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e,EAAKrB,aAAe,IAC3D,EAAKN,SAASyB,YAAY,UAC1B,EAAKxB,cAAe,IAEpB,EAAKD,SAAS0B,SAAS,UACvB,EAAKzB,cAAe,EAEvB,IACA0C,QAAO,WACN,EAAKzC,SAAU,CAChB,GAjDF,CAkDF,CACF,E,MC5FDnC,EAAO,WACL6E,EAAAA,MACD,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/beautycon/assets/js/loadmore.js","webpack://essence_site/./wp/wp-content/themes/beautycon/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  this.loadnext = $(\".loadnext\");\n  this.viewnext = $(\".viewnext\");\n  this.loadByScroll = true;\n  this.loading = false;\n  this.nextpage = 2;\n  this.totalPages = this.loadnext.data(\"total_pages\");\n  this.clickCounter = 0;\n\n  this.init = () => {\n    if (this.loadnext.length) {\n      this.initObserver();\n      this.register();\n    }\n  };\n\n  this.initObserver = () => {\n    const observer = new IntersectionObserver(\n      (entries, observer) => {\n        entries.forEach((entry) => {\n          if (entry.intersectionRatio > 0) {\n            this.load(true);\n          }\n        });\n      },\n      {\n        threshold: 0.1,\n      }\n    );\n    observer.observe(this.loadnext.get(0));\n  };\n\n  this.register = () => {\n    this.viewnext.on(\"click\", (e) => {\n      e.preventDefault();\n      this.load(false);\n    });\n  };\n\n  this.load = (isScroll) => {\n    if (this.loading || (isScroll && !this.loadByScroll)) {\n      return;\n    }\n\n    this.loading = true;\n    this.loadnext.removeClass(\"hidden\");\n    this.viewnext.addClass(\"hidden\");\n\n    if (!isScroll) {\n      this.clickCounter++;\n    }\n\n    const pagesToShow = parseInt(this.loadnext.data(\"pages_to_show\"));\n    const attributes = this.loadnext.data(\"attributes\");\n\n    let action = \"\";\n    if (this.loadnext.hasClass(\"search\")) {\n      action = \"search_scroll\";\n    } else if (this.loadnext.hasClass(\"archive\")) {\n      action = \"archive_load_more\";\n    } else {\n      return;\n    }\n\n    $.ajax({\n      url: `${pubstack.ajaxUrl}?action=${action}`,\n      dataType: \"html\",\n      method: \"POST\",\n      data: { ...attributes, page: this.nextpage },\n    })\n      .done((response) => {\n        $(response).insertBefore(this.loadnext);\n        this.loadnext.addClass(\"hidden\");\n        this.nextpage++;\n\n        if (this.nextpage && this.nextpage > this.totalPages) {\n          this.viewnext.remove();\n          this.loadnext.remove();\n          return;\n        }\n\n        if (this.nextpage - 1 === pagesToShow * (this.clickCounter + 1)) {\n          this.viewnext.removeClass(\"hidden\");\n          this.loadByScroll = false;\n        } else {\n          this.viewnext.addClass(\"hidden\");\n          this.loadByScroll = true;\n        }\n      })\n      .always(() => {\n        this.loading = false;\n      });\n  };\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  LoadMore.init();\n});\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","LoadMore"],"sourceRoot":""}