| 1 |
var im=Object.defineProperty;var rm=(e,t,a)=>t in e?im(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var ze=(e,t,a)=>rm(e,typeof t!="symbol"?t+"":t,a);import{v as C,m as E,j as r,t as u,G as s,u as c,l as x,C as o,g as h,q as R,x as f,F as P,D as ae,f as M,y as Te,o as xt,K as aa,e as G,k as wa,A as ue,R as sa,E as Ge,J as Ln,T as Gl,w as be,n as $e,i as ci,V as ea,L as Cl,M as Tl,s as Cn,a3 as ba,B as bl,P as fa,at as dm,O as Jt,ar as Zc,d as Bs,r as Ds,Q as Ga,ax as Ai,Z as um,a6 as eA,a7 as tA,S as Hs,ab as cm,p as pi,N as Qa,X as $l,a0 as Am,h as pm,z as aA,ad as fm,aG as mm,aH as hm,a2 as _m,a1 as dd,U as vm}from"./chunks/vue.esm-bundler.js?ver=1.8.0";import{a as Oa,u as Pa,o as lA,c as gm,d as ym}from"./chunks/vue-router.js?ver=1.8.0";import{_ as Zt}from"./chunks/preload-helper.js?ver=1.8.0";import{t as d,a as la,A as Ke,_ as xl,p as To}from"./chunks/Translator.js?ver=1.8.0";import{T as ds,a as us,c as ud,F as Qo,_ as ol,P as cs,B as Ht,b as sA,m as nA,d as oA,e as bm}from"./chunks/Badge.js?ver=1.8.0";import{P as Xa}from"./chunks/PageHeading.js?ver=1.8.0";import{B as Ls,a as Ul,ca as wm,C as Za,L as iA,Q as dl,a5 as Cm,cl as rA,N as Mo,O as cd,ad as dA,H as Yd,M as uA,cm as km,A as on,cn as Bm,aP as cA,cf as Ad,aQ as Lo,co as xm,cp as Sm,I as $m,cq as Fm,cr as Em,c9 as Um,cs as Im,ap as Vm}from"./chunks/index.js?ver=1.8.0";import{e as Ts,u as AA,_ as pA,f as pd,a as Va,g as fA,h as mA,L as fd,c as fi,O as hA,b as mi,P as md,C as ns}from"./chunks/OrderCustomerInformation.js?ver=1.8.0";import{_ as Lt,p as zl}from"./chunks/UserCan.js?ver=1.8.0";import{C as _t,f as as,r as Ol}from"./chunks/CurrencyFormatter.js?ver=1.8.0";import{_ as Sa,d as hd,b as _d,c as Dm,a as _A,S as vA,A as gA,e as yA}from"./chunks/Activity.js?ver=1.8.0";import{_ as wt}from"./chunks/Empty.js?ver=1.8.0";import{_ as ta,a as Ve,b as Be,C as xe}from"./chunks/CardBody.js?ver=1.8.0";import{_ as X}from"./chunks/DynamicIcon.js?ver=1.8.0";import{_ as nt}from"./chunks/_plugin-vue_export-helper.js?ver=1.8.0";import{e as Tm,S as Qt,u as Ro,a as un,b as yr,g as bA,c as Qm,d as hl,$ as Ra,j as Mm}from"./chunks/common.js?ver=1.8.0";import{I as tt}from"./chunks/IconButton.js?ver=1.8.0";import{M as il}from"./chunks/Model.js?ver=1.8.0";import{R as ce}from"./chunks/Rest.js?ver=1.8.0";import{d as at,g as Lm}from"./chunks/dayjs.min.js?ver=1.8.0";import{n as j}from"./chunks/Notify.js?ver=1.8.0";import{_ as ma}from"./chunks/Animation.js?ver=1.8.0";import{_ as os,T as Re,m as Ka,a as Yl,i as ca,r as Rm,L as br,e as Om,b as wA,d as CA,c as kA}from"./chunks/dateShortCuts.js?ver=1.8.0";import{S as $a,_ as Fa,u as As,b as Pm,a as Hm,c as Nm}from"./chunks/countries.js?ver=1.8.0";import{u as Ss,L as Ot,_ as hi}from"./chunks/NotFound.js?ver=1.8.0";import{c as Ql,a as kl,b as Ja,e as Rn,i as vd,U as gd,p as Km}from"./chunks/Utils.js?ver=1.8.0";import{A as pl}from"./chunks/Asset.js?ver=1.8.0";import{d as Gm}from"./chunks/index2.js?ver=1.8.0";import{S as Aa}from"./chunks/Str.js?ver=1.8.0";import{A as dt}from"./chunks/Arr.js?ver=1.8.0";import{C as Fs,V as cn,a as zt,c as On,b as So,d as zm,_ as jm}from"./chunks/AttrGroups.js?ver=1.8.0";import{U as Rs}from"./chunks/Url.js?ver=1.8.0";import{p as qm,E as js,v as Ym,i as Wm}from"./chunks/DynamicTemplateParser.js?ver=1.8.0";import{u as _i,t as BA}from"./chunks/timezone.js?ver=1.8.0";import{_ as Ns,P as xA}from"./chunks/ProductVariationSelector.js?ver=1.8.0";import{f as jt,a as Jm,p as Xm,b as Zm,g as eh,c as th,d as ah}from"./chunks/productService.js?ver=1.8.0";import{B as Oo}from"./chunks/BundleProducts.js?ver=1.8.0";import $o from"./chunks/ReviewStar.js?ver=1.8.0";import{m as Wd,n as lh,s as sh,a as nh,i as Jd,r as oh,b as ih,g as Xd,c as Zd,d as rh,e as dh,f as uh,h as ch,j as Ah,k as ph,l as fh}from"./chunks/galleryTabs.js?ver=1.8.0";import{E as eu}from"./chunks/index3.js?ver=1.8.0";import{T as wr}from"./chunks/TransitionAccordion.js?ver=1.8.0";import{_ as SA}from"./chunks/FileUploaderDialog.js?ver=1.8.0";import mh from"./chunks/Screenshot.js?ver=1.8.0";import{u as hh}from"./chunks/useElementPlusComponents.js?ver=1.8.0";import"./chunks/AddressComponent.js?ver=1.8.0";import"./chunks/weekOfYear.js?ver=1.8.0";import"./chunks/index4.js?ver=1.8.0";import"./chunks/reviewStar2.js?ver=1.8.0";class _h extends ds{getTabs(){return{}}getToggleableColumns(){return[{label:d("Lifetime Value (LTV)"),value:"ltv"},{label:d("Customer Since"),value:"customer_since"},{label:d("Last Purchase Date"),value:"last_purchase_date"}]}getSearchHint(){return d("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}}function $A(e){return _h.init(e)}const vh={class:"table-cell"},gh={class:"fct-product-info-card w-full"},yh={class:"fct-product-info-media"},bh={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},wh={class:"fct-product-info-name flex flex-col items-start gap-3"},Ch={class:"table-cell"},kh={class:"table-cell"},Bh={class:"table-cell"},xh={class:"table-cell"},Sh={class:"table-cell"},$h={__name:"CustomersLoader",props:{nextPageCount:{type:Number,default:0},customerTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,n)=>n+1);return(l,n)=>{const i=C("el-skeleton-item"),A=C("el-table-column"),p=C("el-table"),m=C("el-skeleton");return r(),E(m,{animated:""},{template:u(()=>[s(p,{data:c(a),class:"w-full compact-table responsive"},{default:u(()=>[s(A,{label:l.$t("Customer"),width:"340"},{default:u(()=>[o("div",vh,[o("div",gh,[o("div",yh,[s(i,{variant:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",bh,[o("div",wh,[s(i,{variant:"p",class:"max-w-[190px]"}),s(i,{variant:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),s(A,{label:l.$t("Address"),width:"340"},{default:u(()=>[o("div",Ch,[s(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),s(A,{label:l.$t("Purchases"),width:"102"},{default:u(()=>[o("div",kh,[s(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("ltv")?(r(),E(A,{key:0,label:l.$t("LTV"),width:"113"},{default:u(()=>[o("div",Bh,[s(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])):x("",!0),e.customerTable.isColumnVisible("last_purchase_date")?(r(),E(A,{key:1,label:l.$t("Last Purchase Date"),width:"226"},{default:u(()=>[o("div",xh,[s(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.customerTable.isColumnVisible("customer_since")?(r(),E(A,{key:2,label:l.$t("Customer Since"),width:"170"},{default:u(()=>[o("div",Sh,[s(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]),_:1})}}},Fh={key:0,class:"fct-customer-card"},Eh={class:"fct-customer-avatar"},Uh={class:"fct-customer-details"},Ih={class:"fct-customer-name"},Vh={class:"fct-customer-id"},Dh={class:"fct-customer-email"},Th=["innerHTML"],Qh={key:1},Mh={__name:"CustomersTable",props:{table:{type:Object,required:!0}},emits:["selectionChange"],setup(e,{emit:t}){const a=t,l=n=>{a("selectionChange",n)};return(n,i)=>{const A=C("el-table-column"),p=C("el-table");return r(),E(p,{data:e.table.getTableData(),class:"w-full compact-table",onSelectionChange:l},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No customer found!")},null,8,["text"])]),default:u(()=>[s(A,{type:"selection",width:"45"}),s(A,{label:c(d)("Customer"),width:"300"},{default:u(m=>{var _;return[s(ta,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>{var g,y,v,k,b,w;return[(g=m.row)!=null&&g.id?(r(),h("div",Fh,[o("div",Eh,[s(Ts,{url:(y=m.row)==null?void 0:y.photo,name:(v=m.row)==null?void 0:v.full_name},null,8,["url","name"])]),o("div",Uh,[o("div",Ih,[R(f(((k=m.row)==null?void 0:k.full_name)||c(d)("No Name"))+" ",1),o("span",Vh,"#"+f(c(la)((b=m.row)==null?void 0:b.id)),1)]),o("div",Dh,f((w=m.row)==null?void 0:w.email),1)])])):x("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),s(A,{label:c(d)("Address"),width:"300"},{default:u(m=>{var _;return[s(ta,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[R(f(n.getOrderAddress(m.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),s(A,{label:c(d)("Purchases"),width:90},{default:u(m=>{var _;return[s(ta,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[R(f(c(la)(m.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),E(A,{key:0,label:c(d)("LTV"),width:100},{default:u(m=>{var _;return[s(ta,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[o("span",{innerHTML:c(_t).formatNumber(m.row.ltv,!0,!1)},null,8,Th)]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),E(A,{key:1,label:c(d)("Last Purchase Date"),width:"200"},{default:u(m=>{var _;return[s(ta,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[m.row.last_purchase_date?(r(),E(Sa,{key:0,"date-time":m.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",Qh,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("customer_since")?(r(),E(A,{key:2,label:c(d)("Customer Since"),width:"150"},{default:u(m=>{var _;return[s(ta,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[s(Sa,{"date-time":m.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},Lh={class:"fct-customer-table-mobile-wrap"},Rh=["onClick"],Oh={class:"fct-customer-table-mobile-header"},Ph={key:0,class:"fct-customer-table-customer-col fct-customer-card"},Hh={class:"fct-customer-avatar"},Nh={class:"fct-customer-details"},Kh={class:"fct-customer-name"},Gh={class:"fct-customer-id"},zh={class:"fct-customer-email"},jh={class:"fct-customer-table-purchases-col"},qh={class:"fct-customer-table-mobile-body"},Yh={class:"fct-customer-table-mobile-body-list"},Wh={key:0,class:"fct-customer-table-ltv-col"},Jh={class:"label"},Xh=["innerHTML"],Zh={key:1,class:"fct-customer-table-last-purchase-date-col"},e_={class:"label"},t_={class:"value"},a_={key:2,class:"fct-customer-table-customer-since-col"},l_={class:"label"},s_={class:"value"},n_={class:"fct-customer-table-mobile-footer"},o_={class:"fct-customer-table-address-col"},i_={key:0,class:"py-6 text-center"},r_={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:d("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",Lh,[(r(!0),h(P,null,ae(e.table.getTableData(),(l,n)=>(r(),h("div",{key:l.id,class:"fct-customer-table-mobile-row",onClick:i=>t.$router.push({name:"view_customer",params:{customer_id:l.id}})},[o("div",Oh,[l!=null&&l.id?(r(),h("div",Ph,[o("div",Hh,[s(Ts,{url:l==null?void 0:l.photo,name:l==null?void 0:l.full_name},null,8,["url","name"])]),o("div",Nh,[o("div",Kh,[R(f((l==null?void 0:l.full_name)||c(d)("No Name"))+" ",1),o("span",Gh,"#"+f(l==null?void 0:l.id),1)]),o("div",zh,f(l==null?void 0:l.email),1)])])):x("",!0),o("div",jh,f(l.purchase_count)+" "+f(l.purchase_count>1?c(d)("Purchases"):c(d)("Purchase")),1)]),o("div",qh,[o("ul",Yh,[e.table.isColumnVisible("ltv")?(r(),h("li",Wh,[o("div",Jh,f(c(d)("LTV:")),1),o("div",{class:"value",innerHTML:c(_t).formatNumber(l.ltv,!0,!1)},null,8,Xh)])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",Zh,[o("div",e_,f(c(d)("Last Purchase Date:")),1),o("div",t_,[s(Sa,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):x("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",a_,[o("div",l_,f(c(d)("Customer Since:")),1),o("div",s_,[s(Sa,{"date-time":l.created_at},null,8,["date-time"])])])):x("",!0)])]),o("div",n_,[o("div",o_,[s(X,{name:"LocationPin"}),R(" "+f(t.getOrderAddress(l)),1)])])],8,Rh))),128)),e.table.getTableData().length===0?(r(),h("div",i_,[s(wt,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):x("",!0)]))}},d_={},u_={class:"px-4 py-3"},c_={class:"flex items-center justify-between mb-3"},A_={class:"flex items-center justify-between mb-3"},p_={class:"flex items-center justify-between mb-3"},f_={class:"flex items-center justify-between mb-3"};function m_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",u_,[o("div",c_,[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})]),o("div",A_,[s(a,{varient:"p",class:"w-[50px]"}),s(a,{varient:"p",class:"w-[80px]"})]),o("div",p_,[s(a,{varient:"p",class:"w-[120px]"}),s(a,{varient:"p",class:"w-[100px]"})]),o("div",f_,[s(a,{varient:"p",class:"w-[100px]"}),s(a,{varient:"p",class:"w-[100px]"})]),s(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const h_=nt(d_,[["render",m_]]),__={class:"fct-all-customers-page fct-layout-width"},v_={class:"fct-all-customers-wrap"},g_={key:1},y_={__name:"AllCustomers",setup(e){const t=$A(),a=M({showModal:!1,action:"create",title:d("Create New Customer"),customer:{}}),l=M(!1),n=M(!1),i=M([]),A=(y=!0)=>{const v=t.buildQueryParams();return y||(delete v.active_view,delete v.filter_type,delete v.search,delete v.advanced_filters),v},p=AA({entity:"customers",buildParams:()=>A(),buildAllParams:()=>A(!1),filenamePrefix:"customers-export"}),m=({scope:y,columns:v,modules:k,format:b})=>{let w=[];y==="current_page"?w=t.getTableData().map(B=>B.id).filter(Boolean):y==="selected"&&(w=i.value.map(B=>B.id).filter(Boolean)),p.startExport({scope:y,ids:w,columns:v,modules:k,format:b})},_=y=>{i.value=y},g=()=>{l.value=window.innerWidth<768};return Te(()=>{g(),window.addEventListener("resize",g)}),xt(()=>{window.removeEventListener("resize",g)}),(y,v)=>{const k=C("el-icon"),b=C("el-button"),w=C("el-dropdown-item"),B=C("el-dropdown-menu"),S=C("el-dropdown");return r(),h("div",__,[s(Xa,{title:c(d)("Customers")},{action:u(()=>[s(Lt,{permission:"customers/export"},{default:u(()=>[s(S,{trigger:"click","popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:u(()=>[s(B,null,{default:u(()=>[s(w,{onClick:v[0]||(v[0]=V=>n.value=!0)},{default:u(()=>[s(X,{name:"Download"}),R(" "+f(c(d)("Export Customers")),1)]),_:1})]),_:1})]),default:u(()=>[s(b,null,{default:u(()=>[R(f(c(d)("More actions"))+" ",1),s(k,null,{default:u(()=>[s(c(Ls))]),_:1})]),_:1})]),_:1})]),_:1}),s(Lt,{permission:"customers/manage"},{default:u(()=>[s(b,{type:"primary",onClick:v[1]||(v[1]=V=>a.value.showModal=!0)},{default:u(()=>[R(f(c(d)("Add Customer")),1)]),_:1})]),_:1})]),_:1},8,["title"]),s(Lt,{permission:"customers/view"},{default:u(()=>[o("div",v_,[s(us,{table:c(t),"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(h_,{key:0})):x("",!0),s(r_,{table:c(t)},null,8,["table"])]),default:u(()=>[c(t).isLoading()?(r(),E($h,{key:0,customerTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",g_,[s(Mh,{table:c(t),onSelectionChange:_},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),s(Lt,{permission:"customers/manage"},{default:u(()=>[s(pd,{"onUpdate:customerModal":v[2]||(v[2]=()=>{a.value.showModal=!1,a.value.customer={},c(t).fetch()}),customerModalInfos:a.value,customer_id:a.value.customer_id,customer:a.value.customer,onCloseModal:v[3]||(v[3]=V=>a.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"])]),_:1}),s(pA,{modelValue:n.value,"onUpdate:modelValue":v[4]||(v[4]=V=>n.value=V),title:c(d)("Export Customers"),"selected-count":i.value.length,"current-page-count":c(t).getTableData().length,"total-count":c(t).data.paginate.total,"item-label-singular":c(d)("customer"),"item-label-plural":c(d)("customers"),"has-active-filter":!!c(t).isFiltering(),"export-state":c(p),onExport:m},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}};class b_ extends ds{getTabs(){return{all:d("All"),completed:d("Completed"),processing:d("Processing"),"on-hold":d("On Hold"),paid:d("Paid"),subscription:d("Subscription"),renewal:d("Renewal"),refunded:d("Refunded"),partially_refunded:d("Partially Refunded"),upgraded_from:{title:d("Upgraded From"),description:d("Orders upgraded from another order")},upgraded_to:{title:d("Upgraded To"),description:d("Orders upgraded to another order")}}}getToggleableColumns(){return[{label:d("Customer"),value:"customer"},{label:d("Items"),value:"order_items"},{label:d("Order Status"),value:"status"},{label:d("Order Type"),value:"type"},{label:d("Actions"),value:"actions"}]}getSearchHint(){return d("Search by invoice no, customer name, or customer email.")}getFetchUrl(){return"orders"}parseResponse(t){return t.orders}getTableName(){return"order_table"}with(){return["admin_order_list"]}}function FA(e){return b_.init(e)}const w_={class:"fct-order-stats-card"},C_={class:"fct-order-stats-card-head"},k_={class:"fct-order-stats-card-head-content"},B_={class:"text"},x_={key:0,class:"value"},S_={class:"fct-order-stats-card-body"},$_={key:0,class:"change-wrap"},F_={key:0,class:"change-title"},E_={key:1,class:"change-title"},U_={key:1,class:"change-wrap"},I_={class:"change-title"},V_={__name:"StatCard",props:{direction:String,stat:Object,statRanges:Object,currentRange:String|Number,statKey:String|Number,loading:Boolean},setup(e){const t=aa().ctx,a=e,l=G(()=>{switch(a.statKey){case"total_orders":return"warning";case"paid_orders":return"blue";case"total_paid_order_items":return"danger";case"total_paid_amounts":return"secondary";default:return"info"}}),n=G(()=>A.value===0?"":A.value>0?"success":"danger"),i=m=>m.is_cents?t.formatNumber(m.current_count):la(m.current_count),A=G(()=>{let m=Tm(a.stat.current_count,a.stat.compare_count)??0;return m===""?0:m}),p=G(()=>a.statRanges[a.currentRange].label);return(m,_)=>{const g=C("el-skeleton"),y=C("el-skeleton-item");return r(),h("div",w_,[o("div",C_,[s(tt,{size:"large",bg:l.value,soft:""},{default:u(()=>[wa(m.$slots,"icon")]),_:3},8,["bg"]),o("div",k_,[s(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",B_,f(e.stat.title),1),e.loading?x("",!0):(r(),h("div",x_,f(i(e.stat)),1))])]),o("div",S_,[s(g,{loading:e.loading,animated:""},{template:u(()=>[s(y,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(r(),h("div",$_,[o("span",{class:ue("change "+n.value)},[A.value!==0?(r(),E(X,{key:0,name:A.value>0?"CaretUp":"CaretDown"},null,8,["name"])):x("",!0),R(" "+f(A.value===0?m.$t("Same as previous"):Math.abs(A.value)+"%"),1)],2),A.value>0?(r(),h("span",F_,f(c(d)("More than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):A.value<0?(r(),h("span",E_,f(c(d)("Less than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):x("",!0)])):x("",!0),!e.loading&&e.currentRange==="all_time"?(r(),h("div",U_,[o("span",I_,f(m.$t("All Time")),1)])):x("",!0)])])}}},D_={name:"CardFooter"},T_={class:"fct-card-footer"};function Q_(e,t,a,l,n,i){return r(),h("div",T_,[wa(e.$slots,"default")])}const yd=nt(D_,[["render",Q_]]);class EA{constructor(){ze(this,"_attributes",{})}attribute(t,a){return this._attributes[t]=a,this}setAttribute(t){return this._attributes=typeof t=="object"?t:this._attributes,this}}class ws{static install(t,a,l={},n=!1){const i=new a(...Object.values(l));Object.keys(i).forEach(A=>{(n||!t.hasOwnProperty(A))&&(t[A]=i[A])}),Object.getOwnPropertyNames(a.prototype).forEach(A=>{A!=="constructor"&&typeof i[A]=="function"&&(n||typeof t[A]!="function")&&(t[A]=i[A].bind(t))})}}class M_ extends il{constructor(){super(...arguments);ze(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:Ke.get("shop.currency_sign"),isBusy:{recentActivities:!1,fluctuations:!1,dashBoardStats:!1,recentOrders:!1,countryHeatMap:!1,salesGrowthChart:!0,topSoldProducts:!0}})}get controllerKey(){return"ReportingController"}beforeInit(){}makeRequest(a,l,n,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const A=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,n,i),A}resolvePromiseResponse(a,l=null,n=null){a.then(i=>{n==null||l==null||(this.data[n]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[n]=!1})}getDashboardStats(a={}){return this.makeRequest("dashboard-stats",a,"dashBoardStats","dashBoardStats")}getSalesGrowthChart(a={}){return this.makeRequest("sales-growth-chart",a,"salesGrowthChart","salesGrowthChart")}getCountryHeatMap(a={}){return this.makeRequest("country-heat-map",a,"countryHeatMap","countryHeatMap")}getRecentOrders(a={}){return this.makeRequest("get-recent-orders",a,"recentOrders","recentOrders")}getRecentActivities(a={}){return this.makeRequest("get-recent-activities",a,"recentActivities","recentActivities")}getSummary(a={}){return this.makeRequest("get-dashboard-summary",a,"summaryData","summaryData")}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}}const cl=M_.init(),L_={},R_={class:"fct-order-stats-row"},O_={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},P_={class:"flex items-center gap-2 mb-3"},H_={class:"right flex flex-col flex-1 gap-2"};function N_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",R_,[(r(),h(P,null,ae(4,n=>s(l,{animated:"",key:n},{template:u(()=>[o("div",O_,[o("div",P_,[s(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",H_,[s(a,{variant:"p",class:"rounded w-4/5 block"}),s(a,{variant:"p",class:"rounded w-1/2 block"})])]),o("div",null,[s(a,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64))])}const K_=nt(L_,[["render",N_]]),G_={class:"fct-order-stats-wrap"},z_={class:"fct-order-stats-actions flex items-center gap-2.5"},j_={class:"fct-order-stats-body"},q_={key:1,class:"fct-order-stats-row"},Y_={class:"flex justify-end mt-2"},W_=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=M(Qt.get("order_stat_collapse",!1)),a=M(""),l=aa().ctx,n=M(!1),i=M(!0),A=M(!1),p=M("-7 days"),m=Oa(),_=M({"-0 days":{label:d("Today"),desc:d("Compared to yesterday")},"-7 days":{label:d("Last 7 days"),desc:d("Compared to the previous 7 days")},"-30 days":{label:d("Last 30 days"),desc:d("Compared to the previous 30 days")},this_month:{label:d("This Month"),desc:d("Compared to the previous Month")},all_time:{label:d("All Time"),desc:d("See All time Sales Stat")}}),g=async v=>{if(p.value!==v)try{p.value=v,a.value="collapse",t.value===!0&&(t.value=!1,Qt.set("order_stat_collapse",t.value)),await Promise.all([l.Storage().set("order_quick_stat_bar_range",p.value),y()])}catch{}},y=()=>{A.value=!1,i.value=!0;const v={"-0 days":[at().startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],"-7 days":[at().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],"-30 days":[at().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],this_month:[at().startOf("month").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[k,b]=v[p.value]||[at().startOf("month"),at().endOf("day")],w={startDate:k,endDate:b,paymentStatus:"all"};cl.getDashboardStats({params:{...w}}).then(()=>{n.value=cl.data.dashBoardStats}).catch(B=>{}).finally(()=>{i.value=!1})};return Te(()=>{p.value=Qt.get("order_quick_stat_bar_range","-0 days");let v=Qt.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,y()}),(v,k)=>{const b=C("el-button");return r(),h("div",G_,[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Order Stats Overview"),border_bottom:""},{action:u(()=>[o("div",z_,[s(ud,{class:"hide-animation-on-mobile"},{default:u(()=>[(r(!0),h(P,null,ae(_.value,(w,B)=>(r(),E(Qo,{title:`${c(d)("Order Stats Overview of")} ${w.label}`,tabindex:"0",key:B,onClick:S=>g(B),class:ue(B===p.value?"active":"")},{default:u(()=>[R(f(w.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),s(Be,null,{default:u(()=>[o("div",j_,[i.value?(r(),E(K_,{key:0})):(r(),h("div",q_,[(r(!0),h(P,null,ae(n.value,(w,B)=>(r(),h("div",{key:B,class:"fct-order-stats-col cursor-pointer",onClick:k[0]||(k[0]=S=>c(m).push({name:"reports_orders"}))},[(r(),E(V_,{key:B,stat:w,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":B},{icon:u(()=>[s(X,{name:w.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",Y_,[s(b,{text:"",class:"underline-link-button",onClick:k[1]||(k[1]=w=>c(m).push({name:"reports_orders"}))},{default:u(()=>[R(f(c(d)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),J_={class:"table-cell"},X_={class:"table-cell"},Z_={class:"table-cell"},ev={class:"table-cell"},tv={class:"table-cell items-center gap-1"},av={class:"table-cell"},lv={class:"table-cell"},sv={class:"table-cell"},nv={__name:"OrdersLoader",props:{nextPageCount:{type:Number,default:0},orderTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=n=>t.orderTable.columns.includes(n),l=Array.from({length:t.nextPageCount},(n,i)=>i+1);return(n,i)=>{const A=C("el-table-column"),p=C("el-skeleton-item"),m=C("el-table"),_=C("el-skeleton");return r(),E(_,{animated:""},{template:u(()=>[s(m,{data:c(l),class:"w-full compact-table responsive"},{empty:u(()=>i[0]||(i[0]=[])),default:u(()=>[x("",!0),s(A,{label:n.$t("Date"),width:"140"},{default:u(()=>[o("div",J_,[s(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(r(),E(A,{key:1,width:"130",label:n.$t("Customer")},{default:u(()=>[o("div",X_,[s(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("order_items")?(r(),E(A,{key:2,label:n.$t("Items"),width:"402"},{default:u(()=>[o("div",Z_,[s(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),s(A,{width:"150",label:n.$t("Total")},{default:u(()=>[o("div",ev,[s(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),s(A,{width:"150",label:n.$t("Payment Status")},{default:u(()=>[o("div",tv,[s(p,{variant:"p",class:"w-4/5"}),s(p,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(r(),E(A,{key:3,width:"120",label:n.$t("Status")},{default:u(()=>[o("div",av,[s(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("type")?(r(),E(A,{key:4,width:"140",label:n.$t("Order Type")},{default:u(()=>[o("div",lv,[s(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("actions")?(r(),E(A,{key:5,width:"60",label:""},{default:u(()=>[o("div",sv,[s(p,{variant:"p",class:"w-3/5"})])]),_:1})):x("",!0)]),_:1},8,["data"])]),_:1})}}},ov={},iv={class:"px-4 py-3"},rv={class:"grid grid-cols-3 gap-5 mt-5"};function dv(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",iv,[(r(),h(P,null,ae(2,n=>o("div",{key:n,class:"flex items-center justify-between mb-3"},[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",rv,[(r(),h(P,null,ae(3,n=>o("div",{key:n},[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const uv=nt(ov,[["render",dv]]),cv={class:"fct-all-orders-page fct-layout-width"},Av={class:"fct-delete-test-orders-content"},pv={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},fv={class:"fct-delete-test-orders-meta"},mv={class:"fct-delete-test-orders-text"},hv={key:0,class:"fct-delete-test-orders-loading"},_v={class:"fct-test-orders-loading-content"},vv={class:"fct-loading-bars"},gv=["id"],yv={class:"fct-delete-test-orders-percentage"},bv={class:"fct-delete-test-orders-stats"},wv={class:"fct-delete-test-orders-stat-row"},Cv={class:"fct-delete-test-orders-stat-label"},kv={class:"fct-delete-test-orders-stat-value"},Bv={class:"fct-delete-test-orders-stat-row"},xv={class:"fct-delete-test-orders-stat-label"},Sv={class:"fct-delete-test-orders-stat-value is-success"},$v={class:"fct-delete-test-orders-stat-row"},Fv={class:"fct-delete-test-orders-stat-label"},Ev={class:"fct-delete-test-orders-stat-value is-danger"},Uv={key:1,class:"fct-delete-test-orders-message"},Iv={key:0,class:"dialog-footer"},Vv={class:"fct-all-orders-wrap"},Dv={__name:"AllOrders",setup(e){const t=FA({instance:aa()}),a=M(!1),l=M(!1),n=M(!1),i=M(!1),A=M({total:0,processed:0,deleted:0,failed:0}),p=M(""),m=M(!1),_=M([]),g=(T=!0)=>{const I=t.buildQueryParams();return T||(delete I.active_view,delete I.filter_type,delete I.search,delete I.advanced_filters),I},y=AA({entity:"orders",buildParams:()=>g(),buildAllParams:()=>g(!1),filenamePrefix:"orders-export"}),v=({scope:T,columns:I,modules:L,format:O})=>{let Q=[];T==="current_page"?Q=t.getTableData().map(H=>H.id).filter(Boolean):T==="selected"&&(Q=_.value.map(H=>H.id).filter(Boolean)),y.startExport({scope:T,ids:Q,columns:I,modules:L,format:O})},k=T=>{_.value=T},b=G(()=>A.value.total?Math.min(100,Math.round(A.value.processed/A.value.total*100)):0),w=G(()=>{if(!A.value.total)return"";const T=Math.min(A.value.processed,A.value.total);return n.value?d("Deleting %1$s of %2$s Test Orders",T,A.value.total):d("Deleted %1$s of %2$s Test Orders",T,A.value.total)}),B=G(()=>A.value.total?n.value?d("Deleting... %1$s",`${b.value}%`):d("Completed"):""),S=()=>{l.value=window.innerWidth<768},V=()=>{A.value={total:0,processed:0,deleted:0,failed:0},p.value=""},F=T=>{T==="show_order_stats"&&(Qt.set("show_order_stats",!a.value),a.value=!a.value),T==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),T==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),T==="delete_test_orders"&&$()},$=async()=>{var T,I;if(!n.value){try{await Ul.confirm(d("Are you sure you want to delete all test orders? This action cannot be undone."),d("Confirm Delete!"),{confirmButtonText:d("Delete"),cancelButtonText:d("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"})}catch{return}n.value=!0,i.value=!0,V();try{let L=0,O=0,Q=0;for(;;){const K=await ce.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:L}),W=K||{};if(O=O||Number(W.total_count||0),Q+=Number(W.batch_count||0),A.value={total:O,processed:Q,deleted:A.value.deleted+Number(W.deleted_count||0),failed:A.value.failed+Number(W.failed_count||0)},p.value=W.has_more?d("Processed %1$s of %2$s test orders...",Math.min(Q,O),O):(K==null?void 0:K.message)||"",!W.has_more)break;L=Number(W.last_attempted_order_id||0),await new Promise(z=>setTimeout(z,100))}if(!A.value.total){i.value=!1,j.info(d("No test orders found to delete"));return}const H=A.value.failed?d("Deleted %1$s test orders. %2$s test orders could not be deleted.",A.value.deleted,A.value.failed):d("Deleted %s test orders successfully",A.value.deleted);p.value=H,j.success(H),t.fetch()}catch(L){p.value=((T=L==null?void 0:L.data)==null?void 0:T.message)||d("Failed to delete test orders"),j.error(((I=L==null?void 0:L.data)==null?void 0:I.message)||d("Failed to delete test orders"))}finally{n.value=!1}}},U=()=>{i.value=!1},D=()=>{const T=Qt.get("show_order_stats");T&&(a.value=T)};return Te(()=>{D(),S(),window.addEventListener("resize",S)}),xt(()=>{window.removeEventListener("resize",S)}),(T,I)=>{const L=C("el-icon"),O=C("el-button"),Q=C("el-dropdown-item"),H=C("el-dropdown-menu"),K=C("el-dropdown"),W=C("el-tag"),z=C("el-progress"),Y=C("el-dialog");return r(),h("div",cv,[s(Xa,{title:c(d)("Orders")},{action:u(()=>[s(Lt,{permission:["reports/view","orders/manage","orders/export","orders/delete"]},{default:u(()=>[s(K,{trigger:"click","popper-class":"fct-dropdown",onCommand:F,placement:"bottom-end"},{dropdown:u(()=>[s(H,null,{default:u(()=>[s(Lt,{permission:"reports/view"},{default:u(()=>[s(Q,{command:"show_order_stats"},{default:u(()=>[a.value?(r(),h(P,{key:1},[s(X,{name:"EyeOff"}),R(" "+f(c(d)("Hide Order Stats")),1)],64)):(r(),h(P,{key:0},[s(X,{name:"Eye"}),R(" "+f(c(d)("Show Order Stats")),1)],64))]),_:1}),c(t).data.showDeleteBulkAction?x("",!0):(r(),E(Q,{key:0,command:"show_delete_bulk_action"},{default:u(()=>[s(X,{name:"Eye"}),R(" "+f(c(d)("Show Bulk Actions")),1)]),_:1})),c(t).data.showDeleteBulkAction?(r(),E(Q,{key:1,command:"hide_delete_bulk_action"},{default:u(()=>[s(X,{name:"EyeOff"}),R(" "+f(c(d)("Hide Bulk Actions")),1)]),_:1})):x("",!0)]),_:1}),s(Lt,{permission:"orders/delete"},{default:u(()=>[s(Q,{command:"delete_test_orders",disabled:n.value,class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(n.value?c(d)("Deleting Test Orders..."):c(d)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1}),s(Lt,{permission:"orders/export"},{default:u(()=>[s(Q,{onClick:I[0]||(I[0]=Z=>m.value=!0)},{default:u(()=>[s(X,{name:"Download"}),R(" "+f(c(d)("Export Orders")),1)]),_:1})]),_:1})]),_:1})]),default:u(()=>[s(O,null,{default:u(()=>[R(f(c(d)("More actions"))+" ",1),s(L,null,{default:u(()=>[s(c(Ls))]),_:1})]),_:1})]),_:1})]),_:1}),s(Lt,{permission:"orders/create"},{default:u(()=>[s(O,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:u(()=>[R(f(c(d)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),s(Y,{modelValue:i.value,"onUpdate:modelValue":I[1]||(I[1]=Z=>i.value=Z),title:c(d)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:U,class:"fct-delete-test-orders-modal"},{footer:u(()=>[n.value?x("",!0):(r(),h("div",Iv,[s(O,{type:"primary",onClick:U},{default:u(()=>[R(f(c(d)("Done")),1)]),_:1})]))]),default:u(()=>[o("div",Av,[o("div",pv,f(w.value),1),o("div",fv,[o("div",mv,f(n.value?c(d)("You can close this — deletion will continue in the background"):c(d)("Test order deletion completed.")),1),B.value?(r(),E(W,{key:0,type:"success",class:ue(["fct-delete-test-orders-status",{"is-complete":!n.value}])},{default:u(()=>[R(f(B.value),1)]),_:1},8,["class"])):x("",!0)]),n.value?(r(),h("div",hv,[o("div",_v,[o("div",vv,[(r(),h(P,null,ae(8,Z=>o("div",{key:Z,class:"bar-block",id:`bar-block-${Z+1}`},null,8,gv)),64))]),R(" "+f(c(d)("Deleting...")),1)]),o("span",yv,f(b.value)+"% ",1)])):x("",!0),s(ma,{visible:n.value,fade:"",duration:300},{default:u(()=>[s(z,{percentage:b.value,"stroke-width":6,striped:"","striped-flow":"","show-text":!1,status:n.value?void 0:"success",class:"fct-delete-test-orders-progress"},null,8,["percentage","status"])]),_:1},8,["visible"]),o("div",bv,[o("div",wv,[I[3]||(I[3]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M13.66 1.1333C13.3741 1.09487 13.0575 1.0716 12.7083 1.05762V1.66146V1.70461C12.7083 2.25782 12.7084 2.73471 12.6567 3.11653C12.6017 3.52616 12.4775 3.91865 12.1592 4.23714C11.8409 4.55563 11.4483 4.68009 11.0383 4.73518C10.6566 4.78653 10.18 4.78649 9.62663 4.78646H9.58329H8.74996H8.70662C8.15333 4.78649 7.67666 4.78653 7.29499 4.73518C6.88499 4.68009 6.49249 4.55563 6.17416 4.23714C5.85583 3.91865 5.73166 3.52616 5.67666 3.11653C5.62333 2.72482 5.625 2.23304 5.625 1.66146V1.05762C5.27583 1.0716 4.95917 1.09487 4.67333 1.1333C3.92333 1.23414 3.2925 1.45038 2.79083 1.95198C2.28917 2.45358 2.07249 3.08503 1.97166 3.83513C1.87499 4.55588 1.875 5.47186 1.875 6.60774V13.3818C1.875 14.5178 1.87499 15.4337 1.97166 16.1544C2.07249 16.9046 2.28917 17.536 2.79083 18.0376C3.2925 18.5392 3.92333 18.7554 4.67333 18.8563C5.39417 18.9532 6.31 18.9532 7.44667 18.9531H10.8866C11.0791 18.9532 11.2641 18.9519 11.4433 18.9515C11.2358 18.5378 11.0666 18.3449 10.9875 18.2671C10.18 18.0578 9.58329 17.3269 9.58329 16.4539C9.58329 15.4184 10.4225 14.5789 11.4583 14.5789C11.6941 14.5789 11.9733 14.6359 12.1158 14.6766C12.31 14.7322 12.52 14.8165 12.7383 14.9346C13.1533 14.298 13.6958 13.5629 14.3133 12.9367C14.8741 12.3678 15.5933 11.7846 16.4583 11.432V6.60774C16.4583 5.47186 16.4583 4.55588 16.3616 3.83513C16.2608 3.08503 16.0441 2.45358 15.5425 1.95198C15.0408 1.45038 14.41 1.23414 13.66 1.1333Z",fill:"#017EF3"}),o("path",{d:"M17.012 12.3361C17.4462 12.1825 17.922 12.4094 18.0753 12.8431C18.2295 13.2768 18.002 13.753 17.5687 13.9068C17.1453 14.0568 16.6945 14.3786 16.2395 14.8393C15.7912 15.2944 15.3778 15.845 15.022 16.3897C14.6687 16.9317 14.3828 17.4519 14.1853 17.8374C14.087 18.0296 13.9387 18.3456 13.8879 18.4534C13.7587 18.7501 13.4695 18.9462 13.1453 18.9548C12.822 18.9633 12.5228 18.7836 12.3778 18.4942C12.0112 17.7597 11.6821 17.4672 11.5154 17.3564C11.4421 17.3074 11.3937 17.2895 11.3762 17.284C10.9537 17.2435 10.6237 16.8878 10.6237 16.4548C10.6237 15.9945 10.997 15.6214 11.457 15.6214C11.5645 15.6214 11.7428 15.6547 11.8287 15.6792C12.002 15.7287 12.2112 15.8173 12.4403 15.9698C12.6295 16.0958 12.8245 16.2633 13.0228 16.48C13.1945 16.1726 13.3971 15.8302 13.6271 15.4782C14.0187 14.8772 14.5003 14.2296 15.0528 13.6691C15.6003 13.1143 16.2595 12.6028 17.012 12.3361ZM9.16532 11.8714C9.51032 11.8714 9.79032 12.1513 9.79032 12.4964C9.79032 12.8416 9.51032 13.1214 9.16532 13.1214H5.83203C5.48703 13.1214 5.20703 12.8416 5.20703 12.4964C5.20703 12.1513 5.48703 11.8714 5.83203 11.8714H9.16532ZM12.4987 8.53809C12.8437 8.53809 13.1237 8.81793 13.1237 9.16309C13.1237 9.50826 12.8437 9.78809 12.4987 9.78809H5.83203C5.48703 9.78809 5.20703 9.50826 5.20703 9.16309C5.20703 8.81793 5.48703 8.53809 5.83203 8.53809H12.4987ZM11.457 1.0389V1.66309C11.457 2.26994 11.4562 2.66228 11.417 2.95134C11.3803 3.22242 11.3212 3.3074 11.2737 3.35498C11.2262 3.40256 11.1412 3.46176 10.8704 3.49821C10.5812 3.53706 10.1887 3.53809 9.58199 3.53809H8.74866C8.14203 3.53809 7.74952 3.53706 7.46036 3.49821C7.18952 3.46176 7.10453 3.40256 7.05703 3.35498C7.00953 3.3074 6.95036 3.22242 6.9137 2.95134C6.87453 2.66228 6.8737 2.26994 6.8737 1.66309V1.0389C7.05786 1.03839 7.24786 1.03808 7.44536 1.03809H10.8853C11.0828 1.03808 11.2728 1.03839 11.457 1.0389Z",fill:"#017EF3"})])],-1)),o("span",Cv,f(c(d)("Processed")),1),o("span",kv,f(A.value.processed)+" / "+f(A.value.total),1)]),o("div",Bv,[I[4]||(I[4]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M16.9433 13.0463C16.88 14.0913 16.8292 14.9197 16.725 15.5813C16.6183 16.2605 16.4475 16.8263 16.1067 17.3205C15.7942 17.773 15.3917 18.1547 14.9258 18.4413C14.4158 18.7555 13.8467 18.8922 13.1692 18.958H8.06417C7.38667 18.8922 6.81667 18.7547 6.30667 18.4405C5.84 18.153 5.4375 17.7705 5.125 17.3172C4.78417 16.8222 4.61417 16.2563 4.50833 15.5763C4.405 14.913 4.355 14.083 4.2925 13.0372L3.75 3.95801H17.5L16.9433 13.0463Z",fill:"#189877"}),o("path",{d:"M11.7488 1.06879C12.2196 1.11046 12.6621 1.25462 13.043 1.53796C13.3238 1.74712 13.5188 2.00379 13.6855 2.28212C13.8405 2.53962 13.9963 2.86046 14.173 3.22462L14.528 3.95879H18.1263C18.5863 3.95879 18.9596 4.33129 18.9596 4.79212C18.9596 5.25212 18.5863 5.62546 18.1263 5.62546H3.1263C2.6663 5.62546 2.29297 5.25212 2.29297 4.79212C2.29297 4.33129 2.6663 3.95879 3.1263 3.95879H6.8013L7.09797 3.30796C7.26964 2.93046 7.4213 2.59796 7.5738 2.33129C7.73797 2.04296 7.93214 1.77629 8.21714 1.55796C8.6013 1.26296 9.05297 1.11379 9.53464 1.06962C9.86213 1.03962 10.193 1.04046 10.5221 1.04129C10.5571 1.04129 10.5913 1.04212 10.6263 1.04212C10.6605 1.04212 10.6955 1.04212 10.7288 1.04212C11.1138 1.04212 11.4605 1.04296 11.7488 1.06879ZM8.63297 3.95879H12.6763C12.4871 3.56879 12.3663 3.32212 12.2571 3.13962C12.0963 2.87296 11.9046 2.75546 11.6005 2.72879C11.3846 2.70962 11.103 2.70879 10.6555 2.70879C10.1963 2.70879 9.90714 2.70962 9.68547 2.72962C9.3738 2.75796 9.17964 2.87962 9.0213 3.15712C8.91714 3.33879 8.80464 3.58212 8.63297 3.95879Z",fill:"#189877"})])],-1)),o("span",xv,f(c(d)("Deleted")),1),o("span",Sv,f(A.value.deleted),1)]),o("div",$v,[I[5]||(I[5]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M10.0013 1.04004C14.9488 1.04004 18.9596 5.05082 18.9596 9.99833C18.9596 14.9459 14.9488 18.9567 10.0013 18.9567C5.0538 18.9567 1.04297 14.9459 1.04297 9.99833C1.04297 9.54867 1.40778 9.18392 1.85677 9.18375C2.30677 9.18375 2.6722 9.54858 2.6722 9.99833C2.6722 14.0463 5.95297 17.3282 10.0013 17.3282C14.0496 17.3282 17.3304 14.0463 17.3304 9.99833C17.3304 5.95037 14.0496 2.66846 10.0013 2.66846C9.55138 2.66846 9.18764 2.30434 9.18747 1.85466C9.18747 1.40488 9.5513 1.04004 10.0013 1.04004ZM2.80566 4.66634C3.08066 4.35891 3.55043 4.30436 3.89209 4.55241C4.25514 4.81714 4.33519 5.32656 4.07031 5.69011L3.90674 5.92448C3.53507 6.47876 3.23784 7.08712 3.02784 7.73356C2.88857 8.16094 2.42904 8.39483 2.00163 8.25602C1.57424 8.11701 1.33924 7.65747 1.47835 7.22982C1.77169 6.32508 2.20608 5.48362 2.75358 4.73145L2.80566 4.66634ZM7.3125 1.45345C7.71574 1.36659 8.12817 1.59791 8.25814 1.9987C8.39722 2.42644 8.16233 2.88598 7.73486 3.02491L7.46061 3.12011C6.82564 3.35476 6.23137 3.67519 5.69222 4.06738L5.62224 4.11214C5.26557 4.32003 4.80286 4.22905 4.55453 3.88835C4.29044 3.52472 4.37034 3.01452 4.73356 2.74984L5.02084 2.55046C5.69734 2.09692 6.44048 1.7332 7.23194 1.47624L7.3125 1.45345Z",fill:"#F04438"}),o("path",{d:"M11.9754 6.85201C12.3029 6.58506 12.7854 6.6039 13.0904 6.90897C13.3954 7.21407 13.4145 7.69657 13.147 8.02388L13.0904 8.08736L11.1787 9.99808L13.0895 11.9089L13.147 11.9724C13.4137 12.2997 13.3945 12.7823 13.0895 13.0873C12.7845 13.3923 12.302 13.4113 11.9745 13.1442L11.9112 13.0873L10.0012 11.1765L8.09122 13.0873C7.76538 13.4127 7.23789 13.4127 6.91289 13.0873C6.58706 12.7619 6.58706 12.2344 6.91289 11.9089L8.82288 9.99808L6.91206 8.08736L6.85456 8.02388C6.58789 7.69657 6.60706 7.21407 6.91206 6.90897C7.21706 6.6039 7.69955 6.58506 8.02705 6.85201L8.09039 6.90897L10.0012 8.81975L11.912 6.90897L11.9754 6.85201Z",fill:"#F04438"})])],-1)),o("span",Fv,f(c(d)("Failed")),1),o("span",Ev,f(A.value.failed),1)])]),p.value&&!n.value?(r(),h("p",Uv,f(p.value),1)):x("",!0)])]),_:1},8,["modelValue","title"]),s(Lt,{permission:"reports/view"},{default:u(()=>[a.value?(r(),E(W_,{key:0})):x("",!0)]),_:1}),s(Lt,{permission:"orders/view"},{default:u(()=>[o("div",Vv,[s(us,{table:c(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(uv,{key:0})):x("",!0),c(t).isLoading()?x("",!0):(r(),E(_d,{key:1,table:c(t),orders:c(t).getTableData(),columns:c(t).data.columns,"empty-text":c(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),default:u(()=>[c(t).isLoading()?(r(),E(nv,{key:0,orderTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),E(hd,{key:1,table:c(t),orders:c(t).getTableData(),columns:c(t).data.columns,"empty-text":c(t).emptyMessage,onSelectionChange:k},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1}),s(pA,{modelValue:m.value,"onUpdate:modelValue":I[2]||(I[2]=Z=>m.value=Z),title:c(d)("Export Orders"),"selected-count":_.value.length,"current-page-count":c(t).getTableData().length,"total-count":c(t).data.paginate.total,"item-label-singular":c(d)("order"),"item-label-plural":c(d)("orders"),"has-active-filter":!!c(t).isFiltering(),"export-state":c(y),onExport:v},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}},Tv={class:"setting-wrap"},Qv={class:"setting-wrap-inner"},Mv={class:"setting-confirmation-content"},Lv={class:"custom-wp-editor-wrapper"},Rv={class:"setting-save-action"},Ov={__name:"InvoicePacking",setup(e){const t=M([]),a=M([]),l=M(!1),n=M(!1);Ss().onSave(()=>{_()});const A=M([d("Invoice Template"),d("Packing Slip Template"),d("Delivery Slip Template"),d("Shipping Slip Template"),d("Dispatch Slip Template")]),p=()=>{l.value=!0,ce.get("templates/print-templates").then(g=>{t.value=g.templates,l.value=!1}).catch(g=>{j.error(g)}).finally(()=>{l.value=!1})},m=()=>{l.value=!0,ce.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{j.error(g)}).finally(()=>{l.value=!1})},_=()=>{n.value=!0,ce.put("templates/print-templates",{templates:t.value}).then(g=>{j.success(g.message)}).catch(g=>{j.error(g)}).finally(()=>{n.value=!1})};return Te(()=>{p(),m()}),(g,y)=>{const v=C("el-skeleton");return C("el-button"),r(),h("div",Tv,[s($a,{heading:c(d)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",Qv,[s(Fa),s(ol,{class:"mb-5",type:"information",content:c(d)("It will be available soon!")},null,8,["content"]),l.value?(r(!0),h(P,{key:0},ae(A.value,(k,b)=>(r(),E(xe,{key:b},{default:u(()=>[s(Ve,{title:k,border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):x("",!0),!l.value&&t.value.length>0?(r(),h(P,{key:1},[(r(!0),h(P,null,ae(t.value,(k,b)=>(r(),E(xe,{key:b},{default:u(()=>[s(Ve,{title:k.title+" (Under Development)",border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[o("div",Mv,[o("div",Lv,[s(os,{"short-codes":a.value,modelValue:k.content,"onUpdate:modelValue":w=>k.content=w,onUpdate:w=>{k.content=w}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",Rv,[x("",!0)])],64)):x("",!0)])])}}},Pv={key:0,class:"bg-white p-10 rounded m-10 dark:bg-dark-600"},Hv={__name:"PdfTemplateRoute",setup(e){const t=Ke.get("app_config.isProActive");return(a,l)=>{const n=C("router-view");return c(t)?(r(),E(n,{key:1})):(r(),h("div",Pv,[s(cs,{placement:"feature_lock_pdf_templates",title:c(d)("PDF Templates"),text:c(d)("Customizable PDF receipts, invoices, and e-invoices with ZUGFeRD support.")},null,8,["title","text"])]))}}},Nv={class:"setting-wrap"},Kv={class:"setting-wrap-inner"},Gv={class:"flex gap-5"},zv={class:"flex flex-col items-center justify-center py-12 text-center"},jv={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},qv={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},Yv={class:"fct-pdf-template-desc"},Wv={class:"fct-pdf-template-grid"},Jv={class:"fct-pdf-template-preview"},Xv={class:"fct-pdf-template-preview-placeholder"},Zv={class:"fct-pdf-placeholder-text"},eg={class:"fct-pdf-template-overlay"},tg={class:"fct-pdf-template-footer"},ag={class:"fct-pdf-template-name-row"},lg={class:"fct-pdf-template-title"},sg={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},ng={__name:"PdfTemplateIndex",setup(e){const t=Oa(),a=M(!0),l=M(!1),n=M({}),i=M(!1),A=M(""),p=M(!1),m=M(""),_=M(null),g=M(!1),y=M(!1),v=Ke.get("app_config.isProActive"),k=()=>{a.value=!0,ce.get("settings/pdf-templates/receipt").then(F=>{n.value=F.templates||{},l.value=F.has_fluent_pdf||!1,_.value=F.addon_info||null}).catch(F=>{var $;j.error((($=F.data)==null?void 0:$.message)||d("Failed to load templates"))}).finally(()=>{a.value=!1})},b=()=>{if(_.value){if(!v&&_.value.repo_link){window.open(_.value.repo_link,"_blank","noopener,noreferrer");return}g.value=!0,ce.post("settings/modules/plugin-addons/install",{plugin_slug:_.value.plugin_slug,source_type:_.value.source_type||"wordpress",source_link:_.value.source_link||"",asset_path:_.value.asset_path||""}).then(F=>{j.success(F.message||d("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var $;j.error((($=F.data)==null?void 0:$.message)||d("Failed to install plugin"))}).finally(()=>{g.value=!1})}},w=()=>{_.value&&(y.value=!0,ce.post("settings/modules/plugin-addons/activate",{plugin_file:_.value.plugin_file}).then(F=>{j.success(F.message||d("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var $;j.error((($=F.data)==null?void 0:$.message)||d("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},B=()=>{A.value="",i.value=!0},S=()=>{if(!A.value.trim()){j.error(d("Please enter a template name"));return}p.value=!0,ce.post("settings/pdf-templates/create",{title:A.value.trim()}).then(F=>{i.value=!1,j.success(F.message||d("Template created")),F.slug?t.push({name:"edit-pdf-template",params:{template:F.slug}}):k()}).catch(F=>{var $;j.error((($=F.data)==null?void 0:$.message)||d("Failed to create template"))}).finally(()=>{p.value=!1})},V=F=>{m.value=F,ce.delete("settings/pdf-templates/delete/"+F).then($=>{j.success($.message||d("Template deleted")),k()}).catch($=>{var U;j.error(((U=$.data)==null?void 0:U.message)||d("Failed to delete template"))}).finally(()=>{m.value=""})};return Te(()=>{k()}),(F,$)=>{const U=C("el-button"),D=C("el-skeleton-item"),T=C("el-skeleton"),I=C("el-popconfirm"),L=C("el-input"),O=C("el-form-item"),Q=C("el-form"),H=C("el-dialog");return r(),h("div",Nv,[s($a,{heading:c(d)("PDF Templates"),"show-save-button":!1},sa({_:2},[l.value?{name:"action",fn:u(()=>[s(U,{type:"primary",size:"small",onClick:B},{default:u(()=>[R(f(c(d)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",Kv,[s(Fa),a.value?(r(),E(xe,{key:0},{default:u(()=>[s(Be,null,{default:u(()=>[s(T,{animated:""},{template:u(()=>[s(D,{variant:"text",class:"w-[300px] mb-4"}),o("div",Gv,[s(D,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),s(D,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):x("",!0),!a.value&&!l.value&&_.value?(r(),E(xe,{key:1},{default:u(()=>[s(Be,null,{default:u(()=>[o("div",zv,[$[3]||($[3]=o("svg",{class:"mb-4",width:"48",height:"48",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[o("path",{d:"M8 2C6.9 2 6 2.9 6 4v24c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10l-8-8H8z"}),o("path",{d:"M18 2v8h8"}),o("path",{d:"M12 18h8M12 22h6"})],-1)),o("h3",jv,f(c(d)("Fluent PDF Required")),1),o("p",qv,f(c(d)("To use PDF receipt templates, you need to install and activate the Fluent PDF plugin.")),1),_.value.is_installed?_.value.is_installed&&!_.value.is_active?(r(),E(U,{key:1,type:"success",loading:y.value,onClick:w},{default:u(()=>[R(f(c(d)("Activate Plugin")),1)]),_:1},8,["loading"])):x("",!0):(r(),E(U,{key:0,type:"primary",loading:g.value,onClick:b},{default:u(()=>[R(f(c(v)?c(d)("Install & Activate"):c(d)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):x("",!0),!a.value&&l.value?(r(),E(xe,{key:2},{default:u(()=>[s(Be,null,{default:u(()=>[o("p",Yv,f(c(d)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",Wv,[(r(!0),h(P,null,ae(n.value,(K,W)=>(r(),h("div",{key:W,class:"fct-pdf-template-card"},[o("div",Jv,[o("div",Xv,[$[4]||($[4]=o("svg",{width:"40",height:"40",viewBox:"0 0 32 32",fill:"none",stroke:"#525866","stroke-width":"1.2"},[o("path",{d:"M8 2C6.9 2 6 2.9 6 4v24c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10l-8-8H8z"}),o("path",{d:"M18 2v8h8"}),o("path",{d:"M12 18h8M12 22h6"})],-1)),o("span",Zv,f(K.title||c(d)("Receipt Template")),1)]),o("div",eg,[s(U,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:W}}},{default:u(()=>[R(f(c(d)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",tg,[o("div",ag,[o("span",lg,f(K.title||W),1),K.is_default?(r(),h("span",sg,f(c(d)("Built-in")),1)):x("",!0)]),K.is_default?x("",!0):(r(),E(I,{key:0,title:c(d)("Delete this template?"),"confirm-button-text":c(d)("Delete"),"cancel-button-text":c(d)("Cancel"),"confirm-button-type":"danger",onConfirm:z=>V(W)},{reference:u(()=>[s(U,{type:"danger",size:"small",text:"",loading:m.value===W,class:"fct-pdf-delete-btn"},{default:u(()=>$[5]||($[5]=[o("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M3 6h18"}),o("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1)])),_:2,__:[5]},1032,["loading"])]),_:2},1032,["title","confirm-button-text","cancel-button-text","onConfirm"]))])]))),128))])]),_:1})]),_:1})):x("",!0)]),s(H,{modelValue:i.value,"onUpdate:modelValue":$[2]||($[2]=K=>i.value=K),title:c(d)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:u(()=>[s(U,{onClick:$[1]||($[1]=K=>i.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(U,{type:"primary",onClick:S,loading:p.value},{default:u(()=>[R(f(c(d)("Create")),1)]),_:1},8,["loading"])]),default:u(()=>[s(Q,{onSubmit:Ge(S,["prevent"]),"label-position":"top"},{default:u(()=>[s(O,{label:c(d)("Template Name")},{default:u(()=>[s(L,{modelValue:A.value,"onUpdate:modelValue":$[0]||($[0]=K=>A.value=K),placeholder:c(d)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},og={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},ig={class:"fct-email-body-skeleton"},rg={class:"fct-email-body-skeleton__page"},dg={key:0,class:"fct-ebs__badge"},ug={class:"fct-ebs__badge-text"};function cg(e,t,a,l,n,i){return r(),h("div",ig,[o("div",rg,[t[3]||(t[3]=Ln('<div class="fct-ebs__skel fct-ebs__header"></div><div style="height:8px;"></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="width:45%;height:12px;"></div><div style="flex:1;"></div><div class="fct-ebs__skel" style="width:30%;height:12px;"></div></div><div class="fct-ebs__divider"></div><div class="fct-ebs__grid"><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div></div><div class="fct-ebs__row" style="margin-top:2px;"><div class="fct-ebs__skel" style="width:30%;height:12px;"></div><div class="fct-ebs__skel" style="width:20%;height:12px;"></div><div class="fct-ebs__skel" style="width:30%;height:12px;"></div><div class="fct-ebs__skel" style="width:20%;height:12px;"></div></div><div class="fct-ebs__divider"></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="flex:1;height:12px;"></div></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="width:45%;height:12px;"></div></div>',9)),a.showLoadingBadge?(r(),h("div",dg,[t[0]||(t[0]=o("span",{class:"fct-ebs__dot"},null,-1)),t[1]||(t[1]=o("span",{class:"fct-ebs__dot"},null,-1)),t[2]||(t[2]=o("span",{class:"fct-ebs__dot"},null,-1)),o("span",ug,f(e.$t("Loading block editor…")),1)])):x("",!0)])])}const Cr=nt(og,[["render",cg]]),Ag={name:"NewEditorFrame",components:{EmailBodySkeleton:Cr},props:{editorPath:{type:String,default:"/editor"},modelValue:{type:String,default:""},editorParams:{type:Object,default:()=>({})},frameHeight:{type:String,default:"500px"},documentTitle:{type:String,default:""}},emits:["update:modelValue","titleUpdated","contentUpdated","editorFullscreenToggle","featuredMediaUpdated","previewRequest","autosaveState"],data(){return{editorData:{content:""},editorFrame:null,editorOrigin:null,dataSent:!1,isFailing:!1,iframeReady:!1,pendingDataSend:!1,sendRetries:0,editorReadyReceived:!1,editorContentReady:!1,isFullscreen:!1,_timers:[]}},computed:{editorFailed(){return!this.dataSent&&this.isFailing&&!this.editorReadyReceived}},mounted(){this._setTimeout(()=>{this.editorReadyReceived||(this.isFailing=!0)},3e4),this.editorData.content=this.modelValue,this.editorData.title=this.documentTitle,this.createEditorIframe(),window.addEventListener("message",this.handleEditorMessage)},beforeUnmount(){this._timers.forEach(e=>clearTimeout(e)),this._timers=[],window.removeEventListener("message",this.handleEditorMessage),this.isFullscreen&&this.toggleFullScreen(!1),this.editorFrame&&(this.editorFrame.onload=null,this.$refs.iframeContainer.removeChild(this.editorFrame),this.editorFrame=null)},methods:{_setTimeout(e,t){const a=setTimeout(e,t);return this._timers.push(a),a},createEditorIframe(){this.editorFrame=document.createElement("iframe");let e=this.appVars.fct_editor_frame;if(this.editorParams){const t=new URLSearchParams(this.editorParams);e+="&"+t.toString()}try{this.editorOrigin=new URL(e,window.location.origin).origin}catch{this.editorOrigin=window.location.origin}this.editorFrame.src=e,this.editorFrame.style.width="100%",this.editorFrame.style.height=this.frameHeight,this.editorFrame.onload=()=>{this.iframeReady=!0,this.pendingDataSend&&(this.pendingDataSend=!1,this._setTimeout(()=>{this.sendDataToEditor()},1e3)),this._setTimeout(()=>{!this.editorReadyReceived&&this.iframeReady&&this.sendDataToEditor()},1e4)},this.$refs.iframeContainer.appendChild(this.editorFrame)},sendDataToEditor(){if(!this.iframeReady||!this.editorFrame||!this.editorFrame.contentWindow){this.pendingDataSend=!0;return}try{const e=JSON.parse(JSON.stringify(this.editorData));this.editorFrame.contentWindow.postMessage({action:"UPDATE_EDITOR",data:e},this.editorOrigin),this.dataSent=!0,this.sendRetries=0,this._setTimeout(()=>{this.editorContentReady||(this.editorContentReady=!0)},5e3)}catch{this.sendRetries++,this.sendRetries<=3&&this._setTimeout(()=>{this.sendDataToEditor()},500)}},handleEditorMessage(e){if(e&&e.origin&&this.editorOrigin&&e.origin!==this.editorOrigin)return;const{action:t,content:a}=e.data;t==="EDITOR_UPDATED"?this.dataSent&&(this.editorContentReady||this._setTimeout(()=>{this.editorContentReady=!0},1500),this.editorData.content=a,this.$emit("update:modelValue",a),this.$emit("contentUpdated",a)):t==="TITLE_UPDATED"?(this.editorData.title=a,this.$emit("titleUpdated",a)):t==="FEATURED_MEDIA_UPDATED"?this.$emit("featuredMediaUpdated",a):t==="EDITOR_FULLSCREEN_TOGGLE"?this.toggleFullScreen(a):t==="EMAIL_PREVIEW_REQUEST"?this.$emit("previewRequest"):t==="AUTOSAVE_STATE"?this.$emit("autosaveState",a):t==="EDITOR_READY"&&(this.editorReadyReceived=!0,this.isFailing=!1,this.sendDataToEditor())},forceAutosave(){this.editorFrame&&this.editorFrame.contentWindow&&this.editorFrame.contentWindow.postMessage({action:"FORCE_SAVE"},this.editorOrigin)},toggleFullScreen(e){this.isFullscreen=e;const t=this.editorFrame;if(e){if(document.documentElement.classList.add("fct-editor-fullscreen"),document.body.style.overflow="hidden",t){t.classList.add("fct-fullscreen-iframe"),this._fullscreenAncestors=[];let a=t.parentElement;for(;a&&a!==document.documentElement;)a.classList.add("fct-fullscreen-ancestor"),this._fullscreenAncestors.push(a),a=a.parentElement}}else document.documentElement.classList.remove("fct-editor-fullscreen"),document.body.style.overflow="",t&&t.classList.remove("fct-fullscreen-iframe"),this._fullscreenAncestors&&(this._fullscreenAncestors.forEach(function(a){a.classList.remove("fct-fullscreen-ancestor")}),this._fullscreenAncestors=null);this.$emit("editorFullscreenToggle",e)}}},pg={style:{width:"100%"}},fg={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},mg={class:"editor-container",style:{position:"relative"}},hg={key:0,class:"fct-editor-skeleton"},_g={ref:"iframeContainer",class:"iframe-container"};function vg(e,t,a,l,n,i){const A=C("EmailBodySkeleton");return r(),h("div",pg,[i.editorFailed?(r(),h("div",fg,[o("p",null,f(e.$t("Problem with loading the editor. Please reload the page.")),1)])):x("",!0),o("div",mg,[s(Gl,{name:"fct-skeleton-fade"},{default:u(()=>[n.editorContentReady?x("",!0):(r(),h("div",hg,[t[0]||(t[0]=o("div",{class:"fct-skel-menubar"},[o("div",{class:"fct-skel fct-skel-logo"}),o("div",{class:"fct-skel-slash"}),o("div",{class:"fct-skel fct-skel-name"}),o("div",{class:"fct-skel-spacer"}),o("div",{class:"fct-skel fct-skel-btn-wide"}),o("div",{class:"fct-skel-dot"}),o("div",{class:"fct-skel-dot"})],-1)),t[1]||(t[1]=o("div",{class:"fct-skel-toolbar"},[o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-wide"}),o("div",{class:"fct-skel fct-skel-tb-wide"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-btn"})],-1)),s(A,{"show-loading-badge":!0})]))]),_:1}),o("div",_g,null,512)])])}const UA=nt(Ag,[["render",vg],["__scopeId","data-v-e5dae537"]]),gg={class:"setting-wrap fct-pdf-template-edit-wrapper"},yg={class:"capitalize"},bg={class:"setting-wrap-inner"},wg={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},Cg={class:"setting-save-action"},kg={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=Oa(),l=M(!0),n=M(!1),i=M(!1),A=M(!1),p=M(null),m=M(null),_=M(""),g=$=>{const U=atob($),D=new Array(U.length);for(let T=0;T<U.length;T++)D[T]=U.charCodeAt(T);return new Blob([new Uint8Array(D)],{type:"application/pdf"})},y=async()=>{const $=await ce.post("settings/pdf-templates/download",{template_id:t.template});if(!($!=null&&$.pdf_base64))throw new Error(d("Failed to generate PDF"));return $},v=()=>{l.value=!0,ce.get("settings/pdf-templates/receipt/"+t.template).then($=>{var D,T,I;p.value=$.template;const U=(I=(T=(D=$.template)==null?void 0:D.pdf_settings)==null?void 0:T[0])==null?void 0:I.pdf_structure;U&&(_.value=U.content||"")}).catch($=>{var U;j.error(((U=$.data)==null?void 0:U.message)||d("Failed to load template"))}).finally(()=>{l.value=!1})},k=async({showSuccess:$=!0}={})=>{var D,T,I,L;n.value=!0,m.value&&await m.value.forceAutosave();const U=((I=(T=(D=p.value)==null?void 0:D.pdf_settings)==null?void 0:T[0])==null?void 0:I.pdf_structure)||{};U.content=_.value;try{const O=await ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:U});return $&&j.success(O.message||d("Template saved")),!0}catch(O){return j.error(((L=O.data)==null?void 0:L.message)||d("Failed to save template")),!1}finally{n.value=!1}},b=()=>{i.value=!0,y().then($=>{const U=g($.pdf_base64),D=URL.createObjectURL(U),T=document.createElement("a");T.href=D,T.download=$.filename||"receipt-test.pdf",document.body.appendChild(T),T.click(),document.body.removeChild(T),URL.revokeObjectURL(D),j.success(d("PDF downloaded"))}).catch($=>{var U;j.error(((U=$.data)==null?void 0:U.message)||$.message||d("Failed to generate PDF"))}).finally(()=>{i.value=!1})},w=async()=>{var $;A.value=!0;try{const U=await y(),D=g(U.pdf_base64),T=URL.createObjectURL(D),I=document.createElement("a");I.href=T,I.target="_blank",I.rel="noopener",document.body.appendChild(I),I.click(),document.body.removeChild(I),setTimeout(()=>{URL.revokeObjectURL(T)},1e4)}catch(U){j.error((($=U.data)==null?void 0:$.message)||U.message||d("Failed to generate PDF"))}finally{A.value=!1}},B=async()=>{n.value||i.value||A.value||!await k({showSuccess:!1})||await w()},S=()=>p.value&&!p.value.is_default,V=()=>{ce.delete("settings/pdf-templates/delete/"+t.template).then($=>{j.success($.message||d("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch($=>{var U;j.error(((U=$.data)==null?void 0:U.message)||d("Failed to delete template"))})},F=()=>{ce.get("settings/pdf-templates/factory-default").then($=>{var T,I,L;const U=(T=$.templates)==null?void 0:T[t.template];if(!U)return;const D=((L=(I=U.pdf_settings)==null?void 0:I[0])==null?void 0:L.pdf_structure)||{};return ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:D}).then(()=>{j.success(d("Reverted to default template")),v()})}).catch($=>{var U;j.error(((U=$.data)==null?void 0:U.message)||d("Failed to revert template"))})};return Te(()=>{v()}),($,U)=>{const D=C("el-breadcrumb-item"),T=C("el-breadcrumb"),I=C("el-icon"),L=C("el-button"),O=C("el-dropdown-item"),Q=C("el-dropdown-menu"),H=C("el-dropdown"),K=C("el-skeleton-item"),W=C("el-skeleton");return r(),h("div",gg,[s($a,{loading:n.value,"loading-text":c(d)("Saving"),"save-button-text":c(d)("Save Template"),onOnSave:k},{heading:u(()=>[s(T,{class:"mb-0","separator-icon":c(Za)},{default:u(()=>[s(D,{to:{path:"/settings/pdf-template"}},{default:u(()=>[R(f(c(d)("PDF Templates")),1)]),_:1}),s(D,null,{default:u(()=>{var z;return[o("span",yg,f(((z=p.value)==null?void 0:z.title)||c(d)("Edit Template")),1)]}),_:1})]),_:1},8,["separator-icon"])]),action:u(()=>[s(H,{trigger:"click",style:{"margin-left":"12px",display:"inline-flex","align-items":"center"},"popper-class":"fct-dropdown"},{dropdown:u(()=>[s(Q,null,{default:u(()=>[s(O,{onClick:b,disabled:i.value},{default:u(()=>[R(f(i.value?c(d)("Downloading..."):c(d)("Test Download")),1)]),_:1},8,["disabled"]),s(O,{onClick:F},{default:u(()=>[R(f(c(d)("Revert to Default")),1)]),_:1}),S()?(r(),E(O,{key:0,divided:"",onClick:V,style:{color:"#F56C6C"}},{default:u(()=>[R(f(c(d)("Delete Template")),1)]),_:1})):x("",!0)]),_:1})]),default:u(()=>[s(L,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:u(()=>[s(I,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:u(()=>[s(c(wm))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",bg,[s(Fa),s(W,{loading:l.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:u(()=>[s(K,{variant:"h3",class:"w-[200px] mb-5"}),s(K,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!l.value&&p.value?(r(),h(P,{key:0},[o("div",wg,[s(UA,{ref_key:"editorFrameRef",ref:m,editorParams:{block_type:"pdf_template",campaign_title:p.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:p.value.title||c(d)("Receipt Template"),onPreviewRequest:B,modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=z=>_.value=z)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",Cg,[s(L,{onClick:k,type:"primary",disabled:n.value,loading:n.value},{default:u(()=>[R(f(c(d)("Save Template")),1)]),_:1},8,["disabled","loading"]),s(L,{onClick:b,disabled:i.value,loading:i.value},{default:u(()=>[R(f(c(d)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):x("",!0)])])}}},Bg={class:"fluent-cart-admin-validation-error-wrapper `${fieldKey}`"},gl=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:{type:String,default:""}},setup(e){return(t,a)=>(r(),h("div",Bg,[(r(!0),h(P,null,ae(e.validationErrors,(l,n)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},f(l),1))),128))]))}}),Fo={__name:"Alert",props:{type:String,title:String,description:String,closable:Boolean,showIcon:Boolean},setup(e){return(t,a)=>{const l=C("el-alert");return r(),E(l,{title:e.title,type:e.type,description:e.description,"show-icon":e.showIcon,closable:e.closable,role:"alert"},{default:u(()=>[wa(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},xg={class:"setting-wrap"},Sg={class:"setting-wrap-inner"},$g={class:"grid gap-3 mb-6"},Fg={class:"grid gap-3 mb-6"},Eg={class:"grid gap-3 mb-6"},Ug={class:"grid gap-3"},Ig={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},Vg=["href"],Dg={class:"form-note"},Tg={class:"form-note"},Qg=["href"],Mg={class:"mb-4"},Lg={class:"mb-4"},Rg={class:"form-note"},Og={class:"form-note"},Pg={class:"form-note"},Hg={class:"form-note"},Ng={class:"setting-save-action"},Kg={__name:"PdfTemplateSettings",setup(e){const t=M(!0),a=M(!1),l=M({}),n=M(!0),i=M(""),A=M({zugferd_enabled:"0",zugferd_profile:"en16931",seller_legal_registration_scheme:"",seller_contact_name:"",seller_contact_email:"",seller_contact_phone:"",seller_bank_iban:"",seller_bank_bic:"",seller_bank_account_name:"",seller_electronic_address:""}),p=[{label:"EN 16931 (ZUGFeRD)",value:"en16931"}],m=[{value:"",label:d("None")},{value:"0002",label:"0002 — SIRENE (France)"},{value:"0009",label:"0009 — SIRET (France)"},{value:"0021",label:"0021 — SWIFT"},{value:"0060",label:"0060 — DUNS"},{value:"0088",label:"0088 — EAN / GS1 GLN"},{value:"0096",label:"0096 — Danish P number"},{value:"0130",label:"0130 — EU Directorates"},{value:"0183",label:"0183 — Swiss UID"},{value:"0184",label:"0184 — Danish CVR"},{value:"0190",label:"0190 — Dutch OIN"},{value:"0191",label:"0191 — Dutch KvK"},{value:"0192",label:"0192 — Dutch Organisation ID"},{value:"0195",label:"0195 — Singapore UEN"},{value:"0196",label:"0196 — Icelandic kennitala"},{value:"0198",label:"0198 — Danish SE"},{value:"0199",label:"0199 — LEI"},{value:"0200",label:"0200 — Lithuanian legal entity"},{value:"0204",label:"0204 — German Leitweg-ID"},{value:"0208",label:"0208 — Belgian CBE / KBO"},{value:"0210",label:"0210 — Italian Codice Fiscale"},{value:"0211",label:"0211 — Italian Partita IVA"},{value:"0213",label:"0213 — Finnish OVT"}];Ss().onSave(()=>{y()});const g=()=>{t.value=!0,ce.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(A.value).forEach(k=>{v.seller_details[k]!==void 0&&(A.value[k]=v.seller_details[k])}),n.value=v.store_country_set!==!1,i.value=v.store_settings_url||""}).catch(v=>{var k;j.error(((k=v.data)==null?void 0:k.message)||d("Failed to load settings"))}).finally(()=>{t.value=!1})},y=()=>{a.value=!0,l.value={},ce.post("settings/pdf-templates/seller-details",A.value).then(v=>{j.success(v.message||d("Settings saved"))}).catch(v=>{var k,b;v.status_code===422&&((k=v.data)!=null&&k.data)&&(l.value=v.data.data),j.error(((b=v.data)==null?void 0:b.message)||d("Failed to save settings"))}).finally(()=>{a.value=!1})};return Te(()=>{g()}),(v,k)=>{const b=C("el-skeleton-item"),w=C("el-skeleton"),B=C("el-switch"),S=C("el-option"),V=C("el-select"),F=C("el-form-item"),$=C("el-col"),U=C("el-row"),D=C("el-input"),T=C("el-divider"),I=C("el-button");return r(),h("div",xg,[s($a,{heading:c(d)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",Sg,[s(Fa),t.value?(r(),E(xe,{key:0},{default:u(()=>[s(Be,null,{default:u(()=>[s(w,{animated:""},{template:u(()=>[o("div",$g,[s(b,{variant:"p",class:"w-[20%]"}),s(b,{variant:"p"})]),o("div",Fg,[s(b,{variant:"p",class:"w-[20%]"}),s(b,{variant:"p"})]),o("div",Eg,[s(b,{variant:"p",class:"w-[20%]"}),s(b,{variant:"p"})]),o("div",Ug,[s(b,{variant:"p",class:"w-[20%]"}),s(b,{variant:"p"})])]),_:1})]),_:1})]),_:1})):x("",!0),t.value?x("",!0):(r(),h(P,{key:1},[A.value.zugferd_enabled==="1"&&!n.value?(r(),h("div",Ig,[o("strong",null,f(c(d)("Store country is not configured.")),1),R(" "+f(c(d)("ZUGFeRD XML cannot be embedded in PDFs until your store country is set."))+" ",1),i.value?(r(),h("a",{key:0,href:i.value,class:"underline ml-1"},f(c(d)("Go to Store Settings")),9,Vg)):x("",!0)])):x("",!0),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("E-Invoice Configuration"),text:c(d)("Configure ZUGFeRD / Factur-X e-invoice encoding and seller details for your PDFs."),border_bottom:""},{action:u(()=>[s(B,{modelValue:A.value.zugferd_enabled,"onUpdate:modelValue":k[0]||(k[0]=L=>A.value.zugferd_enabled=L),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),s(Be,null,{default:u(()=>[s(U,{gutter:15},{default:u(()=>[s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("ZUGFeRD Profile"),"label-position":"top"},{default:u(()=>[s(V,{modelValue:A.value.zugferd_profile,"onUpdate:modelValue":k[1]||(k[1]=L=>A.value.zugferd_profile=L)},{default:u(()=>[(r(),h(P,null,ae(p,L=>s(S,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",Dg,[o("p",null,f(c(d)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Legal Registration Scheme"),"label-position":"top"},{default:u(()=>[s(V,{modelValue:A.value.seller_legal_registration_scheme,"onUpdate:modelValue":k[2]||(k[2]=L=>A.value.seller_legal_registration_scheme=L),placeholder:c(d)("Select scheme"),clearable:"",filterable:""},{default:u(()=>[(r(),h(P,null,ae(m,L=>s(S,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",Tg,[o("p",null,f(c(d)("ISO 6523 ICD code for the legal registration identifier")),1)]),s(gl,{"validation-errors":l.value.seller_legal_registration_scheme||{},"field-key":"seller_legal_registration_scheme"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),s(Fo,{type:"info",closable:!1,"show-icon":"",class:"mb-4"},{default:u(()=>[R(f(c(d)("Company Name, VAT ID, Tax ID, and Legal Registration ID are managed in"))+" ",1),i.value?(r(),h("a",{key:0,href:i.value,target:"_blank",class:""},f(c(d)("Store Settings → Business Details")),9,Qg)):x("",!0)]),_:1}),o("h4",Mg,f(c(d)("Seller Contact")),1),s(U,{gutter:15},{default:u(()=>[s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Contact Name"),"label-position":"top"},{default:u(()=>[s(D,{modelValue:A.value.seller_contact_name,"onUpdate:modelValue":k[3]||(k[3]=L=>A.value.seller_contact_name=L)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Contact Email"),"label-position":"top"},{default:u(()=>[s(D,{modelValue:A.value.seller_contact_email,"onUpdate:modelValue":k[4]||(k[4]=L=>A.value.seller_contact_email=L),type:"email"},null,8,["modelValue"]),s(gl,{"validation-errors":l.value.seller_contact_email||{},"field-key":"seller_contact_email"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),s(U,{gutter:15},{default:u(()=>[s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Contact Phone"),"label-position":"top"},{default:u(()=>[s(D,{modelValue:A.value.seller_contact_phone,"onUpdate:modelValue":k[5]||(k[5]=L=>A.value.seller_contact_phone=L)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),s(T),o("h4",Lg,f(c(d)("Seller Bank Details")),1),s(U,{gutter:15},{default:u(()=>[s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Bank IBAN"),"label-position":"top"},{default:u(()=>[s(D,{modelValue:A.value.seller_bank_iban,"onUpdate:modelValue":k[6]||(k[6]=L=>A.value.seller_bank_iban=L)},null,8,["modelValue"]),s(gl,{"validation-errors":l.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),o("div",Rg,[o("p",null,f(c(d)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Bank BIC"),"label-position":"top"},{default:u(()=>[s(D,{modelValue:A.value.seller_bank_bic,"onUpdate:modelValue":k[7]||(k[7]=L=>A.value.seller_bank_bic=L)},null,8,["modelValue"]),o("div",Og,[o("p",null,f(c(d)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),s(U,{gutter:15},{default:u(()=>[s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Bank Account Name"),"label-position":"top"},{default:u(()=>[s(D,{modelValue:A.value.seller_bank_account_name,"onUpdate:modelValue":k[8]||(k[8]=L=>A.value.seller_bank_account_name=L)},null,8,["modelValue"]),o("div",Pg,[o("p",null,f(c(d)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),s($,{lg:12},{default:u(()=>[s(F,{label:c(d)("Electronic Address"),"label-position":"top"},{default:u(()=>[s(D,{modelValue:A.value.seller_electronic_address,"onUpdate:modelValue":k[9]||(k[9]=L=>A.value.seller_electronic_address=L)},null,8,["modelValue"]),o("div",Hg,[o("p",null,f(c(d)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),o("div",Ng,[s(I,{type:"primary",onClick:k[10]||(k[10]=L=>y()),loading:a.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},Gg={name:"CustomersRoute"},zg={class:"fca_customers_route"};function jg(e,t,a,l,n,i){const A=C("router-view");return r(),h("div",zg,[s(A)])}const qg=nt(Gg,[["render",jg]]);/*! |
| 2 |
* html2canvas 1.4.1 <https://html2canvas.hertzen.com> |
| 3 |
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com> |
| 4 |
* Released under MIT License |
| 5 |
*//*! ***************************************************************************** |
| 6 |
Copyright (c) Microsoft Corporation. |
| 7 |
|
| 8 |
Permission to use, copy, modify, and/or distribute this software for any |
| 9 |
purpose with or without fee is hereby granted. |
| 10 |
|
| 11 |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
| 12 |
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| 13 |
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
| 14 |
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| 15 |
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 16 |
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 17 |
PERFORMANCE OF THIS SOFTWARE. |
| 18 |
***************************************************************************** */var kr=function(e,t){return kr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,l){a.__proto__=l}||function(a,l){for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(a[n]=l[n])},kr(e,t)};function Pl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");kr(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var Br=function(){return Br=Object.assign||function(t){for(var a,l=1,n=arguments.length;l<n;l++){a=arguments[l];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(t[i]=a[i])}return t},Br.apply(this,arguments)};function rl(e,t,a,l){function n(i){return i instanceof a?i:new a(function(A){A(i)})}return new(a||(a=Promise))(function(i,A){function p(g){try{_(l.next(g))}catch(y){A(y)}}function m(g){try{_(l.throw(g))}catch(y){A(y)}}function _(g){g.done?i(g.value):n(g.value).then(p,m)}_((l=l.apply(e,[])).next())})}function sl(e,t){var a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},l,n,i,A;return A={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function p(_){return function(g){return m([_,g])}}function m(_){if(l)throw new TypeError("Generator is already executing.");for(;a;)try{if(l=1,n&&(i=_[0]&2?n.return:_[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,_[1])).done)return i;switch(n=0,i&&(_=[_[0]&2,i.value]),_[0]){case 0:case 1:i=_;break;case 4:return a.label++,{value:_[1],done:!1};case 5:a.label++,n=_[1],_=[0];continue;case 7:_=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(_[0]===6||_[0]===2)){a=0;continue}if(_[0]===3&&(!i||_[1]>i[0]&&_[1]<i[3])){a.label=_[1];break}if(_[0]===6&&a.label<i[1]){a.label=i[1],i=_;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(_);break}i[2]&&a.ops.pop(),a.trys.pop();continue}_=t.call(e,a)}catch(g){_=[6,g],n=0}finally{l=i=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}function Wn(e,t,a){if(arguments.length===2)for(var l=0,n=t.length,i;l<n;l++)(i||!(l in t))&&(i||(i=Array.prototype.slice.call(t,0,l)),i[l]=t[l]);return e.concat(i||t)}var is=function(){function e(t,a,l,n){this.left=t,this.top=a,this.width=l,this.height=n}return e.prototype.add=function(t,a,l,n){return new e(this.left+t,this.top+a,this.width+l,this.height+n)},e.fromClientRect=function(t,a){return new e(a.left+t.windowBounds.left,a.top+t.windowBounds.top,a.width,a.height)},e.fromDOMRectList=function(t,a){var l=Array.from(a).find(function(n){return n.width!==0});return l?new e(l.left+t.windowBounds.left,l.top+t.windowBounds.top,l.width,l.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),vi=function(e,t){return is.fromClientRect(e,t.getBoundingClientRect())},Yg=function(e){var t=e.body,a=e.documentElement;if(!t||!a)throw new Error("Unable to get document size");var l=Math.max(Math.max(t.scrollWidth,a.scrollWidth),Math.max(t.offsetWidth,a.offsetWidth),Math.max(t.clientWidth,a.clientWidth)),n=Math.max(Math.max(t.scrollHeight,a.scrollHeight),Math.max(t.offsetHeight,a.offsetHeight),Math.max(t.clientHeight,a.clientHeight));return new is(0,0,l,n)},gi=function(e){for(var t=[],a=0,l=e.length;a<l;){var n=e.charCodeAt(a++);if(n>=55296&&n<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((n&1023)<<10)+(i&1023)+65536):(t.push(n),a--)}else t.push(n)}return t},Ia=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var a=e.length;if(!a)return"";for(var l=[],n=-1,i="";++n<a;){var A=e[n];A<=65535?l.push(A):(A-=65536,l.push((A>>10)+55296,A%1024+56320)),(n+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},tu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Jn=0;Jn<tu.length;Jn++)Wg[tu.charCodeAt(Jn)]=Jn;var au="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Xn=0;Xn<au.length;Xn++)kn[au.charCodeAt(Xn)]=Xn;var Jg=function(e){var t=e.length*.75,a=e.length,l,n=0,i,A,p,m;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=kn[e.charCodeAt(l)],A=kn[e.charCodeAt(l+1)],p=kn[e.charCodeAt(l+2)],m=kn[e.charCodeAt(l+3)],g[n++]=i<<2|A>>4,g[n++]=(A&15)<<4|p>>2,g[n++]=(p&3)<<6|m&63;return _},Xg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},Zg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=4)a.push(e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l]);return a},Qs=5,bd=11,Mi=2,ey=bd-Qs,IA=65536>>Qs,ty=1<<Qs,Li=ty-1,ay=1024>>Qs,ly=IA+ay,sy=ly,ny=32,oy=sy+ny,iy=65536>>bd,ry=1<<ey,dy=ry-1,lu=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},uy=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},cy=function(e,t){var a=Jg(e),l=Array.isArray(a)?Zg(a):new Uint32Array(a),n=Array.isArray(a)?Xg(a):new Uint16Array(a),i=24,A=lu(n,i/2,l[4]/2),p=l[5]===2?lu(n,(i+l[4])/2):uy(l,Math.ceil((i+l[4])/4));return new Ay(l[0],l[1],l[2],l[3],A,p)},Ay=function(){function e(t,a,l,n,i,A){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=n,this.index=i,this.data=A}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Qs],a=(a<<Mi)+(t&Li),this.data[a];if(t<=65535)return a=this.index[IA+(t-55296>>Qs)],a=(a<<Mi)+(t&Li),this.data[a];if(t<this.highStart)return a=oy-iy+(t>>bd),a=this.index[a],a+=t>>Qs&dy,a=this.index[a],a=(a<<Mi)+(t&Li),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",py=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Zn=0;Zn<su.length;Zn++)py[su.charCodeAt(Zn)]=Zn;var fy="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",nu=50,my=1,VA=2,DA=3,hy=4,_y=5,ou=7,TA=8,iu=9,vs=10,xr=11,ru=12,Sr=13,vy=14,Bn=15,$r=16,eo=17,gn=18,gy=19,du=20,Fr=21,yn=22,Ri=23,qs=24,ml=25,xn=26,Sn=27,Ys=28,yy=29,Us=30,by=31,to=32,ao=33,Er=34,Ur=35,Ir=36,Pn=37,Vr=38,Eo=39,Uo=40,Oi=41,QA=42,wy=43,Cy=[9001,65288],MA="!",Gt="×",lo="÷",Dr=cy(fy),Zl=[Us,Ir],Tr=[my,VA,DA,_y],LA=[vs,TA],uu=[Sn,xn],ky=Tr.concat(LA),cu=[Vr,Eo,Uo,Er,Ur],By=[Bn,Sr],xy=function(e,t){t===void 0&&(t="strict");var a=[],l=[],n=[];return e.forEach(function(i,A){var p=Dr.get(i);if(p>nu?(n.push(!0),p-=nu):n.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return l.push(A),a.push($r);if(p===hy||p===xr){if(A===0)return l.push(A),a.push(Us);var m=a[A-1];return ky.indexOf(m)===-1?(l.push(l[A-1]),a.push(m)):(l.push(A),a.push(Us))}if(l.push(A),p===by)return a.push(t==="strict"?Fr:Pn);if(p===QA||p===yy)return a.push(Us);if(p===wy)return i>=131072&&i<=196605||i>=196608&&i<=262141?a.push(Pn):a.push(Us);a.push(p)}),[l,a,n]},Pi=function(e,t,a,l){var n=l[a];if(Array.isArray(e)?e.indexOf(n)!==-1:e===n)for(var i=a;i<=l.length;){i++;var A=l[i];if(A===t)return!0;if(A!==vs)break}if(n===vs)for(var i=a;i>0;){i--;var p=l[i];if(Array.isArray(e)?e.indexOf(p)!==-1:e===p)for(var m=a;m<=l.length;){m++;var A=l[m];if(A===t)return!0;if(A!==vs)break}if(p!==vs)break}return!1},Au=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===vs)a--;else return l}return 0},Sy=function(e,t,a,l,n){if(a[l]===0)return Gt;var i=l-1;if(Array.isArray(n)&&n[i]===!0)return Gt;var A=i-1,p=i+1,m=t[i],_=A>=0?t[A]:0,g=t[p];if(m===VA&&g===DA)return Gt;if(Tr.indexOf(m)!==-1)return MA;if(Tr.indexOf(g)!==-1||LA.indexOf(g)!==-1)return Gt;if(Au(i,t)===TA)return lo;if(Dr.get(e[i])===xr||(m===to||m===ao)&&Dr.get(e[p])===xr||m===ou||g===ou||m===iu||[vs,Sr,Bn].indexOf(m)===-1&&g===iu||[eo,gn,gy,qs,Ys].indexOf(g)!==-1||Au(i,t)===yn||Pi(Ri,yn,i,t)||Pi([eo,gn],Fr,i,t)||Pi(ru,ru,i,t))return Gt;if(m===vs)return lo;if(m===Ri||g===Ri)return Gt;if(g===$r||m===$r)return lo;if([Sr,Bn,Fr].indexOf(g)!==-1||m===vy||_===Ir&&By.indexOf(m)!==-1||m===Ys&&g===Ir||g===du||Zl.indexOf(g)!==-1&&m===ml||Zl.indexOf(m)!==-1&&g===ml||m===Sn&&[Pn,to,ao].indexOf(g)!==-1||[Pn,to,ao].indexOf(m)!==-1&&g===xn||Zl.indexOf(m)!==-1&&uu.indexOf(g)!==-1||uu.indexOf(m)!==-1&&Zl.indexOf(g)!==-1||[Sn,xn].indexOf(m)!==-1&&(g===ml||[yn,Bn].indexOf(g)!==-1&&t[p+1]===ml)||[yn,Bn].indexOf(m)!==-1&&g===ml||m===ml&&[ml,Ys,qs].indexOf(g)!==-1)return Gt;if([ml,Ys,qs,eo,gn].indexOf(g)!==-1)for(var y=i;y>=0;){var v=t[y];if(v===ml)return Gt;if([Ys,qs].indexOf(v)!==-1)y--;else break}if([Sn,xn].indexOf(g)!==-1)for(var y=[eo,gn].indexOf(m)!==-1?A:i;y>=0;){var v=t[y];if(v===ml)return Gt;if([Ys,qs].indexOf(v)!==-1)y--;else break}if(Vr===m&&[Vr,Eo,Er,Ur].indexOf(g)!==-1||[Eo,Er].indexOf(m)!==-1&&[Eo,Uo].indexOf(g)!==-1||[Uo,Ur].indexOf(m)!==-1&&g===Uo||cu.indexOf(m)!==-1&&[du,xn].indexOf(g)!==-1||cu.indexOf(g)!==-1&&m===Sn||Zl.indexOf(m)!==-1&&Zl.indexOf(g)!==-1||m===qs&&Zl.indexOf(g)!==-1||Zl.concat(ml).indexOf(m)!==-1&&g===yn&&Cy.indexOf(e[p])===-1||Zl.concat(ml).indexOf(g)!==-1&&m===gn)return Gt;if(m===Oi&&g===Oi){for(var k=a[i],b=1;k>0&&(k--,t[k]===Oi);)b++;if(b%2!==0)return Gt}return m===to&&g===ao?Gt:lo},$y=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=xy(e,t.lineBreak),l=a[0],n=a[1],i=a[2];(t.wordBreak==="break-all"||t.wordBreak==="break-word")&&(n=n.map(function(p){return[ml,Us,QA].indexOf(p)!==-1?Pn:p}));var A=t.wordBreak==="keep-all"?i.map(function(p,m){return p&&e[m]>=19968&&e[m]<=40959}):void 0;return[l,n,A]},Fy=function(){function e(t,a,l,n){this.codePoints=t,this.required=a===MA,this.start=l,this.end=n}return e.prototype.slice=function(){return Ia.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Ey=function(e,t){var a=gi(e),l=$y(a,t),n=l[0],i=l[1],A=l[2],p=a.length,m=0,_=0;return{next:function(){if(_>=p)return{done:!0,value:null};for(var g=Gt;_<p&&(g=Sy(a,i,n,++_,A))===Gt;);if(g!==Gt||_===p){var y=new Fy(a,g,m,_);return m=_,{value:y,done:!1}}return{done:!0,value:null}}}},Uy=1,Iy=2,Gn=4,pu=8,Po=10,fu=47,In=92,Vy=9,Dy=32,so=34,bn=61,Ty=35,Qy=36,My=37,no=39,oo=40,wn=41,Ly=95,Al=45,Ry=33,Oy=60,Py=62,Hy=64,Ny=91,Ky=93,Gy=61,zy=123,io=63,jy=125,mu=124,qy=126,Yy=128,hu=65533,Hi=42,Vs=43,Wy=44,Jy=58,Xy=59,Hn=46,Zy=0,e1=8,t1=11,a1=14,l1=31,s1=127,Nl=-1,RA=48,OA=97,PA=101,n1=102,o1=117,i1=122,HA=65,NA=69,KA=70,r1=85,d1=90,nl=function(e){return e>=RA&&e<=57},u1=function(e){return e>=55296&&e<=57343},Ws=function(e){return nl(e)||e>=HA&&e<=KA||e>=OA&&e<=n1},c1=function(e){return e>=OA&&e<=i1},A1=function(e){return e>=HA&&e<=d1},p1=function(e){return c1(e)||A1(e)},f1=function(e){return e>=Yy},ro=function(e){return e===Po||e===Vy||e===Dy},Ho=function(e){return p1(e)||f1(e)||e===Ly},_u=function(e){return Ho(e)||nl(e)||e===Al},m1=function(e){return e>=Zy&&e<=e1||e===t1||e>=a1&&e<=l1||e===s1},_s=function(e,t){return e!==In?!1:t!==Po},uo=function(e,t,a){return e===Al?Ho(t)||_s(t,a):Ho(e)?!0:!!(e===In&&_s(e,t))},Ni=function(e,t,a){return e===Vs||e===Al?nl(t)?!0:t===Hn&&nl(a):nl(e===Hn?t:e)},h1=function(e){var t=0,a=1;(e[t]===Vs||e[t]===Al)&&(e[t]===Al&&(a=-1),t++);for(var l=[];nl(e[t]);)l.push(e[t++]);var n=l.length?parseInt(Ia.apply(void 0,l),10):0;e[t]===Hn&&t++;for(var i=[];nl(e[t]);)i.push(e[t++]);var A=i.length,p=A?parseInt(Ia.apply(void 0,i),10):0;(e[t]===NA||e[t]===PA)&&t++;var m=1;(e[t]===Vs||e[t]===Al)&&(e[t]===Al&&(m=-1),t++);for(var _=[];nl(e[t]);)_.push(e[t++]);var g=_.length?parseInt(Ia.apply(void 0,_),10):0;return a*(n+p*Math.pow(10,-A))*Math.pow(10,m*g)},_1={type:2},v1={type:3},g1={type:4},y1={type:13},b1={type:8},w1={type:21},C1={type:9},k1={type:10},B1={type:11},x1={type:12},S1={type:14},co={type:23},$1={type:1},F1={type:25},E1={type:24},U1={type:26},I1={type:27},V1={type:28},D1={type:29},T1={type:31},Qr={type:32},GA=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(gi(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==Qr;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case so:return this.consumeStringToken(so);case Ty:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),n=this.peekCodePoint(2);if(_u(a)||_s(l,n)){var i=uo(a,l,n)?Iy:Uy,A=this.consumeName();return{type:5,value:A,flags:i}}break;case Qy:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),y1;break;case no:return this.consumeStringToken(no);case oo:return _1;case wn:return v1;case Hi:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),S1;break;case Vs:if(Ni(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Wy:return g1;case Al:var p=t,m=this.peekCodePoint(0),_=this.peekCodePoint(1);if(Ni(p,m,_))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(uo(p,m,_))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(m===Al&&_===Py)return this.consumeCodePoint(),this.consumeCodePoint(),E1;break;case Hn:if(Ni(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case fu:if(this.peekCodePoint(0)===Hi)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===Hi&&(g=this.consumeCodePoint(),g===fu))return this.consumeToken();if(g===Nl)return this.consumeToken()}break;case Jy:return U1;case Xy:return I1;case Oy:if(this.peekCodePoint(0)===Ry&&this.peekCodePoint(1)===Al&&this.peekCodePoint(2)===Al)return this.consumeCodePoint(),this.consumeCodePoint(),F1;break;case Hy:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),k=this.peekCodePoint(2);if(uo(y,v,k)){var A=this.consumeName();return{type:7,value:A}}break;case Ny:return V1;case In:if(_s(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case Ky:return D1;case Gy:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),b1;break;case zy:return B1;case jy:return x1;case o1:case r1:var b=this.peekCodePoint(0),w=this.peekCodePoint(1);return b===Vs&&(Ws(w)||w===io)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case mu:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),C1;if(this.peekCodePoint(0)===mu)return this.consumeCodePoint(),w1;break;case qy:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),k1;break;case Nl:return Qr}return ro(t)?(this.consumeWhiteSpace(),T1):nl(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):Ho(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:Ia(t)}},e.prototype.consumeCodePoint=function(){var t=this._value.shift();return typeof t>"u"?-1:t},e.prototype.reconsumeCodePoint=function(t){this._value.unshift(t)},e.prototype.peekCodePoint=function(t){return t>=this._value.length?-1:this._value[t]},e.prototype.consumeUnicodeRangeToken=function(){for(var t=[],a=this.consumeCodePoint();Ws(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var l=!1;a===io&&t.length<6;)t.push(a),a=this.consumeCodePoint(),l=!0;if(l){var n=parseInt(Ia.apply(void 0,t.map(function(m){return m===io?RA:m})),16),i=parseInt(Ia.apply(void 0,t.map(function(m){return m===io?KA:m})),16);return{type:30,start:n,end:i}}var A=parseInt(Ia.apply(void 0,t),16);if(this.peekCodePoint(0)===Al&&Ws(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var p=[];Ws(a)&&p.length<6;)p.push(a),a=this.consumeCodePoint();var i=parseInt(Ia.apply(void 0,p),16);return{type:30,start:A,end:i}}else return{type:30,start:A,end:A}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===oo?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===oo?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Nl)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===no||a===so){var l=this.consumeStringToken(this.consumeCodePoint());return l.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Nl||this.peekCodePoint(0)===wn)?(this.consumeCodePoint(),{type:22,value:l.value}):(this.consumeBadUrlRemnants(),co)}for(;;){var n=this.consumeCodePoint();if(n===Nl||n===wn)return{type:22,value:Ia.apply(void 0,t)};if(ro(n))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Nl||this.peekCodePoint(0)===wn?(this.consumeCodePoint(),{type:22,value:Ia.apply(void 0,t)}):(this.consumeBadUrlRemnants(),co);if(n===so||n===no||n===oo||m1(n))return this.consumeBadUrlRemnants(),co;if(n===In)if(_s(n,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),co;else t.push(n)}},e.prototype.consumeWhiteSpace=function(){for(;ro(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===wn||t===Nl)return;_s(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(t){for(var a=5e4,l="";t>0;){var n=Math.min(a,t);l+=Ia.apply(void 0,this._value.splice(0,n)),t-=n}return this._value.shift(),l},e.prototype.consumeStringToken=function(t){var a="",l=0;do{var n=this._value[l];if(n===Nl||n===void 0||n===t)return a+=this.consumeStringSlice(l),{type:0,value:a};if(n===Po)return this._value.splice(0,l),$1;if(n===In){var i=this._value[l+1];i!==Nl&&i!==void 0&&(i===Po?(a+=this.consumeStringSlice(l),l=-1,this._value.shift()):_s(n,i)&&(a+=this.consumeStringSlice(l),a+=Ia(this.consumeEscapedCodePoint()),l=-1))}l++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=Gn,l=this.peekCodePoint(0);for((l===Vs||l===Al)&&t.push(this.consumeCodePoint());nl(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0);var n=this.peekCodePoint(1);if(l===Hn&&nl(n))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=pu;nl(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),n=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===NA||l===PA)&&((n===Vs||n===Al)&&nl(i)||nl(n)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=pu;nl(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[h1(t),a]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),a=t[0],l=t[1],n=this.peekCodePoint(0),i=this.peekCodePoint(1),A=this.peekCodePoint(2);if(uo(n,i,A)){var p=this.consumeName();return{type:15,number:a,flags:l,unit:p}}return n===My?(this.consumeCodePoint(),{type:16,number:a,flags:l}):{type:17,number:a,flags:l}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(Ws(t)){for(var a=Ia(t);Ws(this.peekCodePoint(0))&&a.length<6;)a+=Ia(this.consumeCodePoint());ro(this.peekCodePoint(0))&&this.consumeCodePoint();var l=parseInt(a,16);return l===0||u1(l)||l>1114111?hu:l}return t===Nl?hu:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(_u(a))t+=Ia(a);else if(_s(a,this.peekCodePoint(0)))t+=Ia(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),zA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new GA;return a.write(t),new e(a.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var t=this.consumeToken();t.type===31;)t=this.consumeToken();if(t.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(t);var a=this.consumeComponentValue();do t=this.consumeToken();while(t.type===31);if(t.type===32)return a;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var t=[];;){var a=this.consumeComponentValue();if(a.type===32)return t;t.push(a),t.push()}},e.prototype.consumeComponentValue=function(){var t=this.consumeToken();switch(t.type){case 11:case 28:case 2:return this.consumeSimpleBlock(t.type);case 19:return this.consumeFunction(t)}return t},e.prototype.consumeSimpleBlock=function(t){for(var a={type:t,values:[]},l=this.consumeToken();;){if(l.type===32||M1(l,t))return a;this.reconsumeToken(l),a.values.push(this.consumeComponentValue()),l=this.consumeToken()}},e.prototype.consumeFunction=function(t){for(var a={name:t.value,values:[],type:18};;){var l=this.consumeToken();if(l.type===32||l.type===3)return a;this.reconsumeToken(l),a.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var t=this._tokens.shift();return typeof t>"u"?Qr:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),zn=function(e){return e.type===15},fn=function(e){return e.type===17},pa=function(e){return e.type===20},Q1=function(e){return e.type===0},Mr=function(e,t){return pa(e)&&e.value===t},jA=function(e){return e.type!==31},An=function(e){return e.type!==31&&e.type!==4},Wl=function(e){var t=[],a=[];return e.forEach(function(l){if(l.type===4){if(a.length===0)throw new Error("Error parsing function args, zero tokens for arg");t.push(a),a=[];return}l.type!==31&&a.push(l)}),a.length&&t.push(a),t},M1=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},xs=function(e){return e.type===17||e.type===15},Ta=function(e){return e.type===16||xs(e)},qA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},Wa={type:17,number:0,flags:Gn},wd={type:16,number:50,flags:Gn},gs={type:16,number:100,flags:Gn},$n=function(e,t,a){var l=e[0],n=e[1];return[ya(l,t),ya(typeof n<"u"?n:l,a)]},ya=function(e,t){if(e.type===16)return e.number/100*t;if(zn(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},YA="deg",WA="grad",JA="rad",XA="turn",yi={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case YA:return Math.PI*t.number/180;case WA:return Math.PI/200*t.number;case JA:return t.number;case XA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},ZA=function(e){return e.type===15&&(e.unit===YA||e.unit===WA||e.unit===JA||e.unit===XA)},ep=function(e){var t=e.filter(pa).map(function(a){return a.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Wa,Wa];case"to top":case"bottom":return Il(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Wa,gs];case"to right":case"left":return Il(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[gs,gs];case"to bottom":case"top":return Il(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[gs,Wa];case"to left":case"right":return Il(270)}return 0},Il=function(e){return Math.PI*e/180},Cs={name:"color",parse:function(e,t){if(t.type===18){var a=L1[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return a(e,t.values)}if(t.type===5){if(t.value.length===3){var l=t.value.substring(0,1),n=t.value.substring(1,2),i=t.value.substring(2,3);return ys(parseInt(l+l,16),parseInt(n+n,16),parseInt(i+i,16),1)}if(t.value.length===4){var l=t.value.substring(0,1),n=t.value.substring(1,2),i=t.value.substring(2,3),A=t.value.substring(3,4);return ys(parseInt(l+l,16),parseInt(n+n,16),parseInt(i+i,16),parseInt(A+A,16)/255)}if(t.value.length===6){var l=t.value.substring(0,2),n=t.value.substring(2,4),i=t.value.substring(4,6);return ys(parseInt(l,16),parseInt(n,16),parseInt(i,16),1)}if(t.value.length===8){var l=t.value.substring(0,2),n=t.value.substring(2,4),i=t.value.substring(4,6),A=t.value.substring(6,8);return ys(parseInt(l,16),parseInt(n,16),parseInt(i,16),parseInt(A,16)/255)}}if(t.type===20){var p=ls[t.value.toUpperCase()];if(typeof p<"u")return p}return ls.TRANSPARENT}},ks=function(e){return(255&e)===0},Na=function(e){var t=255&e,a=255&e>>8,l=255&e>>16,n=255&e>>24;return t<255?"rgba("+n+","+l+","+a+","+t/255+")":"rgb("+n+","+l+","+a+")"},ys=function(e,t,a,l){return(e<<24|t<<16|a<<8|Math.round(l*255)<<0)>>>0},vu=function(e,t){if(e.type===17)return e.number;if(e.type===16){var a=t===3?1:255;return t===3?e.number/100*a:Math.round(e.number/100*a)}return 0},gu=function(e,t){var a=t.filter(An);if(a.length===3){var l=a.map(vu),n=l[0],i=l[1],A=l[2];return ys(n,i,A,1)}if(a.length===4){var p=a.map(vu),n=p[0],i=p[1],A=p[2],m=p[3];return ys(n,i,A,m)}return 0};function Ki(e,t,a){return a<0&&(a+=1),a>=1&&(a-=1),a<1/6?(t-e)*a*6+e:a<1/2?t:a<2/3?(t-e)*6*(2/3-a)+e:e}var yu=function(e,t){var a=t.filter(An),l=a[0],n=a[1],i=a[2],A=a[3],p=(l.type===17?Il(l.number):yi.parse(e,l))/(Math.PI*2),m=Ta(n)?n.number/100:0,_=Ta(i)?i.number/100:0,g=typeof A<"u"&&Ta(A)?ya(A,1):1;if(m===0)return ys(_*255,_*255,_*255,1);var y=_<=.5?_*(m+1):_+m-_*m,v=_*2-y,k=Ki(v,y,p+1/3),b=Ki(v,y,p),w=Ki(v,y,p-1/3);return ys(k*255,b*255,w*255,g)},L1={hsl:yu,hsla:yu,rgb:gu,rgba:gu},Vn=function(e,t){return Cs.parse(e,zA.create(t).parseComponentValue())},ls={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},R1={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(pa(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},O1={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},bi=function(e,t){var a=Cs.parse(e,t[0]),l=t[1];return l&&Ta(l)?{color:a,stop:l}:{color:a,stop:null}},bu=function(e,t){var a=e[0],l=e[e.length-1];a.stop===null&&(a.stop=Wa),l.stop===null&&(l.stop=gs);for(var n=[],i=0,A=0;A<e.length;A++){var p=e[A].stop;if(p!==null){var m=ya(p,t);m>i?n.push(m):n.push(i),i=m}else n.push(null)}for(var _=null,A=0;A<n.length;A++){var g=n[A];if(g===null)_===null&&(_=A);else if(_!==null){for(var y=A-_,v=n[_-1],k=(g-v)/(y+1),b=1;b<=y;b++)n[_+b-1]=k*b;_=null}}return e.map(function(w,B){var S=w.color;return{color:S,stop:Math.max(Math.min(1,n[B]/t),0)}})},P1=function(e,t,a){var l=t/2,n=a/2,i=ya(e[0],t)-l,A=n-ya(e[1],a);return(Math.atan2(A,i)+Math.PI*2)%(Math.PI*2)},H1=function(e,t,a){var l=typeof e=="number"?e:P1(e,t,a),n=Math.abs(t*Math.sin(l))+Math.abs(a*Math.cos(l)),i=t/2,A=a/2,p=n/2,m=Math.sin(l-Math.PI/2)*p,_=Math.cos(l-Math.PI/2)*p;return[n,i-_,i+_,A-m,A+m]},Ml=function(e,t){return Math.sqrt(e*e+t*t)},wu=function(e,t,a,l,n){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(A,p){var m=p[0],_=p[1],g=Ml(a-m,l-_);return(n?g<A.optimumDistance:g>A.optimumDistance)?{optimumCorner:p,optimumDistance:g}:A},{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},N1=function(e,t,a,l,n){var i=0,A=0;switch(e.size){case 0:e.shape===0?i=A=Math.min(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-n)):e.shape===1&&(i=Math.min(Math.abs(t),Math.abs(t-l)),A=Math.min(Math.abs(a),Math.abs(a-n)));break;case 2:if(e.shape===0)i=A=Math.min(Ml(t,a),Ml(t,a-n),Ml(t-l,a),Ml(t-l,a-n));else if(e.shape===1){var p=Math.min(Math.abs(a),Math.abs(a-n))/Math.min(Math.abs(t),Math.abs(t-l)),m=wu(l,n,t,a,!0),_=m[0],g=m[1];i=Ml(_-t,(g-a)/p),A=p*i}break;case 1:e.shape===0?i=A=Math.max(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-n)):e.shape===1&&(i=Math.max(Math.abs(t),Math.abs(t-l)),A=Math.max(Math.abs(a),Math.abs(a-n)));break;case 3:if(e.shape===0)i=A=Math.max(Ml(t,a),Ml(t,a-n),Ml(t-l,a),Ml(t-l,a-n));else if(e.shape===1){var p=Math.max(Math.abs(a),Math.abs(a-n))/Math.max(Math.abs(t),Math.abs(t-l)),y=wu(l,n,t,a,!1),_=y[0],g=y[1];i=Ml(_-t,(g-a)/p),A=p*i}break}return Array.isArray(e.size)&&(i=ya(e.size[0],l),A=e.size.length===2?ya(e.size[1],n):i),[i,A]},K1=function(e,t){var a=Il(180),l=[];return Wl(t).forEach(function(n,i){if(i===0){var A=n[0];if(A.type===20&&A.value==="to"){a=ep(n);return}else if(ZA(A)){a=yi.parse(e,A);return}}var p=bi(e,n);l.push(p)}),{angle:a,stops:l,type:1}},Ao=function(e,t){var a=Il(180),l=[];return Wl(t).forEach(function(n,i){if(i===0){var A=n[0];if(A.type===20&&["top","left","right","bottom"].indexOf(A.value)!==-1){a=ep(n);return}else if(ZA(A)){a=(yi.parse(e,A)+Il(270))%Il(360);return}}var p=bi(e,n);l.push(p)}),{angle:a,stops:l,type:1}},G1=function(e,t){var a=Il(180),l=[],n=1,i=0,A=3,p=[];return Wl(t).forEach(function(m,_){var g=m[0];if(_===0){if(pa(g)&&g.value==="linear"){n=1;return}else if(pa(g)&&g.value==="radial"){n=2;return}}if(g.type===18){if(g.name==="from"){var y=Cs.parse(e,g.values[0]);l.push({stop:Wa,color:y})}else if(g.name==="to"){var y=Cs.parse(e,g.values[0]);l.push({stop:gs,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(An);if(v.length===2){var y=Cs.parse(e,v[1]),k=v[0];fn(k)&&l.push({stop:{type:16,number:k.number*100,flags:k.flags},color:y})}}}}),n===1?{angle:(a+Il(180))%Il(360),stops:l,type:n}:{size:A,shape:i,stops:l,position:p,type:n}},tp="closest-side",ap="farthest-side",lp="closest-corner",sp="farthest-corner",np="circle",op="ellipse",ip="cover",rp="contain",z1=function(e,t){var a=0,l=3,n=[],i=[];return Wl(t).forEach(function(A,p){var m=!0;if(p===0){var _=!1;m=A.reduce(function(y,v){if(_)if(pa(v))switch(v.value){case"center":return i.push(wd),y;case"top":case"left":return i.push(Wa),y;case"right":case"bottom":return i.push(gs),y}else(Ta(v)||xs(v))&&i.push(v);else if(pa(v))switch(v.value){case np:return a=0,!1;case op:return a=1,!1;case"at":return _=!0,!1;case tp:return l=0,!1;case ip:case ap:return l=1,!1;case rp:case lp:return l=2,!1;case sp:return l=3,!1}else if(xs(v)||Ta(v))return Array.isArray(l)||(l=[]),l.push(v),!1;return y},m)}if(m){var g=bi(e,A);n.push(g)}}),{size:l,shape:a,stops:n,position:i,type:2}},po=function(e,t){var a=0,l=3,n=[],i=[];return Wl(t).forEach(function(A,p){var m=!0;if(p===0?m=A.reduce(function(g,y){if(pa(y))switch(y.value){case"center":return i.push(wd),!1;case"top":case"left":return i.push(Wa),!1;case"right":case"bottom":return i.push(gs),!1}else if(Ta(y)||xs(y))return i.push(y),!1;return g},m):p===1&&(m=A.reduce(function(g,y){if(pa(y))switch(y.value){case np:return a=0,!1;case op:return a=1,!1;case rp:case tp:return l=0,!1;case ap:return l=1,!1;case lp:return l=2,!1;case ip:case sp:return l=3,!1}else if(xs(y)||Ta(y))return Array.isArray(l)||(l=[]),l.push(y),!1;return g},m)),m){var _=bi(e,A);n.push(_)}}),{size:l,shape:a,stops:n,position:i,type:2}},j1=function(e){return e.type===1},q1=function(e){return e.type===2},Cd={name:"image",parse:function(e,t){if(t.type===22){var a={url:t.value,type:0};return e.cache.addImage(t.value),a}if(t.type===18){var l=dp[t.name];if(typeof l>"u")throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return l(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function Y1(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!dp[e.name])}var dp={"linear-gradient":K1,"-moz-linear-gradient":Ao,"-ms-linear-gradient":Ao,"-o-linear-gradient":Ao,"-webkit-linear-gradient":Ao,"radial-gradient":z1,"-moz-radial-gradient":po,"-ms-radial-gradient":po,"-o-radial-gradient":po,"-webkit-radial-gradient":po,"-webkit-gradient":G1},W1={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var a=t[0];return a.type===20&&a.value==="none"?[]:t.filter(function(l){return An(l)&&Y1(l)}).map(function(l){return Cd.parse(e,l)})}},J1={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(pa(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},X1={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Wl(t).map(function(a){return a.filter(Ta)}).map(qA)}},Z1={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Wl(t).map(function(a){return a.filter(pa).map(function(l){return l.value}).join(" ")}).map(eb)}},eb=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},rn;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(rn||(rn={}));var tb={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Wl(t).map(function(a){return a.filter(ab)})}},ab=function(e){return pa(e)||Ta(e)},wi=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},lb=wi("top"),sb=wi("right"),nb=wi("bottom"),ob=wi("left"),Ci=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return qA(a.filter(Ta))}}},ib=Ci("top-left"),rb=Ci("top-right"),db=Ci("bottom-right"),ub=Ci("bottom-left"),ki=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(t,a){switch(a){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},cb=ki("top"),Ab=ki("right"),pb=ki("bottom"),fb=ki("left"),Bi=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return zn(a)?a.number:0}}},mb=Bi("top"),hb=Bi("right"),_b=Bi("bottom"),vb=Bi("left"),gb={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},yb={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},bb={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(pa).reduce(function(a,l){return a|wb(l.value)},0)}},wb=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Cb={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},kb={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value==="normal"?0:t.type===17||t.type===15?t.number:0}},No;(function(e){e.NORMAL="normal",e.STRICT="strict"})(No||(No={}));var Bb={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return No.STRICT;case"normal":default:return No.NORMAL}}},xb={name:"line-height",initialValue:"normal",prefix:!1,type:4},Cu=function(e,t){return pa(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Ta(e)?ya(e,t):t},Sb={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:Cd.parse(e,t)}},$b={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){switch(t){case"inside":return 0;case"outside":default:return 1}}},Lr={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},xi=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Fb=xi("top"),Eb=xi("right"),Ub=xi("bottom"),Ib=xi("left"),Vb={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(pa).map(function(a){switch(a.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Db={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-word":return"break-word";case"normal":default:return"normal"}}},Si=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Tb=Si("top"),Qb=Si("right"),Mb=Si("bottom"),Lb=Si("left"),Rb={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},Ob={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Pb={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Mr(t[0],"none")?[]:Wl(t).map(function(a){for(var l={color:ls.TRANSPARENT,offsetX:Wa,offsetY:Wa,blur:Wa},n=0,i=0;i<a.length;i++){var A=a[i];xs(A)?(n===0?l.offsetX=A:n===1?l.offsetY=A:l.blur=A,n++):l.color=Cs.parse(e,A)}return l})}},Hb={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Nb={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(e,t){if(t.type===20&&t.value==="none")return null;if(t.type===18){var a=zb[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},Kb=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},Gb=function(e){var t=e.filter(function(m){return m.type===17}).map(function(m){return m.number}),a=t[0],l=t[1];t[2],t[3];var n=t[4],i=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var A=t[12],p=t[13];return t[14],t[15],t.length===16?[a,l,n,i,A,p]:null},zb={matrix:Kb,matrix3d:Gb},ku={type:16,number:50,flags:Gn},jb=[ku,ku],qb={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Ta);return a.length!==2?jb:[a[0],a[1]]}},Yb={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},Dn;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(Dn||(Dn={}));var Wb={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return Dn.BREAK_ALL;case"keep-all":return Dn.KEEP_ALL;case"normal":default:return Dn.NORMAL}}},Jb={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(fn(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},up={name:"time",parse:function(e,t){if(t.type===15)switch(t.unit.toLowerCase()){case"s":return 1e3*t.number;case"ms":return t.number}throw new Error("Unsupported time type")}},Xb={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return fn(t)?t.number:1}},Zb={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},e0={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(pa).map(function(a){switch(a.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(a){return a!==0})}},t0={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var a=[],l=[];return t.forEach(function(n){switch(n.type){case 20:case 0:a.push(n.value);break;case 17:a.push(n.number.toString());break;case 4:l.push(a.join(" ")),a.length=0;break}}),a.length&&l.push(a.join(" ")),l.map(function(n){return n.indexOf(" ")===-1?n:"'"+n+"'"})}},a0={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},l0={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(fn(t))return t.number;if(pa(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},s0={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(pa).map(function(a){return a.value})}},n0={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},La=function(e,t){return(e&t)!==0},o0={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var a=t[0];return a.type===20&&a.value==="none"?[]:t}},i0={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var a=t[0];if(a.type===20&&a.value==="none")return null;for(var l=[],n=t.filter(jA),i=0;i<n.length;i++){var A=n[i],p=n[i+1];if(A.type===20){var m=p&&fn(p)?p.number:1;l.push({counter:A.value,increment:m})}}return l}},r0={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],l=t.filter(jA),n=0;n<l.length;n++){var i=l[n],A=l[n+1];if(pa(i)&&i.value!=="none"){var p=A&&fn(A)?A.number:0;a.push({counter:i.value,reset:p})}}return a}},d0={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(zn).map(function(a){return up.parse(e,a)})}},u0={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var a=t[0];if(a.type===20&&a.value==="none")return null;var l=[],n=t.filter(Q1);if(n.length%2!==0)return null;for(var i=0;i<n.length;i+=2){var A=n[i].value,p=n[i+1].value;l.push({open:A,close:p})}return l}},Bu=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},c0={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Mr(t[0],"none")?[]:Wl(t).map(function(a){for(var l={color:255,offsetX:Wa,offsetY:Wa,blur:Wa,spread:Wa,inset:!1},n=0,i=0;i<a.length;i++){var A=a[i];Mr(A,"inset")?l.inset=!0:xs(A)?(n===0?l.offsetX=A:n===1?l.offsetY=A:n===2?l.blur=A:l.spread=A,n++):l.color=Cs.parse(e,A)}return l})}},A0={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],l=[];return t.filter(pa).forEach(function(n){switch(n.value){case"stroke":l.push(1);break;case"fill":l.push(0);break;case"markers":l.push(2);break}}),a.forEach(function(n){l.indexOf(n)===-1&&l.push(n)}),l}},p0={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},f0={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return zn(t)?t.number:0}},m0=function(){function e(t,a){var l,n;this.animationDuration=ct(t,d0,a.animationDuration),this.backgroundClip=ct(t,R1,a.backgroundClip),this.backgroundColor=ct(t,O1,a.backgroundColor),this.backgroundImage=ct(t,W1,a.backgroundImage),this.backgroundOrigin=ct(t,J1,a.backgroundOrigin),this.backgroundPosition=ct(t,X1,a.backgroundPosition),this.backgroundRepeat=ct(t,Z1,a.backgroundRepeat),this.backgroundSize=ct(t,tb,a.backgroundSize),this.borderTopColor=ct(t,lb,a.borderTopColor),this.borderRightColor=ct(t,sb,a.borderRightColor),this.borderBottomColor=ct(t,nb,a.borderBottomColor),this.borderLeftColor=ct(t,ob,a.borderLeftColor),this.borderTopLeftRadius=ct(t,ib,a.borderTopLeftRadius),this.borderTopRightRadius=ct(t,rb,a.borderTopRightRadius),this.borderBottomRightRadius=ct(t,db,a.borderBottomRightRadius),this.borderBottomLeftRadius=ct(t,ub,a.borderBottomLeftRadius),this.borderTopStyle=ct(t,cb,a.borderTopStyle),this.borderRightStyle=ct(t,Ab,a.borderRightStyle),this.borderBottomStyle=ct(t,pb,a.borderBottomStyle),this.borderLeftStyle=ct(t,fb,a.borderLeftStyle),this.borderTopWidth=ct(t,mb,a.borderTopWidth),this.borderRightWidth=ct(t,hb,a.borderRightWidth),this.borderBottomWidth=ct(t,_b,a.borderBottomWidth),this.borderLeftWidth=ct(t,vb,a.borderLeftWidth),this.boxShadow=ct(t,c0,a.boxShadow),this.color=ct(t,gb,a.color),this.direction=ct(t,yb,a.direction),this.display=ct(t,bb,a.display),this.float=ct(t,Cb,a.cssFloat),this.fontFamily=ct(t,t0,a.fontFamily),this.fontSize=ct(t,a0,a.fontSize),this.fontStyle=ct(t,n0,a.fontStyle),this.fontVariant=ct(t,s0,a.fontVariant),this.fontWeight=ct(t,l0,a.fontWeight),this.letterSpacing=ct(t,kb,a.letterSpacing),this.lineBreak=ct(t,Bb,a.lineBreak),this.lineHeight=ct(t,xb,a.lineHeight),this.listStyleImage=ct(t,Sb,a.listStyleImage),this.listStylePosition=ct(t,$b,a.listStylePosition),this.listStyleType=ct(t,Lr,a.listStyleType),this.marginTop=ct(t,Fb,a.marginTop),this.marginRight=ct(t,Eb,a.marginRight),this.marginBottom=ct(t,Ub,a.marginBottom),this.marginLeft=ct(t,Ib,a.marginLeft),this.opacity=ct(t,Xb,a.opacity);var i=ct(t,Vb,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=ct(t,Db,a.overflowWrap),this.paddingTop=ct(t,Tb,a.paddingTop),this.paddingRight=ct(t,Qb,a.paddingRight),this.paddingBottom=ct(t,Mb,a.paddingBottom),this.paddingLeft=ct(t,Lb,a.paddingLeft),this.paintOrder=ct(t,A0,a.paintOrder),this.position=ct(t,Ob,a.position),this.textAlign=ct(t,Rb,a.textAlign),this.textDecorationColor=ct(t,Zb,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=ct(t,e0,(n=a.textDecorationLine)!==null&&n!==void 0?n:a.textDecoration),this.textShadow=ct(t,Pb,a.textShadow),this.textTransform=ct(t,Hb,a.textTransform),this.transform=ct(t,Nb,a.transform),this.transformOrigin=ct(t,qb,a.transformOrigin),this.visibility=ct(t,Yb,a.visibility),this.webkitTextStrokeColor=ct(t,p0,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=ct(t,f0,a.webkitTextStrokeWidth),this.wordBreak=ct(t,Wb,a.wordBreak),this.zIndex=ct(t,Jb,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return ks(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return La(this.display,4)||La(this.display,33554432)||La(this.display,268435456)||La(this.display,536870912)||La(this.display,67108864)||La(this.display,134217728)},e}(),h0=function(){function e(t,a){this.content=ct(t,o0,a.content),this.quotes=ct(t,u0,a.quotes)}return e}(),xu=function(){function e(t,a){this.counterIncrement=ct(t,i0,a.counterIncrement),this.counterReset=ct(t,r0,a.counterReset)}return e}(),ct=function(e,t,a){var l=new GA,n=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(n);var i=new zA(l.read());switch(t.type){case 2:var A=i.parseComponentValue();return t.parse(e,pa(A)?A.value:t.initialValue);case 0:return t.parse(e,i.parseComponentValue());case 1:return t.parse(e,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(t.format){case"angle":return yi.parse(e,i.parseComponentValue());case"color":return Cs.parse(e,i.parseComponentValue());case"image":return Cd.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return xs(p)?p:Wa;case"length-percentage":var m=i.parseComponentValue();return Ta(m)?m:Wa;case"time":return up.parse(e,i.parseComponentValue())}break}},_0="data-html2canvas-debug",v0=function(e){var t=e.getAttribute(_0);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Rr=function(e,t){var a=v0(e);return a===1||t===a},Jl=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,Rr(a,3))debugger;this.styles=new m0(t,window.getComputedStyle(a,null)),Hr(a)&&(this.styles.animationDuration.some(function(l){return l>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=vi(this.context,a),Rr(a,4)&&(this.flags|=16)}return e}(),g0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var fo=0;fo<Su.length;fo++)Fn[Su.charCodeAt(fo)]=fo;var y0=function(e){var t=e.length*.75,a=e.length,l,n=0,i,A,p,m;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=Fn[e.charCodeAt(l)],A=Fn[e.charCodeAt(l+1)],p=Fn[e.charCodeAt(l+2)],m=Fn[e.charCodeAt(l+3)],g[n++]=i<<2|A>>4,g[n++]=(A&15)<<4|p>>2,g[n++]=(p&3)<<6|m&63;return _},b0=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},w0=function(e){for(var t=e.length,a=[],l=0;l<t;l+=4)a.push(e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l]);return a},Ms=5,kd=11,Gi=2,C0=kd-Ms,cp=65536>>Ms,k0=1<<Ms,zi=k0-1,B0=1024>>Ms,x0=cp+B0,S0=x0,$0=32,F0=S0+$0,E0=65536>>kd,U0=1<<C0,I0=U0-1,$u=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},V0=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},D0=function(e,t){var a=y0(e),l=Array.isArray(a)?w0(a):new Uint32Array(a),n=Array.isArray(a)?b0(a):new Uint16Array(a),i=24,A=$u(n,i/2,l[4]/2),p=l[5]===2?$u(n,(i+l[4])/2):V0(l,Math.ceil((i+l[4])/4));return new T0(l[0],l[1],l[2],l[3],A,p)},T0=function(){function e(t,a,l,n,i,A){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=n,this.index=i,this.data=A}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Ms],a=(a<<Gi)+(t&zi),this.data[a];if(t<=65535)return a=this.index[cp+(t-55296>>Ms)],a=(a<<Gi)+(t&zi),this.data[a];if(t<this.highStart)return a=F0-E0+(t>>kd),a=this.index[a],a+=t>>Ms&I0,a=this.index[a],a=(a<<Gi)+(t&zi),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Fu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var mo=0;mo<Fu.length;mo++)Q0[Fu.charCodeAt(mo)]=mo;var M0=1,ji=2,qi=3,Eu=4,Uu=5,L0=7,Iu=8,Yi=9,Wi=10,Vu=11,Du=12,Tu=13,Qu=14,Ji=15,R0=function(e){for(var t=[],a=0,l=e.length;a<l;){var n=e.charCodeAt(a++);if(n>=55296&&n<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((n&1023)<<10)+(i&1023)+65536):(t.push(n),a--)}else t.push(n)}return t},O0=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var a=e.length;if(!a)return"";for(var l=[],n=-1,i="";++n<a;){var A=e[n];A<=65535?l.push(A):(A-=65536,l.push((A>>10)+55296,A%1024+56320)),(n+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},P0=D0(g0),Bl="×",Xi="÷",H0=function(e){return P0.get(e)},N0=function(e,t,a){var l=a-2,n=t[l],i=t[a-1],A=t[a];if(i===ji&&A===qi)return Bl;if(i===ji||i===qi||i===Eu||A===ji||A===qi||A===Eu)return Xi;if(i===Iu&&[Iu,Yi,Vu,Du].indexOf(A)!==-1||(i===Vu||i===Yi)&&(A===Yi||A===Wi)||(i===Du||i===Wi)&&A===Wi||A===Tu||A===Uu||A===L0||i===M0)return Bl;if(i===Tu&&A===Qu){for(;n===Uu;)n=t[--l];if(n===Qu)return Bl}if(i===Ji&&A===Ji){for(var p=0;n===Ji;)p++,n=t[--l];if(p%2===0)return Bl}return Xi},K0=function(e){var t=R0(e),a=t.length,l=0,n=0,i=t.map(H0);return{next:function(){if(l>=a)return{done:!0,value:null};for(var A=Bl;l<a&&(A=N0(t,i,++l))===Bl;);if(A!==Bl||l===a){var p=O0.apply(null,t.slice(n,l));return n=l,{value:p,done:!1}}return{done:!0,value:null}}}},G0=function(e){for(var t=K0(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},z0=function(e){var t=123;if(e.createRange){var a=e.createRange();if(a.getBoundingClientRect){var l=e.createElement("boundtest");l.style.height=t+"px",l.style.display="block",e.body.appendChild(l),a.selectNode(l);var n=a.getBoundingClientRect(),i=Math.round(n.height);if(e.body.removeChild(l),i===t)return!0}}return!1},j0=function(e){var t=e.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",e.body.appendChild(t);var a=e.createRange();t.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var l=t.firstChild,n=gi(l.data).map(function(m){return Ia(m)}),i=0,A={},p=n.every(function(m,_){a.setStart(l,i),a.setEnd(l,i+m.length);var g=a.getBoundingClientRect();i+=m.length;var y=g.x>A.x||g.y>A.y;return A=g,_===0?!0:y});return e.body.removeChild(t),p},q0=function(){return typeof new Image().crossOrigin<"u"},Y0=function(){return typeof new XMLHttpRequest().responseType=="string"},W0=function(e){var t=new Image,a=e.createElement("canvas"),l=a.getContext("2d");if(!l)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{l.drawImage(t,0,0),a.toDataURL()}catch{return!1}return!0},Mu=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},J0=function(e){var t=e.createElement("canvas"),a=100;t.width=a,t.height=a;var l=t.getContext("2d");if(!l)return Promise.reject(!1);l.fillStyle="rgb(0, 255, 0)",l.fillRect(0,0,a,a);var n=new Image,i=t.toDataURL();n.src=i;var A=Or(a,a,0,0,n);return l.fillStyle="red",l.fillRect(0,0,a,a),Lu(A).then(function(p){l.drawImage(p,0,0);var m=l.getImageData(0,0,a,a).data;l.fillStyle="red",l.fillRect(0,0,a,a);var _=e.createElement("div");return _.style.backgroundImage="url("+i+")",_.style.height=a+"px",Mu(m)?Lu(Or(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),Mu(l.getImageData(0,0,a,a).data)}).catch(function(){return!1})},Or=function(e,t,a,l,n){var i="http://www.w3.org/2000/svg",A=document.createElementNS(i,"svg"),p=document.createElementNS(i,"foreignObject");return A.setAttributeNS(null,"width",e.toString()),A.setAttributeNS(null,"height",t.toString()),p.setAttributeNS(null,"width","100%"),p.setAttributeNS(null,"height","100%"),p.setAttributeNS(null,"x",a.toString()),p.setAttributeNS(null,"y",l.toString()),p.setAttributeNS(null,"externalResourcesRequired","true"),A.appendChild(p),p.appendChild(n),A},Lu=function(e){return new Promise(function(t,a){var l=new Image;l.onload=function(){return t(l)},l.onerror=a,l.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},ja={get SUPPORT_RANGE_BOUNDS(){var e=z0(document);return Object.defineProperty(ja,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=ja.SUPPORT_RANGE_BOUNDS&&j0(document);return Object.defineProperty(ja,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=W0(document);return Object.defineProperty(ja,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?J0(document):Promise.resolve(!1);return Object.defineProperty(ja,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=q0();return Object.defineProperty(ja,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=Y0();return Object.defineProperty(ja,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ja,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(ja,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Tn=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),X0=function(e,t,a,l){var n=tw(t,a),i=[],A=0;return n.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(ja.SUPPORT_RANGE_BOUNDS){var m=Ru(l,A,p.length).getClientRects();if(m.length>1){var _=Bd(p),g=0;_.forEach(function(v){i.push(new Tn(v,is.fromDOMRectList(e,Ru(l,g+A,v.length).getClientRects()))),g+=v.length})}else i.push(new Tn(p,is.fromDOMRectList(e,m)))}else{var y=l.splitText(p.length);i.push(new Tn(p,Z0(e,l))),l=y}else ja.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));A+=p.length}),i},Z0=function(e,t){var a=t.ownerDocument;if(a){var l=a.createElement("html2canvaswrapper");l.appendChild(t.cloneNode(!0));var n=t.parentNode;if(n){n.replaceChild(l,t);var i=vi(e,l);return l.firstChild&&n.replaceChild(l.firstChild,l),i}}return is.EMPTY},Ru=function(e,t,a){var l=e.ownerDocument;if(!l)throw new Error("Node has no owner document");var n=l.createRange();return n.setStart(e,t),n.setEnd(e,t+a),n},Bd=function(e){if(ja.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map(function(a){return a.segment})}return G0(e)},ew=function(e,t){if(ja.SUPPORT_NATIVE_TEXT_SEGMENTATION){var a=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(a.segment(e)).map(function(l){return l.segment})}return lw(e,t)},tw=function(e,t){return t.letterSpacing!==0?Bd(e):ew(e,t)},aw=[32,160,4961,65792,65793,4153,4241],lw=function(e,t){for(var a=Ey(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),l=[],n,i=function(){if(n.value){var A=n.value.slice(),p=gi(A),m="";p.forEach(function(_){aw.indexOf(_)===-1?m+=Ia(_):(m.length&&l.push(m),l.push(Ia(_)),m="")}),m.length&&l.push(m)}};!(n=a.next()).done;)i();return l},sw=function(){function e(t,a,l){this.text=nw(a.data,l.textTransform),this.textBounds=X0(t,this.text,l,a)}return e}(),nw=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(ow,iw);case 2:return e.toUpperCase();default:return e}},ow=/(^|\s|:|-|\(|\))([a-z])/g,iw=function(e,t,a){return e.length>0?t+a.toUpperCase():e},Ap=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;return n.src=l.currentSrc||l.src,n.intrinsicWidth=l.naturalWidth,n.intrinsicHeight=l.naturalHeight,n.context.cache.addImage(n.src),n}return t}(Jl),pp=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;return n.canvas=l,n.intrinsicWidth=l.width,n.intrinsicHeight=l.height,n}return t}(Jl),fp=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this,i=new XMLSerializer,A=vi(a,l);return l.setAttribute("width",A.width+"px"),l.setAttribute("height",A.height+"px"),n.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(l)),n.intrinsicWidth=l.width.baseVal.value,n.intrinsicHeight=l.height.baseVal.value,n.context.cache.addImage(n.svg),n}return t}(Jl),mp=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;return n.value=l.value,n}return t}(Jl),Pr=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;return n.start=l.start,n.reversed=typeof l.reversed=="boolean"&&l.reversed===!0,n}return t}(Jl),rw=[{type:15,flags:0,unit:"px",number:3}],dw=[{type:16,flags:0,number:50}],uw=function(e){return e.width>e.height?new is(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new is(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},cw=function(e){var t=e.type===Aw?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},Ko="checkbox",Go="radio",Aw="password",Ou=707406591,xd=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;switch(n.type=l.type.toLowerCase(),n.checked=l.checked,n.value=cw(l),(n.type===Ko||n.type===Go)&&(n.styles.backgroundColor=3739148031,n.styles.borderTopColor=n.styles.borderRightColor=n.styles.borderBottomColor=n.styles.borderLeftColor=2779096575,n.styles.borderTopWidth=n.styles.borderRightWidth=n.styles.borderBottomWidth=n.styles.borderLeftWidth=1,n.styles.borderTopStyle=n.styles.borderRightStyle=n.styles.borderBottomStyle=n.styles.borderLeftStyle=1,n.styles.backgroundClip=[0],n.styles.backgroundOrigin=[0],n.bounds=uw(n.bounds)),n.type){case Ko:n.styles.borderTopRightRadius=n.styles.borderTopLeftRadius=n.styles.borderBottomRightRadius=n.styles.borderBottomLeftRadius=rw;break;case Go:n.styles.borderTopRightRadius=n.styles.borderTopLeftRadius=n.styles.borderBottomRightRadius=n.styles.borderBottomLeftRadius=dw;break}return n}return t}(Jl),hp=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this,i=l.options[l.selectedIndex||0];return n.value=i&&i.text||"",n}return t}(Jl),_p=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;return n.value=l.value,n}return t}(Jl),vp=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;n.src=l.src,n.width=parseInt(l.width,10)||0,n.height=parseInt(l.height,10)||0,n.backgroundColor=n.styles.backgroundColor;try{if(l.contentWindow&&l.contentWindow.document&&l.contentWindow.document.documentElement){n.tree=yp(a,l.contentWindow.document.documentElement);var i=l.contentWindow.document.documentElement?Vn(a,getComputedStyle(l.contentWindow.document.documentElement).backgroundColor):ls.TRANSPARENT,A=l.contentWindow.document.body?Vn(a,getComputedStyle(l.contentWindow.document.body).backgroundColor):ls.TRANSPARENT;n.backgroundColor=ks(i)?ks(A)?n.styles.backgroundColor:A:i}}catch{}return n}return t}(Jl),pw=["OL","UL","MENU"],Io=function(e,t,a,l){for(var n=t.firstChild,i=void 0;n;n=i)if(i=n.nextSibling,bp(n)&&n.data.trim().length>0)a.textNodes.push(new sw(e,n,a.styles));else if(nn(n))if(Bp(n)&&n.assignedNodes)n.assignedNodes().forEach(function(p){return Io(e,p,a,l)});else{var A=gp(e,n);A.styles.isVisible()&&(fw(n,A,l)?A.flags|=4:mw(A.styles)&&(A.flags|=2),pw.indexOf(n.tagName)!==-1&&(A.flags|=8),a.elements.push(A),n.slot,n.shadowRoot?Io(e,n.shadowRoot,A,l):!zo(n)&&!wp(n)&&!jo(n)&&Io(e,n,A,l))}},gp=function(e,t){return Nr(t)?new Ap(e,t):Cp(t)?new pp(e,t):wp(t)?new fp(e,t):hw(t)?new mp(e,t):_w(t)?new Pr(e,t):vw(t)?new xd(e,t):jo(t)?new hp(e,t):zo(t)?new _p(e,t):kp(t)?new vp(e,t):new Jl(e,t)},yp=function(e,t){var a=gp(e,t);return a.flags|=4,Io(e,t,a,a),a},fw=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Sd(e)&&a.styles.isTransparent()},mw=function(e){return e.isPositioned()||e.isFloating()},bp=function(e){return e.nodeType===Node.TEXT_NODE},nn=function(e){return e.nodeType===Node.ELEMENT_NODE},Hr=function(e){return nn(e)&&typeof e.style<"u"&&!Vo(e)},Vo=function(e){return typeof e.className=="object"},hw=function(e){return e.tagName==="LI"},_w=function(e){return e.tagName==="OL"},vw=function(e){return e.tagName==="INPUT"},gw=function(e){return e.tagName==="HTML"},wp=function(e){return e.tagName==="svg"},Sd=function(e){return e.tagName==="BODY"},Cp=function(e){return e.tagName==="CANVAS"},Pu=function(e){return e.tagName==="VIDEO"},Nr=function(e){return e.tagName==="IMG"},kp=function(e){return e.tagName==="IFRAME"},Hu=function(e){return e.tagName==="STYLE"},yw=function(e){return e.tagName==="SCRIPT"},zo=function(e){return e.tagName==="TEXTAREA"},jo=function(e){return e.tagName==="SELECT"},Bp=function(e){return e.tagName==="SLOT"},Nu=function(e){return e.tagName.indexOf("-")>0},bw=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(t){var a=this.counters[t];return a&&a.length?a[a.length-1]:1},e.prototype.getCounterValues=function(t){var a=this.counters[t];return a||[]},e.prototype.pop=function(t){var a=this;t.forEach(function(l){return a.counters[l].pop()})},e.prototype.parse=function(t){var a=this,l=t.counterIncrement,n=t.counterReset,i=!0;l!==null&&l.forEach(function(p){var m=a.counters[p.counter];m&&p.increment!==0&&(i=!1,m.length||m.push(1),m[Math.max(0,m.length-1)]+=p.increment)});var A=[];return i&&n.forEach(function(p){var m=a.counters[p.counter];A.push(p.counter),m||(m=a.counters[p.counter]=[]),m.push(p.reset)}),A},e}(),Ku={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Gu={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},ww={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Cw={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Js=function(e,t,a,l,n,i){return e<t||e>a?Nn(e,n,i.length>0):l.integers.reduce(function(A,p,m){for(;e>=p;)e-=p,A+=l.values[m];return A},"")+i},xp=function(e,t,a,l){var n="";do a||e--,n=l(e)+n,e/=t;while(e*t>=t);return n},Ua=function(e,t,a,l,n){var i=a-t+1;return(e<0?"-":"")+(xp(Math.abs(e),i,l,function(A){return Ia(Math.floor(A%i)+t)})+n)},Es=function(e,t,a){a===void 0&&(a=". ");var l=t.length;return xp(Math.abs(e),l,!1,function(n){return t[Math.floor(n%l)]})+a},tn=1,ms=2,hs=4,En=8,es=function(e,t,a,l,n,i){if(e<-9999||e>9999)return Nn(e,4,n.length>0);var A=Math.abs(e),p=n;if(A===0)return t[0]+p;for(var m=0;A>0&&m<=4;m++){var _=A%10;_===0&&La(i,tn)&&p!==""?p=t[_]+p:_>1||_===1&&m===0||_===1&&m===1&&La(i,ms)||_===1&&m===1&&La(i,hs)&&e>100||_===1&&m>1&&La(i,En)?p=t[_]+(m>0?a[m-1]:"")+p:_===1&&m>0&&(p=a[m-1]+p),A=Math.floor(A/10)}return(e<0?l:"")+p},zu="十百千萬",ju="拾佰仟萬",qu="マイナス",Zi="마이너스",Nn=function(e,t,a){var l=a?". ":"",n=a?"、":"",i=a?", ":"",A=a?" ":"";switch(t){case 0:return"•"+A;case 1:return"◦"+A;case 2:return"◾"+A;case 5:var p=Ua(e,48,57,!0,l);return p.length<4?"0"+p:p;case 4:return Es(e,"〇一二三四五六七八九",n);case 6:return Js(e,1,3999,Ku,3,l).toLowerCase();case 7:return Js(e,1,3999,Ku,3,l);case 8:return Ua(e,945,969,!1,l);case 9:return Ua(e,97,122,!1,l);case 10:return Ua(e,65,90,!1,l);case 11:return Ua(e,1632,1641,!0,l);case 12:case 49:return Js(e,1,9999,Gu,3,l);case 35:return Js(e,1,9999,Gu,3,l).toLowerCase();case 13:return Ua(e,2534,2543,!0,l);case 14:case 30:return Ua(e,6112,6121,!0,l);case 15:return Es(e,"子丑寅卯辰巳午未申酉戌亥",n);case 16:return Es(e,"甲乙丙丁戊己庚辛壬癸",n);case 17:case 48:return es(e,"零一二三四五六七八九",zu,"負",n,ms|hs|En);case 47:return es(e,"零壹貳參肆伍陸柒捌玖",ju,"負",n,tn|ms|hs|En);case 42:return es(e,"零一二三四五六七八九",zu,"负",n,ms|hs|En);case 41:return es(e,"零壹贰叁肆伍陆柒捌玖",ju,"负",n,tn|ms|hs|En);case 26:return es(e,"〇一二三四五六七八九","十百千万",qu,n,0);case 25:return es(e,"零壱弐参四伍六七八九","拾百千万",qu,n,tn|ms|hs);case 31:return es(e,"영일이삼사오육칠팔구","십백천만",Zi,i,tn|ms|hs);case 33:return es(e,"零一二三四五六七八九","十百千萬",Zi,i,0);case 32:return es(e,"零壹貳參四五六七八九","拾百千",Zi,i,tn|ms|hs);case 18:return Ua(e,2406,2415,!0,l);case 20:return Js(e,1,19999,Cw,3,l);case 21:return Ua(e,2790,2799,!0,l);case 22:return Ua(e,2662,2671,!0,l);case 22:return Js(e,1,10999,ww,3,l);case 23:return Es(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Es(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ua(e,3302,3311,!0,l);case 28:return Es(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",n);case 29:return Es(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",n);case 34:return Ua(e,3792,3801,!0,l);case 37:return Ua(e,6160,6169,!0,l);case 38:return Ua(e,4160,4169,!0,l);case 39:return Ua(e,2918,2927,!0,l);case 40:return Ua(e,1776,1785,!0,l);case 43:return Ua(e,3046,3055,!0,l);case 44:return Ua(e,3174,3183,!0,l);case 45:return Ua(e,3664,3673,!0,l);case 46:return Ua(e,3872,3881,!0,l);case 3:default:return Ua(e,48,57,!0,l)}},Sp="data-html2canvas-ignore",Yu=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new bw,this.quoteDepth=0,!a.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(a.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(t,a){var l=this,n=kw(t,a);if(!n.contentWindow)return Promise.reject("Unable to find iframe window");var i=t.defaultView.pageXOffset,A=t.defaultView.pageYOffset,p=n.contentWindow,m=p.document,_=Sw(n).then(function(){return rl(l,void 0,void 0,function(){var g,y;return sl(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(Uw),p&&(p.scrollTo(a.left,a.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(p.scrollY!==a.top||p.scrollX!==a.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(p.scrollX-a.left,p.scrollY-a.top,0,0))),g=this.options.onclone,y=this.clonedReferenceElement,typeof y>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:m.fonts&&m.fonts.ready?[4,m.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,xw(m)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof g=="function"?[2,Promise.resolve().then(function(){return g(m,y)}).then(function(){return n})]:[2,n]}})})});return m.open(),m.write(Fw(document.doctype)+"<html></html>"),Ew(this.referenceElement.ownerDocument,i,A),m.replaceChild(m.adoptNode(this.documentElement),m.documentElement),m.close(),_},e.prototype.createElementClone=function(t){if(Rr(t,2))debugger;if(Cp(t))return this.createCanvasClone(t);if(Pu(t))return this.createVideoClone(t);if(Hu(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return Nr(a)&&(Nr(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Nu(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return er(t.style,a),a},e.prototype.createStyleClone=function(t){try{var a=t.sheet;if(a&&a.cssRules){var l=[].slice.call(a.cssRules,0).reduce(function(i,A){return A&&typeof A.cssText=="string"?i+A.cssText:i},""),n=t.cloneNode(!1);return n.textContent=l,n}}catch(i){if(this.context.logger.error("Unable to access cssRules property",i),i.name!=="SecurityError")throw i}return t.cloneNode(!1)},e.prototype.createCanvasClone=function(t){var a;if(this.options.inlineImages&&t.ownerDocument){var l=t.ownerDocument.createElement("img");try{return l.src=t.toDataURL(),l}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",t)}}var n=t.cloneNode(!1);try{n.width=t.width,n.height=t.height;var i=t.getContext("2d"),A=n.getContext("2d");if(A)if(!this.options.allowTaint&&i)A.putImageData(i.getImageData(0,0,t.width,t.height),0,0);else{var p=(a=t.getContext("webgl2"))!==null&&a!==void 0?a:t.getContext("webgl");if(p){var m=p.getContextAttributes();(m==null?void 0:m.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}A.drawImage(t,0,0)}return n}catch{this.context.logger.info("Unable to clone canvas as it is tainted",t)}return n},e.prototype.createVideoClone=function(t){var a=t.ownerDocument.createElement("canvas");a.width=t.offsetWidth,a.height=t.offsetHeight;var l=a.getContext("2d");try{return l&&(l.drawImage(t,0,0,a.width,a.height),this.options.allowTaint||l.getImageData(0,0,a.width,a.height)),a}catch{this.context.logger.info("Unable to clone video as it is tainted",t)}var n=t.ownerDocument.createElement("canvas");return n.width=t.offsetWidth,n.height=t.offsetHeight,n},e.prototype.appendChildNode=function(t,a,l){(!nn(a)||!yw(a)&&!a.hasAttribute(Sp)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!nn(a)||!Hu(a))&&t.appendChild(this.cloneNode(a,l))},e.prototype.cloneChildNodes=function(t,a,l){for(var n=this,i=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;i;i=i.nextSibling)if(nn(i)&&Bp(i)&&typeof i.assignedNodes=="function"){var A=i.assignedNodes();A.length&&A.forEach(function(p){return n.appendChildNode(a,p,l)})}else this.appendChildNode(a,i,l)},e.prototype.cloneNode=function(t,a){if(bp(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var l=t.ownerDocument.defaultView;if(l&&nn(t)&&(Hr(t)||Vo(t))){var n=this.createElementClone(t);n.style.transitionProperty="none";var i=l.getComputedStyle(t),A=l.getComputedStyle(t,":before"),p=l.getComputedStyle(t,":after");this.referenceElement===t&&Hr(n)&&(this.clonedReferenceElement=n),Sd(n)&&Dw(n);var m=this.counters.parse(new xu(this.context,i)),_=this.resolvePseudoContent(t,n,A,Qn.BEFORE);Nu(t)&&(a=!0),Pu(t)||this.cloneChildNodes(t,n,a),_&&n.insertBefore(_,n.firstChild);var g=this.resolvePseudoContent(t,n,p,Qn.AFTER);return g&&n.appendChild(g),this.counters.pop(m),(i&&(this.options.copyStyles||Vo(t))&&!kp(t)||a)&&er(i,n),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([n,t.scrollLeft,t.scrollTop]),(zo(t)||jo(t))&&(zo(n)||jo(n))&&(n.value=t.value),n}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,a,l,n){var i=this;if(l){var A=l.content,p=a.ownerDocument;if(!(!p||!A||A==="none"||A==="-moz-alt-content"||l.display==="none")){this.counters.parse(new xu(this.context,l));var m=new h0(this.context,l),_=p.createElement("html2canvaspseudoelement");er(l,_),m.content.forEach(function(y){if(y.type===0)_.appendChild(p.createTextNode(y.value));else if(y.type===22){var v=p.createElement("img");v.src=y.value,v.style.opacity="1",_.appendChild(v)}else if(y.type===18){if(y.name==="attr"){var k=y.values.filter(pa);k.length&&_.appendChild(p.createTextNode(t.getAttribute(k[0].value)||""))}else if(y.name==="counter"){var b=y.values.filter(An),w=b[0],B=b[1];if(w&&pa(w)){var S=i.counters.getCounterValue(w.value),V=B&&pa(B)?Lr.parse(i.context,B.value):3;_.appendChild(p.createTextNode(Nn(S,V,!1)))}}else if(y.name==="counters"){var F=y.values.filter(An),w=F[0],$=F[1],B=F[2];if(w&&pa(w)){var U=i.counters.getCounterValues(w.value),D=B&&pa(B)?Lr.parse(i.context,B.value):3,T=$&&$.type===0?$.value:"",I=U.map(function(Q){return Nn(Q,D,!1)}).join(T);_.appendChild(p.createTextNode(I))}}}else if(y.type===20)switch(y.value){case"open-quote":_.appendChild(p.createTextNode(Bu(m.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(Bu(m.quotes,--i.quoteDepth,!1)));break;default:_.appendChild(p.createTextNode(y.value))}}),_.className=Kr+" "+Gr;var g=n===Qn.BEFORE?" "+Kr:" "+Gr;return Vo(a)?a.className.baseValue+=g:a.className+=g,_}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),Qn;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(Qn||(Qn={}));var kw=function(e,t){var a=e.createElement("iframe");return a.className="html2canvas-container",a.style.visibility="hidden",a.style.position="fixed",a.style.left="-10000px",a.style.top="0px",a.style.border="0",a.width=t.width.toString(),a.height=t.height.toString(),a.scrolling="no",a.setAttribute(Sp,"true"),e.body.appendChild(a),a},Bw=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},xw=function(e){return Promise.all([].slice.call(e.images,0).map(Bw))},Sw=function(e){return new Promise(function(t,a){var l=e.contentWindow;if(!l)return a("No window assigned for iframe");var n=l.document;l.onload=e.onload=function(){l.onload=e.onload=null;var i=setInterval(function(){n.body.childNodes.length>0&&n.readyState==="complete"&&(clearInterval(i),t(e))},50)}})},$w=["all","d","content"],er=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);$w.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},Fw=function(e){var t="";return e&&(t+="<!DOCTYPE ",e.name&&(t+=e.name),e.internalSubset&&(t+=e.internalSubset),e.publicId&&(t+='"'+e.publicId+'"'),e.systemId&&(t+='"'+e.systemId+'"'),t+=">"),t},Ew=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},Uw=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},Iw=":before",Vw=":after",Kr="___html2canvas___pseudoelement_before",Gr="___html2canvas___pseudoelement_after",Wu=`{ |
| 19 |
content: "" !important; |
| 20 |
display: none !important; |
| 21 |
}`,Dw=function(e){Tw(e,"."+Kr+Iw+Wu+` |
| 22 |
.`+Gr+Vw+Wu)},Tw=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},$p=function(){function e(){}return e.getOrigin=function(t){var a=e._link;return a?(a.href=t,a.href=a.href,a.protocol+a.hostname+a.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),Qw=function(){function e(t,a){this.context=t,this._options=a,this._cache={}}return e.prototype.addImage=function(t){var a=Promise.resolve();return this.has(t)||(ar(t)||Ow(t))&&(this._cache[t]=this.loadImage(t)).catch(function(){}),a},e.prototype.match=function(t){return this._cache[t]},e.prototype.loadImage=function(t){return rl(this,void 0,void 0,function(){var a,l,n,i,A=this;return sl(this,function(p){switch(p.label){case 0:return a=$p.isSameOrigin(t),l=!tr(t)&&this._options.useCORS===!0&&ja.SUPPORT_CORS_IMAGES&&!a,n=!tr(t)&&!a&&!ar(t)&&typeof this._options.proxy=="string"&&ja.SUPPORT_CORS_XHR&&!l,!a&&this._options.allowTaint===!1&&!tr(t)&&!ar(t)&&!n&&!l?[2]:(i=t,n?[4,this.proxy(i)]:[3,2]);case 1:i=p.sent(),p.label=2;case 2:return this.context.logger.debug("Added image "+t.substring(0,256)),[4,new Promise(function(m,_){var g=new Image;g.onload=function(){return m(g)},g.onerror=_,(Pw(i)||l)&&(g.crossOrigin="anonymous"),g.src=i,g.complete===!0&&setTimeout(function(){return m(g)},500),A._options.imageTimeout>0&&setTimeout(function(){return _("Timed out ("+A._options.imageTimeout+"ms) loading image")},A._options.imageTimeout)})];case 3:return[2,p.sent()]}})})},e.prototype.has=function(t){return typeof this._cache[t]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(t){var a=this,l=this._options.proxy;if(!l)throw new Error("No proxy defined");var n=t.substring(0,256);return new Promise(function(i,A){var p=ja.SUPPORT_RESPONSE_TYPE?"blob":"text",m=new XMLHttpRequest;m.onload=function(){if(m.status===200)if(p==="text")i(m.response);else{var y=new FileReader;y.addEventListener("load",function(){return i(y.result)},!1),y.addEventListener("error",function(v){return A(v)},!1),y.readAsDataURL(m.response)}else A("Failed to proxy resource "+n+" with status code "+m.status)},m.onerror=A;var _=l.indexOf("?")>-1?"&":"?";if(m.open("GET",""+l+_+"url="+encodeURIComponent(t)+"&responseType="+p),p!=="text"&&m instanceof XMLHttpRequest&&(m.responseType=p),a._options.imageTimeout){var g=a._options.imageTimeout;m.timeout=g,m.ontimeout=function(){return A("Timed out ("+g+"ms) proxying "+n)}}m.send()})},e}(),Mw=/^data:image\/svg\+xml/i,Lw=/^data:image\/.*;base64,/i,Rw=/^data:image\/.*/i,Ow=function(e){return ja.SUPPORT_SVG_DRAWING||!Hw(e)},tr=function(e){return Rw.test(e)},Pw=function(e){return Lw.test(e)},ar=function(e){return e.substr(0,4)==="blob"},Hw=function(e){return e.substr(-3).toLowerCase()==="svg"||Mw.test(e)},ut=function(){function e(t,a){this.type=0,this.x=t,this.y=a}return e.prototype.add=function(t,a){return new e(this.x+t,this.y+a)},e}(),Xs=function(e,t,a){return new ut(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},ho=function(){function e(t,a,l,n){this.type=1,this.start=t,this.startControl=a,this.endControl=l,this.end=n}return e.prototype.subdivide=function(t,a){var l=Xs(this.start,this.startControl,t),n=Xs(this.startControl,this.endControl,t),i=Xs(this.endControl,this.end,t),A=Xs(l,n,t),p=Xs(n,i,t),m=Xs(A,p,t);return a?new e(this.start,l,A,m):new e(m,p,i,this.end)},e.prototype.add=function(t,a){return new e(this.start.add(t,a),this.startControl.add(t,a),this.endControl.add(t,a),this.end.add(t,a))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),El=function(e){return e.type===1},Nw=function(){function e(t){var a=t.styles,l=t.bounds,n=$n(a.borderTopLeftRadius,l.width,l.height),i=n[0],A=n[1],p=$n(a.borderTopRightRadius,l.width,l.height),m=p[0],_=p[1],g=$n(a.borderBottomRightRadius,l.width,l.height),y=g[0],v=g[1],k=$n(a.borderBottomLeftRadius,l.width,l.height),b=k[0],w=k[1],B=[];B.push((i+m)/l.width),B.push((b+y)/l.width),B.push((A+w)/l.height),B.push((_+v)/l.height);var S=Math.max.apply(Math,B);S>1&&(i/=S,A/=S,m/=S,_/=S,y/=S,v/=S,b/=S,w/=S);var V=l.width-m,F=l.height-v,$=l.width-y,U=l.height-w,D=a.borderTopWidth,T=a.borderRightWidth,I=a.borderBottomWidth,L=a.borderLeftWidth,O=ya(a.paddingTop,t.bounds.width),Q=ya(a.paddingRight,t.bounds.width),H=ya(a.paddingBottom,t.bounds.width),K=ya(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||A>0?Ba(l.left+L/3,l.top+D/3,i-L/3,A-D/3,ua.TOP_LEFT):new ut(l.left+L/3,l.top+D/3),this.topRightBorderDoubleOuterBox=i>0||A>0?Ba(l.left+V,l.top+D/3,m-T/3,_-D/3,ua.TOP_RIGHT):new ut(l.left+l.width-T/3,l.top+D/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?Ba(l.left+$,l.top+F,y-T/3,v-I/3,ua.BOTTOM_RIGHT):new ut(l.left+l.width-T/3,l.top+l.height-I/3),this.bottomLeftBorderDoubleOuterBox=b>0||w>0?Ba(l.left+L/3,l.top+U,b-L/3,w-I/3,ua.BOTTOM_LEFT):new ut(l.left+L/3,l.top+l.height-I/3),this.topLeftBorderDoubleInnerBox=i>0||A>0?Ba(l.left+L*2/3,l.top+D*2/3,i-L*2/3,A-D*2/3,ua.TOP_LEFT):new ut(l.left+L*2/3,l.top+D*2/3),this.topRightBorderDoubleInnerBox=i>0||A>0?Ba(l.left+V,l.top+D*2/3,m-T*2/3,_-D*2/3,ua.TOP_RIGHT):new ut(l.left+l.width-T*2/3,l.top+D*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?Ba(l.left+$,l.top+F,y-T*2/3,v-I*2/3,ua.BOTTOM_RIGHT):new ut(l.left+l.width-T*2/3,l.top+l.height-I*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||w>0?Ba(l.left+L*2/3,l.top+U,b-L*2/3,w-I*2/3,ua.BOTTOM_LEFT):new ut(l.left+L*2/3,l.top+l.height-I*2/3),this.topLeftBorderStroke=i>0||A>0?Ba(l.left+L/2,l.top+D/2,i-L/2,A-D/2,ua.TOP_LEFT):new ut(l.left+L/2,l.top+D/2),this.topRightBorderStroke=i>0||A>0?Ba(l.left+V,l.top+D/2,m-T/2,_-D/2,ua.TOP_RIGHT):new ut(l.left+l.width-T/2,l.top+D/2),this.bottomRightBorderStroke=y>0||v>0?Ba(l.left+$,l.top+F,y-T/2,v-I/2,ua.BOTTOM_RIGHT):new ut(l.left+l.width-T/2,l.top+l.height-I/2),this.bottomLeftBorderStroke=b>0||w>0?Ba(l.left+L/2,l.top+U,b-L/2,w-I/2,ua.BOTTOM_LEFT):new ut(l.left+L/2,l.top+l.height-I/2),this.topLeftBorderBox=i>0||A>0?Ba(l.left,l.top,i,A,ua.TOP_LEFT):new ut(l.left,l.top),this.topRightBorderBox=m>0||_>0?Ba(l.left+V,l.top,m,_,ua.TOP_RIGHT):new ut(l.left+l.width,l.top),this.bottomRightBorderBox=y>0||v>0?Ba(l.left+$,l.top+F,y,v,ua.BOTTOM_RIGHT):new ut(l.left+l.width,l.top+l.height),this.bottomLeftBorderBox=b>0||w>0?Ba(l.left,l.top+U,b,w,ua.BOTTOM_LEFT):new ut(l.left,l.top+l.height),this.topLeftPaddingBox=i>0||A>0?Ba(l.left+L,l.top+D,Math.max(0,i-L),Math.max(0,A-D),ua.TOP_LEFT):new ut(l.left+L,l.top+D),this.topRightPaddingBox=m>0||_>0?Ba(l.left+Math.min(V,l.width-T),l.top+D,V>l.width+T?0:Math.max(0,m-T),Math.max(0,_-D),ua.TOP_RIGHT):new ut(l.left+l.width-T,l.top+D),this.bottomRightPaddingBox=y>0||v>0?Ba(l.left+Math.min($,l.width-L),l.top+Math.min(F,l.height-I),Math.max(0,y-T),Math.max(0,v-I),ua.BOTTOM_RIGHT):new ut(l.left+l.width-T,l.top+l.height-I),this.bottomLeftPaddingBox=b>0||w>0?Ba(l.left+L,l.top+Math.min(U,l.height-I),Math.max(0,b-L),Math.max(0,w-I),ua.BOTTOM_LEFT):new ut(l.left+L,l.top+l.height-I),this.topLeftContentBox=i>0||A>0?Ba(l.left+L+K,l.top+D+O,Math.max(0,i-(L+K)),Math.max(0,A-(D+O)),ua.TOP_LEFT):new ut(l.left+L+K,l.top+D+O),this.topRightContentBox=m>0||_>0?Ba(l.left+Math.min(V,l.width+L+K),l.top+D+O,V>l.width+L+K?0:m-L+K,_-(D+O),ua.TOP_RIGHT):new ut(l.left+l.width-(T+Q),l.top+D+O),this.bottomRightContentBox=y>0||v>0?Ba(l.left+Math.min($,l.width-(L+K)),l.top+Math.min(F,l.height+D+O),Math.max(0,y-(T+Q)),v-(I+H),ua.BOTTOM_RIGHT):new ut(l.left+l.width-(T+Q),l.top+l.height-(I+H)),this.bottomLeftContentBox=b>0||w>0?Ba(l.left+L+K,l.top+U,Math.max(0,b-(L+K)),w-(I+H),ua.BOTTOM_LEFT):new ut(l.left+L+K,l.top+l.height-(I+H))}return e}(),ua;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ua||(ua={}));var Ba=function(e,t,a,l,n){var i=4*((Math.sqrt(2)-1)/3),A=a*i,p=l*i,m=e+a,_=t+l;switch(n){case ua.TOP_LEFT:return new ho(new ut(e,_),new ut(e,_-p),new ut(m-A,t),new ut(m,t));case ua.TOP_RIGHT:return new ho(new ut(e,t),new ut(e+A,t),new ut(m,_-p),new ut(m,_));case ua.BOTTOM_RIGHT:return new ho(new ut(m,t),new ut(m,t+p),new ut(e+A,_),new ut(e,_));case ua.BOTTOM_LEFT:default:return new ho(new ut(m,_),new ut(m-A,_),new ut(e,t+p),new ut(e,t))}},qo=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Kw=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},Yo=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Gw=function(){function e(t,a,l){this.offsetX=t,this.offsetY=a,this.matrix=l,this.type=0,this.target=6}return e}(),_o=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),zw=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),jw=function(e){return e.type===0},Fp=function(e){return e.type===1},qw=function(e){return e.type===2},Ju=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},Yw=function(e,t,a,l,n){return e.map(function(i,A){switch(A){case 0:return i.add(t,a);case 1:return i.add(t+l,a);case 2:return i.add(t+l,a+n);case 3:return i.add(t,a+n)}return i})},Ep=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Up=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new Nw(this.container),this.container.styles.opacity<1&&this.effects.push(new zw(this.container.styles.opacity)),this.container.styles.transform!==null){var l=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new Gw(l,n,i))}if(this.container.styles.overflowX!==0){var A=qo(this.curves),p=Yo(this.curves);Ju(A,p)?this.effects.push(new _o(A,6)):(this.effects.push(new _o(A,2)),this.effects.push(new _o(p,4)))}}return e.prototype.getEffects=function(t){for(var a=[2,3].indexOf(this.container.styles.position)===-1,l=this.parent,n=this.effects.slice(0);l;){var i=l.effects.filter(function(m){return!Fp(m)});if(a||l.container.styles.position!==0||!l.parent){if(n.unshift.apply(n,i),a=[2,3].indexOf(l.container.styles.position)===-1,l.container.styles.overflowX!==0){var A=qo(l.curves),p=Yo(l.curves);Ju(A,p)||n.unshift(new _o(p,6))}}else n.unshift.apply(n,i);l=l.parent}return n.filter(function(m){return La(m.target,t)})},e}(),zr=function(e,t,a,l){e.container.elements.forEach(function(n){var i=La(n.flags,4),A=La(n.flags,2),p=new Up(n,e);La(n.styles.display,2048)&&l.push(p);var m=La(n.flags,8)?[]:l;if(i||A){var _=i||n.styles.isPositioned()?a:t,g=new Ep(p);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var y=n.styles.zIndex.order;if(y<0){var v=0;_.negativeZIndex.some(function(b,w){return y>b.element.container.styles.zIndex.order?(v=w,!1):v>0}),_.negativeZIndex.splice(v,0,g)}else if(y>0){var k=0;_.positiveZIndex.some(function(b,w){return y>=b.element.container.styles.zIndex.order?(k=w+1,!1):k>0}),_.positiveZIndex.splice(k,0,g)}else _.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else n.styles.isFloating()?_.nonPositionedFloats.push(g):_.nonPositionedInlineLevel.push(g);zr(p,g,i?g:a,m)}else n.styles.isInlineLevel()?t.inlineLevel.push(p):t.nonInlineLevel.push(p),zr(p,t,a,m);La(n.flags,8)&&Ip(n,m)})},Ip=function(e,t){for(var a=e instanceof Pr?e.start:1,l=e instanceof Pr?e.reversed:!1,n=0;n<t.length;n++){var i=t[n];i.container instanceof mp&&typeof i.container.value=="number"&&i.container.value!==0&&(a=i.container.value),i.listValue=Nn(a,i.container.styles.listStyleType,!0),a+=l?-1:1}},Ww=function(e){var t=new Up(e,null),a=new Ep(t),l=[];return zr(t,a,a,l),Ip(t.container,l),a},Xu=function(e,t){switch(t){case 0:return Vl(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return Vl(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return Vl(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return Vl(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Jw=function(e,t){switch(t){case 0:return Vl(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return Vl(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return Vl(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return Vl(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},Xw=function(e,t){switch(t){case 0:return Vl(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return Vl(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return Vl(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return Vl(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Zw=function(e,t){switch(t){case 0:return vo(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return vo(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return vo(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return vo(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},vo=function(e,t){var a=[];return El(e)?a.push(e.subdivide(.5,!1)):a.push(e),El(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},Vl=function(e,t,a,l){var n=[];return El(e)?n.push(e.subdivide(.5,!1)):n.push(e),El(a)?n.push(a.subdivide(.5,!0)):n.push(a),El(l)?n.push(l.subdivide(.5,!0).reverse()):n.push(l),El(t)?n.push(t.subdivide(.5,!1).reverse()):n.push(t),n},Vp=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},Wo=function(e){var t=e.styles,a=e.bounds,l=ya(t.paddingLeft,a.width),n=ya(t.paddingRight,a.width),i=ya(t.paddingTop,a.width),A=ya(t.paddingBottom,a.width);return a.add(l+t.borderLeftWidth,i+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+l+n),-(t.borderTopWidth+t.borderBottomWidth+i+A))},eC=function(e,t){return e===0?t.bounds:e===2?Wo(t):Vp(t)},tC=function(e,t){return e===0?t.bounds:e===2?Wo(t):Vp(t)},lr=function(e,t,a){var l=eC(an(e.styles.backgroundOrigin,t),e),n=tC(an(e.styles.backgroundClip,t),e),i=aC(an(e.styles.backgroundSize,t),a,l),A=i[0],p=i[1],m=$n(an(e.styles.backgroundPosition,t),l.width-A,l.height-p),_=lC(an(e.styles.backgroundRepeat,t),m,i,l,n),g=Math.round(l.left+m[0]),y=Math.round(l.top+m[1]);return[_,g,y,A,p]},Zs=function(e){return pa(e)&&e.value===rn.AUTO},go=function(e){return typeof e=="number"},aC=function(e,t,a){var l=t[0],n=t[1],i=t[2],A=e[0],p=e[1];if(!A)return[0,0];if(Ta(A)&&p&&Ta(p))return[ya(A,a.width),ya(p,a.height)];var m=go(i);if(pa(A)&&(A.value===rn.CONTAIN||A.value===rn.COVER)){if(go(i)){var _=a.width/a.height;return _<i!=(A.value===rn.COVER)?[a.width,a.width/i]:[a.height*i,a.height]}return[a.width,a.height]}var g=go(l),y=go(n),v=g||y;if(Zs(A)&&(!p||Zs(p))){if(g&&y)return[l,n];if(!m&&!v)return[a.width,a.height];if(v&&m){var k=g?l:n*i,b=y?n:l/i;return[k,b]}var w=g?l:a.width,B=y?n:a.height;return[w,B]}if(m){var S=0,V=0;return Ta(A)?S=ya(A,a.width):Ta(p)&&(V=ya(p,a.height)),Zs(A)?S=V*i:(!p||Zs(p))&&(V=S/i),[S,V]}var F=null,$=null;if(Ta(A)?F=ya(A,a.width):p&&Ta(p)&&($=ya(p,a.height)),F!==null&&(!p||Zs(p))&&($=g&&y?F/l*n:a.height),$!==null&&Zs(A)&&(F=g&&y?$/n*l:a.width),F!==null&&$!==null)return[F,$];throw new Error("Unable to calculate background-size for element")},an=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},lC=function(e,t,a,l,n){var i=t[0],A=t[1],p=a[0],m=a[1];switch(e){case 2:return[new ut(Math.round(l.left),Math.round(l.top+A)),new ut(Math.round(l.left+l.width),Math.round(l.top+A)),new ut(Math.round(l.left+l.width),Math.round(m+l.top+A)),new ut(Math.round(l.left),Math.round(m+l.top+A))];case 3:return[new ut(Math.round(l.left+i),Math.round(l.top)),new ut(Math.round(l.left+i+p),Math.round(l.top)),new ut(Math.round(l.left+i+p),Math.round(l.height+l.top)),new ut(Math.round(l.left+i),Math.round(l.height+l.top))];case 1:return[new ut(Math.round(l.left+i),Math.round(l.top+A)),new ut(Math.round(l.left+i+p),Math.round(l.top+A)),new ut(Math.round(l.left+i+p),Math.round(l.top+A+m)),new ut(Math.round(l.left+i),Math.round(l.top+A+m))];default:return[new ut(Math.round(n.left),Math.round(n.top)),new ut(Math.round(n.left+n.width),Math.round(n.top)),new ut(Math.round(n.left+n.width),Math.round(n.height+n.top)),new ut(Math.round(n.left),Math.round(n.height+n.top))]}},sC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Zu="Hidden Text",nC=function(){function e(t){this._data={},this._document=t}return e.prototype.parseMetrics=function(t,a){var l=this._document.createElement("div"),n=this._document.createElement("img"),i=this._document.createElement("span"),A=this._document.body;l.style.visibility="hidden",l.style.fontFamily=t,l.style.fontSize=a,l.style.margin="0",l.style.padding="0",l.style.whiteSpace="nowrap",A.appendChild(l),n.src=sC,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",i.style.fontFamily=t,i.style.fontSize=a,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(Zu)),l.appendChild(i),l.appendChild(n);var p=n.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(Zu)),l.style.lineHeight="normal",n.style.verticalAlign="super";var m=n.offsetTop-l.offsetTop+2;return A.removeChild(l),{baseline:p,middle:m}},e.prototype.getMetrics=function(t,a){var l=t+" "+a;return typeof this._data[l]>"u"&&(this._data[l]=this.parseMetrics(t,a)),this._data[l]},e}(),Dp=function(){function e(t,a){this.context=t,this.options=a}return e}(),oC=1e4,iC=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;return n._activeEffects=[],n.canvas=l.canvas?l.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),l.canvas||(n.canvas.width=Math.floor(l.width*l.scale),n.canvas.height=Math.floor(l.height*l.scale),n.canvas.style.width=l.width+"px",n.canvas.style.height=l.height+"px"),n.fontMetrics=new nC(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-l.x,-l.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+l.width+"x"+l.height+") with scale "+l.scale),n}return t.prototype.applyEffects=function(a){for(var l=this;this._activeEffects.length;)this.popEffect();a.forEach(function(n){return l.applyEffect(n)})},t.prototype.applyEffect=function(a){this.ctx.save(),qw(a)&&(this.ctx.globalAlpha=a.opacity),jw(a)&&(this.ctx.translate(a.offsetX,a.offsetY),this.ctx.transform(a.matrix[0],a.matrix[1],a.matrix[2],a.matrix[3],a.matrix[4],a.matrix[5]),this.ctx.translate(-a.offsetX,-a.offsetY)),Fp(a)&&(this.path(a.path),this.ctx.clip()),this._activeEffects.push(a)},t.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},t.prototype.renderStack=function(a){return rl(this,void 0,void 0,function(){var l;return sl(this,function(n){switch(n.label){case 0:return l=a.element.container.styles,l.isVisible()?[4,this.renderStackContent(a)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(a){return rl(this,void 0,void 0,function(){return sl(this,function(l){switch(l.label){case 0:if(La(a.container.flags,16))debugger;return a.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(a)]:[3,3];case 1:return l.sent(),[4,this.renderNodeContent(a)];case 2:l.sent(),l.label=3;case 3:return[2]}})})},t.prototype.renderTextWithLetterSpacing=function(a,l,n){var i=this;if(l===0)this.ctx.fillText(a.text,a.bounds.left,a.bounds.top+n);else{var A=Bd(a.text);A.reduce(function(p,m){return i.ctx.fillText(m,p,a.bounds.top+n),p+i.ctx.measureText(m).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var l=a.fontVariant.filter(function(A){return A==="normal"||A==="small-caps"}).join(""),n=AC(a.fontFamily).join(", "),i=zn(a.fontSize)?""+a.fontSize.number+a.fontSize.unit:a.fontSize.number+"px";return[[a.fontStyle,l,a.fontWeight,i,n].join(" "),n,i]},t.prototype.renderTextNode=function(a,l){return rl(this,void 0,void 0,function(){var n,i,A,p,m,_,g,y,v=this;return sl(this,function(k){return n=this.createFontStyle(l),i=n[0],A=n[1],p=n[2],this.ctx.font=i,this.ctx.direction=l.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",m=this.fontMetrics.getMetrics(A,p),_=m.baseline,g=m.middle,y=l.paintOrder,a.textBounds.forEach(function(b){y.forEach(function(w){switch(w){case 0:v.ctx.fillStyle=Na(l.color),v.renderTextWithLetterSpacing(b,l.letterSpacing,_);var B=l.textShadow;B.length&&b.text.trim().length&&(B.slice(0).reverse().forEach(function(S){v.ctx.shadowColor=Na(S.color),v.ctx.shadowOffsetX=S.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=S.offsetY.number*v.options.scale,v.ctx.shadowBlur=S.blur.number,v.renderTextWithLetterSpacing(b,l.letterSpacing,_)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),l.textDecorationLine.length&&(v.ctx.fillStyle=Na(l.textDecorationColor||l.color),l.textDecorationLine.forEach(function(S){switch(S){case 1:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+_),b.bounds.width,1);break;case 2:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:v.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+g),b.bounds.width,1);break}}));break;case 1:l.webkitTextStrokeWidth&&b.text.trim().length&&(v.ctx.strokeStyle=Na(l.webkitTextStrokeColor),v.ctx.lineWidth=l.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(b.text,b.bounds.left,b.bounds.top+_)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},t.prototype.renderReplacedElement=function(a,l,n){if(n&&a.intrinsicWidth>0&&a.intrinsicHeight>0){var i=Wo(a),A=Yo(l);this.path(A),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,a.intrinsicWidth,a.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(a){return rl(this,void 0,void 0,function(){var l,n,i,A,p,m,V,V,_,g,y,v,$,k,b,U,w,B,S,V,F,$,U;return sl(this,function(D){switch(D.label){case 0:this.applyEffects(a.getEffects(4)),l=a.container,n=a.curves,i=l.styles,A=0,p=l.textNodes,D.label=1;case 1:return A<p.length?(m=p[A],[4,this.renderTextNode(m,i)]):[3,4];case 2:D.sent(),D.label=3;case 3:return A++,[3,1];case 4:if(!(l instanceof Ap))return[3,8];D.label=5;case 5:return D.trys.push([5,7,,8]),[4,this.context.cache.match(l.src)];case 6:return V=D.sent(),this.renderReplacedElement(l,n,V),[3,8];case 7:return D.sent(),this.context.logger.error("Error loading image "+l.src),[3,8];case 8:if(l instanceof pp&&this.renderReplacedElement(l,n,l.canvas),!(l instanceof fp))return[3,12];D.label=9;case 9:return D.trys.push([9,11,,12]),[4,this.context.cache.match(l.svg)];case 10:return V=D.sent(),this.renderReplacedElement(l,n,V),[3,12];case 11:return D.sent(),this.context.logger.error("Error loading svg "+l.svg.substring(0,255)),[3,12];case 12:return l instanceof vp&&l.tree?(_=new t(this.context,{scale:this.options.scale,backgroundColor:l.backgroundColor,x:0,y:0,width:l.width,height:l.height}),[4,_.render(l.tree)]):[3,14];case 13:g=D.sent(),l.width&&l.height&&this.ctx.drawImage(g,0,0,l.width,l.height,l.bounds.left,l.bounds.top,l.bounds.width,l.bounds.height),D.label=14;case 14:if(l instanceof xd&&(y=Math.min(l.bounds.width,l.bounds.height),l.type===Ko?l.checked&&(this.ctx.save(),this.path([new ut(l.bounds.left+y*.39363,l.bounds.top+y*.79),new ut(l.bounds.left+y*.16,l.bounds.top+y*.5549),new ut(l.bounds.left+y*.27347,l.bounds.top+y*.44071),new ut(l.bounds.left+y*.39694,l.bounds.top+y*.5649),new ut(l.bounds.left+y*.72983,l.bounds.top+y*.23),new ut(l.bounds.left+y*.84,l.bounds.top+y*.34085),new ut(l.bounds.left+y*.39363,l.bounds.top+y*.79)]),this.ctx.fillStyle=Na(Ou),this.ctx.fill(),this.ctx.restore()):l.type===Go&&l.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(l.bounds.left+y/2,l.bounds.top+y/2,y/4,0,Math.PI*2,!0),this.ctx.fillStyle=Na(Ou),this.ctx.fill(),this.ctx.restore())),rC(l)&&l.value.length){switch(v=this.createFontStyle(i),$=v[0],k=v[1],b=this.fontMetrics.getMetrics($,k).baseline,this.ctx.font=$,this.ctx.fillStyle=Na(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=uC(l.styles.textAlign),U=Wo(l),w=0,l.styles.textAlign){case 1:w+=U.width/2;break;case 2:w+=U.width;break}B=U.add(w,0,0,-U.height/2+1),this.ctx.save(),this.path([new ut(U.left,U.top),new ut(U.left+U.width,U.top),new ut(U.left+U.width,U.top+U.height),new ut(U.left,U.top+U.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Tn(l.value,B),i.letterSpacing,b),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!La(l.styles.display,2048))return[3,20];if(l.styles.listStyleImage===null)return[3,19];if(S=l.styles.listStyleImage,S.type!==0)return[3,18];V=void 0,F=S.url,D.label=15;case 15:return D.trys.push([15,17,,18]),[4,this.context.cache.match(F)];case 16:return V=D.sent(),this.ctx.drawImage(V,l.bounds.left-(V.width+10),l.bounds.top),[3,18];case 17:return D.sent(),this.context.logger.error("Error loading list-style-image "+F),[3,18];case 18:return[3,20];case 19:a.listValue&&l.styles.listStyleType!==-1&&($=this.createFontStyle(i)[0],this.ctx.font=$,this.ctx.fillStyle=Na(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",U=new is(l.bounds.left,l.bounds.top+ya(l.styles.paddingTop,l.bounds.width),l.bounds.width,Cu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Tn(a.listValue,U),i.letterSpacing,Cu(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),D.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(a){return rl(this,void 0,void 0,function(){var l,n,S,i,A,S,p,m,S,_,g,S,y,v,S,k,b,S,w,B,S;return sl(this,function(V){switch(V.label){case 0:if(La(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:V.sent(),l=0,n=a.negativeZIndex,V.label=2;case 2:return l<n.length?(S=n[l],[4,this.renderStack(S)]):[3,5];case 3:V.sent(),V.label=4;case 4:return l++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:V.sent(),i=0,A=a.nonInlineLevel,V.label=7;case 7:return i<A.length?(S=A[i],[4,this.renderNode(S)]):[3,10];case 8:V.sent(),V.label=9;case 9:return i++,[3,7];case 10:p=0,m=a.nonPositionedFloats,V.label=11;case 11:return p<m.length?(S=m[p],[4,this.renderStack(S)]):[3,14];case 12:V.sent(),V.label=13;case 13:return p++,[3,11];case 14:_=0,g=a.nonPositionedInlineLevel,V.label=15;case 15:return _<g.length?(S=g[_],[4,this.renderStack(S)]):[3,18];case 16:V.sent(),V.label=17;case 17:return _++,[3,15];case 18:y=0,v=a.inlineLevel,V.label=19;case 19:return y<v.length?(S=v[y],[4,this.renderNode(S)]):[3,22];case 20:V.sent(),V.label=21;case 21:return y++,[3,19];case 22:k=0,b=a.zeroOrAutoZIndexOrTransformedOrOpacity,V.label=23;case 23:return k<b.length?(S=b[k],[4,this.renderStack(S)]):[3,26];case 24:V.sent(),V.label=25;case 25:return k++,[3,23];case 26:w=0,B=a.positiveZIndex,V.label=27;case 27:return w<B.length?(S=B[w],[4,this.renderStack(S)]):[3,30];case 28:V.sent(),V.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},t.prototype.mask=function(a){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(a.slice(0).reverse()),this.ctx.closePath()},t.prototype.path=function(a){this.ctx.beginPath(),this.formatPath(a),this.ctx.closePath()},t.prototype.formatPath=function(a){var l=this;a.forEach(function(n,i){var A=El(n)?n.start:n;i===0?l.ctx.moveTo(A.x,A.y):l.ctx.lineTo(A.x,A.y),El(n)&&l.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},t.prototype.renderRepeat=function(a,l,n,i){this.path(a),this.ctx.fillStyle=l,this.ctx.translate(n,i),this.ctx.fill(),this.ctx.translate(-n,-i)},t.prototype.resizeImage=function(a,l,n){var i;if(a.width===l&&a.height===n)return a;var A=(i=this.canvas.ownerDocument)!==null&&i!==void 0?i:document,p=A.createElement("canvas");p.width=Math.max(1,l),p.height=Math.max(1,n);var m=p.getContext("2d");return m.drawImage(a,0,0,a.width,a.height,0,0,l,n),p},t.prototype.renderBackgroundImage=function(a){return rl(this,void 0,void 0,function(){var l,n,i,A,p,m;return sl(this,function(_){switch(_.label){case 0:l=a.styles.backgroundImage.length-1,n=function(g){var y,v,k,O,Y,Z,K,W,I,b,O,Y,Z,K,W,w,B,S,V,F,$,U,D,T,I,L,O,Q,H,K,W,z,Y,Z,re,q,Ae,ie,J,N,le,ee;return sl(this,function(pe){switch(pe.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,pe.label=1;case 1:return pe.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return y=pe.sent(),[3,4];case 3:return pe.sent(),i.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(k=lr(a,l,[y.width,y.height,y.width/y.height]),O=k[0],Y=k[1],Z=k[2],K=k[3],W=k[4],I=i.ctx.createPattern(i.resizeImage(y,K,W),"repeat"),i.renderRepeat(O,I,Y,Z)),[3,6];case 5:j1(g)?(b=lr(a,l,[null,null,null]),O=b[0],Y=b[1],Z=b[2],K=b[3],W=b[4],w=H1(g.angle,K,W),B=w[0],S=w[1],V=w[2],F=w[3],$=w[4],U=document.createElement("canvas"),U.width=K,U.height=W,D=U.getContext("2d"),T=D.createLinearGradient(S,F,V,$),bu(g.stops,B).forEach(function(de){return T.addColorStop(de.stop,Na(de.color))}),D.fillStyle=T,D.fillRect(0,0,K,W),K>0&&W>0&&(I=i.ctx.createPattern(U,"repeat"),i.renderRepeat(O,I,Y,Z))):q1(g)&&(L=lr(a,l,[null,null,null]),O=L[0],Q=L[1],H=L[2],K=L[3],W=L[4],z=g.position.length===0?[wd]:g.position,Y=ya(z[0],K),Z=ya(z[z.length-1],W),re=N1(g,Y,Z,K,W),q=re[0],Ae=re[1],q>0&&Ae>0&&(ie=i.ctx.createRadialGradient(Q+Y,H+Z,0,Q+Y,H+Z,q),bu(g.stops,q*2).forEach(function(de){return ie.addColorStop(de.stop,Na(de.color))}),i.path(O),i.ctx.fillStyle=ie,q!==Ae?(J=a.bounds.left+.5*a.bounds.width,N=a.bounds.top+.5*a.bounds.height,le=Ae/q,ee=1/le,i.ctx.save(),i.ctx.translate(J,N),i.ctx.transform(1,0,0,le,0,0),i.ctx.translate(-J,-N),i.ctx.fillRect(Q,ee*(H-N)+N,K,W*ee),i.ctx.restore()):i.ctx.fill())),pe.label=6;case 6:return l--,[2]}})},i=this,A=0,p=a.styles.backgroundImage.slice(0).reverse(),_.label=1;case 1:return A<p.length?(m=p[A],[5,n(m)]):[3,4];case 2:_.sent(),_.label=3;case 3:return A++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(a,l,n){return rl(this,void 0,void 0,function(){return sl(this,function(i){return this.path(Xu(n,l)),this.ctx.fillStyle=Na(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,l,n,i){return rl(this,void 0,void 0,function(){var A,p;return sl(this,function(m){switch(m.label){case 0:return l<3?[4,this.renderSolidBorder(a,n,i)]:[3,2];case 1:return m.sent(),[2];case 2:return A=Jw(i,n),this.path(A),this.ctx.fillStyle=Na(a),this.ctx.fill(),p=Xw(i,n),this.path(p),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return rl(this,void 0,void 0,function(){var l,n,i,A,p,m,_,g,y=this;return sl(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),l=a.container.styles,n=!ks(l.backgroundColor)||l.backgroundImage.length,i=[{style:l.borderTopStyle,color:l.borderTopColor,width:l.borderTopWidth},{style:l.borderRightStyle,color:l.borderRightColor,width:l.borderRightWidth},{style:l.borderBottomStyle,color:l.borderBottomColor,width:l.borderBottomWidth},{style:l.borderLeftStyle,color:l.borderLeftColor,width:l.borderLeftWidth}],A=dC(an(l.backgroundClip,0),a.curves),n||l.boxShadow.length?(this.ctx.save(),this.path(A),this.ctx.clip(),ks(l.backgroundColor)||(this.ctx.fillStyle=Na(l.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(a.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),l.boxShadow.slice(0).reverse().forEach(function(k){y.ctx.save();var b=qo(a.curves),w=k.inset?0:oC,B=Yw(b,-w+(k.inset?1:-1)*k.spread.number,(k.inset?1:-1)*k.spread.number,k.spread.number*(k.inset?-2:2),k.spread.number*(k.inset?-2:2));k.inset?(y.path(b),y.ctx.clip(),y.mask(B)):(y.mask(b),y.ctx.clip(),y.path(B)),y.ctx.shadowOffsetX=k.offsetX.number+w,y.ctx.shadowOffsetY=k.offsetY.number,y.ctx.shadowColor=Na(k.color),y.ctx.shadowBlur=k.blur.number,y.ctx.fillStyle=k.inset?Na(k.color):"rgba(0,0,0,1)",y.ctx.fill(),y.ctx.restore()}),v.label=2;case 2:p=0,m=0,_=i,v.label=3;case 3:return m<_.length?(g=_[m],g.style!==0&&!ks(g.color)&&g.width>0?g.style!==2?[3,5]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return g.style!==3?[3,7]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,3)];case 6:return v.sent(),[3,11];case 7:return g.style!==4?[3,9]:[4,this.renderDoubleBorder(g.color,g.width,p,a.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(g.color,p,a.curves)];case 10:v.sent(),v.label=11;case 11:p++,v.label=12;case 12:return m++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,l,n,i,A){return rl(this,void 0,void 0,function(){var p,m,_,g,y,v,k,b,w,B,S,V,F,$,U,D,U,D;return sl(this,function(T){return this.ctx.save(),p=Zw(i,n),m=Xu(i,n),A===2&&(this.path(m),this.ctx.clip()),El(m[0])?(_=m[0].start.x,g=m[0].start.y):(_=m[0].x,g=m[0].y),El(m[1])?(y=m[1].end.x,v=m[1].end.y):(y=m[1].x,v=m[1].y),n===0||n===2?k=Math.abs(_-y):k=Math.abs(g-v),this.ctx.beginPath(),A===3?this.formatPath(p):this.formatPath(m.slice(0,2)),b=l<3?l*3:l*2,w=l<3?l*2:l,A===3&&(b=l,w=l),B=!0,k<=b*2?B=!1:k<=b*2+w?(S=k/(2*b+w),b*=S,w*=S):(V=Math.floor((k+w)/(b+w)),F=(k-V*b)/(V-1),$=(k-(V+1)*b)/V,w=$<=0||Math.abs(w-F)<Math.abs(w-$)?F:$),B&&(A===3?this.ctx.setLineDash([0,b+w]):this.ctx.setLineDash([b,w])),A===3?(this.ctx.lineCap="round",this.ctx.lineWidth=l):this.ctx.lineWidth=l*2+1.1,this.ctx.strokeStyle=Na(a),this.ctx.stroke(),this.ctx.setLineDash([]),A===2&&(El(m[0])&&(U=m[3],D=m[0],this.ctx.beginPath(),this.formatPath([new ut(U.end.x,U.end.y),new ut(D.start.x,D.start.y)]),this.ctx.stroke()),El(m[1])&&(U=m[1],D=m[2],this.ctx.beginPath(),this.formatPath([new ut(U.end.x,U.end.y),new ut(D.start.x,D.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return rl(this,void 0,void 0,function(){var l;return sl(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Na(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),l=Ww(a),[4,this.renderStack(l)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(Dp),rC=function(e){return e instanceof _p||e instanceof hp?!0:e instanceof xd&&e.type!==Go&&e.type!==Ko},dC=function(e,t){switch(e){case 0:return qo(t);case 2:return Kw(t);case 1:default:return Yo(t)}},uC=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},cC=["-apple-system","system-ui"],AC=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return cC.indexOf(t)===-1}):e},pC=function(e){Pl(t,e);function t(a,l){var n=e.call(this,a,l)||this;return n.canvas=l.canvas?l.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=l,n.canvas.width=Math.floor(l.width*l.scale),n.canvas.height=Math.floor(l.height*l.scale),n.canvas.style.width=l.width+"px",n.canvas.style.height=l.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-l.x,-l.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+l.width+"x"+l.height+" at "+l.x+","+l.y+") with scale "+l.scale),n}return t.prototype.render=function(a){return rl(this,void 0,void 0,function(){var l,n;return sl(this,function(i){switch(i.label){case 0:return l=Or(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,fC(l)];case 1:return n=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Na(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},t}(Dp),fC=function(e){return new Promise(function(t,a){var l=new Image;l.onload=function(){t(l)},l.onerror=a,l.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},mC=function(){function e(t){var a=t.id,l=t.enabled;this.id=a,this.enabled=l,this.start=Date.now()}return e.prototype.debug=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Wn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.getTime=function(){return Date.now()-this.start},e.prototype.info=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Wn([this.id,this.getTime()+"ms"],t))},e.prototype.warn=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Wn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.error=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Wn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),hC=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new mC({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new Qw(this,t)}return e.instanceCount=1,e}(),_C=function(e,t){return t===void 0&&(t={}),vC(e,t)};typeof window<"u"&&$p.setContext(window);var vC=function(e,t){return rl(void 0,void 0,void 0,function(){var a,l,n,i,A,p,m,_,g,y,v,k,b,w,B,S,V,F,$,U,T,D,T,I,L,O,Q,H,K,W,z,Y,Z,re,q,Ae,ie,J,N,le;return sl(this,function(ee){switch(ee.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(a=e.ownerDocument,!a)throw new Error("Element is not attached to a Document");if(l=a.defaultView,!l)throw new Error("Document is not attached to a Window");return n={allowTaint:(I=t.allowTaint)!==null&&I!==void 0?I:!1,imageTimeout:(L=t.imageTimeout)!==null&&L!==void 0?L:15e3,proxy:t.proxy,useCORS:(O=t.useCORS)!==null&&O!==void 0?O:!1},i=Br({logging:(Q=t.logging)!==null&&Q!==void 0?Q:!0,cache:t.cache},n),A={windowWidth:(H=t.windowWidth)!==null&&H!==void 0?H:l.innerWidth,windowHeight:(K=t.windowHeight)!==null&&K!==void 0?K:l.innerHeight,scrollX:(W=t.scrollX)!==null&&W!==void 0?W:l.pageXOffset,scrollY:(z=t.scrollY)!==null&&z!==void 0?z:l.pageYOffset},p=new is(A.scrollX,A.scrollY,A.windowWidth,A.windowHeight),m=new hC(i,p),_=(Y=t.foreignObjectRendering)!==null&&Y!==void 0?Y:!1,g={allowTaint:(Z=t.allowTaint)!==null&&Z!==void 0?Z:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:_,copyStyles:_},m.logger.debug("Starting document clone with size "+p.width+"x"+p.height+" scrolled to "+-p.left+","+-p.top),y=new Yu(m,e,g),v=y.clonedReferenceElement,v?[4,y.toIFrame(a,p)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return k=ee.sent(),b=Sd(v)||gw(v)?Yg(v.ownerDocument):vi(m,v),w=b.width,B=b.height,S=b.left,V=b.top,F=gC(m,v,t.backgroundColor),$={canvas:t.canvas,backgroundColor:F,scale:(q=(re=t.scale)!==null&&re!==void 0?re:l.devicePixelRatio)!==null&&q!==void 0?q:1,x:((Ae=t.x)!==null&&Ae!==void 0?Ae:0)+S,y:((ie=t.y)!==null&&ie!==void 0?ie:0)+V,width:(J=t.width)!==null&&J!==void 0?J:Math.ceil(w),height:(N=t.height)!==null&&N!==void 0?N:Math.ceil(B)},_?(m.logger.debug("Document cloned, using foreign object rendering"),T=new pC(m,$),[4,T.render(v)]):[3,3];case 2:return U=ee.sent(),[3,5];case 3:return m.logger.debug("Document cloned, element located at "+S+","+V+" with size "+w+"x"+B+" using computed rendering"),m.logger.debug("Starting DOM parsing"),D=yp(m,v),F===D.styles.backgroundColor&&(D.styles.backgroundColor=ls.TRANSPARENT),m.logger.debug("Starting renderer for element at "+$.x+","+$.y+" with size "+$.width+"x"+$.height),T=new iC(m,$),[4,T.render(D)];case 4:U=ee.sent(),ee.label=5;case 5:return(!((le=t.removeContainer)!==null&&le!==void 0)||le)&&(Yu.destroy(k)||m.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),m.logger.debug("Finished rendering"),[2,U]}})})},gC=function(e,t,a){var l=t.ownerDocument,n=l.documentElement?Vn(e,getComputedStyle(l.documentElement).backgroundColor):ls.TRANSPARENT,i=l.body?Vn(e,getComputedStyle(l.body).backgroundColor):ls.TRANSPARENT,A=typeof a=="string"?Vn(e,a):a===null?ls.TRANSPARENT:4294967295;return t===l.documentElement?ks(n)?ks(i)?A:i:n:A};const Ea={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef&&_C(a.targetRef,{useCORS:!0,scale:2,backgroundColor:null,scrollY:-window.scrollY}).then(n=>{const i=document.createElement("a");i.download="chart-screenshot.png",i.href=n.toDataURL(),i.click()})},a=e;return(l,n)=>(r(),E(tt,{tag:"button",onClick:t,size:e.size,title:l.$t("Screenshot")},{default:u(()=>[s(X,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var sr={exports:{}};/** @license |
| 23 |
* |
| 24 |
* Colour Palette Generator script. |
| 25 |
* Copyright (c) 2014 Google Inc. |
| 26 |
* |
| 27 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 28 |
* not use this file except in compliance with the License. You may |
| 29 |
* obtain a copy of the License at |
| 30 |
* |
| 31 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 32 |
* |
| 33 |
* Unless required by applicable law or agreed to in writing, software |
| 34 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 35 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 36 |
* implied. See the License for the specific language governing |
| 37 |
* permissions and limitations under the License. |
| 38 |
* |
| 39 |
* Furthermore, ColorBrewer colour schemes are covered by the following: |
| 40 |
* |
| 41 |
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and |
| 42 |
* The Pennsylvania State University. |
| 43 |
* |
| 44 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 45 |
* not use this file except in compliance with the License. You may obtain |
| 46 |
* a copy of the License at |
| 47 |
* |
| 48 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 49 |
* |
| 50 |
* Unless required by applicable law or agreed to in writing, software |
| 51 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 52 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 53 |
* implied. See the License for the specific language governing |
| 54 |
* permissions and limitations under the License. |
| 55 |
* |
| 56 |
* Redistribution and use in source and binary forms, with or without |
| 57 |
* modification, are permitted provided that the following conditions are |
| 58 |
* met: |
| 59 |
* |
| 60 |
* 1. Redistributions as source code must retain the above copyright |
| 61 |
* notice, this list of conditions and the following disclaimer. |
| 62 |
* |
| 63 |
* 2. The end-user documentation included with the redistribution, if any, |
| 64 |
* must include the following acknowledgment: "This product includes color |
| 65 |
* specifications and designs developed by Cynthia Brewer |
| 66 |
* (http://colorbrewer.org/)." Alternately, this acknowledgment may appear |
| 67 |
* in the software itself, if and wherever such third-party |
| 68 |
* acknowledgments normally appear. |
| 69 |
* |
| 70 |
* 4. The name "ColorBrewer" must not be used to endorse or promote products |
| 71 |
* derived from this software without prior written permission. For written |
| 72 |
* permission, please contact Cynthia Brewer at [email protected]. |
| 73 |
* |
| 74 |
* 5. Products derived from this software may not be called "ColorBrewer", |
| 75 |
* nor may "ColorBrewer" appear in their name, without prior written |
| 76 |
* permission of Cynthia Brewer. |
| 77 |
* |
| 78 |
* Furthermore, Solarized colour schemes are covered by the following: |
| 79 |
* |
| 80 |
* Copyright (c) 2011 Ethan Schoonover |
| 81 |
* |
| 82 |
* Permission is hereby granted, free of charge, to any person obtaining |
| 83 |
* a copy of this software and associated documentation files (the |
| 84 |
* "Software"), to deal in the Software without restriction, including |
| 85 |
* without limitation the rights to use, copy, modify, merge, publish, |
| 86 |
* distribute, sublicense, and/or sell copies of the Software, and to |
| 87 |
* permit persons to whom the Software is furnished to do so, subject to |
| 88 |
* the following conditions: |
| 89 |
* |
| 90 |
* The above copyright notice and this permission notice shall be included |
| 91 |
* in all copies or substantial portions of the Software. |
| 92 |
* |
| 93 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 94 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 95 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 96 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 97 |
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 98 |
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 99 |
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 100 |
*/var ec;function yC(){return ec||(ec=1,function(e){var t=function(){var a=Array.prototype,l=function(_,g,y){return a.slice.apply(_,a.slice.call(arguments,1))},n="function",i=1e9,A=function(_,g,y,v){if(g|=0,g==0)return[];if(typeof _!==n){var k=A.listSchemes(_,g);if(!k.length)return null;_=k[(y||0)%k.length]}var b=l(arguments,2);return b[0]=g,_.apply(_,b)};A.Scheme=function(_,g){var y={},v=0,k=i,b=function(){if(arguments.length<=1)return w.color_func.bind(w);var B=l(arguments);return function(S){return B[0]=S,w.color_func.apply(w,B)}},w=function(B,S){if(B|=0,!B)return[];var V=B;if(B=Math.abs(B),B<=v){for(var F=Math.max(B,k);!(F in y);++F);var $=y[F];if(F>B){var U="shrinking_takes_head"in $?$.shrinking_takes_head:w.shrinking_takes_head;if(U)$=$.slice(0,B),F=B;else return A.generate(function(D){return $[Math.round(D)]},V,0,$.length-1)}return $=$.slice(),V<0&&$.reverse(),$}else return w.color_func?A.generate(b.apply(w,arguments),V,0,1,w.color_func_cyclic):null};return w.scheme_name=_,w.groups=g?typeof g=="string"?[g]:g:[],w.max=0,w.cbf_max=i,w.addPalette=function(B,S){var V=B.length;V&&(y[V]=B,k=Math.min(k,V),v=Math.max(v,V),w.max=Math.max(w.max,V),!S&&V!=1&&(w.cbf_max=Math.min(w.cbf_max,V-1)))},w.addPalettes=function(B,S,V){S=S||B.length;for(var F=0;F<S;++F)F in B&&w.addPalette(B[F],!0);w.cbf_max=Math.min(w.cbf_max,V||1)},w.shrinkByTakingHead=function(B,S){S!==void 0?S in y&&(y[S].shrinking_takes_head=!!B):w.shrinking_takes_head=!!B},w.setColorFunction=function(B,S,V){w.color_func=B,w.color_func_cyclic=!!V,w.max=i,!S&&w.cbf_max===i&&(w.cbf_max=1)},w.color=function(B,S){return w.color_func?w.color_func.apply(this,arguments):null},w},A.Scheme.fromPalettes=function(_,g,y,v,k){var b=A.Scheme(_,g);return b.addPalettes.apply(b,l(arguments,2)),b},A.Scheme.withColorFunction=function(_,g,y,v,k){var b=A.Scheme(_,g);return b.setColorFunction.apply(b,l(arguments,2)),b};var p={};A.register=function(_){p["n-"+_.scheme_name]=[_],_.groups.forEach(function(g){(p["g-"+g]=p["g-"+g]||[]).push(_)}),(p["g-all"]=p["g-all"]||[]).push(_)},A.listSchemes=function(_,g){g?g<0&&(g=-g):g=2;var y=[];return(typeof _=="string"?[_]:_).forEach(function(v){var k=v.substring(v.length-4)==="-cbf";k&&(v=v.substring(0,v.length-4));for(var b=p["g-"+v]||p["n-"+v]||[],w=0,B;B=b[w];++w)(k?B.cbf:B.max)>=g&&y.push(B)}),y.sort(function(v,k){return v.scheme_name>=k.scheme_name?v.scheme_name>k.scheme_name?1:0:-1}),y},A.generate=function(_,g,y,v,k){if(Math.abs(g)<1)return[];if(y=y===void 0?0:y,v=v===void 0?1:v,Math.abs(g)<2)return[_(y)];for(var b=Math.abs(g),w=y,B=[],S=(v-y)/(k?b:b-1);--b>=0;w+=S)B.push(_(w));return g<0&&B.reverse(),B};var m=function(_){return _>0?_<1?_:1:0};return A.rgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=Number(Math.round(m(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},A.linearRgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=m(v),v<=.0031308?v=12.92*v:v=1.055*Math.pow(v,.4166666666666667)-.055,v=Number(Math.round(v*255)).toString(16),v.length==1?"0"+v:v}).join("")},A.hsvColor=function(_,g,y){_*=6;var v=g===void 0?1:m(g),k=y===void 0?1:m(y),b=k*(1-v*Math.abs(_%2-1)),w=k*(1-v);switch(Math.floor(_)%6){case 0:return A.rgbColor(k,b,w);case 1:return A.rgbColor(b,k,w);case 2:return A.rgbColor(w,k,b);case 3:return A.rgbColor(w,b,k);case 4:return A.rgbColor(b,w,k);default:return A.rgbColor(k,w,b)}},A.register(A.Scheme.withColorFunction("rainbow","qualitative",A.hsvColor,!1,!0)),A}();t.ColorFunction,t.Palette,t.PalettesList,t.SchemeType,function(){var a=t.Scheme.fromPalettes("mpn65","qualitative",[["ff0029","377eb8","66a61e","984ea3","00d2d5","ff7f00","af8d00","7f80cd","b3e900","c42e60","a65628","f781bf","8dd3c7","bebada","fb8072","80b1d3","fdb462","fccde5","bc80bd","ffed6f","c4eaff","cf8c00","1b9e77","d95f02","e7298a","e6ab02","a6761d","0097ff","00d067","000000","252525","525252","737373","969696","bdbdbd","f43600","4ba93b","5779bb","927acc","97ee3f","bf3947","9f5b00","f48758","8caed6","f2b94f","eff26e","e43872","d9b100","9d7a00","698cff","d9d9d9","00d27e","d06800","009f82","c49200","cbe8ff","fecddf","c27eb6","8cd2ce","c4b8d9","f883b0","a49100","f48800","27d0df","a04a9b"]]);a.shrinkByTakingHead(!0),t.register(a)}(),function(){var a=t.rgbColor,l=function(i,A){for(var p=arguments.length-1,m=arguments[p];p>1;)m=m*i+arguments[--p];return m},n=function(i){var A=l(Math.abs(i),1,.278393,.230389,972e-6,.078108);return A*=A,A*=A,A=1-1/A,i<0?-A:A};t.register(t.Scheme.fromPalettes("tol","qualitative",[["4477aa"],["4477aa","cc6677"],["4477aa","ddcc77","cc6677"],["4477aa","117733","ddcc77","cc6677"],["332288","88ccee","117733","ddcc77","cc6677"],["332288","88ccee","117733","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","cc6677","882255","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","882255","aa4499"],["332288","6699cc","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","882255","aa4499"],["332288","6699cc","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","aa4466","882255","aa4499"]],12,12)),t.tolSequentialColor=function(i){return a(1-.392*(1+n((i-.869)/.255)),1.021-.456*(1+n((i-.527)/.376)),1-.493*(1+n((i-.272)/.309)))},t.register(t.Scheme.withColorFunction("tol-sq","sequential",t.tolSequentialColor,!0)),t.tolDivergingColor=function(i){var A=l(i,.572,1.524,-1.811)/l(i,1,-.291,.1574);return a(l(i,.235,-2.13,26.92,-65.5,63.5,-22.36),A*A,1/l(i,1.579,-4.03,12.92,-31.4,48.6,-23.36))},t.register(t.Scheme.withColorFunction("tol-dv","diverging",t.tolDivergingColor,!0)),t.tolRainbowColor=function(i){return a(l(i,.472,-.567,4.05)/l(i,1,8.72,-19.17,14.1),l(i,.108932,-1.22635,27.284,-98.577,163.3,-131.395,40.634),1/l(i,1.97,3.54,-68.5,243,-297,125))},t.register(t.Scheme.withColorFunction("tol-rainbow","qualitative",t.tolRainbowColor,!0))}(),function(){t.register(t.Scheme.fromPalettes("sol-base","sequential",[["002b36","073642","586e75","657b83","839496","93a1a1","eee8d5","fdf6e3"]],1,8)),t.register(t.Scheme.fromPalettes("sol-accent","qualitative",[["b58900","cb4b16","dc322f","d33682","6c71c4","268bd2","2aa198","859900"]]))}(),function(){var a={YlGn:{type:"sequential",cbf:42,3:["f7fcb9","addd8e","31a354"],4:["ffffcc","c2e699","78c679","238443"],5:["ffffcc","c2e699","78c679","31a354","006837"],6:["ffffcc","d9f0a3","addd8e","78c679","31a354","006837"],7:["ffffcc","d9f0a3","addd8e","78c679","41ab5d","238443","005a32"],8:["ffffe5","f7fcb9","d9f0a3","addd8e","78c679","41ab5d","238443","005a32"],9:["ffffe5","f7fcb9","d9f0a3","addd8e","78c679","41ab5d","238443","006837","004529"]},YlGnBu:{type:"sequential",cbf:42,3:["edf8b1","7fcdbb","2c7fb8"],4:["ffffcc","a1dab4","41b6c4","225ea8"],5:["ffffcc","a1dab4","41b6c4","2c7fb8","253494"],6:["ffffcc","c7e9b4","7fcdbb","41b6c4","2c7fb8","253494"],7:["ffffcc","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","0c2c84"],8:["ffffd9","edf8b1","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","0c2c84"],9:["ffffd9","edf8b1","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","253494","081d58"]},GnBu:{type:"sequential",cbf:42,3:["e0f3db","a8ddb5","43a2ca"],4:["f0f9e8","bae4bc","7bccc4","2b8cbe"],5:["f0f9e8","bae4bc","7bccc4","43a2ca","0868ac"],6:["f0f9e8","ccebc5","a8ddb5","7bccc4","43a2ca","0868ac"],7:["f0f9e8","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","08589e"],8:["f7fcf0","e0f3db","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","08589e"],9:["f7fcf0","e0f3db","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","0868ac","084081"]},BuGn:{type:"sequential",cbf:42,3:["e5f5f9","99d8c9","2ca25f"],4:["edf8fb","b2e2e2","66c2a4","238b45"],5:["edf8fb","b2e2e2","66c2a4","2ca25f","006d2c"],6:["edf8fb","ccece6","99d8c9","66c2a4","2ca25f","006d2c"],7:["edf8fb","ccece6","99d8c9","66c2a4","41ae76","238b45","005824"],8:["f7fcfd","e5f5f9","ccece6","99d8c9","66c2a4","41ae76","238b45","005824"],9:["f7fcfd","e5f5f9","ccece6","99d8c9","66c2a4","41ae76","238b45","006d2c","00441b"]},PuBuGn:{type:"sequential",cbf:42,3:["ece2f0","a6bddb","1c9099"],4:["f6eff7","bdc9e1","67a9cf","02818a"],5:["f6eff7","bdc9e1","67a9cf","1c9099","016c59"],6:["f6eff7","d0d1e6","a6bddb","67a9cf","1c9099","016c59"],7:["f6eff7","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016450"],8:["fff7fb","ece2f0","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016450"],9:["fff7fb","ece2f0","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016c59","014636"]},PuBu:{type:"sequential",cbf:42,3:["ece7f2","a6bddb","2b8cbe"],4:["f1eef6","bdc9e1","74a9cf","0570b0"],5:["f1eef6","bdc9e1","74a9cf","2b8cbe","045a8d"],6:["f1eef6","d0d1e6","a6bddb","74a9cf","2b8cbe","045a8d"],7:["f1eef6","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","034e7b"],8:["fff7fb","ece7f2","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","034e7b"],9:["fff7fb","ece7f2","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","045a8d","023858"]},BuPu:{type:"sequential",cbf:42,3:["e0ecf4","9ebcda","8856a7"],4:["edf8fb","b3cde3","8c96c6","88419d"],5:["edf8fb","b3cde3","8c96c6","8856a7","810f7c"],6:["edf8fb","bfd3e6","9ebcda","8c96c6","8856a7","810f7c"],7:["edf8fb","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","6e016b"],8:["f7fcfd","e0ecf4","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","6e016b"],9:["f7fcfd","e0ecf4","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","810f7c","4d004b"]},RdPu:{type:"sequential",cbf:42,3:["fde0dd","fa9fb5","c51b8a"],4:["feebe2","fbb4b9","f768a1","ae017e"],5:["feebe2","fbb4b9","f768a1","c51b8a","7a0177"],6:["feebe2","fcc5c0","fa9fb5","f768a1","c51b8a","7a0177"],7:["feebe2","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177"],8:["fff7f3","fde0dd","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177"],9:["fff7f3","fde0dd","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177","49006a"]},PuRd:{type:"sequential",cbf:42,3:["e7e1ef","c994c7","dd1c77"],4:["f1eef6","d7b5d8","df65b0","ce1256"],5:["f1eef6","d7b5d8","df65b0","dd1c77","980043"],6:["f1eef6","d4b9da","c994c7","df65b0","dd1c77","980043"],7:["f1eef6","d4b9da","c994c7","df65b0","e7298a","ce1256","91003f"],8:["f7f4f9","e7e1ef","d4b9da","c994c7","df65b0","e7298a","ce1256","91003f"],9:["f7f4f9","e7e1ef","d4b9da","c994c7","df65b0","e7298a","ce1256","980043","67001f"]},OrRd:{type:"sequential",cbf:42,3:["fee8c8","fdbb84","e34a33"],4:["fef0d9","fdcc8a","fc8d59","d7301f"],5:["fef0d9","fdcc8a","fc8d59","e34a33","b30000"],6:["fef0d9","fdd49e","fdbb84","fc8d59","e34a33","b30000"],7:["fef0d9","fdd49e","fdbb84","fc8d59","ef6548","d7301f","990000"],8:["fff7ec","fee8c8","fdd49e","fdbb84","fc8d59","ef6548","d7301f","990000"],9:["fff7ec","fee8c8","fdd49e","fdbb84","fc8d59","ef6548","d7301f","b30000","7f0000"]},YlOrRd:{type:"sequential",cbf:42,3:["ffeda0","feb24c","f03b20"],4:["ffffb2","fecc5c","fd8d3c","e31a1c"],5:["ffffb2","fecc5c","fd8d3c","f03b20","bd0026"],6:["ffffb2","fed976","feb24c","fd8d3c","f03b20","bd0026"],7:["ffffb2","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","b10026"],8:["ffffcc","ffeda0","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","b10026"],9:["ffffcc","ffeda0","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","bd0026","800026"]},YlOrBr:{type:"sequential",cbf:42,3:["fff7bc","fec44f","d95f0e"],4:["ffffd4","fed98e","fe9929","cc4c02"],5:["ffffd4","fed98e","fe9929","d95f0e","993404"],6:["ffffd4","fee391","fec44f","fe9929","d95f0e","993404"],7:["ffffd4","fee391","fec44f","fe9929","ec7014","cc4c02","8c2d04"],8:["ffffe5","fff7bc","fee391","fec44f","fe9929","ec7014","cc4c02","8c2d04"],9:["ffffe5","fff7bc","fee391","fec44f","fe9929","ec7014","cc4c02","993404","662506"]},Purples:{type:"sequential",cbf:42,3:["efedf5","bcbddc","756bb1"],4:["f2f0f7","cbc9e2","9e9ac8","6a51a3"],5:["f2f0f7","cbc9e2","9e9ac8","756bb1","54278f"],6:["f2f0f7","dadaeb","bcbddc","9e9ac8","756bb1","54278f"],7:["f2f0f7","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","4a1486"],8:["fcfbfd","efedf5","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","4a1486"],9:["fcfbfd","efedf5","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","54278f","3f007d"]},Blues:{type:"sequential",cbf:42,3:["deebf7","9ecae1","3182bd"],4:["eff3ff","bdd7e7","6baed6","2171b5"],5:["eff3ff","bdd7e7","6baed6","3182bd","08519c"],6:["eff3ff","c6dbef","9ecae1","6baed6","3182bd","08519c"],7:["eff3ff","c6dbef","9ecae1","6baed6","4292c6","2171b5","084594"],8:["f7fbff","deebf7","c6dbef","9ecae1","6baed6","4292c6","2171b5","084594"],9:["f7fbff","deebf7","c6dbef","9ecae1","6baed6","4292c6","2171b5","08519c","08306b"]},Greens:{type:"sequential",cbf:42,3:["e5f5e0","a1d99b","31a354"],4:["edf8e9","bae4b3","74c476","238b45"],5:["edf8e9","bae4b3","74c476","31a354","006d2c"],6:["edf8e9","c7e9c0","a1d99b","74c476","31a354","006d2c"],7:["edf8e9","c7e9c0","a1d99b","74c476","41ab5d","238b45","005a32"],8:["f7fcf5","e5f5e0","c7e9c0","a1d99b","74c476","41ab5d","238b45","005a32"],9:["f7fcf5","e5f5e0","c7e9c0","a1d99b","74c476","41ab5d","238b45","006d2c","00441b"]},Oranges:{type:"sequential",cbf:42,3:["fee6ce","fdae6b","e6550d"],4:["feedde","fdbe85","fd8d3c","d94701"],5:["feedde","fdbe85","fd8d3c","e6550d","a63603"],6:["feedde","fdd0a2","fdae6b","fd8d3c","e6550d","a63603"],7:["feedde","fdd0a2","fdae6b","fd8d3c","f16913","d94801","8c2d04"],8:["fff5eb","fee6ce","fdd0a2","fdae6b","fd8d3c","f16913","d94801","8c2d04"],9:["fff5eb","fee6ce","fdd0a2","fdae6b","fd8d3c","f16913","d94801","a63603","7f2704"]},Reds:{type:"sequential",cbf:42,3:["fee0d2","fc9272","de2d26"],4:["fee5d9","fcae91","fb6a4a","cb181d"],5:["fee5d9","fcae91","fb6a4a","de2d26","a50f15"],6:["fee5d9","fcbba1","fc9272","fb6a4a","de2d26","a50f15"],7:["fee5d9","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","99000d"],8:["fff5f0","fee0d2","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","99000d"],9:["fff5f0","fee0d2","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","a50f15","67000d"]},Greys:{type:"sequential",cbf:42,3:["f0f0f0","bdbdbd","636363"],4:["f7f7f7","cccccc","969696","525252"],5:["f7f7f7","cccccc","969696","636363","252525"],6:["f7f7f7","d9d9d9","bdbdbd","969696","636363","252525"],7:["f7f7f7","d9d9d9","bdbdbd","969696","737373","525252","252525"],8:["ffffff","f0f0f0","d9d9d9","bdbdbd","969696","737373","525252","252525"],9:["ffffff","f0f0f0","d9d9d9","bdbdbd","969696","737373","525252","252525","000000"]},PuOr:{type:"diverging",cbf:42,3:["f1a340","f7f7f7","998ec3"],4:["e66101","fdb863","b2abd2","5e3c99"],5:["e66101","fdb863","f7f7f7","b2abd2","5e3c99"],6:["b35806","f1a340","fee0b6","d8daeb","998ec3","542788"],7:["b35806","f1a340","fee0b6","f7f7f7","d8daeb","998ec3","542788"],8:["b35806","e08214","fdb863","fee0b6","d8daeb","b2abd2","8073ac","542788"],9:["b35806","e08214","fdb863","fee0b6","f7f7f7","d8daeb","b2abd2","8073ac","542788"],10:["7f3b08","b35806","e08214","fdb863","fee0b6","d8daeb","b2abd2","8073ac","542788","2d004b"],11:["7f3b08","b35806","e08214","fdb863","fee0b6","f7f7f7","d8daeb","b2abd2","8073ac","542788","2d004b"]},BrBG:{type:"diverging",cbf:42,3:["d8b365","f5f5f5","5ab4ac"],4:["a6611a","dfc27d","80cdc1","018571"],5:["a6611a","dfc27d","f5f5f5","80cdc1","018571"],6:["8c510a","d8b365","f6e8c3","c7eae5","5ab4ac","01665e"],7:["8c510a","d8b365","f6e8c3","f5f5f5","c7eae5","5ab4ac","01665e"],8:["8c510a","bf812d","dfc27d","f6e8c3","c7eae5","80cdc1","35978f","01665e"],9:["8c510a","bf812d","dfc27d","f6e8c3","f5f5f5","c7eae5","80cdc1","35978f","01665e"],10:["543005","8c510a","bf812d","dfc27d","f6e8c3","c7eae5","80cdc1","35978f","01665e","003c30"],11:["543005","8c510a","bf812d","dfc27d","f6e8c3","f5f5f5","c7eae5","80cdc1","35978f","01665e","003c30"]},PRGn:{type:"diverging",cbf:42,3:["af8dc3","f7f7f7","7fbf7b"],4:["7b3294","c2a5cf","a6dba0","008837"],5:["7b3294","c2a5cf","f7f7f7","a6dba0","008837"],6:["762a83","af8dc3","e7d4e8","d9f0d3","7fbf7b","1b7837"],7:["762a83","af8dc3","e7d4e8","f7f7f7","d9f0d3","7fbf7b","1b7837"],8:["762a83","9970ab","c2a5cf","e7d4e8","d9f0d3","a6dba0","5aae61","1b7837"],9:["762a83","9970ab","c2a5cf","e7d4e8","f7f7f7","d9f0d3","a6dba0","5aae61","1b7837"],10:["40004b","762a83","9970ab","c2a5cf","e7d4e8","d9f0d3","a6dba0","5aae61","1b7837","00441b"],11:["40004b","762a83","9970ab","c2a5cf","e7d4e8","f7f7f7","d9f0d3","a6dba0","5aae61","1b7837","00441b"]},PiYG:{type:"diverging",cbf:42,3:["e9a3c9","f7f7f7","a1d76a"],4:["d01c8b","f1b6da","b8e186","4dac26"],5:["d01c8b","f1b6da","f7f7f7","b8e186","4dac26"],6:["c51b7d","e9a3c9","fde0ef","e6f5d0","a1d76a","4d9221"],7:["c51b7d","e9a3c9","fde0ef","f7f7f7","e6f5d0","a1d76a","4d9221"],8:["c51b7d","de77ae","f1b6da","fde0ef","e6f5d0","b8e186","7fbc41","4d9221"],9:["c51b7d","de77ae","f1b6da","fde0ef","f7f7f7","e6f5d0","b8e186","7fbc41","4d9221"],10:["8e0152","c51b7d","de77ae","f1b6da","fde0ef","e6f5d0","b8e186","7fbc41","4d9221","276419"],11:["8e0152","c51b7d","de77ae","f1b6da","fde0ef","f7f7f7","e6f5d0","b8e186","7fbc41","4d9221","276419"]},RdBu:{type:"diverging",cbf:42,3:["ef8a62","f7f7f7","67a9cf"],4:["ca0020","f4a582","92c5de","0571b0"],5:["ca0020","f4a582","f7f7f7","92c5de","0571b0"],6:["b2182b","ef8a62","fddbc7","d1e5f0","67a9cf","2166ac"],7:["b2182b","ef8a62","fddbc7","f7f7f7","d1e5f0","67a9cf","2166ac"],8:["b2182b","d6604d","f4a582","fddbc7","d1e5f0","92c5de","4393c3","2166ac"],9:["b2182b","d6604d","f4a582","fddbc7","f7f7f7","d1e5f0","92c5de","4393c3","2166ac"],10:["67001f","b2182b","d6604d","f4a582","fddbc7","d1e5f0","92c5de","4393c3","2166ac","053061"],11:["67001f","b2182b","d6604d","f4a582","fddbc7","f7f7f7","d1e5f0","92c5de","4393c3","2166ac","053061"]},RdGy:{type:"diverging",cbf:42,3:["ef8a62","ffffff","999999"],4:["ca0020","f4a582","bababa","404040"],5:["ca0020","f4a582","ffffff","bababa","404040"],6:["b2182b","ef8a62","fddbc7","e0e0e0","999999","4d4d4d"],7:["b2182b","ef8a62","fddbc7","ffffff","e0e0e0","999999","4d4d4d"],8:["b2182b","d6604d","f4a582","fddbc7","e0e0e0","bababa","878787","4d4d4d"],9:["b2182b","d6604d","f4a582","fddbc7","ffffff","e0e0e0","bababa","878787","4d4d4d"],10:["67001f","b2182b","d6604d","f4a582","fddbc7","e0e0e0","bababa","878787","4d4d4d","1a1a1a"],11:["67001f","b2182b","d6604d","f4a582","fddbc7","ffffff","e0e0e0","bababa","878787","4d4d4d","1a1a1a"]},RdYlBu:{type:"diverging",cbf:42,3:["fc8d59","ffffbf","91bfdb"],4:["d7191c","fdae61","abd9e9","2c7bb6"],5:["d7191c","fdae61","ffffbf","abd9e9","2c7bb6"],6:["d73027","fc8d59","fee090","e0f3f8","91bfdb","4575b4"],7:["d73027","fc8d59","fee090","ffffbf","e0f3f8","91bfdb","4575b4"],8:["d73027","f46d43","fdae61","fee090","e0f3f8","abd9e9","74add1","4575b4"],9:["d73027","f46d43","fdae61","fee090","ffffbf","e0f3f8","abd9e9","74add1","4575b4"],10:["a50026","d73027","f46d43","fdae61","fee090","e0f3f8","abd9e9","74add1","4575b4","313695"],11:["a50026","d73027","f46d43","fdae61","fee090","ffffbf","e0f3f8","abd9e9","74add1","4575b4","313695"]},Spectral:{type:"diverging",cbf:0,3:["fc8d59","ffffbf","99d594"],4:["d7191c","fdae61","abdda4","2b83ba"],5:["d7191c","fdae61","ffffbf","abdda4","2b83ba"],6:["d53e4f","fc8d59","fee08b","e6f598","99d594","3288bd"],7:["d53e4f","fc8d59","fee08b","ffffbf","e6f598","99d594","3288bd"],8:["d53e4f","f46d43","fdae61","fee08b","e6f598","abdda4","66c2a5","3288bd"],9:["d53e4f","f46d43","fdae61","fee08b","ffffbf","e6f598","abdda4","66c2a5","3288bd"],10:["9e0142","d53e4f","f46d43","fdae61","fee08b","e6f598","abdda4","66c2a5","3288bd","5e4fa2"],11:["9e0142","d53e4f","f46d43","fdae61","fee08b","ffffbf","e6f598","abdda4","66c2a5","3288bd","5e4fa2"]},RdYlGn:{type:"diverging",cbf:0,3:["fc8d59","ffffbf","91cf60"],4:["d7191c","fdae61","a6d96a","1a9641"],5:["d7191c","fdae61","ffffbf","a6d96a","1a9641"],6:["d73027","fc8d59","fee08b","d9ef8b","91cf60","1a9850"],7:["d73027","fc8d59","fee08b","ffffbf","d9ef8b","91cf60","1a9850"],8:["d73027","f46d43","fdae61","fee08b","d9ef8b","a6d96a","66bd63","1a9850"],9:["d73027","f46d43","fdae61","fee08b","ffffbf","d9ef8b","a6d96a","66bd63","1a9850"],10:["a50026","d73027","f46d43","fdae61","fee08b","d9ef8b","a6d96a","66bd63","1a9850","006837"],11:["a50026","d73027","f46d43","fdae61","fee08b","ffffbf","d9ef8b","a6d96a","66bd63","1a9850","006837"]},Accent:{type:"qualitative",cbf:0,3:["7fc97f","beaed4","fdc086"],4:["7fc97f","beaed4","fdc086","ffff99"],5:["7fc97f","beaed4","fdc086","ffff99","386cb0"],6:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f"],7:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f","bf5b17"],8:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f","bf5b17","666666"]},Dark2:{type:"qualitative",cbf:3,3:["1b9e77","d95f02","7570b3"],4:["1b9e77","d95f02","7570b3","e7298a"],5:["1b9e77","d95f02","7570b3","e7298a","66a61e"],6:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02"],7:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02","a6761d"],8:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02","a6761d","666666"]},Paired:{type:"qualitative",cbf:4,3:["a6cee3","1f78b4","b2df8a"],4:["a6cee3","1f78b4","b2df8a","33a02c"],5:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99"],6:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c"],7:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f"],8:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00"],9:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6"],10:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a"],11:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a","ffff99"],12:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a","ffff99","b15928"]},Pastel1:{type:"qualitative",cbf:0,3:["fbb4ae","b3cde3","ccebc5"],4:["fbb4ae","b3cde3","ccebc5","decbe4"],5:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6"],6:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc"],7:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd"],8:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd","fddaec"],9:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd","fddaec","f2f2f2"]},Pastel2:{type:"qualitative",cbf:0,3:["b3e2cd","fdcdac","cbd5e8"],4:["b3e2cd","fdcdac","cbd5e8","f4cae4"],5:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9"],6:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae"],7:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae","f1e2cc"],8:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae","f1e2cc","cccccc"]},Set1:{type:"qualitative",cbf:0,3:["e41a1c","377eb8","4daf4a"],4:["e41a1c","377eb8","4daf4a","984ea3"],5:["e41a1c","377eb8","4daf4a","984ea3","ff7f00"],6:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33"],7:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628"],8:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628","f781bf"],9:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628","f781bf","999999"]},Set2:{type:"qualitative",cbf:3,3:["66c2a5","fc8d62","8da0cb"],4:["66c2a5","fc8d62","8da0cb","e78ac3"],5:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854"],6:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f"],7:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f","e5c494"],8:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f","e5c494","b3b3b3"]},Set3:{type:"qualitative",cbf:0,3:["8dd3c7","ffffb3","bebada"],4:["8dd3c7","ffffb3","bebada","fb8072"],5:["8dd3c7","ffffb3","bebada","fb8072","80b1d3"],6:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462"],7:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69"],8:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5"],9:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9"],10:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd"],11:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd","ccebc5"],12:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd","ccebc5","ffed6f"]}};for(var l in a){var n=a[l];n=t.Scheme.fromPalettes("cb-"+l,[n.type,"cb-"+n.type],n,12,n.cbf),t.register(n)}}(),e.exports&&(e.exports=t)}(sr)),sr.exports}yC();class bC extends il{constructor(){super(...arguments);ze(this,"data",{dashboard:[{name:"sales_growth_chart",type:"line"}],order:[{name:"gross_sale_by_day_chart",type:""},{name:"order_completion_time_chart",type:""},{name:"item_count_distribution_chart",type:""},{name:"gross_sale_by_hour_chart",type:""},{name:"order_value_distribution_chart",type:""},{name:"avg_order_gross_chart",type:""},{name:"avg_order_items_chart",type:""},{name:"order_chart",type:""}],revenue:[{name:"revenue_chart",type:"line"}],refund:[{name:"refund_chart",type:"line"}],subscription:[{name:"subscription_chart",type:"line"},{name:"retention_chart",type:"line"},{name:"daily_signups_chart",type:"line"}],product:[{name:"product_chart",type:"bar"}]});ze(this,"storageKey","chart-type");ze(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Qt.get(this.storageKey);this.data.dashboard=a.dashboard??this.data.dashboard,this.data.order=a.order??this.data.order,this.data.revenue=a.revenue??this.data.revenue,this.data.refund=a.refund??this.data.refund,this.data.subscription=a.subscription??this.data.subscription}addListener(a,l){this.listeners[a]=l}async onChange(a,l,n){const A=this.data[a].findIndex(p=>p.name===l);A!==-1?this.data[a][A].type=n:this.data[a].push({name:l,type:n}),this.syncStorage();for(let p in this.listeners)this.listeners[p](this.applicableFilters)}getChartType(a,l){const i=this.data[a].find(A=>A.name===l);return i?i.type:null}syncStorage(){Qt.set(this.storageKey,this.applicableFilters.chartType)}removeListener(a){delete this.listeners[a]}get applicableFilters(){return{chartType:{dashboard:this.data.dashboard,order:this.data.order,revenue:this.data.revenue,refund:this.data.refund,subscription:this.data.subscription}}}}const Ca=bC.init();function Ks(e){const t=at(e[0]).locale(as()).format(Ol("date")),a=at(e[1]).locale(as()).format(Ol("date"));return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Gs(e){const t=e.split("-");if(t.length===3){const[a,l,n]=t;return`${Ka[parseInt(l)-1]} ${n}`}else if(t.length===2){const[a,l]=t;return`${Ka[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}function Hl(e){return e.map(t=>Gs(t.group))}const Ha=Re.colors.report,wC={[Ha.light_gray]:Ha.cyan_blue,[Ha.light_gray_cyan_blue]:Ha.cyan_blue_dark,[Ha.blue]:Ha.royal_blue,[Ha.royal_blue]:Ha.dark_blue,[Ha.medium_slate_blue]:Ha.dark_purple,[Ha.dark_cyan_blue_16]:Ha.dark_cyan_blue_40,[Ha.dark_cyan_blue_24]:Ha.dark_cyan_blue_40,[Ha.blue]:Ha.blue_dark_mode,[Ha.purple]:Ha.purple_dark_mode};function el(e){return wC[e]}function fl(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const CC={class:"fct-gross-sale-vs-net-revenue-wrap"},kC={class:"fct-btn-group sm"},BC={__name:"SalesGrowthChart",props:{chartData:{type:Array,required:!0},reportFilter:{type:Object},loading:{type:Boolean,default:!0}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=M(null),n=M(null);M("daily");const i=M(Ca.getChartType("order","sales_growth_chart")||"line"),A=Re.colors.report,p=M(Re.isDark()),m=G(()=>a.chartData.every(F=>F.orders===0)),_=G(()=>p.value?A.dark_cyan_blue_16:A.light_gray),g=G(()=>p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue),y=G(()=>[{title:xl("Orders","Chart series legend"),key:"orders",color:_.value,yAxisIndex:1},{title:xl("Revenue","Chart series legend"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:F,key:$,color:U,yAxisIndex:D})=>S(F,i.value,a.chartData.map(T=>T[$]),U,D)));Ka.map(F=>F.slice(0,3));const v=G(()=>Hl(a.chartData));let k=null;const b=()=>{k&&(k.dispose(),k=null),$e(()=>{l.value&&(k=ca(l.value),B())})},w=G(()=>fl(a.chartData.length)),B=()=>{if(!k)return;p.value=Re.isDark();const F={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,A.dark_cyan_blue_16,A.light_gray_blue,i.value),confine:!0,position:kl,formatter:$=>{let U=$[0].name;return $.forEach(D=>{const T=D.seriesIndex===1?Ja(D.value*100):D.value,I=p.value?"#ffffff":"#565865";U+=`<div> |
| 101 |
${D.marker} |
| 102 |
<span style="color: ${I};">${D.seriesName}</span> |
| 103 |
<span style="float: right; margin-left: 20px; color: ${I};"> |
| 104 |
${T} |
| 105 |
</span> |
| 106 |
</div>`}),U}},xAxis:{type:"category",data:v.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,interval:w.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{name:xl("Revenue","Chart axis title"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:$=>`${_t.scaledChart($)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:xl("Orders","Chart axis title"),type:"value",position:"right",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:y.value};k.setOption(F,{notMerge:!0,replaceMerge:["series"]})},S=(F,$,U,D,T)=>({name:F,type:$,barMaxWidth:30,data:U,smooth:!1,color:D,lineStyle:{width:3},areaStyle:{opacity:.3,color:D},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},yAxisIndex:T,emphasis:{scale:2,itemStyle:{color:el(D)},lineStyle:{color:D},areaStyle:{opacity:.3,color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),V=F=>{i.value!==F&&(i.value=F,Ca.onChange("order","sales_growth_chart",F),B())};return be([()=>a.chartData,i],()=>{$e(B)},{deep:!0}),be(m,F=>{F||b()}),be(()=>a.loading,F=>{F||b()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",B,!1),window.removeEventListener("fluentCartCurrencyChange",B,!1)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",B),window.addEventListener("fluentCartCurrencyChange",B),$e(b)}),(F,$)=>{const U=C("el-skeleton");return r(),h("div",CC,[s(xe,{id:"chartContainer",ref_key:"cardRef",ref:n},{default:u(()=>[s(Ve,{title:F.$t("Sales Growth"),border_bottom:""},sa({_:2},[!m.value&&!e.loading?{name:"action",fn:u(()=>[o("div",kC,[s(Yl,{activeType:i.value,types:{bar:"BarChart",line:"LineChart"},onChange:V},null,8,["activeType"]),s(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),s(Be,{class:"p-0"},{default:u(()=>[e.loading?(r(),E(U,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(P,{key:1},[m.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-gross-sale-vs-net-revenue-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1})]),_:1},512)])}}},xC={class:"fct-gross-sale-vs-net-revenue-wrap"},SC={class:"fct-btn-group sm"},$C={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},FC={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},tc=.5,nr=6,yo=1.2,EC={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=Re.colors,l=M(null),n=M(null),i=M(!1),A=M("world"),p=M(92),m=M(100);M(!1);let _=null,g=null,y=50;const v=M(1.2),k=M(),b=a.blue,w=G(()=>{const J=m.value-p.value,N=t.data?t.data.length:0;return J<60||N<15}),B=J=>{J=J.replace(/^#/,"");const N=parseInt(J.substring(0,2),16),le=parseInt(J.substring(2,4),16),ee=parseInt(J.substring(4,6),16);return[N,le,ee]},S=()=>Re.isDark()?a.gray[50]:a.gray[600],V=B(b[500]),F={},$=async()=>{const J=pl.getUrl("world.geo.json"),le=await(await fetch(J)).json();le.features.forEach(ee=>{const pe=ee.properties;pe.iso_a2=pe.iso_a2||pe.name,F[pe.iso_a2]=pe.name}),Rm("world",le)},U=J=>{var N;return((N=J.data)==null?void 0:N.label)||F[J.name]||J.name},D=J=>{if(!J||isNaN(J))return`rgba(${V.join(",")}, 0)`;const N=Math.log(J+1)/Math.log(y+1);return`rgba(${V.join(",")}, ${N})`},T=J=>{A.value=J,Y(),_&&(_.clear(),_.setOption(W()),J==="bar"&&I()),g&&i.value&&(g.clear(),g.setOption(W()),J==="bar"&&L())},I=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(J){J.batch&&J.batch[0]?(p.value=J.batch[0].start||0,m.value=J.batch[0].end||100):(p.value=J.start||0,m.value=J.end||100),setTimeout(()=>{Y()},100)}))},L=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(J){J.batch&&J.batch[0]?(p.value=J.batch[0].start||0,m.value=J.batch[0].end||100):(p.value=J.start||0,m.value=J.end||100),setTimeout(()=>{g&&g.setOption(W())},100)}))},O=G(()=>(t.data||[]).filter(J=>J.country_code).map(J=>({...J,name:J.country_code,label:J.name,value:J.value||0,itemStyle:{color:D(J.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),Q=()=>({backgroundColor:Re.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:J=>d("%1$s%2$s Orders: %3$s",Om(U(J)),"<br>",J.value||0),borderRadius:8,backgroundColor:Re.isDark()?"#38485a":"#ffffff",borderColor:Re.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Re.isDark()?"#ffffff":"#565865"}},visualMap:{min:0,max:y,left:i.value?"5%":"center",bottom:i.value?"center":"4%",text:[d("High"),d("Low")],orient:i.value?"vertical":"horizontal",calculable:!0,inRange:{color:[b[100],b[500]]},textStyle:{color:a.gray[800]}},series:[{name:"Orders",type:"map",map:"world",nameProperty:"iso_a2",roam:k.value,zoom:v.value,label:{show:!1,formatter:U,emphasis:{show:!0,color:a.gray[1e3],fontWeight:"bold",textShadowColor:a.gray[50],textShadowBlur:3,textShadowOffsetX:0,textShadowOffsetY:0}},emphasis:{itemStyle:{areaColor:b[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:O.value}]}),H=G(()=>{const J=t.data.length,N=m.value-p.value,le=Math.ceil(J*N/100);let ee=0;return le>100?ee=9:le>50?ee=4:le>30?ee=2:le>20&&(ee=1),ee}),K=()=>{const J=w.value;return{backgroundColor:Re.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(N){const le=N[0];return`${le.name}<br/>${d("Orders")}: ${le.value||0}`},backgroundColor:Re.isDark()?"#38485a":"#ffffff",textStyle:{color:Re.isDark()?a.gray[25]:a.system.mid},borderColor:Re.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:p.value,end:m.value},{type:"slider",yAxisIndex:0,start:p.value,end:m.value,width:25,top:10,right:10,textStyle:{color:S()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:J?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:J},splitLine:{show:!1},axisLine:{show:J,lineStyle:{color:S()}},axisLabel:{show:J,interval:H.value,color:S(),fontSize:11},data:t.data.map(N=>N.name)},xAxis:{type:"value",axisLabel:{show:!0,color:S(),formatter:function(N){return N.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Re.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new br(0,0,1,0,[{offset:0,color:b[400]},{offset:1,color:b[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new br(0,0,1,0,[{offset:0,color:b[500]},{offset:1,color:b[700]}])}},data:t.data.map(N=>N.value),label:{show:J,formatter:"{c}",position:"right",color:S(),fontSize:10}}]}},W=()=>A.value==="bar"?K():Q(),z=async()=>{await $(),l.value&&(_=ca(l.value),_.setOption(W()),A.value==="bar"&&I(),_.on("georoam",()=>{const N=_.getOption().series[0].zoom;if(N!==v.value)if(N<yo||N>nr){const le=Math.max(yo,Math.min(nr,N));_.setOption({series:[{zoom:le}]},!1),v.value=le}else v.value=N}))},Y=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(J=>J.value||0)):y=1,_&&_.setOption(W(),{notMerge:!0})},Z=()=>{v.value=Math.min(v.value+tc,nr),k.value=!0,_.setOption({series:[{zoom:v.value,roam:k.value}]})},re=()=>{v.value=Math.max(v.value-tc,yo),k.value=!0,_.setOption({series:[{zoom:v.value,roam:k.value}]})},q=()=>{A.value==="bar"?(p.value=92,m.value=100,_&&_.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=yo,k.value="move",_&&(_.clear(),_.setOption(W())))},Ae=async()=>{i.value=!0,await $e(),g?g.clear():g=ca(n.value),g.setOption(W()),A.value==="bar"&&L()},ie=J=>{S(),_&&_.setOption(W())};return Te(()=>{window.addEventListener("onFluentCartThemeChange",ie),k.value="move",$e(z)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",ie),_&&(_.dispose(),_=null),g&&(g.dispose(),g=null)}),be(()=>t.data,()=>Y(),{deep:!0}),be(w,()=>{A.value==="bar"&&$e(()=>{Y()})}),(J,N)=>(r(),h("div",xC,[s(xe,{id:"chartContainer",class:"mb-0"},{default:u(()=>[s(Ve,{title:J.$t("Order Heat Map"),border_bottom:""},{action:u(()=>[o("div",SC,[s(Yl,{activeType:A.value,types:{world:"Globe",bar:"BarChart"},onChange:T},null,8,["activeType"]),s(Ea,{targetRef:l.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),s(Be,{class:"p-0 pt-0 relative"},{default:u(()=>[A.value==="world"?(r(),h("div",$C,[s(tt,{tag:"button",size:"small",onClick:Z},{default:u(()=>[s(X,{name:"Plus"})]),_:1}),s(tt,{tag:"button",size:"small",onClick:re},{default:u(()=>[s(X,{name:"Minus"})]),_:1}),s(tt,{tag:"button",size:"small",onClick:q},{default:u(()=>[s(X,{name:"Reload"})]),_:1}),s(tt,{tag:"button",size:"small lg:hidden",onClick:Ae},{default:u(()=>[s(X,{name:"Eye"})]),_:1})])):x("",!0),A.value==="bar"?(r(),h("div",FC,[s(tt,{tag:"button",size:"small",onClick:q},{default:u(()=>[s(X,{name:"Reload"})]),_:1})])):x("",!0),o("div",{class:"fct-chart-wrap rounded-[0px] bg-transparent",ref_key:"chartRef",ref:l},null,512)]),_:1})]),_:1}),s(c(Gm),{modelValue:i.value,"onUpdate:modelValue":N[0]||(N[0]=le=>i.value=le),title:J.$t("Order Heat Map"),class:"country-heat-map-dialog"},{default:u(()=>[o("div",{class:"fct-chart-wrap",ref_key:"modalChartRef",ref:n},null,512)]),_:1},8,["modelValue","title"])]))}},UC=nt(EC,[["__scopeId","data-v-22ea2059"]]),IC={class:"fct-report-card"},VC={key:0,class:"fct-report-card-header"},DC={key:0,class:"flex items-center gap-2"},TC={class:"title"},QC={class:"actions"},MC={class:"fct-report-card-body flex h-full"},LC={class:"w-full"},jn={__name:"ReportCard",props:{cardOptions:{type:Object,default:()=>({heading:"",linkButtonText:"",linkButtonUrl:"",headingIcon:{type:Boolean,default:!1}})}},setup(e){return(t,a)=>{const l=C("router-link");return r(),h("div",IC,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",VC,[e.cardOptions.heading?(r(),h("div",DC,[e.cardOptions.headingIcon?(r(),E(tt,{key:0,size:"x-small",bg:"danger",soft:""},{default:u(()=>[s(X,{name:"FailedCircle"})]),_:1})):x("",!0),o("h4",TC,f(e.cardOptions.heading),1)])):x("",!0),o("div",QC,[e.cardOptions.linkButtonText?(r(),E(l,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:u(()=>[R(f(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):x("",!0),wa(t.$slots,"action")])])):x("",!0),o("div",MC,[o("div",LC,[wa(t.$slots,"default")])])])}}},RC={key:0,class:"fct-report-sold-product-list has-scroll"},OC={class:"list-left-content"},PC={class:"list-title"},HC={class:"list-title-inner"},NC={class:"list-id"},KC={class:"list-right-content"},GC=["innerHTML"],zC={class:"list-price"},jC={__name:"RecentOrders",setup(e){const t=cl.data;return(a,l)=>{const n=C("router-link");return r(),E(jn,{class:"top-sold-products","card-options":{heading:c(d)("Recent Orders"),linkButtonText:c(d)("View All"),linkButtonUrl:"orders"}},{default:u(()=>{var i,A;return[((A=(i=c(t))==null?void 0:i.recentOrders)==null?void 0:A.length)>0?(r(),h("ul",RC,[(r(!0),h(P,null,ae(c(t).recentOrders,p=>(r(),h("li",{key:p.id},[s(n,{class:"no-underline",to:{name:"view_order",params:{order_id:p.id}}},{default:u(()=>[o("div",OC,[o("div",PC,[o("div",HC,f(p.customer_name)+" #"+f(c(la)(p.id)),1),o("div",NC,[s(Sa,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",KC,[o("div",{class:"list-value",innerHTML:c(_t).scaled(p.total_amount)},null,8,GC),o("div",zC,f(c(la)(p.order_items_count))+" "+f(c(d)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},qC={key:0},YC={key:1,class:"fc_dashboard_onboarding_wrap"},WC={class:"fc_dashboard_onboarding_title"},JC={class:"fc_dashboard_onboarding_lists"},XC=["href"],ZC={class:"circle-shape"},e2={class:"fc_dashboard_onboarding_item__title"},t2={__name:"Onboarding",emits:["status"],setup(e,{emit:t}){const a=M(0),l=M(!1);aa().ctx;const n=M([]),i=M(!0);M(localStorage.getItem("started_content_collapse")==="true"||!1),G(()=>{const _=Object.keys(n.value).length;return _?Math.round(a.value/_*100):0});const A=_=>_.hash_id?_.url+"#"+_.hash_id:_.url,p=ci("dashboardTogglePageNotification"),m=t;return Te(async()=>{l.value=!0,ce.get("dashboard").then(_=>{var y,v;n.value=_.data.steps,a.value=_.data.completed,i.value=Object.keys(n.value).length!==a.value,m("status",{completed:!i.value}),l.value=!1;let g=((y=n.value.page_setup)==null?void 0:y.completed)||!1;p&&p(!g,((v=n.value.page_setup)==null?void 0:v.url)||"")}).catch(_=>{l.value=!1})}),(_,g)=>{const y=C("el-skeleton"),v=C("Check"),k=C("el-icon");return i.value?(r(),h("div",qC,[l.value?(r(),E(y,{key:0,rows:3,animated:""})):(r(),h("div",YC,[o("h3",WC,f(_.$t("Getting Started")),1),o("div",JC,[(r(!0),h(P,null,ae(n.value,(b,w)=>(r(),h("a",{key:w,href:A(b),class:ue([b.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",ZC,[b.completed===!0?(r(),E(k,{key:0},{default:u(()=>[s(v)]),_:1})):x("",!0)]),o("div",e2,f(b.title),1)],10,XC))),128))])]))])):x("",!0)}}},a2={class:"fct-dashboard-recent-activities-wrap"},l2={class:"fct-dashboard-recent-activities__header"},s2={class:"fct-dashboard-recent-activities__header_title"},n2={class:"fct-dashboard-recent-activities__header_desc"},o2={key:0,class:"fct-dashboard-recent-activities__body"},i2={class:"content"},r2={class:"title"},d2=["onClick"],u2={class:"date"},c2=["innerHTML"],A2={class:"created_by"},p2={key:1,class:"fct-dashboard-recent-activities__empty"},f2={class:"fct-dashboard-recent-activities__empty_text"},m2={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=Oa(),l=M([{label:xl("All","Activity filter button"),value:"all"},{label:xl("Today","Activity filter button"),value:"today"},{label:xl("Yesterday","Activity filter button"),value:"yesterday"},{label:xl("This Week","Activity filter button"),value:"this_week"}]),n=M("all"),i=()=>{switch(n.value){case"all":return xl("all","Activity filter, mid-sentence");case"today":return xl("today","Activity filter, mid-sentence");case"yesterday":return xl("yesterday","Activity filter, mid-sentence");case"this_week":return xl("this week","Activity filter, mid-sentence");default:return n.value}},A=()=>{i(),cl.getRecentActivities({groupKey:n.value})},p={Order:"orders/view",Payment:"orders/view",PayPal:"orders/view",Product:"products/view",Customer:"customers/view",Coupon:"coupons/view",Subscription:"subscriptions/view",Tax:"store/settings"},m={order:{name:"view_order",param:"order_id",permission:"orders/view"},payment:{name:"view_order",param:"order_id",permission:"orders/view"},product:{name:"view_product",param:"product_id",permission:"products/view"},customer:{name:"view_customer",param:"customer_id",permission:"customers/view"},coupon:{name:"view_coupon",param:"coupon_id",permission:"coupons/view"},subscription:{name:"view_subscription",param:"subscription_id",permission:"subscriptions/view"}},_=v=>{var w;let k=(w=v==null?void 0:v.module_name)==null?void 0:w.toLowerCase();const b=m[k];b&&v.module_id&&g(v)&&a.push({name:b.name,params:{[b.param]:v.module_id}})},g=v=>{if(!v.module_name)return!0;const k=dt.get(p,Aa.capitalize(v.module_name));return k?zl.has(k):!1},y=G(()=>cl.data.recentActivities.filter(v=>g(v)));return Te(()=>{A()}),(v,k)=>{const b=C("el-radio-button"),w=C("el-radio-group");return r(),h("div",a2,[o("div",l2,[o("h4",s2,f(c(d)("Recent Activities")),1),o("p",n2,[n.value==="all"?(r(),h(P,{key:0},[R(f(c(d)("%1$s new activities",c(la)(y.value.length))),1)],64)):(r(),h(P,{key:1},[R(f(c(d)("%1$s new activities %2$s",c(la)(y.value.length),i())),1)],64))]),s(w,{class:"fct-dashboard-recent-activities__header_filter",modelValue:n.value,"onUpdate:modelValue":k[0]||(k[0]=B=>n.value=B),onChange:A,size:"large"},{default:u(()=>[(r(!0),h(P,null,ae(l.value,(B,S)=>(r(),E(b,{key:S,label:B.label,value:B.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),y.value.length?(r(),h("div",o2,[(r(!0),h(P,null,ae(y.value,(B,S)=>{var V;return r(),h("div",{key:S,class:"fct-dashboard-recent-activities__item has-icon"},[k[1]||(k[1]=o("span",{class:"icon"},[o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12.8499 9.92029L13.5711 10.3529C13.6156 10.3795 13.6524 10.4172 13.678 10.4623C13.7036 10.5075 13.717 10.5584 13.717 10.6103C13.717 10.6621 13.7036 10.7131 13.678 10.7582C13.6524 10.8033 13.6156 10.841 13.5711 10.8677L8.30911 14.0249C8.21579 14.081 8.10897 14.1106 8.00011 14.1106C7.89124 14.1106 7.78443 14.081 7.69111 14.0249L2.42911 10.8677C2.38462 10.841 2.34779 10.8033 2.32222 10.7582C2.29664 10.7131 2.2832 10.6621 2.2832 10.6103C2.2832 10.5584 2.29664 10.5075 2.32222 10.4623C2.34779 10.4172 2.38462 10.3795 2.42911 10.3529L3.15031 9.92029L8.00011 12.8303L12.8499 9.92029ZM12.8499 7.10029L13.5711 7.53289C13.6156 7.55952 13.6524 7.59723 13.678 7.64235C13.7036 7.68746 13.717 7.73843 13.717 7.79029C13.717 7.84214 13.7036 7.89311 13.678 7.93822C13.6524 7.98334 13.6156 8.02105 13.5711 8.04769L8.00011 11.3903L2.42911 8.04769C2.38462 8.02105 2.34779 7.98334 2.32222 7.93822C2.29664 7.89311 2.2832 7.84214 2.2832 7.79029C2.2832 7.73843 2.29664 7.68746 2.32222 7.64235C2.34779 7.59723 2.38462 7.55952 2.42911 7.53289L3.15031 7.10029L8.00011 10.0103L12.8499 7.10029ZM8.30851 1.58569L13.5711 4.74289C13.6156 4.76952 13.6524 4.80724 13.678 4.85235C13.7036 4.89746 13.717 4.94843 13.717 5.00029C13.717 5.05214 13.7036 5.10311 13.678 5.14822C13.6524 5.19334 13.6156 5.23105 13.5711 5.25769L8.00011 8.60029L2.42911 5.25769C2.38462 5.23105 2.34779 5.19334 2.32222 5.14822C2.29664 5.10311 2.2832 5.05214 2.2832 5.00029C2.2832 4.94843 2.29664 4.89746 2.32222 4.85235C2.34779 4.80724 2.38462 4.76952 2.42911 4.74289L7.69111 1.58569C7.78443 1.52962 7.89124 1.5 8.00011 1.5C8.10897 1.5 8.21579 1.52962 8.30911 1.58569H8.30851ZM8.00011 2.79949L4.33231 5.00029L8.00011 7.20109L11.6679 5.00029L8.00011 2.79949Z",fill:"#335CFF"})])],-1)),o("div",i2,[o("h3",r2,[m[(V=B.module_name)==null?void 0:V.toLowerCase()]?(r(),h("span",{key:0,onClick:F=>_(B),class:"cursor-pointer"},f(B.title||"--"),9,d2)):(r(),h(P,{key:1},[R(f(B.title||"--"),1)],64)),o("span",u2,[s(Sa,{"date-time":B.created_at},null,8,["date-time"])])]),o("p",{innerHTML:B.content,class:"description"},null,8,c2),o("span",A2,f(c(d)("By %s",B.created_by)),1)])])}),128))])):(r(),h("div",p2,[o("div",f2,f(c(d)("No activity found.")),1)]))])}}},h2="https://wordpress.org/support/plugin/fluent-cart/reviews/#new-post",Tp="fct_review_prompt_hidden",Qp=()=>{try{return window.localStorage}catch{return null}},_2=(e=Qp())=>{try{return!!e&&e.getItem(Tp)==="yes"}catch{return!1}},v2=(e=Qp())=>{try{return e?(e.setItem(Tp,"yes"),!0):!1}catch{return!1}},g2=["aria-label"],y2={class:"fct-review-prompt__text"},ac="fct-review-prompt-title",b2={__name:"ReviewPrompt",setup(e){const t=M(_2()),a=()=>{t.value=!0,v2()};return(l,n)=>{const i=C("el-button");return t.value?x("",!0):(r(),h("div",{key:0,class:"fct-review-prompt",role:"region","aria-labelledby":ac},[o("button",{type:"button",class:"fct-review-prompt__close","aria-label":c(d)("Dismiss feedback request"),onClick:a},[s(X,{name:"Cross"})],8,g2),o("h3",{id:ac,class:"fct-review-prompt__title"},f(c(d)("How's FluentCart working for you?")),1),o("p",y2,f(c(d)("A short review on WordPress.org helps other store owners decide, and tells us what to improve.")),1),s(i,{tag:"a",href:c(h2),target:"_blank",rel:"noopener noreferrer",onClick:a},{default:u(()=>[R(f(c(d)("Share your feedback"))+" ",1),s(X,{name:"External",class:"ml-1.5 w-3.5 h-3.5"})]),_:1},8,["href"])]))}}},w2={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},C2={__name:"SideBar",setup(e){const t=M(!1),a=l=>{t.value=!!l.completed};return(l,n)=>(r(),h("div",w2,[s(Lt,{permission:"is_super_admin"},{default:u(()=>[s(t2,{onStatus:a}),t.value?(r(),E(b2,{key:0})):x("",!0)]),_:1}),s(m2,{onReload:n[0]||(n[0]=()=>{})})]))}},k2={class:"fct-product-create"},B2={class:"fct-product-step"},x2={class:"fct-product-item-selector"},S2=["onClick"],$2={class:"fct-product-item-selector-content"},F2={class:"fct-bundle-product-condition"},E2={class:"condition-text"},U2={class:"dialog-footer"},$i={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,l=t,n=Oa(),i=Ke.get("variation_types",{}),A=M({post_title:"",post_content:"",post_excerpt:"",post_date:new Date,post_status:"draft",detail:{fulfillment_type:"digital",variation_type:"simple",manage_stock:"0",manage_downloadable:"0",other_info:{use_pricing_table:"yes",group_pricing_by:"repeat_interval",active_editor:"wp-editor",sold_individually:"no"}}}),p=[{type:"physical",title:d("Physical Product"),icon:"Gift"},{type:"digital",title:d("Digital Product"),icon:"Code"}],m=M(!1),_=M(null),g=k=>{A.value.detail.fulfillment_type=k},y=()=>{m.value=!0,ce.post("products",{...A.value}).then(k=>{if(j.success(k.message),a.customModal==="order_modal"){const b={id:k.data.product_variants.id,object_id:k.data.product_variants.post_id,variation_id:k.data.product_variants.id,item_name:k.data.product_variants.variation_title,item_price:k.data.product_variants.item_price,quantity:1,stock:100,object_type:k.data.product_details.fulfillment_type,item_total:k.data.product_variants.item_price,line_total:k.data.product_variants.item_price,tax_amount:0,discount_total:0};l("process_custom",b),l("update:createProductModal",!1)}else n.push({name:"product_edit",params:{product_id:k.data.ID}})}).catch(k=>{var b;k.status_code=="422"?j.validationErrors(k):j.error((b=k.data)==null?void 0:b.message)}).finally(()=>{m.value=!1})},v=k=>{k.stopPropagation(),k.preventDefault(),y()};return Te(()=>{$e(()=>{setTimeout(()=>{var k;(k=_.value)==null||k.focus()},10)})}),(k,b)=>{const w=C("el-input"),B=C("el-form-item"),S=C("el-option"),V=C("el-select"),F=C("el-checkbox"),$=C("el-form"),U=C("el-button");return r(),h("div",k2,[o("div",B2,[s($,{"label-position":"top",model:A.value,"require-asterisk-position":"right"},{default:u(()=>[s(B,{label:A.value.detail.other_info.is_bundle_product==="yes"?c(d)("Bundle Title"):c(d)("Product Title"),required:""},{default:u(()=>[s(w,{type:"text",modelValue:A.value.post_title,"onUpdate:modelValue":b[0]||(b[0]=D=>A.value.post_title=D),placeholder:A.value.detail.other_info.is_bundle_product==="yes"?c(d)("Bundle Title"):c(d)("Product Title"),minlength:"3",maxlength:"200","show-word-limit":"",autofocus:"",ref_key:"fcProductTitle",ref:_,onKeydown:ea(v,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),e.customModal!=="order_modal"?(r(),E(B,{key:0,label:c(d)("Variation Type")},{default:u(()=>[s(V,{modelValue:A.value.detail.variation_type,"onUpdate:modelValue":b[1]||(b[1]=D=>A.value.detail.variation_type=D),placeholder:c(d)("Select Variation Type"),class:"w-full"},{default:u(()=>[(r(!0),h(P,null,ae(c(i),(D,T)=>(r(),E(S,{key:T,label:D,value:T},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):x("",!0),s(B,null,{default:u(()=>[o("ul",x2,[(r(),h(P,null,ae(p,D=>o("li",{key:D.type,class:ue({active:D.type===A.value.detail.fulfillment_type}),onClick:T=>g(D.type)},[o("div",$2,[s(X,{name:D.icon},null,8,["name"]),R(" "+f(D.title),1)]),b[3]||(b[3]=o("div",{class:"fct-product-item-selector-dot-wrap"},[o("span",{class:"fct-product-item-selector-dot"})],-1))],10,S2)),64))])]),_:1}),s(B,null,{default:u(()=>[o("div",F2,[s(F,{modelValue:A.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":b[2]||(b[2]=D=>A.value.detail.other_info.is_bundle_product=D),"true-value":"yes","false-value":"no"},{default:u(()=>[R(f(c(d)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),o("span",E2,f(c(d)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",U2,[s(U,{disabled:!A.value.post_title||m.value,loading:m.value,onClick:y,type:"primary"},{default:u(()=>[R(f(m.value?c(d)("Creating"):c(d)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class $d{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new $d().getHours();if(t>=5&&t<12)return d("Good morning");if(t>=12&&t<17)return d("Good afternoon");if(t>=17&&t<21)return d("Good evening");{const a=[d("Step into the moonlight!"),d("Evening vibes!"),d("The night's still young!")];return a[Math.floor(Math.random()*a.length)]}}}const I2={class:"fct-current-user-info-wrap"},V2={class:"fct-current-user-info-content"},D2={class:"image"},T2=["src","alt"],Q2={class:"content"},M2={key:0,class:"fct-current-user-info-action"},L2={__name:"CurrentUserInfo",setup(e){const t=M(!1),a=M(Ke.get("me")),l=()=>Ke.get("shop.store_name"),n=Ke.get("total_products_count");return(i,A)=>{const p=C("el-button"),m=C("el-dialog");return r(),h("div",I2,[o("div",V2,[o("div",D2,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,T2)]),o("div",Q2,[o("h4",null,f(c($d).greeting())+" "+f(a.value.full_name)+" 👋🏻",1),o("p",null,f(c(d)("Welcome to %1$s",l())),1)])]),s(Lt,{permission:"products/create"},{default:u(()=>[c(n)==0?(r(),h("div",M2,[s(p,{onClick:A[0]||(A[0]=_=>t.value=!0),type:"primary"},{default:u(()=>[R(f(c(d)("Add Product")),1)]),_:1})])):x("",!0)]),_:1}),s(m,{"append-to-body":!0,modelValue:t.value,"onUpdate:modelValue":A[1]||(A[1]=_=>t.value=_),onClose:A[2]||(A[2]=_=>t.value=!1),title:c(d)("Add New Product")},{default:u(()=>[s($i)]),_:1},8,["modelValue","title"])])}}};class R2{constructor(){ze(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});ze(this,"defaultMatcherMethod",null)}getMatchingMethod(t){return t==="=="||t==="==="?"matchEqual":this.operatorMap.hasOwnProperty(t)?this.operatorMap[t]:this.defaultMatcherMethod}defaultMatcher(t,a,l){}matchEqual(t,a,l){return l==="==="?t===a:t==a}matchNotEqual(t,a,l){return l==="!=="?t!==a:t!=a}matchContains(t,a,l){return a instanceof String||Array.isArray(a)?a.includes(t):typeof a=="object"?a.hasOwnProperty(t):!1}matchIn(t,a,l){return this.matchContains(t,a,l)}matchNotIn(t,a,l){return!this.matchContains(t,a,l)}}class O2{constructor(){ze(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});ze(this,"defaultModifierMethod",null)}getModificationMethod(t){return t==="=="||t==="==="?"matchEqual":this.modifierMap.hasOwnProperty(t)?this.modifierMap[t]:this.defaultModifierMethod}applyAddition(t,a,l,n,i){return t+a}}class P2{constructor(t,a){ze(this,"value");ze(this,"operator");this.value=t,this.operator=a}setOperator(t){return this.operator=t,this}setValue(t){return this.value=t,this}static make(t,a){return new this(t,a)}build(){return{operator:this.operator,value:this.value instanceof jr?this.value.setModifiers([]).build():this.value}}}class jr{constructor(t,a){ze(this,"accessor");ze(this,"modifiers");this.accessor=t,this.modifiers=[],this.setModifiers(a)}setAccessor(t){return this.accessor=t,this}addModifier(t){return this.modifiers.push(t),this}setModifiers(t){return this.modifiers=Array.isArray(t)?t:this.modifiers,this}static make(t,a){return new this(t,a)}build(){let t=[];return Array.isArray(this.modifiers)&&this.modifiers.length>0&&(t=this.modifiers.map(a=>a instanceof P2?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class Os{constructor(t,a,l,n,i){ze(this,"conditionType");ze(this,"conditions");ze(this,"key");ze(this,"operator");ze(this,"value");this.key=t,this.value=a,this.operator=l,this.conditions=[],this.conditionType=this.buildConditionType(n),this.setConditions(i)}static make(t,a,l,n){return new this(t,a,l,n)}setConditionType(t){return this.conditionType=this.buildConditionType(t),this}buildConditionType(t){return t==="or"||t==="|"?"or":"and"}setOperator(t){return this.operator=t,this}setKey(t){return this.key=t,this}setValue(t){return this.value=t,this}addCondition(t){return this.conditions.push(t),this}setConditions(t){return this.conditions=Array.isArray(t)||t instanceof Os||typeof t=="function"?t:this.conditions,this}build(){if(Array.isArray(this.conditions)&&this.conditions.length>0){let l=[];return l=this.conditions.map(n=>n instanceof Os?n.build.bind(n)():n),{condition_type:this.conditionType,conditions:l}}const t=this.key instanceof jr?this.key.build():this.key,a=this.value instanceof jr?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class H2{constructor(t,a){ze(this,"data");ze(this,"conditions");ze(this,"stateKey");ze(this,"matcher");ze(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new R2,this.modifier=new O2}match(t,a,l,n=!0){let i="",A=this.matcher.getMatchingMethod(a);return A!=null?i=A:i=Aa.camel("match"+a),i in this.matcher&&typeof this.matcher[i]=="function"?this.matcher[i](t,l,a,n):n}evaluate(t,a="and"){if(t instanceof Os){const n=t.build.bind(t)();n.hasOwnProperty("conditions")?(t=n.conditions,a=n.condition_type):t=[n]}a=a==="or"?"or":"and";let l=a==="and";if(typeof t=="function")return t(this.stateKey,this.data);if(!Array.isArray(t))return!0;for(let n of t){let i=null;if(Array.isArray(dt.get(n,"conditions")))i=this.evaluate(n.conditions,dt.get(n,"condition_type","and"));else{if(n.key===null||n.key===void 0){l=!0;continue}i=this.applyCondition(n)}l=a==="and"?l&&i:l||i}return l}applyCondition(t){let a="",l=null;typeof t.key=="object"?a=dt.resolvePath(this.stateKey,dt.get(t,"key.accessor")):a=dt.resolvePath(this.stateKey,t.key);let n=dt.get(this.data,a);if(typeof t.value=="object"){const i=dt.resolvePath(this.stateKey,dt.get(t,"value.accessor"));l=dt.get(this.data,i)}else l=t.value;return n=this.applyModification(n,t.key.modifiers,this.stateKey),l=this.applyModification(l,t.value.modifiers,this.stateKey),this.match(n,t.operator,l)}applyModification(t,a,l){return Array.isArray(a)&&a.forEach(n=>{let i=n.operator,A="",p=this.modifier.getModificationMethod(i);if(p!=null?A=p:A=Aa.camel("apply"+i),A in this.modifier&&typeof this.modifier[A]=="function"){let m=n.value;typeof m=="object"&&m!==null&&(m=dt.getByPath(this.data,l,dt.get(m,"accessor"))),t=this.modifier[A](t,m,i,l,this.data)}}),t}}class Mp{constructor(){ze(this,"_conditionType","and");ze(this,"_conditions",null)}conditionType(t){return this._conditionType=t,this}conditions(t){return this._conditions=Array.isArray(t)||t instanceof Os||typeof t=="function"?t:this._conditions,this}visibleIf(t){return this._conditions=t,this}buildConditions(t){return Array.isArray(t)&&t.length>0?t.map(a=>a instanceof Os?a.build.bind(a)():a):t}}class Lp{constructor(){ze(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class Jo{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new Jo;return a._component="Affix/"+t,a}static make(t=""){return new this(t)}build(){return this._component.length>0?{component:this._component}:this._affix}}class qr{constructor(t,a="input"){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");this._key=t,this._type=a,this._class="",this._id="",this._name="",this._label="",this._value="",this._placeholder="",this._min="",this._max="",this._prefix="",this._hasPrefix=!1,this._hasSuffix=!1,this._suffix="",ws.install(this,EA),ws.install(this,Lp),ws.install(this,Mp),this._wrapperClass=""}static make(t,a="input"){return new this(t,a)}wrapperClass(t){return this._wrapperClass=t,this}type(t){return this._type=t,this}class(t){return this._class=t,this}id(t){return this._id=t,this}name(t){return this._name=t,this}label(t){return this._label=t,this}value(t){return this._value=t,this}placeholder(t){return this._placeholder=t,this}min(t){return this._min=t,this}max(t){return this._max=t,this}prefix(t){return this._hasPrefix=!0,this._prefix=t,this}suffix(t){this._hasSuffix=!0,this._suffix=t}onChange(t){return this._onChangeCallback=t,this}onKeyPress(t){return this._onKeyPressCallback=t,this}onKeyUp(t){return this._onKeyUpCallback=t,this}onKeyDown(t){return this._onKeyDownCallback=t,this}build(){return this._conditions,Array.isArray(this._conditions)&&this._conditions.length>0&&this._conditions.map(t=>t instanceof Os?t.build.bind(t)():t),this._attributes=typeof this._attributes=="object"?this._attributes:{},this._attributes.min=this._min,this._attributes.max=this._max,this._attributes.placeholder=this._placeholder,this._attributes.type=this._type,{key:this._key,type:this._type,class:this._class,id:this._id,name:this._name??d(Aa.headline(this._key)),label:this._label??d(Aa.headline(this._key)),value:this._value,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),hasSuffix:this._hasSuffix,hasPrefix:this._hasPrefix,suffix:this._suffix instanceof Jo?this._suffix.build():this._suffix,prefix:this._prefix instanceof Jo?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Yr{constructor(t){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");this._type="section",this._key=t,this._schema=[],this._class="",this.disable_nesting=!0,ws.install(this,EA),ws.install(this,Lp),ws.install(this,Mp)}static make(t){return new this(t)}enableNesting(){return this.disable_nesting=!1,this}disableNesting(){return this.disable_nesting=!0,this}class(t){return this._class=t,this}get type(){return this._type}set type(t){if(typeof t=="string")this._type=t;else throw new TypeError("Type must be a string.")}get schema(){return this._schema}setSchema(t){return this._schema=t,this}build(){const t=pn.build(this.schema);return{key:this._key,type:this._type,class:this._class,schema:t,disable_nesting:this.disable_nesting,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),attributes:this._attributes}}}class lc{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");ws.install(this,qr,{key:t}),ws.install(this,Yr,{key:t}),this._component=a,this._key=t}static make(t,a=""){return new this(t,a)}component(t){return this._component=t,this}value(t){return this._value=t,this}build(){const t=pn.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??d(Aa.headline(this._key)),label:this._label??d(Aa.headline(this._key)),value:this._value,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),hasSuffix:this._hasSuffix,hasPrefix:this._hasPrefix,suffix:this._suffix,prefix:this._prefix,placeholder:this._placeholder,attributes:this._attributes,onChange:this._onChangeCallback,onKeyUp:this._onKeyUpCallback,onKeyDown:this._onKeyDownCallback,type:this._type,class:this._class,schema:t,disable_nesting:this.disable_nesting,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),type:"custom",component:this._component,key:this._key}}}class pn{static build(t){return Array.isArray(t)?pn.buildFromArray(t):typeof t=="object"?pn.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((l,n)=>{const i=t[l];i instanceof qr||i instanceof Yr||i instanceof lc?a[l]=i.build.bind(i)():a[l]=t[l]}),a}static buildFromArray(t){let a={};return Array.isArray(t)&&t.forEach(l=>{if(l instanceof qr||l instanceof Yr||l instanceof lc){let n=l.build.bind(l)();a[n.key]=n}else a[l.key]=l}),a}}class N2 extends il{constructor(){super(...arguments);ze(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});ze(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);ze(this,"ignorableFormLayouts",["grid"])}get hasChange(){return this.data.hasChange}setSchema(a){return this.data.schema=pn.build(a??{}),this.initForm(),this}setDefaults(a){return this.data.defaults=a||{},this.data._originalDefaults=JSON.parse(JSON.stringify(this.data.defaults)),this.initForm(),this}get schema(){return this.data.schema}get values(){return this.data.values}get isReady(){return this.data.initialized}initForm(){if(typeof this.data.schema!="object"||typeof this.data.defaults!="object")throw new Error("You need to set Schema and Defaults First");this.setValues(),this.data.initialized=!0}setValues(){this.data.values=this.ensureNestedDataProperties(this.data.schema,this.data.defaults)}getState(){return this.data.values}setValidationErrors(a){this.data.validationErrors=a||{}}hasValidationError(a){return(this.data.validationErrors??{}).hasOwnProperty(a)}getValidationError(a){return this.data.validationErrors[a]}ensureNestedDataProperties(a,l={}){return Object.keys(a).reduce((n,i)=>{const A=a[i];if(A.type==="html")return n;if(this.nestedFormLayouts.includes(A.type??""))if(A.disable_nesting===!0){const p=this.ensureNestedDataProperties(A.schema??{},l??{});n={...n,...p}}else n[i]=this.ensureNestedDataProperties(A.schema??{},l[i]??{});else n[i]=l[i]??A.value??"";return n},{})}isVisible(a,l){return a.hasOwnProperty("conditions")?new H2(l,this.values).evaluate(dt.get(a,"conditions"),dt.get(a,"condition_type","and")):!0}triggerChange(a){for(let l of this.data.onChangeCallback)l(a)}onDataChanged(a){this.data.onChangeCallback.push(a)}setValue(a,l){dt.set(this.data.values,a,l),this.data.hasChange=!0,this.triggerChange(this.data.values)}reset(a=!0){if(!this.data.schema||!this.data._originalDefaults)throw new Error("Form is not initialized");const l=a?this.data._originalDefaults:this.data.defaults;return this.data.values=this.ensureNestedDataProperties(this.data.schema,JSON.parse(JSON.stringify(l))),this.data.validationErrors={},this.data.hasChange=!1,this.data.initialized=!0,this}}function Fd(){return N2.init()}const K2=["innerHTML"],Wr={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,K2))}},G2=Object.freeze(Object.defineProperty({__proto__:null,default:Wr},Symbol.toStringTag,{value:"Module"})),sc=Object.assign({name:"ValidationError"},{__name:"ValidationErrorNew",props:{errorKey:String,form:{type:Object,required:!0}},setup(e){return(t,a)=>e.form.hasValidationError(e.errorKey)?(r(),h("div",{key:0,class:ue(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),h(P,null,ae(e.form.getValidationError(e.errorKey),(l,n)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},f(l),1))),128))],2)):x("",!0)}}),Rp={__name:"Resolver",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},label:{type:String},attribute:{type:Object},callback:{type:Function}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>Zt(()=>import("./chunks/Test.js?ver=1.8.0"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>Zt(()=>Promise.resolve().then(()=>sk),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>Zt(()=>Promise.resolve().then(()=>vk),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>Zt(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>Zt(()=>Promise.resolve().then(()=>G2),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>Zt(()=>Promise.resolve().then(()=>rk),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>Zt(()=>Promise.resolve().then(()=>Kk),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>Zt(()=>Promise.resolve().then(()=>ok),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>Zt(()=>Promise.resolve().then(()=>Ck),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>Zt(()=>Promise.resolve().then(()=>wk),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>Zt(()=>Promise.resolve().then(()=>lk),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>Zt(()=>Promise.resolve().then(()=>yk),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>Zt(()=>Promise.resolve().then(()=>j2),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>Zt(()=>Promise.resolve().then(()=>Z2),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>Zt(()=>Promise.resolve().then(()=>ek),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>Zt(()=>Promise.resolve().then(()=>tk),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>Zt(()=>import("./chunks/BuyProducts.js?ver=1.8.0"),[],import.meta.url),"./Coupon/Categories.vue":()=>Zt(()=>import("./chunks/Categories.js?ver=1.8.0"),[],import.meta.url),"./Coupon/Code.vue":()=>Zt(()=>import("./chunks/Code2.js?ver=1.8.0"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>Zt(()=>import("./chunks/GetProducts.js?ver=1.8.0"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>Zt(()=>import("./chunks/Categories2.js?ver=1.8.0"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>Zt(()=>import("./chunks/Product2.js?ver=1.8.0"),[],import.meta.url),"./Coupon/Products.vue":()=>Zt(()=>import("./chunks/Products.js?ver=1.8.0"),[],import.meta.url),"./McpSettings.vue":()=>Zt(()=>import("./chunks/McpSettings.js?ver=1.8.0"),[],import.meta.url),"./ModuleSettings.vue":()=>Zt(()=>import("./chunks/ModuleSettings.js?ver=1.8.0"),[],import.meta.url),"./PaymentView.vue":()=>Zt(()=>import("./chunks/PaymentView.js?ver=1.8.0"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>Zt(()=>import("./chunks/AddressComponent2.js?ver=1.8.0"),[],import.meta.url),"./StoreSettings/AppearanceComponent.vue":()=>Zt(()=>import("./chunks/AppearanceComponent.js?ver=1.8.0"),[],import.meta.url),"./StoreSettings/AppearancePreview.vue":()=>Zt(()=>import("./chunks/AppearancePreview.js?ver=1.8.0"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>Zt(()=>import("./chunks/CreatePageButton.js?ver=1.8.0"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>Zt(()=>import("./chunks/PageSelector.js?ver=1.8.0"),[],import.meta.url),"./StoreSettings/SubscriptionModeManager.vue":()=>Zt(()=>import("./chunks/SubscriptionModeManager.js?ver=1.8.0"),[],import.meta.url),"./TurnstileSettings.vue":()=>Zt(()=>import("./chunks/TurnstileSettings.js?ver=1.8.0"),[],import.meta.url)}),l=Cn(null);Te(()=>{n(i.name)});const n=async A=>{const p=`./${A}.vue`;a[p]&&(l.value=(await a[p]()).default)},i=e;return(A,p)=>(r(),h(P,null,[(r(),E(bl(l.value),ba({name:e.name,field:e.field,fieldKey:e.fieldKey,value:e.value,variant:e.variant,nesting:e.nesting,statePath:e.statePath,form:e.form,attribute:e.attribute,label:e.label,callback:e.callback},{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=m=>t.value=m)}),null,16,["modelValue"])),wa(A.$slots,"fieldNote"),wa(A.$slots,"validationError")],64))}},z2=["id"],Ed={__name:"FormGrid",props:{field:{type:Object},fieldKey:{type:String},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{var l,n,i,A,p,m,_,g,y,v;return r(),h("div",{class:"gap-2 grid grid-cols-dynamic sm:grid-cols-sm-dynamic md:grid-cols-md-dynamic lg:grid-cols-lg--dynamic",id:e.field.id||"",style:fa({"--grid-columns":((l=e.field.columns)==null?void 0:l.default)??2,"--sm-grid-columns":((n=e.field.columns)==null?void 0:n.sm)??((i=e.field.columns)==null?void 0:i.default)??2,"--md-grid-columns":((A=e.field.columns)==null?void 0:A.sm)??((p=e.field.columns)==null?void 0:p.md)??((m=e.field.columns)==null?void 0:m.default)??2,"--lg-grid-columns":((_=e.field.columns)==null?void 0:_.lg)??((g=e.field.columns)==null?void 0:g.md)??((y=e.field.columns)==null?void 0:y.sm)??((v=e.field.columns)==null?void 0:v.default)??2})},[s(Ui,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],12,z2)}}},j2=Object.freeze(Object.defineProperty({__proto__:null,default:Ed},Symbol.toStringTag,{value:"Module"})),q2={key:0,class:"fct-content-card-header"},Y2={key:0,class:"title"},W2={key:1,class:"fct-content-card-action"},J2={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:ue({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",q2,[e.title||t.$slots.title?(r(),h("div",Y2,[wa(t.$slots,"title",{},()=>[R(f(e.title),1)])])):x("",!0),t.$slots.action?(r(),h("div",W2,[wa(t.$slots,"action")])):x("",!0)])):x("",!0),o("div",{class:ue({"fct-content-card-body":e.show_heading!==!1})},[wa(t.$slots,"default")],2)],2))}},X2=["id"],Op={__name:"FormSection",props:{field:{type:Object},fieldKey:{type:String},value:{type:Object},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",{class:"form-section",id:e.field.id||""},[s(xe,null,{default:u(()=>[e.field.show_title!==!1?(r(),E(Ve,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):x("",!0),s(Be,null,{default:u(()=>[s(Ed,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,X2))}},Z2=Object.freeze(Object.defineProperty({__proto__:null,default:Op},Symbol.toStringTag,{value:"Module"})),Pp={__name:"FormTab",props:{field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){const t=e,a=M(""),l=M([]),n=Oa(),i=_=>{const g=_.props.name;A(g)},A=_=>{const g=new URL(window.location.href);g.hash=`#/settings/${_}`,window.history.replaceState(null,"",g.toString())},p=()=>{const g=window.location.hash.split("/").pop().split("#")[0];l.value=Object.keys(t.field.schema);const y=l.value.find(v=>v===g);y?a.value=y:a.value=t.field.default_tab};let m;return Te(()=>{m=n.beforeEach((_,g,y)=>{y(),setTimeout(()=>{p()},200)}),p()}),xt(()=>{m&&m()}),(_,g)=>{const y=C("el-tabs");return r(),E(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:ue(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:i,type:"card"},{default:u(()=>[s(Ui,{form:e.form,schema:e.field.schema,value:e.value,"state-path":e.statePath},null,8,["form","schema","value","state-path"])]),_:1},8,["modelValue","class"])}}},ek=Object.freeze(Object.defineProperty({__proto__:null,default:Pp},Symbol.toStringTag,{value:"Module"})),Hp={__name:"FormTabPane",props:{fieldKey:{type:String},field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{const l=C("el-tab-pane");return r(),E(l,{label:e.field.title,name:e.fieldKey},{default:u(()=>[s(Ui,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},tk=Object.freeze(Object.defineProperty({__proto__:null,default:Hp},Symbol.toStringTag,{value:"Module"}));class Ud{}ze(Ud,"attributesBuilders",async(t,a,l)=>{if(t.attributes||(t.attributes={}),t.class&&(t.attributes.class=t.class),t.placeholder&&(t.attributes.placeholder=t.placeholder),typeof a!="function")return t.attributes??{};let n={};typeof t.events!="object"&&(n={}),n.hasOwnProperty("onChange")&&typeof n.onChange=="function"?n.onChange=(...i)=>{l.data.hasChange=!0,n.onChange(i)}:n.onChange=()=>{l.data.hasChange=!0};for(let i in t.events)n[i]=(...A)=>{a(t.events[i],A)};for(let i in t.attributes??{}){let A=t.attributes[i];typeof A=="function"&&await a(A,{})}return{...t.attributes??{},...n}});const ak={__name:"LayoutRenderer",props:{form:{type:Object,required:!0},field:{type:Object,required:!0},value:{type:Object,required:!0},statePath:{type:String,required:!0},fieldKey:{type:String,required:!0},fullStatePath:{type:String,required:!0}},setup(e){const t=e;aa().ctx;const a=(i,A)=>{if(typeof i=="function")return i({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(A)&&A.length===1?A[0]:A})},l=M(!1),n=M({});return Te(async()=>{n.value=await Ud.attributesBuilders(t.field,a,t.form),l.value=!0}),(i,A)=>(r(),h(P,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),E(Ed,ba({key:0,class:e.field.wrapperClass,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},n.value),null,16,["class","form","field","value","fieldKey","statePath"])):x("",!0),e.field.type==="tab"&&typeof e.field.schema<"u"?(r(),E(Pp,ba({key:1,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},n.value),null,16,["form","field","value","statePath"])):x("",!0),e.field.type==="tab-pane"&&typeof e.field.schema<"u"&&typeof e.field.title<"u"?(r(),E(Hp,ba({key:2,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},n.value),null,16,["form","field","value","fieldKey","statePath"])):x("",!0),e.field.type==="section"?(r(),E(Op,ba({key:3,class:e.field.wrapperClass,form:e.form,statePath:e.field.disable_nesting===!0?e.fullStatePath:e.fieldKey+".",field:e.field,"field-key":e.fieldKey,value:e.field.disable_nesting===!0?e.value:e.value[e.fieldKey],nesting:e.field.disable_nesting===!0},n.value),null,16,["class","form","statePath","field","field-key","value","nesting"])):x("",!0)],64))}},Np={__name:"Switch",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue");return(a,l)=>{const n=C("el-switch");return r(),E(n,ba({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},lk=Object.freeze(Object.defineProperty({__proto__:null,default:Np},Symbol.toStringTag,{value:"Module"})),Kp={__name:"Checkbox",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue");return(a,l)=>{const n=C("el-checkbox");return r(),E(n,ba({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{"true-value":"yes","false-value":"no",disabled:e.field.disabled}),{default:u(()=>[R(f(e.label),1)]),_:1},16,["modelValue","disabled"])}}},sk=Object.freeze(Object.defineProperty({__proto__:null,default:Kp},Symbol.toStringTag,{value:"Module"})),nk=["innerHTML"],Gp={__name:"RadioGroup",props:Cl({field:{type:Object},statePath:{type:String},value:{required:!0},form:{type:Object},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue"),a=e,l=M([]),n=async(i="")=>{if(typeof a.field.options=="function")return l.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:i});if(Array.isArray(a.field.options))return l.value=[...a.field.options]};return Te(async()=>{await n()}),(i,A)=>{const p=C("el-radio"),m=C("el-radio-group");return r(),E(m,ba({modelValue:t.value,"onUpdate:modelValue":A[0]||(A[0]=_=>t.value=_)},e.attribute,{class:"inline-flex items-center gap-4"}),{default:u(()=>[(r(!0),h(P,null,ae(e.field.options,(_,g)=>(r(),h("div",{key:g,class:ue(_.option_class)},[s(p,{value:_.value},{default:u(()=>[R(f(_.label),1)]),_:2},1032,["value"]),_.note?(r(),h("div",{key:0,innerHTML:_.note,class:"radio-option-note"},null,8,nk)):x("",!0)],2))),128))]),_:1},16,["modelValue"])}}},ok=Object.freeze(Object.defineProperty({__proto__:null,default:Gp},Symbol.toStringTag,{value:"Module"})),ik=["innerHTML"],ln={__name:"Input",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=aa().ctx,a=Tl(e,"modelValue"),l=e,n=M(),i=async()=>{typeof l.field.prefix=="function"?n.value=await l.callback(l.field.prefix):n.value=l.field.prefix};return Te(()=>{i()}),dm(()=>{i()}),G(()=>l.fieldKey==="amount"?l.form.data.values.type==="fixed"?Ke.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(A,p)=>{var _;const m=C("el-input");return r(),E(m,ba({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),sa({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:u(()=>[s(Rp,{form:e.form,name:e.field.prefix.component,field:e.field,value:e.value},null,8,["form","name","field","value"])]),key:"0"}:e.field.prefix?{name:"prefix",fn:u(()=>[o("div",{innerHTML:n.value},null,8,ik)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},rk=Object.freeze(Object.defineProperty({__proto__:null,default:ln},Symbol.toStringTag,{value:"Module"})),dk={key:0,class:"fct-color-presets-section"},uk=["aria-label"],ck=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],Ak={class:"fct-color-custom-row"},pk={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},fk={key:1,class:"fct-color-picker-box"},mk={class:"fct-color-picker-trigger-wrap"},hk={class:"fct-color-picker-action-wrap"},_k=["disabled","placeholder","aria-label","onKeydown"],Id={__name:"ColorPicker",props:Cl({field:{type:Object},statePath:{type:String},value:{default:null},form:{type:Object},callback:{type:Function},label:{type:String},attribute:{default:()=>({})},withPresets:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue"),a=()=>{t.value=""},l=M(t.value||""),n=v=>{let k=(v||"").trim();return k&&k[0]!=="#"&&(k="#"+k),/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(k)?k.toLowerCase():""};be(t,v=>{n(l.value)!==(v||"")&&(l.value=v||"")});const i=()=>{const v=n(l.value);v&&(t.value=v)},A=()=>{const v=n(l.value);v&&(t.value=v),l.value=v||t.value||""},p=v=>v?Fs.findIndex(k=>k.toLowerCase()===v.toLowerCase()):-1,m=M(Math.max(0,p(t.value)));be(t,v=>{const k=p(v);k>=0&&(m.value=k)});const _=M([]),g=(v,k)=>{t.value=v,m.value=k},y=(v,k)=>{let b=k;if(v.key==="ArrowRight"||v.key==="ArrowDown")b=(k+1)%Fs.length;else if(v.key==="ArrowLeft"||v.key==="ArrowUp")b=(k-1+Fs.length)%Fs.length;else if(v.key==="Home")b=0;else if(v.key==="End")b=Fs.length-1;else return;v.preventDefault(),g(Fs[b],b),$e(()=>{_.value[b]&&_.value[b].focus()})};return(v,k)=>{const b=C("el-color-picker"),w=C("el-input");return e.withPresets?(r(),h("div",dk,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":c(d)("Color presets")},[(r(!0),h(P,null,ae(c(Fs),(B,S)=>(r(),h("button",{key:B,ref_for:!0,ref:V=>_.value[S]=V,type:"button",class:ue(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===B.toLowerCase()}]),style:fa({background:B,"--swatch-color":B}),"aria-label":c(d)("Select color %1$s",B),"aria-pressed":!!(t.value&&t.value.toLowerCase()===B.toLowerCase()),tabindex:S===m.value?0:-1,onClick:V=>g(B,S),onKeydown:V=>y(V,S)},null,46,ck))),128))],8,uk),o("div",Ak,[o("div",pk,[s(b,ba({modelValue:t.value,"onUpdate:modelValue":k[0]||(k[0]=B=>t.value=B),"color-format":"hex"},e.attribute,{disabled:e.field&&e.field.disabled}),null,16,["modelValue","disabled"])]),s(w,{modelValue:t.value,"onUpdate:modelValue":k[1]||(k[1]=B=>t.value=B),placeholder:c(d)("#000000"),"aria-label":c(d)("Hex color code")},null,8,["modelValue","placeholder","aria-label"])])])):(r(),h("div",fk,[o("div",mk,[s(b,ba({modelValue:t.value,"onUpdate:modelValue":k[2]||(k[2]=B=>t.value=B)},e.attribute,{disabled:e.field&&e.field.disabled,"popper-class":"fct-color-picker-popover"}),null,16,["modelValue","disabled"]),t.value?x("",!0):(r(),E(X,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),o("div",hk,[Jt(o("input",{"onUpdate:modelValue":k[3]||(k[3]=B=>l.value=B),type:"text",class:"fct-color-picker-hex-input",maxlength:"7",spellcheck:"false",disabled:e.field&&e.field.disabled,placeholder:c(d)("Add..."),"aria-label":c(d)("Hex color code"),onInput:i,onBlur:A,onKeydown:ea(Ge(A,["prevent"]),["enter"])},null,40,_k),[[Zc,l.value]]),t.value?(r(),E(X,{key:0,name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})):x("",!0)])]))}}},vk=Object.freeze(Object.defineProperty({__proto__:null,default:Id},Symbol.toStringTag,{value:"Module"})),zp={__name:"Date",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue");return(a,l)=>{const n=C("el-date-picker");return r(),E(n,ba({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},gk=Object.freeze(Object.defineProperty({__proto__:null,default:zp},Symbol.toStringTag,{value:"Module"})),jp={__name:"Time",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue");return(a,l)=>{const n=C("el-time-select");return r(),E(n,ba({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},yk=Object.freeze(Object.defineProperty({__proto__:null,default:jp},Symbol.toStringTag,{value:"Module"})),bk={key:0},qp={__name:"Select",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue"),a=e,l=M([]),n=M(!1),i=async(p="")=>{n.value=!0,typeof a.field.options=="function"&&(l.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:p})),Array.isArray(a.field.options)&&(l.value=[...a.field.options]),n.value=!1};Te(async()=>{await i()});const A=p=>typeof p.disabled=="function"?a.callback(p.disabled,{}):p.disabled;return(p,m)=>{const _=C("el-option"),g=C("el-select");return r(),E(g,ba({modelValue:t.value,"onUpdate:modelValue":m[0]||(m[0]=y=>t.value=y)},e.attribute,{"remote-method":i,loading:n.value,filterable:e.field.filterable===!0,clearable:e.field.clearable===!0,disabled:e.field.disabled}),{default:u(()=>[(r(!0),h(P,null,ae(l.value,(y,v)=>(r(),E(_,{key:v,value:y.value,label:y.label,disabled:A(y)},{default:u(()=>[y.slot?(r(),h("span",bk,f(y.slot),1)):x("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},wk=Object.freeze(Object.defineProperty({__proto__:null,default:qp},Symbol.toStringTag,{value:"Module"})),Yp={__name:"RemoteSearchableSelect",props:Cl({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue"),a=e,l=M(!1),n=M(a.field.options||[]),i=A=>{if(a.field.search_only_on_type===!0){if(A.query.length===0)return}else if(A.query.length<1&&n.value.length>0)return;l.value=!0,ce.get("forms/search_options",{search_by:A.query,search_for:A.key}).then(p=>{n.value=p.options,l.value=!1})};return(A,p)=>{const m=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=g=>t.value=g),filterable:"",remote:"",placeholder:e.field.placeholder??c(d)("Please enter a keyword"),"remote-method":g=>{i({query:g,key:e.field.remote_key})},loading:l.value,multiple:e.field.multiple},{default:u(()=>[(r(!0),h(P,null,ae(n.value,g=>(r(),E(m,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},Ck=Object.freeze(Object.defineProperty({__proto__:null,default:Yp},Symbol.toStringTag,{value:"Module"}));function mn(e,t){t===void 0&&(t={});var a=t.insertAt;if(e&&typeof document<"u"){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",a==="top"&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}mn(".vel-fade-enter-active,.vel-fade-leave-active{-webkit-transition:all .3s ease;transition:all .3s ease}.vel-fade-enter-from,.vel-fade-leave-to{opacity:0}.vel-img-swiper{display:block;position:relative}.vel-modal{background:rgba(0,0,0,.5);bottom:0;left:0;margin:0;position:fixed;right:0;top:0;z-index:9998}.vel-img-wrapper{left:50%;margin:0;position:absolute;top:50%;-webkit-transform:translate(-50% -50%);transform:translate(-50% -50%);-webkit-transition:.3s linear;transition:.3s linear;will-change:transform opacity}.vel-img,.vel-img-wrapper{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-img{background-color:rgba(0,0,0,.7);-webkit-box-shadow:0 5px 20px 2px rgba(0,0,0,.7);box-shadow:0 5px 20px 2px rgba(0,0,0,.7);display:block;max-height:80vh;max-width:80vw;position:relative;-webkit-transition:-webkit-transform .3s ease-in-out;transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out;transition:transform .3s ease-in-out,-webkit-transform .3s ease-in-out}@media (max-width:750px){.vel-img{max-height:95vh;max-width:85vw}}.vel-btns-wrapper{position:static}.vel-btns-wrapper .btn__close,.vel-btns-wrapper .btn__next,.vel-btns-wrapper .btn__prev{-webkit-tap-highlight-color:transparent;color:#fff;cursor:pointer;font-size:32px;opacity:.6;outline:none;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:.15s linear;transition:.15s linear;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-btns-wrapper .btn__close:hover,.vel-btns-wrapper .btn__next:hover,.vel-btns-wrapper .btn__prev:hover{opacity:1}.vel-btns-wrapper .btn__close.disable,.vel-btns-wrapper .btn__close.disable:hover,.vel-btns-wrapper .btn__next.disable,.vel-btns-wrapper .btn__next.disable:hover,.vel-btns-wrapper .btn__prev.disable,.vel-btns-wrapper .btn__prev.disable:hover{cursor:default;opacity:.2}.vel-btns-wrapper .btn__next{right:12px}.vel-btns-wrapper .btn__prev{left:12px}.vel-btns-wrapper .btn__close{right:10px;top:24px}@media (max-width:750px){.vel-btns-wrapper .btn__next,.vel-btns-wrapper .btn__prev{font-size:20px}.vel-btns-wrapper .btn__close{font-size:24px}.vel-btns-wrapper .btn__next{right:4px}.vel-btns-wrapper .btn__prev{left:4px}}.vel-modal.is-rtl .vel-btns-wrapper .btn__next{left:12px;right:auto}.vel-modal.is-rtl .vel-btns-wrapper .btn__prev{left:auto;right:12px}@media (max-width:750px){.vel-modal.is-rtl .vel-btns-wrapper .btn__next{left:4px;right:auto}.vel-modal.is-rtl .vel-btns-wrapper .btn__prev{left:auto;right:4px}}.vel-modal.is-rtl .vel-img-title{direction:rtl}");mn('.vel-loading{left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-loading .ring{display:inline-block;height:64px;width:64px}.vel-loading .ring:after{-webkit-animation:ring 1.2s linear infinite;animation:ring 1.2s linear infinite;border-color:hsla(0,0%,100%,.7) transparent;border-radius:50%;border-style:solid;border-width:5px;content:" ";display:block;height:46px;margin:1px;width:46px}@-webkit-keyframes ring{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes ring{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}');mn(".vel-on-error{left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-on-error .icon{color:#aaa;font-size:80px}");mn(".vel-img-title{bottom:60px;color:#ccc;cursor:default;font-size:12px;left:50%;line-height:1;max-width:80%;opacity:.8;overflow:hidden;position:absolute;text-align:center;text-overflow:ellipsis;-webkit-transform:translate(-50%);transform:translate(-50%);-webkit-transition:opacity .15s;transition:opacity .15s;white-space:nowrap}.vel-img-title:hover{opacity:1}");mn(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");mn(".vel-toolbar{border-radius:4px;bottom:8px;display:-webkit-box;display:-ms-flexbox;display:flex;left:50%;opacity:.9;overflow:hidden;padding:0;position:absolute;-webkit-transform:translate(-50%);transform:translate(-50%)}.vel-toolbar,.vel-toolbar .toolbar-btn{background-color:#2d2d2d;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-toolbar .toolbar-btn{-ms-flex-negative:0;-webkit-tap-highlight-color:transparent;color:#fff;cursor:pointer;flex-shrink:0;font-size:20px;outline:none;padding:6px 10px}.vel-toolbar .toolbar-btn:active,.vel-toolbar .toolbar-btn:hover{background-color:#3d3d3d}");const Fl="vel",Rl=Bs({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>s("svg",{class:`${Fl}-icon icon`,"aria-hidden":"true"},[s("use",{"xlink:href":`#icon-${e.type}`},null)])}),Fi=typeof window<"u",sn=()=>{};let Wp=!1;if(Fi)try{const e={};Object.defineProperty(e,"passive",{get(){Wp=!0}}),window.addEventListener("test-passive",sn,e)}catch{}const nc=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];Fi&&e.addEventListener(t,a,!!Wp&&{capture:!1,passive:l})},oc=(e,t,a)=>{Fi&&e.removeEventListener(t,a)},kk=e=>{e.preventDefault()},Bk=Object.prototype.toString,Vd=e=>t=>Bk.call(t).slice(8,-1)===e,xk=e=>!!e&&Vd("Object")(e),ic=e=>!!e&&Vd("String")(e);function Sk(e){return e!=null}const $k=Bs({name:"Toolbar",props:{zoomIn:{type:Function,default:sn},zoomOut:{type:Function,default:sn},rotateLeft:{type:Function,default:sn},rotateRight:{type:Function,default:sn},resize:{type:Function,default:sn},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>s("div",{class:`${Fl}-toolbar`},[!e.zoomDisabled&&s(P,null,[s("div",{role:"button","aria-label":"zoom in button",class:"toolbar-btn toolbar-btn__zoomin",onClick:e.zoomIn},[s(Rl,{type:"zoomin"},null)]),s("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[s(Rl,{type:"zoomout"},null)])]),s("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[s(Rl,{type:"resize"},null)]),!e.rotateDisabled&&s(P,null,[s("div",{role:"button","aria-label":"image rotate left button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateLeft},[s(Rl,{type:"rotate-left"},null)]),s("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[s(Rl,{type:"rotate-right"},null)])])])}),Fk=()=>s("div",{class:`${Fl}-loading`},[s("div",{class:"ring"},null)]),Ek=()=>s("div",{class:`${Fl}-on-error`},[s("div",{class:"ring"},null),s(Rl,{type:"img-broken"},null)]),Uk=(e,t)=>{let{slots:a}=t;return s("div",{class:`${Fl}-img-title`},[a.default?a.default():""])},Ik=Bs({name:"DefaultIcons",setup:()=>()=>s("svg",{"aria-hidden":!0,style:"position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden;"},[s("symbol",{id:"icon-rotate-right",viewBox:"0 0 1024 1024"},[s("path",{d:"M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973z m282.559912-479.07185A509.887841 509.887841 0 0 0 511.99984 0.00032C229.215928 0.00032 0 229.216248 0 512.00016s229.215928 511.99984 511.99984 511.99984 511.99984-229.215928 511.99984-511.99984c0-3.743999-0.032-7.455998-0.128-11.167997-1.631999-11.295996-8.159997-27.103992-31.87199-27.103991-27.487991 0-31.67999 21.247993-32.03199 32.06399l0.032 4.127999a30.62399 30.62399 0 0 0 0.16 2.079999H959.9997c0 247.423923-200.575937 447.99986-447.99986 447.99986S63.99998 759.424083 63.99998 512.00016 264.575917 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 1 277.439913 96.22397l-94.91197 91.679971c-25.439992 24.607992-17.439995 44.991986 17.887994 45.599986l188.031942 3.295999a64.31998 64.31998 0 0 0 65.055979-62.84798l3.295999-188.127942C969.407697 15.040315 949.311703 5.792318 923.871711 30.368311l-87.999972 85.023973z",fill:""},null)]),s("symbol",{id:"icon-rotate-left",viewBox:"0 0 1024 1024"},[s("path",{d:"M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973zM188.159941 115.392284A509.887841 509.887841 0 0 1 511.99984 0.00032c282.783912 0 511.99984 229.215928 511.99984 511.99984s-229.215928 511.99984-511.99984 511.99984S0 794.784072 0 512.00016c0-3.743999 0.032-7.455998 0.128-11.167997 1.631999-11.295996 8.159997-27.103992 31.87199-27.103991 27.487991 0 31.67999 21.247993 32.03199 32.06399L63.99998 509.920161a30.62399 30.62399 0 0 1-0.16 2.079999H63.99998c0 247.423923 200.575937 447.99986 447.99986 447.99986s447.99986-200.575937 447.99986-447.99986S759.423763 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 0-277.439913 96.22397l94.91197 91.679971c25.439992 24.607992 17.439995 44.991986-17.887994 45.599986L123.551961 300.800226a64.31998 64.31998 0 0 1-65.055979-62.84798l-3.295999-188.127942C54.591983 15.040315 74.687977 5.792318 100.127969 30.368311l87.999972 85.023973z",fill:""},null)]),s("symbol",{id:"icon-resize",viewBox:"0 0 1024 1024"},[s("path",{d:"M456.036919 791.8108 270.553461 791.8108 460.818829 601.572038l-39.593763-39.567157L231.314785 751.915162l0.873903-183.953615c0-15.465227-12.515035-27.981285-27.981285-27.981285s-27.981285 12.515035-27.981285 27.981285l0 251.829516c0 8.3072 3.415796 14.975063 8.826016 19.564591 5.082762 5.192256 12.132318 8.416693 19.947308 8.416693l251.036453 0c15.46625 0 27.981285-12.514012 27.981285-27.981285C484.018204 804.325835 471.504192 791.8108 456.036919 791.8108zM838.945819 184.644347c-5.082762-5.191232-12.132318-8.416693-19.947308-8.416693L567.961034 176.227654c-15.46625 0-27.981285 12.515035-27.981285 27.981285 0 15.46625 12.514012 27.981285 27.981285 27.981285l185.483458 0L563.206754 422.427962l39.567157 39.567157 189.910281-189.910281-0.873903 183.953615c0 15.46625 12.514012 27.981285 27.981285 27.981285s27.981285-12.514012 27.981285-27.981285L847.772858 204.208938C847.771835 195.902762 844.356039 189.234899 838.945819 184.644347zM847.771835 64.303538 176.227142 64.303538c-61.809741 0-111.924115 50.115398-111.924115 111.924115l0 671.544693c0 61.809741 50.114374 111.924115 111.924115 111.924115l671.544693 0c61.809741 0 111.924115-50.114374 111.924115-111.924115l0-671.544693C959.69595 114.418936 909.581576 64.303538 847.771835 64.303538zM903.733381 847.772346c0 30.878265-25.056676 55.962569-55.962569 55.962569L176.227142 903.734916c-30.90487 0-55.962569-25.084305-55.962569-55.962569l0-671.544693c0-30.9325 25.056676-55.962569 55.962569-55.962569l671.544693 0c30.90487 0 55.962569 25.03007 55.962569 55.962569L903.734404 847.772346z"},null)]),s("symbol",{id:"icon-img-broken",viewBox:"0 0 1024 1024"},[s("path",{d:"M810.666667 128H213.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333v597.333334c0 46.933333 38.4 85.333333 85.333333 85.333333h597.333334c46.933333 0 85.333333-38.4 85.333333-85.333333V213.333333c0-46.933333-38.4-85.333333-85.333333-85.333333z m0 682.666667H213.333333v-195.413334l42.24 42.24 170.666667-170.666666 170.666667 170.666666 170.666666-170.24L810.666667 530.346667V810.666667z m0-401.493334l-43.093334-43.093333-170.666666 171.093333-170.666667-170.666666-170.666667 170.666666-42.24-42.666666V213.333333h597.333334v195.84z"},null)]),s("symbol",{id:"icon-prev",viewBox:"0 0 1024 1024"},[s("path",{d:"M784.652701 955.6957 346.601985 517.644983c-2.822492-2.822492-2.822492-7.902977 0-11.289967l439.179713-439.179713c6.77398-6.77398 10.725469-16.370452 10.725469-25.966924L796.507166 36.692393c0-20.32194-16.370452-36.692393-36.692393-36.692393l-4.515987 0c-9.596472 0-19.192944 3.951488-25.966924 10.725469L250.072767 489.420066c-12.418964 12.418964-12.418964 32.740904 0 45.159868l477.565601 477.565601c7.338479 7.338479 17.499449 11.854465 28.224917 11.854465l0 0c22.015436 0 40.079383-18.063947 40.079383-40.079383l0 0C796.507166 973.759647 791.99118 963.598677 784.652701 955.6957z"},null)]),s("symbol",{id:"icon-next",viewBox:"0 0 1024 1024"},[s("path",{d:"M246.121279 955.6957l438.050717-438.050717c2.822492-2.822492 2.822492-7.902977 0-11.289967L244.992282 67.175303c-6.77398-6.77398-10.725469-16.370452-10.725469-25.966924L234.266814 36.692393C234.266814 16.370452 250.637266 0 270.959206 0l4.515987 0c9.596472 0 19.192944 3.951488 25.966924 10.725469l478.694598 478.694598c12.418964 12.418964 12.418964 32.740904 0 45.159868l-477.565601 477.565601c-7.338479 7.338479-17.499449 11.854465-28.224917 11.854465l0 0c-22.015436 0-40.079383-18.063947-40.079383-40.079383l0 0C234.266814 973.759647 238.7828 963.598677 246.121279 955.6957z"},null)]),s("symbol",{id:"icon-zoomin",viewBox:"0 0 1024 1024"},[s("path",{d:"M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z"},null),s("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null),s("path",{d:"M367.488 238.144h127.104v390.72H367.488z"},null)]),s("symbol",{id:"icon-close",viewBox:"0 0 1024 1024"},[s("path",{d:"M570.24 512l259.2 259.2-58.88 58.24L512 570.24l-261.12 261.12-58.24-58.24L453.76 512 194.56 252.8l58.24-58.24L512 453.76l261.12-261.12 58.24 58.24z"},null)]),s("symbol",{id:"icon-zoomout",viewBox:"0 0 1024 1024"},[s("path",{d:"M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z"},null),s("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null)])])}),Mn=Fi?window:global;let rc=Date.now();function Vk(e){const t=Date.now(),a=Math.max(0,16-(t-rc)),l=setTimeout(e,a);return rc=t+a,l}function or(e){return(Mn.requestAnimationFrame||Vk).call(Mn,e)}function dc(e){(Mn.cancelAnimationFrame||Mn.clearTimeout).call(Mn,e)}function uc(e,t){const a=e.clientX-t.clientX,l=e.clientY-t.clientY;return Math.sqrt(a*a+l*l)}function ir(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!um(e)}var rr=Bs({name:"VueEasyLightbox",props:{imgs:{type:[Array,String],default:()=>""},visible:{type:Boolean,default:!1},index:{type:Number,default:0},scrollDisabled:{type:Boolean,default:!0},escDisabled:{type:Boolean,default:!1},moveDisabled:{type:Boolean,default:!1},titleDisabled:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!0},teleport:{type:[String,Object],default:null},swipeTolerance:{type:Number,default:50},loop:{type:Boolean,default:!1},rtl:{type:Boolean,default:!1},zoomScale:{type:Number,default:.12},maxZoom:{type:Number,default:3},minZoom:{type:Number,default:.1},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1},pinchDisabled:{type:Boolean,default:!1},dblclickDisabled:{type:Boolean,default:!1}},emits:{hide:()=>!0,"on-error":e=>!0,"on-prev":(e,t)=>!0,"on-next":(e,t)=>!0,"on-prev-click":(e,t)=>!0,"on-next-click":(e,t)=>!0,"on-index-change":(e,t)=>!0,"on-rotate":e=>!0},setup(e,t){let{emit:a,slots:l}=t;const{imgRef:n,imgState:i,setImgSize:A}=(()=>{const fe=M(),ye=Ds({width:0,height:0,maxScale:1});return{imgRef:fe,imgState:ye,setImgSize:()=>{if(fe.value){const{width:De,height:Le,naturalWidth:At}=fe.value;ye.maxScale=At/De,ye.width=De,ye.height=Le}}}})(),p=M(e.index),m=M(""),_=Ds({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=Ds({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=G(()=>{return fe=e.imgs,Vd("Array")(fe)?e.imgs.map(ye=>typeof ye=="string"?{src:ye}:function(De){return xk(De)&&ic(De.src)}(ye)?ye:void 0).filter(Sk):ic(e.imgs)?[{src:e.imgs}]:[];var fe}),v=G(()=>y.value[p.value]),k=G(()=>{var fe;return(fe=y.value[p.value])==null?void 0:fe.src}),b=G(()=>{var fe;return(fe=y.value[p.value])==null?void 0:fe.title}),w=G(()=>{var fe;return(fe=y.value[p.value])==null?void 0:fe.alt}),B=G(()=>({cursor:g.loadError?"default":e.moveDisabled?g.dragging?"grabbing":"grab":"move",top:`calc(50% + ${_.top}px)`,left:`calc(50% + ${_.left}px)`,transition:g.dragging||g.gesturing?"none":"",transform:`translate(-50%, -50%) scale(${_.scale}) rotate(${_.rotateDeg}deg)`})),S=()=>{a("hide")},V=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},F=(fe,ye)=>{const De=p.value;V(),p.value=fe,y.value[p.value]===y.value[fe]&&$e(()=>{g.loading=!1}),e.visible&&De!==fe&&(ye&&ye(De,fe),a("on-index-change",De,fe))},$=()=>{const fe=p.value,ye=e.loop?(fe+1)%y.value.length:fe+1;!e.loop&&ye>y.value.length-1||F(ye,(De,Le)=>{a("on-next",De,Le),a("on-next-click",De,Le)})},U=()=>{const fe=p.value;let ye=fe-1;if(fe===0){if(!e.loop)return;ye=y.value.length-1}F(ye,(De,Le)=>{a("on-prev",De,Le),a("on-prev-click",De,Le)})},D=fe=>{Math.abs(1-fe)<.05?fe=1:Math.abs(i.maxScale-fe)<.05&&(fe=i.maxScale),_.lastScale=_.scale,_.scale=fe},T=()=>{const fe=_.scale+e.zoomScale;fe<i.maxScale*e.maxZoom&&D(fe)},I=()=>{const fe=_.scale-e.zoomScale;fe>e.minZoom&&D(fe)},L=()=>{const fe=_.rotateDeg%360;a("on-rotate",Math.abs(fe<0?fe+360:fe))},O=()=>{_.rotateDeg-=90,L()},Q=()=>{_.rotateDeg+=90,L()},H=()=>{_.scale=1,_.top=0,_.left=0},K=function(){let fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&fe===0},{onMouseDown:W,onMouseMove:z,onMouseUp:Y}=((fe,ye,De)=>{let Le,At=!1;return{onMouseDown:mt=>{fe.initX=fe.lastX=mt.clientX,fe.initY=fe.lastY=mt.clientY,ye.dragging=!0,At=!1,mt.stopPropagation()},onMouseUp:mt=>{De(mt.button)&&dc(Le),ye.dragging=!1,At=!1},onMouseMove:mt=>{if(ye.dragging)if(De(mt.button)){if(At)return;At=!0,Le=or(()=>{const{top:Mt,left:Dt,lastY:Je,lastX:pt}=fe;fe.top=Mt-Je+mt.clientY,fe.left=Dt-pt+mt.clientX,fe.lastX=mt.clientX,fe.lastY=mt.clientY,At=!1})}else fe.lastX=mt.clientX,fe.lastY=mt.clientY;mt.stopPropagation()}}})(_,g,K),{onTouchStart:Z,onTouchMove:re,onTouchEnd:q}=((fe,ye,De,Le,At)=>{let mt,Mt=!1;return{onTouchStart:Dt=>{const{touches:Je}=Dt;Je.length>1&&At()?(De.gesturing=!0,ye.touches=Je):(ye.initX=ye.lastX=Je[0].clientX,ye.initY=ye.lastY=Je[0].clientY,De.dragging=!0),Dt.stopPropagation()},onTouchMove:Dt=>{if(Mt)return;const{touches:Je}=Dt,{lastX:pt,lastY:qt,left:Ct,top:$t,scale:Nt}=ye;if(!De.gesturing&&De.dragging){if(!Je[0])return;const{clientX:Kt,clientY:Tt}=Je[0];Le()?mt=or(()=>{ye.lastX=Kt,ye.lastY=Tt,ye.top=$t-qt+Tt,ye.left=Ct-pt+Kt,Mt=!1}):(ye.lastX=Kt,ye.lastY=Tt)}else De.gesturing&&ye.touches.length>1&&Je.length>1&&At()&&(mt=or(()=>{const Kt=(uc(ye.touches[0],ye.touches[1])-uc(Je[0],Je[1]))/fe.width;ye.touches=Je;const Tt=Nt-1.3*Kt;Tt>.5&&Tt<1.5*fe.maxScale&&(ye.scale=Tt),Mt=!1}))},onTouchEnd:()=>{dc(mt),De.dragging=!1,De.gesturing=!1,Mt=!1}}})(i,_,g,K,()=>!e.pinchDisabled),Ae=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},ie=fe=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),fe.deltaY<0?T():I())},J=fe=>{const ye=fe;e.visible&&(!e.escDisabled&&ye.key==="Escape"&&e.visible&&S(),ye.key==="ArrowLeft"&&(e.rtl?$():U()),ye.key==="ArrowRight"&&(e.rtl?U():$()))},N=()=>{e.maskClosable&&S()},le=()=>{A()},ee=()=>{g.loading=!1},pe=fe=>{g.loading=!1,g.loadError=!0,a("on-error",fe)},de=()=>{e.visible&&A()};be(()=>e.index,fe=>{fe<0||fe>=y.value.length||F(fe)}),be(()=>g.dragging,(fe,ye)=>{const De=!fe&&ye;if(!K()&&De){const Le=_.lastX-_.initX,At=_.lastY-_.initY,mt=e.swipeTolerance;Math.abs(Le)>Math.abs(At)&&(Le<-1*mt?$():Le>mt&&U())}}),be(()=>e.visible,fe=>{if(fe){V();const ye=y.value.length;if(ye===0)return p.value=0,g.loading=!1,void $e(()=>g.loadError=!0);p.value=e.index>=ye?ye-1:e.index<0?0:e.index,e.scrollDisabled&&Ue()}else e.scrollDisabled&&Ce()});const Ue=()=>{document&&(m.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},Ce=()=>{document&&(document.body.style.overflowY=m.value)};Te(()=>{nc(document,"keydown",J),nc(window,"resize",de)}),Ga(()=>{oc(document,"keydown",J),oc(window,"resize",de),e.scrollDisabled&&Ce()});const Se=()=>g.loading?l.loading?l.loading({key:"loading"}):s(Fk,{key:"img-loading"},null):g.loadError?l.onerror?l.onerror({key:"onerror"}):s(Ek,{key:"img-on-error"},null):s("div",{class:`${Fl}-img-wrapper`,style:B.value,key:"img-wrapper"},[s("img",{alt:w.value,ref:n,draggable:"false",class:`${Fl}-img`,src:k.value,onMousedown:W,onMouseup:Y,onMousemove:z,onTouchstart:Z,onTouchmove:re,onTouchend:q,onLoad:le,onDblclick:Ae,onDragstart:fe=>{fe.preventDefault()}},null)]),ge=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:U});if(y.value.length<=1)return;const fe=!e.loop&&p.value<=0;return s("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(fe?"disable":""),onClick:U},[e.rtl?s(Rl,{type:"next"},null):s(Rl,{type:"prev"},null)])},ke=()=>{if(l["next-btn"])return l["next-btn"]({next:$});if(y.value.length<=1)return;const fe=!e.loop&&p.value>=y.value.length-1;return s("div",{role:"button","aria-label":"next image button",class:"btn__next "+(fe?"disable":""),onClick:$},[e.rtl?s(Rl,{type:"prev"},null):s(Rl,{type:"next"},null)])},Oe=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return l.title?l.title({currentImg:v.value}):b.value?s(Uk,null,{default:()=>[b.value]}):void 0},Ee=()=>{let fe;if(e.visible)return s("div",{onTouchmove:kk,class:[`${Fl}-modal`,e.rtl?"is-rtl":""],onClick:Ge(N,["self"]),onWheel:ie},[s(Ik,null,null),s(Gl,{name:`${Fl}-fade`,mode:"out-in"},ir(fe=Se())?fe:{default:()=>[fe]}),s("img",{style:"display:none;",src:k.value,onError:pe,onLoad:ee},null),s("div",{class:`${Fl}-btns-wrapper`},[ge(),ke(),Oe(),l["close-btn"]?l["close-btn"]({close:S}):s("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:S},[s(Rl,{type:"close"},null)]),l.toolbar?l.toolbar({toolbarMethods:{zoomIn:T,zoomOut:I,rotate:O,rotateLeft:O,rotateRight:Q,resize:H},zoomIn:T,zoomOut:I,rotate:O,rotateLeft:O,rotateRight:Q,resize:H}):s($k,{zoomIn:T,zoomOut:I,resize:H,rotateLeft:O,rotateRight:Q,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let fe;if(e.teleport){let ye;return s(Ai,{to:e.teleport},{default:()=>[s(Gl,{name:`${Fl}-fade`},ir(ye=Ee())?ye:{default:()=>[ye]})]})}return s(Gl,{name:`${Fl}-fade`},ir(fe=Ee())?fe:{default:()=>[fe]})}}});const Dk=Object.assign(rr,{install:e=>{e.component(rr.name,rr)}}),Tk={name:"Attachments",components:{MediaButton:wA,VueEasyLightbox:Dk,IconButton:tt,Delete:iA},props:{multiple:Boolean,attachments:{type:[Array,Object],default:()=>[]},empty_text:String,isSingle:Boolean,title:String,type:String,icon:String,showList:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!0},previewImage:{type:Boolean,default:!0},mediaInputSize:{type:String},mediaInputBg:{type:String}},emits:["removeImage","mediaUploaded"],data(){return{visible:!1,imageIndex:0,lightboxData:[],images:M([])}},computed:{showMediaButtonAsIcon:function(){return!this.multiple&&this.attachments.length===1}},watch:{attachments:{handler:function(e,t){return this.lightboxData=[],Array.isArray(e)&&e.length>0&&e.map((a,l)=>{this.lightboxData.push(a.url)}),e},deep:!0}},mounted:function(){Array.isArray(this.attachments)&&this.attachments.length>0&&this.attachments.forEach(e=>{this.lightboxData.push(e.url),this.images.push({id:e.id,url:e.url,title:e.title})})},methods:{translate:d,removeImageEvent(e){this.$emit("removeImage",e)},onMediaSelected(e){this.images=e.map(t=>({id:t.id,title:t.title,url:t.url})),this.$emit("mediaUploaded",this.images)}}},Qk={class:"fct-attachments-wrap",style:{position:"relative"}},Mk={class:"fct-attachment-img-wrap"},Lk=["src","alt","onClick"],Rk={class:"fct-attachments-button"};function Ok(e,t,a,l,n,i){const A=C("VueEasyLightbox"),p=C("MediaButton"),m=C("IconButton"),_=C("Delete");return r(),h(P,null,[s(A,{visible:n.visible,imgs:n.lightboxData,index:n.imageIndex,onHide:t[0]||(t[0]=()=>{n.visible=!1})},null,8,["visible","imgs","index"]),o("div",Qk,[a.attachments?(r(),h("ul",{key:0,class:ue(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(r(!0),h(P,{key:0},ae(a.attachments,(g,y)=>(r(),h("li",{key:y,class:ue([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",Mk,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{n.imageIndex=y,n.visible=!0}},null,8,Lk)):x("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),E(m,{key:1,size:"x-small"},{default:u(()=>[s(p,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)]),o("div",Rk,[a.showDeleteButton?(r(),E(m,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:Ge(v=>i.removeImageEvent(y),["prevent"]),title:i.translate("Delete media")},{default:u(()=>[a.multiple?(r(),E(_,{key:0})):(r(),h(P,{key:1},[R(f(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):x("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),E(m,{key:1,size:"x-small"},{default:u(()=>[s(p,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)])],2))),128)):x("",!0),i.showMediaButtonAsIcon?x("",!0):(r(),h("li",{key:1,class:ue([a.mediaInputSize,a.mediaInputBg])},[s(p,{"icon-mode":!1,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])],2))],2)):x("",!0),wa(e.$slots,"default")])],64)}const Jp=nt(Tk,[["render",Ok]]),Pk={key:0},Hk={key:0,class:"setting-label"},Ei={__name:"MediaInput",props:{modelValue:{default:""},showSupported:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},fullWidth:{type:Boolean,default:!1},icon:{type:String},title:{type:String},mediaInputSize:{type:String},mediaInputBg:{type:String},field:{type:Object}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,n=M();let i=M([]);const A=()=>{a.multiple?n.value=[]:n.value="",i.value=[],l("update:modelValue",n.value)},p=_=>{if(_.length)if(a.multiple){n.value=[],i.value=[];for(const g of _)n.value.push(g),i.value.push(g)}else n.value=_,i.value=_;l("update:modelValue",n.value)};be(()=>a.modelValue,_=>{Array.isArray(_)&&_.length>0?n.value=_:_&&typeof _=="string"&&_!==""?n.value=[_]:_&&typeof _=="object"?n.value=[_]:n.value=[],m()});const m=()=>{i.value=[],Object.values(n.value).forEach((_,g)=>{_!==void 0&&_!==""&&i.value.push(_)})};return Te(()=>{Array.isArray(a.modelValue)&&a.modelValue.length>0?n.value=a.modelValue:a.modelValue&&typeof a.modelValue=="string"&&a.modelValue!==""?n.value=[a.modelValue]:a.modelValue&&typeof a.modelValue=="object"?n.value=[a.modelValue]:n.value=[],m()}),(_,g)=>(r(),h(P,null,[s(Jp,{attachments:c(i),onMediaUploaded:p,onRemoveImage:A,icon:e.icon,title:e.title,mediaInputSize:e.mediaInputSize,mediaInputBg:e.mediaInputBg},null,8,["attachments","icon","title","mediaInputSize","mediaInputBg"]),e.showSupported?(r(),h("div",Pk,[e.field&&e.field.label?(r(),h("label",Hk,f(e.field.label),1)):x("",!0),o("span",null,f(c(d)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):x("",!0)],64))}},Nk={class:"setting-media-wrap"},Xp={__name:"Media",props:Cl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Tl(e,"modelValue");return(a,l)=>(r(),h("div",Nk,[s(Ei,ba({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=n=>t.value=n),field:e.field,icon:"Upload"},e.attribute),null,16,["modelValue","field"])]))}},Kk=Object.freeze(Object.defineProperty({__proto__:null,default:Xp},Symbol.toStringTag,{value:"Module"})),Gk={__name:"InputRenderer",props:{form:{type:Object,required:!0},field:{type:Object,required:!0},value:{type:Object,required:!0},statePath:{type:String,required:!0},fieldKey:{type:String,required:!0},fullStatePath:{type:String,required:!0}},setup(e){const t=e;M(!1),aa().ctx;const a=_=>typeof _.label=="function"?_.label(t.value,t.statePath,t.form):_.label,l=(_,g)=>{if(typeof _=="function")return _({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(g)&&g.length===1?g[0]:g})},n=M(!1);let i={};Te(async()=>{i=await Ud.attributesBuilders(t.field,l,t.form),n.value=!0});const A={switch:Np,checkbox:Kp,radio:Gp,input:ln,text:ln,email:ln,number:ln,textarea:ln,color:Id,date:zp,time:jp,select:qp,media:Xp,remote_select:Yp},p=G(()=>A[t.field.type]||null),m=G(()=>({modelValue:t.value[t.fieldKey],form:t.form,statePath:t.statePath,field:t.field,fieldKey:t.fieldKey,value:t.value[t.fieldKey],nesting:!1,label:a(t.field),attribute:i,callback:l}));return(_,g)=>e.field.type==="wp-editor"?(r(),E(os,{key:0,shortCodes:e.field.shortcodes.data,modelValue:t.value[t.fieldKey],onUpdate:g[0]||(g[0]=y=>{t.value[t.fieldKey]=y})},null,8,["shortCodes","modelValue"])):p.value&&n.value?(r(),E(bl(p.value),ba({key:1,onChange:g[1]||(g[1]=y=>{e.form.triggerChange(y)}),onInput:g[2]||(g[2]=y=>{e.form.triggerChange(e.value[e.fieldKey])}),modelValue:e.value[e.fieldKey],"onUpdate:modelValue":g[3]||(g[3]=y=>e.value[e.fieldKey]=y)},m.value),null,16,["modelValue"])):x("",!0)}},zk=["innerHTML"],jk={key:0},qk={key:0},Ui={__name:"FormRenderer",props:{form:{type:Object,required:!0},schema:{type:Object},value:{type:Object},statePath:{type:String}},setup(e){const t=e,a=t.statePath??"",l=["grid","section","tab","tab-pane"];M(!1),aa().ctx;const n=(A,p)=>{if(typeof A.label=="function"){let m=i(A)?a:p+".",_=i(A)?t.value:t.value[p];return A.label(_,m,t.form)}return A.label},i=A=>A.disable_nesting!==!1;return(A,p)=>(r(!0),h(P,null,ae(e.schema,(m,_)=>(r(),h(P,{key:_},[e.form.isVisible(m,e.statePath+_)?(r(),h(P,{key:0},[m.type==="html"?(r(),h("div",{key:0,class:ue(`setting-html-wrapper ${m.wrapperClass??""}`),innerHTML:m.value},null,10,zk)):(r(),h(P,{key:1},[m.component?(r(),h("div",{key:0,class:ue(m.wrapperClass??"")},[m.component&&m.label?(r(),E(Ot,{key:0,title:n(m,_),content:m.tooltip,class:"setting-label",placement:m.tooltip_placement},{default:u(()=>[m.labelOptional?(r(),h("span",jk,"("+f(m.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),s(Rp,{modelValue:e.value[_],"onUpdate:modelValue":g=>e.value[_]=g,name:m.component,form:e.form,statePath:i(m)?c(a):_+".",field:m,"field-key":_,value:i(m)?e.value:e.value[_],nesting:i(m)},{fieldNote:u(()=>[m.note&&m.hide_note!==!0?(r(),E(Wr,{key:0,note:m.note},null,8,["note"])):x("",!0)]),validationError:u(()=>[s(sc,{form:e.form,"error-key":c(a)+_},null,8,["form","error-key"])]),_:2},1032,["modelValue","onUpdate:modelValue","name","form","statePath","field","field-key","value","nesting"])],2)):x("",!0),l.includes(m.type)?(r(),E(ak,{key:1,form:e.form,field:m,value:e.value,"full-state-path":c(a),statePath:i(m)?c(a):_+".","field-key":_},null,8,["form","field","value","full-state-path","statePath","field-key"])):x("",!0),typeof m.type<"u"&&!l.includes(m.type)&&!["custom","component","html","hidden"].includes(m.type)?(r(),h("div",{key:2,class:ue(`setting-fields-inner ${m.wrapperClass??""}`)},[m.type!=="checkbox"&&!m.component&&m.label!==!1?(r(),E(Ot,{key:0,class:"setting-label",title:n(m,_),content:m.tooltip,placement:m.tooltip_placement},{default:u(()=>[m.labelOptional?(r(),h("span",qk,"("+f(m.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),s(Gk,{form:e.form,field:m,value:e.value,"full-state-path":c(a),"state-path":e.statePath,"field-key":_},null,8,["form","field","value","full-state-path","state-path","field-key"]),m.note&&!m.component?(r(),E(Wr,{key:1,note:m.note},null,8,["note"])):x("",!0),m.component?x("",!0):(r(),E(sc,{key:2,form:e.form,"error-key":c(a)+_},null,8,["form","error-key"]))],2)):x("",!0)],64))],64)):x("",!0)],64))),128))}},Yk={key:0,class:"vue-form-wrap"},Wk={key:0,class:"form-section-save-action"},Jk={key:0,class:"cmd block leading-none"},Ii={__name:"VueForm",props:{form:{type:Object,required:!0},schema:{type:Object},value:{type:Object},showSubmitButton:{type:Boolean,default:!1},submitButtonText:{type:String,default:"Save"},loading:{type:Boolean,default:!1}},emits:["onSubmit","onChange","onSubmitButtonClick"],setup(e,{expose:t,emit:a}){const l=Pa(),n=e,i=a;be(()=>n.form.isReady,()=>{$e(()=>Rs.scrollToHashSection(l.hash))},{once:!0}),Te(()=>{$e(()=>{A.registerCopyAction(),n.form.isReady&&Rs.scrollToHashSection(l.hash)})}),M({});const A=aa().ctx,p=()=>{i("onSubmitButtonClick")};return t({getState:()=>n.form.values}),(_,g)=>{const y=C("el-button");return e.form.isReady?(r(),h("div",Yk,[s(Ui,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),h("div",Wk,[s(y,{onClick:p,type:"primary",loading:e.loading},{default:u(()=>[e.loading?x("",!0):(r(),h("span",Jk,"⌘s")),R(" "+f(e.submitButtonText),1)]),_:1},8,["loading"])])):x("",!0)])):x("",!0)}}},Xk={key:0},Zp={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=Fd();const n=a,i=e,A=()=>{const g=i.form_name,y={};return y[g]={...l.values},y},p=()=>{l.reset()},m=()=>{var g;return((g=i.widget)==null?void 0:g.reset_on_save)==!0},_=ci("triggerChange");return Te(()=>{l.setSchema(i.schema).setDefaults(i.values).initForm(),l.onDataChanged(g=>{_==null||_(),n("change")})}),t({getState:A,resetForm:p,resetOnSave:m}),(g,y)=>c(l).isReady?(r(),h("div",Xk,[s(Ii,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:c(l),onOnSubmitButtonClick:y[0]||(y[0]=()=>{c(l).values}),onOnChange:y[1]||(y[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):x("",!0)}},Zk={__name:"EChart",props:{option:{type:Object,required:!0},height:{type:String,default:"400px"},width:{type:String,default:"100%"}},setup(e){const t=e,a=M(null);let l=null;const n=()=>{a.value&&(l=ca(a.value),l.setOption(t.option))};be(()=>t.option,m=>{l&&m&&l.setOption(m,!0)},{deep:!0});const i=(m,_)=>{if(m==null||m==="")return _;const g=Number(m);return isNaN(g)?m:`${g}px`},A=G(()=>i(t.height,"400px")),p=G(()=>i(t.width,"100%"));return Te(()=>{n(),window.addEventListener("resize",()=>l==null?void 0:l.resize())}),Ga(()=>{window.removeEventListener("resize",()=>l==null?void 0:l.resize()),l==null||l.dispose()}),(m,_)=>(r(),h("div",{ref_key:"chartRef",ref:a,style:fa({width:p.value,height:A.value})},null,4))}},eB={class:"fct-step-indicator"},tB={class:"indicator-title"},aB={class:"indicator-steps"},lB={class:"indicator-progress"},sB={class:"indicator-steps-bar"},nB=["onClick"],oB={__name:"StepIndicator",props:{steps:{type:Array,required:!0},currentStep:{type:Number,default:1}},emits:["step-click"],setup(e,{emit:t}){const a=t;return(l,n)=>(r(),h("div",eB,[o("div",tB,f(e.steps[e.currentStep-1].label),1),o("div",aB,[o("div",lB,f(e.currentStep)+"/"+f(e.steps.length)+" "+f(l.$t("Completed")),1),o("div",sB,[(r(!0),h(P,null,ae(e.steps,(i,A)=>(r(),h("div",{key:A,class:"indicator-step",onClick:p=>a("step-click",A+1)},[o("div",{class:ue(["indicator-step-bar",A<e.currentStep?"is-completed":""])},null,2)],8,nB))),128))])])]))}},iB=["type","disabled","aria-disabled"],rB={key:0,class:"fct-btn-spinner"},dB="6px",uB={__name:"LoadingButton",props:{loading:Boolean,disabled:Boolean,type:{type:String,default:""},size:{type:String,default:""},plain:Boolean,nativeType:{type:String,default:"button"},duration:{type:Number,default:300}},emits:["click"],setup(e,{emit:t}){const a=e,l=t,n=G(()=>a.disabled||a.loading),i=()=>`width ${a.duration}ms ease, opacity ${a.duration}ms ease, margin-right ${a.duration}ms ease`,A=y=>{y.style.width="0",y.style.opacity="0",y.style.overflow="hidden",y.style.marginRight="6px"},p=(y,v)=>{const k=y.scrollWidth+"px";y.style.transition=i(),requestAnimationFrame(()=>{y.style.width=k,y.style.opacity="1",y.style.marginRight=""}),setTimeout(()=>v(),a.duration)},m=y=>{y.style.width="auto",y.style.overflow="",y.style.marginRight=""},_=y=>{y.style.width=y.scrollWidth+"px",y.style.opacity="1",y.style.overflow="hidden",y.style.marginRight=dB},g=(y,v)=>{y.offsetHeight,y.style.transition=i(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const k=b=>{b.propertyName==="width"&&(y.removeEventListener("transitionend",k),v())};y.addEventListener("transitionend",k)};return(y,v)=>(r(),h("button",{type:e.nativeType,class:ue(["el-button",e.type&&`el-button--${e.type}`,e.size&&`el-button--${e.size}`,{"is-plain":e.plain,"is-loading":e.loading,"is-disabled":n.value}]),disabled:n.value,"aria-disabled":n.value,onClick:v[0]||(v[0]=k=>l("click",k))},[s(Gl,{onBeforeEnter:A,onEnter:p,onAfterEnter:m,onBeforeLeave:_,onLeave:g},{default:u(()=>[e.loading?(r(),h("span",rB,v[1]||(v[1]=[o("i",{class:"el-icon is-loading"},[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[o("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})])],-1)]))):x("",!0)]),_:1}),o("span",null,[wa(y.$slots,"default",{},void 0,!0)])],10,iB))}},cB=nt(uB,[["__scopeId","data-v-fa8794a2"]]),ef={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var A,p;const t=eA(tA),a=Object.freeze({get:(...m)=>ce.get(...m),post:(...m)=>ce.post(...m),put:(...m)=>ce.put(...m),delete:(...m)=>ce.delete(...m),patch:(...m)=>ce.patch(...m),upload:(...m)=>ce.upload(...m),getNonce:()=>ce.getNonce()}),l=Object.freeze({success:(...m)=>j.success(...m),error:(...m)=>j.error(...m),info:(...m)=>j.info(...m),validationErrors:(...m)=>j.validationErrors(...m)}),n={Vue:t,Rest:a,Notify:l,translate:d,Animation:ma,StepIndicator:oB,LoadingButton:cB,ElMessage:(A=window==null?void 0:window.ELEMENT)==null?void 0:A.ElMessage,ElMessageBox:(p=window==null?void 0:window.ELEMENT)==null?void 0:p.ElMessageBox},i=m=>typeof m=="string"?qm(m,n).component:Bs(m);return(m,_)=>(r(),E(bl(i(e.widget.component)),ba({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},AB=["innerHTML"],hn={__name:"DynamicTemplates",props:{widgetsQuery:{type:Object,default:{},required:!1},filter:{type:String,default:"",required:!1},data:{required:!1}},emits:["change"],setup(e,{expose:t,emit:a}){aa().ctx;const l=a,n=e,i=M([]),A=eA(tA),p={},m=V=>{window.fluent_cart_admin.app={vue:A,components:V,xhr:ce,notify:j},window.fluent_cart_admin.hooks.applyFilters(n.filter+"_components",[],A,V).forEach(({name:$,component:U})=>{p[$]=Bs(U)})};Hs(()=>{let F=aa().appContext.components;m(F);let $=window.fluent_cart_admin.hooks.applyFilters(n.filter,[],A,F);Array.isArray($)&&(i.value=i.value.concat($));const U={filter:n.filter,data:n.widgetsQuery};ce.get("widgets",U).then(D=>{Array.isArray(D.widgets)&&(i.value=i.value.concat(D.widgets))}),n.widgetsQuery});const _=V=>Bs(V),g=V=>p[V]||null,y=M([]),v=async(V,F)=>{const $=y.value.map(U=>typeof U[V]=="function"?U[V](F):Promise.resolve());return await Promise.all($),!0};t({beforeUpdatingData:async V=>await v("beforeUpdatingData",V),afterUpdatingData:async V=>await v("afterUpdatingData",V),getFormStates:()=>{let V=[];if(Array.isArray(S.value))for(let F of S.value)V={...V,...F.getState()};return V},resetForms:()=>{if(Array.isArray(S.value))for(let V of S.value)V.resetOnSave()&&V.resetForm()}});const S=M();return(V,F)=>(r(!0),h(P,null,ae(i.value,$=>(r(),h(P,null,[$.type!=="vue-component"&&$.type!=="vue-template"||$.use_card==!0?(r(),E(xe,{key:0},{default:u(()=>[s(Ve,{title:$.title,subtitle:$.subtitle,border_bottom:""},null,8,["title","subtitle"]),s(Be,null,{default:u(()=>[$.type==="html"?(r(),h("div",{key:0,innerHTML:$.content},null,8,AB)):$.type==="chart"?(r(),E(Zk,{key:1,option:$.data,height:`${$.height||400}`,width:`${$.width||"100%"}`},null,8,["option","height","width"])):$.type==="form"?(r(),E(Zp,{key:2,schema:$.schema,values:$.values,submit_button_text:$.submit_button_text,form_name:$.form_name,ref_for:!0,ref_key:"formRefs",ref:S,widget:$,onChange:F[0]||(F[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof $.component=="object"?(r(),E(bl(_($.component)),ba({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...$,data:e.data}),null,16)):g($.component)?(r(),E(bl(g($.component)),ba({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...$,data:e.data}),null,16)):(r(),h(P,{key:5},[R(f($.content),1)],64))]),_:2},1024)]),_:2},1024)):$.type==="vue-component"?(r(),h(P,{key:1},[typeof $.component=="object"?(r(),E(bl(_($.component)),ba({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...$,data:e.data}),null,16)):g($.component)?(r(),E(bl(g($.component)),ba({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...$,data:e.data}),null,16)):x("",!0)],64)):$.type==="vue-template"?(r(),E(ef,{key:2,widget:$,data:e.data},null,8,["widget","data"])):x("",!0)],64))),256))}},ha=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,pB={class:"fct-dashboard-stat-widgets"},fB={class:"right w-full"},mB=["href"],hB={class:"fct-dashboard-stat-widget__icon"},_B={class:"fct-dashboard-stat-widget__content"},vB={class:"fct-dashboard-stat-widget__title"},gB={class:"fct-dashboard-stat-widget__value inner-value"},yB=["innerHTML"],bB={key:1,class:"fct-dashboard-stat-widget__inner"},wB={class:"fct-dashboard-stat-widget__content"},CB={class:"fct-dashboard-stat-widget__title"},kB=["href"],BB={key:1},xB={class:"fct-dashboard-stat-widget__value"},SB={__name:"StatsWidget",setup(e){const t=M(!0),a=M([]),l=()=>{t.value=!0,ce.get("dashboard/stats").then(n=>{a.value=n.stats}).catch(n=>{j.error(n)}).finally(()=>{t.value=!1})};return Te(()=>{l()}),(n,i)=>{const A=C("el-skeleton-item"),p=C("el-skeleton");return r(),h("div",pB,[t.value?(r(),h(P,{key:0},ae(4,m=>s(p,{key:m,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:u(()=>[s(A,{variant:"circle",class:"w-10 h-10 flex-none"}),o("div",fB,[s(A,{variant:"p",class:"w-full"}),s(A,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),h(P,{key:1},[(r(!0),h(P,null,ae(a.value,(m,_)=>(r(),h("div",{key:_,class:"fct-dashboard-stat-widget"},[m.url?(r(),h("a",{key:0,href:m.url,class:"fct-dashboard-stat-widget__inner no-underline"},[o("div",hB,[s(X,{class:"w-5",name:m.icon},null,8,["name"])]),o("div",_B,[o("h3",vB,[o("span",null,f(m.title),1)]),o("span",gB,[m.has_currency?(r(),h("span",{key:0,innerHTML:c(_t).scaled(m.current_count)},null,8,yB)):(r(),h(P,{key:1},[R(f(c(la)(c(ha)(m.current_count))||0),1)],64))])])],8,mB)):(r(),h("div",bB,[i[0]||(i[0]=Ln('<div class="fct-dashboard-stat-widget__icon"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.20248 2.62165L5.7818 3.27834C3.59393 4.28965 2.5 4.7953 2.5 5.62533C2.5 6.45535 3.59393 6.961 5.7818 7.97231L7.20249 8.629C8.57936 9.26544 9.26781 9.58366 10 9.58366C10.7322 9.58366 11.4206 9.26544 12.7975 8.629L14.2182 7.97231C16.4061 6.961 17.5 6.45535 17.5 5.62533C17.5 4.7953 16.4061 4.28965 14.2182 3.27834L12.7975 2.62165C11.4206 1.98521 10.7322 1.66699 10 1.66699C9.26781 1.66699 8.57937 1.98521 7.20248 2.62165Z" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M17.3233 9.24805C17.4411 9.41368 17.5 9.5863 17.5 9.77614C17.5 10.5944 16.4061 11.0928 14.2182 12.0897L12.7975 12.7371C11.4206 13.3644 10.7322 13.6781 10 13.6781C9.26781 13.6781 8.57936 13.3644 7.20249 12.7371L5.7818 12.0897C3.59394 11.0928 2.5 10.5944 2.5 9.77614C2.5 9.5863 2.55889 9.41368 2.67667 9.24805" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.9806 13.5557C17.3269 13.8315 17.5 14.1064 17.5 14.4319C17.5 15.2501 16.4061 15.7486 14.2182 16.7455L12.7975 17.3928C11.4206 18.0202 10.7322 18.3339 10 18.3339C9.26781 18.3339 8.57936 18.0202 7.20249 17.3928L5.7818 16.7455C3.59394 15.7486 2.5 15.2501 2.5 14.4319C2.5 14.1064 2.67315 13.8315 3.01945 13.5557" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></div>',1)),o("div",wB,[o("h3",CB,[m.url?(r(),h("a",{key:0,class:"link",href:m.url},f(m.title),9,kB)):(r(),h("span",BB,f(m.title),1))]),o("span",xB,f(m.current_count),1)])]))]))),128)),s(hn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},cc=200,$B=800,FB=.1,EB=.3,Ac=.5,UB=.5,IB=12,VB=800,DB=1600,TB=150,QB=3500,MB=["#FFC700","#FF0000","#2E3191","#41BBC7"];var Dd={props:{particleCount:{type:Number,default:TB},particleSize:{type:Number,default:IB},duration:{type:Number,default:QB},colors:{type:Array,default:MB},force:{type:Number,default:UB},stageHeight:{type:Number,default:VB},stageWidth:{type:Number,default:DB},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=M(!0),a=(F,$)=>{V(F,{degree:$})},l=G(()=>i(e.particleCount,e.colors));cm(()=>{e.particleCount>300&&console.log("[VUE-CONFETTI-EXPLOSION] That's a lot of confetti, you sure about that? A lesser number like 200 will still give off the party vibes while still not bricking the device 😉")});const n=G(()=>S(e.particleCount,e.duration,e.colors,e.particleSize,e.force,e.stageHeight,e.stageWidth));Te(async()=>{await A(e.duration),e.shouldDestroyAfterDone&&(t.value=!1)});const i=(F,$)=>{const U=360/F;return Array.from({length:F},(D,T)=>({color:$[T%$.length],degree:T*U}))},A=F=>new Promise($=>setTimeout($,F));function p(F){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round((F+Number.EPSILON)*10**$)/10**$}function m(F,$){if(F===$)return!0;if(F==null||$==null||F.length!==$.length)return!1;for(let U=0;U<F.length;U++)if(F[U]!==$[U])return!1;return!0}const _=(F,$,U,D,T)=>(F-$)*(T-D)/(U-$)+D,g=(F,$)=>{const U=F+$;return U>360?U-360:U},y=()=>Math.random()>.5,v=[0,0,1],k=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],b=F=>!m(k[F],v)&&y(),w=F=>typeof F>"u",B=F=>{console.error(F)};function S(F,$,U,D,T,I,L){const O=Number.isSafeInteger;return!w(F)&&O(F)&&F<0?(B("particleCount must be a positive integer"),!1):!w($)&&O($)&&$<0?(B("duration must be a positive integer"),!1):!w(U)&&!Array.isArray(U)?(B("colors must be an array of strings"),!1):!w(D)&&O(D)&&D<0?(B("particleSize must be a positive integer"),!1):!w(T)&&O(T)&&(T<0||T>1)?(B("force must be a positive integer and should be within 0 and 1"),!1):!w(I)&&typeof I=="number"&&O(I)&&I<0?(B("floorHeight must be a positive integer"),!1):!w(L)&&typeof L=="number"&&O(L)&&L<0?(B("floorWidth must be a positive integer"),!1):!0}function V(F,$){let{degree:U}=$;const D=_(Math.abs(g(U,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),T=Math.random()*($B-cc)+cc,I=Math.round(Math.random()*(k.length-1)),L=e.duration-Math.round(Math.random()*1e3),O=Math.random()<FB,Q=b(I),H=O?p(Math.random()*EB,2):0,K=H*-1,W=H,z=p(Math.abs(_(Math.abs(g(U,90)-180),0,180,-1,1)),4),Y=p(Math.random()*Ac,4),Z=p(Math.random()*e.force*(y()?1:-1),4),re=Ac,q=p(Math.max(_(Math.abs(U-180),0,180,e.force,-e.force),0),4),Ae=(ie,J)=>F==null?void 0:F.style.setProperty(ie,J+"");Ae("--x-landing-point",`${D}px`),Ae("--duration-chaos",`${L}ms`),Ae("--x1",`${H}`),Ae("--x2",`${K}`),Ae("--x3",`${W}`),Ae("--x4",`${z}`),Ae("--y1",`${Y}`),Ae("--y2",`${Z}`),Ae("--y3",`${re}`),Ae("--y4",`${q}`),Ae("--width",`${Q?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),Ae("--height",(Q?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),Ae("--rotation",`${k[I].join()}`),Ae("--rotation-duration",`${T}ms`),Ae("--border-radius",`${Q?"50%":"0"}`)}return{isVisible:t,isValid:n,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function LB(e,t,a,l,n,i){return l.isVisible&&l.isValid?(r(),h("div",{key:0,class:"confetti-container",style:fa(`--floor-height: ${l.stageHeight}px;`)},[(r(!0),h(P,null,ae(l.particles,A=>{let{color:p,degree:m}=A;return r(),h("div",{key:m,class:"particle",ref:_=>l.setItemRef(_,m)},[o("div",{style:fa(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):x("",!0)}function RB(e,t){t===void 0&&(t={});var a=t.insertAt;if(!(typeof document>"u")){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",a==="top"&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var OB=` |
| 107 |
@keyframes y-axis-4ff796ae { |
| 108 |
to { |
| 109 |
transform: translate3d(0, var(--floor-height), 0); |
| 110 |
} |
| 111 |
} |
| 112 |
@keyframes x-axis-4ff796ae { |
| 113 |
to { |
| 114 |
transform: translate3d(var(--x-landing-point), 0, 0); |
| 115 |
} |
| 116 |
} |
| 117 |
@keyframes rotation-4ff796ae { |
| 118 |
to { |
| 119 |
transform: rotate3d(var(--rotation), 360deg); |
| 120 |
} |
| 121 |
} |
| 122 |
.confetti-container[data-v-4ff796ae] { |
| 123 |
width: 0; |
| 124 |
height: 0; |
| 125 |
overflow: visible; |
| 126 |
position: relative; |
| 127 |
transform: translate3d(var(--x, 0), var(--y, 0), 0); |
| 128 |
z-index: 1200; |
| 129 |
} |
| 130 |
.confetti-container > .particle[data-v-4ff796ae] { |
| 131 |
animation: x-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--x1), var(--x2), var(--x3), var(--x4)); |
| 132 |
} |
| 133 |
.confetti-container > .particle div[data-v-4ff796ae] { |
| 134 |
position: absolute; |
| 135 |
top: 0; |
| 136 |
left: 0; |
| 137 |
animation: y-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--y1), var(--y2), var(--y3), var(--y4)); |
| 138 |
width: var(--width); |
| 139 |
height: var(--height); |
| 140 |
} |
| 141 |
.confetti-container > .particle div[data-v-4ff796ae]:before { |
| 142 |
display: block; |
| 143 |
height: 100%; |
| 144 |
width: 100%; |
| 145 |
content: ""; |
| 146 |
background-color: var(--bgcolor); |
| 147 |
animation: rotation-4ff796ae var(--rotation-duration) infinite linear; |
| 148 |
border-radius: var(--border-radius); |
| 149 |
} |
| 150 |
`;RB(OB);Dd.render=LB;Dd.__scopeId="data-v-4ff796ae";var PB=(()=>{const e=Dd;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();at.extend(_i);at.extend(BA);let _a=class{static withTimezone(t){const a=at(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class HB extends il{constructor(){super(...arguments);ze(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[_a.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),_a.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:_a.withTimezone(at().format("YYYY-MM-DD 23:59:59")),subscriptionType:""})}get dropdownOpen(){return this.data.showDropdown}toggleDropdown(){this.data.showDropdown=!this.data.showDropdown}setFilterOption(a){this.data.filterOptions=a}get filters(){return this.data.filterOptions}get filteredFilters(){var l;const a=(l=this.data.searchQuery)==null?void 0:l.toLowerCase().trim();return this.filters.filter(n=>a?n.label.toLowerCase().includes(a)||n.value.toLowerCase().includes(a):!0)}get visibleFilters(){return this.filteredFilters.filter(a=>this.shouldRenderOption(a))}selectActiveFilter(a){this.data.activeFilter=a}get activeFilterOptions(){return this.data.activeFilter||null}selectFilterOption(a){const l=this.activeFilterOptions;l&&(this.data.selectedFilters[l.value]={label:l.label,value:a.value,type:l.type,options:l.options},this.data[l.value]=a.value,this.triggerFilterChanged())}selectFilterOptionMulti(a){const l=this.activeFilterOptions;if(!l)return;this.data.selectedFilters[l.value]||(this.data.selectedFilters[l.value]={label:l.label,value:[],type:l.type,options:l.options});let n=this.data.selectedFilters[l.value].value;if(a.value==="all")this.data.selectedFilters[l.value].value=[{label:a.label,value:a.value}],this.data[l.value]=["all"];else{const i=n.findIndex(p=>p.value===a.value);i>-1?n.splice(i,1):n.push({label:a.label,value:a.value});const A=n.findIndex(p=>p.value==="all");A>-1&&n.splice(A,1),this.data[l.value]=n.map(p=>p.value)}this.triggerFilterChanged()}setDateRange(a){const l=at(a[0]),n=at(a[1]);this.data.selectedFilters.dateRange={label:d("Date"),value:[l,n],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[qa.data.dateRange[0],qa.data.dateRange[1]],this.data.selectedFilters.dateRange={label:d("Date"),value:[_a.withTimezone(at(this.data.dateRange[0])),_a.withTimezone(at(this.data.dateRange[1]))],type:"date",rangeKey:this.data.rangeKey},this.data.reRenderDate=!0,this.triggerFilterChanged()}setSelectChange(a,l=null){const n=l||this.activeFilterOptions;n&&(this.data.selectedFilters[n.value]={label:n.label,value:a,type:n.type},this.triggerFilterChanged())}setTreeSelectItem(a){const l=a.filter(n=>!n.children||n.children.length===0).map(n=>({id:n.value,label:n.label,productName:n.productName}));this.handleTreeSelections(l),this.triggerFilterChanged()}removeTreeSelectItem(a){var i;const n=(((i=this.data.selectedFilters.variation_ids)==null?void 0:i.value)||[]).filter(A=>A.id!==a);this.handleTreeSelections(n),this.data.variation_ids=this.data.variation_ids.filter(A=>A!==a),this.triggerFilterChanged()}handleTreeSelections(a){a.length?(this.data.selectedFilters.variation_ids||(this.data.selectedFilters.variation_ids={label:d("Products"),type:"tree-select"}),this.data.selectedFilters.variation_ids.value=a):delete this.data.selectedFilters.variation_ids}clearTreeSelect(){delete this.data.selectedFilters.variation_ids,this.data.variation_ids=[],qa.resetFilterToDefault("variation_ids"),this.triggerFilterChanged()}isFilterOptionSelected(a){const l=this.activeFilterOptions;if(!l)return!1;const n=this.data.selectedFilters[l.value];return n?n.value===a.value:this.data[l.value]===a.value}isFilterOptionSelectedMulti(a){const l=this.activeFilterOptions,n=this.data.selectedFilters[l==null?void 0:l.value];return n?n.value.some(A=>A.value===a.value):!1}setMultiSelectChange(a,l){this.data.selectedFilters[a]||(this.data.selectedFilters[a]={});const n=l.some(A=>A.value==="all"),i=this.data.selectedFilters[a].value||[];n?i.length===1&&i[0].value==="all"&&l.length>1?this.data.selectedFilters[a].value=l.filter(A=>A.value!=="all"):this.data.selectedFilters[a].value=[l.find(A=>A.value==="all")]:this.data.selectedFilters[a].value=l,this.triggerFilterChanged()}onFilterChanged(a){return this.data.onFilterChanged=a}setCompareTypeChange(a){this.data.compareType=a,this.data.selectedFilters.compareType={value:a},a!=="custom"&&this.triggerFilterChanged()}setCompareDateChange(a){this.data.compareDate=a,this.data.selectedFilters.compareDate={value:_a.withTimezone(at(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(qa.data.currencies).map(([a,l])=>({label:a,value:a}))}shouldRenderOption(a){const l=a.disableRoutes||[],n=Pa();return l.includes(n.name)?!1:a.value==="currency"?this.data.currencies&&this.data.currencies.length>1:!0}applyFilterChange(){this.triggerFilterChanged()}resetFilters(){this.data.selectedFilters={},this.data.currency="",this.data.variation_ids=[],this.data.dateRange=[_a.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),_a.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=_a.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),qa.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,l){l!=null?(this.removeFilterItem(a,l),qa.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],qa.resetFilterToDefault(a),this.triggerFilterChanged())}removeFilterItem(a,l){const n=this.data.selectedFilters[a];if(!n)return;const i=n.value.filter(A=>A.id!==l);i.length?this.data.selectedFilters[a].value=i:delete this.data.selectedFilters[a],a==="variation_ids"&&(this.data.variation_ids=this.data.variation_ids.filter(A=>A!==l)),this.triggerFilterChanged()}triggerFilterChanged(){this.storeSelectedFilters(),typeof this.data.onFilterChanged=="function"&&this.data.onFilterChanged(this.data.selectedFilters)}get activeFilters(){return this.data.selectedFilters}applicableFilters(){return Object.fromEntries(["orderStatus","orderTypes","compareDate","currency","compareType","subscriptionType","variation_ids","paymentStatus","rangeKey"].map(l=>[l,this.data[l]]))}storeSelectedFilters(){const a="report-filter",l=Qt.get(a)||{},n=this.applicableFilters(),i={...l,...n};Qt.set(a,i),Qt.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return Qt.get(this.data.storageKey)}retrieveSavedReportFilters(){return Qt.get("report-filter")}}function tf(){return HB.init()}class NB extends il{constructor(){super(...arguments);ze(this,"filterState",null);ze(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[_a.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),_a.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:_a.withTimezone(at().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});ze(this,"storageKey","report-filter");ze(this,"currencyStorageKey",`${this.storageKey}_currencies`);ze(this,"listeners",{})}beforeInit(){this.filterState=tf(),this.mergeWithStorage();const a=Qt.get(this.storageKey),l=Qt.get(this.currencyStorageKey);(!a||!l)&&this.fetchReportMeta()}mergeWithStorage(){const a=Qt.get(this.storageKey),l=Qt.get(this.currencyStorageKey);this.data.paymentStatus=a.paymentStatus??this.data.paymentStatus,this.data.orderStatus=a.orderStatus??this.data.orderStatus,this.data.orderTypes=a.orderTypes??this.data.orderTypes,this.data.compareType=a.compareType?a.compareType:this.data.compareType,this.data.compareDate=a.compareDate??this.data.compareDate,this.data.subscriptionType=a.subscriptionType??this.data.subscriptionType,this.data.currency=a.currency?this.data.currency:Ke.get("shop.currency"),this.data.dateRange=[a.startDate??this.data.dateRange[0],a.endDate??this.data.dateRange[1]],this.data.currencies=l??this.data.currencies,this.data.rangeKey=a.rangeKey,this.data.variation_ids=a.variation_ids?a.variation_ids:this.data.variation_ids,this.data.filterMode=a.filterMode??this.data.filterMode,this.data.storeMode=a.storeMode??this.data.storeMode}fetchReportMeta(){ce.get("reports/fetch-report-meta",this.applicableFilters).then(a=>{this.data.currencies=a.currencies,this.data.dateRange[0]=a.min_date;const[l,n]=Object.entries(a.currencies)[0];this.applicableFilters.params.currency===""&&(this.data.currency=l),this.data.currencySign=n,this.data.storeMode=a.storeMode,this.data.firstOrderDate=at(a.first_order_date||at().startOf("month")).format("YYYY-MM-DD 00:00:00"),this.syncStorage()}).catch(a=>{}).finally(()=>{this.data.loading=!1})}get currentCurrencySign(){return this.data.currencies&&this.data.currencies.hasOwnProperty(this.data.currency)?this.data.currencies[this.data.currency]:""}addListener(a,l){this.listeners[a]=l,this.data.active_tab=a}async onFilterChange(){this.syncStorage(),this.setDateDiff();for(let a in this.listeners)this.listeners[a](this.applicableFilters)}onModeChange(a){this.data.filterMode=a,this.syncStorage()}syncStorage(){Qt.set(this.storageKey,this.applicableFilters.params),Qt.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=CA.find(p=>p.text===this.data.rangeKey);let l,n;if(a){const[p,m]=a.value();l=this.data.rangeKey==="All Time"?_a.withTimezone(at(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):_a.withTimezone(at(p).format("YYYY-MM-DD 00:00:00")),n=_a.withTimezone(at(m).format("YYYY-MM-DD 23:59:59"))}else l=_a.withTimezone(at(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),n=_a.withTimezone(at(this.data.dateRange[1]).format("YYYY-MM-DD 23:59:59"));const i={orderStatus:this.data.orderStatus,paymentStatus:this.data.paymentStatus,currency:this.data.currency,startDate:Ke.get("app_config.isProActive")?l:_a.withTimezone(at().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:Ke.get("app_config.isProActive")?n:_a.withTimezone(at().endOf("month").format("YYYY-MM-DD 23:59:59")),rangeKey:this.data.rangeKey,variation_ids:this.data.variation_ids,filterMode:this.data.filterMode,storeMode:this.data.storeMode,firstOrderDate:this.data.firstOrderDate,compareType:this.data.compareType,compareDate:this.data.compareDate,subscriptionType:this.data.subscriptionType};let A=this.data.orderTypes;return A.includes("all")||(i.orderTypes=A),{params:i}}setDateDiff(){if(!this.data.dateRange||this.data.dateRange.length<2)return 0;const[a,l]=this.data.dateRange;this.data.dateDiff=at(l).diff(at(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=_a.withTimezone(at().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[_a.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),_a.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=_a.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"))),a==="subscriptionType"&&(this.data.subscriptionType=""),a==="orderTypes"&&(this.data.orderTypes=["all"]),(a==="orderStatus"||a==="paymentStatus")&&(this.data[a]=["all"]),a==="variation_ids"&&(this.data.variation_ids=[]),a==="dateRange"&&(this.data[a]=[_a.withTimezone(at().startOf("month").format("YYYY-MM-DD 00:00:00")),_a.withTimezone(at().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return Qt.get(this.data.storageKey)}}const qa=NB.init();class KB extends il{constructor(){super(...arguments);ze(this,"data",{summaryData:{net_revenue:0,order_count:0,subscription_renewal_count:0,new_customers:0,total_item_count:0,total_refunded_amount:0,total_refunded:0,average_order_net:0,average_order_items:0,average_customer_orders:0,average_customer_ltv:0},previousSummary:{},fluctuations:{net_revenue:0,order_count:0,new_customers:0,total_item_count:0,total_refunded_amount:0,total_refunded:0,subscrition_renewal:0},graphs:{netRevenueGraph:{},orderGraph:{},itemsSoldGraph:{},refundCountGraph:{},refundsGraph:{},newCustomerGraph:{},subscriptionRenewalGraph:{}},topSoldProducts:[],failedOrders:[],topSoldVariants:[],isBusy:{graphs:{netRevenueGraph:!1,orderGraph:!1,itemsSoldGraph:!1,refundCountGraph:!1,refundsGraph:!1,newCustomerGraph:!1,subscriptionRenewalGraph:!1},summaryData:!1,topSoldProductsAndFailedOrders:!1,topSoldVariants:!0,topSoldProducts:!0,fluctuations:!1,salesReport:!0}})}get controllerKey(){return"DefaultReportController"}makeRequest(a,l,n,i){if(i&&i.startsWith("graphs.")){const p=i.split(".")[1];this.data.isBusy.graphs[p]=!0}else this.data.isBusy[i]=!0;let A;return typeof l=="object"?A=ce.get("reports/"+a,l):A=ce.get("reports/"+a),this.resolvePromiseResponse(A,n,i),A}resolvePromiseResponse(a,l=null,n=null){a.then(i=>{n==null||l==null?Object.assign(this.data,i):dt.set(this.data,n,dt.get(i,l))}).catch(i=>{}).finally(()=>{if(n&&n.startsWith("graphs.")){const i=n.split(".")[1];this.data.isBusy.graphs[i]=!1}else this.data.isBusy[n]=!1})}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}getTopSoldVariants(a={}){return this.makeRequest("fetch-top-sold-variants",a,"topSoldVariants","topSoldVariants")}getSalesReport(a={}){return this.data.isBusy.salesReport=!0,this.makeRequest("sales-report",a,"salesReport").then(()=>this.data.isBusy.salesReport=!1)}}const Ll=KB.init(),GB={key:0,class:"fct-report-sold-product-list has-scroll"},zB={class:"list-left-content"},jB={class:"list-image"},qB=["src"],YB=["src"],WB={class:"list-title"},JB=["title"],XB={class:"list-id"},ZB={class:"list-right-content"},e8={class:"list-value"},t8=["innerHTML"],Td={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=G(()=>t.data);return(l,n)=>{const i=C("el-skeleton"),A=C("router-link");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[s(jn,{class:"top-sold-products","card-options":{heading:c(d)("Top Sold Products"),linkButtonText:c(d)("View All"),linkButtonUrl:"products"}},{default:u(()=>[e.loading?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(P,{key:1},[a.value.length>0?(r(),h("ul",GB,[(r(!0),h(P,null,ae(a.value,p=>(r(),h("li",{key:p.product_id},[s(A,{to:{name:"product_edit",params:{product_id:p.product_id}}},{default:u(()=>[o("div",zB,[o("div",jB,[p.media!==null?(r(),h("img",{key:0,src:p.media,alt:""},null,8,qB)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,YB))]),o("div",WB,[o("div",{class:"list-title-inner",title:p.product_name},f(p.product_name),9,JB),o("div",XB,"#"+f(c(la)(p.product_id)),1)])]),o("div",ZB,[o("div",e8,f(c(la)(p.quantity_sold))+" "+f(c(d)(" Sold")),1),o("div",{class:"list-price",innerHTML:c(_t).scaled(p.total_amount)},null,8,t8)])]),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no item!")},null,8,["text"]))],64))]),_:1},8,["card-options"])]),_:1})}}},a8={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},l8=["innerHTML"],s8={class:"fluent_cart_dashboard_inner"},n8={class:"fluent_cart_dashboard_main"},o8={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},i8={class:"fluent_cart_dashboard_aside"},r8={class:"fct-congrats-dialog-content"},d8={class:"fct-congrats-dialog-content-inner"},u8={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},c8=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=M(!1),a=M([]),l=M(!1),n=M(Ke.get("admin_url")+"settings/store-settings/pages_setup");pi("dashboardTogglePageNotification",(v,k="")=>{l.value=v,k&&(n.value=k)});const A=()=>{const[v,k]=[at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),at().format("YYYY-MM-DD 23:59:59")],b={startDate:v,endDate:k,paymentStatus:"all"};cl.getSalesGrowthChart({params:{...b,groupKey:"daily"}})},p=()=>{cl.getRecentOrders({params:null})},m=()=>{const v={paymentStatus:"all"};cl.getCountryHeatMap({params:{...v,groupKey:"daily"}})},_=()=>{const[v,k]=[at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),at().format("YYYY-MM-DD 23:59:59")],b={startDate:v,endDate:k};cl.getTopSoldProducts({params:{...b}})},g=()=>{Rs.getVueParams(),Qt.get("onboarding_congratulations","no")!=="yes"&&Ke.get("total_products_count")==0&&(Qt.set("onboarding_congratulations","yes"),t.value=!0)},y=()=>n.value;return Te(()=>{window.addEventListener("getSalesGrowth",A),a.value=Ke.get("dummy_product_info"),A(),m(),p(),g(),_()}),(v,k)=>{const b=C("el-col"),w=C("el-row"),B=C("el-button"),S=C("el-dialog");return r(),h("div",a8,[l.value?(r(),E(ol,{key:0,class:"mb-5",type:"warning",icon:"InformationFill"},{default:u(()=>[o("span",{innerHTML:c(d)("Set up your pages first to get started %s",'<a href="'+y()+'" target="_blank">'+c(d)("Set up your pages")+"</a>")},null,8,l8)]),_:1})):x("",!0),o("div",s8,[o("div",n8,[s(L2),s(Lt,{permission:"dashboard_stats/view"},{default:u(()=>[o("div",o8,[s(X,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(c(d)("Last %s Days",c(la)(30))),1)]),s(SB)]),_:1}),s(Lt,{permission:"reports/view"},{default:u(()=>[s(BC,{chartData:c(cl).data.salesGrowthChart,loading:c(cl).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),s(w,{gutter:24},{default:u(()=>[s(Lt,{permission:"reports/view"},{default:u(()=>[s(b,{lg:12},{default:u(()=>[s(jC)]),_:1})]),_:1}),s(Lt,{permission:"reports/view"},{default:u(()=>[s(b,{lg:12,class:"mt-6 xl:mt-0"},{default:u(()=>[s(Td,{data:c(cl).topSoldProducts,loading:c(cl).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),s(Lt,{permission:"reports/view"},{default:u(()=>[s(b,{class:"mt-6"},{default:u(()=>[s(UC,{data:c(cl).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",i8,[s(C2)])]),s(S,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":k[1]||(k[1]=V=>t.value=V),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:u(()=>[o("div",r8,[o("div",d8,[k[2]||(k[2]=o("div",{class:"icon"},"🎉",-1)),o("h3",null,f(c(d)("Congratulations!")),1),o("p",null,f(c(d)("You successfully finished your onboarding & your store is ready.")),1),s(B,{type:"primary",onClick:k[0]||(k[0]=V=>t.value=!1)},{default:u(()=>[R(f(c(d)("Let's go")),1)]),_:1})])]),o("div",u8,[s(c(PB),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),A8={name:"FilterFields",props:{conditionals:{type:Object,required:!0,default:{}},fields:{type:Object,required:!0,default:{}},editorShortcodes:{type:Array,default:()=>[]},disabled:{type:Boolean,required:!0,default:!1},labels:{default:()=>({status_label:"Enable conditional logic",notification_if_start:"Send this notification if",notification_if_end:"of the following match:"})}},data(){return{defaultRules:{field:null,operator:"=",value:null},comingSoon:!1}},computed:{items(){return this.conditionals.conditions}},mounted(){this.conditionals.conditions.length||this.conditionals.conditions.push({...this.defaultRules})},methods:{add(e){this.items.splice(e+1,0,{...this.defaultRules})},remove(e){this.items.splice(e,1)}}},p8={key:2},f8=["onClick"],m8=["onClick"];function h8(e,t,a,l,n,i){const A=C("el-checkbox"),p=C("el-option"),m=C("el-select"),_=C("el-col"),g=C("el-option-group"),y=C("el-input"),v=C("el-row");return r(),h("div",null,[a.disabled?(r(),E(A,{key:1,disabled:"",onClick:t[1]||(t[1]=k=>n.comingSoon=!0)},{default:u(()=>[R(f(a.labels.status_label),1)]),_:1})):(r(),E(A,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=k=>a.conditionals.status=k)},{default:u(()=>[R(f(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),h("div",p8,[R(f(a.labels.notification_if_start)+" ",1),s(m,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=k=>a.conditionals.type=k)},{default:u(()=>[(r(),h(P,null,ae({all:"All",any:"Any"},(k,b)=>s(p,{key:b,value:b},{default:u(()=>[R(f(k),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+f(a.labels.notification_if_end)+" ",1),(r(!0),h(P,null,ae(i.items,(k,b)=>(r(),E(v,{key:b,style:{"margin-top":"15px"},gutter:10},{default:u(()=>[s(_,{md:8},{default:u(()=>[s(m,{size:"default",modelValue:i.items[b].field,"onUpdate:modelValue":w=>i.items[b].field=w,style:{width:"100%"},onChange:w=>i.items[b].value=""},{default:u(()=>[(r(!0),h(P,null,ae(a.fields,(w,B)=>(r(),E(p,{key:B,label:w.admin_label,value:B},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),s(_,{md:5},{default:u(()=>[s(m,{size:"default",modelValue:i.items[b].operator,"onUpdate:modelValue":w=>i.items[b].operator=w},{default:u(()=>[s(g,{label:"General Operators"},{default:u(()=>[s(p,{value:"=",label:"equals"}),s(p,{value:"!=",label:"not equal"}),a.fields[k.field]&&!Object.keys(a.fields[k.field].options).length?(r(),h(P,{key:0},[s(p,{value:">",label:"greater than"}),s(p,{value:"<",label:"less than"}),s(p,{value:">=",label:"greater than or equal"}),s(p,{value:"<=",label:"less than or equal"}),s(p,{value:"contains",label:"contains"}),s(p,{value:"doNotContains",label:"do not contains"}),s(p,{value:"startsWith",label:"starts with"}),s(p,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1024),s(g,{label:"Advanced Operators"},{default:u(()=>[s(p,{value:"length_equal",label:"Equal to Data Length"}),s(p,{value:"length_less_than",label:"Less than to Data length"}),s(p,{value:"length_greater_than",label:"Greater than to Data Length"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),s(_,{md:8},{default:u(()=>[i.items[b].operator=="length_equal"||i.items[b].operator=="length_less_than"||i.items[b].operator=="length_greater_than"?(r(),E(y,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:i.items[b].value,"onUpdate:modelValue":w=>i.items[b].value=w},null,8,["modelValue","onUpdate:modelValue"])):(r(),h(P,{key:1},[a.fields[k.field]&&Object.keys(a.fields[k.field].options).length?(r(),E(m,{key:0,size:"default",modelValue:i.items[b].value,"onUpdate:modelValue":w=>i.items[b].value=w,style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,ae(a.fields[k.field].options,(w,B)=>(r(),E(p,{key:B,label:w,value:B},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(y,{key:1,size:"default",placeholder:"Enter a value",modelValue:i.items[b].value,"onUpdate:modelValue":w=>i.items[b].value=w},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),s(_,{md:3,class:"action-btns"},{default:u(()=>[o("i",{class:"el-icon-plus",onClick:w=>i.add(b)},null,8,f8),i.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:w=>i.remove(b)},null,8,m8)):x("",!0)]),_:2},1024)]),_:2},1024))),128))])):x("",!0)])}const _8=nt(A8,[["render",h8]]),v8={name:"ErrorView",props:["field","errors"],computed:{Str(){return Aa}}},g8={key:0,class:"fct-inline-error ff"};function y8(e,t,a,l,n,i){return a.errors.has(a.field)?(r(),h("p",g8,f(a.errors.errors[a.field].required?i.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):x("",!0)}const Xo=nt(v8,[["render",y8]]),b8={name:"InputPopover",components:{Popover:kA},props:{value:String,placeholder:{type:String,default:""},placement:{type:String,default:"bottom"},icon:{type:String,default:"el-icon-more"},fieldType:{type:String,default:"text"},data:Array,attrName:{type:String,default:"attribute_name"},defaultValue:{type:[String,Number,Boolean,Array],default:""}},data(){return{model:this.defaultValue}},watch:{model(){this.$emit("update:modelValue",this.model)}},methods:{insertShortcode(e){this.model==null&&(this.model=""),this.model+=e.replace(/param_name/,this.attrName)}}},w8={class:"flex-1"},C8={key:0,class:"input-textarea-value"};function k8(e,t,a,l,n,i){const A=C("el-input"),p=C("Popover");return r(),h("div",{class:ue(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",w8,[a.fieldType=="textarea"?(r(),h("div",C8,[s(A,{placeholder:a.placeholder,type:"textarea",modelValue:n.model,"onUpdate:modelValue":t[0]||(t[0]=m=>n.model=m)},null,8,["placeholder","modelValue"])])):(r(),E(A,{key:1,placeholder:a.placeholder,modelValue:n.model,"onUpdate:modelValue":t[1]||(t[1]=m=>n.model=m),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),s(p,{class:ue(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const B8=nt(b8,[["render",k8]]),x8={name:"FieldGeneral",components:{inputPopover:B8},props:{value:[String,Number,Boolean,Array],editorShortcodes:Array,field_type:{type:String,default:"text"},defaultValue:{type:[String,Number],default:""}},data(){return{fieldValue:this.defaultValue}},watch:{fieldValue(){this.$emit("update:modelValue",this.fieldValue)}},methods:{onValueUpdated(e){this.fieldValue=e,this.$emit("onValueUpdated",this.fieldValue)}}},S8={class:"fct-field-general"};function $8(e,t,a,l,n,i){const A=C("input-popover");return r(),h("div",S8,[s(A,{fieldType:a.field_type,placeholder:e.$t("Select a Field or Type Custom value"),modelValue:n.fieldValue,"onUpdate:modelValue":t[0]||(t[0]=p=>n.fieldValue=p),icon:"el-icon-arrow-down",data:a.editorShortcodes,onOnValueUpdated:t[1]||(t[1]=function(p){i.onValueUpdated(p)}),defaultValue:n.fieldValue},null,8,["fieldType","placeholder","modelValue","data","defaultValue"])])}const ss=nt(x8,[["render",$8]]),F8={key:0,class:"fct-merge-fields"},E8={class:"fct-merge-fields-container"},U8={key:3},I8={name:"FieldMaps",components:{ErrorView:Xo,FieldGeneral:ss},props:["settings","merge_fields","field","errors","merge_model","inputs","editorShortcodes"],data(){return{appReady:!1}},mounted(){(Array.isArray(this.merge_model)||!this.merge_model)&&this.$emit("setMergeModelObj"),this.appReady=!0},methods:{onValueUpdated(e,t){this.merge_model[t]=e}}},V8=Object.assign(I8,{setup(e){return(t,a)=>{const l=C("el-option"),n=C("el-select"),i=C("el-form-item");return t.appReady?(r(),h("div",F8,[o("div",E8,[(r(!0),h(P,null,ae(e.field.primary_fileds,(A,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[s(i,{label:A.label,required:A.required},{default:u(()=>[A.input_options==="emails"?(r(),E(n,{key:0,modelValue:e.settings[A.key],"onUpdate:modelValue":m=>e.settings[A.key]=m,placeholder:t.$t("Select a Field"),clearable:"",class:ue(e.errors.errors[A.key]?"is-error":"")},{default:u(()=>[(r(!0),h(P,null,ae(e.inputs,(m,_)=>(r(),h(P,{key:_},[(m==null?void 0:m.attributes.type)==="email"?(r(),E(l,{key:0,value:m==null?void 0:m.attributes.code,label:m==null?void 0:m.attributes.name},null,8,["value","label"])):x("",!0)],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"])):A.input_options==="all"?(r(),E(n,{key:1,modelValue:e.settings[A.key],"onUpdate:modelValue":m=>e.settings[A.key]=m,placeholder:t.$t("Select a Field"),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(e.inputs,(m,_)=>(r(),E(l,{key:_,value:m.attributes.name,label:m.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),E(ss,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[A.key],modelValue:e.settings[A.key],"onUpdate:modelValue":m=>e.settings[A.key]=m},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),A.help_text?(r(),h("div",U8,f(A.help_text),1)):x("",!0),s(Xo,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(r(!0),h(P,{key:0},ae(e.field.default_fields,A=>(r(),h("div",{class:"fct-merge-fields-item",key:A.name},[s(i,{label:A.label,required:A.required},{default:u(()=>[s(ss,{editorShortcodes:e.editorShortcodes,defaultValue:e.settings[t.primary_field.key],modelValue:e.settings.default_fields[A.name],"onUpdate:modelValue":p=>e.settings.default_fields[A.name]=p},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"]),s(Xo,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):x("",!0),(r(!0),h(P,null,ae(e.merge_fields,(A,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[s(i,{label:A},{default:u(()=>[s(ss,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[p],onOnValueUpdated:function(m){t.onValueUpdated(m,p)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):x("",!0)}}}),D8={name:"ListSelectFilter",props:["settings","field"],computed:{listItems(){let e=this.settings[this.field.filter_by];this.field.parsedType=="number"&&(e=parseInt(e));let t=[];return Rn(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},T8={class:"fluent_cart_list_select_filter"};function Q8(e,t,a,l,n,i){const A=C("el-option"),p=C("el-select");return r(),h("div",T8,[s(p,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=m=>a.settings[a.field.key]=m),placeholder:a.field.placeholder},{default:u(()=>[(r(!0),h(P,null,ae(i.listItems,m=>(r(),E(A,{key:m.label,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const M8=nt(D8,[["render",Q8]]),L8={name:"DropdownLabelRepeater",components:{FieldGeneral:ss},props:["settings","field","inputs","errors","editorShortcodes"],data(){return{loading:!1}},methods:{addItemAfter(e){this.loading=!0,this.settings[this.field.key].splice(e+1,0,{item_value:"",label:""}),this.$nextTick(()=>{this.loading=!1})},removeItem(e){this.loading=!0,this.settings[this.field.key].splice(e,1),this.$nextTick(()=>{this.loading=!1})}}},R8={class:"dropdown_label_repeater"},O8={key:0,class:"fluent_cart-table"};function P8(e,t,a,l,n,i){const A=C("el-input"),p=C("FieldGeneral"),m=C("el-button"),_=C("el-button-group");return r(),h("div",R8,[n.loading?x("",!0):(r(),h("table",O8,[o("thead",null,[o("tr",null,[o("th",null,f(a.field.field_label||"Field Label"),1),o("th",null,f(a.field.value_label||"Field Value"),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,ae(a.settings[a.field.key],(g,y)=>(r(),h("tr",{key:"item_"+y},[o("td",null,[s(A,{placeholder:a.field.field_label||"Field Label",modelValue:g.label,"onUpdate:modelValue":v=>g.label=v},null,8,["placeholder","modelValue","onUpdate:modelValue"])]),o("td",null,[s(p,{editorShortcodes:a.editorShortcodes,modelValue:g.item_value,"onUpdate:modelValue":v=>g.item_value=v},null,8,["editorShortcodes","modelValue","onUpdate:modelValue"])]),o("td",null,[s(_,null,{default:u(()=>[s(m,{type:"success",onClick:v=>i.addItemAfter(y)},{default:u(()=>t[1]||(t[1]=[R("+",-1)])),_:2,__:[1]},1032,["onClick"]),s(m,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>i.removeItem(y)},{default:u(()=>t[2]||(t[2]=[R("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const H8=nt(L8,[["render",P8]]),N8={name:"DropdownManyFields",components:{FieldGeneral:ss,DynamicIcon:X,IconButton:tt},props:["settings","field","inputs","errors","editorShortcodes"],data(){return{test:"null",rendered_labels:{remote_text:this.field.remote_text||"Field Label",local_text:this.field.local_text||"Field Value"}}},mounted(){(!this.settings[this.field.key]||!this.settings[this.field.key].length)&&(this.settings[this.field.key]=[{item_value:this.field,label:""}])},methods:{addNewItem(){this.settings[this.field.key].push({item_value:"",label:""})},removeItem(e){this.settings[this.field.key].length!==1&&this.settings[this.field.key].splice(e,1)}}},K8={class:"dropdown_label_repeater w-full"},G8={class:"fluent_cart-table w-full text-left"},z8={class:"action-btns"},j8={class:"dropdown_label_repeater_footer"};function q8(e,t,a,l,n,i){const A=C("el-option"),p=C("el-select"),m=C("FieldGeneral"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-button");return r(),h("div",K8,[o("table",G8,[t[1]||(t[1]=o("colgroup",null,[o("col",{width:"25%"}),o("col",{width:"70%"}),o("col",{width:"10%"})],-1)),o("thead",null,[o("tr",null,[o("th",null,f(n.rendered_labels.remote_text),1),o("th",null,f(n.rendered_labels.local_text),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,ae(a.settings[a.field.key],(v,k)=>(r(),h("tr",{key:"item_"+k},[o("td",null,[s(p,{modelValue:v.label,"onUpdate:modelValue":b=>v.label=b},{default:u(()=>[(r(!0),h(P,null,ae(a.field.options,(b,w)=>(r(),E(A,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[s(m,{editorShortcodes:a.editorShortcodes,defaultValue:typeof v.item_value=="object"?"":v.item_value,modelValue:v.item_value,"onUpdate:modelValue":b=>v.item_value=b},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),o("td",null,[o("div",z8,[s(g,{size:"x-small",tag:"button",onClick:Ge(b=>i.removeItem(k),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:u(()=>[s(_,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),o("div",j8,[s(y,{text:"",onClick:Ge(i.addNewItem,["prevent"])},{default:u(()=>[s(_,{name:"Plus"}),R(" "+f(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const Y8=nt(N8,[["render",q8]]),W8={name:"ChainedFields",props:["settings","field","value"],data(){return{loading:!1,app_ready:!1,categories:[],subcategories:[],chained_settings:{category:"",sub_category:""},selected_subcategory:""}},computed:{listItems(){}},watch:{"settings.list_id"(){this.field.require_list&&this.fetchSettings()}},mounted(){this.settings[this.field.key]?this.chained_settings=this.settings[this.field.key]:this.settings[this.field.key]=this.chained_settings,this.app_ready=!0,this.fetchSettings()},methods:{fetchSettings(){this.loading=!0,this.$post("integration/feed/chained",{route:this.field.remote_url,settings:this.settings}).then(e=>{this.loading=!1,this.categories=e.data.categories,this.subcategories=e.data.subcategories,e.data.reset_values&&(this.chained_settings={category:"",sub_category:""})}).catch(e=>{})},handleCategoryChange(){this.$set(this.settings,this.field.key.category,this.selected_category),this.fetchSettings()}}},J8={class:"fluent_cart_chained_filter"};function X8(e,t,a,l,n,i){const A=C("el-option"),p=C("el-select"),m=Qa("loading");return Jt((r(),h("div",J8,[s(p,{onChange:t[0]||(t[0]=_=>i.handleCategoryChange()),clearable:"",modelValue:n.chained_settings.category,"onUpdate:modelValue":t[1]||(t[1]=_=>n.chained_settings.category=_),placeholder:a.field.category_label},{default:u(()=>[(r(!0),h(P,null,ae(n.categories,_=>(r(),E(A,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),Jt(s(p,{modelValue:n.chained_settings.sub_category,"onUpdate:modelValue":t[2]||(t[2]=_=>n.chained_settings.sub_category=_),clearable:"",placeholder:a.field.subcategory_label},{default:u(()=>[(r(!0),h(P,null,ae(n.subcategories,_=>(r(),E(A,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),[[$l,n.chained_settings.category]])])),[[m,n.loading]])}const Z8=nt(W8,[["render",X8]]),e4={name:"ChainedSelects",props:["settings","field","value"],data(){return{app_ready:!1,loading:!1}},mounted(){this.fetchSettings(),this.app_ready=!0},methods:{fetchSettings(){this.loading=!0,this.$get(this.field.remote_url,{settings:this.settings}).then(e=>{this.loading=!1;let t=e.data;Rn(t,(a,l)=>{this.$set(this.field,l,a)})}).catch(e=>{})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),Rn(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}}},t4={class:"fluent_cart_chained_filter"};function a4(e,t,a,l,n,i){const A=C("el-option"),p=C("el-select"),m=C("el-col"),_=C("el-row"),g=Qa("loading");return Jt((r(),h("div",t4,[s(_,{gutter:0},{default:u(()=>[(r(!0),h(P,null,ae(a.field.fields_options,(y,v)=>(r(),E(m,{span:12,key:v,class:"fluent_carteach_filter"},{default:u(()=>[o("label",null,f(a.field.options_labels[v].label),1),s(p,{onChange:k=>i.handleSlectChange(v),filterable:"",clearable:"",placeholder:a.field.options_labels[v].placeholder,multiple:a.field.options_labels[v].type=="multi-select",modelValue:a.value[v],"onUpdate:modelValue":k=>a.value[v]=k},{default:u(()=>[(r(!0),h(P,null,ae(y,(k,b)=>(r(),E(A,{key:b,value:b,label:k},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,n.loading]])}const l4=nt(e4,[["render",a4]]),s4={name:"RoutingFilterFields",components:{DynamicIcon:X,IconButton:tt,FieldGeneral:ss},props:{routings:{type:Array,required:!0,default(){return[]}},fields:{type:Object,required:!0,default(){return{}}},disabled:{type:Boolean,required:!1,default:!1},labels:{default:()=>({input_label:"Send To",input_placeholder:"Email Address"})},input_type:{type:String,default:"text"},input_options:{type:Object,required:!1,default(){return{}}},editorShortcodes:{type:Object}},data(){return{defaultRules:{input_value:"",field:"",operator:"=",value:null},comingSoon:!1}},mounted(){(!this.routings||!this.routings.length)&&this.routings.push({...this.defaultRules})},methods:{add(e){this.routings.splice(e+1,0,{...this.defaultRules})},remove(e){this.routings.splice(e,1)}}},n4={class:"fluent_cart_routing_fields"},o4={key:0,class:"fluent_cart_routing_table"},i4={class:"fluent_cart_inline"},r4={class:"action-btns"};function d4(e,t,a,l,n,i){const A=C("el-input"),p=C("el-option"),m=C("el-select"),_=C("FieldGeneral"),g=C("DynamicIcon"),y=C("IconButton");return r(),h("div",n4,[a.disabled?x("",!0):(r(),h("table",o4,[o("tbody",null,[(r(!0),h(P,null,ae(a.routings,(v,k)=>(r(),h("tr",{key:k},[o("td",null,[o("label",i4,f(a.labels.input_label),1),a.input_type=="text"?(r(),E(A,{key:0,placeholder:a.labels.input_placeholder,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(r(),E(m,{key:1,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b,placeholder:a.labels.input_placeholder},{default:u(()=>[(r(!0),h(P,null,ae(a.input_options,(b,w)=>(r(),E(p,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),t[0]||(t[0]=o("td",null,"If",-1)),o("td",null,[s(_,{editorShortcodes:a.editorShortcodes,modelValue:v.field,"onUpdate:modelValue":b=>v.field=b,defaultValue:v.field,onChange:b=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),o("td",null,[s(m,{modelValue:v.operator,"onUpdate:modelValue":b=>v.operator=b,class:"w-[100px]"},{default:u(()=>[s(p,{value:"=",label:"equal"}),s(p,{value:"!=",label:"not equal"}),s(p,{value:">",label:"greater than"}),s(p,{value:"<",label:"less than"}),s(p,{value:">=",label:"greater than or equal"}),s(p,{value:"<=",label:"less than or equal"}),a.fields[v.field]&&!Object.keys(a.fields[v.field].options).length?(r(),h(P,{key:0},[s(p,{value:">",label:"greater than"}),s(p,{value:"<",label:"less than"}),s(p,{value:">=",label:"greater than or equal"}),s(p,{value:"<=",label:"less than or equal"}),s(p,{value:"contains",label:"contains"}),s(p,{value:"doNotContains",label:"do not contains"}),s(p,{value:"startsWith",label:"starts with"}),s(p,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[a.fields[v.field]&&Object.keys(a.fields[v.field].options).length?(r(),E(m,{key:0,modelValue:v.value,"onUpdate:modelValue":b=>v.value=b,style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,ae(a.fields[v.field].options,(b,w)=>(r(),E(p,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(A,{key:1,placeholder:e.$t("Enter a value"),modelValue:v.value,"onUpdate:modelValue":b=>v.value=b},null,8,["placeholder","modelValue","onUpdate:modelValue"]))]),o("td",null,[o("div",r4,[s(y,{size:"x-small",tag:"button",onClick:Ge(b=>i.add(k),["prevent"])},{default:u(()=>[s(g,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(r(),E(y,{key:0,size:"x-small",tag:"button",onClick:Ge(b=>i.remove(k),["prevent"])},{default:u(()=>[s(g,{name:"Minus"})]),_:2},1032,["onClick"])):x("",!0)])])]))),128))])]))])}const u4=nt(s4,[["render",d4]]),c4={name:"SelectionRouting",components:{RoutingFilterFields:u4,FiledGeneral:ss},props:["field","settings","inputs","editorShortcodes"]},A4={class:"fluent_cart_field_routing"},p4={class:"mb-4"},f4={key:3};function m4(e,t,a,l,n,i){const A=C("el-checkbox"),p=C("el-option"),m=C("el-select"),_=C("el-input"),g=C("FiledGeneral"),y=C("RoutingFilterFields");return r(),h("div",A4,[o("div",p4,[s(A,{modelValue:a.settings[a.field.routing_key],"onUpdate:modelValue":t[0]||(t[0]=v=>a.settings[a.field.routing_key]=v),"true-value":"routing","false-value":"simple"},{default:u(()=>[R(f(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),o("div",null,[a.field.simple_component=="select"?(r(),E(m,{key:0,disabled:a.settings[a.field.routing_key]!="simple",filterable:"",clearable:"",multiple:a.field.is_multiple,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[1]||(t[1]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},{default:u(()=>[(r(!0),h(P,null,ae(a.field.options,(v,k)=>(r(),E(p,{key:k,value:k,label:v},null,8,["value","label"]))),128))]),_:1},8,["disabled","multiple","modelValue","placeholder"])):a.field.simple_component=="text"?(r(),E(_,{key:1,disabled:a.settings[a.field.routing_key]!="simple",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[2]||(t[2]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},null,8,["disabled","modelValue","placeholder"])):a.field.simple_component=="value_text"&&a.settings[a.field.routing_key]=="simple"?(r(),E(g,{key:2,editorShortcodes:a.editorShortcodes,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[3]||(t[3]=v=>a.settings[a.field.key]=v)},null,8,["editorShortcodes","modelValue"])):x("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),h("p",f4,f(a.field.inline_tip),1)):x("",!0)]),a.settings[a.field.routing_key]=="routing"?(r(),E(y,{key:0,routings:a.settings[a.field.settings_key],input_type:a.field.routing_input_type,fields:a.inputs,labels:a.field.labels,input_options:a.field.options,editorShortcodes:a.editorShortcodes},null,8,["routings","input_type","fields","labels","input_options","editorShortcodes"])):x("",!0)])}const h4=nt(c4,[["render",m4]]),_4={name:"CustomComponentRender",props:{field:{type:Object,required:!0},settings:{type:Object,required:!0}},data(){return{message:"This is a custom component render"}},render(){if(this.field&&this.field.render_template){const e=`<div>${this.field.render_template}</div>`,t=Am(e).bind(this);return pm(t,{settings:this.settings,app:this})}return null}},v4={name:"FeedHeader",props:{integration_title:String,settings:Object},computed:{ArrowRight(){return Za},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},g4={class:"fct-feed-header mb-5"},y4={class:"mb-5 flex items-center justify-between"};function b4(e,t,a,l,n,i){const A=C("el-breadcrumb-item"),p=C("el-breadcrumb"),m=C("el-switch");return r(),h("div",g4,[o("div",y4,[s(p,{"separator-icon":i.ArrowRight},{default:u(()=>[s(A,{to:i.prevRoute},{default:u(()=>[R(f(e.$t("Integrations")),1)]),_:1},8,["to"]),s(A,null,{default:u(()=>[o("span",null,f(a.integration_title),1)]),_:1})]),_:1},8,["separator-icon"]),s(m,{modelValue:a.settings.enabled,"onUpdate:modelValue":t[0]||(t[0]=_=>a.settings.enabled=_),"active-value":"yes","inactive-value":"no","active-text":e.$t("Enable this Integration")},null,8,["modelValue","active-text"])])])}const w4=nt(v4,[["render",b4]]);class C4{constructor(){this.errors={}}get(t){if(this.errors[t])return this.errors[t]}first(t){if(this.errors[t]){let a=Object.keys(this.errors[t]);return a.length?this.errors[t][a[0]]:""}}has(t){return!!this.errors[t]}record(t){this.errors=t}clear(t){t?this.errors[t]=null:this.errors={}}}const k4={name:"RestSelector",props:["field","modelValue"],emits:["update:modelValue"],data(){return{model:this.modelValue,loading:!1,options:[]}},watch:{model(e){this.$emit("update:modelValue",e)}},mounted(){this.fetchOptions("")},methods:{fetchOptions(e){let t=this.field.option_key;this.field.extended_key&&(t+="_"+this.field.extended_key);let a="";if(this.field.cacheable){if(a+="_fcrm_ajax_cache_"+t,window[a]){this.options=window[a];return}}else if(this.field.experimental_cache&&(a+="_fcrm_ajax_cache_"+t+"_"+e+" "+JSON.stringify(this.model),this.field.sub_option_key&&(a+="_"+JSON.stringify(this.field.sub_option_key)),window[a])){this.options=window[a];return}if(this.doing_ajax)return!1;this.loading=!0;const l={search:e,values:this.model,option_key:t};this.field.sub_option_key&&(l.sub_option_key=this.field.sub_option_key),this.$get("integration/feed/dynamic_options",l).then(n=>{this.options=n.options,a&&n.options&&(window[a]=n.options)}).catch(n=>{this.handleError(n)}).finally(()=>{this.loading=!1})}}};function B4(e,t,a,l,n,i){const A=C("el-option"),p=C("el-select"),m=Qa("loading");return Jt((r(),E(p,{modelValue:n.model,"onUpdate:modelValue":t[0]||(t[0]=_=>n.model=_),multiple:a.field.is_multiple,filterable:"",remote:!a.field.cacheable,clearable:a.field.clearable,disabled:a.field.disabled,"reserve-keyword":"","allow-create":a.field.creatable,size:a.field.size,placeholder:a.field.placeholder||e.$t("Please enter a keyword"),"remote-method":i.fetchOptions},{default:u(()=>[(r(!0),h(P,null,ae(n.options,_=>(r(),E(A,{key:_.id,label:_.title,value:_.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","multiple","remote","clearable","disabled","allow-create","size","placeholder","remote-method"])),[[m,n.loading]])}const x4=nt(k4,[["render",B4]]),S4={name:"FeedEditor",components:{FilterFields:_8,MergeFieldMapper:V8,FiledGeneral:ss,ListSelectFilter:M8,DropDownLabelRepeater:H8,DropDownManyFields:Y8,ChainedFields:Z8,ChainedSelects:l4,SelectionRouting:h4,CardContainer:xe,CardBody:Be,CardHeader:Ve,LabelHint:Ot,FeedHeader:w4,ErrorView:Xo,CustomComponentRender:_4,RestSelector:x4},data(){return{loading_app:!1,loading_list:!1,errors:new C4,integration_id:parseInt(this.$route.params.integration_id),integration_name:this.$route.params.integration_name,saving:!1,merge_fields:{},settings:{},settings_fields:{},attachedForms:[],inputs:[],editorShortcodes:[],scope:"",product_variations:[]}},computed:{integrationTitle(){var e;return((e=this.settings_fields)==null?void 0:e.integration_title)||Aa.studly(this.integration_name,"_")},getTitle(){let e=this.settings_fields.integration_title||"";return this.integration_id?`Update ${e} Integration Feed`:`Add New ${e} Integration Feed`},maybeShowSaveButton(){let e=this.settings_fields,t=this.merge_fields;return e.button_require_list&&t||!e.button_require_list}},mounted(){this.loadIntegrationSettings()},methods:{translate:d,loadIntegrationSettings(){if(this.$route.name==="product_integration_feed_editor"){this.loading_app=!0;const e=this.$route.params.product_id;this.$get(`products/${e}/integrations/${this.integration_name}/settings`,{integration_id:this.integration_id}).then(t=>{this.loading_app=!1,this.settings_fields=t.settings_fields,this.scope=t.scope,this.product_variations=t.product_variations,this.settings=t.settings,this.editorShortcodes=Object.values(t.shortcodes||{}),this.inputs=t.inputs,this.settings.name||(this.settings.name=t.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=t.merge_fields}).catch(t=>{var a;this.loading_app=!1,t.status_code=="422"?j.validationErrors(t):j.error((a=t.data)==null?void 0:a.message)})}else this.loading_app=!0,this.$get("integration/global-feeds/settings",{integration_id:this.integration_id,integration_name:this.integration_name}).then(e=>{this.loading_app=!1,this.settings_fields=e.settings_fields,this.settings=e.settings,this.editorShortcodes=Object.values(e.shortcodes),this.inputs=e.inputs,this.settings.name||(this.settings.name=e.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=e.merge_fields}).catch(e=>{var t,a;this.loading_app=!1,this.handleError(((a=(t=e.responseJSON)==null?void 0:t.data)==null?void 0:a.message)||"Failed to load integration settings")})},loadMergeFields(){this.loading_list=!0,this.fieldsLoaded=!1,this.$get("integration/feed/lists",{integration_id:this.integration_id,list_id:this.settings.list_id,integration_name:this.integration_name}).then(e=>{this.loading_list=!1,this.merge_fields=e.merge_fields,this.fieldsLoaded=!0}).catch(e=>{})},saveNotification(){if(this.errors.clear(),this.$route.name==="product_integration_feed_editor"){this.saving=!0;const e=this.$route.params.product_id;let t={integration_id:this.integration_id,integration_name:this.integration_name,integration:JSON.stringify(this.settings)};this.$post(`products/${e}/integrations`,t).then(a=>{a.feedData&&(this.settings=a.feedData),a.created&&this.$router.push({name:"product_integrations",params:{product_id:e}}),this.handleSuccess(a.message||"Integration saved successfully"),this.errors.clear()}).catch(a=>{var l;this.errors.record(((l=a==null?void 0:a.data)==null?void 0:l.errors)||{}),this.handleError(a)}).finally(()=>{this.saving=!1})}else{this.saving=!0;let e={integration_id:this.integration_id,integration_name:this.integration_name,integration:JSON.stringify(this.settings)};this.$post("integration/global-feeds/settings",e).then(t=>{t.created&&this.$router.push({name:"integrations"}),this.handleSuccess(t.message)}).catch(t=>{var a;this.errors.record(((a=t==null?void 0:t.data)==null?void 0:a.errors)||{}),this.handleError(t)}).finally(()=>{this.saving=!1})}},setMergeModel(e){this.settings[e.key]={}}}},$4={class:"fct-integration-container fct-layout-width"},F4={class:"fct-add-integration py-7.5"},E4={class:"grid gap-5"},U4={key:0,class:"fct-setting-form-content"},I4=["innerHTML"],V4={class:"fct-setting-form-fields"},D4=["innerHTML"],T4=["innerHTML"],Q4=["innerHTML"],M4={key:0,class:"fct-setting-form-row"},L4={class:"fct-setting-form-content"},R4={class:"fct-setting-form-content"},O4={class:"fct-setting-form-fields"},P4={class:"fct-inline-tip pl-6"},H4={key:0,class:"setting-save-action"};function N4(e,t,a,l,n,i){const A=C("el-skeleton-item"),p=C("el-skeleton"),m=C("FeedHeader"),_=C("LabelHint"),g=C("el-input"),y=C("ErrorView"),v=C("el-option"),k=C("el-select"),b=C("MergeFieldMapper"),w=C("el-checkbox"),B=C("el-checkbox-group"),S=C("el-option-group"),V=C("FilterFields"),F=C("FiledGeneral"),$=C("ListSelectFilter"),U=C("DropDownLabelRepeater"),D=C("DropDownManyFields"),T=C("el-radio"),I=C("el-radio-group"),L=C("el-input-number"),O=C("ChainedFields"),Q=C("ChainedSelects"),H=C("SelectionRouting"),K=C("RestSelector"),W=C("CardBody"),z=C("CardContainer"),Y=C("el-button"),Z=C("el-form"),re=Qa("loading");return r(),h("div",$4,[o("div",F4,[s(p,{loading:n.loading_app,class:"bg-white rounded p-6 mb-7.5 dark:bg-dark-700",animated:""},{template:u(()=>[s(A,{variant:"h3",class:"w-[150px] mb-5"}),o("div",E4,[o("div",null,[s(A,{variant:"h3",class:"w-[50px] mb-3"}),s(A,{variant:"p"})]),o("div",null,[s(A,{variant:"h3",class:"w-[50px] mb-3"}),s(A,{variant:"p"})])])]),_:1},8,["loading"]),n.loading_app?x("",!0):(r(),E(Z,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[s(m,{settings:n.settings,integration_title:i.integrationTitle},null,8,["settings","integration_title"]),s(z,null,{default:u(()=>[s(W,null,{default:u(()=>[(r(!0),h(P,null,ae(n.settings_fields.fields,(q,Ae)=>(r(),h("div",{key:Ae,class:ue(["fct-setting-form-row",q.key])},[q.label?(r(),h("div",U4,[q.tips?(r(),E(_,{key:0,title:q.label,content:q.tips,placement:"top-start",required:q.required},null,8,["title","content","required"])):(r(),E(_,{key:1,title:q.label,required:q.required},null,8,["title","required"])),q.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:q.inline_tip},null,8,I4)):x("",!0)])):x("",!0),o("div",V4,[q.component==="text"?(r(),h(P,{key:0},[s(g,{placeholder:q.placeholder,modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie,class:ue(n.errors.errors[q.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),s(y,{field:q.key,errors:n.errors},null,8,["field","errors"])],64)):q.component==="list_ajax_options"?(r(),h(P,{key:1},[Jt((r(),E(k,{onChange:t[0]||(t[0]=ie=>i.loadMergeFields()),modelValue:n.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=ie=>n.settings.list_id=ie),placeholder:q.placeholder,clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(ie,J)=>(r(),E(v,{key:J,value:J,label:ie},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[re,n.loading_list]]),s(y,{field:q.key,errors:n.errors},null,8,["field","errors"])],64)):q.component==="map_fields"?(r(),E(b,{key:2,onSetMergeModelObj:ie=>i.setMergeModel(q),errors:n.errors,inputs:n.inputs,field:q,settings:n.settings,editorShortcodes:n.editorShortcodes,merge_model:n.settings[q.key],merge_fields:n.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):q.component==="select"?(r(),h(P,{key:3},[s(k,{filterable:"",clearable:"",multiple:q.is_multiple,modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie,placeholder:q.placeholder},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(ie,J)=>(r(),E(v,{key:J,value:J,label:ie},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),s(y,{field:q.key,errors:n.errors},null,8,["field","errors"])],64)):q.component==="checkbox-single"?(r(),h(P,{key:4},[s(w,{modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie},{default:u(()=>[R(f(q.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),q.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:q.inline_tip},null,8,D4)):x("",!0)],64)):q.component==="yes-no-checkbox"?(r(),h(P,{key:5},[s(w,{"true-value":"yes","false-value":"no",modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie},{default:u(()=>[R(f(q.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),q.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:q.inline_tip},null,8,T4)):x("",!0)],64)):q.component==="checkbox-multiple"?(r(),E(B,{key:6,modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(ie,J)=>(r(),E(w,{key:J,label:Number(J)},{default:u(()=>[R(f(ie),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):q.component==="selection_group"?(r(),h(P,{key:7},[s(k,{modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie,placeholder:q.placeholder,multiple:"",class:ue(n.errors.errors[q.key]?"is-error":"")},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(ie,J)=>(r(),E(S,{key:J,label:ie.label},{default:u(()=>[(r(!0),h(P,null,ae(ie.options,N=>(r(),E(v,{key:N.value,label:N.label,value:N.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"]),s(y,{field:q.key,errors:n.errors},null,8,["field","errors"])],64)):q.component==="conditional_block"?(r(),E(V,{key:8,fields:n.inputs,conditionals:n.settings[q.key],editorShortcodes:n.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):q.component==="value_text"?(r(),E(F,{key:9,editorShortcodes:n.editorShortcodes,defaultValue:n.settings[q.key],modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):q.component==="value_textarea"?(r(),E(F,{key:10,field_type:"textarea",editorShortcodes:n.editorShortcodes,defaultValue:n.settings[q.key],modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):q.component==="list_select_filter"?(r(),E($,{key:11,settings:n.settings,field:q},null,8,["settings","field"])):q.component==="dropdown_label_repeater"?(r(),E(U,{key:12,errors:n.errors,inputs:n.inputs,field:q,settings:n.settings,editorShortcodes:n.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):q.component==="dropdown_many_fields"?(r(),E(D,{key:13,errors:n.errors,inputs:n.inputs,field:q,settings:n.settings,editorShortcodes:n.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):q.component==="radio_choice"?(r(),E(I,{key:14,modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(ie,J)=>(r(),E(T,{key:J,label:J},{default:u(()=>[R(f(ie),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):q.component==="number"?(r(),E(L,{key:15,size:"default",modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie},null,8,["modelValue","onUpdate:modelValue"])):q.component==="chained_fields"?(r(),E(O,{key:16,settings:n.settings,modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie,field:q},null,8,["settings","modelValue","onUpdate:modelValue","field"])):q.component==="chained_select"?(r(),E(Q,{key:17,settings:n.settings,modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie,field:q},null,8,["settings","modelValue","onUpdate:modelValue","field"])):q.component==="html_info"?(r(),h("div",{key:18,innerHTML:q.html_info},null,8,Q4)):q.component==="selection_routing"?(r(),E(H,{key:19,inputs:n.inputs,field:q,editorShortcodes:n.editorShortcodes,settings:n.settings},null,8,["inputs","field","editorShortcodes","settings"])):q.component==="rest_selector"?(r(),E(K,{key:20,field:q,modelValue:n.settings[q.key],"onUpdate:modelValue":ie=>n.settings[q.key]=ie},null,8,["field","modelValue","onUpdate:modelValue"])):q.component==="custom_component"?(r(),E(bl("custom-component-render"),{key:21,field:q,settings:n.settings},null,8,["field","settings"])):x("",!0)])],2))),128)),n.scope==="product"&&n.product_variations.length?(r(),h("div",M4,[o("div",L4,[o("div",R4,[s(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",O4,[s(k,{filterable:"",clearable:"",multiple:!0,modelValue:n.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=q=>n.settings.conditional_variation_ids=q),placeholder:e.$t("Leave empty for all the variations")},{default:u(()=>[(r(!0),h(P,null,ae(n.product_variations,q=>(r(),E(v,{key:q.id,value:q.id,label:q.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),o("p",P4,f(e.$t("Leave empty to run this feed for all variations")),1)])])):x("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),h("div",H4,[s(Y,{type:"primary",loading:n.saving,onClick:i.saveNotification},{default:u(()=>[R(f(n.integration_id?`Update ${n.settings_fields.integration_title} Feed`:`Create ${n.settings_fields.integration_title} Feed`),1)]),_:1},8,["loading","onClick"])])):x("",!0)]),_:1}))])])}const pc=nt(S4,[["render",N4]]),K4={class:"setting-wrap"},G4={key:0,class:"integration-actions"},z4={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},j4={class:"text-base"},q4={key:1,class:"fct-integrations-table-wrap"},Y4={class:"fct-integration-logo-wrap"},W4=["src","alt"],J4={class:"text-xs text-gray-700"},X4=["onClick"],Z4={class:"fct-event-triggers"},ex={class:"fct-event-triggers"},tx={class:"fct-btn-group sm"},ax={key:2,class:"fct-integration-table-footer"},lx={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},sx={name:"GloablIntegration",props:["editorShortcodes"],data(){return{loading:!0,feeds:[],available_integrations:{},all_module_config_url:""}},computed:{hasActiveIntegrations(){return Object.values(this.available_integrations).some(e=>e.enabled)}},mounted(){this.getFeeds()},methods:{getFeeds(){this.loading=!0,this.$get("integration/global-feeds").then(e=>{this.available_integrations=e.available_integrations,this.feeds=e.feeds,this.all_module_config_url=e.all_module_config_url}).catch(e=>{this.loading=!1}).finally(()=>{this.loading=!1})},handleActive(e){let t={status:e.enabled};this.$post(`integration/global-feeds/change-status/${e.id}`,t).then(a=>{this.handleSuccess(a.message)}).catch(a=>{var l;this.handleError((l=a==null?void 0:a.data)==null?void 0:l.message)})},removeFeed(e,t){let a=t.$index;this.$confirm("Are you sure you want to delete this integration?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.$del(`integration/global-feeds/${e}`).then(l=>{this.handleSuccess(l.message),this.feeds.splice(a,1)}).catch(l=>{var n;this.handleError(((n=l==null?void 0:l.data)==null?void 0:n.message)||"Failed to delete integration.")})}).catch(()=>{})},add(e){let t=this.available_integrations[e];t&&t.enabled?this.$router.push({name:"feed_editor",params:{integration_id:0,integration_name:e}}):this.$notify.error({message:this.$t("This integration is not enabled. Please enable it from the integration modules.")})},edit(e){this.$router.push({name:"feed_editor",params:{integration_id:e.id,integration_name:e.provider}})},isEmpty:vd}},nx=Object.assign(sx,{setup(e){return(t,a)=>{const l=C("el-button"),n=C("el-dropdown-item"),i=C("el-dropdown-menu"),A=C("el-dropdown"),p=C("el-skeleton"),m=C("el-switch"),_=C("el-table-column"),g=C("el-tag"),y=C("el-popover"),v=C("el-tooltip"),k=C("el-table"),b=Qa("loading");return r(),h("div",K4,[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:t.$t("Global Integrations Feeds"),text:t.$t("These integration feeds will be applied globally across all your orders and related actions.")},{action:u(()=>[t.hasActiveIntegrations?(r(),h("div",G4,[s(A,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:u(()=>[s(i,null,{default:u(()=>[(r(!0),h(P,null,ae(t.available_integrations,(w,B)=>(r(),E(n,{key:B,command:B},{default:u(()=>[R(f(w.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[s(l,{type:"info",plain:"",size:"small"},{default:u(()=>[R(f(t.$t("Add Integration"))+" ",1),s(X,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title","text"]),s(Be,{class:"px-0 pb-0 pt-4"},{default:u(()=>[s(p,{class:"px-5 pb-5",loading:t.loading,animated:"",rows:6},null,8,["loading"]),t.loading?x("",!0):(r(),h(P,{key:0},[t.hasActiveIntegrations?(r(),h("div",q4,[Jt((r(),E(k,{data:t.feeds},{empty:u(()=>[s(wt,{icon:"Folder",text:t.$t("You did not add any integration actions yet.")},null,8,["text"])]),default:u(()=>[s(_,{label:t.$t("Enabled"),width:60},{default:u(w=>[s(m,{"active-value":"yes","inactive-value":"no",onChange:B=>t.handleActive(w.row),modelValue:w.row.enabled,"onUpdate:modelValue":B=>w.row.enabled=B},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),s(_,{width:120,label:t.$t("Integration")},{default:u(w=>{var B,S;return[o("div",Y4,[(B=t.available_integrations[w.row.provider])!=null&&B.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:t.available_integrations[w.row.provider].logo,alt:w.row.provider},null,8,W4)):x("",!0),o("span",J4,f(((S=t.available_integrations[w.row.provider])==null?void 0:S.title)||w.row.provider),1)])]}),_:1},8,["label"]),s(_,{width:220,label:t.$t("Title")},{default:u(w=>[o("a",{class:"fct-action-link-btn",onClick:Ge(B=>t.edit(w.row),["prevent"]),href:"#"},f(w.row.name),9,X4)]),_:1},8,["label"]),s(_,{width:160,label:t.$t("Triggers")},{default:u(w=>[o("div",Z4,[(r(!0),h(P,null,ae((w.row.feed.event_trigger||[]).slice(0,2),(B,S)=>(r(),E(g,{key:B},{default:u(()=>[s(X,{name:"Trigger"}),R(" "+f(c(Aa).headline(B)),1)]),_:2},1024))),128)),(w.row.feed.event_trigger||[]).length>2?(r(),E(y,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:u(()=>[s(g,{type:"info"},{default:u(()=>[R(" +"+f((w.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:u(()=>[o("div",ex,[(r(!0),h(P,null,ae((w.row.feed.event_trigger||[]).slice(2),(B,S)=>(r(),E(g,{key:B+S},{default:u(()=>[s(X,{name:"Trigger"}),R(" "+f(c(Aa).headline(B)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),s(_,{width:80},{default:u(w=>[o("div",tx,[s(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{tag:"button",onClick:B=>t.edit(w.row),size:"x-small",hover:"primary"},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),s(v,{effect:"dark",content:t.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{tag:"button",size:"x-small",onClick:B=>t.removeFeed(w.row.id,w),hover:"danger"},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[b,t.loading]])])):(r(),h("div",z4,[o("p",j4,f(t.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),s(l,{tag:"a",type:"primary",href:t.all_module_config_url},{default:u(()=>[R(f(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?x("",!0):(r(),h("div",ax,[o("a",lx,f(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),ox={name:"Integrations",components:{Badge:Ht,FluidTabItem:Qo,FluidTab:ud,CardBody:Be,CardContainer:xe,CardHeader:Ve,PageHeading:Xa,IconButton:tt,DynamicIcon:X,Empty:wt,GlobalIntegrationFeeds:nx},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:Ke.get("admin_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};Rn(e,(a,l)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[l]=a)}),e=t}if(this.module_type!="all"){let t={};Rn(e,(a,l)=>{a.categories&&a.categories.includes(this.module_type)&&(t[l]=a)}),e=t}return e},is_no_modules(){return vd(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{upgradeUrl:Ro,fetchAddons(){this.fetching=!0,this.$get("integration/addons").then(e=>{this.addOns=e.addons}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},translate:d,changeModuleType(e){this.module_type=e},installAddon(e,t){this.installing=!0,this.installingAdding=t,this.$post("integration/feed/install-plugin",{addon:t}).then(a=>{this.$notify.success(a.message),window.location.reload()}).catch(a=>{this.handleError(a)}).finally(()=>{this.installing=!1,this.installingAdding=""})}}},ix={class:"fct-integration-container fct-layout-width"},rx={class:"fct-integration-content mt-8"},dx={class:"fct-integration-content-head"},ux={class:"fct-card-header-title mb-1"},cx={class:"card-header-text mt-0"},Ax={class:"flex items-center gap-3 justify-between py-5 mt-5 border border-solid border-gray-divider border-x-0 dark:border-dark-500 flex-col md:flex-row"},px={class:"fct-integration-search"},fx={key:1},mx={class:"fct-integration-card-content"},hx={class:"fct-integration-card-content-inner"},_x={class:"fct-integration-card-logo"},vx=["src","alt"],gx={class:"title"},yx={class:"desc"},bx={key:0,class:"mt-2"},wx={key:1,class:"mt-2"};function Cx(e,t,a,l,n,i){const A=C("PageHeading"),p=C("GlobalIntegrationFeeds"),m=C("DynamicIcon"),_=C("IconButton"),g=C("FluidTabItem"),y=C("FluidTab"),v=C("el-input"),k=C("el-skeleton"),b=C("Badge"),w=C("el-button"),B=C("Empty"),S=C("CardBody"),V=C("CardContainer");return r(),h("div",ix,[s(A,{title:e.$t("Integrations")},null,8,["title"]),s(p),o("div",rx,[s(V,null,{default:u(()=>[s(S,null,{default:u(()=>[o("div",dx,[s(_,{circle:"",size:"large"},{default:u(()=>[s(m,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",ux,f(e.$t("Integration Modules")),1),o("p",cx,f(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",Ax,[s(y,null,{default:u(()=>[(r(!0),h(P,null,ae(n.modules,(F,$)=>(r(),E(g,{key:$,class:ue(["uppercase",F===n.module_type?"active":""]),onClick:U=>i.changeModuleType(F)},{default:u(()=>[R(f(F),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",px,[s(v,{placeholder:e.$t("Search..."),modelValue:n.search,"onUpdate:modelValue":t[0]||(t[0]=F=>n.search=F)},{prefix:u(()=>[s(m,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),n.fetching?(r(),E(k,{key:0,loading:!0,animated:"",rows:4})):x("",!0),n.fetching?x("",!0):(r(),h("div",fx,[(r(!0),h(P,null,ae(i.filteredAddons,(F,$)=>(r(),h("div",{key:$,class:ue(["fct-integration-card","addon-enabled-"+F.enabled])},[o("div",mx,[o("div",hx,[o("div",_x,[F.logo?(r(),h("img",{key:0,src:F.logo,alt:F.title},null,8,vx)):x("",!0)]),o("div",null,[o("h5",gx,[R(f(F.title)+" ",1),F.is_pro&&!F.enabled?(r(),E(b,{key:0,status:"warning",text:"Pro"})):(r(),E(b,{key:1,status:F.enabled?"active":"info",text:F.enabled?"enabled":"disabled"},null,8,["status","text"]))]),o("p",yx,f(F.description),1),F.is_pro&&!F.is_pro_active?(r(),h("div",bx,[s(w,{type:"warning",size:"small",tag:"a",href:i.upgradeUrl("feature_lock_integrations"),target:"_blank"},{default:u(()=>[s(m,{name:"Crown",class:"mr-1"}),R(" "+f(i.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!F.enabled&&F.installable?(r(),h("div",wx,[s(w,{loading:n.installingAdding==$,disabled:n.installingAdding==$,onClick:U=>i.installAddon(F,$),type:"primary",size:"small"},{default:u(()=>[R(f(i.translate("Install %s",F.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):x("",!0)])])])],2))),128))])),i.is_no_modules&&!n.fetching?(r(),E(B,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):x("",!0)]),_:1})]),_:1})])])}const kx=nt(ox,[["render",Cx]]),Bx={class:"fct-connect-details"},xx={key:0,class:"fct-connect-require"},Sx=["src"],$x={key:1,class:"fct-connect-success"},Fx={class:"inline-flex items-center gap-3"},Ex={key:0,class:"display-name"},Ux={class:"display-role"},Ix={name:"ConnectAccount",props:["connect","connectConfig","mode","method","methodName","methodLabel","brandColor"],data(){return{saving:!1}},methods:{disconnect(){this.saving=!0,this.$post("settings/payment-methods/disconnect",{method:this.method,mode:this.mode}).then(e=>{this.saving=!1,this.$emit("reload_settings",!0)})}}},fc=Object.assign(Ix,{setup(e){return(t,a)=>{var A;const l=C("el-button"),n=C("el-tag"),i=C("el-popconfirm");return r(),h("div",Bx,[!e.connect||e.connect.error?(r(),h("div",xx,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,Sx),o("h4",null,f(c(d)("Connect your %1$s %2$s account",e.mode,e.methodName)),1),s(l,{tag:"a",href:e.connectConfig[e.mode+"_redirect"],style:fa({backgroundColor:e.brandColor,borderColor:e.brandColor,color:"white"})},{default:u(()=>[R(f(c(d)("Connect with %1$s",e.methodLabel)),1)]),_:1},8,["href","style"])])):(r(),h("div",$x,[o("div",Fx,[o("div",null,[e.connect.display_name?(r(),h("p",Ex,f(e.connect.display_name),1)):x("",!0),o("h4",Ux,f(t.$t("Administrator"))+" ("+f(t.$t("Owner"))+") ",1)]),s(n,{size:"small",type:"success"},{default:u(()=>[R(f(c(d)("Connected")),1)]),_:1})]),s(i,{width:"230","confirm-button-text":t.$t("Confirm"),"cancel-button-text":t.$t("No, Thanks"),icon:"el-icon-info","icon-color":"red",title:((A=e.connectConfig)==null?void 0:A.disconnect_note)??t.$t("Are you sure to disconnect?"),position:"top",onConfirm:t.disconnect},{reference:u(()=>[s(l,{type:"danger",plain:""},{default:u(()=>[R(f(c(d)("Disconnect")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])]))])}}}),Vx={__name:"Tabs",props:{fields:Object,settings:Object,tabs:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-tab-pane"),n=C("el-tabs");return r(),E(n,{class:"demo-tabs",modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=i=>e.settings[e.index]=i)},{default:u(()=>[(r(!0),h(P,null,ae(e.tabs.schema,(i,A)=>(r(),E(l,{label:i.label,name:i.value,key:A},{default:u(()=>[o("div",null,[s(Qd,{fields:i.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},Dx={class:"setting-label"},Tx=["innerHTML"],Qx={key:0},Mx={__name:"RadioSelectDependants",props:{fields:Object,settings:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-icon"),n=C("el-tooltip"),i=C("el-radio"),A=C("el-radio-group");return r(),h(P,null,[o("p",Dx,[R(f(e.fields[e.index].label)+" ",1),e.fields[e.index].tooltip?(r(),E(n,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:e.fields[e.index].tooltip},null,8,Tx)]),default:u(()=>[s(l,null,{default:u(()=>[s(c(dl))]),_:1})]),_:1})):x("",!0)]),s(A,{modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=p=>e.settings[e.index]=p)},{default:u(()=>[(r(!0),h(P,null,ae(e.fields[e.index].options,(p,m)=>(r(),E(i,{label:p,value:m,key:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),a[1]||(a[1]=o("br",null,null,-1)),a[2]||(a[2]=o("br",null,null,-1)),(r(!0),h(P,null,ae(e.fields[e.index].dependants,(p,m)=>(r(),h("div",{key:m},[e.settings[e.index]===p.value?(r(),h("div",Qx,[s(Qd,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):x("",!0)]))),128))],64)}}},Lx={name:"PayPalWebhookSetup",components:{Notify:j},props:["mode","webhook_info","testConnect","liveConnect"],data(){return{isLoading:!1,setupStatus:null,checkingWebhook:!1}},computed:{isConnected(){return this.mode==="test"&&this.testConnect||this.mode==="live"&&this.liveConnect}},watch:{testConnect(){this.checkWebhookStatus()},liveConnect(){this.checkWebhookStatus()}},mounted(){this.checkWebhookStatus()},methods:{checkWebhookStatus(){this.isConnected&&(this.checkingWebhook=!0,this.$get("settings/payment-methods/paypal/webhook/check",{mode:this.mode}).then(e=>{this.checkingWebhook=!1}).catch(e=>{this.checkingWebhook=!1}))},setupWebhook(){this.isLoading=!0,this.$post("settings/payment-methods/paypal/webhook/setup",{mode:this.mode}).then(e=>{this.isLoading=!1,this.setupStatus="success",j.success(e.message),this.$emit("reload_settings",!0)}).catch(e=>{this.isLoading=!1,this.setupStatus="error",j.error(e.message),setTimeout(()=>{window.location.reload()},2e3)})}}},Rx={key:0,class:"fluent_cart_paypal_webhook_setup"},Ox={class:"fluent_cart_paypal_webhook_setup_title"},Px=["innerHTML"],Hx={key:1};function Nx(e,t,a,l,n,i){const A=C("el-button"),p=Qa("loading");return i.isConnected?(r(),h("div",Rx,[o("p",Ox,"PayPal "+f(a.mode)+" webhook setup",1),a.webhook_info?Jt((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,Px)),[[p,n.checkingWebhook]]):(r(),h("div",Hx,[t[1]||(t[1]=o("p",{class:"fluent_cart_paypal_webhook_setup_description"}," Configure PayPal webhooks to receive real-time payment notifications ",-1)),t[2]||(t[2]=o("br",null,null,-1)),s(A,{type:e.text,loading:n.isLoading,onClick:i.setupWebhook,disabled:n.isLoading,class:"setup-button",size:"small"},{default:u(()=>t[0]||(t[0]=[o("span",null,"Setup Webhook",-1)])),_:1,__:[0]},8,["type","loading","onClick","disabled"])]))])):x("",!0)}const Kx=nt(Lx,[["render",Nx],["__scopeId","data-v-f187f73f"]]),Gx={key:0,class:"fct-col"},zx=["innerHTML"],jx={key:1,class:"fct-col"},qx={class:"font-bold p-6 mt-6 text-center bg-gray-200"},Yx={key:2,class:"fct-col"},Wx={class:"bg-gray-25 dark:bg-dark-500 p-5 rounded flex flex-col"},Jx={class:"text-red-700"},Xx={key:1},Zx={key:0},e3={class:"flex items-center justify-between"},t3={key:1,class:"flex items-center justify-between"},a3={class:"text-red-700"},l3={key:3,class:"fct-col"},s3={class:"setting-label"},n3=["innerHTML"],o3={key:0,class:"fct-settings-description"},i3={key:4,class:"fct-col"},r3=["innerHTML"],d3={key:0,class:"fct-settings-description"},u3={key:5,class:"fct-col"},c3={class:"setting-label"},A3=["innerHTML"],p3={key:0,class:"fct-settings-description"},f3={key:6,class:"fct-col"},m3={class:"setting-label flex items-center gap-1"},h3=["innerHTML"],_3={class:"options-img"},v3=["src"],g3={class:"options-name"},y3={class:"options-text"},b3={key:0,class:"fct-settings-description"},w3={key:7,class:"fct-col"},C3={key:0},k3=["innerHTML"],B3={key:8,class:"fct-col"},x3={class:"setting-label"},S3={key:0,class:"fct-settings-description"},$3={key:9,class:"fct-col"},F3={class:"setting-label"},E3={key:0,class:"fct-settings-description"},U3={key:10,class:"fct-col"},I3={class:"setting-label"},V3={key:0,class:"fct-settings-description"},D3={key:11,class:"fct-col"},T3={class:"setting-label"},Q3=["innerHTML"],M3={key:0,class:"fct-settings-description"},L3={key:12,class:"fct-col"},R3={class:"setting-label"},O3=["innerHTML"],P3={key:0,class:"fct-settings-description"},H3={key:13,class:"fct-col"},N3={class:"setting-label"},K3=["innerHTML"],G3={key:0,class:"fct-settings-description"},z3={key:14,class:"fct-col"},j3={class:"setting-label"},q3={key:0,class:"fct-settings-description"},Y3={key:15,class:"fct-col"},W3=["innerHTML"],J3={key:1},X3={key:0,class:"setting-label"},Z3={key:1,class:"copyable-content"},eS={key:2},tS={key:0,class:"setting-label"},aS={class:"fct-payment-steps-list"},lS={class:"fct-payment-steps-number"},sS=["innerHTML"],nS={key:4,class:"fct-events-wrap"},oS={class:"setting-label"},iS={class:"flex items-center gap-2 flex-wrap"},rS={class:"copyable-content"},dS={key:5,class:"fct-webhook-notice"},uS={class:"fct-webhook-notice-title"},cS={class:"fct-webhook-notice-desc"},AS={key:0},pS={key:16,class:"fct-col"},fS={key:0},mS={key:0},hS={class:"setting-label"},_S={class:"flex flex-wrap gap-2"},vS=["href"],gS={key:1},yS={class:"setting-label"},bS={class:"flex flex-wrap gap-2"},wS=["href"],CS={key:17,class:"fct-col"},kS={key:18,class:"fct-col"},Qd={__name:"Renderer",props:{fields:Object,settings:Object,routeName:String,methodName:String,methodTitle:String,methodLabel:String,brandColor:{type:String,default:"#253241"}},emits:["onSettingsChange"],setup(e,{emit:t}){const a=aa().ctx,l=M({}),n=M(null),i=M(null),A=M(!1),p=M({}),m=Ke.get("shop.order_mode"),_=e,g=t,y=G(()=>{var F,$,U;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?($=_.settings)==null?void 0:$.define_test_keys:(U=_.settings)==null?void 0:U.define_live_keys});G(()=>{var F,$;return(F=_.fields)!=null&&F.payment_mode&&(($=_.settings)==null?void 0:$.payment_mode)!==m&&g("onSettingsChange",{..._.settings,payment_mode:m}),!0});const v=G(()=>{var F;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?"test":"live"}),k=()=>{A.value=!0,a.$get("settings/payment-methods/connect/info",{method:_.routeName}).then(F=>{F&&(A.value=!1,l.value=F.connect_config,g("onSettingsChange",F.settings),n.value=F.live_account,i.value=F.test_account,n.value.error&&(p.value=n.value),i.value.error&&(p.value=i.value),A.value=!1)}).catch(F=>{A.value=!1,p.value=F}).finally(()=>{A.value=!1})},b=F=>{const $=F.target;if($.classList.contains("fct-install-addon-btn")||$.closest(".fct-install-addon-btn")){F.preventDefault(),F.stopPropagation();const U=$.classList.contains("fct-install-addon-btn")?$:$.closest(".fct-install-addon-btn"),D=U.getAttribute("data-addon-slug"),T=U.getAttribute("data-addon-file"),I=U.getAttribute("data-source-type"),L=U.getAttribute("data-source-link"),O=U.getAttribute("data-repo-link");D&&T&&O&&B({slug:D,source_type:I||"github",source_link:L||"",repo_link:O||""});return}if($.classList.contains("fct-activate-addon-btn")||$.closest(".fct-activate-addon-btn")){F.preventDefault(),F.stopPropagation();const D=($.classList.contains("fct-activate-addon-btn")?$:$.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");D&&S({file:D})}},w=Ke.get("app_config.isProActive"),B=F=>{if(!w){window.open(F.repo_link,"_blank","noopener,noreferrer");return}const $=document.querySelector(`[data-addon-slug="${F.slug}"]`);$&&($.disabled=!0,$.innerHTML='<span class="el-icon-loading"></span> '+d("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:F.slug,source_type:F.source_type,source_link:F.source_link}).then(U=>{j.success({message:U.message||d("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(U=>{j.error({message:(U==null?void 0:U.message)||d("Failed to install addon")}),$&&($.disabled=!1,$.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 10H18L12 16L6 10H11V3H13V10M4 19H20V12H22V20C22 20.5304 21.7893 21.0391 21.4142 21.4142C21.0391 21.7893 20.5304 22 20 22H4C3.46957 22 2.96086 21.7893 2.58579 21.4142C2.21071 21.0391 2 20.5304 2 20V12H4V19Z"/></svg>'+d("Install Addon"))})},S=F=>{const $=document.querySelector(`[data-addon-file="${F.file}"]`);$&&($.disabled=!0,$.innerHTML='<span class="el-icon-loading"></span> '+d("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:F.file}).then(U=>{j.success({message:U.message||d("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(U=>{j.error({message:(U==null?void 0:U.message)||d("Failed to activate addon")}),$&&($.disabled=!1,$.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>'+d("Activate Addon"))})},V=F=>F?Array.isArray(F)?F:F[v.value]??[]:[];return Te(()=>{k(),document.addEventListener("click",b)}),xt(()=>{document.removeEventListener("click",b)}),(F,$)=>{const U=C("el-skeleton-item"),D=C("el-skeleton"),T=C("el-icon"),I=C("el-tooltip"),L=C("el-switch"),O=C("el-checkbox"),Q=C("el-option"),H=C("el-select"),K=C("el-radio"),W=C("el-radio-group"),z=C("el-input"),Y=C("el-input-number"),Z=C("el-checkbox-group"),re=C("el-tag");return r(),h("div",{class:ue([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(P,null,ae(e.fields,(q,Ae)=>{var ie,J,N,le,ee,pe;return r(),h("div",{class:"fct-setting-row fct-row",key:Ae},[q.type==="notice"?(r(),h("div",Gx,[o("p",{innerHTML:q.value},null,8,zx)])):x("",!0),q.type==="upcoming"?(r(),h("div",jx,[o("h1",qx,f(c(d)("Upcoming")),1)])):x("",!0),q.type==="provider"?(r(),h("div",Yx,[q.value=="connect"?(r(),h(P,{key:0},[e.settings.payment_mode=="test"?(r(),h(P,{key:0},[s(D,{loading:A.value,animated:""},{template:u(()=>[s(U,{variant:"h3",class:"w-[150px] mb-3"}),s(U,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),A.value?x("",!0):(r(),E(fc,{key:0,onReload_settings:$[0]||($[0]=de=>k()),method:e.routeName,methodName:e.methodName,methodLabel:e.methodLabel,connectConfig:l.value,mode:"test",connect:i.value,brandColor:e.brandColor},null,8,["method","methodName","methodLabel","connectConfig","connect","brandColor"]))],64)):e.settings.payment_mode=="live"?(r(),h(P,{key:1},[s(D,{loading:A.value,animated:""},{template:u(()=>[o("div",Wx,[s(U,{variant:"h3",class:"w-9 h-9 mb-7 mx-auto rounded"}),s(U,{variant:"h3",class:"w-[200px] mx-auto mb-3"}),s(U,{variant:"h3",class:"w-[120px] h-7.5 mx-auto"})])]),_:1},8,["loading"]),A.value?x("",!0):(r(),E(fc,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:$[1]||($[1]=de=>k()),connectConfig:l.value,mode:"live",methodLabel:e.methodLabel,connect:n.value,brandColor:e.brandColor},null,8,["method","methodName","connectConfig","methodLabel","connect","brandColor"]))],64)):x("",!0),o("p",Jx,f((ie=p.value)==null?void 0:ie.error),1)],64)):(r(),h("div",Xx,[y.value?(r(),h("div",Zx,[o("div",null,[s(J2,{title:c(d)("Your API setup is Up & Running 🎉")},{default:u(()=>[o("div",e3,[o("div",null,[o("b",null,f(c(d)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),h("div",t3,[o("div",null,[o("b",null,f(c(d)("Payment API settings is not enabled by API keys / Connect")),1),$[3]||($[3]=o("br",null,null,-1)),o("p",null,f(c(d)("You can Set Up API keys defined as constant, Or use connect.")),1),o("p",a3,f((J=p.value)==null?void 0:J.error),1)])]))]))])):x("",!0),q.type==="enable"?(r(),h("div",l3,[o("p",s3,[R(f(q.label)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:q.tooltip},null,8,n3)]),default:u(()=>[s(T,null,{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),s(L,{modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,"active-value":"yes","inactive-value":"no","active-text":c(d)("Active"),"inactive-text":c(d)("Inactive")},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text"]),q.description?(r(),h("p",o3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="checkbox"?(r(),h("div",i3,[s(O,{"true-value":"yes","false-value":"no",modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,disabled:q.disabled},{default:u(()=>[R(f(q.label)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:q.tooltip},null,8,r3)]),default:u(()=>[s(T,{class:"text-gray-500"},{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),q.description?(r(),h("p",d3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="select"?(r(),h("div",u3,[o("p",c3,[R(f(q.label)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:q.tooltip},null,8,A3)]),default:u(()=>[s(T,{class:"text-gray-500"},{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),s(H,{placeholder:q.placeholder,modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,filterable:q.filterable!==!1},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(de,Ue)=>(r(),E(Q,{label:de.label,value:de.value,key:Ue},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),q.description?(r(),h("p",p3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="radio"?(r(),h("div",f3,[o("p",m3,[R(f(q.label)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:q.tooltip},null,8,h3)]),default:u(()=>[s(T,{class:"text-gray-500"},{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),s(W,{modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,class:ue({"fct-payment-setting-radio-box":typeof Object.values(q.options)[0]=="object"})},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(de,Ue)=>(r(),h(P,{key:Ue},[typeof de=="object"?(r(),E(K,{key:0,value:Ue},{default:u(()=>[o("div",_3,[o("img",{src:de.icon,alt:""},null,8,v3)]),o("div",null,[o("span",g3,f(de.label),1),o("span",y3,f(de.text),1)])]),_:2},1032,["value"])):(r(),E(K,{key:1,value:Ue},{default:u(()=>[R(f(de),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),q.description?(r(),h("p",b3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="webhook_info"&&((N=e.settings)==null?void 0:N.payment_mode)===q.mode?(r(),h("div",w3,[e.routeName==="paypal"&&!y.value?(r(),h("div",C3,[s(Kx,{testConnect:i.value,liveConnect:n.value,webhook_info:q.info,onReload_settings:$[2]||($[2]=de=>k()),mode:q==null?void 0:q.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):q.info?(r(),h("div",{key:1,innerHTML:q.info},null,8,k3)):x("",!0)])):x("",!0),q.type==="input"||q.type==="password"?(r(),h("div",B3,[o("p",x3,f(q.label),1),s(z,{type:q.type,placeholder:q.placeholder,modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,maxlength:q.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),q.description?(r(),h("p",S3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="email"?(r(),h("div",$3,[o("p",F3,f(q.label),1),s(z,{type:"email",placeholder:q.placeholder,modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de},null,8,["placeholder","modelValue","onUpdate:modelValue"]),q.description?(r(),h("p",E3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="number"?(r(),h("div",U3,[o("p",I3,f(q.label),1),s(Y,{placeholder:q.placeholder,modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,max:q.max,min:q.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),q.description?(r(),h("p",V3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="text"?(r(),h("div",D3,[o("p",T3,[R(f(q.label)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:q.tooltip},null,8,Q3)]),default:u(()=>[s(T,{class:"text-gray-500"},{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),s(z,{type:"text",placeholder:q.placeholder,modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,disabled:q.disabled,maxlength:q.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),q.description?(r(),h("p",M3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="color"?(r(),h("div",L3,[o("p",R3,[R(f(q.label)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:q.tooltip},null,8,O3)]),default:u(()=>[s(T,{class:"text-gray-500"},{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),s(Id,{modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,field:q},null,8,["modelValue","onUpdate:modelValue","field"]),q.description?(r(),h("p",P3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="file"?(r(),h("div",H3,[o("p",N3,[R(f(q.label)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:q.tooltip},null,8,K3)]),default:u(()=>[s(T,{class:"text-gray-500"},{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),s(Ei,{modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de,icon:"Upload",title:c(d)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),q.description?(r(),h("p",G3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="checkbox_group"?(r(),h("div",z3,[o("p",j3,[R(f(q.title)+" ",1),q.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",null,f(q.tooltip),1)]),default:u(()=>[s(T,{class:"text-gray-500"},{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),s(Z,{modelValue:e.settings[Ae],"onUpdate:modelValue":de=>e.settings[Ae]=de},{default:u(()=>[(r(!0),h(P,null,ae(q.options,(de,Ue)=>(r(),E(O,{label:Ue,key:Ue},{default:u(()=>[R(f(de),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),q.description?(r(),h("p",q3,f(q.description),1)):x("",!0)])):x("",!0),q.type==="html_attr"?(r(),h("div",Y3,[typeof q.value=="string"?(r(),h("div",{key:0,innerHTML:q.value},null,8,W3)):typeof q.value=="object"&&q.value!==null?(r(),h("div",J3,[q.value.title?(r(),h("p",X3,f(q.value.title),1)):x("",!0),q.value.webhook_url?(r(),h("code",Z3,f(q.value.webhook_url),1)):x("",!0),q.value.description?(r(),h("p",eS,f(q.value.description),1)):x("",!0),q.value.steps?(r(),h(P,{key:3},[q.value.steps.title?(r(),h("p",tS,f(q.value.steps.title),1)):x("",!0),o("ul",aS,[(r(!0),h(P,null,ae(V(q.value.steps.list),(de,Ue)=>(r(),h("li",{key:Ue},[o("span",lS,f(Ue+1),1),o("span",{innerHTML:de},null,8,sS)]))),128))])],64)):x("",!0),q.value.events?(r(),h("div",nS,[o("p",oS,f(q.value.events.title),1),o("ul",iS,[(r(!0),h(P,null,ae(V(q.value.events.list),(de,Ue)=>(r(),h("li",{key:Ue},[o("code",rS,f(de),1)]))),128))])])):x("",!0),q.value.webhook_notice?(r(),h("div",dS,[o("h4",uS,f(q.value.webhook_notice.title),1),o("div",cS,f(q.value.webhook_notice.description),1),q.value.webhook_notice.list&&q.value.webhook_notice.list.length?(r(),h("ul",AS,[(r(!0),h(P,null,ae(q.value.webhook_notice.list,(de,Ue)=>(r(),h("li",{key:Ue},f(de),1))),128))])):x("",!0)])):x("",!0)])):x("",!0)])):x("",!0),q.type==="active_methods"?(r(),h("div",pS,[(le=q.value)!=null&&le.activated_methods?(r(),h("div",fS,[e.settings.payment_mode==="live"&&Ae==="live_active_methods"?(r(),h("div",mS,[o("p",hS,f(q.label),1),R(" "+f(F.active_methods)+" ",1),o("ul",_S,[(r(!0),h(P,null,ae(q.value.activated_methods,(de,Ue)=>(r(),E(re,{key:Ue},{default:u(()=>[R(f(de!=null&&de.name?de.name:de),1)]),_:2},1024))),128))]),o("p",null,[R(f(c(d)("You can configure methods "))+" ",1),o("a",{href:(ee=q.value)==null?void 0:ee.configure_url,target:"_blank"},f(c(d)("here")),9,vS)])])):x("",!0),e.settings.payment_mode==="test"&&Ae==="test_active_methods"?(r(),h("div",gS,[o("p",yS,f(q.label),1),o("ul",bS,[R(f(F.active_methods)+" ",1),(r(!0),h(P,null,ae(q.value.activated_methods,(de,Ue)=>(r(),E(re,{key:Ue},{default:u(()=>[R(f(de!=null&&de.name?de.name:de),1)]),_:2},1024))),128))]),o("p",null,[R(f(c(d)("You can configure methods "))+" ",1),o("a",{href:(pe=q.value)==null?void 0:pe.configure_url,target:"_blank"},f(c(d)("here")),9,wS)])])):x("",!0)])):x("",!0)])):x("",!0),q.type==="tabs"?(r(),h("div",CS,[s(Vx,{fields:e.fields,settings:e.settings,index:Ae,tabs:e.fields[Ae]},null,8,["fields","settings","index","tabs"])])):x("",!0),q.type==="radio-select-dependants"?(r(),h("div",kS,[s(Mx,{fields:e.fields,settings:e.settings,index:Ae},null,8,["fields","settings","index"])])):x("",!0)])}),128))],2)}}},BS={class:"setting-wrap"},xS={class:"setting-wrap-inner"},SS={class:"mb-5 flex items-center justify-between"},$S={class:"setting-switcher flex items-center gap-3"},FS={class:"setting-save-action"},ES={name:"GlobalPaymentComponents",data(){return{fields:{},settings:{},saving:!1,fetching:!1,is_key_defined:!1,labelPosition:"top",webhook_url:"",fetchRoute:"",pages:[],route_name:"",ipn_url:"Blank",verifiedMessage:!1,verifiedStatus:!1,verifying:!1,methodName:"",methodTitle:"",methodLabel:"",brandColor:"#253241",editDesignModal:!1,mediaSelection:[],checkout_label:"",checkout_logo:"",checkout_instructions:"",addonInfo:null,thank_you_page_instructions:""}},watch:{$route(e,t){this.getRoute(),this.getSettings(),this.getPageName()}},mounted(){this.getRoute(),this.getSettings(),window.outerWidth<500&&(this.labelPosition="top")},methods:{editDesign(){this.$router.push({name:"payment-design",params:{method:this.route_name}})},savePaymentDesign(){this.editDesignModal=!1,this.mediaSelection.length>0?this.checkout_logo=this.mediaSelection[0].url:this.checkout_logo="",this.$post("settings/payment-methods/design",{checkout_label:this.checkout_label,checkout_logo:this.checkout_logo,checkout_instructions:this.checkout_instructions,thank_you_page_instructions:this.thank_you_page_instructions,method:this.route_name}).then(e=>{this.saving=!1,un("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return pl.getUrl("images/payment-methods/"+t+"-icon.svg")},updateSettings(e){this.settings=e},getSettings(){this.fetching=!0,this.$get("settings/payment-methods/all").then(e=>{const t=e.gateways.find(a=>a.route===this.route_name);t&&(this.brandColor=t.brand_color||"#000000")}).catch(()=>{}),this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,n,i,A,p;this.fetching=!1,this.fields=e.fields,this.settings=e.settings,this.addonInfo=e.addon_info||null,this.registerCopyAction(),this.checkout_label=(t=this.settings)!=null&&t.checkout_label?(a=this.settings)==null?void 0:a.checkout_label:this.methodTitle,this.checkout_logo=(l=this.settings)==null?void 0:l.checkout_logo,this.checkout_instructions=((n=this.settings)==null?void 0:n.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(A=this.settings)!=null&&A.checkout_logo?{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}:""}).catch(e=>{var t;this.fetching=!1,yr(((t=e==null?void 0:e.data)==null?void 0:t.message)||"Failed to load settings")})},saveSettings(){this.saving=!0,this.$post("settings/payment-methods",{settings:this.settings,method:this.route_name}).then(e=>{this.saving=!1,un("Settings updated!")}).catch(e=>{var t;this.saving=!1,yr(((t=e==null?void 0:e.data)==null?void 0:t.message)||"Something went wrong!")})},verifyKeys(e,t){this.verifying=!0},getRoute(){var e,t,a,l,n,i,A,p,m;this.route_name=this.$route.name,this.methodName=(e=this.$route)==null?void 0:e.name,(a=(t=this.$route)==null?void 0:t.meta)!=null&&a.admin_title?this.methodTitle=(n=(l=this.$route)==null?void 0:l.meta)==null?void 0:n.admin_title:this.methodTitle=(A=(i=this.$route)==null?void 0:i.meta)==null?void 0:A.title,this.methodLabel=(m=(p=this.$route)==null?void 0:p.meta)==null?void 0:m.label,this.fetchRoute=`settings/payments/${this.$route.name}`},getPageName(){let e="";return this.$route.meta.title?e=this.$route.meta.title+" Settings":e=this.$route.name.charAt(0).toUpperCase()+this.$route.name.slice(1).toLowerCase()+" Settings",e}}},US=Object.assign(ES,{setup(e){const t=aa().ctx;return Ss().onSave(()=>{t.saveSettings()}),(l,n)=>{const i=C("el-breadcrumb-item"),A=C("el-breadcrumb"),p=C("el-switch"),m=C("Edit"),_=C("el-icon"),g=C("el-skeleton"),y=C("el-button");return r(),h("div",BS,[o("div",xS,[o("div",SS,[s(A,{class:"mb-0","separator-icon":c(Za)},{default:u(()=>[s(i,{to:{path:"/settings/payments"}},{default:u(()=>[R(f(l.$t("Payment Settings")),1)]),_:1}),s(i,null,{default:u(()=>[o("span",null,f(l.methodTitle),1)]),_:1})]),_:1},8,["separator-icon"]),o("div",$S,[s(p,{modelValue:l.settings.is_active,"onUpdate:modelValue":n[0]||(n[0]=v=>l.settings.is_active=v),"active-value":"yes","inactive-value":"no","inactive-text":l.$t("Payment Activation")},null,8,["modelValue","inactive-text"])])]),s(xe,null,{default:u(()=>[s(Ve,{title:l.methodTitle,border_bottom:""},{action:u(()=>[s(_,{class:"text-gray-500 cursor-pointer",onClick:l.editDesign},{default:u(()=>[s(m)]),_:1},8,["onClick"])]),_:1},8,["title"]),s(Be,{class:"pt-0"},{default:u(()=>[s(g,{loading:l.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),l.fetching?x("",!0):(r(),E(Qd,{key:0,onOnSettingsChange:l.updateSettings,routeName:l.route_name,methodName:l.methodName,methodTitle:l.methodTitle,methodLabel:l.methodLabel,brandColor:l.brandColor,fields:l.fields,settings:l.settings},null,8,["onOnSettingsChange","routeName","methodName","methodTitle","methodLabel","brandColor","fields","settings"]))]),_:1})]),_:1}),o("div",FS,[s(y,{onClick:n[1]||(n[1]=v=>l.saveSettings()),type:"primary",loading:l.saving},{default:u(()=>[R(f(l.$t("Save Settings")),1)]),_:1},8,["loading"])])])])}}}),IS={class:"setting-wrap"},VS={class:"setting-wrap-inner"},DS={class:"setting-save-action"},TS={name:"PaymentDesign",components:{SettingsHeader:$a},data(){return{settings:{},fetching:!1,saving:!1,mediaSelection:[],checkout_label:"",checkout_logo:"",checkout_instructions:"",thank_you_page_instructions:"",route_name:"",methodTitle:"",routeLabel:""}},mounted(){this.initRouteData(),this.getSettings()},methods:{goBack(){this.$router.push({path:`/settings/payments/${this.route_name}`})},savePaymentDesign(){var t;this.saving=!0;let e="";Array.isArray(this.mediaSelection)&&this.mediaSelection.length>0?e=((t=this.mediaSelection[0])==null?void 0:t.url)||"":this.mediaSelection&&typeof this.mediaSelection=="object"&&this.mediaSelection.url?e=this.mediaSelection.url:typeof this.mediaSelection=="string"&&(e=this.mediaSelection),this.checkout_logo=e||"",this.$post("settings/payment-methods/design",{checkout_label:this.checkout_label,checkout_logo:this.checkout_logo,checkout_instructions:this.checkout_instructions,thank_you_page_instructions:this.thank_you_page_instructions,method:this.route_name}).then(a=>{this.saving=!1,un("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,yr("Something went wrong!")})},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,n,i,A,p;this.fetching=!1,this.settings=e.settings,this.checkout_label=(t=this.settings)!=null&&t.checkout_label?(a=this.settings)==null?void 0:a.checkout_label:this.methodTitle,this.checkout_logo=(l=this.settings)==null?void 0:l.checkout_logo,this.checkout_instructions=((n=this.settings)==null?void 0:n.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(A=this.settings)!=null&&A.checkout_logo?[{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}]:""}).catch(()=>{this.fetching=!1})},initRouteData(){var a,l,n,i,A,p;this.route_name=this.$route.params.method||this.$route.name,(l=(a=this.$route)==null?void 0:a.meta)!=null&&l.admin_title?this.methodTitle=(i=(n=this.$route)==null?void 0:n.meta)==null?void 0:i.admin_title:this.methodTitle=((p=(A=this.$route)==null?void 0:A.meta)==null?void 0:p.title)||"",this.routeLabel=this.methodTitle||this.route_name;const e=this.$t("Gateway & checkout instructions"),t=this.methodTitle?`${this.methodTitle} - ${e}`:e;this.$route&&this.$route.meta&&(this.$route.meta.title=t)}}},QS=Object.assign(TS,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),n=C("el-breadcrumb"),i=C("el-icon"),A=C("el-button"),p=C("el-skeleton"),m=C("el-input"),_=C("el-form-item"),g=C("el-form");return r(),h("div",IS,[s($a,{onOnSave:t.savePaymentDesign,loading:t.saving,"save-button-text":t.$t("Update"),"loading-text":t.$t("Updating")},{heading:u(()=>[s(n,{class:"mb-0","separator-icon":c(Za)},{default:u(()=>[s(l,{to:{path:"/settings/payments"}},{default:u(()=>[R(f(t.$t("Payment Settings")),1)]),_:1}),s(l,null,{default:u(()=>[o("span",{class:"cursor-pointer",onClick:a[0]||(a[0]=(...y)=>t.goBack&&t.goBack(...y))},f(t.$route.params.method),1)]),_:1}),s(l,null,{default:u(()=>[o("span",null,f(t.$t("Checkout Customization")),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["onOnSave","loading","save-button-text","loading-text"]),o("div",VS,[s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Customization"),border_bottom:""},{action:u(()=>[s(A,{onClick:t.goBack,type:"text",class:"cursor-pointer border-none p-0"},{default:u(()=>[s(i,{class:"text-gray-500 cursor-pointer",onClick:t.goBack},{default:u(()=>[s(c(Cm))]),_:1},8,["onClick"]),R(" "+f(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),s(Be,null,{default:u(()=>[s(p,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?x("",!0):(r(),E(g,{key:0,"label-position":"left"},{default:u(()=>[s(_,{label:t.$t("Checkout Label")},{default:u(()=>[s(m,{type:"text",modelValue:t.checkout_label,"onUpdate:modelValue":a[1]||(a[1]=y=>t.checkout_label=y)},null,8,["modelValue"])]),_:1},8,["label"]),s(_,{label:t.$t("Checkout Logo")},{default:u(()=>[s(Ei,{modelValue:t.mediaSelection,"onUpdate:modelValue":a[2]||(a[2]=y=>t.mediaSelection=y),icon:"Upload",title:t.$t("Upload Logo")},null,8,["modelValue","title"])]),_:1},8,["label"]),s(_,{"label-position":"top"},{default:u(()=>[s(Ot,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),s(os,{modelValue:t.checkout_instructions,"onUpdate:modelValue":a[3]||(a[3]=y=>t.checkout_instructions=y),onUpdate:a[4]||(a[4]=y=>{t.checkout_instructions=y})},null,8,["modelValue"])]),_:1}),a[7]||(a[7]=o("div",{class:"h-10"},null,-1)),s(_,{"label-position":"top"},{default:u(()=>[s(Ot,{title:t.$t("Thank you page Instruction"),content:t.$t("Thank you page Instruction will be displayed on the thank you page receipt section.")},null,8,["title","content"]),s(os,{modelValue:t.thank_you_page_instructions,"onUpdate:modelValue":a[5]||(a[5]=y=>t.thank_you_page_instructions=y),onUpdate:a[6]||(a[6]=y=>{t.thank_you_page_instructions=y})},null,8,["modelValue"])]),_:1})]),_:1,__:[7]}))]),_:1})]),_:1}),o("div",DS,[s(A,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:u(()=>[R(f(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),MS={class:"fct-integration-setting-content"},LS={class:"fct-integration-setting-head"},RS={class:"flex items-center gap-3 mb-2"},OS=["src"],PS={class:"title"},HS=["innerHTML"],NS={key:0,class:"integration_success_state"},KS=["innerHTML"],GS={key:1,class:"fct-integration-setting-body"},zS={class:"fct-integration-setting-body-inner"},jS=["innerHTML"],qS=["innerHTML"],YS=["target","href"],WS={key:0},JS={key:0,class:"fct-integration-setting-body-footer"},XS={key:2},ZS={name:"GeneralIntegration",components:{InfoFilled:dl,Setting:rA},props:["settings_key"],data(){return{integration:{},loading:!1,saving:!1,settings:{},error_message:""}},watch:{settings_key(){this.integration={},this.settings={},this.getIntegrationSettings()}},mounted(){this.getIntegrationSettings()},methods:{save(){this.saving=!0,this.$post("integration/global-settings",{settings_key:this.settings_key,integration:this.integration}).then(e=>{if(this.saving=!1,this.handleSuccess(e.data.message),e.data.redirect_url){window.location.href=e.data.redirect_url;return}this.integration.status=e.data.status}).catch(e=>{this.integration.status=!1,e&&e.data.message?this.handleError(e.data.message):e&&e.responseJSON.data.message&&this.handleerror(e.responseJSON.data.message)})},getIntegrationSettings(){this.loading=!0,this.$get("integration/global-settings",{settings_key:this.settings_key}).then(e=>{this.loading=!1,this.integration=e.data.integration,this.settings=e.data.settings}).catch(e=>{this.error_message=e.responseJSON.data.message})},disconnect(e){this.integration=e,this.save()},authenticate(e,t){this.loading=!0,this.$post("integration/global-settings"+e,{settings_key:this.settings_key,integration:this.integration}).then(a=>{this.loading=!1,a.data.url?window.open(a.data.url,"_blank"):this.handleSuccess(a.data.message)}).catch(a=>{this.handleError(a.responseJSON.data.message)})}}},e$=Object.assign(ZS,{setup(e){const t=aa().ctx;return Ss().onSave(()=>{t.integration.status||t.save()}),(l,n)=>{const i=C("el-button"),A=C("el-icon"),p=C("el-tooltip"),m=C("el-option"),_=C("el-select"),g=C("el-input"),y=C("el-form-item"),v=C("el-form"),k=Qa("loading");return r(),h("div",MS,[o("div",LS,[o("div",RS,[l.settings.logo?(r(),h("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,OS)):x("",!0),o("h3",PS,f(l.settings.menu_title),1)]),o("p",{class:"desc",innerHTML:l.settings.menu_description},null,8,HS)]),l.settings.hide_on_valid&&l.integration.status?(r(),h("div",NS,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,KS),o("div",null,[s(i,{onClick:n[0]||(n[0]=b=>l.disconnect(l.settings.discard_settings.data)),type:"danger",plain:""},{default:u(()=>[R(f(l.settings.discard_settings.disconnect_button_text),1)]),_:1}),l.settings.discard_settings.show_verify?(r(),E(i,{key:0,onClick:n[1]||(n[1]=b=>l.save()),type:"primary"},{default:u(()=>[R(f(l.settings.discard_settings.verify_button_text),1)]),_:1})):x("",!0)])])):Jt((r(),h("div",GS,[o("div",zS,[l.settings.config_instruction&&!l.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,jS)):x("",!0),s(v,{"label-width":"205px","label-position":"top"},{default:u(()=>[(r(!0),h(P,null,ae(l.settings.fields,(b,w)=>(r(),E(y,{key:w},{label:u(()=>[R(f(b.label)+" ",1),b.label_tips?(r(),E(p,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:u(()=>[o("div",{innerHTML:b.label_tips},null,8,qS)]),default:u(()=>[s(A,null,{default:u(()=>[s(c(dl))]),_:1})]),_:2},1024)):x("",!0)]),default:u(()=>[b.type=="authenticate-button"?(r(),E(i,{key:0,onClick:B=>l.authenticate(b.end_point,b.params)},{default:u(()=>[R(f(b.button_text),1)]),_:2},1032,["onClick"])):b.type=="select"?(r(),E(_,{key:1,modelValue:l.integration[w],"onUpdate:modelValue":B=>l.integration[w]=B},{default:u(()=>[(r(!0),h(P,null,ae(b.options,(B,S)=>(r(),E(m,{key:S,label:B,value:S},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):b.type=="link"?(r(),h(P,{key:2},[o("a",{target:b.target,class:ue(b.btn_class),href:b.link},f(b.link_text),11,YS),o("p",null,f(b.tips),1)],64)):(r(),h(P,{key:3},[s(g,{placeholder:b.placeholder,type:b.type,modelValue:l.integration[w],"onUpdate:modelValue":B=>l.integration[w]=B},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),b.tips?(r(),h("p",WS,f(b.tips),1)):x("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?x("",!0):(r(),h("div",JS,[s(i,{type:"primary",onClick:l.save},{default:u(()=>[R(f(l.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[k,l.loading]]),l.error_message?(r(),h("p",XS,f(l.error_message),1)):x("",!0)])}}}),t$={class:"fct-integration-setting-container fct-layout-width"},a$={class:"single-page-header"},l$={class:"single-page-body"},s$={class:"fct-integration-setting-wrap"},n$={name:"IntegrationEditor"},o$=Object.assign(n$,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),n=C("el-breadcrumb");return r(),h("div",t$,[o("div",a$,[s(n,{"separator-icon":c(Za)},{default:u(()=>[s(l,{to:{name:"integrations"}},{default:u(()=>[R(f(t.$t("Integrations")),1)]),_:1}),s(l,null,{default:u(()=>[R(f(c(Aa).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),o("div",l$,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[o("div",s$,[s(e$,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),i$={class:"fct-form-group"},r$={for:"store-country"},d$={class:"fct-form-group"},u$={class:"fct-form-group"},c$={class:"fct-form-group"},A$={__name:"OnboardingStoreInfoStep",props:{savedFormData:{type:Object,default:null},initialSettings:{type:Object,default:null},countries:{type:Array,default:()=>[]},currencies:{type:Object,default:()=>({})}},emits:["storeCountryChanged"],setup(e,{expose:t,emit:a}){const l=e,n=a,i=M({store_name:"",store_logo:"",store_country:"",currency:""});be(()=>l.savedFormData??l.initialSettings,m=>{m&&(i.value.store_name=m.store_name??"",i.value.store_logo=m.store_logo??"",i.value.store_country=m.store_country??"",i.value.currency=m.currency??"")},{immediate:!0});const A=m=>{n("storeCountryChanged",m),m&&ce.post("settings/store",{store_country:m,store_name:i.value.store_name,settings_name:"store_setup"}).catch(()=>{})};return t({onNextStep:async()=>{const m=Array.isArray(i.value.store_logo)&&i.value.store_logo.length>0?i.value.store_logo[0]:i.value.store_logo;try{await ce.post("onboarding/",{store_name:i.value.store_name,store_logo:m,store_country:i.value.store_country,currency:i.value.currency})}catch{j.warning(d("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...i.value})}),(m,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-input");return r(),h(P,null,[o("div",i$,[o("label",r$,f(c(d)("Store Country")),1),s(y,{modelValue:i.value.store_country,"onUpdate:modelValue":_[0]||(_[0]=k=>i.value.store_country=k),placeholder:c(d)("Store Country"),onChange:A,filterable:""},{default:u(()=>[(r(!0),h(P,null,ae(e.countries,(k,b)=>(r(),E(g,{key:b,label:k.name,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",d$,[o("label",null,f(c(d)("Shop Name")),1),s(v,{modelValue:i.value.store_name,"onUpdate:modelValue":_[1]||(_[1]=k=>i.value.store_name=k)},null,8,["modelValue"])]),o("div",u$,[o("label",null,f(c(d)("Store Currency")),1),s(y,{modelValue:i.value.currency,"onUpdate:modelValue":_[2]||(_[2]=k=>i.value.currency=k),filterable:"",placeholder:c(d)("Select")},{default:u(()=>[(r(!0),h(P,null,ae(e.currencies,(k,b)=>(r(),E(g,{key:b,label:k.label,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",c$,[o("label",null,f(c(d)("Shop Image/Logo")),1),s(Ei,{modelValue:i.value.store_logo,"onUpdate:modelValue":_[3]||(_[3]=k=>i.value.store_logo=k),showSupported:"",icon:"Upload",title:c(d)("Upload")},null,8,["modelValue","title"])])],64)}}},Md=["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],p$=[...Md,"GB","AU","NZ","CA","IN"],f$=[...Md,"GB","AU","NZ"],m$={class:"fct-tax-step"},h$={class:"fct-tax-step-toggle-row"},_$={class:"fct-tax-step-toggle-row__label"},v$={class:"fct-alert-content"},g$={class:"fct-alert-text"},y$={class:"fct-form-group"},b$={key:0,class:"fct-tax-step-country-chip"},w$={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},C$={class:"fct-form-group"},k$={class:"fct-tax-step-radio-group",role:"radiogroup"},B$=["aria-checked"],x$={class:"fct-tax-step-radio-card__label"},S$={class:"fct-tax-step-radio-card__desc"},$$=["aria-checked"],F$={class:"fct-tax-step-radio-card__label"},E$={class:"fct-tax-step-radio-card__desc"},U$={key:0,class:"fct-form-group"},I$={class:"fct-tax-step-radio-group",role:"radiogroup"},V$=["aria-checked"],D$={class:"fct-tax-step-radio-card__label"},T$={class:"fct-tax-step-radio-card__desc"},Q$=["aria-checked"],M$={class:"fct-tax-step-radio-card__label"},L$={class:"fct-tax-step-radio-card__desc"},R$=["aria-checked"],O$={class:"fct-tax-step-radio-card__label"},P$={class:"fct-tax-step-radio-card__desc"},H$={class:"fct-form-group"},N$={class:"fct-tax-step-optional"},K$={class:"fct-form-help-text"},G$={class:"fct-alert-content"},z$={class:"fct-alert-text"},j$={__name:"OnboardingTaxStep",props:{savedFormData:{type:Object,default:null},storeCountry:{type:String,default:""},countryName:{type:String,default:""},initialTaxSettings:{type:Object,default:null}},setup(e,{expose:t}){const a=e,l=M({collectTaxes:!1,taxInclusion:"excluded",euMethod:"oss",vatNumber:""}),n=G(()=>Md.includes(a.storeCountry)),i=y=>{l.value={...l.value,...y}},A=G(()=>{if(!n.value)return d("Tax ID / VAT Number");if(l.value.euMethod==="oss")return d("OSS VAT Number");if(l.value.euMethod==="specific"){const y=a.countryName||a.storeCountry;return d("%1$s VAT Number",y)}return d("Home VAT Number")}),p=G(()=>n.value?d("Standard EU VAT rates will be imported automatically for all EU countries."):a.countryName?d("A standard tax class will be created for %1$s. Add your rates in Tax → Tax Rates after setup.",a.countryName):d("A standard tax class will be created. Add your rates in Tax → Tax Rates after setup.")),m=y=>{l.value={collectTaxes:p$.includes(y),taxInclusion:f$.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};be(()=>a.storeCountry,m),Te(()=>{if(a.savedFormData){l.value={...a.savedFormData};return}const y=a.initialTaxSettings;y&&y.enable_tax==="yes"?l.value={collectTaxes:!0,taxInclusion:y.tax_inclusion||"excluded",euMethod:y.eu_method||"oss",vatNumber:y.vat_number||""}:m(a.storeCountry)});const _=async()=>{try{await ce.post("onboarding/save-tax",{enable_tax:l.value.collectTaxes?"yes":"no",store_country:a.storeCountry,tax_inclusion:l.value.taxInclusion,eu_method:l.value.euMethod,vat_number:l.value.vatNumber})}catch{j.warning(d("Tax settings could not be saved. You can configure them in Tax → Settings."))}return!0},g=(y,v)=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i(v))};return t({onNextStep:_,getFormData:()=>({...l.value})}),(y,v)=>{const k=C("el-switch"),b=C("el-input");return r(),h("div",m$,[o("div",h$,[o("span",_$,f(c(d)("Collect taxes for my store")),1),s(k,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=w=>i({collectTaxes:w}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),h(P,{key:1},[o("div",y$,[o("label",null,f(c(d)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),h("span",b$,[s(X,{name:"Globe"}),R(" "+f(e.countryName||e.storeCountry),1)])):(r(),h("span",w$,f(c(d)("Not set")),1))])]),e.storeCountry?(r(),h(P,{key:0},[o("div",C$,[o("label",null,f(c(d)("How do you display your prices?")),1),o("div",k$,[o("div",{class:ue(["fct-tax-step-radio-card",{"is-selected":l.value.taxInclusion==="included"}]),role:"radio",tabindex:"0","aria-checked":l.value.taxInclusion==="included",onClick:v[1]||(v[1]=w=>i({taxInclusion:"included"})),onKeydown:v[2]||(v[2]=w=>g(w,{taxInclusion:"included"}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="included"}])},null,2),o("div",null,[o("div",x$,f(c(d)("Prices include tax")),1),o("div",S$,f(c(d)("Tax is already factored into your listed price.")),1)])],42,B$),o("div",{class:ue(["fct-tax-step-radio-card",{"is-selected":l.value.taxInclusion==="excluded"}]),role:"radio",tabindex:"0","aria-checked":l.value.taxInclusion==="excluded",onClick:v[3]||(v[3]=w=>i({taxInclusion:"excluded"})),onKeydown:v[4]||(v[4]=w=>g(w,{taxInclusion:"excluded"}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="excluded"}])},null,2),o("div",null,[o("div",F$,f(c(d)("Add tax at checkout")),1),o("div",E$,f(c(d)("Tax is shown separately and added to the subtotal.")),1)])],42,$$)])]),n.value?(r(),h("div",U$,[o("label",null,f(c(d)("Cross-border compliance")),1),o("div",I$,[o("div",{class:ue(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="oss"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="oss",onClick:v[5]||(v[5]=w=>i({euMethod:"oss",vatNumber:""})),onKeydown:v[6]||(v[6]=w=>g(w,{euMethod:"oss",vatNumber:""}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="oss"}])},null,2),o("div",null,[o("div",D$,f(c(d)("OSS (One Stop Shop)")),1),o("div",T$,f(c(d)("Charge each EU customer their country's VAT rate.")),1)])],42,V$),o("div",{class:ue(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="home"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="home",onClick:v[7]||(v[7]=w=>i({euMethod:"home",vatNumber:""})),onKeydown:v[8]||(v[8]=w=>g(w,{euMethod:"home",vatNumber:""}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="home"}])},null,2),o("div",null,[o("div",M$,f(c(d)("Home Country Only")),1),o("div",L$,f(c(d)("Charge all EU customers your home country's rate.")),1)])],42,Q$),o("div",{class:ue(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="specific"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="specific",onClick:v[9]||(v[9]=w=>i({euMethod:"specific",vatNumber:""})),onKeydown:v[10]||(v[10]=w=>g(w,{euMethod:"specific",vatNumber:""}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="specific"}])},null,2),o("div",null,[o("div",O$,f(c(d)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",P$,f(c(d)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,R$)])])):x("",!0),o("div",H$,[o("label",null,[R(f(A.value)+" ",1),o("span",N$,f(c(d)("(optional)")),1)]),s(b,{"model-value":l.value.vatNumber,"onUpdate:modelValue":v[11]||(v[11]=w=>i({vatNumber:w})),placeholder:n.value?"DE123456789":""},null,8,["model-value","placeholder"]),o("p",K$,f(c(d)("Your registration number, printed on invoices")),1)]),s(ol,{icon:"Info"},{content:u(()=>[o("div",G$,[o("p",z$,f(p.value),1)])]),_:1})],64)):x("",!0)],64)):(r(),E(ol,{key:0},{content:u(()=>[o("div",v$,[o("p",g$,f(c(d)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},q$={class:"dialog-footer"},Y$={__name:"CreatePageButton",props:{title:{default:d("Create Page")},content:{required:!0,type:String}},emits:["onPageCreated"],setup(e,{emit:t}){const a=e,l=t,n=M(!1),i=M(a.title),A=()=>{ce.post("onboarding/create-page",{page_name:i.value,content:a.content}).then(p=>{l("onPageCreated",{value:p.page_id,label:`${i.value}( ${p.page_id})`,page_link:p.link}),i.value="",n.value=!1,j.success(d("The page created successfully."))}).catch(p=>{if(p&&p.hasOwnProperty("page_name")){const m=Object.entries(p.page_name).length;let _="",g=0;for(const y in p.page_name)_+=p.page_name[y],g!==m&&(_+=` |
| 151 |
`),g++;j.error(_)}else j.error(d("Sorry, Unable To Create Page!!"))})};return(p,m)=>{const _=C("el-input"),g=C("el-form-item"),y=C("el-form"),v=C("el-button"),k=C("el-dialog");return r(),h(P,null,[s(tt,{onClick:m[0]||(m[0]=Ge(b=>n.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:u(()=>[s(X,{name:"Plus"})]),_:1}),s(k,{modelValue:n.value,"onUpdate:modelValue":m[3]||(m[3]=b=>n.value=b),title:c(d)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:u(()=>[o("div",q$,[s(v,{onClick:m[2]||(m[2]=b=>n.value=!1),type:"info",soft:""},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(v,{type:"primary",onClick:A},{default:u(()=>[R(f(c(d)("Create Page")),1)]),_:1})])]),default:u(()=>[s(y,{"require-asterisk-position":"right","label-position":"top",onSubmit:Ge(A,["prevent"])},{default:u(()=>[s(g,{label:c(d)("Page Name"),required:""},{default:u(()=>[s(_,{modelValue:i.value,"onUpdate:modelValue":m[1]||(m[1]=b=>i.value=b),placeholder:c(d)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},W$={class:"fct-form-group"},J$={class:"fct-form-group-inner"},X$={class:"input-prepend"},Z$={class:"input-append"},eF={__name:"PageSelector",props:Cl({title:{type:String,required:!0},pages:{type:Array,required:!0},modelId:{type:String,required:!0}},{modelValue:{},modelModifiers:{}}),emits:Cl(["onPageCreated"],["update:modelValue"]),setup(e,{emit:t}){const a=Tl(e,"modelValue",{get:A=>A?typeof A=="string"?Number(A):A:""}),l=t,n=M(!1),i=A=>{n.value=A};return(A,p)=>{const m=C("el-option"),_=C("el-select");return r(),h("div",W$,[o("label",null,f(e.title),1),o("div",J$,[o("div",{class:ue(["fct-input-group w-full",{focused:n.value}])},[o("div",X$,[s(_,{filterable:"",modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g),onFocus:p[1]||(p[1]=g=>i(!0)),onBlur:p[2]||(p[2]=g=>i(!1)),placeholder:c(d)("Select"),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(e.pages,(g,y)=>(r(),E(m,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",Z$,[s(Y$,{title:e.title,onOnPageCreated:p[3]||(p[3]=g=>l("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},tF={__name:"OnboardingPagesStep",props:{pages:{type:Array,default:()=>[]},initialSettings:{type:Object,default:null},savedFormData:{type:Object,default:null},onPagesUpdated:{type:Function,default:()=>{}}},setup(e,{expose:t}){const a=e,l=["checkout_page_id","cart_page_id","receipt_page_id","shop_page_id","customer_profile_page_id"],n={checkout_page_id:()=>d("Checkout"),cart_page_id:()=>d("Cart"),receipt_page_id:()=>d("Receipt"),shop_page_id:()=>d("Shop"),customer_profile_page_id:()=>d("Customer Profile")},i=M(Object.fromEntries(l.map(v=>[v,""])));be(()=>a.initialSettings,v=>{if(a.savedFormData){l.forEach(k=>{i.value[k]=a.savedFormData[k]??""});return}v&&l.forEach(k=>{i.value[k]=v[k]??""})},{immediate:!0});const A=M(!1),p=M(!1),m=()=>{p.value=!0,ce.post("onboarding/create-pages",{}).then(v=>{l.forEach(k=>{var b;i.value[k]=String(((b=v.default_settings)==null?void 0:b[k])??"")}),A.value=!0,a.onPagesUpdated(v.pages)}).finally(()=>{p.value=!1})},_=(v,k)=>{i.value[k]=v.value,a.onPagesUpdated([...a.pages,v])};return t({onNextStep:async()=>{try{await ce.post("onboarding/",{...i.value})}catch{}return!0},getFormData:()=>({...i.value}),createAllPage:m,pageGenerated:A,generating:p}),(v,k)=>(r(),h(P,null,ae(l,b=>o("div",{key:b,class:"fct-form-group"},[s(eF,{title:n[b](),pages:e.pages,modelId:b,modelValue:i.value[b],"onUpdate:modelValue":w=>i.value[b]=w,onOnPageCreated:_},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))}},aF={key:0,class:"fct-dummy-product-content"},lF={key:0,class:"title"},sF={class:"fct-dummy-product-hint"},nF={class:"fct-btn-group mt-4"},oF={key:1,class:"fct-dummy-product-content"},iF={key:0,class:"title"},rF={class:"text"},dF={class:"fct-dummy-product-loading"},uF={class:"fct-loading-bars"},cF=["id"],AF={class:"fct-dummy-product-hint"},pF=["href"],fF={key:2,class:"fct-form-group"},mF={class:"label"},hF={class:"marker"},_F={class:"label"},vF={class:"marker"},gF={__name:"OnboardingProductsStep",props:{dummyProductInfo:{type:Object,default:()=>({})}},setup(e,{expose:t}){const a=e,l=M("start-from-scratch"),n=M(!1),i=M(!1),A=M(null),p=M(0),m=M(0),_=M([]),g=M(!1),y=G(()=>g.value||_.value.length>0),v=()=>{m.value=0,p.value=0,n.value=!1,i.value=!1,A.value=null,_.value=[],g.value=!1},k=async F=>{let $=0;for(let U=0;U<F.count;U++){p.value=U;try{await ce.post("products/create-dummy",{category:F.category,index:U}),$++,m.value=parseFloat(($/F.count*100).toFixed(0))}catch(D){if(D.status_code===400){g.value=!0;for(let T=U;T<F.count;T++)_.value.push(T);return}_.value.push(U)}}},b=async()=>{if(!l.value||l.value==="start-from-scratch"){v();return}const F=a.dummyProductInfo[l.value];if(!F){v();return}_.value=[],g.value=!1,n.value=!0,i.value=!0,A.value=F;try{await k(F)}finally{i.value=!1}},w=()=>{y.value||(m.value=100,setTimeout(B,1e3))},B=()=>{let F=Ke.get("dashboard_url");l.value&&l.value!=="start-from-scratch"&&(F=Rs.appendToVueUrl(F,{import_product:l.value})),window.location.href=F},S=async()=>{const F=!l.value||l.value==="start-from-scratch";try{await ce.post("onboarding/")}catch{}return F?(setTimeout(B,300),!1):(await b(),w(),!1)},V=Ke.get("dashboard_url");return t({onNextStep:S,inserting:n}),(F,$)=>{const U=C("el-button"),D=C("el-progress"),T=C("el-icon"),I=C("el-radio-button"),L=C("el-radio-group");return n.value&&y.value&&!i.value?(r(),h("div",aF,[A.value!=null?(r(),h("div",lF,f(c(d)("%1$s of %2$s products could not be created",_.value.length,A.value.count)),1)):x("",!0),o("p",sF,f(g.value?c(d)("The import stopped early. Products created before it stopped were kept, and you can add the rest from the Products page."):c(d)("The products that were created have been kept. You can add the rest from the Products page.")),1),o("div",nF,[s(U,{type:"primary",onClick:B},{default:u(()=>[R(f(c(d)("Continue to Dashboard")),1)]),_:1})])])):n.value?(r(),h("div",oF,[A.value!=null?(r(),h("div",iF,f(c(d)("Inserting %1$s of %2$s %3$s Product",p.value+1,A.value.count,A.value.title)),1)):x("",!0),o("div",rF,[R(f(c(d)("Please wait, your products are being added."))+" ",1),o("div",dF,[o("div",uF,[(r(),h(P,null,ae(8,O=>o("div",{key:O,class:"bar-block",id:`bar-block-${O+1}`},null,8,cF)),64))]),R(" "+f(c(d)("Uploading... %1$s",`${m.value}%`)),1)])]),s(D,{percentage:m.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"]),o("p",AF,[R(f(c(d)("Please keep this window open, we'll take you to your"))+" ",1),o("a",{href:c(V),target:"_blank",rel:"noopener"},f(c(d)("Dashboard")),9,pF),R(" "+f(c(d)("as soon as your products are ready.")),1)])])):(r(),h("div",fF,[s(L,{class:"fct-import-onboarding-products",modelValue:l.value,"onUpdate:modelValue":$[0]||($[0]=O=>l.value=O),size:"large"},{default:u(()=>[s(I,{value:"start-from-scratch"},{default:u(()=>[s(X,{name:"Scratch"}),o("span",mF,[R(f(c(d)("Start"))+" ",1),$[1]||($[1]=o("br",null,null,-1)),R(" "+f(c(d)("From scratch")),1)]),o("span",hF,[s(T,null,{default:u(()=>[s(c(Mo))]),_:1})])]),_:1}),(r(!0),h(P,null,ae(e.dummyProductInfo,(O,Q)=>(r(),E(I,{key:Q,value:Q},{default:u(()=>[s(X,{name:O.icon},null,8,["name"]),o("span",_F,f(O.title),1),o("span",vF,[s(T,null,{default:u(()=>[s(c(Mo))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]))}}},yF={class:"fct-onboarding-wrap"},bF={key:0,class:"fct-onboarding-card"},wF={class:"fct-onboarding-card-body"},CF={class:"fct-onboarding-content-box"},kF={class:"fct-onboarding-card-head"},BF={class:"fct-onboarding-card-head-top"},xF=["src","alt"],SF={class:"fct-onboarding-steps-count"},$F={class:"fct-onboarding-card-head-content"},FF={class:"flex-1"},EF={class:"fct-onboarding-card-title"},UF={class:"fct-onboarding-card-text"},IF={key:0,class:"fct-onboarding-card-head-action"},VF={class:"fct-onboarding-content-box-inner"},DF={key:0,class:"fct-onboarding-load-error"},TF={key:1,class:"fct-onboarding-form-wrap active"},QF={class:"fct-onboarding-form-body"},MF={key:0,class:"fct-onboarding-bottom"},LF={class:"fct-onboarding-bottom-left"},RF={class:"fct-onboarding-bottom-right"},OF={key:0,class:"cmd"},PF={__name:"Onboarding",setup(e){const t=M(!1),a=M([]),l=M({}),n=M([]),i=M([]),A=M(null),p=M(null),m=M(null),_=M(null),g=M(null),y=M(""),v=G(()=>{if(!y.value)return"";const Ae=n.value.find(ie=>ie.value===y.value);return Ae?Ae.name:y.value}),k=[{key:"store-info",title:()=>d("Welcome aboard! Let's create your online store."),text:()=>d("You've successfully installed the plugin, let's configure the store."),component:A$,props:()=>({savedFormData:m.value,initialSettings:A.value,countries:n.value,currencies:l.value,onStoreCountryChanged:Ae=>{y.value=Ae}})},{key:"tax",title:()=>d("Set Up Tax Collection"),text:()=>d("Configure tax rates so checkout calculates correctly."),component:j$,canSkip:!0,props:()=>({savedFormData:_.value,storeCountry:y.value,countryName:v.value,initialTaxSettings:p.value})},{key:"pages",title:()=>d("Setup Your Pages"),text:()=>d("Create the essential pages your store needs: cart, checkout, and more."),component:tF,props:()=>({pages:a.value,initialSettings:A.value,savedFormData:g.value,onPagesUpdated:Ae=>{a.value=Ae}})},{key:"products",title:()=>d("Setup Your Products"),text:()=>d("Add your first products and start building your business catalog."),component:gF,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],b=k.length+1,w=M(1),B=G(()=>k[w.value-1]),S=G(()=>{var Ae;return((Ae=B.value)==null?void 0:Ae.title())??""}),V=G(()=>{var Ae;return((Ae=B.value)==null?void 0:Ae.text())??""}),F=M(null),$=M(!1),U=()=>{w.value++},D=G(()=>{var Ae;return!!((Ae=F.value)!=null&&Ae.inserting)}),T=()=>{var ie,J;const Ae=(J=(ie=F.value)==null?void 0:ie.getFormData)==null?void 0:J.call(ie);Ae&&(B.value.key==="store-info"?m.value=Ae:B.value.key==="tax"?_.value=Ae:B.value.key==="pages"&&(g.value=Ae))},I=async()=>{var Ae,ie;if(!$.value){$.value=!0;try{T(),await((ie=(Ae=F.value)==null?void 0:Ae.onNextStep)==null?void 0:ie.call(Ae))!==!1&&U()}finally{$.value=!1}}},L=()=>{var Ae,ie;T(),(ie=(Ae=F.value)==null?void 0:Ae.onPreviousStep)==null||ie.call(Ae),w.value>1&&w.value--},O=()=>{U()},Q=()=>{var Ae,ie;(ie=(Ae=F.value)==null?void 0:Ae.onSkipAll)==null||ie.call(Ae),window.location.href=Ke.get("dashboard_url")};Ss().onSave(()=>{var Ae;(Ae=B.value)!=null&&Ae.isFinal&&I()});const K=M(!1),W=()=>{t.value=!0,K.value=!1,ce.get("onboarding/").then(Ae=>{var ie;a.value=Ae.pages,l.value=Ae.currencies,A.value=Ae.default_settings,y.value=((ie=Ae.default_settings)==null?void 0:ie.store_country)??"",p.value=Ae.tax_settings??null}).catch(()=>{K.value=!0}).finally(()=>{t.value=!1})},z=()=>{ce.get("address-info/countries").then(Ae=>{n.value=Ae.data})},Y=pl.getUrl("images/logo/logo-full-dark.svg"),Z=pl.getUrl("images/logo/logo-full.svg"),re=M(Ke.get("asset_url")+"/images/logo/logo-full-dark.svg"),q=()=>{re.value=Re.isDark()?Z:Y};return Te(()=>{window.addEventListener("onFluentCartThemeChange",q),i.value=Ke.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),re.value=Re.isDark()?Z:Y,W(),z()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",q),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(Ae,ie)=>{const J=C("el-progress"),N=C("el-button"),le=Qa("loading");return r(),h(P,null,[o("div",yF,[w.value<b?(r(),h("div",bF,[Jt((r(),h("div",wF,[o("div",CF,[o("div",kF,[o("div",BF,[o("img",{src:re.value,alt:c(d)("Fluent Cart")},null,8,xF),o("div",SF,f(c(d)("Step %1$s of %2$s",w.value,k.length)),1),s(J,{percentage:w.value/k.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("div",$F,[o("div",FF,[o("h2",EF,f(S.value),1),o("p",UF,f(V.value),1)]),B.value.key==="pages"&&F.value&&!F.value.pageGenerated?(r(),h("div",IF,[s(N,{onClick:ie[0]||(ie[0]=ee=>F.value.createAllPage()),loading:F.value.generating,size:"small"},{default:u(()=>[F.value.generating?x("",!0):(r(),E(X,{key:0,name:"MagicPen"})),R(" "+f(c(d)("Generate All Pages")),1)]),_:1},8,["loading"])])):x("",!0)])]),o("div",VF,[K.value?(r(),h("div",DF,[o("p",null,f(c(d)("Failed to load settings. Please refresh and try again.")),1),s(N,{onClick:W},{default:u(()=>[R(f(c(d)("Retry")),1)]),_:1})])):(r(),h("div",TF,[o("div",QF,[(r(),E(bl(B.value.component),ba({key:B.value.key,ref_key:"stepRef",ref:F},B.value.props()),null,16))])]))])])])),[[le,t.value]])])):x("",!0)]),w.value<b&&!D.value?(r(),h("div",MF,[o("div",LF,[w.value>1?(r(),E(N,{key:0,text:"",onClick:Q},{default:u(()=>[R(f(c(d)("Skip All")),1)]),_:1})):x("",!0)]),o("div",RF,[s(N,{onClick:L,type:"info",plain:"",disabled:w.value===1},{default:u(()=>[R(f(c(d)("Go Back")),1)]),_:1},8,["disabled"]),B.value.canSkip?(r(),E(N,{key:0,text:"",onClick:O,disabled:$.value},{default:u(()=>[R(f(c(d)("Skip for now")),1)]),_:1},8,["disabled"])):x("",!0),B.value.isFinal?(r(),E(N,{key:2,type:"primary",loading:$.value,onClick:I},{default:u(()=>[$.value?x("",!0):(r(),h("span",OF,"⌘s")),R(" "+f($.value?c(d)("Saving"):c(d)("Save")),1)]),_:1},8,["loading"])):(r(),E(N,{key:1,type:"primary",loading:$.value,disabled:K.value,onClick:I},{default:u(()=>[R(f(c(d)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):x("",!0)],64)}}},HF={class:"fct-orders-route-wrap"},NF=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const l=C("router-view");return r(),h("div",HF,[s(l)])}}}),KF={class:"setting-wrap"},GF={class:"setting-wrap-inner"},zF={key:0,class:"payment-method-list fct-content-card-list"},jF={class:"flex items-start gap-3"},qF=["title"],YF=["onClick"],WF=["src","alt"],JF=["src","alt"],XF={key:1,class:"fct_payment_method_tag"},ZF={class:"fct-content-card-list-content"},eE={class:"fct-content-card-list-action"},tE={key:0},aE=["src"],lE={__name:"PaymentSettings",setup(e){const t=aa().ctx,a=M(!1),l=M([]),n=Ke.get("app_config.isProActive"),i=G(()=>({animation:200,ghostClass:"ghost"})),A=g=>!((g==null?void 0:g.upcoming)==!0||g!=null&&g.requires_pro&&!n||(g==null?void 0:g.is_addon)==!0&&!(g!=null&&g.status)&&(g!=null&&g.addon_status)&&!g.addon_status.is_installed),p=g=>g===!0?"active":"inactive",m=()=>{a.value=!0,t.$get("settings/payment-methods/all",{}).then(g=>{l.value=g.gateways}).catch(g=>{}).finally(()=>{a.value=!1})},_=()=>{const g=l.value.map(y=>y.route);t.$post("settings/payment-methods/reorder",{order:g}).then(y=>{j.success(y.message)}).catch(y=>{})};return Te(()=>{m()}),(g,y)=>{const v=C("el-skeleton"),k=C("el-button");return r(),h("div",KF,[s($a,{heading:c(d)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",GF,[s(Fa),s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?x("",!0):(r(),h("div",zF,[s(c(cn),ba(i.value,{list:l.value,"item-key":"route",handle:".drag-handle",onEnd:_}),{default:u(()=>[(r(!0),h(P,null,ae(l.value,b=>(r(),h("div",{key:b.route,class:ue(b!=null&&b.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",jF,[o("span",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 mt-1 w-7.5 h-7.5",title:c(d)("Drag to reorder")},y[0]||(y[0]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 6h8v2H8V6zm0 4h8v2H8v-2zm0 4h8v2H8v-2z"})],-1)]),8,qF),o("div",{onClick:()=>{var w;!((w=b==null?void 0:b.addon_status)!=null&&w.is_installed)&&(b!=null&&b.addon_source)||g.$router.push({name:b.route})},class:"cursor-pointer grid gap-2 flex-1"},[o("div",{class:ue(["fct-content-card-list-head",b.route])},[o("img",{src:b.logo,alt:b.admin_title||b.title,class:ue(b.logo_light?"dark:hidden":"")},null,10,WF),b.logo_light?(r(),h("img",{key:0,src:b.logo_light,alt:b.admin_title||b.title,class:"hidden dark:block"},null,8,JF)):x("",!0),b!=null&&b.tag?(r(),h("span",XF,[s(Ht,{size:"small",status:"info",text:b.tag},null,8,["text"])])):x("",!0),A(b)?(r(),E(Ht,{key:2,size:"small",status:b.status?"active":"disabled","hide-icon":!0},{default:u(()=>[R(f(p(b.status)),1)]),_:2},1032,["status"])):x("",!0)],2),o("div",ZF,[o("p",null,f(b.description),1)])],8,YF),o("div",eE,[b!=null&&b.upcoming?(r(),h("div",tE,f(c(d)("Coming Soon!")),1)):(r(),E(k,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:b.route})},{default:u(()=>{var w;return[R(f(c(d)("Manage"))+" ",1),b!=null&&b.requires_pro?(r(),h("img",{key:0,src:((w=g.appVars)==null?void 0:w.asset_url)+"images/crown.svg",alt:"pro feature",class:"pro-feature-icon"},null,8,aE)):x("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},sE={class:"role-form"},nE={class:"select-use-option"},oE={class:"select-label"},iE={key:0,class:"select-desc"},rE={class:"dialog-footer"},dE={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const l=M(!1),n=a,i=M(!1),A=M(null),p=M(null),m=M(!1),_=M(null),g=M(null),y=M({}),v=M(!1),k=$=>{if(!$){_.value=[];return}ce.get("roles/user-list",{search:$}).then(U=>{_.value=U.users.data}).finally(()=>{})},b=()=>{ce.get("roles").then($=>{g.value=$.roles}).catch($=>{if($.message){j.error($.message);return}}).finally(()=>{})},w=()=>{y.value={},i.value=!0,ce.post("roles",{user_id:A.value,role_key:p.value}).then(($,U)=>{l.value=!1,j.success($.message),n("fetchRoles")}).catch($=>{var U;(U=$.data)!=null&&U.message?j.error($.data.message):y.value=$.data}).finally(()=>{i.value=!1})},B=()=>{A.value=null,p.value=null,m.value=!1,y.value={},l.value=!1},S=M(""),V=G(()=>m.value?d("Edit %1$s's Role",S.value):d("Add Role"));return t({openModal:($,U,D,T=!1)=>{A.value=$,p.value=U,S.value=D,l.value=!0,m.value=T,b()}}),($,U)=>{const D=C("el-option"),T=C("el-select"),I=C("el-form-item"),L=C("el-form"),O=C("el-button"),Q=C("el-dialog");return r(),E(Q,{title:V.value,modelValue:l.value,"onUpdate:modelValue":U[4]||(U[4]=H=>l.value=H),onClosed:B,"append-to-body":!0},{footer:u(()=>[o("span",rE,[s(O,{onClick:B},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(O,{type:"primary",onClick:w,loading:i.value,disabled:i.value},{default:u(()=>[R(f(m.value?c(d)("Update Role"):c(d)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:u(()=>[o("div",sE,[s(L,{"label-position":"top"},{default:u(()=>[m.value?x("",!0):(r(),E(I,{key:0,label:c(d)("Select User")},{default:u(()=>[s(T,{modelValue:A.value,"onUpdate:modelValue":U[0]||(U[0]=H=>A.value=H),remote:!0,"remote-method":k,loading:v.value,filterable:"",clearable:"",placeholder:c(d)("Type to search user"),class:"w-full",onChange:U[1]||(U[1]=()=>{delete y.value.user_id})},{default:u(()=>[(r(!0),h(P,null,ae(_.value,H=>(r(),E(D,{key:H.ID,label:H.name,value:H.ID},{default:u(()=>[o("div",nE,[o("span",null,f(H.name),1),o("span",null,f(H.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(r(),E(zt,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])),s(I,{label:c(d)("Select Role")},{default:u(()=>[s(T,{onChange:U[2]||(U[2]=H=>{delete y.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":U[3]||(U[3]=H=>p.value=H),placeholder:c(d)("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:u(()=>[(r(!0),h(P,null,ae(g.value,(H,K)=>(r(),E(D,{key:K,label:H.title,value:K},{default:u(()=>[o("div",oE,f(H.title),1),H.description?(r(),h("div",iE,f(H.description),1)):x("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),E(zt,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},uE=nt(dE,[["__scopeId","data-v-b3e8599d"]]),cE={class:"setting-wrap"},AE={class:"setting-wrap-inner"},pE={key:0,class:"fct-setting-header-action"},fE={class:"fct-role-settings"},mE={class:"fct-customer-card"},hE={class:"fct-customer-details"},_E={class:"fct-customer-name"},vE={class:"fct-customer-id"},gE={class:"fct-customer-email"},yE={class:"role-title flex items-center gap-1 capitalize"},bE={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},wE={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},CE={__name:"RoleSettings",setup(e){const t=M(!1),a=M([]),l=M(),n=M(!1),i=Ke.get("app_config.isProActive"),A=()=>{t.value=!0,ce.get("roles/managers").then(m=>{a.value=m.managers}).finally(()=>{t.value=!1})},p=m=>{n.value=!0,ce.delete("roles/"+m.shop_role,{user_id:m.id}).then(_=>{a.value=a.value.filter(g=>g.id!==m.id),j.success(_.message)}).catch(_=>{if(_.message)return j.error(_.message)}).finally(()=>{n.value=!1})};return Te(()=>{i&&A()}),(m,_)=>{const g=C("el-button"),y=C("el-table-column"),v=C("el-popconfirm"),k=C("el-table"),b=Qa("loading");return r(),h("div",cE,[s($a,{heading:c(d)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",AE,[s(Fa),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Existing Roles & Permissions")},{action:u(()=>[c(i)?(r(),h("div",pE,[s(g,{type:"primary",size:"small",onClick:_[0]||(_[0]=()=>{var w;(w=l.value)==null||w.openModal()})},{default:u(()=>[R(f(c(d)("Add Role")),1)]),_:1})])):x("",!0)]),_:1},8,["title"]),c(i)?(r(),E(Be,{key:0,class:"px-0 pb-0"},{default:u(()=>[o("div",fE,[Jt((r(),E(k,{data:a.value},{empty:u(()=>[s(wt,{icon:"Empty/RoleAndPermission","has-dark":!0,text:c(d)("No roles found!")},null,8,["text"])]),default:u(()=>[s(y,{label:c(d)("User"),width:150},{default:u(w=>{var B,S,V;return[o("div",mE,[o("div",hE,[o("div",_E,[R(f(((B=w.row)==null?void 0:B.display_name)||c(d)("No Name"))+" ",1),o("span",vE,"#"+f((S=w.row)==null?void 0:S.id),1)]),o("div",gE,f((V=w.row)==null?void 0:V.email),1)])])]}),_:1},8,["label"]),s(y,{prop:"shop_role",label:c(d)("Role Title"),width:100},{default:u(w=>[o("span",yE,f(c(Aa).headline(w.row.shop_role)),1)]),_:1},8,["label"]),s(y,{prop:"description",label:c(d)("Roles"),width:100},{default:u(w=>[o("span",bE,f(w.row.description),1)]),_:1},8,["label"]),s(y,{width:100},{default:u(w=>[o("div",wE,[s(tt,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var B;(B=l.value)==null||B.openModal(w.row.id,w.row.shop_role,w.row.display_name,!0)}},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["onClick"]),s(v,{width:235,"confirm-button-text":c(d)("Confirm"),"cancel-button-text":c(d)("No, Thanks"),"icon-color":"red",title:c(d)("Are you sure to delete this user?"),onConfirm:B=>p(w.row)},{reference:u(()=>[s(tt,{tag:"a",size:"x-small",hover:"danger"},{default:u(()=>[s(X,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[b,t.value||n.value]])])]),_:1})):(r(),E(Be,{key:1,class:"px-0 pb-0"},{default:u(()=>[s(cs,{class:"py-7.5",placement:"feature_lock_roles_permissions",title:c(d)("Upgrade to Pro for Roles & Permission"),text:c(d)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]),_:1}))]),_:1}),s(uE,{ref_key:"roleModal",ref:l,onFetchRoles:A},null,512)])])}}},kE={class:"fct-settings-nav-wrap"},BE={class:"fct-settings-nav-collapse-button-wrapper"},xE={class:"fct-menu-collapse-button-text"},SE=["src","alt"],$E=["src","alt"],FE={class:"fct-settings-nav-link-text"},EE={class:"fct-settings-nav-child-list"},UE={class:"fct-settings-nav-content"},IE={class:"fct-settings-nav-content-inner"},mc="fct-settings-nav-collapsed",hc="fct-settings-nav-expanded",VE=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=Pa(),a=Oa(),l=M(window.innerWidth>=1024),n=M(!1),i=M(!1),A=M(null),p=M(null),m=M(null);zl.has("store/settings");const _=M([{name:d("Store Settings"),icon:"Gift",permission:["store/settings","store/sensitive"],url:"/settings/store-settings/",child:[{name:d("Store Setup"),url:"/settings/store-settings/"},{name:d("Pages Setup"),url:"/settings/store-settings/pages_setup"},{name:d("Product Page"),url:"/settings/store-settings/single_product_setup"},{name:d("Cart & Checkout"),url:"/settings/store-settings/cart_and_checkout"},{name:d("Checkout Fields"),url:"/settings/store-settings/checkout_fields"},{name:d("Subscriptions"),url:"/settings/store-settings/subscriptions_setup"},{name:d("Appearance"),url:"/settings/store-settings/appearance"}]},{name:d("Product Reviews"),icon:"ReviewCard",permission:["reviews/manage"],url:"/settings/product-reviews"},{name:d("Payment Settings"),icon:"PaymentIcon",permission:["is_super_admin"],url:"/settings/payments"},{name:d("Invoice & Packing"),icon:"Invoice",permission:["is_super_admin"],url:"/settings/invoice-packing",child:[{name:d("Invoice & Packing"),url:"/settings/invoice-packing"},{name:d("PDF Templates"),url:"/settings/pdf-template"},{name:d("E-Invoice Settings"),url:"/settings/pdf-template/settings"}]},{name:d("Tax Settings"),icon:"Tax",permission:["is_super_admin"],url:"/settings/tax_settings",child:[{name:d("Configuration"),url:"/settings/tax_settings"},{name:d("Rates"),url:"/settings/tax_settings/tax_rates",activeFor:["/settings/tax_settings/eu","/settings/tax_settings/tax_rates_country_single"]}]},{name:d("Email Configuration"),icon:"Message",permission:["store/sensitive"],url:"/settings/email_mailing_settings",child:[{name:d("Mailing Settings"),url:"/settings/email_mailing_settings"},{name:d("Reminders"),url:"/settings/email_mailing_settings/reminders"},{name:d("Notifications"),url:"/settings/email_notifications"},{name:d("Store Digest"),url:"/settings/email_digest_settings"}]},{name:d("Roles and Permissions"),icon:"ShieldCheck",permission:["is_super_admin"],url:"/settings/roles"},{name:d("Storage Settings"),icon:"Database",permission:["is_super_admin"],url:"/settings/storage"}]);a.hasRoute("shipping")&&_.value.push({name:d("Shipping"),icon:"Truck",permission:["store/sensitive"],url:"/settings/shipping",child:[{name:d("Shipping Zones"),permission:["store/sensitive"],url:"/settings/shipping"},{name:d("Shipping Classes"),permission:["store/sensitive"],url:"/settings/shipping/shipping_classes"},{name:d("Packages"),permission:["store/sensitive"],url:"/settings/shipping/packages"}]}),_.value.push({name:d("Features & addon"),icon:"Module",permission:["is_super_admin"],url:"/settings/addons"}),_.value.push({name:d("Compliance"),icon:"ShieldCheck",permission:["store/settings"],url:"/settings/compliance"}),Ke.get("app_config.isProActive")&&_.value.push({name:d("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"}),Ke.get("addon_settings_sidebar",[]).forEach(F=>_.value.push(F));const y=()=>{if(!l.value){A.value&&A.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open");return}n.value=!n.value,i.value=!1},v=()=>{l.value||(A.value&&A.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open"))},k=F=>F.child?(!w.value||B.value)&&S(F):!1,b=()=>{const F=window.innerWidth,$=l.value;l.value=F>=1024,!$&&l.value&&(A.value&&A.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open")),$&&!l.value&&(n.value=!1)};be(n,F=>{document.body.classList.toggle(mc,F),document.body.classList.toggle(hc,!F)},{immediate:!0}),Te(()=>{m.value=document.getElementById("fluent_cart_plugin_app"),m.value&&m.value.classList.add("fct_settings_page_plugin_app_wrap"),b(),window.addEventListener("resize",b)}),xt(()=>{m.value&&m.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",b),document.body.classList.remove(mc,hc)});const w=G(()=>n.value),B=G(()=>l.value&&n.value&&i.value),S=F=>{const $=t.path;return!!(F.child&&F.child.length&&F.child.some(D=>$===D.url||$.includes(D.url))||$===F.url||$.includes(F.url))},V=(F,$,U)=>{const D=t.path;return!!(D===F.url||F.activeFor&&F.activeFor.some(T=>D.startsWith(T))||D===U.url&&$===0)};return(F,$)=>{const U=C("el-button"),D=C("el-tooltip"),T=C("router-link"),I=C("router-view");return r(),h("div",{class:ue(["fct-setting-container setting-container",{"is-collapsed":w.value,"is-expanded":B.value}])},[o("div",{ref_key:"overlayRef",ref:p,class:"fct-settings-menu-overlay",onClick:v},null,512),o("div",kE,[o("div",{ref_key:"sidebarRef",ref:A,class:ue(["fct-settings-nav-container",{"is-collapsed":w.value,"is-expanded":B.value}])},[o("div",BE,[s(D,{content:c(d)("Toggle settings"),placement:"right"},{default:u(()=>[s(U,{onClick:y,"aria-label":c(d)("Toggle settings navigation"),"aria-expanded":!w.value},{default:u(()=>[s(X,{name:"Window"}),o("span",xE,f(c(d)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:$[0]||($[0]=L=>l.value&&n.value&&(i.value=!0)),onMouseleave:$[1]||($[1]=L=>i.value=!1)},[(r(!0),h(P,null,ae(_.value,(L,O)=>(r(),h("li",{key:O,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":S(L)}])},[c(zl).hasAny(L.permission)?(r(),E(T,{key:0,to:L.url,class:"fct-settings-nav-link"},{default:u(()=>[L.icon_img?(r(),h(P,{key:0},[o("img",{src:L.icon_img,alt:L.name,class:ue(L.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,SE),L.icon_img_dark?(r(),h("img",{key:0,src:L.icon_img_dark,alt:L.name,class:"w-5 h-5 hidden dark:block"},null,8,$E)):x("",!0)],64)):(r(),E(X,{key:1,name:L.icon},null,8,["name"])),o("span",FE,[R(f(L.name)+" ",1),s(X,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):x("",!0),s(ma,{visible:k(L),accordion:"",class:"fct-settings-nav-child-wrap"},{default:u(()=>[o("ul",EE,[(r(!0),h(P,null,ae(L.child,(Q,H)=>Jt((r(),h("li",{key:H,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":V(Q,H,L)}])},[s(T,{to:Q.url,class:"fct-settings-nav-link"},{default:u(()=>[R(f(Q.name),1)]),_:2},1032,["to"])],2)),[[$l,!Q.permission||c(zl).hasAny(Q.permission)]])),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),o("div",UE,[o("div",IE,[s(I)])])])],2)}}}),DE={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},TE={__name:"CustomerOrdersLoader",props:{columns:{type:Array,default:()=>[]}},setup(e){const t=e,a=l=>t.columns.includes(l);return(l,n)=>{const i=C("el-table-column"),A=C("el-skeleton-item"),p=C("el-skeleton"),m=C("el-table");return r(),E(m,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default:u(()=>[a("selection")?(r(),E(i,{key:0,type:"selection",width:"45"})):x("",!0),s(i,{width:140,label:c(d)("# Date")},{default:u(()=>[o("div",DE,[s(p,{animated:""},{template:u(()=>[s(A,{varient:"p",class:"w-3/5"})]),_:1}),s(p,{animated:""},{template:u(()=>[s(A,{varient:"p",class:"w-4/5"})]),_:1})])]),_:1},8,["label"]),a("order_items")?(r(),E(i,{key:1,"min-width":200,label:c(d)("Items")},{default:u(()=>[s(p,{animated:""},{template:u(()=>[s(A,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"])):x("",!0),s(i,{width:150,label:c(d)("Total")},{default:u(()=>[s(p,{animated:""},{template:u(()=>[s(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),s(i,{width:150,label:c(d)("Payment Status")},{default:u(()=>[s(p,{animated:""},{template:u(()=>[s(A,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),a("status")?(r(),E(i,{key:2,width:120,label:c(d)("Status")},{default:u(()=>[s(p,{animated:""},{template:u(()=>[s(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0),a("type")?(r(),E(i,{key:3,width:140,label:c(d)("Order Type")},{default:u(()=>[s(p,{animated:""},{template:u(()=>[s(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0)]),_:1})}}},QE={class:"select-use-option"},ME={class:"dialog-footer"},af={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=M(!1),l=M([]),n=M(null),i=M({}),A=M(!1),p=()=>{i.value={},A.value=!0,ce.post(`customers/${t.customer.id}/attachable-user`,{user_id:n.value}).then((g,y)=>{a.value=!1,j.success(g.message),t.customer.user_id=n.value}).catch(g=>{if(g.message)return j.error(g.message);i.value=g}).finally(()=>{A.value=!1})},m=()=>{n.value=null,i.value={},a.value=!1},_=()=>{ce.get("customers/attachable-user").then(g=>{l.value=dt.get(g,"users")})};return Te(()=>{_()}),(g,y)=>{C("el-link");const v=C("el-option"),k=C("el-select"),b=C("el-form-item"),w=C("el-form"),B=C("el-button"),S=C("el-dialog");return r(),h(P,null,[x("",!0),s(S,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=V=>a.value=V),title:c(d)("Attach User"),onClosed:m},{footer:u(()=>[o("span",ME,[s(B,{onClick:m},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(B,{type:"primary",onClick:p,loading:A.value,disabled:A.value},{default:u(()=>[R(f(c(d)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:u(()=>[s(w,{"label-position":"top"},{default:u(()=>[s(b,{label:g.$t("Select User")},{default:u(()=>[s(k,{id:"user_id",modelValue:n.value,"onUpdate:modelValue":y[1]||(y[1]=V=>n.value=V),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:u(()=>[(r(!0),h(P,null,ae(l.value,V=>(r(),E(v,{key:V.ID,label:V.display_name,value:V.ID},{default:u(()=>[o("div",QE,[o("span",null,f(V.display_name),1),o("span",null,f(V.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i.value.hasOwnProperty("user_id")?(r(),E(zt,{key:0,"validation-errors":i.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},LE={class:"more-btn"},RE={class:"fct-admin-sidebar-item"},OE={class:"fct-profile-card"},PE={class:"fct-profile-image"},HE={class:"fct-profile-details"},NE={class:"title"},KE={class:"text"},GE={key:0},zE={class:"text"},jE={key:0,class:"flex items-center gap-2 mt-1.5"},qE={class:"user-info"},YE=["href"],WE={key:1},JE={class:"fct-admin-sidebar-item mt-5"},XE={class:"sidebar-title"},ZE={class:"fct-contact-info-list"},eU={class:"flex items-center justify-between gap-2"},tU=["href"],aU={class:"fct-admin-sidebar-item mt-5"},lU={class:"sidebar-title"},sU={key:0,class:"fct-address-copy-wrap"},nU={class:"text"},oU={key:0,class:"pr-1"},iU=["innerHTML"],rU={key:1,class:"mt-3"},dU={class:"pr-1"},uU=["href"],cU={key:0,class:"no-address-text"},AU={class:"fct-admin-sidebar-item mt-5"},pU={class:"sidebar-title"},fU={key:0,class:"fct-address-copy-wrap"},mU={class:"text"},hU={key:0,class:"pr-1"},_U=["innerHTML"],vU={key:1,class:"mt-3"},gU={class:"pr-1"},yU=["href"],bU={key:0,class:"no-address-text"},wU={class:"fct-customer-address-wrap"},CU={name:"CustomerInformations",components:{CustomerPurchaseValue:Dm,NewCustomerModal:pd,ManageAddressModal:mA,AddOrEditAddressModal:fA,DynamicIcon:X,CopyToClipboard:Va,UserAttchModal:af,Back:cd},props:["customer","customer_id"],data(){return this.localizedData=window.fluentCartAdminApp,{addOrEditAddress:!1,shippingAddress:[],billingAddress:[],showAddressModal:!1,modalAction:{type:"billing",action:"create"},address:{},address_mock:{label:"",name:"",phone:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",is_primary:"0"},customerModalInfos:{showModal:!1,action:"edit",title:"Edit Customer Information",customer:{}},detaching:!1,recalculatingLtv:!1,shouldShowSetAsAlsoCheckbox:!0,closingModal:!1}},computed:{customerDisplayName(){var e,t,a;return this.localizedData.is_full_name_required?(e=this.customer)==null?void 0:e.full_name:((t=this.customer)==null?void 0:t.first_name)+" "+((a=this.customer)==null?void 0:a.last_name)},hasPrimaryBilling(){return this.billingAddress.findIndex(e=>e.is_primary=="1")},hasPrimaryShipping(){return this.shippingAddress.findIndex(e=>e.is_primary=="1")}},mounted(){this.billingAddress=this.customer.billing_address,this.shippingAddress=this.customer.shipping_address,this.customerModalInfos.customer=this.customer,this.customerModalInfos.customer_id=this.customer.id},methods:{handleCustomerBulkCommand(e){e==="edit_customer_information"&&(this.customerModalInfos.showModal=!0),e==="manage_billing_address"&&this.manageAddress("billing"),e==="manage_shipping_address"&&this.manageAddress("shipping"),e==="recalculate_ltv"&&this.recalculateLtv()},getCustomerTotalOrders(e){return e>0?e+" "+(e.toString()==="1"?this.$t("order"):this.$t("orders")):this.$t("No orders")},refresh(){this.addOrEditAddress=!1,this.fetch()},getTitle(){return this.modalAction.action==="create"?this.modalAction.type==="billing"?this.$t("Add new billing address"):this.$t("Add new shipping Address"):this.modalAction.type==="billing"?this.$t("Edit billing address"):this.$t("Edit shipping address")},addNewAddress(e="billing",t="create",a=[]){Object.keys(a).length>0?(this.address=JSON.parse(JSON.stringify(a)),this.shouldShowSetAsAlsoCheckbox=!1):this.address=JSON.parse(JSON.stringify(this.address_mock)),this.addOrEditAddress=!0,this.modalAction.type=e,this.modalAction.action=t,this.showAddressModal=!1},manageAddress(e="billing",t="edit"){this.showAddressModal=!0,this.modalAction.type=e,this.modalAction.action=t},fetch(){this.$emit("fetch")},recalculateLtv(){this.recalculatingLtv=!0,this.$post(`customers/${this.customer_id}/recalculate-ltv`).then(e=>{e.customer&&(this.customer.ltv=e.customer.ltv,this.customer.purchase_count=e.customer.purchase_count,this.customer.aov=e.customer.aov,this.customer.first_purchase_date=e.customer.first_purchase_date,this.customer.last_purchase_date=e.customer.last_purchase_date),this.handleSuccess(e.message)}).catch(e=>{this.handleError(e.message||this.$t("Failed to recalculate lifetime value"))}).finally(()=>{this.recalculatingLtv=!1})},handleDetachUser(){this.detaching=!0,Rest.post(`customers/${this.customer_id}/detach-user`,{user_id:this.customer.user_id}).then((e,t)=>{this.customer.user_id=0,Notify.success(e.message)}).catch(e=>{if(e.message)return Notify.error(e.message)}).finally(()=>{this.detaching=!1})}}},lf=Object.assign(CU,{setup(e){return(t,a)=>{const l=C("el-dropdown-item"),n=C("el-dropdown-menu"),i=C("el-dropdown"),A=C("el-button"),p=C("el-popconfirm"),m=C("el-tag"),_=C("el-icon"),g=C("el-dialog"),y=Qa("loading");return r(),h("div",null,[s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Customer Information"),title_size:"small",border_bottom:""},{action:u(()=>[s(i,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleCustomerBulkCommand},{dropdown:u(()=>[s(n,null,{default:u(()=>[s(l,{command:"edit_customer_information"},{default:u(()=>[R(f(t.$t("Edit customer information")),1)]),_:1}),s(l,{command:"manage_shipping_address"},{default:u(()=>[R(f(t.$t("Manage shipping address")),1)]),_:1}),s(l,{command:"manage_billing_address"},{default:u(()=>[R(f(t.$t("Manage billing address")),1)]),_:1}),s(l,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:u(()=>[R(f(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:u(()=>[o("span",LE,[s(X,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),s(Be,null,{default:u(()=>{var v,k,b,w;return[o("div",RE,[o("div",OE,[o("div",PE,[s(Ts,{url:(v=e.customer)==null?void 0:v.photo,name:t.customerDisplayName},null,8,["url","name"])]),o("div",HE,[o("div",NE,f(t.customerDisplayName),1),o("span",KE,[e.customer.purchase_count>0?(r(),h("span",GE,f(c(la)(e.customer.purchase_count)),1)):x("",!0),R(" "+f(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),o("span",zE,f(c(jt)((k=e.customer)==null?void 0:k.ltv,!0))+" "+f(c(d)("Lifetime Value")),1)])])]),o("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),h("div",jE,[o("div",qE,[a[6]||(a[6]=R(" WP User: ",-1)),o("a",{href:e.customer.user_link,target:"_blank",class:"inline-flex items-center gap-1 dark:text-gray-100 text-primary-500 focus:shadow-none hover:!underline"},[R(" #"+f(c(la)(e.customer.user_id))+" ",1),s(X,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,YE)]),x("",!0)])):(r(),h("div",WE,[s(af,{customer:e.customer},null,8,["customer"])]))]),o("div",JE,[o("h4",XE,f(t.$t("Contact Information")),1),o("ul",ZE,[o("li",null,[o("div",eU,[o("a",{class:"text",href:"mailto:"+((b=e.customer)==null?void 0:b.email)},f((w=e.customer)==null?void 0:w.email),9,tU),s(Va,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",aU,[o("h4",lU,[R(f(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:u(()=>[R(f(t.$t("Default")),1)]),_:1})):x("",!0)]),(r(!0),h(P,null,ae(t.shippingAddress,(B,S)=>(r(),h(P,null,[B.is_primary==="1"?(r(),h("div",sU,[o("span",nU,[B.name?(r(),h("strong",oU,f(B.name),1)):x("",!0),o("span",{innerHTML:t.getOrderAddress(B,"shipping",!0)},null,8,iU),B.phone?(r(),h("span",rU,[o("strong",dU,f(c(d)("Phone"))+":",1),o("a",{href:"tel:"+B.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(B.phone),9,uU)])):x("",!0)]),s(Va,{text:t.getOrderAddress(B),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):x("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",cU,f(t.$t("No default address found.")),1)):x("",!0)]),o("div",AU,[o("h4",pU,[R(f(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:u(()=>[R(f(t.$t("Default")),1)]),_:1})):x("",!0)]),(r(!0),h(P,null,ae(t.billingAddress,(B,S)=>(r(),h(P,null,[B.is_primary==="1"?(r(),h("div",fU,[o("span",mU,[B.name?(r(),h("strong",hU,f(B.name),1)):x("",!0),o("span",{innerHTML:t.getOrderAddress(B,"billing",!0)},null,8,_U),B.phone?(r(),h("span",vU,[o("strong",gU,f(c(d)("Phone"))+":",1),o("a",{href:"tel:"+B.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(B.phone),9,yU)])):x("",!0)]),s(Va,{text:t.getOrderAddress(B),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):x("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),h("p",bU,f(t.$t("No default address found.")),1)):x("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),E(pd,{key:0,"onUpdate:customerModal":t.fetch,customerModalInfos:t.customerModalInfos,customer_id:t.customerModalInfos.customer_id,customer:t.customerModalInfos.customer,onCloseModal:a[0]||(a[0]=v=>t.customerModalInfos.showModal=!1)},null,8,["onUpdate:customerModal","customerModalInfos","customer_id","customer"])):x("",!0),s(mA,{modalAction:t.modalAction,onRefreshAddress:t.refresh,"onUpdate:showAddressModal":a[1]||(a[1]=v=>t.showAddressModal=v),showAddressModal:t.showAddressModal,customer_id:e.customer_id,showBusinessDetailsSection:!0,onAddNewAddress:t.addNewAddress},null,8,["modalAction","onRefreshAddress","showAddressModal","customer_id","onAddNewAddress"]),s(g,{"show-close":!0,modelValue:t.addOrEditAddress,"onUpdate:modelValue":a[4]||(a[4]=v=>t.addOrEditAddress=v),"append-to-body":!0,title:t.getTitle(),onClose:a[5]||(a[5]=()=>{t.closingModal=!0})},{default:u(()=>[o("div",wU,[s(A,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:u(()=>[s(_,null,{default:u(()=>[s(c(cd))]),_:1}),R(" "+f(t.$t("Manage address")),1)]),_:1}),s(fA,{"onUpdate:refreshAddress":t.refresh,customer_id:e.customer_id,modalAction:t.modalAction,address:t.address,showAddressModal:t.addOrEditAddress,showSetAsAlsoCheckbox:t.shouldShowSetAsAlsoCheckbox,showBusinessDetailsSection:!0,onCloseModal:a[3]||(a[3]=v=>t.addOrEditAddress=!1),closing_modal:t.closingModal},null,8,["onUpdate:refreshAddress","customer_id","modalAction","address","showAddressModal","showSetAsAlsoCheckbox","closing_modal"])])]),_:1},8,["modelValue","title"])])}}}),kU={class:"fct-single-customer-loader-wrap fct-layout-width"},BU={class:"single-page-header fct-page-loader-header flex items-start justify-between"},xU={class:"single-page-body"},SU={class:"fct-single-order"},$U={class:"fct-single-order-main"},FU={class:"fct-single-order-aside"},EU={class:"fct-admin-sidebar"},sf={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton");return r(),h("div",kU,[o("div",BU,[s(n,{animated:"",class:"flex items-start gap-2"},{template:u(()=>[(r(),h(P,null,ae(3,i=>s(l,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),o("div",xU,[o("div",SU,[o("div",$U,[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:5})]),_:1})]),_:1})]),o("div",FU,[o("div",EU,[s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:5})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},UU={key:2},IU={key:0,class:"fct-single-customer-wrapper fct-layout-width"},VU={class:"single-page-header"},DU={class:"single-page-header-title-wrap"},TU={key:0},QU={key:0,class:"single-page-body"},MU={class:"fct-admin-sidebar"},LU={key:0},RU={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:hd,IconButton:tt,Empty:wt,DynamicIcon:X,Badge:Ht,SaveBar:Ns,CustomerInformation:lf,Labels:fi,DynamicTemplates:hn,ArrowDown:Ls,ArrowRight:Za,CardContainer:xe,CardHeader:Ve,CardBody:Be,LicenseTable:fd,OrdersTableMobile:_d,SubscriptionsTable:vA,SingleCustomerLoader:sf,SubscriptionsTableMobile:_A},data(){return{changes_made:0,notFound:{show:!1,message:"",buttonText:"",route:""},loading:!1,customer:"",selection:!1,selectedOrders:[],editableOrderStatues:this.appVars.editable_order_statues,selectedLabels:[],licenses:[],subscriptions:[],customerOrders:[],paginate:{current_page:1,per_page:10,last_page:1,total:0,from:1,to:10},fetchingOrders:!1,search:"",showSearch:!1}},watch:{customer_id:{handler(e,t){this.fetch()}}},computed:{},methods:{getProductName(e){var t,a;return(t=e==null?void 0:e.product)!=null&&t.post_title?(a=e==null?void 0:e.product)==null?void 0:a.post_title:"n/a"},getProductVariationName(e){var t,a;return(t=e==null?void 0:e.product_variant)!=null&&t.variation_title?(a=e==null?void 0:e.product_variant)==null?void 0:a.variation_title:"n/a"},onChangeLabel(e){this.selectedLabels=e,this.changes_made++},update(){this.loading=!0,ce.put("customers/"+this.customer_id+"/additional-info",{labels:this.selectedLabels}).then(e=>{j.success(e)}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,this.changes_made=0})},discardChanges(){return this.changes_made=0,window.location.reload()},fetch(){this.notFound.show=!1,this.loading=!0,this.selectedOrders=[],ce.get("customers/"+this.customer_id,{with:["admin_customer_detail"]}).then(e=>{this.changeTitle(d("Customer: %s",e.customer.full_name)),this.customer=e.customer,this.selectedLabels=e.customer.selected_labels,this.licenses=this.customer.licenses,this.subscriptions=this.customer.subscriptions}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=dt.get(e,"data.buttonText"),this.notFound.message=dt.get(e,"data.message"),this.notFound.route=dt.get(e,"data.route")):e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},getCustomerOrders(){this.fetchingOrders=!0,ce.get("customers/"+this.customer_id+"/orders",{per_page:this.paginate.per_page,page:this.paginate.current_page,with:["admin_customer_orders"],search:this.search,order_by:"id",order_type:"DESC"}).then(e=>{this.customerOrders=e.orders,this.paginate.total=e.orders.total,this.paginate.per_page=e.orders.per_page,this.paginate.current_page=e.orders.current_page,this.paginate.last_page=e.orders.last_page,this.paginate.from=e.orders.from,this.paginate.to=e.orders.to}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.fetchingOrders=!1})},onSelection(e){this.selection=!!e.length,this.selectedOrders=e,this.selectionCount=e.length}},mounted(){this.fetch(),this.getCustomerOrders()}},OU=Object.assign(RU,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),n=C("el-breadcrumb"),i=C("el-input"),A=C("el-col"),p=C("el-row");return r(),h(P,null,[t.loading?(r(),E(sf,{key:0})):x("",!0),t.notFound.show?(r(),E(hi,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):x("",!0),t.notFound.show===!1?(r(),h("div",UU,[t.loading?x("",!0):(r(),h("div",IU,[s(Ns,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",VU,[o("div",DU,[s(n,{"separator-icon":c(Za)},{default:u(()=>[s(l,{to:{name:"customers"}},{default:u(()=>[R(f(c(d)("Customers")),1)]),_:1}),s(l,null,{default:u(()=>[t.customer?(r(),h("span",TU,f(t.customer.full_name),1)):x("",!0)]),_:1}),s(l,null,{default:u(()=>[R(f(c(d)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(r(),h("div",QU,[s(p,{gutter:30},{default:u(()=>[s(A,{lg:17,xs:24},{default:u(()=>[s(c(xe),{class:"overflow-hidden fct-customer-orders-items"},{default:u(()=>[s(c(Ve),{title:c(d)("Orders (%s)",c(la)(t.customerOrders.total||0)),title_size:"small"},{action:u(()=>[s(i,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=m=>t.search=m),onKeyup:a[1]||(a[1]=ea(m=>t.getCustomerOrders(),["enter"])),placeholder:c(d)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=m=>t.getCustomerOrders()),class:ue(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),s(tt,{tag:"button",size:"small",onClick:a[3]||(a[3]=m=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:u(()=>[t.showSearch?(r(),E(X,{key:0,name:"Cross"})):(r(),E(X,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),s(c(Be),{class:"px-0 pb-0"},{default:u(()=>[t.fetchingOrders?(r(),E(TE,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(P,{key:1},[s(hd,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),s(_d,{class:"show-on-mobile",orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["orders"])],64)),t.paginate.total>10?(r(),E(sA,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):x("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(r(),E(c(xe),{key:0,class:"overflow-hidden"},{default:u(()=>[s(c(Ve),{title:c(d)("Subscriptions")+" ("+c(la)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),s(c(Be),{class:"px-0 pb-0"},{default:u(()=>[s(vA,{class:"hide-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"]),s(_A,{class:"show-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"])]),_:1})]),_:1})):x("",!0),t.customer.licenses?(r(),E(c(xe),{key:1,class:"overflow-hidden"},{default:u(()=>[s(c(Ve),{title:c(d)("Licenses")+" ("+c(la)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),s(c(Be),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:u(()=>[s(fd,{columns:["product","order_id"],licenses:t.customer.licenses},null,8,["licenses"])]),_:1})]),_:1})):x("",!0)]),_:1}),s(A,{lg:7,xs:24},{default:u(()=>[o("div",MU,[s(lf,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),s(fi,{"bind-to-id":t.customer.id,"bind-to-type":"Customer",selectedLabels:t.selectedLabels,shouldEnableEditing:!0},null,8,["bind-to-id","selectedLabels"]),t.customer?(r(),h("div",LU,[s(hn,{filter:"customer",widgetsQuery:{customer_id:t.customer.id},data:{customer:t.customer}},null,8,["widgetsQuery","data"])])):x("",!0)])]),_:1})]),_:1})])):x("",!0)]))])):x("",!0)],64)}}}),PU={components:{BundleProducts:Oo,Empty:wt,Pagination:sA,Badge:Ht,DynamicIcon:X},props:["searchQueryParent","orderParent","order_id"],data(){return{loading:!1,searching:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],cartItems:[],paginate:{per_page:10,current_page:1,total:0,last_page:1},collapsedStates:null}},computed:{CurrencyFormatter(){return _t},Asset(){return pl},order:{get(){return this.orderParent},set(e){this.$emit("update:order",e)}},searchQuery:{get(){return this.searchQueryParent},set(e){this.$emit("update:searchQuery",e)}}},created(){this.initializeCollapsedStates()},methods:{translate:d,translateNumber:la,initializeCollapsedStates(){this.collapsedStates=Array.from({length:this.availableProducts.length},()=>!1)},handleToggleCollapse(e){this.collapsedStates[e]=!this.collapsedStates[e];for(let t=0;t<this.collapsedStates.length;t++)t!==e&&(this.collapsedStates[t]=!1)},hasSubscriptionProduct(e,t){return e.filter(l=>l.variants&&l.variants.other_info&&l.variants.other_info.payment_type===t?!0:!!(l.other_info.payment_type&&l.other_info.payment_type===t)).length>0},validateShouldAddProduct(e){var i;const t=this.order.order_items.map(A=>A.object_id),a=this.selectedProducts.map(A=>A.object_id),l=((i=e==null?void 0:e.other_info)==null?void 0:i.payment_type)==="onetime"?"subscription":"onetime",n=this.order.order_items.length===0;if(n&&this.selectedProducts.length===0)return!0;if(n&&a.includes(e.object_id))return!0;if(!n&&t.includes(e.object_id))return!0;if(n&&!this.hasSubscriptionProduct(this.selectedProducts,l)){if(!this.hasSubscriptionProduct(this.selectedProducts,"subscription"))return!0}else if(!n&&!this.hasSubscriptionProduct(this.order.order_items,l)&&!this.hasSubscriptionProduct(this.order.order_items,"subscription"))return!0;return!1},handleCheckboxChange(e,t){if(t.checked)if(this.validateShouldAddProduct(t))this.selectedProducts.push(t);else return t.checked=!1,j.error(d("You can purchase one subscription at a time."));else{const a=this.selectedProducts.findIndex(l=>l.id===t.id);if(a!==-1)return this.selectedProducts.splice(a,1)}},onCurrentPageChanged({page:e,currentPageCount:t}){this.paginate.current_page=e,this.doSearch()},onPerPageChanged(e){this.paginate.per_page=e,this.doSearch()},isAlreadyAdded(e){return this.order.order_items?this.order.order_items.some(t=>parseInt(t.object_id)===parseInt(e)):!1},isNotParentVariant(e){return!e.children||e.children.length<1},handleSelectionChanges(e){this.selectedProducts=e},processProducts(){let e={};this.order.order_items&&this.order.order_items.length&&this.order.order_items.forEach((a,l)=>{e[a.object_id]=a}),this.selectedProducts&&this.selectedProducts.forEach((a,l)=>{e[a.object_id]?e[a.object_id].quantity++:(a.tax_amount=parseInt(a.tax_amount)||0,a.shipping_charge=parseInt(a.shipping_charge)||0,a.discount_total=parseInt(a.discount_total)||0,a.quantity=parseInt(a.quantity)||1,a.payment_type==="subscription"&&(a.custom_price=null,a.original_price=a.price,a.original_unit_price=a.unit_price,a.has_custom_price=!1),e[a.object_id]=a),e[a.object_id].updated_stock=parseInt(a.available),e[a.object_id].total=parseInt(e[a.object_id].price)*parseInt(e[a.object_id].quantity),e[a.object_id].line_total=parseInt(e[a.object_id].total)-parseInt(e[a.object_id].discount_total)+parseInt(e[a.object_id].tax_amount)}),this.order.order_items=[];let t=0;for(const a in e)if(this.order.order_items.push(e[a]),t+=parseInt(e[a].line_total),e[a].payment_type==="subscription"&&e[a].other_info.manage_setup_fee==="yes"){let l=parseInt(e[a].other_info.signup_fee);e[a].other_info.setup_fee_per_item==="yes"&&(l=l*e[a].quantity),t+=l}return this.order.subtotal=t,this.order.total_amount=t+parseInt(this.order.tax_total)+parseInt(this.order.shipping_total)-parseInt(this.order.manual_discount_total),this.orderAddModal=!1,this.searchQuery="",this.selectedProducts=[],!0},fetchBySearch(){this.loading=!0,this.searching=!0,this.orderAddModal=!0;let e=this;$e(()=>{setTimeout(()=>{e.$refs.fc_product_search_new.ref.focus()},50)}),clearTimeout(this.timeout);const t=this;this.timeout=setTimeout(function(){t.doSearch()},700)},doSearch(){this.loading=!0;let e={active_view:"publish",per_page:this.paginate.per_page,page:this.paginate.current_page,search:this.searchQuery,filter_type:"simple",sort_by:"ID",with:["admin_order_add_product"]};ce.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=Xm(a.data,this.order_id),delete a.data,this.paginate=a,this.searching=!1}).catch(t=>{var a;t.status_code=="422"?j.validationErrors(t):j.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1})},formatCapitalized(e){return Jm(e)}}},HU={class:"fluent-cart-admin-pages"},NU={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},KU={class:"px-5"},GU={class:"fc_product_search_table",ref:"fc_product_search_table"},zU={class:"fct-collapsible-list"},jU={class:"fct-collapsible-list-item-inner"},qU={class:"fct-collapsible-item"},YU={class:"fct-collapsible-content-wrapper"},WU=["onClick"],JU={key:1,class:"content-indent"},XU={class:"content-checkbox"},ZU={class:"content-img"},e5=["src","alt"],t5={class:"content-title"},a5={class:"title"},l5={key:0,class:"text-gray-500 dark:text-gray-400"},s5={key:1,class:"text"},n5={key:0,class:"fct-collapsible-stock-wrapper"},o5={key:0},i5={key:1,class:"text-red-500"},r5={class:"fct-collapsible-value-wrapper"},d5={key:0},u5={key:1},c5={class:"fct-collapsible-item-child-inner"},A5={class:"fct-collapsible-item"},p5={class:"fct-collapsible-content-wrapper"},f5={class:"fct-collapsible-content-group"},m5={class:"content-checkbox"},h5={class:"content-img"},_5=["src","alt"],v5={class:"content-title"},g5={class:"title title--wrap"},y5={key:0,class:"text"},b5={key:0},w5={key:1,class:"text already-added"},C5={class:"fct-collapsible-stock-wrapper"},k5={key:0},B5={key:1,class:"text-red-500"},x5={class:"fct-collapsible-value-wrapper"},S5={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},$5={class:"dialog-footer"};function F5(e,t,a,l,n,i){const A=C("DynamicIcon"),p=C("el-input"),m=C("el-skeleton"),_=C("el-checkbox"),g=C("BundleProducts"),y=C("Empty"),v=C("Pagination"),k=C("el-button"),b=C("el-dialog");return r(),h("div",HU,[s(b,{class:"fct-add-product-item-modal",ref:"fc_product_search_container",onClose:t[3]||(t[3]=w=>i.searchQuery=""),modelValue:n.orderAddModal,"onUpdate:modelValue":t[4]||(t[4]=w=>n.orderAddModal=w),title:e.$t("Add Items")},{default:u(()=>[o("div",NU,[o("div",KU,[s(p,{placeholder:e.$t("Search products"),autofocus:"",ref:"fc_product_search_new",onInput:t[0]||(t[0]=w=>i.fetchBySearch()),modelValue:i.searchQuery,"onUpdate:modelValue":t[1]||(t[1]=w=>i.searchQuery=w),clearable:""},{prefix:u(()=>[s(A,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),o("div",GU,[s(m,{class:"px-5 py-4",loading:n.loading,rows:5,animated:""},null,8,["loading"]),n.loading?x("",!0):(r(),h(P,{key:0},[o("ul",zU,[(r(!0),h(P,null,ae(n.availableProducts,(w,B)=>{var S,V,F,$,U,D,T,I,L;return r(),h("li",{class:"fct-collapsible-list-item",key:B},[o("div",jU,[o("div",qU,[o("div",YU,[((S=w==null?void 0:w.children)==null?void 0:S.length)>0?(r(),h("div",{key:0,class:ue(["content-collapsible-btn",{"is-collapsed":n.collapsedStates[B]}]),onClick:O=>i.handleToggleCollapse(B)},[s(A,{name:"CaretRight"})],10,WU)):x("",!0),!((V=w==null?void 0:w.children)!=null&&V.length)>0?(r(),h("div",JU)):x("",!0),o("div",XU,[s(_,{modelValue:w.checked,"onUpdate:modelValue":O=>w.checked=O,onChange:O=>i.handleCheckboxChange(B,w),disabled:w.disable===!0||i.isAlreadyAdded(w.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",ZU,[o("img",{src:w.featured_media!=null?w.featured_media:i.Asset.productPlaceholder(),alt:w.title},null,8,e5)]),o("div",t5,[o("div",a5,f(w.post_title),1),((F=w==null?void 0:w.other_info)==null?void 0:F.payment_type)==="subscription"&&(($=w.other_info)==null?void 0:$.billing_summary)!==""?(r(),h("small",l5,f((U=w.other_info)==null?void 0:U.billing_summary),1)):x("",!0),i.isAlreadyAdded(w.object_id)?(r(),h("div",s5,f(e.$t("Item already added")),1)):x("",!0)])]),((D=w==null?void 0:w.children)==null?void 0:D.length)==0?(r(),h("div",n5,[w.stockStatus=="in-stock"?(r(),h("span",o5,f(w.available!==1/0?w.available+i.translate(" Available"):i.translate("Unlimited")),1)):x("",!0),w.stockStatus==="out-of-stock"?(r(),h("span",i5,f(i.formatCapitalized(w.stockStatus)),1)):x("",!0)])):x("",!0),o("div",r5,[((T=w==null?void 0:w.children)==null?void 0:T.length)>0?(r(),h("span",d5,f(w.min_price!=w.max_price?e.formatNumber(w.min_price)+" - "+e.formatNumber(w.max_price):e.formatNumber(w.min_price)),1)):(r(),h("span",u5,f(e.formatNumber(w.price)),1))])]),((I=w==null?void 0:w.children)==null?void 0:I.length)>0?(r(),h("div",{key:0,class:ue(["fct-collapsible-item-child-container",{"is-collapsed":n.collapsedStates[B]}])},null,2)):x("",!0),((L=w==null?void 0:w.children)==null?void 0:L.length)>0?(r(),h("div",{key:1,class:ue(["fct-collapsible-item-child-container",{"is-collapsed":n.collapsedStates[B]}])},[o("ul",c5,[(r(!0),h(P,null,ae(w.children,(O,Q)=>{var H,K,W,z,Y;return r(),h("li",{key:Q},[o("div",A5,[o("div",p5,[o("div",f5,[o("div",m5,[s(_,{modelValue:O.checked,"onUpdate:modelValue":Z=>O.checked=Z,onChange:Z=>i.handleCheckboxChange(Q,O),disabled:O.disable===!0||i.isAlreadyAdded(O.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",h5,[o("img",{src:O.featured_media!=null?O.featured_media:i.Asset.productPlaceholder(),alt:O.title},null,8,_5)])]),o("div",v5,[o("div",g5,f(O.variation_display_title||O.title),1),((H=O==null?void 0:O.other_info)==null?void 0:H.payment_type)==="subscription"&&((K=O.other_info)==null?void 0:K.billing_summary)!==""?(r(),h("small",y5,[R(f(i.CurrencyFormatter.currencySign)+" "+f((W=O.other_info)==null?void 0:W.billing_summary)+" ",1),((z=O.other_info)==null?void 0:z.trial_days)>0?(r(),h("span",b5,[t[5]||(t[5]=o("br",null,null,-1)),R(" "+f(i.translate("Trial Days"))+": "+f((Y=O.other_info)==null?void 0:Y.trial_days),1)])):x("",!0)])):x("",!0),i.isAlreadyAdded(O.object_id)?(r(),h("div",w5,f(i.translate("Item already added")),1)):x("",!0),O.bundle_items.length>0?(r(),E(g,{key:2,product:O,"title-key":"variation_title"},null,8,["product"])):x("",!0)])]),o("div",C5,[O.stockStatus=="in-stock"?(r(),h("span",k5,f(O.available!==1/0?i.translateNumber(O.available)+i.translate(" Available"):i.translate("Unlimited")),1)):x("",!0),O.stockStatus=="out-of-stock"?(r(),h("span",B5,f(i.formatCapitalized(O.stockStatus)),1)):x("",!0)]),o("div",x5,f(e.formatNumber(O.price)),1)])])}),128))])],2)):x("",!0)])])}),128))]),n.availableProducts.length===0?(r(),E(y,{key:0,icon:"Empty/ListView",text:i.translate("We could't find any products matching your search.")},null,8,["text"])):x("",!0)],64))],512),o("div",S5,[s(v,{pagerSizes:!1,hide_on_single:!1,pagination:n.paginate,onFetch:i.doSearch,onCurrentPageChanged:i.onCurrentPageChanged,onOnPerPageChanged:i.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),o("div",$5,[s(k,{onClick:t[2]||(t[2]=w=>n.orderAddModal=!1)},{default:u(()=>[R(f(i.translate("Cancel")),1)]),_:1}),s(k,{disabled:!n.selectedProducts.length,type:"primary",onClick:i.processProducts},{default:u(()=>[R(f(i.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const nf=nt(PU,[["render",F5]]),Kn=(e,t=null)=>{if(!e)return"";const a=Array.isArray(e.attr_map)?e.attr_map:[];if(a.length){const l=Array.isArray(t)?t.map(p=>parseInt(p,10)):null,n=p=>{const m=parseInt(p&&p.group_id,10);if(l){const _=l.indexOf(m);return _===-1?Number.MAX_SAFE_INTEGER:_}return m||0},A=[...a].sort((p,m)=>n(p)-n(m)).map(p=>p&&p.title?String(p.title).trim():"").filter(Boolean);if(A.length)return A.join(" / ")}return e.variation_title||""},Zo=e=>{var a,l;const t=(l=(a=e==null?void 0:e.detail)==null?void 0:a.other_info)==null?void 0:l.attribute_config;return Array.isArray(t)?t.map(n=>parseInt(n&&n.group_id,10)).filter(n=>!Number.isNaN(n)):null},E5={key:0,class:"fct-downloadable-variation-selector"},U5={class:"price-info"},I5={key:0},ei={__name:"VariationSelector",props:{variant:{type:Object,required:!0},groupOrder:{type:Array,default:null}},setup(e){return(t,a)=>{var l;return e.variant?(r(),h("div",E5,[o("span",null,f(c(Kn)(e.variant,e.groupOrder)),1),o("span",U5,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),h("span",I5,f(c(Aa).capitalize(e.variant.other_info.repeat_interval)),1)):x("",!0),o("span",null,f(c(jt)(e.variant.item_price,!0)),1)])])):x("",!0)}}},V5={name:"Refund",components:{Badge:Ht,VariationSelector:ei,DynamicIcon:X},props:["order_id","order","is_subscription","subscription_status","showRefundModal"],data(){return{transactions:{},maxRefundAmount:"",refundProcessing:!1,refundableTransactions:[],isShippingRefundable:!1,refund:{item_ids:[],transaction_id:"",amount:0,cancelSubscription:!0,reason:"",availableAmount:"",paymentMethod:"",manageStock:!1},totalPaid:0,refundNote:""}},computed:{CurrencyFormatter(){return _t},orderCurrencySign(){const e=Ke.get("currency_signs",{}),t=Ke.get("shop.currency_sign","$");return this.order&&this.order.currency&&e[this.order.currency]?e[this.order.currency]:t},isAnyProductManageStock(){var e;for(const t of this.order.order_items)if(t!=null&&t.variants&&((e=t==null?void 0:t.variants)==null?void 0:e.manage_stock)==="1")return!0;return!1},isSubscriptionCancelable(){return this.is_subscription&&this.subscription_status!=="canceled"&&this.subscription_status!=="expired"},checkMaxRefundAmount(){this.refund.amount>this.maxRefundAmount&&(this.refund.amount=this.maxRefundAmount)},refundTableItems(){let e=[];return!this.refund.item_ids||this.refund.item_ids.length===0?e=this.order.order_items.filter(t=>t.payment_type!=="signup_fee"):e=this.order.order_items.filter(t=>this.refund.item_ids.includes(t.id)&&t.payment_type!=="signup_fee"),e.map(t=>({...t,restore_quantity:t.restore_quantity||0,refund_quantity:Number(t.refund_total)||0}))}},watch:{showRefundModal(e){this.refundNote=""},"order.order_items":{immediate:!0,handler(e){const t=e.filter(a=>Number(a.line_total)-Number(a.refund_total)>0);t.length===1?this.refund.item_ids=[t[0].id]:this.refund.item_ids=[]}}},mounted(){var e,t,a;this.refund.availableAmount=parseInt((e=this==null?void 0:this.order)==null?void 0:e.total_paid)-parseInt((t=this==null?void 0:this.order)==null?void 0:t.total_refund),this.transactions=(a=this.order)==null?void 0:a.transactions,this.transactions.length&&this.updateRefundable()},methods:{translate:d,formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)},updateMaxRefund(){const e=this.refund.transaction_id;let t=this.refundableTransactions.find(n=>n.id===e);this.refund.amount=t.refundable?parseFloat(t.refundable/100):0,this.refund.paymentMethod=t.payment_method;const a=dt.whereIn(this.order.order_items,"id",this.refund.item_ids),l=a.reduce((n,i)=>n+(i.line_total-i.refund_total)/100,0);this.refund.amount>l&&a.length>0&&(this.refund.amount=l),this.maxRefundAmount=this.refund.amount},updateRefundable(){this.refundableTransactions=this.transactions.filter(e=>e.status==="succeeded"),this.refundableTransactions.length!==0&&(this.refund.transaction_id=this.refundableTransactions[0].id,this.refund.payment_method=this.refundableTransactions[0].payment_method,this.updateMaxRefund(this.refund.transaction_id))},processRefund(){if(this.refundProcessing=!0,!this.refund.amount)return this.refundProcessing=!1,this.handleMessage("Please add refund amount.","error");if(this.refund.amount>this.refund.availableAmount)return this.refundProcessing=!1,this.handleMessage(`Refund amount should not exceed: ${this.appVars.shop.currency_sign}${this.refund.availableAmount}`,"error");const e=this.refundTableItems.filter(a=>a.restore_quantity>0).map(a=>({id:a.id,variation_id:a.object_id,quantity:a.quantity,restore_quantity:a.restore_quantity}));this.refund.refunded_items=e;const t={...this.refund,amount:Math.round(parseFloat(this.refund.amount)*100)};this.$post("orders/"+this.order_id+"/refund",{refund_info:t,refunded_items:e}).then(a=>{this.refundNote=a}).catch(a=>{this.handleError(a)}).finally(()=>{this.updateRefundable(),this.refundProcessing=!1})}}},D5={key:0,class:"fct-refund-note-list"},T5={class:"message"},Q5={key:1},M5={class:"refund-item-info"},L5={class:"right"},R5={class:"price"},O5={class:"price light"},P5={class:"form-note"},H5={style:{color:"#F04438","font-weight":"500"}},N5={class:"form-note form-note-tooltip"},K5={class:"dialog-footer is-border"},G5={key:0};function z5(e,t,a,l,n,i){const A=C("Badge"),p=C("el-option"),m=C("el-select"),_=C("el-form-item"),g=C("el-input"),y=C("el-checkbox"),v=C("el-col"),k=C("el-table-column"),b=C("el-input-number"),w=C("el-table"),B=C("DynamicIcon"),S=C("el-tooltip"),V=C("el-row"),F=C("el-form"),$=C("el-button");return r(),h("div",null,[n.refundNote?(r(),h("div",D5,[(r(!0),h(P,null,ae(n.refundNote,(U,D)=>(r(),h("div",{key:D,class:"fct-refund-note-item"},[o("span",T5,f(U.message),1),s(A,{status:U.status},null,8,["status"])]))),128))])):(r(),h("div",Q5,[s(F,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[s(V,{gutter:10},{default:u(()=>[s(v,{lg:24},{default:u(()=>[s(_,{label:e.$t("Refund with transaction"),required:""},{default:u(()=>[s(m,{modelValue:n.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=U=>n.refund.transaction_id=U),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:u(()=>[(r(!0),h(P,null,ae(n.refundableTransactions,U=>(r(),E(p,{key:U.id,label:i.translate("#%1$s - Paid %2$s",U.id,i.formatNumber(U.refundable,!0)),value:U.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),s(_,{label:e.$t("Select Item/s")},{default:u(()=>[s(m,{modelValue:n.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=U=>n.refund.item_ids=U),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:u(()=>[(r(!0),h(P,null,ae(a.order.order_items,U=>(r(),E(p,{key:U.id,value:U.id,label:U.post_title+" - "+(U.variation_display_title||U.title)+" "+i.formatNumber(U.line_total-U.refund_total),class:"refund-item",disabled:Number(U.line_total)-Number(U.refund_total)<=0},{default:u(()=>[o("div",M5,[o("p",null,[R(f(U.post_title)+" ",1),o("span",null,"-"+f(U.variation_display_title||U.title),1)]),o("div",L5,[o("span",R5,f(i.translate("Refundable: %1$s",i.formatNumber(U.line_total-U.refund_total))),1),o("span",O5,f(i.translate("Item price: %1$s",i.formatNumber(U.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),s(v,{lg:24},{default:u(()=>[s(_,{label:e.$t("Refund amount"),required:""},{default:u(()=>[s(g,{type:"number",min:1,max:n.maxRefundAmount,modelValue:n.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=U=>n.refund.amount=U),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:u(()=>[R(f(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",P5,[o("p",null,[R(f(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",H5,f(i.formatNumber(n.maxRefundAmount*100)),1)])])]),_:1},8,["label"]),i.isSubscriptionCancelable?(r(),E(v,{key:0,lg:24},{default:u(()=>[s(_,{label:e.$t("Subscription")},{default:u(()=>[s(y,{label:e.$t("Cancel Subscription (if any)"),modelValue:n.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=U=>n.refund.cancelSubscription=U)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):x("",!0),i.isAnyProductManageStock?(r(),E(v,{key:1,lg:24},{default:u(()=>[s(_,null,{default:u(()=>[s(y,{modelValue:n.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=U=>n.refund.manageStock=U)},{default:u(()=>[R(f(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):x("",!0),n.refund.manageStock?(r(),E(v,{key:2,lg:24},{default:u(()=>[s(w,{data:i.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:u(()=>[s(k,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:u(({row:U})=>[o("span",null,f(U.post_title)+" - "+f(U.title),1)]),_:1},8,["label"]),s(k,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:u(({row:U})=>[o("span",null,f(U.quantity),1)]),_:1},8,["label"]),s(k,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:u(({row:U})=>[s(b,{modelValue:U.restore_quantity,"onUpdate:modelValue":D=>U.restore_quantity=D,min:0,max:U.quantity},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})):x("",!0),s(v,{lg:24},{default:u(()=>[s(_,{label:e.$t("Reason of refund")},{default:u(()=>[s(g,{modelValue:n.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=U=>n.refund.reason=U)},null,8,["modelValue"]),o("div",N5,[o("p",null,[R(f(i.translate("Your customers can see this reason"))+" ",1),o("span",null,[s(S,{"popper-class":"fct-tooltip",placement:"top",content:i.translate("If set, possible values are duplicate fraudulent, and requested_by_customer If you believe the charge to be fraudulent, specifying fraudulent as the reason will add the associated card and email to your block lists")},{default:u(()=>[s(B,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",K5,[s($,{type:"primary",onClick:Ge(i.processRefund,["prevent"]),loading:n.refundProcessing,disabled:n.refund.amount<=0},{default:u(()=>[R(f(n.refundProcessing?i.translate("Processing"):i.translate("Refund"))+" ",1),n.refund.amount?(r(),h("span",G5)):x("",!0),R(f(i.formatNumber(n.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const j5=nt(V5,[["render",z5]]),q5={class:"fct-number-input"},Y5=["disabled","min","max"],W5={class:"fct-number-input-buttons"},J5=["disabled"],X5=["disabled"],Z5={style:{color:"red"}},of={__name:"NumberInput",props:{min:{type:Number,default:1},max:{type:Number,default:999999},item:{type:Object,default:()=>({})},isDisabled:{type:Boolean,default:!1}},setup(e,{emit:t}){var S,V,F,$,U;const a=t,l=e,n=M(""),i=()=>{var D,T,I,L;return(((D=l.item)==null?void 0:D.manage_stock)||((L=(I=(T=l.item)==null?void 0:T.variants)==null?void 0:I.product_detail)==null?void 0:L.manage_stock))==1},A=M(((S=l.item)==null?void 0:S.quantity)||l.min),p=M(A.value),m=M(i()?((V=l.item)==null?void 0:V.available)||(($=(F=l.item)==null?void 0:F.variants)==null?void 0:$.available):l.max),_=M(i()?(U=l.item)==null?void 0:U.updated_stock:l.max);aa().ctx;const g=G(()=>p.value<=l.min),y=G(()=>p.value>=_.value),v=()=>{n.value="",p.value<_.value&&(A.value++,p.value=A.value,a("update:value",A.value,_.value,l.item))},k=()=>{n.value="",p.value>l.min&&(A.value--,p.value=A.value,a("update:value",A.value,_.value,l.item))},b=(D,T)=>{n.value="",p.value=parseInt(p.value),(isNaN(p.value)||p.value==="")&&(A.value=1),p.value<l.min?(A.value=l.min,p.value=A.value):p.value>l.max?(A.value=l.min,p.value=A.value,n.value=d("Unable to adjust quantity")):p.value>_.value?(A.value=_.value,p.value=A.value,n.value=d("Available: %s in stock",_.value)):p.value>=l.min&&(p.value===_.value||p.value<_.value)&&(A.value=p.value,p.value=A.value),a("update:value",A.value,_.value,l.item)},w=D=>{D.key==="ArrowDown"&&p.value<=l.min&&D.preventDefault()},B=()=>{var D,T,I,L,O;n.value="",A.value=((D=l.item)==null?void 0:D.quantity)||l.min,p.value=A.value,m.value=i()?((T=l.item)==null?void 0:T.available)||((L=(I=l.item)==null?void 0:I.variants)==null?void 0:L.available):l.max,_.value=i()?(O=l.item)==null?void 0:O.updated_stock:l.max};return Hs(()=>{B()}),be(()=>l.item,D=>{B()},{deep:!0}),(D,T)=>(r(),h(P,null,[o("div",q5,[Jt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":T[0]||(T[0]=I=>p.value=I),type:"number",onInput:T[1]||(T[1]=I=>{b()}),min:e.min,max:e.max,onKeydown:w},null,40,Y5),[[Zc,p.value,void 0,{number:!0}]]),o("div",W5,[o("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[s(X,{name:"ChevronUp"})],8,J5),o("button",{onClick:k,class:"decrement-btn",disabled:g.value||e.isDisabled},[s(X,{name:"ChevronDown"})],8,X5)])]),o("span",Z5,f(n.value),1)],64))}},e6={name:"PaymentLink",components:{IconButton:tt,DynamicIcon:X,CopyToClipboard:Va,InfoFilled:dl},props:["order","order_id"],data(){return{fetchLink:!1,selectedMethod:"stripe",business_email:"",buyer_email:"",selectedTransaction:"0",use_vendor_checkout:!1,vendor_url:null,transactionIds:[],actionName:"copy",paymentUrl:"",paymentMethods:[{value:"stripe",label:"Stripe"},{value:"paypal",label:"PayPal"}]}},computed:{DynamicIcon(){return X},adminUrl(){return Ke.get("admin_url")}},mounted(){this.makeSelectableId(),this.generatePaymentUrl()},methods:{translate:d,updatePaymentLink(e){e?this.searchOldUrl():this.paymentUrl=this.order.custom_checkout_url},getPaymentLink(){this.fetchLink=!0,this.$get("orders/"+this.order_id+"/transactions/get_payment_link",{data:{method:this.selectedMethod,transaction:0,use_vendor_checkout:this.use_vendor_checkout,business_email:this.business_email,buyer_email:this.buyer_email}}).then(e=>{var t,a;this.vendor_url=(t=e==null?void 0:e.data)==null?void 0:t.redirect_to,this.paymentUrl=(a=e==null?void 0:e.data)==null?void 0:a.redirect_to,this.fetchLink=!1}).catch(e=>{this.handleError(e),this.fetchLink=!1,this.$emit("reload")})},makeSelectableId(){this.transactionIds=[],this.order.transactions.forEach(e=>{e.status!=="paid"&&this.transactionIds.push({label:e.id,value:e.id})})},searchOldUrl(){var t,a;this.selectedTransaction=this.transactionIds[this.transactionIds.length-1].value;const e=this.order.transactions.filter(l=>l.id==this.selectedTransaction&&l.payment_method==this.selectedMethod);this.paymentUrl=(a=(t=e[0])==null?void 0:t.meta)==null?void 0:a.payment_link},generatePaymentUrl(){this.paymentUrl=this.order.custom_checkout_url}}},t6=["element-loading-text"],a6={class:"fct-payment-link-block"},l6={key:1,class:"fct-payment-link-block"};function s6(e,t,a,l,n,i){const A=C("CopyToClipboard"),p=C("el-button"),m=C("el-input"),_=C("el-form-item"),g=C("el-col"),y=C("el-row"),v=Qa("loading");return Jt((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",a6,[n.paymentUrl?(r(),E(A,{key:0,text:n.paymentUrl,tooltipText:i.translate("Copy Link"),placeholder:i.translate("No payment link available,Please setup custom checkout page!")},null,8,["text","tooltipText","placeholder"])):(r(),E(p,{key:1,target:"_blank",link:"",tag:"router-link",to:{name:"pages_setup"}},{default:u(()=>[R(f(i.translate("Create a custom checkout page to generate custom links.")),1)]),_:1}))]),n.selectedMethod==="paypal"&&n.use_vendor_checkout?(r(),E(y,{key:0,class:"el-form--label-top",gutter:20},{default:u(()=>[s(g,{md:24,lg:11},{default:u(()=>[s(_,{label:i.translate("PayPal Business/Seller Email")},{default:u(()=>[s(m,{modelValue:n.business_email,"onUpdate:modelValue":t[0]||(t[0]=k=>n.business_email=k),placeholder:i.translate("Enter your PayPal business/seller email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),s(g,{md:24,lg:11},{default:u(()=>[s(_,{label:i.translate("PayPal Buyer Email (optional)")},{default:u(()=>[s(m,{modelValue:n.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=k=>n.buyer_email=k),placeholder:i.translate("Enter The buyer email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0),n.use_vendor_checkout?(r(),h("div",l6,[s(p,{type:"primary",onClick:i.getPaymentLink},{default:u(()=>[R(f(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):x("",!0)],8,t6)),[[v,n.fetchLink]])}const n6=nt(e6,[["render",s6]]),o6={class:"fct-single-order-loader-wrap fct-layout-width"},i6={class:"single-page-header fct-page-loader-header flex items-start justify-between"},r6={class:"single-page-body"},d6={class:"fct-single-order"},u6={class:"fct-single-order-main"},c6={class:"fct-single-order-aside"},A6={class:"fct-admin-sidebar"},p6={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton");return r(),h("div",o6,[o("div",i6,[s(n,{animated:"",class:"flex flex-col items-start gap-2"},{template:u(()=>[s(l,{class:"max-w-180"}),s(l,{class:"max-w-[100px]"})]),_:1}),s(n,{animated:"",class:"flex gap-2 max-w-180"},{template:u(()=>[s(l,{class:"w-1/4"}),s(l,{class:"w-3/4"})]),_:1})]),o("div",r6,[o("div",d6,[o("div",u6,[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:3})]),_:1})]),_:1}),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:3})]),_:1})]),_:1}),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:3})]),_:1})]),_:1}),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:3})]),_:1})]),_:1})]),o("div",c6,[o("div",A6,[s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:3})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},f6={name:"_Plans.vue",components:{Badge:Ht},props:["subscription","header","order","getOrderUrl"],data(){return{}},computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:d}},m6={class:"fct-subscription-plan-wrap"},h6={class:"fct-subs-status-wrap float-end"},_6={class:"fct-subs-title underline"},v6=["innerHTML"],g6={key:0,class:"cursor-pointer"};function y6(e,t,a,l,n,i){var m,_,g,y;const A=C("Badge"),p=C("router-link");return r(),h("div",m6,[o("div",h6,[s(A,{status:i.subscriptionStatus},null,8,["status"])]),s(p,{to:{name:"view_subscription",params:{subscription_id:(m=a.subscription)==null?void 0:m.id}}},{default:u(()=>{var v;return[o("p",_6,f(e.$t((v=a.subscription)==null?void 0:v.display_item_name)),1)]}),_:1},8,["to"]),o("p",{innerHTML:(_=a.subscription)==null?void 0:_.payment_info},null,8,v6),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",g6,[R(f(i.translate("Parent Order:"))+" ",1),o("a",{onClick:t[0]||(t[0]=v=>{var k;return a.getOrderUrl((k=a.order)==null?void 0:k.parent_id)})},"#"+f((y=a.order)==null?void 0:y.parent_id),1)])):x("",!0)])}const rf=nt(f6,[["render",y6]]),b6={name:"SubscriptionPlanItem",components:{CardContainer:xe,CardHeader:Ve,CardBody:Be,Plans:rf},props:["subscription","order","index","getOrderUrl"]};function w6(e,t,a,l,n,i){const A=C("CardHeader"),p=C("Plans"),m=C("CardBody"),_=C("CardContainer");return r(),E(_,null,{default:u(()=>[s(A,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},null,8,["title"]),s(m,null,{default:u(()=>[s(p,{getOrderUrl:a.getOrderUrl,subscription:a.subscription,order:a.order,header:e.$t("Subscription Plans #")+(a.index+1)},null,8,["getOrderUrl","subscription","order","header"])]),_:1})]),_:1})}const C6=nt(b6,[["render",w6]]),k6={name:"OrderBulkActions",components:{DynamicIcon:X},props:["order","trigger_action","isEditingItem","mode","triggerMode","shouldShowRefund","warningMessage"],emits:["reload","addItem","addProduct","enableItemEditing","disableItemEditing","handlePaymentActions"],data(){return{selected_action:"",showModal:!1,status_data:{order_status:this.order.status,shipping_status:this.order.shipping_status},doing_actions:!1,manage_stock:!0,shouldDisableEditing:["completed","archived","canceled"].includes(this.order.status),isCancelled:["canceled"].includes(this.order.status),isCompleted:["completed"].includes(this.order.status),isUnshippable:["unshippable"].includes(this.order.shipping_status)}},methods:{translate:d,handleCommandAction(e){if(this.selected_action=e,e==="shipping_status")this.changeShipping();else if(e==="delete_order")this.confirmDeleteOrder();else if(e==="order_complete")this.selected_action="order_status",this.completeOrder();else if(e==="order_cancel")this.selected_action="order_status",this.cancelOrder();else if(e==="order_processing")this.selected_action="order_status",this.backToProcessing();else if(e==="order_receipt")this.showModal=!1;else if(e==="generate_missing_licenses")this.generateMissingLicenses();else if(e==="refund_order")this.$emit("handlePaymentActions","refund");else if(e==="sync_order_statuses")this.syncOrderStatuses();else if(e.action==="order_edit")if(e.isEditingItem)this.$emit("disableItemEditing");else{if(this.shouldDisableEditing)return;this.$emit("enableItemEditing")}else this.showModal=!0},confirmDeleteOrder(){this.$confirm(d("Are you sure you want to delete this order? This action can not be undone!"),d("Confirm Deleting"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteOrder()})},deleteOrder(){this.deleting=!0,this.$del("orders/"+this.order.id).then(e=>{un(e.message),this.$router.replace({name:"orders"})}).catch(e=>{e.status_code=="422"?j.validationErrors(e):j.error(e==null?void 0:e.data)}).finally(()=>{this.deleting=!1})},changeShipping(){this.showModal=!0},completeOrder(){this.$confirm(d("Are you sure you want to complete this order!"),d("Please confirm"),{confirmButtonText:d("Yes, Mark order as complete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"completed"})})},generateMissingLicenses(){this.$confirm(d("Are you sure you want to generate missing licenses!"),d("Please confirm"),{confirmButtonText:d("Yes, Generate all missing licenses!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{this.generateLicenses()})},generateLicenses(){this.doing_actions=!0,this.$post("orders/"+this.order.id+"/generate-missing-licenses",{}).then(e=>{j.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},backToProcessing(){this.$confirm(d("Are you sure you want to revert back processing this order!"),d("Please confirm"),{confirmButtonText:d("Yes, Mark order as processing!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"processing"})})},cancelOrder(){this.$confirm(d("Are you sure you want to change the order status to Cancel? This action is irreversible and cannot be undone."),d("Please confirm"),{confirmButtonText:d("Yes, Changed status to Cancel"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{this.manage_stock=!0,this.updateOrderStatuses({order_status:"canceled"})})},changeShippingStatus(){let e={};this.manage_stock=!0,e[this.selected_action]=this.status_data[this.selected_action],this.updateOrderStatuses(e)},updateOrderStatuses(e){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/statuses",{action:"change_"+this.selected_action,statuses:e,manage_stock:this.manage_stock}).then(t=>{j.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?j.validationErrors(t):j.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},syncOrderStatuses(){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/sync-statuses").then(e=>{j.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},B6={class:"fct-order-bulk-action-modal"},x6={key:1,class:"more-btn"},S6={key:0},$6=["href"],F6={class:"dialog-footer"};function E6(e,t,a,l,n,i){const A=C("DynamicIcon"),p=C("el-button"),m=C("el-dropdown-item"),_=C("el-tooltip"),g=C("el-dropdown-menu"),y=C("el-dropdown"),v=C("el-option"),k=C("el-select"),b=C("el-form-item"),w=C("el-form"),B=C("el-dialog");return r(),h("div",B6,[s(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:u(()=>[s(g,null,{default:u(()=>{var S,V;return[a.trigger_action!=="add"?(r(),h("div",S6,[!n.isCancelled&&((S=a.order)==null?void 0:S.fulfillment_type)==="physical"?(r(),E(m,{key:0,command:"shipping_status"},{default:u(()=>[s(A,{name:"ShipmentStatus"}),R(" "+f(i.translate("Change Shipping Status")),1)]),_:1})):x("",!0),a.order.mode==="test"||n.isCancelled?(r(),E(m,{key:1,command:"delete_order",class:"item-destructive"},{default:u(()=>[s(A,{name:"Delete"}),R(" "+f(i.translate("Delete order")),1)]),_:1})):x("",!0),a.order.status==="processing"?(r(),E(m,{key:2,command:"order_complete"},{default:u(()=>[s(A,{name:"Check"}),R(" "+f(i.translate("Mark As Complete")),1)]),_:1})):x("",!0),n.isCancelled?x("",!0):(r(),E(m,{key:3,command:"order_cancel"},{default:u(()=>[s(A,{name:"Cross"}),R(" "+f(i.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(r(),E(m,{key:4,command:"order_processing"},{default:u(()=>[s(A,{name:"Refresh"}),R(" "+f(i.translate("Back to processing")),1)]),_:1})):x("",!0),!n.isCompleted&&!n.isCancelled?(r(),E(m,{key:5,command:"sync_order_statuses"},{default:u(()=>[s(A,{name:"Refresh"}),R(" "+f(i.translate("Sync Order Statuses")),1)]),_:1})):x("",!0),s(m,{command:"order_receipt",class:"item-link"},{default:u(()=>[o("a",{target:"_blank",href:a.order.receipt_url},[s(A,{name:"External"}),R(" "+f(i.translate("Receipt")),1)],8,$6)]),_:1}),(V=a.order)!=null&&V.has_missing_licenses?(r(),E(m,{key:6,command:"generate_missing_licenses"},{default:u(()=>[s(A,{name:"Files"}),R(" "+f(i.translate("Generate missing licenses")),1)]),_:1})):x("",!0),a.shouldShowRefund?(r(),E(m,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:u(()=>[s(A,{name:"Money"}),R(" "+f(i.translate("Refund")),1)]),_:1})):x("",!0),s(m,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:n.shouldDisableEditing},{default:u(()=>[s(A,{name:"Edit"}),a.isEditingItem?(r(),h(P,{key:1},[R(f(i.translate("Disable Editing")),1)],64)):(r(),h(P,{key:0},[n.shouldDisableEditing?(r(),E(_,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:u(()=>[R(f(a.warningMessage),1)]),default:u(()=>[R(" "+f(i.translate("Edit")),1)]),_:1})):(r(),h(P,{key:1},[R(f(i.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):x("",!0)]}),_:1})]),default:u(()=>[a.triggerMode==="button"?(r(),E(p,{key:0},{default:u(()=>[R(f(i.translate("More Action"))+" ",1),s(A,{name:"ChevronDown"})]),_:1})):(r(),h("span",x6,[s(A,{name:"More"})]))]),_:1},8,["onCommand"]),s(B,{modelValue:n.showModal,"onUpdate:modelValue":t[2]||(t[2]=S=>n.showModal=S),title:i.translate("Update Shipping Status")},{default:u(()=>[s(w,{data:n.status_data,"label-position":"top"},{default:u(()=>[n.selected_action==="shipping_status"||n.selected_action==="all"?(r(),E(b,{key:0,label:i.translate("Shipping Status")},{default:u(()=>[s(k,{modelValue:n.status_data.shipping_status,"onUpdate:modelValue":t[0]||(t[0]=S=>n.status_data.shipping_status=S),placeholder:i.translate("Select Shipping Status")},{default:u(()=>[(r(!0),h(P,null,ae(e.appVars.shipping_statuses,(S,V)=>(r(),E(v,{key:V,label:S,value:V},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]),o("span",F6,[s(p,{onClick:t[1]||(t[1]=S=>i.changeShippingStatus()),type:"primary"},{default:u(()=>[R(f(i.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const Ld=nt(k6,[["render",E6]]),U6={name:"Transaction",computed:{Str(){return Aa}},components:{ConvertedTime:Sa,ArrowDown:aA(Ls),Check:dA,Badge:Ht,DynamicIcon:X},props:["transactions","transaction","header","transaction_data","order_id","orderCurrency"],emits:["reload"],data(){return{visible:!1,doing_action:!1,disputeHandleModal:!1,disputeForm:{dispute_note:""},disputeTransaction:null,loadingDisputeAction:!1,syncing_transaction:null}},methods:{translate:d,getCardBrand:bA,translateNumber:la,handleDispute(e){this.disputeHandleModal=!0,this.disputeTransaction=e},handleDisputeSubmit(e){this.loadingDisputeAction=!0,this.$post("orders/"+this.order_id+"/transactions/"+this.disputeTransaction.id+"/accept-dispute",{dispute_note:this.disputeForm.dispute_note}).then(t=>{this.$notify.success(t.message),this.$emit("reload"),this.disputeHandleModal=!1}).catch(t=>{this.$notify.error(t.message)}).finally(()=>{this.disputeHandleModal=!1,this.loadingDisputeAction=!1})},hasDisputedTransaction(e){return e.some(t=>t.transaction_type=="dispute"&&t.status=="succeeded")},hasSyncableTransaction(e){return e.some(t=>t.transaction_type=="charge"&&t.status=="pending"&&t.vendor_charge_id)},syncTransaction(e){this.syncing_transaction||(this.syncing_transaction=e.id,this.$post("orders/"+this.order_id+"/transactions/"+e.id+"/sync").then(t=>{this.$notify.success(t.message),this.$emit("reload")}).catch(t=>{var a;this.$notify.error(((a=t==null?void 0:t.data)==null?void 0:a.message)||d("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},I6={key:0,class:"fct-transaction-details -mt-[1px]"},V6={class:"fct-table-wrap"},D6={class:"p-0 m-0 text-xs text-gray-500"},T6={key:0},Q6=["href"],M6={class:"flex items-center gap-2.5"},L6={key:0,class:"w-7"},R6=["title","src","alt"],O6={key:1,class:"capitalize"},P6={key:2},H6={class:"p-0 m-0 text-xs text-gray-500"},N6={key:1},K6={class:"text-sm"},G6={class:"text-sm text-gray-700"},z6={class:"text-sm flex gap-2"},j6=["href"];function q6(e,t,a,l,n,i){var S,V;const A=C("ConvertedTime"),p=C("el-table-column"),m=C("Badge"),_=C("el-tooltip"),g=C("el-button"),y=C("DynamicIcon"),v=C("el-table"),k=C("el-form-item"),b=C("el-input"),w=C("el-form"),B=C("el-dialog");return a.transactions.length>0?(r(),h("div",I6,[o("div",V6,[s(v,{data:a.transactions,class:"w-full"},{default:u(()=>[s(p,{label:i.translate("# Date"),width:"auto"},{default:u(F=>{var $,U;return[o("div",null,[o("p",D6,"#"+f(i.translateNumber(F.row.id)),1),s(A,{"date-time":((U=($=F.row)==null?void 0:$.meta)==null?void 0:U.settled_at)||F.row.created_at},null,8,["date-time"])])]}),_:1},8,["label"]),s(p,{label:i.translate("Gateway ID"),width:"160"},{default:u(F=>[F.row.vendor_charge_id==""?(r(),h("span",T6,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:F.row.url},f(F.row.vendor_charge_id),9,Q6))]),_:1},8,["label"]),s(p,{label:i.translate("Payment Method"),width:"140"},{default:u(F=>[o("div",M6,[i.getCardBrand(F.row.card_brand,F.row.payment_method_type)?(r(),h("div",L6,[o("img",{class:"w-full",title:F.row.payment_method,src:i.getCardBrand(F.row.card_brand,F.row.payment_method_type),alt:F.row.card_brand},null,8,R6)])):(r(),h("span",O6,f(F.row.payment_method_type),1)),F.row.card_last_4&&F.row.card_last_4!="0"?(r(),h("span",P6,f("..."+F.row.card_last_4),1)):x("",!0)])]),_:1},8,["label"]),s(p,{label:i.translate("Total"),width:"auto"},{default:u(F=>{var $,U;return[((U=($=F.row)==null?void 0:$.meta)==null?void 0:U.mor_vat_removed)>0?(r(),h(P,{key:0},[o("span",null,f(e.formatNumberForOrder(F.row.total-F.row.meta.mor_vat_removed,a.orderCurrency)),1),o("p",H6,f(i.translate("Tax reversed"))+": "+f(e.formatNumberForOrder(F.row.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),h("span",N6,f(e.formatNumberForOrder(F.row.total,a.orderCurrency)),1))]}),_:1},8,["label"]),s(p,{label:i.translate("Status"),width:"120"},{default:u(F=>{var $,U,D,T,I,L;return[F.row.transaction_type=="dispute"?(r(),E(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((U=($=F.row)==null?void 0:$.meta)==null?void 0:U.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>[s(m,{class:"m-2 b-red",status:"dispute"},{default:u(()=>t[3]||(t[3]=[R(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):x("",!0),(T=(D=F.row)==null?void 0:D.meta)!=null&&T.reason?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate((L=(I=F.row)==null?void 0:I.meta)==null?void 0:L.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>{var O,Q,H,K;return[((Q=(O=F.row)==null?void 0:O.meta)==null?void 0:Q.disputed)=="yes"&&((K=(H=F.row)==null?void 0:H.meta)==null?void 0:K.dispute_resolved)=="no"?(r(),E(m,{key:0,status:F.row.status},{default:u(()=>{var W;return[R(f(F.row.status)+" "+f((W=F==null?void 0:F.row)==null?void 0:W.transaction_type),1)]}),_:2},1032,["status"])):(r(),E(m,{key:1,status:F.row.status},{default:u(()=>[R(f(F.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(m,{key:2,status:F.row.status},{default:u(()=>[R(f(F.row.status),1)]),_:2},1032,["status"]))]}),_:1},8,["label"]),i.hasDisputedTransaction(a.transactions)||i.hasSyncableTransaction(a.transactions)?(r(),E(p,{key:0,label:i.translate("Actions"),width:"140"},{default:u(F=>[F.row.transaction_type=="dispute"&&F.row.status=="succeeded"?(r(),E(g,{key:0,type:"warning",size:"small",onClick:$=>i.handleDispute(F.row)},{default:u(()=>[R(f(i.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):x("",!0),F.row.transaction_type=="charge"&&F.row.status=="pending"&&F.row.vendor_charge_id?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",F.row.payment_method),"popper-class":"fct-tooltip"},{default:u(()=>[s(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",F.row.payment_method),loading:n.syncing_transaction===F.row.id,onClick:$=>i.syncTransaction(F.row)},{default:u(()=>[s(y,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]),s(B,{modelValue:n.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=F=>n.disputeHandleModal=F),title:"Handle Dispute #"+((V=(S=n.disputeTransaction)==null?void 0:S.meta)==null?void 0:V.dispute_id),width:"800px"},{footer:u(()=>{var F,$,U,D,T,I;return[o("a",{href:(F=n.disputeTransaction)==null?void 0:F.url,target:"_blank",class:"el-button el-button--warning is-link"},f(i.translate("See dispute on ")+(($=n.disputeTransaction)==null?void 0:$.payment_method)),9,j6),(D=(U=n.disputeTransaction)==null?void 0:U.meta)!=null&&D.is_charge_refundable?(r(),E(g,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:n.loadingDisputeAction},{default:u(()=>[R(f(i.translate("Refund customer")),1)]),_:1},8,["loading"])):x("",!0),(I=(T=n.disputeTransaction)==null?void 0:T.meta)!=null&&I.is_dispute_actionable?(r(),E(g,{key:1,type:"primary",onClick:i.handleDisputeSubmit,loading:n.loadingDisputeAction},{default:u(()=>[R(f(i.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):x("",!0)]}),default:u(()=>{var F,$,U,D,T,I;return[($=(F=n.disputeTransaction)==null?void 0:F.meta)!=null&&$.dispute_reason?(r(),E(k,{key:0},{default:u(()=>{var L,O;return[o("div",K6," Dispute Reason: "+f((O=(L=n.disputeTransaction)==null?void 0:L.meta)==null?void 0:O.dispute_reason),1)]}),_:1})):x("",!0),s(k,null,{default:u(()=>[o("div",G6,f(i.translate("You may either counter the dispute by providing evidence to prove that the cardholder is the legitimate purchaser, or you can accept this dispute immediately to refund the cardholder and close the dispute.")),1)]),_:1}),(D=(U=n.disputeTransaction)==null?void 0:U.meta)!=null&&D.is_dispute_actionable?(r(),E(w,{key:1,model:n.disputeForm,"label-position":"top"},{default:u(()=>[s(k,{label:i.translate("Note"),prop:"dispute_note"},{default:u(()=>[s(b,{modelValue:n.disputeForm.dispute_note,"onUpdate:modelValue":t[0]||(t[0]=L=>n.disputeForm.dispute_note=L),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):x("",!0),(I=(T=n.disputeTransaction)==null?void 0:T.meta)!=null&&I.is_charge_refundable?(r(),E(k,{key:2},{default:u(()=>[o("div",z6,[s(y,{class:"w-6 h-6",name:"Information"}),R(" "+f(i.translate("This dispute has refundable action, so you may refund the charge to the customer for a dispute resolution.")),1)])]),_:1})):x("",!0)]}),_:1},8,["modelValue","title"])])):x("",!0)}const Rd=nt(U6,[["render",q6]]),Od=(e,t,a=0)=>{let l=0,n=0;return t&&(e.manual_discount_total=0),e.order_items&&e.order_items.forEach((i,A)=>{let p=i.updateStock||0;i.quantity<1?i.quantity=1:p!=0&&parseInt(i.quantity)>p&&(i.quantity=p),i.total=i.unit_price*i.quantity;let m=i.unit_price*i.quantity;if(i.subtotal=m-(parseInt(i.cost)||0),e.manual_discount_total>0?i.discount_total=i.discount_total:t===!0?n+=i.discount_total:(!e.manual_discount_total===0?e.manual_discount_total-=i.discount_total:e.manual_discount_total=0,i.discount_total=0),i.line_total=m-i.discount_total,l+=m,i.payment_type=="subscription"&&i.other_info.manage_setup_fee=="yes"){let _=parseInt(i.other_info.signup_fee);i.other_info.setup_fee_per_item=="yes"&&(_=_*i.quantity),l+=_}}),e.subtotal=l,e.coupon_discount_total=n,(e.subtotal<=0||e.subtotal<=e.manual_discount_total)&&(e.manual_discount_total=e.coupon_discount_total=e.shipping_tax=e.shipping_total=e.tax_total=0),Y6(e),e},_c=(e,t)=>{if(t.value<0)return e;let a=t.value?Math.round(t.value*100):0;t.label="",t.type==="percentage"&&(a=e.subtotal*t.value/100),df(t),a=parseInt(a),a>=0&&a<=parseInt(e.subtotal)&&(e.manual_discount_total=a);let l=e.subtotal*1+e.tax_total*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total;return l>=0&&(e.total_amount=l),e},Y6=e=>(e.total_amount=e.subtotal*1+e.tax_total*1+e.shipping_tax*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total,e),df=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),W6={name:"NoteModal",props:["note"],data(){return{notes:this.note}},watch:{note:{handler:function(e,t){this.notes=e},deep:!0}},mounted(){},methods:{saveNote(){this.$emit("whenNoteEditIsDone",this.notes,!1)},closeModal(){this.$emit("closeModal")}}},J6={class:"fct-note-modal"},X6={class:"dialog-footer"};function Z6(e,t,a,l,n,i){const A=C("el-input"),p=C("el-form-item"),m=C("el-form"),_=C("el-button");return r(),h("div",J6,[s(m,{"label-position":"top"},{default:u(()=>[s(p,null,{default:u(()=>[s(A,{modelValue:n.notes,"onUpdate:modelValue":t[0]||(t[0]=g=>n.notes=g),autosize:{minRows:4},type:"textarea",minlength:"1",maxlength:"5000","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),o("div",X6,[s(_,{type:"info",soft:"",onClick:i.closeModal},{default:u(()=>[R(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),s(_,{type:"primary",onClick:i.saveNote},{default:u(()=>[R(f(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const uf=nt(W6,[["render",Z6]]),eI={class:"fct-admin-sidebar-item"},tI={class:"whitespace-pre-line"},aI={key:0},lI={name:"Notes",components:{IconButton:tt,NoteModal:uf,DynamicIcon:X},props:{note:{type:String,default:""},shouldEnableEditing:{type:Boolean,default:!0},orderId:{type:[String,Number]}},data(){return{noteModalIsOpen:!1,isNoteExpanded:!1,noteCopy:this.note,loading:!1}},computed:{noteNeedsCollapse(){var e;return((e=this.noteCopy)==null?void 0:e.length)>355},noteTextToDisplay(){return this.isNoteExpanded||!this.noteNeedsCollapse?this.noteCopy:this.noteCopy.substring(0,355)+"..."}},watch:{note:{handler(e,t){this.noteCopy=e},deep:!0,immediate:!0}},mounted(){},methods:{saveNoteModal(e,t){this.loading=!0,this.noteModalIsOpen=t,this.$emit("whenNoteEditIsDone",e),this.orderId&&this.$post("notes/attach",{order_id:this.orderId,note:e}).then(a=>{j.success(a.message),this.noteCopy=e}).catch(a=>{j.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},Vi=Object.assign(lI,{setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton"),i=C("el-button"),A=C("el-dialog");return r(),h("div",null,[e.orderId?(r(),E(xe,{key:0},{default:u(()=>[s(Ve,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:u(()=>[e.shouldEnableEditing?(r(),E(tt,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=p=>t.noteModalIsOpen=!0)},{default:u(()=>[s(X,{name:"Edit"})]),_:1})):x("",!0)]),_:1},8,["title"]),s(Be,{class:ue(t.noteNeedsCollapse?"pb-0":"")},{default:u(()=>[o("div",eI,[t.loading?(r(),E(n,{key:0,animated:""},{template:u(()=>[s(l,{variant:"p"})]),_:1})):(r(),h(P,{key:1},[o("span",tI,f(t.noteCopy?t.noteTextToDisplay:t.$t("No notes")),1),t.noteNeedsCollapse?(r(),E(i,{key:0,class:"fct-show-more-button",onClick:t.toggleNoteText,text:""},{default:u(()=>[t.isNoteExpanded?(r(),h(P,{key:0},[R(f(t.$t("Show less"))+" ",1),s(X,{name:"ChevronUp"})],64)):(r(),h(P,{key:1},[R(f(t.$t("Show more"))+" ",1),s(X,{name:"ChevronDown"})],64))]),_:1},8,["onClick"])):x("",!0)],64))])]),_:1},8,["class"])]),_:1})):x("",!0),s(A,{"append-to-body":!0,width:"45%",modelValue:t.noteModalIsOpen,"onUpdate:modelValue":a[2]||(a[2]=p=>t.noteModalIsOpen=p),title:t.noteCopy?t.$t("Edit Note"):t.$t("Add Note")},{default:u(()=>[t.noteModalIsOpen?(r(),h("div",aI,[s(uf,{note:t.noteCopy,onWhenNoteEditIsDone:t.saveNoteModal,onCloseModal:a[1]||(a[1]=p=>t.noteModalIsOpen=!1)},null,8,["note","onWhenNoteEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])])}}}),sI={name:"Coupon",components:{IconButton:tt,DynamicIcon:X},props:{order:{type:Object,default:()=>({})},appliedCouponsAttributes:{type:Array,default:()=>[]},hasCouponAttributes:{type:Boolean,default:!1},couponsAttributes:{type:Array,default:()=>[]},action:{type:String,default:""},shouldManageCoupon:{type:Boolean,default:!0}},data(){return{appliedCoupons:[...this.appliedCouponsAttributes],hasCoupon:this.hasCouponAttributes,availableCoupons:[],newCoupon:"",coupons:[...this.couponsAttributes]}},mounted(){},methods:{translate:d,searchCoupon(e,t){this.fetchCoupon(e,t)},fetchCoupon(e="",t=()=>{}){this.$get("coupons",{search:e,select:"code",scopes:["active"]}).then(a=>{var i;const l=(i=a.coupons)==null?void 0:i.data;this.availableCoupons=l.map(A=>A.code);const n=this.availableCoupons.filter(A=>A.toLowerCase().includes(e.toLowerCase())).map(A=>({value:A}));t(n)}).catch(a=>{var l;a.status_code=="422"?j.validationErrors(a):j.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},applyCoupon(){if(this.coupons&&this.coupons.find(e=>e.code===this.newCoupon)){j.error(this.translate("Coupon already applied"));return}this.$post("coupons/apply",{coupon_code:this.newCoupon,order_items:this.order.order_items,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons}).then(e=>{this.processCoupon(e),this.newCoupon=""}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)})},cancelCoupon(e,t){this.$post("coupons/cancel",{id:t.id,coupon_code:t.code,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons,order_items:this.order.order_items}).then(a=>{this.processCoupon(a)}).catch(a=>{var l;a.status_code=="422"?j.validationErrors(a):j.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},reApplyCoupon(){this.$post("coupons/re-apply",{order_items:this.order.order_items,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons}).then(e=>{this.processCoupon(e)}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},processCoupon(e){this.coupons=[],this.appliedCoupons=[];for(let n in e.applied_coupons)this.coupons.push({id:e.applied_coupons[n].id,code:n,amount:e.applied_coupons[n].discount}),this.appliedCoupons.push(e.applied_coupons[n].id);let t=0,a=0;const l=Object.values(e.calculated_items);this.order.order_items.forEach((n,i)=>{const A=l.find(p=>p.id==n.object_id||p.id==n.id);A!=null&&(this.order.order_items[i].price=A.price,this.order.order_items[i].unit_price=A.unit_price,this.order.order_items[i].line_total=A.unit_price*A.quantity-A.discount_total,t+=this.order.order_items[i].line_total,a+=A.discount_total,this.order.order_items[i].line_total_formatted=A.line_total_formatted,this.order.order_items[i].discount_total=A.discount_total,this.order.order_items[i].coupon_discount=A.coupon_discount||0,this.order.order_items[i].line_meta&&(this.order.order_items[i].line_meta.coupon_discount=A.coupon_discount||0))}),this.order.applied_coupon=e.applied_coupons,this.hasCoupon=this.coupons.length>0,Od(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},nI={colspan:"3"},oI={class:"fct-add-coupon-wrap"},iI={key:0,class:"fct-add-coupon-input-label"},rI={key:1,class:"fct-add-coupon-input-label"},dI={key:2,class:"fct-add-coupon-input-wrap"},uI={class:"flex gap-0.5 items-center"};function cI(e,t,a,l,n,i){const A=C("el-autocomplete"),p=C("el-button"),m=C("el-alert"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-popconfirm");return r(),h(P,null,[o("tr",null,[o("td",nI,[o("div",oI,[a.action==="create_order"?(r(),h("div",iI,f(e.$t("Have a Coupon?")),1)):(r(),h("div",rI,f(a.shouldManageCoupon?e.$t("Have a Coupon?"):n.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",dI,[s(A,{modelValue:n.newCoupon,"onUpdate:modelValue":t[0]||(t[0]=v=>n.newCoupon=v),"fetch-suggestions":i.searchCoupon,"trigger-on-focus":!1,clearable:"",class:"w-full",placeholder:e.$t("Enter coupon code")},null,8,["modelValue","fetch-suggestions","placeholder"]),s(p,{onClick:i.applyCoupon,type:"info",soft:"",class:"el-button--x-small"},{default:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["onClick"])])):x("",!0),!n.hasCoupon&&a.shouldManageCoupon?(r(),E(m,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):x("",!0),t[1]||(t[1]=o("span",null,null,-1))])])]),(r(!0),h(P,null,ae(n.coupons,v=>(r(),h("tr",{key:v.id,class:"fct-coupons-applied-row"},[o("td",null,[o("div",uI,[o("span",null,f(v.code),1),a.action==="create_order"?(r(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ge(k=>i.cancelCoupon(v.id,v),["prevent"]),class:"coupon-delete-btn"},{default:u(()=>[s(_,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),a.action==="edit_order"?(r(),E(y,{key:1,icon:"InfoFilled","icon-color":"#626AEF",title:i.translate("Are you sure to cancel this coupon? This action is not recoverable"),onConfirm:k=>i.cancelCoupon(v.id,v),width:"250"},{reference:u(()=>[a.shouldManageCoupon?(r(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",class:"coupon-delete-btn"},{default:u(()=>[s(_,{name:"Delete"})]),_:1})):x("",!0)]),_:2},1032,["title","onConfirm"])):x("",!0)])]),t[2]||(t[2]=o("td",null,null,-1)),o("td",null,"- "+f(e.formatNumberForOrder(v.amount,a.order)),1)]))),128))],64)}const Di=nt(sI,[["render",cI]]),AI={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=Ds({...e.discount}),l=M([{label:d("Amount"),value:"amount"}]),n=M("");return{discountOptions:l,applyDiscount:()=>{const m=parseInt(a.value);isNaN(m)||m<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{n.value="";const m=parseInt(a.value);let _=m||0;const g=e.totalAmount/100;return a.type=="percentage"?(_=g*m/100,(m>100||_>g)&&(n.value=d("Discount should not exceed the full product price (100%).")),isNaN(m)||m<1||m>100):(_>g&&(n.value=d("Discount should not exceed the full product price (%s).",Zm(g))),isNaN(m)||m<1||_>g)},error:n}}},pI={class:"fct-discount-modal"},fI=["innerHTML"],mI={key:1},hI={style:{color:"red"}},_I={class:"form-note"},vI={class:"dialog-footer"};function gI(e,t,a,l,n,i){const A=C("el-option"),p=C("el-select"),m=C("el-form-item"),_=C("el-col"),g=C("el-input"),y=C("el-row"),v=C("el-form"),k=C("el-button");return r(),h("div",pI,[s(v,{"label-position":"top"},{default:u(()=>[s(y,{gutter:20},{default:u(()=>[s(_,{md:12,sm:12,xs:24},{default:u(()=>[s(m,{label:e.$t("Discount type")},{default:u(()=>[s(p,{modelValue:l.initialDiscount.type,"onUpdate:modelValue":t[0]||(t[0]=b=>l.initialDiscount.type=b),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=b=>{l.error=""})},{default:u(()=>[(r(!0),h(P,null,ae(l.discountOptions,b=>(r(),E(A,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),s(_,{md:12,sm:12,xs:24},{default:u(()=>[s(m,{label:e.$t("Discount value")},{default:u(()=>[s(g,{type:"number",min:1,modelValue:l.initialDiscount.value,"onUpdate:modelValue":t[2]||(t[2]=b=>l.initialDiscount.value=b),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:u(()=>[l.initialDiscount.type==="amount"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,fI)):(r(),h("span",mI,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",hI,f(l.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),s(y,null,{default:u(()=>[s(_,{md:24,sm:12,xs:24},{default:u(()=>[s(m,{label:e.$t("Reason for discount")},{default:u(()=>[s(g,{modelValue:l.initialDiscount.reason,"onUpdate:modelValue":t[3]||(t[3]=b=>l.initialDiscount.reason=b),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),o("div",_I,[o("p",null,f(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",vI,[s(k,{type:"info",onClick:l.cancelDiscount,soft:""},{default:u(()=>[R(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),s(k,{type:"primary",disabled:l.isDisabledApplyButton(),onClick:l.applyDiscount},{default:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const yI=nt(AI,[["render",gI]]),bI={name:"CustomDiscount",components:{IconButton:tt,DynamicIcon:X,DiscountModal:yI},props:{order:{type:Object,default:()=>({})},discountAttributes:{type:Object,default:()=>({type:"amount",label:"",reason:""})},hasCoupon:{type:Boolean,default:!1},shouldEnableEditing:{type:Boolean,default:!0}},data(){return{discountModalIsOpen:!1,discount:this.discountAttributes}},mounted(){},methods:{translate:d,isOnlyProrateCredit(){const e=this.order.config&&this.order.config.prorate_credit||0;return e>0&&this.order.manual_discount_total-e<=0},getDiscountButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?this.isOnlyProrateCredit()?d("Prorate Credit"):d("Discount"):this.order.manual_discount_total!==0?d("Edit Discount"):d("Add Discount")},manageDiscount(){this.discount.action=parseInt(this.order.manual_discount_total)>0?"edit":"add",this.shouldEnableEditing&&!this.hasCoupon&&this.order.order_items.length>0&&(this.discountModalIsOpen=!0)},removeDiscount(){this.discount={},_c(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,_c(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},wI={key:0},CI={key:1},kI={key:2},BI={style:{"font-size":"12px",color:"rgb(107,114,128)"}},xI={style:{"padding-left":"16px"}},SI={style:{"font-size":"12px",color:"rgb(107,114,128)"}},$I={style:{"padding-left":"16px"}},FI={key:0};function EI(e,t,a,l,n,i){const A=C("DynamicIcon"),p=C("DiscountModal"),m=C("el-dialog");return r(),h(P,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),h("tr",wI,[o("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(_=>i.manageDiscount(),["prevent"]))},[R(f(i.getDiscountButtonLabel())+" ",1),s(A,{name:"External"})])):(r(),h("span",CI,f(i.getDiscountButtonLabel()),1)),n.discount.label?(r(),h("span",kI,f(n.discount.label),1)):x("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(P,{key:3},[t[4]||(t[4]=R(" | ",-1)),o("a",{href:"#",onClick:t[1]||(t[1]=Ge(_=>i.removeDiscount(),["prevent"]))},f(i.translate("Remove Discount")),1)],64)):x("",!0)]),o("td",null,f(n.discount.reason?n.discount.reason:"__"),1),o("td",null,[o("span",null,"- "+f(e.formatNumberForOrder(a.order.manual_discount_total,a.order)),1)])])):x("",!0),a.order.config&&a.order.config.prorate_credit>0&&a.order.manual_discount_total-a.order.config.prorate_credit>0?(r(),h(P,{key:1},[o("tr",BI,[o("td",xI,f(i.translate("Upgrade Discount")),1),t[5]||(t[5]=o("td",null,null,-1)),o("td",null,f(e.formatNumberForOrder(a.order.manual_discount_total-a.order.config.prorate_credit,a.order)),1)]),o("tr",SI,[o("td",$I,f(i.translate("Prorate Credit")),1),t[6]||(t[6]=o("td",null,null,-1)),o("td",null,f(e.formatNumberForOrder(a.order.config.prorate_credit,a.order)),1)])],64)):x("",!0),s(m,{"append-to-body":!0,width:"50%",modelValue:n.discountModalIsOpen,"onUpdate:modelValue":t[3]||(t[3]=_=>n.discountModalIsOpen=_),title:a.order.manual_discount_total===0?i.translate("Add discount"):i.translate("Edit discount")},{default:u(()=>[n.discountModalIsOpen?(r(),h("div",FI,[s(p,{discount:n.discount,totalAmount:a.order.subtotal,onWhenDiscountEditIsDone:i.applyDiscount,onEmitCancelDiscountModal:t[2]||(t[2]=_=>n.discountModalIsOpen=!1)},null,8,["discount","totalAmount","onWhenDiscountEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])],64)}const Ti=nt(bI,[["render",EI]]),UI={name:"ShippingModal",props:["shipping","shipping_type"],setup(e,{emit:t}){const a=M(e.shipping_type);return{availableOptions:M([{label:"Custom",value:"custom"}]),updatingIsDone:()=>parseInt(e.shipping.custom_price)<0?e.shipping.custom_price=0:(parseInt(e.shipping.custom_price)==0&&(e.shipping.custom_price=0),e.shipping.rate_name=e.shipping.rate_name==""||e.shipping.rate_name==null?"Custom":e.shipping.rate_name,e.shipping.type=a.value,t("whenShippingEditIsDone",!1)),removeShipping:()=>{e.shipping.type="",e.shipping.custom_price="",e.shipping.rate_name="",t("whenShippingEditIsDone",!1)},isDisabledApplyButton:()=>{const p=parseInt(e.shipping.custom_price);return isNaN(p)||p<0},shippingType:a}}},II={class:"fct-shipping-modal"},VI=["innerHTML"],DI={class:"dialog-footer"};function TI(e,t,a,l,n,i){const A=C("el-radio"),p=C("el-radio-group"),m=C("el-form-item"),_=C("el-col"),g=C("el-row"),y=C("el-input"),v=C("el-form"),k=C("el-button");return r(),h("div",II,[s(v,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[s(g,{gutter:20},{default:u(()=>[s(_,{md:24,sm:24,xs:24},{default:u(()=>[s(m,{label:e.$t(""),required:""},{default:u(()=>[s(p,{modelValue:l.shippingType,"onUpdate:modelValue":t[0]||(t[0]=b=>l.shippingType=b)},{default:u(()=>[(r(!0),h(P,null,ae(l.availableOptions,(b,w)=>(r(),E(A,{label:b.value,key:w},{default:u(()=>[R(f(b.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),l.shippingType==="custom"?(r(),E(g,{key:0,gutter:15},{default:u(()=>[s(_,{md:12,sm:12,xs:24},{default:u(()=>[s(m,{label:e.$t("Name")},{default:u(()=>[s(y,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=b=>a.shipping.rate_name=b)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),s(_,{md:12,sm:12,xs:24},{default:u(()=>[s(m,{label:e.$t("Price")},{default:u(()=>[s(y,{type:"number",min:1,modelValue:a.shipping.custom_price,"onUpdate:modelValue":t[2]||(t[2]=b=>a.shipping.custom_price=b),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,VI)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0)]),_:1}),o("div",DI,[a.shipping.type?(r(),E(k,{key:0,type:"danger",onClick:l.removeShipping},{default:u(()=>[R(f(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):x("",!0),s(k,{type:"primary",onClick:l.updatingIsDone,disabled:l.isDisabledApplyButton()},{default:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const QI=nt(UI,[["render",TI]]),MI={name:"Shipping",components:{IconButton:tt,DynamicIcon:X,ShippingModal:QI},props:{order:{type:Object,default:()=>({})},shippingAttributes:{type:Object,default:()=>({id:""})},shouldEnableEditing:{type:Boolean,default:!0},shippingMethodsProps:{type:Array,default:()=>[]},otherShippingMethodsProps:{type:Array,default:()=>[]}},data(){return{shippingModalIsOpen:!1,shipping:this.shippingAttributes,shippingMethods:this.shippingMethodsProps,otherShippingMethods:this.otherShippingMethodsProps,total_shipping:this.order.shipping_total/100}},computed:{currency(){const e=Ke.get("currency_signs",{}),t=Ke.get("shop.currency_sign","$");return this.order&&this.order.currency&&e[this.order.currency]?e[this.order.currency]:t},shippingTitle(){return this.getShippingTitle()}},watch:{shippingMethodsProps:{handler:function(e,t){this.shippingMethods=e},deep:!0},otherShippingMethodsProps:{handler:function(e,t){this.otherShippingMethods=e},deep:!0},order:{handler:function(e,t){this.total_shipping=e.shipping_total/100},deep:!0}},mounted(){},methods:{translate:d,showShippingModal(){this.shippingModalIsOpen=!0},hasFreeShipping(){return Object.keys(this.shipping).length>0&&parseInt(this.shipping.custom_price)==0},getShippingButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?d("Shipping"):this.shipping.id!==0?d("Edit Shipping"):d("Add Shipping")},getShippingTitle(){const e=this.order&&this.order.checkout_shipping&&this.order.checkout_shipping.method_title?this.order.checkout_shipping.method_title:"";if(!this.shipping.id)return e;const t=this.shipping.id,l=this.shippingMethods.concat(this.otherShippingMethods).find(function(n){return n.id==t});return l?l.title:e},updateShipping(){this.shippingModalIsOpen=!1;const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),ce.post("orders/calculate-shipping",{shipping_id:this.shipping.id,order_items:e}).then(t=>{this.order.shipping_total=t.shipping_charge;const a={order_items:t.order_items,shipping_total:t.shipping_charge};this.total_shipping=this.order.shipping_total/100,this.$emit("update:shipping",a.order_items,a.shipping_total,this.shipping)}).catch(t=>{var a;t.status_code=="422"?j.validationErrors(t):j.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.shippingModalIsOpen=!1})},getShippingMethodsNotFoundMessage(){const e=this.$router.resolve({name:"shipping"}).href;return d("No shipping methods found. You can add shipping methods from %1$s here %2$s",`<a href="${e}" target="_blank" class="link-text">`,"</a>")}}},LI={key:1},RI={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},OI={key:0},PI={key:1,class:"max-w-[120px] block ml-auto text-right"},HI={key:2},NI={key:0},KI={key:0,class:"fct-shipping-methods-list-wrap"},GI={key:0,class:"charge"},zI={key:1,class:"fct-other-shipping-methods-list-wrap"},jI={key:0,class:"charge"},qI={key:1,class:"fct-no-shipping-methods-found"},YI=["innerHTML"];function WI(e,t,a,l,n,i){const A=C("DynamicIcon"),p=C("el-input"),m=C("el-radio"),_=C("el-radio-group"),g=C("el-button"),y=C("el-dialog");return r(),h(P,null,[o("tr",null,[o("td",null,[a.shouldEnableEditing&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(v=>i.showShippingModal(),["prevent"]))},[R(f(i.getShippingButtonLabel())+" ",1),s(A,{name:"External"})])):(r(),h("span",LI,f(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),h("div",RI,f(i.shippingTitle),1)):x("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),h("span",OI,[o("del",null,f(e.formatNumberForOrder(a.order.shipping_total,a.order)),1),R(" "+f(i.translate("Free")),1)])):x("",!0),a.shouldEnableEditing&&!i.hasFreeShipping()?(r(),h("span",PI,[s(p,{modelValue:n.total_shipping,"onUpdate:modelValue":t[1]||(t[1]=v=>n.total_shipping=v),onChange:t[2]||(t[2]=v=>{a.order.shipping_total=v*100}),type:"number"},{prefix:u(()=>[R(f(i.currency),1)]),_:1},8,["modelValue"])])):(r(),h("span",HI,f(e.formatNumberForOrder(a.order.shipping_total-(a.order.tax_summary&&a.order.tax_summary.rcShippingAdjustment?a.order.tax_summary.rcShippingAdjustment:0),a.order)),1))])]),s(y,{"append-to-body":!0,width:"50%",modelValue:n.shippingModalIsOpen,"onUpdate:modelValue":t[6]||(t[6]=v=>n.shippingModalIsOpen=v),title:e.$t("Shipping and delivery options")},sa({default:u(()=>[n.shippingModalIsOpen?(r(),h("div",NI,[n.shippingMethods.length||n.otherShippingMethods.length?(r(),h(P,{key:0},[n.shippingMethods.length?(r(),h("div",KI,[o("h3",null,f(i.translate("Shipping Methods")),1),s(_,{modelValue:n.shipping.id,"onUpdate:modelValue":t[3]||(t[3]=v=>n.shipping.id=v),class:"fct-shipping-methods-radio"},{default:u(()=>[(r(!0),h(P,null,ae(n.shippingMethods,(v,k)=>(r(),E(m,{label:v.id,key:k},{default:u(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",GI,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0),n.otherShippingMethods.length?(r(),h("div",zI,[o("h3",null,f(i.translate("Other Shipping Methods")),1),s(_,{modelValue:n.shipping.id,"onUpdate:modelValue":t[4]||(t[4]=v=>n.shipping.id=v),class:"fct-shipping-methods-radio"},{default:u(()=>[(r(!0),h(P,null,ae(n.otherShippingMethods,(v,k)=>(r(),E(m,{label:v.id,key:k},{default:u(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",jI,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0)],64)):(r(),h("div",qI,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,YI)]))])):x("",!0)]),_:2},[n.shippingMethods.length||n.otherShippingMethods.length?{name:"footer",fn:u(()=>[s(g,{onClick:t[5]||(t[5]=v=>n.shippingModalIsOpen=!1)},{default:u(()=>[R(f(i.translate("Cancel")),1)]),_:1}),s(g,{type:"primary",onClick:i.updateShipping},{default:u(()=>[R(f(i.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const Pd=nt(MI,[["render",WI]]),JI={key:0},XI={class:"fct-admin-sidebar-item"},ZI={class:"fct-admin-summary-item-list"},eV={class:"fct-admin-summary-item"},tV={class:"font-medium"},aV={key:0,class:"fct-admin-summary-item"},lV={class:"font-medium"},sV={key:1,class:"fct-admin-summary-item"},nV={class:"font-medium"},oV={key:2,class:"fct-admin-summary-item"},iV={class:"font-medium"},rV={key:3,class:"fct-admin-summary-item"},dV={class:"font-medium"},uV={key:4,class:"fct-admin-summary-item"},cV={class:"font-medium"},AV={key:5,class:"fct-admin-summary-item"},pV={class:"font-medium"},fV={class:"font-medium"},mV={name:"UtmDetails",props:{order_operation:{type:Object}},computed:{metaItems(){const e=this.order_operation&&this.order_operation.meta;if(!e||typeof e!="object")return[];const t={gclid:d("Google Click ID (gclid)"),gbraid:d("Google iOS Web Click ID (gbraid)"),wbraid:d("Google iOS App Click ID (wbraid)"),gad_campaignid:d("Google Ads Campaign ID"),gad_source:d("Google Ads Source"),msclkid:d("Microsoft Click ID (msclkid)"),fbclid:d("Facebook Click ID (fbclid)")};return Object.keys(e).filter(a=>e[a]!==""&&e[a]!==null&&e[a]!==void 0).map(a=>({key:a,label:t[a]||a,value:e[a]}))}}},cf=Object.assign(mV,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",JI,[s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[o("div",XI,[o("ul",ZI,[o("li",eV,[o("span",tV,f(t.$t("UTM Campaign")),1),o("span",null,f(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",aV,[o("span",lV,f(t.$t("UTM Medium")),1),o("span",null,f(e.order_operation.utm_medium||"--"),1)])):x("",!0),e.order_operation.utm_source?(r(),h("li",sV,[o("span",nV,f(t.$t("UTM Source")),1),o("span",null,f(e.order_operation.utm_source||"--"),1)])):x("",!0),e.order_operation.utm_content?(r(),h("li",oV,[o("span",iV,f(t.$t("UTM Content")),1),o("span",null,f(e.order_operation.utm_content||"--"),1)])):x("",!0),e.order_operation.utm_id?(r(),h("li",rV,[o("span",dV,f(t.$t("UTM ID")),1),o("span",null,f(e.order_operation.utm_id||"--"),1)])):x("",!0),e.order_operation.utm_term?(r(),h("li",uV,[o("span",cV,f(t.$t("UTM Term")),1),o("span",null,f(e.order_operation.utm_term||"--"),1)])):x("",!0),e.order_operation.refer_url?(r(),h("li",AV,[o("span",pV,f(t.$t("Refer Url")),1),o("span",null,f(e.order_operation.refer_url||"--"),1)])):x("",!0),(r(!0),h(P,null,ae(t.metaItems,l=>(r(),h("li",{key:l.key,class:"fct-admin-summary-item"},[o("span",fV,f(l.label),1),o("span",null,f(l.value),1)]))),128))])])]),_:1})]),_:1})])):x("",!0)}}),hV={name:"TaxBreakdownBox",components:{InfoFilled:dl},props:{taxSummary:{type:Object,required:!0},order:{type:Object,required:!0},taxBreakdownShouldShow:{type:Boolean,default:!1}},methods:{translate:d,formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)}}},_V={class:"fct-tax-sum-box"},vV={class:"fct-tax-sum-row fct-tax-breakdown-heading"},gV={class:"fct-tax-sum-row fct-tax-breakdown-col-headers"},yV={class:"fct-tax-breakdown-col-rate"},bV={class:"fct-tax-breakdown-col-base"},wV={class:"fct-tax-breakdown-col-tax"},CV={class:"fct-tax-breakdown-col-rate"},kV={class:"fct-tax-breakdown-col-base"},BV={class:"fct-tax-breakdown-col-tax"},xV={key:0,class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider fct-tax-sum-row--reversed"},SV={key:0},$V={key:1},FV={class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider"},EV={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},UV={key:1,class:"fct-tax-sum-row fct-tax-sum-row--divider"},IV={key:1,class:"fct-tax-sum-row fct-tax-sum-row--muted"},VV={key:2,class:"fct-tax-sum-row"},DV={key:5,class:"fct-tax-sum-row total-pay total-payable-tax-row"},TV={key:6,class:"fct-tax-sum-row fct-tax-sum-row--muted"},QV={key:2,class:"fct-tax-sum-row"},MV={class:"fct-tax-amount fct-tax-amount--reversed"},LV={key:3,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},RV={key:4,class:"fct-tax-sum-row fct-tax-sum-row--reversed"};function OV(e,t,a,l,n,i){const A=C("InfoFilled"),p=C("el-icon");return r(),h("div",_V,[a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length?(r(),h(P,{key:0},[o("div",vV,[o("span",null,f(i.translate("Tax breakdown by rate")),1),s(p,{class:"fct-tax-breakdown-info"},{default:u(()=>[s(A)]),_:1})]),o("div",gV,[o("span",yV,f(i.translate("Rate")),1),o("span",bV,f(i.translate("Taxable base")),1),o("span",wV,f(i.translate("Tax")),1)]),(r(!0),h(P,null,ae(a.taxSummary.foldedRateLines,(m,_)=>(r(),h("div",{key:"folded-rate-"+_,class:ue(["fct-tax-sum-row fct-tax-breakdown-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",CV,f(m.label),1),o("span",kV,f(i.formatNumber(m.base)),1),o("span",BV,f(i.formatNumber(m.tax)),1)],2))),128)),a.order.is_reverse_charge_tax_order?(r(),h("div",xV,[o("span",null,f(i.translate("VAT reversed")),1),a.taxSummary.reversedTaxTotal>0?(r(),h("span",SV,f(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)):(r(),h("span",$V,f(i.translate("Charge reversed")),1))])):(r(),h(P,{key:1},[o("div",FV,[o("span",null,f(i.translate("Total tax")),1),o("span",null,f(i.formatNumber(a.taxSummary.totalOrderTax)),1)]),a.taxSummary.includedInPrices>0?(r(),h("div",EV,[o("span",null,f(i.translate("of which included in prices")),1),o("span",null,f(i.formatNumber(a.taxSummary.includedInPrices)),1)])):x("",!0),a.taxSummary.payableTax>0&&a.taxSummary.includedInPrices>0?(r(),h("div",UV,[o("span",null,f(i.translate("Payable now (added)")),1),o("span",null,f(i.formatNumber(a.taxSummary.payableTax)),1)])):x("",!0)],64))],64)):a.order.is_reverse_charge_tax_order?x("",!0):(r(),h(P,{key:1},[a.taxSummary.taxRateLines.length&&a.taxBreakdownShouldShow?(r(!0),h(P,{key:0},ae(a.taxSummary.taxRateLines,m=>(r(),h("div",{key:"tax-rate-line-"+m.rate_id+"-"+m.label,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.label),1),o("span",null,f(i.formatNumber(m.order_tax)),1)],2))),128)):x("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.inclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",IV,[o("span",null,f(i.translate("Included in item prices")),1),o("span",null,f(i.formatNumber(a.taxSummary.inclusiveTax)),1)])):x("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.exclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",VV,[o("span",null,f(i.translate("Added on products")),1),o("span",null,f(i.formatNumber(a.taxSummary.exclusiveTax)),1)])):x("",!0),a.taxSummary.feeTaxLineRows&&a.taxSummary.feeTaxLineRows.length&&a.taxBreakdownShouldShow?(r(!0),h(P,{key:3},ae(a.taxSummary.feeTaxLineRows,(m,_)=>(r(),h("div",{key:_,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.display_label),1),o("span",null,f(i.formatNumber(m.tax_amount)),1)],2))),128)):x("",!0),a.taxSummary.shippingTax>0&&a.taxBreakdownShouldShow?(r(),h(P,{key:4},[a.taxSummary.shippingTaxLines&&a.taxSummary.shippingTaxLines.length?(r(!0),h(P,{key:0},ae(a.taxSummary.shippingTaxLines,m=>(r(),h("div",{key:m.label,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(m.label),1),o("span",null,f(i.formatNumber(m.shipping_tax)),1)],2))),128)):(r(),h("div",{key:1,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(a.taxSummary.isShippingInclusive?i.translate("Included in shipping prices"):i.translate("Added on shipping")),1),o("span",null,f(i.formatNumber(a.taxSummary.shippingTax)),1)],2))],64)):x("",!0),a.taxSummary.payableTax>0?(r(),h("div",DV,[o("span",null,f(i.translate("Total payable tax")),1),o("span",null,f(i.formatNumber(a.taxSummary.payableTax)),1)])):x("",!0),a.taxSummary.inclusiveTax>0||a.taxSummary.inclusiveFeeTax>0?(r(),h("div",TV,[o("span",null,f(i.translate("Total tax in this order")),1),o("span",null,f(i.formatNumber(a.taxSummary.totalOrderTax)),1)])):x("",!0)],64)),a.order.is_reverse_charge_tax_order&&a.taxSummary.showRcShippingRow&&a.taxSummary.reversedShippingTax>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),h("div",QV,[o("span",null,f(i.translate("Added on shipping")),1),o("span",MV,f(i.formatNumber(a.taxSummary.reversedShippingTax)),1)])):x("",!0),a.order.is_reverse_charge_tax_order&&a.taxSummary.reversedTaxTotal>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),h("div",LV,[o("span",null,f(i.translate("Tax reversed")),1),o("span",null,f(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)])):x("",!0),a.order.is_reverse_charge_tax_order&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)&&!(a.taxSummary.reversedTaxTotal>0)&&!(a.taxSummary.showRcShippingRow&&a.taxSummary.reversedShippingTax>0)?(r(),h("div",RV,[o("span",null,f(i.translate("VAT reversed")),1),o("span",null,f(i.translate("Charge reversed")),1)])):x("",!0)])}const Jr=nt(hV,[["render",OV]]),PV={name:"Transaction",components:{ConvertedTime:Sa,Badge:Ht,DynamicIcon:X},props:{transactions:{type:Array,required:!0},order_id:{type:Number,required:!0},orderCurrency:{type:String,default:null}},emits:["reload"],data(){return{syncing_transaction:null}},computed:{Str(){return Aa}},methods:{translate:d,getCardBrand:bA,syncTransaction(e){this.syncing_transaction||(this.syncing_transaction=e.id,this.$post("orders/"+this.order_id+"/transactions/"+e.id+"/sync").then(t=>{this.$notify.success(t.message),this.$emit("reload")}).catch(t=>{var a;this.$notify.error(((a=t==null?void 0:t.data)==null?void 0:a.message)||d("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},HV={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},NV={class:"fct-table-mobile-header"},KV={class:"fct-table-mobile-header-left"},GV={class:"fct-table-status-col"},zV={class:"fct-table-date-col"},jV={class:"id"},qV={class:"fct-table-price-col"},YV={class:"p-0 m-0 text-xs text-gray-500"},WV={class:"fct-table-mobile-body"},JV={class:"fct-table-mobile-body-list"},XV={class:"fct-table-mobile-method-col"},ZV={class:"label"},eD={class:"value"},tD={class:"flex items-center gap-2.5"},aD={key:0,class:"w-7"},lD=["title","src","alt"],sD={key:1,class:"capitalize"},nD={key:2},oD={class:"fct-table-mobile-gateway-col"},iD={class:"label"},rD={class:"value"},dD={key:0},uD=["href"];function cD(e,t,a,l,n,i){const A=C("Badge"),p=C("el-tooltip"),m=C("ConvertedTime"),_=C("DynamicIcon"),g=C("el-button");return r(),h("div",HV,[(r(!0),h(P,null,ae(a.transactions,(y,v)=>{var k,b,w,B;return r(),h("div",{class:"fct-table-mobile-row",key:v},[o("div",NV,[o("div",KV,[o("div",GV,[(k=y==null?void 0:y.meta)!=null&&k.reason?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate((b=y==null?void 0:y.meta)==null?void 0:b.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>{var S,V;return[((S=y==null?void 0:y.meta)==null?void 0:S.disputed)==="yes"&&((V=y==null?void 0:y.meta)==null?void 0:V.dispute_resolved)==="no"?(r(),E(A,{key:0,status:y.status},{default:u(()=>[R(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"])):(r(),E(A,{key:1,status:y.status},{default:u(()=>[R(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(A,{key:1,status:y.status},{default:u(()=>[R(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]),o("div",zV,[o("span",jV,"#"+f(y.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),s(m,{"date-time":((w=y==null?void 0:y.meta)==null?void 0:w.settled_at)||y.created_at},null,8,["date-time"])])]),o("div",qV,[((B=y==null?void 0:y.meta)==null?void 0:B.mor_vat_removed)>0?(r(),h(P,{key:0},[R(f(e.formatNumberForOrder(y.total-y.meta.mor_vat_removed,a.orderCurrency))+" ",1),o("p",YV,f(i.translate("Tax reversed"))+": "+f(e.formatNumberForOrder(y.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),h(P,{key:1},[R(f(e.formatNumberForOrder(y.total,a.orderCurrency)),1)],64))]),y.transaction_type=="charge"&&y.status=="pending"&&y.vendor_charge_id?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",y.payment_method),"popper-class":"fct-tooltip"},{default:u(()=>[s(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",y.payment_method),loading:n.syncing_transaction===y.id,onClick:S=>i.syncTransaction(y)},{default:u(()=>[s(_,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):x("",!0)]),o("div",WV,[o("ul",JV,[o("li",XV,[o("div",ZV,f(i.translate("Payment Method:")),1),o("div",eD,[o("div",tD,[i.getCardBrand(y.card_brand,y.payment_method_type)?(r(),h("div",aD,[o("img",{class:"w-full",title:y.payment_method,src:i.getCardBrand(y.card_brand,y.payment_method_type),alt:y.card_brand},null,8,lD)])):(r(),h("span",sD,f(y.payment_method_type),1)),y.card_last_4&&y.card_last_4!="0"?(r(),h("span",nD,f("..."+y.card_last_4),1)):x("",!0)])])]),o("li",oD,[o("div",iD,f(i.translate("Gateway ID:")),1),o("div",rD,[y.vendor_charge_id===""?(r(),h("span",dD,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:y.url},f(y.vendor_charge_id),9,uD))])])])])])}),128))])}const Af=nt(PV,[["render",cD]]),AD={key:1,class:"fct-single-order-page"},pD={key:1,class:"fct-single-order-wrapper fct-layout-width"},fD={class:"single-page-header flex items-start justify-between"},mD={class:"single-page-header-title-wrap"},hD={key:1},_D={key:2},vD={class:"single-page-header-status-wrap"},gD={class:"single-page-header-text"},yD={class:"capitalize"},bD={class:"fct-btn-group sm"},wD={class:"single-page-body"},CD={class:"fct-single-order"},kD={class:"fct-single-order-main"},BD={class:"fct-card-header-title is-small"},xD={key:0,class:"fct-browse-product-form-group pb-5"},SD={class:"fct-ordered-product-list-container"},$D={key:0,class:"fct-ordered-product-list-wrapper"},FD={class:"fct-media-content-list -mt-4 w-full"},ED={class:"align-top"},UD=["rowspan"],ID={class:"product-thumbnail w-[46px] flex-shrink-0"},VD=["href"],DD=["src","alt"],TD=["src","alt"],QD={class:""},MD={class:"product-details-content-row"},LD={class:"product-details-content-first flex flex-col"},RD={class:"product-title m-0"},OD=["href"],PD={key:0,class:"product-variation-title m-0"},HD={key:2,class:"product-subscription-info"},ND=["innerHTML"],KD=["innerHTML"],GD={key:0,class:"product-details-quantity"},zD={key:1,class:"product-details-price-mobile"},jD={class:"product-details-quantity"},qD={key:0,class:"del"},YD={class:"product-details-price-mobile"},WD={key:0,class:"del"},JD={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},XD={key:0,class:"del"},ZD={class:"fct-order-item-qty-col text-right whitespace-nowrap"},e9={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},t9={class:"product-details-quantity"},a9={key:0,class:"del"},l9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},s9={class:"fct-order-item-price-col text-right whitespace-nowrap"},n9={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},o9={key:0,class:"flex items-center"},i9={class:"del line-through text-xs font-normal opacity-60 leading-tight"},r9={colspan:"2",class:""},d9={class:"fct-tax-badge"},u9={class:"text-right"},c9={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},A9={class:"pb-2"},p9={key:1},f9={colspan:"2",class:""},m9={class:"text-xs text-system-mid dark:text-gray-300"},h9={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},_9={colspan:"2",class:"pb-2"},v9={class:"fct-tax-badge"},g9={class:"text-right pb-2"},y9={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},b9={class:"pb-2"},w9={key:3},C9={colspan:"3"},k9={class:"product-details-action-row"},B9=["onClick"],x9=["onClick"],S9={key:1,class:"m-0 text-center"},$9={class:"fct-card-header-title is-small"},F9={class:"fct-table-border fct-table-order-details"},E9={key:0},U9={key:3},I9={key:4},V9={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},D9={key:5},T9={colspan:"3",class:"fct-tax-summary-cell"},Q9={key:0,class:"fct-tax-simple-line",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},M9={style:{display:"flex","align-items":"center",gap:"6px"}},L9={href:"javascript:void(0)",class:"fct-tax-see-details"},R9={class:"total-amount-tr"},O9={class:"payment-tr"},P9={key:6,class:"payment-tr"},H9={key:7,class:"payment-tr"},N9={class:"font-semibold"},K9={key:8,class:"payment-tr"},G9={class:"font-semibold"},z9={key:9,class:"payment-tr total-refund-owed-tr"},j9={class:"flex flex-end m-0 items-center"},q9={class:"font-semibold"},Y9={class:"fct-single-order-aside"},W9={class:"fct-admin-sidebar"},J9={key:0},X9={class:"fct-adjust-quantity-modal-content"},Z9={class:"title"},eT={class:"fct-form-group"},tT={class:"dialog-footer"},aT={key:0},lT={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:Ld,Alert:ol,Transaction:Rd,Plans:rf,Badge:Ht,Refresh:uA,ElMessageBox:Ul,CopyToClipboard:Va,Notes:Vi,Coupon:Di,CustomDiscount:Ti,OrderCustomerInformation:mi,ShippingComponent:Pd,UtmDetails:cf,TaxBreakdownBox:Jr,OrderUpDownIndicator:hA,TransactionMobile:Af,BundleProducts:Oo,Promotion:Yd},provide(){return{triggerChange:this.triggerChange}},data(){return{notFound:{show:!1,message:"",buttonText:"",route:""},warningMessage:"",loading:!1,calculating:!1,customModal:!1,processing_refund:!1,nextInvoiceModal:!1,cartItems:{},discount:{},shippingSettings:{},customItem:{item_name:"",item_price:0,quantity:1,is_physical:"yes"},transactionMedium:!1,otherData:{payment_method:"offline_payment",mark_paid_note:"",vendor_charge_id:""},paymentMethodOption:[{name:"Others",value:"others"}],timeout:"",widgets:[],order:!1,searching:!1,orderSettings:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],deletedItems:[],searchQuery:"",actionableActivities:[],isSubscription:!1,subscriptionStatus:"",showManageActivity:!1,change_order_infos:!1,change_payment_infos:!1,changes_made:0,createProductModal:!1,showRefundModal:!1,isEditingItem:!1,shouldDisableEditing:!1,adjustQuantityModal:!1,adjustItem:[],selectedLabels:[],tmpAdjustedItem:{},coupons:[],appliedCoupons:[],hasCoupon:!1,shippingMethods:[],otherShippingMethods:[],uniqueItemsCount:0,markingOrderAsPaid:!1,sendingPaymentReminder:!1,canSendPaymentReminderFlag:!1,isMobile:window.innerWidth<768}},watch:{order:{handler(e,t){this.changes_made++},deep:!0},order_id:{handler(e,t){this.changeTitle("Order #"+e),this.changes_made=0,this.fetch()}}},computed:{parentOrderId(){return!this.order||!this.order.parent_id?null:this.order.parent_id!=="0"?this.order.parent_id:null},orderUuid(){return this.order&&this.order.uuid?this.order.uuid:""},orderUuidDisplay(){return this.orderUuid.length>12?this.orderUuid.substring(0,12):this.orderUuid},isOrderUuidTruncated(){return this.orderUuid.length>12},transactionType(){return"charge"},placeholderImage(){return pl.productPlaceholder()},canSendPaymentReminder(){return this.canSendPaymentReminderFlag},feeItems(){return!this.order||!this.order.order_items?[]:this.order.order_items.filter(e=>e.payment_type==="fee")},taxSummary(){const e=this.order.tax_summary||{};return{inclusiveTax:e.inclusiveTax||0,exclusiveTax:e.exclusiveTax||0,taxRateLines:this.order.display_tax_lines||e.taxRateLines||[],feeTaxLines:e.feeTaxLines||[],feeTaxLineRows:e.feeTaxLineRows||[],inclusiveFeeTax:e.inclusiveFeeTax||0,shippingTax:e.shippingTax||0,shippingTaxLines:e.shippingTaxLines||[],payableTax:e.payableTax||0,totalOrderTax:e.totalOrderTax||0,isShippingInclusive:e.isShippingInclusive||!1,reversedTaxTotal:e.reversedTaxTotal||0,reversedShippingTax:e.reversedShippingTax||0,rcShippingAdjustment:e.rcShippingAdjustment||0,rcTotalAdjustment:e.rcTotalAdjustment||0,showRcShippingRow:e.showRcShippingRow||!1,foldedRateLines:e.foldedRateLines||[],includedInPrices:e.includedInPrices||0,displayMode:e.displayMode||"itemized",simpleLine:e.simpleLine||null}},taxBreakdownShouldShow(){const e=this.taxSummary;if(e.taxRateLines.length||e.shippingTaxLines.length)return!0;let t=0;return e.taxRateLines.length?t+=e.taxRateLines.length:(e.inclusiveTax>0&&t++,e.exclusiveTax>0&&t++),t+=e.feeTaxLineRows.filter(function(a){return a.tax_amount>0}).length,e.shippingTax>0&&t++,t>=2?!0:t===0?!1:!(e.payableTax>0||e.inclusiveTax>0||e.inclusiveFeeTax>0)},setupFeeSiblingMap(){if(!this.order||!Array.isArray(this.order.order_items))return{};var e={};return this.order.order_items.forEach(function(t){t.payment_type==="signup_fee"&&(t.line_meta&&t.line_meta.parent_item_id&&(e[t.line_meta.parent_item_id]=t),t.object_id&&!e["obj_"+t.object_id]&&(e["obj_"+t.object_id]=t))}),e}},methods:{confirmSendPaymentReminder(){Ul.confirm(d("Are you sure you want to send a payment reminder email for this order?"),d("Send Payment Reminder"),{type:"info",icon:aA(Yd),cancelButtonText:d("Cancel"),confirmButtonText:d("Send Now"),beforeClose:async(e,t,a)=>{var l;if(e==="confirm")try{t.confirmButtonLoading=!0,this.sendingPaymentReminder=!0;const n=await this.$post("email-notification/send-manual-reminder",{event:"renewal_reminder_overdue",entity_id:this.order.id});j.success(n.message||d("Payment reminder sent successfully"))}catch(n){j.error(((l=n.data)==null?void 0:l.message)||d("Failed to send payment reminder"))}finally{t.confirmButtonLoading=!1,this.sendingPaymentReminder=!1,a()}else a()}})},triggerChange(){this.changes_made=1},handleResize(){this.isMobile=window.innerWidth<768},formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)},getDueRefund(){var e;return this.formatNumber(Math.abs(parseFloat(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid))+parseFloat(this.order.total_refund)))},triggerRefundModal(){this.showRefundModal=!0},getNetPayment(){var t,a,l;const e=((a=(t=this.order)==null?void 0:t.business_info)==null?void 0:a.net_total_paid)??this.order.total_paid;return this.formatNumber(e-((l=this.order)==null?void 0:l.total_refund))},getTotalDue(){var e;return this.formatNumber(Math.abs(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid)))},markOrderAsPaid(){this.markingOrderAsPaid||(this.markingOrderAsPaid=!0,ce.post("orders/"+this.order_id+"/mark-as-paid",{...this.otherData,transaction_type:this.transactionType}).then(e=>{this.markingOrderAsPaid=!1,this.transactionMedium=!1,j.success(e.message),this.fetch()}).catch(e=>{var t;this.markingOrderAsPaid=!1,e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}))},handleCommand(e){e==="custom-payment-link"?this.nextInvoiceModal=!0:e==="send-payment-reminder"?this.confirmSendPaymentReminder():this.transactionMedium=!0},shouldSkipAdjustmentItem(e){return!(this.order.order_items.some(a=>a.payment_type==="subscription")&&e.payment_type==="adjustment")},handleAdjustQuantityModal(e){this.adjustItem={},this.adjustQuantityModal=!0,this.adjustItem=e},getImageUrl(e){var l,n,i,A;const t=(l=e==null?void 0:e.variants)==null?void 0:l.media;if(t&&Array.isArray(t.meta_value)&&((n=t.meta_value[0])!=null&&n.url))return t.meta_value[0].url;const a=(A=(i=e==null?void 0:e.variants)==null?void 0:i.product_detail)==null?void 0:A.featured_media;return!t&&a&&typeof a=="object"&&a!==null?a.url:this.placeholderImage},getClass(e){let t=null;return e.featured_media!=null&&(t=this.getImageUrl(e)),{"w-full":!0,"border border-solid border-gray-divider rounded":t&&t!==null&&t!==void 0}},shouldShowRefund(){var t;if(!this.order||(t=this.order.config)!=null&&t.upgraded_to)return!1;const e=parseInt(this.order.total_paid/100);return this.order.payment_status!=="refunded"&&e>0&&e>=parseInt(this.order.total_refund/100)},enableItemEditing(){this.isEditingItem=!0,this.fetchShippingMethods()},disableItemEditing(){this.isEditingItem=!1},handlePaymentActions(e){this.changes_made=0,e==="refund"?this.showRefundModal=!0:e==="create_next_invoice"&&(this.nextInvoiceModal=!0)},getOrderUrl(e){const t=Ke.get("dashboard_url")+"/orders/"+e+"/view";window.location=t},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){this.tmpAdjustedItem={quantity:e,updatedStock:t,item:a}},saveAdjustedProductQuantity(e){this.adjustQuantityModal=!1,Object.keys(e).length>0&&(parseInt(e.updatedStock)<0?j.error(d("You have exceeded the stock limit! Current stock is : %s",e.updatedStock)):e.item.quantity=e.quantity,e.item.updated_stock=e.updatedStock,this.calculateLine())},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():Od(this.order,this.hasCoupon)},deleteProduct(e,t){t.id&&this.deletedItems.push(t.id),this.order.order_items.splice(e,1),this.calculateLine()},processCustom(e){e.order_id=this.order_id,this.order.order_items.unshift(e),this.customModal=!1,this.calculateLine()},update(){var a;this.loading=!0;const e={...this.order};delete e.customer,delete e.note,e.metaValue=((a=this.$refs.dynamicTemplates)==null?void 0:a.getFormStates())||{};const t={...e,deletedItems:this.deletedItems,discount:this.discount,shipping:this.shippingSettings};ce.post("orders/"+this.order_id,t).then(l=>{j.success(l.message),this.fetch()}).catch(l=>{var n;l.status_code=="422"?j.validationErrors(l):j.error((n=l.data)==null?void 0:n.message)}).finally(()=>{this.loading=!1})},fetch(){this.notFound.show=!1,this.loading=!0,ce.get("orders/"+this.order_id,{with:["widgets"]}).then(e=>{var t,a,l,n,i;this.coupons=e.order.applied_coupons||[],this.hasCoupon=this.coupons.length>0,this.appliedCoupons=this.coupons.map(A=>A.coupon_id),this.order=e.order,this.order.order_items=this.formatOrderItems(e.order.order_items),e.checkout_shipping&&(this.order.checkout_shipping=e.checkout_shipping),this.canSendPaymentReminderFlag=!!e.can_send_payment_reminder,this.isSubscription=((t=this.order)==null?void 0:t.subscriptions)&&this.order.subscriptions.length>0,this.isSubscription&&(this.subscriptionStatus=(a=this.order.subscriptions[0])==null?void 0:a.status),this.shouldDisableEditing=["completed","archived","canceled"].includes(this.order.status)||this.isSubscription||this.order.payment_status==="paid",["completed","archived","canceled"].includes(this.order.status)&&(this.warningMessage=d("Order cannot be edited once it is %s",this.order.status)),this.order.payment_status==="paid"&&(this.warningMessage=d("Order cannot be edited once paid.")),this.isSubscription&&(this.warningMessage=d("Subscription Order cannot be edited.")),this.orderSettings=e.order_settings,this.widgets=e.widgets,this.selectedProducts=this.availableProducts=[],this.discount.value=((l=e.discount_meta)==null?void 0:l.value)||0,this.discount.reason=((n=e.discount_meta)==null?void 0:n.reason)||"",this.discount.type=((i=e.discount_meta)==null?void 0:i.type)||"amount",this.selectedLabels=e.selected_labels||[],this.uniqueItemsCount=eh(e.order),e.shipping_meta&&e.shipping_meta.type?this.shippingSettings=e.shipping_meta:e.checkout_shipping&&e.checkout_shipping.method_id&&(this.shippingSettings={id:e.checkout_shipping.method_id}),df(this.discount),this.order.order_items.find(A=>A.payment_type==="subscription"),this.order.order_items=this.order.order_items.map(A=>{var p;return{...A,quantity:Number(A.quantity),updated_stock:parseInt((A==null?void 0:A.available)||((p=A==null?void 0:A.variants)==null?void 0:p.available))+parseInt(A.quantity)}}),this.resetUnsaved(),this.renderActionables(),this.disableItemEditing(),$e(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(j.error(dt.get(e,"data.message")||d("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,(["completed","archived","canceled"].includes(this.order.status)||["unshippable"].includes(this.order.shipping_status))&&this.disableItemEditing()})},updateCustomDiscount(e){this.discount=e,this.changes_made++},updateCoupons(e,t,a){this.coupons=e,this.appliedCoupons=t,this.hasCoupon=a},updateShipping(e,t,a){a&&a.id&&(this.shippingSettings=a),this.changes_made++},reloadOrder(){return this.changes_made=0,window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},clearActivityAction(e){ce.put("activity/"+e.id+"/mark-read",{id:e.id,status:"read"}).then(t=>{this.actionableActivities=this.actionableActivities.filter(a=>a.id!==e.id),this.handleSuccess(t==null?void 0:t.message)}).catch(t=>{var a;t.status_code=="422"?j.validationErrors(t):j.error((a=t.data)==null?void 0:a.message)})},renderActionables(){var a;let e=(a=this==null?void 0:this.order)==null?void 0:a.activities;const t=["warning","error"];this.actionableActivities=e==null?void 0:e.filter(l=>(l==null?void 0:l.read_status)==="unread"&&t.includes(l==null?void 0:l.status))},getCustomerTotalOrders(e){return e>0?e+" "+(e==1?this.$t("order"):this.$t("orders")):this.$t("No orders")},onChangeLabel(e){this.selectedLabels=e,this.changes_made++},saveNoteModal(e){this.order.note=e},hasSubscriptionProduct(e,t){return e.filter(l=>l.variants&&l.variants.other_info&&l.variants.other_info.payment_type===t?!0:!!(l.payment_type&&l.payment_type===t)).length>0},fetchShippingMethods(){const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),ce.get("orders/shipping_methods",{country_code:this.order.customer.country,order_items:e}).then(t=>{this.shippingMethods=t.shipping_methods,this.otherShippingMethods=t.other_shipping_methods}).finally(()=>{})},formatOrderItems:Qm,getProductRowSpan(e){var t=1,a=this.getItemTaxRates(e);a.length>0?t+=a.length:e.tax_amount>0&&(t+=1),e.other_info&&e.other_info.manage_setup_fee==="yes"&&(t+=1);var l=this.getSubscriptionSetupFeeTaxRates(e);return l.length>0?t+=l.length:e.other_info&&e.other_info.signup_fee_tax>0&&e.other_info.manage_setup_fee==="yes"&&(t+=1),this.isEditingItem&&(t+=1),t},getItemTaxRates(e){var t=e.line_meta&&e.line_meta.tax_config?e.line_meta.tax_config.rates:null;return Array.isArray(t)?t.filter(function(a){return a.tax_amount>0}):[]},getSetupFeeSibling(e){return this.setupFeeSiblingMap[e.id]||this.setupFeeSiblingMap["obj_"+e.object_id]||null},getSubscriptionSetupFeeTaxRates(e){var t=this.getSetupFeeSibling(e);if(!t)return[];var a=t.line_meta&&t.line_meta.tax_config&&Array.isArray(t.line_meta.tax_config.rates)?t.line_meta.tax_config.rates:t.line_meta&&Array.isArray(t.line_meta.rates)?t.line_meta.rates:null;return Array.isArray(a)?a.filter(function(l){return l.tax_amount>0}):[]},isSubscriptionSetupFeeInclusive(e){var t=this.getSetupFeeSibling(e);if(!t||!t.line_meta)return!1;var a=t.line_meta.tax_config&&typeof t.line_meta.tax_config=="object"?t.line_meta.tax_config:t.line_meta;return!!a.inclusive},getItemDisplayLineTotal(e){return Math.max(0,parseInt(e.line_total||0))},shouldShowUnitPriceRoundingTooltip(e){var t=parseInt(e.quantity||1),a=parseInt(e.unit_price||0),l=parseInt(e.line_total||0);if(t<2||a<=0||l<=0)return!1;var n=Math.abs(a*t-l);return n>0&&n<=t},formatTaxRateBadge(e){return(e.label||d("Tax"))+" ("+e.rate_percent+"%)"},onBusinessInfoOrderUpdated(e){if(!e)return;const t={business_info:e.business_info,is_reverse_charge_tax_order:e.is_reverse_charge_tax_order,customer_tax_number:e.customer_tax_number,is_b2b_order:e.is_b2b_order,tax_total:e.tax_total,shipping_tax:e.shipping_tax,tax_behavior:e.tax_behavior,total_amount:e.total_amount,total_paid:e.total_paid,payment_status:e.payment_status,tax_summary:e.tax_summary,display_tax_lines:e.display_tax_lines,display_shipping_tax_lines:e.display_shipping_tax_lines};Object.keys(t).forEach(a=>{t[a]===void 0&&delete t[a]}),this.order=Object.assign({},this.order,t)}},mounted(){this.changeTitle("Order #"+this.order_id),this.fetch(),window.onbeforeunload=()=>{if(this.changes_made>1)return!0},(Ke.get("payment_routes")??[]).filter(t=>!(t!=null&&t.upcoming)).forEach(t=>{var a;this.paymentMethodOption.unshift({name:(a=t==null?void 0:t.meta)==null?void 0:a.title,value:t==null?void 0:t.path})}),window.addEventListener("resize",this.handleResize)},beforeUnmount(){window.removeEventListener("resize",this.handleResize)}},sT=Object.assign(lT,{setup(e){const t=M(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(n,i)=>{var L,O;const A=C("el-breadcrumb-item"),p=C("el-tooltip"),m=C("el-breadcrumb"),_=C("el-button"),g=C("el-input"),y=C("router-link"),v=C("el-icon"),k=C("el-popover"),b=C("el-dropdown-item"),w=C("el-dropdown-menu"),B=C("el-dropdown"),S=C("el-option"),V=C("el-select"),F=C("el-form-item"),$=C("el-form"),U=C("el-dialog"),D=C("el-skeleton-item"),T=C("el-skeleton"),I=Qa("loading");return r(),h(P,null,[n.notFound.show?(r(),E(hi,{key:0,"button-text":n.notFound.buttonText,message:n.notFound.message,route:n.notFound.route},null,8,["button-text","message","route"])):x("",!0),n.notFound.show===!1?(r(),h("div",AD,[s(Ns,{isActive:n.changes_made>=1&&!n.showRefundModal?"is-active":"",onDiscard:n.reloadOrder,onSave:n.update,loading:n.loading,saveButtonText:c(d)("Update")},null,8,["isActive","onDiscard","onSave","loading","saveButtonText"]),n.loading?(r(),E(p6,{key:0})):x("",!0),n.order?(r(),h("div",pD,[!n.loading&&n.order?(r(),h(P,{key:0},[o("div",fD,[o("div",null,[o("div",mD,[s(m,{"separator-icon":c(Za)},{default:u(()=>[s(A,{to:{name:"orders"}},{default:u(()=>[R(f(c(d)("Orders")),1)]),_:1}),n.parentOrderId?(r(),E(A,{key:0,to:{name:"view_order",params:{}}},{default:u(()=>[o("a",{onClick:i[0]||(i[0]=Q=>n.getOrderUrl(n.parentOrderId))}," #"+f(n.parentOrderId),1)]),_:1})):x("",!0),s(A,null,{default:u(()=>[n.isOrderUuidTruncated?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-tooltip-long",content:n.orderUuid},{default:u(()=>[o("span",null,"#"+f(n.orderUuidDisplay),1)]),_:1},8,["content"])):n.orderUuid?(r(),h("span",hD,"#"+f(n.orderUuidDisplay),1)):(r(),h("span",_D,"#"+f(c(la)(e.order_id)),1))]),_:1})]),_:1},8,["separator-icon"]),o("div",vD,[s(Ht,{status:n.order.status},null,8,["status"]),n.order.is_b2b_order?(r(),E(Ht,{key:0,type:"blue",text:c(d)("B2B")},null,8,["text"])):x("",!0),s(hA,{order:n.order},null,8,["order"])])]),o("div",gD,[s(Sa,{"date-time":n.order.created_at,"with-time":""},null,8,["date-time"]),i[21]||(i[21]=o("span",{class:"fct_separator"},null,-1)),n.order.invoice_no?(r(),h(P,{key:0},[o("span",null,f(n.order.invoice_no),1),i[20]||(i[20]=o("span",{class:"fct_separator"},null,-1))],64)):x("",!0),o("span",yD,f(n.order.type),1)])]),o("div",bD,[n.shouldShowRefund()?(r(),E(_,{key:0,onClick:i[1]||(i[1]=Q=>n.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:u(()=>[R(f(c(d)("Refund")),1)]),_:1})):x("",!0),n.isEditingItem?(r(),E(_,{key:2,onClick:n.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:u(()=>[R(f(c(d)("Disable Editing")),1)]),_:1},8,["onClick"])):(r(),E(_,{key:1,onClick:n.enableItemEditing,disabled:n.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:u(()=>[n.shouldDisableEditing?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:u(()=>[R(f(n.warningMessage),1)]),default:u(()=>[R(" "+f(c(d)("Edit")),1)]),_:1})):(r(),h(P,{key:1},[R(f(c(d)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),s(Ld,{onReload:i[2]||(i[2]=Q=>n.reloadOrder()),onAddItem:a,onAddProduct:n.addProduct,onEnableItemEditing:n.enableItemEditing,onDisableItemEditing:n.disableItemEditing,onHandlePaymentActions:n.handlePaymentActions,"is-editing-item":n.isEditingItem,order:n.order,triggerMode:n.isMobile?"":"button",shouldShowRefund:n.shouldShowRefund(),warningMessage:n.warningMessage},null,8,["onAddProduct","onEnableItemEditing","onDisableItemEditing","onHandlePaymentActions","is-editing-item","order","triggerMode","shouldShowRefund","warningMessage"])])]),o("div",wD,[(r(!0),h(P,null,ae(n.actionableActivities,Q=>(r(),E(ol,{class:"mb-5",type:"error",key:Q.id,content:Q==null?void 0:Q.content,closable:"",onClose:H=>n.clearActivityAction(Q)},null,8,["content","onClose"]))),128)),o("div",CD,[o("div",kD,[s(xe,{class:"overflow-hidden fct-order-items-card"},{default:u(()=>[s(Ve,{border_bottom:""},{title:u(()=>{var Q,H;return[o("h2",BD,[R(f(c(d)("Order items"))+" ",1),((Q=n.order)==null?void 0:Q.fulfillment_type)==="physical"?(r(),E(Ht,{key:0,status:(H=n.order)==null?void 0:H.shipping_status},{default:u(()=>{var K;return[R(f((K=n.order)==null?void 0:K.shipping_status),1)]}),_:1},8,["status"])):x("",!0)])]}),_:1}),s(Be,null,{default:u(()=>[n.isEditingItem?(r(),h("div",xD,[s(g,{placeholder:c(d)("Search products..."),onKeyup:i[3]||(i[3]=Q=>a()),modelValue:n.searchQuery,"onUpdate:modelValue":i[4]||(i[4]=Q=>n.searchQuery=Q)},{prefix:u(()=>[s(X,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),s(_,{onClick:l,type:"info",soft:"",class:"el-button--x-small"},{default:u(()=>[R(f(c(d)("Browse")),1)]),_:1})])):x("",!0),o("div",SD,[n.order.order_items.length>0?(r(),h("div",$D,[o("table",FD,[o("tbody",null,[(r(!0),h(P,null,ae(n.order.order_items,(Q,H)=>{var K,W,z,Y,Z,re,q,Ae,ie,J,N,le,ee,pe;return r(),h(P,{key:H},[Q.payment_type!=="signup_fee"&&Q.payment_type!=="fee"&&((K=Q==null?void 0:Q.other_info)==null?void 0:K.item_status)!=="adjusted"&&n.shouldSkipAdjustmentItem(Q)?(r(),h(P,{key:0},[o("tr",ED,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:n.getProductRowSpan(Q)},[o("div",ID,[Q!=null&&Q.is_custom?(r(),h("a",{key:0,href:(W=Q==null?void 0:Q.other_info)==null?void 0:W.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[o("img",{src:Q.featured_media!=null?Q.featured_media:n.getImageUrl(Q),alt:Q.title,class:ue([n.getClass(Q),"h-full object-contain rounded"])},null,10,DD)],8,VD)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:Q==null?void 0:Q.post_id}}},{default:u(()=>[o("img",{src:Q.featured_media!=null?Q.featured_media:n.getImageUrl(Q),alt:Q.title,class:ue([n.getClass(Q),"h-full object-contain rounded"])},null,10,TD)]),_:2},1032,["to"]))])],8,UD),o("td",QD,[o("div",MD,[o("div",LD,[o("div",RD,[Q!=null&&Q.is_custom?(r(),h("a",{key:0,href:(z=Q==null?void 0:Q.other_info)==null?void 0:z.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},f(Q==null?void 0:Q.post_title),9,OD)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:Q==null?void 0:Q.post_id}}},{default:u(()=>[R(f(Q==null?void 0:Q.post_title),1)]),_:2},1032,["to"]))]),(Q!=null&&Q.variation_display_title||Q!=null&&Q.title)&&(Q==null?void 0:Q.title)!==(Q==null?void 0:Q.post_title)?(r(),h("div",PD," – "+f((Q==null?void 0:Q.variation_display_title)||(Q==null?void 0:Q.title)),1)):x("",!0),Q.bundle_items.length>0?(r(),E(Oo,{key:1,product:Q},null,8,["product"])):x("",!0),(Q==null?void 0:Q.payment_type)==="subscription"?(r(),h("div",HD,[o("div",{innerHTML:Q==null?void 0:Q.payment_info},null,8,ND),((Y=Q==null?void 0:Q.other_info)==null?void 0:Y.manage_setup_fee)==="yes"?(r(),h("div",{key:0,innerHTML:Q==null?void 0:Q.setup_info},null,8,KD)):x("",!0)])):x("",!0)]),n.isEditingItem?(r(),h("div",GD,[o("span",null,f(n.formatNumber(Q.unit_price)),1),i[22]||(i[22]=o("span",null,"x",-1)),o("span",null,f(c(la)(Q.quantity)),1)])):x("",!0),n.isEditingItem?x("",!0):(r(),h("div",zD,[o("div",jD,[((Z=Q==null?void 0:Q.variants)==null?void 0:Z.length)>0?(r(),h("span",qD,f(n.formatNumber(Q.variants.compare_price)),1)):x("",!0),o("span",null,f(n.formatNumber(Q.unit_price)),1),i[23]||(i[23]=o("span",null,"x",-1)),o("span",null,f(c(la)(Q.quantity)),1)])])),Q.bundle_items.length>0?(r(),E(Oo,{key:2,product:Q},null,8,["product"])):x("",!0)]),o("div",YD,[((re=Q==null?void 0:Q.variants)==null?void 0:re.length)>0?(r(),h("span",WD,f(n.formatNumber(Q.variants.compare_price)),1)):x("",!0),Q.line_meta&&Q.line_meta.original_unit_price?(r(),h("span",JD,f(n.formatNumber(Q.line_meta.original_unit_price)),1)):x("",!0),o("span",null,f(n.formatNumber(Q.unit_price)),1),i[25]||(i[25]=o("span",null,"×",-1)),o("span",null,f(c(la)(Q.quantity)),1),((q=Q==null?void 0:Q.other_info)==null?void 0:q.item_status)!=="adjusted"?(r(),h(P,{key:2},[i[24]||(i[24]=o("span",{class:"text-system-mid"},"·",-1)),Q.coupon_discount>0?(r(),h("span",XD,f(n.formatNumber(Q.subtotal)),1)):x("",!0),o("span",null,f(n.formatNumber(n.getItemDisplayLineTotal(Q))),1)],64)):x("",!0)])]),o("td",ZD,[n.isEditingItem?x("",!0):(r(),h("div",e9,[o("div",t9,[((Ae=Q==null?void 0:Q.variants)==null?void 0:Ae.length)>0?(r(),h("span",a9,f(n.formatNumber(Q.variants.compare_price)),1)):x("",!0),Q.line_meta&&Q.line_meta.original_unit_price?(r(),h("span",l9,f(n.formatNumber(Q.line_meta.original_unit_price)),1)):x("",!0),o("span",null,f(n.formatNumber(Q.unit_price)),1),i[26]||(i[26]=o("span",null,"x",-1)),o("span",null,f(c(la)(Q.quantity)),1),n.shouldShowUnitPriceRoundingTooltip(Q)?(r(),E(p,{key:2,effect:"dark",content:c(d)("Unit price is rounded for display. The line total is calculated at full precision."),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(v,{class:"fct-unit-price-rounding-icon"},{default:u(()=>[s(c(dl))]),_:1})]),_:1},8,["content"])):x("",!0)])]))]),o("td",s9,[o("div",n9,[((ie=Q==null?void 0:Q.other_info)==null?void 0:ie.item_status)!=="adjusted"?(r(),h(P,{key:0},[Q.coupon_discount>0?(r(),h("div",o9,[o("span",i9,f(n.formatNumber(Q.subtotal)),1)])):x("",!0),o("span",null,f(n.formatNumber(n.getItemDisplayLineTotal(Q))),1)],64)):x("",!0)])])]),n.taxSummary.displayMode!=="simplified"?(r(),h(P,{key:0},[n.getItemTaxRates(Q).length?(r(!0),h(P,{key:0},ae(n.getItemTaxRates(Q),(de,Ue)=>{var Ce,Se,ge;return r(),h("tr",{key:"tax-rate-"+Ue,class:ue(Q.line_meta&&Q.line_meta.tax_config&&Q.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[o("td",r9,[o("span",d9,f(n.formatTaxRateBadge(de)),1)]),o("td",u9,[o("span",{class:ue(["fct-tax-amount",{"fct-tax-amount--reversed":n.order.is_reverse_charge_tax_order&&(!((Se=(Ce=Q.line_meta)==null?void 0:Ce.tax_config)!=null&&Se.inclusive)||((ge=n.orderSettings)==null?void 0:ge.reverse_charge_price_mode)==="dynamic")}])},[Q.line_meta&&Q.line_meta.tax_config&&Q.line_meta.tax_config.inclusive?(r(),h(P,{key:0},[R(f(c(d)("incl.")),1)],64)):(r(),h(P,{key:1},[R("+")],64)),R(" "+f(n.formatNumber(de.tax_amount)),1)],2)])],2)}),128)):Q.tax_amount>0?(r(),h("tr",c9,[o("td",A9,f(c(d)("Tax"))+": "+f(n.formatNumber(Q.tax_amount)),1)])):x("",!0)],64)):x("",!0),((J=Q==null?void 0:Q.other_info)==null?void 0:J.manage_setup_fee)==="yes"?(r(),h("tr",p9,[o("td",f9,[o("span",m9,f(Q==null?void 0:Q.other_info.signup_fee_name),1)]),o("td",h9," + "+f(n.formatNumber(((N=Q==null?void 0:Q.other_info)==null?void 0:N.setup_fee_per_item)==="yes"?Q.other_info.signup_fee*Q.quantity:Q.other_info.signup_fee)),1)])):x("",!0),n.taxSummary.displayMode!=="simplified"?(r(),h(P,{key:2},[n.getSubscriptionSetupFeeTaxRates(Q).length?(r(!0),h(P,{key:0},ae(n.getSubscriptionSetupFeeTaxRates(Q),(de,Ue)=>{var Ce;return r(),h("tr",{key:"setup-tax-rate-"+Ue,class:ue(n.isSubscriptionSetupFeeInclusive(Q)?"is-inclusive":"is-exclusive")},[o("td",_9,[o("span",v9,f(c(d)("Setup fee"))+": "+f(n.formatTaxRateBadge(de)),1)]),o("td",g9,[o("span",{class:ue(["fct-tax-amount",{"fct-tax-amount--reversed":n.order.is_reverse_charge_tax_order&&(!n.isSubscriptionSetupFeeInclusive(Q)||((Ce=n.orderSettings)==null?void 0:Ce.reverse_charge_price_mode)==="dynamic")}])},[n.isSubscriptionSetupFeeInclusive(Q)?(r(),h(P,{key:0},[R(f(c(d)("incl.")),1)],64)):x("",!0),R(f(n.formatNumber(de.tax_amount)),1)],2)])],2)}),128)):((le=Q==null?void 0:Q.other_info)==null?void 0:le.signup_fee_tax)>0&&((ee=Q==null?void 0:Q.other_info)==null?void 0:ee.manage_setup_fee)==="yes"?(r(),h("tr",y9,[o("td",b9,[R(f(c(d)("Setup fee tax"))+": ",1),o("span",{class:ue(["fct-tax-amount",{"fct-tax-amount--reversed":n.order.is_reverse_charge_tax_order&&(!n.isSubscriptionSetupFeeInclusive(Q)||((pe=n.orderSettings)==null?void 0:pe.reverse_charge_price_mode)==="dynamic")}])},f(n.formatNumber(Q.other_info.signup_fee_tax)),3)])])):x("",!0)],64)):x("",!0),n.isEditingItem?(r(),h("tr",w9,[o("td",C9,[o("div",k9,[o("a",{href:"#",onClick:Ge(de=>n.handleAdjustQuantityModal(Q),["prevent"])},f(c(d)("Adjust Quantity")),9,B9),o("a",{href:"#",onClick:Ge(de=>n.deleteProduct(H,Q),["prevent"])},f(c(d)("Remove Item")),9,x9)])])])):x("",!0),i[27]||(i[27]=o("tr",{class:"last:hidden"},[o("td",{colspan:"4",class:"pt-1"},[o("div",{class:"bg-gray-divider dark:bg-dark-400 h-[1px] w-full mb-1"})])],-1))],64)):x("",!0)],64)}),128))])])])):x("",!0),n.order.order_items.length==0?(r(),h("p",S9,f(c(d)("No items found.")),1)):x("",!0)])]),_:1})]),_:1}),s(xe,{class:"fct-order-payment-card"},{default:u(()=>[s(Ve,{border_bottom:""},{title:u(()=>[o("h2",$9,[o("span",null,f(c(d)("Payment")),1),s(Ht,{status:n.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),s(Be,null,{default:u(()=>{var Q,H,K,W,z,Y,Z,re,q,Ae,ie;return[o("table",F9,[o("tbody",null,[o("tr",null,[o("td",null,f(c(d)("Subtotal")),1),o("td",null,[n.order.order_items.length>0?(r(),h("span",E9,f(c(la)(n.uniqueItemsCount))+" "+f(c(To)("item","items",n.uniqueItemsCount)),1)):x("",!0)]),o("td",null,f(n.formatNumber(n.order.subtotal)),1)]),s(Pd,{order:n.order,shippingAttributes:n.shippingSettings,shouldEnableEditing:n.isEditingItem,"onUpdate:shipping":n.updateShipping,shippingMethodsProps:n.shippingMethods,otherShippingMethodsProps:n.otherShippingMethods},null,8,["order","shippingAttributes","shouldEnableEditing","onUpdate:shipping","shippingMethodsProps","otherShippingMethodsProps"]),n.order.fee_total>0?(r(!0),h(P,{key:0},ae(n.feeItems,J=>(r(),h("tr",{key:"fee-"+J.id},[o("td",null,f(J.title),1),i[28]||(i[28]=o("td",null,null,-1)),o("td",null,f(n.formatNumber(J.subtotal)),1)]))),128)):x("",!0),n.order.order_items.length>0&&(n.isEditingItem||n.hasCoupon)?(r(),E(Di,{key:1,order:n.order,couponsAttributes:n.coupons,hasCouponAttributes:n.hasCoupon,appliedCouponsAttributes:n.appliedCoupons,action:"edit_order",shouldManageCoupon:n.isEditingItem,"onUpdate:coupons":n.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","couponsAttributes","hasCouponAttributes","appliedCouponsAttributes","shouldManageCoupon","onUpdate:coupons"])):x("",!0),n.hasCoupon?x("",!0):(r(),E(Ti,{key:2,order:n.order,discountAttributes:n.discount,hasCoupon:n.hasCoupon,shouldEnableEditing:n.isEditingItem,"onUpdate:customDiscount":n.updateCustomDiscount},null,8,["order","discountAttributes","hasCoupon","shouldEnableEditing","onUpdate:customDiscount"])),!n.hasCoupon&&n.order.coupon_discount_total>0?(r(),h("tr",U9,[o("td",null,f(c(d)("Coupon Discount")),1),i[29]||(i[29]=o("td",null,null,-1)),o("td",null,"- "+f(n.formatNumber(n.order.coupon_discount_total)),1)])):x("",!0),n.isEditingItem?(r(),h("tr",I9,[o("td",V9,f(c(d)("Tax will be recalculated on save")),1)])):n.taxSummary.payableTax>0||n.taxSummary.inclusiveTax>0||n.taxSummary.inclusiveFeeTax>0||n.taxSummary.taxRateLines.length||n.taxSummary.shippingTax>0||n.order.is_reverse_charge_tax_order&&n.taxSummary.reversedTaxTotal>0||n.order.is_reverse_charge_tax_order&&n.taxSummary.reversedShippingTax>0?(r(),h("tr",D9,[o("td",T9,[n.taxSummary.displayMode==="simplified"&&n.taxSummary.simpleLine?(r(),h("div",Q9,[o("span",M9,[o("span",null,f(n.taxSummary.simpleLine.label),1),n.taxSummary.simpleLine.hasDetails?(r(),E(k,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:u(()=>[o("a",L9,f(c(d)("See details"))+" ▾",1)]),default:u(()=>[s(Jr,{"tax-summary":n.taxSummary,order:n.order,"tax-breakdown-should-show":n.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"])]),_:1})):x("",!0)]),o("span",null,f(n.taxSummary.simpleLine.value),1)])):(r(),E(Jr,{key:1,"tax-summary":n.taxSummary,order:n.order,"tax-breakdown-should-show":n.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"]))])])):x("",!0),o("tr",R9,[o("td",null,f(c(d)("Total")),1),i[30]||(i[30]=o("td",null,null,-1)),o("td",null,f(n.formatNumber(n.order.total_amount-(n.taxSummary.rcTotalAdjustment||0))),1)]),o("tr",O9,[o("td",null,f(c(d)("Total Paid")),1),i[31]||(i[31]=o("td",null,null,-1)),o("td",null,f(n.formatNumber(((H=(Q=n.order)==null?void 0:Q.business_info)==null?void 0:H.net_total_paid)??((K=n.order)==null?void 0:K.total_paid))),1)]),((W=n.order)==null?void 0:W.total_refund)>0?(r(),h("tr",P9,[o("td",null,f(c(d)("Total Refund")),1),i[32]||(i[32]=o("td",null,null,-1)),o("td",null,"- "+f(n.formatNumber((z=n.order)==null?void 0:z.total_refund)),1)])):x("",!0),(((Z=(Y=n.order)==null?void 0:Y.business_info)==null?void 0:Z.net_total_paid)??n.order.total_paid)-((re=n.order)==null?void 0:re.total_refund)!=0?(r(),h("tr",H9,[o("td",null,f(c(d)("Net Payment")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",N9,f(n.getNetPayment()),1)])):x("",!0),n.order.total_amount-((q=n.order)==null?void 0:q.total_paid)>0?(r(),h("tr",K9,[o("td",null,f(c(d)("Total Due")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",G9,f(n.getTotalDue()),1)])):x("",!0),n.order.total_amount-(((Ae=n.order)==null?void 0:Ae.total_paid)-((ie=n.order)==null?void 0:ie.total_refund))<0?(r(),h("tr",z9,[o("td",null,[o("p",j9,[s(c(km),{class:"w-6 text-amber-500 mr-2"}),R(" "+f(c(d)("Total Refund Owed")),1)])]),i[35]||(i[35]=o("td",null,null,-1)),o("td",q9,f(n.getDueRefund()),1)])):x("",!0)])])]}),_:1})]),_:1}),n.order.transactions&&n.order.transactions.length?(r(),E(xe,{key:0,class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Transaction Details"),border_bottom:"",title_size:"small"},{action:u(()=>{var Q;return[n.order.total_amount-((Q=n.order)==null?void 0:Q.total_paid)>0&&n.order.status!=="canceled"&&n.markingOrderAsPaid===!1?(r(),E(B,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:n.handleCommand},{dropdown:u(()=>[s(w,null,{default:u(()=>[s(b,{command:"custom-payment-link"},{default:u(()=>[R(f(c(d)("Custom Payment Link"))+" ",1),s(p,{effect:"dark",content:c(d)("Due amount is remaining, Get a custom payment link to send to the customer."),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(v,null,{default:u(()=>[s(c(dl))]),_:1})]),_:1},8,["content"])]),_:1}),s(b,{command:"mark-order-paid"},{default:u(()=>[R(f(c(d)("Mark order as paid")),1)]),_:1}),n.canSendPaymentReminder?(r(),E(b,{key:0,command:"send-payment-reminder",disabled:n.sendingPaymentReminder},{default:u(()=>[R(f(c(d)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):x("",!0)]),_:1})]),default:u(()=>[s(_,{size:"small"},{default:u(()=>[R(f(c(d)("Collect Payments"))+" ",1),s(X,{name:"ChevronDown"})]),_:1}),s(X,{name:"More"})]),_:1},8,["onCommand"])):x("",!0)]}),_:1},8,["title"]),s(Be,{class:"p-0"},{default:u(()=>[s(Rd,{onReload:i[5]||(i[5]=Q=>n.reloadOrder()),onTriggerRefundModal:n.triggerRefundModal,transactions:n.order.transactions,order_id:n.order.id,"order-currency":n.order.currency},null,8,["onTriggerRefundModal","transactions","order_id","order-currency"]),s(Af,{onReload:i[6]||(i[6]=Q=>n.reloadOrder()),transactions:n.order.transactions,order_id:n.order.id,"order-currency":n.order.currency},null,8,["transactions","order_id","order-currency"])]),_:1})]),_:1})):x("",!0),s(U,{title:c(d)("Mark as paid"),modelValue:n.transactionMedium,"onUpdate:modelValue":i[10]||(i[10]=Q=>n.transactionMedium=Q)},{footer:u(()=>[Jt((r(),E(_,{plan:"",type:"primary",onClick:n.markOrderAsPaid,disabled:n.markingOrderAsPaid},{default:u(()=>[R(f(c(d)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[I,n.markingOrderAsPaid]])]),default:u(()=>[o("div",null,[s($,{"label-position":"top"},{default:u(()=>[s(F,{"label-position":"top",label:c(d)("Payment method")},{default:u(()=>[s(V,{modelValue:n.otherData.payment_method,"onUpdate:modelValue":i[7]||(i[7]=Q=>n.otherData.payment_method=Q)},{default:u(()=>[(r(!0),h(P,null,ae(n.paymentMethodOption,Q=>(r(),E(S,{key:Q.value,label:Q.name,value:Q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),s(F,{"label-position":"top",label:c(d)("Vendor charge id")},{default:u(()=>[s(g,{modelValue:n.otherData.vendor_charge_id,"onUpdate:modelValue":i[8]||(i[8]=Q=>n.otherData.vendor_charge_id=Q)},null,8,["modelValue"])]),_:1},8,["label"]),s(F,{"label-position":"top",label:c(d)("Notes")},{default:u(()=>[s(g,{rows:2,type:"textarea",placeholder:c(d)("Please enter the payment note..."),modelValue:n.otherData.mark_paid_note,"onUpdate:modelValue":i[9]||(i[9]=Q=>n.otherData.mark_paid_note=Q)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),n.order.licenses?(r(),E(xe,{key:1,class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Licenses"),title_size:"small"},null,8,["title"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[s(fd,{licenses:n.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):x("",!0),s(xe,{class:"overflow-hidden mb-0"},{default:u(()=>[s(Ve,{title:c(d)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(gA,{onReload:n.reloadOrder,activities:n.order.activities||[],showManageActivity:n.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",Y9,[o("div",W9,[(r(!0),h(P,null,ae(n.order.subscriptions,(Q,H)=>(r(),E(C6,{key:Q.id,subscription:Q,order:n.order,index:H,getOrderUrl:n.getOrderUrl},null,8,["subscription","order","index","getOrderUrl"]))),128)),n.order.customer?(r(),E(mi,{key:0,order:n.order,shouldEnableEditing:!0,onOnOrderUpdated:n.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):x("",!0),s(Vi,{orderId:n.order.id,note:n.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),s(fi,{"bind-to-id":n.order.id,"bind-to-type":"Order",selectedLabels:n.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(L=n.order)!=null&&L.order_operation?(r(),E(cf,{key:1,order_operation:(O=n.order)==null?void 0:O.order_operation},null,8,["order_operation"])):x("",!0)]),n.order?(r(),h("div",J9,[s(hn,{ref:"dynamicTemplates",filter:"single_order_page","widgets-query":{order_uuid:n.order.uuid,order_id:n.order.id},data:{order:n.order}},null,8,["widgets-query","data"])])):x("",!0)])]),s(U,{modelValue:n.adjustQuantityModal,"onUpdate:modelValue":i[13]||(i[13]=Q=>n.adjustQuantityModal=Q),title:c(d)("Adjust Quantity"),width:"35%","align-center":"","append-to-body":!0,class:"fct-adjust-quantity-modal",onClose:i[14]||(i[14]=()=>{n.adjustQuantityModal=!1,n.adjustItem={},n.tmpAdjustedItem={}})},{footer:u(()=>[o("div",tT,[s(_,{onClick:i[11]||(i[11]=Q=>n.adjustQuantityModal=!1),type:"info",soft:""},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(_,{type:"primary",onClick:i[12]||(i[12]=Q=>n.saveAdjustedProductQuantity(n.tmpAdjustedItem))},{default:u(()=>[R(f(c(d)("Done")),1)]),_:1})])]),default:u(()=>[o("div",X9,[o("div",Z9,[i[36]||(i[36]=R(" Adjust the quantity for ",-1)),o("strong",null,f(n.adjustItem.variation_display_title||n.adjustItem.title),1)]),o("div",eT,[o("label",null,f(c(d)("Quantity")),1),n.isEditingItem?(r(),E(of,{key:0,item:n.adjustItem,"onUpdate:value":n.updateQuantity},null,8,["item","onUpdate:value"])):x("",!0)])])]),_:1},8,["modelValue","title"]),s(nf,{ref_key:"productItemModal",ref:t,order_id:e.order_id,searchQueryParent:n.searchQuery,orderParent:n.order,"onUpdate:searchQuery":n.updateSearchQuery},null,8,["order_id","searchQueryParent","orderParent","onUpdate:searchQuery"]),s(U,{"append-to-body":!0,width:"40%",modelValue:n.createProductModal,"onUpdate:modelValue":i[15]||(i[15]=Q=>n.createProductModal=Q),title:c(d)("Add New Product")},{default:u(()=>[n.createProductModal?(r(),h("div",aT,[s($i,{customModal:"order_modal","onUpdate:createProductModal":n.updateProductModal,onProcess_custom:n.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"]),s(U,{"append-to-body":!0,modelValue:n.showRefundModal,"onUpdate:modelValue":i[17]||(i[17]=Q=>n.showRefundModal=Q),title:c(d)("Refund Transaction"),onClose:i[18]||(i[18]=()=>{n.changes_made=0,n.showRefundModal=!1,n.fetch()})},{default:u(()=>[Jt(s(j5,{"element-loading-text":c(d)("Refund initiating on remote..."),order_id:e.order_id,order:n.order,showRefundModal:n.showRefundModal,onProcessing_refund:i[16]||(i[16]=Q=>n.processing_refund=Q),subscription:n.subscription,is_subscription:n.isSubscription,subscription_status:n.subscriptionStatus},null,8,["element-loading-text","order_id","order","showRefundModal","subscription","is_subscription","subscription_status"]),[[I,n.processing_refund]])]),_:1},8,["modelValue","title"]),n.loading?(r(),E(T,{key:0,animated:""},{default:u(()=>[s(D),s(D),s(D)]),_:1})):x("",!0),s(U,{modelValue:n.nextInvoiceModal,"onUpdate:modelValue":i[19]||(i[19]=Q=>n.nextInvoiceModal=Q),title:c(d)("Custom payment link")},{default:u(()=>[s(n6,{order_id:e.order_id,order:n.order,onReload:n.fetch},null,8,["order_id","order","onReload"])]),_:1},8,["modelValue","title"])])],64)):x("",!0)])):x("",!0)])):x("",!0)],64)}}}),nT={class:"fct-create-order-wrapper fct-layout-width"},oT={class:"single-page-header"},iT={class:"single-page-header-title-wrap"},rT={class:"single-page-body"},dT={class:"fct-create-order"},uT={class:"fct-create-order-main"},cT={class:"fct-browse-product-form-group pb-5 mx-5"},AT={key:0,class:"fct-table-wrap fct-table-transparent-header"},pT={class:"fct-product-info-card"},fT={class:"fct-product-info-media"},mT=["src","alt"],hT={class:"fct-product-info-details"},_T={class:"fct-product-info-name"},vT={class:"product-sub-name product-sub-name--wrap"},gT={class:"mt-1"},yT={key:0,class:"line-through mr-3"},bT={key:1},wT={key:0},CT={class:"fct-input-number-wrap"},kT={key:0},BT={key:0},xT={key:1},ST={key:0},$T={class:"fct-table-border fct-table-order-details"},FT={key:0},ET={key:3},UT={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},IT={class:"fct-create-order-aside"},VT={class:"fct-admin-sidebar"},DT={key:0},TT={name:"CreateOrder",components:{OrderBulkActions:Ld,Transaction:Rd,Badge:Ht,IconButton:tt,CopyToClipboard:Va,Notes:Vi,Coupon:Di,CustomDiscount:Ti,OrderCustomerInformation:mi,Shipping:Pd},data(){return{loading:!1,calculating:!1,customModal:!1,cartItems:{},discount:{},shippingSettings:{},customItem:{title:"",price:0,quantity:1,is_physical:"yes"},timeout:"",widgets:[],order:{applied_coupon:[],customer_id:"",customer:{id:null,full_name:"",email:"",phone:""},status:"processing",subtotal:0,manual_discount_total:0,shipping_tax:0,shipping_total:0,tax_total:0,total_amount:0,order_items:[],payment_status:"pending",payment_method:"offline_payment",shipping_status:"unshipped"},searching:!1,orderSettings:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],deletedItems:[],searchQuery:"",change_order_infos:!1,change_payment_infos:!1,changes_made:0,createProductModal:!1,coupons:[],appliedCoupons:[],hasCoupon:!1,selectedLabels:[],selectedCustomerCountry:"",selectedCustomerAddress:null,shippingMethods:[],otherShippingMethods:[]}},watch:{order:{handler(){this.changes_made++},deep:!0}},computed:{beforeRouteLeave(e,t,a){this.redirectRouteName=e.name,this.changes_made?this.outerVisible=!0:a()},hasSubscriptionItem(){return this.order.order_items.some(e=>e.payment_type==="subscription")}},methods:{getImageUrl(e,t){return e&&e!==null&&e!==void 0?e:pl.productPlaceholder()},getClass(e){return{"w-full":!0,"border border-solid border-gray-divider rounded":e&&e!==null&&e!==void 0}},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){parseInt(t)<0?this.handleError(`You have exceeded the stock limit! Current stock is : ${t}`):a.quantity=e,a.updated_stock=t,this.calculateLine()},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():Od(this.order,this.hasCoupon)},deleteProduct(e,t){t.id&&this.deletedItems.push(t.id),this.order.order_items.splice(e,1),this.calculateLine()},processCustom(e){e.order_id=this.order_id,this.order.order_items.unshift(e),this.customModal=!1,this.calculateLine()},update(){delete this.order.customer.orders,this.loading=!0;const e={...this.order};delete e.customer,ce.post("orders",{...e,discount:this.discount,shipping:this.shippingSettings,labels:this.selectedLabels,user_tz:at.tz.guess(),trigger:"on_admin_create"}).then(t=>{j.success(t.message),setTimeout(()=>{this.$router.push({name:"view_order",params:{order_id:t==null?void 0:t.order_id}})},300)}).catch(t=>{var a;t.status_code=="422"?j.validationErrors(t):j.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1,this.changes_made=0})},reloadOrder(){return window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},onChangeLabel(e){this.selectedLabels=e},saveNoteModal(e){this.order.note=e},updateCustomDiscount(e){this.discount=e,this.changes_made++},updateCoupons(e,t,a){this.coupons=e,this.appliedCoupons=t,this.hasCoupon=a},updateShipping(e,t){var a;(a=this.order)==null||a.order_items.forEach((l,n)=>{l.shipping_charge=dt.get(e,`${l.id}.shipping_charge`)}),this.order.shipping_total=t,this.changes_made++},isDisabled(e){return(e==null?void 0:e.payment_type)==="subscription"},updateCustomPrice(e){const t=parseFloat(e.custom_price);!isNaN(t)&&t>=0?(e.has_custom_price||(e.original_price=e.price,e.original_unit_price=e.unit_price,e.has_custom_price=!0),e.price=t,e.unit_price=Math.round(t*100)):e.has_custom_price&&(e.price=e.original_price,e.unit_price=e.original_unit_price,e.has_custom_price=!1),this.calculateLine()},fetchShippingMethods(){const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),ce.get("orders/shipping_methods",{country_code:this.selectedCustomerCountry,order_items:e}).then(t=>{this.shippingMethods=t.shipping_methods,this.otherShippingMethods=t.other_shipping_methods}).finally(()=>{})}},mounted(){this.fetchShippingMethods(),window.onbeforeunload=()=>{if(this.changes_made>0)return!0}}},QT=Object.assign(TT,{setup(e){const t=M(),a=M(!0),l=()=>t.value.fetchBySearch(),n=()=>{l()};return(i,A)=>{const p=C("el-breadcrumb-item"),m=C("el-breadcrumb"),_=C("el-input"),g=C("el-button"),y=C("router-link"),v=C("el-table-column"),k=C("el-input-number"),b=C("el-table"),w=C("el-dialog"),B=Qa("loading");return r(),h("div",nT,[s(Ns,{isActive:i.changes_made>0?"is-active":"",onDiscard:i.reloadOrder,onSave:i.update,loading:i.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",oT,[o("div",iT,[s(m,{"separator-icon":c(Za)},{default:u(()=>[s(p,{to:{name:"orders"}},{default:u(()=>[R(f(i.$t("Orders")),1)]),_:1}),s(p,null,{default:u(()=>[R(f(i.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),o("div",rT,[o("div",dT,[o("div",uT,[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:i.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[o("div",cT,[s(_,{placeholder:i.$t("Search products..."),onKeyup:A[0]||(A[0]=S=>l()),modelValue:i.searchQuery,"onUpdate:modelValue":A[1]||(A[1]=S=>i.searchQuery=S)},{prefix:u(()=>[s(X,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),s(g,{onClick:n,type:"info",soft:"",class:"el-button--x-small"},{default:u(()=>[R(f(i.$t("Browse")),1)]),_:1})]),i.order.order_items.length>0?(r(),h("div",AT,[Jt((r(),E(b,{data:i.order.order_items,class:"fct-table w-full","row-key":"id","default-expand-all":"","element-loading-text":i.$t("Recalculating with product latest info...")},{default:u(()=>[s(v,{"min-width":"450",label:i.$t("Product")},{default:u(S=>{var V,F,$,U;return[o("div",pT,[o("div",fT,[s(y,{class:"link",to:{name:"product_edit",params:{product_id:S.row.post_id}}},{default:u(()=>[o("img",{src:i.getImageUrl(S.row.featured_media,i.appVars.asset_url),alt:S.row.title,class:ue(i.getClass(S.row.featured_media))},null,10,mT)]),_:2},1032,["to"])]),o("div",hT,[o("div",_T,[s(y,{class:"link",to:{name:"product_edit",params:{product_id:S.row.post_id}}},{default:u(()=>[R(f(S.row.post_title)+" ",1),o("span",vT,"- "+f(S.row.variation_display_title||S.row.title),1)]),_:2},1032,["to"])]),o("div",gT,[R(f(i.formatNumber(S.row.price))+" ",1),parseInt(S.row.unit_price)>parseInt(S.row.price)?(r(),h("span",yT,f(i.formatNumber(S.row.unit_price)),1)):x("",!0),S.row.payment_type==="subscription"&&((F=(V=S.row)==null?void 0:V.other_info)==null?void 0:F.manage_setup_fee)==="yes"?(r(),h("div",bT,[o("span",null,f(S.row.other_info.signup_fee_name)+" : "+f(i.formatNumber(S.row.other_info.signup_fee)),1),((U=($=S.row)==null?void 0:$.other_info)==null?void 0:U.setup_fee_per_item)=="yes"?(r(),h("span",wT,[A[6]||(A[6]=o("span",null,"x",-1)),o("span",null,f(S.row.quantity),1)])):x("",!0)])):x("",!0)])])])]}),_:1},8,["label"]),s(v,{width:"120",label:i.$t("Quantity")},{default:u(S=>[o("div",CT,[s(of,{item:S.row,"onUpdate:value":i.updateQuantity,isDisabled:i.isDisabled(S.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),s(v,{width:120,label:i.$t("Total")},{default:u(S=>{var V,F,$,U;return[o("div",null,f(i.formatNumber(S.row.line_total)),1),S.row.payment_type=="subscription"&&((F=(V=S.row)==null?void 0:V.other_info)==null?void 0:F.manage_setup_fee)=="yes"?(r(),h("div",kT,[A[7]||(A[7]=o("span",null,"+",-1)),((U=($=S.row)==null?void 0:$.other_info)==null?void 0:U.setup_fee_per_item)=="yes"?(r(),h("span",BT,[o("span",null,f(i.formatNumber(S.row.other_info.signup_fee*S.row.quantity)),1)])):(r(),h("span",xT,f(i.formatNumber(S.row.other_info.signup_fee)),1))])):x("",!0)]}),_:1},8,["label"]),i.hasSubscriptionItem?(r(),E(v,{key:0,width:"140",label:i.$t("Custom Price")},{default:u(S=>[S.row.payment_type==="subscription"?(r(),h("div",ST,[s(k,{modelValue:S.row.custom_price,"onUpdate:modelValue":V=>S.row.custom_price=V,min:0,precision:2,step:.01,"controls-position":"right",placeholder:i.$t("Custom price"),size:"small",onChange:V=>i.updateCustomPrice(S.row),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder","onChange"])])):x("",!0)]),_:1},8,["label"])):x("",!0),s(v,{width:50},{default:u(S=>[s(tt,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ge(V=>i.deleteProduct(S.$index,S.row),["prevent"])},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[B,i.calculating]])])):x("",!0)]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{border_bottom:"",title:i.$t("Payment"),title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[o("table",$T,[o("tbody",null,[o("tr",null,[o("td",null,f(i.$t("Subtotal")),1),o("td",null,[i.order.order_items.length>0?(r(),h("span",FT,f(c(la)(i.order.order_items.length))+" "+f(i.order.order_items.length===1?i.$t("item"):i.$t("items")),1)):x("",!0)]),o("td",null,f(i.formatNumber(i.order.subtotal)),1)]),i.order.order_items.length>0&&!i.discount.value?(r(),E(Di,{key:0,order:i.order,couponsAttributes:[],hasCouponAttributes:!1,appliedCouponsAttributes:[],action:"create_order",shouldManageCoupon:!0,"onUpdate:coupons":i.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","onUpdate:coupons"])):x("",!0),i.hasCoupon?x("",!0):(r(),E(Ti,{key:1,order:i.order,hasCoupon:i.hasCoupon,"onUpdate:customDiscount":i.updateCustomDiscount},null,8,["order","hasCoupon","onUpdate:customDiscount"])),x("",!0),i.selectedCustomerCountry&&i.order.order_items.length>0?(r(),h("tr",ET,[o("td",UT,f(i.$t("Tax will be calculated on save")),1)])):x("",!0)]),o("tfoot",null,[o("tr",null,[o("td",null,f(i.$t("Total")),1),A[8]||(A[8]=o("td",null,null,-1)),o("td",null,f(i.formatNumber(i.order.total_amount)),1)])])])]),_:1})]),_:1})]),o("div",IT,[o("div",VT,[s(Vi,{note:i.order.note,onWhenNoteEditIsDone:A[2]||(A[2]=S=>{i.saveNoteModal(S)})},null,8,["note"]),s(mi,{order:i.order,onOnAddressSelected:A[3]||(A[3]=S=>{if(i.fetchShippingMethods(),S===null){i.selectedCustomerCountry="",i.selectedCustomerAddress=null;return}i.selectedCustomerCountry=S.country,i.selectedCustomerAddress=S,S.type==="shipping"?i.order.shipping_address_id=S.id:i.order.billing_address_id=S.id}),onOnAddressRemove:A[4]||(A[4]=()=>{i.selectedCustomerCountry="",i.selectedCustomerAddress=null,i.order.billing_address_id=null,i.order.shipping_address_id=null,i.fetchShippingMethods()})},null,8,["order"]),s(fi,{selectedLabels:i.selectedLabels,"onUpdate:updateLabel":i.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),s(nf,{ref_key:"productItemModal",ref:t,searchQueryParent:i.searchQuery,orderParent:i.order,"onUpdate:searchQuery":i.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),s(w,{"append-to-body":!0,modelValue:i.createProductModal,"onUpdate:modelValue":A[5]||(A[5]=S=>i.createProductModal=S),title:i.$t("Add New Product")},{default:u(()=>[i.createProductModal?(r(),h("div",DT,[s($i,{customModal:"order_modal","onUpdate:createProductModal":i.updateProductModal,onProcess_custom:i.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"])])])}}});class MT extends il{constructor(){super(...arguments);ze(this,"data",{form:Fd()})}get controllerKey(){return"Customer"}}function pf(){return MT.init()}const LT=/^(\d+(?:\.\d+)?|\.\d+)(px|rem|em)?$/,RT=e=>String(Number(e)),OT=e=>{if(e==null)return"";const t=String(e).trim().toLowerCase().match(LT);return t?RT(t[1])+(t[2]||"px"):""},ff=e=>e==null||String(e).trim()===""?!0:OT(e)!=="",ti=e=>`appearance_radius.${e}`,mf=(e,t)=>{const a=e?e[ti(t)]:null;if(!a)return"";if(typeof a=="string")return a;const l=Array.isArray(a)?a:Object.values(a);return l.length?String(l[0]):""},wSe=(e,t,a,l,n)=>{const i={...e||{}};return l.forEach(A=>{const p=t?t[A]:void 0;p!==(a?a[A]:void 0)&&(delete i[ti(A)],ff(p)||(i[ti(A)]=[n]))}),i},PT=(e,t,a={},l=["card","btn","input"])=>!e||e.appearance_source!==t?"":l.find(n=>!ff((e.appearance_radius||{})[n])||mf(a,n)!=="")||"",HT={class:"setting-wrap"},NT={class:"setting-wrap-inner"},KT={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},GT={class:"grid gap-3 mb-6"},zT={class:"grid gap-3 mb-6"},jT={class:"grid gap-3 mb-6"},qT={class:"grid gap-3"},ts=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=pf(),{form:a}=t.data,l=As(),n=M([]),i=M([]),A=M(!0),p=M(!1),m=M(!0),_=M({}),g=Pa(),y=M(g.name),v=M(g.meta.title||"Store Settings"),k=()=>y.value==="reminders",b=G(()=>y.value==="appearance"),w=()=>k()?"email-notification/reminders":"settings/store",B=()=>{var U,D,T,I,L;if(b.value){const O=(T=(D=(U=i.value)==null?void 0:U.appearance)==null?void 0:D.schema)==null?void 0:T.appearance_component,Q=O==null?void 0:O.custom_source,H=PT(a.values,Q,a.data.validationErrors);if(H){mf(a.data.validationErrors,H)||a.setValidationErrors({...a.data.validationErrors,[ti(H)]:[((I=O==null?void 0:O.radius_section)==null?void 0:I.invalid)||d("Fix the highlighted border radius before saving.")]}),j.error(d("Fix the highlighted border radius before saving."));const K=document.getElementById(`fct-appearance-radius-${H}`);K==null||K.scrollIntoView({block:"center",behavior:"smooth"}),K==null||K.focus();return}}p.value=!0;let $=a.values;Array.isArray($.store_logo)&&$.store_logo.length>0&&($.store_logo=(L=$.store_logo)==null?void 0:L[0]),k()||($.settings_name=y.value),ce.post(w(),{...$}).then(O=>{if(j.success(d("Settings saved successfully")),y.value==="store_setup"){const Q=["currency","currency_position","currency_separator","decimal_separator","decimal_points","order_mode","store_name","store_logo","weight_unit","dimension_unit"],H={};if(Q.forEach(function(Y){a.values[Y]!==void 0&&(H[Y]=a.values[Y])}),H.currency){const Y=Ke.get("currency_signs",{});Y[H.currency]!==void 0&&(H.currency_sign=Y[H.currency])}H.decimal_points!==void 0&&(H.is_zero_decimal=parseInt(H.decimal_points,10)===0);const K=Ke.get("shop",{}),z=["currency","currency_position","decimal_separator","decimal_points"].some(function(Y){return H[Y]!==void 0&&H[Y]!==K[Y]});Ke.mergeConfig({shop:Object.assign({},K,H)}),_t.setLocale(),z&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(O=>{var Q;O.status_code=="422"?j.validationErrors(O):j.error((Q=O.data)==null?void 0:Q.message),a.setValidationErrors(O),_.value=O}).finally(()=>{p.value=!1,m.value=!1,A.value=!1})},S=M(!1),V=()=>{A.value=!0,S.value=!1;const $=k()?{}:{settings_name:y.value};ce.get(w(),$).then(U=>{a.setSchema(U.fields).setDefaults(U.settings).initForm(),n.value=U.settings,i.value=U.fields,A.value=!1,m.value=!1,p.value=!1}).catch(U=>{S.value=!0,A.value=!1,m.value=!1,p.value=!1})},F=()=>{l.bind(["mod+s"],$=>{$.preventDefault(),B()})};return be(()=>g.name,($,U)=>{var D;y.value=$,v.value=((D=g.meta)==null?void 0:D.title)||"Store Settings",l.unbind("mod+s"),F(),V()}),Te(()=>{F(),V()}),lA(()=>{l.unbind("mod+s")}),($,U)=>{const D=C("el-skeleton-item"),T=C("el-skeleton"),I=C("el-form");return r(),h("div",HT,[s($a,{heading:v.value,loading:p.value,onOnSave:B},null,8,["heading","loading"]),o("div",NT,[s(Fa),S.value?(r(),E(xe,{key:1},{default:u(()=>[s(Be,null,{default:u(()=>[o("p",null,f(c(d)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(r(),h(P,{key:0},[m.value?(r(),h("div",KT,[s(T,{loading:m.value,animated:""},{template:u(()=>[o("div",GT,[s(D,{variant:"p",class:"w-[20%]"}),s(D,{variant:"p"})]),o("div",zT,[s(D,{variant:"p",class:"w-[20%]"}),s(D,{variant:"p"})]),o("div",jT,[s(D,{variant:"p",class:"w-[20%]"}),s(D,{variant:"p"})]),o("div",qT,[s(D,{variant:"p",class:"w-[20%]"}),s(D,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),m.value?x("",!0):(r(),h(P,{key:1},[c(a).isReady?(r(),E(I,{key:0,class:"relative"},{default:u(()=>[A.value?(r(),E(xe,{key:0},{default:u(()=>[s(Be,null,{default:u(()=>[s(T,{rows:5,animated:""},{default:u(()=>[s(D),s(D,{variant:"text"}),s(D,{variant:"text"})]),_:1})]),_:1})]),_:1})):x("",!0),A.value?x("",!0):(r(),E(Ii,{key:1,form:c(a),showSubmitButton:!b.value,onOnSubmitButtonClick:B,submitButtonText:c(d)("Save"),loading:p.value,onOnChange:U[0]||(U[0]=L=>{}),"validation-errors":_.value},null,8,["form","showSubmitButton","submitButtonText","loading","validation-errors"]))]),_:1})):x("",!0)],64))],64))])])}}}),YT={};function WT(e,t){const a=C("router-view");return r(),h("div",null,[s(a)])}const JT=nt(YT,[["render",WT]]),XT={name:"Licensing",components:{Refresh:uA,Badge:Ht,DynamicIcon:X,CopyToClipboard:Va,SettingsHeader:$a,CardBody:Be,CardContainer:xe,AdminNotice:Fa},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return Ke.get("purchase_fluent_cart_link")}},mounted(){this.disabled||this.getSettings()},methods:{formatDate:hl,translate:d,getSettings(){this.errorMessage="",this.loading=!0,ce.get("settings/license",{verify:!0}).then(e=>{this.licenseData=e}).catch(e=>{j.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){j.error(d("Please provide a license key")),this.errorMessage=d("Please provide a license key");return}this.verifying=!0,this.errorMessage="",ce.post("settings/license",{license_key:this.licenseKey}).then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.data)}).finally(()=>{this.verifying=!1})},deactivateLicense(){this.verifying=!0,ce.delete("settings/license").then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{j.error(e)}).finally(()=>{this.verifying=!1})},maskLicense(e){if(!e)return"";const t=e.slice(0,4),a=e.slice(-4),l="*".repeat(e.length-8);return`${t}${l}${a}`}}},ZT={class:"setting-wrap"},eQ={class:"setting-wrap-inner"},tQ={key:0,class:"fluent_cart_configure_integration_body"},aQ={key:0,class:"fct-license-box-content"},lQ=["href"],sQ={class:"fct-license-box-content-details"},nQ={class:"label"},oQ={class:"license-key"},iQ={class:"label"},rQ={key:1,class:"w-full items-start"},dQ={key:1,class:"fct-license-box-content"},uQ={class:"fct-license-box-content-details"},cQ={key:0},AQ={class:"label"},pQ={class:"license-key"},fQ={class:"label"},mQ={key:2,class:"fct-license-box-content"},hQ={key:0},_Q=["href"],vQ=["innerHTML"];function gQ(e,t,a,l,n,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("DynamicIcon"),g=C("CopyToClipboard"),y=C("el-input"),v=C("el-button"),k=C("CardBody"),b=C("CardContainer"),w=Qa("loading");return r(),h("div",ZT,[s(A,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",eQ,[s(p),s(b,null,{default:u(()=>[s(k,null,{default:u(()=>[s(m,{loading:n.loading,animated:"",rows:6},null,8,["loading"]),o("div",null,[!a.disabled&&!n.loading?Jt((r(),h("div",tQ,[o("div",{class:ue(["fluent_cart_license_box","fct_license_"+n.licenseData.status])},[n.licenseData.status=="expired"?(r(),h("div",aQ,[n.showNewLicenseInput?(r(),h("div",rQ,[o("h3",null,f(i.translate("Your License Key")),1),s(y,{modelValue:n.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=B=>n.licenseKey=B),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"])])):(r(),h(P,{key:0},[s(_,{name:"GradientWarningCircle"}),o("h3",null,f(i.translate("Looks like your license key has been Expired!")),1),o("p",null,[R(f(i.translate("Have a new license Key?"))+" ",1),o("a",{onClick:t[0]||(t[0]=Ge(B=>n.showNewLicenseInput=!n.showNewLicenseInput,["prevent"])),href:"#"},f(i.translate("Click here")),1),t[7]||(t[7]=R()),n.licenseData.renew_url?(r(),h(P,{key:0},[t[6]||(t[6]=R("or ",-1)),o("a",{href:n.licenseData.renew_url,target:"_blank"},f(i.translate("Purchase a new license")),9,lQ)],64)):x("",!0)]),o("div",sQ,[o("p",null,[o("span",nQ,f(i.translate("License Key")),1),o("span",oQ,[R(f(i.maskLicense(n.licenseData.license_key))+" ",1),s(g,{text:n.licenseData.license_key,showMode:"basic_copy_btn",tooltipText:i.translate("Copy License")},null,8,["text","tooltipText"])])]),o("p",null,[o("span",iQ,f(i.translate("Expired At")),1),R(" "+f(i.formatDate(n.licenseData.expires,!0)),1)])])],64))])):n.licenseData.status=="valid"?(r(),h("div",dQ,[s(_,{name:"GradientCheckCircle"}),o("h3",null,f(i.translate("Congratulations! Your license key is valid and activated")),1),o("p",null,[R(f(i.translate("Want to deactivate this license?"))+" ",1),o("a",{onClick:t[2]||(t[2]=Ge(B=>i.deactivateLicense(),["prevent"])),href:"#"},f(i.translate("Click here")),1)]),o("div",uQ,[n.licenseData.license_key?(r(),h("p",cQ,[o("span",AQ,f(i.translate("License Key")),1),o("span",pQ,f(i.maskLicense(n.licenseData.license_key)),1)])):x("",!0),o("p",null,[o("span",fQ,f(i.translate("Expires")),1),R(" "+f(n.licenseData.expires!=="lifetime"?i.formatDate(n.licenseData.expires,!0):n.licenseData.expires),1)])])])):(r(),h("div",mQ,[o("h3",null,f(i.translate("Please Provide a license key of"))+" FluentCart ",1),s(y,{modelValue:n.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=B=>n.licenseKey=B),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"]),n.showNewLicenseInput?x("",!0):(r(),h("p",hQ,[R(f(i.translate("Don't have a license key?"))+" ",1),o("a",{target:"_blank",href:i.purchaseLink},[R(f(i.translate("Purchase one here"))+" ",1),s(_,{name:"External",class:"w-4 h-4"})],8,_Q)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:n.errorMessage},null,8,vQ),n.licenseData.status==="expired"&&n.showNewLicenseInput?(r(),E(v,{key:3,type:"primary",onClick:t[4]||(t[4]=B=>i.verifyLicense())},{default:u(()=>[s(_,{name:"Lock",class:"w-5 h-5"}),R(" "+f(i.translate("Click Here to Renew your License")),1)]),_:1})):["valid","expired"].includes(n.licenseData.status)?x("",!0):(r(),E(v,{key:4,type:"primary",onClick:t[5]||(t[5]=B=>i.verifyLicense())},{default:u(()=>[s(_,{name:"Lock",class:"w-5 h-5"}),R(" "+f(i.translate("Verify License")),1)]),_:1}))],2)])),[[w,n.verifying]]):x("",!0)])]),_:1})]),_:1})])])}const yQ=nt(XT,[["render",gQ]]),bQ={class:"fct-single-order-loader-wrap fct-layout-width"},wQ={class:"single-page-header fct-page-loader-header flex items-start justify-between"},CQ={class:"single-page-body"},kQ={class:"fct-single-order"},BQ={class:"fct-single-order-main"},xQ={class:"fct-single-order-aside"},SQ={class:"fct-admin-sidebar"},$Q={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton");return r(),h("div",bQ,[o("div",wQ,[s(n,{animated:"",class:"flex flex-col items-start gap-2"},{template:u(()=>[s(l,{class:"max-w-180"}),s(l,{class:"max-w-[100px]"})]),_:1}),s(n,{animated:"",class:"flex gap-2 max-w-[100px]"},{template:u(()=>[s(l,{class:"w-2/4"}),s(l,{class:"w-2/4"})]),_:1})]),o("div",CQ,[o("div",kQ,[o("div",BQ,[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:5})]),_:1})]),_:1}),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:5})]),_:1})]),_:1}),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:6})]),_:1})]),_:1}),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:""},{template:u(()=>[s(l,{variant:"p"})]),_:1})]),_:1})]),_:1})]),o("div",xQ,[o("div",SQ,[s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:""},{template:u(()=>[s(l,{variant:"image",class:"rounded w-full h-[138px] mb-2"}),s(l,{variant:"image",class:"rounded w-[90px] h-[90px]"})]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},FQ={class:"fct-product-route-wrap"},EQ={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=Ds({show:!1,message:"",buttonText:"",route:""}),l=M(!1),n=M(!1),i=M(!1),A=Pa(),p=M(!0),m=()=>{i.value=!0,a.show=!1,ce.get("products/"+t.product_id+"/pricing",{with:["product_menu"]}).then(v=>{l.value=v.product,l.value.variants=_(l.value.variants),n.value=v.taxonomies,l.value.post_date=at.utc(l.value.post_date).local().format("YYYY-MM-DDTHH:mm:ssZ"),p.value&&jQuery("#fct_admin_menu_holder").append(v.product_menu),g(!0)}).catch(v=>{var k;(v==null?void 0:v.code)==="fluent_cart_entity_not_found"?(a.show=!0,a.buttonText=dt.get(v,"data.buttonText"),a.message=dt.get(v,"data.message"),a.route=dt.get(v,"data.route"),jQuery(".fct-admin-product-header").remove()):v.status_code=="422"?j.validationErrors(v):j.error((k=v.data)==null?void 0:k.message)}).finally(()=>{i.value=!1})},_=v=>(v.forEach((k,b)=>{k.item_price=k.item_price?Number(k.item_price):0,k.item_cost=k.item_cost?Number(k.item_cost):0,k.compare_price=k.compare_price?Number(k.compare_price):"",k.other_info&&(k.other_info.signup_fee=k.other_info.signup_fee?Number(k.other_info.signup_fee):0),k.rowId=b}),v),g=(v=!1)=>{let k=jQuery(".fct-admin-product-menu"),b=A.name;k.length&&(k.find("li").removeClass("active-menu"),k.find(`li.fct_menu_${b}`).addClass("active-menu")),v&&l.value&&(jQuery("#wp-admin-bar-root-default .fct_view_link").remove(),jQuery("#wp-admin-bar-root-default").append('<li class="fct_view_link" id="wp-admin-bar-view"><a class="ab-item" href="'+l.value.guid+'" target="_blank">View Product</a></li>'))};return be(()=>t.product_id,(v,k)=>{v!==k&&m()}),Te(()=>{m(),g(),window.addEventListener("hashchange",g)}),Ga(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),pi("reload",()=>{p.value=!1,m()}),(v,k)=>{const b=C("router-view");return r(),h("div",FQ,[c(A).name==="product_edit"&&i.value?(r(),E($Q,{key:0})):x("",!0),a.show?(r(),E(hi,{key:1,"button-text":a.buttonText,message:a.message,route:a.route},null,8,["button-text","message","route"])):x("",!0),l.value&&a.show==!1?(r(),E(b,{key:2,product:l.value,taxonomies:n.value},null,8,["product","taxonomies"])):x("",!0)])}}};class UQ extends ds{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="ID"}getTabs(){return{all:d("All"),publish:d("Published"),draft:d("Draft"),physical:d("Physical"),digital:d("Digital"),subscribable:d("Subscribable"),bundle:d("Bundle"),non_bundle:d("Non Bundle")}}getToggleableColumns(){const t=Ke.get("modules_settings.reviews.active")==="yes";return[{label:d("Type"),value:"product_type"},{label:d("Variation"),value:"variation_type"},{label:d("Stock"),value:"stock_availability"},{label:d("Price"),value:"item_price"},{label:d("Status"),value:"post_status"},{label:d("Date"),value:"post_date"},...t?[{label:d("Reviews"),value:"reviews"}]:[]]}getSearchHint(){return d("Search by Id, product title or variation title")}getFetchUrl(){return"products"}parseResponse(t){return t.products}getTableName(){return"product_table"}with(){return["admin_product_list"]}}function hf(e){return UQ.init(e)}const IQ={key:0,class:"fct-dummy-product-content"},VQ={key:0,class:"title"},DQ={class:"text"},TQ={class:"fct-dummy-product-loading"},QQ={class:"fct-loading-bars"},MQ=["id"],LQ={key:1,class:"fct-form-group"},RQ={class:"required"},OQ={class:"dialog-footer"},PQ={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,l=aa().ctx,n=M(!1),i=M([]),A=M(null),p=M(0),m=M(!1),_=M(null),g=M(0),y=b=>{n.value=b},v=(b=0)=>{if(A.value===null){k();return}m.value=!0;const w=i.value[A.value];if(_.value=w,b>w.count-1){setTimeout(()=>{k(),n.value=!1,a("onProductCreated")},1e3);return}p.value=b,l.$post("products/create-dummy",{category:w.category,index:b}).then(B=>{g.value=parseFloat(((b+1)/w.count*100).toFixed(0)),v(b+1)}).catch(B=>{B.code===400?k():v(b+1),l.handleError(B)})},k=()=>{g.value=0,p.value=0,m.value=!1,_.value=null};return Te(()=>{i.value=Ke.get("dummy_product_info")}),(b,w)=>{const B=C("el-button"),S=C("el-progress"),V=C("el-option"),F=C("el-select"),$=C("el-dialog");return r(),h(P,null,[s(B,{onClick:w[0]||(w[0]=U=>y(!0))},{default:u(()=>[s(X,{name:"Stars",class:"hidden lg:inline"}),R(" "+f(b.$t("Add Dummy Product")),1)]),_:1}),s($,{modelValue:n.value,"onUpdate:modelValue":w[4]||(w[4]=U=>n.value=U),title:b.$t("Create Dummy Product"),"append-to-body":!0},sa({default:u(()=>[m.value?(r(),h("div",IQ,[_.value!=null?(r(),h("div",VQ,f(c(d)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):x("",!0),o("div",DQ,[R(f(b.$t("Can close the window - product will continue to insert."))+" ",1),o("div",TQ,[o("div",QQ,[(r(),h(P,null,ae(8,U=>o("div",{key:U,class:"bar-block",id:`bar-block-${U+1}`},null,8,MQ)),64))]),R(" "+f(c(d)("Uploading... %1$s",`${g.value}%`)),1)])]),s(S,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",LQ,[o("label",RQ,f(b.$t("Product Category")),1),s(F,{modelValue:A.value,"onUpdate:modelValue":w[1]||(w[1]=U=>A.value=U),clearable:"",placeholder:b.$t("Select a Product Category")},{default:u(()=>[(r(!0),h(P,null,ae(i.value,(U,D)=>(r(),E(V,{key:D,label:U.title,value:D},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[m.value?void 0:{name:"footer",fn:u(()=>[o("div",OQ,[s(B,{onClick:w[2]||(w[2]=U=>y(!1))},{default:u(()=>[R(f(b.$t("Cancel")),1)]),_:1}),s(B,{type:"primary",onClick:w[3]||(w[3]=()=>{v()}),disabled:!A.value},{default:u(()=>[R(f(b.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},HQ={class:"table-cell"},NQ={class:"fct-product-info-card w-full"},KQ={class:"fct-product-info-media"},GQ={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},zQ={class:"fct-product-info-name flex flex-col items-start gap-3"},jQ={class:"table-cell"},qQ={class:"table-cell"},YQ={class:"table-cell"},WQ={class:"table-cell"},JQ={class:"table-cell"},XQ={class:"table-cell"},ZQ={class:"table-cell"},eM={__name:"ProductsLoader",props:{nextPageCount:{type:Number,default:0},productTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,n)=>n+1);return(l,n)=>{const i=C("el-table-column"),A=C("el-skeleton-item"),p=C("el-table"),m=C("el-skeleton");return r(),E(m,{animated:""},{template:u(()=>[s(p,{data:c(a),class:"w-full compact-table responsive fct-loader-table"},{empty:u(()=>n[0]||(n[0]=[])),default:u(()=>[s(i,{selectable:()=>!1,type:"selection",width:"45"}),s(i,{label:l.$t("Products"),width:"380"},{default:u(()=>[o("div",HQ,[o("div",NQ,[o("div",KQ,[s(A,{variant:"image",class:"w-10 h-10.5 flex-none rounded-md"})]),o("div",GQ,[o("div",zQ,[s(A,{variant:"p",class:"max-w-[190px]"}),s(A,{variant:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(i,{key:0,label:l.$t("Type"),width:"170"},{default:u(()=>[o("div",jQ,[s(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(i,{key:1,label:l.$t("Variation"),width:"150"},{default:u(()=>[o("div",qQ,[s(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(i,{key:2,label:l.$t("Price"),width:"130"},{default:u(()=>[o("div",YQ,[s(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(i,{key:3,label:l.$t("Stock"),width:"100"},{default:u(()=>[o("div",WQ,[s(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(i,{key:4,label:l.$t("Status"),width:"130"},{default:u(()=>[o("div",JQ,[s(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(i,{key:5,label:l.$t("Date"),width:"100"},{default:u(()=>[o("div",XQ,[s(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),s(i,{label:l.$t("Actions"),width:"90",align:"right"},{default:u(()=>[o("div",ZQ,[s(A,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},tM={},aM={class:"px-4 py-3"},lM={class:"flex items-center justify-between mb-3"},sM={class:"grid grid-cols-3 gap-5 mt-5"};function nM(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",aM,[o("div",lM,[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})]),o("div",sM,[(r(),h(P,null,ae(3,n=>o("div",{key:n},[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const oM=nt(tM,[["render",nM]]),iM=["aria-label"],rM={key:0,class:"fct-star fct-star-half","aria-hidden":"true"},dM={class:"fct-star-half-empty"},uM={class:"fct-star-half-fill"},cM={__name:"StarRating",props:{rating:{type:Number,default:0},size:{type:String,default:"small",validator:e=>["small","medium","large"].includes(e)}},setup(e){const t=e,a=G(()=>Math.floor(t.rating)),l=G(()=>t.rating-a.value>=.5),n=p=>p<=a.value?"fct-star-filled":p===a.value+1&&l.value?"fct-star-half":"fct-star-empty",i=G(()=>`fct-star-rating-${t.size}`),A=G(()=>d("%s out of 5 stars",t.rating));return(p,m)=>(r(),h("div",{class:ue(["fct-star-rating",i.value]),role:"img","aria-label":A.value},[(r(),h(P,null,ae(5,_=>(r(),h(P,{key:_},[n(_)==="fct-star-half"?(r(),h("span",rM,[o("span",dM,[s($o)]),o("span",uM,[s($o)])])):(r(),h("span",{key:1,class:ue(["fct-star",n(_)]),"aria-hidden":"true"},[s($o)],2))],64))),64))],10,iM))}},Qi=nt(cM,[["__scopeId","data-v-c7080661"]]),AM={class:"fct-product-action show-on-mobile absolute right-0 top-1"},pM={class:"more-btn pr-3"},fM={class:"flex items-center gap-2"},mM={key:0},hM={key:1},_M={key:2},vM={key:0},gM={key:1},yM={key:0},bM={key:1},wM={key:0},CM={key:1},kM={class:"flex items-center gap-0.5"},BM={class:"text-xs text-gray-500"},xM={key:0},SM={key:1},$M=["innerHTML"],FM=["innerHTML"],EM={class:"fct-product-id hidden",title:"Product ID"},UM={class:"more-btn pr-3"},IM={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const l=Ke.get("modules_settings.reviews.active")==="yes",n=a,i=M(null),A=v=>{v.action==="delete"?Ra(d("Are you sure you want to delete this product : %s ?",v.product.post_title),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{n("delete",v.product.ID)}).catch(k=>{}):v.action==="duplicate"&&n("duplicate",v.product)},p=v=>v.min_price===v.max_price?jt(v.min_price,!0):`${jt(v.min_price,!0)} - ${jt(v.max_price,!0)}`,m=v=>{switch(v){case"physical":return d("Physical");case"digital":return d("Digital");case"bundle":return d("Bundle");default:return Aa.headline(v)}},_=v=>{switch(v){case"simple":return d("Simple");case"simple_variations":return d("Simple Variations");case"advanced_variations":return d("Advanced Variations");default:return v?Aa.headline(v):""}},g=v=>{n("selectionChange",v)};return t({clearSelection:()=>{var v,k;(k=(v=i.value)==null?void 0:v.clearSelection)==null||k.call(v)}}),(v,k)=>{const b=C("el-table-column"),w=C("router-link"),B=C("el-dropdown-item"),S=C("el-dropdown-menu"),V=C("el-dropdown"),F=C("el-tooltip"),$=C("el-table");return r(),E($,{ref_key:"elTableRef",ref:i,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:g},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:u(()=>[s(b,{type:"selection",width:"45"}),s(b,{label:c(d)("Products"),width:"380"},{default:u(U=>[s(ta,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[s(md,{product:U.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",AM,[s(V,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:A,placement:"bottom-end"},{dropdown:u(()=>[s(S,null,{default:u(()=>[U.row.ID?(r(),E(B,{key:0,class:"item-link"},{default:u(()=>[s(w,{to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),s(B,{command:{action:"duplicate",product:U.row}},{default:u(()=>[s(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:2},1032,["command"]),s(B,{command:{action:"delete",product:U.row},class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",pM,[s(X,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(b,{key:0,label:c(d)("Type"),width:"170"},{default:u(U=>[s(ta,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>{var D,T;return[o("div",fM,[((T=(D=U.row.detail)==null?void 0:D.other_info)==null?void 0:T.is_bundle_product)==="yes"?(r(),h("span",mM,f(c(d)("Bundle"))+" - ",1)):x("",!0),U.row.detail?(r(),h("span",hM,f(m(U.row.detail.fulfillment_type)),1)):(r(),h("span",_M,f(c(d)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(b,{key:1,label:c(d)("Variation"),width:"150"},{default:u(U=>[s(ta,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[U.row.detail?(r(),h("span",vM,f(_(U.row.detail.variation_type)),1)):(r(),h("span",gM,f("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(b,{key:2,label:c(d)("Price"),width:"130"},{default:u(U=>[s(ta,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[U.row.detail?(r(),h("span",yM,f(p(U.row.detail)),1)):(r(),h("span",bM,f(c(d)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(b,{key:3,label:c(d)("Stock"),width:"100"},{default:u(U=>[s(ta,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[U.row.detail?(r(),h("span",wM,[U.row.detail.manage_stock.toString()==="0"?(r(),h(P,{key:0},[R(f(c(d)("Unlimited")),1)],64)):(r(),h(P,{key:1},[R(f(c(la)(c(dt).sum(U.row.variants,"available"))),1)],64))])):(r(),h("span",CM,f("")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(b,{key:4,label:c(d)("Status"),width:"130"},{default:u(U=>[s(ta,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[o("div",kM,[(r(),E(Ht,{key:U.row.ID,status:U.row.post_status==="future"?"scheduled":U.row.post_status},null,8,["status"])),U.row.post_status==="future"?(r(),E(F,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:u(()=>[R(f(c(d)("Publishes On: %s",c(hl)(U.row.post_date,!0))),1)]),default:u(()=>[s(X,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(b,{key:5,label:c(d)("Date"),width:"100"},{default:u(U=>[s(ta,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[s(Sa,{"date-time":U.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),l&&e.productTable.isColumnVisible("reviews")?(r(),E(b,{key:6,label:c(d)("Reviews"),width:"130"},{default:u(U=>[s(w,{class:"hover:no-underline flex items-center gap-1.5",to:{name:"reviews",query:{post_id:U.row.ID}},"aria-label":c(d)("View reviews for %s",U.row.post_title)},{default:u(()=>[s(Qi,{rating:U.row.avg_rating||0,size:"small"},null,8,["rating"]),o("span",BM,"("+f(c(la)(U.row.reviews_count||0))+")",1)]),_:2},1032,["to","aria-label"])]),_:1},8,["label"])):x("",!0),(r(!0),h(P,null,ae(e.productTable.getCustomColumns(),U=>(r(),E(b,{label:U.label},{default:u(D=>[U.render_template?(r(),h("div",xM,[(r(),E(bl(yA),{templateContent:U.template,data:{column:U,product:D.row,index:D.$index}},null,8,["templateContent","data"]))])):(r(),h("div",SM,[U.as_link!==!1?(r(),E(ta,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:D.row.ID}}},{default:u(()=>[o("div",{innerHTML:c(dt).get(D.row,U.accessor)},null,8,$M)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:c(dt).get(D.row,U.accessor)},null,8,FM))]))]),_:2},1032,["label"]))),256)),s(b,{label:c(d)("Actions"),width:"90",align:"right"},{default:u(U=>[o("span",EM,"ID: "+f(U.row.ID),1),s(V,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:A,placement:"bottom-end"},{dropdown:u(()=>[s(S,null,{default:u(()=>[U.row.ID?(r(),E(B,{key:0,class:"item-link"},{default:u(()=>[s(w,{to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),s(B,{command:{action:"duplicate",product:U.row}},{default:u(()=>[s(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:2},1032,["command"]),s(B,{command:{action:"delete",product:U.row},class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",UM,[s(X,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},VM={class:"fct-product-table-mobile-wrap"},DM={class:"fct-product-table-mobile-header"},TM={key:0,class:"fct-product-table-post-status-col"},QM={class:"flex items-center gap-1.5"},MM={class:"fct-product-action"},LM={class:"more-btn"},RM=["onClick"],OM={class:"fct-product-table-mobile-body-header"},PM={class:"fct-product-table-date-col"},HM={class:"invoice-no",title:"Product ID"},NM={key:0,class:"fct-product-table-price-col"},KM={key:0},GM={key:1},zM={class:"fct-product-table-product-col"},jM=["onClick"],qM={key:0,class:"fct-product-table-product-type"},YM={class:"title"},WM={key:0,class:"value"},JM={key:1,class:"value"},XM={key:1,class:"fct-product-table-variation-col"},ZM={class:"title"},e7={key:0,class:"value"},t7={key:1,class:"value"},a7={key:2,class:"fct-product-table-stock-col"},l7={class:"title"},s7={key:0,class:"value"},n7={key:1},o7={key:0,class:"fct-product-table-mobile-footer"},i7={class:"fct-product-table-stock-col"},r7={key:0,class:"title"},d7=["innerHTML"],u7=["innerHTML"],c7={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,l=p=>{p.action==="delete"&&Ra(d("Are you sure you want to delete this product : %s ?",p.product.post_title),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{a("delete",p.product.ID)}).catch(m=>{})},n=p=>p.min_price===p.max_price?jt(p.min_price,!0):`${jt(p.min_price,!0)} - ${jt(p.max_price,!0)}`,i=p=>{switch(p){case"physical":return d("Physical");case"digital":return d("Digital");default:Aa.headline(p)}},A=p=>{switch(p){case"simple":return d("Simple");case"simple_variations":return d("Simple Variations");default:Aa.headline(p)}};return(p,m)=>{const _=C("el-tooltip"),g=C("router-link"),y=C("el-dropdown-item"),v=C("el-dropdown-menu"),k=C("el-dropdown");return r(),h("div",VM,[(r(!0),h(P,null,ae(e.productTable.getTableData(),(b,w)=>(r(),h("div",{key:b.id,class:"fct-product-table-mobile-row"},[o("div",DM,[e.productTable.isColumnVisible("post_status")?(r(),h("div",TM,[o("div",QM,[(r(),E(Ht,{key:b.ID,status:b.post_status,onClick:B=>p.$router.push({name:"product_edit",params:{product_id:b.ID}})},null,8,["status","onClick"])),b.post_status==="future"?(r(),E(_,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:u(()=>[R(f(c(d)("Publishes On: %s",c(hl)(b.post_date,!0))),1)]),default:u(()=>[s(X,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):x("",!0)])])):x("",!0),o("div",MM,[s(k,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[s(v,null,{default:u(()=>[b.ID?(r(),E(y,{key:0,class:"item-link"},{default:u(()=>[s(g,{to:{name:"product_edit",params:{product_id:b.ID}}},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),s(y,{command:{action:"delete",product:b},class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",LM,[s(X,{name:"More"})])]),_:2},1024)])]),o("div",{class:"fct-product-table-mobile-body",onClick:B=>p.$router.push({name:"product_edit",params:{product_id:b.ID}})},[o("div",OM,[o("div",PM,[e.productTable.isColumnVisible("post_date")?(r(),h(P,{key:0},[s(Sa,{class:"date","date-time":b.post_date,"with-time":!1},null,8,["date-time"]),m[0]||(m[0]=o("span",{class:"bullet"},"•",-1))],64)):x("",!0),o("span",HM,"#"+f(b.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",NM,[b.detail?(r(),h("span",KM,f(n(b.detail)),1)):(r(),h("span",GM,f(c(d)("Set Price")),1))])):x("",!0)]),o("div",zM,[s(md,{product:b},null,8,["product"])])],8,RM),o("div",{class:"fct-product-table-mobile-footer",onClick:B=>p.$router.push({name:"product_edit",params:{product_id:b.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),h("div",qM,[o("div",YM,f(c(d)("Type")),1),b.detail?(r(),h("span",WM,f(i(b.detail.fulfillment_type)),1)):(r(),h("span",JM,f("N/A")))])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",XM,[o("div",ZM,f(c(d)("Variation")),1),b.detail?(r(),h("span",e7,f(A(b.detail.variation_type)),1)):(r(),h("span",t7,f("N/A")))])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",a7,[o("div",l7,f(c(d)("Stock")),1),b.detail?(r(),h("span",s7,[b.detail.manage_stock.toString()==="0"?(r(),h(P,{key:0},[R(f(c(d)("Unlimited")),1)],64)):(r(),h(P,{key:1},[R(f(c(la)(c(dt).sum(b.variants,"available"))),1)],64))])):(r(),h("span",n7,f("")))])):x("",!0)],8,jM),e.productTable.getCustomColumns()?(r(),h("div",o7,[(r(!0),h(P,null,ae(e.productTable.getCustomColumns(),B=>(r(),h("div",i7,[B.label?(r(),h("div",r7,f(B.label),1)):x("",!0),B.render_template?(r(),E(bl(yA),{key:1,templateContent:B.template,data:B,column:B,row:b},null,8,["templateContent","data","column","row"])):(r(),h(P,{key:2},[B.as_link!==!1?(r(),E(ta,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:b.ID}}},{default:u(()=>[o("div",{innerHTML:c(dt).get(b,B.accessor)},null,8,d7)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:c(dt).get(b,B.accessor)},null,8,u7))],64))]))),256))])):x("",!0)]))),128))])}}},A7={class:"product-action-modal"},p7={class:"fct-alert-content"},f7={class:"fct-alert-title"},m7={class:"fct-alert-text"},h7={class:"fct-alert-subtext"},_7={key:1,class:"product-info"},v7={class:"info-text"},g7={key:0},y7={key:1},b7={key:2},w7={key:2,class:"options-wrapper"},C7={key:4,class:"products-preview"},k7={class:"preview-title"},B7={class:"product-list"},x7={class:"product-name"},S7={key:0,class:"remaining-count"},$7={key:5,class:"progress-section"},F7={class:"progress-text"},E7={key:6,class:"results-section"},U7={class:"dialog-footer"},I7={key:0,class:"el-icon-delete"},V7={__name:"ProductActionModal",props:{modelValue:{type:Boolean,default:!1},action:{type:String,required:!0,validator:e=>["duplicate","delete"].includes(e)},productId:{type:[Number,String],default:null},productName:{type:String,default:""},products:{type:Array,default:()=>[]},productIds:{type:Array,default:()=>[]}},emits:["update:modelValue","completed"],setup(e,{emit:t}){const a=e,l=t,n=M(a.modelValue),i=M(!1),A=M(!1),p=M(!1),m=M(0),_=M(0),g=M(0),y=M({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=Ke.get("app_config.isProActive"),k=Ke.get("modules_settings.stock_management.active"),b=G(()=>a.action==="duplicate"),w=G(()=>a.action==="delete"),B=G(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),S=G(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),V=G(()=>B.value?d(b.value?"Bulk Duplicate Products":"Bulk Delete Products"):d(b.value?"Duplicate Product":"Delete Product")),F=G(()=>w.value?d(B.value?"Delete Products":"Delete Product"):d(B.value?"Duplicate Products":"Duplicate Product")),$=G(()=>a.products.slice(0,5)),U=G(()=>{const Z=S.value-5;return Z>0?Z:0}),D=G(()=>S.value===0?0:Math.round(m.value/S.value*100)),T=G(()=>{if(g.value>0&&m.value===S.value)return"exception";if(m.value===S.value)return"success"});be(()=>a.modelValue,Z=>{n.value=Z,Z&&(y.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},A.value=!1,p.value=!1,m.value=0,_.value=0,g.value=0,i.value=!1)}),be(n,Z=>{l("update:modelValue",Z)});const I=()=>{!A.value&&!i.value&&(n.value=!1,(p.value&&_.value>0||!B.value&&!p.value)&&l("completed"))},L=()=>{B.value?K():O()},O=()=>{i.value=!0,b.value?Q():H()},Q=()=>{ce.post(`products/${a.productId}/duplicate`,{import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles}).then(Z=>{j.success(Z.message||d("Product duplicated successfully")),l("completed"),I()}).catch(Z=>{var re,q;((re=Z.status_code)==null?void 0:re.toString())==="422"?j.validationErrors(Z):j.error(((q=Z.data)==null?void 0:q.message)||d("Failed to duplicate product"))}).finally(()=>{i.value=!1})},H=()=>{ce.delete(`products/${a.productId}`).then(Z=>{j.success(Z.message||d("Product deleted successfully")),l("completed"),I()}).catch(Z=>{var re,q;((re=Z.status_code)==null?void 0:re.toString())==="422"?j.validationErrors(Z):j.error(((q=Z.data)==null?void 0:q.message)||d("Failed to delete product"))}).finally(()=>{i.value=!1})},K=async()=>{A.value=!0,m.value=0,_.value=0,g.value=0,b.value?await W():await z(),A.value=!1,p.value=!0,Y()},W=async()=>{const Z={import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles},re=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(q=>q.ID);for(const q of re){try{await ce.post(`products/${q}/duplicate`,Z),_.value++}catch{g.value++}m.value++}},z=async()=>{const Z=a.products&&a.products.length>0?a.products:[];for(const re of Z){try{await ce.delete(`products/${re.ID}`),_.value++}catch{g.value++}m.value++}},Y=()=>{const Z=b.value;_.value>0&&g.value===0?j.success({message:Z?d("All products duplicated successfully"):d("All products deleted successfully")}):_.value>0&&g.value>0?j.warning({message:Z?d("Some products were duplicated successfully"):d("Some products were deleted successfully")}):j.error({message:Z?d("Failed to duplicate products"):d("Failed to delete products")})};return(Z,re)=>{const q=C("el-checkbox"),Ae=C("el-progress"),ie=C("el-alert"),J=C("el-button"),N=C("el-dialog");return r(),E(N,{modelValue:n.value,"onUpdate:modelValue":re[3]||(re[3]=le=>n.value=le),title:V.value,"append-to-body":!0,width:"500px",onClose:I,"modal-class":"fct-duplicate-product-modal"},{footer:u(()=>[o("div",U7,[s(J,{onClick:I,disabled:A.value},{default:u(()=>[R(f(A.value||p.value?c(d)("Close"):c(d)("Cancel")),1)]),_:1},8,["disabled"]),p.value?x("",!0):(r(),E(J,{key:0,type:w.value?"danger":"primary",loading:i.value||A.value,disabled:i.value||A.value,onClick:L},{default:u(()=>[w.value?(r(),h("i",I7)):x("",!0),R(" "+f(F.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:u(()=>[o("div",A7,[w.value?(r(),E(ol,{key:0,icon:"WarningFill",type:"error"},{content:u(()=>[o("div",p7,[o("h3",f7,f(c(d)("Are you sure?")),1),o("p",m7,[R(f(c(d)("You are about to permanently delete"))+" ",1),o("strong",null,f(S.value),1),R(" "+f(c(d)(S.value===1?"product":"products"))+". ",1)]),o("p",h7,f(c(d)("This action cannot be undone.")),1)])]),_:1})):x("",!0),b.value?(r(),h("div",_7,[o("div",v7,[R(f(c(d)(B.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),B.value?(r(),h("strong",g7,f(S.value),1)):(r(),h("strong",y7,f(e.productName),1)),B.value?(r(),h("span",b7,f(c(d)(S.value===1?"product":"products")),1)):x("",!0)])])):x("",!0),b.value?(r(),h("div",w7,[s(q,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":re[0]||(re[0]=le=>y.value.importDownloadableFiles=le),label:c(d)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),s(q,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":re[1]||(re[1]=le=>y.value.importLicenseSettings=le),label:c(d)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),c(k)==="yes"?(r(),h(P,{key:0},[c(v)?(r(),E(q,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":re[2]||(re[2]=le=>y.value.importStockManagement=le),label:c(d)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),E(q,{key:1,disabled:!0,size:"large"},{default:u(()=>[R(f(c(d)("Import Stock Management"))+" ",1),s(X,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):x("",!0)])):x("",!0),b.value?(r(),E(ol,{key:3,type:"warning",icon:"InformationFill"},{default:u(()=>[o("span",null,f(c(d)(B.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):x("",!0),w.value&&B.value&&!A.value&&!p.value?(r(),h("div",C7,[o("p",k7,f(c(d)("Products to be deleted:")),1),o("ul",B7,[(r(!0),h(P,null,ae($.value,le=>(r(),h("li",{key:le.ID,class:"product-item"},[o("span",x7,f(le.post_title),1)]))),128)),U.value>0?(r(),h("li",S7,f(c(d)("... and %s more",U.value)),1)):x("",!0)])])):x("",!0),B.value&&A.value?(r(),h("div",$7,[s(Ae,{percentage:D.value,status:T.value},null,8,["percentage","status"]),o("p",F7,f(c(d)(w.value?"Deleting":"Duplicating"))+" "+f(m.value)+" / "+f(S.value),1)])):x("",!0),B.value&&p.value?(r(),h("div",E7,[_.value>0?(r(),E(ie,{key:0,title:c(d)(w.value?"Successfully deleted %s product(s)":"Successfully duplicated %s product(s)",_.value),type:"success",closable:!1,"show-icon":""},null,8,["title"])):x("",!0),g.value>0?(r(),E(ie,{key:1,title:c(d)(w.value?"Failed to delete %s product(s)":"Failed to duplicate %s product(s)",g.value),type:"error",closable:!1,"show-icon":"",style:{"margin-top":"10px"}},null,8,["title"])):x("",!0)])):x("",!0)])]),_:1},8,["modelValue","title"])}}},D7={class:"fct-all-products-page fct-layout-width"},T7={class:"fct-all-products-wrap"},Q7={key:0,class:"bulk-actions-bar"},M7={class:"bulk-left flex items-center gap-2"},L7={class:"bulk-right"},R7={key:1,class:"fct-products-table-wrap"},O7={__name:"AllProducts",setup(e){const t=hf({instance:aa()}),a=M(!1),l=M(!1),n=M("duplicate"),i=M(null),A=M([]),p=M(""),m=M(!1),_=()=>{m.value=window.innerWidth<768},g=D=>{ce.delete(`products/${D}`).then(T=>{j.success(T),t.fetch()}).catch(T=>{var I;T.status_code.toString()==="422"?j.validationErrors(T):j.error((I=T.data)==null?void 0:I.message)})},y=D=>{i.value=D,A.value=[],n.value="duplicate",l.value=!0},v=()=>{t.fetch(),i.value=null,A.value=[]},k=()=>{var D,T;t.fetch(),A.value=[],p.value="",(T=(D=U.value)==null?void 0:D.clearSelection)==null||T.call(D)},b=D=>{A.value=D},w=()=>{if(A.value.length===0){j.warning({message:d("Please select at least one product to duplicate")});return}i.value=null,n.value="duplicate",l.value=!0},B=()=>{if(A.value.length===0){j.warning({message:d("Please select at least one product to delete")});return}i.value=null,n.value="delete",l.value=!0},S=()=>{if(!p.value){j.warning({message:d("Please select a bulk action")});return}p.value==="duplicate"?w():p.value==="delete"&&B()},V=G(()=>A.value.map(D=>D.ID)),F=G(()=>A.value.length>0),$=G(()=>A.value.length>0),U=M(null);return Te(()=>{_(),window.addEventListener("resize",_)}),xt(()=>{window.removeEventListener("resize",_)}),(D,T)=>{const I=C("el-icon"),L=C("el-button"),O=C("el-dropdown-item"),Q=C("el-dropdown-menu"),H=C("el-dropdown"),K=C("el-option"),W=C("el-select"),z=C("el-dialog");return r(),h("div",D7,[s(Xa,{title:c(d)("Products")},{action:u(()=>[s(Lt,{permission:"products/view"},{default:u(()=>[s(H,{trigger:"click","popper-class":"fct-dropdown",onCommand:T[3]||(T[3]=()=>{}),placement:"bottom-end"},{dropdown:u(()=>[s(Q,null,{default:u(()=>[s(Lt,{permission:"products/create"},{default:u(()=>[s(O,{class:"item-link"},{default:u(()=>[s(PQ,{onOnProductCreated:T[0]||(T[0]=Y=>c(t).fetch()),products:c(t).getTableData()},null,8,["products"])]),_:1}),s(O,{onClick:T[1]||(T[1]=Y=>D.$router.push({name:"product_bulk_insert"}))},{default:u(()=>[s(X,{name:"Insert"}),R(" "+f(c(d)("Bulk Product Insert")),1)]),_:1}),s(O,{onClick:T[2]||(T[2]=Y=>D.$router.push({name:"product_bulk_edit"}))},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(c(d)("Bulk Product Edit")),1)]),_:1})]),_:1})]),_:1})]),default:u(()=>[s(L,null,{default:u(()=>[R(f(c(d)("More actions"))+" ",1),s(I,null,{default:u(()=>[s(c(Ls))]),_:1})]),_:1})]),_:1})]),_:1}),s(Lt,{permission:"products/create"},{default:u(()=>[s(L,{type:"primary",onClick:T[4]||(T[4]=()=>{a.value=!0})},{default:u(()=>[R(f(c(d)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),s(Lt,{permission:"products/view"},{default:u(()=>[o("div",T7,[s(us,{table:c(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(oM,{key:0})):x("",!0),s(c7,{"product-table":c(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:u(()=>[s(Gl,{name:"slide-fade"},{default:u(()=>[F.value?(r(),h("div",Q7,[o("div",M7,[s(W,{size:"small",class:"bulk-select min-w-[180px]",placeholder:c(d)("Select Bulk Action"),modelValue:p.value,"onUpdate:modelValue":T[5]||(T[5]=Y=>p.value=Y)},{default:u(()=>[s(K,{label:c(d)("Duplicate"),value:"duplicate"},null,8,["label"]),s(K,{label:c(d)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),s(L,{size:"small",type:p.value==="delete"?"danger":"primary",disabled:!p.value,onClick:S},{default:u(()=>[p.value==="delete"?(r(),E(X,{key:0,name:"Delete",class:"w-4 h-4"})):p.value==="duplicate"?(r(),E(X,{key:1,name:"Copy",class:"w-4 h-4"})):x("",!0),R(" "+f(c(d)("Confirm")),1)]),_:1},8,["type","disabled"])]),o("div",L7,f(A.value.length)+" "+f(c(d)("item(s) selected")),1)])):x("",!0)]),_:1}),c(t).isLoading()?(r(),E(eM,{key:0,productTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",R7,[s(IM,{ref_key:"productTableRef",ref:U,"product-table":c(t),onDelete:g,onDuplicate:y,onSelectionChange:b},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),s(Lt,{permission:"products/create"},{default:u(()=>{var Y,Z;return[s(z,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":T[6]||(T[6]=re=>a.value=re),title:c(d)("Add New Product")},{default:u(()=>[a.value?(r(),E($i,{key:0})):x("",!0)]),_:1},8,["modelValue","title"]),s(V7,{modelValue:l.value,"onUpdate:modelValue":T[7]||(T[7]=re=>l.value=re),action:n.value,"product-id":(Y=i.value)==null?void 0:Y.ID,"product-name":(Z=i.value)==null?void 0:Z.post_title,products:$.value?A.value:[],"product-ids":$.value?V.value:[],onCompleted:T[8]||(T[8]=re=>$.value?k():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},P7=nt(O7,[["__scopeId","data-v-b4bb1bad"]]);let H7=0;function _l(){return"_cid_"+ ++H7}const fs={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Hd extends il{constructor(){super(...arguments);ze(this,"data",{visibleColumns:[],options:{status:[{title:"Published",value:"published"},{title:"Draft",value:"draft"}],fulfilment:[{title:"Physical",value:"physical"},{title:"Digital",value:"digital"}],variation:[{title:"Simple",value:"simple"},{title:"Simple Variations",value:"simple_variations"}]},dummies:{productDetail:{variation_type:"simple",manage_stock:1,fulfillment_type:"physical",stock_availability:fs.IN_STOCK},variation:{variation_title:"",sku:"",item_price:0,compare_price:0,serial_index:1,fulfillment_type:"",manage_stock:1,total_stock:100,available:100,committed:0,on_hold:0,stock_status:fs.IN_STOCK},variationDetail:{description:"",payment_type:"onetime",installment:"no",times:"",repeat_interval:"",trial_days:"",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no"},variationImage:{id:"",url:"",title:""},gallery:{id:"",url:"",title:""},downloadableFile:{title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",settings:"",serial:1}}});ze(this,"ensureProductVariantIsArray",a=>{Array.isArray(a.variants)||(a.variants=[])})}getDummyVariation(a){var i;const l=a==null?void 0:a.variants,n={...this.data.dummies.variation};return n.serial_index=Array.isArray(l)?l.length+1:1,n.fulfillment_type=(i=a==null?void 0:a.detail)==null?void 0:i.fulfillment_type,n.other_info={...this.data.dummies.variationDetail},n.media=[],n._cid=_l(),n}addVariationToProduct(a){this.ensureProductVariantIsArray(a),a.variants.push(this.getDummyVariation(a))}handleVariationChanged(a,l){l==="simple_variations"?this.addVariationToProduct(a):a.variants=[]}getColumnWidthStorageKey(){return""}saveColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const n={};a.forEach(i=>{i.key&&(n[i.key]=i.width)}),Qt.set(l,n)}restoreColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const n=Qt.get(l);n&&typeof n=="object"&&a.forEach(i=>{i.key&&n[i.key]!==void 0&&(i.width=n[i.key])})}getColumnStorageKey(){return""}getToggleableColumns(){return[]}setupColumnVisibility(){const a=this.getColumnStorageKey();if(!a)return;const l=Qt.get(a);Array.isArray(l)?this.data.visibleColumns=l:this.data.visibleColumns=this.getToggleableColumns().map(n=>n.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&Qt.set(a,this.data.visibleColumns)}isColumnVisible(a){return this.data.visibleColumns.includes(a)}get downloadableFileSchema(){return{product_variation_id:[],title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",settings:{download_limit:"",download_expiry:"",bucket:""},serial:""}}syncStockStatus(a){var i;if(!Array.isArray(a.variants))return;if(!((i=a.detail)==null?void 0:i.manage_stock)){for(const A of a.variants)A.stock_status=fs.IN_STOCK;a.detail&&(a.detail.stock_availability=fs.IN_STOCK);return}let n=!0;for(const A of a.variants){const p=parseInt(A.available,10)||0;A.stock_status=p>0?fs.IN_STOCK:fs.OUT_OF_STOCK,p>0&&(n=!1)}a.detail&&(a.detail.stock_availability=n?fs.OUT_OF_STOCK:fs.IN_STOCK)}addDummyDownloadableFiles(a){const l=a;Array.isArray(l.downloadable_files)||(l.downloadable_files=[]),l.downloadable_files.push(this.downloadableFileSchema)}}const N7=["id","post_id","variation_title","fulfillment_type"],K7=["sku","item_price","compare_price","item_cost","manage_cost","shipping_class","other_info","manage_stock","serial_index","total_stock","available","committed","on_hold","stock_status","sold_individually","media","downloadable","payment_type"],G7=["total_stock","available","committed","on_hold","manage_stock"];function z7(e){const t=new Map;return(Array.isArray(e)?e:[]).forEach(a=>{a&&a.id!==void 0&&a.id!==null&&t.set(String(a.id),a)}),t}function _f(e,t,a){if(!Array.isArray(e))return[];const l=z7(t);return e.filter(Boolean).filter(n=>n.id===void 0||n.id===null?!0:l.has(String(n.id))).map(n=>{const i=l.get(String(n.id))||{},A={};return N7.forEach(p=>{const m=n[p]!==void 0?n[p]:i[p];m!==void 0&&(A[p]=m)}),(A.post_id===void 0||A.post_id===null)&&(A.post_id=a),K7.forEach(p=>{if(n[p]!==void 0){if(p==="other_info"){A.other_info={...i.other_info||{},...n.other_info||{}};return}A[p]=n[p]}}),A})}function j7(e,t,a){const l=Array.isArray(t)?t:[],i={...(Array.isArray(e)?e.filter(Boolean):[])[0]||{}},A=(i.id!==void 0?l.find(p=>p&&String(p.id)===String(i.id)):null)||l[0]||{};return i.id===void 0&&(i.id=A.id),i.other_info===void 0&&(i.other_info=A.other_info),G7.forEach(p=>{delete i[p]}),_f([i],l,a)}function q7(e){return e==null||e===""?null:e}class Y7 extends Hd{constructor(){super(...arguments);ze(this,"data",{product:{},original_product:{},product_changes:{},validationErrors:{},excerptWordCount:0,maxExcerptWordCount:0,hasChange:!1,saving:!1,product_snapshot:{},discardKey:0,savedVariationLength:0,productDownloadableModel:null,metaValue:null,hasChangeLongDescEditor:!1,reloader:()=>{},onProductUpdatedListener:{}});ze(this,"router",Oa());ze(this,"_mergeOtherInfo",(a,l)=>{const n=JSON.parse(JSON.stringify(l));Object.keys(n).forEach(i=>{a[i]=n[i]}),Object.keys(a).forEach(i=>{i in n||delete a[i]})});ze(this,"_mergeSnapshot",a=>{const l=this.data.product,n=new Set(["ID","guid","variants","detail","downloadable_files","product_terms","taxonomies","variantOptions"]);if(Object.keys(a).forEach(i=>{if(n.has(i))return;const A=a[i];l[i]=A!==null&&typeof A=="object"?JSON.parse(JSON.stringify(A)):A}),a.detail&&l.detail){const i=JSON.parse(JSON.stringify(a.detail));Object.keys(i).forEach(A=>{A!=="other_info"&&(l.detail[A]=i[A])}),i.other_info&&(l.detail.other_info||(l.detail.other_info={}),this._mergeOtherInfo(l.detail.other_info,i.other_info))}if(Array.isArray(a.variants)&&Array.isArray(l.variants)){const i={};a.variants.forEach(p=>{p.id&&(i[p.id]=p)});const A=new Set(["id","post_id","rowId","media","created_at","updated_at"]);l.variants.forEach(p=>{const m=i[p.id];m&&Object.keys(m).forEach(_=>{if(A.has(_))return;const g=m[_];_==="other_info"&&p.other_info?this._mergeOtherInfo(p.other_info,g):p[_]=g!==null&&typeof g=="object"?JSON.parse(JSON.stringify(g)):g})})}});ze(this,"addDummyVariant",()=>{var a,l;return{post_id:this.product.detail.post_id,serial_index:this.variantsLength()+1,variation_title:"",item_price:"",compare_price:"",manage_cost:"yes",item_cost:"",profit:"--",profit_margin:"--",manage_stock:this.product.detail.manage_stock,stock_status:"in-stock",total_stock:1,on_hold:0,committed:0,available:1,fulfillment_type:this.product.detail.fulfillment_type,media:[],other_info:{description:"",payment_type:"onetime",tax_class:"standard",tax_exempt:"no",tax_inclusion:"",times:"",repeat_interval:"yearly",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no",package_slug:"",weight:null,weight_unit:((l=(a=window.fluentCartAdminApp)==null?void 0:a.shop)==null?void 0:l.weight_unit)||"kg"},downloadable:"true"}});ze(this,"formatPricing",a=>(a.forEach((l,n)=>{l.item_price=l.item_price?Number(l.item_price):0,l.item_cost=l.item_cost?Number(l.item_cost):0,l.compare_price=l.compare_price?Number(l.compare_price):0,l.other_info&&(l.other_info.signup_fee=l.other_info.signup_fee?Number(l.other_info.signup_fee):0),l.rowId=n}),a));ze(this,"onChangePricing",(a,l,n)=>{this.ensureVariationIndex(l),this.product.variants[l][a]=n,a==="item_price"&&this.onChangePricingPayment(this.product.variants[l],n,l),this.data.product_changes.detail||(this.data.product_changes.detail.id=this.product.detail.id),this.data.product_changes.variants[l][a]=n,this.data.product_changes.variants[l].id=this.product.variants[l].id,(a==="item_price"||a==="compare_price")&&this.validateComparePrice(l),this.setHasChange(!0)});ze(this,"updateLongDescEditorChange",a=>{this.setHasChangeLongDescEditor(!0),ce.post(`products/${this.product.ID}/update-long-desc-editor-mode`,{active_editor:a??"wp-editor"}).then(l=>{j.success(l.message)}).catch(l=>{l&&l.message&&j.error(l)}).finally(()=>{this.setHasChangeLongDescEditor(!1)})});ze(this,"onChangePricingPayment",(a,l,n)=>{var i;if(a.item_price!==""&&a.other_info.repeat_interval!==""){let A=parseInt(a.other_info.times)?d("for %s Times",(i=a==null?void 0:a.other_info)==null?void 0:i.times):d("Until Cancel");const p=`${jt(a.item_price,!0)} ${a.other_info.repeat_interval} ${A}`;return this.data.product_changes.variants[n].billing_summary=p,this.data.product_changes.variants[n].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=p}return this.data.product_changes.variants[n].billing_summary="",this.data.product_changes.variants[n].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=""});ze(this,"onUploadPricingMedia",(a,l,n)=>{this.product.variants[l][a]=[],this.product.variants[l][a]=[...this.product.variants[l][a],...n];const i=this.product.variants[l].id;ce.post(`products/variants/${i}/setMedia`,{media:this.product.variants[l].media}).then(A=>{j.success(A.message)}).catch(A=>{var p;A.status_code=="422"?j.validationErrors(A):j.error((p=A.data)==null?void 0:p.message)}).finally(()=>{})});ze(this,"afterCreatingOrUpdatingPricing",(a,l)=>{l.created_at=l.created_at??new Date().toLocaleDateString()+""+new Date().toLocaleTimeString(),a!==void 0&&a!=null?this.product.variants[a]=l:(l.rowId=this.variantsLength()>0?this.data.product.variants[this.variantsLength()-1].rowId+1:this.variantsLength(),this.data.product.variants.push(l),a=this.variantsLength()-1),this.data.productDownloadableModel.setDownloadableFiles(this.data.product.downloadable_files)});ze(this,"createOrUpdatePricing",a=>{this.setSaving(!0),this.setValidationErrors({});let l="";return a.id!=null?l=ce.post(`products/variants/${a.id}`,{variants:a}):l=ce.post("products/variants",{variants:a}),l.then(n=>(j.success(n.message),Object.values(this.data.onProductUpdatedListener).forEach(i=>{typeof i=="function"&&i(this.product)}),this.saveSnapshot(),n)).catch(n=>{var i;n.status_code=="422"?(j.validationErrors(n),this.setValidationErrors(n.data)):j.error((i=n.data)==null?void 0:i.message)}).finally(()=>{this.setSaving(!1)})});ze(this,"updatePricingValue",(a,l,n,i,A)=>{if(n.includes(".")&&(n=n.split(".").pop()),this.ensureVariationIndex(n),n!==void 0&&this.clearValidationError(`${n}.${a}`),i[a]=l,a==="item_price"&&this.onChangePricingPayment(i,l,n),a==="item_cost"){const p=parseFloat(l);i.item_cost=isNaN(p)||p<0?0:p}parseFloat(i.item_cost)>parseFloat(i.item_price)&&(i.item_cost=0),this.data.product_changes.variants[n][a]=a==="item_cost"?i[a]:l,this.data.product_changes.variants[n].id=i.id,this.data.product_changes.detail.id=this.product.detail.id,this.product.detail.variation_type==="simple"&&(a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.variants[n].fulfillment_type=l),this.product.variants[0]=i,this.setHasChange(!0)),(a==="item_price"||a==="compare_price")&&this.validateComparePrice(n)});ze(this,"updatePricingOtherValue",(a,l,n=null,i,A="")=>{this.ensureVariationIndex(n),["payment_type","times","repeat_interval","trial_days","installment","manage_setup_fee","signup_fee_name","signup_fee","billing_summary","setup_fee_per_item","purchasable","tax_class","tax_exempt","tax_inclusion","weight","length","width","height","package_slug","weight_unit","manage_stock"].includes(a)&&(n!==void 0&&this.clearValidationError(`${n}.other_info.${a}`),i.other_info[a]=l,this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[n].other_info||(this.data.product_changes.variants[n].other_info={}),this.data.product_changes.variants[n].other_info[a]=l,i.other_info.payment_type==="subscription"&&(a==="times"&&parseInt(l)<0&&(i.other_info.times=0),i.other_info.times=i.other_info.times??"",i.other_info.repeat_interval=i.other_info.repeat_interval??"",i.other_info.trial_days=i.other_info.trial_days??0,i.other_info.billing_summary=i.other_info.billing_summary??"",i.other_info.manage_setup_fee=i.other_info.manage_setup_fee??"no",i.other_info.signup_fee_name=i.other_info.signup_fee_name??"",i.other_info.signup_fee=i.other_info.signup_fee??"",i.other_info.setup_fee_per_item=i.other_info.setup_fee_per_item??"no"),this.data.product_changes.variants[n].other_info=i.other_info,this.data.product_changes.variants[n].id=i.id,this.data.product_changes.detail.id=this.product.detail.id,["payment_type","times","repeat_interval","manage_setup_fee","signup_fee_name","signup_fee","billing_summary","setup_fee_per_item","purchasable"].includes(a)&&this.onChangePricingPayment(i,l,n)),["media"].includes(a)&&(i.media=[],i.media=[...i.media,...l],this.data.product_changes.variants[n].media=i.media,this.data.product_changes.variants[n].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),["description"].includes(a)&&(n!==void 0&&this.clearValidationError(`${n}.other_info.${a}`),this.data.product_changes.variants[n].other_info||(this.data.product_changes.variants[n].other_info={}),i.other_info[a]=l,this.data.product_changes.variants[n].other_info[a]=l,this.data.product_changes.variants[n].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),this.product.detail.variation_type==="simple"&&(this.product.variants[0]=i,this.data.product_changes.variants=[],this.data.product_changes.variants[0]=i,this.data.product_changes.variants[0].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),A==="add"&&this.setHasChange(!0)});ze(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});ze(this,"deletePricing",(a,l)=>On.ofDelete(d("Are you sure, you want to delete this price?")).then(()=>{if(a!==void 0)return ce.delete(`products/variants/${a}`).then(n=>{j.success(n.message),this.afterDeletingPricing(l),this.saveSnapshot()}).catch(n=>{throw(n==null?void 0:n.status_code)=="422"?j.validationErrors(n):j.error(n==null?void 0:n.data),n})}));ze(this,"getDownloadableHeaderClass",()=>{var l;const a=this.product.downloadable_files&&Array.isArray(this.product.downloadable_files)&&this.product.downloadable_files.length>0;return{"!border-0":((l=this.product.detail)==null?void 0:l.manage_downloadable)=="0"||!a}});ze(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(l=>l.manage_stock=a),this.setHasChange(!0)});ze(this,"ensureVariationIndex",a=>{var l;(l=this.data.product_changes)!=null&&l.detail||(this.data.product_changes.detail={}),this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[a]||(this.data.product_changes.variants[a]={})});ze(this,"resolveStockVariant",(a,l)=>l||(Array.isArray(this.product.variants)?this.product.variants[a]:void 0));ze(this,"onChangeNewStock",(a,l,n,i=null)=>{const A=this.resolveStockVariant(n,i);if(!A)return;l===""&&(A.new_stock=0);const p=parseInt(A.total_stock??0),m=parseInt(A.new_stock??0);A.adjusted_quantity=m-p});ze(this,"onChangeAdjustedQuantity",(a,l,n,i=null)=>{const A=this.resolveStockVariant(n,i);if(!A)return;l===""&&(l=0);const p=parseInt(A.total_stock??0)+parseInt(l);A.new_stock=p<0?0:p});ze(this,"onChangeInputField",(a,l,n=!0)=>{var i,A,p,m,_;if(a==="post_title"&&this.product.detail.variation_type==="simple"&&Array.isArray(this.product.variants)&&this.variantsLength()>0&&(this.product.variants[0].variation_title=l,(i=this.data.product_changes)!=null&&i.variants||(this.data.product_changes.variants=[]),this.ensureVariationIndex(0),this.data.product_changes.variants[0].variation_title=l,this.data.product_changes.variants[0].id=this.product.variants[0].id),a==="post_date"&&(this.product[a]=at(l).format("YYYY-MM-DDTHH:mm:ssZ"),this.data.product_changes[a]=this.product[a]),a==="default_variation_id"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),this.data.product_changes.detail.default_variation_id=q7(l),this.data.product_changes.detail.id=this.product.detail.id,this.setHasChange(!0)),a==="manage_downloadable"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),this.product.detail.manage_downloadable=l,this.data.product_changes.detail.manage_downloadable=l,this.data.product_changes.detail.id=this.product.detail.id,this.setHasChange(!0)),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail.fulfillment_type=l,this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.detail.id=this.product.detail.id,this.product.variants.forEach((g,y)=>{this.product.variants[y].fulfillment_type=l,this.ensureVariationIndex(y),this.data.product_changes.variants[y].fulfillment_type=l,this.data.product_changes.variants[y].id=g.id})),a==="shipping_class"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),(A=this.product.detail)!=null&&A.other_info||(this.product.detail.other_info={}),this.product.detail.other_info[a]=l,(p=this.data.product_changes.detail)!=null&&p.other_info||(this.data.product_changes.detail.other_info={}),this.data.product_changes.detail.other_info[a]=l,this.product.variants.forEach((g,y)=>{this.product.variants[y].shipping_class=l,this.ensureVariationIndex(y),this.data.product_changes.variants[y].shipping_class=l,this.data.product_changes.variants[y].id=g.id})),["group_pricing_by","use_pricing_table","active_editor","sold_individually","reviews_enabled","fluent_player_video"].includes(a)&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),(m=this.product.detail)!=null&&m.other_info||(this.product.detail.other_info={}),(_=this.data.product_changes.detail)!=null&&_.other_info||(this.data.product_changes.detail.other_info={}),this.product.detail.other_info[a]=l,this.data.product_changes.detail.other_info[a]=l,this.data.product_changes.detail.id=this.product.detail.id),a==="post_excerpt"){this.product[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id,this.data.product_changes[a]=this.product[a];const g=l.trim();g.length===0?this.setExcerptWordCount(0):this.setExcerptWordCount(g.split(" ").length)}else this.product[a]=l,this.data.product_changes[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id;n&&this.setHasChange(!0)});ze(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));ze(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});ze(this,"validateComparePrice",a=>{var p,m;if(a==null)return!0;const l=(m=(p=this.product)==null?void 0:p.variants)==null?void 0:m[a];if(!l)return!0;const n=`variants.${a}.compare_price`,i=parseFloat(l.item_price),A=parseFloat(l.compare_price);return isNaN(A)||A<=0?(this.clearValidationError(n),!0):!isNaN(i)&&A<i?(this.validationErrors[n]=[d("Compare price must be greater than or equal to item price.")],!1):(this.clearValidationError(n),!0)});ze(this,"discard",()=>{const a=this.data.product_snapshot;!a||!Object.keys(a).length||(this._mergeSnapshot(a),this.data.product_changes={},this.data.discardKey++,this.setHasChange(!1))});ze(this,"update",async(a=null)=>{var A,p,m,_;let l=this.data.product_changes;l={...this.product},l.metaValue=this.data.metaValue,this.data.product_changes.post_status||(this.data.product_changes.post_status=this.product.post_status),this.data.product_changes.post_title||(this.data.product_changes.post_title=this.product.post_title),this.data.product_changes.detail?((A=this.data.product_changes.detail)!=null&&A.fulfillment_type||(this.data.product_changes.detail.fulfillment_type=this.product.detail.fulfillment_type),(p=this.data.product_changes.detail)!=null&&p.variation_type||(this.data.product_changes.detail.variation_type=this.product.detail.variation_type)):(this.data.product_changes.detail={},this.data.product_changes.detail.fulfillment_type=this.product.detail.fulfillment_type,this.data.product_changes.detail.variation_type=this.product.detail.variation_type),l=this.data.product_changes,l.metaValue=this.data.metaValue,this.setValidationErrors({}),this.setSaving(!0),delete l.taxonomies,delete l.product_terms,delete l.variantOptions,delete l.downloadable_files,((m=l.detail)==null?void 0:m.variation_type)==="simple"?l.variants=j7(l.variants,this.product.variants,this.product.ID):l.variants&&(l.variants=_f(l.variants,this.product.variants,this.product.ID)),((_=l.downloadable_files)==null?void 0:_.length)<1&&(l.variantOptions=[]);const n=ce.post(`products/${this.product.ID}/pricing`,l);let i=document.querySelector(".fct-admin-product-info .badge");n.then(g=>{j.success(a||g.message),this.setHasChange(!1),i&&(i.innerText=g.data.post_status),this.product.view_url=g.data.viewUrl,i&&g.data.post_status==="publish"&&(i.classList.remove("warning"),i.classList.add("success")),i&&g.data.post_status==="future"&&(i.innerText=d("Publishes on: %s",hl(g.data.post_date,!0)),i.classList.remove("success"),i.classList.add("warning")),i&&(g.data.post_status==="draft"?(i.classList.remove("success"),i.classList.add("info")):(i.classList.remove("info"),i.classList.add("success"))),this.product.detail.variation_type==="simple"&&Array.isArray(g.data.variants)&&g.data.variants.length>0&&(this.product.variants[0].id=g.data.variants[0].id,this.product.variants[0].created_at=g.data.variants[0].created_at),this.product.variants=this.product.variants.filter((y,v,k)=>v===k.findIndex(b=>b.id===y.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(y=>{typeof y=="function"&&y(this.product)})}).catch(g=>{var y,v;((y=g==null?void 0:g.status_code)==null?void 0:y.toString())==="422"?(j.validationErrors(g),this.setValidationErrors(g)):j.error(((v=g==null?void 0:g.data)==null?void 0:v.message)||(g==null?void 0:g.message)||d("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});ze(this,"delete",()=>{Ra(d("Are you sure you want to delete this product?"),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{this.setHasChange(!1),ce.delete(`products/${this.product.ID}`).then(a=>{j.success(a.message),this.router.push({name:"products"})}).catch(a=>{var l;a.status_code=="422"?j.validationErrors(a):j.error((l=a.data)==null?void 0:l.message)})}).catch(()=>{})});ze(this,"updateVariationType",(a,l)=>{var p,m;const n=this.product.detail[a];this.product.detail[a]=l;let i={variation_type:l,variation_ids:[(m=(p=this.product)==null?void 0:p.variants[0])==null?void 0:m.id],action:"change_variation_type"};const A=ce.post(`products/detail/${this.product.detail.id}`,i);return A.then(_=>{j.info(_.message),a==="variation_type"&&l==="simple"?(this.product.variants=this.product.variants.slice(0,1),this.variantsLength()>0&&(this.product.variants[0].manage_stock=this.product.detail.manage_stock)):a==="variation_type"&&l==="advanced_variations"&&(this.product.variants=[])}).catch(_=>{var g;this.product.detail[a]=n,_.status_code=="422"?j.validationErrors(_):j.error((g=_.data)==null?void 0:g.message)}).finally(()=>{}),A});ze(this,"getMaxExcerptWordCount",()=>{ce.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});ze(this,"shouldShowShippingMethodAlert",()=>Ke.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());ze(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));ze(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));ze(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));ze(this,"isTaxEnabled",()=>Ke.get("is_tax_enabled"));ze(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));ze(this,"isBundleProduct",()=>dt.get(this.data.product,"detail.other_info.is_bundle_product")==="yes")}addOnProductUpdatedListener(a,l){this.data.onProductUpdatedListener[a]=l}triggerProductUpdated(a=null){const l=this.data.onProductUpdatedListener;(Array.isArray(a)?a:Object.keys(l)).forEach(i=>{const A=l[i];typeof A=="function"&&A(this.product)})}setProductDownloadableModel(a){this.data.productDownloadableModel=a}setReloader(a){this.data.reloader=a}saveSnapshot(){this.data.product_snapshot=JSON.parse(JSON.stringify(this.data.product))}get product(){return this.data.product}get validationErrors(){return this.data.validationErrors}get excerptWordCount(){return this.data.excerptWordCount}get maxExcerptWordCount(){return this.data.maxExcerptWordCount}get hasChange(){return this.data.hasChange}get hasChangeLongDescEditor(){return this.data.hasChangeLongDescEditor}get saving(){return this.data.saving}beforeInit(){this.data.product={ID:"",post_title:"",post_name:"",post_content:"",post_excerpt:"",post_status:"publish",post_date:new Date,comment_status:"close",variants:!1},this.vueInstance=aa().ctx}setProduct(a){let l=document.querySelector(".fct-admin-product-info .badge");l&&a.post_status==="future"&&(l.innerText=d("Publishes on: %s",hl(a.post_date,!0)),l.classList.add("warning")),this.data.product=a,this.data.original_product={...a}}setValidationErrors(a){this.data.validationErrors=a}setExcerptWordCount(a){this.data.excerptWordCount=a}setMaxExcerptWordCount(a){this.data.maxExcerptWordCount=a}setHasChange(a){this.data.hasChange=a}setHasChangeLongDescEditor(a){this.data.hasChangeLongDescEditor=a}setSaving(a){this.data.saving=a}isInDraft(){return this.product.post_status==="draft"}viewUrl(){return this.product.view_url??""}variantsLength(){return this.product.variants.length??0}updateVariantSerialIndexes(a){a.forEach((i,A)=>{i.serial_index=A+1});const l=Array.isArray(this.data.product_changes.variants)?this.data.product_changes.variants:[],n=new Map;l.filter(Boolean).forEach(i=>{i.id!==void 0&&i.id!==null&&n.set(String(i.id),i)}),this.data.product_changes.variants=a.map(i=>({...n.get(String(i.id))||{},id:i.id,serial_index:i.serial_index})),this.setHasChange(!0)}bulkUpdateVariants(a){return ce.post("products/variants/bulk-update",{updates:a})}addDummyDownloadableFile(){super.addDummyDownloadableFiles(this.product),this.setHasChange(!0)}updateMedia(a,l){this.product[a]=l,this.data.product_changes[a]=l,this.setHasChange(!0)}shippingSettingsUrl(){return Ke.get("admin_url")+"settings/shipping"}}function W7(){return Y7.init()}function J7(){Te(()=>{document.addEventListener("keydown",t)}),Ga(()=>{document.removeEventListener("keydown",t)});let e;function t(l){(l.ctrlKey||l.metaKey)&&l.shiftKey&&l.keyCode===83&&(l.preventDefault(),typeof e=="function"&&e())}function a(l){e=l}return{onSave:a}}const X7={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},Z7={key:0,class:"iframe-loader"},eL=["src"],tL={class:"iframe-controls"},aL={class:"dialog-header"},lL={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},sL={key:0,class:"iframe-loader"},nL=["src"],oL={__name:"GutenbergEditor",props:{post_id:{required:!0},product:{type:Object},reload:Function,productEditModel:Object},setup(e){const t=e,a=M(!1),l=M(!0),n=M(!0),i=M(),A=M(0);let p=!1;const m=M(null),_=M(null);Pa();const g=()=>{i.value=Ke.get("wp_admin_url",window.location.origin+"/wp-admin")},y=()=>{setTimeout(()=>{l.value=!1},500)},v=()=>{var V;n.value=!1,setTimeout(()=>{},500);try{const F=(V=_.value)==null?void 0:V.contentDocument;F&&F.addEventListener("click",$=>{const U=$.target.closest("a[href]");if(U&&!U.target&&!U.getAttribute("onclick")){const D=U.getAttribute("href");D&&(D.startsWith("/")||D.startsWith("http"))&&($.preventDefault(),window.parent.postMessage({type:"navigateTo",content:D},"*"))}},!0)}catch{}},k=()=>{a.value=!0,n.value=!0,p=!1},b=()=>{p||(p=!0,n.value=!1,a.value=!1,w(),t.productEditModel.data.reloader())},w=()=>{l.value=!0,A.value+=1},B=()=>{n.value=!0,_.value&&(_.value.src=_.value.src.toString())},S=V=>{const{type:F,content:$}=V.data;F==="gutenbergContentChanged"&&w(),F==="classicEditorSaved"&&b(),F==="navigateTo"&&(b(),window.location.href=$)};return Te(()=>{g(),window.addEventListener("message",S)}),Ga(()=>{window.removeEventListener("message",S)}),(V,F)=>{const $=C("el-icon"),U=C("el-button"),D=C("el-breadcrumb-item"),T=C("el-breadcrumb"),I=C("el-dialog");return r(),h(P,null,[o("div",X7,[F[2]||(F[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),h("div",Z7,[o("span",null,[R(f(c(d)("Loading preview..."))+" ",1),s($,{class:"is-loading"},{default:u(()=>[s(c(on))]),_:1})])])):x("",!0),o("iframe",{ref_key:"previewIframeRef",ref:m,class:"scrollbar-none preview-iframe",src:`${i.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true&is-preview-mode=true&fct-preview=${A.value}`,width:"100%",height:"400px",onLoad:y,style:fa({visibility:l.value?"hidden":"visible"})},null,44,eL)]),o("div",tL,[s(U,{onClick:k},{default:u(()=>[R(f(c(d)("Show Content Editor")),1)]),_:1})]),s(I,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":F[0]||(F[0]=L=>a.value=L),onClose:b,onOpen:F[1]||(F[1]=()=>{B()})},{header:u(()=>[o("div",aL,[s(T,{separator:"/"},{default:u(()=>[s(D,null,{default:u(()=>[o("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:b},f(e.product.post_title),1)]),_:1}),s(D,null,{default:u(()=>F[3]||(F[3]=[R("Editor",-1)])),_:1,__:[3]})]),_:1}),n.value?x("",!0):(r(),E(U,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:b},{default:u(()=>[s(X,{name:"Cross"}),R(" "+f(c(d)("Close")),1)]),_:1}))])]),default:u(()=>[o("div",lL,[n.value?(r(),h("div",sL,[o("span",null,[R(f(c(d)("Loading editor..."))+" ",1),s($,{class:"is-loading"},{default:u(()=>[s(c(on))]),_:1})])])):x("",!0),o("iframe",{ref_key:"dialogIframeRef",ref:_,class:"dialog-iframe",src:`${i.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true`,width:"100%",height:"700px",sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",onLoad:v,style:fa({visibility:n.value?"hidden":"visible"})},null,44,nL)])]),_:1},8,["modelValue"])],64)}}},iL={class:"fct-product-info-wrap"},rL={class:"fct-admin-input-wrapper"},dL={class:"fct-admin-input-wrapper"},uL={class:"form-note"},cL={class:"fct-excerpt-word-counter mt-[7px]"},AL={class:"editor-tabs-nav"},pL={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},fL={class:"custom-wp-editor-wrapper relative"},mL={class:"relative rounded overflow-hidden"},hL={class:"editor-tab-content fct-wp-editor-tab-content"},_L={class:"editor-tab-content fct-gutenberg-tab-content"},vL={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=M(!1),l=M("wp-editor");M("#gt"),Pa();const n=M(),i=A=>{t.productEditModel.updateLongDescEditorChange(A),l.value=A};return be(()=>t.product.post_title,A=>{const p=document.querySelector(".fct-admin-product-header .product-name");p&&(p.textContent=A&&A.trim()?A:d("Product Name"))}),Te(()=>{var A,p,m,_,g,y;a.value=!0,t.productEditModel.getMaxExcerptWordCount(),((A=t.product)==null?void 0:A.post_excerpt)!==void 0&&((p=t.product)==null?void 0:p.post_excerpt.toString().length)>0&&t.productEditModel.setExcerptWordCount((m=t.product)==null?void 0:m.post_excerpt.toString().split(" ").length),(y=(g=(_=t.product)==null?void 0:_.detail)==null?void 0:g.other_info)!=null&&y.active_editor&&(l.value=t.product.detail.other_info.active_editor)}),be(()=>t.productEditModel.data.discardKey,()=>{n.value&&n.value.resetContent(t.product.post_content)}),(A,p)=>{const m=C("el-input"),_=C("el-form-item"),g=C("el-form"),y=Qa("loading");return r(),h("div",iL,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[6]||(p[6]=Ge(()=>{},["prevent"]))},{default:u(()=>[o("div",rL,[s(_,{label:c(d)("Title"),required:""},{default:u(()=>[s(m,{class:ue(e.productEditModel.hasValidationError("post_title")?"is-error":""),id:"post_title",placeholder:c(d)("Title"),type:"text",modelValue:e.product.post_title,"onUpdate:modelValue":p[0]||(p[0]=v=>e.product.post_title=v),onInput:p[1]||(p[1]=v=>{e.productEditModel.onChangeInputField("post_title",v)}),onFocus:p[2]||(p[2]=v=>e.productEditModel.clearValidationError("post_title"))},null,8,["class","placeholder","modelValue"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),o("div",dL,[s(_,{label:c(d)("Short description")},{default:u(()=>[s(m,{class:"fct-short-desc-input",onInput:p[3]||(p[3]=v=>{e.productEditModel.onChangeInputField("post_excerpt",v)}),modelValue:e.product.post_excerpt,"onUpdate:modelValue":p[4]||(p[4]=v=>e.product.post_excerpt=v),rows:2,type:"textarea",onFocus:p[5]||(p[5]=v=>e.productEditModel.clearValidationError("post_excerpt"))},null,8,["modelValue"]),o("div",null,[o("div",uL,[o("p",cL,f(c(d)("%1$s Words of %2$s",c(d)(e.productEditModel.data.excerptWordCount),c(d)(e.productEditModel.maxExcerptWordCount))),1)]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Long Description")},{action:u(()=>[Jt((r(),h("div",AL,[s(ud,null,{default:u(()=>[s(Qo,{label:c(d)("Classic Editor"),class:ue(l.value==="wp-editor"?"active":""),onClick:p[7]||(p[7]=v=>i("wp-editor"))},null,8,["label","class"]),s(Qo,{label:c(d)("Builder"),class:ue(l.value==="gutenberg"?"active":""),onClick:p[8]||(p[8]=v=>i("gutenberg"))},null,8,["label","class"])]),_:1})])),[[y,e.productEditModel.hasChangeLongDescEditor]])]),_:1},8,["title"]),s(Be,null,{default:u(()=>[s(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[10]||(p[10]=Ge(()=>{},["prevent"]))},{default:u(()=>[o("div",pL,[s(_,null,{default:u(()=>[o("div",fL,[o("div",mL,[Jt(o("div",hL,[s(os,{ref_key:"wpEditor",ref:n,modelValue:e.product.post_content,onUpdate:p[9]||(p[9]=v=>{e.productEditModel.onChangeInputField("post_content",v)})},null,8,["modelValue"])],512),[[$l,l.value==="wp-editor"]]),Jt(o("div",_L,[s(oL,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[$l,l.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},gL=["aria-label"],yL=["src","alt"],bL={class:"fmp-featured__edit-icon"},wL=["src","alt"],CL={key:0,class:"fmp-count"},kL={key:0,class:"fmp-preview-grid"},BL=["data-fct-media-kind"],xL=["src","alt"],SL={key:0,class:"fmp-preview-play","aria-hidden":"true"},$L={key:1,class:"fmp-preview-more"},FL={key:1,class:"fmp-add-full",type:"button"},EL={class:"fmp-modal-body"},UL={key:0,class:"fmp-grid-loading",role:"status","data-fct-gallery-loading":""},IL=["data-fct-media-kind"],VL=["src","alt"],DL={key:0,class:"fmp-grid-play","aria-hidden":"true"},TL={key:3,class:"fmp-grid-move"},QL=["data-fct-media-move-index","disabled","aria-label","onClick"],ML=["data-fct-media-move-index","disabled","aria-label","onClick"],LL=["disabled","aria-label","title","onClick"],RL={key:2,class:"fmp-empty"},OL={class:"fmp-sr-only",role:"status","aria-live":"polite","data-fct-gallery-live":""},PL={class:"fmp-url-list"},HL=["src","alt"],NL={class:"fmp-url-info"},KL={class:"fmp-url-title"},GL={class:"fmp-url-text"},zL=["onClick","title"],jL={class:"fmp-url-add"},qL={class:"dialog-footer"},YL=["aria-disabled"],WL={class:"fct-media-picker-footer-actions"},JL={class:"fct-btn-group sm"},bo=4,wl={__name:"BulkMediaPicker",props:{modelValue:{type:Array,default:()=>[]},compact:{type:Boolean,default:!0},maxThumbs:{type:Number,default:3},multiple:{type:Boolean,default:!0},showUrlTab:{type:Boolean,default:!0},title:{type:String,default:""},featured:{type:Boolean,default:!1},square:{type:Boolean,default:!1},showApplyToAll:{type:Boolean,default:!1},defaultApplyToAll:{type:Boolean,default:!1},selectedCount:{type:Number,default:0},busy:{type:Boolean,default:!1},extraPreviews:{type:Array,default:()=>[]},extraItems:{type:Array,default:()=>[]},extraItemsLoading:{type:Boolean,default:!1}},emits:["update:modelValue","change","open","save","extra-reorder","extra-remove"],setup(e,{emit:t}){const a=pl.getUrl("images/placeholder.svg"),l=N=>{N.target&&N.target.src!==a&&(N.target.src=a)},n=e,i=t,A=M(!1),p=M([]),m=M("gallery"),_=M(""),g=M(!1),y=G(()=>n.title||d("Manage Media")),v=G(()=>n.selectedCount>0?d("Apply to all (%1$s)",n.selectedCount):d("Apply to all")),k=G(()=>p.value.filter(N=>N.id>0)),b=G(()=>p.value.filter(N=>!N.id)),w=G(()=>n.showUrlTab),B=G(()=>Array.isArray(n.modelValue)?n.modelValue:[]),S=G(()=>B.value.filter(N=>N&&N.url)),V=N=>({kind:"image",id:N.id,url:N.url,title:N.title||"",image:N}),F=G(()=>Wd(B.value.map(N=>({id:N.id,url:N.url,title:N.title||"",kind:"image"})),(Array.isArray(n.extraPreviews)?n.extraPreviews:[]).filter(N=>N&&N.url).map(N=>({id:N.id,url:N.url,title:N.title||"",kind:N.kind||"image",position:lh(N.position)})))),$=M([]),U=G(()=>(Array.isArray(n.extraItems)?n.extraItems:[]).filter(N=>N&&N.url)),D=G(()=>n.extraItemsLoading),T=(N=U.value)=>{$.value=Wd(p.value.map(V),N.map(le=>({...le})))},I=()=>{const{images:N,order:le}=sh($.value);p.value=N.map(ee=>ee.image),i("extra-reorder",le.map(ee=>({tab:ee.tab,id:ee.id,position:ee.position})))};let L=!1;be(U,N=>{if(A.value){if(!L){L=!0,T();return}$.value=oh($.value,N)}});const O=M(""),Q=N=>N.title||(N.kind==="video"?d("Video"):d("Image")),H=(N,le)=>{const ee=document.querySelector(".fct-bulk-media-picker-modal");if(!ee)return;const pe=Ce=>ee.querySelector(`[data-fct-media-move="${Ce}"][data-fct-media-move-index="${N}"]`),de=pe(le<0?"earlier":"later"),Ue=de&&!de.disabled?de:pe(le<0?"later":"earlier");Ue&&Ue.focus()},K=(N,le)=>{if(D.value)return;const ee=$.value[N],pe=N+le;!ee||!nh($.value,N,pe)||(I(),O.value=d("%1$s moved to position %2$s of %3$s",Q(ee),pe+1,$.value.length),$e(()=>H(pe,le)))},W=G(()=>$.value.findIndex(N=>N.kind==="image")),z=()=>{p.value=JSON.parse(JSON.stringify(B.value)),m.value="gallery",_.value="",g.value=n.defaultApplyToAll,A.value=!0,L=!1,O.value="",T([]),i("open")},Y=()=>{if(n.busy||D.value)return;(JSON.stringify(p.value)!==JSON.stringify(B.value)||g.value)&&(i("update:modelValue",p.value),i("change",p.value,{applyToAll:g.value})),i("save"),A.value=!1},Z=()=>{n.busy||(A.value=!1)},re=N=>{n.busy||N()},q=N=>{if(D.value)return;const le=$.value[N];le&&($.value.splice(N,1),le.kind!=="image"&&i("extra-remove",le),I())},Ae=N=>{if(D.value)return;const le=N.filter(de=>de.url).map(de=>({id:de.id,title:de.title,url:de.url}));if(!n.multiple){p.value=le.slice(0,1),T();return}const ee=new Set(p.value.map(de=>de.url));let pe=!1;for(const de of le)ee.has(de.url)||(Jd($.value,V(de)),ee.add(de.url),pe=!0);pe&&I()},ie=()=>{if(D.value)return;const N=_.value.trim();if(!N)return;if(p.value.some(pe=>pe.url===N)){_.value="";return}const le=N.split("/").pop().split("?")[0]||"image",ee={id:0,url:N,title:le};n.multiple?(Jd($.value,V(ee)),I()):(p.value=[ee],T()),_.value=""},J=N=>{const le=$.value.findIndex(ee=>ee.kind==="image"&&ee.url===N);le!==-1&&q(le)};return(N,le)=>{const ee=C("el-tag"),pe=C("el-button"),de=C("el-tab-pane"),Ue=C("el-input"),Ce=C("el-tabs"),Se=C("el-checkbox"),ge=C("el-dialog");return r(),h(P,null,[o("div",{class:ue(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured,"is-square":e.square}]),onClick:z},[e.featured?(r(),h(P,{key:0},[e.modelValue&&e.modelValue.length?(r(),h("button",{key:0,type:"button",class:"fmp-featured","aria-label":c(d)("Edit media")},[o("img",{src:e.modelValue[0].url||c(a),alt:e.modelValue[0].title||"",class:"fmp-featured__image",onError:l},null,40,yL),o("span",bL,[s(X,{name:"Edit"})]),e.modelValue.length>1?(r(),E(ee,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:u(()=>[R(f(e.modelValue.length)+" "+f(N.$t("images")),1)]),_:1})):x("",!0)],8,gL)):(r(),E(pe,{key:1,class:"fct-mp-add-featured"},{default:u(()=>[s(X,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),h(P,{key:1},[S.value.length?(r(),h("div",{key:0,class:ue(["fmp-stack",{"is-square":e.square}])},[(r(!0),h(P,null,ae(S.value.slice(0,e.maxThumbs),(ke,Oe)=>(r(),h("span",{key:Oe,class:"fmp-thumb-wrap",style:fa({zIndex:e.maxThumbs-Oe})},[o("img",{src:ke.url,alt:ke.title||"",class:"fmp-thumb",onError:l},null,40,wL)],4))),128)),S.value.length>e.maxThumbs?(r(),h("span",CL,"+"+f(S.value.length-e.maxThumbs),1)):x("",!0),le[4]||(le[4]=Ln('<span class="fmp-edit-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none" width="14" height="14"><path d="M11.7282 3.23787C12.3492 2.56506 12.6597 2.22865 12.9896 2.03243C13.7857 1.55896 14.766 1.54423 15.5754 1.99359C15.9108 2.17982 16.2309 2.50676 16.8709 3.16062C17.511 3.81449 17.8311 4.14143 18.0134 4.48409C18.4533 5.31092 18.4388 6.31232 17.9754 7.12558C17.7833 7.46262 17.454 7.7798 16.7953 8.41416L8.95894 15.9619C7.71081 17.1641 7.08675 17.7651 6.3068 18.0698C5.52685 18.3744 4.66942 18.352 2.95455 18.3071L2.72123 18.301C2.19917 18.2874 1.93814 18.2806 1.7864 18.1084C1.63467 17.9362 1.65538 17.6703 1.69681 17.1385L1.71931 16.8497C1.83592 15.3529 1.89423 14.6046 2.1865 13.9318C2.47878 13.2591 2.98294 12.7129 3.99127 11.6204L11.7282 3.23787Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path><path d="M10.8333 3.33334L16.6666 9.16668" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path><path d="M11.6667 18.3333L18.3334 18.3333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></span>',1))],2)):(r(),E(pe,{key:1,class:"fct-mp-add-compact"},{default:u(()=>[s(X,{name:"GalleryAdd"})]),_:1}))],64)):(r(),h(P,{key:2},[F.value.length?(r(),h("div",kL,[(r(!0),h(P,null,ae(F.value.slice(0,bo),(ke,Oe)=>(r(),h("div",{class:ue(["fmp-preview-item",{"is-video":ke.kind==="video"}]),key:`${ke.kind}-${ke.id??Oe}`,"data-fct-media-kind":ke.kind},[o("img",{src:ke.url||c(a),alt:ke.title||"",onError:l},null,40,xL),ke.kind==="video"?(r(),h("span",SL,le[5]||(le[5]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 5v14l11-7z"})],-1)]))):x("",!0),Oe===bo-1&&F.value.length>bo?(r(),h("span",$L,"+"+f(F.value.length-bo),1)):x("",!0)],10,BL))),128))])):(r(),h("button",FL,[le[6]||(le[6]=Ln('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="none" width="20" height="20"><path d="M9.5 10C10.6046 10 11.5 9.10457 11.5 8C11.5 6.89543 10.6046 6 9.5 6C8.39543 6 7.5 6.89543 7.5 8C7.5 9.10457 8.39543 10 9.5 10Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13.5 2H9.5C4.5 2 2.5 4 2.5 9V15C2.5 20 4.5 22 9.5 22H15.5C20.5 22 22.5 20 22.5 15V10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.25 5H21.75" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M19 7.75V2.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M3.16992 18.9501L8.09992 15.6401C8.88992 15.1101 10.0299 15.1701 10.7399 15.7801L11.0699 16.0701C11.8499 16.7401 13.1099 16.7401 13.8899 16.0701L18.0499 12.5001C18.8299 11.8301 20.0899 11.8301 20.8699 12.5001L22.4999 13.9001" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)),o("span",null,f(N.$t("Add Media")),1)]))],64))],2),A.value?(r(),E(ge,{key:0,modelValue:A.value,"onUpdate:modelValue":le[3]||(le[3]=ke=>A.value=ke),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,"close-on-press-escape":!e.busy,"before-close":re,onClose:Z,class:"fct-bulk-media-picker-modal"},{default:u(()=>[o("div",EL,[s(Ce,{modelValue:m.value,"onUpdate:modelValue":le[1]||(le[1]=ke=>m.value=ke)},{default:u(()=>[s(de,{label:N.$t("Gallery"),name:"gallery"},{default:u(()=>[D.value?(r(),h("p",UL,f(N.$t("Loading gallery items...")),1)):x("",!0),$.value.length?(r(),E(c(cn),{key:1,list:$.value,class:ue(["fmp-grid",{"is-locked":D.value}]),tag:"div",animation:200,disabled:D.value,onEnd:I},{default:u(()=>[(r(!0),h(P,null,ae($.value,(ke,Oe)=>(r(),h("div",{class:ue(["fmp-grid-item",{"is-video":ke.kind==="video"}]),key:`${ke.kind}-${ke.id??""}-${ke.url||Oe}`,"data-fct-media-kind":ke.kind},[o("img",{src:ke.url||c(a),alt:ke.title||"",onError:l},null,40,VL),ke.kind==="video"?(r(),h("span",DL,le[7]||(le[7]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 5v14l11-7z"})],-1)]))):x("",!0),Oe===W.value?(r(),E(ee,{key:1,type:"primary",size:"small",class:"fmp-featured-tag"},{default:u(()=>[R(f(N.$t("Featured")),1)]),_:1})):Oe===0?(r(),E(ee,{key:2,type:"info",size:"small",class:"fmp-featured-tag"},{default:u(()=>[R(f(N.$t("Plays first")),1)]),_:1})):x("",!0),$.value.length>1?(r(),h("div",TL,[o("button",{type:"button",class:"fmp-move-btn","data-fct-media-move":"earlier","data-fct-media-move-index":Oe,disabled:D.value||Oe===0,"aria-label":c(d)("Move %1$s earlier",Q(ke)),onClick:Ge(Ee=>K(Oe,-1),["stop"])},le[8]||(le[8]=[o("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[o("path",{d:"M15 6l-6 6 6 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,QL),o("button",{type:"button",class:"fmp-move-btn","data-fct-media-move":"later","data-fct-media-move-index":Oe,disabled:D.value||Oe===$.value.length-1,"aria-label":c(d)("Move %1$s later",Q(ke)),onClick:Ge(Ee=>K(Oe,1),["stop"])},le[9]||(le[9]=[o("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[o("path",{d:"M9 6l6 6-6 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,ML)])):x("",!0),o("button",{type:"button",class:"fmp-remove-btn",disabled:D.value,"aria-label":c(d)("Remove %1$s",Q(ke)),title:N.$t("Remove"),onClick:Ge(Ee=>q(Oe),["stop"])}," × ",8,LL)],10,IL))),128))]),_:1},8,["list","class","disabled"])):(r(),h("div",RL,[o("p",null,f(N.$t("No media added yet.")),1)])),o("span",OL,f(O.value),1)]),_:1},8,["label"]),w.value?(r(),E(de,{key:0,name:"imported-urls"},{label:u(()=>[R(f(N.$t("Add by URL"))+" ",1),b.value.length?(r(),E(ee,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:u(()=>[R(f(b.value.length),1)]),_:1})):x("",!0)]),default:u(()=>[o("div",PL,[(r(!0),h(P,null,ae(b.value,ke=>(r(),h("div",{class:"fmp-url-item",key:ke.url},[o("img",{src:ke.url,alt:ke.title||"",class:"fmp-url-thumb"},null,8,HL),o("div",NL,[o("span",KL,f(ke.title),1),o("span",GL,f(ke.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ge(Oe=>J(ke.url),["stop"]),title:N.$t("Remove")}," × ",8,zL)]))),128)),o("div",jL,[s(Ue,{modelValue:_.value,"onUpdate:modelValue":le[0]||(le[0]=ke=>_.value=ke),placeholder:N.$t("Paste image URL..."),size:"small",disabled:D.value,onKeyup:ea(ie,["enter"])},null,8,["modelValue","placeholder","disabled"]),s(pe,{size:"small",onClick:ie,disabled:D.value||!_.value.trim()},{default:u(()=>[R(f(N.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):x("",!0),wa(N.$slots,"extra-tabs",{activeTab:m.value})]),_:3},8,["modelValue"])]),o("div",qL,[o("div",{class:ue(["fmp-add-media",{"is-disabled":D.value}]),"aria-disabled":D.value?"true":null},[s(wA,{attachments:k.value,multiple:e.multiple,onOnMediaSelected:Ae},null,8,["attachments","multiple"])],10,YL),o("div",WL,[e.showApplyToAll?(r(),h("label",{key:0,class:ue(["fct-media-picker-apply-to-group-label",{"is-enabled":g.value}])},[s(Se,{modelValue:g.value,"onUpdate:modelValue":le[2]||(le[2]=ke=>g.value=ke),"aria-label":N.$t("Apply media to all variants in this group")},null,8,["modelValue","aria-label"]),R(" "+f(v.value),1)],2)):x("",!0),o("div",JL,[s(pe,{disabled:e.busy,onClick:Z},{default:u(()=>[R(f(N.$t("Cancel")),1)]),_:1},8,["disabled"]),s(pe,{type:"primary",disabled:e.busy||D.value,onClick:Y},{default:u(()=>[R(f(N.$t("Save")),1)]),_:1},8,["disabled"])])])])]),_:3},8,["modelValue","title","close-on-press-escape"])):x("",!0)],64)}}},XL={},ZL={class:"fct-shared-variant-item-box"},eR={key:0,class:"fct-shared-variant-item-box__header"},tR={class:"fct-shared-variant-item-box__label"},aR={class:"fct-shared-variant-item-box__action"},lR={class:"fct-shared-variant-item-box__body"};function sR(e,t){return r(),h("div",ZL,[e.$slots.label||e.$slots.action?(r(),h("div",eR,[o("div",tR,[wa(e.$slots,"label")]),o("div",aR,[wa(e.$slots,"action")])])):x("",!0),o("div",lR,[wa(e.$slots,"default")])])}const qn=nt(XL,[["render",sR]]),nR={class:"fct-product-media-row"},oR={key:0,class:"fct-variant-title-readonly"},iR={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},rR={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},dR={class:"fct-admin-input-wrapper"},uR={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,titleInfo:Object},setup(e){const t=e,a=G(()=>{var n;return["simple_variations","advanced_variations"].includes((n=t.product.detail)==null?void 0:n.variation_type)}),l=G(()=>{var n;return((n=t.product.detail)==null?void 0:n.variation_type)==="advanced_variations"});return(n,i)=>{const A=C("el-input"),p=C("el-form-item");return a.value?(r(),E(qn,{key:0,class:"fct-product-media-and-title"},{default:u(()=>[o("div",nR,[s(wl,{modelValue:e.variant.media,"onUpdate:modelValue":i[0]||(i[0]=m=>e.variant.media=m),featured:!0,compact:!1,onChange:i[1]||(i[1]=m=>e.productEditModel.updatePricingOtherValue("media",m,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),l.value?(r(),h("div",oR,[e.titleInfo&&e.titleInfo.group?(r(),h("div",iR,f(e.titleInfo.group),1)):x("",!0),o("div",rR,f(e.titleInfo&&e.titleInfo.detail||e.variant.variation_title),1)])):(r(),E(p,{key:1,label:c(d)("Variation Title")},{default:u(()=>[o("div",dR,[s(A,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.variation_title`)?"is-error":""),id:`${e.fieldKey}.variation_title`,placeholder:c(d)("e.g. Small, Medium, Large"),type:"text",modelValue:e.variant.variation_title,"onUpdate:modelValue":i[2]||(i[2]=m=>e.variant.variation_title=m),onInput:i[3]||(i[3]=m=>{e.productEditModel.updatePricingValue("variation_title",m,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):x("",!0)}}},cR=nt(uR,[["__scopeId","data-v-81001ec3"]]),AR={class:"fct-variant-item-collapse"},pR={class:"fct-variant-item-collapse-header"},fR={class:"fct-variant-item-collapse-body"},vf={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,n=G({get:()=>a.modelValue,set:A=>l("update:modelValue",A)}),i=G(()=>n.value.includes("1"));return(A,p)=>{const m=C("el-collapse-item"),_=C("el-collapse");return r(),h("div",AR,[s(_,{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=g=>n.value=g),accordion:""},{default:u(()=>[s(m,{name:"1",icon:c(Bm)},{title:u(()=>[o("div",pR,[wa(A.$slots,"header",{isOpen:i.value})])]),default:u(()=>[o("div",fR,[wa(A.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},gf=(e="",t="")=>{let a;return e==="comma"?a=",":e==="dot"?a=".":a=t==="dot_comma"?",":".",{decimal:a,thousand:a===","?".":",",locale:a===","?"de-DE":"en-US"}},dr=e=>String(e||"").replace(/^0+(?=\d)/,""),mR=e=>String(e??"").replace(/[^\d.,]/g,""),yf=(e,t=",")=>{const a=mR(e);if(!a)return"";const l=a.lastIndexOf("."),n=a.lastIndexOf(","),i=Math.max(l,n);if(i===-1)return dr(a.replace(/[.,]/g,""));const A=dr(a.slice(0,i).replace(/[^\d]/g,"")),p=a.slice(i+1).replace(/[^\d]/g,""),m=a.charAt(i),_=(a.match(new RegExp(`\\${m}`,"g"))||[]).length,g=i===a.length-1,y=a.includes(".")&&a.includes(",");if(!g&&!y&&m===t&&(_>1||p.length>2))return dr(a.replace(/[^\d]/g,""));const k=A||"0";return g?`${k}.`:`${k}.${p.slice(0,2)}`},bf=(e,t=",")=>{if(e==null||e==="")return NaN;const a=typeof e=="number"?String(e):yf(e,t);return a?parseFloat(a.replace(/\.$/,"")):NaN},wf=(e,t=",")=>{if(e==null||e==="")return"";const a=bf(e,t);return isNaN(a)?"":Math.round(a*100)},hR=/^-?[\d.,]*\d[\d.,]*$/,_R=(e,t=",")=>{if(e==null)return"";const a=String(e).trim();if(a==="")return"";if(!hR.test(a))return a;const l=wf(a,t);return l===""?a:a.charAt(0)==="-"?-l:l},wo=e=>{if(e==null||e==="")return"";const t=typeof e=="number"?e:parseFloat(String(e));return isNaN(t)?"":(t/100).toFixed(2)},vR=["innerHTML"],Ya={__name:"PriceInput",props:{modelValue:{type:[Number,String],default:""},numberFormat:{type:String,default:"comma_dot",validator:e=>["comma_dot","dot_comma"].includes(e)},id:{type:String,default:""},placeholder:{type:String,default:""},min:{type:Number,default:0},errorClass:{type:String,default:""},size:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change","focus","blur"],setup(e,{emit:t}){const a=e,l=t,n=G(()=>Ke.get("shop.currency_sign","$")),i=G(()=>gf(Ke.get("shop.decimal_separator",""),a.numberFormat)),A=G(()=>i.value.decimal),p=G(()=>i.value.thousand),m=G(()=>i.value.locale),_=/[\d.,]/,g=O=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(O.key)||O.ctrlKey||O.metaKey||_.test(O.key)||O.preventDefault()},y=O=>yf(O,p.value),v=O=>bf(O,p.value),k=O=>{const Q=v(O);return isNaN(Q)?"":Q.toLocaleString(m.value,{minimumFractionDigits:0,maximumFractionDigits:2})},b=O=>{if(!O)return"";const Q=O.endsWith("."),[H="",K=""]=O.split("."),W=(H||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return Q?`${W}${A.value}`:K?`${W}${A.value}${K}`:W},w=(O,Q=!1)=>{const H=v(O);return isNaN(H)?"":(Q?B(H):H).toFixed(2)},B=O=>a.min===null||a.min===void 0||isNaN(O)?O:O<a.min?a.min:O,S=O=>wf(O,p.value),V=M(""),F=M(""),$=M(!1),U=O=>{const Q=w(wo(O));if(!Q){V.value="",F.value="";return}V.value=k(Q),F.value=Q},D=O=>{const Q=y(O);if(F.value=Q,V.value=b(Q),$.value=!0,Q===""){l("update:modelValue","");return}const H=w(Q);H!==""&&H!==wo(a.modelValue)&&l("update:modelValue",S(H))},T=M(""),I=()=>{T.value=w(wo(a.modelValue)),l("focus")},L=()=>{const O=$.value?F.value:wo(a.modelValue);let Q=a.modelValue;if(O==="")Q="",l("update:modelValue",""),T.value!==""&&l("change",""),V.value="",F.value="";else{const H=w(O,!0);if(H==="")U(a.modelValue);else{const K=S(H);Q=K,l("update:modelValue",K),H!==T.value&&l("change",K),V.value=k(H),F.value=H}}$.value=!1,T.value="",l("blur",Q)};return be([()=>a.modelValue,()=>a.numberFormat],([O])=>{$.value||U(O)}),U(a.modelValue),(O,Q)=>{const H=C("el-input");return r(),E(H,{class:ue(e.errorClass),id:e.id,size:e.size,placeholder:e.placeholder,"model-value":V.value,disabled:e.disabled,onFocus:I,onBlur:L,onInput:D,onKeydown:g},sa({prefix:u(()=>[o("span",{innerHTML:n.value},null,8,vR)]),_:2},[O.$slots.suffix?{name:"suffix",fn:u(()=>[wa(O.$slots,"suffix")]),key:"0"}:void 0,O.$slots.append?{name:"append",fn:u(()=>[wa(O.$slots,"append")]),key:"1"}:void 0]),1032,["class","id","size","placeholder","model-value","disabled"])}}},gR={key:0,class:"fct-shared-variant-item-box__switch"},yR={class:"fct-shared-variant-item-box__hint"},bR={key:1,class:"fct-inline-select-wrap"},wR={class:"fct-price-with-inclusion"},CR={key:0,class:"fct-required"},kR={class:"fct-admin-input-wrapper"},BR={key:0},xR={key:0,class:"fct-collapse-heading"},SR={key:1,class:"fct-tag-group"},$R={class:"fct-tag-item"},FR={class:"fct-tags-internal"},ER={key:0,class:"fct-tag-item"},UR={class:"fct-tags-internal"},IR={key:1,class:"fct-tag-item"},VR={class:"fct-tags-internal"},DR={key:2,class:"fct-tag-item"},TR={class:"fct-tags-internal"},QR={class:"fct-tag-item"},MR={class:"fct-tags-internal"},LR={class:"fct-shared-variant-pricing-additional"},RR={class:"fct-admin-input-wrapper"},OR={class:"fct-admin-input-wrapper"},PR={class:"fct-admin-input-wrapper"},HR={key:0},NR={class:"fct-admin-input-wrapper"},KR={class:"fct-admin-input-wrapper"},GR={class:"fct-admin-input-wrapper"},zR={class:"fct-admin-input-wrapper"},jR={class:"fct-admin-input-wrapper"},qR={class:"fct-admin-input-wrapper"},YR={class:"fct-admin-input-wrapper"},ur=2,Cf={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=Ke.get("app_config.isProActive"),l=M(),n=M([""]),i=M(0),A=new Set(["compare_price","repeat_interval","trial_days","times","signup_fee_name","signup_fee","item_cost","manage_cost"]);be(()=>{var w;return(w=t.variant)==null?void 0:w.id},()=>{var w,B;i.value=Number((B=(w=t.variant)==null?void 0:w.other_info)==null?void 0:B.signup_fee)||0}),be(()=>{var w,B;return(B=(w=t.variant)==null?void 0:w.other_info)==null?void 0:B.payment_type},w=>{w==="subscription"&&(n.value="1")}),be(()=>{var w;return(w=t.productEditModel)==null?void 0:w.validationErrors},w=>{if(!w||Object.keys(w).length===0)return;Object.keys(w).some(S=>{for(const V of A)if(S.includes(V))return!0;return!1})&&(n.value="1")},{deep:!0});let p=t.product.variants.length>0;const m=G(()=>{var w;return((w=window.fluentCartAdminApp)==null?void 0:w.subscription_intervals)??[]}),_=()=>{var w,B,S;return((w=t.variant)==null?void 0:w.other_info)&&["subscription"].includes((S=(B=t.variant)==null?void 0:B.other_info)==null?void 0:S.payment_type)},g=(w,B,S,V)=>{t.productEditModel.updatePricingOtherValue(w,B,S,V,t.modeType)},y=(w,B,S)=>{const V=Number(w);(!Number.isFinite(V)||V<ur)&&g("times",ur,B,S)},v=w=>{t.productEditModel.updatePricingOtherValue("manage_setup_fee",w,t.fieldKey,t.variant,t.modeType),w==="no"?(i.value=Number(t.variant.other_info.signup_fee),t.productEditModel.updatePricingOtherValue("signup_fee","0",t.fieldKey,t.variant,t.modeType)):t.productEditModel.updatePricingOtherValue("signup_fee",i.value,t.fieldKey,t.variant,t.modeType)},k=G(()=>{var S,V;const w=Number(t.variant.item_price)||0,B=Number((V=(S=t.variant)==null?void 0:S.other_info)==null?void 0:V.times)||1;return w*B}),b=w=>{const B=m.value.find(V=>V.value===w);return!(B!=null&&B.label)&&!w?"":((B==null?void 0:B.label)||w).split(" ").map(V=>V.charAt(0).toUpperCase()).join("")};return(w,B)=>{const S=C("el-switch"),V=C("el-option"),F=C("el-select"),$=C("el-form-item"),U=C("el-col"),D=C("el-input"),T=C("el-row"),I=C("el-checkbox"),L=C("el-tooltip");return r(),E(qn,null,{label:u(()=>[R(f(c(d)("Pricing")),1)]),action:u(()=>{var O;return[(O=e.variant)!=null&&O.other_info?(r(),h("div",gR,[e.isGroupMode?(r(),h("div",bR,[o("label",null,f(c(d)("Payment Type"))+":",1),s(F,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":B[1]||(B[1]=Q=>e.variant.other_info.payment_type=Q),"popper-class":"fct-group-select-popper",onChange:B[2]||(B[2]=Q=>{Q==="subscription"&&!e.variant.other_info.repeat_interval&&$e(()=>{e.variant.other_info.repeat_interval="yearly"})}),class:"fct-inline-select",placement:"bottom"},{default:u(()=>[s(V,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),s(V,{value:"subscription",label:c(d)("Subscription")},null,8,["label"]),s(V,{value:"onetime",label:c(d)("One-time")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(P,{key:0},[o("span",yR,f(c(d)("Subscription")),1),s(S,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:B[0]||(B[0]=Q=>{const H=Q?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",H,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",Q&&$e(()=>{var K;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((K=l.value.value)==null||K.focus())})})},null,8,["model-value"])],64))])):x("",!0)]}),default:u(()=>[o("div",wR,[s($,{class:"fct-price-with-inclusion__price"},{label:u(()=>{var O,Q;return[R(f(((Q=(O=e.variant)==null?void 0:O.other_info)==null?void 0:Q.installment)==="yes"?c(d)("Installment Price"):c(d)("Price"))+" ",1),e.isGroupMode?x("",!0):(r(),h("span",CR,"*"))]}),default:u(()=>{var O,Q;return[o("div",kR,[s(Ya,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:e.isGroupMode?c(d)("Unchanged"):((Q=(O=e.variant)==null?void 0:O.other_info)==null?void 0:Q.installment)==="yes"?c(d)("Installment Price"):c(d)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":B[3]||(B[3]=H=>{e.variant.item_price=H,e.productEditModel.updatePricingValue("item_price",H,e.fieldKey,e.variant,e.modeType)})},{suffix:u(()=>{var H,K,W,z;return[((K=(H=e.variant)==null?void 0:H.other_info)==null?void 0:K.installment)==="yes"?(r(),h("span",BR," x "+f((z=(W=e.variant)==null?void 0:W.other_info)==null?void 0:z.times),1)):x("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(r(),E($,{key:0,class:"fct-price-with-inclusion__tax"},{label:u(()=>[R(f(c(d)("Tax")),1)]),default:u(()=>{var O,Q;return[e.isGroupMode?(r(),E(F,{key:0,modelValue:e.variant.other_info.tax_inclusion,"onUpdate:modelValue":B[4]||(B[4]=H=>e.variant.other_info.tax_inclusion=H),"popper-class":"fct-group-select-popper"},{default:u(()=>[s(V,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),s(V,{value:"included",label:c(d)("Tax included")},null,8,["label"]),s(V,{value:"excluded",label:c(d)("Tax excluded")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(F,{key:1,"model-value":((Q=(O=e.variant)==null?void 0:O.other_info)==null?void 0:Q.tax_inclusion)||"_default_",onChange:B[5]||(B[5]=H=>{const K=H==="_default_"?"":H;e.variant.other_info&&(e.variant.other_info.tax_inclusion=K),e.productEditModel.updatePricingOtherValue("tax_inclusion",K,e.fieldKey,e.variant,e.modeType)})},{default:u(()=>[s(V,{value:"_default_",label:c(d)("Store default")},null,8,["label"]),s(V,{value:"included",label:c(d)("Tax included")},null,8,["label"]),s(V,{value:"excluded",label:c(d)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"]))]}),_:1})):x("",!0)]),s(vf,{modelValue:n.value,"onUpdate:modelValue":B[27]||(B[27]=O=>n.value=O)},{header:u(({isOpen:O})=>{var Q,H,K,W,z,Y;return[O?(r(),h("div",xR,f(c(d)("Additional display prices")),1)):(r(),h("div",SR,[o("div",$R,[R(f(c(d)("Compare-at"))+" ",1),o("span",FR,f((Q=e.variant)!=null&&Q.compare_price?c(jt)(e.variant.compare_price,!0):0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),h("div",ER,[R(f(c(d)("Installment"))+" ",1),o("span",UR,f(((K=(H=e.variant)==null?void 0:H.other_info)==null?void 0:K.installment)==="yes"?c(d)("Yes"):c(d)("No")),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",IR,[R(f(c(d)("Interval"))+" ",1),o("span",VR,f(b(e.variant.other_info.repeat_interval)),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",DR,[R(f(c(d)("Trial Days"))+" ",1),o("span",TR,f(((z=(W=e.variant)==null?void 0:W.other_info)==null?void 0:z.trial_days)??0),1)])):x("",!0),o("div",QR,[R(f(c(d)("Cost Per Item"))+" ",1),o("span",MR,f((Y=e.variant)!=null&&Y.item_cost?c(jt)(e.variant.item_cost,!0):c(d)("N/A")),1)])]))]}),default:u(()=>[o("div",LR,[s(T,{gutter:15},{default:u(()=>[s(U,{lg:12},{default:u(()=>[o("div",RR,[s($,null,{label:u(()=>[s(Ot,{title:c(d)("Compare at price"),content:c(d)("Set a higher price to show with a strike-through, highlighting a discount for sales")},null,8,["title","content"])]),default:u(()=>[s(Ya,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.compare_price`)?"is-error":"",id:`${e.fieldKey}.compare_price`,placeholder:e.isGroupMode?c(d)("Unchanged"):c(d)("Compare at price"),"model-value":e.variant.compare_price,"onUpdate:modelValue":B[6]||(B[6]=O=>{e.variant.compare_price=O,e.productEditModel.updatePricingValue("compare_price",O,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),_()?(r(),h(P,{key:0},[s(U,{lg:12},{default:u(()=>[o("div",OR,[s($,{label:c(d)("Interval"),required:""},{default:u(()=>[s(F,{class:ue(["fct-repeat-payment-every-select",e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.repeat_interval`)?"is-error":""]),id:`${e.fieldKey}.other_info.repeat_interval`,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":B[7]||(B[7]=O=>e.variant.other_info.repeat_interval=O),placeholder:c(d)("Interval"),onChange:B[8]||(B[8]=O=>{e.productEditModel.updatePricingOtherValue("repeat_interval",O,e.fieldKey,e.variant,e.modeType)})},{default:u(()=>[(r(!0),h(P,null,ae(m.value,O=>(r(),E(V,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),s(U,{lg:12},{default:u(()=>[s($,{class:"has-tooltip"},{label:u(()=>[s(Ot,{title:c(d)("Trial Days"),content:c(d)("Enter the number of days the free trial will last. The trial period cannot exceed 365 days.")},null,8,["title","content"])]),default:u(()=>[s(D,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.trial_days`)?"is-error":""),id:`${e.fieldKey}.other_info.trial_days`,placeholder:c(d)("Trial Days"),type:"number",min:1,max:365,modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":B[9]||(B[9]=O=>e.variant.other_info.trial_days=O),modelModifiers:{number:!0},autofocus:"",onInput:B[10]||(B[10]=O=>{e.productEditModel.updatePricingOtherValue("trial_days",O,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.trial_days`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})],64)):x("",!0)]),_:1}),_()?(r(),E(T,{key:0},{default:u(()=>{var O;return[s(U,{lg:24},{default:u(()=>[s($,null,{default:u(()=>[s(I,{"true-value":"yes","false-value":"no",label:c(d)("Enable installment payment"),class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.installment`)?"is-error":""),id:`${e.fieldKey}.other_info.installment`,placeholder:c(d)("Occurrence"),type:"number",modelValue:e.variant.other_info.installment,"onUpdate:modelValue":B[11]||(B[11]=Q=>e.variant.other_info.installment=Q),modelModifiers:{number:!0},disabled:!c(a),onChange:B[12]||(B[12]=Q=>{if(g("installment",Q,e.fieldKey,e.variant),Q==="no"){g("times",0,e.fieldKey,e.variant);return}(!e.variant.other_info.times||e.variant.other_info.times<2)&&g("times",2,e.fieldKey,e.variant)}),autofocus:""},null,8,["label","class","id","placeholder","modelValue","disabled"]),c(a)?x("",!0):(r(),E(L,{key:0,"popper-class":"fct-tooltip"},{content:u(()=>[R(f(c(d)("This feature is available in pro version only.")),1)]),default:u(()=>[s(X,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),s(ma,{visible:((O=e.variant.other_info)==null?void 0:O.installment)==="yes",accordion:""},{default:u(()=>[s(T,{gutter:15},{default:u(()=>{var Q;return[s(U,{lg:12},{default:u(()=>[s($,{required:"",class:"has-tooltip-and-required"},{label:u(()=>[s(Ot,{title:c(d)("Installment Count"),content:c(d)("Number of payments to split the price over the installment period.")},null,8,["title","content"])]),default:u(()=>[s(D,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:c(d)("Installment Count"),type:"number",min:ur,modelValue:e.variant.other_info.times,"onUpdate:modelValue":B[13]||(B[13]=H=>e.variant.other_info.times=H),modelModifiers:{number:!0},onInput:B[14]||(B[14]=H=>{g("times",H,e.fieldKey,e.variant)}),onChange:B[15]||(B[15]=H=>{y(H,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:l},null,8,["class","id","placeholder","modelValue"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((Q=e.variant.other_info)==null?void 0:Q.installment)==="yes"?(r(),E(U,{key:0,lg:12},{default:u(()=>[s($,null,{label:u(()=>[s(Ot,{title:c(d)("Total Price"),content:c(d)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:u(()=>[s(Ya,{id:`${e.fieldKey}.total_price`,disabled:"","model-value":k.value},null,8,["id","model-value"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})):x("",!0)]}),_:1})]),_:1},8,["visible"])]}),_:1})):x("",!0),_()?(r(),E(T,{key:1,gutter:15},{default:u(()=>{var O,Q;return[s(U,{lg:24},{default:u(()=>[o("div",PR,[s($,{label:e.isGroupMode?c(d)("Setup fee"):void 0,class:ue(e.isGroupMode?"fct-group-select-label":"")},{default:u(()=>[e.isGroupMode?(r(),E(F,{key:0,size:"small",modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":B[16]||(B[16]=H=>e.variant.other_info.manage_setup_fee=H),style:{width:"160px"},"popper-class":"fct-group-select-popper"},{default:u(()=>[s(V,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),s(V,{value:"yes",label:c(d)("Setup fee: Yes")},null,8,["label"]),s(V,{value:"no",label:c(d)("Setup fee: No")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),h(P,{key:1},[s(S,{size:"small",disabled:!c(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":B[17]||(B[17]=H=>e.variant.other_info.manage_setup_fee=H),"active-value":"yes","inactive-value":"no",onChange:v,"active-text":c(d)("Setup fee")},null,8,["disabled","modelValue","active-text"]),c(a)?x("",!0):(r(),h("span",HR,[s(L,{"popper-class":"fct-tooltip"},{content:u(()=>[R(f(c(d)("This feature is available in pro version only.")),1)]),default:u(()=>[s(X,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))],64))]),_:1},8,["label","class"])])]),_:1}),s(ma,{visible:((Q=(O=e.variant)==null?void 0:O.other_info)==null?void 0:Q.manage_setup_fee)=="yes",accordion:""},{default:u(()=>[s(T,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:u(()=>[s(U,{lg:12},{default:u(()=>[o("div",NR,[s($,{required:"",class:"has-tooltip-and-required"},{label:u(()=>[s(Ot,{title:c(d)("Setup fee label"),content:c(d)("Name the one-time setup fee (e.g., Initial Setup)")},null,8,["title","content"])]),default:u(()=>[s(D,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee_name`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee_name`,placeholder:c(d)("Setup fee name"),type:"text",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":B[18]||(B[18]=H=>e.variant.other_info.signup_fee_name=H),onInput:B[19]||(B[19]=H=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",H,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),s(U,{lg:12},{default:u(()=>[o("div",KR,[s($,{required:"",class:"has-tooltip-and-required"},{label:u(()=>[s(Ot,{title:c(d)("Setup fee amount"),content:c(d)("Set the one-time setup fee amount (e.g., $50) per order. This fee does not apply to quantity.")},null,8,["title","content"])]),default:u(()=>[s(Ya,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee`)?"is-error":"",id:`${e.fieldKey}.other_info.signup_fee`,placeholder:c(d)("Setup fee amount"),"model-value":e.variant.other_info.signup_fee,"onUpdate:modelValue":B[20]||(B[20]=H=>{e.variant.other_info.signup_fee=H,e.productEditModel.updatePricingOtherValue("signup_fee",H,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1})]),_:1})]),_:1},8,["visible"])]}),_:1})):x("",!0),s(T,{gutter:15},{default:u(()=>[e.variant.manage_cost||e.isGroupMode?(r(),E(U,{key:0,lg:24,class:"fct-manage-cost-col"},{default:u(()=>[o("div",GR,[s($,{label:e.isGroupMode?c(d)("Calculate profit/cost"):void 0,class:ue(e.isGroupMode?"fct-group-select-label":"")},{default:u(()=>[e.isGroupMode?(r(),E(F,{key:0,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":B[21]||(B[21]=O=>e.variant.manage_cost=O),style:{width:"200px"},"popper-class":"fct-group-select-popper"},{default:u(()=>[s(V,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),s(V,{value:"true",label:c(d)("Enable")},null,8,["label"]),s(V,{value:"false",label:c(d)("Disable")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(S,{key:1,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":B[22]||(B[22]=O=>e.variant.manage_cost=O),"active-value":"true","inactive-value":"false",onChange:B[23]||(B[23]=O=>{c(p)&&e.productEditModel.updatePricingValue("manage_cost",O,e.fieldKey,e.variant,e.modeType),fm(p)?p.value=!0:p=!0}),"active-text":c(d)("Calculate profit/cost")},null,8,["modelValue","active-text"]))]),_:1},8,["label","class"])])]),_:1})):x("",!0),s(ma,{visible:e.variant.manage_cost==="true",accordion:""},{default:u(()=>[s(T,{gutter:15,class:"fct-cost-profit-wrap"},{default:u(()=>{var O,Q,H;return[s(U,{lg:e.isGroupMode?24:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?12:8},{default:u(()=>[o("div",zR,[s($,null,{label:u(()=>[s(Ot,{title:c(d)("Cost per item"),content:c(d)("Customers won't see this")},null,8,["title","content"])]),default:u(()=>[s(Ya,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_cost`)?"is-error":"",id:`${e.fieldKey}.item_cost`,placeholder:e.isGroupMode?c(d)("Unchanged"):c(d)("Cost per item"),"model-value":e.variant.item_cost,"onUpdate:modelValue":B[24]||(B[24]=K=>{e.variant.item_cost=K,e.productEditModel.updatePricingValue("item_cost",K,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_cost`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1},8,["lg"]),e.isGroupMode?x("",!0):(r(),E(U,{key:0,lg:((Q=e.product.detail)==null?void 0:Q.variation_type)==="simple_variations"?6:8},{default:u(()=>[o("div",jR,[s($,{label:c(d)("Profit")},{default:u(()=>[s(D,{disabled:"",class:"fct-profit-display",value:c(th)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?x("",!0):(r(),E(U,{key:1,lg:((H=e.product.detail)==null?void 0:H.variation_type)==="simple_variations"?6:8},{default:u(()=>[o("div",qR,[s($,{label:c(d)("Margin")},{default:u(()=>[s(D,{disabled:"",class:"fct-margin-display",value:c(ah)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),s(U,{lg:24},{default:u(()=>[o("div",YR,[(e.variant.other_info,x("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},WR={class:"fct-adjust-by-wrap"},JR={class:"fct-adjust-by-row"},XR={class:"fct-adjust-by-col"},ZR={class:"title"},eO={class:"fct-adjust-by-col"},tO={class:"title"},aO={class:"fct-adjust-by-action"},Xr={__name:"StockAdjuster",props:{variant:Object,fieldKey:String,productEditModel:Object},emits:["save"],setup(e,{expose:t,emit:a}){const l=a,n=M(!1);return t({toggle:()=>n.value=!n.value}),(i,A)=>{const p=C("el-input"),m=C("el-button"),_=C("el-popover");return r(),E(_,{visible:n.value,"popper-class":"fct-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:u(()=>[o("div",{onClick:A[7]||(A[7]=g=>n.value=!n.value),class:"fct-stock-adjuster-trigger"},[s(X,{name:"Configuration"})])]),default:u(()=>[o("div",WR,[o("div",JR,[o("div",XR,[o("span",ZR,f(c(d)("Adjust by")),1),s(p,{size:"small",placeholder:c(d)("Quantity"),type:"number",modelValue:e.variant.adjusted_quantity,"onUpdate:modelValue":A[0]||(A[0]=g=>e.variant.adjusted_quantity=g),modelModifiers:{number:!0},onKeyup:A[1]||(A[1]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g.target.value,e.fieldKey,e.variant)}),onChange:A[2]||(A[2]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])]),o("div",eO,[o("span",tO,f(c(d)("New Stock")),1),s(p,{size:"small",placeholder:c(d)("New Stock"),type:"number",min:1,modelValue:e.variant.new_stock,"onUpdate:modelValue":A[3]||(A[3]=g=>e.variant.new_stock=g),modelModifiers:{number:!0},onKeyup:A[4]||(A[4]=g=>{e.productEditModel.onChangeNewStock("new_stock",g.target.value,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])])]),o("div",aO,[s(m,{size:"small",type:"info",soft:"",onClick:A[5]||(A[5]=g=>n.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(m,{size:"small",type:"primary",onClick:A[6]||(A[6]=g=>{n.value=!1,l("save")}),disabled:e.variant.new_stock===""},{default:u(()=>[R(f(c(d)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},lO={class:"fct-shared-variant-item-box__switch"},sO={key:1,class:"fct-inline-select-wrap"},nO={key:0,class:"fct-variant-inventory-global-off",role:"alert"},oO={class:"fct-variant-inventory-global-off__text"},iO={class:"fct-variant-inventory-global-off__action"},rO={key:1,class:"fct-variant-stock-grid"},dO={class:"fct-variant-stock-box"},uO={class:"fct-stock-box-label"},cO={class:"fct-stock-box-content fct-stock-box-total-content"},AO={class:"fct-stock-number"},pO={class:"fct-variant-stock-box"},fO={class:"fct-stock-box-label"},mO={class:"fct-stock-box-content"},hO={class:"fct-stock-number"},_O={class:"fct-variant-stock-box"},vO={class:"fct-stock-box-label"},gO={class:"fct-stock-box-content"},yO={class:"fct-stock-number"},bO={class:"fct-variant-stock-box"},wO={class:"fct-stock-box-label"},CO={class:"fct-stock-box-content"},kO={class:"fct-stock-number"},BO={key:2,class:"fct-admin-input-wrapper"},xO={key:0,class:"fct-collapse-heading"},SO={key:1,class:"fct-tag-group"},$O={class:"fct-tag-item"},FO={class:"fct-admin-input-wrapper"},EO={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},UO=["disabled"],kf={__name:"VariantInventory",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=M(!1),l=G(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),n=G(()=>{var b,w,B,S;return((w=(b=t.product)==null?void 0:b.detail)==null?void 0:w.manage_stock)=="1"||((S=(B=t.product)==null?void 0:B.detail)==null?void 0:S.manage_stock)==1}),i=M(!1),A=M(!1),p=b=>{b&&m()},m=()=>{i.value||(i.value=!0,ce.put(`products/${t.product.ID}/update-manage-stock`,{manage_stock:"1"}).then(b=>{t.product.detail.manage_stock="1",(t.product.variants||[]).forEach(w=>{w.manage_stock="1"}),t.variant.manage_stock="1",t.productEditModel.updatePricingValue("manage_stock","1",t.fieldKey,t.variant,t.modeType),j.success((b==null?void 0:b.message)||d("Inventory Management enabled"))}).catch(b=>{var w;A.value=!1,(b==null?void 0:b.status_code)=="422"?j.validationErrors(b):j.error(((w=b==null?void 0:b.data)==null?void 0:w.message)||d("Failed to update inventory"))}).finally(()=>{i.value=!1}))},_=G(()=>Ke.get("modules_settings.stock_management.active")==="yes"),g=G(()=>{var b;return _.value?["simple_variations","advanced_variations"].includes((b=t.product.detail)==null?void 0:b.variation_type):!1}),y=b=>{t.productEditModel.updatePricingValue("manage_stock",b,t.fieldKey,t.variant,t.modeType)};Te(()=>{t.variant.new_stock===void 0&&(t.variant.new_stock=t.variant.total_stock),t.variant.adjusted_quantity===void 0&&(t.variant.adjusted_quantity=0)});const v=()=>{let b=parseInt(t.variant.new_stock)||0;const w=t.variant.total_stock,B=t.variant.available;t.variant.total_stock=b<0?0:b;let S=(parseInt(t.variant.total_stock)||0)-(parseInt(t.variant.committed)||0)-(parseInt(t.variant.on_hold)||0);if(t.variant.available=S<0?0:S,t.variant.adjusted_quantity=0,t.variant.new_stock=t.variant.total_stock,!t.variant.id){t.productEditModel.updatePricingValue("total_stock",t.variant.total_stock,t.fieldKey,t.variant,t.modeType),t.productEditModel.updatePricingValue("available",t.variant.available,t.fieldKey,t.variant,t.modeType);return}ce.put(`products/${t.product.ID}/update-inventory/${t.variant.id}`,{total_stock:t.variant.total_stock,available:t.variant.available}).then(V=>{j.success(V.message)}).catch(V=>{var F;t.variant.total_stock=w,t.variant.available=B,t.variant.new_stock=w,j.error(((F=V==null?void 0:V.data)==null?void 0:F.message)||d("Failed to update inventory"))})},k=()=>{var V;if(a.value)return;const b=t.product.post_title||"";if(!b)return;const B=["simple_variations","advanced_variations"].includes((V=t.product.detail)==null?void 0:V.variation_type)&&t.variant.variation_title||"",S=t.variant.id||0;a.value=!0,ce.get("products/suggest-sku",{title:b,variant_title:B,exclude_id:S}).then(F=>{F!=null&&F.sku&&(t.variant.sku=F.sku,t.productEditModel.updatePricingValue("sku",F.sku,t.fieldKey,t.variant,t.modeType))}).catch(F=>{var U;const $=((U=F==null?void 0:F.data)==null?void 0:U.message)||d("Failed to generate SKU.");j.error($)}).finally(()=>{a.value=!1})};return(b,w)=>{var U;const B=C("el-switch"),S=C("el-option"),V=C("el-select"),F=C("el-input"),$=C("el-form-item");return r(),E(qn,{class:ue(["fct-variant-inventory",((U=e.product.detail)==null?void 0:U.variation_type)==="simple"?"fct-variant-inventory--simple":""])},sa({default:u(()=>[g.value&&!n.value?(r(),h("div",nO,[o("span",oO,[s(X,{name:"Warning"}),R(" "+f(c(d)("Enable inventory to track stock and manage availability for this product and its variations.")),1)]),o("span",iO,[s(B,{size:"small",modelValue:A.value,"onUpdate:modelValue":w[2]||(w[2]=D=>A.value=D),loading:i.value,disabled:i.value,onChange:p},null,8,["modelValue","loading","disabled"])])])):x("",!0),l.value&&g.value&&!e.isGroupMode?(r(),h("div",rO,[o("div",dO,[o("div",uO,f(c(d)("Total Stock")),1),o("div",cO,[o("div",AO,f(e.variant.total_stock),1),s(Xr,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:v},null,8,["variant","field-key","product-edit-model"])])]),o("div",pO,[o("div",fO,f(c(d)("Available")),1),o("div",mO,[o("div",hO,f(e.variant.available),1)])]),o("div",_O,[o("div",vO,f(c(d)("On Hold")),1),o("div",gO,[o("div",yO,f(e.variant.on_hold),1)])]),o("div",bO,[o("div",wO,f(c(d)("Delivered")),1),o("div",CO,[o("div",kO,f(e.variant.committed),1)])])])):x("",!0),l.value&&g.value&&e.isGroupMode?(r(),h("div",BO,[s($,{label:c(d)("Total Stock")},{default:u(()=>[s(F,{type:"number",min:0,placeholder:c(d)("Unchanged"),modelValue:e.variant.total_stock,"onUpdate:modelValue":w[3]||(w[3]=D=>e.variant.total_stock=D)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])])):x("",!0),e.isGroupMode?x("",!0):(r(),E(vf,{key:3},{header:u(({isOpen:D})=>[D?(r(),h("div",xO,f(c(d)("More details")),1)):x("",!0),D?x("",!0):(r(),h("div",SO,[o("div",$O,f(c(d)("SKU")),1)]))]),default:u(()=>[o("div",FO,[s($,null,{label:u(()=>[o("div",EO,[s(Ot,{title:c(d)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),o("button",{type:"button",onClick:k,disabled:!e.product.post_title||a.value,class:"underline-link-button fct-generate-sku-btn"},f(a.value?c(d)("Generating..."):c(d)("Generate SKU")),9,UO)])]),default:u(()=>[s(F,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:c(d)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":w[4]||(w[4]=D=>e.variant.sku=D),maxlength:"30","show-word-limit":"",onInput:w[5]||(w[5]=D=>{e.productEditModel.updatePricingValue("sku",D,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),s(zt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}))]),_:2},[g.value?{name:"label",fn:u(()=>[R(f(c(d)("Inventory")),1)]),key:"0"}:void 0,g.value&&n.value?{name:"action",fn:u(()=>[o("div",lO,[e.isGroupMode?(r(),h("div",sO,[o("label",null,f(c(d)("Manage Stock"))+":",1),s(V,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":w[1]||(w[1]=D=>e.variant.manage_stock=D),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:u(()=>[s(S,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),s(S,{value:"1",label:c(d)("Manage stock")},null,8,["label"]),s(S,{value:"0",label:c(d)("Don't manage")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),E(B,{key:0,size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":w[0]||(w[0]=D=>e.variant.manage_stock=D),onChange:y,"active-value":"1","inactive-value":"0"},null,8,["modelValue"]))])]),key:"1"}:void 0]),1032,["class"])}}},IO={class:"fct-shared-variant-item-box__switch"},VO={class:"fct-shared-variant-item-box__hint"},DO={key:1,class:"fct-inline-select-wrap"},TO={key:0,class:"fct-package-select-icon"},QO={class:"fct-add-new-package-option"},MO={class:"fct-package-options"},LO={class:"fct-package-options-info"},RO={class:"fct-package-options-name"},OO={class:"fct-package-options-dimensions"},PO={class:"fct-product-weight-input"},Bf={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){var b,w;const t=e,a=M(!1),l=M(!1),n=M(Ke.get("shop.shipping_packages")||[]),i=[{label:"kg",value:"kg"},{label:"g",value:"g"},{label:"lbs",value:"lbs"},{label:"oz",value:"oz"}],A={box:"Box",envelope:"Envelope",soft_package:"SoftPackage"},p=G(()=>{var S,V;const B=(V=(S=t.variant)==null?void 0:S.other_info)==null?void 0:V.package_slug;return B?n.value.find(F=>F.slug===B)||null:n.value.find(F=>F.is_default)||null}),m=B=>{if(!B)return d("Select a package");const S=B.type==="envelope"?B.length+" × "+B.width+" "+B.dimension_unit:B.length+" × "+B.width+" × "+B.height+" "+B.dimension_unit;return(B.is_default?d("Store default")+" · ":"")+B.name+" - "+S+", "+B.weight+" "+B.weight_unit},_=()=>ce.get("shipping/packages").then(B=>{n.value=B.packages||n.value}).catch(()=>{eu({message:d("Failed to load packages."),type:"error"})}),g=M(((w=(b=t.variant)==null?void 0:b.other_info)==null?void 0:w.package_slug)||""),y=async B=>{if(B==="__add_new__"){t.variant.other_info.package_slug=g.value,await _(),a.value=!0;return}g.value=B||"",t.productEditModel.updatePricingOtherValue("package_slug",B,t.fieldKey,t.variant,t.modeType)},v=B=>{t.productEditModel.updatePricingOtherValue("weight_unit",B,t.fieldKey,t.variant,t.modeType)},k=B=>{const S=JSON.parse(JSON.stringify(n.value));B.is_default&&n.value.forEach($=>{$.is_default=!1});let V=B.slug,F=1;for(;n.value.some($=>$.slug===V);)V=B.slug+"-"+F,F++;B.slug=V,n.value.push(B),l.value=!0,ce.post("shipping/packages",{packages:n.value}).then($=>{n.value=$.packages||n.value,a.value=!1,y(B.slug)}).catch(()=>{n.value=S,eu({message:d("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(B,S)=>{const V=C("el-switch"),F=C("el-option"),$=C("el-select"),U=C("el-form-item"),D=C("el-col"),T=C("el-input"),I=C("el-row");return r(),h(P,null,[e.variant.other_info?(r(),E(qn,{key:0},{label:u(()=>[R(f(c(d)("Shipping")),1)]),action:u(()=>[o("div",IO,[e.isGroupMode?(r(),h("div",DO,[o("label",null,f(c(d)("Fulfillment Type"))+":",1),s($,{size:"small",modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":S[2]||(S[2]=L=>e.variant.fulfillment_type=L),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:u(()=>[s(F,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),s(F,{value:"physical",label:c(d)("Physical")},null,8,["label"]),s(F,{value:"digital",label:c(d)("Digital")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(P,{key:0},[o("span",VO,f(c(d)("Physical Product")),1),s(V,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":S[0]||(S[0]=L=>e.variant.fulfillment_type=L),"active-value":"physical","inactive-value":"digital",onChange:S[1]||(S[1]=L=>{e.productEditModel.updatePricingValue("fulfillment_type",L,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])],64))])]),default:u(()=>[s(ma,{visible:e.variant.fulfillment_type==="physical",accordion:""},{default:u(()=>[s(I,{gutter:10,class:"fct-physical-product-meta-row"},{default:u(()=>[s(D,{xs:24,sm:14,lg:14},{default:u(()=>[s(U,null,{label:u(()=>[R(f(c(d)("Package")),1)]),default:u(()=>[s($,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":S[3]||(S[3]=L=>e.variant.other_info.package_slug=L),placeholder:c(d)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:u(()=>[p.value?(r(),h("span",TO,[s(X,{name:A[p.value.type]||"Box"},null,8,["name"])])):x("",!0)]),default:u(()=>[s(F,{value:"__add_new__",label:c(d)("Add new package")},{default:u(()=>[o("div",QO," + "+f(c(d)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(P,null,ae(n.value,L=>(r(),E(F,{key:L.slug,label:m(L),value:L.slug},{default:u(()=>[o("div",MO,[s(X,{name:A[L.type]||"Box"},null,8,["name"]),o("div",LO,[o("span",RO,f(L.is_default?c(d)("Store default")+" · ":"")+f(L.name),1),o("span",OO,f(L.type==="envelope"?L.length+" × "+L.width:L.length+" × "+L.width+" × "+L.height)+" "+f(L.dimension_unit)+", "+f(L.weight)+" "+f(L.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),s(D,{xs:24,sm:10,lg:10},{default:u(()=>[s(U,null,{label:u(()=>[R(f(c(d)("Product weight")),1)]),default:u(()=>[o("div",PO,[s(T,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":S[5]||(S[5]=L=>e.variant.other_info.weight=L),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:S[6]||(S[6]=L=>{e.productEditModel.updatePricingOtherValue("weight",L,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:u(()=>[s($,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":S[4]||(S[4]=L=>e.variant.other_info.weight_unit=L),onChange:v,class:"fct-product-weight-unit"},{default:u(()=>[(r(),h(P,null,ae(i,L=>s(F,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):x("",!0),s(Pm,{modelValue:a.value,"onUpdate:modelValue":S[7]||(S[7]=L=>a.value=L),saving:l.value,onSave:k},null,8,["modelValue","saving"])],64)}}},HO={key:0,class:"fct-tax-class-control"},NO={class:"fct-inline-select-wrap"},KO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},GO=["title"],zO={key:1,class:"fct-tax-class-control"},jO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},qO=["title"],xf={__name:"VariationTaxClass",props:{variant:Object,productEditModel:Object,fieldKey:String,modeType:String,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=M([]),l=B=>{if(!B)return"standard";const S=a.value.find(F=>String(F.slug)===String(B));if(S)return S.slug;const V=a.value.find(F=>String(F.id)===String(B));return V?V.slug:B},n=G(()=>dt.get(t.variant,"other_info.tax_exempt","no")),i=G(()=>{const B=dt.get(t.variant,"other_info.tax_class","standard");return l(B)||"standard"}),A=M(n.value!=="yes"),p=M(i.value||"standard");be([n,i,a],([B,S])=>{A.value=B!=="yes",p.value=S||"standard"});const m=()=>{t.variant.other_info||(t.variant.other_info={})},_=(B,S)=>{m(),t.variant.other_info.tax_exempt=B,t.variant.other_info.tax_class=S||"standard",t.productEditModel&&t.fieldKey&&(t.productEditModel.updatePricingOtherValue("tax_exempt",t.variant.other_info.tax_exempt,t.fieldKey,t.variant,t.modeType),t.productEditModel.updatePricingOtherValue("tax_class",t.variant.other_info.tax_class,t.fieldKey,t.variant,t.modeType))},g=()=>{ce.get("tax/classes").then(B=>{a.value=B.classes||[]}).catch(()=>{j.error(d("Failed to load tax classes"))})},y=B=>{const S=p.value||i.value||"standard";A.value=B,p.value=S,_(B?"no":"yes",S)},v=B=>{p.value=B,A.value=!0,_("no",B)},k=()=>{const B=a.value.find(S=>S.slug===p.value);return B?B.title:"Standard"},b=()=>{var V,F;const B=(F=(V=t.variant)==null?void 0:V.other_info)==null?void 0:F.tax_class;if(!B)return d("Unchanged");const S=a.value.find($=>$.slug===B);return S?S.title:B},w=B=>{t.variant.other_info&&(t.variant.other_info.tax_class=B)};return Te(()=>{g()}),(B,S)=>{const V=C("el-option"),F=C("el-select"),$=C("el-dropdown-item"),U=C("el-dropdown-menu"),D=C("el-dropdown"),T=C("el-checkbox");return r(),E(qn,null,{label:u(()=>[R(f(c(d)("Tax")),1)]),default:u(()=>[e.isGroupMode?(r(),h("div",HO,[o("div",NO,[o("label",null,f(c(d)("Tax Exemption"))+":",1),s(F,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":S[0]||(S[0]=I=>e.variant.other_info.tax_exempt=I),size:"small",class:"fct-inline-select",placement:"bottom","popper-class":"fct-group-select-popper"},{default:u(()=>[s(V,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),s(V,{value:"no",label:c(d)("Charge tax")},null,8,["label"]),s(V,{value:"yes",label:c(d)("Tax exempt")},null,8,["label"])]),_:1},8,["modelValue"])]),e.variant.other_info.tax_exempt==="no"&&a.value.length>=1?(r(),h("div",KO,[o("span",null,[R(f(c(d)("Class:"))+" ",1),o("strong",{class:ue(e.variant.other_info.tax_class&&e.variant.other_info.tax_class!=="standard"?"text-red-500 dark:text-red-400":"")},f(b()),3)]),a.value.length>1?(r(),E(D,{key:0,trigger:"click",onCommand:w},{dropdown:u(()=>[s(U,null,{default:u(()=>[s($,{command:null,class:ue({"is-active":!e.variant.other_info.tax_class})},{default:u(()=>[R(f(c(d)("Unchanged")),1)]),_:1},8,["class"]),(r(!0),h(P,null,ae(a.value,I=>(r(),E($,{key:I.slug,command:I.slug,class:ue({"is-active":e.variant.other_info.tax_class===I.slug})},{default:u(()=>[R(f(I.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:u(()=>[o("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:c(d)("Change tax class")},S[2]||(S[2]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[o("path",{d:"M13.488 2.513a1.75 1.75 0 0 0-2.475 0L3.22 10.303a.75.75 0 0 0-.178.31l-.893 3.125a.75.75 0 0 0 .926.926l3.125-.893a.75.75 0 0 0 .31-.178l7.79-7.79a1.75 1.75 0 0 0 0-2.475l-.812-.815ZM12.074 3.574a.25.25 0 0 1 .354 0l.812.812a.25.25 0 0 1 0 .354L5.45 12.529l-1.838.526.525-1.838 7.937-7.643Z"})],-1)]),8,GO)]),_:1})):x("",!0)])):x("",!0)])):(r(),h("div",zO,[s(T,{class:"fct-tax-class-control__checkbox",modelValue:A.value,"onUpdate:modelValue":S[1]||(S[1]=I=>A.value=I),onChange:y},{default:u(()=>[R(f(c(d)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),A.value&&a.value.length>=1?(r(),h("div",jO,[o("span",null,[R(f(c(d)("Class:"))+" ",1),o("strong",{class:ue(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},f(k()),3)]),a.value.length>1?(r(),E(D,{key:0,trigger:"click",onCommand:v},{dropdown:u(()=>[s(U,null,{default:u(()=>[(r(!0),h(P,null,ae(a.value,I=>(r(),E($,{key:I.slug,command:I.slug,class:ue({"is-active":p.value===I.slug})},{default:u(()=>[R(f(I.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:u(()=>[o("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:c(d)("Change tax class")},S[3]||(S[3]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[o("path",{d:"M13.488 2.513a1.75 1.75 0 0 0-2.475 0L3.22 10.303a.75.75 0 0 0-.178.31l-.893 3.125a.75.75 0 0 0 .926.926l3.125-.893a.75.75 0 0 0 .31-.178l7.79-7.79a1.75 1.75 0 0 0 0-2.475l-.812-.815ZM12.074 3.574a.25.25 0 0 1 .354 0l.812.812a.25.25 0 0 1 0 .354L5.45 12.529l-1.838.526.525-1.838 7.937-7.643Z"})],-1)]),8,qO)]),_:1})):x("",!0)])):x("",!0)]))]),_:1})}}},YO={class:"fct-product-pricing-form-wrap"},WO={class:"fct-product-pricing-form-inner"},JO={key:0,class:"dialog-footer"},XO={class:"fct-btn-group sm"},Nd={__name:"ProductPricingForm",props:{modeType:String,index:Number,fieldKey:String,product:Object,productEditModel:Object,variantTitleInfo:Object},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const l=e,n=M({}),i=a,A=As(),p=M(0),m=M(!1),_=M({}),g=M(null),y=M(!1),v=Q=>Q?JSON.parse(JSON.stringify(Q)):{},k=(Q=l.modeType,H=l.index)=>{var W,z,Y;if(Q==="create")return"create";if(Q==="duplicate"){const Z=(W=l.product.variants)==null?void 0:W[H];return`duplicate-${(Z==null?void 0:Z.id)??H??"draft"}`}if(((z=l.product.detail)==null?void 0:z.variation_type)==="simple")return"simple-0";const K=(Y=l.product.variants)==null?void 0:Y[H];return`update-${(K==null?void 0:K.id)??H??"draft"}`},b=(Q=l.modeType,H=l.index,K=n.value)=>({modeType:Q,index:H,variant:v(K)}),w=()=>{if(y.value){y.value=!1;return}!g.value||m.value||!p.value||(_.value[g.value]=b())},B=()=>{var Q;(Q=n.value)!=null&&Q.other_info&&(n.value.other_info.payment_type||(n.value.other_info.payment_type="onetime"),n.value.other_info.weight_unit||(n.value.other_info.weight_unit=$.value),n.value.other_info.package_slug===void 0&&(n.value.other_info.package_slug=""))},S=async()=>{var H,K,W,z;w(),m.value=!0,p.value=0,g.value=k();const Q=(H=_.value[g.value])==null?void 0:H.variant;if(Q){n.value=v(Q),B(),await $e(),p.value=1,m.value=!1;return}((K=l.product.detail)==null?void 0:K.variation_type)==="simple"?Array.isArray(l.product.variants)&&l.product.variants.length===0?(n.value=l.productEditModel.addDummyVariant(),n.value.variation_title=l.product.post_title):n.value=l.product.variants[0]:l.modeType==="create"?n.value=l.productEditModel.addDummyVariant():l.modeType==="update"?n.value=v((W=l.product.variants)==null?void 0:W[l.index]):l.modeType==="duplicate"?(n.value=v((z=l.product.variants)==null?void 0:z[l.index]),n.value.serial_index=l.productEditModel.variantsLength()+1,n.value.variation_title=`${d("Copy of")} ${n.value.variation_title||""}`.trim(),n.value.sku="",n.value.on_hold=0,n.value.committed=0,n.value.available=n.value.total_stock??0,delete n.value.id):n.value={},B(),await $e(),p.value=0,m.value=!1},V=async()=>{var Q;try{let H=l.index;const K=v(n.value);l.modeType==="duplicate"&&(H=l.productEditModel.variantsLength(),K.rowId=(K.rowId??0)+1);let W=await l.productEditModel.createOrUpdatePricing(K);return(Q=W==null?void 0:W.data)!=null&&Q.id?(K.id=W.data.id,l.productEditModel.afterCreatingOrUpdatingPricing(H,K),H==null&&(H=l.product.variants.findIndex(z=>(z==null?void 0:z.id)===K.id),H===-1&&(H=l.product.variants.length-1)),g.value&&delete _.value[g.value],p.value=0,i("createOrUpdateVariant",{index:H,modeType:l.modeType,variant:v(K)}),{index:H,modeType:l.modeType,variant:v(K)}):null}catch{return null}},F=async()=>V(),$=G(()=>Ke.get("shop.weight_unit")||"kg"),U=()=>{const Q={..._.value};return g.value&&p.value&&(Q[g.value]=b()),Object.entries(Q)},D=()=>U().length>0,T=()=>U().length,I=G(()=>U().length),L=async()=>{y.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await S()};return be(n,()=>{m.value||p.value++},{deep:!0}),be(()=>[l.modeType,l.index],()=>{S()},{immediate:!0}),be(I,Q=>{i("dirtyStateChange",!!Q)},{immediate:!0}),A.bind(["mod+s"],Q=>{var H,K;((K=(H=l.product)==null?void 0:H.detail)==null?void 0:K.variation_type)!=="simple"&&(Q.preventDefault(),p.value&&F())}),xt(()=>{A.unbind("mod+s")}),t({hasDirtyDrafts:D,getDirtyDraftCount:T,discardDrafts:L,saveCurrentDraft:V,loadVariantFromProps:S,getVariantData:()=>v(n.value)}),(Q,H)=>{const K=C("el-form"),W=C("el-button");return r(),h("div",YO,[o("div",WO,[s(K,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[s(cR,{variant:n.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel,"title-info":e.variantTitleInfo},null,8,["variant","field-key","mode-type","product","product-edit-model","title-info"]),s(Cf,{variant:n.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),s(kf,{variant:n.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),s(Bf,{variant:n.value,"field-key":l.fieldKey,"mode-type":e.modeType,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),E(xf,{key:0,variant:n.value,"product-edit-model":e.productEditModel,"field-key":l.fieldKey,"mode-type":e.modeType},null,8,["variant","product-edit-model","field-key","mode-type"])):x("",!0)]),_:1})]),e.modeType!=="add"?(r(),h("div",JO,[o("div",XO,[I.value?(r(),E(W,{key:0,onClick:L},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1})):x("",!0),s(W,{onClick:H[0]||(H[0]=()=>{i("closeModal")})},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(W,{disabled:e.productEditModel.saving||e.modeType==="update"&&!I.value,onClick:F,type:"primary",loading:e.productEditModel.saving},{default:u(()=>[R(f(typeof n.value.id>"u"?c(d)("Save"):c(d)("Update")),1)]),_:1},8,["disabled","loading"])])])):x("",!0)])}}},ZO={class:"fct-product-button-and-drawer-wrap"},eP={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},tP={key:1,class:"fct-btn-group sm"},aP={class:"more-btn"},cr={__name:"ProductPricingActions",props:{modeType:String,index:Number,variant:{type:Object,default:{}},product:Object,productEditModel:Object},emits:["open-editor"],setup(e,{emit:t}){const a=e,l=t;let n=M(null);const i=M(1),A=(v="update")=>{l("open-editor",{modeType:v,index:a.index??null})},p=G(()=>{var v;return{product:a.product,variant:a.variant,index:a.index,productEditModel:a.productEditModel,openPricingModal:k=>{A(k)},vueContext:(v=aa())==null?void 0:v.ctx}}),m=M([]),_=()=>{var w,B;const v=((w=window==null?void 0:window.fluent_cart_admin)==null?void 0:w.hooks)||(window==null?void 0:window.fluentCartAdminHooks),k=[],b=(B=v==null?void 0:v.applyFilters)==null?void 0:B.call(v,"fluent_cart_product_pricing_actions_dropdown_items",k,p.value);m.value=Array.isArray(b)?b:k},g=v=>v?typeof v.disabled=="function"?!!v.disabled(p.value):!!v.disabled:!1;Te(()=>{n.value=a.index,_(),setTimeout(_,0)});const y=v=>{var k,b;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const w=((k=window==null?void 0:window.fluent_cart_admin)==null?void 0:k.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(b=w==null?void 0:w.doAction)==null?void 0:b.call(w,"fluent_cart_product_pricing_actions_dropdown_command",v.command,p.value,v)}}v==="duplicate_pricing"?A("duplicate"):v==="delete_variant"&&a.productEditModel.deletePricing(a.variant.id,a.index)};return(v,k)=>{const b=C("el-button"),w=C("el-checkbox"),B=C("el-dropdown-item"),S=C("el-dropdown-menu"),V=C("el-dropdown");return r(),h("div",ZO,[a.modeType=="add"?(r(),h("div",eP,[e.product.detail.variation_type!=="simple"?(r(),E(b,{key:0,text:"",type:"primary",onClick:k[0]||(k[0]=F=>A("create"))},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(e.product.variants.length>0?v.$t("Add more"):v.$t("Add Pricing")),1)]),_:1})):x("",!0)])):x("",!0),a.modeType=="action"?(r(),h("div",tP,[s(tt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:k[1]||(k[1]=F=>A("update"))},{default:u(()=>[s(X,{name:"Edit"})]),_:1}),s(V,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:k[5]||(k[5]=F=>{F&&_()})},{dropdown:u(()=>[s(S,null,{default:u(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),E(B,{key:0,class:"item-checkbox"},{default:u(()=>[s(w,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":k[2]||(k[2]=F=>e.variant.manage_stock=F),onChange:k[3]||(k[3]=F=>{e.productEditModel.onChangePricing("manage_stock",c(n),F)}),"true-value":"0","false-value":"1"},{default:u(()=>[R(f(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):x("",!0),s(B,{class:"show-on-mobile",onClick:k[4]||(k[4]=F=>A("update"))},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),E(B,{key:1,command:"duplicate_pricing"},{default:u(()=>[s(X,{name:"Duplicate"}),R(" "+f(v.$t("Duplicate")),1)]),_:1})):x("",!0),s(B,null,{default:u(()=>[e.variant.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(e.variant.id),showMode:"icon_with_text",buttonText:v.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:1}),s(B,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:u(()=>{var F;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((F=v.appVars)==null?void 0:F.frontend_url)+"=instant_checkout&item_id="+e.variant.id+"&quantity=1",showMode:"icon_with_text",buttonText:v.$t("Direct Checkout"),tooltipContent:v.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[s(X,{name:"Copy"}),R(" "+f(v.$t("Direct Checkout"))+" ",1),s(Ot,{content:v.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:1},8,["disabled"]),(r(!0),h(P,null,ae(m.value,(F,$)=>(r(),E(B,{key:"js_item_"+$,command:F,class:ue(F==null?void 0:F.class),divided:!!(F!=null&&F.divided),disabled:g(F)},{default:u(()=>[F!=null&&F.icon?(r(),E(X,{key:0,name:F.icon},null,8,["name"])):x("",!0),R(" "+f(F==null?void 0:F.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>i.value?(r(),E(B,{key:2,command:"delete_variant",class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(v.$t("Delete")),1)]),_:1})):x("",!0)]),_:1})]),default:u(()=>[o("span",aP,[s(X,{name:"More"})])]),_:1})])):x("",!0)])}}},lP={class:"fct-variant-pricing-add-button-wrap"},sP={__name:"VariantPricingAddButton",props:{product:Object,drawerMode:String,isVariationDirty:Boolean},emits:["open-editor"],setup(e,{emit:t}){const a=e,l=t,n=()=>{l("open-editor",{modeType:"create"})},i=()=>a.drawerMode==="create"||a.isVariationDirty;return(A,p)=>{var _;const m=C("el-button");return r(),h("div",lP,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),E(m,{key:0,text:"",type:"primary",disabled:i(),onClick:n,size:"small"},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(e.product.variants.length>0?A.$t("Add more"):A.$t("Add Pricing")),1)]),_:1},8,["disabled"])):x("",!0)])}}},nP={class:"fct-shared-variant-nav__summary"},oP={class:"fct-shared-variant-nav__summary-product"},iP={class:"fct-shared-variant-nav__summary-product-name"},rP={class:"fct-shared-variant-nav__summary-meta"},dP={class:"fct-shared-variant-nav__status"},uP={class:"fct-shared-variant-nav__variant-count"},Zr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",nP,[o("div",oP,[o("h3",iP,f(e.product.post_title||c(d)("Untitled product")),1)]),o("div",rP,[o("span",dP,[s(Ht,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",uP,f(e.product.variants.length)+" "+f(c(d)("variants")),1)])]))}},cP={class:"fct-shared-variant-nav__group-header"},AP=["aria-expanded","onClick"],pP={class:"fct-shared-variant-nav__group-caret"},fP={class:"fct-shared-variant-nav__group-title"},mP={class:"fct-shared-variant-nav__group-count"},hP=["aria-label","onClick"],_P={class:"fct-shared-variant-nav__group-body"},vP=["disabled","aria-current","onClick"],gP={class:"fct-shared-variant-nav__item-image-wrapper"},yP={class:"fct-shared-variant-nav__item-image"},bP=["src","alt"],wP=["src","alt"],CP={key:0,class:"fct-shared-variant-nav__item-dot"},kP={class:"fct-shared-variant-nav__item-content"},BP={class:"fct-shared-variant-nav__item-title"},xP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},SP={class:"fct-shared-variant-nav__item-meta"},$P=["disabled","aria-label"],FP=["disabled","aria-label"],EP={class:"more-btn"},UP=["disabled","aria-current","onClick"],IP={class:"fct-shared-variant-nav__item-image-wrapper"},VP={class:"fct-shared-variant-nav__item-image"},DP=["src","alt"],TP=["src","alt"],QP={key:0,class:"fct-shared-variant-nav__item-dot"},MP={class:"fct-shared-variant-nav__item-content"},LP={class:"fct-shared-variant-nav__item-title"},RP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},OP={class:"fct-shared-variant-nav__item-meta"},PP=["disabled","aria-label"],HP=["disabled","aria-label"],NP={class:"more-btn"},Sf={__name:"VariantNavList",props:{items:Array,groupedItems:{type:Array,default:null},activeKey:[String,Number],isDirty:Boolean,isSaving:Boolean,drawerMode:String,product:Object,productEditModel:Object,canCopyDirectCheckout:Function},emits:["select","command","save","edit-group"],setup(e,{emit:t}){const a=()=>pl.productPlaceholder(),l=e,n=b=>{const w=l.isDirty&&l.activeKey!==b.key,B=l.drawerMode==="create"&&b.key!=="draft-variation";return w||B},i=t,A=G(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=M(null),m=(b,w)=>{for(const B of b||[])if((B.items||[]).some(S=>S.key===w))return String(B.termId);return null};be(()=>l.groupedItems,b=>{if(!Array.isArray(b)||!b.length){p.value=null;return}p.value=m(b,l.activeKey)||String(b[0].termId)},{immediate:!0}),be(()=>l.activeKey,b=>{if(!A.value||b==null)return;const w=m(l.groupedItems,b);w&&(p.value=w)});const _=b=>String(b.termId)===p.value,g=b=>{const w=String(b.termId);p.value=p.value===w?null:w},y=M(null);let v=null;const k=()=>{v&&clearTimeout(v),$e(()=>{v=setTimeout(()=>{var w;v=null;const b=(w=y.value)==null?void 0:w.querySelector(".fct-shared-variant-nav__item-shell.is-active");b&&b.scrollIntoView({block:"center"})},240)})};return Te(k),be(()=>l.activeKey,()=>k()),Ga(()=>{v&&clearTimeout(v)}),(b,w)=>{const B=C("el-dropdown-item"),S=C("el-dropdown-menu"),V=C("el-dropdown");return r(),h("div",{ref_key:"listRef",ref:y,class:"fct-shared-variant-nav__list"},[A.value?(r(!0),h(P,{key:0},ae(e.groupedItems,F=>(r(),h("div",{key:"g-"+F.termId,class:ue(["fct-shared-variant-nav__group",{"is-collapsed":!_(F)}])},[o("div",cP,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_(F)?"true":"false",onClick:$=>g(F)},[o("span",pP,[s(X,{name:_(F)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",fP,f(F.title),1),o("span",mP,f(c(d)("%1$s variants",F.count)),1)],8,AP),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":c(d)("Edit group"),onClick:Ge($=>i("edit-group",F),["stop"])},[s(X,{name:"Edit"})],8,hP)]),s(ma,{visible:_(F),accordion:"",duration:220},{default:u(()=>[o("div",_P,[(r(!0),h(P,null,ae(F.items,$=>{var U,D,T,I,L,O,Q,H;return r(),h("div",{key:$.key,class:ue(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===$.key,"is-draft":$.isDraft}])},[o("button",{type:"button",class:ue(["fct-shared-variant-nav__item",{"is-disabled":n($)}]),disabled:n($),"aria-current":e.activeKey===$.key?"true":void 0,onClick:K=>!n($)&&i("select",$)},[o("div",gP,[o("div",yP,[(T=(D=(U=$.variant)==null?void 0:U.media)==null?void 0:D[0])!=null&&T.url?(r(),h("img",{key:0,src:(O=(L=(I=$.variant)==null?void 0:I.media)==null?void 0:L[0])==null?void 0:O.url,alt:$.label},null,8,bP)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:$.label},null,8,wP))]),e.activeKey===$.key?(r(),h("span",CP)):x("",!0)]),o("div",kP,[o("span",BP,[R(f($.label)+" ",1),((Q=$.variant)==null?void 0:Q.item_status)==="inactive"&&((H=e.product.detail)==null?void 0:H.variation_type)==="advanced_variations"?(r(),h("span",xP,f(c(d)("Inactive")),1)):x("",!0)]),o("span",SP,f($.meta),1)])],10,vP),e.isDirty&&e.activeKey===$.key?(r(),h("button",{key:0,type:"button",class:ue(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:w[0]||(w[0]=K=>i("save")),"aria-label":c(d)("Save variant")},[e.isSaving?(r(),E(X,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(X,{key:0,name:"Save"}))],10,$P)):x("",!0),$.isDraft?x("",!0):(r(),E(V,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:n($),onCommand:K=>!n($)&&i("command",K,$)},{dropdown:u(()=>[s(S,null,{default:u(()=>{var K,W,z,Y,Z;return[["simple","advanced_variations"].includes((K=e.product.detail)==null?void 0:K.variation_type)?x("",!0):(r(),E(B,{key:0,command:"duplicate"},{default:u(()=>[s(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:1})),s(B,{command:"copy_variation_id"},{default:u(()=>[s(X,{name:"Copy"}),R(" "+f(c(d)("Copy Variation ID")),1)]),_:1}),s(B,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout($)},{default:u(()=>[s(X,{name:"Copy"}),R(" "+f(c(d)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(W=$.variant)!=null&&W.id&&((z=e.product.detail)==null?void 0:z.variation_type)==="advanced_variations"?(r(),E(B,{key:1,command:"toggle_status",class:ue({"item-destructive":((Y=$.variant)==null?void 0:Y.item_status)!=="inactive"})},{default:u(()=>{var re,q;return[s(X,{name:((re=$.variant)==null?void 0:re.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((q=$.variant)==null?void 0:q.item_status)==="inactive"?c(d)("Set Active"):c(d)("Set Inactive")),1)]}),_:2},1032,["class"])):x("",!0),((Z=e.product.detail)==null?void 0:Z.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(B,{key:2,command:"delete",class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})):x("",!0)]}),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:ue(["fct-shared-variant-nav__menu-trigger",{"is-disabled":n($)}]),disabled:n($),onClick:w[1]||(w[1]=Ge(()=>{},["stop"])),"aria-label":c(d)("Variation actions")},[o("span",EP,[s(X,{name:"More"})])],10,FP)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),h(P,{key:1},ae(e.items,F=>{var $,U,D,T,I,L,O,Q;return r(),h("div",{key:F.key,class:ue(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===F.key,"is-draft":F.isDraft}])},[o("button",{type:"button",class:ue(["fct-shared-variant-nav__item",{"is-disabled":n(F)}]),disabled:n(F),"aria-current":e.activeKey===F.key?"true":void 0,onClick:H=>!n(F)&&i("select",F)},[o("div",IP,[o("div",VP,[(D=(U=($=F.variant)==null?void 0:$.media)==null?void 0:U[0])!=null&&D.url?(r(),h("img",{key:0,src:(L=(I=(T=F.variant)==null?void 0:T.media)==null?void 0:I[0])==null?void 0:L.url,alt:F.label},null,8,DP)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:F.label},null,8,TP))]),e.activeKey===F.key?(r(),h("span",QP)):x("",!0)]),o("div",MP,[o("span",LP,[R(f(F.label)+" ",1),((O=F.variant)==null?void 0:O.item_status)==="inactive"&&((Q=e.product.detail)==null?void 0:Q.variation_type)==="advanced_variations"?(r(),h("span",RP,f(c(d)("Inactive")),1)):x("",!0)]),o("span",OP,f(F.meta),1)])],10,UP),e.isDirty&&e.activeKey===F.key?(r(),h("button",{key:0,type:"button",class:ue(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:w[2]||(w[2]=H=>i("save")),"aria-label":c(d)("Save variant")},[e.isSaving?(r(),E(X,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(X,{key:0,name:"Save"}))],10,PP)):x("",!0),F.isDraft?x("",!0):(r(),E(V,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:n(F),onCommand:H=>!n(F)&&i("command",H,F)},{dropdown:u(()=>[s(S,null,{default:u(()=>{var H,K,W,z,Y;return[["simple","advanced_variations"].includes((H=e.product.detail)==null?void 0:H.variation_type)?x("",!0):(r(),E(B,{key:0,command:"duplicate"},{default:u(()=>[s(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:1})),s(B,{command:"copy_variation_id"},{default:u(()=>[s(X,{name:"Copy"}),R(" "+f(c(d)("Copy Variation ID")),1)]),_:1}),s(B,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(F)},{default:u(()=>[s(X,{name:"Copy"}),R(" "+f(c(d)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(K=F.variant)!=null&&K.id&&((W=e.product.detail)==null?void 0:W.variation_type)==="advanced_variations"?(r(),E(B,{key:1,command:"toggle_status",class:ue({"item-destructive":((z=F.variant)==null?void 0:z.item_status)!=="inactive"})},{default:u(()=>{var Z,re;return[s(X,{name:((Z=F.variant)==null?void 0:Z.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((re=F.variant)==null?void 0:re.item_status)==="inactive"?c(d)("Set Active"):c(d)("Set Inactive")),1)]}),_:2},1032,["class"])):x("",!0),((Y=e.product.detail)==null?void 0:Y.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(B,{key:2,command:"delete",class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})):x("",!0)]}),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:ue(["fct-shared-variant-nav__menu-trigger",{"is-disabled":n(F)}]),disabled:n(F),onClick:w[3]||(w[3]=Ge(()=>{},["stop"])),"aria-label":c(d)("Variation actions")},[o("span",NP,[s(X,{name:"More"})])],10,HP)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},KP={class:"fct-shared-variant-nav-mobile"},GP=["disabled","onClick"],$f={__name:"VariantNavMobile",props:{items:Array,activeKey:[String,Number],isDirty:Boolean},emits:["select"],setup(e,{emit:t}){const a=t;return(l,n)=>(r(),h("div",KP,[(r(!0),h(P,null,ae(e.items,i=>(r(),h("button",{key:`mobile-${i.key}`,type:"button",class:ue(["fct-shared-variant-nav-mobile__item",{"is-active":e.activeKey===i.key,"is-draft":i.isDraft}]),disabled:e.isDirty&&e.activeKey!==i.key,onClick:A=>a("select",i)},f(i.label),11,GP))),128))]))}},zP={class:"fct-product-pricing-table-wrap"},jP={class:"fct-table-draggable hide-on-mobile"},qP={class:"is-right"},YP={key:0,class:"fct-drag-handle drag-icon"},WP=["src","alt"],JP=["src"],XP={class:"fct-product-pricing-table-item"},ZP={key:0,class:"fct-variant-badge"},eH={class:"fct-product-pricing-table-item"},tH={key:0,class:"fct-variant-badge fct-variant-badge--light"},aH={class:"fct-product-pricing-table-item"},lH={class:"is-right"},sH={class:"fct-product-pricing-table-item"},nH={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},oH={key:0,class:"fct-drag-handle drag-icon"},iH={class:"fct-product-pricing-table-mobile-item-inner"},rH={class:"fct-product-pricing-table-item"},dH={class:"media"},uH=["src","alt"],cH=["src"],AH={class:"fct-product-pricing-table-item-content"},pH={class:"title"},fH={key:0,class:"fct-variant-badge"},mH={key:0,class:"compare-price"},hH={class:"price"},_H={key:0,class:"capitalize"},vH={key:0,class:"fct-product-pricing-table-item-action"},gH={class:"fct-shared-variant-drawer__layout"},yH={key:0,class:"fct-shared-variant-nav"},bH={class:"fct-shared-variant-drawer__content"},wH={class:"fct-shared-variant-drawer__form"},CH={class:"fct-variant-dirty-dialog__header"},kH={class:"dialog-footer"},BH={class:"fct-btn-group sm"},vc=1040,xH=1060,SH={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=M(typeof window<"u"?window.innerWidth:vc),l=M(0),n=()=>{if(typeof window>"u")return 0;const ee=document.querySelector("#adminmenuwrap");if(!ee)return 0;const pe=window.getComputedStyle(ee);return pe.display==="none"||pe.visibility==="hidden"?0:Math.round(ee.getBoundingClientRect().width)},i=()=>{typeof window>"u"||(a.value=window.innerWidth,l.value=n())};Te(()=>{i(),window.addEventListener("resize",i),setTimeout(()=>{document.querySelectorAll(".el-input__wrapper input[type='number']").forEach(pe=>{pe.addEventListener("wheel",de=>{document.activeElement===pe&&de.preventDefault()})}),t.product.variants.filter(pe=>{const de=pe.media?pe.media.meta_value||[]:[];return pe.media=de})},50)}),xt(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const A=G(()=>({animation:600,ghostClass:"ghost"})),p=M(!1),m=M("update"),_=M(null),g=M(null),y=M(!1),v=M(!1),k=M(null),b=M(!1),w=G(()=>Math.max(a.value-l.value,360)),B=G(()=>w.value<=xH),S=G(()=>{let ee=24;a.value<=640?ee=12:a.value<=900&&(ee=16);const pe=Math.max(w.value-ee,320);return`${Math.min(vc,pe)}px`}),V=(ee,pe)=>(ee==null?void 0:ee.variation_title)||`${d("Variation")} ${pe+1}`,F=ee=>{const pe=(ee==null?void 0:ee.item_price)??"";return pe===""||pe===null||pe===void 0?d("No price set"):jt(pe,!0)},$=ee=>typeof ee=="number"&&ee>=0&&ee<t.product.variants.length?ee:t.product.variants.length?0:null,U=({modeType:ee="update",index:pe=null}={})=>{m.value=ee,_.value=ee==="create"?null:$(pe),b.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},D=()=>{b.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},T=()=>{y.value=!1,v.value=!1,k.value=null},I=()=>{var ee,pe;return((pe=(ee=g.value)==null?void 0:ee.hasDirtyDrafts)==null?void 0:pe.call(ee))??!1},L=ee=>{ee&&(m.value=ee.modeType,_.value=ee.index,t.productEditModel.setValidationErrors({}))},O=async(ee,pe)=>{var de,Ue;if(!(!pe||!ee)){if(ee==="duplicate"){U({modeType:"duplicate",index:pe.index});return}if(ee==="delete"&&((de=pe.variant)!=null&&de.id)){t.productEditModel.deletePricing(pe.variant.id,pe.index).then(async()=>{var Ce,Se;await $e(),t.product.variants.length>0?(m.value="update",_.value=Math.min(pe.index,t.product.variants.length-1),b.value=!1,(Se=(Ce=g.value)==null?void 0:Ce.loadVariantFromProps)==null||Se.call(Ce)):D()}).catch(()=>{});return}if(ee==="copy_variation_id"&&((Ue=pe.variant)!=null&&Ue.id)){ns.copy(String(pe.variant.id),{successMessage:d("Variation ID copied to clipboard")});return}ee==="copy_direct_checkout"&&Q(pe)&&ns.copy(H(pe),{successMessage:d("Direct checkout link copied to clipboard")})}},Q=ee=>{var pe,de;return!!((pe=ee==null?void 0:ee.variant)!=null&&pe.id)&&["publish","private"].includes((de=t.product)==null?void 0:de.post_status)},H=ee=>`${Ke.get("frontend_url")}=instant_checkout&item_id=${ee.variant.id}&quantity=1`,K=()=>{const ee=k.value;if(T(),!!ee&&ee.type==="close"){if(typeof ee.done=="function"){ee.done();return}D()}},W=()=>{T()},z=async()=>{var ee,pe;await((pe=(ee=g.value)==null?void 0:ee.discardDrafts)==null?void 0:pe.call(ee)),K()},Y=async()=>{var pe;if(!((pe=g.value)!=null&&pe.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){K();return}v.value=!1,W()},Z=ee=>{if(!I()){ee();return}k.value={type:"close",done:ee},y.value=!0},re=()=>{Z(()=>{D()})},q=ee=>{b.value=ee},Ae=ee=>{ee&&(m.value="update",typeof ee.index=="number"&&ee.index>=0?_.value=ee.index:_.value=$(_.value),b.value=!1,t.productEditModel.setValidationErrors({}))},ie=(ee,pe)=>{const de=V(ee,pe);return`${d("Copy of")} ${de}`},J=G(()=>{var pe;const ee=(t.product.variants||[]).map((de,Ue)=>({key:(de==null?void 0:de.id)??`variant-${Ue}`,index:Ue,variant:de,label:V(de,Ue),meta:F(de),modeType:"update",isDraft:!1}));if(p.value&&m.value==="create"&&ee.push({key:"draft-variation",index:null,label:d("New variation"),meta:d("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&m.value==="duplicate"){const de=(pe=t.product.variants)==null?void 0:pe[_.value];ee.push({key:"duplicate-variation",index:_.value,variant:de,label:ie(de,_.value??0),meta:d("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return ee}),N=G(()=>{var pe;if(m.value==="create"&&_.value===null)return"draft-variation";if(m.value==="duplicate")return"duplicate-variation";const ee=(pe=t.product.variants)==null?void 0:pe[_.value];return(ee==null?void 0:ee.id)??`variant-${_.value??0}`}),le=ee=>{ee&&(b.value&&N.value!==ee.key||L(ee))};return(ee,pe)=>{const de=C("el-input"),Ue=C("el-drawer"),Ce=C("el-button"),Se=C("el-dialog");return r(),h("div",zP,[o("div",jP,[o("table",null,[pe[5]||(pe[5]=o("colgroup",null,[o("col"),o("col",{width:"50"}),o("col",{width:"300"}),o("col"),o("col"),o("col")],-1)),o("thead",null,[o("tr",null,[pe[4]||(pe[4]=o("th",null,null,-1)),o("th",null,f(ee.$t("Image")),1),o("th",null,f(ee.$t("Title")),1),o("th",null,f(ee.$t("Price")),1),o("th",null,f(ee.$t("Compare at price")),1),o("th",qP,f(ee.$t("Action")),1)])]),s(c(cn),ba(A.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:pe[0]||(pe[0]=ge=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:u(()=>[(r(!0),h(P,null,ae(e.product.variants,(ge,ke)=>{var Oe,Ee,fe,ye;return r(),h("tr",{key:ge.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),h("span",YP,[s(X,{name:"ReorderDotsVertical"})])):x("",!0)]),o("td",null,[e.readonly?ge.media&&ge.media[0]?(r(),h("img",{key:1,src:ge.media[0].url,alt:ge.variation_title,class:"fct-variant-thumb-readonly"},null,8,WP)):(r(),h("img",{key:2,src:c(pl).productPlaceholder(),alt:"",class:"fct-variant-thumb-readonly"},null,8,JP)):(r(),E(wl,{key:0,modelValue:ge.media,"onUpdate:modelValue":De=>ge.media=De,compact:!0,"max-thumbs":1,onChange:De=>e.productEditModel.onUploadPricingMedia("media",ke,De)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("td",null,[o("div",XP,[s(de,{class:ue(e.productEditModel.hasValidationError(`variants.${ke}.variation_title`)?"is-error":""),id:`variants.${ke}.variation_title`,placeholder:ee.$t("e.g. Small, Medium, Large"),type:"text",modelValue:ge.variation_title,"onUpdate:modelValue":De=>ge.variation_title=De,onInput:De=>{e.productEditModel.onChangePricing("variation_title",ke,De)},disabled:((Ee=(Oe=e.product)==null?void 0:Oe.detail)==null?void 0:Ee.variation_type)==="simple"||e.readonly,onFocus:De=>e.productEditModel.clearValidationError(`variants.${ke}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((fe=ge.other_info)==null?void 0:fe.installment)==="yes"?(r(),h("span",ZP,f(ge.other_info.times)+" "+f(c(d)("Installment")),1)):x("",!0)])]),o("td",null,[o("div",eH,[s(Ya,{placeholder:ee.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${ke}.item_price`)?"is-error":"",id:`variants.${ke}.item_price`,"model-value":ge.item_price,disabled:ge.expanded||e.readonly,"onUpdate:modelValue":De=>{e.readonly||(ge.item_price=De,e.productEditModel.onChangePricing("item_price",ke,De),e.productEditModel.clearValidationError(`variants.${ke}.item_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((ye=ge.other_info)==null?void 0:ye.payment_type)==="subscription"?(r(),h("span",tH,f(ge.other_info.repeat_interval),1)):x("",!0)])]),o("td",null,[o("div",aH,[s(Ya,{placeholder:ee.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${ke}.compare_price`)?"is-error":"",id:`variants.${ke}.compare_price`,"model-value":ge.compare_price,disabled:ge.expanded||e.readonly,"onUpdate:modelValue":De=>{e.readonly||(ge.compare_price=De,e.productEditModel.onChangePricing("compare_price",ke,De),e.productEditModel.clearValidationError(`variants.${ke}.compare_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),o("td",lH,[o("div",sH,[e.readonly?x("",!0):(r(),E(cr,{key:0,modeType:"action",index:ke,variant:ge,product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",nH,[s(c(cn),ba(A.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:pe[1]||(pe[1]=ge=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:u(()=>[(r(!0),h(P,null,ae(e.product.variants,(ge,ke)=>{var Oe,Ee;return r(),h("div",{key:ge.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),h("span",oH,[s(X,{name:"ReorderDotsVertical"})])):x("",!0),o("div",iH,[o("div",rH,[o("div",dH,[e.readonly?ge.media&&ge.media[0]?(r(),h("img",{key:1,src:ge.media[0].url,alt:ge.variation_title,class:"fct-variant-thumb-readonly"},null,8,uH)):(r(),h("img",{key:2,src:c(pl).productPlaceholder(),alt:"",class:"fct-variant-thumb-readonly"},null,8,cH)):(r(),E(wl,{key:0,modelValue:ge.media,"onUpdate:modelValue":fe=>ge.media=fe,compact:!0,"max-thumbs":1,onChange:fe=>e.productEditModel.onUploadPricingMedia("media",ke,fe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",AH,[o("div",pH,[R(f(ge.variation_title)+" ",1),((Oe=ge.other_info)==null?void 0:Oe.installment)==="yes"?(r(),h("span",fH,f(ge.other_info.times)+" "+f(c(d)("Installment")),1)):x("",!0)]),o("ul",null,[o("li",null,[ge.compare_price?(r(),h("div",mH,[o("span",null,f(ee.appVars.shop.currency_sign),1),R(" "+f(c(jt)(ge.compare_price,!1)),1)])):x("",!0),o("div",hH,[o("span",null,f(ee.appVars.shop.currency_sign),1),R(" "+f(c(jt)(ge.item_price,!1)),1)])]),((Ee=ge.other_info)==null?void 0:Ee.payment_type)==="subscription"?(r(),h("li",_H,f(ge.other_info.repeat_interval),1)):x("",!0)])])]),e.readonly?x("",!0):(r(),h("div",vH,[s(cr,{modeType:"action",index:ke,variant:ge,product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?x("",!0):(r(),E(cr,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["product","productEditModel"])),s(Ue,{modelValue:p.value,"onUpdate:modelValue":pe[2]||(pe[2]=ge=>p.value=ge),title:ee.$t("Pricing"),size:S.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":Z,class:"fct-shared-variant-drawer",onClose:D},{default:u(()=>[o("div",gH,[B.value?x("",!0):(r(),h("aside",yH,[s(Zr,{product:e.product},null,8,["product"]),s(Sf,{items:J.value,"active-key":N.value,"is-dirty":b.value,"drawer-mode":m.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":Q,"is-saving":v.value,onSelect:le,onCommand:O,onSave:Y},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),s(sP,{product:e.product,"drawer-mode":m.value,"is-variation-dirty":b.value,onOpenEditor:U},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",bH,[B.value?(r(),E($f,{key:0,items:J.value,"active-key":N.value,"is-dirty":b.value,onSelect:le},null,8,["items","active-key","is-dirty"])):x("",!0),o("div",wH,[s(Nd,{ref_key:"pricingFormRef",ref:g,index:_.value,modeType:m.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:Ae,onCloseModal:re,onDirtyStateChange:q},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),s(Se,{modelValue:y.value,"onUpdate:modelValue":pe[3]||(pe[3]=ge=>y.value=ge),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:W},{header:u(()=>[o("div",CH,[o("h3",null,f(c(d)("Unsaved changes")),1)])]),default:u(()=>[o("p",null,f(c(d)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",kH,[o("div",BH,[s(Ce,{disabled:v.value,onClick:W,size:"small"},{default:u(()=>[R(f(c(d)("Continue editing")),1)]),_:1},8,["disabled"]),s(Ce,{disabled:v.value,onClick:z,size:"small"},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1},8,["disabled"]),s(Ce,{type:"primary",loading:v.value,onClick:Y,size:"small"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},$H={key:0,class:"fct-adv-groupby-bar"},FH={class:"fct-adv-groupby-label"},EH={__name:"AdvancedVariationGroupBar",props:{product:Object,attributeGroups:{type:Array,default:()=>[]},modelValue:{type:[Number,null],default:null}},emits:["update:modelValue"],setup(e,{expose:t,emit:a}){const l=e,n=a,i=G({get(){return l.modelValue},set(p){n("update:modelValue",p)}}),A=G(()=>{var m,_,g;const p=(g=(_=(m=l.product)==null?void 0:m.detail)==null?void 0:_.other_info)==null?void 0:g.attribute_config;return!p||!Array.isArray(p)?[]:p.map(y=>{const v=l.attributeGroups.find(k=>String(k.id)===String(y.group_id));return v?{id:v.id,title:v.title}:null}).filter(Boolean)});return t({configuredGroups:A}),(p,m)=>{const _=C("el-option"),g=C("el-select");return A.value.length>=2?(r(),h("div",$H,[o("span",FH,f(p.$t("Group by")),1),s(g,{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=y=>i.value=y),placeholder:p.$t("Select")},{default:u(()=>[(r(!0),h(P,null,ae(A.value,y=>(r(),E(_,{key:y.id,label:y.title,value:y.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):x("",!0)}}},UH={key:0,class:"fct-adv-bulk-bar"},IH={class:"fct-adv-bulk-count"},VH={__name:"AdvancedVariationBulkBar",props:{selectedCount:{type:Number,default:0},bulkAction:{type:String,default:""},bulkValue:{type:[String,Number],default:""},saving:{type:Boolean,default:!1}},emits:["update:bulkAction","update:bulkValue","apply","clear"],setup(e,{emit:t}){const a=e,l=t,n=G({get(){return a.bulkAction},set(p){l("update:bulkAction",p)}}),i=G({get(){return a.bulkValue},set(p){l("update:bulkValue",p)}}),A=G(()=>a.bulkAction==="set_price");return(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-button");return e.selectedCount>0?(r(),h("div",UH,[o("span",IH,f(p.$t("%1$s selected",e.selectedCount)),1),o("button",{type:"button",class:"fct-adv-bulk-clear",onClick:m[0]||(m[0]=v=>p.$emit("clear"))},f(p.$t("Clear")),1),s(g,{modelValue:n.value,"onUpdate:modelValue":m[1]||(m[1]=v=>n.value=v),placeholder:p.$t("Bulk Actions"),size:"small"},{default:u(()=>[s(_,{label:p.$t("Set Price"),value:"set_price"},null,8,["label"]),s(_,{label:p.$t("Set Active"),value:"set_status_active"},null,8,["label"]),s(_,{label:p.$t("Set Inactive"),value:"set_status_inactive"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),A.value?(r(),E(Ya,{key:0,modelValue:i.value,"onUpdate:modelValue":m[2]||(m[2]=v=>i.value=v),placeholder:p.$t("Value"),size:"small"},null,8,["modelValue","placeholder"])):x("",!0),s(y,{type:"primary",size:"small",loading:e.saving,disabled:!e.bulkAction||e.selectedCount===0,onClick:m[3]||(m[3]=v=>p.$emit("apply"))},{default:u(()=>[R(f(p.$t("Apply")),1)]),_:1},8,["loading","disabled"])])):x("",!0)}}};function gc(e){if(e===""||e===null||e===void 0)return null;const t=Number(e);return Number.isFinite(t)?t:null}function DH(e,t){return e===null||t!==void 0&&t===e?null:e}function TH(){let e={};return{onEnter(t,a){const l=gc(a);return l===null?null:(e={...e,[t]:l},l)},onBlur(t,a){const l=gc(a),n=e[t];if(n!==void 0){const i={...e};delete i[t],e=i}return DH(l,n)},reset(t){if(t===void 0){e={};return}const a={...e};delete a[t],e=a},hasPending(t){return e[t]!==void 0}}}const QH={class:"fct-grouped-variant-table fct-adv-table-desktop"},MH={class:"is-right"},LH=["aria-expanded","aria-label"],RH=["onClick"],OH={class:"fct-adv-group-header"},PH={class:"fct-adv-group-count"},HH={class:"fct-product-pricing-table-item"},NH={class:"is-right"},KH={class:"fct-adv-group-actions"},GH=["aria-expanded","aria-label","onClick"],zH={class:"fct-adv-slot-row"},jH={colspan:"6"},qH={class:"fct-product-pricing-table-item"},YH={class:"fct-product-pricing-table-item fct-adv-child-title"},WH={class:"fct-adv-title-cell"},JH={class:"fct-adv-title-main"},XH={class:"fct-adv-variant-title"},ZH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},eN={class:"fct-product-pricing-table-item"},tN={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},aN={class:"fct-product-pricing-table-item"},lN={class:"is-right"},sN={class:"fct-product-pricing-table-item"},nN={class:"fct-btn-group sm justify-end"},oN=["aria-label"],iN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},rN={colspan:"6"},dN={class:"fct-grouped-variant-table fct-adv-table-mobile"},uN={class:"is-right"},cN=["aria-expanded","aria-label"],AN=["onClick"],pN={class:"fct-adv-group-header"},fN={class:"fct-adv-group-count"},mN={class:"is-right"},hN={class:"fct-adv-group-actions"},_N=["aria-expanded","aria-label","onClick"],vN={class:"fct-adv-slot-row"},gN={colspan:"4"},yN={class:"fct-product-pricing-table-item"},bN={class:"fct-product-pricing-table-item fct-adv-child-title"},wN={class:"fct-adv-title-cell"},CN={class:"fct-adv-title-main"},kN={class:"fct-adv-variant-title"},BN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},xN={class:"fct-adv-variant-price"},SN={key:0,class:"fct-adv-variant-compare"},$N={class:"is-right"},FN={class:"fct-product-pricing-table-item"},EN={class:"fct-btn-group sm justify-end"},UN=["aria-label"],IN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},VN={colspan:"6"},yc=30,DN=30,TN={__name:"AdvancedVariationGroupedTable",props:{product:Object,productEditModel:{type:Object,default:null},attributeGroups:{type:Array,default:()=>[]},groupedVariants:{type:Array,default:()=>[]},selectedVariants:{type:Array,default:()=>[]},isAllSelected:{type:Boolean,default:!1},isSelectionIndeterminate:{type:Boolean,default:!1},groupById:{type:Number,default:null},expandedGroups:{type:Set,default:()=>new Set}},emits:["update:selectedVariants","update:isAllSelected","update:expandedGroups","editVariant","editGroup","toggleStatus","inlinePriceChange","inlinePriceCommit","mediaUploaded","groupPriceApply","groupMediaUploaded"],setup(e,{emit:t}){const a=e,l=G(()=>{var Ue,Ce,Se;const N=a.groupById?parseInt(a.groupById):null,le=(((Se=(Ce=(Ue=a.product)==null?void 0:Ue.detail)==null?void 0:Ce.other_info)==null?void 0:Se.attribute_config)||[]).map(ge=>parseInt(ge.group_id)).filter(Boolean),ee=ge=>{const ke=le.indexOf(ge);return ke===-1?Number.MAX_SAFE_INTEGER:ke},pe={};(a.attributeGroups||[]).forEach(ge=>{const ke={};(ge.terms||[]).forEach(Oe=>{ke[parseInt(Oe.id)]=Oe.title}),pe[parseInt(ge.id)]=ke});const de={};return(a.groupedVariants||[]).forEach(ge=>{(ge.variants||[]).forEach(ke=>{const Oe=ke.attr_map||[];if(!Oe.length){de[ke.id]="";return}const Ee=[...Oe].sort((fe,ye)=>ee(parseInt(fe.group_id))-ee(parseInt(ye.group_id))).map(fe=>{const ye=parseInt(fe.group_id);if(N&&ye===N)return null;const De=pe[ye];return De&&De[parseInt(fe.term_id)]||null}).filter(Boolean);de[ke.id]=Ee.join(" / ")})}),de}),n=M(new Set),i=N=>{n.value.has(N)||(n.value=new Set(n.value).add(N))},A=M({}),p=N=>A.value[N]||yc,m=N=>{const le=N.variants||[],ee=p(N.termId);return ee>=le.length?le:le.slice(0,ee)},_=N=>(N.variants||[]).length>p(N.termId),g=(N,le)=>{const ee=A.value[N]||yc;ee>=le||(A.value={...A.value,[N]:Math.min(ee+DN,le)})};be(()=>a.expandedGroups,N=>{const le=Object.keys(A.value);if(!le.length)return;const ee={};le.forEach(pe=>{N&&(N.has(pe)||N.has(Number(pe)))&&(ee[pe]=A.value[pe])}),Object.keys(ee).length!==le.length&&(A.value=ee)});let y=null;const v={},k=N=>{let le=N&&N.parentElement;for(;le;){const ee=getComputedStyle(le).overflowY;if(ee==="auto"||ee==="scroll"||ee==="overlay")return le;le=le.parentElement}return null},b=N=>{y||(y=new IntersectionObserver(le=>{le.forEach(ee=>{ee.isIntersecting&&g(ee.target.dataset.termId,parseInt(ee.target.dataset.total,10)||0)})},{root:k(N),rootMargin:"300px 0px"}))},w=(N,le)=>ee=>{ee?(ee.dataset.termId=N,ee.dataset.total=le,b(ee),v[N]=ee,y.observe(ee)):v[N]&&(y&&y.unobserve(v[N]),delete v[N])};xt(()=>{y&&(y.disconnect(),y=null)});const B=N=>{if(!a.productEditModel)return!1;const le=a.product.variants.findIndex(ee=>ee.id===N.id);return le===-1?!1:a.productEditModel.hasValidationError(`variants.${le}.compare_price`)},S=t,V=M({}),F=TH();be(()=>{var N,le;return(le=(N=a.productEditModel)==null?void 0:N.data)==null?void 0:le.discardKey},()=>{V.value={},F.reset()});const $=G(()=>a.groupedVariants.every(N=>a.expandedGroups.has(N.termId))),U=()=>{const N=$.value?new Set:new Set(a.groupedVariants.map(le=>le.termId));S("update:expandedGroups",N)},D=N=>{const le=new Set(a.expandedGroups);le.has(N)?le.delete(N):le.add(N),S("update:expandedGroups",le)},T=N=>a.expandedGroups.has(N),I=N=>N.variants.length>0&&N.variants.every(le=>a.selectedVariants.includes(le.id)),L=N=>{if(N.variants.length===0)return!1;const le=N.variants.filter(ee=>a.selectedVariants.includes(ee.id)).length;return le>0&&le<N.variants.length},O=(N,le)=>{let ee;if(le){const pe=new Set(a.selectedVariants);N.variants.forEach(de=>pe.add(de.id)),ee=Array.from(pe)}else{const pe=new Set(N.variants.map(de=>de.id));ee=a.selectedVariants.filter(de=>!pe.has(de))}S("update:selectedVariants",ee)},Q=(N,le)=>{let ee;le?ee=[...a.selectedVariants,N]:ee=a.selectedVariants.filter(pe=>pe!==N),S("update:selectedVariants",ee)},H=(N,le)=>{S("groupPriceApply",N,le)},K=N=>{const le=F.onEnter(N.termId,V.value[N.termId]);le!==null&&H(N.termId,le)},W=N=>{const le=F.onBlur(N.termId,V.value[N.termId]);le!==null&&H(N.termId,le)},z=N=>{const le=N.variants.map(de=>parseFloat(de.item_price)).filter(de=>!isNaN(de));if(!le.length)return"";const ee=Math.min(...le),pe=Math.max(...le);return ee===pe?jt(ee,!1):`${jt(ee,!1)} – ${jt(pe,!1)}`},Y=M(null),Z=N=>Y.value===N.termId?"":z(N)||"",re=N=>{Y.value=N.termId},q=N=>{Y.value=null,W(N)},Ae=N=>{const le=new Set,ee=[];return(N.variants||[]).forEach(pe=>{Array.isArray(pe==null?void 0:pe.media)&&pe.media.forEach(de=>{const Ue=(de==null?void 0:de.id)||(de==null?void 0:de.url);Ue&&!le.has(Ue)&&(le.add(Ue),ee.push(de))})}),ee},ie=(N,le,ee)=>{!ee||!ee.applyToAll||S("groupMediaUploaded",N,le)},J=(N,le,ee,pe)=>{pe&&pe.applyToAll?S("groupMediaUploaded",N,ee):S("mediaUploaded",le,ee)};return(N,le)=>{const ee=C("el-checkbox"),pe=C("el-dropdown-item"),de=C("el-dropdown-menu"),Ue=C("el-dropdown");return r(),h(P,null,[o("div",QH,[o("table",null,[le[11]||(le[11]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[s(ee,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":le[0]||(le[0]=Ce=>N.$emit("update:isAllSelected",Ce))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(N.$t("Image")),1),o("th",null,f(N.$t("Variant")),1),o("th",null,f(N.$t("Price")),1),o("th",null,f(N.$t("Compare at price")),1),o("th",MH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":$.value,"aria-label":$.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:U},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":$.value}])},[s(X,{name:"ChevronDown"})],2)],8,LH)])])]),o("tbody",null,[(r(!0),h(P,null,ae(e.groupedVariants,Ce=>(r(),h(P,{key:Ce.termId},[o("tr",{class:ue(["fct-adv-group-row",{"is-expanded":T(Ce.termId)}]),onClick:Se=>D(Ce.termId)},[o("td",null,[s(ee,{onClick:le[1]||(le[1]=Ge(()=>{},["stop"])),"model-value":I(Ce),indeterminate:L(Ce),"aria-label":c(d)("Select all variants in %1$s",Ce.title),onChange:Se=>O(Ce,Se)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:le[2]||(le[2]=Ge(()=>{},["stop"]))},[s(wl,{"model-value":Ae(Ce),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Se,ge)=>ie(Ce,Se,ge)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",OH,[o("strong",null,f(Ce.title),1),o("span",PH,f(Ce.variants.length)+" "+f(Ce.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",null,[o("div",HH,[s(Ya,{onClick:le[3]||(le[3]=Ge(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:Z(Ce),size:"small",modelValue:V.value[Ce.termId],"onUpdate:modelValue":Se=>V.value[Ce.termId]=Se,onFocus:Se=>re(Ce),onBlur:Se=>q(Ce),onKeyup:ea(Se=>K(Ce),["enter"])},null,8,["placeholder","modelValue","onUpdate:modelValue","onFocus","onBlur","onKeyup"])])]),le[9]||(le[9]=o("td",null,null,-1)),o("td",NH,[o("div",KH,[T(Ce.termId)?(r(),E(tt,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":N.$t("Edit group %1$s",Ce.title),onClick:Ge(Se=>N.$emit("editGroup",Ce),["stop"])},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):x("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":T(Ce.termId),"aria-label":N.$t("Toggle %1$s variants",Ce.title),onClick:Ge(Se=>D(Ce.termId),["stop"])},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":T(Ce.termId)}])},[s(X,{name:"ChevronDown"})],2)],8,GH)])])],10,RH),o("tr",zH,[o("td",jH,[s(wr,{visible:T(Ce.termId),duration:220},{default:u(()=>[o("table",null,[le[10]||(le[10]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("tbody",null,[(r(!0),h(P,null,ae(m(Ce),Se=>{var ge,ke;return r(),h("tr",{key:Se.id,class:"fct-adv-group-child-row"},[o("td",{onClick:le[4]||(le[4]=Ge(()=>{},["stop"]))},[s(ee,{"model-value":e.selectedVariants.includes(Se.id),"aria-label":c(d)("Select variant %1$s",Se.variation_title),onChange:Oe=>Q(Se.id,Oe)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",qH,[s(wl,{modelValue:Se.media,"onUpdate:modelValue":Oe=>Se.media=Oe,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Oe,Ee)=>J(Ce,Se,Oe,Ee)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",YH,[o("div",WH,[o("div",JH,[o("span",XH,f(l.value[Se.id]||Se.variation_title),1),Se.item_status==="inactive"?(r(),h("span",ZH,f(c(d)("Inactive")),1)):x("",!0)])])])]),o("td",null,[o("div",eN,[s(Ya,{placeholder:N.$t("Price"),"model-value":Se.item_price,"onUpdate:modelValue":Oe=>N.$emit("inlinePriceChange",Se,"item_price",Oe),onChange:Oe=>N.$emit("inlinePriceCommit",Se)},null,8,["placeholder","model-value","onUpdate:modelValue","onChange"]),((ge=Se.other_info)==null?void 0:ge.payment_type)==="subscription"&&((ke=Se.other_info)!=null&&ke.repeat_interval)?(r(),h("span",tN,f(Se.other_info.repeat_interval),1)):x("",!0)])]),o("td",null,[o("div",aN,[s(Ya,{placeholder:N.$t("Compare price"),"error-class":B(Se)?"is-error":"",title:B(Se)?N.$t("Compare price must be greater than or equal to item price."):null,"model-value":Se.compare_price,"onUpdate:modelValue":Oe=>N.$emit("inlinePriceChange",Se,"compare_price",Oe),onChange:Oe=>N.$emit("inlinePriceCommit",Se)},null,8,["placeholder","error-class","title","model-value","onUpdate:modelValue","onChange"])])]),o("td",lN,[o("div",sN,[o("div",nN,[s(tt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:Oe=>N.$emit("editVariant",Se)},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["onClick"]),s(Ue,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:Oe=>Oe&&i(Se.id),onCommand:Oe=>{Oe==="toggle_status"&&N.$emit("toggleStatus",Se)}},{dropdown:u(()=>[s(de,null,{default:u(()=>[n.value.has(Se.id)?(r(),h(P,{key:0},[s(pe,{class:"show-on-mobile",onClick:Oe=>N.$emit("editVariant",Se)},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(N.$t("Edit")),1)]),_:2},1032,["onClick"]),s(pe,null,{default:u(()=>[Se.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(Se.id),showMode:"icon_with_text",buttonText:N.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),s(pe,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Se.id},{default:u(()=>{var Oe;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Se.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((Oe=N.appVars)==null?void 0:Oe.frontend_url)+"=instant_checkout&item_id="+Se.id+"&quantity=1",showMode:"icon_with_text",buttonText:N.$t("Direct Checkout"),tooltipContent:N.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[s(X,{name:"Copy"}),R(" "+f(N.$t("Direct Checkout"))+" ",1),s(Ot,{content:N.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),Se.id?(r(),E(pe,{key:0,command:"toggle_status",class:ue({"item-destructive":Se.item_status!=="inactive"})},{default:u(()=>[s(X,{name:Se.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(Se.item_status==="inactive"?N.$t("Set Active"):N.$t("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)],64)):x("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[s(X,{name:"More"})],8,oN)]),_:2},1032,["onVisibleChange","onCommand"])])])])])}),128)),_(Ce)?(r(),h("tr",iN,[o("td",rN,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:w(Ce.termId,Ce.variants.length)},null,512)])])):x("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])]),o("div",dN,[o("table",null,[le[13]||(le[13]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[s(ee,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":le[5]||(le[5]=Ce=>N.$emit("update:isAllSelected",Ce))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(N.$t("Image")),1),o("th",null,f(N.$t("Variant")),1),o("th",uN,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":$.value,"aria-label":$.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:U},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":$.value}])},[s(X,{name:"ChevronDown"})],2)],8,cN)])])]),o("tbody",null,[(r(!0),h(P,null,ae(e.groupedVariants,Ce=>(r(),h(P,{key:Ce.termId},[o("tr",{class:ue(["fct-adv-group-row",{"is-expanded":T(Ce.termId)}]),onClick:Se=>D(Ce.termId)},[o("td",null,[s(ee,{onClick:le[6]||(le[6]=Ge(()=>{},["stop"])),"model-value":I(Ce),indeterminate:L(Ce),"aria-label":c(d)("Select all variants in %1$s",Ce.title),onChange:Se=>O(Ce,Se)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:le[7]||(le[7]=Ge(()=>{},["stop"]))},[s(wl,{"model-value":Ae(Ce),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Se,ge)=>ie(Ce,Se,ge)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",pN,[o("strong",null,f(Ce.title),1),o("span",fN,f(Ce.variants.length)+" "+f(Ce.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",mN,[o("div",hN,[T(Ce.termId)?(r(),E(tt,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":N.$t("Edit group %1$s",Ce.title),onClick:Ge(Se=>N.$emit("editGroup",Ce),["stop"])},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):x("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":T(Ce.termId),"aria-label":N.$t("Toggle %1$s variants",Ce.title),onClick:Ge(Se=>D(Ce.termId),["stop"])},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":T(Ce.termId)}])},[s(X,{name:"ChevronDown"})],2)],8,_N)])])],10,AN),o("tr",vN,[o("td",gN,[s(wr,{visible:T(Ce.termId),duration:220},{default:u(()=>[o("table",null,[le[12]||(le[12]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("tbody",null,[(r(!0),h(P,null,ae(m(Ce),Se=>(r(),h("tr",{key:Se.id,class:"fct-adv-group-child-row"},[o("td",{onClick:le[8]||(le[8]=Ge(()=>{},["stop"]))},[s(ee,{"model-value":e.selectedVariants.includes(Se.id),"aria-label":c(d)("Select variant %1$s",Se.variation_title),onChange:ge=>Q(Se.id,ge)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",yN,[s(wl,{modelValue:Se.media,"onUpdate:modelValue":ge=>Se.media=ge,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(ge,ke)=>J(Ce,Se,ge,ke)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",bN,[o("div",wN,[o("div",CN,[o("span",kN,f(l.value[Se.id]||Se.variation_title),1),Se.item_status==="inactive"?(r(),h("span",BN,f(c(d)("Inactive")),1)):x("",!0)]),o("span",xN,[Se.compare_price?(r(),h("span",SN,f(c(jt)(Se.compare_price,!0)),1)):x("",!0),o("span",null,f(c(jt)(Se.item_price||0,!0)),1)])])])]),o("td",$N,[o("div",FN,[o("div",EN,[s(Ue,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:ge=>ge&&i(Se.id),onCommand:ge=>{ge==="toggle_status"&&N.$emit("toggleStatus",Se)}},{dropdown:u(()=>[s(de,null,{default:u(()=>[n.value.has(Se.id)?(r(),h(P,{key:0},[s(pe,{onClick:ge=>N.$emit("editVariant",Se)},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(N.$t("Edit")),1)]),_:2},1032,["onClick"]),s(pe,null,{default:u(()=>[Se.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(Se.id),showMode:"icon_with_text",buttonText:N.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),s(pe,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Se.id},{default:u(()=>{var ge;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Se.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((ge=N.appVars)==null?void 0:ge.frontend_url)+"=instant_checkout&item_id="+Se.id+"&quantity=1",showMode:"icon_with_text",buttonText:N.$t("Direct Checkout"),tooltipContent:N.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[s(X,{name:"Copy"}),R(" "+f(N.$t("Direct Checkout"))+" ",1),s(Ot,{content:N.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),Se.id?(r(),E(pe,{key:0,command:"toggle_status",class:ue({"item-destructive":Se.item_status!=="inactive"})},{default:u(()=>[s(X,{name:Se.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(Se.item_status==="inactive"?N.$t("Set Active"):N.$t("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)],64)):x("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[s(X,{name:"More"})],8,UN)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(Ce)?(r(),h("tr",IN,[o("td",VN,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:w(Ce.termId,Ce.variants.length)},null,512)])])):x("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])])],64)}}},QN={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},MN={class:"is-right"},LN={class:"fct-product-pricing-table-item"},RN={class:"fct-product-pricing-table-item"},ON={class:"fct-adv-title-cell"},PN={class:"fct-adv-title-main"},HN={class:"fct-adv-variant-title"},NN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},KN={key:0,class:"fct-adv-attr-breadcrumb"},GN={class:"fct-product-pricing-table-item"},zN={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},jN={class:"fct-product-pricing-table-item"},qN={class:"is-right"},YN={class:"fct-product-pricing-table-item"},WN={class:"fct-btn-group sm"},JN=["aria-label"],XN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},bc=30,ZN=30,eK={__name:"AdvancedVariationFlatTable",props:{product:Object,productEditModel:{type:Object,default:null},attributeGroups:{type:Array,default:()=>[]},selectedVariants:{type:Array,default:()=>[]},isAllSelected:{type:Boolean,default:!1},isSelectionIndeterminate:{type:Boolean,default:!1},variants:{type:Array,default:null}},emits:["update:selectedVariants","update:isAllSelected","editVariant","toggleStatus","inlinePriceChange","inlinePriceCommit","mediaUploaded"],setup(e,{emit:t}){const a=e,l=G(()=>a.variants??a.product.variants),n=M(bc),i=G(()=>{const w=l.value;return w.length<=n.value?w:w.slice(0,n.value)}),A=G(()=>l.value.length>n.value);be(l,()=>{n.value=bc});let p=null,m=null;const _=w=>{let B=w&&w.parentElement;for(;B;){const S=getComputedStyle(B).overflowY;if(S==="auto"||S==="scroll"||S==="overlay")return B;B=B.parentElement}return null},g=w=>{w?(p||(p=new IntersectionObserver(B=>{B.some(S=>S.isIntersecting)&&(n.value=Math.min(n.value+ZN,l.value.length))},{root:_(w),rootMargin:"300px 0px"})),m=w,p.observe(w)):m&&(p&&p.unobserve(m),m=null)};xt(()=>{p&&(p.disconnect(),p=null)});const y=w=>{if(!a.productEditModel)return!1;const B=a.product.variants.findIndex(S=>S.id===w.id);return B===-1?!1:a.productEditModel.hasValidationError(`variants.${B}.compare_price`)},v=w=>{var $,U,D;const B=w.attr_map||[];if(!B.length)return"";const S=(((D=(U=($=a.product)==null?void 0:$.detail)==null?void 0:U.other_info)==null?void 0:D.attribute_config)||[]).map(T=>parseInt(T.group_id)).filter(Boolean),V=T=>{const I=S.indexOf(T);return I===-1?Number.MAX_SAFE_INTEGER:I};return[...B].sort((T,I)=>V(parseInt(T.group_id))-V(parseInt(I.group_id))).map(T=>{const I=a.attributeGroups.find(O=>O.id===parseInt(T.group_id));if(!I)return null;const L=(I.terms||[]).find(O=>O.id===parseInt(T.term_id));return L?L.title:null}).filter(Boolean).join(" / ")},k=t,b=(w,B)=>{let S;B?S=[...a.selectedVariants,w]:S=a.selectedVariants.filter(V=>V!==w),k("update:selectedVariants",S)};return(w,B)=>{const S=C("el-checkbox"),V=C("el-dropdown-item"),F=C("el-dropdown-menu"),$=C("el-dropdown");return r(),h("div",QN,[o("table",null,[B[1]||(B[1]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col"),o("col"),o("col")],-1)),o("thead",null,[o("tr",null,[o("th",null,[s(S,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":w.$t("Select all variants"),"onUpdate:modelValue":B[0]||(B[0]=U=>w.$emit("update:isAllSelected",U))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(w.$t("Image")),1),o("th",null,f(w.$t("Title")),1),o("th",null,f(w.$t("Price")),1),o("th",null,f(w.$t("Compare at price")),1),o("th",MN,f(w.$t("Action")),1)])]),o("tbody",null,[(r(!0),h(P,null,ae(i.value,U=>{var D,T;return r(),h("tr",{key:U.id},[o("td",null,[s(S,{"model-value":e.selectedVariants.includes(U.id),"aria-label":c(d)("Select variant %1$s",U.variation_title),onChange:I=>b(U.id,I)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",LN,[s(wl,{modelValue:U.media,"onUpdate:modelValue":I=>U.media=I,compact:!0,"max-thumbs":1,square:!0,onChange:I=>w.$emit("mediaUploaded",U,I)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",RN,[o("div",ON,[o("div",PN,[o("span",HN,f(U.variation_title),1),U.item_status==="inactive"?(r(),h("span",NN,f(c(d)("Inactive")),1)):x("",!0)]),v(U)&&v(U)!==U.variation_title?(r(),h("span",KN,f(v(U)),1)):x("",!0)])])]),o("td",null,[o("div",GN,[s(Ya,{placeholder:w.$t("Price"),"model-value":U.item_price,"onUpdate:modelValue":I=>w.$emit("inlinePriceChange",U,"item_price",I),onChange:I=>w.$emit("inlinePriceCommit",U)},null,8,["placeholder","model-value","onUpdate:modelValue","onChange"]),((D=U.other_info)==null?void 0:D.payment_type)==="subscription"&&((T=U.other_info)!=null&&T.repeat_interval)?(r(),h("span",zN,f(U.other_info.repeat_interval),1)):x("",!0)])]),o("td",null,[o("div",jN,[s(Ya,{placeholder:w.$t("Compare price"),"error-class":y(U)?"is-error":"",title:y(U)?w.$t("Compare price must be greater than or equal to item price."):null,"model-value":U.compare_price,"onUpdate:modelValue":I=>w.$emit("inlinePriceChange",U,"compare_price",I),onChange:I=>w.$emit("inlinePriceCommit",U)},null,8,["placeholder","error-class","title","model-value","onUpdate:modelValue","onChange"])])]),o("td",qN,[o("div",YN,[o("div",WN,[s(tt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:I=>w.$emit("editVariant",U)},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["onClick"]),s($,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:I=>{I==="toggle_status"&&w.$emit("toggleStatus",U)}},{dropdown:u(()=>[s(F,null,{default:u(()=>[s(V,{class:"show-on-mobile",onClick:I=>w.$emit("editVariant",U)},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(w.$t("Edit")),1)]),_:2},1032,["onClick"]),s(V,null,{default:u(()=>[U.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(U.id),showMode:"icon_with_text",buttonText:w.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),s(V,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!U.id},{default:u(()=>{var I;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&U.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((I=w.appVars)==null?void 0:I.frontend_url)+"=instant_checkout&item_id="+U.id+"&quantity=1",showMode:"icon_with_text",buttonText:w.$t("Direct Checkout"),tooltipContent:w.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[s(X,{name:"Copy"}),R(" "+f(w.$t("Direct Checkout"))+" ",1),s(Ot,{content:w.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),U.id?(r(),E(V,{key:0,command:"toggle_status",class:ue({"item-destructive":U.item_status!=="inactive"})},{default:u(()=>[s(X,{name:U.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(U.item_status==="inactive"?w.$t("Set Active"):w.$t("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[s(X,{name:"More"})],8,JN)]),_:2},1032,["onCommand"])])])])])}),128)),A.value?(r(),h("tr",XN,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:g})])])):x("",!0)])])])}}},tK={class:"fct-product-pricing-form-wrap"},aK={class:"fct-product-pricing-form-inner"},lK={class:"dialog-footer"},sK={class:"fct-btn-group sm"},nK={__name:"GroupBulkEditForm",props:{groupVariantIds:{type:Array,required:!0},product:Object,productEditModel:Object,fieldKey:String},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const l=e,n=a,i=()=>({item_price:null,compare_price:null,item_cost:null,manage_cost:"__unchanged__",sku:null,manage_stock:"__unchanged__",total_stock:null,fulfillment_type:"__unchanged__",available:null,on_hold:null,committed:null,other_info:{payment_type:"__unchanged__",description:null,tax_class:null,tax_exempt:"__unchanged__",tax_inclusion:"__unchanged__",package_slug:null,weight:null,weight_unit:null,length:null,width:null,height:null,interval:null,interval_count:null,billing_summary:null,manage_setup_fee:"__unchanged__",signup_fee:null,signup_fee_name:null,times:null,trial_days:null}}),A=M(i()),p=M(0),m=M(!1),_=M(!1);Te(async()=>{await $e(),_.value=!0});const g=()=>{const v=A.value||{},k={};["item_price","compare_price","item_cost","manage_cost","sku","manage_stock","total_stock","fulfillment_type"].forEach(V=>{const F=v[V];F!=null&&F!==""&&F!=="__unchanged__"&&(k[V]=F)});const w=v.other_info||{},B={};Object.keys(w).forEach(V=>{if(V==="billing_summary")return;const F=w[V];F!=null&&F!==""&&F!=="__unchanged__"&&(B[V]=F)});const S={...k};return Object.keys(B).length>0&&(S.other_info=B),S},y=async()=>{if(!l.groupVariantIds.length)return j.error(d("Please select at least one variant to update.")),null;const v=g();if(!Object.keys(v).length)return j.error(d("Please fill in at least one field to update.")),null;l.productEditModel.setSaving(!0);try{const k=await ce.post("products/variants/group-bulk-update",{variant_ids:l.groupVariantIds,...v});return j.success(k.message||d("Variants updated successfully")),p.value=0,n("createOrUpdateVariant",{group:!0,count:l.groupVariantIds.length}),k}catch(k){return k&&(k.status_code===422||k.status===422)?j.validationErrors(k):j.error(k&&k.data&&k.data.message||d("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return be(A,()=>{m.value||!_.value||p.value++},{deep:!0}),be(()=>p.value,v=>{n("dirtyStateChange",v>0)},{immediate:!0}),t({hasDirtyDrafts:()=>p.value>0,getDirtyDraftCount:()=>p.value>0?1:0,discardDrafts:async()=>{m.value=!0,A.value=i(),await $e(),p.value=0,m.value=!1},saveCurrentDraft:y}),(v,k)=>{const b=C("el-form"),w=C("el-button");return r(),h("div",tK,[o("div",aK,[s(b,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[s(Cf,{variant:A.value,"field-key":e.fieldKey,"mode-type":"update",product:e.product,"product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product","product-edit-model"]),s(kf,{variant:A.value,"field-key":e.fieldKey,"mode-type":"update",product:e.product,"product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product","product-edit-model"]),s(Bf,{variant:A.value,"field-key":e.fieldKey,"mode-type":"update","product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),E(xf,{key:0,variant:A.value,"product-edit-model":e.productEditModel,"field-key":e.fieldKey,"mode-type":"update","is-group-mode":!0},null,8,["variant","product-edit-model","field-key"])):x("",!0)]),_:1})]),o("div",lK,[o("div",sK,[s(w,{onClick:k[0]||(k[0]=B=>n("closeModal"))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(w,{type:"primary",loading:e.productEditModel.saving,disabled:e.productEditModel.saving,onClick:y},{default:u(()=>[R(f(c(d)("Update %1$s variants",e.groupVariantIds.length)),1)]),_:1},8,["loading","disabled"])])])])}}},oK={class:"fct-adv-variant-table-wrap"},iK={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},rK={class:"flex items-center flex-wrap gap-2 ml-auto"},dK=["aria-label"],uK={key:0,class:"fct-adv-filters-panel-wrap"},cK={class:"fct-adv-variant-search-row"},AK={key:0,class:"fct-adv-variant-filters"},pK=["aria-pressed"],fK={key:0,class:"fct-adv-filter-chip__count"},mK={class:"fct-adv-filter-options"},hK={class:"fct-adv-filter-options__header"},_K=["onClick"],vK={class:"fct-adv-filter-options__list"},gK={key:0,class:"fct-adv-filter-count"},yK={key:0,class:"fct-adv-variant-empty"},bK={class:"fct-adv-variant-empty__title"},wK={class:"fct-adv-variant-empty__hint"},CK=["aria-label"],kK={class:"fct-grouped-variant-skeleton"},BK={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},xK={class:"fct-product-pricing-table-mobile-item-inner"},SK={class:"fct-product-pricing-table-item"},$K={class:"media relative"},FK={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},EK={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},UK=["src","alt"],IK=["src","alt"],VK={class:"fct-product-pricing-table-item-content"},DK={class:"title"},TK={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},QK={class:"fct-adv-attr-breadcrumb"},MK={key:0,class:"compare-price"},LK={class:"price"},RK={class:"fct-product-pricing-table-item-action"},OK={class:"fct-btn-group sm"},PK=["aria-label"],HK={class:"fct-shared-variant-drawer__layout"},NK={key:0,class:"fct-shared-variant-nav"},KK={class:"fct-group-edit-aside"},GK={class:"fct-group-edit-aside__label flex items-center gap-2"},zK={class:"fct-group-edit-aside__title"},jK={class:"fct-group-edit-aside__hint"},qK={class:"fct-group-edit-aside__list"},YK={key:1,class:"fct-shared-variant-nav"},WK={class:"fct-shared-variant-nav__filters"},JK={key:0,class:"fct-shared-variant-nav__chips"},XK=["aria-pressed"],ZK={key:0,class:"fct-adv-filter-chip__count"},eG={class:"fct-adv-filter-options"},tG={class:"fct-adv-filter-options__header"},aG=["onClick"],lG={class:"fct-adv-filter-options__list"},sG={class:"fct-shared-variant-drawer__content"},nG={key:0,class:"fct-compact-group-edit-summary"},oG={class:"fct-compact-group-edit-summary__title"},iG={class:"fct-compact-group-edit-summary__count"},rG={class:"fct-compact-group-edit-summary__list"},dG={key:0,class:"fct-compact-group-edit-bar"},uG=["disabled","aria-label","onClick"],cG={class:"fct-shared-variant-drawer__form"},AG={class:"fct-variant-dirty-dialog__header"},pG=["id"],fG={class:"dialog-footer"},mG={class:"fct-btn-group sm"},wc=200,hG={__name:"AdvancedVariationTable",props:{product:Object,productEditModel:Object,attributeGroups:{type:Array,default:()=>[]},externalBusy:{type:Boolean,default:!1}},setup(e){var ot,qe,Ze,gt,lt,Vt;const t=e,a=M([]),l=M(!1),n=M(!1),i=M(null),A=M(!1),p=M(new Set),m=M(new Set),_=M(0),g=()=>{_.value++},y=()=>{_.value=Math.max(0,_.value-1)},v=G(()=>_.value>0||l.value||t.externalBusy),k=M(((Vt=(lt=(gt=(Ze=(qe=(ot=t.product)==null?void 0:ot.detail)==null?void 0:qe.other_info)==null?void 0:Ze.attribute_config)==null?void 0:gt[0])==null?void 0:lt.variants)==null?void 0:Vt.length)||6),b=M(!1),w=M(null),B=M(null),S=M(!1),V=M(!1),F=M(!1),$=M(null),U=M(""),D=M(""),T=M(null),I=M(""),L=M(!1),O=M({}),Q=()=>{L.value=!L.value},H=()=>{O.value={},I.value="",L.value=!1},K=me=>{me.style.opacity="0",me.style.overflow="hidden"},W=me=>{const ve=me.scrollHeight+"px";me.style.height="0",me.offsetHeight,me.style.transition="height 0.25s ease, opacity 0.2s ease",me.style.height=ve,me.style.opacity="1"},z=me=>{me.style.height="",me.style.overflow="",me.style.transition="",me.style.opacity=""},Y=me=>{me.style.height=me.scrollHeight+"px",me.style.overflow="hidden",me.offsetHeight,me.style.transition="height 0.25s ease, opacity 0.2s ease",me.style.height="0",me.style.opacity="0"},Z=me=>{me.style.height="",me.style.overflow="",me.style.transition="",me.style.opacity=""},re=G(()=>{var ve,Ne,Pe;const me=(Pe=(Ne=(ve=t.product)==null?void 0:ve.detail)==null?void 0:Ne.other_info)==null?void 0:Pe.attribute_config;return!me||!Array.isArray(me)?[]:me.map(ft=>{const se=parseInt(ft.group_id,10),je=t.attributeGroups.find(vt=>parseInt(vt.id,10)===se);return je?{id:parseInt(je.id,10),title:je.title}:null}).filter(Boolean)}),q=G(()=>re.value.map(me=>{const ve=t.attributeGroups.find(Ne=>Ne.id===me.id);return ve?{id:ve.id,title:ve.title,terms:ve.terms||[]}:null}).filter(Boolean)),Ae=(me,ve)=>{const Ne=O.value[me];return Ne?Ne.has(ve):!1},ie=(me,ve)=>{const Ne={...O.value},Pe=Ne[me]?new Set(Ne[me]):new Set;Pe.has(ve)?Pe.delete(ve):Pe.add(ve),Pe.size===0?delete Ne[me]:Ne[me]=Pe,O.value=Ne},J=me=>{var ve;return((ve=O.value[me])==null?void 0:ve.size)||0},N=me=>{if(!O.value[me])return;const ve={...O.value};delete ve[me],O.value=ve},le=()=>{O.value={},I.value=""},ee=G(()=>Object.keys(O.value).length>0||I.value.trim()!==""),pe=G(()=>ee.value&&t.product.variants.length>0&&de.value.length===0),de=G(()=>{let me=t.product.variants;const ve=Object.keys(O.value);ve.length>0&&(me=me.filter(Pe=>ve.every(ft=>{const se=O.value[ft];if(!se||se.size===0)return!0;const je=(Pe.attr_map||[]).find(vt=>parseInt(vt.group_id)===parseInt(ft));return je&&se.has(parseInt(je.term_id))})));const Ne=I.value.trim().toLowerCase();return Ne&&(me=me.filter(Pe=>(Pe.variation_title||"").toLowerCase().includes(Ne)?!0:(Pe.attr_map||[]).map(je=>{const vt=t.attributeGroups.find(St=>St.id===parseInt(je.group_id));if(!vt)return"";const Me=(vt.terms||[]).find(St=>St.id===parseInt(je.term_id));return Me?Me.title.toLowerCase():""}).join(" ").includes(Ne))),me}),Ue=G(()=>{if(!T.value)return null;const me=parseInt(T.value,10),ve=t.attributeGroups.find(ft=>parseInt(ft.id,10)===me);if(!ve)return null;const Ne=[],Pe={};for(const ft of de.value){const se=(ft.attr_map||[]).find(vt=>parseInt(vt.group_id,10)===me);if(!se)continue;const je=parseInt(se.term_id,10);if(!Pe[je]){const vt=(ve.terms||[]).find(Me=>parseInt(Me.id,10)===je);Pe[je]={termId:je,title:vt?vt.title:"Unknown",variants:[]},Ne.push(Pe[je])}Pe[je].variants.push(ft)}return Ne}),Ce=G(()=>!!T.value&&Ue.value&&Ue.value.length>0);be(Ue,me=>{Array.isArray(me)&&me.length>0&&(k.value=me.length)},{immediate:!0});const Se=me=>t.productEditModel.validateComparePrice(me),ge=(me,ve)=>{const Ne=Ue.value?Ue.value.find(je=>je.termId===me):null;if(!Ne||ve===""||ve===null||ve===void 0)return;const Pe=parseFloat(ve);if(isNaN(Pe)||Pe<0){j.error(d("Please enter a valid price."));return}const ft=Ne.variants.filter(je=>a.value.includes(je.id));(ft.length?ft:Ne.variants).forEach(je=>{const vt=t.product.variants.findIndex(Me=>Me.id===je.id);vt!==-1&&(t.productEditModel.onChangePricing("item_price",vt,Pe),Se(vt))})},ke=me=>{const ve=t.product.variants.findIndex(Pe=>Pe.id===me.id);if(ve===-1)return;Se(ve)||j.error(d("Compare price must be greater than or equal to item price."))};be(()=>t.product.variants,me=>{Array.isArray(me)&&(me.forEach(ve=>{const Ne=ve.media?ve.media.meta_value||ve.media:[];ve.media=Array.isArray(Ne)?Ne:[]}),A.value&&(A.value=!1,qt()))},{immediate:!0,deep:!1}),be(()=>{var me;return(me=re.value[0])==null?void 0:me.id},me=>{if(re.value.length<2||!me){T.value=null;return}T.value=parseInt(me,10)},{immediate:!0}),be(()=>re.value.length,me=>{me<2&&(T.value=null)}),be([T,re],([me,ve])=>{var ft;if(!Array.isArray(ve)||ve.length<2)return;const Ne=(ft=ve[0])==null?void 0:ft.id;if(!Ne)return;const Pe=ve.map(se=>parseInt(se.id,10));(me==null||!Pe.includes(parseInt(me,10)))&&(T.value=parseInt(Ne,10))},{deep:!0});const Oe=(me,ve,Ne)=>{const Pe=parseFloat(Ne)||0,ft=t.product.variants.findIndex(se=>se.id===me.id);ft!==-1&&t.productEditModel.onChangePricing(ve,ft,Pe)},Ee=(me,ve)=>{const Ne=me.media;me.media=ve,g(),ce.post(`products/variants/${me.id}/setMedia`,{media:ve}).then(Pe=>{j.success(Pe.message||d("Thumbnail set successfully"))}).catch(Pe=>{var ft;me.media=Ne,j.error(((ft=Pe==null?void 0:Pe.data)==null?void 0:ft.message)||(Pe==null?void 0:Pe.message)||d("Failed to save thumbnail"))}).finally(y)},fe=async(me,ve)=>{const Ne=me.variants.filter(vt=>a.value.includes(vt.id)),Pe=Ne.length?Ne:me.variants;Pe.forEach(vt=>{vt.media=ve});const ft=Pe.map(vt=>vt.id),se=5;let je=0;g();try{for(let vt=0;vt<ft.length;vt+=se){const Me=await Promise.allSettled(ft.slice(vt,vt+se).map(St=>ce.post(`products/variants/${St}/setMedia`,{media:ve})));je+=Me.filter(St=>St.status==="rejected").length}}finally{y()}je===0?j.success(d("Thumbnail applied to %1$s variants",Pe.length)):j.error(d("Failed to apply thumbnail to %1$s variants",je))},ye=G({get(){const me=de.value.map(ve=>ve.id);return me.length===0?!1:me.every(ve=>a.value.includes(ve))},set(me){const ve=de.value.map(Ne=>Ne.id);if(me){const Ne=new Set([...a.value,...ve]);a.value=Array.from(Ne)}else{const Ne=new Set(ve);a.value=a.value.filter(Pe=>!Ne.has(Pe))}}}),De=G(()=>{const me=de.value.map(Ne=>Ne.id);if(me.length===0)return!1;const ve=me.filter(Ne=>a.value.includes(Ne)).length;return ve>0&&ve<me.length}),Le=()=>{if(l.value||!U.value||a.value.length===0)return;if(U.value==="delete"){On.confirmDeleteWithInput("delete",d("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{At()}).catch(()=>{});return}const me=U.value==="set_price";let ve=null;if(me&&(ve=parseFloat(D.value),D.value===""||isNaN(ve)||ve<0)){j.error(d("Please enter a valid price."));return}if(me&&a.value.slice(0,wc).map(ft=>t.product.variants.find(se=>se.id===ft)).filter(ft=>{if(!ft)return!1;const se=parseFloat(ft.compare_price);return!isNaN(se)&&se>0&&se<ve}).length){j.error(d("Compare price must be greater than or equal to item price."));return}const Ne=a.value.slice(0,wc).map(Pe=>{const ft={id:Pe};return U.value==="set_price"?ft.item_price=ve:U.value==="set_status_active"?ft.item_status="active":U.value==="set_status_inactive"&&(ft.item_status="inactive"),ft});l.value=!0,t.productEditModel.bulkUpdateVariants(Ne).then(Pe=>{j.success((Pe==null?void 0:Pe.message)||d("Variants updated successfully")),t.productEditModel.data.reloader(),a.value=[],U.value="",D.value=""}).catch(Pe=>{var ft;j.error(((ft=Pe==null?void 0:Pe.data)==null?void 0:ft.message)||d("Bulk action failed"))}).finally(()=>{l.value=!1})},At=async()=>{const me=[...a.value],ve=5;g();try{for(let Ne=0;Ne<me.length;Ne+=ve)await Promise.all(me.slice(Ne,Ne+ve).map(Pe=>ce.delete(`products/variants/${Pe}`)));j.success(d("Variants deleted successfully")),t.productEditModel.data.reloader(),a.value=[]}catch{j.error(d("Failed to delete some variants"))}finally{y()}},mt=me=>{if(!me||!me.id)return;const ve=me.item_status==="inactive"?"active":"inactive";g(),t.productEditModel.bulkUpdateVariants([{id:me.id,item_status:ve}]).then(Ne=>{me.item_status=ve,j.success((Ne==null?void 0:Ne.message)||d("Variant updated successfully")),t.productEditModel.data.reloader()}).catch(Ne=>{var Pe;j.error(((Pe=Ne==null?void 0:Ne.data)==null?void 0:Pe.message)||d("Failed to update variant"))}).finally(y)},Mt=me=>{const ve=me.attr_map||[];return ve.length?ve.map(Pe=>{const ft=t.attributeGroups.find(je=>je.id===parseInt(Pe.group_id));if(!ft)return null;const se=(ft.terms||[]).find(je=>je.id===parseInt(Pe.term_id));return se?se.title:null}).filter(Boolean).join(" / "):""},Dt=(me,ve)=>{const Ne=me.attr_map||[];if(!Ne.length)return"";const Pe=parseInt(ve);return Ne.filter(se=>parseInt(se.group_id)!==Pe).map(se=>{const je=t.attributeGroups.find(Me=>Me.id===parseInt(se.group_id));if(!je)return null;const vt=(je.terms||[]).find(Me=>Me.id===parseInt(se.term_id));return vt?vt.title:null}).filter(Boolean).join(" / ")},Je=me=>{const ve=t.product.variants.findIndex(Ne=>Ne.id===me.id);ve!==-1&&(t.productEditModel.setValidationErrors({}),w.value=ve,b.value=!0)},pt=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,b.value=!1,w.value=null,n.value=!1,i.value=null,A.value=!1},qt=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,n.value=!1,i.value=null,p.value=new Set},Ct=G(()=>!i.value||!i.value.items?[]:i.value.items.filter(me=>p.value.has(me.key)).map(me=>me.variant&&me.variant.id?me.variant.id:null).filter(Boolean)),$t=me=>{const ve=new Set(p.value);ve.has(me)?ve.delete(me):ve.add(me),p.value=ve},Nt=()=>{S.value=!1,V.value=!1,$.value=null},Kt=()=>{var me,ve;return((ve=(me=B.value)==null?void 0:me.hasDirtyDrafts)==null?void 0:ve.call(me))??!1},Tt=me=>{F.value=me},yt=()=>{const me=$.value;if(Nt(),!!me&&me.type==="close"){if(typeof me.done=="function"){me.done();return}pt()}},Xt=()=>{Nt()},we=async()=>{var me,ve;await((ve=(me=B.value)==null?void 0:me.discardDrafts)==null?void 0:ve.call(me)),F.value=!1,yt()},Ie=async()=>{var ve;if(!((ve=B.value)!=null&&ve.saveCurrentDraft)||V.value)return;if(V.value=!0,await B.value.saveCurrentDraft()){F.value=!1,yt();return}V.value=!1,Xt()},it=me=>{if(!Kt()){me();return}$.value={type:"close",done:me},S.value=!0},kt=()=>{if(n.value){it(qt);return}it(pt)},Bt=me=>{if(F.value=!1,t.productEditModel.setValidationErrors({}),n.value){A.value=!0,t.productEditModel.data.reloader();return}me&&typeof me.index=="number"&&me.index>=0&&(w.value=me.index)},na=me=>{const ve=ul.value?ul.value.find(Ne=>Ne.termId===me.termId):null;ve&&bt(ve)},bt=me=>{if(!me||!me.items||!me.items.length||F.value)return;i.value=me,p.value=new Set(me.items.map(Ne=>Ne.key)),n.value=!0;const ve=me.items[0];t.productEditModel.setValidationErrors({}),w.value=typeof ve.index=="number"?ve.index:null,b.value=!0},ia=M(typeof window<"u"?window.innerWidth:1280);let ra=null;Te(()=>{typeof window>"u"||(ra=()=>{ia.value=window.innerWidth},window.addEventListener("resize",ra))}),xt(()=>{ra&&(window.removeEventListener("resize",ra),ra=null)});const Yt=G(()=>ia.value<=900),ka=G(()=>ia.value<=640?"100%":ia.value<=900?"95%":"920px"),tl=G(()=>{const me=new Map;return(t.product.variants||[]).forEach((ve,Ne)=>{ve&&ve.id!=null&&me.set(ve.id,Ne)}),(de.value||[]).map(ve=>{const Ne=me.get(ve==null?void 0:ve.id);return{key:(ve==null?void 0:ve.id)??`variant-${Ne}`,index:Ne,variant:ve,label:Mt(ve)||(ve==null?void 0:ve.variation_title)||`${d("Variant")} ${Ne+1}`,meta:(ve==null?void 0:ve.item_price)!==void 0&&(ve==null?void 0:ve.item_price)!==null&&(ve==null?void 0:ve.item_price)!==""?jt(ve.item_price,!0):d("No price set"),modeType:"update",isDraft:!1}})}),ul=G(()=>{if(!Ue.value||Ue.value.length===0)return null;const me=new Map;(t.product.variants||[]).forEach((Pe,ft)=>{Pe&&Pe.id!=null&&me.set(Pe.id,ft)});const ve=T.value,Ne=Pe=>{const ft=me.get(Pe==null?void 0:Pe.id),se=ve?Dt(Pe,ve):Mt(Pe);return{key:(Pe==null?void 0:Pe.id)??`variant-${ft}`,index:ft,variant:Pe,label:se||(Pe==null?void 0:Pe.variation_title)||`${d("Variant")} ${ft+1}`,meta:(Pe==null?void 0:Pe.item_price)!==void 0&&(Pe==null?void 0:Pe.item_price)!==null&&(Pe==null?void 0:Pe.item_price)!==""?jt(Pe.item_price,!0):d("No price set"),modeType:"update",isDraft:!1}};return Ue.value.map(Pe=>({termId:Pe.termId,title:Pe.title,count:Pe.variants.length,items:Pe.variants.map(Ne)}))}),al=G(()=>{var ve;const me=(ve=t.product.variants)==null?void 0:ve[w.value];return(me==null?void 0:me.id)??`variant-${w.value??0}`}),va=(me,ve)=>{const Ne=parseInt(ve,10),Pe=(me.attr_map||[]).find(vt=>parseInt(vt.group_id,10)===Ne);if(!Pe)return"";const ft=t.attributeGroups.find(vt=>parseInt(vt.id,10)===Ne);if(!ft)return"";const se=parseInt(Pe.term_id,10),je=(ft.terms||[]).find(vt=>parseInt(vt.id,10)===se);return je?je.title:""},te=G(()=>{var ve;if(w.value===null)return{group:"",detail:""};const me=(ve=t.product.variants)==null?void 0:ve[w.value];return me?T.value?{group:va(me,T.value),detail:Dt(me,T.value)}:{group:"",detail:Mt(me)}:{group:"",detail:""}}),Fe=me=>{me&&(F.value&&al.value!==me.key||typeof me.index=="number"&&(t.productEditModel.setValidationErrors({}),w.value=me.index))},ne=me=>{var ve,Ne;return!!((ve=me==null?void 0:me.variant)!=null&&ve.id)&&["publish","private"].includes((Ne=t.product)==null?void 0:Ne.post_status)},_e=me=>`${Ke.get("frontend_url")}=instant_checkout&item_id=${me.variant.id}&quantity=1`,We=(me,ve)=>{var Ne,Pe;if(!(!ve||!me)){if(me==="copy_variation_id"&&((Ne=ve.variant)!=null&&Ne.id)){ns.copy(String(ve.variant.id),{successMessage:d("Variation ID copied to clipboard")});return}if(me==="copy_direct_checkout"&&ne(ve)){ns.copy(_e(ve),{successMessage:d("Direct checkout link copied to clipboard")});return}me==="toggle_status"&&((Pe=ve.variant)!=null&&Pe.id)&&mt(ve.variant)}};return(me,ve)=>{const Ne=C("el-button"),Pe=C("el-input"),ft=C("el-checkbox"),se=C("el-popover"),je=C("el-dropdown-item"),vt=C("el-dropdown-menu"),Me=C("el-dropdown"),St=C("el-drawer"),ll=C("el-dialog");return r(),h("div",oK,[o("div",iK,[s(EH,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:T.value,"onUpdate:modelValue":ve[0]||(ve[0]=oe=>T.value=oe)},null,8,["product","attribute-groups","modelValue"]),o("div",rK,[L.value?(r(),E(Ne,{key:1,onClick:H},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})):(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-panel-toggle","aria-label":c(d)("Search and filter variants"),onClick:Q},[s(X,{name:"Search"}),s(X,{name:"Filter"})],8,dK))])]),s(Gl,{onBeforeEnter:K,onEnter:W,onAfterEnter:z,onLeave:Y,onAfterLeave:Z},{default:u(()=>[L.value?(r(),h("div",uK,[o("div",cK,[s(Pe,{modelValue:I.value,"onUpdate:modelValue":ve[1]||(ve[1]=oe=>I.value=oe),placeholder:c(d)("Search variants"),size:"small",clearable:""},{prefix:u(()=>[s(X,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),q.value.length>0?(r(),h("div",AK,[(r(!0),h(P,null,ae(q.value,oe=>(r(),E(se,{key:oe.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:u(()=>[o("button",{class:ue(["fct-adv-filter-chip",{"is-active":J(oe.id)>0}]),"aria-pressed":J(oe.id)>0,type:"button"},[o("span",null,f(oe.title),1),J(oe.id)>0?(r(),h("span",fK,f(J(oe.id)),1)):x("",!0),s(X,{name:"ChevronDown"})],10,pK)]),default:u(()=>[o("div",mK,[o("div",hK,[o("span",null,f(c(d)("Filter by %1$s",oe.title)),1),J(oe.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:he=>N(oe.id)},f(c(d)("Clear")),9,_K)):x("",!0)]),o("ul",vK,[(r(!0),h(P,null,ae(oe.terms,he=>(r(),h("li",{key:he.id},[s(ft,{"model-value":Ae(oe.id,he.id),onChange:Qe=>ie(oe.id,he.id)},{default:u(()=>[R(f(he.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),ee.value&&!pe.value?(r(),h("span",gK,f(c(d)("Showing %1$s of %2$s variants",de.value.length,e.product.variants.length)),1)):x("",!0),ee.value?(r(),h("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:le},f(c(d)("Clear filters")),1)):x("",!0)])):x("",!0)])):x("",!0)]),_:1}),s(VH,{"selected-count":a.value.length,"bulk-action":U.value,"onUpdate:bulkAction":ve[2]||(ve[2]=oe=>U.value=oe),"bulk-value":D.value,"onUpdate:bulkValue":ve[3]||(ve[3]=oe=>D.value=oe),saving:l.value,onApply:Le,onClear:ve[4]||(ve[4]=oe=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),pe.value?(r(),h("div",yK,[s(X,{name:"Search"}),o("p",bK,f(c(d)("No variants match your filters")),1),o("p",wK,f(c(d)("Try a different search term or clear some filters.")),1),s(Ne,{size:"small",onClick:le},{default:u(()=>[R(f(c(d)("Clear filters")),1)]),_:1})])):x("",!0),v.value&&!pe.value?(r(),h("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":me.$t("Updating variants")},[o("table",null,[ve[16]||(ve[16]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col",{width:"160"}),o("col",{width:"160"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[ve[13]||(ve[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,f(me.$t("Image")),1),o("th",null,f(me.$t("Variant")),1),o("th",null,f(me.$t("Price")),1),o("th",null,f(me.$t("Compare at price")),1),ve[14]||(ve[14]=o("th",null,null,-1))])]),o("tbody",kK,[(r(!0),h(P,null,ae(Math.min(k.value,8),oe=>(r(),h("tr",{key:"wrap-skel-"+oe},ve[15]||(ve[15]=[o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-img"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-title"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-action"})],-1)])))),128))])])],8,CK)):Ce.value&&!pe.value?(r(),E(TN,{key:2,product:e.product,"product-edit-model":e.productEditModel,"attribute-groups":e.attributeGroups,"grouped-variants":Ue.value,"selected-variants":a.value,"is-all-selected":ye.value,"is-selection-indeterminate":De.value,"group-by-id":T.value,"expanded-groups":m.value,"onUpdate:selectedVariants":ve[5]||(ve[5]=oe=>a.value=oe),"onUpdate:isAllSelected":ve[6]||(ve[6]=oe=>ye.value=oe),"onUpdate:expandedGroups":ve[7]||(ve[7]=oe=>m.value=oe),onEditVariant:Je,onEditGroup:na,onToggleStatus:mt,onInlinePriceChange:Oe,onInlinePriceCommit:ke,onMediaUploaded:Ee,onGroupPriceApply:ge,onGroupMediaUploaded:fe},null,8,["product","product-edit-model","attribute-groups","grouped-variants","selected-variants","is-all-selected","is-selection-indeterminate","group-by-id","expanded-groups"])):!Ce.value&&!pe.value?(r(),E(eK,{key:3,product:e.product,"product-edit-model":e.productEditModel,variants:de.value,"attribute-groups":e.attributeGroups,"selected-variants":a.value,"is-all-selected":ye.value,"is-selection-indeterminate":De.value,"onUpdate:selectedVariants":ve[8]||(ve[8]=oe=>a.value=oe),"onUpdate:isAllSelected":ve[9]||(ve[9]=oe=>ye.value=oe),onEditVariant:Je,onToggleStatus:mt,onInlinePriceChange:Oe,onInlinePriceCommit:ke,onMediaUploaded:Ee},null,8,["product","product-edit-model","variants","attribute-groups","selected-variants","is-all-selected","is-selection-indeterminate"])):x("",!0),Ce.value?x("",!0):(r(),h("div",BK,[(r(!0),h(P,null,ae(de.value,oe=>{var he,Qe;return r(),h("div",{key:oe.id,class:"fct-product-pricing-table-mobile-row"},[o("div",xK,[o("div",SK,[o("div",$K,[o("div",FK,[s(Jp,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:He=>Ee(oe,He)},null,8,["onMediaUploaded"])]),((he=oe==null?void 0:oe.media)==null?void 0:he.length)>0?(r(),h("div",EK,[o("img",{src:(Qe=oe.media[0])==null?void 0:Qe.url,alt:oe.variation_title,class:"!object-contain rounded border border-solid border-gray-outline dark:border-dark-400"},null,8,UK)])):(r(),h("img",{key:1,src:c(pl).productPlaceholder(),alt:c(d)("No Image")},null,8,IK))]),o("div",VK,[o("div",DK,[R(f(oe.variation_title)+" ",1),oe.item_status==="inactive"?(r(),h("span",TK,f(c(d)("Inactive")),1)):x("",!0)]),o("div",QK,f(Mt(oe)||"—"),1),o("ul",null,[o("li",null,[oe.compare_price?(r(),h("div",MK,f(c(jt)(oe.compare_price,!0)),1)):x("",!0),o("div",LK,f(c(jt)(oe.item_price,!0)),1)])])])]),o("div",RK,[o("div",OK,[s(tt,{size:"small",tag:"button",onClick:He=>Je(oe)},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["onClick"]),s(Me,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:He=>{He==="toggle_status"&&mt(oe)}},{dropdown:u(()=>[s(vt,null,{default:u(()=>[s(je,null,{default:u(()=>[oe.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(oe.id),showMode:"icon_with_text",buttonText:c(d)("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),oe.id?(r(),E(je,{key:0,command:"toggle_status",class:ue({"item-destructive":oe.item_status!=="inactive"})},{default:u(()=>[s(X,{name:oe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(oe.item_status==="inactive"?c(d)("Set Active"):c(d)("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[s(X,{name:"More"})],8,PK)]),_:2},1032,["onCommand"])])])])])}),128))])),s(St,{modelValue:b.value,"onUpdate:modelValue":ve[11]||(ve[11]=oe=>b.value=oe),title:c(d)("Pricing"),size:ka.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":it,class:"fct-shared-variant-drawer",onClose:pt},{default:u(()=>{var oe,he,Qe,He,Ye,ht;return[o("div",HK,[!Yt.value&&n.value?(r(),h("aside",NK,[s(Zr,{product:e.product},null,8,["product"]),o("div",KK,[o("p",GK,[R(f(c(d)("Editing group"))+": ",1),o("span",zK,f((oe=i.value)==null?void 0:oe.title),1)]),o("p",jK,f(c(d)("Changes will apply to %1$s of %2$s variants in this group.",Ct.value.length,(he=i.value)==null?void 0:he.count)),1),o("ul",qK,[(r(!0),h(P,null,ae((Qe=i.value)==null?void 0:Qe.items,st=>(r(),h("li",{key:st.key,class:"fct-group-edit-aside__item"},[s(ft,{"model-value":p.value.has(st.key),onChange:It=>$t(st.key)},{default:u(()=>[R(f(st.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])])):Yt.value?x("",!0):(r(),h("aside",YK,[s(Zr,{product:e.product},null,8,["product"]),o("div",WK,[s(Pe,{modelValue:I.value,"onUpdate:modelValue":ve[10]||(ve[10]=st=>I.value=st),placeholder:c(d)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:u(()=>[s(X,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),q.value.length>0?(r(),h("div",JK,[(r(!0),h(P,null,ae(q.value,st=>(r(),E(se,{key:"nav-chip-"+st.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:u(()=>[o("button",{class:ue(["fct-adv-filter-chip",{"is-active":J(st.id)>0}]),"aria-pressed":J(st.id)>0,type:"button"},[o("span",null,f(st.title),1),J(st.id)>0?(r(),h("span",ZK,f(J(st.id)),1)):x("",!0),s(X,{name:"ChevronDown"})],10,XK)]),default:u(()=>[o("div",eG,[o("div",tG,[o("span",null,f(c(d)("Filter by %1$s",st.title)),1),J(st.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:It=>N(st.id)},f(c(d)("Clear")),9,aG)):x("",!0)]),o("ul",lG,[(r(!0),h(P,null,ae(st.terms,It=>(r(),h("li",{key:It.id},[s(ft,{"model-value":Ae(st.id,It.id),onChange:Wt=>ie(st.id,It.id)},{default:u(()=>[R(f(It.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128))])):x("",!0),ee.value?(r(),h("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:le},f(c(d)("Clear filters")),1)):x("",!0)]),s(Sf,{items:tl.value,"grouped-items":ul.value,"active-key":al.value,"is-dirty":F.value,"is-saving":V.value,"drawer-mode":"update",product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":ne,onSelect:Fe,onSave:Ie,onCommand:We,onEditGroup:bt},null,8,["items","grouped-items","active-key","is-dirty","is-saving","product","product-edit-model"])])),o("div",sG,[Yt.value&&n.value?(r(),h("div",nG,[o("div",oG,[R(f(c(d)("Editing group"))+": ",1),o("span",null,f((He=i.value)==null?void 0:He.title),1)]),o("div",iG,f(c(d)("Changes will apply to %1$s of %2$s variants in this group.",Ct.value.length,(Ye=i.value)==null?void 0:Ye.count)),1),o("ul",rG,[(r(!0),h(P,null,ae((ht=i.value)==null?void 0:ht.items,st=>(r(),h("li",{key:st.key},[s(ft,{"model-value":p.value.has(st.key),onChange:It=>$t(st.key)},{default:u(()=>[R(f(st.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])):Yt.value?(r(),h(P,{key:1},[ul.value&&ul.value.length?(r(),h("div",dG,[(r(!0),h(P,null,ae(ul.value,st=>(r(),h("button",{key:"cge-"+st.termId,type:"button",class:"fct-compact-group-edit-bar__btn",disabled:F.value,"aria-label":c(d)("Edit group %1$s",st.title),onClick:It=>bt(st)},[s(X,{name:"Edit"}),o("span",null,f(st.title),1)],8,uG))),128))])):x("",!0),s($f,{items:tl.value,"active-key":al.value,"is-dirty":F.value,onSelect:Fe},null,8,["items","active-key","is-dirty"])],64)):x("",!0),o("div",cG,[b.value&&w.value!==null&&!n.value?(r(),E(Nd,{ref_key:"pricingFormRef",ref:B,key:al.value,index:w.value,modeType:"update",fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,"variant-title-info":te.value,onCreateOrUpdateVariant:Bt,onCloseModal:kt,onDirtyStateChange:Tt},null,8,["index","product","productEditModel","variant-title-info"])):b.value&&n.value&&i.value?(r(),E(nK,{ref_key:"pricingFormRef",ref:B,key:`group-${i.value.termId}`,"group-variant-ids":Ct.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:Bt,onCloseModal:kt,onDirtyStateChange:Tt},null,8,["group-variant-ids","product","productEditModel"])):x("",!0)])])])]}),_:1},8,["modelValue","title","size"]),s(ll,{modelValue:S.value,"onUpdate:modelValue":ve[12]||(ve[12]=oe=>S.value=oe),"close-on-click-modal":!1,"close-on-press-escape":!V.value,"show-close":!V.value,class:"fct-variant-dirty-dialog",onClose:Xt},{header:u(({titleId:oe})=>[o("div",AG,[o("h3",{id:oe},f(c(d)("Unsaved changes")),9,pG)])]),default:u(()=>[o("p",null,f(c(d)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",fG,[o("div",mG,[s(Ne,{disabled:V.value,size:"small",onClick:Xt},{default:u(()=>[R(f(c(d)("Continue editing")),1)]),_:1},8,["disabled"]),s(Ne,{disabled:V.value,size:"small",onClick:we},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1},8,["disabled"]),s(Ne,{type:"primary",loading:V.value,size:"small",onClick:Ie},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},_G=["src","alt"],vG={class:"fct-swatch-tag-label"},gG=["aria-label","onClick","onKeydown"],Ar={__name:"DraggableOptionValues",props:{modelValue:{type:Array,default:()=>[]},terms:{type:Array,default:()=>[]},type:{type:String,default:"options"}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,n=(y,v)=>String(y)===String(v),i=G({get:()=>a.modelValue,set:y=>l("update:modelValue",y)}),A=y=>a.terms.find(v=>n(v.id,y))||null,p=y=>{if(typeof y=="string")return y;const v=A(y);return v?v.title:String(y)},m=y=>{const v=A(y);return v&&v.settings&&v.settings.color?{background:v.settings.color}:{}},_=y=>{const v=A(y);return v&&v.settings&&v.settings.image?v.settings.image:""},g=y=>{l("update:modelValue",a.modelValue.filter(v=>!n(v,y)))};return(y,v)=>(r(),E(c(cn),{modelValue:i.value,"onUpdate:modelValue":v[2]||(v[2]=k=>i.value=k),handle:".fct-value-tag-handle",disabled:i.value.length<2,class:"fct-value-tag-list",tag:"div"},{default:u(()=>[(r(!0),h(P,null,ae(i.value,k=>(r(),h("span",{key:String(k),class:"fct-swatch-tag"},[i.value.length>1?(r(),h("span",{key:0,class:"fct-value-tag-handle",onMousedown:v[0]||(v[0]=Ge(()=>{},["stop"]))},[s(X,{name:"ReorderDotsVertical"})],32)):x("",!0),e.type==="color"?(r(),h("span",{key:1,class:"fct-swatch-tag-dot",style:fa(m(k))},null,4)):e.type==="image"?(r(),h("img",{key:2,class:"fct-swatch-tag-img",src:_(k),alt:p(k)},null,8,_G)):x("",!0),o("span",vG,f(p(k)),1),o("span",{class:"fct-swatch-tag-close",role:"button",tabindex:"0","aria-label":c(d)("Remove"),onMousedown:v[1]||(v[1]=Ge(()=>{},["stop"])),onClick:Ge(b=>g(k),["stop"]),onKeydown:ea(Ge(b=>g(k),["prevent"]),["enter","space"])},"×",40,gG)]))),128))]),_:1},8,["modelValue","disabled"]))}},yG={class:"fct-add-term-modal"},bG={class:"dialog-footer"},wG={__name:"AddTermModal",props:{groupId:{type:[String,Number],required:!0},group:{type:Object,default:()=>({})},initialTitle:{type:String,default:""}},emits:["isTermCreatingDone"],setup(e,{emit:t}){const a=e,l=t,n=M(!1),i=M({}),A=M(null),p=G(()=>{const y=a.group&&a.group.settings;return y&&y.type?y.type:"options"}),m=M({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=G(()=>(m.value.title||"").trim()!==""),g=()=>{if(!_.value||n.value)return;n.value=!0,i.value={};const y={terms:[{title:m.value.title.trim(),settings:{color:m.value.settings.color||"",image:m.value.settings.image||""}}]};ce.post("options/attr/group/"+a.groupId+"/terms",y).then(v=>{un(v.message);const k=Array.isArray(v.data)?v.data[0]:v.data;l("isTermCreatingDone",k)}).catch(v=>{var k;(v==null?void 0:v.status_code)==422&&v.data?i.value=v.data:j.error(((k=v==null?void 0:v.data)==null?void 0:k.message)||(v==null?void 0:v.message)||d("Failed to add the term."))}).finally(()=>{n.value=!1})};return(y,v)=>{const k=C("el-button");return r(),h("div",yG,[s(So,{ref_key:"formRef",ref:A,term:m.value,"group-type":p.value,"show-remove-button":!1,"validation-errors":i.value,"field-key":"terms.0",onSubmit:g,onRemove:v[0]||(v[0]=b=>l("isTermCreatingDone"))},null,8,["term","group-type","validation-errors"]),o("div",bG,[s(k,{disabled:!_.value||n.value,loading:n.value,type:"primary",onClick:g},{default:u(()=>[R(f(c(d)("Add term")),1)]),_:1},8,["disabled","loading"])])])}}},Cc=10,CG=async(e,t,a)=>{const l=[];let n="";for(let i=0;i<a.length;i+=Cc){const A=a.slice(i,i+Cc);try{const p=await e("options/attr/group/"+t+"/terms",{terms:A.map(m=>({title:m}))});l.push(...(p==null?void 0:p.data)||[]),n=(p==null?void 0:p.message)||n}catch(p){return{created:l,message:n,error:p}}}return{created:l,message:n,error:null}},kG={class:"fct-advanced-variation-config"},BG={class:"fct-adv-var-attributes"},xG={key:0,class:"fct-adv-var-loading"},SG={key:1,class:"fct-adv-var-empty-hint"},$G={key:2,class:"fct-adv-var-empty-state"},FG={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},EG={class:"fct-adv-var-empty-state__copy"},UG=["aria-expanded","onClick","onKeydown"],IG={class:"fct-option-card-summary"},VG={class:"fct-option-card-summary-header"},DG={key:0,class:"fct-option-card-chips"},TG=["src","alt"],QG={class:"fct-option-value-chip-label"},MG=["aria-label","title","onClick"],LG={key:0,class:"fct-option-card-body"},RG={class:"fct-option-label"},OG={key:0,class:"mt-2"},PG={key:1,class:"fct-option-error"},HG={class:"fct-option-label"},NG={key:0,class:"fct-select-all-header"},KG={class:"fct-option-item"},GG={class:"fct-option-item"},zG={key:1,class:"fct-picker-inline-form-body"},jG={class:"fct-picker-inline-form-actions"},qG={key:1,class:"fct-option-field-values"},YG={class:"fct-option-empty-default"},WG={key:0,class:"fct-select-all-header"},JG={class:"fct-color-option"},XG={key:1,class:"fct-picker-inline-form-body"},ZG={class:"fct-picker-inline-form-actions"},ez={key:2,class:"fct-option-field-values"},tz={class:"fct-option-empty-default"},az={key:0,class:"fct-select-all-header"},lz={class:"fct-image-option"},sz=["src"],nz={key:1,class:"fct-picker-inline-form-body"},oz={class:"fct-picker-inline-form-actions"},iz={key:3,class:"fct-option-error"},rz={class:"fct-option-card-actions"},dz=["title"],uz={key:5,class:"fct-adv-order-save-bar"},cz={class:"fct-adv-order-save-bar__msg"},Az={class:"fct-adv-order-save-bar__actions"},pz={key:6},fz={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},mz={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},hz={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},_z={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},Co=200,pr=10,fr=100,kc=200,vz={__name:"AdvancedVariationConfig",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M([]),l=M([]),n=M(!1),i=M(!1),A=M(!1),p=M(null),m=M(!1),_=M(null),g=M(!1),y=M(null),v=M(null),k=M([]),b=M([]),w=M(""),B=oe=>JSON.stringify(oe.map(he=>({group_id:he.group_id||null,variants:[...he.variants||[]].map(Qe=>String(Qe))}))),S=()=>{b.value=l.value.map(oe=>({group_id:oe.group_id||null,title:oe.title||"",variants:Array.isArray(oe.variants)?[...oe.variants]:[]})),w.value=B(l.value)},V=G(()=>{const oe=l.value.filter(he=>he.group_id&&Array.isArray(he.variants)&&he.variants.length>0);return oe.length===0?w.value!==B([]):B(oe)!==w.value}),F=G(()=>l.value.length===0?d("All options removed. Save to delete all variations."):d("Option config changed. Save to update variants.")),$=G(()=>{if(p.value===null||!v.value)return!1;const oe=l.value[p.value];if(!oe)return!1;if(String(oe.group_id||"")!==String(v.value.group_id||"")||(oe.title||"")!==(v.value.title||""))return!0;const he=Array.isArray(oe.variants)?oe.variants:[],Qe=Array.isArray(v.value.variants)?v.value.variants:[];if(he.length!==Qe.length)return!0;const He=he.map(ht=>String(ht)),Ye=Qe.map(ht=>String(ht));return He.some((ht,st)=>ht!==Ye[st])});Te(()=>{D(),U()}),xt(()=>{je()});const U=()=>{A.value=!0,ce.get("options/attr/groups/library").then(oe=>{a.value=(oe.groups||[]).slice(0,kc),l.value.forEach(he=>O(he.group_id))}).catch(oe=>{var he;j.error(((he=oe==null?void 0:oe.data)==null?void 0:he.message)||d("Failed to load attribute groups"))}).finally(()=>{A.value=!1})},D=()=>{var Qe,He;const oe=(He=(Qe=t.product)==null?void 0:Qe.detail)==null?void 0:He.other_info,he=oe==null?void 0:oe.attribute_config;he&&Array.isArray(he)&&(l.value=he.map(Ye=>({group_id:/^\d+$/.test(String(Ye.group_id))?parseInt(Ye.group_id,10):Ye.group_id,title:Ye.title||"",variants:(Ye.variants||[]).map(ht=>parseInt(ht,10)).filter(Number.isFinite),errors:{name:"",values:""}}))),Z(),S()},T=new Set,I=M({}),L=G(()=>{if(!v.value||!v.value.group_id)return!1;const oe=parseInt(v.value.group_id,10);return!!I.value[oe]}),O=oe=>{if(!/^\d+$/.test(String(oe)))return;const he=parseInt(oe,10),Qe=a.value.find(Ye=>ye(Ye.id,he));if(!Qe||Array.isArray(Qe.terms)||T.has(he))return;T.add(he),I.value[he]=!0;const He=Math.min(Math.max(parseInt(Qe.terms_count,10)||0,50),200);ce.get("options/attr/group/"+he+"/terms",{per_page:He}).then(Ye=>{Qe.terms=Ye.terms&&Ye.terms.data||[]}).catch(Ye=>{var ht;j.error(((ht=Ye==null?void 0:Ye.data)==null?void 0:ht.message)||d("Failed to load option values"))}).finally(()=>{T.delete(he),delete I.value[he]})},Q=new Set;let H=null;const K=(oe,he)=>{const Qe=(he||"").trim();if(!Qe||!/^\d+$/.test(String(oe)))return;const He=parseInt(oe,10),Ye=a.value.find(It=>ye(It.id,He));if(!Ye)return;const ht=Array.isArray(Ye.terms)?Ye.terms.length:0,st=parseInt(Ye.terms_count,10)||0;st&&ht>=st||Array.isArray(Ye.terms)&&Ye.terms.some(It=>(It.title||"").trim().toLowerCase()===Qe.toLowerCase())||(H&&clearTimeout(H),H=setTimeout(()=>{const It=He+":"+Qe.toLowerCase();Q.has(It)||(Q.add(It),ce.get("options/attr/group/"+He+"/terms",{search:Qe,per_page:50}).then(Wt=>{const Ma=Wt.terms&&Wt.terms.data||[];if(!Ma.length)return;Array.isArray(Ye.terms)||(Ye.terms=[]);const Et=new Set(Ye.terms.map(ga=>ga.id)),oa=Ma.filter(ga=>!Et.has(ga.id));oa.length&&(Ye.terms=[...Ye.terms,...oa])}).catch(()=>{}).finally(()=>{Q.delete(It)}))},250))},W=oe=>{if(!/^\d+$/.test(String(oe)))return;const he=parseInt(oe,10),Qe=a.value.find(Ye=>ye(Ye.id,he));if(!Qe||T.has(he))return;T.add(he);const He=Math.min(Math.max(parseInt(Qe.terms_count,10)||0,50),200);ce.get("options/attr/group/"+he+"/terms",{per_page:He}).then(Ye=>{const ht=Ye.terms&&Ye.terms.data||[],st=new Map((Array.isArray(Qe.terms)?Qe.terms:[]).map(Wt=>[Wt.id,Wt]));ht.forEach(Wt=>st.set(Wt.id,Wt)),Qe.terms=Array.from(st.values());const It=Ye.terms&&Ye.terms.total;typeof It=="number"&&(Qe.terms_count=It)}).catch(()=>{}).finally(()=>{T.delete(he)})};let z=!1;const Y=()=>{z||(z=!0,ce.get("options/attr/groups/library").then(oe=>{const he=(oe.groups||[]).slice(0,kc),Qe=new Map(a.value.map(He=>[He.id,He]));he.forEach(He=>{const Ye=Qe.get(He.id);Qe.set(He.id,Ye&&Array.isArray(Ye.terms)?{...He,terms:Ye.terms}:He)}),a.value=Array.from(Qe.values())}).catch(()=>{}).finally(()=>{z=!1}))},Z=()=>{k.value=l.value.map(oe=>oe.group_id).filter(Boolean)},re=()=>{v.value=null,p.value=null,l.value=b.value.map(oe=>({group_id:oe.group_id,title:oe.title,variants:[...oe.variants],errors:{name:"",values:""}}))},q=async()=>{if(p.value!==null&&(await ee(p.value),p.value!==null))return;if(i.value=!0,!await it()){i.value=!1;return}Xt({silent:!1})},Ae=oe=>{const he=l.value.filter((Qe,He)=>He!==oe).map(Qe=>Qe.group_id).filter(Boolean);return a.value.filter(Qe=>!he.includes(Qe.id))},ie=async()=>{if(p.value!==null&&(await ee(p.value),p.value!==null))return;l.value.push({group_id:null,title:"",variants:[],errors:{name:"",values:""}});const oe=l.value.length-1;le(oe)},J=oe=>{l.value.splice(oe,1),p.value===oe?(p.value=null,v.value=null):p.value!==null&&p.value>oe&&p.value--},N=oe=>{p.value===oe?ee(oe):le(oe)},le=oe=>{const he=l.value[oe];v.value={group_id:he.group_id||null,title:he.title||"",variants:Array.isArray(he.variants)?[...he.variants]:[],errors:{name:"",values:""}},p.value=oe,O(he.group_id)},ee=async oe=>{if(!v.value||(v.value.errors.name=v.value.group_id?"":d("Option name is required."),v.value.errors.values=!v.value.variants||v.value.variants.length===0?d("Please add at least one option value."):"",v.value.errors.name||v.value.errors.values))return;const he=l.value[oe];he.group_id=v.value.group_id,he.title=v.value.title,he.variants=[...v.value.variants],he.errors={name:"",values:""},v.value=null,p.value=null},pe=M(""),de=oe=>{pe.value=oe||""},Ue=oe=>{if(oe){Y();return}pe.value=""},Ce=oe=>{const he=Ae(oe),Qe=pe.value.trim().toLowerCase();return Qe?he.filter(He=>typeof He.title=="string"&&He.title.toLowerCase().includes(Qe)):he},Se=G(()=>{const oe=pe.value.trim().toLowerCase();return oe?!a.value.some(he=>typeof he.title=="string"&&he.title.trim().toLowerCase()===oe):!0}),ge=oe=>{if(v.value){if(typeof oe=="string"&&oe!==""){const he=oe.trim().toLowerCase(),Qe=a.value.find(He=>typeof He.title=="string"&&He.title.trim().toLowerCase()===he);Qe?(v.value.group_id=Qe.id,v.value.title=Qe.title,v.value.variants=[],O(Qe.id)):(v.value.title=oe,v.value.variants=[])}else{const he=a.value.find(Qe=>ye(Qe.id,oe));he&&(v.value.title=he.title,v.value.variants=[]),O(oe)}v.value.errors&&(v.value.errors.name="")}},ke=G(()=>v.value?typeof v.value.group_id=="string"&&v.value.group_id.trim()!=="":!1),Oe=M(!1),Ee=async oe=>{var Ye;if(!oe||typeof oe.group_id!="string"||oe.group_id.trim()==="")return oe?oe.group_id:null;const he=oe.group_id.trim(),Qe=he.toLowerCase(),He=a.value.find(ht=>typeof ht.title=="string"&&ht.title.trim().toLowerCase()===Qe);if(He)return oe.group_id=He.id,oe.title=He.title,O(He.id),He.id;Oe.value=!0;try{const ht=await ce.post("options/attr/group/",{title:he,slug:he}),st=ht.data||ht.group||ht;if(!st||!st.id)return j.error(d("Failed to create attribute group")),null;a.value=[...a.value,{...st,terms:st.terms||[]}];const It=parseInt(st.id,10);return oe.group_id=It,oe.title=st.title||he,It}catch(ht){let st="";if((ht==null?void 0:ht.status_code)===422||(ht==null?void 0:ht.status)===422){j.validationErrors(ht);const It=ht!=null&&ht.data&&typeof ht.data=="object"?ht.data:{},Wt=Object.values(It)[0],Ma=Wt&&typeof Wt=="object"?Object.values(Wt)[0]:Wt;st=typeof Ma=="string"?Ma:d("Failed to create attribute group")}else st=((Ye=ht==null?void 0:ht.data)==null?void 0:Ye.message)||d("Failed to create attribute group"),j.error(st);return oe.errors&&(oe.errors.name=st),null}finally{Oe.value=!1}},fe=async()=>!v.value||!ke.value?!0:await Ee(v.value)!==null,ye=(oe,he)=>String(oe)===String(he),De=oe=>{const he=a.value.find(Qe=>ye(Qe.id,oe));return he?he.terms||[]:[]},Le=oe=>{if(!v.value||!ye(v.value.group_id,oe))return[];const he=De(oe).map(Qe=>Qe.title.toLowerCase());return(v.value.variants||[]).filter(Qe=>typeof Qe=="string"&&Qe.trim()!==""&&!he.includes(Qe.toLowerCase()))},At=G(function(){if(!v.value||!v.value.group_id)return!1;var oe=De(v.value.group_id);return oe.length?oe.every(function(he){return v.value.variants.some(function(Qe){return ye(Qe,he.id)})}):!1}),mt=G(function(){if(!v.value||!v.value.group_id)return!1;var oe=De(v.value.group_id),he=oe.filter(function(Qe){return v.value.variants.some(function(He){return ye(He,Qe.id)})}).length;return he>0&&he<oe.length}),Mt=function(oe){if(v.value){var he=String(oe),Qe=v.value.variants.findIndex(function(He){return String(He)===he});Qe===-1?v.value.variants.push(oe):v.value.variants.splice(Qe,1)}},Dt=function(oe){if(v.value){var he=De(v.value.group_id);v.value.variants=oe?he.map(function(Qe){return Qe.id}):[]}},Je=(oe,he)=>{const Qe=p.value===he&&v.value?v.value:oe;if(Qe.title)return Qe.title;const He=a.value.find(Ye=>ye(Ye.id,Qe.group_id));return He&&He.title?He.title:d("Untitled option")},pt=G(()=>{const oe=l.value.map(he=>he.group_id).filter(Boolean);return new Set(oe).size!==oe.length}),qt=G(()=>l.value.length>pr),Ct=G(()=>l.value.length>0&&l.value.length<=pr&&!pt.value&&l.value.every(oe=>oe.group_id&&oe.variants&&oe.variants.length>0&&oe.variants.every(he=>typeof he=="number"))),$t=G(()=>Ct.value?l.value.reduce((oe,he)=>oe*(he.variants?he.variants.length:0),1):0),Nt=G(()=>$t.value>Co),Kt=G(()=>{const oe=l.value.filter(he=>he.group_id&&Array.isArray(he.variants)&&he.variants.length>0);return oe.length?oe.reduce((he,Qe)=>he*Qe.variants.length,1):0}),Tt=G(()=>{const oe=l.value.filter(Qe=>Array.isArray(Qe.variants)&&Qe.variants.length>0);if(!oe.length)return 0;let he=oe.length-1;return oe.forEach(Qe=>{const He=Qe.variants.map(ht=>parseInt(ht,10)).filter(Number.isFinite),Ye=He.length?Math.max(...He):0;he+=String(Ye).length}),he}),yt=G(()=>Tt.value>fr),Xt=({silent:oe=!1}={})=>{if(n.value)return;if(l.value.length===0){n.value=!0,ce.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:[]}).then(()=>{const He=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;He&&(He.variants=[]),Z(),S(),t.productEditModel&&t.productEditModel.data&&typeof t.productEditModel.data.reloader=="function"&&t.productEditModel.data.reloader(),t.productEditModel&&typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(He=>{var Ye;j.error(((Ye=He==null?void 0:He.data)==null?void 0:Ye.message)||d("Failed to clear variations"))}).finally(()=>{n.value=!1,i.value=!1});return}if(!Ct.value){oe||j.error(d("Please select at least one term for each attribute.")),i.value=!1;return}if(Nt.value){oe||j.error(d("Too many combinations (%1$s). Maximum allowed is %2$s.",$t.value,Co)),i.value=!1;return}if(yt.value){oe||j.error(d("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",fr)),i.value=!1;return}n.value=!0;const he=l.value.map(He=>({group_id:He.group_id,title:He.title,variants:[...new Set((He.variants||[]).map(Ye=>parseInt(Ye,10)).filter(Number.isFinite))]}));let Qe=null;ce.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:he}).then(He=>{oe||(Qe=He.message||d("Variations generated successfully!")),Z(),S();const Ye=He&&Array.isArray(He.data)?He.data:null,ht=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Ye&&ht&&(ht.variants=Ye),t.productEditModel.data.reloader(),typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(He=>{var Ye;j.error(((Ye=He==null?void 0:He.data)==null?void 0:Ye.message)||d("Failed to generate variations"))}).finally(async()=>{var It,Wt;await $e();const He=(Wt=(It=t.productEditModel)==null?void 0:It.data)==null?void 0:Wt.product,Ye=()=>{const Ma=He?He.variants:null;return Array.isArray(Ma)&&Ma.some(Et=>Array.isArray(Et.attr_map)&&Et.attr_map.length>0)},ht=2500,st=Date.now();for(;!Ye()&&Date.now()-st<ht;)await new Promise(Ma=>setTimeout(Ma,50));await $e(),n.value=!1,await $e(),await $e(),i.value=!1,Qe&&(j.success(Qe),Qe=null)})},we=oe=>{v.value&&v.value.errors&&oe&&oe.length>0&&(v.value.errors.values="")},Ie=async(oe,{silent:he=!1}={})=>{var Ma;const Qe=De(oe.group_id).map(Et=>Et.title.toLowerCase()),He=(oe.variants||[]).filter(Et=>typeof Et=="string"&&!Qe.includes(Et.toLowerCase()));if(!He.length)return!0;const Ye=a.value.find(Et=>ye(Et.id,oe.group_id)),ht=Et=>{Et.length&&(Ye&&(Array.isArray(Ye.terms)||(Ye.terms=[]),Ye.terms=[...Ye.terms,...Et]),Et.forEach(oa=>{oe.variants=oe.variants.map(ga=>typeof ga=="string"&&ga.toLowerCase()===oa.title.toLowerCase()?oa.id:ga)}))},{created:st,message:It,error:Wt}=await CG((Et,oa)=>ce.post(Et,oa),oe.group_id,He);return ht(st),oe.variants=oe.variants.filter(Et=>typeof Et!="string"),Wt?((Wt==null?void 0:Wt.status_code)===422||(Wt==null?void 0:Wt.status)===422?j.validationErrors(Wt):j.error(((Ma=Wt==null?void 0:Wt.data)==null?void 0:Ma.message)||d("Failed to create option values")),!1):(he||j.success(It||d("Option values created successfully")),!0)},it=async()=>{for(const oe of l.value)if(typeof oe.group_id=="string"&&oe.group_id.trim()!==""&&!await Ee(oe)||!await Ie(oe,{silent:!0}))return!1;return!0},kt=oe=>{const he=a.value.find(Qe=>ye(Qe.id,oe));return he&&he.settings&&he.settings.type?he.settings.type:"options"},Bt=oe=>({options:d("Text"),color:d("Color"),image:d("Image")})[kt(oe)]||kt(oe),na=oe=>({options:"info",color:"warning",image:"success"})[kt(oe)]||"info",bt=oe=>{if(!oe.variants||oe.variants.length===0)return[];const he=De(oe.group_id);return oe.variants.map(Qe=>typeof Qe=="string"?{id:Qe,title:Qe}:he.find(He=>ye(He.id,Qe))).filter(Boolean)},ia=oe=>oe.title?d("Add %1$s",oe.title.toLowerCase()):d("Add more value"),ra=M(""),Yt=M(""),ka=M("");let tl=null;const ul=oe=>{tl=oe},al=M(!1),va=M({title:"",settings:{color:"",image:""}}),te=M(!1),Fe=M({}),ne=oe=>{Yt.value=oe||"",v.value&&K(v.value.group_id,oe)},_e=G(()=>{if(!v.value||!v.value.group_id)return[];const oe=De(v.value.group_id),he=Yt.value.trim().toLowerCase();return he?oe.filter(Qe=>(Qe.title||"").toLowerCase().includes(he)):oe}),We=()=>{const oe=Yt.value.trim();if(!oe||!v.value||!v.value.group_id)return;const he=kt(v.value.group_id);he!=="color"&&he!=="image"||se(oe)},ot=(oe,he)=>{if(!oe||oe.key!=="Enter"||!v.value||!v.value.group_id)return;const Qe=kt(v.value.group_id);if(Qe!=="color"&&Qe!=="image")return;const He=oe.target,Ye=(He&&typeof He.value=="string"?He.value:"").trim();!Ye||De(v.value.group_id).find(st=>typeof st.title=="string"&&st.title.trim().toLowerCase()===Ye.toLowerCase())||(oe.preventDefault(),oe.stopPropagation(),se(Ye))};let qe=null,Ze=null,gt=null,lt=null;const Vt=oe=>{qe=oe},me=oe=>{y.value=oe,g.value=!0},ve=oe=>{if(!oe||!oe.id){g.value=!1,y.value=null;return}const he=y.value;a.value=[...a.value,{...oe,terms:oe.terms||[]}],he!==null&&v.value&&p.value===he&&(v.value.group_id=parseInt(oe.id,10),v.value.title=oe.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),O(parseInt(oe.id,10))),g.value=!1,y.value=null},Ne=oe=>{ka.value=oe||"",v.value&&K(v.value.group_id,oe)},Pe=G(()=>{if(!v.value||!v.value.group_id)return[];const oe=De(v.value.group_id),he=ka.value.trim().toLowerCase();return he?oe.filter(Qe=>(Qe.title||"").toLowerCase().includes(he)):oe}),ft=G(()=>{if(!v.value||!v.value.group_id)return[];const oe=Le(v.value.group_id),he=ka.value.trim().toLowerCase();return he?oe.filter(Qe=>(Qe||"").toLowerCase().includes(he)):oe}),se=oe=>{va.value={title:(oe||"").trim(),settings:{color:"",image:""}},al.value=!0,Fe.value={},Ze||(Ze=function(he){var Qe=document.querySelector(".fct-option-values-select");if(!(Qe&&Qe.contains(he.target))){var He=document.querySelector(".el-color-picker__panel");He&&He.contains(he.target)||he.stopPropagation()}},document.addEventListener("mousedown",Ze,!0),gt=function(he){var Qe=document.querySelector(".el-color-picker__panel");Qe&&Qe.contains(he.target)&&he.stopPropagation()},document.body.addEventListener("mousedown",gt)),lt&&document.removeEventListener("keyup",lt,!0),lt=function(he){he.key==="Enter"&&(he.stopPropagation(),document.removeEventListener("keyup",lt,!0),lt=null)},document.addEventListener("keyup",lt,!0),$e(()=>{var he=document.querySelector(".fct-option-values-select");if(he){var Qe=qe||tl;if(Qe){var He=Qe.$el||Qe,Ye=He?He.getBoundingClientRect().width:0;Ye>0&&(he.style.maxWidth=Ye+"px")}}})},je=()=>{al.value=!1,va.value={title:"",settings:{color:"",image:""}},Fe.value={},Ze&&(document.removeEventListener("mousedown",Ze,!0),Ze=null),gt&&(document.body.removeEventListener("mousedown",gt),gt=null),lt&&(document.removeEventListener("keyup",lt,!0),lt=null);var oe=document.querySelector(".fct-option-values-select");oe&&(oe.style.maxWidth="")},vt=async oe=>{const he=(va.value.title||"").trim();if(!he||te.value||!v.value||!v.value.group_id)return;te.value=!0,Fe.value={};const Qe={terms:[{title:he,settings:{color:va.value.settings.color||"",image:va.value.settings.image||""}}]};try{if(ke.value&&!await fe())return;const He=await ce.post("options/attr/group/"+v.value.group_id+"/terms",Qe),Ye=Array.isArray(He.data)?He.data[0]:He.data;_.value=oe,ll(Ye),je(),Yt.value="",ka.value=""}catch(He){He&&He.status_code===422&&He.data?Fe.value=He.data:j.error(He&&He.data&&He.data.message||He&&He.message||d("Failed to add the term."))}finally{te.value=!1}},Me=oe=>{if(oe){v.value&&W(v.value.group_id);return}je(),Yt.value=""},St=oe=>{if(oe){v.value&&W(v.value.group_id);return}je(),ka.value=""},ll=oe=>{const he=_.value,Qe=l.value[he];if(Qe){const He=v.value?v.value.group_id:Qe.group_id;if(He&&/^\d+$/.test(String(He))){const Ye=parseInt(He,10),ht=a.value.find(st=>ye(st.id,Ye));if(ht&&oe&&Array.isArray(ht.terms)?ht.terms.push(oe):(ht&&delete ht.terms,O(Ye)),oe&&v.value&&Array.isArray(v.value.variants)){const st=(oe.title||"").trim().toLowerCase();v.value.variants=v.value.variants.filter(function(It){return!(typeof It=="string"&&It.trim().toLowerCase()===st)}),v.value.variants.some(function(It){return String(It)===String(oe.id)})||v.value.variants.push(oe.id)}}j.success(d("Term created successfully"))}m.value=!1,_.value=null,ra.value=""};return(oe,he)=>{var Ma;const Qe=C("router-link"),He=C("el-tag"),Ye=C("el-option"),ht=C("el-select"),st=C("el-button"),It=C("el-checkbox"),Wt=C("el-dialog");return r(),h("div",kG,[o("div",BG,[A.value?(r(),h("div",xG,[(r(!0),h(P,null,ae(l.value.length||3,Et=>(r(),h("div",{key:Et,class:"fct-adv-var-loading-card"},he[26]||(he[26]=[o("span",{class:"fct-skel-block fct-adv-var-loading-handle"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-title"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-badge"},null,-1)])))),128))])):x("",!0),l.value.length===0&&!A.value&&a.value.length===0?(r(),h("div",SG,[R(f(c(d)("No attribute groups found."))+" ",1),s(Qe,{to:{name:"attributes"}},{default:u(()=>[R(f(c(d)("Create attribute groups")),1)]),_:1})])):l.value.length===0&&!A.value?(r(),h("div",$G,[o("span",FG,[s(X,{name:"Information"})]),o("div",EG,[o("strong",null,f(c(d)("No options added yet.")),1),o("span",null,f(c(d)("Add options like Color, Size etc. to create variations.")),1)])])):x("",!0),l.value.length>0&&!A.value?(r(),E(c(cn),{key:3,modelValue:l.value,"onUpdate:modelValue":he[22]||(he[22]=Et=>l.value=Et),handle:".fct-option-drag-handle",disabled:l.value.length<=1||p.value!==null,class:"fct-option-card-list"},{default:u(()=>[(r(!0),h(P,null,ae(l.value,(Et,oa)=>(r(),h("div",{key:Et.group_id||"new-"+oa,class:"fct-option-card"},[o("div",{class:"fct-option-card-collapsed",role:"button",tabindex:"0","aria-expanded":p.value===oa,onClick:ga=>N(oa),onKeydown:ea(Ge(ga=>N(oa),["prevent"]),["enter","space"])},[l.value.length>1?(r(),h("span",{key:0,class:"fct-option-drag-handle",onClick:he[0]||(he[0]=Ge(()=>{},["stop"]))},[s(X,{name:"ReorderDotsVertical"})])):x("",!0),o("div",IG,[o("div",VG,[o("strong",null,f(Je(Et,oa)),1),Et.group_id?(r(),E(He,{key:0,size:"small",type:na(Et.group_id),class:"fct-group-type-badge"},{default:u(()=>[R(f(Bt(Et.group_id)),1)]),_:2},1032,["type"])):x("",!0)]),bt(Et).length?(r(),h("div",DG,[(r(!0),h(P,null,ae(bt(Et),ga=>(r(),h("span",{key:ga.id,class:ue(["fct-option-value-chip",`fct-option-value-chip--${kt(Et.group_id)}`])},[kt(Et.group_id)==="color"?(r(),h("span",{key:0,class:"fct-option-value-swatch",style:fa({background:ga.settings&&ga.settings.color?ga.settings.color:""})},null,4)):kt(Et.group_id)==="image"&&ga.settings&&ga.settings.image?(r(),h("img",{key:1,src:ga.settings.image,alt:ga.title,class:"fct-option-value-img"},null,8,TG)):x("",!0),o("span",QG,f(ga.title),1)],2))),128))])):x("",!0)]),p.value===oa?(r(),h("button",{key:1,type:"button",class:"fct-option-card-toggle fct-option-card-toggle--open","aria-label":c(d)("Done"),title:c(d)("Done"),onClick:Ge(ga=>ee(oa),["stop"])},he[27]||(he[27]=[o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M6 4l4 4-4 4",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,MG)):x("",!0)],40,UG),s(ma,{accordion:"",visible:p.value===oa},{default:u(()=>{var ga,et,da,za;return[p.value===oa&&v.value?(r(),h("div",LG,[o("div",{class:ue(["fct-option-field",{"fct-option-field--error":(ga=v.value.errors)==null?void 0:ga.name}])},[o("label",RG,f(c(d)("Option name")),1),s(ht,{modelValue:v.value.group_id,"onUpdate:modelValue":he[1]||(he[1]=Xe=>v.value.group_id=Xe),filterable:"","allow-create":Se.value,"default-first-option":"","filter-method":de,"popper-class":"fct-option-name-select",placeholder:c(d)("Select or type a new option"),onChange:he[2]||(he[2]=Xe=>ge(Xe)),onVisibleChange:Ue},{default:u(()=>[(r(!0),h(P,null,ae(Ce(oa),Xe=>(r(),E(Ye,{key:Xe.id,label:Xe.title,value:Xe.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","allow-create","placeholder"]),v.value.group_id?x("",!0):(r(),h("div",OG,[s(st,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:Xe=>me(oa)},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(et=v.value.errors)!=null&&et.name?(r(),h("div",PG,[s(X,{name:"AlertIcon"}),o("span",null,f(v.value.errors.name),1)])):x("",!0)],2),o("div",{class:ue(["fct-option-field",{"fct-option-field--error":(da=v.value.errors)==null?void 0:da.values}])},[o("label",HG,f(c(d)("Option values")),1),kt(v.value.group_id)==="options"?(r(),E(ht,{key:0,ref_for:!0,ref:ul,modelValue:v.value.variants,"onUpdate:modelValue":he[8]||(he[8]=Xe=>v.value.variants=Xe),multiple:"",filterable:"","allow-create":"","default-first-option":"","filter-method":Ne,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ia(v.value),disabled:!v.value.group_id,loading:L.value,"loading-text":c(d)("Loading..."),onChange:he[9]||(he[9]=Xe=>we(Xe)),onVisibleChange:St},{tag:u(()=>[s(Ar,{modelValue:v.value.variants,"onUpdate:modelValue":he[3]||(he[3]=Xe=>v.value.variants=Xe),terms:De(v.value.group_id),type:kt(v.value.group_id)},null,8,["modelValue","terms","type"])]),header:u(()=>[De(v.value.group_id).length>0?(r(),h("div",NG,[s(It,{"model-value":At.value,indeterminate:mt.value,onChange:Dt},null,8,["model-value","indeterminate"]),o("span",null,f(c(d)("Select all")),1)])):x("",!0)]),footer:u(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:he[7]||(he[7]=Ge(()=>{},["self","prevent"]))},[al.value?(r(),h("div",zG,[s(So,{term:va.value,"group-type":"options","show-remove-button":!1,"validation-errors":Fe.value,"field-key":"terms.0",onSubmit:Xe=>vt(oa),onRemove:je},null,8,["term","validation-errors","onSubmit"]),o("div",jG,[s(st,{type:"primary",size:"small",loading:te.value,disabled:!va.value.title.trim()||te.value,onClick:Xe=>vt(oa)},{default:u(()=>[R(f(c(d)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),s(st,{size:"small",onClick:je},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})])])):(r(),h(P,{key:0},[ka.value.trim()&&!De(v.value.group_id).some(function(Xe){return Xe.title.toLowerCase()===ka.value.trim().toLowerCase()})?(r(),E(st,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[6]||(he[6]=Xe=>se(ka.value))},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)('Add "%1$s" as new value',ka.value.trim())),1)]),_:1})):x("",!0)],64))],32)]),default:u(()=>[(r(!0),h(P,null,ae(Pe.value,Xe=>(r(),E(Ye,{key:Xe.id,label:Xe.title,value:Xe.id},{default:u(()=>[o("div",KG,[s(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Xe.id)}),tabindex:"-1",onClick:he[4]||(he[4]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Xe.id)},null,8,["model-value","onChange"]),o("span",null,f(Xe.title),1)])]),_:2},1032,["label","value"]))),128)),(r(!0),h(P,null,ae(ft.value,Xe=>(r(),E(Ye,{key:Xe,label:Xe,value:Xe},{default:u(()=>[o("div",GG,[s(It,{"model-value":!0,tabindex:"-1",onClick:he[5]||(he[5]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Xe)},null,8,["onChange"]),o("span",null,f(Xe),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text"])):kt(v.value.group_id)==="color"?(r(),h("div",qG,[s(ht,{ref_for:!0,ref:Vt,modelValue:v.value.variants,"onUpdate:modelValue":he[15]||(he[15]=Xe=>v.value.variants=Xe),multiple:"",filterable:"","filter-method":ne,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ia(v.value),disabled:!v.value.group_id,loading:L.value,"loading-text":c(d)("Loading..."),onKeydownCapture:Xe=>ot(Xe,oa),onVisibleChange:Me},{empty:u(()=>[o("div",YG,f(c(d)("No matching data")),1)]),header:u(()=>[De(v.value.group_id).length>0?(r(),h("div",WG,[s(It,{"model-value":At.value,indeterminate:mt.value,onChange:Dt},null,8,["model-value","indeterminate"]),o("span",null,f(c(d)("Select all")),1)])):x("",!0)]),tag:u(()=>[s(Ar,{modelValue:v.value.variants,"onUpdate:modelValue":he[10]||(he[10]=Xe=>v.value.variants=Xe),terms:De(v.value.group_id),type:"color"},null,8,["modelValue","terms"])]),footer:u(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:he[14]||(he[14]=Ge(()=>{},["self","prevent"]))},[al.value?(r(),h("div",XG,[s(So,{term:va.value,"group-type":"color","show-remove-button":!1,"validation-errors":Fe.value,"field-key":"terms.0",onSubmit:Xe=>vt(oa),onRemove:je},null,8,["term","validation-errors","onSubmit"]),o("div",ZG,[s(st,{type:"primary",size:"small",loading:te.value,disabled:!va.value.title.trim()||te.value,onClick:Xe=>vt(oa)},{default:u(()=>[R(f(c(d)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),s(st,{size:"small",onClick:je},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})])])):(r(),h(P,{key:0},[Yt.value.trim()&&!_e.value.some(function(Xe){return Xe.title.toLowerCase()===Yt.value.trim().toLowerCase()})?(r(),E(st,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[12]||(he[12]=Xe=>We())},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)('Add "%1$s" as new value',Yt.value.trim())),1)]),_:1})):(r(),E(st,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[13]||(he[13]=Xe=>se(""))},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)("Add new value")),1)]),_:1}))],64))],32)]),default:u(()=>[(r(!0),h(P,null,ae(_e.value,Xe=>(r(),E(Ye,{key:Xe.id,label:Xe.title,value:Xe.id},{default:u(()=>[o("div",JG,[s(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Xe.id)}),tabindex:"-1",onClick:he[11]||(he[11]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Xe.id)},null,8,["model-value","onChange"]),o("span",{class:"fct-color-dot",style:fa({background:Xe.settings&&Xe.settings.color?Xe.settings.color:""})},null,4),R(" "+f(Xe.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):kt(v.value.group_id)==="image"?(r(),h("div",ez,[s(ht,{ref_for:!0,ref:Vt,modelValue:v.value.variants,"onUpdate:modelValue":he[21]||(he[21]=Xe=>v.value.variants=Xe),multiple:"",filterable:"","filter-method":ne,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ia(v.value),disabled:!v.value.group_id,loading:L.value,"loading-text":c(d)("Loading..."),onKeydownCapture:Xe=>ot(Xe,oa),onVisibleChange:Me},{empty:u(()=>[o("div",tz,f(c(d)("No matching data")),1)]),header:u(()=>[De(v.value.group_id).length>0?(r(),h("div",az,[s(It,{"model-value":At.value,indeterminate:mt.value,onChange:Dt},null,8,["model-value","indeterminate"]),o("span",null,f(c(d)("Select all")),1)])):x("",!0)]),tag:u(()=>[s(Ar,{modelValue:v.value.variants,"onUpdate:modelValue":he[16]||(he[16]=Xe=>v.value.variants=Xe),terms:De(v.value.group_id),type:"image"},null,8,["modelValue","terms"])]),footer:u(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:he[20]||(he[20]=Ge(()=>{},["self","prevent"]))},[al.value?(r(),h("div",nz,[s(So,{term:va.value,"group-type":"image","show-remove-button":!1,"validation-errors":Fe.value,"field-key":"terms.0",onSubmit:Xe=>vt(oa),onRemove:je},null,8,["term","validation-errors","onSubmit"]),o("div",oz,[s(st,{type:"primary",size:"small",loading:te.value,disabled:!va.value.title.trim()||te.value,onClick:Xe=>vt(oa)},{default:u(()=>[R(f(c(d)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),s(st,{size:"small",onClick:je},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})])])):(r(),h(P,{key:0},[Yt.value.trim()&&!_e.value.some(function(Xe){return Xe.title.toLowerCase()===Yt.value.trim().toLowerCase()})?(r(),E(st,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[18]||(he[18]=Xe=>se(Yt.value))},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)('Add "%1$s" as new value',Yt.value.trim())),1)]),_:1})):(r(),E(st,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[19]||(he[19]=Xe=>se(""))},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)("Add new value")),1)]),_:1}))],64))],32)]),default:u(()=>[(r(!0),h(P,null,ae(_e.value,Xe=>(r(),E(Ye,{key:Xe.id,label:Xe.title,value:Xe.id},{default:u(()=>[o("div",lz,[s(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Xe.id)}),tabindex:"-1",onClick:he[17]||(he[17]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Xe.id)},null,8,["model-value","onChange"]),o("img",{src:Xe.settings&&Xe.settings.image?Xe.settings.image:"",alt:""},null,8,sz),R(" "+f(Xe.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):x("",!0),(za=v.value.errors)!=null&&za.values?(r(),h("div",iz,[s(X,{name:"AlertIcon"}),o("span",null,f(v.value.errors.values),1)])):x("",!0)],2),o("div",rz,[s(st,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:Xe=>J(oa)},{default:u(()=>[R(f(c(d)("Delete")),1)]),_:2},1032,["onClick"])])])):x("",!0)]}),_:2},1032,["visible"])]))),128))]),_:1},8,["modelValue","disabled"])):x("",!0),a.value.length>0?(r(),h("div",{key:4,class:ue(["fct-option-add-wrap",{"fct-option-add-wrap--empty":l.value.length===0}])},[s(st,{class:ue(["fct-option-add",{"fct-option-add--empty":l.value.length===0}]),size:"small",onClick:ie},{default:u(()=>[he[28]||(he[28]=o("svg",{fill:"currentColor",width:"14",height:"14",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},[o("path",{d:"M4.25 8a.75.75 0 0 1 .75-.75h2.25v-2.25a.75.75 0 0 1 1.5 0v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25h-2.25a.75.75 0 0 1-.75-.75"}),o("path",{"fill-rule":"evenodd",d:"M8 15a7 7 0 1 0 0-14 7 7 0 0 0 0 14m0-1.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 1 0 0 11"})],-1)),R(" "+f(l.value.length===0?c(d)("Add options like size or color"):c(d)("Add more")),1)]),_:1,__:[28]},8,["class"]),Kt.value>0?(r(),h("span",{key:0,class:"fct-adv-var-combinations-chip",title:c(d)("Variant combinations the current options will generate (max %1$s)",Co)},f(c(d)("%1$s combinations",Kt.value)),9,dz)):x("",!0)],2)):x("",!0),(V.value||$.value)&&!i.value?(r(),h("div",uz,[o("span",cz,f(F.value),1),o("div",Az,[s(st,{size:"small",disabled:n.value,onClick:re},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1},8,["disabled"]),s(st,{size:"small",type:"primary",loading:n.value,onClick:q},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading"])])])):x("",!0),Nt.value||qt.value||pt.value||yt.value?(r(),h("div",pz,[qt.value?(r(),h("div",fz,[o("span",null,f(c(d)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",pr)),1)])):pt.value?(r(),h("div",mz,[o("span",null,f(c(d)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Nt.value?(r(),h("div",hz,[o("span",null,f(c(d)("Too many combinations (%1$s). Maximum allowed is %2$s. Remove some option values.",$t.value,Co)),1)])):yt.value?(r(),h("div",_z,[o("span",null,f(c(d)("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",fr)),1)])):x("",!0)])):x("",!0)]),l.value.some(Et=>Et.group_id&&Et.variants&&Et.variants.length>0)&&e.product.variants&&e.product.variants.length>0&&((Ma=e.product.detail)==null?void 0:Ma.variation_type)==="advanced_variations"?(r(),E(hG,{key:0,product:e.product,productEditModel:e.productEditModel,attributeGroups:a.value,"external-busy":i.value||n.value||A.value},null,8,["product","productEditModel","attributeGroups","external-busy"])):x("",!0),s(Wt,{"append-to-body":!0,modelValue:m.value,"onUpdate:modelValue":he[23]||(he[23]=Et=>m.value=Et),title:c(d)("Add new attribute term"),onClose:he[24]||(he[24]=Et=>ra.value="")},{default:u(()=>[m.value&&_.value!==null&&v.value?(r(),E(wG,{key:0,"group-id":v.value.group_id,group:a.value.find(Et=>ye(Et.id,v.value.group_id)),"initial-title":ra.value,onIsTermCreatingDone:ll},null,8,["group-id","group","initial-title"])):x("",!0)]),_:1},8,["modelValue","title"]),s(Wt,{"append-to-body":!0,width:"50%",modelValue:g.value,"onUpdate:modelValue":he[25]||(he[25]=Et=>g.value=Et),title:c(d)("Add new attribute group")},{default:u(()=>[g.value?(r(),E(zm,{key:0,onWhenGroupCreateIsDone:ve})):x("",!0)]),_:1},8,["modelValue","title"])])}}},gz={class:"fct-product-pricing-wrap"},yz={class:"w-[150px] fct-select-gray"},bz={key:1,class:"fct-simple-product-actions"},wz={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var p,m;const t=e;M(!1);const a=M((m=(p=t.product)==null?void 0:p.detail)==null?void 0:m.variation_type),l=M(null),n=_=>{var w,B;const g=t.product.detail.variation_type,y=((w=t.product.variants)==null?void 0:w.length)??0;if(_==="advanced_variations"&&g!=="advanced_variations"){l.value=_,a.value=g,On.confirmDeleteWithInput("proceed",d("Switching to Advanced Variations will delete all current variations for this product and cannot be undone. You won't be able to switch back to Simple Variations.")).then(()=>{i()}).catch(()=>{l.value||(l.value=null)});return}const v=(B=t.product.variants)==null?void 0:B[0],k=v==null?void 0:v.media,b=Array.isArray(k)?k.length>0:Array.isArray(k==null?void 0:k.meta_value)&&k.meta_value.length>0;if(_==="simple"&&g==="simple_variations"&&(y>1||b)){l.value=_,a.value=g;const S=y>1?d("Switching to 'Simple' will permanently delete all variations except the first one, along with any image attached to that variation."):d("Switching to 'Simple' will permanently delete the image attached to this variation.");On.confirmDeleteWithInput("proceed",S).then(()=>{i()}).catch(()=>{l.value||(l.value=null)})}else A(_)},i=()=>{l.value&&A(l.value),l.value=null},A=_=>{const g=t.product.detail.variation_type;a.value=_;const y=t.productEditModel.updateVariationType("variation_type",_);Promise.resolve(y).catch(()=>{a.value=g})};return(_,g)=>{var k,b;const y=C("el-option"),v=C("el-select");return r(),h("div",gz,[s(xe,{class:ue(((b=(k=e.product)==null?void 0:k.detail)==null?void 0:b.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:u(()=>{var w,B;return[s(Ve,{title:_.$t("Pricing"),border_bottom:""},{action:u(()=>[o("div",yz,[e.product.detail?(r(),E(v,{key:0,size:"small",class:ue(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=S=>a.value=S),placeholder:_.$t("Select Variation"),onChange:n},{default:u(()=>[(r(!0),h(P,null,ae(_.appVars.variation_types,(S,V)=>{var F,$;return r(),E(y,{key:V,label:S,value:V,disabled:(($=(F=e.product)==null?void 0:F.detail)==null?void 0:$.variation_type)==="advanced_variations"&&V!=="advanced_variations"},null,8,["label","value","disabled"])}),128))]),_:1},8,["class","modelValue","placeholder"])):x("",!0)])]),_:1},8,["title"]),s(Be,{class:ue(((B=(w=e.product)==null?void 0:w.detail)==null?void 0:B.variation_type)==="simple_variations"?"pb-0":"")},{default:u(()=>{var S,V,F,$,U,D,T,I,L,O,Q,H,K,W,z,Y,Z;return[((V=(S=e.product)==null?void 0:S.detail)==null?void 0:V.variation_type)==="simple"?(r(),E(Nd,{key:0,class:"simple-product-pricing",index:0,modeType:"add",fieldKey:"variants.0",product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0),(($=(F=e.product)==null?void 0:F.detail)==null?void 0:$.variation_type)==="simple"&&((D=(U=e.product)==null?void 0:U.variants[0])!=null&&D.id)?(r(),h("div",bz,[s(Va,{class:"fct-copy-wrap-inline",text:String(e.product.variants[0].id),showMode:"icon_with_text",buttonText:_.$t("Copy Variation ID")},null,8,["text","buttonText"]),((I=(T=e.product)==null?void 0:T.detail)==null?void 0:I.variation_type)==="simple"&&(((L=e.product)==null?void 0:L.post_status)==="publish"||((O=e.product)==null?void 0:O.post_status)==="private")&&((H=(Q=e.product)==null?void 0:Q.variants[0])!=null&&H.id)?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline mt-3",text:((K=_.appVars)==null?void 0:K.frontend_url)+"=instant_checkout&item_id="+e.product.variants[0].id+"&quantity=1",showMode:"icon_with_text",placement:"top",buttonText:_.$t("Direct Checkout"),tooltipContent:_.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):x("",!0)])):x("",!0),((z=(W=e.product)==null?void 0:W.detail)==null?void 0:z.variation_type)==="simple_variations"?(r(),E(SH,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0),((Z=(Y=e.product)==null?void 0:Y.detail)==null?void 0:Z.variation_type)==="advanced_variations"?(r(),E(vz,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},Cz={class:"fct-sku-input-wrap"},kz={class:"fct-sku-edit-actions"},Bc={__name:"SkuInput",props:{variant:{type:Object,required:!0},productTitle:{type:String,default:""}},emits:["saved"],setup(e,{emit:t}){const a=e,l=t,n=M(a.variant.sku||""),i=M(a.variant.sku||""),A=M(!1),p=M(!1),m=M(!1),_=()=>{A.value=!0},g=()=>{i.value=n.value,A.value=!1},y=()=>{p.value=!0,ce.post("products/variants/group-bulk-update",{variant_ids:[a.variant.id],sku:i.value}).then(k=>{n.value=i.value,l("saved",i.value),A.value=!1,j.success(k.message)}).catch(k=>{var b;k.status_code=="422"?j.validationErrors(k):j.error((b=k.data)==null?void 0:b.message)}).finally(()=>{p.value=!1})},v=()=>{m.value=!0,ce.get("products/suggest-sku",{title:a.productTitle,variant_title:a.variant.variation_title||"",exclude_id:a.variant.id}).then(k=>{i.value=k.sku,A.value=!0}).catch(k=>{var b;j.error((b=k.data)==null?void 0:b.message)}).finally(()=>{m.value=!1})};return(k,b)=>{const w=C("el-input"),B=C("el-button");return r(),h("div",Cz,[s(w,{modelValue:i.value,"onUpdate:modelValue":b[0]||(b[0]=S=>i.value=S),size:"small",placeholder:c(d)("No SKU"),onInput:_,onKeydown:[b[1]||(b[1]=ea(Ge(S=>A.value&&y(),["prevent"]),["enter"])),ea(g,["escape"])]},null,8,["modelValue","placeholder"]),o("div",kz,[A.value?(r(),h(P,{key:0},[s(B,{size:"small",type:"primary",title:c(d)("Save SKU"),"aria-label":c(d)("Save SKU"),loading:p.value,onClick:y},{default:u(()=>[s(X,{name:"Check"})]),_:1},8,["title","aria-label","loading"]),s(B,{size:"small",type:"danger",title:c(d)("Discard changes"),"aria-label":c(d)("Discard changes"),onClick:g},{default:u(()=>[s(X,{name:"Close"})]),_:1},8,["title","aria-label"])],64)):(r(),E(B,{key:1,size:"small",class:"fct-sku-suggest-btn",loading:m.value,title:c(d)("Generate SKU"),onClick:v},{default:u(()=>[s(X,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},Bz={key:0,class:"fct-product-inventory-wrap"},xz={class:"fct-product-inventory-inner-wrap hide-on-mobile"},Sz={key:0,class:"fct-variant-badge fct-variant-badge--light"},$z={class:"fct-inventory-cell-text pl-5"},Fz={class:"fct-inventory-cell-text pl-5"},Ez={class:"fct-inventory-cell-text pl-5"},Uz={class:"fct-product-inventory-inner-wrap-mobile"},Iz={class:"fct-product-inventory-mobile-col"},Vz={class:"title"},Dz={class:"fct-product-inventory-mobile-col"},Tz={class:"fct-product-inventory-mobile-col"},Qz={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=Ke.get("modules_settings.stock_management.active"),n=M([]),i=M({}),A=(y,v)=>{y&&(i.value[v]=y.scrollWidth>y.clientWidth)};Te(()=>{a.product.variants.forEach(y=>{y.new_stock=y.total_stock,y.adjusted_quantity=0})});const p=y=>a.product.detail.variation_type==="simple_variations"&&y.row.manage_stock==0?"disable_inventory_row":"",m=y=>a.product.detail.variation_type==="simple_variations"&&y.manage_stock==0?"disable_inventory_row":"",_=y=>{let v=parseInt(a.product.variants[y].new_stock);a.product.variants[y].total_stock=v<0?0:v;let k=parseInt(a.product.variants[y].total_stock)-parseInt(a.product.variants[y].committed)-parseInt(a.product.variants[y].on_hold);a.product.variants[y].available=k<0?0:k,a.product.variants[y].adjusted_quantity=0,a.product.variants[y].new_stock=a.product.variants[y].total_stock,ce.put(`products/${a.product.ID}/update-inventory/${a.product.variants[y].id}`,{total_stock:a.product.variants[y].total_stock,available:a.product.variants[y].available}).then(b=>{j.success(b.message)}).catch(b=>{var w;b.status_code=="422"?j.validationErrors(b):j.error((w=b.data)==null?void 0:w.message)})},g=y=>{ce.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(v=>{j.success(v.message),a.product.variants.forEach(k=>{k.manage_stock=y})}).catch(v=>{var k;v.status_code=="422"?j.validationErrors(v):j.error((k=v.data)==null?void 0:k.message)})};return(y,v)=>{const k=C("el-switch"),b=C("el-tooltip"),w=C("el-table-column"),B=C("el-input"),S=C("el-table");return c(l)==="yes"?(r(),h("div",Bz,[s(xe,{class:"overflow-hidden"},{default:u(()=>{var V,F;return[s(Ve,{class:ue(((V=e.product.detail)==null?void 0:V.manage_stock.toString())==="0"?"pb-5":"")},{action:u(()=>{var $;return[($=e.product.detail)!=null&&$.manage_stock?(r(),E(k,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=U=>e.product.detail.manage_stock=U),onChange:g,"active-value":"1","inactive-value":"0","active-text":c(d)("Inventory Management")},null,8,["modelValue","active-text"])):x("",!0)]}),_:1},8,["class"]),s(ma,{visible:((F=e.product.detail)==null?void 0:F.manage_stock.toString())==="1",accordion:""},{default:u(()=>[s(Be,{class:"px-0 pb-0"},{default:u(()=>[o("div",xz,[s(S,{data:e.product.variants,"row-class-name":p},{default:u(()=>[s(w,{label:c(d)("Title"),width:"180"},{default:u($=>{var U,D;return[o("div",{class:ue(["relative",{"fct-inventory-title-cell--has-badge":((U=$.row.other_info)==null?void 0:U.payment_type)==="subscription"}])},[s(b,{content:$.row.variation_title,placement:"top","show-after":300,disabled:!i.value[`title_${$.$index}`]},{default:u(()=>[o("span",{class:"fct-inventory-cell-text truncate block",ref:T=>A(T,`title_${$.$index}`)},f($.row.variation_title||"--"),513)]),_:2},1032,["content","disabled"]),((D=$.row.other_info)==null?void 0:D.payment_type)==="subscription"?(r(),h("span",Sz,f($.row.other_info.repeat_interval),1)):x("",!0)],2)]}),_:1},8,["label"]),s(w,{label:c(d)("SKU"),width:"220"},{default:u($=>[s(Bc,{variant:$.row,"product-title":e.product.post_title,onSaved:U=>$.row.sku=U},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),s(w,{label:c(d)("Total Stock"),width:"120"},{default:u($=>[o("div",null,[s(B,{modelValue:$.row.total_stock,"onUpdate:modelValue":U=>$.row.total_stock=U,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:U=>{var D;return(D=n.value[$.$index])==null?void 0:D.toggle()}},{append:u(()=>[s(Xr,{ref:U=>n.value[$.$index]=U,variant:$.row,"field-key":$.$index,"product-edit-model":e.productEditModel,onSave:U=>_($.$index),onClick:v[1]||(v[1]=Ge(()=>{},["stop"]))},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue","onClick"])])]),_:1},8,["label"]),s(w,{label:c(d)("Available"),width:"100"},{default:u($=>[o("span",$z,f(c(d)($.row.available)),1)]),_:1},8,["label"]),s(w,{label:c(d)("On hold"),width:"100"},{default:u($=>[o("span",Fz,f(c(d)($.row.on_hold)),1)]),_:1},8,["label"]),s(w,{label:c(d)("Delivered"),width:"100"},{default:u($=>[o("span",Ez,f(c(d)($.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",Uz,[(r(!0),h(P,null,ae(e.product.variants,($,U)=>(r(),h("div",{key:U,class:ue(["fct-product-inventory-mobile-row",m($)])},[o("div",Iz,[o("div",Vz,f($.variation_title||"--"),1),s(Bc,{variant:$,"product-title":e.product.post_title,class:"mt-1 mb-2",onSaved:D=>$.sku=D},null,8,["variant","product-title","onSaved"])]),o("div",Dz,[s(B,{modelValue:$.total_stock,"onUpdate:modelValue":D=>$.total_stock=D,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:u(()=>[s(Xr,{variant:$,"field-key":U,"product-edit-model":e.productEditModel,onSave:D=>_(U)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",Tz,[o("ul",null,[o("li",null,[o("span",null,f(c(d)("Available"))+":",1),R(" "+f($.available.toString()),1)]),o("li",null,[o("span",null,f(c(d)("On Hold"))+":",1),R(" "+f($.on_hold.toString()),1)]),o("li",null,[o("span",null,f(c(d)("Delivered"))+":",1),R(" "+f($.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):x("",!0)}}},Mz={class:"el-form el-form--default el-form--label-top"},Ff={__name:"SingleFileForm",props:{product:Object,file:Object,index:Number,productDownloadableModel:Object,singleMode:{type:Boolean,default:!1},isEditing:{type:Boolean,default:!1}},setup(e){const t=e,a=G(()=>Zo(t.product));return Hs(()=>{var l;if(t.file&&typeof t.file.product_variation_id=="string")try{t.file.product_variation_id=JSON.parse(t.file.product_variation_id),t.file.product_variation_id=t.file.product_variation_id.map(n=>parseInt(n))}catch{}if(t.file&&Array.isArray(t.file.product_variation_id)&&((l=t.product)!=null&&l.variants)){const n=Array.isArray(t.product.variants)?t.product.variants:[],i=new Set(n.map(p=>parseInt(p.id,10))),A=t.file.product_variation_id.filter(p=>i.has(parseInt(p,10)));A.length!==t.file.product_variation_id.length&&(t.file.product_variation_id=A)}}),(l,n)=>{const i=C("el-option"),A=C("el-select"),p=C("el-form-item"),m=C("el-input");return r(),h("div",Mz,[s(p,{label:l.$t("Choose variant")},{default:u(()=>[s(A,{class:"",size:"small",modelValue:e.file.product_variation_id,"onUpdate:modelValue":n[0]||(n[0]=_=>e.file.product_variation_id=_),multiple:"",id:`downloadable_files.${e.index}.product_variation_id`,placeholder:l.$t("Keep empty for all"),"popper-class":"fct-choose-variant-popover","collapse-tags":"","collapse-tags-tooltip":""},{default:u(()=>[(r(!0),h(P,null,ae(e.productDownloadableModel.generateVariantOptions(e.product),_=>(r(),E(i,{key:_.id,label:c(Kn)(_,a.value),value:_.id},{default:u(()=>[s(ei,{variant:_,"group-order":a.value},null,8,["variant","group-order"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),s(zt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.product_variation_id`},null,8,["validation-errors","field-key"])]),_:1},8,["label"]),e.isEditing||e.productDownloadableModel.insertableFiles.length===1?(r(),E(p,{key:0},{default:u(()=>[s(SA,{isMultiple:!e.singleMode,onOnFileSelected:n[1]||(n[1]=_=>{const g=e.index,y=_;y.forEach((v,k)=>{e.isEditing?(y[k].serial=g+1,y[k].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[g].settings.download_limit,y[k].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[g].settings.download_expiry,y.length>1?(y[k].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file=y[k]):(y[k].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file.file_name=y[k].file_name,e.file.file_path=y[k].file_path,e.file.file_size=y[k].file_size,e.file.file_url=y[k].file_url,e.file.title=y[k].title,e.file.type=y[k].type,e.file.driver=y[k].driver,e.file.settings=y[k].settings)):(y[k].serial=g+1,y[k].settings.download_limit=e.productDownloadableModel.insertableFiles[g].settings.download_limit,y[k].settings.download_expiry=e.productDownloadableModel.insertableFiles[g].settings.download_expiry,y.length>1?(y[k].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g+k]=y[k]):(y[k].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g]=y[k]))})})},null,8,["isMultiple"]),s(zt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.file_url`},null,8,["validation-errors","field-key"])]),_:1})):x("",!0),e.file.title?(r(),E(p,{key:1,label:l.$t("File Title")},{default:u(()=>[o("p",null,f(e.file.title),1),x("",!0),s(zt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.title`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])):x("",!0),e.file.driver?(r(),E(p,{key:2},{default:u(()=>[o("p",null,f(c(d)("Driver: %s",e.file.driver)),1)]),_:1})):x("",!0)])}}},Lz={key:0,class:"text-right"},Rz={key:1,class:"px-6 py-3"},Oz={class:"fct-product-download-inner-wrap flex flex-col gap-4"},Pz={class:"fct-product-download-form-box"},Hz={key:1},Nz={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=G(()=>window.innerWidth<=768?"90%":"34%");return(a,l)=>{const n=C("el-button"),i=C("el-drawer");return r(),h(P,null,[o("div",{class:ue(["add-download-btn",e.productDownloadableModel.hasVariationOption(e.product)?"px-6 py-3 border border-solid border-gray-divider border-x-0 border-b-0 dark:border-dark-400":""])},[e.productDownloadableModel.hasVariationOption(e.product)?(r(),h("div",Lz,[s(n,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(a.$t("Add")),1)]),_:1})])):(r(),h("div",Rz,f(a.$t("No pricing added yet")),1))],2),s(i,{modelValue:e.productDownloadableModel.data.addModal.isModalOpen,"onUpdate:modelValue":l[4]||(l[4]=A=>e.productDownloadableModel.data.addModal.isModalOpen=A),size:t.value,onClose:l[5]||(l[5]=()=>{e.productDownloadableModel.clearInsertableFile()}),onOpen:l[6]||(l[6]=()=>{e.productDownloadableModel.addDummyInsertableFile()})},{header:u(()=>[s(Ot,{title:a.$t("Add Downloadable Asset(s)"),content:a.$t("Attach the WordPress-supported digital files that customers will receive after purchasing this product. If this downloadable file is only for a specific product variation (e.g., 'eBook Version' or 'Audiobook Version'), please select that variant. Otherwise, you may leave the 'Choose variant' field empty to make the file available for all variants of this product. Please note that any additional files added after any sell will be accessible to both existing and new orders."),placement:"bottom"},null,8,["title","content"])]),footer:u(()=>[o("div",null,[s(n,{onClick:l[2]||(l[2]=A=>e.productDownloadableModel.data.addModal.isModalOpen=!1)},{default:u(()=>[R(f(a.$t("Cancel")),1)]),_:1}),s(n,{type:"primary",onClick:l[3]||(l[3]=()=>{e.productDownloadableModel.attachInsertableFiles(e.product.ID)}),loading:e.productDownloadableModel.data.saving},{default:u(()=>[R(f(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:u(()=>[o("div",Oz,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(P,{key:0},ae(e.productDownloadableModel.insertableFiles,(A,p)=>(r(),h("div",Pz,[e.productDownloadableModel.insertableFiles.length>1?(r(),E(n,{key:0,onClick:m=>e.productDownloadableModel.deleteInsertableFile(p),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),s(Ff,{product:e.product,file:A,index:p,productDownloadableModel:e.productDownloadableModel},null,8,["product","file","index","productDownloadableModel"])]))),256)):x("",!0),e.productDownloadableModel.insertableFiles.length>1?(r(),h("div",Hz,[s(SA,{uploadBtnText:c(d)("Add More Files"),onOnFileSelected:l[1]||(l[1]=A=>{const p=e.productDownloadableModel.insertableFiles.length-1,m=A;m.value.forEach((_,g)=>{m.value[g].serial=p+1,m.value[g].settings.download_limit=e.productDownloadableModel.insertableFiles[p].settings.download_limit,m.value[g].settings.download_expiry=e.productDownloadableModel.insertableFiles[p].settings.download_expiry,m.value[g].product_variation_id=e.productDownloadableModel.insertableFiles[p].product_variation_id,e.productDownloadableModel.insertableFiles.push(m.value[g])})})},null,8,["uploadBtnText"])])):x("",!0),(r(!0),h(P,null,ae(e.product.variants,(A,p)=>(r(),h("div",{key:p},[s(zt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${p}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},Kz={class:"fct-product-download-form-wrap"},Gz={class:"fct-product-download-form-box"},zz={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=G(()=>window.innerWidth<=768?"90%":"40%"),l=M({...t.productDownloadable}),n=t.productDownloadableModel.data.editModal.states;return Hs(()=>{n[t.index]={},n[t.index].visible=!1}),(i,A)=>{const p=C("el-button"),m=C("el-drawer");return r(),h(P,null,[s(m,{"append-to-body":"",modelValue:c(n)[e.index].visible,"onUpdate:modelValue":A[1]||(A[1]=_=>c(n)[e.index].visible=_),size:a.value,title:c(d)("Edit Downloadable Asset"),onClose:A[2]||(A[2]=()=>{e.productDownloadableModel.closeEditModal(e.index)})},{footer:u(()=>[s(p,{type:"primary",loading:e.productDownloadableModel.saving,onClick:A[0]||(A[0]=()=>{e.productDownloadableModel.updateDownloadableFile()})},{default:u(()=>[R(f(c(d)("Update")),1)]),_:1},8,["loading"])]),default:u(()=>[o("div",Kz,[o("div",Gz,[s(Ff,{product:e.product,file:l.value,index:e.index,productDownloadableModel:e.productDownloadableModel,singleMode:!0,"is-editing":""},null,8,["product","file","index","productDownloadableModel"])])])]),_:1},8,["modelValue","size","title"]),o("div",{class:"el-dropdown-menu__item w-full",onClick:A[3]||(A[3]=Ge(()=>{c(n)[e.index].visible=!0,e.productDownloadableModel.openEditModal(e.index,l.value)},["prevent"]))},[s(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)])],64)}}},jz={class:"fct-product-download-wrap"},qz={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},Yz={class:"fct-media-content-list"},Wz={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},Jz={class:"product-details"},Xz={class:"product-details-content-row"},Zz={class:"product-details-content-first"},ej={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},tj={key:0,class:"font-normal text-system-mid"},aj={class:"product-variation-title inline-flex"},lj={key:1,class:"product-variation-title"},sj={class:"product-details-content-second"},nj={class:"more-btn"},oj={__name:"ProductDownload",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=e,a=function(n){ce.get(`products/getDownloadableUrl/${n.id}`).then(i=>{ns.copy(i.url)}).catch(i=>{j.error({title:d("Error"),message:d("Failed to copy file URL")})})},l=n=>{n.action==="copy-download-link"?a(n.data):n.action==="delete"&&t.productDownloadableModel.deleteDownloadableFile(n.data.id,n.idx)};return(n,i)=>{const A=C("el-switch"),p=C("el-popover"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",jz,[s(xe,null,{default:u(()=>{var y;return[s(Ve,{class:"pb-5"},{action:u(()=>[e.product.detail?(r(),E(A,{key:0,modelValue:e.product.detail.manage_downloadable,"onUpdate:modelValue":i[0]||(i[0]=v=>e.product.detail.manage_downloadable=v),"active-value":"1","inactive-value":"0","active-text":n.$t("Downloadable Asset(s)"),onChange:i[1]||(i[1]=v=>e.productEditModel.onChangeInputField("manage_downloadable",v))},null,8,["modelValue","active-text"])):x("",!0)]),_:1}),s(ma,{visible:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:u(()=>[s(Be,{class:"p-0"},{default:u(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),h("div",qz,[o("div",Yz,[(r(!0),h(P,null,ae(e.productDownloadableModel.downloadableFiles,(v,k)=>(r(),h("div",{class:"fct-media-content-list-item",key:k},[o("div",Wz,f(v.type),1),o("div",Jz,[o("div",Xz,[o("div",Zz,[o("div",ej,[R(f(v.title)+" ",1),v.driver!=="local"?(r(),h("span",tj," - "+f(v.driver),1)):x("",!0)]),e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product).length?(r(),E(p,{key:0,placement:"top",trigger:"hover",width:200},{reference:u(()=>[o("div",aj," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:u(()=>[(r(!0),h(P,null,ae(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(b,w)=>(r(),h("div",{style:{"margin-top":"4px"},key:w},f(b),1))),128))]),_:2},1024)):(r(),h("div",lj," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",sj,[s(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:l},{dropdown:u(()=>[s(_,null,{default:u(()=>[s(m,{class:"item-link"},{default:u(()=>[s(zz,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:k},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),s(m,{command:{action:"copy-download-link",data:v}},{default:u(()=>[s(X,{name:"Copy"}),R(" "+f(c(d)("Copy Download Link")),1)]),_:2},1032,["command"]),s(m,{command:{action:"delete",data:v,idx:k},class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",nj,[s(X,{name:"More"})])]),_:2},1024)])])])]))),128))])])):x("",!0),s(Nz,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},ij={class:"fct-product-status-wrap"},rj={class:"fct-admin-summary-item-list"},dj={class:"fct-admin-summary-item"},uj={class:"fct-admin-summary-item-title"},cj={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},Aj={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},pj={key:0,style:{"margin-top":"20px"}},fj={class:"title"},mj={key:1},hj={class:"text-sm text-gray-500 mt-4"},_j={class:"capitalize"},vj={key:1},gj={class:"fct-admin-summary-item"},yj={class:"fct-admin-summary-item-title flex items-center gap-1"},bj=["href"],wj={class:"fct-product-url-slug-container"},Cj={class:"filter-popover-item fct-admin-summary-popover-item"},kj={class:"filter-popover-title"},Bj={class:"filter-popover-input-group"},xj={class:"fct-product-url-label"},Sj=["href"],$j={class:"fct-product-url-slug"},Fj={key:0,class:"fct-admin-summary-item"},Ej={class:"fct-admin-summary-item-title"},Uj={class:"fct-admin-summary-item-select"},Ij={key:1,class:"fct-admin-summary-item"},Vj={class:"fct-admin-summary-item-title"},Dj={key:0,class:"fct-admin-summary-item-select"},Tj={key:0,class:"mt-4 pt-4 space-y-2"},xc={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=Ke.get("modules_settings.reviews.active")==="yes",a=e,l=M(""),n=M(""),i=M(""),A=M(!1),p=k=>Kn(k,Zo(a.product))||k.variation_title;be(()=>{var k,b,w;return[(b=(k=a.product)==null?void 0:k.detail)==null?void 0:b.default_variation_id,(w=a.product)==null?void 0:w.variants]},([k,b])=>{var S;if(!k||!((S=a.product)!=null&&S.detail))return;(Array.isArray(b)?b:[]).some(V=>String(V.id)===String(k))||(a.product.detail.default_variation_id="",a.productEditModel&&typeof a.productEditModel.onChangeInputField=="function"&&a.productEditModel.onChangeInputField("default_variation_id",""))},{immediate:!0,deep:!1});const m=d("Customize the product's URL ending. Remember, this will affect SEO and readability. The URL will be activated when publish. Check Google's %s Structure Best Practices.",'<a href="https://developers.google.com/search/docs/crawling-indexing/url-structure">'+d("URL")+"</a>"),_=()=>a.product.variants.filter(b=>b.created_at).length>0,g=k=>{a.productEditModel.onChangeInputField("post_status",k),(k==="draft"||k==="publish")&&(A.value=!1)},y=()=>d("Status controls the product's visibility on the public page and its purchasability. 'Publish' indicates that it is live and can be purchased, 'Draft' signifies that it is in private editing, and 'Schedule' means it will be publish on a specified date. 'Private' means, Only visible to adminstrators but can be purchased via direct purchase link. The status can only be changed once pricing is set."),v={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no",reviews_enabled:"yes"};return be(()=>a.product.detail,k=>{if(k)if(!k.other_info||Object.keys(k.other_info).length===0)a.product.detail.other_info={...v};else for(const[b,w]of Object.entries(v))b in k.other_info||(k.other_info[b]=w)},{immediate:!0}),Te(()=>{l.value=window.location.protocol,n.value=window.location.hostname,i.value=`${l.value}//${n.value}`}),(k,b)=>{const w=C("el-radio"),B=C("el-radio-group"),S=C("el-date-picker"),V=C("el-button"),F=C("el-popover"),$=C("el-input"),U=C("el-option"),D=C("el-select"),T=C("el-checkbox");return r(),h("div",ij,[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>{var I,L;return[o("ul",rj,[o("li",dj,[o("span",uj,[s(Ot,{title:c(d)("Status"),content:y()},null,8,["title","content"])]),o("div",cj,[_()?(r(),E(F,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:u(()=>[_()?(r(),E(V,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:u(()=>[o("span",_j,f(e.product.post_status==="future"?c(d)("Scheduled"):e.product.post_status),1),s(X,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",vj,f(c(Aa).headline(e.product.post_status)),1))]),default:u(()=>[o("div",Aj,[s(B,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":b[0]||(b[0]=O=>e.product.post_status=O),onChange:g},{default:u(()=>[s(w,{value:"draft"},{default:u(()=>[R(f(c(d)("Draft")),1)]),_:1}),s(w,{value:"future"},{default:u(()=>[R(f(c(d)("Scheduled")),1)]),_:1}),s(w,{value:"private"},{default:u(()=>[R(f(c(d)("Private (Invisible except Admin)")),1)]),_:1}),s(w,{value:"publish"},{default:u(()=>[R(f(c(d)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",pj,[o("h3",fj,f(c(d)("Scheduled Date")),1),s(S,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":b[1]||(b[1]=O=>e.product.post_date=O),type:"datetime",placeholder:c(d)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:b[2]||(b[2]=O=>{e.productEditModel.onChangeInputField("post_date",O)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",mj,[o("p",hj,f(c(d)("Note: Private products are only visible to administrators but can be purchased via direct purchase link.")),1)])):x("",!0)])]),_:1})):x("",!0)])]),o("li",gj,[o("span",yj,[R(f(c(d)("URL Slug"))+" ",1),o("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[s(X,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,bj)]),o("div",wj,[s(F,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:u(()=>[s(V,{type:"primary",class:"is-tertiary el-button--x-small"},{default:u(()=>[o("span",null,f(e.product.post_name),1),s(X,{name:"ChevronUpDown"})]),_:1})]),default:u(()=>[o("div",Cj,[o("h3",kj,f(c(d)("URL")),1),o("div",Bj,[s(Ot,{title:c(d)("Permalink"),content:c(m),hideAfter:300},null,8,["title","content"]),s($,{placeholder:c(d)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":b[3]||(b[3]=O=>e.product.post_name=O),onInput:b[4]||(b[4]=O=>{e.productEditModel.onChangeInputField("post_name",O)})},null,8,["placeholder","modelValue"])]),o("div",xj,f(c(d)("View Product")),1),o("a",{class:"fct-product-url-slug-wrap",target:"_blank",href:e.product.view_url,rel:"external noreferrer noopener"},[o("span",$j,f(e.product.view_url),1),s(Va,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:c(d)("Copy Link")},null,8,["text","tooltipText"])],8,Sj)])]),_:1})])]),((I=e.product.detail)==null?void 0:I.variation_type)==="simple_variations"||((L=e.product.detail)==null?void 0:L.variation_type)==="advanced_variations"?(r(),h("li",Fj,[o("span",Ej,[s(Ot,{title:c(d)("Default Variant"),content:c(d)("Select the default variant that users will see pre-selected on the product page.")},null,8,["title","content"])]),o("div",Uj,[s(D,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":b[5]||(b[5]=O=>e.product.detail.default_variation_id=O),placeholder:c(d)("Select Default Variant"),onChange:b[6]||(b[6]=O=>{e.productEditModel.onChangeInputField("default_variation_id",O)}),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(e.product.variants,O=>(r(),E(U,{key:O.id,label:p(O),value:O.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):x("",!0),e.product.detail&&e.product.detail.variation_type==="simple_variations"?(r(),h("li",Ij,[o("span",Vj,[s(Ot,{title:c(d)("Pricing Table Layout"),content:c(d)("Organize product variations by repeat interval (Monthly, Yearly) or payment term (One time, Subscription).")},null,8,["title","content"])]),e.product.detail?(r(),h("div",Dj,[s(D,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":b[7]||(b[7]=O=>e.product.detail.other_info.group_pricing_by=O),placeholder:c(d)("Pricing Table Layout"),onChange:b[8]||(b[8]=O=>{e.productEditModel.onChangeInputField("group_pricing_by",O)})},{default:u(()=>[s(U,{label:c(d)("Payment Term"),value:"payment_type"},null,8,["label"]),s(U,{label:c(d)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),s(U,{label:c(d)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):x("",!0)])):x("",!0)]),e.product.detail?(r(),h("div",Tj,[s(T,{onChange:b[9]||(b[9]=O=>{e.productEditModel.onChangeInputField("sold_individually",O)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":b[10]||(b[10]=O=>e.product.detail.other_info.sold_individually=O),"true-value":"yes","false-value":"no"},{default:u(()=>[R(f(c(d)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"]),t?(r(),E(T,{key:0,onChange:b[11]||(b[11]=O=>{e.productEditModel.onChangeInputField("reviews_enabled",O)}),"model-value":e.product.detail.other_info.reviews_enabled,"true-value":"no","false-value":"yes"},{default:u(()=>[R(f(c(d)("Disable reviews for this product")),1)]),_:1},8,["model-value"])):x("",!0)])):x("",!0)]}),_:1})]),_:1})])}}},Qj={class:"fct-product-media-wrap"},Mj={class:"fct-admin-summary-item"},Lj={class:"fct-gallery-tab-label"},Sc={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=Cn([]),l=Cn({}),n=M({}),i=M({}),A=G(()=>ih(i.value)),p=($,U)=>{i.value=fh(i.value,$,U)},m=()=>({product:t.product,productEditModel:t.productEditModel}),_=Cn([]);let g=0;const y=()=>{var D;const $=++g,U=Zd((D=window.fluent_cart_admin)==null?void 0:D.hooks,m());rh(U,t.product).then(T=>{$===g&&(_.value=T)})};Te(y),be(()=>{var $,U;return(U=($=t.product)==null?void 0:$.detail)==null?void 0:U.other_info},y,{deep:!0});const v=Cn([]);let k=0;const b=M(!1),w=()=>{const $=++k;dh(a.value,n.value).then(U=>{$===k&&(v.value=U,b.value=!1)})};be(n,w,{deep:!0});const B=()=>{var D;const $=Zd((D=window.fluent_cart_admin)==null?void 0:D.hooks,m()),U={};$.forEach(T=>{U[T.name]=Bs(T.component)}),a.value=$,l.value=U,n.value=ph($,t.product),i.value={},b.value=$.some(T=>T.items),w()},S=$=>{n.value=ch(a.value,n.value,$)},V=$=>{n.value=uh(a.value,n.value,$)},F=()=>{Ah(a.value,n.value,m()),y()};return($,U)=>{const D=C("el-tag"),T=C("el-tab-pane");return r(),h("div",Qj,[s(xe,null,{default:u(()=>[s(Ve,{title:$.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[o("div",Mj,[s(wl,{modelValue:e.product.gallery,"onUpdate:modelValue":U[0]||(U[0]=I=>e.product.gallery=I),compact:!1,title:$.$t("Product Gallery"),onChange:U[1]||(U[1]=I=>e.productEditModel.updateMedia("gallery",I)),busy:A.value,"extra-previews":_.value,"extra-items":v.value,"extra-items-loading":b.value,onOpen:B,onSave:F,onExtraReorder:S,onExtraRemove:V},sa({_:2},[a.value.length?{name:"extra-tabs",fn:u(()=>[(r(!0),h(P,null,ae(a.value,I=>(r(),E(T,{key:I.name,name:I.name,lazy:"",class:ue(`fct-gallery-tab-pane fct-gallery-tab-pane--${I.name}`)},{label:u(()=>[o("span",Lj,f(I.label),1),c(Xd)(I,n.value[I.name])?(r(),E(D,{key:0,size:"small",round:"",class:"fct-gallery-tab-label__badge"},{default:u(()=>[R(f(c(Xd)(I,n.value[I.name])),1)]),_:2},1024)):x("",!0)]),default:u(()=>[(r(),E(bl(l.value[I.name]),ba({modelValue:n.value[I.name],"onUpdate:modelValue":L=>n.value[I.name]=L},{ref_for:!0},I.props,{onBusy:L=>p(I.name,L)}),null,16,["modelValue","onUpdate:modelValue","onBusy"]))]),_:2},1032,["name","class"]))),128))]),key:"0"}:void 0]),1032,["modelValue","title","busy","extra-previews","extra-items","extra-items-loading"])])]),_:1})]),_:1})])}}},Rj={class:"fct-term-input-item"},Oj={class:"el-tag__content"},Pj=["innerHTML"],Hj=["innerHTML"],Nj={class:"pt-1.5 text-right"},Kj={class:"relative w-3 h-3"},Gj={class:"fct-term-add-input-wrap"},zj={__name:"TermInput",props:{modelValue:Array,taxonomy:Object,product_id:Number},emits:["update:modelValue","onChanged"],setup(e,{emit:t}){aa().ctx;const a=e,l=t,n=M([]),i=M(!1),A=M(),p=M(""),m=M([]),_=M(""),g=M(!1);Te(()=>{n.value=a.modelValue,m.value=a.taxonomy.terms,be(()=>a.taxonomy.terms,(U,D)=>{m.value=U}),be(()=>a.modelValue,(U,D)=>{g.value=!0,n.value=U})});const y=U=>{U.stopPropagation(),U.preventDefault(),B()},v=()=>{g.value&&ce.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:n.value}).then(U=>{j.success(U.message),l("update:modelValue",n.value)}).catch(U=>{var D;U.status_code=="422"?j.validationErrors(U):j.error((D=U.data)==null?void 0:D.message)}).finally(()=>{g.value=!1})},k=gd.debounce(U=>{w(U)},1200),b=()=>{l("update:modelValue",n.value)},w=U=>{g.value=!1,ce.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:U}).then(D=>{un(D.message),l("update:modelValue",n.value)}).catch(D=>{var T;D.status_code=="422"?j.validationErrors(D):j.error((T=D.data)==null?void 0:T.message)}).finally(()=>{g.value=!1})};[...n.value];const B=()=>{g.value=!0,ce.post("products/add-product-terms",{term:{name:p.value,taxonomy:a.taxonomy.name,parent:_.value}}).then(U=>{i.value=!1,p.value="",U.term_ids.forEach(function(D,T){m.value.push({value:D,label:U.names[T]}),n.value.push(D)}),v()}).catch(U=>{})},S=()=>{i.value=!i.value,i.value&&$e(()=>{A.value.focus()})},V={categories:"Category",types:"Type"};G(()=>{let U=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(V).forEach(D=>{U.toLowerCase().includes(D)&&(U=U.replace(new RegExp(D,"i"),V[D]))}),U});const F=U=>{const D=n.value.indexOf(U);D>-1&&n.value.splice(D,1),g.value=!1,k(U)},$=U=>{const D=T=>{for(const I of T){if(I.value==U)return I.label;if(I.children&&I.children.length>0){const L=D(I.children);if(L)return L}}return null};return D(m.value)};return(U,D)=>{const T=C("el-tag"),I=C("el-tree-select"),L=C("el-button"),O=C("el-input");return r(),h("div",Rj,[s(I,{modelValue:n.value,"onUpdate:modelValue":D[0]||(D[0]=Q=>n.value=Q),data:m.value,multiple:"","render-after-expand":!1,"show-checkbox":"","check-strictly":"","check-on-click-node":"",onCheck:D[1]||(D[1]=()=>{g.value=!0}),onBlur:v,onChange:b,onRemoveTag:D[2]||(D[2]=Q=>{g.value=!1,c(k)(Q)})},{tag:u(()=>[(r(!0),h(P,null,ae(n.value,(Q,H)=>(r(),E(T,{key:H,closable:"",onClose:K=>F(Q)},{default:u(()=>[o("span",Oj,[o("span",{class:"el-select__tags-text",innerHTML:$(Q)},null,8,Pj)])]),_:2},1032,["onClose"]))),128))]),default:u(({data:Q})=>[o("span",{innerHTML:Q.label},null,8,Hj)]),_:1},8,["modelValue","data"]),o("div",Nj,[s(L,{text:"",onClick:S,size:"small"},{default:u(()=>[o("span",Kj,[s(ma,{visible:i.value,fade:""},{default:u(()=>[s(X,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),s(ma,{visible:!i.value,fade:""},{default:u(()=>[s(X,{name:"Plus",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"])]),R(" "+f(c(d)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),s(ma,{visible:i.value,accordion:""},{default:u(()=>[o("div",Gj,[s(O,{modelValue:p.value,"onUpdate:modelValue":D[3]||(D[3]=Q=>p.value=Q),ref_key:"inputRef",ref:A,onKeydown:ea(y,["enter"])},null,8,["modelValue"]),s(L,{type:"info",plain:"",onClick:B,class:"el-button--x-small"},{default:u(()=>[R(f(c(d)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},jj={class:"fct-product-simple-wrap"},qj={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",jj,[s(xe,null,{default:u(()=>[s(Ve,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[(r(!0),h(P,null,ae(e.product.taxonomies,l=>(r(),h("div",{class:"fct-admin-summary-item",key:l.id},[o("h4",null,f(l.labels.name),1),s(zj,{product_id:e.product.ID,taxonomy:l,modelValue:e.product.product_terms[l.name],"onUpdate:modelValue":n=>e.product.product_terms[l.name]=n},null,8,["product_id","taxonomy","modelValue","onUpdate:modelValue"])]))),128))]),_:1})]),_:1})]))}};class Yj extends il{constructor(){super(...arguments);ze(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});ze(this,"generateDownloadableVariationName",(a,l)=>{if(!a)return d("For all variants");let n=[];if(typeof a=="string")try{n=JSON.parse(a)}catch{}else typeof a=="object"&&(n=Object.values(a));if(n.length===0)return d("For all variants");const i=Zo(l),A=l.variants.reduce((m,_)=>(m[_.id]=Kn(_,i),m),{}),p=n.map(m=>A[m]).filter(Boolean);return p.length===0?"--":p.length===1?p[0]:`${p[0]} +${p.length-1}`});ze(this,"deleteDownloadableFile",(a,l)=>{On.ofDelete(d("Deleting this asset will break the download link in existing purchase emails. To update the file, edit the asset instead of deleting it.")).then(()=>{ce.delete(`products/${a}/delete`).then(()=>{j.success(d("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(l,1)}).catch(n=>{j.error(d("Failed To Delete"))})}).catch(()=>{})});ze(this,"addDummyDownloadableFileForAllVariant",a=>{this.data.addModal.files=this.data.addModal.files.filter(l=>Object.values(l).every(n=>n!=null&&n!=="")),Object.values(this.generateVariantOptions(a)).forEach(l=>{l.id>0&&this.addDummyInsertableFile(l.id)})});ze(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});ze(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});ze(this,"attachInsertableFiles",a=>{this.setSaving(!0),ce.post(`products/${a}/sync-downloadable-files`,{downloadable_files:this.insertableFiles}).then(l=>{this.setDownloadableFiles(l.downloadable_files),this.syncToSourceProduct(),this.closeAddModal(),j.success(d("Variations Synced Successfully"))}).catch(l=>{this.setSaving(!1),l.status_code=="422"?this.setValidationError(l.data):j.error(d("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});ze(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});ze(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});ze(this,"openEditModal",(a,l)=>{this.data.editModal.isCurrentlyEditing=!0,this.data.editModal.states[a].visible=!0,this.data.editModal.states[a].file=l,this.data.editModal.currentIndex=a});ze(this,"closeEditModal",a=>{this.data.editModal.isCurrentlyEditing=!1,this.data.editModal.states[a].visible=!1,this.data.editModal.states[a].file=null,this.data.editModal.currentIndex=-1,this.resetValidationError()});ze(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);ze(this,"setValidationError",a=>{this.data.validationErrors=a});ze(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));ze(this,"clearValidationError",()=>{this.data.validationErrors={}});ze(this,"deleteValidationError",a=>{this.data.validationErrors.hasOwnProperty(a)&&delete this.data.validationErrors[a]})}setDownloadableFiles(a,l=null){a=a.map(n=>{if(typeof n.settings=="string")try{n.settings=JSON.parse(n.settings)}catch{}return n}),this.data.downloadableFiles=a,l&&(this.data.sourceProduct=l)}syncToSourceProduct(){this.data.sourceProduct&&Array.isArray(this.data.downloadableFiles)&&(this.data.sourceProduct.downloadable_files=[...this.data.downloadableFiles])}get downloadableFiles(){return this.data.downloadableFiles}get saving(){return this.data.saving}setSaving(a){this.data.saving=a}hasDownloadableFiles(){return Array.isArray(this.data.downloadableFiles)&&this.data.downloadableFiles.length>0}getHiddenVariationNames(a,l){if(!a)return[];let n=[];if(typeof a=="string")try{n=JSON.parse(a)}catch{return[]}else typeof a=="object"&&(n=Object.values(a));const i=Zo(l),A=l.variants.reduce((m,_)=>(m[_.id]=Kn(_,i),m),{});return n.map(m=>A[m]).filter(Boolean).slice(1)}generateVariantOptions(a){return[...a.variants.filter(n=>n.created_at)]}hasVariationOption(a){return Object.values(this.generateVariantOptions(a)).length>0}get downloadableFileSchema(){return{product_variation_id:[],title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",file_size:"",settings:{download_limit:"",download_expiry:"",bucket:""},serial:""}}setInsertableFiles(a){this.data.addModal.files=a}get insertableFiles(){return this.data.addModal.files}addDummyInsertableFile(a=null){const l=this.downloadableFileSchema;a&&(l.product_variation_id=[a]),this.data.addModal.files.push(l)}getCurrentEditableIndex(){return this.data.editModal.currentIndex}getCurrentEditableFile(){var a;return((a=this.data.editModal.states[this.getCurrentEditableIndex()])==null?void 0:a.file)??null}updateDownloadableFile(){const a=this.getCurrentEditableFile(),l=this.getCurrentEditableIndex();!a||l<0||(this.setSaving(!0),ce.put("products/"+a.id+"/update",a).then(n=>{this.closeEditModal(l),j.success(n.message),this.downloadableFiles[l]={...a},this.syncToSourceProduct()}).catch(n=>{n.hasOwnProperty("message")?j.error(n.message):j.error(d("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function Wj(){return Yj.init()}const Jj={class:"fct-product-simple-wrap"},Xj={class:"flex items-center gap-1 justify-between w-full"},Zj={class:"fct-shipping-class-select-wrap relative"},eq={class:"fct-select-option-with-leftright-value"},tq={class:"text-sm text-gray-500"},aq={class:"pt-1.5 text-right"},lq={key:0},sq={class:"mb-0 mt-2"},nq={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M(dt.get(t,"product.detail.other_info.shipping_class")),l=M(),n=M(!1),i=M(!1),A=M([]),p=Ke.get("admin_url")+"settings/shipping/shipping_classes",m=(b="")=>{i.value=!0,A.value=[],ce.get("shipping/classes",{search:b}).then(w=>{A.value=w.shipping_classes.data,g()}).finally(()=>{i.value=!1})},_=b=>{m(),b.id&&(a.value=b.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const b=dt.where(A.value,"id",a.value);l.value=dt.get(b,"0")},y=()=>{n.value=!0},v=()=>{a.value&&ce.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(b=>{j.success(b.message)}).catch(b=>{var w;b.status_code=="422"?j.validationErrors(b):j.error((w=b.data)==null?void 0:w.message)})},k=()=>{ce.post("products/"+t.product.ID+"/shipping-class/remove").then(b=>{j.success(b.message)}).catch(b=>{var w;b.status_code=="422"?j.validationErrors(b):j.error((w=b.data)==null?void 0:w.message)})};return Te(()=>{m()}),(b,w)=>{const B=C("el-option"),S=C("el-select"),V=C("el-button");return r(),h("div",Jj,[s(xe,null,{default:u(()=>[s(Ve,{border_bottom:""},{default:u(()=>[o("div",Xj,[s(Ot,{title:c(d)("Shipping Class"),content:c(d)("Use a shipping class to group products with similar shipping requirements. This allows you to set specific shipping rates for different types of items, such as 'Bulky Items', 'Fragile Goods'. Select an existing class from the search box or click + Add to create a new one. If no class is assigned, the product will use your store's default shipping rates.")},null,8,["title","content"]),o("a",{href:p,class:"focus:outline-none focus:shadow-none w-4 h-4 inline-flex items-center justify-center",target:"_blank"},[s(X,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),s(Be,null,{default:u(()=>[o("div",Zj,[s(S,{modelValue:a.value,"onUpdate:modelValue":w[0]||(w[0]=F=>a.value=F),remote:"",placeholder:c(d)("Search Shipping Class"),"remote-method":m,loading:i.value,filterable:"",clearable:"",onChange:v,onClear:k,"popper-class":"fct-shipping-class-select"},{default:u(()=>[(r(!0),h(P,null,ae(A.value,F=>(r(),E(B,{key:F.id,label:F.name,value:F.id},{default:u(()=>[o("div",eq,[R(f(F.name)+" ",1),o("span",tq,f(F.type==="percentage"?F.cost+"%":c(_t).formatNumber(F.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",aq,[s(V,{onClick:Ge(y,["stop"]),size:"small",text:""},{default:u(()=>[s(X,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),h("div",lq,[o("p",sq,f(c(d)("Cost: %s",l.value.type==="percentage"?l.value.cost+"%":c(_t).formatNumber(l.value.cost*100,!0))),1)])):x("",!0)]),_:1})]),_:1}),s(Hm,{modelValue:n.value,"onUpdate:modelValue":w[1]||(w[1]=F=>n.value=F),onSaved:_},null,8,["modelValue"])])}}},oq={key:0,class:"fct-product-inventory-wrap"},iq={class:"fct-product-inventory-inner-wrap hide-on-mobile"},rq={class:"space-x-5"},dq={key:0,class:"fct-variant-badge bg-white border border-solid border-gray-outline text-primary-500 rounded-xs dark:bg-primary-700 dark:text-gray-50 dark:border-primary-500"},uq={key:1},cq={class:"fct-card-header-title"},Aq={class:"fct-product-inventory-pro-text"},pq={class:"m-0"},fq={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=Ke.get("app_config.isProActive"),n=M([]);Te(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){p()}),p()});const i=(m,_)=>{ce.post(`products/save-bundle-info/${m}`,{bundle_child_ids:_}).then(g=>{j.success(d("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?j.validationErrors(g):j.error(g==null?void 0:g.message)})},A=M(!0),p=()=>{A.value=!0,ce.get(`products/get-bundle-info/${a.product.ID}`).then(m=>{n.value=m,A.value=!1})};return(m,_)=>{const g=C("el-table-column"),y=C("el-table");return c(l)?(r(),h("div",oq,[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Map bundle items")},null,8,["title"]),s(ma,{visible:!0,accordion:""},{default:u(()=>[s(Be,{class:"px-0 pb-0"},{default:u(()=>[o("div",iq,[A.value?x("",!0):(r(),E(y,{key:0,data:n.value},{default:u(()=>[e.product.detail.variation_type!=="simple"?(r(),E(g,{key:0,label:c(d)("Title"),width:"140"},{default:u(v=>{var k;return[o("div",rq,[o("span",null,f(v.row.variation_title),1),((k=v.row.other_info)==null?void 0:k.payment_type)==="subscription"?(r(),h("span",dq,f(v.row.other_info.repeat_interval),1)):x("",!0)])]}),_:1},8,["label"])):x("",!0),s(g,{label:c(d)("Bundle Items"),width:"140"},{default:u(v=>[s(xA,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":k=>v.row.bundle_child_ids=k,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:k=>{k||i(v.row.id,v.row.bundle_child_ids)},scopes:["nonBundle"]},null,8,["modelValue","onUpdate:modelValue","onVisibleChange"])]),_:1},8,["label"])]),_:1},8,["data"]))])]),_:1})]),_:1})]),_:1})])):(r(),h("div",uq,[s(xe,null,{default:u(()=>[s(Ve,{border_bottom:""},{title:u(()=>[o("h2",cq,[R(f(c(d)("Map bundle items"))+" ",1),s(X,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),s(Be,null,{default:u(()=>[o("div",Aq,[o("p",pq,f(c(d)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},mq={class:"fct-edit-product-wrapper fct-layout-width"},hq={class:"fct-btn-group sm"},_q={class:"hide-on-mobile"},vq={class:"show-on-mobile"},gq=["href"],yq={key:1,class:"single-page-body"},bq=["innerHTML"],wq={class:"fct-product-edit"},Cq={class:"fct-product-main"},kq={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},Bq={class:"fct-product-aside"},xq={class:"el-form el-form--default el-form--label-top"},Sq={key:1},$q={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=M(),l=W7();let n=null;const i=Wj();l.setProductDownloadableModel(i);const A=M(!1),p=k=>{var b,w;A.value=!1,l.setProduct(k),n=l.data.product,i.setDownloadableFiles(k.downloadable_files,k),n.gallery=((w=(b=n==null?void 0:n.detail)==null?void 0:b.gallery_image)==null?void 0:w.meta_value)??[],n.taxonomies=t.taxonomies,n.product_terms={},Object.keys(n.taxonomies).map(B=>{n.product_terms[B]=n[B]??[]}),l.saveSnapshot(),A.value=!0};J7().onSave(()=>{var k;l.data.metaValue=(k=a.value)==null?void 0:k.getFormStates(),l.update()});const _=As();_.bind(["mod+s"],k=>{var b;k.preventDefault(),l.data.hasChange&&(i.isAddModalOpen()?i.attachInsertableFiles(t.product.ID):i.isEditModalOpen()?i.updateDownloadableFile():(l.data.metaValue=(b=a.value)==null?void 0:b.getFormStates(),l.update()))});const g=()=>{l.setHasChange(!0)},y=k=>{k==="delete"&&l.delete()};pi("triggerChange",g);const v=ci("reload");return be(()=>t.product,(k,b)=>{k!==b&&p(k)}),Te(()=>{p(t.product),l.setReloader(v);const k=document.querySelector(".fct-admin-product-header");k&&document.querySelector("#fluent_cart_plugin_app").prepend(k),l.addOnProductUpdatedListener("formreset",function(){var b;(b=a.value)==null||b.resetForms()})}),lA(()=>{_.unbind("mod+s")}),(k,b)=>{const w=C("el-button"),B=C("el-dropdown-item"),S=C("el-dropdown-menu"),V=C("el-dropdown");return r(),h("div",mq,[(r(),E(Ai,{to:"#fct-admin-product-header-buttons"},[o("div",hq,[s(V,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:u(()=>[s(S,null,{default:u(()=>[s(B,{command:"preview",class:"item-link"},{default:u(()=>[o("a",{href:c(l).viewUrl(),target:"_blank"},[s(X,{name:"Eye"}),R(" "+f(c(d)("Preview")),1)],8,gq)]),_:1}),s(B,{command:"delete",class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})]),_:1})]),default:u(()=>[s(w,null,{default:u(()=>[o("span",_q,[R(f(c(d)("More Actions"))+" ",1),s(X,{name:"ChevronDown"})]),o("span",vq,[s(X,{name:"More"})])]),_:1})]),_:1})])])),A.value?(r(),E(Ns,{key:0,isActive:c(l).data.hasChange?"is-active":"",loading:c(l).data.saving,onDiscard:c(l).discard,onSave:b[0]||(b[0]=()=>{var F;c(l).data.metaValue=(F=a.value)==null?void 0:F.getFormStates(),c(l).update()}),saveButtonText:c(d)("Update"),"show-cmnd-icon":!0},null,8,["isActive","loading","onDiscard","saveButtonText"])):x("",!0),A.value?(r(),h("div",yq,[c(l).shouldShowShippingMethodAlert()?(r(),E(ol,{key:0,class:"mb-3",type:"warning",icon:"InformationFill"},{default:u(()=>[o("span",{innerHTML:c(d)("This Product has physical variants. Please %s",'<a href="'+c(l).shippingSettingsUrl()+'" target="_blank">'+c(d)("Add Shipping")+"</a>")},null,8,bq)]),_:1})):x("",!0),c(l).isInDraft()?(r(),E(ol,{key:1,class:"mb-3",type:"warning",icon:"InformationFill",content:c(d)("This product is currently in draft and cannot be sold to customers. Please publish the product to make it available for purchase.")},null,8,["content"])):x("",!0),o("div",wq,[o("div",Cq,[s(vL,{product:c(n),productEditModel:c(l),reload:c(v)},null,8,["product","productEditModel","reload"]),o("div",kq,[(r(),E(xc,{key:c(l).data.discardKey,product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"])),s(Sc,{product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"])]),s(wz,{product:c(n),productEditModel:c(l),productDownloadableModel:c(i)},null,8,["product","productEditModel","productDownloadableModel"]),s(Qz,{product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"]),c(l).isBundleProduct()?(r(),E(fq,{key:0,product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"])):x("",!0),c(l).isBundleProduct()?x("",!0):(r(),E(oj,{key:1,product:c(n),productEditModel:c(l),productDownloadableModel:c(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",Bq,[o("div",xq,[(r(),E(xc,{class:"fct-hide-on-tablet",key:"aside-"+c(l).data.discardKey,product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"])),s(Sc,{class:"fct-hide-on-tablet",product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"]),s(qj,{product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"]),c(l).hasPhysicalVariation()?(r(),E(nq,{key:0,product:c(n),productEditModel:c(l)},null,8,["product","productEditModel"])):x("",!0),c(n)?(r(),h("div",Sq,[s(hn,{ref_key:"dynamicTemplates",ref:a,filter:"single_product_page","widgets-query":{product_id:c(n).ID},data:{editableProduct:c(n)}},null,8,["widgets-query","data"])])):x("",!0)])])])])):x("",!0)])}}},Fq={class:"fct-upgrade-path-drawer-content"},Eq={class:"fct-form-group"},Uq={class:"fct-form-group"},Iq={class:"fct-form-group"},Vq={class:"fct-form-group"},Dq={__name:"AddModal",props:{pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,productId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{expose:t,emit:a}){const l=e,n=a,i=M(!1),A=()=>{i.value=!0},p={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},m=M({...p}),_=M({}),g=Ke.get("shop.currency_sign"),y=()=>{_.value={};const b={...m.value};(!Array.isArray(b.to_variants)||b.to_variants.length===0)&&(b.to_variants=[]),ce.post(`products/${l.productId}/upgrade-path`,{...b}).then(w=>{j.success(w.message),m.value={...p},i.value=!1,n("pathGenerated")}).catch(w=>{if(_.value=w,w.message)return j.error(w.message)})},v=()=>m.value.from_variant?l.allVariants.filter(b=>{var w,B;return!((w=l.existingUpgradePathMap[m.value.from_variant])!=null&&w.includes(b.id)||(B=l.existingUpgradePathMap[m.value.from_variant])!=null&&B.includes(b.id.toString()))&&b.id!==m.value.from_variant}):[],k=b=>{let w=b==null?void 0:b.toString().replace(/^0+(?=\d)/,"");w===""&&(w="0"),parseInt(w)<0&&(w="0"),m.value.discount_amount=w};return t({openModal:A}),(b,w)=>{const B=C("el-option"),S=C("el-select"),V=C("el-checkbox"),F=C("el-input"),$=C("el-button"),U=C("el-drawer");return r(),E(U,{title:c(d)("Add Upgrade Path"),modelValue:i.value,"onUpdate:modelValue":w[5]||(w[5]=D=>i.value=D),onClosed:w[6]||(w[6]=()=>{i.value=!1,m.value={...p}}),"append-to-body":"",class:ue(c(Re).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:u(()=>[s($,{onClick:w[4]||(w[4]=D=>i.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s($,{onClick:y,type:"primary"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1})]),default:u(()=>[o("div",Fq,[o("div",Eq,[o("label",null,f(c(d)("From Plan")),1),s(S,{modelValue:m.value.from_variant,"onUpdate:modelValue":w[0]||(w[0]=D=>m.value.from_variant=D),placeholder:c(d)("Select"),"popper-class":"fct-variation-select"},{default:u(()=>[(r(!0),h(P,null,ae(e.pathOptions,D=>(r(),E(B,{key:D.id,label:D.variation_title,value:D.id,disabled:m.value.to_variants.includes(D.id)},{default:u(()=>[s(ei,{variant:D},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),_.value.hasOwnProperty("from_variant")?(r(),E(zt,{key:0,"validation-errors":_.value,"field-key":"from_variant"},null,8,["validation-errors"])):x("",!0)]),o("div",Uq,[o("label",null,f(c(d)("To Plan(s)")),1),s(S,{disabled:!m.value.from_variant,modelValue:m.value.to_variants,"onUpdate:modelValue":w[1]||(w[1]=D=>m.value.to_variants=D),multiple:"",placeholder:c(d)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:u(()=>[(r(!0),h(P,null,ae(v(),D=>(r(),E(B,{key:D.id,label:D.variation_title,value:D.id,disabled:D.id==m.value.from_variant},{default:u(()=>[s(ei,{variant:D},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),_.value.hasOwnProperty("to_variants")?(r(),E(zt,{key:0,"validation-errors":_.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),o("div",Iq,[s(V,{"true-value":"1","false-value":"0",modelValue:m.value.is_prorate,"onUpdate:modelValue":w[2]||(w[2]=D=>m.value.is_prorate=D)},{default:u(()=>[R(f(c(d)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",Vq,[o("label",null,f(c(d)("Discount Amount")),1),s(F,{modelValue:m.value.discount_amount,"onUpdate:modelValue":w[3]||(w[3]=D=>m.value.discount_amount=D),type:"number",min:0,onInput:k},{prepend:u(()=>[R(f(c(g)),1)]),_:1},8,["modelValue"]),_.value.hasOwnProperty("discount_amount")?(r(),E(zt,{key:0,"validation-errors":_.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["title","modelValue","class"])}}},Tq={class:"fct-upgrade-path-drawer-content"},Qq={class:"fct-form-group"},Mq={class:"text"},Lq={class:"fct-form-group"},Rq={class:"fct-form-group"},Oq={class:"fct-form-group"},$c={__name:"EditModal",props:{fromName:String,preSelectedFromVariant:{type:[String,Number]},preSelectedToVariants:{type:Array},preSelectedIsProrate:{type:[String,Number]},preSelectedDiscountAmount:{type:[String,Number]},pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,pathId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{emit:t}){const a=e,l=M({...a.existingUpgradePathMap}),n=t,i=M(!1),A={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},p=M({...A}),m=M({}),_=()=>{m.value={};const k={...p.value};(!Array.isArray(k.to_variants)||k.to_variants.length===0)&&(k.to_variants=[]),ce.post(`products/upgrade-path/${a.pathId}/update`,{...k}).then(b=>{j.success(b.message),p.value={...A},i.value=!1,n("pathGenerated")}).catch(b=>{if(m.value=b,b.message)return j.error(b.message)})},g=()=>p.value.from_variant?a.allVariants.filter(k=>{var b,w;return!((b=l[p.value.from_variant])!=null&&b.includes(k.id)||(w=l[p.value.from_variant])!=null&&w.includes(k.id.toString()))&&k.id.toString()!==p.value.from_variant.toString()}):[],y=()=>{p.value.from_variant=a.preSelectedFromVariant,p.value.is_prorate=a.preSelectedIsProrate,p.value.discount_amount=a.preSelectedDiscountAmount,p.value.to_variants=[];for(const k of a.preSelectedToVariants)p.value.to_variants.push(parseInt(k))},v=k=>{let b=k==null?void 0:k.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),p.value.discount_amount=b};return Hs(()=>{y()}),(k,b)=>{const w=C("el-option"),B=C("el-select"),S=C("el-checkbox"),V=C("el-input"),F=C("el-button"),$=C("el-drawer");return r(),h(P,null,[s(tt,{size:"x-small",tag:"button",onClick:b[0]||(b[0]=()=>{i.value=!0})},{default:u(()=>[s(X,{name:"Edit"})]),_:1}),s($,{modelValue:i.value,"onUpdate:modelValue":b[5]||(b[5]=U=>i.value=U),title:k.$t("Update Upgrade Path"),onClosed:b[6]||(b[6]=()=>{i.value=!1,p.value={...A}}),onOpen:y,"append-to-body":""},{footer:u(()=>[s(F,{onClick:b[4]||(b[4]=U=>i.value=!1),size:"small"},{default:u(()=>[R(f(k.$t("Cancel")),1)]),_:1}),s(F,{onClick:_,size:"small",type:"primary"},{default:u(()=>[R(f(k.$t("Update")),1)]),_:1})]),default:u(()=>[o("div",Tq,[o("div",Qq,[o("label",null,f(k.$t("From Plan")),1),o("div",Mq,f(e.fromName),1)]),o("div",Lq,[o("label",null,f(k.$t("To Plan(s)")),1),s(B,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=U=>p.value.to_variants=U),multiple:"",placeholder:k.$t("Select"),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(g(),U=>(r(),E(w,{key:U.id,label:U.variation_title,value:U.id,disabled:U.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),m.value.hasOwnProperty("to_variants")?(r(),E(zt,{key:0,"validation-errors":m.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),o("div",Rq,[s(S,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=U=>p.value.is_prorate=U)},{default:u(()=>[s(Ot,{class:"flex items-center",title:k.$t("Prorate"),content:`The prorated amount, based on the remaining days, will be credited to the new plan. Upgrading from one-time payment, the full amount will be credited. |
| 152 |
`},null,8,["title"])]),_:1},8,["modelValue"])]),o("div",Oq,[o("label",null,f(k.$t("Discount Amount")),1),s(V,{modelValue:p.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=U=>p.value.discount_amount=U),type:"number",min:"0",onInput:v},null,8,["modelValue"]),m.value.hasOwnProperty("discount_amount")?(r(),E(zt,{key:0,"validation-errors":m.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},Pq={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton"),i=C("el-table-column"),A=C("el-table");return r(),E(A,{data:[1,2,3,4,5]},{default:u(()=>[s(i,{label:c(d)("From Plan"),prop:"object_id",width:300},{default:u(()=>[s(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[s(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),s(i,{label:c(d)("To Plan"),width:200},{default:u(()=>[s(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[s(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),s(i,{label:c(d)("Discount Amount"),width:110},{default:u(()=>[s(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[s(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),s(i,{label:c(d)("Is Prorate"),width:100},{default:u(()=>[s(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[s(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),s(i,{width:100},{default:u(()=>[s(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[s(l,{varient:"p",class:"w-3/5"})]),_:1})]),_:1})]),_:1})}}},Hq={class:"fct-upgrade-paths-wrap fct-layout-width"},Nq={class:"grid gap-1"},Kq={class:"text-system-dark dark:text-gray-50"},Gq={class:"text-xs text-system-mid dark:text-gray-300"},zq={class:"flex gap-1 flex-wrap"},jq={key:0},qq={key:1},Yq={class:"fct-btn-group sm"},Wq={key:2,class:"fct-upgrade-paths-mobile"},Jq={class:"from-plan"},Xq={class:"title"},Zq={class:"plan-title"},eY={key:0,class:"plan-billing-summary"},tY={class:"to-plan"},aY={class:"title"},lY={class:"discount-amount"},sY={class:"title"},nY={key:0},oY={key:1},iY={class:"is-prorate"},rY={class:"title"},dY={class:"path-actions"},uY={class:"title"},cY={class:"fct-btn-group sm mt-3"},AY={key:0,class:"py-6 text-center"},pY={key:1},fY={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},mY={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},hY={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=G(()=>dt.get(t.product,"detail.other_info.is_bundle_product")==="yes"),l=M(!1),n=M(null);M([]),M({status:"yes",paths:{}});const i=Ke.get("app_config.isProActive"),A=M([]),p=G(()=>t.product.variants.filter(B=>{var V;return(((V=k.value[B.id])==null?void 0:V.length)||0)<v.value-1})),m=B=>{_()},_=async()=>{l.value=!0,ce.get(`products/${t.product_id}/upgrade-paths`).then(function(B){A.value=B.data,b()}).catch(function(B){}).finally(()=>{l.value=!1})},g=M({}),y=M({}),v=M(dt.get(t.product,"variants",[]).length),k=M({}),b=()=>{t.product.variants.entries().forEach(([B,S])=>{g.value[S.id]=S.variation_title,y.value[S.id]=S.other_info.billing_summary}),k.value={},A.value.forEach(B=>{k.value.hasOwnProperty(B.object_id)?(k.value[B.object_id]=[...k.value[B.object_id].concat([...B.meta_value.to_variants])],k.value[B.object_id]=[...new Set(k.value[B.object_id])]):k.value[B.object_id]=[...B.meta_value.to_variants]})},w=B=>{ce.delete(`products/upgrade-path/${B}/delete`).then(function(S){_(),j.success(S.message)}).catch(function(S){})};return Te(()=>{_();const B=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");B&&document.querySelector("#fluent_cart_plugin_app").prepend(B)}),(B,S)=>{const V=C("el-table-column"),F=C("el-tag"),$=C("el-table"),U=C("el-button");return r(),h(P,null,[o("div",Hq,[s(c(xe),null,{default:u(()=>[s(c(Ve),{title:c(d)("Upgrade Paths")},null,8,["title"]),c(i)&&!a.value?(r(),h(P,{key:0},[s(c(Be),{class:"px-0 pb-0"},{default:u(()=>[l.value?(r(),E(Pq,{key:0})):x("",!0),l.value?x("",!0):(r(),E($,{key:1,class:"hide-on-mobile",data:A.value},{empty:u(()=>[R(f(c(d)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:u(()=>[s(V,{label:c(d)("From Plan"),prop:"object_id",width:300},{default:u(D=>[o("div",Nq,[o("div",Kq,f(c(dt).get(g.value,D.row.object_id,"")),1),o("div",Gq,f(c(dt).get(y.value,D.row.object_id,"")),1)])]),_:1},8,["label"]),s(V,{label:c(d)("To Plan"),width:200},{default:u(D=>[o("div",zq,[(r(!0),h(P,null,ae(c(dt).get(D.row,"meta_value.to_variants",[]),T=>(r(),h(P,{key:T},[c(dt).get(g.value,T)?(r(),E(F,{key:0},{default:u(()=>[R(f(c(dt).get(g.value,T)),1)]),_:2},1024)):x("",!0)],64))),128))])]),_:1},8,["label"]),s(V,{label:c(d)("Discount Amount"),width:110},{default:u(D=>[D.row.meta_value.discount_amount>0?(r(),h("span",jq,f(c(dt).get(D.row,"meta_value.discount_amount","0")),1)):(r(),h("span",qq,"--"))]),_:1},8,["label"]),s(V,{label:c(d)("Is Prorate"),width:100},{default:u(D=>[R(f(c(dt).get(D.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),s(V,{width:100},{default:u(D=>[o("div",Yq,[s($c,{pathId:D.row.id,preSelectedToVariants:c(dt).get(D.row,"meta_value.to_variants",[]),preSelectedIsProrate:c(dt).get(D.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:c(dt).get(D.row,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:k.value,fromName:c(dt).get(g.value,D.row.object_id,""),preSelectedFromVariant:D.row.object_id,onPathGenerated:m},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),s(tt,{size:"x-small",tag:"button",outline:"",onClick:()=>w(D.row.id)},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?x("",!0):(r(),h("div",Wq,[(r(!0),h(P,null,ae(A.value,(D,T)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:T},[o("div",Jq,[o("div",Xq,f(c(d)("From Plan"))+": ",1),o("div",null,[o("div",Zq,f(c(dt).get(g.value,D.object_id,"")),1),c(dt).get(y.value,D.object_id,"")?(r(),h("div",eY,f(c(dt).get(y.value,D.object_id,"")),1)):x("",!0)])]),o("div",tY,[o("div",aY,f(c(d)("To Plan"))+": ",1),(r(!0),h(P,null,ae(c(dt).get(D,"meta_value.to_variants",[]),I=>(r(),h(P,{key:I},[c(dt).get(g.value,I)?(r(),E(F,{key:0},{default:u(()=>[R(f(c(dt).get(g.value,I)),1)]),_:2},1024)):x("",!0)],64))),128))]),o("div",lY,[o("div",sY,f(c(d)("Discount Amount"))+": ",1),D.meta_value.discount_amount>0?(r(),h("span",nY,f(c(dt).get(D,"meta_value.discount_amount","0")),1)):(r(),h("span",oY,"--"))]),o("div",iY,[o("div",rY,f(c(d)("Is Prorate"))+": ",1),o("span",null,f(c(dt).get(D,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),o("div",dY,[o("div",uY,f(c(d)("Actions"))+": ",1),o("div",cY,[s($c,{pathId:D.id,preSelectedToVariants:c(dt).get(D,"meta_value.to_variants",[]),preSelectedIsProrate:c(dt).get(D,"meta_value.is_prorate","0"),preSelectedDiscountAmount:c(dt).get(D,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:k.value,fromName:c(dt).get(g.value,D.object_id,""),preSelectedFromVariant:D.object_id,onPathGenerated:m},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),s(tt,{size:"x-small",tag:"button",outline:"",onClick:()=>w(D.id)},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),A.value.length==0?(r(),h("div",AY,f(c(d)("No upgrade paths found.")),1)):x("",!0)]))]),_:1}),l.value?x("",!0):(r(),E(c(yd),{key:0},{default:u(()=>[p.value.length?(r(),E(U,{key:0,text:"",onClick:S[0]||(S[0]=()=>{var D;return(D=n.value)==null?void 0:D.openModal()})},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)("Add Path")),1)]),_:1})):(r(),h("span",pY,f(c(d)("No more upgrade paths available")),1))]),_:1}))],64)):c(i)?a.value?(r(),h("div",mY,[s(wt,{icon:"Empty/WebPage",title:c(d)("Upgrade Paths Temporarily Unavailable for Bundle Products"),text:c(d)("Upgrade paths feature is temporarily disabled for bundle products. This feature will be enabled in a future update.")},null,8,["title","text"])])):x("",!0):(r(),h("div",fY,[s(cs,{class:"py-7.5",placement:"feature_lock_upgrade_paths",title:c(d)("Get access to this feature by Upgrading to FluentCart Pro"),text:c(d)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))]),_:1})]),a.value?x("",!0):(r(),E(Dq,{key:0,productId:e.product.ID,onPathGenerated:m,ref_key:"addModalRef",ref:n,pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:k.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},_Y={name:"ProductIntegrations",components:{IconButton:tt,Empty:wt,DynamicIcon:X,CardFooter:yd,CardBody:Be,CardHeader:Ve,CardContainer:xe},props:["product","product_id"],data(){return{product_id:this.product_id,selectedIntegrationType:"",integrationLists:[],showIntegrationDialog:!1,feeds:[],available_integrations:{},all_module_config_url:{},totalActiveModules:0,loading:!1}},computed:{Str(){return Aa},hasActiveModules(){return Object.values(this.available_integrations).some(e=>e.enabled)}},mounted(){this.fetchIntegrations();const e=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");e&&document.querySelector("#fluent_cart_plugin_app").prepend(e)},methods:{isEmpty:vd,fetchIntegrations(){this.loading=!0,this.$get(`products/${this.product_id}/integrations`).then(e=>{this.available_integrations=e.available_integrations,this.feeds=e.feeds,this.all_module_config_url=e.all_module_config_url}).catch(e=>{this.handleError(e.message||"Failed to load integrations")}).finally(()=>{this.loading=!1})},add(e){let t=this.available_integrations[e];if(!t.enabled){this.$confirm(t.configure_message,t.configure_title,{confirmButtonText:t.configure_button_text,cancelButtonText:"Cancel",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{window.location.href=t.global_configure_url});return}this.$router.push({name:"product_integration_feed_editor",params:{integration_id:0,integration_name:e}})},edit(e){this.$router.push({name:"product_integration_feed_editor",params:{integration_id:e.id,integration_name:e.provider}})},handleActive(e){let t={status:e.enabled,notification_id:e.id};this.$post(`products/${this.product_id}/integrations/feed/change-status`,t).then(a=>{this.handleSuccess(a.message)}).catch(a=>{this.handleError(a.responseJSON.data.message)})},remove(e,t){let a=t.$index,l={integration_id:e};this.$confirm("Are you sure you want to delete this integration?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.$del(`products/${this.product_id}/integrations/${e}`,l).then(n=>{this.handleSuccess(n.message),this.feeds.splice(a,1)}).catch(()=>{})}).catch(()=>{})},handleSuccess(e){this.$notify({type:"success",message:e,offset:40})},handleError(e){this.$notify({type:"error",message:e,offset:40})}}},vY={class:"fct-integration-settings fct-layout-width"},gY={key:0,class:"integration-actions"},yY={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},bY={class:"text-sm"},wY={key:1,class:"fct-integrations-table-wrap"},CY={class:"fct-integration-logo-wrap"},kY=["src","alt"],BY={class:"text-xs text-gray-700"},xY=["onClick"],SY={class:"fct-event-triggers"},$Y={class:"fct-event-triggers"},FY={class:"fct-btn-group sm"},EY={class:"fct-integration-table-footer"},UY=["href"],IY={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function VY(e,t,a,l,n,i){const A=C("DynamicIcon"),p=C("el-button"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown"),y=C("CardHeader"),v=C("el-skeleton"),k=C("el-switch"),b=C("el-table-column"),w=C("el-tag"),B=C("el-popover"),S=C("IconButton"),V=C("el-tooltip"),F=C("Empty"),$=C("el-table"),U=C("CardBody"),D=C("CardContainer"),T=Qa("loading");return r(),h("div",vY,[s(D,null,{default:u(()=>[s(y,{title:e.$t("Product Integrations")},{action:u(()=>[i.hasActiveModules?(r(),h("div",gY,[s(g,{onCommand:i.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:u(()=>[s(_,null,{default:u(()=>[(r(!0),h(P,null,ae(n.available_integrations,(I,L)=>(r(),E(m,{key:L,command:L},{default:u(()=>[R(f(I.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[s(p,{type:"info",plain:"",size:"small"},{default:u(()=>[R(f(e.$t("Add Integration"))+" ",1),s(A,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title"]),s(U,{class:"px-0 pb-0 pt-4"},{default:u(()=>[s(v,{class:"px-5 pb-5",loading:n.loading,animated:"",rows:6},null,8,["loading"]),n.loading?x("",!0):(r(),h(P,{key:0},[i.hasActiveModules?(r(),h("div",wY,[Jt((r(),E($,{data:n.feeds},{empty:u(()=>[s(F,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:u(()=>[s(b,{label:e.$t("Status"),width:90},{default:u(I=>[s(k,{"active-value":"yes","inactive-value":"no",onChange:L=>i.handleActive(I.row),modelValue:I.row.enabled,"onUpdate:modelValue":L=>I.row.enabled=L},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),s(b,{width:160,label:e.$t("Integration")},{default:u(I=>{var L,O;return[o("div",CY,[(L=n.available_integrations[I.row.provider])!=null&&L.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:n.available_integrations[I.row.provider].logo,alt:I.row.provider},null,8,kY)):x("",!0),o("span",BY,f(((O=n.available_integrations[I.row.provider])==null?void 0:O.title)||I.row.provider),1)])]}),_:1},8,["label"]),s(b,{"min-width":150,label:e.$t("Title")},{default:u(I=>[o("a",{class:"fct-action-link-btn",onClick:Ge(L=>i.edit(I.row),["prevent"]),href:"#"},f(I.row.name),9,xY)]),_:1},8,["label"]),s(b,{"min-width":150,label:e.$t("Triggers")},{default:u(I=>[o("div",SY,[(r(!0),h(P,null,ae((I.row.feed.event_trigger||[]).slice(0,2),(L,O)=>(r(),E(w,{key:L},{default:u(()=>[s(A,{name:"Trigger"}),R(" "+f(i.Str.headline(L)),1)]),_:2},1024))),128)),(I.row.feed.event_trigger||[]).length>2?(r(),E(B,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:u(()=>[s(w,{type:"info"},{default:u(()=>[R(" +"+f((I.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:u(()=>[o("div",$Y,[(r(!0),h(P,null,ae((I.row.feed.event_trigger||[]).slice(2),(L,O)=>(r(),E(w,{key:L+O},{default:u(()=>[s(A,{name:"Trigger"}),R(" "+f(i.Str.headline(L)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),s(b,{width:90},{default:u(I=>[o("div",FY,[s(V,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(S,{tag:"button",onClick:L=>i.edit(I.row),size:"x-small",hover:"primary"},{default:u(()=>[s(A,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),s(V,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(S,{tag:"button",size:"x-small",onClick:L=>i.remove(I.row.id,I),hover:"danger"},{default:u(()=>[s(A,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[T,n.loading]])])):(r(),h("div",yY,[o("p",bY,f(e.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),s(p,{tag:"a",type:"primary",href:n.all_module_config_url},{default:u(()=>[R(f(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),o("div",EY,[o("a",{href:n.all_module_config_url},f(e.$t("Check Global Integration Settings")),9,UY),o("a",IY,f(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const Fc=nt(_Y,[["render",VY]]),DY={name:"SingleIntegration",components:{CardFooter:yd,CardBody:Be,CardHeader:Ve,CardContainer:xe},props:["product","product_id","integration_id","integration_type"],data(){return{integration_id:this.integration_id,product_id:this.product_id,integration_type:this.integration_type||"",saving:!1,formData:{values:{name:"",integrationName:this.integration_type||"",description:""},fields:{integrationName:{type:"select",label:"Integration Type",placeholder:"Select Integration",options:[]}}}}},mounted(){this.fetchIntegrationData()},methods:{saveIntegration(){if(!this.formData.values.name){this.$notify({type:"error",message:"Integration name is required",offset:40});return}this.saving=!0;const e=this.integration_id?`products/${this.product_id}/integrations/${this.integration_id}`:`products/${this.product_id}/integrations`,t=this.integration_id?"put":"post";this[`$${t}`](e,{integration:this.formData.values}).then(a=>{this.saving=!1,this.$notify({type:"success",message:a.message||"Integration saved successfully",offset:40}),this.$router.push({name:"ProductIntegrations",params:{product_id:this.product_id}})}).catch(a=>{this.saving=!1,this.$notify({type:"error",message:(a==null?void 0:a.message)||"Failed to save integration",offset:40})})},fetchIntegrationData(){if(!this.integration_id){this.fetchIntegrationType();return}this.$get(`products/${this.product_id}/integrations/${this.integration_id}`).then(e=>{e.integration&&(this.formData.values={...e.integration},this.integration_type=e.integration.integrationName,this.fetchIntegrationType())}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration data",offset:40})})},fetchIntegrationType(){this.integration_type&&this.$get(`integration/settings?integration_name=${this.integration_type}`).then(e=>{e.settings_fields&&(this.formData.fields=e.settings_fields),Object.keys(this.formData.fields).forEach(t=>{this.formData.values[t]===void 0&&(this.formData.values[t]="")})}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration fields",offset:40})})},compare(e,t,a){switch(t){case"=":return e===a;case"!=":return e!==a;default:return!0}},dependancyPass(e){if(e.dependency){const a=e.dependency.depends_on.split("/").reduce((l,n)=>l[n],this.formData.values);return this.compare(a,e.dependency.operator,e.dependency.value)}return!0}}},TY={class:"fct-integration-settings fct-layout-width"};function QY(e,t,a,l,n,i){const A=C("el-button"),p=C("CardHeader"),m=C("el-input"),_=C("el-form-item"),g=C("el-option"),y=C("el-select"),v=C("el-form"),k=C("CardBody"),b=C("CardContainer");return r(),h("div",TY,[s(b,null,{default:u(()=>[s(p,{border_bottom:"",title:n.integration_id?e.$t("Edit Integration"):e.$t("Add Integration")},{action:u(()=>[s(A,{onClick:i.saveIntegration,type:"primary",loading:n.saving},{default:u(()=>[R(f(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),s(k,null,{default:u(()=>[s(v,{"label-position":"top",model:n.formData.values,class:"integration-form"},{default:u(()=>[s(_,{label:e.$t("Integration Name"),required:""},{default:u(()=>[s(m,{modelValue:n.formData.values.name,"onUpdate:modelValue":t[0]||(t[0]=w=>n.formData.values.name=w),placeholder:e.$t("Enter a name for this integration")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n.integration_id?x("",!0):(r(),E(_,{key:0,label:e.$t("Integration Type")},{default:u(()=>[s(y,{modelValue:n.formData.values.integrationName,"onUpdate:modelValue":t[1]||(t[1]=w=>n.formData.values.integrationName=w),disabled:"",class:"fct-select"},{default:u(()=>[(r(!0),h(P,null,ae(n.formData.fields.integrationName.options,w=>(r(),E(g,{key:w.value,label:w.label,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(r(!0),h(P,null,ae(n.formData.fields,(w,B)=>(r(),h(P,{key:B},[B!=="integrationName"&&i.dependancyPass(w)?(r(),E(_,{key:0,label:w.label},{default:u(()=>[w.type==="text"?(r(),E(m,{key:0,modelValue:n.formData.values[B],"onUpdate:modelValue":S=>n.formData.values[B]=S,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="select"?(r(),E(y,{key:1,modelValue:n.formData.values[B],"onUpdate:modelValue":S=>n.formData.values[B]=S,placeholder:w.placeholder,class:"fct-select"},{default:u(()=>[(r(!0),h(P,null,ae(w.options,S=>(r(),E(g,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="textarea"?(r(),E(m,{key:2,type:"textarea",modelValue:n.formData.values[B],"onUpdate:modelValue":S=>n.formData.values[B]=S,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),_:2},1032,["label"])):x("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const MY=nt(DY,[["render",QY],["__scopeId","data-v-486bb338"]]),LY={class:"fct-reason-dropdown-wrap"},RY={class:"fct-reason-label"},Ef=Object.assign({name:"ReasonDropdown"},{__name:"ReasonDropdown",props:{modelValue:{type:String,default:""}},emits:["update:modelValue","update:customReason"],setup(e,{expose:t,emit:a}){const l=e,n=a,i=M(l.modelValue),A=M("");be(()=>l.modelValue,_=>{i.value=_});const p=()=>{n("update:modelValue",i.value),i.value==="other"&&n("update:customReason",A.value)},m=_=>{i.value=_,p()};return t({getValue:()=>i.value,getCustomReason:()=>A.value,setValue:_=>m(_),setCustomReason:_=>{A.value=_}}),(_,g)=>{const y=C("el-option"),v=C("el-select"),k=C("el-input");return r(),h("div",LY,[o("label",RY,f(c(d)("Reason")),1),s(v,{modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=b=>i.value=b),placeholder:c(d)("Select reason"),class:"w-full",onChange:p},{default:u(()=>[s(y,{label:c(d)("Received Stock"),value:"received"},null,8,["label"]),s(y,{label:c(d)("Damage/Loss"),value:"damage"},null,8,["label"]),s(y,{label:c(d)("Return/Refund"),value:"return"},null,8,["label"]),s(y,{label:c(d)("Count Correction"),value:"correction"},null,8,["label"]),s(y,{label:c(d)("Inventory Transfer"),value:"transfer"},null,8,["label"]),s(y,{label:c(d)("Other"),value:"other"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),s(ma,{visible:i.value==="other",accordion:"",duration:300},{default:u(()=>[s(k,{modelValue:A.value,"onUpdate:modelValue":g[1]||(g[1]=b=>A.value=b),type:"textarea",rows:3,placeholder:c(d)("Please describe the reason"),class:"fct-custom-reason-textarea",onInput:p},null,8,["modelValue","placeholder"])]),_:1},8,["visible"])])}}}),OY={class:"fct-adjust-by-wrap"},PY={class:"fct-adjust-by-row"},HY={class:"fct-adjust-by-col"},NY={class:"title"},KY={class:"fct-adjust-by-col"},GY={class:"title"},zY={class:"fct-stock-info"},jY={class:"fct-adjust-reason-wrap"},qY={class:"fct-adjust-by-action"},Uf=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,n=ci("fctPendingStockSaves",null),i=G(()=>!!a.variant.stock_save_pending||!!(n!=null&&n.has(a.variant.id))),A=M(!1),p=M(0),m=M(a.variant.total_stock),_=M(""),g=M(""),y=M(null),v=M(null);be(i,(S,V)=>{V&&!S&&A.value&&k()}),be(A,S=>{S&&(m.value=a.variant.total_stock,p.value=0,$e(()=>{var V,F,$;(V=y.value)==null||V.focus(),($=(F=y.value)==null?void 0:F.select)==null||$.call(F)}))});const k=()=>{const S=p.value||0;let F=(parseInt(a.variant.total_stock)||0)+parseInt(S);m.value=F<0?0:F},b=()=>{const S=m.value||0,V=parseInt(a.variant.total_stock)||0;p.value=parseInt(S)-V},w=()=>{p.value=0,m.value=a.variant.total_stock,_.value="",g.value="",A.value=!1},B=()=>{i.value||(l("save",{variant:a.variant,newStock:m.value,adjustedQuantity:p.value,reason:_.value,customReason:_.value==="other"?g.value:""}),A.value=!1,w())};return(S,V)=>{const F=C("el-input"),$=C("el-button"),U=C("el-popover");return r(),E(U,{visible:A.value,"popper-class":"fct-stock-dropdown fct-inventory-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:u(()=>[o("div",{class:"fct-stock-adjuster-trigger",onClick:V[4]||(V[4]=D=>A.value=!A.value)},[s(X,{name:"Configuration"})])]),default:u(()=>[o("div",OY,[o("div",PY,[o("div",HY,[o("span",NY,f(c(d)("Adjust by")),1),s(F,{ref_key:"adjustByInput",ref:y,size:"small",placeholder:c(d)("Quantity"),type:"number",modelValue:p.value,"onUpdate:modelValue":V[0]||(V[0]=D=>p.value=D),modelModifiers:{number:!0},onInput:k},null,8,["placeholder","modelValue"])]),o("div",KY,[o("span",GY,f(c(d)("New Stock")),1),s(F,{size:"small",placeholder:c(d)("New Stock"),type:"number",modelValue:m.value,"onUpdate:modelValue":V[1]||(V[1]=D=>m.value=D),modelModifiers:{number:!0},onInput:b},null,8,["placeholder","modelValue"])])]),s(ma,{visible:!!p.value,accordion:""},{default:u(()=>[o("div",zY,[V[5]||(V[5]=R(" (Original quantity: ",-1)),o("strong",null,f(e.variant.total_stock),1),V[6]||(V[6]=R(") ",-1))])]),_:1},8,["visible"]),o("div",jY,[s(Ef,{ref_key:"reasonDropdownRef",ref:v,modelValue:_.value,"onUpdate:modelValue":V[2]||(V[2]=D=>_.value=D),"onUpdate:customReason":V[3]||(V[3]=D=>g.value=D)},null,8,["modelValue"])]),o("div",qY,[s($,{size:"small",type:"info",soft:"",onClick:w},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s($,{size:"small",type:"primary",onClick:B,disabled:!_.value||i.value,loading:i.value},{default:u(()=>[R(f(c(d)("Apply")),1)]),_:1},8,["disabled","loading"])])])]),_:1},8,["visible"])}}}),YY={class:"fct-inventory-row"},WY={width:"50"},JY={class:"flex items-center gap-1"},XY=["src","alt"],ZY=["src","alt"],eW={class:"fct-inventory-product-content"},tW={class:"fct-inventory-product-title"},aW={key:0},lW={key:0},sW={key:1,class:"text-system-mid dark:text-gray-300"},nW={key:1},oW={key:2},iW={key:3},rW=Object.assign({name:"InventoryTableRow"},{__name:"InventoryTableRow",props:{row:{type:Object,required:!0},inventoryTable:Object,isRowSelected:{type:Function,required:!0},toggleRowSelection:{type:Function,required:!0},navigateToProduct:{type:Function,required:!0},getPlaceholderImage:{type:Function,required:!0}},emits:["stock-save","open-history"],setup(e){return(t,a)=>{var i,A,p,m;const l=C("el-checkbox"),n=C("el-input");return r(),h("tr",YY,[o("td",WY,[o("div",JY,[s(l,{"model-value":e.isRowSelected(e.row.variants[0]),onChange:a[0]||(a[0]=_=>e.toggleRowSelection(e.row.variants[0]))},null,8,["model-value"])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:a[1]||(a[1]=_=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(r(),h("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,XY)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,ZY)),o("div",eW,[o("span",tW,f(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),h("td",aW,[e.row.variants[0].sku?(r(),h("span",lW,f(e.row.variants[0].sku),1)):(r(),h("span",sW,f(c(d)("No SKU")),1))])):x("",!0),o("td",null,[s(n,{modelValue:e.row.variants[0].total_stock,"onUpdate:modelValue":a[3]||(a[3]=_=>e.row.variants[0].total_stock=_),class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:u(()=>[s(Uf,{variant:e.row.variants[0],onSave:a[2]||(a[2]=_=>t.$emit("stock-save",_))},null,8,["variant"])]),_:1},8,["modelValue"])]),(A=e.inventoryTable)!=null&&A.isColumnVisible("available")?(r(),h("td",nW,[o("span",null,f(e.row.variants[0].available),1)])):x("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),h("td",oW,[o("span",null,f(e.row.variants[0].on_hold),1)])):x("",!0),(m=e.inventoryTable)!=null&&m.isColumnVisible("committed")?(r(),h("td",iW,[o("span",null,f(e.row.variants[0].committed),1)])):x("",!0),o("td",null,[s(tt,{tag:"button",size:"small",onClick:a[4]||(a[4]=_=>t.$emit("open-history",e.row.variants[0]))},{default:u(()=>a[5]||(a[5]=[o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M10 2.5C14.1422 2.5 17.5 5.85775 17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85775 17.5 2.5 14.1422 2.5 10H4C4 13.3135 6.6865 16 10 16C13.3135 16 16 13.3135 16 10C16 6.6865 13.3135 4 10 4C7.9375 4 6.118 5.04025 5.03875 6.625H7V8.125H2.5V3.625H4V5.5C5.368 3.6775 7.54675 2.5 10 2.5ZM10.75 6.25V9.68875L13.1823 12.121L12.121 13.1823L9.25 10.3098V6.25H10.75Z",fill:"currentColor"})],-1)])),_:1,__:[5]})])])}}}),dW={class:"fct-inventory-row fct-inventory-parent-row"},uW={width:"50"},cW={class:"fct-inventory-row-selection"},AW=["src","alt"],pW=["src","alt"],fW={class:"fct-inventory-product-content"},mW={class:"fct-inventory-product-title"},hW={key:0},_W={class:"!pl-5"},vW={key:1},gW={key:2},yW={key:3},bW={class:"fct-inventory-variant-item"},wW={class:"fct-inventory-product-info"},CW=["src","alt"],kW=["src","alt"],BW={class:"fct-inventory-product-content"},xW={key:0},SW={key:1},$W={key:2},FW={key:3},EW={key:0,class:"fct-inventory-child-row fct-inventory-load-more-row"},UW=["colspan"],IW=["disabled"],VW={class:"fct-inventory-load-more-count"},Ec=10,DW=Object.assign({name:"InventoryParentTableRow"},{__name:"InventoryParentTableRow",props:{row:{type:Object,required:!0},inventoryTable:Object,navigateToProduct:{type:Function,required:!0},getPlaceholderImage:{type:Function,required:!0},isRowSelected:{type:Function,required:!0},toggleRowSelection:{type:Function,required:!0},expanded:{type:Boolean,default:!0}},emits:["stock-save","open-history","variants-loaded"],setup(e,{emit:t}){Oa();const a=e,l=t,n=M(!0),i=G(()=>n.value);be(()=>a.expanded,D=>{n.value=D});const A=()=>{n.value=!n.value},p=()=>i.value,m=D=>{var I,L;const T=(I=a.row.stock_totals)==null?void 0:I[D];return T??(((L=a.row.variants)==null?void 0:L.reduce((O,Q)=>O+(Q[D]||0),0))||0)},_=G(()=>m("total_stock")),g=G(()=>m("available")),y=G(()=>m("on_hold")),v=G(()=>m("committed")),k=M(!1),b=G(()=>{var D;return((D=a.row.variants)==null?void 0:D.length)||0}),w=G(()=>a.row.variants_total??b.value),B=G(()=>b.value<w.value),S=G(()=>{var I,L;return 3+(((L=(I=a.inventoryTable)==null?void 0:I.getToggleableColumns)==null?void 0:L.call(I))||[]).filter(O=>{var Q;return(Q=a.inventoryTable)==null?void 0:Q.isColumnVisible(O.value)}).length}),V=()=>{if(k.value)return;k.value=!0;const D=a.row.variants||[],T=D.length?D[D.length-1].id:0;ce.get("inventory/variants",{post_id:a.row.ID,after_id:T,page:Math.floor(D.length/Ec)+1,per_page:Ec}).then(I=>{var Q,H;const L=((Q=I==null?void 0:I.variants)==null?void 0:Q.data)||[],O=new Set((a.row.variants||[]).map(K=>K.id));L.forEach(K=>{O.has(K.id)||a.row.variants.push(K)}),((H=I==null?void 0:I.variants)==null?void 0:H.total)!==void 0&&(a.row.variants_total=I.variants.total),l("variants-loaded")}).catch(I=>{var L;I.status_code=="422"?j.validationErrors(I):j.error(((L=I.data)==null?void 0:L.message)||d("Failed to load more variants"))}).finally(()=>{k.value=!1})},F=()=>{const D=a.row.variants||[];return D.length>0&&D.every(T=>a.isRowSelected(T))},$=()=>{const D=a.row.variants||[],T=D.filter(I=>a.isRowSelected(I)).length;return T>0&&T<D.length},U=D=>{var T;(T=a.row.variants)==null||T.forEach(I=>{D!==a.isRowSelected(I)&&a.toggleRowSelection(I)})};return(D,T)=>{var Q,H,K,W;const I=C("el-checkbox"),L=C("router-link"),O=C("el-input");return r(),h(P,null,[o("tr",dW,[o("td",uW,[o("div",cW,[s(I,{"model-value":F(),indeterminate:$(),onChange:U,onClick:T[0]||(T[0]=Ge(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),o("div",{onClick:T[1]||(T[1]=z=>A()),class:"fct-inventory-row-toggle"},[s(X,{name:p()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:T[2]||(T[2]=z=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(r(),h("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,AW)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,pW)),o("div",fW,[o("span",mW,f(e.row.post_title),1)])])]),(Q=e.inventoryTable)!=null&&Q.isColumnVisible("sku")?(r(),h("td",hW,[Jt(o("span",null,"--",512),[[$l,!p()]])])):x("",!0),o("td",_W,[Jt(o("span",null,f(_.value),513),[[$l,!p()]])]),(H=e.inventoryTable)!=null&&H.isColumnVisible("available")?(r(),h("td",vW,[Jt(o("span",null,f(g.value),513),[[$l,!p()]])])):x("",!0),(K=e.inventoryTable)!=null&&K.isColumnVisible("on_hand")?(r(),h("td",gW,[Jt(o("span",null,f(y.value),513),[[$l,!p()]])])):x("",!0),(W=e.inventoryTable)!=null&&W.isColumnVisible("committed")?(r(),h("td",yW,[Jt(o("span",null,f(v.value),513),[[$l,!p()]])])):x("",!0),T[4]||(T[4]=o("td",null,null,-1))]),(r(!0),h(P,null,ae(e.row.variants,z=>{var Y,Z,re,q,Ae;return Jt((r(),h("tr",{key:`child-${z.id}`,class:"fct-inventory-child-row"},[T[6]||(T[6]=o("td",null,null,-1)),o("td",null,[o("div",bW,[s(I,{"model-value":e.isRowSelected(z),onChange:ie=>e.toggleRowSelection(z)},null,8,["model-value","onChange"]),o("div",wW,[z.thumbnail!==null?(r(),h("img",{key:0,src:z.thumbnail,alt:z.variation_title,class:"inventory-thumbnail"},null,8,CW)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:z.variation_title},null,8,kW)),o("div",BW,[s(L,{to:`/products/${z.post_id}`,class:"fct-inventory-product-title"},{default:u(()=>[R(f(z.variation_title),1)]),_:2},1032,["to"])])])])]),(Y=e.inventoryTable)!=null&&Y.isColumnVisible("sku")?(r(),h("td",xW,f(z.sku),1)):x("",!0),o("td",null,[s(O,{modelValue:z.total_stock,"onUpdate:modelValue":ie=>z.total_stock=ie,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:u(()=>[s(Uf,{variant:z,onSave:T[3]||(T[3]=ie=>D.$emit("stock-save",ie))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("available")?(r(),h("td",SW,f(z.available),1)):x("",!0),(re=e.inventoryTable)!=null&&re.isColumnVisible("on_hand")?(r(),h("td",$W,f(z.on_hold),1)):x("",!0),(q=e.inventoryTable)!=null&&q.isColumnVisible("committed")?(r(),h("td",FW,f(z.committed),1)):x("",!0),o("td",null,[s(tt,{tag:"button",size:"small",onClick:ie=>D.$emit("open-history",z)},{default:u(()=>T[5]||(T[5]=[o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M10 2.5C14.1422 2.5 17.5 5.85775 17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85775 17.5 2.5 14.1422 2.5 10H4C4 13.3135 6.6865 16 10 16C13.3135 16 16 13.3135 16 10C16 6.6865 13.3135 4 10 4C7.9375 4 6.118 5.04025 5.03875 6.625H7V8.125H2.5V3.625H4V5.5C5.368 3.6775 7.54675 2.5 10 2.5ZM10.75 6.25V9.68875L13.1823 12.121L12.121 13.1823L9.25 10.3098V6.25H10.75Z",fill:"currentColor"})],-1)])),_:2,__:[5]},1032,["onClick"])])])),[[$l,((Ae=e.row.variants)==null?void 0:Ae.length)>0&&p()]])}),128)),B.value?Jt((r(),h("tr",EW,[T[7]||(T[7]=o("td",null,null,-1)),o("td",{colspan:S.value},[o("button",{class:"fct-inventory-load-more-btn",disabled:k.value,onClick:V},[s(X,{name:"Reload",class:ue({"fct-spin":k.value})},null,8,["class"]),k.value?(r(),h(P,{key:0},[R(f(c(d)("Loading...")),1)],64)):(r(),h(P,{key:1},[R(f(c(d)("Load More"))+" ",1),o("span",VW,"("+f(b.value)+"/"+f(w.value)+")",1)],64))],8,IW)],8,UW)],512)),[[$l,i.value]]):x("",!0)],64)}}}),TW={class:"fct-adjustment-header"},QW={class:"fct-adjustment-product-name"},MW={key:0,class:"fct-adjustment-timeline-wrap"},LW={key:0,class:"fct-adjustment-timeline"},RW={class:"fct-timeline-node"},OW={class:"fct-timeline-content"},PW={class:"fct-timeline-header"},HW={class:"fct-timeline-time"},NW={class:"fct-stock-flow"},KW={class:"fct-stock-flow-item"},GW={class:"fct-stock-entry"},zW={class:"fct-stock-label"},jW={class:"fct-stock-value"},qW={class:"fct-stock-entry new-stock-entry"},YW={class:"fct-stock-label"},WW={class:"fct-stock-value"},JW={class:"fct-stock-flow-item"},XW={class:"fct-stock-label"},ZW={key:0,class:"fct-custom-reason-section"},eJ={class:"fct-stock-label"},tJ={class:"fct-custom-reason-text"},aJ={key:1,class:"fct-timeline-empty"},lJ={key:1,class:"fct-timeline-loading"},sJ=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=M(!1),l=M(!1),n=M({id:null,name:""}),i=M([]),A=()=>{a.value=!1,i.value=[]},p=y=>{n.value=y,a.value=!0,m(y.id)},m=y=>{y&&(l.value=!0,ce.get("inventory/adjustment-history",{variant_id:y}).then(v=>{i.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{j.error(d("Failed to load adjustment history"))}).finally(()=>{l.value=!1}))},_=y=>y>0?"positive":y<0?"negative":"",g=y=>y>0?`+${y}`:`${y}`;return t({openHistory:p}),(y,v)=>{const k=C("el-drawer");return r(),E(k,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=b=>a.value=b),title:c(d)("Stock Adjustment History"),onClose:A},{default:u(()=>[o("div",TW,[o("h3",QW,f(n.value.name),1)]),l.value?(r(),h("div",lJ,[o("p",null,f(c(d)("Loading adjustment history...")),1)])):(r(),h("div",MW,[i.value.length>0?(r(),h("div",LW,[(r(!0),h(P,null,ae(i.value,(b,w)=>(r(),h("div",{key:w,class:"fct-timeline-item"},[o("div",RW,[o("span",{class:ue(["fct-node-dot",`node-${b.reason}`])},null,2)]),o("div",OW,[o("div",PW,[o("span",HW,[s(Sa,{"date-time":b.created_at},null,8,["date-time"]),R(" (by "+f(b.user_name)+") ",1)]),o("span",{class:ue(["fct-timeline-reason-badge",`badge-${b.reason}`])},f(b.reason_label),3)]),o("div",NW,[o("div",KW,[o("div",GW,[o("span",zW,f(c(d)("Previous Stock:")),1),o("span",jW,f(b.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",qW,[o("span",YW,f(c(d)("New Stock:")),1),o("span",WW,f(b.new_stock),1)])]),o("div",JW,[o("span",XW,f(c(d)("Change:")),1),o("span",{class:ue(["fct-stock-value fct-stock-change",_(b.change)])},f(g(b.change))+" "+f(c(d)("units")),3)]),b.reason==="other"&&b.custom_reason?(r(),h("div",ZW,[o("span",eJ,f(c(d)("Details:")),1),o("p",tJ,f(b.custom_reason),1)])):x("",!0)])])]))),128))])):(r(),h("div",aJ,[s(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),nJ={class:"fct-bulk-modal-content"},oJ={class:"fct-inventory-mode-selection"},iJ={class:"fct-inventory-input-section"},rJ={key:0,class:"fct-inventory-mode-hint"},dJ={class:"fct-inventory-selected-items"},uJ={class:"fct-inventory-selected-items-count"},cJ={key:0,class:"fct-inventory-selected-items-preview"},AJ={class:"fct-inventory-selected-item-header"},pJ={class:"variant-title"},fJ={class:"total-stock"},mJ={class:"fct-inventory-selected-item-list"},hJ={class:"fct-inventory-selected-item-info"},_J={class:"fct-inventory-selected-item-title"},vJ={class:"fct-inventory-selected-item-stock-action"},gJ={class:"total-stock"},yJ={class:"stock-arrow"},bJ={class:"bulk-stock-value"},wJ={class:"fct-inventory-adjustment-reason"},CJ={class:"dialog-footer"},kJ=Object.assign({name:"InventoryBulkAdjustModal"},{__name:"InventoryBulkAdjustModal",props:{selectedItems:{type:Array,required:!0}},emits:["bulk-update-success","close"],setup(e,{expose:t,emit:a}){const l=e,n=a,i=M(!1),A=M("add"),p=M(null),m=M(""),_=M(""),g=B=>A.value==="add"?B.total_stock+p.value:p.value,y=B=>p.value!==null&&p.value!==""&&g(B)!==B.total_stock,v=()=>{b(),i.value=!1},k=()=>{const B={mode:A.value,value:p.value,reason:m.value,customReason:m.value==="other"?_.value:"",items:l.selectedItems.map(S=>({id:S.id,post_id:S.post_id}))};ce.post("inventory/bulk-update",B).then(()=>{j.success(d("Stock updated successfully")),b(),i.value=!1,n("bulk-update-success")}).catch(S=>{var V;S.status_code===422?j.validationErrors(S):j.error(((V=S.data)==null?void 0:V.message)||d("Failed to update stock"))})},b=()=>{p.value=null,A.value="add",m.value="",_.value=""};return t({openModal:()=>{b(),i.value=!0}}),(B,S)=>{const V=C("el-radio"),F=C("el-radio-group"),$=C("el-input"),U=C("el-button"),D=C("el-dialog");return r(),E(D,{modelValue:i.value,"onUpdate:modelValue":S[4]||(S[4]=T=>i.value=T),title:c(d)("Update Stocks")},{default:u(()=>{var T;return[o("div",nJ,[o("div",oJ,[s(F,{modelValue:A.value,"onUpdate:modelValue":S[0]||(S[0]=I=>A.value=I),class:"fct-mode-radio-group"},{default:u(()=>[s(V,{value:"add"},{default:u(()=>[R(f(c(d)("Increase Stock")),1)]),_:1}),s(V,{value:"set"},{default:u(()=>[R(f(c(d)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),o("div",iJ,[s(Ot,{title:A.value==="add"?c(d)("Increase Stock by"):c(d)("Exact new stock"),content:A.value==="add"?c(d)("Increase stock by value (e.g. 10 + 5 = 15)"):c(d)("Set stock to exact value (e.g. 10 → 20)")},null,8,["title","content"]),s($,{modelValue:p.value,"onUpdate:modelValue":S[1]||(S[1]=I=>p.value=I),modelModifiers:{number:!0},type:"number",placeholder:A.value==="add"?c(d)("Enter amount to add"):c(d)("Enter exact stock value")},null,8,["modelValue","placeholder"]),A.value==="set"?(r(),h("div",rJ,[s(X,{name:"Warning"}),R(" "+f(c(d)("Replaces current inventory")),1)])):x("",!0)]),o("div",dJ,[o("div",uJ,f(e.selectedItems.length)+" "+f(c(d)("variants will be changed:")),1),(T=e.selectedItems)!=null&&T.length?(r(),h("div",cJ,[o("div",AJ,[o("span",pJ,f(c(d)("Variant")),1),o("span",fJ,f(c(d)("Stock Change")),1)]),o("ul",mJ,[(r(!0),h(P,null,ae(e.selectedItems,I=>(r(),h("li",{key:I.id},[o("div",hJ,[o("span",_J,f(I.variation_title),1)]),o("div",vJ,[o("span",gJ,f(I.total_stock),1),y(I)?(r(),h(P,{key:0},[o("span",yJ,[s(X,{name:"ArrowRight"})]),o("span",bJ,f(g(I)),1)],64)):x("",!0)])]))),128))])])):x("",!0)]),o("div",wJ,[s(Ef,{modelValue:m.value,"onUpdate:modelValue":S[2]||(S[2]=I=>m.value=I),"onUpdate:customReason":S[3]||(S[3]=I=>_.value=I)},null,8,["modelValue"])]),o("div",CJ,[s(U,{onClick:v},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(U,{type:"primary",onClick:k,disabled:!m.value},{default:u(()=>[R(f(c(d)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),BJ={class:"fct-advanced-inventory-table"},xJ={class:"fct-inventory-toolbar-wrap"},SJ={key:0,class:"fct-inventory-toolbar-selected"},$J={class:"fct-inventory-toolbar-actions ml-auto"},FJ={key:0,class:"fct-advanced-inventory-table-wrap"},EJ={class:"fct-advanced-inventory-table"},UJ={key:0,width:"150"},IJ={key:1,width:"100"},VJ={key:2,width:"100"},DJ={key:3,width:"100"},TJ={width:"50"},QJ={key:0},MJ={key:1},LJ={key:2},RJ={key:3},Uc=Object.assign({name:"InventoryTable"},{__name:"InventoryTable",props:{data:{type:Array,default:()=>[]},inventoryTable:Object},emits:["stock-save","bulk-update-success","selection-changed"],setup(e,{emit:t}){const a=Oa(),l=e,n=t,i=M([]),A=M(!1),p=M(!1),m=M(null),_=M(null),g=M(!0);be(i,D=>{n("selection-changed",{selectedItems:D,count:D.length})},{deep:!0});const y=D=>D.post_id?`variant-${D.id}`:`product-${D.id}`,v=D=>{a.push({name:"product_edit",params:{product_id:D}})},k=()=>{_.value&&_.value.openModal()},b=()=>{i.value=[],F(),n("bulk-update-success")},w=()=>l.data.flatMap(D=>D.variants&&D.variants.length>0?D.variants:[D]),B=D=>{D?i.value=w():i.value=[],F()},S=D=>{const T=i.value.findIndex(I=>I.id===D.id);T>-1?i.value.splice(T,1):i.value.push(D),F()},V=D=>i.value.some(T=>T.id===D.id),F=()=>{const D=w(),T=i.value.length;T===0?(A.value=!1,p.value=!1):T===D.length?(A.value=!0,p.value=!1):(A.value=!1,p.value=!0)},$=D=>{m.value&&m.value.openHistory({id:D.id,name:D.variation_title||D.post_title})},U=()=>{g.value=!g.value};return(D,T)=>{var O,Q,H,K,W,z,Y,Z;const I=C("el-button"),L=C("el-checkbox");return r(),h("div",BJ,[o("div",xJ,[i.value.length>0?(r(),h("div",SJ,f(i.value.length)+" "+f(c(d)("selected")),1)):x("",!0),o("div",$J,[i.value.length>0?(r(),E(I,{key:0,type:"primary",size:"small",onClick:k},{default:u(()=>[R(f(c(d)("Update Stocks")),1)]),_:1})):x("",!0),s(I,{class:"fct-expand-row-button",size:"small",onClick:U},{default:u(()=>[s(X,{name:g.value?"Expand":"Collapse"},null,8,["name"]),R(" "+f(g.value?c(d)("Collapse All"):c(d)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),h("div",FJ,[o("table",EJ,[o("colgroup",null,[T[3]||(T[3]=o("col",{width:"50"},null,-1)),T[4]||(T[4]=o("col",null,null,-1)),(O=e.inventoryTable)!=null&&O.isColumnVisible("sku")?(r(),h("col",UJ)):x("",!0),T[5]||(T[5]=o("col",{width:"160"},null,-1)),(Q=e.inventoryTable)!=null&&Q.isColumnVisible("available")?(r(),h("col",IJ)):x("",!0),(H=e.inventoryTable)!=null&&H.isColumnVisible("on_hand")?(r(),h("col",VJ)):x("",!0),(K=e.inventoryTable)!=null&&K.isColumnVisible("committed")?(r(),h("col",DJ)):x("",!0),T[6]||(T[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",TJ,[s(L,{modelValue:A.value,"onUpdate:modelValue":T[0]||(T[0]=re=>A.value=re),indeterminate:p.value,onChange:B},null,8,["modelValue","indeterminate"])]),o("th",null,f(c(d)("Products")),1),(W=e.inventoryTable)!=null&&W.isColumnVisible("sku")?(r(),h("th",QJ,f(c(d)("SKU")),1)):x("",!0),o("th",null,f(c(d)("Total Stock")),1),(z=e.inventoryTable)!=null&&z.isColumnVisible("available")?(r(),h("th",MJ,f(c(d)("Available")),1)):x("",!0),(Y=e.inventoryTable)!=null&&Y.isColumnVisible("on_hand")?(r(),h("th",LJ,f(c(d)("On hold")),1)):x("",!0),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("committed")?(r(),h("th",RJ,f(c(d)("Delivered")),1)):x("",!0),T[7]||(T[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,ae(e.data,re=>(r(),h(P,{key:y(re)},[!re.variants||re.variants.length===1?(r(),E(rW,{key:0,row:re,"inventory-table":e.inventoryTable,"is-row-selected":V,"toggle-row-selection":S,"navigate-to-product":v,"get-placeholder-image":D.getPlaceholderImage,onStockSave:T[1]||(T[1]=q=>n("stock-save",q)),onOpenHistory:$},null,8,["row","inventory-table","get-placeholder-image"])):x("",!0),re.variants&&re.variants.length>1?(r(),E(DW,{key:1,row:re,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":D.getPlaceholderImage,"is-row-selected":V,"toggle-row-selection":S,expanded:g.value,onStockSave:T[2]||(T[2]=q=>n("stock-save",q)),onOpenHistory:$,onVariantsLoaded:F},null,8,["row","inventory-table","get-placeholder-image","expanded"])):x("",!0)],64))),128))])])])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("No inventory data")},null,8,["text"])),s(kJ,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:b},null,8,["selected-items"]),s(sJ,{ref_key:"historyRef",ref:m},null,512)])}}}),OJ={class:"fct-advanced-inventory-table"},PJ={class:"fct-inventory-toolbar-wrap"},HJ={class:"fct-inventory-toolbar-actions ml-auto"},NJ={class:"fct-advanced-inventory-table-wrap"},KJ={class:"fct-advanced-inventory-table"},GJ={key:0,width:"150"},zJ={key:1,width:"100"},jJ={key:2,width:"100"},qJ={key:3,width:"100"},YJ={width:"50"},WJ={key:0},JJ={key:1},XJ={key:2},ZJ={key:3},eX={class:"fct-product-info-card"},tX={class:"fct-product-info-media"},aX={class:"fct-product-info-details"},lX={key:0},sX={key:1},nX={key:2},oX={key:3},iX={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=G(()=>Array.from({length:t.nextPageCount/2},(l,n)=>n+1));return(l,n)=>{const i=C("el-skeleton-item"),A=C("el-skeleton");return r(),E(A,{animated:""},{template:u(()=>{var p,m,_,g,y,v,k,b;return[o("div",OJ,[o("div",PJ,[o("div",HJ,[s(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",NJ,[o("table",KJ,[o("colgroup",null,[n[0]||(n[0]=o("col",{width:"50"},null,-1)),n[1]||(n[1]=o("col",null,null,-1)),(p=e.inventoryTable)!=null&&p.isColumnVisible("sku")?(r(),h("col",GJ)):x("",!0),n[2]||(n[2]=o("col",{width:"160"},null,-1)),(m=e.inventoryTable)!=null&&m.isColumnVisible("available")?(r(),h("col",zJ)):x("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),h("col",jJ)):x("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",qJ)):x("",!0),n[3]||(n[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",YJ,[s(i,{variant:"p",class:"w-4 h-4"})]),o("th",null,[s(i,{variant:"p",class:"w-20"})]),(y=e.inventoryTable)!=null&&y.isColumnVisible("sku")?(r(),h("th",WJ,[s(i,{variant:"p",class:"w-10"})])):x("",!0),o("th",null,[s(i,{variant:"p",class:"w-24"})]),(v=e.inventoryTable)!=null&&v.isColumnVisible("available")?(r(),h("th",JJ,[s(i,{variant:"p",class:"w-20"})])):x("",!0),(k=e.inventoryTable)!=null&&k.isColumnVisible("on_hand")?(r(),h("th",XJ,[s(i,{variant:"p",class:"w-16"})])):x("",!0),(b=e.inventoryTable)!=null&&b.isColumnVisible("committed")?(r(),h("th",ZJ,[s(i,{variant:"p",class:"w-20"})])):x("",!0),n[4]||(n[4]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,ae(a.value,w=>{var B,S,V,F;return r(),h("tr",{key:w},[o("td",null,[s(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",eX,[o("div",tX,[s(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",aX,[s(i,{variant:"p",class:"max-w-[180px]"})])])]),(B=e.inventoryTable)!=null&&B.isColumnVisible("sku")?(r(),h("td",lX,[s(i,{variant:"p",class:"w-20"})])):x("",!0),o("td",null,[s(i,{variant:"p",class:"w-16"})]),(S=e.inventoryTable)!=null&&S.isColumnVisible("available")?(r(),h("td",sX,[s(i,{variant:"p",class:"w-10"})])):x("",!0),(V=e.inventoryTable)!=null&&V.isColumnVisible("on_hand")?(r(),h("td",nX,[s(i,{variant:"p",class:"w-10"})])):x("",!0),(F=e.inventoryTable)!=null&&F.isColumnVisible("committed")?(r(),h("td",oX,[s(i,{variant:"p",class:"w-10"})])):x("",!0),n[5]||(n[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},rX={class:"fct-module-disabled-notice"},dX={class:"fct-disabled-notice-title"},uX={class:"fct-disabled-notice-text"},cX=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=C("el-icon"),n=C("router-link");return r(),h("div",rX,[s(l,{class:"fct-disabled-notice-icon"},{default:u(()=>[s(c(cA))]),_:1}),o("h3",dX,f(c(d)("Stock Management Inactive")),1),o("p",uX,[R(f(c(d)("Stock Management module is currently disabled. Please enable it in "))+" ",1),s(n,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("module settings")),1)]),_:1}),R(" "+f(c(d)(" to use inventory features.")),1)])])}}});class AX extends ds{getTabs(){return{all:d("All"),low_stock:d("Low Stock"),out_of_stock:d("Out of Stock")}}getToggleableColumns(){return[{label:d("SKU"),value:"sku"},{label:d("Available"),value:"available"},{label:d("On hold"),value:"on_hand"},{label:d("Committed"),value:"committed"}]}getSortableColumns(){return[{label:d("Product ID"),value:"id"},{label:d("Product Title"),value:"post_title"}]}getSearchHint(){return d("Search by product name, variation name or SKU")}getFetchUrl(){return"inventory"}parseResponse(t){return t.products||[]}getTableName(){return"inventory_table"}getAdvanceFilterOptions(){var t,a,l;return((l=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:l.advance)||null}getSearchGuideOptions(){return{}}getCustomColumns(){return{}}with(){return["admin_inventory_list_v2"]}}function pX(e){return AX.init(e)}const fX={class:"fct-all-inventory-page fct-layout-width"},mX={class:"fct-inventory-wrap"},hX={key:2,class:"py-10"},_X={class:"fct-pro-feature-text"},vX=Object.assign({name:"AdvancedInventory"},{__name:"Inventory",setup(e){const t=Ke.get("app_config"),a=G(()=>t==null?void 0:t.isProActive),l=Ke.get("modules_settings"),n=G(()=>{var V;return((V=l==null?void 0:l.stock_management)==null?void 0:V.active)==="yes"}),i=G(()=>{var V;return((V=l==null?void 0:l.stock_management)==null?void 0:V.enable_advanced_inventory)==="yes"}),A=G(()=>a.value&&n.value&&i.value),p=pX({instance:aa(),fetch:!1}),m=M(0),_=M([]),g=V=>{m.value=V.count,_.value=V.selectedItems||[]},y=()=>{p.fetch()},v=new Map,k=Ds(new Set);pi("fctPendingStockSaves",k);const b=V=>{const{variant:F,newStock:$,reason:U,customReason:D}=V,T=parseInt($);if(isNaN(T)||T<0){j.error(d("Please enter a valid stock quantity"));return}const I={variantId:F.id,postId:F.post_id,newStock:T,reason:U,customReason:D||""},L=v.get(I.postId)||{inFlight:!1,pending:new Map};if(v.set(I.postId,L),k.add(I.variantId),L.inFlight){L.pending.set(I.variantId,I);return}L.inFlight=!0,S(I,L)},w=V=>p.getTableData().find(F=>F.ID===V),B=(V,F,$)=>{var D;const U=w(V);return((D=U==null?void 0:U.variants)==null?void 0:D.find(T=>T.id===F))||$},S=(V,F)=>{ce.post("inventory/update-stock",{variant_id:V.variantId,post_id:V.postId,new_stock:V.newStock,reason:V.reason,customReason:V.customReason}).then($=>{const U=B(V.postId,V.variantId,null);if(U){const D=parseInt($.new_stock);if(U.total_stock=isNaN(D)?V.newStock:D,$.available!==void 0)U.available=parseInt($.available)||0;else{const T=U.total_stock-(parseInt(U.committed)||0)-(parseInt(U.on_hold)||0);U.available=T<0?0:T}}if($.stock_totals){const D=w(V.postId);D&&D.stock_totals&&(D.stock_totals=$.stock_totals)}j.success($.message?d($.message):d("Stock updated successfully"))}).catch($=>{var U;F.pending.has(V.variantId)||(($==null?void 0:$.status_code)=="422"?j.validationErrors($):j.error(((U=$==null?void 0:$.data)==null?void 0:U.message)||d("Failed to update stock")))}).finally(()=>{if(!F.pending.has(V.variantId)){k.delete(V.variantId);const U=B(V.postId,V.variantId,null);U&&(U.stock_save_pending=!1)}const $=F.pending.entries().next().value;$?(F.pending.delete($[0]),S($[1],F)):(F.inFlight=!1,v.delete(V.postId))})};return Te(()=>{A.value&&p.fetch()}),(V,F)=>{const $=C("router-link");return r(),h("div",fX,[s(Xa,{title:c(d)("Inventory")},{action:u(()=>[s(Lt,{permission:"products/view"})]),_:1},8,["title"]),A.value?(r(),E(Lt,{key:0,permission:"products/view"},{default:u(()=>[o("div",mX,[s(us,{table:c(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[s(Uc,{data:c(p).getTableData(),"inventory-table":c(p),onStockSave:b,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:u(()=>[c(p).isLoading()?(r(),E(iX,{key:0,"next-page-count":c(p).nextPageCount,"inventory-table":c(p)},null,8,["next-page-count","inventory-table"])):(r(),E(Uc,{key:1,data:c(p).getTableData(),"inventory-table":c(p),onStockSave:b,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):n.value?(r(),h("div",hX,[s(cs,{placement:"feature_lock_advanced_inventory",title:c(d)("Advanced Inventory")},{default:u(()=>[o("p",_X,[R(f(c(d)("This feature is only available in FluentCart Pro with "))+" ",1),s($,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),E(cX,{key:1}))])}}}),gX={class:"setting-wrap"},yX={class:"setting-wrap-inner"},bX={key:0,class:"fct-all-notification-table-wrap"},wX={class:"fct-card-header"},CX={class:"w-full pb-2"},kX={class:"flex items-center justify-between gap-2 pb-2"},BX={class:"flex-1"},xX={style:{width:"120px"}},SX={class:"flex items-center justify-between gap-3",style:{width:"220px"}},$X={key:1,class:"fct-all-notification-table-wrap"},FX=["id"],EX={class:"fct-card-header"},UX={class:"w-full pb-2"},IX={class:"flex items-center justify-between gap-2 pb-2"},VX={class:"fct-card-header-title"},DX={class:"text-xs text-system-mid dark:text-gray-300"},TX={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},QX={class:"fct-card-body px-0 pb-0 pt-0"},MX={class:"m-0 mb-1"},LX={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},RX={class:"m-0 text-sm"},OX={class:"fct-all-notification-actions flex items-center justify-between gap-3"},PX={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},HX={class:"fct-btn-group sm flex-shrink-0"},NX={__name:"EmailNotificationSettings",setup(e){const t=Pa(),a=M(!0),l=M([]),n=G(()=>{if(!l.value.length)return[];const p={};return l.value.forEach(m=>{const _=(m==null?void 0:m.group)||"other";p[_]||(p[_]={key:_,label:(m==null?void 0:m.group_label)||d("Other Actions"),items:[]}),p[_].items.push(m)}),Object.values(p)}),i=()=>{a.value=!0,ce.get("email-notification").then(p=>{l.value=Object.values(p.data)}).catch(p=>{}).finally(()=>{a.value=!1,$e(()=>{requestAnimationFrame(()=>Rs.scrollToHashSection(t.hash))})})},A=(p,m)=>{ce.post("email-notification/enable-notification/"+m,{active:p}).then(_=>{j.success(_.message)}).catch(_=>{var g;_.status_code=="422"?j.validationErrors(_):j.error((g=_.data)==null?void 0:g.message)}).finally(()=>{})};return Te(()=>{i()}),(p,m)=>{const _=C("el-skeleton-item"),g=C("el-skeleton"),y=C("router-link"),v=C("el-table-column"),k=C("el-switch"),b=C("el-tooltip"),w=C("el-table");return r(),h("div",gX,[s($a,{heading:c(d)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",yX,[s(Fa),a.value?(r(),h("div",bX,[(r(),h(P,null,ae(2,B=>o("div",{key:B,class:"fct-card fct-notification-group mb-4 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[s(g,{animated:""},{template:u(()=>[o("div",wX,[o("div",CX,[o("div",kX,[s(_,{variant:"text",style:{width:"140px",height:"16px"}}),s(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(P,null,ae(4,S=>o("div",{key:S,class:"flex items-center gap-4 px-4 py-4 border-t border-solid border-x-0 border-b-0 border-gray-divider dark:border-dark-400"},[o("div",BX,[s(_,{variant:"text",style:{width:"50%",height:"14px",display:"block","margin-bottom":"8px"}}),s(_,{variant:"text",style:{width:"75%",height:"12px",display:"block"}})]),o("div",xX,[s(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",SX,[s(_,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px",display:"block"}}),s(_,{variant:"text",style:{width:"28px",height:"28px","border-radius":"6px",display:"block"}})])])),64))]),_:1})])),64))])):(r(),h("div",$X,[n.value.length?(r(!0),h(P,{key:0},ae(n.value,B=>(r(),h("div",{key:B.key,id:B.key,class:"fct-card fct-notification-group overflow-hidden"},[o("div",EX,[o("div",UX,[o("div",IX,[o("h4",VX,f(B.label),1),o("span",DX,f(B.items.length)+" "+f(c(d)("Notifications")),1)]),B.key==="scheduler"?(r(),h("p",TX,[R(f(c(d)("This notification trigger is controlled from the Reminders section. You can configure it from"))+" ",1),s(y,{to:{path:"/settings/email_mailing_settings/reminders"},class:"underline hover:no-underline font-medium text-inherit hover:text-inherit"},{default:u(()=>[R(f(c(d)("reminder settings")),1)]),_:1})])):x("",!0)])]),o("div",QX,[s(w,{data:B.items,"show-header":!0},{default:u(()=>[s(v,{prop:"title",label:c(d)("Notification Name"),"min-width":"320"},{default:u(S=>[o("h4",MX,f(S.row.title),1),o("p",LX,f(S.row.description),1)]),_:1},8,["label"]),s(v,{prop:"recipient",label:c(d)("Recipient"),"min-width":"120"},{default:u(S=>[o("p",RX,f(c(Aa).headline(S.row.recipient)),1)]),_:1},8,["label"]),s(v,{label:c(d)("Enabled"),"min-width":"220"},{default:u(S=>{var V,F,$;return[o("div",OX,[((V=S.row)==null?void 0:V.manage_toggle)!=="no"?(r(),E(k,{key:0,onChange:U=>A(U,S.row.name),modelValue:S.row.settings.active,"onUpdate:modelValue":U=>S.row.settings.active=U,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):x("",!0),((F=S.row)==null?void 0:F.manage_toggle)==="no"?(r(),h("span",PX,f((($=S.row)==null?void 0:$.toggle_label)||c(d)("Auto-enabled")),1)):x("",!0),o("div",HX,[s(b,{effect:"dark",content:c(d)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{to:{name:"email_notifications/edit",params:{name:S.row.name}},size:"x-small",hover:"primary"},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])])],8,FX))),128)):(r(),E(wt,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:c(d)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},KX={__name:"ProVersionGuard",props:{minVersion:{type:String,required:!0},featureTitle:{type:String,default:""},featureText:{type:String,default:""},placement:{type:String,default:"upgrade_page"}},setup(e){const t=e,a=Ke.get("app_config.isProActive"),l=Ke.get("app_config.proVersion"),n=a&&l&&l.localeCompare(t.minVersion,void 0,{numeric:!0})<0,i=d("This feature requires FluentCart Pro v%s or later. Please update FluentCart Pro to use this feature.").replace("%s",t.minVersion);return(A,p)=>{const m=C("el-alert");return c(a)&&!c(n)?wa(A.$slots,"default",{key:0}):c(n)?(r(),E(m,{key:1,type:"warning","show-icon":"",closable:!1,title:c(d)("Update Required"),description:c(i)},null,8,["title","description"])):(r(),E(cs,{key:2,title:e.featureTitle,text:e.featureText,placement:e.placement},null,8,["title","text","placement"]))}}},GX={class:"setting-wrap fct-edit-email-notification-wrapper"},zX={class:"capitalize"},jX={class:"setting-wrap-inner"},qX={class:"mb-5"},YX={class:"setting-switcher flex items-center gap-3"},WX={class:"text-sm text-system-dark dark:text-gray-50"},JX={class:"fct-card p-6"},XX={class:"mb-5"},ZX={class:"el-form-item__label block mb-2"},eZ={class:"mb-5"},tZ={class:"el-form-item__label block mb-2"},aZ={class:"el-form-item__label block mb-2"},lZ={class:"mb-5"},sZ={key:0,class:"setting-switcher"},nZ={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},oZ={class:"fct-seg-wrap"},iZ={key:0,class:"fct-default-template-preview"},rZ={class:"el-form-item__label"},dZ={key:1,class:"fct-default-template-frame"},uZ=["srcdoc"],cZ={key:0,class:"el-form-item__label"},AZ={key:1,class:"text-system-mid mb-3"},pZ={key:2,class:"mb-4"},fZ={class:"setting-save-action"},mZ={key:0,style:{height:"300px"}},hZ={class:"fct-preview-toolbar"},_Z={class:"fct-preview-device-toggle"},vZ={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=Ke.get("app_config.isProActive"),a=e,l=M(!1),n=M(!1),i=M(a.name),A=M({title:"",description:"",event:"",name:"",recipient:"",smartcode_groups:[],template_path:"",is_async:!1,settings:{active:"",is_default_body:"yes",email_body:"",subject:"",attach_pdf_template:""}}),p=M(null),m=M({}),_=M([]),g=M(),y=(z,Y={})=>!z||typeof z!="object"?[]:(z.schema?[[z.form_name||"form",z]]:Object.entries(z)).filter(([,re])=>(re==null?void 0:re.schema)&&Object.keys(re.schema).length).map(([re,q])=>({...q,form_key:re,values:{...q.values||{},...Y[re]||{}}})),v=()=>{const Y=[].concat(g.value||[]).reduce((Z,re)=>typeof(re==null?void 0:re.getState)=="function"?{...Z,...re.getState()}:Z,{});return Object.keys(Y).length?{[i.value]:Y}:null},k=M(!1),b=M(!1),w=M([]),B=M(!1),S=M(!1),V=M(""),F=M("desktop"),$=M(null),U=()=>{B.value=!0,S.value=!0,V.value="",ce.post("email-notification/preview",{notification_name:i.value,block_content:A.value.settings.email_body||""}).then(z=>{V.value=z.html,S.value=!1,$e(()=>D())}).catch(z=>{var Y;j.error(((Y=z.data)==null?void 0:Y.message)||"Failed to generate preview"),B.value=!1,S.value=!1})},D=()=>{const z=$.value;if(!z||!V.value)return;const Y=z.contentDocument||z.contentWindow&&z.contentWindow.document;Y&&(Y.open(),Y.write(V.value),Y.close())},T=()=>{$e(()=>{V.value&&D()})},I=()=>{B.value=!1,V.value="",F.value="desktop"},L=M(""),O=M(!1),Q=()=>{var Y;const z=(Y=A.value)==null?void 0:Y.template_path;!z||L.value||(O.value=!0,ce.post("email-notification/preview-default-template",{template:z}).then(Z=>{var re;L.value=((re=Z.data)==null?void 0:re.content)||""}).catch(()=>{}).finally(()=>{O.value=!1}))};be(()=>A.value.settings.is_default_body,z=>{z==="yes"&&!L.value&&Q()});const H=z=>{A.value.settings.subject+=z},K=()=>{l.value=!0,ce.get("email-notification/"+i.value).then(z=>{var Z;A.value=z.data,m.value=z.shortcodes,b.value=z.has_fluent_pdf||!1,w.value=z.pdf_templates||[];const Y=((Z=A.value.settings.extra)==null?void 0:Z[i.value])||{};_.value=y(A.value.extra_fields,Y),A.value.settings.is_default_body==="yes"&&Q()}).catch(z=>{var Y;z.status_code=="422"?j.validationErrors(z):j.error((Y=z.data)==null?void 0:Y.message)}).finally(()=>{l.value=!1})},W=()=>{n.value=!0;const z=JSON.parse(JSON.stringify(A.value)),Y=v();Y&&(z.settings.extra=Y),z.settings.is_default_body==="no"&&p.value&&p.value.forceAutosave(),ce.put("email-notification/"+i.value,z).then(Z=>{j.success(Z.message)}).catch(Z=>{var re;Z.status_code=="422"?j.validationErrors(Z):j.error((re=Z.data)==null?void 0:re.message)}).finally(()=>{n.value=!1})};return Te(()=>{K()}),(z,Y)=>{var Se;const Z=C("el-breadcrumb-item"),re=C("el-breadcrumb"),q=C("el-skeleton-item"),Ae=C("el-skeleton"),ie=C("el-switch"),J=C("el-input"),N=C("el-form-item"),le=C("el-form"),ee=C("el-option"),pe=C("el-select"),de=C("el-button"),Ue=C("el-drawer"),Ce=Qa("loading");return r(),h("div",GX,[s($a,{loading:n.value,"loading-text":c(d)("Updating"),"save-button-text":c(d)("Update"),onOnSave:W},{heading:u(()=>[s(re,{class:"mb-0","separator-icon":c(Za)},{default:u(()=>[s(Z,{to:{path:"/settings/email_notifications"}},{default:u(()=>[R(f(z.$t("Email Notifications")),1)]),_:1}),s(Z,null,{default:u(()=>[o("span",zX,f(A.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",jX,[s(Fa),l.value?(r(),E(Ae,{key:0,animated:""},{template:u(()=>[o("div",qX,[o("div",YX,[s(q,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",WX,f(c(d)("Enable this email notification!")),1)])]),o("div",JX,[o("div",XX,[o("label",ZX,f(c(d)("Email Subject")),1),s(q,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",eZ,[o("label",tZ,f(c(d)("Email Body Type")),1),s(q,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",aZ,f(c(d)("Email Body")),1),s(Cr)])])]),_:1})):x("",!0),l.value?x("",!0):(r(),h(P,{key:1},[o("div",lZ,[((Se=A.value)==null?void 0:Se.manage_toggle)!=="no"?(r(),h("div",sZ,[s(ie,{modelValue:A.value.settings.active,"onUpdate:modelValue":Y[0]||(Y[0]=ge=>A.value.settings.active=ge),"active-value":"yes","inactive-value":"no","active-text":c(d)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",nZ,f(c(d)("Auto-enabled for offline payments")),1))]),s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(le,{"label-position":"top"},{default:u(()=>[s(N,{label:c(d)("Email Subject")},{default:u(()=>[s(J,{modelValue:A.value.settings.subject,"onUpdate:modelValue":Y[1]||(Y[1]=ge=>A.value.settings.subject=ge),autocomplete:"rutjfkde",class:ue({"is-focus":k.value}),onFocus:Y[2]||(Y[2]=ge=>k.value=!0),onBlur:Y[3]||(Y[3]=ge=>k.value=!1),label:c(d)("Email Subject")},{append:u(()=>[s(kA,{data:m.value,onCommand:H,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:u(()=>[R(f(c(d)("Add ShortCodes")),1)]),_:1},8,["data"])]),_:1},8,["modelValue","class","label"])]),_:1},8,["label"]),s(N,{label:c(d)("Email Body Type")},{default:u(()=>[o("div",oZ,[o("button",{type:"button",class:ue(["fct-seg-btn",{active:A.value.settings.is_default_body==="yes"}]),onClick:Y[4]||(Y[4]=ge=>A.value.settings.is_default_body="yes")},[Y[13]||(Y[13]=o("svg",{class:"fct-seg-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o("path",{d:"M9 9h6M9 13h6M9 17h4"})],-1)),R(" "+f(c(d)("Default Body")),1)],2),o("button",{type:"button",class:ue(["fct-seg-btn",{active:A.value.settings.is_default_body==="no"}]),onClick:Y[5]||(Y[5]=ge=>A.value.settings.is_default_body="no")},[Y[14]||(Y[14]=o("svg",{class:"fct-seg-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M12 20h9"}),o("path",{d:"M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),R(" "+f(c(d)("Customized Body"))+" ",1),c(t)?x("",!0):(r(),E(X,{key:0,name:"Crown",class:"fct-pro-icon",style:{"margin-left":"4px",display:"inline-flex"}}))],2)])]),_:1},8,["label"]),A.value.settings.is_default_body==="yes"?(r(),h("div",iZ,[o("label",rZ,f(c(d)("Email Body")),1),O.value?(r(),E(Cr,{key:0})):L.value?(r(),h("div",dZ,[s(Fo,{type:"warning",class:"mb-3","show-icon":"",description:c(d)("The preview shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("iframe",{srcdoc:L.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,uZ)])):x("",!0)])):x("",!0),A.value.settings.is_default_body==="no"&&!l.value?(r(),E(KX,{key:1,"min-version":"1.3.15",placement:"feature_lock_email_templates","feature-title":c(d)("Custom Email Templates"),"feature-text":c(d)("Design beautiful email templates with a drag-and-drop block editor, shortcodes, and conditional content.")},{default:u(()=>[s(N,{label:c(d)("Email Body")},{default:u(()=>[s(Fo,{class:"mb-3",type:"warning","show-icon":"",description:c(d)("Shortcodes/Blocks shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),s(UA,{ref_key:"editorFrameRef",ref:p,editorParams:{block_type:"template",campaign_title:A.value.settings.subject,bid:A.value.name},frameHeight:"calc(100vh - 60px)",documentTitle:A.value.settings.subject,onTitleUpdated:Y[6]||(Y[6]=ge=>{A.value.settings.subject=ge}),onPreviewRequest:U,modelValue:A.value.settings.email_body,"onUpdate:modelValue":Y[7]||(Y[7]=ge=>A.value.settings.email_body=ge)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):x("",!0)]),_:1})]),_:1})]),_:1}),(r(!0),h(P,null,ae(_.value,ge=>(r(),E(xe,{key:ge.form_key,class:"mt-4"},{default:u(()=>[s(Be,null,{default:u(()=>[ge.title?(r(),h("h3",cZ,f(ge.title),1)):x("",!0),ge.sub_title?(r(),h("p",AZ,f(ge.sub_title),1)):x("",!0),s(Zp,{schema:ge.schema,values:ge.values,form_name:ge.form_key,ref_for:!0,ref_key:"extraFormRefs",ref:g},null,8,["schema","values","form_name"])]),_:2},1024)]),_:2},1024))),128))],64)),b.value&&w.value.length?(r(),h("div",pZ,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(le,{"label-position":"top"},{default:u(()=>[s(N,{label:c(d)("Attach PDF Template")},{default:u(()=>[s(pe,{modelValue:A.value.settings.attach_pdf_template,"onUpdate:modelValue":Y[8]||(Y[8]=ge=>A.value.settings.attach_pdf_template=ge),placeholder:c(d)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:u(()=>[(r(!0),h(P,null,ae(w.value,ge=>(r(),E(ee,{key:ge.id,label:ge.title,value:ge.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):x("",!0),o("div",fZ,[s(de,{onClick:W,type:"primary",disabled:n.value,loading:n.value},{default:u(()=>[R(f(c(d)("Update")),1)]),_:1},8,["disabled","loading"])])]),s(Ue,{modelValue:B.value,"onUpdate:modelValue":Y[12]||(Y[12]=ge=>B.value=ge),direction:"rtl",size:"70%",title:c(d)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:T},{footer:u(()=>[s(de,{onClick:I},{default:u(()=>[R(f(c(d)("Close")),1)]),_:1})]),default:u(()=>[S.value?Jt((r(),h("div",mZ,null,512)),[[Ce,!0]]):x("",!0),!S.value&&V.value?(r(),h(P,{key:1},[o("div",hZ,[o("div",_Z,[o("button",{type:"button",class:ue(["fct-device-btn",{active:F.value==="desktop"}]),onClick:Y[9]||(Y[9]=ge=>F.value="desktop")},[Y[15]||(Y[15]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o("path",{d:"M8 21h8"}),o("path",{d:"M12 17v4"})],-1)),o("span",null,f(c(d)("Desktop")),1)],2),o("button",{type:"button",class:ue(["fct-device-btn",{active:F.value==="tablet"}]),onClick:Y[10]||(Y[10]=ge=>F.value="tablet")},[Y[16]||(Y[16]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,f(c(d)("Tablet")),1)],2),o("button",{type:"button",class:ue(["fct-device-btn",{active:F.value==="mobile"}]),onClick:Y[11]||(Y[11]=ge=>F.value="mobile")},[Y[17]||(Y[17]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,f(c(d)("Mobile")),1)],2)])]),s(Fo,{class:"mb-3",type:"warning","show-icon":"",description:c(d)("The preview shown here uses sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("div",{class:ue(["fct-preview-stage","fct-preview-stage--"+F.value])},[o("div",{class:ue(["fct-device-frame","fct-device-frame--"+F.value])},[o("iframe",{ref_key:"previewIframe",ref:$,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):x("",!0)]),_:1},8,["modelValue","title"])])}}},gZ={name:"StorageSettings",components:{Badge:Ht,CardBody:Be,CardContainer:xe,SettingsHeader:$a,AdminNotice:Fa,DynamicIcon:X},props:["settings"],data(){return{loading:!1,availableDrivers:[]}},mounted(){this.getStorageDrivers()},methods:{translate:d,getLogo(e){return e},getDarkLogo(e){return e||null},getRowLabel(e){return this.isProLocked(e)?this.translate("Upgrade to Pro to use storage provider: %1$s",e.title):`${this.translate("Manage storage provider")}: ${e.title}`},getToggleLabel(e){return`${this.translate("Toggle storage driver status")}: ${e.title}`},canToggle(e){return!e.has_bucket&&!e.requires_pro},canManage(e){return!!e.route||!!e.upgrade_url},isProLocked(e){return!e.route&&!!e.upgrade_url},handleDriverAction(e){if(e.upgrade_url&&!e.route){window.open(e.upgrade_url,"_blank","noopener,noreferrer");return}e.route&&this.$router.push({name:e.route})},toggleStatus(e){const t=e.is_active_input,a=t==="yes"?"no":"yes";e.saving=!0,this.$post("settings/storage-drivers/change-status",{driver:e.route,status:t}).then(l=>{e.status=t==="yes",this.$notify({type:"success",title:this.translate("Success"),message:l.message})}).catch(l=>{e.is_active_input=a,this.handleError(l)}).finally(()=>{e.saving=!1})},getStorageDrivers(){this.loading=!0,this.$get("settings/storage-drivers").then(e=>{this.availableDrivers=Object.values(e.drivers||{}).map(t=>({...t,is_active_input:t.status?"yes":"no",saving:!1}))}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})}}},yZ={class:"setting-wrap"},bZ={class:"setting-wrap-inner"},wZ={key:0,class:"storage-setting-list fct-content-card-list"},CZ=["role","tabindex","aria-label","onClick","onKeydown"],kZ={class:"flex items-start gap-3"},BZ=["src","alt"],xZ=["src","alt"],SZ={class:"flex-1 min-w-0 pl-15"},$Z={class:"fct-content-card-list-head"},FZ={class:"title-wrap"},EZ={class:"fct-content-card-list-content"};function UZ(e,t,a,l,n,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("Badge"),g=C("el-switch"),y=C("DynamicIcon"),v=C("el-button"),k=C("CardBody"),b=C("CardContainer");return r(),h("div",yZ,[s(A,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",bZ,[s(p),s(b,null,{default:u(()=>[s(k,null,{default:u(()=>[s(m,{loading:n.loading,animated:"",rows:6},null,8,["loading"]),n.loading?x("",!0):(r(),h("div",wZ,[(r(!0),h(P,null,ae(n.availableDrivers,(w,B)=>(r(),h("div",{key:w.route||B,class:ue(["fct-content-card-list-item",i.canManage(w)?"cursor-pointer":""]),role:i.canManage(w)?"button":void 0,tabindex:i.canManage(w)?0:-1,"aria-label":i.getRowLabel(w),onClick:S=>i.handleDriverAction(w),onKeydown:[ea(Ge(S=>i.handleDriverAction(w),["prevent"]),["enter"]),ea(Ge(S=>i.handleDriverAction(w),["prevent"]),["space"])]},[o("div",kZ,[o("div",{class:ue(`fct-content-card-list-icon ${w.title.toLowerCase()}`)},[o("img",{class:ue({"dark:hidden":i.getDarkLogo(w.dark_logo)}),src:i.getLogo(w.logo),alt:w.title},null,10,BZ),i.getDarkLogo(w.dark_logo)?(r(),h("img",{key:0,src:i.getDarkLogo(w.dark_logo),alt:w.title,class:"hidden dark:block"},null,8,xZ)):x("",!0)],2),o("div",SZ,[o("div",$Z,[o("div",FZ,[o("h6",null,f(w.title),1)]),s(_,{size:"small",status:w.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",EZ,[o("p",null,f(w.description),1)])]),i.canToggle(w)?(r(),h("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=Ge(()=>{},["stop"])),onKeydown:t[1]||(t[1]=Ge(()=>{},["stop"]))},[s(g,{modelValue:w.is_active_input,"onUpdate:modelValue":S=>w.is_active_input=S,"active-value":"yes","inactive-value":"no",loading:w.saving,"aria-label":i.getToggleLabel(w),onChange:S=>i.toggleStatus(w)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):i.isProLocked(w)?(r(),h("div",{key:1,class:"fct-content-card-list-action",onClick:t[2]||(t[2]=Ge(()=>{},["stop"])),onKeydown:t[3]||(t[3]=Ge(()=>{},["stop"]))},[s(v,{type:"primary",class:"el-button--x-small",tag:"a",href:w.upgrade_url,target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[s(y,{name:"Crown"}),R(" "+f(i.translate("Upgrade to Pro")),1)]),_:2},1032,["href"])],32)):i.canManage(w)?(r(),h("div",{key:2,class:"fct-content-card-list-action",onClick:t[4]||(t[4]=Ge(()=>{},["stop"])),onKeydown:t[5]||(t[5]=Ge(()=>{},["stop"]))},[s(v,{class:"el-button--x-small",onClick:S=>i.handleDriverAction(w)},{default:u(()=>[R(f(i.translate("Manage")),1)]),_:2},1032,["onClick"])],32)):x("",!0)])],42,CZ))),128))]))]),_:1})]),_:1})])])}const IZ=nt(gZ,[["render",UZ]]),VZ={class:"fct-setting-header"},DZ={key:0,class:"fct-setting-header-action"},TZ={class:"setting-wrap-inner"},Ic={__name:"GlobalStorageComponents",setup(e){const t=M({}),a=M(""),l=M({}),n=M(!1),i=M(!1),A=M(""),p=Fd(),m=M({}),_=G(()=>!!a.value),g=Pa(),y=Ss(),v=()=>{i.value=!0,ce.get("settings/storage-drivers/"+A.value).then(w=>{t.value=w.settings||{},a.value=w.template||"",l.value=w.template_payload||{},m.value={},w.template||p.setSchema(w.fields).setDefaults(w.settings).initForm()}).catch(w=>{var B;t.value={},a.value="",l.value={},m.value={},p.setSchema({}).setDefaults({}),j.error(((B=w==null?void 0:w.data)==null?void 0:B.message)||d("Failed to load storage settings."))}).finally(()=>{i.value=!1})},k=()=>{if(_.value)return;let w=p.values;n.value=!0,ce.post("settings/storage-drivers",{settings:{...w},driver:A.value}).then(B=>{var S;t.value.is_active=(S=B.data)==null?void 0:S.is_active,j.success(B.message||d("Storage Settings updated!")),p.values=B.data,B.data.shouldReload&&v()}).catch(B=>{var S;B.status_code=="422"?j.validationErrors(B):j.error((S=B.data)==null?void 0:S.message)}).finally(()=>{n.value=!1})},b=()=>{A.value=g.name};return be(g,(w,B)=>{b(),v()}),y.onSave(()=>{_.value||k()}),Te(()=>{b(),v()}),(w,B)=>{const S=C("el-breadcrumb-item"),V=C("el-breadcrumb"),F=C("el-button"),$=C("el-skeleton");return r(),h("div",{class:ue(["setting-wrap",A.value])},[o("div",VZ,[s(V,{class:"mb-0","separator-icon":c(Za)},{default:u(()=>[s(S,{to:{name:"storage"}},{default:u(()=>[R(f(c(d)("Storage Providers")),1)]),_:1}),c(Aa).headline(A.value)?(r(),E(S,{key:0},{default:u(()=>[R(f(c(Aa).headline(A.value)),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"]),_.value?x("",!0):(r(),h("div",DZ,[s(F,{type:"primary",onClick:k,loading:n.value,disabled:n.value||i.value,size:"small"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading","disabled"])]))]),o("div",TZ,[s(Fa),i.value?(r(),E(xe,{key:0},{default:u(()=>[s(Be,null,{default:u(()=>[s($,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(P,{key:1},[_.value?(r(),E(ef,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:A.value}},null,8,["widget","data"])):(r(),E(Ii,{key:1,form:c(p),showSubmitButton:!1,loading:n.value,onOnChange:B[0]||(B[0]=U=>{}),"validation-errors":m.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},QZ=["innerHTML"],MZ={class:"fct-select-template-wrap"},LZ={class:"fct-select-template-wrap flex gap-2 flex-row"},RZ={class:"setting-save-action"},OZ={__name:"AddEmailNotification",setup(e){const t=aa().ctx,a=M(),l=M(!0),n=M(!1),i=M({}),A=M(),p=M([{label:d("After Order Created"),value:"fluent_cart/order_created"},{label:d("After Order Updated"),value:"fluent_cart/order_updated"},{label:d("After Payment Paid"),value:"fluent_cart/order_paid"},{label:d("After User Created"),value:"fluent_cart/user_created"},{label:d("After Refund made"),value:"fluent_cart/order_refunded"}]),m=M({}),_=M([{label:"Admin Email",value:"{wp.admin_email}"},{label:"Customer Email",value:"{order.customer.email}"},{label:"User Email",value:"{user.user_email}"}]),g=M({}),y=M({});Oa(),Pa();let v=null;const k=M([]),b=M([]),w=M({});Ss().onSave(()=>{$()});const S=O=>{const Q=O;t.$post("email-notification/getTemplate/",{template:Q}).then(H=>{var K;i.value.content=H.data.content,(K=a.value)==null||K.setContent(i.value.content)}).catch(H=>{}).finally(()=>{l.value=!1})},V=()=>{var O;(O=a.value)==null||O.setContent("")},F=()=>{l.value=!0,t.$get("email-notification/get-short-codes").then(O=>{m.value=O.data.shortcodes,g.value=O.data.email_templates,y.value=Object.keys(O.data.buttons).map(Q=>({[Q]:O.data.buttons[Q]}))}).catch(O=>{}).finally(()=>{l.value=!1})},$=O=>{O&&O.preventDefault(),w.value={},l.value=!0,t.$post("email-notification/create",i.value).then(Q=>{t.handleSuccess(Q)}).catch(Q=>{var H;Q.status_code=="422"?(j.validationErrors(Q),w.value=Q.data):j.error((H=Q.data)==null?void 0:H.message)}).finally(()=>{l.value=!1})},U=()=>{n.value=!0,A.value=i.value.content};Te(()=>{F()});const D=O=>{v=O},T=O=>{w.value&&w.value.hasOwnProperty(O)&&delete w.value[O]},I=()=>{i.value.to=k.value},L=()=>{i.value.from=b.value};return(O,Q)=>{const H=C("el-dialog"),K=C("el-input"),W=C("el-form-item"),z=C("el-option"),Y=C("el-select"),Z=C("el-col"),re=C("el-row"),q=C("el-tooltip"),Ae=C("el-button"),ie=C("el-form");return r(),E(xe,null,{default:u(()=>[s(Ve,{title:i.value.title?i.value.title:c(d)("Add Notification"),title_size:"small",border_bottom:"",icon:"Message"},{action:u(()=>Q[20]||(Q[20]=[])),_:1},8,["title"]),s(Be,null,{default:u(()=>[s(H,{modelValue:n.value,"onUpdate:modelValue":Q[0]||(Q[0]=J=>n.value=J),title:O.$t("Preview")},{default:u(()=>[o("div",{innerHTML:A.value},null,8,QZ)]),_:1},8,["modelValue","title"]),s(ie,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[s(W,{label:O.$t("Notification Name"),required:""},{default:u(()=>{var J,N;return[s(K,{modelValue:i.value.title,"onUpdate:modelValue":Q[1]||(Q[1]=le=>i.value.title=le),onFocus:Q[2]||(Q[2]=le=>T("title"))},null,8,["modelValue"]),s(gl,{"validation-errors":(N=(J=w.value)==null?void 0:J.title)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),s(W,{label:O.$t("Select notification event"),required:""},{default:u(()=>{var J,N;return[s(Y,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":Q[3]||(Q[3]=le=>i.value.events=le),placeholder:O.$t("Select Events"),onFocus:Q[4]||(Q[4]=le=>T("events")),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(p.value,le=>(r(),E(z,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),s(gl,{"validation-errors":(N=(J=w.value)==null?void 0:J.events)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),s(re,{gutter:15},{default:u(()=>[s(Z,{lg:12},{default:u(()=>[s(W,{label:O.$t("Mail From:"),required:""},{default:u(()=>{var J,N;return[s(K,{modelValue:i.value.from,"onUpdate:modelValue":Q[7]||(Q[7]=le=>i.value.from=le),onFocus:Q[8]||(Q[8]=le=>T("from")),placeholder:O.$t("Select a Field or Type Custom Value")},{append:u(()=>[s(Y,{modelValue:b.value,"onUpdate:modelValue":Q[5]||(Q[5]=le=>b.value=le),onChange:Q[6]||(Q[6]=le=>L()),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(_.value,le=>(r(),E(z,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),s(gl,{"validation-errors":(N=(J=w.value)==null?void 0:J.from)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),s(Z,{lg:12},{default:u(()=>[s(W,{label:O.$t("Send Mail To:"),required:""},{default:u(()=>{var J,N;return[s(K,{modelValue:i.value.to,"onUpdate:modelValue":Q[11]||(Q[11]=le=>i.value.to=le),onFocus:Q[12]||(Q[12]=le=>T("to"))},{append:u(()=>[s(Y,{modelValue:k.value,"onUpdate:modelValue":Q[9]||(Q[9]=le=>k.value=le),onChange:Q[10]||(Q[10]=le=>I()),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(_.value,le=>(r(),E(z,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),s(gl,{"validation-errors":(N=(J=w.value)==null?void 0:J.to)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),s(W,{label:O.$t("Cc:")},{default:u(()=>[s(K,{modelValue:i.value.cc,"onUpdate:modelValue":Q[13]||(Q[13]=J=>i.value.cc=J)},null,8,["modelValue"])]),_:1},8,["label"]),s(W,{label:O.$t("Mail Subject:"),required:""},{default:u(()=>{var J,N;return[s(K,{modelValue:i.value.subject,"onUpdate:modelValue":Q[14]||(Q[14]=le=>i.value.subject=le),onFocus:Q[15]||(Q[15]=le=>T("subject"))},null,8,["modelValue"]),s(gl,{"validation-errors":(N=(J=w.value)==null?void 0:J.subject)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o("div",null,[s(os,{ref_key:"wpEditor",ref:a,"short-codes":m.value,buttons:y.value,onOnEditorReady:D,onUpdate:Q[18]||(Q[18]=J=>{i.value.content=J}),modelValue:i.value.content,"onUpdate:modelValue":Q[19]||(Q[19]=J=>i.value.content=J)},{action:u(()=>[o("div",MZ,[s(Y,{onChange:Q[16]||(Q[16]=J=>{var N;(N=a.value)==null||N.setContent(J)}),placeholder:O.$t("Select button"),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(y.value,(J,N)=>(r(),E(z,{key:N,label:Object.keys(J)[0],value:Object.values(J)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",LZ,[s(Y,{onChange:Q[17]||(Q[17]=J=>{S(J)}),placeholder:O.$t("Select template"),clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(g.value,(J,N)=>(r(),E(z,{key:N,label:J.label,value:J.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),o("span",null,[s(q,{effect:"dark",content:O.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{onClick:Ge(V,["prevent"]),tag:"button"},{default:u(()=>[s(X,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:u(()=>[c(v)!==null?(r(),E(q,{key:0,effect:"dark",content:O.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{onClick:Ge(U,["prevent"]),tag:"button"},{default:u(()=>[s(X,{name:"Eye"})]),_:1})]),_:1},8,["content"])):x("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",RZ,[s(Ae,{onClick:$,type:"primary",disabled:l.value,loading:l.value},{default:u(()=>[R(f(O.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class PZ extends ds{getTabs(){return{all:d("All"),success:d("Success"),warning:d("Warning"),error:d("Error"),failed:d("Failed"),info:d("Info"),api:d("API Only")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Content",value:"content"},{label:"Date",value:"date"},{label:"Actions",value:"actions"}]}getSearchHint(){return d("Search by id, title, content or module.")}getFetchUrl(){return"activity"}parseResponse(t){return t.activities}getTableName(){return"log_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}}function HZ(e){return PZ.init(e)}const NZ={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},KZ={class:"fct-table-mobile-header"},GZ={class:"fct-table-date-col"},zZ={class:"mark-read-unread-wrap"},jZ=["onClick","title"],qZ=["onClick","title"],YZ=["title"],WZ={class:"fct-table-mobile-body"},JZ={key:0,class:"fct-table-title-col"},XZ={key:1,class:"fct-table-content-col"},ZZ={class:"fct-table-mobile-footer"},eee={class:"fct-table-mobile-footer-row"},tee={class:"fct-table-status-col"},aee={class:"title"},lee={class:"fct-table-module-col"},see={class:"title"},nee={class:"value"},oee={key:0,class:"fct-table-actions-col"},iee={class:"title"},ree={__name:"LogsTableMobile",props:{table:{type:Object}},emits:["changeStatus"],setup(e,{emit:t}){const a=t,l=(n,i)=>{a("changeStatus",n,i)};return(n,i)=>{const A=C("el-icon"),p=C("router-link");return r(),h("div",NZ,[(r(!0),h(P,null,ae(e.table.getTableData(),(m,_)=>(r(),h("div",{key:m.id,class:"fct-table-mobile-row"},[o("div",KZ,[o("div",GZ,[o("div",zZ,[m.read_status!=="unread"?(r(),h("span",{key:0,onClick:g=>l(m,"unread"),title:c(d)("Mark as unread")},[s(A,null,{default:u(()=>[s(c(Mo))]),_:1})],8,jZ)):(r(),h("span",{key:1,onClick:g=>l(m,"read"),title:c(d)("Mark as read")},[s(A,null,{default:u(()=>[s(c(Ad))]),_:1})],8,qZ))]),o("div",{title:c(d)("Logs ID: %s",m.id),class:"invoice-no"}," #"+f(m.id),9,YZ),e.table.isColumnVisible("date")?(r(),h(P,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),s(Sa,{class:"date","date-time":m.created_at,"with-time":!0},null,8,["date-time"])],64)):x("",!0)])]),o("div",WZ,[e.table.isColumnVisible("title")?(r(),h("div",JZ,f(m.title),1)):x("",!0),e.table.isColumnVisible("content")?(r(),h("div",XZ,f(m.content),1)):x("",!0)]),o("div",ZZ,[o("div",eee,[o("div",tee,[o("div",aee,f(c(d)("Status")),1),(r(),E(Ht,{status:m.status,size:"small",key:m.id},null,8,["status"]))]),o("div",lee,[o("div",see,f(c(d)("Module")),1),o("div",nee,f(m.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",oee,[o("div",iee,f(c(d)("Actions")),1),m.module_id&&m.module_name.toLowerCase()==="order"?(r(),E(p,{key:0,class:"value",to:{name:"view_order",params:{order_id:m.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):x("",!0),m.module_id&&m.module_name.toLowerCase()==="subscription"?(r(),E(p,{key:1,class:"value",to:{name:"view_subscription",params:{subscription_id:m.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):x("",!0)])):x("",!0)])])]))),128))])}}},dee={},uee={class:"px-4 py-3"},cee={class:"grid grid-cols-3 gap-5 mt-5"};function Aee(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",uee,[(r(),h(P,null,ae(2,n=>o("div",{key:n,class:"flex items-center justify-between mb-3"},[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",cee,[(r(),h(P,null,ae(3,n=>o("div",{key:n},[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const pee=nt(dee,[["render",Aee]]),fee={class:"table-cell"},mee={class:"table-cell"},hee={class:"table-cell"},_ee={class:"table-cell"},vee={class:"table-cell"},gee={class:"table-cell"},yee={class:"table-cell"},bee={__name:"LogsLoader",props:{nextPageCount:{type:Number,default:0},logTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,n)=>n+1);return(l,n)=>{const i=C("el-skeleton-item"),A=C("el-skeleton"),p=C("el-table-column"),m=C("el-table");return r(),E(m,{data:c(a),class:"w-full compact-table full-compact"},{default:u(()=>[s(p,{width:143,label:c(d)("ID")},{default:u(()=>[o("div",fee,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(r(),E(p,{key:0,label:c(d)("Date"),width:172},{default:u(()=>[o("div",mee,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("title")?(r(),E(p,{key:1,label:c(d)("Title"),width:287},{default:u(()=>[o("div",hee,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("content")?(r(),E(p,{key:2,label:c(d)("Content"),width:287},{default:u(()=>[o("div",_ee,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),s(p,{label:c(d)("Status"),width:143},{default:u(()=>[o("div",vee,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),s(p,{label:c(d)("Module"),width:143},{default:u(()=>[o("div",gee,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(r(),E(p,{key:3,label:c(d)("Actions"),width:114},{default:u(()=>[o("div",yee,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},wee={class:"fct-all-logs-page fct-layout-width"},Cee={key:1},kee={class:"inline-flex items-center gap-1"},Bee=["onClick","title"],xee=["onClick","title"],See={__name:"Logs",setup(e){const t=aa().ctx,a=HZ(),l=M([]),n=(i,A)=>{t.$put("activity/"+i.id+"/mark-read",{id:i.id,status:A}).then(p=>{l.value.find(m=>m.id===i.id).read_status=A,t.handleSuccess(p)}).catch(p=>{var m;p.status_code=="422"?j.validationErrors(p):j.error((m=p.data)==null?void 0:m.message)})};return a.onDataLoaded(function(){l.value=a.getTableData()}),(i,A)=>{const p=C("el-icon"),m=C("el-table-column"),_=C("el-button"),g=C("el-table");return r(),h("div",wee,[s(Xa,{title:c(d)("Logs")},null,8,["title"]),s(us,{table:c(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(a).isLoading()?(r(),E(pee,{key:0})):x("",!0),c(a).isLoading()?x("",!0):(r(),E(ree,{key:1,table:c(a),onChangeStatus:n},null,8,["table"]))]),default:u(()=>[c(a).isLoading()?(r(),E(bee,{key:0,logTable:c(a),"next-page-count":c(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",Cee,[s(g,{class:"w-full",data:c(a).getTableData()},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("We could't find any logs matching your filter.")},null,8,["text"])]),default:u(()=>[s(m,{label:c(d)("ID"),width:100},{default:u(y=>[o("div",kee,[y.row.read_status!=="unread"?(r(),h("span",{key:0,onClick:v=>n(y.row,"unread"),title:c(d)("Mark as unread"),class:"cursor-pointer"},[s(p,null,{default:u(()=>[s(c(Mo))]),_:1})],8,Bee)):(r(),h("span",{key:1,onClick:v=>n(y.row,"read"),title:c(d)("Mark as read"),class:"cursor-pointer"},[s(p,null,{default:u(()=>[s(c(Ad))]),_:1})],8,xee)),R(" #"+f(c(la)(y.row.id)),1)])]),_:1},8,["label"]),c(a).isColumnVisible("date")?(r(),E(m,{key:0,label:c(d)("Date"),width:120},{default:u(y=>[s(Sa,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):x("",!0),c(a).isColumnVisible("title")?(r(),E(m,{key:1,label:c(d)("Title"),width:200},{default:u(y=>[R(f(y.row.title),1)]),_:1},8,["label"])):x("",!0),c(a).isColumnVisible("content")?(r(),E(m,{key:2,label:c(d)("Content"),width:200},{default:u(y=>[R(f(y.row.content),1)]),_:1},8,["label"])):x("",!0),s(m,{label:c(d)("Status"),width:100},{default:u(y=>[(r(),E(Ht,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),s(m,{label:c(d)("Module"),width:100},{default:u(y=>[R(f(y.row.module_name),1)]),_:1},8,["label"]),c(a).isColumnVisible("actions")?(r(),E(m,{key:3,label:c(d)("Actions"),width:80},{default:u(y=>[y.row.module_id&&y.row.module_name.toLowerCase()==="order"?(r(),E(_,{key:0,tag:"router-link",class:"el-button--x-small",to:{name:"view_order",params:{order_id:y.row.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):x("",!0),y.row.module_id&&y.row.module_name.toLowerCase()==="subscription"?(r(),E(_,{key:1,tag:"router-link",class:"el-button--x-small",to:{name:"view_subscription",params:{subscription_id:y.row.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},$ee=["title"],Fee={__name:"RemoveButton",props:{filterKey:{type:String,required:!0},itemId:{type:[String,Number],default:null}},emits:["remove"],setup(e,{emit:t}){const a=e,l=t,n=()=>{l("remove",{filterKey:a.filterKey,itemId:a.itemId})};return(i,A)=>(r(),h("button",{class:"fct-applied-filter-remove",onClick:n,title:i.$t("Remove")},[s(X,{name:"Close"})],8,$ee))}},Eee={__name:"StatusFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const a=e.filterState;return(l,n)=>{const i=C("el-option"),A=C("el-select");return r(),E(A,{modelValue:c(a).data.selectedFilters[e.filterItemKey].value,"onUpdate:modelValue":n[0]||(n[0]=p=>c(a).data.selectedFilters[e.filterItemKey].value=p),placeholder:l.$t("Select Status"),filterable:"",onChange:c(a).applyFilterChange,"popper-class":"fct-dropdown-compact",size:"small"},{default:u(()=>[(r(!0),h(P,null,ae(e.filterItem.options,p=>(r(),E(i,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])}}},If={__name:"DateRangeFilter",props:{modelValue:Array,type:{type:String,default:"daterange"},separator:{type:String,default:"-"},startPlaceholder:{type:String,default:""},endPlaceholder:{type:String,default:""},unlinkPanels:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placement:{type:String,default:"bottom-end"},showArrow:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},filterState:{type:[Object]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,n=a.filterState,i=M(null),A=G({get:()=>a.modelValue,set:g=>l("update:modelValue",g)}),p=G(()=>Ke.get("app_config.isProActive"));function m(g){l("change",g)}function _(){n.data.dateRange=[_a.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),_a.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],l("change",n.data.dateRange)}return Ga(()=>{}),(g,y)=>{const v=C("el-date-picker"),k=Qa("translate-numbers");return r(),h("div",{class:ue(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Jt(s(v,{ref_key:"datePickerRef",ref:i,modelValue:A.value,"onUpdate:modelValue":y[0]||(y[0]=b=>A.value=b),type:e.type,"range-separator":e.separator,"start-placeholder":e.startPlaceholder||c(d)("Start date"),"end-placeholder":e.endPlaceholder||c(d)("End date"),"unlink-panels":e.unlinkPanels,clearable:e.clearable,shortcuts:c(CA),onChange:m,placement:e.placement,disabled:e.disabled||!p.value},null,8,["modelValue","type","range-separator","start-placeholder","end-placeholder","unlink-panels","clearable","shortcuts","placement","disabled"]),[[k,"translate-numbers"]]),e.showArrow?(r(),E(X,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):x("",!0),p.value&&e.clearable?(r(),E(X,{key:1,onClick:_,name:"CircleClose",class:"fct-applied-filter-clear-all"})):x("",!0)],2)}}},Vf={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,n=G({get:()=>a.modelValue,set:A=>l("update:modelValue",A)}),i=A=>{l("change",A)};return(A,p)=>{const m=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=g=>n.value=g),placeholder:A.$t("Select Currency"),filterable:"",onChange:i,"popper-class":"fct-dropdown-compact",size:"small"},{default:u(()=>[(r(!0),h(P,null,ae(e.currencies,(g,y)=>(r(),E(m,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},Uee={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,n)=>(r(),h("button",{onClick:n[0]||(n[0]=(...i)=>c(a).resetFilters&&c(a).resetFilters(...i)),class:"reset-filters-btn"},f(l.$t("Reset Filters")),1))}},Iee={__name:"MultiselectFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const t=e,a=t.filterState,l=G({get:()=>{var n;return((n=a.data.selectedFilters[t.filterItemKey])==null?void 0:n.value)??[]},set:n=>{a.setMultiSelectChange(t.filterItemKey,n)}});return(n,i)=>{const A=C("el-option"),p=C("el-select");return r(),E(p,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=m=>l.value=m),placeholder:n.$t("Select Order Type"),multiple:"",filterable:"","popper-class":"fct-dropdown-compact fct-multi-select-filter",size:"small"},{default:u(()=>[(r(!0),h(P,null,ae(e.filterItem.options,m=>(r(),E(A,{key:m.value,label:m.label,value:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},Vee={class:"fct-compare-to-filter"},Dee={class:"fct-applied-filter-label"},Tee={class:"fct-applied-filter-actions"},Qee={class:"fct-compare-to-select"},Mee={class:"fct-compare-to-date"},Lee={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,l=t,n=a.filterState,i=G({get:()=>{var m;return((m=n.data.selectedFilters.compareType)==null?void 0:m.value)??n.data.compareType},set:m=>{n.setCompareTypeChange(m),l("selectChange",m)}}),A=G({get:()=>{var m;return((m=n.data.selectedFilters.compareDate)==null?void 0:m.value)??n.data.compareDate},set:m=>{n.setCompareDateChange(m),l("dateChange",m)}}),p=G(()=>Ke.get("app_config.isProActive"));return(m,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-date-picker");return r(),h("div",Vee,[o("div",Dee,f(c(d)("Compare to")),1),o("div",Tee,[o("div",Qee,[s(y,{modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=k=>i.value=k),"popper-class":"fct-dropdown-compact",disabled:!p.value},{default:u(()=>[s(g,{label:c(d)("Previous Period"),value:"previous_period"},null,8,["label"]),s(g,{label:c(d)("Previous Month"),value:"previous_month"},null,8,["label"]),s(g,{label:c(d)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),s(g,{label:c(d)("Previous Year"),value:"previous_year"},null,8,["label"]),s(g,{label:c(d)("Custom"),value:"custom"},null,8,["label"]),s(g,{label:c(d)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),o("div",Mee,[i.value==="custom"?(r(),E(v,{key:0,modelValue:A.value,"onUpdate:modelValue":_[1]||(_[1]=k=>A.value=k),type:"date",size:"small",placeholder:c(d)("Select Date")},null,8,["modelValue","placeholder"])):x("",!0)])])])}}},Ree={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},Oee={key:0},Df={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,l=M([]),n=M([]),i=M(!1),A=aa().ctx;let p=0;const m=b=>{const w=Qt.get("product_variations");w&&(l.value=w);const B=++p;if(l.value.length&&!b){n.value=[...l.value],i.value=!1;return}i.value=!0,A.$get("products/searchVariantByName",{name:b}).then(S=>{B===p&&(n.value=S,b||(l.value=S,Qt.set("product_variations",S)))}).catch(()=>{}).finally(()=>{B===p&&(i.value=!1)})},_=gd.debounce(m),g=(b,w)=>{const B=w.checkedNodes||[],S={};[...B,...w.halfCheckedNodes||[]].forEach(V=>{(V.children||[]).forEach(F=>{S[F.value]=V.label})}),a.setTreeSelectItem(B.map(V=>({...V,productName:S[V.value]})))},y=b=>{a.removeTreeSelectItem(b)},v=()=>{a.clearTreeSelect()},k=G(()=>{var B;const b=((B=a.data.selectedFilters.variation_ids)==null?void 0:B.value)||[];let w={};return b.forEach(S=>{const V=S.productName||"Unknown";w[V]||(w[V]=[]),w[V].push(S.label||S.id)}),w});return Te(()=>{const b=a.retrieveSavedReportFilters();b&&b.variation_ids&&(a.data.variation_ids=b.variation_ids),m("")}),(b,w)=>{const B=C("el-tag"),S=C("el-tree-select");return r(),E(S,{placeholder:b.$t("Select Products"),modelValue:c(a).data.variation_ids,"onUpdate:modelValue":w[0]||(w[0]=V=>c(a).data.variation_ids=V),data:n.value,"filter-method":c(_),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:i.value,onCheck:g,"popper-class":"fct-tooltip-long",onRemoveTag:y,onClear:v,size:"small"},{tag:u(()=>[o("div",Ree,[(r(!0),h(P,null,ae(k.value,(V,F)=>(r(),E(B,{style:{"margin-right":"4px"}},{default:u(()=>[R(f(F)+" ",1),V.length?(r(),h("span",Oee," | "+f(V.join(", ")),1)):x("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},Pee={class:"fct-applied-filters-wrap"},Hee={class:"fct-applied-filter-list"},Nee={class:"fct-applied-filter fct-applied-filter-date"},Kee={class:"fct-applied-filter-label"},Gee={class:"fct-applied-filter-value"},zee={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},jee={class:"fct-applied-filter-label"},qee={class:"fct-applied-filter-value"},Yee={key:2,class:"fct-applied-filter-clear-wrap"},Wee={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=Pa(),n=({filterKey:m,itemId:_})=>{a.removeFilter(m,_)},i=m=>!(["dateRange","compareType","compareDate"].includes(m)||l.name==="reports_customer"||l.name==="reports_sources"),A=G(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(l.name)),p=G(()=>Object.keys(a.data.selectedFilters).filter(m=>!(m==="orderTypes"&&l.name==="reports_subscriptions")).reduce((m,_)=>(m[_]=a.data.selectedFilters[_],m),{}));return be(a.data.dateRange,m=>{}),(m,_)=>(r(),h("div",Pee,[o("ul",Hee,[o("li",Nee,[o("div",Kee,f(m.$t("Date:")),1),o("div",Gee,[s(If,{modelValue:c(a).data.dateRange,"onUpdate:modelValue":_[0]||(_[0]=g=>c(a).data.dateRange=g),placement:"bottom-start",reRenderDate:c(a).data.reRenderDate,showArrow:!0,size:"small",onChange:c(a).setDateRange,clearable:"",filterState:c(a)},null,8,["modelValue","reRenderDate","onChange","filterState"])])]),A.value?(r(),h("li",zee,[s(Lee,{filterState:c(a)},null,8,["filterState"])])):x("",!0),Object.keys(p.value).length?(r(!0),h(P,{key:1},ae(p.value,(g,y)=>(r(),h(P,{key:y},[i(y)?(r(),h("li",{key:0,class:ue(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",jee,f(g.label)+":",1),o("div",qee,[g.type==="list"?(r(),E(Eee,{key:0,"filter-state":c(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):x("",!0),g.type==="multi-list"?(r(),E(Iee,{key:1,"filter-state":c(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):y==="variation_ids"?(r(),E(Df,{key:2,"filter-state":c(a)},null,8,["filter-state"])):y==="currency"?(r(),E(Vf,{key:3,modelValue:c(a).data.currency,"onUpdate:modelValue":_[1]||(_[1]=v=>c(a).data.currency=v),currencies:c(a).currencies,onChange:v=>{c(a).setSelectChange(v,{...g,value:y})}},null,8,["modelValue","currencies","onChange"])):x("",!0)]),y!=="variation_ids"?(r(),E(Fee,{key:0,filterKey:y,itemId:y==="variation_ids"?g.value[0].id:null,onRemove:n},null,8,["filterKey","itemId"])):x("",!0)],2)):x("",!0)],64))),128)):x("",!0),Object.keys(p.value).length?(r(),h("li",Yee,[s(Uee,{"filter-state":c(a)},null,8,["filter-state"])])):x("",!0)])]))}},Jee={class:"fct-filter-dropdown-header"},Xee={key:0,class:"fct-filter-back-wrapper"},Zee={class:"fct-filter-active-label"},ete={key:1,class:"fct-filter-dropdown-search-input"},tte={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,n)=>{const i=C("el-input");return r(),h("div",Jee,[c(a).data.activeFilter!=null?(r(),h("div",Xee,[o("button",{class:"fct-filter-back-button",onClick:n[0]||(n[0]=A=>c(a).selectActiveFilter(null))},[s(X,{name:"ArrowLeft"})]),o("span",Zee,f(c(a).activeFilterOptions.label),1)])):(r(),h("div",ete,[s(i,{modelValue:c(a).data.searchQuery,"onUpdate:modelValue":n[1]||(n[1]=A=>c(a).data.searchQuery=A),placeholder:l.$t("Search Filter..."),clearable:""},null,8,["modelValue","placeholder"])]))])}}},ate={class:"fct-filter-dropdown-active-filter-list"},lte=["onClick"],ste={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,n)=>(r(),h("ul",ate,[(r(!0),h(P,null,ae(c(a).activeFilterOptions.options,(i,A)=>(r(),h("li",{key:A,class:ue(["fct-filter-active-option-item",{"is-selected":c(a).isFilterOptionSelected(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>c(a).selectFilterOption(i)},f(i.label),9,lte)],2))),128))]))}},nte={class:"fct-filter-dropdown-active-filter-list is-multi-list"},ote=["onClick"],ite={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,n)=>(r(),h("ul",nte,[(r(!0),h(P,null,ae(c(a).activeFilterOptions.options,(i,A)=>(r(),h("li",{key:A,class:ue(["fct-filter-active-option-item",{"is-selected":c(a).isFilterOptionSelectedMulti(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>c(a).selectFilterOptionMulti(i)},f(i.label),9,ote)],2))),128))]))}},rte={class:"fct-filter-dropdown-active-filter"},dte={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,n)=>(r(),h("div",rte,[c(a).activeFilterOptions.type==="list"?(r(),E(ste,{key:0,"filter-state":c(a)},null,8,["filter-state"])):x("",!0),c(a).activeFilterOptions.type==="multi-list"?(r(),E(ite,{key:1,"filter-state":c(a)},null,8,["filter-state"])):x("",!0),c(a).activeFilterOptions.type==="date"?(r(),E(If,{key:2,modelValue:c(a).data.dateRange,"onUpdate:modelValue":n[0]||(n[0]=i=>c(a).data.dateRange=i),onChange:c(a).setDateRange},null,8,["modelValue","onChange"])):x("",!0),c(a).activeFilterOptions.type==="currency"?(r(),E(Vf,{key:3,modelValue:c(a).data.currency,"onUpdate:modelValue":n[1]||(n[1]=i=>c(a).data.currency=i),currencies:c(a).currencies,onChange:c(a).setSelectChange},null,8,["modelValue","currencies","onChange"])):x("",!0),c(a).activeFilterOptions.type==="tree-select"?(r(),E(Df,{key:4,"filter-state":c(a)},null,8,["filter-state"])):x("",!0)]))}},ute={class:"fct-filter-dropdown-list"},cte=["onClick"],Ate={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},pte={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,n)=>(r(),h("ul",ute,[c(a).visibleFilters.length?(r(!0),h(P,{key:0},ae(c(a).visibleFilters,(i,A)=>(r(),h("li",{class:"fct-filter-dropdown-list-item",key:A},[o("div",{class:"fct-filter-dropdown-button",onClick:p=>c(a).selectActiveFilter(i)},[s(X,{name:i.icon},null,8,["name"]),R(" "+f(i.label),1)],8,cte)]))),128)):(r(),h("li",Ate,f(c(a).data.searchQuery?c(d)("No filter found"):c(d)("All filters selected")),1))]))}},fte={key:0,class:"fct-filter-dropdown"},mte={class:"fct-filter-dropdown-body"},hte={key:1},_te={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=M(null),l=t.filterState,n=Ke.get("app_config.isProActive"),i=[{label:d("Order Type"),icon:"AppsLine",type:"multi-list",value:"orderTypes",disableRoutes:["reports_customer","reports_subscriptions"],options:[{label:d("All"),value:"all"},{label:d("One time"),value:"payment"},{label:d("Subscription"),value:"subscription"},{label:d("Renewal"),value:"renewal"}]},{label:d("Subscription Type"),icon:"Reload",type:"list",value:"subscriptionType",disableRoutes:["reports_revenue","reports_products","reports_customer","reports_sales","reports_refunds","reports_orders","reports_sales"],options:[{label:d("Active"),value:"subscription"},{label:d("Renewal"),value:"renewal"},{label:d("Expired"),value:"expired"},{label:d("Canceled"),value:"canceled"}]},{label:d("Currency"),icon:"Currency",type:"currency",value:"currency",disableRoutes:["reports_products","reports_customer","reports_subscriptions"]},{label:d("Products"),icon:"ListView",type:"tree-select",value:"variation_ids",disableRoutes:["reports_customer"]}];l.setFilterOption(i);const A=p=>{const m=a.value,_=p.target,g=document.querySelectorAll(".el-picker-panel"),y=Array.from(g).some(v=>v.contains(_));m!=null&&m.contains(_)||y||(l.data.searchQuery="",l.dropdownOpen&&l.toggleDropdown())};return Te(()=>{document.addEventListener("click",A)}),Ga(()=>{document.removeEventListener("click",A)}),(p,m)=>(r(),h("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:m[0]||(m[0]=Ge(()=>{},["stop"]))},[s(tt,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:c(l).toggleDropdown},{default:u(()=>[s(X,{name:"Filter"})]),_:1},8,["onClick"]),s(Gl,{name:"fade-scale","enter-active-class":"transition ease-out duration-200","leave-active-class":"transition ease-in duration-150","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:u(()=>[c(l).dropdownOpen?(r(),h("div",fte,[c(n)?(r(),h(P,{key:0},[s(tte,{"filter-state":c(l)},null,8,["filter-state"]),o("div",mte,[c(l).data.activeFilter!=null?(r(),E(dte,{key:0,"filter-state":c(l)},null,8,["filter-state"])):(r(),E(pte,{key:1,"filter-state":c(l)},null,8,["filter-state"]))])],64)):(r(),h("div",hte,[s(cs,{class:"py-7.5",placement:"feature_lock_report_advanced_filtering",title:c(d)("Upgrade to Pro for filtering"),text:c(d)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))])):x("",!0)]),_:1})],512))}},vte={class:"fct-report-nav-links-wrap"},gte={class:"fct-settings-nav-collapse-button-wrapper"},yte={class:"fct-menu-collapse-button-text"},bte=["onClick"],wte=["src","alt"],Cte=["src","alt"],kte={class:"fct-settings-nav-link-text"},Bte={class:"fct-settings-nav-child-list"},xte=["onClick"],Ste={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=Oa(),l=Pa(),n=[{route:"reports_overview",label:d("Overview"),url:"/reports/overview",icon:"Overview"},{route:"reports_sales",label:d("Sales"),url:"/reports/sales",icon:"LineChart"},{route:"reports_orders",label:d("Orders"),url:"/reports/orders",icon:"Cart"},{route:"reports_revenue",label:d("Revenue"),url:"/reports/revenue",icon:"Revenue"},{route:"reports_refunds",label:d("Refunds"),url:"/reports/refunds",icon:"Refund"},{route:"reports_subscriptions",label:d("Subscriptions"),url:"/reports/subscriptions",icon:"Subscription",always_open:!0,child:[{route:"subscriptions-retention",label:d("Retention"),url:"/reports/subscriptions/subscriptions-retention"},{route:"subscriptions-cohorts",label:d("Cohorts"),url:"/reports/subscriptions/subscriptions-cohorts"},{route:"future_renewals",label:d("Future Renewals"),url:"/reports/subscriptions/future-renewals"}]},{route:"reports_products",label:d("Products"),url:"/reports/products",icon:"Product"},{route:"reports_customer",label:d("Customers"),url:"/reports/customer",icon:"Users"},{route:"reports_sources",label:d("Sources"),url:"/reports/sources",icon:"Source"}];Ke.get("addon_report_sidebar",[]).forEach(U=>n.push(U));const i=M(!1),A=M(!1),p=M(window.innerWidth>=1024),m=t,_=M(null),g=M(null),y=U=>!U.child||!(!F.value||$.value)?!1:v(U)||U.always_open,v=U=>{const D=l.path;return!!(U.child&&U.child.length&&U.child.some(I=>D===I.url||D.includes(I.url))||D===U.url||D.includes(U.url))},k=(U,D,T)=>l.path===U.url,b=U=>{a.push({name:U.route}).catch(T=>{T.name});const D=document.querySelector("#fct-report-body");D&&(D.scrollTop=0)},w=()=>{if(!p.value){_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open");return}i.value=!i.value,A.value=!1},B=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},S=()=>{const U=window.innerWidth,D=p.value;p.value=U>=1024,!D&&p.value&&(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open")),D&&!p.value&&(i.value=!1)};be([i,A,p],()=>{m("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:A.value,isDesktopView:p.value})},{immediate:!0});const F=G(()=>i.value),$=G(()=>p.value&&i.value&&A.value);return Te(()=>{S(),window.addEventListener("resize",S)}),xt(()=>{window.removeEventListener("resize",S)}),(U,D)=>{const T=C("el-button"),I=C("el-tooltip");return r(),h("div",vte,[o("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:B},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:ue(["fct-settings-nav-container",{"is-collapsed":F.value,"is-expanded":$.value}])},[o("div",gte,[s(I,{content:c(d)("Toggle reports"),placement:"right"},{default:u(()=>[s(T,{onClick:w},{default:u(()=>[s(X,{name:"Window"}),o("span",yte,f(c(d)("Reports")),1)]),_:1})]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:D[0]||(D[0]=L=>p.value&&i.value&&(A.value=!0)),onMouseleave:D[1]||(D[1]=L=>A.value=!1)},[(r(),h(P,null,ae(n,(L,O)=>o("li",{key:O,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(L)}])},[o("div",{onClick:Q=>b(L),class:"fct-settings-nav-link"},[L.icon_img?(r(),h(P,{key:0},[o("img",{src:L.icon_img,alt:L.label,class:ue(L.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,wte),L.icon_img_dark?(r(),h("img",{key:0,src:L.icon_img_dark,alt:L.label,class:"w-5 h-5 hidden dark:block"},null,8,Cte)):x("",!0)],64)):L.icon?(r(),E(X,{key:1,name:L.icon,class:"w-5 h-5"},null,8,["name"])):x("",!0),o("span",kte,[R(f(L.label)+" ",1),s(X,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,bte),s(ma,{accordion:"",visible:y(L),class:"fct-settings-nav-child-wrap"},{default:u(()=>[o("ul",Bte,[(r(!0),h(P,null,ae(L.child,(Q,H)=>(r(),h("li",{key:H,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":k(Q,H,L)}])},[o("div",{onClick:K=>b(Q),class:"fct-settings-nav-link"},f(Q.label),9,xte)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},$te={class:"fct-reports-view-inner"},Fte={class:"fct-report-body",id:"fct-report-body"},Ete={key:0,class:"fct-report-filter-wrap"},Ute={key:1,class:"fct-report-filter-button"},Ite={class:"fct-report-body-inner"},Vte={__name:"ReportsView",setup(e){var v;const t=M({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=tf(),l=Pa(),n=M((v=l.meta)==null?void 0:v.title),i=G(()=>qa.data);a.onFilterChanged(k=>{_(k)});const A=G(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(l.name)),p=G(()=>["reports_overview","reports","future_renewals"].includes(l.name));let m=null;const _=k=>{Object.entries(k).forEach(([b,w])=>{let B=w.value;switch(w.type==="multi-list"&&(B=w.value.map(S=>S.value)),b){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":qa.data[b]=B;break;case"dateRange":qa.data.dateRange=w.value,qa.data.rangeKey=w.rangeKey;break;case"variation_ids":qa.data[b]=Array.isArray(w.value)?w.value.map(S=>S.id):[];break}}),qa.onFilterChange()},g=()=>{var b,w;const k=a.retrieveSavedFilters();k?(a.data.selectedFilters={...k},((w=(b=k.dateRange)==null?void 0:b.value)==null?void 0:w.length)===2&&(a.data.dateRange=[k.dateRange.value[0],k.dateRange.value[1]])):a.data.selectedFilters={}},y=k=>{t.value=k};return be(()=>l.name,(k,b)=>{var w;n.value=((w=l.meta)==null?void 0:w.title)||"Reports"}),Te(()=>{qa.fetchReportMeta(),g(),m=document.getElementById("fluent_cart_plugin_app"),m&&m.classList.add("fct_report_page_plugin_app_wrap")}),xt(()=>{m&&m.classList.remove("fct_report_page_plugin_app_wrap")}),Ga(()=>{Qt.remove("product_variations")}),(k,b)=>{const w=C("router-view");return r(),h("div",{class:ue(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",$te,[s(Ste,{"onUpdate:menuState":y}),o("div",Fte,[s($a,{heading:c(d)(n.value),"show-save-button":!1},null,8,["heading"]),!p.value||A.value?(r(),h("div",Ete,[p.value?x("",!0):(r(),E(Wee,{key:0,"filter-state":c(a)},null,8,["filter-state"])),!p.value&&A.value?(r(),h("div",Ute,[s(_te,{"filter-state":c(a)},null,8,["filter-state"])])):x("",!0)])):x("",!0),o("div",Ite,[s(Fa),i.value.storeMode!==i.value.filterMode&&i.value.filterMode&&i.value.filterMode!==""?(r(),E(ol,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:k.$t("Your store is in %1$s mode but you are watching data in %2$s mode.",i.value.storeMode,i.value.filterMode)},null,8,["content"])):x("",!0),s(w,null,{default:u(({Component:B})=>[(r(),E(bl(B),{reportFilter:c(qa)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},Dte=nt(Vte,[["__scopeId","data-v-081223ea"]]),Tte={__name:"lineChart",props:{xAxis:{type:Array,default:()=>[],required:!0},yAxis:{type:Array,default:()=>[],required:!0},lineColor:{type:String,default:"#42b983"},backgroundGradient:{type:Array,required:!0},chartTitle:{type:String,default:""},hasCurrency:{type:Boolean,default:!1}},setup(e){const t=e,a=M(null),l=(y,v,k,b)=>({name:y,type:v,data:k,smooth:!0,color:b,showSymbol:!0,areaStyle:{color:new br(0,0,0,1,t.backgroundGradient.map(w=>({offset:w.offset,color:w.color})))}}),n=()=>{const y=[];return y.push(l("","line",t.yAxis,t.lineColor)),y},i=y=>{const v=y.split("-");if(v.length===3){const[k,b,w]=v;return`${Ka[parseInt(b)-1]} ${w}, ${k}`}else if(v.length===2){const[k,b]=v;return`${Ka[parseInt(b)-1]} ${k}`}else if(v.length===1){const[k]=v;return`${k}`}},A=G(()=>t.xAxis.map(y=>i(y)));let p=null;const m=()=>{if(a.value&&p==null){p=ca(a.value);const y={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?Ja(v*100):v},grid:{show:!1,left:"10%",right:"10%",bottom:"80%"},xAxis:{type:"category",data:A.value,axisLabel:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{show:!1},splitLine:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},series:n()};p.setOption(y),window.addEventListener("resize",()=>{p.resize()})}},_=()=>{p&&p.setOption({xAxis:{data:t.xAxis},series:n()})};be(()=>[t.xAxis,t.yAxis],()=>{$e(()=>{_()})});const g=()=>{_()};return Te(()=>{window.addEventListener("fluentCartCurrencyChange",g),$e(()=>{m()})}),xt(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},Qte=nt(Tte,[["__scopeId","data-v-b4cb951c"]]);function Tf(e){return Number(e)>0}function bs(e){return Tf(e)?"text-red-500":""}function Dl(e,t=null){return(t!==null?t:Tf(e))?`(${_t.scaled(e)})`:_t.scaled(e)}const Mte=["innerHTML"],zs={__name:"ReportSummary",props:{amount:{type:[Number,String],required:!0},placement:{type:String,default:"top"},title:{type:String,default:""}},setup(e){const t=e,a=G(()=>t.title?t.title+" "+t.amount:t.amount);return(l,n)=>{const i=C("el-tooltip");return r(),E(i,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:u(()=>[o("span",null,f(a.value),1)]),default:u(()=>[o("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,Mte)]),_:1},8,["placement"])}}},yl={__name:"Fluctuation",props:{fluctuation:{type:[String,Number],required:!0},isLiability:{type:Boolean,default:!1},placement:{type:String,default:"top"},amount:{type:[String,Number],required:!1},title:{type:String,default:""},hasCurrency:{type:Boolean,default:!0},isPercentage:{type:Boolean,default:!1},fluctuationSuffix:{type:String,default:""}},setup(e){const t=e,a=G(()=>qa.data.compareType!=="no_comparison"),l=G(()=>ha(t.fluctuation)),n=G(()=>(t.hasCurrency?_t.scaled:ha)(t.amount)),i=G(()=>(t.title?t.title:d("Previously"))+" "+n.value+(t.isPercentage?"%":"")),A=G(()=>{if(t.fluctuation===0)return"text-system-light";const m=t.fluctuation>0;return(t.isLiability?!m:m)?"text-success-500":"text-red-500"}),p=G(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(m,_)=>{const g=C("el-tooltip");return a.value?(r(),h("div",{key:0,class:ue(["percentage",A.value])},[e.fluctuation!==0?(r(),E(X,{key:0,class:"w-2",name:p.value},null,8,["name"])):x("",!0),s(g,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:u(()=>[o("span",null,f(i.value),1)]),default:u(()=>[o("span",{class:ue(["cursor-pointer",A.value])},[R(f(l.value)+"% ",1),e.fluctuationSuffix?(r(),h(P,{key:0},[R(f(e.fluctuationSuffix),1)],64)):x("",!0)],2)]),_:1},8,["placement"])],2)):x("",!0)}}},Lte={class:"fct-report-result"},Rte={key:0,class:"fct-report-result-content"},Ote={key:1,class:"fct-report-result-content"},Pte={class:"title flex items-center gap-1"},Hte={class:"value"},Nte={class:"inline-flex"},Kte={key:2,class:"fct-report-result-chart"},Gte={key:3,class:"fct-report-result-chart"},zte={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;G(()=>reportFilter.currentCurrencySign),G(()=>defaultReport.data.isBusy.salesReport);const a=(m,_)=>{const g=parseInt(m.replace("#",""),16),y=g>>16&255,v=g>>8&255,k=g&255;return`rgba(${y}, ${v}, ${k}, ${_})`},l=Re.colors.report,n=M([{title:d("Gross Sales"),key:"gross_sale",graph:"grossSaleGraph",lineColor:l.sea_green,backgroundGradient:[{offset:0,color:a(l.sea_green,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:d("The total sales you had in this period.")},{title:d("Refunds"),key:"total_refunded_amount",graph:"refundsGraph",lineColor:l.medium_slate_blue,backgroundGradient:[{offset:0,color:a(l.medium_slate_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:d("Refunds made in this period. This is deducted from gross sales to calculate revenue."),liability:!0},{title:d("Revenue"),key:"net_revenue",graph:"netRevenueGraph",lineColor:l.royal_blue,backgroundGradient:[{offset:0,color:a(l.royal_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:d("Gross sales less refunds, taxes, shipping, fees.")},{title:d("Orders"),key:"order_count",graph:"orderGraph",lineColor:l.medium_turquoise,backgroundGradient:[{offset:0,color:a(l.medium_turquoise,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:d("The total number of orders placed in this period.")},{title:d("Items"),key:"total_item_count",graph:"itemsSoldGraph",lineColor:l.deep_sky_blue,backgroundGradient:[{offset:0,color:a(l.deep_sky_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:d("The total number of items sold in this period.")},{title:d("Total Refunds"),key:"total_refunded",graph:"refundCountGraph",lineColor:l.golden_rod,backgroundGradient:[{offset:0,color:a(l.golden_rod,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:d("Total refunds count including partially refunds.")}]),i=G(()=>n.value.map(m=>({...m,value:t.defaultReport.summaryData[m.key]||0,fluctuation:t.defaultReport.fluctuations[m.key]||0,graph:t.defaultReport.data.graphs[m.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[m.graph]||!1,liability:m.liability||!1}))),A=m=>["net_revenue","total_refunded_amount","gross_sale"].includes(m),p=m=>A(m.key)?Dl(m.value,m.liability):ha(m.value);return(m,_)=>{const g=C("el-skeleton"),y=C("el-tooltip"),v=C("el-skeleton-item"),k=C("el-col"),b=C("el-row");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[s(b,{gutter:16,class:"gap-y-4"},{default:u(()=>[(r(!0),h(P,null,ae(i.value,(w,B)=>(r(),E(k,{lg:8,md:12,key:B},{default:u(()=>[s(jn,{class:"fct-report-summary-card h-[100px]"},{default:u(()=>[o("div",Lte,[w.dataBusy?(r(),h("div",Rte,[s(g,{animated:"",rows:1})])):(r(),h("div",Ote,[o("div",Pte,[R(f(w.title)+" ",1),s(y,{"popper-class":"fct-tooltip",content:w.info,placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",Hte,[o("div",Nte,[s(zs,{amount:p(w),title:w.title},null,8,["amount","title"])]),s(yl,{fluctuation:w.fluctuation,amount:e.defaultReport.data.previousSummary[w.key],"is-liability":w.liability,"has-currency":A(w.key)},null,8,["fluctuation","amount","is-liability","has-currency"])])])),w.dataBusy?(r(),h("div",Kte,[s(g,{animated:"",class:"flex items-center justify-end"},{template:u(()=>[s(v,{variant:"circle",class:"w-12.5 h-12.5 flex-none"})]),_:1})])):x("",!0),!w.dataBusy&&Object.keys(w.graph).length>0?(r(),h("div",Gte,[s(Qte,{ref_for:!0,ref:"lineChart",xAxis:Object.keys(w.graph),yAxis:Object.values(w.graph),lineColor:w.lineColor,backgroundGradient:w.backgroundGradient,"has-currency":A(w.key)},null,8,["xAxis","yAxis","lineColor","backgroundGradient","has-currency"])])):x("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const jte={key:0,class:"fct-report-sold-product-list has-scroll"},qte={class:"list-left-content"},Yte={class:"list-image"},Wte=["src","alt"],Jte=["src"],Xte={class:"list-title"},Zte={class:"list-title-inner"},eae={class:"list-id"},tae={class:"list-right-content"},aae={class:"list-value"},lae={class:"list-price"},sae={class:"inline-flex"},nae={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=Ll.data,a=G(()=>Ll.data.isBusy.topSoldVariants);return(l,n)=>{const i=C("el-skeleton"),A=C("router-link");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[s(jn,{class:"top-sold-variants","card-options":{heading:c(d)("Top Sold Variants")}},{default:u(()=>{var p,m;return[a.value?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(P,{key:1},[((m=(p=c(t))==null?void 0:p.topSoldVariants)==null?void 0:m.length)>0?(r(),h("ul",jte,[(r(!0),h(P,null,ae(c(t).topSoldVariants,_=>(r(),h("li",{key:_.product_id},[s(A,{to:{name:"product_edit",params:{product_id:_.product_id}}},{default:u(()=>{var g;return[o("div",qte,[o("div",Yte,[_.media_url!==null?(r(),h("img",{key:0,src:_.media_url,alt:(g=_.media)==null?void 0:g.title},null,8,Wte)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,Jte))]),o("div",Xte,[o("div",Zte,f(_.variation_name),1),o("div",eae,[o("strong",null,f(_.product_name),1)])])]),o("div",tae,[o("div",aae,f(_.quantity)+" "+f(c(d)(" Sold")),1),o("div",lae,[o("div",sae,f(c(_t).scaled(_.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no item!")},null,8,["text"]))],64))]}),_:1},8,["card-options"])]),_:1})}}},oae={key:0,class:"flex items-center gap-2 justify-between"},iae={class:"fct-btn-group sm"},rae={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=Re.colors,l=M(null),n=M(Re.isDark()),i=M("revenue"),A=M({}),p=S=>{const V=["#F6B51E","#855EF8","#47C2FF"],F=["#E6A819","#693EE0","#35ADE9"];return(n.value?F:V)[S]},m=G(()=>{if(typeof t.data.onetime_count===void 0)return[];if((t.data.onetime_count||0)===0&&(t.data.renewal_count||0)===0&&(t.data.subscription_count||0)===0)return[];const S={onetime:d("Onetime Payments"),renewal:d("Renewals"),subscription:d("Subscriptions")},V=t.data.order_count,F=[];return Object.keys(S).forEach(($,U)=>{F.push({name:S[$],value:t.data[$+"_count"]||0,count:t.data[$+"_count"]||0,gross:t.data[$+"_gross"]||0,net:t.data[$+"_net"]||0,percentage:V?(t.data[$+"_count"]/V*100).toFixed(2):0,color:p(U),visible:A.value[S[$]]!==!1})}),F}),_=G(()=>!m.value.length),g=G(()=>Ll.data.isBusy.salesReport),y=G(()=>m.value.filter(S=>A.value[S.name]!==!1).map((S,V)=>({value:i.value==="revenue"?S.net:S.count,count:S.count,name:S.name,gross:S.gross,net:S.net,itemStyle:{color:p(m.value.findIndex(F=>F.name===S.name))}})));let v=null;const k=()=>{v&&(v.dispose(),v=null),$e(()=>{l.value&&(v=ca(l.value),b())})},b=()=>{if(!v)return;const S={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",confine:!0,position:kl,formatterr:"{b}: {c} ({d}%)",formatter:function(V){const F=n.value?"#ffffff":"#565865";return` |
| 153 |
<div style="font-weight: bold; margin-bottom: 4px;"> |
| 154 |
${V.marker} ${V.name} (${V.percent}%) |
| 155 |
</div> |
| 156 |
<div> |
| 157 |
<span style="color: ${F};">${d("Orders")}</span> |
| 158 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};"> |
| 159 |
${ha(V.data.count)} |
| 160 |
</span> |
| 161 |
</div> |
| 162 |
<div> |
| 163 |
<span style="color: ${F};">${d("Gross Sales")}</span> |
| 164 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};"> |
| 165 |
${Ja(V.data.gross*100)} |
| 166 |
</span> |
| 167 |
</div> |
| 168 |
<div> |
| 169 |
<span style="color: ${F};">${d("Revenue")}</span> |
| 170 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};"> |
| 171 |
${Ja(V.data.net*100)} |
| 172 |
</span> |
| 173 |
</div> |
| 174 |
`},borderRadius:8,backgroundColor:n.value?"#38485a":"#ffffff",textStyle:{color:n.value?a.gray[25]:a.system.mid},borderColor:n.value?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"70%",data:y.value,label:{show:!0,color:n.value?a.gray[25]:a.system.dark},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},itemStyle:{emphasis:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};v.setOption(S,{notMerge:!0,replaceMerge:["series"]})};be([()=>m.value],()=>{$e(b)},{deep:!0}),be(_,S=>{S||k()}),be(g,S=>{S||k()}),be(i,()=>{b()});const w=S=>{n.value=Re.isDark(),b()},B=()=>{b()};return Te(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",B),$e(k)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w),window.removeEventListener("fluentCartCurrencyChange",B,!1)}),(S,V)=>{const F=C("el-button"),$=C("el-button-group"),U=C("el-skeleton");return r(),E(jn,{class:"sales-sources","card-options":{heading:c(d)("Sources")}},{action:u(()=>[_.value?x("",!0):(r(),h("div",oae,[s($,{class:"left"},{default:u(()=>[s(F,{size:"small",onClick:V[0]||(V[0]=D=>i.value="revenue"),type:i.value==="revenue"?"primary":""},{default:u(()=>[R(f(c(d)("Revenue")),1)]),_:1},8,["type"]),s(F,{size:"small",onClick:V[1]||(V[1]=D=>i.value="orders"),type:i.value==="orders"?"primary":""},{default:u(()=>[R(f(c(d)("Orders")),1)]),_:1},8,["type"])]),_:1}),o("div",iae,[s(Ea,{targetRef:l.value},null,8,["targetRef"])])]))]),default:u(()=>[g.value?(r(),E(U,{key:0,animated:"",rows:7})):(r(),h(P,{key:1},[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("No relevant data to plot the chart")},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1},8,["card-options"])}}},dae={class:"fct-default-report-page"},uae={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M(t.reportFilter),l=async n=>{n&&(await Ll.getSalesReport(n),await Ll.getTopSoldProducts(n),await Ll.getTopSoldVariants(n))};return Te(()=>{a.value&&a.value.addListener("default-report",l)}),xt(()=>{a.value&&a.value.removeListener("default-report")}),be(()=>t.reportFilter,n=>{a.value&&a.value.removeListener("default-report"),a.value=n,a.value&&(a.value.addListener("default-report",l),l(a.value.applicableFilters))},{immediate:!0}),(n,i)=>{const A=C("el-col"),p=C("el-row");return r(),h("div",dae,[s(zte,{"default-report":c(Ll)},null,8,["default-report"]),s(p,{gutter:30,class:"gap-y-4 my-5"},{default:u(()=>[s(A,{lg:12},{default:u(()=>[s(Td,{data:c(Ll).data.topSoldProducts,loading:c(Ll).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),s(A,{lg:12},{default:u(()=>[s(nae,{"default-report":c(Ll)},null,8,["default-report"])]),_:1}),x("",!0)]),_:1}),s(p,{gutter:30,class:"gap-y-4 my-5"},{default:u(()=>[s(A,{lg:12},{default:u(()=>[s(rae,{data:c(Ll).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class cae extends il{constructor(){super(...arguments);ze(this,"data",{order:["net_revenue","gross_sale","order_count","total_item_count","average_net","average_gross","average_order_items_count"],revenue:["Revenue","Gross Sales","Refund","Taxes","Shipping","Discount"],refund:["Total Refunds","Total Refunded Amount","Avg. Refunded Amount","Refund Rate","Total Paid"],product:["average_selling_price","units_sold","gross_sale","customer_count"]});ze(this,"storageKey","report-checkbox-filter");ze(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Qt.get(this.storageKey);this.data.order=a.order??this.data.order,this.data.revenue=a.revenue??this.data.revenue,this.data.refund=a.refund??this.data.refund}addListener(a,l){this.listeners[a]=l}async onCheckBoxChange(a,l){const n=this.data[a];n.includes(l)?this.data[a]=n.filter(i=>i!==l):this.data[a].push(l),this.syncStorage();for(let i in this.listeners)this.listeners[i](this.applicableFilters)}syncStorage(){Qt.set(this.storageKey,this.applicableFilters.checkbox)}removeListener(a){delete this.listeners[a]}get applicableFilters(){return{checkbox:{order:this.data.order,revenue:this.data.revenue,refund:this.data.refund,product:this.data.product}}}}const jl=cae.init();function _n(e,t){const a=G(()=>{if(t.value&&t.value!=="default")return d("Auto");const[n,i]=e.data.dateRange||[];if(!n||!i)return d("Auto");const A=Math.floor(Math.abs(new Date(i)-new Date(n))/(1e3*60*60*24));let p;return A<=91?p=d("Daily"):A<=365?p=d("Monthly"):p=d("Yearly"),d("Auto (%1$s)",p)});return{groupKeys:G(()=>[{value:"default",label:a.value},{value:"daily",label:d("Daily")},{value:"monthly",label:d("Monthly")},{value:"yearly",label:d("Yearly")}])}}const Aae={class:"fct-revenue-line-chart-wrap"},pae={class:"flex items-center gap-2"},fae={class:"fct-card-header-title is-small"},mae={class:"fct-chart-select"},hae={class:"fct-btn-group sm"},_ae={key:2,class:"chart-action-wrap"},vae={class:"chart-change-wrap"},gae={class:"chart-change"},yae={class:"text"},bae={class:"chart-change"},wae={class:"text"},Cae={__name:"RevenueLineChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=M(null),n=M(Ca.getChartType("revenue","revenue_chart")||"line"),i=M(!1),A=Re.colors.report,p=M(Re.isDark()),m=(T,I,L,O,Q,H=!1)=>({name:T,type:I,barMaxWidth:30,yAxisIndex:L,data:O,smooth:!1,color:Q,hidden:H,lineStyle:{width:3},areaStyle:{opacity:.3,color:Q},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(Q)},lineStyle:{color:Q},areaStyle:{opacity:.3,color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M(a.appliedGroupKey);be(()=>a.appliedGroupKey,T=>{_.value=T});const{groupKeys:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=G(()=>a.reportFilter.data.compareType!=="no_comparison"),b=G(()=>{let T=[{name:d("Current Revenue"),key:"net_revenue",type:n.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(I=>I.net_revenue)}];return k.value&&T.unshift({name:d("Compare Revenue"),key:"net_revenue",type:n.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(I=>({value:I.net_revenue,date:I.group})),hidden:!1}),T.map(I=>m(I.name,I.type,0,I.data,I.color,I.hidden))});let w=null;const B=()=>{w&&(w.dispose(),w=null),$e(()=>{l.value&&(w=ca(l.value),F())})},S=G(()=>{const T=Ks(a.reportFilter.data.dateRange);return d("This report looks at the revenue you received ")+T}),V=G(()=>fl(a.chartData.length)),F=()=>{if(!w)return;const T=Hl(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"},selected:Object.fromEntries(b.value.map(L=>[L.name,!L.hidden]))},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,A.dark_cyan_blue_16,A.light_gray_blue,n.value),confine:!0,position:kl,alwaysShowContent:!1,valueFormatter:L=>Ja(L*100),formatter:L=>{let O="";const Q=p.value?"#ffffff":"#565865";return L.forEach(function(H,K){const z=typeof H.data=="object"&&H.data!==null?Gs(H.data.date):H.name,Y=Ja(H.value*100),Z=L.length>1&&K===0;Z&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${z}</div>`,O+=`<div> |
| 175 |
${H.marker} |
| 176 |
<span style="color: ${Q}">${H.seriesName}</span> |
| 177 |
<span style="float: right; margin-left: 20px; color: ${Q}"> |
| 178 |
${ha(Y)} |
| 179 |
</span> |
| 180 |
</div>`,Z&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:V.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,formatter:L=>`${_t.scaled(L)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(I,{notMerge:!0,replaceMerge:["series"]})},$=()=>{i.value=!i.value,i.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()},U=T=>{Ca.onChange("revenue","revenue_chart",T),n.value!==T&&(i.value=!1,n.value=T,F())};be([()=>a.chartData,_],()=>{$e(F)},{deep:!0}),be(()=>jl.data.revenue,()=>{$e(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||B()}),be(()=>a.loading,T=>{T||B()});const D=()=>{p.value=Re.isDark(),$e(()=>{F()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("fluentCartCurrencyChange",D,!1)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("fluentCartCurrencyChange",D),$e(()=>{B()})}),(T,I)=>{const L=C("el-tooltip"),O=C("el-option"),Q=C("el-select"),H=C("el-skeleton");return r(),h("div",Aae,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",pae,[o("h5",fae,f(c(d)("Revenue Chart")),1),s(L,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",mae,[s(Q,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=K=>_.value=K),onChange:v},{default:u(()=>[(r(!0),h(P,null,ae(c(g),K=>(r(),E(O,{key:K.value,label:c(d)(K.label),value:K.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",hae,[s(Yl,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),s(tt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:$,class:ue(i.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?x("",!0):(r(),h("div",_ae,[o("div",vae,[o("div",gae,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",yae,f(c(d)("Data")),1)]),o("div",bae,[o("span",wae,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},kae={components:{DynamicIcon:X},props:{data:{type:Array,required:!0},filename:{type:String,default:"data.csv"}},methods:{exportCSV(){const t=(n=>{const i=_=>_.replace(/_/g," ").replace(/\b\w/g,g=>g.toUpperCase()),A=Object.keys(n[0]),m=[A.map(i).join(",")];return n.forEach(_=>{const g=A.map(y=>{let v=_[y];return typeof v=="object"&&(v=JSON.stringify(v)),typeof v=="string"&&(v=`"${v.replace(/"/g,'""')}"`),v});m.push(g.join(","))}),m.join(` |
| 181 |
`)})(this.data),a=new Blob([t],{type:"text/csv"}),l=document.createElement("a");l.href=URL.createObjectURL(a),l.download=this.filename,l.click(),URL.revokeObjectURL(l.href)}}};function Bae(e,t,a,l,n,i){const A=C("DynamicIcon"),p=C("el-button");return r(),E(p,{onClick:i.exportCSV,size:"small"},{default:u(()=>[s(A,{name:"Download"}),R(" "+f(e.$t("Export")),1)]),_:1},8,["onClick"])}const Yn=nt(kae,[["render",Bae]]),xae=["innerHTML"],Sae=["innerHTML"],$ae=["innerHTML"],Fae=["innerHTML"],Eae=["innerHTML"],Uae=["innerHTML"],Iae=["innerHTML"],Vae=["innerHTML"],Dae={name:"Revenue",props:{revenueReport:{type:Array,required:!0},appliedGroupKey:{type:String},loading:{type:Boolean,default:!0}},computed:{dateFormat(){if(!this.revenueReport.length)return"";const e=this.revenueReport[0].group.split("-");return e.length===3?Ol("date"):e.length===2?Ol("month_year"):""},tableData(){const e=this.revenueReport.reduce((t,a)=>{const l=a.year;return t[l]||(t[l]={year:l,order_count:0,net_revenue:0,gross_sale:0,total_refunded_amount:0,tax_total:0,shipping_total:0,items:[]}),t[l].order_count+=Number(a.order_count),t[l].net_revenue+=Number(a.net_revenue),t[l].gross_sale+=Number(a.total_sales),t[l].total_refunded_amount+=Number(a.total_refunds),t[l].tax_total+=Number(a.total_tax),t[l].shipping_total+=Number(a.shipping_total),t[l].items.push(a),t},{});return Object.values(e)}},data(){return{}},methods:{formatDate(e){return at(e).locale(as()).format(Ol("date"))},formatCurrency(e){return _t.scaled(e)},liabilityClass:bs,maybeLiability:Dl}},Tae=Object.assign(Dae,{setup(e){return(t,a)=>{const l=C("el-skeleton"),n=C("el-table-column"),i=C("el-table"),A=C("el-empty");return r(),E(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Revenue Breakdown"),title_size:"small"},sa({_:2},[e.loading?void 0:{name:"action",fn:u(()=>[s(Yn,{data:e.revenueReport,filename:"revenue.csv"},null,8,["data"])]),key:"0"}]),1032,["title"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[e.loading?(r(),E(l,{key:0,animated:"",rows:2,class:"p-4"})):(r(),E(i,{key:1,data:t.tableData,"row-key":"year","default-expand-all":!1,class:"w-full"},{empty:u(()=>[s(A,{description:c(d)("No data available")},null,8,["description"])]),default:u(()=>[t.dateFormat?(r(),E(n,{key:0,type:"expand"},{default:u(p=>[s(i,{data:p.row.items,"row-key":"month",size:"small",border:"",class:"w-full"},{default:u(()=>[s(n,{prop:"group",label:c(d)("Date"),"min-width":"160"},{default:u(m=>[R(f(c(at)(m.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),s(n,{prop:"order_count",label:c(d)("Order Count"),"min-width":"140"},{default:u(m=>[R(f(c(d)(c(ha)(m.row.order_count))),1)]),_:1},8,["label"]),s(n,{prop:"total_sales",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.total_sales))},null,8,xae)]),_:1},8,["label"]),s(n,{label:c(d)("Refunds"),"min-width":"150"},{default:u(m=>[o("div",{class:ue(["inline-flex",c(bs)(m.row.total_refunds)]),innerHTML:c(Dl)(m.row.total_refunds)},null,10,Sae)]),_:1},8,["label"]),t.tax_total>0?(r(),E(n,{key:0,prop:"total_tax",label:c(d)("Taxes"),"min-width":"150"},{default:u(m=>[o("div",{class:ue(["inline-flex",c(bs)(m.row.total_tax)])},f(c(Dl)(m.row.total_tax)),3)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(r(),E(n,{key:1,prop:"shipping_total",label:c(d)("Shipping"),"min-width":"150"},{default:u(m=>[o("div",{class:ue(["inline-flex",c(bs)(m.row.shipping_total)])},f(c(Dl)(m.row.shipping_total)),3)]),_:1},8,["label"])):x("",!0),s(n,{prop:"net_revenue",label:c(d)("Revenue"),"min-width":"180"},{default:u(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.net_revenue))},null,8,$ae)]),_:1},8,["label"])]),_:2},1032,["data"])]),_:1})):x("",!0),s(n,{prop:"year",label:c(d)("Year"),"min-width":"50",fixed:""},null,8,["label"]),s(n,{prop:"order_count",label:c(d)("Order Count"),"min-width":"120"},{default:u(p=>[R(f(c(d)(c(ha)(p.row.order_count))),1)]),_:1},8,["label"]),s(n,{prop:"gross_sale",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.gross_sale)},null,8,Fae)]),_:1},8,["label"]),s(n,{label:c(d)("Refunds"),"min-width":"150"},{default:u(p=>[o("div",{class:ue(["inline-flex",c(bs)(p.row.total_refunded_amount)]),innerHTML:c(Dl)(p.row.total_refunded_amount)},null,10,Eae)]),_:1},8,["label"]),t.tax_total>0?(r(),E(n,{key:1,prop:"tax_total",label:c(d)("Taxes"),"min-width":"150"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.tax_total)},null,8,Uae)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(r(),E(n,{key:2,prop:"shipping_total",label:c(d)("Shipping"),"min-width":"150"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.shipping_total)},null,8,Iae)]),_:1},8,["label"])):x("",!0),s(n,{prop:"net_revenue",label:c(d)("Revenue"),"min-width":"180"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.net_revenue)},null,8,Vae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function Ps(e){var t;return((t=Nm.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const Qae={class:"px-5 pb-4"},Mae={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton");return r(),E(n,{loading:e.loading,animated:""},{template:u(()=>[o("div",Qae,[s(l,{class:"w-full h-7"})]),(r(),h(P,null,ae(8,i=>o("div",{key:i,class:"flex items-center gap-5 px-5"},[s(l,{class:"w-1/2 h-4 mb-3"}),s(l,{class:"w-1/2 h-4 mb-3"}),s(l,{class:"w-1/2 h-4 mb-3"}),s(l,{class:"w-1/2 h-4 mb-3"})])),64))]),_:1},8,["loading"])}}},Lae={class:"fct-btn-group sm w-[240px] gap-2"},Rae={class:"capitalize"},Oae={class:"capitalize"},Pae=["innerHTML"],Hae=["innerHTML"],Nae=["innerHTML"],Kae=["innerHTML"],Gae=["innerHTML"],zae={__name:"RevenueGroupedBy",props:{tableData:{type:Object},reportFilter:{type:Object},revenueReport:{type:Object}},emits:["fetch-data-by-group"],setup(e,{emit:t}){const a=e,l=t;G(()=>a.reportFilter.currentCurrencySign);const n=[{label:"Billing Country",value:"billing_country"},{label:"Shipping Country",value:"shipping_country"},{label:"Payment Method",value:"payment_method"}];M({offline_payment:"Cash On Delivery",paypal:"PayPal",stripe:"Stripe"});const i=M("billing_country"),A=()=>{l("fetch-data-by-group",i.value)};return(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:p.$t("Grouped by"),title_size:"small"},{action:u(()=>[o("div",Lae,[s(g,{class:"el-select--x-small",modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=k=>i.value=k),onChange:A,placeholder:p.$t("Select Group")},{default:u(()=>[(r(),h(P,null,ae(n,k=>s(_,{key:k.value,label:p.$t(k.label),value:k.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),s(Yn,{data:e.tableData,filename:"revenue grouped by.csv",class:"!ml-0"},null,8,["data"])])]),_:1},8,["title"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[s(Mae,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?x("",!0):(r(),E(v,{key:0,data:e.tableData,"max-height":"390"},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:p.$t("Currently there is no data!")},null,8,["text"])]),default:u(()=>[i.value==="country"?(r(),E(y,{key:0,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(k=>[R(f(k.row.country),1)]),_:1},8,["label"])):x("",!0),i.value==="shipping_country"?(r(),E(y,{key:1,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(k=>[o("span",Rae,f(c(Ps)(k.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),i.value==="billing_country"?(r(),E(y,{key:2,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(k=>[o("span",Oae,f(c(Ps)(k.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),i.value==="payment_method"?(r(),E(y,{key:3,prop:"payment_method",label:p.$t("Payment Method"),"min-width":"150"},{default:u(k=>[R(f(k.row.payment_method),1)]),_:1},8,["label"])):x("",!0),s(y,{prop:"order_count",label:p.$t("Order Count"),"min-width":"150"},{default:u(k=>[R(f(c(d)(k.row.orders)),1)]),_:1},8,["label"]),s(y,{prop:"total_sales",label:p.$t("Gross Sales"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(_t).scaled(k.row.gross_sale)},null,8,Pae)]),_:1},8,["label"]),s(y,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:u(k=>[o("div",{class:ue(["inline-flex",c(bs)(k.row.total_refunds)]),innerHTML:c(Dl)(k.row.total_refunds)},null,10,Hae)]),_:1},8,["label"]),p.total_tax>0?(r(),E(y,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:u(k=>[o("div",{class:ue(["inline-flex",c(bs)(k.row.total_tax)]),innerHTML:c(Dl)(k.row.total_tax)},null,10,Nae)]),_:1},8,["label"])):x("",!0),p.shipping_total>0?(r(),E(y,{key:5,prop:"shipping_total",label:p.$t("Shipping"),"min-width":"150"},{default:u(k=>[o("div",{class:ue(["inline-flex",c(bs)(k.row.shipping_total)]),innerHTML:c(Dl)(k.row.shipping_total)},null,10,Kae)]),_:1},8,["label"])):x("",!0),s(y,{prop:"net_revenue",label:p.$t("Revenue"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(_t).scaled(k.row.net_sale)},null,8,Gae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class jae extends il{constructor(){super(...arguments);ze(this,"data",{revenueReport:[],previousMetrics:[],netRevenueByGroup:[],summary:{},previousSummary:{},fluctuations:{},isBusy:{revenueReport:!0,netRevenueByGroup:!1,revenueSummary:!1,fluctuations:!1,chartData:!1,productBarRacer:!1},chartData:[],productBarRacer:[],appliedGroupKey:"default"})}get controllerKey(){return"RevenueReportController"}makeRequest(a,l,n,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const A=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,n,i),A}resolvePromiseResponse(a,l=null,n=null){a.then(i=>{n==null||l==null?Object.assign(this.data,i):this.data[n]=i[l]}).catch(i=>{}).finally(()=>{n&&(this.data.isBusy[n]=!1)})}getReportData(a={}){return this.makeRequest("revenue",a,null,"revenueReport")}getReportByGroup(a={}){return this.makeRequest("revenue-by-group",a,"data","netRevenueByGroup")}getChartData(a={}){return this.makeRequest("revenue-chart",a,"revenueReport","chartData")}getProductBarRacer(a={}){return this.makeRequest("fetch-product-bar-racer",a,"productBarRacer","productBarRacer")}}const Da=jae.init(),ql={__name:"SummaryLoader",props:{loading:{type:Boolean,default:!1},count:{type:Number,default:1},marginBottom:{type:Number,default:7.5},padding:{type:Number,default:4},rows:{type:Number,default:1}},setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton");return r(),E(n,{loading:"loading",animated:""},{template:u(()=>[o("div",{class:ue(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:fa(`--loader-grid-cols: ${e.count};`)},[(r(!0),h(P,null,ae(e.rows,i=>(r(),h(P,{key:i},[(r(!0),h(P,null,ae(e.count,A=>(r(),h("div",{key:A},[s(l),s(l,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},qae={class:"summary-item-inner"},Yae={class:"value"},Wae={class:"inner-value"},Jae={class:"title"},Xae={__name:"RevenueReportSummary",props:{reportFilter:{type:Object}},setup(e){const t=[{title:d("Gross Sales"),key:"gross_sale",info:d("The total sales you had in this period.")},{title:d("Refunds"),key:"total_refunded_amount",liability:!0,info:d("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:d("Taxes"),key:"tax_total",liability:!0,info:d("Taxes paid in orders. This is deducted from gross sales to calculate revenue.")},{title:d("Shipping"),key:"shipping_total",liability:!0,info:d("Shipping paid in orders. This is deducted from gross sales to calculate revenue.")},{title:d("Revenue"),key:"net_revenue",info:d("Gross sales less refunds, taxes, shipping, fees.")}],a=G(()=>t.map(n=>({key:n.key,title:n.title,value:Da.data.summary[n.key]||0,fluctuation:Da.data.fluctuations[n.key]||0,liability:n.liability||!1,info:n.info})).filter(n=>["tax_total","shipping_total"].includes(n.key)?n.value!==0:!0)),l=G(()=>Da.data.isBusy.revenueReport);return(n,i)=>{const A=C("el-tooltip");return l.value?(r(),E(ql,{key:0,loading:l.value,count:a.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:"fct-report-order-summary",style:fa(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(P,null,ae(a.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",qae,[o("div",Yae,[o("div",Wae,[s(zs,{amount:c(Dl)(p.value,p.liability),title:p.title},null,8,["amount","title"])]),s(yl,{fluctuation:p.fluctuation,amount:c(Da).data.previousSummary[p.key],"is-liability":p.liability},null,8,["fluctuation","amount","is-liability"])]),o("div",Jae,[R(f(p.title)+" ",1),s(A,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},Zae={name:"Comparison",components:{CardContainer:xe,CardHeader:Ve,CardBody:Be},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.currentMetrics.forEach((t,a)=>{const l=parseFloat(t.net_revenue);let n={group:this.formatDate(t.group),net_revenue:l};if(this.hasComparison){const i=this.previousMetrics[a];if(i){const A=parseFloat(i.net_revenue),p=A?((l-A)/A*100).toFixed(2):"n/a";n.previous_revenue=A,n.percent_change=p,n.group=`${this.formatDate(t.group)} vs ${this.formatDate(i.group)}`}}e.push(n)}),e}},methods:{translate:d,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,n]=t;return`${Ka[parseInt(l)-1]} ${n}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Ka[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}},formatCurrency(e){return _t.scaled(e)}}},ele={class:"fct-revenue-comparison"},tle=["innerHTML"],ale=["innerHTML"];function lle(e,t,a,l,n,i){const A=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",ele,[s(y,{class:"overflow-hidden"},{default:u(()=>[s(A,{title:i.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),s(g,{class:"px-0 pb-0"},{default:u(()=>[a.loading?(r(),E(p,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:u(()=>[s(m,{label:i.translate("Period")},{default:u(v=>[R(f(v.row.group),1)]),_:1},8,["label"]),s(m,{label:i.translate("Current Revenue")},{default:u(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.net_revenue)},null,8,tle)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[s(m,{label:i.translate("Compare Revenue")},{default:u(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.previous_revenue)},null,8,ale)]),_:1},8,["label"]),s(m,{label:i.translate("Change")+" (%)"},{default:u(v=>[o("span",{class:ue(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const sle=nt(Zae,[["render",lle]]),nle={class:"fct-revenue-report-page"},ole={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M("default"),l=t.reportFilter,n=l.applicableFilters,i=(g,y="default")=>{Da.getReportData({params:{...g.params,groupKey:y}})},A=g=>{Da.getReportData({params:{...n.params,groupKey:g}})},p=g=>{g!==Da.data.appliedGroupKey&&(a.value=g,i(n,a.value))},m=g=>{Da.getReportByGroup({params:{...n.params,groupKey:g}})},_=g=>{i(g,a.value),Da.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return Te(()=>{l.addListener("revenue-report",_),_(n)}),xt(()=>{l.removeListener("revenue-report")}),(g,y)=>(r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",nle,[s(Xae,{reportFilter:c(l)},null,8,["reportFilter"]),s(Cae,{chartData:c(Da).data.revenueReport,compareData:c(Da).data.previousMetrics,reportFilter:c(l),appliedGroupKey:a.value,onFilterData:p,"is-empty":!c(Da).data.summary.gross_sale,loading:c(Da).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),s(sle,{class:"my-7.5",currentMetrics:c(Da).data.revenueReport,previousMetrics:c(Da).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:c(l),loading:c(Da).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),s(Tae,{revenueReport:c(Da).data.revenueReport,appliedGroupKey:a.value,onFetchData:A,loading:c(Da).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),s(zae,{tableData:c(Da).data.netRevenueByGroup,reportFilter:c(l),revenueReport:c(Da),onFetchDataByGroup:m},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class ile extends il{constructor(){super(...arguments);ze(this,"data",{summary:{},previousSummary:{},fluctuations:{},orderChartData:[],newVsReturning:[],orderByGroup:[],itemCountDistribution:[],grossSaleByDay:[],averageOrderGross:[],grossSaleByHour:[],orderCompletionTime:[],averageOrderItems:[],orderValueDistribution:[],orderByDayAndHour:[],dashBoardStats:[],isBusy:{summary:!1,fluctuations:!1,orderChartData:!0,newVsReturning:!0,orderByGroup:!1,itemCountDistribution:!1,grossSaleByDay:!1,averageOrderGross:!1,grossSaleByHour:!1,orderCompletionTime:!1,averageOrderItems:!1,orderValueDistribution:!1,orderByDayAndHour:!1,dashBoardStats:!1}})}get controllerKey(){return"OrderReportController"}makeRequest(a,l,n,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const A=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,n,i),A}resolvePromiseResponse(a,l=null,n=null){a.then(i=>{n==null||l==null?Object.assign(this.data,i):this.data[n]=i[l]}).catch(i=>{}).finally(()=>{this.data.isBusy[n]=!1})}getOrderChartData(a={}){return this.data.isBusy.orderChartData=!0,this.makeRequest("order-chart",a).then(()=>this.data.isBusy.orderChartData=!1)}getNewVsReturningCustomer(a={}){return this.data.isBusy.newVsReturning=!0,this.makeRequest("fetch-new-vs-returning-customer",a).then(()=>this.data.isBusy.newVsReturning=!1)}getOrderByGroup(a={}){return this.makeRequest("fetch-order-by-group",a,"data","orderByGroup")}getItemCountDistribution(a={}){return this.makeRequest("item-count-distribution",a,"data","itemCountDistribution")}getOrderCompletionTime(a={}){return this.makeRequest("order-completion-time",a,"data","orderCompletionTime")}getOrderValueDistribution(a={}){return this.makeRequest("order-value-distribution",a,"data","orderValueDistribution")}getReportByDayAndHour(a={}){return this.data.isBusy.orderByDayAndHour=!0,this.makeRequest("fetch-report-by-day-and-hour",a).then(()=>this.data.isBusy.orderByDayAndHour=!1)}getDashboardStats(a={}){return this.makeRequest("dashboard-stats",a,"dashBoardStats","dashBoardStats")}}const Rt=ile.init(),rle={key:1,class:"fct-report-order-summary summary-col-4"},dle={class:"summary-item-inner"},ule={class:"value"},cle={key:0,class:"summary-checkbox"},Ale={class:"inner-value"},ple={class:"title"},fle={__name:"Summary",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=[{title:d("Gross Sales"),key:"gross_sale",content:d("The total sales you had in this period."),checkable:!0,hasCurrency:!0},{title:d("Refunds"),key:"total_refund",liability:!0,hasCurrency:!0,content:d("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:d("Revenue"),key:"net_revenue",hasCurrency:!0,content:d("Gross sales less refunds, taxes, shipping, fees."),checkable:!0},{title:d("Orders"),key:"order_count",content:d("The total number of orders placed in this period."),checkable:!0,hideCurrency:!0},{title:d("Items"),key:"total_item_count",content:d("The total number of items sold in this period."),hideCurrency:!0},{title:d("Average Gross"),key:"average_gross",hasCurrency:!0,content:d("Average gross sales per order in this period.")},{title:d("Average Revenue"),key:"average_net",hasCurrency:!0,content:d("Average revenue per order in this period.")},{title:d("Average Order Items"),key:"average_order_items_count",content:d("Average number of items per order in this period."),hideCurrency:!0}],l=G(()=>a.map(m=>({...m,value:t.orderReport.data.summary[m.key]||0,fluctuation:t.orderReport.data.fluctuations[m.key]||0,liability:m.liability||!1,hasCurrency:m.hasCurrency||!1}))),n=G(()=>a.filter(m=>!m.hideCurrency).map(m=>m.key)),i=G(()=>t.orderReport.data.isBusy.orderChartData),A=m=>{jl.onCheckBoxChange("order",m)},p=m=>n.value.includes(m.key)?Dl(m.value,m.liability):ha(m.value);return(m,_)=>{const g=C("el-checkbox"),y=C("el-tooltip");return i.value?(r(),E(ql,{key:0,count:4,rows:2})):(r(),h("div",rle,[(r(!0),h(P,null,ae(l.value,(v,k)=>(r(),h("div",{class:"summary-item",key:k},[o("div",dle,[o("div",ule,[v.checkable?(r(),h("div",cle,[s(g,{"true-value":!0,"false-value":!1,"model-value":c(jl).data.order.includes(v.key),onChange:()=>A(v.key)},null,8,["model-value","onChange"])])):x("",!0),o("div",Ale,[s(zs,{amount:p(v),title:v.title},null,8,["amount","title"])]),s(yl,{fluctuation:v.fluctuation,amount:e.orderReport.data.previousSummary[v.key],"is-liability":v.liability,"has-currency":v.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",ple,[R(f(v.title)+" ",1),s(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},mle={__name:"OrderHeatMap",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let l=null;const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=Re.colors,A=M(Re.isDark()),p=G(()=>{const b=[];return t.chartData.forEach((w,B)=>{n.forEach((S,V)=>{b.push([B,V,w[S]])})}),b}),m=G(()=>t.chartData.length?Math.max(...t.chartData.flatMap(b=>n.map(w=>b[w]||0))):0),_=G(()=>A.value?["#000000",i.blue[500]]:["#ffffff",i.blue[600]]),g=G(()=>Object.values(t.chartData).every(b=>b.order_count===0)),y=G(()=>Rt.data.isBusy.orderByDayAndHour),v=()=>{l&&(l.dispose(),l=null),$e(()=>{if(a.value){l=ca(a.value,null,{renderer:"svg"});const b=t.chartData.map(S=>S.hour),w=n,B={tooltip:{position:"top",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},formatter:S=>{const V=A.value?"#ffffff":"#000000";let F=`<div style="color: ${V};"><div>${n[S.data[1]]}, ${S.name||"-"}</div>`;return F+=`<div style="color: ${V};"> |
| 182 |
${S.marker} |
| 183 |
<span style="color: ${V};">${S.seriesName}</span> |
| 184 |
<span style="float: right; margin-left: 20px; color: ${V};"> |
| 185 |
${S.data[2]} |
| 186 |
</span> |
| 187 |
</div>`,F+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:b,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},yAxis:{type:"category",data:w,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},visualMap:{min:0,max:m.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:_.value}},series:[{name:d("Orders"),type:"heatmap",data:p.value,label:{show:!0},itemStyle:{borderColor:"#e0e0e0",borderWidth:1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};l.setOption(B)}})};be([p,m],()=>{$e(()=>{v()})}),be(g,b=>{b||v()}),be(y,b=>{b||v()});const k=()=>{A.value=Re.isDark(),$e(()=>{v()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",k),$e(()=>{v(),window.addEventListener("resize",()=>l==null?void 0:l.resize())})}),Ga(()=>{l&&(window.removeEventListener("resize",()=>l==null?void 0:l.resize()),window.removeEventListener("onFluentCartThemeChange",k,!1),l.dispose(),l=null)}),(b,w)=>{const B=C("el-skeleton");return r(),E(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[y.value?(r(),E(B,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(P,{key:1},[g.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512))],64))]),_:1})]),_:1})}}},hle={class:"fct-gross-sale-vs-net-revenue-wrap"},_le={class:"flex items-center gap-2"},vle={class:"fct-card-header-title is-small"},gle={class:"fct-chart-select"},yle={class:"fct-btn-group sm"},ble={key:2,class:"chart-action-wrap"},wle={class:"chart-change-wrap"},Cle={class:"chart-change"},kle={class:"text"},Ble={class:"chart-change"},xle={class:"text"},Sle={__name:"OrderLineChart",props:{chartData:{type:Array,required:!0},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=M(null),n=M("default"),i=M(Ca.getChartType("order","order_chart")||"line"),A=M(!1),p=Re.colors.report,m=M(Re.isDark()),{groupKeys:_}=_n(a.reportFilter,n),g=t,y=()=>{g("fetch-chart-data",n.value)},v=G(()=>Rt.data.isBusy.orderChartData),k=G(()=>[{title:d("Orders"),key:"order_count",color:m.value?p.dark_cyan_blue_16:p.light_gray,yAxisIndex:1,type:"bar"},{title:d("Gross Sales"),key:"gross_sale",color:m.value?p.blue_dark_mode:p.blue,yAxisIndex:0,type:"line"},{title:d("Revenue"),key:"net_revenue",color:m.value?p.purple_dark_mode:p.purple,yAxisIndex:0,type:"line"}].filter(({key:L})=>jl.data.order.includes(L)).map(({title:L,key:O,color:Q,yAxisIndex:H,type:K})=>U(L,K,H,a.chartData.map(W=>W[O]),Q))),b=G(()=>a.chartData.map(L=>Gs(L.group)));let w=null;const B=M(!0),S=()=>{w&&(w.dispose(),w=null),$e(()=>{l.value&&(w=ca(l.value),$(),w.on("legendselectchanged",L=>{B.value=L.selected.Orders}))})},V=G(()=>{const L=Ks(a.reportFilter.data.dateRange);return d("This report looks at orders created ")+L}),F=G(()=>fl(a.chartData.length)),$=()=>{if(!w)return;const L={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:m.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:Ql(m.value,p.dark_cyan_blue_16,p.light_gray_blue),confine:!0,position:kl,formatter:O=>{let Q=O[0].axisValue;const H=m.value?"#ffffff":"#565865";return O.forEach(function(K,W){const z=W===0?K.value:Ja(K.value*100);Q+=`<div> |
| 188 |
${K.marker} |
| 189 |
<span style="color: ${H};">${K.seriesName}</span> |
| 190 |
<span style="float: right; margin-left: 20px; color: ${H};"> |
| 191 |
${z} |
| 192 |
</span> |
| 193 |
</div>`}),Q}},xAxis:{type:"category",data:b.value,axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,interval:F.value.interval},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{name:d("Sales"),type:"value",position:"left",axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,formatter:O=>`${_t.scaled(O)}`},splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:d("Orders"),type:"value",position:"right",axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:k.value};w.setOption(L,{notMerge:!0,replaceMerge:["series"]})},U=(L,O,Q,H,K)=>({name:L,type:O,yAxisIndex:Q,barMaxWidth:30,data:H,smooth:!1,color:K,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:K,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(K)},lineStyle:{color:K},areaStyle:{opacity:.3,color:K}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),D=()=>{A.value=!A.value,A.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):$()};be([()=>a.chartData,i],()=>{$e($)},{deep:!0}),be(()=>jl.data.order,()=>{$e(()=>{$()})},{deep:!0}),be(()=>a.isEmpty,L=>{L||S()}),be(v,L=>{L||S()}),be(B,()=>{if(!w)return;const O=w.getOption().series.map(Q=>Q.type==="line"?{...Q,areaStyle:B.value?void 0:{opacity:.3}}:Q);$e(()=>{w.setOption({series:O})})});const T=()=>{m.value=Re.isDark(),$e(()=>{$()})},I=()=>{$e(()=>{$()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("fluentCartCurrencyChange",I,!1)}),Te(()=>{$e(S),window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("fluentCartCurrencyChange",I)}),(L,O)=>{const Q=C("el-tooltip"),H=C("el-option"),K=C("el-select"),W=C("el-skeleton");return r(),h("div",hle,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",_le,[o("h5",vle,f(c(d)("Order Chart")),1),s(Q,{"popper-class":"fct-tooltip",content:V.value,placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",gle,[s(K,{class:"el-select--x-small",modelValue:n.value,"onUpdate:modelValue":O[0]||(O[0]=z=>n.value=z),onChange:y},{default:u(()=>[(r(!0),h(P,null,ae(c(_),z=>(r(),E(H,{key:z.value,label:z.label,value:z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",yle,[s(tt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:D,class:ue(A.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}]),1024),s(Be,null,{default:u(()=>[v.value?(r(),E(W,{key:0,animated:"",rows:4})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-order-line-chart",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?x("",!0):(r(),h("div",ble,[o("div",wle,[o("div",Cle,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",kle,f(c(d)("Data")),1)]),o("div",Ble,[o("span",xle,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},$le={class:"fct-report-monthly-list"},Fle={class:"list-left-content"},Ele={class:"list-title"},Ule={class:"list-right-content"},Ile={class:"list-value"},Vle={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=G(()=>qa.currentCurrencySign),l=[{title:d("Average Monthly Gross"),key:"monthly_gross",currencySign:a,hasCurrency:!0},{title:d("Average Monthly Revenue"),key:"monthly_net",currencySign:a,hasCurrency:!0},{title:d("Average Monthly Orders"),key:"monthly_orders"},{title:d("Average Monthly Items"),key:"monthly_items"}],n=G(()=>l.map(A=>({...A,value:t.orderReport.data.summary[A.key]||0,fluctuation:t.orderReport.data.fluctuations[A.key]||0,hasCurrency:A.hasCurrency||!1}))),i=A=>["monthly_net","monthly_gross"].includes(A.key)?_t.scaled(A.value):ha(A.value);return(A,p)=>(r(),h("ul",$le,[(r(!0),h(P,null,ae(n.value,(m,_)=>(r(),h("li",{key:_},[o("div",Fle,[o("div",Ele,f(m.title),1)]),o("div",Ule,[o("div",Ile,[s(zs,{amount:i(m),title:m.title},null,8,["amount","title"]),s(yl,{fluctuation:m.fluctuation,amount:e.orderReport.data.previousSummary[m.key],"is-liability":!1,"has-currency":m.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},Dle={class:"fct-report-result-content"},Tle={class:"value"},Qle={class:"inline-flex"},Mle={class:"title"},Lle={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=G(()=>t.reportFilter.currentCurrencySign),l=[{title:d("Taxes"),content:d("Total amount of taxes"),key:"tax_total",currencySign:a.value},{title:d("Shipping"),content:d("Total amount of shipping costs"),key:"shipping_total",currencySign:a.value}],n=G(()=>l.map(i=>({...i,value:t.orderReport.data.summary[i.key]||0,fluctuation:t.orderReport.data.fluctuations[i.key]||0})).filter(i=>i.value>0));return(i,A)=>{const p=C("el-tooltip");return r(),h("div",{class:"fct-report-avg-wrap mb-7.5",style:fa(`--avg-grid-cols: ${n.value.length}`)},[(r(!0),h(P,null,ae(n.value,m=>(r(),h("div",{class:"fct-report-result",key:m.title},[o("div",Dle,[o("div",Tle,[o("span",Qle,f(c(_t).scaled(m.value)),1),m.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:fa({color:m.fluctuation>0?"green":"red"})},[m.fluctuation>0?(r(),E(X,{key:0,class:"w-2",name:"CaretUp"})):x("",!0),m.fluctuation<0?(r(),E(X,{key:1,class:"w-2",name:"CaretDown"})):x("",!0),R(" "+f(c(ha)(m.fluctuation))+"% ",1)],4)):x("",!0)]),o("div",Mle,[R(f(m.title)+" ",1),m.content?(r(),E(p,{key:0,"popper-class":"fct-tooltip",content:m.content,placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):x("",!0)])])]))),128))],4)}}},Rle={class:"flex items-center gap-2"},Ole={class:"fct-card-header-title is-small"},Ple={class:"fct-btn-group sm"},Hle=["innerHTML"],Nle=["innerHTML"],Kle=["innerHTML"],Gle=["innerHTML"],zle={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;M("number");const a=M(!1),l=G(()=>Rt.data.isBusy.newVsReturning),n=G(()=>{if(a.value===!0){const A=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],p={customer_type:"New"},m={customer_type:"Returning"};return A.forEach(_=>{const g=parseFloat(t.tableData[0][_]),y=parseFloat(t.tableData[1][_]),v=g+y;p[_]=g*100/v,m[_]=y*100/v}),[p,m]}return t.tableData});G(()=>t.reportFilter.currentCurrencySign),Te(()=>{});const i=A=>`${parseFloat(A).toFixed(2)}%`;return(A,p)=>{const m=C("el-tooltip"),_=C("el-checkbox"),g=C("el-skeleton"),y=C("el-table-column"),v=C("el-empty"),k=C("el-table");return r(),E(xe,{class:"overflow-hidden",id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small"},{title:u(()=>[o("div",Rle,[o("h5",Ole,f(c(d)("New vs. Returning Customers")),1),s(m,{"popper-class":"fct-tooltip",content:c(d)("Returning customers are those who first ordered before this period."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:u(()=>[o("div",Ple,[s(_,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=b=>a.value=b),onChange:A.selectGroupKey},{default:u(()=>[R(f(c(d)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),s(Yn,{data:n.value,filename:"order_report.csv"},null,8,["data"])])]),_:1}),s(Be,{class:"px-0 pb-0"},{default:u(()=>[l.value?(r(),E(g,{key:0,animated:"",rows:3,class:"p-3"})):(r(),E(k,{key:1,data:n.value,border:""},{empty:u(()=>[s(v,{text:c(d)("No data available")},null,8,["text"])]),default:u(()=>[s(y,{prop:"customer_type",label:c(d)("Type"),"min-width":"90"},{default:u(b=>[R(f(b.row.customer_type),1)]),_:1},8,["label"]),s(y,{prop:"customer_count",label:c(d)("Customer Count"),"min-width":"120"},{default:u(b=>[R(f(a.value?i(b.row.customer_count):b.row.customer_count),1)]),_:1},8,["label"]),s(y,{prop:"order_count",label:c(d)("Order Count"),"min-width":"150"},{default:u(b=>[R(f(a.value?i(b.row.order_count):b.row.order_count),1)]),_:1},8,["label"]),s(y,{prop:"gross_sales",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.gross_sales):c(_t).scaled(b.row.gross_sales)},null,8,Hle)]),_:1},8,["label"]),s(y,{prop:"average_gross",label:c(d)("Average Gross Sales"),"min-width":"150"},{default:u(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.average_gross):c(_t).scaled(b.row.average_gross)},null,8,Nle)]),_:1},8,["label"]),s(y,{prop:"net_sales",label:c(d)("Revenue"),"min-width":"150"},{default:u(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.net_sales):c(_t).scaled(b.row.net_sales)},null,8,Kle)]),_:1},8,["label"]),s(y,{prop:"average_net",label:c(d)("Average Revenue"),"min-width":"150"},{default:u(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.average_net):c(_t).scaled(b.row.average_net)},null,8,Gle)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},jle=nt(zle,[["__scopeId","data-v-7818e7a0"]]),qle={class:"w-[240px] fct-btn-group gap-1.5"},Yle={class:"capitalize"},Wle={class:"capitalize"},Jle=["innerHTML"],Xle=["innerHTML"],Zle=["innerHTML"],ese=["innerHTML"],tse={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,l=M("billing_country"),n=a.applicableFilters;G(()=>a.currentCurrencySign);const i=()=>{Rt.getOrderByGroup({params:{...n.params,groupKey:l.value}})},A=[{label:d("Billing Country"),value:"billing_country"},{label:d("Shipping Country"),value:"shipping_country"},{label:d("Payment Method"),value:"payment_method"}];return Te(()=>{i()}),(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(xe,{class:"overflow-hidden",id:"chartContainer"},{default:u(()=>[s(Ve,{title:c(d)("Orders grouped by"),title_size:"small"},{action:u(()=>[o("div",qle,[s(g,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=k=>l.value=k),onChange:i,placeholder:c(d)("Select Group")},{default:u(()=>[(r(),h(P,null,ae(A,k=>s(_,{key:k.value,label:k.label,value:k.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),s(Yn,{data:c(Rt).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[s(v,{data:c(Rt).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!")},null,8,["text"])]),default:u(()=>[l.value==="payment_method"?(r(),E(y,{key:0,prop:"payment_method",label:c(d)("Payment Method"),"min-width":"150"},{default:u(k=>[R(f(k.row.payment_method),1)]),_:1},8,["label"])):x("",!0),l.value==="shipping_country"?(r(),E(y,{key:1,prop:"shipping_country",label:c(d)("Country"),"min-width":"150"},{default:u(k=>[o("span",Yle,f(c(Ps)(k.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),l.value==="billing_country"?(r(),E(y,{key:2,prop:"billing_country",label:c(d)("Billing Country"),"min-width":"150"},{default:u(k=>[o("span",Wle,f(c(Ps)(k.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),s(y,{prop:"orders",label:c(d)("Orders"),"min-width":"150"},{default:u(k=>[R(f(c(d)(k.row.orders)),1)]),_:1},8,["label"]),s(y,{prop:"gross_sale",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(_t).scaled(k.row.gross_sale)},null,8,Jle)]),_:1},8,["label"]),s(y,{prop:"average_order_gross",label:c(d)("Average Gross Sales"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(_t).scaled(k.row.average_order_gross)},null,8,Xle)]),_:1},8,["label"]),s(y,{prop:"net_sale",label:c(d)("Revenue"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(_t).scaled(k.row.net_sale)},null,8,Zle)]),_:1},8,["label"]),s(y,{prop:"average_order_net",label:c(d)("Average Revenue"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(_t).scaled(k.row.average_order_net)},null,8,ese)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},ase={class:"fct-report-spend-by-day-wrap"},lse={class:"flex items-center gap-2"},sse={class:"fct-card-header-title is-small"},nse={class:"fct-btn-group sm"},ose={key:2,class:"chart-action-wrap"},ise={class:"chart-change-wrap"},rse={class:"chart-change"},dse={class:"text"},use={class:"chart-change"},cse={class:"text"},Ase={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=M(null);let l=null;M(Ca.getChartType("order","gross_sale_by_day_chart")||"line");const n=M(!1),i=G(()=>{const S=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort((F,$)=>F.day-$.day).map(F=>S[F.day-1])}),A=G(()=>Object.values(t.chartData).every(S=>S.order_count===0)),p=G(()=>Rt.data.isBusy.orderByDayAndHour),m=Re.colors.report,_=M(Re.isDark()),g=G(()=>[y("Gross Sale","line",0,t.chartData.map(S=>S.gross_sale),_.value?m.blue_dark_mode:m.blue),y("Orders","bar",1,t.chartData.map(S=>S.order_count),_.value?m.dark_cyan_blue_16:m.light_gray)]),y=(S,V,F,$,U)=>({name:S,type:V,barMaxWidth:30,data:$,smooth:!1,color:U,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:U,borderRadius:[4,4,0,0]},yAxisIndex:F,emphasis:{scale:2,itemStyle:{color:el(U)},lineStyle:{color:U},areaStyle:{opacity:.3,color:U}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!l)return;const S={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:_.value?"#253241":"#ffffff",borderColor:_.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:_.value?"#ffffff":"#565865"},axisPointer:Ql(_.value,m.dark_cyan_blue_16,m.light_gray_blue),confine:!0,position:kl,formatter:V=>{let F=V[0].name;return V.forEach($=>{const U=$.seriesName==="Gross Sale"?Ja($.value*100):$.value,D=_.value?"#ffffff":"#565865";F+=`<div> |
| 194 |
${$.marker} |
| 195 |
<span style="color: ${D};">${$.seriesName}</span> |
| 196 |
<span style="float: right; margin-left: 20px; color: ${D};"> |
| 197 |
${U} |
| 198 |
</span> |
| 199 |
</div>`}),F}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:_.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",name:"Gross Sale",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:V=>`${_t.scaled(V)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:"Orders",position:"right",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:g.value};l.setOption(S)},k=()=>{l&&(l.dispose(),l=null),$e(()=>{a.value&&(l=ca(a.value),v())})},b=()=>{n.value=!n.value,n.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>[Rt.data.grossSaleByDay],()=>{$e(()=>{v()})},{deep:!0}),be(A,S=>{S||k()}),be(p,S=>{S||k()});const w=()=>{_.value=Re.isDark(),$e(()=>{v()})},B=()=>{$e(()=>{v()})};return Te(()=>{$e(()=>{k(),t.reportFilter.addListener("spend-by-day",k),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",B)})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",B,!1),t.reportFilter.removeListener("spend-by-day",k,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(S,V)=>{const F=C("el-tooltip"),$=C("el-skeleton");return r(),h("div",ase,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",lse,[o("h5",sse,f(c(d)("Spend by day")),1),s(F,{"popper-class":"fct-tooltip",content:c(d)("Gross sales grouped by the days of the week."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:u(()=>[o("div",nse,[s(tt,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:b,class:ue(n.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[p.value?(r(),E($,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(P,{key:1},[A.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-day-chart",ref_key:"chartRef",ref:a},null,512)),A.value?x("",!0):(r(),h("div",ose,[o("div",ise,[o("div",rse,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",dse,f(S.$t("Gross Sale")),1)]),o("div",use,[o("span",cse,f(S.$t("Days of the week")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},pse={class:"fct-report-item-count-distribution-wrap"},fse={class:"flex items-center gap-2"},mse={class:"fct-card-header-title is-small"},hse={class:"fct-btn-group sm"},_se={key:2,class:"chart-action-wrap"},vse={class:"chart-change-wrap"},gse={class:"chart-change"},yse={class:"text"},bse={class:"chart-change"},wse={class:"text"},Cse={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);M(t.chartData.length<=1?"bar":Ca.getChartType("order","item_count_distribtion_chart")||"bar");const l=M(!1);G(()=>{const S=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort((F,$)=>F.day-$.day).map(F=>S[F.day-1])});const n=Re.colors,i=M(Re.isDark());let A=null;const p=()=>{l.value=!l.value,l.value?A.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):A.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})},m=()=>{A&&A.resize()},_=G(()=>i.value?n.blue[500]+"52":n.blue[300]),g=G(()=>[{name:d("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(S=>S.order_count),smooth:!1,color:_.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:_.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:i.value?n.blue[800]:n.blue[400]},lineStyle:{color:_.value},areaStyle:{opacity:.3,color:_.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=G(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:i.value?"#253241":"#ffffff",borderColor:i.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:i.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:i.value?n.report.dark_cyan_blue_16:n.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:t.chartData.map(S=>S.item_count),axisLabel:{color:i.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:d("Orders"),axisLabel:{formatter:"{value}",color:i.value?"#FFFFFF":"#696778",fontSize:12},min:0,splitLine:{show:!0,lineStyle:{color:i.value?"#253241":"#D6DAE1",type:"dashed"}}},dataZoom:[],series:g.value})),v=G(()=>Object.values(t.chartData).every(S=>S.order_count===0)),k=G(()=>Rt.data.isBusy.orderByDayAndHour),b=()=>{A&&(A.dispose(),A=null),$e(()=>{a.value&&(A=ca(a.value),A.setOption(y.value),window.addEventListener("resize",m))})},w=()=>{A&&A.setOption(y.value)};be(()=>t.chartData,()=>{A?A.setOption(y.value):$e(()=>{b()})}),be(v,S=>{S||b()}),be(k,S=>{S||b()});const B=()=>{i.value=Re.isDark(),$e(()=>{w()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",B,!1),$e(()=>{b()})}),xt(()=>{A&&(A.dispose(),window.removeEventListener("onFluentCartThemeChange",B,!1),window.removeEventListener("resize",m))}),(S,V)=>{const F=C("el-tooltip"),$=C("el-skeleton");return r(),h("div",pse,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",fse,[o("h5",mse,f(c(d)("Item count distribution")),1),s(F,{"popper-class":"fct-tooltip",content:c(d)("Grouping the orders by the number of items in each order."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:u(()=>[o("div",hse,[s(tt,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:p,class:ue(l.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[k.value?(r(),E($,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(P,{key:1},[v.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-item-count-distribution-chart",ref_key:"chartRef",ref:a},null,512)),v.value?x("",!0):(r(),h("div",_se,[o("div",vse,[o("div",gse,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",yse,f(S.$t("Order Count")),1)]),o("div",bse,[o("span",wse,f(S.$t("Item Count")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},kse={class:"fct-report-spend-by-hour-wrap"},Bse={class:"flex items-center gap-2"},xse={class:"fct-card-header-title is-small"},Sse={class:"fct-btn-group sm"},$se={key:2,class:"chart-action-wrap"},Fse={class:"chart-change-wrap"},Ese={class:"chart-change"},Use={class:"text"},Ise={class:"chart-change"},Vse={class:"text"},Dse={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=M(null);let l=null;M(Ca.getChartType("order","gross_sale_by_hour_chart")||"line");const n=M(!1),i=G(()=>t.chartData.map(S=>S.hour)),A=G(()=>Object.values(t.chartData).every(S=>S.order_count===0)),p=G(()=>Rt.data.isBusy.orderByDayAndHour),m=Re.colors.report,_=M(Re.isDark()),g=(S,V,F,$,U)=>({name:S,type:V,barMaxWidth:30,data:F,smooth:!1,color:$,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:$,borderRadius:[4,4,0,0]},yAxisIndex:U,emphasis:{scale:2,itemStyle:{color:el($)},lineStyle:{color:$},areaStyle:{opacity:.3,color:$}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=G(()=>[{name:d("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map(S=>S.gross_sale),color:_.value?m.purple_dark_mode:m.purple},{name:d("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map(S=>S.order_count),color:_.value?m.dark_cyan_blue_16:m.light_gray}].map(S=>g(S.name,S.type,S.data,S.color,S.yAxisIndex))),v=()=>{if(!l)return;const S={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:_.value?"#253241":"#ffffff",borderColor:_.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:_.value?"#ffffff":"#565865"},axisPointer:Ql(_.value,m.dark_cyan_blue_16,m.light_gray_blue),confine:!0,position:kl,formatter:V=>{let F=V[0].name;return V.forEach($=>{const U=$.seriesName==="Gross Sale"?Ja($.value*100):$.value,D=_.value?"#ffffff":"#565865";F+=`<div> |
| 200 |
${$.marker} |
| 201 |
<span style="color: ${D};">${$.seriesName}</span> |
| 202 |
<span style="float: right; margin-left: 20px; color: ${D};"> |
| 203 |
${U} |
| 204 |
</span> |
| 205 |
</div>`}),F}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:_.value?"#253241":"#D6DAE1"}},axisTick:{alignWithLabel:!0}},yAxis:[{type:"value",name:d("Gross Sale"),axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:V=>`${_t.scaled(V)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:d("Orders"),position:"right",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value};l.setOption(S)},k=()=>{l&&(l.dispose(),l=null),$e(()=>{a.value&&(l=ca(a.value),v())})},b=()=>{n.value=!n.value,n.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{$e(()=>v())}),be(A,S=>{S||k()}),be(p,S=>{S||k()});const w=()=>{_.value=Re.isDark(),$e(()=>{v()})},B=()=>{$e(()=>{v()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",B),$e(()=>k())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",B,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(S,V)=>{const F=C("el-tooltip"),$=C("el-skeleton");return r(),h("div",kse,[s(xe,null,{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",Bse,[o("h5",xse,f(c(d)("Spend by hour ")),1),s(F,{"popper-class":"fct-tooltip",content:c(d)("Gross Sales grouped by the hours of the day."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:u(()=>[o("div",Sse,[s(tt,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:b,class:ue(n.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[p.value?(r(),E($,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(P,{key:1},[A.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-hour-chart",ref_key:"chartRef",ref:a},null,512)),A.value?x("",!0):(r(),h("div",$se,[o("div",Fse,[o("div",Ese,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Use,f(S.$t("Gross Sale")),1)]),o("div",Ise,[o("span",Vse,f(S.$t("Hour")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Tse={class:"fct-report-order-completion-time-wrap"},Qse={class:"flex items-center gap-2"},Mse={class:"fct-card-header-title is-small"},Lse={class:"fct-btn-group sm"},Rse={key:2,class:"chart-action-wrap"},Ose={class:"chart-change-wrap"},Pse={class:"chart-change"},Hse={class:"text"},Nse={class:"chart-change"},Kse={class:"text"},Gse={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let l=null;M(Ca.getChartType("order","order_completion_time_chart")||"bar");const n=M(!1),i=G(()=>t.chartData.map(S=>S.hour)),A=Re.colors,p=M(Re.isDark()),m=G(()=>p.value?A.blue[500]+"52":A.blue[300]),_=G(()=>[{name:d("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(S=>S.orders),smooth:!1,color:m.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?A.blue[800]:A.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=G(()=>Object.values(t.chartData).every(S=>S.orders===0)),y=G(()=>Rt.data.isBusy.orderCompletionTime),v=()=>{l&&l.resize()},k=()=>{if(!l)return;const S={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?A.report.dark_cyan_blue_16:A.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:p.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:p.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption(S)},b=()=>{l&&(l.dispose(),l=null),$e(()=>{a.value&&(l=ca(a.value),k())})},w=()=>{n.value=!n.value,n.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{l?k():$e(()=>{b()})}),be(g,S=>{S||b()}),be(y,S=>{S||b()});const B=()=>{p.value=Re.isDark(),$e(()=>{k()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",B,!1),$e(()=>b())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",B,!1),window.removeEventListener("resize",v))}),(S,V)=>{const F=C("el-tooltip"),$=C("el-skeleton");return r(),h("div",Tse,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",Qse,[o("h5",Mse,f(c(d)("Time between an order's created & completed date")),1),s(F,{"popper-class":"fct-tooltip",content:c(d)("Orders grouped by based on their completion time in Hours."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:u(()=>[o("div",Lse,[s(tt,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:w,class:ue(n.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[y.value?(r(),E($,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(P,{key:1},[g.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:a},null,512)),g.value?x("",!0):(r(),h("div",Rse,[o("div",Ose,[o("div",Pse,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Hse,f(c(d)("Order Count")),1)]),o("div",Nse,[o("span",Kse,f(c(d)("Hours")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},zse={class:"fct-report-order-value-distribution-wrap"},jse={class:"flex items-center gap-2"},qse={class:"fct-card-header-title is-small"},Yse={class:"fct-btn-group sm"},Wse={key:2,class:"chart-action-wrap"},Jse={class:"chart-change-wrap"},Xse={class:"chart-change"},Zse={class:"text"},ene={class:"chart-change"},tne={class:"text"},ane={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let l=null;M(Ca.getChartType("order","order_value_distribution_chart")||"bar");const n=M(!1),i=G(()=>Object.keys(t.chartData)),A=Re.colors,p=M(Re.isDark()),m=G(()=>p.value?A.blue[500]+"52":A.blue[300]),_=G(()=>!Object.values(t.chartData).every(S=>S&&S!==0)),g=G(()=>Rt.data.isBusy.orderValueDistribution),y=G(()=>[{name:d("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),smooth:!1,color:m.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?A.blue[800]:A.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=G(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?A.report.dark_cyan_blue_16:A.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:d("Orders"),axisLabel:{formatter:"{value}",color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value})),k=()=>{l&&(l.dispose(),l=null),$e(()=>{a.value?(l=ca(a.value),l.setOption(v.value),window.addEventListener("resize",()=>{l.resize()})):l&&l.setOption(v.value)})},b=()=>{l&&l.setOption(v.value)},w=()=>{n.value=!n.value,n.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{l&&l.setOption(v.value)}),be(_,S=>{S||k()}),be(g,S=>{S||k()});const B=()=>{p.value=Re.isDark(),$e(()=>{b()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",B,!1),$e(()=>{k()})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",B,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(S,V)=>{const F=C("el-tooltip"),$=C("el-skeleton");return r(),h("div",zse,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",jse,[o("h5",qse,f(c(d)("Order value distribution")),1),s(F,{"popper-class":"fct-tooltip",content:c(d)("Orders grouped by based on their order value in different ranges."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[_.value?void 0:{name:"action",fn:u(()=>[o("div",Yse,[s(tt,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:w,class:ue(n.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[g.value?(r(),E($,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(P,{key:1},[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-value-distribution-chart",ref_key:"chartRef",ref:a},null,512)),_.value?x("",!0):(r(),h("div",Wse,[o("div",Jse,[o("div",Xse,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Zse,f(S.$t("Order Count")),1)]),o("div",ene,[o("span",tne,f(S.$t("Order Value Ranges")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},lne={class:"fct-report-average-order-gross-wrap"},sne={class:"flex items-center gap-2"},nne={class:"fct-card-header-title is-small"},one={class:"fct-btn-group sm"},ine={key:2,class:"chart-action-wrap"},rne={class:"chart-change-wrap"},dne={class:"chart-change"},une={class:"text"},cne={class:"chart-change"},Ane={class:"text"},pne={__name:"AverageOrderGross",props:{chartData:{type:Array,required:!0},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=M(null);let l=null;M("line");const n=M(!1),i=Re.colors.report,A=M(Re.isDark()),p=G(()=>A.value?i.blue_dark_mode:i.blue),m=G(()=>Rt.data.isBusy.orderChartData),_=G(()=>[{name:d("Average Order Gross"),type:"line",barMaxWidth:30,data:t.chartData.map(S=>S.average_order_gross),smooth:!1,color:p.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:p.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:el(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=G(()=>fl(t.chartData.length)),y=()=>{l&&l.resize()},v=()=>{if(!l)return;const S=Hl(t.chartData),V={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:Ql(A.value,i.dark_cyan_blue_16,i.light_gray_cyan_blue),confine:!0,position:kl,valueFormatter:F=>Ja(F*100)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:S,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:g.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption(V)},k=()=>{l&&(l.dispose(),l=null),$e(()=>{a.value&&(l=ca(a.value),v())})},b=()=>{n.value=!n.value,n.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{$e(()=>v())}),be(t.isEmpty,S=>{S||k()}),be(m,S=>{S||k()});const w=()=>{A.value=Re.isDark(),$e(()=>{v()})},B=()=>{v()};return Te(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",B),$e(()=>k())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",B,!1)}),(S,V)=>{const F=C("el-tooltip"),$=C("el-skeleton");return r(),h("div",lne,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{border_bottom:"",title_size:"small"},sa({title:u(()=>[o("div",sne,[o("h5",nne,f(c(d)("Average Order Gross ")),1),s(F,{"popper-class":"fct-tooltip",content:c(d)("Average Order Gross grouped by date period."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",one,[s(tt,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:b,class:ue(n.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[m.value?(r(),E($,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-gross-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(r(),h("div",ine,[o("div",rne,[o("div",dne,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",une,f(S.$t("Average Order Gross")),1)]),o("div",cne,[o("span",Ane,f(S.$t("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},fne={class:"fct-report-average-order-items-wrap"},mne={class:"flex items-center gap-2"},hne={class:"fct-card-header-title is-small"},_ne={class:"fct-btn-group sm"},vne={key:2,class:"chart-action-wrap"},gne={class:"chart-change-wrap"},yne={class:"chart-change"},bne={class:"text"},wne={class:"chart-change"},Cne={class:"text"},kne={__name:"AverageOrderItems",props:{chartData:{type:Array,required:!0},chartRef:{},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=M(null);let l=null;M(Ca.getChartType("order","avg_order_items_chart")||"line");const n=M(!1),i=Re.colors.report,A=M(Re.isDark()),p=G(()=>A.value?i.purple_dark_mode:i.purple),m=G(()=>[{name:d("Average Order Items"),type:"line",barMaxWidth:30,data:Array.isArray(t.chartData)?t.chartData.map(S=>S.average_order_items_count):[],smooth:!1,color:p.value,showSymbol:!0,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:p.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:el(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),_=G(()=>fl(t.chartData.length)),g=G(()=>{const S=Hl(t.chartData);return{title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?i.dark_cyan_blue_16:i.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:S,axisLabel:{color:A.value?"#FFFFFF":"#696778",fontSize:12,interval:_.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{name:"Order Items",type:"value",axisLabel:{formatter:"{value}",color:A.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:m.value}}),y=G(()=>Rt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},k=()=>{l&&(l.dispose(),l=null),$e(()=>{a.value?(l=ca(a.value),l.setOption(g.value),window.addEventListener("resize",v)):l&&l.setOption(g.value)})},b=()=>{l&&l.setOption(g.value)},w=()=>{n.value=!n.value,n.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{l&&l.setOption(g.value)}),be(t.isEmpty,S=>{S||k()}),be(y,S=>{S||k()});const B=()=>{A.value=Re.isDark(),$e(()=>{b()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",B),$e(()=>{k(),window.addEventListener("resize",v)})}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",B,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),(S,V)=>{const F=C("el-tooltip"),$=C("el-skeleton");return r(),h("div",fne,[s(xe,null,{default:u(()=>[s(Ve,{border_bottom:"",title_size:"small"},sa({title:u(()=>[o("div",mne,[o("h5",hne,f(c(d)("Average Order Items ")),1),s(F,{"popper-class":"fct-tooltip",content:c(d)("Average Order Items grouped by date period."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",_ne,[s(tt,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:w,class:ue(n.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[y.value?(r(),E($,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(r(),h("div",vne,[o("div",gne,[o("div",yne,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",bne,f(S.$t("Average Order Items")),1)]),o("div",wne,[o("span",Cne,f(S.$t("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Bne={class:"fct-order-report-page"},xne={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=i=>{i&&(Rt.getOrderChartData({params:{...i.params,groupKey:"default"}}),Rt.getNewVsReturningCustomer(i),Rt.getReportByDayAndHour(i),Rt.getItemCountDistribution(i),Rt.getOrderCompletionTime(i),Rt.getOrderValueDistribution(i))},n=i=>{const A=a.applicableFilters;A&&Rt.getOrderChartData({params:{...A.params,groupKey:i}})};return Te(()=>{a.addListener("order-report",l),l(a.applicableFilters),a.value}),xt(()=>{a.removeListener("order-report",l,!1),a.value}),(i,A)=>{const p=C("el-col"),m=C("el-row");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",Bne,[s(fle,{orderReport:c(Rt),reportFilter:c(a)},null,8,["orderReport","reportFilter"]),s(Sle,{chartData:c(Rt).data.orderChartData,reportFilter:c(a),onFetchChartData:n,"is-empty":!c(Rt).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),s(Vle,{orderReport:c(Rt)},null,8,["orderReport"]),c(Rt).data.summary.tax_total||c(Rt).data.summary.shipping_total?(r(),E(Lle,{key:0,orderReport:c(Rt),reportFilter:c(a)},null,8,["orderReport","reportFilter"])):x("",!0),s(jle,{tableData:c(Rt).data.newVsReturning,reportFilter:c(a)},null,8,["tableData","reportFilter"]),s(tse,{tableData:c(Rt).data.orderByGroup,reportFilter:c(a)},null,8,["tableData","reportFilter"]),s(mle,{chartData:c(Rt).data.orderByDayAndHour},null,8,["chartData"]),s(m,{gutter:30},{default:u(()=>[s(p,{lg:12},{default:u(()=>[s(Ase,{reportFilter:c(a),ref:"chartRef",chartData:c(Rt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),s(p,{lg:12},{default:u(()=>[s(Dse,{chartData:c(Rt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),s(p,{lg:12},{default:u(()=>[s(Cse,{ref:"chartRef",chartData:c(Rt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),s(p,{lg:12},{default:u(()=>[s(ane,{chartData:c(Rt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),s(p,{lg:12},{default:u(()=>[s(pne,{chartData:c(Rt).data.orderChartData,"is-empty":!c(Rt).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),s(p,{lg:12},{default:u(()=>[s(kne,{chartData:c(Rt).data.orderChartData,"is-empty":!c(Rt).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),s(p,{lg:12},{default:u(()=>[s(Gse,{chartData:c(Rt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},Sne={class:"fct-gross-sale-vs-net-revenue-wrap"},$ne={class:"flex items-center gap-2"},Fne={class:"fct-card-header-title is-small"},Ene={class:"fct-chart-select"},Une={class:"fct-btn-group sm"},Ine={class:"chart-action-wrap"},Vne={class:"chart-change-wrap"},Dne={class:"chart-change"},Tne={class:"text"},Qne={class:"chart-change"},Mne={class:"text"},Lne={__name:"RefundLineChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!1},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=Re.colors.report,n=M(Re.isDark()),i=M(null),A=M("default"),p=M(Ca.getChartType("refund","refund_chart")||"line"),m=M(!1);G(()=>a.reportFilter.currentCurrencySign);const{groupKeys:_}=_n(a.reportFilter,A),g=t,y=()=>{g("fetch-chart-data",A.value)},v=G(()=>a.reportFilter.data.compareType!=="no_comparison"),k=(T,I,L,O,Q,H=!0)=>({name:T,type:I,barMaxWidth:30,data:L,smooth:!1,color:O,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},yAxisIndex:Q,emphasis:{scale:2,itemStyle:{color:el(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:H,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),b=G(()=>{let T=[{name:d("Refunded Amount"),key:"refunded_amount",type:"line",color:n.value?l.blue_dark_mode:l.blue,yAxisIndex:0,data:a.chartData.map(I=>I.refunded_amount),animation:!1},{name:d("Total Refunds"),key:"refund_count",type:"bar",color:n.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,yAxisIndex:1,data:a.chartData.map(I=>I.refund_count),animation:!1}];return v.value&&T.unshift({name:d("Previous Refunded Amount"),key:"refunded_amount_compare",type:"line",color:n.value?l.purple_dark_mode:l.purple,yAxisIndex:0,data:a.compareData.map(I=>I.refunded_amount),animation:!1},{name:d("Previous Total Refunds"),key:"refund_count_compare",type:"bar",color:n.value?l.dark_cyan_blue_16:l.light_gray,yAxisIndex:1,data:a.compareData.map(I=>I.refund_count),animation:!0}),T.map(I=>k(I.name,I.type,I.data,I.color,I.yAxisIndex,I.animation))});let w=null;const B=M(!0),S=()=>{w&&(w.dispose(),w=null),$e(()=>{i.value&&(w=ca(i.value),$(),w.on("legendselectchanged",T=>{B.value=T.selected["Total Refunds"]||T.selected["Previous Total Refunds"]}))})},V=G(()=>{const T=Ks(a.reportFilter.data.dateRange);return d("This report looks at refunds made for successful orders created ")+T}),F=G(()=>fl(a.chartData.length)),$=()=>{if(!w)return;const T=Hl(a.chartData),I={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:n.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:n.value?"#253241":"#ffffff",borderColor:n.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:n.value?"#ffffff":"#565865"},axisPointer:Ql(n.value,l.dark_cyan_blue_16,l.light_gray_blue),confine:!0,position:kl,formatter:L=>{let O=L[0].name;return L.forEach(Q=>{const H=[0,2].includes(Q.seriesIndex)?Ja(Q.value*100):Q.value,K=n.value?"#ffffff":"#565865";O+=`<div> |
| 206 |
${Q.marker} |
| 207 |
<span style="color: ${K};">${Q.seriesName}</span> |
| 208 |
<span style="float: right; margin-left: 20px; color: ${K};"> |
| 209 |
${H} |
| 210 |
</span> |
| 211 |
</div>`}),O}},xAxis:{type:"category",data:T,axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,interval:F.value.interval},axisLine:{lineStyle:{type:"dashed",color:n.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,formatter:L=>`${_t.scaled(L)}`},splitLine:{show:!0,lineStyle:{color:n.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",axisLabel:{color:n.value?"#253241":"#D6DAE1",fontSize:12},splitLine:{show:!1}}],series:b.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};w.setOption(I,{notMerge:!0,replaceMerge:["series"]})},U=()=>{m.value=!m.value,m.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):$()};be([()=>a.chartData,p],()=>{$e($)},{deep:!0}),be(()=>jl.data.refund,()=>{$e(()=>{$()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||S()}),be(()=>a.loading,T=>{T||S()}),be(B,()=>{if(!w)return;const I=w.getOption().series.map(L=>L.type==="line"?{...L,areaStyle:B.value?void 0:{opacity:.3}}:L);$e(()=>{w.setOption({series:I})})});const D=()=>{n.value=Re.isDark(),$e(()=>{$()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("fluentCartCurrencyChange",D,!1)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("fluentCartCurrencyChange",D),$e(S)}),(T,I)=>{const L=C("el-tooltip"),O=C("el-option"),Q=C("el-select"),H=C("el-skeleton");return r(),h("div",Sne,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",$ne,[o("h5",Fne,f(c(d)("Refunds Chart")),1),s(L,{"popper-class":"fct-tooltip",content:V.value,placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",Ene,[s(Q,{class:"el-select--x-small",modelValue:A.value,"onUpdate:modelValue":I[0]||(I[0]=K=>A.value=K),onChange:y},{default:u(()=>[(r(!0),h(P,null,ae(c(_),K=>(r(),E(O,{key:K.value,label:T.$t(K.label),value:K.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",Une,[s(tt,{tag:"button",size:"small",title:T.$t("Zoom Chart"),onClick:U,class:ue(m.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:i},null,512)),o("div",Ine,[o("div",Vne,[o("div",Dne,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Tne,f(T.$t("Data")),1)]),o("div",Qne,[o("span",Mne,f(T.$t("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Rne extends il{constructor(){super(...arguments);ze(this,"data",{refundData:[],previousMetrics:[],summary:{},previousSummary:{},fluctuations:{},chartData:[],weeksBetweenRefund:[],isBusy:{chartData:!0,weeksBetweenRefund:!0,refundData:!0}})}get controllerKey(){return"RefundReportController"}makeRequest(a,l,n,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const A=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,n,i),A}resolvePromiseResponse(a,l=null,n=null){a.then(i=>{n==null||l==null?Object.assign(this.data,i):this.data[n]=i[l]}).catch(i=>{}).finally(()=>{n&&(this.data.isBusy[n]=!1)})}getRefundChartData(a={}){return this.makeRequest("refund-chart",a,null,"chartData")}getWeeksBetweenRefund(a={}){return this.makeRequest("weeks-between-refund",a,"data","weeksBetweenRefund")}getRefundSummary(a={}){return this.makeRequest("refund-summary",a,"summaryData","summaryData")}getRefundDataByGroup(a={}){return this.makeRequest("refund-data-by-group",a,"data","refundData")}getRefundReportFluctuations(a={}){return this.makeRequest("refund-report-fluctuations",a,"data","fluctuations")}}const xa=Rne.init(),One={key:1,class:"fct-report-order-summary summary-col-4"},Pne={class:"summary-item-inner"},Hne={class:"value"},Nne={class:"inner-value"},Kne=["innerHTML"],Gne={class:"title"},zne={__name:"Summary",setup(e){const t=G(()=>[{title:d("Refunds"),value:xa.data.summary.refund_count,key:"refund_count",percentage:xa.data.fluctuations.refund_count,info:d("Total refunds count including partially refunds."),no_currency:!0},{title:d("Refunded"),value:xa.data.summary.refunded_amount,key:"refunded_amount",percentage:xa.data.fluctuations.refunded_amount,info:d("Total Refunded Amount")},{title:d("Avgerage Amount"),value:xa.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:xa.data.fluctuations.average_refunded_amount,info:d("Total Refunded Amount / Total Refund count")},{title:d("Refund Rate"),value:xa.data.summary.refund_rate,key:"refund_rate",percentage:xa.data.fluctuations.refund_rate,info:d("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=G(()=>xa.data.isBusy.chartData),l=n=>{const i=n.no_currency?ha(n.value):_t.scaled(n.value);return n.is_percentage?`${i}%`:i};return(n,i)=>{const A=C("el-tooltip");return a.value?(r(),E(ql,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",One,[(r(!0),h(P,null,ae(t.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Pne,[o("div",Hne,[o("div",Nne,[o("span",{innerHTML:l(p)},null,8,Kne)]),s(yl,{fluctuation:p.percentage,amount:c(xa).data.previousSummary[p.key],"is-liability":!0,"has-currency":!p.no_currency,"is-percentage":p.is_percentage},null,8,["fluctuation","amount","has-currency","is-percentage"])]),o("div",Gne,[R(f(p.title)+" ",1),s(A,{content:p.info,placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},jne={class:"fct-report-refund-weeks-between-an-order-wrap"},qne={class:"fct-btn-group sm"},Yne={class:"chart-action-wrap"},Wne={class:"chart-change-wrap"},Jne={class:"chart-change"},Xne={class:"text"},Zne={class:"chart-change"},eoe={class:"text"},toe={__name:"WeeksBetweenRefundChart",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=M(null),l=M("bar");let n=null;const i=Re.colors.report,A=M(Re.isDark()),p=G(()=>A.value?i.dark_cyan_blue_16:i.light_gray),m=G(()=>[{name:d("Refund Count"),type:l.value,data:t.chartData.map(b=>b.occurrence),smooth:!0,color:p.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:el(p.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),_=G(()=>fl(t.chartData.length)),g=()=>({title:{text:t.chartTitle,left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:t.chartData.map(b=>b.weekBetween),axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:_.value.interval,formatter:b=>b>1?`${b} weeks`:`${b} week`},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1"}}},series:m.value}),y=()=>{n&&(n.dispose(),n=null),$e(()=>{a.value&&(n=ca(a.value),n.setOption(g()),window.addEventListener("resize",()=>{n.resize()}))})};be(()=>t.chartData,()=>{n&&n.setOption(g())}),be(()=>t.isEmpty,b=>{b||y()}),be(()=>t.loading,b=>{b||y()});const v=()=>{A.value=Re.isDark(),$e(()=>{k()})};xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const k=b=>{n&&n.setOption(g(),!0)};return Te(()=>{window.addEventListener("onFluentCartThemeChange",v),$e(()=>{y()})}),(b,w)=>{const B=C("el-skeleton");return r(),h("div",jne,[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},sa({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",qne,[s(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),s(Be,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(B,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-weeks-between-an-order-chart",ref_key:"chartRef",ref:a},null,512)),o("div",Yne,[o("div",Wne,[o("div",Jne,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Xne,f(c(d)("Refund Count")),1)]),o("div",Zne,[o("span",eoe,f(c(d)("Weeks")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},aoe={class:"fct-btn-group sm w-[240px] gap-2"},loe={key:0},soe={key:1},noe={class:"inline-flex"},ooe={class:"inline-flex"},ioe={__name:"RefundTable",props:{tableData:{type:Array,required:!0},currencySign:{type:String},loading:{type:Boolean,default:!0}},emits:["group-data"],setup(e,{emit:t}){const a=t;M([]);const l=M([{label:d("Billing Country"),value:"billing_country"},{label:d("Shipping Country"),value:"shipping_country"},{label:d("Payment Method"),value:"payment_method"}]),n=M("billing_country"),i=G(()=>{var p;return((p=l.value.find(m=>m.value===n.value))==null?void 0:p.label)||""}),A=()=>{a("group-data",n.value)};return(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-skeleton"),v=C("el-table-column"),k=C("el-table");return r(),E(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Refunds Grouped By"),title_size:"small"},sa({_:2},[e.loading?void 0:{name:"action",fn:u(()=>[o("div",aoe,[s(g,{modelValue:n.value,"onUpdate:modelValue":m[0]||(m[0]=b=>n.value=b),onChange:A,class:"el-select--x-small",placeholder:c(d)("Select Group")},{default:u(()=>[(r(!0),h(P,null,ae(l.value,b=>(r(),E(_,{key:b.value,label:c(d)(b.label),value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),s(Yn,{data:e.tableData,filename:"refund.csv",class:"!ml-0"},null,8,["data"])])]),key:"0"}]),1032,["title"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[e.loading?(r(),E(y,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(k,{key:1,data:e.tableData,height:"330"},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!")},null,8,["text"])]),default:u(()=>[s(v,{prop:n.value,label:c(d)(i.value),"min-width":"150"},{default:u(b=>[n.value!=="payment_method"?(r(),h("span",loe,f(c(Ps)(b.row[n.value])),1)):(r(),h("span",soe,f(b.row[n.value]),1))]),_:1},8,["prop","label"]),s(v,{prop:"refunds",label:c(d)("Refunds"),"min-width":"150"},{default:u(b=>m[1]||(m[1]=[])),_:1},8,["label"]),s(v,{prop:"refunded_amount",label:c(d)("Refunded Amount"),"min-width":"150"},{default:u(b=>[o("div",noe,f(c(_t).scaled(b.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),s(v,{prop:"average_refund",label:c(d)("Average Refund"),"min-width":"150"},{default:u(b=>[o("div",ooe,f(c(_t).scaled(b.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},roe={class:"fct-refund-report-page"},doe={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=p=>{xa.getRefundChartData({params:{...p.params,groupKey:"default"}}),xa.getWeeksBetweenRefund(p),n(p)},n=p=>{xa.getRefundDataByGroup({params:{...p.params,groupKey:"billing_country"}})},i=p=>{const m=a.applicableFilters;xa.getRefundDataByGroup({params:{...m.params,groupKey:p}})},A=p=>{const m=a.applicableFilters;m&&xa.getRefundChartData({params:{...m.params,groupKey:p}})};return Te(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),xt(()=>{a.removeListener("refund-report")}),(p,m)=>(r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",roe,[s(zne),s(Lne,{ref:"refundChart",chartData:c(xa).data.chartData,compareData:c(xa).data.previousMetrics,reportFilter:c(a),onFetchChartData:A,"is-empty":!c(xa).data.summary.refund_count,loading:c(xa).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),s(toe,{chartData:c(xa).data.weeksBetweenRefund,"is-empty":!c(xa).data.weeksBetweenRefund.length,loading:c(xa).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),s(ioe,{tableData:c(xa).data.refundData,currencySign:c(a).currentCurrencySign,onGroupData:i,loading:c(xa).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},uoe={class:"fct-gross-sale-vs-net-revenue-wrap"},coe={class:"fct-chart-select"},Aoe={class:"fct-btn-group sm"},poe={class:"chart-action-wrap"},foe={class:"chart-change-wrap"},moe={class:"chart-change"},hoe={class:"text"},_oe={class:"chart-change"},voe={class:"text"},goe={__name:"RetentionChart",props:{chartData:{type:Object,required:!0},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["fetch-custom-chart-data"],setup(e,{emit:t}){const a=e,l=M(null),n=M(Ca.getChartType("subscription","retention_chart")||"line"),i=M(!1),A=M(null);M([]);const p=Re.colors.report,m=M(Re.isDark()),_=($,U,D,T)=>({name:$,type:U,barMaxWidth:30,data:D,smooth:!1,color:T,lineStyle:{width:3},areaStyle:{opacity:.3,color:T},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:T,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(T)},lineStyle:{color:T},areaStyle:{opacity:.3,color:T}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=G(()=>Object.keys(a.chartData).map(U=>U.startsWith("day_")?d("%s Days",U.replace("day_","")):U==="more_than_year"?d("More than Year"):U)),y=G(()=>Object.keys(a.chartData).map(U=>a.chartData[U]||0)),v=G(()=>[_(d("Customers"),n.value,y.value,m.value?p.dark_cyan_blue_16:p.light_gray)]);let k=null;const b=()=>{k&&(k.dispose(),k=null),$e(()=>{l.value&&(k=ca(l.value),w())})},w=()=>{if(!k)return;const $={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:m.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:m.value?p.dark_cyan_blue_16:p.light_gray_blue}}},xAxis:{type:"category",data:g.value,axisLabel:{color:m.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:m.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};k.setOption($,{notMerge:!0,replaceMerge:["series"]})},B=$=>{Ca.onChange("subscription","retention_chart",$),n.value!==$&&(i.value=!1,n.value=$,w())},S=t,V=()=>{S("fetch-custom-chart-data",A.value)};be(()=>a.chartData,()=>{$e(w)},{deep:!0}),be(()=>jl.data.refund,()=>{$e(w)},{deep:!0}),be(()=>a.isEmpty,$=>{$||b()}),be(()=>a.loading,$=>{$||b()});const F=()=>{m.value=Re.isDark(),$e(()=>{w()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",F,!1)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",F),$e(b)}),($,U)=>{const D=C("el-input"),T=C("el-skeleton");return r(),h("div",uoe,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title:c(d)("Retention Chart"),title_size:"small",border_bottom:""},sa({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",coe,[s(D,{type:"text",modelValue:A.value,"onUpdate:modelValue":U[0]||(U[0]=I=>A.value=I),placeholder:c(d)("Enter custom days"),class:"el-input--x-small",onKeyup:ea(V,["enter"])},null,8,["modelValue","placeholder"])]),o("div",Aoe,[s(Yl,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:B},null,8,["activeType"]),s(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),s(Be,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(T,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[o("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512),o("div",poe,[o("div",foe,[o("div",moe,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",hoe,f(c(d)("Data")),1)]),o("div",_oe,[o("span",voe,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},yoe={class:"fct-revenue-line-chart-wrap"},boe={class:"flex items-center gap-2"},woe={class:"fct-card-header-title is-small"},Coe={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},koe={class:"chart-action-wrap"},Boe={class:"chart-change-wrap"},xoe={class:"chart-change"},Soe={class:"text"},$oe={class:"chart-change"},Foe={class:"text"},Eoe={__name:"SubscriptionChartNew",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=M(null),n=M(Ca.getChartType("subscription","subscription_chart")||"line"),i=M(!1),A=Re.colors.report,p=M(Re.isDark()),m=(T,I,L,O,Q)=>({name:T,type:I,barMaxWidth:30,yAxisIndex:L,data:O,smooth:!1,color:Q,lineStyle:{width:3},areaStyle:{opacity:.3,color:Q},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(Q)},lineStyle:{color:Q},areaStyle:{opacity:.3,color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M(a.appliedGroupKey);be(()=>a.appliedGroupKey,T=>{_.value=T});const{groupKeys:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=G(()=>a.reportFilter.data.compareType!=="no_comparison"),b=G(()=>{let T=[{name:d("Current Range"),key:"count",type:n.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(I=>I.count)}];return k.value&&T.unshift({name:d("Compare Range"),key:"count",type:n.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(I=>({value:I.count,date:I.group}))}),T.map(I=>m(I.name,I.type,0,I.data,I.color))});let w=null;const B=()=>{w&&(w.dispose(),w=null),$e(()=>{l.value&&(w=ca(l.value),F())})},S=G(()=>{const T=Ks(a.reportFilter.data.dateRange);return d("This report looks at the subscription you received ")+T}),V=G(()=>fl(a.chartData.length)),F=()=>{if(!w)return;const T=Hl(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,formatter:L=>{let O="";return L.forEach(function(Q,H){const K=typeof Q.data=="object"&&Q.data!==null,W=K?Gs(Q.data.date):Q.name,z=K?Q.data.value:Q.value,Y=L.length>1&&H===0;Y&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${W}</div>`,O+=`<div> |
| 212 |
<span style="color:${Q.color}">●</span> |
| 213 |
<span>${d("Subscription")}</span> |
| 214 |
<span style="float: right; margin-left: 20px;"> |
| 215 |
${ha(z)} |
| 216 |
</span> |
| 217 |
</div>`,Y&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:V.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(I,{notMerge:!0,replaceMerge:["series"]})},$=()=>{i.value=!i.value,i.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()},U=T=>{Ca.onChange("subscription","subscription_chart",T),n.value!==T&&(i.value=!1,n.value=T,F())};be([()=>a.chartData,_],()=>{$e(F)},{deep:!0}),be(()=>jl.data.revenue,()=>{$e(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||B()}),be(()=>a.loading,T=>{T||B()});const D=()=>{p.value=Re.isDark(),$e(()=>{F()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",D),$e(()=>{B()})}),(T,I)=>{const L=C("el-tooltip"),O=C("el-option"),Q=C("el-select"),H=C("el-skeleton");return r(),h("div",yoe,[s(xe,null,{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",boe,[o("h4",woe,f(c(d)("Subscription Chart")),1),s(L,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",Coe,[s(Q,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=K=>_.value=K),onChange:v},{default:u(()=>[(r(!0),h(P,null,ae(c(g),K=>(r(),E(O,{key:K.value,label:c(d)(K.label),value:K.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),s(Yl,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),s(tt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:$,class:ue(i.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),o("div",koe,[o("div",Boe,[o("div",xoe,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Soe,f(c(d)("Data")),1)]),o("div",$oe,[o("span",Foe,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Uoe extends il{constructor(){super(...arguments);ze(this,"data",{overviews:[],fluctuations:[],chartData:[],productList:[],customerList:[],revenueChurnRateNet:{title:d("Revenue Churn Rate"),isCurrency:!1,value:0},netNewMrr:{title:d("Net New MRR"),isCurrency:!0,value:0},isBusy:{overviews:!1,fluctuations:!1,chartData:!0,productList:!1,customerList:!1,revenueChurnRateNet:!0,netNewMrr:!0},currentMetrics:[],previousMetrics:[]})}get controllerKey(){return"SubscriptionReportController"}get revenueChurnRateNet(){return this.data.revenueChurnRateNet}get netNewMrr(){return this.data.netNewMrr}makeRequest(a,l,n,i){typeof l!="object"&&(l={}),this.data.isBusy[i]=!0;const A=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,n,i),A}resolvePromiseResponse(a,l=null,n=null){a.then(i=>{n==null||l==null||(this.data[n]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[n]=!1})}getSubscriptionReportFluctuations(a={}){return this.makeRequest("getSubscriptionReportFluctuations",a,"fluctuations","fluctuations")}getSubscriptionReportFluctuations(a={}){return this.makeRequest("get-subscription-fluctuations",a,"fluctuations","fluctuations")}getRetentionChart(a={}){return this.makeRequest("retention-chart",a,"chartData","chartData")}listSubscriptionsByProduct(a={}){return this.makeRequest("list-subscription-by-product",a,"productList","productList")}listSubscriptionsByCustomer(a={}){return this.makeRequest("list-subscription-by-customer",a,"customerList","customerList")}getSubscriptionOverview(a={}){return this.makeRequest("get-subscription-overview",a,"overviews","overviews").then(l=>{this.getRevenueChurnRateNet(a),this.getNetNewMrr(a)}).finally(()=>{})}getRevenueChurnRateNet(a={}){this.data.isBusy.revenueChurnRateNet=!0,ce.get("reports/get-subscription-overview/revenue-churn-rate-net",a).then(l=>{this.data.revenueChurnRateNet=l.data}).finally(()=>{this.data.isBusy.revenueChurnRateNet=!1})}getNetNewMrr(a={}){this.data.isBusy.netNewMrr=!0,ce.get("reports/get-subscription-overview/net-new-mrr",a).then(l=>{this.data.netNewMrr=l.data}).finally(()=>{this.data.isBusy.netNewMrr=!1})}}const en=Uoe.init(),Ioe={key:1,class:"fct-report-order-summary summary-col-4"},Voe={class:"summary-item-inner"},Doe={class:"value"},Toe={class:"inner-value"},Qoe={class:"title"},Moe={__name:"Summary",props:{summaryData:{type:Object,required:!0},fluctuations:{type:Object,required:!0},reportFilter:{type:Object},subscriptionReport:{type:Object},loading:{type:Boolean,default:!0}},setup(e){const t=e;G(()=>{var n;return((n=t.reportFilter)==null?void 0:n.currentCurrencySign)||""});const a=[{title:d("Future Installments"),key:"future_installments",info:d("The total amount expected from future installments."),hasCurrency:!0}],l=G(()=>!t.summaryData||!t.fluctuations?[]:a.map(n=>({...n,title:n.title,value:t.summaryData[n.key]||0,fluctuation:t.fluctuations[n.key]||0,hasCurrency:n.hasCurrency})));return(n,i)=>{const A=C("el-tooltip");return e.loading?(r(),E(ql,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",Ioe,[(r(!0),h(P,null,ae(l.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Voe,[o("div",Doe,[o("div",Toe,[s(zs,{amount:c(_t).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",Qoe,[R(f(p.title)+" ",1),s(A,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Loe={class:"chart-action-wrap"},Roe={class:"chart-change-wrap"},Ooe={class:"chart-change"},Poe={class:"text"},Hoe={class:"chart-change"},Noe={class:"text"},Koe={__name:"LineChart",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""},formatValuePercentage:{type:Boolean,default:!1},amountFormat:{type:Boolean,default:!1},chartType:{type:String},zoomIsActive:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},setup(e,{expose:t}){const a=e,l=M(null),n=M(a.chartData);t({chartRef:l}),be(()=>a.chartData,S=>{n.value=S},{deep:!0});const i=Re.colors.report,A=M(Re.isDark()),p=G(()=>({textColor:A.value?"#ffffff":"#000000",borderColor:A.value?"#4a5a6b":"#c0c4ca",splitLineColor:A.value?"#253241":"#D6DAE1",bgColor:A.value?"#2d3748":"#ffffff"})),m=G(()=>A.value?i.dark_cyan_blue_16:i.light_gray),_=G(()=>n.value.map(S=>Gs(S.label))),g=G(()=>[{name:a.chartTitle,type:a.chartType,data:n.value.map(S=>S.value),smooth:!1,color:m.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:m.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(m.value)},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let y=null;const v=()=>{y&&(y.dispose(),y=null),$e(()=>{l.value&&(y=ca(l.value),b())})},k=G(()=>fl(a.chartData.length)),b=()=>{if(!y)return;const S={legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:_.value,axisLabel:{color:p.value.textColor,fontSize:12,interval:k.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:p.value.textColor,fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:g.value};y.setOption(S,{notMerge:!0,replaceMerge:["series"]})},w=S=>{S?y.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):b()};be([()=>n.value,()=>a.chartType,()=>Re.isDark(),()=>a.loading],()=>{v()},{deep:!0}),be(()=>a.zoomIsActive,S=>{w(S)});const B=()=>{A.value=Re.isDark(),$e(()=>{b()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",B),window.addEventListener("fluentCartCurrencyChange",b),$e(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",B,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1)}),(S,V)=>{const F=C("el-skeleton");return e.loading?(r(),E(F,{key:0,animated:"",rows:8})):(r(),h(P,{key:1},[n.value.length?(r(),h(P,{key:0},[n.value.length?(r(),h("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:l},null,512)):x("",!0),o("div",Loe,[o("div",Roe,[o("div",Ooe,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Poe,f(S.$t("Data")),1)]),o("div",Hoe,[o("span",Noe,f(S.$t("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],64))}}},Goe={class:"fct-daily-signup-chart-wrap"},zoe={class:"fct-btn-group sm gap-2 lg:gap-0"},joe={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=M(Ca.getChartType("subscription","daily_signups_chart")||"line"),l=M([]),n=M(""),i=M(!1),A=M(!0),p=_=>{A.value=!0,ce.get("reports/daily-signups",{params:{..._}}).then(g=>{l.value=g.signups,l.value.forEach(y=>{y.label=y.trend_date})}).finally(()=>A.value=!1)},m=_=>{Ca.onChange("subscription","daily_signups_chart",_),a.value!==_&&(a.value=_)};return Te(()=>{p(t.reportFilter.applicableFilters.params),t.reportFilter.addListener("daily-signup-chart",_=>{p(_.params)})}),(_,g)=>(r(),h("div",Goe,[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Daily Signups"),title_size:"small",border_bottom:""},sa({_:2},[l.value.length&&!A.value?{name:"action",fn:u(()=>[o("div",zoe,[s(Yl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:m},null,8,["activeType"]),n.value?(r(),E(Ea,{key:0,targetRef:n.value.chartRef},null,8,["targetRef"])):x("",!0)])]),key:"0"}:void 0]),1032,["title"]),s(Be,null,{default:u(()=>[s(Koe,{chartData:l.value,"chart-title":c(d)("Signups"),chartType:a.value,zoomIsActive:i.value,ref_key:"lineChartRef",ref:n,loading:A.value},null,8,["chartData","chart-title","chartType","zoomIsActive","loading"])]),_:1})]),_:1})]))}};const qoe={name:"Comparison",components:{CardContainer:xe,CardHeader:Ve,CardBody:Be},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.hasComparison?(this.currentMetrics.forEach((t,a)=>{if(a<this.previousMetrics.length){const l=this.previousMetrics[a],n=t.count,i=l.count,A=i?((n-i)/i*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(l.group)}`,count:ha(n),previous_count:ha(i),percent_change:A})}}),e):this.currentMetrics}},methods:{translate:d,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,n]=t;return`${Ka[parseInt(l)-1]} ${n}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Ka[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},Yoe={class:"fct-revenue-comparison"},Woe={class:"inline-flex"},Joe={class:"inline-flex"};function Xoe(e,t,a,l,n,i){const A=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",Yoe,[s(y,{class:"overflow-hidden"},{default:u(()=>[s(A,{title:i.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),s(g,{class:"px-0 pb-0"},{default:u(()=>[a.loading?(r(),E(p,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:u(()=>[s(m,{label:"Date"},{default:u(v=>[R(f(v.row.group),1)]),_:1}),s(m,{label:i.translate("Current Range")},{default:u(v=>[o("div",Woe,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[s(m,{label:i.translate("Compare Range")},{default:u(v=>[o("div",Joe,f(v.row.previous_count),1)]),_:1},8,["label"]),s(m,{label:i.translate("Change")+" (%)"},{default:u(v=>[o("span",{class:ue(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Zoe=nt(qoe,[["render",Xoe]]),eie={class:"fct-refund-report-page"};const tie={__name:"SubscriptionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M({summary:{},fluctuations:{},currentMetrics:[],compareMetrics:[],loading:!0}),l=t.reportFilter,n=M("default"),i=G(()=>l.currentCurrencySign);l.applicableFilters;const A=M(""),p=M(""),m=G(()=>{var S;const w=((S=en.data)==null?void 0:S.productList)||[],B=A.value.toLowerCase();return w.filter(V=>V.product_name.toLowerCase().includes(B))}),_=G(()=>{var S;const w=((S=en.data)==null?void 0:S.customerList)||[],B=p.value.toLowerCase();return w.filter(V=>V.customer_name.toLowerCase().includes(B)||V.email.toLowerCase().includes(B))}),g=w=>{y(w),k(w)},y=(w,B="default")=>{a.value.loading=!0,ce.get("reports/subscription-chart",{params:{...w.params,groupKey:B}}).then(S=>{a.value=S}).finally(()=>a.value.loading=!1)},v=w=>{n.value!==w&&(n.value=w,y(l.applicableFilters.params,w))},k=(w,B=null)=>{en.getRetentionChart({params:{...w.params,customDays:B}})},b=w=>{k(l.applicableFilters,w)};return Te(()=>{l.addListener("subscription-report",w=>{g(w)}),g(l.applicableFilters)}),xt(()=>{l.removeListener("subscription-report")}),(w,B)=>{const S=C("el-col"),V=C("el-row"),F=C("el-input"),$=C("el-table-column"),U=C("el-empty"),D=C("el-table");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",eie,[s(Moe,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:c(en),reportFilter:c(l),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),s(Eoe,{ref:"subscriptionChart",chartData:a.value.currentMetrics,compareData:a.value.compareMetrics,reportFilter:c(l),appliedGroupKey:n.value,onFilterData:v,"is-empty":!a.value.summary.total_subscriptions,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),s(Zoe,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.compareMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:c(l),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),s(V,{gutter:30},{default:u(()=>[s(S,{lg:12},{default:u(()=>[s(goe,{ref:"subscriptionChart",chartData:c(en).data.chartData,onFetchCustomChartData:b,"is-empty":!a.value.summary.total_subscriptions,loading:c(en).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),s(S,{lg:12},{default:u(()=>[s(joe,{reportFilter:c(l),"is-empty":!a.value.summary.total_subscriptions},null,8,["reportFilter","is-empty"])]),_:1})]),_:1}),x("",!0),x("",!0),x("",!0),x("",!0)])]),_:1})}}},aie={class:"fct-refund-report-page"},lie={key:1},sie={key:1,class:"fct-report-order-summary summary-col-2"},nie={class:"summary-item-inner"},oie={class:"value"},iie={class:"inner-value"},rie=["innerHTML"],die={class:"title"},uie={class:"fct-revenue-line-chart-wrap"},cie={class:"flex items-center gap-2"},Aie={class:"fct-card-header-title is-small"},pie={class:"fct-btn-group sm"},fie={class:"chart-action-wrap"},mie={class:"chart-change-wrap"},hie={class:"chart-change"},_ie={class:"text"},vie={class:"chart-change"},gie={class:"text"},yie={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=M(!1),n=Re.colors.report,i=M(Re.isDark()),A=M(null);let p=null;const m=M({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=M(!0),g=(U,D="monthly")=>{_.value=!0,ce.get("reports/future-renewals",{params:{...U.params,groupKey:D}}).then(T=>{m.value=T}).finally(()=>_.value=!1)},y=(U,D,T,I,L)=>({name:U,type:D,barMaxWidth:30,yAxisIndex:T,data:I,smooth:!1,color:L,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(L)},lineStyle:{color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{p&&(p.dispose(),p=null),$e(()=>{A.value&&(p=ca(A.value),k())})},k=()=>{if(!p)return;const U=Hl(m.value.projections),D={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:i.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:i.value?"#253241":"#ffffff",borderColor:i.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:i.value?"#ffffff":"#565865"},axisPointer:Ql(i.value,n.dark_cyan_blue_16,n.light_gray_blue),confine:!0,position:kl,formatter:T=>{let I=T[0].name;return T.forEach((L,O)=>{const Q=O===0?Ja(L.value):ha(L.value),H=i.value?"#ffffff":"#565865";I+=`<div> |
| 218 |
${L.marker} |
| 219 |
<span style="color: ${H};">${L.seriesName}</span> |
| 220 |
<span style="float: right; margin-left: 20px; color: ${H};"> |
| 221 |
${Q} |
| 222 |
</span> |
| 223 |
</div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:U,axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,interval:V.value.interval},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,formatter:T=>`${_t.formatScaledChart(T)}`},splitLine:{show:!0,lineStyle:{color:i.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!1}}],series:S.value};p.setOption(D,{notMerge:!0,replaceMerge:["series"]})},b=()=>{l.value=!l.value,l.value?p.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):k()},w=()=>{i.value=Re.isDark(),$e(()=>{k()})},B=G(()=>{const U=Ks(m.value.period);return d("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+U}),S=G(()=>[{name:d("Revenue"),key:"count",type:"line",color:i.value?n.blue_dark_mode:n.blue,data:m.value.projections.map(D=>D.projected_amount)},{name:d("Count"),key:"count",type:"bar",color:i.value?n.dark_cyan_blue_16:n.light_gray,data:m.value.projections.map(D=>D.renewals_count)}].map((D,T)=>y(D.name,D.type,T,D.data,D.color))),V=G(()=>fl(m.value.projections.length)),F=G(()=>[{title:d("Renewal Revenue"),value:_t.formatScaled(m.value.totalProjected),key:"renewal_revenue"},{title:d("Renewals"),value:ha(m.value.totalRenewals),key:"renewals_count",no_currency:!0}]),$=G(()=>!m.value.totalRenewals);return be([()=>m.value],()=>{$e(k)},{deep:!0}),be($,U=>{U||v()}),be(_,U=>{U||v()}),Te(()=>{g(a.applicableFilters),$e(()=>{v()}),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",k)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),(U,D)=>{const T=C("el-skeleton");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",aie,[s(Xa,{title:c(d)("Subscription Future Revenue")},null,8,["title"])]),s(xe,null,{default:u(()=>[s(Be,{class:"p-3"},{default:u(()=>[_.value?(r(),E(ql,{key:0,loading:_.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),h("div",lie,f(B.value),1))]),_:1})]),_:1}),_.value?(r(),E(ql,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),h("div",sie,[(r(!0),h(P,null,ae(F.value,(I,L)=>(r(),h("div",{class:"summary-item",key:L},[o("div",nie,[o("div",oie,[o("div",iie,[o("span",{innerHTML:I.value},null,8,rie)])]),o("div",die,f(I.title),1)])]))),128))])),o("div",uie,[s(xe,null,{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",cie,[o("h4",Aie,f(c(d)("Upcoming Renewal Revenue")),1)])]),_:2},[m.value.totalRenewals&&!_.value?{name:"action",fn:u(()=>[o("div",pie,[s(tt,{tag:"button",size:"small",title:U.$t("Zoom Chart"),onClick:b,class:ue(l.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:A.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[_.value?(r(),E(T,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(P,{key:1},[$.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[$.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:A},null,512)),o("div",fie,[o("div",mie,[o("div",hie,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",_ie,f(c(d)("Data")),1)]),o("div",vie,[o("span",gie,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},bie={class:"fct-retention-lifetime"},wie={class:"flex items-center gap-2"},Cie={class:"fct-card-header-title is-small"},kie={key:0},Bie={class:"mt-2"},xie={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=G(()=>{var n;return((n=t.data)==null?void 0:n.retention_data)??[]}),l=G(()=>{const n=a.value;if(!n.length)return null;const A=n.reduce((B,S)=>B+parseFloat(S.retention_rate),0)/n.length,p=A/100;let m=0;p<1?m=1/(1-p):m=n.length;const _=n[n.length-1],g=parseInt(_.active_subscriptions),y=parseFloat(_.mrr);let v=0;g>0&&(v=y/g);const k=v*m,b=new Date(_.day),w=Ka[b.getMonth()]+" "+b.getFullYear().toString();return{expected_lifetime_text:d("Based on an average monthly subscription retention rate of %1$s, your expected subscription lifetime is %2$s months.",`${A.toFixed(1)}%`,m.toFixed(1)),ltv_text:d("In %1$s, your average monthly revenue per subscriber was %2$s, giving you an expected subscription lifetime value of %3$s.",w,_t.scaled(v),_t.scaled(k))}});return(n,i)=>{const A=C("el-skeleton");return r(),h("div",bie,[s(xe,null,{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},{title:u(()=>[o("div",wie,[o("h4",Cie,f(c(d)("Lifetime")),1)])]),_:1}),s(Be,null,{default:u(()=>[e.loading?(r(),E(A,{key:0,animated:"",rows:1})):(r(),h(P,{key:1},[l.value?(r(),h("div",kie,[o("div",null,f(l.value.expected_lifetime_text),1),o("div",Bie,f(l.value.ltv_text),1)])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Not enough data to calculate lifetime metrics."),class:"fct-report-empty-state"},null,8,["text"]))],64))]),_:1})]),_:1})])}}},Sie={class:"summary-item-inner"},$ie={class:"title text-[16px] mb-2.5"},Fie={class:"grid grid-cols-2 items-center"},Eie={class:"value"},Uie={class:"sub-value mt-1.5"},Iie={class:"value"},Vie={class:"sub-value mt-1.5"},Die={class:"description leading-[1.6] mt-3.5"},Tie={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Re.colors.report,l=M(Re.isDark()),n=G(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=G(()=>{const p=n.value;if(!p.length)return[];const _=(p.reduce((D,T)=>D+parseFloat(T.retention_rate),0)/p.length).toFixed(1),y=(p.reduce((D,T)=>D+parseFloat(T.retention_rate_money),0)/p.length).toFixed(1),v=p[p.length-1];let k="",b=0,w=0;if(p.length>1){const D=p[p.length-2],T=new Date(D.day);k=Ka[T.getMonth()]+" "+T.getFullYear().toString(),b=parseInt(D.active_subscriptions),w=parseFloat(D.mrr)}else{const D=new Date(v.day);D.setMonth(D.getMonth()-1),k=Ka[D.getMonth()]+" "+D.getFullYear().toString();const T=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);b=v.retention_rate>0?Math.round(T/(v.retention_rate/100)):0;const I=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);w=v.retention_rate_money>0?I/(v.retention_rate_money/100):0}const B=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),S=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),V=parseFloat(v.retention_rate),F=parseFloat(v.retention_rate_money),$=new Date(v.day),U=Ka[$.getMonth()]+" "+$.getFullYear().toString();return[{title:d("Subscription Retention"),value:`${V}%`,average_value:`${_}%`,month_name:U,sub_title:d("Average in period"),description:d("You retained %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${v.retention_rate}%`,ha(B),k,ha(b)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:d("MRR Retention"),value:`${F}%`,average_value:`${y}%`,month_name:U,sub_title:d("Average in period"),description:d("You retained %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${v.retention_rate_money}%`,_t.scaled(S),k,_t.scaled(w)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),A=()=>{l.value=Re.isDark()};return Te(()=>{window.addEventListener("onFluentCartThemeChange",A)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",A,!1)}),(p,m)=>{var _,g;return e.loading?(r(),E(ql,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:ue(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(P,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",Sie,[o("div",$ie,f(y.title),1),o("div",Fie,[o("div",null,[o("div",Eie,f(y.value),1),o("div",Uie,f(y.month_name),1)]),o("div",null,[o("div",Iie,f(y.average_value),1),o("div",Vie,f(y.sub_title),1)])]),o("div",Die,f(y.description),1)])]))),128)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},Qie={class:"fct-revenue-line-chart-wrap"},Mie={class:"flex items-center gap-2"},Lie={class:"fct-card-header-title is-small"},Rie={class:"fct-btn-group sm"},Oie={class:"chart-action-wrap"},Pie={class:"chart-change-wrap"},Hie={class:"chart-change"},Nie={class:"text"},Kie={class:"chart-change"},Gie={class:"text"},zie={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=M(!1),l=Re.colors.report,n=M(Re.isDark()),i=M(null);let A=null;const p=M(Ca.getChartType("subscription","retention_chart")||"line"),m=(V,F,$,U,D)=>({name:V,type:F,barMaxWidth:30,yAxisIndex:$,data:U,smooth:!1,color:D,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(D)},lineStyle:{color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{A&&(A.dispose(),A=null),$e(()=>{i.value&&(A=ca(i.value),g())})},g=()=>{if(!A)return;const V=Hl(b.value),F={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:n.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:n.value?"#253241":"#ffffff",borderColor:n.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:n.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:n.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:$=>{let U=$[0].name;return $.forEach((D,T)=>{const I=ha(D.value)+"%",L=n.value?"#ffffff":"#565865";U+=`<div> |
| 224 |
${D.marker} |
| 225 |
<span style="color: ${L};">${D.seriesName}</span> |
| 226 |
<span style="float: right; margin-left: 20px; color: ${L};"> |
| 227 |
${I} |
| 228 |
</span> |
| 229 |
</div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,interval:B.value.interval},axisLine:{lineStyle:{type:"dashed",color:n.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,formatter:$=>`${$}%`},splitLine:{show:!0,lineStyle:{color:n.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};A.setOption(F,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?A.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):g()},v=()=>{n.value=Re.isDark(),$e(()=>{g()})},k=V=>{Ca.onChange("subscription","retention_chart",V),p.value!==V&&(a.value=!1,p.value=V,g())},b=G(()=>{var V;return((V=t.data)==null?void 0:V.retention_data)??[]}),w=G(()=>[{name:d("Subscription Retention"),key:"count",type:p.value,color:n.value?l.dark_cyan_blue_16:l.light_gray,data:b.value.map(F=>F.retention_rate)},{name:d("MRR Retention"),key:"count",type:p.value,color:n.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:b.value.map(F=>F.retention_rate_money)}].map((F,$)=>m(F.name,F.type,0,F.data,F.color))),B=G(()=>fl(b.value.length)),S=G(()=>!b.value||!b.value.length);return be([()=>t.data],()=>{$e(_)},{deep:!0}),be(S,V=>{V||_()}),be(t.loading,V=>{V||_()}),Te(()=>{$e(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(V,F)=>{const $=C("el-skeleton");return r(),h("div",Qie,[s(xe,null,{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",Mie,[o("h4",Lie,f(c(d)("Retention Rate")),1)])]),_:2},[!S.value&&!e.loading?{name:"action",fn:u(()=>[o("div",Rie,[s(Yl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:k},null,8,["activeType"]),s(tt,{tag:"button",size:"small",title:V.$t("Zoom Chart"),onClick:y,class:ue(a.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E($,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(P,{key:1},[S.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[S.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:i},null,512)),o("div",Oie,[o("div",Pie,[o("div",Hie,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Nie,f(c(d)("Data")),1)]),o("div",Kie,[o("span",Gie,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},jie={class:"summary-item-inner"},qie={class:"title text-[16px] mb-2.5"},Yie={class:"grid grid-cols-2 items-center"},Wie={class:"value"},Jie={class:"sub-value mt-1.5"},Xie={class:"value"},Zie={class:"sub-value mt-1.5"},ere={class:"description leading-[1.6] mt-3.5"},tre={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Re.colors.report,l=M(Re.isDark()),n=G(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=G(()=>{const p=n.value;if(!p.length)return[];const m=p.map((T,I)=>{const L=I>0?parseInt(p[I-1].active_subscriptions)||0:parseInt(T.active_subscriptions)-parseInt(T.new_subscriptions)||0,O=parseInt(T.churned_subscriptions)||0;return L>0?O/L*100:0}),_=p.map((T,I)=>{const L=I>0?parseFloat(p[I-1].mrr)||0:parseFloat(T.mrr)-parseFloat(T.new_subscriptions_mrr)||0,O=parseFloat(T.churned_subscriptions_mrr)||0;return L>0?O/L*100:0}),g=(m.reduce((T,I)=>T+I,0)/m.length).toFixed(1),y=(_.reduce((T,I)=>T+I,0)/_.length).toFixed(1),v=p[p.length-1],k=p.length-1,b=k>0?parseInt(p[k-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,w=k>0?parseFloat(p[k-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,B=parseInt(v.churned_subscriptions)||0,S=parseFloat(v.churned_subscriptions_mrr)||0,V=b>0?(B/b*100).toFixed(1):0,F=w>0?(S/w*100).toFixed(1):0,$=new Date(v.day),U=Ka[$.getMonth()]+" "+$.getFullYear().toString();let D="";if(p.length>1){const T=p[p.length-2],I=new Date(T.day);D=Ka[I.getMonth()]+" "+I.getFullYear().toString()}else{const T=new Date(v.day);T.setMonth(T.getMonth()-1),D=Ka[T.getMonth()]+" "+T.getFullYear().toString()}return[{title:d("Subscription Churn"),value:`${V}%`,average_value:`${g}%`,month_name:U,sub_title:d("Average in period"),description:d("You lost %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${V}%`,ha(B),D,ha(b)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:d("MRR Churn"),value:`${F}%`,average_value:`${y}%`,month_name:U,sub_title:d("Average in period"),description:d("You lost %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${F}%`,_t.scaled(S),D,_t.scaled(w)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),A=()=>{l.value=Re.isDark()};return Te(()=>{window.addEventListener("onFluentCartThemeChange",A)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",A,!1)}),(p,m)=>{var _,g;return e.loading?(r(),E(ql,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:ue(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(P,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",jie,[o("div",qie,f(y.title),1),o("div",Yie,[o("div",null,[o("div",Wie,f(y.value),1),o("div",Jie,f(y.month_name),1)]),o("div",null,[o("div",Xie,f(y.average_value),1),o("div",Zie,f(y.sub_title),1)])]),o("div",ere,f(y.description),1)])]))),128)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},are={class:"fct-revenue-line-chart-wrap"},lre={class:"flex items-center gap-2"},sre={class:"fct-card-header-title is-small"},nre={class:"fct-btn-group sm"},ore={class:"chart-action-wrap"},ire={class:"chart-change-wrap"},rre={class:"chart-change"},dre={class:"text"},ure={class:"chart-change"},cre={class:"text"},Are={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=M(!1),l=Re.colors.report,n=M(Re.isDark()),i=M(null);let A=null;const p=M(Ca.getChartType("subscription","churn_chart")||"line"),m=(V,F,$,U,D)=>({name:V,type:F,barMaxWidth:30,yAxisIndex:$,data:U,smooth:!1,color:D,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(D)},lineStyle:{color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{A&&(A.dispose(),A=null),$e(()=>{i.value&&(A=ca(i.value),g())})},g=()=>{if(!A)return;const V=Hl(b.value),F={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:n.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:n.value?"#253241":"#ffffff",borderColor:n.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:n.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:n.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:$=>{let U=$[0].name;return $.forEach((D,T)=>{const I=ha(D.value)+"%",L=n.value?"#ffffff":"#565865";U+=`<div> |
| 230 |
${D.marker} |
| 231 |
<span style="color: ${L};">${D.seriesName}</span> |
| 232 |
<span style="float: right; margin-left: 20px; color: ${L};"> |
| 233 |
${I} |
| 234 |
</span> |
| 235 |
</div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,interval:B.value.interval},axisLine:{lineStyle:{type:"dashed",color:n.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,formatter:$=>`${$}%`},splitLine:{show:!0,lineStyle:{color:n.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};A.setOption(F,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?A.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):g()},v=()=>{n.value=Re.isDark(),$e(()=>{g()})},k=V=>{Ca.onChange("subscription","churn_chart",V),p.value!==V&&(a.value=!1,p.value=V,g())},b=G(()=>{var V;return((V=t.data)==null?void 0:V.retention_data)??[]}),w=G(()=>{const V=b.value.map((U,D)=>{const T=D>0?parseInt(b.value[D-1].active_subscriptions)||0:parseInt(U.active_subscriptions)-parseInt(U.new_subscriptions)||0,I=parseInt(U.churned_subscriptions)||0;return T>0?(I/T*100).toFixed(2):0}),F=b.value.map((U,D)=>{const T=D>0?parseFloat(b.value[D-1].mrr)||0:parseFloat(U.mrr)-parseFloat(U.new_subscriptions_mrr)||0,I=parseFloat(U.churned_subscriptions_mrr)||0;return T>0?(I/T*100).toFixed(2):0});return[{name:d("Subscription Churn"),type:p.value,color:n.value?l.dark_cyan_blue_16:l.light_gray,data:V},{name:d("MRR Churn"),type:p.value,color:n.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:F}].map((U,D)=>m(U.name,U.type,0,U.data,U.color))}),B=G(()=>fl(b.value.length)),S=G(()=>!b.value||!b.value.length);return be([()=>t.data],()=>{$e(_)},{deep:!0}),be(S,V=>{V||_()}),be(t.loading,V=>{V||_()}),Te(()=>{$e(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(V,F)=>{const $=C("el-skeleton");return r(),h("div",are,[s(xe,null,{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",lre,[o("h4",sre,f(c(d)("Churn Rate")),1)])]),_:2},[!S.value&&!e.loading?{name:"action",fn:u(()=>[o("div",nre,[s(Yl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:k},null,8,["activeType"]),s(tt,{tag:"button",size:"small",title:V.$t("Zoom Chart"),onClick:y,class:ue(a.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E($,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(P,{key:1},[S.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[S.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:i},null,512)),o("div",ore,[o("div",ire,[o("div",rre,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",dre,f(c(d)("Data")),1)]),o("div",ure,[o("span",cre,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},pre={class:"fct-retention-report-page"},fre={class:"page-title"},mre={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=M({retention_data:[]}),n=M(!0),i=(A,p="monthly")=>{n.value=!0,ce.get("reports/subscription-retention",{params:{...A.params,groupKey:p}}).then(m=>{l.value=m}).finally(()=>n.value=!1)};return Te(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(A,p)=>{const m=C("el-tooltip");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",pre,[s(Xa,null,{title:u(()=>[o("h1",fre,[R(f(c(d)("Subscription Retention"))+" ",1),s(m,{"popper-class":"fct-tooltip",content:c(d)("Retention is calculated by looking at the active subscriptions at the end of each month, compared to the active subscriptions at the end of the start of each month."),placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),s(Tie,{data:l.value,loading:n.value},null,8,["data","loading"]),s(zie,{data:l.value,loading:n.value},null,8,["data","loading"]),s(xie,{data:l.value,loading:n.value},null,8,["data","loading"]),s(tre,{data:l.value,loading:n.value},null,8,["data","loading"]),s(Are,{data:l.value,loading:n.value},null,8,["data","loading"])])]),_:1})}}},hre={key:1,class:"fct-report-order-summary"},_re={class:"summary-item-inner"},vre={class:"value"},gre={class:"inner-value"},yre={class:"title"},bre={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:d("Customer Growth"),key:"customer_count"}],l=G(()=>t.customerReport.loading),n=G(()=>a.map(i=>({key:i.key,title:i.title,value:t.customerReport.summary[i.key],fluctuation:t.customerReport.fluctuations[i.key]})));return(i,A)=>l.value?(r(),E(ql,{key:0,count:n.value.length},null,8,["count"])):(r(),h("div",hre,[(r(!0),h(P,null,ae(n.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",_re,[o("div",vre,[o("div",gre,f(c(ha)(p.value)),1),s(yl,{fluctuation:p.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[p.key]},null,8,["fluctuation","amount"])]),o("div",yre,f(p.title),1)])]))),128))]))}},wre={class:"fct-revenue-line-chart-wrap"},Cre={class:"flex items-center gap-2"},kre={class:"fct-card-header-title is-small"},Bre={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},xre={class:"chart-action-wrap"},Sre={class:"chart-change-wrap"},$re={class:"chart-change"},Fre={class:"text"},Ere={class:"chart-change"},Ure={class:"text"},Ire={__name:"CustomerReportChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,required:!1},loading:{type:Boolean,required:!1}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=M(null),n=M(Ca.getChartType("revenue","revenue_chart")||"line"),i=M(!1),A=Re.colors.report,p=M(Re.isDark()),m=(T,I,L,O,Q)=>({name:T,type:I,barMaxWidth:30,yAxisIndex:L,data:O,smooth:!1,color:Q,lineStyle:{width:3},areaStyle:{opacity:.3,color:Q},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(Q)},lineStyle:{color:Q},areaStyle:{opacity:.3,color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M(a.appliedGroupKey);be(()=>a.appliedGroupKey,T=>{_.value=T});const{groupKeys:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=G(()=>a.reportFilter.data.compareType!=="no_comparison"),b=G(()=>{var I;let T=[{name:d("Current Range"),key:"customer_count",type:n.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(L=>L.customer_count)}];return k.value&&T.unshift({name:d("Compare Range"),key:"customer_count",type:n.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:(I=a.compareData)==null?void 0:I.map(L=>({value:L.customer_count,date:L.group}))}),T.map(L=>m(L.name,L.type,0,L.data,L.color))});let w=null;const B=()=>{w&&(w.dispose(),w=null),$e(()=>{l.value&&(w=ca(l.value),F())})},S=G(()=>{const T=Ks(a.reportFilter.data.dateRange);return d("Customers that first ordered ")+T}),V=G(()=>fl(a.chartData.length)),F=()=>{if(!w)return;const T=Hl(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,formatter:L=>{let O="";const Q=p.value?"#ffffff":"#565865";return L.forEach(function(H,K){const W=typeof H.data=="object"&&H.data!==null,z=W?Gs(H.data.date):H.name,Y=W?H.data.value:H.value,Z=L.length>1&&K===0;Z&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${z}</div>`,O+=`<div> |
| 236 |
${H.marker} |
| 237 |
<span style="color: ${Q}">${d("Customer")}</span> |
| 238 |
<span style="float: right; margin-left: 20px; color: ${Q}"> |
| 239 |
${ha(Y)} |
| 240 |
</span> |
| 241 |
</div>`,Z&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:V.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(I,{notMerge:!0,replaceMerge:["series"]})},$=()=>{i.value=!i.value,i.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()},U=T=>{Ca.onChange("revenue","revenue_chart",T),n.value!==T&&(i.value=!1,n.value=T,F())};be([()=>a.chartData,_],()=>{$e(F)},{deep:!0}),be(()=>jl.data.revenue,()=>{$e(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||B()}),be(()=>a.loading,T=>{T||B()});const D=()=>{p.value=Re.isDark(),$e(()=>{F()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",D),$e(()=>{B()})}),(T,I)=>{const L=C("el-tooltip"),O=C("el-option"),Q=C("el-select"),H=C("el-skeleton");return r(),h("div",wre,[s(xe,null,{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",Cre,[o("h5",kre,f(c(d)("New Customers")),1),s(L,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",Bre,[s(Q,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=K=>_.value=K),onChange:v},{default:u(()=>[(r(!0),h(P,null,ae(c(g),K=>(r(),E(O,{key:K.value,label:c(d)(K.label),value:K.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),s(Yl,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),s(tt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:$,class:ue(i.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:6,class:"p-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[o("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512),o("div",xre,[o("div",Sre,[o("div",$re,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Fre,f(c(d)("Data")),1)]),o("div",Ere,[o("span",Ure,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Vre={name:"Comparison",components:{CardContainer:xe,CardHeader:Ve,CardBody:Be},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,required:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.hasComparison?(this.currentMetrics.forEach((t,a)=>{var l;if(a<((l=this.previousMetrics)==null?void 0:l.length)){const n=this.previousMetrics[a],i=t.customer_count,A=n.customer_count,p=A?((i-A)/A*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(n.group)}`,count:i,previous_count:A,percent_change:p})}}),e):this.currentMetrics}},methods:{translate:d,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,n]=t;return`${Ka[parseInt(l)-1]} ${n}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Ka[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},Dre={class:"fct-revenue-comparison"},Tre={class:"inline-flex"},Qre={class:"inline-flex"};function Mre(e,t,a,l,n,i){const A=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",Dre,[s(y,{class:"overflow-hidden"},{default:u(()=>[s(A,{title:i.translate("Comparison"),title_size:"small"},null,8,["title"]),s(g,{class:"px-0 pb-0"},{default:u(()=>[a.loading?(r(),E(p,{key:0,animated:"",rows:6,class:"p-5"})):(r(),E(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:u(()=>[s(m,{label:"Date"},{default:u(v=>[R(f(v.row.group),1)]),_:1}),s(m,{label:i.translate("Current Range")},{default:u(v=>[o("div",Tre,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[s(m,{label:i.translate("Compare Range")},{default:u(v=>[o("div",Qre,f(v.row.previous_count),1)]),_:1},8,["label"]),s(m,{label:i.translate("Change")+" (%)"},{default:u(v=>[o("span",{class:ue(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Lre=nt(Vre,[["render",Mre]]),Rre={class:"fct-customer-report-page"},Ore={__name:"CustomerReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M({summary:{},previousSummary:{},fluctuations:{},currentMetrics:[],previousMetrics:[],loading:!0}),l=M("default"),n=t.reportFilter,i=n.applicableFilters.params,A=(m,_="default")=>{a.value.loading=!0,ce.get("reports/customer-report",{params:{...m,groupKey:_}}).then(g=>{a.value=g}).finally(()=>{a.value.loading=!1})},p=m=>{l.value!==m&&(l.value=m,A(i,m))};return Te(()=>{A(i),t.reportFilter.addListener("customer-report",m=>{A(m.params,l.value)})}),(m,_)=>(r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",Rre,[s(Xa,{title:c(d)("Customers")},null,8,["title"]),s(bre,{reportFilter:c(n),customerReport:a.value},null,8,["reportFilter","customerReport"]),s(Ire,{chartData:a.value.currentMetrics,compareData:a.value.previousMetrics,reportFilter:c(n),appliedGroupKey:l.value,onFilterData:p,"is-empty":!a.value.summary.customer_count,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),s(Lre,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:c(n),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"])])]),_:1}))}},Pre="source_report";class Hre extends il{constructor(a={}){super();ze(this,"data",{});this.initOptions=a}beforeInit(){this.data.advanceFilters=this.getStoredAdvanceFilters(),this.data.filterType=this.getStoredFilterType(),this.data.vueInstance=this.initOptions.instance||null,this.data.onApply=typeof this.initOptions.onApply=="function"?this.initOptions.onApply:null}getTableName(){return Pre}getFilterTypeStorageName(){return`${this.getTableName()}_filter_type`}getAdvancedFilterStorageName(){return`${this.getTableName()}_advanced_filter`}getStoredAdvanceFilters(){const a=Qt.get(this.getAdvancedFilterStorageName());return!Array.isArray(a)||!a.length?[[]]:a}getStoredFilterType(){return this.isProActive()&&Qt.get(this.getFilterTypeStorageName())==="advanced"&&this.isAdvanceFilterEnabled()?"advanced":"simple"}storeAdvanceFilter(){Qt.set(this.getAdvancedFilterStorageName(),this.data.advanceFilters)}isProActive(){return Ke.get("app_config.isProActive")}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}isUsingSimpleFilter(){return this.data.filterType==="simple"}getAdvanceFilterOptions(){return dt.get(window,`fluentCartAdminApp.table_config.${this.getTableName()}.filters.advance`)}isAdvanceFilterEnabled(){return this.getAdvanceFilterOptions()!==null}onFilterTypeChanged(a){a==="simple"&&this.triggerApply(),Qt.set(this.getFilterTypeStorageName(),this.data.filterType)}applyAdvancedFilter(a=!1){if(!this.isProActive()){a||nA.showFeaturesCTA(d("Advanced Filter"),d("Advanced filter is only available in pro version"),[],this.data.vueInstance,"feature_lock_advanced_filtering"),this.storeAdvanceFilter();return}this.storeAdvanceFilter(),this.triggerApply()}addAdvanceFilterGroup(){this.data.advanceFilters.push([])}removeAdvanceFilterGroup(a){this.data.advanceFilters.length>1&&this.data.advanceFilters.splice(a,1),this.storeAdvanceFilter()}clearAdvanceFilter(){this.data.advanceFilters=[[]],this.applyAdvancedFilter(!0)}getQueryParams(){return this.isUsingAdvanceFilter()?{filter_type:"advanced",advanced_filters:JSON.stringify(this.data.advanceFilters)}:{filter_type:"simple"}}triggerApply(){this.data.onApply&&this.data.onApply()}}const Nre={class:"fct-revenue-report-page"},Kre={class:"fct-revenue-comparison fct-table-wrapper"},Gre={class:"fct-card"},zre={class:"fct-card-header"},jre={class:"fct-card-header-top"},qre={key:0,class:"fct-card-header-left flex-1"},Yre={class:"search-bar is-transparent"},Wre={class:"text-xs text-system-light pt-1 dark:text-gray-300"},Jre={key:1,class:"flex-1"},Xre={class:"fct-card-header-actions"},Zre={key:0,class:"fct-advanced-filter-toggle-wrapper"},ede={class:"w-[130px]"},tde={class:"fct-btn-group sm"},ade={class:"filter-popover-item"},lde={class:"filter-popover-title"},sde={class:"fct-card-body"},nde={key:1},ode={key:2,class:"unknown"},ide={key:1},rde={key:2,class:"unknown"},dde={key:1},ude={key:2,class:"unknown"},cde={key:1},Ade={key:2,class:"unknown"},pde={key:1},fde={key:2,class:"unknown"},mde={key:1},hde={key:2,class:"unknown"},_de={class:"inline-flex items-center gap-2"},vde={class:"inline-flex items-center gap-2"},gde={class:"inline-flex items-center gap-2"},yde={class:"inline-flex items-center gap-2"},bde={class:"inline-flex items-center gap-2"},wde=4,Cde={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M([]),l=M({}),n=M(!1),i=M({utm_campaign:d("UTM Campaign"),utm_source:d("UTM Source"),utm_medium:d("UTM Medium"),utm_term:d("UTM Term"),utm_content:d("UTM Content"),utm_id:d("UTM ID")}),A=M(["utm_campaign","utm_source","utm_medium"]),p=M(!0),m=M(""),_=G(()=>a.value.filter(B=>{if(!m.value)return!0;const S=m.value.toLowerCase();return B.utm_campaign&&B.utm_campaign.toLowerCase().includes(S)||B.utm_source&&B.utm_source.toLowerCase().includes(S)||B.utm_medium&&B.utm_medium.toLowerCase().includes(S)||B.utm_term&&B.utm_term.toLowerCase().includes(S)||B.utm_content&&B.utm_content.toLowerCase().includes(S)||B.utm_id&&B.utm_id.toLowerCase().includes(S)}));let g=0;const y=()=>{const B=++g;p.value=!0;const S={params:{...t.reportFilter.applicableFilters.params,...v.getQueryParams()}};ce.get("/reports/sources",S).then(V=>{B===g&&(a.value=V.sourceReportData,l.value=V.fluctuations||{})}).catch(V=>{var F;B===g&&j.error(((F=V==null?void 0:V.data)==null?void 0:F.message)||d("Failed to load the order sources report"))}).finally(()=>{B===g&&(p.value=!1)})},v=Hre.init({instance:aa(),onApply:()=>y()}),k=G(()=>!v.isUsingAdvanceFilter()),b=B=>{B==="advanced"&&(m.value=""),v.onFilterTypeChanged(B)},w=B=>A.value.includes(B)?!1:A.value.length>=wde;return Te(()=>{y(),t.reportFilter.addListener("product-top-chart",()=>{y()})}),(B,S)=>{const V=C("el-input"),F=C("el-switch"),$=C("el-checkbox"),U=C("el-checkbox-group"),D=C("el-tooltip"),T=C("el-popover"),I=C("el-skeleton"),L=C("el-table-column"),O=C("el-table");return r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",Nre,[s(Xa,{title:c(d)("Order Sources")},null,8,["title"]),o("div",Kre,[o("div",Gre,[o("div",zre,[o("div",jre,[c(v).isUsingAdvanceFilter()?(r(),h("div",Jre)):(r(),h("div",qre,[o("div",Yre,[s(V,{placeholder:c(d)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:m.value,"onUpdate:modelValue":S[0]||(S[0]=Q=>m.value=Q)},{prefix:u(()=>[s(X,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",Wre,f(c(d)("Filter results by UTM values")),1)])),o("div",Xre,[c(v).isAdvanceFilterEnabled()?(r(),h("div",Zre,[s(F,{class:"fct-advanced-filter-toggle",onChange:S[1]||(S[1]=Q=>{b(Q)}),"active-value":"advanced","inactive-value":"simple",modelValue:c(v).data.filterType,"onUpdate:modelValue":S[2]||(S[2]=Q=>c(v).data.filterType=Q),"active-text":c(d)("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):x("",!0),o("div",ede,[s(F,{modelValue:n.value,"onUpdate:modelValue":S[3]||(S[3]=Q=>n.value=Q),"active-text":c(d)("Net"),"inactive-text":c(d)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),o("div",tde,[s(T,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:u(()=>[o("span",null,[s(D,{effect:"light",content:c(d)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{tag:"button"},{default:u(()=>[s(X,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",ade,[o("h3",lde,f(B.$t("Columns")),1),s(U,{class:"fct-checkbox-blocks",modelValue:A.value,"onUpdate:modelValue":S[4]||(S[4]=Q=>A.value=Q)},{default:u(()=>[(r(!0),h(P,null,ae(i.value,(Q,H)=>(r(),E($,{label:Q,value:H,disabled:w(H)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])]),s(oA,{table:c(v),"show-save-view":!1},null,8,["table"])]),o("div",sde,[p.value?(r(),E(I,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),E(O,{key:1,data:_.value,class:"w-full fct-source-report"},{empty:u(()=>[s(wt,{icon:"Empty/Order","has-dark":"",text:c(d)("No data available")},null,8,["text"])]),default:u(()=>[A.value.includes("utm_campaign")?(r(),E(L,{key:0,label:c(d)("UTM Campaign"),width:"180"},{default:u(Q=>[Q.row.utm_campaign&&k.value?(r(),E(c(js),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=Q.row.utm_campaign},{default:u(()=>[R(f(Q.row.utm_campaign),1)]),_:2},1032,["onClick"])):Q.row.utm_campaign?(r(),h("span",nde,f(Q.row.utm_campaign),1)):(r(),h("span",ode,f(c(d)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_source")?(r(),E(L,{key:1,label:c(d)("UTM Source"),width:"150"},{default:u(Q=>[Q.row.utm_source&&k.value?(r(),E(c(js),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=Q.row.utm_source},{default:u(()=>[R(f(Q.row.utm_source),1)]),_:2},1032,["onClick"])):Q.row.utm_source?(r(),h("span",ide,f(Q.row.utm_source),1)):(r(),h("span",rde,f(c(d)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_medium")?(r(),E(L,{key:2,label:c(d)("UTM Medium"),width:"150"},{default:u(Q=>[Q.row.utm_medium&&k.value?(r(),E(c(js),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=Q.row.utm_medium},{default:u(()=>[R(f(Q.row.utm_medium),1)]),_:2},1032,["onClick"])):Q.row.utm_medium?(r(),h("span",dde,f(Q.row.utm_medium),1)):(r(),h("span",ude,f(c(d)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_term")?(r(),E(L,{key:3,label:c(d)("UTM Term"),width:"150"},{default:u(Q=>[Q.row.utm_term&&k.value?(r(),E(c(js),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=Q.row.utm_term},{default:u(()=>[R(f(Q.row.utm_term),1)]),_:2},1032,["onClick"])):Q.row.utm_term?(r(),h("span",cde,f(Q.row.utm_term),1)):(r(),h("span",Ade,f(c(d)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_content")?(r(),E(L,{key:4,label:c(d)("UTM Content"),width:"150"},{default:u(Q=>[Q.row.utm_content&&k.value?(r(),E(c(js),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=Q.row.utm_content},{default:u(()=>[R(f(Q.row.utm_content),1)]),_:2},1032,["onClick"])):Q.row.utm_content?(r(),h("span",pde,f(Q.row.utm_content),1)):(r(),h("span",fde,f(c(d)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_id")?(r(),E(L,{key:5,label:c(d)("UTM ID"),width:"100"},{default:u(Q=>[Q.row.utm_id&&k.value?(r(),E(c(js),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=Q.row.utm_id},{default:u(()=>[R(f(Q.row.utm_id),1)]),_:2},1032,["onClick"])):Q.row.utm_id?(r(),h("span",mde,f(Q.row.utm_id),1)):(r(),h("span",hde,f(c(d)("Unknown")),1))]),_:1},8,["label"])):x("",!0),s(L,{label:c(d)("Orders"),width:"200"},{default:u(Q=>{var H,K;return[o("div",_de,[R(f(c(ha)(Q.row.orders))+" ",1),s(yl,{class:"flex",fluctuation:((H=l.value[Q.row.utm_key])==null?void 0:H.orders_fluctuation)||0,amount:((K=l.value[Q.row.utm_key])==null?void 0:K.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n.value?(r(),h(P,{key:6},[s(L,{label:c(d)("Net Sales"),width:"200"},{default:u(Q=>{var H,K;return[o("div",vde,[R(f(c(_t).scaled(Q.row.net_sales))+" ",1),s(yl,{class:"flex",fluctuation:((H=l.value[Q.row.utm_key])==null?void 0:H.net_sales_fluctuation)||0,amount:((K=l.value[Q.row.utm_key])==null?void 0:K.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s(L,{label:c(d)("Average Order Net"),width:"200"},{default:u(Q=>{var H,K;return[o("div",gde,[R(f(c(_t).scaled(Q.row.average_net_order))+" ",1),s(yl,{class:"flex",fluctuation:((H=l.value[Q.row.utm_key])==null?void 0:H.average_net_order_fluctuation)||0,amount:((K=l.value[Q.row.utm_key])==null?void 0:K.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),h(P,{key:7},[s(L,{label:c(d)("Gross Sales"),width:"200"},{default:u(Q=>{var H,K;return[o("div",yde,[R(f(c(_t).scaled(Q.row.gross_sales))+" ",1),s(yl,{class:"flex",fluctuation:((H=l.value[Q.row.utm_key])==null?void 0:H.gross_sales_fluctuation)||0,amount:((K=l.value[Q.row.utm_key])==null?void 0:K.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s(L,{label:c(d)("Average Order"),width:"200"},{default:u(Q=>{var H,K;return[o("div",bde,[R(f(c(_t).scaled(Q.row.average_order))+" ",1),s(yl,{class:"flex",fluctuation:((H=l.value[Q.row.utm_key])==null?void 0:H.average_order_fluctuation)||0,amount:((K=l.value[Q.row.utm_key])==null?void 0:K.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},kde={class:"fct-revenue-line-chart-wrap"},Bde={class:"flex items-center gap-2"},xde={class:"fct-card-header-title is-small"},Sde={class:"fct-chart-select"},$de={class:"fct-btn-group sm"},Fde={class:"chart-action-wrap"},Ede={class:"chart-change-wrap"},Ude={class:"chart-change"},Ide={class:"text"},Vde={class:"chart-change"},Dde={class:"text"},Tde={__name:"ProductReportChart",props:{chartData:{type:Array,required:!0,default:()=>[]},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=M(null),n=M(Ca.getChartType("product","product_chart")||"bar"),i=M(!1),A=Re.colors.report,p=M(Re.isDark()),m=(I,L,O,Q,H)=>({name:I,type:L,barMaxWidth:30,yAxisIndex:O,data:Q,smooth:!1,color:H,lineStyle:{width:3},areaStyle:{opacity:.3,color:H},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:H,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:el(H)},lineStyle:{color:H},areaStyle:{opacity:.3,color:H}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M("default"),{groupKeys:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=G(()=>a.reportFilter.data.compareType!=="no_comparison"),b=G(()=>{let I=[{name:d("Current Range"),key:"units_sold",type:n.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(L=>L.units_sold)}];return k.value&&I.unshift({name:d("Compare Range"),key:"units_sold",type:n.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(L=>({value:L.units_sold,date:L.group}))}),I.map(L=>m(L.name,L.type,0,L.data,L.color))});let w=null;const B=()=>{w&&(w.dispose(),w=null),$e(()=>{l.value&&(w=ca(l.value),F())})},S=G(()=>{const I=Ks(a.reportFilter.data.dateRange);return d("This report looks at the units sold ")+I}),V=G(()=>fl(a.chartData.length)),F=()=>{if(!w)return;const I=Hl(a.chartData),L={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?A.dark_cyan_blue_16:A.light_gray_blue}},formatter:O=>{let Q="";const H=p.value?"#ffffff":"#565865";return O.forEach(function(K,W){const z=typeof K.data=="object"&&K.data!==null,Y=z?Gs(K.data.date):K.name,Z=z?K.data.value:K.value,re=O.length>1&&W===0;re&&(Q+='<div style="margin-bottom: 10px">'),Q+=`<div>${Y}</div>`,Q+=`<div> |
| 242 |
${K.marker} |
| 243 |
<span style="color: ${H}">${d("Units Sold")}</span> |
| 244 |
<span style="float: right; margin-left: 20px; color: ${H}"> |
| 245 |
${ha(Z)} |
| 246 |
</span> |
| 247 |
</div>`,re&&(Q+="</div>")}),Q}},grid:{show:!1},xAxis:{type:"category",data:I,splitNumber:V.value.splitNumber,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:V.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(L,{notMerge:!0,replaceMerge:["series"]})},$=()=>{i.value=!i.value,i.value&&w?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):w&&F()},U=I=>{Ca.onChange("revenue","revenue_chart",I),n.value!==I&&(i.value=!1,n.value=I,F())};be([()=>a.chartData,_],()=>{$e(()=>{F()})},{deep:!0}),be(()=>jl.data.product,()=>{$e(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,I=>{I||B()}),be(()=>a.loading,I=>{I||B()});const D=()=>{w&&w.resize()},T=()=>{p.value=Re.isDark(),$e(()=>{F()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("resize",D),setTimeout(()=>{B()},100)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("resize",D),w&&(w.dispose(),w=null)}),(I,L)=>{const O=C("el-tooltip"),Q=C("el-option"),H=C("el-select"),K=C("el-skeleton");return r(),h("div",kde,[s(xe,{id:"chartContainer"},{default:u(()=>[s(Ve,{title_size:"small",border_bottom:""},sa({title:u(()=>[o("div",Bde,[o("h5",xde,f(c(d)("Product Report Chart")),1),s(O,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",Sde,[s(H,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":L[0]||(L[0]=W=>_.value=W),onChange:v},{default:u(()=>[(r(!0),h(P,null,ae(c(g),W=>(r(),E(Q,{key:W.value,label:c(d)(W.label),value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",$de,[s(Yl,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),s(tt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:$,class:ue(i.value?"primary":"")},{default:u(()=>[s(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),s(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),s(Be,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(K,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:l},null,512)),o("div",Fde,[o("div",Ede,[o("div",Ude,[s(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Ide,f(c(d)("Data")),1)]),o("div",Vde,[o("span",Dde,f(c(d)("Timeline")),1),s(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Qde=nt(Tde,[["__scopeId","data-v-8add5f1e"]]);class Mde extends il{constructor(){super(...arguments);ze(this,"data",{summary:{},previousSummary:{},fluctuations:{},isBusy:!0,currentMetrics:[],previousMetrics:[],chartData:[],topSoldProducts:[]})}get controllerKey(){return"ProductReportController"}makeRequest(a,l,n,i){this.data.isBusy=!0,typeof l!="object"&&(l={});const A=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,n,i),A}resolvePromiseResponse(a,l=null,n=null){a.then(i=>{n==null||l==null?Object.assign(this.data,i):this.data[n]=i[l]}).catch(i=>{}).finally(()=>{this.data.isBusy=!1})}getReportData(a={}){return this.makeRequest("net-revenue",a,"data","revenueReport")}getReportByGroup(a={}){return this.makeRequest("net-revenue-by-group",a,"data","netRevenueByGroup")}getProductReportData(a={}){return this.makeRequest("product-report",a)}getSummary(a={}){return this.makeRequest("product-report-summary",a)}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}}const Sl=Mde.init(),Lde={class:"summary-item-inner"},Rde={class:"value"},Ode={class:"inner-value"},Pde={class:"title"},Hde={__name:"Summary",props:{reportFilter:{type:Object}},setup(e){e.reportFilter;const a=[{title:"Units Sold",key:"units_sold",info:d("The total number of units sold in this period.")},{title:"Gross Sale",key:"gross_sale",hasCurrency:!0,info:d("The total sales you had in this period.")},{title:"Refunds",key:"total_refunds",hasCurrency:!0,liability:!0,info:d("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:"Revenue",key:"net_sale",hasCurrency:!0,info:d("Gross sales less refunds, taxes, shipping, fees.")}],l=G(()=>Sl.data.isBusy),n=G(()=>a.map(p=>({key:p.key,title:p.title,value:Sl.data.summary[p.key]||0,fluctuation:Sl.data.fluctuations[p.key]||0,info:p.info,liability:p.liability||!1,hasCurrency:p.hasCurrency||!1}))),i=G(()=>a.filter(p=>p.hasCurrency).map(p=>p.key)),A=p=>i.value.includes(p.key)?Dl(p.value,p.liability):ha(p.value);return(p,m)=>{const _=C("el-tooltip");return l.value?(r(),E(ql,{key:0,loading:l.value,count:n.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:ue(["fct-report-order-summary",l.value?"":"summary-col-4"])},[(r(!0),h(P,null,ae(n.value,(g,y)=>(r(),h("div",{class:"summary-item",key:y},[o("div",Lde,[o("div",Rde,[o("div",Ode,[s(zs,{amount:A(g),title:g.title},null,8,["amount","title"])]),s(yl,{fluctuation:g.fluctuation,amount:c(Sl).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",Pde,[R(f(c(d)(g.title))+" ",1),s(_,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[s(X,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},Nde={class:"fct-product-performance-chart"},Kde={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},Gde={class:"flex items-center gap-3 flex-wrap"},zde={class:"selector-group"},jde={class:"vs-pill inline-flex items-center justify-center px-2 h-6 bg-gray-100 rounded-[12px] font-xs font-medium text-uppercase dark:bg-primary-500"},qde={class:"selector-group"},Yde={key:0,class:"comparison-mode ml-auto inline-flex items-center h-6 px-2.5 bg-gray-50 rounded-[12px] dark:bg-primary-500"},Wde={class:"text-xs font-medium text-gray-500"},Jde={key:1,class:"comparison-mode ml-auto inline-flex items-center h-6 px-2.5 bg-gray-50 rounded-[12px] dark:bg-primary-500"},Xde={class:"text-xs font-medium text-gray-500"},Zde={key:0,class:"comparison-results"},eue={class:"legend flex items-center gap-4 mb-4"},tue={class:"flex items-center"},aue={class:"text-xs text-gray-600"},lue={class:"flex items-center"},sue={class:"text-xs text-gray-600"},nue={class:"comparison-table"},oue={class:"w-full"},iue={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},rue={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},due={class:"w-[40%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},uue={class:"w-[10%] text-right font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},cue={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Aue={class:"py-3"},pue={class:"dual-bar-container"},fue={class:"bar-label"},mue={class:"dual-bar-wrapper"},hue=["onMouseenter"],_ue=["onMouseenter"],vue={class:"py-3 text-right"},gue={key:0},yue={colspan:"3",class:"py-4 text-center text-gray-500"},bue={class:"text-sm"},wue={key:1,class:"current-period-data"},Cue={class:"legend flex items-center gap-4 mb-4"},kue={class:"flex items-center"},Bue={class:"text-xs text-gray-600"},xue={class:"current-period-table"},Sue={class:"w-full"},$ue={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Fue={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Eue={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Uue={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Iue={class:"py-3"},Vue={class:"single-bar-container"},Due=["onMouseenter"],Tue={class:"single-bar-wrapper"},Que=["onMouseenter"],Mue={key:0},Lue={colspan:"2",class:"py-4 text-center text-gray-500"},Rue={class:"text-sm"},Oue={key:2,class:"no-comparison-message"},Pue={class:"flex flex-col items-center justify-center text-center py-8"},Hue={class:"text-gray-500 text-sm"},Nue={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){mm(ie=>({"0b3f8aef":a.value?"#1C2732":"#F9FAFB","0a9a6549":H.value,e9fdd5fc:K.value,"36e9ce8e":W.value}));const t=e,a=M(Re.isDark()),l=M(!0);Te(()=>{i(),t.reportFilter.addListener("product-top-chart",()=>{i()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=Re.isDark()})}),M({});const n=M({}),i=()=>{l.value=!0;const ie=t.reportFilter.applicableFilters;ce.get("reports/product-performance",ie).then(J=>{n.value=J.productPerformance,k(),V(!0)}).finally(()=>l.value=!1)},A=G(()=>!(Array.isArray(n.value)?n.value:Object.values(n.value)).length),p=M(""),m=M(""),_=M(""),g=M(""),y=ie=>ie.sort((J,N)=>at(J.value).diff(at(N.value))),v=M([]),k=()=>{const ie=new Set;Object.keys(n.value).forEach(J=>{const N=J.split("-")[0];ie.add(N)}),v.value=Array.from(ie).sort()},b=ie=>{if(!ie)return[];const J=[];return Object.keys(n.value).forEach(N=>{N.startsWith(ie)&&J.push({value:N,label:at(N).locale(as()).format(Ol("month_long"))})}),y(J)},w=G(()=>{if(!p.value||!_.value)return!1;const ie=!!m.value,J=!!g.value;return!ie&&!J?p.value!==_.value:ie&&J?m.value!==g.value:!0}),B=G(()=>m.value?at(m.value).locale(as()).format(Ol("month_year")):p.value),S=G(()=>g.value?at(g.value).locale(as()).format(Ol("month_year")):_.value),V=(ie=!1)=>{const J=v.value;if(J.length){if(!p.value||ie){p.value=J[0];const N=b(p.value);N.length&&(m.value=N[0].value)}if(!_.value||ie){_.value=J[J.length-1];const N=b(_.value);N.length&&(g.value=N[N.length-1].value)}}},F=ie=>n.value[ie]||[],$=ie=>{const J={};Object.entries(n.value).forEach(([le,ee])=>{le.startsWith(ie)&&ee.forEach(pe=>{J[pe.name]||(J[pe.variation_id]={...pe,value:0}),J[pe.variation_id].value+=pe.value})});const N=[];return Object.values(J).forEach(le=>{N.push(le)}),N},U=(ie,J)=>J?F(J):($(ie),$(ie)),D=G(()=>p.value?[...U(p.value,m.value)].sort((J,N)=>N.value-J.value):[]),T=G(()=>D.value.length?Math.max(...D.value.map(ie=>ie.value))*1.1:100),I=ie=>ie===0||T.value===0?0:ie/T.value*100,L=G(()=>{if(!w.value)return[];const ie=U(p.value,m.value),J=U(_.value,g.value),N=new Set;return ie.forEach(pe=>N.add(pe.variation_id)),J.forEach(pe=>N.add(pe.variation_id)),Array.from(N).map(pe=>{const de=ie.find(ke=>ke.variation_id===pe),Ue=(de==null?void 0:de.value)||0,Ce=J.find(ke=>ke.variation_id===pe),Se=(Ce==null?void 0:Ce.value)||0;let ge=0;return Ue>0?ge=(Se-Ue)/Ue*100:Se>0&&(ge=100),{name:(de==null?void 0:de.name)||(Ce==null?void 0:Ce.name)||"",post_title:(de==null?void 0:de.post_title)||(Ce==null?void 0:Ce.post_title)||"",primaryValue:Ue,comparisonValue:Se,growthRate:parseFloat(ge.toFixed(1))}}).sort((pe,de)=>Math.abs(de.growthRate)-Math.abs(pe.growthRate))}),O=(ie,J)=>{if(ie===0&&J===0)return{primaryWidth:0,comparisonWidth:0};const N=ie+J,le=ie/N*100,ee=J/N*100;return{primaryWidth:le,comparisonWidth:ee}},Q=ie=>ie>0?"positive":ie<0?"negative":"neutral",H=G(()=>a.value?Re.colors.report.dark_cyan_blue_16:Re.colors.report.light_gray),K=G(()=>a.value?Re.colors.report.dark_cyan_blue_36:Re.colors.report.light_gray_cyan_blue),W=G(()=>a.value?"#ffffff":Re.colors.system.mid),z=(ie,J)=>`${ie} ${To("unit","units",ie)} sold in ${J}`,Y=M(!1),Z=M(""),re=M(null);function q(ie,J){re.value=ie.currentTarget,Z.value=J,setTimeout(()=>{Y.value=!0},150)}function Ae(){Y.value=!1}return(ie,J)=>{const N=C("el-skeleton"),le=C("el-option"),ee=C("el-select"),pe=C("el-tooltip");return r(),h("div",Nde,[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),s(Be,{class:"pt-6"},{default:u(()=>[l.value?(r(),E(N,{key:0,animated:"",rows:8})):(r(),h(P,{key:1},[A.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[o("div",Kde,[o("div",Gde,[o("div",zde,[s(ee,{modelValue:p.value,"onUpdate:modelValue":J[0]||(J[0]=de=>p.value=de),placeholder:c(d)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,ae(v.value,de=>(r(),E(le,{key:de,label:de,value:de},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),s(ee,{modelValue:m.value,"onUpdate:modelValue":J[1]||(J[1]=de=>m.value=de),placeholder:c(d)("Month"),size:"small",clearable:"",class:"month-select",disabled:!p.value,"popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,ae(b(p.value),de=>(r(),E(le,{key:de.value,label:de.label,value:de.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",jde,f(c(d)("vs")),1),o("div",qde,[s(ee,{modelValue:_.value,"onUpdate:modelValue":J[2]||(J[2]=de=>_.value=de),placeholder:c(d)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,ae(v.value,de=>(r(),E(le,{key:de,label:de,value:de},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),s(ee,{modelValue:g.value,"onUpdate:modelValue":J[3]||(J[3]=de=>g.value=de),placeholder:c(d)("Month"),size:"small",clearable:"",class:"month-select",disabled:!_.value,"popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,ae(b(_.value),de=>(r(),E(le,{key:de.value,label:de.label,value:de.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),w.value?(r(),h("div",Yde,[o("span",Wde,f(c(d)("Comparing %s with %s",B.value,S.value)),1)])):p.value?(r(),h("div",Jde,[o("span",Xde,f(c(d)("Viewing %s",B.value)),1)])):x("",!0)]),w.value?(r(),h("div",Zde,[o("div",eue,[o("div",tue,[J[5]||(J[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",aue,f(B.value),1)]),o("div",lue,[J[6]||(J[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",sue,f(S.value),1)])]),o("div",nue,[o("table",oue,[o("thead",iue,[o("tr",null,[o("th",rue,f(c(d)("Product")),1),o("th",due,f(c(d)("Sales")),1),o("th",uue,f(c(d)("Change")),1)])]),o("tbody",null,[(r(!0),h(P,null,ae(L.value,(de,Ue)=>(r(),h("tr",{key:Ue,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",cue,[R(f(de.post_title)+" ",1),J[7]||(J[7]=o("br",null,null,-1)),R(" "+f(de.name),1)]),o("td",Aue,[o("div",pue,[o("span",fue,f(de.primaryValue)+f(" vs "+de.comparisonValue)+" "+f(c(d)("Units")),1),o("div",mue,[o("div",{class:"dual-bar-segment primary-segment",style:fa({width:`${O(de.primaryValue,de.comparisonValue).primaryWidth}%`}),onMouseenter:Ce=>q(Ce,z(de.primaryValue,B.value)),onMouseleave:Ae},null,44,hue),o("div",{class:"dual-bar-segment comparison-segment",style:fa({width:`${O(de.primaryValue,de.comparisonValue).comparisonWidth}%`}),onMouseenter:Ce=>q(Ce,z(de.comparisonValue,S.value)),onMouseleave:Ae},null,44,_ue)])])]),o("td",vue,[o("div",{class:ue(["growth-pill",Q(de.growthRate)])},f(de.growthRate>0?"+":"")+f(de.growthRate)+"% ",3)])]))),128)),L.value.length===0?(r(),h("tr",gue,[o("td",yue,[o("span",bue,f(c(d)("No comparison data available")),1)])])):x("",!0)])])])])):p.value&&D.value.length>0?(r(),h("div",wue,[o("div",Cue,[o("div",kue,[J[8]||(J[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",Bue,f(B.value),1)])]),o("div",xue,[o("table",Sue,[o("thead",$ue,[o("tr",null,[o("th",Fue,f(c(d)("Product")),1),o("th",Eue,f(c(d)("Sales")),1)])]),o("tbody",null,[(r(!0),h(P,null,ae(D.value,(de,Ue)=>(r(),h("tr",{key:Ue,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Uue,[R(f(de.post_title)+" ",1),J[9]||(J[9]=o("br",null,null,-1)),R(" "+f(de.name),1)]),o("td",Iue,[o("div",Vue,[o("span",{class:"bar-label",onMouseenter:Ce=>q(Ce,z(de.value,S.value)),onMouseleave:Ae},f(de.value)+" "+f(c(To)("Unit","Units",de.value)),41,Due),o("div",Tue,[o("div",{class:"single-bar-segment",style:fa({width:`${I(de.value)}%`}),onMouseenter:Ce=>q(Ce,z(de.value,S.value)),onMouseleave:Ae},null,44,Que)])])])]))),128)),D.value.length===0?(r(),h("tr",Mue,[o("td",Lue,[o("span",Rue,f(c(d)("No data available for this period")),1)])])):x("",!0)])])])])):(r(),h("div",Oue,[o("div",Pue,[J[10]||(J[10]=o("svg",{class:"w-10 h-10 text-gray-300 mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1)),o("p",Hue,f(c(d)("Please select a time period to view sales data")),1)])])),s(pe,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:Y.value,"onUpdate:visible":J[4]||(J[4]=de=>Y.value=de),content:Z.value,"virtual-ref":re.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},Kue=nt(Nue,[["__scopeId","data-v-ab75a225"]]),Gue={class:"fct-revenue-report-page"},zue={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=p=>{Sl.getProductReportData({params:{...p.params,groupKey:A.value}}),Sl.getTopSoldProducts(p)},l=p=>{A.value!==p&&(A.value=p,a(i))},n=t.reportFilter,i=n.applicableFilters,A=M("default");return Te(()=>{n.addListener("product-report",a),a(i)}),xt(()=>{n.removeListener("product-report",!1)}),(p,m)=>(r(),E(Lt,{permission:"reports/view"},{default:u(()=>[o("div",Gue,[s(Xa,{title:c(d)("Products")},null,8,["title"]),s(Hde,{reportFilter:c(n)},null,8,["reportFilter"]),s(Qde,{chartData:c(Sl).data.currentMetrics,compareData:c(Sl).data.previousMetrics,appliedGroupKey:A.value,reportFilter:t.reportFilter,onFilterData:l,"is-empty":!c(Sl).data.summary.gross_sale,loading:c(Sl).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),s(Td,{data:c(Sl).data.topSoldProducts,loading:c(Sl).data.isBusy},null,8,["data","loading"]),s(Kue,{reportFilter:c(n)},null,8,["reportFilter"])])]),_:1}))}},jue={class:"fct-overview-chart-wrap"},que={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Yue={__name:"OverviewChart",props:{data:{type:Object,required:!0},dataKey:{type:String,required:!0},labelSet:{type:String,default:"monthly"},dateRange:{type:Boolean,default:!1},barMaxWidth:{type:Number,default:30},isEmpty:{type:Boolean,default:!1}},setup(e){const t=e,a=M(null),l=M(null),n=M("bar"),i=M(null),A=Re.colors,p=M(Re.isDark()),m=G(()=>p.value?A.blue[500]+"52":A.blue[300]),_={current:d("Current"),prev:d("Previous"),yoy_growth:d("YoY Growth")},g=G(()=>{try{return Object.keys(t.data).map(V=>({label:V,value:t.data[V][t.dataKey]||0}))}catch(S){return i.value=`Error processing data: ${S.message}`,[]}}),y=G(()=>g.value.length?t.dateRange?g.value.map(S=>{try{const[V,F]=S.label.split("-");return at(`${V}-${F}-01`).locale(as()).format(Ol("month_year"))}catch{return S.label}}):g.value.map(S=>S.label):[]),v=G(()=>g.value.length?[{title:_[t.dataKey]||t.dataKey,data:g.value.map(V=>V.value),color:m.value,yAxisIndex:0}].map(({title:V,data:F,color:$,yAxisIndex:U})=>B(V,n.value,F,$,U)):[]);let k=null;const b=()=>{if(a.value&&k===null)try{k=ca(a.value),w()}catch(S){i.value=`Error initializing chart: ${S.message}`}},w=()=>{if(!k||i.value)return;p.value=Re.isDark();const S={title:{text:"",left:"center"},legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,A.report.dark_cyan_blue_16,A.report.light_gray_cyan_blue,n.value),confine:!0,position:kl,formatter:V=>{let F=V[0].name;const $=p.value?"#ffffff":"#565865";return V.forEach(U=>{const D=Ja(U.value);F+=`<div> |
| 248 |
${U.marker} |
| 249 |
<span style="color: ${$};">${U.seriesName}</span> |
| 250 |
<span style="float: right; margin-left: 20px; color: ${$};"> |
| 251 |
${D} |
| 252 |
</span> |
| 253 |
</div>`}),F}},xAxis:{type:"category",data:y.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:V=>`${_t.formatScaledChart(V)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};try{k.setOption(S,{notMerge:!0,replaceMerge:["series"]})}catch(V){i.value=`Error updating chart: ${V.message}`}},B=(S,V,F,$,U)=>({name:S,type:V,barMaxWidth:t.barMaxWidth,areaStyle:V==="line"?{}:void 0,data:F,smooth:!0,color:$,lineStyle:{width:2},yAxisIndex:U,emphasis:{itemStyle:{color:p.value?A.blue[800]:A.blue[400]}}});return be([()=>t.data,()=>t.dataKey,()=>t.labelSet,n],()=>{$e(w)},{deep:!0}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),k&&(k.dispose(),k=null)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),$e(b)}),(S,V)=>(r(),h("div",jue,[s(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:u(()=>[s(Be,{class:"p-0"},{default:u(()=>[i.value?(r(),h("div",que,f(i.value),1)):x("",!0),e.isEmpty?(r(),E(wt,{key:2,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-overview-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},ko=nt(Yue,[["__scopeId","data-v-2c76289f"]]),Wue={class:"fct-gross-volume-chart-wrap"},Jue={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Xue={__name:"GrossVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""},currentKey:{type:String,default:"current"},prevKey:{type:String,default:"prev"},labelKey:{type:String,default:"yoy_growth"},isDate:{type:Boolean,default:!1},barMaxWidth:{type:Number,default:30},isEmpty:{type:Boolean,default:!1}},setup(e){const t=e,a=M(null),l=M(null),n=M("bar"),i=M(null),A=Re.colors,p=M(Re.isDark()),m={current:d("Current"),prev:d("Previous"),prev_year:d("Previous"),yoy_growth:d("YoY Growth")},_=G(()=>{if(!t.data||typeof t.data!="object")return i.value="Invalid or missing data prop",[];try{return Object.keys(t.data).map(V=>{const F=t.data[V];return{label:V,current:F[t.currentKey]?parseInt(F[t.currentKey]):0,prev:F[t.prevKey]?parseInt(F[t.prevKey]):0,growth:F[t.labelKey]?parseFloat(F[t.labelKey]):0}})}catch(S){return i.value=`Error processing data: ${S.message}`,[]}}),g=G(()=>_.value.length?_.value.map(S=>{if(t.isDate)try{const[V,F]=S.label.split("-");return at(`${V}-${F}-01`).locale(as()).format(Ol("month_year"))}catch{return S.label}else return S.label}):[]),y=G(()=>_.value.length?[{title:m[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:p.value?A.report.blue_dark_mode:A.report.blue},{title:m[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:p.value?A.blue[500]+"52":A.blue[300]}].map(({title:S,dataKey:V,type:F,color:$})=>B(S,F,_.value.map(U=>U[V]),$)):[]),v=G(()=>_.value.length?_.value.map(V=>V.growth):[]);let k=null;const b=()=>{if(a.value&&k===null)try{k=ca(a.value),w()}catch(S){i.value=`Error initializing chart: ${S.message}`}},w=()=>{if(!k||i.value)return;p.value=Re.isDark();const S={legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,A.report.dark_cyan_blue_16,A.report.light_gray_cyan_blue),confine:!0,position:kl,formatter:V=>{let F=V[0].name;const $=p.value?"#ffffff":"#565865",U=v.value[V[0].dataIndex];V.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:d("YoY Growth"),value:isNaN(U)?"N/A":U.toFixed(2)+"%"});const D=p.value?A.report.dark_cyan_blue_16:A.report.light_gray_blue;return V.forEach(function(T,I){const L=I===V.length-1,O=L?T.value:Ja(T.value);L?F+=`<div style="border-top: 1px solid ${D}; margin-top: 5px; padding-top: 5px;">`:F+="<div>",F+=` |
| 254 |
${T.marker} |
| 255 |
<span style="color: ${$};">${T.seriesName}</span> |
| 256 |
<span style="float: right; margin-left: 20px; color: ${$};"> |
| 257 |
${O} |
| 258 |
</span> |
| 259 |
</div>`}),F}},xAxis:{type:"category",data:g.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",name:d("Volume (%s)",_t.currencySign),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:V=>_t.formatScaledChart(V)},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:d("YoY Growth (%)"),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:"{value}%"},splitLine:{show:!1},min:Math.min(...v.value.filter(V=>!isNaN(V)),0)-5,max:Math.max(...v.value.filter(V=>!isNaN(V)),0)+5}],series:y.value};try{k.setOption(S,{notMerge:!0,replaceMerge:["series"]})}catch(V){i.value=`Error updating chart: ${V.message}`}},B=(S,V,F,$,U=0)=>({name:S,type:V,barMaxWidth:t.barMaxWidth,areaStyle:V==="line"?null:void 0,data:F,smooth:V==="line",color:$,lineStyle:V==="line"?{width:2}:void 0,yAxisIndex:U,emphasis:{scale:2,itemStyle:{color:p.value?A.blue[800]:A.blue[400]}}});return be([()=>t.data,n],()=>{$e(w)},{deep:!0}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),k&&(k.dispose(),k=null)}),Te(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),$e(b)}),(S,V)=>(r(),h("div",Wue,[s(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:u(()=>[s(Ve,{title:c(d)(e.title),title_size:"small",border_bottom:""},{action:u(()=>V[0]||(V[0]=[])),_:1},8,["title"]),s(Be,{class:"p-0"},{default:u(()=>[i.value?(r(),h("div",Jue,f(i.value),1)):x("",!0),e.isEmpty?(r(),E(wt,{key:2,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-gross-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Vc=nt(Xue,[["__scopeId","data-v-a0726f58"]]),Zue={class:"fct-country-volume-chart-wrap"},ece={class:"fct-btn-group sm"},tce=.05,ace={__name:"CountryVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=M(null),l=M(null);let n=null;const i=M("bar");M("");const A=M(Re.isDark()),p=G(()=>A.value?["#8FC0F5","#4E90E8","#2E6BC4","#1E4C90","#143562"]:["#9CC9FA","#3E9DF6","#1573D5","#0B57A3","#083C73"]),m=F=>{const $=F.replace("#",""),U=parseInt($.substring(0,2),16),D=parseInt($.substring(2,4),16),T=parseInt($.substring(4,6),16);return(U*299+D*587+T*114)/1e3>150?"#0B3A66":"#ffffff"},_=G(()=>{const F=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!F.length||!F.every($=>!!$)}),g=Re.colors,y=G(()=>{const F=t.data.by_month||{};return Object.keys(F).sort().map(U=>{const D=F[U],T=Object.values(D).reduce((L,O)=>L+O,0),I=Object.entries(D).sort((L,O)=>L[1]-O[1]).reduce((L,[O,Q])=>({...L,[O]:Q}),{});return{label:U,countries:I,total:T}})}),v=G(()=>y.value.length?y.value.map(F=>{try{const[$,U]=F.label.split("-");return at(new Date($,U-1)).locale(as()).format(Ol("month_year"))}catch{return F.label}}):[]),k=G(()=>{const F={};Object.values(t.data.by_month||{}).forEach(D=>{Object.entries(D).forEach(([T,I])=>{F[T]=(F[T]||0)+I})}),Object.entries(t.data.by_countries||{}).forEach(([D,T])=>{F[D]=T});const $=p.value,U=$[$.length-1];return Object.keys(F).sort((D,T)=>F[T]-F[D]).reduce((D,T,I)=>(D[T]=$[I]||U,D),{})}),b=G(()=>y.value.reduce((F,$)=>Math.max(F,$.total),0)),w=G(()=>{const F=t.data.by_month||{},$=new Set;Object.values(F).forEach(T=>{Object.keys(T).forEach(I=>$.add(I))});const U=p.value,D=b.value;return Array.from($).reverse().map(T=>{const I=k.value[T]||U[U.length-1],L=m(I),O=y.value.map(Q=>{const H=Q.countries[T]||0,K=D>0&&H/D>=tce;return{value:H/100,label:{show:H>0&&K,position:"inside",formatter:T,color:L,fontSize:10,fontWeight:"bold"}}});return{name:T,type:i.value,stack:"total",data:O,itemStyle:{color:I},lineStyle:{color:I}}})}),B=()=>{if(!a.value)return;n=ca(a.value);const F={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",textStyle:{color:A.value?g.gray[25]:g.system.mid},borderColor:A.value?"#2C3C4E":"#c0c4ca",axisPointer:Ql(A.value,g.report.dark_cyan_blue_16,g.report.light_gray_cyan_blue,i.value),borderWidth:1,confine:!0,position:kl,formatter:$=>{const U=A.value?"#ffffff":"#565865",D=A.value?g.report.dark_cyan_blue_16:g.report.light_gray_blue,T=y.value[$[0].dataIndex].total;let I=$[0].axisValue;return $.filter(L=>L.value>0).sort((L,O)=>O.value-L.value).forEach(L=>{const O=Ja(L.value*100);I+=` |
| 260 |
<div> |
| 261 |
${L.marker} |
| 262 |
<span style="color: ${U};">${Ps(L.seriesName)}</span> |
| 263 |
<span style="float: right; margin-left: 20px; color: ${U};"> |
| 264 |
${O} |
| 265 |
</span> |
| 266 |
</div>`}),I+=` |
| 267 |
<div style="border-top: 1px solid ${D}; margin-top: 5px; padding-top: 5px;"> |
| 268 |
<span style="color: ${U}; font-weight: 600;">${d("Total")}</span> |
| 269 |
<span style="float: right; margin-left: 20px; color: ${U}; font-weight: 600;"> |
| 270 |
${Ja(T)} |
| 271 |
</span> |
| 272 |
</div>`,I}},xAxis:{type:"category",data:v.value,axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",position:"left",name:d("Volume (%s)",_t.currencySign),axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12,formatter:$=>_t.formatScaled($*100)},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:w.value};n.setOption(F)},S=()=>{A.value=Re.isDark(),$e(()=>{B()})},V=()=>{n&&(n.dispose(),n=null),B()};return Te(()=>{window.addEventListener("onFluentCartThemeChange",S),window.addEventListener("fluentCartCurrencyChange",V),$e(B)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("fluentCartCurrencyChange",V,!1)}),be(()=>A.value,()=>{n&&(n.dispose(),B())}),be(()=>t.data,()=>{n&&B()}),(F,$)=>(r(),h("div",Zue,[s(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:u(()=>[s(Ve,{title:e.title,title_size:"small",border_bottom:""},{action:u(()=>[o("div",ece,[s(mh,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),s(Be,{class:"p-0"},{default:u(()=>[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-country-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Dc=nt(ace,[["__scopeId","data-v-c6534652"]]),lce={class:"fct-card-header-title is-small"},Tc={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=Re.colors.report,l=M(Re.isDark()),n=M(null),i=M("line"),A=M(t.data),p=G(()=>({textColor:l.value?"#ffffff":"#696778",borderColor:l.value?"#2C3C4E":"#c0c4ca",splitLineColor:l.value?"#253241":"#D6DAE1",bgColor:l.value?"#2d3748":"#ffffff"})),m=G(()=>Object.values(A.value).every(w=>w===0)),_=G(()=>Object.keys(A.value)),g=G(()=>[{name:d("Current"),type:i.value,data:Object.values(A.value),smooth:!0,color:l.value?a.purple_dark_mode:a.purple,lineStyle:{width:2},barMaxWidth:30}]);let y=null;const v=()=>{n.value&&!y&&(y=ca(n.value),k())},k=()=>{if(!y)return;const w={legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:p.value.bgColor,borderColor:p.value.borderColor,borderWidth:1,textStyle:{color:p.value.textColor},axisPointer:Ql(l.value,a.dark_cyan_blue_16,a.light_gray_blue,i.value),confine:!0,position:kl,formatter:B=>{let S=Ps(B[0].name);const V=l.value?"#ffffff":"#565865";return B.forEach(F=>{const $=Ja(F.value);S+=`<div> |
| 273 |
${F.marker} |
| 274 |
<span style="color: ${V};">${F.seriesName}</span> |
| 275 |
<span style="float: right; margin-left: 20px; color: ${V};"> |
| 276 |
${$} |
| 277 |
</span> |
| 278 |
</div>`}),S}},xAxis:{type:"category",data:_.value,axisLabel:{color:p.value.textColor,fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:p.value.textColor,fontSize:12,formatter:B=>_t.formatScaled(B)},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:g.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};y.setOption(w,{notMerge:!0,replaceMerge:["series"]})};be([()=>A.value,i,()=>l.value],()=>{$e(k)},{deep:!0});const b=()=>{l.value=Re.isDark(),$e(()=>{k()})};return Te(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",k),$e(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),(w,B)=>(r(),E(xe,null,{default:u(()=>[e.title!==""?(r(),E(Ve,{key:0,border_bottom:!0},{title:u(()=>[o("h3",lce,f(e.title),1)]),_:1})):x("",!0),s(Be,null,{default:u(()=>[m.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap h-[350px]",ref_key:"SubscriptionCountTrendChartRef",ref:n},null,512))]),_:1})]),_:1}))}},sce={class:"fct-overview-report-loader-wrap"},nce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},oce={class:"fct-card-header-title is-small"},ice={class:"flex gap-2 mt-1"},rce={class:"py-6"},dce={class:"grid grid-cols-1"},uce={class:"fct-card-header-title is-small"},cce={class:"py-6"},Ace={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},pce={class:"fct-card-header-title is-small"},fce={class:"flex gap-2 mt-1"},mce={class:"py-6"},hce={class:"grid grid-cols-1"},_ce={class:"fct-card-header-title is-small"},vce={class:"py-6"},gce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},yce={class:"fct-card-header-title is-small"},bce={class:"py-6"},wce={__name:"OverviewLoading",setup(e){const t=[{title:d("Gross Summary"),key:"gross_summary"},{title:d("Gross Revenue Quarterly"),key:"net_summary"}],a=[{title:d("Net Revenue"),key:"net_revenue"},{title:d("Net Revenue Quarterly"),key:"net_revenue_quarterly"}],l=[{title:d("Top Country Gross Volume"),key:"top_country_gross"},{title:d("Top Country Net Volume"),key:"top_country_net"}],n=[{title:d("Top Countries Gross Revenue"),key:"top_country_revenue"},{title:d("Top Countries Net Revenue"),key:"top_country_net_revenue"}];return(i,A)=>{const p=C("el-skeleton-item"),m=C("el-skeleton");return r(),h("div",sce,[o("div",nce,[(r(),h(P,null,ae(t,(_,g)=>o("div",{key:g},[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:!0},{title:u(()=>[o("h3",oce,f(_.title),1),o("div",ice,[s(m,{animated:""},{template:u(()=>[s(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",rce,[s(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",dce,[(r(),h(P,null,ae(2,_=>o("div",{key:_},[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(m,{animated:""},{template:u(()=>[s(p,{variant:"p",class:"w-2/3"})]),_:1}),s(Ve,{border_bottom:!0},{title:u(()=>[o("h2",uce,f(c(d)("Gross Volume Breakdown")),1)]),_:1}),o("div",cce,[s(m,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",Ace,[(r(),h(P,null,ae(a,(_,g)=>o("div",{key:g},[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:!0},{title:u(()=>[o("h3",pce,f(_.title),1),o("div",fce,[s(m,{animated:""},{template:u(()=>[s(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",mce,[s(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",hce,[(r(),h(P,null,ae(l,(_,g)=>o("div",{key:g},[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:!0},{title:u(()=>[o("h2",_ce,f(_.title),1)]),_:2},1024),o("div",vce,[s(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",gce,[(r(),h(P,null,ae(n,(_,g)=>o("div",{key:g},[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:!0},{title:u(()=>[o("h3",yce,f(_.title),1)]),_:2},1024),o("div",bce,[s(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},Cce={class:"overview-summary-report-inline"},kce={class:"inner-value"},Bce={__name:"Summary",props:{title:{type:String},current:{type:[String,Number],required:!0},previous:{type:[String,Number],required:!0},fluctuation:{type:[String,Number],required:!0}},setup(e){return(t,a)=>(r(),h("div",Cce,[o("div",kce,[s(zs,{amount:c(_t).formatScaled(e.current),title:c(d)(e.title)},null,8,["amount","title"])]),s(yl,{fluctuation:e.fluctuation,amount:e.previous/100,fluctuationSuffix:c(d)("YoY")},null,8,["fluctuation","amount","fluctuationSuffix"])]))}},Bo=nt(Bce,[["__scopeId","data-v-b394c9f1"]]),xce={class:"report-overview-page"},Sce={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},$ce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Fce={class:"fct-card-header-title is-small"},Ece={class:"fct-card-header-title is-small"},Uce={class:"grid grid-cols-1"},Ice=["innerHTML"],Vce=["innerHTML"],Dce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Tce={class:"fct-card-header-title is-small"},Qce={class:"fct-card-header-title is-small"},Mce={class:"grid gap-4 grid-cols-1"},Lce={class:"grid gap-4 grid-cols-1"},Rce={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},Oce={__name:"Overview",setup(e){const t=M({}),a=M(!0),l=M({gross_revenue_quarterly:{},net_revenue_quarterly:{}}),n=()=>{ce.get("reports/overview").then(p=>{t.value=p.data,i()}).catch(p=>{}).finally(()=>{a.value=!1})},i=()=>{l.value.gross_revenue_quarterly=A(t.value.gross_revenue_quarterly,"current","prev_year"),l.value.net_revenue_quarterly=A(t.value.net_revenue_quarterly,"current","prev_year")},A=(p,m="current",_="prev")=>{const g=dt.sum(p,"*."+m),y=dt.sum(p,"*."+_),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return G(()=>{var p,m;return((p=t.value.gross_summary)==null?void 0:p.yoy_growth)<0?"danger":((m=t.value.gross_summary)==null?void 0:m.yoy_growth)===null?"warning":"success"}),Te(()=>{n()}),(p,m)=>(r(),h("div",xce,[o("div",Sce,[s(X,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(c(d)("Last %s Months",c(d)(12))),1)]),a.value?(r(),E(wce,{key:0})):(r(),h(P,{key:1},[o("div",$ce,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:""},{title:u(()=>[o("h3",Fce,f(c(d)("Gross Summary")),1),s(Bo,{current:t.value.gross_summary.total,previous:t.value.gross_summary.total_prev,fluctuation:t.value.gross_summary.yoy_growth},null,8,["current","previous","fluctuation"])]),_:1}),s(ko,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:""},{title:u(()=>[o("h3",Ece,f(c(d)("Gross Revenue Quarterly")),1),s(Bo,{current:l.value.gross_revenue_quarterly.current,previous:l.value.gross_revenue_quarterly.prev,fluctuation:l.value.gross_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),s(ko,{data:t.value.gross_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!l.value.gross_revenue_quarterly.current},null,8,["data","is-empty"])]),_:1})]),_:1})]),o("div",Uce,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[o("div",{class:"mb-3",innerHTML:c(_t).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,Ice),s(Vc,{title:c(d)("Gross Volume Breakdown"),data:t.value.gross_revenue,dataKey:"current","is-date":"","is-empty":!t.value.gross_summary.total},null,8,["title","data","is-empty"])]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[o("div",{class:"mb-3",innerHTML:c(_t).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,Vce),s(Vc,{title:c(d)("Gross Revenue Breakdown"),data:t.value.gross_revenue_quarterly,dataKey:"current",prevKey:"prev_year",labelKey:"yy_growth","bar-max-width":80,"is-empty":!t.value.gross_summary.total},null,8,["title","data","is-empty"])]),_:1})]),_:1})]),o("div",Dce,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:!0},{title:u(()=>[o("h3",Tce,f(c(d)("Net Revenue")),1),s(Bo,{title:c(d)("Net Revenue"),current:t.value.net_summary.total,previous:t.value.net_summary.total_prev,fluctuation:t.value.net_summary.yoy_growth},null,8,["title","current","previous","fluctuation"])]),_:1}),s(ko,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Ve,{border_bottom:!0},{title:u(()=>[o("h3",Qce,f(c(d)("Net Revenue Quarterly")),1),s(Bo,{title:c(d)("Net Revenue Quarterly"),current:l.value.net_revenue_quarterly.current,previous:l.value.net_revenue_quarterly.prev,fluctuation:l.value.net_revenue_quarterly.value},null,8,["title","current","previous","fluctuation"])]),_:1}),s(ko,{data:t.value.net_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1})]),o("div",Mce,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Dc,{data:t.value.top_country_gross,title:c(d)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Lce,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[s(Dc,{data:t.value.top_country_net,title:c(d)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Rce,[s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>{var _;return[s(Tc,{data:(_=t.value.top_country_gross)==null?void 0:_.by_countries,title:c(d)("Top Countries Gross Revenue")},null,8,["data","title"])]}),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>{var _;return[s(Tc,{data:(_=t.value.top_country_net)==null?void 0:_.by_countries,title:c(d)("Top Countries Net Revenue")},null,8,["data","title"])]}),_:1})]),_:1})])],64))]))}},Pce={class:"setting-wrap"},Hce={class:"setting-wrap-inner"},Nce={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},Kce={class:"grid gap-3 mb-6"},Gce={class:"grid gap-3 mb-6"},zce={class:"grid gap-3 mb-6"},jce={class:"grid gap-3"},qce={class:"payment-method-list fct-content-card-list"},Yce=["id"],Wce={class:"flex items-start gap-3"},Jce={class:"grid gap-2 flex-1"},Xce={key:0,class:"fct-content-card-list-head stripe"},Zce=["src","alt"],eAe=["src","alt"],tAe={class:"block font-semibold text-system-dark dark:text-gray-50"},aAe={class:"fct-content-card-list-content"},lAe={class:"fct-content-card-list-action flex items-center gap-2"},sAe={key:0},nAe=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=pf(),{form:a}=t.data,l=Ss(),n=M([]),i=M([]),A=M(!0),p=M(!1),m=M(!0),_=M({}),g=M(!1),y=M({}),v=M(!1),k=M(""),b=M(""),w=M(""),B=G(()=>Object.keys(y.value).length>0),S=()=>{p.value=!0;let T=a.values;ce.post("settings/modules",{...T}).then(I=>{j.success(d("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(I=>{if(I&&I.message)return j.error(I);_.value=I}).finally(()=>{p.value=!1,m.value=!1,A.value=!1})},V=()=>{A.value=!0,ce.get("settings/modules",{}).then(T=>{var O,Q;a.setSchema(T.fields).setDefaults(T.settings).initForm(),n.value=T.settings,i.value=T.fields,m.value=!1,p.value=!1;const I=((Q=(O=T.fields)==null?void 0:O.modules_settings)==null?void 0:Q.schema)||[];let L=!1;Array.isArray(I)?L=I.length>0:L=Object.keys(I).length>0,g.value=L}).finally(()=>{A.value=!1})},F=()=>{v.value=!0,ce.get("settings/modules/plugin-addons",{}).then(T=>{y.value=T.addons||{},w.value&&$e(()=>Rs.scrollToHashSection(w.value))}).catch(T=>{j.error(T)}).finally(()=>{v.value=!1})},$=Ke.get("app_config.isProActive"),U=(T,I)=>{if(!$){window.open(T.repo_link,"_blank","noopener,noreferrer");return}k.value=I,ce.post("settings/modules/plugin-addons/install",{plugin_slug:T.plugin_slug,source_type:T.source_type||"wordpress",source_link:T.source_link||"",asset_path:T.asset_path||""}).then(L=>{L.action==="copy"&&L.url?(ns.copy(L.url,{successMessage:d("Download link copied to your clipboard")}),window.open(L.url,"_blank","noopener,noreferrer")):L.action==="reload"?(j.success(L.message||d("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):j.success(L.message||d("Addon installed successfully"))}).catch(L=>{j.error(L)}).finally(()=>{k.value=""})},D=(T,I)=>{b.value=I,ce.post("settings/modules/plugin-addons/activate",{plugin_file:T.plugin_file}).then(L=>{j.success(L.message||d("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(L=>{j.error(L)}).finally(()=>{b.value=""})};return Te(()=>{const T=window.location.hash||"",I=T.lastIndexOf("#");I>0&&(w.value=T.substring(I+1)),V(),F()}),l.onSave(S),(T,I)=>{const L=C("el-skeleton-item"),O=C("el-skeleton"),Q=C("el-form"),H=C("el-button"),K=C("el-icon"),W=C("router-link");return r(),h("div",Pce,[s($a,{heading:c(d)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",Hce,[s(Fa),m.value?(r(),h("div",Nce,[s(O,{loading:m.value,animated:""},{template:u(()=>[o("div",Kce,[s(L,{variant:"p",class:"w-[20%]"}),s(L,{variant:"p"})]),o("div",Gce,[s(L,{variant:"p",class:"w-[20%]"}),s(L,{variant:"p"})]),o("div",zce,[s(L,{variant:"p",class:"w-[20%]"}),s(L,{variant:"p"})]),o("div",jce,[s(L,{variant:"p",class:"w-[20%]"}),s(L,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),m.value?x("",!0):(r(),h(P,{key:1},[c(a).isReady?(r(),E(Q,{key:0},{default:u(()=>[g.value?(r(),E(Ii,{key:0,form:c(a),showSubmitButton:!0,onOnSubmitButtonClick:S,submitButtonText:c(d)("Save Settings"),loading:p.value,onOnChange:I[0]||(I[0]=z=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):B.value?x("",!0):(r(),E(xe,{key:1},{default:u(()=>[s(Ve,{title:c(d)("Features & addon"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(wt,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:c(d)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):x("",!0),B.value?(r(),E(xe,{key:1,class:"mt-6"},{default:u(()=>[s(Ve,{title:c(d)("Plugin Addons"),border_bottom:""},null,8,["title"]),s(Be,{class:"py-0"},{default:u(()=>[o("div",qce,[(r(!0),h(P,null,ae(y.value,(z,Y)=>(r(),h("div",{key:Y,class:"fct-content-card-list-item",id:z.plugin_slug===w.value?w.value:null},[o("div",Wce,[o("div",Jce,[z.logo?(r(),h("div",Xce,[o("img",{class:ue({"dark:hidden":z.dark_logo}),src:z.logo,alt:z.title},null,10,Zce),z.dark_logo?(r(),h("img",{key:0,src:z.dark_logo,alt:z.title,class:"hidden dark:block"},null,8,eAe)):x("",!0),o("span",tAe,f(z.title),1),z.is_active?(r(),E(Ht,{key:1,status:"active",text:c(d)("Active")},null,8,["text"])):x("",!0)])):x("",!0),o("div",aAe,[o("p",null,f(z.description),1)])]),o("div",lAe,[z.upcoming?(r(),h("div",sAe,f(c(d)("Coming Soon")),1)):(r(),h(P,{key:1},[z.is_installed?z.is_installed&&!z.is_active&&(c($)||z.source_type!=="github")?(r(),E(H,{key:1,type:"success",size:"small",loading:b.value===Y,disabled:b.value===Y,onClick:Z=>D(z,Y)},{default:u(()=>[R(f(c(d)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):x("",!0):(r(),E(H,{key:0,type:"primary",size:"small",loading:k.value===Y,disabled:k.value===Y,onClick:Z=>U(z,Y)},{default:u(()=>[R(f(c($)?c(d)("Install & Activate"):c(d)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),z.is_active&&Y==="fluent-pdf"?(r(),E(W,{key:2,to:{path:"/settings/pdf-template"}},{default:u(()=>[s(K,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:u(()=>[s(c(rA))]),_:1})]),_:1})):x("",!0)],64))])])],8,Yce))),128))])]),_:1})]),_:1})):x("",!0)],64))])])}}}),oAe=nt(nAe,[["__scopeId","data-v-a315b5d5"]]),iAe={class:"form-note"},rAe={class:"form-note"},dAe={class:"form-note"},uAe={class:"form-note"},cAe={class:"el-form-item__label"},AAe={class:"h-[297px] w-full relative"},pAe={class:"mt-2 mb-2"},fAe={class:"form-note"},mAe={class:"fct-powered-by-email-footer-checkbox mb-4 pb-4 border-[1px] border-l-0 border-t-0 border-r-0 border-solid border-gray-outline dark:border-dark-400"},hAe={class:"setting-html-wrapper"},_Ae={class:"setting-label"},vAe={class:"form-note"},gAe={class:"setting-fields-inner w-full"},yAe={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton"),i=C("el-form-item"),A=C("el-col"),p=C("el-row");return r(),E(Be,null,{default:u(()=>[s(p,{gutter:15},{default:u(()=>[s(A,{lg:12},{default:u(()=>[s(i,{label:c(d)("From Name"),"label-position":"top"},{default:u(()=>[s(n,{animated:"",class:"h-9 gap-2"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"})]),_:1}),a[0]||(a[0]=o("br",null,null,-1)),o("div",null,[o("div",iAe,[o("p",null,f(c(d)("Name that will be used to send emails")),1)])])]),_:1,__:[0]},8,["label"])]),_:1}),s(A,{lg:12},{default:u(()=>[s(i,{label:c(d)("From Email"),"label-position":"top"},{default:u(()=>[s(n,{animated:"",class:"h-9"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",rAe,[o("p",null,f(c(d)(`Provide Valid Email Address email as per your domain/SMTP settings. This |
| 279 |
email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),s(p,{gutter:15},{default:u(()=>[s(A,{lg:12},{default:u(()=>[s(i,{label:c(d)("Reply to name (Optional)"),"label-position":"top"},{default:u(()=>[s(n,{animated:"",class:"h-9"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",dAe,[o("p",null,f(c(d)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),s(A,{lg:12},{default:u(()=>[s(i,{label:c(d)("Reply to email (Optional)"),"label-position":"top"},{default:u(()=>[s(n,{animated:"",class:"h-9"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",uAe,[o("p",null,f(c(d)(`If someone replies to your notification email, this is where you would like to |
| 280 |
receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),s(p,{gutter:15},{default:u(()=>[s(A,null,{default:u(()=>[o("div",cAe,f(c(d)("Email Footer")),1),o("div",AAe,[s(n,{animated:"",rows:7})]),o("div",pAe,[o("div",fAe,[o("p",null,f(c(d)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for |
| 281 |
compliance.`)),1)])]),o("div",mAe,[s(n,{animated:"",class:"h-5"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1}),s(p,{gutter:15},{default:u(()=>[s(A,null,{default:u(()=>[s(i,null,{default:u(()=>[s(p,{gutter:15,class:"w-full"},{default:u(()=>[s(A,{lg:12},{default:u(()=>[o("div",hAe,[o("span",_Ae,f(c(d)("Admin Email Address")),1),o("div",vAe,[o("p",null,f(c(d)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),s(A,{lg:12},{default:u(()=>[o("div",gAe,[s(n,{animated:"",class:"h-9"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},bAe={class:"setting-wrap"},wAe={class:"setting-wrap-inner"},CAe={class:"form-note"},kAe={class:"form-note"},BAe={class:"form-note"},xAe={class:"form-note"},SAe={class:"el-form-item__label"},$Ae={class:"mt-2 mb-2"},FAe={class:"form-note"},EAe={class:"fct-powered-by-email-footer-checkbox"},UAe={class:"setting-html-wrapper"},IAe={class:"setting-label"},VAe={class:"form-note"},DAe={class:"setting-fields-inner w-full"},TAe={class:"setting-save-action"},QAe={__name:"MailingSettings",setup(e){const t=M({from_name:"",from_email:"",reply_to_name:"",reply_to_email:"",email_footer:"",show_email_footer:"yes",admin_email:"{{wp.admin_email}}"}),a=Ke.get("app_config.isProActive"),l=M(!1),n=M({}),i=M({}),A=()=>{l.value=!0,ce.get("email-notification/get-settings").then(m=>{var _,g,y,v,k,b,w;t.value={from_name:(_=m.data)==null?void 0:_.from_name,from_email:(g=m.data)==null?void 0:g.from_email,reply_to_name:(y=m.data)==null?void 0:y.reply_to_name,reply_to_email:(v=m.data)==null?void 0:v.reply_to_email,email_footer:(k=m.data)==null?void 0:k.email_footer,admin_email:(b=m.data)==null?void 0:b.admin_email,show_email_footer:((w=m.data)==null?void 0:w.show_email_footer)||"yes"},i.value=m.shortcodes}).catch(m=>{}).finally(()=>{l.value=!1})},p=()=>{l.value=!0,n.value={},ce.post("email-notification/save-settings",t.value).then(m=>{j.success(m.message)}).catch(m=>{m.status_code===422&&m.data?n.value=m.data:m.message?j.error(m.message):(j.error(d("Something went wrong")),n.value=m)}).finally(()=>{l.value=!1})};return Te(()=>{A()}),(m,_)=>{const g=C("el-input"),y=C("el-form-item"),v=C("el-col"),k=C("el-row"),b=C("el-tooltip"),w=C("el-checkbox"),B=C("el-button");return r(),h("div",bAe,[s($a,{heading:c(d)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",wAe,[s(Fa),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Email Configuration"),text:c(d)("Set your from name, email, and email footer. These configurations will be used to send emails from %s.","FluentCart"),border_bottom:""},null,8,["title","text"]),l.value?(r(),E(yAe,{key:0})):(r(),E(Be,{key:1},{default:u(()=>[s(k,{gutter:15},{default:u(()=>[s(v,{lg:12},{default:u(()=>[s(y,{label:c(d)("From Name"),"label-position":"top"},{default:u(()=>[s(g,{modelValue:t.value.from_name,"onUpdate:modelValue":_[0]||(_[0]=S=>t.value.from_name=S)},null,8,["modelValue"]),_[9]||(_[9]=o("br",null,null,-1)),o("div",null,[s(gl,{"validation-errors":n.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),o("div",CAe,[o("p",null,f(c(d)("Name that will be used to send emails")),1)])])]),_:1,__:[9]},8,["label"])]),_:1}),s(v,{lg:12},{default:u(()=>[s(y,{label:c(d)("From Email"),"label-position":"top"},{default:u(()=>[s(g,{modelValue:t.value.from_email,"onUpdate:modelValue":_[1]||(_[1]=S=>t.value.from_email=S)},null,8,["modelValue"]),o("div",null,[s(gl,{"validation-errors":n.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),o("div",kAe,[o("p",null,f(c(d)(`Provide Valid Email Address email as per your domain/SMTP settings. This |
| 282 |
email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),s(k,{gutter:15},{default:u(()=>[s(v,{lg:12},{default:u(()=>[s(y,{label:c(d)("Reply to name (Optional)"),"label-position":"top"},{default:u(()=>[s(g,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":_[2]||(_[2]=S=>t.value.reply_to_name=S)},null,8,["modelValue"]),o("div",BAe,[o("p",null,f(c(d)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),s(v,{lg:12},{default:u(()=>[s(y,{label:c(d)("Reply to email (Optional)"),"label-position":"top"},{default:u(()=>[s(g,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":_[3]||(_[3]=S=>t.value.reply_to_email=S)},null,8,["modelValue"]),o("div",null,[s(gl,{"validation-errors":n.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),o("div",xAe,[o("p",null,f(c(d)(`If someone replies to your notification email, this is where you would like to |
| 283 |
receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),s(k,{gutter:15},{default:u(()=>[s(v,null,{default:u(()=>[o("div",SAe,f(c(d)("Email Footer")),1),s(os,{"short-codes":i.value,modelValue:t.value.email_footer,"onUpdate:modelValue":_[4]||(_[4]=S=>t.value.email_footer=S),onUpdate:_[5]||(_[5]=S=>{t.value.email_footer=S})},null,8,["short-codes","modelValue"]),o("div",$Ae,[s(gl,{"validation-errors":n.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",FAe,[o("p",null,f(c(d)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for |
| 284 |
compliance.`)),1)])]),o("div",EAe,[s(w,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":_[6]||(_[6]=S=>t.value.show_email_footer=S),"true-value":"yes","false-value":"no",disabled:!c(a)},{default:u(()=>[R(f(c(d)("Enable powered by FluentCart in the email footer"))+" ",1),c(a)?x("",!0):(r(),E(b,{key:0,"popper-class":"fct-tooltip",placement:"top"},{content:u(()=>[R(f(c(d)("This feature is available in pro version only.")),1)]),default:u(()=>[s(X,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),s(k,{gutter:15},{default:u(()=>[s(v,null,{default:u(()=>[s(y,null,{default:u(()=>[s(k,{gutter:15,class:"w-full"},{default:u(()=>[s(v,{lg:12},{default:u(()=>[o("div",UAe,[o("span",IAe,f(c(d)("Admin Email Address")),1),o("div",VAe,[o("p",null,f(c(d)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),s(v,{lg:12},{default:u(()=>[o("div",DAe,[s(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":_[7]||(_[7]=S=>t.value.admin_email=S)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),o("div",TAe,[s(B,{type:"primary",onClick:_[8]||(_[8]=S=>p()),loading:l.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},MAe={class:"setting-wrap"},LAe={class:"setting-wrap-inner"},RAe={class:"form-note"},OAe={class:"form-note"},PAe={class:"form-note",style:{"padding-top":"6px"}},HAe={class:"form-note"},NAe={class:"setting-save-action"},Qc="{{wp.admin_email}}",KAe={__name:"StoreDigestSettings",setup(e){const t=M({recipients:"{{wp.admin_email}}",send_when_empty:"no",daily:{enabled:"no",send_hour:8},weekly:{enabled:"no",send_hour:8,send_dow:1},monthly:{enabled:"no",send_hour:8}}),a=M(!1),l=M({}),n=M(""),i=[{key:"daily",label:d("Daily digest"),desc:d("Yesterday's performance, sent every morning.")},{key:"weekly",label:d("Weekly digest"),desc:d("The previous 7 days, sent on your chosen day.")},{key:"monthly",label:d("Monthly digest"),desc:d("The previous calendar month, sent on the 1st.")}],A=d("Comma-separate multiple addresses. %1$s resolves to the site admin email.",Qc),p=G(()=>{const v=[];for(let k=0;k<24;k++)v.push({value:k,label:String(k).padStart(2,"0")+":00"});return v}),m=[{value:1,label:d("Monday")},{value:2,label:d("Tuesday")},{value:3,label:d("Wednesday")},{value:4,label:d("Thursday")},{value:5,label:d("Friday")},{value:6,label:d("Saturday")},{value:7,label:d("Sunday")}],_=()=>{a.value=!0,ce.get("email-notification/digest-settings").then(v=>{v.data&&(t.value=v.data)}).catch(()=>{}).finally(()=>{a.value=!1})},g=()=>{a.value=!0,l.value={},ce.post("email-notification/digest-settings",t.value).then(v=>{j.success(v.message)}).catch(v=>{v.status_code===422&&v.data?l.value=v.data:v.message?j.error(v.message):j.error(d("Something went wrong"))}).finally(()=>{a.value=!1})},y=v=>{n.value=v,ce.post("email-notification/digest-settings/send-test",{frequency:v}).then(k=>{j.success(k.message)}).catch(k=>{j.error(k.message||d("Could not send the test email."))}).finally(()=>{n.value=""})};return Te(()=>{_()}),(v,k)=>{const b=C("el-input"),w=C("el-form-item"),B=C("el-col"),S=C("el-checkbox"),V=C("el-row"),F=C("el-switch"),$=C("el-option"),U=C("el-select"),D=C("el-button");return r(),h("div",MAe,[s($a,{heading:c(d)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",LAe,[s(Fa),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Recipients & General"),text:c(d)("A system email summarising your store activity. Numbers match the Reports dashboard."),border_bottom:""},null,8,["title","text"]),s(Be,null,{default:u(()=>[s(V,{gutter:15},{default:u(()=>[s(B,{lg:12},{default:u(()=>[s(w,{label:c(d)("Recipient email addresses"),"label-position":"top"},{default:u(()=>[s(b,{modelValue:t.value.recipients,"onUpdate:modelValue":k[0]||(k[0]=T=>t.value.recipients=T),placeholder:Qc},null,8,["modelValue"]),o("div",null,[s(gl,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",RAe,[o("p",null,f(c(A)),1)])])]),_:1},8,["label"])]),_:1}),s(B,{lg:12},{default:u(()=>[s(w,{label:c(d)("Empty periods"),"label-position":"top"},{default:u(()=>[s(S,{modelValue:t.value.send_when_empty,"onUpdate:modelValue":k[1]||(k[1]=T=>t.value.send_when_empty=T),"true-value":"yes","false-value":"no"},{default:u(()=>[R(f(c(d)("Send even when there was no activity")),1)]),_:1},8,["modelValue"]),o("div",OAe,[o("p",null,f(c(d)("When off, a digest is skipped for any period with no paid orders.")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),(r(),h(P,null,ae(i,T=>s(xe,{key:T.key,class:"fct-mt-4"},{default:u(()=>[s(Ve,{title:T.label,text:T.desc,border_bottom:""},null,8,["title","text"]),s(Be,null,{default:u(()=>[s(V,{gutter:15,align:"middle"},{default:u(()=>[s(B,{lg:6},{default:u(()=>[s(w,{label:c(d)("Enable"),"label-position":"top"},{default:u(()=>[s(F,{modelValue:t.value[T.key].enabled,"onUpdate:modelValue":I=>t.value[T.key].enabled=I,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),s(B,{lg:6},{default:u(()=>[s(w,{label:c(d)("Send time"),"label-position":"top"},{default:u(()=>[s(U,{modelValue:t.value[T.key].send_hour,"onUpdate:modelValue":I=>t.value[T.key].send_hour=I,class:"w-full"},{default:u(()=>[(r(!0),h(P,null,ae(p.value,I=>(r(),E($,{key:I.value,label:I.label,value:I.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),T.key==="weekly"?(r(),E(B,{key:0,lg:6},{default:u(()=>[s(w,{label:c(d)("Day of week"),"label-position":"top"},{default:u(()=>[s(U,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":k[2]||(k[2]=I=>t.value.weekly.send_dow=I),class:"w-full"},{default:u(()=>[(r(),h(P,null,ae(m,I=>s($,{key:I.value,label:I.label,value:I.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):x("",!0),T.key==="monthly"?(r(),E(B,{key:1,lg:6},{default:u(()=>[s(w,{label:c(d)("Send day"),"label-position":"top"},{default:u(()=>[o("div",PAe,[o("p",null,f(c(d)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):x("",!0),s(B,{lg:6},{default:u(()=>[s(w,{label:" ","label-position":"top"},{default:u(()=>[s(D,{loading:n.value===T.key,onClick:I=>y(T.key),class:"mt-2"},{default:u(()=>[R(f(c(d)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),o("div",HAe,[o("p",null,f(c(d)("Send time is in your store timezone. Test emails use your saved recipients.")),1)])]),_:2},1024)]),_:2},1024)),64)),o("div",NAe,[s(D,{type:"primary",onClick:k[3]||(k[3]=T=>g()),loading:a.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},GAe={};function zAe(e,t){const a=C("router-view");return r(),h("div",null,[s(a)])}const jAe=nt(GAe,[["render",zAe]]),qAe={},YAe={class:"fct-setting-form-row"},WAe={class:"w-[300px]"},JAe={class:"flex-grow flex-shrink flex-basis-0 self-center"},XAe={class:"fct-setting-form-row"},ZAe={class:"w-[300px]"},epe={class:"flex-grow flex-shrink flex-basis-0 self-center"},tpe={class:"fct-setting-form-row"},ape={class:"w-[300px]"},lpe={class:"flex-grow flex-shrink flex-basis-0 self-center"};function spe(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",null,[o("div",YAe,[o("div",WAe,[s(l,{animated:"",class:"max-w-[70%]"},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1}),s(l,{animated:"",class:"max-w-[80%]"},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"}),s(a,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),o("div",JAe,[s(l,{animated:""},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",XAe,[o("div",ZAe,[s(l,{animated:"",class:"max-w-[60%]"},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1}),s(l,{animated:"",class:"max-w-full"},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",epe,[s(l,{animated:""},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",tpe,[o("div",ape,[s(l,{animated:"",class:"max-w-[50%]"},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1}),s(l,{animated:"",class:"max-w-full"},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",lpe,[s(l,{animated:""},{template:u(()=>[s(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const npe=nt(qAe,[["render",spe]]),ope={name:"TaxConfigurations",components:{TaxConfigurationsLoader:npe,CardContainer:xe,CardBody:Be,CardHeader:Ve,LabelHint:Ot,SettingsHeader:$a,AdminNotice:Fa,Animation:ma},data(){return{settings:{enable_tax:"no",tax_inclusion:"included",tax_calculation_basis:"shipping",tax_rounding:"item",checkout_tax_breakdown_display:"itemized",tax_display_label:"Tax",price_suffix_included:"",price_suffix_excluded:"",eu_vat_settings:{require_vat_number:"no",local_reverse_charge:"yes",reverse_charge_price_mode:"fixed",vat_reverse_excluded_categories:[]}},tax_settings_changed:!1,saving:!1,loading:!1,categories:[],fetchingCategories:!1,keyboardShortcuts:null}},computed:{handlePriceMode(){return this.settings.eu_vat_settings.local_reverse_charge=="yes"}},mounted(){this.bindSaveShortcut(),this.getSettings(),this.fetchCategories()},beforeUnmount(){this.unbindSaveShortcut()},methods:{translate:d,saveSettings(){this.saving||this.loading||(this.saving=!0,this.$post("tax/configuration/settings",{settings:this.settings}).then(e=>{this.handleSuccess(e.message),this.tax_settings_changed=!0,Ke.mergeConfig({is_tax_enabled:this.settings.enable_tax==="yes"})}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message),this.saving=!1}).finally(()=>{this.saving=!1}))},getSettings(){this.loading=!0,this.$get("tax/configuration/settings").then(e=>{if(this.settings=e.settings,this.settings.eu_vat_settings={require_vat_number:"no",local_reverse_charge:"yes",reverse_charge_price_mode:"fixed",vat_reverse_excluded_categories:[],...this.settings.eu_vat_settings||{}},["itemized","simplified"].includes(this.settings.checkout_tax_breakdown_display)||(this.settings.checkout_tax_breakdown_display="itemized"),this.settings.tax_display_label||(this.settings.tax_display_label="Tax"),!Array.isArray(this.settings.eu_vat_settings.vat_reverse_excluded_categories))this.settings.eu_vat_settings.vat_reverse_excluded_categories=[];else{let t=this.settings.eu_vat_settings.vat_reverse_excluded_categories.map(a=>a.toString());this.settings.eu_vat_settings.vat_reverse_excluded_categories=t}}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},fetchCategories(){this.categories.length>0||(this.fetchingCategories=!0,this.$get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms||[]}).catch(()=>{}).finally(()=>{this.fetchingCategories=!1}))},bindSaveShortcut(){this.keyboardShortcuts=As(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.saveSettings()})},unbindSaveShortcut(){var e;(e=this.keyboardShortcuts)!=null&&e.unbind&&this.keyboardShortcuts.unbind("mod+s")}}},ipe={class:"setting-wrap"},rpe={class:"setting-wrap-inner"},dpe={class:"fct-setting-form-row"},upe={class:"fct-setting-form-content flex gap-3.5 flex-1"},cpe={class:"fct-inline-tip"},Ape={key:1},ppe={class:"fct-setting-form-row"},fpe={class:"fct-setting-form-content"},mpe={class:"fct-inline-tip"},hpe={class:"fct-setting-form-fields self-center"},_pe={class:"fct-inline-tip mt-2"},vpe={class:"fct-setting-form-row"},gpe={class:"fct-setting-form-content"},ype={class:"fct-inline-tip"},bpe={class:"fct-setting-form-fields self-center"},wpe={class:"flex flex-col"},Cpe={class:"price-mode-label"},kpe={class:"price-mode-text"},Bpe={class:"flex flex-col"},xpe={class:"price-mode-label"},Spe={class:"price-mode-text"},$pe={class:"fct-setting-form-row"},Fpe={class:"fct-setting-form-content"},Epe={class:"fct-inline-tip"},Upe={class:"fct-setting-form-fields self-center"},Ipe={class:"fct-setting-form-row"},Vpe={class:"fct-setting-form-content"},Dpe={class:"fct-inline-tip"},Tpe={class:"fct-setting-form-fields self-center"},Qpe={class:"fct-setting-form-row"},Mpe={class:"fct-setting-form-content"},Lpe={class:"fct-inline-tip"},Rpe={class:"fct-setting-form-fields self-center"},Ope={class:"fct-setting-form-row"},Ppe={class:"fct-setting-form-content"},Hpe={class:"fct-inline-tip"},Npe={class:"fct-setting-form-fields self-center"},Kpe={key:0,class:"fct-setting-form-row"},Gpe={class:"fct-setting-form-content"},zpe={class:"fct-inline-tip"},jpe={class:"fct-setting-form-fields self-center"},qpe={class:"fct-setting-form-row"},Ype={class:"fct-setting-form-content"},Wpe={class:"fct-inline-tip"},Jpe={class:"fct-setting-form-fields"},Xpe={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},Zpe={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},efe={class:"fct-inline-tip"},tfe={class:"fct-vat-excluded-categories"},afe={class:"fct-inline-tip"};function lfe(e,t,a,l,n,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-switch"),_=C("LabelHint"),g=C("TaxConfigurationsLoader"),y=C("el-radio"),v=C("el-radio-group"),k=C("el-option"),b=C("el-select"),w=C("el-input"),B=C("Animation"),S=C("CardBody"),V=C("CardContainer"),F=Qa("loading");return r(),h("div",ipe,[s(A,{heading:i.translate("Tax Configuration"),loading:n.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",rpe,[s(p),s(V,null,{default:u(()=>[s(S,null,{default:u(()=>[o("div",dpe,[o("div",upe,[s(m,{modelValue:n.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=$=>n.settings.enable_tax=$),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[s(_,{title:i.translate("Enable Tax")},null,8,["title"]),o("p",cpe,f(n.settings.enable_tax==="yes"?i.translate("This store is now collecting tax."):i.translate("This store is not collecting tax.")),1)])])]),s(B,{visible:n.settings.enable_tax==="yes",accordion:""},{default:u(()=>[n.loading?(r(),E(g,{key:0})):x("",!0),n.loading?x("",!0):(r(),h("div",Ape,[o("div",ppe,[o("div",fpe,[s(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",mpe,f(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",hpe,[s(v,{modelValue:n.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=$=>n.settings.tax_inclusion=$)},{default:u(()=>[s(y,{value:"included"},{default:u(()=>[R(f(i.translate("Included")),1)]),_:1}),s(y,{value:"excluded"},{default:u(()=>[R(f(i.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),o("p",_pe,f(i.translate("Shipping tax always follows the store-level tax mode (Included or Excluded). Product-specific tax settings do not apply to shipping.")),1)])]),o("div",vpe,[o("div",gpe,[s(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",ype,f(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",bpe,[s(v,{modelValue:n.settings.eu_vat_settings.reverse_charge_price_mode,"onUpdate:modelValue":t[2]||(t[2]=$=>n.settings.eu_vat_settings.reverse_charge_price_mode=$),class:"fct-reverse-charge-price-mode"},{default:u(()=>[s(y,{value:"fixed"},{default:u(()=>[o("div",wpe,[o("span",Cpe,f(i.translate("Fixed")),1),o("span",kpe,f(i.translate("Listed price stays unchanged on reverse charge. Only the tax line is zeroed on the invoice.")),1)])]),_:1}),s(y,{value:"dynamic"},{default:u(()=>[o("div",Bpe,[o("span",xpe,f(i.translate("Dynamic")),1),o("span",Spe,f(i.translate("VAT is stripped from the price on reverse charge. Customer pays the net (ex-VAT) amount.")),1)])]),_:1})]),_:1},8,["modelValue"])])]),o("div",$pe,[o("div",Fpe,[s(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",Epe,f(i.translate("Determine the location used for tax calculations.")),1)]),o("div",Upe,[s(b,{modelValue:n.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=$=>n.settings.tax_calculation_basis=$),clearable:""},{default:u(()=>[s(k,{value:"shipping",label:i.translate("Customer Shipping Address")},null,8,["label"]),s(k,{value:"billing",label:i.translate("Customer Billing Address")},null,8,["label"]),s(k,{value:"store",label:i.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),o("div",Ipe,[o("div",Vpe,[s(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",Dpe,f(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",Tpe,[s(w,{modelValue:n.settings.price_suffix_included,"onUpdate:modelValue":t[4]||(t[4]=$=>n.settings.price_suffix_included=$),placeholder:i.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),o("div",Qpe,[o("div",Mpe,[s(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",Lpe,f(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",Rpe,[s(w,{modelValue:n.settings.price_suffix_excluded,"onUpdate:modelValue":t[5]||(t[5]=$=>n.settings.price_suffix_excluded=$),placeholder:i.translate("e.g. (+ tax)")},null,8,["modelValue","placeholder"])])]),o("div",Ope,[o("div",Ppe,[s(_,{title:i.translate("Tax Display Style")},null,8,["title"]),o("p",Hpe,f(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",Npe,[s(b,{modelValue:n.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=$=>n.settings.checkout_tax_breakdown_display=$)},{default:u(()=>[s(k,{value:"simplified",label:i.translate("Simplified (single line + details)")},null,8,["label"]),s(k,{value:"itemized",label:i.translate("Itemized (per-item tax + breakdown)")},null,8,["label"])]),_:1},8,["modelValue"])])]),n.settings.checkout_tax_breakdown_display==="simplified"?(r(),h("div",Kpe,[o("div",Gpe,[s(_,{title:i.translate("Tax Line Label")},null,8,["title"]),o("p",zpe,f(i.translate("The single-line tax label shown in Simplified mode, e.g. VAT, MwSt, GST.")),1)]),o("div",jpe,[s(w,{modelValue:n.settings.tax_display_label,"onUpdate:modelValue":t[7]||(t[7]=$=>n.settings.tax_display_label=$),placeholder:i.translate("e.g. Tax")},null,8,["modelValue","placeholder"])])])):x("",!0),o("div",qpe,[o("div",Ype,[s(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",Wpe,f(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",Jpe,[o("div",Xpe,[o("div",Zpe,[s(m,{modelValue:n.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[8]||(t[8]=$=>n.settings.eu_vat_settings.local_reverse_charge=$),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[s(_,{title:i.translate("Local Reverse Charge")},null,8,["title"]),o("p",efe,f(i.translate("If enabled, apply reverse charge when applicable even when customers are in your home country.")),1)])]),s(B,{visible:i.handlePriceMode,accordion:""},{default:u(()=>[o("div",tfe,[s(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",afe,f(i.translate("Select product categories that should NOT get VAT reverse charge !")),1),Jt((r(),E(b,{modelValue:n.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[9]||(t[9]=$=>n.settings.eu_vat_settings.vat_reverse_excluded_categories=$),filterable:"",multiple:"",clearable:"",placeholder:i.translate("Select Product Categories"),class:"w-full mt-4"},{default:u(()=>[(r(!0),h(P,null,ae(n.categories,$=>(r(),E(k,{key:$.value||$.term_id,label:$.label||$.name,value:$.value||$.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[F,n.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const sfe=nt(ope,[["render",lfe]]),nfe={class:"fct-tax-rates-wrap-loader px-5"},ofe={__name:"TaxRatesLoader",setup(e){const t=M(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,l)=>{const n=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",nfe,[(r(!0),h(P,null,ae(t.value,(A,p)=>(r(),h("div",{key:p,class:"flex items-center justify-between border-[1px] border-solid border-gray-divider dark:border-dark-400 rounded h-12 pr-4 pl-6 mb-4"},[s(i,{animated:"",style:fa({width:A}),class:"h-4"},{template:u(()=>[s(n,{variant:"p",class:"h-4"})]),_:2},1032,["style"]),s(i,{animated:"",class:"w-[100px] h-4"},{template:u(()=>[s(n,{variant:"p",class:"h-4"})]),_:1})]))),128))])}}},ife={class:"setting-wrap"},rfe={class:"setting-wrap-inner"},dfe={class:"fct-all-tax-classes-page"},ufe={class:"flex items-center justify-end gap-4"},cfe={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},Afe={class:"inline-flex items-center gap-2"},pfe={class:"inline-flex items-center gap-2"},ffe=["src","alt"],mfe={key:0,class:"text-gray-400 dark:text-gray-300"},hfe={key:1,class:"text-success-500"},_fe={key:2,class:"text-system-mid dark:text-gray-300"},vfe={key:3,class:"text-gray-400 dark:text-gray-300"},gfe={key:1,class:"text-gray-400"},yfe={__name:"TaxRates",setup(e){const t=M({}),a=M([]),l=M({}),n=M({}),i=G(()=>!!Ke.get("is_tax_enabled")),A=M(!1),p=M({}),m={};let _=0;const g=M(""),y=M(!1),v={XI:"gb"},k=I=>(v[I]||I).toLowerCase(),b=G(()=>{const I=new Set;for(const L of a.value)for(const O of L.countries||[])I.add(O.country_code);return I}),w=I=>!I||!Object.prototype.hasOwnProperty.call(n.value,I)?!0:n.value[I],B=I=>!I||!I.vat?!1:I.rates&&typeof I.rates=="object"&&Object.keys(I.rates).length?Object.values(I.rates).some(L=>L&&parseFloat(L.rate)>0):parseFloat(I.rate)>0,S=G(()=>{const I=l.value||{},L=Array.isArray(I.country_registrations)?I.country_registrations:[],O=I.method||"",Q=L.some(B);if(O==="oss")return!!I.oss_country;if(O==="home"){const H=I.home_country||"",K=L.find(W=>W.country===H);if(H&&K&&B(K))return!0}return O==="specific"?!!I.home_country:Q}),V=G(()=>{const I=l.value||{},L=Array.isArray(I.country_registrations)?I.country_registrations:[],O=I.method||"";return O==="oss"?!!I.oss_country:O==="home"?!!I.home_country&&L.some(Q=>Q.country===I.home_country):O==="specific"?!!I.home_country:L.some(B)}),F=G(()=>{const I=[],L=Object.values(t.value||{});for(const H of L)if(H.group_code==="EU")I.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:V.value,enabled:w("EU"),collecting:V.value&&S.value&&w("EU")});else for(const K of H.countries||[]){const W=b.value.has(K.country_code),z=w(K.country_code);I.push({country_code:K.country_code,country_name:K.country_name,isEU:!1,group_code:H.group_code,hasConfig:W,enabled:z,collecting:W&&z})}const O=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],Q=new Set(O);return I.sort((H,K)=>{if(H.hasConfig!==K.hasConfig)return H.hasConfig?-1:1;const W=Q.has(H.country_code),z=Q.has(K.country_code);return W&&z?O.indexOf(H.country_code)-O.indexOf(K.country_code):W?-1:z?1:H.country_name.localeCompare(K.country_name)}),I}),$=G(()=>{const I=g.value.trim().toLowerCase();return F.value.filter(L=>y.value&&(!i.value||!L.collecting)?!1:I?L.country_name.toLowerCase().includes(I)||L.country_code.toLowerCase().includes(I):!0)}),U=G(()=>{if(!i.value)return!1;const I=F.value.filter(O=>O.enabled).length,L=F.value.filter(O=>!O.enabled).length;return I>0&&L>0}),D=()=>{A.value=!0,Promise.all([ce.get("tax/configuration/rates"),ce.get("tax/rates"),ce.get("tax/configuration/settings")]).then(([I,L,O])=>{var Q;t.value=I.tax_rates,a.value=L.tax_rates,n.value=L.country_enabled_map||{},l.value=((Q=O.settings)==null?void 0:Q.eu_vat_settings)||{}}).catch(I=>{}).finally(()=>{A.value=!1})},T=(I,L)=>{const O=w(I.country_code),Q=++_;m[I.country_code]=Q,n.value={...n.value,[I.country_code]:L},p.value={...p.value,[I.country_code]:!0},ce.post("tax/country-status/"+I.country_code,{enabled:L?1:0}).then(H=>{m[I.country_code]===Q&&(j.success(H.message),n.value={...n.value,[I.country_code]:H.enabled})}).catch(H=>{var K;m[I.country_code]===Q&&(n.value={...n.value,[I.country_code]:O},j.error(((K=H==null?void 0:H.data)==null?void 0:K.message)||d("Failed to update tax status")))}).finally(()=>{if(m[I.country_code]===Q){const H={...p.value};delete H[I.country_code],p.value=H}})};return Te(()=>{D()}),(I,L)=>{const O=C("el-checkbox"),Q=C("el-input"),H=C("el-table-column"),K=C("el-switch"),W=C("el-table");return r(),h("div",ife,[s($a,{heading:c(d)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",rfe,[s(Fa),o("div",dfe,[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Tax Regions"),text:c(d)("Manage tax rates for different regions")},{action:u(()=>[o("div",ufe,[U.value?(r(),E(O,{key:0,modelValue:y.value,"onUpdate:modelValue":L[0]||(L[0]=z=>y.value=z)},{default:u(()=>[R(f(c(d)("Collecting Tax")),1)]),_:1},8,["modelValue"])):x("",!0),s(Q,{modelValue:g.value,"onUpdate:modelValue":L[1]||(L[1]=z=>g.value=z),class:"w-[200px]",placeholder:c(d)("Search regions..."),size:"small",clearable:""},{prefix:u(()=>[s(X,{name:"Search",class:"w-4 h-4"})]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["title","text"]),s(Be,{class:"px-0 pb-0"},{default:u(()=>[!A.value&&!i.value?(r(),h("div",cfe,[s(ol,{type:"warning",icon:"AlertTriangle",content:c(d)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):x("",!0),A.value?(r(),E(ofe,{key:1})):(r(),E(W,{key:2,data:$.value,"max-height":"500",class:"w-full compact-table fct-tax-rates-regions-table"},{default:u(()=>[s(H,{label:c(d)("Region"),"min-width":"300"},{default:u(({row:z})=>[z.isEU?(r(),E(ta,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:u(()=>[o("div",Afe,[L[2]||(L[2]=o("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),R(" "+f(z.country_name),1)])]),_:2},1024)):(r(),E(ta,{key:1,to:{name:"tax-rates-country-single",params:{country:z.country_code,group:z.group_code}},class:"fct-tax-region-link hover:no-underline"},{default:u(()=>[o("div",pfe,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${k(z.country_code)}.png`,alt:z.country_code},null,8,ffe),R(" "+f(z.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),s(H,{label:c(d)("Collecting"),width:"200"},{default:u(({row:z})=>[i.value?z.collecting?(r(),h("span",hfe,f(c(d)("Collecting tax")),1)):z.hasConfig&&!z.enabled?(r(),h("span",_fe,f(c(d)("Disabled")),1)):(r(),h("span",vfe,"—")):(r(),h("span",mfe,"—"))]),_:1},8,["label"]),s(H,{label:c(d)("Enabled"),width:"140",align:"center"},{default:u(({row:z})=>[z.hasConfig?(r(),E(K,{key:0,"model-value":i.value?z.enabled:!1,loading:!!p.value[z.country_code],disabled:!i.value,onChange:Y=>T(z,Y)},null,8,["model-value","loading","disabled","onChange"])):(r(),h("span",gfe,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},bfe={class:"fct-base-taxes"},wfe={class:"fct-tax-class-tabs"},Cfe={class:"fct-tax-class-tabs__list"},kfe={class:"fct-base-taxes__header"},Bfe={class:"fct-base-taxes__header-label"},xfe={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},Sfe={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},$fe={class:"fct-base-taxes__state-fields"},Ffe={class:"fct-base-taxes__region-name"},Efe={class:"fct-base-taxes__state-fields"},Ufe={__name:"CountryTaxRatesLoader",setup(e){const t=[1,2,3];return(a,l)=>{const n=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",null,[o("div",bfe,[o("div",wfe,[o("div",Cfe,[(r(),h(P,null,ae(3,A=>o("div",{key:A,class:"fct-tax-class-tabs__tab"},[s(i,{animated:""},{template:u(()=>[s(n,{variant:"text",class:"w-16 h-5"})]),_:1})])),64)),s(i,{animated:""},{template:u(()=>[s(n,{variant:"text",class:"w-5 h-5"})]),_:1})])]),o("div",kfe,[o("span",Bfe,f(c(d)("Regions")),1)]),o("div",xfe,[o("div",Sfe,[s(i,{animated:""},{template:u(()=>[s(n,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",$fe,[s(i,{animated:""},{template:u(()=>[s(n,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),s(i,{animated:""},{template:u(()=>[s(n,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),l[0]||(l[0]=o("div",{class:"fct-base-taxes__field-compound"},null,-1))])]),l[1]||(l[1]=o("div",{class:"fct-base-taxes__divider"},null,-1)),(r(),h(P,null,ae(t,A=>o("div",{key:A,class:"fct-base-taxes__state-row"},[o("div",Ffe,[s(i,{animated:""},{template:u(()=>[s(n,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",Efe,[s(i,{animated:""},{template:u(()=>[s(n,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),s(i,{animated:""},{template:u(()=>[s(n,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),s(i,{animated:""},{template:u(()=>[s(n,{variant:"rect",class:"fct-base-taxes__field-compound h-8"})]),_:1})])])),64))])])}}},Ife={class:"fct-tax-class-tabs"},Vfe={class:"fct-tax-class-tabs__list"},Dfe=["onClick"],Tfe=["title","onClick"],Qfe=["disabled","title"],Mfe=["disabled","title"],Lfe=["disabled"],Rfe=["disabled","title"],Ofe={class:"fct-tax-class-tabs__search"},Qf={__name:"TaxClassTabs",props:{classes:{type:Array,default:()=>[]},activeId:{type:[Number,String],default:null},maxClasses:{type:Number,default:6},creating:{type:Boolean,default:!1},search:{type:String,default:""}},emits:["switch","delete","add","create-custom","update:search"],setup(e,{emit:t}){const a=e,l=t,n=M(!1),i=M(""),A=M(null),p=M(!1),m=G(()=>[...a.classes].sort((w,B)=>w.slug==="standard"&&B.slug!=="standard"?-1:w.slug!=="standard"&&B.slug==="standard"?1:0)),_=G(()=>["reduced","zero"].filter(w=>!a.classes.find(B=>B.slug===w))),g=()=>{i.value="",p.value=!1,n.value=!0,$e(()=>{var w;return(w=A.value)==null?void 0:w.focus()})},y=w=>{if(w==="custom"){g();return}l("add",w)},v=()=>{const w=i.value.trim();if(!w){k();return}l("create-custom",w)},k=()=>{n.value=!1,i.value="",p.value=!1},b=()=>{!a.creating&&!i.value.trim()&&k()};return be([()=>a.classes.length,()=>a.creating],([w,B],[S,V])=>{if(n.value){if(w>S){k();return}V&&!B&&(p.value=!0)}}),be(i,()=>{p.value=!1}),(w,B)=>{const S=C("el-input"),V=C("el-dropdown-item"),F=C("el-dropdown-menu"),$=C("el-dropdown");return r(),h("div",Ife,[o("div",Vfe,[(r(!0),h(P,null,ae(m.value,U=>(r(),h("button",{key:U.id,class:ue(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==U.id}]),onClick:D=>l("switch",U)},[R(f(U.title)+" ",1),U.slug!=="standard"?(r(),h("span",{key:0,class:"fct-tax-class-tabs__delete",title:c(d)("Delete tax class"),onClick:Ge(D=>l("delete",U),["stop"])},[s(X,{name:"Close"})],8,Tfe)):x("",!0)],10,Dfe))),128)),e.classes.length<e.maxClasses?(r(),h(P,{key:0},[n.value?(r(),h("div",{key:0,class:ue(["fct-tax-class-tabs__inline-create",{"fct-tax-class-tabs__inline-create--error":p.value}])},[s(S,{ref_key:"inlineInput",ref:A,modelValue:i.value,"onUpdate:modelValue":B[0]||(B[0]=U=>i.value=U),size:"small",maxlength:"30",disabled:e.creating,placeholder:c(d)("e.g. Luxury"),onKeyup:[ea(v,["enter"]),ea(k,["esc"])],onBlur:b},null,8,["modelValue","disabled","placeholder"]),o("button",{class:"fct-tax-class-tabs__inline-confirm",disabled:e.creating||!i.value.trim(),title:c(d)("Create tax class"),onMousedown:B[1]||(B[1]=Ge(()=>{},["prevent"])),onClick:v},[s(X,{name:"Check"})],40,Qfe),o("button",{class:"fct-tax-class-tabs__inline-cancel",disabled:e.creating,title:c(d)("Cancel"),onMousedown:B[2]||(B[2]=Ge(()=>{},["prevent"])),onClick:k},[s(X,{name:"Close"})],40,Mfe)],2)):_.value.length?(r(),E($,{key:1,trigger:"click",disabled:e.creating,onCommand:y,"popper-class":"fct-dropdown"},{dropdown:u(()=>[s(F,null,{default:u(()=>[_.value.includes("reduced")?(r(),E(V,{key:0,command:"reduced"},{default:u(()=>[R(f(c(d)("Reduced")),1)]),_:1})):x("",!0),_.value.includes("zero")?(r(),E(V,{key:1,command:"zero"},{default:u(()=>[R(f(c(d)("Zero")),1)]),_:1})):x("",!0),s(V,{command:"custom"},{default:u(()=>[R(f(c(d)("Custom Class...")),1)]),_:1})]),_:1})]),default:u(()=>[o("button",{class:"fct-tax-class-tabs__add",disabled:e.creating},[s(X,{name:"Plus"})],8,Lfe)]),_:1},8,["disabled"])):(r(),h("button",{key:2,class:"fct-tax-class-tabs__add",disabled:e.creating,title:c(d)("Add custom tax class"),onClick:g},[s(X,{name:"Plus"})],8,Rfe))],64)):x("",!0)]),o("div",Ofe,[s(S,{"model-value":e.search,placeholder:c(d)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":B[3]||(B[3]=U=>l("update:search",U)),onClear:B[4]||(B[4]=U=>l("update:search",""))},{prefix:u(()=>[s(X,{name:"Search",class:"w-3.5 h-3.5 text-system-light dark:text-gray-400"})]),_:1},8,["model-value","placeholder"]),wa(w.$slots,"search-actions")])])}}},Pfe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,Kd=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||Pfe(e),Hfe=({classes:e=[],previousIds:t=new Set,createdSlug:a=null})=>{if(a){const l=e.find(n=>n.slug===a);if(l)return l}return e.find(l=>!t.has(l.id))||null},ai=async({payload:e,createdSlug:t=null,currentClasses:a=[],reloadClasses:l})=>{const n=new Set((a||[]).map(p=>p.id)),i=await ce.post("tax/classes",e),A=await l();return{response:i,classes:A,createdClass:Hfe({classes:A,previousIds:n,createdSlug:t})}},Mf=async({classId:e,currentActiveId:t=null,reloadClasses:a})=>{const l=await ce.delete("tax/classes/"+e),n=await a();return{response:l,classes:n,nextActiveClass:Kd({classes:n,activeId:t})}};function dn(e){return e==null||e===""?"":String(e)}const Nfe={class:"setting-wrap"},Kfe={class:"setting-wrap-inner"},Gfe={class:"fct-single-tax-rates-country-single-page"},zfe={class:"fct-single-tax-rates-country-single"},jfe={class:"single-page-header flex items-center justify-between"},qfe={key:0,class:"flex items-center gap-2"},Yfe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},Wfe={class:"mt-3 flex justify-end"},Jfe={key:1,class:"fct-base-taxes"},Xfe={class:"fct-btn-group mt-4 justify-end sm"},Zfe={class:"fct-tax-rates-country-view"},eme={key:0},tme={key:1},ame={key:0},lme={key:1},sme={class:"fct-btn-group sm justify-end"},Mc={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=M(!1),l=M([]),n=M(""),i=G(()=>!!Ke.get("is_tax_enabled")),A=M([]),p=M(null),m=M("standard"),_=M(!1),g=M(null),y=M(6),v=M({id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0}),k=M({rate:0,name:""}),b=M([]),w=M({}),B=M(""),S=G(()=>{const te=B.value.trim().toLowerCase();return te?b.value.filter(Fe=>Fe.stateName&&Fe.stateName.toLowerCase().includes(te)):b.value}),V=G(()=>t.group==="EU"),F=G(()=>[v.value,...S.value]),$=M([]),U=M(!1),D=M([]),T=M([]),I=M(!1),L=M(new Set),O=M(0),Q=M([]),H=M(!1),K=M(!1),W=M(!1),z=M({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:"",tax_rate:0,override_state_tax:!0,class_id:0,id:"",previous_id:""}),Y=G(()=>{const te=v.value.rate||0;return[{label:d("added to")+` ${te}% `+d("federal tax"),is_compound:"0",for_order:0},{label:d("instead of")+` ${te}% `+d("federal tax"),is_compound:"0",for_order:1},{label:d("compounded on top of")+` ${te}% `+d("federal tax"),is_compound:"1",for_order:0}]}),Z=te=>String(te.is_compound)==="1"?"1_0":te.for_order==1?"0_1":"0_0",re=(te,Fe)=>{const[ne,_e]=Fe.split("_");te.is_compound=ne,te.for_order=parseInt(_e)},q=te=>te&&te.replace(/\s*\(Standard\)\s*/gi,"").trim(),Ae=M(!1),ie=M({}),J=M(!1),N=M(""),le=M(""),ee=M(""),pe=M(!1),de=M(!1),Ue=M(!0),Ce=M(!1),Se=M(!1),ge=M(!1),ke=G(()=>d("Toggle tax collection for %1$s",n.value||t.country)),Oe=()=>ce.get("tax/classes").then(te=>{A.value=te.classes||[],y.value=te.max_classes||6,g.value=te.next_builtin||null;const Fe=Kd({classes:A.value,activeId:p.value});return Fe&&(p.value=Fe.id,m.value=Fe.slug),A.value}).catch(te=>A.value),Ee=(te="")=>{if(!te)return v.value.name||"Tax";const Fe=b.value.find(ne=>ne.state===te);return Fe!=null&&Fe.name?Fe.name:v.value.name||"Tax"},fe=te=>{v.value={...te.federalRate},k.value={...te.federalOriginal},b.value=te.stateRows.map(Fe=>({...Fe})),w.value={...te.stateOriginals}},ye=()=>({federalRate:{...v.value},federalOriginal:{...k.value},stateRows:b.value.map(te=>({...te})),stateOriginals:{...w.value}}),De=()=>{p.value&&(ie.value[p.value]=ye())},Le=async te=>{De(),p.value=te.id,m.value=te.slug,ie.value[te.id]?(fe(ie.value[te.id]),await yt()):await Xt()},At=te=>{_.value=!0,ai({payload:{slug:te},createdSlug:te,currentClasses:A.value,reloadClasses:Oe}).then(({response:Fe,createdClass:ne})=>{if(j.success(Fe.message),ne)return Le(ne)}).catch(Fe=>{var ne;j.error(((ne=Fe==null?void 0:Fe.data)==null?void 0:ne.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},mt=te=>{_.value=!0,ai({payload:{title:te},currentClasses:A.value,reloadClasses:Oe}).then(({response:Fe,createdClass:ne})=>{if(j.success(Fe.message),ne)return Le(ne)}).catch(Fe=>{var ne;j.error(((ne=Fe==null?void 0:Fe.data)==null?void 0:ne.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},Mt=te=>{const Fe=p.value===te.id;Ra(d("All rates for this class will be deleted. Products using it will default to Standard."),d("Delete")+" "+te.title+"?",{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Mf({classId:te.id,currentActiveId:p.value,reloadClasses:Oe}).then(({response:ne,nextActiveClass:_e})=>{if(delete ie.value[te.id],j.success(ne.message),_e)return Fe&&(p.value=null),Le(_e)}).catch(ne=>{var _e;j.error(((_e=ne==null?void 0:ne.data)==null?void 0:_e.message)||"Failed to delete tax class")})}).catch(()=>{})},Dt=()=>ce.get("address-info/get-country-info",{country_code:t.country}).then(te=>{l.value=te.states||[],n.value=te.country_name||t.country}).catch(te=>{j.error(d("Failed to load country data. Please refresh the page."))}),Je=()=>V.value?(le.value="",ee.value="",Promise.resolve()):(pe.value=!0,ce.get("tax/country-tax-id/"+t.country).then(te=>{var ne;const Fe=((ne=te==null?void 0:te.tax_data)==null?void 0:ne.tax_id)||"";le.value=Fe,ee.value=Fe}).catch(te=>{var Fe;j.error(((Fe=te==null?void 0:te.data)==null?void 0:Fe.message)||d("Failed to load tax ID"))}).finally(()=>{pe.value=!1})),pt=({hydrateClassData:te=!0}={})=>ce.get("tax/rates/country/rates/"+t.country).then(Fe=>{const ne=Fe.tax_rates||[],_e=ne.filter(qe=>qe.for_shipping!==null),We=p.value?ne.filter(qe=>Number(qe.class_id)===Number(p.value)):ne;D.value=We.filter(qe=>!qe.city&&!qe.postcode).map(qe=>({name:qe.name,value:qe.id,state:qe.state||""}));const ot=Tt(We);return ge.value=ne.length>0,te&&(fe(ot),De(),Ue.value=!!Fe.tax_enabled,Se.value=!0),{allRates:ne,shippingOverrides:_e,classEntry:ot}}).catch(Fe=>(j.error(d("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),qt=()=>ce.get("tax/product-overrides/"+t.country).then(te=>te.overrides||[]).catch(()=>[]),Ct=()=>{Q.value.length>0||(H.value=!0,ce.get("products/fetch-term").then(te=>{const Fe=te.taxonomies&&te.taxonomies["product-categories"]?te.taxonomies["product-categories"].terms||[]:[];Q.value=Fe.map(ne=>({...ne,value:dn(ne.value)}))}).catch(()=>{}).finally(()=>{H.value=!1}))};let $t=0;const Nt=te=>{const Fe=++$t;return!te||Number(te)===Number(p.value)?(T.value=D.value.slice(),I.value=!1,Promise.resolve()):(I.value=!0,T.value=[],ce.get("tax/rates/country/rates/"+t.country,{class_id:te}).then(ne=>{if(Fe!==$t)return;const _e=ne.tax_rates||[];T.value=_e.filter(We=>!We.city&&!We.postcode).map(We=>({name:We.name,value:We.id,state:We.state||""}))}).catch(()=>{Fe===$t&&(T.value=[],j.error(d("Failed to load tax rates for the selected tax class")))}).finally(()=>{Fe===$t&&(I.value=!1)}))},Kt=(te,Fe)=>{var _e,We;const ne=[];for(const ot of te){const qe=ot.state?((_e=l.value.find(lt=>lt.value===ot.state))==null?void 0:_e.name)||ot.state:n.value||t.country,Ze=Ee(ot.state||""),gt=A.value.find(lt=>Number(lt.id)===Number(ot.class_id));ne.push({id:ot.id,type:"shipping",label:Ze,tax_label:Ze,category_name:"",location:qe,city:ot.city||"",postcode:ot.postcode||"",rate:ot.for_shipping,class_id:Number(ot.class_id)||0,class_label:gt?gt.title:"",_raw:ot})}for(const ot of Fe){const qe=ot.meta_value||ot,Ze=qe.state||"",gt=Ze?((We=l.value.find(me=>me.value===Ze))==null?void 0:We.name)||Ze:n.value||t.country,lt=Number(ot.class_id)||0,Vt=lt?A.value.find(me=>Number(me.id)===lt):null;ne.push({id:ot.id,type:"products",label:qe.category_name||"",tax_label:qe.tax_label||"",category_name:qe.category_name||"",location:gt,city:qe.city||"",postcode:qe.postcode||"",rate:qe.rate,class_id:lt,class_label:Vt?Vt.title:"",_raw:ot})}$.value=ne},Tt=te=>{const Fe=lt=>(!lt.state||lt.state==="")&&(!lt.city||lt.city==="")&&(!lt.postcode||lt.postcode===""),ne=te.find(Fe),_e=te.filter(lt=>lt.state&<.state!==""&&(!lt.city||lt.city==="")&&(!lt.postcode||lt.postcode===""));let We,ot;if(ne){const lt=q(ne.name)||"Tax";We={...ne,name:lt},ot={rate:ne.rate,name:lt}}else We={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},ot={rate:0,name:"Tax"};const qe={};for(const lt of _e)qe[lt.state]=lt;const Ze=[],gt={};for(const lt of l.value){const Vt=qe[lt.value];if(Vt){const me=q(Vt.name)||"State Tax";Ze.push({id:Vt.id,state:lt.value,stateName:lt.name,rate:Vt.rate,name:me,is_compound:String(Vt.is_compound||"0"),for_order:Vt.for_order||0}),gt[lt.value]={rate:Vt.rate,name:me,is_compound:String(Vt.is_compound||"0"),for_order:Vt.for_order||0}}else Ze.push({id:null,state:lt.value,stateName:lt.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),gt[lt.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:We,federalOriginal:ot,stateRows:Ze,stateOriginals:gt}},yt=async()=>{const[{shippingOverrides:te},Fe]=await Promise.all([pt({hydrateClassData:!1}),qt()]);Kt(te,Fe)},Xt=async()=>{a.value=!0;try{const[{shippingOverrides:te},Fe]=await Promise.all([pt(),qt()]);Kt(te,Fe)}finally{a.value=!1}},we=async()=>{a.value=!0;try{await Promise.all([Oe(),Dt(),Je()]),await Xt()}finally{a.value=!1}},Ie=()=>{V.value||de.value||pe.value||(de.value=!0,ce.post("tax/country-tax-id/"+t.country,{tax_id:le.value||""}).then(te=>{ee.value=le.value||"",j.success(te.message||d("Tax ID has been saved successfully"))}).catch(te=>{var Fe;j.error(((Fe=te==null?void 0:te.data)==null?void 0:Fe.message)||d("Failed to save tax ID"))}).finally(()=>{de.value=!1}))},it=te=>{if(Ce.value)return;const Fe=Ue.value;Ue.value=te,Ce.value=!0,ce.post("tax/country-status/"+t.country,{enabled:te?1:0}).then(ne=>{Ue.value=ne.enabled,j.success(ne.message)}).catch(ne=>{var _e;Ue.value=Fe,j.error(((_e=ne==null?void 0:ne.data)==null?void 0:_e.message)||d("Failed to update tax status"))}).finally(()=>{Ce.value=!1})},kt=async()=>{try{await Ra(d("This will overwrite your current rates with preset defaults. Continue?"),d("Reset to default tax rates"),{confirmButtonText:d("Reset"),cancelButtonText:d("Cancel"),type:"warning"})}catch{return}J.value=!0;try{const Fe=(await ce.get("tax/configuration/rates")).tax_rates||{};let ne=[];for(const Ze in Fe){const gt=Fe[Ze];for(const lt of gt.countries||[])if(lt.country_code===t.country){ne=lt.rates||[];break}if(ne.length)break}if(!ne.length){j.error(d("No preset rates found for this country"));return}const _e=ne.find(Ze=>(!Ze.state||Ze.state==="")&&Ze.type==="standard"),We=ne.filter(Ze=>Ze.state&&Ze.state!==""&&Ze.type==="standard"),ot=[];_e&&_e.rate>0&&(v.value.rate=_e.rate,v.value.name=q(_e.name||"")||d("Tax"),ot.push(Bt()));const qe=[];for(const Ze of We){const gt=b.value.find(lt=>lt.state===Ze.state);gt&&(gt.rate=Ze.rate,gt.name=q(Ze.name)||d("State Tax"),gt.is_compound=Ze.compound?"1":"0",qe.push(na(gt)))}await Promise.all([...ot,...qe]),De(),await yt(),j.success(d("Tax rates have been reset to defaults"))}catch{j.error(d("Failed to reset tax rates"))}finally{J.value=!1}},Bt=()=>{const te={country:t.country,state:"",rate:v.value.rate,name:v.value.name||"Tax",is_compound:v.value.is_compound||"0",for_order:v.value.for_order||0,group:t.group,class_id:p.value||""};return(v.value.id?ce.put("tax/country/rate/"+v.value.id,te):ce.post("tax/country/rate",te)).then(ne=>{ne.tax_rate&&(v.value.id=ne.tax_rate.id),k.value={rate:v.value.rate,name:v.value.name}})},na=te=>{const Fe={country:t.country,state:te.state,rate:te.rate,name:te.name,is_compound:te.is_compound,for_order:te.for_order,group:t.group,class_id:p.value||""};return(te.id?ce.put("tax/country/rate/"+te.id,Fe):ce.post("tax/country/rate",Fe)).then(_e=>{_e.tax_rate&&(te.id=_e.tax_rate.id),w.value[te.state]={rate:te.rate,name:te.name,is_compound:String(te.is_compound),for_order:te.for_order}})},bt=async()=>{Ae.value=!0;try{const te=[];(String(v.value.rate)!==String(k.value.rate)||v.value.name!==k.value.name)&&te.push(Bt());for(const ne of b.value){const _e=w.value[ne.state];(!_e||String(ne.rate)!==String(_e.rate)||ne.name!==_e.name||String(ne.is_compound)!==String(_e.is_compound)||ne.for_order!=_e.for_order)&&te.push(na(ne))}await Promise.all(te),De(),await yt(),j.success(d("Tax rates saved"))}catch{j.error(d("Failed to save rates"))}finally{Ae.value=!1}},ia=()=>{L.value=new Set,O.value=0},ra=()=>{const te=Ee();W.value=!1,z.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:te,tax_rate:0,override_state_tax:!0,class_id:Number(p.value)||0,id:"",previous_id:""},N.value=te,T.value=D.value.slice(),U.value=!0,Ct()},Yt=te=>{if(W.value=!0,Ct(),te.type==="shipping"){const Fe=te._raw.state||"",ne=Ee(Fe),_e=Number(te._raw.class_id)||Number(p.value)||0;z.value={type:"shipping",original_type:"shipping",original_id:te.id,category_id:"",category_name:"",state:Fe||"__country__",city:te._raw.city||"",postcode:te._raw.postcode||"",tax_label:ne,tax_rate:te.rate,override_state_tax:!0,class_id:_e,id:te.id,previous_id:te.id},N.value=ne,O.value=_e,Nt(_e);const We=te._raw.city||"",ot=te._raw.postcode||"",qe=new Set;for(const Ze of $.value)Ze.type==="shipping"&&(Ze._raw.state||"")===Fe&&(Ze._raw.city||"")===We&&(Ze._raw.postcode||"")===ot&&qe.add(Number(Ze.class_id));L.value=qe}else{const Fe=te._raw.meta_value||te._raw,ne=Fe.state||"",_e=Ee(ne),We=te.tax_label||_e;z.value={type:"products",original_type:"products",original_id:te.id,category_id:dn(Fe.category_id),category_name:te.category_name,state:ne||"__country__",tax_label:We,tax_rate:te.rate,override_state_tax:Fe.override_state_tax==="yes",city:Fe.city||"",postcode:Fe.postcode||"",class_id:te.class_id||0,id:te.id,previous_id:""},N.value=_e}U.value=!0},ka=G(()=>{const te=[{label:n.value||t.country,value:"__country__"}];for(const Fe of l.value)te.push({label:Fe.name,value:Fe.value});return te}),tl=G(()=>{if(!T.value.length)return ka.value;const te=new Set(T.value.map(Fe=>Fe.state||""));return ka.value.filter(Fe=>{const ne=Fe.value==="__country__"?"":Fe.value;return te.has(ne)})}),ul=te=>{const Fe=dn(te),ne=Q.value.find(_e=>_e.value===Fe);ne&&(z.value.category_name=ne.label)},al=te=>{Ra(d("Are you sure you want to delete this override?"),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{const Fe=te.type==="shipping"?"tax/rates/country/override/"+te.id:"tax/product-overrides/"+te.id;ce.delete(Fe).then(ne=>{j.success(ne.message),$.value=$.value.filter(_e=>!(_e.id===te.id&&_e.type===te.type))}).catch(ne=>{var _e;j.error(((_e=ne==null?void 0:ne.data)==null?void 0:_e.message)||d("Failed to delete override"))})}).catch(()=>{})},va=async()=>{var Fe;const te=z.value.state==="__country__"?"":z.value.state;if(z.value.type==="products"&&!z.value.category_id){j.error(d("Please select a category"));return}if(z.value.type==="shipping"){if(!z.value.class_id){j.error(d("Please select a tax class"));return}if(I.value){j.error(d("Please wait for the province rates to finish loading"));return}const ne=T.value.find(_e=>(_e.state||"")===te);z.value.id=ne?ne.value:0}K.value=!0;try{let ne;if(z.value.type==="products"){const _e=z.value.state==="__country__"?"":z.value.state;ne=await ce.post("tax/product-overrides",{id:W.value&&z.value.original_type==="products"?z.value.original_id:"",source_type:z.value.original_type,source_id:z.value.original_id,country:t.country,state:_e,category_id:z.value.category_id,category_name:z.value.category_name,tax_label:z.value.tax_label,rate:z.value.tax_rate,override_state_tax:z.value.override_state_tax===!0?"yes":"no",city:z.value.city||"",postcode:z.value.postcode||"",class_id:z.value.class_id||0})}else ne=await ce.post("tax/rates/country/override",{id:z.value.id,country:t.country,state:te,previous_id:W.value&&z.value.original_type==="shipping"?z.value.previous_id:"",source_type:z.value.original_type,source_id:z.value.original_id,class_id:z.value.class_id||p.value||"",override_tax_rate:z.value.tax_rate,city:z.value.city||"",postcode:z.value.postcode||""});j.success(ne.message),U.value=!1,await yt()}catch(ne){const _e=((Fe=ne==null?void 0:ne.data)==null?void 0:Fe.message)||(ne==null?void 0:ne.message)||"Failed to save override";j.error(_e)}finally{K.value=!1}};return be(()=>z.value.type,te=>{te==="shipping"&&(z.value.class_id||(z.value.class_id=p.value||0),Nt(z.value.class_id))}),be(()=>z.value.class_id,te=>{z.value.type!=="shipping"||!U.value||Nt(te).then(()=>{const Fe=z.value.state==="__country__"?"":z.value.state,ne=T.value.map(_e=>_e.state||"");Fe!==""&&!ne.includes(Fe)&&(z.value.state="__country__")})}),be(()=>z.value.state,te=>{if(!U.value||z.value.type!=="products"||W.value)return;const Fe=Ee(te==="__country__"?"":te);(!z.value.tax_label||z.value.tax_label===N.value)&&(z.value.tax_label=Fe),N.value=Fe}),Te(()=>{we()}),(te,Fe)=>{const ne=C("el-breadcrumb-item"),_e=C("el-breadcrumb"),We=C("el-switch"),ot=C("el-skeleton"),qe=C("el-input"),Ze=C("el-form-item"),gt=C("el-form"),lt=C("el-button"),Vt=C("el-table-column"),me=C("el-option"),ve=C("el-select"),Ne=C("el-table"),Pe=C("el-tag"),ft=C("el-radio"),se=C("el-radio-group"),je=C("el-checkbox"),vt=C("el-dialog");return r(),h("div",Nfe,[o("div",Kfe,[o("div",Gfe,[o("div",zfe,[o("div",jfe,[s(_e,{class:"mb-0","separator-icon":c(Za)},{default:u(()=>[e.group==="EU"?(r(),E(ne,{key:0,to:{name:"eu"}},{default:u(()=>[R(f(c(d)("Tax Regions")),1)]),_:1})):(r(),E(ne,{key:1,to:{name:"tax_rates"}},{default:u(()=>[R(f(c(d)("Tax Regions")),1)]),_:1})),s(ne,null,{default:u(()=>[R(f(n.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),Se.value&&ge.value?(r(),h("div",qfe,[i.value?(r(),h("span",{key:0,class:ue(["text-sm",Ue.value?"text-success-500":"text-system-mid dark:text-gray-300"])},f(Ue.value?c(d)("Collecting tax"):c(d)("Disabled")),3)):x("",!0),s(We,{"model-value":i.value?Ue.value:!1,loading:Ce.value,disabled:!i.value,"aria-label":ke.value,onChange:it},null,8,["model-value","loading","disabled","aria-label"])])):x("",!0)]),!a.value&&!i.value?(r(),h("div",Yfe,[s(ol,{type:"warning",icon:"AlertTriangle",content:c(d)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):x("",!0),V.value?x("",!0):(r(),E(xe,{key:1},{default:u(()=>[s(Be,null,{default:u(()=>[pe.value?(r(),E(ot,{key:0,animated:"",rows:2})):(r(),E(gt,{key:1,"label-position":"top"},{default:u(()=>[s(Ze,{label:c(d)("VAT/GST/Tax Number"),class:"mb-0"},{default:u(()=>[s(qe,{modelValue:le.value,"onUpdate:modelValue":Fe[0]||(Fe[0]=Me=>le.value=Me),placeholder:c(d)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",Wfe,[s(lt,{type:"primary",size:"small",loading:de.value,disabled:pe.value||de.value||le.value===ee.value,onClick:Ie},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Base taxes")},null,8,["title"]),s(Be,null,{default:u(()=>[s(ol,{type:"info"},{content:u(()=>[o("span",null,f(c(d)("Rates are pre-filled for convenience and may not reflect current laws — verify with a tax advisor before going live. If you sell products taxed at different rates (e.g. food, books, digital goods), use the"))+" + "+f(c(d)("button to add tax classes.")),1)]),_:1}),a.value?(r(),E(Ufe,{key:0})):(r(),h("div",Jfe,[s(Qf,{classes:A.value,"active-id":p.value,"max-classes":y.value,creating:_.value,search:B.value,onSwitch:Le,onDelete:Mt,onAdd:At,onCreateCustom:mt,"onUpdate:search":Fe[1]||(Fe[1]=Me=>B.value=Me)},null,8,["classes","active-id","max-classes","creating","search"]),s(Ne,{data:F.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:u(()=>[s(Vt,{label:c(d)("Region")},{default:u(({row:Me})=>[o("span",{class:ue(["fct-base-taxes__region-name",Me.state?"":"fct-base-taxes__region-name--federal"])},f(Me.state?Me.stateName:n.value||e.country),3)]),_:1},8,["label"]),s(Vt,{label:c(d)("Rate"),width:"130"},{default:u(({row:Me})=>[s(qe,{modelValue:Me.rate,"onUpdate:modelValue":St=>Me.rate=St,size:"small",type:"number",step:"0.01",min:"0"},{suffix:u(()=>Fe[18]||(Fe[18]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),s(Vt,{label:c(d)("Tax Label"),width:"200"},{default:u(({row:Me})=>[s(qe,{modelValue:Me.name,"onUpdate:modelValue":St=>Me.name=St,size:"small",placeholder:c(d)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),b.value.length>0?(r(),E(Vt,{key:0,label:c(d)("Compound"),width:"310"},{default:u(({row:Me})=>[Me.state?(r(),E(ve,{key:0,"model-value":Z(Me),size:"small",style:{width:"100%"},onChange:St=>re(Me,St)},{default:u(()=>[s(me,{value:"0_0",label:Y.value[0].label},null,8,["label"]),s(me,{value:"0_1",label:Y.value[1].label},null,8,["label"]),s(me,{value:"1_0",label:Y.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]),o("div",Xfe,[m.value==="standard"?(r(),E(lt,{key:0,loading:J.value,size:"small",onClick:kt,type:"danger",soft:""},{default:u(()=>[R(f(c(d)("Reset to default")),1)]),_:1},8,["loading"])):x("",!0),s(lt,{type:"primary",size:"small",loading:Ae.value,onClick:bt},{default:u(()=>[R(f(c(d)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Tax overrides"),text:c(d)("Override tax rates for specific product categories or shipping.")},{action:u(()=>[s(lt,{size:"small",onClick:ra},{default:u(()=>[R(f(c(d)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),s(Be,null,{default:u(()=>[o("div",Zfe,[s(Ne,{data:$.value,"empty-text":c(d)("No overrides configured")},{default:u(()=>[s(Vt,{label:c(d)("Type"),width:"110"},{default:u(({row:Me})=>[s(Pe,{type:Me.type==="products"?"primary":"info",size:"small"},{default:u(()=>[R(f(Me.type==="products"?c(d)("Product"):c(d)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),s(Vt,{label:c(d)("Category")},{default:u(({row:Me})=>[R(f(Me.category_name||"—"),1)]),_:1},8,["label"]),s(Vt,{label:c(d)("Tax Label")},{default:u(({row:Me})=>[R(f(Me.tax_label||"—"),1)]),_:1},8,["label"]),s(Vt,{label:c(d)("Location")},{default:u(({row:Me})=>[R(f(Me.location),1)]),_:1},8,["label"]),s(Vt,{label:c(d)("Tax Class"),width:"130"},{default:u(({row:Me})=>[Me.type==="products"?(r(),h("span",eme,f(Me.class_label||c(d)("All")),1)):(r(),h("span",tme,f(Me.class_label||"—"),1))]),_:1},8,["label"]),s(Vt,{label:c(d)("City / Postcode")},{default:u(({row:Me})=>[Me.city||Me.postcode?(r(),h("span",ame,f([Me.city,Me.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",lme,"—"))]),_:1},8,["label"]),s(Vt,{label:c(d)("Rate"),width:"100"},{default:u(({row:Me})=>[R(f(Me.rate)+"% ",1)]),_:1},8,["label"]),s(Vt,{label:c(d)("Actions"),width:"110",align:"right"},{default:u(({row:Me})=>[o("div",sme,[s(tt,{tag:"button",size:"small",onClick:St=>Yt(Me)},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["onClick"]),s(tt,{tag:"button",size:"small",onClick:St=>al(Me),bg:"danger",outline:""},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),s(vt,{modelValue:U.value,"onUpdate:modelValue":Fe[17]||(Fe[17]=Me=>U.value=Me),title:(W.value?c(d)("Edit tax override for"):c(d)("Add tax override for"))+" "+(n.value||e.country),width:"520px","append-to-body":!0,onClose:ia},{footer:u(()=>[s(lt,{onClick:Fe[16]||(Fe[16]=Me=>U.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(lt,{type:"primary",loading:K.value,onClick:va},{default:u(()=>[R(f(W.value?c(d)("Save changes"):c(d)("Add override")),1)]),_:1},8,["loading"])]),default:u(()=>[s(gt,{"label-position":"top",model:z.value},{default:u(()=>[s(Ze,{label:c(d)("Override type")},{default:u(()=>[s(se,{modelValue:z.value.type,"onUpdate:modelValue":Fe[2]||(Fe[2]=Me=>z.value.type=Me)},{default:u(()=>[s(ft,{value:"products"},{default:u(()=>[R(f(c(d)("Products")),1)]),_:1}),s(ft,{value:"shipping"},{default:u(()=>[R(f(c(d)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),z.value.type==="products"?(r(),h(P,{key:0},[s(Ze,{label:c(d)("Category")},{default:u(()=>[s(ve,{modelValue:z.value.category_id,"onUpdate:modelValue":Fe[3]||(Fe[3]=Me=>z.value.category_id=Me),filterable:"",placeholder:c(d)("Select a category"),loading:H.value,style:{width:"100%"},onChange:ul},{default:u(()=>[(r(!0),h(P,null,ae(Q.value,Me=>(r(),E(me,{key:Me.value,label:Me.label,value:Me.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Tax Class")},{default:u(()=>[s(ve,{modelValue:z.value.class_id,"onUpdate:modelValue":Fe[4]||(Fe[4]=Me=>z.value.class_id=Me),style:{width:"100%"}},{default:u(()=>[s(me,{value:0,label:c(d)("All Tax Classes")},null,8,["label"]),(r(!0),h(P,null,ae(A.value,Me=>(r(),E(me,{key:Me.id,value:Number(Me.id),label:Me.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Tax label")},{default:u(()=>[s(qe,{modelValue:z.value.tax_label,"onUpdate:modelValue":Fe[5]||(Fe[5]=Me=>z.value.tax_label=Me),placeholder:c(d)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Location")},{default:u(()=>[s(ve,{modelValue:z.value.state,"onUpdate:modelValue":Fe[6]||(Fe[6]=Me=>z.value.state=Me),placeholder:c(d)("Select location"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,ae(ka.value,Me=>(r(),E(me,{key:Me.value,label:Me.label,value:Me.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s(Ze,{label:c(d)("City (optional)")},{default:u(()=>[s(qe,{modelValue:z.value.city,"onUpdate:modelValue":Fe[7]||(Fe[7]=Me=>z.value.city=Me),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Postcode (optional)")},{default:u(()=>[s(qe,{modelValue:z.value.postcode,"onUpdate:modelValue":Fe[8]||(Fe[8]=Me=>z.value.postcode=Me),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Tax rate (%)")},{default:u(()=>[s(qe,{modelValue:z.value.tax_rate,"onUpdate:modelValue":Fe[9]||(Fe[9]=Me=>z.value.tax_rate=Me),type:"number",step:"0.01",min:"0",placeholder:c(d)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),b.value.length>0?(r(),E(Ze,{key:0},{default:u(()=>[s(je,{modelValue:z.value.override_state_tax,"onUpdate:modelValue":Fe[10]||(Fe[10]=Me=>z.value.override_state_tax=Me)},{default:u(()=>[R(f(c(d)("Also override state/provincial taxes")),1)]),_:1},8,["modelValue"])]),_:1})):x("",!0)],64)):(r(),h(P,{key:1},[s(Ze,{label:c(d)("Tax Class")},{default:u(()=>[s(ve,{modelValue:z.value.class_id,"onUpdate:modelValue":Fe[11]||(Fe[11]=Me=>z.value.class_id=Me),style:{width:"100%"},loading:I.value},{default:u(()=>[(r(!0),h(P,null,ae(A.value,Me=>(r(),E(me,{key:Me.id,value:Number(Me.id),label:Me.title,disabled:W.value&&Number(Me.id)!==Number(O.value)&&L.value.has(Number(Me.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Location")},{default:u(()=>[s(ve,{modelValue:z.value.state,"onUpdate:modelValue":Fe[12]||(Fe[12]=Me=>z.value.state=Me),placeholder:c(d)("Select location"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,ae(tl.value,Me=>(r(),E(me,{key:Me.value,label:Me.label,value:Me.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s(Ze,{label:c(d)("City (optional)")},{default:u(()=>[s(qe,{modelValue:z.value.city,"onUpdate:modelValue":Fe[13]||(Fe[13]=Me=>z.value.city=Me),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Postcode (optional)")},{default:u(()=>[s(qe,{modelValue:z.value.postcode,"onUpdate:modelValue":Fe[14]||(Fe[14]=Me=>z.value.postcode=Me),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(Ze,{label:c(d)("Tax rate (%)")},{default:u(()=>[s(qe,{modelValue:z.value.tax_rate,"onUpdate:modelValue":Fe[15]||(Fe[15]=Me=>z.value.tax_rate=Me),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])])])])}}};class nme extends ds{getTabs(){return{all:d("All"),filed:d("Filed"),not_filed:d("Not Filed")}}getToggleableColumns(){return[{label:"ID",value:"id"},{label:"Order ID",value:"order_id"},{label:"Zip Code",value:"postcode"},{label:"Tax Rate",value:"rate"},{label:"Filed",value:"filed_at"}]}getSearchHint(){return d("Search by id, title, content or module.")}getFetchUrl(){return"taxes"}parseResponse(t){return t.taxes}getTableName(){return"taxes_table"}with(){return["admin_tax_report"]}scopes(){return["validOrder"]}}function ome(e){return nme.init(e)}const ime=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),rme=e=>{const t=Object.keys(e[0]),l=[t.map(ime).join(",")];return e.forEach(n=>{const i=t.map(A=>{let p=n[A];return typeof p=="object"&&(p=JSON.stringify(p)),typeof p=="string"&&(p=`"${p.replace(/"/g,'""')}"`),p});l.push(i.join(","))}),l.join(` |
| 285 |
`)},dme=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const n=rme(e),i=new Blob([n],{type:"text/csv"}),A=document.createElement("a"),p=()=>{window.removeEventListener("focus",p),a()};window.addEventListener("focus",p),A.href=URL.createObjectURL(i),A.download=t,A.click(),URL.revokeObjectURL(A.href),setTimeout(()=>{a()},200)}catch(n){l(n)}}),ume={class:"table-cell"},cme={class:"table-cell"},Ame={class:"table-cell"},pme={class:"table-cell"},fme={class:"table-cell"},mme={class:"table-cell"},hme={class:"table-cell"},_me={class:"table-cell"},vme={class:"table-cell"},gme={__name:"TaxesLoader",props:{nextPageCount:{type:Number,default:0},taxTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,n)=>n+1);return(l,n)=>{const i=C("el-table-column"),A=C("el-skeleton-item"),p=C("el-skeleton"),m=C("el-table");return r(),E(m,{data:c(a),class:"w-full compact-table full-compact"},{default:u(()=>[s(i,{type:"selection",width:45}),e.taxTable.isColumnVisible("id")?(r(),E(i,{key:0,width:100,label:c(d)("ID")},{default:u(()=>[o("div",ume,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.taxTable.isColumnVisible("order_id")?(r(),E(i,{key:1,label:c(d)("Order ID"),width:100},{default:u(()=>[o("div",cme,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),s(i,{label:c(d)("Tax Country"),width:120},{default:u(()=>[o("div",Ame,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),s(i,{label:c(d)("Tax Region"),width:120},{default:u(()=>[o("div",pme,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("postcode")?(r(),E(i,{key:2,label:c(d)("Zip Code"),width:120},{default:u(()=>[o("div",fme,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),s(i,{label:c(d)("Tax Name"),width:120},{default:u(()=>[o("div",mme,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("rate")?(r(),E(i,{key:3,label:c(d)("Tax Rate"),width:120},{default:u(()=>[o("div",hme,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),s(i,{label:c(d)("Sale Taxes"),width:120},{default:u(()=>[o("div",_me,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("filed_at")?(r(),E(i,{key:4,label:c(d)("Filed"),width:120},{default:u(()=>[o("div",vme,[s(p,{animated:""},{template:u(()=>[s(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},yme={class:"table-cell"},bme={class:"table-cell"},wme={class:"table-cell"},Cme={class:"table-cell"},kme={class:"table-cell"},Bme={class:"table-cell"},xme={class:"table-cell"},Sme={class:"table-cell"},$me={class:"table-cell"},Fme={__name:"AllCouponsLoader",props:{nextPageCount:{type:Number,default:0},couponTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,n)=>n+1);return(l,n)=>{const i=C("el-skeleton-item"),A=C("el-skeleton"),p=C("el-table-column"),m=C("el-table");return r(),E(m,{data:c(a),class:"w-full compact-table responsive full-compact"},{default:u(()=>[s(p,{width:103,label:c(d)("ID")},{default:u(()=>[o("div",yme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(r(),E(p,{key:0,label:c(d)("Title"),width:227},{default:u(()=>[o("div",bme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[180px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),s(p,{label:c(d)("Code"),width:206},{default:u(()=>[o("div",wme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[130px]"})]),_:1})])]),_:1},8,["label"]),s(p,{label:c(d)("Amount"),width:124},{default:u(()=>[o("div",Cme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),s(p,{label:c(d)("Usage"),width:155},{default:u(()=>[o("div",kme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(r(),E(p,{key:1,label:c(d)("Stackable"),width:124},{default:u(()=>[o("div",Bme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[80px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),s(p,{label:c(d)("Status"),width:124},{default:u(()=>[o("div",xme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),s(p,{label:c(d)("Expiry Date"),width:124},{default:u(()=>[o("div",Sme,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(r(),E(p,{key:2,label:c(d)("Actions"),width:103,align:"right"},{default:u(()=>[o("div",$me,[s(A,{animated:""},{template:u(()=>[s(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},Eme={class:"fct-taxes-page fct-layout-width"},Ume={key:1},Ime={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Vme={class:"fct-tax-filing-wrap"},Dme={class:"fct-tax-filing-summary"},Tme={class:"summary-item"},Qme={class:"summary-label"},Mme={class:"summary-value"},Lme={class:"summary-item"},Rme={class:"summary-label"},Ome={class:"summary-value"},Pme={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},Hme={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Nme={class:"dialog-footer"},Kme={class:"fct-tax-filing-success-wrap"},Gme={class:"fct-tax-filling-success-icon"},zme={class:"dialog-footer"},jme={__name:"Taxes",setup(e){const t=Object.fromEntries(Mm.map($=>[$.value,$.label])),a=$=>t[$]||$;aa().ctx;const l=ome(),n=M(!1),i=M(!1),A=M(!1),p=M([]),m=G(()=>l.getTableData().map($=>{var U,D,T,I,L,O,Q,H,K,W,z;return{id:$.id,order_id:$.order_id,country:a(((U=$.tax_rate)==null?void 0:U.country)??((D=$.meta)==null?void 0:D.tax_country)??""),state:((T=$.tax_rate)==null?void 0:T.formatted_state)??((I=$.tax_rate)==null?void 0:I.state)??"",postcode:((L=$.tax_rate)==null?void 0:L.postcode)??"",name:((O=$.tax_rate)==null?void 0:O.name)??((Q=$.meta)==null?void 0:Q.label)??"",reverse_charge:!!((H=$.meta)!=null&&H.reverse_charge_applied),rate:((K=$.tax_rate)==null?void 0:K.rate)??((W=$.meta)==null?void 0:W.rate_percent)??"",total_tax:String(parseFloat(($.total_tax/100).toFixed(2))),currency:((z=$.order)==null?void 0:z.currency)||"",total_tax:String(parseFloat(($.total_tax/100).toFixed(2))),filed_at:$.filed_at?d("Yes"):d("No")}})),_=()=>{n.value=!0,i.value=!1},g=()=>{n.value=!1,i.value=!0},y=async()=>{try{await dme(S.value),g()}catch{}},v=()=>{i.value=!1},k=()=>{const $=S.value.map(U=>U.id);ce.post(l.getFetchUrl(),{ids:$}).then(U=>{j.success(U.message),l.fetch()}).catch(U=>{j.error(U)}).finally(()=>{v()})},b=$=>{p.value=$,A.value=$.length>0},w=$=>{S.value=$},B=M(null),S=M([]),V=G(()=>{const $=S.value.reduce((D,T)=>D+parseFloat(T.total_tax||0),0),U=[...new Set(S.value.map(D=>D.order_id))];return{totalTax:_t.formatNumber(Math.round($*100),!1),totalOrders:U.length,items:S.value}}),F=()=>{$e(()=>{S.value=[...p.value],p.value.forEach($=>{B.value.toggleRowSelection($,!0)})})};return($,U)=>{const D=C("el-button"),T=C("el-tooltip"),I=C("el-table-column"),L=C("router-link"),O=C("el-tag"),Q=C("el-table"),H=C("el-dialog");return r(),h("div",Eme,[s(Xa,{title:c(d)("Taxes")},{action:u(()=>[A.value?(r(),E(D,{key:1,type:"primary",onClick:_,disabled:!A.value},{default:u(()=>[R(f(c(d)("Tax Filing")),1)]),_:1},8,["disabled"])):(r(),E(T,{key:0,"popper-class":"fct-tooltip",effect:"dark",content:c(d)("Please select the taxes you want to file"),placement:"top-start"},{default:u(()=>[s(D,{type:"primary",disabled:!A.value},{default:u(()=>[R(f(c(d)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),s(us,{table:c(l),"has-mobile-slot":!1},{default:u(()=>[c(l).isLoading()?(r(),E(gme,{key:0,taxTable:c(l),"next-page-count":c(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",Ume,[s(Q,{class:"w-full",data:m.value,onSelectionChange:b},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:u(()=>[s(I,{type:"selection",width:45}),c(l).isColumnVisible("id")?(r(),E(I,{key:0,label:c(d)("ID"),width:100},{default:u(K=>[o("span",null,"#"+f(c(d)(K.row.id)),1)]),_:1},8,["label"])):x("",!0),c(l).isColumnVisible("order_id")?(r(),E(I,{key:1,label:c(d)("Order ID"),width:100},{default:u(K=>[o("span",Ime,[s(L,{class:"link",to:{name:"view_order",params:{order_id:K.row.order_id}}},{default:u(()=>[R(" #"+f(K.row.order_id),1)]),_:2},1032,["to"]),K.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:u(()=>[R(f(c(d)("Reverse Charge")),1)]),_:1})):x("",!0)])]),_:1},8,["label"])):x("",!0),s(I,{label:c(d)("Tax Country"),width:120},{default:u(K=>[o("span",null,f(K.row.country),1)]),_:1},8,["label"]),s(I,{label:c(d)("Tax Region"),width:120},{default:u(K=>[o("span",null,f(K.row.state),1)]),_:1},8,["label"]),c(l).isColumnVisible("postcode")?(r(),E(I,{key:2,label:c(d)("Zip Code"),width:120},{default:u(K=>[o("span",null,f(K.row.postcode),1)]),_:1},8,["label"])):x("",!0),s(I,{label:c(d)("Tax Name"),width:120},{default:u(K=>[o("span",null,f(K.row.name),1)]),_:1},8,["label"]),c(l).isColumnVisible("rate")?(r(),E(I,{key:3,label:c(d)("Tax Rate"),width:120},{default:u(K=>[o("span",null,f(K.row.rate)+"%",1)]),_:1},8,["label"])):x("",!0),s(I,{label:c(d)("Sale Taxes"),width:120},{default:u(K=>[o("span",null,f(c(_t).formatForOrder(K.row.total_tax_cents,K.row.currency)),1)]),_:1},8,["label"]),c(l).isColumnVisible("filed_at")?(r(),E(I,{key:4,label:c(d)("Filed"),width:120},{default:u(K=>[o("span",null,f(K.row.filed_at),1)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),s(H,{modelValue:n.value,"onUpdate:modelValue":U[1]||(U[1]=K=>n.value=K),title:c(d)("Tax Filing"),onOpen:F,class:"fct-tax-filling-modal"},{footer:u(()=>[o("div",Nme,[s(D,{onClick:U[0]||(U[0]=()=>{n.value=!1})},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(D,{type:"primary",onClick:y},{default:u(()=>[s(X,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+f(c(d)("Download & Continue")),1)]),_:1})])]),default:u(()=>[o("div",Vme,[o("div",Dme,[o("div",Tme,[o("span",Qme,f(c(d)("Taxable Amount")),1),o("span",Mme,f(V.value.totalTax),1)]),o("div",Lme,[o("span",Rme,f(c(d)("Total Orders")),1),o("span",Ome,f(c(d)(V.value.totalOrders)),1)])]),o("div",Pme,[s(Q,{ref_key:"selectedTaxesTableRef",ref:B,data:p.value,onSelectionChange:w},{empty:u(()=>[s(wt,{icon:"Empty/ListView",text:c(d)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:u(()=>[s(I,{type:"selection",width:45}),s(I,{label:c(d)("ID"),width:100},{default:u(K=>[o("span",null,f(K.row.id),1)]),_:1},8,["label"]),s(I,{label:c(d)("Order ID"),"min-width":100},{default:u(K=>[o("span",Hme,[o("span",null,f(K.row.order_id),1),K.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:u(()=>[R(f(c(d)("Reverse Charge")),1)]),_:1})):x("",!0)])]),_:1},8,["label"]),s(I,{width:120,label:c(d)("Tax Country")},{default:u(K=>[o("span",null,f(K.row.country),1)]),_:1},8,["label"]),s(I,{width:120,label:c(d)("Tax Region")},{default:u(K=>[o("span",null,f(K.row.state),1)]),_:1},8,["label"]),s(I,{label:c(d)("Zip Code"),width:120},{default:u(K=>[o("span",null,f(K.row.postcode),1)]),_:1},8,["label"]),s(I,{width:120,label:c(d)("Tax Name")},{default:u(K=>[o("span",null,f(K.row.name),1)]),_:1},8,["label"]),s(I,{label:c(d)("Tax Rate"),width:120},{default:u(K=>[o("span",null,f(K.row.rate)+"%",1)]),_:1},8,["label"]),s(I,{width:150,label:c(d)("Sale Taxes")},{default:u(K=>[o("span",null,f(c(_t).formatForOrder(K.row.total_tax_cents,K.row.currency)),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),s(H,{modelValue:i.value,"onUpdate:modelValue":U[2]||(U[2]=K=>i.value=K),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:u(()=>[o("div",zme,[s(D,{onClick:v},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(D,{type:"primary",onClick:k},{default:u(()=>[R(f(c(d)("Mark as Filed")),1)]),_:1})])]),default:u(()=>[o("div",Kme,[o("div",Gme,[s(X,{name:"CheckCircleFill"})]),o("div",null,[o("h4",null,f(c(d)("Don't Forget to Save Your Tax File")),1),o("p",null,f(c(d)("You're about to mark this tax report as filed.")),1),o("p",null,[R(f(c(d)("Make sure you've downloaded and saved the CSV file for your records before proceeding."))+" ",1),o("a",{onClick:Ge(y,["prevent"]),class:"cursor-pointer"},f(c(d)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},qme={class:"fct-card fct-card-border fct-vat-card"},Yme={class:"fct-card-body"},Wme={class:"fct-vat-card-header"},Jme={class:"fct-vat-card-title"},Xme={class:"fct-card fct-card-border fct-vat-card mt-5"},Zme={class:"fct-card-body"},ehe={class:"fct-vat-card-header"},the={class:"fct-vat-card-title"},ahe={class:"fct-tax-rates-country-view"},lhe={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},she={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},nhe={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),h("div",null,[o("div",qme,[o("div",Yme,[o("div",Wme,[o("div",Jme,[o("h3",null,f(c(d)("Collect VAT cross-border")),1)])]),l[0]||(l[0]=o("div",{class:"fct-vat-card-body"},[o("div",{class:"fct-sk w-[200px] h-3 rounded-xs"}),o("div",{class:"fct-sk w-full h-3 rounded-xs mt-3"})],-1))])]),o("div",Xme,[o("div",Zme,[o("div",ehe,[o("div",the,[o("h3",null,f(c(d)("Tax overrides")),1)])]),o("div",ahe,[o("div",lhe,[o("div",she,[(r(),h(P,null,ae(6,n=>o("div",{key:"header-"+n,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(P,null,ae(t,n=>o("div",{key:"override-row-"+n,class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-4 border-b border-gray-100 last:border-b-0 dark:border-dark-400"},l[1]||(l[1]=[Ln('<div class="fct-sk w-16 h-6 rounded-full"></div><div class="fct-sk w-28 h-3.5 rounded-xs"></div><div class="fct-sk w-24 h-3.5 rounded-xs"></div><div class="fct-sk w-24 h-3.5 rounded-xs"></div><div class="fct-sk w-12 h-3.5 rounded-xs"></div><div class="fct-sk w-4 h-4 rounded-xs justify-self-end"></div>',6)]))),64))])])])])]))}},ohe={class:"fct-modal-body"},ihe={class:"fct-radio-option-fields"},rhe={class:"form-note"},dhe={class:"fct-radio-option-fields"},uhe={class:"fct-radio-option-fields-desc"},che={class:"form-note"},Ahe={key:0,class:"fct-info-box mt-3"},phe={class:"text-xs text-system-mid"},fhe={class:"fct-radio-option-fields"},mhe={class:"fct-radio-option-fields-desc"},hhe={__name:"EUVatCrossBorderModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},currentForm:{type:Object,default:()=>({})},initialRegistrations:{type:Array,default:()=>[]}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,n=M({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=M(!1);be(()=>a.modelValue,_=>{if(_){const g=a.initialRegistrations.length?a.initialRegistrations[0]:null,y=g?g.country:"",v=g&&g.vat||"",k=a.currentForm||{};n.value={method:k.method||"oss",oss_country:k.oss_country||y,oss_vat:k.oss_vat||v,home_country:k.home_country||y,home_vat:k.home_vat||v}}else n.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}});function A(_){const g=a.countries.find(y=>y.value===_);return g?parseFloat(g.default_rate||0):0}function p(){return a.initialRegistrations.some(_=>_.country===n.value.home_country)}function m(){if(!n.value.method){j.error(d("Select a cross-border registration type"));return}if(n.value.method==="oss"){if(!n.value.oss_country){j.error(d("Select your country of OSS registration"));return}}else if(n.value.method==="home"&&!n.value.home_country){j.error(d("Select your country of registration"));return}i.value=!0,(n.value.method==="home"&&!p()?ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:n.value.home_country,vat:n.value.home_vat,rate:A(n.value.home_country)}):Promise.resolve()).then(()=>ce.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:n.value})).then(g=>{j.success(g.message),l("saved",{method:n.value.method,oss_country:n.value.oss_country,oss_vat:n.value.oss_vat,home_country:n.value.home_country,home_country_vat:n.value.home_vat}),l("update:modelValue",!1)}).catch(g=>{var y;j.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{i.value=!1})}return(_,g)=>{const y=C("el-radio"),v=C("el-option"),k=C("el-select"),b=C("el-form-item"),w=C("el-input"),B=C("el-radio-group"),S=C("el-form"),V=C("el-button"),F=C("el-dialog");return r(),E(F,{"model-value":e.modelValue,title:c(d)("Collect across the EU"),width:"760px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":g[9]||(g[9]=$=>l("update:modelValue",$))},{footer:u(()=>[s(V,{onClick:g[8]||(g[8]=$=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(V,{type:"primary",onClick:m,loading:i.value},{default:u(()=>[R(f(c(d)("Collect VAT")),1)]),_:1},8,["loading"])]),default:u(()=>[o("div",ohe,[s(S,{"label-position":"top"},{default:u(()=>[s(B,{modelValue:n.value.method,"onUpdate:modelValue":g[7]||(g[7]=$=>n.value.method=$),class:"fct-cross-border-radios"},{default:u(()=>[o("div",{class:ue(["fct-radio-option",{"is-active":n.value.method==="oss"}]),onClick:g[2]||(g[2]=$=>n.value.method="oss")},[s(y,{value:"oss"},{default:u(()=>[R(f(c(d)("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),s(ma,{accordion:"",visible:n.value.method==="oss"},{default:u(()=>[o("div",ihe,[s(b,{label:c(d)("Country of OSS registration")},{default:u(()=>[s(k,{modelValue:n.value.oss_country,"onUpdate:modelValue":g[0]||(g[0]=$=>n.value.oss_country=$),placeholder:c(d)("Select country"),filterable:"",class:"w-full"},{default:u(()=>[(r(!0),h(P,null,ae(e.countries,$=>(r(),E(v,{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s(b,{label:c(d)("VAT number")},{default:u(()=>[s(w,{modelValue:n.value.oss_vat,"onUpdate:modelValue":g[1]||(g[1]=$=>n.value.oss_vat=$),placeholder:c(d)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",rhe,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),o("div",{class:ue(["fct-radio-option",{"is-active":n.value.method==="home"}]),onClick:g[5]||(g[5]=$=>n.value.method="home")},[s(y,{value:"home"},{default:u(()=>[R(f(c(d)("Collect using your home country registration")),1)]),_:1}),s(ma,{accordion:"",visible:n.value.method==="home"},{default:u(()=>[o("div",dhe,[o("p",uhe,f(c(d)("Applies to micro-businesses located in one EU country and making less than €10,000 in sales to other EU countries each year")),1),s(b,{label:c(d)("Country of registration")},{default:u(()=>[s(k,{modelValue:n.value.home_country,"onUpdate:modelValue":g[3]||(g[3]=$=>n.value.home_country=$),placeholder:c(d)("Select country"),filterable:"",class:"w-full"},{default:u(()=>[(r(!0),h(P,null,ae(e.countries,$=>(r(),E(v,{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s(b,{label:c(d)("VAT number")},{default:u(()=>[s(w,{modelValue:n.value.home_vat,"onUpdate:modelValue":g[4]||(g[4]=$=>n.value.home_vat=$),placeholder:c(d)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",che,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?x("",!0):(r(),h("div",Ahe,[s(X,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",phe,f(c(d)("You haven't added a home country registration. The information you add here will be used to create one for you.")),1)]))])]),_:1},8,["visible"])],2),o("div",{class:ue(["fct-radio-option",{"is-active":n.value.method==="specific"}]),onClick:g[6]||(g[6]=$=>n.value.method="specific")},[s(y,{value:"specific"},{default:u(()=>[R(f(c(d)("Collect using specific country registrations")),1)]),_:1}),s(ma,{accordion:"",visible:n.value.method==="specific"},{default:u(()=>[o("div",fhe,[o("p",mhe,f(c(d)("Register in each EU country where you are required to collect VAT. Manage your registrations in the country list below.")),1)])]),_:1},8,["visible"])],2)]),_:1},8,["modelValue"])]),_:1})])]),_:1},8,["model-value","title"])}}},_he={key:0,class:"fct-country-registrations-list mt-4"},vhe={class:"fct-home-country-header"},ghe=["src","alt"],yhe={class:"fct-vat-country-name"},bhe={key:0,class:"fct-collecting-badge"},whe={class:"fct-home-country-body"},Che={class:"fct-vat-home-field"},khe={class:"fct-vat-home-field__label"},Bhe={class:"fct-reg-rates-section"},xhe={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},She={class:"fct-reg-rates-row fct-reg-rates-header"},$he={class:"fct-reg-rates-cell-label"},Fhe={class:"fct-reg-rates-cell-label"},Ehe={key:1,class:"fct-reg-class-name"},Uhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Ihe={class:"fct-reg-rates-cell-input"},Vhe={class:"fct-reg-rates-cell-action"},Dhe=["title","onClick"],The={key:0,class:"fct-reg-add-class px-5"},Qhe={type:"button",class:"fct-reg-add-class-btn"},Mhe={class:"fct-vat-home-actions"},Lhe={__name:"EUVatHomeCountryRegistration",props:{countries:{type:Array,default:()=>[]},homeCountry:{type:String,default:""},homeVat:{type:String,default:""},taxClasses:{type:Array,default:()=>[]},registrations:{type:Array,default:()=>[]}},emits:["save-home","class-changed"],setup(e,{emit:t}){const a=e,l=t,n=M({country:"",vat:"",rates:{}}),i=M([]),A=G(()=>a.homeCountry&&a.countries.find($=>$.value===a.homeCountry)||null),p=G(()=>a.homeCountry&&a.registrations.find($=>$.country===a.homeCountry)||null),m=G(()=>{const $=p.value;return!$||!$.vat?!1:$.rates&&typeof $.rates=="object"&&Object.keys($.rates).length?Object.values($.rates).some(function(U){return U&&parseFloat(U.rate)>0}):parseFloat($.rate)>0}),_=G(()=>[...a.taxClasses,...i.value]),g=G(()=>_.value.length?_.value:[{slug:"standard",title:d("Standard")}]),y=G(()=>{if(_.value.length>=6)return[];const $=_.value.map(D=>D.slug).filter(Boolean),U=[];return $.includes("reduced")||U.push({command:"reduced",label:d("Reduced")}),$.includes("zero")||U.push({command:"zero",label:d("Zero")}),U.push({command:"custom",label:d("Custom Class...")}),U});be([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const $=p.value,U={};a.taxClasses.forEach(D=>{var O;const T=(O=$==null?void 0:$.rates)==null?void 0:O[D.slug],I=D.slug==="standard"?($==null?void 0:$.rate)??"":"",L=D.slug==="standard"?($==null?void 0:$.tax_label)??"":"";T&&typeof T=="object"?U[D.slug]={rate:T.rate??"",label:T.label??""}:U[D.slug]={rate:T??I,label:L}}),i.value.forEach(D=>{const T=v(D);U[T]=n.value.rates[T]||{rate:"",label:""}}),U.standard||(U.standard={rate:"",label:""}),n.value={country:a.homeCountry||"",vat:($==null?void 0:$.vat)||a.homeVat||"",rates:U}},{immediate:!0});function v($){return $.tempKey||$.slug}function k($){if($==="custom"){w();return}const U=$==="reduced"?d("Reduced"):d("Zero");i.value.push({slug:$,title:U,tempKey:$}),n.value.rates[$]={rate:"",label:""}}let b=0;function w(){const $="_new_"+b++;i.value.push({slug:null,title:"",tempKey:$,isNew:!0}),n.value.rates[$]={rate:"",label:""}}function B($){return $.slug?$.title||$.slug:$.title&&$.title.trim()?$.title.trim():d("Custom")}function S($){if($.hasError=!1,$.created)return Promise.resolve(null);if(!$.slug&&!($.title&&$.title.trim()))return $.hasError=!0,Promise.reject(new Error(d("Please enter a name for the custom tax class")));const U=$.slug?{slug:$.slug}:{title:$.title.trim()};return ce.post("tax/classes",U).then(D=>{const T=(D==null?void 0:D.class)||{},I=T.slug||$.slug;if(!I)throw new Error(d("Tax class creation returned an invalid response"));return!$.slug&&n.value.rates[$.tempKey]!==void 0&&(n.value.rates[I]=n.value.rates[$.tempKey],delete n.value.rates[$.tempKey],$.tempKey=null),$.slug=I,$.title=T.title||$.title,$.created=!0,T}).catch(D=>{var I;$.hasError=!0;const T=((I=D==null?void 0:D.data)==null?void 0:I.message)||d("Failed to create tax class");throw new Error(d("%1$s: %2$s",T,B($)))})}function V($){const U=v($);if(i.value.some(T=>v(T)===U)){i.value=i.value.filter(T=>v(T)!==U),delete n.value.rates[U];return}Ra(d('This will permanently delete the "%1$s" tax class and all its rates across every country (not just EU). Products using this class will fall back to Standard. Continue?',$.title),d("Delete Tax Class"),{confirmButtonText:d("Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete("tax/classes/"+$.id).then(()=>{l("class-changed")}).catch(T=>{var I;j.error(((I=T==null?void 0:T.data)==null?void 0:I.message)||d("Failed to delete tax class"))})}).catch(()=>{})}function F(){const $=i.value.map(S);Promise.all($).then(()=>{i.value=[],l("save-home",{country:n.value.country,vat:n.value.vat,rates:n.value.rates})}).catch(U=>{j.error((U==null?void 0:U.message)||d("Failed to create tax class"))})}return($,U)=>{const D=C("el-input"),T=C("el-dropdown-item"),I=C("el-dropdown-menu"),L=C("el-dropdown"),O=C("el-button");return A.value?(r(),h("div",_he,[o("div",vhe,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:A.value.label,class:"fct-flag-icon"},null,8,ghe),o("span",yhe,f(A.value.label),1),m.value?(r(),h("span",bhe,[U[1]||(U[1]=o("span",{class:"fct-green-dot"},null,-1)),R(" "+f(c(d)("Collecting")),1)])):x("",!0)]),o("div",whe,[o("div",Che,[o("label",khe,f(c(d)("VAT number")),1),s(D,{modelValue:n.value.vat,"onUpdate:modelValue":U[0]||(U[0]=Q=>n.value.vat=Q),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",Bhe,[o("div",xhe,[o("div",She,[o("div",$he,f(c(d)("Tax Classes")),1),U[2]||(U[2]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),U[3]||(U[3]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),U[4]||(U[4]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),h(P,null,ae(g.value,Q=>(r(),h("div",{key:v(Q),class:"fct-reg-rates-row"},[o("div",Fhe,[Q.isNew?(r(),E(D,{key:0,modelValue:Q.title,"onUpdate:modelValue":H=>Q.title=H,size:"small",placeholder:c(d)("Class name"),class:ue(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":Q.hasError}]),onInput:H=>Q.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",Ehe,f(Q.title),1))]),o("div",Uhe,[s(D,{modelValue:n.value.rates[v(Q)].rate,"onUpdate:modelValue":H=>n.value.rates[v(Q)].rate=H,type:"number",step:"0.01",min:"0",size:"small"},{suffix:u(()=>U[5]||(U[5]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",Ihe,[s(D,{modelValue:n.value.rates[v(Q)].label,"onUpdate:modelValue":H=>n.value.rates[v(Q)].label=H,size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Vhe,[Q.slug!=="standard"?(r(),h("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:c(d)("Delete class"),onClick:H=>V(Q)},[s(X,{name:"Delete"})],8,Dhe)):x("",!0)])]))),128))]),y.value.length?(r(),h("div",The,[y.value.length===1&&y.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:w},[s(X,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add class")),1)])):(r(),E(L,{key:1,trigger:"click",onCommand:k,"popper-class":"fct-dropdown"},{dropdown:u(()=>[s(I,null,{default:u(()=>[(r(!0),h(P,null,ae(y.value,Q=>(r(),E(T,{key:Q.command,command:Q.command},{default:u(()=>[R(f(Q.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[o("button",Qhe,[s(X,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add class")),1)])]),_:1}))])):x("",!0)]),o("div",Mhe,[s(O,{type:"primary",size:"small",onClick:F},{default:u(()=>[R(f(c(d)("Save VAT")),1)]),_:1})])])])):x("",!0)}}},Rhe={class:"fct-modal-body fct-country-reg-modal"},Ohe={class:"fct-country-reg-text"},Phe={class:"form-note"},Hhe={class:"fct-reg-rates-table"},Nhe={class:"fct-reg-rates-row fct-reg-rates-header"},Khe={class:"fct-reg-rates-cell-label"},Ghe={class:"fct-reg-rates-cell-label"},zhe={key:1,class:"fct-reg-class-name"},jhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},qhe={class:"fct-reg-rates-cell-input"},Yhe={key:1,class:"fct-reg-rates-row"},Whe={class:"fct-reg-rates-cell-label"},Jhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Xhe={class:"fct-reg-rates-cell-input"},Zhe={key:0,class:"fct-reg-add-class"},e_e={type:"button",class:"fct-reg-add-class-btn"},t_e={__name:"EUVatRegistrationModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},taxClasses:{type:Array,default:()=>[]},initialForm:{type:Object,default:()=>({country:"",vat:"",rates:{},isEdit:!1})},registeredCountries:{type:Array,default:()=>[]}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,n=M({country:"",vat:"",rates:{},isEdit:!1}),i=M([]),A=M(!1),p=G(()=>[...a.taxClasses,...i.value]),m=G(()=>{if(p.value.length>=6)return[];const V=p.value.map($=>$.slug).filter(Boolean),F=[];return V.includes("reduced")||F.push({command:"reduced",label:d("Reduced")}),V.includes("zero")||F.push({command:"zero",label:d("Zero")}),F.push({command:"custom",label:d("Custom Class...")}),F}),_=G(()=>n.value.isEdit?a.countries:a.countries.filter(V=>!a.registeredCountries.includes(V.value)));be(()=>a.modelValue,V=>{if(V){const F=a.initialForm||{},$=F.rates?JSON.parse(JSON.stringify(F.rates)):{};a.taxClasses.forEach(U=>{$[U.slug]||($[U.slug]={rate:"",label:""})}),$.standard||($.standard={rate:"",label:""}),n.value={country:F.country||"",vat:F.vat||"",rates:$,isEdit:F.isEdit||!1},i.value=[]}});function g(V){return V.tempKey||V.slug}function y(V){const F=a.countries.find($=>$.value===V);if(F&&F.default_rate){const $=n.value.rates.standard||{};n.value.rates=Object.assign({},n.value.rates,{standard:Object.assign({},$,{rate:F.default_rate})})}}function v(V){if(V==="custom"){b();return}const F=V==="reduced"?d("Reduced"):d("Zero");i.value.push({slug:V,title:F,tempKey:V}),n.value.rates[V]={rate:"",label:""}}let k=0;function b(){const V="_new_"+k++;i.value.push({slug:null,title:"",tempKey:V,isNew:!0}),n.value.rates[V]={rate:"",label:""}}function w(V){return V.slug?V.title||V.slug:V.title&&V.title.trim()?V.title.trim():d("Custom")}function B(V){if(V.hasError=!1,V.created)return Promise.resolve(null);if(!V.slug&&!(V.title&&V.title.trim()))return V.hasError=!0,Promise.reject(new Error(d("Please enter a name for the custom tax class")));const F=V.slug?{slug:V.slug}:{title:V.title.trim()};return ce.post("tax/classes",F).then($=>{const U=($==null?void 0:$.class)||{},D=U.slug||V.slug;if(!D)throw new Error(d("Tax class creation returned an invalid response"));return!V.slug&&n.value.rates[V.tempKey]!==void 0&&(n.value.rates[D]=n.value.rates[V.tempKey],delete n.value.rates[V.tempKey],V.tempKey=null),V.slug=D,V.title=U.title||V.title,V.created=!0,U}).catch($=>{var D;V.hasError=!0;const U=((D=$==null?void 0:$.data)==null?void 0:D.message)||d("Failed to create tax class");throw new Error(d("%1$s: %2$s",U,w(V)))})}function S(){if(!n.value.country){j.error(d("Select a registration country"));return}const V=n.value.rates;if(!Object.values(V).some(U=>parseFloat(U.rate)>0)){j.error(d("At least one tax rate must be greater than 0%"));return}A.value=!0;const $=i.value.map(B);Promise.all($).then(()=>ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:n.value.country,vat:n.value.vat,rates:n.value.rates})).then(U=>{j.success(U.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(U=>{var D;j.error((U==null?void 0:U.message)||((D=U==null?void 0:U.data)==null?void 0:D.message)||d("Failed to save VAT registration"))}).finally(()=>{A.value=!1})}return(V,F)=>{const $=C("el-option"),U=C("el-select"),D=C("el-form-item"),T=C("el-input"),I=C("el-dropdown-item"),L=C("el-dropdown-menu"),O=C("el-dropdown"),Q=C("el-form"),H=C("el-button"),K=C("el-dialog");return r(),E(K,{"model-value":e.modelValue,title:n.value.isEdit?c(d)("Edit VAT registration"):c(d)("Collect VAT"),"close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":F[5]||(F[5]=W=>l("update:modelValue",W))},{footer:u(()=>[s(H,{onClick:F[4]||(F[4]=W=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(H,{type:"primary",onClick:S,loading:A.value},{default:u(()=>[R(f(c(d)("Collect VAT")),1)]),_:1},8,["loading"])]),default:u(()=>[o("div",Rhe,[o("p",Ohe,f(c(d)("Make sure you're registered for VAT when collecting in the EU.")),1),s(Q,{"label-position":"top"},{default:u(()=>[s(D,{label:c(d)("Registration country")},{default:u(()=>[s(U,{modelValue:n.value.country,"onUpdate:modelValue":F[0]||(F[0]=W=>n.value.country=W),placeholder:c(d)("Select country"),filterable:"",class:"w-full",disabled:n.value.isEdit,onChange:y},{default:u(()=>[(r(!0),h(P,null,ae(_.value,W=>(r(),E($,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),s(D,{label:c(d)("VAT number")},{default:u(()=>[s(T,{modelValue:n.value.vat,"onUpdate:modelValue":F[1]||(F[1]=W=>n.value.vat=W),placeholder:n.value.country?n.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",Phe,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",Hhe,[o("div",Nhe,[o("div",Khe,f(c(d)("Tax Classes")),1),F[6]||(F[6]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),F[7]||(F[7]=o("div",{class:"fct-reg-rates-cell-input"},null,-1))]),p.value.length?(r(!0),h(P,{key:0},ae(p.value,W=>(r(),h("div",{key:W.tempKey||W.slug,class:"fct-reg-rates-row"},[o("div",Ghe,[W.isNew?(r(),E(T,{key:0,modelValue:W.title,"onUpdate:modelValue":z=>W.title=z,size:"small",placeholder:c(d)("Class name"),class:ue(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":W.hasError}]),onInput:z=>W.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",zhe,f(W.title),1))]),o("div",jhe,[s(T,{modelValue:n.value.rates[g(W)].rate,"onUpdate:modelValue":z=>n.value.rates[g(W)].rate=z,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:W.slug==="standard"?"19":"0"},{suffix:u(()=>F[8]||(F[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",qhe,[s(T,{modelValue:n.value.rates[g(W)].label,"onUpdate:modelValue":z=>n.value.rates[g(W)].label=z,size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),h("div",Yhe,[o("div",Whe,f(c(d)("Standard")),1),o("div",Jhe,[s(T,{modelValue:n.value.rates.standard.rate,"onUpdate:modelValue":F[2]||(F[2]=W=>n.value.rates.standard.rate=W),modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:"19"},{suffix:u(()=>F[9]||(F[9]=[R("%",-1)])),_:1},8,["modelValue"])]),o("div",Xhe,[s(T,{modelValue:n.value.rates.standard.label,"onUpdate:modelValue":F[3]||(F[3]=W=>n.value.rates.standard.label=W),size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),m.value.length?(r(),h("div",Zhe,[m.value.length===1&&m.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:b},[s(X,{name:"Plus"}),R(" "+f(c(d)("Add class")),1)])):(r(),E(O,{key:1,trigger:"click",onCommand:v},{dropdown:u(()=>[s(L,null,{default:u(()=>[(r(!0),h(P,null,ae(m.value,W=>(r(),E(I,{key:W.command,command:W.command},{default:u(()=>[R(f(W.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[o("button",e_e,[s(X,{name:"Plus"}),R(" "+f(c(d)("Add class")),1)])]),_:1}))])):x("",!0)]),_:1})])]),_:1},8,["model-value","title"])}}},a_e={class:"fct-oss-rates-section"},l_e=["aria-expanded"],s_e={class:"inline-flex items-center gap-2"},n_e={class:"fct-oss-rates-count"},o_e={class:"fct-oss-rates-table"},i_e={key:1,class:"text-system-mid"},r_e={class:"fct-btn-group mt-4 justify-end sm"},d_e={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=M([]),l=M([]),n=M(null),i=M("standard"),A=M(!1),p=M(!1),m=M(!1),_=M(!1),g=M(6),y=M(!1),v=M(""),k=G(()=>a.value),b=G(()=>{const D=v.value.trim().toLowerCase();return D?k.value.filter(T=>T.label&&T.label.toLowerCase().includes(D)):k.value});function w(){return A.value=!0,ce.get("tax/configuration/settings/eu-vat/oss-rates").then(D=>{a.value=D.rates||[],l.value=D.classes||[];const T=Kd({classes:l.value,activeId:n.value});return T&&(n.value=T.id,i.value=T.slug),l.value}).catch(D=>{var T;j.error((T=D==null?void 0:D.data)==null?void 0:T.message)}).finally(()=>{A.value=!1})}function B(D){n.value=D.id,i.value=D.slug}function S(D){y.value=!0,ai({payload:{slug:D},createdSlug:D,currentClasses:l.value,reloadClasses:w}).then(({createdClass:T})=>{T&&B(T)}).catch(T=>{var I;j.error((I=T==null?void 0:T.data)==null?void 0:I.message)}).finally(()=>{y.value=!1})}function V(D){y.value=!0,ai({payload:{title:D},currentClasses:l.value,reloadClasses:w}).then(({createdClass:T})=>{T&&B(T)}).catch(T=>{var I;j.error((I=T==null?void 0:T.data)==null?void 0:I.message)}).finally(()=>{y.value=!1})}function F(D){D.slug!=="standard"&&Ra(d('This will permanently delete the "%1$s" tax class and all its rates across every country (not just EU). Products using this class will fall back to Standard. Continue?',D.title),d("Delete Tax Class"),{confirmButtonText:d("Remove"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{A.value=!0,Mf({classId:D.id,currentActiveId:n.value===D.id?null:n.value,reloadClasses:w}).then(({nextActiveClass:T})=>{T&&B(T)}).catch(T=>{var I;j.error((I=T==null?void 0:T.data)==null?void 0:I.message),A.value=!1})}).catch(()=>{})}function $(){p.value=!0,ce.post("tax/configuration/settings/eu-vat/oss-rates",{rates:k.value.map(D=>({country:D.country,rate:D.rate,tax_label:D.tax_label||"",class_rates:D.class_rates||{}}))}).then(D=>{j.success(D.message)}).catch(D=>{var T;j.error((T=D==null?void 0:D.data)==null?void 0:T.message)}).finally(()=>{p.value=!1})}function U(){Ra(d("This will overwrite all EU destination country standard rates with preset defaults. Continue?"),d("Reset to default tax rates"),{confirmButtonText:d("Reset"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{m.value=!0,ce.post("tax/configuration/settings/eu-vat/reset-rates").then(()=>w()).then(()=>{j.success(d("EU tax rates have been reset to defaults"))}).catch(D=>{var T;j.error(((T=D==null?void 0:D.data)==null?void 0:T.message)||d("Failed to reset rates"))}).finally(()=>{m.value=!1})}).catch(()=>{})}return Te(w),t({loadRates:w}),(D,T)=>{const I=C("el-icon"),L=C("el-table-column"),O=C("el-input"),Q=C("el-table"),H=C("el-button"),K=Qa("loading");return r(),h("div",a_e,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:T[0]||(T[0]=W=>{_.value=!_.value,_.value||(v.value="")}),onKeydown:[T[1]||(T[1]=ea(Ge(W=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["enter"])),T[2]||(T[2]=ea(Ge(W=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["space"]))]},[o("span",s_e,[R(f(c(d)("Destination country rates"))+" ",1),o("span",n_e," ("+f(k.value.length)+") ",1)]),s(I,{class:ue(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:u(()=>[s(X,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,l_e),s(Gl,{name:"fct-collapse"},{default:u(()=>[Jt(o("div",o_e,[s(ol,{type:"info"},{content:u(()=>[o("span",null,f(c(d)("Rates are pre-filled for convenience and may not reflect current laws — verify with a tax advisor before going live. If you sell products taxed at different rates (e.g. food, books, digital goods), use the"))+" + "+f(c(d)("button to add tax classes.")),1)]),_:1}),s(Qf,{classes:l.value,"active-id":n.value,"max-classes":g.value,creating:y.value,search:v.value,onSwitch:B,onDelete:F,onAdd:S,onCreateCustom:V,"onUpdate:search":T[3]||(T[3]=W=>v.value=W)},null,8,["classes","active-id","max-classes","creating","search"]),Jt((r(),E(Q,{data:b.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":c(d)("No rates found")},{default:u(()=>[s(L,{label:c(d)("Country"),"min-width":"160"},{default:u(({row:W})=>[R(f(W.label),1)]),_:1},8,["label"]),s(L,{label:c(d)("Tax Label"),"min-width":"150"},{default:u(({row:W})=>[W.class_rates&&W.class_rates[i.value]?(r(),E(O,{key:0,modelValue:W.class_rates[i.value].label,"onUpdate:modelValue":z=>W.class_rates[i.value].label=z,size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),_:1},8,["label"]),s(L,{label:c(d)("Rate"),"min-width":"120"},{default:u(({row:W})=>[W.class_rates&&W.class_rates[i.value]?(r(),E(O,{key:0,modelValue:W.class_rates[i.value].rate,"onUpdate:modelValue":z=>W.class_rates[i.value].rate=z,modelModifiers:{number:!0},size:"small",type:"number",min:0,max:100,step:"0.5"},{suffix:u(()=>T[4]||(T[4]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),h("span",i_e,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[K,A.value]]),o("div",r_e,[i.value==="standard"?(r(),E(H,{key:0,size:"small",loading:m.value,onClick:U,type:"danger",soft:""},{default:u(()=>[R(f(c(d)("Reset to default")),1)]),_:1},8,["loading"])):x("",!0),s(H,{type:"primary",size:"small",loading:p.value,onClick:$},{default:u(()=>[R(f(c(d)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[$l,_.value]])]),_:1})])}}},u_e={class:"fct-vat-card-header"},c_e={class:"fct-vat-card-title"},A_e={class:"fct-vat-card-body"},p_e={class:"fct-vat-reg-info"},f_e={class:"fct-vat-country-name"},m_e={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},h_e={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},__e={key:2,class:"fct-country-registrations-list mt-4"},v_e={class:"fct-reg-rows"},g_e={key:0,class:"fct-vat-registration-row"},y_e={class:"fct-vat-reg-info"},b_e=["src","alt"],w_e={class:"fct-vat-country-name"},C_e={class:"fct-vat-reg-info"},k_e=["src","alt"],B_e={class:"fct-vat-country-name"},x_e={key:0,class:"fct-vat-number"},S_e={key:1,class:"fct-vat-missing-badge"},$_e={class:"fct-vat-reg-actions"},F_e={key:1,class:"fct-vat-empty-state"},E_e={class:"text-system-mid text-sm"},U_e={key:0,class:"px-5 py-3"},I_e={key:1,class:"fct-vat-cross-border-empty"},V_e={class:"fct-vat-cross-border-empty-text"},D_e={class:"fct-vat-cross-border-empty-title"},T_e={class:"fct-vat-cross-border-empty-desc"},Q_e={__name:"EUVatCrossBorderCard",props:{countries:{type:Array,default:()=>[]},initialForm:{type:Object,default:()=>({})},initialRegistrations:{type:Array,default:()=>[]},storeCountry:{type:String,default:""},isTaxEnabled:{type:Boolean,default:!0}},emits:["method-changed"],setup(e,{emit:t}){const a=e,l=t,n=M({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=M(!1),A=M(null),p=M([]),m=M(!1),_=M({country:"",vat:"",rates:{},isEdit:!1}),g=G(()=>a.countries.length||28),y=G(()=>a.initialRegistrations.filter(V).length),v=G(()=>a.storeCountry&&a.countries.find(Y=>Y.value===a.storeCountry)||null),k=G(()=>a.storeCountry?a.initialRegistrations.some(Y=>Y.country===a.storeCountry):!1),b=G(()=>{if(n.value.method!=="home"||!n.value.home_country)return!1;const Y=a.initialRegistrations.find(Z=>Z.country===n.value.home_country);return!!Y&&V(Y)}),w=G(()=>n.value.method==="oss"||n.value.method==="home"||n.value.method==="specific");function B(Y){if(!Y||!Array.isArray(a.countries))return Y;const Z=a.countries.find(re=>re.value===Y);return Z?Z.label:Y}function S(Y){return Y?Y.rates&&typeof Y.rates=="object"&&Object.keys(Y.rates).length?Object.values(Y.rates).some(Z=>Z&&parseFloat(Z.rate)>0):parseFloat(Y.rate)>0:!1}function V(Y){return!!Y&&!!Y.vat&&S(Y)}function F(Y){return S(Y)&&!Y.vat}function $(){return ce.get("tax/classes").then(Y=>{p.value=Y.classes||[]}).catch(()=>{j.error(d("Failed to load tax classes"))})}function U(Y){const Z={};return p.value.forEach(re=>{Z[re.slug]={rate:re.slug==="standard"&&Y||"",label:""}}),Z}function D(){const Y=v.value&&!k.value?a.storeCountry:"",Z=Y&&v.value&&v.value.default_rate||"";_.value={country:Y,vat:"",rates:U(Z),isEdit:!1},m.value=!0}function T(Y){const Z=Y.rates||{},re={};p.value.forEach(q=>{const Ae=Z[q.slug];if(Ae&&typeof Ae=="object")re[q.slug]={rate:Ae.rate||"",label:Ae.label||""};else{const ie=q.slug==="standard"?Y.rate||"":Ae||"";re[q.slug]={rate:ie,label:q.slug==="standard"&&Y.tax_label||""}}}),_.value={country:Y.country,vat:Y.vat||"",rates:re,isEdit:!0},m.value=!0}function I(){$(),l("method-changed",{method:n.value.method,home_country:n.value.home_country,home_vat:n.value.home_vat})}function L(Y){ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:Y.country,vat:Y.vat,rates:Y.rates}).then(Z=>{j.success(Z.message),l("method-changed",{method:n.value.method,home_country:n.value.home_country,home_vat:Y.vat})}).catch(Z=>{var re;j.error(((re=Z==null?void 0:Z.data)==null?void 0:re.message)||d("Failed to save VAT registration"))})}function O(Y){Ra(d("Are you sure you want to remove this country registration?"),d("Confirm Remove"),{confirmButtonText:d("Yes, Remove"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.post("tax/configuration/settings/eu-vat",{action:"deleteCountryRegistration",country:Y}).then(Z=>{j.success(Z.message),l("method-changed",{method:n.value.method,home_country:n.value.home_country,home_vat:n.value.home_vat})}).catch(Z=>{var re;j.error((re=Z==null?void 0:Z.data)==null?void 0:re.message)})}).catch(()=>{})}function Q(){return y.value===1?d("Collecting in 1 country"):d("Collecting in %1$s countries",y.value)}const H=G(()=>g.value===1?d("Collecting in 1 region"):d("Collecting in %1$s regions",g.value));function K(Y){n.value={method:Y.method,oss_country:Y.oss_country,oss_vat:Y.oss_vat,home_country:Y.home_country,home_vat:Y.home_country_vat},Y.method==="oss"&&$e(()=>{var Z;return(Z=A.value)==null?void 0:Z.loadRates()}),l("method-changed",{method:Y.method,home_country:Y.home_country,home_vat:Y.home_country_vat})}function W(Y){Y==="edit"?i.value=!0:Y==="stop"&&z()}function z(){Ra(d("Are you sure you want to stop collecting cross-border VAT? This will clear your OSS/home country registration."),d("Stop Collecting"),{confirmButtonText:d("Yes, Stop"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(Y=>{j.success(Y.message),n.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},l("method-changed",{method:"",home_country:"",home_vat:""})}).catch(Y=>{var Z;j.error((Z=Y==null?void 0:Y.data)==null?void 0:Z.message)})}).catch(()=>{})}return be(()=>a.initialForm,Y=>{const Z=Y||{};n.value={method:Z.method||"",oss_country:Z.oss_country||"",oss_vat:Z.oss_vat||"",home_country:Z.home_country||"",home_vat:Z.home_vat||""}},{immediate:!0}),be(()=>a.countries,Y=>{Y&&Y.length&&$()},{immediate:!0}),(Y,Z)=>{const re=C("el-tooltip"),q=C("el-dropdown-item"),Ae=C("el-dropdown-menu"),ie=C("el-dropdown"),J=C("el-button");return r(),h(P,null,[s(xe,{class:"fct-vat-card"},{default:u(()=>[s(Be,null,{default:u(()=>[o("div",u_e,[o("div",c_e,[o("h3",null,f(c(d)("Collect VAT cross-border")),1),s(re,{content:c(d)("Choose how to collect VAT for sales to other EU countries."),placement:"top"},{default:u(()=>[s(X,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),w.value?(r(),E(ie,{key:0,trigger:"click",onCommand:W,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:u(()=>[s(Ae,null,{default:u(()=>[s(q,{command:"edit"},{default:u(()=>[R(f(c(d)("Edit registration")),1)]),_:1}),s(q,{command:"stop"},{default:u(()=>[R(f(c(d)("Stop collecting")),1)]),_:1})]),_:1})]),default:u(()=>[s(tt,{border:"none",size:"small",tag:"button"},{default:u(()=>[s(X,{name:"More"})]),_:1})]),_:1})):x("",!0)]),o("div",A_e,[w.value?(r(),h(P,{key:0},[o("div",p_e,[Z[4]||(Z[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",f_e,f(n.value.method==="oss"?c(d)("EU (OSS)"):n.value.method==="home"?c(d)("EU (micro-business)"):c(d)("EU (specific countries)")),1),e.isTaxEnabled&&(n.value.method!=="specific"||y.value>0)?(r(),h("span",m_e,[Z[3]||(Z[3]=o("span",{class:"fct-green-dot"},null,-1)),n.value.method==="specific"?(r(),h(P,{key:0},[R(f(Q()),1)],64)):(r(),h(P,{key:1},[R(f(H.value),1)],64))])):x("",!0),e.isTaxEnabled?x("",!0):(r(),h("span",h_e,f(c(d)("Tax disabled")),1))]),n.value.method==="home"?(r(),E(ol,{key:0,type:b.value?"info":"warning",icon:"Info",class:"mb-4 mt-4",content:b.value?c(d)("Collecting cross-border EU VAT at your %1$s home country rate. This is for small businesses whose total cross-border EU sales stay below €10,000/year. Once you exceed that threshold you must charge each buyer's local VAT rate instead.",B(n.value.home_country)):c(d)("Your %1$s home country VAT rate will apply to all EU cross-border sales. This is available for small businesses below €10,000/year in cross-border EU sales. Make sure %1$s is registered below with the correct rate.",B(n.value.home_country))},null,8,["type","content"])):x("",!0),n.value.method==="home"?(r(),E(Lhe,{key:1,countries:e.countries,"home-country":n.value.home_country,"home-vat":n.value.home_vat,"tax-classes":p.value,registrations:e.initialRegistrations,onSaveHome:L,onClassChanged:$},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):x("",!0),n.value.method==="specific"?(r(),h("div",__e,[o("div",v_e,[v.value&&!k.value?(r(),h("div",g_e,[o("div",y_e,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,b_e),o("span",w_e,f(v.value.label),1)]),s(J,{size:"small",onClick:D},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})])):x("",!0),(r(!0),h(P,null,ae(e.initialRegistrations,N=>(r(),h("div",{key:N.country,class:"fct-vat-registration-row"},[o("div",C_e,[o("img",{src:`https://flagcdn.com/w40/${N.country.toLowerCase()}.png`,alt:B(N.country),class:"fct-flag-icon"},null,8,k_e),o("span",B_e,f(B(N.country)),1),N.vat?(r(),h("span",x_e,f(N.vat),1)):F(N)?(r(),h("span",S_e,f(c(d)("VAT ID missing")),1)):x("",!0)]),o("div",$_e,[S(N)?(r(),E(tt,{key:0,border:"none",size:"small",tag:"button",title:c(d)("Edit"),onClick:le=>T(N)},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),E(J,{key:1,size:"small",onClick:le=>T(N)},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:2},1032,["onClick"])),s(tt,{border:"none",size:"small",tag:"button",title:c(d)("Delete"),onClick:le=>O(N.country)},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),h("div",F_e,[o("p",E_e,f(c(d)("No country VAT registrations configured.")),1),s(J,{type:"primary",size:"small",onClick:D},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})])):x("",!0)]),e.initialRegistrations.length||v.value?(r(),h("div",U_e,[s(J,{type:"primary",link:"",onClick:D},{default:u(()=>[R(" + "+f(c(d)("Collect in another country")),1)]),_:1})])):x("",!0)])):x("",!0),n.value.method==="oss"?(r(),E(d_e,{key:3,ref_key:"ossRatesRef",ref:A},null,512)):x("",!0)],64)):(r(),h("div",I_e,[Z[5]||(Z[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",V_e,[o("p",D_e,f(c(d)("Not collecting cross-border VAT")),1),o("p",T_e,f(c(d)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),s(J,{size:"small",onClick:Z[0]||(Z[0]=N=>i.value=!0),type:"primary"},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),s(hhe,{modelValue:i.value,"onUpdate:modelValue":Z[1]||(Z[1]=N=>i.value=N),countries:e.countries,"current-form":n.value,"initial-registrations":e.initialRegistrations,onSaved:K},null,8,["modelValue","countries","current-form","initial-registrations"]),s(t_e,{modelValue:m.value,"onUpdate:modelValue":Z[2]||(Z[2]=N=>m.value=N),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(N=>N.country),onSaved:I},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},M_e={__name:"EUVatTaxOverrideModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},taxClasses:{type:Array,default:()=>[]},editRow:{type:Object,default:null}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,n=M({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}),i=M([]),A=M(!1),p=M(!1);function m(){return a.taxClasses&&a.taxClasses.length>0&&Number(a.taxClasses[0].id)||0}function _(){n.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}}function g(w){if(w.type==="shipping")n.value={type:"shipping",original_type:"shipping",original_id:w.id,category_id:"",category_name:"",country:w._raw.country||"",city:w._raw.city||"",postcode:w._raw.postcode||"",tax_label:w.tax_label,tax_rate:w.rate,class_id:Number(w._raw.class_id)||m(),id:w.id};else{const B=w._raw.meta_value||w._raw;n.value={type:"products",original_type:"products",original_id:w.id,category_id:dn(B.category_id),category_name:w.category_name,country:B.country||"",city:B.city||"",postcode:B.postcode||"",tax_label:w.tax_label,tax_rate:w.rate,class_id:Number(w.class_id)||0,id:w.id}}}be(()=>a.modelValue,w=>{w&&(a.editRow?g(a.editRow):_(),y())}),be(()=>n.value.type,w=>{w==="shipping"&&!n.value.class_id&&(n.value.class_id=m())}),be(()=>a.taxClasses,w=>{n.value.type==="shipping"&&!n.value.class_id&&w&&w.length>0&&(n.value.class_id=Number(w[0].id)||0)});function y(){i.value.length>0||(A.value=!0,ce.get("products/fetch-term").then(w=>{const B=w.taxonomies&&w.taxonomies["product-categories"]?w.taxonomies["product-categories"].terms||[]:[];i.value=B.map(S=>({...S,value:dn(S.value)}))}).catch(()=>{j.error(d("Failed to load product categories"))}).finally(()=>{A.value=!1}))}function v(w,B){return ce.get("tax/rates/country/rates/"+w,{class_id:B}).then(S=>{const F=(S&&S.tax_rates?S.tax_rates:[]).find(function(U){return!U.state&&!U.city&&!U.postcode});if(F)return F;const $=a.countries.find(function(U){return U.value===w});return ce.post("tax/country/rate",{country:w,state:"",rate:$&&$.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:B}).then(function(U){return U&&U.tax_rate?U.tax_rate:null})})}function k(w){const B=dn(w),S=i.value.find(V=>V.value===B);S&&(n.value.category_name=S.label)}function b(){if(n.value.type==="products"&&!n.value.category_id){j.error(d("Please select a category"));return}if(!n.value.country){j.error(d("Please select a location"));return}if(n.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){j.error(d("Tax classes are not available. Please reload the page and try again."));return}if(!n.value.class_id){j.error(d("Please select a tax class"));return}}if(p.value=!0,n.value.type==="products")ce.post("tax/product-overrides",{id:n.value.original_type==="products"?n.value.original_id:"",source_type:n.value.original_type,source_id:n.value.original_id,country:n.value.country,state:"",city:n.value.city||"",postcode:n.value.postcode||"",category_id:n.value.category_id,category_name:n.value.category_name,tax_label:n.value.tax_label,rate:n.value.tax_rate,override_state_tax:"no",class_id:n.value.class_id||0}).then(w=>{j.success(w.message),l("saved"),l("update:modelValue",!1)}).catch(w=>{j.error(w&&w.data?w.data.message:w&&w.message?w.message:"")}).finally(()=>{p.value=!1});else{const w=n.value.class_id;v(n.value.country,w).then(B=>B?ce.post("tax/rates/country/override",{id:B.id,previous_id:n.value.original_type==="shipping"?n.value.original_id:"",source_type:n.value.original_type,source_id:n.value.original_id,class_id:w,override_tax_rate:n.value.tax_rate,city:n.value.city||"",postcode:n.value.postcode||""}).then(S=>{j.success(S.message),l("saved"),l("update:modelValue",!1)}).catch(S=>{j.error(S&&S.data?S.data.message:S&&S.message?S.message:"")}).finally(()=>{p.value=!1}):(j.error(d("No tax rate found for the selected country and tax class")),p.value=!1,null)).catch(B=>{j.error(B&&B.data?B.data.message:B&&B.message?B.message:""),p.value=!1})}}return(w,B)=>{const S=C("el-radio"),V=C("el-radio-group"),F=C("el-form-item"),$=C("el-option"),U=C("el-select"),D=C("el-input"),T=C("el-form"),I=C("el-button"),L=C("el-dialog");return r(),E(L,{"model-value":e.modelValue,title:e.editRow?c(d)("Edit tax override"):c(d)("Add tax override"),width:"520px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":B[14]||(B[14]=O=>l("update:modelValue",O))},{footer:u(()=>[s(I,{onClick:B[13]||(B[13]=O=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),s(I,{type:"primary",loading:p.value,onClick:b},{default:u(()=>[R(f(e.editRow?c(d)("Save changes"):c(d)("Add override")),1)]),_:1},8,["loading"])]),default:u(()=>[s(T,{"label-position":"top",model:n.value},{default:u(()=>[s(F,{label:c(d)("Override type")},{default:u(()=>[s(V,{modelValue:n.value.type,"onUpdate:modelValue":B[0]||(B[0]=O=>n.value.type=O)},{default:u(()=>[s(S,{value:"products"},{default:u(()=>[R(f(c(d)("Products")),1)]),_:1}),s(S,{value:"shipping"},{default:u(()=>[R(f(c(d)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),n.value.type==="products"?(r(),h(P,{key:0},[s(F,{label:c(d)("Category")},{default:u(()=>[s(U,{modelValue:n.value.category_id,"onUpdate:modelValue":B[1]||(B[1]=O=>n.value.category_id=O),filterable:"",placeholder:c(d)("Select a category"),loading:A.value,style:{width:"100%"},onChange:k},{default:u(()=>[(r(!0),h(P,null,ae(i.value,O=>(r(),E($,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),e.taxClasses.length>0?(r(),E(F,{key:0,label:c(d)("Tax Class")},{default:u(()=>[s(U,{modelValue:n.value.class_id,"onUpdate:modelValue":B[2]||(B[2]=O=>n.value.class_id=O),style:{width:"100%"}},{default:u(()=>[s($,{value:0,label:c(d)("All Tax Classes")},null,8,["label"]),(r(!0),h(P,null,ae(e.taxClasses,O=>(r(),E($,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):x("",!0),s(F,{label:c(d)("Tax label")},{default:u(()=>[s(D,{modelValue:n.value.tax_label,"onUpdate:modelValue":B[3]||(B[3]=O=>n.value.tax_label=O),placeholder:c(d)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(F,{label:c(d)("Location")},{default:u(()=>[s(U,{modelValue:n.value.country,"onUpdate:modelValue":B[4]||(B[4]=O=>n.value.country=O),placeholder:c(d)("Select country"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,ae(e.countries,O=>(r(),E($,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s(F,{label:c(d)("City (optional)")},{default:u(()=>[s(D,{modelValue:n.value.city,"onUpdate:modelValue":B[5]||(B[5]=O=>n.value.city=O),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(F,{label:c(d)("Postcode (optional)")},{default:u(()=>[s(D,{modelValue:n.value.postcode,"onUpdate:modelValue":B[6]||(B[6]=O=>n.value.postcode=O),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(F,{label:c(d)("Tax rate (%)")},{default:u(()=>[s(D,{modelValue:n.value.tax_rate,"onUpdate:modelValue":B[7]||(B[7]=O=>n.value.tax_rate=O),type:"number",step:"0.01",min:"0",placeholder:c(d)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):(r(),h(P,{key:1},[s(F,{label:c(d)("Location")},{default:u(()=>[s(U,{modelValue:n.value.country,"onUpdate:modelValue":B[8]||(B[8]=O=>n.value.country=O),placeholder:c(d)("Select country"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,ae(e.countries,O=>(r(),E($,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),e.taxClasses.length>0?(r(),E(F,{key:0,label:c(d)("Tax Class")},{default:u(()=>[s(U,{modelValue:n.value.class_id,"onUpdate:modelValue":B[9]||(B[9]=O=>n.value.class_id=O),style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,ae(e.taxClasses,O=>(r(),E($,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):x("",!0),s(F,{label:c(d)("City (optional)")},{default:u(()=>[s(D,{modelValue:n.value.city,"onUpdate:modelValue":B[10]||(B[10]=O=>n.value.city=O),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(F,{label:c(d)("Postcode (optional)")},{default:u(()=>[s(D,{modelValue:n.value.postcode,"onUpdate:modelValue":B[11]||(B[11]=O=>n.value.postcode=O),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(F,{label:c(d)("Tax rate (%)")},{default:u(()=>[s(D,{modelValue:n.value.tax_rate,"onUpdate:modelValue":B[12]||(B[12]=O=>n.value.tax_rate=O),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},L_e={class:"fct-tax-rates-country-view"},R_e={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},O_e={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_110px] gap-4 px-4 py-3 border-b border-gray-200 dark:border-dark-300"},P_e={key:0},H_e={key:1},N_e={class:"fct-btn-group sm justify-end"},K_e={__name:"EUVatTaxOverridesCard",props:{countries:{type:Array,default:()=>[]}},setup(e){const t=e,a=M([]),l=M(!1),n=M(!1),i=M(null),A=M([]);function p(k){if(!k||!Array.isArray(t.countries))return k;const b=t.countries.find(w=>w.value===k);return b?b.label:k}function m(){ce.get("tax/classes").then(k=>{A.value=k.classes||[]}).catch(()=>{j.error(d("Failed to load tax classes"))})}function _(){l.value=!0,ce.get("tax/configuration/settings/eu-vat/product-overrides").then(k=>{const b=[],w=k.overrides||[];for(const S of w){const V=S.meta_value||S;b.push({id:S.id,type:"products",tax_label:V.tax_label||"",category_name:V.category_name||"",location:p(V.country),city:V.city||"",postcode:V.postcode||"",rate:V.rate,class_id:Number(S.class_id)||0,class_label:S.class_label||"",_raw:S})}const B=k.shipping_overrides||[];for(const S of B)b.push({id:S.id,type:"shipping",tax_label:S.name||"",category_name:"",location:p(S.country),city:S.city||"",postcode:S.postcode||"",rate:S.for_shipping,class_id:Number(S.class_id)||0,class_label:S.class_label||"",_raw:S});a.value=b}).catch(()=>{a.value=[]}).finally(()=>{l.value=!1})}function g(){i.value=null,n.value=!0}function y(k){i.value=k,n.value=!0}function v(k){Ra(d("Are you sure you want to delete this override?"),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{const b=k.type==="shipping"?"tax/rates/country/override/"+k.id:"tax/product-overrides/"+k.id;ce.delete(b).then(w=>{j.success(w.message),a.value=a.value.filter(B=>!(B.id===k.id&&B.type===k.type))}).catch(w=>{var B;j.error((B=w==null?void 0:w.data)==null?void 0:B.message)})}).catch(()=>{})}return Te(()=>{m(),_()}),(k,b)=>{const w=C("el-button"),B=C("el-tag"),S=C("el-table-column"),V=C("el-table");return r(),h(P,null,[s(xe,{class:"fct-vat-card"},{default:u(()=>[s(Ve,{title:c(d)("Tax overrides"),text:c(d)("Override tax rates for specific product categories or shipping.")},{action:u(()=>[s(w,{size:"small",onClick:g},{default:u(()=>[R(f(c(d)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),s(Be,null,{default:u(()=>[o("div",L_e,[l.value?(r(),h("div",R_e,[o("div",O_e,[(r(),h(P,null,ae(6,F=>o("div",{key:"loading-header-"+F,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(P,null,ae(3,F=>o("div",{key:"loading-row-"+F,class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_110px] gap-4 px-4 py-4 border-b border-gray-100 last:border-b-0 dark:border-dark-400"},b[2]||(b[2]=[o("div",{class:"fct-sk w-16 h-6 rounded-full"},null,-1),o("div",{class:"fct-sk w-28 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-12 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-4 h-4 rounded-xs justify-self-end"},null,-1)]))),64))])):(r(),E(V,{key:1,data:a.value,"empty-text":c(d)("No overrides configured")},{default:u(()=>[s(S,{label:c(d)("Type"),width:"110"},{default:u(({row:F})=>[s(B,{type:F.type==="products"?"primary":"info",size:"small"},{default:u(()=>[R(f(F.type==="products"?c(d)("Product"):c(d)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),s(S,{label:c(d)("Category")},{default:u(({row:F})=>[R(f(F.category_name||"—"),1)]),_:1},8,["label"]),s(S,{label:c(d)("Tax Class"),width:"130"},{default:u(({row:F})=>[R(f(F.class_label||c(d)("All")),1)]),_:1},8,["label"]),s(S,{label:c(d)("Tax Label")},{default:u(({row:F})=>[R(f(F.tax_label||"—"),1)]),_:1},8,["label"]),s(S,{label:c(d)("Location")},{default:u(({row:F})=>[R(f(F.location),1)]),_:1},8,["label"]),s(S,{label:c(d)("City / Postcode")},{default:u(({row:F})=>[F.city||F.postcode?(r(),h("span",P_e,f([F.city,F.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",H_e,"—"))]),_:1},8,["label"]),s(S,{label:c(d)("Rate"),width:"100"},{default:u(({row:F})=>[R(f(F.rate)+"% ",1)]),_:1},8,["label"]),s(S,{label:c(d)("Actions"),width:"110",align:"right"},{default:u(({row:F})=>[o("div",N_e,[s(tt,{tag:"button",size:"small",onClick:$=>y(F)},{default:u(()=>[s(X,{name:"Edit"})]),_:2},1032,["onClick"]),s(tt,{tag:"button",size:"small",onClick:$=>v(F),bg:"danger",outline:""},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),s(M_e,{modelValue:n.value,"onUpdate:modelValue":[b[0]||(b[0]=F=>n.value=F),b[1]||(b[1]=F=>!F&&(i.value=null))],countries:e.countries,"tax-classes":A.value,"edit-row":i.value,onSaved:_},null,8,["modelValue","countries","tax-classes","edit-row"])],64)}}},G_e={class:"setting-wrap"},z_e={class:"setting-wrap-inner"},j_e={class:"fct-tax-collection-page"},q_e={__name:"EUVatSettings",setup(e){const t=M(!0),a=Ke.get("eu_vat_county_options",[]),l=M(""),n=M(""),i=M([]),A=M({}),p=G(()=>!!Ke.get("is_tax_enabled"));function m(){return t.value=!0,ce.get("tax/configuration/settings").then(g=>{var v;const y=((v=g.settings)==null?void 0:v.eu_vat_settings)||{};l.value=g.store_country||"",i.value=y.country_registrations||[],A.value=y,n.value=y.method||""}).catch(g=>{var y;j.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{t.value=!1})}function _({method:g}){n.value=g||"",m()}return Te(m),(g,y)=>(r(),h("div",G_e,[s($a,{heading:c(d)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",z_e,[s(Fa),o("div",j_e,[t.value?(r(),E(nhe,{key:0})):(r(),h(P,{key:1},[s(Q_e,{countries:c(a),"initial-form":A.value,"initial-registrations":i.value,"store-country":l.value,"is-tax-enabled":p.value,onMethodChanged:_},null,8,["countries","initial-form","initial-registrations","store-country","is-tax-enabled"]),s(K_e,{countries:c(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class Y_e extends ds{getTabs(){return{all:d("All"),active:d("Active"),expired:d("Inactive")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Stackable",value:"stackable"},{label:"Actions",value:"actions"}]}getSearchHint(){return d("Search by id, title, amount, code.")}getFetchUrl(){return"coupons"}parseResponse(t){return t.coupons}getTableName(){return"coupon_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}with(){return[]}}function Lf(e){return Y_e.init(e)}const W_e={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},J_e={class:"fct-table-mobile-header"},X_e={class:"fct-table-mobile-header-left"},Z_e={class:"fct-table-id-col"},eve={class:"fct-table-status-col"},tve=["onClick"],ave={class:"title"},lve={class:"value"},sve={key:0,class:"fct-table-action-col"},nve={class:"more-btn pr-0"},ove={class:"fct-table-mobile-body"},ive=["onClick"],rve={key:0,class:"fct-table-coupon-title-col"},dve={class:"fct-table-coupon-code-col"},uve=["onClick"],cve={class:"fct-table-mobile-footer"},Ave=["onClick"],pve={class:"fct-table-date-col grid"},fve={class:"title"},mve={class:"value"},hve={key:0,class:"fct-table-stackable-col"},_ve={class:"title"},vve={class:"value"},gve={class:"fct-table-amount-col"},yve={class:"title"},bve={class:"value"},wve={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:d("No customers found.")}},setup(e){at.extend(_i);const t=e,a=n=>{if(!n||n==="0000-00-00 00:00:00")return!1;const i=at.utc(n).local();return i.isValid()?i.isBefore(at()):!1},l=n=>{let i=d("Are you sure you want to delete this %s coupon. This action is not recoverable",n.coupon.title);n.action==="delete"&&Ra(i,d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete("coupons/"+n.coupon.id).then(A=>{j.success(A.message),t.table.fetch()}).catch(A=>{j.error(A)}).finally(()=>{})}).catch(()=>{})};return(n,i)=>{const A=C("router-link"),p=C("el-tooltip"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",W_e,[(r(!0),h(P,null,ae(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[o("div",J_e,[o("div",X_e,[o("div",Z_e,[s(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:u(()=>[R(" #"+f(y.id),1)]),_:2},1032,["to"])]),o("div",eve,[s(Ht,{status:y.status},{default:u(()=>[R(f(a(y.end_date)?c(d)("Expired"):y.status),1)]),_:2},1032,["status"]),y.status==="scheduled"?(r(),E(p,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:u(()=>[R(f(c(d)("Available On: %s",c(hl)(y.start_date,!0))),1)]),default:u(()=>[s(X,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),o("div",{class:"fct-table-usage-col",onClick:k=>n.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",ave,f(c(d)("Usage:")),1),o("div",lve,[R(f(y.use_count??0)+" ",1),i[0]||(i[0]=o("span",null,"/",-1)),R(" "+f(y.conditions.max_uses>0?y.conditions.max_uses:c(d)("Unlimited")),1)])],8,tve)]),e.table.isColumnVisible("actions")?(r(),h("div",sve,[s(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[s(_,null,{default:u(()=>[y.id?(r(),E(m,{key:0,class:"item-link"},{default:u(()=>[s(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id,action:"edit"}}},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),s(m,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",nve,[s(X,{name:"More"})])]),_:2},1024)])):x("",!0)]),o("div",ove,[o("div",{class:"fct-table-coupon-code-wrapper-col",onClick:k=>n.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(r(),h("div",rve,f(y.title),1)):x("",!0),o("div",dve,[o("code",{class:"copyable-content",onClick:k=>{c(ns).copy(y.code)}},f(y.code),9,uve)])],8,ive)]),o("div",cve,[o("div",{class:"fct-table-mobile-footer-row items-start",onClick:k=>n.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",pve,[o("div",fve,f(c(d)("Expiry Date")),1),o("div",mve,[isNaN(Date.parse(y.end_date))?(r(),h(P,{key:1},[R("n/a")],64)):(r(),E(Sa,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),h("div",hve,[o("div",_ve,f(c(d)("Stackable")),1),o("div",vve,f(y.stackable),1)])):x("",!0),o("div",gve,[o("div",yve,f(c(d)("Amount")),1),o("div",bve,f(y.type!=="percentage"?c(jt)(y.amount,!0):y.amount+"%"),1)])],8,Ave)])]))),128))])}}},Cve={},kve={class:"px-4 py-3"},Bve={class:"grid grid-cols-3 gap-5 mt-5"};function xve(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",kve,[(r(),h(P,null,ae(2,n=>o("div",{key:n,class:"flex items-center justify-between mb-3"},[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",Bve,[(r(),h(P,null,ae(3,n=>o("div",{key:n},[s(a,{varient:"p",class:"w-1/2"}),s(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const Sve=nt(Cve,[["render",xve]]),$ve={class:"fct-all-coupons-page fct-layout-width"},Fve={class:"fct-all-coupons-wrap"},Eve={key:1},Uve=["onClick"],Ive={class:"capitalize"},Vve={class:"more-btn mr-2"},Lc={__name:"AllCoupons",setup(e){at.extend(_i);const t=Lf(),a=M(!1),l=A=>{let p=d("Are you sure you want to delete this %s coupon. This action is not recoverable",A.coupon.title);A.action==="delete"&&Ra(p,d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete("coupons/"+A.coupon.id).then(m=>{j.success(m.message),t.fetch()}).catch(m=>{var _;m.status_code=="422"?j.validationErrors(m):j.error((_=m.data)==null?void 0:_.message)}).finally(()=>{})}).catch(()=>{})},n=()=>{ce.get("coupons/getSettings").then(A=>{a.value=!!parseInt(A.show_on_checkout)}).catch(A=>{var p;A.status_code=="422"?j.validationErrors(A):j.error((p=A.data)==null?void 0:p.message)}).finally(()=>{})},i=A=>{if(!A||A==="0000-00-00 00:00:00")return!1;const p=at.utc(A).local();return p.isValid()?p.isBefore(at()):!1};return Te(()=>{n()}),(A,p)=>{const m=C("el-button"),_=C("el-table-column"),g=C("el-tooltip"),y=C("router-link"),v=C("el-dropdown-item"),k=C("el-dropdown-menu"),b=C("el-dropdown"),w=C("el-table");return r(),E(Lt,{permission:"coupons/view"},{default:u(()=>[o("div",$ve,[s(Xa,{title:c(d)("Coupons")},{action:u(()=>[s(m,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:u(()=>[R(f(c(d)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),o("div",Fve,[s(us,{table:c(t),"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(Sve,{key:0})):x("",!0),c(t).isLoading()?x("",!0):(r(),E(wve,{key:1,table:c(t)},null,8,["table"]))]),default:u(()=>[c(t).isLoading()?(r(),E(Fme,{key:0,couponTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",Eve,[s(w,{data:c(t).getTableData(),class:"w-full compact-table full-compact"},{empty:u(()=>[s(wt,{icon:"Empty/Order","has-dark":"",text:c(d)("No coupons available at the moment.")},null,8,["text"])]),default:u(()=>[s(_,{width:100,label:c(d)("ID")},{default:u(B=>[s(ta,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id}}},{default:u(()=>[R(" #"+f(c(la)(B.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),c(t).isColumnVisible("title")?(r(),E(_,{key:0,label:c(d)("Title"),width:220},{default:u(B=>[s(ta,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id,action:"edit"}}},{default:u(()=>[R(f(B.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),s(_,{label:c(d)("Code"),width:200},{default:u(B=>[o("code",{class:"copyable-content",onClick:S=>{c(ns).copy(B.row.code)}},f(B.row.code),9,Uve)]),_:1},8,["label"]),s(_,{label:c(d)("Amount"),width:120},{default:u(B=>[s(ta,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id,action:"edit"}}},{default:u(()=>[R(f(B.row.type!=="percentage"?c(jt)(B.row.amount,!0):B.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),s(_,{label:c(d)("Usage"),width:150},{default:u(B=>[s(ta,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id,action:"edit"}}},{default:u(()=>[o("span",null,f(c(la)(B.row.use_count??0)),1),p[0]||(p[0]=o("span",{class:"px-1"},"/",-1)),o("span",null,f(B.row.conditions.max_uses>0?B.row.conditions.max_uses:c(d)("Unlimited")),1)]),_:2,__:[0]},1032,["to"])]),_:1},8,["label"]),c(t).isColumnVisible("stackable")?(r(),E(_,{key:1,label:c(d)("Stackable"),width:120},{default:u(B=>[s(ta,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id,action:"edit"}}},{default:u(()=>[o("span",Ive,f(B.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),s(_,{label:c(d)("Status"),width:120},{default:u(B=>[s(ta,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id,action:"edit"}}},{default:u(()=>[s(Ht,{status:B.row.status},{default:u(()=>[R(f(i(B.row.end_date)?c(d)("Expired"):B.row.status),1)]),_:2},1032,["status"]),B.row.status==="scheduled"?(r(),E(g,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:u(()=>[R(f(c(d)("Available On: %s",c(hl)(B.row.start_date,!0))),1)]),default:u(()=>[s(X,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),_:2},1032,["to"])]),_:1},8,["label"]),s(_,{label:c(d)("Expiry Date"),width:120},{default:u(B=>[s(ta,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id,action:"edit"}}},{default:u(()=>[o("span",null,[isNaN(Date.parse(B.row.end_date))?(r(),h(P,{key:1},[R("n/a")],64)):(r(),E(Sa,{key:0,"date-time":B.row.end_date,"with-time":!0},null,8,["date-time"]))])]),_:2},1032,["to"])]),_:1},8,["label"]),c(t).isColumnVisible("actions")?(r(),E(_,{key:2,label:c(d)("Actions"),width:100,align:"right",fixed:"right"},{default:u(B=>[s(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[s(k,null,{default:u(()=>[B.row.id?(r(),E(v,{key:0,class:"item-link"},{default:u(()=>[s(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:B.row.id,action:"edit"}}},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),s(v,{command:{action:"delete",coupon:B.row},class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",Vve,[s(X,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},Dve={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Tve={class:"single-page-header"},Qve={class:"single-page-body"},Mve={class:"fct-add-edit-coupon"},Lve={class:"fct-add-edit-coupon-main"},Rve={class:"fct-add-edit-coupon-aside"},Ove={class:"fct-admin-sidebar"},Pve={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),n=C("el-skeleton"),i=C("el-breadcrumb-item"),A=C("el-breadcrumb");return r(),h("div",Dve,[o("div",Tve,[s(A,{"separator-icon":c(Za)},{default:u(()=>[s(i,null,{default:u(()=>[s(n,{animated:!0},{template:u(()=>[s(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),s(i,null,{default:u(()=>[s(n,{animated:!0},{template:u(()=>[s(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),s(i,null,{default:u(()=>[s(n,{animated:!0},{template:u(()=>[s(l,{variant:"p",class:"w-[60px] h-4"})]),_:1})]),_:1})]),_:1},8,["separator-icon"])]),o("div",Qve,[o("div",Mve,[o("div",Lve,[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"}),s(l,{variant:"p",class:"max-w-[400px] h-4"}),s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"}),s(l,{variant:"p",class:"max-w-[400px] h-4"}),s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"}),s(l,{variant:"p",class:"max-w-[400px] h-4"}),s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"}),s(l,{variant:"p",class:"max-w-[400px] h-4"}),s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"}),s(l,{variant:"p",class:"max-w-[400px] h-4"}),s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})]),o("div",Rve,[o("div",Ove,[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),s(Be,null,{default:u(()=>[s(n,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[s(l,{variant:"p",class:"w-full h-4"}),s(l,{variant:"p",class:"w-2/3 h-4"}),s(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})])])])])])}}};at.extend(_i);at.extend(BA);const Hve={name:"AddOrEditCoupon",components:{CardContainer:xe,CardHeader:Ve,CardBody:Be,LabelHint:Ot,ValidationError:zt,CopyToClipboard:Va,DynamicTemplates:hn,SaveBar:Ns,ProductVariationSelector:xA,SingleCouponLoader:Pve,Activity:gA},beforeRouteLeave(e,t,a){var l;(l=this.keyboardShortcuts)!=null&&l.unbind&&this.keyboardShortcuts.unbind("mod+s"),a()},props:{coupon_id:{type:[String,Number],required:!0}},data(){return{changes_made:0,creating:!1,updating:!1,keyboardShortcuts:null,coupon:{type:"fixed",status:"active",stackable:"no",show_on_checkout:"no",title:"",code:"",priority:0,amount:0,start_date:"",end_date:"",notes:"",conditions:{buy_quantity:1,get_quantity:1,excluded_categories:[],included_categories:[],excluded_products:[],included_products:[],min_purchase_amount:"",max_purchase_amount:"",min_amount_basis:"subtotal",allowed_user_ids:[],allowed_user_roles:[],apply_to_quantity:"no",apply_to_whole_cart:"yes",max_per_customer:"",max_discount_amount:"",max_uses:"",buy_products:[],get_products:[],is_recurring:"no"}},validationErrors:{},minQuantity:1,maxQuantity:100,minPurchaseAmount:0,maxPurchaseAmount:1e4,minDiscountAmount:0,minLimit:0,maxLimit:1e3,categories:[],usageError:!1,isEndDateEnabled:!1,fetchingCoupon:!1,isInitialLoading:!1,showDynamicTemplates:!1,showManageActivity:!1}},computed:{ArrowRight(){return Za},maxDiscountAmount(){return this.coupon.type==="percentage"?100:999999}},watch:{coupon:{handler(){this.handleChangesMade()},deep:!0}},mounted(){this.keyboardShortcuts=As(),this.fetchTerms(),this.coupon_id?(this.fetchCoupon(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.updateCoupon()}),window.onbeforeunload=()=>{if(this.changes_made>1)return!0}):this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.addCoupon()})},methods:{translate:d,generateRandomCouponCode(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let t="";for(let a=0;a<8;a++)t+=e.charAt(Math.floor(Math.random()*e.length));this.coupon.code=t},onChangeCouponInput(e,t){if(t=parseInt(t),isNaN(t)||t===""){this.coupon[e]="";return}if(e==="priority"&&(t<0||t>100)){this.coupon[e]=0;return}if((e==="buy_quantity"||e==="get_quantity")&&(t<this.minQuantity||t>this.maxQuantity)){this.coupon[e]=this.minQuantity;return}if((e==="min_purchase_amount"||e==="max_discount_amount")&&(t<this.minPurchaseAmount||t>this.maxPurchaseAmount)){this.coupon.conditions[e]=this.minPurchaseAmount;return}if(e==="amount"){if(this.coupon.type==="fixed"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}if(this.coupon.type==="percentage"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}}if((e==="max_uses"||e==="max_per_customer")&&(t<this.minLimit||t>this.maxLimit)){this.coupon[e]=this.minLimit;return}},preventInvalidChars(e,t=!1){let a=["-",".","+"];t&&(a=["-","+"]),a.includes(e.key)&&e.preventDefault()},handleChangesMade(){this.changes_made++},setDefaultStatus(){const e=new Date,t=this.coupon.start_date?new Date(this.coupon.start_date):null,a=this.coupon.end_date?new Date(this.coupon.end_date):null;this.coupon.status!=="disabled"&&(a===null&&(this.isEndDateEnabled=!1),!t&&!a?this.coupon.status="active":t&&e<t?this.coupon.status="scheduled":a&&e>a?this.coupon.status="expired":this.coupon.status="active")},disabledStartDate(e){const t=new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},disabledEndDate(e){const t=this.coupon.start_date?new Date(this.coupon.start_date):new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},formatDate(e){return!e||e==="0000-00-00 00:00:00"?null:at(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=jt(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=jt(this.coupon.conditions.min_purchase_amount,!1):this.coupon.conditions.min_purchase_amount=""),this.coupon.conditions.max_discount_amount!==null&&(this.coupon.conditions.max_discount_amount?this.coupon.conditions.max_discount_amount=jt(this.coupon.conditions.max_discount_amount,!1):this.coupon.conditions.max_discount_amount=""),this.coupon.conditions.max_purchase_amount||(this.coupon.conditions.max_purchase_amount=""),this.coupon.conditions.max_uses||(this.coupon.conditions.max_uses=""),this.coupon.conditions.max_per_customer||(this.coupon.conditions.max_per_customer=""),this.coupon.conditions.min_purchase_amount||(this.coupon.conditions.min_purchase_amount=""))},parseProductIds(e){return Array.isArray(e)?e.map(t=>parseInt(t,10)):[]},reloadPage(){return this.changes_made=0,window.location.reload()},validateAndFormatDate(e){let t=this.formatDate(e);return t!==null&&t!=="Invalid date"?t:null},validateDate(){this.coupon.start_date=this.validateAndFormatDate(this.coupon.start_date),this.coupon.end_date=this.validateAndFormatDate(this.coupon.end_date)},fetchTerms(){ce.get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms}).catch(e=>{var t;e.status_code=="422"?j.validationErrors(e):j.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},fetchCoupon(){this.fetchingCoupon=!0,this.isInitialLoading=!0,ce.get(`coupons/${this.coupon_id}`,{}).then(e=>{var l,n;const t=(l=e==null?void 0:e.coupon)==null?void 0:l.start_date,a=(n=e==null?void 0:e.coupon)==null?void 0:n.end_date;t&&t!=="0000-00-00 00:00:00"&&(e.coupon.start_date=at.utc(t).tz(at.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=at.utc(a).tz(at.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),e=e.coupon,this.coupon=e,this.coupon.start_date=this.formatDate(this.coupon.start_date),this.coupon.end_date=this.formatDate(this.coupon.end_date),this.coupon.end_date!==null&&(this.isEndDateEnabled=!0),this.coupon.end_date=this.coupon.end_date!==null&&this.coupon.end_date!=="Invalid date"?this.coupon.end_date:null,this.coupon.conditions.excluded_products=this.parseProductIds(e.conditions.excluded_products),this.coupon.conditions.included_products=this.parseProductIds(e.conditions.included_products),this.coupon.conditions.min_amount_basis||(this.coupon.conditions.min_amount_basis="total"),this.formatAmount(),this.setDefaultStatus(),this.showDynamicTemplates=!0}).catch(e=>{var t;errors.status_code=="422"?j.validationErrors(errors):j.error((t=errors.data)==null?void 0:t.message)}).finally(()=>{this.fetchingCoupon=!1,this.isInitialLoading=!1,this.changes_made=0})},updateCoupon(){var e,t;this.updating=!0,this.validateDate(),(e=this.$refs.dynamic_templates)==null||e.beforeUpdatingData({data:{coupon:this.coupon}}),ce.put(`coupons/${this.coupon_id}`,{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var l;(l=this.$refs.dynamic_templates)==null||l.afterUpdatingData({coupon:this.coupon,response:a}),j.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var l;a.status_code=="422"?(j.validationErrors(a),this.validationErrors=a):j.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.updating=!1,this.changes_made=0})},addCoupon(){var e,t;this.creating=!0,this.validateDate(),(e=this.$refs.dynamic_templates)==null||e.beforeUpdatingData({data:{coupon:this.coupon}}),ce.post("coupons",{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var l;(l=this.$refs.dynamic_templates)==null||l.afterUpdatingData({coupon:this.coupon,response:a}),j.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var l;a.status_code=="422"?(j.validationErrors(a),this.validationErrors=a):j.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.creating=!1})}}},Nve={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Kve={class:"single-page-header"},Gve={class:"single-page-body"},zve={class:"fct-add-edit-coupon"},jve={class:"fct-add-edit-coupon-main"},qve={class:"flex gap-2 items-center justify-between w-full mb-2.5"},Yve={class:"form-note"},Wve=["innerHTML"],Jve={key:1},Xve=["innerHTML"],Zve=["innerHTML"],ege=["innerHTML"],tge={class:"fct-add-edit-coupon-aside"},age={class:"fct-admin-sidebar"},lge={class:"fct-admin-sidebar-item"},sge={key:0,class:"flex items-center gap-1"},nge={class:"text-sm font-medium text-system-dark dark:text-gray-300"},oge={key:1},ige={class:"fct-admin-sidebar-item mt-5 hidden"},rge={class:"sidebar-title mb-3"},dge={class:"fct-bullet-lists"},uge={class:"fct-admin-sidebar-item mt-5 hidden"},cge={class:"sidebar-title mb-3"},Age={class:"fct-bullet-lists"},pge={key:0};function fge(e,t,a,l,n,i){const A=C("SaveBar"),p=C("SingleCouponLoader"),m=C("el-breadcrumb-item"),_=C("el-breadcrumb"),g=C("CardHeader"),y=C("el-input"),v=C("ValidationError"),k=C("el-form-item"),b=C("el-col"),w=C("LabelHint"),B=C("el-row"),S=C("CardBody"),V=C("CardContainer"),F=C("el-option"),$=C("el-select"),U=C("el-radio"),D=C("el-radio-group"),T=C("ProductVariationSelector"),I=C("el-checkbox"),L=C("el-form"),O=C("CopyToClipboard"),Q=C("el-date-picker"),H=C("DynamicTemplates"),K=C("Activity");return r(),h("div",Nve,[s(A,{isActive:n.changes_made>0?"is-active":"",loading:a.coupon_id?n.updating:n.creating,onSave:t[0]||(t[0]=W=>a.coupon_id?i.updateCoupon():i.addCoupon()),onDiscard:i.reloadPage,"show-cmnd-icon":!0,saveButtonText:a.coupon_id?i.translate("Update"):i.translate("Create")},null,8,["isActive","loading","onDiscard","saveButtonText"]),n.fetchingCoupon?(r(),E(p,{key:0})):x("",!0),n.fetchingCoupon?x("",!0):(r(),h(P,{key:1},[o("div",Kve,[s(_,{"separator-icon":i.ArrowRight},{default:u(()=>[s(m,{to:{name:"coupons"}},{default:u(()=>[R(f(i.translate("Coupons")),1)]),_:1}),s(m,null,{default:u(()=>[R(f(a.coupon_id?i.translate("Edit Coupon"):i.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),E(m,{key:0},{default:u(()=>[R(f(n.coupon.title),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"])]),o("div",Gve,[o("div",zve,[o("div",jve,[s(L,{model:n.coupon,"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[s(V,null,{default:u(()=>[s(g,{title:i.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,{class:"pb-1.5"},{default:u(()=>[s(B,{gutter:20},{default:u(()=>[s(b,{lg:24},{default:u(()=>[s(k,{label:i.translate("Title"),required:""},{default:u(()=>{var W,z;return[s(y,{modelValue:n.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=Y=>n.coupon.title=Y),placeholder:i.translate("Enter title"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(z=n.validationErrors)!=null&&z.hasOwnProperty("title")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"title"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),s(b,{lg:12},{default:u(()=>[s(k,null,{default:u(()=>{var W,z;return[o("div",qve,[s(w,{title:i.translate("Code"),required:""},null,8,["title"]),o("span",{class:"text-system-dark text-xs cursor-pointer hover:underline dark:text-gray-50 underline",onClick:t[2]||(t[2]=(...Y)=>i.generateRandomCouponCode&&i.generateRandomCouponCode(...Y))},f(i.translate("Generate Random Code")),1)]),s(y,{modelValue:n.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=Y=>n.coupon.code=Y),placeholder:i.translate("Eg. COUPON10"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(z=n.validationErrors)!=null&&z.hasOwnProperty("code")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"code"},null,8,["validation-errors"])):x("",!0),o("div",Yve,[o("p",null,f(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),s(b,{lg:12},{default:u(()=>[s(k,null,{label:u(()=>[s(w,{title:i.translate("Coupon Priority"),content:i.translate("Coupons will be calculated based on their priority. The lower the number the higher the priority is.")},null,8,["title","content"])]),default:u(()=>{var W,z;return[s(y,{modelValue:n.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=Y=>n.coupon.priority=Y),type:"number",placeholder:i.translate("Enter priority"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=Y=>{i.onChangeCouponInput("priority",Y)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","onKeypress"]),(z=n.validationErrors)!=null&&z.hasOwnProperty("priority")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"priority"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),s(V,null,{default:u(()=>[s(g,{title:i.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,{class:"pb-1.5"},{default:u(()=>[s(B,{gutter:20},{default:u(()=>[s(b,{lg:8},{default:u(()=>[s(k,{label:i.translate("Type"),required:""},{default:u(()=>{var W;return[s($,{modelValue:n.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=z=>n.coupon.type=z),placeholder:i.translate("Select coupon type"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:u(()=>[s(F,{label:i.translate("Fixed"),value:"fixed"},null,8,["label"]),s(F,{label:i.translate("Percentage"),value:"percentage"},null,8,["label"])]),_:1},8,["modelValue","placeholder","class"])]}),_:1},8,["label"])]),_:1}),n.coupon.type==="fixed"||n.coupon.type==="percentage"?(r(),h(P,{key:0},[s(b,{lg:8},{default:u(()=>[s(k,{label:n.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:u(()=>{var W;return[s(y,{modelValue:n.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=z=>n.coupon.amount=z),type:"number",placeholder:"0.00",min:n.minDiscountAmount,max:i.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=z=>{i.onChangeCouponInput("amount",z)}),onKeypress:t[9]||(t[9]=z=>i.preventInvalidChars(z,!0))},{prefix:u(()=>[n.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,Wve)):(r(),h("span",Jve,"%"))]),_:1},8,["modelValue","min","max"]),(W=n.validationErrors)!=null&&W.hasOwnProperty("amount")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"amount"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),n.coupon.type==="percentage"?(r(),E(b,{key:0,lg:8},{default:u(()=>[s(k,{label:i.translate("Max Discount Amount")},{default:u(()=>{var W;return[s(y,{modelValue:n.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=z=>n.coupon.conditions.max_discount_amount=z),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Xve)]),_:1},8,["modelValue","placeholder","class"]),s(v,{"validation-errors":n.validationErrors,"field-key":"max_discount_amount"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})):x("",!0)],64)):x("",!0)]),_:1})]),_:1})]),_:1}),s(V,null,{default:u(()=>[s(g,{title:i.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,{class:"pb-1.5"},{default:u(()=>[s(B,{gutter:20},{default:u(()=>[s(b,{lg:12},{default:u(()=>[s(k,null,{label:u(()=>[s(w,{title:i.translate("Min Spend Amount"),content:i.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:u(()=>{var W,z;return[s(y,{modelValue:n.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=Y=>n.coupon.conditions.min_purchase_amount=Y),type:"number",placeholder:"0.00",class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Zve)]),_:1},8,["modelValue","class"]),(z=n.validationErrors)!=null&&z.hasOwnProperty("min_purchase_amount")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"min_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),s(b,{lg:12},{default:u(()=>[s(k,null,{label:u(()=>[s(w,{title:i.translate("Max Spend Amount"),content:i.translate("Set the maximum spend (subtotal) allowed when using the coupon.")},null,8,["title","content"])]),default:u(()=>{var W,z;return[s(y,{modelValue:n.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=Y=>n.coupon.conditions.max_purchase_amount=Y),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,ege)]),_:1},8,["modelValue","placeholder","class"]),(z=n.validationErrors)!=null&&z.hasOwnProperty("max_purchase_amount")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"max_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),s(b,{lg:24},{default:u(()=>[s(k,null,{label:u(()=>[s(w,{title:i.translate("Spend Amount Based On"),content:i.translate("Choose what the min/max spend limits are measured against: the cart subtotal (items only) or the order total (including shipping and fees). Applies at checkout.")},null,8,["title","content"])]),default:u(()=>[s(D,{modelValue:n.coupon.conditions.min_amount_basis,"onUpdate:modelValue":t[13]||(t[13]=W=>n.coupon.conditions.min_amount_basis=W)},{default:u(()=>[s(U,{value:"subtotal",label:i.translate("Subtotal (items only)")},null,8,["label"]),s(U,{value:"total",label:i.translate("Total (includes shipping & fees)")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),s(b,{md:12},{default:u(()=>[s(k,{label:i.translate("Include Categories")},{default:u(()=>[s($,{modelValue:n.coupon.conditions.included_categories,"onUpdate:modelValue":t[14]||(t[14]=W=>n.coupon.conditions.included_categories=W),multiple:"",placeholder:i.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:u(()=>[(r(!0),h(P,null,ae(n.categories,W=>(r(),E(F,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),s(b,{md:12},{default:u(()=>[s(k,{label:i.translate("Exclude Categories")},{default:u(()=>[s($,{modelValue:n.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[15]||(t[15]=W=>n.coupon.conditions.excluded_categories=W),multiple:"",placeholder:i.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:u(()=>[(r(!0),h(P,null,ae(n.categories,W=>(r(),E(F,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),s(b,{md:24},{default:u(()=>[s(k,{label:i.translate("Include Products")},{default:u(()=>[s(T,{modelValue:n.coupon.conditions.included_products,"onUpdate:modelValue":t[16]||(t[16]=W=>n.coupon.conditions.included_products=W)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),s(b,{md:24},{default:u(()=>[s(k,{label:i.translate("Excluded Products")},{default:u(()=>[s(T,{modelValue:n.coupon.conditions.excluded_products,"onUpdate:modelValue":t[17]||(t[17]=W=>n.coupon.conditions.excluded_products=W)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),s(b,{md:24},{default:u(()=>[s(k,null,{label:u(()=>[s(w,{title:i.translate("By Email Address"),content:i.translate("List of email addresses that can use the coupon. Separate multiple emails with commas. You may also use regular expressions.")},null,8,["title","content"])]),default:u(()=>{var W;return[s(y,{autocomplete:"off",modelValue:n.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[18]||(t[18]=z=>n.coupon.conditions.email_restrictions=z),type:"text",placeholder:i.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(W=n.validationErrors)!=null&&W.hasOwnProperty("email_restrictions")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"email_restrictions"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),s(b,{md:24},{default:u(()=>{var W;return[s(k,null,{label:u(()=>[s(w,{title:i.translate("Recurring Coupon"),content:i.translate("Mark this coupon as recurring to apply it automatically to every future subscription order. This discount will automatically apply on every renewal. However, the coupon will not be applied if it reduces the payable amount to zero.")},null,8,["title","content"])]),default:u(()=>[s(I,{modelValue:n.coupon.conditions.is_recurring,"onUpdate:modelValue":t[19]||(t[19]=z=>n.coupon.conditions.is_recurring=z),label:i.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(W=n.validationErrors)!=null&&W.hasOwnProperty("is_recurring")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"is_recurring"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),s(V,null,{default:u(()=>[s(g,{title:i.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,{class:"pb-1.5"},{default:u(()=>[s(B,{gutter:20},{default:u(()=>[s(b,{lg:12},{default:u(()=>[s(k,null,{label:u(()=>[s(w,{title:i.translate("Total Limit"),content:i.translate("Total number of times this coupon can be redeemed across the entire store.")},null,8,["title","content"])]),default:u(()=>{var W,z;return[s(y,{modelValue:n.coupon.conditions.max_uses,"onUpdate:modelValue":t[20]||(t[20]=Y=>n.coupon.conditions.max_uses=Y),type:"number",placeholder:i.translate("Total limit"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("max_uses")?"is-error":n.usageError),min:n.minLimit,max:n.maxLimit,onInput:t[21]||(t[21]=Y=>{i.onChangeCouponInput("max_uses",Y)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),(z=n.validationErrors)!=null&&z.hasOwnProperty("max_uses")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"max_uses"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),s(b,{lg:12},{default:u(()=>[s(k,null,{label:u(()=>[s(w,{title:i.translate("Per Logged in User Limit"),content:i.translate("Maximum an logged in user can use. 0 means unlimited. Only logged in user can use this coupon.")},null,8,["title","content"])]),default:u(()=>[s(y,{modelValue:n.coupon.conditions.max_per_customer,"onUpdate:modelValue":t[22]||(t[22]=W=>n.coupon.conditions.max_per_customer=W),type:"number",placeholder:i.translate("Max limit per logged in user"),class:ue(n.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:n.minLimit,max:n.maxLimit,onInput:t[23]||(t[23]=W=>{i.onChangeCouponInput("max_per_customer",W)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),s(v,{"validation-errors":n.validationErrors,"field-key":"max_per_customer"},null,8,["validation-errors"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),s(V,null,{default:u(()=>[s(g,{title:i.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,{class:"pb-1.5"},{default:u(()=>[s(B,{gutter:20},{default:u(()=>[s(b,{lg:24},{default:u(()=>[s(k,{label:i.translate("Status")},{default:u(()=>[s(D,{modelValue:n.coupon.status,"onUpdate:modelValue":t[24]||(t[24]=W=>n.coupon.status=W)},{default:u(()=>[s(U,{value:"active",label:i.translate("Active")},null,8,["label"]),s(U,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),s(U,{disabled:"",value:"expired",label:i.translate("Expired")},null,8,["label"])]),_:1},8,["modelValue"]),s(v,{"validation-errors":n.validationErrors,"field-key":"status"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),s(b,{lg:24},{default:u(()=>[s(k,{label:i.translate("Internal Notes")},{default:u(()=>{var W;return[s(y,{modelValue:n.coupon.notes,"onUpdate:modelValue":t[25]||(t[25]=z=>n.coupon.notes=z),type:"textarea",placeholder:i.translate("Enter note"),class:ue((W=n.validationErrors)!=null&&W.hasOwnProperty("notes")?"is-error":"")},null,8,["modelValue","placeholder","class"]),s(v,{"validation-errors":n.validationErrors,"field-key":"notes"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),s(b,{lg:24},{default:u(()=>{var W;return[s(k,null,{label:u(()=>[s(w,{title:i.translate("Stackable"),content:i.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:u(()=>[s(D,{modelValue:n.coupon.stackable,"onUpdate:modelValue":t[26]||(t[26]=z=>n.coupon.stackable=z)},{default:u(()=>[s(U,{value:"yes"},{default:u(()=>[R(f(i.translate("Yes")),1)]),_:1}),s(U,{value:"no"},{default:u(()=>[R(f(i.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(W=n.validationErrors)!=null&&W.hasOwnProperty("stackable")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"stackable"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),o("div",tge,[o("div",age,[s(V,null,{default:u(()=>[s(g,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,null,{default:u(()=>[o("div",lge,[n.coupon.code?(r(),h("div",sge,[o("span",nge,f(i.translate("Coupon code"))+": "+f(n.coupon.code),1),s(O,{text:n.coupon.code,showMode:"basic_copy_btn",tooltipText:i.translate("Copy discount code")},null,8,["text","tooltipText"])])):(r(),h("div",oge,f(i.translate("No discount code yet")),1))]),o("div",ige,[o("h4",rge,f(i.translate("Type & Method")),1),o("ul",dge,[o("li",null,[o("span",null,f(i.translate("Amount off Products")),1)]),o("li",null,[o("span",null,f(i.translate("Code")),1)])])]),o("div",uge,[o("h4",cge,f(i.translate("Details")),1),o("ul",Age,[o("li",null,[o("span",null,f(i.translate("For Online Store")),1)]),o("li",null,[o("span",null,f(i.translate("No Min Purchase Requirement")),1)]),o("li",null,[o("span",null,f(i.translate("All Customers")),1)])])])]),_:1})]),_:1}),s(V,null,{default:u(()=>[s(g,{title:i.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,{class:"pb-1.5"},{default:u(()=>[s(L,{"label-position":"top"},{default:u(()=>[s(B,{gutter:20},{default:u(()=>[s(b,{lg:24},{default:u(()=>[s(k,{label:i.translate("Start Date & Time")},{default:u(()=>[s(Q,{modelValue:n.coupon.start_date,"onUpdate:modelValue":t[27]||(t[27]=W=>n.coupon.start_date=W),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:i.translate("Start date & time"),onChange:i.setDefaultStatus,"disabled-date":i.disabledStartDate},null,8,["modelValue","placeholder","onChange","disabled-date"])]),_:1},8,["label"])]),_:1}),s(b,{lg:24},{default:u(()=>[s(k,null,{default:u(()=>[s(I,{modelValue:n.isEndDateEnabled,"onUpdate:modelValue":t[28]||(t[28]=W=>n.isEndDateEnabled=W),label:i.translate("Set end date & time"),onChange:t[29]||(t[29]=W=>{W||(n.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),n.isEndDateEnabled?(r(),E(b,{key:0,lg:24},{default:u(()=>[s(k,{label:i.translate("End Date & Time")},{default:u(()=>[s(Q,{modelValue:n.coupon.end_date,"onUpdate:modelValue":t[30]||(t[30]=W=>n.coupon.end_date=W),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:i.translate("End date & time"),onChange:i.setDefaultStatus,"disabled-date":i.disabledEndDate},null,8,["modelValue","placeholder","onChange","disabled-date"]),n.validationErrors.hasOwnProperty("end_date")?(r(),E(v,{key:0,"validation-errors":n.validationErrors,"field-key":"end_date"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})):x("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),n.showDynamicTemplates?(r(),h("div",pge,[s(H,{filter:"fluent_cart_single_coupon_page",ref:"dynamic_templates",data:{coupon:n.coupon},widgetsQuery:{coupon_id:n.coupon.id},onChange:i.handleChangesMade},null,8,["data","widgetsQuery","onChange"])])):x("",!0),s(V,null,{default:u(()=>[s(g,{title:i.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),s(S,null,{default:u(()=>[s(K,{onReload:i.fetchCoupon,activities:n.coupon.activities||[],showManageActivity:n.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const mge=nt(Hve,[["render",fge]]),hge={class:"fct-reviews-route-wrap"},_ge=Object.assign({name:"ReviewsRoute"},{__name:"ReviewsRoute",setup(e){const t=Pa();return(a,l)=>{const n=C("router-view");return r(),h("div",hge,[(r(),E(n,{key:c(t).query.post_id||"default"}))])}}});class vge extends ds{constructor(t={}){super(t),this.data.postId=t.postId||null}buildQueryParams(){const t=super.buildQueryParams();return this.data.postId&&(t.post_id=this.data.postId),t}getPostId(){return this.data.postId}shouldDisableFilters(){return!!this.data.postId}isUsingSimpleFilter(){return super.isUsingSimpleFilter()&&!this.shouldDisableFilters()}isAdvanceFilterEnabled(){return super.isAdvanceFilterEnabled()&&!this.shouldDisableFilters()}setupInitialData(){super.setupInitialData(),this.shouldDisableFilters()&&(this.data.filterType="simple",this.data.searching=!1,this.data.search="",this.data.advanceFilters=[[]],this.data.activeSavedViewId&&(this.data.activeSavedViewId=null,this.data.savedViewQueryParams=null,this.data.selectedView=this.getDefaultView(),Qt.set(this.getTabStorageName(),this.getDefaultView()),Rs.pushToVueUrl(null,{active_view:this.getDefaultView()})))}getSavedViews(){return this.shouldDisableFilters()?[]:super.getSavedViews()}applySavedView(t){this.shouldDisableFilters()||super.applySavedView(t)}getTabs(){return{all:d("All"),approved:d("Approved"),pending:d("Pending"),spam:d("Spam"),trash:d("Trash")}}getToggleableColumns(){return[{label:d("Reviewer"),value:"reviewer"},{label:d("Rating"),value:"rating"},{label:d("Content"),value:"content"},{label:d("Status"),value:"status"},{label:d("Date"),value:"date"},{label:d("Actions"),value:"actions"}]}getSortableColumns(){return[{label:d("ID"),value:"id"},{label:d("Rating"),value:"rating"},{label:d("Reviewer"),value:"reviewer_name"},{label:d("Created At"),value:"created_at"}]}getSearchHint(){return d("Search by title, content, reviewer name, email or product name.")}getFetchUrl(){return"reviews"}parseResponse(t){return t.reviews}getTableName(){return"review_table"}with(){return["product","customer"]}}function gge(e){return vge.init(e)}const yge={class:"table-cell"},bge={class:"table-cell"},wge={class:"table-cell"},Cge={class:"table-cell"},kge={class:"table-cell"},Bge={class:"table-cell"},xge={class:"table-cell"},Sge={__name:"ReviewsLoader",props:{nextPageCount:{type:Number,default:0},reviewTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,n)=>n+1);return(l,n)=>{const i=C("el-skeleton-item"),A=C("el-skeleton"),p=C("el-table-column"),m=C("el-table");return r(),E(m,{data:c(a),class:"w-full compact-table"},{default:u(()=>[s(p,{label:c(d)("ID"),width:"300"},{default:u(()=>[o("div",yge,[s(A,{animated:""},{template:u(()=>[s(i,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.reviewTable.isColumnVisible("reviewer")?(r(),E(p,{key:0,label:c(d)("Reviewer"),width:220},{default:u(()=>[o("div",bge,[s(A,{animated:""},{template:u(()=>[s(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.reviewTable.isColumnVisible("rating")?(r(),E(p,{key:1,label:c(d)("Rating"),width:120},{default:u(()=>[o("div",wge,[s(A,{animated:""},{template:u(()=>[s(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.reviewTable.isColumnVisible("content")?(r(),E(p,{key:2,label:c(d)("Review"),"min-width":200},{default:u(()=>[o("div",Cge,[s(A,{animated:""},{template:u(()=>[s(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.reviewTable.isColumnVisible("status")?(r(),E(p,{key:3,label:c(d)("Status"),width:120},{default:u(()=>[o("div",kge,[s(A,{animated:""},{template:u(()=>[s(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.reviewTable.isColumnVisible("date")?(r(),E(p,{key:4,label:c(d)("Date"),width:140},{default:u(()=>[o("div",Bge,[s(A,{animated:""},{template:u(()=>[s(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.reviewTable.isColumnVisible("actions")?(r(),E(p,{key:5,label:c(d)("Actions"),width:90},{default:u(()=>[o("div",xge,[s(A,{animated:""},{template:u(()=>[s(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},$ge={class:"fct-table-mobile-wrap fct-reviews-table-mobile-wrap"},Fge={class:"fct-table-mobile-header"},Ege={class:"fct-table-date-col"},Uge=["title"],Ige={class:"fct-table-mobile-body"},Vge={key:0,class:"mb-1 text-sm font-medium"},Dge={key:1,class:"mb-1 text-xs text-gray-500"},Tge={key:2,class:"mb-1"},Qge={key:3,class:"text-sm text-gray-600 truncate"},Mge={key:0,class:"font-medium"},Lge={class:"fct-table-mobile-footer"},Rge={class:"fct-table-mobile-footer-row"},Oge={key:0,class:"fct-table-status-col"},Pge={class:"title"},Hge={class:"value text-sm"},Nge={key:1,class:"fct-table-status-col"},Kge={class:"title"},Gge={key:2,class:"fct-table-actions-col"},zge={class:"title"},jge={__name:"ReviewsTableMobile",props:{table:{type:Object}},setup(e){return(t,a)=>{const l=C("router-link");return r(),h("div",$ge,[(r(!0),h(P,null,ae(e.table.getTableData(),n=>(r(),h("div",{key:n.id,class:"fct-table-mobile-row"},[o("div",Fge,[o("div",Ege,[o("div",{title:c(d)("Review ID: %s",n.id),class:"invoice-no"}," #"+f(n.id),9,Uge),e.table.isColumnVisible("date")?(r(),h(P,{key:0},[a[0]||(a[0]=o("span",{class:"bullet"},"•",-1)),s(Sa,{class:"date","date-time":n.created_at,"with-time":!0},null,8,["date-time"])],64)):x("",!0)])]),o("div",Ige,[n.product?(r(),h("div",Vge,f(n.product.post_title),1)):x("",!0),n.item_label?(r(),h("div",Dge,f(n.item_label),1)):x("",!0),e.table.isColumnVisible("rating")?(r(),h("div",Tge,[s(Qi,{rating:n.rating,size:"small"},null,8,["rating"])])):x("",!0),e.table.isColumnVisible("content")?(r(),h("div",Qge,[n.title?(r(),h("span",Mge,f(n.title)+" — ",1)):x("",!0),R(" "+f(n.content),1)])):x("",!0)]),o("div",Lge,[o("div",Rge,[e.table.isColumnVisible("reviewer")?(r(),h("div",Oge,[o("div",Pge,f(c(d)("Reviewer")),1),o("div",Hge,f(n.reviewer_name),1)])):x("",!0),e.table.isColumnVisible("status")?(r(),h("div",Nge,[o("div",Kge,f(c(d)("Status")),1),(r(),E(Ht,{status:n.status,size:"small",key:n.id},null,8,["status"]))])):x("",!0),e.table.isColumnVisible("actions")?(r(),h("div",Gge,[o("div",zge,f(c(d)("Actions")),1),s(l,{class:"value text-primary text-sm",to:{name:"view_review",params:{review_id:n.id}},"aria-label":c(d)("View review #%1$s",n.id)},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to","aria-label"])])):x("",!0)])])]))),128))])}}},qge={},Yge={class:"fct-table-mobile-wrap"};function Wge(e,t){const a=C("el-skeleton");return r(),h("div",Yge,[(r(),h(P,null,ae(5,l=>o("div",{key:l,class:"fct-table-mobile-row"},[s(a,{animated:"",rows:3})])),64))])}const Jge=nt(qge,[["render",Wge]]),Xge=["aria-label"],Zge=["aria-checked","aria-label","tabindex","disabled","onClick","onMouseenter","onFocus"],eye={__name:"StarRatingInput",props:{modelValue:{type:Number,default:0},size:{type:String,default:"medium",validator:e=>["small","medium","large"].includes(e)},label:{type:String,default:()=>d("Rating")},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,n=M(0),i=M([]),A=b=>{a.disabled||l("update:modelValue",b)},p=b=>{const w=b===a.modelValue;A(w?0:b),w&&(n.value=0)},m=b=>{if(a.disabled)return;const w=Math.min(5,Math.max(1,(a.modelValue||0)+b));A(w),n.value=w,$e(()=>{var B;return(B=i.value[w-1])==null?void 0:B.focus()})},_=b=>d("Rate %1$s out of 5 stars",b),g={1:d("Poor"),2:d("Average"),3:d("Good"),4:d("Very Good"),5:d("Excellent")},y={1:"danger",2:"warning",3:"info",4:"success",5:"success"},v=b=>g[b]||"",k=b=>y[b]||"none";return(b,w)=>(r(),h("div",{class:ue(["fct-star-rating-input",`fct-star-rating-input-${e.size}`])},[o("div",{class:"fct-star-rating-input__stars",role:"radiogroup","aria-label":e.label},[(r(),h(P,null,ae(5,B=>o("button",{key:B,ref_for:!0,ref:S=>i.value[B-1]=S,type:"button",role:"radio",class:ue(["fct-star-rating-input__star",{"is-filled":B<=(n.value||e.modelValue),"is-selected":B<=e.modelValue}]),"aria-checked":e.modelValue===B,"aria-label":_(B),tabindex:e.modelValue===B||!e.modelValue&&B===1?0:-1,disabled:e.disabled,onClick:S=>p(B),onMouseenter:S=>n.value=B,onMouseleave:w[0]||(w[0]=S=>n.value=0),onFocus:S=>n.value=B,onBlur:w[1]||(w[1]=S=>n.value=0),onKeydown:[w[2]||(w[2]=ea(Ge(S=>m(-1),["prevent"]),["left"])),w[3]||(w[3]=ea(Ge(S=>m(1),["prevent"]),["right"])),w[4]||(w[4]=ea(Ge(S=>m(1),["prevent"]),["up"])),w[5]||(w[5]=ea(Ge(S=>m(-1),["prevent"]),["down"]))]},[s($o,{class:"fct-star-rating-input__svg"})],42,Zge)),64))],8,Xge),n.value||e.modelValue?(r(),h("span",{key:0,class:ue(["fct-star-rating-input__badge",`is-${k(n.value||e.modelValue)}`]),"aria-hidden":"true"},f(v(n.value||e.modelValue)),3)):x("",!0)],2))}},tye=["onKeydown"],aye={key:0,class:"fct-add-review-field"},lye={class:"fct-add-review-label",for:"fct_add_review_product"},sye={key:1,class:"fct-add-review-field"},nye={class:"fct-add-review-label",for:"fct_add_review_variation"},oye={key:2,class:"fct-add-review-field"},iye={class:"fct-add-review-label"},rye={key:0,class:"fct-add-review-required"},dye={class:"fct-add-review-field"},uye={class:"fct-add-review-label",for:"fct_add_review_title"},cye={class:"fct-add-review-field"},Aye={class:"fct-add-review-label",for:"fct_add_review_content"},pye={class:"fct-add-review-row"},fye={class:"fct-add-review-field"},mye={class:"fct-add-review-label",for:"fct_add_review_name"},hye={class:"fct-add-review-field"},_ye={class:"fct-add-review-label",for:"fct_add_review_email"},vye={class:"fct-add-review-field"},gye={class:"fct-add-review-label",for:"fct_add_review_status"},yye={key:0,class:"fct-add-review-field fct-add-review-field-inline"},bye={class:"fct-add-review-switch"},wye={class:"fct-add-review-label"},Cye={key:3,class:"fct-add-review-field"},kye={class:"fct-add-review-label"},Bye={key:0,class:"fct-add-review-media"},xye=["src","alt"],Sye=["aria-label","onClick"],$ye={key:0,class:"fct-add-review-media-item is-add"},Fye=["aria-label"],Eye={class:"fct-add-review-hint"},Uye=["accept"],Iye={key:1,class:"fct-add-review-locked"},Vye={class:"fct-add-review-hint"},Dye=["href"],Tye={__name:"AddReviewModal",props:{modelValue:{type:Boolean,default:!1},productId:{type:Number,default:null}},emits:["update:modelValue","created","update:saving"],setup(e,{emit:t}){const a=e,l=t,n=G({get:()=>a.modelValue,set:Ee=>l("update:modelValue",Ee)}),i=Ke.get("modules_settings.reviews")||{},A=i.enable_star_rating==="yes",p=A&&i.star_rating_required==="yes",m=i.show_verified_badge===void 0||i.show_verified_badge==="yes",_=i.enable_photo_reviews==="yes",g=()=>({post_id:a.productId||null,item_id:null,rating:0,title:"",content:"",reviewer_name:"",reviewer_email:"",status:"approved",is_verified:!1,media:[]}),y=M(g()),v=M(!1),k=M(null),b=M({}),w=Ee=>Object.prototype.hasOwnProperty.call(b.value,Ee),B=Ee=>{Object.prototype.hasOwnProperty.call(b.value,Ee)&&delete b.value[Ee]},S=()=>{const Ee=k.value;if(!Ee)return;const fe=Ee.querySelector("#fct_add_review_product"),De=(fe?fe.matches("input")?fe:fe.querySelector("input"):null)||Ee.querySelector('.fct-star-rating-input__star[tabindex="0"]')||Ee.querySelector("#fct_add_review_title");De&&De.focus()};be(v,Ee=>l("update:saving",Ee));const V=Ee=>String(Ee.id),F=(Ee,fe)=>`${Ee.id}:${fe.id}`,$=M([]),U=M(!1),D=M(null),T=Ke.get("review_media")||null,I=!!(T&&T.enabled&&_),L=Number(T==null?void 0:T.max_photos)||0,O=Number(T==null?void 0:T.max_size_mb)||0,Q=String((T==null?void 0:T.accept)||"").split(",").map(Ee=>Ee.trim()).filter(Boolean),H=Ro("review_attachments","reviews"),K=!!Ke.get("app_config.isProActive"),W=K?d("Update FluentCart Pro to attach photos to a review"):d("Reviews with photos are available in FluentCart Pro"),z=()=>{B("post_id"),B("item_id")},Y=Ee=>{const[fe,ye]=String(Ee).split(":");y.value.post_id=Number(fe),y.value.item_id=ye?Number(ye):null},Z=M([]);let re=null,q=0,Ae=null;const ie=()=>{Ae&&(Ae.abort(),Ae=null)},J=(Ee,fe)=>{const ye=typeof AbortController<"u"?new AbortController:null;return Ae=ye,ce.get("advance_filter/get-filter-options",{remote_data_key:"review_products",limit:20,...Ee},null,ye?{signal:ye.signal}:{}).then(De=>{var Le;return fe!==q?null:(((Le=De.options)==null?void 0:Le.data)||[]).map(At=>({id:Number(At.id),title:At.title,variations:(At.variations||[]).map(mt=>({id:Number(mt.id),title:mt.title}))}))})},N=Ee=>{clearTimeout(re);const fe=++q;if(ie(),!Ee){$.value=[],U.value=!1;return}U.value=!0,re=setTimeout(()=>{J({search:Ee},fe).then(ye=>{ye!==null&&($.value=ye)}).catch(ye=>{var De;fe===q&&($.value=[],j.error(((De=ye==null?void 0:ye.data)==null?void 0:De.message)||d("Could not load products. Please try again.")))}).finally(()=>{fe===q&&(Ae=null,U.value=!1)})},400)},le=Ee=>{const fe=++q;ie(),J({include_ids:[Ee],limit:1},fe).then(ye=>{if(ye===null)return;const De=ye.find(Le=>Le.id===Number(Ee));Z.value=De?De.variations:[]}).catch(ye=>{var De;fe===q&&(Z.value=[],j.error(((De=ye==null?void 0:ye.data)==null?void 0:De.message)||d("Could not load this product's variations.")))})};be(()=>a.productId,Ee=>{y.value.post_id=Ee||null,y.value.item_id=null,D.value=null,Z.value=[],Ee&&le(Ee)},{immediate:!0}),Ga(()=>{clearTimeout(re),ie(),y.value.media.forEach(Se)});const ee=M(null);let pe=0;const de=G(()=>y.value.media.length>=L?d("Photo limit reached (%1$s)",L):d("Up to %1$s photos, %2$s MB each",L,O)),Ue=()=>{var Ee;return(Ee=ee.value)==null?void 0:Ee.click()},Ce=Ee=>{const fe=Array.from(Ee.target.files||[]);if(Ee.target.value="",!fe.length)return;const ye=L-y.value.media.length;ye<=0||(fe.length>ye&&j.info(d("%1$s photo(s) were skipped — the limit is %2$s per review",fe.length-ye,L)),fe.slice(0,ye).forEach(De=>{if(O&&De.size>O*1024*1024){j.error(d("%1$s is too large",De.name));return}if(Q.length&&De.type&&!Q.includes(De.type)){j.error(d("%1$s is not an allowed file type",De.name));return}y.value.media.push({key:`${De.name}-${De.size}-${De.lastModified}-${pe++}`,name:De.name,url:URL.createObjectURL(De),file:De})}))},Se=Ee=>{Ee!=null&&Ee.url&&URL.revokeObjectURL(Ee.url)},ge=Ee=>{const fe=y.value.media.find(ye=>ye.key===Ee);Se(fe),y.value.media=y.value.media.filter(ye=>ye.key!==Ee)},ke=()=>{y.value.media.forEach(Se),y.value=g(),$.value=[],D.value=null,b.value={}},Oe=()=>{if(v.value)return;b.value={},v.value=!0;const Ee=new FormData;Ee.append("post_id",y.value.post_id),y.value.item_id&&Ee.append("item_id",y.value.item_id),Ee.append("rating",y.value.rating),Ee.append("title",y.value.title),Ee.append("content",y.value.content),Ee.append("reviewer_name",y.value.reviewer_name),Ee.append("reviewer_email",y.value.reviewer_email),Ee.append("status",y.value.status),Ee.append("is_verified",y.value.is_verified?1:0),y.value.media.forEach(fe=>Ee.append("files[]",fe.file,fe.name)),ce.upload("reviews",Ee).then(fe=>{var ye;(ye=fe.media_rejected)!=null&&ye.length?j.error(fe.message,d("Photos not saved"),8e3):j.success(fe.message),l("created",fe.review),n.value=!1}).catch(fe=>{const ye=fe&&typeof fe=="object"&&!fe.message&&Object.values(fe).some(De=>De&&typeof De=="object");b.value=ye?fe:{general:{server:(fe==null?void 0:fe.message)||d("Could not add the review. Please try again.")}}}).finally(()=>{v.value=!1})};return(Ee,fe)=>{const ye=C("el-option"),De=C("el-option-group"),Le=C("el-select"),At=C("el-input"),mt=C("el-switch"),Mt=C("el-button"),Dt=C("el-dialog");return r(),E(Dt,{modelValue:n.value,"onUpdate:modelValue":fe[16]||(fe[16]=Je=>n.value=Je),class:"fct-add-review-modal",title:c(d)("Add Review"),width:"560px","align-center":"","append-to-body":"","destroy-on-close":"","close-on-click-modal":!v.value,"close-on-press-escape":!v.value,onOpened:S,onClosed:ke},{footer:u(()=>[s(Mt,{disabled:v.value,onClick:fe[15]||(fe[15]=Je=>n.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1},8,["disabled"]),s(Mt,{type:"primary",loading:v.value,disabled:v.value,onClick:Oe},{default:u(()=>[R(f(c(d)("Add Review")),1)]),_:1},8,["loading","disabled"])]),default:u(()=>[o("div",{ref_key:"formRef",ref:k,class:"fct-add-review-form",onKeydown:[ea(Ge(Oe,["ctrl","prevent"]),["enter"]),ea(Ge(Oe,["meta","prevent"]),["enter"])]},[s(zt,{"validation-errors":b.value,"field-key":"general"},null,8,["validation-errors"]),e.productId?Z.value.length?(r(),h("div",sye,[o("label",nye,f(c(d)("Variation")),1),s(Le,{id:"fct_add_review_variation",modelValue:y.value.item_id,"onUpdate:modelValue":fe[1]||(fe[1]=Je=>y.value.item_id=Je),class:ue(["w-full",w("item_id")?"is-error":""]),"aria-invalid":w("item_id")?"true":void 0,clearable:"",filterable:"",placeholder:c(d)("Whole product (no specific variation)"),onFocus:fe[2]||(fe[2]=Je=>B("item_id"))},{default:u(()=>[(r(!0),h(P,null,ae(Z.value,Je=>(r(),E(ye,{key:Je.id,label:Je.title,value:Je.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","class","aria-invalid","placeholder"]),s(zt,{"validation-errors":b.value,"field-key":"item_id"},null,8,["validation-errors"])])):x("",!0):(r(),h("div",aye,[o("label",lye,[R(f(c(d)("Select Product"))+" ",1),fe[17]||(fe[17]=o("span",{class:"fct-add-review-required"},"*",-1))]),s(Le,{id:"fct_add_review_product",modelValue:D.value,"onUpdate:modelValue":fe[0]||(fe[0]=Je=>D.value=Je),class:ue(["w-full",w("post_id")||w("item_id")?"is-error":""]),"aria-invalid":w("post_id")||w("item_id")?"true":void 0,filterable:"",remote:"","reserve-keyword":!1,"remote-method":N,loading:U.value,placeholder:c(d)("Search a product"),"popper-class":"fct-add-review-product-options",onFocus:z,onChange:Y},{default:u(()=>[(r(!0),h(P,null,ae($.value,Je=>(r(),h(P,{key:Je.id},[Je.variations.length?(r(),E(De,{key:0,label:Je.title},{default:u(()=>[(r(!0),h(P,null,ae(Je.variations,pt=>(r(),E(ye,{key:pt.id,label:pt.title,value:F(Je,pt)},null,8,["label","value"]))),128))]),_:2},1032,["label"])):(r(),E(ye,{key:1,label:Je.title,value:V(Je)},null,8,["label","value"]))],64))),128))]),_:1},8,["modelValue","class","aria-invalid","loading","placeholder"]),s(zt,{"validation-errors":b.value,"field-key":"post_id"},null,8,["validation-errors"]),s(zt,{"validation-errors":b.value,"field-key":"item_id"},null,8,["validation-errors"])])),A?(r(),h("div",oye,[o("span",iye,[R(f(c(d)("How would you rate this product?"))+" ",1),c(p)?(r(),h("span",rye,"*")):x("",!0)]),s(eye,{modelValue:y.value.rating,"onUpdate:modelValue":[fe[3]||(fe[3]=Je=>y.value.rating=Je),fe[4]||(fe[4]=Je=>B("rating"))],class:ue(w("rating")?"is-error":""),label:c(d)("Review rating")},null,8,["modelValue","class","label"]),s(zt,{"validation-errors":b.value,"field-key":"rating"},null,8,["validation-errors"])])):x("",!0),o("div",dye,[o("label",uye,f(c(d)("Review title")),1),s(At,{id:"fct_add_review_title",modelValue:y.value.title,"onUpdate:modelValue":fe[5]||(fe[5]=Je=>y.value.title=Je),maxlength:"192",class:ue(w("title")?"is-error":""),placeholder:c(d)("Summarize your experience"),"aria-invalid":w("title")?"true":void 0,onFocus:fe[6]||(fe[6]=Je=>B("title"))},null,8,["modelValue","class","placeholder","aria-invalid"]),s(zt,{"validation-errors":b.value,"field-key":"title"},null,8,["validation-errors"])]),o("div",cye,[o("label",Aye,[R(f(c(d)("Your review"))+" ",1),fe[18]||(fe[18]=o("span",{class:"fct-add-review-required"},"*",-1))]),s(At,{id:"fct_add_review_content",modelValue:y.value.content,"onUpdate:modelValue":fe[7]||(fe[7]=Je=>y.value.content=Je),type:"textarea",rows:4,maxlength:"5000","show-word-limit":"",class:ue(w("content")?"is-error":""),placeholder:c(d)("What did you like or dislike? How did you use this product?"),"aria-invalid":w("content")?"true":void 0,onFocus:fe[8]||(fe[8]=Je=>B("content"))},null,8,["modelValue","class","placeholder","aria-invalid"]),s(zt,{"validation-errors":b.value,"field-key":"content"},null,8,["validation-errors"])]),o("div",pye,[o("div",fye,[o("label",mye,[R(f(c(d)("Reviewer name"))+" ",1),fe[19]||(fe[19]=o("span",{class:"fct-add-review-required"},"*",-1))]),s(At,{id:"fct_add_review_name",modelValue:y.value.reviewer_name,"onUpdate:modelValue":fe[9]||(fe[9]=Je=>y.value.reviewer_name=Je),maxlength:"100",class:ue(w("reviewer_name")?"is-error":""),placeholder:c(d)("Name shown on the review"),"aria-invalid":w("reviewer_name")?"true":void 0,onFocus:fe[10]||(fe[10]=Je=>B("reviewer_name"))},null,8,["modelValue","class","placeholder","aria-invalid"]),s(zt,{"validation-errors":b.value,"field-key":"reviewer_name"},null,8,["validation-errors"])]),o("div",hye,[o("label",_ye,f(c(d)("Reviewer email")),1),s(At,{id:"fct_add_review_email",modelValue:y.value.reviewer_email,"onUpdate:modelValue":fe[11]||(fe[11]=Je=>y.value.reviewer_email=Je),type:"email",maxlength:"192",class:ue(w("reviewer_email")?"is-error":""),placeholder:c(d)("[email protected] (optional)"),"aria-invalid":w("reviewer_email")?"true":void 0,onFocus:fe[12]||(fe[12]=Je=>B("reviewer_email"))},null,8,["modelValue","class","placeholder","aria-invalid"]),s(zt,{"validation-errors":b.value,"field-key":"reviewer_email"},null,8,["validation-errors"])])]),o("div",{class:ue(["fct-add-review-row",{"fct-add-review-row-single":!c(m)}])},[o("div",vye,[o("label",gye,f(c(d)("Status")),1),s(Le,{id:"fct_add_review_status",modelValue:y.value.status,"onUpdate:modelValue":fe[13]||(fe[13]=Je=>y.value.status=Je),class:"w-full"},{default:u(()=>[s(ye,{label:c(d)("Approved"),value:"approved"},null,8,["label"]),s(ye,{label:c(d)("Pending"),value:"pending"},null,8,["label"])]),_:1},8,["modelValue"])]),c(m)?(r(),h("div",yye,[o("div",bye,[s(mt,{modelValue:y.value.is_verified,"onUpdate:modelValue":fe[14]||(fe[14]=Je=>y.value.is_verified=Je),"aria-label":c(d)("Mark as verified purchase")},null,8,["modelValue","aria-label"]),o("span",wye,f(c(d)("Verified purchase")),1)])])):x("",!0)],2),_?(r(),h("div",Cye,[o("span",kye,f(c(d)("Attachments")),1),I?(r(),h(P,{key:0},[y.value.media.length?(r(),h("ul",Bye,[(r(!0),h(P,null,ae(y.value.media,Je=>(r(),h("li",{key:Je.key,class:"fct-add-review-media-item"},[o("img",{src:Je.url,alt:Je.name||""},null,8,xye),o("button",{type:"button",class:"fct-add-review-media-remove","aria-label":c(d)("Remove attachment"),onClick:pt=>ge(Je.key)},"×",8,Sye)]))),128)),y.value.media.length<c(L)?(r(),h("li",$ye,[o("button",{type:"button",class:"fct-add-review-media-add","aria-label":c(d)("Add attachments"),onClick:Ue},[s(X,{name:"GalleryAdd"})],8,Fye)])):x("",!0)])):(r(),h("button",{key:1,type:"button",class:"fct-add-review-media-add is-empty",onClick:Ue},[s(X,{name:"GalleryAdd"}),o("span",null,f(c(d)("Add attachments")),1)])),o("span",Eye,f(de.value),1),o("input",{ref_key:"fileInputRef",ref:ee,type:"file",multiple:"",class:"fct-add-review-file-input",accept:c(T).accept,onChange:Ce},null,40,Uye)],64)):(r(),h("div",Iye,[s(Mt,{disabled:"",class:"fct-add-review-locked-btn"},{default:u(()=>[s(X,{name:"Crown"}),R(" "+f(c(d)("Add attachment")),1)]),_:1}),o("span",Vye,[R(f(c(W))+" ",1),!c(K)&&c(H)?(r(),h("a",{key:0,class:"fct-add-review-upgrade",href:c(H),target:"_blank",rel:"noopener noreferrer"},f(c(d)("Upgrade to Pro")),9,Dye)):x("",!0)])]))])):x("",!0)],40,tye)]),_:1},8,["modelValue","title","close-on-click-modal","close-on-press-escape"])}}},Qye={class:"fct-all-reviews-page fct-layout-width"},Mye={key:0,class:"fct-product-filter-banner"},Lye={class:"fct-all-reviews-wrap"},Rye={key:0,class:"bulk-actions-bar"},Oye={class:"bulk-left flex items-center gap-2"},Pye={class:"bulk-right"},Hye={key:0,class:"px-4 pb-3"},Nye={class:"mb-1 text-xs text-gray-500"},Kye={class:"font-medium"},Gye={class:"text-sm text-system-dark dark:text-gray-300 truncate max-w-[220px]"},zye={key:0,class:"text-xs text-gray-500 dark:text-gray-400 truncate max-w-[220px]"},jye={key:1,class:"text-sm text-gray-400"},qye={class:"font-medium"},Yye={class:"text-xs text-gray-500"},Wye={class:"max-w-[250px]"},Jye={key:0,class:"font-medium truncate"},Xye={class:"text-xs text-gray-500 truncate"},Zye=["aria-label"],Rc=20,e1e={__name:"AllReviews",setup(e){const t=Pa(),a=Oa(),l=t.query.post_id?parseInt(t.query.post_id):null,n=gge({postId:l}),i=M(null),A=M([]),p=M(""),m=M(!1),_=M(""),g=M(!1),y=M(!1),v=M(null),k=M(null);let b=[];be(k,Q=>{if(!Q||!b.length)return;const H=new Set(b);b=[],$e(()=>{n.getTableData().forEach(K=>{H.has(K.id)&&Q.toggleRowSelection(K,!0)})})});const w=M(!1),B=M(!1),S=()=>{let Q;Q=be(()=>n.getTableData(),H=>{H.length>0&&H[0].product&&H[0].post_id===n.getPostId()?(i.value=H[0].product.post_title,Q==null||Q()):H.length===0&&(i.value=d("Product #%1$s",n.getPostId()),Q==null||Q())})};l>0&&S();const V=()=>{a.replace({query:{...t.query,post_id:void 0}})},F=Q=>{A.value=Q},$=Q=>{if(Q.action==="delete")Ra(d("Are you sure you want to permanently delete this review? This action cannot be undone."),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete("reviews/"+Q.review.id).then(H=>{j.success(H.message),n.fetch()}).catch(H=>{var K;j.error((K=H.data)==null?void 0:K.message)})}).catch(()=>{});else if(["approve","pending","spam","trash"].includes(Q.action)){const H={approve:"approved",pending:"pending",spam:"spam",trash:"trash"};ce.put("reviews/"+Q.review.id,{status:H[Q.action]}).then(K=>{j.success(K.message),n.fetch()}).catch(K=>{var W;j.error((W=K.data)==null?void 0:W.message)})}},U=()=>{if(!p.value){j.error(d("Please select a bulk action"));return}D(p.value)},D=Q=>{const H=A.value.map(K=>K.id);if(Q==="reply"){_.value="",m.value=!0;return}Q==="delete"?Ra(d("Are you sure you want to permanently delete %s reviews?",H.length),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{O(Q,H)}).catch(()=>{}):O(Q,H)},T=async(Q,H)=>{const K=[];for(let z=0;z<Q.length;z+=Rc)K.push(Q.slice(z,z+Rc));const W={processed:0,skipped:0,failedIds:[],failedBatches:0,totalBatches:K.length};v.value={current:0,total:K.length};try{for(let z=0;z<K.length;z++){v.value.current=z+1;try{const Y=await H(K[z]),Z=(Y==null?void 0:Y.data)||{};W.processed+=Number(Z.affected??Z.replied??K[z].length),W.skipped+=Number(Z.skipped??0)}catch{W.failedBatches++,W.failedIds.push(...K[z])}}}finally{v.value=null}return W},I=({processed:Q,skipped:H,failedIds:K},W=!1)=>{const z=W?d("Replied to %s review(s).",Q):d("%s review(s) updated.",Q),Y=W&&H>0?" "+d("%s skipped: already replied.",H):"";if(!K.length){j.success(z+Y);return}j.error(z+Y+" "+d("%s review(s) were not processed and are still selected. Try again.",K.length))},L=async()=>{if(!_.value.trim()){j.error(d("Please write a reply message before sending."));return}const Q=A.value.map(K=>K.id);if(!Q.length){j.error(d("No reviews selected"));return}g.value=!0;const H=await T(Q,K=>ce.post("reviews/bulk-reply",{content:_.value,review_ids:K}));I(H,!0),g.value=!1,H.failedIds.length||(m.value=!1,p.value=""),b=H.failedIds,n.fetch()},O=async(Q,H)=>{if(y.value)return;y.value=!0;const K=await T(H,W=>ce.post("reviews/bulk-action",{action_type:Q,review_ids:W}));I(K),y.value=!1,K.failedIds.length||(p.value=""),b=K.failedIds,n.fetch()};return(Q,H)=>{const K=C("el-button"),W=C("el-option"),z=C("el-select"),Y=C("el-progress"),Z=C("el-table-column"),re=C("router-link"),q=C("el-dropdown-item"),Ae=C("el-dropdown-menu"),ie=C("el-dropdown"),J=C("el-table"),N=C("el-input"),le=C("el-dialog");return r(),E(Lt,{permission:"reviews/manage"},{default:u(()=>[o("div",Qye,[s(Xa,{title:c(d)("Reviews")},{action:u(()=>[s(K,{type:"primary",loading:B.value,disabled:B.value,onClick:H[0]||(H[0]=ee=>w.value=!0)},{default:u(()=>[R(f(c(d)("Add Review")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),i.value?(r(),h("div",Mye,[o("span",null,[R(f(c(d)("Showing reviews for:"))+" ",1),o("strong",null,f(i.value),1)]),s(K,{size:"small",text:"",disabled:c(n).isLoading(),onClick:V},{default:u(()=>[R(f(c(d)("Clear filter")),1)]),_:1},8,["disabled"])])):x("",!0),o("div",Lye,[s(us,{table:c(n),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(n).isLoading()?(r(),E(Jge,{key:0})):x("",!0),c(n).isLoading()?x("",!0):(r(),E(jge,{key:1,table:c(n)},null,8,["table"]))]),default:u(()=>[s(Gl,{name:"slide-fade"},{default:u(()=>[A.value.length>0?(r(),h("div",Rye,[o("div",Oye,[s(z,{size:"small",class:"bulk-select min-w-[180px]",placeholder:c(d)("Select Bulk Action"),disabled:c(n).isLoading()||y.value,modelValue:p.value,"onUpdate:modelValue":H[1]||(H[1]=ee=>p.value=ee)},{default:u(()=>[s(W,{label:c(d)("Approve"),value:"approve"},null,8,["label"]),s(W,{label:c(d)("Pending"),value:"pending"},null,8,["label"]),s(W,{label:c(d)("Mark as Spam"),value:"spam"},null,8,["label"]),s(W,{label:c(d)("Move to Trash"),value:"trash"},null,8,["label"]),s(W,{label:c(d)("Delete Permanently"),value:"delete"},null,8,["label"]),s(W,{label:c(d)("Reply"),value:"reply"},null,8,["label"])]),_:1},8,["placeholder","disabled","modelValue"]),s(K,{size:"small",type:p.value==="delete"?"danger":"primary",disabled:!p.value||y.value||c(n).isLoading(),loading:y.value,onClick:U},{default:u(()=>[R(f(v.value?c(d)("Processing %1$s of %2$s",v.value.current,v.value.total):c(d)("Confirm")),1)]),_:1},8,["type","disabled","loading"])]),o("div",Pye,f(A.value.length)+" "+f(c(d)("item(s) selected")),1)])):x("",!0)]),_:1}),v.value?(r(),h("div",Hye,[o("div",Nye,f(c(d)("Processing batch %1$s of %2$s",v.value.current,v.value.total)),1),s(Y,{percentage:Math.round(v.value.current/v.value.total*100),"show-text":!1,"stroke-width":6},null,8,["percentage"])])):x("",!0),c(n).isLoading()?(r(),E(Sge,{key:1,reviewTable:c(n),"next-page-count":c(n).nextPageCount},null,8,["reviewTable","next-page-count"])):(r(),E(J,{key:2,ref_key:"reviewTableEl",ref:k,data:c(n).getTableData(),class:"w-full compact-table",onSelectionChange:F},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":"",text:c(d)("No reviews found.")},null,8,["text"])]),default:u(()=>[s(Z,{type:"selection",width:45}),s(Z,{label:c(d)("ID"),width:"300"},{default:u(ee=>[s(ta,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[o("div",null,[o("div",Kye,"#"+f(c(la)(ee.row.id)),1),ee.row.product?(r(),h(P,{key:0},[o("div",Gye,f(ee.row.product.post_title),1),ee.row.item_label?(r(),h("div",zye,f(ee.row.item_label),1)):x("",!0)],64)):(r(),h("span",jye,"-"))])]),_:2},1032,["to"])]),_:1},8,["label"]),c(n).isColumnVisible("reviewer")?(r(),E(Z,{key:0,label:c(d)("Reviewer"),width:220},{default:u(ee=>[s(ta,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[o("div",null,[o("div",qye,f(ee.row.reviewer_name),1),o("div",Yye,f(ee.row.reviewer_email),1)])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),c(n).isColumnVisible("rating")?(r(),E(Z,{key:1,label:c(d)("Rating"),width:120},{default:u(ee=>[s(ta,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[s(Qi,{rating:ee.row.rating,size:"small"},null,8,["rating"])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),c(n).isColumnVisible("content")?(r(),E(Z,{key:2,label:c(d)("Review"),"min-width":200},{default:u(ee=>[s(ta,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[o("div",Wye,[ee.row.title?(r(),h("div",Jye,f(ee.row.title),1)):x("",!0),o("div",Xye,f(ee.row.content),1)])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),c(n).isColumnVisible("status")?(r(),E(Z,{key:3,label:c(d)("Status"),width:120},{default:u(ee=>[s(ta,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[s(Ht,{status:ee.row.status,size:"small"},null,8,["status"])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),c(n).isColumnVisible("date")?(r(),E(Z,{key:4,label:c(d)("Date"),width:140},{default:u(ee=>[s(ta,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[s(Sa,{"date-time":ee.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),c(n).isColumnVisible("actions")?(r(),E(Z,{key:5,label:c(d)("Actions"),width:90,align:"right"},{default:u(ee=>[s(ie,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:$,placement:"bottom-end"},{dropdown:u(()=>[s(Ae,null,{default:u(()=>[ee.row.id?(r(),E(q,{key:0,class:"item-link"},{default:u(()=>[s(re,{to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[s(X,{name:"Eye"}),R(" "+f(c(d)("View")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),ee.row.status!=="approved"?(r(),E(q,{key:1,command:{action:"approve",review:ee.row}},{default:u(()=>[R(f(c(d)("Approve")),1)]),_:2},1032,["command"])):x("",!0),ee.row.status!=="pending"?(r(),E(q,{key:2,command:{action:"pending",review:ee.row}},{default:u(()=>[R(f(c(d)("Pending")),1)]),_:2},1032,["command"])):x("",!0),ee.row.status!=="spam"?(r(),E(q,{key:3,command:{action:"spam",review:ee.row}},{default:u(()=>[R(f(c(d)("Spam")),1)]),_:2},1032,["command"])):x("",!0),ee.row.status!=="trash"?(r(),E(q,{key:4,command:{action:"trash",review:ee.row}},{default:u(()=>[R(f(c(d)("Trash")),1)]),_:2},1032,["command"])):x("",!0),s(q,{command:{action:"delete",review:ee.row},class:"item-destructive"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",{class:"more-btn mr-2","aria-label":c(d)("Review actions")},[s(X,{name:"More"})],8,Zye)]),_:2},1024)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]))]),_:1},8,["table"])]),s(Tye,{modelValue:w.value,"onUpdate:modelValue":H[2]||(H[2]=ee=>w.value=ee),saving:B.value,"onUpdate:saving":H[3]||(H[3]=ee=>B.value=ee),"product-id":c(n).getPostId()||null,onCreated:H[4]||(H[4]=ee=>c(n).fetch())},null,8,["modelValue","saving","product-id"]),s(le,{modelValue:m.value,"onUpdate:modelValue":H[7]||(H[7]=ee=>m.value=ee),title:c(d)("Reply to %s reviews",A.value.length),width:"500px","aria-label":c(d)("Bulk reply to reviews")},{footer:u(()=>[s(K,{disabled:g.value,onClick:H[6]||(H[6]=ee=>m.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1},8,["disabled"]),s(K,{type:"primary",loading:g.value,disabled:g.value,onClick:L},{default:u(()=>[R(f(v.value?c(d)("Processing %1$s of %2$s",v.value.current,v.value.total):c(d)("Send Reply")),1)]),_:1},8,["loading","disabled"])]),default:u(()=>[s(N,{modelValue:_.value,"onUpdate:modelValue":H[5]||(H[5]=ee=>_.value=ee),type:"textarea",rows:4,placeholder:c(d)("Write your reply...")},null,8,["modelValue","placeholder"])]),_:1},8,["modelValue","title","aria-label"])])]),_:1})}}},t1e={class:"fct-single-review-page fct-layout-width"},a1e={key:0,class:"p-6"},l1e={class:"single-page-header flex items-start justify-between"},s1e={class:"single-page-header-title-wrap"},n1e={key:1},o1e={class:"single-page-header-status-wrap"},i1e={class:"fct-btn-group sm"},r1e={class:"single-page-body"},d1e={class:"fct-single-review-layout"},u1e={class:"fct-single-review-main"},c1e={class:"fct-review-rating-inline"},A1e={class:"fct-review-rating-num"},p1e={class:"fct-review-thread-container"},f1e={class:"fct-thread-item"},m1e={class:"fct-thread-content"},h1e={class:"fct-thread-name-row"},_1e={class:"fct-thread-name"},v1e={class:"fct-thread-meta"},g1e={key:0,class:"fct-thread-title"},y1e={class:"fct-thread-text"},b1e={key:1,class:"fct-thread-media"},w1e=["aria-label","onClick"],C1e=["src","alt"],k1e={key:1,class:"fct-thread-media-video"},B1e={key:0,class:"fct-thread-reply-group"},x1e={class:"fct-thread-content"},S1e={class:"fct-thread-name-row"},$1e={class:"fct-thread-name"},F1e={class:"fct-thread-meta"},E1e=["disabled","aria-label","aria-expanded"],U1e={class:"fct-thread-text"},I1e={key:0,class:"fct-thread-form"},V1e={class:"fct-thread-form-box"},D1e={class:"fct-thread-form-actions"},T1e={key:0,class:"fct-review-media-preview"},Q1e=["src","alt"],M1e=["src"],L1e={key:2,class:"fct-review-media-preview-nav"},R1e={class:"text-sm text-gray-500"},O1e={class:"fct-single-review-aside"},P1e={class:"fct-admin-sidebar"},H1e={class:"fct-review-context"},N1e={key:0,class:"fct-review-context-row"},K1e={class:"fct-review-context-thumb","aria-hidden":"true"},G1e=["src"],z1e={class:"fct-review-context-label"},j1e={key:0,class:"block text-xs text-gray-500 dark:text-gray-400"},q1e=["href","aria-label","title"],Y1e={class:"fct-review-context-row"},W1e={class:"fct-review-context-label"},J1e={class:"fct-review-verified-row"},X1e={class:"fct-review-verified-label"},Z1e={class:"fct-review-verified-hint"},ebe={class:"fct-review-actions-label"},tbe={class:"fct-review-action-buttons"},abe=["disabled","aria-label","title","onClick"],lbe={class:"fct-review-action-label"},sbe={class:"fct-vote-rows"},nbe={class:"fct-vote-row fct-vote-row--helpful"},obe={class:"fct-vote-row-count"},ibe={class:"sr-only"},rbe={class:"fct-vote-row fct-vote-row--not-helpful"},dbe={class:"fct-vote-row-count"},ube={class:"sr-only"},cbe={key:2,class:"p-6 text-center text-gray-500"},Abe={__name:"SingleReview",setup(e){const t=Pa(),a=Oa(),l=M(null),n=M(!0),i=()=>{var Y;return dt.get((Y=l.value)==null?void 0:Y.product,"detail.featured_media.url")??pl.productPlaceholder()},A=G(()=>[{status:"approved",label:d("Approve"),aria:d("Approve")},{status:"spam",label:d("Spam"),aria:d("Mark as Spam")},{status:"trash",label:d("Trash"),aria:d("Move to Trash")},{status:"pending",label:d("Pending"),aria:d("Mark as Pending")}].filter(Z=>{var re;return Z.status!==((re=l.value)==null?void 0:re.status)}).slice(0,3)),p=M(""),m=M(!1),_=M(null),g=[{status:"pending",label:d("Pending"),icon:"Clock"},{status:"approved",label:d("Approved"),icon:"Check"},{status:"spam",label:d("Spam"),icon:"AlertIcon"},{status:"trash",label:d("Trash"),icon:"TrashIcon"}],y=Y=>{const Z=g.find(re=>re.status===Y);return Z?Z.label:Y},v=M(null),k=(Y,Z)=>{_.value===null&&(_.value=Y.id,ce.put("reviews/"+Y.id,{status:Z}).then(re=>{Y.status=Z,j.success(re.message)}).catch(re=>{var q;return j.error((q=re.data)==null?void 0:q.message)}).finally(()=>{_.value=null}))},b=M(null),w=()=>{$e(()=>{b.value&&(b.value.scrollTop=b.value.scrollHeight)})},B=M(!1),S=M(!1),V=M(null),F=M([]),$=M(!1),U=G(()=>{var Y;return $.value||!(((Y=l.value)==null?void 0:Y.replies)||[]).length}),D=M(!1),T=M(0),I=Y=>{T.value=Y,D.value=!0},L=Y=>{!D.value||!F.value.length||(Y.key==="ArrowLeft"&&T.value>0?T.value--:Y.key==="ArrowRight"&&T.value<F.value.length-1&&T.value++)};be(D,Y=>{Y?document.addEventListener("keydown",L):document.removeEventListener("keydown",L)});const O=()=>{n.value=!0,ce.get("reviews/"+t.params.review_id).then(Y=>{l.value=Y.review,V.value=Y.vote_counts||null,F.value=Y.review_media||[],$.value=!!Y.allow_multiple_replies,w()}).catch(Y=>{var Z;j.error(((Z=Y.data)==null?void 0:Z.message)||d("Review not found"))}).finally(()=>{n.value=!1})},Q=Y=>{B.value||(B.value=!0,ce.put("reviews/"+l.value.id,{status:Y}).then(Z=>{j.success(Z.message),l.value.status=Y}).catch(Z=>{var re;j.error((re=Z.data)==null?void 0:re.message)}).finally(()=>{B.value=!1}))},H=Y=>{S.value||(S.value=!0,ce.put("reviews/"+l.value.id,{is_verified:Y?1:0}).then(Z=>{j.success(Z.message),l.value.is_verified=Y?1:0}).catch(Z=>{var re;j.error((re=Z.data)==null?void 0:re.message)}).finally(()=>{S.value=!1}))},K=()=>{Ra(d("Are you sure you want to permanently delete this review? This action cannot be undone."),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete("reviews/"+l.value.id).then(Y=>{j.success(Y.message),a.push({name:"reviews"})}).catch(Y=>{var Z;j.error((Z=Y.data)==null?void 0:Z.message)})}).catch(()=>{})},W=Y=>{Ra(d("Are you sure you want to delete this reply?"),d("Delete Reply"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete("reviews/"+l.value.id+"/replies/"+Y).then(Z=>{j.success(Z.message),Array.isArray(l.value.replies)&&(l.value.replies=l.value.replies.filter(re=>re.id!==Y))}).catch(Z=>{var re;j.error((re=Z.data)==null?void 0:re.message)})}).catch(()=>{})},z=()=>{if(!p.value.trim()){j.error(d("Please write a reply message before sending."));return}m.value=!0,ce.post("reviews/"+l.value.id+"/reply",{content:p.value}).then(Y=>{j.success(Y.message),p.value="",Y.reply?(Array.isArray(l.value.replies)||(l.value.replies=[]),l.value.replies.push(Y.reply),w()):O()}).catch(Y=>{var Z;j.error((Z=Y.data)==null?void 0:Z.message)}).finally(()=>{m.value=!1})};return Te(()=>{O()}),Ga(()=>{document.removeEventListener("keydown",L)}),(Y,Z)=>{const re=C("el-skeleton"),q=C("el-breadcrumb-item"),Ae=C("el-tooltip"),ie=C("router-link"),J=C("el-breadcrumb"),N=C("el-icon"),le=C("el-button"),ee=C("el-dropdown-item"),pe=C("el-dropdown-menu"),de=C("el-dropdown"),Ue=C("el-tag"),Ce=C("el-input"),Se=C("el-dialog"),ge=C("el-switch");return r(),E(Lt,{permission:"reviews/manage"},{default:u(()=>[o("div",t1e,[n.value?(r(),h("div",a1e,[s(re,{rows:8,animated:""})])):l.value?(r(),h(P,{key:1},[o("div",l1e,[o("div",null,[o("div",s1e,[s(J,{"separator-icon":c(Za)},{default:u(()=>[s(q,{to:{name:"reviews"}},{default:u(()=>[R(f(c(d)("Reviews")),1)]),_:1}),l.value.product?(r(),E(q,{key:0,to:{name:"reviews",query:{post_id:l.value.post_id}}},{default:u(()=>[R(f(l.value.product.post_title),1)]),_:1},8,["to"])):x("",!0),s(q,null,{default:u(()=>[l.value.reviewer_email?(r(),E(Ae,{key:0,content:l.value.reviewer_email,placement:"bottom"},{default:u(()=>[o("span",null,f(l.value.reviewer_name),1)]),_:1},8,["content"])):(r(),h("span",n1e,f(l.value.reviewer_name),1)),l.value.customer?(r(),E(ie,{key:2,class:"fct-goto-customer-pill",to:{name:"view_customer",params:{customer_id:l.value.customer.id}}},{default:u(()=>[R(f(c(d)("Go to Customer")),1),Z[8]||(Z[8]=o("span",{"aria-hidden":"true"},"→",-1))]),_:1,__:[8]},8,["to"])):x("",!0)]),_:1})]),_:1},8,["separator-icon"]),o("div",o1e,[s(Ht,{status:l.value.status},null,8,["status"])])])]),o("div",i1e,[s(de,{trigger:"click"},{dropdown:u(()=>[s(pe,null,{default:u(()=>[l.value.status!=="approved"?(r(),E(ee,{key:0,disabled:B.value,onClick:Z[0]||(Z[0]=ke=>Q("approved"))},{default:u(()=>[R(f(c(d)("Approve")),1)]),_:1},8,["disabled"])):x("",!0),l.value.status!=="spam"?(r(),E(ee,{key:1,disabled:B.value,onClick:Z[1]||(Z[1]=ke=>Q("spam"))},{default:u(()=>[R(f(c(d)("Mark as Spam")),1)]),_:1},8,["disabled"])):x("",!0),l.value.status!=="pending"?(r(),E(ee,{key:2,disabled:B.value,onClick:Z[2]||(Z[2]=ke=>Q("pending"))},{default:u(()=>[R(f(c(d)("Mark as Pending")),1)]),_:1},8,["disabled"])):x("",!0),l.value.status!=="trash"?(r(),E(ee,{key:3,disabled:B.value,onClick:Z[3]||(Z[3]=ke=>Q("trash"))},{default:u(()=>[R(f(c(d)("Move to Trash")),1)]),_:1},8,["disabled"])):x("",!0),s(ee,{onClick:K,class:"fct-dropdown-item--danger"},{default:u(()=>[R(f(c(d)("Delete Permanently")),1)]),_:1})]),_:1})]),default:u(()=>[s(le,{size:"small"},{default:u(()=>[R(f(c(d)("More Actions"))+" ",1),s(N,{class:"el-icon--right"},{default:u(()=>[s(c(Ls))]),_:1})]),_:1})]),_:1})])]),o("div",r1e,[o("div",d1e,[o("div",u1e,[s(c(xe),null,{default:u(()=>[s(c(Ve),{title:c(d)("Review Information"),border_bottom:"",title_size:"small"},{action:u(()=>[o("span",c1e,[s(Qi,{rating:l.value.rating,size:"small"},null,8,["rating"]),o("span",A1e,f(l.value.rating?Number(l.value.rating).toFixed(1):"—"),1)])]),_:1},8,["title"]),o("div",p1e,[o("div",{class:"fct-review-thread",ref_key:"chatScrollRef",ref:b},[o("div",f1e,[s(Ts,{name:l.value.reviewer_name,url:l.value.photo},null,8,["name","url"]),o("div",m1e,[o("div",h1e,[o("span",_1e,f(l.value.reviewer_name),1),s(Ue,{size:"small",effect:"light",class:"fct-customer-review-badge"},{default:u(()=>[R(f(c(d)("Customer review")),1)]),_:1}),l.value.user_id?x("",!0):(r(),E(Ue,{key:0,size:"small",type:"warning",effect:"light"},{default:u(()=>[R(f(c(d)("Guest")),1)]),_:1})),l.value.is_verified?(r(),E(Ue,{key:1,size:"small",type:"success",effect:"light"},{default:u(()=>[R(f(c(d)("Verified Purchase")),1)]),_:1})):x("",!0)]),o("div",v1e,[s(Sa,{"date-time":l.value.created_at,"with-time":!0},null,8,["date-time"])]),l.value.title?(r(),h("div",g1e,f(l.value.title),1)):x("",!0),o("div",y1e,f(l.value.content||c(d)("No review content.")),1),F.value&&F.value.length?(r(),h("div",b1e,[(r(!0),h(P,null,ae(F.value,(ke,Oe)=>(r(),h("button",{key:ke.id,type:"button",class:"fct-thread-media-thumb","aria-label":`${c(d)("Preview")} ${ke.name||c(d)("media")}`,onClick:Ee=>I(Oe)},[ke.type==="image"?(r(),h("img",{key:0,src:ke.url,alt:ke.name,loading:"lazy"},null,8,C1e)):(r(),h("div",k1e,Z[9]||(Z[9]=[o("span",{class:"fct-thread-media-play"},"▶",-1)])))],8,w1e))),128))])):x("",!0)])]),l.value.replies&&l.value.replies.length?(r(),h("div",B1e,[(r(!0),h(P,null,ae(l.value.replies,ke=>(r(),h("div",{key:ke.id,class:"fct-thread-reply-card"},[s(Ts,{name:ke.reviewer_name||c(d)("Customer"),url:ke.photo},null,8,["name","url"]),o("div",x1e,[o("div",S1e,[o("span",$1e,f(ke.reviewer_name||c(d)("Customer")),1),Number(ke.is_admin_reply)===1?(r(),E(Ue,{key:0,size:"small",effect:"light",class:"fct-admin-reply-badge"},{default:u(()=>[R(f(c(d)("Admin")),1)]),_:1})):x("",!0)]),o("div",F1e,[s(Sa,{"date-time":ke.created_at,"with-time":!0},null,8,["date-time"]),Z[10]||(Z[10]=o("span",{class:"fct-thread-meta-dot","aria-hidden":"true"},"·",-1)),s(de,{trigger:"click",disabled:_.value!==null,onCommand:Oe=>k(ke,Oe),onVisibleChange:Oe=>v.value=Oe?ke.id:null},{dropdown:u(()=>[s(pe,{class:"fct-thread-status-menu"},{default:u(()=>[(r(),h(P,null,ae(g,Oe=>s(ee,{key:Oe.status,command:Oe.status,disabled:Oe.status===ke.status,class:ue(["fct-thread-status-option",`fct-thread-status-option--${Oe.status}`,{"is-current":Oe.status===ke.status}])},{default:u(()=>[s(X,{name:Oe.status===ke.status?"Check":Oe.icon,class:"fct-thread-status-option-icon"},null,8,["name"]),o("span",null,f(Oe.label),1)]),_:2},1032,["command","disabled","class"])),64))]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:ue(["fct-thread-status-trigger",{"is-open":v.value===ke.id,"is-busy":_.value===ke.id}]),disabled:_.value!==null,"aria-label":c(d)("Reply status"),"aria-expanded":v.value===ke.id?"true":"false","aria-haspopup":"menu"},[s(Ht,{type:ke.status,class:"fct-thread-status-pill"},{default:u(()=>[o("span",null,f(y(ke.status)),1),s(N,{class:"fct-thread-status-caret","aria-hidden":"true"},{default:u(()=>[s(c(Ls))]),_:1})]),_:2},1032,["type"])],10,E1e)]),_:2},1032,["disabled","onCommand","onVisibleChange"]),s(le,{type:"danger",text:"",size:"small",class:"fct-thread-delete-btn","aria-label":c(d)("Delete reply"),onClick:Oe=>W(ke.id)},{default:u(()=>[s(X,{name:"TrashIcon"})]),_:2},1032,["aria-label","onClick"])]),o("div",U1e,f(ke.content),1)])]))),128))])):x("",!0)],512),U.value?(r(),h("div",I1e,[o("div",V1e,[s(Ce,{modelValue:p.value,"onUpdate:modelValue":Z[4]||(Z[4]=ke=>p.value=ke),type:"textarea",rows:3,placeholder:c(d)("Type a message"),"aria-label":c(d)("Reply to review"),resize:"none"},null,8,["modelValue","placeholder","aria-label"]),o("div",D1e,[s(le,{class:"fct-thread-reply-btn",size:"small",onClick:z,loading:m.value,disabled:m.value||!p.value.trim()},{default:u(()=>[R(f(c(d)("Reply")),1)]),_:1},8,["loading","disabled"])])])])):x("",!0)])]),_:1}),s(Se,{modelValue:D.value,"onUpdate:modelValue":Z[7]||(Z[7]=ke=>D.value=ke),title:c(d)("Review Media"),width:"720px","destroy-on-close":"","aria-label":c(d)("Review media preview")},{default:u(()=>[F.value&&F.value[T.value]?(r(),h("div",T1e,[F.value[T.value].type==="image"?(r(),h("img",{key:0,src:F.value[T.value].url,alt:F.value[T.value].name,class:"fct-review-media-preview-img"},null,8,Q1e)):(r(),h("video",{key:1,src:F.value[T.value].url,controls:"",class:"fct-review-media-preview-video"},null,8,M1e)),F.value.length>1?(r(),h("div",L1e,[s(le,{size:"small",disabled:T.value===0,onClick:Z[5]||(Z[5]=ke=>T.value--)},{default:u(()=>[R(" ← "+f(c(d)("Previous")),1)]),_:1},8,["disabled"]),o("span",R1e,f(T.value+1)+" / "+f(F.value.length),1),s(le,{size:"small",disabled:T.value===F.value.length-1,onClick:Z[6]||(Z[6]=ke=>T.value++)},{default:u(()=>[R(f(c(d)("Next"))+" → ",1)]),_:1},8,["disabled"])])):x("",!0)])):x("",!0)]),_:1},8,["modelValue","title","aria-label"])]),o("div",O1e,[o("div",P1e,[s(c(xe),null,{default:u(()=>[s(c(Ve),{title:c(d)("About the Reviews"),border_bottom:"",title_size:"small"},null,8,["title"]),s(c(Be),null,{default:u(()=>[o("div",H1e,[l.value.product?(r(),h("div",N1e,[o("span",K1e,[o("img",{src:i(),alt:""},null,8,G1e)]),o("span",z1e,[R(f(l.value.product.post_title)+" ",1),l.value.item_label?(r(),h("span",j1e,f(l.value.item_label),1)):x("",!0)]),l.value.product.view_url?(r(),h("a",{key:0,class:"fct-review-context-link",href:l.value.product.view_url,target:"_blank",rel:"noopener noreferrer","aria-label":c(d)("View product"),title:c(d)("View product")},[s(X,{name:"Redirect"})],8,q1e)):x("",!0)])):x("",!0),o("div",Y1e,[s(Ts,{class:"fct-review-context-avatar",name:l.value.reviewer_name,url:l.value.photo},null,8,["name","url"]),o("span",W1e,f(l.value.customer?l.value.reviewer_name:c(d)("Guest customer")),1),l.value.customer?(r(),E(ie,{key:0,class:"fct-review-context-link",to:{name:"view_customer",params:{customer_id:l.value.customer.id}},target:"_blank","aria-label":c(d)("View profile"),title:c(d)("View profile")},{default:u(()=>[s(X,{name:"Redirect"})]),_:1},8,["to","aria-label","title"])):(r(),E(Ue,{key:1,type:"info",round:"",class:"flex-shrink-0"},{default:u(()=>[R(f(c(d)("No account")),1)]),_:1}))])]),o("div",J1e,[o("div",null,[o("div",X1e,f(c(d)("Verified purchase")),1),o("div",Z1e,f(c(d)("Show the verified badge on this review")),1)]),s(ge,{"model-value":!!l.value.is_verified,loading:S.value,disabled:S.value,"aria-label":c(d)("Mark as verified purchase"),"onUpdate:modelValue":H},null,8,["model-value","loading","disabled","aria-label"])]),o("div",ebe,f(c(d)("Actions")),1),o("div",tbe,[(r(!0),h(P,null,ae(A.value,ke=>(r(),h("button",{key:ke.status,type:"button",class:ue(["fct-review-action",`fct-review-action--${ke.status}`]),disabled:B.value,"aria-label":ke.aria,title:ke.aria,onClick:Oe=>Q(ke.status)},[ke.status==="approved"?(r(),E(X,{key:0,class:"fct-review-action-icon",name:"Check"})):ke.status==="spam"?(r(),E(X,{key:1,class:"fct-review-action-icon",name:"FlagIcon"})):ke.status==="trash"?(r(),E(X,{key:2,class:"fct-review-action-icon",name:"TrashIcon"})):(r(),E(X,{key:3,class:"fct-review-action-icon",name:"Clock"})),o("span",lbe,f(ke.label),1)],10,abe))),128))])]),_:1})]),_:1}),V.value?(r(),E(c(xe),{key:0},{default:u(()=>[s(c(Ve),{title:c(d)("Helpful Votes"),text:c(d)("How shoppers reacted to this review"),title_size:"small"},null,8,["title","text"]),s(c(Be),null,{default:u(()=>[o("div",sbe,[o("div",nbe,[s(X,{name:"ThumbUp"}),o("span",obe,f(V.value.helpful),1),o("span",ibe,f(c(d)("Helpful votes")),1)]),o("div",rbe,[s(X,{name:"ThumbDown"}),o("span",dbe,f(V.value.not_helpful),1),o("span",ube,f(c(d)("Not helpful votes")),1)])])]),_:1})]),_:1})):x("",!0)])])])])],64)):(r(),h("div",cbe,f(c(d)("Review not found")),1))])]),_:1})}}},pbe={class:"setting-wrap fct-review-settings"},fbe={class:"setting-wrap-inner"},mbe={class:"fct-setting-form-row"},hbe={class:"fct-setting-form-content flex gap-3.5 flex-1"},_be={class:"fct-inline-tip"},vbe={key:0,class:"fct-setting-form-row"},gbe={class:"grid gap-3 mb-6"},ybe={class:"grid gap-3"},bbe={key:1},wbe={class:"fct-setting-form-row"},Cbe={class:"fct-setting-form-content"},kbe={class:"fct-inline-tip"},Bbe={class:"fct-setting-form-fields self-center"},xbe={class:"flex flex-col"},Sbe={class:"fct-review-radio-label"},$be={class:"fct-review-radio-text"},Fbe={class:"fct-setting-form-row"},Ebe={class:"fct-setting-form-content"},Ube={class:"fct-inline-tip"},Ibe={class:"fct-setting-form-fields self-center flex justify-end"},Vbe={class:"fct-setting-form-row"},Dbe={class:"fct-setting-form-content"},Tbe={class:"fct-inline-tip"},Qbe={class:"fct-setting-form-fields self-center flex justify-end"},Mbe={key:0,class:"fct-setting-form-row is-child"},Lbe={class:"fct-setting-form-content"},Rbe={class:"fct-inline-tip"},Obe={class:"fct-setting-form-fields self-center flex justify-end"},Pbe={class:"fct-setting-form-row"},Hbe={class:"fct-setting-form-content"},Nbe={class:"fct-inline-tip"},Kbe={class:"fct-setting-form-fields self-center flex justify-end"},Gbe={class:"fct-setting-form-row"},zbe={class:"fct-setting-form-content"},jbe={class:"fct-inline-tip"},qbe={class:"fct-setting-form-fields self-center flex justify-end"},Ybe={class:"fct-setting-form-row"},Wbe={class:"fct-setting-form-content"},Jbe={class:"fct-inline-tip"},Xbe={key:0,class:"fct-inline-tip"},Zbe={class:"fct-setting-form-fields self-center flex justify-end"},e0e={class:"fct-setting-form-row is-child"},t0e={class:"fct-setting-form-content"},a0e={class:"fct-setting-form-fields self-center flex justify-end"},l0e={class:"fct-setting-form-row is-child"},s0e={class:"fct-setting-form-content"},n0e={class:"fct-setting-form-fields self-center flex justify-end"},o0e={class:"fct-setting-form-row is-child"},i0e={class:"fct-setting-form-content"},r0e={class:"fct-inline-tip"},d0e={class:"fct-setting-form-fields self-center flex justify-end"},u0e={class:"fct-setting-form-row is-child"},c0e={class:"fct-setting-form-content"},A0e={class:"fct-setting-form-fields self-center"},p0e={class:"fct-setting-form-row"},f0e={class:"fct-setting-form-content"},m0e={class:"fct-inline-tip"},h0e={key:0,class:"fct-inline-tip"},_0e={class:"fct-setting-form-fields self-center flex justify-end"},v0e=Object.assign({name:"ReviewSettings"},{__name:"ReviewSettings",setup(e){const t=xe,a=Be,l=Ke.get("app_config.isProActive"),n=M(!0),i=M(!1);let A=!1;const p=As(),m=[{value:"verified_buyers",label:d("Verified buyers only"),desc:d("Only customers who purchased the product.")},{value:"logged_in",label:d("Logged-in users"),desc:d("Any logged-in user can leave a review.")},{value:"anyone",label:d("Anyone"),desc:d("Guests can leave reviews too.")}],_=Ds({active:"yes",review_permission_mode:"verified_buyers",auto_approve_reviews:"no",show_verified_badge:"yes",enable_star_rating:"yes",star_rating_required:"yes",reviews_per_page:10,enable_photo_reviews:"no",auto_approve_photo_reviews:"no",max_photos_per_review:5,max_photo_size_mb:1,allowed_photo_types:["jpeg","png","gif","webp"],enable_helpful_votes:"yes"});let g={};const y=()=>{n.value=!0,A=!1,ce.get("settings/modules",{}).then(k=>{g=k.settings||{};const b=g.reviews||{};Object.keys(_).forEach(w=>{b[w]!==void 0&&(_[w]=b[w])}),A=!0}).catch(k=>{var b;j.error(((b=k==null?void 0:k.data)==null?void 0:b.message)||(k==null?void 0:k.message)||d("Could not load review settings."))}).finally(()=>{n.value=!1})},v=()=>{n.value||!A||(i.value=!0,ce.post("settings/modules",{...g,reviews:{..._}}).then(()=>{j.success(d("Settings saved successfully"))}).catch(k=>{var b;j.error(((b=k==null?void 0:k.data)==null?void 0:b.message)||(k==null?void 0:k.message)||d("Failed to save settings"))}).finally(()=>{i.value=!1}))};return Te(()=>{y(),p.bind(["mod+s"],k=>{k.preventDefault(),v()})}),Ga(()=>{p.unbind(["mod+s"])}),(k,b)=>{const w=C("el-switch"),B=C("el-skeleton-item"),S=C("el-skeleton"),V=C("el-radio"),F=C("el-radio-group"),$=C("el-input-number"),U=C("el-button"),D=C("el-checkbox"),T=C("el-checkbox-group");return r(),h("div",pbe,[s($a,{heading:c(d)("Product Reviews"),loading:i.value,"show-cmnd-icon":!0,onOnSave:v},null,8,["heading","loading"]),o("div",fbe,[s(Fa),s(c(t),null,{default:u(()=>[s(c(a),null,{default:u(()=>[o("div",mbe,[o("div",hbe,[s(w,{modelValue:_.active,"onUpdate:modelValue":b[0]||(b[0]=I=>_.active=I),"active-value":"yes","inactive-value":"no",disabled:n.value},null,8,["modelValue","disabled"]),o("div",null,[s(Ot,{title:c(d)("Enable Product Reviews")},null,8,["title"]),o("p",_be,f(_.active==="yes"?c(d)("Customers can leave ratings and reviews on products."):c(d)("Customers cannot leave reviews right now.")),1)])])]),s(ma,{visible:_.active==="yes",accordion:""},{default:u(()=>[n.value?(r(),h("div",vbe,[s(S,{animated:"",class:"w-full"},{template:u(()=>[o("div",gbe,[s(B,{variant:"p",class:"w-[20%]"}),s(B,{variant:"p"})]),o("div",ybe,[s(B,{variant:"p",class:"w-[20%]"}),s(B,{variant:"p"})])]),_:1})])):x("",!0),n.value?x("",!0):(r(),h("div",bbe,[o("div",wbe,[o("div",Cbe,[s(Ot,{title:c(d)("Who can leave reviews?")},null,8,["title"]),o("p",kbe,f(c(d)("Who is offered the review form on a product.")),1)]),o("div",Bbe,[s(F,{modelValue:_.review_permission_mode,"onUpdate:modelValue":b[1]||(b[1]=I=>_.review_permission_mode=I),class:"fct-review-stacked-radios"},{default:u(()=>[(r(),h(P,null,ae(m,I=>s(V,{key:I.value,value:I.value},{default:u(()=>[o("div",xbe,[o("span",Sbe,f(I.label),1),o("span",$be,f(I.desc),1)])]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"])])]),o("div",Fbe,[o("div",Ebe,[s(Ot,{title:c(d)("Show 'Verified Owner' Badge")},null,8,["title"]),o("p",Ube,f(c(d)("Display a verified badge on reviews from customers who purchased the product.")),1)]),o("div",Ibe,[s(w,{modelValue:_.show_verified_badge,"onUpdate:modelValue":b[2]||(b[2]=I=>_.show_verified_badge=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",Vbe,[o("div",Dbe,[s(Ot,{title:c(d)("Enable Star Ratings")},null,8,["title"]),o("p",Tbe,f(c(d)("Allow customers to rate products with stars.")),1)]),o("div",Qbe,[s(w,{modelValue:_.enable_star_rating,"onUpdate:modelValue":b[3]||(b[3]=I=>_.enable_star_rating=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),_.enable_star_rating==="yes"?(r(),h("div",Mbe,[o("div",Lbe,[s(Ot,{title:c(d)("Star Ratings Required")},null,8,["title"]),o("p",Rbe,f(c(d)("When off, customers can submit text-only reviews without a star rating.")),1)]),o("div",Obe,[s(w,{modelValue:_.star_rating_required,"onUpdate:modelValue":b[4]||(b[4]=I=>_.star_rating_required=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])])):x("",!0),o("div",Pbe,[o("div",Hbe,[s(Ot,{title:c(d)("Auto-approve Reviews")},null,8,["title"]),o("p",Nbe,f(c(d)("Publish new reviews immediately, without moderation.")),1)]),o("div",Kbe,[s(w,{modelValue:_.auto_approve_reviews,"onUpdate:modelValue":b[5]||(b[5]=I=>_.auto_approve_reviews=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",Gbe,[o("div",zbe,[s(Ot,{title:c(d)("Reviews Per Page")},null,8,["title"]),o("p",jbe,f(c(d)("How many reviews a product page lists before paging.")),1)]),o("div",qbe,[s($,{modelValue:_.reviews_per_page,"onUpdate:modelValue":b[6]||(b[6]=I=>_.reviews_per_page=I),min:1,max:50},null,8,["modelValue"])])]),o("div",Ybe,[o("div",Wbe,[s(Ot,{title:c(d)("Photo Reviews")},null,8,["title"]),o("p",Jbe,f(c(d)("Let customers attach photos to their reviews.")),1),c(l)?x("",!0):(r(),h("p",Xbe,[R(f(c(d)("This feature is only available in FluentCart Pro."))+" ",1),s(U,{size:"small",tag:"a",link:"",href:c(Ro)("feature_lock_review_settings"),target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Upgrade to Pro")),1)]),_:1},8,["href"])]))]),o("div",Zbe,[s(w,{modelValue:_.enable_photo_reviews,"onUpdate:modelValue":b[7]||(b[7]=I=>_.enable_photo_reviews=I),"active-value":"yes","inactive-value":"no",disabled:!c(l)},null,8,["modelValue","disabled"])])]),c(l)&&_.enable_photo_reviews==="yes"?(r(),h(P,{key:1},[o("div",e0e,[o("div",t0e,[s(Ot,{title:c(d)("Max Photos Per Review")},null,8,["title"])]),o("div",a0e,[s($,{modelValue:_.max_photos_per_review,"onUpdate:modelValue":b[8]||(b[8]=I=>_.max_photos_per_review=I),min:1,max:10},null,8,["modelValue"])])]),o("div",l0e,[o("div",s0e,[s(Ot,{title:c(d)("Max File Size (MB)")},null,8,["title"])]),o("div",n0e,[s($,{modelValue:_.max_photo_size_mb,"onUpdate:modelValue":b[9]||(b[9]=I=>_.max_photo_size_mb=I),min:.1,max:10,step:.1,precision:1,"controls-position":"right"},null,8,["modelValue"])])]),o("div",o0e,[o("div",i0e,[s(Ot,{title:c(d)("Auto-approve Photo Reviews")},null,8,["title"]),o("p",r0e,f(c(d)("Publish reviews with photos immediately. When off, photo reviews always wait for moderation.")),1)]),o("div",d0e,[s(w,{modelValue:_.auto_approve_photo_reviews,"onUpdate:modelValue":b[10]||(b[10]=I=>_.auto_approve_photo_reviews=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",u0e,[o("div",c0e,[s(Ot,{title:c(d)("Allowed File Types")},null,8,["title"])]),o("div",A0e,[s(T,{modelValue:_.allowed_photo_types,"onUpdate:modelValue":b[11]||(b[11]=I=>_.allowed_photo_types=I)},{default:u(()=>[s(D,{label:"jpeg"},{default:u(()=>b[13]||(b[13]=[R("JPEG",-1)])),_:1,__:[13]}),s(D,{label:"png"},{default:u(()=>b[14]||(b[14]=[R("PNG",-1)])),_:1,__:[14]}),s(D,{label:"gif"},{default:u(()=>b[15]||(b[15]=[R("GIF",-1)])),_:1,__:[15]}),s(D,{label:"webp"},{default:u(()=>b[16]||(b[16]=[R("WebP",-1)])),_:1,__:[16]})]),_:1},8,["modelValue"])])])],64)):x("",!0),o("div",p0e,[o("div",f0e,[s(Ot,{title:c(d)("Helpful Votes")},null,8,["title"]),o("p",m0e,f(c(d)("Let visitors mark reviews as helpful.")),1),c(l)?x("",!0):(r(),h("p",h0e,[R(f(c(d)("This feature is only available in FluentCart Pro."))+" ",1),s(U,{size:"small",tag:"a",link:"",href:c(Ro)("feature_lock_review_settings"),target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Upgrade to Pro")),1)]),_:1},8,["href"])]))]),o("div",_0e,[s(w,{modelValue:_.enable_helpful_votes,"onUpdate:modelValue":b[12]||(b[12]=I=>_.enable_helpful_votes=I),"active-value":"yes","inactive-value":"no",disabled:!c(l)},null,8,["modelValue","disabled"])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}}}),g0e={class:"flex flex-col gap-1.5"},y0e={class:"block"},b0e={class:"block text-xs text-system-light dark:text-gray-400"},w0e={key:1},C0e={class:"block"},k0e={class:"block text-xs text-system-light dark:text-gray-400"},B0e={class:"inline-flex items-center flex-wrap gap-1.5 text-sm"},x0e={key:0,class:"text-system-mid dark:text-gray-400"},S0e={key:1,class:"inline-flex items-center flex-wrap gap-1.5 text-sm"},$0e={key:0,class:"text-system-mid dark:text-gray-400"},F0e={class:"flex flex-col gap-1.5"},E0e={class:"block"},U0e={class:"block text-xs text-system-mid dark:text-gray-400"},I0e={key:1},V0e={class:"block"},D0e={class:"block text-xs text-system-mid dark:text-gray-400"},T0e=["aria-label"],Q0e={__name:"PricingRulesTable",props:{pricingRuleTable:{type:Object,required:!0}},setup(e){const t=e,a=Oa(),l=zl.has("dynamic_pricing/manage"),n=M(new Set),i=B=>d("Toggle status for %1$s",B.display_name),A=B=>d("Actions for %1$s",B.display_name),p=B=>({discount:{label:d("Discount"),icon:"Tag",type:"success"},fee:{label:d("Fee"),icon:"Tag",type:"info"}})[B]||{label:B,icon:"Tag",type:"info"},m=B=>({checkout:{label:d("Checkout"),icon:"Cart",type:"blue"},shipping:{label:d("Shipping"),icon:"Truck",type:"blue"},line_item:{label:d("Line Item"),icon:"ShoppingBag",type:"blue"}})[B]||{label:B,icon:"Cart",type:"blue"},_={first:d("First purchase only"),renewals:d("Store managed renewals"),upgrades:d("Upgrades & downgrades")},g=B=>{const S=B.config||{},V=[];_[S.when_to_apply]&&V.push(_[S.when_to_apply]);const $=(Array.isArray(S.conditions)?S.conditions:[]).reduce((U,D)=>U+(Array.isArray(D)?D.length:0),0);return $===1?V.push(d("1 condition")):$>1&&V.push(d("%1$s conditions",$)),V.join(" · ")},y=B=>d("Created %1$s",hl(B.created_at)),v=B=>{const S=at.utc(),V=B.start_date?at.utc(B.start_date):null,F=B.end_date?at.utc(B.end_date):null;return F&&F.isBefore(S)?d("Ended %1$s",hl(B.end_date)):V&&V.isAfter(S)?F?`${hl(B.start_date)} – ${hl(B.end_date)}`:d("Starts %1$s",hl(B.start_date)):F?d("Until %1$s",hl(B.end_date)):d("No end date")},k=B=>{if(n.value.has(B.id))return;const S=B.status,V=S==="active"?"inactive":"active";n.value.add(B.id),B.status=V,ce.put(`pricing_rules/${B.id}/status`,{status:V}).then(()=>{j.success(d("Status updated successfully"))}).catch(F=>{var $;B.status=S,j.error((($=F==null?void 0:F.data)==null?void 0:$.message)||d("Failed to update status"))}).finally(()=>{n.value.delete(B.id)})},b=(B,S)=>{if(B==="edit"){a.push({name:"dynamic_pricing_edit",params:{id:S.id}});return}B==="delete"&&w(S)},w=B=>{Ra(d("Are you sure you want to delete this rule : %1$s ?",B.display_name),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete(`pricing_rules/${B.id}`).then(S=>{j.success((S==null?void 0:S.message)||d("Pricing rule deleted successfully")),t.pricingRuleTable.fetch()}).catch(S=>{var V;j.error(((V=S==null?void 0:S.data)==null?void 0:V.message)||d("Failed to delete pricing rule"))})}).catch(()=>{})};return(B,S)=>{const V=C("el-table-column"),F=C("el-switch"),$=C("el-dropdown-item"),U=C("el-dropdown-menu"),D=C("el-dropdown"),T=C("el-table");return r(),E(T,{data:e.pricingRuleTable.getTableData(),class:ue(["w-full",{"compact-table":c(l)}])},{empty:u(()=>[s(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No pricing rules found!")},null,8,["text"])]),default:u(()=>[s(V,{label:c(d)("Rule"),width:200},{default:u(I=>[c(l)?(r(),E(ta,{key:0,class:"hover:no-underline",to:{name:"dynamic_pricing_edit",params:{id:I.row.id}}},{default:u(()=>[o("div",g0e,[o("span",y0e,f(I.row.display_name),1),o("span",b0e,f(I.row.name),1)])]),_:2},1032,["to"])):(r(),h("div",w0e,[o("span",C0e,f(I.row.display_name),1),o("span",k0e,f(I.row.name),1)]))]),_:1},8,["label"]),e.pricingRuleTable.isColumnVisible("type")?(r(),E(V,{key:0,label:c(d)("What it does"),width:340},{default:u(I=>[c(l)?(r(),E(ta,{key:0,class:"hover:no-underline",to:{name:"dynamic_pricing_edit",params:{id:I.row.id}}},{default:u(()=>[o("span",B0e,[s(Ht,{type:p(I.row.price_type).type,text:p(I.row.price_type).label,icon:p(I.row.price_type).icon},null,8,["type","text","icon"]),R(" "+f(c(d)("to"))+" ",1),s(Ht,{type:m(I.row.applies_to).type,text:m(I.row.applies_to).label,icon:m(I.row.applies_to).icon},null,8,["type","text","icon"]),g(I.row)?(r(),h("span",x0e," · "+f(g(I.row)),1)):x("",!0)])]),_:2},1032,["to"])):(r(),h("span",S0e,[s(Ht,{type:p(I.row.price_type).type,text:p(I.row.price_type).label,icon:p(I.row.price_type).icon},null,8,["type","text","icon"]),R(" "+f(c(d)("to"))+" ",1),s(Ht,{type:m(I.row.applies_to).type,text:m(I.row.applies_to).label,icon:m(I.row.applies_to).icon},null,8,["type","text","icon"]),g(I.row)?(r(),h("span",$0e," · "+f(g(I.row)),1)):x("",!0)]))]),_:1},8,["label"])):x("",!0),e.pricingRuleTable.isColumnVisible("date")?(r(),E(V,{key:1,label:c(d)("Schedule"),width:160},{default:u(I=>[c(l)?(r(),E(ta,{key:0,class:"hover:no-underline",to:{name:"dynamic_pricing_edit",params:{id:I.row.id}}},{default:u(()=>[o("div",F0e,[o("span",E0e,f(v(I.row)),1),o("span",U0e,f(y(I.row)),1)])]),_:2},1032,["to"])):(r(),h("div",I0e,[o("span",V0e,f(v(I.row)),1),o("span",D0e,f(y(I.row)),1)]))]),_:1},8,["label"])):x("",!0),e.pricingRuleTable.isColumnVisible("status")?(r(),E(V,{key:2,label:c(d)("Status"),width:80,align:"center"},{default:u(I=>[c(l)?(r(),E(F,{key:0,"model-value":I.row.status==="active",disabled:n.value.has(I.row.id),loading:n.value.has(I.row.id),"aria-label":i(I.row),onChange:L=>k(I.row)},null,8,["model-value","disabled","loading","aria-label","onChange"])):(r(),E(Ht,{key:1,status:I.row.status},null,8,["status"]))]),_:1},8,["label"])):x("",!0),c(l)?(r(),E(V,{key:3,label:c(d)("Actions"),width:80,align:"right"},{default:u(I=>[s(D,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:L=>b(L,I.row)},{dropdown:u(()=>[s(U,null,{default:u(()=>[s($,{command:"edit"},{default:u(()=>[s(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:1}),s($,{class:"item-destructive",command:"delete"},{default:u(()=>[s(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})]),_:1})]),default:u(()=>[o("button",{class:"more-btn mr-2",type:"button","aria-label":A(I.row)},[s(X,{name:"More"})],8,T0e)]),_:2},1032,["onCommand"])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data","class"])}}},M0e={class:"table-cell"},L0e={class:"flex flex-col items-start gap-1.5 w-full"},R0e={class:"table-cell"},O0e={class:"flex items-center gap-1.5 w-full"},P0e={class:"table-cell"},H0e={class:"flex flex-col items-start gap-1.5 w-full"},N0e={class:"table-cell justify-center"},K0e={class:"table-cell justify-end"},G0e={__name:"PricingRulesLoader",props:{nextPageCount:{type:Number,default:0},pricingRuleTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=zl.has("dynamic_pricing/manage"),l=Array.from({length:t.nextPageCount},(n,i)=>i+1);return(n,i)=>{const A=C("el-skeleton-item"),p=C("el-table-column"),m=C("el-table"),_=C("el-skeleton");return r(),E(_,{animated:""},{template:u(()=>[s(m,{data:c(l),class:ue(["w-full",{"compact-table":c(a)}])},{empty:u(()=>i[0]||(i[0]=[])),default:u(()=>[s(p,{label:c(d)("Rule"),width:200},{default:u(()=>[o("div",M0e,[o("div",L0e,[s(A,{variant:"p",class:"w-4/5"}),s(A,{variant:"p",class:"w-1/2"})])])]),_:1},8,["label"]),e.pricingRuleTable.isColumnVisible("type")?(r(),E(p,{key:0,label:c(d)("What it does"),width:340},{default:u(()=>[o("div",R0e,[o("div",O0e,[s(A,{variant:"button",class:"w-[100px] h-6 rounded-md"}),s(A,{variant:"text",class:"w-8"}),s(A,{variant:"button",class:"w-[100px] h-6 rounded-md"}),s(A,{variant:"text",class:"w-[96px]"})])])]),_:1},8,["label"])):x("",!0),e.pricingRuleTable.isColumnVisible("date")?(r(),E(p,{key:1,label:c(d)("Schedule"),width:160},{default:u(()=>[o("div",P0e,[o("div",H0e,[s(A,{variant:"p",class:"w-4/5"}),s(A,{variant:"p",class:"w-3/5"})])])]),_:1},8,["label"])):x("",!0),e.pricingRuleTable.isColumnVisible("status")?(r(),E(p,{key:2,label:c(d)("Status"),width:80,align:"center"},{default:u(()=>[o("div",N0e,[s(A,{variant:"button",class:"w-10 h-5 rounded-full"})])]),_:1},8,["label"])):x("",!0),c(a)?(r(),E(p,{key:3,label:c(d)("Actions"),width:80,align:"right"},{default:u(()=>[o("div",K0e,[s(A,{variant:"circle",class:"w-6 h-6"})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data","class"])]),_:1})}}},z0e={class:"fct-module-disabled-notice"},j0e={class:"fct-disabled-notice-title"},q0e={class:"fct-disabled-notice-text"},Gd=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=C("el-icon"),n=C("router-link");return r(),h("div",z0e,[s(l,{class:"fct-disabled-notice-icon"},{default:u(()=>[s(c(cA))]),_:1}),o("h3",j0e,f(c(d)("Dynamic Pricing Inactive")),1),o("p",q0e,[R(f(c(d)("Dynamic Pricing module is currently disabled. Please enable it in "))+" ",1),s(n,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("module settings")),1)]),_:1}),R(" "+f(c(d)(" to manage pricing rules.")),1)])])}}});class Y0e extends ds{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="id"}getTabs(){return{all:d("All"),active:d("Active"),inactive:d("Inactive")}}getToggleableColumns(){return[{label:d("Status"),value:"status"},{label:d("What it does"),value:"type"},{label:d("Schedule"),value:"date"}]}getSortableColumns(){return[{label:d("ID"),value:"id"},{label:d("Name"),value:"name"},{label:d("Status"),value:"status"},{label:d("Date"),value:"updated_at"}]}getSearchHint(){return d("Search rules by name.")}getSearchGuideOptions(){return[]}getTableName(){return"pricing_rule_table"}getFetchUrl(){return"pricing_rules"}parseResponse(t){return t.pricing_rules}}function W0e(e){return Y0e.init(e)}const J0e={class:"fct-pricing-rules-page fct-layout-width"},X0e={class:"fct-pricing-rules-wrap"},Z0e={key:2,class:"py-10"},ewe={__name:"AllPricingRules",setup(e){const t=G(()=>Ke.get("app_config.isProActive")),a=G(()=>Ke.get("modules_settings.dynamic_pricing.active")==="yes"),l=G(()=>t.value&&a.value),n=W0e({fetch:!1});return Te(()=>{l.value&&n.fetch()}),(i,A)=>{const p=C("el-button");return r(),h("div",J0e,[l.value?(r(),h(P,{key:0},[s(Xa,{title:c(d)("Dynamic Pricing")},{action:u(()=>[s(Lt,{permission:"dynamic_pricing/manage"},{default:u(()=>[s(p,{type:"primary",tag:"router-link",to:{name:"dynamic_pricing_create"}},{default:u(()=>[R(f(c(d)("Add New Rule")),1)]),_:1})]),_:1})]),_:1},8,["title"]),o("div",X0e,[s(us,{table:c(n)},{default:u(()=>[c(n).isLoading()?(r(),E(G0e,{key:0,"pricing-rule-table":c(n),"next-page-count":c(n).nextPageCount},null,8,["pricing-rule-table","next-page-count"])):(r(),E(Q0e,{key:1,"pricing-rule-table":c(n)},null,8,["pricing-rule-table"]))]),_:1},8,["table"])])],64)):t.value&&!a.value?(r(),E(Gd,{key:1})):(r(),h("div",Z0e,[s(cs,{placement:"feature_lock_dynamic_pricing",title:c(d)("Dynamic Pricing"),text:c(d)("This feature is only available in FluentCart Pro")},null,8,["title","text"])]))])}}},twe=["aria-label"],awe=["aria-checked","tabindex","disabled","onClick"],lwe={class:"form-note mt-3"},Un=[{value:"line_item",label:d("All line items"),icon:"ShoppingBag",hint:d("Applied to every line item in the cart when the conditions match.")},{value:"checkout",label:d("Checkout"),icon:"Cart",hint:d("Discount or fee is applied once to the overall checkout total.")},{value:"shipping",label:d("Shipping"),icon:"Truck",hint:d("Discount or fee is applied to the shipping cost.")}],Rf={__name:"AppliesToOptions",props:{modelValue:{type:String,default:""},isDisabled:{type:Function,default:()=>!1}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,n=M([]),i=G(()=>{const g=Un.find(y=>y.value===a.modelValue);return g?g.hint:d("Where should this rule affect the price?")}),A=()=>Un.filter(g=>!a.isDisabled(g.value)).map(g=>g.value),p=G(()=>{const g=A();return g.includes(a.modelValue)?a.modelValue:g[0]}),m=g=>{l("update:modelValue",g)},_=g=>{const y=A();if(!y.length)return;const v=y[(y.indexOf(p.value)+g+y.length)%y.length];m(v),$e(()=>{var k;(k=n.value[Un.findIndex(b=>b.value===v)])==null||k.focus()})};return(g,y)=>(r(),h(P,null,[o("div",{class:"fct-pricing-rule-applies-to-options",role:"radiogroup","aria-label":c(d)("Applies To")},[(r(),h(P,null,ae(Un,(v,k)=>o("button",{key:v.value,ref_for:!0,ref:b=>{n.value[k]=b},type:"button",role:"radio",class:ue(["fct-pricing-rule-applies-to-option",{"is-selected":e.modelValue===v.value}]),"aria-checked":e.modelValue===v.value,tabindex:p.value===v.value?0:-1,disabled:e.isDisabled(v.value),onClick:b=>m(v.value),onKeydown:[y[0]||(y[0]=ea(Ge(b=>_(-1),["prevent"]),["left"])),y[1]||(y[1]=ea(Ge(b=>_(-1),["prevent"]),["up"])),y[2]||(y[2]=ea(Ge(b=>_(1),["prevent"]),["right"])),y[3]||(y[3]=ea(Ge(b=>_(1),["prevent"]),["down"]))]},[s(X,{name:v.icon},null,8,["name"]),o("span",null,f(v.label),1)],42,awe)),64))],8,twe),o("div",lwe,[o("p",null,f(i.value),1)])],64))}},swe={class:"fct-pricing-rule-when-title"},nwe={class:"fct-pricing-rule-when-hint"},Of={__name:"WhenToApplyOptions",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const a=t,l=[{value:"every",label:d("Every purchase"),hint:d("Applies to all eligible purchases.")},{value:"first",label:d("First purchase only"),hint:d("Only applies when a customer purchases for the first time.")},{value:"renewals",label:d("Store managed renewals"),hint:d("Applies when a customer pays a renewal invoice issued by the store.")},{value:"upgrades",label:d("Upgrades & downgrades"),hint:d("Applies when a customer moves a subscription to another plan.")}];return(n,i)=>{const A=C("el-radio"),p=C("el-radio-group");return r(),E(p,{"model-value":e.modelValue,class:"fct-pricing-rule-when-options",disabled:e.disabled,"onUpdate:modelValue":i[0]||(i[0]=m=>a("update:modelValue",m))},{default:u(()=>[(r(),h(P,null,ae(l,m=>s(A,{key:m.value,label:m.value},{default:u(()=>[o("span",swe,f(m.label),1),s(ma,{visible:e.modelValue===m.value,accordion:""},{default:u(()=>[o("span",nwe,f(m.hint),1)]),_:2},1032,["visible"])]),_:2},1032,["label"])),64))]),_:1},8,["model-value","disabled"])}}},owe={class:"fct-pricing-rule-fee-tax"},iwe={class:"form-note"},Pf={__name:"FeeTaxOption",props:{modelValue:{type:String,default:"yes"}},emits:["update:modelValue"],setup(e,{emit:t}){const a=t;return(l,n)=>{const i=C("el-switch");return r(),h("div",owe,[s(i,{"model-value":e.modelValue!=="no","active-text":c(d)("Charge tax on this fee"),"onUpdate:modelValue":n[0]||(n[0]=A=>a("update:modelValue",A?"yes":"no"))},null,8,["model-value","active-text"]),o("div",iwe,[o("p",null,f(c(d)("Tax is worked out on the fee at the same rate as the cart items.")),1)])])}}},rwe={class:"fct-create-pricing-rule-page fct-layout-width"},dwe={class:"single-page-header flex items-center justify-between gap-4"},uwe={class:"single-page-header-title-wrap"},cwe={class:"single-page-body"},Awe={class:"fct-pricing-rule-form"},pwe={class:"fct-form-group"},fwe={class:"required"},mwe={class:"fct-form-group"},hwe={class:"required"},_we={class:"form-note"},vwe={class:"fct-form-group fct-pricing-rule-form-section"},gwe={class:"required"},ywe={class:"fct-rule-template-content"},bwe={class:"fct-rule-template-title"},wwe={class:"fct-rule-template-text"},Cwe={class:"fct-form-group fct-pricing-rule-form-section"},kwe={class:"grid grid-cols-1 sm:grid-cols-3 gap-3"},Bwe={class:"fct-pricing-rule-price-type"},xwe={class:"fct-pricing-rule-apply-as"},Swe={class:"fct-pricing-rule-amount"},$we={class:"fct-form-group"},Fwe={class:"required"},Ewe={class:"form-note"},Uwe={key:2,class:"py-10"},Iwe={__name:"CreateNewPricingRule",setup(e){const t=Oa(),a=G(()=>Ke.get("app_config.isProActive")),l=G(()=>Ke.get("modules_settings.dynamic_pricing.active")==="yes"),n=G(()=>a.value&&l.value),i=[{value:"scratch",icon:"Document",title:d("Start from scratch"),description:d("Build your own rule from an empty canvas.")},{value:"volume_discount",icon:"Discount",title:d("Bulk Purchase Discount"),description:d("10% discount for bulk purchases."),preset:{display_name:d("Bulk Purchase Discount"),price_type:"discount",applies_to:"line_item",when_to_apply:"every",apply_as:"percentage",amount:"10",conditions:[[{key:"quantity",operator:"is_at_least",value:"5"}]]}},{value:"free_shipping_minimum",icon:"Truck",title:d("Free‑shipping minimum"),description:d("Free shipping when the subtotal is at least %1$s.",_t.formatNumber(7500)),preset:{display_name:d("Free‑shipping minimum"),price_type:"discount",applies_to:"shipping",when_to_apply:"every",apply_as:"percentage",amount:"100",conditions:[[{key:"cart_subtotal",operator:"is_at_least",value:7500}]]}}],A=[{value:"discount",label:d("Discount")},{value:"fee",label:d("Fee")}],p=[{value:"percentage",label:d("Percentage")},{value:"fixed",label:d("Fixed")}],m=G(()=>Ke.get("shop.currency_sign","$")),_={price_type:"discount",applies_to:"",when_to_apply:"",apply_as:"percentage",amount:"",conditions:[]},g=M({name:"",display_name:"",rule_type:"scratch",price_type:_.price_type,applies_to:_.applies_to,config:{when_to_apply:_.when_to_apply,apply_as:_.apply_as,amount:_.amount,fee_taxable:"yes",conditions:[]}}),y=M(!1),v=S=>S==="shipping"&&g.value.config.when_to_apply==="renewals",k=S=>S==="fee"&&g.value.config.when_to_apply==="renewals",b=S=>{var V;return(V=i.find(F=>F.value===S))==null?void 0:V.preset},w=S=>{g.value.price_type=S.price_type,g.value.applies_to=S.applies_to,g.value.config.when_to_apply=S.when_to_apply,g.value.config.apply_as=S.apply_as,g.value.config.amount=S.amount,g.value.config.conditions=JSON.parse(JSON.stringify(S.conditions))};be(()=>g.value.rule_type,(S,V)=>{const F=b(S),$=b(V),U=g.value.display_name;F?(w(F),(!U||U===($==null?void 0:$.display_name))&&(g.value.display_name=F.display_name)):$&&(w(_),U===$.display_name&&(g.value.display_name=""))}),be(()=>g.value.config.when_to_apply,S=>{S==="renewals"&&g.value.applies_to==="shipping"&&(g.value.applies_to=""),S==="renewals"&&g.value.price_type==="fee"&&(g.value.price_type="discount")});const B=()=>{if(!g.value.name){j.error(d("Name is required"));return}if(!g.value.display_name){j.error(d("Display Name is required"));return}if(!g.value.rule_type){j.error(d("Please select a template to start from"));return}if(!g.value.applies_to){j.error(d("Please select where this rule applies to"));return}if(!g.value.config.when_to_apply){j.error(d("Please select when this rule should apply"));return}y.value=!0,ce.post("pricing_rules",g.value).then(S=>{j.success((S==null?void 0:S.message)||d("Pricing rule created successfully")),t.push({name:"dynamic_pricing_edit",params:{id:S.pricing_rule.id}})}).catch(S=>{var V;S.status_code===422?j.validationErrors(S):j.error(((V=S==null?void 0:S.data)==null?void 0:V.message)||d("Failed to create pricing rule"))}).finally(()=>{y.value=!1})};return(S,V)=>{const F=C("el-breadcrumb-item"),$=C("el-breadcrumb"),U=C("el-button"),D=C("el-input"),T=C("el-radio"),I=C("el-radio-group"),L=C("el-option"),O=C("el-select"),Q=C("el-col"),H=C("el-row");return r(),h("div",rwe,[n.value?(r(),h(P,{key:0},[o("div",dwe,[o("div",uwe,[s($,{"separator-icon":c(Za)},{default:u(()=>[s(F,{to:{name:"dynamic_pricing"}},{default:u(()=>[R(f(c(d)("Dynamic Pricing")),1)]),_:1}),s(F,null,{default:u(()=>[R(f(c(d)("Add New Rule")),1)]),_:1})]),_:1},8,["separator-icon"])]),s(U,{type:"primary",loading:y.value,onClick:B},{default:u(()=>[R(f(c(d)("Create Rule")),1)]),_:1},8,["loading"])]),o("div",cwe,[s(H,{gutter:30},{default:u(()=>[s(Q,{lg:16},{default:u(()=>[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Basic Information"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[o("div",Awe,[o("div",pwe,[o("label",fwe,f(c(d)("Name")),1),s(D,{modelValue:g.value.name,"onUpdate:modelValue":V[0]||(V[0]=K=>g.value.name=K),placeholder:c(d)("e.g. summer-sale-10")},null,8,["modelValue","placeholder"])]),o("div",mwe,[o("label",hwe,f(c(d)("Display Name")),1),s(D,{modelValue:g.value.display_name,"onUpdate:modelValue":V[1]||(V[1]=K=>g.value.display_name=K),placeholder:c(d)("e.g. Summer Sale")},null,8,["modelValue","placeholder"]),o("div",_we,[o("p",null,f(c(d)("The friendly name shown to customers at checkout.")),1)])]),o("div",vwe,[o("label",gwe,f(c(d)("Start from a template")),1),s(I,{modelValue:g.value.rule_type,"onUpdate:modelValue":V[2]||(V[2]=K=>g.value.rule_type=K),class:"fct-pricing-rule-template"},{default:u(()=>[(r(),h(P,null,ae(i,K=>s(T,{key:K.value,label:K.value},{default:u(()=>[s(X,{class:"fct-rule-template-icon",name:K.icon},null,8,["name"]),o("span",ywe,[o("span",bwe,f(K.title),1),o("span",wwe,f(K.description),1)]),s(X,{class:"fct-rule-template-recipe-check",name:"Check"})]),_:2},1032,["label"])),64))]),_:1},8,["modelValue"])]),o("div",Cwe,[o("div",kwe,[o("div",Bwe,[o("label",null,f(c(d)("Price Type")),1),s(O,{modelValue:g.value.price_type,"onUpdate:modelValue":V[3]||(V[3]=K=>g.value.price_type=K),class:"w-full"},{default:u(()=>[(r(),h(P,null,ae(A,K=>s(L,{key:K.value,value:K.value,label:K.label,disabled:k(K.value)},null,8,["value","label","disabled"])),64))]),_:1},8,["modelValue"])]),o("div",xwe,[o("label",null,f(c(d)("Apply as")),1),s(O,{modelValue:g.value.config.apply_as,"onUpdate:modelValue":V[4]||(V[4]=K=>g.value.config.apply_as=K),class:"w-full"},{default:u(()=>[(r(),h(P,null,ae(p,K=>s(L,{key:K.value,value:K.value,label:K.label},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),o("div",Swe,[o("label",null,f(g.value.config.apply_as==="fixed"?c(d)("Amount"):c(d)("Percent")),1),s(D,{modelValue:g.value.config.amount,"onUpdate:modelValue":V[5]||(V[5]=K=>g.value.config.amount=K),type:"number"},sa({_:2},[g.value.config.apply_as==="fixed"?{name:"prepend",fn:u(()=>[R(f(m.value),1)]),key:"0"}:{name:"append",fn:u(()=>[V[9]||(V[9]=R(" % ",-1))]),key:"1"}]),1032,["modelValue"])])]),g.value.price_type==="fee"?(r(),E(Pf,{key:0,modelValue:g.value.config.fee_taxable,"onUpdate:modelValue":V[6]||(V[6]=K=>g.value.config.fee_taxable=K),class:"mt-4"},null,8,["modelValue"])):x("",!0)])])]),_:1})]),_:1})]),_:1}),s(Q,{lg:8},{default:u(()=>[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Applies To"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(Rf,{modelValue:g.value.applies_to,"onUpdate:modelValue":V[7]||(V[7]=K=>g.value.applies_to=K),"is-disabled":v},null,8,["modelValue"])]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Be,null,{default:u(()=>[o("div",$we,[o("label",Fwe,f(c(d)("Apply discount to")),1),o("div",Ewe,[o("p",null,f(c(d)("Choose which transactions this rule should run on.")),1)]),s(Of,{modelValue:g.value.config.when_to_apply,"onUpdate:modelValue":V[8]||(V[8]=K=>g.value.config.when_to_apply=K),class:"mt-4"},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})])],64)):a.value&&!l.value?(r(),E(Gd,{key:1})):(r(),h("div",Uwe,[s(cs,{placement:"feature_lock_dynamic_pricing",title:c(d)("Dynamic Pricing"),text:c(d)("This feature is only available in FluentCart Pro")},null,8,["title","text"])]))])}}},Vwe={class:"fct-resource-option-label"},Dwe={key:0,class:"fct-resource-option-description"},Twe={__name:"ResourceSelector",props:{dataKey:{type:String,required:!0},modelValue:{type:[String,Number,Array,null],default:null},multiple:{type:Boolean,default:!1},placeholder:{type:String,default:""},limit:{type:Number,default:20},size:{type:String,default:"small"},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,n=M([]),i=M(!1),A=M(!1),p=G({get:()=>{const B=a.modelValue,S=B===null||B===""||B===void 0;return a.multiple?Array.isArray(B)?B:S?[]:[B]:Array.isArray(B)?B.length?B[0]:"":B},set:B=>l("update:modelValue",B)}),m=G(()=>a.modelValue===null||a.modelValue===""?[]:Array.isArray(a.modelValue)?a.modelValue:[a.modelValue]);let _=0,g=[],y=!1,v=null,k=0;const b=(B="")=>{const S=++_;B&&(k=S),i.value=!0,A.value=!1;const V={remote_data_key:a.dataKey,search:B,limit:a.limit};!B&&m.value.length&&(V.include_ids=m.value),ce.get("advance_filter/get-filter-options",V).then(F=>{S===_&&(n.value=F.options||[],B||(g=n.value,y=!0))}).catch(F=>{var $;S===_&&(A.value=!0,j.error((($=F==null?void 0:F.data)==null?void 0:$.message)||d("Failed to load options")))}).finally(()=>{k===S&&(k=0),S===_&&(i.value=!1)})},w=B=>{if(clearTimeout(v),B){i.value=!0,v=setTimeout(()=>b(B),400);return}if(k&&(_++,k=0,i.value=!1),y){i.value=!1,n.value=g;return}i.value||b()};return be(()=>a.modelValue,B=>{if(!B)return;n.value.some(V=>m.value.includes(V.value))||b()}),be(()=>a.dataKey,()=>{clearTimeout(v),k=0,g=[],y=!1,A.value=!1,n.value=[],b()}),Te(()=>b()),Ga(()=>clearTimeout(v)),(B,S)=>{const V=C("el-option"),F=C("el-select");return r(),E(F,{modelValue:p.value,"onUpdate:modelValue":S[0]||(S[0]=$=>p.value=$),class:"w-full fct-resource-selector",filterable:"",remote:"",clearable:"","reserve-keyword":!1,multiple:e.multiple,size:e.size,disabled:e.disabled,loading:i.value,"loading-text":c(d)("Loading..."),"remote-method":w,placeholder:e.placeholder||c(d)("Search and select"),"popper-class":"fct-resource-selector-popper"},{default:u(()=>[(r(!0),h(P,null,ae(n.value,$=>(r(),E(V,{key:$.value,value:$.value,label:$.label},{default:u(()=>[o("span",Vwe,f($.label),1),$.description?(r(),h("span",Dwe,f($.description),1)):x("",!0)]),_:2},1032,["value","label"]))),128))]),_:1},8,["modelValue","multiple","size","disabled","loading","loading-text","placeholder"])}}},ed=Ke.get("dynamic_pricing_condition_attributes",[]),Hf=(e,t)=>{const a=e==null?void 0:e.children;Array.isArray(a)&&a.forEach(l=>{if(Array.isArray(l==null?void 0:l.children)){Hf(l,t);return}l!=null&&l.value&&!t[l.value]&&(t[l.value]={...l,group:e.label})})},Qwe=e=>{const t={};return Array.isArray(e)&&e.forEach(a=>Hf(a,t)),t},Mwe=Qwe(ed),Lwe=e=>Mwe[e]||null,Rwe={class:"w-[250px] fct-conditions-label"},Owe={class:"fct-conditions-operator w-[190px]"},Pwe={class:"fct-conditions-value"},Hwe={class:"w-[40px] text-right fct-conditions-action"},Nwe={__name:"ConditionRow",props:{modelValue:{type:Object,default:()=>({key:"",operator:"",value:""})}},emits:["update:modelValue","remove"],setup(e,{emit:t}){const a=e,l=t,n=M(a.modelValue);be(()=>a.modelValue,k=>{n.value=k}),be(n,k=>{l("update:modelValue",k)},{deep:!0});const i=G(()=>Lwe(n.value.key)),A=G(()=>i.value?i.value.label:d("%1$s (unavailable)",n.value.key)),p=G(()=>i.value?i.value.group:""),m=G(()=>i.value?i.value.operators:{}),_=G(()=>{var k;return((k=i.value)==null?void 0:k.input_type)==="number"?"number":"text"}),g=G(()=>{var k;return((k=i.value)==null?void 0:k.input_type)!=="select"?"":i.value.data_key||""}),y=G(()=>{var k;return((k=i.value)==null?void 0:k.multiple)===!0}),v=G(()=>{var k;return((k=i.value)==null?void 0:k.input_type)==="currency"});return(k,b)=>{const w=C("el-option"),B=C("el-select"),S=C("el-input");return r(),h("tr",null,[o("td",Rwe,[p.value?(r(),h(P,{key:0},[R(f(p.value)+" ",1),b[5]||(b[5]=o("span",{class:"fct-conditions-separator"},"/",-1))],64)):x("",!0),R(" "+f(A.value),1)]),o("td",Owe,[s(B,{modelValue:n.value.operator,"onUpdate:modelValue":b[0]||(b[0]=V=>n.value.operator=V),size:"small",placeholder:c(d)("Select a condition")},{default:u(()=>[(r(!0),h(P,null,ae(m.value,(V,F)=>(r(),E(w,{key:F,value:F,label:V},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("td",Pwe,[g.value?(r(),E(Twe,{key:0,modelValue:n.value.value,"onUpdate:modelValue":b[1]||(b[1]=V=>n.value.value=V),"data-key":g.value,multiple:y.value,placeholder:c(d)("Search and select")},null,8,["modelValue","data-key","multiple","placeholder"])):v.value?(r(),E(Ya,{key:1,modelValue:n.value.value,"onUpdate:modelValue":b[2]||(b[2]=V=>n.value.value=V),size:"small",placeholder:c(d)("Enter an amount")},null,8,["modelValue","placeholder"])):(r(),E(S,{key:2,modelValue:n.value.value,"onUpdate:modelValue":b[3]||(b[3]=V=>n.value.value=V),size:"small",type:_.value,placeholder:c(d)("Enter a value")},null,8,["modelValue","type","placeholder"]))]),o("td",Hwe,[s(tt,{size:"x-small",bg:"info",tag:"button","aria-label":c(d)("Remove condition"),onClick:b[4]||(b[4]=V=>l("remove"))},{default:u(()=>[s(X,{name:"Delete"})]),_:1},8,["aria-label"])])])}}},Kwe={class:"fct-cascader-panel"},Gwe=["aria-expanded","aria-controls","onClick"],zwe=["id"],jwe=["onClick"],qwe={__name:"ConditionCascaderPanel",props:{options:{type:Array,default:()=>[]}},emits:["select"],setup(e,{emit:t}){const a=t,l=M(null),n=hm(),i=m=>`${n}-${m}`,A=m=>{l.value=l.value===m?null:m},p=m=>{a("select",m),l.value=null};return(m,_)=>{const g=C("ConditionCascaderPanel",!0);return r(),h("div",Kwe,[(r(!0),h(P,null,ae(e.options,y=>(r(),h("div",{key:y.value,class:"fct-cascader-option"},[o("button",{type:"button",class:"fct-cascader-button","aria-expanded":l.value===y.value,"aria-controls":i(y.value),onClick:v=>A(y.value)},f(y.label),9,Gwe),s(wr,{visible:l.value===y.value},{default:u(()=>[o("ul",{id:i(y.value),class:"fct-cascader-content"},[(r(!0),h(P,null,ae(y.children,v=>(r(),h("li",{key:v.value},[Array.isArray(v.children)?(r(),E(g,{key:0,options:[v],onSelect:p},null,8,["options"])):(r(),h("button",{key:1,type:"button",class:"fct-cascader-item",onClick:k=>p(v.value)},f(v.label),9,jwe))]))),128))],8,zwe)]),_:2},1032,["visible"])]))),128))])}}},Ywe={class:"fct-conditions-group"},Wwe={key:0,class:"w-full"},Jwe={class:"fct-conditions-intro"},Xwe={class:"fct-cascader-panel-wrap"},Zwe={class:"px-2"},eCe={__name:"ConditionGroup",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue","remove"],setup(e,{emit:t}){const a=e,l=t,n=M(a.modelValue),i=M(null),A=M([]);be(()=>a.modelValue,g=>{n.value=g}),be(n,g=>{l("update:modelValue",g)},{deep:!0});const p=g=>{g&&(n.value.push({key:g,operator:"",value:""}),A.value=[],$e(()=>{i.value&&i.value.hide()}))},m=g=>{Array.isArray(g)&&g.length>=2&&p(g[g.length-1])},_=g=>{n.value.splice(g,1)};return(g,y)=>{const v=C("el-cascader-panel"),k=C("el-button"),b=C("el-popover");return r(),h("div",Ywe,[n.value.length?(r(),h("table",Wwe,[o("tbody",null,[(r(!0),h(P,null,ae(n.value,(w,B)=>(r(),E(Nwe,{key:B,modelValue:n.value[B],"onUpdate:modelValue":S=>n.value[B]=S,onRemove:S=>_(B)},null,8,["modelValue","onUpdate:modelValue","onRemove"]))),128))])])):x("",!0),o("div",Jwe,[s(b,{ref_key:"popoverRef",ref:i,placement:"right",width:"auto","popper-class":"fct-conditions-popover",trigger:"click"},{reference:u(()=>[s(k,{class:"el-button--x-small"},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)("Add")),1)]),_:1})]),default:u(()=>[o("div",Xwe,[s(qwe,{options:c(ed),onSelect:p},null,8,["options"]),s(v,{modelValue:A.value,"onUpdate:modelValue":y[0]||(y[0]=w=>A.value=w),style:{width:"100%"},options:c(ed),onChange:m},null,8,["modelValue","options"])])]),_:1},512),o("span",Zwe,f(c(d)("Add new properties")),1),n.value.length?x("",!0):(r(),E(tt,{key:0,size:"x-small",bg:"info",tag:"button",class:"float-end","aria-label":c(d)("Remove group"),onClick:y[1]||(y[1]=w=>l("remove"))},{default:u(()=>[s(X,{name:"Delete"})]),_:1},8,["aria-label"]))])])}}},tCe={class:"fct-conditions-wrapper"},aCe={key:0,class:"cond-empty bg-gray-25 dark:bg-dark-500 rounded border border-dashed border-gray-200 dark:border-dark-400 py-10 px-7 text-center"},lCe={class:"empty-icon"},sCe={key:1,class:"fct-conditions-container"},nCe={class:"fct-conditions-wrap"},oCe={key:0,class:"fct-conditions-or-wrap"},iCe={class:"fct-conditions-or"},rCe={class:"fct-conditions-or-wrap"},dCe=["aria-label"],uCe={__name:"PricingRuleConditions",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,n=M(a.modelValue);be(()=>a.modelValue,p=>{n.value=p}),be(n,p=>{l("update:modelValue",p)},{deep:!0});const i=()=>{n.value.push([])},A=p=>{n.value.splice(p,1)};return(p,m)=>{const _=C("el-button");return r(),h("div",tCe,[n.value.length?(r(),h("div",sCe,[o("div",nCe,[(r(!0),h(P,null,ae(n.value,(g,y)=>(r(),h("div",{key:y,class:"fct-conditions-item"},[s(eCe,{modelValue:n.value[y],"onUpdate:modelValue":v=>n.value[y]=v,onRemove:v=>A(y)},null,8,["modelValue","onUpdate:modelValue","onRemove"]),y<n.value.length-1?(r(),h("div",oCe,[o("div",iCe,f(c(d)("or")),1)])):x("",!0)]))),128))]),o("div",rCe,[o("button",{type:"button",class:"fct-conditions-or","aria-label":c(d)("Add another condition group"),onClick:i},[s(X,{name:"Plus"}),R(" "+f(c(d)("or")),1)],8,dCe)])])):(r(),h("div",aCe,[o("span",lCe,[s(X,{name:"Configuration",class:"w-5 h-5 mx-auto"})]),o("p",null,f(c(d)("To get started, add some conditions for this dynamic price")),1),s(_,{onClick:i},{default:u(()=>[s(X,{name:"Plus"}),R(" "+f(c(d)("Add Conditions")),1)]),_:1})]))])}}},cCe={class:"fct-pricing-rule-schedule"},ACe={class:"form-note mt-2"},pCe={class:"form-note mt-2"},fCe={__name:"PricingRuleSchedule",props:{startDate:{type:String,default:null},endDate:{type:String,default:null},disabled:{type:Boolean,default:!1}},emits:["update:startDate","update:endDate"],setup(e,{emit:t}){const a=e,l=t,n=M(!1);be(()=>a.endDate,A=>{n.value=!!A},{immediate:!0});const i=A=>{A||l("update:endDate",null)};return(A,p)=>{const m=C("el-date-picker"),_=C("el-form-item"),g=C("el-checkbox"),y=C("el-form");return r(),E(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Schedule"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[o("div",cCe,[s(y,{"label-position":"top"},{default:u(()=>[s(_,{label:c(d)("Start Date & Time")},{default:u(()=>[s(m,{"model-value":e.startDate,type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",class:"w-full",placeholder:c(d)("Immediately"),disabled:e.disabled,"onUpdate:modelValue":p[0]||(p[0]=v=>l("update:startDate",v))},null,8,["model-value","placeholder","disabled"]),o("div",ACe,[o("p",null,f(c(d)("Time at which the dynamic price becomes active and starts being applied at checkout.")),1)])]),_:1},8,["label"]),s(_,null,{default:u(()=>[s(g,{modelValue:n.value,"onUpdate:modelValue":p[1]||(p[1]=v=>n.value=v),label:c(d)("Set end date & time"),disabled:e.disabled,onChange:i},null,8,["modelValue","label","disabled"])]),_:1}),n.value?(r(),E(_,{key:0,label:c(d)("End Date & Time")},{default:u(()=>[s(m,{"model-value":e.endDate,type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",class:"w-full",placeholder:c(d)("Never"),disabled:e.disabled,"onUpdate:modelValue":p[2]||(p[2]=v=>l("update:endDate",v))},null,8,["model-value","placeholder","disabled"]),o("div",pCe,[o("p",null,f(c(d)("Time at which the dynamic price becomes inactive.")),1)])]),_:1},8,["label"])):x("",!0)]),_:1})])]),_:1})]),_:1})}}},mCe={class:"fct-pricing-rule-loader-wrap"},hCe={class:"single-page-header fct-page-loader-header"},_Ce={class:"fct-pricing-rule-summary"},vCe={class:"flex items-center gap-2 flex-1"},gCe={key:0,class:"fct-pricing-rule-summary-status"},yCe={class:"single-page-body"},bCe={class:"fct-pricing-rule-form"},wCe={class:"fct-form-group"},CCe={class:"fct-form-group"},kCe={class:"fct-form-group"},BCe={class:"grid grid-cols-1 sm:grid-cols-3 gap-3"},xCe={class:"fct-pricing-rule-applies-to-options"},SCe={class:"flex flex-col gap-3"},$Ce={__name:"PricingRuleEditLoader",setup(e){const t=zl.has("dynamic_pricing/manage"),a=[1,2,3,4];return(l,n)=>{const i=C("el-skeleton-item"),A=C("el-skeleton"),p=C("el-col"),m=C("el-row");return r(),h("div",mCe,[o("div",hCe,[s(A,{animated:""},{template:u(()=>[s(i,{class:"max-w-180"})]),_:1})]),s(A,{animated:""},{template:u(()=>[o("div",_Ce,[o("div",vCe,[s(i,{variant:"text",class:"w-10"}),s(i,{variant:"button",class:"w-[96px] h-6 rounded-sm"}),s(i,{variant:"text",class:"w-4"}),s(i,{variant:"button",class:"w-[80px] h-6 rounded-sm"}),s(i,{variant:"text",class:"w-[160px]"})]),c(t)?(r(),h("div",gCe,[s(i,{variant:"button",class:"w-10 h-5 rounded-full"}),s(i,{variant:"text",class:"w-12"})])):x("",!0)])]),_:1}),o("div",yCe,[s(m,{gutter:30},{default:u(()=>[s(p,{lg:16},{default:u(()=>[s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Details")},null,8,["title"]),s(Be,null,{default:u(()=>[s(A,{animated:""},{template:u(()=>[o("div",bCe,[o("div",wCe,[s(i,{variant:"text",class:"w-16 mb-2"}),s(i,{variant:"button",class:"w-full h-8"})]),o("div",CCe,[s(i,{variant:"text",class:"w-[96px] mb-2"}),s(i,{variant:"button",class:"w-full h-8"})]),o("div",kCe,[o("div",BCe,[(r(),h(P,null,ae(3,_=>o("div",{key:_},[s(i,{variant:"text",class:"w-[80px] mb-2"}),s(i,{variant:"button",class:"w-full h-8"})])),64))])])])]),_:1})]),_:1})]),_:1}),s(xe,{class:"overflow-hidden"},{default:u(()=>[s(Ve,{title:c(d)("Display Conditions"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(A,{animated:"",rows:2})]),_:1})]),_:1})]),_:1}),s(p,{lg:8},{default:u(()=>[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Applies To"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(A,{animated:""},{template:u(()=>[o("div",xCe,[(r(),h(P,null,ae(3,_=>s(i,{key:_,variant:"button",class:"w-full h-[66px] rounded"})),64))]),s(i,{variant:"text",class:"w-4/5 mt-3"})]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("When to Apply"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(A,{animated:""},{template:u(()=>[o("div",SCe,[(r(),h(P,null,ae(a,_=>o("div",{key:_,class:"flex items-center gap-2"},[s(i,{variant:"circle",class:"w-4 h-4 flex-none"}),s(i,{variant:"text",class:"w-2/5"})])),64))])]),_:1})]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Schedule"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(A,{animated:"",rows:2})]),_:1})]),_:1})]),_:1})]),_:1})])])}}},FCe={class:"fct-create-pricing-rule-page fct-layout-width"},ECe={key:1,class:"py-10"},UCe={class:"single-page-header"},ICe={class:"single-page-header-title-wrap"},VCe={class:"fct-pricing-rule-summary"},DCe={class:"fct-pricing-rule-summary-text"},TCe={class:"text-system-dark font-medium dark:text-gray-400"},QCe={key:2,class:"text-system-mid dark:text-gray-400"},MCe={key:0,class:"fct-pricing-rule-summary-status"},LCe={class:"single-page-body"},RCe={class:"fct-pricing-rule-form"},OCe={class:"fct-form-group"},PCe={class:"required"},HCe={class:"fct-form-group"},NCe={class:"required"},KCe={class:"fct-form-group"},GCe={class:"grid grid-cols-1 sm:grid-cols-3 gap-3"},zCe={class:"fct-pricing-rule-price-type"},jCe={class:"fct-pricing-rule-apply-as"},qCe={class:"fct-pricing-rule-amount"},YCe={class:"required"},WCe={__name:"EditPricingRule",setup(e){const t=Pa(),a=M(null),l=M(!1),n=M(!1),i=M(!1),A=M(0),p=zl.has("dynamic_pricing/manage"),m=G(()=>l.value||n.value||i.value),_=G(()=>Ke.get("shop.currency_sign","$")),g=G(()=>Ke.get("app_config.isProActive")),y=G(()=>Ke.get("modules_settings.dynamic_pricing.active")==="yes"),v=G(()=>g.value&&y.value),k=[{value:"discount",label:d("Discount")},{value:"fee",label:d("Fee")}],b=[{value:"percentage",label:d("Percentage")},{value:"fixed",label:d("Fixed")}],w=O=>{var Q,H;return O==="shipping"&&((H=(Q=a.value)==null?void 0:Q.config)==null?void 0:H.when_to_apply)==="renewals"},B=O=>{var Q,H;return O==="fee"&&((H=(Q=a.value)==null?void 0:Q.config)==null?void 0:H.when_to_apply)==="renewals"},S=G(()=>{var re,q;const O=((re=a.value)==null?void 0:re.config)||{},Q=O.amount===""||O.amount===null||O.amount===void 0?"":O.apply_as==="fixed"?`${_.value}${O.amount}`:`${O.amount}%`,H={discount:{text:d("%1$s Discount",Q).trim(),type:"success"},fee:{text:d("%1$s Fee",Q).trim(),type:"info"}},K={every:d("every purchase"),first:d("first purchase only"),renewals:d("store managed renewals"),upgrades:d("upgrades & downgrades")},z=(Array.isArray(O.conditions)?O.conditions:[]).reduce((Ae,ie)=>Ae+(Array.isArray(ie)?ie.length:0),0);let Y="";z===1?Y=d("1 condition"):z>1&&(Y=d("%1$s conditions",z));const Z=Un.find(Ae=>{var ie;return Ae.value===((ie=a.value)==null?void 0:ie.applies_to)});return{priceType:H[(q=a.value)==null?void 0:q.price_type]||null,appliesTo:Z||null,when:K[O.when_to_apply]||K.every,conditions:Y}}),V=G(()=>{var O;return d("Toggle status for %1$s",((O=a.value)==null?void 0:O.display_name)||"")});let F=!1;const $=O=>(O!=null&&O.config&&!O.config.when_to_apply&&(O.config.when_to_apply="every"),O),U=()=>{l.value=!0,ce.get(`pricing_rules/${t.params.id}`).then(O=>{F=!0,a.value=$(O.pricing_rule),A.value=0}).catch(O=>{var Q;j.error(((Q=O==null?void 0:O.data)==null?void 0:Q.message)||d("Failed to load pricing rule"))}).finally(()=>{l.value=!1})},D=()=>{var Q,H;return(((H=(Q=a.value)==null?void 0:Q.config)==null?void 0:H.conditions)||[]).some(K=>K.some(W=>Array.isArray(W.value)?!W.key||!W.operator||!W.value.length:!W.key||!W.operator||W.value===""||W.value===null))},T=()=>{if(!m.value){if(D()){j.error(d("Please complete or remove the unfinished conditions"));return}if(w(a.value.applies_to)){j.error(d("A store managed renewals rule cannot apply to shipping"));return}if(B(a.value.price_type)){j.error(d("A store managed renewals rule can only be a discount"));return}n.value=!0,ce.put(`pricing_rules/${t.params.id}`,a.value).then(O=>{j.success((O==null?void 0:O.message)||d("Pricing rule updated successfully")),O!=null&&O.pricing_rule&&(F=!0,a.value=$(O.pricing_rule)),A.value=0}).catch(O=>{var Q;O.status_code===422?j.validationErrors(O):j.error(((Q=O==null?void 0:O.data)==null?void 0:Q.message)||d("Failed to update pricing rule"))}).finally(()=>{n.value=!1})}},I=()=>{m.value||U()},L=()=>{if(m.value)return;const O=a.value.status,Q=O==="active"?"inactive":"active";i.value=!0,F=!0,a.value.status=Q,ce.put(`pricing_rules/${t.params.id}/status`,{status:Q}).then(()=>{j.success(d("Status updated successfully"))}).catch(H=>{var K;F=!0,a.value.status=O,j.error(((K=H==null?void 0:H.data)==null?void 0:K.message)||d("Failed to update status"))}).finally(()=>{i.value=!1})};return be(a,()=>{if(F){F=!1;return}A.value++},{deep:!0}),Te(()=>{v.value&&U()}),(O,Q)=>{const H=C("el-breadcrumb-item"),K=C("el-breadcrumb"),W=C("el-switch"),z=C("el-input"),Y=C("el-option"),Z=C("el-select"),re=C("el-col"),q=C("el-row");return r(),h("div",FCe,[v.value?l.value?(r(),E($Ce,{key:1})):a.value?(r(),h(P,{key:2},[s(Ns,{isActive:A.value>0?"is-active":"",loading:n.value||i.value,onDiscard:I,onSave:T},null,8,["isActive","loading"]),o("div",UCe,[o("div",ICe,[s(K,{"separator-icon":c(Za)},{default:u(()=>[s(H,{to:{name:"dynamic_pricing"}},{default:u(()=>[R(f(c(d)("Dynamic Pricing")),1)]),_:1}),s(H,null,{default:u(()=>[R(f(a.value.display_name),1)]),_:1})]),_:1},8,["separator-icon"])])]),o("div",VCe,[o("p",DCe,[R(f(c(d)("Apply"))+" ",1),S.value.priceType?(r(),E(Ht,{key:0,type:S.value.priceType.type,text:S.value.priceType.text,icon:"Tag"},null,8,["type","text"])):x("",!0),R(" "+f(c(d)("to"))+" ",1),S.value.appliesTo?(r(),E(Ht,{key:1,type:"blue",text:S.value.appliesTo.label,icon:S.value.appliesTo.icon},null,8,["text","icon"])):x("",!0),R(" "+f(c(d)("on"))+" ",1),o("span",TCe,f(S.value.when),1),S.value.conditions?(r(),h("span",QCe," · "+f(S.value.conditions),1)):x("",!0)]),c(p)?(r(),h("div",MCe,[s(W,{"model-value":a.value.status==="active",disabled:m.value,loading:i.value,"aria-label":V.value,onChange:L},null,8,["model-value","disabled","loading","aria-label"]),o("span",null,f(a.value.status==="active"?c(d)("Active"):c(d)("Inactive")),1)])):x("",!0)]),o("div",LCe,[s(q,{gutter:30},{default:u(()=>[s(re,{lg:16},{default:u(()=>[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Details")},null,8,["title"]),s(Be,null,{default:u(()=>[o("div",RCe,[o("div",OCe,[o("label",PCe,f(c(d)("Name")),1),s(z,{modelValue:a.value.name,"onUpdate:modelValue":Q[0]||(Q[0]=Ae=>a.value.name=Ae)},null,8,["modelValue"])]),o("div",HCe,[o("label",NCe,f(c(d)("Display Name")),1),s(z,{modelValue:a.value.display_name,"onUpdate:modelValue":Q[1]||(Q[1]=Ae=>a.value.display_name=Ae)},null,8,["modelValue"])]),o("div",KCe,[o("div",GCe,[o("div",zCe,[o("label",null,f(c(d)("Price Type")),1),s(Z,{modelValue:a.value.price_type,"onUpdate:modelValue":Q[2]||(Q[2]=Ae=>a.value.price_type=Ae),class:"w-full"},{default:u(()=>[(r(),h(P,null,ae(k,Ae=>s(Y,{key:Ae.value,value:Ae.value,label:Ae.label,disabled:B(Ae.value)},null,8,["value","label","disabled"])),64))]),_:1},8,["modelValue"])]),o("div",jCe,[o("label",null,f(c(d)("Apply as")),1),s(Z,{modelValue:a.value.config.apply_as,"onUpdate:modelValue":Q[3]||(Q[3]=Ae=>a.value.config.apply_as=Ae),class:"w-full"},{default:u(()=>[(r(),h(P,null,ae(b,Ae=>s(Y,{key:Ae.value,value:Ae.value,label:Ae.label},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),o("div",qCe,[o("label",YCe,f(a.value.config.apply_as==="fixed"?c(d)("Amount"):c(d)("Percent")),1),s(z,{modelValue:a.value.config.amount,"onUpdate:modelValue":Q[4]||(Q[4]=Ae=>a.value.config.amount=Ae),type:"number"},sa({_:2},[a.value.config.apply_as==="fixed"?{name:"prepend",fn:u(()=>[R(f(_.value),1)]),key:"0"}:{name:"append",fn:u(()=>[Q[11]||(Q[11]=R(" % ",-1))]),key:"1"}]),1032,["modelValue"])])]),a.value.price_type==="fee"?(r(),E(Pf,{key:0,modelValue:a.value.config.fee_taxable,"onUpdate:modelValue":Q[5]||(Q[5]=Ae=>a.value.config.fee_taxable=Ae),class:"mt-4"},null,8,["modelValue"])):x("",!0)])])]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Display Conditions"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(uCe,{modelValue:a.value.config.conditions,"onUpdate:modelValue":Q[6]||(Q[6]=Ae=>a.value.config.conditions=Ae)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),s(re,{lg:8},{default:u(()=>[s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("Applies To"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(Rf,{modelValue:a.value.applies_to,"onUpdate:modelValue":Q[7]||(Q[7]=Ae=>a.value.applies_to=Ae),"is-disabled":w},null,8,["modelValue"])]),_:1})]),_:1}),s(xe,null,{default:u(()=>[s(Ve,{title:c(d)("When to Apply"),border_bottom:""},null,8,["title"]),s(Be,null,{default:u(()=>[s(Of,{modelValue:a.value.config.when_to_apply,"onUpdate:modelValue":Q[8]||(Q[8]=Ae=>a.value.config.when_to_apply=Ae),disabled:m.value},null,8,["modelValue","disabled"])]),_:1})]),_:1}),s(fCe,{"start-date":a.value.start_date,"onUpdate:startDate":Q[9]||(Q[9]=Ae=>a.value.start_date=Ae),"end-date":a.value.end_date,"onUpdate:endDate":Q[10]||(Q[10]=Ae=>a.value.end_date=Ae),disabled:m.value},null,8,["start-date","end-date","disabled"])]),_:1})]),_:1})])],64)):x("",!0):(r(),h(P,{key:0},[g.value&&!y.value?(r(),E(Gd,{key:0})):(r(),h("div",ECe,[s(cs,{placement:"feature_lock_dynamic_pricing",title:c(d)("Dynamic Pricing"),text:c(d)("This feature is only available in FluentCart Pro")},null,8,["title","text"])]))],64))])}}},JCe={name:"CheckoutFields",components:{Animation:ma,CardHeader:Ve,Card:xe,CardBody:Be,SettingsHeader:$a,AdminNotice:Fa},data(){return{fields:{},settings:{},saving:!1,fetching:!1}},watch:{"settings.basic_info.last_name.enabled"(e){var t,a;e==="yes"&&((a=(t=this.settings.basic_info)==null?void 0:t.first_name)==null?void 0:a.enabled)==="no"&&(this.settings.basic_info.first_name.enabled="yes")},"settings.business_details":{deep:!0,handler(e){var a,l,n;if(!e||!e.b2b_only_mode)return;((a=e.company_name)==null?void 0:a.enabled)==="yes"||((l=e.vat_number)==null?void 0:l.enabled)==="yes"||((n=e.legal_registration_id)==null?void 0:n.enabled)==="yes"||(e.b2b_only_mode.enabled="no")}}},mounted(){this.getFields()},methods:{translate:d,clearRequiredWhenDisabled(e){e&&e.enabled!=="yes"&&e.required==="yes"&&(e.required="no")},isFirstNameDisabled(e,t){var a,l;return e==="basic_info"&&t==="first_name"&&((l=(a=this.settings.basic_info)==null?void 0:a.last_name)==null?void 0:l.enabled)==="yes"},isB2BOnlyModeDisabled(e,t){var l,n,i;if(e!=="business_details"||t!=="b2b_only_mode")return!1;const a=this.settings.business_details||{};return((l=a.company_name)==null?void 0:l.enabled)!=="yes"&&((n=a.vat_number)==null?void 0:n.enabled)!=="yes"&&((i=a.legal_registration_id)==null?void 0:i.enabled)!=="yes"},shouldDimLabel(e,t){var a,l,n,i,A,p,m;return((n=(l=(a=this.settings)==null?void 0:a[e])==null?void 0:l[t])==null?void 0:n.enabled)==="no"?!0:e==="basic_info"&&t==="full_name"?((A=(i=this.settings.basic_info)==null?void 0:i.first_name)==null?void 0:A.enabled)==="yes"||((m=(p=this.settings.basic_info)==null?void 0:p.last_name)==null?void 0:m.enabled)==="yes":!1},isVisible(e,t){var a,l,n,i;return t==="full_name"?((l=(a=this.settings.basic_info)==null?void 0:a.first_name)==null?void 0:l.enabled)!=="yes"&&((i=(n=this.settings.basic_info)==null?void 0:n.last_name)==null?void 0:i.enabled)!=="yes":!0},getFields(){this.fetching=!0,this.$get("checkout-fields/get-fields").then(e=>{this.fields=e.fields||{},this.settings=e.settings||{}}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},saveFields(){this.saving=!0,this.$post("checkout-fields/save-fields",{settings:this.settings}).then(e=>{this.$notify.success(e.message||this.$t("Settings saved successfully!")),this.getFields()}).catch(e=>{this.handleError(e)}).finally(()=>{this.saving=!1})},formatSectionTitle(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}}},XCe={class:"setting-wrap"},ZCe={class:"setting-wrap-inner"},e2e={class:"fct-checkout-fields-wrapp"},t2e={class:"field-heading"},a2e={class:"fct-checkout-fields"},l2e={key:0,class:"fct-checkout-field"},s2e={class:"fct-checkout-field-info"},n2e={class:"fct-checkout-field-label-wrap"},o2e={class:"fct-checkout-field-tags"},i2e={key:0,class:"fct-checkout-field-info-desc"},r2e={key:0,class:"fct-checkout-field-action"},d2e={key:1,class:"fct-checkout-field-input"},u2e={class:"fct-checkout-field-info"},c2e={class:"fct-checkout-field-label-wrap"},A2e={key:1,class:"fct-checkout-field-tags"},p2e={key:0,class:"fct-checkout-field-info-desc"},f2e={key:0,class:"fct-checkout-field-action"},m2e={class:"form-section-save-action"};function h2e(e,t,a,l,n,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("el-switch"),g=C("el-tag"),y=C("el-checkbox"),v=C("el-input"),k=C("CardBody"),b=C("Card"),w=C("el-button");return r(),h("div",XCe,[s(A,{heading:i.translate("Checkout Fields"),loading:n.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",ZCe,[s(p),o("div",e2e,[s(b,null,{default:u(()=>[s(k,null,{default:u(()=>[s(m,{loading:n.fetching,animated:"",rows:5},null,8,["loading"]),n.fetching?x("",!0):(r(!0),h(P,{key:0},ae(n.fields,(B,S)=>(r(),h("div",{key:S,class:"fct-checkout-field-section"},[o("h3",t2e,f(i.formatSectionTitle(S)),1),o("div",a2e,[B.label?(r(),h("div",l2e,[o("div",s2e,[o("div",n2e,[B.can_alter==="yes"?(r(),E(_,{key:0,modelValue:n.settings[S].enabled,"onUpdate:modelValue":V=>n.settings[S].enabled=V,"active-value":"yes","inactive-value":"no",onChange:V=>i.clearRequiredWhenDisabled(n.settings[S])},null,8,["modelValue","onUpdate:modelValue","onChange"])):x("",!0),o("span",{class:ue(`fct-checkout-field-label ${n.settings[S].enabled==="no"?"opacity-50":""}`)},f(B.label),3),o("div",o2e,[B.can_alter!=="yes"&&n.settings[S].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:u(()=>[R(f(i.translate("System")),1)]),_:1})):x("",!0),n.settings[S].required==="yes"&&n.settings[S].enabled==="yes"?(r(),E(g,{key:1,size:"small"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:1})):x("",!0)])]),B.help_text?(r(),h("div",i2e,f(B.help_text),1)):x("",!0)]),B.can_alter==="yes"?(r(),h("div",r2e,[s(y,{modelValue:n.settings[S].required,"onUpdate:modelValue":V=>n.settings[S].required=V,"true-label":"yes","false-label":"no",disabled:n.settings[S].enabled!=="yes"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),n.settings[S].hasOwnProperty("text")&&n.settings[S].enabled==="yes"?(r(),h("div",d2e,[s(v,{type:"textarea",modelValue:n.settings[S].text,"onUpdate:modelValue":V=>n.settings[S].text=V,disabled:n.settings[S].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)])):(r(!0),h(P,{key:1},ae(B,(V,F)=>(r(),h("div",{key:F,class:"fct-checkout-field"},[o("div",u2e,[o("div",c2e,[V.can_alter==="yes"?(r(),E(_,{key:0,modelValue:n.settings[S][F].enabled,"onUpdate:modelValue":$=>n.settings[S][F].enabled=$,"active-value":"yes","inactive-value":"no",onChange:$=>i.clearRequiredWhenDisabled(n.settings[S][F]),disabled:i.isFirstNameDisabled(S,F)||i.isB2BOnlyModeDisabled(S,F)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])):x("",!0),o("span",{class:ue(["fct-checkout-field-label",i.shouldDimLabel(S,F)?"opacity-50":""])},f(V.label),3),i.isVisible(V,F)?(r(),h("div",A2e,[(V.can_alter!=="yes"||F==="first_name")&&n.settings[S][F].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:u(()=>[R(f(i.translate("System")),1)]),_:1})):x("",!0),n.settings[S][F].required==="yes"&&n.settings[S][F].enabled==="yes"?(r(),E(g,{key:1,size:"small"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:1})):x("",!0)])):x("",!0)]),V.help_text?(r(),h("div",p2e,f(V.help_text),1)):x("",!0)]),V.can_alter==="yes"&&F!=="first_name"&&F!=="b2b_only_mode"?(r(),h("div",f2e,[s(y,{modelValue:n.settings[S][F].required,"onUpdate:modelValue":$=>n.settings[S][F].required=$,"true-label":"yes","false-label":"no",disabled:n.settings[S][F].enabled!=="yes"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)]))),128))])]))),128))]),_:1})]),_:1}),o("div",m2e,[s(w,{type:"primary",onClick:i.saveFields,loading:n.saving},{default:u(()=>[R(f(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const _2e=nt(JCe,[["render",h2e]]);var Do={exports:{}};/* @license |
| 286 |
Papa Parse |
| 287 |
v5.5.3 |
| 288 |
https://github.com/mholt/PapaParse |
| 289 |
License: MIT |
| 290 |
*/var v2e=Do.exports,Oc;function g2e(){return Oc||(Oc=1,function(e,t){((a,l)=>{e.exports=l()})(v2e,function a(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},n,i=!l.document&&!!l.postMessage,A=l.IS_PAPA_WORKER||!1,p={},m=0,_={};function g(I){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(L){var O=U(L);O.chunkSize=parseInt(O.chunkSize),L.step||L.chunk||(O.chunkSize=null),this._handle=new w(O),(this._handle.streamer=this)._config=O}).call(this,I),this.parseChunk=function(L,O){var Q=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<Q){let K=this._config.newline;K||(H=this._config.quoteChar||'"',K=this._handle.guessLineEndings(L,H)),L=[...L.split(K).slice(Q)].join(K)}this.isFirstChunk&&T(this._config.beforeFirstChunk)&&(H=this._config.beforeFirstChunk(L))!==void 0&&(L=H),this.isFirstChunk=!1,this._halted=!1;var Q=this._partialLine+L,H=(this._partialLine="",this._handle.parse(Q,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(L=H.meta.cursor,Q=(this._finished||(this._partialLine=Q.substring(L-this._baseIndex),this._baseIndex=L),H&&H.data&&(this._rowCount+=H.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),A)l.postMessage({results:H,workerId:_.WORKER_ID,finished:Q});else if(T(this._config.chunk)&&!O){if(this._config.chunk(H,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=H=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(H.data),this._completeResults.errors=this._completeResults.errors.concat(H.errors),this._completeResults.meta=H.meta),this._completed||!Q||!T(this._config.complete)||H&&H.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),Q||H&&H.meta.paused||this._nextChunk(),H}this._halted=!0},this._sendError=function(L){T(this._config.error)?this._config.error(L):A&&this._config.error&&l.postMessage({workerId:_.WORKER_ID,error:L,finished:!1})}}function y(I){var L;(I=I||{}).chunkSize||(I.chunkSize=_.RemoteChunkSize),g.call(this,I),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(O){this._input=O,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(L=new XMLHttpRequest,this._config.withCredentials&&(L.withCredentials=this._config.withCredentials),i||(L.onload=D(this._chunkLoaded,this),L.onerror=D(this._chunkError,this)),L.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var O,Q=this._config.downloadRequestHeaders;for(O in Q)L.setRequestHeader(O,Q[O])}var H;this._config.chunkSize&&(H=this._start+this._config.chunkSize-1,L.setRequestHeader("Range","bytes="+this._start+"-"+H));try{L.send(this._config.downloadRequestBody)}catch(K){this._chunkError(K.message)}i&&L.status===0&&this._chunkError()}},this._chunkLoaded=function(){L.readyState===4&&(L.status<200||400<=L.status?this._chunkError():(this._start+=this._config.chunkSize||L.responseText.length,this._finished=!this._config.chunkSize||this._start>=(O=>(O=O.getResponseHeader("Content-Range"))!==null?parseInt(O.substring(O.lastIndexOf("/")+1)):-1)(L),this.parseChunk(L.responseText)))},this._chunkError=function(O){O=L.statusText||O,this._sendError(new Error(O))}}function v(I){(I=I||{}).chunkSize||(I.chunkSize=_.LocalChunkSize),g.call(this,I);var L,O,Q=typeof FileReader<"u";this.stream=function(H){this._input=H,O=H.slice||H.webkitSlice||H.mozSlice,Q?((L=new FileReader).onload=D(this._chunkLoaded,this),L.onerror=D(this._chunkError,this)):L=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var H=this._input,K=(this._config.chunkSize&&(K=Math.min(this._start+this._config.chunkSize,this._input.size),H=O.call(H,this._start,K)),L.readAsText(H,this._config.encoding));Q||this._chunkLoaded({target:{result:K}})},this._chunkLoaded=function(H){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(H.target.result)},this._chunkError=function(){this._sendError(L.error)}}function k(I){var L;g.call(this,I=I||{}),this.stream=function(O){return L=O,this._nextChunk()},this._nextChunk=function(){var O,Q;if(!this._finished)return O=this._config.chunkSize,L=O?(Q=L.substring(0,O),L.substring(O)):(Q=L,""),this._finished=!L,this.parseChunk(Q)}}function b(I){g.call(this,I=I||{});var L=[],O=!0,Q=!1;this.pause=function(){g.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){g.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(H){this._input=H,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){Q&&L.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),L.length?this.parseChunk(L.shift()):O=!0},this._streamData=D(function(H){try{L.push(typeof H=="string"?H:H.toString(this._config.encoding)),O&&(O=!1,this._checkIsFinished(),this.parseChunk(L.shift()))}catch(K){this._streamError(K)}},this),this._streamError=D(function(H){this._streamCleanUp(),this._sendError(H)},this),this._streamEnd=D(function(){this._streamCleanUp(),Q=!0,this._streamData("")},this),this._streamCleanUp=D(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function w(I){var L,O,Q,H,K=Math.pow(2,53),W=-K,z=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Y=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,Z=this,re=0,q=0,Ae=!1,ie=!1,J=[],N={data:[],errors:[],meta:{}};function le(Ue){return I.skipEmptyLines==="greedy"?Ue.join("").trim()==="":Ue.length===1&&Ue[0].length===0}function ee(){if(N&&Q&&(de("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+_.DefaultDelimiter+"'"),Q=!1),I.skipEmptyLines&&(N.data=N.data.filter(function(ge){return!le(ge)})),pe()){let ge=function(ke,Oe){T(I.transformHeader)&&(ke=I.transformHeader(ke,Oe)),J.push(ke)};if(N)if(Array.isArray(N.data[0])){for(var Ue=0;pe()&&Ue<N.data.length;Ue++)N.data[Ue].forEach(ge);N.data.splice(0,1)}else N.data.forEach(ge)}function Ce(ge,ke){for(var Oe=I.header?{}:[],Ee=0;Ee<ge.length;Ee++){var fe=Ee,ye=ge[Ee],ye=((De,Le)=>(At=>(I.dynamicTypingFunction&&I.dynamicTyping[At]===void 0&&(I.dynamicTyping[At]=I.dynamicTypingFunction(At)),(I.dynamicTyping[At]||I.dynamicTyping)===!0))(De)?Le==="true"||Le==="TRUE"||Le!=="false"&&Le!=="FALSE"&&((At=>{if(z.test(At)&&(At=parseFloat(At),W<At&&At<K))return 1})(Le)?parseFloat(Le):Y.test(Le)?new Date(Le):Le===""?null:Le):Le)(fe=I.header?Ee>=J.length?"__parsed_extra":J[Ee]:fe,ye=I.transform?I.transform(ye,fe):ye);fe==="__parsed_extra"?(Oe[fe]=Oe[fe]||[],Oe[fe].push(ye)):Oe[fe]=ye}return I.header&&(Ee>J.length?de("FieldMismatch","TooManyFields","Too many fields: expected "+J.length+" fields but parsed "+Ee,q+ke):Ee<J.length&&de("FieldMismatch","TooFewFields","Too few fields: expected "+J.length+" fields but parsed "+Ee,q+ke)),Oe}var Se;N&&(I.header||I.dynamicTyping||I.transform)&&(Se=1,!N.data.length||Array.isArray(N.data[0])?(N.data=N.data.map(Ce),Se=N.data.length):N.data=Ce(N.data,0),I.header&&N.meta&&(N.meta.fields=J),q+=Se)}function pe(){return I.header&&J.length===0}function de(Ue,Ce,Se,ge){Ue={type:Ue,code:Ce,message:Se},ge!==void 0&&(Ue.row=ge),N.errors.push(Ue)}T(I.step)&&(H=I.step,I.step=function(Ue){N=Ue,pe()?ee():(ee(),N.data.length!==0&&(re+=Ue.data.length,I.preview&&re>I.preview?O.abort():(N.data=N.data[0],H(N,Z))))}),this.parse=function(Ue,Ce,Se){var ge=I.quoteChar||'"',ge=(I.newline||(I.newline=this.guessLineEndings(Ue,ge)),Q=!1,I.delimiter?T(I.delimiter)&&(I.delimiter=I.delimiter(Ue),N.meta.delimiter=I.delimiter):((ge=((ke,Oe,Ee,fe,ye)=>{var De,Le,At,mt;ye=ye||[","," ","|",";",_.RECORD_SEP,_.UNIT_SEP];for(var Mt=0;Mt<ye.length;Mt++){for(var Dt,Je=ye[Mt],pt=0,qt=0,Ct=0,$t=(At=void 0,new S({comments:fe,delimiter:Je,newline:Oe,preview:10}).parse(ke)),Nt=0;Nt<$t.data.length;Nt++)Ee&&le($t.data[Nt])?Ct++:(Dt=$t.data[Nt].length,qt+=Dt,At===void 0?At=Dt:0<Dt&&(pt+=Math.abs(Dt-At),At=Dt));0<$t.data.length&&(qt/=$t.data.length-Ct),(Le===void 0||pt<=Le)&&(mt===void 0||mt<qt)&&1.99<qt&&(Le=pt,De=Je,mt=qt)}return{successful:!!(I.delimiter=De),bestDelimiter:De}})(Ue,I.newline,I.skipEmptyLines,I.comments,I.delimitersToGuess)).successful?I.delimiter=ge.bestDelimiter:(Q=!0,I.delimiter=_.DefaultDelimiter),N.meta.delimiter=I.delimiter),U(I));return I.preview&&I.header&&ge.preview++,L=Ue,O=new S(ge),N=O.parse(L,Ce,Se),ee(),Ae?{meta:{paused:!0}}:N||{meta:{paused:!1}}},this.paused=function(){return Ae},this.pause=function(){Ae=!0,O.abort(),L=T(I.chunk)?"":L.substring(O.getCharIndex())},this.resume=function(){Z.streamer._halted?(Ae=!1,Z.streamer.parseChunk(L,!0)):setTimeout(Z.resume,3)},this.aborted=function(){return ie},this.abort=function(){ie=!0,O.abort(),N.meta.aborted=!0,T(I.complete)&&I.complete(N),L=""},this.guessLineEndings=function(ke,ge){ke=ke.substring(0,1048576);var ge=new RegExp(B(ge)+"([^]*?)"+B(ge),"gm"),Se=(ke=ke.replace(ge,"")).split("\r"),ge=ke.split(` |
| 291 |
`),ke=1<ge.length&&ge[0].length<Se[0].length;if(Se.length===1||ke)return` |
| 292 |
`;for(var Oe=0,Ee=0;Ee<Se.length;Ee++)Se[Ee][0]===` |
| 293 |
`&&Oe++;return Oe>=Se.length/2?`\r |
| 294 |
`:"\r"}}function B(I){return I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S(I){var L=(I=I||{}).delimiter,O=I.newline,Q=I.comments,H=I.step,K=I.preview,W=I.fastMode,z=null,Y=!1,Z=I.quoteChar==null?'"':I.quoteChar,re=Z;if(I.escapeChar!==void 0&&(re=I.escapeChar),(typeof L!="string"||-1<_.BAD_DELIMITERS.indexOf(L))&&(L=","),Q===L)throw new Error("Comment character same as delimiter");Q===!0?Q="#":(typeof Q!="string"||-1<_.BAD_DELIMITERS.indexOf(Q))&&(Q=!1),O!==` |
| 295 |
`&&O!=="\r"&&O!==`\r |
| 296 |
`&&(O=` |
| 297 |
`);var q=0,Ae=!1;this.parse=function(ie,J,N){if(typeof ie!="string")throw new Error("Input must be a string");var le=ie.length,ee=L.length,pe=O.length,de=Q.length,Ue=T(H),Ce=[],Se=[],ge=[],ke=q=0;if(!ie)return pt();if(W||W!==!1&&ie.indexOf(Z)===-1){for(var Oe=ie.split(O),Ee=0;Ee<Oe.length;Ee++){if(ge=Oe[Ee],q+=ge.length,Ee!==Oe.length-1)q+=O.length;else if(N)return pt();if(!Q||ge.substring(0,de)!==Q){if(Ue){if(Ce=[],mt(ge.split(L)),qt(),Ae)return pt()}else mt(ge.split(L));if(K&&K<=Ee)return Ce=Ce.slice(0,K),pt(!0)}}return pt()}for(var fe=ie.indexOf(L,q),ye=ie.indexOf(O,q),De=new RegExp(B(re)+B(Z),"g"),Le=ie.indexOf(Z,q);;)if(ie[q]===Z)for(Le=q,q++;;){if((Le=ie.indexOf(Z,Le+1))===-1)return N||Se.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Ce.length,index:q}),Dt();if(Le===le-1)return Dt(ie.substring(q,Le).replace(De,Z));if(Z===re&&ie[Le+1]===re)Le++;else if(Z===re||Le===0||ie[Le-1]!==re){fe!==-1&&fe<Le+1&&(fe=ie.indexOf(L,Le+1));var At=Mt((ye=ye!==-1&&ye<Le+1?ie.indexOf(O,Le+1):ye)===-1?fe:Math.min(fe,ye));if(ie.substr(Le+1+At,ee)===L){ge.push(ie.substring(q,Le).replace(De,Z)),ie[q=Le+1+At+ee]!==Z&&(Le=ie.indexOf(Z,q)),fe=ie.indexOf(L,q),ye=ie.indexOf(O,q);break}if(At=Mt(ye),ie.substring(Le+1+At,Le+1+At+pe)===O){if(ge.push(ie.substring(q,Le).replace(De,Z)),Je(Le+1+At+pe),fe=ie.indexOf(L,q),Le=ie.indexOf(Z,q),Ue&&(qt(),Ae))return pt();if(K&&Ce.length>=K)return pt(!0);break}Se.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Ce.length,index:q}),Le++}}else if(Q&&ge.length===0&&ie.substring(q,q+de)===Q){if(ye===-1)return pt();q=ye+pe,ye=ie.indexOf(O,q),fe=ie.indexOf(L,q)}else if(fe!==-1&&(fe<ye||ye===-1))ge.push(ie.substring(q,fe)),q=fe+ee,fe=ie.indexOf(L,q);else{if(ye===-1)break;if(ge.push(ie.substring(q,ye)),Je(ye+pe),Ue&&(qt(),Ae))return pt();if(K&&Ce.length>=K)return pt(!0)}return Dt();function mt(Ct){Ce.push(Ct),ke=q}function Mt(Ct){var $t=0;return $t=Ct!==-1&&(Ct=ie.substring(Le+1,Ct))&&Ct.trim()===""?Ct.length:$t}function Dt(Ct){return N||(Ct===void 0&&(Ct=ie.substring(q)),ge.push(Ct),q=le,mt(ge),Ue&&qt()),pt()}function Je(Ct){q=Ct,mt(ge),ge=[],ye=ie.indexOf(O,q)}function pt(Ct){if(I.header&&!J&&Ce.length&&!Y){var $t=Ce[0],Nt=Object.create(null),Kt=new Set($t);let Tt=!1;for(let yt=0;yt<$t.length;yt++){let Xt=$t[yt];if(Nt[Xt=T(I.transformHeader)?I.transformHeader(Xt,yt):Xt]){let we,Ie=Nt[Xt];for(;we=Xt+"_"+Ie,Ie++,Kt.has(we););Kt.add(we),$t[yt]=we,Nt[Xt]++,Tt=!0,(z=z===null?{}:z)[we]=Xt}else Nt[Xt]=1,$t[yt]=Xt;Kt.add(Xt)}Tt&&console.warn("Duplicate headers found and renamed."),Y=!0}return{data:Ce,errors:Se,meta:{delimiter:L,linebreak:O,aborted:Ae,truncated:!!Ct,cursor:ke+(J||0),renamedHeaders:z}}}function qt(){H(pt()),Ce=[],Se=[]}},this.abort=function(){Ae=!0},this.getCharIndex=function(){return q}}function V(I){var L=I.data,O=p[L.workerId],Q=!1;if(L.error)O.userError(L.error,L.file);else if(L.results&&L.results.data){var H={abort:function(){Q=!0,F(L.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:$,resume:$};if(T(O.userStep)){for(var K=0;K<L.results.data.length&&(O.userStep({data:L.results.data[K],errors:L.results.errors,meta:L.results.meta},H),!Q);K++);delete L.results}else T(O.userChunk)&&(O.userChunk(L.results,H,L.file),delete L.results)}L.finished&&!Q&&F(L.workerId,L.results)}function F(I,L){var O=p[I];T(O.userComplete)&&O.userComplete(L),O.terminate(),delete p[I]}function $(){throw new Error("Not implemented.")}function U(I){if(typeof I!="object"||I===null)return I;var L,O=Array.isArray(I)?[]:{};for(L in I)O[L]=U(I[L]);return O}function D(I,L){return function(){I.apply(L,arguments)}}function T(I){return typeof I=="function"}return _.parse=function(I,L){var O=(L=L||{}).dynamicTyping||!1;if(T(O)&&(L.dynamicTypingFunction=O,O={}),L.dynamicTyping=O,L.transform=!!T(L.transform)&&L.transform,!L.worker||!_.WORKERS_SUPPORTED)return O=null,_.NODE_STREAM_INPUT,typeof I=="string"?(I=(Q=>Q.charCodeAt(0)!==65279?Q:Q.slice(1))(I),O=new(L.download?y:k)(L)):I.readable===!0&&T(I.read)&&T(I.on)?O=new b(L):(l.File&&I instanceof File||I instanceof Object)&&(O=new v(L)),O.stream(I);(O=(()=>{var Q;return!!_.WORKERS_SUPPORTED&&(Q=(()=>{var H=l.URL||l.webkitURL||null,K=a.toString();return _.BLOB_URL||(_.BLOB_URL=H.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",K,")();"],{type:"text/javascript"})))})(),(Q=new l.Worker(Q)).onmessage=V,Q.id=m++,p[Q.id]=Q)})()).userStep=L.step,O.userChunk=L.chunk,O.userComplete=L.complete,O.userError=L.error,L.step=T(L.step),L.chunk=T(L.chunk),L.complete=T(L.complete),L.error=T(L.error),delete L.worker,O.postMessage({input:I,config:L,workerId:O.id})},_.unparse=function(I,L){var O=!1,Q=!0,H=",",K=`\r |
| 298 |
`,W='"',z=W+W,Y=!1,Z=null,re=!1,q=((()=>{if(typeof L=="object"){if(typeof L.delimiter!="string"||_.BAD_DELIMITERS.filter(function(J){return L.delimiter.indexOf(J)!==-1}).length||(H=L.delimiter),typeof L.quotes!="boolean"&&typeof L.quotes!="function"&&!Array.isArray(L.quotes)||(O=L.quotes),typeof L.skipEmptyLines!="boolean"&&typeof L.skipEmptyLines!="string"||(Y=L.skipEmptyLines),typeof L.newline=="string"&&(K=L.newline),typeof L.quoteChar=="string"&&(W=L.quoteChar),typeof L.header=="boolean"&&(Q=L.header),Array.isArray(L.columns)){if(L.columns.length===0)throw new Error("Option columns is empty");Z=L.columns}L.escapeChar!==void 0&&(z=L.escapeChar+W),L.escapeFormulae instanceof RegExp?re=L.escapeFormulae:typeof L.escapeFormulae=="boolean"&&L.escapeFormulae&&(re=/^[=+\-@\t\r].*$/)}})(),new RegExp(B(W),"g"));if(typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(I)){if(!I.length||Array.isArray(I[0]))return Ae(null,I,Y);if(typeof I[0]=="object")return Ae(Z||Object.keys(I[0]),I,Y)}else if(typeof I=="object")return typeof I.data=="string"&&(I.data=JSON.parse(I.data)),Array.isArray(I.data)&&(I.fields||(I.fields=I.meta&&I.meta.fields||Z),I.fields||(I.fields=Array.isArray(I.data[0])?I.fields:typeof I.data[0]=="object"?Object.keys(I.data[0]):[]),Array.isArray(I.data[0])||typeof I.data[0]=="object"||(I.data=[I.data])),Ae(I.fields||[],I.data||[],Y);throw new Error("Unable to serialize unrecognized input");function Ae(J,N,le){var ee="",pe=(typeof J=="string"&&(J=JSON.parse(J)),typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(J)&&0<J.length),de=!Array.isArray(N[0]);if(pe&&Q){for(var Ue=0;Ue<J.length;Ue++)0<Ue&&(ee+=H),ee+=ie(J[Ue],Ue);0<N.length&&(ee+=K)}for(var Ce=0;Ce<N.length;Ce++){var Se=(pe?J:N[Ce]).length,ge=!1,ke=pe?Object.keys(N[Ce]).length===0:N[Ce].length===0;if(le&&!pe&&(ge=le==="greedy"?N[Ce].join("").trim()==="":N[Ce].length===1&&N[Ce][0].length===0),le==="greedy"&&pe){for(var Oe=[],Ee=0;Ee<Se;Ee++){var fe=de?J[Ee]:Ee;Oe.push(N[Ce][fe])}ge=Oe.join("").trim()===""}if(!ge){for(var ye=0;ye<Se;ye++){0<ye&&!ke&&(ee+=H);var De=pe&&de?J[ye]:ye;ee+=ie(N[Ce][De],ye)}Ce<N.length-1&&(!le||0<Se&&!ke)&&(ee+=K)}}return ee}function ie(J,N){var le,ee;return J==null?"":J.constructor===Date?JSON.stringify(J).slice(1,25):(ee=!1,re&&typeof J=="string"&&re.test(J)&&(J="'"+J,ee=!0),le=J.toString().replace(q,z),(ee=ee||O===!0||typeof O=="function"&&O(J,N)||Array.isArray(O)&&O[N]||((pe,de)=>{for(var Ue=0;Ue<de.length;Ue++)if(-1<pe.indexOf(de[Ue]))return!0;return!1})(le,_.BAD_DELIMITERS)||-1<le.indexOf(H)||le.charAt(0)===" "||le.charAt(le.length-1)===" ")?W+le+W:le)}},_.RECORD_SEP="",_.UNIT_SEP="",_.BYTE_ORDER_MARK="\uFEFF",_.BAD_DELIMITERS=["\r",` |
| 299 |
`,'"',_.BYTE_ORDER_MARK],_.WORKERS_SUPPORTED=!i&&!!l.Worker,_.NODE_STREAM_INPUT=1,_.LocalChunkSize=10485760,_.RemoteChunkSize=5242880,_.DefaultDelimiter=",",_.Parser=S,_.ParserHandle=w,_.NetworkStreamer=y,_.FileStreamer=v,_.StringStreamer=k,_.ReadableStreamStreamer=b,l.jQuery&&((n=l.jQuery).fn.parse=function(I){var L=I.config||{},O=[];return this.each(function(K){if(!(n(this).prop("tagName").toUpperCase()==="INPUT"&&n(this).attr("type").toLowerCase()==="file"&&l.FileReader)||!this.files||this.files.length===0)return!0;for(var W=0;W<this.files.length;W++)O.push({file:this.files[W],inputElem:this,instanceConfig:n.extend({},L)})}),Q(),this;function Q(){if(O.length===0)T(I.complete)&&I.complete();else{var K,W,z,Y,Z=O[0];if(T(I.before)){var re=I.before(Z.file,Z.inputElem);if(typeof re=="object"){if(re.action==="abort")return K="AbortError",W=Z.file,z=Z.inputElem,Y=re.reason,void(T(I.error)&&I.error({name:K},W,z,Y));if(re.action==="skip")return void H();typeof re.config=="object"&&(Z.instanceConfig=n.extend(Z.instanceConfig,re.config))}else if(re==="skip")return void H()}var q=Z.instanceConfig.complete;Z.instanceConfig.complete=function(Ae){T(q)&&q(Ae,Z.file,Z.inputElem),H()},_.parse(Z.file,Z.instanceConfig)}}function H(){O.splice(0,1),Q()}}),A&&(l.onmessage=function(I){I=I.data,_.WORKER_ID===void 0&&I&&(_.WORKER_ID=I.workerId),typeof I.input=="string"?l.postMessage({workerId:_.WORKER_ID,results:_.parse(I.input,I.config),finished:!0}):(l.File&&I.input instanceof File||I.input instanceof Object)&&(I=_.parse(I.input,I.config))&&l.postMessage({workerId:_.WORKER_ID,results:I,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(k.prototype=Object.create(k.prototype)).constructor=k,(b.prototype=Object.create(g.prototype)).constructor=b,_})}(Do)),Do.exports}var y2e=g2e();const Pc=Lm(y2e),b2e={class:"el-upload__text"},w2e={class:"fct-import-map-table-wrap"},C2e={class:"fct-import-map-heading"},k2e={class:"fct-import-map-table"},B2e={width:"50%"},x2e={class:"dialog-footer"},S2e={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=aa().ctx,l=M(!1),n=M(),i=M(),A=M([]),p=M([]),m=M({}),_=M({}),g=M(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const k=M(!1),b=gf(Ke.get("shop.decimal_separator","")),w=z=>_R(z,b.thousand),B=z=>{z&&Pc.parse(z,{header:!0,complete:function(Y){p.value=Y.data,A.value=Y.meta.fields,g.value=A.value.includes("Type")&&A.value.includes("Parent"),V(),g.value&&U(),k.value=!0}})},S=()=>{_.value={},A.value=[],p.value=[],k.value=!1,g.value=!1},V=()=>{const z=[],Y=[];let Z=0;A.value.forEach(re=>{let q=null,Ae=null;const ie=re.toString();for(const[J,N]of y.entries())if(ie.toLocaleLowerCase().startsWith(N)){const le=re.toString().match(/ \d+ /g);if(Array.isArray(le)&&le.length===1){let ee=le[0];Z=ee>Z?ee:Z,q=re.toString().replace(le[0]," %d "),Ae=re.toString().replace(le[0]," ");break}}q!=null?z.includes(q)||(z.push(q),Y.push({title:Ae,value:q})):Y.push({title:re,value:re})}),_.value=Y,v=Z},F=()=>window.fluentCartRestVars.rest.url+"/files/upload",$={post_id:["ID"],post_title:["Name"],post_name:["SKU"],post_content:["description","Description"],post_excerpt:["Short description","Short Description"],post_status:["Published"],comment_status:["Allow customer reviews?"],item_price:["Regular price","Meta: _subscription_price"],compare_price:["Sale price"],images:["Images"],categories:["Categories"],sku:["SKU"],payment_type:["Payment Type"],repeat_interval:["Subscription Interval","Meta: _subscription_period"],trial_days:["Trial Days","Meta: _subscription_trial_length"],installment:["Installment"],installment_count:["Installment Count"],manage_setup_fee:["Setup Fee"],signup_fee_name:["Setup Fee Name"],signup_fee:["Setup Fee Amount","Meta: _subscription_sign_up_fee"]},U=()=>{for(const[z,Y]of Object.entries($))if(m.value[z]){for(const Z of Y)if(A.value.includes(Z)){m.value[z].value=Z;break}}},D=z=>z?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[z.trim().toLowerCase()]||z:"",T=z=>{if(!z)return"";const Y=z.split(",").map(Z=>Z.trim().toLowerCase());return Y.includes("variation")?"variation":Y.includes("variable")?"variable":Y.includes("subscription")?"subscription":Y.includes("simple")?"simple":Y[0]||""},I=(z=!0)=>{const Y=[],Z={},re=m.value,q={description:"",payment_type:"onetime",times:"",repeat_interval:"",trial_days:"",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no"},Ae=J=>{const N=[];for(let le=1;le<=10;le++){const ee=`Attribute ${le} name`,pe=`Attribute ${le} value(s)`;J[ee]&&J[pe]&&N.push(J[pe])}return N.join(" - ")},ie=J=>J==="1"||J===1?"published":J==="0"||J===0?"draft":J||"published";p.value.forEach(J=>{var Se,ge,ke,Oe,Ee,fe,ye,De,Le,At,mt,Mt,Dt,Je,pt,qt,Ct,$t,Nt,Kt;const N=T(J.Type);if(N!=="simple"&&N!=="variable"&&N!=="subscription")return;const le={};le._cid=_l(),le.post_title=J[(Se=re.post_title)==null?void 0:Se.value]||"",le.post_name=J[(ge=re.post_name)==null?void 0:ge.value]||le.post_title,le.ID=J[(ke=re.post_id)==null?void 0:ke.value]||"",le.post_content=J[(Oe=re.post_content)==null?void 0:Oe.value]||"",le.post_excerpt=J[(Ee=re.post_excerpt)==null?void 0:Ee.value]||"",le.post_status=ie(J[(fe=re.post_status)==null?void 0:fe.value]);const ee={variation_type:N==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},pe=J[(ye=re.images)==null?void 0:ye.value]||"",de=[];pe&&pe.split(",").map(Tt=>Tt.trim()).filter(Boolean).forEach(Tt=>{const yt=Tt.split("/").pop().split("?")[0]||"image";de.push({id:0,url:Tt,title:yt})}),le.detail=ee,le.gallery=de,le.variants=[];const Ue=J[(De=re.categories)==null?void 0:De.value]||"";if(Ue?le.categories=Ue.split(",").map(Tt=>Tt.trim()).filter(Boolean):le.categories=[],N==="simple"||N==="subscription"){const Tt=w(J[(Le=re.item_price)==null?void 0:Le.value]||""),yt=w(J[(At=re.compare_price)==null?void 0:At.value]||""),Xt=J[(mt=re.sku)==null?void 0:mt.value]||"",we=N==="subscription"?"subscription":J[(Mt=re.payment_type)==null?void 0:Mt.value]||"onetime",Ie=D(J[(Dt=re.repeat_interval)==null?void 0:Dt.value]||""),it=J[(Je=re.trial_days)==null?void 0:Je.value]||"",kt=J[(pt=re.installment)==null?void 0:pt.value]||"",Bt=J[(qt=re.installment_count)==null?void 0:qt.value]||"",na=J[(Ct=re.manage_setup_fee)==null?void 0:Ct.value]||"",bt=J[($t=re.signup_fee_name)==null?void 0:$t.value]||"",ia=w(J[(Nt=re.signup_fee)==null?void 0:Nt.value]||"");(Tt||le.post_title)&&le.variants.push({_cid:_l(),variation_title:le.post_title,sku:Xt,item_price:Tt,compare_price:yt,other_info:{...q,payment_type:we,repeat_interval:Ie,trial_days:it,installment:kt==="yes"?"yes":"no",times:Bt,manage_setup_fee:na==="yes"?"yes":"no",signup_fee_name:bt,signup_fee:ia},media:[]})}const Ce=J[(Kt=re.sku)==null?void 0:Kt.value]||"";N==="variable"&&Ce&&(Z[Ce]=le),Y.push(le)}),p.value.forEach(J=>{var At,mt,Mt,Dt,Je,pt,qt,Ct,$t,Nt,Kt,Tt;if(T(J.Type)!=="variation")return;const N=J.Parent;if(!N||!Z[N])return;const le=Ae(J),ee=w(J[(At=re.item_price)==null?void 0:At.value]||""),pe=w(J[(mt=re.compare_price)==null?void 0:mt.value]||""),de=J[(Mt=re.images)==null?void 0:Mt.value]||"",Ue=[];de&&de.split(",").map(yt=>yt.trim()).filter(Boolean).forEach(yt=>{const Xt=yt.split("/").pop().split("?")[0]||"image";Ue.push({id:0,url:yt,title:Xt})});const Ce=J[(Dt=re.sku)==null?void 0:Dt.value]||"",Se=J[(Je=re.payment_type)==null?void 0:Je.value]||"onetime",ge=D(J[(pt=re.repeat_interval)==null?void 0:pt.value]||""),ke=J[(qt=re.trial_days)==null?void 0:qt.value]||"",Oe=J[(Ct=re.installment)==null?void 0:Ct.value]||"",Ee=J[($t=re.installment_count)==null?void 0:$t.value]||"",fe=J[(Nt=re.manage_setup_fee)==null?void 0:Nt.value]||"",ye=J[(Kt=re.signup_fee_name)==null?void 0:Kt.value]||"",De=w(J[(Tt=re.signup_fee)==null?void 0:Tt.value]||""),Le={_cid:_l(),variation_title:le||J.Name||"",sku:Ce,item_price:ee,compare_price:pe,other_info:{...q,payment_type:Se,repeat_interval:ge,trial_days:ke,installment:Oe==="yes"?"yes":"no",times:Ee,manage_setup_fee:fe==="yes"?"yes":"no",signup_fee_name:ye,signup_fee:De},media:Ue};Z[N].variants.push(Le)}),W("onDataPopulated",{products:Y,concat:z})},L=(z=!0)=>{if(g.value)return I(z);const Y=[];p.value.forEach(Z=>{var Ee,fe,ye,De,Le,At,mt,Mt,Dt,Je,pt,qt;const re={};re._cid=_l();const q=m.value;re.post_title=Z[q.post_title.value]??"",re.post_name=Z[q.post_name.value]??re.post_title,re.ID=Z[q.post_id.value]??"",re.post_content=Z[q.post_content.value]??"",re.post_excerpt=Z[q.post_excerpt.value]??"",re.post_status=Z[(Ee=q.post_status)==null?void 0:Ee.value]||"published",re.comment_status="close";const Ae=Z[(fe=q.images)==null?void 0:fe.value]||"",ie=[];Ae&&Ae.split(",").map(Ct=>Ct.trim()).filter(Boolean).forEach(Ct=>{const $t=Ct.split("/").pop().split("?")[0]||"image";ie.push({id:0,url:Ct,title:$t})});const J=Z[(ye=q.categories)==null?void 0:ye.value]||"";J?re.categories=J.split(",").map(Ct=>Ct.trim()).filter(Boolean):re.categories=[];const N=Z[(De=q.sku)==null?void 0:De.value]||"",le=Z[(Le=q.payment_type)==null?void 0:Le.value]||"onetime",ee=Z[(At=q.repeat_interval)==null?void 0:At.value]||"",pe=Z[(mt=q.trial_days)==null?void 0:mt.value]||"",de=Z[(Mt=q.installment)==null?void 0:Mt.value]||"",Ue=Z[(Dt=q.installment_count)==null?void 0:Dt.value]||"",Ce=Z[(Je=q.manage_setup_fee)==null?void 0:Je.value]||"",Se=Z[(pt=q.signup_fee_name)==null?void 0:pt.value]||"",ge=w(Z[(qt=q.signup_fee)==null?void 0:qt.value]||""),ke={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},Oe={description:"",payment_type:le,times:Ue,repeat_interval:ee,trial_days:pe,billing_summary:"",manage_setup_fee:Ce==="yes"?"yes":"no",signup_fee_name:Se,signup_fee:ge,setup_fee_per_item:"no",installment:de==="yes"?"yes":"no"};re.gallery=ie,re.variants=[];for(let Ct=1;Ct<=v;Ct++){const $t={};["variation_title","item_price","compare_price"].forEach(Nt=>{var Tt;const Kt=((Tt=q[Nt])==null?void 0:Tt.value)??"";if(Kt.length>0){const yt=Kt.replace("%d",Ct.toString()),Xt=Z[yt];$t[Nt]=Nt==="variation_title"?Xt:w(Xt)}}),H($t)&&($t._cid=_l(),$t.sku=N,$t.other_info={...Oe},$t.media=[],re.variants.push($t))}re.variants.length>0?(ke.variation_type="simple_variations",re.detail=ke,Y.push(re)):H(re)&&(re.variants.push({_cid:_l(),variation_title:"",sku:N,item_price:0,compare_price:0,other_info:{...Oe},media:[]}),re.detail=ke,Y.push(re))}),W("onDataPopulated",{products:Y,concat:z})},O=()=>{l.value=!1,n.value=[],i.value=null,S()},Q=(z=!0)=>{L(z),O()},H=z=>{let Y=!1;for(const[Z,re]of Object.entries(z))if(typeof re!==null&&typeof re<"u"&&(Array.isArray(re)&&re.length>0||re.toString().length>0)){Y=!0;break}return Y};Te(()=>{m.value={post_id:{title:a.$t("Post ID"),value:""},post_title:{title:a.$t("Post Title"),value:""},post_name:{title:a.$t("Post Name"),value:""},post_content:{title:a.$t("Post Content"),value:""},post_excerpt:{title:a.$t("Post Excerpt"),value:""},post_status:{title:a.$t("Post Status"),value:""},post_date:{title:a.$t("Post Date"),value:""},comment_status:{title:a.$t("Comment Status"),value:""},images:{title:a.$t("Images"),value:""},variation_title:{title:a.$t("Variation Title"),value:""},item_price:{title:a.$t("Variation Price"),value:""},compare_price:{title:a.$t("Variation Compare Price"),value:""},sku:{title:a.$t("SKU"),value:""},categories:{title:a.$t("Categories"),value:""},payment_type:{title:a.$t("Payment Type"),value:""},repeat_interval:{title:a.$t("Subscription Interval"),value:""},trial_days:{title:a.$t("Trial Days"),value:""},installment:{title:a.$t("Installment"),value:""},installment_count:{title:a.$t("Installment Count"),value:""},manage_setup_fee:{title:a.$t("Setup Fee"),value:""},signup_fee_name:{title:a.$t("Setup Fee Name"),value:""},signup_fee:{title:a.$t("Setup Fee Amount"),value:""}}});const K=()=>{const z=[{ID:"",Type:"simple",SKU:"BASIC-TEE-001",Name:"Classic Cotton T-Shirt",Published:1,"Short description":"Comfortable everyday cotton tee",description:"Made from 100% organic cotton. Pre-shrunk and machine washable.",Categories:"Clothing, Clothing > T-Shirts",Images:"https://example.com/images/tee-front.jpg, https://example.com/images/tee-back.jpg",Parent:"","Regular price":"29.99","Sale price":"24.99","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"onetime","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"simple",SKU:"STARTER-PLAN",Name:"Starter Membership Plan",Published:1,"Short description":"Monthly access to premium content",description:"Get access to all premium tutorials and resources. Cancel anytime.",Categories:"Memberships",Images:"",Parent:"","Regular price":"9.99","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"subscription","Subscription Interval":"monthly","Trial Days":"14",Installment:"","Installment Count":"","Setup Fee":"yes","Setup Fee Name":"Activation Fee","Setup Fee Amount":"4.99"},{ID:"",Type:"simple",SKU:"PRO-YEARLY",Name:"Pro Annual Plan",Published:1,"Short description":"12-month installment plan",description:"Pay in 12 monthly installments for annual access to all pro features.",Categories:"Memberships",Images:"",Parent:"","Regular price":"19.99","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"subscription","Subscription Interval":"monthly","Trial Days":"",Installment:"yes","Installment Count":"12","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variable",SKU:"HOODIE-PREMIUM",Name:"Premium Zip Hoodie",Published:1,"Short description":"Heavyweight zip-up hoodie",description:"Premium quality hoodie with YKK zipper. Available in multiple colors.",Categories:"Clothing, Clothing > Hoodies",Images:"https://example.com/images/hoodie-main.jpg, https://example.com/images/hoodie-side.jpg, https://example.com/images/hoodie-detail.jpg",Parent:"","Regular price":"","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-BLK",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"https://example.com/images/hoodie-black.jpg",Parent:"HOODIE-PREMIUM","Regular price":"59.99","Sale price":"","Attribute 1 name":"Color","Attribute 1 value(s)":"Black","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-WHT",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"",Parent:"HOODIE-PREMIUM","Regular price":"59.99","Sale price":"","Attribute 1 name":"Color","Attribute 1 value(s)":"White","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-BLU-LE",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"",Parent:"HOODIE-PREMIUM","Regular price":"69.99","Sale price":"64.99","Attribute 1 name":"Color","Attribute 1 value(s)":"Blue","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""}],Y=Pc.unparse(z),Z=new Blob([Y],{type:"text/csv;charset=utf-8;"}),re=URL.createObjectURL(Z),q=document.createElement("a");q.href=re,q.download="fluent-cart-sample-import.csv",document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(re)},W=t;return(z,Y)=>{const Z=C("el-button"),re=C("el-upload"),q=C("el-option"),Ae=C("el-select"),ie=C("el-dialog");return r(),h(P,null,[s(Z,{onClick:Y[0]||(Y[0]=J=>l.value=!0)},{default:u(()=>[R(f(z.$t("Import")),1)]),_:1}),s(ie,{modelValue:l.value,"onUpdate:modelValue":Y[4]||(Y[4]=J=>l.value=J),"append-to-body":!0,title:z.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:u(()=>[k.value?x("",!0):(r(),E(re,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":n.value,"onUpdate:fileList":Y[1]||(Y[1]=J=>n.value=J),drag:"",action:F(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":J=>{S(),i.value=J,B(J==null?void 0:J.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:u(()=>[s(tt,{circle:"",bg:"primary",soft:""},{default:u(()=>[s(X,{name:"Upload"})]),_:1}),o("div",b2e,[R(f(z.$t("Drag & Drop or"))+" ",1),o("em",null,f(z.$t("Browse/Upload")),1),R(" "+f(z.$t("Files"))+" ",1),o("span",null,f(c(d)("Any Format upto %s",c(Qt).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),k.value?x("",!0):(r(),E(Z,{key:1,onClick:K,link:""},{default:u(()=>[s(X,{name:"Download"}),R(" "+f(z.$t("Download a Sample CSV File")),1)]),_:1})),k.value?(r(),h(P,{key:2},[o("div",w2e,[o("h4",C2e,f(z.$t("Map Columns")),1),o("table",k2e,[o("thead",null,[o("tr",null,[o("th",null,f(z.$t("Products Fields")),1),o("th",null,f(z.$t("CSV Headers")),1)])]),o("tbody",null,[(r(!0),h(P,null,ae(m.value,(J,N)=>(r(),h("tr",null,[o("td",null,f(J.title),1),o("td",B2e,[s(Ae,{modelValue:J.value,"onUpdate:modelValue":le=>J.value=le,filterable:"",clearable:""},{default:u(()=>[(r(!0),h(P,null,ae(_.value,le=>(r(),E(q,{key:le.value,label:le.title,value:le.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",x2e,[s(Z,{onClick:Y[2]||(Y[2]=J=>Q())},{default:u(()=>[R(f(z.$t("Add Products")),1)]),_:1}),s(Z,{onClick:Y[3]||(Y[3]=J=>Q(!1))},{default:u(()=>[R(f(z.$t("Clear and Add Products")),1)]),_:1})])],64)):x("",!0)]),_:1},8,["modelValue","title"])],64)}}};class $2e extends Hd{beforeInit(){this.data.products=[],this.data.saving=!1,this.data.saveProgress={total:0,completed:0,errors:[],createdIds:[]},this.data.savingIds=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map,this.data.categoryOptions=[],this.data.dummies.product={ID:"",post_title:"",post_name:"",post_content:"",post_excerpt:"",post_status:"published",post_date:new Date,comment_status:"close",categories:[],variants:!1}}populateDummyProduct(){const t={...this.data.dummies.product};t._cid=_l(),t.detail={...this.data.dummies.productDetail},t.gallery=[],t.downloadable_files={...this.data.dummies.downloadableFile},t.variants=[this.getDummyVariation(t)],this.data.products.push(t)}clearProducts(){this.data.products=[]}isSaving(t){return this.data.savingIds.has(t)}isSaved(t){return this.data.savedIds.has(t)}isRowDisabled(t){return this.isSaving(t)||this.isSaved(t)}hasError(t){return this.data.productErrors.has(t)}getError(t){const a=this.data.productErrors.get(t);return a?a.fields&&Object.keys(a.fields).length?Object.values(a.fields).join("; "):a.message||"":""}hasProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?!!a.message:Object.keys(a.fields).some(l=>!l.startsWith("variants.")):!1}getProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?a.message||"":Object.entries(a.fields).filter(([n])=>!n.startsWith("variants.")).map(([,n])=>n).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const n=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(n))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const n=`variants.${a}.`;return Object.entries(l.fields).filter(([A])=>A.startsWith(n)).map(([,A])=>A).join("; ")}hasFieldError(t,a){var n;const l=this.data.productErrors.get(t);return!!((n=l==null?void 0:l.fields)!=null&&n[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}chunkArray(t,a){const l=[];for(let n=0;n<t.length;n+=a)l.push(t.slice(n,n+a));return l}async saveProducts(){var n,i;const t=this.data.products,a=t.filter(A=>!this.data.savedIds.has(A._cid));if(a.length===0){j.error(d("No products to save."));return}const l=this.chunkArray(a,10);this.data.saving=!0,this.data.productErrors=new Map,this.data.saveProgress={total:l.length,completed:0,errors:[],createdIds:[]};try{for(const m of l){const _=m.map(g=>g._cid);for(const g of _)this.data.savingIds.add(g);this.data.savingIds=new Set(this.data.savingIds);try{const g=await ce.post("products/bulk-insert",{products:m});if(g.created&&g.created.length){this.data.saveProgress.createdIds.push(...g.created);for(const y of g.created){this.data.savedIds.add(y._cid);const v=t.find(k=>k._cid===y._cid);v&&(v.ID=y.id,v.view_url=y.view_url||"")}this.data.savedIds=new Set(this.data.savedIds)}if(g.errors&&g.errors.length){this.data.saveProgress.errors.push(...g.errors);for(const y of g.errors)y._cid&&this.data.productErrors.set(y._cid,{message:y.message,fields:y.fields||{}});this.data.productErrors=new Map(this.data.productErrors)}}catch(g){const y=(n=g==null?void 0:g.data)==null?void 0:n.errors;if(Array.isArray(y)&&y.length){this.data.saveProgress.errors.push(...y);for(const v of y)v._cid&&this.data.productErrors.set(v._cid,{message:v.message,fields:v.fields||{}})}else{const v=((i=g==null?void 0:g.data)==null?void 0:i.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:v});for(const k of _)this.data.productErrors.set(k,{message:v,fields:{}})}this.data.productErrors=new Map(this.data.productErrors)}for(const g of _)this.data.savingIds.delete(g);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{createdIds:A,errors:p}=this.data.saveProgress;p.length===0?j.success(`${A.length} product(s) created successfully`):A.length>0?j.info(`${A.length} product(s) created, ${p.length} error(s)`):j.error(d("All products failed to save"))}finally{this.data.saving=!1}}async removeProduct(t){var l;if(t.ID&&this.data.savedIds.has(t._cid)){try{await ce.delete(`products/${t.ID}`)}catch(n){const i=((l=n==null?void 0:n.data)==null?void 0:l.message)||"Failed to delete product from server";j.error(i);return}this.data.savedIds.delete(t._cid),this.data.savedIds=new Set(this.data.savedIds)}const a=this.data.products.indexOf(t);a!==-1&&this.data.products.splice(a,1)}removeVariant(t,a){const l=t.variants.indexOf(a);l!==-1&&t.variants.splice(l,1)}duplicateProduct(t){const a=JSON.parse(JSON.stringify(t));a._cid=_l(),a.post_title=a.post_title?a.post_title+" (Copy)":"",a.variants&&Array.isArray(a.variants)&&a.variants.forEach(n=>{n.sku="",n._cid=_l()});const l=this.data.products.indexOf(t);this.data.products.splice(l+1,0,a)}duplicateProductWithVariants(t,a){const l=JSON.parse(JSON.stringify(t));if(l._cid=_l(),l.post_title=l.post_title?l.post_title+" (Copy)":"",l.variants&&Array.isArray(l.variants)){const i=new Set(a);l.variants=l.variants.filter((A,p)=>i.has(p)),l.variants.forEach(A=>{A.sku="",A._cid=_l()})}const n=this.data.products.indexOf(t);this.data.products.splice(n+1,0,l)}duplicateVariant(t,a){const l=JSON.parse(JSON.stringify(a));l._cid=_l(),l.variation_title=l.variation_title?l.variation_title+" (Copy)":"",l.sku="";const n=t.variants.indexOf(a);t.variants.splice(n+1,0,l)}resetPaymentTypeDefaults(t){t.other_info.payment_type==="onetime"&&(t.other_info.installment="no",t.other_info.times="",t.other_info.manage_setup_fee="no",t.other_info.signup_fee="",t.other_info.signup_fee_name="")}resetState(){this.data.products.splice(0),this.data.savedIds=new Set,this.data.savingIds=new Set,this.data.productErrors=new Map}getColumnWidthStorageKey(){return"bulk_insert_column_widths"}getColumnStorageKey(){return"bulk_insert_columns"}getToggleableColumns(){return[{label:"SKU",value:"sku"},{label:"Media",value:"media"},{label:"Categories",value:"categories"},{label:"Description",value:"description"},{label:"Short Description",value:"short_description"},{label:"Status",value:"status"},{label:"Product Type",value:"product_type"},{label:"Pricing Type",value:"pricing_type"},{label:"Payment Type",value:"payment_type"},{label:"Interval",value:"interval"},{label:"Trial Days",value:"trial_days"},{label:"Best Price",value:"best_price"},{label:"Compare-at Price",value:"compare_price"},{label:"Track Quantity",value:"track_quantity"},{label:"Stock",value:"stock"}]}flattenCategoryTree(t,a=""){var n;const l=[];for(const i of t){const A=a?`${a} > ${i.label}`:i.label;l.push({label:A,value:A}),(n=i.children)!=null&&n.length&&l.push(...this.flattenCategoryTree(i.children,A))}return l}async fetchCategories(){try{const a=(await ce.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(n=>n.name==="product-categories");l!=null&&l.terms&&(this.data.categoryOptions=this.flattenCategoryTree(l.terms))}catch{}}}const Ft=$2e.init(),F2e={class:"max-w-full overflow-x-scroll"},E2e={class:"relative"},U2e={key:0,class:"bulk-checkbox-cell"},I2e=["onMousedown","onTouchstart"],Nf={__name:"ResizeableColumns",props:{columns:{type:Array,required:!0},stickyLast:{type:Boolean,default:!1}},emits:["scroll","resize-end"],setup(e,{emit:t}){const a=t,l=_m(),n=dd("table"),i=M(null);let A=null;Te(()=>{$e(()=>{const g=n.value.querySelectorAll("th"),y=l["header-first"]?1:0;Array.from(g).forEach((v,k)=>{const b=k-y;b<0||b>=p.columns.length||(p.columns[b].width=v.offsetWidth,p.columns[b].minWidth||(p.columns[b].minWidth=v.offsetWidth))}),A=new ResizeObserver(()=>{n.value.style.setProperty("--resizer-height",n.value.offsetHeight+"px");const v=n.value.querySelector("th");v&&n.value.style.setProperty("--header-height",v.offsetHeight+"px")}),A.observe(n.value)})}),Ga(()=>{A&&A.disconnect()});const p=e,m=G(()=>{const g=l["header-first"]?40:0;return p.columns.reduce((y,v)=>y+v.width,0)+g}),_=(g,y)=>{g.preventDefault();const v=g.clientX,k=p.columns[y].width,b=p.columns[y].minWidth||50;i.value=y;const w=S=>{const V=k+(S.clientX-v);V>=b&&(p.columns[y].width=V)},B=()=>{i.value=null,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",B),a("resize-end")};document.addEventListener("mousemove",w),document.addEventListener("mouseup",B)};return(g,y)=>(r(),h("div",F2e,[o("div",{class:ue(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[o("div",E2e,[o("table",{id:"tb",ref_key:"table",ref:n,style:fa({tableLayout:"fixed",width:m.value+"px"})},[o("thead",null,[o("tr",null,[g.$slots["header-first"]?(r(),h("th",U2e,[wa(g.$slots,"header-first")])):x("",!0),(r(!0),h(P,null,ae(e.columns,(v,k)=>(r(),h("th",{class:ue({"sticky-col":k===0,"sticky-col sticky-col-right":k===e.columns.length-1&&e.stickyLast}),style:fa({width:v.width+"px",zIndex:k===0||k===e.columns.length-1&&e.stickyLast?70:e.columns.length-k+50,left:k===0&&g.$slots["header-first"]?"40px":k===0?"0px":void 0}),key:v.key||k},[k===e.columns.length-1?wa(g.$slots,"header-last",{key:0},()=>[R(f(v.title),1)]):(r(),h(P,{key:1},[R(f(v.title),1)],64)),k<e.columns.length-1?(r(),h("span",{key:2,class:ue(["resizer",{"is-active":i.value===k}]),onMousedown:b=>_(b,k),onTouchstart:b=>_(b,k)},null,42,I2e)):x("",!0)],6))),128))])]),o("tbody",null,[wa(g.$slots,"default")])],4)])],34)]))}},V2e={class:"bulk-setup-fee-badge"},D2e={key:1,class:"text-gray-300 text-sm flex justify-center"},li={__name:"BulkPriceInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=t;return(l,n)=>{var A;const i=C("el-tooltip");return e.variant?(r(),E(Ya,{key:0,size:"small","error-class":e.hasError?"is-error":"","model-value":e.variant.item_price,placeholder:l.$t("Price"),disabled:e.disabled,"onUpdate:modelValue":n[0]||(n[0]=p=>{e.variant.item_price=p,a("change")})},sa({_:2},[((A=e.variant.other_info)==null?void 0:A.manage_setup_fee)==="yes"&&e.variant.other_info.signup_fee?{name:"suffix",fn:u(()=>[s(i,{content:(e.variant.other_info.signup_fee_name||l.$t("Setup fee"))+": "+c(jt)(e.variant.other_info.signup_fee,!0),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[o("span",V2e,"+ "+f(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["error-class","model-value","placeholder","disabled"])):(r(),h("span",D2e,"—"))}}},T2e=["disabled"],Q2e={key:0,class:"fct-bulk-sub-count"},M2e={class:"fct-bulk-sub-popover-body"},L2e={class:"fct-bulk-sub-popover-title"},R2e={class:"fct-bulk-sub-section"},O2e={class:"fct-bulk-sub-row"},P2e={class:"fct-bulk-sub-row"},H2e={class:"fct-bulk-sub-label"},N2e={class:"fct-bulk-sub-row"},K2e={class:"fct-bulk-sub-label"},G2e=["innerHTML"],z2e={class:"fct-bulk-sub-section"},j2e={class:"fct-bulk-sub-row"},q2e={class:"fct-bulk-sub-row"},Y2e={class:"fct-bulk-sub-label"},W2e={class:"fct-bulk-sub-row"},J2e={class:"fct-bulk-sub-label"},X2e={class:"fct-bulk-sub-footer"},mr=2,Z2e={__name:"BulkSubscriptionPopover",props:{variant:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:["changed"],setup(e,{emit:t}){const a=e,l=t,n=aa().ctx,i=Ke.get(),A=Ke.get("app_config.isProActive"),p=M(!1);G(()=>{var F;return((F=i==null?void 0:i.shop)==null?void 0:F.currency_sign)||"$"});const m=G(()=>{var F;return((F=a.variant)==null?void 0:F.other_info)||{}}),_=G(()=>m.value.payment_type==="subscription"),g=G(()=>m.value.installment==="yes"),y=G(()=>Number(m.value.times)||1),v=G(()=>{var $;const F=Number(($=a.variant)==null?void 0:$.item_price)||0;return g.value?F*y.value:F}),k=G(()=>{const F=[];if(g.value&&F.push(n.$t("Installment")+": "+y.value+"x"),m.value.manage_setup_fee==="yes"){const $=m.value.signup_fee_name||n.$t("Setup fee"),U=m.value.signup_fee||0;F.push(n.$t("Setup fee")+": "+$+" ("+jt(U,!0)+")")}return F.length>0?F.join(` |
| 300 |
`):n.$t("Subscription settings")}),b=F=>{F==="no"?a.variant.other_info.times="":w(),l("changed")},w=()=>{const F=Number(a.variant.other_info.times);(!Number.isFinite(F)||F<mr)&&(a.variant.other_info.times=mr)},B=F=>{F==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},S=()=>{l("changed")},V=()=>{p.value=!1};return(F,$)=>{const U=C("el-checkbox"),D=C("el-tooltip"),T=C("el-input"),I=C("el-switch"),L=C("el-button"),O=C("el-popover");return r(),E(D,{content:k.value,placement:"top",disabled:!_.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:u(()=>[s(O,{visible:p.value,"onUpdate:visible":$[6]||($[6]=Q=>p.value=Q),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!_.value,"popper-class":"bulk-sub-popover"},{reference:u(()=>[o("button",{class:ue(["fc-bulk-sub-icon-btn",{"is-active":_.value,"is-configured":_.value&&(g.value||m.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!_.value,onClick:$[0]||($[0]=Ge(()=>{},["prevent"]))},[$[7]||($[7]=o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[o("path",{d:"M6 4H21C21.5523 4 22 4.44772 22 5V12H20V6H6V9L1 5.5L6 2V4ZM18 20H3C2.44772 20 2 19.5523 2 19V12H4V18H18V15L23 18.5L18 22V20Z"})],-1)),g.value?(r(),h("span",Q2e,f(y.value),1)):x("",!0)],10,T2e)]),default:u(()=>[o("div",M2e,[o("h4",L2e,f(F.$t("Subscription Settings")),1),o("div",R2e,[o("div",O2e,[s(U,{"true-value":"yes","false-value":"no",label:F.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":$[1]||($[1]=Q=>e.variant.other_info.installment=Q),disabled:!c(A)||e.disabled,onChange:b},null,8,["label","modelValue","disabled"]),c(A)?x("",!0):(r(),E(D,{key:0,"popper-class":"fct-tooltip"},{content:u(()=>[R(f(F.$t("This feature is available in pro version only.")),1)]),default:u(()=>[s(X,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.installment==="yes"?(r(),h(P,{key:0},[o("div",P2e,[o("label",H2e,f(F.$t("Installment Count")),1),s(T,{type:"number",min:mr,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":$[2]||($[2]=Q=>e.variant.other_info.times=Q),modelModifiers:{number:!0},placeholder:F.$t("Count"),style:{width:"100px"},onInput:S,onChange:w},null,8,["modelValue","placeholder"])]),o("div",N2e,[o("span",K2e,f(F.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:c(jt)(v.value,!0)},null,8,G2e)])],64)):x("",!0)]),o("div",z2e,[o("div",j2e,[s(I,{"active-text":F.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":$[3]||($[3]=Q=>e.variant.other_info.manage_setup_fee=Q),"active-value":"yes","inactive-value":"no",disabled:!c(A)||e.disabled,size:"small",onChange:B},null,8,["active-text","modelValue","disabled"]),c(A)?x("",!0):(r(),E(D,{key:0,"popper-class":"fct-tooltip"},{content:u(()=>[R(f(F.$t("This feature is available in pro version only.")),1)]),default:u(()=>[s(X,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.manage_setup_fee==="yes"?(r(),h(P,{key:0},[o("div",q2e,[o("label",Y2e,f(F.$t("Label")),1),s(T,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":$[4]||($[4]=Q=>e.variant.other_info.signup_fee_name=Q),placeholder:F.$t("e.g. Initial Setup"),onInput:S},null,8,["modelValue","placeholder"])]),o("div",W2e,[o("label",J2e,f(F.$t("Amount")),1),s(Ya,{size:"small","model-value":e.variant.other_info.signup_fee,placeholder:F.$t("Amount"),"onUpdate:modelValue":$[5]||($[5]=Q=>{e.variant.other_info.signup_fee=Q,S()})},null,8,["model-value","placeholder"])])],64)):x("",!0)]),o("div",X2e,[s(L,{size:"small",type:"primary",onClick:V},{default:u(()=>[R(f(F.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},eke={key:0,class:"flex items-center"},tke={key:1,class:"text-gray-300 text-sm flex justify-center"},si={__name:"BulkPaymentTypeCell",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change","payment-type-change"],setup(e,{emit:t}){const a=e,l=t,n=()=>{var i;return(i=a.variant)==null?void 0:i.other_info};return(i,A)=>{const p=C("el-option"),m=C("el-select");return e.variant&&n()?(r(),h("div",eke,[s(m,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":A[0]||(A[0]=_=>e.variant.other_info.payment_type=_),size:"small",class:ue({"is-field-error":e.hasError}),disabled:e.disabled,onChange:A[1]||(A[1]=_=>l("payment-type-change",e.variant))},{default:u(()=>[s(p,{label:i.$t("One Time"),value:"onetime"},null,8,["label"]),s(p,{label:i.$t("Subscription"),value:"subscription"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"]),s(Z2e,{variant:e.variant,disabled:e.disabled,onChanged:A[2]||(A[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),h("span",tke,"—"))}}},ake={key:1,class:"text-gray-300 text-sm flex justify-center"},ni={__name:"BulkIntervalSelect",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=e,l=t,n=()=>{var i,A;return((A=(i=a.variant)==null?void 0:i.other_info)==null?void 0:A.payment_type)==="subscription"};return(i,A)=>{const p=C("el-option"),m=C("el-select");return e.variant&&n()?(r(),E(m,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":A[0]||(A[0]=_=>e.variant.other_info.repeat_interval=_),size:"small",class:ue({"is-field-error":e.hasError}),disabled:e.disabled,onChange:A[1]||(A[1]=_=>l("change"))},{default:u(()=>[s(p,{label:i.$t("Yearly"),value:"yearly"},null,8,["label"]),s(p,{label:i.$t("Half Yearly"),value:"half_yearly"},null,8,["label"]),s(p,{label:i.$t("Quarterly"),value:"quarterly"},null,8,["label"]),s(p,{label:i.$t("Monthly"),value:"monthly"},null,8,["label"]),s(p,{label:i.$t("Weekly"),value:"weekly"},null,8,["label"]),s(p,{label:i.$t("Daily"),value:"daily"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"])):(r(),h("span",ake,"—"))}}},lke={key:1,class:"text-gray-300 text-sm flex justify-center"},oi={__name:"BulkTrialDaysInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=e,l=t,n=()=>{var i,A;return((A=(i=a.variant)==null?void 0:i.other_info)==null?void 0:A.payment_type)==="subscription"};return(i,A)=>{const p=C("el-input");return e.variant&&n()?(r(),E(p,{key:0,class:ue(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":A[0]||(A[0]=m=>e.variant.other_info.trial_days=m),placeholder:"0",disabled:e.disabled,onChange:A[1]||(A[1]=m=>l("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),h("span",lke,"—"))}}},ske={key:1,class:"text-gray-300 text-sm flex justify-center"},ii={__name:"BulkComparePriceInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=t;return(l,n)=>e.variant?(r(),E(Ya,{key:0,size:"small","error-class":e.hasError?"is-error":"","model-value":e.variant.compare_price,placeholder:l.$t("Compare price"),disabled:e.disabled,"onUpdate:modelValue":n[0]||(n[0]=i=>{e.variant.compare_price=i,a("change")})},null,8,["error-class","model-value","placeholder","disabled"])):(r(),h("span",ske,"—"))}},Kf={__name:"BulkCategorySelect",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=t,l=n=>{a("update:modelValue",n),a("change",n)};return(n,i)=>{const A=C("el-option"),p=C("el-select");return r(),E(p,{"model-value":e.modelValue,multiple:"",filterable:"","allow-create":"","default-first-option":"","collapse-tags":"","collapse-tags-tooltip":!1,"max-collapse-tags":1,size:"small",placeholder:n.$t("Select or type..."),disabled:e.disabled,"onUpdate:modelValue":l},{default:u(()=>[(r(!0),h(P,null,ae(e.options,m=>(r(),E(A,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},nke=["textContent"],oke={key:1,class:"fct-bulk-editor-placeholder"},ri={__name:"BulkEditorCell",props:{value:{type:String,default:""},placeholder:{type:String,default:""}},emits:["click"],setup(e){return(t,a)=>(r(),h("div",{class:"fct-bulk-editor",onClick:a[0]||(a[0]=l=>t.$emit("click"))},[e.value?(r(),h("span",{key:0,class:"bulk-editor-preview",textContent:f(e.value)},null,8,nke)):(r(),h("span",oke,f(e.placeholder),1))]))}};function Gf(){const e=M(new Set),t=M(null),a=M(!1),l=(y,v,k)=>{if(v.shiftKey&&t.value!==null){const w=k.indexOf(t.value),B=k.indexOf(y);if(w!==-1&&B!==-1){const S=Math.min(w,B),V=Math.max(w,B),F=new Set(e.value);for(let $=S;$<=V;$++)F.add(k[$]);e.value=F}}else{const w=new Set(e.value);w.has(y)?w.delete(y):w.add(y),e.value=w,t.value=y}},n=y=>{e.value.size===y.length&&y.length>0?e.value=new Set:e.value=new Set(y)},i=y=>{e.value=new Set(y)},A=()=>{e.value=new Set,t.value=null,a.value=!1},p=()=>{a.value?a.value=!1:e.value.size>=2&&(a.value=!0)};be(e,y=>{a.value&&y.size<2&&(a.value=!1)});const m=y=>e.value.has(y),_=G(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:l,toggleSelectAll:n,selectAll:i,deselectAll:A,toggleLinkMode:p,isSelected:m,selectedCount:_,pruneStaleKeys:y=>{const v=new Set(y);let k=!1;const b=new Set;for(const w of e.value)v.has(w)?b.add(w):k=!0;k&&(e.value=b),t.value&&!v.has(t.value)&&(t.value=null)}}}const ike={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},zf={title:{product:{get:e=>e.post_title,set:(e,t)=>e.post_title=t},variant:{get:e=>e.variation_title,set:(e,t)=>e.variation_title=t}},sku:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.sku},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].sku=t)}},variant:{get:e=>e.sku,set:(e,t)=>e.sku=t}},status:{product:{get:e=>e.post_status,set:(e,t)=>e.post_status=t}},description:{product:{get:e=>e.post_content,set:(e,t)=>e.post_content=t}},short_desc:{product:{get:e=>e.post_excerpt,set:(e,t)=>e.post_excerpt=t}},product_type:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.fulfillment_type},set:(e,t)=>{e.detail&&(e.detail.fulfillment_type=t)}}},pricing_type:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.variation_type},set:(e,t)=>{e.detail&&(e.detail.variation_type=t)}}},payment_type:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.payment_type},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.payment_type=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.payment_type},set:(e,t)=>{e.other_info&&(e.other_info.payment_type=t)}}},interval:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.repeat_interval},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.repeat_interval=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.repeat_interval},set:(e,t)=>{e.other_info&&(e.other_info.repeat_interval=t)}}},trial_days:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.trial_days},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.trial_days=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.trial_days},set:(e,t)=>{e.other_info&&(e.other_info.trial_days=t)}}},price:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.item_price},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].item_price=t)}},variant:{get:e=>e.item_price,set:(e,t)=>e.item_price=t}},compare_price:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.compare_price},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].compare_price=t)}},variant:{get:e=>e.compare_price,set:(e,t)=>e.compare_price=t}},manage_stock:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.manage_stock},set:(e,t)=>{e.detail&&(e.detail.manage_stock=t)}}},categories:{product:{get:e=>e.categories,set:(e,t)=>e.categories=[...t]}}},rke={...zf,stock:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.total_stock},set:(e,t)=>{e.detail&&(e.detail.total_stock=t)}},variant:{get:e=>e.total_stock,set:(e,t)=>e.total_stock=t}}},dke={...zf,stock:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.available},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].available=t)}},variant:{get:e=>e.available,set:(e,t)=>e.available=t}}};function jf(e,t,a,l,n,i,A){const p=A[e];if(p)for(const m of l){if(m===a)continue;const _=n(m);if(!_)continue;const g=p[_.type];g&&(g.set(_.data,t),i&&i(_.product))}}const uke={class:"fct-bulk-insert-page fct-layout-width"},cke={class:"fct-btn-group sm justify-end"},Ake={class:"filter-popover-item"},pke={class:"filter-popover-title"},fke={key:0,"aria-hidden":"true"},mke=["colspan"],hke=["onClick"],_ke=["onClick"],vke={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},gke={class:"flex items-center"},yke=["onClick","title"],bke={key:0,class:"bulk-collapse-count"},wke=["title"],Cke=["title"],kke={class:"bulk-status-icon is-error"},Bke={key:0,class:"fct-bulk-sku-cell"},xke={key:1,class:"text-gray-300 text-sm flex justify-center"},Ske={key:1,class:"fct-bulk-media-cell"},$ke={key:2,class:"fct-bulk-categories-cell"},Fke={key:3,class:"fct-bulk-desc-cell"},Eke={key:4,class:"fct-bulk-short-desc-cell"},Uke={key:5,class:"fct-bulk-status-cell"},Ike={key:6,class:"fct-bulk-product-type-cell"},Vke={key:7,class:"fct-bulk-product-type-cell"},Dke={key:8,class:"fct-bulk-pricing-type-cell"},Tke={key:9,class:"fct-bulk-pricing-type-cell"},Qke={key:10,class:"fct-bulk-payment-type-cell"},Mke={key:11,class:"fct-bulk-interval-cell"},Lke={key:12,class:"fct-bulk-trial-days-cell"},Rke={key:13,class:"fct-bulk-best-price-cell"},Oke={key:14,class:"fct-bulk-compare-price-cell"},Pke={key:15,class:"fct-bulk-qty-cell !pl-5"},Hke={key:16,class:"fct-bulk-stock-cell"},Nke={key:1,class:"text-gray-300 text-sm pl-5"},Kke={class:"fct-btn-group xs justify-end"},Gke=["href","title"],zke={key:0,class:"bulk-variants-block-row"},jke=["colspan"],qke={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Yke=["onClick"],Wke={class:"bulk-checkbox-cell"},Jke={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Xke={class:"flex items-center gap-1 pl-4"},Zke={class:"bulk-status-icon is-error"},eBe={key:0,class:"fct-bulk-sku-cell"},tBe={key:1,class:"fct-bulk-media-cell"},aBe={key:2},lBe={key:3},sBe={key:4},nBe={key:5},oBe={key:6},iBe={key:7},rBe={key:8},dBe={key:9},uBe={key:10},cBe={key:11},ABe={key:12},pBe={key:13,class:"text-center"},fBe={key:14},mBe={key:1,class:"text-gray-300 text-sm flex justify-center"},hBe={class:"fct-btn-group sm justify-end"},_Be={class:"bulk-add-variant-row"},vBe=["colspan"],gBe={class:"sticky left-0 inline-block pl-6"},yBe={key:1,"aria-hidden":"true"},bBe=["colspan"],hr=43,wBe=10,CBe=800,Hc=100,kBe={__name:"BulkInsert",setup(e){const{options:t,products:a}=Ft.data,l=we=>{var Ie;return((Ie=we==null?void 0:we.detail)==null?void 0:Ie.variation_type)==="simple"},n=G(()=>Ft.data.saving),i=G(()=>Ft.data.saveProgress),A=G(()=>{const we=Ft.data.saveProgress;return we.total?Math.round(we.completed/we.total*100):0}),p=()=>{Ft.saveProducts()},m=we=>Ft.isSaving(we._cid),_=we=>Ft.isSaved(we._cid),g=we=>Ft.isRowDisabled(we._cid),y=we=>Ft.hasError(we._cid),v=we=>Ft.getError(we._cid),k=we=>Ft.hasProductLevelError(we._cid),b=(we,Ie)=>Ft.hasVariantError(we._cid,Ie),w=(we,Ie)=>Ft.getVariantError(we._cid,Ie),B=(we,Ie)=>Ft.hasFieldError(we._cid,Ie),S=(we,Ie,it)=>Ft.hasVariantFieldError(we._cid,Ie,it),V=async we=>{const Ie=we.post_title||H.$t("Untitled product"),it=Array.isArray(we.variants)?we.variants.length:0,kt=Ft.isSaved(we._cid);let Bt=it>0?H.$t('This will remove "%1$s" and its %2$s variant(s).',Ie,it):H.$t('This will remove "%1$s".',Ie);kt&&(Bt+=" "+H.$t("This product was already saved and will be permanently deleted."));try{await Ul.confirm(Bt,H.$t("Remove Product"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),type:"warning"})}catch{return}await Ft.removeProduct(we)},F=(we,Ie)=>{const it=Ie.variation_title||H.$t("Untitled variant");Ul.confirm(H.$t('This will remove the variant "%1$s".',it),H.$t("Remove Variant"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),confirmButtonClass:"el-button--small",cancelButtonClass:"el-button--small",type:"warning"}).then(()=>{Ft.removeVariant(we,Ie)}).catch(()=>{})},$=we=>Ft.duplicateProduct(we),U=(we,Ie)=>Ft.duplicateVariant(we,Ie),D=()=>{const we=[];for(const Ie of a){const it=`p:${Ie._cid}`,kt=Ae.value.has(it),Bt=[];Ie.variants&&Ie.variants.forEach((na,bt)=>{Ae.value.has(`v:${Ie._cid}:${bt}`)&&Bt.push(bt)}),!(!kt&&Bt.length===0)&&(kt&&Bt.length===0?we.push({product:Ie,type:"full"}):!kt&&Bt.length>0?we.push({product:Ie,type:"variants-only",variantIndexes:Bt}):we.push({product:Ie,type:"partial",variantIndexes:Bt}))}return we},T=()=>{const we=D();if(!we.length)return;const Ie=we.filter(bt=>bt.type==="full").length,it=we.filter(bt=>bt.type==="partial").length,Bt=we.filter(bt=>bt.type==="variants-only").reduce((bt,ia)=>bt+ia.variantIndexes.length,0),na=[];Ie>0&&na.push(`${Ie} product(s) with all variants`),it>0&&na.push(`${it} product(s) with selected variants`),Bt>0&&na.push(`${Bt} variant(s)`),Ul.confirm(H.$t("Duplicate %s?").replace("%s",na.join(", ")),H.$t("Bulk Duplicate"),{confirmButtonText:H.$t("Duplicate"),cancelButtonText:H.$t("Cancel"),type:"info"}).then(()=>{for(const bt of we)if(bt.type==="full")Ft.duplicateProduct(bt.product);else if(bt.type==="variants-only")for(const ia of bt.variantIndexes){const ra=bt.product.variants[ia];ra&&Ft.duplicateVariant(bt.product,ra)}else bt.type==="partial"&&Ft.duplicateProductWithVariants(bt.product,bt.variantIndexes);le()}).catch(()=>{})},I=async()=>{const we=[],Ie=[];for(const bt of a){const ia=`p:${bt._cid}`;if(Ae.value.has(ia)){we.push(bt);continue}const Yt=[];bt.variants&&bt.variants.forEach((ka,tl)=>{Ae.value.has(`v:${bt._cid}:${tl}`)&&Yt.push(ka)}),Yt.length>0&&Ie.push({product:bt,variants:Yt})}if(!we.length&&!Ie.length)return;const it=we.filter(bt=>Ft.isSaved(bt._cid)).length,kt=Ie.reduce((bt,ia)=>bt+ia.variants.length,0),Bt=[];we.length>0&&Bt.push(`${we.length} product(s)`),kt>0&&Bt.push(`${kt} variant(s)`);let na=H.$t("Remove %s?").replace("%s",Bt.join(" and "));it>0&&(na+=" "+H.$t("%s already saved will be permanently deleted.").replace("%s",`${it}`));try{await Ul.confirm(na,H.$t("Bulk Remove"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),type:"warning"})}catch{return}for(const bt of we)await Ft.removeProduct(bt);for(const{product:bt,variants:ia}of Ie)for(const ra of ia)Ft.removeVariant(bt,ra);le()},L=we=>{Ft.resetPaymentTypeDefaults(we)},O=(we,Ie)=>{const it=Ft.data.categoryOptions;for(const kt of Ie)it.find(Bt=>Bt.value===kt)||it.push({label:kt,value:kt})},Q=()=>{Ft.populateDummyProduct()},H=aa().ctx,K=we=>{const Ie=Ft.data.products;we.concat||(Ie.splice(0,Ie.length),Ft.data.savedIds=new Set,Ft.data.savingIds=new Set,Ft.data.productErrors=new Map),Ie.push(...we.products)},W=M({visible:!1,field:"",product:null,value:""}),z=(we,Ie)=>{W.value={visible:!0,field:Ie,product:we,value:we[Ie]||""}},Y=we=>{W.value.value=we},Z=()=>{const{product:we,field:Ie,value:it}=W.value;we&&(we[Ie]=it),W.value.visible=!1},re=G(()=>W.value.field==="post_content"?H.$t("Edit Description"):H.$t("Edit Short Description")),q=M(!0),{selectedKeys:Ae,handleRowClick:ie,toggleSelectAll:J,selectAll:N,deselectAll:le,isSelected:ee,selectedCount:pe,isLinkMode:de,toggleLinkMode:Ue}=Gf(),Ce=G(()=>{const we=[];for(const Ie of pt.value)if(we.push(`p:${Ie.productId}`),Ie.hasVariants&&!Ie.collapsed)for(let it=0;it<Ie.product.variants.length;it++)we.push(`v:${Ie.productId}:${it}`);return we}),Se=we=>{var Ie;if(we.startsWith("p:")){const it=we.slice(2),kt=a.find(Bt=>Bt._cid===it);return kt?{type:"product",data:kt,product:kt}:null}else if(we.startsWith("v:")){const it=we.split(":"),kt=it[1],Bt=parseInt(it[2]),na=a.find(bt=>bt._cid===kt);if(na&&((Ie=na.variants)!=null&&Ie[Bt]))return{type:"variant",data:na.variants[Bt],product:na}}return null},ge=(we,Ie,it)=>{!de.value||!ee(it)||jf(we,Ie,it,Ae.value,Se,null,rke)},ke=M(!1),Oe=we=>{we.key==="Shift"&&(ke.value=!0)},Ee=we=>{we.key==="Shift"&&(ke.value=!1)},fe=(we,Ie)=>{if(!Ie.shiftKey||Ie.target.closest(".bulk-checkbox-cell"))return;Ie.preventDefault();const it=new Set(Ae.value);it.has(we)?it.delete(we):it.add(we),Ae.value=it},ye=M([]),De=G(()=>ye.value.filter(we=>we.key==="title"||we.key==="actions"?!0:Ft.isColumnVisible(we.key))),Le=we=>Ft.isColumnVisible(we),At=()=>{Ft.saveColumnWidths(ye.value)},mt=M(new Set),Mt=we=>{const Ie=we._cid;mt.value.has(Ie)?mt.value.delete(Ie):mt.value.add(Ie),mt.value=new Set(mt.value)},Dt=we=>mt.value.has(we._cid),Je=M(0),pt=G(()=>{let we=0;return a.map(Ie=>{var Yt;const it=Ie._cid,kt=((Yt=Ie.detail)==null?void 0:Yt.variation_type)!=="simple"&&Array.isArray(Ie.variants),Bt=kt?Ie.variants.length:0,na=mt.value.has(it),bt=kt&&!na?(Bt+1)*hr:0,ia=hr+bt,ra={product:Ie,productId:it,hasVariants:kt,variantCount:Bt,collapsed:na,groupHeight:ia,offset:we};return we+=ia,ra})}),qt=G(()=>{const we=pt.value;if(we.length===0)return 0;const Ie=we[we.length-1];return Ie.offset+Ie.groupHeight}),Ct=G(()=>{const we=pt.value,Ie=Je.value,it=Ie+CBe,kt=wBe*hr;return we.filter(Bt=>Bt.offset+Bt.groupHeight>=Ie-kt&&Bt.offset<=it+kt)}),$t=G(()=>Ct.value.length===0?0:Ct.value[0].offset),Nt=G(()=>{if(Ct.value.length===0)return 0;const we=Ct.value[Ct.value.length-1];return qt.value-we.offset-we.groupHeight});let Kt=null,Tt=0;const yt=we=>{const Ie=we.target,it=Date.now();Kt&&clearTimeout(Kt),it-Tt>=Hc?(Je.value=Ie.scrollTop,Tt=it):Kt=setTimeout(()=>{Je.value=Ie.scrollTop,Tt=Date.now(),Kt=null},Hc)};let Xt=null;return Te(async()=>{Xt=As(),Xt.bind("mod+a",we=>{var it,kt;const Ie=(it=document.activeElement)==null?void 0:it.tagName;Ie==="INPUT"||Ie==="TEXTAREA"||(kt=document.activeElement)!=null&&kt.isContentEditable||(we.preventDefault(),N(Ce.value))}),Xt.bind("escape",()=>{var Ie,it;const we=(Ie=document.activeElement)==null?void 0:Ie.tagName;we==="INPUT"||we==="TEXTAREA"||(it=document.activeElement)!=null&&it.isContentEditable||(de.value?Ue():le())}),ye.value=[{key:"title",title:H.$t("Title"),width:150,minWidth:100},{key:"sku",title:H.$t("SKU"),width:120,minWidth:80},{key:"media",title:H.$t("Media"),width:100,minWidth:50},{key:"categories",title:H.$t("Categories"),width:200,minWidth:150},{key:"description",title:H.$t("Description"),width:200,minWidth:150},{key:"short_description",title:H.$t("Short Description"),width:150,minWidth:100},{key:"status",title:H.$t("Status"),width:100,minWidth:50},{key:"product_type",title:H.$t("Product Type"),width:200,minWidth:150},{key:"pricing_type",title:H.$t("Pricing Type"),width:200,minWidth:150},{key:"payment_type",title:H.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:H.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:H.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:H.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:H.$t("Compare-at Price"),width:200,minWidth:150},{key:"track_quantity",title:H.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:H.$t("Stock"),width:150,minWidth:150},{key:"actions",title:"",width:110,minWidth:110}],Ft.restoreColumnWidths(ye.value),Ft.setupColumnVisibility(),Ft.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",Oe),window.addEventListener("keyup",Ee)}),Ga(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",Oe),window.removeEventListener("keyup",Ee),Xt&&Xt.reset()}),(we,Ie)=>{const it=C("el-button"),kt=C("el-progress"),Bt=C("el-checkbox"),na=C("el-checkbox-group"),bt=C("el-tooltip"),ia=C("el-popover"),ra=C("el-input"),Yt=C("el-icon"),ka=C("el-option"),tl=C("el-select"),ul=C("el-switch"),al=C("el-dialog");return r(),h("div",uke,[s(Xa,{title:we.$t("Bulk Insert")},{action:u(()=>[s(S2e,{onOnDataPopulated:K}),s(it,{onClick:Q},{default:u(()=>[R(f(we.$t("Add Product")),1)]),_:1}),s(it,{type:"primary",onClick:p,loading:n.value,disabled:n.value||c(a).length===0},{default:u(()=>[R(f(n.value?we.$t("Saving %s/%s...").replace("%s",i.value.completed).replace("%s",i.value.total):we.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),n.value?(r(),E(kt,{key:0,percentage:A.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),s(xe,null,{default:u(()=>{var va;return[c(a).length>0?(r(),E(Ve,{key:0,title:((va=c(a))==null?void 0:va.length)===1?we.$t("Product"):we.$t("Products"),border_bottom:""},{action:u(()=>[o("div",cke,[s(it,{disabled:c(pe)===0,onClick:I,size:"small",type:"danger",soft:""},{default:u(()=>[Ie[8]||(Ie[8]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"3 6 5 6 21 6"}),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+f(we.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),s(it,{disabled:c(pe)===0,onClick:T,size:"small",type:"info",soft:""},{default:u(()=>[Ie[9]||(Ie[9]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+f(we.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),s(it,{class:ue({"is-active":c(de)}),disabled:c(pe)<2&&!c(de),onClick:c(Ue),size:"small",type:"info",soft:""},{default:u(()=>[Ie[10]||(Ie[10]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+f(c(de)?we.$t("Unlink"):we.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),s(Bt,{modelValue:q.value,"onUpdate:modelValue":Ie[0]||(Ie[0]=te=>q.value=te),label:we.$t("Pin Actions")},null,8,["modelValue","label"]),s(ia,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:u(()=>[o("span",null,[s(bt,{effect:"light",content:we.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{tag:"button",size:"small"},{default:u(()=>[s(X,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",Ake,[o("h3",pke,f(we.$t("Columns")),1),s(na,{modelValue:c(Ft).data.visibleColumns,"onUpdate:modelValue":Ie[1]||(Ie[1]=te=>c(Ft).data.visibleColumns=te),class:"fct-checkbox-blocks",onChange:Ie[2]||(Ie[2]=te=>c(Ft).handleColumnVisibilityChange())},{default:u(()=>[(r(!0),h(P,null,ae(c(Ft).getToggleableColumns(),te=>(r(),E(Bt,{key:te.value,value:te.value,label:we.$t(te.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):x("",!0),s(Be,{class:"p-0"},{default:u(()=>[c(a).length>0?(r(),h("div",{key:0,class:ue(["relative",{"is-link-mode":c(de),"is-shift-held":ke.value}])},[s(Nf,{columns:De.value,"sticky-last":q.value,onScroll:yt,onResizeEnd:At},{"header-first":u(()=>[s(Bt,{"model-value":c(pe)>0&&c(pe)===Ce.value.length,indeterminate:c(pe)>0&&c(pe)<Ce.value.length,onChange:Ie[3]||(Ie[3]=te=>c(J)(Ce.value))},null,8,["model-value","indeterminate"])]),"header-last":u(()=>[R(f(we.$t("Actions")),1)]),default:u(()=>[$t.value>0?(r(),h("tr",fke,[o("td",{colspan:De.value.length+1,style:fa({height:$t.value+"px",padding:0,border:"none"})},null,12,mke)])):x("",!0),(r(!0),h(P,null,ae(Ct.value,te=>{var Fe,ne,_e,We,ot,qe,Ze,gt,lt,Vt,me,ve,Ne,Pe,ft;return r(),h(P,{key:te.productId},[o("tr",{class:ue(["bulk-product-row",{"is-saving":m(te.product),"is-saved":_(te.product),"has-product-error":y(te.product),"is-selected":c(ee)(`p:${te.productId}`)}]),onClick:se=>fe(`p:${te.productId}`,se)},[o("td",{class:"bulk-checkbox-cell",onClick:se=>c(ie)(`p:${te.productId}`,se,Ce.value)},[s(Bt,{"model-value":c(ee)(`p:${te.productId}`),tabindex:"-1"},null,8,["model-value"])],8,_ke),o("td",vke,[o("div",gke,[te.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ge(se=>Mt(te.product),["prevent"]),title:Dt(te.product)?we.$t("Expand variants"):we.$t("Collapse variants")},[(r(),h("svg",{class:ue(["bulk-collapse-icon",{"is-collapsed":Dt(te.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},Ie[11]||(Ie[11]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),Dt(te.product)?(r(),h("span",bke,f(te.variantCount),1)):x("",!0)],8,yke)):x("",!0),s(ra,{class:ue(["fct-bulk-input",{"is-error":B(te.product,"post_title")}]),modelValue:te.product.post_title,"onUpdate:modelValue":se=>te.product.post_title=se,placeholder:we.$t("Product title"),size:"small",disabled:g(te.product),onInput:se=>ge("title",se,`p:${te.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),m(te.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:we.$t("Saving...")},[s(Yt,{class:"is-loading",size:14},{default:u(()=>[s(c(on))]),_:1})],8,wke)):_(te.product)?(r(),h("span",{key:2,class:"bulk-status-icon is-saved",title:we.$t("Saved")},Ie[12]||(Ie[12]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[o("path",{d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-.997-6l7.07-7.071-1.414-1.414-5.656 5.657-2.829-2.829-1.414 1.414L11.003 16z"})],-1)]),8,Cke)):k(te.product)||l(te.product)&&y(te.product)?(r(),E(bt,{key:3,content:v(te.product),placement:"top"},{default:u(()=>[o("span",kke,[s(Yt,{size:16},{default:u(()=>[s(c(Lo))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),Le("sku")?(r(),h("td",Bke,[((ne=(Fe=te.product)==null?void 0:Fe.detail)==null?void 0:ne.variation_type)==="simple"&&((_e=te.product.variants)!=null&&_e[0])?(r(),E(ra,{key:0,class:ue(["fct-bulk-input",{"is-error":B(te.product,"variants.0.sku")}]),modelValue:te.product.variants[0].sku,"onUpdate:modelValue":[se=>te.product.variants[0].sku=se,se=>ge("sku",se,`p:${te.productId}`)],placeholder:"SKU",size:"small",disabled:g(te.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",xke,"—"))])):x("",!0),Le("media")?(r(),h("td",Ske,[s(wl,{modelValue:te.product.gallery,"onUpdate:modelValue":se=>te.product.gallery=se,"show-url-tab":"",disabled:g(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),Le("categories")?(r(),h("td",$ke,[s(Kf,{modelValue:te.product.categories,"onUpdate:modelValue":se=>te.product.categories=se,options:c(Ft).data.categoryOptions,disabled:g(te.product),onChange:se=>{O(te.product,se),ge("categories",te.product.categories,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),Le("description")?(r(),h("td",Fke,[s(ri,{value:te.product.post_content,placeholder:we.$t("Description"),onClick:se=>z(te.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),Le("short_description")?(r(),h("td",Eke,[s(ri,{value:te.product.post_excerpt,placeholder:we.$t("Short description"),onClick:se=>z(te.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),Le("status")?(r(),h("td",Uke,[s(tl,{modelValue:te.product.post_status,"onUpdate:modelValue":se=>te.product.post_status=se,size:"small",class:ue({"is-field-error":B(te.product,"post_status")}),disabled:g(te.product),onChange:se=>ge("status",te.product.post_status,`p:${te.productId}`)},{default:u(()=>[(r(!0),h(P,null,ae(c(t).status,se=>(r(),E(ka,{key:se.value,label:we.$t(se.title),value:se.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),Le("product_type")&&((We=te.product)!=null&&We.detail)?(r(),h("td",Ike,[s(tl,{modelValue:te.product.detail.fulfillment_type,"onUpdate:modelValue":se=>te.product.detail.fulfillment_type=se,size:"small",class:ue({"is-field-error":B(te.product,"detail.fulfillment_type")}),disabled:g(te.product),onChange:se=>ge("product_type",te.product.detail.fulfillment_type,`p:${te.productId}`)},{default:u(()=>[(r(!0),h(P,null,ae(c(t).fulfilment,se=>(r(),E(ka,{key:se.value,label:we.$t(se.title),value:se.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Le("product_type")?(r(),h("td",Vke)):x("",!0),Le("pricing_type")&&((ot=te.product)!=null&&ot.detail)?(r(),h("td",Dke,[s(tl,{modelValue:te.product.detail.variation_type,"onUpdate:modelValue":se=>te.product.detail.variation_type=se,size:"small",class:ue({"is-field-error":B(te.product,"detail.variation_type")}),disabled:g(te.product),onChange:se=>{c(Ft).handleVariationChanged(te.product,se),ge("pricing_type",se,`p:${te.productId}`)}},{default:u(()=>[(r(!0),h(P,null,ae(c(t).variation,se=>(r(),E(ka,{key:se.value,label:we.$t(se.title),value:se.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Le("pricing_type")?(r(),h("td",Tke)):x("",!0),Le("payment_type")?(r(),h("td",Qke,[s(si,{variant:l(te.product)?(qe=te.product.variants)==null?void 0:qe[0]:null,disabled:g(te.product),"has-error":B(te.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:se=>{var je;L(se),ge("payment_type",(je=se.other_info)==null?void 0:je.payment_type,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),Le("interval")?(r(),h("td",Mke,[s(ni,{variant:l(te.product)?(Ze=te.product.variants)==null?void 0:Ze[0]:null,disabled:g(te.product),"has-error":B(te.product,"variants.0.other_info.repeat_interval"),onChange:se=>{var je,vt,Me;return ge("interval",(Me=(vt=(je=te.product.variants)==null?void 0:je[0])==null?void 0:vt.other_info)==null?void 0:Me.repeat_interval,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("trial_days")?(r(),h("td",Lke,[s(oi,{variant:l(te.product)?(gt=te.product.variants)==null?void 0:gt[0]:null,disabled:g(te.product),"has-error":B(te.product,"variants.0.other_info.trial_days"),onChange:se=>{var je,vt,Me;return ge("trial_days",(Me=(vt=(je=te.product.variants)==null?void 0:je[0])==null?void 0:vt.other_info)==null?void 0:Me.trial_days,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("best_price")?(r(),h("td",Rke,[s(li,{variant:l(te.product)?(lt=te.product.variants)==null?void 0:lt[0]:null,disabled:g(te.product),"has-error":B(te.product,"variants.0.item_price"),onChange:se=>{var je,vt;return ge("price",(vt=(je=te.product.variants)==null?void 0:je[0])==null?void 0:vt.item_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("compare_price")?(r(),h("td",Oke,[s(ii,{variant:l(te.product)?(Vt=te.product.variants)==null?void 0:Vt[0]:null,disabled:g(te.product),"has-error":B(te.product,"variants.0.compare_price"),onChange:se=>{var je,vt;return ge("compare_price",(vt=(je=te.product.variants)==null?void 0:je[0])==null?void 0:vt.compare_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("track_quantity")?(r(),h("td",Pke,[(me=te.product)!=null&&me.detail?(r(),E(ul,{key:0,modelValue:te.product.detail.manage_stock,"onUpdate:modelValue":se=>te.product.detail.manage_stock=se,"active-value":"1","inactive-value":"0",disabled:g(te.product),onChange:se=>{c(Ft).syncStockStatus(te.product),ge("manage_stock",te.product.detail.manage_stock,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),Le("stock")?(r(),h("td",Hke,[((Ne=(ve=te.product)==null?void 0:ve.detail)==null?void 0:Ne.manage_stock)==="1"&&((ft=(Pe=te.product)==null?void 0:Pe.detail)==null?void 0:ft.variation_type)==="simple"?(r(),E(ra,{key:0,modelValue:te.product.detail.total_stock,"onUpdate:modelValue":[se=>te.product.detail.total_stock=se,se=>{var je;(je=te.product.variants)!=null&&je[0]&&(te.product.variants[0].total_stock=se,te.product.variants[0].available=se),c(Ft).syncStockStatus(te.product),ge("stock",se,`p:${te.productId}`)}],disabled:g(te.product),size:"small",placeholder:we.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",Nke,"—"))])):x("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":q.value}])},[o("div",Kke,[_(te.product)&&te.product.view_url?(r(),h("a",{key:0,href:te.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:we.$t("View Product")},[s(X,{name:"External"})],8,Gke)):x("",!0),s(tt,{tag:"button",size:"x-small",onClick:Ge(se=>$(te.product),["prevent"]),disabled:n.value||g(te.product),title:we.$t("Duplicate")},{default:u(()=>[s(X,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),s(tt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(se=>V(te.product),["prevent"]),disabled:n.value||g(te.product),title:we.$t("Delete")},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,hke),te.hasVariants?(r(),h("tr",zke,[o("td",{colspan:De.value.length+1,class:"!p-0 !border-b-0"},[s(ma,{accordion:"",visible:!te.collapsed,duration:200},{default:u(()=>[o("table",qke,[o("colgroup",null,[Ie[13]||(Ie[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(P,null,ae(De.value,(se,je)=>(r(),h("col",{key:je,style:fa({width:se.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(P,null,ae(te.product.variants,(se,je)=>{var vt,Me;return r(),h("tr",{key:je,class:ue(["bulk-variation-row",{"is-selected":c(ee)(`v:${te.productId}:${je}`)}]),onClick:St=>fe(`v:${te.productId}:${je}`,St)},[o("td",Wke,[s(Bt,{"model-value":c(ee)(`v:${te.productId}:${je}`),tabindex:"-1",onChange:St=>c(ie)(`v:${te.productId}:${je}`,St,Ce.value)},null,8,["model-value","onChange"])]),o("td",Jke,[o("div",Xke,[Ie[14]||(Ie[14]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),s(ra,{size:"small",modelValue:se.variation_title,"onUpdate:modelValue":[St=>se.variation_title=St,St=>ge("title",St,`v:${te.productId}:${je}`)],placeholder:we.$t("Variation title"),disabled:g(te.product),class:ue({"is-error":S(te.product,je,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),b(te.product,je)?(r(),E(bt,{key:0,content:w(te.product,je),placement:"top"},{default:u(()=>[o("span",Zke,[s(Yt,{size:14},{default:u(()=>[s(c(Lo))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),Le("sku")?(r(),h("td",eBe,[s(ra,{size:"small",modelValue:se.sku,"onUpdate:modelValue":[St=>se.sku=St,St=>ge("sku",St,`v:${te.productId}:${je}`)],placeholder:"SKU",disabled:g(te.product),class:ue({"is-error":S(te.product,je,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):x("",!0),Le("media")?(r(),h("td",tBe,[s(wl,{modelValue:se.media,"onUpdate:modelValue":St=>se.media=St,"show-url-tab":"",disabled:g(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),Le("categories")?(r(),h("td",aBe,Ie[15]||(Ie[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Le("description")?(r(),h("td",lBe,Ie[16]||(Ie[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Le("short_description")?(r(),h("td",sBe,Ie[17]||(Ie[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Le("status")?(r(),h("td",nBe,Ie[18]||(Ie[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Le("product_type")?(r(),h("td",oBe,Ie[19]||(Ie[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Le("pricing_type")?(r(),h("td",iBe,Ie[20]||(Ie[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Le("payment_type")?(r(),h("td",rBe,[s(si,{variant:se,disabled:g(te.product),"has-error":S(te.product,je,"other_info.payment_type"),onPaymentTypeChange:St=>{var ll;L(St),ge("payment_type",(ll=St.other_info)==null?void 0:ll.payment_type,`v:${te.productId}:${je}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),Le("interval")?(r(),h("td",dBe,[s(ni,{variant:se,disabled:g(te.product),"has-error":S(te.product,je,"other_info.repeat_interval"),onChange:St=>{var ll;return ge("interval",(ll=se.other_info)==null?void 0:ll.repeat_interval,`v:${te.productId}:${je}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("trial_days")?(r(),h("td",uBe,[s(oi,{variant:se,disabled:g(te.product),"has-error":S(te.product,je,"other_info.trial_days"),onChange:St=>{var ll;return ge("trial_days",(ll=se.other_info)==null?void 0:ll.trial_days,`v:${te.productId}:${je}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("best_price")?(r(),h("td",cBe,[s(li,{variant:se,disabled:g(te.product),"has-error":S(te.product,je,"item_price"),onChange:St=>ge("price",se.item_price,`v:${te.productId}:${je}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("compare_price")?(r(),h("td",ABe,[s(ii,{variant:se,disabled:g(te.product),"has-error":S(te.product,je,"compare_price"),onChange:St=>ge("compare_price",se.compare_price,`v:${te.productId}:${je}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Le("track_quantity")?(r(),h("td",pBe,Ie[21]||(Ie[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Le("stock")?(r(),h("td",fBe,[((Me=(vt=te.product)==null?void 0:vt.detail)==null?void 0:Me.manage_stock)==="1"?(r(),E(ra,{key:0,class:"fc-bulk-input",size:"small",modelValue:se.total_stock,"onUpdate:modelValue":[St=>se.total_stock=St,St=>{se.available=St,c(Ft).syncStockStatus(te.product),ge("stock",St,`v:${te.productId}:${je}`)}],disabled:g(te.product),placeholder:we.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",mBe,"—"))])):x("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":q.value}])},[o("div",hBe,[s(tt,{tag:"button",size:"x-small",onClick:Ge(St=>U(te.product,se),["prevent"]),disabled:n.value||g(te.product),title:we.$t("Duplicate")},{default:u(()=>[s(X,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),s(tt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(St=>F(te.product,se),["prevent"]),disabled:n.value||g(te.product),title:we.$t("Delete")},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Yke)}),128)),o("tr",_Be,[o("td",{colspan:De.value.length+1},[o("div",gBe,[s(it,{size:"small",text:"",type:"primary",onClick:Ge(se=>c(Ft).addVariationToProduct(te.product),["prevent"])},{default:u(()=>[R(" + "+f(we.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,vBe)])])])]),_:2},1032,["visible"])],8,jke)])):x("",!0)],64)}),128)),Nt.value>0?(r(),h("tr",yBe,[o("td",{colspan:De.value.length+1,style:fa({height:Nt.value+"px",padding:0,border:"none"})},null,12,bBe)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("No products yet. Import a CSV or add products manually.")},null,8,["text"]))]),_:1})]}),_:1}),s(al,{modelValue:W.value.visible,"onUpdate:modelValue":Ie[6]||(Ie[6]=va=>W.value.visible=va),title:re.value,width:"700px","close-on-click-modal":!1,onClosed:Ie[7]||(Ie[7]=va=>W.value.product=null)},{footer:u(()=>[s(it,{onClick:Ie[5]||(Ie[5]=va=>W.value.visible=!1)},{default:u(()=>[R(f(we.$t("Cancel")),1)]),_:1}),s(it,{type:"primary",onClick:Z},{default:u(()=>[R(f(we.$t("Save")),1)]),_:1})]),default:u(()=>[W.value.visible&&W.value.field==="post_content"?(r(),E(os,{key:0,"model-value":W.value.value,height:300,onUpdate:Y},null,8,["model-value"])):x("",!0),W.value.visible&&W.value.field==="post_excerpt"?(r(),E(ra,{key:1,modelValue:W.value.value,"onUpdate:modelValue":Ie[4]||(Ie[4]=va=>W.value.value=va),type:"textarea",rows:6,placeholder:we.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}};class BBe extends Hd{beforeInit(){this.data.products=[],this.data.dirty=new Set,this.data.loading=!1,this.data.saving=!1,this.data.pagination={page:1,per_page:5,total:0,hasMore:!1},this.data.saveProgress={total:0,completed:0,errors:[],updatedIds:[]},this.data.savingIds=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map,this.data.advanceFilters=[[]],this.data.filterType="simple",this.data.selectedView="all",this.data.searching=!1,this.data.search="",this.data.duplicatingIds=new Set,this.data.deletingIds=new Set,this.data.categoryOptions=[],this.data.constrainedProductIds="",this.data.constrainedVariantIds="",this.data.savedViews=[],this.data.activeSavedViewId=null,this.data.savedViewQueryParams=null}getTabs(){return{all:d("All"),publish:d("Published"),draft:d("Draft"),physical:d("Physical"),digital:d("Digital")}}getTabsCount(){return Object.values(this.getTabs()).length}getSelectedTab(){return this.data.selectedView}handleTabChanged(t){t!==this.data.selectedView&&(this.data.selectedView=t,this.fetchProducts({},!1))}isSearching(){return this.data.searching!==!1}openSearch(){this.data.searching=!0}closeSearch(){this.data.searching=!1,this.data.search="",this.fetchProducts({},!1)}search(){this.fetchProducts({},!1)}useFullWidthSearch(){return!1}getSearchHint(){return d("Search by Id, product title or variation title")}getSearchGuideOptions(){return null}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}isUsingSimpleFilter(){return this.data.filterType==="simple"}isAdvanceFilterEnabled(){return this.getAdvanceFilterOptions()!==null}getAdvanceFilterOptions(){var t,a,l;return((l=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:l.advance)||null}onFilterTypeChanged(t){t==="advanced"?(this.data.searching=!1,this.data.search=""):this.data.advanceFilters=[[]],this.fetchProducts({},!1)}applyAdvancedFilter(t=!1){this.fetchProducts({},!1)}addAdvanceFilterGroup(){this.data.advanceFilters.push([])}removeAdvanceFilterGroup(t){this.data.advanceFilters.length>1&&this.data.advanceFilters.splice(t,1)}clearAdvanceFilter(){this.data.advanceFilters=[[]],this.fetchProducts({},!1)}getColumnWidthStorageKey(){return"bulk_edit_column_widths"}getColumnStorageKey(){return"bulk_edit_columns"}getToggleableColumns(){return[{label:"Image",value:"image"},{label:"SKU",value:"sku"},{label:"Categories",value:"categories"},{label:"Description",value:"description"},{label:"Short Description",value:"short_description"},{label:"Status",value:"status"},{label:"Product Type",value:"product_type"},{label:"Pricing Type",value:"pricing_type"},{label:"Payment Type",value:"payment_type"},{label:"Interval",value:"interval"},{label:"Trial Days",value:"trial_days"},{label:"Best Price",value:"best_price"},{label:"Compare-at Price",value:"compare_price"},{label:"Track Quantity",value:"track_quantity"},{label:"Stock",value:"stock"}]}getSortableColumns(){return[]}markDirty(t){this._suppressDirty||(this.data.dirty.add(t),this.data.dirty=new Set(this.data.dirty),this.data.savedIds.has(t)&&(this.data.savedIds.delete(t),this.data.savedIds=new Set(this.data.savedIds)),this.data.productErrors.has(t)&&(this.data.productErrors.delete(t),this.data.productErrors=new Map(this.data.productErrors)))}get dirtyCount(){return this.data.dirty.size}getDirtyProducts(){return this.data.products.filter(t=>this.data.dirty.has(t.ID))}chunkArray(t,a){const l=[];for(let n=0;n<t.length;n+=a)l.push(t.slice(n,n+a));return l}async fetchProducts(t={},a=!1,l="",n=""){var i;this.data.loading=!0;try{l&&(this.data.constrainedProductIds=l,this.data.constrainedVariantIds=n);const A=l||this.data.constrainedProductIds,p=n||this.data.constrainedVariantIds,m={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};A&&(m.product_ids=A,m.variant_ids=p),this.data.filterType==="advanced"?(m.advanced_filters=JSON.stringify(this.data.advanceFilters),m.filter_type="advanced"):(this.data.search&&(m.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(m.active_view=this.data.selectedView)),Object.assign(m,t);const _=await ce.get("products/bulk-edit-data",m),g=_.products||[];this._suppressDirty=!0,a?this.data.products.push(...g):(this.data.products=g,this.data.dirty=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map),$e(()=>{this._suppressDirty=!1}),this.data.pagination={page:_.page||m.page,per_page:_.per_page||m.per_page,total:_.total||0,hasMore:_.page*_.per_page<_.total}}catch(A){const p=((i=A==null?void 0:A.data)==null?void 0:i.message)||"Failed to fetch products";j.error(p)}finally{this.data.loading=!1}}isSavingProduct(t){return this.data.savingIds.has(t)}isDirty(t){return this.data.dirty.has(t)}isSaved(t){return this.data.savedIds.has(t)}isRowDisabled(t){return this.isSavingProduct(t)}isDuplicating(t){return this.data.duplicatingIds.has(t)}isDeleting(t){return this.data.deletingIds.has(t)}hasError(t){return this.data.productErrors.has(t)}getError(t){const a=this.data.productErrors.get(t);return a?a.fields&&Object.keys(a.fields).length?Object.values(a.fields).join("; "):a.message||"":""}hasProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?!!a.message:Object.keys(a.fields).some(l=>!l.startsWith("variants.")):!1}getProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?a.message||"":Object.entries(a.fields).filter(([n])=>!n.startsWith("variants.")).map(([,n])=>n).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const n=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(n))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const n=`variants.${a}.`;return Object.entries(l.fields).filter(([A])=>A.startsWith(n)).map(([,A])=>A).join("; ")}hasFieldError(t,a){var n;const l=this.data.productErrors.get(t);return!!((n=l==null?void 0:l.fields)!=null&&n[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}async saveProduct(t){var l,n,i,A;const a=t.ID;if(!this.data.savingIds.has(a)){this.data.savingIds.add(a),this.data.savingIds=new Set(this.data.savingIds);try{const p=await ce.post("products/bulk-update",{products:[t]});if((l=p.updated)!=null&&l.length)this.data.dirty.delete(a),this.data.dirty=new Set(this.data.dirty),this.data.savedIds.add(a),this.data.savedIds=new Set(this.data.savedIds),this.data.productErrors.delete(a),this.data.productErrors=new Map(this.data.productErrors),j.success(d("Product updated successfully"));else if((n=p.errors)!=null&&n.length){const m=p.errors[0];m!=null&&m.fields&&(this.data.productErrors.set(a,m),this.data.productErrors=new Map(this.data.productErrors)),j.error((m==null?void 0:m.message)||"Failed to save product")}}catch(p){const m=((i=p==null?void 0:p.data)==null?void 0:i.message)||"Failed to save product",_=(A=p==null?void 0:p.data)==null?void 0:A.errors;if(_!=null&&_.length){const g=_[0];g!=null&&g.fields&&(this.data.productErrors.set(a,g),this.data.productErrors=new Map(this.data.productErrors))}j.error(m)}finally{this.data.savingIds.delete(a),this.data.savingIds=new Set(this.data.savingIds)}}}async saveProducts(){var l,n;const t=this.getDirtyProducts().filter(i=>!this.data.savedIds.has(i.ID));if(t.length===0){j.info(d("No changes to save"));return}const a=this.chunkArray(t,10);this.data.saving=!0,this.data.saveProgress={total:a.length,completed:0,errors:[],updatedIds:[]};try{for(const p of a){const m=p.map(_=>_.ID);for(const _ of m)this.data.savingIds.add(_);this.data.savingIds=new Set(this.data.savingIds);try{const _=await ce.post("products/bulk-update",{products:p});if(_.updated){this.data.saveProgress.updatedIds.push(..._.updated);for(const g of _.updated)this.data.savedIds.add(g),this.data.dirty.delete(g),this.data.productErrors.delete(g);this.data.savedIds=new Set(this.data.savedIds),this.data.dirty=new Set(this.data.dirty),this.data.productErrors=new Map(this.data.productErrors)}if(_.errors&&_.errors.length){this.data.saveProgress.errors.push(..._.errors);for(const g of _.errors)g.post_id&&g.fields&&this.data.productErrors.set(g.post_id,g);this.data.productErrors=new Map(this.data.productErrors)}}catch(_){const g=((l=_==null?void 0:_.data)==null?void 0:l.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:g});const y=(n=_==null?void 0:_.data)==null?void 0:n.errors;if(y!=null&&y.length){for(const v of y)v.post_id&&v.fields&&this.data.productErrors.set(v.post_id,v);this.data.productErrors=new Map(this.data.productErrors)}}for(const _ of m)this.data.savingIds.delete(_);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{updatedIds:i,errors:A}=this.data.saveProgress;A.length===0?j.success(`${i.length} product(s) updated successfully`):i.length>0?j.info(`${i.length} product(s) updated, ${A.length} error(s)`):j.error(d("All products failed to save"))}finally{this.data.saving=!1}}async duplicateProduct(t){var l;const a=t.ID;if(!(!a||this.data.duplicatingIds.has(a))){this.data.duplicatingIds.add(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const i=(await ce.post(`products/${a}/duplicate`,{})).product_id;if(i){const p=(await ce.get("products/bulk-edit-data",{search:i,per_page:1})).products||[];if(p.length>0){const m=this.data.products.indexOf(t);this.data.products.splice(m+1,0,p[0])}}}catch(n){const i=((l=n==null?void 0:n.data)==null?void 0:l.message)||"Failed to duplicate product";j.error(i)}finally{this.data.duplicatingIds.delete(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}async duplicateProductWithVariants(t,a){var n;const l=t.ID;if(!(!l||this.data.duplicatingIds.has(l))){this.data.duplicatingIds.add(l),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const A=(await ce.post(`products/${l}/duplicate`,{})).product_id;if(!A)return;const m=(await ce.get("products/bulk-edit-data",{search:A,per_page:1})).products||[];if(!m.length)return;const _=m[0],g=t.variants||[],y=new Set;for(const k of g)a.includes(k.id)&&k.serial_index!=null&&y.add(k.serial_index);_.variants&&y.size>0&&(_.variants=_.variants.filter(k=>y.has(k.serial_index)));const v=this.data.products.indexOf(t);this.data.products.splice(v+1,0,_),this.markDirty(_.ID)}catch(i){const A=((n=i==null?void 0:i.data)==null?void 0:n.message)||"Failed to duplicate product";j.error(A)}finally{this.data.duplicatingIds.delete(l),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}duplicateVariant(t,a){const l=JSON.parse(JSON.stringify(a));l.variation_title=l.variation_title?l.variation_title+" (Copy)":"",l.sku="",delete l.id,delete l.post_id;const n=t.variants.indexOf(a);t.variants.splice(n+1,0,l),this.markDirty(t.ID)}async deleteProduct(t){var l;const a=t.ID;if(!(!a||this.data.deletingIds.has(a))){this.data.deletingIds.add(a),this.data.deletingIds=new Set(this.data.deletingIds);try{await ce.delete(`products/${a}`);const n=this.data.products.indexOf(t);n!==-1&&this.data.products.splice(n,1),this.data.dirty.delete(a),this.data.savedIds.delete(a)}catch(n){const i=((l=n==null?void 0:n.data)==null?void 0:l.message)||"Failed to delete product";j.error(i)}finally{this.data.deletingIds.delete(a),this.data.deletingIds=new Set(this.data.deletingIds)}}}removeVariant(t,a){if(t.variants.length<=1)return j.error(d("A product must have at least one variant.")),!1;const l=t.variants.indexOf(a);return l!==-1&&t.variants.splice(l,1),this.markDirty(t.ID),!0}resetPaymentTypeDefaults(t){t.other_info.payment_type==="onetime"&&(t.other_info.installment="no",t.other_info.times="",t.other_info.manage_setup_fee="no",t.other_info.signup_fee="",t.other_info.signup_fee_name="")}flattenCategoryTree(t,a=""){var n;const l=[];for(const i of t){const A=a?`${a} > ${i.label}`:i.label;l.push({label:A,value:A}),(n=i.children)!=null&&n.length&&l.push(...this.flattenCategoryTree(i.children,A))}return l}async fetchCategories(){try{const a=(await ce.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(n=>n.name==="product-categories");l!=null&&l.terms&&(this.data.categoryOptions=this.flattenCategoryTree(l.terms))}catch{}}setupSavedViews(){var a,l;const t=(a=window.fluentCartAdminApp)==null?void 0:a.table_config;this.data.savedViews=((l=t==null?void 0:t.products)==null?void 0:l.saved_views)||[]}getSavedViews(){return this.data.savedViews}getActiveSavedViewId(){return this.data.activeSavedViewId}applySavedView(t){const a=this.data.savedViews.find(l=>l.slug===t);a&&(this.data.activeSavedViewId=t,this.data.savedViewQueryParams=a.query_params)}isViewOwner(t){var a,l;return!t||!t.owner_id?!1:t.owner_id===((l=(a=window.fluentCartAdminApp)==null?void 0:a.me)==null?void 0:l.id)}renameSavedView(t,a){}updateSavedView(t){}deleteSavedView(t){}}const rt=BBe.init(),xBe={class:"fct-bulk-edit-page fct-layout-width"},SBe={class:"fct-table-wrapper"},$Be={class:"fct-card-header-top"},FBe={class:"fct-card-header-left flex-1"},EBe={class:"fct-card-header-actions"},UBe={key:0,class:"fct-advanced-filter-toggle-wrapper"},IBe={key:1,class:"fct-btn-group sm hidden md:flex"},VBe={key:0,class:"filter-search-wrap"},DBe={class:"search-bar"},TBe={class:"text-xs text-system-light pt-2 dark:text-gray-300"},QBe={class:"fct-bulk-edit-table-wrap"},MBe={key:0,class:"px-5 py-3 flex items-center justify-between border border-solid border-x-0 border-gray-divider border-t-0 dark:border-dark-400"},LBe={class:"m-0 text-base"},RBe={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},OBe={class:"fct-btn-group sm justify-end"},PBe={class:"filter-popover-item"},HBe={class:"filter-popover-title"},NBe={class:"fct-bulk-edit-table"},KBe={key:0,"aria-hidden":"true"},GBe=["colspan"],zBe=["onClick"],jBe=["onClick"],qBe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},YBe={class:"flex items-center"},WBe=["onClick","title"],JBe={key:0,class:"bulk-collapse-count"},XBe=["title"],ZBe={class:"bulk-status-icon is-error"},e8e=["disabled","onClick","title"],t8e={key:0,class:"fct-bulk-media-cell"},a8e={key:1,class:"fct-bulk-sku-cell"},l8e={key:1,class:"text-gray-300 text-sm flex justify-center"},s8e={key:2,class:"fct-bulk-categories-cell"},n8e={key:3,class:"fct-bulk-desc-cell"},o8e={key:4,class:"fct-bulk-short-desc-cell"},i8e={key:5,class:"fct-bulk-status-cell"},r8e={key:6,class:"fct-bulk-product-type-cell"},d8e={class:"bulk-readonly-label"},u8e={key:7,class:"fct-bulk-pricing-type-cell"},c8e={class:"bulk-readonly-label"},A8e={key:8,class:"fct-bulk-payment-type-cell"},p8e={key:9,class:"fct-bulk-interval-cell"},f8e={key:10,class:"fct-bulk-trial-days-cell"},m8e={key:11,class:"fct-bulk-best-price-cell"},h8e={key:12,class:"fct-bulk-compare-price-cell"},_8e={key:13,class:"fct-bulk-qty-cell !pl-5"},v8e={key:14,class:"fct-bulk-stock-cell"},g8e={key:1,class:"text-gray-300 text-sm flex justify-center"},y8e={class:"fct-btn-group sm justify-end"},b8e={key:0,class:"bulk-variants-block-row"},w8e=["colspan"],C8e={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},k8e=["onClick"],B8e={class:"bulk-checkbox-cell"},x8e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},S8e={class:"flex items-center gap-1 pl-4"},$8e={class:"bulk-status-icon is-error"},F8e={key:0},E8e={key:1},U8e={key:2},I8e={key:3},V8e={key:4},D8e={key:5},T8e={key:6},Q8e={key:7},M8e={key:8},L8e={key:9},R8e={key:10},O8e={key:11},P8e={key:12},H8e={key:13,class:"text-center"},N8e={key:14},K8e={key:1,class:"text-gray-300 text-sm flex justify-center"},G8e={class:"fct-btn-group sm justify-end"},z8e={key:1,"aria-hidden":"true"},j8e=["colspan"],q8e={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},Y8e={class:"text-system-mid text-sm"},W8e={key:2,class:"flex items-center justify-center py-8"},J8e={class:"text-system-mid text-sm"},X8e={key:1,class:"flex items-center justify-center py-3 border-top"},Z8e={class:"text-system-mid text-sm"},_r=43,e4e=10,Nc=800,Kc=100,t4e=200,a4e={__name:"BulkEdit",setup(e){const t=aa().ctx,a=Pa(),{options:l}=rt.data,n=ne=>{var _e;return((_e=ne==null?void 0:ne.detail)==null?void 0:_e.variation_type)==="simple"},i=G(()=>rt.data.products),A=G(()=>rt.data.loading),p=G(()=>rt.data.saving),m=G(()=>rt.data.saveProgress),_=G(()=>rt.data.pagination),g=G(()=>rt.data.dirty),y=G(()=>g.value.size),v=G(()=>Math.max(0,_.value.total-i.value.length)),k=G(()=>Math.min(_.value.per_page,v.value)),b=G(()=>{const ne=rt.data.saveProgress;return ne.total?Math.round(ne.completed/ne.total*100):0}),w=dd("search-input"),B=()=>{rt.openSearch(),$e(()=>{var ne;(ne=w.value)==null||ne.focus()})},S=(ne=!1)=>{rt.fetchProducts({},ne)},V=()=>{rt.saveProducts()},F=ne=>{rt.markDirty(ne.ID)},$=(ne,_e)=>{rt.resetPaymentTypeDefaults(_e),F(ne)},U=(ne,_e)=>{const We=rt.data.categoryOptions;for(const ot of _e)We.find(qe=>qe.value===ot)||We.push({label:ot,value:ot});F(ne)},D=ne=>rt.isDirty(ne.ID),T=ne=>rt.isSavingProduct(ne.ID),I=ne=>rt.isSaved(ne.ID),L=ne=>rt.isRowDisabled(ne.ID),O=ne=>rt.isDuplicating(ne.ID),Q=ne=>rt.isDeleting(ne.ID),H=ne=>rt.hasError(ne.ID),K=ne=>rt.getError(ne.ID),W=ne=>rt.hasProductLevelError(ne.ID),z=(ne,_e)=>rt.hasVariantError(ne.ID,_e),Y=(ne,_e)=>rt.getVariantError(ne.ID,_e),Z=(ne,_e)=>rt.hasFieldError(ne.ID,_e),re=(ne,_e,We)=>rt.hasVariantFieldError(ne.ID,_e,We),q=ne=>rt.saveProduct(ne),Ae=ne=>rt.duplicateProduct(ne),ie=(ne,_e)=>rt.duplicateVariant(ne,_e),J=M(!0),{selectedKeys:N,handleRowClick:le,toggleSelectAll:ee,selectAll:pe,deselectAll:de,isSelected:Ue,selectedCount:Ce,isLinkMode:Se,toggleLinkMode:ge}=Gf(),ke=G(()=>{const ne=[];for(const _e of Bt.value)if(ne.push(`p:${_e.productId}`),_e.hasVariants&&!_e.collapsed)for(const We of _e.product.variants)ne.push(`v:${We.id}`);return ne}),Oe=ne=>{var _e;if(ne.startsWith("p:")){const We=parseInt(ne.slice(2)),ot=Bt.value.find(qe=>qe.productId===We);return ot?{type:"product",data:ot.product,product:ot.product}:null}else if(ne.startsWith("v:")){const We=parseInt(ne.slice(2));for(const ot of Bt.value){const qe=(_e=ot.product.variants)==null?void 0:_e.find(Ze=>Ze.id===We);if(qe)return{type:"variant",data:qe,product:ot.product}}}return null},Ee=(ne,_e,We)=>{!Se.value||!Ue(We)||jf(ne,_e,We,N.value,Oe,F,dke)},fe=M(!1),ye=ne=>{ne.key==="Shift"&&(fe.value=!0)},De=ne=>{ne.key==="Shift"&&(fe.value=!1)},Le=(ne,_e)=>{if(!_e.shiftKey||_e.target.closest(".bulk-checkbox-cell"))return;_e.preventDefault();const We=new Set(N.value);We.has(ne)?We.delete(ne):We.add(ne),N.value=We},At=()=>{const ne=[];for(const _e of Bt.value){const We=`p:${_e.productId}`,ot=N.value.has(We),qe=[];if(_e.product.variants)for(const Ze of _e.product.variants)N.value.has(`v:${Ze.id}`)&&qe.push(Ze.id);!ot&&qe.length===0||(ot&&qe.length===0?ne.push({product:_e.product,type:"full"}):!ot&&qe.length>0?ne.push({product:_e.product,type:"variants-only",variantIds:qe}):ne.push({product:_e.product,type:"partial",variantIds:qe}))}return ne},mt=async()=>{const ne=At();if(!ne.length)return;const _e=ne.filter(gt=>gt.type==="full").length,We=ne.filter(gt=>gt.type==="partial").length,qe=ne.filter(gt=>gt.type==="variants-only").reduce((gt,lt)=>gt+lt.variantIds.length,0),Ze=[];_e>0&&Ze.push(`${_e} product(s) with all variants`),We>0&&Ze.push(`${We} product(s) with selected variants`),qe>0&&Ze.push(`${qe} variant(s)`);try{await Ul.confirm(t.$t("Duplicate %s?").replace("%s",Ze.join(", ")),t.$t("Bulk Duplicate"),{confirmButtonText:t.$t("Duplicate"),cancelButtonText:t.$t("Cancel"),type:"info"})}catch{return}for(const gt of ne)if(gt.type==="full")await rt.duplicateProduct(gt.product);else if(gt.type==="variants-only")for(const lt of gt.variantIds){const Vt=gt.product.variants.find(me=>me.id===lt);Vt&&rt.duplicateVariant(gt.product,Vt)}else gt.type==="partial"&&await rt.duplicateProductWithVariants(gt.product,gt.variantIds);de()},Mt=async()=>{const ne=[],_e=[];for(const qe of Bt.value){const Ze=`p:${qe.productId}`;if(N.value.has(Ze)){ne.push(qe.product);continue}const lt=[];if(qe.product.variants)for(const Vt of qe.product.variants)N.value.has(`v:${Vt.id}`)&<.push(Vt);lt.length>0&&_e.push({product:qe.product,variants:lt})}if(!ne.length&&!_e.length)return;const We=_e.reduce((qe,Ze)=>qe+Ze.variants.length,0),ot=[];ne.length>0&&ot.push(`${ne.length} product(s)`),We>0&&ot.push(`${We} variant(s)`);try{await Ul.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",ot.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const qe of ne)await rt.deleteProduct(qe);for(const{product:qe,variants:Ze}of _e)for(const gt of Ze)rt.removeVariant(qe,gt);de()},Dt=async ne=>{const _e=ne.ID;if(!_e||rt.isDeleting(_e))return;const We=ne.post_title||t.$t("Untitled product"),ot=Array.isArray(ne.variants)?ne.variants.length:0,qe=ot>0?t.$t('This will permanently delete "%1$s" and its %2$s variant(s).',We,ot):t.$t('This will permanently delete "%1$s".',We);try{await Ul.confirm(qe,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}rt.deleteProduct(ne)},Je=(ne,_e)=>{if(ne.variants.length<=1){rt.removeVariant(ne,_e);return}const We=_e.variation_title||t.$t("Untitled variant");Ul.confirm(t.$t('This will remove the variant "%1$s".',We),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{rt.removeVariant(ne,_e)}).catch(()=>{})},pt=M({visible:!1,field:"",product:null,value:""}),qt=(ne,_e)=>{pt.value={visible:!0,field:_e,product:ne,value:ne[_e]||""}},Ct=ne=>{pt.value.value=ne},$t=()=>{const{product:ne,field:_e,value:We}=pt.value;ne&&(ne[_e]=We,F(ne)),pt.value.visible=!1},Nt=G(()=>pt.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),Kt=M([]),Tt=G(()=>Kt.value.filter(ne=>ne.key==="title"||ne.key==="actions"?!0:rt.isColumnVisible(ne.key))),yt=ne=>rt.isColumnVisible(ne),Xt=()=>{rt.saveColumnWidths(Kt.value)},we=M(new Set),Ie=ne=>{const _e=ne.ID;we.value.has(_e)?we.value.delete(_e):we.value.add(_e),we.value=new Set(we.value)},it=ne=>we.value.has(ne.ID),kt=M(0),Bt=G(()=>{let ne=0;return i.value.map(_e=>{var me;const We=_e.ID,ot=((me=_e.detail)==null?void 0:me.variation_type)!=="simple"&&Array.isArray(_e.variants)&&_e.variants.length>0,qe=ot?_e.variants.length:0,Ze=we.value.has(We),gt=ot&&!Ze?qe*_r:0,lt=_r+gt,Vt={product:_e,productId:We,hasVariants:ot,variantCount:qe,collapsed:Ze,groupHeight:lt,offset:ne};return ne+=lt,Vt})}),na=G(()=>{const ne=Bt.value;if(ne.length===0)return 0;const _e=ne[ne.length-1];return _e.offset+_e.groupHeight}),bt=G(()=>{const ne=Bt.value,_e=kt.value,We=_e+Nc,ot=e4e*_r;return ne.filter(qe=>qe.offset+qe.groupHeight>=_e-ot&&qe.offset<=We+ot)}),ia=G(()=>bt.value.length===0?0:bt.value[0].offset),ra=G(()=>{if(bt.value.length===0)return 0;const ne=bt.value[bt.value.length-1];return na.value-ne.offset-ne.groupHeight});let Yt=null,ka=0;const tl=()=>{if(A.value||!_.value.hasMore||i.value.length===0)return;na.value-(kt.value+Nc)<t4e&&S(!0)},ul=ne=>{const _e=ne.target,We=Date.now();Yt&&clearTimeout(Yt),We-ka>=Kc?(kt.value=_e.scrollTop,ka=We,tl()):Yt=setTimeout(()=>{kt.value=_e.scrollTop,ka=Date.now(),Yt=null,tl()},Kc)},al=ne=>({physical:"Physical",digital:"Digital"})[ne]||ne||"—",va=ne=>({simple:"Simple",simple_variations:"Variable"})[ne]||ne||"—";let te=null;const Fe=()=>{const ne=a.query.product_ids,_e=a.query.variant_ids;ne&&_e?rt.fetchProducts({},!1,ne,_e):S(!1)};return Te(async()=>{te=As(),te.bind("mod+a",ne=>{var We,ot;const _e=(We=document.activeElement)==null?void 0:We.tagName;_e==="INPUT"||_e==="TEXTAREA"||(ot=document.activeElement)!=null&&ot.isContentEditable||(ne.preventDefault(),pe(ke.value))}),te.bind("escape",()=>{var _e,We;const ne=(_e=document.activeElement)==null?void 0:_e.tagName;ne==="INPUT"||ne==="TEXTAREA"||(We=document.activeElement)!=null&&We.isContentEditable||(Se.value?ge():de())}),Kt.value=[{key:"title",title:t.$t("Title"),width:150,minWidth:100},{key:"image",title:t.$t("Image"),width:60,minWidth:50},{key:"sku",title:t.$t("SKU"),width:120,minWidth:80},{key:"categories",title:t.$t("Categories"),width:200,minWidth:150},{key:"description",title:t.$t("Description"),width:200,minWidth:150},{key:"short_description",title:t.$t("Short Description"),width:150,minWidth:100},{key:"status",title:t.$t("Status"),width:100,minWidth:50},{key:"product_type",title:t.$t("Product Type"),width:120,minWidth:80},{key:"pricing_type",title:t.$t("Pricing Type"),width:120,minWidth:80},{key:"payment_type",title:t.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:t.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:t.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:t.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:t.$t("Compare-at Price"),width:150,minWidth:100},{key:"track_quantity",title:t.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:t.$t("Stock"),width:120,minWidth:80},{key:"actions",title:"",width:110,minWidth:110}],rt.restoreColumnWidths(Kt.value),rt.setupColumnVisibility(),rt.setupSavedViews(),rt.fetchCategories(),Fe(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",ye),window.addEventListener("keyup",De)}),Ga(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",ye),window.removeEventListener("keyup",De),te&&te.reset()}),(ne,_e)=>{const We=C("el-button"),ot=C("el-progress"),qe=C("el-switch"),Ze=C("el-tooltip"),gt=C("el-input"),lt=C("el-checkbox"),Vt=C("el-checkbox-group"),me=C("el-popover"),ve=C("el-icon"),Ne=C("el-option"),Pe=C("el-select"),ft=C("el-dialog");return r(),h("div",xBe,[s(Xa,{title:ne.$t("Bulk Edit")},{action:u(()=>[s(We,{type:"primary",onClick:V,loading:p.value,disabled:p.value||y.value===0},{default:u(()=>[R(f(p.value?ne.$t("Saving %s/%s...").replace("%s",m.value.completed).replace("%s",m.value.total):y.value>0?ne.$t("Save Changes")+` (${y.value})`:ne.$t("Save Changes")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),p.value?(r(),E(ot,{key:0,percentage:b.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),o("div",SBe,[s(xe,null,{default:u(()=>[s(Ve,{border_bottom:""},{default:u(()=>[o("div",$Be,[o("div",FBe,[c(rt).getTabsCount()&&!c(rt).isUsingAdvanceFilter()?(r(),E(bm,{key:0,class:ue("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:c(rt)},null,8,["table"])):x("",!0)]),o("div",EBe,[c(rt).isAdvanceFilterEnabled()?(r(),h("div",UBe,[s(qe,{class:"fct-advanced-filter-toggle",onChange:_e[0]||(_e[0]=se=>{c(rt).onFilterTypeChanged(se)}),"active-value":"advanced","inactive-value":"simple",modelValue:c(rt).data.filterType,"onUpdate:modelValue":_e[1]||(_e[1]=se=>c(rt).data.filterType=se),"active-text":ne.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):x("",!0),c(rt).isUsingAdvanceFilter()?x("",!0):(r(),h("div",IBe,[c(rt).isSearching()?x("",!0):(r(),E(Ze,{key:0,effect:"light",content:ne.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{tag:"button",onClick:Ge(B,["prevent"])},{default:u(()=>[s(X,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),s(oA,{table:c(rt)},null,8,["table"]),c(rt).isSearching()&&!c(rt).isUsingAdvanceFilter()?(r(),h("div",VBe,[o("div",DBe,[s(gt,{ref:"search-input",onClear:_e[2]||(_e[2]=()=>{c(rt).search()}),onKeyup:_e[3]||(_e[3]=ea(()=>{c(rt).search()},["enter"])),modelValue:c(rt).data.search,"onUpdate:modelValue":_e[4]||(_e[4]=se=>c(rt).data.search=se),type:"text",placeholder:ne.$t("Search"),clearable:""},{prefix:u(()=>[s(X,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",TBe,f(c(rt).getSearchHint()),1)]),s(We,{text:"",onClick:_e[5]||(_e[5]=()=>{c(rt).closeSearch()})},{default:u(()=>[R(f(ne.$t("Cancel")),1)]),_:1})])):x("",!0)]),_:1}),s(Be,{class:"p-0"},{default:u(()=>[o("div",QBe,[i.value.length>0?(r(),h("div",MBe,[o("h5",LBe,[R(f(i.value.length)+" "+f(i.value.length===1?ne.$t("Product"):ne.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),h("span",RBe,f(ne.$t("of"))+" "+f(_.value.total)+" "+f(ne.$t("total"))+" · "+f(k.value)+" "+f(ne.$t("next")),1)):x("",!0)]),o("div",OBe,[s(We,{disabled:c(Ce)===0,onClick:mt,size:"small"},{default:u(()=>[_e[14]||(_e[14]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+f(ne.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),s(We,{disabled:c(Ce)===0,onClick:Mt,size:"small",type:"danger",plain:""},{default:u(()=>[_e[15]||(_e[15]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"3 6 5 6 21 6"}),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+f(ne.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),s(We,{class:ue({"is-active":c(Se)}),disabled:c(Ce)<2&&!c(Se),onClick:c(ge),size:"small"},{default:u(()=>[_e[16]||(_e[16]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+f(c(Se)?ne.$t("Unlink"):ne.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),s(lt,{modelValue:J.value,"onUpdate:modelValue":_e[6]||(_e[6]=se=>J.value=se),label:ne.$t("Pin Actions")},null,8,["modelValue","label"]),s(me,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:u(()=>[o("span",null,[s(Ze,{effect:"light",content:ne.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[s(tt,{tag:"button",size:"small"},{default:u(()=>[s(X,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",PBe,[o("h3",HBe,f(ne.$t("Columns")),1),s(Vt,{modelValue:c(rt).data.visibleColumns,"onUpdate:modelValue":_e[7]||(_e[7]=se=>c(rt).data.visibleColumns=se),class:"fct-checkbox-blocks",onChange:_e[8]||(_e[8]=se=>c(rt).handleColumnVisibilityChange())},{default:u(()=>[(r(!0),h(P,null,ae(c(rt).getToggleableColumns(),se=>(r(),E(lt,{key:se.value,value:se.value,label:ne.$t(se.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):x("",!0),o("div",NBe,[i.value.length>0?(r(),h("div",{key:0,class:ue(["relative",{"is-link-mode":c(Se),"is-shift-held":fe.value}])},[s(Nf,{columns:Tt.value,"sticky-last":J.value,onScroll:ul,onResizeEnd:Xt},{"header-first":u(()=>[Jt(s(lt,{checked:c(Ce)>0&&c(Ce)===ke.value.length,onChange:_e[9]||(_e[9]=se=>c(ee)(ke.value))},null,8,["checked"]),[[c(ike),c(Ce)>0&&c(Ce)<ke.value.length]])]),"header-last":u(()=>[R(f(ne.$t("Actions")),1)]),default:u(()=>[ia.value>0?(r(),h("tr",KBe,[o("td",{colspan:Tt.value.length+1,style:fa({height:ia.value+"px",padding:0,border:"none"})},null,12,GBe)])):x("",!0),(r(!0),h(P,null,ae(bt.value,se=>{var je,vt,Me,St,ll,oe,he,Qe,He,Ye,ht,st,It,Wt,Ma,Et,oa,ga;return r(),h(P,{key:se.productId},[o("tr",{class:ue(["bulk-product-row",{"is-dirty":D(se.product),"is-saving":T(se.product),"is-saved":I(se.product),"has-product-error":H(se.product),"is-selected":c(Ue)(`p:${se.productId}`)}]),onClick:et=>Le(`p:${se.productId}`,et)},[o("td",{class:"bulk-checkbox-cell",onClick:et=>c(le)(`p:${se.productId}`,et,ke.value)},[s(lt,{"model-value":c(Ue)(`p:${se.productId}`),tabindex:"-1"},null,8,["model-value"])],8,jBe),o("td",qBe,[o("div",YBe,[se.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ge(et=>Ie(se.product),["prevent"]),title:it(se.product)?ne.$t("Expand variants"):ne.$t("Collapse variants")},[(r(),h("svg",{class:ue(["bulk-collapse-icon",{"is-collapsed":it(se.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_e[17]||(_e[17]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),it(se.product)?(r(),h("span",JBe,f(se.variantCount),1)):x("",!0)],8,WBe)):x("",!0),s(gt,{class:ue(["fct-bulk-input",{"is-error":Z(se.product,"post_title")}]),modelValue:se.product.post_title,"onUpdate:modelValue":[et=>se.product.post_title=et,et=>{F(se.product),Ee("title",et,`p:${se.productId}`)}],placeholder:ne.$t("Product title"),disabled:L(se.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),T(se.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:ne.$t("Saving...")},[s(ve,{class:"is-loading",size:14},{default:u(()=>[s(c(on))]),_:1})],8,XBe)):W(se.product)||n(se.product)&&H(se.product)?(r(),E(Ze,{key:2,content:K(se.product),placement:"top"},{default:u(()=>[o("span",ZBe,[s(ve,{size:16},{default:u(()=>[s(c(Lo))]),_:1})])]),_:2},1032,["content"])):D(se.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:L(se.product),onClick:Ge(et=>q(se.product),["prevent"]),title:ne.$t("Save")},_e[18]||(_e[18]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",width:"16",height:"16"},[o("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z",fill:"currentColor"})],-1)]),8,e8e)):x("",!0)])]),yt("image")?(r(),h("td",t8e,[s(wl,{modelValue:se.product.gallery,"onUpdate:modelValue":et=>se.product.gallery=et,onChange:et=>F(se.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),yt("sku")?(r(),h("td",a8e,[((vt=(je=se.product)==null?void 0:je.detail)==null?void 0:vt.variation_type)==="simple"&&((Me=se.product.variants)!=null&&Me[0])?(r(),E(gt,{key:0,class:ue(["fct-bulk-input",{"is-error":Z(se.product,"variants.0.sku")}]),modelValue:se.product.variants[0].sku,"onUpdate:modelValue":[et=>se.product.variants[0].sku=et,et=>{F(se.product),Ee("sku",et,`p:${se.productId}`)}],placeholder:"SKU",size:"small",disabled:L(se.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),h("span",l8e,"—"))])):x("",!0),yt("categories")?(r(),h("td",s8e,[s(Kf,{modelValue:se.product.categories,"onUpdate:modelValue":et=>se.product.categories=et,options:c(rt).data.categoryOptions,disabled:L(se.product),onChange:et=>{U(se.product,et),Ee("categories",se.product.categories,`p:${se.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),yt("description")?(r(),h("td",n8e,[s(ri,{value:se.product.post_content,placeholder:ne.$t("Description"),onClick:et=>qt(se.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),yt("short_description")?(r(),h("td",o8e,[s(ri,{value:se.product.post_excerpt,placeholder:ne.$t("Short description"),onClick:et=>qt(se.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),yt("status")?(r(),h("td",i8e,[s(Pe,{modelValue:se.product.post_status,"onUpdate:modelValue":et=>se.product.post_status=et,size:"small",class:ue({"is-field-error":Z(se.product,"post_status")}),disabled:L(se.product),onChange:et=>{F(se.product),Ee("status",se.product.post_status,`p:${se.productId}`)}},{default:u(()=>[s(Ne,{label:ne.$t("Published"),value:"publish"},null,8,["label"]),s(Ne,{label:ne.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),yt("product_type")?(r(),h("td",r8e,[o("span",d8e,f(al((ll=(St=se.product)==null?void 0:St.detail)==null?void 0:ll.fulfillment_type)),1)])):x("",!0),yt("pricing_type")?(r(),h("td",u8e,[o("span",c8e,f(va((he=(oe=se.product)==null?void 0:oe.detail)==null?void 0:he.variation_type)),1)])):x("",!0),yt("payment_type")?(r(),h("td",A8e,[s(si,{variant:n(se.product)?(Qe=se.product.variants)==null?void 0:Qe[0]:null,disabled:L(se.product),"has-error":Z(se.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:et=>{var da;$(se.product,et),Ee("payment_type",(da=et.other_info)==null?void 0:da.payment_type,`p:${se.productId}`)},onChange:et=>F(se.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),yt("interval")?(r(),h("td",p8e,[s(ni,{variant:n(se.product)?(He=se.product.variants)==null?void 0:He[0]:null,disabled:L(se.product),"has-error":Z(se.product,"variants.0.other_info.repeat_interval"),onChange:et=>{var da,za,Xe;F(se.product),Ee("interval",(Xe=(za=(da=se.product.variants)==null?void 0:da[0])==null?void 0:za.other_info)==null?void 0:Xe.repeat_interval,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("trial_days")?(r(),h("td",f8e,[s(oi,{variant:n(se.product)?(Ye=se.product.variants)==null?void 0:Ye[0]:null,disabled:L(se.product),"has-error":Z(se.product,"variants.0.other_info.trial_days"),onChange:et=>{var da,za,Xe;F(se.product),Ee("trial_days",(Xe=(za=(da=se.product.variants)==null?void 0:da[0])==null?void 0:za.other_info)==null?void 0:Xe.trial_days,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("best_price")?(r(),h("td",m8e,[s(li,{variant:n(se.product)?(ht=se.product.variants)==null?void 0:ht[0]:null,disabled:L(se.product),"has-error":Z(se.product,"variants.0.item_price"),onChange:et=>{var da,za;F(se.product),Ee("price",(za=(da=se.product.variants)==null?void 0:da[0])==null?void 0:za.item_price,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("compare_price")?(r(),h("td",h8e,[s(ii,{variant:n(se.product)?(st=se.product.variants)==null?void 0:st[0]:null,disabled:L(se.product),"has-error":Z(se.product,"variants.0.compare_price"),onChange:et=>{var da,za;F(se.product),Ee("compare_price",(za=(da=se.product.variants)==null?void 0:da[0])==null?void 0:za.compare_price,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("track_quantity")?(r(),h("td",_8e,[(It=se.product)!=null&&It.detail?(r(),E(qe,{key:0,modelValue:se.product.detail.manage_stock,"onUpdate:modelValue":et=>se.product.detail.manage_stock=et,"active-value":1,"inactive-value":0,disabled:L(se.product),onChange:et=>{F(se.product),c(rt).syncStockStatus(se.product),Ee("manage_stock",se.product.detail.manage_stock,`p:${se.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),yt("stock")?(r(),h("td",v8e,[(Ma=(Wt=se.product)==null?void 0:Wt.detail)!=null&&Ma.manage_stock&&((oa=(Et=se.product)==null?void 0:Et.detail)==null?void 0:oa.variation_type)==="simple"&&((ga=se.product.variants)!=null&&ga[0])?(r(),E(gt,{key:0,class:"fct-bulk-input",placeholder:ne.$t("e.g 10"),size:"small",modelValue:se.product.variants[0].available,"onUpdate:modelValue":[et=>se.product.variants[0].available=et,et=>{se.product.variants[0].total_stock=et,F(se.product),c(rt).syncStockStatus(se.product),Ee("stock",et,`p:${se.productId}`)}],disabled:L(se.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",g8e,"—"))])):x("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":J.value}])},[o("div",y8e,[se.product.view_url?(r(),E(tt,{key:0,tag:"a",size:"x-small",href:se.product.view_url,target:"_blank",title:ne.$t("View Product")},{default:u(()=>[s(X,{name:"External"})]),_:2},1032,["href","title"])):x("",!0),s(tt,{tag:"button",size:"x-small",onClick:Ge(et=>Ae(se.product),["prevent"]),disabled:p.value||L(se.product)||O(se.product),title:ne.$t("Duplicate")},{default:u(()=>[O(se.product)?(r(),E(ve,{key:0,class:"is-loading",size:14},{default:u(()=>[s(c(on))]),_:1})):(r(),E(X,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),s(tt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(et=>Dt(se.product),["prevent"]),disabled:p.value||L(se.product)||Q(se.product),title:ne.$t("Delete")},{default:u(()=>[Q(se.product)?(r(),E(ve,{key:0,class:"is-loading",size:14},{default:u(()=>[s(c(on))]),_:1})):(r(),E(X,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,zBe),se.hasVariants?(r(),h("tr",b8e,[o("td",{colspan:Tt.value.length+1,class:"!p-0 !border-b-0"},[s(ma,{accordion:"",visible:!se.collapsed,duration:200},{default:u(()=>[o("table",C8e,[o("colgroup",null,[_e[19]||(_e[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(P,null,ae(Tt.value,(et,da)=>(r(),h("col",{key:da,style:fa({width:et.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(P,null,ae(se.product.variants,(et,da)=>{var za,Xe;return r(),h("tr",{key:et.id||da,class:ue(["bulk-variation-row",{"is-selected":c(Ue)(`v:${et.id}`)}]),onClick:Pt=>Le(`v:${et.id}`,Pt)},[o("td",B8e,[s(lt,{"model-value":c(Ue)(`v:${et.id}`),tabindex:"-1",onChange:Pt=>c(le)(`v:${et.id}`,Pt,ke.value)},null,8,["model-value","onChange"])]),o("td",x8e,[o("div",S8e,[_e[20]||(_e[20]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),s(gt,{size:"small",modelValue:et.variation_title,"onUpdate:modelValue":[Pt=>et.variation_title=Pt,Pt=>{F(se.product),Ee("title",Pt,`v:${et.id}`)}],placeholder:ne.$t("Variation title"),disabled:L(se.product),class:ue({"is-error":re(se.product,da,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),z(se.product,da)?(r(),E(Ze,{key:0,content:Y(se.product,da),placement:"top"},{default:u(()=>[o("span",$8e,[s(ve,{size:14},{default:u(()=>[s(c(Lo))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),yt("image")?(r(),h("td",F8e,[s(wl,{modelValue:et.media,"onUpdate:modelValue":Pt=>et.media=Pt,onChange:Pt=>F(se.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),yt("sku")?(r(),h("td",E8e,[s(gt,{class:ue(["fct-bulk-input",{"is-error":re(se.product,da,"sku")}]),size:"small",modelValue:et.sku,"onUpdate:modelValue":[Pt=>et.sku=Pt,Pt=>{F(se.product),Ee("sku",Pt,`v:${et.id}`)}],placeholder:ne.$t("SKU"),disabled:L(se.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):x("",!0),yt("categories")?(r(),h("td",U8e,_e[21]||(_e[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),yt("description")?(r(),h("td",I8e,_e[22]||(_e[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),yt("short_description")?(r(),h("td",V8e,_e[23]||(_e[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),yt("status")?(r(),h("td",D8e,_e[24]||(_e[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),yt("product_type")?(r(),h("td",T8e,_e[25]||(_e[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),yt("pricing_type")?(r(),h("td",Q8e,_e[26]||(_e[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),yt("payment_type")?(r(),h("td",M8e,[s(si,{variant:et,disabled:L(se.product),"has-error":re(se.product,da,"other_info.payment_type"),onPaymentTypeChange:Pt=>{var ps;$(se.product,Pt),Ee("payment_type",(ps=Pt.other_info)==null?void 0:ps.payment_type,`v:${et.id}`)},onChange:Pt=>F(se.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),yt("interval")?(r(),h("td",L8e,[s(ni,{variant:et,disabled:L(se.product),"has-error":re(se.product,da,"other_info.repeat_interval"),onChange:Pt=>{var ps;F(se.product),Ee("interval",(ps=et.other_info)==null?void 0:ps.repeat_interval,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("trial_days")?(r(),h("td",R8e,[s(oi,{variant:et,disabled:L(se.product),"has-error":re(se.product,da,"other_info.trial_days"),onChange:Pt=>{var ps;F(se.product),Ee("trial_days",(ps=et.other_info)==null?void 0:ps.trial_days,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("best_price")?(r(),h("td",O8e,[s(li,{variant:et,disabled:L(se.product),"has-error":re(se.product,da,"item_price"),onChange:Pt=>{F(se.product),Ee("price",et.item_price,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("compare_price")?(r(),h("td",P8e,[s(ii,{variant:et,disabled:L(se.product),"has-error":re(se.product,da,"compare_price"),onChange:Pt=>{F(se.product),Ee("compare_price",et.compare_price,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),yt("track_quantity")?(r(),h("td",H8e,_e[27]||(_e[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),yt("stock")?(r(),h("td",N8e,[(Xe=(za=se.product)==null?void 0:za.detail)!=null&&Xe.manage_stock?(r(),E(gt,{key:0,class:"fct-bulk-input",placeholder:ne.$t("e.g 10"),size:"small",modelValue:et.available,"onUpdate:modelValue":[Pt=>et.available=Pt,Pt=>{et.total_stock=Pt,F(se.product),c(rt).syncStockStatus(se.product),Ee("stock",Pt,`v:${et.id}`)}],disabled:L(se.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",K8e,"—"))])):x("",!0),o("td",{class:ue(["text-center",{"sticky-col sticky-col-right":J.value}])},[o("div",G8e,[s(tt,{tag:"button",size:"x-small",onClick:Ge(Pt=>ie(se.product,et),["prevent"]),disabled:p.value||L(se.product),title:ne.$t("Duplicate")},{default:u(()=>[s(X,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),s(tt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(Pt=>Je(se.product,et),["prevent"]),disabled:p.value||L(se.product),title:ne.$t("Delete")},{default:u(()=>[s(X,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,k8e)}),128))])])]),_:2},1032,["visible"])],8,w8e)])):x("",!0)],64)}),128)),ra.value>0?(r(),h("tr",z8e,[o("td",{colspan:Tt.value.length+1,style:fa({height:ra.value+"px",padding:0,border:"none"})},null,12,j8e)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):A.value?A.value?(r(),h("div",W8e,[s(ve,{class:"is-loading mr-2"},{default:u(()=>_e[28]||(_e[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",J8e,f(ne.$t("Loading products...")),1)])):x("",!0):(r(),h("div",q8e,[o("p",Y8e,f(ne.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&A.value?(r(),h("div",X8e,[s(ve,{class:"is-loading mr-2"},{default:u(()=>_e[29]||(_e[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",Z8e,f(ne.$t("Loading"))+" "+f(k.value)+" "+f(ne.$t("more...")),1)])):x("",!0)])]),_:1})]),_:1})]),s(ft,{modelValue:pt.value.visible,"onUpdate:modelValue":_e[12]||(_e[12]=se=>pt.value.visible=se),title:Nt.value,width:"700px","close-on-click-modal":!1,onClosed:_e[13]||(_e[13]=se=>pt.value.product=null)},{footer:u(()=>[s(We,{onClick:_e[11]||(_e[11]=se=>pt.value.visible=!1)},{default:u(()=>[R(f(ne.$t("Cancel")),1)]),_:1}),s(We,{type:"primary",onClick:$t},{default:u(()=>[R(f(ne.$t("Save")),1)]),_:1})]),default:u(()=>[pt.value.visible&&pt.value.field==="post_content"?(r(),E(os,{key:0,"model-value":pt.value.value,height:300,onUpdate:Ct},null,8,["model-value"])):x("",!0),pt.value.visible&&pt.value.field==="post_excerpt"?(r(),E(gt,{key:1,modelValue:pt.value.value,"onUpdate:modelValue":_e[10]||(_e[10]=se=>pt.value.value=se),type:"textarea",rows:6,placeholder:ne.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}},qf=Ke.get("payment_routes");for(const e of qf)e.props=!0;const l4e=Ke.get("storage_driver_routes"),Yf=(l4e||[]).filter(e=>e.name!=="s3");for(const e of Yf)e.props=!0;var s4e={dashboard:{name:"dashboard",path:"/",component:c8,meta:{active_menu:"dashboard",title:d("Dashboard")}},orders:{path:"/orders",component:NF,meta:{active_menu:"orders",title:d("Orders")},children:[{name:"orders",path:"",component:Dv,meta:{active_menu:"orders",title:d("Orders"),permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:sT,props:!0,meta:{active_menu:"orders",title:d("View Order"),permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:QT,props:!0,meta:{active_menu:"orders",title:d("Create Order"),permission:"orders/create"}}]},products:{name:"products",path:"/products",component:P7,meta:{active_menu:"products",title:d("Products"),permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:EQ,name:"product_route",meta:{active_menu:"products",title:d("Products"),permission:["products/view","products/edit","integrations/manage"]},props:!0,children:[{name:"product_edit",path:"",props:!0,component:$q,meta:{active_menu:"products",title:d("Product Edit"),permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:Fc,meta:{active_menu:"products",title:d("Integrations"),permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:pc,meta:{active_menu:"products",title:d("Edit Integration"),permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:MY,meta:{active_menu:"products",title:d("Integrations"),permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:hY,meta:{active_menu:"products",title:d("Upgrade Paths"),permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:Fc,meta:{active_menu:"integrations",title:d("Product Integrations"),permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:kBe,meta:{active_menu:"products",title:d("Product Bulk Insert"),permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:a4e,meta:{active_menu:"products",title:d("Product Bulk Edit"),permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:jm,meta:{active_menu:"products",title:d("Attributes"),permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:vX,meta:{active_menu:"products",title:d("Inventory"),permission:"products/view"}},customers:{path:"/customers",component:qg,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:y_,meta:{active_menu:"customers",title:d("Customers"),permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:OU,props:!0,meta:{active_menu:"customers",title:d("View Customer"),permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:Dte,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:Oce,meta:{title:d("Overview"),permission:"reports/view"}},{name:"reports_sales",path:"sales",component:uae,meta:{title:d("Sales"),permission:"reports/view"}},{name:"reports_orders",path:"orders",component:xne,meta:{title:d("Orders"),permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:ole,meta:{title:d("Revenue"),permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:doe,meta:{title:d("Refunds"),permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:tie,meta:{title:d("Subscriptions"),permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:mre,meta:{title:d("Retention"),permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>Zt(()=>import("./chunks/Cohort.js?ver=1.8.0"),[],import.meta.url),meta:{title:d("Cohorts"),permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:yie,meta:{title:d("Future Renewals"),permission:"reports/view"}},{name:"reports_products",path:"products",component:zue,meta:{title:d("Product"),permission:"reports/view"}},{name:"reports_customer",path:"customer",component:Ore,meta:{title:d("Customer"),permission:"reports/view"}},{name:"reports_sources",path:"sources",component:Cde,meta:{title:d("Sources"),permission:"reports/view"}}]},settings:{path:"/settings",component:VE,meta:{active_menu:"settings",title:d("Settings"),permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:JT,meta:{active_menu:"settings",title:d("Settings"),permission:"store/settings"},children:[{name:"store_setup",path:"",component:ts,meta:{title:d("Store Setup")}},{name:"pages_setup",path:"pages_setup",component:ts,meta:{title:d("Pages Setup")}},{name:"single_product_setup",path:"single_product_setup",component:ts,meta:{title:d("Product Page")}},{name:"cart_and_checkout",path:"cart_and_checkout",component:ts,meta:{title:d("Cart & Checkout")}},{name:"subscriptions_setup",path:"subscriptions_setup",component:ts,meta:{title:d("Subscriptions")}},{name:"checkout_fields",path:"checkout_fields",component:_2e,meta:{}},{name:"appearance",path:"appearance",component:ts,meta:{title:d("Appearance")}}]},{name:"compliance",path:"compliance",component:ts,meta:{active_menu:"settings",title:d("Compliance"),permission:"store/settings"}},...Ke.get("addon_settings_routes",[]).map(e=>({component:ts,...e})),{name:"product_reviews",path:"product-reviews",component:v0e,meta:{active_menu:"settings",title:d("Product Reviews"),permission:"reviews/manage"}},{name:"email_notifications",path:"email_notifications",component:NX,meta:{active_menu:"settings",title:d("Notifications"),permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:QAe,meta:{active_menu:"settings",title:d("Mailing Settings"),permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:ts,meta:{active_menu:"settings",title:d("Reminders"),permission:"store/sensitive"}},{name:"email_digest_settings",path:"email_digest_settings",component:KAe,meta:{active_menu:"settings",title:d("Store Digest"),permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:vZ,meta:{active_menu:"settings",title:d("Edit Notification"),permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:OZ,meta:{active_menu:"settings",title:d("Add Notification"),permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:yQ,meta:{active_menu:"settings",title:d("Licensing"),permission:"store/sensitive"}},{name:"payments",path:"payments",component:lE,meta:{active_menu:"settings",title:d("Payment Settings"),permission:"is_super_admin"}},{name:"gateway",component:US,path:"payments",children:qf,props:!0,meta:{active_menu:"settings",title:d("Payment Settings"),permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:Ov,meta:{active_menu:"settings",title:d("Invoice & Packing"),permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:Hv,meta:{active_menu:"settings",title:d("PDF Templates"),permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:ng,meta:{active_menu:"settings",title:d("PDF Templates"),permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:Kg,meta:{active_menu:"settings",title:d("PDF Template Settings"),permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:kg,props:!0,meta:{active_menu:"settings",title:d("Edit PDF Template"),permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:CE,meta:{active_menu:"settings",title:d("Role Settings"),permission:"is_super_admin"}},{name:"addons",path:"addons",component:oAe,meta:{active_menu:"settings",title:d("Features & addon"),permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:Lc,meta:{active_menu:"coupons",title:d("Coupons Settings"),permission:"is_super_admin"}},{name:"storage",path:"storage",component:IZ,meta:{active_menu:"settings",title:d("Storage Providers"),permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:Ic,props:!0,meta:{active_menu:"settings",title:d("S3"),permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:QS,meta:{active_menu:"settings",title:d("Gateway"),permission:"is_super_admin"},props:!0},{name:"drivers",component:Ic,path:"storage",children:Yf,props:!0,meta:{active_menu:"settings",title:d("Storage Settings"),permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:jAe,meta:{active_menu:"settings",title:d("Tax Settings"),permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:sfe,meta:{}},{name:"tax_rates",path:"tax_rates",component:yfe,meta:{}},{name:"eu",path:"eu",component:q_e,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:Mc,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:Mc,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:kx,meta:{active_menu:"integrations",title:d("Integrations"),permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:pc,meta:{active_menu:"integrations",title:d("Global Integrations"),permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:o$,meta:{active_menu:"integrations",title:d("Integrations"),permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:Lc,meta:{active_menu:"coupons",title:d("Coupons"),permission:"coupons/view"}},reviews:{path:"/reviews",component:_ge,meta:{active_menu:"products",title:d("Reviews"),permission:"reviews/manage"},beforeEnter:(e,t,a)=>{const l=Ke.get("modules_settings.reviews");if(!l||l.active!=="yes"){a({name:"dashboard"});return}a()},children:[{name:"reviews",path:"",component:e1e,meta:{active_menu:"products",title:d("Reviews"),permission:"reviews/manage"}},{name:"view_review",path:":review_id(\\d+)/view",component:Abe,props:!0,meta:{active_menu:"products",title:d("View Review"),permission:"reviews/manage"}}]},dynamic_pricing:{name:"dynamic_pricing",path:"/dynamic_pricing",component:ewe,meta:{active_menu:"dynamic_pricing",title:d("Dynamic Pricing"),permission:"dynamic_pricing/view"}},dynamic_pricing_create:{name:"dynamic_pricing_create",path:"/dynamic_pricing/create",component:Iwe,meta:{active_menu:"dynamic_pricing",title:d("New Pricing Rule"),permission:"dynamic_pricing/manage"}},dynamic_pricing_edit:{name:"dynamic_pricing_edit",path:"/dynamic_pricing/:id/edit",component:WCe,meta:{active_menu:"dynamic_pricing",title:d("Edit Pricing Rule"),permission:"dynamic_pricing/manage"}},logs:{name:"logs",path:"/logs",component:See,meta:{active_menu:"logs",title:d("Logs"),permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:jme,meta:{active_menu:"taxes",title:d("Taxes"),permission:"is_super_admin"}},add_or_edit_coupon_route:{name:"add_or_edit_coupon",path:"/coupons/add_or_edit_coupon/:coupon_id?",component:mge,props:!0,meta:{active_menu:"coupons",title:d("Coupons"),permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:PF,name:"onboarding",meta:{active_menu:"dashboard",title:d("Onboarding"),permission:"is_super_admin"}}};const n4e={class:"fct-theme-button-container"},o4e={class:"theme-selected-button"},i4e={__name:"ThemeToggle",setup(e){const t=M(Re.MODE_LIGHT),a=A=>{t.value!==A&&(t.value=A,Re.apply(A))},l=[{value:"light",label:d("Light"),icon:"Sun"},{value:"dark",label:d("Dark"),icon:"Moon"},{value:"system",label:d("System"),icon:"Tools"}];Hs(()=>{const A=document.getElementById("theme-button-container");if(A){const p=A.querySelector(".fct-theme-button-container");p&&p.remove()}t.value=Re.getCurrentTheme(),t.value.toString().startsWith(Re.MODE_SYSTEM)&&(t.value=Re.MODE_SYSTEM)});const n=A=>{$e(()=>{t.value=Re.getCurrentTheme()})},i=A=>{a(A)};return Te(()=>{window.addEventListener(Re.THEME_CHANGE_EVENT,n,!1)}),Ga(()=>{window.removeEventListener(Re.THEME_CHANGE_EVENT,n,!1)}),(A,p)=>{const m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",n4e,[s(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:i},{dropdown:u(()=>[s(_,null,{default:u(()=>[(r(),h(P,null,ae(l,y=>s(m,{key:y.value,command:y.value,class:ue({active:t.value===y.value})},{default:u(()=>[s(X,{name:y.icon},null,8,["name"]),R(" "+f(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:u(()=>[o("div",o4e,[t.value==="light"?(r(),E(X,{key:0,name:"Sun"})):t.value==="dark"?(r(),E(X,{key:1,name:"Moon"})):t.value==="system"?(r(),E(X,{key:2,name:"Tools"})):x("",!0)])]),_:1})])}}};function rs(e){return Array.isArray?Array.isArray(e):Xf(e)==="[object Array]"}function r4e(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function d4e(e){return e==null?"":r4e(e)}function Kl(e){return typeof e=="string"}function Wf(e){return typeof e=="number"}function u4e(e){return e===!0||e===!1||c4e(e)&&Xf(e)=="[object Boolean]"}function Jf(e){return typeof e=="object"}function c4e(e){return Jf(e)&&e!==null}function vl(e){return e!=null}function vr(e){return!e.trim().length}function Xf(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const A4e="Incorrect 'index' type",p4e=e=>`Invalid value for key ${e}`,f4e=e=>`Pattern length exceeds max of ${e}.`,m4e=e=>`Missing ${e} property in key`,h4e=e=>`Property 'weight' in key '${e}' must be a positive integer`,Gc=Object.prototype.hasOwnProperty;class _4e{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let n=Zf(l);this._keys.push(n),this._keyMap[n.id]=n,a+=n.weight}),this._keys.forEach(l=>{l.weight/=a})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Zf(e){let t=null,a=null,l=null,n=1,i=null;if(Kl(e)||rs(e))l=e,t=zc(e),a=td(e);else{if(!Gc.call(e,"name"))throw new Error(m4e("name"));const A=e.name;if(l=A,Gc.call(e,"weight")&&(n=e.weight,n<=0))throw new Error(h4e(A));t=zc(A),a=td(A),i=e.getFn}return{path:t,id:a,weight:n,src:l,getFn:i}}function zc(e){return rs(e)?e:e.split(".")}function td(e){return rs(e)?e.join("."):e}function v4e(e,t){let a=[],l=!1;const n=(i,A,p)=>{if(vl(i))if(!A[p])a.push(i);else{let m=A[p];const _=i[m];if(!vl(_))return;if(p===A.length-1&&(Kl(_)||Wf(_)||u4e(_)))a.push(d4e(_));else if(rs(_)){l=!0;for(let g=0,y=_.length;g<y;g+=1)n(_[g],A,p+1)}else A.length&&n(_,A,p+1)}};return n(e,Kl(t)?t.split("."):t,0),l?a:a[0]}const g4e={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},y4e={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},b4e={location:0,threshold:.6,distance:100},w4e={useExtendedSearch:!1,getFn:v4e,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Ut={...y4e,...g4e,...b4e,...w4e};const C4e=/[^ ]+/g;function k4e(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(n){const i=n.match(C4e).length;if(a.has(i))return a.get(i);const A=1/Math.pow(i,.5*e),p=parseFloat(Math.round(A*l)/l);return a.set(i,p),p},clear(){a.clear()}}}class zd{constructor({getFn:t=Ut.getFn,fieldNormWeight:a=Ut.fieldNormWeight}={}){this.norm=k4e(a,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((a,l)=>{this._keysMap[a.id]=l})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Kl(this.docs[0])?this.docs.forEach((t,a)=>{this._addString(t,a)}):this.docs.forEach((t,a)=>{this._addObject(t,a)}),this.norm.clear())}add(t){const a=this.size();Kl(t)?this._addString(t,a):this._addObject(t,a)}removeAt(t){this.records.splice(t,1);for(let a=t,l=this.size();a<l;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(t,a){return t[this._keysMap[a]]}size(){return this.records.length}_addString(t,a){if(!vl(t)||vr(t))return;let l={v:t,i:a,n:this.norm.get(t)};this.records.push(l)}_addObject(t,a){let l={i:a,$:{}};this.keys.forEach((n,i)=>{let A=n.getFn?n.getFn(t):this.getFn(t,n.path);if(vl(A)){if(rs(A)){let p=[];const m=[{nestedArrIndex:-1,value:A}];for(;m.length;){const{nestedArrIndex:_,value:g}=m.pop();if(vl(g))if(Kl(g)&&!vr(g)){let y={v:g,i:_,n:this.norm.get(g)};p.push(y)}else rs(g)&&g.forEach((y,v)=>{m.push({nestedArrIndex:v,value:y})})}l.$[i]=p}else if(Kl(A)&&!vr(A)){let p={v:A,n:this.norm.get(A)};l.$[i]=p}}}),this.records.push(l)}toJSON(){return{keys:this.keys,records:this.records}}}function em(e,t,{getFn:a=Ut.getFn,fieldNormWeight:l=Ut.fieldNormWeight}={}){const n=new zd({getFn:a,fieldNormWeight:l});return n.setKeys(e.map(Zf)),n.setSources(t),n.create(),n}function B4e(e,{getFn:t=Ut.getFn,fieldNormWeight:a=Ut.fieldNormWeight}={}){const{keys:l,records:n}=e,i=new zd({getFn:t,fieldNormWeight:a});return i.setKeys(l),i.setIndexRecords(n),i}function xo(e,{errors:t=0,currentLocation:a=0,expectedLocation:l=0,distance:n=Ut.distance,ignoreLocation:i=Ut.ignoreLocation}={}){const A=t/e.length;if(i)return A;const p=Math.abs(l-a);return n?A+p/n:p?1:A}function x4e(e=[],t=Ut.minMatchCharLength){let a=[],l=-1,n=-1,i=0;for(let A=e.length;i<A;i+=1){let p=e[i];p&&l===-1?l=i:!p&&l!==-1&&(n=i-1,n-l+1>=t&&a.push([l,n]),l=-1)}return e[i-1]&&i-l>=t&&a.push([l,i-1]),a}const Is=32;function S4e(e,t,a,{location:l=Ut.location,distance:n=Ut.distance,threshold:i=Ut.threshold,findAllMatches:A=Ut.findAllMatches,minMatchCharLength:p=Ut.minMatchCharLength,includeMatches:m=Ut.includeMatches,ignoreLocation:_=Ut.ignoreLocation}={}){if(t.length>Is)throw new Error(f4e(Is));const g=t.length,y=e.length,v=Math.max(0,Math.min(l,y));let k=i,b=v;const w=p>1||m,B=w?Array(y):[];let S;for(;(S=e.indexOf(t,b))>-1;){let T=xo(t,{currentLocation:S,expectedLocation:v,distance:n,ignoreLocation:_});if(k=Math.min(T,k),b=S+g,w){let I=0;for(;I<g;)B[S+I]=1,I+=1}}b=-1;let V=[],F=1,$=g+y;const U=1<<g-1;for(let T=0;T<g;T+=1){let I=0,L=$;for(;I<L;)xo(t,{errors:T,currentLocation:v+L,expectedLocation:v,distance:n,ignoreLocation:_})<=k?I=L:$=L,L=Math.floor(($-I)/2+I);$=L;let O=Math.max(1,v-L+1),Q=A?y:Math.min(v+L,y)+g,H=Array(Q+2);H[Q+1]=(1<<T)-1;for(let W=Q;W>=O;W-=1){let z=W-1,Y=a[e.charAt(z)];if(w&&(B[z]=+!!Y),H[W]=(H[W+1]<<1|1)&Y,T&&(H[W]|=(V[W+1]|V[W])<<1|1|V[W+1]),H[W]&U&&(F=xo(t,{errors:T,currentLocation:z,expectedLocation:v,distance:n,ignoreLocation:_}),F<=k)){if(k=F,b=z,b<=v)break;O=Math.max(1,2*v-b)}}if(xo(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:n,ignoreLocation:_})>k)break;V=H}const D={isMatch:b>=0,score:Math.max(.001,F)};if(w){const T=x4e(B,p);T.length?m&&(D.indices=T):D.isMatch=!1}return D}function $4e(e){let t={};for(let a=0,l=e.length;a<l;a+=1){const n=e.charAt(a);t[n]=(t[n]||0)|1<<l-a-1}return t}const di=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class tm{constructor(t,{location:a=Ut.location,threshold:l=Ut.threshold,distance:n=Ut.distance,includeMatches:i=Ut.includeMatches,findAllMatches:A=Ut.findAllMatches,minMatchCharLength:p=Ut.minMatchCharLength,isCaseSensitive:m=Ut.isCaseSensitive,ignoreDiacritics:_=Ut.ignoreDiacritics,ignoreLocation:g=Ut.ignoreLocation}={}){if(this.options={location:a,threshold:l,distance:n,includeMatches:i,findAllMatches:A,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:_,ignoreLocation:g},t=m?t:t.toLowerCase(),t=_?di(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(k,b)=>{this.chunks.push({pattern:k,alphabet:$4e(k),startIndex:b})},v=this.pattern.length;if(v>Is){let k=0;const b=v%Is,w=v-b;for(;k<w;)y(this.pattern.substr(k,Is),k),k+=Is;if(b){const B=v-Is;y(this.pattern.substr(B),B)}}else y(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:l,includeMatches:n}=this.options;if(t=a?t:t.toLowerCase(),t=l?di(t):t,this.pattern===t){let w={isMatch:!0,score:0};return n&&(w.indices=[[0,t.length-1]]),w}const{location:i,distance:A,threshold:p,findAllMatches:m,minMatchCharLength:_,ignoreLocation:g}=this.options;let y=[],v=0,k=!1;this.chunks.forEach(({pattern:w,alphabet:B,startIndex:S})=>{const{isMatch:V,score:F,indices:$}=S4e(t,w,B,{location:i+S,distance:A,threshold:p,findAllMatches:m,minMatchCharLength:_,includeMatches:n,ignoreLocation:g});V&&(k=!0),v+=F,V&&$&&(y=[...y,...$])});let b={isMatch:k,score:k?v/this.chunks.length:1};return k&&n&&(b.indices=y),b}}class $s{constructor(t){this.pattern=t}static isMultiMatch(t){return jc(t,this.multiRegex)}static isSingleMatch(t){return jc(t,this.singleRegex)}search(){}}function jc(e,t){const a=e.match(t);return a?a[1]:null}class F4e extends $s{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const a=t===this.pattern;return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class E4e extends $s{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const l=t.indexOf(this.pattern)===-1;return{isMatch:l,score:l?0:1,indices:[0,t.length-1]}}}class U4e extends $s{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const a=t.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class I4e extends $s{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const a=!t.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,t.length-1]}}}class V4e extends $s{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const a=t.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class D4e extends $s{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const a=!t.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,t.length-1]}}}class am extends $s{constructor(t,{location:a=Ut.location,threshold:l=Ut.threshold,distance:n=Ut.distance,includeMatches:i=Ut.includeMatches,findAllMatches:A=Ut.findAllMatches,minMatchCharLength:p=Ut.minMatchCharLength,isCaseSensitive:m=Ut.isCaseSensitive,ignoreDiacritics:_=Ut.ignoreDiacritics,ignoreLocation:g=Ut.ignoreLocation}={}){super(t),this._bitapSearch=new tm(t,{location:a,threshold:l,distance:n,includeMatches:i,findAllMatches:A,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:_,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class lm extends $s{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let a=0,l;const n=[],i=this.pattern.length;for(;(l=t.indexOf(this.pattern,a))>-1;)a=l+i,n.push([l,a-1]);const A=!!n.length;return{isMatch:A,score:A?0:1,indices:n}}}const ad=[F4e,lm,U4e,I4e,D4e,V4e,E4e,am],qc=ad.length,T4e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Q4e="|";function M4e(e,t={}){return e.split(Q4e).map(a=>{let l=a.trim().split(T4e).filter(i=>i&&!!i.trim()),n=[];for(let i=0,A=l.length;i<A;i+=1){const p=l[i];let m=!1,_=-1;for(;!m&&++_<qc;){const g=ad[_];let y=g.isMultiMatch(p);y&&(n.push(new g(y,t)),m=!0)}if(!m)for(_=-1;++_<qc;){const g=ad[_];let y=g.isSingleMatch(p);if(y){n.push(new g(y,t));break}}}return n})}const L4e=new Set([am.type,lm.type]);class R4e{constructor(t,{isCaseSensitive:a=Ut.isCaseSensitive,ignoreDiacritics:l=Ut.ignoreDiacritics,includeMatches:n=Ut.includeMatches,minMatchCharLength:i=Ut.minMatchCharLength,ignoreLocation:A=Ut.ignoreLocation,findAllMatches:p=Ut.findAllMatches,location:m=Ut.location,threshold:_=Ut.threshold,distance:g=Ut.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:l,includeMatches:n,minMatchCharLength:i,findAllMatches:p,ignoreLocation:A,location:m,threshold:_,distance:g},t=a?t:t.toLowerCase(),t=l?di(t):t,this.pattern=t,this.query=M4e(this.pattern,this.options)}static condition(t,a){return a.useExtendedSearch}searchIn(t){const a=this.query;if(!a)return{isMatch:!1,score:1};const{includeMatches:l,isCaseSensitive:n,ignoreDiacritics:i}=this.options;t=n?t:t.toLowerCase(),t=i?di(t):t;let A=0,p=[],m=0;for(let _=0,g=a.length;_<g;_+=1){const y=a[_];p.length=0,A=0;for(let v=0,k=y.length;v<k;v+=1){const b=y[v],{isMatch:w,indices:B,score:S}=b.search(t);if(w){if(A+=1,m+=S,l){const V=b.constructor.type;L4e.has(V)?p=[...p,...B]:p.push(B)}}else{m=0,A=0,p.length=0;break}}if(A){let v={isMatch:!0,score:m/A};return l&&(v.indices=p),v}}return{isMatch:!1,score:1}}}const ld=[];function O4e(...e){ld.push(...e)}function sd(e,t){for(let a=0,l=ld.length;a<l;a+=1){let n=ld[a];if(n.condition(e,t))return new n(e,t)}return new tm(e,t)}const ui={AND:"$and",OR:"$or"},nd={PATH:"$path",PATTERN:"$val"},od=e=>!!(e[ui.AND]||e[ui.OR]),P4e=e=>!!e[nd.PATH],H4e=e=>!rs(e)&&Jf(e)&&!od(e),Yc=e=>({[ui.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function sm(e,t,{auto:a=!0}={}){const l=n=>{let i=Object.keys(n);const A=P4e(n);if(!A&&i.length>1&&!od(n))return l(Yc(n));if(H4e(n)){const m=A?n[nd.PATH]:i[0],_=A?n[nd.PATTERN]:n[m];if(!Kl(_))throw new Error(p4e(m));const g={keyId:td(m),pattern:_};return a&&(g.searcher=sd(_,t)),g}let p={children:[],operator:i[0]};return i.forEach(m=>{const _=n[m];rs(_)&&_.forEach(g=>{p.children.push(l(g))})}),p};return od(e)||(e=Yc(e)),l(e)}function N4e(e,{ignoreFieldNorm:t=Ut.ignoreFieldNorm}){e.forEach(a=>{let l=1;a.matches.forEach(({key:n,norm:i,score:A})=>{const p=n?n.weight:null;l*=Math.pow(A===0&&p?Number.EPSILON:A,(p||1)*(t?1:i))}),a.score=l})}function K4e(e,t){const a=e.matches;t.matches=[],vl(a)&&a.forEach(l=>{if(!vl(l.indices)||!l.indices.length)return;const{indices:n,value:i}=l;let A={indices:n,value:i};l.key&&(A.key=l.key.src),l.idx>-1&&(A.refIndex=l.idx),t.matches.push(A)})}function G4e(e,t){t.score=e.score}function z4e(e,t,{includeMatches:a=Ut.includeMatches,includeScore:l=Ut.includeScore}={}){const n=[];return a&&n.push(K4e),l&&n.push(G4e),e.map(i=>{const{idx:A}=i,p={item:t[A],refIndex:A};return n.length&&n.forEach(m=>{m(i,p)}),p})}class vn{constructor(t,a={},l){this.options={...Ut,...a},this.options.useExtendedSearch,this._keyStore=new _4e(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof zd))throw new Error(A4e);this._myIndex=a||em(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){vl(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const a=[];for(let l=0,n=this._docs.length;l<n;l+=1){const i=this._docs[l];t(i,l)&&(this.removeAt(l),l-=1,n-=1,a.push(i))}return a}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:a=-1}={}){const{includeMatches:l,includeScore:n,shouldSort:i,sortFn:A,ignoreFieldNorm:p}=this.options;let m=Kl(t)?Kl(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return N4e(m,{ignoreFieldNorm:p}),i&&m.sort(A),Wf(a)&&a>-1&&(m=m.slice(0,a)),z4e(m,this._docs,{includeMatches:l,includeScore:n})}_searchStringList(t){const a=sd(t,this.options),{records:l}=this._myIndex,n=[];return l.forEach(({v:i,i:A,n:p})=>{if(!vl(i))return;const{isMatch:m,score:_,indices:g}=a.searchIn(i);m&&n.push({item:i,idx:A,matches:[{score:_,value:i,norm:p,indices:g}]})}),n}_searchLogical(t){const a=sm(t,this.options),l=(p,m,_)=>{if(!p.children){const{keyId:y,searcher:v}=p,k=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(m,y),searcher:v});return k&&k.length?[{idx:_,item:m,matches:k}]:[]}const g=[];for(let y=0,v=p.children.length;y<v;y+=1){const k=p.children[y],b=l(k,m,_);if(b.length)g.push(...b);else if(p.operator===ui.AND)return[]}return g},n=this._myIndex.records,i={},A=[];return n.forEach(({$:p,i:m})=>{if(vl(p)){let _=l(a,p,m);_.length&&(i[m]||(i[m]={idx:m,item:p,matches:[]},A.push(i[m])),_.forEach(({matches:g})=>{i[m].matches.push(...g)}))}}),A}_searchObjectList(t){const a=sd(t,this.options),{keys:l,records:n}=this._myIndex,i=[];return n.forEach(({$:A,i:p})=>{if(!vl(A))return;let m=[];l.forEach((_,g)=>{m.push(...this._findMatches({key:_,value:A[g],searcher:a}))}),m.length&&i.push({idx:p,item:A,matches:m})}),i}_findMatches({key:t,value:a,searcher:l}){if(!vl(a))return[];let n=[];if(rs(a))a.forEach(({v:i,i:A,n:p})=>{if(!vl(i))return;const{isMatch:m,score:_,indices:g}=l.searchIn(i);m&&n.push({score:_,key:t,value:i,idx:A,norm:p,indices:g})});else{const{v:i,n:A}=a,{isMatch:p,score:m,indices:_}=l.searchIn(i);p&&n.push({score:m,key:t,value:i,norm:A,indices:_})}return n}}vn.version="7.1.0";vn.createIndex=em;vn.parseIndex=B4e;vn.config=Ut;vn.parseQuery=sm;O4e(R4e);const j4e=(Ke.get("payment_routes")||[]).filter(e=>!e.upcoming).map(e=>{const t=e.meta.admin_title||e.meta.title||e.meta.label||e.name;return{title:t,subtitle:d("Manage %1$s",t),path:"/settings/payments/"+e.path}}),q4e=[{title:d("Dashboard"),path:"/"},{title:d("Orders"),path:"/orders"},{title:d("Create Order"),path:"/orders/add"},{title:d("Customers"),path:"/customers"},{title:d("Products"),path:"/products"},{title:d("Product Inventory"),path:"/products/inventory"},{title:d("Bulk Import Products"),path:"/products/bulk-insert"},{title:d("Integrations"),path:"/integrations"},{title:d("Coupons"),path:"/coupons"},{title:d("Logs"),path:"/logs"},{title:d("Taxes"),path:"/taxes"},{title:d("Reports"),path:"/reports/overview"},{title:d("Sales Report"),path:"/reports/sales"},{title:d("Orders Report"),path:"/reports/orders"},{title:d("Revenue Report"),path:"/reports/revenue"},{title:d("Refunds Report"),path:"/reports/refunds"},{title:d("Subscriptions Report"),path:"/reports/subscriptions"},{title:d("Future Renewals Report"),path:"/reports/subscriptions/future-renewals"},{title:d("Product Report"),path:"/reports/products"},{title:d("Customer Report"),path:"/reports/customer"},{title:d("Traffic Sources Report"),path:"/reports/sources"},...j4e],Y4e=q4e.map(({title:e,subtitle:t,path:a})=>({title:e,...t?{subtitle:t}:{},data:{type:"action",action:({router:l})=>{l.push({path:a})},show_description:!1}})),W4e=[{title:"Theme",title_resolver:()=>{let t=(Re.isDark()?"dark":"light")==="light"?d("Dark"):d("Light");return d("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(Re.isDark()?"dark":"light")==="light"?"dark":"light";Re.apply(t,{fromShortcut:!0})}}}],Wc={"/settings/store-settings":d("Store Setup"),"/settings/store-settings/pages_setup":d("Pages Setup"),"/settings/store-settings/single_product_setup":d("Single Product & Order Setup"),"/settings/store-settings/cart_and_checkout":d("Cart and Checkout"),"/settings/compliance":d("Compliance"),"/settings/store-settings/subscriptions_setup":d("Subscriptions Setup"),"/settings/store-settings/checkout_fields":d("Checkout Fields"),"/settings/store-settings/appearance":d("Appearance"),"/settings/email_notifications":d("Email Notifications"),"/settings/email_mailing_settings":d("Mailing Settings"),"/settings/email_mailing_settings/reminders":d("Reminders"),"/settings/licensing":d("Licensing"),"/settings/payments":d("Payment Settings"),"/settings/invoice-packing":d("Invoice & Packing Slips"),"/settings/pdf-template":d("PDF Templates"),"/settings/roles":d("Role Settings"),"/settings/addons":d("Features & Addons"),"/settings/tax_settings":d("Tax Settings"),"/settings/tax_settings/tax_rates":d("Tax Rates"),"/settings/tax_settings/eu":d("EU VAT Settings"),"/settings/storage":d("Storage Providers"),"/settings/coupons":d("Coupon Settings")};let nm=[];Object.keys(Wc).forEach(e=>{const t=Wc[e];nm.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:d("Go to %1$s",t),show_description:!1}})});const J4e=[],X4e={Menu:Y4e,Actions:W4e,Settings:nm,Shortcuts:J4e},id=[];Object.entries(X4e).forEach(([e,t])=>{t.forEach((a,l)=>{id.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const Z4e=()=>({shouldSort:!0,threshold:.6,keys:[{name:"title",getFn:e=>e.title},{name:"data.description",getFn:e=>e.data.description},{name:"group",weight:2,getFn:e=>e.group}]}),exe={class:"navigable-list-container fct-global-search-result-container"},txe={key:0,class:"no-results fct-global-search-result-not-found"},axe={key:1},lxe=["tabindex","onClick","onKeydown"],sxe={__name:"NavigableList",props:{items:{type:Array,required:!0,default:()=>[]},noResultsText:{type:String,default:d("No results found")},onAction:{type:Function,required:!0}},setup(e,{expose:t}){const a=e,l=M(-1),n=dd("listContainer"),i=M({}),A=(b,w)=>{w&&(i.value[b]=w)},p=b=>{const w=a.items.length;if(w===0)return;const B=w-1;b==="up"?l.value=l.value<=0?B:l.value-1:b==="down"&&(l.value=l.value>=B?0:l.value+1),m()},m=()=>{const b=n.value,w=i.value[l.value];w&&b&&(w.scrollIntoView({behavior:"smooth",block:"nearest"}),$e(()=>{w.focus()}))},_=b=>{l.value=b,g(b)},g=b=>{b>=0&&b<a.items.length&&a.onAction(a.items[b],b)},y=()=>{l.value=-1};return t({focusList:b=>{b=b??a.items.length-1,b>=0&&(l.value=b,$e(()=>{i.value[b]&&i.value[b].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(l.value=0,setTimeout(()=>{g(0)},200)):l.value=-1}}),be(()=>a.items,b=>{y(),b.length>0&&$e(()=>{})},{immediate:!0}),be(l,()=>{}),(b,w)=>(r(),h("div",exe,[e.items.length===0?(r(),h("div",txe,[s(X,{name:"Empty/GlobalSearch"}),R(" "+f(e.noResultsText),1)])):(r(),h("div",axe,[o("ul",{ref_key:"listContainer",ref:n,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(P,null,ae(e.items,(B,S)=>(r(),h("li",{key:S,ref_for:!0,ref:V=>A(S,V),class:ue({selected:S===l.value}),tabindex:S,onClick:V=>_(S),onKeydown:[w[0]||(w[0]=ea(Ge(V=>p("up"),["prevent"]),["arrow-up"])),w[1]||(w[1]=ea(Ge(V=>p("down"),["prevent"]),["arrow-down"])),ea(V=>g(S),["enter"])]},[wa(b.$slots,"default",{item:B,index:S,isSelected:S===l.value},void 0,!0)],42,lxe))),128))],512)]))]))}},rd=nt(sxe,[["__scopeId","data-v-2379fe26"]]),nxe={class:"fct-search-result-label"},oxe={class:"fct-search-result-title"},ixe={key:0,class:"fct-search-result-subtitle"},rxe={key:1,class:"fct-search-result-subtitle"},dxe={class:"action-icon"},uxe={class:"recent-search-title"},cxe={class:"fct-search-result-label"},Axe={class:"fct-search-result-title"},pxe={key:0,class:"fct-search-result-subtitle"},fxe={key:1,class:"fct-search-result-subtitle"},mxe={class:"action-icon"},gr="recent_actions",hxe={__name:"ResultList",props:{query:{type:String,required:!0},searchResults:{type:Array,required:!0,default:()=>[]},onActionPerformed:{type:Function,required:!0},focusInput:{type:Function,required:!0},searchData:{type:Array,required:!0,default:()=>[]}},setup(e,{expose:t}){const a=Oa();aa().ctx;const l=e,n=M(0),i=M({}),A=M(),p=(B,S)=>{const F=B.item.data,$=_(F.type);if($==="link"){let U=_(F.url);_(F.new_tab)?window.open(U,"_blank"):window.location.href=U}else $==="action"&&_(F.action);m(B),l.onActionPerformed()},m=B=>{const S=B.item.id;let V=Qt.get(gr)||[];V=V.filter(F=>F!==S),V.unshift(S),V=V.slice(0,5),Qt.set(gr,V)},_=B=>typeof B=="function"?g(B):B,g=async B=>await B({query:l.query,router:a}),y=()=>{var B;(B=A.value)==null||B.resetSelection()},v=()=>{var B;(B=A.value)==null||B.focusList(0)},k=()=>{var B;(B=A.value)==null||B.performFirstAction()};be(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},n.value=Object.keys(i.value).length-1;let B=i.value;for(const S of Object.keys(B)){const V=B[S];V.item.title_resolver&&(B[S].item.title=await _(V.item.title_resolver))}i.value={...B}});const b=M([]),w=async()=>{const B=Qt.get(gr)||[];let S=dt.whereIn(l.searchData,"id",B),V=[];for(const F of S)typeof F.title_resolver=="function"&&(F.title=await _(F.title_resolver)),V.push({item:F});b.value=V};return Te(()=>{w()}),t({focusList:v,resetSelection:y,performFirstAction:k,fetchRecentActions:w}),(B,S)=>(r(),h(P,null,[e.query||b.value.length<1?(r(),E(rd,{key:0,items:e.searchResults,"on-action":p,"no-results-text":c(d)("No matches found"),ref_key:"navigableList",ref:A},{default:u(({item:V,index:F,isSelected:$})=>{var U,D,T;return[o("span",nxe,[o("span",oxe,f(V.item.title),1),(U=V.item)!=null&&U.subtitle?(r(),h("span",ixe,f(V.item.subtitle),1)):((T=(D=V.item)==null?void 0:D.data)==null?void 0:T.show_description)===!0?(r(),h("span",rxe,f(V.item.data.description),1)):x("",!0)]),o("div",dxe,[s(X,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):x("",!0),!e.query&&b.value.length>0?(r(),h(P,{key:1},[o("span",uxe,f(c(d)("Recent Actions")),1),s(rd,{items:b.value,"on-action":p,"no-results-text":c(d)("No matches found"),ref_key:"navigableList",ref:A},{default:u(({item:V,index:F,isSelected:$})=>{var U,D,T;return[o("span",cxe,[o("span",Axe,f(V.item.title),1),(U=V.item)!=null&&U.subtitle?(r(),h("span",pxe,f(V.item.subtitle),1)):((T=(D=V.item)==null?void 0:D.data)==null?void 0:T.show_description)===!0?(r(),h("span",fxe,f(V.item.data.description),1)):x("",!0)]),o("div",mxe,[s(X,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):x("",!0)],64))}},_xe=nt(hxe,[["__scopeId","data-v-ccb0ebef"]]),vxe={class:"fct-global-search-product-wrap"},gxe={class:"fct-global-search-product-left-info"},yxe={key:0,class:"type"},bxe={key:0,class:"price-and-status"},wxe={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=l=>l.min_price===l.max_price?jt(l.min_price,!0):`${jt(l.min_price,!0)} - ${jt(l.max_price,!0)}`,a=l=>l==="publish"?d("published"):l==="future"?d("scheduled"):l;return(l,n)=>(r(),h("div",vxe,[o("div",gxe,[s(md,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",yxe,[R(f(c(Aa).headline(e.product.detail.variation_type))+" ",1),n[0]||(n[0]=o("br",null,null,-1)),R(" "+f(c(Aa).headline(e.product.detail.fulfillment_type)),1)])):x("",!0)]),e.product.detail?(r(),h("span",bxe,[R(f(t(e.product.detail))+" ",1),(r(),E(Ht,{key:e.product.ID,status:e.product.post_status},{default:u(()=>[R(f(a(e.product.post_status)),1)]),_:1},8,["status"]))])):x("",!0)]))}},Cxe={class:"fct-global-search-order-wrap"},kxe={class:"fct-global-search-order-header"},Bxe={class:"fct-global-search-order-id"},xxe={class:"items"},Sxe={class:"fct-global-search-order-header-meta"},$xe={class:"date"},Fxe=["innerHTML"],Exe={class:"customer-name"},Uxe={class:"fct-global-search-order-status-wrapper"},Ixe=["src","alt"],Vxe={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>dt.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,l)=>{var i;const n=C("el-tag");return r(),h("div",Cxe,[o("div",kxe,[o("div",Bxe,[R(" #"+f(e.order.id)+" ",1),o("span",xxe,f(c(d)("%s Items",e.order.order_items.length)),1)]),o("div",Sxe,[o("span",$xe,[s(Sa,{"date-time":e.order.created_at},null,8,["date-time"])]),l[0]||(l[0]=o("span",{class:"circle"},null,-1)),o("span",{class:"total-price",innerHTML:c(jt)(e.order.total_amount,!0,!1,e.order.currency)},null,8,Fxe),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",Exe,f(((i=e.order.customer)==null?void 0:i.full_name)||c(d)("No Name")),1)])]),o("div",Uxe,[s(Ht,{status:e.order.payment_status,"hide-icon":!0},null,8,["status"]),t(e.order.payment_method)?(r(),h("img",{key:0,src:t(e.order.payment_method),alt:c(Aa).headline(e.order.payment_method)},null,8,Ixe)):(r(),E(n,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:u(()=>[R(f(c(Aa).headline(e.order.payment_method)),1)]),_:1}))])])}}},Dxe={class:"fct-global-search-customer-wrap"},Txe={class:"fct-customer-card"},Qxe={class:"fct-customer-avatar"},Mxe={class:"fct-customer-details"},Lxe={class:"fct-customer-name"},Rxe={class:"fct-customer-id"},Oxe={class:"fct-customer-email"},Pxe={class:"purchase-count"},Hxe={class:"date"},Nxe={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Dxe,[o("div",Txe,[o("div",Qxe,[s(Ts,{url:e.customer.photo,name:e.customer.full_name},null,8,["url","name"])]),o("div",Mxe,[o("div",Lxe,[R(f(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",Rxe,"#"+f(e.customer.id),1)]),o("div",Oxe,[R(f(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),o("span",Pxe,"Purchase: "+f(e.customer.purchase_count),1)])])]),o("span",Hxe,[s(Sa,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},Kxe={class:"fct-global-search-coupon-wrap"},Gxe={class:"amount"},zxe={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Kxe,[o("span",null,f(e.coupon.title),1),o("span",null,f(e.coupon.code),1),o("span",Gxe,f(c(jt)(e.coupon.amount,!0)),1)]))}},jxe={class:"fct-global-remote-result-container"},qxe={class:"fct-global-remote-result-label"},Yxe={class:"text"},Wxe={class:"navigable-content"},Jxe={class:"action-icon"},Xxe={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,n=Oa(),i=M({}),A=M(""),p=M(),m=M({}),_=M([]),g=T=>{y.value=!1,_.value=B.data.tableData,l("onRemoteSearchStateChange",!1)},y=M(!1),v={orders:FA({fetch:!1}),products:hf({fetch:!1}),customers:$A({fetch:!1}),coupons:Lf({fetch:!1})},k=()=>{},b=()=>{var T;(T=p.value)==null||T.focusList(0)},w=()=>{var T;(T=p.value)==null||T.performFirstAction()};Hs(()=>{for(const T of Object.keys(v))v[T].onDataLoaded(g)});let B=null;const S=()=>{B=v[i.value.key],B.data.search=A.value,y.value=!0,B.fetch(),l("onRemoteSearchStateChange",!0)},V=gd.debounce(S,800),F=(T,I)=>{if(_.value=[],B&&(B.data.search=""),i.value=I,m.value={title:I.title,key:I.key},!T){A.value="";return}A.value=T,V()},$=()=>{n.push({name:m.value.key,query:{search:A.value}}),l("close-modal")},U={orders:{name:"view_order",key:"order_id"},products:{name:"product_edit",key:"product_id"},customers:{name:"view_customer",key:"customer_id"},coupons:{name:"edit_coupon",key:"coupon_id"}},D=T=>{i.value.key in U&&(n.push({name:U[i.value.key].name,params:{[U[i.value.key].key]:T.id||T.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:F,focusList:b,resetSelection:k,performFirstAction:w}),(T,I)=>(r(),h("div",jxe,[o("div",qxe,[o("span",Yxe,f(i.value.title),1),m.value.key?(r(),h("span",{key:0,class:"view-all",onClick:$},f(A.value?c(d)('Search "%1$s" in %2$s',A.value,m.value.title):c(d)("See All %s",m.value.title)),1)):x("",!0)]),s(rd,{items:_.value,"on-action":L=>{D(L)},"no-results-text":A.value?c(d)("No matches found for %s",i.value.title):c(d)("Type something to find %s",i.value.title),ref_key:"navigableList",ref:p},{default:u(({item:L,index:O,isSelected:Q})=>[o("div",Wxe,[i.value.key==="products"?(r(),E(wxe,{key:0,product:L},null,8,["product"])):x("",!0),i.value.key==="orders"?(r(),E(Vxe,{key:1,order:L},null,8,["order"])):x("",!0),i.value.key==="customers"?(r(),E(Nxe,{key:2,customer:L},null,8,["customer"])):x("",!0),i.value.key==="coupons"?(r(),E(zxe,{key:3,coupon:L},null,8,["coupon"])):x("",!0)]),o("div",Jxe,[s(X,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},Zxe={class:"fct-global-search-input-wrap"},e3e=["aria-label"],t3e={class:"fct-setting-search-icon"},a3e={class:"fct-global-search-input-container"},l3e={key:0,class:"searched-item"},s3e={class:"fct-global-searching-for"},n3e={class:"fct-global-searching-for-label"},o3e={class:"fct-global-searching-suggestion-list"},i3e=["onClick"],r3e={class:"dialog-footer is-border"},d3e={class:"fct-search-commands"},u3e={class:"command-key"},c3e={class:"command-key"},A3e={class:"label"},p3e={class:"command-key"},f3e={class:"label"},m3e={class:"label"},h3e={__name:"GlobalSearch",setup(e){aa().ctx,Oa();const t=M(!1),a=M(""),l=M({}),n=M(),i=M(""),A=M([d("orders"),d("products"),d("customers"),d("coupons"),d("settings"),d("menus"),d("shortcuts...")]),p=M(0),m=M(!0),_=M(0),g=M(null),y=M(null),v=M(70),k=M(40),b=M(1700),w=()=>{$e(()=>{S()})},B=()=>{var ie,J;D.value?(ie=W.value)==null||ie.resetSelection():(J=F.value)==null||J.resetSelection(),D.value=!1,H.value=!1,V()},S=()=>{var ie;(ie=n.value)==null||ie.focus()},V=()=>{D.value=!1,l.value=[],t.value=!1,a.value="",T.value=null},F=M(),$=ie=>{let J=ie.includes(","),N={},le=[];(J?ie.split(","):[ie]).forEach(de=>{de.includes(":")?U(de,N,le):le.push(de)});let pe=[];return Object.keys(N).forEach(de=>{const Ue=N[de];Ue.length>0?Ue.forEach(Ce=>{Ce.length>0?pe.push({group:"'"+de,title:Ce}):pe.push({group:"'"+de})}):pe.push({group:"'"+de})}),le.forEach(de=>{de.length>0&&pe.push({title:de})}),pe},U=(ie,J,N)=>{if(ie.length===1)return;let le=ie.split(":"),ee=le[0],pe=le[1];ee.length>0?(J.hasOwnProperty(ee)||(J[ee]=[]),pe.length>0&&J[ee].push(pe)):N.push(pe)},D=M(!1),T=M(null),I=M({o:{key:"orders",title:d("Orders")},p:{key:"products",title:d("Products")},c:{key:"customers",title:d("Customers")},d:{key:"coupons",title:d("Coupons")}}),L=ie=>{T.value=ie,D.value=!0,l.value={},$e(()=>{var J,N;(J=W.value)==null||J.fetchData(a.value,ie),(N=n.value)==null||N.focus()})},O=()=>{var ie;l.value=[],T.value=null,a.value="",D.value=!1,(ie=n.value)==null||ie.focus(),H.value=!1},Q=()=>{var ie;(ie=W.value)==null||ie.fetchData(a.value,T.value)},H=M(!1),K=ie=>{H.value=ie,$e(()=>{var J;(J=n.value)==null||J.focus()})},W=M(),z=As(),Y=()=>{if(t.value){S();return}const ie=["o","p","c","d"];z.bind(ie,J=>{J.preventDefault();const N=I.value[J.key];N&&L(N)}),t.value=!0,$e(()=>{var J;(J=F.value)==null||J.fetchRecentActions()}),setTimeout(()=>{z.unbind(ie)},800)};z.bind(["/"],ie=>{!t.value&&Z()||(ie.preventDefault(),Y())});const Z=()=>{const ie=document.activeElement;if(!ie)return!1;const J=ie.tagName;return J==="INPUT"||J==="TEXTAREA"||J==="SELECT"||ie.isContentEditable},re=()=>{if(g.value)return;const ie=()=>{if(n.value&&n.value.length>0)return;const N=A.value[p.value];if(m.value)_.value<N.length?(i.value=N.slice(0,_.value+1),_.value++):(m.value=!1,clearTimeout(y.value),y.value=setTimeout(()=>{y.value=null},b.value));else{if(y.value)return;_.value>0?(_.value--,i.value=N.slice(0,_.value)):(m.value=!0,p.value=(p.value+1)%A.value.length)}},J=()=>{ie();const N=m.value?v.value:y.value?120:k.value;g.value=setTimeout(J,N)};J()},q=M(!1);let Ae;return Te(()=>{re(),Ae=new vn(id,Z4e());const ie=document.getElementById("fct_admin_menu_search");if(ie){const J=ie.querySelector(".fct-global-search-input-wrap");J&&J.remove()}q.value=!!ie,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=Y}),xt(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(ie,J)=>{const N=C("el-input"),le=C("el-dialog");return r(),h(P,null,[q.value?(r(),E(Ai,{key:0,to:"#fct_admin_menu_search"},[o("div",Zxe,[o("button",{onClick:Y,type:"button",class:"fct-setting-search-button","aria-label":c(d)("Search")},[o("span",t3e,[s(X,{name:"Search"})]),J[6]||(J[6]=o("span",{class:"fct-global-search-button-keys"},[o("kbd",{class:"fct-global-search-button-key"},"/")],-1))],8,e3e)])])):x("",!0),s(le,{modelValue:t.value,"onUpdate:modelValue":J[5]||(J[5]=ee=>t.value=ee),onOpened:w,onClosed:B,class:"fct-global-search-container","append-to-body":!0},{header:u(()=>[o("div",a3e,[s(X,{name:"Search",class:"search-icon"}),T.value!=null?(r(),h("div",l3e,[R(f(T.value.title)+" ",1),s(X,{name:"Cross",class:"searched-item-remove",onClick:O})])):x("",!0),s(N,{class:"mousetrap",placeholder:c(d)("Search for %1$s",i.value),autofocus:"",ref_key:"searchRef",ref:n,id:"fct-global-search-input",disabled:H.value,onKeydown:[J[0]||(J[0]=ea(Ge(()=>{var ee,pe;if(D.value){(ee=W.value)==null||ee.focusList();return}(pe=F.value)==null||pe.focusList()},["prevent"]),["arrow-down"])),J[1]||(J[1]=ea(Ge(()=>{var ee,pe;if(D.value){(ee=W.value)==null||ee.performFirstAction();return}(pe=F.value)==null||pe.performFirstAction()},["prevent"]),["enter"])),J[2]||(J[2]=ea(()=>{a.value.length===0&&(T.value=null,D.value=!1)},["backspace"]))],onInput:J[3]||(J[3]=()=>{if(D.value){Q();return}let ee=a.value.includes(","),pe=a.value.includes(":");if(!ee&&!pe)l.value.value=c(Ae).search(a.value);else{const de=$(a.value);l.value.value=c(Ae).search({$or:de})}}),modelValue:a.value,"onUpdate:modelValue":J[4]||(J[4]=ee=>a.value=ee),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:u(()=>[s(ma,{visible:!T.value&&a.value.length===0,accordion:""},{default:u(()=>[o("div",s3e,[o("div",n3e,f(c(d)("Searching for")),1),o("div",o3e,[(r(!0),h(P,null,ae(I.value,ee=>{var pe;return r(),h("div",{key:ee.key,onClick:de=>L(ee),class:ue(["fct-global-searching-suggestion",((pe=T.value)==null?void 0:pe.key)===ee.key?"active":""])},f(ee.title),11,i3e)}),128))])])]),_:1},8,["visible"]),D.value?(r(),E(Xxe,{key:0,ref_key:"remoteResultRef",ref:W,query:a.value,tag:T.value,onCloseModal:V,onOnRemoteSearchStateChange:K},null,8,["query","tag"])):(r(),E(_xe,{key:1,ref_key:"resultListRef",ref:F,query:a.value,"search-results":l.value.value,onActionPerformed:V,focusInput:S,searchData:c(id)},null,8,["query","search-results","searchData"])),o("div",r3e,[o("ul",d3e,[o("li",null,[o("span",u3e,[s(X,{name:"ArrowUp"})]),o("span",c3e,[s(X,{name:"ArrowDown"})]),o("span",A3e,f(c(d)("To navigate")),1)]),o("li",null,[o("span",p3e,[s(X,{name:"Enter"})]),o("span",f3e,f(c(d)("To select")),1)]),o("li",null,[J[7]||(J[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",m3e,f(c(d)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},_3e={class:"fl_app fluent-cart-admin-pages"},v3e=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=M("");Te(()=>{jQuery(".notice:not(.fluent-cart), .error:not(.fluent-cart), #ehp-admin-cb").remove(),t.value=a(),l.value=!!document.getElementById("theme-button-container");const A=document.querySelector(".fct_admin_menu_wrap"),p=()=>{window.scrollY>10?A==null||A.classList.add("scroll-header"):A==null||A.classList.remove("scroll-header")};window.addEventListener("scroll",p)});const a=()=>window.location.href,l=M(!1),n=Pa();be(()=>n.fullPath,()=>{t.value=a()});const i=G(()=>!(n.fullPath.includes("reports")||n.fullPath.includes("settings")));return(A,p)=>{const m=C("router-view");return r(),h("div",null,[s(h3e),i.value?(r(),E(Fa,{key:0})):x("",!0),o("div",_3e,[s(m)]),l.value?(r(),E(Ai,{key:1,to:"#theme-button-container"},[s(i4e)])):x("",!0)])}}});let Jc=!1;function g3e(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:ce.get,$post:ce.post,$put:ce.put,$del:ce.delete,$t:d,$n:To,formatMoney(t,a,l=!1){return!t&&l?"":(t||(t="0.00"),Ke.get("shop.currency_sign")+" "+t)},formatCents(t,a,l=!1){return!t&&l?"":(t?t=(t*100).toFixed(2):t="0.00",a?(t=new Intl.NumberFormat("en-US").format(t),Ke.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,l=!1,n){return _t.formatNumber(t,a,l,n)},formatNumberForOrder(t,a,l=!0,n=!1){return _t.formatForOrder(t,a,l,n)},getAddress(t,a="billing"){let l=[t[a+"_address_1"],t[a+"_address_2"],t[a+"_city"],t[a+"_city"],t[a+"_state"],t[a+"_zip"],t[a+"_country"]];return l=l.filter(n=>!!n).join(", "),l||"no "+a+" address"},getOrderAddress(t,a="billing",l=!1){return Km(t,a,l)},changeTitle(t){jQuery("head title").text(t+" - FluentCart")},handleError(t){if(!t)return;let a="";typeof t=="string"?a=t:t&&t.message?a=t.message:a=t,typeof t=="object"&&(a=this.convertToText(t)),a||(a="Something is wrong!"),this.$notify({type:"error",title:"Error",message:a,dangerouslyUseHTMLString:!0})},convertToText(t){const a=[];if(typeof t=="object"&&t.join===void 0)for(const l in t)a.push(this.convertToText(t[l]));else if(typeof t=="object"&&t.join!==void 0)for(const l in t)a.push(this.convertToText(t[l]));else typeof t=="function"||typeof t=="string"&&a.push(t);return a.join("<br />")},handleSuccess:t=>{j.success(t)},handleMessage:(t,a="info",l=40,n=1e3)=>{nA.show(t,a,l,n)},Storage:()=>Qt,buildFormRendererValue(t,a){let l={};return Object.keys(t).forEach(n=>{let i=t[n];["grid"].includes(i.type??"")?l[n]=this.buildFormRendererValue(i.schema??{},a[n]??{}):l[n]=a[n]??""}),l},registerCopyAction(){Jc||(Jc=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&ns.copy(t.target.textContent)}))},currencySign(){return Ke.get("shop.currency_sign")},getPlaceholderImage(){return pl.productPlaceholder()},saveLocal(t,a){Qt.set(t,a)},getLocal(t){return Qt.get(t)},hasPermission(t){return zl.hasPermission(t)}}}}function y3e(e){e.beforeEach((t,a,l)=>{const n=dt.get(t,"meta.permission");return n?zl.resolve({permission:n,permissionType:dt.get(t,"meta.permissionType")})?l():l({name:"unauthorized"}):(Ke.get("app_config.env"),l())})}function b3e(e){const t=A=>A.replace(/\/+$/,"")||"/",a=(A,p)=>{let m=null,_=0;return A.each(function(){const g=jQuery(this).find("a").first().attr("href")||"",y=g.indexOf("#");if(y===-1)return;const v=t(g.slice(y+1));(p===v||p.startsWith(v+"/"))&&v.length>_&&(m=jQuery(this),_=v.length)}),m},l=(A,p)=>{jQuery(".fct_menu li").removeClass("active_admin_menu"),jQuery(".fct_menu li.fct_menu_item_"+p).addClass("active_admin_menu");const m=a(jQuery(".fct_menu li.fct_menu_child_item"),A);m&&(m.addClass("active_admin_menu"),m.closest("li.fct_menu_item").addClass("active_admin_menu")),jQuery(".fct_admin_settings_btn").toggleClass("active_admin_menu",p==="settings")},n=(A,p)=>{const m=jQuery(".fct-offcanvas-menu-item");m.removeClass("active");const _=a(m,A);_?_.addClass("active"):p&&m.filter(".fct-offcanvas-menu-item_"+p).addClass("active")},i=(A,p)=>{const m=jQuery("#toplevel_page_fluent-cart .wp-submenu li");m.removeClass("current");const _=a(m,A);_?_.addClass("current"):p&&m.filter(".fluent_cart_"+p).addClass("current")};e.afterEach((A,p)=>{const m=A.meta.active_menu,_=t(A.path);l(_,m),n(_,m),i(_,m),A.meta.title&&jQuery("head title").text(A.meta.title+" - FluentCart")})}const w3e={mounted(e,t){const a=t.value,l=1e3,n=0,i=performance.now(),A=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(n+m*(a-n)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(A)};A()},updated(e,t){const a=t.value,l=2e3,n=0,i=performance.now(),A=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(n+m*(a-n)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(A)};A()}},C3e={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,f(c(d)("You are not allowed")),1))}},k3e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",s4e);let Xc=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Xc||Ul.alert(d("Your session has expired due to inactivity. Please refresh the page to continue."),d("Session Expired"),{confirmButtonText:d("Reload"),callback:t=>{Xc=!1,window.location.reload()}})});const B3e=[xm,Sm,$m,iA,Fm,cd,Em,Um,Ad,Im,Vm,dA],Xl=vm(v3e);Xl.config.globalProperties.appVars=Ke.get();Xl.provide("appVars",Ke.get());Xl.mixin(g3e());Xl.directive("loading",Ym);Xl.directive("animate",w3e);hh(Xl);const jd=gm({routes:[...Object.values(k3e),{path:"/unauthorized",name:"unauthorized",component:C3e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:hi,props:!0}],history:ym(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});Xl.use(jd);y3e(jd);b3e(jd);B3e.forEach(e=>{Xl.component(e.name,e)});const qd=Ke.get("el_strings"),om=Ke.get("datei18");qd.el.datepicker.weeks=om.weekdaysShort;qd.el.datepicker.months=om.monthsShort;Xl.use(Wm,{locale:qd});Xl.mount("#fluent_cart_plugin_app");if(Ke.get("has_data_migrations")){let e=0;const t=()=>{ce.post("data-backfills/run").then(a=>{a&&a.status==="running"&&++e<100&&t()}).catch(()=>{})};t()}export{Yn as E,Id as _,OT as n,mf as r,wSe as s}; |
| 301 |
|