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wB,GAAe,EAAKrB,aAAe,IAC5D,EAAKN,SAASyB,YAAY,UAC1B,EAAKxB,cAAe,IAEpB,EAAKD,SAAS0B,SAAS,UACvB,EAAKzB,cAAe,EAErB,IACA0C,QAAO,WACP,EAAKzC,SAAU,CACf,GAjDD,CAkDD,CACD,E,ICxDGW,EA/Bc+B,EACbC,EAQL,SAASC,IACR,IAwBMC,EAxBAC,EAAaC,OAAOC,SAASC,KAC7BlB,EAAM,IAAImB,IAAIJ,GACdK,EAAS,IAAIC,gBAAgBrB,EAAIsB,QAKnCF,EAAOG,IAHM,aAGWH,EAAOG,IAFlB,YAIZ3C,GACHA,EAAS4C,aAIN5C,IAUCkC,EAAWW,SAASC,iBAAiB,eAC3C9C,EAAW,IAAIF,sBAAqB,SAACC,GACpCA,EAAQE,SAAQ,SAACC,GACZA,EAAM6C,gBACTC,QAAQC,IAAI,0BAA2B/C,EAAMgD,OAE9C,GACD,IAEDhB,EAASjC,SAAQ,SAACkD,GAAD,OAAanD,EAASM,QAAQ6C,EAA9B,IAfjB,C,OAjCDjG,EAAO,WACNkG,EAAAA,MACA,IAkDDnB,IAGAG,OAAOiB,iBAAiB,UAlDNtB,EAkDyBE,EAAiB,IAhDpD,WAAmB,kCAANqB,EAAM,yBAANA,EAAM,gBACzBC,aAAavB,GACbA,EAAUwB,YAAW,kBAAMzB,EAAK0B,MAAM,EAAMH,EAAvB,GA8CqC,IA7C1D,G","sources":["webpack://essence_site/external var \"jQuery\"","webpack://essence_site/webpack/bootstrap","webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://essence_site/./wp/wp-content/themes/essence/assets/js/loadmore.js","webpack://essence_site/./wp/wp-content/themes/essence/assets/loadmore.js"],"sourcesContent":["module.exports = jQuery;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","/**\n * Infinite scroll behavior on posts section.\n *\n * Load {pagesToShow} pages by scroll\n * - on page load\n * - each time user clicks `Load More` button\n */\nfunction LoadMore() {\n\tthis.loadnext = $(\".loadnext\");\n\tthis.viewnext = $(\".viewnext\");\n\tthis.loadByScroll = true;\n\tthis.loading = false;\n\tthis.nextpage = 2;\n\tthis.totalPages = this.loadnext.data(\"total_pages\");\n\tthis.clickCounter = 0;\n\n\tthis.init = () => {\n\t\tif (this.loadnext.length) {\n\t\t\tthis.initObserver();\n\t\t\tthis.register();\n\t\t}\n\t};\n\n\tthis.initObserver = () => {\n\t\tconst observer = new IntersectionObserver(\n\t\t\t(entries, observer) => {\n\t\t\t\tentries.forEach((entry) => {\n\t\t\t\t\tif (entry.intersectionRatio > 0) {\n\t\t\t\t\t\tthis.load(true);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t{\n\t\t\t\tthreshold: 0.1,\n\t\t\t}\n\t\t);\n\t\tobserver.observe(this.loadnext.get(0));\n\t};\n\n\tthis.register = () => {\n\t\tthis.viewnext.on(\"click\", (e) => {\n\t\t\te.preventDefault();\n\t\t\tthis.load(false);\n\t\t});\n\t};\n\n\tthis.load = (isScroll) => {\n\t\tif (this.loading || (isScroll && !this.loadByScroll)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.loading = true;\n\t\tthis.loadnext.removeClass(\"hidden\");\n\t\tthis.viewnext.addClass(\"hidden\");\n\n\t\tif (!isScroll) {\n\t\t\tthis.clickCounter++;\n\t\t}\n\n\t\tconst pagesToShow = parseInt(this.loadnext.data(\"pages_to_show\"));\n\t\tconst attributes = this.loadnext.data(\"attributes\");\n\n\t\tlet action = \"\";\n\t\tif (this.loadnext.hasClass(\"search\")) {\n\t\t\taction = \"search_scroll\";\n\t\t} else if (this.loadnext.hasClass(\"archive\")) {\n\t\t\taction = \"archive_load_more\";\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\n\t\t$.ajax({\n\t\t\turl: `${pubstack.ajaxUrl}?action=${action}`,\n\t\t\tdataType: \"html\",\n\t\t\tmethod: \"POST\",\n\t\t\tdata: { ...attributes, page: this.nextpage },\n\t\t})\n\t\t\t.done((response) => {\n\t\t\t\t$(response).insertBefore(this.loadnext);\n\t\t\t\tthis.loadnext.addClass(\"hidden\");\n\t\t\t\tthis.nextpage++;\n\n\t\t\t\tif (this.nextpage && this.nextpage > this.totalPages) {\n\t\t\t\t\tthis.viewnext.remove();\n\t\t\t\t\tthis.loadnext.remove();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (this.nextpage - 1 === pagesToShow * (this.clickCounter + 1)) {\n\t\t\t\t\tthis.viewnext.removeClass(\"hidden\");\n\t\t\t\t\tthis.loadByScroll = false;\n\t\t\t\t} else {\n\t\t\t\t\tthis.viewnext.addClass(\"hidden\");\n\t\t\t\t\tthis.loadByScroll = true;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.always(() => {\n\t\t\t\tthis.loading = false;\n\t\t\t});\n\t};\n}\n\nexport default new LoadMore();\n","/**\n * Handle infinite scrolling of posts.\n *\n * This is the file that Webpack is compiling into loadmore.[hash].js\n */\n\nimport LoadMore from \"./js/loadmore\"; // 2KB\n\njQuery(function () {\n\tLoadMore.init();\n});\n\n// Debounce function to limit the rate at which a function is called\nfunction debounce(func, wait) {\n\tlet timeout;\n\treturn function (...args) {\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(() => func.apply(this, args), wait);\n\t};\n}\n\n// Function to check viewport width and toggle event listeners/observers\nfunction toggleListeners() {\n\tconst currentUrl = window.location.href;\n\tconst url = new URL(currentUrl);\n\tconst params = new URLSearchParams(url.search);\n\n\tconst appView1 = \"appview1\";\n\tconst appView2 = \"appview2\";\n\n\tif (params.has(appView1) || params.has(appView2)) {\n\t\t// Disable IntersectionObserver (if any)\n\t\tif (observer) {\n\t\t\tobserver.disconnect();\n\t\t}\n\t} else {\n\t\t// Re-enable IntersectionObserver (if any)\n\t\tif (observer) {\n\t\t\tobserveElements();\n\t\t}\n\t}\n}\n\n// Example IntersectionObserver setup\nlet observer;\n\nfunction observeElements() {\n\tconst elements = document.querySelectorAll(\".observe-me\");\n\tobserver = new IntersectionObserver((entries) => {\n\t\tentries.forEach((entry) => {\n\t\t\tif (entry.isIntersecting) {\n\t\t\t\tconsole.log(\"Element is in viewport:\", entry.target);\n\t\t\t}\n\t\t});\n\t});\n\n\telements.forEach((element) => observer.observe(element));\n}\n\n// Initial check and setup\ntoggleListeners();\n\n// Debounced resize event listener\nwindow.addEventListener(\"resize\", debounce(toggleListeners, 100));\n"],"names":["module","exports","jQuery","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","_typeof","obj","Symbol","iterator","constructor","prototype","_defineProperty","key","value","arg","input","hint","prim","toPrimitive","res","call","TypeError","String","Object","defineProperty","enumerable","configurable","writable","this","loadnext","$","viewnext","loadByScroll","loading","nextpage","totalPages","data","clickCounter","init","length","initObserver","register","IntersectionObserver","entries","observer","forEach","entry","intersectionRatio","load","threshold","observe","get","on","e","preventDefault","isScroll","removeClass","addClass","pagesToShow","parseInt","attributes","action","hasClass","ajax","url","pubstack","ajaxUrl","dataType","method","page","done","response","insertBefore","remove","always","func","timeout","toggleListeners","elements","currentUrl","window","location","href","URL","params","URLSearchParams","search","has","disconnect","document","querySelectorAll","isIntersecting","console","log","target","element","LoadMore","addEventListener","args","clearTimeout","setTimeout","apply"],"sourceRoot":""}