liebling/assets/js/app.js
dragonwocky 246fdb865d
chore: better attribution in footer, remove commented code
rely on git to compare with upstream instead of comments
2023-11-09 16:56:29 +11:00

1 line
17 KiB
JavaScript

(self.webpackChunkliebling=self.webpackChunkliebling||[]).push([[773],{480:(t,e,n)=>{"use strict";var r=n(755),o=n.n(r),i=n(631),a=n.n(i),c=n(488),l=(n(418),n(433)),s=n(414),u=n(911),f=(n(350),n(769)),d=n(360),h=n.n(d);n(531);function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function m(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */m=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new E(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return C()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=x(a,n);if(c){if(c===u)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(t,e,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(t,n,a),i}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var u={};function f(){}function d(){}function h(){}var v={};c(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(L([])));g&&g!==e&&n.call(g,o)&&(v=g);var b=h.prototype=f.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var l=s(t[o],t,i);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==p(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(l.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,u;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=h,c(b,"constructor",h),c(h,"constructor",d),d.displayName=c(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(j.prototype),c(j.prototype,i,(function(){return this})),t.AsyncIterator=j,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new j(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),c(b,a,"Generator"),c(b,o,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=L,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(c&&l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),u},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;S(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function v(t){return function(t){if(Array.isArray(t))return y(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function g(t,e,n,r,o,i,a){try{var c=t[i](a),l=c.value}catch(t){return void n(t)}c.done?e(l):Promise.resolve(l).then(r,o)}o()((function(){(0,f.dZ)()&&o()("html").attr("dir","rtl").addClass("rtl");var t=o()("body"),e=o()(".js-header"),n=o()("#announcement-bar-root"),r=o()(".js-open-menu"),i=o()(".js-close-menu"),d=o()(".js-menu"),p=o()(".js-toggle-submenu"),y=o()(".js-submenu-option")[0],b=o()(".js-submenu"),w=o()(".js-recent-slider"),j=o()(".js-open-secondary-menu"),x=o()(".js-open-search"),k=o()(".js-close-search"),S=o()(".js-search"),E=o()(".js-input-search"),L=o()(".js-search-results"),C=o()(".js-no-results"),A=o()(".js-toggle-darkmode"),_=o()(".js-main-nav"),O=o()(".js-main-nav-left"),T=o()(".js-newsletter"),P=o()(".js-native-comments > div > iframe")[0],I=localStorage.getItem("theme"),N=null,M=!1,q=null,Z=function(){e.removeClass("submenu-is-active"),p.removeClass("active"),b.removeClass("opened").addClass("closed")},G=function(){t.toggleClass("no-scroll-y")},H=function(){var t,e=(t=m().mark((function t(e,n){var r,o,i;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new s.Z({url:e,key:n,version:"v5.0"}),t.prev=1,t.next=4,r.posts.browse({limit:"all",include:"tags",fields:"id, title, url, published_at, plaintext"});case 4:return o=t.sent,t.next=7,r.pages.browse({limit:"all",include:"tags",fields:"id, title, url, published_at, plaintext"});case 7:i=t.sent,N=[].concat(v(i),v(o)),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),console.log(t.t0);case 14:case"end":return t.stop()}}),t,null,[[1,11]])})),function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){g(i,r,o,a,c,"next",t)}function c(t){g(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t,n){return e.apply(this,arguments)}}(),F=function(t){(0,f.tq)()||(t?(_.addClass("toggle-overflow"),O.addClass("toggle-overflow")):(_.removeClass("toggle-overflow"),O.removeClass("toggle-overflow")))};(r.on("click",(function(){e.addClass("mobile-menu-opened"),d.addClass("opened"),G()})),i.on("click",(function(){e.removeClass("mobile-menu-opened"),d.removeClass("opened"),G()})),p.on("click",(function(){(M=!M)?(e.addClass("submenu-is-active"),p.addClass("active"),b.removeClass("closed").addClass("opened")):Z()})),x.on("click",(function(){S.addClass("opened"),setTimeout((function(){E.trigger("focus")}),400),G()})),k.on("click",(function(){E.trigger("blur"),S.removeClass("opened"),G()})),E.on("keyup",(function(){if(E.val().length>0&&N){var t=h().go(E.val(),N,{keys:["title","plaintext"],limit:4}),e="";if(t.length>0){for(var n=0,r=t.length;n<r;n++){var o,i,a=h().highlight(t[n][0])||t[n].obj.title,c=192,l=h().highlight(t[n][1]),s=!1;if(l){var u=l.indexOf("<b>")-48;u>0&&(l="..."+l.slice(u)),l.length>c&&(l=l.slice(0,c),s=!0)}else l=t[n].obj.plaintext.slice(0,c),t[n].obj.plaintext.length>c&&(l=l.split(" ").slice(0,-1).join(" "),s=!0);(null===(o=l.match(/<b>/g))||void 0===o?void 0:o.length)>(null===(i=l.match(/<\/b>/g))||void 0===i?void 0:i.length)&&(l+="</b>"),s&&(l+="..."),e+='\n <article class="m-result"> <a href="'.concat(t[n].obj.url,'" class="m-result__link"> <h3 class="m-result__title">').concat(a,'</h3> <span class="m-result__date">').concat(l,"</span> </a> </article>")}C.hide(),L.html(e),L.show()}else L.html(""),L.hide(),C.show()}else L.html(""),L.hide(),C.hide()})),A.on("change",(function(){A.is(":checked")?(o()("html").attr("data-theme","dark"),localStorage.setItem("theme","dark")):(o()("html").attr("data-theme","light"),localStorage.setItem("theme","light")),P&&P.contentDocument.location.reload(!0)})),A.on("mouseenter",(function(){F(!0)})),A.on("mouseleave",(function(){F(!1)})),o()(window).on("click",(function(t){M&&y&&!y.contains(t.target)&&(M=!1,Z())})),o()(document).on("keyup",(function(t){"Escape"===t.key&&S.hasClass("opened")&&k.trigger("click")})),I&&"dark"===I&&A.each((function(){o()(this).attr("checked",!0)})),e.length>0)&&new(a())(e[0],{tolerance:{down:10,up:20},offset:15,onUnpin:function(){if(!(0,f.tq)()&&q){var t=q[0];t&&t.state.isVisible&&t.hide()}}}).init();if(n.length>0){e.addClass("with-announcement-bar"),setTimeout((function(){e.removeAttr("data-animate")}),500);var z=new MutationObserver((function(t){if(t[0].addedNodes.length){n.detach().prependTo(e);var r=n.height();document.documentElement.style.setProperty("--announcement-bar-height","".concat(r,"px"))}t[0].removedNodes.length&&document.documentElement.style.setProperty("--announcement-bar-height","0px")})),R=new ResizeObserver((function(t){t.forEach((function(t){var e=t.contentRect.height;document.documentElement.style.setProperty("--announcement-bar-height","".concat(e,"px"))}))}));z.observe(n[0],{childList:!0}),R.observe(n[0])}else setTimeout((function(){e.removeAttr("data-animate")}),500);if(w.length>0)new u.ZP(".js-recent-slider",{modules:[u.Rv,u.s5],freeMode:!0,slidesPerView:"auto",a11y:!0,on:{init:function(){(0,l.Z)(".js-recent-article-title",50)}}});if(j.length>0){var U=document.getElementById("secondary-navigation-template");q=(0,c.ZP)(".js-open-secondary-menu",{appendTo:document.body,content:U.innerHTML,allowHTML:!0,arrow:!0,trigger:"click",interactive:!0,onShow:function(){F(!0)},onHidden:function(){F(!1)}})}(0,c.ZP)(".js-tooltip",{allowHTML:!0}),(0,l.Z)(".js-article-card-title",100),(0,l.Z)(".js-article-card-title-no-image",250),"undefined"!=typeof disableNewsletter&&disableNewsletter&&T.remove(),"undefined"!=typeof ghostSearchApiKey&&"undefined"==typeof nativeSearchEnabled?H(ghostHost,ghostSearchApiKey):(x.css("visibility","hidden"),k.remove(),S.remove())}))},769:(t,e,n)=>{"use strict";n.d(e,{dZ:()=>r,e:()=>i,eS:()=>a,ej:()=>c,tq:()=>o});var r=function(){var t=document.querySelector("html");return["ar","he","fa"].includes(t.getAttribute("lang"))},o=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"768px";return window.matchMedia("(max-width: ".concat(t,")")).matches},i=function(){for(var t=document.querySelectorAll(".kg-gallery-image img"),e=0,n=t.length;e<n;e++){var r=t[e].closest(".kg-gallery-image"),o=t[e].attributes.width.value/t[e].attributes.height.value;r.style.flex="".concat(o," 1 0%")}},a=function(t){t(".js-post-content").find("img").each((function(){t(this).closest("figure").hasClass("kg-bookmark-card")||t(this).closest("figure").hasClass("kg-nft-card")||t(this).parent().is("a")||t(this).hasClass("kg-product-card-image")||t(this).hasClass("kg-audio-thumbnail")||t(this).addClass("js-zoomable")}))},c=function(t,e){e(".js-zoomable").on("opened",(function(){setTimeout((function(){var e=t(".medium-zoom-image--opened");e.length>1&&e.last().hide()}),10)}))}},531:()=>{function t(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return c=t.done,t},e:function(t){l=!0,a=t},f:function(){try{c||null==r.return||r.return()}finally{if(l)throw a}}}}function e(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var o='<div class="paypal-order">\n <div class="paypal-order-total"></div>\n <div class="paypal-order-checkout m-button primary focusable" role="button" tabindex="0"><span>Checkout with</span> <span title="PayPal" class="paypal-checkout-logo"></span></div>\n </div>'.replace(/\s+/g," "),i=function(t){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild},a=function(t,e){var n=parseInt(t.dataset[e]);return isNaN(n)&&(n=0),n},c=function(t,e){t.addEventListener("click",e),t.addEventListener("keydown",(function(t){["Space","Enter"].includes(t.code)&&e()}))},l=function(n){var r=n.dataset.id,l=i(o),s=e(n.querySelectorAll(".paypal-item")),u=l.querySelector(".paypal-order-total"),f=l.querySelector(".paypal-order-checkout"),d=n.querySelector(".paypal-confirmation");d?d.before(l):n.append(l);var h=function(t){return a(t,"count")},p=function(){return s.reduce((function(t,e){return t+h(e)*function(t){return a(t,"cost")}(e)}),0)},m=function(){return u.innerText="$".concat(p())},v=function(t,e){t.dataset.count=Math.max(h(t)+e,0),m()};m();var y,g=t(s);try{var b=function(){var t=y.value,e=i('<div class="paypal-item-add m-button primary focusable" title="+1" role="button" tabindex="0"><i class="icon-plus"></i></div>'),n=i('<div class="paypal-item-remove m-button primary focusable" title="-1" role="button" tabindex="0"><i class="icon-minus"></i></div>');c(e,(function(){return v(t,1)})),c(n,(function(){return v(t,-1)})),t.append(n,e)};for(g.s();!(y=g.n()).done;)b()}catch(t){g.e(t)}finally{g.f()}c(f,(function(){console.log({cart:r,items:s.map((function(t){return{id:t.dataset.id,count:h(t)}}))}),d&&d.style.setProperty("display","flex")}))};document.addEventListener("DOMContentLoaded",(function(){var e,n=t(document.querySelectorAll(".paypal-cart"));try{for(n.s();!(e=n.n()).done;){var r=e.value;l(r)}}catch(t){n.e(t)}finally{n.f()}}))}},t=>{t.O(0,[898],(()=>{return e=480,t(t.s=e);var e}));t.O()}]);