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.5.4";import{u as A}from"./chunks/useElementPlusComponents.js?ver=1.5.4";import{t as v}from"./chunks/Translator.js?ver=1.5.4";import{_ as b}from"./chunks/AddProductItemModal.js?ver=1.5.4";import{_ as x}from"./chunks/_plugin-vue_export-helper.js?ver=1.5.4";import"./chunks/index.js?ver=1.5.4";import"./chunks/index2.js?ver=1.5.4";import"./chunks/index4.js?ver=1.5.4";import"./chunks/dayjs.min.js?ver=1.5.4";import"./chunks/index3.js?ver=1.5.4";import"./chunks/Arr.js?ver=1.5.4";import"./chunks/DynamicIcon.js?ver=1.5.4";import"./chunks/CaretRight.js?ver=1.5.4";import"./chunks/Str.js?ver=1.5.4";import"./chunks/productService.js?ver=1.5.4";import"./chunks/CurrencyFormatter.js?ver=1.5.4";import"./chunks/Model.js?ver=1.5.4";import"./chunks/Rest.js?ver=1.5.4";import"./chunks/Asset.js?ver=1.5.4";import"./chunks/Url.js?ver=1.5.4";import"./chunks/vue-router.js?ver=1.5.4";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 o,i,n,r;const c=(o=elementor.getPanelView())==null?void 0:o.getCurrentPageView(),t=c==null?void 0:c.model;t&&((i=t.setSetting)==null||i.call(t,"variant_id",""),(r=(n=elementor==null?void 0:elementor.saver)==null?void 0:n.setFlagEditorChange)==null||r.call(n,!0))},100)},P=c=>{s.value=c,setTimeout(()=>{var i,n,r,p;const t=(i=elementor.getPanelView())==null?void 0:i.getCurrentPageView(),o=t==null?void 0:t.model;o&&((n=o.setSetting)==null||n.call(o,"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 o=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(o,{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,n)=>{P(i[0]),n.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-197abdf2"]]),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)})});
