2 lines
126 KiB
JavaScript
2 lines
126 KiB
JavaScript
(()=>{"use strict";function t(e){return t="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},t(e)}function e(){e=function(){return n};var r,n={},o=Object.prototype,a=o.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{s({},"")}catch(r){s=function(t,e,r){return t[e]=r}}function f(t,e,n,o){var a=e&&e.prototype instanceof d?e:d,i=Object.create(a.prototype);return s(i,"_invoke",function(t,e,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:r,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===p)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=h(t,e,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(t,n,new j(o||[])),!0),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=f;var p={};function d(){}function v(){}function y(){}var g={};s(g,u,function(){return this});var m=Object.getPrototypeOf,b=m&&m(m(O([])));b&&b!==o&&a.call(b,u)&&(g=b);var w=y.prototype=d.prototype=Object.create(g);function _(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function x(e,r){function n(o,i,u,c){var l=h(e[o],e,i);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==t(f)&&a.call(f,"__await")?r.resolve(f.__await).then(function(t){n("next",t,u,c)},function(t){n("throw",t,u,c)}):r.resolve(f).then(function(t){s.value=t,u(s)},function(t){return n("throw",t,u,c)})}c(l.arg)}var o;s(this,"_invoke",function(t,e){function a(){return new r(function(r,o){n(t,e,r,o)})}return o=o?o.then(a,a):a()},!0)}function E(t,e){var n=e.method,o=t.i[n];if(o===r)return e.delegate=null,"throw"===n&&t.i.return&&(e.method="return",e.arg=r,E(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var a=h(o,t.i,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,p;var i=a.arg;return i?i.done?(e[t.r]=i.value,e.next=t.n,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function k(t){this.tryEntries.push(t)}function S(t){var e=t[4]||{};e.type="normal",e.arg=r,t[4]=e}function j(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function O(e){if(null!=e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function t(){for(;++o<e.length;)if(a.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return i.next=i}}throw new TypeError(t(e)+" is not iterable")}return v.prototype=y,s(w,"constructor",y),s(y,"constructor",v),v.displayName=s(y,l,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,l,"GeneratorFunction")),t.prototype=Object.create(w),t},n.awrap=function(t){return{__await:t}},_(x.prototype),s(x.prototype,c,function(){return this}),n.AsyncIterator=x,n.async=function(t,e,r,o,a){void 0===a&&(a=Promise);var i=new x(f(t,e,r,o),a);return n.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(w),s(w,l,"Generator"),s(w,u,function(){return this}),s(w,"toString",function(){return"[object Generator]"}),n.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},n.values=O,j.prototype={constructor:j,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r){i.type="throw",i.arg=t,e.next=r}for(var o=e.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=r,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],p):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),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),S(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={i:O(t),r:e,n},"next"===this.method&&(this.arg=r),p}},n}function r(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function n(){var t;return t=e().mark(function t(r,n){return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r.classList.add("unavailable-popup-table--active"),n.classList.add("overlay--active");case 2:case"end":return t.stop()}},t)}),n=function(){var e=this,n=arguments;return new Promise(function(o,a){var i=t.apply(e,n);function u(t){r(i,o,a,u,c,"next",t)}function c(t){r(i,o,a,u,c,"throw",t)}u(void 0)})},n.apply(this,arguments)}function o(){var t=document.querySelector(".unavailable-popup-table"),e=document.querySelector(".unavailable__table-wrapper--products"),r=document.querySelector(".unavailable__table-wrapper--categories"),n=document.querySelector(".overlay"),o=null==r?void 0:r.querySelector(".unavailable__no-results");t.classList.remove("unavailable-popup-table--active"),e.classList.add("unavailable__table-wrapper--hidden"),r.classList.remove("unavailable__table-wrapper--hidden"),n.classList.remove("overlay--active"),o&&o.remove()}function a(t){return a="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},a(t)}function i(){i=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(e,r,n,o){var a=r&&r.prototype instanceof d?r:d,i=Object.create(a.prototype);return s(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===p)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new j(o||[])),!0),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p={};function d(){}function v(){}function y(){}var g={};s(g,u,function(){return this});var m=Object.getPrototypeOf,b=m&&m(m(O([])));b&&b!==r&&n.call(b,u)&&(g=b);var w=y.prototype=d.prototype=Object.create(g);function _(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function x(t,e){function r(o,i,u,c){var l=h(t[o],t,i);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==a(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,u,c)},function(t){r("throw",t,u,c)}):e.resolve(f).then(function(t){s.value=t,u(s)},function(t){return r("throw",t,u,c)})}c(l.arg)}var o;s(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function E(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var a=h(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,p;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function k(t){this.tryEntries.push(t)}function S(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function j(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function O(e){if(null!=e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(a(e)+" is not iterable")}return v.prototype=y,s(w,"constructor",y),s(y,"constructor",v),v.displayName=s(y,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,l,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},_(x.prototype),s(x.prototype,c,function(){return this}),e.AsyncIterator=x,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new x(f(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(w),s(w,l,"Generator"),s(w,u,function(){return this}),s(w,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=O,j.prototype={constructor:j,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],p):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),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),S(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:O(e),r,n},"next"===this.method&&(this.arg=t),p}},e}function u(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function c(){return l.apply(this,arguments)}function l(){var t;return t=i().mark(function t(){var e,r,n;return i().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=window.location.origin,t.next=4,fetch("".concat(e).concat("/wp-json/inpost/v1/izi/product/categories"),{credentials:"same-origin",headers:{"Content-Type":"application/json",cache:"no-cache"}});case 4:return r=t.sent,t.next=7,r.json();case 7:if(n=t.sent,r.ok){t.next=10;break}throw new Error(n.error);case 10:if(200===r.status){t.next=12;break}return t.abrupt("return");case 12:return t.abrupt("return",n);case 13:case"end":return t.stop()}},t)}),l=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){u(a,n,o,i,c,"next",t)}function c(t){u(a,n,o,i,c,"throw",t)}i(void 0)})},l.apply(this,arguments)}function s(t){return s="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},s(t)}function f(){f=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof d?r:d,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===p)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new j(o||[])),!0),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p={};function d(){}function v(){}function y(){}var g={};c(g,a,function(){return this});var m=Object.getPrototypeOf,b=m&&m(m(O([])));b&&b!==r&&n.call(b,a)&&(g=b);var w=y.prototype=d.prototype=Object.create(g);function _(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function x(t,e){function r(o,a,i,u){var c=h(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==s(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function E(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var a=h(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,p;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function k(t){this.tryEntries.push(t)}function S(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function j(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function O(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(s(e)+" is not iterable")}return v.prototype=y,c(w,"constructor",y),c(y,"constructor",v),v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},_(x.prototype),c(x.prototype,i,function(){return this}),e.AsyncIterator=x,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new x(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(w),c(w,u,"Generator"),c(w,a,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=O,j.prototype={constructor:j,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],p):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),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),S(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:O(e),r,n},"next"===this.method&&(this.arg=t),p}},e}function h(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}var p,d=null;function v(t,e){return y.apply(this,arguments)}function y(){var t;return t=f().mark(function t(e,r){var n,o,a,i,u,c,l,s=arguments;return f().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>2&&void 0!==s[2]?s[2]:1,o=window.location.origin,a=e?"category_id=".concat(e):"",i=r?"&search=".concat(r):"",u="&page=".concat(n),d&&d.abort(),d=new AbortController,t.prev=9,t.next=12,fetch("".concat(o).concat("/wp-json/inpost/v1/izi/product/list","?").concat(a).concat("&type=hotproduct").concat(i).concat(u),{credentials:"same-origin",headers:{"Content-Type":"application/json",cache:"no-cache"},signal:d.signal});case 12:return c=t.sent,t.next=15,c.json();case 15:if(l=t.sent,c.ok){t.next=18;break}throw new Error(l.error);case 18:if(200===c.status){t.next=20;break}return t.abrupt("return");case 20:return d=null,t.abrupt("return",l);case 24:if(t.prev=24,t.t0=t.catch(9),"AbortError"!==t.t0.name){t.next=28;break}throw new Error("Request cancelled");case 28:throw t.t0;case 29:case"end":return t.stop()}},t,null,[[9,24]])}),y=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){h(a,n,o,i,u,"next",t)}function u(t){h(a,n,o,i,u,"throw",t)}i(void 0)})},y.apply(this,arguments)}function g(t){return g="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},g(t)}function m(){m=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new j(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,b=y&&y(y(O([])));b&&b!==r&&n.call(b,a)&&(v=b);var w=d.prototype=h.prototype=Object.create(v);function _(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function x(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==g(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function E(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function k(t){this.tryEntries.push(t)}function S(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function j(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function O(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(g(e)+" is not iterable")}return p.prototype=d,c(w,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},_(x.prototype),c(x.prototype,i,function(){return this}),e.AsyncIterator=x,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new x(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(w),c(w,u,"Generator"),c(w,a,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=O,j.prototype={constructor:j,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),S(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:O(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function b(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function w(t){return _.apply(this,arguments)}function _(){var t;return t=m().mark(function t(e){var r,n,o;return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=window.location.origin,t.next=4,fetch("".concat(r).concat("/wp-json/inpost/v1/izi/unavailable/add"),{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",cache:"no-cache"},body:JSON.stringify({products:e})});case 4:return n=t.sent,t.next=7,n.json();case 7:if(o=t.sent,n.ok){t.next=10;break}throw new Error(o.error);case 10:if(200===n.status){t.next=12;break}return t.abrupt("return");case 12:return t.abrupt("return",o);case 13:case"end":return t.stop()}},t)}),_=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){b(a,n,o,i,u,"next",t)}function u(t){b(a,n,o,i,u,"throw",t)}i(void 0)})},_.apply(this,arguments)}function x(t){var e=document.querySelector(".unavailable-wrapper");if(e){var r=document.querySelectorAll(".unavailable-error-alert");r.length>0&&r.forEach(function(t){t.remove()});var n=' \n <div class="unavailable-error-alert__content">\n <h3 class="unavailable-error-alert__title">'.concat(e.dataset.apiErrorTitle,'</h3>\n <p class="unavailable-error-alert__text">').concat(t,"</p>\n </div>"),o=document.createElement("div");o.classList="unavailable-error-alert unavailable-error-alert--active",o.innerHTML=n,e.appendChild(o),setTimeout(function(){o.classList.remove("unavailable-error-alert--active")},5e3)}}function E(t){return E="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},E(t)}function k(){k=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new j(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(O([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==E(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function S(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function j(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function O(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(E(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=O,j.prototype={constructor:j,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),S(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:O(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function S(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function j(){return O.apply(this,arguments)}function O(){var t;return t=k().mark(function t(){var e,r,n;return k().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=window.location.origin,t.next=4,fetch("".concat(e).concat("/wp-json/inpost/v1/izi/unavailable/products"),{credentials:"same-origin",headers:{"Content-Type":"application/json",cache:"no-cache"}});case 4:return r=t.sent,t.next=7,r.json();case 7:if(n=t.sent,r.ok){t.next=10;break}throw new Error(n.error);case 10:if(200===r.status){t.next=12;break}return t.abrupt("return");case 12:return t.abrupt("return",n.products);case 13:case"end":return t.stop()}},t)}),O=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){S(a,n,o,i,u,"next",t)}function u(t){S(a,n,o,i,u,"throw",t)}i(void 0)})},O.apply(this,arguments)}function T(t){return T="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},T(t)}function q(){q=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==T(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(T(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function P(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function G(t){return N.apply(this,arguments)}function N(){var t;return t=q().mark(function t(e){var r,n,o;return q().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=window.location.origin,t.next=4,fetch("".concat(r).concat("/wp-json/inpost/v1/izi/unavailable/remove"),{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",cache:"no-cache"},body:JSON.stringify({items:[e]})});case 4:return n=t.sent,t.next=7,n.json();case 7:if(o=t.sent,n.ok){t.next=10;break}throw new Error(o.error);case 10:if(200===n.status){t.next=12;break}return t.abrupt("return");case 12:return t.abrupt("return",o);case 13:case"end":return t.stop()}},t)}),N=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){P(a,n,o,i,u,"next",t)}function u(t){P(a,n,o,i,u,"throw",t)}i(void 0)})},N.apply(this,arguments)}function L(t){return L="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},L(t)}function A(){A=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==L(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(L(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function F(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function C(){return I.apply(this,arguments)}function I(){var t;return t=A().mark(function t(){var e,r,n;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=window.location.origin,t.next=4,fetch("".concat(e).concat("/wp-json/inpost/v1/izi/unavailable/remove/products"),{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",cache:"no-cache"}});case 4:return r=t.sent,t.next=7,r.json();case 7:if(n=t.sent,r.ok){t.next=10;break}throw new Error(n.error);case 10:if(200===r.status){t.next=12;break}return t.abrupt("return");case 12:return t.abrupt("return",n);case 13:case"end":return t.stop()}},t)}),I=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){F(a,n,o,i,u,"next",t)}function u(t){F(a,n,o,i,u,"throw",t)}i(void 0)})},I.apply(this,arguments)}function M(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=document.querySelector(".unavailable__remove-all");e&&(e.style.display=t?"flex":"none")}function B(t){return B="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},B(t)}function H(){H=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==B(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(B(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function z(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function Y(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){z(a,n,o,i,u,"next",t)}function u(t){z(a,n,o,i,u,"throw",t)}i(void 0)})}}function R(){return U.apply(this,arguments)}function U(){return U=Y(H().mark(function t(){var e,r,n,o,a,i,u,c,l,s,f,h,p,d=arguments;return H().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=d.length>0&&void 0!==d[0]?d[0]:null,r=document.querySelector(".unavailable__table--unavailable tbody"),n=document.querySelector(".unavailable__remove-all"),r&&n){t.next=5;break}return t.abrupt("return");case 5:return n.replaceWith(n.cloneNode(!0)),o=document.querySelector(".unavailable__remove-all"),r.innerHTML='\n <tr>\n <td colspan="7" style="text-align: center">\n <div class="unavailable__loader">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" style="height: 40px;">\n <radialGradient id="loader-gradient-unavailable" cx=".66" fx=".66" cy=".3125" fy=".3125" gradientTransform="scale(1.5)">\n <stop offset="0" stop-color="#0085BA"/>\n <stop offset=".3" stop-color="#0085BA" stop-opacity=".9"/>\n <stop offset=".6" stop-color="#0085BA" stop-opacity=".6"/>\n <stop offset=".8" stop-color="#0085BA" stop-opacity=".3"/>\n <stop offset="1" stop-color="#0085BA" stop-opacity="0"/>\n </radialGradient>\n <circle transform-origin="center" fill="none" stroke="url(#loader-gradient-unavailable)" stroke-width="15" stroke-linecap="round" stroke-dasharray="200 1000" stroke-dashoffset="0" cx="100" cy="100" r="70">\n <animateTransform type="rotate" attributeName="transform" calcMode="spline" dur="2" values="360;0" keyTimes="0;1" keySplines="0 0 1 1" repeatCount="indefinite"/>\n </circle>\n <circle transform-origin="center" fill="none" opacity=".2" stroke="#0085BA" stroke-width="15" stroke-linecap="round" cx="100" cy="100" r="70"/>\n </svg>\n </div>\n </td>\n </tr>\n ',t.prev=9,t.next=12,j();case 12:M((null==(c=t.sent)?void 0:c.length)>0),l=null===(a=document.querySelector(".unavailable-wrapper"))||void 0===a||null===(a=a.dataset)||void 0===a?void 0:a.removeText,s=null===(i=document.querySelector(".unavailable-wrapper"))||void 0===i||null===(i=i.dataset)||void 0===i?void 0:i.courierText,f=null===(u=document.querySelector(".unavailable-wrapper"))||void 0===u||null===(u=u.dataset)||void 0===u?void 0:u.parcelLockerText,r.innerHTML=null!=c&&c.length?c.map(function(t,e){return'\n <tr data-product-id="'.concat(t.id,'">\n <td class="unavailable__td unavailable__td--count">').concat(e+1,'.</td>\n <td class="unavailable__td unavailable__td--product-name">\n <a href="/wp-admin/post.php?post=').concat(t.product_id,'&action=edit" target="_blank">\n ').concat(t.title,'\n </a>\n </td>\n <td class="unavailable__td unavailable__td--id">').concat(t.product_id,'</td>\n <td class="unavailable__td unavailable__td--actions">\n <div class="unavailable__checkbox-wrapper">\n <input type="checkbox" class="unavailable__checkbox unavailable__checkbox--courier" data-product-id="').concat(t.product_id,'" ').concat("2"===t.delivery_type||"3"===t.delivery_type?"checked":"",' />\n <label class="unavailable__checkbox-label">\n ').concat(s,'\n </label>\n </div>\n <div class="unavailable__checkbox-wrapper">\n <input type="checkbox" class="unavailable__checkbox unavailable__checkbox--parcel-locker" data-product-id="').concat(t.product_id,'" ').concat("1"===t.delivery_type||"3"===t.delivery_type?"checked":"",' />\n <label class="unavailable__checkbox-label">\n ').concat(f,'\n </label>\n </div>\n <div>\n <button class="inpost-btn inpost-btn--remove-mini">\n <img src="').concat(document.querySelector(".unavailable-wrapper").dataset.pluginUrl,'../../../assets/img/hp-remove.svg" alt="">\n <span>').concat(l,"</span>\n </button>\n </div>\n </td>\n </tr>\n ")}).join(""):'\n <tr>\n <td colspan="7" style="text-align: center;" class="unavailable__no-results-main>\n '.concat(document.querySelector(".unavailable-wrapper").dataset.noResultsMessage,"\n </td>\n </tr>\n "),(h=e||window.unavailablePaginationHandler)&&((p=document.querySelector(".unavailable__search-main"))&&(p.value=""),h.reinitialize()),r.querySelectorAll(".inpost-btn--remove-mini").forEach(function(t){var e=t.cloneNode(!0);t.parentNode.replaceChild(e,t)}),r.querySelectorAll(".unavailable__checkbox").forEach(function(t){t.addEventListener("change",function(){var t=Y(H().mark(function t(e){var r,n,o,a,i,u,c;return H().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.target.closest("tr"),n=r.querySelector(".unavailable__checkbox--courier"),o=r.querySelector(".unavailable__checkbox--parcel-locker"),a=n.checked,i=o.checked,t.prev=5,a||i){t.next=11;break}(u=r.querySelector(".inpost-btn--remove-mini"))&&u.click(),t.next=16;break;case 11:return r.classList.add("removing"),a&&i?c="3":a?c="2":i&&(c="1"),t.next=15,w([{id:r.querySelector(".unavailable__td--id").textContent,delivery_type:c}]);case 15:r.classList.remove("removing");case 16:t.next=24;break;case 18:t.prev=18,t.t0=t.catch(5),console.error("Error updating product delivery type:",t.t0),x(t.t0),e.target.checked=!e.target.checked,r.classList.remove("removing");case 24:case"end":return t.stop()}},t,null,[[5,18]])}));return function(e){return t.apply(this,arguments)}}())}),r.querySelectorAll(".inpost-btn--remove-mini").forEach(function(t){t.addEventListener("click",function(){var t=Y(H().mark(function t(e){var n,o,a;return H().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.target.closest("tr"),o=n.dataset.productId,a=n.innerHTML,t.prev=3,n.classList.add("removing"),t.next=7,G(o);case 7:setTimeout(function(){(n.remove(),h)?h.refresh():r.querySelectorAll("tr").forEach(function(t,e){var r=t.querySelector(".unavailable__td--count");r&&(r.innerHTML='\n <div class="unavailable__td--count-wrapper">\n <span>'.concat(e+1,".</span>\n </div>\n "))});var t=document.querySelector("#unavailable-pagination .unavailable__pagination-total-items");if(t&&!h){var e=parseInt(t.textContent)-1;t.textContent=e}if(!r.querySelectorAll("tr[data-product-id]").length){r.innerHTML='\n <tr>\n <td colspan="7" style="text-align: center;" class="unavailable__no-results-main">\n '.concat(document.querySelector(".unavailable-wrapper").dataset.noResultsMessage,"\n </td>\n </tr>\n ");var o=document.querySelector(".unavailable__remove-all");o&&(o.style.display="none"),t&&!h&&(t.textContent="0")}},300),t.next=16;break;case 10:t.prev=10,t.t0=t.catch(3),console.error("Error removing product:",t.t0),x(t.t0),n.classList.remove("removing"),n.innerHTML=a;case 16:case"end":return t.stop()}},t,null,[[3,10]])}));return function(e){return t.apply(this,arguments)}}())}),o.addEventListener("click",Y(H().mark(function t(){return H().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r.querySelectorAll("tr").forEach(function(t){return t.classList.add("removing")}),t.next=5,C();case 5:setTimeout(function(){r.innerHTML='\n <tr>\n <td colspan="7" style="text-align: center;" class="unavailable__no-results-main">\n '.concat(document.querySelector(".unavailable-wrapper").dataset.noResultsMessage,"\n </td>\n </tr>\n "),o.style.display="none",h&&h.refresh()},300),t.next=13;break;case 8:t.prev=8,t.t0=t.catch(0),x(t.t0),console.error("Error removing all products:",t.t0),rows.forEach(function(t){return t.classList.remove("removing")});case 13:case"end":return t.stop()}},t,null,[[0,8]])}))),t.next=33;break;case 27:t.prev=27,t.t0=t.catch(9),console.error("Error loading hot products:",t.t0),x(t.t0),M(!1),r.innerHTML='\n <tr>\n <td colspan="7" style="text-align: center; color: var(--unavailable-red);">\n '.concat(document.querySelector(".unavailable-wrapper").dataset.apiErrorMessage,"\n </td>\n </tr>\n ");case 33:case"end":return t.stop()}},t,null,[[9,27]])})),U.apply(this,arguments)}function J(t){return J="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},J(t)}function D(){D=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==J(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(J(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function W(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,u=[],c=!0,l=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return $(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function K(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function Q(){var t=document.querySelector(".unavailable__table--products"),e=document.querySelector(".unavailable__table-actions-products-save-btn");if(t&&e){var r=t.getAttribute("data-handler");r&&(t.removeEventListener("change",window[r]),e.removeEventListener("click",window[r+"_save"]));var n=new Map,a=function(t){var r=t.target;if(r.matches('input[type="checkbox"].unavailable__checkbox')){var o=r.closest("tr"),a=o.dataset.productId;if(a){var i,u=o.querySelector(".unavailable__checkbox--courier"),c=o.querySelector(".unavailable__checkbox--parcel-locker"),l=(null==u?void 0:u.checked)||!1,s=(null==c?void 0:c.checked)||!1;if(l||s)i=l&&s?3:l?2:1,n.set(a,i),o.classList.add("selected"),o.style.backgroundColor="#f0f8ff";else n.delete(a),o.classList.remove("selected"),o.style.backgroundColor="";e.classList.toggle("disabled",0===n.size)}}},i=function(){var r,a=(r=D().mark(function r(){var a,i,u;return D().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==n.size){r.next=2;break}return r.abrupt("return");case 2:return e.classList.add("disabled"),a=t.querySelector("tbody"),i=document.querySelectorAll("#products-pagination .unavailable__pagination-btn"),a.innerHTML='\n <tr>\n <td colspan="4" style="text-align: center">\n <div class="unavailable__loader">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" style="height: 40px;">\n <radialGradient id="loader-gradient-save" cx=".66" fx=".66" cy=".3125" fy=".3125" gradientTransform="scale(1.5)">\n <stop offset="0" stop-color="#0085BA"/>\n <stop offset=".3" stop-color="#0085BA" stop-opacity=".9"/>\n <stop offset=".6" stop-color="#0085BA" stop-opacity=".6"/>\n <stop offset=".8" stop-color="#0085BA" stop-opacity=".3"/>\n <stop offset="1" stop-color="#0085BA" stop-opacity="0"/>\n </radialGradient>\n <circle transform-origin="center" fill="none" stroke="url(#loader-gradient-save)" stroke-width="15" stroke-linecap="round" stroke-dasharray="200 1000" stroke-dashoffset="0" cx="100" cy="100" r="70">\n <animateTransform type="rotate" attributeName="transform" calcMode="spline" dur="2" values="360;0" keyTimes="0;1" keySplines="0 0 1 1" repeatCount="indefinite"/>\n </circle>\n <circle transform-origin="center" fill="none" opacity=".2" stroke="#0085BA" stroke-width="15" stroke-linecap="round" cx="100" cy="100" r="70"/>\n </svg>\n </div>\n </td>\n </tr>\n ',i.forEach(function(t){t.disabled=!0}),u=Array.from(n.entries()).map(function(t){var e=W(t,2);return{id:e[0],delivery_type:e[1]}}),r.prev=8,r.next=11,w(u);case 11:r.sent,r.next=18;break;case 14:r.prev=14,r.t0=r.catch(8),console.error("Error adding unavailable products:",r.t0),x(r.t0);case 18:return r.prev=18,n.clear(),e.classList.remove("disabled"),t.querySelectorAll("tbody tr").forEach(function(t){t.classList.remove("selected"),t.style.backgroundColor="",t.querySelectorAll(".unavailable__checkbox").forEach(function(t){return t.checked=!1})}),R(window.unavailablePaginationHandler),o(),r.finish(18);case 26:case"end":return r.stop()}},r,null,[[8,14,18,26]])}),function(){var t=this,e=arguments;return new Promise(function(n,o){var a=r.apply(t,e);function i(t){K(a,n,o,i,u,"next",t)}function u(t){K(a,n,o,i,u,"throw",t)}i(void 0)})});return function(){return a.apply(this,arguments)}}(),u="handler_"+Date.now();window[u]=a,window[u+"_save"]=i,t.setAttribute("data-handler",u),t.addEventListener("change",a),e.addEventListener("click",i)}}function V(t){var e=document.querySelector("#products-pagination"),r=e.querySelector(".unavailable__pagination-pages"),n=e.querySelector(".unavailable__pagination-btn--first"),o=e.querySelector(".unavailable__pagination-btn--prev"),a=e.querySelector(".unavailable__pagination-btn--next"),i=e.querySelector(".unavailable__pagination-btn--last"),u=e.querySelector(".unavailable__pagination-total-items"),c=document.querySelector(".unavailable-wrapper").dataset.paginationText,l=1,s=1,f=0,h=function(){r&&(r.innerHTML="".concat(l," ").concat(c," ").concat(s))};return n&&n.addEventListener("click",function(){1!==l&&t()}),o&&o.addEventListener("click",function(){l>1&&t(l-1,s)}),a&&a.addEventListener("click",function(){l<s&&t(l+1,s)}),i&&i.addEventListener("click",function(){l!==s&&t(s,s)}),{updatePaginationState:function(t){l=t.current_page,s=t.total_pages,f=t.total_products,u&&(u.textContent=f),n&&(n.disabled=l<=1),o&&(o.disabled=l<=1),a&&(a.disabled=l>=s),i&&(i.disabled=l>=s),h()},reset:function(){l=1,s=1,f=0,u&&(u.textContent="0"),n&&(n.disabled=!0),o&&(o.disabled=!0),a&&(a.disabled=!0),i&&(i.disabled=!0),h()}}}function X(t){return X="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},X(t)}function Z(){Z=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==X(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(X(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function tt(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}var et,rt,nt,ot=null;function at(){return it.apply(this,arguments)}function it(){var t;return t=Z().mark(function t(){var e,r,n,o,a,i,u,c,l,s,f,h,p,d,y,g,m,b,w,_,x,E,k,S,j,O,T=arguments;return Z().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=T.length>0&&void 0!==T[0]?T[0]:1,r=T.length>1&&void 0!==T[1]?T[1]:null,n=document.querySelector(".unavailable__table--products tbody")){t.next=5;break}return t.abrupt("return");case 5:return o=document.querySelector(".unavailable-wrapper"),a=document.querySelector(".unavailable__table-wrapper--products").dataset.categoryId,i=o.dataset.noResultsMessage,u=document.querySelector(".unavailable__search--products"),c=document.querySelector(".unavailable__table-actions-products-save-btn"),l=document.querySelector("#products-pagination .unavailable__pagination-total-items"),s=document.querySelector(".unavailable-wrapper").dataset.paginationText,f=document.querySelector("#products-pagination .unavailable__pagination-pages"),h=document.querySelectorAll("#products-pagination .unavailable__pagination-btn"),c.classList.add("disabled"),h.forEach(function(t){t.disabled=!0}),p=r||1,l&&(l.textContent=0),f&&(f.textContent="".concat(e," ").concat(s," ").concat(p)),ot||(ot=V(at)),d='\n <tr>\n <td colspan="4" style="text-align: center">\n <div class="unavailable__loader">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" style="height: 40px;">\n <radialGradient id="loader-gradient-products" cx=".66" fx=".66" cy=".3125" fy=".3125" gradientTransform="scale(1.5)">\n <stop offset="0" stop-color="#0085BA"/>\n <stop offset=".3" stop-color="#0085BA" stop-opacity=".9"/>\n <stop offset=".6" stop-color="#0085BA" stop-opacity=".6"/>\n <stop offset=".8" stop-color="#0085BA" stop-opacity=".3"/>\n <stop offset="1" stop-color="#0085BA" stop-opacity="0"/>\n </radialGradient>\n <circle transform-origin="center" fill="none" stroke="url(#loader-gradient-products)" stroke-width="15" stroke-linecap="round" stroke-dasharray="200 1000" stroke-dashoffset="0" cx="100" cy="100" r="70">\n <animateTransform type="rotate" attributeName="transform" calcMode="spline" dur="2" values="360;0" keyTimes="0;1" keySplines="0 0 1 1" repeatCount="indefinite"/>\n </circle>\n <circle transform-origin="center" fill="none" opacity=".2" stroke="#0085BA" stroke-width="15" stroke-linecap="round" cx="100" cy="100" r="70"/>\n </svg>\n </div>\n </td>\n </tr>\n ',n.innerHTML=d,t.prev=22,t.next=25,v(a,(null==u?void 0:u.value)||"",e);case 25:if(y=t.sent,g=y.products,m=y.total_pages,b=y.total_products,w=y.current_page,ot.updatePaginationState({current_page:w,total_pages:m,total_products:b}),null!=g&&g.length){t.next=31;break}return n.innerHTML='\n <tr>\n <td colspan="4" style="text-align: center;">\n '.concat(i,"\n </td>\n </tr>\n "),t.abrupt("return");case 31:_=g.length,x=(w-1)*_,E=document.querySelector(".unavailable__table-wrapper--products"),k=E.dataset.categoryId,S=E.dataset.categoryName,n.innerHTML='\n <tr style="position: relative;">\n <td class="unavailable__td unavailable__td--count unavailable__td--bg-gray"></td>\n <td class="unavailable__td unavailable__td--product-name unavailable__td--font-bold unavailable__td--position-left unavailable__td--bg-gray"><span>'.concat(S,'</span></td>\n <td class="unavailable__td unavailable__td--id unavailable__td--bg-gray">').concat(k,'</td>\n <td class="unavailable__td unavailable__td--id unavailable__td--bg-gray"></td>\n <td class="unavailable__td unavailable__td--id unavailable__td--bg-gray"></td>\n </tr>\n '),j=document.querySelector(".unavailable-wrapper").dataset.parcelLockerText,O=document.querySelector(".unavailable-wrapper").dataset.courierText,n.innerHTML+=g.map(function(t,e){return'\n <tr data-product-id="'.concat(t.id,'">\n <td class="unavailable__td unavailable__td--count">\n <span>').concat(x+e+1,'.</span>\n </td>\n <td class="unavailable__td unavailable__td--product-name">').concat(t.name,'</td>\n <td class="unavailable__td unavailable__td--id">').concat(t.id,'</td>\n <td class="unavailable__td unavailable__td--actions">\n <div class="unavailable__checkbox-wrapper">\n <input type="checkbox" class="unavailable__checkbox unavailable__checkbox--courier" />\n <label class="unavailable__checkbox-label">\n ').concat(O,'\n </label>\n </div>\n <div class="unavailable__checkbox-wrapper">\n <input type="checkbox" class="unavailable__checkbox unavailable__checkbox--parcel-locker" />\n <label class="unavailable__checkbox-label">\n ').concat(j,"\n </label>\n </div>\n </td>\n </tr>\n ")}).join(""),Q(),t.next=48;break;case 43:t.prev=43,t.t0=t.catch(22),console.error("Error updating products list:",t.t0),n.innerHTML=d,ot.reset();case 48:case"end":return t.stop()}},t,null,[[22,43]])}),it=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){tt(a,n,o,i,u,"next",t)}function u(t){tt(a,n,o,i,u,"throw",t)}i(void 0)})},it.apply(this,arguments)}function ut(t){return ut="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},ut(t)}function ct(){ct=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==ut(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(ut(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function lt(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function st(){var t=document.querySelector(".unavailable__table-wrapper--categories"),e=document.querySelector(".unavailable__table-wrapper--products");if(t&&e){var r=e.querySelector("tbody");t.addEventListener("click",function(){var n,o=(n=ct().mark(function n(o){var a,i,u;return ct().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(a=o.target.closest(".unavailable__product-link")){n.next=3;break}return n.abrupt("return");case 3:t.classList.add("unavailable__table-wrapper--hidden"),e.classList.remove("unavailable__table-wrapper--hidden"),i=a.dataset.categoryName,e.dataset.categoryName=i,u=a.dataset.categoryId,e.dataset.categoryId=u,r.innerHTML='\n <tr>\n <td colspan="4" style="text-align: center">\n <div class="unavailable__loader">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" style="height: 40px;">\n <radialGradient id="loader-gradient-products" cx=".66" fx=".66" cy=".3125" fy=".3125" gradientTransform="scale(1.5)">\n <stop offset="0" stop-color="#0085BA"/>\n <stop offset=".3" stop-color="#0085BA" stop-opacity=".9"/>\n <stop offset=".6" stop-color="#0085BA" stop-opacity=".6"/>\n <stop offset=".8" stop-color="#0085BA" stop-opacity=".3"/>\n <stop offset="1" stop-color="#0085BA" stop-opacity="0"/>\n </radialGradient>\n <circle transform-origin="center" fill="none" stroke="url(#loader-gradient-products)" stroke-width="15" stroke-linecap="round" stroke-dasharray="200 1000" stroke-dashoffset="0" cx="100" cy="100" r="70">\n <animateTransform type="rotate" attributeName="transform" calcMode="spline" dur="2" values="360;0" keyTimes="0;1" keySplines="0 0 1 1" repeatCount="indefinite"/>\n </circle>\n <circle transform-origin="center" fill="none" opacity=".2" stroke="#0085BA" stroke-width="15" stroke-linecap="round" cx="100" cy="100" r="70"/>\n </svg>\n </div>\n </td>\n </tr>\n ',at();case 11:case"end":return n.stop()}},n)}),function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function i(t){lt(a,r,o,i,u,"next",t)}function u(t){lt(a,r,o,i,u,"throw",t)}i(void 0)})});return function(t){return o.apply(this,arguments)}}())}}function ft(t){return ft="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},ft(t)}function ht(){ht=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==ft(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(ft(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function pt(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function dt(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){pt(a,n,o,i,u,"next",t)}function u(t){pt(a,n,o,i,u,"throw",t)}i(void 0)})}}function vt(){return vt=dt(ht().mark(function t(){var e,r,n,o,a;return ht().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=document.querySelector(".unavailable__table--categories"),r=null==e?void 0:e.querySelector("tbody"),e&&r){t.next=4;break}return t.abrupt("return");case 4:return r.innerHTML='\n <tr>\n <td colspan="3" style="text-align: center">\n <div class="unavailable__loader">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" style="height: 40px;">\n <radialGradient id="loader-gradient" cx=".66" fx=".66" cy=".3125" fy=".3125" gradientTransform="scale(1.5)">\n <stop offset="0" stop-color="#0085BA"/>\n <stop offset=".3" stop-color="#0085BA" stop-opacity=".9"/>\n <stop offset=".6" stop-color="#0085BA" stop-opacity=".6"/>\n <stop offset=".8" stop-color="#0085BA" stop-opacity=".3"/>\n <stop offset="1" stop-color="#0085BA" stop-opacity="0"/>\n </radialGradient>\n <circle transform-origin="center" fill="none" stroke="url(#loader-gradient)" stroke-width="15" stroke-linecap="round" stroke-dasharray="200 1000" stroke-dashoffset="0" cx="100" cy="100" r="70">\n <animateTransform type="rotate" attributeName="transform" calcMode="spline" dur="2" values="360;0" keyTimes="0;1" keySplines="0 0 1 1" repeatCount="indefinite"/>\n </circle>\n <circle transform-origin="center" fill="none" opacity=".2" stroke="#0085BA" stroke-width="15" stroke-linecap="round" cx="100" cy="100" r="70"/>\n </svg>\n </div>\n </td>\n </tr>\n ',t.prev=6,t.next=9,c();case 9:return n=t.sent,r.innerHTML="",o=document.querySelector(".unavailable-wrapper").dataset.pluginUrl,t.next=14,Promise.all(n.map(function(){var t=dt(ht().mark(function t(e){var n;return ht().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:(n=document.createElement("tr")).innerHTML='\n <td class="unavailable__td unavailable__td--product-name unavailable__td--font-bold">'.concat(e.name,'</td>\n <td class="unavailable__td unavailable__td--id">').concat(e.id,'</td>\n <td class="unavailable__td unavailable__td--actions">\n <div class="unavailable__product-link" data-category-id="').concat(e.id,'" data-category-name="').concat(e.name,'">\n <img src="').concat(o,'../../../assets/img/hp-arrow.svg" alt="">\n </div>\n </td>\n '),r.appendChild(n);case 3:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()));case 14:st(),t.next=23;break;case 17:t.prev=17,t.t0=t.catch(6),x(t.t0),a=document.querySelector(".unavailable-wrapper").dataset.apiErrorMessage,r.innerHTML='\n <tr>\n <td colspan="3" style="text-align: center; color: var(--unavailable-red);">\n '.concat(a,"\n </td>\n </tr>\n "),console.error("Błąd podczas ładowania kategorii:",t.t0);case 23:case"end":return t.stop()}},t,null,[[6,17]])})),vt.apply(this,arguments)}function yt(t){return yt="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},yt(t)}function gt(){gt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==yt(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(yt(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function mt(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function bt(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){mt(a,n,o,i,u,"next",t)}function u(t){mt(a,n,o,i,u,"throw",t)}i(void 0)})}}function wt(){document.querySelectorAll(".unavailable__search").forEach(function(t){t.value=""})}function _t(){var t=document.querySelector(".unavailable__selected-count--products");t&&(t.textContent="0");var e=document.querySelector(".unavailable__table--products");if(e){e.querySelectorAll('input[type="checkbox"]').forEach(function(t){t.checked=!1,t.disabled=!1}),e.querySelectorAll("tbody tr").forEach(function(t){t.classList.remove("selected","disabled")});var r=e.getAttribute("data-handler");if(r&&window[r]){var n=new Set,o=new Event("reset");window[r](o,n)}}}function xt(){var t=document.querySelectorAll(".unavailable__table--categories tbody tr");t&&t.forEach(function(t){t.style.display=""})}function Et(t){return Et="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},Et(t)}function kt(){kt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var a=r&&r.prototype instanceof h?r:h,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new k(o||[])),!0),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function h(){}function p(){}function d(){}var v={};c(v,a,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==r&&n.call(g,a)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function w(t,e){function r(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==Et(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):e.resolve(f).then(function(t){l.value=t,i(l)},function(t){return r("throw",t,i,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function a(){return new e(function(e,o){r(t,n,e,o)})}return o=o?o.then(a,a):a()},!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Et(e)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,function(){return this}),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(m),c(m,u,"Generator"),c(m,a,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],l=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],f):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),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function St(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function jt(){var t=document.querySelector(".unavailable-confirmation"),e=document.querySelector(".unavailable__table-wrapper--categories"),r=document.querySelector(".unavailable__table-wrapper--products"),n=t.querySelector(".unavailable-confirmation__button--cancel"),o=t.querySelector(".unavailable-confirmation__button--confirm"),a=t.querySelector(".unavailable-confirmation__close");if(t&&n&&o&&a){var i=function(){t.classList.remove("unavailable-confirmation--active")},u=function(){var t,e=(t=kt().mark(function t(){var e,r;return kt().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if((e=document.createElement("div")).className="unavailable__loading-overlay",e.innerHTML='\n <div class="unavailable__loader">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">\n <radialGradient id="loader-gradient-save" cx=".66" fx=".66" cy=".3125" fy=".3125" gradientTransform="scale(1.5)">\n <stop offset="0" stop-color="#0085BA"/>\n <stop offset=".3" stop-color="#0085BA" stop-opacity=".9"/>\n <stop offset=".6" stop-color="#0085BA" stop-opacity=".6"/>\n <stop offset=".8" stop-color="#0085BA" stop-opacity=".3"/>\n <stop offset="1" stop-color="#0085BA" stop-opacity="0"/>\n </radialGradient>\n <circle transform-origin="center" fill="none" stroke="url(#loader-gradient-save)" stroke-width="15" stroke-linecap="round" stroke-dasharray="200 1000" stroke-dashoffset="0" cx="100" cy="100" r="70">\n <animateTransform type="rotate" attributeName="transform" calcMode="spline" dur="2" values="360;0" keyTimes="0;1" keySplines="0 0 1 1" repeatCount="indefinite"/>\n </circle>\n </svg>\n </div>\n ',document.body.appendChild(e),t.prev=4,r=document.querySelector(".unavailable__table-actions-products-save-btn")){t.next=8;break}return t.abrupt("return");case 8:i(),r.disabled=!1,r.click(),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(4),console.error("Błąd podczas zapisywania produktów:",t.t0);case 16:return t.prev=16,document.body.removeChild(e),t.finish(16);case 19:case"end":return t.stop()}},t,null,[[4,13,16,19]])}),function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){St(a,n,o,i,u,"next",t)}function u(t){St(a,n,o,i,u,"throw",t)}i(void 0)})});return function(){return e.apply(this,arguments)}}();n.addEventListener("click",function(){i(),e.classList.remove("unavailable__table-wrapper--hidden"),r.classList.add("unavailable__table-wrapper--hidden"),wt(),_t()}),o.addEventListener("click",u),a.addEventListener("click",i),t.addEventListener("click",function(e){e.target===t&&i()})}}function Ot(){var t,e=document.querySelector("#unavailable-pagination"),r=null==e?void 0:e.querySelector(".unavailable__pagination-pages"),n=null==e?void 0:e.querySelector(".unavailable__pagination-btn--first"),o=null==e?void 0:e.querySelector(".unavailable__pagination-btn--prev"),a=null==e?void 0:e.querySelector(".unavailable__pagination-btn--next"),i=null==e?void 0:e.querySelector(".unavailable__pagination-btn--last"),u=null==e?void 0:e.querySelector(".unavailable__pagination-total-items");if(!e)return{init:function(){},refresh:function(){},reinitialize:function(){},showPage:function(){},getCurrentPage:function(){return 1},getTotalPages:function(){return 1}};var c=(null===(t=document.querySelector(".unavailable-wrapper"))||void 0===t||null===(t=t.dataset)||void 0===t?void 0:t.paginationText)||"z",l=1,s=1,f=[],h=[],p=new AbortController,d=function(){var t=document.querySelector(".unavailable__table--unavailable tbody");return t?Array.from(t.querySelectorAll("tr")).filter(function(t){return!t.classList.contains("unavailable__no-results-main")&&t.querySelector(".unavailable__td--product-name")}):[]},v=function(t){var e,p;l=t,e=document.querySelector(".unavailable__search-main"),p=(null==e?void 0:e.value.toLowerCase())||"",h=p?f.filter(function(t){var e,r,n=(null===(e=t.querySelector(".unavailable__td--product-name"))||void 0===e||null===(e=e.textContent)||void 0===e?void 0:e.toLowerCase())||"",o=(null===(r=t.querySelector(".unavailable__td--id"))||void 0===r||null===(r=r.textContent)||void 0===r?void 0:r.toLowerCase())||"";return n.includes(p)||o.includes(p)}):f,s=Math.max(1,Math.ceil(h.length/10)),l>s&&(l=s);var d=document.querySelector(".unavailable__table--unavailable tbody");if(d){f.forEach(function(t){t.style.display="none"});var v=10*(l-1),y=v+10,g=h.slice(v,y);g.forEach(function(t){t.style.display=""}),function(t){t.forEach(function(t,e){var r=t.querySelector(".unavailable__td--count");if(r){var n=10*(l-1)+e+1;r.textContent="".concat(n,".")}})}(g),u&&(u.textContent=h.length);var m=d.querySelector(".unavailable__no-results-main");if(0===h.length)if(m)m.style.display="";else{var b,w=document.createElement("tr");w.className="unavailable__no-results-main",w.innerHTML='<td colspan="4" style="text-align: center;">'.concat((null===(b=document.querySelector(".unavailable-wrapper"))||void 0===b||null===(b=b.dataset)||void 0===b?void 0:b.noResultsMessage)||"Brak wyników","</td>"),d.appendChild(w)}else m&&(m.style.display="none");r&&(r.innerHTML="".concat(l," ").concat(c," ").concat(s)),n&&(n.disabled=l<=1),o&&(o.disabled=l<=1),a&&(a.disabled=l>=s),i&&(i.disabled=l>=s)}},y=function(){p.abort(),p=new AbortController;var t=document.querySelector(".unavailable__search-main");t&&t.addEventListener("input",function(){v(1)},{signal:p.signal})};return n&&n.addEventListener("click",function(){1!==l&&v(1)}),o&&o.addEventListener("click",function(){l>1&&v(l-1)}),a&&a.addEventListener("click",function(){l<s&&v(l+1)}),i&&i.addEventListener("click",function(){l!==s&&v(s)}),{init:function(){f=d(),y(),v(1)},refresh:function(){f=d(),v(l)},reinitialize:function(){f=d(),y(),v(1)},showPage:v,getCurrentPage:function(){return l},getTotalPages:function(){return s}}}null===(p=document.querySelector(".unavailable__search--products"))||void 0===p||p.addEventListener("input",(et=function(){at()},rt=300,function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];clearTimeout(nt),nt=setTimeout(function(){clearTimeout(nt),et.apply(void 0,e)},rt)})),window.unavailablePaginationHandler=null,window.addEventListener("load",function(){var t=document.querySelector(".unavailable-wrapper");if(t){var e=Ot();window.unavailablePaginationHandler=e,R(e),function(){vt.apply(this,arguments)}();var r,a,i,u=null==t?void 0:t.querySelector(".unavailable-popup-table"),c=null==t?void 0:t.querySelector(".overlay"),l=null==t?void 0:t.querySelector(".unavailable-select-products");[null==u?void 0:u.querySelector(".unavailable__popup-close"),null==t?void 0:t.querySelector(".unavailable__table-actions-categories-btn"),c].forEach(function(t){t&&t.addEventListener("click",function(){o(),xt(),wt()})}),l.addEventListener("click",function(){!function(t,e){n.apply(this,arguments)}(u,c),xt(),wt(),_t()}),function(){var t=document.querySelector(".unavailable__search--categories"),e=document.querySelector(".unavailable__search--products");if(t&&e){t.addEventListener("input",function(t){var e,r=t.target.value.toLowerCase(),n=document.querySelectorAll(".unavailable__table--categories tbody tr"),o=0;n.forEach(function(t){var e,n,a=(null===(e=t.querySelector(".unavailable__td--product-name"))||void 0===e||null===(e=e.textContent)||void 0===e?void 0:e.toLowerCase())||"",i=(null===(n=t.querySelector(".unavailable__td--id"))||void 0===n||null===(n=n.textContent)||void 0===n?void 0:n.toLowerCase())||"",u=a.includes(r)||i.includes(r);t.style.display=u?"":"none",u&&o++});var a=null===(e=document.querySelector(".unavailable-wrapper"))||void 0===e||null===(e=e.dataset)||void 0===e?void 0:e.noResultsMessage;if(!document.querySelector(".unavailable__no-results")){var i=document.querySelector(".unavailable__table--categories tbody"),u=document.createElement("tr");u.className="unavailable__no-results",u.innerHTML='<td colspan="3" style="text-align: center;">'.concat(a,"</td>"),i.appendChild(u)}document.querySelector(".unavailable__no-results").style.display=0===o?"":"none"});var r=null;e.addEventListener("input",function(t){r&&clearTimeout(r),r=setTimeout(bt(gt().mark(function t(){return gt().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:at();case 1:case"end":return t.stop()}},t)})),300)})}}(),r=document.querySelector(".unavailable__table-actions-products-back-btn"),a=document.querySelector(".unavailable-confirmation"),r&&a&&r.addEventListener("click",function(){if(document.querySelectorAll(".unavailable__table--products input[type='checkbox']:checked").length>0)a.classList.add("unavailable-confirmation--active");else{var t=document.querySelector(".unavailable__table-wrapper--categories"),e=document.querySelector(".unavailable__table-wrapper--products");t.classList.remove("unavailable__table-wrapper--hidden"),e.classList.add("unavailable__table-wrapper--hidden"),wt(),_t()}}),Q(),(i=document.querySelector(".unavailable__table-actions-added-products-save-btn"))&&i.addEventListener("click",function(){o()}),jt(),function(t){var e=document.querySelector(".unavailable__search-main");e&&e.addEventListener("input",function(e){if(t)t.showPage(1);else{var r,n=e.target.value.toLowerCase(),o=document.querySelectorAll(".unavailable__table--unavailable tbody tr"),a=0;o.forEach(function(t){var e,r,o=(null===(e=t.querySelector(".unavailable__td--product-name"))||void 0===e||null===(e=e.textContent)||void 0===e?void 0:e.toLowerCase())||"",i=(null===(r=t.querySelector(".unavailable__td--id"))||void 0===r||null===(r=r.textContent)||void 0===r?void 0:r.toLowerCase())||"",u=o.includes(n)||i.includes(n);t.style.display=u?"":"none",u&&a++});var i=null===(r=document.querySelector(".unavailable-wrapper"))||void 0===r||null===(r=r.dataset)||void 0===r?void 0:r.noResultsMessage,u=document.querySelector(".unavailable__no-results-main"),c=document.querySelector(".unavailable__table--unavailable tbody");if(0===a){if(!u){var l=document.createElement("tr");l.className="unavailable__no-results-main",l.innerHTML='<td colspan="4" style="text-align: center;">'.concat(i,"</td>"),c.appendChild(l),u=l}u.style.display=""}else u&&(u.style.display="none")}})}(e)}})})();
|
|
//# sourceMappingURL=admin-unavailable.js.map
|