PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | assets/FluentCartApp.js +1 -1 1.6.1 → 1.6.5 View file →
@@ -1 +1 @@
1 -var bt=l=>{throw TypeError(l)};var ot=(l,t,e)=>t.has(l)||bt("Cannot "+e);var n=(l,t,e)=>(ot(l,t,"read from private field"),e?e.call(l):t.get(l)),d=(l,t,e)=>t.has(l)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,e),g=(l,t,e,r)=>(ot(l,t,"write to private field"),r?r.call(l,e):t.set(l,e),e),i=(l,t,e)=>(ot(l,t,"access private method"),e);class H{constructor(t={}){this.storageKey=t.storageKey||"fc_utm_data",this.expirationDays=t.expirationDays||30,this.utmKeys=t.utmKeys||H.getUtmParams(),this.internalDomains=t.internalDomains||H.getInternalDomains(),this.collectFromURL()}collectFromURL(){const t=this.getURLParams();if(t.refer_url&&(t.refer_url=this.normalizeReferUrl(t.refer_url)),!t.refer_url&&document.referrer)try{const e=new URL(document.referrer).hostname;e!==window.location.hostname&&!this.isInternalHost(e)&&(t.refer_url=this.normalizeReferUrl(document.referrer))}catch{}Object.keys(t).length>0&&this.store(t)}normalizeReferUrl(t){const e=String(t||"").trim();if(!e)return"";const r=/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?e:"https://"+e.replace(/^\/+/,"");try{return new URL(r).hostname.toLowerCase().replace(/^www\./,"")}catch{return e}}isInternalHost(t){const e=(t||"").toLowerCase();return this.internalDomains.some(r=>{const a=String(r).toLowerCase().replace(/^www\./,"");return e===a||e==="www."+a||e.endsWith("."+a)})}getURLParams(){const t=new URLSearchParams(window.location.search),e={};return this.utmKeys.forEach(r=>{const a=t.get(r);a&&(e[r]=a)}),e}store(t){const e=this.getStoredData(),r=Date.now(),o={params:{...e.params,...t},timestamp:r};try{localStorage.setItem(this.storageKey,JSON.stringify(o))}catch{}}getStoredData(){try{const t=localStorage.getItem(this.storageKey);if(t){let e=JSON.parse(t);if(e&&e.timestamp)return e}}catch{}return{params:{},timestamp:null}}get(){return this.getStoredData().params||{}}clear(){try{localStorage.removeItem(this.storageKey)}catch{}}static getUtmParams(){return window.fluentcart_utm_vars.allowed_keys||["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"]}static getInternalDomains(){return window.fluentcart_utm_vars&&window.fluentcart_utm_vars.internal_domains||[]}}var _t,St,I,L,v,G,Y,j,R,Z,A,U,tt,W,it,c,At,lt,Tt,ut,M,qt,kt,Pt,xt,D,Dt,Ut,Ot,Mt,B;const p=class p{constructor(){d(this,c);d(this,v,[]);d(this,G,"?action=fluent_cart_checkout_routes&fc_checkout_action=fluent_cart_cart_status");d(this,Y,"?action=fluent_cart_checkout_routes&fc_checkout_action=fluent_cart_cart_update");d(this,j,window.fluentCartRestVars.ajaxurl);d(this,R,!1);d(this,Z,(_t=window.fluentcart_drawer_vars)==null?void 0:_t.is_admin_bar_showing);d(this,A,"open");d(this,U,"active");d(this,tt,((St=window.fluentcart_drawer_vars)==null?void 0:St.is_drawer_hidden)=="1")}init(){return n(p,I)!==null?n(p,I):(g(p,I,this),i(this,c,Mt).call(this),n(this,tt)||i(this,c,Ot).call(this),i(this,c,Ut).call(this),i(this,c,qt).call(this),i(this,c,kt).call(this),i(this,c,Pt).call(this),i(this,c,xt).call(this),i(this,c,At).call(this),this)}broadcastCartCleared(){p.broadcastCartUpdate([],null)}static broadcastCartUpdate(t,e){var a;if(!n(p,L))return;const r=i(a=p,W,it).call(a);!t||t.length===0?n(p,L).postMessage({_token:r,type:"cart_cleared"}):n(p,L).postMessage({_token:r,type:"cart_updated",cart_data:t,fragments:e||[]})}async getCart(){let t=await new Promise((e,r)=>{fetch(n(this,j)+n(this,G),{method:"GET",headers:{"Content-Type":"application/json"}}).then(a=>{if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}).then(a=>{a&&a.cart_data?e(a.cart_data):e([])}).catch(a=>{r([])})});return g(this,v,t),window.dispatchEvent(new Event("fluentCartNotifyCartDrawerItemChanged")),t}async addProduct(t,e=1,r=!1,a=!1,o=!1){return i(this,c,M).call(this,t,e,r,a,o)}async removeProduct(t,e=!1){return t=t.toString(),await i(this,c,M).call(this,t,0,!1,e)}async incrementProduct(t,e=1){const r=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");return r&&r.classList.contains("active")&&g(this,R,!0),t=t.toString(),e=Math.abs(parseInt(e.toString())),await i(this,c,M).call(this,t,e)}async decrementProduct(t,e=1){const r=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");return r&&r.classList.contains("active")&&g(this,R,!0),t=t.toString(),e=Math.abs(parseInt(e.toString())),await i(this,c,M).call(this,t,e*-1)}async updateProductQuantity(t,e=1,r=!1){return e=parseInt(e.toString(),10),(isNaN(e)||e<1)&&(e=1),t=t.toString(),await i(this,c,M).call(this,t,e,r)}closeModal(){const t=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),e=document.querySelector("[data-fluent-cart-cart-drawer]"),r=document.body;t&&t.classList.remove(n(this,U)),e&&e.classList.remove(n(this,A)),r.style.overflow=""}openModal(){const t=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),e=document.querySelector("[data-fluent-cart-cart-drawer]"),r=document.body;t&&t.classList.add(n(this,U)),e&&e.classList.add(n(this,A)),r.style.overflow="hidden"}appendUtmSource(t){const e=new URLSearchParams(window.location.search);return H.getUtmParams().forEach(r=>{e.has(r)&&(t[r]=e.get(r))}),t}getState(){return n(this,v)}updateCartTotalPrice(t=[]){var s,u;let e=0;const r=((u=(s=window.fluentcart_drawer_vars)==null?void 0:s.currency_settings)==null?void 0:u.currency_sign)||"$";t.forEach(f=>{f.subtotal&&(e+=f.subtotal)});const a=String(parseFloat((e/100).toFixed(2))),o=`${r}${a}`;return document.querySelectorAll("[data-fluent-cart-cart-total-price]").forEach(f=>{f.textContent=o}),o}};I=new WeakMap,L=new WeakMap,v=new WeakMap,G=new WeakMap,Y=new WeakMap,j=new WeakMap,R=new WeakMap,Z=new WeakMap,A=new WeakMap,U=new WeakMap,tt=new WeakMap,W=new WeakSet,it=function(){const t="fc_bc_token";let e=localStorage.getItem(t);return e||(e=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2),localStorage.setItem(t,e)),e},c=new WeakSet,At=function(){var e;if(typeof BroadcastChannel>"u"||n(p,L))return;const t=((e=window.fluentCartRestVars)==null?void 0:e.ajaxurl)||window.location.origin;g(p,L,new BroadcastChannel("fluent_cart_cart:"+t)),n(p,L).onmessage=r=>{var a;r.data&&r.data.type&&r.data._token===i(a=p,W,it).call(a)&&i(this,c,Tt).call(this,r.data)}},lt=function(t){return{distinctCount:t.length,totalQty:t.reduce((e,r)=>e+(r.quantity||1),0)}},Tt=function(t){if(t.type==="cart_updated"&&Array.isArray(t.fragments)){const e=Array.isArray(t.cart_data)?t.cart_data:[],{distinctCount:r,totalQty:a}=i(this,c,lt).call(this,e);window.fluentcart_drawer_vars&&(window.fluentcart_drawer_vars.cart_item_count=r,window.fluentcart_drawer_vars.cart_total_quantity=a),this.updateCartTotalPrice(e),i(this,c,B).call(this,r,a),document.querySelectorAll(".fct-cart-badge-count").forEach(u=>{u.textContent=r.toString()});const o=document.querySelector("[data-fluent-cart-cart-drawer]"),s=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");o&&(o.style.transition="none"),s&&(s.style.transition="none"),i(this,c,ut).call(this,t.fragments,!0),requestAnimationFrame(()=>{const u=document.querySelector("[data-fluent-cart-cart-drawer]"),f=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");u&&(u.style.transition=""),f&&(f.style.transition="")}),document.querySelectorAll("[data-fluent-cart-cart-total-item]").forEach(u=>{u.textContent=r.toString()}),g(this,v,e),i(this,c,D).call(this)}t.type==="cart_cleared"&&(g(this,v,[]),window.fluentcart_drawer_vars&&(window.fluentcart_drawer_vars.cart_item_count=0,window.fluentcart_drawer_vars.cart_total_quantity=0),i(this,c,B).call(this,0,0),document.querySelectorAll(".fct-cart-badge-count").forEach(e=>{e.textContent="0"}),this.updateCartTotalPrice([]),i(this,c,D).call(this))},ut=function(t,e=!1){const r="[data-fluent-cart-cart-drawer-container]";t.forEach(a=>{const o=document.querySelector(a.selector);if(a.selector===r){o?!e&&a.type==="replace"&&(o.outerHTML=a.content):(document.body.insertAdjacentHTML("beforeend",a.content),e&&this.closeModal());return}o&&a.type==="replace"&&(a.content?o.outerHTML=a.content:o.remove())})},M=async function(t=null,e=1,r=!1,a=!1,o=!1){if(t==null)return;const s=document.querySelector("[data-fluent-cart-cart-drawer]");let u="";s&&(u=s.querySelector("[data-fluent-cart-cart-drawer-loader]"),u&&u.classList.add("show"));const f=this;let _={item_id:t,quantity:e,is_custom:o};r&&(_.by_input=!0),(n(this,R)||a||r)&&(_.open_cart=!0),_.is_admin_bar_enabled=n(this,Z),_=this.appendUtmSource(_);let h=null,x=!1,w=await new Promise((C,ft)=>{const ht=new URL(n(this,j)+n(this,Y));Object.entries(_).forEach(([z,J])=>{ht.searchParams.append(z,J)});const E=new XMLHttpRequest;E.open("GET",ht.toString(),!0),E.setRequestHeader("Content-Type","application/json"),E.setRequestHeader("X-WP-Nonce",window.fluentCartRestVars.rest.nonce),E.onreadystatechange=function(){var z,J,mt,wt,yt,gt,pt;if(E.readyState===XMLHttpRequest.DONE)try{if(E.status>=200&&E.status<300){const y=JSON.parse(E.responseText),st=(J=(z=y.data)==null?void 0:z.cart)==null?void 0:J.cart_data;if(Array.isArray(st)){const{distinctCount:Q,totalQty:N}=i(mt=f,c,lt).call(mt,st);window.fluentcart_drawer_vars.cart_item_count=Q,window.fluentcart_drawer_vars.cart_total_quantity=N,i(wt=f,c,B).call(wt,Q,N),f.updateCartTotalPrice(st)}if(y!=null&&y.fragments){const Q=Array.isArray(y.fragments)?y.fragments:[y.fragments];h=Array.isArray(y.fragments)?y.fragments:null,i(yt=f,c,ut).call(yt,Q);const N=document.querySelector("[data-fluent-cart-cart-drawer]");N&&N.classList.contains(n(f,A))&&f.openModal()}(pt=(gt=y==null?void 0:y.data)==null?void 0:gt.cart)!=null&&pt.cart_data?(x=!0,C(y.data.cart.cart_data)):(y.message&&new Toastify({text:y.message,className:"warning",duration:3e3,gravity:"top",position:"right",slideFrom:"right",type:"warning"}).showToast(),C([])),u&&u.classList.remove("show")}else{const y=E.responseText&&JSON.parse(E.responseText).message||"An error occurred";new Toastify({text:y,className:"info",duration:2e3,style:{background:"#eabe11"}}).showToast(),u&&u.classList.remove("show"),ft(new Error(y))}}catch(y){y.message&&new Toastify({text:y.message,className:"info",duration:2e3,style:{background:"#eabe11"}}).showToast(),u&&u.classList.remove("show"),ft(y)}},E.send()});return w.length,g(this,v,w),x&&p.broadcastCartUpdate(w,h),new URLSearchParams(window.location.search).has("fct_cart_hash")||window.dispatchEvent(new CustomEvent("fluentCartNotifyCartDrawerItemChanged",{detail:{response:w}})),w},qt=function(){const t=this;document.addEventListener("click",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-delete-button]");if(r){const o=r.dataset.itemId,s=await t.removeProduct(o,!0);s!=null&&(g(t,v,s),i(a=t,c,D).call(a))}})},kt=function(){const t=this;document.addEventListener("click",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-increase-button]");if(r){const o=r.dataset.itemId,s=await t.incrementProduct(o);s!=null&&(g(t,v,s),i(a=t,c,D).call(a))}})},Pt=function(){const t=this;document.addEventListener("click",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-decrease-button]");if(r){const o=r.dataset.itemId,s=await t.decrementProduct(o);s!=null&&(g(t,v,s),i(a=t,c,D).call(a))}})},xt=function(){const t=this;document.addEventListener("change",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-quantity-input]");if(r){const o=r.dataset.itemId;let s=parseInt(event.target.value,10);parseInt(event.target.dataset.oldValue||"0",10),s<1&&(s=1);let u=s;const f=await t.updateProductQuantity(o,u,!0);f!=null&&(g(t,v,f),i(a=t,c,D).call(a))}})},D=function(){if(i(this,c,Dt).call(this)){const t=document.querySelectorAll("[data-fluent-cart-cart-total-item]"),e=document.querySelectorAll("[data-fluent-cart-checkout-page-cart-item-count]"),r=document.querySelectorAll("[data-fluent-cart-cart-total-wrapper]"),a=document.querySelectorAll("[data-fluent-cart-cart-expand-button]"),o=document.querySelectorAll("[data-fluent-cart-cart-checkout-button-wrap]");t&&t.forEach(s=>s.textContent="0"),e&&e.forEach(s=>s.textContent="0"),r&&r.forEach(s=>s.style.display="none"),o&&o.forEach(s=>s.style.display="none"),a&&a.forEach(s=>s.classList.add("is-hidden")),setTimeout(()=>{this.closeModal()},300)}},Dt=function(){return n(this,v)===void 0||n(this,v)==null||Object.keys(n(this,v)).length===0},Ut=function(){const t=this;document.addEventListener("click",function(e){const r=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");r&&r.contains(e.target)&&t.closeModal()})},Ot=function(){const t=this,e=document.body;document.addEventListener("click",r=>{document.querySelector("[data-fluent-cart-cart-drawer-container]");const a=document.querySelector("[data-fluent-cart-cart-drawer]"),o=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),s=r.target.closest("[data-fluent-cart-cart-toggle-button]"),u=r.target.closest("[data-fluent-cart-cart-expand-button], .fcart-cart-toggle-button"),f=r.target.closest("[data-fluent-cart-cart-collapse-button]");if(s){a&&a.classList.toggle(n(t,A));return}if(u){a&&(a.classList.add(n(t,A)),e.style.overflow="hidden"),o&&o.classList.add(n(t,U));return}if(f){a&&a.classList.remove(n(t,A)),o&&o.classList.remove(n(t,U)),e.style.overflow="";return}})},Mt=function(){var e,r;i(this,c,B).call(this,((e=window.fluentcart_drawer_vars)==null?void 0:e.cart_item_count)||0,((r=window.fluentcart_drawer_vars)==null?void 0:r.cart_total_quantity)||0);const t=document.querySelector(".fluent-cart-menu-cart-open-button-container");if(t){const a=t.closest("li"),o=a==null?void 0:a.previousElementSibling;if(o&&a){const s=o.cloneNode(!0);s.removeAttribute("id"),s.innerHTML="",s.appendChild(t.cloneNode(!0)),a.parentNode.replaceChild(s,a)}}},B=function(t,e){document.querySelectorAll("[data-cart-badge-count]").forEach(r=>{const a=r.dataset.cartCountMode||"distinct_products";r.textContent=(a==="total_quantity"?e:t).toString()})},d(p,W),d(p,I,null),d(p,L,null);let ct=p;class Vt{static init(){document.addEventListener("click",function(t){var f;const e=t.target.closest("[data-fluent-cart-add-to-cart-button]");if(!e||(t.preventDefault(),e.classList.contains("fct-loading")))return;e.classList.add("fct-loading");const r=e.getAttribute("data-cart-id");if(!r)return;let a=parseInt(e.getAttribute("data-quantity"),10)||1;const o=e.getAttribute("data-action-name"),s=e.getAttribute("data-error-action-name");e.setAttribute("data-quantity","1");const u=e.getAttribute("data-is-custom");(f=window.fluentCartCart)==null||f.addProduct(r,a,!1,!0,u).then(_=>{setTimeout(()=>{e.classList.remove("fct-loading")},300),document.dispatchEvent(new Event(o))}).catch(_=>{e.classList.remove("fct-loading"),document.dispatchEvent(new Event(s))})})}}var O,q,b,S,k,et,K,P,m,It,Rt,Nt,Bt,X,Ht,rt,F,at,$,nt,jt,Wt,Kt,Ft;const T=class T{constructor(){d(this,m);d(this,q,null);d(this,b,null);d(this,S,null);d(this,k,null);d(this,et,300);d(this,K,null);d(this,P,null);d(this,rt,()=>{i(this,m,Kt).call(this),n(this,F).call(this),n(this,at).call(this)});d(this,F,()=>{try{const t=n(this,b).contentDocument||n(this,b).contentWindow.document,e=t.querySelector("[data-fct-modal-checkout-form-inner]");let r=t.body.scrollHeight;if(e)for(const o of e.children)r=Math.max(r,o.scrollHeight);r+=20;const a=r+"px";n(this,b).style.height!==a&&(n(this,b).style.height=a)}catch{}});d(this,at,()=>{n(this,$).call(this);try{const t=n(this,b).contentDocument||n(this,b).contentWindow.document;let e=null;g(this,P,new MutationObserver(()=>{e||(e=requestAnimationFrame(()=>{e=null,n(this,F).call(this)}))})),n(this,P).observe(t.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]})}catch{}});d(this,$,()=>{n(this,P)&&(n(this,P).disconnect(),g(this,P,null))});d(this,nt,t=>{var e;t.origin===window.location.origin&&((e=t.data)==null?void 0:e.type)==="fluentCartCheckoutComplete"&&(t.data.redirectUrl?window.location.href=t.data.redirectUrl:this.closeModal())});var t;this.translate=((t=window.fluentcart)==null?void 0:t.$t)||(e=>e),i(this,m,It).call(this),i(this,m,Rt).call(this)}static init(){return n(T,O)||g(T,O,new T),n(T,O)}openModal(t){if(n(this,q)||!n(this,S)||!n(this,b)){(!n(this,S)||!n(this,b))&&i(this,m,jt).call(this);return}g(this,q,n(this,S)),i(this,m,Wt).call(this),n(this,b).src=t,n(this,b).addEventListener("load",()=>{n(this,rt).call(this),i(this,m,Ft).call(this,n(this,b))},{once:!0}),n(this,K)||(g(this,K,!0),window.addEventListener("message",n(this,nt))),n(this,S).classList.add("fct-checkout-modal-open"),n(this,S).style.opacity="1",n(this,S).style.visibility="visible",window.dispatchEvent(new CustomEvent("fluentCartModalCheckoutOpened",{detail:{checkoutUrl:t}}))}closeModal(){n(this,q)&&(n(this,q).classList.remove("fct-checkout-modal-open"),n(this,S).style.opacity="0",n(this,S).style.visibility="hidden",setTimeout(()=>{n(this,$).call(this),n(this,b)&&(n(this,b).src=""),g(this,q,null),window.dispatchEvent(new CustomEvent("fluentCartModalCheckoutClosed"))},n(this,et)))}};O=new WeakMap,q=new WeakMap,b=new WeakMap,S=new WeakMap,k=new WeakMap,et=new WeakMap,K=new WeakMap,P=new WeakMap,m=new WeakSet,It=function(){g(this,k,document.querySelector("[data-fct-checkout-modal-loader]")),g(this,S,document.querySelector("[data-fct-checkout-modal-container]")),g(this,b,document.querySelector("[data-fct-checkout-modal-iframe]"))},Rt=function(){i(this,m,Nt).call(this),document.addEventListener("click",i(this,m,Ht).bind(this)),i(this,m,Bt).call(this)},Nt=function(){document.querySelectorAll("[data-fct-instant-checkout-button]").forEach(e=>{e.addEventListener("click",i(this,m,X).bind(this))})},Bt=function(){new MutationObserver(e=>{e.forEach(r=>{r.addedNodes.forEach(a=>{var o;a.nodeType===1&&((o=a.hasAttribute)!=null&&o.call(a,"data-fct-instant-checkout-button")&&a.addEventListener("click",i(this,m,X).bind(this)),a.querySelectorAll&&a.querySelectorAll("[data-fct-instant-checkout-button]").forEach(u=>{u.addEventListener("click",i(this,m,X).bind(this))}))})})}).observe(document.body,{childList:!0,subtree:!0})},X=function(t){t.preventDefault();const r=t.currentTarget.getAttribute("href"),a=new URL(r,window.location.origin);a.searchParams.set("fluent-cart","modal_checkout"),this.openModal(a.toString())},Ht=function(t){t.target.closest("[data-fct-checkout-modal-close]")&&(t.preventDefault(),this.closeModal())},rt=new WeakMap,F=new WeakMap,at=new WeakMap,$=new WeakMap,nt=new WeakMap,jt=function(){typeof Toastify<"u"?new Toastify({text:this.translate("Modal checkout is not available. Please try again."),className:"info",duration:3e3,style:{background:"linear-gradient(to right, rgb(255 30 30), rgb(252 133 101))",color:"#fff"}}).showToast():alert(this.translate("Modal checkout is not available. Please try again."))},Wt=function(){n(this,k)&&(n(this,k).style.display="")},Kt=function(){n(this,k)&&(n(this,k).style.display="none")},Ft=function(t){var e;try{const r=t.contentDocument||((e=t.contentWindow)==null?void 0:e.document);if(!r||!r.body)return;const a=s=>{if(s.tagName!=="A")return;const u=s.getAttribute("href")||"";u.startsWith("#")||u.startsWith("mailto:")||u.startsWith("tel:")||(s.hasAttribute("target")||(s.target="_blank"),s.rel||(s.rel="noopener noreferrer"))};r.querySelectorAll("a").forEach(a),new MutationObserver(s=>{var u,f;for(const _ of s)for(const h of _.addedNodes)h.nodeType===1&&((u=h.matches)!=null&&u.call(h,"a")&&a(h),(f=h.querySelectorAll)==null||f.call(h,"a").forEach(a))}).observe(r.body,{childList:!0,subtree:!0})}catch{}},d(T,O,null);let dt=T;var Ct,Et,Lt;const zt={...((Ct=window.fluentcart_checkout_vars)==null?void 0:Ct.trans)||{},...((Et=window.fluentcart_checkout_vars)==null?void 0:Et.payments_trans)||{},...((Lt=window.fluentcart_shop_vars)==null?void 0:Lt.trans)||{}};window.fluentcart={$t:function(l){let t=zt[l]||l;const e=Array.prototype.slice.call(arguments,1);if(e.length===0)return t;const r=/%(\d*\$?)s|%d/g;let a=0;return t=t.replace(r,(o,s)=>{if(s){const u=parseInt(s,10)-1;return u<e.length?e[u]:o}else return a<e.length?e[a++]:o}),t}};const $t=function(l,t){return Object.keys(l).reduce(function(e,r){const a=t+"["+r+"]";return l[r]!==null&&typeof l[r]=="object"&&!Array.isArray(l[r])?Object.assign(e,$t(l[r],a)):e[a]=l[r],e},{})},vt=function(l,t={},e){const r=`${window.fluentCartRestVars.ajaxurl}`,a=new AbortController,o=a.signal,s={"X-WP-Nonce":window.fluentCartRestVars.rest.nonce};["PUT","PATCH","DELETE"].indexOf(l.toUpperCase())!==-1&&(s["X-HTTP-Method-Override"]=l,l="POST"),t.query_timestamp=Date.now();const u=new Promise((f,_)=>{const h=new XMLHttpRequest;let x=r;if(l.toUpperCase()==="GET"){let w={};Object.keys(t).forEach(C=>{t[C]===null||t[C]===!1?delete t[C]:typeof t[C]=="object"?w=Object.assign(w,$t(t[C],C)):w[C]=t[C]});let V=new URLSearchParams(w).toString();x.indexOf("?")!==-1?x+="&"+V:x+="?"+V}h.open(l,x,!0),o.addEventListener("abort",()=>{h.abort(),_({aborted:!0,message:"Request aborted"})}),Object.keys(s).forEach(w=>{h.setRequestHeader(w,s[w])}),h.onload=function(){let w;try{w=JSON.parse(h.responseText)}catch{w=null}this.status>=200&&this.status<300?f(w):(w&&(typeof w=="object"&&(w.xhr_status=h.status),w.code=="rest_cookie_invalid_nonce"&&document.dispatchEvent(new CustomEvent("fcart_renew_rest_nonce",{detail:w}))),_(w))},h.onerror=function(){_({status:h.status,statusText:h.statusText})},l.toUpperCase()==="GET"?h.send():(h.setRequestHeader("Content-Type","application/json;charset=UTF-8"),h.send(JSON.stringify(t)))});return e?{request:u,controller:a}:u};document.addEventListener("DOMContentLoaded",function(){window.fluentCartCart=new ct().init(),window.fluentCartUtmManager=new H,Vt.init(),window.fluentCartAjax={get:function(l={},t=!1){return vt("GET",l,t)},post:function(l={},t=!1){return vt("POST",l,t)}},window.fluentcart.ajax=window.fluentCartAjax,dt.init(),window.dispatchEvent(new CustomEvent("fluent_cart_app_loaded",{})),document.addEventListener("click",function(l){const t=l.target.closest("[data-fluent-cart-collapsible-toggle]");if(!t)return;l.preventDefault(),t.closest("[data-fluent-cart-collapsibles]").classList.toggle("show-all")})});
1 +var vt=u=>{throw TypeError(u)};var ct=(u,t,e)=>t.has(u)||vt("Cannot "+e);var n=(u,t,e)=>(ct(u,t,"read from private field"),e?e.call(u):t.get(u)),f=(u,t,e)=>t.has(u)?vt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(u):t.set(u,e),p=(u,t,e,r)=>(ct(u,t,"write to private field"),r?r.call(u,e):t.set(u,e),e),l=(u,t,e)=>(ct(u,t,"access private method"),e);const Jt=["utm_campaign","utm_content","utm_term","utm_source","utm_medium","utm_id","refer_url"],St="fluent_cart_utm_before_store",J="open",Et="pending",it="granted",Qt="denied";class x{constructor(t={}){this.storageKey=t.storageKey||"fc_utm_data",this.expirationDays=t.expirationDays||30,this.clickExpirationDays=t.clickExpirationDays||90,this.utmKeys=t.utmKeys||x.getUtmParams(),this.internalDomains=t.internalDomains||x.getInternalDomains(),this.consentState=J,this.collectFromURL()}static partition(t){const e={},r={};return Object.keys(t||{}).forEach(a=>{Jt.indexOf(a)!==-1?e[a]=t[a]:r[a]=t[a]}),{attribution:e,clickIds:r}}collectFromURL(){const t=this.getURLParams(),e=Object.keys(t).some(r=>r!=="refer_url");if(t.refer_url&&(t.refer_url=this.normalizeReferUrl(t.refer_url)),!t.refer_url&&document.referrer)try{const r=new URL(document.referrer).hostname;r!==window.location.hostname&&!this.isInternalHost(r)&&(t.refer_url=this.normalizeReferUrl(document.referrer))}catch{}if(Object.keys(t).length>0){this.requestStore(t,e);return}this.requestAccess()}requestAccess(){const t=this.getStoredData(!1);if(!Object.keys(t.params).length&&!Object.keys(t.clickIds).length)return;const e=new CustomEvent(St,{cancelable:!0,detail:{params:{...t.clickIds,...t.params},replace:!1,reason:"read",allow:()=>{this.consentState=it},deny:()=>this.revokeConsent()}});window.dispatchEvent(e),e.defaultPrevented&&this.consentState===J&&(this.consentState=Et)}requestStore(t,e=!1){const r={...t},a=new CustomEvent(St,{cancelable:!0,detail:{params:{...r},replace:e,allow:()=>{this.consentState=it,this.store(r,e)},deny:()=>this.revokeConsent()}});if(window.dispatchEvent(a),a.defaultPrevented){this.consentState===J&&(this.consentState=Et);return}this.store(r,e)}hasConsent(){return this.consentState===J||this.consentState===it}revokeConsent(){this.consentState=Qt,this.clear()}normalizeReferUrl(t){const e=String(t||"").trim();if(!e)return"";const r=/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?e:"https://"+e.replace(/^\/+/,"");try{return new URL(r).hostname.toLowerCase().replace(/^www\./,"")}catch{return e}}isInternalHost(t){const e=(t||"").toLowerCase();return this.internalDomains.some(r=>{const a=String(r).toLowerCase().replace(/^www\./,"");return e===a||e==="www."+a||e.endsWith("."+a)})}getURLParams(){const t=new URLSearchParams(window.location.search),e={};return this.utmKeys.forEach(r=>{const a=t.get(r);a&&(e[r]=a)}),e}store(t,e=!1){const r=this.getStoredData(),a=Date.now(),o=x.partition(t),s=e?{...o.attribution}:{...r.params,...o.attribution},c={...r.clickIds,...o.clickIds},d=Object.keys(o.clickIds).length>0,_={params:s,timestamp:a,clickIds:c,clickTimestamp:d?a:r.clickTimestamp||null};try{localStorage.setItem(this.storageKey,JSON.stringify(_))}catch{}}getStoredData(t=!0){const e={params:{},timestamp:null,clickIds:{},clickTimestamp:null};try{const r=localStorage.getItem(this.storageKey);if(!r)return e;const a=JSON.parse(r);if(!a||!a.timestamp)return e;const o=!a.clickIds,s=o?x.partition(a.params):{attribution:a.params||{},clickIds:a.clickIds||{}},c=o?a.timestamp:a.clickTimestamp||null,d={params:this.isExpired(a.timestamp,this.expirationDays)?{}:s.attribution,timestamp:a.timestamp,clickIds:this.isExpired(c,this.clickExpirationDays)?{}:s.clickIds,clickTimestamp:c};return!Object.keys(d.params).length&&!Object.keys(d.clickIds).length?(t&&this.clear(),e):d}catch{}return e}isExpired(t,e=null){const r=e===null?this.expirationDays:e;return!r||!t?!1:Date.now()-t>r*24*60*60*1e3}get(){if(!this.hasConsent())return{};const t=this.getStoredData();return{...t.clickIds||{},...t.params||{}}}clear(){try{localStorage.removeItem(this.storageKey)}catch{}}static getUtmParams(){return window.fluentcart_utm_vars&&window.fluentcart_utm_vars.allowed_keys||["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"]}static getInternalDomains(){return window.fluentcart_utm_vars&&window.fluentcart_utm_vars.internal_domains||[]}}var kt,Tt,M,k,v,Y,Z,H,R,tt,T,P,et,W,ut,i,It,dt,Ot,ft,U,Dt,xt,Pt,Nt,D,Ut,Mt,Rt,Bt,j;const g=class g{constructor(){f(this,i);f(this,v,[]);f(this,Y,"?action=fluent_cart_checkout_routes&fc_checkout_action=fluent_cart_cart_status");f(this,Z,"?action=fluent_cart_checkout_routes&fc_checkout_action=fluent_cart_cart_update");f(this,H,window.fluentCartRestVars.ajaxurl);f(this,R,!1);f(this,tt,(kt=window.fluentcart_drawer_vars)==null?void 0:kt.is_admin_bar_showing);f(this,T,"open");f(this,P,"active");f(this,et,((Tt=window.fluentcart_drawer_vars)==null?void 0:Tt.is_drawer_hidden)=="1")}init(){return n(g,M)!==null?n(g,M):(p(g,M,this),l(this,i,Bt).call(this),n(this,et)||l(this,i,Rt).call(this),l(this,i,Mt).call(this),l(this,i,Dt).call(this),l(this,i,xt).call(this),l(this,i,Pt).call(this),l(this,i,Nt).call(this),l(this,i,It).call(this),this)}broadcastCartCleared(){g.broadcastCartUpdate([],null)}static broadcastCartUpdate(t,e){var a;if(!n(g,k))return;const r=l(a=g,W,ut).call(a);!t||t.length===0?n(g,k).postMessage({_token:r,type:"cart_cleared"}):n(g,k).postMessage({_token:r,type:"cart_updated",cart_data:t,fragments:e||[]})}async getCart(){let t=await new Promise((e,r)=>{var s,c;const a={"Content-Type":"application/json"},o=(c=(s=window.fluentCartRestVars)==null?void 0:s.rest)==null?void 0:c.nonce;o&&(a["X-WP-Nonce"]=o),fetch(n(this,H)+n(this,Y),{method:"GET",headers:a}).then(d=>{if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return d.json()}).then(d=>{d&&d.cart_data?e(d.cart_data):e([])}).catch(d=>{r([])})});return p(this,v,t),window.dispatchEvent(new Event("fluentCartNotifyCartDrawerItemChanged")),t}async addProduct(t,e=1,r=!1,a=!1,o=!1){return l(this,i,U).call(this,t,e,r,a,o)}async removeProduct(t,e=!1){return t=t.toString(),await l(this,i,U).call(this,t,0,!1,e)}async incrementProduct(t,e=1){const r=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");return r&&r.classList.contains("active")&&p(this,R,!0),t=t.toString(),e=Math.abs(parseInt(e.toString())),await l(this,i,U).call(this,t,e)}async decrementProduct(t,e=1){const r=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");return r&&r.classList.contains("active")&&p(this,R,!0),t=t.toString(),e=Math.abs(parseInt(e.toString())),await l(this,i,U).call(this,t,e*-1)}async updateProductQuantity(t,e=1,r=!1){return e=parseInt(e.toString(),10),(isNaN(e)||e<1)&&(e=1),t=t.toString(),await l(this,i,U).call(this,t,e,r)}closeModal(){const t=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),e=document.querySelector("[data-fluent-cart-cart-drawer]"),r=document.body;t&&t.classList.remove(n(this,P)),e&&e.classList.remove(n(this,T)),r.style.overflow=""}openModal(){const t=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),e=document.querySelector("[data-fluent-cart-cart-drawer]"),r=document.body;t&&t.classList.add(n(this,P)),e&&e.classList.add(n(this,T)),r.style.overflow="hidden"}appendUtmSource(t){const e=window.fluentCartUtmManager;if(e&&!e.hasConsent())return t;const r=new URLSearchParams(window.location.search);return x.getUtmParams().forEach(a=>{r.has(a)&&(t[a]=r.get(a))}),t}getState(){return n(this,v)}updateCartTotalPrice(t=[]){var s,c;let e=0;const r=((c=(s=window.fluentcart_drawer_vars)==null?void 0:s.currency_settings)==null?void 0:c.currency_sign)||"$";t.forEach(d=>{d.subtotal&&(e+=d.subtotal)});const a=String(parseFloat((e/100).toFixed(2))),o=`${r}${a}`;return document.querySelectorAll("[data-fluent-cart-cart-total-price]").forEach(d=>{d.textContent=o}),o}};M=new WeakMap,k=new WeakMap,v=new WeakMap,Y=new WeakMap,Z=new WeakMap,H=new WeakMap,R=new WeakMap,tt=new WeakMap,T=new WeakMap,P=new WeakMap,et=new WeakMap,W=new WeakSet,ut=function(){const t="fc_bc_token";let e=localStorage.getItem(t);return e||(e=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2),localStorage.setItem(t,e)),e},i=new WeakSet,It=function(){var e;if(typeof BroadcastChannel>"u"||n(g,k))return;const t=((e=window.fluentCartRestVars)==null?void 0:e.ajaxurl)||window.location.origin;p(g,k,new BroadcastChannel("fluent_cart_cart:"+t)),n(g,k).onmessage=r=>{var a;r.data&&r.data.type&&r.data._token===l(a=g,W,ut).call(a)&&l(this,i,Ot).call(this,r.data)}},dt=function(t){return{distinctCount:t.length,totalQty:t.reduce((e,r)=>e+(r.quantity||1),0)}},Ot=function(t){if(t.type==="cart_updated"&&Array.isArray(t.fragments)){const e=Array.isArray(t.cart_data)?t.cart_data:[],{distinctCount:r,totalQty:a}=l(this,i,dt).call(this,e);window.fluentcart_drawer_vars&&(window.fluentcart_drawer_vars.cart_item_count=r,window.fluentcart_drawer_vars.cart_total_quantity=a),this.updateCartTotalPrice(e),l(this,i,j).call(this,r,a),document.querySelectorAll(".fct-cart-badge-count").forEach(c=>{c.textContent=r.toString()});const o=document.querySelector("[data-fluent-cart-cart-drawer]"),s=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");o&&(o.style.transition="none"),s&&(s.style.transition="none"),l(this,i,ft).call(this,t.fragments,!0),requestAnimationFrame(()=>{const c=document.querySelector("[data-fluent-cart-cart-drawer]"),d=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");c&&(c.style.transition=""),d&&(d.style.transition="")}),document.querySelectorAll("[data-fluent-cart-cart-total-item]").forEach(c=>{c.textContent=r.toString()}),p(this,v,e),l(this,i,D).call(this)}t.type==="cart_cleared"&&(p(this,v,[]),window.fluentcart_drawer_vars&&(window.fluentcart_drawer_vars.cart_item_count=0,window.fluentcart_drawer_vars.cart_total_quantity=0),l(this,i,j).call(this,0,0),document.querySelectorAll(".fct-cart-badge-count").forEach(e=>{e.textContent="0"}),this.updateCartTotalPrice([]),l(this,i,D).call(this))},ft=function(t,e=!1){const r="[data-fluent-cart-cart-drawer-container]";t.forEach(a=>{const o=document.querySelector(a.selector);if(a.selector===r){o?!e&&a.type==="replace"&&(o.outerHTML=a.content):(document.body.insertAdjacentHTML("beforeend",a.content),e&&this.closeModal());return}o&&a.type==="replace"&&(a.content?o.outerHTML=a.content:o.remove())})},U=async function(t=null,e=1,r=!1,a=!1,o=!1){if(t==null)return;const s=document.querySelector("[data-fluent-cart-cart-drawer]");let c="";s&&(c=s.querySelector("[data-fluent-cart-cart-drawer-loader]"),c&&c.classList.add("show"));const d=this;let _={item_id:t,quantity:e,is_custom:o};r&&(_.by_input=!0),(n(this,R)||a||r)&&(_.open_cart=!0),_.is_admin_bar_enabled=n(this,tt),_=this.appendUtmSource(_);let h=null,O=!1,w=await new Promise((E,mt)=>{const wt=new URL(n(this,H)+n(this,Z));Object.entries(_).forEach(([G,X])=>{wt.searchParams.append(G,X)});const C=new XMLHttpRequest;C.open("GET",wt.toString(),!0),C.setRequestHeader("Content-Type","application/json"),C.setRequestHeader("X-WP-Nonce",window.fluentCartRestVars.rest.nonce),C.onreadystatechange=function(){var G,X,yt,pt,gt,bt,_t;if(C.readyState===XMLHttpRequest.DONE)try{if(C.status>=200&&C.status<300){const y=JSON.parse(C.responseText),ot=(X=(G=y.data)==null?void 0:G.cart)==null?void 0:X.cart_data;if(Array.isArray(ot)){const{distinctCount:z,totalQty:B}=l(yt=d,i,dt).call(yt,ot);window.fluentcart_drawer_vars.cart_item_count=z,window.fluentcart_drawer_vars.cart_total_quantity=B,l(pt=d,i,j).call(pt,z,B),d.updateCartTotalPrice(ot)}if(y!=null&&y.fragments){const z=Array.isArray(y.fragments)?y.fragments:[y.fragments];h=Array.isArray(y.fragments)?y.fragments:null,l(gt=d,i,ft).call(gt,z);const B=document.querySelector("[data-fluent-cart-cart-drawer]");B&&B.classList.contains(n(d,T))&&d.openModal()}(_t=(bt=y==null?void 0:y.data)==null?void 0:bt.cart)!=null&&_t.cart_data?(O=!0,E(y.data.cart.cart_data)):(y.message&&new Toastify({text:y.message,className:"warning",duration:3e3,gravity:"top",position:"right",slideFrom:"right",type:"warning"}).showToast(),E([])),c&&c.classList.remove("show")}else{const y=C.responseText&&JSON.parse(C.responseText).message||"An error occurred";new Toastify({text:y,className:"info",duration:2e3,style:{background:"#eabe11"}}).showToast(),c&&c.classList.remove("show"),mt(new Error(y))}}catch(y){y.message&&new Toastify({text:y.message,className:"info",duration:2e3,style:{background:"#eabe11"}}).showToast(),c&&c.classList.remove("show"),mt(y)}},C.send()});return w.length,p(this,v,w),O&&g.broadcastCartUpdate(w,h),new URLSearchParams(window.location.search).has("fct_cart_hash")||window.dispatchEvent(new CustomEvent("fluentCartNotifyCartDrawerItemChanged",{detail:{response:w}})),w},Dt=function(){const t=this;document.addEventListener("click",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-delete-button]");if(r){const o=r.dataset.itemId,s=await t.removeProduct(o,!0);s!=null&&(p(t,v,s),l(a=t,i,D).call(a))}})},xt=function(){const t=this;document.addEventListener("click",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-increase-button]");if(r){const o=r.dataset.itemId,s=await t.incrementProduct(o);s!=null&&(p(t,v,s),l(a=t,i,D).call(a))}})},Pt=function(){const t=this;document.addEventListener("click",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-decrease-button]");if(r){const o=r.dataset.itemId,s=await t.decrementProduct(o);s!=null&&(p(t,v,s),l(a=t,i,D).call(a))}})},Nt=function(){const t=this;document.addEventListener("change",async function(e){var a;const r=e.target.closest("[data-fluent-cart-cart-list-item-quantity-input]");if(r){const o=r.dataset.itemId;let s=parseInt(event.target.value,10);parseInt(event.target.dataset.oldValue||"0",10),s<1&&(s=1);let c=s;const d=await t.updateProductQuantity(o,c,!0);d!=null&&(p(t,v,d),l(a=t,i,D).call(a))}})},D=function(){if(l(this,i,Ut).call(this)){const t=document.querySelectorAll("[data-fluent-cart-cart-total-item]"),e=document.querySelectorAll("[data-fluent-cart-checkout-page-cart-item-count]"),r=document.querySelectorAll("[data-fluent-cart-cart-total-wrapper]"),a=document.querySelectorAll("[data-fluent-cart-cart-expand-button]"),o=document.querySelectorAll("[data-fluent-cart-cart-checkout-button-wrap]");t&&t.forEach(s=>s.textContent="0"),e&&e.forEach(s=>s.textContent="0"),r&&r.forEach(s=>s.style.display="none"),o&&o.forEach(s=>s.style.display="none"),a&&a.forEach(s=>s.classList.add("is-hidden")),setTimeout(()=>{this.closeModal()},300)}},Ut=function(){return n(this,v)===void 0||n(this,v)==null||Object.keys(n(this,v)).length===0},Mt=function(){const t=this;document.addEventListener("click",function(e){const r=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");r&&r.contains(e.target)&&t.closeModal()})},Rt=function(){const t=this,e=document.body;document.addEventListener("click",r=>{document.querySelector("[data-fluent-cart-cart-drawer-container]");const a=document.querySelector("[data-fluent-cart-cart-drawer]"),o=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),s=r.target.closest("[data-fluent-cart-cart-toggle-button]"),c=r.target.closest("[data-fluent-cart-cart-expand-button], .fcart-cart-toggle-button"),d=r.target.closest("[data-fluent-cart-cart-collapse-button]");if(s){a&&a.classList.toggle(n(t,T));return}if(c){a&&(a.classList.add(n(t,T)),e.style.overflow="hidden"),o&&o.classList.add(n(t,P));return}if(d){a&&a.classList.remove(n(t,T)),o&&o.classList.remove(n(t,P)),e.style.overflow="";return}})},Bt=function(){var e,r;l(this,i,j).call(this,((e=window.fluentcart_drawer_vars)==null?void 0:e.cart_item_count)||0,((r=window.fluentcart_drawer_vars)==null?void 0:r.cart_total_quantity)||0);const t=document.querySelector(".fluent-cart-menu-cart-open-button-container");if(t){const a=t.closest("li"),o=a==null?void 0:a.previousElementSibling;if(o&&a){const s=o.cloneNode(!0);s.removeAttribute("id"),s.innerHTML="",s.appendChild(t.cloneNode(!0)),a.parentNode.replaceChild(s,a)}}},j=function(t,e){document.querySelectorAll("[data-cart-badge-count]").forEach(r=>{const a=r.dataset.cartCountMode||"distinct_products";r.textContent=(a==="total_quantity"?e:t).toString()})},f(g,W),f(g,M,null),f(g,k,null);let lt=g;class Yt{static init(){document.addEventListener("click",function(t){var d;const e=t.target.closest("[data-fluent-cart-add-to-cart-button]");if(!e||(t.preventDefault(),e.classList.contains("fct-loading")))return;e.classList.add("fct-loading");const r=e.getAttribute("data-cart-id");if(!r)return;let a=parseInt(e.getAttribute("data-quantity"),10)||1;const o=e.getAttribute("data-action-name"),s=e.getAttribute("data-error-action-name");e.setAttribute("data-quantity","1");const c=e.getAttribute("data-is-custom");(d=window.fluentCartCart)==null||d.addProduct(r,a,!1,!0,c).then(_=>{setTimeout(()=>{e.classList.remove("fct-loading")},300),document.dispatchEvent(new Event(o))}).catch(_=>{e.classList.remove("fct-loading"),document.dispatchEvent(new Event(s))})})}}var N,A,b,S,q,rt,K,I,m,jt,Ht,Wt,Kt,Q,Ft,at,F,nt,V,st,Vt,$t,Gt,Xt;const L=class L{constructor(){f(this,m);f(this,A,null);f(this,b,null);f(this,S,null);f(this,q,null);f(this,rt,300);f(this,K,null);f(this,I,null);f(this,at,()=>{l(this,m,Gt).call(this),n(this,F).call(this),n(this,nt).call(this)});f(this,F,()=>{try{const t=n(this,b).contentDocument||n(this,b).contentWindow.document,e=t.querySelector("[data-fct-modal-checkout-form-inner]");let r=t.body.scrollHeight;if(e)for(const o of e.children)r=Math.max(r,o.scrollHeight);r+=20;const a=r+"px";n(this,b).style.height!==a&&(n(this,b).style.height=a)}catch{}});f(this,nt,()=>{n(this,V).call(this);try{const t=n(this,b).contentDocument||n(this,b).contentWindow.document;let e=null;p(this,I,new MutationObserver(()=>{e||(e=requestAnimationFrame(()=>{e=null,n(this,F).call(this)}))})),n(this,I).observe(t.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]})}catch{}});f(this,V,()=>{n(this,I)&&(n(this,I).disconnect(),p(this,I,null))});f(this,st,t=>{var e;t.origin===window.location.origin&&((e=t.data)==null?void 0:e.type)==="fluentCartCheckoutComplete"&&(t.data.redirectUrl?window.location.href=t.data.redirectUrl:this.closeModal())});var t;this.translate=((t=window.fluentcart)==null?void 0:t.$t)||(e=>e),l(this,m,jt).call(this),l(this,m,Ht).call(this)}static init(){return n(L,N)||p(L,N,new L),n(L,N)}openModal(t){if(n(this,A)||!n(this,S)||!n(this,b)){(!n(this,S)||!n(this,b))&&l(this,m,Vt).call(this);return}p(this,A,n(this,S)),l(this,m,$t).call(this),n(this,b).src=t,n(this,b).addEventListener("load",()=>{n(this,at).call(this),l(this,m,Xt).call(this,n(this,b))},{once:!0}),n(this,K)||(p(this,K,!0),window.addEventListener("message",n(this,st))),n(this,S).classList.add("fct-checkout-modal-open"),n(this,S).style.opacity="1",n(this,S).style.visibility="visible",window.dispatchEvent(new CustomEvent("fluentCartModalCheckoutOpened",{detail:{checkoutUrl:t}}))}closeModal(){n(this,A)&&(n(this,A).classList.remove("fct-checkout-modal-open"),n(this,S).style.opacity="0",n(this,S).style.visibility="hidden",setTimeout(()=>{n(this,V).call(this),n(this,b)&&(n(this,b).src=""),p(this,A,null),window.dispatchEvent(new CustomEvent("fluentCartModalCheckoutClosed"))},n(this,rt)))}};N=new WeakMap,A=new WeakMap,b=new WeakMap,S=new WeakMap,q=new WeakMap,rt=new WeakMap,K=new WeakMap,I=new WeakMap,m=new WeakSet,jt=function(){p(this,q,document.querySelector("[data-fct-checkout-modal-loader]")),p(this,S,document.querySelector("[data-fct-checkout-modal-container]")),p(this,b,document.querySelector("[data-fct-checkout-modal-iframe]"))},Ht=function(){l(this,m,Wt).call(this),document.addEventListener("click",l(this,m,Ft).bind(this)),l(this,m,Kt).call(this)},Wt=function(){document.querySelectorAll("[data-fct-instant-checkout-button]").forEach(e=>{e.addEventListener("click",l(this,m,Q).bind(this))})},Kt=function(){new MutationObserver(e=>{e.forEach(r=>{r.addedNodes.forEach(a=>{var o;a.nodeType===1&&((o=a.hasAttribute)!=null&&o.call(a,"data-fct-instant-checkout-button")&&a.addEventListener("click",l(this,m,Q).bind(this)),a.querySelectorAll&&a.querySelectorAll("[data-fct-instant-checkout-button]").forEach(c=>{c.addEventListener("click",l(this,m,Q).bind(this))}))})})}).observe(document.body,{childList:!0,subtree:!0})},Q=function(t){t.preventDefault();const r=t.currentTarget.getAttribute("href"),a=new URL(r,window.location.origin);a.searchParams.set("fluent-cart","modal_checkout"),this.openModal(a.toString())},Ft=function(t){t.target.closest("[data-fct-checkout-modal-close]")&&(t.preventDefault(),this.closeModal())},at=new WeakMap,F=new WeakMap,nt=new WeakMap,V=new WeakMap,st=new WeakMap,Vt=function(){typeof Toastify<"u"?new Toastify({text:this.translate("Modal checkout is not available. Please try again."),className:"info",duration:3e3,style:{background:"linear-gradient(to right, rgb(255 30 30), rgb(252 133 101))",color:"#fff"}}).showToast():alert(this.translate("Modal checkout is not available. Please try again."))},$t=function(){n(this,q)&&(n(this,q).style.display="")},Gt=function(){n(this,q)&&(n(this,q).style.display="none")},Xt=function(t){var e;try{const r=t.contentDocument||((e=t.contentWindow)==null?void 0:e.document);if(!r||!r.body)return;const a=s=>{if(s.tagName!=="A")return;const c=s.getAttribute("href")||"";c.startsWith("#")||c.startsWith("mailto:")||c.startsWith("tel:")||(s.hasAttribute("target")||(s.target="_blank"),s.rel||(s.rel="noopener noreferrer"))};r.querySelectorAll("a").forEach(a),new MutationObserver(s=>{var c,d;for(const _ of s)for(const h of _.addedNodes)h.nodeType===1&&((c=h.matches)!=null&&c.call(h,"a")&&a(h),(d=h.querySelectorAll)==null||d.call(h,"a").forEach(a))}).observe(r.body,{childList:!0,subtree:!0})}catch{}},f(L,N,null);let ht=L;var Lt,At,qt;const Zt={...((Lt=window.fluentcart_checkout_vars)==null?void 0:Lt.trans)||{},...((At=window.fluentcart_checkout_vars)==null?void 0:At.payments_trans)||{},...((qt=window.fluentcart_shop_vars)==null?void 0:qt.trans)||{}};window.fluentcart={$t:function(u){let t=Zt[u]||u;const e=Array.prototype.slice.call(arguments,1);if(e.length===0)return t;const r=/%(\d*\$?)s|%d/g;let a=0;return t=t.replace(r,(o,s)=>{if(s){const c=parseInt(s,10)-1;return c<e.length?e[c]:o}else return a<e.length?e[a++]:o}),t}};const zt=function(u,t){return Object.keys(u).reduce(function(e,r){const a=t+"["+r+"]";return u[r]!==null&&typeof u[r]=="object"&&!Array.isArray(u[r])?Object.assign(e,zt(u[r],a)):e[a]=u[r],e},{})},Ct=function(u,t={},e){const r=`${window.fluentCartRestVars.ajaxurl}`,a=new AbortController,o=a.signal,s={"X-WP-Nonce":window.fluentCartRestVars.rest.nonce};["PUT","PATCH","DELETE"].indexOf(u.toUpperCase())!==-1&&(s["X-HTTP-Method-Override"]=u,u="POST"),t.query_timestamp=Date.now();const c=new Promise((d,_)=>{const h=new XMLHttpRequest;let O=r;if(u.toUpperCase()==="GET"){let w={};Object.keys(t).forEach(E=>{t[E]===null||t[E]===!1?delete t[E]:typeof t[E]=="object"?w=Object.assign(w,zt(t[E],E)):w[E]=t[E]});let $=new URLSearchParams(w).toString();O.indexOf("?")!==-1?O+="&"+$:O+="?"+$}h.open(u,O,!0),o.addEventListener("abort",()=>{h.abort(),_({aborted:!0,message:"Request aborted"})}),Object.keys(s).forEach(w=>{h.setRequestHeader(w,s[w])}),h.onload=function(){let w;try{w=JSON.parse(h.responseText)}catch{w=null}this.status>=200&&this.status<300?d(w):(w&&(typeof w=="object"&&(w.xhr_status=h.status),w.code=="rest_cookie_invalid_nonce"&&document.dispatchEvent(new CustomEvent("fcart_renew_rest_nonce",{detail:w}))),_(w))},h.onerror=function(){_({status:h.status,statusText:h.statusText})},u.toUpperCase()==="GET"?h.send():(h.setRequestHeader("Content-Type","application/json;charset=UTF-8"),h.send(JSON.stringify(t)))});return e?{request:c,controller:a}:c};document.addEventListener("DOMContentLoaded",function(){window.fluentCartCart=new lt().init(),window.fluentCartUtmManager=new x,Yt.init(),window.fluentCartAjax={get:function(u={},t=!1){return Ct("GET",u,t)},post:function(u={},t=!1){return Ct("POST",u,t)}},window.fluentcart.ajax=window.fluentCartAjax,ht.init(),window.dispatchEvent(new CustomEvent("fluent_cart_app_loaded",{})),document.addEventListener("click",function(u){const t=u.target.closest("[data-fluent-cart-collapsible-toggle]");if(!t)return;u.preventDefault(),t.closest("[data-fluent-cart-collapsibles]").classList.toggle("show-all")})});