import{h as m,r as V,e as g,o as _,d as u,c as C,t as f,u as h,a as k,f as y,w,a2 as S}from"./chunks/vue.esm-bundler.js?ver=1.3.21";import{u as A}from"./chunks/useElementPlusComponents.js?ver=1.3.21";import{t as v}from"./chunks/Translator.js?ver=1.3.21";import{_ as b}from"./chunks/AddProductItemModal.js?ver=1.3.21";import{_ as x}from"./chunks/_plugin-vue_export-helper.js?ver=1.3.21";import"./chunks/index.js?ver=1.3.21";import"./chunks/index2.js?ver=1.3.21";import"./chunks/index4.js?ver=1.3.21";import"./chunks/dayjs.min.js?ver=1.3.21";import"./chunks/index3.js?ver=1.3.21";import"./chunks/Arr.js?ver=1.3.21";import"./chunks/DynamicIcon.js?ver=1.3.21";import"./chunks/CaretRight.js?ver=1.3.21";import"./chunks/Str.js?ver=1.3.21";import"./chunks/productService.js?ver=1.3.21";import"./chunks/Model.js?ver=1.3.21";import"./chunks/Rest.js?ver=1.3.21";import"./chunks/Asset.js?ver=1.3.21";import"./chunks/Url.js?ver=1.3.21";import"./chunks/vue-router.js?ver=1.3.21";const B={class:"fluent-cart-add-to-cart-app"},E={class:"fluent-cart-add-to-cart-app-title"},I={key:0,class:"fluent-cart-add-to-cart-app-content"},j=["title"],F={class:"fluent-cart-add-to-cart-app-product-id"},N=["innerHTML"],Q={__name:"App",props:{variantId:{type:String,default:""},variantTitle:{type:String,default:""},variantPrice:{type:String,default:""}},setup(e){const a=e;m(0);const s=m(a.variantId),d=m(a.variantTitle),l=m(a.variantPrice),T=()=>{s.value="",d.value="",l.value="",setTimeout(()=>{var n,i,o,r;const c=(n=elementor.getPanelView())==null?void 0:n.getCurrentPageView(),t=c==null?void 0:c.model;t&&((i=t.setSetting)==null||i.call(t,"variant_id",""),(r=(o=elementor==null?void 0:elementor.saver)==null?void 0:o.setFlagEditorChange)==null||r.call(o,!0))},100)},P=c=>{s.value=c,setTimeout(()=>{var i,o,r,p;const t=(i=elementor.getPanelView())==null?void 0:i.getCurrentPageView(),n=t==null?void 0:t.model;n&&((o=n.setSetting)==null||o.call(n,"variant_id",c.toString()),(p=(r=elementor==null?void 0:elementor.saver)==null?void 0:r.setFlagEditorChange)==null||p.call(r,!0))},100)};return(c,t)=>{const n=V("el-button");return _(),g("div",null,[u("div",B,[u("h3",E,f(h(v)("Add To Cart Button")),1),s.value?(_(),g("div",I,[u("div",{class:"fluent-cart-add-to-cart-app-product-title",title:d.value},[u("span",F,"#"+f(s.value),1),y(f(d.value),1)],8,j),u("div",{class:"fluent-cart-add-to-cart-app-product-price",innerHTML:l.value},null,8,N),k(n,{class:"fluent-cart-add-to-cart-app-reset-button",type:"primary",onClick:T},{default:w(()=>[y(f(h(v)("Reset")),1)]),_:1})])):(_(),C(b,{key:1,scopes:["cartable"],onOnVariationSelectionUpdated:t[0]||(t[0]=(i,o)=>{P(i[0]),o.forEach(r=>{for(const p of r.variants)if(p.id===i[0])return d.value=p.variation_title,l.value=p.formatted_total,!1})})}))])])}}},D=x(Q,[["__scopeId","data-v-37abec9b"]]),H=e=>{const a=e.dataset.variantId,s=e.dataset.variantTitle,d=e.dataset.variantPrice,l=S(D,{variantId:a,variantTitle:s,variantPrice:d});A(l),l.mixin({methods:{$t:v}}).mount(e)};jQuery(document).ready(function(){elementor.hooks.addAction("panel/open_editor/widget/fluent_cart_add_to_cart",function(e,a,s){a.get("settings")})});jQuery(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/fluent_cart_add_to_cart.default",function(e){const a=jQuery(e[0]).find("[data-fluent-cart-add-to-cart-app]")[0];H(a)})});
