PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.2
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.2
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / assets / app.js

app.js in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.2, at assets/app.js

301 lines 1.7 MB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var Ff=Object.defineProperty;var $f=(e,t,a)=>t in e?Ff(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Re=(e,t,a)=>$f(e,typeof t!="symbol"?t+"":t,a);import{r as C,c as E,o as r,w as d,a as n,u as A,b as B,d as o,e as h,f as R,t as m,F as H,g as ae,h as M,i as Ie,j as xt,k as Yt,l as N,m as ba,n as de,p as oa,q as Ne,s as Un,T as Wl,v as be,x as ke,y as ai,z as xa,A as _l,B as El,C as Ef,D as ya,E as Bl,G as ua,H as Uf,I as Fs,J as Js,K as vl,L as li,M as If,N as Uc,V as Ic,O as Is,P as Qf,Q as si,R as qt,S as Ma,U as Dl,W as Df,X as Vf,Y as Tf,Z as Qc,_ as Mf,$ as Lf,a0 as Rf,a1 as Xr,a2 as Of}from"./chunks/vue.esm-bundler.js?ver=1.6.2";import{u as ll,a as sl,o as Dc,c as Hf,b as Pf}from"./chunks/vue-router.js?ver=1.6.2";import{_ as J,a as Jt}from"./chunks/DynamicIcon.js?ver=1.6.2";import{t as u,a as ta,A as Ge,_ as bl,p as Fo}from"./chunks/Translator.js?ver=1.6.2";import{T as Qs,_ as Ds,a as Zr,F as $o,b as Xa,P as on,B as ma,c as Vc,m as Tc,d as Mc,e as Nf}from"./chunks/Badge.js?ver=1.6.2";import{_ as wt,P as nl}from"./chunks/Empty.js?ver=1.6.2";import{a as Rn,E as xl,m as Kf,b as dl,d as Lc,i as al,c as Gf,s as Rc,e as Eo,f as ed,g as Oc,p as Td,r as Hc,w as jf,h as ni,l as zf,j as Xs,k as qf,n as Yf,o as Uo,t as Wf,q as Jf,u as Xf,v as Zf,x as em,y as tm,z as am,A as lm}from"./chunks/index.js?ver=1.6.2";import{u as Pc,_ as Nc,a as td,b as Ia,c as Kc,d as Gc,L as ad,e as oi,O as jc,f as ii,P as ld,C as Zl}from"./chunks/OrderCustomerInformation.js?ver=1.6.2";import{_ as Rt,p as In}from"./chunks/UserCan.js?ver=1.6.2";import{C as pt}from"./chunks/CurrencyFormatter.js?ver=1.6.2";import{_ as Na,a as sd,b as nd,c as sm,S as zc,d as qc,A as Yc,e as Wc}from"./chunks/Activity.js?ver=1.6.2";import{_ as Ba,C as Qe,a as Ce,b as Be}from"./chunks/CardBody.js?ver=1.6.2";import{_ as lt}from"./chunks/_plugin-vue_export-helper.js?ver=1.6.2";import{c as nm,S as Qt,u as om,h as tn,a as cr,g as Jc,f as im,b as $s,$ as rl,d as rm}from"./chunks/common.js?ver=1.6.2";import{I as Ze}from"./chunks/IconButton.js?ver=1.6.2";import{M as Za}from"./chunks/Model.js?ver=1.6.2";import{R as ue}from"./chunks/Rest.js?ver=1.6.2";import{d as et,g as dm}from"./chunks/dayjs.min.js?ver=1.6.2";import{n as z}from"./chunks/Notify.js?ver=1.6.2";import{_ as va}from"./chunks/Animation.js?ver=1.6.2";import{_ as es,T as De,m as Pa,a as Nl,i as aa,r as um,L as Ar,b as Xc,d as Zc,c as eA}from"./chunks/dateShortCuts.js?ver=1.6.2";import{S as Qa,_ as Da,u as _s,a as cm,b as Am,c as pm}from"./chunks/countries.js?ver=1.6.2";import{u as vs,L as fa,_ as ri}from"./chunks/NotFound.js?ver=1.6.2";import{c as Ul,a as gl,b as qa,e as Qn,i as od,U as id,p as fm}from"./chunks/Utils.js?ver=1.6.2";import{A as ms}from"./chunks/Asset.js?ver=1.6.2";import{E as mm}from"./chunks/index2.js?ver=1.6.2";import{S as ca}from"./chunks/Str.js?ver=1.6.2";import{A as it}from"./chunks/Arr.js?ver=1.6.2";import{C as ys,V as an,_ as ra,c as Dn,a as bo,b as hm,d as _m}from"./chunks/AttrGroups.js?ver=1.6.2";import{U as ln}from"./chunks/Url.js?ver=1.6.2";import{p as vm,E as Ls,v as gm,i as ym}from"./chunks/DynamicTemplateParser.js?ver=1.6.2";import{u as di,t as tA}from"./chunks/timezone.js?ver=1.6.2";import{_ as rn,P as aA}from"./chunks/ProductVariationSelector.js?ver=1.6.2";import{f as Gt,a as bm,p as wm,b as Cm,g as km,c as Bm,d as xm}from"./chunks/productService.js?ver=1.6.2";import{B as Io}from"./chunks/BundleProducts.js?ver=1.6.2";import{E as Md}from"./chunks/index3.js?ver=1.6.2";import{T as Ld}from"./chunks/TransitionAccordion.js?ver=1.6.2";import{_ as lA}from"./chunks/FileUploaderDialog.js?ver=1.6.2";import Sm from"./chunks/Screenshot.js?ver=1.6.2";import{u as Fm}from"./chunks/useElementPlusComponents.js?ver=1.6.2";import"./chunks/AddressComponent2.js?ver=1.6.2";import"./chunks/index4.js?ver=1.6.2";class $m extends Qs{getTabs(){return{}}getToggleableColumns(){return[{label:u("Lifetime Value (LTV)"),value:"ltv"},{label:u("Customer Since"),value:"customer_since"},{label:u("Last Purchase Date"),value:"last_purchase_date"}]}getSearchHint(){return u("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}}function sA(e){return $m.init(e)}const Em={class:"table-cell"},Um={class:"fct-product-info-card w-full"},Im={class:"fct-product-info-media"},Qm={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},Dm={class:"fct-product-info-name flex flex-col items-start gap-3"},Vm={class:"table-cell"},Tm={class:"table-cell"},Mm={class:"table-cell"},Lm={class:"table-cell"},Rm={class:"table-cell"},Om={__name:"CustomersLoader",props:{nextPageCount:{type:Number,default:0},customerTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-table-column"),p=C("el-table"),f=C("el-skeleton");return r(),E(f,{animated:""},{template:d(()=>[n(p,{data:A(a),class:"w-full compact-table responsive"},{default:d(()=>[n(c,{label:l.$t("Customer"),width:"340"},{default:d(()=>[o("div",Em,[o("div",Um,[o("div",Im,[n(i,{variant:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",Qm,[o("div",Dm,[n(i,{variant:"p",class:"max-w-[190px]"}),n(i,{variant:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),n(c,{label:l.$t("Address"),width:"340"},{default:d(()=>[o("div",Vm,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{label:l.$t("Purchases"),width:"102"},{default:d(()=>[o("div",Tm,[n(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("ltv")?(r(),E(c,{key:0,label:l.$t("LTV"),width:"113"},{default:d(()=>[o("div",Mm,[n(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])):B("",!0),e.customerTable.isColumnVisible("last_purchase_date")?(r(),E(c,{key:1,label:l.$t("Last Purchase Date"),width:"226"},{default:d(()=>[o("div",Lm,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.customerTable.isColumnVisible("customer_since")?(r(),E(c,{key:2,label:l.$t("Customer Since"),width:"170"},{default:d(()=>[o("div",Rm,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]),_:1})}}},Hm={key:0,class:"fct-customer-card"},Pm={class:"fct-customer-avatar"},Nm=["src"],Km={class:"fct-customer-details"},Gm={class:"fct-customer-name"},jm={class:"fct-customer-id"},zm={class:"fct-customer-email"},qm=["innerHTML"],Ym={key:1},Wm={__name:"CustomersTable",props:{table:{type:Object,required:!0}},emits:["selectionChange"],setup(e,{emit:t}){const a=t,l=s=>{a("selectionChange",s)};return(s,i)=>{const c=C("el-table-column"),p=C("el-table");return r(),E(p,{data:e.table.getTableData(),class:"w-full compact-table",onSelectionChange:l},{empty:d(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No customer found!")},null,8,["text"])]),default:d(()=>[n(c,{type:"selection",width:"45"}),n(c,{label:A(u)("Customer"),width:"300"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>{var g,y,v,b,k;return[(g=f.row)!=null&&g.id?(r(),h("div",Hm,[o("div",Pm,[o("span",null,[o("img",{src:(y=f.row)==null?void 0:y.photo,alt:"avatar"},null,8,Nm)])]),o("div",Km,[o("div",Gm,[R(m(((v=f.row)==null?void 0:v.full_name)||A(u)("No Name"))+" ",1),o("span",jm,"#"+m(A(ta)((b=f.row)==null?void 0:b.id)),1)]),o("div",zm,m((k=f.row)==null?void 0:k.email),1)])])):B("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),n(c,{label:A(u)("Address"),width:"300"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[R(m(s.getOrderAddress(f.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),n(c,{label:A(u)("Purchases"),width:90},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[R(m(A(ta)(f.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),E(c,{key:0,label:A(u)("LTV"),width:100},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[o("span",{innerHTML:A(pt).formatNumber(f.row.ltv,!0,!1)},null,8,qm)]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),E(c,{key:1,label:A(u)("Last Purchase Date"),width:"200"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[f.row.last_purchase_date?(r(),E(Na,{key:0,"date-time":f.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",Ym,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0),e.table.isColumnVisible("customer_since")?(r(),E(c,{key:2,label:A(u)("Customer Since"),width:"150"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[n(Na,{"date-time":f.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},Jm={class:"fct-customer-table-mobile-wrap"},Xm=["onClick"],Zm={class:"fct-customer-table-mobile-header"},eh={key:0,class:"fct-customer-table-customer-col fct-customer-card"},th={class:"fct-customer-avatar"},ah=["src"],lh={class:"fct-customer-details"},sh={class:"fct-customer-name"},nh={class:"fct-customer-id"},oh={class:"fct-customer-email"},ih={class:"fct-customer-table-purchases-col"},rh={class:"fct-customer-table-mobile-body"},dh={class:"fct-customer-table-mobile-body-list"},uh={key:0,class:"fct-customer-table-ltv-col"},ch={class:"label"},Ah=["innerHTML"],ph={key:1,class:"fct-customer-table-last-purchase-date-col"},fh={class:"label"},mh={class:"value"},hh={key:2,class:"fct-customer-table-customer-since-col"},_h={class:"label"},vh={class:"value"},gh={class:"fct-customer-table-mobile-footer"},yh={class:"fct-customer-table-address-col"},bh={key:0,class:"py-6 text-center"},wh={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",Jm,[(r(!0),h(H,null,ae(e.table.getTableData(),(l,s)=>(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",Zm,[l!=null&&l.id?(r(),h("div",eh,[o("div",th,[o("img",{src:l==null?void 0:l.photo,alt:"avatar"},null,8,ah)]),o("div",lh,[o("div",sh,[R(m((l==null?void 0:l.full_name)||A(u)("No Name"))+" ",1),o("span",nh,"#"+m(l==null?void 0:l.id),1)]),o("div",oh,m(l==null?void 0:l.email),1)])])):B("",!0),o("div",ih,m(l.purchase_count)+" "+m(l.purchase_count>1?A(u)("Purchases"):A(u)("Purchase")),1)]),o("div",rh,[o("ul",dh,[e.table.isColumnVisible("ltv")?(r(),h("li",uh,[o("div",ch,m(A(u)("LTV:")),1),o("div",{class:"value",innerHTML:A(pt).formatNumber(l.ltv,!0,!1)},null,8,Ah)])):B("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",ph,[o("div",fh,m(A(u)("Last Purchase Date:")),1),o("div",mh,[n(Na,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):B("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",hh,[o("div",_h,m(A(u)("Customer Since:")),1),o("div",vh,[n(Na,{"date-time":l.created_at},null,8,["date-time"])])])):B("",!0)])]),o("div",gh,[o("div",yh,[n(J,{name:"LocationPin"}),R(" "+m(t.getOrderAddress(l)),1)])])],8,Xm))),128)),e.table.getTableData().length===0?(r(),h("div",bh,[n(wt,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):B("",!0)]))}},Ch={},kh={class:"px-4 py-3"},Bh={class:"flex items-center justify-between mb-3"},xh={class:"flex items-center justify-between mb-3"},Sh={class:"flex items-center justify-between mb-3"},Fh={class:"flex items-center justify-between mb-3"};function $h(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",kh,[o("div",Bh,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",xh,[n(a,{varient:"p",class:"w-[50px]"}),n(a,{varient:"p",class:"w-[80px]"})]),o("div",Sh,[n(a,{varient:"p",class:"w-[120px]"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",Fh,[n(a,{varient:"p",class:"w-[100px]"}),n(a,{varient:"p",class:"w-[100px]"})]),n(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const Eh=lt(Ch,[["render",$h]]),Uh={class:"fct-all-customers-page fct-layout-width"},Ih={class:"fct-all-customers-wrap"},Qh={key:1},Dh={__name:"AllCustomers",setup(e){const t=sA(),a=M({showModal:!1,action:"create",title:u("Create New Customer"),customer:{}}),l=M(!1),s=M(!1),i=M([]),c=(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=Pc({entity:"customers",buildParams:()=>c(),buildAllParams:()=>c(!1),filenamePrefix:"customers-export"}),f=({scope:y,columns:v,modules:b,format:k})=>{let w=[];y==="current_page"?w=t.getTableData().map(S=>S.id).filter(Boolean):y==="selected"&&(w=i.value.map(S=>S.id).filter(Boolean)),p.startExport({scope:y,ids:w,columns:v,modules:b,format:k})},_=y=>{i.value=y},g=()=>{l.value=window.innerWidth<768};return Ie(()=>{g(),window.addEventListener("resize",g)}),xt(()=>{window.removeEventListener("resize",g)}),(y,v)=>{const b=C("el-icon"),k=C("el-button"),w=C("el-dropdown-item"),S=C("el-dropdown-menu"),$=C("el-dropdown");return r(),h("div",Uh,[n(nl,{title:A(u)("Customers")},{action:d(()=>[n(Rt,{permission:"customers/export"},{default:d(()=>[n($,{trigger:"click","popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:d(()=>[n(S,null,{default:d(()=>[n(w,{onClick:v[0]||(v[0]=V=>s.value=!0)},{default:d(()=>[n(J,{name:"Download"}),R(" "+m(A(u)("Export Customers")),1)]),_:1})]),_:1})]),default:d(()=>[n(k,null,{default:d(()=>[R(m(A(u)("More actions"))+" ",1),n(b,null,{default:d(()=>[n(A(Rn))]),_:1})]),_:1})]),_:1})]),_:1}),n(Rt,{permission:"customers/manage"},{default:d(()=>[n(k,{type:"primary",onClick:v[1]||(v[1]=V=>a.value.showModal=!0)},{default:d(()=>[R(m(A(u)("Add Customer")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Rt,{permission:"customers/view"},{default:d(()=>[o("div",Ih,[n(Ds,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(Eh,{key:0})):B("",!0),n(wh,{table:A(t)},null,8,["table"])]),default:d(()=>[A(t).isLoading()?(r(),E(Om,{key:0,customerTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",Qh,[n(Wm,{table:A(t),onSelectionChange:_},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),n(Rt,{permission:"customers/manage"},{default:d(()=>[n(td,{"onUpdate:customerModal":v[2]||(v[2]=()=>{a.value.showModal=!1,a.value.customer={},A(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}),n(Nc,{modelValue:s.value,"onUpdate:modelValue":v[4]||(v[4]=V=>s.value=V),title:A(u)("Export Customers"),"selected-count":i.value.length,"current-page-count":A(t).getTableData().length,"total-count":A(t).data.paginate.total,"item-label-singular":A(u)("customer"),"item-label-plural":A(u)("customers"),"has-active-filter":!!A(t).isFiltering(),"export-state":A(p),onExport:f},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}};class Vh extends Qs{getTabs(){return{all:u("All"),completed:u("Completed"),processing:u("Processing"),"on-hold":u("On Hold"),paid:u("Paid"),subscription:u("Subscription"),renewal:u("Renewal"),refunded:u("Refunded"),partially_refunded:u("Partially Refunded"),upgraded_from:{title:u("Upgraded From"),description:u("Orders upgraded from another order")},upgraded_to:{title:u("Upgraded To"),description:u("Orders upgraded to another order")}}}getToggleableColumns(){return[{label:u("Customer"),value:"customer"},{label:u("Items"),value:"order_items"},{label:u("Order Status"),value:"status"},{label:u("Order Type"),value:"type"},{label:u("Actions"),value:"actions"}]}getSearchHint(){return u("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 nA(e){return Vh.init(e)}const Th={class:"fct-order-stats-card"},Mh={class:"fct-order-stats-card-head"},Lh={class:"fct-order-stats-card-head-content"},Rh={class:"text"},Oh={key:0,class:"value"},Hh={class:"fct-order-stats-card-body"},Ph={key:0,class:"change-wrap"},Nh={key:0,class:"change-title"},Kh={key:1,class:"change-title"},Gh={key:1,class:"change-wrap"},jh={class:"change-title"},zh={__name:"StatCard",props:{direction:String,stat:Object,statRanges:Object,currentRange:String|Number,statKey:String|Number,loading:Boolean},setup(e){const t=Yt().ctx,a=e,l=N(()=>{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"}}),s=N(()=>c.value===0?"":c.value>0?"success":"danger"),i=f=>f.is_cents?t.formatNumber(f.current_count):ta(f.current_count),c=N(()=>{let f=nm(a.stat.current_count,a.stat.compare_count)??0;return f===""?0:f}),p=N(()=>a.statRanges[a.currentRange].label);return(f,_)=>{const g=C("el-skeleton"),y=C("el-skeleton-item");return r(),h("div",Th,[o("div",Mh,[n(Ze,{size:"large",bg:l.value,soft:""},{default:d(()=>[ba(f.$slots,"icon")]),_:3},8,["bg"]),o("div",Lh,[n(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",Rh,m(e.stat.title),1),e.loading?B("",!0):(r(),h("div",Oh,m(i(e.stat)),1))])]),o("div",Hh,[n(g,{loading:e.loading,animated:""},{template:d(()=>[n(y,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(r(),h("div",Ph,[o("span",{class:de("change "+s.value)},[c.value!==0?(r(),E(J,{key:0,name:c.value>0?"CaretUp":"CaretDown"},null,8,["name"])):B("",!0),R(" "+m(c.value===0?f.$t("Same as previous"):Math.abs(c.value)+"%"),1)],2),c.value>0?(r(),h("span",Nh,m(A(u)("More than %s",p.value==="Today"?f.$t("Yesterday"):f.$t(p.value))),1)):c.value<0?(r(),h("span",Kh,m(A(u)("Less than %s",p.value==="Today"?f.$t("Yesterday"):f.$t(p.value))),1)):B("",!0)])):B("",!0),!e.loading&&e.currentRange==="all_time"?(r(),h("div",Gh,[o("span",jh,m(f.$t("All Time")),1)])):B("",!0)])])}}},qh={name:"CardFooter"},Yh={class:"fct-card-footer"};function Wh(e,t,a,l,s,i){return r(),h("div",Yh,[ba(e.$slots,"default")])}const rd=lt(qh,[["render",Wh]]);class oA{constructor(){Re(this,"_attributes",{})}attribute(t,a){return this._attributes[t]=a,this}setAttribute(t){return this._attributes=typeof t=="object"?t:this._attributes,this}}class As{static install(t,a,l={},s=!1){const i=new a(...Object.values(l));Object.keys(i).forEach(c=>{(s||!t.hasOwnProperty(c))&&(t[c]=i[c])}),Object.getOwnPropertyNames(a.prototype).forEach(c=>{c!=="constructor"&&typeof i[c]=="function"&&(s||typeof t[c]!="function")&&(t[c]=i[c].bind(t))})}}class Jh extends Za{constructor(){super(...arguments);Re(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:Ge.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,s,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const c=ue.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null||(this.data[s]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!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 ol=Jh.init(),Xh={},Zh={class:"fct-order-stats-row"},e_={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},t_={class:"flex items-center gap-2 mb-3"},a_={class:"right flex flex-col flex-1 gap-2"};function l_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",Zh,[(r(),h(H,null,ae(4,s=>n(l,{animated:"",key:s},{template:d(()=>[o("div",e_,[o("div",t_,[n(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",a_,[n(a,{variant:"p",class:"rounded w-4/5 block"}),n(a,{variant:"p",class:"rounded w-1/2 block"})])]),o("div",null,[n(a,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64))])}const s_=lt(Xh,[["render",l_]]),n_={class:"fct-order-stats-wrap"},o_={class:"fct-order-stats-actions flex items-center gap-2.5"},i_={class:"fct-order-stats-body"},r_={key:1,class:"fct-order-stats-row"},d_={class:"flex justify-end mt-2"},u_=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=M(Qt.get("order_stat_collapse",!1)),a=M(""),l=Yt().ctx,s=M(!1),i=M(!0),c=M(!1),p=M("-7 days"),f=ll(),_=M({"-0 days":{label:u("Today"),desc:u("Compared to yesterday")},"-7 days":{label:u("Last 7 days"),desc:u("Compared to the previous 7 days")},"-30 days":{label:u("Last 30 days"),desc:u("Compared to the previous 30 days")},this_month:{label:u("This Month"),desc:u("Compared to the previous Month")},all_time:{label:u("All Time"),desc:u("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=()=>{c.value=!1,i.value=!0;const v={"-0 days":[et().startOf("day").format("YYYY-MM-DD"),et().endOf("day").format("YYYY-MM-DD")],"-7 days":[et().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),et().endOf("day").format("YYYY-MM-DD")],"-30 days":[et().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),et().endOf("day").format("YYYY-MM-DD")],this_month:[et().startOf("month").format("YYYY-MM-DD"),et().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[b,k]=v[p.value]||[et().startOf("month"),et().endOf("day")],w={startDate:b,endDate:k,paymentStatus:"all"};ol.getDashboardStats({params:{...w}}).then(()=>{s.value=ol.data.dashBoardStats}).catch(S=>{}).finally(()=>{i.value=!1})};return Ie(()=>{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,b)=>{const k=C("el-button");return r(),h("div",n_,[n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Order Stats Overview"),border_bottom:""},{action:d(()=>[o("div",o_,[n(Zr,{class:"hide-animation-on-mobile"},{default:d(()=>[(r(!0),h(H,null,ae(_.value,(w,S)=>(r(),E($o,{title:`${A(u)("Order Stats Overview of")} ${w.label}`,tabindex:"0",key:S,onClick:$=>g(S),class:de(S===p.value?"active":"")},{default:d(()=>[R(m(w.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>[o("div",i_,[i.value?(r(),E(s_,{key:0})):(r(),h("div",r_,[(r(!0),h(H,null,ae(s.value,(w,S)=>(r(),h("div",{key:S,class:"fct-order-stats-col cursor-pointer",onClick:b[0]||(b[0]=$=>A(f).push({name:"reports_orders"}))},[(r(),E(zh,{key:S,stat:w,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":S},{icon:d(()=>[n(J,{name:w.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",d_,[n(k,{text:"",class:"underline-link-button",onClick:b[1]||(b[1]=w=>A(f).push({name:"reports_orders"}))},{default:d(()=>[R(m(A(u)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),c_={class:"table-cell"},A_={class:"table-cell"},p_={class:"table-cell"},f_={class:"table-cell"},m_={class:"table-cell items-center gap-1"},h_={class:"table-cell"},__={class:"table-cell"},v_={class:"table-cell"},g_={__name:"OrdersLoader",props:{nextPageCount:{type:Number,default:0},orderTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=s=>t.orderTable.columns.includes(s),l=Array.from({length:t.nextPageCount},(s,i)=>i+1);return(s,i)=>{const c=C("el-table-column"),p=C("el-skeleton-item"),f=C("el-table"),_=C("el-skeleton");return r(),E(_,{animated:""},{template:d(()=>[n(f,{data:A(l),class:"w-full compact-table responsive"},{empty:d(()=>i[0]||(i[0]=[])),default:d(()=>[B("",!0),n(c,{label:s.$t("Date"),width:"140"},{default:d(()=>[o("div",c_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(r(),E(c,{key:1,width:"130",label:s.$t("Customer")},{default:d(()=>[o("div",A_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),a("order_items")?(r(),E(c,{key:2,label:s.$t("Items"),width:"402"},{default:d(()=>[o("div",p_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),n(c,{width:"150",label:s.$t("Total")},{default:d(()=>[o("div",f_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{width:"150",label:s.$t("Payment Status")},{default:d(()=>[o("div",m_,[n(p,{variant:"p",class:"w-4/5"}),n(p,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(r(),E(c,{key:3,width:"120",label:s.$t("Status")},{default:d(()=>[o("div",h_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),a("type")?(r(),E(c,{key:4,width:"140",label:s.$t("Order Type")},{default:d(()=>[o("div",__,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),a("actions")?(r(),E(c,{key:5,width:"60",label:""},{default:d(()=>[o("div",v_,[n(p,{variant:"p",class:"w-3/5"})])]),_:1})):B("",!0)]),_:1},8,["data"])]),_:1})}}},y_={},b_={class:"px-4 py-3"},w_={class:"grid grid-cols-3 gap-5 mt-5"};function C_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",b_,[(r(),h(H,null,ae(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",w_,[(r(),h(H,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const k_=lt(y_,[["render",C_]]),B_={class:"fct-all-orders-page fct-layout-width"},x_={class:"fct-delete-test-orders-content"},S_={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},F_={class:"fct-delete-test-orders-meta"},$_={class:"fct-delete-test-orders-text"},E_={key:0,class:"fct-delete-test-orders-loading"},U_={class:"fct-test-orders-loading-content"},I_={class:"fct-loading-bars"},Q_=["id"],D_={class:"fct-delete-test-orders-percentage"},V_={class:"fct-delete-test-orders-stats"},T_={class:"fct-delete-test-orders-stat-row"},M_={class:"fct-delete-test-orders-stat-label"},L_={class:"fct-delete-test-orders-stat-value"},R_={class:"fct-delete-test-orders-stat-row"},O_={class:"fct-delete-test-orders-stat-label"},H_={class:"fct-delete-test-orders-stat-value is-success"},P_={class:"fct-delete-test-orders-stat-row"},N_={class:"fct-delete-test-orders-stat-label"},K_={class:"fct-delete-test-orders-stat-value is-danger"},G_={key:1,class:"fct-delete-test-orders-message"},j_={key:0,class:"dialog-footer"},z_={class:"fct-all-orders-wrap"},q_={__name:"AllOrders",setup(e){const t=nA({instance:Yt()}),a=M(!1),l=M(!1),s=M(!1),i=M(!1),c=M({total:0,processed:0,deleted:0,failed:0}),p=M(""),f=M(!1),_=M([]),g=(T=!0)=>{const U=t.buildQueryParams();return T||(delete U.active_view,delete U.filter_type,delete U.search,delete U.advanced_filters),U},y=Pc({entity:"orders",buildParams:()=>g(),buildAllParams:()=>g(!1),filenamePrefix:"orders-export"}),v=({scope:T,columns:U,modules:I,format:O})=>{let L=[];T==="current_page"?L=t.getTableData().map(P=>P.id).filter(Boolean):T==="selected"&&(L=_.value.map(P=>P.id).filter(Boolean)),y.startExport({scope:T,ids:L,columns:U,modules:I,format:O})},b=T=>{_.value=T},k=N(()=>c.value.total?Math.min(100,Math.round(c.value.processed/c.value.total*100)):0),w=N(()=>{if(!c.value.total)return"";const T=Math.min(c.value.processed,c.value.total);return s.value?u("Deleting %1$s of %2$s Test Orders",T,c.value.total):u("Deleted %1$s of %2$s Test Orders",T,c.value.total)}),S=N(()=>c.value.total?s.value?u("Deleting... %1$s",`${k.value}%`):u("Completed"):""),$=()=>{l.value=window.innerWidth<768},V=()=>{c.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"&&x()},x=async()=>{var T,U;if(!s.value){try{await xl.confirm(u("Are you sure you want to delete all test orders? This action cannot be undone."),u("Confirm Delete!"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"})}catch{return}s.value=!0,i.value=!0,V();try{let I=0,O=0,L=0;for(;;){const q=await ue.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:I}),X=q||{};if(O=O||Number(X.total_count||0),L+=Number(X.batch_count||0),c.value={total:O,processed:L,deleted:c.value.deleted+Number(X.deleted_count||0),failed:c.value.failed+Number(X.failed_count||0)},p.value=X.has_more?u("Processed %1$s of %2$s test orders...",Math.min(L,O),O):(q==null?void 0:q.message)||"",!X.has_more)break;I=Number(X.last_attempted_order_id||0),await new Promise(G=>setTimeout(G,100))}if(!c.value.total){i.value=!1,z.info(u("No test orders found to delete"));return}const P=c.value.failed?u("Deleted %1$s test orders. %2$s test orders could not be deleted.",c.value.deleted,c.value.failed):u("Deleted %s test orders successfully",c.value.deleted);p.value=P,z.success(P),t.fetch()}catch(I){p.value=((T=I==null?void 0:I.data)==null?void 0:T.message)||u("Failed to delete test orders"),z.error(((U=I==null?void 0:I.data)==null?void 0:U.message)||u("Failed to delete test orders"))}finally{s.value=!1}}},Q=()=>{i.value=!1},D=()=>{const T=Qt.get("show_order_stats");T&&(a.value=T)};return Ie(()=>{D(),$(),window.addEventListener("resize",$)}),xt(()=>{window.removeEventListener("resize",$)}),(T,U)=>{const I=C("el-icon"),O=C("el-button"),L=C("el-dropdown-item"),P=C("el-dropdown-menu"),q=C("el-dropdown"),X=C("el-tag"),G=C("el-progress"),te=C("el-dialog");return r(),h("div",B_,[n(nl,{title:A(u)("Orders")},{action:d(()=>[n(Rt,{permission:["reports/view","orders/manage","orders/export"]},{default:d(()=>[n(q,{trigger:"click","popper-class":"fct-dropdown",onCommand:F,placement:"bottom-end"},{dropdown:d(()=>[n(P,null,{default:d(()=>[n(Rt,{permission:"reports/view"},{default:d(()=>[n(L,{command:"show_order_stats"},{default:d(()=>[a.value?(r(),h(H,{key:1},[n(J,{name:"EyeOff"}),R(" "+m(A(u)("Hide Order Stats")),1)],64)):(r(),h(H,{key:0},[n(J,{name:"Eye"}),R(" "+m(A(u)("Show Order Stats")),1)],64))]),_:1}),A(t).data.showDeleteBulkAction?B("",!0):(r(),E(L,{key:0,command:"show_delete_bulk_action"},{default:d(()=>[n(J,{name:"Eye"}),R(" "+m(A(u)("Show Bulk Actions")),1)]),_:1})),A(t).data.showDeleteBulkAction?(r(),E(L,{key:1,command:"hide_delete_bulk_action"},{default:d(()=>[n(J,{name:"EyeOff"}),R(" "+m(A(u)("Hide Bulk Actions")),1)]),_:1})):B("",!0)]),_:1}),n(Rt,{permission:"orders/manage"},{default:d(()=>[n(L,{command:"delete_test_orders",disabled:s.value,class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(s.value?A(u)("Deleting Test Orders..."):A(u)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1}),n(Rt,{permission:"orders/export"},{default:d(()=>[n(L,{onClick:U[0]||(U[0]=ne=>f.value=!0)},{default:d(()=>[n(J,{name:"Download"}),R(" "+m(A(u)("Export Orders")),1)]),_:1})]),_:1})]),_:1})]),default:d(()=>[n(O,null,{default:d(()=>[R(m(A(u)("More actions"))+" ",1),n(I,null,{default:d(()=>[n(A(Rn))]),_:1})]),_:1})]),_:1})]),_:1}),n(Rt,{permission:"orders/create"},{default:d(()=>[n(O,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:d(()=>[R(m(A(u)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(te,{modelValue:i.value,"onUpdate:modelValue":U[1]||(U[1]=ne=>i.value=ne),title:A(u)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:Q,class:"fct-delete-test-orders-modal"},{footer:d(()=>[s.value?B("",!0):(r(),h("div",j_,[n(O,{type:"primary",onClick:Q},{default:d(()=>[R(m(A(u)("Done")),1)]),_:1})]))]),default:d(()=>[o("div",x_,[o("div",S_,m(w.value),1),o("div",F_,[o("div",$_,m(s.value?A(u)("You can close this — deletion will continue in the background"):A(u)("Test order deletion completed.")),1),S.value?(r(),E(X,{key:0,type:"success",class:de(["fct-delete-test-orders-status",{"is-complete":!s.value}])},{default:d(()=>[R(m(S.value),1)]),_:1},8,["class"])):B("",!0)]),s.value?(r(),h("div",E_,[o("div",U_,[o("div",I_,[(r(),h(H,null,ae(8,ne=>o("div",{key:ne,class:"bar-block",id:`bar-block-${ne+1}`},null,8,Q_)),64))]),R(" "+m(A(u)("Deleting...")),1)]),o("span",D_,m(k.value)+"% ",1)])):B("",!0),n(va,{visible:s.value,fade:"",duration:300},{default:d(()=>[n(G,{percentage:k.value,"stroke-width":6,striped:"","striped-flow":"","show-text":!1,status:s.value?void 0:"success",class:"fct-delete-test-orders-progress"},null,8,["percentage","status"])]),_:1},8,["visible"]),o("div",V_,[o("div",T_,[U[3]||(U[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",M_,m(A(u)("Processed")),1),o("span",L_,m(c.value.processed)+" / "+m(c.value.total),1)]),o("div",R_,[U[4]||(U[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",O_,m(A(u)("Deleted")),1),o("span",H_,m(c.value.deleted),1)]),o("div",P_,[U[5]||(U[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",N_,m(A(u)("Failed")),1),o("span",K_,m(c.value.failed),1)])]),p.value&&!s.value?(r(),h("p",G_,m(p.value),1)):B("",!0)])]),_:1},8,["modelValue","title"]),n(Rt,{permission:"reports/view"},{default:d(()=>[a.value?(r(),E(u_,{key:0})):B("",!0)]),_:1}),n(Rt,{permission:"orders/view"},{default:d(()=>[o("div",z_,[n(Ds,{table:A(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(k_,{key:0})):B("",!0),A(t).isLoading()?B("",!0):(r(),E(nd,{key:1,table:A(t),orders:A(t).getTableData(),columns:A(t).data.columns,"empty-text":A(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),default:d(()=>[A(t).isLoading()?(r(),E(g_,{key:0,orderTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),E(sd,{key:1,table:A(t),orders:A(t).getTableData(),columns:A(t).data.columns,"empty-text":A(t).emptyMessage,onSelectionChange:b},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1}),n(Nc,{modelValue:f.value,"onUpdate:modelValue":U[2]||(U[2]=ne=>f.value=ne),title:A(u)("Export Orders"),"selected-count":_.value.length,"current-page-count":A(t).getTableData().length,"total-count":A(t).data.paginate.total,"item-label-singular":A(u)("order"),"item-label-plural":A(u)("orders"),"has-active-filter":!!A(t).isFiltering(),"export-state":A(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"])])}}},Y_={class:"setting-wrap"},W_={class:"setting-wrap-inner"},J_={class:"setting-confirmation-content"},X_={class:"custom-wp-editor-wrapper"},Z_={class:"setting-save-action"},ev={__name:"InvoicePacking",setup(e){const t=M([]),a=M([]),l=M(!1),s=M(!1);vs().onSave(()=>{_()});const c=M([u("Invoice Template"),u("Packing Slip Template"),u("Delivery Slip Template"),u("Shipping Slip Template"),u("Dispatch Slip Template")]),p=()=>{l.value=!0,ue.get("templates/print-templates").then(g=>{t.value=g.templates,l.value=!1}).catch(g=>{z.error(g)}).finally(()=>{l.value=!1})},f=()=>{l.value=!0,ue.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{z.error(g)}).finally(()=>{l.value=!1})},_=()=>{s.value=!0,ue.put("templates/print-templates",{templates:t.value}).then(g=>{z.success(g.message)}).catch(g=>{z.error(g)}).finally(()=>{s.value=!1})};return Ie(()=>{p(),f()}),(g,y)=>{const v=C("el-skeleton");return C("el-button"),r(),h("div",Y_,[n(Qa,{heading:A(u)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",W_,[n(Da),n(Xa,{class:"mb-5",type:"information",content:A(u)("It will be available soon!")},null,8,["content"]),l.value?(r(!0),h(H,{key:0},ae(c.value,(b,k)=>(r(),E(Be,{key:k},{default:d(()=>[n(Qe,{title:b,border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[n(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):B("",!0),!l.value&&t.value.length>0?(r(),h(H,{key:1},[(r(!0),h(H,null,ae(t.value,(b,k)=>(r(),E(Be,{key:k},{default:d(()=>[n(Qe,{title:b.title+" (Under Development)",border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",J_,[o("div",X_,[n(es,{"short-codes":a.value,modelValue:b.content,"onUpdate:modelValue":w=>b.content=w,onUpdate:w=>{b.content=w}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",Z_,[B("",!0)])],64)):B("",!0)])])}}},tv={key:0,class:"bg-white p-10 rounded m-10 dark:bg-dark-600"},av={__name:"PdfTemplateRoute",setup(e){const t=Ge.get("app_config.isProActive");return(a,l)=>{const s=C("router-view");return A(t)?(r(),E(s,{key:1})):(r(),h("div",tv,[n(on,{placement:"feature_lock_pdf_templates",title:A(u)("PDF Templates"),text:A(u)("Customizable PDF receipts, invoices, and e-invoices with ZUGFeRD support.")},null,8,["title","text"])]))}}},lv={class:"setting-wrap"},sv={class:"setting-wrap-inner"},nv={class:"flex gap-5"},ov={class:"flex flex-col items-center justify-center py-12 text-center"},iv={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},rv={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},dv={class:"fct-pdf-template-desc"},uv={class:"fct-pdf-template-grid"},cv={class:"fct-pdf-template-preview"},Av={class:"fct-pdf-template-preview-placeholder"},pv={class:"fct-pdf-placeholder-text"},fv={class:"fct-pdf-template-overlay"},mv={class:"fct-pdf-template-footer"},hv={class:"fct-pdf-template-name-row"},_v={class:"fct-pdf-template-title"},vv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},gv={__name:"PdfTemplateIndex",setup(e){const t=ll(),a=M(!0),l=M(!1),s=M({}),i=M(!1),c=M(""),p=M(!1),f=M(""),_=M(null),g=M(!1),y=M(!1),v=Ge.get("app_config.isProActive"),b=()=>{a.value=!0,ue.get("settings/pdf-templates/receipt").then(F=>{s.value=F.templates||{},l.value=F.has_fluent_pdf||!1,_.value=F.addon_info||null}).catch(F=>{var x;z.error(((x=F.data)==null?void 0:x.message)||u("Failed to load templates"))}).finally(()=>{a.value=!1})},k=()=>{if(_.value){if(!v&&_.value.repo_link){window.open(_.value.repo_link,"_blank","noopener,noreferrer");return}g.value=!0,ue.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=>{z.success(F.message||u("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var x;z.error(((x=F.data)==null?void 0:x.message)||u("Failed to install plugin"))}).finally(()=>{g.value=!1})}},w=()=>{_.value&&(y.value=!0,ue.post("settings/modules/plugin-addons/activate",{plugin_file:_.value.plugin_file}).then(F=>{z.success(F.message||u("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var x;z.error(((x=F.data)==null?void 0:x.message)||u("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},S=()=>{c.value="",i.value=!0},$=()=>{if(!c.value.trim()){z.error(u("Please enter a template name"));return}p.value=!0,ue.post("settings/pdf-templates/create",{title:c.value.trim()}).then(F=>{i.value=!1,z.success(F.message||u("Template created")),F.slug?t.push({name:"edit-pdf-template",params:{template:F.slug}}):b()}).catch(F=>{var x;z.error(((x=F.data)==null?void 0:x.message)||u("Failed to create template"))}).finally(()=>{p.value=!1})},V=F=>{f.value=F,ue.delete("settings/pdf-templates/delete/"+F).then(x=>{z.success(x.message||u("Template deleted")),b()}).catch(x=>{var Q;z.error(((Q=x.data)==null?void 0:Q.message)||u("Failed to delete template"))}).finally(()=>{f.value=""})};return Ie(()=>{b()}),(F,x)=>{const Q=C("el-button"),D=C("el-skeleton-item"),T=C("el-skeleton"),U=C("el-popconfirm"),I=C("el-input"),O=C("el-form-item"),L=C("el-form"),P=C("el-dialog");return r(),h("div",lv,[n(Qa,{heading:A(u)("PDF Templates"),"show-save-button":!1},oa({_:2},[l.value?{name:"action",fn:d(()=>[n(Q,{type:"primary",size:"small",onClick:S},{default:d(()=>[R(m(A(u)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",sv,[n(Da),a.value?(r(),E(Be,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(T,{animated:""},{template:d(()=>[n(D,{variant:"text",class:"w-[300px] mb-4"}),o("div",nv,[n(D,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),n(D,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):B("",!0),!a.value&&!l.value&&_.value?(r(),E(Be,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",ov,[x[3]||(x[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",iv,m(A(u)("Fluent PDF Required")),1),o("p",rv,m(A(u)("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(Q,{key:1,type:"success",loading:y.value,onClick:w},{default:d(()=>[R(m(A(u)("Activate Plugin")),1)]),_:1},8,["loading"])):B("",!0):(r(),E(Q,{key:0,type:"primary",loading:g.value,onClick:k},{default:d(()=>[R(m(A(v)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):B("",!0),!a.value&&l.value?(r(),E(Be,{key:2},{default:d(()=>[n(Ce,null,{default:d(()=>[o("p",dv,m(A(u)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",uv,[(r(!0),h(H,null,ae(s.value,(q,X)=>(r(),h("div",{key:X,class:"fct-pdf-template-card"},[o("div",cv,[o("div",Av,[x[4]||(x[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",pv,m(q.title||A(u)("Receipt Template")),1)]),o("div",fv,[n(Q,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:X}}},{default:d(()=>[R(m(A(u)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",mv,[o("div",hv,[o("span",_v,m(q.title||X),1),q.is_default?(r(),h("span",vv,m(A(u)("Built-in")),1)):B("",!0)]),q.is_default?B("",!0):(r(),E(U,{key:0,title:A(u)("Delete this template?"),"confirm-button-text":A(u)("Delete"),"cancel-button-text":A(u)("Cancel"),"confirm-button-type":"danger",onConfirm:G=>V(X)},{reference:d(()=>[n(Q,{type:"danger",size:"small",text:"",loading:f.value===X,class:"fct-pdf-delete-btn"},{default:d(()=>x[5]||(x[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})):B("",!0)]),n(P,{modelValue:i.value,"onUpdate:modelValue":x[2]||(x[2]=q=>i.value=q),title:A(u)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:d(()=>[n(Q,{onClick:x[1]||(x[1]=q=>i.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:$,loading:p.value},{default:d(()=>[R(m(A(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[n(L,{onSubmit:Ne($,["prevent"]),"label-position":"top"},{default:d(()=>[n(O,{label:A(u)("Template Name")},{default:d(()=>[n(I,{modelValue:c.value,"onUpdate:modelValue":x[0]||(x[0]=q=>c.value=q),placeholder:A(u)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},yv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},bv={class:"fct-email-body-skeleton"},wv={class:"fct-email-body-skeleton__page"},Cv={key:0,class:"fct-ebs__badge"},kv={class:"fct-ebs__badge-text"};function Bv(e,t,a,l,s,i){return r(),h("div",bv,[o("div",wv,[t[3]||(t[3]=Un('<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",Cv,[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",kv,m(e.$t("Loading block editor…")),1)])):B("",!0)])])}const pr=lt(yv,[["render",Bv]]),xv={name:"NewEditorFrame",components:{EmailBodySkeleton:pr},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)}}},Sv={style:{width:"100%"}},Fv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},$v={class:"editor-container",style:{position:"relative"}},Ev={key:0,class:"fct-editor-skeleton"},Uv={ref:"iframeContainer",class:"iframe-container"};function Iv(e,t,a,l,s,i){const c=C("EmailBodySkeleton");return r(),h("div",Sv,[i.editorFailed?(r(),h("div",Fv,[o("p",null,m(e.$t("Problem with loading the editor. Please reload the page.")),1)])):B("",!0),o("div",$v,[n(Wl,{name:"fct-skeleton-fade"},{default:d(()=>[s.editorContentReady?B("",!0):(r(),h("div",Ev,[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)),n(c,{"show-loading-badge":!0})]))]),_:1}),o("div",Uv,null,512)])])}const iA=lt(xv,[["render",Iv],["__scopeId","data-v-e5dae537"]]),Qv={class:"setting-wrap fct-pdf-template-edit-wrapper"},Dv={class:"capitalize"},Vv={class:"setting-wrap-inner"},Tv={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},Mv={class:"setting-save-action"},Lv={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=ll(),l=M(!0),s=M(!1),i=M(!1),c=M(!1),p=M(null),f=M(null),_=M(""),g=x=>{const Q=atob(x),D=new Array(Q.length);for(let T=0;T<Q.length;T++)D[T]=Q.charCodeAt(T);return new Blob([new Uint8Array(D)],{type:"application/pdf"})},y=async()=>{const x=await ue.post("settings/pdf-templates/download",{template_id:t.template});if(!(x!=null&&x.pdf_base64))throw new Error(u("Failed to generate PDF"));return x},v=()=>{l.value=!0,ue.get("settings/pdf-templates/receipt/"+t.template).then(x=>{var D,T,U;p.value=x.template;const Q=(U=(T=(D=x.template)==null?void 0:D.pdf_settings)==null?void 0:T[0])==null?void 0:U.pdf_structure;Q&&(_.value=Q.content||"")}).catch(x=>{var Q;z.error(((Q=x.data)==null?void 0:Q.message)||u("Failed to load template"))}).finally(()=>{l.value=!1})},b=async({showSuccess:x=!0}={})=>{var D,T,U,I;s.value=!0,f.value&&await f.value.forceAutosave();const Q=((U=(T=(D=p.value)==null?void 0:D.pdf_settings)==null?void 0:T[0])==null?void 0:U.pdf_structure)||{};Q.content=_.value;try{const O=await ue.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:Q});return x&&z.success(O.message||u("Template saved")),!0}catch(O){return z.error(((I=O.data)==null?void 0:I.message)||u("Failed to save template")),!1}finally{s.value=!1}},k=()=>{i.value=!0,y().then(x=>{const Q=g(x.pdf_base64),D=URL.createObjectURL(Q),T=document.createElement("a");T.href=D,T.download=x.filename||"receipt-test.pdf",document.body.appendChild(T),T.click(),document.body.removeChild(T),URL.revokeObjectURL(D),z.success(u("PDF downloaded"))}).catch(x=>{var Q;z.error(((Q=x.data)==null?void 0:Q.message)||x.message||u("Failed to generate PDF"))}).finally(()=>{i.value=!1})},w=async()=>{var x;c.value=!0;try{const Q=await y(),D=g(Q.pdf_base64),T=URL.createObjectURL(D),U=document.createElement("a");U.href=T,U.target="_blank",U.rel="noopener",document.body.appendChild(U),U.click(),document.body.removeChild(U),setTimeout(()=>{URL.revokeObjectURL(T)},1e4)}catch(Q){z.error(((x=Q.data)==null?void 0:x.message)||Q.message||u("Failed to generate PDF"))}finally{c.value=!1}},S=async()=>{s.value||i.value||c.value||!await b({showSuccess:!1})||await w()},$=()=>p.value&&!p.value.is_default,V=()=>{ue.delete("settings/pdf-templates/delete/"+t.template).then(x=>{z.success(x.message||u("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(x=>{var Q;z.error(((Q=x.data)==null?void 0:Q.message)||u("Failed to delete template"))})},F=()=>{ue.get("settings/pdf-templates/factory-default").then(x=>{var T,U,I;const Q=(T=x.templates)==null?void 0:T[t.template];if(!Q)return;const D=((I=(U=Q.pdf_settings)==null?void 0:U[0])==null?void 0:I.pdf_structure)||{};return ue.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:D}).then(()=>{z.success(u("Reverted to default template")),v()})}).catch(x=>{var Q;z.error(((Q=x.data)==null?void 0:Q.message)||u("Failed to revert template"))})};return Ie(()=>{v()}),(x,Q)=>{const D=C("el-breadcrumb-item"),T=C("el-breadcrumb"),U=C("el-icon"),I=C("el-button"),O=C("el-dropdown-item"),L=C("el-dropdown-menu"),P=C("el-dropdown"),q=C("el-skeleton-item"),X=C("el-skeleton");return r(),h("div",Qv,[n(Qa,{loading:s.value,"loading-text":A(u)("Saving"),"save-button-text":A(u)("Save Template"),onOnSave:b},{heading:d(()=>[n(T,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(D,{to:{path:"/settings/pdf-template"}},{default:d(()=>[R(m(A(u)("PDF Templates")),1)]),_:1}),n(D,null,{default:d(()=>{var G;return[o("span",Dv,m(((G=p.value)==null?void 0:G.title)||A(u)("Edit Template")),1)]}),_:1})]),_:1},8,["separator-icon"])]),action:d(()=>[n(P,{trigger:"click",style:{"margin-left":"12px",display:"inline-flex","align-items":"center"},"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(L,null,{default:d(()=>[n(O,{onClick:k,disabled:i.value},{default:d(()=>[R(m(i.value?A(u)("Downloading..."):A(u)("Test Download")),1)]),_:1},8,["disabled"]),n(O,{onClick:F},{default:d(()=>[R(m(A(u)("Revert to Default")),1)]),_:1}),$()?(r(),E(O,{key:0,divided:"",onClick:V,style:{color:"#F56C6C"}},{default:d(()=>[R(m(A(u)("Delete Template")),1)]),_:1})):B("",!0)]),_:1})]),default:d(()=>[n(I,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:d(()=>[n(U,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:d(()=>[n(A(Kf))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",Vv,[n(Da),n(X,{loading:l.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:d(()=>[n(q,{variant:"h3",class:"w-[200px] mb-5"}),n(q,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!l.value&&p.value?(r(),h(H,{key:0},[o("div",Tv,[n(iA,{ref_key:"editorFrameRef",ref:f,editorParams:{block_type:"pdf_template",campaign_title:p.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:p.value.title||A(u)("Receipt Template"),onPreviewRequest:S,modelValue:_.value,"onUpdate:modelValue":Q[0]||(Q[0]=G=>_.value=G)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",Mv,[n(I,{onClick:b,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(m(A(u)("Save Template")),1)]),_:1},8,["disabled","loading"]),n(I,{onClick:k,disabled:i.value,loading:i.value},{default:d(()=>[R(m(A(u)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):B("",!0)])])}}},Rv={class:"fluent-cart-admin-validation-error-wrapper `${fieldKey}`"},fl=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:{type:String,default:""}},setup(e){return(t,a)=>(r(),h("div",Rv,[(r(!0),h(H,null,ae(e.validationErrors,(l,s)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},m(l),1))),128))]))}}),wo={__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:d(()=>[ba(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},Ov={class:"setting-wrap"},Hv={class:"setting-wrap-inner"},Pv={class:"grid gap-3 mb-6"},Nv={class:"grid gap-3 mb-6"},Kv={class:"grid gap-3 mb-6"},Gv={class:"grid gap-3"},jv={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},zv=["href"],qv={class:"form-note"},Yv={class:"form-note"},Wv=["href"],Jv={class:"mb-4"},Xv={class:"mb-4"},Zv={class:"form-note"},eg={class:"form-note"},tg={class:"form-note"},ag={class:"form-note"},lg={class:"setting-save-action"},sg={__name:"PdfTemplateSettings",setup(e){const t=M(!0),a=M(!1),l=M({}),s=M(!0),i=M(""),c=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"}],f=[{value:"",label:u("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"}];vs().onSave(()=>{y()});const g=()=>{t.value=!0,ue.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(c.value).forEach(b=>{v.seller_details[b]!==void 0&&(c.value[b]=v.seller_details[b])}),s.value=v.store_country_set!==!1,i.value=v.store_settings_url||""}).catch(v=>{var b;z.error(((b=v.data)==null?void 0:b.message)||u("Failed to load settings"))}).finally(()=>{t.value=!1})},y=()=>{a.value=!0,l.value={},ue.post("settings/pdf-templates/seller-details",c.value).then(v=>{z.success(v.message||u("Settings saved"))}).catch(v=>{var b,k;v.status_code===422&&((b=v.data)!=null&&b.data)&&(l.value=v.data.data),z.error(((k=v.data)==null?void 0:k.message)||u("Failed to save settings"))}).finally(()=>{a.value=!1})};return Ie(()=>{g()}),(v,b)=>{const k=C("el-skeleton-item"),w=C("el-skeleton"),S=C("el-switch"),$=C("el-option"),V=C("el-select"),F=C("el-form-item"),x=C("el-col"),Q=C("el-row"),D=C("el-input"),T=C("el-divider"),U=C("el-button");return r(),h("div",Ov,[n(Qa,{heading:A(u)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",Hv,[n(Da),t.value?(r(),E(Be,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(w,{animated:""},{template:d(()=>[o("div",Pv,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",Nv,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",Kv,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",Gv,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})])]),_:1})]),_:1})]),_:1})):B("",!0),t.value?B("",!0):(r(),h(H,{key:1},[c.value.zugferd_enabled==="1"&&!s.value?(r(),h("div",jv,[o("strong",null,m(A(u)("Store country is not configured.")),1),R(" "+m(A(u)("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"},m(A(u)("Go to Store Settings")),9,zv)):B("",!0)])):B("",!0),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("E-Invoice Configuration"),text:A(u)("Configure ZUGFeRD / Factur-X e-invoice encoding and seller details for your PDFs."),border_bottom:""},{action:d(()=>[n(S,{modelValue:c.value.zugferd_enabled,"onUpdate:modelValue":b[0]||(b[0]=I=>c.value.zugferd_enabled=I),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[n(Q,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("ZUGFeRD Profile"),"label-position":"top"},{default:d(()=>[n(V,{modelValue:c.value.zugferd_profile,"onUpdate:modelValue":b[1]||(b[1]=I=>c.value.zugferd_profile=I)},{default:d(()=>[(r(),h(H,null,ae(p,I=>n($,{key:I.value,label:I.label,value:I.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",qv,[o("p",null,m(A(u)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Legal Registration Scheme"),"label-position":"top"},{default:d(()=>[n(V,{modelValue:c.value.seller_legal_registration_scheme,"onUpdate:modelValue":b[2]||(b[2]=I=>c.value.seller_legal_registration_scheme=I),placeholder:A(u)("Select scheme"),clearable:"",filterable:""},{default:d(()=>[(r(),h(H,null,ae(f,I=>n($,{key:I.value,label:I.label,value:I.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",Yv,[o("p",null,m(A(u)("ISO 6523 ICD code for the legal registration identifier")),1)]),n(fl,{"validation-errors":l.value.seller_legal_registration_scheme||{},"field-key":"seller_legal_registration_scheme"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(wo,{type:"info",closable:!1,"show-icon":"",class:"mb-4"},{default:d(()=>[R(m(A(u)("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:""},m(A(u)("Store Settings → Business Details")),9,Wv)):B("",!0)]),_:1}),o("h4",Jv,m(A(u)("Seller Contact")),1),n(Q,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Name"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_contact_name,"onUpdate:modelValue":b[3]||(b[3]=I=>c.value.seller_contact_name=I)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Email"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_contact_email,"onUpdate:modelValue":b[4]||(b[4]=I=>c.value.seller_contact_email=I),type:"email"},null,8,["modelValue"]),n(fl,{"validation-errors":l.value.seller_contact_email||{},"field-key":"seller_contact_email"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(Q,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Phone"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_contact_phone,"onUpdate:modelValue":b[5]||(b[5]=I=>c.value.seller_contact_phone=I)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n(T),o("h4",Xv,m(A(u)("Seller Bank Details")),1),n(Q,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank IBAN"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_bank_iban,"onUpdate:modelValue":b[6]||(b[6]=I=>c.value.seller_bank_iban=I)},null,8,["modelValue"]),n(fl,{"validation-errors":l.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),o("div",Zv,[o("p",null,m(A(u)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank BIC"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_bank_bic,"onUpdate:modelValue":b[7]||(b[7]=I=>c.value.seller_bank_bic=I)},null,8,["modelValue"]),o("div",eg,[o("p",null,m(A(u)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),n(Q,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank Account Name"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_bank_account_name,"onUpdate:modelValue":b[8]||(b[8]=I=>c.value.seller_bank_account_name=I)},null,8,["modelValue"]),o("div",tg,[o("p",null,m(A(u)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:d(()=>[n(F,{label:A(u)("Electronic Address"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_electronic_address,"onUpdate:modelValue":b[9]||(b[9]=I=>c.value.seller_electronic_address=I)},null,8,["modelValue"]),o("div",ag,[o("p",null,m(A(u)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),o("div",lg,[n(U,{type:"primary",onClick:b[10]||(b[10]=I=>y()),loading:a.value},{default:d(()=>[R(m(A(u)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},ng={name:"CustomersRoute"},og={class:"fca_customers_route"};function ig(e,t,a,l,s,i){const c=C("router-view");return r(),h("div",og,[n(c)])}const rg=lt(ng,[["render",ig]]);/*!
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 fr=function(e,t){return fr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,l){a.__proto__=l}||function(a,l){for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&(a[s]=l[s])},fr(e,t)};function Tl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");fr(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var mr=function(){return mr=Object.assign||function(t){for(var a,l=1,s=arguments.length;l<s;l++){a=arguments[l];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(t[i]=a[i])}return t},mr.apply(this,arguments)};function tl(e,t,a,l){function s(i){return i instanceof a?i:new a(function(c){c(i)})}return new(a||(a=Promise))(function(i,c){function p(g){try{_(l.next(g))}catch(y){c(y)}}function f(g){try{_(l.throw(g))}catch(y){c(y)}}function _(g){g.done?i(g.value):s(g.value).then(p,f)}_((l=l.apply(e,[])).next())})}function Wa(e,t){var a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},l,s,i,c;return c={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function p(_){return function(g){return f([_,g])}}function f(_){if(l)throw new TypeError("Generator is already executing.");for(;a;)try{if(l=1,s&&(i=_[0]&2?s.return:_[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,_[1])).done)return i;switch(s=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++,s=_[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],s=0}finally{l=i=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}function Gn(e,t,a){if(arguments.length===2)for(var l=0,s=t.length,i;l<s;l++)(i||!(l in t))&&(i||(i=Array.prototype.slice.call(t,0,l)),i[l]=t[l]);return e.concat(i||t)}var ts=function(){function e(t,a,l,s){this.left=t,this.top=a,this.width=l,this.height=s}return e.prototype.add=function(t,a,l,s){return new e(this.left+t,this.top+a,this.width+l,this.height+s)},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(s){return s.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}(),ui=function(e,t){return ts.fromClientRect(e,t.getBoundingClientRect())},dg=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)),s=Math.max(Math.max(t.scrollHeight,a.scrollHeight),Math.max(t.offsetHeight,a.offsetHeight),Math.max(t.clientHeight,a.clientHeight));return new ts(0,0,l,s)},ci=function(e){for(var t=[],a=0,l=e.length;a<l;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((s&1023)<<10)+(i&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},Ua=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=[],s=-1,i="";++s<a;){var c=e[s];c<=65535?l.push(c):(c-=65536,l.push((c>>10)+55296,c%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},Rd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ug=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var jn=0;jn<Rd.length;jn++)ug[Rd.charCodeAt(jn)]=jn;var Od="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var zn=0;zn<Od.length;zn++)vn[Od.charCodeAt(zn)]=zn;var cg=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,f;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=vn[e.charCodeAt(l)],c=vn[e.charCodeAt(l+1)],p=vn[e.charCodeAt(l+2)],f=vn[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|f&63;return _},Ag=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},pg=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},xs=5,dd=11,Fi=2,fg=dd-xs,rA=65536>>xs,mg=1<<xs,$i=mg-1,hg=1024>>xs,_g=rA+hg,vg=_g,gg=32,yg=vg+gg,bg=65536>>dd,wg=1<<fg,Cg=wg-1,Hd=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},kg=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},Bg=function(e,t){var a=cg(e),l=Array.isArray(a)?pg(a):new Uint32Array(a),s=Array.isArray(a)?Ag(a):new Uint16Array(a),i=24,c=Hd(s,i/2,l[4]/2),p=l[5]===2?Hd(s,(i+l[4])/2):kg(l,Math.ceil((i+l[4])/4));return new xg(l[0],l[1],l[2],l[3],c,p)},xg=function(){function e(t,a,l,s,i,c){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=c}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>xs],a=(a<<Fi)+(t&$i),this.data[a];if(t<=65535)return a=this.index[rA+(t-55296>>xs)],a=(a<<Fi)+(t&$i),this.data[a];if(t<this.highStart)return a=yg-bg+(t>>dd),a=this.index[a],a+=t>>xs&Cg,a=this.index[a],a=(a<<Fi)+(t&$i),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Pd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var qn=0;qn<Pd.length;qn++)Sg[Pd.charCodeAt(qn)]=qn;var Fg="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==",Nd=50,$g=1,dA=2,uA=3,Eg=4,Ug=5,Kd=7,cA=8,Gd=9,rs=10,hr=11,jd=12,_r=13,Ig=14,gn=15,vr=16,Yn=17,fn=18,Qg=19,zd=20,gr=21,mn=22,Ei=23,Rs=24,cl=25,yn=26,bn=27,Os=28,Dg=29,Cs=30,Vg=31,Wn=32,Jn=33,yr=34,br=35,wr=36,Vn=37,Cr=38,Co=39,ko=40,Ui=41,AA=42,Tg=43,Mg=[9001,65288],pA="!",Kt="×",Xn="÷",kr=Bg(Fg),zl=[Cs,wr],Br=[$g,dA,uA,Ug],fA=[rs,cA],qd=[bn,yn],Lg=Br.concat(fA),Yd=[Cr,Co,ko,yr,br],Rg=[gn,_r],Og=function(e,t){t===void 0&&(t="strict");var a=[],l=[],s=[];return e.forEach(function(i,c){var p=kr.get(i);if(p>Nd?(s.push(!0),p-=Nd):s.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return l.push(c),a.push(vr);if(p===Eg||p===hr){if(c===0)return l.push(c),a.push(Cs);var f=a[c-1];return Lg.indexOf(f)===-1?(l.push(l[c-1]),a.push(f)):(l.push(c),a.push(Cs))}if(l.push(c),p===Vg)return a.push(t==="strict"?gr:Vn);if(p===AA||p===Dg)return a.push(Cs);if(p===Tg)return i>=131072&&i<=196605||i>=196608&&i<=262141?a.push(Vn):a.push(Cs);a.push(p)}),[l,a,s]},Ii=function(e,t,a,l){var s=l[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var i=a;i<=l.length;){i++;var c=l[i];if(c===t)return!0;if(c!==rs)break}if(s===rs)for(var i=a;i>0;){i--;var p=l[i];if(Array.isArray(e)?e.indexOf(p)!==-1:e===p)for(var f=a;f<=l.length;){f++;var c=l[f];if(c===t)return!0;if(c!==rs)break}if(p!==rs)break}return!1},Wd=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===rs)a--;else return l}return 0},Hg=function(e,t,a,l,s){if(a[l]===0)return Kt;var i=l-1;if(Array.isArray(s)&&s[i]===!0)return Kt;var c=i-1,p=i+1,f=t[i],_=c>=0?t[c]:0,g=t[p];if(f===dA&&g===uA)return Kt;if(Br.indexOf(f)!==-1)return pA;if(Br.indexOf(g)!==-1||fA.indexOf(g)!==-1)return Kt;if(Wd(i,t)===cA)return Xn;if(kr.get(e[i])===hr||(f===Wn||f===Jn)&&kr.get(e[p])===hr||f===Kd||g===Kd||f===Gd||[rs,_r,gn].indexOf(f)===-1&&g===Gd||[Yn,fn,Qg,Rs,Os].indexOf(g)!==-1||Wd(i,t)===mn||Ii(Ei,mn,i,t)||Ii([Yn,fn],gr,i,t)||Ii(jd,jd,i,t))return Kt;if(f===rs)return Xn;if(f===Ei||g===Ei)return Kt;if(g===vr||f===vr)return Xn;if([_r,gn,gr].indexOf(g)!==-1||f===Ig||_===wr&&Rg.indexOf(f)!==-1||f===Os&&g===wr||g===zd||zl.indexOf(g)!==-1&&f===cl||zl.indexOf(f)!==-1&&g===cl||f===bn&&[Vn,Wn,Jn].indexOf(g)!==-1||[Vn,Wn,Jn].indexOf(f)!==-1&&g===yn||zl.indexOf(f)!==-1&&qd.indexOf(g)!==-1||qd.indexOf(f)!==-1&&zl.indexOf(g)!==-1||[bn,yn].indexOf(f)!==-1&&(g===cl||[mn,gn].indexOf(g)!==-1&&t[p+1]===cl)||[mn,gn].indexOf(f)!==-1&&g===cl||f===cl&&[cl,Os,Rs].indexOf(g)!==-1)return Kt;if([cl,Os,Rs,Yn,fn].indexOf(g)!==-1)for(var y=i;y>=0;){var v=t[y];if(v===cl)return Kt;if([Os,Rs].indexOf(v)!==-1)y--;else break}if([bn,yn].indexOf(g)!==-1)for(var y=[Yn,fn].indexOf(f)!==-1?c:i;y>=0;){var v=t[y];if(v===cl)return Kt;if([Os,Rs].indexOf(v)!==-1)y--;else break}if(Cr===f&&[Cr,Co,yr,br].indexOf(g)!==-1||[Co,yr].indexOf(f)!==-1&&[Co,ko].indexOf(g)!==-1||[ko,br].indexOf(f)!==-1&&g===ko||Yd.indexOf(f)!==-1&&[zd,yn].indexOf(g)!==-1||Yd.indexOf(g)!==-1&&f===bn||zl.indexOf(f)!==-1&&zl.indexOf(g)!==-1||f===Rs&&zl.indexOf(g)!==-1||zl.concat(cl).indexOf(f)!==-1&&g===mn&&Mg.indexOf(e[p])===-1||zl.concat(cl).indexOf(g)!==-1&&f===fn)return Kt;if(f===Ui&&g===Ui){for(var b=a[i],k=1;b>0&&(b--,t[b]===Ui);)k++;if(k%2!==0)return Kt}return f===Wn&&g===Jn?Kt:Xn},Pg=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=Og(e,t.lineBreak),l=a[0],s=a[1],i=a[2];(t.wordBreak==="break-all"||t.wordBreak==="break-word")&&(s=s.map(function(p){return[cl,Cs,AA].indexOf(p)!==-1?Vn:p}));var c=t.wordBreak==="keep-all"?i.map(function(p,f){return p&&e[f]>=19968&&e[f]<=40959}):void 0;return[l,s,c]},Ng=function(){function e(t,a,l,s){this.codePoints=t,this.required=a===pA,this.start=l,this.end=s}return e.prototype.slice=function(){return Ua.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Kg=function(e,t){var a=ci(e),l=Pg(a,t),s=l[0],i=l[1],c=l[2],p=a.length,f=0,_=0;return{next:function(){if(_>=p)return{done:!0,value:null};for(var g=Kt;_<p&&(g=Hg(a,i,s,++_,c))===Kt;);if(g!==Kt||_===p){var y=new Ng(a,g,f,_);return f=_,{value:y,done:!1}}return{done:!0,value:null}}}},Gg=1,jg=2,On=4,Jd=8,Qo=10,Xd=47,Bn=92,zg=9,qg=32,Zn=34,hn=61,Yg=35,Wg=36,Jg=37,eo=39,to=40,_n=41,Xg=95,il=45,Zg=33,e1=60,t1=62,a1=64,l1=91,s1=93,n1=61,o1=123,ao=63,i1=125,Zd=124,r1=126,d1=128,eu=65533,Qi=42,Bs=43,u1=44,c1=58,A1=59,Tn=46,p1=0,f1=8,m1=11,h1=14,_1=31,v1=127,Rl=-1,mA=48,hA=97,_A=101,g1=102,y1=117,b1=122,vA=65,gA=69,yA=70,w1=85,C1=90,Ja=function(e){return e>=mA&&e<=57},k1=function(e){return e>=55296&&e<=57343},Hs=function(e){return Ja(e)||e>=vA&&e<=yA||e>=hA&&e<=g1},B1=function(e){return e>=hA&&e<=b1},x1=function(e){return e>=vA&&e<=C1},S1=function(e){return B1(e)||x1(e)},F1=function(e){return e>=d1},lo=function(e){return e===Qo||e===zg||e===qg},Do=function(e){return S1(e)||F1(e)||e===Xg},tu=function(e){return Do(e)||Ja(e)||e===il},$1=function(e){return e>=p1&&e<=f1||e===m1||e>=h1&&e<=_1||e===v1},is=function(e,t){return e!==Bn?!1:t!==Qo},so=function(e,t,a){return e===il?Do(t)||is(t,a):Do(e)?!0:!!(e===Bn&&is(e,t))},Di=function(e,t,a){return e===Bs||e===il?Ja(t)?!0:t===Tn&&Ja(a):Ja(e===Tn?t:e)},E1=function(e){var t=0,a=1;(e[t]===Bs||e[t]===il)&&(e[t]===il&&(a=-1),t++);for(var l=[];Ja(e[t]);)l.push(e[t++]);var s=l.length?parseInt(Ua.apply(void 0,l),10):0;e[t]===Tn&&t++;for(var i=[];Ja(e[t]);)i.push(e[t++]);var c=i.length,p=c?parseInt(Ua.apply(void 0,i),10):0;(e[t]===gA||e[t]===_A)&&t++;var f=1;(e[t]===Bs||e[t]===il)&&(e[t]===il&&(f=-1),t++);for(var _=[];Ja(e[t]);)_.push(e[t++]);var g=_.length?parseInt(Ua.apply(void 0,_),10):0;return a*(s+p*Math.pow(10,-c))*Math.pow(10,f*g)},U1={type:2},I1={type:3},Q1={type:4},D1={type:13},V1={type:8},T1={type:21},M1={type:9},L1={type:10},R1={type:11},O1={type:12},H1={type:14},no={type:23},P1={type:1},N1={type:25},K1={type:24},G1={type:26},j1={type:27},z1={type:28},q1={type:29},Y1={type:31},xr={type:32},bA=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(ci(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==xr;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case Zn:return this.consumeStringToken(Zn);case Yg:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),s=this.peekCodePoint(2);if(tu(a)||is(l,s)){var i=so(a,l,s)?jg:Gg,c=this.consumeName();return{type:5,value:c,flags:i}}break;case Wg:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),D1;break;case eo:return this.consumeStringToken(eo);case to:return U1;case _n:return I1;case Qi:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),H1;break;case Bs:if(Di(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case u1:return Q1;case il:var p=t,f=this.peekCodePoint(0),_=this.peekCodePoint(1);if(Di(p,f,_))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(so(p,f,_))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(f===il&&_===t1)return this.consumeCodePoint(),this.consumeCodePoint(),K1;break;case Tn:if(Di(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Xd:if(this.peekCodePoint(0)===Qi)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===Qi&&(g=this.consumeCodePoint(),g===Xd))return this.consumeToken();if(g===Rl)return this.consumeToken()}break;case c1:return G1;case A1:return j1;case e1:if(this.peekCodePoint(0)===Zg&&this.peekCodePoint(1)===il&&this.peekCodePoint(2)===il)return this.consumeCodePoint(),this.consumeCodePoint(),N1;break;case a1:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),b=this.peekCodePoint(2);if(so(y,v,b)){var c=this.consumeName();return{type:7,value:c}}break;case l1:return z1;case Bn:if(is(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case s1:return q1;case n1:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),V1;break;case o1:return R1;case i1:return O1;case y1:case w1:var k=this.peekCodePoint(0),w=this.peekCodePoint(1);return k===Bs&&(Hs(w)||w===ao)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case Zd:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),M1;if(this.peekCodePoint(0)===Zd)return this.consumeCodePoint(),T1;break;case r1:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),L1;break;case Rl:return xr}return lo(t)?(this.consumeWhiteSpace(),Y1):Ja(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):Do(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:Ua(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();Hs(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var l=!1;a===ao&&t.length<6;)t.push(a),a=this.consumeCodePoint(),l=!0;if(l){var s=parseInt(Ua.apply(void 0,t.map(function(f){return f===ao?mA:f})),16),i=parseInt(Ua.apply(void 0,t.map(function(f){return f===ao?yA:f})),16);return{type:30,start:s,end:i}}var c=parseInt(Ua.apply(void 0,t),16);if(this.peekCodePoint(0)===il&&Hs(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var p=[];Hs(a)&&p.length<6;)p.push(a),a=this.consumeCodePoint();var i=parseInt(Ua.apply(void 0,p),16);return{type:30,start:c,end:i}}else return{type:30,start:c,end:c}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===to?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===to?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Rl)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===eo||a===Zn){var l=this.consumeStringToken(this.consumeCodePoint());return l.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Rl||this.peekCodePoint(0)===_n)?(this.consumeCodePoint(),{type:22,value:l.value}):(this.consumeBadUrlRemnants(),no)}for(;;){var s=this.consumeCodePoint();if(s===Rl||s===_n)return{type:22,value:Ua.apply(void 0,t)};if(lo(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Rl||this.peekCodePoint(0)===_n?(this.consumeCodePoint(),{type:22,value:Ua.apply(void 0,t)}):(this.consumeBadUrlRemnants(),no);if(s===Zn||s===eo||s===to||$1(s))return this.consumeBadUrlRemnants(),no;if(s===Bn)if(is(s,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),no;else t.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;lo(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===_n||t===Rl)return;is(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(t){for(var a=5e4,l="";t>0;){var s=Math.min(a,t);l+=Ua.apply(void 0,this._value.splice(0,s)),t-=s}return this._value.shift(),l},e.prototype.consumeStringToken=function(t){var a="",l=0;do{var s=this._value[l];if(s===Rl||s===void 0||s===t)return a+=this.consumeStringSlice(l),{type:0,value:a};if(s===Qo)return this._value.splice(0,l),P1;if(s===Bn){var i=this._value[l+1];i!==Rl&&i!==void 0&&(i===Qo?(a+=this.consumeStringSlice(l),l=-1,this._value.shift()):is(s,i)&&(a+=this.consumeStringSlice(l),a+=Ua(this.consumeEscapedCodePoint()),l=-1))}l++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=On,l=this.peekCodePoint(0);for((l===Bs||l===il)&&t.push(this.consumeCodePoint());Ja(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(l===Tn&&Ja(s))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=Jd;Ja(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===gA||l===_A)&&((s===Bs||s===il)&&Ja(i)||Ja(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=Jd;Ja(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[E1(t),a]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),a=t[0],l=t[1],s=this.peekCodePoint(0),i=this.peekCodePoint(1),c=this.peekCodePoint(2);if(so(s,i,c)){var p=this.consumeName();return{type:15,number:a,flags:l,unit:p}}return s===Jg?(this.consumeCodePoint(),{type:16,number:a,flags:l}):{type:17,number:a,flags:l}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(Hs(t)){for(var a=Ua(t);Hs(this.peekCodePoint(0))&&a.length<6;)a+=Ua(this.consumeCodePoint());lo(this.peekCodePoint(0))&&this.consumeCodePoint();var l=parseInt(a,16);return l===0||k1(l)||l>1114111?eu:l}return t===Rl?eu:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(tu(a))t+=Ua(a);else if(is(a,this.peekCodePoint(0)))t+=Ua(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),wA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new bA;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||J1(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"?xr:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),Hn=function(e){return e.type===15},dn=function(e){return e.type===17},da=function(e){return e.type===20},W1=function(e){return e.type===0},Sr=function(e,t){return da(e)&&e.value===t},CA=function(e){return e.type!==31},sn=function(e){return e.type!==31&&e.type!==4},Kl=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},J1=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},hs=function(e){return e.type===17||e.type===15},Ta=function(e){return e.type===16||hs(e)},kA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},za={type:17,number:0,flags:On},ud={type:16,number:50,flags:On},ds={type:16,number:100,flags:On},wn=function(e,t,a){var l=e[0],s=e[1];return[_a(l,t),_a(typeof s<"u"?s:l,a)]},_a=function(e,t){if(e.type===16)return e.number/100*t;if(Hn(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},BA="deg",xA="grad",SA="rad",FA="turn",Ai={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case BA:return Math.PI*t.number/180;case xA:return Math.PI/200*t.number;case SA:return t.number;case FA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},$A=function(e){return e.type===15&&(e.unit===BA||e.unit===xA||e.unit===SA||e.unit===FA)},EA=function(e){var t=e.filter(da).map(function(a){return a.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[za,za];case"to top":case"bottom":return Sl(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[za,ds];case"to right":case"left":return Sl(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ds,ds];case"to bottom":case"top":return Sl(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ds,za];case"to left":case"right":return Sl(270)}return 0},Sl=function(e){return Math.PI*e/180},ps={name:"color",parse:function(e,t){if(t.type===18){var a=X1[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),s=t.value.substring(1,2),i=t.value.substring(2,3);return us(parseInt(l+l,16),parseInt(s+s,16),parseInt(i+i,16),1)}if(t.value.length===4){var l=t.value.substring(0,1),s=t.value.substring(1,2),i=t.value.substring(2,3),c=t.value.substring(3,4);return us(parseInt(l+l,16),parseInt(s+s,16),parseInt(i+i,16),parseInt(c+c,16)/255)}if(t.value.length===6){var l=t.value.substring(0,2),s=t.value.substring(2,4),i=t.value.substring(4,6);return us(parseInt(l,16),parseInt(s,16),parseInt(i,16),1)}if(t.value.length===8){var l=t.value.substring(0,2),s=t.value.substring(2,4),i=t.value.substring(4,6),c=t.value.substring(6,8);return us(parseInt(l,16),parseInt(s,16),parseInt(i,16),parseInt(c,16)/255)}}if(t.type===20){var p=Jl[t.value.toUpperCase()];if(typeof p<"u")return p}return Jl.TRANSPARENT}},fs=function(e){return(255&e)===0},Ha=function(e){var t=255&e,a=255&e>>8,l=255&e>>16,s=255&e>>24;return t<255?"rgba("+s+","+l+","+a+","+t/255+")":"rgb("+s+","+l+","+a+")"},us=function(e,t,a,l){return(e<<24|t<<16|a<<8|Math.round(l*255)<<0)>>>0},au=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},lu=function(e,t){var a=t.filter(sn);if(a.length===3){var l=a.map(au),s=l[0],i=l[1],c=l[2];return us(s,i,c,1)}if(a.length===4){var p=a.map(au),s=p[0],i=p[1],c=p[2],f=p[3];return us(s,i,c,f)}return 0};function Vi(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 su=function(e,t){var a=t.filter(sn),l=a[0],s=a[1],i=a[2],c=a[3],p=(l.type===17?Sl(l.number):Ai.parse(e,l))/(Math.PI*2),f=Ta(s)?s.number/100:0,_=Ta(i)?i.number/100:0,g=typeof c<"u"&&Ta(c)?_a(c,1):1;if(f===0)return us(_*255,_*255,_*255,1);var y=_<=.5?_*(f+1):_+f-_*f,v=_*2-y,b=Vi(v,y,p+1/3),k=Vi(v,y,p),w=Vi(v,y,p-1/3);return us(b*255,k*255,w*255,g)},X1={hsl:su,hsla:su,rgb:lu,rgba:lu},xn=function(e,t){return ps.parse(e,wA.create(t).parseComponentValue())},Jl={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},Z1={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(da(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ey={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},pi=function(e,t){var a=ps.parse(e,t[0]),l=t[1];return l&&Ta(l)?{color:a,stop:l}:{color:a,stop:null}},nu=function(e,t){var a=e[0],l=e[e.length-1];a.stop===null&&(a.stop=za),l.stop===null&&(l.stop=ds);for(var s=[],i=0,c=0;c<e.length;c++){var p=e[c].stop;if(p!==null){var f=_a(p,t);f>i?s.push(f):s.push(i),i=f}else s.push(null)}for(var _=null,c=0;c<s.length;c++){var g=s[c];if(g===null)_===null&&(_=c);else if(_!==null){for(var y=c-_,v=s[_-1],b=(g-v)/(y+1),k=1;k<=y;k++)s[_+k-1]=b*k;_=null}}return e.map(function(w,S){var $=w.color;return{color:$,stop:Math.max(Math.min(1,s[S]/t),0)}})},ty=function(e,t,a){var l=t/2,s=a/2,i=_a(e[0],t)-l,c=s-_a(e[1],a);return(Math.atan2(c,i)+Math.PI*2)%(Math.PI*2)},ay=function(e,t,a){var l=typeof e=="number"?e:ty(e,t,a),s=Math.abs(t*Math.sin(l))+Math.abs(a*Math.cos(l)),i=t/2,c=a/2,p=s/2,f=Math.sin(l-Math.PI/2)*p,_=Math.cos(l-Math.PI/2)*p;return[s,i-_,i+_,c-f,c+f]},Il=function(e,t){return Math.sqrt(e*e+t*t)},ou=function(e,t,a,l,s){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(c,p){var f=p[0],_=p[1],g=Il(a-f,l-_);return(s?g<c.optimumDistance:g>c.optimumDistance)?{optimumCorner:p,optimumDistance:g}:c},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},ly=function(e,t,a,l,s){var i=0,c=0;switch(e.size){case 0:e.shape===0?i=c=Math.min(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-s)):e.shape===1&&(i=Math.min(Math.abs(t),Math.abs(t-l)),c=Math.min(Math.abs(a),Math.abs(a-s)));break;case 2:if(e.shape===0)i=c=Math.min(Il(t,a),Il(t,a-s),Il(t-l,a),Il(t-l,a-s));else if(e.shape===1){var p=Math.min(Math.abs(a),Math.abs(a-s))/Math.min(Math.abs(t),Math.abs(t-l)),f=ou(l,s,t,a,!0),_=f[0],g=f[1];i=Il(_-t,(g-a)/p),c=p*i}break;case 1:e.shape===0?i=c=Math.max(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-s)):e.shape===1&&(i=Math.max(Math.abs(t),Math.abs(t-l)),c=Math.max(Math.abs(a),Math.abs(a-s)));break;case 3:if(e.shape===0)i=c=Math.max(Il(t,a),Il(t,a-s),Il(t-l,a),Il(t-l,a-s));else if(e.shape===1){var p=Math.max(Math.abs(a),Math.abs(a-s))/Math.max(Math.abs(t),Math.abs(t-l)),y=ou(l,s,t,a,!1),_=y[0],g=y[1];i=Il(_-t,(g-a)/p),c=p*i}break}return Array.isArray(e.size)&&(i=_a(e.size[0],l),c=e.size.length===2?_a(e.size[1],s):i),[i,c]},sy=function(e,t){var a=Sl(180),l=[];return Kl(t).forEach(function(s,i){if(i===0){var c=s[0];if(c.type===20&&c.value==="to"){a=EA(s);return}else if($A(c)){a=Ai.parse(e,c);return}}var p=pi(e,s);l.push(p)}),{angle:a,stops:l,type:1}},oo=function(e,t){var a=Sl(180),l=[];return Kl(t).forEach(function(s,i){if(i===0){var c=s[0];if(c.type===20&&["top","left","right","bottom"].indexOf(c.value)!==-1){a=EA(s);return}else if($A(c)){a=(Ai.parse(e,c)+Sl(270))%Sl(360);return}}var p=pi(e,s);l.push(p)}),{angle:a,stops:l,type:1}},ny=function(e,t){var a=Sl(180),l=[],s=1,i=0,c=3,p=[];return Kl(t).forEach(function(f,_){var g=f[0];if(_===0){if(da(g)&&g.value==="linear"){s=1;return}else if(da(g)&&g.value==="radial"){s=2;return}}if(g.type===18){if(g.name==="from"){var y=ps.parse(e,g.values[0]);l.push({stop:za,color:y})}else if(g.name==="to"){var y=ps.parse(e,g.values[0]);l.push({stop:ds,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(sn);if(v.length===2){var y=ps.parse(e,v[1]),b=v[0];dn(b)&&l.push({stop:{type:16,number:b.number*100,flags:b.flags},color:y})}}}}),s===1?{angle:(a+Sl(180))%Sl(360),stops:l,type:s}:{size:c,shape:i,stops:l,position:p,type:s}},UA="closest-side",IA="farthest-side",QA="closest-corner",DA="farthest-corner",VA="circle",TA="ellipse",MA="cover",LA="contain",oy=function(e,t){var a=0,l=3,s=[],i=[];return Kl(t).forEach(function(c,p){var f=!0;if(p===0){var _=!1;f=c.reduce(function(y,v){if(_)if(da(v))switch(v.value){case"center":return i.push(ud),y;case"top":case"left":return i.push(za),y;case"right":case"bottom":return i.push(ds),y}else(Ta(v)||hs(v))&&i.push(v);else if(da(v))switch(v.value){case VA:return a=0,!1;case TA:return a=1,!1;case"at":return _=!0,!1;case UA:return l=0,!1;case MA:case IA:return l=1,!1;case LA:case QA:return l=2,!1;case DA:return l=3,!1}else if(hs(v)||Ta(v))return Array.isArray(l)||(l=[]),l.push(v),!1;return y},f)}if(f){var g=pi(e,c);s.push(g)}}),{size:l,shape:a,stops:s,position:i,type:2}},io=function(e,t){var a=0,l=3,s=[],i=[];return Kl(t).forEach(function(c,p){var f=!0;if(p===0?f=c.reduce(function(g,y){if(da(y))switch(y.value){case"center":return i.push(ud),!1;case"top":case"left":return i.push(za),!1;case"right":case"bottom":return i.push(ds),!1}else if(Ta(y)||hs(y))return i.push(y),!1;return g},f):p===1&&(f=c.reduce(function(g,y){if(da(y))switch(y.value){case VA:return a=0,!1;case TA:return a=1,!1;case LA:case UA:return l=0,!1;case IA:return l=1,!1;case QA:return l=2,!1;case MA:case DA:return l=3,!1}else if(hs(y)||Ta(y))return Array.isArray(l)||(l=[]),l.push(y),!1;return g},f)),f){var _=pi(e,c);s.push(_)}}),{size:l,shape:a,stops:s,position:i,type:2}},iy=function(e){return e.type===1},ry=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=RA[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 dy(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!RA[e.name])}var RA={"linear-gradient":sy,"-moz-linear-gradient":oo,"-ms-linear-gradient":oo,"-o-linear-gradient":oo,"-webkit-linear-gradient":oo,"radial-gradient":oy,"-moz-radial-gradient":io,"-ms-radial-gradient":io,"-o-radial-gradient":io,"-webkit-radial-gradient":io,"-webkit-gradient":ny},uy={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 sn(l)&&dy(l)}).map(function(l){return cd.parse(e,l)})}},cy={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(da(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ay={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Kl(t).map(function(a){return a.filter(Ta)}).map(kA)}},py={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Kl(t).map(function(a){return a.filter(da).map(function(l){return l.value}).join(" ")}).map(fy)}},fy=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}},Zs;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(Zs||(Zs={}));var my={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Kl(t).map(function(a){return a.filter(hy)})}},hy=function(e){return da(e)||Ta(e)},fi=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},_y=fi("top"),vy=fi("right"),gy=fi("bottom"),yy=fi("left"),mi=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return kA(a.filter(Ta))}}},by=mi("top-left"),wy=mi("top-right"),Cy=mi("bottom-right"),ky=mi("bottom-left"),hi=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}}},By=hi("top"),xy=hi("right"),Sy=hi("bottom"),Fy=hi("left"),_i=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return Hn(a)?a.number:0}}},$y=_i("top"),Ey=_i("right"),Uy=_i("bottom"),Iy=_i("left"),Qy={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Dy={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},Vy={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(da).reduce(function(a,l){return a|Ty(l.value)},0)}},Ty=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},My={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}},Ly={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}},Vo;(function(e){e.NORMAL="normal",e.STRICT="strict"})(Vo||(Vo={}));var Ry={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return Vo.STRICT;case"normal":default:return Vo.NORMAL}}},Oy={name:"line-height",initialValue:"normal",prefix:!1,type:4},iu=function(e,t){return da(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Ta(e)?_a(e,t):t},Hy={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)}},Py={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}}},Fr={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}}},vi=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Ny=vi("top"),Ky=vi("right"),Gy=vi("bottom"),jy=vi("left"),zy={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(da).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}})}},qy={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"}}},gi=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Yy=gi("top"),Wy=gi("right"),Jy=gi("bottom"),Xy=gi("left"),Zy={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}}},eb={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}},tb={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Sr(t[0],"none")?[]:Kl(t).map(function(a){for(var l={color:Jl.TRANSPARENT,offsetX:za,offsetY:za,blur:za},s=0,i=0;i<a.length;i++){var c=a[i];hs(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:l.blur=c,s++):l.color=ps.parse(e,c)}return l})}},ab={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}},lb={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=ob[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},sb=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},nb=function(e){var t=e.filter(function(f){return f.type===17}).map(function(f){return f.number}),a=t[0],l=t[1];t[2],t[3];var s=t[4],i=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var c=t[12],p=t[13];return t[14],t[15],t.length===16?[a,l,s,i,c,p]:null},ob={matrix:sb,matrix3d:nb},ru={type:16,number:50,flags:On},ib=[ru,ru],rb={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Ta);return a.length!==2?ib:[a[0],a[1]]}},db={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}}},Sn;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(Sn||(Sn={}));var ub={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return Sn.BREAK_ALL;case"keep-all":return Sn.KEEP_ALL;case"normal":default:return Sn.NORMAL}}},cb={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(dn(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},OA={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")}},Ab={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return dn(t)?t.number:1}},pb={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fb={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(da).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})}},mb={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var a=[],l=[];return t.forEach(function(s){switch(s.type){case 20:case 0:a.push(s.value);break;case 17:a.push(s.number.toString());break;case 4:l.push(a.join(" ")),a.length=0;break}}),a.length&&l.push(a.join(" ")),l.map(function(s){return s.indexOf(" ")===-1?s:"'"+s+"'"})}},hb={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},_b={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(dn(t))return t.number;if(da(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},vb={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(da).map(function(a){return a.value})}},gb={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},yb={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}},bb={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=[],s=t.filter(CA),i=0;i<s.length;i++){var c=s[i],p=s[i+1];if(c.type===20){var f=p&&dn(p)?p.number:1;l.push({counter:c.value,increment:f})}}return l}},wb={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],l=t.filter(CA),s=0;s<l.length;s++){var i=l[s],c=l[s+1];if(da(i)&&i.value!=="none"){var p=c&&dn(c)?c.number:0;a.push({counter:i.value,reset:p})}}return a}},Cb={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Hn).map(function(a){return OA.parse(e,a)})}},kb={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=[],s=t.filter(W1);if(s.length%2!==0)return null;for(var i=0;i<s.length;i+=2){var c=s[i].value,p=s[i+1].value;l.push({open:c,close:p})}return l}},du=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},Bb={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Sr(t[0],"none")?[]:Kl(t).map(function(a){for(var l={color:255,offsetX:za,offsetY:za,blur:za,spread:za,inset:!1},s=0,i=0;i<a.length;i++){var c=a[i];Sr(c,"inset")?l.inset=!0:hs(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:s===2?l.blur=c:l.spread=c,s++):l.color=ps.parse(e,c)}return l})}},xb={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],l=[];return t.filter(da).forEach(function(s){switch(s.value){case"stroke":l.push(1);break;case"fill":l.push(0);break;case"markers":l.push(2);break}}),a.forEach(function(s){l.indexOf(s)===-1&&l.push(s)}),l}},Sb={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Fb={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Hn(t)?t.number:0}},$b=function(){function e(t,a){var l,s;this.animationDuration=dt(t,Cb,a.animationDuration),this.backgroundClip=dt(t,Z1,a.backgroundClip),this.backgroundColor=dt(t,ey,a.backgroundColor),this.backgroundImage=dt(t,uy,a.backgroundImage),this.backgroundOrigin=dt(t,cy,a.backgroundOrigin),this.backgroundPosition=dt(t,Ay,a.backgroundPosition),this.backgroundRepeat=dt(t,py,a.backgroundRepeat),this.backgroundSize=dt(t,my,a.backgroundSize),this.borderTopColor=dt(t,_y,a.borderTopColor),this.borderRightColor=dt(t,vy,a.borderRightColor),this.borderBottomColor=dt(t,gy,a.borderBottomColor),this.borderLeftColor=dt(t,yy,a.borderLeftColor),this.borderTopLeftRadius=dt(t,by,a.borderTopLeftRadius),this.borderTopRightRadius=dt(t,wy,a.borderTopRightRadius),this.borderBottomRightRadius=dt(t,Cy,a.borderBottomRightRadius),this.borderBottomLeftRadius=dt(t,ky,a.borderBottomLeftRadius),this.borderTopStyle=dt(t,By,a.borderTopStyle),this.borderRightStyle=dt(t,xy,a.borderRightStyle),this.borderBottomStyle=dt(t,Sy,a.borderBottomStyle),this.borderLeftStyle=dt(t,Fy,a.borderLeftStyle),this.borderTopWidth=dt(t,$y,a.borderTopWidth),this.borderRightWidth=dt(t,Ey,a.borderRightWidth),this.borderBottomWidth=dt(t,Uy,a.borderBottomWidth),this.borderLeftWidth=dt(t,Iy,a.borderLeftWidth),this.boxShadow=dt(t,Bb,a.boxShadow),this.color=dt(t,Qy,a.color),this.direction=dt(t,Dy,a.direction),this.display=dt(t,Vy,a.display),this.float=dt(t,My,a.cssFloat),this.fontFamily=dt(t,mb,a.fontFamily),this.fontSize=dt(t,hb,a.fontSize),this.fontStyle=dt(t,gb,a.fontStyle),this.fontVariant=dt(t,vb,a.fontVariant),this.fontWeight=dt(t,_b,a.fontWeight),this.letterSpacing=dt(t,Ly,a.letterSpacing),this.lineBreak=dt(t,Ry,a.lineBreak),this.lineHeight=dt(t,Oy,a.lineHeight),this.listStyleImage=dt(t,Hy,a.listStyleImage),this.listStylePosition=dt(t,Py,a.listStylePosition),this.listStyleType=dt(t,Fr,a.listStyleType),this.marginTop=dt(t,Ny,a.marginTop),this.marginRight=dt(t,Ky,a.marginRight),this.marginBottom=dt(t,Gy,a.marginBottom),this.marginLeft=dt(t,jy,a.marginLeft),this.opacity=dt(t,Ab,a.opacity);var i=dt(t,zy,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=dt(t,qy,a.overflowWrap),this.paddingTop=dt(t,Yy,a.paddingTop),this.paddingRight=dt(t,Wy,a.paddingRight),this.paddingBottom=dt(t,Jy,a.paddingBottom),this.paddingLeft=dt(t,Xy,a.paddingLeft),this.paintOrder=dt(t,xb,a.paintOrder),this.position=dt(t,eb,a.position),this.textAlign=dt(t,Zy,a.textAlign),this.textDecorationColor=dt(t,pb,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=dt(t,fb,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=dt(t,tb,a.textShadow),this.textTransform=dt(t,ab,a.textTransform),this.transform=dt(t,lb,a.transform),this.transformOrigin=dt(t,rb,a.transformOrigin),this.visibility=dt(t,db,a.visibility),this.webkitTextStrokeColor=dt(t,Sb,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=dt(t,Fb,a.webkitTextStrokeWidth),this.wordBreak=dt(t,ub,a.wordBreak),this.zIndex=dt(t,cb,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return fs(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}(),Eb=function(){function e(t,a){this.content=dt(t,yb,a.content),this.quotes=dt(t,kb,a.quotes)}return e}(),uu=function(){function e(t,a){this.counterIncrement=dt(t,bb,a.counterIncrement),this.counterReset=dt(t,wb,a.counterReset)}return e}(),dt=function(e,t,a){var l=new bA,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(s);var i=new wA(l.read());switch(t.type){case 2:var c=i.parseComponentValue();return t.parse(e,da(c)?c.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 Ai.parse(e,i.parseComponentValue());case"color":return ps.parse(e,i.parseComponentValue());case"image":return cd.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return hs(p)?p:za;case"length-percentage":var f=i.parseComponentValue();return Ta(f)?f:za;case"time":return OA.parse(e,i.parseComponentValue())}break}},Ub="data-html2canvas-debug",Ib=function(e){var t=e.getAttribute(Ub);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},$r=function(e,t){var a=Ib(e);return a===1||t===a},Gl=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,$r(a,3))debugger;this.styles=new $b(t,window.getComputedStyle(a,null)),Ir(a)&&(this.styles.animationDuration.some(function(l){return l>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=ui(this.context,a),$r(a,4)&&(this.flags|=16)}return e}(),Qb="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var ro=0;ro<cu.length;ro++)Cn[cu.charCodeAt(ro)]=ro;var Db=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,f;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=Cn[e.charCodeAt(l)],c=Cn[e.charCodeAt(l+1)],p=Cn[e.charCodeAt(l+2)],f=Cn[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|f&63;return _},Vb=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},Tb=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},Ss=5,Ad=11,Ti=2,Mb=Ad-Ss,HA=65536>>Ss,Lb=1<<Ss,Mi=Lb-1,Rb=1024>>Ss,Ob=HA+Rb,Hb=Ob,Pb=32,Nb=Hb+Pb,Kb=65536>>Ad,Gb=1<<Mb,jb=Gb-1,Au=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},zb=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},qb=function(e,t){var a=Db(e),l=Array.isArray(a)?Tb(a):new Uint32Array(a),s=Array.isArray(a)?Vb(a):new Uint16Array(a),i=24,c=Au(s,i/2,l[4]/2),p=l[5]===2?Au(s,(i+l[4])/2):zb(l,Math.ceil((i+l[4])/4));return new Yb(l[0],l[1],l[2],l[3],c,p)},Yb=function(){function e(t,a,l,s,i,c){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=c}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Ss],a=(a<<Ti)+(t&Mi),this.data[a];if(t<=65535)return a=this.index[HA+(t-55296>>Ss)],a=(a<<Ti)+(t&Mi),this.data[a];if(t<this.highStart)return a=Nb-Kb+(t>>Ad),a=this.index[a],a+=t>>Ss&jb,a=this.index[a],a=(a<<Ti)+(t&Mi),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wb=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var uo=0;uo<pu.length;uo++)Wb[pu.charCodeAt(uo)]=uo;var Jb=1,Li=2,Ri=3,fu=4,mu=5,Xb=7,hu=8,Oi=9,Hi=10,_u=11,vu=12,gu=13,yu=14,Pi=15,Zb=function(e){for(var t=[],a=0,l=e.length;a<l;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((s&1023)<<10)+(i&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},e0=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=[],s=-1,i="";++s<a;){var c=e[s];c<=65535?l.push(c):(c-=65536,l.push((c>>10)+55296,c%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},t0=qb(Qb),yl="×",Ni="÷",a0=function(e){return t0.get(e)},l0=function(e,t,a){var l=a-2,s=t[l],i=t[a-1],c=t[a];if(i===Li&&c===Ri)return yl;if(i===Li||i===Ri||i===fu||c===Li||c===Ri||c===fu)return Ni;if(i===hu&&[hu,Oi,_u,vu].indexOf(c)!==-1||(i===_u||i===Oi)&&(c===Oi||c===Hi)||(i===vu||i===Hi)&&c===Hi||c===gu||c===mu||c===Xb||i===Jb)return yl;if(i===gu&&c===yu){for(;s===mu;)s=t[--l];if(s===yu)return yl}if(i===Pi&&c===Pi){for(var p=0;s===Pi;)p++,s=t[--l];if(p%2===0)return yl}return Ni},s0=function(e){var t=Zb(e),a=t.length,l=0,s=0,i=t.map(a0);return{next:function(){if(l>=a)return{done:!0,value:null};for(var c=yl;l<a&&(c=l0(t,i,++l))===yl;);if(c!==yl||l===a){var p=e0.apply(null,t.slice(s,l));return s=l,{value:p,done:!1}}return{done:!0,value:null}}}},n0=function(e){for(var t=s0(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},o0=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 s=a.getBoundingClientRect(),i=Math.round(s.height);if(e.body.removeChild(l),i===t)return!0}}return!1},i0=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"?"&#128104;".repeat(10):"";var l=t.firstChild,s=ci(l.data).map(function(f){return Ua(f)}),i=0,c={},p=s.every(function(f,_){a.setStart(l,i),a.setEnd(l,i+f.length);var g=a.getBoundingClientRect();i+=f.length;var y=g.x>c.x||g.y>c.y;return c=g,_===0?!0:y});return e.body.removeChild(t),p},r0=function(){return typeof new Image().crossOrigin<"u"},d0=function(){return typeof new XMLHttpRequest().responseType=="string"},u0=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},bu=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},c0=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 s=new Image,i=t.toDataURL();s.src=i;var c=Er(a,a,0,0,s);return l.fillStyle="red",l.fillRect(0,0,a,a),wu(c).then(function(p){l.drawImage(p,0,0);var f=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",bu(f)?wu(Er(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),bu(l.getImageData(0,0,a,a).data)}).catch(function(){return!1})},Er=function(e,t,a,l,s){var i="http://www.w3.org/2000/svg",c=document.createElementNS(i,"svg"),p=document.createElementNS(i,"foreignObject");return c.setAttributeNS(null,"width",e.toString()),c.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"),c.appendChild(p),p.appendChild(s),c},wu=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))})},Ga={get SUPPORT_RANGE_BOUNDS(){var e=o0(document);return Object.defineProperty(Ga,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Ga.SUPPORT_RANGE_BOUNDS&&i0(document);return Object.defineProperty(Ga,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=u0(document);return Object.defineProperty(Ga,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?c0(document):Promise.resolve(!1);return Object.defineProperty(Ga,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=r0();return Object.defineProperty(Ga,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=d0();return Object.defineProperty(Ga,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ga,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ga,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Fn=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),A0=function(e,t,a,l){var s=m0(t,a),i=[],c=0;return s.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(Ga.SUPPORT_RANGE_BOUNDS){var f=Cu(l,c,p.length).getClientRects();if(f.length>1){var _=pd(p),g=0;_.forEach(function(v){i.push(new Fn(v,ts.fromDOMRectList(e,Cu(l,g+c,v.length).getClientRects()))),g+=v.length})}else i.push(new Fn(p,ts.fromDOMRectList(e,f)))}else{var y=l.splitText(p.length);i.push(new Fn(p,p0(e,l))),l=y}else Ga.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));c+=p.length}),i},p0=function(e,t){var a=t.ownerDocument;if(a){var l=a.createElement("html2canvaswrapper");l.appendChild(t.cloneNode(!0));var s=t.parentNode;if(s){s.replaceChild(l,t);var i=ui(e,l);return l.firstChild&&s.replaceChild(l.firstChild,l),i}}return ts.EMPTY},Cu=function(e,t,a){var l=e.ownerDocument;if(!l)throw new Error("Node has no owner document");var s=l.createRange();return s.setStart(e,t),s.setEnd(e,t+a),s},pd=function(e){if(Ga.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 n0(e)},f0=function(e,t){if(Ga.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 _0(e,t)},m0=function(e,t){return t.letterSpacing!==0?pd(e):f0(e,t)},h0=[32,160,4961,65792,65793,4153,4241],_0=function(e,t){for(var a=Kg(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),l=[],s,i=function(){if(s.value){var c=s.value.slice(),p=ci(c),f="";p.forEach(function(_){h0.indexOf(_)===-1?f+=Ua(_):(f.length&&l.push(f),l.push(Ua(_)),f="")}),f.length&&l.push(f)}};!(s=a.next()).done;)i();return l},v0=function(){function e(t,a,l){this.text=g0(a.data,l.textTransform),this.textBounds=A0(t,this.text,l,a)}return e}(),g0=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(y0,b0);case 2:return e.toUpperCase();default:return e}},y0=/(^|\s|:|-|\(|\))([a-z])/g,b0=function(e,t,a){return e.length>0?t+a.toUpperCase():e},PA=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.src=l.currentSrc||l.src,s.intrinsicWidth=l.naturalWidth,s.intrinsicHeight=l.naturalHeight,s.context.cache.addImage(s.src),s}return t}(Gl),NA=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.canvas=l,s.intrinsicWidth=l.width,s.intrinsicHeight=l.height,s}return t}(Gl),KA=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=new XMLSerializer,c=ui(a,l);return l.setAttribute("width",c.width+"px"),l.setAttribute("height",c.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(l)),s.intrinsicWidth=l.width.baseVal.value,s.intrinsicHeight=l.height.baseVal.value,s.context.cache.addImage(s.svg),s}return t}(Gl),GA=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Gl),Ur=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.start=l.start,s.reversed=typeof l.reversed=="boolean"&&l.reversed===!0,s}return t}(Gl),w0=[{type:15,flags:0,unit:"px",number:3}],C0=[{type:16,flags:0,number:50}],k0=function(e){return e.width>e.height?new ts(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new ts(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},B0=function(e){var t=e.type===x0?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},To="checkbox",Mo="radio",x0="password",ku=707406591,fd=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;switch(s.type=l.type.toLowerCase(),s.checked=l.checked,s.value=B0(l),(s.type===To||s.type===Mo)&&(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=1,s.styles.backgroundClip=[0],s.styles.backgroundOrigin=[0],s.bounds=k0(s.bounds)),s.type){case To:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=w0;break;case Mo:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=C0;break}return s}return t}(Gl),jA=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=l.options[l.selectedIndex||0];return s.value=i&&i.text||"",s}return t}(Gl),zA=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Gl),qA=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;s.src=l.src,s.width=parseInt(l.width,10)||0,s.height=parseInt(l.height,10)||0,s.backgroundColor=s.styles.backgroundColor;try{if(l.contentWindow&&l.contentWindow.document&&l.contentWindow.document.documentElement){s.tree=WA(a,l.contentWindow.document.documentElement);var i=l.contentWindow.document.documentElement?xn(a,getComputedStyle(l.contentWindow.document.documentElement).backgroundColor):Jl.TRANSPARENT,c=l.contentWindow.document.body?xn(a,getComputedStyle(l.contentWindow.document.body).backgroundColor):Jl.TRANSPARENT;s.backgroundColor=fs(i)?fs(c)?s.styles.backgroundColor:c:i}}catch{}return s}return t}(Gl),S0=["OL","UL","MENU"],Bo=function(e,t,a,l){for(var s=t.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,JA(s)&&s.data.trim().length>0)a.textNodes.push(new v0(e,s,a.styles));else if(Ws(s))if(tp(s)&&s.assignedNodes)s.assignedNodes().forEach(function(p){return Bo(e,p,a,l)});else{var c=YA(e,s);c.styles.isVisible()&&(F0(s,c,l)?c.flags|=4:$0(c.styles)&&(c.flags|=2),S0.indexOf(s.tagName)!==-1&&(c.flags|=8),a.elements.push(c),s.slot,s.shadowRoot?Bo(e,s.shadowRoot,c,l):!Lo(s)&&!XA(s)&&!Ro(s)&&Bo(e,s,c,l))}},YA=function(e,t){return Qr(t)?new PA(e,t):ZA(t)?new NA(e,t):XA(t)?new KA(e,t):E0(t)?new GA(e,t):U0(t)?new Ur(e,t):I0(t)?new fd(e,t):Ro(t)?new jA(e,t):Lo(t)?new zA(e,t):ep(t)?new qA(e,t):new Gl(e,t)},WA=function(e,t){var a=YA(e,t);return a.flags|=4,Bo(e,t,a,a),a},F0=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||md(e)&&a.styles.isTransparent()},$0=function(e){return e.isPositioned()||e.isFloating()},JA=function(e){return e.nodeType===Node.TEXT_NODE},Ws=function(e){return e.nodeType===Node.ELEMENT_NODE},Ir=function(e){return Ws(e)&&typeof e.style<"u"&&!xo(e)},xo=function(e){return typeof e.className=="object"},E0=function(e){return e.tagName==="LI"},U0=function(e){return e.tagName==="OL"},I0=function(e){return e.tagName==="INPUT"},Q0=function(e){return e.tagName==="HTML"},XA=function(e){return e.tagName==="svg"},md=function(e){return e.tagName==="BODY"},ZA=function(e){return e.tagName==="CANVAS"},Bu=function(e){return e.tagName==="VIDEO"},Qr=function(e){return e.tagName==="IMG"},ep=function(e){return e.tagName==="IFRAME"},xu=function(e){return e.tagName==="STYLE"},D0=function(e){return e.tagName==="SCRIPT"},Lo=function(e){return e.tagName==="TEXTAREA"},Ro=function(e){return e.tagName==="SELECT"},tp=function(e){return e.tagName==="SLOT"},Su=function(e){return e.tagName.indexOf("-")>0},V0=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,s=t.counterReset,i=!0;l!==null&&l.forEach(function(p){var f=a.counters[p.counter];f&&p.increment!==0&&(i=!1,f.length||f.push(1),f[Math.max(0,f.length-1)]+=p.increment)});var c=[];return i&&s.forEach(function(p){var f=a.counters[p.counter];c.push(p.counter),f||(f=a.counters[p.counter]=[]),f.push(p.reset)}),c},e}(),Fu={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"]},$u={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},T0={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},M0={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Ps=function(e,t,a,l,s,i){return e<t||e>a?Mn(e,s,i.length>0):l.integers.reduce(function(c,p,f){for(;e>=p;)e-=p,c+=l.values[f];return c},"")+i},ap=function(e,t,a,l){var s="";do a||e--,s=l(e)+s,e/=t;while(e*t>=t);return s},Ea=function(e,t,a,l,s){var i=a-t+1;return(e<0?"-":"")+(ap(Math.abs(e),i,l,function(c){return Ua(Math.floor(c%i)+t)})+s)},bs=function(e,t,a){a===void 0&&(a=". ");var l=t.length;return ap(Math.abs(e),l,!1,function(s){return t[Math.floor(s%l)]})+a},js=1,ns=2,os=4,kn=8,ql=function(e,t,a,l,s,i){if(e<-9999||e>9999)return Mn(e,4,s.length>0);var c=Math.abs(e),p=s;if(c===0)return t[0]+p;for(var f=0;c>0&&f<=4;f++){var _=c%10;_===0&&La(i,js)&&p!==""?p=t[_]+p:_>1||_===1&&f===0||_===1&&f===1&&La(i,ns)||_===1&&f===1&&La(i,os)&&e>100||_===1&&f>1&&La(i,kn)?p=t[_]+(f>0?a[f-1]:"")+p:_===1&&f>0&&(p=a[f-1]+p),c=Math.floor(c/10)}return(e<0?l:"")+p},Eu="十百千萬",Uu="拾佰仟萬",Iu="マイナス",Ki="마이너스",Mn=function(e,t,a){var l=a?". ":"",s=a?"、":"",i=a?", ":"",c=a?" ":"";switch(t){case 0:return"•"+c;case 1:return"◦"+c;case 2:return"◾"+c;case 5:var p=Ea(e,48,57,!0,l);return p.length<4?"0"+p:p;case 4:return bs(e,"〇一二三四五六七八九",s);case 6:return Ps(e,1,3999,Fu,3,l).toLowerCase();case 7:return Ps(e,1,3999,Fu,3,l);case 8:return Ea(e,945,969,!1,l);case 9:return Ea(e,97,122,!1,l);case 10:return Ea(e,65,90,!1,l);case 11:return Ea(e,1632,1641,!0,l);case 12:case 49:return Ps(e,1,9999,$u,3,l);case 35:return Ps(e,1,9999,$u,3,l).toLowerCase();case 13:return Ea(e,2534,2543,!0,l);case 14:case 30:return Ea(e,6112,6121,!0,l);case 15:return bs(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return bs(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return ql(e,"零一二三四五六七八九",Eu,"負",s,ns|os|kn);case 47:return ql(e,"零壹貳參肆伍陸柒捌玖",Uu,"負",s,js|ns|os|kn);case 42:return ql(e,"零一二三四五六七八九",Eu,"负",s,ns|os|kn);case 41:return ql(e,"零壹贰叁肆伍陆柒捌玖",Uu,"负",s,js|ns|os|kn);case 26:return ql(e,"〇一二三四五六七八九","十百千万",Iu,s,0);case 25:return ql(e,"零壱弐参四伍六七八九","拾百千万",Iu,s,js|ns|os);case 31:return ql(e,"영일이삼사오육칠팔구","십백천만",Ki,i,js|ns|os);case 33:return ql(e,"零一二三四五六七八九","十百千萬",Ki,i,0);case 32:return ql(e,"零壹貳參四五六七八九","拾百千",Ki,i,js|ns|os);case 18:return Ea(e,2406,2415,!0,l);case 20:return Ps(e,1,19999,M0,3,l);case 21:return Ea(e,2790,2799,!0,l);case 22:return Ea(e,2662,2671,!0,l);case 22:return Ps(e,1,10999,T0,3,l);case 23:return bs(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return bs(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ea(e,3302,3311,!0,l);case 28:return bs(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return bs(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return Ea(e,3792,3801,!0,l);case 37:return Ea(e,6160,6169,!0,l);case 38:return Ea(e,4160,4169,!0,l);case 39:return Ea(e,2918,2927,!0,l);case 40:return Ea(e,1776,1785,!0,l);case 43:return Ea(e,3046,3055,!0,l);case 44:return Ea(e,3174,3183,!0,l);case 45:return Ea(e,3664,3673,!0,l);case 46:return Ea(e,3872,3881,!0,l);case 3:default:return Ea(e,48,57,!0,l)}},lp="data-html2canvas-ignore",Qu=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new V0,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,s=L0(t,a);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var i=t.defaultView.pageXOffset,c=t.defaultView.pageYOffset,p=s.contentWindow,f=p.document,_=H0(s).then(function(){return tl(l,void 0,void 0,function(){var g,y;return Wa(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(G0),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")]:f.fonts&&f.fonts.ready?[4,f.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,O0(f)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof g=="function"?[2,Promise.resolve().then(function(){return g(f,y)}).then(function(){return s})]:[2,s]}})})});return f.open(),f.write(N0(document.doctype)+"<html></html>"),K0(this.referenceElement.ownerDocument,i,c),f.replaceChild(f.adoptNode(this.documentElement),f.documentElement),f.close(),_},e.prototype.createElementClone=function(t){if($r(t,2))debugger;if(ZA(t))return this.createCanvasClone(t);if(Bu(t))return this.createVideoClone(t);if(xu(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return Qr(a)&&(Qr(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Su(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return Gi(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,c){return c&&typeof c.cssText=="string"?i+c.cssText:i},""),s=t.cloneNode(!1);return s.textContent=l,s}}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 s=t.cloneNode(!1);try{s.width=t.width,s.height=t.height;var i=t.getContext("2d"),c=s.getContext("2d");if(c)if(!this.options.allowTaint&&i)c.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 f=p.getContextAttributes();(f==null?void 0:f.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}c.drawImage(t,0,0)}return s}catch{this.context.logger.info("Unable to clone canvas as it is tainted",t)}return s},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 s=t.ownerDocument.createElement("canvas");return s.width=t.offsetWidth,s.height=t.offsetHeight,s},e.prototype.appendChildNode=function(t,a,l){(!Ws(a)||!D0(a)&&!a.hasAttribute(lp)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!Ws(a)||!xu(a))&&t.appendChild(this.cloneNode(a,l))},e.prototype.cloneChildNodes=function(t,a,l){for(var s=this,i=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;i;i=i.nextSibling)if(Ws(i)&&tp(i)&&typeof i.assignedNodes=="function"){var c=i.assignedNodes();c.length&&c.forEach(function(p){return s.appendChildNode(a,p,l)})}else this.appendChildNode(a,i,l)},e.prototype.cloneNode=function(t,a){if(JA(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var l=t.ownerDocument.defaultView;if(l&&Ws(t)&&(Ir(t)||xo(t))){var s=this.createElementClone(t);s.style.transitionProperty="none";var i=l.getComputedStyle(t),c=l.getComputedStyle(t,":before"),p=l.getComputedStyle(t,":after");this.referenceElement===t&&Ir(s)&&(this.clonedReferenceElement=s),md(s)&&q0(s);var f=this.counters.parse(new uu(this.context,i)),_=this.resolvePseudoContent(t,s,c,$n.BEFORE);Su(t)&&(a=!0),Bu(t)||this.cloneChildNodes(t,s,a),_&&s.insertBefore(_,s.firstChild);var g=this.resolvePseudoContent(t,s,p,$n.AFTER);return g&&s.appendChild(g),this.counters.pop(f),(i&&(this.options.copyStyles||xo(t))&&!ep(t)||a)&&Gi(i,s),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([s,t.scrollLeft,t.scrollTop]),(Lo(t)||Ro(t))&&(Lo(s)||Ro(s))&&(s.value=t.value),s}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,a,l,s){var i=this;if(l){var c=l.content,p=a.ownerDocument;if(!(!p||!c||c==="none"||c==="-moz-alt-content"||l.display==="none")){this.counters.parse(new uu(this.context,l));var f=new Eb(this.context,l),_=p.createElement("html2canvaspseudoelement");Gi(l,_),f.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 b=y.values.filter(da);b.length&&_.appendChild(p.createTextNode(t.getAttribute(b[0].value)||""))}else if(y.name==="counter"){var k=y.values.filter(sn),w=k[0],S=k[1];if(w&&da(w)){var $=i.counters.getCounterValue(w.value),V=S&&da(S)?Fr.parse(i.context,S.value):3;_.appendChild(p.createTextNode(Mn($,V,!1)))}}else if(y.name==="counters"){var F=y.values.filter(sn),w=F[0],x=F[1],S=F[2];if(w&&da(w)){var Q=i.counters.getCounterValues(w.value),D=S&&da(S)?Fr.parse(i.context,S.value):3,T=x&&x.type===0?x.value:"",U=Q.map(function(L){return Mn(L,D,!1)}).join(T);_.appendChild(p.createTextNode(U))}}}else if(y.type===20)switch(y.value){case"open-quote":_.appendChild(p.createTextNode(du(f.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(du(f.quotes,--i.quoteDepth,!1)));break;default:_.appendChild(p.createTextNode(y.value))}}),_.className=Dr+" "+Vr;var g=s===$n.BEFORE?" "+Dr:" "+Vr;return xo(a)?a.className.baseValue+=g:a.className+=g,_}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),$n;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})($n||($n={}));var L0=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(lp,"true"),e.body.appendChild(a),a},R0=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},O0=function(e){return Promise.all([].slice.call(e.images,0).map(R0))},H0=function(e){return new Promise(function(t,a){var l=e.contentWindow;if(!l)return a("No window assigned for iframe");var s=l.document;l.onload=e.onload=function(){l.onload=e.onload=null;var i=setInterval(function(){s.body.childNodes.length>0&&s.readyState==="complete"&&(clearInterval(i),t(e))},50)}})},P0=["all","d","content"],Gi=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);P0.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},N0=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},K0=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},G0=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},j0=":before",z0=":after",Dr="___html2canvas___pseudoelement_before",Vr="___html2canvas___pseudoelement_after",Du=`{
19 content: "" !important;
20 display: none !important;
21 }`,q0=function(e){Y0(e,"."+Dr+j0+Du+`
22 .`+Vr+z0+Du)},Y0=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},sp=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}(),W0=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)||(zi(t)||ew(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 tl(this,void 0,void 0,function(){var a,l,s,i,c=this;return Wa(this,function(p){switch(p.label){case 0:return a=sp.isSameOrigin(t),l=!ji(t)&&this._options.useCORS===!0&&Ga.SUPPORT_CORS_IMAGES&&!a,s=!ji(t)&&!a&&!zi(t)&&typeof this._options.proxy=="string"&&Ga.SUPPORT_CORS_XHR&&!l,!a&&this._options.allowTaint===!1&&!ji(t)&&!zi(t)&&!s&&!l?[2]:(i=t,s?[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(f,_){var g=new Image;g.onload=function(){return f(g)},g.onerror=_,(tw(i)||l)&&(g.crossOrigin="anonymous"),g.src=i,g.complete===!0&&setTimeout(function(){return f(g)},500),c._options.imageTimeout>0&&setTimeout(function(){return _("Timed out ("+c._options.imageTimeout+"ms) loading image")},c._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 s=t.substring(0,256);return new Promise(function(i,c){var p=Ga.SUPPORT_RESPONSE_TYPE?"blob":"text",f=new XMLHttpRequest;f.onload=function(){if(f.status===200)if(p==="text")i(f.response);else{var y=new FileReader;y.addEventListener("load",function(){return i(y.result)},!1),y.addEventListener("error",function(v){return c(v)},!1),y.readAsDataURL(f.response)}else c("Failed to proxy resource "+s+" with status code "+f.status)},f.onerror=c;var _=l.indexOf("?")>-1?"&":"?";if(f.open("GET",""+l+_+"url="+encodeURIComponent(t)+"&responseType="+p),p!=="text"&&f instanceof XMLHttpRequest&&(f.responseType=p),a._options.imageTimeout){var g=a._options.imageTimeout;f.timeout=g,f.ontimeout=function(){return c("Timed out ("+g+"ms) proxying "+s)}}f.send()})},e}(),J0=/^data:image\/svg\+xml/i,X0=/^data:image\/.*;base64,/i,Z0=/^data:image\/.*/i,ew=function(e){return Ga.SUPPORT_SVG_DRAWING||!aw(e)},ji=function(e){return Z0.test(e)},tw=function(e){return X0.test(e)},zi=function(e){return e.substr(0,4)==="blob"},aw=function(e){return e.substr(-3).toLowerCase()==="svg"||J0.test(e)},ot=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}(),Ns=function(e,t,a){return new ot(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},co=function(){function e(t,a,l,s){this.type=1,this.start=t,this.startControl=a,this.endControl=l,this.end=s}return e.prototype.subdivide=function(t,a){var l=Ns(this.start,this.startControl,t),s=Ns(this.startControl,this.endControl,t),i=Ns(this.endControl,this.end,t),c=Ns(l,s,t),p=Ns(s,i,t),f=Ns(c,p,t);return a?new e(this.start,l,c,f):new e(f,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}(),kl=function(e){return e.type===1},lw=function(){function e(t){var a=t.styles,l=t.bounds,s=wn(a.borderTopLeftRadius,l.width,l.height),i=s[0],c=s[1],p=wn(a.borderTopRightRadius,l.width,l.height),f=p[0],_=p[1],g=wn(a.borderBottomRightRadius,l.width,l.height),y=g[0],v=g[1],b=wn(a.borderBottomLeftRadius,l.width,l.height),k=b[0],w=b[1],S=[];S.push((i+f)/l.width),S.push((k+y)/l.width),S.push((c+w)/l.height),S.push((_+v)/l.height);var $=Math.max.apply(Math,S);$>1&&(i/=$,c/=$,f/=$,_/=$,y/=$,v/=$,k/=$,w/=$);var V=l.width-f,F=l.height-v,x=l.width-y,Q=l.height-w,D=a.borderTopWidth,T=a.borderRightWidth,U=a.borderBottomWidth,I=a.borderLeftWidth,O=_a(a.paddingTop,t.bounds.width),L=_a(a.paddingRight,t.bounds.width),P=_a(a.paddingBottom,t.bounds.width),q=_a(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||c>0?Ca(l.left+I/3,l.top+D/3,i-I/3,c-D/3,ea.TOP_LEFT):new ot(l.left+I/3,l.top+D/3),this.topRightBorderDoubleOuterBox=i>0||c>0?Ca(l.left+V,l.top+D/3,f-T/3,_-D/3,ea.TOP_RIGHT):new ot(l.left+l.width-T/3,l.top+D/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?Ca(l.left+x,l.top+F,y-T/3,v-U/3,ea.BOTTOM_RIGHT):new ot(l.left+l.width-T/3,l.top+l.height-U/3),this.bottomLeftBorderDoubleOuterBox=k>0||w>0?Ca(l.left+I/3,l.top+Q,k-I/3,w-U/3,ea.BOTTOM_LEFT):new ot(l.left+I/3,l.top+l.height-U/3),this.topLeftBorderDoubleInnerBox=i>0||c>0?Ca(l.left+I*2/3,l.top+D*2/3,i-I*2/3,c-D*2/3,ea.TOP_LEFT):new ot(l.left+I*2/3,l.top+D*2/3),this.topRightBorderDoubleInnerBox=i>0||c>0?Ca(l.left+V,l.top+D*2/3,f-T*2/3,_-D*2/3,ea.TOP_RIGHT):new ot(l.left+l.width-T*2/3,l.top+D*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?Ca(l.left+x,l.top+F,y-T*2/3,v-U*2/3,ea.BOTTOM_RIGHT):new ot(l.left+l.width-T*2/3,l.top+l.height-U*2/3),this.bottomLeftBorderDoubleInnerBox=k>0||w>0?Ca(l.left+I*2/3,l.top+Q,k-I*2/3,w-U*2/3,ea.BOTTOM_LEFT):new ot(l.left+I*2/3,l.top+l.height-U*2/3),this.topLeftBorderStroke=i>0||c>0?Ca(l.left+I/2,l.top+D/2,i-I/2,c-D/2,ea.TOP_LEFT):new ot(l.left+I/2,l.top+D/2),this.topRightBorderStroke=i>0||c>0?Ca(l.left+V,l.top+D/2,f-T/2,_-D/2,ea.TOP_RIGHT):new ot(l.left+l.width-T/2,l.top+D/2),this.bottomRightBorderStroke=y>0||v>0?Ca(l.left+x,l.top+F,y-T/2,v-U/2,ea.BOTTOM_RIGHT):new ot(l.left+l.width-T/2,l.top+l.height-U/2),this.bottomLeftBorderStroke=k>0||w>0?Ca(l.left+I/2,l.top+Q,k-I/2,w-U/2,ea.BOTTOM_LEFT):new ot(l.left+I/2,l.top+l.height-U/2),this.topLeftBorderBox=i>0||c>0?Ca(l.left,l.top,i,c,ea.TOP_LEFT):new ot(l.left,l.top),this.topRightBorderBox=f>0||_>0?Ca(l.left+V,l.top,f,_,ea.TOP_RIGHT):new ot(l.left+l.width,l.top),this.bottomRightBorderBox=y>0||v>0?Ca(l.left+x,l.top+F,y,v,ea.BOTTOM_RIGHT):new ot(l.left+l.width,l.top+l.height),this.bottomLeftBorderBox=k>0||w>0?Ca(l.left,l.top+Q,k,w,ea.BOTTOM_LEFT):new ot(l.left,l.top+l.height),this.topLeftPaddingBox=i>0||c>0?Ca(l.left+I,l.top+D,Math.max(0,i-I),Math.max(0,c-D),ea.TOP_LEFT):new ot(l.left+I,l.top+D),this.topRightPaddingBox=f>0||_>0?Ca(l.left+Math.min(V,l.width-T),l.top+D,V>l.width+T?0:Math.max(0,f-T),Math.max(0,_-D),ea.TOP_RIGHT):new ot(l.left+l.width-T,l.top+D),this.bottomRightPaddingBox=y>0||v>0?Ca(l.left+Math.min(x,l.width-I),l.top+Math.min(F,l.height-U),Math.max(0,y-T),Math.max(0,v-U),ea.BOTTOM_RIGHT):new ot(l.left+l.width-T,l.top+l.height-U),this.bottomLeftPaddingBox=k>0||w>0?Ca(l.left+I,l.top+Math.min(Q,l.height-U),Math.max(0,k-I),Math.max(0,w-U),ea.BOTTOM_LEFT):new ot(l.left+I,l.top+l.height-U),this.topLeftContentBox=i>0||c>0?Ca(l.left+I+q,l.top+D+O,Math.max(0,i-(I+q)),Math.max(0,c-(D+O)),ea.TOP_LEFT):new ot(l.left+I+q,l.top+D+O),this.topRightContentBox=f>0||_>0?Ca(l.left+Math.min(V,l.width+I+q),l.top+D+O,V>l.width+I+q?0:f-I+q,_-(D+O),ea.TOP_RIGHT):new ot(l.left+l.width-(T+L),l.top+D+O),this.bottomRightContentBox=y>0||v>0?Ca(l.left+Math.min(x,l.width-(I+q)),l.top+Math.min(F,l.height+D+O),Math.max(0,y-(T+L)),v-(U+P),ea.BOTTOM_RIGHT):new ot(l.left+l.width-(T+L),l.top+l.height-(U+P)),this.bottomLeftContentBox=k>0||w>0?Ca(l.left+I+q,l.top+Q,Math.max(0,k-(I+q)),w-(U+P),ea.BOTTOM_LEFT):new ot(l.left+I+q,l.top+l.height-(U+P))}return e}(),ea;(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"})(ea||(ea={}));var Ca=function(e,t,a,l,s){var i=4*((Math.sqrt(2)-1)/3),c=a*i,p=l*i,f=e+a,_=t+l;switch(s){case ea.TOP_LEFT:return new co(new ot(e,_),new ot(e,_-p),new ot(f-c,t),new ot(f,t));case ea.TOP_RIGHT:return new co(new ot(e,t),new ot(e+c,t),new ot(f,_-p),new ot(f,_));case ea.BOTTOM_RIGHT:return new co(new ot(f,t),new ot(f,t+p),new ot(e+c,_),new ot(e,_));case ea.BOTTOM_LEFT:default:return new co(new ot(f,_),new ot(f-c,_),new ot(e,t+p),new ot(e,t))}},Oo=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},sw=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},Ho=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},nw=function(){function e(t,a,l){this.offsetX=t,this.offsetY=a,this.matrix=l,this.type=0,this.target=6}return e}(),Ao=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),ow=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),iw=function(e){return e.type===0},np=function(e){return e.type===1},rw=function(e){return e.type===2},Vu=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},dw=function(e,t,a,l,s){return e.map(function(i,c){switch(c){case 0:return i.add(t,a);case 1:return i.add(t+l,a);case 2:return i.add(t+l,a+s);case 3:return i.add(t,a+s)}return i})},op=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),ip=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new lw(this.container),this.container.styles.opacity<1&&this.effects.push(new ow(this.container.styles.opacity)),this.container.styles.transform!==null){var l=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new nw(l,s,i))}if(this.container.styles.overflowX!==0){var c=Oo(this.curves),p=Ho(this.curves);Vu(c,p)?this.effects.push(new Ao(c,6)):(this.effects.push(new Ao(c,2)),this.effects.push(new Ao(p,4)))}}return e.prototype.getEffects=function(t){for(var a=[2,3].indexOf(this.container.styles.position)===-1,l=this.parent,s=this.effects.slice(0);l;){var i=l.effects.filter(function(f){return!np(f)});if(a||l.container.styles.position!==0||!l.parent){if(s.unshift.apply(s,i),a=[2,3].indexOf(l.container.styles.position)===-1,l.container.styles.overflowX!==0){var c=Oo(l.curves),p=Ho(l.curves);Vu(c,p)||s.unshift(new Ao(p,6))}}else s.unshift.apply(s,i);l=l.parent}return s.filter(function(f){return La(f.target,t)})},e}(),Tr=function(e,t,a,l){e.container.elements.forEach(function(s){var i=La(s.flags,4),c=La(s.flags,2),p=new ip(s,e);La(s.styles.display,2048)&&l.push(p);var f=La(s.flags,8)?[]:l;if(i||c){var _=i||s.styles.isPositioned()?a:t,g=new op(p);if(s.styles.isPositioned()||s.styles.opacity<1||s.styles.isTransformed()){var y=s.styles.zIndex.order;if(y<0){var v=0;_.negativeZIndex.some(function(k,w){return y>k.element.container.styles.zIndex.order?(v=w,!1):v>0}),_.negativeZIndex.splice(v,0,g)}else if(y>0){var b=0;_.positiveZIndex.some(function(k,w){return y>=k.element.container.styles.zIndex.order?(b=w+1,!1):b>0}),_.positiveZIndex.splice(b,0,g)}else _.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else s.styles.isFloating()?_.nonPositionedFloats.push(g):_.nonPositionedInlineLevel.push(g);Tr(p,g,i?g:a,f)}else s.styles.isInlineLevel()?t.inlineLevel.push(p):t.nonInlineLevel.push(p),Tr(p,t,a,f);La(s.flags,8)&&rp(s,f)})},rp=function(e,t){for(var a=e instanceof Ur?e.start:1,l=e instanceof Ur?e.reversed:!1,s=0;s<t.length;s++){var i=t[s];i.container instanceof GA&&typeof i.container.value=="number"&&i.container.value!==0&&(a=i.container.value),i.listValue=Mn(a,i.container.styles.listStyleType,!0),a+=l?-1:1}},uw=function(e){var t=new ip(e,null),a=new op(t),l=[];return Tr(t,a,a,l),rp(t.container,l),a},Tu=function(e,t){switch(t){case 0:return Fl(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return Fl(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return Fl(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return Fl(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},cw=function(e,t){switch(t){case 0:return Fl(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return Fl(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return Fl(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return Fl(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},Aw=function(e,t){switch(t){case 0:return Fl(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return Fl(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return Fl(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return Fl(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},pw=function(e,t){switch(t){case 0:return po(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return po(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return po(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return po(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},po=function(e,t){var a=[];return kl(e)?a.push(e.subdivide(.5,!1)):a.push(e),kl(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},Fl=function(e,t,a,l){var s=[];return kl(e)?s.push(e.subdivide(.5,!1)):s.push(e),kl(a)?s.push(a.subdivide(.5,!0)):s.push(a),kl(l)?s.push(l.subdivide(.5,!0).reverse()):s.push(l),kl(t)?s.push(t.subdivide(.5,!1).reverse()):s.push(t),s},dp=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},Po=function(e){var t=e.styles,a=e.bounds,l=_a(t.paddingLeft,a.width),s=_a(t.paddingRight,a.width),i=_a(t.paddingTop,a.width),c=_a(t.paddingBottom,a.width);return a.add(l+t.borderLeftWidth,i+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+l+s),-(t.borderTopWidth+t.borderBottomWidth+i+c))},fw=function(e,t){return e===0?t.bounds:e===2?Po(t):dp(t)},mw=function(e,t){return e===0?t.bounds:e===2?Po(t):dp(t)},qi=function(e,t,a){var l=fw(zs(e.styles.backgroundOrigin,t),e),s=mw(zs(e.styles.backgroundClip,t),e),i=hw(zs(e.styles.backgroundSize,t),a,l),c=i[0],p=i[1],f=wn(zs(e.styles.backgroundPosition,t),l.width-c,l.height-p),_=_w(zs(e.styles.backgroundRepeat,t),f,i,l,s),g=Math.round(l.left+f[0]),y=Math.round(l.top+f[1]);return[_,g,y,c,p]},Ks=function(e){return da(e)&&e.value===Zs.AUTO},fo=function(e){return typeof e=="number"},hw=function(e,t,a){var l=t[0],s=t[1],i=t[2],c=e[0],p=e[1];if(!c)return[0,0];if(Ta(c)&&p&&Ta(p))return[_a(c,a.width),_a(p,a.height)];var f=fo(i);if(da(c)&&(c.value===Zs.CONTAIN||c.value===Zs.COVER)){if(fo(i)){var _=a.width/a.height;return _<i!=(c.value===Zs.COVER)?[a.width,a.width/i]:[a.height*i,a.height]}return[a.width,a.height]}var g=fo(l),y=fo(s),v=g||y;if(Ks(c)&&(!p||Ks(p))){if(g&&y)return[l,s];if(!f&&!v)return[a.width,a.height];if(v&&f){var b=g?l:s*i,k=y?s:l/i;return[b,k]}var w=g?l:a.width,S=y?s:a.height;return[w,S]}if(f){var $=0,V=0;return Ta(c)?$=_a(c,a.width):Ta(p)&&(V=_a(p,a.height)),Ks(c)?$=V*i:(!p||Ks(p))&&(V=$/i),[$,V]}var F=null,x=null;if(Ta(c)?F=_a(c,a.width):p&&Ta(p)&&(x=_a(p,a.height)),F!==null&&(!p||Ks(p))&&(x=g&&y?F/l*s:a.height),x!==null&&Ks(c)&&(F=g&&y?x/s*l:a.width),F!==null&&x!==null)return[F,x];throw new Error("Unable to calculate background-size for element")},zs=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},_w=function(e,t,a,l,s){var i=t[0],c=t[1],p=a[0],f=a[1];switch(e){case 2:return[new ot(Math.round(l.left),Math.round(l.top+c)),new ot(Math.round(l.left+l.width),Math.round(l.top+c)),new ot(Math.round(l.left+l.width),Math.round(f+l.top+c)),new ot(Math.round(l.left),Math.round(f+l.top+c))];case 3:return[new ot(Math.round(l.left+i),Math.round(l.top)),new ot(Math.round(l.left+i+p),Math.round(l.top)),new ot(Math.round(l.left+i+p),Math.round(l.height+l.top)),new ot(Math.round(l.left+i),Math.round(l.height+l.top))];case 1:return[new ot(Math.round(l.left+i),Math.round(l.top+c)),new ot(Math.round(l.left+i+p),Math.round(l.top+c)),new ot(Math.round(l.left+i+p),Math.round(l.top+c+f)),new ot(Math.round(l.left+i),Math.round(l.top+c+f))];default:return[new ot(Math.round(s.left),Math.round(s.top)),new ot(Math.round(s.left+s.width),Math.round(s.top)),new ot(Math.round(s.left+s.width),Math.round(s.height+s.top)),new ot(Math.round(s.left),Math.round(s.height+s.top))]}},vw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Mu="Hidden Text",gw=function(){function e(t){this._data={},this._document=t}return e.prototype.parseMetrics=function(t,a){var l=this._document.createElement("div"),s=this._document.createElement("img"),i=this._document.createElement("span"),c=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",c.appendChild(l),s.src=vw,s.width=1,s.height=1,s.style.margin="0",s.style.padding="0",s.style.verticalAlign="baseline",i.style.fontFamily=t,i.style.fontSize=a,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(Mu)),l.appendChild(i),l.appendChild(s);var p=s.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(Mu)),l.style.lineHeight="normal",s.style.verticalAlign="super";var f=s.offsetTop-l.offsetTop+2;return c.removeChild(l),{baseline:p,middle:f}},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}(),up=function(){function e(t,a){this.context=t,this.options=a}return e}(),yw=1e4,bw=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s._activeEffects=[],s.canvas=l.canvas?l.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),l.canvas||(s.canvas.width=Math.floor(l.width*l.scale),s.canvas.height=Math.floor(l.height*l.scale),s.canvas.style.width=l.width+"px",s.canvas.style.height=l.height+"px"),s.fontMetrics=new gw(document),s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-l.x,-l.y),s.ctx.textBaseline="bottom",s._activeEffects=[],s.context.logger.debug("Canvas renderer initialized ("+l.width+"x"+l.height+") with scale "+l.scale),s}return t.prototype.applyEffects=function(a){for(var l=this;this._activeEffects.length;)this.popEffect();a.forEach(function(s){return l.applyEffect(s)})},t.prototype.applyEffect=function(a){this.ctx.save(),rw(a)&&(this.ctx.globalAlpha=a.opacity),iw(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)),np(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 tl(this,void 0,void 0,function(){var l;return Wa(this,function(s){switch(s.label){case 0:return l=a.element.container.styles,l.isVisible()?[4,this.renderStackContent(a)]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(a){return tl(this,void 0,void 0,function(){return Wa(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,s){var i=this;if(l===0)this.ctx.fillText(a.text,a.bounds.left,a.bounds.top+s);else{var c=pd(a.text);c.reduce(function(p,f){return i.ctx.fillText(f,p,a.bounds.top+s),p+i.ctx.measureText(f).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var l=a.fontVariant.filter(function(c){return c==="normal"||c==="small-caps"}).join(""),s=xw(a.fontFamily).join(", "),i=Hn(a.fontSize)?""+a.fontSize.number+a.fontSize.unit:a.fontSize.number+"px";return[[a.fontStyle,l,a.fontWeight,i,s].join(" "),s,i]},t.prototype.renderTextNode=function(a,l){return tl(this,void 0,void 0,function(){var s,i,c,p,f,_,g,y,v=this;return Wa(this,function(b){return s=this.createFontStyle(l),i=s[0],c=s[1],p=s[2],this.ctx.font=i,this.ctx.direction=l.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",f=this.fontMetrics.getMetrics(c,p),_=f.baseline,g=f.middle,y=l.paintOrder,a.textBounds.forEach(function(k){y.forEach(function(w){switch(w){case 0:v.ctx.fillStyle=Ha(l.color),v.renderTextWithLetterSpacing(k,l.letterSpacing,_);var S=l.textShadow;S.length&&k.text.trim().length&&(S.slice(0).reverse().forEach(function($){v.ctx.shadowColor=Ha($.color),v.ctx.shadowOffsetX=$.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=$.offsetY.number*v.options.scale,v.ctx.shadowBlur=$.blur.number,v.renderTextWithLetterSpacing(k,l.letterSpacing,_)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),l.textDecorationLine.length&&(v.ctx.fillStyle=Ha(l.textDecorationColor||l.color),l.textDecorationLine.forEach(function($){switch($){case 1:v.ctx.fillRect(k.bounds.left,Math.round(k.bounds.top+_),k.bounds.width,1);break;case 2:v.ctx.fillRect(k.bounds.left,Math.round(k.bounds.top),k.bounds.width,1);break;case 3:v.ctx.fillRect(k.bounds.left,Math.ceil(k.bounds.top+g),k.bounds.width,1);break}}));break;case 1:l.webkitTextStrokeWidth&&k.text.trim().length&&(v.ctx.strokeStyle=Ha(l.webkitTextStrokeColor),v.ctx.lineWidth=l.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(k.text,k.bounds.left,k.bounds.top+_)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},t.prototype.renderReplacedElement=function(a,l,s){if(s&&a.intrinsicWidth>0&&a.intrinsicHeight>0){var i=Po(a),c=Ho(l);this.path(c),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(s,0,0,a.intrinsicWidth,a.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(a){return tl(this,void 0,void 0,function(){var l,s,i,c,p,f,V,V,_,g,y,v,x,b,k,Q,w,S,$,V,F,x,Q;return Wa(this,function(D){switch(D.label){case 0:this.applyEffects(a.getEffects(4)),l=a.container,s=a.curves,i=l.styles,c=0,p=l.textNodes,D.label=1;case 1:return c<p.length?(f=p[c],[4,this.renderTextNode(f,i)]):[3,4];case 2:D.sent(),D.label=3;case 3:return c++,[3,1];case 4:if(!(l instanceof PA))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,s,V),[3,8];case 7:return D.sent(),this.context.logger.error("Error loading image "+l.src),[3,8];case 8:if(l instanceof NA&&this.renderReplacedElement(l,s,l.canvas),!(l instanceof KA))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,s,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 qA&&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 fd&&(y=Math.min(l.bounds.width,l.bounds.height),l.type===To?l.checked&&(this.ctx.save(),this.path([new ot(l.bounds.left+y*.39363,l.bounds.top+y*.79),new ot(l.bounds.left+y*.16,l.bounds.top+y*.5549),new ot(l.bounds.left+y*.27347,l.bounds.top+y*.44071),new ot(l.bounds.left+y*.39694,l.bounds.top+y*.5649),new ot(l.bounds.left+y*.72983,l.bounds.top+y*.23),new ot(l.bounds.left+y*.84,l.bounds.top+y*.34085),new ot(l.bounds.left+y*.39363,l.bounds.top+y*.79)]),this.ctx.fillStyle=Ha(ku),this.ctx.fill(),this.ctx.restore()):l.type===Mo&&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=Ha(ku),this.ctx.fill(),this.ctx.restore())),ww(l)&&l.value.length){switch(v=this.createFontStyle(i),x=v[0],b=v[1],k=this.fontMetrics.getMetrics(x,b).baseline,this.ctx.font=x,this.ctx.fillStyle=Ha(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=kw(l.styles.textAlign),Q=Po(l),w=0,l.styles.textAlign){case 1:w+=Q.width/2;break;case 2:w+=Q.width;break}S=Q.add(w,0,0,-Q.height/2+1),this.ctx.save(),this.path([new ot(Q.left,Q.top),new ot(Q.left+Q.width,Q.top),new ot(Q.left+Q.width,Q.top+Q.height),new ot(Q.left,Q.top+Q.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Fn(l.value,S),i.letterSpacing,k),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($=l.styles.listStyleImage,$.type!==0)return[3,18];V=void 0,F=$.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&&(x=this.createFontStyle(i)[0],this.ctx.font=x,this.ctx.fillStyle=Ha(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",Q=new ts(l.bounds.left,l.bounds.top+_a(l.styles.paddingTop,l.bounds.width),l.bounds.width,iu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Fn(a.listValue,Q),i.letterSpacing,iu(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 tl(this,void 0,void 0,function(){var l,s,$,i,c,$,p,f,$,_,g,$,y,v,$,b,k,$,w,S,$;return Wa(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,s=a.negativeZIndex,V.label=2;case 2:return l<s.length?($=s[l],[4,this.renderStack($)]):[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,c=a.nonInlineLevel,V.label=7;case 7:return i<c.length?($=c[i],[4,this.renderNode($)]):[3,10];case 8:V.sent(),V.label=9;case 9:return i++,[3,7];case 10:p=0,f=a.nonPositionedFloats,V.label=11;case 11:return p<f.length?($=f[p],[4,this.renderStack($)]):[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?($=g[_],[4,this.renderStack($)]):[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?($=v[y],[4,this.renderNode($)]):[3,22];case 20:V.sent(),V.label=21;case 21:return y++,[3,19];case 22:b=0,k=a.zeroOrAutoZIndexOrTransformedOrOpacity,V.label=23;case 23:return b<k.length?($=k[b],[4,this.renderStack($)]):[3,26];case 24:V.sent(),V.label=25;case 25:return b++,[3,23];case 26:w=0,S=a.positiveZIndex,V.label=27;case 27:return w<S.length?($=S[w],[4,this.renderStack($)]):[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(s,i){var c=kl(s)?s.start:s;i===0?l.ctx.moveTo(c.x,c.y):l.ctx.lineTo(c.x,c.y),kl(s)&&l.ctx.bezierCurveTo(s.startControl.x,s.startControl.y,s.endControl.x,s.endControl.y,s.end.x,s.end.y)})},t.prototype.renderRepeat=function(a,l,s,i){this.path(a),this.ctx.fillStyle=l,this.ctx.translate(s,i),this.ctx.fill(),this.ctx.translate(-s,-i)},t.prototype.resizeImage=function(a,l,s){var i;if(a.width===l&&a.height===s)return a;var c=(i=this.canvas.ownerDocument)!==null&&i!==void 0?i:document,p=c.createElement("canvas");p.width=Math.max(1,l),p.height=Math.max(1,s);var f=p.getContext("2d");return f.drawImage(a,0,0,a.width,a.height,0,0,l,s),p},t.prototype.renderBackgroundImage=function(a){return tl(this,void 0,void 0,function(){var l,s,i,c,p,f;return Wa(this,function(_){switch(_.label){case 0:l=a.styles.backgroundImage.length-1,s=function(g){var y,v,b,O,te,ne,q,X,U,k,O,te,ne,q,X,w,S,$,V,F,x,Q,D,T,U,I,O,L,P,q,X,G,te,ne,re,K,Y,W,j,ie,he,me;return Wa(this,function(ye){switch(ye.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,ye.label=1;case 1:return ye.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return y=ye.sent(),[3,4];case 3:return ye.sent(),i.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(b=qi(a,l,[y.width,y.height,y.width/y.height]),O=b[0],te=b[1],ne=b[2],q=b[3],X=b[4],U=i.ctx.createPattern(i.resizeImage(y,q,X),"repeat"),i.renderRepeat(O,U,te,ne)),[3,6];case 5:iy(g)?(k=qi(a,l,[null,null,null]),O=k[0],te=k[1],ne=k[2],q=k[3],X=k[4],w=ay(g.angle,q,X),S=w[0],$=w[1],V=w[2],F=w[3],x=w[4],Q=document.createElement("canvas"),Q.width=q,Q.height=X,D=Q.getContext("2d"),T=D.createLinearGradient($,F,V,x),nu(g.stops,S).forEach(function(se){return T.addColorStop(se.stop,Ha(se.color))}),D.fillStyle=T,D.fillRect(0,0,q,X),q>0&&X>0&&(U=i.ctx.createPattern(Q,"repeat"),i.renderRepeat(O,U,te,ne))):ry(g)&&(I=qi(a,l,[null,null,null]),O=I[0],L=I[1],P=I[2],q=I[3],X=I[4],G=g.position.length===0?[ud]:g.position,te=_a(G[0],q),ne=_a(G[G.length-1],X),re=ly(g,te,ne,q,X),K=re[0],Y=re[1],K>0&&Y>0&&(W=i.ctx.createRadialGradient(L+te,P+ne,0,L+te,P+ne,K),nu(g.stops,K*2).forEach(function(se){return W.addColorStop(se.stop,Ha(se.color))}),i.path(O),i.ctx.fillStyle=W,K!==Y?(j=a.bounds.left+.5*a.bounds.width,ie=a.bounds.top+.5*a.bounds.height,he=Y/K,me=1/he,i.ctx.save(),i.ctx.translate(j,ie),i.ctx.transform(1,0,0,he,0,0),i.ctx.translate(-j,-ie),i.ctx.fillRect(L,me*(P-ie)+ie,q,X*me),i.ctx.restore()):i.ctx.fill())),ye.label=6;case 6:return l--,[2]}})},i=this,c=0,p=a.styles.backgroundImage.slice(0).reverse(),_.label=1;case 1:return c<p.length?(f=p[c],[5,s(f)]):[3,4];case 2:_.sent(),_.label=3;case 3:return c++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(a,l,s){return tl(this,void 0,void 0,function(){return Wa(this,function(i){return this.path(Tu(s,l)),this.ctx.fillStyle=Ha(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,l,s,i){return tl(this,void 0,void 0,function(){var c,p;return Wa(this,function(f){switch(f.label){case 0:return l<3?[4,this.renderSolidBorder(a,s,i)]:[3,2];case 1:return f.sent(),[2];case 2:return c=cw(i,s),this.path(c),this.ctx.fillStyle=Ha(a),this.ctx.fill(),p=Aw(i,s),this.path(p),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return tl(this,void 0,void 0,function(){var l,s,i,c,p,f,_,g,y=this;return Wa(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),l=a.container.styles,s=!fs(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}],c=Cw(zs(l.backgroundClip,0),a.curves),s||l.boxShadow.length?(this.ctx.save(),this.path(c),this.ctx.clip(),fs(l.backgroundColor)||(this.ctx.fillStyle=Ha(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(b){y.ctx.save();var k=Oo(a.curves),w=b.inset?0:yw,S=dw(k,-w+(b.inset?1:-1)*b.spread.number,(b.inset?1:-1)*b.spread.number,b.spread.number*(b.inset?-2:2),b.spread.number*(b.inset?-2:2));b.inset?(y.path(k),y.ctx.clip(),y.mask(S)):(y.mask(k),y.ctx.clip(),y.path(S)),y.ctx.shadowOffsetX=b.offsetX.number+w,y.ctx.shadowOffsetY=b.offsetY.number,y.ctx.shadowColor=Ha(b.color),y.ctx.shadowBlur=b.blur.number,y.ctx.fillStyle=b.inset?Ha(b.color):"rgba(0,0,0,1)",y.ctx.fill(),y.ctx.restore()}),v.label=2;case 2:p=0,f=0,_=i,v.label=3;case 3:return f<_.length?(g=_[f],g.style!==0&&!fs(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 f++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,l,s,i,c){return tl(this,void 0,void 0,function(){var p,f,_,g,y,v,b,k,w,S,$,V,F,x,Q,D,Q,D;return Wa(this,function(T){return this.ctx.save(),p=pw(i,s),f=Tu(i,s),c===2&&(this.path(f),this.ctx.clip()),kl(f[0])?(_=f[0].start.x,g=f[0].start.y):(_=f[0].x,g=f[0].y),kl(f[1])?(y=f[1].end.x,v=f[1].end.y):(y=f[1].x,v=f[1].y),s===0||s===2?b=Math.abs(_-y):b=Math.abs(g-v),this.ctx.beginPath(),c===3?this.formatPath(p):this.formatPath(f.slice(0,2)),k=l<3?l*3:l*2,w=l<3?l*2:l,c===3&&(k=l,w=l),S=!0,b<=k*2?S=!1:b<=k*2+w?($=b/(2*k+w),k*=$,w*=$):(V=Math.floor((b+w)/(k+w)),F=(b-V*k)/(V-1),x=(b-(V+1)*k)/V,w=x<=0||Math.abs(w-F)<Math.abs(w-x)?F:x),S&&(c===3?this.ctx.setLineDash([0,k+w]):this.ctx.setLineDash([k,w])),c===3?(this.ctx.lineCap="round",this.ctx.lineWidth=l):this.ctx.lineWidth=l*2+1.1,this.ctx.strokeStyle=Ha(a),this.ctx.stroke(),this.ctx.setLineDash([]),c===2&&(kl(f[0])&&(Q=f[3],D=f[0],this.ctx.beginPath(),this.formatPath([new ot(Q.end.x,Q.end.y),new ot(D.start.x,D.start.y)]),this.ctx.stroke()),kl(f[1])&&(Q=f[1],D=f[2],this.ctx.beginPath(),this.formatPath([new ot(Q.end.x,Q.end.y),new ot(D.start.x,D.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return tl(this,void 0,void 0,function(){var l;return Wa(this,function(s){switch(s.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ha(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),l=uw(a),[4,this.renderStack(l)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(up),ww=function(e){return e instanceof zA||e instanceof jA?!0:e instanceof fd&&e.type!==Mo&&e.type!==To},Cw=function(e,t){switch(e){case 0:return Oo(t);case 2:return sw(t);case 1:default:return Ho(t)}},kw=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Bw=["-apple-system","system-ui"],xw=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return Bw.indexOf(t)===-1}):e},Sw=function(e){Tl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.canvas=l.canvas?l.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),s.options=l,s.canvas.width=Math.floor(l.width*l.scale),s.canvas.height=Math.floor(l.height*l.scale),s.canvas.style.width=l.width+"px",s.canvas.style.height=l.height+"px",s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-l.x,-l.y),s.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+l.width+"x"+l.height+" at "+l.x+","+l.y+") with scale "+l.scale),s}return t.prototype.render=function(a){return tl(this,void 0,void 0,function(){var l,s;return Wa(this,function(i){switch(i.label){case 0:return l=Er(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,Fw(l)];case 1:return s=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ha(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(s,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},t}(up),Fw=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))})},$w=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,Gn([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,Gn([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,Gn([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,Gn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),Ew=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new $w({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new W0(this,t)}return e.instanceCount=1,e}(),Uw=function(e,t){return t===void 0&&(t={}),Iw(e,t)};typeof window<"u"&&sp.setContext(window);var Iw=function(e,t){return tl(void 0,void 0,void 0,function(){var a,l,s,i,c,p,f,_,g,y,v,b,k,w,S,$,V,F,x,Q,T,D,T,U,I,O,L,P,q,X,G,te,ne,re,K,Y,W,j,ie,he;return Wa(this,function(me){switch(me.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 s={allowTaint:(U=t.allowTaint)!==null&&U!==void 0?U:!1,imageTimeout:(I=t.imageTimeout)!==null&&I!==void 0?I:15e3,proxy:t.proxy,useCORS:(O=t.useCORS)!==null&&O!==void 0?O:!1},i=mr({logging:(L=t.logging)!==null&&L!==void 0?L:!0,cache:t.cache},s),c={windowWidth:(P=t.windowWidth)!==null&&P!==void 0?P:l.innerWidth,windowHeight:(q=t.windowHeight)!==null&&q!==void 0?q:l.innerHeight,scrollX:(X=t.scrollX)!==null&&X!==void 0?X:l.pageXOffset,scrollY:(G=t.scrollY)!==null&&G!==void 0?G:l.pageYOffset},p=new ts(c.scrollX,c.scrollY,c.windowWidth,c.windowHeight),f=new Ew(i,p),_=(te=t.foreignObjectRendering)!==null&&te!==void 0?te:!1,g={allowTaint:(ne=t.allowTaint)!==null&&ne!==void 0?ne:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:_,copyStyles:_},f.logger.debug("Starting document clone with size "+p.width+"x"+p.height+" scrolled to "+-p.left+","+-p.top),y=new Qu(f,e,g),v=y.clonedReferenceElement,v?[4,y.toIFrame(a,p)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return b=me.sent(),k=md(v)||Q0(v)?dg(v.ownerDocument):ui(f,v),w=k.width,S=k.height,$=k.left,V=k.top,F=Qw(f,v,t.backgroundColor),x={canvas:t.canvas,backgroundColor:F,scale:(K=(re=t.scale)!==null&&re!==void 0?re:l.devicePixelRatio)!==null&&K!==void 0?K:1,x:((Y=t.x)!==null&&Y!==void 0?Y:0)+$,y:((W=t.y)!==null&&W!==void 0?W:0)+V,width:(j=t.width)!==null&&j!==void 0?j:Math.ceil(w),height:(ie=t.height)!==null&&ie!==void 0?ie:Math.ceil(S)},_?(f.logger.debug("Document cloned, using foreign object rendering"),T=new Sw(f,x),[4,T.render(v)]):[3,3];case 2:return Q=me.sent(),[3,5];case 3:return f.logger.debug("Document cloned, element located at "+$+","+V+" with size "+w+"x"+S+" using computed rendering"),f.logger.debug("Starting DOM parsing"),D=WA(f,v),F===D.styles.backgroundColor&&(D.styles.backgroundColor=Jl.TRANSPARENT),f.logger.debug("Starting renderer for element at "+x.x+","+x.y+" with size "+x.width+"x"+x.height),T=new bw(f,x),[4,T.render(D)];case 4:Q=me.sent(),me.label=5;case 5:return(!((he=t.removeContainer)!==null&&he!==void 0)||he)&&(Qu.destroy(b)||f.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),f.logger.debug("Finished rendering"),[2,Q]}})})},Qw=function(e,t,a){var l=t.ownerDocument,s=l.documentElement?xn(e,getComputedStyle(l.documentElement).backgroundColor):Jl.TRANSPARENT,i=l.body?xn(e,getComputedStyle(l.body).backgroundColor):Jl.TRANSPARENT,c=typeof a=="string"?xn(e,a):a===null?Jl.TRANSPARENT:4294967295;return t===l.documentElement?fs(s)?fs(i)?c:i:s:c};const Fa={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef&&Uw(a.targetRef,{useCORS:!0,scale:2,backgroundColor:null,scrollY:-window.scrollY}).then(s=>{const i=document.createElement("a");i.download="chart-screenshot.png",i.href=s.toDataURL(),i.click()})},a=e;return(l,s)=>(r(),E(Ze,{tag:"button",onClick:t,size:e.size,title:l.$t("Screenshot")},{default:d(()=>[n(J,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var Yi={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 Lu;function Dw(){return Lu||(Lu=1,function(e){var t=function(){var a=Array.prototype,l=function(_,g,y){return a.slice.apply(_,a.slice.call(arguments,1))},s="function",i=1e9,c=function(_,g,y,v){if(g|=0,g==0)return[];if(typeof _!==s){var b=c.listSchemes(_,g);if(!b.length)return null;_=b[(y||0)%b.length]}var k=l(arguments,2);return k[0]=g,_.apply(_,k)};c.Scheme=function(_,g){var y={},v=0,b=i,k=function(){if(arguments.length<=1)return w.color_func.bind(w);var S=l(arguments);return function($){return S[0]=$,w.color_func.apply(w,S)}},w=function(S,$){if(S|=0,!S)return[];var V=S;if(S=Math.abs(S),S<=v){for(var F=Math.max(S,b);!(F in y);++F);var x=y[F];if(F>S){var Q="shrinking_takes_head"in x?x.shrinking_takes_head:w.shrinking_takes_head;if(Q)x=x.slice(0,S),F=S;else return c.generate(function(D){return x[Math.round(D)]},V,0,x.length-1)}return x=x.slice(),V<0&&x.reverse(),x}else return w.color_func?c.generate(k.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(S,$){var V=S.length;V&&(y[V]=S,b=Math.min(b,V),v=Math.max(v,V),w.max=Math.max(w.max,V),!$&&V!=1&&(w.cbf_max=Math.min(w.cbf_max,V-1)))},w.addPalettes=function(S,$,V){$=$||S.length;for(var F=0;F<$;++F)F in S&&w.addPalette(S[F],!0);w.cbf_max=Math.min(w.cbf_max,V||1)},w.shrinkByTakingHead=function(S,$){$!==void 0?$ in y&&(y[$].shrinking_takes_head=!!S):w.shrinking_takes_head=!!S},w.setColorFunction=function(S,$,V){w.color_func=S,w.color_func_cyclic=!!V,w.max=i,!$&&w.cbf_max===i&&(w.cbf_max=1)},w.color=function(S,$){return w.color_func?w.color_func.apply(this,arguments):null},w},c.Scheme.fromPalettes=function(_,g,y,v,b){var k=c.Scheme(_,g);return k.addPalettes.apply(k,l(arguments,2)),k},c.Scheme.withColorFunction=function(_,g,y,v,b){var k=c.Scheme(_,g);return k.setColorFunction.apply(k,l(arguments,2)),k};var p={};c.register=function(_){p["n-"+_.scheme_name]=[_],_.groups.forEach(function(g){(p["g-"+g]=p["g-"+g]||[]).push(_)}),(p["g-all"]=p["g-all"]||[]).push(_)},c.listSchemes=function(_,g){g?g<0&&(g=-g):g=2;var y=[];return(typeof _=="string"?[_]:_).forEach(function(v){var b=v.substring(v.length-4)==="-cbf";b&&(v=v.substring(0,v.length-4));for(var k=p["g-"+v]||p["n-"+v]||[],w=0,S;S=k[w];++w)(b?S.cbf:S.max)>=g&&y.push(S)}),y.sort(function(v,b){return v.scheme_name>=b.scheme_name?v.scheme_name>b.scheme_name?1:0:-1}),y},c.generate=function(_,g,y,v,b){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 k=Math.abs(g),w=y,S=[],$=(v-y)/(b?k:k-1);--k>=0;w+=$)S.push(_(w));return g<0&&S.reverse(),S};var f=function(_){return _>0?_<1?_:1:0};return c.rgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=Number(Math.round(f(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},c.linearRgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=f(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("")},c.hsvColor=function(_,g,y){_*=6;var v=g===void 0?1:f(g),b=y===void 0?1:f(y),k=b*(1-v*Math.abs(_%2-1)),w=b*(1-v);switch(Math.floor(_)%6){case 0:return c.rgbColor(b,k,w);case 1:return c.rgbColor(k,b,w);case 2:return c.rgbColor(w,b,k);case 3:return c.rgbColor(w,k,b);case 4:return c.rgbColor(k,w,b);default:return c.rgbColor(b,w,k)}},c.register(c.Scheme.withColorFunction("rainbow","qualitative",c.hsvColor,!1,!0)),c}();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,c){for(var p=arguments.length-1,f=arguments[p];p>1;)f=f*i+arguments[--p];return f},s=function(i){var c=l(Math.abs(i),1,.278393,.230389,972e-6,.078108);return c*=c,c*=c,c=1-1/c,i<0?-c:c};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+s((i-.869)/.255)),1.021-.456*(1+s((i-.527)/.376)),1-.493*(1+s((i-.272)/.309)))},t.register(t.Scheme.withColorFunction("tol-sq","sequential",t.tolSequentialColor,!0)),t.tolDivergingColor=function(i){var c=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),c*c,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 s=a[l];s=t.Scheme.fromPalettes("cb-"+l,[s.type,"cb-"+s.type],s,12,s.cbf),t.register(s)}}(),e.exports&&(e.exports=t)}(Yi)),Yi.exports}Dw();class Vw extends Za{constructor(){super(...arguments);Re(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"}]});Re(this,"storageKey","chart-type");Re(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,s){const c=this.data[a].findIndex(p=>p.name===l);c!==-1?this.data[a][c].type=s:this.data[a].push({name:l,type:s}),this.syncStorage();for(let p in this.listeners)this.listeners[p](this.applicableFilters)}getChartType(a,l){const i=this.data[a].find(c=>c.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 ga=Vw.init();function Vs(e){const t=et(e[0]).format("MMMM D, YYYY"),a=et(e[1]).format("MMMM D, YYYY");return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Ts(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Pa[parseInt(l)-1]} ${s}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}function Ml(e){return e.map(t=>Ts(t.group))}const Oa=De.colors.report,Tw={[Oa.light_gray]:Oa.cyan_blue,[Oa.light_gray_cyan_blue]:Oa.cyan_blue_dark,[Oa.blue]:Oa.royal_blue,[Oa.royal_blue]:Oa.dark_blue,[Oa.medium_slate_blue]:Oa.dark_purple,[Oa.dark_cyan_blue_16]:Oa.dark_cyan_blue_40,[Oa.dark_cyan_blue_24]:Oa.dark_cyan_blue_40,[Oa.blue]:Oa.blue_dark_mode,[Oa.purple]:Oa.purple_dark_mode};function Ya(e){return Tw[e]}function ul(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const Mw={class:"fct-gross-sale-vs-net-revenue-wrap"},Lw={class:"fct-btn-group sm"},Rw={__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),s=M(null);M("daily");const i=M(ga.getChartType("order","sales_growth_chart")||"line"),c=De.colors.report,p=M(De.isDark()),f=N(()=>a.chartData.every(F=>F.orders===0)),_=N(()=>p.value?c.dark_cyan_blue_16:c.light_gray),g=N(()=>p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue),y=N(()=>[{title:bl("Orders","Chart series legend"),key:"orders",color:_.value,yAxisIndex:1},{title:bl("Revenue","Chart series legend"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:F,key:x,color:Q,yAxisIndex:D})=>$(F,i.value,a.chartData.map(T=>T[x]),Q,D)));Pa.map(F=>F.slice(0,3));const v=N(()=>Ml(a.chartData));let b=null;const k=()=>{b&&(b.dispose(),b=null),ke(()=>{l.value&&(b=aa(l.value),S())})},w=N(()=>ul(a.chartData.length)),S=()=>{if(!b)return;p.value=De.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:Ul(p.value,c.dark_cyan_blue_16,c.light_gray_blue,i.value),confine:!0,position:gl,formatter:x=>{let Q=x[0].name;return x.forEach(D=>{const T=D.seriesIndex===1?qa(D.value*100):D.value,U=p.value?"#ffffff":"#565865";Q+=`<div>
101 ${D.marker}
102 <span style="color: ${U};">${D.seriesName}</span>
103 <span style="float: right; margin-left: 20px; color: ${U};">
104 ${T}
105 </span>
106 </div>`}),Q}},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:bl("Revenue","Chart axis title"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:x=>`${pt.scaledChart(x)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:bl("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};b.setOption(F,{notMerge:!0,replaceMerge:["series"]})},$=(F,x,Q,D,T)=>({name:F,type:x,barMaxWidth:30,data:Q,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:Ya(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,ga.onChange("order","sales_growth_chart",F),S())};return be([()=>a.chartData,i],()=>{ke(S)},{deep:!0}),be(f,F=>{F||k()}),be(()=>a.loading,F=>{F||k()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",S),window.addEventListener("fluentCartCurrencyChange",S),ke(k)}),(F,x)=>{const Q=C("el-skeleton");return r(),h("div",Mw,[n(Be,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[n(Qe,{title:F.$t("Sales Growth"),border_bottom:""},oa({_:2},[!f.value&&!e.loading?{name:"action",fn:d(()=>[o("div",Lw,[n(Nl,{activeType:i.value,types:{bar:"BarChart",line:"LineChart"},onChange:V},null,8,["activeType"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[e.loading?(r(),E(Q,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(H,{key:1},[f.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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)])}}},Ow={class:"fct-gross-sale-vs-net-revenue-wrap"},Hw={class:"fct-btn-group sm"},Pw={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},Nw={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},Ru=.5,Wi=6,mo=1.2,Kw={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=De.colors,l=M(null),s=M(null),i=M(!1),c=M("world"),p=M(92),f=M(100);M(!1);let _=null,g=null,y=50;const v=M(1.2),b=M(),k=a.blue,w=N(()=>{const Y=f.value-p.value,W=t.data?t.data.length:0;return Y<60||W<15}),S=Y=>{Y=Y.replace(/^#/,"");const W=parseInt(Y.substring(0,2),16),j=parseInt(Y.substring(2,4),16),ie=parseInt(Y.substring(4,6),16);return[W,j,ie]},$=()=>De.isDark()?a.gray[50]:a.gray[600],V=S(k[500]),F=async()=>{const Y=ms.getUrl("world.geo.json"),j=await(await fetch(Y)).json();um("world",j)},x=Y=>{if(!Y||isNaN(Y))return`rgba(${V.join(",")}, 0)`;const W=Math.log(Y+1)/Math.log(y+1);return`rgba(${V.join(",")}, ${W})`},Q=Y=>{c.value=Y,X(),_&&(_.clear(),_.setOption(P()),Y==="bar"&&D()),g&&i.value&&(g.clear(),g.setOption(P()),Y==="bar"&&T())},D=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(Y){Y.batch&&Y.batch[0]?(p.value=Y.batch[0].start||0,f.value=Y.batch[0].end||100):(p.value=Y.start||0,f.value=Y.end||100),setTimeout(()=>{X()},100)}))},T=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(Y){Y.batch&&Y.batch[0]?(p.value=Y.batch[0].start||0,f.value=Y.batch[0].end||100):(p.value=Y.start||0,f.value=Y.end||100),setTimeout(()=>{g&&g.setOption(P())},100)}))},U=N(()=>(t.data||[]).map(Y=>({...Y,value:Y.value||0,itemStyle:{color:x(Y.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),I=()=>({backgroundColor:De.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:Y=>u("%1$s%2$s Orders: %3$s",Y.name,"<br>",Y.value||0),borderRadius:8,backgroundColor:De.isDark()?"#38485a":"#ffffff",borderColor:De.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:De.isDark()?"#ffffff":"#565865"}},visualMap:{min:0,max:y,left:i.value?"5%":"center",bottom:i.value?"center":"4%",text:[u("High"),u("Low")],orient:i.value?"vertical":"horizontal",calculable:!0,inRange:{color:[k[100],k[500]]},textStyle:{color:a.gray[800]}},series:[{name:"Orders",type:"map",map:"world",roam:b.value,zoom:v.value,label:{show:!1,emphasis:{show:!0,color:a.gray[1e3],fontWeight:"bold",textShadowColor:a.gray[50],textShadowBlur:3,textShadowOffsetX:0,textShadowOffsetY:0}},emphasis:{itemStyle:{areaColor:k[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:U.value}]}),O=N(()=>{const Y=t.data.length,W=f.value-p.value,j=Math.ceil(Y*W/100);let ie=0;return j>100?ie=9:j>50?ie=4:j>30?ie=2:j>20&&(ie=1),ie}),L=()=>{const Y=w.value;return{backgroundColor:De.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(W){const j=W[0];return`${j.name}<br/>${u("Orders")}: ${j.value||0}`},backgroundColor:De.isDark()?"#38485a":"#ffffff",textStyle:{color:De.isDark()?a.gray[25]:a.system.mid},borderColor:De.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:p.value,end:f.value},{type:"slider",yAxisIndex:0,start:p.value,end:f.value,width:25,top:10,right:10,textStyle:{color:$()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:Y?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:Y},splitLine:{show:!1},axisLine:{show:Y,lineStyle:{color:$()}},axisLabel:{show:Y,interval:O.value,color:$(),fontSize:11},data:t.data.map(W=>W.name)},xAxis:{type:"value",axisLabel:{show:!0,color:$(),formatter:function(W){return W.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:De.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new Ar(0,0,1,0,[{offset:0,color:k[400]},{offset:1,color:k[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new Ar(0,0,1,0,[{offset:0,color:k[500]},{offset:1,color:k[700]}])}},data:t.data.map(W=>W.value),label:{show:Y,formatter:"{c}",position:"right",color:$(),fontSize:10}}]}},P=()=>c.value==="bar"?L():I(),q=async()=>{await F(),l.value&&(_=aa(l.value),_.setOption(P()),c.value==="bar"&&D(),_.on("georoam",()=>{const W=_.getOption().series[0].zoom;if(W!==v.value)if(W<mo||W>Wi){const j=Math.max(mo,Math.min(Wi,W));_.setOption({series:[{zoom:j}]},!1),v.value=j}else v.value=W}))},X=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(Y=>Y.value||0)):y=1,_&&_.setOption(P(),{notMerge:!0})},G=()=>{v.value=Math.min(v.value+Ru,Wi),b.value=!0,_.setOption({series:[{zoom:v.value,roam:b.value}]})},te=()=>{v.value=Math.max(v.value-Ru,mo),b.value=!0,_.setOption({series:[{zoom:v.value,roam:b.value}]})},ne=()=>{c.value==="bar"?(p.value=92,f.value=100,_&&_.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=mo,b.value="move",_&&(_.clear(),_.setOption(P())))},re=async()=>{i.value=!0,await ke(),g?g.clear():g=aa(s.value),g.setOption(P()),c.value==="bar"&&T()},K=Y=>{$(),_&&_.setOption(P())};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",K),b.value="move",ke(q)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",K),_&&(_.dispose(),_=null),g&&(g.dispose(),g=null)}),be(()=>t.data,()=>X(),{deep:!0}),be(w,()=>{c.value==="bar"&&ke(()=>{X()})}),(Y,W)=>(r(),h("div",Ow,[n(Be,{id:"chartContainer",class:"mb-0"},{default:d(()=>[n(Qe,{title:Y.$t("Order Heat Map"),border_bottom:""},{action:d(()=>[o("div",Hw,[n(Nl,{activeType:c.value,types:{world:"Globe",bar:"BarChart"},onChange:Q},null,8,["activeType"]),n(Fa,{targetRef:l.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),n(Ce,{class:"p-0 pt-0 relative"},{default:d(()=>[c.value==="world"?(r(),h("div",Pw,[n(Ze,{tag:"button",size:"small",onClick:G},{default:d(()=>[n(J,{name:"Plus"})]),_:1}),n(Ze,{tag:"button",size:"small",onClick:te},{default:d(()=>[n(J,{name:"Minus"})]),_:1}),n(Ze,{tag:"button",size:"small",onClick:ne},{default:d(()=>[n(J,{name:"Reload"})]),_:1}),n(Ze,{tag:"button",size:"small lg:hidden",onClick:re},{default:d(()=>[n(J,{name:"Eye"})]),_:1})])):B("",!0),c.value==="bar"?(r(),h("div",Nw,[n(Ze,{tag:"button",size:"small",onClick:ne},{default:d(()=>[n(J,{name:"Reload"})]),_:1})])):B("",!0),o("div",{class:"fct-chart-wrap rounded-[0px] bg-transparent",ref_key:"chartRef",ref:l},null,512)]),_:1})]),_:1}),n(A(mm),{modelValue:i.value,"onUpdate:modelValue":W[0]||(W[0]=j=>i.value=j),title:Y.$t("Order Heat Map"),class:"country-heat-map-dialog"},{default:d(()=>[o("div",{class:"fct-chart-wrap",ref_key:"modalChartRef",ref:s},null,512)]),_:1},8,["modelValue","title"])]))}},Gw=lt(Kw,[["__scopeId","data-v-36a900c8"]]),jw={class:"fct-report-card"},zw={key:0,class:"fct-report-card-header"},qw={key:0,class:"flex items-center gap-2"},Yw={class:"title"},Ww={class:"actions"},Jw={class:"fct-report-card-body flex h-full"},Xw={class:"w-full"},Pn={__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",jw,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",zw,[e.cardOptions.heading?(r(),h("div",qw,[e.cardOptions.headingIcon?(r(),E(Ze,{key:0,size:"x-small",bg:"danger",soft:""},{default:d(()=>[n(J,{name:"FailedCircle"})]),_:1})):B("",!0),o("h4",Yw,m(e.cardOptions.heading),1)])):B("",!0),o("div",Ww,[e.cardOptions.linkButtonText?(r(),E(l,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:d(()=>[R(m(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):B("",!0),ba(t.$slots,"action")])])):B("",!0),o("div",Jw,[o("div",Xw,[ba(t.$slots,"default")])])])}}},Zw={key:0,class:"fct-report-sold-product-list has-scroll"},eC={class:"list-left-content"},tC={class:"list-title"},aC={class:"list-title-inner"},lC={class:"list-id"},sC={class:"list-right-content"},nC=["innerHTML"],oC={class:"list-price"},iC={__name:"RecentOrders",setup(e){const t=ol.data;return(a,l)=>{const s=C("router-link");return r(),E(Pn,{class:"top-sold-products","card-options":{heading:A(u)("Recent Orders"),linkButtonText:A(u)("View All"),linkButtonUrl:"orders"}},{default:d(()=>{var i,c;return[((c=(i=A(t))==null?void 0:i.recentOrders)==null?void 0:c.length)>0?(r(),h("ul",Zw,[(r(!0),h(H,null,ae(A(t).recentOrders,p=>(r(),h("li",{key:p.id},[n(s,{class:"no-underline",to:{name:"view_order",params:{order_id:p.id}}},{default:d(()=>[o("div",eC,[o("div",tC,[o("div",aC,m(p.customer_name)+" #"+m(A(ta)(p.id)),1),o("div",lC,[n(Na,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",sC,[o("div",{class:"list-value",innerHTML:A(pt).scaled(p.total_amount)},null,8,nC),o("div",oC,m(A(ta)(p.order_items_count))+" "+m(A(u)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},rC={key:0},dC={key:1,class:"fc_dashboard_onboarding_wrap"},uC={class:"fc_dashboard_onboarding_title"},cC={class:"fc_dashboard_onboarding_lists"},AC=["href"],pC={class:"circle-shape"},fC={class:"fc_dashboard_onboarding_item__title"},mC={__name:"Onboarding",setup(e){const t=M(0),a=M(!1);Yt().ctx;const l=M([]),s=M(!0);M(localStorage.getItem("started_content_collapse")==="true"||!1),N(()=>{const p=Object.keys(l.value).length;return p?Math.round(t.value/p*100):0});const i=p=>p.hash_id?p.url+"#"+p.hash_id:p.url,c=ai("dashboardTogglePageNotification");return Ie(async()=>{a.value=!0,ue.get("dashboard").then(p=>{var _,g;l.value=p.data.steps,t.value=p.data.completed,s.value=Object.keys(l.value).length!==t.value,a.value=!1;let f=((_=l.value.page_setup)==null?void 0:_.completed)||!1;c&&c(!f,((g=l.value.page_setup)==null?void 0:g.url)||"")}).catch(p=>{a.value=!1})}),(p,f)=>{const _=C("el-skeleton"),g=C("Check"),y=C("el-icon");return s.value?(r(),h("div",rC,[a.value?(r(),E(_,{key:0,rows:3,animated:""})):(r(),h("div",dC,[o("h3",uC,m(p.$t("Getting Started")),1),o("div",cC,[(r(!0),h(H,null,ae(l.value,(v,b)=>(r(),h("a",{key:b,href:i(v),class:de([v.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",pC,[v.completed===!0?(r(),E(y,{key:0},{default:d(()=>[n(g)]),_:1})):B("",!0)]),o("div",fC,m(v.title),1)],10,AC))),128))])]))])):B("",!0)}}},hC={class:"fct-dashboard-recent-activities-wrap"},_C={class:"fct-dashboard-recent-activities__header"},vC={class:"fct-dashboard-recent-activities__header_title"},gC={class:"fct-dashboard-recent-activities__header_desc"},yC={key:0,class:"fct-dashboard-recent-activities__body"},bC={class:"content"},wC={class:"title"},CC=["onClick"],kC={class:"date"},BC=["innerHTML"],xC={class:"created_by"},SC={key:1,class:"fct-dashboard-recent-activities__empty"},FC={class:"fct-dashboard-recent-activities__empty_text"},$C={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=ll(),l=M([{label:bl("All","Activity filter button"),value:"all"},{label:bl("Today","Activity filter button"),value:"today"},{label:bl("Yesterday","Activity filter button"),value:"yesterday"},{label:bl("This Week","Activity filter button"),value:"this_week"}]),s=M("all"),i=()=>{switch(s.value){case"all":return bl("all","Activity filter, mid-sentence");case"today":return bl("today","Activity filter, mid-sentence");case"yesterday":return bl("yesterday","Activity filter, mid-sentence");case"this_week":return bl("this week","Activity filter, mid-sentence");default:return s.value}},c=()=>{i(),ol.getRecentActivities({groupKey:s.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"},f={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 b=(w=v==null?void 0:v.module_name)==null?void 0:w.toLowerCase();const k=f[b];k&&v.module_id&&g(v)&&a.push({name:k.name,params:{[k.param]:v.module_id}})},g=v=>{if(!v.module_name)return!0;const b=it.get(p,ca.capitalize(v.module_name));return b?In.has(b):!1},y=N(()=>ol.data.recentActivities.filter(v=>g(v)));return Ie(()=>{c()}),(v,b)=>{const k=C("el-radio-button"),w=C("el-radio-group");return r(),h("div",hC,[o("div",_C,[o("h4",vC,m(A(u)("Recent Activities")),1),o("p",gC,[s.value==="all"?(r(),h(H,{key:0},[R(m(A(u)("%1$s new activities",A(ta)(y.value.length))),1)],64)):(r(),h(H,{key:1},[R(m(A(u)("%1$s new activities %2$s",A(ta)(y.value.length),i())),1)],64))]),n(w,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=S=>s.value=S),onChange:c,size:"large"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,(S,$)=>(r(),E(k,{key:$,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),y.value.length?(r(),h("div",yC,[(r(!0),h(H,null,ae(y.value,(S,$)=>{var V;return r(),h("div",{key:$,class:"fct-dashboard-recent-activities__item has-icon"},[b[1]||(b[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",bC,[o("h3",wC,[f[(V=S.module_name)==null?void 0:V.toLowerCase()]?(r(),h("span",{key:0,onClick:F=>_(S),class:"cursor-pointer"},m(S.title||"--"),9,CC)):(r(),h(H,{key:1},[R(m(S.title||"--"),1)],64)),o("span",kC,[n(Na,{"date-time":S.created_at},null,8,["date-time"])])]),o("p",{innerHTML:S.content,class:"description"},null,8,BC),o("span",xC,m(A(u)("By %s",S.created_by)),1)])])}),128))])):(r(),h("div",SC,[o("div",FC,m(A(u)("No activity found.")),1)]))])}}},EC={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},UC={__name:"SideBar",setup(e){return(t,a)=>(r(),h("div",EC,[n(Rt,{permission:"is_super_admin"},{default:d(()=>[n(mC)]),_:1}),n($C,{onReload:a[0]||(a[0]=()=>{})})]))}},IC={class:"fct-product-create"},QC={class:"fct-product-step"},DC={class:"fct-product-item-selector"},VC=["onClick"],TC={class:"fct-product-item-selector-content"},MC={class:"fct-bundle-product-condition"},LC={class:"condition-text"},RC={class:"dialog-footer"},yi={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,l=t,s=ll(),i=Ge.get("variation_types",{}),c=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:u("Physical Product"),icon:"Gift"},{type:"digital",title:u("Digital Product"),icon:"Code"}],f=M(!1),_=M(null),g=b=>{c.value.detail.fulfillment_type=b},y=()=>{f.value=!0,ue.post("products",{...c.value}).then(b=>{if(z.success(b.message),a.customModal==="order_modal"){const k={id:b.data.product_variants.id,object_id:b.data.product_variants.post_id,variation_id:b.data.product_variants.id,item_name:b.data.product_variants.variation_title,item_price:b.data.product_variants.item_price,quantity:1,stock:100,object_type:b.data.product_details.fulfillment_type,item_total:b.data.product_variants.item_price,line_total:b.data.product_variants.item_price,tax_amount:0,discount_total:0};l("process_custom",k),l("update:createProductModal",!1)}else s.push({name:"product_edit",params:{product_id:b.data.ID}})}).catch(b=>{var k;b.status_code=="422"?z.validationErrors(b):z.error((k=b.data)==null?void 0:k.message)}).finally(()=>{f.value=!1})},v=b=>{b.stopPropagation(),b.preventDefault(),y()};return Ie(()=>{ke(()=>{setTimeout(()=>{var b;(b=_.value)==null||b.focus()},10)})}),(b,k)=>{const w=C("el-input"),S=C("el-form-item"),$=C("el-option"),V=C("el-select"),F=C("el-checkbox"),x=C("el-form"),Q=C("el-button");return r(),h("div",IC,[o("div",QC,[n(x,{"label-position":"top",model:c.value,"require-asterisk-position":"right"},{default:d(()=>[n(S,{label:c.value.detail.other_info.is_bundle_product==="yes"?A(u)("Bundle Title"):A(u)("Product Title"),required:""},{default:d(()=>[n(w,{type:"text",modelValue:c.value.post_title,"onUpdate:modelValue":k[0]||(k[0]=D=>c.value.post_title=D),placeholder:c.value.detail.other_info.is_bundle_product==="yes"?A(u)("Bundle Title"):A(u)("Product Title"),minlength:"3",maxlength:"200","show-word-limit":"",autofocus:"",ref_key:"fcProductTitle",ref:_,onKeydown:xa(v,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),e.customModal!=="order_modal"?(r(),E(S,{key:0,label:A(u)("Variation Type")},{default:d(()=>[n(V,{modelValue:c.value.detail.variation_type,"onUpdate:modelValue":k[1]||(k[1]=D=>c.value.detail.variation_type=D),placeholder:A(u)("Select Variation Type"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(A(i),(D,T)=>(r(),E($,{key:T,label:D,value:T},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):B("",!0),n(S,null,{default:d(()=>[o("ul",DC,[(r(),h(H,null,ae(p,D=>o("li",{key:D.type,class:de({active:D.type===c.value.detail.fulfillment_type}),onClick:T=>g(D.type)},[o("div",TC,[n(J,{name:D.icon},null,8,["name"]),R(" "+m(D.title),1)]),k[3]||(k[3]=o("div",{class:"fct-product-item-selector-dot-wrap"},[o("span",{class:"fct-product-item-selector-dot"})],-1))],10,VC)),64))])]),_:1}),n(S,null,{default:d(()=>[o("div",MC,[n(F,{modelValue:c.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":k[2]||(k[2]=D=>c.value.detail.other_info.is_bundle_product=D),"true-value":"yes","false-value":"no"},{default:d(()=>[R(m(A(u)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),o("span",LC,m(A(u)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",RC,[n(Q,{disabled:!c.value.post_title||f.value,loading:f.value,onClick:y,type:"primary"},{default:d(()=>[R(m(f.value?A(u)("Creating"):A(u)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class hd{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new hd().getHours();if(t>=5&&t<12)return u("Good morning");if(t>=12&&t<17)return u("Good afternoon");if(t>=17&&t<21)return u("Good evening");{const a=[u("Step into the moonlight!"),u("Evening vibes!"),u("The night's still young!")];return a[Math.floor(Math.random()*a.length)]}}}const OC={class:"fct-current-user-info-wrap"},HC={class:"fct-current-user-info-content"},PC={class:"image"},NC=["src","alt"],KC={class:"content"},GC={key:0,class:"fct-current-user-info-action"},jC={__name:"CurrentUserInfo",setup(e){const t=M(!1),a=M(Ge.get("me")),l=()=>Ge.get("shop.store_name"),s=Ge.get("total_products_count");return(i,c)=>{const p=C("el-button"),f=C("el-dialog");return r(),h("div",OC,[o("div",HC,[o("div",PC,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,NC)]),o("div",KC,[o("h4",null,m(A(hd).greeting())+" "+m(a.value.full_name)+" 👋🏻",1),o("p",null,m(A(u)("Welcome to %1$s",l())),1)])]),n(Rt,{permission:"products/create"},{default:d(()=>[A(s)==0?(r(),h("div",GC,[n(p,{onClick:c[0]||(c[0]=_=>t.value=!0),type:"primary"},{default:d(()=>[R(m(A(u)("Add Product")),1)]),_:1})])):B("",!0)]),_:1}),n(f,{"append-to-body":!0,modelValue:t.value,"onUpdate:modelValue":c[1]||(c[1]=_=>t.value=_),onClose:c[2]||(c[2]=_=>t.value=!1),title:A(u)("Add New Product")},{default:d(()=>[n(yi)]),_:1},8,["modelValue","title"])])}}};class zC{constructor(){Re(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});Re(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 qC{constructor(){Re(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});Re(this,"defaultModifierMethod",null)}getModificationMethod(t){return t==="=="||t==="==="?"matchEqual":this.modifierMap.hasOwnProperty(t)?this.modifierMap[t]:this.defaultModifierMethod}applyAddition(t,a,l,s,i){return t+a}}class YC{constructor(t,a){Re(this,"value");Re(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 Mr?this.value.setModifiers([]).build():this.value}}}class Mr{constructor(t,a){Re(this,"accessor");Re(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 YC?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class Es{constructor(t,a,l,s,i){Re(this,"conditionType");Re(this,"conditions");Re(this,"key");Re(this,"operator");Re(this,"value");this.key=t,this.value=a,this.operator=l,this.conditions=[],this.conditionType=this.buildConditionType(s),this.setConditions(i)}static make(t,a,l,s){return new this(t,a,l,s)}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 Es||typeof t=="function"?t:this.conditions,this}build(){if(Array.isArray(this.conditions)&&this.conditions.length>0){let l=[];return l=this.conditions.map(s=>s instanceof Es?s.build.bind(s)():s),{condition_type:this.conditionType,conditions:l}}const t=this.key instanceof Mr?this.key.build():this.key,a=this.value instanceof Mr?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class WC{constructor(t,a){Re(this,"data");Re(this,"conditions");Re(this,"stateKey");Re(this,"matcher");Re(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new zC,this.modifier=new qC}match(t,a,l,s=!0){let i="",c=this.matcher.getMatchingMethod(a);return c!=null?i=c:i=ca.camel("match"+a),i in this.matcher&&typeof this.matcher[i]=="function"?this.matcher[i](t,l,a,s):s}evaluate(t,a="and"){if(t instanceof Es){const s=t.build.bind(t)();s.hasOwnProperty("conditions")?(t=s.conditions,a=s.condition_type):t=[s]}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 s of t){let i=null;if(Array.isArray(it.get(s,"conditions")))i=this.evaluate(s.conditions,it.get(s,"condition_type","and"));else{if(s.key===null||s.key===void 0){l=!0;continue}i=this.applyCondition(s)}l=a==="and"?l&&i:l||i}return l}applyCondition(t){let a="",l=null;typeof t.key=="object"?a=it.resolvePath(this.stateKey,it.get(t,"key.accessor")):a=it.resolvePath(this.stateKey,t.key);let s=it.get(this.data,a);if(typeof t.value=="object"){const i=it.resolvePath(this.stateKey,it.get(t,"value.accessor"));l=it.get(this.data,i)}else l=t.value;return s=this.applyModification(s,t.key.modifiers,this.stateKey),l=this.applyModification(l,t.value.modifiers,this.stateKey),this.match(s,t.operator,l)}applyModification(t,a,l){return Array.isArray(a)&&a.forEach(s=>{let i=s.operator,c="",p=this.modifier.getModificationMethod(i);if(p!=null?c=p:c=ca.camel("apply"+i),c in this.modifier&&typeof this.modifier[c]=="function"){let f=s.value;typeof f=="object"&&f!==null&&(f=it.getByPath(this.data,l,it.get(f,"accessor"))),t=this.modifier[c](t,f,i,l,this.data)}}),t}}class cp{constructor(){Re(this,"_conditionType","and");Re(this,"_conditions",null)}conditionType(t){return this._conditionType=t,this}conditions(t){return this._conditions=Array.isArray(t)||t instanceof Es||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 Es?a.build.bind(a)():a):t}}class Ap{constructor(){Re(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class No{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new No;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 Lr{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="",As.install(this,oA),As.install(this,Ap),As.install(this,cp),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 Es?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??u(ca.headline(this._key)),label:this._label??u(ca.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 No?this._suffix.build():this._suffix,prefix:this._prefix instanceof No?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Rr{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,As.install(this,oA),As.install(this,Ap),As.install(this,cp)}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=nn.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 Ou{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");As.install(this,Lr,{key:t}),As.install(this,Rr,{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=nn.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??u(ca.headline(this._key)),label:this._label??u(ca.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 nn{static build(t){return Array.isArray(t)?nn.buildFromArray(t):typeof t=="object"?nn.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((l,s)=>{const i=t[l];i instanceof Lr||i instanceof Rr||i instanceof Ou?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 Lr||l instanceof Rr||l instanceof Ou){let s=l.build.bind(l)();a[s.key]=s}else a[l.key]=l}),a}}class JC extends Za{constructor(){super(...arguments);Re(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});Re(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);Re(this,"ignorableFormLayouts",["grid"])}get hasChange(){return this.data.hasChange}setSchema(a){return this.data.schema=nn.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((s,i)=>{const c=a[i];if(c.type==="html")return s;if(this.nestedFormLayouts.includes(c.type??""))if(c.disable_nesting===!0){const p=this.ensureNestedDataProperties(c.schema??{},l??{});s={...s,...p}}else s[i]=this.ensureNestedDataProperties(c.schema??{},l[i]??{});else s[i]=l[i]??c.value??"";return s},{})}isVisible(a,l){return a.hasOwnProperty("conditions")?new WC(l,this.values).evaluate(it.get(a,"conditions"),it.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){it.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 _d(){return JC.init()}const XC=["innerHTML"],Or={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,XC))}},ZC=Object.freeze(Object.defineProperty({__proto__:null,default:Or},Symbol.toStringTag,{value:"Module"})),Hu=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:de(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),h(H,null,ae(e.form.getValidationError(e.errorKey),(l,s)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},m(l),1))),128))],2)):B("",!0)}}),pp={__name:"Resolver",props:_l({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=El(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>Jt(()=>import("./chunks/Test.js?ver=1.6.2"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>Jt(()=>Promise.resolve().then(()=>A2),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>Jt(()=>Promise.resolve().then(()=>x2),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>Jt(()=>Promise.resolve().then(()=>S2),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>Jt(()=>Promise.resolve().then(()=>ZC),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>Jt(()=>Promise.resolve().then(()=>h2),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>Jt(()=>Promise.resolve().then(()=>X2),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>Jt(()=>Promise.resolve().then(()=>f2),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>Jt(()=>Promise.resolve().then(()=>U2),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>Jt(()=>Promise.resolve().then(()=>E2),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>Jt(()=>Promise.resolve().then(()=>c2),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>Jt(()=>Promise.resolve().then(()=>F2),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>Jt(()=>Promise.resolve().then(()=>t2),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>Jt(()=>Promise.resolve().then(()=>i2),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>Jt(()=>Promise.resolve().then(()=>r2),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>Jt(()=>Promise.resolve().then(()=>d2),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>Jt(()=>import("./chunks/BuyProducts.js?ver=1.6.2"),[],import.meta.url),"./Coupon/Categories.vue":()=>Jt(()=>import("./chunks/Categories.js?ver=1.6.2"),[],import.meta.url),"./Coupon/Code.vue":()=>Jt(()=>import("./chunks/Code.js?ver=1.6.2"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>Jt(()=>import("./chunks/GetProducts.js?ver=1.6.2"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>Jt(()=>import("./chunks/Categories2.js?ver=1.6.2"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>Jt(()=>import("./chunks/Product.js?ver=1.6.2"),[],import.meta.url),"./Coupon/Products.vue":()=>Jt(()=>import("./chunks/Products.js?ver=1.6.2"),[],import.meta.url),"./McpSettings.vue":()=>Jt(()=>import("./chunks/McpSettings.js?ver=1.6.2"),[],import.meta.url),"./ModuleSettings.vue":()=>Jt(()=>import("./chunks/ModuleSettings.js?ver=1.6.2"),[],import.meta.url),"./PaymentView.vue":()=>Jt(()=>import("./chunks/PaymentView.js?ver=1.6.2"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>Jt(()=>import("./chunks/AddressComponent.js?ver=1.6.2"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>Jt(()=>import("./chunks/CreatePageButton.js?ver=1.6.2"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>Jt(()=>import("./chunks/PageSelector.js?ver=1.6.2"),[],import.meta.url),"./StoreSettings/SubscriptionModeManager.vue":()=>Jt(()=>import("./chunks/SubscriptionModeManager.js?ver=1.6.2"),[],import.meta.url),"./TurnstileSettings.vue":()=>Jt(()=>import("./chunks/TurnstileSettings.js?ver=1.6.2"),[],import.meta.url)}),l=Ef(null);Ie(()=>{s(i.name)});const s=async c=>{const p=`./${c}.vue`;a[p]&&(l.value=(await a[p]()).default)},i=e;return(c,p)=>(r(),h(H,null,[(r(),E(Bl(l.value),ya({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]=f=>t.value=f)}),null,16,["modelValue"])),ba(c.$slots,"fieldNote"),ba(c.$slots,"validationError")],64))}},e2=["id"],vd={__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,s,i,c,p,f,_,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:ua({"--grid-columns":((l=e.field.columns)==null?void 0:l.default)??2,"--sm-grid-columns":((s=e.field.columns)==null?void 0:s.sm)??((i=e.field.columns)==null?void 0:i.default)??2,"--md-grid-columns":((c=e.field.columns)==null?void 0:c.sm)??((p=e.field.columns)==null?void 0:p.md)??((f=e.field.columns)==null?void 0:f.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})},[n(Ci,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],12,e2)}}},t2=Object.freeze(Object.defineProperty({__proto__:null,default:vd},Symbol.toStringTag,{value:"Module"})),a2={key:0,class:"fct-content-card-header"},l2={key:0,class:"title"},s2={key:1,class:"fct-content-card-action"},n2={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:de({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",a2,[e.title||t.$slots.title?(r(),h("div",l2,[ba(t.$slots,"title",{},()=>[R(m(e.title),1)])])):B("",!0),t.$slots.action?(r(),h("div",s2,[ba(t.$slots,"action")])):B("",!0)])):B("",!0),o("div",{class:de({"fct-content-card-body":e.show_heading!==!1})},[ba(t.$slots,"default")],2)],2))}},o2=["id"],fp={__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||""},[n(Be,null,{default:d(()=>[e.field.show_title!==!1?(r(),E(Qe,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):B("",!0),n(Ce,null,{default:d(()=>[n(vd,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,o2))}},i2=Object.freeze(Object.defineProperty({__proto__:null,default:fp},Symbol.toStringTag,{value:"Module"})),mp={__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([]),s=ll(),i=_=>{const g=_.props.name;c(g)},c=_=>{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 f;return Ie(()=>{f=s.beforeEach((_,g,y)=>{y(),setTimeout(()=>{p()},200)}),p()}),xt(()=>{f&&f()}),(_,g)=>{const y=C("el-tabs");return r(),E(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:de(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:i,type:"card"},{default:d(()=>[n(Ci,{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"])}}},r2=Object.freeze(Object.defineProperty({__proto__:null,default:mp},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:d(()=>[n(Ci,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},d2=Object.freeze(Object.defineProperty({__proto__:null,default:hp},Symbol.toStringTag,{value:"Module"}));class gd{}Re(gd,"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 s={};typeof t.events!="object"&&(s={}),s.hasOwnProperty("onChange")&&typeof s.onChange=="function"?s.onChange=(...i)=>{l.data.hasChange=!0,s.onChange(i)}:s.onChange=()=>{l.data.hasChange=!0};for(let i in t.events)s[i]=(...c)=>{a(t.events[i],c)};for(let i in t.attributes??{}){let c=t.attributes[i];typeof c=="function"&&await a(c,{})}return{...t.attributes??{},...s}});const u2={__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;Yt().ctx;const a=(i,c)=>{if(typeof i=="function")return i({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(c)&&c.length===1?c[0]:c})},l=M(!1),s=M({});return Ie(async()=>{s.value=await gd.attributesBuilders(t.field,a,t.form),l.value=!0}),(i,c)=>(r(),h(H,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),E(vd,ya({key:0,class:e.field.wrapperClass,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},s.value),null,16,["class","form","field","value","fieldKey","statePath"])):B("",!0),e.field.type==="tab"&&typeof e.field.schema<"u"?(r(),E(mp,ya({key:1,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},s.value),null,16,["form","field","value","statePath"])):B("",!0),e.field.type==="tab-pane"&&typeof e.field.schema<"u"&&typeof e.field.title<"u"?(r(),E(hp,ya({key:2,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},s.value),null,16,["form","field","value","fieldKey","statePath"])):B("",!0),e.field.type==="section"?(r(),E(fp,ya({key:3,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},s.value),null,16,["form","statePath","field","field-key","value","nesting"])):B("",!0)],64))}},_p={__name:"Switch",props:_l({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=El(e,"modelValue");return(a,l)=>{const s=C("el-switch");return r(),E(s,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},c2=Object.freeze(Object.defineProperty({__proto__:null,default:_p},Symbol.toStringTag,{value:"Module"})),vp={__name:"Checkbox",props:_l({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=El(e,"modelValue");return(a,l)=>{const s=C("el-checkbox");return r(),E(s,ya({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:d(()=>[R(m(e.label),1)]),_:1},16,["modelValue","disabled"])}}},A2=Object.freeze(Object.defineProperty({__proto__:null,default:vp},Symbol.toStringTag,{value:"Module"})),p2=["innerHTML"],gp={__name:"RadioGroup",props:_l({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=El(e,"modelValue"),a=e,l=M([]),s=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 Ie(async()=>{await s()}),(i,c)=>{const p=C("el-radio"),f=C("el-radio-group");return r(),E(f,ya({modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=_=>t.value=_)},e.attribute,{class:"inline-flex items-center gap-4"}),{default:d(()=>[(r(!0),h(H,null,ae(e.field.options,(_,g)=>(r(),h("div",{key:g,class:de(_.option_class)},[n(p,{value:_.value},{default:d(()=>[R(m(_.label),1)]),_:2},1032,["value"]),_.note?(r(),h("div",{key:0,innerHTML:_.note,class:"radio-option-note"},null,8,p2)):B("",!0)],2))),128))]),_:1},16,["modelValue"])}}},f2=Object.freeze(Object.defineProperty({__proto__:null,default:gp},Symbol.toStringTag,{value:"Module"})),m2=["innerHTML"],qs={__name:"Input",props:_l({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=Yt().ctx,a=El(e,"modelValue"),l=e,s=M(),i=async()=>{typeof l.field.prefix=="function"?s.value=await l.callback(l.field.prefix):s.value=l.field.prefix};return Ie(()=>{i()}),Uf(()=>{i()}),N(()=>l.fieldKey==="amount"?l.form.data.values.type==="fixed"?Ge.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(c,p)=>{var _;const f=C("el-input");return r(),E(f,ya({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),oa({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:d(()=>[n(pp,{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:d(()=>[o("div",{innerHTML:s.value},null,8,m2)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},h2=Object.freeze(Object.defineProperty({__proto__:null,default:qs},Symbol.toStringTag,{value:"Module"})),_2={key:0,class:"fct-color-presets-section"},v2=["aria-label"],g2=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],y2={class:"fct-color-custom-row"},b2={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},w2={key:1,class:"fct-color-picker-box"},C2={class:"fct-color-picker-trigger-wrap"},k2={key:0,class:"text-xs text-system-light"},B2={key:1,class:"fct-color-picker-action-wrap"},yd={__name:"ColorPicker",props:_l({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=El(e,"modelValue"),a=()=>{t.value=""},l=f=>f?ys.findIndex(_=>_.toLowerCase()===f.toLowerCase()):-1,s=M(Math.max(0,l(t.value)));be(t,f=>{const _=l(f);_>=0&&(s.value=_)});const i=M([]),c=(f,_)=>{t.value=f,s.value=_},p=(f,_)=>{let g=_;if(f.key==="ArrowRight"||f.key==="ArrowDown")g=(_+1)%ys.length;else if(f.key==="ArrowLeft"||f.key==="ArrowUp")g=(_-1+ys.length)%ys.length;else if(f.key==="Home")g=0;else if(f.key==="End")g=ys.length-1;else return;f.preventDefault(),c(ys[g],g),ke(()=>{i.value[g]&&i.value[g].focus()})};return(f,_)=>{const g=C("el-color-picker"),y=C("el-input");return e.withPresets?(r(),h("div",_2,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":A(u)("Color presets")},[(r(!0),h(H,null,ae(A(ys),(v,b)=>(r(),h("button",{key:v,ref_for:!0,ref:k=>i.value[b]=k,type:"button",class:de(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===v.toLowerCase()}]),style:ua({background:v,"--swatch-color":v}),"aria-label":A(u)("Select color %1$s",v),"aria-pressed":!!(t.value&&t.value.toLowerCase()===v.toLowerCase()),tabindex:b===s.value?0:-1,onClick:k=>c(v,b),onKeydown:k=>p(k,b)},null,46,g2))),128))],8,v2),o("div",y2,[o("div",b2,[n(g,ya({modelValue:t.value,"onUpdate:modelValue":_[0]||(_[0]=v=>t.value=v),"color-format":"hex"},e.attribute,{disabled:e.field&&e.field.disabled}),null,16,["modelValue","disabled"])]),n(y,{modelValue:t.value,"onUpdate:modelValue":_[1]||(_[1]=v=>t.value=v),placeholder:A(u)("#000000"),"aria-label":A(u)("Hex color code")},null,8,["modelValue","placeholder","aria-label"])])])):(r(),h("div",w2,[o("div",C2,[n(g,ya({modelValue:t.value,"onUpdate:modelValue":_[2]||(_[2]=v=>t.value=v)},e.attribute,{disabled:e.field&&e.field.disabled,"popper-class":"fct-color-picker-popover"}),null,16,["modelValue","disabled"]),t.value?B("",!0):(r(),E(J,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),t.value?B("",!0):(r(),h("span",k2,m(A(u)("Add...")),1)),t.value?(r(),h("div",B2,[o("span",null,m(t.value),1),n(J,{name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})])):B("",!0)]))}}},x2=Object.freeze(Object.defineProperty({__proto__:null,default:yd},Symbol.toStringTag,{value:"Module"})),yp={__name:"Date",props:_l({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=El(e,"modelValue");return(a,l)=>{const s=C("el-date-picker");return r(),E(s,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},S2=Object.freeze(Object.defineProperty({__proto__:null,default:yp},Symbol.toStringTag,{value:"Module"})),bp={__name:"Time",props:_l({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=El(e,"modelValue");return(a,l)=>{const s=C("el-time-select");return r(),E(s,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},F2=Object.freeze(Object.defineProperty({__proto__:null,default:bp},Symbol.toStringTag,{value:"Module"})),$2={key:0},wp={__name:"Select",props:_l({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=El(e,"modelValue"),a=e,l=M([]),s=M(!1),i=async(p="")=>{s.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]),s.value=!1};Ie(async()=>{await i()});const c=p=>typeof p.disabled=="function"?a.callback(p.disabled,{}):p.disabled;return(p,f)=>{const _=C("el-option"),g=C("el-select");return r(),E(g,ya({modelValue:t.value,"onUpdate:modelValue":f[0]||(f[0]=y=>t.value=y)},e.attribute,{"remote-method":i,loading:s.value,filterable:e.field.filterable===!0,clearable:e.field.clearable===!0,disabled:e.field.disabled}),{default:d(()=>[(r(!0),h(H,null,ae(l.value,(y,v)=>(r(),E(_,{key:v,value:y.value,label:y.label,disabled:c(y)},{default:d(()=>[y.slot?(r(),h("span",$2,m(y.slot),1)):B("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},E2=Object.freeze(Object.defineProperty({__proto__:null,default:wp},Symbol.toStringTag,{value:"Module"})),Cp={__name:"RemoteSearchableSelect",props:_l({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=El(e,"modelValue"),a=e,l=M(!1),s=M(a.field.options||[]),i=c=>{if(a.field.search_only_on_type===!0){if(c.query.length===0)return}else if(c.query.length<1&&s.value.length>0)return;l.value=!0,ue.get("forms/search_options",{search_by:c.query,search_for:c.key}).then(p=>{s.value=p.options,l.value=!1})};return(c,p)=>{const f=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??A(u)("Please enter a keyword"),"remote-method":g=>{i({query:g,key:e.field.remote_key})},loading:l.value,multiple:e.field.multiple},{default:d(()=>[(r(!0),h(H,null,ae(s.value,g=>(r(),E(f,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},U2=Object.freeze(Object.defineProperty({__proto__:null,default:Cp},Symbol.toStringTag,{value:"Module"}));function un(e,t){t===void 0&&(t={});var a=t.insertAt;if(e&&typeof document<"u"){var l=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&l.firstChild?l.insertBefore(s,l.firstChild):l.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}un(".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}");un('.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)}}');un(".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}");un(".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}");un(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");un(".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 Cl="vel",Vl=Fs({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>n("svg",{class:`${Cl}-icon icon`,"aria-hidden":"true"},[n("use",{"xlink:href":`#icon-${e.type}`},null)])}),bi=typeof window<"u",Ys=()=>{};let kp=!1;if(bi)try{const e={};Object.defineProperty(e,"passive",{get(){kp=!0}}),window.addEventListener("test-passive",Ys,e)}catch{}const Pu=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];bi&&e.addEventListener(t,a,!!kp&&{capture:!1,passive:l})},Nu=(e,t,a)=>{bi&&e.removeEventListener(t,a)},I2=e=>{e.preventDefault()},Q2=Object.prototype.toString,bd=e=>t=>Q2.call(t).slice(8,-1)===e,D2=e=>!!e&&bd("Object")(e),Ku=e=>!!e&&bd("String")(e);function V2(e){return e!=null}const T2=Fs({name:"Toolbar",props:{zoomIn:{type:Function,default:Ys},zoomOut:{type:Function,default:Ys},rotateLeft:{type:Function,default:Ys},rotateRight:{type:Function,default:Ys},resize:{type:Function,default:Ys},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>n("div",{class:`${Cl}-toolbar`},[!e.zoomDisabled&&n(H,null,[n("div",{role:"button","aria-label":"zoom in button",class:"toolbar-btn toolbar-btn__zoomin",onClick:e.zoomIn},[n(Vl,{type:"zoomin"},null)]),n("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[n(Vl,{type:"zoomout"},null)])]),n("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[n(Vl,{type:"resize"},null)]),!e.rotateDisabled&&n(H,null,[n("div",{role:"button","aria-label":"image rotate left button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateLeft},[n(Vl,{type:"rotate-left"},null)]),n("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[n(Vl,{type:"rotate-right"},null)])])])}),M2=()=>n("div",{class:`${Cl}-loading`},[n("div",{class:"ring"},null)]),L2=()=>n("div",{class:`${Cl}-on-error`},[n("div",{class:"ring"},null),n(Vl,{type:"img-broken"},null)]),R2=(e,t)=>{let{slots:a}=t;return n("div",{class:`${Cl}-img-title`},[a.default?a.default():""])},O2=Fs({name:"DefaultIcons",setup:()=>()=>n("svg",{"aria-hidden":!0,style:"position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden;"},[n("symbol",{id:"icon-rotate-right",viewBox:"0 0 1024 1024"},[n("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)]),n("symbol",{id:"icon-rotate-left",viewBox:"0 0 1024 1024"},[n("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)]),n("symbol",{id:"icon-resize",viewBox:"0 0 1024 1024"},[n("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)]),n("symbol",{id:"icon-img-broken",viewBox:"0 0 1024 1024"},[n("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)]),n("symbol",{id:"icon-prev",viewBox:"0 0 1024 1024"},[n("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)]),n("symbol",{id:"icon-next",viewBox:"0 0 1024 1024"},[n("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)]),n("symbol",{id:"icon-zoomin",viewBox:"0 0 1024 1024"},[n("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),n("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null),n("path",{d:"M367.488 238.144h127.104v390.72H367.488z"},null)]),n("symbol",{id:"icon-close",viewBox:"0 0 1024 1024"},[n("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)]),n("symbol",{id:"icon-zoomout",viewBox:"0 0 1024 1024"},[n("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),n("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null)])])}),En=bi?window:global;let Gu=Date.now();function H2(e){const t=Date.now(),a=Math.max(0,16-(t-Gu)),l=setTimeout(e,a);return Gu=t+a,l}function Ji(e){return(En.requestAnimationFrame||H2).call(En,e)}function ju(e){(En.cancelAnimationFrame||En.clearTimeout).call(En,e)}function zu(e,t){const a=e.clientX-t.clientX,l=e.clientY-t.clientY;return Math.sqrt(a*a+l*l)}function Xi(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!If(e)}var Zi=Fs({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:s,imgState:i,setImgSize:c}=(()=>{const xe=M(),Ee=Js({width:0,height:0,maxScale:1});return{imgRef:xe,imgState:Ee,setImgSize:()=>{if(xe.value){const{width:Oe,height:Me,naturalWidth:gt}=xe.value;Ee.maxScale=gt/Oe,Ee.width=Oe,Ee.height=Me}}}})(),p=M(e.index),f=M(""),_=Js({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=Js({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=N(()=>{return xe=e.imgs,bd("Array")(xe)?e.imgs.map(Ee=>typeof Ee=="string"?{src:Ee}:function(Oe){return D2(Oe)&&Ku(Oe.src)}(Ee)?Ee:void 0).filter(V2):Ku(e.imgs)?[{src:e.imgs}]:[];var xe}),v=N(()=>y.value[p.value]),b=N(()=>{var xe;return(xe=y.value[p.value])==null?void 0:xe.src}),k=N(()=>{var xe;return(xe=y.value[p.value])==null?void 0:xe.title}),w=N(()=>{var xe;return(xe=y.value[p.value])==null?void 0:xe.alt}),S=N(()=>({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)`})),$=()=>{a("hide")},V=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},F=(xe,Ee)=>{const Oe=p.value;V(),p.value=xe,y.value[p.value]===y.value[xe]&&ke(()=>{g.loading=!1}),e.visible&&Oe!==xe&&(Ee&&Ee(Oe,xe),a("on-index-change",Oe,xe))},x=()=>{const xe=p.value,Ee=e.loop?(xe+1)%y.value.length:xe+1;!e.loop&&Ee>y.value.length-1||F(Ee,(Oe,Me)=>{a("on-next",Oe,Me),a("on-next-click",Oe,Me)})},Q=()=>{const xe=p.value;let Ee=xe-1;if(xe===0){if(!e.loop)return;Ee=y.value.length-1}F(Ee,(Oe,Me)=>{a("on-prev",Oe,Me),a("on-prev-click",Oe,Me)})},D=xe=>{Math.abs(1-xe)<.05?xe=1:Math.abs(i.maxScale-xe)<.05&&(xe=i.maxScale),_.lastScale=_.scale,_.scale=xe},T=()=>{const xe=_.scale+e.zoomScale;xe<i.maxScale*e.maxZoom&&D(xe)},U=()=>{const xe=_.scale-e.zoomScale;xe>e.minZoom&&D(xe)},I=()=>{const xe=_.rotateDeg%360;a("on-rotate",Math.abs(xe<0?xe+360:xe))},O=()=>{_.rotateDeg-=90,I()},L=()=>{_.rotateDeg+=90,I()},P=()=>{_.scale=1,_.top=0,_.left=0},q=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&xe===0},{onMouseDown:X,onMouseMove:G,onMouseUp:te}=((xe,Ee,Oe)=>{let Me,gt=!1;return{onMouseDown:yt=>{xe.initX=xe.lastX=yt.clientX,xe.initY=xe.lastY=yt.clientY,Ee.dragging=!0,gt=!1,yt.stopPropagation()},onMouseUp:yt=>{Oe(yt.button)&&ju(Me),Ee.dragging=!1,gt=!1},onMouseMove:yt=>{if(Ee.dragging)if(Oe(yt.button)){if(gt)return;gt=!0,Me=Ji(()=>{const{top:Mt,left:Ut,lastY:Dt,lastX:ht}=xe;xe.top=Mt-Dt+yt.clientY,xe.left=Ut-ht+yt.clientX,xe.lastX=yt.clientX,xe.lastY=yt.clientY,gt=!1})}else xe.lastX=yt.clientX,xe.lastY=yt.clientY;yt.stopPropagation()}}})(_,g,q),{onTouchStart:ne,onTouchMove:re,onTouchEnd:K}=((xe,Ee,Oe,Me,gt)=>{let yt,Mt=!1;return{onTouchStart:Ut=>{const{touches:Dt}=Ut;Dt.length>1&&gt()?(Oe.gesturing=!0,Ee.touches=Dt):(Ee.initX=Ee.lastX=Dt[0].clientX,Ee.initY=Ee.lastY=Dt[0].clientY,Oe.dragging=!0),Ut.stopPropagation()},onTouchMove:Ut=>{if(Mt)return;const{touches:Dt}=Ut,{lastX:ht,lastY:Pt,left:Ct,top:St,scale:Ot}=Ee;if(!Oe.gesturing&&Oe.dragging){if(!Dt[0])return;const{clientX:Ht,clientY:It}=Dt[0];Me()?yt=Ji(()=>{Ee.lastX=Ht,Ee.lastY=It,Ee.top=St-Pt+It,Ee.left=Ct-ht+Ht,Mt=!1}):(Ee.lastX=Ht,Ee.lastY=It)}else Oe.gesturing&&Ee.touches.length>1&&Dt.length>1&&gt()&&(yt=Ji(()=>{const Ht=(zu(Ee.touches[0],Ee.touches[1])-zu(Dt[0],Dt[1]))/xe.width;Ee.touches=Dt;const It=Ot-1.3*Ht;It>.5&&It<1.5*xe.maxScale&&(Ee.scale=It),Mt=!1}))},onTouchEnd:()=>{ju(yt),Oe.dragging=!1,Oe.gesturing=!1,Mt=!1}}})(i,_,g,q,()=>!e.pinchDisabled),Y=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},W=xe=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),xe.deltaY<0?T():U())},j=xe=>{const Ee=xe;e.visible&&(!e.escDisabled&&Ee.key==="Escape"&&e.visible&&$(),Ee.key==="ArrowLeft"&&(e.rtl?x():Q()),Ee.key==="ArrowRight"&&(e.rtl?Q():x()))},ie=()=>{e.maskClosable&&$()},he=()=>{c()},me=()=>{g.loading=!1},ye=xe=>{g.loading=!1,g.loadError=!0,a("on-error",xe)},se=()=>{e.visible&&c()};be(()=>e.index,xe=>{xe<0||xe>=y.value.length||F(xe)}),be(()=>g.dragging,(xe,Ee)=>{const Oe=!xe&&Ee;if(!q()&&Oe){const Me=_.lastX-_.initX,gt=_.lastY-_.initY,yt=e.swipeTolerance;Math.abs(Me)>Math.abs(gt)&&(Me<-1*yt?x():Me>yt&&Q())}}),be(()=>e.visible,xe=>{if(xe){V();const Ee=y.value.length;if(Ee===0)return p.value=0,g.loading=!1,void ke(()=>g.loadError=!0);p.value=e.index>=Ee?Ee-1:e.index<0?0:e.index,e.scrollDisabled&&fe()}else e.scrollDisabled&&$e()});const fe=()=>{document&&(f.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},$e=()=>{document&&(document.body.style.overflowY=f.value)};Ie(()=>{Pu(document,"keydown",j),Pu(window,"resize",se)}),vl(()=>{Nu(document,"keydown",j),Nu(window,"resize",se),e.scrollDisabled&&$e()});const tt=()=>g.loading?l.loading?l.loading({key:"loading"}):n(M2,{key:"img-loading"},null):g.loadError?l.onerror?l.onerror({key:"onerror"}):n(L2,{key:"img-on-error"},null):n("div",{class:`${Cl}-img-wrapper`,style:S.value,key:"img-wrapper"},[n("img",{alt:w.value,ref:s,draggable:"false",class:`${Cl}-img`,src:b.value,onMousedown:X,onMouseup:te,onMousemove:G,onTouchstart:ne,onTouchmove:re,onTouchend:K,onLoad:he,onDblclick:Y,onDragstart:xe=>{xe.preventDefault()}},null)]),ve=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:Q});if(y.value.length<=1)return;const xe=!e.loop&&p.value<=0;return n("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(xe?"disable":""),onClick:Q},[e.rtl?n(Vl,{type:"next"},null):n(Vl,{type:"prev"},null)])},Je=()=>{if(l["next-btn"])return l["next-btn"]({next:x});if(y.value.length<=1)return;const xe=!e.loop&&p.value>=y.value.length-1;return n("div",{role:"button","aria-label":"next image button",class:"btn__next "+(xe?"disable":""),onClick:x},[e.rtl?n(Vl,{type:"prev"},null):n(Vl,{type:"next"},null)])},vt=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return l.title?l.title({currentImg:v.value}):k.value?n(R2,null,{default:()=>[k.value]}):void 0},Ye=()=>{let xe;if(e.visible)return n("div",{onTouchmove:I2,class:[`${Cl}-modal`,e.rtl?"is-rtl":""],onClick:Ne(ie,["self"]),onWheel:W},[n(O2,null,null),n(Wl,{name:`${Cl}-fade`,mode:"out-in"},Xi(xe=tt())?xe:{default:()=>[xe]}),n("img",{style:"display:none;",src:b.value,onError:ye,onLoad:me},null),n("div",{class:`${Cl}-btns-wrapper`},[ve(),Je(),vt(),l["close-btn"]?l["close-btn"]({close:$}):n("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:$},[n(Vl,{type:"close"},null)]),l.toolbar?l.toolbar({toolbarMethods:{zoomIn:T,zoomOut:U,rotate:O,rotateLeft:O,rotateRight:L,resize:P},zoomIn:T,zoomOut:U,rotate:O,rotateLeft:O,rotateRight:L,resize:P}):n(T2,{zoomIn:T,zoomOut:U,resize:P,rotateLeft:O,rotateRight:L,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let xe;if(e.teleport){let Ee;return n(li,{to:e.teleport},{default:()=>[n(Wl,{name:`${Cl}-fade`},Xi(Ee=Ye())?Ee:{default:()=>[Ee]})]})}return n(Wl,{name:`${Cl}-fade`},Xi(xe=Ye())?xe:{default:()=>[xe]})}}});const P2=Object.assign(Zi,{install:e=>{e.component(Zi.name,Zi)}}),N2={name:"Attachments",components:{MediaButton:Xc,VueEasyLightbox:P2,IconButton:Ze,Delete:Lc},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:u,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)}}},K2={class:"fct-attachments-wrap",style:{position:"relative"}},G2={class:"fct-attachment-img-wrap"},j2=["src","alt","onClick"],z2={class:"fct-attachments-button"};function q2(e,t,a,l,s,i){const c=C("VueEasyLightbox"),p=C("MediaButton"),f=C("IconButton"),_=C("Delete");return r(),h(H,null,[n(c,{visible:s.visible,imgs:s.lightboxData,index:s.imageIndex,onHide:t[0]||(t[0]=()=>{s.visible=!1})},null,8,["visible","imgs","index"]),o("div",K2,[a.attachments?(r(),h("ul",{key:0,class:de(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(r(!0),h(H,{key:0},ae(a.attachments,(g,y)=>(r(),h("li",{key:y,class:de([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",G2,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{s.imageIndex=y,s.visible=!0}},null,8,j2)):B("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),E(f,{key:1,size:"x-small"},{default:d(()=>[n(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})):B("",!0)]),o("div",z2,[a.showDeleteButton?(r(),E(f,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:Ne(v=>i.removeImageEvent(y),["prevent"]),title:i.translate("Delete media")},{default:d(()=>[a.multiple?(r(),E(_,{key:0})):(r(),h(H,{key:1},[R(m(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):B("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),E(f,{key:1,size:"x-small"},{default:d(()=>[n(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})):B("",!0)])],2))),128)):B("",!0),i.showMediaButtonAsIcon?B("",!0):(r(),h("li",{key:1,class:de([a.mediaInputSize,a.mediaInputBg])},[n(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)):B("",!0),ba(e.$slots,"default")])],64)}const Bp=lt(N2,[["render",q2]]),Y2={key:0},W2={key:0,class:"setting-label"},wi={__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,s=M();let i=M([]);const c=()=>{a.multiple?s.value=[]:s.value="",i.value=[],l("update:modelValue",s.value)},p=_=>{if(_.length)if(a.multiple){s.value=[],i.value=[];for(const g of _)s.value.push(g),i.value.push(g)}else s.value=_,i.value=_;l("update:modelValue",s.value)};be(()=>a.modelValue,_=>{Array.isArray(_)&&_.length>0?s.value=_:_&&typeof _=="string"&&_!==""?s.value=[_]:_&&typeof _=="object"?s.value=[_]:s.value=[],f()});const f=()=>{i.value=[],Object.values(s.value).forEach((_,g)=>{_!==void 0&&_!==""&&i.value.push(_)})};return Ie(()=>{Array.isArray(a.modelValue)&&a.modelValue.length>0?s.value=a.modelValue:a.modelValue&&typeof a.modelValue=="string"&&a.modelValue!==""?s.value=[a.modelValue]:a.modelValue&&typeof a.modelValue=="object"?s.value=[a.modelValue]:s.value=[],f()}),(_,g)=>(r(),h(H,null,[n(Bp,{attachments:A(i),onMediaUploaded:p,onRemoveImage:c,icon:e.icon,title:e.title,mediaInputSize:e.mediaInputSize,mediaInputBg:e.mediaInputBg},null,8,["attachments","icon","title","mediaInputSize","mediaInputBg"]),e.showSupported?(r(),h("div",Y2,[e.field&&e.field.label?(r(),h("label",W2,m(e.field.label),1)):B("",!0),o("span",null,m(A(u)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):B("",!0)],64))}},J2={class:"setting-media-wrap"},xp={__name:"Media",props:_l({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=El(e,"modelValue");return(a,l)=>(r(),h("div",J2,[n(wi,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),field:e.field,icon:"Upload"},e.attribute),null,16,["modelValue","field"])]))}},X2=Object.freeze(Object.defineProperty({__proto__:null,default:xp},Symbol.toStringTag,{value:"Module"})),Z2={__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),Yt().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})},s=M(!1);let i={};Ie(async()=>{i=await gd.attributesBuilders(t.field,l,t.form),s.value=!0});const c={switch:_p,checkbox:vp,radio:gp,input:qs,text:qs,email:qs,number:qs,textarea:qs,color:yd,date:yp,time:bp,select:wp,media:xp,remote_select:Cp},p=N(()=>c[t.field.type]||null),f=N(()=>({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(es,{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&&s.value?(r(),E(Bl(p.value),ya({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)},f.value),null,16,["modelValue"])):B("",!0)}},ek=["innerHTML"],tk={key:0},ak={key:0},Ci={__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),Yt().ctx;const s=(c,p)=>{if(typeof c.label=="function"){let f=i(c)?a:p+".",_=i(c)?t.value:t.value[p];return c.label(_,f,t.form)}return c.label},i=c=>c.disable_nesting!==!1;return(c,p)=>(r(!0),h(H,null,ae(e.schema,(f,_)=>(r(),h(H,{key:_},[e.form.isVisible(f,e.statePath+_)?(r(),h(H,{key:0},[f.type==="html"?(r(),h("div",{key:0,class:de(`setting-html-wrapper ${f.wrapperClass??""}`),innerHTML:f.value},null,10,ek)):(r(),h(H,{key:1},[f.component?(r(),h("div",{key:0,class:de(f.wrapperClass??"")},[f.component&&f.label?(r(),E(fa,{key:0,title:s(f,_),content:f.tooltip,class:"setting-label",placement:f.tooltip_placement},{default:d(()=>[f.labelOptional?(r(),h("span",tk,"("+m(f.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(pp,{modelValue:e.value[_],"onUpdate:modelValue":g=>e.value[_]=g,name:f.component,form:e.form,statePath:i(f)?A(a):_+".",field:f,"field-key":_,value:i(f)?e.value:e.value[_],nesting:i(f)},{fieldNote:d(()=>[f.note&&f.hide_note!==!0?(r(),E(Or,{key:0,note:f.note},null,8,["note"])):B("",!0)]),validationError:d(()=>[n(Hu,{form:e.form,"error-key":A(a)+_},null,8,["form","error-key"])]),_:2},1032,["modelValue","onUpdate:modelValue","name","form","statePath","field","field-key","value","nesting"])],2)):B("",!0),l.includes(f.type)?(r(),E(u2,{key:1,form:e.form,field:f,value:e.value,"full-state-path":A(a),statePath:i(f)?A(a):_+".","field-key":_},null,8,["form","field","value","full-state-path","statePath","field-key"])):B("",!0),typeof f.type<"u"&&!l.includes(f.type)&&!["custom","component","html","hidden"].includes(f.type)?(r(),h("div",{key:2,class:de(`setting-fields-inner ${f.wrapperClass??""}`)},[f.type!=="checkbox"&&!f.component&&f.label!==!1?(r(),E(fa,{key:0,class:"setting-label",title:s(f,_),content:f.tooltip,placement:f.tooltip_placement},{default:d(()=>[f.labelOptional?(r(),h("span",ak,"("+m(f.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(Z2,{form:e.form,field:f,value:e.value,"full-state-path":A(a),"state-path":e.statePath,"field-key":_},null,8,["form","field","value","full-state-path","state-path","field-key"]),f.note&&!f.component?(r(),E(Or,{key:1,note:f.note},null,8,["note"])):B("",!0),f.component?B("",!0):(r(),E(Hu,{key:2,form:e.form,"error-key":A(a)+_},null,8,["form","error-key"]))],2)):B("",!0)],64))],64)):B("",!0)],64))),128))}},lk={key:0,class:"vue-form-wrap"},sk={key:0,class:"form-section-save-action"},nk={key:0,class:"cmd block leading-none"},ki={__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=sl(),s=e,i=a;be(()=>s.form.isReady,()=>{ke(()=>ln.scrollToHashSection(l.hash))},{once:!0}),Ie(()=>{ke(()=>{c.registerCopyAction(),s.form.isReady&&ln.scrollToHashSection(l.hash)})}),M({});const c=Yt().ctx,p=()=>{i("onSubmitButtonClick")};return t({getState:()=>s.form.values}),(_,g)=>{const y=C("el-button");return e.form.isReady?(r(),h("div",lk,[n(Ci,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),h("div",sk,[n(y,{onClick:p,type:"primary",loading:e.loading},{default:d(()=>[e.loading?B("",!0):(r(),h("span",nk,"⌘s")),R(" "+m(e.submitButtonText),1)]),_:1},8,["loading"])])):B("",!0)])):B("",!0)}}},ok={key:0},Sp={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=_d();const s=a,i=e,c=()=>{const g=i.form_name,y={};return y[g]={...l.values},y},p=()=>{l.reset()},f=()=>{var g;return((g=i.widget)==null?void 0:g.reset_on_save)==!0},_=ai("triggerChange");return Ie(()=>{l.setSchema(i.schema).setDefaults(i.values).initForm(),l.onDataChanged(g=>{_==null||_(),s("change")})}),t({getState:c,resetForm:p,resetOnSave:f}),(g,y)=>A(l).isReady?(r(),h("div",ok,[n(ki,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:A(l),onOnSubmitButtonClick:y[0]||(y[0]=()=>{A(l).values}),onOnChange:y[1]||(y[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):B("",!0)}},ik={__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 s=()=>{a.value&&(l=aa(a.value),l.setOption(t.option))};be(()=>t.option,f=>{l&&f&&l.setOption(f,!0)},{deep:!0});const i=(f,_)=>{if(f==null||f==="")return _;const g=Number(f);return isNaN(g)?f:`${g}px`},c=N(()=>i(t.height,"400px")),p=N(()=>i(t.width,"100%"));return Ie(()=>{s(),window.addEventListener("resize",()=>l==null?void 0:l.resize())}),vl(()=>{window.removeEventListener("resize",()=>l==null?void 0:l.resize()),l==null||l.dispose()}),(f,_)=>(r(),h("div",{ref_key:"chartRef",ref:a,style:ua({width:p.value,height:c.value})},null,4))}},rk={class:"fct-step-indicator"},dk={class:"indicator-title"},uk={class:"indicator-steps"},ck={class:"indicator-progress"},Ak={class:"indicator-steps-bar"},pk=["onClick"],fk={__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,s)=>(r(),h("div",rk,[o("div",dk,m(e.steps[e.currentStep-1].label),1),o("div",uk,[o("div",ck,m(e.currentStep)+"/"+m(e.steps.length)+" "+m(l.$t("Completed")),1),o("div",Ak,[(r(!0),h(H,null,ae(e.steps,(i,c)=>(r(),h("div",{key:c,class:"indicator-step",onClick:p=>a("step-click",c+1)},[o("div",{class:de(["indicator-step-bar",c<e.currentStep?"is-completed":""])},null,2)],8,pk))),128))])])]))}},mk=["type","disabled","aria-disabled"],hk={key:0,class:"fct-btn-spinner"},_k="6px",vk={__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,s=N(()=>a.disabled||a.loading),i=()=>`width ${a.duration}ms ease, opacity ${a.duration}ms ease, margin-right ${a.duration}ms ease`,c=y=>{y.style.width="0",y.style.opacity="0",y.style.overflow="hidden",y.style.marginRight="6px"},p=(y,v)=>{const b=y.scrollWidth+"px";y.style.transition=i(),requestAnimationFrame(()=>{y.style.width=b,y.style.opacity="1",y.style.marginRight=""}),setTimeout(()=>v(),a.duration)},f=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=_k},g=(y,v)=>{y.offsetHeight,y.style.transition=i(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const b=k=>{k.propertyName==="width"&&(y.removeEventListener("transitionend",b),v())};y.addEventListener("transitionend",b)};return(y,v)=>(r(),h("button",{type:e.nativeType,class:de(["el-button",e.type&&`el-button--${e.type}`,e.size&&`el-button--${e.size}`,{"is-plain":e.plain,"is-loading":e.loading,"is-disabled":s.value}]),disabled:s.value,"aria-disabled":s.value,onClick:v[0]||(v[0]=b=>l("click",b))},[n(Wl,{onBeforeEnter:c,onEnter:p,onAfterEnter:f,onBeforeLeave:_,onLeave:g},{default:d(()=>[e.loading?(r(),h("span",hk,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)]))):B("",!0)]),_:1}),o("span",null,[ba(y.$slots,"default",{},void 0,!0)])],10,mk))}},gk=lt(vk,[["__scopeId","data-v-fa8794a2"]]),Fp={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var c,p;const t=Uc(Ic),a=Object.freeze({get:(...f)=>ue.get(...f),post:(...f)=>ue.post(...f),put:(...f)=>ue.put(...f),delete:(...f)=>ue.delete(...f),patch:(...f)=>ue.patch(...f),upload:(...f)=>ue.upload(...f),getNonce:()=>ue.getNonce()}),l=Object.freeze({success:(...f)=>z.success(...f),error:(...f)=>z.error(...f),info:(...f)=>z.info(...f),validationErrors:(...f)=>z.validationErrors(...f)}),s={Vue:t,Rest:a,Notify:l,translate:u,Animation:va,StepIndicator:fk,LoadingButton:gk,ElMessage:(c=window==null?void 0:window.ELEMENT)==null?void 0:c.ElMessage,ElMessageBox:(p=window==null?void 0:window.ELEMENT)==null?void 0:p.ElMessageBox},i=f=>typeof f=="string"?vm(f,s).component:Fs(f);return(f,_)=>(r(),E(Bl(i(e.widget.component)),ya({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},yk=["innerHTML"],cn={__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}){Yt().ctx;const l=a,s=e,i=M([]),c=Uc(Ic),p={},f=V=>{window.fluent_cart_admin.app={vue:c,components:V,xhr:ue,notify:z},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],c,V).forEach(({name:x,component:Q})=>{p[x]=Fs(Q)})};Is(()=>{let F=Yt().appContext.components;f(F);let x=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],c,F);Array.isArray(x)&&(i.value=i.value.concat(x));const Q={filter:s.filter,data:s.widgetsQuery};ue.get("widgets",Q).then(D=>{Array.isArray(D.widgets)&&(i.value=i.value.concat(D.widgets))}),s.widgetsQuery});const _=V=>Fs(V),g=V=>p[V]||null,y=M([]),v=async(V,F)=>{const x=y.value.map(Q=>typeof Q[V]=="function"?Q[V](F):Promise.resolve());return await Promise.all(x),!0};t({beforeUpdatingData:async V=>await v("beforeUpdatingData",V),afterUpdatingData:async V=>await v("afterUpdatingData",V),getFormStates:()=>{let V=[];if(Array.isArray($.value))for(let F of $.value)V={...V,...F.getState()};return V},resetForms:()=>{if(Array.isArray($.value))for(let V of $.value)V.resetOnSave()&&V.resetForm()}});const $=M();return(V,F)=>(r(!0),h(H,null,ae(i.value,x=>(r(),h(H,null,[x.type!=="vue-component"&&x.type!=="vue-template"||x.use_card==!0?(r(),E(Be,{key:0},{default:d(()=>[n(Qe,{title:x.title,subtitle:x.subtitle,border_bottom:""},null,8,["title","subtitle"]),n(Ce,null,{default:d(()=>[x.type==="html"?(r(),h("div",{key:0,innerHTML:x.content},null,8,yk)):x.type==="chart"?(r(),E(ik,{key:1,option:x.data,height:`${x.height||400}`,width:`${x.width||"100%"}`},null,8,["option","height","width"])):x.type==="form"?(r(),E(Sp,{key:2,schema:x.schema,values:x.values,submit_button_text:x.submit_button_text,form_name:x.form_name,ref_for:!0,ref_key:"formRefs",ref:$,widget:x,onChange:F[0]||(F[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof x.component=="object"?(r(),E(Bl(_(x.component)),ya({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...x,data:e.data}),null,16)):g(x.component)?(r(),E(Bl(g(x.component)),ya({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...x,data:e.data}),null,16)):(r(),h(H,{key:5},[R(m(x.content),1)],64))]),_:2},1024)]),_:2},1024)):x.type==="vue-component"?(r(),h(H,{key:1},[typeof x.component=="object"?(r(),E(Bl(_(x.component)),ya({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...x,data:e.data}),null,16)):g(x.component)?(r(),E(Bl(g(x.component)),ya({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...x,data:e.data}),null,16)):B("",!0)],64)):x.type==="vue-template"?(r(),E(Fp,{key:2,widget:x,data:e.data},null,8,["widget","data"])):B("",!0)],64))),256))}},Aa=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,bk={class:"fct-dashboard-stat-widgets"},wk={class:"right w-full"},Ck=["href"],kk={class:"fct-dashboard-stat-widget__icon"},Bk={class:"fct-dashboard-stat-widget__content"},xk={class:"fct-dashboard-stat-widget__title"},Sk={class:"fct-dashboard-stat-widget__value inner-value"},Fk=["innerHTML"],$k={key:1,class:"fct-dashboard-stat-widget__inner"},Ek={class:"fct-dashboard-stat-widget__content"},Uk={class:"fct-dashboard-stat-widget__title"},Ik=["href"],Qk={key:1},Dk={class:"fct-dashboard-stat-widget__value"},Vk={__name:"StatsWidget",setup(e){const t=M(!0),a=M([]),l=()=>{t.value=!0,ue.get("dashboard/stats").then(s=>{a.value=s.stats}).catch(s=>{z.error(s)}).finally(()=>{t.value=!1})};return Ie(()=>{l()}),(s,i)=>{const c=C("el-skeleton-item"),p=C("el-skeleton");return r(),h("div",bk,[t.value?(r(),h(H,{key:0},ae(4,f=>n(p,{key:f,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:d(()=>[n(c,{variant:"circle",class:"w-10 h-10 flex-none"}),o("div",wk,[n(c,{variant:"p",class:"w-full"}),n(c,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),h(H,{key:1},[(r(!0),h(H,null,ae(a.value,(f,_)=>(r(),h("div",{key:_,class:"fct-dashboard-stat-widget"},[f.url?(r(),h("a",{key:0,href:f.url,class:"fct-dashboard-stat-widget__inner no-underline"},[o("div",kk,[n(J,{class:"w-5",name:f.icon},null,8,["name"])]),o("div",Bk,[o("h3",xk,[o("span",null,m(f.title),1)]),o("span",Sk,[f.has_currency?(r(),h("span",{key:0,innerHTML:A(pt).scaled(f.current_count)},null,8,Fk)):(r(),h(H,{key:1},[R(m(A(ta)(A(Aa)(f.current_count))||0),1)],64))])])],8,Ck)):(r(),h("div",$k,[i[0]||(i[0]=Un('<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",Ek,[o("h3",Uk,[f.url?(r(),h("a",{key:0,class:"link",href:f.url},m(f.title),9,Ik)):(r(),h("span",Qk,m(f.title),1))]),o("span",Dk,m(f.current_count),1)])]))]))),128)),n(cn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},qu=200,Tk=800,Mk=.1,Lk=.3,Yu=.5,Rk=.5,Ok=12,Hk=800,Pk=1600,Nk=150,Kk=3500,Gk=["#FFC700","#FF0000","#2E3191","#41BBC7"];var wd={props:{particleCount:{type:Number,default:Nk},particleSize:{type:Number,default:Ok},duration:{type:Number,default:Kk},colors:{type:Array,default:Gk},force:{type:Number,default:Rk},stageHeight:{type:Number,default:Hk},stageWidth:{type:Number,default:Pk},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=M(!0),a=(F,x)=>{V(F,{degree:x})},l=N(()=>i(e.particleCount,e.colors));Qf(()=>{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 s=N(()=>$(e.particleCount,e.duration,e.colors,e.particleSize,e.force,e.stageHeight,e.stageWidth));Ie(async()=>{await c(e.duration),e.shouldDestroyAfterDone&&(t.value=!1)});const i=(F,x)=>{const Q=360/F;return Array.from({length:F},(D,T)=>({color:x[T%x.length],degree:T*Q}))},c=F=>new Promise(x=>setTimeout(x,F));function p(F){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round((F+Number.EPSILON)*10**x)/10**x}function f(F,x){if(F===x)return!0;if(F==null||x==null||F.length!==x.length)return!1;for(let Q=0;Q<F.length;Q++)if(F[Q]!==x[Q])return!1;return!0}const _=(F,x,Q,D,T)=>(F-x)*(T-D)/(Q-x)+D,g=(F,x)=>{const Q=F+x;return Q>360?Q-360:Q},y=()=>Math.random()>.5,v=[0,0,1],b=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],k=F=>!f(b[F],v)&&y(),w=F=>typeof F>"u",S=F=>{console.error(F)};function $(F,x,Q,D,T,U,I){const O=Number.isSafeInteger;return!w(F)&&O(F)&&F<0?(S("particleCount must be a positive integer"),!1):!w(x)&&O(x)&&x<0?(S("duration must be a positive integer"),!1):!w(Q)&&!Array.isArray(Q)?(S("colors must be an array of strings"),!1):!w(D)&&O(D)&&D<0?(S("particleSize must be a positive integer"),!1):!w(T)&&O(T)&&(T<0||T>1)?(S("force must be a positive integer and should be within 0 and 1"),!1):!w(U)&&typeof U=="number"&&O(U)&&U<0?(S("floorHeight must be a positive integer"),!1):!w(I)&&typeof I=="number"&&O(I)&&I<0?(S("floorWidth must be a positive integer"),!1):!0}function V(F,x){let{degree:Q}=x;const D=_(Math.abs(g(Q,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),T=Math.random()*(Tk-qu)+qu,U=Math.round(Math.random()*(b.length-1)),I=e.duration-Math.round(Math.random()*1e3),O=Math.random()<Mk,L=k(U),P=O?p(Math.random()*Lk,2):0,q=P*-1,X=P,G=p(Math.abs(_(Math.abs(g(Q,90)-180),0,180,-1,1)),4),te=p(Math.random()*Yu,4),ne=p(Math.random()*e.force*(y()?1:-1),4),re=Yu,K=p(Math.max(_(Math.abs(Q-180),0,180,e.force,-e.force),0),4),Y=(W,j)=>F==null?void 0:F.style.setProperty(W,j+"");Y("--x-landing-point",`${D}px`),Y("--duration-chaos",`${I}ms`),Y("--x1",`${P}`),Y("--x2",`${q}`),Y("--x3",`${X}`),Y("--x4",`${G}`),Y("--y1",`${te}`),Y("--y2",`${ne}`),Y("--y3",`${re}`),Y("--y4",`${K}`),Y("--width",`${L?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),Y("--height",(L?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),Y("--rotation",`${b[U].join()}`),Y("--rotation-duration",`${T}ms`),Y("--border-radius",`${L?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function jk(e,t,a,l,s,i){return l.isVisible&&l.isValid?(r(),h("div",{key:0,class:"confetti-container",style:ua(`--floor-height: ${l.stageHeight}px;`)},[(r(!0),h(H,null,ae(l.particles,c=>{let{color:p,degree:f}=c;return r(),h("div",{key:f,class:"particle",ref:_=>l.setItemRef(_,f)},[o("div",{style:ua(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):B("",!0)}function zk(e,t){t===void 0&&(t={});var a=t.insertAt;if(!(typeof document>"u")){var l=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&l.firstChild?l.insertBefore(s,l.firstChild):l.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var qk=`
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 `;zk(qk);wd.render=jk;wd.__scopeId="data-v-4ff796ae";var Yk=(()=>{const e=wd;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();et.extend(di);et.extend(tA);let pa=class{static withTimezone(t){const a=et(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class Wk extends Za{constructor(){super(...arguments);Re(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[pa.withTimezone(et().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),pa.withTimezone(et().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:pa.withTimezone(et().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(s=>a?s.label.toLowerCase().includes(a)||s.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 s=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=s.findIndex(p=>p.value===a.value);i>-1?s.splice(i,1):s.push({label:a.label,value:a.value});const c=s.findIndex(p=>p.value==="all");c>-1&&s.splice(c,1),this.data[l.value]=s.map(p=>p.value)}this.triggerFilterChanged()}setDateRange(a){const l=et(a[0]),s=et(a[1]);this.data.selectedFilters.dateRange={label:u("Date"),value:[l,s],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[ja.data.dateRange[0],ja.data.dateRange[1]],this.data.selectedFilters.dateRange={label:u("Date"),value:[pa.withTimezone(et(this.data.dateRange[0])),pa.withTimezone(et(this.data.dateRange[1]))],type:"date",rangeKey:this.data.rangeKey},this.data.reRenderDate=!0,this.triggerFilterChanged()}setSelectChange(a,l=null){const s=l||this.activeFilterOptions;s&&(this.data.selectedFilters[s.value]={label:s.label,value:a,type:s.type},this.triggerFilterChanged())}setTreeSelectItem(a){const l=a.filter(s=>!s.children||s.children.length===0).map(s=>({id:s.value,label:s.label,productName:s.productName}));this.handleTreeSelections(l),this.triggerFilterChanged()}removeTreeSelectItem(a){var i;const s=(((i=this.data.selectedFilters.variation_ids)==null?void 0:i.value)||[]).filter(c=>c.id!==a);this.handleTreeSelections(s),this.data.variation_ids=this.data.variation_ids.filter(c=>c!==a),this.triggerFilterChanged()}handleTreeSelections(a){a.length?(this.data.selectedFilters.variation_ids||(this.data.selectedFilters.variation_ids={label:u("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=[],ja.resetFilterToDefault("variation_ids"),this.triggerFilterChanged()}isFilterOptionSelected(a){const l=this.activeFilterOptions;if(!l)return!1;const s=this.data.selectedFilters[l.value];return s?s.value===a.value:this.data[l.value]===a.value}isFilterOptionSelectedMulti(a){const l=this.activeFilterOptions,s=this.data.selectedFilters[l==null?void 0:l.value];return s?s.value.some(c=>c.value===a.value):!1}setMultiSelectChange(a,l){this.data.selectedFilters[a]||(this.data.selectedFilters[a]={});const s=l.some(c=>c.value==="all"),i=this.data.selectedFilters[a].value||[];s?i.length===1&&i[0].value==="all"&&l.length>1?this.data.selectedFilters[a].value=l.filter(c=>c.value!=="all"):this.data.selectedFilters[a].value=[l.find(c=>c.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:pa.withTimezone(et(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(ja.data.currencies).map(([a,l])=>({label:a,value:a}))}shouldRenderOption(a){const l=a.disableRoutes||[],s=sl();return l.includes(s.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=[pa.withTimezone(et().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),pa.withTimezone(et().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=pa.withTimezone(et().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ja.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,l){l!=null?(this.removeFilterItem(a,l),ja.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],ja.resetFilterToDefault(a),this.triggerFilterChanged())}removeFilterItem(a,l){const s=this.data.selectedFilters[a];if(!s)return;const i=s.value.filter(c=>c.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(c=>c!==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)||{},s=this.applicableFilters(),i={...l,...s};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 $p(){return Wk.init()}class Jk extends Za{constructor(){super(...arguments);Re(this,"filterState",null);Re(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[pa.withTimezone(et().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),pa.withTimezone(et().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:pa.withTimezone(et().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});Re(this,"storageKey","report-filter");Re(this,"currencyStorageKey",`${this.storageKey}_currencies`);Re(this,"listeners",{})}beforeInit(){this.filterState=$p(),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:Ge.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(){ue.get("reports/fetch-report-meta",this.applicableFilters).then(a=>{this.data.currencies=a.currencies,this.data.dateRange[0]=a.min_date;const[l,s]=Object.entries(a.currencies)[0];this.applicableFilters.params.currency===""&&(this.data.currency=l),this.data.currencySign=s,this.data.storeMode=a.storeMode,this.data.firstOrderDate=et(a.first_order_date||et().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=Zc.find(p=>p.text===this.data.rangeKey);let l,s;if(a){const[p,f]=a.value();l=this.data.rangeKey==="All Time"?pa.withTimezone(et(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):pa.withTimezone(et(p).format("YYYY-MM-DD 00:00:00")),s=pa.withTimezone(et(f).format("YYYY-MM-DD 23:59:59"))}else l=pa.withTimezone(et(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),s=pa.withTimezone(et(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:Ge.get("app_config.isProActive")?l:pa.withTimezone(et().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:Ge.get("app_config.isProActive")?s:pa.withTimezone(et().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 c=this.data.orderTypes;return c.includes("all")||(i.orderTypes=c),{params:i}}setDateDiff(){if(!this.data.dateRange||this.data.dateRange.length<2)return 0;const[a,l]=this.data.dateRange;this.data.dateDiff=et(l).diff(et(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=pa.withTimezone(et().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[pa.withTimezone(et().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),pa.withTimezone(et().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=pa.withTimezone(et().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]=[pa.withTimezone(et().startOf("month").format("YYYY-MM-DD 00:00:00")),pa.withTimezone(et().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return Qt.get(this.data.storageKey)}}const ja=Jk.init();class Xk extends Za{constructor(){super(...arguments);Re(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,s,i){if(i&&i.startsWith("graphs.")){const p=i.split(".")[1];this.data.isBusy.graphs[p]=!0}else this.data.isBusy[i]=!0;let c;return typeof l=="object"?c=ue.get("reports/"+a,l):c=ue.get("reports/"+a),this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):it.set(this.data,s,it.get(i,l))}).catch(i=>{}).finally(()=>{if(s&&s.startsWith("graphs.")){const i=s.split(".")[1];this.data.isBusy.graphs[i]=!1}else this.data.isBusy[s]=!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 Ql=Xk.init(),Zk={key:0,class:"fct-report-sold-product-list has-scroll"},eB={class:"list-left-content"},tB={class:"list-image"},aB=["src"],lB=["src"],sB={class:"list-title"},nB=["title"],oB={class:"list-id"},iB={class:"list-right-content"},rB={class:"list-value"},dB=["innerHTML"],Cd={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=N(()=>t.data);return(l,s)=>{const i=C("el-skeleton"),c=C("router-link");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[n(Pn,{class:"top-sold-products","card-options":{heading:A(u)("Top Sold Products"),linkButtonText:A(u)("View All"),linkButtonUrl:"products"}},{default:d(()=>[e.loading?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[a.value.length>0?(r(),h("ul",Zk,[(r(!0),h(H,null,ae(a.value,p=>(r(),h("li",{key:p.product_id},[n(c,{to:{name:"product_edit",params:{product_id:p.product_id}}},{default:d(()=>[o("div",eB,[o("div",tB,[p.media!==null?(r(),h("img",{key:0,src:p.media,alt:""},null,8,aB)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,lB))]),o("div",sB,[o("div",{class:"list-title-inner",title:p.product_name},m(p.product_name),9,nB),o("div",oB,"#"+m(A(ta)(p.product_id)),1)])]),o("div",iB,[o("div",rB,m(A(ta)(p.quantity_sold))+" "+m(A(u)(" Sold")),1),o("div",{class:"list-price",innerHTML:A(pt).scaled(p.total_amount)},null,8,dB)])]),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))],64))]),_:1},8,["card-options"])]),_:1})}}},uB={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},cB=["innerHTML"],AB={class:"fluent_cart_dashboard_inner"},pB={class:"fluent_cart_dashboard_main"},fB={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},mB={class:"fluent_cart_dashboard_aside"},hB={class:"fct-congrats-dialog-content"},_B={class:"fct-congrats-dialog-content-inner"},vB={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},gB=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=M(!1),a=M([]),l=M(!1),s=M(Ge.get("admin_url")+"settings/store-settings/pages_setup");si("dashboardTogglePageNotification",(v,b="")=>{l.value=v,b&&(s.value=b)});const c=()=>{const[v,b]=[et().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),et().format("YYYY-MM-DD 23:59:59")],k={startDate:v,endDate:b,paymentStatus:"all"};ol.getSalesGrowthChart({params:{...k,groupKey:"daily"}})},p=()=>{ol.getRecentOrders({params:null})},f=()=>{const v={paymentStatus:"all"};ol.getCountryHeatMap({params:{...v,groupKey:"daily"}})},_=()=>{const[v,b]=[et().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),et().format("YYYY-MM-DD 23:59:59")],k={startDate:v,endDate:b};ol.getTopSoldProducts({params:{...k}})},g=()=>{ln.getVueParams(),Qt.get("onboarding_congratulations","no")!=="yes"&&Ge.get("total_products_count")==0&&(Qt.set("onboarding_congratulations","yes"),t.value=!0)},y=()=>s.value;return Ie(()=>{window.addEventListener("getSalesGrowth",c),a.value=Ge.get("dummy_product_info"),c(),f(),p(),g(),_()}),(v,b)=>{const k=C("el-col"),w=C("el-row"),S=C("el-button"),$=C("el-dialog");return r(),h("div",uB,[l.value?(r(),E(Xa,{key:0,class:"mb-5",type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",{innerHTML:A(u)("Set up your pages first to get started %s",'<a href="'+y()+'" target="_blank">'+A(u)("Set up your pages")+"</a>")},null,8,cB)]),_:1})):B("",!0),o("div",AB,[o("div",pB,[n(jC),n(Rt,{permission:"dashboard_stats/view"},{default:d(()=>[o("div",fB,[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+m(A(u)("Last %s Days",A(ta)(30))),1)]),n(Vk)]),_:1}),n(Rt,{permission:"reports/view"},{default:d(()=>[n(Rw,{chartData:A(ol).data.salesGrowthChart,loading:A(ol).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),n(w,{gutter:24},{default:d(()=>[n(Rt,{permission:"reports/view"},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(iC)]),_:1})]),_:1}),n(Rt,{permission:"reports/view"},{default:d(()=>[n(k,{lg:12,class:"mt-6 xl:mt-0"},{default:d(()=>[n(Cd,{data:A(ol).topSoldProducts,loading:A(ol).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),n(Rt,{permission:"reports/view"},{default:d(()=>[n(k,{class:"mt-6"},{default:d(()=>[n(Gw,{data:A(ol).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",mB,[n(UC)])]),n($,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":b[1]||(b[1]=V=>t.value=V),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:d(()=>[o("div",hB,[o("div",_B,[b[2]||(b[2]=o("div",{class:"icon"},"🎉",-1)),o("h3",null,m(A(u)("Congratulations!")),1),o("p",null,m(A(u)("You successfully finished your onboarding & your store is ready.")),1),n(S,{type:"primary",onClick:b[0]||(b[0]=V=>t.value=!1)},{default:d(()=>[R(m(A(u)("Let's go")),1)]),_:1})])]),o("div",vB,[n(A(Yk),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),yB={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)}}},bB={key:2},wB=["onClick"],CB=["onClick"];function kB(e,t,a,l,s,i){const c=C("el-checkbox"),p=C("el-option"),f=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(c,{key:1,disabled:"",onClick:t[1]||(t[1]=b=>s.comingSoon=!0)},{default:d(()=>[R(m(a.labels.status_label),1)]),_:1})):(r(),E(c,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=b=>a.conditionals.status=b)},{default:d(()=>[R(m(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),h("div",bB,[R(m(a.labels.notification_if_start)+" ",1),n(f,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=b=>a.conditionals.type=b)},{default:d(()=>[(r(),h(H,null,ae({all:"All",any:"Any"},(b,k)=>n(p,{key:k,value:k},{default:d(()=>[R(m(b),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+m(a.labels.notification_if_end)+" ",1),(r(!0),h(H,null,ae(i.items,(b,k)=>(r(),E(v,{key:k,style:{"margin-top":"15px"},gutter:10},{default:d(()=>[n(_,{md:8},{default:d(()=>[n(f,{size:"default",modelValue:i.items[k].field,"onUpdate:modelValue":w=>i.items[k].field=w,style:{width:"100%"},onChange:w=>i.items[k].value=""},{default:d(()=>[(r(!0),h(H,null,ae(a.fields,(w,S)=>(r(),E(p,{key:S,label:w.admin_label,value:S},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),n(_,{md:5},{default:d(()=>[n(f,{size:"default",modelValue:i.items[k].operator,"onUpdate:modelValue":w=>i.items[k].operator=w},{default:d(()=>[n(g,{label:"General Operators"},{default:d(()=>[n(p,{value:"=",label:"equals"}),n(p,{value:"!=",label:"not equal"}),a.fields[b.field]&&!Object.keys(a.fields[b.field].options).length?(r(),h(H,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):B("",!0)]),_:2},1024),n(g,{label:"Advanced Operators"},{default:d(()=>[n(p,{value:"length_equal",label:"Equal to Data Length"}),n(p,{value:"length_less_than",label:"Less than to Data length"}),n(p,{value:"length_greater_than",label:"Greater than to Data Length"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),n(_,{md:8},{default:d(()=>[i.items[k].operator=="length_equal"||i.items[k].operator=="length_less_than"||i.items[k].operator=="length_greater_than"?(r(),E(y,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:i.items[k].value,"onUpdate:modelValue":w=>i.items[k].value=w},null,8,["modelValue","onUpdate:modelValue"])):(r(),h(H,{key:1},[a.fields[b.field]&&Object.keys(a.fields[b.field].options).length?(r(),E(f,{key:0,size:"default",modelValue:i.items[k].value,"onUpdate:modelValue":w=>i.items[k].value=w,style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(a.fields[b.field].options,(w,S)=>(r(),E(p,{key:S,label:w,value:S},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(y,{key:1,size:"default",placeholder:"Enter a value",modelValue:i.items[k].value,"onUpdate:modelValue":w=>i.items[k].value=w},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),n(_,{md:3,class:"action-btns"},{default:d(()=>[o("i",{class:"el-icon-plus",onClick:w=>i.add(k)},null,8,wB),i.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:w=>i.remove(k)},null,8,CB)):B("",!0)]),_:2},1024)]),_:2},1024))),128))])):B("",!0)])}const BB=lt(yB,[["render",kB]]),xB={name:"ErrorView",props:["field","errors"],computed:{Str(){return ca}}},SB={key:0,class:"fct-inline-error ff"};function FB(e,t,a,l,s,i){return a.errors.has(a.field)?(r(),h("p",SB,m(a.errors.errors[a.field].required?i.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):B("",!0)}const Ko=lt(xB,[["render",FB]]),$B={name:"InputPopover",components:{Popover:eA},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)}}},EB={class:"flex-1"},UB={key:0,class:"input-textarea-value"};function IB(e,t,a,l,s,i){const c=C("el-input"),p=C("Popover");return r(),h("div",{class:de(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",EB,[a.fieldType=="textarea"?(r(),h("div",UB,[n(c,{placeholder:a.placeholder,type:"textarea",modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=f=>s.model=f)},null,8,["placeholder","modelValue"])])):(r(),E(c,{key:1,placeholder:a.placeholder,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=f=>s.model=f),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),n(p,{class:de(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const QB=lt($B,[["render",IB]]),DB={name:"FieldGeneral",components:{inputPopover:QB},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)}}},VB={class:"fct-field-general"};function TB(e,t,a,l,s,i){const c=C("input-popover");return r(),h("div",VB,[n(c,{fieldType:a.field_type,placeholder:e.$t("Select a Field or Type Custom value"),modelValue:s.fieldValue,"onUpdate:modelValue":t[0]||(t[0]=p=>s.fieldValue=p),icon:"el-icon-arrow-down",data:a.editorShortcodes,onOnValueUpdated:t[1]||(t[1]=function(p){i.onValueUpdated(p)}),defaultValue:s.fieldValue},null,8,["fieldType","placeholder","modelValue","data","defaultValue"])])}const Xl=lt(DB,[["render",TB]]),MB={key:0,class:"fct-merge-fields"},LB={class:"fct-merge-fields-container"},RB={key:3},OB={name:"FieldMaps",components:{ErrorView:Ko,FieldGeneral:Xl},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}}},HB=Object.assign(OB,{setup(e){return(t,a)=>{const l=C("el-option"),s=C("el-select"),i=C("el-form-item");return t.appReady?(r(),h("div",MB,[o("div",LB,[(r(!0),h(H,null,ae(e.field.primary_fileds,(c,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:c.label,required:c.required},{default:d(()=>[c.input_options==="emails"?(r(),E(s,{key:0,modelValue:e.settings[c.key],"onUpdate:modelValue":f=>e.settings[c.key]=f,placeholder:t.$t("Select a Field"),clearable:"",class:de(e.errors.errors[c.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,ae(e.inputs,(f,_)=>(r(),h(H,{key:_},[(f==null?void 0:f.attributes.type)==="email"?(r(),E(l,{key:0,value:f==null?void 0:f.attributes.code,label:f==null?void 0:f.attributes.name},null,8,["value","label"])):B("",!0)],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"])):c.input_options==="all"?(r(),E(s,{key:1,modelValue:e.settings[c.key],"onUpdate:modelValue":f=>e.settings[c.key]=f,placeholder:t.$t("Select a Field"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.inputs,(f,_)=>(r(),E(l,{key:_,value:f.attributes.name,label:f.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),E(Xl,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[c.key],modelValue:e.settings[c.key],"onUpdate:modelValue":f=>e.settings[c.key]=f},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),c.help_text?(r(),h("div",RB,m(c.help_text),1)):B("",!0),n(Ko,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(r(!0),h(H,{key:0},ae(e.field.default_fields,c=>(r(),h("div",{class:"fct-merge-fields-item",key:c.name},[n(i,{label:c.label,required:c.required},{default:d(()=>[n(Xl,{editorShortcodes:e.editorShortcodes,defaultValue:e.settings[t.primary_field.key],modelValue:e.settings.default_fields[c.name],"onUpdate:modelValue":p=>e.settings.default_fields[c.name]=p},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"]),n(Ko,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):B("",!0),(r(!0),h(H,null,ae(e.merge_fields,(c,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:c},{default:d(()=>[n(Xl,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[p],onOnValueUpdated:function(f){t.onValueUpdated(f,p)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):B("",!0)}}}),PB={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 Qn(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},NB={class:"fluent_cart_list_select_filter"};function KB(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select");return r(),h("div",NB,[n(p,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=f=>a.settings[a.field.key]=f),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(H,null,ae(i.listItems,f=>(r(),E(c,{key:f.label,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const GB=lt(PB,[["render",KB]]),jB={name:"DropdownLabelRepeater",components:{FieldGeneral:Xl},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})}}},zB={class:"dropdown_label_repeater"},qB={key:0,class:"fluent_cart-table"};function YB(e,t,a,l,s,i){const c=C("el-input"),p=C("FieldGeneral"),f=C("el-button"),_=C("el-button-group");return r(),h("div",zB,[s.loading?B("",!0):(r(),h("table",qB,[o("thead",null,[o("tr",null,[o("th",null,m(a.field.field_label||"Field Label"),1),o("th",null,m(a.field.value_label||"Field Value"),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(H,null,ae(a.settings[a.field.key],(g,y)=>(r(),h("tr",{key:"item_"+y},[o("td",null,[n(c,{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,[n(p,{editorShortcodes:a.editorShortcodes,modelValue:g.item_value,"onUpdate:modelValue":v=>g.item_value=v},null,8,["editorShortcodes","modelValue","onUpdate:modelValue"])]),o("td",null,[n(_,null,{default:d(()=>[n(f,{type:"success",onClick:v=>i.addItemAfter(y)},{default:d(()=>t[1]||(t[1]=[R("+",-1)])),_:2,__:[1]},1032,["onClick"]),n(f,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>i.removeItem(y)},{default:d(()=>t[2]||(t[2]=[R("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const WB=lt(jB,[["render",YB]]),JB={name:"DropdownManyFields",components:{FieldGeneral:Xl,DynamicIcon:J,IconButton:Ze},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)}}},XB={class:"dropdown_label_repeater w-full"},ZB={class:"fluent_cart-table w-full text-left"},e8={class:"action-btns"},t8={class:"dropdown_label_repeater_footer"};function a8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=C("FieldGeneral"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-button");return r(),h("div",XB,[o("table",ZB,[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,m(s.rendered_labels.remote_text),1),o("th",null,m(s.rendered_labels.local_text),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(H,null,ae(a.settings[a.field.key],(v,b)=>(r(),h("tr",{key:"item_"+b},[o("td",null,[n(p,{modelValue:v.label,"onUpdate:modelValue":k=>v.label=k},{default:d(()=>[(r(!0),h(H,null,ae(a.field.options,(k,w)=>(r(),E(c,{key:w,label:k,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[n(f,{editorShortcodes:a.editorShortcodes,defaultValue:typeof v.item_value=="object"?"":v.item_value,modelValue:v.item_value,"onUpdate:modelValue":k=>v.item_value=k},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),o("td",null,[o("div",e8,[n(g,{size:"x-small",tag:"button",onClick:Ne(k=>i.removeItem(b),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:d(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),o("div",t8,[n(y,{text:"",onClick:Ne(i.addNewItem,["prevent"])},{default:d(()=>[n(_,{name:"Plus"}),R(" "+m(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const l8=lt(JB,[["render",a8]]),s8={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()}}},n8={class:"fluent_cart_chained_filter"};function o8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=Ma("loading");return qt((r(),h("div",n8,[n(p,{onChange:t[0]||(t[0]=_=>i.handleCategoryChange()),clearable:"",modelValue:s.chained_settings.category,"onUpdate:modelValue":t[1]||(t[1]=_=>s.chained_settings.category=_),placeholder:a.field.category_label},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,_=>(r(),E(c,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),qt(n(p,{modelValue:s.chained_settings.sub_category,"onUpdate:modelValue":t[2]||(t[2]=_=>s.chained_settings.sub_category=_),clearable:"",placeholder:a.field.subcategory_label},{default:d(()=>[(r(!0),h(H,null,ae(s.subcategories,_=>(r(),E(c,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),[[Dl,s.chained_settings.category]])])),[[f,s.loading]])}const i8=lt(s8,[["render",o8]]),r8={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;Qn(t,(a,l)=>{this.$set(this.field,l,a)})}).catch(e=>{})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),Qn(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}}},d8={class:"fluent_cart_chained_filter"};function u8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=C("el-col"),_=C("el-row"),g=Ma("loading");return qt((r(),h("div",d8,[n(_,{gutter:0},{default:d(()=>[(r(!0),h(H,null,ae(a.field.fields_options,(y,v)=>(r(),E(f,{span:12,key:v,class:"fluent_carteach_filter"},{default:d(()=>[o("label",null,m(a.field.options_labels[v].label),1),n(p,{onChange:b=>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":b=>a.value[v]=b},{default:d(()=>[(r(!0),h(H,null,ae(y,(b,k)=>(r(),E(c,{key:k,value:k,label:b},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,s.loading]])}const c8=lt(r8,[["render",u8]]),A8={name:"RoutingFilterFields",components:{DynamicIcon:J,IconButton:Ze,FieldGeneral:Xl},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)}}},p8={class:"fluent_cart_routing_fields"},f8={key:0,class:"fluent_cart_routing_table"},m8={class:"fluent_cart_inline"},h8={class:"action-btns"};function _8(e,t,a,l,s,i){const c=C("el-input"),p=C("el-option"),f=C("el-select"),_=C("FieldGeneral"),g=C("DynamicIcon"),y=C("IconButton");return r(),h("div",p8,[a.disabled?B("",!0):(r(),h("table",f8,[o("tbody",null,[(r(!0),h(H,null,ae(a.routings,(v,b)=>(r(),h("tr",{key:b},[o("td",null,[o("label",m8,m(a.labels.input_label),1),a.input_type=="text"?(r(),E(c,{key:0,placeholder:a.labels.input_placeholder,modelValue:v.input_value,"onUpdate:modelValue":k=>v.input_value=k},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(r(),E(f,{key:1,modelValue:v.input_value,"onUpdate:modelValue":k=>v.input_value=k,placeholder:a.labels.input_placeholder},{default:d(()=>[(r(!0),h(H,null,ae(a.input_options,(k,w)=>(r(),E(p,{key:w,label:k,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),t[0]||(t[0]=o("td",null,"If",-1)),o("td",null,[n(_,{editorShortcodes:a.editorShortcodes,modelValue:v.field,"onUpdate:modelValue":k=>v.field=k,defaultValue:v.field,onChange:k=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),o("td",null,[n(f,{modelValue:v.operator,"onUpdate:modelValue":k=>v.operator=k,class:"w-[100px]"},{default:d(()=>[n(p,{value:"=",label:"equal"}),n(p,{value:"!=",label:"not equal"}),n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),a.fields[v.field]&&!Object.keys(a.fields[v.field].options).length?(r(),h(H,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):B("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[a.fields[v.field]&&Object.keys(a.fields[v.field].options).length?(r(),E(f,{key:0,modelValue:v.value,"onUpdate:modelValue":k=>v.value=k,style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(a.fields[v.field].options,(k,w)=>(r(),E(p,{key:w,label:k,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(c,{key:1,placeholder:e.$t("Enter a value"),modelValue:v.value,"onUpdate:modelValue":k=>v.value=k},null,8,["placeholder","modelValue","onUpdate:modelValue"]))]),o("td",null,[o("div",h8,[n(y,{size:"x-small",tag:"button",onClick:Ne(k=>i.add(b),["prevent"])},{default:d(()=>[n(g,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(r(),E(y,{key:0,size:"x-small",tag:"button",onClick:Ne(k=>i.remove(b),["prevent"])},{default:d(()=>[n(g,{name:"Minus"})]),_:2},1032,["onClick"])):B("",!0)])])]))),128))])]))])}const v8=lt(A8,[["render",_8]]),g8={name:"SelectionRouting",components:{RoutingFilterFields:v8,FiledGeneral:Xl},props:["field","settings","inputs","editorShortcodes"]},y8={class:"fluent_cart_field_routing"},b8={class:"mb-4"},w8={key:3};function C8(e,t,a,l,s,i){const c=C("el-checkbox"),p=C("el-option"),f=C("el-select"),_=C("el-input"),g=C("FiledGeneral"),y=C("RoutingFilterFields");return r(),h("div",y8,[o("div",b8,[n(c,{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:d(()=>[R(m(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),o("div",null,[a.field.simple_component=="select"?(r(),E(f,{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:d(()=>[(r(!0),h(H,null,ae(a.field.options,(v,b)=>(r(),E(p,{key:b,value:b,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"])):B("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),h("p",w8,m(a.field.inline_tip),1)):B("",!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"])):B("",!0)])}const k8=lt(g8,[["render",C8]]),B8={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=Df(e).bind(this);return Vf(t,{settings:this.settings,app:this})}return null}},x8={name:"FeedHeader",props:{integration_name:String,settings:Object},computed:{ArrowRight(){return dl},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},S8={class:"fct-feed-header mb-5"},F8={class:"mb-5 flex items-center justify-between"},$8={class:"capitalize"};function E8(e,t,a,l,s,i){const c=C("el-breadcrumb-item"),p=C("el-breadcrumb"),f=C("el-switch");return r(),h("div",S8,[o("div",F8,[n(p,{"separator-icon":i.ArrowRight},{default:d(()=>[n(c,{to:i.prevRoute},{default:d(()=>[R(m(e.$t("Integrations")),1)]),_:1},8,["to"]),n(c,null,{default:d(()=>[o("span",$8,m(a.integration_name),1)]),_:1})]),_:1},8,["separator-icon"]),n(f,{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 U8=lt(x8,[["render",E8]]);class I8{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 Q8={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(s=>{this.options=s.options,a&&s.options&&(window[a]=s.options)}).catch(s=>{this.handleError(s)}).finally(()=>{this.loading=!1})}}};function D8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=Ma("loading");return qt((r(),E(p,{modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=_=>s.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:d(()=>[(r(!0),h(H,null,ae(s.options,_=>(r(),E(c,{key:_.id,label:_.title,value:_.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","multiple","remote","clearable","disabled","allow-create","size","placeholder","remote-method"])),[[f,s.loading]])}const V8=lt(Q8,[["render",D8]]),T8={name:"FeedEditor",components:{FilterFields:BB,MergeFieldMapper:HB,FiledGeneral:Xl,ListSelectFilter:GB,DropDownLabelRepeater:WB,DropDownManyFields:l8,ChainedFields:i8,ChainedSelects:c8,SelectionRouting:k8,CardContainer:Be,CardBody:Ce,CardHeader:Qe,LabelHint:fa,FeedHeader:U8,ErrorView:Ko,CustomComponentRender:B8,RestSelector:V8},data(){return{loading_app:!1,loading_list:!1,errors:new I8,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:{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:u,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"?z.validationErrors(t):z.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]={}}}},M8={class:"fct-integration-container fct-layout-width"},L8={class:"fct-add-integration py-7.5"},R8={class:"grid gap-5"},O8={key:0,class:"fct-setting-form-content"},H8=["innerHTML"],P8={class:"fct-setting-form-fields"},N8=["innerHTML"],K8=["innerHTML"],G8=["innerHTML"],j8={key:0,class:"fct-setting-form-row"},z8={class:"fct-setting-form-content"},q8={class:"fct-setting-form-content"},Y8={class:"fct-setting-form-fields"},W8={class:"fct-inline-tip pl-6"},J8={key:0,class:"setting-save-action"};function X8(e,t,a,l,s,i){const c=C("el-skeleton-item"),p=C("el-skeleton"),f=C("FeedHeader"),_=C("LabelHint"),g=C("el-input"),y=C("ErrorView"),v=C("el-option"),b=C("el-select"),k=C("MergeFieldMapper"),w=C("el-checkbox"),S=C("el-checkbox-group"),$=C("el-option-group"),V=C("FilterFields"),F=C("FiledGeneral"),x=C("ListSelectFilter"),Q=C("DropDownLabelRepeater"),D=C("DropDownManyFields"),T=C("el-radio"),U=C("el-radio-group"),I=C("el-input-number"),O=C("ChainedFields"),L=C("ChainedSelects"),P=C("SelectionRouting"),q=C("RestSelector"),X=C("CardBody"),G=C("CardContainer"),te=C("el-button"),ne=C("el-form"),re=Ma("loading");return r(),h("div",M8,[o("div",L8,[n(p,{loading:s.loading_app,class:"bg-white rounded p-6 mb-7.5 dark:bg-dark-700",animated:""},{template:d(()=>[n(c,{variant:"h3",class:"w-[150px] mb-5"}),o("div",R8,[o("div",null,[n(c,{variant:"h3",class:"w-[50px] mb-3"}),n(c,{variant:"p"})]),o("div",null,[n(c,{variant:"h3",class:"w-[50px] mb-3"}),n(c,{variant:"p"})])])]),_:1},8,["loading"]),s.loading_app?B("",!0):(r(),E(ne,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(f,{settings:s.settings,integration_name:s.integration_name},null,8,["settings","integration_name"]),n(G,null,{default:d(()=>[n(X,null,{default:d(()=>[(r(!0),h(H,null,ae(s.settings_fields.fields,(K,Y)=>(r(),h("div",{key:Y,class:de(["fct-setting-form-row",K.key])},[K.label?(r(),h("div",O8,[K.tips?(r(),E(_,{key:0,title:K.label,content:K.tips,placement:"top-start",required:K.required},null,8,["title","content","required"])):(r(),E(_,{key:1,title:K.label,required:K.required},null,8,["title","required"])),K.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:K.inline_tip},null,8,H8)):B("",!0)])):B("",!0),o("div",P8,[K.component==="text"?(r(),h(H,{key:0},[n(g,{placeholder:K.placeholder,modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W,class:de(s.errors.errors[K.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="list_ajax_options"?(r(),h(H,{key:1},[qt((r(),E(b,{onChange:t[0]||(t[0]=W=>i.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=W=>s.settings.list_id=W),placeholder:K.placeholder,clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(W,j)=>(r(),E(v,{key:j,value:j,label:W},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[re,s.loading_list]]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="map_fields"?(r(),E(k,{key:2,onSetMergeModelObj:W=>i.setMergeModel(K),errors:s.errors,inputs:s.inputs,field:K,settings:s.settings,editorShortcodes:s.editorShortcodes,merge_model:s.settings[K.key],merge_fields:s.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):K.component==="select"?(r(),h(H,{key:3},[n(b,{filterable:"",clearable:"",multiple:K.is_multiple,modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W,placeholder:K.placeholder},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(W,j)=>(r(),E(v,{key:j,value:j,label:W},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="checkbox-single"?(r(),h(H,{key:4},[n(w,{modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W},{default:d(()=>[R(m(K.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:K.inline_tip},null,8,N8)):B("",!0)],64)):K.component==="yes-no-checkbox"?(r(),h(H,{key:5},[n(w,{"true-value":"yes","false-value":"no",modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W},{default:d(()=>[R(m(K.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:K.inline_tip},null,8,K8)):B("",!0)],64)):K.component==="checkbox-multiple"?(r(),E(S,{key:6,modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(W,j)=>(r(),E(w,{key:j,label:Number(j)},{default:d(()=>[R(m(W),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):K.component==="selection_group"?(r(),h(H,{key:7},[n(b,{modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W,placeholder:K.placeholder,multiple:"",class:de(s.errors.errors[K.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(W,j)=>(r(),E($,{key:j,label:W.label},{default:d(()=>[(r(!0),h(H,null,ae(W.options,ie=>(r(),E(v,{key:ie.value,label:ie.label,value:ie.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="conditional_block"?(r(),E(V,{key:8,fields:s.inputs,conditionals:s.settings[K.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):K.component==="value_text"?(r(),E(F,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[K.key],modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):K.component==="value_textarea"?(r(),E(F,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[K.key],modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):K.component==="list_select_filter"?(r(),E(x,{key:11,settings:s.settings,field:K},null,8,["settings","field"])):K.component==="dropdown_label_repeater"?(r(),E(Q,{key:12,errors:s.errors,inputs:s.inputs,field:K,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):K.component==="dropdown_many_fields"?(r(),E(D,{key:13,errors:s.errors,inputs:s.inputs,field:K,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):K.component==="radio_choice"?(r(),E(U,{key:14,modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(W,j)=>(r(),E(T,{key:j,label:j},{default:d(()=>[R(m(W),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):K.component==="number"?(r(),E(I,{key:15,size:"default",modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W},null,8,["modelValue","onUpdate:modelValue"])):K.component==="chained_fields"?(r(),E(O,{key:16,settings:s.settings,modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W,field:K},null,8,["settings","modelValue","onUpdate:modelValue","field"])):K.component==="chained_select"?(r(),E(L,{key:17,settings:s.settings,modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W,field:K},null,8,["settings","modelValue","onUpdate:modelValue","field"])):K.component==="html_info"?(r(),h("div",{key:18,innerHTML:K.html_info},null,8,G8)):K.component==="selection_routing"?(r(),E(P,{key:19,inputs:s.inputs,field:K,editorShortcodes:s.editorShortcodes,settings:s.settings},null,8,["inputs","field","editorShortcodes","settings"])):K.component==="rest_selector"?(r(),E(q,{key:20,field:K,modelValue:s.settings[K.key],"onUpdate:modelValue":W=>s.settings[K.key]=W},null,8,["field","modelValue","onUpdate:modelValue"])):K.component==="custom_component"?(r(),E(Bl("custom-component-render"),{key:21,field:K,settings:s.settings},null,8,["field","settings"])):B("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(r(),h("div",j8,[o("div",z8,[o("div",q8,[n(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",Y8,[n(b,{filterable:"",clearable:"",multiple:!0,modelValue:s.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=K=>s.settings.conditional_variation_ids=K),placeholder:e.$t("Leave empty for all the variations")},{default:d(()=>[(r(!0),h(H,null,ae(s.product_variations,K=>(r(),E(v,{key:K.id,value:K.id,label:K.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),o("p",W8,m(e.$t("Leave empty to run this feed for all variations")),1)])])):B("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),h("div",J8,[n(te,{type:"primary",loading:s.saving,onClick:i.saveNotification},{default:d(()=>[R(m(s.integration_id?`Update ${s.settings_fields.integration_title} Feed`:`Create ${s.settings_fields.integration_title} Feed`),1)]),_:1},8,["loading","onClick"])])):B("",!0)]),_:1}))])])}const Wu=lt(T8,[["render",X8]]),Z8={class:"setting-wrap"},e4={key:0,class:"integration-actions"},t4={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},a4={class:"text-base"},l4={key:1,class:"fct-integrations-table-wrap"},s4={class:"fct-integration-logo-wrap"},n4=["src","alt"],o4={class:"text-xs text-gray-700"},i4=["onClick"],r4={class:"fct-event-triggers"},d4={class:"fct-event-triggers"},u4={class:"fct-btn-group sm"},c4={key:2,class:"fct-integration-table-footer"},A4={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},p4={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 s;this.handleError(((s=l==null?void 0:l.data)==null?void 0:s.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:od}},f4=Object.assign(p4,{setup(e){return(t,a)=>{const l=C("el-button"),s=C("el-dropdown-item"),i=C("el-dropdown-menu"),c=C("el-dropdown"),p=C("el-skeleton"),f=C("el-switch"),_=C("el-table-column"),g=C("el-tag"),y=C("el-popover"),v=C("el-tooltip"),b=C("el-table"),k=Ma("loading");return r(),h("div",Z8,[n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:t.$t("Global Integrations Feeds"),text:t.$t("These integration feeds will be applied globally across all your orders and related actions.")},{action:d(()=>[t.hasActiveIntegrations?(r(),h("div",e4,[n(c,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(i,null,{default:d(()=>[(r(!0),h(H,null,ae(t.available_integrations,(w,S)=>(r(),E(s,{key:S,command:S},{default:d(()=>[R(m(w.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(l,{type:"info",plain:"",size:"small"},{default:d(()=>[R(m(t.$t("Add Integration"))+" ",1),n(J,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):B("",!0)]),_:1},8,["title","text"]),n(Ce,{class:"px-0 pb-0 pt-4"},{default:d(()=>[n(p,{class:"px-5 pb-5",loading:t.loading,animated:"",rows:6},null,8,["loading"]),t.loading?B("",!0):(r(),h(H,{key:0},[t.hasActiveIntegrations?(r(),h("div",l4,[qt((r(),E(b,{data:t.feeds},{empty:d(()=>[n(wt,{icon:"Folder",text:t.$t("You did not add any integration actions yet.")},null,8,["text"])]),default:d(()=>[n(_,{label:t.$t("Enabled"),width:60},{default:d(w=>[n(f,{"active-value":"yes","inactive-value":"no",onChange:S=>t.handleActive(w.row),modelValue:w.row.enabled,"onUpdate:modelValue":S=>w.row.enabled=S},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(_,{width:120,label:t.$t("Integration")},{default:d(w=>{var S,$;return[o("div",s4,[(S=t.available_integrations[w.row.provider])!=null&&S.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,n4)):B("",!0),o("span",o4,m((($=t.available_integrations[w.row.provider])==null?void 0:$.title)||w.row.provider),1)])]}),_:1},8,["label"]),n(_,{width:220,label:t.$t("Title")},{default:d(w=>[o("a",{class:"fct-action-link-btn",onClick:Ne(S=>t.edit(w.row),["prevent"]),href:"#"},m(w.row.name),9,i4)]),_:1},8,["label"]),n(_,{width:160,label:t.$t("Triggers")},{default:d(w=>[o("div",r4,[(r(!0),h(H,null,ae((w.row.feed.event_trigger||[]).slice(0,2),(S,$)=>(r(),E(g,{key:S},{default:d(()=>[n(J,{name:"Trigger"}),R(" "+m(A(ca).headline(S)),1)]),_:2},1024))),128)),(w.row.feed.event_trigger||[]).length>2?(r(),E(y,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(g,{type:"info"},{default:d(()=>[R(" +"+m((w.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",d4,[(r(!0),h(H,null,ae((w.row.feed.event_trigger||[]).slice(2),(S,$)=>(r(),E(g,{key:S+$},{default:d(()=>[n(J,{name:"Trigger"}),R(" "+m(A(ca).headline(S)),1)]),_:2},1024))),128))])]),_:2},1024)):B("",!0)])]),_:1},8,["label"]),n(_,{width:80},{default:d(w=>[o("div",u4,[n(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",onClick:S=>t.edit(w.row),size:"x-small",hover:"primary"},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(v,{effect:"dark",content:t.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",size:"x-small",onClick:S=>t.removeFeed(w.row.id,w),hover:"danger"},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[k,t.loading]])])):(r(),h("div",t4,[o("p",a4,m(t.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),n(l,{tag:"a",type:"primary",href:t.all_module_config_url},{default:d(()=>[R(m(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?B("",!0):(r(),h("div",c4,[o("a",A4,m(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),m4={name:"Integrations",components:{Badge:ma,FluidTabItem:$o,FluidTab:Zr,CardBody:Ce,CardContainer:Be,CardHeader:Qe,PageHeading:nl,IconButton:Ze,DynamicIcon:J,Empty:wt,GlobalIntegrationFeeds:f4},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:Ge.get("admin_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};Qn(e,(a,l)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[l]=a)}),e=t}if(this.module_type!="all"){let t={};Qn(e,(a,l)=>{a.categories&&a.categories.includes(this.module_type)&&(t[l]=a)}),e=t}return e},is_no_modules(){return od(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{upgradeUrl:om,fetchAddons(){this.fetching=!0,this.$get("integration/addons").then(e=>{this.addOns=e.addons}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},translate:u,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=""})}}},h4={class:"fct-integration-container fct-layout-width"},_4={class:"fct-integration-content mt-8"},v4={class:"fct-integration-content-head"},g4={class:"fct-card-header-title mb-1"},y4={class:"card-header-text mt-0"},b4={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"},w4={class:"fct-integration-search"},C4={key:1},k4={class:"fct-integration-card-content"},B4={class:"fct-integration-card-content-inner"},x4={class:"fct-integration-card-logo"},S4=["src","alt"],F4={class:"title"},$4={class:"desc"},E4={key:0,class:"mt-2"},U4={key:1,class:"mt-2"};function I4(e,t,a,l,s,i){const c=C("PageHeading"),p=C("GlobalIntegrationFeeds"),f=C("DynamicIcon"),_=C("IconButton"),g=C("FluidTabItem"),y=C("FluidTab"),v=C("el-input"),b=C("el-skeleton"),k=C("Badge"),w=C("el-button"),S=C("Empty"),$=C("CardBody"),V=C("CardContainer");return r(),h("div",h4,[n(c,{title:e.$t("Integrations & Addons")},null,8,["title"]),n(p),o("div",_4,[n(V,null,{default:d(()=>[n($,null,{default:d(()=>[o("div",v4,[n(_,{circle:"",size:"large"},{default:d(()=>[n(f,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",g4,m(e.$t("Integration Modules")),1),o("p",y4,m(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",b4,[n(y,null,{default:d(()=>[(r(!0),h(H,null,ae(s.modules,(F,x)=>(r(),E(g,{key:x,class:de(["uppercase",F===s.module_type?"active":""]),onClick:Q=>i.changeModuleType(F)},{default:d(()=>[R(m(F),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",w4,[n(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=F=>s.search=F)},{prefix:d(()=>[n(f,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(r(),E(b,{key:0,loading:!0,animated:"",rows:4})):B("",!0),s.fetching?B("",!0):(r(),h("div",C4,[(r(!0),h(H,null,ae(i.filteredAddons,(F,x)=>(r(),h("div",{key:x,class:de(["fct-integration-card","addon-enabled-"+F.enabled])},[o("div",k4,[o("div",B4,[o("div",x4,[F.logo?(r(),h("img",{key:0,src:F.logo,alt:F.title},null,8,S4)):B("",!0)]),o("div",null,[o("h5",F4,[R(m(F.title)+" ",1),F.is_pro&&!F.enabled?(r(),E(k,{key:0,status:"warning",text:"Pro"})):(r(),E(k,{key:1,status:F.enabled?"active":"info",text:F.enabled?"enabled":"disabled"},null,8,["status","text"]))]),o("p",$4,m(F.description),1),F.is_pro&&!F.is_pro_active?(r(),h("div",E4,[n(w,{type:"warning",size:"small",tag:"a",href:i.upgradeUrl("feature_lock_integrations"),target:"_blank"},{default:d(()=>[n(f,{name:"Crown",class:"mr-1"}),R(" "+m(i.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!F.enabled&&F.installable?(r(),h("div",U4,[n(w,{loading:s.installingAdding==x,disabled:s.installingAdding==x,onClick:Q=>i.installAddon(F,x),type:"primary",size:"small"},{default:d(()=>[R(m(i.translate("Install %s",F.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):B("",!0)])])])],2))),128))])),i.is_no_modules&&!s.fetching?(r(),E(S,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):B("",!0)]),_:1})]),_:1})])])}const Q4=lt(m4,[["render",I4]]),D4={class:"fct-connect-details"},V4={key:0,class:"fct-connect-require"},T4=["src"],M4={key:1,class:"fct-connect-success"},L4={class:"inline-flex items-center gap-3"},R4={key:0,class:"display-name"},O4={class:"display-role"},H4={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)})}}},Ju=Object.assign(H4,{setup(e){return(t,a)=>{var c;const l=C("el-button"),s=C("el-tag"),i=C("el-popconfirm");return r(),h("div",D4,[!e.connect||e.connect.error?(r(),h("div",V4,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,T4),o("h4",null,m(A(u)("Connect your %1$s %2$s account",e.mode,e.methodName)),1),n(l,{tag:"a",href:e.connectConfig[e.mode+"_redirect"],style:ua({backgroundColor:e.brandColor,borderColor:e.brandColor,color:"white"})},{default:d(()=>[R(m(A(u)("Connect with %1$s",e.methodLabel)),1)]),_:1},8,["href","style"])])):(r(),h("div",M4,[o("div",L4,[o("div",null,[e.connect.display_name?(r(),h("p",R4,m(e.connect.display_name),1)):B("",!0),o("h4",O4,m(t.$t("Administrator"))+" ("+m(t.$t("Owner"))+") ",1)]),n(s,{size:"small",type:"success"},{default:d(()=>[R(m(A(u)("Connected")),1)]),_:1})]),n(i,{width:"230","confirm-button-text":t.$t("Confirm"),"cancel-button-text":t.$t("No, Thanks"),icon:"el-icon-info","icon-color":"red",title:((c=e.connectConfig)==null?void 0:c.disconnect_note)??t.$t("Are you sure to disconnect?"),position:"top",onConfirm:t.disconnect},{reference:d(()=>[n(l,{type:"danger",plain:""},{default:d(()=>[R(m(A(u)("Disconnect")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])]))])}}}),P4={__name:"Tabs",props:{fields:Object,settings:Object,tabs:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-tab-pane"),s=C("el-tabs");return r(),E(s,{class:"demo-tabs",modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=i=>e.settings[e.index]=i)},{default:d(()=>[(r(!0),h(H,null,ae(e.tabs.schema,(i,c)=>(r(),E(l,{label:i.label,name:i.value,key:c},{default:d(()=>[o("div",null,[n(kd,{fields:i.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},N4={class:"setting-label"},K4=["innerHTML"],G4={key:0},j4={__name:"RadioSelectDependants",props:{fields:Object,settings:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-icon"),s=C("el-tooltip"),i=C("el-radio"),c=C("el-radio-group");return r(),h(H,null,[o("p",N4,[R(m(e.fields[e.index].label)+" ",1),e.fields[e.index].tooltip?(r(),E(s,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:e.fields[e.index].tooltip},null,8,K4)]),default:d(()=>[n(l,null,{default:d(()=>[n(A(al))]),_:1})]),_:1})):B("",!0)]),n(c,{modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=p=>e.settings[e.index]=p)},{default:d(()=>[(r(!0),h(H,null,ae(e.fields[e.index].options,(p,f)=>(r(),E(i,{label:p,value:f,key:f},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(H,null,ae(e.fields[e.index].dependants,(p,f)=>(r(),h("div",{key:f},[e.settings[e.index]===p.value?(r(),h("div",G4,[n(kd,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):B("",!0)]))),128))],64)}}},z4={name:"PayPalWebhookSetup",components:{Notify:z},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",z.success(e.message),this.$emit("reload_settings",!0)}).catch(e=>{this.isLoading=!1,this.setupStatus="error",z.error(e.message),setTimeout(()=>{window.location.reload()},2e3)})}}},q4={key:0,class:"fluent_cart_paypal_webhook_setup"},Y4={class:"fluent_cart_paypal_webhook_setup_title"},W4=["innerHTML"],J4={key:1};function X4(e,t,a,l,s,i){const c=C("el-button"),p=Ma("loading");return i.isConnected?(r(),h("div",q4,[o("p",Y4,"PayPal "+m(a.mode)+" webhook setup",1),a.webhook_info?qt((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,W4)),[[p,s.checkingWebhook]]):(r(),h("div",J4,[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)),n(c,{type:e.text,loading:s.isLoading,onClick:i.setupWebhook,disabled:s.isLoading,class:"setup-button",size:"small"},{default:d(()=>t[0]||(t[0]=[o("span",null,"Setup Webhook",-1)])),_:1,__:[0]},8,["type","loading","onClick","disabled"])]))])):B("",!0)}const Z4=lt(z4,[["render",X4],["__scopeId","data-v-f187f73f"]]),ex={key:0,class:"fct-col"},tx=["innerHTML"],ax={key:1,class:"fct-col"},lx={class:"font-bold p-6 mt-6 text-center bg-gray-200"},sx={key:2,class:"fct-col"},nx={class:"bg-gray-25 dark:bg-dark-500 p-5 rounded flex flex-col"},ox={class:"text-red-700"},ix={key:1},rx={key:0},dx={class:"flex items-center justify-between"},ux={key:1,class:"flex items-center justify-between"},cx={class:"text-red-700"},Ax={key:3,class:"fct-col"},px={class:"setting-label"},fx=["innerHTML"],mx={key:0,class:"fct-settings-description"},hx={key:4,class:"fct-col"},_x=["innerHTML"],vx={key:0,class:"fct-settings-description"},gx={key:5,class:"fct-col"},yx={class:"setting-label"},bx=["innerHTML"],wx={key:0,class:"fct-settings-description"},Cx={key:6,class:"fct-col"},kx={class:"setting-label flex items-center gap-1"},Bx=["innerHTML"],xx={class:"options-img"},Sx=["src"],Fx={class:"options-name"},$x={class:"options-text"},Ex={key:0,class:"fct-settings-description"},Ux={key:7,class:"fct-col"},Ix={key:0},Qx=["innerHTML"],Dx={key:8,class:"fct-col"},Vx={class:"setting-label"},Tx={key:0,class:"fct-settings-description"},Mx={key:9,class:"fct-col"},Lx={class:"setting-label"},Rx={key:0,class:"fct-settings-description"},Ox={key:10,class:"fct-col"},Hx={class:"setting-label"},Px={key:0,class:"fct-settings-description"},Nx={key:11,class:"fct-col"},Kx={class:"setting-label"},Gx=["innerHTML"],jx={key:0,class:"fct-settings-description"},zx={key:12,class:"fct-col"},qx={class:"setting-label"},Yx=["innerHTML"],Wx={key:0,class:"fct-settings-description"},Jx={key:13,class:"fct-col"},Xx={class:"setting-label"},Zx=["innerHTML"],e3={key:0,class:"fct-settings-description"},t3={key:14,class:"fct-col"},a3={class:"setting-label"},l3={key:0,class:"fct-settings-description"},s3={key:15,class:"fct-col"},n3=["innerHTML"],o3={key:1},i3={key:0,class:"setting-label"},r3={key:1,class:"copyable-content"},d3={key:2},u3={key:0,class:"setting-label"},c3={class:"fct-payment-steps-list"},A3={class:"fct-payment-steps-number"},p3=["innerHTML"],f3={key:4,class:"fct-events-wrap"},m3={class:"setting-label"},h3={class:"flex items-center gap-2 flex-wrap"},_3={class:"copyable-content"},v3={key:5,class:"fct-webhook-notice"},g3={class:"fct-webhook-notice-title"},y3={class:"fct-webhook-notice-desc"},b3={key:0},w3={key:16,class:"fct-col"},C3={key:0},k3={key:0},B3={class:"setting-label"},x3={class:"flex flex-wrap gap-2"},S3=["href"],F3={key:1},$3={class:"setting-label"},E3={class:"flex flex-wrap gap-2"},U3=["href"],I3={key:17,class:"fct-col"},Q3={key:18,class:"fct-col"},kd={__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=Yt().ctx,l=M({}),s=M(null),i=M(null),c=M(!1),p=M({}),f=Ge.get("shop.order_mode"),_=e,g=t,y=N(()=>{var F,x,Q;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?(x=_.settings)==null?void 0:x.define_test_keys:(Q=_.settings)==null?void 0:Q.define_live_keys});N(()=>{var F,x;return(F=_.fields)!=null&&F.payment_mode&&((x=_.settings)==null?void 0:x.payment_mode)!==f&&g("onSettingsChange",{..._.settings,payment_mode:f}),!0});const v=N(()=>{var F;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?"test":"live"}),b=()=>{c.value=!0,a.$get("settings/payment-methods/connect/info",{method:_.routeName}).then(F=>{F&&(c.value=!1,l.value=F.connect_config,g("onSettingsChange",F.settings),s.value=F.live_account,i.value=F.test_account,s.value.error&&(p.value=s.value),i.value.error&&(p.value=i.value),c.value=!1)}).catch(F=>{c.value=!1,p.value=F}).finally(()=>{c.value=!1})},k=F=>{const x=F.target;if(x.classList.contains("fct-install-addon-btn")||x.closest(".fct-install-addon-btn")){F.preventDefault(),F.stopPropagation();const Q=x.classList.contains("fct-install-addon-btn")?x:x.closest(".fct-install-addon-btn"),D=Q.getAttribute("data-addon-slug"),T=Q.getAttribute("data-addon-file"),U=Q.getAttribute("data-source-type"),I=Q.getAttribute("data-source-link"),O=Q.getAttribute("data-repo-link");D&&T&&O&&S({slug:D,source_type:U||"github",source_link:I||"",repo_link:O||""});return}if(x.classList.contains("fct-activate-addon-btn")||x.closest(".fct-activate-addon-btn")){F.preventDefault(),F.stopPropagation();const D=(x.classList.contains("fct-activate-addon-btn")?x:x.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");D&&$({file:D})}},w=Ge.get("app_config.isProActive"),S=F=>{if(!w){window.open(F.repo_link,"_blank","noopener,noreferrer");return}const x=document.querySelector(`[data-addon-slug="${F.slug}"]`);x&&(x.disabled=!0,x.innerHTML='<span class="el-icon-loading"></span> '+u("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:F.slug,source_type:F.source_type,source_link:F.source_link}).then(Q=>{z.success({message:Q.message||u("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(Q=>{z.error({message:(Q==null?void 0:Q.message)||u("Failed to install addon")}),x&&(x.disabled=!1,x.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>'+u("Install Addon"))})},$=F=>{const x=document.querySelector(`[data-addon-file="${F.file}"]`);x&&(x.disabled=!0,x.innerHTML='<span class="el-icon-loading"></span> '+u("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:F.file}).then(Q=>{z.success({message:Q.message||u("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(Q=>{z.error({message:(Q==null?void 0:Q.message)||u("Failed to activate addon")}),x&&(x.disabled=!1,x.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>'+u("Activate Addon"))})},V=F=>F?Array.isArray(F)?F:F[v.value]??[]:[];return Ie(()=>{b(),document.addEventListener("click",k)}),xt(()=>{document.removeEventListener("click",k)}),(F,x)=>{const Q=C("el-skeleton-item"),D=C("el-skeleton"),T=C("el-icon"),U=C("el-tooltip"),I=C("el-switch"),O=C("el-checkbox"),L=C("el-option"),P=C("el-select"),q=C("el-radio"),X=C("el-radio-group"),G=C("el-input"),te=C("el-input-number"),ne=C("el-checkbox-group"),re=C("el-tag");return r(),h("div",{class:de([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(H,null,ae(e.fields,(K,Y)=>{var W,j,ie,he,me,ye;return r(),h("div",{class:"fct-setting-row fct-row",key:Y},[K.type==="notice"?(r(),h("div",ex,[o("p",{innerHTML:K.value},null,8,tx)])):B("",!0),K.type==="upcoming"?(r(),h("div",ax,[o("h1",lx,m(A(u)("Upcoming")),1)])):B("",!0),K.type==="provider"?(r(),h("div",sx,[K.value=="connect"?(r(),h(H,{key:0},[e.settings.payment_mode=="test"?(r(),h(H,{key:0},[n(D,{loading:c.value,animated:""},{template:d(()=>[n(Q,{variant:"h3",class:"w-[150px] mb-3"}),n(Q,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),c.value?B("",!0):(r(),E(Ju,{key:0,onReload_settings:x[0]||(x[0]=se=>b()),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(H,{key:1},[n(D,{loading:c.value,animated:""},{template:d(()=>[o("div",nx,[n(Q,{variant:"h3",class:"w-9 h-9 mb-7 mx-auto rounded"}),n(Q,{variant:"h3",class:"w-[200px] mx-auto mb-3"}),n(Q,{variant:"h3",class:"w-[120px] h-7.5 mx-auto"})])]),_:1},8,["loading"]),c.value?B("",!0):(r(),E(Ju,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:x[1]||(x[1]=se=>b()),connectConfig:l.value,mode:"live",methodLabel:e.methodLabel,connect:s.value,brandColor:e.brandColor},null,8,["method","methodName","connectConfig","methodLabel","connect","brandColor"]))],64)):B("",!0),o("p",ox,m((W=p.value)==null?void 0:W.error),1)],64)):(r(),h("div",ix,[y.value?(r(),h("div",rx,[o("div",null,[n(n2,{title:A(u)("Your API setup is Up & Running 🎉")},{default:d(()=>[o("div",dx,[o("div",null,[o("b",null,m(A(u)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),h("div",ux,[o("div",null,[o("b",null,m(A(u)("Payment API settings is not enabled by API keys / Connect")),1),x[3]||(x[3]=o("br",null,null,-1)),o("p",null,m(A(u)("You can Set Up API keys defined as constant, Or use connect.")),1),o("p",cx,m((j=p.value)==null?void 0:j.error),1)])]))]))])):B("",!0),K.type==="enable"?(r(),h("div",Ax,[o("p",px,[R(m(K.label)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,fx)]),default:d(()=>[n(T,null,{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),n(I,{modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,"active-value":"yes","inactive-value":"no","active-text":A(u)("Active"),"inactive-text":A(u)("Inactive")},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text"]),K.description?(r(),h("p",mx,m(K.description),1)):B("",!0)])):B("",!0),K.type==="checkbox"?(r(),h("div",hx,[n(O,{"true-value":"yes","false-value":"no",modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,disabled:K.disabled},{default:d(()=>[R(m(K.label)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,_x)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),K.description?(r(),h("p",vx,m(K.description),1)):B("",!0)])):B("",!0),K.type==="select"?(r(),h("div",gx,[o("p",yx,[R(m(K.label)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,bx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),n(P,{placeholder:K.placeholder,modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,filterable:K.filterable!==!1},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(se,fe)=>(r(),E(L,{label:se.label,value:se.value,key:fe},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),K.description?(r(),h("p",wx,m(K.description),1)):B("",!0)])):B("",!0),K.type==="radio"?(r(),h("div",Cx,[o("p",kx,[R(m(K.label)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,Bx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),n(X,{modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,class:de({"fct-payment-setting-radio-box":typeof Object.values(K.options)[0]=="object"})},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(se,fe)=>(r(),h(H,{key:fe},[typeof se=="object"?(r(),E(q,{key:0,value:fe},{default:d(()=>[o("div",xx,[o("img",{src:se.icon,alt:""},null,8,Sx)]),o("div",null,[o("span",Fx,m(se.label),1),o("span",$x,m(se.text),1)])]),_:2},1032,["value"])):(r(),E(q,{key:1,value:fe},{default:d(()=>[R(m(se),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),K.description?(r(),h("p",Ex,m(K.description),1)):B("",!0)])):B("",!0),K.type==="webhook_info"&&((ie=e.settings)==null?void 0:ie.payment_mode)===K.mode?(r(),h("div",Ux,[e.routeName==="paypal"&&!y.value?(r(),h("div",Ix,[n(Z4,{testConnect:i.value,liveConnect:s.value,webhook_info:K.info,onReload_settings:x[2]||(x[2]=se=>b()),mode:K==null?void 0:K.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):K.info?(r(),h("div",{key:1,innerHTML:K.info},null,8,Qx)):B("",!0)])):B("",!0),K.type==="input"||K.type==="password"?(r(),h("div",Dx,[o("p",Vx,m(K.label),1),n(G,{type:K.type,placeholder:K.placeholder,modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,maxlength:K.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),K.description?(r(),h("p",Tx,m(K.description),1)):B("",!0)])):B("",!0),K.type==="email"?(r(),h("div",Mx,[o("p",Lx,m(K.label),1),n(G,{type:"email",placeholder:K.placeholder,modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se},null,8,["placeholder","modelValue","onUpdate:modelValue"]),K.description?(r(),h("p",Rx,m(K.description),1)):B("",!0)])):B("",!0),K.type==="number"?(r(),h("div",Ox,[o("p",Hx,m(K.label),1),n(te,{placeholder:K.placeholder,modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,max:K.max,min:K.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),K.description?(r(),h("p",Px,m(K.description),1)):B("",!0)])):B("",!0),K.type==="text"?(r(),h("div",Nx,[o("p",Kx,[R(m(K.label)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,Gx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),n(G,{type:"text",placeholder:K.placeholder,modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,disabled:K.disabled,maxlength:K.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),K.description?(r(),h("p",jx,m(K.description),1)):B("",!0)])):B("",!0),K.type==="color"?(r(),h("div",zx,[o("p",qx,[R(m(K.label)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,Yx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),n(yd,{modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,field:K},null,8,["modelValue","onUpdate:modelValue","field"]),K.description?(r(),h("p",Wx,m(K.description),1)):B("",!0)])):B("",!0),K.type==="file"?(r(),h("div",Jx,[o("p",Xx,[R(m(K.label)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,Zx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),n(wi,{modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se,icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),K.description?(r(),h("p",e3,m(K.description),1)):B("",!0)])):B("",!0),K.type==="checkbox_group"?(r(),h("div",t3,[o("p",a3,[R(m(K.title)+" ",1),K.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",null,m(K.tooltip),1)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),n(ne,{modelValue:e.settings[Y],"onUpdate:modelValue":se=>e.settings[Y]=se},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(se,fe)=>(r(),E(O,{label:fe,key:fe},{default:d(()=>[R(m(se),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.description?(r(),h("p",l3,m(K.description),1)):B("",!0)])):B("",!0),K.type==="html_attr"?(r(),h("div",s3,[typeof K.value=="string"?(r(),h("div",{key:0,innerHTML:K.value},null,8,n3)):typeof K.value=="object"&&K.value!==null?(r(),h("div",o3,[K.value.title?(r(),h("p",i3,m(K.value.title),1)):B("",!0),K.value.webhook_url?(r(),h("code",r3,m(K.value.webhook_url),1)):B("",!0),K.value.description?(r(),h("p",d3,m(K.value.description),1)):B("",!0),K.value.steps?(r(),h(H,{key:3},[K.value.steps.title?(r(),h("p",u3,m(K.value.steps.title),1)):B("",!0),o("ul",c3,[(r(!0),h(H,null,ae(V(K.value.steps.list),(se,fe)=>(r(),h("li",{key:fe},[o("span",A3,m(fe+1),1),o("span",{innerHTML:se},null,8,p3)]))),128))])],64)):B("",!0),K.value.events?(r(),h("div",f3,[o("p",m3,m(K.value.events.title),1),o("ul",h3,[(r(!0),h(H,null,ae(V(K.value.events.list),(se,fe)=>(r(),h("li",{key:fe},[o("code",_3,m(se),1)]))),128))])])):B("",!0),K.value.webhook_notice?(r(),h("div",v3,[o("h4",g3,m(K.value.webhook_notice.title),1),o("div",y3,m(K.value.webhook_notice.description),1),K.value.webhook_notice.list&&K.value.webhook_notice.list.length?(r(),h("ul",b3,[(r(!0),h(H,null,ae(K.value.webhook_notice.list,(se,fe)=>(r(),h("li",{key:fe},m(se),1))),128))])):B("",!0)])):B("",!0)])):B("",!0)])):B("",!0),K.type==="active_methods"?(r(),h("div",w3,[(he=K.value)!=null&&he.activated_methods?(r(),h("div",C3,[e.settings.payment_mode==="live"&&Y==="live_active_methods"?(r(),h("div",k3,[o("p",B3,m(K.label),1),R(" "+m(F.active_methods)+" ",1),o("ul",x3,[(r(!0),h(H,null,ae(K.value.activated_methods,(se,fe)=>(r(),E(re,{key:fe},{default:d(()=>[R(m(se!=null&&se.name?se.name:se),1)]),_:2},1024))),128))]),o("p",null,[R(m(A(u)("You can configure methods "))+" ",1),o("a",{href:(me=K.value)==null?void 0:me.configure_url,target:"_blank"},m(A(u)("here")),9,S3)])])):B("",!0),e.settings.payment_mode==="test"&&Y==="test_active_methods"?(r(),h("div",F3,[o("p",$3,m(K.label),1),o("ul",E3,[R(m(F.active_methods)+" ",1),(r(!0),h(H,null,ae(K.value.activated_methods,(se,fe)=>(r(),E(re,{key:fe},{default:d(()=>[R(m(se!=null&&se.name?se.name:se),1)]),_:2},1024))),128))]),o("p",null,[R(m(A(u)("You can configure methods "))+" ",1),o("a",{href:(ye=K.value)==null?void 0:ye.configure_url,target:"_blank"},m(A(u)("here")),9,U3)])])):B("",!0)])):B("",!0)])):B("",!0),K.type==="tabs"?(r(),h("div",I3,[n(P4,{fields:e.fields,settings:e.settings,index:Y,tabs:e.fields[Y]},null,8,["fields","settings","index","tabs"])])):B("",!0),K.type==="radio-select-dependants"?(r(),h("div",Q3,[n(j4,{fields:e.fields,settings:e.settings,index:Y},null,8,["fields","settings","index"])])):B("",!0)])}),128))],2)}}},D3={class:"setting-wrap"},V3={class:"setting-wrap-inner"},T3={class:"mb-5 flex items-center justify-between"},M3={class:"setting-switcher flex items-center gap-3"},L3={class:"setting-save-action"},R3={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,tn("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return ms.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,s,i,c,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=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(c=this.settings)!=null&&c.checkout_logo?{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}:""}).catch(e=>{var t;this.fetching=!1,cr(((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,tn("Settings updated!")}).catch(e=>{var t;this.saving=!1,cr(((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,s,i,c,p,f;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=(s=(l=this.$route)==null?void 0:l.meta)==null?void 0:s.admin_title:this.methodTitle=(c=(i=this.$route)==null?void 0:i.meta)==null?void 0:c.title,this.methodLabel=(f=(p=this.$route)==null?void 0:p.meta)==null?void 0:f.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}}},O3=Object.assign(R3,{setup(e){const t=Yt().ctx;return vs().onSave(()=>{t.saveSettings()}),(l,s)=>{const i=C("el-breadcrumb-item"),c=C("el-breadcrumb"),p=C("el-switch"),f=C("Edit"),_=C("el-icon"),g=C("el-skeleton"),y=C("el-button");return r(),h("div",D3,[o("div",V3,[o("div",T3,[n(c,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(i,{to:{path:"/settings/payments"}},{default:d(()=>[R(m(l.$t("Payment Settings")),1)]),_:1}),n(i,null,{default:d(()=>[o("span",null,m(l.methodTitle),1)]),_:1})]),_:1},8,["separator-icon"]),o("div",M3,[n(p,{modelValue:l.settings.is_active,"onUpdate:modelValue":s[0]||(s[0]=v=>l.settings.is_active=v),"active-value":"yes","inactive-value":"no","inactive-text":l.$t("Payment Activation")},null,8,["modelValue","inactive-text"])])]),n(Be,null,{default:d(()=>[n(Qe,{title:l.methodTitle,border_bottom:""},{action:d(()=>[n(_,{class:"text-gray-500 cursor-pointer",onClick:l.editDesign},{default:d(()=>[n(f)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(Ce,{class:"pt-0"},{default:d(()=>[n(g,{loading:l.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),l.fetching?B("",!0):(r(),E(kd,{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",L3,[n(y,{onClick:s[1]||(s[1]=v=>l.saveSettings()),type:"primary",loading:l.saving},{default:d(()=>[R(m(l.$t("Save Settings")),1)]),_:1},8,["loading"])])])])}}}),H3={class:"setting-wrap"},P3={class:"setting-wrap-inner"},N3={class:"setting-save-action"},K3={name:"PaymentDesign",components:{SettingsHeader:Qa},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,tn("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,cr("Something went wrong!")})},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,s,i,c,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=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(c=this.settings)!=null&&c.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,s,i,c,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=(s=this.$route)==null?void 0:s.meta)==null?void 0:i.admin_title:this.methodTitle=((p=(c=this.$route)==null?void 0:c.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)}}},G3=Object.assign(K3,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb"),i=C("el-icon"),c=C("el-button"),p=C("el-skeleton"),f=C("el-input"),_=C("el-form-item"),g=C("el-form");return r(),h("div",H3,[n(Qa,{onOnSave:t.savePaymentDesign,loading:t.saving,"save-button-text":t.$t("Update"),"loading-text":t.$t("Updating")},{heading:d(()=>[n(s,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(l,{to:{path:"/settings/payments"}},{default:d(()=>[R(m(t.$t("Payment Settings")),1)]),_:1}),n(l,null,{default:d(()=>[o("span",{class:"cursor-pointer",onClick:a[0]||(a[0]=(...y)=>t.goBack&&t.goBack(...y))},m(t.$route.params.method),1)]),_:1}),n(l,null,{default:d(()=>[o("span",null,m(t.$t("Checkout Customization")),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["onOnSave","loading","save-button-text","loading-text"]),o("div",P3,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Customization"),border_bottom:""},{action:d(()=>[n(c,{onClick:t.goBack,type:"text",class:"cursor-pointer border-none p-0"},{default:d(()=>[n(i,{class:"text-gray-500 cursor-pointer",onClick:t.goBack},{default:d(()=>[n(A(Gf))]),_:1},8,["onClick"]),R(" "+m(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>[n(p,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?B("",!0):(r(),E(g,{key:0,"label-position":"left"},{default:d(()=>[n(_,{label:t.$t("Checkout Label")},{default:d(()=>[n(f,{type:"text",modelValue:t.checkout_label,"onUpdate:modelValue":a[1]||(a[1]=y=>t.checkout_label=y)},null,8,["modelValue"])]),_:1},8,["label"]),n(_,{label:t.$t("Checkout Logo")},{default:d(()=>[n(wi,{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"]),n(_,{"label-position":"top"},{default:d(()=>[n(fa,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),n(es,{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)),n(_,{"label-position":"top"},{default:d(()=>[n(fa,{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"]),n(es,{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",N3,[n(c,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:d(()=>[R(m(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),j3={class:"fct-integration-setting-content"},z3={class:"fct-integration-setting-head"},q3={class:"flex items-center gap-3 mb-2"},Y3=["src"],W3={class:"title"},J3=["innerHTML"],X3={key:0,class:"integration_success_state"},Z3=["innerHTML"],eS={key:1,class:"fct-integration-setting-body"},tS={class:"fct-integration-setting-body-inner"},aS=["innerHTML"],lS=["innerHTML"],sS=["target","href"],nS={key:0},oS={key:0,class:"fct-integration-setting-body-footer"},iS={key:2},rS={name:"GeneralIntegration",components:{InfoFilled:al,Setting:Rc},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)})}}},dS=Object.assign(rS,{setup(e){const t=Yt().ctx;return vs().onSave(()=>{t.integration.status||t.save()}),(l,s)=>{const i=C("el-button"),c=C("el-icon"),p=C("el-tooltip"),f=C("el-option"),_=C("el-select"),g=C("el-input"),y=C("el-form-item"),v=C("el-form"),b=Ma("loading");return r(),h("div",j3,[o("div",z3,[o("div",q3,[l.settings.logo?(r(),h("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,Y3)):B("",!0),o("h3",W3,m(l.settings.menu_title),1)]),o("p",{class:"desc",innerHTML:l.settings.menu_description},null,8,J3)]),l.settings.hide_on_valid&&l.integration.status?(r(),h("div",X3,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,Z3),o("div",null,[n(i,{onClick:s[0]||(s[0]=k=>l.disconnect(l.settings.discard_settings.data)),type:"danger",plain:""},{default:d(()=>[R(m(l.settings.discard_settings.disconnect_button_text),1)]),_:1}),l.settings.discard_settings.show_verify?(r(),E(i,{key:0,onClick:s[1]||(s[1]=k=>l.save()),type:"primary"},{default:d(()=>[R(m(l.settings.discard_settings.verify_button_text),1)]),_:1})):B("",!0)])])):qt((r(),h("div",eS,[o("div",tS,[l.settings.config_instruction&&!l.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,aS)):B("",!0),n(v,{"label-width":"205px","label-position":"top"},{default:d(()=>[(r(!0),h(H,null,ae(l.settings.fields,(k,w)=>(r(),E(y,{key:w},{label:d(()=>[R(m(k.label)+" ",1),k.label_tips?(r(),E(p,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:d(()=>[o("div",{innerHTML:k.label_tips},null,8,lS)]),default:d(()=>[n(c,null,{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):B("",!0)]),default:d(()=>[k.type=="authenticate-button"?(r(),E(i,{key:0,onClick:S=>l.authenticate(k.end_point,k.params)},{default:d(()=>[R(m(k.button_text),1)]),_:2},1032,["onClick"])):k.type=="select"?(r(),E(_,{key:1,modelValue:l.integration[w],"onUpdate:modelValue":S=>l.integration[w]=S},{default:d(()=>[(r(!0),h(H,null,ae(k.options,(S,$)=>(r(),E(f,{key:$,label:S,value:$},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):k.type=="link"?(r(),h(H,{key:2},[o("a",{target:k.target,class:de(k.btn_class),href:k.link},m(k.link_text),11,sS),o("p",null,m(k.tips),1)],64)):(r(),h(H,{key:3},[n(g,{placeholder:k.placeholder,type:k.type,modelValue:l.integration[w],"onUpdate:modelValue":S=>l.integration[w]=S},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),k.tips?(r(),h("p",nS,m(k.tips),1)):B("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?B("",!0):(r(),h("div",oS,[n(i,{type:"primary",onClick:l.save},{default:d(()=>[R(m(l.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[b,l.loading]]),l.error_message?(r(),h("p",iS,m(l.error_message),1)):B("",!0)])}}}),uS={class:"fct-integration-setting-container fct-layout-width"},cS={class:"single-page-header"},AS={class:"single-page-body"},pS={class:"fct-integration-setting-wrap"},fS={name:"IntegrationEditor"},mS=Object.assign(fS,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb");return r(),h("div",uS,[o("div",cS,[n(s,{"separator-icon":A(dl)},{default:d(()=>[n(l,{to:{name:"integrations"}},{default:d(()=>[R(m(t.$t("Integrations")),1)]),_:1}),n(l,null,{default:d(()=>[R(m(A(ca).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),o("div",AS,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",pS,[n(dS,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),hS={class:"fct-form-group"},_S={for:"store-country"},vS={class:"fct-form-group"},gS={class:"fct-form-group"},yS={class:"fct-form-group"},bS={__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,s=a,i=M({store_name:"",store_logo:"",store_country:"",currency:""});be(()=>l.savedFormData??l.initialSettings,f=>{f&&(i.value.store_name=f.store_name??"",i.value.store_logo=f.store_logo??"",i.value.store_country=f.store_country??"",i.value.currency=f.currency??"")},{immediate:!0});const c=f=>{s("storeCountryChanged",f),f&&ue.post("settings/store",{store_country:f,store_name:i.value.store_name,settings_name:"store_setup"}).catch(()=>{})};return t({onNextStep:async()=>{const f=Array.isArray(i.value.store_logo)&&i.value.store_logo.length>0?i.value.store_logo[0]:i.value.store_logo;try{await ue.post("onboarding/",{store_name:i.value.store_name,store_logo:f,store_country:i.value.store_country,currency:i.value.currency})}catch{z.warning(u("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...i.value})}),(f,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-input");return r(),h(H,null,[o("div",hS,[o("label",_S,m(A(u)("Store Country")),1),n(y,{modelValue:i.value.store_country,"onUpdate:modelValue":_[0]||(_[0]=b=>i.value.store_country=b),placeholder:A(u)("Store Country"),onChange:c,filterable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,(b,k)=>(r(),E(g,{key:k,label:b.name,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",vS,[o("label",null,m(A(u)("Shop Name")),1),n(v,{modelValue:i.value.store_name,"onUpdate:modelValue":_[1]||(_[1]=b=>i.value.store_name=b)},null,8,["modelValue"])]),o("div",gS,[o("label",null,m(A(u)("Store Currency")),1),n(y,{modelValue:i.value.currency,"onUpdate:modelValue":_[2]||(_[2]=b=>i.value.currency=b),filterable:"",placeholder:A(u)("Select")},{default:d(()=>[(r(!0),h(H,null,ae(e.currencies,(b,k)=>(r(),E(g,{key:k,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",yS,[o("label",null,m(A(u)("Shop Image/Logo")),1),n(wi,{modelValue:i.value.store_logo,"onUpdate:modelValue":_[3]||(_[3]=b=>i.value.store_logo=b),showSupported:"",icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","title"])])],64)}}},Bd=["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"],wS=[...Bd,"GB","AU","NZ","CA","IN"],CS=[...Bd,"GB","AU","NZ"],kS={class:"fct-tax-step"},BS={class:"fct-tax-step-toggle-row"},xS={class:"fct-tax-step-toggle-row__label"},SS={class:"fct-alert-content"},FS={class:"fct-alert-text"},$S={class:"fct-form-group"},ES={key:0,class:"fct-tax-step-country-chip"},US={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},IS={class:"fct-form-group"},QS={class:"fct-tax-step-radio-group",role:"radiogroup"},DS=["aria-checked"],VS={class:"fct-tax-step-radio-card__label"},TS={class:"fct-tax-step-radio-card__desc"},MS=["aria-checked"],LS={class:"fct-tax-step-radio-card__label"},RS={class:"fct-tax-step-radio-card__desc"},OS={key:0,class:"fct-form-group"},HS={class:"fct-tax-step-radio-group",role:"radiogroup"},PS=["aria-checked"],NS={class:"fct-tax-step-radio-card__label"},KS={class:"fct-tax-step-radio-card__desc"},GS=["aria-checked"],jS={class:"fct-tax-step-radio-card__label"},zS={class:"fct-tax-step-radio-card__desc"},qS=["aria-checked"],YS={class:"fct-tax-step-radio-card__label"},WS={class:"fct-tax-step-radio-card__desc"},JS={class:"fct-form-group"},XS={class:"fct-tax-step-optional"},ZS={class:"fct-form-help-text"},eF={class:"fct-alert-content"},tF={class:"fct-alert-text"},aF={__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:""}),s=N(()=>Bd.includes(a.storeCountry)),i=y=>{l.value={...l.value,...y}},c=N(()=>{if(!s.value)return u("Tax ID / VAT Number");if(l.value.euMethod==="oss")return u("OSS VAT Number");if(l.value.euMethod==="specific"){const y=a.countryName||a.storeCountry;return u("%1$s VAT Number",y)}return u("Home VAT Number")}),p=N(()=>s.value?u("Standard EU VAT rates will be imported automatically for all EU countries."):a.countryName?u("A standard tax class will be created for %1$s. Add your rates in Tax → Tax Rates after setup.",a.countryName):u("A standard tax class will be created. Add your rates in Tax → Tax Rates after setup.")),f=y=>{l.value={collectTaxes:wS.includes(y),taxInclusion:CS.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};be(()=>a.storeCountry,f),Ie(()=>{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||""}:f(a.storeCountry)});const _=async()=>{try{await ue.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{z.warning(u("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 b=C("el-switch"),k=C("el-input");return r(),h("div",kS,[o("div",BS,[o("span",xS,m(A(u)("Collect taxes for my store")),1),n(b,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=w=>i({collectTaxes:w}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),h(H,{key:1},[o("div",$S,[o("label",null,m(A(u)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),h("span",ES,[n(J,{name:"Globe"}),R(" "+m(e.countryName||e.storeCountry),1)])):(r(),h("span",US,m(A(u)("Not set")),1))])]),e.storeCountry?(r(),h(H,{key:0},[o("div",IS,[o("label",null,m(A(u)("How do you display your prices?")),1),o("div",QS,[o("div",{class:de(["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:de(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="included"}])},null,2),o("div",null,[o("div",VS,m(A(u)("Prices include tax")),1),o("div",TS,m(A(u)("Tax is already factored into your listed price.")),1)])],42,DS),o("div",{class:de(["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:de(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="excluded"}])},null,2),o("div",null,[o("div",LS,m(A(u)("Add tax at checkout")),1),o("div",RS,m(A(u)("Tax is shown separately and added to the subtotal.")),1)])],42,MS)])]),s.value?(r(),h("div",OS,[o("label",null,m(A(u)("Cross-border compliance")),1),o("div",HS,[o("div",{class:de(["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:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="oss"}])},null,2),o("div",null,[o("div",NS,m(A(u)("OSS (One Stop Shop)")),1),o("div",KS,m(A(u)("Charge each EU customer their country's VAT rate.")),1)])],42,PS),o("div",{class:de(["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:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="home"}])},null,2),o("div",null,[o("div",jS,m(A(u)("Home Country Only")),1),o("div",zS,m(A(u)("Charge all EU customers your home country's rate.")),1)])],42,GS),o("div",{class:de(["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:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="specific"}])},null,2),o("div",null,[o("div",YS,m(A(u)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",WS,m(A(u)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,qS)])])):B("",!0),o("div",JS,[o("label",null,[R(m(c.value)+" ",1),o("span",XS,m(A(u)("(optional)")),1)]),n(k,{"model-value":l.value.vatNumber,"onUpdate:modelValue":v[11]||(v[11]=w=>i({vatNumber:w})),placeholder:s.value?"DE123456789":""},null,8,["model-value","placeholder"]),o("p",ZS,m(A(u)("Your registration number, printed on invoices")),1)]),n(Xa,{icon:"Info"},{content:d(()=>[o("div",eF,[o("p",tF,m(p.value),1)])]),_:1})],64)):B("",!0)],64)):(r(),E(Xa,{key:0},{content:d(()=>[o("div",SS,[o("p",FS,m(A(u)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},lF={class:"dialog-footer"},sF={__name:"CreatePageButton",props:{title:{default:u("Create Page")},content:{required:!0,type:String}},emits:["onPageCreated"],setup(e,{emit:t}){const a=e,l=t,s=M(!1),i=M(a.title),c=()=>{ue.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="",s.value=!1,z.success(u("The page created successfully."))}).catch(p=>{if(p&&p.hasOwnProperty("page_name")){const f=Object.entries(p.page_name).length;let _="",g=0;for(const y in p.page_name)_+=p.page_name[y],g!==f&&(_+=`
151 `),g++;z.error(_)}else z.error(u("Sorry, Unable To Create Page!!"))})};return(p,f)=>{const _=C("el-input"),g=C("el-form-item"),y=C("el-form"),v=C("el-button"),b=C("el-dialog");return r(),h(H,null,[n(Ze,{onClick:f[0]||(f[0]=Ne(k=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:d(()=>[n(J,{name:"Plus"})]),_:1}),n(b,{modelValue:s.value,"onUpdate:modelValue":f[3]||(f[3]=k=>s.value=k),title:A(u)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:d(()=>[o("div",lF,[n(v,{onClick:f[2]||(f[2]=k=>s.value=!1),type:"info",soft:""},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(v,{type:"primary",onClick:c},{default:d(()=>[R(m(A(u)("Create Page")),1)]),_:1})])]),default:d(()=>[n(y,{"require-asterisk-position":"right","label-position":"top",onSubmit:Ne(c,["prevent"])},{default:d(()=>[n(g,{label:A(u)("Page Name"),required:""},{default:d(()=>[n(_,{modelValue:i.value,"onUpdate:modelValue":f[1]||(f[1]=k=>i.value=k),placeholder:A(u)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},nF={class:"fct-form-group"},oF={class:"fct-form-group-inner"},iF={class:"input-prepend"},rF={class:"input-append"},dF={__name:"PageSelector",props:_l({title:{type:String,required:!0},pages:{type:Array,required:!0},modelId:{type:String,required:!0}},{modelValue:{},modelModifiers:{}}),emits:_l(["onPageCreated"],["update:modelValue"]),setup(e,{emit:t}){const a=El(e,"modelValue",{get:c=>c?typeof c=="string"?Number(c):c:""}),l=t,s=M(!1),i=c=>{s.value=c};return(c,p)=>{const f=C("el-option"),_=C("el-select");return r(),h("div",nF,[o("label",null,m(e.title),1),o("div",oF,[o("div",{class:de(["fct-input-group w-full",{focused:s.value}])},[o("div",iF,[n(_,{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:A(u)("Select"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.pages,(g,y)=>(r(),E(f,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",rF,[n(sF,{title:e.title,onOnPageCreated:p[3]||(p[3]=g=>l("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},uF={__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"],s={checkout_page_id:()=>u("Checkout"),cart_page_id:()=>u("Cart"),receipt_page_id:()=>u("Receipt"),shop_page_id:()=>u("Shop"),customer_profile_page_id:()=>u("Customer Profile")},i=M(Object.fromEntries(l.map(v=>[v,""])));be(()=>a.initialSettings,v=>{if(a.savedFormData){l.forEach(b=>{i.value[b]=a.savedFormData[b]??""});return}v&&l.forEach(b=>{i.value[b]=v[b]??""})},{immediate:!0});const c=M(!1),p=M(!1),f=()=>{p.value=!0,ue.post("onboarding/create-pages",{}).then(v=>{l.forEach(b=>{var k;i.value[b]=String(((k=v.default_settings)==null?void 0:k[b])??"")}),c.value=!0,a.onPagesUpdated(v.pages)}).finally(()=>{p.value=!1})},_=(v,b)=>{i.value[b]=v.value,a.onPagesUpdated([...a.pages,v])};return t({onNextStep:async()=>{try{await ue.post("onboarding/",{...i.value})}catch{}return!0},getFormData:()=>({...i.value}),createAllPage:f,pageGenerated:c,generating:p}),(v,b)=>(r(),h(H,null,ae(l,k=>o("div",{key:k,class:"fct-form-group"},[n(dF,{title:s[k](),pages:e.pages,modelId:k,modelValue:i.value[k],"onUpdate:modelValue":w=>i.value[k]=w,onOnPageCreated:_},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))}},cF={key:0,class:"fct-dummy-product-content"},AF={key:0,class:"title"},pF={class:"fct-dummy-product-hint"},fF={class:"fct-btn-group mt-4"},mF={key:1,class:"fct-dummy-product-content"},hF={key:0,class:"title"},_F={class:"text"},vF={class:"fct-dummy-product-loading"},gF={class:"fct-loading-bars"},yF=["id"],bF={class:"fct-dummy-product-hint"},wF=["href"],CF={key:2,class:"fct-form-group"},kF={class:"label"},BF={class:"marker"},xF={class:"label"},SF={class:"marker"},FF={__name:"OnboardingProductsStep",props:{dummyProductInfo:{type:Object,default:()=>({})}},setup(e,{expose:t}){const a=e,l=M("start-from-scratch"),s=M(!1),i=M(!1),c=M(null),p=M(0),f=M(0),_=M([]),g=M(!1),y=N(()=>g.value||_.value.length>0),v=()=>{f.value=0,p.value=0,s.value=!1,i.value=!1,c.value=null,_.value=[],g.value=!1},b=async F=>{let x=0;for(let Q=0;Q<F.count;Q++){p.value=Q;try{await ue.post("products/create-dummy",{category:F.category,index:Q}),x++,f.value=parseFloat((x/F.count*100).toFixed(0))}catch(D){if(D.status_code===400){g.value=!0;for(let T=Q;T<F.count;T++)_.value.push(T);return}_.value.push(Q)}}},k=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,s.value=!0,i.value=!0,c.value=F;try{await b(F)}finally{i.value=!1}},w=()=>{y.value||(f.value=100,setTimeout(S,1e3))},S=()=>{let F=Ge.get("dashboard_url");l.value&&l.value!=="start-from-scratch"&&(F=ln.appendToVueUrl(F,{import_product:l.value})),window.location.href=F},$=async()=>{const F=!l.value||l.value==="start-from-scratch";try{await ue.post("onboarding/")}catch{}return F?(setTimeout(S,300),!1):(await k(),w(),!1)},V=Ge.get("dashboard_url");return t({onNextStep:$,inserting:s}),(F,x)=>{const Q=C("el-button"),D=C("el-progress"),T=C("el-icon"),U=C("el-radio-button"),I=C("el-radio-group");return s.value&&y.value&&!i.value?(r(),h("div",cF,[c.value!=null?(r(),h("div",AF,m(A(u)("%1$s of %2$s products could not be created",_.value.length,c.value.count)),1)):B("",!0),o("p",pF,m(g.value?A(u)("The import stopped early. Products created before it stopped were kept, and you can add the rest from the Products page."):A(u)("The products that were created have been kept. You can add the rest from the Products page.")),1),o("div",fF,[n(Q,{type:"primary",onClick:S},{default:d(()=>[R(m(A(u)("Continue to Dashboard")),1)]),_:1})])])):s.value?(r(),h("div",mF,[c.value!=null?(r(),h("div",hF,m(A(u)("Inserting %1$s of %2$s %3$s Product",p.value+1,c.value.count,c.value.title)),1)):B("",!0),o("div",_F,[R(m(A(u)("Please wait, your products are being added."))+" ",1),o("div",vF,[o("div",gF,[(r(),h(H,null,ae(8,O=>o("div",{key:O,class:"bar-block",id:`bar-block-${O+1}`},null,8,yF)),64))]),R(" "+m(A(u)("Uploading... %1$s",`${f.value}%`)),1)])]),n(D,{percentage:f.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"]),o("p",bF,[R(m(A(u)("Please keep this window open, we'll take you to your"))+" ",1),o("a",{href:A(V),target:"_blank",rel:"noopener"},m(A(u)("Dashboard")),9,wF),R(" "+m(A(u)("as soon as your products are ready.")),1)])])):(r(),h("div",CF,[n(I,{class:"fct-import-onboarding-products",modelValue:l.value,"onUpdate:modelValue":x[0]||(x[0]=O=>l.value=O),size:"large"},{default:d(()=>[n(U,{value:"start-from-scratch"},{default:d(()=>[n(J,{name:"Scratch"}),o("span",kF,[R(m(A(u)("Start"))+" ",1),x[1]||(x[1]=o("br",null,null,-1)),R(" "+m(A(u)("From scratch")),1)]),o("span",BF,[n(T,null,{default:d(()=>[n(A(Eo))]),_:1})])]),_:1}),(r(!0),h(H,null,ae(e.dummyProductInfo,(O,L)=>(r(),E(U,{key:L,value:L},{default:d(()=>[n(J,{name:O.icon},null,8,["name"]),o("span",xF,m(O.title),1),o("span",SF,[n(T,null,{default:d(()=>[n(A(Eo))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]))}}},$F={class:"fct-onboarding-wrap"},EF={key:0,class:"fct-onboarding-card"},UF={class:"fct-onboarding-card-body"},IF={class:"fct-onboarding-content-box"},QF={class:"fct-onboarding-card-head"},DF={class:"fct-onboarding-card-head-top"},VF=["src","alt"],TF={class:"fct-onboarding-steps-count"},MF={class:"fct-onboarding-card-head-content"},LF={class:"flex-1"},RF={class:"fct-onboarding-card-title"},OF={class:"fct-onboarding-card-text"},HF={key:0,class:"fct-onboarding-card-head-action"},PF={class:"fct-onboarding-content-box-inner"},NF={key:0,class:"fct-onboarding-load-error"},KF={key:1,class:"fct-onboarding-form-wrap active"},GF={class:"fct-onboarding-form-body"},jF={key:0,class:"fct-onboarding-bottom"},zF={class:"fct-onboarding-bottom-left"},qF={class:"fct-onboarding-bottom-right"},YF={key:0,class:"cmd"},WF={__name:"Onboarding",setup(e){const t=M(!1),a=M([]),l=M({}),s=M([]),i=M([]),c=M(null),p=M(null),f=M(null),_=M(null),g=M(null),y=M(""),v=N(()=>{if(!y.value)return"";const Y=s.value.find(W=>W.value===y.value);return Y?Y.name:y.value}),b=[{key:"store-info",title:()=>u("Welcome aboard! Let's create your online store."),text:()=>u("You've successfully installed the plugin, let's configure the store."),component:bS,props:()=>({savedFormData:f.value,initialSettings:c.value,countries:s.value,currencies:l.value,onStoreCountryChanged:Y=>{y.value=Y}})},{key:"tax",title:()=>u("Set Up Tax Collection"),text:()=>u("Configure tax rates so checkout calculates correctly."),component:aF,canSkip:!0,props:()=>({savedFormData:_.value,storeCountry:y.value,countryName:v.value,initialTaxSettings:p.value})},{key:"pages",title:()=>u("Setup Your Pages"),text:()=>u("Create the essential pages your store needs: cart, checkout, and more."),component:uF,props:()=>({pages:a.value,initialSettings:c.value,savedFormData:g.value,onPagesUpdated:Y=>{a.value=Y}})},{key:"products",title:()=>u("Setup Your Products"),text:()=>u("Add your first products and start building your business catalog."),component:FF,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],k=b.length+1,w=M(1),S=N(()=>b[w.value-1]),$=N(()=>{var Y;return((Y=S.value)==null?void 0:Y.title())??""}),V=N(()=>{var Y;return((Y=S.value)==null?void 0:Y.text())??""}),F=M(null),x=M(!1),Q=()=>{w.value++},D=N(()=>{var Y;return!!((Y=F.value)!=null&&Y.inserting)}),T=()=>{var W,j;const Y=(j=(W=F.value)==null?void 0:W.getFormData)==null?void 0:j.call(W);Y&&(S.value.key==="store-info"?f.value=Y:S.value.key==="tax"?_.value=Y:S.value.key==="pages"&&(g.value=Y))},U=async()=>{var Y,W;if(!x.value){x.value=!0;try{T(),await((W=(Y=F.value)==null?void 0:Y.onNextStep)==null?void 0:W.call(Y))!==!1&&Q()}finally{x.value=!1}}},I=()=>{var Y,W;T(),(W=(Y=F.value)==null?void 0:Y.onPreviousStep)==null||W.call(Y),w.value>1&&w.value--},O=()=>{Q()},L=()=>{var Y,W;(W=(Y=F.value)==null?void 0:Y.onSkipAll)==null||W.call(Y),window.location.href=Ge.get("dashboard_url")};vs().onSave(()=>{var Y;(Y=S.value)!=null&&Y.isFinal&&U()});const q=M(!1),X=()=>{t.value=!0,q.value=!1,ue.get("onboarding/").then(Y=>{var W;a.value=Y.pages,l.value=Y.currencies,c.value=Y.default_settings,y.value=((W=Y.default_settings)==null?void 0:W.store_country)??"",p.value=Y.tax_settings??null}).catch(()=>{q.value=!0}).finally(()=>{t.value=!1})},G=()=>{ue.get("address-info/countries").then(Y=>{s.value=Y.data})},te=ms.getUrl("images/logo/logo-full-dark.svg"),ne=ms.getUrl("images/logo/logo-full.svg"),re=M(Ge.get("asset_url")+"/images/logo/logo-full-dark.svg"),K=()=>{re.value=De.isDark()?ne:te};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",K),i.value=Ge.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),re.value=De.isDark()?ne:te,X(),G()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",K),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(Y,W)=>{const j=C("el-progress"),ie=C("el-button"),he=Ma("loading");return r(),h(H,null,[o("div",$F,[w.value<k?(r(),h("div",EF,[qt((r(),h("div",UF,[o("div",IF,[o("div",QF,[o("div",DF,[o("img",{src:re.value,alt:A(u)("Fluent Cart")},null,8,VF),o("div",TF,m(A(u)("Step %1$s of %2$s",w.value,b.length)),1),n(j,{percentage:w.value/b.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("div",MF,[o("div",LF,[o("h2",RF,m($.value),1),o("p",OF,m(V.value),1)]),S.value.key==="pages"&&F.value&&!F.value.pageGenerated?(r(),h("div",HF,[n(ie,{onClick:W[0]||(W[0]=me=>F.value.createAllPage()),loading:F.value.generating,size:"small"},{default:d(()=>[F.value.generating?B("",!0):(r(),E(J,{key:0,name:"MagicPen"})),R(" "+m(A(u)("Generate All Pages")),1)]),_:1},8,["loading"])])):B("",!0)])]),o("div",PF,[q.value?(r(),h("div",NF,[o("p",null,m(A(u)("Failed to load settings. Please refresh and try again.")),1),n(ie,{onClick:X},{default:d(()=>[R(m(A(u)("Retry")),1)]),_:1})])):(r(),h("div",KF,[o("div",GF,[(r(),E(Bl(S.value.component),ya({key:S.value.key,ref_key:"stepRef",ref:F},S.value.props()),null,16))])]))])])])),[[he,t.value]])])):B("",!0)]),w.value<k&&!D.value?(r(),h("div",jF,[o("div",zF,[w.value>1?(r(),E(ie,{key:0,text:"",onClick:L},{default:d(()=>[R(m(A(u)("Skip All")),1)]),_:1})):B("",!0)]),o("div",qF,[n(ie,{onClick:I,type:"info",plain:"",disabled:w.value===1},{default:d(()=>[R(m(A(u)("Go Back")),1)]),_:1},8,["disabled"]),S.value.canSkip?(r(),E(ie,{key:0,text:"",onClick:O,disabled:x.value},{default:d(()=>[R(m(A(u)("Skip for now")),1)]),_:1},8,["disabled"])):B("",!0),S.value.isFinal?(r(),E(ie,{key:2,type:"primary",loading:x.value,onClick:U},{default:d(()=>[x.value?B("",!0):(r(),h("span",YF,"⌘s")),R(" "+m(x.value?A(u)("Saving"):A(u)("Save")),1)]),_:1},8,["loading"])):(r(),E(ie,{key:1,type:"primary",loading:x.value,disabled:q.value,onClick:U},{default:d(()=>[R(m(A(u)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):B("",!0)],64)}}},JF={class:"fct-orders-route-wrap"},XF=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const l=C("router-view");return r(),h("div",JF,[n(l)])}}}),ZF={class:"setting-wrap"},e$={class:"setting-wrap-inner"},t$={key:0,class:"payment-method-list fct-content-card-list"},a$={class:"flex items-start gap-3"},l$=["title"],s$=["onClick"],n$=["src","alt"],o$=["src","alt"],i$={key:1,class:"fct_payment_method_tag"},r$={class:"fct-content-card-list-content"},d$={class:"fct-content-card-list-action"},u$={key:0},c$=["src"],A$={__name:"PaymentSettings",setup(e){const t=Yt().ctx,a=M(!1),l=M([]),s=Ge.get("app_config.isProActive"),i=N(()=>({animation:200,ghostClass:"ghost"})),c=g=>!((g==null?void 0:g.upcoming)==!0||g!=null&&g.requires_pro&&!s||(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",f=()=>{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=>{z.success(y.message)}).catch(y=>{})};return Ie(()=>{f()}),(g,y)=>{const v=C("el-skeleton"),b=C("el-button");return r(),h("div",ZF,[n(Qa,{heading:A(u)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",e$,[n(Da),n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?B("",!0):(r(),h("div",t$,[n(A(an),ya(i.value,{list:l.value,"item-key":"route",handle:".drag-handle",onEnd:_}),{default:d(()=>[(r(!0),h(H,null,ae(l.value,k=>(r(),h("div",{key:k.route,class:de(k!=null&&k.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",a$,[o("span",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 mt-1 w-7.5 h-7.5",title:A(u)("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,l$),o("div",{onClick:()=>{var w;!((w=k==null?void 0:k.addon_status)!=null&&w.is_installed)&&(k!=null&&k.addon_source)||g.$router.push({name:k.route})},class:"cursor-pointer grid gap-2 flex-1"},[o("div",{class:de(["fct-content-card-list-head",k.route])},[o("img",{src:k.logo,alt:k.admin_title||k.title,class:de(k.logo_light?"dark:hidden":"")},null,10,n$),k.logo_light?(r(),h("img",{key:0,src:k.logo_light,alt:k.admin_title||k.title,class:"hidden dark:block"},null,8,o$)):B("",!0),k!=null&&k.tag?(r(),h("span",i$,[n(ma,{size:"small",status:"info",text:k.tag},null,8,["text"])])):B("",!0),c(k)?(r(),E(ma,{key:2,size:"small",status:k.status?"active":"disabled","hide-icon":!0},{default:d(()=>[R(m(p(k.status)),1)]),_:2},1032,["status"])):B("",!0)],2),o("div",r$,[o("p",null,m(k.description),1)])],8,s$),o("div",d$,[k!=null&&k.upcoming?(r(),h("div",u$,m(A(u)("Coming Soon!")),1)):(r(),E(b,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:k.route})},{default:d(()=>{var w;return[R(m(A(u)("Manage"))+" ",1),k!=null&&k.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,c$)):B("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},p$={class:"role-form"},f$={class:"select-use-option"},m$={class:"select-label"},h$={key:0,class:"select-desc"},_$={class:"dialog-footer"},v$={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const l=M(!1),s=a,i=M(!1),c=M(null),p=M(null),f=M(!1),_=M(null),g=M(null),y=M({}),v=M(!1),b=x=>{if(!x){_.value=[];return}ue.get("roles/user-list",{search:x}).then(Q=>{_.value=Q.users.data}).finally(()=>{})},k=()=>{ue.get("roles").then(x=>{g.value=x.roles}).catch(x=>{if(x.message){z.error(x.message);return}}).finally(()=>{})},w=()=>{y.value={},i.value=!0,ue.post("roles",{user_id:c.value,role_key:p.value}).then((x,Q)=>{l.value=!1,z.success(x.message),s("fetchRoles")}).catch(x=>{var Q;(Q=x.data)!=null&&Q.message?z.error(x.data.message):y.value=x.data}).finally(()=>{i.value=!1})},S=()=>{c.value=null,p.value=null,f.value=!1,y.value={},l.value=!1},$=M(""),V=N(()=>f.value?u("Edit %1$s's Role",$.value):u("Add Role"));return t({openModal:(x,Q,D,T=!1)=>{c.value=x,p.value=Q,$.value=D,l.value=!0,f.value=T,k()}}),(x,Q)=>{const D=C("el-option"),T=C("el-select"),U=C("el-form-item"),I=C("el-form"),O=C("el-button"),L=C("el-dialog");return r(),E(L,{title:V.value,modelValue:l.value,"onUpdate:modelValue":Q[4]||(Q[4]=P=>l.value=P),onClosed:S,"append-to-body":!0},{footer:d(()=>[o("span",_$,[n(O,{onClick:S},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(O,{type:"primary",onClick:w,loading:i.value,disabled:i.value},{default:d(()=>[R(m(f.value?A(u)("Update Role"):A(u)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[o("div",p$,[n(I,{"label-position":"top"},{default:d(()=>[f.value?B("",!0):(r(),E(U,{key:0,label:A(u)("Select User")},{default:d(()=>[n(T,{modelValue:c.value,"onUpdate:modelValue":Q[0]||(Q[0]=P=>c.value=P),remote:!0,"remote-method":b,loading:v.value,filterable:"",clearable:"",placeholder:A(u)("Type to search user"),class:"w-full",onChange:Q[1]||(Q[1]=()=>{delete y.value.user_id})},{default:d(()=>[(r(!0),h(H,null,ae(_.value,P=>(r(),E(D,{key:P.ID,label:P.name,value:P.ID},{default:d(()=>[o("div",f$,[o("span",null,m(P.name),1),o("span",null,m(P.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(r(),E(ra,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])),n(U,{label:A(u)("Select Role")},{default:d(()=>[n(T,{onChange:Q[2]||(Q[2]=P=>{delete y.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":Q[3]||(Q[3]=P=>p.value=P),placeholder:A(u)("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:d(()=>[(r(!0),h(H,null,ae(g.value,(P,q)=>(r(),E(D,{key:q,label:P.title,value:q},{default:d(()=>[o("div",m$,m(P.title),1),P.description?(r(),h("div",h$,m(P.description),1)):B("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),E(ra,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},g$=lt(v$,[["__scopeId","data-v-b3e8599d"]]),y$={class:"setting-wrap"},b$={class:"setting-wrap-inner"},w$={key:0,class:"fct-setting-header-action"},C$={class:"fct-role-settings"},k$={class:"fct-customer-card"},B$={class:"fct-customer-details"},x$={class:"fct-customer-name"},S$={class:"fct-customer-id"},F$={class:"fct-customer-email"},$$={class:"role-title flex items-center gap-1 capitalize"},E$={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},U$={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},I$={__name:"RoleSettings",setup(e){const t=M(!1),a=M([]),l=M(),s=M(!1),i=Ge.get("app_config.isProActive"),c=()=>{t.value=!0,ue.get("roles/managers").then(f=>{a.value=f.managers}).finally(()=>{t.value=!1})},p=f=>{s.value=!0,ue.delete("roles/"+f.shop_role,{user_id:f.id}).then(_=>{a.value=a.value.filter(g=>g.id!==f.id),z.success(_.message)}).catch(_=>{if(_.message)return z.error(_.message)}).finally(()=>{s.value=!1})};return Ie(()=>{i&&c()}),(f,_)=>{const g=C("el-button"),y=C("el-table-column"),v=C("el-popconfirm"),b=C("el-table"),k=Ma("loading");return r(),h("div",y$,[n(Qa,{heading:A(u)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",b$,[n(Da),n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Existing Roles & Permissions")},{action:d(()=>[A(i)?(r(),h("div",w$,[n(g,{type:"primary",size:"small",onClick:_[0]||(_[0]=()=>{var w;(w=l.value)==null||w.openModal()})},{default:d(()=>[R(m(A(u)("Add Role")),1)]),_:1})])):B("",!0)]),_:1},8,["title"]),A(i)?(r(),E(Ce,{key:0,class:"px-0 pb-0"},{default:d(()=>[o("div",C$,[qt((r(),E(b,{data:a.value},{empty:d(()=>[n(wt,{icon:"Empty/RoleAndPermission","has-dark":!0,text:A(u)("No roles found!")},null,8,["text"])]),default:d(()=>[n(y,{label:A(u)("User"),width:150},{default:d(w=>{var S,$,V;return[o("div",k$,[o("div",B$,[o("div",x$,[R(m(((S=w.row)==null?void 0:S.display_name)||A(u)("No Name"))+" ",1),o("span",S$,"#"+m(($=w.row)==null?void 0:$.id),1)]),o("div",F$,m((V=w.row)==null?void 0:V.email),1)])])]}),_:1},8,["label"]),n(y,{prop:"shop_role",label:A(u)("Role Title"),width:100},{default:d(w=>[o("span",$$,m(A(ca).headline(w.row.shop_role)),1)]),_:1},8,["label"]),n(y,{prop:"description",label:A(u)("Roles"),width:100},{default:d(w=>[o("span",E$,m(w.row.description),1)]),_:1},8,["label"]),n(y,{width:100},{default:d(w=>[o("div",U$,[n(Ze,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var S;(S=l.value)==null||S.openModal(w.row.id,w.row.shop_role,w.row.display_name,!0)}},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(v,{width:235,"confirm-button-text":A(u)("Confirm"),"cancel-button-text":A(u)("No, Thanks"),"icon-color":"red",title:A(u)("Are you sure to delete this user?"),onConfirm:S=>p(w.row)},{reference:d(()=>[n(Ze,{tag:"a",size:"x-small",hover:"danger"},{default:d(()=>[n(J,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[k,t.value||s.value]])])]),_:1})):(r(),E(Ce,{key:1,class:"px-0 pb-0"},{default:d(()=>[n(on,{class:"py-7.5",placement:"feature_lock_roles_permissions",title:A(u)("Upgrade to Pro for Roles & Permission"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]),_:1}))]),_:1}),n(g$,{ref_key:"roleModal",ref:l,onFetchRoles:c},null,512)])])}}},Q$={class:"fct-settings-nav-wrap"},D$={class:"fct-settings-nav-collapse-button-wrapper"},V$={class:"fct-menu-collapse-button-text"},T$=["src","alt"],M$=["src","alt"],L$={class:"fct-settings-nav-link-text"},R$={class:"fct-settings-nav-child-list"},O$={class:"fct-settings-nav-content"},H$={class:"fct-settings-nav-content-inner"},P$=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=sl(),a=ll(),l=M(window.innerWidth>=1024),s=M(!1),i=M(!1),c=M(null),p=M(null),f=M(null);In.has("store/settings");const _=M([{name:u("Store Settings"),icon:"Gift",permission:["store/settings","store/sensitive"],url:"/settings/store-settings/",child:[{name:u("Store Setup"),url:"/settings/store-settings/"},{name:u("Pages Setup"),url:"/settings/store-settings/pages_setup"},{name:u("Product Page"),url:"/settings/store-settings/single_product_setup"},{name:u("Cart & Checkout"),url:"/settings/store-settings/cart_and_checkout"},{name:u("Checkout Fields"),url:"/settings/store-settings/checkout_fields"},{name:u("Subscriptions"),url:"/settings/store-settings/subscriptions_setup"}]},{name:u("Payment Settings"),icon:"PaymentIcon",permission:["is_super_admin"],url:"/settings/payments"},{name:u("Invoice & Packing"),icon:"Invoice",permission:["is_super_admin"],url:"/settings/invoice-packing",child:[{name:u("Invoice & Packing"),url:"/settings/invoice-packing"},{name:u("PDF Templates"),url:"/settings/pdf-template"},{name:u("E-Invoice Settings"),url:"/settings/pdf-template/settings"}]},{name:u("Tax Settings"),icon:"Tax",permission:["is_super_admin"],url:"/settings/tax_settings",child:[{name:u("Configuration"),url:"/settings/tax_settings"},{name:u("Rates"),url:"/settings/tax_settings/tax_rates",activeFor:["/settings/tax_settings/eu","/settings/tax_settings/tax_rates_country_single"]}]},{name:u("Email Configuration"),icon:"Message",permission:["store/sensitive"],url:"/settings/email_mailing_settings",child:[{name:u("Mailing Settings"),url:"/settings/email_mailing_settings"},{name:u("Reminders"),url:"/settings/email_mailing_settings/reminders"},{name:u("Notifications"),url:"/settings/email_notifications"},{name:u("Store Digest"),url:"/settings/email_digest_settings"}]},{name:u("Roles and Permissions"),icon:"ShieldCheck",permission:["is_super_admin"],url:"/settings/roles"},{name:u("Storage Settings"),icon:"Database",permission:["is_super_admin"],url:"/settings/storage"}]);a.hasRoute("shipping")&&_.value.push({name:u("Shipping"),icon:"Truck",permission:["store/sensitive"],url:"/settings/shipping",child:[{name:u("Shipping Zones"),permission:["store/sensitive"],url:"/settings/shipping"},{name:u("Shipping Classes"),permission:["store/sensitive"],url:"/settings/shipping/shipping_classes"},{name:u("Packages"),permission:["store/sensitive"],url:"/settings/shipping/packages"}]}),_.value.push({name:u("Features & addon"),icon:"Module",permission:["is_super_admin"],url:"/settings/addons"}),Ge.get("app_config.isProActive")&&_.value.push({name:u("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"}),Ge.get("addon_settings_sidebar",[]).forEach(F=>_.value.push(F));const y=()=>{if(!l.value){c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open");return}s.value=!s.value,i.value=!1},v=()=>{l.value||(c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open"))},b=F=>F.child?(!w.value||S.value)&&$(F):!1,k=()=>{const F=window.innerWidth,x=l.value;l.value=F>=1024,!x&&l.value&&(c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open")),x&&!l.value&&(s.value=!1)};Ie(()=>{f.value=document.getElementById("fluent_cart_plugin_app"),f.value&&f.value.classList.add("fct_settings_page_plugin_app_wrap"),k(),window.addEventListener("resize",k)}),xt(()=>{f.value&&f.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",k)});const w=N(()=>s.value),S=N(()=>l.value&&s.value&&i.value),$=F=>{const x=t.path;return!!(F.child&&F.child.length&&F.child.some(D=>x===D.url||x.includes(D.url))||x===F.url||x.includes(F.url))},V=(F,x,Q)=>{const D=t.path;return!!(D===F.url||F.activeFor&&F.activeFor.some(T=>D.startsWith(T))||D===Q.url&&x===0)};return(F,x)=>{const Q=C("el-button"),D=C("el-tooltip"),T=C("router-link"),U=C("router-view");return r(),h("div",{class:de(["fct-setting-container setting-container",{"is-collapsed":w.value,"is-expanded":S.value}])},[o("div",{ref_key:"overlayRef",ref:p,class:"fct-settings-menu-overlay",onClick:v},null,512),o("div",Q$,[o("div",{ref_key:"sidebarRef",ref:c,class:de(["fct-settings-nav-container",{"is-collapsed":w.value,"is-expanded":S.value}])},[o("div",D$,[n(D,{content:A(u)("Toggle settings"),placement:"right"},{default:d(()=>[n(Q,{onClick:y,"aria-label":A(u)("Toggle settings navigation"),"aria-expanded":!w.value},{default:d(()=>[n(J,{name:"Window"}),o("span",V$,m(A(u)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:x[0]||(x[0]=I=>l.value&&s.value&&(i.value=!0)),onMouseleave:x[1]||(x[1]=I=>i.value=!1)},[(r(!0),h(H,null,ae(_.value,(I,O)=>(r(),h("li",{key:O,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":$(I)}])},[A(In).hasAny(I.permission)?(r(),E(T,{key:0,to:I.url,class:"fct-settings-nav-link"},{default:d(()=>[I.icon_img?(r(),h(H,{key:0},[o("img",{src:I.icon_img,alt:I.name,class:de(I.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,T$),I.icon_img_dark?(r(),h("img",{key:0,src:I.icon_img_dark,alt:I.name,class:"w-5 h-5 hidden dark:block"},null,8,M$)):B("",!0)],64)):(r(),E(J,{key:1,name:I.icon},null,8,["name"])),o("span",L$,[R(m(I.name)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):B("",!0),n(va,{visible:b(I),accordion:"",class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",R$,[(r(!0),h(H,null,ae(I.child,(L,P)=>(r(),h("li",{key:P,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":V(L,P,I)}])},[n(T,{to:L.url,class:"fct-settings-nav-link"},{default:d(()=>[R(m(L.name),1)]),_:2},1032,["to"])],2))),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),o("div",O$,[o("div",H$,[n(U)])])])],2)}}}),N$={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},K$={__name:"CustomerOrdersLoader",props:{columns:{type:Array,default:()=>[]}},setup(e){const t=e,a=l=>t.columns.includes(l);return(l,s)=>{const i=C("el-table-column"),c=C("el-skeleton-item"),p=C("el-skeleton"),f=C("el-table");return r(),E(f,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default:d(()=>[a("selection")?(r(),E(i,{key:0,type:"selection",width:"45"})):B("",!0),n(i,{width:140,label:A(u)("# Date")},{default:d(()=>[o("div",N$,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1}),n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})])]),_:1},8,["label"]),a("order_items")?(r(),E(i,{key:1,"min-width":200,label:A(u)("Items")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"])):B("",!0),n(i,{width:150,label:A(u)("Total")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:150,label:A(u)("Payment Status")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),a("status")?(r(),E(i,{key:2,width:120,label:A(u)("Status")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):B("",!0),a("type")?(r(),E(i,{key:3,width:140,label:A(u)("Order Type")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):B("",!0)]),_:1})}}},G$={class:"select-use-option"},j$={class:"dialog-footer"},Ep={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=M(!1),l=M([]),s=M(null),i=M({}),c=M(!1),p=()=>{i.value={},c.value=!0,ue.post(`customers/${t.customer.id}/attachable-user`,{user_id:s.value}).then((g,y)=>{a.value=!1,z.success(g.message),t.customer.user_id=s.value}).catch(g=>{if(g.message)return z.error(g.message);i.value=g}).finally(()=>{c.value=!1})},f=()=>{s.value=null,i.value={},a.value=!1},_=()=>{ue.get("customers/attachable-user").then(g=>{l.value=it.get(g,"users")})};return Ie(()=>{_()}),(g,y)=>{C("el-link");const v=C("el-option"),b=C("el-select"),k=C("el-form-item"),w=C("el-form"),S=C("el-button"),$=C("el-dialog");return r(),h(H,null,[B("",!0),n($,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=V=>a.value=V),title:A(u)("Attach User"),onClosed:f},{footer:d(()=>[o("span",j$,[n(S,{onClick:f},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(S,{type:"primary",onClick:p,loading:c.value,disabled:c.value},{default:d(()=>[R(m(A(u)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[n(w,{"label-position":"top"},{default:d(()=>[n(k,{label:g.$t("Select User")},{default:d(()=>[n(b,{id:"user_id",modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=V=>s.value=V),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,V=>(r(),E(v,{key:V.ID,label:V.display_name,value:V.ID},{default:d(()=>[o("div",G$,[o("span",null,m(V.display_name),1),o("span",null,m(V.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i.value.hasOwnProperty("user_id")?(r(),E(ra,{key:0,"validation-errors":i.value,"field-key":"user_id"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},z$={class:"more-btn"},q$={class:"fct-admin-sidebar-item"},Y$={class:"fct-profile-card"},W$={class:"fct-profile-image"},J$=["src","alt"],X$={class:"fct-profile-details"},Z$={class:"title"},eE={class:"text"},tE={key:0},aE={class:"text"},lE={key:0,class:"flex items-center gap-2 mt-1.5"},sE={class:"user-info"},nE=["href"],oE={key:1},iE={class:"fct-admin-sidebar-item mt-5"},rE={class:"sidebar-title"},dE={class:"fct-contact-info-list"},uE={class:"flex items-center justify-between gap-2"},cE=["href"],AE={class:"fct-admin-sidebar-item mt-5"},pE={class:"sidebar-title"},fE={key:0,class:"fct-address-copy-wrap"},mE={class:"text"},hE={key:0,class:"pr-1"},_E=["innerHTML"],vE={key:1,class:"mt-3"},gE={class:"pr-1"},yE=["href"],bE={key:0,class:"no-address-text"},wE={class:"fct-admin-sidebar-item mt-5"},CE={class:"sidebar-title"},kE={key:0,class:"fct-address-copy-wrap"},BE={class:"text"},xE={key:0,class:"pr-1"},SE=["innerHTML"],FE={key:1,class:"mt-3"},$E={class:"pr-1"},EE=["href"],UE={key:0,class:"no-address-text"},IE={class:"fct-customer-address-wrap"},QE={name:"CustomerInformations",components:{CustomerPurchaseValue:sm,NewCustomerModal:td,ManageAddressModal:Gc,AddOrEditAddressModal:Kc,DynamicIcon:J,CopyToClipboard:Ia,UserAttchModal:Ep,Back:ed},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})}}},Up=Object.assign(QE,{setup(e){return(t,a)=>{const l=C("el-dropdown-item"),s=C("el-dropdown-menu"),i=C("el-dropdown"),c=C("el-button"),p=C("el-popconfirm"),f=C("el-tag"),_=C("el-icon"),g=C("el-dialog"),y=Ma("loading");return r(),h("div",null,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Customer Information"),title_size:"small",border_bottom:""},{action:d(()=>[n(i,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleCustomerBulkCommand},{dropdown:d(()=>[n(s,null,{default:d(()=>[n(l,{command:"edit_customer_information"},{default:d(()=>[R(m(t.$t("Edit customer information")),1)]),_:1}),n(l,{command:"manage_shipping_address"},{default:d(()=>[R(m(t.$t("Manage shipping address")),1)]),_:1}),n(l,{command:"manage_billing_address"},{default:d(()=>[R(m(t.$t("Manage billing address")),1)]),_:1}),n(l,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:d(()=>[R(m(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:d(()=>[o("span",z$,[n(J,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>{var v,b,k,w;return[o("div",q$,[o("div",Y$,[o("div",W$,[o("img",{src:(v=e.customer)==null?void 0:v.photo,alt:t.customerDisplayName},null,8,J$)]),o("div",X$,[o("div",Z$,m(t.customerDisplayName),1),o("span",eE,[e.customer.purchase_count>0?(r(),h("span",tE,m(A(ta)(e.customer.purchase_count)),1)):B("",!0),R(" "+m(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),o("span",aE,m(A(Gt)((b=e.customer)==null?void 0:b.ltv,!0))+" "+m(A(u)("Lifetime Value")),1)])])]),o("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),h("div",lE,[o("div",sE,[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(" #"+m(A(ta)(e.customer.user_id))+" ",1),n(J,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,nE)]),B("",!0)])):(r(),h("div",oE,[n(Ep,{customer:e.customer},null,8,["customer"])]))]),o("div",iE,[o("h4",rE,m(t.$t("Contact Information")),1),o("ul",dE,[o("li",null,[o("div",uE,[o("a",{class:"text",href:"mailto:"+((k=e.customer)==null?void 0:k.email)},m((w=e.customer)==null?void 0:w.email),9,cE),n(Ia,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",AE,[o("h4",pE,[R(m(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),E(f,{key:0,type:"info",round:""},{default:d(()=>[R(m(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),h(H,null,ae(t.shippingAddress,(S,$)=>(r(),h(H,null,[S.is_primary==="1"?(r(),h("div",fE,[o("span",mE,[S.name?(r(),h("strong",hE,m(S.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(S,"shipping",!0)},null,8,_E),S.phone?(r(),h("span",vE,[o("strong",gE,m(A(u)("Phone"))+":",1),o("a",{href:"tel:"+S.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},m(S.phone),9,yE)])):B("",!0)]),n(Ia,{text:t.getOrderAddress(S),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):B("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",bE,m(t.$t("No default address found.")),1)):B("",!0)]),o("div",wE,[o("h4",CE,[R(m(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),E(f,{key:0,type:"info",round:""},{default:d(()=>[R(m(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),h(H,null,ae(t.billingAddress,(S,$)=>(r(),h(H,null,[S.is_primary==="1"?(r(),h("div",kE,[o("span",BE,[S.name?(r(),h("strong",xE,m(S.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(S,"billing",!0)},null,8,SE),S.phone?(r(),h("span",FE,[o("strong",$E,m(A(u)("Phone"))+":",1),o("a",{href:"tel:"+S.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},m(S.phone),9,EE)])):B("",!0)]),n(Ia,{text:t.getOrderAddress(S),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):B("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),h("p",UE,m(t.$t("No default address found.")),1)):B("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),E(td,{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"])):B("",!0),n(Gc,{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"]),n(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:d(()=>[o("div",IE,[n(c,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:d(()=>[n(_,null,{default:d(()=>[n(A(ed))]),_:1}),R(" "+m(t.$t("Manage address")),1)]),_:1}),n(Kc,{"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"])])}}}),DE={class:"fct-single-customer-loader-wrap fct-layout-width"},VE={class:"single-page-header fct-page-loader-header flex items-start justify-between"},TE={class:"single-page-body"},ME={class:"fct-single-order"},LE={class:"fct-single-order-main"},RE={class:"fct-single-order-aside"},OE={class:"fct-admin-sidebar"},Ip={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",DE,[o("div",VE,[n(s,{animated:"",class:"flex items-start gap-2"},{template:d(()=>[(r(),h(H,null,ae(3,i=>n(l,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),o("div",TE,[o("div",ME,[o("div",LE,[n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1})]),o("div",RE,[o("div",OE,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},HE={key:2},PE={key:0,class:"fct-single-customer-wrapper fct-layout-width"},NE={class:"single-page-header"},KE={class:"single-page-header-title-wrap"},GE={key:0},jE={key:0,class:"single-page-body"},zE={class:"fct-admin-sidebar"},qE={key:0},YE={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:sd,IconButton:Ze,Empty:wt,DynamicIcon:J,Badge:ma,SaveBar:rn,CustomerInformation:Up,Labels:oi,DynamicTemplates:cn,ArrowDown:Rn,ArrowRight:dl,CardContainer:Be,CardHeader:Qe,CardBody:Ce,LicenseTable:ad,OrdersTableMobile:nd,SubscriptionsTable:qc,SingleCustomerLoader:Ip,SubscriptionsTableMobile:zc},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,ue.put("customers/"+this.customer_id+"/additional-info",{labels:this.selectedLabels}).then(e=>{z.success(e)}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,this.changes_made=0})},discardChanges(){return window.location.reload()},fetch(){this.notFound.show=!1,this.loading=!0,this.selectedOrders=[],ue.get("customers/"+this.customer_id,{with:["admin_customer_detail"]}).then(e=>{this.changeTitle(u("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=it.get(e,"data.buttonText"),this.notFound.message=it.get(e,"data.message"),this.notFound.route=it.get(e,"data.route")):e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},getCustomerOrders(){this.fetchingOrders=!0,ue.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"?z.validationErrors(e):z.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()}},WE=Object.assign(YE,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb"),i=C("el-input"),c=C("el-col"),p=C("el-row");return r(),h(H,null,[t.loading?(r(),E(Ip,{key:0})):B("",!0),t.notFound.show?(r(),E(ri,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):B("",!0),t.notFound.show===!1?(r(),h("div",HE,[t.loading?B("",!0):(r(),h("div",PE,[n(rn,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",NE,[o("div",KE,[n(s,{"separator-icon":A(dl)},{default:d(()=>[n(l,{to:{name:"customers"}},{default:d(()=>[R(m(A(u)("Customers")),1)]),_:1}),n(l,null,{default:d(()=>[t.customer?(r(),h("span",GE,m(t.customer.full_name),1)):B("",!0)]),_:1}),n(l,null,{default:d(()=>[R(m(A(u)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(r(),h("div",jE,[n(p,{gutter:30},{default:d(()=>[n(c,{lg:17,xs:24},{default:d(()=>[n(A(Be),{class:"overflow-hidden fct-customer-orders-items"},{default:d(()=>[n(A(Qe),{title:A(u)("Orders (%s)",A(ta)(t.customerOrders.total||0)),title_size:"small"},{action:d(()=>[n(i,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=f=>t.search=f),onKeyup:a[1]||(a[1]=xa(f=>t.getCustomerOrders(),["enter"])),placeholder:A(u)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=f=>t.getCustomerOrders()),class:de(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),n(Ze,{tag:"button",size:"small",onClick:a[3]||(a[3]=f=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:d(()=>[t.showSearch?(r(),E(J,{key:0,name:"Cross"})):(r(),E(J,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),n(A(Ce),{class:"px-0 pb-0"},{default:d(()=>[t.fetchingOrders?(r(),E(K$,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(H,{key:1},[n(sd,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),n(nd,{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(Vc,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):B("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(r(),E(A(Be),{key:0,class:"overflow-hidden"},{default:d(()=>[n(A(Qe),{title:A(u)("Subscriptions")+" ("+A(ta)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),n(A(Ce),{class:"px-0 pb-0"},{default:d(()=>[n(qc,{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"]),n(zc,{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})):B("",!0),t.customer.licenses?(r(),E(A(Be),{key:1,class:"overflow-hidden"},{default:d(()=>[n(A(Qe),{title:A(u)("Licenses")+" ("+A(ta)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),n(A(Ce),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:d(()=>[n(ad,{columns:["product","order_id"],licenses:t.customer.licenses},null,8,["licenses"])]),_:1})]),_:1})):B("",!0)]),_:1}),n(c,{lg:7,xs:24},{default:d(()=>[o("div",zE,[n(Up,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),n(oi,{"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",qE,[n(cn,{filter:"customer",widgetsQuery:{customer_id:t.customer.id},data:{customer:t.customer}},null,8,["widgetsQuery","data"])])):B("",!0)])]),_:1})]),_:1})])):B("",!0)]))])):B("",!0)],64)}}}),JE={components:{BundleProducts:Io,Empty:wt,Pagination:Vc,Badge:ma,DynamicIcon:J},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 pt},Asset(){return ms},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:u,translateNumber:ta,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(c=>c.object_id),a=this.selectedProducts.map(c=>c.object_id),l=((i=e==null?void 0:e.other_info)==null?void 0:i.payment_type)==="onetime"?"subscription":"onetime",s=this.order.order_items.length===0;if(s&&this.selectedProducts.length===0)return!0;if(s&&a.includes(e.object_id))return!0;if(!s&&t.includes(e.object_id))return!0;if(s&&!this.hasSubscriptionProduct(this.selectedProducts,l)){if(!this.hasSubscriptionProduct(this.selectedProducts,"subscription"))return!0}else if(!s&&!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,z.error(u("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;ke(()=>{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"]};ue.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=wm(a.data,this.order_id),delete a.data,this.paginate=a,this.searching=!1}).catch(t=>{var a;t.status_code=="422"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1})},formatCapitalized(e){return bm(e)}}},XE={class:"fluent-cart-admin-pages"},ZE={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},eU={class:"px-5"},tU={class:"fc_product_search_table",ref:"fc_product_search_table"},aU={class:"fct-collapsible-list"},lU={class:"fct-collapsible-list-item-inner"},sU={class:"fct-collapsible-item"},nU={class:"fct-collapsible-content-wrapper"},oU=["onClick"],iU={key:1,class:"content-indent"},rU={class:"content-checkbox"},dU={class:"content-img"},uU=["src","alt"],cU={class:"content-title"},AU={class:"title"},pU={key:0,class:"text-gray-500 dark:text-gray-400"},fU={key:1,class:"text"},mU={key:0,class:"fct-collapsible-stock-wrapper"},hU={key:0},_U={key:1,class:"text-red-500"},vU={class:"fct-collapsible-value-wrapper"},gU={key:0},yU={key:1},bU={class:"fct-collapsible-item-child-inner"},wU={class:"fct-collapsible-item"},CU={class:"fct-collapsible-content-wrapper"},kU={class:"fct-collapsible-content-group"},BU={class:"content-checkbox"},xU={class:"content-img"},SU=["src","alt"],FU={class:"content-title"},$U={class:"title title--wrap"},EU={key:0,class:"text"},UU={key:0},IU={key:1,class:"text already-added"},QU={class:"fct-collapsible-stock-wrapper"},DU={key:0},VU={key:1,class:"text-red-500"},TU={class:"fct-collapsible-value-wrapper"},MU={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},LU={class:"dialog-footer"};function RU(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-input"),f=C("el-skeleton"),_=C("el-checkbox"),g=C("BundleProducts"),y=C("Empty"),v=C("Pagination"),b=C("el-button"),k=C("el-dialog");return r(),h("div",XE,[n(k,{class:"fct-add-product-item-modal",ref:"fc_product_search_container",onClose:t[3]||(t[3]=w=>i.searchQuery=""),modelValue:s.orderAddModal,"onUpdate:modelValue":t[4]||(t[4]=w=>s.orderAddModal=w),title:e.$t("Add Items")},{default:d(()=>[o("div",ZE,[o("div",eU,[n(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:d(()=>[n(c,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),o("div",tU,[n(f,{class:"px-5 py-4",loading:s.loading,rows:5,animated:""},null,8,["loading"]),s.loading?B("",!0):(r(),h(H,{key:0},[o("ul",aU,[(r(!0),h(H,null,ae(s.availableProducts,(w,S)=>{var $,V,F,x,Q,D,T,U,I;return r(),h("li",{class:"fct-collapsible-list-item",key:S},[o("div",lU,[o("div",sU,[o("div",nU,[(($=w==null?void 0:w.children)==null?void 0:$.length)>0?(r(),h("div",{key:0,class:de(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[S]}]),onClick:O=>i.handleToggleCollapse(S)},[n(c,{name:"CaretRight"})],10,oU)):B("",!0),!((V=w==null?void 0:w.children)!=null&&V.length)>0?(r(),h("div",iU)):B("",!0),o("div",rU,[n(_,{modelValue:w.checked,"onUpdate:modelValue":O=>w.checked=O,onChange:O=>i.handleCheckboxChange(S,w),disabled:w.disable===!0||i.isAlreadyAdded(w.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",dU,[o("img",{src:w.featured_media!=null?w.featured_media:i.Asset.getUrl("images/placeholder-small.svg"),alt:w.title},null,8,uU)]),o("div",cU,[o("div",AU,m(w.post_title),1),((F=w==null?void 0:w.other_info)==null?void 0:F.payment_type)==="subscription"&&((x=w.other_info)==null?void 0:x.billing_summary)!==""?(r(),h("small",pU,m((Q=w.other_info)==null?void 0:Q.billing_summary),1)):B("",!0),i.isAlreadyAdded(w.object_id)?(r(),h("div",fU,m(e.$t("Item already added")),1)):B("",!0)])]),((D=w==null?void 0:w.children)==null?void 0:D.length)==0?(r(),h("div",mU,[w.stockStatus=="in-stock"?(r(),h("span",hU,m(w.available!==1/0?w.available+i.translate(" Available"):i.translate("Unlimited")),1)):B("",!0),w.stockStatus==="out-of-stock"?(r(),h("span",_U,m(i.formatCapitalized(w.stockStatus)),1)):B("",!0)])):B("",!0),o("div",vU,[((T=w==null?void 0:w.children)==null?void 0:T.length)>0?(r(),h("span",gU,m(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",yU,m(e.formatNumber(w.price)),1))])]),((U=w==null?void 0:w.children)==null?void 0:U.length)>0?(r(),h("div",{key:0,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[S]}])},null,2)):B("",!0),((I=w==null?void 0:w.children)==null?void 0:I.length)>0?(r(),h("div",{key:1,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[S]}])},[o("ul",bU,[(r(!0),h(H,null,ae(w.children,(O,L)=>{var P,q,X,G,te;return r(),h("li",{key:L},[o("div",wU,[o("div",CU,[o("div",kU,[o("div",BU,[n(_,{modelValue:O.checked,"onUpdate:modelValue":ne=>O.checked=ne,onChange:ne=>i.handleCheckboxChange(L,O),disabled:O.disable===!0||i.isAlreadyAdded(O.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",xU,[o("img",{src:O.featured_media!=null?O.featured_media:e.appVars.asset_url+"images/placeholder-small.svg",alt:O.title},null,8,SU)])]),o("div",FU,[o("div",$U,m(O.variation_display_title||O.title),1),((P=O==null?void 0:O.other_info)==null?void 0:P.payment_type)==="subscription"&&((q=O.other_info)==null?void 0:q.billing_summary)!==""?(r(),h("small",EU,[R(m(i.CurrencyFormatter.currencySign)+" "+m((X=O.other_info)==null?void 0:X.billing_summary)+" ",1),((G=O.other_info)==null?void 0:G.trial_days)>0?(r(),h("span",UU,[t[5]||(t[5]=o("br",null,null,-1)),R(" "+m(i.translate("Trial Days"))+": "+m((te=O.other_info)==null?void 0:te.trial_days),1)])):B("",!0)])):B("",!0),i.isAlreadyAdded(O.object_id)?(r(),h("div",IU,m(i.translate("Item already added")),1)):B("",!0),O.bundle_items.length>0?(r(),E(g,{key:2,product:O,"title-key":"variation_title"},null,8,["product"])):B("",!0)])]),o("div",QU,[O.stockStatus=="in-stock"?(r(),h("span",DU,m(O.available!==1/0?i.translateNumber(O.available)+i.translate(" Available"):i.translate("Unlimited")),1)):B("",!0),O.stockStatus=="out-of-stock"?(r(),h("span",VU,m(i.formatCapitalized(O.stockStatus)),1)):B("",!0)]),o("div",TU,m(e.formatNumber(O.price)),1)])])}),128))])],2)):B("",!0)])])}),128))]),s.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"])):B("",!0)],64))],512),o("div",MU,[n(v,{pagerSizes:!1,hide_on_single:!1,pagination:s.paginate,onFetch:i.doSearch,onCurrentPageChanged:i.onCurrentPageChanged,onOnPerPageChanged:i.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),o("div",LU,[n(b,{onClick:t[2]||(t[2]=w=>s.orderAddModal=!1)},{default:d(()=>[R(m(i.translate("Cancel")),1)]),_:1}),n(b,{disabled:!s.selectedProducts.length,type:"primary",onClick:i.processProducts},{default:d(()=>[R(m(i.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const Qp=lt(JE,[["render",RU]]),Ln=(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,s=p=>{const f=parseInt(p&&p.group_id,10);if(l){const _=l.indexOf(f);return _===-1?Number.MAX_SAFE_INTEGER:_}return f||0},c=[...a].sort((p,f)=>s(p)-s(f)).map(p=>p&&p.title?String(p.title).trim():"").filter(Boolean);if(c.length)return c.join(" / ")}return e.variation_title||""},Go=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(s=>parseInt(s&&s.group_id,10)).filter(s=>!Number.isNaN(s)):null},OU={key:0,class:"fct-downloadable-variation-selector"},HU={class:"price-info"},PU={key:0},jo={__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",OU,[o("span",null,m(A(Ln)(e.variant,e.groupOrder)),1),o("span",HU,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),h("span",PU,m(A(ca).capitalize(e.variant.other_info.repeat_interval)),1)):B("",!0),o("span",null,m(A(Gt)(e.variant.item_price,!0)),1)])])):B("",!0)}}},NU={name:"Refund",components:{Badge:ma,VariationSelector:jo,DynamicIcon:J},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 pt},orderCurrencySign(){const e=Ge.get("currency_signs",{}),t=Ge.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:u,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(s=>s.id===e);this.refund.amount=t.refundable?parseFloat(t.refundable/100):0,this.refund.paymentMethod=t.payment_method;const a=it.whereIn(this.order.order_items,"id",this.refund.item_ids),l=a.reduce((s,i)=>s+(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").map(e=>{var t;return{...e,refundable:e.total-(parseInt((t=e.meta)==null?void 0:t.refunded_total)||0)}}),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})}}},KU={key:0,class:"fct-refund-note-list"},GU={class:"message"},jU={key:1},zU={class:"refund-item-info"},qU={class:"right"},YU={class:"price"},WU={class:"price light"},JU={class:"form-note"},XU={style:{color:"#F04438","font-weight":"500"}},ZU={class:"form-note form-note-tooltip"},e5={class:"dialog-footer is-border"},t5={key:0};function a5(e,t,a,l,s,i){const c=C("Badge"),p=C("el-option"),f=C("el-select"),_=C("el-form-item"),g=C("el-input"),y=C("el-checkbox"),v=C("el-col"),b=C("el-table-column"),k=C("el-input-number"),w=C("el-table"),S=C("DynamicIcon"),$=C("el-tooltip"),V=C("el-row"),F=C("el-form"),x=C("el-button");return r(),h("div",null,[s.refundNote?(r(),h("div",KU,[(r(!0),h(H,null,ae(s.refundNote,(Q,D)=>(r(),h("div",{key:D,class:"fct-refund-note-item"},[o("span",GU,m(Q.message),1),n(c,{status:Q.status},null,8,["status"])]))),128))])):(r(),h("div",jU,[n(F,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(V,{gutter:10},{default:d(()=>[n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Refund with transaction"),required:""},{default:d(()=>[n(f,{modelValue:s.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=Q=>s.refund.transaction_id=Q),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,ae(s.refundableTransactions,Q=>(r(),E(p,{key:Q.id,label:i.translate("#%1$s - Paid %2$s",Q.id,i.formatNumber(Q.refundable,!0)),value:Q.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(_,{label:e.$t("Select Item/s")},{default:d(()=>[n(f,{modelValue:s.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=Q=>s.refund.item_ids=Q),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,ae(a.order.order_items,Q=>(r(),E(p,{key:Q.id,value:Q.id,label:Q.post_title+" - "+(Q.variation_display_title||Q.title)+" "+i.formatNumber(Q.line_total-Q.refund_total),class:"refund-item",disabled:Number(Q.line_total)-Number(Q.refund_total)<=0},{default:d(()=>[o("div",zU,[o("p",null,[R(m(Q.post_title)+" ",1),o("span",null,"-"+m(Q.variation_display_title||Q.title),1)]),o("div",qU,[o("span",YU,m(i.translate("Refundable: %1$s",i.formatNumber(Q.line_total-Q.refund_total))),1),o("span",WU,m(i.translate("Item price: %1$s",i.formatNumber(Q.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Refund amount"),required:""},{default:d(()=>[n(g,{type:"number",min:1,max:s.maxRefundAmount,modelValue:s.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=Q=>s.refund.amount=Q),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:d(()=>[R(m(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",JU,[o("p",null,[R(m(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",XU,m(i.formatNumber(s.maxRefundAmount*100)),1)])])]),_:1},8,["label"]),i.isSubscriptionCancelable?(r(),E(v,{key:0,lg:24},{default:d(()=>[n(_,{label:e.$t("Subscription")},{default:d(()=>[n(y,{label:e.$t("Cancel Subscription (if any)"),modelValue:s.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=Q=>s.refund.cancelSubscription=Q)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):B("",!0),i.isAnyProductManageStock?(r(),E(v,{key:1,lg:24},{default:d(()=>[n(_,null,{default:d(()=>[n(y,{modelValue:s.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=Q=>s.refund.manageStock=Q)},{default:d(()=>[R(m(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):B("",!0),s.refund.manageStock?(r(),E(v,{key:2,lg:24},{default:d(()=>[n(w,{data:i.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:d(()=>[n(b,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:d(({row:Q})=>[o("span",null,m(Q.post_title)+" - "+m(Q.title),1)]),_:1},8,["label"]),n(b,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:d(({row:Q})=>[o("span",null,m(Q.quantity),1)]),_:1},8,["label"]),n(b,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:d(({row:Q})=>[n(k,{modelValue:Q.restore_quantity,"onUpdate:modelValue":D=>Q.restore_quantity=D,min:0,max:Q.quantity},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})):B("",!0),n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Reason of refund")},{default:d(()=>[n(g,{modelValue:s.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=Q=>s.refund.reason=Q)},null,8,["modelValue"]),o("div",ZU,[o("p",null,[R(m(i.translate("Your customers can see this reason"))+" ",1),o("span",null,[n($,{"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:d(()=>[n(S,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",e5,[n(x,{type:"primary",onClick:Ne(i.processRefund,["prevent"]),loading:s.refundProcessing,disabled:s.refund.amount<=0},{default:d(()=>[R(m(s.refundProcessing?i.translate("Processing"):i.translate("Refund"))+" ",1),s.refund.amount?(r(),h("span",t5)):B("",!0),R(m(i.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const l5=lt(NU,[["render",a5]]),s5={class:"fct-number-input"},n5=["disabled","min","max"],o5={class:"fct-number-input-buttons"},i5=["disabled"],r5=["disabled"],d5={style:{color:"red"}},Dp={__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 $,V,F,x,Q;const a=t,l=e,s=M(""),i=()=>{var D,T,U,I;return(((D=l.item)==null?void 0:D.manage_stock)||((I=(U=(T=l.item)==null?void 0:T.variants)==null?void 0:U.product_detail)==null?void 0:I.manage_stock))==1},c=M((($=l.item)==null?void 0:$.quantity)||l.min),p=M(c.value),f=M(i()?((V=l.item)==null?void 0:V.available)||((x=(F=l.item)==null?void 0:F.variants)==null?void 0:x.available):l.max),_=M(i()?(Q=l.item)==null?void 0:Q.updated_stock:l.max);Yt().ctx;const g=N(()=>p.value<=l.min),y=N(()=>p.value>=_.value),v=()=>{s.value="",p.value<_.value&&(c.value++,p.value=c.value,a("update:value",c.value,_.value,l.item))},b=()=>{s.value="",p.value>l.min&&(c.value--,p.value=c.value,a("update:value",c.value,_.value,l.item))},k=(D,T)=>{s.value="",p.value=parseInt(p.value),(isNaN(p.value)||p.value==="")&&(c.value=1),p.value<l.min?(c.value=l.min,p.value=c.value):p.value>l.max?(c.value=l.min,p.value=c.value,s.value=u("Unable to adjust quantity")):p.value>_.value?(c.value=_.value,p.value=c.value,s.value=u("Available: %s in stock",_.value)):p.value>=l.min&&(p.value===_.value||p.value<_.value)&&(c.value=p.value,p.value=c.value),a("update:value",c.value,_.value,l.item)},w=D=>{D.key==="ArrowDown"&&p.value<=l.min&&D.preventDefault()},S=()=>{var D,T,U,I,O;s.value="",c.value=((D=l.item)==null?void 0:D.quantity)||l.min,p.value=c.value,f.value=i()?((T=l.item)==null?void 0:T.available)||((I=(U=l.item)==null?void 0:U.variants)==null?void 0:I.available):l.max,_.value=i()?(O=l.item)==null?void 0:O.updated_stock:l.max};return Is(()=>{S()}),be(()=>l.item,D=>{S()},{deep:!0}),(D,T)=>(r(),h(H,null,[o("div",s5,[qt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":T[0]||(T[0]=U=>p.value=U),type:"number",onInput:T[1]||(T[1]=U=>{k()}),min:e.min,max:e.max,onKeydown:w},null,40,n5),[[Tf,p.value,void 0,{number:!0}]]),o("div",o5,[o("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[n(J,{name:"ChevronUp"})],8,i5),o("button",{onClick:b,class:"decrement-btn",disabled:g.value||e.isDisabled},[n(J,{name:"ChevronDown"})],8,r5)])]),o("span",d5,m(s.value),1)],64))}},u5={name:"PaymentLink",components:{IconButton:Ze,DynamicIcon:J,CopyToClipboard:Ia,InfoFilled:al},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 J},adminUrl(){return Ge.get("admin_url")}},mounted(){this.makeSelectableId(),this.generatePaymentUrl()},methods:{translate:u,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}}},c5=["element-loading-text"],A5={class:"fct-payment-link-block"},p5={key:1,class:"fct-payment-link-block"};function f5(e,t,a,l,s,i){const c=C("CopyToClipboard"),p=C("el-button"),f=C("el-input"),_=C("el-form-item"),g=C("el-col"),y=C("el-row"),v=Ma("loading");return qt((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",A5,[s.paymentUrl?(r(),E(c,{key:0,text:s.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:d(()=>[R(m(i.translate("Create a custom checkout page to generate custom links.")),1)]),_:1}))]),s.selectedMethod==="paypal"&&s.use_vendor_checkout?(r(),E(y,{key:0,class:"el-form--label-top",gutter:20},{default:d(()=>[n(g,{md:24,lg:11},{default:d(()=>[n(_,{label:i.translate("PayPal Business/Seller Email")},{default:d(()=>[n(f,{modelValue:s.business_email,"onUpdate:modelValue":t[0]||(t[0]=b=>s.business_email=b),placeholder:i.translate("Enter your PayPal business/seller email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(g,{md:24,lg:11},{default:d(()=>[n(_,{label:i.translate("PayPal Buyer Email (optional)")},{default:d(()=>[n(f,{modelValue:s.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=b=>s.buyer_email=b),placeholder:i.translate("Enter The buyer email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})):B("",!0),s.use_vendor_checkout?(r(),h("div",p5,[n(p,{type:"primary",onClick:i.getPaymentLink},{default:d(()=>[R(m(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):B("",!0)],8,c5)),[[v,s.fetchLink]])}const m5=lt(u5,[["render",f5]]),h5={class:"fct-single-order-loader-wrap fct-layout-width"},_5={class:"single-page-header fct-page-loader-header flex items-start justify-between"},v5={class:"single-page-body"},g5={class:"fct-single-order"},y5={class:"fct-single-order-main"},b5={class:"fct-single-order-aside"},w5={class:"fct-admin-sidebar"},C5={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",h5,[o("div",_5,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-180"},{template:d(()=>[n(l,{class:"w-1/4"}),n(l,{class:"w-3/4"})]),_:1})]),o("div",v5,[o("div",g5,[o("div",y5,[n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})]),o("div",b5,[o("div",w5,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},k5={name:"_Plans.vue",components:{Badge:ma},props:["subscription","header","order","getOrderUrl"],data(){return{}},computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:u}},B5={class:"fct-subscription-plan-wrap"},x5={class:"fct-subs-status-wrap float-end"},S5={class:"fct-subs-title underline"},F5=["innerHTML"],$5={key:0,class:"cursor-pointer"};function E5(e,t,a,l,s,i){var f,_,g,y;const c=C("Badge"),p=C("router-link");return r(),h("div",B5,[o("div",x5,[n(c,{status:i.subscriptionStatus},null,8,["status"])]),n(p,{to:{name:"view_subscription",params:{subscription_id:(f=a.subscription)==null?void 0:f.id}}},{default:d(()=>{var v;return[o("p",S5,m(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,F5),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",$5,[R(m(i.translate("Parent Order:"))+" ",1),o("a",{onClick:t[0]||(t[0]=v=>{var b;return a.getOrderUrl((b=a.order)==null?void 0:b.parent_id)})},"#"+m((y=a.order)==null?void 0:y.parent_id),1)])):B("",!0)])}const Vp=lt(k5,[["render",E5]]),U5={name:"SubscriptionPlanItem",components:{CardContainer:Be,CardHeader:Qe,CardBody:Ce,Plans:Vp},props:["subscription","order","index","getOrderUrl"]};function I5(e,t,a,l,s,i){const c=C("CardHeader"),p=C("Plans"),f=C("CardBody"),_=C("CardContainer");return r(),E(_,null,{default:d(()=>[n(c,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},null,8,["title"]),n(f,null,{default:d(()=>[n(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 Q5=lt(U5,[["render",I5]]),D5={name:"OrderBulkActions",components:{DynamicIcon:J},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:u,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(u("Are you sure you want to delete this order? This action can not be undone!"),u("Confirm Deleting"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteOrder()})},deleteOrder(){this.deleting=!0,this.$del("orders/"+this.order.id).then(e=>{tn(e.message),this.$router.replace({name:"orders"})}).catch(e=>{e.status_code=="422"?z.validationErrors(e):z.error(e==null?void 0:e.data)}).finally(()=>{this.deleting=!1})},changeShipping(){this.showModal=!0},completeOrder(){this.$confirm(u("Are you sure you want to complete this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as complete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"completed"})})},generateMissingLicenses(){this.$confirm(u("Are you sure you want to generate missing licenses!"),u("Please confirm"),{confirmButtonText:u("Yes, Generate all missing licenses!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.generateLicenses()})},generateLicenses(){this.doing_actions=!0,this.$post("orders/"+this.order.id+"/generate-missing-licenses",{}).then(e=>{z.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},backToProcessing(){this.$confirm(u("Are you sure you want to revert back processing this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as processing!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"processing"})})},cancelOrder(){this.$confirm(u("Are you sure you want to change the order status to Cancel? This action is irreversible and cannot be undone."),u("Please confirm"),{confirmButtonText:u("Yes, Changed status to Cancel"),cancelButtonText:u("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=>{z.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?z.validationErrors(t):z.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=>{z.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},V5={class:"fct-order-bulk-action-modal"},T5={key:1,class:"more-btn"},M5={key:0},L5=["href"],R5={class:"dialog-footer"};function O5(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button"),f=C("el-dropdown-item"),_=C("el-tooltip"),g=C("el-dropdown-menu"),y=C("el-dropdown"),v=C("el-option"),b=C("el-select"),k=C("el-form-item"),w=C("el-form"),S=C("el-dialog");return r(),h("div",V5,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:d(()=>[n(g,null,{default:d(()=>{var $,V;return[a.trigger_action!=="add"?(r(),h("div",M5,[!s.isCancelled&&(($=a.order)==null?void 0:$.fulfillment_type)==="physical"?(r(),E(f,{key:0,command:"shipping_status"},{default:d(()=>[n(c,{name:"ShipmentStatus"}),R(" "+m(i.translate("Change Shipping Status")),1)]),_:1})):B("",!0),a.order.mode==="test"||s.isCancelled?(r(),E(f,{key:1,command:"delete_order",class:"item-destructive"},{default:d(()=>[n(c,{name:"Delete"}),R(" "+m(i.translate("Delete order")),1)]),_:1})):B("",!0),a.order.status==="processing"?(r(),E(f,{key:2,command:"order_complete"},{default:d(()=>[n(c,{name:"Check"}),R(" "+m(i.translate("Mark As Complete")),1)]),_:1})):B("",!0),s.isCancelled?B("",!0):(r(),E(f,{key:3,command:"order_cancel"},{default:d(()=>[n(c,{name:"Cross"}),R(" "+m(i.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(r(),E(f,{key:4,command:"order_processing"},{default:d(()=>[n(c,{name:"Refresh"}),R(" "+m(i.translate("Back to processing")),1)]),_:1})):B("",!0),!s.isCompleted&&!s.isCancelled?(r(),E(f,{key:5,command:"sync_order_statuses"},{default:d(()=>[n(c,{name:"Refresh"}),R(" "+m(i.translate("Sync Order Statuses")),1)]),_:1})):B("",!0),n(f,{command:"order_receipt",class:"item-link"},{default:d(()=>[o("a",{target:"_blank",href:a.order.receipt_url},[n(c,{name:"External"}),R(" "+m(i.translate("Receipt")),1)],8,L5)]),_:1}),(V=a.order)!=null&&V.has_missing_licenses?(r(),E(f,{key:6,command:"generate_missing_licenses"},{default:d(()=>[n(c,{name:"Files"}),R(" "+m(i.translate("Generate missing licenses")),1)]),_:1})):B("",!0),a.shouldShowRefund?(r(),E(f,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:d(()=>[n(c,{name:"Money"}),R(" "+m(i.translate("Refund")),1)]),_:1})):B("",!0),n(f,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:s.shouldDisableEditing},{default:d(()=>[n(c,{name:"Edit"}),a.isEditingItem?(r(),h(H,{key:1},[R(m(i.translate("Disable Editing")),1)],64)):(r(),h(H,{key:0},[s.shouldDisableEditing?(r(),E(_,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[R(m(a.warningMessage),1)]),default:d(()=>[R(" "+m(i.translate("Edit")),1)]),_:1})):(r(),h(H,{key:1},[R(m(i.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):B("",!0)]}),_:1})]),default:d(()=>[a.triggerMode==="button"?(r(),E(p,{key:0},{default:d(()=>[R(m(i.translate("More Action"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})):(r(),h("span",T5,[n(c,{name:"More"})]))]),_:1},8,["onCommand"]),n(S,{modelValue:s.showModal,"onUpdate:modelValue":t[2]||(t[2]=$=>s.showModal=$),title:i.translate("Update Shipping Status")},{default:d(()=>[n(w,{data:s.status_data,"label-position":"top"},{default:d(()=>[s.selected_action==="shipping_status"||s.selected_action==="all"?(r(),E(k,{key:0,label:i.translate("Shipping Status")},{default:d(()=>[n(b,{modelValue:s.status_data.shipping_status,"onUpdate:modelValue":t[0]||(t[0]=$=>s.status_data.shipping_status=$),placeholder:i.translate("Select Shipping Status")},{default:d(()=>[(r(!0),h(H,null,ae(e.appVars.shipping_statuses,($,V)=>(r(),E(v,{key:V,label:$,value:V},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]),o("span",R5,[n(p,{onClick:t[1]||(t[1]=$=>i.changeShippingStatus()),type:"primary"},{default:d(()=>[R(m(i.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const xd=lt(D5,[["render",O5]]),H5={name:"Transaction",computed:{Str(){return ca}},components:{ConvertedTime:Na,ArrowDown:Qc(Rn),Check:Oc,Badge:ma,DynamicIcon:J},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:u,getCardBrand:Jc,translateNumber:ta,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)||u("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},P5={key:0,class:"fct-transaction-details -mt-[1px]"},N5={class:"fct-table-wrap"},K5={class:"p-0 m-0 text-xs text-gray-500"},G5={key:0},j5=["href"],z5={class:"flex items-center gap-2.5"},q5={key:0,class:"w-7"},Y5=["title","src","alt"],W5={key:1,class:"capitalize"},J5={key:2},X5={class:"text-sm"},Z5={class:"text-sm text-gray-700"},eI={class:"text-sm flex gap-2"},tI=["href"];function aI(e,t,a,l,s,i){var $,V;const c=C("ConvertedTime"),p=C("el-table-column"),f=C("Badge"),_=C("el-tooltip"),g=C("el-button"),y=C("DynamicIcon"),v=C("el-table"),b=C("el-form-item"),k=C("el-input"),w=C("el-form"),S=C("el-dialog");return a.transactions.length>0?(r(),h("div",P5,[o("div",N5,[n(v,{data:a.transactions,class:"w-full"},{default:d(()=>[n(p,{label:i.translate("# Date"),width:"auto"},{default:d(F=>{var x,Q;return[o("div",null,[o("p",K5,"#"+m(i.translateNumber(F.row.id)),1),n(c,{"date-time":((Q=(x=F.row)==null?void 0:x.meta)==null?void 0:Q.settled_at)||F.row.created_at},null,8,["date-time"])])]}),_:1},8,["label"]),n(p,{label:i.translate("Gateway ID"),width:"160"},{default:d(F=>[F.row.vendor_charge_id==""?(r(),h("span",G5,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:F.row.url},m(F.row.vendor_charge_id),9,j5))]),_:1},8,["label"]),n(p,{label:i.translate("Payment Method"),width:"140"},{default:d(F=>[o("div",z5,[i.getCardBrand(F.row.card_brand,F.row.payment_method_type)?(r(),h("div",q5,[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,Y5)])):(r(),h("span",W5,m(F.row.payment_method_type),1)),F.row.card_last_4&&F.row.card_last_4!="0"?(r(),h("span",J5,m("..."+F.row.card_last_4),1)):B("",!0)])]),_:1},8,["label"]),n(p,{label:i.translate("Total"),width:"auto"},{default:d(F=>[o("span",null,m(e.formatNumberForOrder(F.row.total,a.orderCurrency)),1)]),_:1},8,["label"]),n(p,{label:i.translate("Status"),width:"120"},{default:d(F=>{var x,Q,D,T,U,I;return[F.row.transaction_type=="dispute"?(r(),E(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((Q=(x=F.row)==null?void 0:x.meta)==null?void 0:Q.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>[n(f,{class:"m-2 b-red",status:"dispute"},{default:d(()=>t[3]||(t[3]=[R(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):B("",!0),(T=(D=F.row)==null?void 0:D.meta)!=null&&T.reason?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate((I=(U=F.row)==null?void 0:U.meta)==null?void 0:I.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var O,L,P,q;return[((L=(O=F.row)==null?void 0:O.meta)==null?void 0:L.disputed)=="yes"&&((q=(P=F.row)==null?void 0:P.meta)==null?void 0:q.dispute_resolved)=="no"?(r(),E(f,{key:0,status:F.row.status},{default:d(()=>{var X;return[R(m(F.row.status)+" "+m((X=F==null?void 0:F.row)==null?void 0:X.transaction_type),1)]}),_:2},1032,["status"])):(r(),E(f,{key:1,status:F.row.status},{default:d(()=>[R(m(F.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(f,{key:2,status:F.row.status},{default:d(()=>[R(m(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:d(F=>[F.row.transaction_type=="dispute"&&F.row.status=="succeeded"?(r(),E(g,{key:0,type:"warning",size:"small",onClick:x=>i.handleDispute(F.row)},{default:d(()=>[R(m(i.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):B("",!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:d(()=>[n(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",F.row.payment_method),loading:s.syncing_transaction===F.row.id,onClick:x=>i.syncTransaction(F.row)},{default:d(()=>[n(y,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]),n(S,{modelValue:s.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=F=>s.disputeHandleModal=F),title:"Handle Dispute #"+((V=($=s.disputeTransaction)==null?void 0:$.meta)==null?void 0:V.dispute_id),width:"800px"},{footer:d(()=>{var F,x,Q,D,T,U;return[o("a",{href:(F=s.disputeTransaction)==null?void 0:F.url,target:"_blank",class:"el-button el-button--warning is-link"},m(i.translate("See dispute on ")+((x=s.disputeTransaction)==null?void 0:x.payment_method)),9,tI),(D=(Q=s.disputeTransaction)==null?void 0:Q.meta)!=null&&D.is_charge_refundable?(r(),E(g,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:s.loadingDisputeAction},{default:d(()=>[R(m(i.translate("Refund customer")),1)]),_:1},8,["loading"])):B("",!0),(U=(T=s.disputeTransaction)==null?void 0:T.meta)!=null&&U.is_dispute_actionable?(r(),E(g,{key:1,type:"primary",onClick:i.handleDisputeSubmit,loading:s.loadingDisputeAction},{default:d(()=>[R(m(i.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):B("",!0)]}),default:d(()=>{var F,x,Q,D,T,U;return[(x=(F=s.disputeTransaction)==null?void 0:F.meta)!=null&&x.dispute_reason?(r(),E(b,{key:0},{default:d(()=>{var I,O;return[o("div",X5," Dispute Reason: "+m((O=(I=s.disputeTransaction)==null?void 0:I.meta)==null?void 0:O.dispute_reason),1)]}),_:1})):B("",!0),n(b,null,{default:d(()=>[o("div",Z5,m(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=(Q=s.disputeTransaction)==null?void 0:Q.meta)!=null&&D.is_dispute_actionable?(r(),E(w,{key:1,model:s.disputeForm,"label-position":"top"},{default:d(()=>[n(b,{label:i.translate("Note"),prop:"dispute_note"},{default:d(()=>[n(k,{modelValue:s.disputeForm.dispute_note,"onUpdate:modelValue":t[0]||(t[0]=I=>s.disputeForm.dispute_note=I),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):B("",!0),(U=(T=s.disputeTransaction)==null?void 0:T.meta)!=null&&U.is_charge_refundable?(r(),E(b,{key:2},{default:d(()=>[o("div",eI,[n(y,{class:"w-6 h-6",name:"Information"}),R(" "+m(i.translate("This dispute has refundable action, so you may refund the charge to the customer for a dispute resolution.")),1)])]),_:1})):B("",!0)]}),_:1},8,["modelValue","title"])])):B("",!0)}const Sd=lt(H5,[["render",aI]]),Fd=(e,t,a=0)=>{let l=0,s=0;return t&&(e.manual_discount_total=0),e.order_items&&e.order_items.forEach((i,c)=>{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 f=i.unit_price*i.quantity;if(i.subtotal=f-(parseInt(i.cost)||0),e.manual_discount_total>0?i.discount_total=i.discount_total:t===!0?s+=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=f-i.discount_total,l+=f,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=s,(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),lI(e),e},Xu=(e,t)=>{if(t.value<0)return e;let a=t.value?t.value*100:0;t.label="",t.type==="percentage"&&(a=e.subtotal*t.value/100),Tp(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},lI=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),Tp=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),sI={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")}}},nI={class:"fct-note-modal"},oI={class:"dialog-footer"};function iI(e,t,a,l,s,i){const c=C("el-input"),p=C("el-form-item"),f=C("el-form"),_=C("el-button");return r(),h("div",nI,[n(f,{"label-position":"top"},{default:d(()=>[n(p,null,{default:d(()=>[n(c,{modelValue:s.notes,"onUpdate:modelValue":t[0]||(t[0]=g=>s.notes=g),autosize:{minRows:4},type:"textarea",minlength:"1",maxlength:"5000","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),o("div",oI,[n(_,{type:"info",soft:"",onClick:i.closeModal},{default:d(()=>[R(m(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(_,{type:"primary",onClick:i.saveNote},{default:d(()=>[R(m(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const Mp=lt(sI,[["render",iI]]),rI={class:"fct-admin-sidebar-item"},dI={key:0},uI={name:"Notes",components:{IconButton:Ze,NoteModal:Mp,DynamicIcon:J},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=>{z.success(a.message),this.noteCopy=e}).catch(a=>{z.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},Bi=Object.assign(uI,{setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-button"),c=C("el-dialog");return r(),h("div",null,[e.orderId?(r(),E(Be,{key:0},{default:d(()=>[n(Qe,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:d(()=>[e.shouldEnableEditing?(r(),E(Ze,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=p=>t.noteModalIsOpen=!0)},{default:d(()=>[n(J,{name:"Edit"})]),_:1})):B("",!0)]),_:1},8,["title"]),n(Ce,{class:de(t.noteNeedsCollapse?"pb-0":"")},{default:d(()=>[o("div",rI,[t.loading?(r(),E(s,{key:0,animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})):(r(),h(H,{key:1},[o("span",null,m(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:d(()=>[t.isNoteExpanded?(r(),h(H,{key:0},[R(m(t.$t("Show less"))+" ",1),n(J,{name:"ChevronUp"})],64)):(r(),h(H,{key:1},[R(m(t.$t("Show more"))+" ",1),n(J,{name:"ChevronDown"})],64))]),_:1},8,["onClick"])):B("",!0)],64))])]),_:1},8,["class"])]),_:1})):B("",!0),n(c,{"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:d(()=>[t.noteModalIsOpen?(r(),h("div",dI,[n(Mp,{note:t.noteCopy,onWhenNoteEditIsDone:t.saveNoteModal,onCloseModal:a[1]||(a[1]=p=>t.noteModalIsOpen=!1)},null,8,["note","onWhenNoteEditIsDone"])])):B("",!0)]),_:1},8,["modelValue","title"])])}}}),cI={name:"Coupon",components:{IconButton:Ze,DynamicIcon:J},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:u,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(c=>c.code);const s=this.availableCoupons.filter(c=>c.toLowerCase().includes(e.toLowerCase())).map(c=>({value:c}));t(s)}).catch(a=>{var l;a.status_code=="422"?z.validationErrors(a):z.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},applyCoupon(){if(this.coupons&&this.coupons.find(e=>e.code===this.newCoupon)){z.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"?z.validationErrors(e):z.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"?z.validationErrors(a):z.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"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},processCoupon(e){this.coupons=[],this.appliedCoupons=[];for(let s in e.applied_coupons)this.coupons.push({id:e.applied_coupons[s].id,code:s,amount:e.applied_coupons[s].discount}),this.appliedCoupons.push(e.applied_coupons[s].id);let t=0,a=0;const l=Object.values(e.calculated_items);this.order.order_items.forEach((s,i)=>{const c=l.find(p=>p.id==s.object_id||p.id==s.id);c!=null&&(this.order.order_items[i].price=c.price,this.order.order_items[i].unit_price=c.unit_price,this.order.order_items[i].line_total=c.unit_price*c.quantity-c.discount_total,t+=this.order.order_items[i].line_total,a+=c.discount_total,this.order.order_items[i].line_total_formatted=c.line_total_formatted,this.order.order_items[i].discount_total=c.discount_total,this.order.order_items[i].coupon_discount=c.coupon_discount||0,this.order.order_items[i].line_meta&&(this.order.order_items[i].line_meta.coupon_discount=c.coupon_discount||0))}),this.order.applied_coupon=e.applied_coupons,this.hasCoupon=this.coupons.length>0,Fd(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},AI={colspan:"3"},pI={class:"fct-add-coupon-wrap"},fI={key:0,class:"fct-add-coupon-input-label"},mI={key:1,class:"fct-add-coupon-input-label"},hI={key:2,class:"fct-add-coupon-input-wrap"},_I={class:"flex gap-0.5 items-center"};function vI(e,t,a,l,s,i){const c=C("el-autocomplete"),p=C("el-button"),f=C("el-alert"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-popconfirm");return r(),h(H,null,[o("tr",null,[o("td",AI,[o("div",pI,[a.action==="create_order"?(r(),h("div",fI,m(e.$t("Have a Coupon?")),1)):(r(),h("div",mI,m(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",hI,[n(c,{modelValue:s.newCoupon,"onUpdate:modelValue":t[0]||(t[0]=v=>s.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"]),n(p,{onClick:i.applyCoupon,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(m(e.$t("Apply")),1)]),_:1},8,["onClick"])])):B("",!0),!s.hasCoupon&&a.shouldManageCoupon?(r(),E(f,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):B("",!0),t[1]||(t[1]=o("span",null,null,-1))])])]),(r(!0),h(H,null,ae(s.coupons,v=>(r(),h("tr",{key:v.id,class:"fct-coupons-applied-row"},[o("td",null,[o("div",_I,[o("span",null,m(v.code),1),a.action==="create_order"?(r(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ne(b=>i.cancelCoupon(v.id,v),["prevent"]),class:"coupon-delete-btn"},{default:d(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick"])):B("",!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:b=>i.cancelCoupon(v.id,v),width:"250"},{reference:d(()=>[a.shouldManageCoupon?(r(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",class:"coupon-delete-btn"},{default:d(()=>[n(_,{name:"Delete"})]),_:1})):B("",!0)]),_:2},1032,["title","onConfirm"])):B("",!0)])]),t[2]||(t[2]=o("td",null,null,-1)),o("td",null,"- "+m(e.formatNumberForOrder(v.amount,a.order)),1)]))),128))],64)}const xi=lt(cI,[["render",vI]]),gI={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=Js({...e.discount}),l=M([{label:u("Amount"),value:"amount"}]),s=M("");return{discountOptions:l,applyDiscount:()=>{const f=parseInt(a.value);isNaN(f)||f<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{s.value="";const f=parseInt(a.value);let _=f||0;const g=e.totalAmount/100;return a.type=="percentage"?(_=g*f/100,(f>100||_>g)&&(s.value=u("Discount should not exceed the full product price (100%).")),isNaN(f)||f<1||f>100):(_>g&&(s.value=u("Discount should not exceed the full product price (%s).",Cm(g))),isNaN(f)||f<1||_>g)},error:s}}},yI={class:"fct-discount-modal"},bI=["innerHTML"],wI={key:1},CI={style:{color:"red"}},kI={class:"form-note"},BI={class:"dialog-footer"};function xI(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=C("el-form-item"),_=C("el-col"),g=C("el-input"),y=C("el-row"),v=C("el-form"),b=C("el-button");return r(),h("div",yI,[n(v,{"label-position":"top"},{default:d(()=>[n(y,{gutter:20},{default:d(()=>[n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Discount type")},{default:d(()=>[n(p,{modelValue:l.initialDiscount.type,"onUpdate:modelValue":t[0]||(t[0]=k=>l.initialDiscount.type=k),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=k=>{l.error=""})},{default:d(()=>[(r(!0),h(H,null,ae(l.discountOptions,k=>(r(),E(c,{key:k.value,label:k.label,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Discount value")},{default:d(()=>[n(g,{type:"number",min:1,modelValue:l.initialDiscount.value,"onUpdate:modelValue":t[2]||(t[2]=k=>l.initialDiscount.value=k),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:d(()=>[l.initialDiscount.type==="amount"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,bI)):(r(),h("span",wI,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",CI,m(l.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),n(y,null,{default:d(()=>[n(_,{md:24,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Reason for discount")},{default:d(()=>[n(g,{modelValue:l.initialDiscount.reason,"onUpdate:modelValue":t[3]||(t[3]=k=>l.initialDiscount.reason=k),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),o("div",kI,[o("p",null,m(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",BI,[n(b,{type:"info",onClick:l.cancelDiscount,soft:""},{default:d(()=>[R(m(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(b,{type:"primary",disabled:l.isDisabledApplyButton(),onClick:l.applyDiscount},{default:d(()=>[R(m(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const SI=lt(gI,[["render",xI]]),FI={name:"CustomDiscount",components:{IconButton:Ze,DynamicIcon:J,DiscountModal:SI},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:u,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()?u("Prorate Credit"):u("Discount"):this.order.manual_discount_total!==0?u("Edit Discount"):u("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={},Xu(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,Xu(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},$I={key:0},EI={key:1},UI={key:2},II={style:{"font-size":"12px",color:"rgb(107,114,128)"}},QI={style:{"padding-left":"16px"}},DI={style:{"font-size":"12px",color:"rgb(107,114,128)"}},VI={style:{"padding-left":"16px"}},TI={key:0};function MI(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("DiscountModal"),f=C("el-dialog");return r(),h(H,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),h("tr",$I,[o("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ne(_=>i.manageDiscount(),["prevent"]))},[R(m(i.getDiscountButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",EI,m(i.getDiscountButtonLabel()),1)),s.discount.label?(r(),h("span",UI,m(s.discount.label),1)):B("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(H,{key:3},[t[4]||(t[4]=R(" | ",-1)),o("a",{href:"#",onClick:t[1]||(t[1]=Ne(_=>i.removeDiscount(),["prevent"]))},m(i.translate("Remove Discount")),1)],64)):B("",!0)]),o("td",null,m(s.discount.reason?s.discount.reason:"__"),1),o("td",null,[o("span",null,"- "+m(e.formatNumberForOrder(a.order.manual_discount_total,a.order)),1)])])):B("",!0),a.order.config&&a.order.config.prorate_credit>0&&a.order.manual_discount_total-a.order.config.prorate_credit>0?(r(),h(H,{key:1},[o("tr",II,[o("td",QI,m(i.translate("Upgrade Discount")),1),t[5]||(t[5]=o("td",null,null,-1)),o("td",null,m(e.formatNumberForOrder(a.order.manual_discount_total-a.order.config.prorate_credit,a.order)),1)]),o("tr",DI,[o("td",VI,m(i.translate("Prorate Credit")),1),t[6]||(t[6]=o("td",null,null,-1)),o("td",null,m(e.formatNumberForOrder(a.order.config.prorate_credit,a.order)),1)])],64)):B("",!0),n(f,{"append-to-body":!0,width:"50%",modelValue:s.discountModalIsOpen,"onUpdate:modelValue":t[3]||(t[3]=_=>s.discountModalIsOpen=_),title:a.order.manual_discount_total===0?i.translate("Add discount"):i.translate("Edit discount")},{default:d(()=>[s.discountModalIsOpen?(r(),h("div",TI,[n(p,{discount:s.discount,totalAmount:a.order.subtotal,onWhenDiscountEditIsDone:i.applyDiscount,onEmitCancelDiscountModal:t[2]||(t[2]=_=>s.discountModalIsOpen=!1)},null,8,["discount","totalAmount","onWhenDiscountEditIsDone"])])):B("",!0)]),_:1},8,["modelValue","title"])],64)}const Si=lt(FI,[["render",MI]]),LI={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}}},RI={class:"fct-shipping-modal"},OI=["innerHTML"],HI={class:"dialog-footer"};function PI(e,t,a,l,s,i){const c=C("el-radio"),p=C("el-radio-group"),f=C("el-form-item"),_=C("el-col"),g=C("el-row"),y=C("el-input"),v=C("el-form"),b=C("el-button");return r(),h("div",RI,[n(v,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(g,{gutter:20},{default:d(()=>[n(_,{md:24,sm:24,xs:24},{default:d(()=>[n(f,{label:e.$t(""),required:""},{default:d(()=>[n(p,{modelValue:l.shippingType,"onUpdate:modelValue":t[0]||(t[0]=k=>l.shippingType=k)},{default:d(()=>[(r(!0),h(H,null,ae(l.availableOptions,(k,w)=>(r(),E(c,{label:k.value,key:w},{default:d(()=>[R(m(k.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:d(()=>[n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Name")},{default:d(()=>[n(y,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=k=>a.shipping.rate_name=k)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Price")},{default:d(()=>[n(y,{type:"number",min:1,modelValue:a.shipping.custom_price,"onUpdate:modelValue":t[2]||(t[2]=k=>a.shipping.custom_price=k),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,OI)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):B("",!0)]),_:1}),o("div",HI,[a.shipping.type?(r(),E(b,{key:0,type:"danger",onClick:l.removeShipping},{default:d(()=>[R(m(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):B("",!0),n(b,{type:"primary",onClick:l.updatingIsDone,disabled:l.isDisabledApplyButton()},{default:d(()=>[R(m(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const NI=lt(LI,[["render",PI]]),KI={name:"Shipping",components:{IconButton:Ze,DynamicIcon:J,ShippingModal:NI},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=Ge.get("currency_signs",{}),t=Ge.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:u,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?u("Shipping"):this.shipping.id!==0?u("Edit Shipping"):u("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(s){return s.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})}),ue.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"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.shippingModalIsOpen=!1})},getShippingMethodsNotFoundMessage(){const e=this.$router.resolve({name:"shipping"}).href;return u("No shipping methods found. You can add shipping methods from %1$s here %2$s",`<a href="${e}" target="_blank" class="link-text">`,"</a>")}}},GI={key:1},jI={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},zI={key:0},qI={key:1,class:"max-w-[120px] block ml-auto text-right"},YI={key:2},WI={key:0},JI={key:0,class:"fct-shipping-methods-list-wrap"},XI={key:0,class:"charge"},ZI={key:1,class:"fct-other-shipping-methods-list-wrap"},e6={key:0,class:"charge"},t6={key:1,class:"fct-no-shipping-methods-found"},a6=["innerHTML"];function l6(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-input"),f=C("el-radio"),_=C("el-radio-group"),g=C("el-button"),y=C("el-dialog");return r(),h(H,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]=Ne(v=>i.showShippingModal(),["prevent"]))},[R(m(i.getShippingButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",GI,m(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),h("div",jI,m(i.shippingTitle),1)):B("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),h("span",zI,[o("del",null,m(e.formatNumberForOrder(a.order.shipping_total,a.order)),1),R(" "+m(i.translate("Free")),1)])):B("",!0),a.shouldEnableEditing&&!i.hasFreeShipping()?(r(),h("span",qI,[n(p,{modelValue:s.total_shipping,"onUpdate:modelValue":t[1]||(t[1]=v=>s.total_shipping=v),onChange:t[2]||(t[2]=v=>{a.order.shipping_total=v*100}),type:"number"},{prefix:d(()=>[R(m(i.currency),1)]),_:1},8,["modelValue"])])):(r(),h("span",YI,m(e.formatNumberForOrder(a.order.shipping_total-(a.order.tax_summary&&a.order.tax_summary.rcShippingAdjustment?a.order.tax_summary.rcShippingAdjustment:0),a.order)),1))])]),n(y,{"append-to-body":!0,width:"50%",modelValue:s.shippingModalIsOpen,"onUpdate:modelValue":t[6]||(t[6]=v=>s.shippingModalIsOpen=v),title:e.$t("Shipping and delivery options")},oa({default:d(()=>[s.shippingModalIsOpen?(r(),h("div",WI,[s.shippingMethods.length||s.otherShippingMethods.length?(r(),h(H,{key:0},[s.shippingMethods.length?(r(),h("div",JI,[o("h3",null,m(i.translate("Shipping Methods")),1),n(_,{modelValue:s.shipping.id,"onUpdate:modelValue":t[3]||(t[3]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(H,null,ae(s.shippingMethods,(v,b)=>(r(),E(f,{label:v.id,key:b},{default:d(()=>[R(m(v.title)+" ",1),v.shipping_charge?(r(),h("span",XI,m(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):B("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):B("",!0),s.otherShippingMethods.length?(r(),h("div",ZI,[o("h3",null,m(i.translate("Other Shipping Methods")),1),n(_,{modelValue:s.shipping.id,"onUpdate:modelValue":t[4]||(t[4]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(H,null,ae(s.otherShippingMethods,(v,b)=>(r(),E(f,{label:v.id,key:b},{default:d(()=>[R(m(v.title)+" ",1),v.shipping_charge?(r(),h("span",e6,m(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):B("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):B("",!0)],64)):(r(),h("div",t6,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,a6)]))])):B("",!0)]),_:2},[s.shippingMethods.length||s.otherShippingMethods.length?{name:"footer",fn:d(()=>[n(g,{onClick:t[5]||(t[5]=v=>s.shippingModalIsOpen=!1)},{default:d(()=>[R(m(i.translate("Cancel")),1)]),_:1}),n(g,{type:"primary",onClick:i.updateShipping},{default:d(()=>[R(m(i.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const $d=lt(KI,[["render",l6]]),s6={key:0},n6={class:"fct-admin-sidebar-item"},o6={class:"fct-admin-summary-item-list"},i6={class:"fct-admin-summary-item"},r6={class:"font-medium"},d6={key:0,class:"fct-admin-summary-item"},u6={class:"font-medium"},c6={key:1,class:"fct-admin-summary-item"},A6={class:"font-medium"},p6={key:2,class:"fct-admin-summary-item"},f6={class:"font-medium"},m6={key:3,class:"fct-admin-summary-item"},h6={class:"font-medium"},_6={key:4,class:"fct-admin-summary-item"},v6={class:"font-medium"},g6={key:5,class:"fct-admin-summary-item"},y6={class:"font-medium"},b6={class:"font-medium"},w6={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:u("Google Click ID (gclid)"),gbraid:u("Google iOS Web Click ID (gbraid)"),wbraid:u("Google iOS App Click ID (wbraid)"),gad_campaignid:u("Google Ads Campaign ID"),gad_source:u("Google Ads Source"),msclkid:u("Microsoft Click ID (msclkid)"),fbclid:u("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]}))}}},Lp=Object.assign(w6,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",s6,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",n6,[o("ul",o6,[o("li",i6,[o("span",r6,m(t.$t("UTM Campaign")),1),o("span",null,m(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",d6,[o("span",u6,m(t.$t("UTM Medium")),1),o("span",null,m(e.order_operation.utm_medium||"--"),1)])):B("",!0),e.order_operation.utm_source?(r(),h("li",c6,[o("span",A6,m(t.$t("UTM Source")),1),o("span",null,m(e.order_operation.utm_source||"--"),1)])):B("",!0),e.order_operation.utm_content?(r(),h("li",p6,[o("span",f6,m(t.$t("UTM Content")),1),o("span",null,m(e.order_operation.utm_content||"--"),1)])):B("",!0),e.order_operation.utm_id?(r(),h("li",m6,[o("span",h6,m(t.$t("UTM ID")),1),o("span",null,m(e.order_operation.utm_id||"--"),1)])):B("",!0),e.order_operation.utm_term?(r(),h("li",_6,[o("span",v6,m(t.$t("UTM Term")),1),o("span",null,m(e.order_operation.utm_term||"--"),1)])):B("",!0),e.order_operation.refer_url?(r(),h("li",g6,[o("span",y6,m(t.$t("Refer Url")),1),o("span",null,m(e.order_operation.refer_url||"--"),1)])):B("",!0),(r(!0),h(H,null,ae(t.metaItems,l=>(r(),h("li",{key:l.key,class:"fct-admin-summary-item"},[o("span",b6,m(l.label),1),o("span",null,m(l.value),1)]))),128))])])]),_:1})]),_:1})])):B("",!0)}}),C6={name:"TaxBreakdownBox",components:{InfoFilled:al},props:{taxSummary:{type:Object,required:!0},order:{type:Object,required:!0},taxBreakdownShouldShow:{type:Boolean,default:!1}},methods:{translate:u,formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)}}},k6={class:"fct-tax-sum-box"},B6={class:"fct-tax-sum-row fct-tax-breakdown-heading"},x6={class:"fct-tax-sum-row fct-tax-breakdown-col-headers"},S6={class:"fct-tax-breakdown-col-rate"},F6={class:"fct-tax-breakdown-col-base"},$6={class:"fct-tax-breakdown-col-tax"},E6={class:"fct-tax-breakdown-col-rate"},U6={class:"fct-tax-breakdown-col-base"},I6={class:"fct-tax-breakdown-col-tax"},Q6={key:0,class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider fct-tax-sum-row--reversed"},D6={key:0},V6={key:1},T6={class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider"},M6={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},L6={key:1,class:"fct-tax-sum-row fct-tax-sum-row--divider"},R6={key:1,class:"fct-tax-sum-row fct-tax-sum-row--muted"},O6={key:2,class:"fct-tax-sum-row"},H6={key:5,class:"fct-tax-sum-row total-pay total-payable-tax-row"},P6={key:6,class:"fct-tax-sum-row fct-tax-sum-row--muted"},N6={key:2,class:"fct-tax-sum-row"},K6={class:"fct-tax-amount fct-tax-amount--reversed"},G6={key:3,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},j6={key:4,class:"fct-tax-sum-row fct-tax-sum-row--reversed"};function z6(e,t,a,l,s,i){const c=C("InfoFilled"),p=C("el-icon");return r(),h("div",k6,[a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length?(r(),h(H,{key:0},[o("div",B6,[o("span",null,m(i.translate("Tax breakdown by rate")),1),n(p,{class:"fct-tax-breakdown-info"},{default:d(()=>[n(c)]),_:1})]),o("div",x6,[o("span",S6,m(i.translate("Rate")),1),o("span",F6,m(i.translate("Taxable base")),1),o("span",$6,m(i.translate("Tax")),1)]),(r(!0),h(H,null,ae(a.taxSummary.foldedRateLines,(f,_)=>(r(),h("div",{key:"folded-rate-"+_,class:de(["fct-tax-sum-row fct-tax-breakdown-row",{"fct-tax-sum-row--muted":f.inclusive}])},[o("span",E6,m(f.label),1),o("span",U6,m(i.formatNumber(f.base)),1),o("span",I6,m(i.formatNumber(f.tax)),1)],2))),128)),a.order.is_reverse_charge_tax_order?(r(),h("div",Q6,[o("span",null,m(i.translate("VAT reversed")),1),a.taxSummary.reversedTaxTotal>0?(r(),h("span",D6,m(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)):(r(),h("span",V6,m(i.translate("Charge reversed")),1))])):(r(),h(H,{key:1},[o("div",T6,[o("span",null,m(i.translate("Total tax")),1),o("span",null,m(i.formatNumber(a.taxSummary.totalOrderTax)),1)]),a.taxSummary.includedInPrices>0?(r(),h("div",M6,[o("span",null,m(i.translate("of which included in prices")),1),o("span",null,m(i.formatNumber(a.taxSummary.includedInPrices)),1)])):B("",!0),a.taxSummary.payableTax>0&&a.taxSummary.includedInPrices>0?(r(),h("div",L6,[o("span",null,m(i.translate("Payable now (added)")),1),o("span",null,m(i.formatNumber(a.taxSummary.payableTax)),1)])):B("",!0)],64))],64)):a.order.is_reverse_charge_tax_order?B("",!0):(r(),h(H,{key:1},[a.taxSummary.taxRateLines.length&&a.taxBreakdownShouldShow?(r(!0),h(H,{key:0},ae(a.taxSummary.taxRateLines,f=>(r(),h("div",{key:"tax-rate-line-"+f.rate_id+"-"+f.label,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":f.inclusive}])},[o("span",null,m(f.label),1),o("span",null,m(i.formatNumber(f.order_tax)),1)],2))),128)):B("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.inclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",R6,[o("span",null,m(i.translate("Included in item prices")),1),o("span",null,m(i.formatNumber(a.taxSummary.inclusiveTax)),1)])):B("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.exclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",O6,[o("span",null,m(i.translate("Added on products")),1),o("span",null,m(i.formatNumber(a.taxSummary.exclusiveTax)),1)])):B("",!0),a.taxSummary.feeTaxLineRows&&a.taxSummary.feeTaxLineRows.length&&a.taxBreakdownShouldShow?(r(!0),h(H,{key:3},ae(a.taxSummary.feeTaxLineRows,(f,_)=>(r(),h("div",{key:_,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":f.inclusive}])},[o("span",null,m(f.display_label),1),o("span",null,m(i.formatNumber(f.tax_amount)),1)],2))),128)):B("",!0),a.taxSummary.shippingTax>0&&a.taxBreakdownShouldShow?(r(),h(H,{key:4},[a.taxSummary.shippingTaxLines&&a.taxSummary.shippingTaxLines.length?(r(!0),h(H,{key:0},ae(a.taxSummary.shippingTaxLines,f=>(r(),h("div",{key:f.label,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,m(f.label),1),o("span",null,m(i.formatNumber(f.shipping_tax)),1)],2))),128)):(r(),h("div",{key:1,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,m(a.taxSummary.isShippingInclusive?i.translate("Included in shipping prices"):i.translate("Added on shipping")),1),o("span",null,m(i.formatNumber(a.taxSummary.shippingTax)),1)],2))],64)):B("",!0),a.taxSummary.payableTax>0?(r(),h("div",H6,[o("span",null,m(i.translate("Total payable tax")),1),o("span",null,m(i.formatNumber(a.taxSummary.payableTax)),1)])):B("",!0),a.taxSummary.inclusiveTax>0||a.taxSummary.inclusiveFeeTax>0?(r(),h("div",P6,[o("span",null,m(i.translate("Total tax in this order")),1),o("span",null,m(i.formatNumber(a.taxSummary.totalOrderTax)),1)])):B("",!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",N6,[o("span",null,m(i.translate("Added on shipping")),1),o("span",K6,m(i.formatNumber(a.taxSummary.reversedShippingTax)),1)])):B("",!0),a.order.is_reverse_charge_tax_order&&a.taxSummary.reversedTaxTotal>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),h("div",G6,[o("span",null,m(i.translate("Tax reversed")),1),o("span",null,m(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)])):B("",!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",j6,[o("span",null,m(i.translate("VAT reversed")),1),o("span",null,m(i.translate("Charge reversed")),1)])):B("",!0)])}const Hr=lt(C6,[["render",z6]]),q6={name:"Transaction",components:{ConvertedTime:Na,Badge:ma,DynamicIcon:J},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 ca}},methods:{translate:u,getCardBrand:Jc,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)||u("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},Y6={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},W6={class:"fct-table-mobile-header"},J6={class:"fct-table-mobile-header-left"},X6={class:"fct-table-status-col"},Z6={class:"fct-table-date-col"},e9={class:"id"},t9={class:"fct-table-price-col"},a9={class:"fct-table-mobile-body"},l9={class:"fct-table-mobile-body-list"},s9={class:"fct-table-mobile-method-col"},n9={class:"label"},o9={class:"value"},i9={class:"flex items-center gap-2.5"},r9={key:0,class:"w-7"},d9=["title","src","alt"],u9={key:1,class:"capitalize"},c9={key:2},A9={class:"fct-table-mobile-gateway-col"},p9={class:"label"},f9={class:"value"},m9={key:0},h9=["href"];function _9(e,t,a,l,s,i){const c=C("Badge"),p=C("el-tooltip"),f=C("ConvertedTime"),_=C("DynamicIcon"),g=C("el-button");return r(),h("div",Y6,[(r(!0),h(H,null,ae(a.transactions,(y,v)=>{var b,k,w;return r(),h("div",{class:"fct-table-mobile-row",key:v},[o("div",W6,[o("div",J6,[o("div",X6,[(b=y==null?void 0:y.meta)!=null&&b.reason?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate((k=y==null?void 0:y.meta)==null?void 0:k.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var S,$;return[((S=y==null?void 0:y.meta)==null?void 0:S.disputed)==="yes"&&(($=y==null?void 0:y.meta)==null?void 0:$.dispute_resolved)==="no"?(r(),E(c,{key:0,status:y.status},{default:d(()=>[R(m(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"])):(r(),E(c,{key:1,status:y.status},{default:d(()=>[R(m(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(c,{key:1,status:y.status},{default:d(()=>[R(m(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]),o("div",Z6,[o("span",e9,"#"+m(y.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),n(f,{"date-time":((w=y==null?void 0:y.meta)==null?void 0:w.settled_at)||y.created_at},null,8,["date-time"])])]),o("div",t9,m(e.formatNumberForOrder(y.total,a.orderCurrency)),1),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:d(()=>[n(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",y.payment_method),loading:s.syncing_transaction===y.id,onClick:S=>i.syncTransaction(y)},{default:d(()=>[n(_,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):B("",!0)]),o("div",a9,[o("ul",l9,[o("li",s9,[o("div",n9,m(i.translate("Payment Method:")),1),o("div",o9,[o("div",i9,[i.getCardBrand(y.card_brand,y.payment_method_type)?(r(),h("div",r9,[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,d9)])):(r(),h("span",u9,m(y.payment_method_type),1)),y.card_last_4&&y.card_last_4!="0"?(r(),h("span",c9,m("..."+y.card_last_4),1)):B("",!0)])])]),o("li",A9,[o("div",p9,m(i.translate("Gateway ID:")),1),o("div",f9,[y.vendor_charge_id===""?(r(),h("span",m9,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:y.url},m(y.vendor_charge_id),9,h9))])])])])])}),128))])}const Rp=lt(q6,[["render",_9]]),v9={key:1,class:"fct-single-order-page"},g9={key:1,class:"fct-single-order-wrapper fct-layout-width"},y9={class:"single-page-header flex items-start justify-between"},b9={class:"single-page-header-title-wrap"},w9={key:1},C9={key:2},k9={class:"single-page-header-status-wrap"},B9={class:"single-page-header-text"},x9={class:"capitalize"},S9={class:"fct-btn-group sm"},F9={class:"single-page-body"},$9={class:"fct-single-order"},E9={class:"fct-single-order-main"},U9={class:"fct-card-header-title is-small"},I9={key:0,class:"fct-browse-product-form-group pb-5"},Q9={class:"fct-ordered-product-list-container"},D9={key:0,class:"fct-ordered-product-list-wrapper"},V9={class:"fct-media-content-list -mt-4 w-full"},T9={class:"align-top"},M9=["rowspan"],L9={class:"product-thumbnail w-[46px] flex-shrink-0"},R9=["href"],O9=["src","alt"],H9=["src","alt"],P9={class:""},N9={class:"product-details-content-row"},K9={class:"product-details-content-first flex flex-col"},G9={class:"product-title m-0"},j9=["href"],z9={key:0,class:"product-variation-title m-0"},q9={key:2,class:"product-subscription-info"},Y9=["innerHTML"],W9=["innerHTML"],J9={key:0,class:"product-details-quantity"},X9={key:1,class:"product-details-price-mobile"},Z9={class:"product-details-quantity"},eQ={key:0,class:"del"},tQ={class:"product-details-price-mobile"},aQ={key:0,class:"del"},lQ={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},sQ={key:0,class:"del"},nQ={class:"fct-order-item-qty-col text-right whitespace-nowrap"},oQ={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},iQ={class:"product-details-quantity"},rQ={key:0,class:"del"},dQ={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},uQ={class:"fct-order-item-price-col text-right whitespace-nowrap"},cQ={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},AQ={key:0,class:"flex items-center"},pQ={class:"del line-through text-xs font-normal opacity-60 leading-tight"},fQ={colspan:"2",class:""},mQ={class:"fct-tax-badge"},hQ={class:"text-right"},_Q={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},vQ={class:"pb-2"},gQ={key:1},yQ={colspan:"2",class:""},bQ={class:"text-xs text-system-mid dark:text-gray-300"},wQ={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},CQ={colspan:"2",class:"pb-2"},kQ={class:"fct-tax-badge"},BQ={class:"text-right pb-2"},xQ={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},SQ={class:"pb-2"},FQ={key:3},$Q={colspan:"3"},EQ={class:"product-details-action-row"},UQ=["onClick"],IQ=["onClick"],QQ={key:1,class:"m-0 text-center"},DQ={class:"fct-card-header-title is-small"},VQ={class:"fct-table-border fct-table-order-details"},TQ={key:0},MQ={key:3},LQ={key:4},RQ={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},OQ={key:5},HQ={colspan:"3",class:"fct-tax-summary-cell"},PQ={key:0,class:"fct-tax-simple-line",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},NQ={style:{display:"flex","align-items":"center",gap:"6px"}},KQ={href:"javascript:void(0)",class:"fct-tax-see-details"},GQ={class:"total-amount-tr"},jQ={class:"payment-tr"},zQ={key:6,class:"payment-tr"},qQ={key:7,class:"payment-tr"},YQ={class:"font-semibold"},WQ={key:8,class:"payment-tr"},JQ={class:"font-semibold"},XQ={key:9,class:"payment-tr total-refund-owed-tr"},ZQ={class:"flex flex-end m-0 items-center"},eD={class:"font-semibold"},tD={class:"fct-single-order-aside"},aD={class:"fct-admin-sidebar"},lD={key:0},sD={class:"fct-adjust-quantity-modal-content"},nD={class:"title"},oD={class:"fct-form-group"},iD={class:"dialog-footer"},rD={key:0},dD={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:xd,Alert:Xa,Transaction:Sd,Plans:Vp,Badge:ma,Refresh:Hc,ElMessageBox:xl,CopyToClipboard:Ia,Notes:Bi,Coupon:xi,CustomDiscount:Si,OrderCustomerInformation:ii,ShippingComponent:$d,UtmDetails:Lp,TaxBreakdownBox:Hr,OrderUpDownIndicator:jc,TransactionMobile:Rp,BundleProducts:Io,Promotion:Td},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`${Ge.get("asset_url")}images/empty-image.svg`},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(){xl.confirm(u("Are you sure you want to send a payment reminder email for this order?"),u("Send Payment Reminder"),{type:"info",icon:Qc(Td),cancelButtonText:u("Cancel"),confirmButtonText:u("Send Now"),beforeClose:async(e,t,a)=>{var l;if(e==="confirm")try{t.confirmButtonLoading=!0,this.sendingPaymentReminder=!0;const s=await this.$post("email-notification/send-manual-reminder",{event:"renewal_reminder_overdue",entity_id:this.order.id});z.success(s.message||u("Payment reminder sent successfully"))}catch(s){z.error(((l=s.data)==null?void 0:l.message)||u("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 e;return this.formatNumber(this.order.total_paid-((e=this.order)==null?void 0:e.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,ue.post("orders/"+this.order_id+"/mark-as-paid",{...this.otherData,transaction_type:this.transactionType}).then(e=>{this.markingOrderAsPaid=!1,this.transactionMedium=!1,z.success(e.message),this.fetch()}).catch(e=>{var t;this.markingOrderAsPaid=!1,e.status_code=="422"?z.validationErrors(e):z.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,s,i,c;const t=(l=e==null?void 0:e.variants)==null?void 0:l.media;if(t&&Array.isArray(t.meta_value)&&((s=t.meta_value[0])!=null&&s.url))return t.meta_value[0].url;const a=(c=(i=e==null?void 0:e.variants)==null?void 0:i.product_detail)==null?void 0:c.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=Ge.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?z.error(u("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():Fd(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};ue.post("orders/"+this.order_id,t).then(l=>{z.success(l.message),this.fetch()}).catch(l=>{var s;l.status_code=="422"?z.validationErrors(l):z.error((s=l.data)==null?void 0:s.message)}).finally(()=>{this.loading=!1})},fetch(){this.notFound.show=!1,this.loading=!0,ue.get("orders/"+this.order_id,{with:["widgets"]}).then(e=>{var t,a,l,s,i;this.coupons=e.order.applied_coupons||[],this.hasCoupon=this.coupons.length>0,this.appliedCoupons=this.coupons.map(c=>c.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=u("Order cannot be edited once it is %s",this.order.status)),this.order.payment_status==="paid"&&(this.warningMessage=u("Order cannot be edited once paid.")),this.isSubscription&&(this.warningMessage=u("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=((s=e.discount_meta)==null?void 0:s.reason)||"",this.discount.type=((i=e.discount_meta)==null?void 0:i.type)||"amount",this.selectedLabels=e.selected_labels||[],this.uniqueItemsCount=km(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}),Tp(this.discount),this.order.order_items.find(c=>c.payment_type==="subscription"),this.order.order_items=this.order.order_items.map(c=>{var p;return{...c,quantity:Number(c.quantity),updated_stock:parseInt((c==null?void 0:c.available)||((p=c==null?void 0:c.variants)==null?void 0:p.available))+parseInt(c.quantity)}}),this.resetUnsaved(),this.renderActionables(),this.disableItemEditing(),ke(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(z.error(it.get(e,"data.message")||u("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?z.validationErrors(e):z.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 window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},clearActivityAction(e){ue.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"?z.validationErrors(t):z.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})}),ue.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:im,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 s=Math.abs(a*t-l);return s>0&&s<=t},formatTaxRateBadge(e){return(e.label||u("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},(Ge.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)}},uD=Object.assign(dD,{setup(e){const t=M(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(s,i)=>{var I,O;const c=C("el-breadcrumb-item"),p=C("el-tooltip"),f=C("el-breadcrumb"),_=C("el-button"),g=C("el-input"),y=C("router-link"),v=C("el-icon"),b=C("el-popover"),k=C("el-dropdown-item"),w=C("el-dropdown-menu"),S=C("el-dropdown"),$=C("el-option"),V=C("el-select"),F=C("el-form-item"),x=C("el-form"),Q=C("el-dialog"),D=C("el-skeleton-item"),T=C("el-skeleton"),U=Ma("loading");return r(),h(H,null,[s.notFound.show?(r(),E(ri,{key:0,"button-text":s.notFound.buttonText,message:s.notFound.message,route:s.notFound.route},null,8,["button-text","message","route"])):B("",!0),s.notFound.show===!1?(r(),h("div",v9,[n(rn,{isActive:s.changes_made>=1&&!s.showRefundModal?"is-active":"",onDiscard:s.reloadOrder,onSave:s.update,loading:s.loading,saveButtonText:A(u)("Update")},null,8,["isActive","onDiscard","onSave","loading","saveButtonText"]),s.loading?(r(),E(C5,{key:0})):B("",!0),s.order?(r(),h("div",g9,[!s.loading&&s.order?(r(),h(H,{key:0},[o("div",y9,[o("div",null,[o("div",b9,[n(f,{"separator-icon":A(dl)},{default:d(()=>[n(c,{to:{name:"orders"}},{default:d(()=>[R(m(A(u)("Orders")),1)]),_:1}),s.parentOrderId?(r(),E(c,{key:0,to:{name:"view_order",params:{}}},{default:d(()=>[o("a",{onClick:i[0]||(i[0]=L=>s.getOrderUrl(s.parentOrderId))}," #"+m(s.parentOrderId),1)]),_:1})):B("",!0),n(c,null,{default:d(()=>[s.isOrderUuidTruncated?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-tooltip-long",content:s.orderUuid},{default:d(()=>[o("span",null,"#"+m(s.orderUuidDisplay),1)]),_:1},8,["content"])):s.orderUuid?(r(),h("span",w9,"#"+m(s.orderUuidDisplay),1)):(r(),h("span",C9,"#"+m(A(ta)(e.order_id)),1))]),_:1})]),_:1},8,["separator-icon"]),o("div",k9,[n(ma,{status:s.order.status},null,8,["status"]),s.order.is_b2b_order?(r(),E(ma,{key:0,type:"blue",text:A(u)("B2B")},null,8,["text"])):B("",!0),n(jc,{order:s.order},null,8,["order"])])]),o("div",B9,[n(Na,{"date-time":s.order.created_at,"with-time":""},null,8,["date-time"]),i[21]||(i[21]=o("span",{class:"fct_separator"},null,-1)),s.order.invoice_no?(r(),h(H,{key:0},[o("span",null,m(s.order.invoice_no),1),i[20]||(i[20]=o("span",{class:"fct_separator"},null,-1))],64)):B("",!0),o("span",x9,m(s.order.type),1)])]),o("div",S9,[s.shouldShowRefund()?(r(),E(_,{key:0,onClick:i[1]||(i[1]=L=>s.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:d(()=>[R(m(A(u)("Refund")),1)]),_:1})):B("",!0),s.isEditingItem?(r(),E(_,{key:2,onClick:s.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[R(m(A(u)("Disable Editing")),1)]),_:1},8,["onClick"])):(r(),E(_,{key:1,onClick:s.enableItemEditing,disabled:s.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[s.shouldDisableEditing?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[R(m(s.warningMessage),1)]),default:d(()=>[R(" "+m(A(u)("Edit")),1)]),_:1})):(r(),h(H,{key:1},[R(m(A(u)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),n(xd,{onReload:i[2]||(i[2]=L=>s.reloadOrder()),onAddItem:a,onAddProduct:s.addProduct,onEnableItemEditing:s.enableItemEditing,onDisableItemEditing:s.disableItemEditing,onHandlePaymentActions:s.handlePaymentActions,"is-editing-item":s.isEditingItem,order:s.order,triggerMode:s.isMobile?"":"button",shouldShowRefund:s.shouldShowRefund(),warningMessage:s.warningMessage},null,8,["onAddProduct","onEnableItemEditing","onDisableItemEditing","onHandlePaymentActions","is-editing-item","order","triggerMode","shouldShowRefund","warningMessage"])])]),o("div",F9,[(r(!0),h(H,null,ae(s.actionableActivities,L=>(r(),E(Xa,{class:"mb-5",type:"error",key:L.id,content:L==null?void 0:L.content,closable:"",onClose:P=>s.clearActivityAction(L)},null,8,["content","onClose"]))),128)),o("div",$9,[o("div",E9,[n(Be,{class:"overflow-hidden fct-order-items-card"},{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>{var L,P;return[o("h2",U9,[R(m(A(u)("Order items"))+" ",1),((L=s.order)==null?void 0:L.fulfillment_type)==="physical"?(r(),E(ma,{key:0,status:(P=s.order)==null?void 0:P.shipping_status},{default:d(()=>{var q;return[R(m((q=s.order)==null?void 0:q.shipping_status),1)]}),_:1},8,["status"])):B("",!0)])]}),_:1}),n(Ce,null,{default:d(()=>[s.isEditingItem?(r(),h("div",I9,[n(g,{placeholder:A(u)("Search products..."),onKeyup:i[3]||(i[3]=L=>a()),modelValue:s.searchQuery,"onUpdate:modelValue":i[4]||(i[4]=L=>s.searchQuery=L)},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(_,{onClick:l,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(m(A(u)("Browse")),1)]),_:1})])):B("",!0),o("div",Q9,[s.order.order_items.length>0?(r(),h("div",D9,[o("table",V9,[o("tbody",null,[(r(!0),h(H,null,ae(s.order.order_items,(L,P)=>{var q,X,G,te,ne,re,K,Y,W,j,ie,he,me,ye;return r(),h(H,{key:P},[L.payment_type!=="signup_fee"&&L.payment_type!=="fee"&&((q=L==null?void 0:L.other_info)==null?void 0:q.item_status)!=="adjusted"&&s.shouldSkipAdjustmentItem(L)?(r(),h(H,{key:0},[o("tr",T9,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(L)},[o("div",L9,[L!=null&&L.is_custom?(r(),h("a",{key:0,href:(X=L==null?void 0:L.other_info)==null?void 0:X.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[o("img",{src:L.featured_media!=null?L.featured_media:s.getImageUrl(L),alt:L.title,class:de([s.getClass(L),"h-full object-contain rounded"])},null,10,O9)],8,R9)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:L==null?void 0:L.post_id}}},{default:d(()=>[o("img",{src:L.featured_media!=null?L.featured_media:s.getImageUrl(L),alt:L.title,class:de([s.getClass(L),"h-full object-contain rounded"])},null,10,H9)]),_:2},1032,["to"]))])],8,M9),o("td",P9,[o("div",N9,[o("div",K9,[o("div",G9,[L!=null&&L.is_custom?(r(),h("a",{key:0,href:(G=L==null?void 0:L.other_info)==null?void 0:G.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},m(L==null?void 0:L.post_title),9,j9)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:L==null?void 0:L.post_id}}},{default:d(()=>[R(m(L==null?void 0:L.post_title),1)]),_:2},1032,["to"]))]),(L!=null&&L.variation_display_title||L!=null&&L.title)&&(L==null?void 0:L.title)!==(L==null?void 0:L.post_title)?(r(),h("div",z9," – "+m((L==null?void 0:L.variation_display_title)||(L==null?void 0:L.title)),1)):B("",!0),L.bundle_items.length>0?(r(),E(Io,{key:1,product:L},null,8,["product"])):B("",!0),(L==null?void 0:L.payment_type)==="subscription"?(r(),h("div",q9,[o("div",{innerHTML:L==null?void 0:L.payment_info},null,8,Y9),((te=L==null?void 0:L.other_info)==null?void 0:te.manage_setup_fee)==="yes"?(r(),h("div",{key:0,innerHTML:L==null?void 0:L.setup_info},null,8,W9)):B("",!0)])):B("",!0)]),s.isEditingItem?(r(),h("div",J9,[o("span",null,m(s.formatNumber(L.unit_price)),1),i[22]||(i[22]=o("span",null,"x",-1)),o("span",null,m(A(ta)(L.quantity)),1)])):B("",!0),s.isEditingItem?B("",!0):(r(),h("div",X9,[o("div",Z9,[((ne=L==null?void 0:L.variants)==null?void 0:ne.length)>0?(r(),h("span",eQ,m(s.formatNumber(L.variants.compare_price)),1)):B("",!0),o("span",null,m(s.formatNumber(L.unit_price)),1),i[23]||(i[23]=o("span",null,"x",-1)),o("span",null,m(A(ta)(L.quantity)),1)])])),L.bundle_items.length>0?(r(),E(Io,{key:2,product:L},null,8,["product"])):B("",!0)]),o("div",tQ,[((re=L==null?void 0:L.variants)==null?void 0:re.length)>0?(r(),h("span",aQ,m(s.formatNumber(L.variants.compare_price)),1)):B("",!0),L.line_meta&&L.line_meta.original_unit_price?(r(),h("span",lQ,m(s.formatNumber(L.line_meta.original_unit_price)),1)):B("",!0),o("span",null,m(s.formatNumber(L.unit_price)),1),i[25]||(i[25]=o("span",null,"×",-1)),o("span",null,m(A(ta)(L.quantity)),1),((K=L==null?void 0:L.other_info)==null?void 0:K.item_status)!=="adjusted"?(r(),h(H,{key:2},[i[24]||(i[24]=o("span",{class:"text-system-mid"},"·",-1)),L.coupon_discount>0?(r(),h("span",sQ,m(s.formatNumber(L.subtotal)),1)):B("",!0),o("span",null,m(s.formatNumber(s.getItemDisplayLineTotal(L))),1)],64)):B("",!0)])]),o("td",nQ,[s.isEditingItem?B("",!0):(r(),h("div",oQ,[o("div",iQ,[((Y=L==null?void 0:L.variants)==null?void 0:Y.length)>0?(r(),h("span",rQ,m(s.formatNumber(L.variants.compare_price)),1)):B("",!0),L.line_meta&&L.line_meta.original_unit_price?(r(),h("span",dQ,m(s.formatNumber(L.line_meta.original_unit_price)),1)):B("",!0),o("span",null,m(s.formatNumber(L.unit_price)),1),i[26]||(i[26]=o("span",null,"x",-1)),o("span",null,m(A(ta)(L.quantity)),1),s.shouldShowUnitPriceRoundingTooltip(L)?(r(),E(p,{key:2,effect:"dark",content:A(u)("Unit price is rounded for display. The line total is calculated at full precision."),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(v,{class:"fct-unit-price-rounding-icon"},{default:d(()=>[n(A(al))]),_:1})]),_:1},8,["content"])):B("",!0)])]))]),o("td",uQ,[o("div",cQ,[((W=L==null?void 0:L.other_info)==null?void 0:W.item_status)!=="adjusted"?(r(),h(H,{key:0},[L.coupon_discount>0?(r(),h("div",AQ,[o("span",pQ,m(s.formatNumber(L.subtotal)),1)])):B("",!0),o("span",null,m(s.formatNumber(s.getItemDisplayLineTotal(L))),1)],64)):B("",!0)])])]),s.taxSummary.displayMode!=="simplified"?(r(),h(H,{key:0},[s.getItemTaxRates(L).length?(r(!0),h(H,{key:0},ae(s.getItemTaxRates(L),(se,fe)=>{var $e,tt,ve;return r(),h("tr",{key:"tax-rate-"+fe,class:de(L.line_meta&&L.line_meta.tax_config&&L.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[o("td",fQ,[o("span",mQ,m(s.formatTaxRateBadge(se)),1)]),o("td",hQ,[o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!((tt=($e=L.line_meta)==null?void 0:$e.tax_config)!=null&&tt.inclusive)||((ve=s.orderSettings)==null?void 0:ve.reverse_charge_price_mode)==="dynamic")}])},[L.line_meta&&L.line_meta.tax_config&&L.line_meta.tax_config.inclusive?(r(),h(H,{key:0},[R(m(A(u)("incl.")),1)],64)):(r(),h(H,{key:1},[R("+")],64)),R(" "+m(s.formatNumber(se.tax_amount)),1)],2)])],2)}),128)):L.tax_amount>0?(r(),h("tr",_Q,[o("td",vQ,m(A(u)("Tax"))+": "+m(s.formatNumber(L.tax_amount)),1)])):B("",!0)],64)):B("",!0),((j=L==null?void 0:L.other_info)==null?void 0:j.manage_setup_fee)==="yes"?(r(),h("tr",gQ,[o("td",yQ,[o("span",bQ,m(L==null?void 0:L.other_info.signup_fee_name),1)]),o("td",wQ," + "+m(s.formatNumber(((ie=L==null?void 0:L.other_info)==null?void 0:ie.setup_fee_per_item)==="yes"?L.other_info.signup_fee*L.quantity:L.other_info.signup_fee)),1)])):B("",!0),s.taxSummary.displayMode!=="simplified"?(r(),h(H,{key:2},[s.getSubscriptionSetupFeeTaxRates(L).length?(r(!0),h(H,{key:0},ae(s.getSubscriptionSetupFeeTaxRates(L),(se,fe)=>{var $e;return r(),h("tr",{key:"setup-tax-rate-"+fe,class:de(s.isSubscriptionSetupFeeInclusive(L)?"is-inclusive":"is-exclusive")},[o("td",CQ,[o("span",kQ,m(A(u)("Setup fee"))+": "+m(s.formatTaxRateBadge(se)),1)]),o("td",BQ,[o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(L)||(($e=s.orderSettings)==null?void 0:$e.reverse_charge_price_mode)==="dynamic")}])},[s.isSubscriptionSetupFeeInclusive(L)?(r(),h(H,{key:0},[R(m(A(u)("incl.")),1)],64)):B("",!0),R(m(s.formatNumber(se.tax_amount)),1)],2)])],2)}),128)):((he=L==null?void 0:L.other_info)==null?void 0:he.signup_fee_tax)>0&&((me=L==null?void 0:L.other_info)==null?void 0:me.manage_setup_fee)==="yes"?(r(),h("tr",xQ,[o("td",SQ,[R(m(A(u)("Setup fee tax"))+": ",1),o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(L)||((ye=s.orderSettings)==null?void 0:ye.reverse_charge_price_mode)==="dynamic")}])},m(s.formatNumber(L.other_info.signup_fee_tax)),3)])])):B("",!0)],64)):B("",!0),s.isEditingItem?(r(),h("tr",FQ,[o("td",$Q,[o("div",EQ,[o("a",{href:"#",onClick:Ne(se=>s.handleAdjustQuantityModal(L),["prevent"])},m(A(u)("Adjust Quantity")),9,UQ),o("a",{href:"#",onClick:Ne(se=>s.deleteProduct(P,L),["prevent"])},m(A(u)("Remove Item")),9,IQ)])])])):B("",!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)):B("",!0)],64)}),128))])])])):B("",!0),s.order.order_items.length==0?(r(),h("p",QQ,m(A(u)("No items found.")),1)):B("",!0)])]),_:1})]),_:1}),n(Be,{class:"fct-order-payment-card"},{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h2",DQ,[o("span",null,m(A(u)("Payment")),1),n(ma,{status:s.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),n(Ce,null,{default:d(()=>{var L,P,q,X,G,te,ne;return[o("table",VQ,[o("tbody",null,[o("tr",null,[o("td",null,m(A(u)("Subtotal")),1),o("td",null,[s.order.order_items.length>0?(r(),h("span",TQ,m(A(ta)(s.uniqueItemsCount))+" "+m(A(Fo)("item","items",s.uniqueItemsCount)),1)):B("",!0)]),o("td",null,m(s.formatNumber(s.order.subtotal)),1)]),n($d,{order:s.order,shippingAttributes:s.shippingSettings,shouldEnableEditing:s.isEditingItem,"onUpdate:shipping":s.updateShipping,shippingMethodsProps:s.shippingMethods,otherShippingMethodsProps:s.otherShippingMethods},null,8,["order","shippingAttributes","shouldEnableEditing","onUpdate:shipping","shippingMethodsProps","otherShippingMethodsProps"]),s.order.fee_total>0?(r(!0),h(H,{key:0},ae(s.feeItems,re=>(r(),h("tr",{key:"fee-"+re.id},[o("td",null,m(re.title),1),i[28]||(i[28]=o("td",null,null,-1)),o("td",null,m(s.formatNumber(re.subtotal)),1)]))),128)):B("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(r(),E(xi,{key:1,order:s.order,couponsAttributes:s.coupons,hasCouponAttributes:s.hasCoupon,appliedCouponsAttributes:s.appliedCoupons,action:"edit_order",shouldManageCoupon:s.isEditingItem,"onUpdate:coupons":s.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","couponsAttributes","hasCouponAttributes","appliedCouponsAttributes","shouldManageCoupon","onUpdate:coupons"])):B("",!0),s.hasCoupon?B("",!0):(r(),E(Si,{key:2,order:s.order,discountAttributes:s.discount,hasCoupon:s.hasCoupon,shouldEnableEditing:s.isEditingItem,"onUpdate:customDiscount":s.updateCustomDiscount},null,8,["order","discountAttributes","hasCoupon","shouldEnableEditing","onUpdate:customDiscount"])),!s.hasCoupon&&s.order.coupon_discount_total>0?(r(),h("tr",MQ,[o("td",null,m(A(u)("Coupon Discount")),1),i[29]||(i[29]=o("td",null,null,-1)),o("td",null,"- "+m(s.formatNumber(s.order.coupon_discount_total)),1)])):B("",!0),s.isEditingItem?(r(),h("tr",LQ,[o("td",RQ,m(A(u)("Tax will be recalculated on save")),1)])):s.taxSummary.payableTax>0||s.taxSummary.inclusiveTax>0||s.taxSummary.inclusiveFeeTax>0||s.taxSummary.taxRateLines.length||s.taxSummary.shippingTax>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedTaxTotal>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedShippingTax>0?(r(),h("tr",OQ,[o("td",HQ,[s.taxSummary.displayMode==="simplified"&&s.taxSummary.simpleLine?(r(),h("div",PQ,[o("span",NQ,[o("span",null,m(s.taxSummary.simpleLine.label),1),s.taxSummary.simpleLine.hasDetails?(r(),E(b,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:d(()=>[o("a",KQ,m(A(u)("See details"))+" ▾",1)]),default:d(()=>[n(Hr,{"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"])]),_:1})):B("",!0)]),o("span",null,m(s.taxSummary.simpleLine.value),1)])):(r(),E(Hr,{key:1,"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"]))])])):B("",!0),o("tr",GQ,[o("td",null,m(A(u)("Total")),1),i[30]||(i[30]=o("td",null,null,-1)),o("td",null,m(s.formatNumber(s.order.total_amount-(s.taxSummary.rcTotalAdjustment||0))),1)]),o("tr",jQ,[o("td",null,m(A(u)("Total Paid")),1),i[31]||(i[31]=o("td",null,null,-1)),o("td",null,m(s.formatNumber((L=s.order)==null?void 0:L.total_paid)),1)]),((P=s.order)==null?void 0:P.total_refund)>0?(r(),h("tr",zQ,[o("td",null,m(A(u)("Total Refund")),1),i[32]||(i[32]=o("td",null,null,-1)),o("td",null,"- "+m(s.formatNumber((q=s.order)==null?void 0:q.total_refund)),1)])):B("",!0),s.order.total_paid-((X=s.order)==null?void 0:X.total_refund)!=0?(r(),h("tr",qQ,[o("td",null,m(A(u)("Net Payment")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",YQ,m(s.getNetPayment()),1)])):B("",!0),s.order.total_amount-((G=s.order)==null?void 0:G.total_paid)>0?(r(),h("tr",WQ,[o("td",null,m(A(u)("Total Due")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",JQ,m(s.getTotalDue()),1)])):B("",!0),s.order.total_amount-(((te=s.order)==null?void 0:te.total_paid)-((ne=s.order)==null?void 0:ne.total_refund))<0?(r(),h("tr",XQ,[o("td",null,[o("p",ZQ,[n(A(jf),{class:"w-6 text-amber-500 mr-2"}),R(" "+m(A(u)("Total Refund Owed")),1)])]),i[35]||(i[35]=o("td",null,null,-1)),o("td",eD,m(s.getDueRefund()),1)])):B("",!0)])])]}),_:1})]),_:1}),s.order.transactions&&s.order.transactions.length?(r(),E(Be,{key:0,class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Transaction Details"),border_bottom:"",title_size:"small"},{action:d(()=>{var L;return[s.order.total_amount-((L=s.order)==null?void 0:L.total_paid)>0&&s.order.status!=="canceled"&&s.markingOrderAsPaid===!1?(r(),E(S,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s.handleCommand},{dropdown:d(()=>[n(w,null,{default:d(()=>[n(k,{command:"custom-payment-link"},{default:d(()=>[R(m(A(u)("Custom Payment Link"))+" ",1),n(p,{effect:"dark",content:A(u)("Due amount is remaining, Get a custom payment link to send to the customer."),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(v,null,{default:d(()=>[n(A(al))]),_:1})]),_:1},8,["content"])]),_:1}),n(k,{command:"mark-order-paid"},{default:d(()=>[R(m(A(u)("Mark order as paid")),1)]),_:1}),s.canSendPaymentReminder?(r(),E(k,{key:0,command:"send-payment-reminder",disabled:s.sendingPaymentReminder},{default:d(()=>[R(m(A(u)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):B("",!0)]),_:1})]),default:d(()=>[n(_,{size:"small"},{default:d(()=>[R(m(A(u)("Collect Payments"))+" ",1),n(J,{name:"ChevronDown"})]),_:1}),n(J,{name:"More"})]),_:1},8,["onCommand"])):B("",!0)]}),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[n(Sd,{onReload:i[5]||(i[5]=L=>s.reloadOrder()),onTriggerRefundModal:s.triggerRefundModal,transactions:s.order.transactions,order_id:s.order.id,"order-currency":s.order.currency},null,8,["onTriggerRefundModal","transactions","order_id","order-currency"]),n(Rp,{onReload:i[6]||(i[6]=L=>s.reloadOrder()),transactions:s.order.transactions,order_id:s.order.id,"order-currency":s.order.currency},null,8,["transactions","order_id","order-currency"])]),_:1})]),_:1})):B("",!0),n(Q,{title:A(u)("Mark as paid"),modelValue:s.transactionMedium,"onUpdate:modelValue":i[10]||(i[10]=L=>s.transactionMedium=L)},{footer:d(()=>[qt((r(),E(_,{plan:"",type:"primary",onClick:s.markOrderAsPaid,disabled:s.markingOrderAsPaid},{default:d(()=>[R(m(A(u)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[U,s.markingOrderAsPaid]])]),default:d(()=>[o("div",null,[n(x,{"label-position":"top"},{default:d(()=>[n(F,{"label-position":"top",label:A(u)("Payment method")},{default:d(()=>[n(V,{modelValue:s.otherData.payment_method,"onUpdate:modelValue":i[7]||(i[7]=L=>s.otherData.payment_method=L)},{default:d(()=>[(r(!0),h(H,null,ae(s.paymentMethodOption,L=>(r(),E($,{key:L.value,label:L.name,value:L.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(F,{"label-position":"top",label:A(u)("Vendor charge id")},{default:d(()=>[n(g,{modelValue:s.otherData.vendor_charge_id,"onUpdate:modelValue":i[8]||(i[8]=L=>s.otherData.vendor_charge_id=L)},null,8,["modelValue"])]),_:1},8,["label"]),n(F,{"label-position":"top",label:A(u)("Notes")},{default:d(()=>[n(g,{rows:2,type:"textarea",placeholder:A(u)("Please enter the payment note..."),modelValue:s.otherData.mark_paid_note,"onUpdate:modelValue":i[9]||(i[9]=L=>s.otherData.mark_paid_note=L)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),s.order.licenses?(r(),E(Be,{key:1,class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Licenses"),title_size:"small"},null,8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[n(ad,{licenses:s.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):B("",!0),n(Be,{class:"overflow-hidden mb-0"},{default:d(()=>[n(Qe,{title:A(u)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(Yc,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",tD,[o("div",aD,[(r(!0),h(H,null,ae(s.order.subscriptions,(L,P)=>(r(),E(Q5,{key:L.id,subscription:L,order:s.order,index:P,getOrderUrl:s.getOrderUrl},null,8,["subscription","order","index","getOrderUrl"]))),128)),s.order.customer?(r(),E(ii,{key:0,order:s.order,shouldEnableEditing:!0,onOnOrderUpdated:s.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):B("",!0),n(Bi,{orderId:s.order.id,note:s.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),n(oi,{"bind-to-id":s.order.id,"bind-to-type":"Order",selectedLabels:s.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(I=s.order)!=null&&I.order_operation?(r(),E(Lp,{key:1,order_operation:(O=s.order)==null?void 0:O.order_operation},null,8,["order_operation"])):B("",!0)]),s.order?(r(),h("div",lD,[n(cn,{ref:"dynamicTemplates",filter:"single_order_page","widgets-query":{order_uuid:s.order.uuid,order_id:s.order.id},data:{order:s.order}},null,8,["widgets-query","data"])])):B("",!0)])]),n(Q,{modelValue:s.adjustQuantityModal,"onUpdate:modelValue":i[13]||(i[13]=L=>s.adjustQuantityModal=L),title:A(u)("Adjust Quantity"),width:"35%","align-center":"","append-to-body":!0,class:"fct-adjust-quantity-modal",onClose:i[14]||(i[14]=()=>{s.adjustQuantityModal=!1,s.adjustItem={},s.tmpAdjustedItem={}})},{footer:d(()=>[o("div",iD,[n(_,{onClick:i[11]||(i[11]=L=>s.adjustQuantityModal=!1),type:"info",soft:""},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(_,{type:"primary",onClick:i[12]||(i[12]=L=>s.saveAdjustedProductQuantity(s.tmpAdjustedItem))},{default:d(()=>[R(m(A(u)("Done")),1)]),_:1})])]),default:d(()=>[o("div",sD,[o("div",nD,[i[36]||(i[36]=R(" Adjust the quantity for ",-1)),o("strong",null,m(s.adjustItem.variation_display_title||s.adjustItem.title),1)]),o("div",oD,[o("label",null,m(A(u)("Quantity")),1),s.isEditingItem?(r(),E(Dp,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):B("",!0)])])]),_:1},8,["modelValue","title"]),n(Qp,{ref_key:"productItemModal",ref:t,order_id:e.order_id,searchQueryParent:s.searchQuery,orderParent:s.order,"onUpdate:searchQuery":s.updateSearchQuery},null,8,["order_id","searchQueryParent","orderParent","onUpdate:searchQuery"]),n(Q,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":i[15]||(i[15]=L=>s.createProductModal=L),title:A(u)("Add New Product")},{default:d(()=>[s.createProductModal?(r(),h("div",rD,[n(yi,{customModal:"order_modal","onUpdate:createProductModal":s.updateProductModal,onProcess_custom:s.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"]),n(Q,{"append-to-body":!0,modelValue:s.showRefundModal,"onUpdate:modelValue":i[17]||(i[17]=L=>s.showRefundModal=L),title:A(u)("Refund Transaction"),onClose:i[18]||(i[18]=()=>{s.changes_made=0,s.showRefundModal=!1,s.fetch()})},{default:d(()=>[qt(n(l5,{"element-loading-text":A(u)("Refund initiating on remote..."),order_id:e.order_id,order:s.order,showRefundModal:s.showRefundModal,onProcessing_refund:i[16]||(i[16]=L=>s.processing_refund=L),subscription:s.subscription,is_subscription:s.isSubscription,subscription_status:s.subscriptionStatus},null,8,["element-loading-text","order_id","order","showRefundModal","subscription","is_subscription","subscription_status"]),[[U,s.processing_refund]])]),_:1},8,["modelValue","title"]),s.loading?(r(),E(T,{key:0,animated:""},{default:d(()=>[n(D),n(D),n(D)]),_:1})):B("",!0),n(Q,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":i[19]||(i[19]=L=>s.nextInvoiceModal=L),title:A(u)("Custom payment link")},{default:d(()=>[n(m5,{order_id:e.order_id,order:s.order,onReload:s.fetch},null,8,["order_id","order","onReload"])]),_:1},8,["modelValue","title"])])],64)):B("",!0)])):B("",!0)])):B("",!0)],64)}}}),cD={class:"fct-create-order-wrapper fct-layout-width"},AD={class:"single-page-header"},pD={class:"single-page-header-title-wrap"},fD={class:"single-page-body"},mD={class:"fct-create-order"},hD={class:"fct-create-order-main"},_D={class:"fct-browse-product-form-group pb-5 mx-5"},vD={key:0,class:"fct-table-wrap fct-table-transparent-header"},gD={class:"fct-product-info-card"},yD={class:"fct-product-info-media"},bD=["src","alt"],wD={class:"fct-product-info-details"},CD={class:"fct-product-info-name"},kD={class:"product-sub-name product-sub-name--wrap"},BD={class:"mt-1"},xD={key:0,class:"line-through mr-3"},SD={key:1},FD={key:0},$D={class:"fct-input-number-wrap"},ED={key:0},UD={key:0},ID={key:1},QD={key:0},DD={class:"fct-table-border fct-table-order-details"},VD={key:0},TD={key:3},MD={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},LD={class:"fct-create-order-aside"},RD={class:"fct-admin-sidebar"},OD={key:0},HD={name:"CreateOrder",components:{OrderBulkActions:xd,Transaction:Sd,Badge:ma,IconButton:Ze,CopyToClipboard:Ia,Notes:Bi,Coupon:xi,CustomDiscount:Si,OrderCustomerInformation:ii,Shipping:$d},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:t+"images/empty-image.svg"},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():Fd(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,ue.post("orders",{...e,discount:this.discount,shipping:this.shippingSettings,labels:this.selectedLabels,user_tz:et.tz.guess(),trigger:"on_admin_create"}).then(t=>{z.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"?z.validationErrors(t):z.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,s)=>{l.shipping_charge=it.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})}),ue.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}}},PD=Object.assign(HD,{setup(e){const t=M(),a=M(!0),l=()=>t.value.fetchBySearch(),s=()=>{l()};return(i,c)=>{const p=C("el-breadcrumb-item"),f=C("el-breadcrumb"),_=C("el-input"),g=C("el-button"),y=C("router-link"),v=C("el-table-column"),b=C("el-input-number"),k=C("el-table"),w=C("el-dialog"),S=Ma("loading");return r(),h("div",cD,[n(rn,{isActive:i.changes_made>0?"is-active":"",onDiscard:i.reloadOrder,onSave:i.update,loading:i.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",AD,[o("div",pD,[n(f,{"separator-icon":A(dl)},{default:d(()=>[n(p,{to:{name:"orders"}},{default:d(()=>[R(m(i.$t("Orders")),1)]),_:1}),n(p,null,{default:d(()=>[R(m(i.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),o("div",fD,[o("div",mD,[o("div",hD,[n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:i.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[o("div",_D,[n(_,{placeholder:i.$t("Search products..."),onKeyup:c[0]||(c[0]=$=>l()),modelValue:i.searchQuery,"onUpdate:modelValue":c[1]||(c[1]=$=>i.searchQuery=$)},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(g,{onClick:s,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(m(i.$t("Browse")),1)]),_:1})]),i.order.order_items.length>0?(r(),h("div",vD,[qt((r(),E(k,{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:d(()=>[n(v,{"min-width":"450",label:i.$t("Product")},{default:d($=>{var V,F,x,Q;return[o("div",gD,[o("div",yD,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:$.row.post_id}}},{default:d(()=>[o("img",{src:i.getImageUrl($.row.featured_media,i.appVars.asset_url),alt:$.row.title,class:de(i.getClass($.row.featured_media))},null,10,bD)]),_:2},1032,["to"])]),o("div",wD,[o("div",CD,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:$.row.post_id}}},{default:d(()=>[R(m($.row.post_title)+" ",1),o("span",kD,"- "+m($.row.variation_display_title||$.row.title),1)]),_:2},1032,["to"])]),o("div",BD,[R(m(i.formatNumber($.row.price))+" ",1),parseInt($.row.unit_price)>parseInt($.row.price)?(r(),h("span",xD,m(i.formatNumber($.row.unit_price)),1)):B("",!0),$.row.payment_type==="subscription"&&((F=(V=$.row)==null?void 0:V.other_info)==null?void 0:F.manage_setup_fee)==="yes"?(r(),h("div",SD,[o("span",null,m($.row.other_info.signup_fee_name)+" : "+m(i.formatNumber($.row.other_info.signup_fee)),1),((Q=(x=$.row)==null?void 0:x.other_info)==null?void 0:Q.setup_fee_per_item)=="yes"?(r(),h("span",FD,[c[6]||(c[6]=o("span",null,"x",-1)),o("span",null,m($.row.quantity),1)])):B("",!0)])):B("",!0)])])])]}),_:1},8,["label"]),n(v,{width:"120",label:i.$t("Quantity")},{default:d($=>[o("div",$D,[n(Dp,{item:$.row,"onUpdate:value":i.updateQuantity,isDisabled:i.isDisabled($.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),n(v,{width:120,label:i.$t("Total")},{default:d($=>{var V,F,x,Q;return[o("div",null,m(i.formatNumber($.row.line_total)),1),$.row.payment_type=="subscription"&&((F=(V=$.row)==null?void 0:V.other_info)==null?void 0:F.manage_setup_fee)=="yes"?(r(),h("div",ED,[c[7]||(c[7]=o("span",null,"+",-1)),((Q=(x=$.row)==null?void 0:x.other_info)==null?void 0:Q.setup_fee_per_item)=="yes"?(r(),h("span",UD,[o("span",null,m(i.formatNumber($.row.other_info.signup_fee*$.row.quantity)),1)])):(r(),h("span",ID,m(i.formatNumber($.row.other_info.signup_fee)),1))])):B("",!0)]}),_:1},8,["label"]),i.hasSubscriptionItem?(r(),E(v,{key:0,width:"140",label:i.$t("Custom Price")},{default:d($=>[$.row.payment_type==="subscription"?(r(),h("div",QD,[n(b,{modelValue:$.row.custom_price,"onUpdate:modelValue":V=>$.row.custom_price=V,min:0,precision:2,step:.01,"controls-position":"right",placeholder:i.$t("Custom price"),size:"small",onChange:V=>i.updateCustomPrice($.row),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder","onChange"])])):B("",!0)]),_:1},8,["label"])):B("",!0),n(v,{width:50},{default:d($=>[n(Ze,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ne(V=>i.deleteProduct($.$index,$.row),["prevent"])},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[S,i.calculating]])])):B("",!0)]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{border_bottom:"",title:i.$t("Payment"),title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("table",DD,[o("tbody",null,[o("tr",null,[o("td",null,m(i.$t("Subtotal")),1),o("td",null,[i.order.order_items.length>0?(r(),h("span",VD,m(A(ta)(i.order.order_items.length))+" "+m(i.order.order_items.length===1?i.$t("item"):i.$t("items")),1)):B("",!0)]),o("td",null,m(i.formatNumber(i.order.subtotal)),1)]),i.order.order_items.length>0&&!i.discount.value?(r(),E(xi,{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"])):B("",!0),i.hasCoupon?B("",!0):(r(),E(Si,{key:1,order:i.order,hasCoupon:i.hasCoupon,"onUpdate:customDiscount":i.updateCustomDiscount},null,8,["order","hasCoupon","onUpdate:customDiscount"])),B("",!0),i.selectedCustomerCountry&&i.order.order_items.length>0?(r(),h("tr",TD,[o("td",MD,m(i.$t("Tax will be calculated on save")),1)])):B("",!0)]),o("tfoot",null,[o("tr",null,[o("td",null,m(i.$t("Total")),1),c[8]||(c[8]=o("td",null,null,-1)),o("td",null,m(i.formatNumber(i.order.total_amount)),1)])])])]),_:1})]),_:1})]),o("div",LD,[o("div",RD,[n(Bi,{note:i.order.note,onWhenNoteEditIsDone:c[2]||(c[2]=$=>{i.saveNoteModal($)})},null,8,["note"]),n(ii,{order:i.order,onOnAddressSelected:c[3]||(c[3]=$=>{if(i.fetchShippingMethods(),$===null){i.selectedCustomerCountry="",i.selectedCustomerAddress=null;return}i.selectedCustomerCountry=$.country,i.selectedCustomerAddress=$,$.type==="shipping"?i.order.shipping_address_id=$.id:i.order.billing_address_id=$.id}),onOnAddressRemove:c[4]||(c[4]=()=>{i.selectedCustomerCountry="",i.selectedCustomerAddress=null,i.order.billing_address_id=null,i.order.shipping_address_id=null,i.fetchShippingMethods()})},null,8,["order"]),n(oi,{selectedLabels:i.selectedLabels,"onUpdate:updateLabel":i.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),n(Qp,{ref_key:"productItemModal",ref:t,searchQueryParent:i.searchQuery,orderParent:i.order,"onUpdate:searchQuery":i.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),n(w,{"append-to-body":!0,modelValue:i.createProductModal,"onUpdate:modelValue":c[5]||(c[5]=$=>i.createProductModal=$),title:i.$t("Add New Product")},{default:d(()=>[i.createProductModal?(r(),h("div",OD,[n(yi,{customModal:"order_modal","onUpdate:createProductModal":i.updateProductModal,onProcess_custom:i.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"])])])}}});class ND extends Za{constructor(){super(...arguments);Re(this,"data",{form:_d()})}get controllerKey(){return"Customer"}}function Op(){return ND.init()}const KD={class:"setting-wrap"},GD={class:"setting-wrap-inner"},jD={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},zD={class:"grid gap-3 mb-6"},qD={class:"grid gap-3 mb-6"},YD={class:"grid gap-3 mb-6"},WD={class:"grid gap-3"},ws=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=Op(),{form:a}=t.data,l=_s(),s=M([]),i=M([]),c=M(!0),p=M(!1),f=M(!0),_=M({}),g=sl(),y=M(g.name),v=M(g.meta.title||"Store Settings"),b=()=>y.value==="reminders",k=()=>b()?"email-notification/reminders":"settings/store",w=()=>{var x;p.value=!0;let F=a.values;Array.isArray(F.store_logo)&&F.store_logo.length>0&&(F.store_logo=(x=F.store_logo)==null?void 0:x[0]),b()||(F.settings_name=y.value),ue.post(k(),{...F}).then(Q=>{if(z.success(u("Settings saved successfully")),y.value==="store_setup"){const D=["currency","currency_position","currency_separator","decimal_separator","decimal_points","order_mode","store_name","store_logo","weight_unit","dimension_unit"],T={};if(D.forEach(function(L){a.values[L]!==void 0&&(T[L]=a.values[L])}),T.currency){const L=Ge.get("currency_signs",{});L[T.currency]!==void 0&&(T.currency_sign=L[T.currency])}T.decimal_points!==void 0&&(T.is_zero_decimal=parseInt(T.decimal_points,10)===0);const U=Ge.get("shop",{}),O=["currency","currency_position","decimal_separator","decimal_points"].some(function(L){return T[L]!==void 0&&T[L]!==U[L]});Ge.mergeConfig({shop:Object.assign({},U,T)}),pt.setLocale(),O&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(Q=>{var D;Q.status_code=="422"?z.validationErrors(Q):z.error((D=Q.data)==null?void 0:D.message),a.setValidationErrors(Q),_.value=Q}).finally(()=>{p.value=!1,f.value=!1,c.value=!1})},S=M(!1),$=()=>{c.value=!0,S.value=!1;const F=b()?{}:{settings_name:y.value};ue.get(k(),F).then(x=>{a.setSchema(x.fields).setDefaults(x.settings).initForm(),s.value=x.settings,i.value=x.fields,c.value=!1,f.value=!1,p.value=!1}).catch(x=>{S.value=!0,c.value=!1,f.value=!1,p.value=!1})},V=()=>{l.bind(["mod+s"],F=>{F.preventDefault(),w()})};return be(()=>g.name,(F,x)=>{var Q;y.value=F,v.value=((Q=g.meta)==null?void 0:Q.title)||"Store Settings",l.unbind("mod+s"),V(),$()}),Ie(()=>{V(),$()}),Dc(()=>{l.unbind("mod+s")}),(F,x)=>{const Q=C("el-skeleton-item"),D=C("el-skeleton"),T=C("el-form");return r(),h("div",KD,[n(Qa,{heading:v.value,loading:p.value,onOnSave:w},null,8,["heading","loading"]),o("div",GD,[n(Da),S.value?(r(),E(Be,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[o("p",null,m(A(u)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(r(),h(H,{key:0},[f.value?(r(),h("div",jD,[n(D,{loading:f.value,animated:""},{template:d(()=>[o("div",zD,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",qD,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",YD,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",WD,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),f.value?B("",!0):(r(),h(H,{key:1},[A(a).isReady?(r(),E(T,{key:0,class:"relative"},{default:d(()=>[c.value?(r(),E(Be,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(D,{rows:5,animated:""},{default:d(()=>[n(Q),n(Q,{variant:"text"}),n(Q,{variant:"text"})]),_:1})]),_:1})]),_:1})):B("",!0),c.value?B("",!0):(r(),E(ki,{key:1,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:w,submitButtonText:A(u)("Save"),loading:p.value,onOnChange:x[0]||(x[0]=U=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"]))]),_:1})):B("",!0)],64))],64))])])}}}),JD={};function XD(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const ZD=lt(JD,[["render",XD]]),eV={name:"Licensing",components:{Lock:zf,Refresh:Hc,CircleCheck:ni,Badge:ma,DynamicIcon:J,CopyToClipboard:Ia,SettingsHeader:Qa,CardBody:Ce,CardContainer:Be,AdminNotice:Da},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return Ge.get("purchase_fluent_cart_link")}},mounted(){this.disabled||this.getSettings()},methods:{formatDate:$s,translate:u,getSettings(){this.errorMessage="",this.loading=!0,ue.get("settings/license",{verify:!0}).then(e=>{this.licenseData=e}).catch(e=>{z.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){z.error(u("Please provide a license key")),this.errorMessage=u("Please provide a license key");return}this.verifying=!0,this.errorMessage="",ue.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"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.data)}).finally(()=>{this.verifying=!1})},deactivateLicense(){this.verifying=!0,ue.delete("settings/license").then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{z.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}`}}},tV={class:"setting-wrap"},aV={class:"setting-wrap-inner"},lV={key:0,class:"fluent_cart_configure_integration_body"},sV={key:0,class:"fct-license-box-content"},nV=["href"],oV={class:"fct-license-box-content-details"},iV={class:"label"},rV={class:"license-key"},dV={class:"label"},uV={key:1,class:"w-full items-start"},cV={key:1,class:"fct-license-box-content"},AV={class:"fct-license-box-content-details"},pV={key:0},fV={class:"label"},mV={class:"license-key"},hV={class:"label"},_V={key:2,class:"fct-license-box-content"},vV={key:0},gV=["href"],yV=["innerHTML"];function bV(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-skeleton"),_=C("DynamicIcon"),g=C("CopyToClipboard"),y=C("el-input"),v=C("el-button"),b=C("CardBody"),k=C("CardContainer"),w=Ma("loading");return r(),h("div",tV,[n(c,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",aV,[n(p),n(k,null,{default:d(()=>[n(b,null,{default:d(()=>[n(f,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),o("div",null,[!a.disabled&&!s.loading?qt((r(),h("div",lV,[o("div",{class:de(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(r(),h("div",sV,[s.showNewLicenseInput?(r(),h("div",uV,[o("h3",null,m(i.translate("Your License Key")),1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=S=>s.licenseKey=S),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"])])):(r(),h(H,{key:0},[n(_,{name:"GradientWarningCircle"}),o("h3",null,m(i.translate("Looks like your license key has been Expired!")),1),o("p",null,[R(m(i.translate("Have a new license Key?"))+" ",1),o("a",{onClick:t[0]||(t[0]=Ne(S=>s.showNewLicenseInput=!s.showNewLicenseInput,["prevent"])),href:"#"},m(i.translate("Click here")),1),t[7]||(t[7]=R()),s.licenseData.renew_url?(r(),h(H,{key:0},[t[6]||(t[6]=R("or ",-1)),o("a",{href:s.licenseData.renew_url,target:"_blank"},m(i.translate("Purchase a new license")),9,nV)],64)):B("",!0)]),o("div",oV,[o("p",null,[o("span",iV,m(i.translate("License Key")),1),o("span",rV,[R(m(i.maskLicense(s.licenseData.license_key))+" ",1),n(g,{text:s.licenseData.license_key,showMode:"basic_copy_btn",tooltipText:i.translate("Copy License")},null,8,["text","tooltipText"])])]),o("p",null,[o("span",dV,m(i.translate("Expired At")),1),R(" "+m(i.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(r(),h("div",cV,[n(_,{name:"GradientCheckCircle"}),o("h3",null,m(i.translate("Congratulations! Your license key is valid and activated")),1),o("p",null,[R(m(i.translate("Want to deactivate this license?"))+" ",1),o("a",{onClick:t[2]||(t[2]=Ne(S=>i.deactivateLicense(),["prevent"])),href:"#"},m(i.translate("Click here")),1)]),o("div",AV,[s.licenseData.license_key?(r(),h("p",pV,[o("span",fV,m(i.translate("License Key")),1),o("span",mV,m(i.maskLicense(s.licenseData.license_key)),1)])):B("",!0),o("p",null,[o("span",hV,m(i.translate("Expires")),1),R(" "+m(s.licenseData.expires!=="lifetime"?i.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(r(),h("div",_V,[o("h3",null,m(i.translate("Please Provide a license key of"))+" FluentCart ",1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=S=>s.licenseKey=S),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"]),s.showNewLicenseInput?B("",!0):(r(),h("p",vV,[R(m(i.translate("Don't have a license key?"))+" ",1),o("a",{target:"_blank",href:i.purchaseLink},[R(m(i.translate("Purchase one here"))+" ",1),n(_,{name:"External",class:"w-4 h-4"})],8,gV)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,yV),s.licenseData.status==="expired"&&s.showNewLicenseInput?(r(),E(v,{key:3,type:"primary",onClick:t[4]||(t[4]=S=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),R(" "+m(i.translate("Click Here to Renew your License")),1)]),_:1})):["valid","expired"].includes(s.licenseData.status)?B("",!0):(r(),E(v,{key:4,type:"primary",onClick:t[5]||(t[5]=S=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),R(" "+m(i.translate("Verify License")),1)]),_:1}))],2)])),[[w,s.verifying]]):B("",!0)])]),_:1})]),_:1})])])}const wV=lt(eV,[["render",bV]]),CV={class:"fct-single-order-loader-wrap fct-layout-width"},kV={class:"single-page-header fct-page-loader-header flex items-start justify-between"},BV={class:"single-page-body"},xV={class:"fct-single-order"},SV={class:"fct-single-order-main"},FV={class:"fct-single-order-aside"},$V={class:"fct-admin-sidebar"},EV={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",CV,[o("div",kV,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-[100px]"},{template:d(()=>[n(l,{class:"w-2/4"}),n(l,{class:"w-2/4"})]),_:1})]),o("div",BV,[o("div",xV,[o("div",SV,[n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:6})]),_:1})]),_:1}),n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})]),_:1})]),_:1})]),o("div",FV,[o("div",$V,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:""},{template:d(()=>[n(l,{variant:"image",class:"rounded w-full h-[138px] mb-2"}),n(l,{variant:"image",class:"rounded w-[90px] h-[90px]"})]),_:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},UV={class:"fct-product-route-wrap"},IV={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=Js({show:!1,message:"",buttonText:"",route:""}),l=M(!1),s=M(!1),i=M(!1),c=sl(),p=M(!0),f=()=>{i.value=!0,a.show=!1,ue.get("products/"+t.product_id+"/pricing",{with:["product_menu"]}).then(v=>{l.value=v.product,l.value.variants=_(l.value.variants),s.value=v.taxonomies,l.value.post_date=et.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 b;(v==null?void 0:v.code)==="fluent_cart_entity_not_found"?(a.show=!0,a.buttonText=it.get(v,"data.buttonText"),a.message=it.get(v,"data.message"),a.route=it.get(v,"data.route"),jQuery(".fct-admin-product-header").remove()):v.status_code=="422"?z.validationErrors(v):z.error((b=v.data)==null?void 0:b.message)}).finally(()=>{i.value=!1})},_=v=>(v.forEach((b,k)=>{b.item_price=b.item_price?Number(b.item_price):0,b.item_cost=b.item_cost?Number(b.item_cost):0,b.compare_price=b.compare_price?Number(b.compare_price):"",b.other_info&&(b.other_info.signup_fee=b.other_info.signup_fee?Number(b.other_info.signup_fee):0),b.rowId=k}),v),g=(v=!1)=>{let b=jQuery(".fct-admin-product-menu"),k=c.name;b.length&&(b.find("li").removeClass("active-menu"),b.find(`li.fct_menu_${k}`).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,b)=>{v!==b&&f()}),Ie(()=>{f(),g(),window.addEventListener("hashchange",g)}),vl(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),si("reload",()=>{p.value=!1,f()}),(v,b)=>{const k=C("router-view");return r(),h("div",UV,[A(c).name==="product_edit"&&i.value?(r(),E(EV,{key:0})):B("",!0),a.show?(r(),E(ri,{key:1,"button-text":a.buttonText,message:a.message,route:a.route},null,8,["button-text","message","route"])):B("",!0),l.value&&a.show==!1?(r(),E(k,{key:2,product:l.value,taxonomies:s.value},null,8,["product","taxonomies"])):B("",!0)])}}};class QV extends Qs{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="ID"}getTabs(){return{all:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("Digital"),subscribable:u("Subscribable"),bundle:u("Bundle"),non_bundle:u("Non Bundle")}}getToggleableColumns(){return[{label:u("Type"),value:"product_type"},{label:u("Variation"),value:"variation_type"},{label:u("Stock"),value:"stock_availability"},{label:u("Price"),value:"item_price"},{label:u("Status"),value:"post_status"},{label:u("Date"),value:"post_date"}]}getSearchHint(){return u("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 Hp(e){return QV.init(e)}const DV={key:0,class:"fct-dummy-product-content"},VV={key:0,class:"title"},TV={class:"text"},MV={class:"fct-dummy-product-loading"},LV={class:"fct-loading-bars"},RV=["id"],OV={key:1,class:"fct-form-group"},HV={class:"required"},PV={class:"dialog-footer"},NV={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,l=Yt().ctx,s=M(!1),i=M([]),c=M(null),p=M(0),f=M(!1),_=M(null),g=M(0),y=k=>{s.value=k},v=(k=0)=>{if(c.value===null){b();return}f.value=!0;const w=i.value[c.value];if(_.value=w,k>w.count-1){setTimeout(()=>{b(),s.value=!1,a("onProductCreated")},1e3);return}p.value=k,l.$post("products/create-dummy",{category:w.category,index:k}).then(S=>{g.value=parseFloat(((k+1)/w.count*100).toFixed(0)),v(k+1)}).catch(S=>{S.code===400?b():v(k+1),l.handleError(S)})},b=()=>{g.value=0,p.value=0,f.value=!1,_.value=null};return Ie(()=>{i.value=Ge.get("dummy_product_info")}),(k,w)=>{const S=C("el-button"),$=C("el-progress"),V=C("el-option"),F=C("el-select"),x=C("el-dialog");return r(),h(H,null,[n(S,{onClick:w[0]||(w[0]=Q=>y(!0))},{default:d(()=>[n(J,{name:"Stars",class:"hidden lg:inline"}),R(" "+m(k.$t("Add Dummy Product")),1)]),_:1}),n(x,{modelValue:s.value,"onUpdate:modelValue":w[4]||(w[4]=Q=>s.value=Q),title:k.$t("Create Dummy Product"),"append-to-body":!0},oa({default:d(()=>[f.value?(r(),h("div",DV,[_.value!=null?(r(),h("div",VV,m(A(u)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):B("",!0),o("div",TV,[R(m(k.$t("Can close the window - product will continue to insert."))+" ",1),o("div",MV,[o("div",LV,[(r(),h(H,null,ae(8,Q=>o("div",{key:Q,class:"bar-block",id:`bar-block-${Q+1}`},null,8,RV)),64))]),R(" "+m(A(u)("Uploading... %1$s",`${g.value}%`)),1)])]),n($,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",OV,[o("label",HV,m(k.$t("Product Category")),1),n(F,{modelValue:c.value,"onUpdate:modelValue":w[1]||(w[1]=Q=>c.value=Q),clearable:"",placeholder:k.$t("Select a Product Category")},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(Q,D)=>(r(),E(V,{key:D,label:Q.title,value:D},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[f.value?void 0:{name:"footer",fn:d(()=>[o("div",PV,[n(S,{onClick:w[2]||(w[2]=Q=>y(!1))},{default:d(()=>[R(m(k.$t("Cancel")),1)]),_:1}),n(S,{type:"primary",onClick:w[3]||(w[3]=()=>{v()}),disabled:!c.value},{default:d(()=>[R(m(k.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},KV={class:"table-cell"},GV={class:"fct-product-info-card w-full"},jV={class:"fct-product-info-media"},zV={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},qV={class:"fct-product-info-name flex flex-col items-start gap-3"},YV={class:"table-cell"},WV={class:"table-cell"},JV={class:"table-cell"},XV={class:"table-cell"},ZV={class:"table-cell"},eT={class:"table-cell"},tT={class:"table-cell"},aT={__name:"ProductsLoader",props:{nextPageCount:{type:Number,default:0},productTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-table-column"),c=C("el-skeleton-item"),p=C("el-table"),f=C("el-skeleton");return r(),E(f,{animated:""},{template:d(()=>[n(p,{data:A(a),class:"w-full compact-table responsive fct-loader-table"},{empty:d(()=>s[0]||(s[0]=[])),default:d(()=>[n(i,{selectable:()=>!1,type:"selection",width:"45"}),n(i,{label:l.$t("Products"),width:"380"},{default:d(()=>[o("div",KV,[o("div",GV,[o("div",jV,[n(c,{variant:"image",class:"w-10 h-10.5 flex-none rounded-md"})]),o("div",zV,[o("div",qV,[n(c,{variant:"p",class:"max-w-[190px]"}),n(c,{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:d(()=>[o("div",YV,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(i,{key:1,label:l.$t("Variation"),width:"150"},{default:d(()=>[o("div",WV,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(i,{key:2,label:l.$t("Price"),width:"130"},{default:d(()=>[o("div",JV,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(i,{key:3,label:l.$t("Stock"),width:"100"},{default:d(()=>[o("div",XV,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(i,{key:4,label:l.$t("Status"),width:"130"},{default:d(()=>[o("div",ZV,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(i,{key:5,label:l.$t("Date"),width:"100"},{default:d(()=>[o("div",eT,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),n(i,{label:l.$t("Actions"),width:"90",align:"right"},{default:d(()=>[o("div",tT,[n(c,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},lT={},sT={class:"px-4 py-3"},nT={class:"flex items-center justify-between mb-3"},oT={class:"grid grid-cols-3 gap-5 mt-5"};function iT(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",sT,[o("div",nT,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",oT,[(r(),h(H,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const rT=lt(lT,[["render",iT]]),dT={class:"fct-product-action show-on-mobile absolute right-0 top-1"},uT={class:"more-btn pr-3"},cT={class:"flex items-center gap-2"},AT={key:0},pT={key:1},fT={key:2},mT={key:0},hT={key:1},_T={key:0},vT={key:1},gT={key:0},yT={key:1},bT={class:"flex items-center gap-0.5"},wT={key:0},CT={key:1},kT=["innerHTML"],BT=["innerHTML"],xT={class:"fct-product-id hidden",title:"Product ID"},ST={class:"more-btn pr-3"},FT={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const l=a,s=M(null),i=y=>{y.action==="delete"?rl(u("Are you sure you want to delete this product : %s ?",y.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{l("delete",y.product.ID)}).catch(v=>{}):y.action==="duplicate"&&l("duplicate",y.product)},c=y=>y.min_price===y.max_price?Gt(y.min_price,!0):`${Gt(y.min_price,!0)} - ${Gt(y.max_price,!0)}`,p=y=>{switch(y){case"physical":return u("Physical");case"digital":return u("Digital");case"bundle":return u("Bundle");default:ca.headline(y)}},f=y=>{switch(y){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");case"advanced_variations":return u("Advanced Variations");default:return y?ca.headline(y):""}},_=y=>{l("selectionChange",y)};return t({clearSelection:()=>{var y,v;(v=(y=s.value)==null?void 0:y.clearSelection)==null||v.call(y)}}),(y,v)=>{const b=C("el-table-column"),k=C("router-link"),w=C("el-dropdown-item"),S=C("el-dropdown-menu"),$=C("el-dropdown"),V=C("el-tooltip"),F=C("el-table");return r(),E(F,{ref_key:"elTableRef",ref:s,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:_},{empty:d(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:d(()=>[n(b,{type:"selection",width:"45"}),n(b,{label:A(u)("Products"),width:"380"},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[n(ld,{product:x.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",dT,[n($,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(S,null,{default:d(()=>[x.row.ID?(r(),E(w,{key:0,class:"item-link"},{default:d(()=>[n(k,{to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(w,{command:{action:"duplicate",product:x.row}},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(w,{command:{action:"delete",product:x.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",uT,[n(J,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(b,{key:0,label:A(u)("Type"),width:"170"},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>{var Q,D;return[o("div",cT,[((D=(Q=x.row.detail)==null?void 0:Q.other_info)==null?void 0:D.is_bundle_product)==="yes"?(r(),h("span",AT,m(A(u)("Bundle"))+" - ",1)):B("",!0),x.row.detail?(r(),h("span",pT,m(p(x.row.detail.fulfillment_type)),1)):(r(),h("span",fT,m(A(u)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(b,{key:1,label:A(u)("Variation"),width:"150"},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[x.row.detail?(r(),h("span",mT,m(f(x.row.detail.variation_type)),1)):(r(),h("span",hT,m("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(b,{key:2,label:A(u)("Price"),width:"130"},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[x.row.detail?(r(),h("span",_T,m(c(x.row.detail)),1)):(r(),h("span",vT,m(A(u)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(b,{key:3,label:A(u)("Stock"),width:"100"},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[x.row.detail?(r(),h("span",gT,[x.row.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[R(m(A(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[R(m(A(ta)(A(it).sum(x.row.variants,"available"))),1)],64))])):(r(),h("span",yT,m("")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(b,{key:4,label:A(u)("Status"),width:"130"},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[o("div",bT,[(r(),E(ma,{key:x.row.ID,status:x.row.post_status==="future"?"scheduled":x.row.post_status},null,8,["status"])),x.row.post_status==="future"?(r(),E(V,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(m(A(u)("Publishes On: %s",A($s)(x.row.post_date,!0))),1)]),default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):B("",!0)])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(b,{key:5,label:A(u)("Date"),width:"100"},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[n(Na,{"date-time":x.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),(r(!0),h(H,null,ae(e.productTable.getCustomColumns(),x=>(r(),E(b,{label:x.label},{default:d(Q=>[x.render_template?(r(),h("div",wT,[(r(),E(Bl(Wc),{templateContent:x.template,data:{column:x,product:Q.row,index:Q.$index}},null,8,["templateContent","data"]))])):(r(),h("div",CT,[x.as_link!==!1?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:Q.row.ID}}},{default:d(()=>[o("div",{innerHTML:A(it).get(Q.row,x.accessor)},null,8,kT)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(it).get(Q.row,x.accessor)},null,8,BT))]))]),_:2},1032,["label"]))),256)),n(b,{label:A(u)("Actions"),width:"90",align:"right"},{default:d(x=>[o("span",xT,"ID: "+m(x.row.ID),1),n($,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(S,null,{default:d(()=>[x.row.ID?(r(),E(w,{key:0,class:"item-link"},{default:d(()=>[n(k,{to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(w,{command:{action:"duplicate",product:x.row}},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(w,{command:{action:"delete",product:x.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",ST,[n(J,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},$T={class:"fct-product-table-mobile-wrap"},ET={class:"fct-product-table-mobile-header"},UT={key:0,class:"fct-product-table-post-status-col"},IT={class:"flex items-center gap-1.5"},QT={class:"fct-product-action"},DT={class:"more-btn"},VT=["onClick"],TT={class:"fct-product-table-mobile-body-header"},MT={class:"fct-product-table-date-col"},LT={class:"invoice-no",title:"Product ID"},RT={key:0,class:"fct-product-table-price-col"},OT={key:0},HT={key:1},PT={class:"fct-product-table-product-col"},NT=["onClick"],KT={key:0,class:"fct-product-table-product-type"},GT={class:"title"},jT={key:0,class:"value"},zT={key:1,class:"value"},qT={key:1,class:"fct-product-table-variation-col"},YT={class:"title"},WT={key:0,class:"value"},JT={key:1,class:"value"},XT={key:2,class:"fct-product-table-stock-col"},ZT={class:"title"},eM={key:0,class:"value"},tM={key:1},aM={key:0,class:"fct-product-table-mobile-footer"},lM={class:"fct-product-table-stock-col"},sM={key:0,class:"title"},nM=["innerHTML"],oM=["innerHTML"],iM={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,l=p=>{p.action==="delete"&&rl(u("Are you sure you want to delete this product : %s ?",p.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{a("delete",p.product.ID)}).catch(f=>{})},s=p=>p.min_price===p.max_price?Gt(p.min_price,!0):`${Gt(p.min_price,!0)} - ${Gt(p.max_price,!0)}`,i=p=>{switch(p){case"physical":return u("Physical");case"digital":return u("Digital");default:ca.headline(p)}},c=p=>{switch(p){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");default:ca.headline(p)}};return(p,f)=>{const _=C("el-tooltip"),g=C("router-link"),y=C("el-dropdown-item"),v=C("el-dropdown-menu"),b=C("el-dropdown");return r(),h("div",$T,[(r(!0),h(H,null,ae(e.productTable.getTableData(),(k,w)=>(r(),h("div",{key:k.id,class:"fct-product-table-mobile-row"},[o("div",ET,[e.productTable.isColumnVisible("post_status")?(r(),h("div",UT,[o("div",IT,[(r(),E(ma,{key:k.ID,status:k.post_status,onClick:S=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},null,8,["status","onClick"])),k.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:d(()=>[R(m(A(u)("Publishes On: %s",A($s)(k.post_date,!0))),1)]),default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):B("",!0)])])):B("",!0),o("div",QT,[n(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(v,null,{default:d(()=>[k.ID?(r(),E(y,{key:0,class:"item-link"},{default:d(()=>[n(g,{to:{name:"product_edit",params:{product_id:k.ID}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(y,{command:{action:"delete",product:k},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",DT,[n(J,{name:"More"})])]),_:2},1024)])]),o("div",{class:"fct-product-table-mobile-body",onClick:S=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},[o("div",TT,[o("div",MT,[e.productTable.isColumnVisible("post_date")?(r(),h(H,{key:0},[n(Na,{class:"date","date-time":k.post_date,"with-time":!1},null,8,["date-time"]),f[0]||(f[0]=o("span",{class:"bullet"},"•",-1))],64)):B("",!0),o("span",LT,"#"+m(k.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",RT,[k.detail?(r(),h("span",OT,m(s(k.detail)),1)):(r(),h("span",HT,m(A(u)("Set Price")),1))])):B("",!0)]),o("div",PT,[n(ld,{product:k},null,8,["product"])])],8,VT),o("div",{class:"fct-product-table-mobile-footer",onClick:S=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),h("div",KT,[o("div",GT,m(A(u)("Type")),1),k.detail?(r(),h("span",jT,m(i(k.detail.fulfillment_type)),1)):(r(),h("span",zT,m("N/A")))])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",qT,[o("div",YT,m(A(u)("Variation")),1),k.detail?(r(),h("span",WT,m(c(k.detail.variation_type)),1)):(r(),h("span",JT,m("N/A")))])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",XT,[o("div",ZT,m(A(u)("Stock")),1),k.detail?(r(),h("span",eM,[k.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[R(m(A(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[R(m(A(ta)(A(it).sum(k.variants,"available"))),1)],64))])):(r(),h("span",tM,m("")))])):B("",!0)],8,NT),e.productTable.getCustomColumns()?(r(),h("div",aM,[(r(!0),h(H,null,ae(e.productTable.getCustomColumns(),S=>(r(),h("div",lM,[S.label?(r(),h("div",sM,m(S.label),1)):B("",!0),S.render_template?(r(),E(Bl(Wc),{key:1,templateContent:S.template,data:S,column:S,row:k},null,8,["templateContent","data","column","row"])):(r(),h(H,{key:2},[S.as_link!==!1?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:k.ID}}},{default:d(()=>[o("div",{innerHTML:A(it).get(k,S.accessor)},null,8,nM)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(it).get(k,S.accessor)},null,8,oM))],64))]))),256))])):B("",!0)]))),128))])}}},rM={class:"product-action-modal"},dM={class:"fct-alert-content"},uM={class:"fct-alert-title"},cM={class:"fct-alert-text"},AM={class:"fct-alert-subtext"},pM={key:1,class:"product-info"},fM={class:"info-text"},mM={key:0},hM={key:1},_M={key:2},vM={key:2,class:"options-wrapper"},gM={key:4,class:"products-preview"},yM={class:"preview-title"},bM={class:"product-list"},wM={class:"product-name"},CM={key:0,class:"remaining-count"},kM={key:5,class:"progress-section"},BM={class:"progress-text"},xM={key:6,class:"results-section"},SM={class:"dialog-footer"},FM={key:0,class:"el-icon-delete"},$M={__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,s=M(a.modelValue),i=M(!1),c=M(!1),p=M(!1),f=M(0),_=M(0),g=M(0),y=M({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=Ge.get("app_config.isProActive"),b=Ge.get("modules_settings.stock_management.active"),k=N(()=>a.action==="duplicate"),w=N(()=>a.action==="delete"),S=N(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),$=N(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),V=N(()=>S.value?u(k.value?"Bulk Duplicate Products":"Bulk Delete Products"):u(k.value?"Duplicate Product":"Delete Product")),F=N(()=>w.value?u(S.value?"Delete Products":"Delete Product"):u(S.value?"Duplicate Products":"Duplicate Product")),x=N(()=>a.products.slice(0,5)),Q=N(()=>{const ne=$.value-5;return ne>0?ne:0}),D=N(()=>$.value===0?0:Math.round(f.value/$.value*100)),T=N(()=>{if(g.value>0&&f.value===$.value)return"exception";if(f.value===$.value)return"success"});be(()=>a.modelValue,ne=>{s.value=ne,ne&&(y.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},c.value=!1,p.value=!1,f.value=0,_.value=0,g.value=0,i.value=!1)}),be(s,ne=>{l("update:modelValue",ne)});const U=()=>{!c.value&&!i.value&&(s.value=!1,(p.value&&_.value>0||!S.value&&!p.value)&&l("completed"))},I=()=>{S.value?q():O()},O=()=>{i.value=!0,k.value?L():P()},L=()=>{ue.post(`products/${a.productId}/duplicate`,{import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles}).then(ne=>{z.success(ne.message||u("Product duplicated successfully")),l("completed"),U()}).catch(ne=>{var re,K;((re=ne.status_code)==null?void 0:re.toString())==="422"?z.validationErrors(ne):z.error(((K=ne.data)==null?void 0:K.message)||u("Failed to duplicate product"))}).finally(()=>{i.value=!1})},P=()=>{ue.delete(`products/${a.productId}`).then(ne=>{z.success(ne.message||u("Product deleted successfully")),l("completed"),U()}).catch(ne=>{var re,K;((re=ne.status_code)==null?void 0:re.toString())==="422"?z.validationErrors(ne):z.error(((K=ne.data)==null?void 0:K.message)||u("Failed to delete product"))}).finally(()=>{i.value=!1})},q=async()=>{c.value=!0,f.value=0,_.value=0,g.value=0,k.value?await X():await G(),c.value=!1,p.value=!0,te()},X=async()=>{const ne={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(K=>K.ID);for(const K of re){try{await ue.post(`products/${K}/duplicate`,ne),_.value++}catch{g.value++}f.value++}},G=async()=>{const ne=a.products&&a.products.length>0?a.products:[];for(const re of ne){try{await ue.delete(`products/${re.ID}`),_.value++}catch{g.value++}f.value++}},te=()=>{const ne=k.value;_.value>0&&g.value===0?z.success({message:ne?u("All products duplicated successfully"):u("All products deleted successfully")}):_.value>0&&g.value>0?z.warning({message:ne?u("Some products were duplicated successfully"):u("Some products were deleted successfully")}):z.error({message:ne?u("Failed to duplicate products"):u("Failed to delete products")})};return(ne,re)=>{const K=C("el-checkbox"),Y=C("el-progress"),W=C("el-alert"),j=C("el-button"),ie=C("el-dialog");return r(),E(ie,{modelValue:s.value,"onUpdate:modelValue":re[3]||(re[3]=he=>s.value=he),title:V.value,"append-to-body":!0,width:"500px",onClose:U,"modal-class":"fct-duplicate-product-modal"},{footer:d(()=>[o("div",SM,[n(j,{onClick:U,disabled:c.value},{default:d(()=>[R(m(c.value||p.value?A(u)("Close"):A(u)("Cancel")),1)]),_:1},8,["disabled"]),p.value?B("",!0):(r(),E(j,{key:0,type:w.value?"danger":"primary",loading:i.value||c.value,disabled:i.value||c.value,onClick:I},{default:d(()=>[w.value?(r(),h("i",FM)):B("",!0),R(" "+m(F.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:d(()=>[o("div",rM,[w.value?(r(),E(Xa,{key:0,icon:"WarningFill",type:"error"},{content:d(()=>[o("div",dM,[o("h3",uM,m(A(u)("Are you sure?")),1),o("p",cM,[R(m(A(u)("You are about to permanently delete"))+" ",1),o("strong",null,m($.value),1),R(" "+m(A(u)($.value===1?"product":"products"))+". ",1)]),o("p",AM,m(A(u)("This action cannot be undone.")),1)])]),_:1})):B("",!0),k.value?(r(),h("div",pM,[o("div",fM,[R(m(A(u)(S.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),S.value?(r(),h("strong",mM,m($.value),1)):(r(),h("strong",hM,m(e.productName),1)),S.value?(r(),h("span",_M,m(A(u)($.value===1?"product":"products")),1)):B("",!0)])])):B("",!0),k.value?(r(),h("div",vM,[n(K,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":re[0]||(re[0]=he=>y.value.importDownloadableFiles=he),label:A(u)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),n(K,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":re[1]||(re[1]=he=>y.value.importLicenseSettings=he),label:A(u)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),A(b)==="yes"?(r(),h(H,{key:0},[A(v)?(r(),E(K,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":re[2]||(re[2]=he=>y.value.importStockManagement=he),label:A(u)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),E(K,{key:1,disabled:!0,size:"large"},{default:d(()=>[R(m(A(u)("Import Stock Management"))+" ",1),n(J,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):B("",!0)])):B("",!0),k.value?(r(),E(Xa,{key:3,type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",null,m(A(u)(S.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):B("",!0),w.value&&S.value&&!c.value&&!p.value?(r(),h("div",gM,[o("p",yM,m(A(u)("Products to be deleted:")),1),o("ul",bM,[(r(!0),h(H,null,ae(x.value,he=>(r(),h("li",{key:he.ID,class:"product-item"},[o("span",wM,m(he.post_title),1)]))),128)),Q.value>0?(r(),h("li",CM,m(A(u)("... and %s more",Q.value)),1)):B("",!0)])])):B("",!0),S.value&&c.value?(r(),h("div",kM,[n(Y,{percentage:D.value,status:T.value},null,8,["percentage","status"]),o("p",BM,m(A(u)(w.value?"Deleting":"Duplicating"))+" "+m(f.value)+" / "+m($.value),1)])):B("",!0),S.value&&p.value?(r(),h("div",xM,[_.value>0?(r(),E(W,{key:0,title:A(u)(w.value?"Successfully deleted %s product(s)":"Successfully duplicated %s product(s)",_.value),type:"success",closable:!1,"show-icon":""},null,8,["title"])):B("",!0),g.value>0?(r(),E(W,{key:1,title:A(u)(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"])):B("",!0)])):B("",!0)])]),_:1},8,["modelValue","title"])}}},EM={class:"fct-all-products-page fct-layout-width"},UM={class:"fct-all-products-wrap"},IM={key:0,class:"bulk-actions-bar"},QM={class:"bulk-left flex items-center gap-2"},DM={class:"bulk-right"},VM={key:1,class:"fct-products-table-wrap"},TM={__name:"AllProducts",setup(e){const t=Hp({instance:Yt()}),a=M(!1),l=M(!1),s=M("duplicate"),i=M(null),c=M([]),p=M(""),f=M(!1),_=()=>{f.value=window.innerWidth<768},g=D=>{ue.delete(`products/${D}`).then(T=>{z.success(T),t.fetch()}).catch(T=>{var U;T.status_code.toString()==="422"?z.validationErrors(T):z.error((U=T.data)==null?void 0:U.message)})},y=D=>{i.value=D,c.value=[],s.value="duplicate",l.value=!0},v=()=>{t.fetch(),i.value=null,c.value=[]},b=()=>{var D,T;t.fetch(),c.value=[],p.value="",(T=(D=Q.value)==null?void 0:D.clearSelection)==null||T.call(D)},k=D=>{c.value=D},w=()=>{if(c.value.length===0){z.warning({message:u("Please select at least one product to duplicate")});return}i.value=null,s.value="duplicate",l.value=!0},S=()=>{if(c.value.length===0){z.warning({message:u("Please select at least one product to delete")});return}i.value=null,s.value="delete",l.value=!0},$=()=>{if(!p.value){z.warning({message:u("Please select a bulk action")});return}p.value==="duplicate"?w():p.value==="delete"&&S()},V=N(()=>c.value.map(D=>D.ID)),F=N(()=>c.value.length>0),x=N(()=>c.value.length>0),Q=M(null);return Ie(()=>{_(),window.addEventListener("resize",_)}),xt(()=>{window.removeEventListener("resize",_)}),(D,T)=>{const U=C("el-icon"),I=C("el-button"),O=C("el-dropdown-item"),L=C("el-dropdown-menu"),P=C("el-dropdown"),q=C("el-option"),X=C("el-select"),G=C("el-dialog");return r(),h("div",EM,[n(nl,{title:A(u)("Products")},{action:d(()=>[n(Rt,{permission:"products/view"},{default:d(()=>[n(P,{trigger:"click","popper-class":"fct-dropdown",onCommand:T[3]||(T[3]=()=>{}),placement:"bottom-end"},{dropdown:d(()=>[n(L,null,{default:d(()=>[n(Rt,{permission:"products/create"},{default:d(()=>[n(O,{class:"item-link"},{default:d(()=>[n(NV,{onOnProductCreated:T[0]||(T[0]=te=>A(t).fetch()),products:A(t).getTableData()},null,8,["products"])]),_:1}),n(O,{onClick:T[1]||(T[1]=te=>D.$router.push({name:"product_bulk_insert"}))},{default:d(()=>[n(J,{name:"Insert"}),R(" "+m(A(u)("Bulk Product Insert")),1)]),_:1}),n(O,{onClick:T[2]||(T[2]=te=>D.$router.push({name:"product_bulk_edit"}))},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(A(u)("Bulk Product Edit")),1)]),_:1})]),_:1})]),_:1})]),default:d(()=>[n(I,null,{default:d(()=>[R(m(A(u)("More actions"))+" ",1),n(U,null,{default:d(()=>[n(A(Rn))]),_:1})]),_:1})]),_:1})]),_:1}),n(Rt,{permission:"products/create"},{default:d(()=>[n(I,{type:"primary",onClick:T[4]||(T[4]=()=>{a.value=!0})},{default:d(()=>[R(m(A(u)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Rt,{permission:"products/view"},{default:d(()=>[o("div",UM,[n(Ds,{table:A(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(rT,{key:0})):B("",!0),n(iM,{"product-table":A(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:d(()=>[n(Wl,{name:"slide-fade"},{default:d(()=>[F.value?(r(),h("div",IM,[o("div",QM,[n(X,{size:"small",class:"bulk-select min-w-[180px]",placeholder:A(u)("Select Bulk Action"),modelValue:p.value,"onUpdate:modelValue":T[5]||(T[5]=te=>p.value=te)},{default:d(()=>[n(q,{label:A(u)("Duplicate"),value:"duplicate"},null,8,["label"]),n(q,{label:A(u)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),n(I,{size:"small",type:p.value==="delete"?"danger":"primary",onClick:$},{default:d(()=>[p.value==="delete"?(r(),E(J,{key:0,name:"Delete",class:"w-4 h-4"})):(r(),E(J,{key:1,name:"Copy",class:"w-4 h-4"})),R(" "+m(A(u)("Confirm")),1)]),_:1},8,["type"])]),o("div",DM,m(c.value.length)+" "+m(A(u)("item(s) selected")),1)])):B("",!0)]),_:1}),A(t).isLoading()?(r(),E(aT,{key:0,productTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",VM,[n(FT,{ref_key:"productTableRef",ref:Q,"product-table":A(t),onDelete:g,onDuplicate:y,onSelectionChange:k},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),n(Rt,{permission:"products/create"},{default:d(()=>{var te,ne;return[n(G,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":T[6]||(T[6]=re=>a.value=re),title:A(u)("Add New Product")},{default:d(()=>[a.value?(r(),E(yi,{key:0})):B("",!0)]),_:1},8,["modelValue","title"]),n($M,{modelValue:l.value,"onUpdate:modelValue":T[7]||(T[7]=re=>l.value=re),action:s.value,"product-id":(te=i.value)==null?void 0:te.ID,"product-name":(ne=i.value)==null?void 0:ne.post_title,products:x.value?c.value:[],"product-ids":x.value?V.value:[],onCompleted:T[8]||(T[8]=re=>x.value?b():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},MM=lt(TM,[["__scopeId","data-v-3831dbcb"]]);let LM=0;function Al(){return"_cid_"+ ++LM}const ss={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Ed extends Za{constructor(){super(...arguments);Re(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:ss.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:ss.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}}});Re(this,"ensureProductVariantIsArray",a=>{Array.isArray(a.variants)||(a.variants=[])})}getDummyVariation(a){var i;const l=a==null?void 0:a.variants,s={...this.data.dummies.variation};return s.serial_index=Array.isArray(l)?l.length+1:1,s.fulfillment_type=(i=a==null?void 0:a.detail)==null?void 0:i.fulfillment_type,s.other_info={...this.data.dummies.variationDetail},s.media=[],s._cid=Al(),s}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 s={};a.forEach(i=>{i.key&&(s[i.key]=i.width)}),Qt.set(l,s)}restoreColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s=Qt.get(l);s&&typeof s=="object"&&a.forEach(i=>{i.key&&s[i.key]!==void 0&&(i.width=s[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(s=>s.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 c of a.variants)c.stock_status=ss.IN_STOCK;a.detail&&(a.detail.stock_availability=ss.IN_STOCK);return}let s=!0;for(const c of a.variants){const p=parseInt(c.available,10)||0;c.stock_status=p>0?ss.IN_STOCK:ss.OUT_OF_STOCK,p>0&&(s=!1)}a.detail&&(a.detail.stock_availability=s?ss.OUT_OF_STOCK:ss.IN_STOCK)}addDummyDownloadableFiles(a){const l=a;Array.isArray(l.downloadable_files)||(l.downloadable_files=[]),l.downloadable_files.push(this.downloadableFileSchema)}}class RM extends Ed{constructor(){super(...arguments);Re(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:{}});Re(this,"router",ll());Re(this,"_mergeOtherInfo",(a,l)=>{const s=JSON.parse(JSON.stringify(l));Object.keys(s).forEach(i=>{a[i]=s[i]}),Object.keys(a).forEach(i=>{i in s||delete a[i]})});Re(this,"_mergeSnapshot",a=>{const l=this.data.product,s=new Set(["ID","guid","variants","detail","downloadable_files","product_terms","taxonomies","variantOptions"]);if(Object.keys(a).forEach(i=>{if(s.has(i))return;const c=a[i];l[i]=c!==null&&typeof c=="object"?JSON.parse(JSON.stringify(c)):c}),a.detail&&l.detail){const i=JSON.parse(JSON.stringify(a.detail));Object.keys(i).forEach(c=>{c!=="other_info"&&(l.detail[c]=i[c])}),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 c=new Set(["id","post_id","rowId","media","created_at","updated_at"]);l.variants.forEach(p=>{const f=i[p.id];f&&Object.keys(f).forEach(_=>{if(c.has(_))return;const g=f[_];_==="other_info"&&p.other_info?this._mergeOtherInfo(p.other_info,g):p[_]=g!==null&&typeof g=="object"?JSON.parse(JSON.stringify(g)):g})})}});Re(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"}});Re(this,"formatPricing",a=>(a.forEach((l,s)=>{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=s}),a));Re(this,"onChangePricing",(a,l,s)=>{this.ensureVariationIndex(l),this.product.variants[l][a]=s,a==="item_price"&&this.onChangePricingPayment(this.product.variants[l],s,l),this.data.product_changes.detail||(this.data.product_changes.detail.id=this.product.detail.id),this.data.product_changes.variants[l][a]=s,this.data.product_changes.variants[l].id=this.product.variants[l].id,(a==="item_price"||a==="compare_price")&&this.validateComparePrice(l),this.setHasChange(!0)});Re(this,"updateLongDescEditorChange",a=>{this.setHasChangeLongDescEditor(!0),ue.post(`products/${this.product.ID}/update-long-desc-editor-mode`,{active_editor:a??"wp-editor"}).then(l=>{z.success(l.message)}).catch(l=>{l&&l.message&&z.error(l)}).finally(()=>{this.setHasChangeLongDescEditor(!1)})});Re(this,"onChangePricingPayment",(a,l,s)=>{var i;if(a.item_price!==""&&a.other_info.repeat_interval!==""){let c=parseInt(a.other_info.times)?u("for %s Times",(i=a==null?void 0:a.other_info)==null?void 0:i.times):u("Until Cancel");const p=`${Gt(a.item_price,!0)} ${a.other_info.repeat_interval} ${c}`;return this.data.product_changes.variants[s].billing_summary=p,this.data.product_changes.variants[s].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[s].billing_summary="",this.data.product_changes.variants[s].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=""});Re(this,"onUploadPricingMedia",(a,l,s)=>{this.product.variants[l][a]=[],this.product.variants[l][a]=[...this.product.variants[l][a],...s];const i=this.product.variants[l].id;ue.post(`products/variants/${i}/setMedia`,{media:this.product.variants[l].media}).then(c=>{z.success(c.message)}).catch(c=>{var p;c.status_code=="422"?z.validationErrors(c):z.error((p=c.data)==null?void 0:p.message)}).finally(()=>{})});Re(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)});Re(this,"createOrUpdatePricing",a=>{this.setSaving(!0),this.setValidationErrors({});let l="";return a.id!=null?l=ue.post(`products/variants/${a.id}`,{variants:a}):l=ue.post("products/variants",{variants:a}),l.then(s=>(z.success(s.message),Object.values(this.data.onProductUpdatedListener).forEach(i=>{typeof i=="function"&&i(this.product)}),this.saveSnapshot(),s)).catch(s=>{var i;s.status_code=="422"?(z.validationErrors(s),this.setValidationErrors(s.data)):z.error((i=s.data)==null?void 0:i.message)}).finally(()=>{this.setSaving(!1)})});Re(this,"updatePricingValue",(a,l,s,i,c)=>{if(s.includes(".")&&(s=s.split(".").pop()),this.ensureVariationIndex(s),s!==void 0&&this.clearValidationError(`${s}.${a}`),i[a]=l,a==="item_price"&&this.onChangePricingPayment(i,l,s),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[s].fulfillment_type=l),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[s][a]=a==="item_cost"?i[a]:l,this.data.product_changes.variants[s].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[s].fulfillment_type=l),this.product.variants[0]=i,this.setHasChange(!0)),(a==="item_price"||a==="compare_price")&&this.validateComparePrice(s)});Re(this,"updatePricingOtherValue",(a,l,s=null,i,c="")=>{this.ensureVariationIndex(s),["payment_type","times","repeat_interval","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)&&(s!==void 0&&this.clearValidationError(`${s}.other_info.${a}`),i.other_info[a]=l,this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[s].other_info||(this.data.product_changes.variants[s].other_info={}),this.data.product_changes.variants[s].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[s].other_info=i.other_info,this.data.product_changes.variants[s].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,s)),["media"].includes(a)&&(i.media=[],i.media=[...i.media,...l],this.data.product_changes.variants[s].media=i.media,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),["description"].includes(a)&&(s!==void 0&&this.clearValidationError(`${s}.other_info.${a}`),this.data.product_changes.variants[s].other_info||(this.data.product_changes.variants[s].other_info={}),i.other_info[a]=l,this.data.product_changes.variants[s].other_info[a]=l,this.data.product_changes.variants[s].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),c==="add"&&this.setHasChange(!0)});Re(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});Re(this,"deletePricing",(a,l)=>Dn.ofDelete(u("Are you sure, you want to delete this price?")).then(()=>{if(a!==void 0)return ue.delete(`products/variants/${a}`).then(s=>{z.success(s.message),this.afterDeletingPricing(l),this.saveSnapshot()}).catch(s=>{throw(s==null?void 0:s.status_code)=="422"?z.validationErrors(s):z.error(s==null?void 0:s.data),s})}));Re(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}});Re(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(l=>l.manage_stock=a),this.setHasChange(!0)});Re(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]={})});Re(this,"onChangeNewStock",(a,l,s)=>{this.product.variants[s]||(this.data.product_changes.variants=[]),this.ensureVariationIndex(s),l===""&&(this.product.variants[s].new_stock=0,this.data.product_changes.variants[s].new_stock=0);let i=this.product.variants[s].total_stock??0,c=this.product.variants[s].new_stock??0,p=parseInt(c.toString())-parseInt(i);this.product.variants[s].adjusted_quantity=p,this.data.product_changes.variants[s].adjusted_quantity=p,this.data.product_changes.variants[s].id=this.product.variants[s].id});Re(this,"onChangeAdjustedQuantity",(a,l,s)=>{this.ensureVariationIndex(s),l===""&&(l=0);let i=this.product.variants[s].total_stock+parseInt(l);this.product.variants[s].new_stock=i<0?0:i});Re(this,"onChangeInputField",(a,l,s=!0)=>{var i,c,p,f,_;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]=et(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=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={}),(c=this.product.detail)!=null&&c.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"].includes(a)&&(this.ensureVariationIndex(0),this.data.product_changes.detail||(this.data.product_changes.detail={}),(f=this.product.detail)!=null&&f.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.product.detail.variation_type==="simple"&&(this.data.product_changes.detail.id=this.product.detail.id,this.data.product_changes.variants[0].id=this.product.variants[0].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;s&&this.setHasChange(!0)});Re(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));Re(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});Re(this,"validateComparePrice",a=>{var p,f;if(a==null)return!0;const l=(f=(p=this.product)==null?void 0:p.variants)==null?void 0:f[a];if(!l)return!0;const s=`variants.${a}.compare_price`,i=parseFloat(l.item_price),c=parseFloat(l.compare_price);return isNaN(c)||c<=0?(this.clearValidationError(s),!0):!isNaN(i)&&c<i?(this.validationErrors[s]=[u("Compare price must be greater than or equal to item price.")],!1):(this.clearValidationError(s),!0)});Re(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))});Re(this,"update",async(a=null)=>{var c,p,f,_,g,y;let l=this.data.product_changes;if(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?((c=this.data.product_changes.detail)!=null&&c.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),((f=l.detail)==null?void 0:f.variation_type)==="simple"&&(l.variants||(l.variants=[]),!Array.isArray(l.variants)||l.variants.length===0)){const v=((_=this.product.variants)==null?void 0:_[0])||{};l.variants[0]={id:v.id,variation_title:l.post_title||v.variation_title,item_price:v.item_price??"",post_id:this.product.ID}}if(delete l.taxonomies,delete l.product_terms,delete l.variantOptions,delete l.downloadable_files,((g=l.detail)==null?void 0:g.variation_type)!=="simple"&&l.variants){let v=[];l.variants.forEach(b=>{v.push({id:b.id,variation_title:b.variation_title,sku:b.sku,item_price:b.item_price,compare_price:b.compare_price,item_cost:b.item_cost,manage_cost:b.manage_cost,fulfillment_type:b.fulfillment_type,shipping_class:b.shipping_class,other_info:b.other_info,manage_stock:b.manage_stock,serial_index:b.serial_index,total_stock:b.total_stock,available:b.available,committed:b.committed,on_hold:b.on_hold,stock_status:b.stock_status,sold_individually:b.sold_individually,media:b.media,downloadable:b.downloadable,payment_type:b.payment_type})}),l.variants=v}((y=l.downloadable_files)==null?void 0:y.length)<1&&(l.variantOptions=[]);const s=ue.post(`products/${this.product.ID}/pricing`,l);let i=document.querySelector(".fct-admin-product-info .badge");s.then(v=>{z.success(a||v.message),this.setHasChange(!1),i&&(i.innerText=v.data.post_status),this.product.view_url=v.data.viewUrl,i&&v.data.post_status==="publish"&&(i.classList.remove("warning"),i.classList.add("success")),i&&v.data.post_status==="future"&&(i.innerText=u("Publishes on: %s",$s(v.data.post_date,!0)),i.classList.remove("success"),i.classList.add("warning")),i&&(v.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(v.data.variants)&&v.data.variants.length>0&&(this.product.variants[0].id=v.data.variants[0].id,this.product.variants[0].created_at=v.data.variants[0].created_at),this.product.variants=this.product.variants.filter((b,k,w)=>k===w.findIndex(S=>S.id===b.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(b=>{typeof b=="function"&&b(this.product)})}).catch(v=>{var b,k;((b=v==null?void 0:v.status_code)==null?void 0:b.toString())==="422"?(z.validationErrors(v),this.setValidationErrors(v)):z.error(((k=v==null?void 0:v.data)==null?void 0:k.message)||(v==null?void 0:v.message)||u("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});Re(this,"delete",()=>{rl(u("Are you sure you want to delete this product?"),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.setHasChange(!1),ue.delete(`products/${this.product.ID}`).then(a=>{z.success(a.message),this.router.push({name:"products"})}).catch(a=>{var l;a.status_code=="422"?z.validationErrors(a):z.error((l=a.data)==null?void 0:l.message)})}).catch(()=>{})});Re(this,"updateVariationType",(a,l)=>{var p,f;const s=this.product.detail[a];this.product.detail[a]=l;let i={variation_type:l,variation_ids:[(f=(p=this.product)==null?void 0:p.variants[0])==null?void 0:f.id],action:"change_variation_type"};const c=ue.post(`products/detail/${this.product.detail.id}`,i);return c.then(_=>{z.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]=s,_.status_code=="422"?z.validationErrors(_):z.error((g=_.data)==null?void 0:g.message)}).finally(()=>{}),c});Re(this,"getMaxExcerptWordCount",()=>{ue.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});Re(this,"shouldShowShippingMethodAlert",()=>Ge.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());Re(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));Re(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));Re(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));Re(this,"isTaxEnabled",()=>Ge.get("is_tax_enabled"));Re(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Re(this,"isBundleProduct",()=>it.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 c=l[i];typeof c=="function"&&c(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=Yt().ctx}setProduct(a){let l=document.querySelector(".fct-admin-product-info .badge");l&&a.post_status==="future"&&(l.innerText=u("Publishes on: %s",$s(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){var l;a.forEach((s,i)=>{s.serial_index=i+1}),(l=this.data.product_changes)!=null&&l.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants=a.map(s=>({id:s.id,serial_index:s.serial_index})),this.setHasChange(!0)}bulkUpdateVariants(a){return ue.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 Ge.get("admin_url")+"settings/shipping"}}function OM(){return RM.init()}function HM(){Ie(()=>{document.addEventListener("keydown",t)}),vl(()=>{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 PM={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},NM={key:0,class:"iframe-loader"},KM=["src"],GM={class:"iframe-controls"},jM={class:"dialog-header"},zM={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},qM={key:0,class:"iframe-loader"},YM=["src"],WM={__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),s=M(!0),i=M(),c=M(null),p=M(null);sl();const f=()=>{i.value=Ge.get("wp_admin_url",window.location.origin+"/wp-admin")},_=()=>{setTimeout(()=>{l.value=!1},500)},g=()=>{var S;s.value=!1,setTimeout(()=>{},500);try{const $=(S=p.value)==null?void 0:S.contentDocument;$&&$.addEventListener("click",V=>{const F=V.target.closest("a[href]");if(F&&!F.target&&!F.getAttribute("onclick")){const x=F.getAttribute("href");x&&(x.startsWith("/")||x.startsWith("http"))&&(V.preventDefault(),window.parent.postMessage({type:"navigateTo",content:x},"*"))}},!0)}catch{}},y=()=>{a.value=!0,s.value=!0},v=()=>{s.value=!1,a.value=!1,t.productEditModel.data.reloader()},b=()=>{l.value=!0,c.value&&(c.value.src=c.value.src.toString())},k=()=>{s.value=!0,p.value&&(p.value.src=p.value.src.toString())},w=S=>{const{type:$,content:V}=S.data;$==="gutenbergContentChanged"&&b(),$==="navigateTo"&&(v(),window.location.href=V)};return Ie(()=>{f(),window.addEventListener("message",w)}),(S,$)=>{const V=C("el-icon"),F=C("el-button"),x=C("el-breadcrumb-item"),Q=C("el-breadcrumb"),D=C("el-dialog");return r(),h(H,null,[o("div",PM,[$[2]||($[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),h("div",NM,[o("span",null,[R(m(A(u)("Loading preview..."))+" ",1),n(V,{class:"is-loading"},{default:d(()=>[n(A(Xs))]),_:1})])])):B("",!0),o("iframe",{ref_key:"previewIframeRef",ref:c,class:"scrollbar-none preview-iframe",src:`${i.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true&is-preview-mode=true`,width:"100%",height:"400px",onLoad:_,style:ua({visibility:l.value?"hidden":"visible"})},null,44,KM)]),o("div",GM,[n(F,{onClick:y},{default:d(()=>[R(m(A(u)("Show Content Editor")),1)]),_:1})]),n(D,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":$[0]||($[0]=T=>a.value=T),onClose:v,onOpen:$[1]||($[1]=()=>{k()})},{header:d(()=>[o("div",jM,[n(Q,{separator:"/"},{default:d(()=>[n(x,null,{default:d(()=>[o("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:v},m(e.product.post_title),1)]),_:1}),n(x,null,{default:d(()=>$[3]||($[3]=[R("Editor",-1)])),_:1,__:[3]})]),_:1}),s.value?B("",!0):(r(),E(F,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:v},{default:d(()=>[n(J,{name:"Cross"}),R(" "+m(A(u)("Close")),1)]),_:1}))])]),default:d(()=>[o("div",zM,[s.value?(r(),h("div",qM,[o("span",null,[R(m(A(u)("Loading editor..."))+" ",1),n(V,{class:"is-loading"},{default:d(()=>[n(A(Xs))]),_:1})])])):B("",!0),o("iframe",{ref_key:"dialogIframeRef",ref:p,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:g,style:ua({visibility:s.value?"hidden":"visible"})},null,44,YM)])]),_:1},8,["modelValue"])],64)}}},JM={class:"fct-product-info-wrap"},XM={class:"fct-admin-input-wrapper"},ZM={class:"fct-admin-input-wrapper"},e7={class:"form-note"},t7={class:"fct-excerpt-word-counter mt-[7px]"},a7={class:"editor-tabs-nav"},l7={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},s7={class:"custom-wp-editor-wrapper relative"},n7={class:"relative rounded overflow-hidden"},o7={class:"editor-tab-content fct-wp-editor-tab-content"},i7={class:"editor-tab-content fct-gutenberg-tab-content"},r7={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=M(!1),l=M("wp-editor");M("#gt"),sl();const s=M(),i=c=>{t.productEditModel.updateLongDescEditorChange(c),l.value=c};return be(()=>t.product.post_title,c=>{const p=document.querySelector(".fct-admin-product-header .product-name");p&&(p.textContent=c&&c.trim()?c:u("Product Name"))}),Ie(()=>{var c,p,f,_,g,y;a.value=!0,t.productEditModel.getMaxExcerptWordCount(),((c=t.product)==null?void 0:c.post_excerpt)!==void 0&&((p=t.product)==null?void 0:p.post_excerpt.toString().length)>0&&t.productEditModel.setExcerptWordCount((f=t.product)==null?void 0:f.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,()=>{s.value&&s.value.resetContent(t.product.post_content)}),(c,p)=>{const f=C("el-input"),_=C("el-form-item"),g=C("el-form"),y=Ma("loading");return r(),h("div",JM,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[6]||(p[6]=Ne(()=>{},["prevent"]))},{default:d(()=>[o("div",XM,[n(_,{label:A(u)("Title"),required:""},{default:d(()=>[n(f,{class:de(e.productEditModel.hasValidationError("post_title")?"is-error":""),id:"post_title",placeholder:A(u)("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"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),o("div",ZM,[n(_,{label:A(u)("Short description")},{default:d(()=>[n(f,{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",e7,[o("p",t7,m(A(u)("%1$s Words of %2$s",A(u)(e.productEditModel.data.excerptWordCount),A(u)(e.productEditModel.maxExcerptWordCount))),1)]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Long Description")},{action:d(()=>[qt((r(),h("div",a7,[n(Zr,null,{default:d(()=>[n($o,{label:A(u)("Classic Editor"),class:de(l.value==="wp-editor"?"active":""),onClick:p[7]||(p[7]=v=>i("wp-editor"))},null,8,["label","class"]),n($o,{label:A(u)("Builder"),class:de(l.value==="gutenberg"?"active":""),onClick:p[8]||(p[8]=v=>i("gutenberg"))},null,8,["label","class"])]),_:1})])),[[y,e.productEditModel.hasChangeLongDescEditor]])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[10]||(p[10]=Ne(()=>{},["prevent"]))},{default:d(()=>[o("div",l7,[n(_,null,{default:d(()=>[o("div",s7,[o("div",n7,[qt(o("div",o7,[n(es,{ref_key:"wpEditor",ref:s,modelValue:e.product.post_content,onUpdate:p[9]||(p[9]=v=>{e.productEditModel.onChangeInputField("post_content",v)})},null,8,["modelValue"])],512),[[Dl,l.value==="wp-editor"]]),qt(o("div",i7,[n(WM,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[Dl,l.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},d7=["aria-label"],u7=["src","alt"],c7={class:"fmp-featured__edit-icon"},A7=["src","alt"],p7={key:0,class:"fmp-count"},f7={key:0,class:"fmp-preview-grid"},m7=["src","alt"],h7={key:0,class:"fmp-preview-more"},_7={key:1,class:"fmp-add-full",type:"button"},v7={class:"fmp-modal-body"},g7=["src","alt"],y7=["onClick","title"],b7={key:1,class:"fmp-empty"},w7={class:"fmp-url-list"},C7=["src","alt"],k7={class:"fmp-url-info"},B7={class:"fmp-url-title"},x7={class:"fmp-url-text"},S7=["onClick","title"],F7={class:"fmp-url-add"},$7={class:"dialog-footer"},E7={class:"fct-media-picker-footer-actions"},U7={class:"fct-btn-group sm"},hl={__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}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=ms.getUrl("images/placeholder.svg"),l=I=>{I.target&&I.target.src!==a&&(I.target.src=a)},s=e,i=t,c=M(!1),p=M([]),f=M("gallery"),_=M(""),g=M(!1),y=N(()=>s.title||u("Manage Media")),v=N(()=>s.selectedCount>0?u("Apply to all (%1$s)",s.selectedCount):u("Apply to all")),b=N(()=>p.value.filter(I=>I.id>0)),k=N(()=>p.value.filter(I=>!I.id)),w=N(()=>s.showUrlTab),S=N(()=>Array.isArray(s.modelValue)?s.modelValue:[]),$=N(()=>S.value.filter(I=>I&&I.url)),V=()=>{p.value=JSON.parse(JSON.stringify(S.value)),f.value="gallery",_.value="",g.value=s.defaultApplyToAll,c.value=!0},F=()=>{(JSON.stringify(p.value)!==JSON.stringify(S.value)||g.value)&&(i("update:modelValue",p.value),i("change",p.value,{applyToAll:g.value})),c.value=!1},x=()=>{c.value=!1},Q=I=>{p.value.splice(I,1)},D=I=>{const O=I.filter(P=>P.url).map(P=>({id:P.id,title:P.title,url:P.url}));if(!s.multiple){p.value=O.slice(0,1);return}const L=new Set(p.value.map(P=>P.url));for(const P of O)L.has(P.url)||(p.value.push(P),L.add(P.url))},T=()=>{const I=_.value.trim();if(!I)return;if(p.value.some(P=>P.url===I)){_.value="";return}const O=I.split("/").pop().split("?")[0]||"image",L={id:0,url:I,title:O};s.multiple?p.value.push(L):p.value=[L],_.value=""},U=I=>{const O=p.value.findIndex(L=>L.url===I);O!==-1&&p.value.splice(O,1)};return(I,O)=>{const L=C("el-tag"),P=C("el-button"),q=C("el-tab-pane"),X=C("el-input"),G=C("el-tabs"),te=C("el-checkbox"),ne=C("el-dialog");return r(),h(H,null,[o("div",{class:de(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured,"is-square":e.square}]),onClick:V},[e.featured?(r(),h(H,{key:0},[e.modelValue&&e.modelValue.length?(r(),h("button",{key:0,type:"button",class:"fmp-featured","aria-label":A(u)("Edit media")},[o("img",{src:e.modelValue[0].url||A(a),alt:e.modelValue[0].title||"",class:"fmp-featured__image",onError:l},null,40,u7),o("span",c7,[n(J,{name:"Edit"})]),e.modelValue.length>1?(r(),E(L,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:d(()=>[R(m(e.modelValue.length)+" "+m(I.$t("images")),1)]),_:1})):B("",!0)],8,d7)):(r(),E(P,{key:1,class:"fct-mp-add-featured"},{default:d(()=>[n(J,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),h(H,{key:1},[$.value.length?(r(),h("div",{key:0,class:de(["fmp-stack",{"is-square":e.square}])},[(r(!0),h(H,null,ae($.value.slice(0,e.maxThumbs),(re,K)=>(r(),h("span",{key:K,class:"fmp-thumb-wrap",style:ua({zIndex:e.maxThumbs-K})},[o("img",{src:re.url,alt:re.title||"",class:"fmp-thumb",onError:l},null,40,A7)],4))),128)),$.value.length>e.maxThumbs?(r(),h("span",p7,"+"+m($.value.length-e.maxThumbs),1)):B("",!0),O[4]||(O[4]=Un('<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(P,{key:1,class:"fct-mp-add-compact"},{default:d(()=>[n(J,{name:"GalleryAdd"})]),_:1}))],64)):(r(),h(H,{key:2},[e.modelValue&&e.modelValue.length?(r(),h("div",f7,[(r(!0),h(H,null,ae(e.modelValue.slice(0,4),(re,K)=>(r(),h("div",{class:"fmp-preview-item",key:K},[o("img",{src:re.url,alt:re.title||""},null,8,m7),K===3&&e.modelValue.length>4?(r(),h("span",h7,"+"+m(e.modelValue.length-4),1)):B("",!0)]))),128))])):(r(),h("button",_7,[O[5]||(O[5]=Un('<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,m(I.$t("Add Media")),1)]))],64))],2),c.value?(r(),E(ne,{key:0,modelValue:c.value,"onUpdate:modelValue":O[3]||(O[3]=re=>c.value=re),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,onClose:x,class:"fct-bulk-media-picker-modal"},{default:d(()=>[o("div",v7,[n(G,{modelValue:f.value,"onUpdate:modelValue":O[1]||(O[1]=re=>f.value=re)},{default:d(()=>[n(q,{label:I.$t("Gallery"),name:"gallery"},{default:d(()=>[p.value.length?(r(),E(A(an),{key:0,list:p.value,class:"fmp-grid",tag:"div",animation:200},{default:d(()=>[(r(!0),h(H,null,ae(p.value,(re,K)=>(r(),h("div",{class:"fmp-grid-item",key:re.url||K},[o("img",{src:re.url,alt:re.title||""},null,8,g7),K===0?(r(),E(L,{key:0,type:"primary",size:"small",class:"fmp-featured-tag"},{default:d(()=>[R(m(I.$t("Featured")),1)]),_:1})):B("",!0),o("button",{type:"button",class:"fmp-remove-btn",onClick:Ne(Y=>Q(K),["stop"]),title:I.$t("Remove")}," × ",8,y7)]))),128))]),_:1},8,["list"])):(r(),h("div",b7,[o("p",null,m(I.$t("No media added yet.")),1)]))]),_:1},8,["label"]),w.value?(r(),E(q,{key:0,name:"imported-urls"},{label:d(()=>[R(m(I.$t("Add by URL"))+" ",1),k.value.length?(r(),E(L,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:d(()=>[R(m(k.value.length),1)]),_:1})):B("",!0)]),default:d(()=>[o("div",w7,[(r(!0),h(H,null,ae(k.value,re=>(r(),h("div",{class:"fmp-url-item",key:re.url},[o("img",{src:re.url,alt:re.title||"",class:"fmp-url-thumb"},null,8,C7),o("div",k7,[o("span",B7,m(re.title),1),o("span",x7,m(re.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ne(K=>U(re.url),["stop"]),title:I.$t("Remove")}," × ",8,S7)]))),128)),o("div",F7,[n(X,{modelValue:_.value,"onUpdate:modelValue":O[0]||(O[0]=re=>_.value=re),placeholder:I.$t("Paste image URL..."),size:"small",onKeyup:xa(T,["enter"])},null,8,["modelValue","placeholder"]),n(P,{size:"small",onClick:T,disabled:!_.value.trim()},{default:d(()=>[R(m(I.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):B("",!0)]),_:1},8,["modelValue"])]),o("div",$7,[n(Xc,{attachments:b.value,multiple:e.multiple,onOnMediaSelected:D},null,8,["attachments","multiple"]),o("div",E7,[e.showApplyToAll?(r(),h("label",{key:0,class:de(["fct-media-picker-apply-to-group-label",{"is-enabled":g.value}])},[n(te,{modelValue:g.value,"onUpdate:modelValue":O[2]||(O[2]=re=>g.value=re),"aria-label":I.$t("Apply media to all variants in this group")},null,8,["modelValue","aria-label"]),R(" "+m(v.value),1)],2)):B("",!0),o("div",U7,[n(P,{onClick:x},{default:d(()=>[R(m(I.$t("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:F},{default:d(()=>[R(m(I.$t("Save")),1)]),_:1})])])])]),_:1},8,["modelValue","title"])):B("",!0)],64)}}},I7={},Q7={class:"fct-shared-variant-item-box"},D7={key:0,class:"fct-shared-variant-item-box__header"},V7={class:"fct-shared-variant-item-box__label"},T7={class:"fct-shared-variant-item-box__action"},M7={class:"fct-shared-variant-item-box__body"};function L7(e,t){return r(),h("div",Q7,[e.$slots.label||e.$slots.action?(r(),h("div",D7,[o("div",V7,[ba(e.$slots,"label")]),o("div",T7,[ba(e.$slots,"action")])])):B("",!0),o("div",M7,[ba(e.$slots,"default")])])}const Nn=lt(I7,[["render",L7]]),R7={class:"fct-product-media-row"},O7={key:0,class:"fct-variant-title-readonly"},H7={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},P7={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},N7={class:"fct-admin-input-wrapper"},K7={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,titleInfo:Object},setup(e){const t=e,a=N(()=>{var s;return["simple_variations","advanced_variations"].includes((s=t.product.detail)==null?void 0:s.variation_type)}),l=N(()=>{var s;return((s=t.product.detail)==null?void 0:s.variation_type)==="advanced_variations"});return(s,i)=>{const c=C("el-input"),p=C("el-form-item");return a.value?(r(),E(Nn,{key:0,class:"fct-product-media-and-title"},{default:d(()=>[o("div",R7,[n(hl,{modelValue:e.variant.media,"onUpdate:modelValue":i[0]||(i[0]=f=>e.variant.media=f),featured:!0,compact:!1,onChange:i[1]||(i[1]=f=>e.productEditModel.updatePricingOtherValue("media",f,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),l.value?(r(),h("div",O7,[e.titleInfo&&e.titleInfo.group?(r(),h("div",H7,m(e.titleInfo.group),1)):B("",!0),o("div",P7,m(e.titleInfo&&e.titleInfo.detail||e.variant.variation_title),1)])):(r(),E(p,{key:1,label:A(u)("Variation Title")},{default:d(()=>[o("div",N7,[n(c,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.variation_title`)?"is-error":""),id:`${e.fieldKey}.variation_title`,placeholder:A(u)("e.g. Small, Medium, Large"),type:"text",modelValue:e.variant.variation_title,"onUpdate:modelValue":i[2]||(i[2]=f=>e.variant.variation_title=f),onInput:i[3]||(i[3]=f=>{e.productEditModel.updatePricingValue("variation_title",f,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):B("",!0)}}},G7=lt(K7,[["__scopeId","data-v-81001ec3"]]),j7={class:"fct-variant-item-collapse"},z7={class:"fct-variant-item-collapse-header"},q7={class:"fct-variant-item-collapse-body"},Pp={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=N({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=N(()=>s.value.includes("1"));return(c,p)=>{const f=C("el-collapse-item"),_=C("el-collapse");return r(),h("div",j7,[n(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),accordion:""},{default:d(()=>[n(f,{name:"1",icon:A(qf)},{title:d(()=>[o("div",z7,[ba(c.$slots,"header",{isOpen:i.value})])]),default:d(()=>[o("div",q7,[ba(c.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},Np=(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"}},er=e=>String(e||"").replace(/^0+(?=\d)/,""),Y7=e=>String(e??"").replace(/[^\d.,]/g,""),Kp=(e,t=",")=>{const a=Y7(e);if(!a)return"";const l=a.lastIndexOf("."),s=a.lastIndexOf(","),i=Math.max(l,s);if(i===-1)return er(a.replace(/[.,]/g,""));const c=er(a.slice(0,i).replace(/[^\d]/g,"")),p=a.slice(i+1).replace(/[^\d]/g,""),f=a.charAt(i),_=(a.match(new RegExp(`\\${f}`,"g"))||[]).length,g=i===a.length-1,y=a.includes(".")&&a.includes(",");if(!g&&!y&&f===t&&(_>1||p.length>2))return er(a.replace(/[^\d]/g,""));const b=c||"0";return g?`${b}.`:`${b}.${p.slice(0,2)}`},Gp=(e,t=",")=>{if(e==null||e==="")return NaN;const a=typeof e=="number"?String(e):Kp(e,t);return a?parseFloat(a.replace(/\.$/,"")):NaN},jp=(e,t=",")=>{if(e==null||e==="")return"";const a=Gp(e,t);return isNaN(a)?"":Math.round(a*100)},W7=/^-?[\d.,]*\d[\d.,]*$/,J7=(e,t=",")=>{if(e==null)return"";const a=String(e).trim();if(a==="")return"";if(!W7.test(a))return a;const l=jp(a,t);return l===""?a:a.charAt(0)==="-"?-l:l},ho=e=>{if(e==null||e==="")return"";const t=typeof e=="number"?e:parseFloat(String(e));return isNaN(t)?"":(t/100).toFixed(2)},X7=["innerHTML"],Yl={__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"],setup(e,{emit:t}){const a=e,l=t,s=N(()=>Ge.get("shop.currency_sign","$")),i=N(()=>Np(Ge.get("shop.decimal_separator",""),a.numberFormat)),c=N(()=>i.value.decimal),p=N(()=>i.value.thousand),f=N(()=>i.value.locale),_=/[\d.,]/,g=U=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(U.key)||U.ctrlKey||U.metaKey||_.test(U.key)||U.preventDefault()},y=U=>Kp(U,p.value),v=U=>Gp(U,p.value),b=U=>{const I=v(U);return isNaN(I)?"":I.toLocaleString(f.value,{minimumFractionDigits:0,maximumFractionDigits:2})},k=U=>{if(!U)return"";const I=U.endsWith("."),[O="",L=""]=U.split("."),P=(O||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return I?`${P}${c.value}`:L?`${P}${c.value}${L}`:P},w=(U,I=!1)=>{const O=v(U);return isNaN(O)?"":(I?S(O):O).toFixed(2)},S=U=>a.min===null||a.min===void 0||isNaN(U)?U:U<a.min?a.min:U,$=U=>jp(U,p.value),V=M(""),F=M(""),x=M(!1),Q=U=>{const I=w(ho(U));if(!I){V.value="",F.value="";return}V.value=b(I),F.value=I},D=U=>{const I=y(U);if(F.value=I,V.value=k(I),x.value=!0,I===""){l("update:modelValue","");return}const O=w(I);O!==""&&O!==ho(a.modelValue)&&l("update:modelValue",$(O))},T=()=>{const U=x.value?F.value:ho(a.modelValue);if(U==="")l("update:modelValue",""),l("change",""),V.value="",F.value="";else{const I=w(U,!0);if(I==="")Q(a.modelValue);else{const O=$(I);l("update:modelValue",O),I!==ho(a.modelValue)&&l("change",O),V.value=b(I),F.value=I}}x.value=!1};return be([()=>a.modelValue,()=>a.numberFormat],([U])=>{x.value||Q(U)}),Q(a.modelValue),(U,I)=>{const O=C("el-input");return r(),E(O,{class:de(e.errorClass),id:e.id,size:e.size,placeholder:e.placeholder,"model-value":V.value,disabled:e.disabled,onBlur:T,onInput:D,onKeydown:g},oa({prefix:d(()=>[o("span",{innerHTML:s.value},null,8,X7)]),_:2},[U.$slots.suffix?{name:"suffix",fn:d(()=>[ba(U.$slots,"suffix")]),key:"0"}:void 0,U.$slots.append?{name:"append",fn:d(()=>[ba(U.$slots,"append")]),key:"1"}:void 0]),1032,["class","id","size","placeholder","model-value","disabled"])}}},Z7={key:0,class:"fct-shared-variant-item-box__switch"},eL={class:"fct-shared-variant-item-box__hint"},tL={key:1,class:"fct-inline-select-wrap"},aL={class:"fct-price-with-inclusion"},lL={key:0,class:"fct-required"},sL={class:"fct-admin-input-wrapper"},nL={key:0},oL={key:0,class:"fct-collapse-heading"},iL={key:1,class:"fct-tag-group"},rL={class:"fct-tag-item"},dL={class:"fct-tags-internal"},uL={key:0,class:"fct-tag-item"},cL={class:"fct-tags-internal"},AL={key:1,class:"fct-tag-item"},pL={class:"fct-tags-internal"},fL={key:2,class:"fct-tag-item"},mL={class:"fct-tags-internal"},hL={class:"fct-tag-item"},_L={class:"fct-tags-internal"},vL={class:"fct-shared-variant-pricing-additional"},gL={class:"fct-admin-input-wrapper"},yL={class:"fct-admin-input-wrapper"},bL={class:"fct-admin-input-wrapper"},wL={key:0},CL={class:"fct-admin-input-wrapper"},kL={class:"fct-admin-input-wrapper"},BL={class:"fct-admin-input-wrapper"},xL={class:"fct-admin-input-wrapper"},SL={class:"fct-admin-input-wrapper"},FL={class:"fct-admin-input-wrapper"},$L={class:"fct-admin-input-wrapper"},tr=2,zp={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=Ge.get("app_config.isProActive"),l=M(),s=M([""]),i=M(0),c=new Set(["compare_price","repeat_interval","trial_days","times","signup_fee_name","signup_fee","setup_fee_per_item","item_cost","manage_cost"]);be(()=>{var w;return(w=t.variant)==null?void 0:w.id},()=>{var w,S;i.value=Number((S=(w=t.variant)==null?void 0:w.other_info)==null?void 0:S.signup_fee)||0}),be(()=>{var w,S;return(S=(w=t.variant)==null?void 0:w.other_info)==null?void 0:S.payment_type},w=>{w==="subscription"&&(s.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($=>{for(const V of c)if($.includes(V))return!0;return!1})&&(s.value="1")},{deep:!0});let p=t.product.variants.length>0;const f=N(()=>{var w;return((w=window.fluentCartAdminApp)==null?void 0:w.subscription_intervals)??[]}),_=()=>{var w,S,$;return((w=t.variant)==null?void 0:w.other_info)&&["subscription"].includes(($=(S=t.variant)==null?void 0:S.other_info)==null?void 0:$.payment_type)},g=(w,S,$,V)=>{t.productEditModel.updatePricingOtherValue(w,S,$,V,t.modeType)},y=(w,S,$)=>{const V=Number(w);(!Number.isFinite(V)||V<tr)&&g("times",tr,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)},b=N(()=>{var $,V;const w=Number(t.variant.item_price)||0,S=Number((V=($=t.variant)==null?void 0:$.other_info)==null?void 0:V.times)||1;return w*S}),k=w=>{const S=f.value.find(V=>V.value===w);return!(S!=null&&S.label)&&!w?"":((S==null?void 0:S.label)||w).split(" ").map(V=>V.charAt(0).toUpperCase()).join("")};return(w,S)=>{const $=C("el-switch"),V=C("el-option"),F=C("el-select"),x=C("el-form-item"),Q=C("el-col"),D=C("el-input"),T=C("el-row"),U=C("el-checkbox"),I=C("el-tooltip");return r(),E(Nn,null,{label:d(()=>[R(m(A(u)("Pricing")),1)]),action:d(()=>{var O;return[(O=e.variant)!=null&&O.other_info?(r(),h("div",Z7,[e.isGroupMode?(r(),h("div",tL,[o("label",null,m(A(u)("Payment Type"))+":",1),n(F,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":S[1]||(S[1]=L=>e.variant.other_info.payment_type=L),"popper-class":"fct-group-select-popper",onChange:S[2]||(S[2]=L=>{L==="subscription"&&!e.variant.other_info.repeat_interval&&ke(()=>{e.variant.other_info.repeat_interval="yearly"})}),class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(V,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(V,{value:"subscription",label:A(u)("Subscription")},null,8,["label"]),n(V,{value:"onetime",label:A(u)("One-time")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(H,{key:0},[o("span",eL,m(A(u)("Subscription")),1),n($,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:S[0]||(S[0]=L=>{const P=L?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",P,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",L&&ke(()=>{var q;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((q=l.value.value)==null||q.focus())})})},null,8,["model-value"])],64))])):B("",!0)]}),default:d(()=>[o("div",aL,[n(x,{class:"fct-price-with-inclusion__price"},{label:d(()=>{var O,L;return[R(m(((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"))+" ",1),e.isGroupMode?B("",!0):(r(),h("span",lL,"*"))]}),default:d(()=>{var O,L;return[o("div",sL,[n(Yl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":S[3]||(S[3]=P=>{e.variant.item_price=P,e.productEditModel.updatePricingValue("item_price",P,e.fieldKey,e.variant,e.modeType)})},{suffix:d(()=>{var P,q,X,G;return[((q=(P=e.variant)==null?void 0:P.other_info)==null?void 0:q.installment)==="yes"?(r(),h("span",nL," x "+m((G=(X=e.variant)==null?void 0:X.other_info)==null?void 0:G.times),1)):B("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(r(),E(x,{key:0,class:"fct-price-with-inclusion__tax"},{label:d(()=>[R(m(A(u)("Tax")),1)]),default:d(()=>{var O,L;return[e.isGroupMode?(r(),E(F,{key:0,modelValue:e.variant.other_info.tax_inclusion,"onUpdate:modelValue":S[4]||(S[4]=P=>e.variant.other_info.tax_inclusion=P),"popper-class":"fct-group-select-popper"},{default:d(()=>[n(V,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(V,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(V,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(F,{key:1,"model-value":((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.tax_inclusion)||"_default_",onChange:S[5]||(S[5]=P=>{const q=P==="_default_"?"":P;e.variant.other_info&&(e.variant.other_info.tax_inclusion=q),e.productEditModel.updatePricingOtherValue("tax_inclusion",q,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[n(V,{value:"_default_",label:A(u)("Store default")},null,8,["label"]),n(V,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(V,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"]))]}),_:1})):B("",!0)]),n(Pp,{modelValue:s.value,"onUpdate:modelValue":S[27]||(S[27]=O=>s.value=O)},{header:d(({isOpen:O})=>{var L,P,q,X,G,te;return[O?(r(),h("div",oL,m(A(u)("Additional display prices")),1)):(r(),h("div",iL,[o("div",rL,[R(m(A(u)("Compare-at"))+" ",1),o("span",dL,m((L=e.variant)!=null&&L.compare_price?A(Gt)(e.variant.compare_price,!0):0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),h("div",uL,[R(m(A(u)("Installment"))+" ",1),o("span",cL,m(((q=(P=e.variant)==null?void 0:P.other_info)==null?void 0:q.installment)==="yes"?A(u)("Yes"):A(u)("No")),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",AL,[R(m(A(u)("Interval"))+" ",1),o("span",pL,m(k(e.variant.other_info.repeat_interval)),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",fL,[R(m(A(u)("Trial Days"))+" ",1),o("span",mL,m(((G=(X=e.variant)==null?void 0:X.other_info)==null?void 0:G.trial_days)??0),1)])):B("",!0),o("div",hL,[R(m(A(u)("Cost Per Item"))+" ",1),o("span",_L,m((te=e.variant)!=null&&te.item_cost?A(Gt)(e.variant.item_cost,!0):A(u)("N/A")),1)])]))]}),default:d(()=>[o("div",vL,[n(T,{gutter:15},{default:d(()=>[n(Q,{lg:12},{default:d(()=>[o("div",gL,[n(x,null,{label:d(()=>[n(fa,{title:A(u)("Compare at price"),content:A(u)("Set a higher price to show with a strike-through, highlighting a discount for sales")},null,8,["title","content"])]),default:d(()=>[n(Yl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.compare_price`)?"is-error":"",id:`${e.fieldKey}.compare_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):A(u)("Compare at price"),"model-value":e.variant.compare_price,"onUpdate:modelValue":S[6]||(S[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"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),_()?(r(),h(H,{key:0},[n(Q,{lg:12},{default:d(()=>[o("div",yL,[n(x,{label:A(u)("Interval"),required:""},{default:d(()=>[n(F,{class:de(["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":S[7]||(S[7]=O=>e.variant.other_info.repeat_interval=O),placeholder:A(u)("Interval"),onChange:S[8]||(S[8]=O=>{e.productEditModel.updatePricingOtherValue("repeat_interval",O,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[(r(!0),h(H,null,ae(f.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"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),n(Q,{lg:12},{default:d(()=>[n(x,{class:"has-tooltip"},{label:d(()=>[n(fa,{title:A(u)("Trial Days"),content:A(u)("Enter the number of days the free trial will last. The trial period cannot exceed 365 days.")},null,8,["title","content"])]),default:d(()=>[n(D,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.trial_days`)?"is-error":""),id:`${e.fieldKey}.other_info.trial_days`,placeholder:A(u)("Trial Days"),type:"number",min:1,max:365,modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":S[9]||(S[9]=O=>e.variant.other_info.trial_days=O),modelModifiers:{number:!0},autofocus:"",onInput:S[10]||(S[10]=O=>{e.productEditModel.updatePricingOtherValue("trial_days",O,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.trial_days`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})],64)):B("",!0)]),_:1}),_()?(r(),E(T,{key:0},{default:d(()=>{var O;return[n(Q,{lg:24},{default:d(()=>[n(x,null,{default:d(()=>[n(U,{"true-value":"yes","false-value":"no",label:A(u)("Enable installment payment"),class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.installment`)?"is-error":""),id:`${e.fieldKey}.other_info.installment`,placeholder:A(u)("Occurrence"),type:"number",modelValue:e.variant.other_info.installment,"onUpdate:modelValue":S[11]||(S[11]=L=>e.variant.other_info.installment=L),modelModifiers:{number:!0},disabled:!A(a),onChange:S[12]||(S[12]=L=>{if(g("installment",L,e.fieldKey,e.variant),L==="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"]),A(a)?B("",!0):(r(),E(I,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(m(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),n(va,{visible:((O=e.variant.other_info)==null?void 0:O.installment)==="yes",accordion:""},{default:d(()=>[n(T,{gutter:15},{default:d(()=>{var L;return[n(Q,{lg:12},{default:d(()=>[n(x,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(fa,{title:A(u)("Installment Count"),content:A(u)("Number of payments to split the price over the installment period.")},null,8,["title","content"])]),default:d(()=>[n(D,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:A(u)("Installment Count"),type:"number",min:tr,modelValue:e.variant.other_info.times,"onUpdate:modelValue":S[13]||(S[13]=P=>e.variant.other_info.times=P),modelModifiers:{number:!0},onInput:S[14]||(S[14]=P=>{g("times",P,e.fieldKey,e.variant)}),onChange:S[15]||(S[15]=P=>{y(P,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:l},null,8,["class","id","placeholder","modelValue"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((L=e.variant.other_info)==null?void 0:L.installment)==="yes"?(r(),E(Q,{key:0,lg:12},{default:d(()=>[n(x,null,{label:d(()=>[n(fa,{title:A(u)("Total Price"),content:A(u)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:d(()=>[n(D,{id:`${e.fieldKey}.total_price`,type:"number",min:1,disabled:"","model-value":b.value,autofocus:""},{prefix:d(()=>[o("span",null,m(w.appVars.shop.currency_sign),1)]),_:1},8,["id","model-value"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})):B("",!0)]}),_:1})]),_:1},8,["visible"])]}),_:1})):B("",!0),_()?(r(),E(T,{key:1,gutter:15},{default:d(()=>{var O,L;return[n(Q,{lg:24},{default:d(()=>[o("div",bL,[n(x,{label:e.isGroupMode?A(u)("Setup fee"):void 0,class:de(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E(F,{key:0,size:"small",modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":S[16]||(S[16]=P=>e.variant.other_info.manage_setup_fee=P),style:{width:"160px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(V,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(V,{value:"yes",label:A(u)("Setup fee: Yes")},null,8,["label"]),n(V,{value:"no",label:A(u)("Setup fee: No")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),h(H,{key:1},[n($,{size:"small",disabled:!A(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":S[17]||(S[17]=P=>e.variant.other_info.manage_setup_fee=P),"active-value":"yes","inactive-value":"no",onChange:v,"active-text":A(u)("Setup fee")},null,8,["disabled","modelValue","active-text"]),A(a)?B("",!0):(r(),h("span",wL,[n(I,{"popper-class":"fct-tooltip"},{content:d(()=>[R(m(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))],64))]),_:1},8,["label","class"])])]),_:1}),n(va,{visible:((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.manage_setup_fee)=="yes",accordion:""},{default:d(()=>[n(T,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:d(()=>[n(Q,{lg:12},{default:d(()=>[o("div",CL,[n(x,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(fa,{title:A(u)("Setup fee label"),content:A(u)("Name the one-time setup fee (e.g., Initial Setup)")},null,8,["title","content"])]),default:d(()=>[n(D,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee_name`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee_name`,placeholder:A(u)("Setup fee name"),type:"text",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":S[18]||(S[18]=P=>e.variant.other_info.signup_fee_name=P),onInput:S[19]||(S[19]=P=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",P,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),n(Q,{lg:12},{default:d(()=>[o("div",kL,[n(x,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(fa,{title:A(u)("Setup fee amount"),content:A(u)("Set the one-time setup fee amount (e.g., $50) per order. This fee does not apply to quantity.")},null,8,["title","content"])]),default:d(()=>[n(Yl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee`)?"is-error":"",id:`${e.fieldKey}.other_info.signup_fee`,placeholder:A(u)("Setup fee amount"),"model-value":e.variant.other_info.signup_fee,"onUpdate:modelValue":S[20]||(S[20]=P=>{e.variant.other_info.signup_fee=P,e.productEditModel.updatePricingOtherValue("signup_fee",P,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.setup_fee_per_item`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1})]),_:1})]),_:1},8,["visible"])]}),_:1})):B("",!0),n(T,{gutter:15},{default:d(()=>[e.variant.manage_cost||e.isGroupMode?(r(),E(Q,{key:0,lg:24,class:"fct-manage-cost-col"},{default:d(()=>[o("div",BL,[n(x,{label:e.isGroupMode?A(u)("Calculate profit/cost"):void 0,class:de(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E(F,{key:0,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":S[21]||(S[21]=O=>e.variant.manage_cost=O),style:{width:"200px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(V,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(V,{value:"true",label:A(u)("Enable")},null,8,["label"]),n(V,{value:"false",label:A(u)("Disable")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E($,{key:1,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":S[22]||(S[22]=O=>e.variant.manage_cost=O),"active-value":"true","inactive-value":"false",onChange:S[23]||(S[23]=O=>{A(p)&&e.productEditModel.updatePricingOtherValue("manage_cost",O,e.fieldKey,e.variant,e.modeType),Mf(p)?p.value=!0:p=!0}),"active-text":A(u)("Calculate profit/cost")},null,8,["modelValue","active-text"]))]),_:1},8,["label","class"])])]),_:1})):B("",!0),n(va,{visible:e.variant.manage_cost==="true",accordion:""},{default:d(()=>[n(T,{gutter:15,class:"fct-cost-profit-wrap"},{default:d(()=>{var O,L,P;return[n(Q,{lg:e.isGroupMode?24:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?12:8},{default:d(()=>[o("div",xL,[n(x,null,{label:d(()=>[n(fa,{title:A(u)("Cost per item"),content:A(u)("Customers won't see this")},null,8,["title","content"])]),default:d(()=>[n(Yl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_cost`)?"is-error":"",id:`${e.fieldKey}.item_cost`,placeholder:e.isGroupMode?A(u)("Unchanged"):A(u)("Cost per item"),"model-value":e.variant.item_cost,"onUpdate:modelValue":S[24]||(S[24]=q=>{e.variant.item_cost=q,e.productEditModel.updatePricingValue("item_cost",q,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_cost`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1},8,["lg"]),e.isGroupMode?B("",!0):(r(),E(Q,{key:0,lg:((L=e.product.detail)==null?void 0:L.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",SL,[n(x,{label:A(u)("Profit")},{default:d(()=>[n(D,{disabled:"",class:"fct-profit-display",value:A(Bm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?B("",!0):(r(),E(Q,{key:1,lg:((P=e.product.detail)==null?void 0:P.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",FL,[n(x,{label:A(u)("Margin")},{default:d(()=>[n(D,{disabled:"",class:"fct-margin-display",value:A(xm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),n(Q,{lg:24},{default:d(()=>[o("div",$L,[(e.variant.other_info,B("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},EL={class:"fct-adjust-by-wrap"},UL={class:"fct-adjust-by-row"},IL={class:"fct-adjust-by-col"},QL={class:"title"},DL={class:"fct-adjust-by-col"},VL={class:"title"},TL={class:"fct-adjust-by-action"},Pr={__name:"StockAdjuster",props:{variant:Object,fieldKey:String,productEditModel:Object},emits:["save"],setup(e,{expose:t,emit:a}){const l=a,s=M(!1);return t({toggle:()=>s.value=!s.value}),(i,c)=>{const p=C("el-input"),f=C("el-button"),_=C("el-popover");return r(),E(_,{visible:s.value,"popper-class":"fct-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[o("div",{onClick:c[7]||(c[7]=g=>s.value=!s.value),class:"fct-stock-adjuster-trigger"},[n(J,{name:"Configuration"})])]),default:d(()=>[o("div",EL,[o("div",UL,[o("div",IL,[o("span",QL,m(A(u)("Adjust by")),1),n(p,{size:"small",placeholder:A(u)("Quantity"),type:"number",modelValue:e.variant.adjusted_quantity,"onUpdate:modelValue":c[0]||(c[0]=g=>e.variant.adjusted_quantity=g),modelModifiers:{number:!0},onKeyup:c[1]||(c[1]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g.target.value,e.fieldKey)}),onChange:c[2]||(c[2]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g,e.fieldKey)})},null,8,["placeholder","modelValue"])]),o("div",DL,[o("span",VL,m(A(u)("New Stock")),1),n(p,{size:"small",placeholder:A(u)("New Stock"),type:"number",min:1,modelValue:e.variant.new_stock,"onUpdate:modelValue":c[3]||(c[3]=g=>e.variant.new_stock=g),modelModifiers:{number:!0},onKeyup:c[4]||(c[4]=g=>{e.productEditModel.onChangeNewStock("new_stock",g.target.value,e.fieldKey)})},null,8,["placeholder","modelValue"])])]),o("div",TL,[n(f,{size:"small",type:"info",soft:"",onClick:c[5]||(c[5]=g=>s.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(f,{size:"small",type:"primary",onClick:c[6]||(c[6]=g=>{s.value=!1,l("save")}),disabled:e.variant.new_stock===""},{default:d(()=>[R(m(A(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},ML={class:"fct-shared-variant-item-box__switch"},LL={key:1,class:"fct-inline-select-wrap"},RL={key:0,class:"fct-variant-inventory-global-off",role:"alert"},OL={class:"fct-variant-inventory-global-off__text"},HL={class:"fct-variant-inventory-global-off__action"},PL={key:1,class:"fct-variant-stock-grid"},NL={class:"fct-variant-stock-box"},KL={class:"fct-stock-box-label"},GL={class:"fct-stock-box-content fct-stock-box-total-content"},jL={class:"fct-stock-number"},zL={class:"fct-variant-stock-box"},qL={class:"fct-stock-box-label"},YL={class:"fct-stock-box-content"},WL={class:"fct-stock-number"},JL={class:"fct-variant-stock-box"},XL={class:"fct-stock-box-label"},ZL={class:"fct-stock-box-content"},eR={class:"fct-stock-number"},tR={class:"fct-variant-stock-box"},aR={class:"fct-stock-box-label"},lR={class:"fct-stock-box-content"},sR={class:"fct-stock-number"},nR={key:2,class:"fct-admin-input-wrapper"},oR={key:0,class:"fct-collapse-heading"},iR={key:1,class:"fct-tag-group"},rR={class:"fct-tag-item"},dR={class:"fct-admin-input-wrapper"},uR={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},cR=["disabled"],qp={__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=N(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),s=N(()=>{var b,k,w,S;return((k=(b=t.product)==null?void 0:b.detail)==null?void 0:k.manage_stock)=="1"||((S=(w=t.product)==null?void 0:w.detail)==null?void 0:S.manage_stock)==1}),i=M(!1),c=M(!1),p=b=>{b&&f()},f=()=>{i.value||(i.value=!0,ue.put(`products/${t.product.ID}/update-manage-stock`,{manage_stock:"1"}).then(b=>{t.product.detail.manage_stock="1",(t.product.variants||[]).forEach(k=>{k.manage_stock="1"}),t.variant.manage_stock="1",t.productEditModel.updatePricingValue("manage_stock","1",t.fieldKey,t.variant,t.modeType),z.success((b==null?void 0:b.message)||u("Inventory Management enabled"))}).catch(b=>{var k;c.value=!1,(b==null?void 0:b.status_code)=="422"?z.validationErrors(b):z.error(((k=b==null?void 0:b.data)==null?void 0:k.message)||u("Failed to update inventory"))}).finally(()=>{i.value=!1}))},_=N(()=>{var b;return["simple_variations","advanced_variations"].includes((b=t.product.detail)==null?void 0:b.variation_type)}),g=b=>{t.productEditModel.updatePricingValue("manage_stock",b,t.fieldKey,t.variant,t.modeType)};Ie(()=>{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 y=()=>{let b=parseInt(t.variant.new_stock)||0;const k=t.variant.total_stock,w=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}ue.put(`products/${t.product.ID}/update-inventory/${t.variant.id}`,{total_stock:t.variant.total_stock,available:t.variant.available}).then($=>{z.success($.message)}).catch($=>{var V;t.variant.total_stock=k,t.variant.available=w,t.variant.new_stock=k,z.error(((V=$==null?void 0:$.data)==null?void 0:V.message)||u("Failed to update inventory"))})},v=()=>{var $;if(a.value)return;const b=t.product.post_title||"";if(!b)return;const w=["simple_variations","advanced_variations"].includes(($=t.product.detail)==null?void 0:$.variation_type)&&t.variant.variation_title||"",S=t.variant.id||0;a.value=!0,ue.get("products/suggest-sku",{title:b,variant_title:w,exclude_id:S}).then(V=>{V!=null&&V.sku&&(t.variant.sku=V.sku,t.productEditModel.updatePricingValue("sku",V.sku,t.fieldKey,t.variant,t.modeType))}).catch(V=>{var x;const F=((x=V==null?void 0:V.data)==null?void 0:x.message)||u("Failed to generate SKU.");z.error(F)}).finally(()=>{a.value=!1})};return(b,k)=>{var x;const w=C("el-switch"),S=C("el-option"),$=C("el-select"),V=C("el-input"),F=C("el-form-item");return r(),E(Nn,{class:de(["fct-variant-inventory",((x=e.product.detail)==null?void 0:x.variation_type)==="simple"?"fct-variant-inventory--simple":""])},oa({default:d(()=>[_.value&&!s.value?(r(),h("div",RL,[o("span",OL,[n(J,{name:"Warning"}),R(" "+m(A(u)("Enable inventory to track stock and manage availability for this product and its variations.")),1)]),o("span",HL,[n(w,{size:"small",modelValue:c.value,"onUpdate:modelValue":k[2]||(k[2]=Q=>c.value=Q),loading:i.value,disabled:i.value,onChange:p},null,8,["modelValue","loading","disabled"])])])):B("",!0),l.value&&_.value&&!e.isGroupMode?(r(),h("div",PL,[o("div",NL,[o("div",KL,m(A(u)("Total Stock")),1),o("div",GL,[o("div",jL,m(e.variant.total_stock),1),n(Pr,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:y},null,8,["variant","field-key","product-edit-model"])])]),o("div",zL,[o("div",qL,m(A(u)("Available")),1),o("div",YL,[o("div",WL,m(e.variant.available),1)])]),o("div",JL,[o("div",XL,m(A(u)("On Hold")),1),o("div",ZL,[o("div",eR,m(e.variant.on_hold),1)])]),o("div",tR,[o("div",aR,m(A(u)("Delivered")),1),o("div",lR,[o("div",sR,m(e.variant.committed),1)])])])):B("",!0),l.value&&_.value&&e.isGroupMode?(r(),h("div",nR,[n(F,{label:A(u)("Total Stock")},{default:d(()=>[n(V,{type:"number",min:0,placeholder:A(u)("Unchanged"),modelValue:e.variant.total_stock,"onUpdate:modelValue":k[3]||(k[3]=Q=>e.variant.total_stock=Q)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])])):B("",!0),e.isGroupMode?B("",!0):(r(),E(Pp,{key:3},{header:d(({isOpen:Q})=>[Q?(r(),h("div",oR,m(A(u)("More details")),1)):B("",!0),Q?B("",!0):(r(),h("div",iR,[o("div",rR,m(A(u)("SKU")),1)]))]),default:d(()=>[o("div",dR,[n(F,null,{label:d(()=>[o("div",uR,[n(fa,{title:A(u)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),o("button",{type:"button",onClick:v,disabled:!e.product.post_title||a.value,class:"underline-link-button fct-generate-sku-btn"},m(a.value?A(u)("Generating..."):A(u)("Generate SKU")),9,cR)])]),default:d(()=>[n(V,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:A(u)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":k[4]||(k[4]=Q=>e.variant.sku=Q),maxlength:"30","show-word-limit":"",onInput:k[5]||(k[5]=Q=>{e.productEditModel.updatePricingValue("sku",Q,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(ra,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}))]),_:2},[_.value?{name:"label",fn:d(()=>[R(m(A(u)("Inventory")),1)]),key:"0"}:void 0,_.value&&s.value?{name:"action",fn:d(()=>[o("div",ML,[e.isGroupMode?(r(),h("div",LL,[o("label",null,m(A(u)("Manage Stock"))+":",1),n($,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":k[1]||(k[1]=Q=>e.variant.manage_stock=Q),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(S,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(S,{value:"1",label:A(u)("Manage stock")},null,8,["label"]),n(S,{value:"0",label:A(u)("Don't manage")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),E(w,{key:0,size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":k[0]||(k[0]=Q=>e.variant.manage_stock=Q),onChange:g,"active-value":"1","inactive-value":"0"},null,8,["modelValue"]))])]),key:"1"}:void 0]),1032,["class"])}}},AR={class:"fct-shared-variant-item-box__switch"},pR={class:"fct-shared-variant-item-box__hint"},fR={key:1,class:"fct-inline-select-wrap"},mR={key:0,class:"fct-package-select-icon"},hR={class:"fct-add-new-package-option"},_R={class:"fct-package-options"},vR={class:"fct-package-options-info"},gR={class:"fct-package-options-name"},yR={class:"fct-package-options-dimensions"},bR={class:"fct-product-weight-input"},Yp={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){var k,w;const t=e,a=M(!1),l=M(!1),s=M(Ge.get("shop.shipping_packages")||[]),i=[{label:"kg",value:"kg"},{label:"g",value:"g"},{label:"lbs",value:"lbs"},{label:"oz",value:"oz"}],c={box:"Box",envelope:"Envelope",soft_package:"SoftPackage"},p=N(()=>{var $,V;const S=(V=($=t.variant)==null?void 0:$.other_info)==null?void 0:V.package_slug;return S?s.value.find(F=>F.slug===S)||null:s.value.find(F=>F.is_default)||null}),f=S=>{if(!S)return u("Select a package");const $=S.type==="envelope"?S.length+" × "+S.width+" "+S.dimension_unit:S.length+" × "+S.width+" × "+S.height+" "+S.dimension_unit;return(S.is_default?u("Store default")+" · ":"")+S.name+" - "+$+", "+S.weight+" "+S.weight_unit},_=()=>ue.get("shipping/packages").then(S=>{s.value=S.packages||s.value}).catch(()=>{Md({message:u("Failed to load packages."),type:"error"})}),g=M(((w=(k=t.variant)==null?void 0:k.other_info)==null?void 0:w.package_slug)||""),y=async S=>{if(S==="__add_new__"){t.variant.other_info.package_slug=g.value,await _(),a.value=!0;return}g.value=S||"",t.productEditModel.updatePricingOtherValue("package_slug",S,t.fieldKey,t.variant,t.modeType)},v=S=>{t.productEditModel.updatePricingOtherValue("weight_unit",S,t.fieldKey,t.variant,t.modeType)},b=S=>{const $=JSON.parse(JSON.stringify(s.value));S.is_default&&s.value.forEach(x=>{x.is_default=!1});let V=S.slug,F=1;for(;s.value.some(x=>x.slug===V);)V=S.slug+"-"+F,F++;S.slug=V,s.value.push(S),l.value=!0,ue.post("shipping/packages",{packages:s.value}).then(x=>{s.value=x.packages||s.value,a.value=!1,y(S.slug)}).catch(()=>{s.value=$,Md({message:u("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(S,$)=>{const V=C("el-switch"),F=C("el-option"),x=C("el-select"),Q=C("el-form-item"),D=C("el-col"),T=C("el-input"),U=C("el-row");return r(),h(H,null,[e.variant.other_info?(r(),E(Nn,{key:0},{label:d(()=>[R(m(A(u)("Shipping")),1)]),action:d(()=>[o("div",AR,[e.isGroupMode?(r(),h("div",fR,[o("label",null,m(A(u)("Fulfillment Type"))+":",1),n(x,{size:"small",modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":$[2]||($[2]=I=>e.variant.fulfillment_type=I),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(F,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(F,{value:"physical",label:A(u)("Physical")},null,8,["label"]),n(F,{value:"digital",label:A(u)("Digital")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(H,{key:0},[o("span",pR,m(A(u)("Physical Product")),1),n(V,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":$[0]||($[0]=I=>e.variant.fulfillment_type=I),"active-value":"physical","inactive-value":"digital",onChange:$[1]||($[1]=I=>{e.productEditModel.updatePricingValue("fulfillment_type",I,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])],64))])]),default:d(()=>[n(va,{visible:e.variant.fulfillment_type==="physical",accordion:""},{default:d(()=>[n(U,{gutter:10,class:"fct-physical-product-meta-row"},{default:d(()=>[n(D,{xs:24,sm:14,lg:14},{default:d(()=>[n(Q,null,{label:d(()=>[R(m(A(u)("Package")),1)]),default:d(()=>[n(x,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":$[3]||($[3]=I=>e.variant.other_info.package_slug=I),placeholder:A(u)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:d(()=>[p.value?(r(),h("span",mR,[n(J,{name:c[p.value.type]||"Box"},null,8,["name"])])):B("",!0)]),default:d(()=>[n(F,{value:"__add_new__",label:A(u)("Add new package")},{default:d(()=>[o("div",hR," + "+m(A(u)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(H,null,ae(s.value,I=>(r(),E(F,{key:I.slug,label:f(I),value:I.slug},{default:d(()=>[o("div",_R,[n(J,{name:c[I.type]||"Box"},null,8,["name"]),o("div",vR,[o("span",gR,m(I.is_default?A(u)("Store default")+" · ":"")+m(I.name),1),o("span",yR,m(I.type==="envelope"?I.length+" × "+I.width:I.length+" × "+I.width+" × "+I.height)+" "+m(I.dimension_unit)+", "+m(I.weight)+" "+m(I.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),n(D,{xs:24,sm:10,lg:10},{default:d(()=>[n(Q,null,{label:d(()=>[R(m(A(u)("Product weight")),1)]),default:d(()=>[o("div",bR,[n(T,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":$[5]||($[5]=I=>e.variant.other_info.weight=I),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:$[6]||($[6]=I=>{e.productEditModel.updatePricingOtherValue("weight",I,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:d(()=>[n(x,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":$[4]||($[4]=I=>e.variant.other_info.weight_unit=I),onChange:v,class:"fct-product-weight-unit"},{default:d(()=>[(r(),h(H,null,ae(i,I=>n(F,{key:I.value,label:I.label,value:I.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):B("",!0),n(cm,{modelValue:a.value,"onUpdate:modelValue":$[7]||($[7]=I=>a.value=I),saving:l.value,onSave:b},null,8,["modelValue","saving"])],64)}}},wR={key:0,class:"fct-tax-class-control"},CR={class:"fct-inline-select-wrap"},kR={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},BR=["title"],xR={key:1,class:"fct-tax-class-control"},SR={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},FR=["title"],Wp={__name:"VariationTaxClass",props:{variant:Object,productEditModel:Object,fieldKey:String,modeType:String,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=M([]),l=S=>{if(!S)return"standard";const $=a.value.find(F=>String(F.slug)===String(S));if($)return $.slug;const V=a.value.find(F=>String(F.id)===String(S));return V?V.slug:S},s=N(()=>it.get(t.variant,"other_info.tax_exempt","no")),i=N(()=>{const S=it.get(t.variant,"other_info.tax_class","standard");return l(S)||"standard"}),c=M(s.value!=="yes"),p=M(i.value||"standard");be([s,i,a],([S,$])=>{c.value=S!=="yes",p.value=$||"standard"});const f=()=>{t.variant.other_info||(t.variant.other_info={})},_=(S,$)=>{f(),t.variant.other_info.tax_exempt=S,t.variant.other_info.tax_class=$||"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=()=>{ue.get("tax/classes").then(S=>{a.value=S.classes||[]}).catch(()=>{z.error(u("Failed to load tax classes"))})},y=S=>{const $=p.value||i.value||"standard";c.value=S,p.value=$,_(S?"no":"yes",$)},v=S=>{p.value=S,c.value=!0,_("no",S)},b=()=>{const S=a.value.find($=>$.slug===p.value);return S?S.title:"Standard"},k=()=>{var V,F;const S=(F=(V=t.variant)==null?void 0:V.other_info)==null?void 0:F.tax_class;if(!S)return u("Unchanged");const $=a.value.find(x=>x.slug===S);return $?$.title:S},w=S=>{t.variant.other_info&&(t.variant.other_info.tax_class=S)};return Ie(()=>{g()}),(S,$)=>{const V=C("el-option"),F=C("el-select"),x=C("el-dropdown-item"),Q=C("el-dropdown-menu"),D=C("el-dropdown"),T=C("el-checkbox");return r(),E(Nn,null,{label:d(()=>[R(m(A(u)("Tax")),1)]),default:d(()=>[e.isGroupMode?(r(),h("div",wR,[o("div",CR,[o("label",null,m(A(u)("Tax Exemption"))+":",1),n(F,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":$[0]||($[0]=U=>e.variant.other_info.tax_exempt=U),size:"small",class:"fct-inline-select",placement:"bottom","popper-class":"fct-group-select-popper"},{default:d(()=>[n(V,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(V,{value:"no",label:A(u)("Charge tax")},null,8,["label"]),n(V,{value:"yes",label:A(u)("Tax exempt")},null,8,["label"])]),_:1},8,["modelValue"])]),e.variant.other_info.tax_exempt==="no"&&a.value.length>=1?(r(),h("div",kR,[o("span",null,[R(m(A(u)("Class:"))+" ",1),o("strong",{class:de(e.variant.other_info.tax_class&&e.variant.other_info.tax_class!=="standard"?"text-red-500 dark:text-red-400":"")},m(k()),3)]),a.value.length>1?(r(),E(D,{key:0,trigger:"click",onCommand:w},{dropdown:d(()=>[n(Q,null,{default:d(()=>[n(x,{command:null,class:de({"is-active":!e.variant.other_info.tax_class})},{default:d(()=>[R(m(A(u)("Unchanged")),1)]),_:1},8,["class"]),(r(!0),h(H,null,ae(a.value,U=>(r(),E(x,{key:U.slug,command:U.slug,class:de({"is-active":e.variant.other_info.tax_class===U.slug})},{default:d(()=>[R(m(U.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:d(()=>[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:A(u)("Change tax class")},$[2]||($[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,BR)]),_:1})):B("",!0)])):B("",!0)])):(r(),h("div",xR,[n(T,{class:"fct-tax-class-control__checkbox",modelValue:c.value,"onUpdate:modelValue":$[1]||($[1]=U=>c.value=U),onChange:y},{default:d(()=>[R(m(A(u)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),c.value&&a.value.length>=1?(r(),h("div",SR,[o("span",null,[R(m(A(u)("Class:"))+" ",1),o("strong",{class:de(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},m(b()),3)]),a.value.length>1?(r(),E(D,{key:0,trigger:"click",onCommand:v},{dropdown:d(()=>[n(Q,null,{default:d(()=>[(r(!0),h(H,null,ae(a.value,U=>(r(),E(x,{key:U.slug,command:U.slug,class:de({"is-active":p.value===U.slug})},{default:d(()=>[R(m(U.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:d(()=>[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:A(u)("Change tax class")},$[3]||($[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,FR)]),_:1})):B("",!0)])):B("",!0)]))]),_:1})}}},$R={class:"fct-product-pricing-form-wrap"},ER={class:"fct-product-pricing-form-inner"},UR={key:0,class:"dialog-footer"},IR={class:"fct-btn-group sm"},Ud={__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,s=M({}),i=a,c=_s(),p=M(0),f=M(!1),_=M({}),g=M(null),y=M(!1),v=L=>L?JSON.parse(JSON.stringify(L)):{},b=(L=l.modeType,P=l.index)=>{var X,G,te;if(L==="create")return"create";if(L==="duplicate"){const ne=(X=l.product.variants)==null?void 0:X[P];return`duplicate-${(ne==null?void 0:ne.id)??P??"draft"}`}if(((G=l.product.detail)==null?void 0:G.variation_type)==="simple")return"simple-0";const q=(te=l.product.variants)==null?void 0:te[P];return`update-${(q==null?void 0:q.id)??P??"draft"}`},k=(L=l.modeType,P=l.index,q=s.value)=>({modeType:L,index:P,variant:v(q)}),w=()=>{if(y.value){y.value=!1;return}!g.value||f.value||!p.value||(_.value[g.value]=k())},S=()=>{var L;(L=s.value)!=null&&L.other_info&&(s.value.other_info.payment_type||(s.value.other_info.payment_type="onetime"),s.value.other_info.weight_unit||(s.value.other_info.weight_unit=x.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},$=async()=>{var P,q,X,G;w(),f.value=!0,p.value=0,g.value=b();const L=(P=_.value[g.value])==null?void 0:P.variant;if(L){s.value=v(L),S(),await ke(),p.value=1,f.value=!1;return}((q=l.product.detail)==null?void 0:q.variation_type)==="simple"?Array.isArray(l.product.variants)&&l.product.variants.length===0?(s.value=l.productEditModel.addDummyVariant(),s.value.variation_title=l.product.post_title):s.value=l.product.variants[0]:l.modeType==="create"?s.value=l.productEditModel.addDummyVariant():l.modeType==="update"?s.value=v((X=l.product.variants)==null?void 0:X[l.index]):l.modeType==="duplicate"?(s.value=v((G=l.product.variants)==null?void 0:G[l.index]),s.value.serial_index=l.productEditModel.variantsLength()+1,s.value.variation_title=`${u("Copy of")} ${s.value.variation_title||""}`.trim(),s.value.sku="",s.value.on_hold=0,s.value.committed=0,s.value.available=s.value.total_stock??0,delete s.value.id):s.value={},S(),await ke(),p.value=0,f.value=!1},V=async()=>{var L;try{let P=l.index;const q=v(s.value);l.modeType==="duplicate"&&(P=l.productEditModel.variantsLength(),q.rowId=(q.rowId??0)+1);let X=await l.productEditModel.createOrUpdatePricing(q);return(L=X==null?void 0:X.data)!=null&&L.id?(q.id=X.data.id,l.productEditModel.afterCreatingOrUpdatingPricing(P,q),P==null&&(P=l.product.variants.findIndex(G=>(G==null?void 0:G.id)===q.id),P===-1&&(P=l.product.variants.length-1)),g.value&&delete _.value[g.value],p.value=0,i("createOrUpdateVariant",{index:P,modeType:l.modeType,variant:v(q)}),{index:P,modeType:l.modeType,variant:v(q)}):null}catch{return null}},F=async()=>V(),x=N(()=>Ge.get("shop.weight_unit")||"kg"),Q=()=>{const L={..._.value};return g.value&&p.value&&(L[g.value]=k()),Object.entries(L)},D=()=>Q().length>0,T=()=>Q().length,U=N(()=>Q().length),I=async()=>{y.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await $()};return be(s,()=>{f.value||p.value++},{deep:!0}),be(()=>[l.modeType,l.index],()=>{$()},{immediate:!0}),be(U,L=>{i("dirtyStateChange",!!L)},{immediate:!0}),c.bind(["mod+s"],L=>{var P,q;((q=(P=l.product)==null?void 0:P.detail)==null?void 0:q.variation_type)!=="simple"&&(L.preventDefault(),p.value&&F())}),xt(()=>{c.unbind("mod+s")}),t({hasDirtyDrafts:D,getDirtyDraftCount:T,discardDrafts:I,saveCurrentDraft:V,loadVariantFromProps:$,getVariantData:()=>v(s.value)}),(L,P)=>{const q=C("el-form"),X=C("el-button");return r(),h("div",$R,[o("div",ER,[n(q,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(G7,{variant:s.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"]),n(zp,{variant:s.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"]),n(qp,{variant:s.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"]),n(Yp,{variant:s.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(Wp,{key:0,variant:s.value,"product-edit-model":e.productEditModel,"field-key":l.fieldKey,"mode-type":e.modeType},null,8,["variant","product-edit-model","field-key","mode-type"])):B("",!0)]),_:1})]),e.modeType!=="add"?(r(),h("div",UR,[o("div",IR,[U.value?(r(),E(X,{key:0,onClick:I},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1})):B("",!0),n(X,{onClick:P[0]||(P[0]=()=>{i("closeModal")})},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(X,{disabled:e.productEditModel.saving||e.modeType==="update"&&!U.value,onClick:F,type:"primary",loading:e.productEditModel.saving},{default:d(()=>[R(m(typeof s.value.id>"u"?A(u)("Save"):A(u)("Update")),1)]),_:1},8,["disabled","loading"])])])):B("",!0)])}}},QR={class:"fct-product-button-and-drawer-wrap"},DR={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},VR={key:1,class:"fct-btn-group sm"},TR={class:"more-btn"},ar={__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 s=M(null);const i=M(1),c=(v="update")=>{l("open-editor",{modeType:v,index:a.index??null})},p=N(()=>{var v;return{product:a.product,variant:a.variant,index:a.index,productEditModel:a.productEditModel,openPricingModal:b=>{c(b)},vueContext:(v=Yt())==null?void 0:v.ctx}}),f=M([]),_=()=>{var w,S;const v=((w=window==null?void 0:window.fluent_cart_admin)==null?void 0:w.hooks)||(window==null?void 0:window.fluentCartAdminHooks),b=[],k=(S=v==null?void 0:v.applyFilters)==null?void 0:S.call(v,"fluent_cart_product_pricing_actions_dropdown_items",b,p.value);f.value=Array.isArray(k)?k:b},g=v=>v?typeof v.disabled=="function"?!!v.disabled(p.value):!!v.disabled:!1;Ie(()=>{s.value=a.index,_(),setTimeout(_,0)});const y=v=>{var b,k;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const w=((b=window==null?void 0:window.fluent_cart_admin)==null?void 0:b.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(k=w==null?void 0:w.doAction)==null?void 0:k.call(w,"fluent_cart_product_pricing_actions_dropdown_command",v.command,p.value,v)}}v==="duplicate_pricing"?c("duplicate"):v==="delete_variant"&&a.productEditModel.deletePricing(a.variant.id,a.index)};return(v,b)=>{const k=C("el-button"),w=C("el-checkbox"),S=C("el-dropdown-item"),$=C("el-dropdown-menu"),V=C("el-dropdown");return r(),h("div",QR,[a.modeType=="add"?(r(),h("div",DR,[e.product.detail.variation_type!=="simple"?(r(),E(k,{key:0,text:"",type:"primary",onClick:b[0]||(b[0]=F=>c("create"))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(e.product.variants.length>0?v.$t("Add more"):v.$t("Add Pricing")),1)]),_:1})):B("",!0)])):B("",!0),a.modeType=="action"?(r(),h("div",VR,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:b[1]||(b[1]=F=>c("update"))},{default:d(()=>[n(J,{name:"Edit"})]),_:1}),n(V,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:b[5]||(b[5]=F=>{F&&_()})},{dropdown:d(()=>[n($,null,{default:d(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),E(S,{key:0,class:"item-checkbox"},{default:d(()=>[n(w,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":b[2]||(b[2]=F=>e.variant.manage_stock=F),onChange:b[3]||(b[3]=F=>{e.productEditModel.onChangePricing("manage_stock",A(s),F)}),"true-value":"0","false-value":"1"},{default:d(()=>[R(m(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):B("",!0),n(S,{class:"show-on-mobile",onClick:b[4]||(b[4]=F=>c("update"))},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),E(S,{key:1,command:"duplicate_pricing"},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+m(v.$t("Duplicate")),1)]),_:1})):B("",!0),n(S,null,{default:d(()=>[e.variant.id?(r(),E(Ia,{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"])):B("",!0)]),_:1}),n(S,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:d(()=>{var F;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(r(),E(Ia,{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(H,{key:1},[n(J,{name:"Copy"}),R(" "+m(v.$t("Direct Checkout"))+" ",1),n(fa,{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(H,null,ae(f.value,(F,x)=>(r(),E(S,{key:"js_item_"+x,command:F,class:de(F==null?void 0:F.class),divided:!!(F!=null&&F.divided),disabled:g(F)},{default:d(()=>[F!=null&&F.icon?(r(),E(J,{key:0,name:F.icon},null,8,["name"])):B("",!0),R(" "+m(F==null?void 0:F.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>i.value?(r(),E(S,{key:2,command:"delete_variant",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(v.$t("Delete")),1)]),_:1})):B("",!0)]),_:1})]),default:d(()=>[o("span",TR,[n(J,{name:"More"})])]),_:1})])):B("",!0)])}}},MR={class:"fct-variant-pricing-add-button-wrap"},LR={__name:"VariantPricingAddButton",props:{product:Object,drawerMode:String,isVariationDirty:Boolean},emits:["open-editor"],setup(e,{emit:t}){const a=e,l=t,s=()=>{l("open-editor",{modeType:"create"})},i=()=>a.drawerMode==="create"||a.isVariationDirty;return(c,p)=>{var _;const f=C("el-button");return r(),h("div",MR,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),E(f,{key:0,text:"",type:"primary",disabled:i(),onClick:s,size:"small"},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(e.product.variants.length>0?c.$t("Add more"):c.$t("Add Pricing")),1)]),_:1},8,["disabled"])):B("",!0)])}}},RR={class:"fct-shared-variant-nav__summary"},OR={class:"fct-shared-variant-nav__summary-product"},HR={class:"fct-shared-variant-nav__summary-product-name"},PR={class:"fct-shared-variant-nav__summary-meta"},NR={class:"fct-shared-variant-nav__status"},KR={class:"fct-shared-variant-nav__variant-count"},Nr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",RR,[o("div",OR,[o("h3",HR,m(e.product.post_title||A(u)("Untitled product")),1)]),o("div",PR,[o("span",NR,[n(ma,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",KR,m(e.product.variants.length)+" "+m(A(u)("variants")),1)])]))}},GR={class:"fct-shared-variant-nav__group-header"},jR=["aria-expanded","onClick"],zR={class:"fct-shared-variant-nav__group-caret"},qR={class:"fct-shared-variant-nav__group-title"},YR={class:"fct-shared-variant-nav__group-count"},WR=["aria-label","onClick"],JR={class:"fct-shared-variant-nav__group-body"},XR=["disabled","aria-current","onClick"],ZR={class:"fct-shared-variant-nav__item-image-wrapper"},eO={class:"fct-shared-variant-nav__item-image"},tO=["src","alt"],aO=["src","alt"],lO={key:0,class:"fct-shared-variant-nav__item-dot"},sO={class:"fct-shared-variant-nav__item-content"},nO={class:"fct-shared-variant-nav__item-title"},oO={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},iO={class:"fct-shared-variant-nav__item-meta"},rO=["disabled","aria-label"],dO=["disabled","aria-label"],uO={class:"more-btn"},cO=["disabled","aria-current","onClick"],AO={class:"fct-shared-variant-nav__item-image-wrapper"},pO={class:"fct-shared-variant-nav__item-image"},fO=["src","alt"],mO=["src","alt"],hO={key:0,class:"fct-shared-variant-nav__item-dot"},_O={class:"fct-shared-variant-nav__item-content"},vO={class:"fct-shared-variant-nav__item-title"},gO={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},yO={class:"fct-shared-variant-nav__item-meta"},bO=["disabled","aria-label"],wO=["disabled","aria-label"],CO={class:"more-btn"},Jp={__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=()=>ms.getUrl("images/placeholder.svg"),l=e,s=k=>{const w=l.isDirty&&l.activeKey!==k.key,S=l.drawerMode==="create"&&k.key!=="draft-variation";return w||S},i=t,c=N(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=M(null),f=(k,w)=>{for(const S of k||[])if((S.items||[]).some($=>$.key===w))return String(S.termId);return null};be(()=>l.groupedItems,k=>{if(!Array.isArray(k)||!k.length){p.value=null;return}p.value=f(k,l.activeKey)||String(k[0].termId)},{immediate:!0}),be(()=>l.activeKey,k=>{if(!c.value||k==null)return;const w=f(l.groupedItems,k);w&&(p.value=w)});const _=k=>String(k.termId)===p.value,g=k=>{const w=String(k.termId);p.value=p.value===w?null:w},y=M(null);let v=null;const b=()=>{v&&clearTimeout(v),ke(()=>{v=setTimeout(()=>{var w;v=null;const k=(w=y.value)==null?void 0:w.querySelector(".fct-shared-variant-nav__item-shell.is-active");k&&k.scrollIntoView({block:"center"})},240)})};return Ie(b),be(()=>l.activeKey,()=>b()),vl(()=>{v&&clearTimeout(v)}),(k,w)=>{const S=C("el-dropdown-item"),$=C("el-dropdown-menu"),V=C("el-dropdown");return r(),h("div",{ref_key:"listRef",ref:y,class:"fct-shared-variant-nav__list"},[c.value?(r(!0),h(H,{key:0},ae(e.groupedItems,F=>(r(),h("div",{key:"g-"+F.termId,class:de(["fct-shared-variant-nav__group",{"is-collapsed":!_(F)}])},[o("div",GR,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_(F)?"true":"false",onClick:x=>g(F)},[o("span",zR,[n(J,{name:_(F)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",qR,m(F.title),1),o("span",YR,m(A(u)("%1$s variants",F.count)),1)],8,jR),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":A(u)("Edit group"),onClick:Ne(x=>i("edit-group",F),["stop"])},[n(J,{name:"Edit"})],8,WR)]),n(va,{visible:_(F),accordion:"",duration:220},{default:d(()=>[o("div",JR,[(r(!0),h(H,null,ae(F.items,x=>{var Q,D,T,U,I,O,L,P;return r(),h("div",{key:x.key,class:de(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===x.key,"is-draft":x.isDraft}])},[o("button",{type:"button",class:de(["fct-shared-variant-nav__item",{"is-disabled":s(x)}]),disabled:s(x),"aria-current":e.activeKey===x.key?"true":void 0,onClick:q=>!s(x)&&i("select",x)},[o("div",ZR,[o("div",eO,[(T=(D=(Q=x.variant)==null?void 0:Q.media)==null?void 0:D[0])!=null&&T.url?(r(),h("img",{key:0,src:(O=(I=(U=x.variant)==null?void 0:U.media)==null?void 0:I[0])==null?void 0:O.url,alt:x.label},null,8,tO)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:x.label},null,8,aO))]),e.activeKey===x.key?(r(),h("span",lO)):B("",!0)]),o("div",sO,[o("span",nO,[R(m(x.label)+" ",1),((L=x.variant)==null?void 0:L.item_status)==="inactive"&&((P=e.product.detail)==null?void 0:P.variation_type)==="advanced_variations"?(r(),h("span",oO,m(A(u)("Inactive")),1)):B("",!0)]),o("span",iO,m(x.meta),1)])],10,XR),e.isDirty&&e.activeKey===x.key?(r(),h("button",{key:0,type:"button",class:de(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:w[0]||(w[0]=q=>i("save")),"aria-label":A(u)("Save variant")},[e.isSaving?(r(),E(J,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(J,{key:0,name:"Save"}))],10,rO)):B("",!0),x.isDraft?B("",!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:s(x),onCommand:q=>!s(x)&&i("command",q,x)},{dropdown:d(()=>[n($,null,{default:d(()=>{var q,X,G,te,ne;return[["simple","advanced_variations"].includes((q=e.product.detail)==null?void 0:q.variation_type)?B("",!0):(r(),E(S,{key:0,command:"duplicate"},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:1})),n(S,{command:"copy_variation_id"},{default:d(()=>[n(J,{name:"Copy"}),R(" "+m(A(u)("Copy Variation ID")),1)]),_:1}),n(S,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(x)},{default:d(()=>[n(J,{name:"Copy"}),R(" "+m(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(X=x.variant)!=null&&X.id&&((G=e.product.detail)==null?void 0:G.variation_type)==="advanced_variations"?(r(),E(S,{key:1,command:"toggle_status",class:de({"item-destructive":((te=x.variant)==null?void 0:te.item_status)!=="inactive"})},{default:d(()=>{var re,K;return[n(J,{name:((re=x.variant)==null?void 0:re.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(((K=x.variant)==null?void 0:K.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):B("",!0),((ne=e.product.detail)==null?void 0:ne.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(S,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:1})):B("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:de(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(x)}]),disabled:s(x),onClick:w[1]||(w[1]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",uO,[n(J,{name:"More"})])],10,dO)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),h(H,{key:1},ae(e.items,F=>{var x,Q,D,T,U,I,O,L;return r(),h("div",{key:F.key,class:de(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===F.key,"is-draft":F.isDraft}])},[o("button",{type:"button",class:de(["fct-shared-variant-nav__item",{"is-disabled":s(F)}]),disabled:s(F),"aria-current":e.activeKey===F.key?"true":void 0,onClick:P=>!s(F)&&i("select",F)},[o("div",AO,[o("div",pO,[(D=(Q=(x=F.variant)==null?void 0:x.media)==null?void 0:Q[0])!=null&&D.url?(r(),h("img",{key:0,src:(I=(U=(T=F.variant)==null?void 0:T.media)==null?void 0:U[0])==null?void 0:I.url,alt:F.label},null,8,fO)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:F.label},null,8,mO))]),e.activeKey===F.key?(r(),h("span",hO)):B("",!0)]),o("div",_O,[o("span",vO,[R(m(F.label)+" ",1),((O=F.variant)==null?void 0:O.item_status)==="inactive"&&((L=e.product.detail)==null?void 0:L.variation_type)==="advanced_variations"?(r(),h("span",gO,m(A(u)("Inactive")),1)):B("",!0)]),o("span",yO,m(F.meta),1)])],10,cO),e.isDirty&&e.activeKey===F.key?(r(),h("button",{key:0,type:"button",class:de(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:w[2]||(w[2]=P=>i("save")),"aria-label":A(u)("Save variant")},[e.isSaving?(r(),E(J,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(J,{key:0,name:"Save"}))],10,bO)):B("",!0),F.isDraft?B("",!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:s(F),onCommand:P=>!s(F)&&i("command",P,F)},{dropdown:d(()=>[n($,null,{default:d(()=>{var P,q,X,G,te;return[["simple","advanced_variations"].includes((P=e.product.detail)==null?void 0:P.variation_type)?B("",!0):(r(),E(S,{key:0,command:"duplicate"},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:1})),n(S,{command:"copy_variation_id"},{default:d(()=>[n(J,{name:"Copy"}),R(" "+m(A(u)("Copy Variation ID")),1)]),_:1}),n(S,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(F)},{default:d(()=>[n(J,{name:"Copy"}),R(" "+m(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(q=F.variant)!=null&&q.id&&((X=e.product.detail)==null?void 0:X.variation_type)==="advanced_variations"?(r(),E(S,{key:1,command:"toggle_status",class:de({"item-destructive":((G=F.variant)==null?void 0:G.item_status)!=="inactive"})},{default:d(()=>{var ne,re;return[n(J,{name:((ne=F.variant)==null?void 0:ne.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(((re=F.variant)==null?void 0:re.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):B("",!0),((te=e.product.detail)==null?void 0:te.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(S,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:1})):B("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:de(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(F)}]),disabled:s(F),onClick:w[3]||(w[3]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",CO,[n(J,{name:"More"})])],10,wO)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},kO={class:"fct-shared-variant-nav-mobile"},BO=["disabled","onClick"],Xp={__name:"VariantNavMobile",props:{items:Array,activeKey:[String,Number],isDirty:Boolean},emits:["select"],setup(e,{emit:t}){const a=t;return(l,s)=>(r(),h("div",kO,[(r(!0),h(H,null,ae(e.items,i=>(r(),h("button",{key:`mobile-${i.key}`,type:"button",class:de(["fct-shared-variant-nav-mobile__item",{"is-active":e.activeKey===i.key,"is-draft":i.isDraft}]),disabled:e.isDirty&&e.activeKey!==i.key,onClick:c=>a("select",i)},m(i.label),11,BO))),128))]))}},xO={class:"fct-product-pricing-table-wrap"},SO={class:"fct-table-draggable hide-on-mobile"},FO={class:"is-right"},$O={key:0,class:"fct-drag-handle drag-icon"},EO=["src","alt"],UO=["src"],IO={class:"fct-product-pricing-table-item"},QO={key:0,class:"fct-variant-badge"},DO={class:"fct-product-pricing-table-item"},VO={key:0,class:"fct-variant-badge fct-variant-badge--light"},TO={class:"fct-product-pricing-table-item"},MO={class:"is-right"},LO={class:"fct-product-pricing-table-item"},RO={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},OO={key:0,class:"fct-drag-handle drag-icon"},HO={class:"fct-product-pricing-table-mobile-item-inner"},PO={class:"fct-product-pricing-table-item"},NO={class:"media"},KO=["src","alt"],GO=["src"],jO={class:"fct-product-pricing-table-item-content"},zO={class:"title"},qO={key:0,class:"fct-variant-badge"},YO={key:0,class:"compare-price"},WO={class:"price"},JO={key:0,class:"capitalize"},XO={key:0,class:"fct-product-pricing-table-item-action"},ZO={class:"fct-shared-variant-drawer__layout"},eH={key:0,class:"fct-shared-variant-nav"},tH={class:"fct-shared-variant-drawer__content"},aH={class:"fct-shared-variant-drawer__form"},lH={class:"fct-variant-dirty-dialog__header"},sH={class:"dialog-footer"},nH={class:"fct-btn-group sm"},Zu=1040,oH=1060,iH={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=M(typeof window<"u"?window.innerWidth:Zu),l=M(0),s=()=>{if(typeof window>"u")return 0;const me=document.querySelector("#adminmenuwrap");if(!me)return 0;const ye=window.getComputedStyle(me);return ye.display==="none"||ye.visibility==="hidden"?0:Math.round(me.getBoundingClientRect().width)},i=()=>{typeof window>"u"||(a.value=window.innerWidth,l.value=s())};Ie(()=>{i(),window.addEventListener("resize",i),setTimeout(()=>{document.querySelectorAll(".el-input__wrapper input[type='number']").forEach(ye=>{ye.addEventListener("wheel",se=>{document.activeElement===ye&&se.preventDefault()})}),t.product.variants.filter(ye=>{const se=ye.media?ye.media.meta_value||[]:[];return ye.media=se})},50)}),xt(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const c=N(()=>({animation:600,ghostClass:"ghost"})),p=M(!1),f=M("update"),_=M(null),g=M(null),y=M(!1),v=M(!1),b=M(null),k=M(!1),w=N(()=>Math.max(a.value-l.value,360)),S=N(()=>w.value<=oH),$=N(()=>{let me=24;a.value<=640?me=12:a.value<=900&&(me=16);const ye=Math.max(w.value-me,320);return`${Math.min(Zu,ye)}px`}),V=(me,ye)=>(me==null?void 0:me.variation_title)||`${u("Variation")} ${ye+1}`,F=me=>{var se,fe;const ye=(me==null?void 0:me.item_price)??"";return ye===""||ye===null||ye===void 0?u("No price set"):`${((fe=(se=window.appVars)==null?void 0:se.shop)==null?void 0:fe.currency_sign)||"$"} ${ye}`},x=me=>typeof me=="number"&&me>=0&&me<t.product.variants.length?me:t.product.variants.length?0:null,Q=({modeType:me="update",index:ye=null}={})=>{f.value=me,_.value=me==="create"?null:x(ye),k.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},D=()=>{k.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},T=()=>{y.value=!1,v.value=!1,b.value=null},U=()=>{var me,ye;return((ye=(me=g.value)==null?void 0:me.hasDirtyDrafts)==null?void 0:ye.call(me))??!1},I=me=>{me&&(f.value=me.modeType,_.value=me.index,t.productEditModel.setValidationErrors({}))},O=async(me,ye)=>{var se,fe;if(!(!ye||!me)){if(me==="duplicate"){Q({modeType:"duplicate",index:ye.index});return}if(me==="delete"&&((se=ye.variant)!=null&&se.id)){t.productEditModel.deletePricing(ye.variant.id,ye.index).then(async()=>{var $e,tt;await ke(),t.product.variants.length>0?(f.value="update",_.value=Math.min(ye.index,t.product.variants.length-1),k.value=!1,(tt=($e=g.value)==null?void 0:$e.loadVariantFromProps)==null||tt.call($e)):D()}).catch(()=>{});return}if(me==="copy_variation_id"&&((fe=ye.variant)!=null&&fe.id)){Zl.copy(String(ye.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}me==="copy_direct_checkout"&&L(ye)&&Zl.copy(P(ye),{successMessage:u("Direct checkout link copied to clipboard")})}},L=me=>{var ye,se;return!!((ye=me==null?void 0:me.variant)!=null&&ye.id)&&["publish","private"].includes((se=t.product)==null?void 0:se.post_status)},P=me=>`${Ge.get("frontend_url")}=instant_checkout&item_id=${me.variant.id}&quantity=1`,q=()=>{const me=b.value;if(T(),!!me&&me.type==="close"){if(typeof me.done=="function"){me.done();return}D()}},X=()=>{T()},G=async()=>{var me,ye;await((ye=(me=g.value)==null?void 0:me.discardDrafts)==null?void 0:ye.call(me)),q()},te=async()=>{var ye;if(!((ye=g.value)!=null&&ye.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){q();return}v.value=!1,X()},ne=me=>{if(!U()){me();return}b.value={type:"close",done:me},y.value=!0},re=()=>{ne(()=>{D()})},K=me=>{k.value=me},Y=me=>{me&&(f.value="update",typeof me.index=="number"&&me.index>=0?_.value=me.index:_.value=x(_.value),k.value=!1,t.productEditModel.setValidationErrors({}))},W=(me,ye)=>{const se=V(me,ye);return`${u("Copy of")} ${se}`},j=N(()=>{var ye;const me=(t.product.variants||[]).map((se,fe)=>({key:(se==null?void 0:se.id)??`variant-${fe}`,index:fe,variant:se,label:V(se,fe),meta:F(se),modeType:"update",isDraft:!1}));if(p.value&&f.value==="create"&&me.push({key:"draft-variation",index:null,label:u("New variation"),meta:u("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&f.value==="duplicate"){const se=(ye=t.product.variants)==null?void 0:ye[_.value];me.push({key:"duplicate-variation",index:_.value,variant:se,label:W(se,_.value??0),meta:u("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return me}),ie=N(()=>{var ye;if(f.value==="create"&&_.value===null)return"draft-variation";if(f.value==="duplicate")return"duplicate-variation";const me=(ye=t.product.variants)==null?void 0:ye[_.value];return(me==null?void 0:me.id)??`variant-${_.value??0}`}),he=me=>{me&&(k.value&&ie.value!==me.key||I(me))};return(me,ye)=>{const se=C("el-input"),fe=C("el-drawer"),$e=C("el-button"),tt=C("el-dialog");return r(),h("div",xO,[o("div",SO,[o("table",null,[ye[5]||(ye[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,[ye[4]||(ye[4]=o("th",null,null,-1)),o("th",null,m(me.$t("Image")),1),o("th",null,m(me.$t("Title")),1),o("th",null,m(me.$t("Price")),1),o("th",null,m(me.$t("Compare at price")),1),o("th",FO,m(me.$t("Action")),1)])]),n(A(an),ya(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:ye[0]||(ye[0]=ve=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,(ve,Je)=>{var vt,Ye,xe,Ee;return r(),h("tr",{key:ve.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),h("span",$O,[n(J,{name:"ReorderDotsVertical"})])):B("",!0)]),o("td",null,[e.readonly?ve.media&&ve.media[0]?(r(),h("img",{key:1,src:ve.media[0].url,alt:ve.variation_title,class:"fct-variant-thumb-readonly"},null,8,EO)):(r(),h("img",{key:2,src:me.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,UO)):(r(),E(hl,{key:0,modelValue:ve.media,"onUpdate:modelValue":Oe=>ve.media=Oe,compact:!0,"max-thumbs":1,onChange:Oe=>e.productEditModel.onUploadPricingMedia("media",Je,Oe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("td",null,[o("div",IO,[n(se,{class:de(e.productEditModel.hasValidationError(`variants.${Je}.variation_title`)?"is-error":""),id:`variants.${Je}.variation_title`,placeholder:me.$t("e.g. Small, Medium, Large"),type:"text",modelValue:ve.variation_title,"onUpdate:modelValue":Oe=>ve.variation_title=Oe,onInput:Oe=>{e.productEditModel.onChangePricing("variation_title",Je,Oe)},disabled:((Ye=(vt=e.product)==null?void 0:vt.detail)==null?void 0:Ye.variation_type)==="simple"||e.readonly,onFocus:Oe=>e.productEditModel.clearValidationError(`variants.${Je}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((xe=ve.other_info)==null?void 0:xe.installment)==="yes"?(r(),h("span",QO,m(ve.other_info.times)+" "+m(A(u)("Installment")),1)):B("",!0)])]),o("td",null,[o("div",DO,[n(Yl,{placeholder:me.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Je}.item_price`)?"is-error":"",id:`variants.${Je}.item_price`,"model-value":ve.item_price,disabled:ve.expanded||e.readonly,"onUpdate:modelValue":Oe=>{e.readonly||(ve.item_price=Oe,e.productEditModel.onChangePricing("item_price",Je,Oe),e.productEditModel.clearValidationError(`variants.${Je}.item_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((Ee=ve.other_info)==null?void 0:Ee.payment_type)==="subscription"?(r(),h("span",VO,m(ve.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",TO,[n(Yl,{placeholder:me.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${Je}.compare_price`)?"is-error":"",id:`variants.${Je}.compare_price`,"model-value":ve.compare_price,disabled:ve.expanded||e.readonly,"onUpdate:modelValue":Oe=>{e.readonly||(ve.compare_price=Oe,e.productEditModel.onChangePricing("compare_price",Je,Oe),e.productEditModel.clearValidationError(`variants.${Je}.compare_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),o("td",MO,[o("div",LO,[e.readonly?B("",!0):(r(),E(ar,{key:0,modeType:"action",index:Je,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:Q},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",RO,[n(A(an),ya(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:ye[1]||(ye[1]=ve=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,(ve,Je)=>{var vt,Ye;return r(),h("div",{key:ve.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),h("span",OO,[n(J,{name:"ReorderDotsVertical"})])):B("",!0),o("div",HO,[o("div",PO,[o("div",NO,[e.readonly?ve.media&&ve.media[0]?(r(),h("img",{key:1,src:ve.media[0].url,alt:ve.variation_title,class:"fct-variant-thumb-readonly"},null,8,KO)):(r(),h("img",{key:2,src:me.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,GO)):(r(),E(hl,{key:0,modelValue:ve.media,"onUpdate:modelValue":xe=>ve.media=xe,compact:!0,"max-thumbs":1,onChange:xe=>e.productEditModel.onUploadPricingMedia("media",Je,xe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",jO,[o("div",zO,[R(m(ve.variation_title)+" ",1),((vt=ve.other_info)==null?void 0:vt.installment)==="yes"?(r(),h("span",qO,m(ve.other_info.times)+" "+m(A(u)("Installment")),1)):B("",!0)]),o("ul",null,[o("li",null,[ve.compare_price?(r(),h("div",YO,[o("span",null,m(me.appVars.shop.currency_sign),1),R(" "+m(A(Gt)(ve.compare_price,!1)),1)])):B("",!0),o("div",WO,[o("span",null,m(me.appVars.shop.currency_sign),1),R(" "+m(A(Gt)(ve.item_price,!1)),1)])]),((Ye=ve.other_info)==null?void 0:Ye.payment_type)==="subscription"?(r(),h("li",JO,m(ve.other_info.repeat_interval),1)):B("",!0)])])]),e.readonly?B("",!0):(r(),h("div",XO,[n(ar,{modeType:"action",index:Je,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:Q},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?B("",!0):(r(),E(ar,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:Q},null,8,["product","productEditModel"])),n(fe,{modelValue:p.value,"onUpdate:modelValue":ye[2]||(ye[2]=ve=>p.value=ve),title:me.$t("Pricing"),size:$.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":ne,class:"fct-shared-variant-drawer",onClose:D},{default:d(()=>[o("div",ZO,[S.value?B("",!0):(r(),h("aside",eH,[n(Nr,{product:e.product},null,8,["product"]),n(Jp,{items:j.value,"active-key":ie.value,"is-dirty":k.value,"drawer-mode":f.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":L,"is-saving":v.value,onSelect:he,onCommand:O,onSave:te},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),n(LR,{product:e.product,"drawer-mode":f.value,"is-variation-dirty":k.value,onOpenEditor:Q},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",tH,[S.value?(r(),E(Xp,{key:0,items:j.value,"active-key":ie.value,"is-dirty":k.value,onSelect:he},null,8,["items","active-key","is-dirty"])):B("",!0),o("div",aH,[n(Ud,{ref_key:"pricingFormRef",ref:g,index:_.value,modeType:f.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:Y,onCloseModal:re,onDirtyStateChange:K},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),n(tt,{modelValue:y.value,"onUpdate:modelValue":ye[3]||(ye[3]=ve=>y.value=ve),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:X},{header:d(()=>[o("div",lH,[o("h3",null,m(A(u)("Unsaved changes")),1)])]),default:d(()=>[o("p",null,m(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",sH,[o("div",nH,[n($e,{disabled:v.value,onClick:X,size:"small"},{default:d(()=>[R(m(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n($e,{disabled:v.value,onClick:G,size:"small"},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1},8,["disabled"]),n($e,{type:"primary",loading:v.value,onClick:te,size:"small"},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},rH={key:0,class:"fct-adv-groupby-bar"},dH={class:"fct-adv-groupby-label"},uH={__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,s=a,i=N({get(){return l.modelValue},set(p){s("update:modelValue",p)}}),c=N(()=>{var f,_,g;const p=(g=(_=(f=l.product)==null?void 0:f.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(b=>String(b.id)===String(y.group_id));return v?{id:v.id,title:v.title}:null}).filter(Boolean)});return t({configuredGroups:c}),(p,f)=>{const _=C("el-option"),g=C("el-select");return c.value.length>=2?(r(),h("div",rH,[o("span",dH,m(p.$t("Group by")),1),n(g,{modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=y=>i.value=y),placeholder:p.$t("Select")},{default:d(()=>[(r(!0),h(H,null,ae(c.value,y=>(r(),E(_,{key:y.id,label:y.title,value:y.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):B("",!0)}}},cH={key:0,class:"fct-adv-bulk-bar"},AH={class:"fct-adv-bulk-count"},pH=["textContent"],fH={__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,s=N({get(){return a.bulkAction},set(p){l("update:bulkAction",p)}}),i=N({get(){return a.bulkValue},set(p){l("update:bulkValue",p)}}),c=N(()=>a.bulkAction==="set_price");return(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-input"),v=C("el-button");return e.selectedCount>0?(r(),h("div",cH,[o("span",AH,m(p.$t("%1$s selected",e.selectedCount)),1),o("button",{type:"button",class:"fct-adv-bulk-clear",onClick:f[0]||(f[0]=b=>p.$emit("clear"))},m(p.$t("Clear")),1),n(g,{modelValue:s.value,"onUpdate:modelValue":f[1]||(f[1]=b=>s.value=b),placeholder:p.$t("Bulk Actions"),size:"small"},{default:d(()=>[n(_,{label:p.$t("Set Price"),value:"set_price"},null,8,["label"]),n(_,{label:p.$t("Set Active"),value:"set_status_active"},null,8,["label"]),n(_,{label:p.$t("Set Inactive"),value:"set_status_inactive"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),c.value?(r(),E(y,{key:0,modelValue:i.value,"onUpdate:modelValue":f[2]||(f[2]=b=>i.value=b),placeholder:p.$t("Value"),size:"small",type:"number"},{prefix:d(()=>[o("span",{textContent:m(p.appVars.shop.currency_sign)},null,8,pH)]),_:1},8,["modelValue","placeholder"])):B("",!0),n(v,{type:"primary",size:"small",loading:e.saving,disabled:!e.bulkAction||e.selectedCount===0,onClick:f[3]||(f[3]=b=>p.$emit("apply"))},{default:d(()=>[R(m(p.$t("Apply")),1)]),_:1},8,["loading","disabled"])])):B("",!0)}}},mH={class:"fct-grouped-variant-table fct-adv-table-desktop"},hH={class:"is-right"},_H=["aria-expanded","aria-label"],vH=["onClick"],gH={class:"fct-adv-group-header"},yH={class:"fct-adv-group-count"},bH={class:"fct-product-pricing-table-item"},wH=["textContent"],CH={class:"is-right"},kH={class:"fct-adv-group-actions"},BH=["aria-expanded","aria-label","onClick"],xH={class:"fct-adv-slot-row"},SH={colspan:"6"},FH={class:"fct-product-pricing-table-item"},$H={class:"fct-product-pricing-table-item fct-adv-child-title"},EH={class:"fct-adv-title-cell"},UH={class:"fct-adv-title-main"},IH={class:"fct-adv-variant-title"},QH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},DH={class:"fct-product-pricing-table-item"},VH=["textContent"],TH={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},MH={class:"fct-product-pricing-table-item"},LH=["textContent"],RH={class:"is-right"},OH={class:"fct-product-pricing-table-item"},HH={class:"fct-btn-group sm justify-end"},PH=["aria-label"],NH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},KH={colspan:"6"},GH={class:"fct-grouped-variant-table fct-adv-table-mobile"},jH={class:"is-right"},zH=["aria-expanded","aria-label"],qH=["onClick"],YH={class:"fct-adv-group-header"},WH={class:"fct-adv-group-count"},JH={class:"is-right"},XH={class:"fct-adv-group-actions"},ZH=["aria-expanded","aria-label","onClick"],eP={class:"fct-adv-slot-row"},tP={colspan:"4"},aP={class:"fct-product-pricing-table-item"},lP={class:"fct-product-pricing-table-item fct-adv-child-title"},sP={class:"fct-adv-title-cell"},nP={class:"fct-adv-title-main"},oP={class:"fct-adv-variant-title"},iP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},rP={class:"fct-adv-variant-price"},dP={key:0,class:"fct-adv-variant-compare"},uP={class:"is-right"},cP={class:"fct-product-pricing-table-item"},AP={class:"fct-btn-group sm justify-end"},pP=["aria-label"],fP={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},mP={colspan:"6"},ec=30,hP=30,_P={__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=N(()=>{var me,ye,se;const Y=a.groupById?parseInt(a.groupById):null,W=(((se=(ye=(me=a.product)==null?void 0:me.detail)==null?void 0:ye.other_info)==null?void 0:se.attribute_config)||[]).map(fe=>parseInt(fe.group_id)).filter(Boolean),j=fe=>{const $e=W.indexOf(fe);return $e===-1?Number.MAX_SAFE_INTEGER:$e},ie={};(a.attributeGroups||[]).forEach(fe=>{const $e={};(fe.terms||[]).forEach(tt=>{$e[parseInt(tt.id)]=tt.title}),ie[parseInt(fe.id)]=$e});const he={};return(a.groupedVariants||[]).forEach(fe=>{(fe.variants||[]).forEach($e=>{const tt=$e.attr_map||[];if(!tt.length){he[$e.id]="";return}const ve=[...tt].sort((Je,vt)=>j(parseInt(Je.group_id))-j(parseInt(vt.group_id))).map(Je=>{const vt=parseInt(Je.group_id);if(Y&&vt===Y)return null;const Ye=ie[vt];return Ye&&Ye[parseInt(Je.term_id)]||null}).filter(Boolean);he[$e.id]=ve.join(" / ")})}),he}),s=M(new Set),i=Y=>{s.value.has(Y)||(s.value=new Set(s.value).add(Y))},c=M({}),p=Y=>c.value[Y]||ec,f=Y=>{const W=Y.variants||[],j=p(Y.termId);return j>=W.length?W:W.slice(0,j)},_=Y=>(Y.variants||[]).length>p(Y.termId),g=(Y,W)=>{const j=c.value[Y]||ec;j>=W||(c.value={...c.value,[Y]:Math.min(j+hP,W)})};be(()=>a.expandedGroups,Y=>{const W=Object.keys(c.value);if(!W.length)return;const j={};W.forEach(ie=>{Y&&(Y.has(ie)||Y.has(Number(ie)))&&(j[ie]=c.value[ie])}),Object.keys(j).length!==W.length&&(c.value=j)});let y=null;const v={},b=Y=>{let W=Y&&Y.parentElement;for(;W;){const j=getComputedStyle(W).overflowY;if(j==="auto"||j==="scroll"||j==="overlay")return W;W=W.parentElement}return null},k=Y=>{y||(y=new IntersectionObserver(W=>{W.forEach(j=>{j.isIntersecting&&g(j.target.dataset.termId,parseInt(j.target.dataset.total,10)||0)})},{root:b(Y),rootMargin:"300px 0px"}))},w=(Y,W)=>j=>{j?(j.dataset.termId=Y,j.dataset.total=W,k(j),v[Y]=j,y.observe(j)):v[Y]&&(y&&y.unobserve(v[Y]),delete v[Y])};xt(()=>{y&&(y.disconnect(),y=null)});const S=Y=>{if(!a.productEditModel)return!1;const W=a.product.variants.findIndex(j=>j.id===Y.id);return W===-1?!1:a.productEditModel.hasValidationError(`variants.${W}.compare_price`)},$=t,V=M({});be(()=>{var Y,W;return(W=(Y=a.productEditModel)==null?void 0:Y.data)==null?void 0:W.discardKey},()=>{V.value={}});const F=N(()=>a.groupedVariants.every(Y=>a.expandedGroups.has(Y.termId))),x=()=>{const Y=F.value?new Set:new Set(a.groupedVariants.map(W=>W.termId));$("update:expandedGroups",Y)},Q=Y=>{const W=new Set(a.expandedGroups);W.has(Y)?W.delete(Y):W.add(Y),$("update:expandedGroups",W)},D=Y=>a.expandedGroups.has(Y),T=Y=>Y.variants.length>0&&Y.variants.every(W=>a.selectedVariants.includes(W.id)),U=Y=>{if(Y.variants.length===0)return!1;const W=Y.variants.filter(j=>a.selectedVariants.includes(j.id)).length;return W>0&&W<Y.variants.length},I=(Y,W)=>{let j;if(W){const ie=new Set(a.selectedVariants);Y.variants.forEach(he=>ie.add(he.id)),j=Array.from(ie)}else{const ie=new Set(Y.variants.map(he=>he.id));j=a.selectedVariants.filter(he=>!ie.has(he))}$("update:selectedVariants",j)},O=(Y,W)=>{let j;W?j=[...a.selectedVariants,Y]:j=a.selectedVariants.filter(ie=>ie!==Y),$("update:selectedVariants",j)},L=(Y,W)=>{$("groupPriceApply",Y,W)},P=Y=>{const W=Y.variants.map(he=>parseFloat(he.item_price)).filter(he=>!isNaN(he));if(!W.length)return"";const j=Math.min(...W),ie=Math.max(...W);return j===ie?Gt(j,!1):`${Gt(j,!1)} – ${Gt(ie,!1)}`},q=M(null),X=Y=>q.value===Y.termId?"":P(Y)||"",G=Y=>{q.value=Y.termId},te=()=>{q.value=null},ne=Y=>{const W=new Set,j=[];return(Y.variants||[]).forEach(ie=>{Array.isArray(ie==null?void 0:ie.media)&&ie.media.forEach(he=>{const me=(he==null?void 0:he.id)||(he==null?void 0:he.url);me&&!W.has(me)&&(W.add(me),j.push(he))})}),j},re=(Y,W,j)=>{!j||!j.applyToAll||$("groupMediaUploaded",Y,W)},K=(Y,W,j,ie)=>{ie&&ie.applyToAll?$("groupMediaUploaded",Y,j):$("mediaUploaded",W,j)};return(Y,W)=>{const j=C("el-checkbox"),ie=C("el-input"),he=C("el-dropdown-item"),me=C("el-dropdown-menu"),ye=C("el-dropdown");return r(),h(H,null,[o("div",mH,[o("table",null,[W[11]||(W[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,[n(j,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":Y.$t("Select all variants"),"onUpdate:modelValue":W[0]||(W[0]=se=>Y.$emit("update:isAllSelected",se))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,m(Y.$t("Image")),1),o("th",null,m(Y.$t("Variant")),1),o("th",null,m(Y.$t("Price")),1),o("th",null,m(Y.$t("Compare at price")),1),o("th",hH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":F.value,"aria-label":F.value?Y.$t("Collapse all groups"):Y.$t("Expand all groups"),onClick:x},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":F.value}])},[n(J,{name:"ChevronDown"})],2)],8,_H)])])]),o("tbody",null,[(r(!0),h(H,null,ae(e.groupedVariants,se=>(r(),h(H,{key:se.termId},[o("tr",{class:de(["fct-adv-group-row",{"is-expanded":D(se.termId)}]),onClick:fe=>Q(se.termId)},[o("td",null,[n(j,{onClick:W[1]||(W[1]=Ne(()=>{},["stop"])),"model-value":T(se),indeterminate:U(se),"aria-label":A(u)("Select all variants in %1$s",se.title),onChange:fe=>I(se,fe)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:W[2]||(W[2]=Ne(()=>{},["stop"]))},[n(hl,{"model-value":ne(se),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(fe,$e)=>re(se,fe,$e)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",gH,[o("strong",null,m(se.title),1),o("span",yH,m(se.variants.length)+" "+m(se.variants.length===1?Y.$t("variant"):Y.$t("variants")),1)])]),o("td",null,[o("div",bH,[n(ie,{onClick:W[3]||(W[3]=Ne(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:X(se),type:"number",min:0,size:"small",modelValue:V.value[se.termId],"onUpdate:modelValue":fe=>V.value[se.termId]=fe,onFocus:fe=>G(se),onBlur:te,onKeyup:xa(fe=>L(se.termId,V.value[se.termId]),["enter"]),onChange:fe=>L(se.termId,fe)},{prefix:d(()=>[o("span",{textContent:m(Y.appVars.shop.currency_sign)},null,8,wH)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","onFocus","onKeyup","onChange"])])]),W[9]||(W[9]=o("td",null,null,-1)),o("td",CH,[o("div",kH,[D(se.termId)?(r(),E(Ze,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":Y.$t("Edit group %1$s",se.title),onClick:Ne(fe=>Y.$emit("editGroup",se),["stop"])},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):B("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":D(se.termId),"aria-label":Y.$t("Toggle %1$s variants",se.title),onClick:Ne(fe=>Q(se.termId),["stop"])},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":D(se.termId)}])},[n(J,{name:"ChevronDown"})],2)],8,BH)])])],10,vH),o("tr",xH,[o("td",SH,[n(Ld,{visible:D(se.termId),duration:220},{default:d(()=>[o("table",null,[W[10]||(W[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(H,null,ae(f(se),fe=>{var $e,tt;return r(),h("tr",{key:fe.id,class:"fct-adv-group-child-row"},[o("td",{onClick:W[4]||(W[4]=Ne(()=>{},["stop"]))},[n(j,{"model-value":e.selectedVariants.includes(fe.id),"aria-label":A(u)("Select variant %1$s",fe.variation_title),onChange:ve=>O(fe.id,ve)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",FH,[n(hl,{modelValue:fe.media,"onUpdate:modelValue":ve=>fe.media=ve,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(ve,Je)=>K(se,fe,ve,Je)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",$H,[o("div",EH,[o("div",UH,[o("span",IH,m(l.value[fe.id]||fe.variation_title),1),fe.item_status==="inactive"?(r(),h("span",QH,m(A(u)("Inactive")),1)):B("",!0)])])])]),o("td",null,[o("div",DH,[n(ie,{placeholder:Y.$t("Price"),type:"number",min:0,"model-value":fe.item_price,onInput:ve=>Y.$emit("inlinePriceChange",fe,"item_price",ve),onChange:ve=>Y.$emit("inlinePriceCommit",fe)},{prefix:d(()=>[o("span",{textContent:m(Y.appVars.shop.currency_sign)},null,8,VH)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),(($e=fe.other_info)==null?void 0:$e.payment_type)==="subscription"&&((tt=fe.other_info)!=null&&tt.repeat_interval)?(r(),h("span",TH,m(fe.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",MH,[n(ie,{placeholder:Y.$t("Compare price"),type:"number",min:0,class:de({"is-error":S(fe)}),title:S(fe)?Y.$t("Compare price must be greater than or equal to item price."):null,"model-value":fe.compare_price,onInput:ve=>Y.$emit("inlinePriceChange",fe,"compare_price",ve),onChange:ve=>Y.$emit("inlinePriceCommit",fe)},{prefix:d(()=>[o("span",{textContent:m(Y.appVars.shop.currency_sign)},null,8,LH)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",RH,[o("div",OH,[o("div",HH,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:ve=>Y.$emit("editVariant",fe)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(ye,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:ve=>ve&&i(fe.id),onCommand:ve=>{ve==="toggle_status"&&Y.$emit("toggleStatus",fe)}},{dropdown:d(()=>[n(me,null,{default:d(()=>[s.value.has(fe.id)?(r(),h(H,{key:0},[n(he,{class:"show-on-mobile",onClick:ve=>Y.$emit("editVariant",fe)},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(Y.$t("Edit")),1)]),_:2},1032,["onClick"]),n(he,null,{default:d(()=>[fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(fe.id),showMode:"icon_with_text",buttonText:Y.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(he,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!fe.id},{default:d(()=>{var ve;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:((ve=Y.appVars)==null?void 0:ve.frontend_url)+"=instant_checkout&item_id="+fe.id+"&quantity=1",showMode:"icon_with_text",buttonText:Y.$t("Direct Checkout"),tooltipContent:Y.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(H,{key:1},[n(J,{name:"Copy"}),R(" "+m(Y.$t("Direct Checkout"))+" ",1),n(fa,{content:Y.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),fe.id?(r(),E(he,{key:0,command:"toggle_status",class:de({"item-destructive":fe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:fe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(fe.item_status==="inactive"?Y.$t("Set Active"):Y.$t("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)],64)):B("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(J,{name:"More"})],8,PH)]),_:2},1032,["onVisibleChange","onCommand"])])])])])}),128)),_(se)?(r(),h("tr",NH,[o("td",KH,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:w(se.termId,se.variants.length)},null,512)])])):B("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])]),o("div",GH,[o("table",null,[W[13]||(W[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,[n(j,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":Y.$t("Select all variants"),"onUpdate:modelValue":W[5]||(W[5]=se=>Y.$emit("update:isAllSelected",se))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,m(Y.$t("Image")),1),o("th",null,m(Y.$t("Variant")),1),o("th",jH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":F.value,"aria-label":F.value?Y.$t("Collapse all groups"):Y.$t("Expand all groups"),onClick:x},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":F.value}])},[n(J,{name:"ChevronDown"})],2)],8,zH)])])]),o("tbody",null,[(r(!0),h(H,null,ae(e.groupedVariants,se=>(r(),h(H,{key:se.termId},[o("tr",{class:de(["fct-adv-group-row",{"is-expanded":D(se.termId)}]),onClick:fe=>Q(se.termId)},[o("td",null,[n(j,{onClick:W[6]||(W[6]=Ne(()=>{},["stop"])),"model-value":T(se),indeterminate:U(se),"aria-label":A(u)("Select all variants in %1$s",se.title),onChange:fe=>I(se,fe)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:W[7]||(W[7]=Ne(()=>{},["stop"]))},[n(hl,{"model-value":ne(se),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(fe,$e)=>re(se,fe,$e)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",YH,[o("strong",null,m(se.title),1),o("span",WH,m(se.variants.length)+" "+m(se.variants.length===1?Y.$t("variant"):Y.$t("variants")),1)])]),o("td",JH,[o("div",XH,[D(se.termId)?(r(),E(Ze,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":Y.$t("Edit group %1$s",se.title),onClick:Ne(fe=>Y.$emit("editGroup",se),["stop"])},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):B("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":D(se.termId),"aria-label":Y.$t("Toggle %1$s variants",se.title),onClick:Ne(fe=>Q(se.termId),["stop"])},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":D(se.termId)}])},[n(J,{name:"ChevronDown"})],2)],8,ZH)])])],10,qH),o("tr",eP,[o("td",tP,[n(Ld,{visible:D(se.termId),duration:220},{default:d(()=>[o("table",null,[W[12]||(W[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(H,null,ae(f(se),fe=>(r(),h("tr",{key:fe.id,class:"fct-adv-group-child-row"},[o("td",{onClick:W[8]||(W[8]=Ne(()=>{},["stop"]))},[n(j,{"model-value":e.selectedVariants.includes(fe.id),"aria-label":A(u)("Select variant %1$s",fe.variation_title),onChange:$e=>O(fe.id,$e)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",aP,[n(hl,{modelValue:fe.media,"onUpdate:modelValue":$e=>fe.media=$e,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:($e,tt)=>K(se,fe,$e,tt)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",lP,[o("div",sP,[o("div",nP,[o("span",oP,m(l.value[fe.id]||fe.variation_title),1),fe.item_status==="inactive"?(r(),h("span",iP,m(A(u)("Inactive")),1)):B("",!0)]),o("span",rP,[fe.compare_price?(r(),h("span",dP,m(A(Gt)(fe.compare_price,!0)),1)):B("",!0),o("span",null,m(A(Gt)(fe.item_price||0,!0)),1)])])])]),o("td",uP,[o("div",cP,[o("div",AP,[n(ye,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:$e=>$e&&i(fe.id),onCommand:$e=>{$e==="toggle_status"&&Y.$emit("toggleStatus",fe)}},{dropdown:d(()=>[n(me,null,{default:d(()=>[s.value.has(fe.id)?(r(),h(H,{key:0},[n(he,{onClick:$e=>Y.$emit("editVariant",fe)},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(Y.$t("Edit")),1)]),_:2},1032,["onClick"]),n(he,null,{default:d(()=>[fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(fe.id),showMode:"icon_with_text",buttonText:Y.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(he,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!fe.id},{default:d(()=>{var $e;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:(($e=Y.appVars)==null?void 0:$e.frontend_url)+"=instant_checkout&item_id="+fe.id+"&quantity=1",showMode:"icon_with_text",buttonText:Y.$t("Direct Checkout"),tooltipContent:Y.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(H,{key:1},[n(J,{name:"Copy"}),R(" "+m(Y.$t("Direct Checkout"))+" ",1),n(fa,{content:Y.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),fe.id?(r(),E(he,{key:0,command:"toggle_status",class:de({"item-destructive":fe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:fe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(fe.item_status==="inactive"?Y.$t("Set Active"):Y.$t("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)],64)):B("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(J,{name:"More"})],8,pP)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(se)?(r(),h("tr",fP,[o("td",mP,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:w(se.termId,se.variants.length)},null,512)])])):B("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])])],64)}}},vP={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},gP={class:"is-right"},yP={class:"fct-product-pricing-table-item"},bP={class:"fct-product-pricing-table-item"},wP={class:"fct-adv-title-cell"},CP={class:"fct-adv-title-main"},kP={class:"fct-adv-variant-title"},BP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},xP={key:0,class:"fct-adv-attr-breadcrumb"},SP={class:"fct-product-pricing-table-item"},FP=["textContent"],$P={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},EP={class:"fct-product-pricing-table-item"},UP=["textContent"],IP={class:"is-right"},QP={class:"fct-product-pricing-table-item"},DP={class:"fct-btn-group sm"},VP=["aria-label"],TP={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},tc=30,MP=30,LP={__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=N(()=>a.variants??a.product.variants),s=M(tc),i=N(()=>{const w=l.value;return w.length<=s.value?w:w.slice(0,s.value)}),c=N(()=>l.value.length>s.value);be(l,()=>{s.value=tc});let p=null,f=null;const _=w=>{let S=w&&w.parentElement;for(;S;){const $=getComputedStyle(S).overflowY;if($==="auto"||$==="scroll"||$==="overlay")return S;S=S.parentElement}return null},g=w=>{w?(p||(p=new IntersectionObserver(S=>{S.some($=>$.isIntersecting)&&(s.value=Math.min(s.value+MP,l.value.length))},{root:_(w),rootMargin:"300px 0px"})),f=w,p.observe(w)):f&&(p&&p.unobserve(f),f=null)};xt(()=>{p&&(p.disconnect(),p=null)});const y=w=>{if(!a.productEditModel)return!1;const S=a.product.variants.findIndex($=>$.id===w.id);return S===-1?!1:a.productEditModel.hasValidationError(`variants.${S}.compare_price`)},v=w=>{var x,Q,D;const S=w.attr_map||[];if(!S.length)return"";const $=(((D=(Q=(x=a.product)==null?void 0:x.detail)==null?void 0:Q.other_info)==null?void 0:D.attribute_config)||[]).map(T=>parseInt(T.group_id)).filter(Boolean),V=T=>{const U=$.indexOf(T);return U===-1?Number.MAX_SAFE_INTEGER:U};return[...S].sort((T,U)=>V(parseInt(T.group_id))-V(parseInt(U.group_id))).map(T=>{const U=a.attributeGroups.find(O=>O.id===parseInt(T.group_id));if(!U)return null;const I=(U.terms||[]).find(O=>O.id===parseInt(T.term_id));return I?I.title:null}).filter(Boolean).join(" / ")},b=t,k=(w,S)=>{let $;S?$=[...a.selectedVariants,w]:$=a.selectedVariants.filter(V=>V!==w),b("update:selectedVariants",$)};return(w,S)=>{const $=C("el-checkbox"),V=C("el-input"),F=C("el-dropdown-item"),x=C("el-dropdown-menu"),Q=C("el-dropdown");return r(),h("div",vP,[o("table",null,[S[1]||(S[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,[n($,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":w.$t("Select all variants"),"onUpdate:modelValue":S[0]||(S[0]=D=>w.$emit("update:isAllSelected",D))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,m(w.$t("Image")),1),o("th",null,m(w.$t("Title")),1),o("th",null,m(w.$t("Price")),1),o("th",null,m(w.$t("Compare at price")),1),o("th",gP,m(w.$t("Action")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(i.value,D=>{var T,U;return r(),h("tr",{key:D.id},[o("td",null,[n($,{"model-value":e.selectedVariants.includes(D.id),"aria-label":A(u)("Select variant %1$s",D.variation_title),onChange:I=>k(D.id,I)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",yP,[n(hl,{modelValue:D.media,"onUpdate:modelValue":I=>D.media=I,compact:!0,"max-thumbs":1,square:!0,onChange:I=>w.$emit("mediaUploaded",D,I)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",bP,[o("div",wP,[o("div",CP,[o("span",kP,m(D.variation_title),1),D.item_status==="inactive"?(r(),h("span",BP,m(A(u)("Inactive")),1)):B("",!0)]),v(D)&&v(D)!==D.variation_title?(r(),h("span",xP,m(v(D)),1)):B("",!0)])])]),o("td",null,[o("div",SP,[n(V,{placeholder:w.$t("Price"),type:"number",min:0,"model-value":D.item_price,onInput:I=>w.$emit("inlinePriceChange",D,"item_price",I),onChange:I=>w.$emit("inlinePriceCommit",D)},{prefix:d(()=>[o("span",{textContent:m(w.appVars.shop.currency_sign)},null,8,FP)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),((T=D.other_info)==null?void 0:T.payment_type)==="subscription"&&((U=D.other_info)!=null&&U.repeat_interval)?(r(),h("span",$P,m(D.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",EP,[n(V,{placeholder:w.$t("Compare price"),type:"number",min:0,class:de({"is-error":y(D)}),title:y(D)?w.$t("Compare price must be greater than or equal to item price."):null,"model-value":D.compare_price,onInput:I=>w.$emit("inlinePriceChange",D,"compare_price",I),onChange:I=>w.$emit("inlinePriceCommit",D)},{prefix:d(()=>[o("span",{textContent:m(w.appVars.shop.currency_sign)},null,8,UP)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",IP,[o("div",QP,[o("div",DP,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:I=>w.$emit("editVariant",D)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Q,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:I=>{I==="toggle_status"&&w.$emit("toggleStatus",D)}},{dropdown:d(()=>[n(x,null,{default:d(()=>[n(F,{class:"show-on-mobile",onClick:I=>w.$emit("editVariant",D)},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(w.$t("Edit")),1)]),_:2},1032,["onClick"]),n(F,null,{default:d(()=>[D.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(D.id),showMode:"icon_with_text",buttonText:w.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(F,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!D.id},{default:d(()=>{var I;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&D.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:((I=w.appVars)==null?void 0:I.frontend_url)+"=instant_checkout&item_id="+D.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(H,{key:1},[n(J,{name:"Copy"}),R(" "+m(w.$t("Direct Checkout"))+" ",1),n(fa,{content:w.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),D.id?(r(),E(F,{key:0,command:"toggle_status",class:de({"item-destructive":D.item_status!=="inactive"})},{default:d(()=>[n(J,{name:D.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(D.item_status==="inactive"?w.$t("Set Active"):w.$t("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(J,{name:"More"})],8,VP)]),_:2},1032,["onCommand"])])])])])}),128)),c.value?(r(),h("tr",TP,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:g})])])):B("",!0)])])])}}},RP={class:"fct-product-pricing-form-wrap"},OP={class:"fct-product-pricing-form-inner"},HP={class:"dialog-footer"},PP={class:"fct-btn-group sm"},NP={__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,s=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}}),c=M(i()),p=M(0),f=M(!1),_=M(!1);Ie(async()=>{await ke(),_.value=!0});const g=()=>{const v=c.value||{},b={};["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__"&&(b[V]=F)});const w=v.other_info||{},S={};Object.keys(w).forEach(V=>{if(V==="billing_summary")return;const F=w[V];F!=null&&F!==""&&F!=="__unchanged__"&&(S[V]=F)});const $={...b};return Object.keys(S).length>0&&($.other_info=S),$},y=async()=>{if(!l.groupVariantIds.length)return z.error(u("Please select at least one variant to update.")),null;const v=g();if(!Object.keys(v).length)return z.error(u("Please fill in at least one field to update.")),null;l.productEditModel.setSaving(!0);try{const b=await ue.post("products/variants/group-bulk-update",{variant_ids:l.groupVariantIds,...v});return z.success(b.message||u("Variants updated successfully")),p.value=0,s("createOrUpdateVariant",{group:!0,count:l.groupVariantIds.length}),b}catch(b){return b&&(b.status_code===422||b.status===422)?z.validationErrors(b):z.error(b&&b.data&&b.data.message||u("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return be(c,()=>{f.value||!_.value||p.value++},{deep:!0}),be(()=>p.value,v=>{s("dirtyStateChange",v>0)},{immediate:!0}),t({hasDirtyDrafts:()=>p.value>0,getDirtyDraftCount:()=>p.value>0?1:0,discardDrafts:async()=>{f.value=!0,c.value=i(),await ke(),p.value=0,f.value=!1},saveCurrentDraft:y}),(v,b)=>{const k=C("el-form"),w=C("el-button");return r(),h("div",RP,[o("div",OP,[n(k,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(zp,{variant:c.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"]),n(qp,{variant:c.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"]),n(Yp,{variant:c.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(Wp,{key:0,variant:c.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"])):B("",!0)]),_:1})]),o("div",HP,[o("div",PP,[n(w,{onClick:b[0]||(b[0]=S=>s("closeModal"))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(w,{type:"primary",loading:e.productEditModel.saving,disabled:e.productEditModel.saving,onClick:y},{default:d(()=>[R(m(A(u)("Update %1$s variants",e.groupVariantIds.length)),1)]),_:1},8,["loading","disabled"])])])])}}},KP={class:"fct-adv-variant-table-wrap"},GP={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},jP={class:"flex items-center flex-wrap gap-2 ml-auto"},zP=["aria-label"],qP={key:0,class:"fct-adv-filters-panel-wrap"},YP={class:"fct-adv-variant-search-row"},WP={key:0,class:"fct-adv-variant-filters"},JP=["aria-pressed"],XP={key:0,class:"fct-adv-filter-chip__count"},ZP={class:"fct-adv-filter-options"},eN={class:"fct-adv-filter-options__header"},tN=["onClick"],aN={class:"fct-adv-filter-options__list"},lN={key:0,class:"fct-adv-filter-count"},sN={key:0,class:"fct-adv-variant-empty"},nN={class:"fct-adv-variant-empty__title"},oN={class:"fct-adv-variant-empty__hint"},iN=["aria-label"],rN={class:"fct-grouped-variant-skeleton"},dN={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},uN={class:"fct-product-pricing-table-mobile-item-inner"},cN={class:"fct-product-pricing-table-item"},AN={class:"media relative"},pN={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},fN={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},mN=["src","alt"],hN=["src","alt"],_N={class:"fct-product-pricing-table-item-content"},vN={class:"title"},gN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},yN={class:"fct-adv-attr-breadcrumb"},bN={key:0,class:"compare-price"},wN=["textContent"],CN={class:"price"},kN=["textContent"],BN={class:"fct-product-pricing-table-item-action"},xN={class:"fct-btn-group sm"},SN=["aria-label"],FN={class:"fct-shared-variant-drawer__layout"},$N={key:0,class:"fct-shared-variant-nav"},EN={class:"fct-group-edit-aside"},UN={class:"fct-group-edit-aside__label flex items-center gap-2"},IN={class:"fct-group-edit-aside__title"},QN={class:"fct-group-edit-aside__hint"},DN={class:"fct-group-edit-aside__list"},VN={key:1,class:"fct-shared-variant-nav"},TN={class:"fct-shared-variant-nav__filters"},MN={key:0,class:"fct-shared-variant-nav__chips"},LN=["aria-pressed"],RN={key:0,class:"fct-adv-filter-chip__count"},ON={class:"fct-adv-filter-options"},HN={class:"fct-adv-filter-options__header"},PN=["onClick"],NN={class:"fct-adv-filter-options__list"},KN={class:"fct-shared-variant-drawer__content"},GN={key:0,class:"fct-compact-group-edit-summary"},jN={class:"fct-compact-group-edit-summary__title"},zN={class:"fct-compact-group-edit-summary__count"},qN={class:"fct-compact-group-edit-summary__list"},YN={key:0,class:"fct-compact-group-edit-bar"},WN=["disabled","aria-label","onClick"],JN={class:"fct-shared-variant-drawer__form"},XN={class:"fct-variant-dirty-dialog__header"},ZN=["id"],eK={class:"dialog-footer"},tK={class:"fct-btn-group sm"},ac=200,aK={__name:"AdvancedVariationTable",props:{product:Object,productEditModel:Object,attributeGroups:{type:Array,default:()=>[]},externalBusy:{type:Boolean,default:!1}},setup(e){var Ke,qe,ft,Xe,Et,Xt;const t=e,a=M([]),l=M(!1),s=M(!1),i=M(null),c=M(!1),p=M(new Set),f=M(new Set),_=M(0),g=()=>{_.value++},y=()=>{_.value=Math.max(0,_.value-1)},v=N(()=>_.value>0||l.value||t.externalBusy),b=M(((Xt=(Et=(Xe=(ft=(qe=(Ke=t.product)==null?void 0:Ke.detail)==null?void 0:qe.other_info)==null?void 0:ft.attribute_config)==null?void 0:Xe[0])==null?void 0:Et.variants)==null?void 0:Xt.length)||6),k=M(!1),w=M(null),S=M(null),$=M(!1),V=M(!1),F=M(!1),x=M(null),Q=M(""),D=M(""),T=M(null),U=M(""),I=M(!1),O=M({}),L=()=>{I.value=!I.value},P=()=>{O.value={},U.value="",I.value=!1},q=Ae=>{Ae.style.opacity="0",Ae.style.overflow="hidden"},X=Ae=>{const _e=Ae.scrollHeight+"px";Ae.style.height="0",Ae.offsetHeight,Ae.style.transition="height 0.25s ease, opacity 0.2s ease",Ae.style.height=_e,Ae.style.opacity="1"},G=Ae=>{Ae.style.height="",Ae.style.overflow="",Ae.style.transition="",Ae.style.opacity=""},te=Ae=>{Ae.style.height=Ae.scrollHeight+"px",Ae.style.overflow="hidden",Ae.offsetHeight,Ae.style.transition="height 0.25s ease, opacity 0.2s ease",Ae.style.height="0",Ae.style.opacity="0"},ne=Ae=>{Ae.style.height="",Ae.style.overflow="",Ae.style.transition="",Ae.style.opacity=""},re=N(()=>{var _e,Le,Ve;const Ae=(Ve=(Le=(_e=t.product)==null?void 0:_e.detail)==null?void 0:Le.other_info)==null?void 0:Ve.attribute_config;return!Ae||!Array.isArray(Ae)?[]:Ae.map(ee=>{const He=parseInt(ee.group_id,10),ut=t.attributeGroups.find(Se=>parseInt(Se.id,10)===He);return ut?{id:parseInt(ut.id,10),title:ut.title}:null}).filter(Boolean)}),K=N(()=>re.value.map(Ae=>{const _e=t.attributeGroups.find(Le=>Le.id===Ae.id);return _e?{id:_e.id,title:_e.title,terms:_e.terms||[]}:null}).filter(Boolean)),Y=(Ae,_e)=>{const Le=O.value[Ae];return Le?Le.has(_e):!1},W=(Ae,_e)=>{const Le={...O.value},Ve=Le[Ae]?new Set(Le[Ae]):new Set;Ve.has(_e)?Ve.delete(_e):Ve.add(_e),Ve.size===0?delete Le[Ae]:Le[Ae]=Ve,O.value=Le},j=Ae=>{var _e;return((_e=O.value[Ae])==null?void 0:_e.size)||0},ie=Ae=>{if(!O.value[Ae])return;const _e={...O.value};delete _e[Ae],O.value=_e},he=()=>{O.value={},U.value=""},me=N(()=>Object.keys(O.value).length>0||U.value.trim()!==""),ye=N(()=>me.value&&t.product.variants.length>0&&se.value.length===0),se=N(()=>{let Ae=t.product.variants;const _e=Object.keys(O.value);_e.length>0&&(Ae=Ae.filter(Ve=>_e.every(ee=>{const He=O.value[ee];if(!He||He.size===0)return!0;const ut=(Ve.attr_map||[]).find(Se=>parseInt(Se.group_id)===parseInt(ee));return ut&&He.has(parseInt(ut.term_id))})));const Le=U.value.trim().toLowerCase();return Le&&(Ae=Ae.filter(Ve=>(Ve.variation_title||"").toLowerCase().includes(Le)?!0:(Ve.attr_map||[]).map(ut=>{const Se=t.attributeGroups.find(wa=>wa.id===parseInt(ut.group_id));if(!Se)return"";const kt=(Se.terms||[]).find(wa=>wa.id===parseInt(ut.term_id));return kt?kt.title.toLowerCase():""}).join(" ").includes(Le))),Ae}),fe=N(()=>{if(!T.value)return null;const Ae=parseInt(T.value,10),_e=t.attributeGroups.find(ee=>parseInt(ee.id,10)===Ae);if(!_e)return null;const Le=[],Ve={};for(const ee of se.value){const He=(ee.attr_map||[]).find(Se=>parseInt(Se.group_id,10)===Ae);if(!He)continue;const ut=parseInt(He.term_id,10);if(!Ve[ut]){const Se=(_e.terms||[]).find(kt=>parseInt(kt.id,10)===ut);Ve[ut]={termId:ut,title:Se?Se.title:"Unknown",variants:[]},Le.push(Ve[ut])}Ve[ut].variants.push(ee)}return Le}),$e=N(()=>!!T.value&&fe.value&&fe.value.length>0);be(fe,Ae=>{Array.isArray(Ae)&&Ae.length>0&&(b.value=Ae.length)},{immediate:!0});const tt=Ae=>t.productEditModel.validateComparePrice(Ae),ve=(Ae,_e)=>{const Le=fe.value?fe.value.find(ut=>ut.termId===Ae):null;if(!Le||_e===""||_e===null||_e===void 0)return;const Ve=parseFloat(_e);if(isNaN(Ve)||Ve<0){z.error(u("Please enter a valid price."));return}const ee=Le.variants.filter(ut=>a.value.includes(ut.id));(ee.length?ee:Le.variants).forEach(ut=>{const Se=t.product.variants.findIndex(kt=>kt.id===ut.id);Se!==-1&&(t.productEditModel.onChangePricing("item_price",Se,Ve),tt(Se))})},Je=Ae=>{const _e=t.product.variants.findIndex(Ve=>Ve.id===Ae.id);if(_e===-1)return;tt(_e)||z.error(u("Compare price must be greater than or equal to item price."))};be(()=>t.product.variants,Ae=>{Array.isArray(Ae)&&(Ae.forEach(_e=>{const Le=_e.media?_e.media.meta_value||_e.media:[];_e.media=Array.isArray(Le)?Le:[]}),c.value&&(c.value=!1,Ct()))},{immediate:!0,deep:!1});const vt=[];Ie(async()=>{await ke(),document.querySelectorAll(".fct-adv-variant-table-wrap .el-input__wrapper input[type='number']").forEach(_e=>{const Le=Ve=>{document.activeElement===_e&&Ve.preventDefault()};_e.addEventListener("wheel",Le),vt.push({input:_e,handler:Le})})}),xt(()=>{vt.forEach(({input:Ae,handler:_e})=>{Ae.removeEventListener("wheel",_e)}),vt.length=0}),be(()=>{var Ae;return(Ae=re.value[0])==null?void 0:Ae.id},Ae=>{if(re.value.length<2||!Ae){T.value=null;return}T.value=parseInt(Ae,10)},{immediate:!0}),be(()=>re.value.length,Ae=>{Ae<2&&(T.value=null)}),be([T,re],([Ae,_e])=>{var ee;if(!Array.isArray(_e)||_e.length<2)return;const Le=(ee=_e[0])==null?void 0:ee.id;if(!Le)return;const Ve=_e.map(He=>parseInt(He.id,10));(Ae==null||!Ve.includes(parseInt(Ae,10)))&&(T.value=parseInt(Le,10))},{deep:!0});const Ye=(Ae,_e,Le)=>{const Ve=parseFloat(Le)||0,ee=t.product.variants.findIndex(He=>He.id===Ae.id);ee!==-1&&t.productEditModel.onChangePricing(_e,ee,Ve)},xe=(Ae,_e)=>{const Le=Ae.media;Ae.media=_e,g(),ue.post(`products/variants/${Ae.id}/setMedia`,{media:_e}).then(Ve=>{z.success(Ve.message||u("Thumbnail set successfully"))}).catch(Ve=>{var ee;Ae.media=Le,z.error(((ee=Ve==null?void 0:Ve.data)==null?void 0:ee.message)||(Ve==null?void 0:Ve.message)||u("Failed to save thumbnail"))}).finally(y)},Ee=async(Ae,_e)=>{const Le=Ae.variants.filter(Se=>a.value.includes(Se.id)),Ve=Le.length?Le:Ae.variants;Ve.forEach(Se=>{Se.media=_e});const ee=Ve.map(Se=>Se.id),He=5;let ut=0;g();try{for(let Se=0;Se<ee.length;Se+=He){const kt=await Promise.allSettled(ee.slice(Se,Se+He).map(wa=>ue.post(`products/variants/${wa}/setMedia`,{media:_e})));ut+=kt.filter(wa=>wa.status==="rejected").length}}finally{y()}ut===0?z.success(u("Thumbnail applied to %1$s variants",Ve.length)):z.error(u("Failed to apply thumbnail to %1$s variants",ut))},Oe=N({get(){const Ae=se.value.map(_e=>_e.id);return Ae.length===0?!1:Ae.every(_e=>a.value.includes(_e))},set(Ae){const _e=se.value.map(Le=>Le.id);if(Ae){const Le=new Set([...a.value,..._e]);a.value=Array.from(Le)}else{const Le=new Set(_e);a.value=a.value.filter(Ve=>!Le.has(Ve))}}}),Me=N(()=>{const Ae=se.value.map(Le=>Le.id);if(Ae.length===0)return!1;const _e=Ae.filter(Le=>a.value.includes(Le)).length;return _e>0&&_e<Ae.length}),gt=()=>{if(l.value||!Q.value||a.value.length===0)return;if(Q.value==="delete"){Dn.confirmDeleteWithInput("delete",u("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{yt()}).catch(()=>{});return}const Ae=Q.value==="set_price";let _e=null;if(Ae&&(_e=parseFloat(D.value),D.value===""||isNaN(_e)||_e<0)){z.error(u("Please enter a valid price."));return}if(Ae&&a.value.slice(0,ac).map(ee=>t.product.variants.find(He=>He.id===ee)).filter(ee=>{if(!ee)return!1;const He=parseFloat(ee.compare_price);return!isNaN(He)&&He>0&&He<_e}).length){z.error(u("Compare price must be greater than or equal to item price."));return}const Le=a.value.slice(0,ac).map(Ve=>{const ee={id:Ve};return Q.value==="set_price"?ee.item_price=_e:Q.value==="set_status_active"?ee.item_status="active":Q.value==="set_status_inactive"&&(ee.item_status="inactive"),ee});l.value=!0,t.productEditModel.bulkUpdateVariants(Le).then(Ve=>{z.success((Ve==null?void 0:Ve.message)||u("Variants updated successfully")),t.productEditModel.data.reloader(),a.value=[],Q.value="",D.value=""}).catch(Ve=>{var ee;z.error(((ee=Ve==null?void 0:Ve.data)==null?void 0:ee.message)||u("Bulk action failed"))}).finally(()=>{l.value=!1})},yt=async()=>{const Ae=[...a.value],_e=5;g();try{for(let Le=0;Le<Ae.length;Le+=_e)await Promise.all(Ae.slice(Le,Le+_e).map(Ve=>ue.delete(`products/variants/${Ve}`)));z.success(u("Variants deleted successfully")),t.productEditModel.data.reloader(),a.value=[]}catch{z.error(u("Failed to delete some variants"))}finally{y()}},Mt=Ae=>{if(!Ae||!Ae.id)return;const _e=Ae.item_status==="inactive"?"active":"inactive";g(),t.productEditModel.bulkUpdateVariants([{id:Ae.id,item_status:_e}]).then(Le=>{Ae.item_status=_e,z.success((Le==null?void 0:Le.message)||u("Variant updated successfully")),t.productEditModel.data.reloader()}).catch(Le=>{var Ve;z.error(((Ve=Le==null?void 0:Le.data)==null?void 0:Ve.message)||u("Failed to update variant"))}).finally(y)},Ut=Ae=>{const _e=Ae.attr_map||[];return _e.length?_e.map(Ve=>{const ee=t.attributeGroups.find(ut=>ut.id===parseInt(Ve.group_id));if(!ee)return null;const He=(ee.terms||[]).find(ut=>ut.id===parseInt(Ve.term_id));return He?He.title:null}).filter(Boolean).join(" / "):""},Dt=(Ae,_e)=>{const Le=Ae.attr_map||[];if(!Le.length)return"";const Ve=parseInt(_e);return Le.filter(He=>parseInt(He.group_id)!==Ve).map(He=>{const ut=t.attributeGroups.find(kt=>kt.id===parseInt(He.group_id));if(!ut)return null;const Se=(ut.terms||[]).find(kt=>kt.id===parseInt(He.term_id));return Se?Se.title:null}).filter(Boolean).join(" / ")},ht=Ae=>{const _e=t.product.variants.findIndex(Le=>Le.id===Ae.id);_e!==-1&&(t.productEditModel.setValidationErrors({}),w.value=_e,k.value=!0)},Pt=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,k.value=!1,w.value=null,s.value=!1,i.value=null,c.value=!1},Ct=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,s.value=!1,i.value=null,p.value=new Set},St=N(()=>!i.value||!i.value.items?[]:i.value.items.filter(Ae=>p.value.has(Ae.key)).map(Ae=>Ae.variant&&Ae.variant.id?Ae.variant.id:null).filter(Boolean)),Ot=Ae=>{const _e=new Set(p.value);_e.has(Ae)?_e.delete(Ae):_e.add(Ae),p.value=_e},Ht=()=>{$.value=!1,V.value=!1,x.value=null},It=()=>{var Ae,_e;return((_e=(Ae=S.value)==null?void 0:Ae.hasDirtyDrafts)==null?void 0:_e.call(Ae))??!1},mt=Ae=>{F.value=Ae},jt=()=>{const Ae=x.value;if(Ht(),!!Ae&&Ae.type==="close"){if(typeof Ae.done=="function"){Ae.done();return}Pt()}},ge=()=>{Ht()},Fe=async()=>{var Ae,_e;await((_e=(Ae=S.value)==null?void 0:Ae.discardDrafts)==null?void 0:_e.call(Ae)),F.value=!1,jt()},nt=async()=>{var _e;if(!((_e=S.value)!=null&&_e.saveCurrentDraft)||V.value)return;if(V.value=!0,await S.value.saveCurrentDraft()){F.value=!1,jt();return}V.value=!1,ge()},bt=Ae=>{if(!It()){Ae();return}x.value={type:"close",done:Ae},$.value=!0},Bt=()=>{if(s.value){bt(Ct);return}bt(Pt)},Wt=Ae=>{if(F.value=!1,t.productEditModel.setValidationErrors({}),s.value){c.value=!0,t.productEditModel.data.reloader();return}Ae&&typeof Ae.index=="number"&&Ae.index>=0&&(w.value=Ae.index)},_t=Ae=>{const _e=Ra.value?Ra.value.find(Le=>Le.termId===Ae.termId):null;_e&&la(_e)},la=Ae=>{if(!Ae||!Ae.items||!Ae.items.length||F.value)return;i.value=Ae,p.value=new Set(Ae.items.map(Le=>Le.key)),s.value=!0;const _e=Ae.items[0];t.productEditModel.setValidationErrors({}),w.value=typeof _e.index=="number"?_e.index:null,k.value=!0},sa=M(typeof window<"u"?window.innerWidth:1280);let Nt=null;Ie(()=>{typeof window>"u"||(Nt=()=>{sa.value=window.innerWidth},window.addEventListener("resize",Nt))}),xt(()=>{Nt&&(window.removeEventListener("resize",Nt),Nt=null)});const ia=N(()=>sa.value<=900),el=N(()=>sa.value<=640?"100%":sa.value<=900?"95%":"920px"),Ll=N(()=>{const Ae=new Map;return(t.product.variants||[]).forEach((_e,Le)=>{_e&&_e.id!=null&&Ae.set(_e.id,Le)}),(se.value||[]).map(_e=>{const Le=Ae.get(_e==null?void 0:_e.id);return{key:(_e==null?void 0:_e.id)??`variant-${Le}`,index:Le,variant:_e,label:Ut(_e)||(_e==null?void 0:_e.variation_title)||`${u("Variant")} ${Le+1}`,meta:(_e==null?void 0:_e.item_price)!==void 0&&(_e==null?void 0:_e.item_price)!==null&&(_e==null?void 0:_e.item_price)!==""?Gt(_e.item_price,!0):u("No price set"),modeType:"update",isDraft:!1}})}),Ra=N(()=>{if(!fe.value||fe.value.length===0)return null;const Ae=new Map;(t.product.variants||[]).forEach((Ve,ee)=>{Ve&&Ve.id!=null&&Ae.set(Ve.id,ee)});const _e=T.value,Le=Ve=>{const ee=Ae.get(Ve==null?void 0:Ve.id),He=_e?Dt(Ve,_e):Ut(Ve);return{key:(Ve==null?void 0:Ve.id)??`variant-${ee}`,index:ee,variant:Ve,label:He||(Ve==null?void 0:Ve.variation_title)||`${u("Variant")} ${ee+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)!==""?Gt(Ve.item_price,!0):u("No price set"),modeType:"update",isDraft:!1}};return fe.value.map(Ve=>({termId:Ve.termId,title:Ve.title,count:Ve.variants.length,items:Ve.variants.map(Le)}))}),na=N(()=>{var _e;const Ae=(_e=t.product.variants)==null?void 0:_e[w.value];return(Ae==null?void 0:Ae.id)??`variant-${w.value??0}`}),Z=(Ae,_e)=>{const Le=parseInt(_e,10),Ve=(Ae.attr_map||[]).find(Se=>parseInt(Se.group_id,10)===Le);if(!Ve)return"";const ee=t.attributeGroups.find(Se=>parseInt(Se.id,10)===Le);if(!ee)return"";const He=parseInt(Ve.term_id,10),ut=(ee.terms||[]).find(Se=>parseInt(Se.id,10)===He);return ut?ut.title:""},we=N(()=>{var _e;if(w.value===null)return{group:"",detail:""};const Ae=(_e=t.product.variants)==null?void 0:_e[w.value];return Ae?T.value?{group:Z(Ae,T.value),detail:Dt(Ae,T.value)}:{group:"",detail:Ut(Ae)}:{group:"",detail:""}}),le=Ae=>{Ae&&(F.value&&na.value!==Ae.key||typeof Ae.index=="number"&&(t.productEditModel.setValidationErrors({}),w.value=Ae.index))},pe=Ae=>{var _e,Le;return!!((_e=Ae==null?void 0:Ae.variant)!=null&&_e.id)&&["publish","private"].includes((Le=t.product)==null?void 0:Le.post_status)},je=Ae=>`${Ge.get("frontend_url")}=instant_checkout&item_id=${Ae.variant.id}&quantity=1`,at=(Ae,_e)=>{var Le,Ve;if(!(!_e||!Ae)){if(Ae==="copy_variation_id"&&((Le=_e.variant)!=null&&Le.id)){Zl.copy(String(_e.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}if(Ae==="copy_direct_checkout"&&pe(_e)){Zl.copy(je(_e),{successMessage:u("Direct checkout link copied to clipboard")});return}Ae==="toggle_status"&&((Ve=_e.variant)!=null&&Ve.id)&&Mt(_e.variant)}};return(Ae,_e)=>{const Le=C("el-button"),Ve=C("el-input"),ee=C("el-checkbox"),He=C("el-popover"),ut=C("el-dropdown-item"),Se=C("el-dropdown-menu"),kt=C("el-dropdown"),wa=C("el-drawer"),ce=C("el-dialog");return r(),h("div",KP,[o("div",GP,[n(uH,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:T.value,"onUpdate:modelValue":_e[0]||(_e[0]=oe=>T.value=oe)},null,8,["product","attribute-groups","modelValue"]),o("div",jP,[I.value?(r(),E(Le,{key:1,onClick:P},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})):(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-panel-toggle","aria-label":A(u)("Search and filter variants"),onClick:L},[n(J,{name:"Search"}),n(J,{name:"Filter"})],8,zP))])]),n(Wl,{onBeforeEnter:q,onEnter:X,onAfterEnter:G,onLeave:te,onAfterLeave:ne},{default:d(()=>[I.value?(r(),h("div",qP,[o("div",YP,[n(Ve,{modelValue:U.value,"onUpdate:modelValue":_e[1]||(_e[1]=oe=>U.value=oe),placeholder:A(u)("Search variants"),size:"small",clearable:""},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),K.value.length>0?(r(),h("div",WP,[(r(!0),h(H,null,ae(K.value,oe=>(r(),E(He,{key:oe.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:de(["fct-adv-filter-chip",{"is-active":j(oe.id)>0}]),"aria-pressed":j(oe.id)>0,type:"button"},[o("span",null,m(oe.title),1),j(oe.id)>0?(r(),h("span",XP,m(j(oe.id)),1)):B("",!0),n(J,{name:"ChevronDown"})],10,JP)]),default:d(()=>[o("div",ZP,[o("div",eN,[o("span",null,m(A(u)("Filter by %1$s",oe.title)),1),j(oe.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Ue=>ie(oe.id)},m(A(u)("Clear")),9,tN)):B("",!0)]),o("ul",aN,[(r(!0),h(H,null,ae(oe.terms,Ue=>(r(),h("li",{key:Ue.id},[n(ee,{"model-value":Y(oe.id,Ue.id),onChange:Te=>W(oe.id,Ue.id)},{default:d(()=>[R(m(Ue.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),me.value&&!ye.value?(r(),h("span",lN,m(A(u)("Showing %1$s of %2$s variants",se.value.length,e.product.variants.length)),1)):B("",!0),me.value?(r(),h("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:he},m(A(u)("Clear filters")),1)):B("",!0)])):B("",!0)])):B("",!0)]),_:1}),n(fH,{"selected-count":a.value.length,"bulk-action":Q.value,"onUpdate:bulkAction":_e[2]||(_e[2]=oe=>Q.value=oe),"bulk-value":D.value,"onUpdate:bulkValue":_e[3]||(_e[3]=oe=>D.value=oe),saving:l.value,onApply:gt,onClear:_e[4]||(_e[4]=oe=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),ye.value?(r(),h("div",sN,[n(J,{name:"Search"}),o("p",nN,m(A(u)("No variants match your filters")),1),o("p",oN,m(A(u)("Try a different search term or clear some filters.")),1),n(Le,{size:"small",onClick:he},{default:d(()=>[R(m(A(u)("Clear filters")),1)]),_:1})])):B("",!0),v.value&&!ye.value?(r(),h("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":Ae.$t("Updating variants")},[o("table",null,[_e[16]||(_e[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,[_e[13]||(_e[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,m(Ae.$t("Image")),1),o("th",null,m(Ae.$t("Variant")),1),o("th",null,m(Ae.$t("Price")),1),o("th",null,m(Ae.$t("Compare at price")),1),_e[14]||(_e[14]=o("th",null,null,-1))])]),o("tbody",rN,[(r(!0),h(H,null,ae(Math.min(b.value,8),oe=>(r(),h("tr",{key:"wrap-skel-"+oe},_e[15]||(_e[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,iN)):$e.value&&!ye.value?(r(),E(_P,{key:2,product:e.product,"product-edit-model":e.productEditModel,"attribute-groups":e.attributeGroups,"grouped-variants":fe.value,"selected-variants":a.value,"is-all-selected":Oe.value,"is-selection-indeterminate":Me.value,"group-by-id":T.value,"expanded-groups":f.value,"onUpdate:selectedVariants":_e[5]||(_e[5]=oe=>a.value=oe),"onUpdate:isAllSelected":_e[6]||(_e[6]=oe=>Oe.value=oe),"onUpdate:expandedGroups":_e[7]||(_e[7]=oe=>f.value=oe),onEditVariant:ht,onEditGroup:_t,onToggleStatus:Mt,onInlinePriceChange:Ye,onInlinePriceCommit:Je,onMediaUploaded:xe,onGroupPriceApply:ve,onGroupMediaUploaded:Ee},null,8,["product","product-edit-model","attribute-groups","grouped-variants","selected-variants","is-all-selected","is-selection-indeterminate","group-by-id","expanded-groups"])):!$e.value&&!ye.value?(r(),E(LP,{key:3,product:e.product,"product-edit-model":e.productEditModel,variants:se.value,"attribute-groups":e.attributeGroups,"selected-variants":a.value,"is-all-selected":Oe.value,"is-selection-indeterminate":Me.value,"onUpdate:selectedVariants":_e[8]||(_e[8]=oe=>a.value=oe),"onUpdate:isAllSelected":_e[9]||(_e[9]=oe=>Oe.value=oe),onEditVariant:ht,onToggleStatus:Mt,onInlinePriceChange:Ye,onInlinePriceCommit:Je,onMediaUploaded:xe},null,8,["product","product-edit-model","variants","attribute-groups","selected-variants","is-all-selected","is-selection-indeterminate"])):B("",!0),$e.value?B("",!0):(r(),h("div",dN,[(r(!0),h(H,null,ae(se.value,oe=>{var Ue,Te;return r(),h("div",{key:oe.id,class:"fct-product-pricing-table-mobile-row"},[o("div",uN,[o("div",cN,[o("div",AN,[o("div",pN,[n(Bp,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:Pe=>xe(oe,Pe)},null,8,["onMediaUploaded"])]),((Ue=oe==null?void 0:oe.media)==null?void 0:Ue.length)>0?(r(),h("div",fN,[o("img",{src:(Te=oe.media[0])==null?void 0:Te.url,alt:oe.variation_title,class:"!object-contain rounded border border-solid border-gray-outline dark:border-dark-400"},null,8,mN)])):(r(),h("img",{key:1,src:Ae.appVars.asset_url+"images/empty-image.svg",alt:A(u)("No Image")},null,8,hN))]),o("div",_N,[o("div",vN,[R(m(oe.variation_title)+" ",1),oe.item_status==="inactive"?(r(),h("span",gN,m(A(u)("Inactive")),1)):B("",!0)]),o("div",yN,m(Ut(oe)||"—"),1),o("ul",null,[o("li",null,[oe.compare_price?(r(),h("div",bN,[o("span",{textContent:m(Ae.appVars.shop.currency_sign)},null,8,wN),R(" "+m(A(Gt)(oe.compare_price,!1)),1)])):B("",!0),o("div",CN,[o("span",{textContent:m(Ae.appVars.shop.currency_sign)},null,8,kN),R(" "+m(A(Gt)(oe.item_price,!1)),1)])])])])]),o("div",BN,[o("div",xN,[n(Ze,{size:"small",tag:"button",onClick:Pe=>ht(oe)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(kt,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:Pe=>{Pe==="toggle_status"&&Mt(oe)}},{dropdown:d(()=>[n(Se,null,{default:d(()=>[n(ut,null,{default:d(()=>[oe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(oe.id),showMode:"icon_with_text",buttonText:A(u)("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),oe.id?(r(),E(ut,{key:0,command:"toggle_status",class:de({"item-destructive":oe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:oe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(oe.item_status==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(J,{name:"More"})],8,SN)]),_:2},1032,["onCommand"])])])])])}),128))])),n(wa,{modelValue:k.value,"onUpdate:modelValue":_e[11]||(_e[11]=oe=>k.value=oe),title:A(u)("Pricing"),size:el.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":bt,class:"fct-shared-variant-drawer",onClose:Pt},{default:d(()=>{var oe,Ue,Te,Pe,ct,At;return[o("div",FN,[!ia.value&&s.value?(r(),h("aside",$N,[n(Nr,{product:e.product},null,8,["product"]),o("div",EN,[o("p",UN,[R(m(A(u)("Editing group"))+": ",1),o("span",IN,m((oe=i.value)==null?void 0:oe.title),1)]),o("p",QN,m(A(u)("Changes will apply to %1$s of %2$s variants in this group.",St.value.length,(Ue=i.value)==null?void 0:Ue.count)),1),o("ul",DN,[(r(!0),h(H,null,ae((Te=i.value)==null?void 0:Te.items,rt=>(r(),h("li",{key:rt.key,class:"fct-group-edit-aside__item"},[n(ee,{"model-value":p.value.has(rt.key),onChange:Lt=>Ot(rt.key)},{default:d(()=>[R(m(rt.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])])):ia.value?B("",!0):(r(),h("aside",VN,[n(Nr,{product:e.product},null,8,["product"]),o("div",TN,[n(Ve,{modelValue:U.value,"onUpdate:modelValue":_e[10]||(_e[10]=rt=>U.value=rt),placeholder:A(u)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),K.value.length>0?(r(),h("div",MN,[(r(!0),h(H,null,ae(K.value,rt=>(r(),E(He,{key:"nav-chip-"+rt.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:de(["fct-adv-filter-chip",{"is-active":j(rt.id)>0}]),"aria-pressed":j(rt.id)>0,type:"button"},[o("span",null,m(rt.title),1),j(rt.id)>0?(r(),h("span",RN,m(j(rt.id)),1)):B("",!0),n(J,{name:"ChevronDown"})],10,LN)]),default:d(()=>[o("div",ON,[o("div",HN,[o("span",null,m(A(u)("Filter by %1$s",rt.title)),1),j(rt.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Lt=>ie(rt.id)},m(A(u)("Clear")),9,PN)):B("",!0)]),o("ul",NN,[(r(!0),h(H,null,ae(rt.terms,Lt=>(r(),h("li",{key:Lt.id},[n(ee,{"model-value":Y(rt.id,Lt.id),onChange:$a=>W(rt.id,Lt.id)},{default:d(()=>[R(m(Lt.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128))])):B("",!0),me.value?(r(),h("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:he},m(A(u)("Clear filters")),1)):B("",!0)]),n(Jp,{items:Ll.value,"grouped-items":Ra.value,"active-key":na.value,"is-dirty":F.value,"is-saving":V.value,"drawer-mode":"update",product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":pe,onSelect:le,onSave:nt,onCommand:at,onEditGroup:la},null,8,["items","grouped-items","active-key","is-dirty","is-saving","product","product-edit-model"])])),o("div",KN,[ia.value&&s.value?(r(),h("div",GN,[o("div",jN,[R(m(A(u)("Editing group"))+": ",1),o("span",null,m((Pe=i.value)==null?void 0:Pe.title),1)]),o("div",zN,m(A(u)("Changes will apply to %1$s of %2$s variants in this group.",St.value.length,(ct=i.value)==null?void 0:ct.count)),1),o("ul",qN,[(r(!0),h(H,null,ae((At=i.value)==null?void 0:At.items,rt=>(r(),h("li",{key:rt.key},[n(ee,{"model-value":p.value.has(rt.key),onChange:Lt=>Ot(rt.key)},{default:d(()=>[R(m(rt.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])):ia.value?(r(),h(H,{key:1},[Ra.value&&Ra.value.length?(r(),h("div",YN,[(r(!0),h(H,null,ae(Ra.value,rt=>(r(),h("button",{key:"cge-"+rt.termId,type:"button",class:"fct-compact-group-edit-bar__btn",disabled:F.value,"aria-label":A(u)("Edit group %1$s",rt.title),onClick:Lt=>la(rt)},[n(J,{name:"Edit"}),o("span",null,m(rt.title),1)],8,WN))),128))])):B("",!0),n(Xp,{items:Ll.value,"active-key":na.value,"is-dirty":F.value,onSelect:le},null,8,["items","active-key","is-dirty"])],64)):B("",!0),o("div",JN,[k.value&&w.value!==null&&!s.value?(r(),E(Ud,{ref_key:"pricingFormRef",ref:S,key:na.value,index:w.value,modeType:"update",fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,"variant-title-info":we.value,onCreateOrUpdateVariant:Wt,onCloseModal:Bt,onDirtyStateChange:mt},null,8,["index","product","productEditModel","variant-title-info"])):k.value&&s.value&&i.value?(r(),E(NP,{ref_key:"pricingFormRef",ref:S,key:`group-${i.value.termId}`,"group-variant-ids":St.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:Wt,onCloseModal:Bt,onDirtyStateChange:mt},null,8,["group-variant-ids","product","productEditModel"])):B("",!0)])])])]}),_:1},8,["modelValue","title","size"]),n(ce,{modelValue:$.value,"onUpdate:modelValue":_e[12]||(_e[12]=oe=>$.value=oe),"close-on-click-modal":!1,"close-on-press-escape":!V.value,"show-close":!V.value,class:"fct-variant-dirty-dialog",onClose:ge},{header:d(({titleId:oe})=>[o("div",XN,[o("h3",{id:oe},m(A(u)("Unsaved changes")),9,ZN)])]),default:d(()=>[o("p",null,m(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",eK,[o("div",tK,[n(Le,{disabled:V.value,size:"small",onClick:ge},{default:d(()=>[R(m(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n(Le,{disabled:V.value,size:"small",onClick:Fe},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(Le,{type:"primary",loading:V.value,size:"small",onClick:nt},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},lK=["src","alt"],sK={class:"fct-swatch-tag-label"},nK=["aria-label","onClick","onKeydown"],lr={__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,s=(y,v)=>String(y)===String(v),i=N({get:()=>a.modelValue,set:y=>l("update:modelValue",y)}),c=y=>a.terms.find(v=>s(v.id,y))||null,p=y=>{if(typeof y=="string")return y;const v=c(y);return v?v.title:String(y)},f=y=>{const v=c(y);return v&&v.settings&&v.settings.color?{background:v.settings.color}:{}},_=y=>{const v=c(y);return v&&v.settings&&v.settings.image?v.settings.image:""},g=y=>{l("update:modelValue",a.modelValue.filter(v=>!s(v,y)))};return(y,v)=>(r(),E(A(an),{modelValue:i.value,"onUpdate:modelValue":v[2]||(v[2]=b=>i.value=b),handle:".fct-value-tag-handle",disabled:i.value.length<2,class:"fct-value-tag-list",tag:"div"},{default:d(()=>[(r(!0),h(H,null,ae(i.value,b=>(r(),h("span",{key:String(b),class:"fct-swatch-tag"},[i.value.length>1?(r(),h("span",{key:0,class:"fct-value-tag-handle",onMousedown:v[0]||(v[0]=Ne(()=>{},["stop"]))},[n(J,{name:"ReorderDotsVertical"})],32)):B("",!0),e.type==="color"?(r(),h("span",{key:1,class:"fct-swatch-tag-dot",style:ua(f(b))},null,4)):e.type==="image"?(r(),h("img",{key:2,class:"fct-swatch-tag-img",src:_(b),alt:p(b)},null,8,lK)):B("",!0),o("span",sK,m(p(b)),1),o("span",{class:"fct-swatch-tag-close",role:"button",tabindex:"0","aria-label":A(u)("Remove"),onMousedown:v[1]||(v[1]=Ne(()=>{},["stop"])),onClick:Ne(k=>g(b),["stop"]),onKeydown:xa(Ne(k=>g(b),["prevent"]),["enter","space"])},"×",40,nK)]))),128))]),_:1},8,["modelValue","disabled"]))}},oK={class:"fct-add-term-modal"},iK={class:"dialog-footer"},rK={__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,s=M(!1),i=M({}),c=M(null),p=N(()=>{const y=a.group&&a.group.settings;return y&&y.type?y.type:"options"}),f=M({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=N(()=>(f.value.title||"").trim()!==""),g=()=>{if(!_.value||s.value)return;s.value=!0,i.value={};const y={terms:[{title:f.value.title.trim(),settings:{color:f.value.settings.color||"",image:f.value.settings.image||""}}]};ue.post("options/attr/group/"+a.groupId+"/terms",y).then(v=>{tn(v.message);const b=Array.isArray(v.data)?v.data[0]:v.data;l("isTermCreatingDone",b)}).catch(v=>{var b;(v==null?void 0:v.status_code)==422&&v.data?i.value=v.data:z.error(((b=v==null?void 0:v.data)==null?void 0:b.message)||(v==null?void 0:v.message)||u("Failed to add the term."))}).finally(()=>{s.value=!1})};return(y,v)=>{const b=C("el-button");return r(),h("div",oK,[n(bo,{ref_key:"formRef",ref:c,term:f.value,"group-type":p.value,"show-remove-button":!1,"validation-errors":i.value,"field-key":"terms.0",onSubmit:g,onRemove:v[0]||(v[0]=k=>l("isTermCreatingDone"))},null,8,["term","group-type","validation-errors"]),o("div",iK,[n(b,{disabled:!_.value||s.value,loading:s.value,type:"primary",onClick:g},{default:d(()=>[R(m(A(u)("Add term")),1)]),_:1},8,["disabled","loading"])])])}}},dK={class:"fct-advanced-variation-config"},uK={class:"fct-adv-var-attributes"},cK={key:0,class:"fct-adv-var-loading"},AK={key:1,class:"fct-adv-var-empty-hint"},pK={key:2,class:"fct-adv-var-empty-state"},fK={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},mK={class:"fct-adv-var-empty-state__copy"},hK=["aria-expanded","onClick","onKeydown"],_K={class:"fct-option-card-summary"},vK={class:"fct-option-card-summary-header"},gK={key:0,class:"fct-option-card-chips"},yK=["src","alt"],bK={class:"fct-option-value-chip-label"},wK=["aria-label","title","onClick"],CK={key:0,class:"fct-option-card-body"},kK={class:"fct-option-label"},BK={key:0,class:"mt-2"},xK={key:1,class:"fct-option-error"},SK={class:"fct-option-label"},FK={key:0,class:"fct-select-all-header"},$K={class:"fct-option-item"},EK={class:"fct-option-item"},UK={key:1,class:"fct-picker-inline-form-body"},IK={class:"fct-picker-inline-form-actions"},QK={key:1,class:"fct-option-field-values"},DK={class:"fct-option-empty-default"},VK={key:0,class:"fct-select-all-header"},TK={class:"fct-color-option"},MK={key:1,class:"fct-picker-inline-form-body"},LK={class:"fct-picker-inline-form-actions"},RK={key:2,class:"fct-option-field-values"},OK={class:"fct-option-empty-default"},HK={key:0,class:"fct-select-all-header"},PK={class:"fct-image-option"},NK=["src"],KK={key:1,class:"fct-picker-inline-form-body"},GK={class:"fct-picker-inline-form-actions"},jK={key:3,class:"fct-option-error"},zK={class:"fct-option-card-actions"},qK=["title"],YK={key:5,class:"fct-adv-order-save-bar"},WK={class:"fct-adv-order-save-bar__msg"},JK={class:"fct-adv-order-save-bar__actions"},XK={key:6},ZK={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},eG={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},tG={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},aG={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},_o=200,sr=10,nr=100,lc=200,lG={__name:"AdvancedVariationConfig",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M([]),l=M([]),s=M(!1),i=M(!1),c=M(!1),p=M(null),f=M(!1),_=M(null),g=M(!1),y=M(null),v=M(null),b=M([]),k=M([]),w=M(""),S=ce=>JSON.stringify(ce.map(oe=>({group_id:oe.group_id||null,variants:[...oe.variants||[]].map(Ue=>String(Ue))}))),$=()=>{k.value=l.value.map(ce=>({group_id:ce.group_id||null,title:ce.title||"",variants:Array.isArray(ce.variants)?[...ce.variants]:[]})),w.value=S(l.value)},V=N(()=>{const ce=l.value.filter(oe=>oe.group_id&&Array.isArray(oe.variants)&&oe.variants.length>0);return ce.length===0?w.value!==S([]):S(ce)!==w.value}),F=N(()=>l.value.length===0?u("All options removed. Save to delete all variations."):u("Option config changed. Save to update variants.")),x=N(()=>{if(p.value===null||!v.value)return!1;const ce=l.value[p.value];if(!ce)return!1;if(String(ce.group_id||"")!==String(v.value.group_id||"")||(ce.title||"")!==(v.value.title||""))return!0;const oe=Array.isArray(ce.variants)?ce.variants:[],Ue=Array.isArray(v.value.variants)?v.value.variants:[];if(oe.length!==Ue.length)return!0;const Te=oe.map(ct=>String(ct)),Pe=Ue.map(ct=>String(ct));return Te.some((ct,At)=>ct!==Pe[At])});Ie(()=>{D(),Q()}),xt(()=>{He()});const Q=()=>{c.value=!0,ue.get("options/attr/groups/library").then(ce=>{a.value=(ce.groups||[]).slice(0,lc),l.value.forEach(oe=>O(oe.group_id))}).catch(ce=>{var oe;z.error(((oe=ce==null?void 0:ce.data)==null?void 0:oe.message)||u("Failed to load attribute groups"))}).finally(()=>{c.value=!1})},D=()=>{var Ue,Te;const ce=(Te=(Ue=t.product)==null?void 0:Ue.detail)==null?void 0:Te.other_info,oe=ce==null?void 0:ce.attribute_config;oe&&Array.isArray(oe)&&(l.value=oe.map(Pe=>({group_id:/^\d+$/.test(String(Pe.group_id))?parseInt(Pe.group_id,10):Pe.group_id,title:Pe.title||"",variants:(Pe.variants||[]).map(ct=>parseInt(ct,10)).filter(Number.isFinite),errors:{name:"",values:""}}))),ne(),$()},T=new Set,U=M({}),I=N(()=>{if(!v.value||!v.value.group_id)return!1;const ce=parseInt(v.value.group_id,10);return!!U.value[ce]}),O=ce=>{if(!/^\d+$/.test(String(ce)))return;const oe=parseInt(ce,10),Ue=a.value.find(Pe=>Ee(Pe.id,oe));if(!Ue||Array.isArray(Ue.terms)||T.has(oe))return;T.add(oe),U.value[oe]=!0;const Te=Math.min(Math.max(parseInt(Ue.terms_count,10)||0,50),200);ue.get("options/attr/group/"+oe+"/terms",{per_page:Te}).then(Pe=>{Ue.terms=Pe.terms&&Pe.terms.data||[]}).catch(Pe=>{var ct;z.error(((ct=Pe==null?void 0:Pe.data)==null?void 0:ct.message)||u("Failed to load option values"))}).finally(()=>{T.delete(oe),delete U.value[oe]})},L=new Set;let P=null;const q=(ce,oe)=>{const Ue=(oe||"").trim();if(!Ue||!/^\d+$/.test(String(ce)))return;const Te=parseInt(ce,10),Pe=a.value.find(rt=>Ee(rt.id,Te));if(!Pe)return;const ct=Array.isArray(Pe.terms)?Pe.terms.length:0,At=parseInt(Pe.terms_count,10)||0;At&&ct>=At||Array.isArray(Pe.terms)&&Pe.terms.some(rt=>(rt.title||"").trim().toLowerCase()===Ue.toLowerCase())||(P&&clearTimeout(P),P=setTimeout(()=>{const rt=Te+":"+Ue.toLowerCase();L.has(rt)||(L.add(rt),ue.get("options/attr/group/"+Te+"/terms",{search:Ue,per_page:50}).then(Lt=>{const $a=Lt.terms&&Lt.terms.data||[];if(!$a.length)return;Array.isArray(Pe.terms)||(Pe.terms=[]);const zt=new Set(Pe.terms.map(Sa=>Sa.id)),ha=$a.filter(Sa=>!zt.has(Sa.id));ha.length&&(Pe.terms=[...Pe.terms,...ha])}).catch(()=>{}).finally(()=>{L.delete(rt)}))},250))},X=ce=>{if(!/^\d+$/.test(String(ce)))return;const oe=parseInt(ce,10),Ue=a.value.find(Pe=>Ee(Pe.id,oe));if(!Ue||T.has(oe))return;T.add(oe);const Te=Math.min(Math.max(parseInt(Ue.terms_count,10)||0,50),200);ue.get("options/attr/group/"+oe+"/terms",{per_page:Te}).then(Pe=>{const ct=Pe.terms&&Pe.terms.data||[],At=new Map((Array.isArray(Ue.terms)?Ue.terms:[]).map(Lt=>[Lt.id,Lt]));ct.forEach(Lt=>At.set(Lt.id,Lt)),Ue.terms=Array.from(At.values());const rt=Pe.terms&&Pe.terms.total;typeof rt=="number"&&(Ue.terms_count=rt)}).catch(()=>{}).finally(()=>{T.delete(oe)})};let G=!1;const te=()=>{G||(G=!0,ue.get("options/attr/groups/library").then(ce=>{const oe=(ce.groups||[]).slice(0,lc),Ue=new Map(a.value.map(Te=>[Te.id,Te]));oe.forEach(Te=>{const Pe=Ue.get(Te.id);Ue.set(Te.id,Pe&&Array.isArray(Pe.terms)?{...Te,terms:Pe.terms}:Te)}),a.value=Array.from(Ue.values())}).catch(()=>{}).finally(()=>{G=!1}))},ne=()=>{b.value=l.value.map(ce=>ce.group_id).filter(Boolean)},re=()=>{v.value=null,p.value=null,l.value=k.value.map(ce=>({group_id:ce.group_id,title:ce.title,variants:[...ce.variants],errors:{name:"",values:""}}))},K=async()=>{if(p.value!==null&&(await me(p.value),p.value!==null))return;if(i.value=!0,!await nt()){i.value=!1;return}jt({silent:!1})},Y=ce=>{const oe=l.value.filter((Ue,Te)=>Te!==ce).map(Ue=>Ue.group_id).filter(Boolean);return a.value.filter(Ue=>!oe.includes(Ue.id))},W=async()=>{if(p.value!==null&&(await me(p.value),p.value!==null))return;l.value.push({group_id:null,title:"",variants:[],errors:{name:"",values:""}});const ce=l.value.length-1;he(ce)},j=ce=>{l.value.splice(ce,1),p.value===ce?(p.value=null,v.value=null):p.value!==null&&p.value>ce&&p.value--},ie=ce=>{p.value===ce?me(ce):he(ce)},he=ce=>{const oe=l.value[ce];v.value={group_id:oe.group_id||null,title:oe.title||"",variants:Array.isArray(oe.variants)?[...oe.variants]:[],errors:{name:"",values:""}},p.value=ce,O(oe.group_id)},me=async ce=>{if(!v.value||(v.value.errors.name=v.value.group_id?"":u("Option name is required."),v.value.errors.values=!v.value.variants||v.value.variants.length===0?u("Please add at least one option value."):"",v.value.errors.name||v.value.errors.values))return;const oe=l.value[ce];oe.group_id=v.value.group_id,oe.title=v.value.title,oe.variants=[...v.value.variants],oe.errors={name:"",values:""},v.value=null,p.value=null},ye=M(""),se=ce=>{ye.value=ce||""},fe=ce=>{if(ce){te();return}ye.value=""},$e=ce=>{const oe=Y(ce),Ue=ye.value.trim().toLowerCase();return Ue?oe.filter(Te=>typeof Te.title=="string"&&Te.title.toLowerCase().includes(Ue)):oe},tt=N(()=>{const ce=ye.value.trim().toLowerCase();return ce?!a.value.some(oe=>typeof oe.title=="string"&&oe.title.trim().toLowerCase()===ce):!0}),ve=ce=>{if(v.value){if(typeof ce=="string"&&ce!==""){const oe=ce.trim().toLowerCase(),Ue=a.value.find(Te=>typeof Te.title=="string"&&Te.title.trim().toLowerCase()===oe);Ue?(v.value.group_id=Ue.id,v.value.title=Ue.title,v.value.variants=[],O(Ue.id)):(v.value.title=ce,v.value.variants=[])}else{const oe=a.value.find(Ue=>Ee(Ue.id,ce));oe&&(v.value.title=oe.title,v.value.variants=[]),O(ce)}v.value.errors&&(v.value.errors.name="")}},Je=N(()=>v.value?typeof v.value.group_id=="string"&&v.value.group_id.trim()!=="":!1),vt=M(!1),Ye=async ce=>{var Pe;if(!ce||typeof ce.group_id!="string"||ce.group_id.trim()==="")return ce?ce.group_id:null;const oe=ce.group_id.trim(),Ue=oe.toLowerCase(),Te=a.value.find(ct=>typeof ct.title=="string"&&ct.title.trim().toLowerCase()===Ue);if(Te)return ce.group_id=Te.id,ce.title=Te.title,O(Te.id),Te.id;vt.value=!0;try{const ct=await ue.post("options/attr/group/",{title:oe,slug:oe}),At=ct.data||ct.group||ct;if(!At||!At.id)return z.error(u("Failed to create attribute group")),null;a.value=[...a.value,{...At,terms:At.terms||[]}];const rt=parseInt(At.id,10);return ce.group_id=rt,ce.title=At.title||oe,rt}catch(ct){let At="";if((ct==null?void 0:ct.status_code)===422||(ct==null?void 0:ct.status)===422){z.validationErrors(ct);const rt=ct!=null&&ct.data&&typeof ct.data=="object"?ct.data:{},Lt=Object.values(rt)[0],$a=Lt&&typeof Lt=="object"?Object.values(Lt)[0]:Lt;At=typeof $a=="string"?$a:u("Failed to create attribute group")}else At=((Pe=ct==null?void 0:ct.data)==null?void 0:Pe.message)||u("Failed to create attribute group"),z.error(At);return ce.errors&&(ce.errors.name=At),null}finally{vt.value=!1}},xe=async()=>!v.value||!Je.value?!0:await Ye(v.value)!==null,Ee=(ce,oe)=>String(ce)===String(oe),Oe=ce=>{const oe=a.value.find(Ue=>Ee(Ue.id,ce));return oe?oe.terms||[]:[]},Me=ce=>{if(!v.value||!Ee(v.value.group_id,ce))return[];const oe=Oe(ce).map(Ue=>Ue.title.toLowerCase());return(v.value.variants||[]).filter(Ue=>typeof Ue=="string"&&Ue.trim()!==""&&!oe.includes(Ue.toLowerCase()))},gt=N(function(){if(!v.value||!v.value.group_id)return!1;var ce=Oe(v.value.group_id);return ce.length?ce.every(function(oe){return v.value.variants.some(function(Ue){return Ee(Ue,oe.id)})}):!1}),yt=N(function(){if(!v.value||!v.value.group_id)return!1;var ce=Oe(v.value.group_id),oe=ce.filter(function(Ue){return v.value.variants.some(function(Te){return Ee(Te,Ue.id)})}).length;return oe>0&&oe<ce.length}),Mt=function(ce){if(v.value){var oe=String(ce),Ue=v.value.variants.findIndex(function(Te){return String(Te)===oe});Ue===-1?v.value.variants.push(ce):v.value.variants.splice(Ue,1)}},Ut=function(ce){if(v.value){var oe=Oe(v.value.group_id);v.value.variants=ce?oe.map(function(Ue){return Ue.id}):[]}},Dt=(ce,oe)=>{const Ue=p.value===oe&&v.value?v.value:ce;if(Ue.title)return Ue.title;const Te=a.value.find(Pe=>Ee(Pe.id,Ue.group_id));return Te&&Te.title?Te.title:u("Untitled option")},ht=N(()=>{const ce=l.value.map(oe=>oe.group_id).filter(Boolean);return new Set(ce).size!==ce.length}),Pt=N(()=>l.value.length>sr),Ct=N(()=>l.value.length>0&&l.value.length<=sr&&!ht.value&&l.value.every(ce=>ce.group_id&&ce.variants&&ce.variants.length>0&&ce.variants.every(oe=>typeof oe=="number"))),St=N(()=>Ct.value?l.value.reduce((ce,oe)=>ce*(oe.variants?oe.variants.length:0),1):0),Ot=N(()=>St.value>_o),Ht=N(()=>{const ce=l.value.filter(oe=>oe.group_id&&Array.isArray(oe.variants)&&oe.variants.length>0);return ce.length?ce.reduce((oe,Ue)=>oe*Ue.variants.length,1):0}),It=N(()=>{const ce=l.value.filter(Ue=>Array.isArray(Ue.variants)&&Ue.variants.length>0);if(!ce.length)return 0;let oe=ce.length-1;return ce.forEach(Ue=>{const Te=Ue.variants.map(ct=>parseInt(ct,10)).filter(Number.isFinite),Pe=Te.length?Math.max(...Te):0;oe+=String(Pe).length}),oe}),mt=N(()=>It.value>nr),jt=({silent:ce=!1}={})=>{if(s.value)return;if(l.value.length===0){s.value=!0,ue.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:[]}).then(()=>{const Te=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Te&&(Te.variants=[]),ne(),$(),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(Te=>{var Pe;z.error(((Pe=Te==null?void 0:Te.data)==null?void 0:Pe.message)||u("Failed to clear variations"))}).finally(()=>{s.value=!1,i.value=!1});return}if(!Ct.value){ce||z.error(u("Please select at least one term for each attribute.")),i.value=!1;return}if(Ot.value){ce||z.error(u("Too many combinations (%1$s). Maximum allowed is %2$s.",St.value,_o)),i.value=!1;return}if(mt.value){ce||z.error(u("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",nr)),i.value=!1;return}s.value=!0;const oe=l.value.map(Te=>({group_id:Te.group_id,title:Te.title,variants:[...new Set((Te.variants||[]).map(Pe=>parseInt(Pe,10)).filter(Number.isFinite))]}));let Ue=null;ue.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:oe}).then(Te=>{ce||(Ue=Te.message||u("Variations generated successfully!")),ne(),$();const Pe=Te&&Array.isArray(Te.data)?Te.data:null,ct=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Pe&&ct&&(ct.variants=Pe),t.productEditModel.data.reloader(),typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(Te=>{var Pe;z.error(((Pe=Te==null?void 0:Te.data)==null?void 0:Pe.message)||u("Failed to generate variations"))}).finally(async()=>{var rt,Lt;await ke();const Te=(Lt=(rt=t.productEditModel)==null?void 0:rt.data)==null?void 0:Lt.product,Pe=()=>{const $a=Te?Te.variants:null;return Array.isArray($a)&&$a.some(zt=>Array.isArray(zt.attr_map)&&zt.attr_map.length>0)},ct=2500,At=Date.now();for(;!Pe()&&Date.now()-At<ct;)await new Promise($a=>setTimeout($a,50));await ke(),s.value=!1,await ke(),await ke(),i.value=!1,Ue&&(z.success(Ue),Ue=null)})},ge=ce=>{v.value&&v.value.errors&&ce&&ce.length>0&&(v.value.errors.values="")},Fe=async(ce,{silent:oe=!1}={})=>{var ct;const Ue=Oe(ce.group_id).map(At=>At.title.toLowerCase()),Te=(ce.variants||[]).filter(At=>typeof At=="string"&&!Ue.includes(At.toLowerCase()));if(!Te.length)return!0;const Pe=a.value.find(At=>Ee(At.id,ce.group_id));try{const At=await ue.post("options/attr/group/"+ce.group_id+"/terms",{terms:Te.map(Lt=>({title:Lt}))}),rt=At.data;Pe&&(Array.isArray(Pe.terms)||(Pe.terms=[]),Pe.terms=[...Pe.terms,...rt]),rt.forEach(Lt=>{ce.variants=ce.variants.map($a=>typeof $a=="string"&&$a.toLowerCase()===Lt.title.toLowerCase()?Lt.id:$a)}),ce.variants=ce.variants.filter(Lt=>typeof Lt!="string"),oe||z.success(At.message||u("Option values created successfully"))}catch(At){return ce.variants=ce.variants.filter(rt=>typeof rt!="string"),z.error(((ct=At==null?void 0:At.data)==null?void 0:ct.message)||u("Failed to create option values")),!1}return!0},nt=async()=>{for(const ce of l.value)if(typeof ce.group_id=="string"&&ce.group_id.trim()!==""&&!await Ye(ce)||!await Fe(ce,{silent:!0}))return!1;return!0},bt=ce=>{const oe=a.value.find(Ue=>Ee(Ue.id,ce));return oe&&oe.settings&&oe.settings.type?oe.settings.type:"options"},Bt=ce=>({options:u("Text"),color:u("Color"),image:u("Image")})[bt(ce)]||bt(ce),Wt=ce=>({options:"info",color:"warning",image:"success"})[bt(ce)]||"info",_t=ce=>{if(!ce.variants||ce.variants.length===0)return[];const oe=Oe(ce.group_id);return ce.variants.map(Ue=>typeof Ue=="string"?{id:Ue,title:Ue}:oe.find(Te=>Ee(Te.id,Ue))).filter(Boolean)},la=ce=>ce.title?u("Add %1$s",ce.title.toLowerCase()):u("Add more value"),sa=M(""),Nt=M(""),ia=M("");let el=null;const Ll=ce=>{el=ce},Ra=M(!1),na=M({title:"",settings:{color:"",image:""}}),Z=M(!1),we=M({}),le=ce=>{Nt.value=ce||"",v.value&&q(v.value.group_id,ce)},pe=N(()=>{if(!v.value||!v.value.group_id)return[];const ce=Oe(v.value.group_id),oe=Nt.value.trim().toLowerCase();return oe?ce.filter(Ue=>(Ue.title||"").toLowerCase().includes(oe)):ce}),je=()=>{const ce=Nt.value.trim();if(!ce||!v.value||!v.value.group_id)return;const oe=bt(v.value.group_id);oe!=="color"&&oe!=="image"||ee(ce)},at=(ce,oe)=>{if(!ce||ce.key!=="Enter"||!v.value||!v.value.group_id)return;const Ue=bt(v.value.group_id);if(Ue!=="color"&&Ue!=="image")return;const Te=ce.target,Pe=(Te&&typeof Te.value=="string"?Te.value:"").trim();!Pe||Oe(v.value.group_id).find(At=>typeof At.title=="string"&&At.title.trim().toLowerCase()===Pe.toLowerCase())||(ce.preventDefault(),ce.stopPropagation(),ee(Pe))};let Ke=null,qe=null,ft=null,Xe=null;const Et=ce=>{Ke=ce},Xt=ce=>{y.value=ce,g.value=!0},Ae=ce=>{if(!ce||!ce.id){g.value=!1,y.value=null;return}const oe=y.value;a.value=[...a.value,{...ce,terms:ce.terms||[]}],oe!==null&&v.value&&p.value===oe&&(v.value.group_id=parseInt(ce.id,10),v.value.title=ce.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),O(parseInt(ce.id,10))),g.value=!1,y.value=null},_e=ce=>{ia.value=ce||"",v.value&&q(v.value.group_id,ce)},Le=N(()=>{if(!v.value||!v.value.group_id)return[];const ce=Oe(v.value.group_id),oe=ia.value.trim().toLowerCase();return oe?ce.filter(Ue=>(Ue.title||"").toLowerCase().includes(oe)):ce}),Ve=N(()=>{if(!v.value||!v.value.group_id)return[];const ce=Me(v.value.group_id),oe=ia.value.trim().toLowerCase();return oe?ce.filter(Ue=>(Ue||"").toLowerCase().includes(oe)):ce}),ee=ce=>{na.value={title:(ce||"").trim(),settings:{color:"",image:""}},Ra.value=!0,we.value={},qe||(qe=function(oe){var Ue=document.querySelector(".fct-option-values-select");if(!(Ue&&Ue.contains(oe.target))){var Te=document.querySelector(".el-color-picker__panel");Te&&Te.contains(oe.target)||oe.stopPropagation()}},document.addEventListener("mousedown",qe,!0),ft=function(oe){var Ue=document.querySelector(".el-color-picker__panel");Ue&&Ue.contains(oe.target)&&oe.stopPropagation()},document.body.addEventListener("mousedown",ft)),Xe&&document.removeEventListener("keyup",Xe,!0),Xe=function(oe){oe.key==="Enter"&&(oe.stopPropagation(),document.removeEventListener("keyup",Xe,!0),Xe=null)},document.addEventListener("keyup",Xe,!0),ke(()=>{var oe=document.querySelector(".fct-option-values-select");if(oe){var Ue=Ke||el;if(Ue){var Te=Ue.$el||Ue,Pe=Te?Te.getBoundingClientRect().width:0;Pe>0&&(oe.style.maxWidth=Pe+"px")}}})},He=()=>{Ra.value=!1,na.value={title:"",settings:{color:"",image:""}},we.value={},qe&&(document.removeEventListener("mousedown",qe,!0),qe=null),ft&&(document.body.removeEventListener("mousedown",ft),ft=null),Xe&&(document.removeEventListener("keyup",Xe,!0),Xe=null);var ce=document.querySelector(".fct-option-values-select");ce&&(ce.style.maxWidth="")},ut=async ce=>{const oe=(na.value.title||"").trim();if(!oe||Z.value||!v.value||!v.value.group_id)return;Z.value=!0,we.value={};const Ue={terms:[{title:oe,settings:{color:na.value.settings.color||"",image:na.value.settings.image||""}}]};try{if(Je.value&&!await xe())return;const Te=await ue.post("options/attr/group/"+v.value.group_id+"/terms",Ue),Pe=Array.isArray(Te.data)?Te.data[0]:Te.data;_.value=ce,wa(Pe),He(),Nt.value="",ia.value=""}catch(Te){Te&&Te.status_code===422&&Te.data?we.value=Te.data:z.error(Te&&Te.data&&Te.data.message||Te&&Te.message||u("Failed to add the term."))}finally{Z.value=!1}},Se=ce=>{if(ce){v.value&&X(v.value.group_id);return}He(),Nt.value=""},kt=ce=>{if(ce){v.value&&X(v.value.group_id);return}He(),ia.value=""},wa=ce=>{const oe=_.value,Ue=l.value[oe];if(Ue){const Te=v.value?v.value.group_id:Ue.group_id;if(Te&&/^\d+$/.test(String(Te))){const Pe=parseInt(Te,10),ct=a.value.find(At=>Ee(At.id,Pe));if(ct&&ce&&Array.isArray(ct.terms)?ct.terms.push(ce):(ct&&delete ct.terms,O(Pe)),ce&&v.value&&Array.isArray(v.value.variants)){const At=(ce.title||"").trim().toLowerCase();v.value.variants=v.value.variants.filter(function(rt){return!(typeof rt=="string"&&rt.trim().toLowerCase()===At)}),v.value.variants.some(function(rt){return String(rt)===String(ce.id)})||v.value.variants.push(ce.id)}}z.success(u("Term created successfully"))}f.value=!1,_.value=null,sa.value=""};return(ce,oe)=>{var $a;const Ue=C("router-link"),Te=C("el-tag"),Pe=C("el-option"),ct=C("el-select"),At=C("el-button"),rt=C("el-checkbox"),Lt=C("el-dialog");return r(),h("div",dK,[o("div",uK,[c.value?(r(),h("div",cK,[(r(!0),h(H,null,ae(l.value.length||3,zt=>(r(),h("div",{key:zt,class:"fct-adv-var-loading-card"},oe[26]||(oe[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))])):B("",!0),l.value.length===0&&!c.value&&a.value.length===0?(r(),h("div",AK,[R(m(A(u)("No attribute groups found."))+" ",1),n(Ue,{to:{name:"attributes"}},{default:d(()=>[R(m(A(u)("Create attribute groups")),1)]),_:1})])):l.value.length===0&&!c.value?(r(),h("div",pK,[o("span",fK,[n(J,{name:"Information"})]),o("div",mK,[o("strong",null,m(A(u)("No options added yet.")),1),o("span",null,m(A(u)("Add options like Color, Size etc. to create variations.")),1)])])):B("",!0),l.value.length>0&&!c.value?(r(),E(A(an),{key:3,modelValue:l.value,"onUpdate:modelValue":oe[22]||(oe[22]=zt=>l.value=zt),handle:".fct-option-drag-handle",disabled:l.value.length<=1||p.value!==null,class:"fct-option-card-list"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,(zt,ha)=>(r(),h("div",{key:zt.group_id||"new-"+ha,class:"fct-option-card"},[o("div",{class:"fct-option-card-collapsed",role:"button",tabindex:"0","aria-expanded":p.value===ha,onClick:Sa=>ie(ha),onKeydown:xa(Ne(Sa=>ie(ha),["prevent"]),["enter","space"])},[l.value.length>1?(r(),h("span",{key:0,class:"fct-option-drag-handle",onClick:oe[0]||(oe[0]=Ne(()=>{},["stop"]))},[n(J,{name:"ReorderDotsVertical"})])):B("",!0),o("div",_K,[o("div",vK,[o("strong",null,m(Dt(zt,ha)),1),zt.group_id?(r(),E(Te,{key:0,size:"small",type:Wt(zt.group_id),class:"fct-group-type-badge"},{default:d(()=>[R(m(Bt(zt.group_id)),1)]),_:2},1032,["type"])):B("",!0)]),_t(zt).length?(r(),h("div",gK,[(r(!0),h(H,null,ae(_t(zt),Sa=>(r(),h("span",{key:Sa.id,class:de(["fct-option-value-chip",`fct-option-value-chip--${bt(zt.group_id)}`])},[bt(zt.group_id)==="color"?(r(),h("span",{key:0,class:"fct-option-value-swatch",style:ua({background:Sa.settings&&Sa.settings.color?Sa.settings.color:""})},null,4)):bt(zt.group_id)==="image"&&Sa.settings&&Sa.settings.image?(r(),h("img",{key:1,src:Sa.settings.image,alt:Sa.title,class:"fct-option-value-img"},null,8,yK)):B("",!0),o("span",bK,m(Sa.title),1)],2))),128))])):B("",!0)]),p.value===ha?(r(),h("button",{key:1,type:"button",class:"fct-option-card-toggle fct-option-card-toggle--open","aria-label":A(u)("Done"),title:A(u)("Done"),onClick:Ne(Sa=>me(ha),["stop"])},oe[27]||(oe[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,wK)):B("",!0)],40,hK),n(va,{accordion:"",visible:p.value===ha},{default:d(()=>{var Sa,We,Zt,Ka;return[p.value===ha&&v.value?(r(),h("div",CK,[o("div",{class:de(["fct-option-field",{"fct-option-field--error":(Sa=v.value.errors)==null?void 0:Sa.name}])},[o("label",kK,m(A(u)("Option name")),1),n(ct,{modelValue:v.value.group_id,"onUpdate:modelValue":oe[1]||(oe[1]=ze=>v.value.group_id=ze),filterable:"","allow-create":tt.value,"default-first-option":"","filter-method":se,"popper-class":"fct-option-name-select",placeholder:A(u)("Select or type a new option"),onChange:oe[2]||(oe[2]=ze=>ve(ze)),onVisibleChange:fe},{default:d(()=>[(r(!0),h(H,null,ae($e(ha),ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","allow-create","placeholder"]),v.value.group_id?B("",!0):(r(),h("div",BK,[n(At,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:ze=>Xt(ha)},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(A(u)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(We=v.value.errors)!=null&&We.name?(r(),h("div",xK,[n(J,{name:"AlertIcon"}),o("span",null,m(v.value.errors.name),1)])):B("",!0)],2),o("div",{class:de(["fct-option-field",{"fct-option-field--error":(Zt=v.value.errors)==null?void 0:Zt.values}])},[o("label",SK,m(A(u)("Option values")),1),bt(v.value.group_id)==="options"?(r(),E(ct,{key:0,ref_for:!0,ref:Ll,modelValue:v.value.variants,"onUpdate:modelValue":oe[8]||(oe[8]=ze=>v.value.variants=ze),multiple:"",filterable:"","allow-create":"","default-first-option":"","filter-method":_e,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:la(v.value),disabled:!v.value.group_id,loading:I.value,"loading-text":A(u)("Loading..."),onChange:oe[9]||(oe[9]=ze=>ge(ze)),onVisibleChange:kt},{tag:d(()=>[n(lr,{modelValue:v.value.variants,"onUpdate:modelValue":oe[3]||(oe[3]=ze=>v.value.variants=ze),terms:Oe(v.value.group_id),type:bt(v.value.group_id)},null,8,["modelValue","terms","type"])]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",FK,[n(rt,{"model-value":gt.value,indeterminate:yt.value,onChange:Ut},null,8,["model-value","indeterminate"]),o("span",null,m(A(u)("Select all")),1)])):B("",!0)]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:oe[7]||(oe[7]=Ne(()=>{},["self","prevent"]))},[Ra.value?(r(),h("div",UK,[n(bo,{term:na.value,"group-type":"options","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ha),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",IK,[n(At,{type:"primary",size:"small",loading:Z.value,disabled:!na.value.title.trim()||Z.value,onClick:ze=>ut(ha)},{default:d(()=>[R(m(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(At,{size:"small",onClick:He},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[ia.value.trim()&&!Oe(v.value.group_id).some(function(ze){return ze.title.toLowerCase()===ia.value.trim().toLowerCase()})?(r(),E(At,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[6]||(oe[6]=ze=>ee(ia.value))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(A(u)('Add "%1$s" as new value',ia.value.trim())),1)]),_:1})):B("",!0)],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(Le.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",$K,[n(rt,{"model-value":v.value.variants.some(function(Tt){return Ee(Tt,ze.id)}),tabindex:"-1",onClick:oe[4]||(oe[4]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(ze.id)},null,8,["model-value","onChange"]),o("span",null,m(ze.title),1)])]),_:2},1032,["label","value"]))),128)),(r(!0),h(H,null,ae(Ve.value,ze=>(r(),E(Pe,{key:ze,label:ze,value:ze},{default:d(()=>[o("div",EK,[n(rt,{"model-value":!0,tabindex:"-1",onClick:oe[5]||(oe[5]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(ze)},null,8,["onChange"]),o("span",null,m(ze),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text"])):bt(v.value.group_id)==="color"?(r(),h("div",QK,[n(ct,{ref_for:!0,ref:Et,modelValue:v.value.variants,"onUpdate:modelValue":oe[15]||(oe[15]=ze=>v.value.variants=ze),multiple:"",filterable:"","filter-method":le,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:la(v.value),disabled:!v.value.group_id,loading:I.value,"loading-text":A(u)("Loading..."),onKeydownCapture:ze=>at(ze,ha),onVisibleChange:Se},{empty:d(()=>[o("div",DK,m(A(u)("No matching data")),1)]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",VK,[n(rt,{"model-value":gt.value,indeterminate:yt.value,onChange:Ut},null,8,["model-value","indeterminate"]),o("span",null,m(A(u)("Select all")),1)])):B("",!0)]),tag:d(()=>[n(lr,{modelValue:v.value.variants,"onUpdate:modelValue":oe[10]||(oe[10]=ze=>v.value.variants=ze),terms:Oe(v.value.group_id),type:"color"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:oe[14]||(oe[14]=Ne(()=>{},["self","prevent"]))},[Ra.value?(r(),h("div",MK,[n(bo,{term:na.value,"group-type":"color","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ha),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",LK,[n(At,{type:"primary",size:"small",loading:Z.value,disabled:!na.value.title.trim()||Z.value,onClick:ze=>ut(ha)},{default:d(()=>[R(m(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(At,{size:"small",onClick:He},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[Nt.value.trim()&&!pe.value.some(function(ze){return ze.title.toLowerCase()===Nt.value.trim().toLowerCase()})?(r(),E(At,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[12]||(oe[12]=ze=>je())},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(A(u)('Add "%1$s" as new value',Nt.value.trim())),1)]),_:1})):(r(),E(At,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[13]||(oe[13]=ze=>ee(""))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(pe.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",TK,[n(rt,{"model-value":v.value.variants.some(function(Tt){return Ee(Tt,ze.id)}),tabindex:"-1",onClick:oe[11]||(oe[11]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(ze.id)},null,8,["model-value","onChange"]),o("span",{class:"fct-color-dot",style:ua({background:ze.settings&&ze.settings.color?ze.settings.color:""})},null,4),R(" "+m(ze.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):bt(v.value.group_id)==="image"?(r(),h("div",RK,[n(ct,{ref_for:!0,ref:Et,modelValue:v.value.variants,"onUpdate:modelValue":oe[21]||(oe[21]=ze=>v.value.variants=ze),multiple:"",filterable:"","filter-method":le,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:la(v.value),disabled:!v.value.group_id,loading:I.value,"loading-text":A(u)("Loading..."),onKeydownCapture:ze=>at(ze,ha),onVisibleChange:Se},{empty:d(()=>[o("div",OK,m(A(u)("No matching data")),1)]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",HK,[n(rt,{"model-value":gt.value,indeterminate:yt.value,onChange:Ut},null,8,["model-value","indeterminate"]),o("span",null,m(A(u)("Select all")),1)])):B("",!0)]),tag:d(()=>[n(lr,{modelValue:v.value.variants,"onUpdate:modelValue":oe[16]||(oe[16]=ze=>v.value.variants=ze),terms:Oe(v.value.group_id),type:"image"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:oe[20]||(oe[20]=Ne(()=>{},["self","prevent"]))},[Ra.value?(r(),h("div",KK,[n(bo,{term:na.value,"group-type":"image","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ha),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",GK,[n(At,{type:"primary",size:"small",loading:Z.value,disabled:!na.value.title.trim()||Z.value,onClick:ze=>ut(ha)},{default:d(()=>[R(m(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(At,{size:"small",onClick:He},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[Nt.value.trim()&&!pe.value.some(function(ze){return ze.title.toLowerCase()===Nt.value.trim().toLowerCase()})?(r(),E(At,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[18]||(oe[18]=ze=>ee(Nt.value))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(A(u)('Add "%1$s" as new value',Nt.value.trim())),1)]),_:1})):(r(),E(At,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[19]||(oe[19]=ze=>ee(""))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(pe.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",PK,[n(rt,{"model-value":v.value.variants.some(function(Tt){return Ee(Tt,ze.id)}),tabindex:"-1",onClick:oe[17]||(oe[17]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(ze.id)},null,8,["model-value","onChange"]),o("img",{src:ze.settings&&ze.settings.image?ze.settings.image:"",alt:""},null,8,NK),R(" "+m(ze.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):B("",!0),(Ka=v.value.errors)!=null&&Ka.values?(r(),h("div",jK,[n(J,{name:"AlertIcon"}),o("span",null,m(v.value.errors.values),1)])):B("",!0)],2),o("div",zK,[n(At,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:ze=>j(ha)},{default:d(()=>[R(m(A(u)("Delete")),1)]),_:2},1032,["onClick"])])])):B("",!0)]}),_:2},1032,["visible"])]))),128))]),_:1},8,["modelValue","disabled"])):B("",!0),a.value.length>0?(r(),h("div",{key:4,class:de(["fct-option-add-wrap",{"fct-option-add-wrap--empty":l.value.length===0}])},[n(At,{class:de(["fct-option-add",{"fct-option-add--empty":l.value.length===0}]),size:"small",onClick:W},{default:d(()=>[oe[28]||(oe[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(" "+m(l.value.length===0?A(u)("Add options like size or color"):A(u)("Add more")),1)]),_:1,__:[28]},8,["class"]),Ht.value>0?(r(),h("span",{key:0,class:"fct-adv-var-combinations-chip",title:A(u)("Variant combinations the current options will generate (max %1$s)",_o)},m(A(u)("%1$s combinations",Ht.value)),9,qK)):B("",!0)],2)):B("",!0),(V.value||x.value)&&!i.value?(r(),h("div",YK,[o("span",WK,m(F.value),1),o("div",JK,[n(At,{size:"small",disabled:s.value,onClick:re},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(At,{size:"small",type:"primary",loading:s.value,onClick:K},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading"])])])):B("",!0),Ot.value||Pt.value||ht.value||mt.value?(r(),h("div",XK,[Pt.value?(r(),h("div",ZK,[o("span",null,m(A(u)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",sr)),1)])):ht.value?(r(),h("div",eG,[o("span",null,m(A(u)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Ot.value?(r(),h("div",tG,[o("span",null,m(A(u)("Too many combinations (%1$s). Maximum allowed is %2$s. Remove some option values.",St.value,_o)),1)])):mt.value?(r(),h("div",aG,[o("span",null,m(A(u)("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",nr)),1)])):B("",!0)])):B("",!0)]),l.value.some(zt=>zt.group_id&&zt.variants&&zt.variants.length>0)&&e.product.variants&&e.product.variants.length>0&&(($a=e.product.detail)==null?void 0:$a.variation_type)==="advanced_variations"?(r(),E(aK,{key:0,product:e.product,productEditModel:e.productEditModel,attributeGroups:a.value,"external-busy":i.value||s.value||c.value},null,8,["product","productEditModel","attributeGroups","external-busy"])):B("",!0),n(Lt,{"append-to-body":!0,modelValue:f.value,"onUpdate:modelValue":oe[23]||(oe[23]=zt=>f.value=zt),title:A(u)("Add new attribute term"),onClose:oe[24]||(oe[24]=zt=>sa.value="")},{default:d(()=>[f.value&&_.value!==null&&v.value?(r(),E(rK,{key:0,"group-id":v.value.group_id,group:a.value.find(zt=>Ee(zt.id,v.value.group_id)),"initial-title":sa.value,onIsTermCreatingDone:wa},null,8,["group-id","group","initial-title"])):B("",!0)]),_:1},8,["modelValue","title"]),n(Lt,{"append-to-body":!0,width:"50%",modelValue:g.value,"onUpdate:modelValue":oe[25]||(oe[25]=zt=>g.value=zt),title:A(u)("Add new attribute group")},{default:d(()=>[g.value?(r(),E(hm,{key:0,onWhenGroupCreateIsDone:Ae})):B("",!0)]),_:1},8,["modelValue","title"])])}}},sG={class:"fct-product-pricing-wrap"},nG={class:"w-[150px] fct-select-gray"},oG={key:1,class:"fct-simple-product-actions"},iG={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var p,f;const t=e;M(!1);const a=M((f=(p=t.product)==null?void 0:p.detail)==null?void 0:f.variation_type),l=M(null),s=_=>{var v;const g=t.product.detail.variation_type,y=((v=t.product.variants)==null?void 0:v.length)??0;if(_==="advanced_variations"&&g!=="advanced_variations"){l.value=_,a.value=g,Dn.confirmDeleteWithInput("proceed",u("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}_==="simple"&&g==="simple_variations"&&y>1?(l.value=_,a.value=g,Dn.confirmDeleteWithInput("proceed",u("Switching to 'Simple' will permanently delete all variations except the first one.")).then(()=>{i()}).catch(()=>{l.value||(l.value=null)})):c(_)},i=()=>{l.value&&c(l.value),l.value=null},c=_=>{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 b,k;const y=C("el-option"),v=C("el-select");return r(),h("div",sG,[n(Be,{class:de(((k=(b=e.product)==null?void 0:b.detail)==null?void 0:k.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:d(()=>{var w,S;return[n(Qe,{title:_.$t("Pricing"),border_bottom:""},{action:d(()=>[o("div",nG,[e.product.detail?(r(),E(v,{key:0,size:"small",class:de(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=$=>a.value=$),placeholder:_.$t("Select Variation"),onChange:s},{default:d(()=>[(r(!0),h(H,null,ae(_.appVars.variation_types,($,V)=>{var F,x;return r(),E(y,{key:V,label:$,value:V,disabled:((x=(F=e.product)==null?void 0:F.detail)==null?void 0:x.variation_type)==="advanced_variations"&&V!=="advanced_variations"},null,8,["label","value","disabled"])}),128))]),_:1},8,["class","modelValue","placeholder"])):B("",!0)])]),_:1},8,["title"]),n(Ce,{class:de(((S=(w=e.product)==null?void 0:w.detail)==null?void 0:S.variation_type)==="simple_variations"?"pb-0":"")},{default:d(()=>{var $,V,F,x,Q,D,T,U,I,O,L,P,q,X,G,te,ne;return[((V=($=e.product)==null?void 0:$.detail)==null?void 0:V.variation_type)==="simple"?(r(),E(Ud,{key:0,class:"simple-product-pricing",index:0,modeType:"add",fieldKey:"variants.0",product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0),((x=(F=e.product)==null?void 0:F.detail)==null?void 0:x.variation_type)==="simple"&&((D=(Q=e.product)==null?void 0:Q.variants[0])!=null&&D.id)?(r(),h("div",oG,[n(Ia,{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"]),((U=(T=e.product)==null?void 0:T.detail)==null?void 0:U.variation_type)==="simple"&&(((I=e.product)==null?void 0:I.post_status)==="publish"||((O=e.product)==null?void 0:O.post_status)==="private")&&((P=(L=e.product)==null?void 0:L.variants[0])!=null&&P.id)?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline mt-3",text:((q=_.appVars)==null?void 0:q.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"])):B("",!0)])):B("",!0),((G=(X=e.product)==null?void 0:X.detail)==null?void 0:G.variation_type)==="simple_variations"?(r(),E(iH,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0),((ne=(te=e.product)==null?void 0:te.detail)==null?void 0:ne.variation_type)==="advanced_variations"?(r(),E(lG,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},rG={class:"fct-sku-input-wrap"},dG={class:"fct-sku-edit-actions"},sc={__name:"SkuInput",props:{variant:{type:Object,required:!0},productTitle:{type:String,default:""}},emits:["saved"],setup(e,{emit:t}){const a=e,l=t,s=M(a.variant.sku||""),i=M(a.variant.sku||""),c=M(!1),p=M(!1),f=M(!1),_=()=>{c.value=!0},g=()=>{i.value=s.value,c.value=!1},y=()=>{p.value=!0,ue.post("products/variants/group-bulk-update",{variant_ids:[a.variant.id],sku:i.value}).then(b=>{s.value=i.value,l("saved",i.value),c.value=!1,z.success(b.message)}).catch(b=>{var k;b.status_code=="422"?z.validationErrors(b):z.error((k=b.data)==null?void 0:k.message)}).finally(()=>{p.value=!1})},v=()=>{f.value=!0,ue.get("products/suggest-sku",{title:a.productTitle,variant_title:a.variant.variation_title||"",exclude_id:a.variant.id}).then(b=>{i.value=b.sku,c.value=!0}).catch(b=>{var k;z.error((k=b.data)==null?void 0:k.message)}).finally(()=>{f.value=!1})};return(b,k)=>{const w=C("el-input"),S=C("el-button");return r(),h("div",rG,[n(w,{modelValue:i.value,"onUpdate:modelValue":k[0]||(k[0]=$=>i.value=$),size:"small",placeholder:A(u)("No SKU"),onInput:_,onKeydown:[k[1]||(k[1]=xa(Ne($=>c.value&&y(),["prevent"]),["enter"])),xa(g,["escape"])]},null,8,["modelValue","placeholder"]),o("div",dG,[c.value?(r(),h(H,{key:0},[n(S,{size:"small",type:"primary",title:A(u)("Save SKU"),"aria-label":A(u)("Save SKU"),loading:p.value,onClick:y},{default:d(()=>[n(J,{name:"Check"})]),_:1},8,["title","aria-label","loading"]),n(S,{size:"small",type:"danger",title:A(u)("Discard changes"),"aria-label":A(u)("Discard changes"),onClick:g},{default:d(()=>[n(J,{name:"Close"})]),_:1},8,["title","aria-label"])],64)):(r(),E(S,{key:1,size:"small",class:"fct-sku-suggest-btn",loading:f.value,title:A(u)("Generate SKU"),onClick:v},{default:d(()=>[n(J,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},uG={key:0,class:"fct-product-inventory-wrap"},cG={class:"fct-product-inventory-inner-wrap hide-on-mobile"},AG={key:0,class:"fct-variant-badge fct-variant-badge--light"},pG={class:"fct-inventory-cell-text pl-5"},fG={class:"fct-inventory-cell-text pl-5"},mG={class:"fct-inventory-cell-text pl-5"},hG={class:"fct-product-inventory-inner-wrap-mobile"},_G={class:"fct-product-inventory-mobile-col"},vG={class:"title"},gG={class:"fct-product-inventory-mobile-col"},yG={class:"fct-product-inventory-mobile-col"},bG={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=Ge.get("modules_settings.stock_management.active"),s=M([]),i=M({}),c=(y,v)=>{y&&(i.value[v]=y.scrollWidth>y.clientWidth)};Ie(()=>{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":"",f=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 b=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=b<0?0:b,a.product.variants[y].adjusted_quantity=0,a.product.variants[y].new_stock=a.product.variants[y].total_stock,ue.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(k=>{z.success(k.message)}).catch(k=>{var w;k.status_code=="422"?z.validationErrors(k):z.error((w=k.data)==null?void 0:w.message)})},g=y=>{ue.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(v=>{z.success(v.message),a.product.variants.forEach(b=>{b.manage_stock=y})}).catch(v=>{var b;v.status_code=="422"?z.validationErrors(v):z.error((b=v.data)==null?void 0:b.message)})};return(y,v)=>{const b=C("el-switch"),k=C("el-tooltip"),w=C("el-table-column"),S=C("el-input"),$=C("el-table");return A(l)==="yes"?(r(),h("div",uG,[n(Be,{class:"overflow-hidden"},{default:d(()=>{var V,F;return[n(Qe,{class:de(((V=e.product.detail)==null?void 0:V.manage_stock.toString())==="0"?"pb-5":"")},{action:d(()=>{var x;return[(x=e.product.detail)!=null&&x.manage_stock?(r(),E(b,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=Q=>e.product.detail.manage_stock=Q),onChange:g,"active-value":"1","inactive-value":"0","active-text":A(u)("Inventory Management")},null,8,["modelValue","active-text"])):B("",!0)]}),_:1},8,["class"]),n(va,{visible:((F=e.product.detail)==null?void 0:F.manage_stock.toString())==="1",accordion:""},{default:d(()=>[n(Ce,{class:"px-0 pb-0"},{default:d(()=>[o("div",cG,[n($,{data:e.product.variants,"row-class-name":p},{default:d(()=>[n(w,{label:A(u)("Title"),width:"180"},{default:d(x=>{var Q,D;return[o("div",{class:de(["relative",{"fct-inventory-title-cell--has-badge":((Q=x.row.other_info)==null?void 0:Q.payment_type)==="subscription"}])},[n(k,{content:x.row.variation_title,placement:"top","show-after":300,disabled:!i.value[`title_${x.$index}`]},{default:d(()=>[o("span",{class:"fct-inventory-cell-text truncate block",ref:T=>c(T,`title_${x.$index}`)},m(x.row.variation_title||"--"),513)]),_:2},1032,["content","disabled"]),((D=x.row.other_info)==null?void 0:D.payment_type)==="subscription"?(r(),h("span",AG,m(x.row.other_info.repeat_interval),1)):B("",!0)],2)]}),_:1},8,["label"]),n(w,{label:A(u)("SKU"),width:"220"},{default:d(x=>[n(sc,{variant:x.row,"product-title":e.product.post_title,onSaved:Q=>x.row.sku=Q},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),n(w,{label:A(u)("Total Stock"),width:"120"},{default:d(x=>[o("div",null,[n(S,{modelValue:x.row.total_stock,"onUpdate:modelValue":Q=>x.row.total_stock=Q,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:Q=>{var D;return(D=s.value[x.$index])==null?void 0:D.toggle()}},{append:d(()=>[n(Pr,{ref:Q=>s.value[x.$index]=Q,variant:x.row,"field-key":x.$index,"product-edit-model":e.productEditModel,onSave:Q=>_(x.$index),onClick:v[1]||(v[1]=Ne(()=>{},["stop"]))},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue","onClick"])])]),_:1},8,["label"]),n(w,{label:A(u)("Available"),width:"100"},{default:d(x=>[o("span",pG,m(A(u)(x.row.available)),1)]),_:1},8,["label"]),n(w,{label:A(u)("On hold"),width:"100"},{default:d(x=>[o("span",fG,m(A(u)(x.row.on_hold)),1)]),_:1},8,["label"]),n(w,{label:A(u)("Delivered"),width:"100"},{default:d(x=>[o("span",mG,m(A(u)(x.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",hG,[(r(!0),h(H,null,ae(e.product.variants,(x,Q)=>(r(),h("div",{key:Q,class:de(["fct-product-inventory-mobile-row",f(x)])},[o("div",_G,[o("div",vG,m(x.variation_title||"--"),1),n(sc,{variant:x,"product-title":e.product.post_title,class:"mt-1 mb-2",onSaved:D=>x.sku=D},null,8,["variant","product-title","onSaved"])]),o("div",gG,[n(S,{modelValue:x.total_stock,"onUpdate:modelValue":D=>x.total_stock=D,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(Pr,{variant:x,"field-key":Q,"product-edit-model":e.productEditModel,onSave:D=>_(Q)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",yG,[o("ul",null,[o("li",null,[o("span",null,m(A(u)("Available"))+":",1),R(" "+m(x.available.toString()),1)]),o("li",null,[o("span",null,m(A(u)("On Hold"))+":",1),R(" "+m(x.on_hold.toString()),1)]),o("li",null,[o("span",null,m(A(u)("Delivered"))+":",1),R(" "+m(x.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):B("",!0)}}},wG={class:"el-form el-form--default el-form--label-top"},Zp={__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=N(()=>Go(t.product));return Is(()=>{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(s=>parseInt(s))}catch{}if(t.file&&Array.isArray(t.file.product_variation_id)&&((l=t.product)!=null&&l.variants)){const s=Array.isArray(t.product.variants)?t.product.variants:[],i=new Set(s.map(p=>parseInt(p.id,10))),c=t.file.product_variation_id.filter(p=>i.has(parseInt(p,10)));c.length!==t.file.product_variation_id.length&&(t.file.product_variation_id=c)}}),(l,s)=>{const i=C("el-option"),c=C("el-select"),p=C("el-form-item"),f=C("el-input");return r(),h("div",wG,[n(p,{label:l.$t("Choose variant")},{default:d(()=>[n(c,{class:"",size:"small",modelValue:e.file.product_variation_id,"onUpdate:modelValue":s[0]||(s[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:d(()=>[(r(!0),h(H,null,ae(e.productDownloadableModel.generateVariantOptions(e.product),_=>(r(),E(i,{key:_.id,label:A(Ln)(_,a.value),value:_.id},{default:d(()=>[n(jo,{variant:_,"group-order":a.value},null,8,["variant","group-order"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),n(ra,{"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:d(()=>[n(lA,{isMultiple:!e.singleMode,onOnFileSelected:s[1]||(s[1]=_=>{const g=e.index,y=_;y.forEach((v,b)=>{e.isEditing?(y[b].serial=g+1,y[b].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[g].settings.download_limit,y[b].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[g].settings.download_expiry,y.length>1?(y[b].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file=y[b]):(y[b].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file.file_name=y[b].file_name,e.file.file_path=y[b].file_path,e.file.file_size=y[b].file_size,e.file.file_url=y[b].file_url,e.file.title=y[b].title,e.file.type=y[b].type,e.file.settings=y[b].settings)):(y[b].serial=g+1,y[b].settings.download_limit=e.productDownloadableModel.insertableFiles[g].settings.download_limit,y[b].settings.download_expiry=e.productDownloadableModel.insertableFiles[g].settings.download_expiry,y.length>1?(y[b].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g+b]=y[b]):(y[b].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g]=y[b]))})})},null,8,["isMultiple"]),n(ra,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.file_url`},null,8,["validation-errors","field-key"])]),_:1})):B("",!0),e.file.title?(r(),E(p,{key:1,label:l.$t("File Title")},{default:d(()=>[o("p",null,m(e.file.title),1),B("",!0),n(ra,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.title`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])):B("",!0),e.file.driver?(r(),E(p,{key:2},{default:d(()=>[o("p",null,m(A(u)("Driver: %s",e.file.driver)),1)]),_:1})):B("",!0)])}}},CG={key:0,class:"text-right"},kG={key:1,class:"px-6 py-3"},BG={class:"fct-product-download-inner-wrap flex flex-col gap-4"},xG={class:"fct-product-download-form-box"},SG={key:1},FG={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=N(()=>window.innerWidth<=768?"90%":"34%");return(a,l)=>{const s=C("el-button"),i=C("el-drawer");return r(),h(H,null,[o("div",{class:de(["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",CG,[n(s,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(a.$t("Add")),1)]),_:1})])):(r(),h("div",kG,m(a.$t("No pricing added yet")),1))],2),n(i,{modelValue:e.productDownloadableModel.data.addModal.isModalOpen,"onUpdate:modelValue":l[4]||(l[4]=c=>e.productDownloadableModel.data.addModal.isModalOpen=c),size:t.value,onClose:l[5]||(l[5]=()=>{e.productDownloadableModel.clearInsertableFile()}),onOpen:l[6]||(l[6]=()=>{e.productDownloadableModel.addDummyInsertableFile()})},{header:d(()=>[n(fa,{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:d(()=>[o("div",null,[n(s,{onClick:l[2]||(l[2]=c=>e.productDownloadableModel.data.addModal.isModalOpen=!1)},{default:d(()=>[R(m(a.$t("Cancel")),1)]),_:1}),n(s,{type:"primary",onClick:l[3]||(l[3]=()=>{e.productDownloadableModel.attachInsertableFiles(e.product.ID)}),loading:e.productDownloadableModel.data.saving},{default:d(()=>[R(m(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:d(()=>[o("div",BG,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(H,{key:0},ae(e.productDownloadableModel.insertableFiles,(c,p)=>(r(),h("div",xG,[e.productDownloadableModel.insertableFiles.length>1?(r(),E(s,{key:0,onClick:f=>e.productDownloadableModel.deleteInsertableFile(p),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])):B("",!0),n(Zp,{product:e.product,file:c,index:p,productDownloadableModel:e.productDownloadableModel},null,8,["product","file","index","productDownloadableModel"])]))),256)):B("",!0),e.productDownloadableModel.insertableFiles.length>1?(r(),h("div",SG,[n(lA,{uploadBtnText:A(u)("Add More Files"),onOnFileSelected:l[1]||(l[1]=c=>{const p=e.productDownloadableModel.insertableFiles.length-1,f=c;f.value.forEach((_,g)=>{f.value[g].serial=p+1,f.value[g].settings.download_limit=e.productDownloadableModel.insertableFiles[p].settings.download_limit,f.value[g].settings.download_expiry=e.productDownloadableModel.insertableFiles[p].settings.download_expiry,f.value[g].product_variation_id=e.productDownloadableModel.insertableFiles[p].product_variation_id,e.productDownloadableModel.insertableFiles.push(f.value[g])})})},null,8,["uploadBtnText"])])):B("",!0),(r(!0),h(H,null,ae(e.product.variants,(c,p)=>(r(),h("div",{key:p},[n(ra,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${p}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},$G={class:"fct-product-download-form-wrap"},EG={class:"fct-product-download-form-box"},UG={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=N(()=>window.innerWidth<=768?"90%":"40%"),l=M({...t.productDownloadable}),s=t.productDownloadableModel.data.editModal.states;return Is(()=>{s[t.index]={},s[t.index].visible=!1}),(i,c)=>{const p=C("el-button"),f=C("el-drawer");return r(),h(H,null,[n(f,{"append-to-body":"",modelValue:A(s)[e.index].visible,"onUpdate:modelValue":c[1]||(c[1]=_=>A(s)[e.index].visible=_),size:a.value,title:A(u)("Edit Downloadable Asset"),onClose:c[2]||(c[2]=()=>{e.productDownloadableModel.closeEditModal(e.index)})},{footer:d(()=>[n(p,{type:"primary",loading:e.productDownloadableModel.saving,onClick:c[0]||(c[0]=()=>{e.productDownloadableModel.updateDownloadableFile()})},{default:d(()=>[R(m(A(u)("Update")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",$G,[o("div",EG,[n(Zp,{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:c[3]||(c[3]=Ne(()=>{A(s)[e.index].visible=!0,e.productDownloadableModel.openEditModal(e.index,l.value)},["prevent"]))},[n(J,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)])],64)}}},IG={class:"fct-product-download-wrap"},QG={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},DG={class:"fct-media-content-list"},VG={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},TG={class:"product-details"},MG={class:"product-details-content-row"},LG={class:"product-details-content-first"},RG={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},OG={key:0,class:"font-normal text-system-mid"},HG={class:"product-variation-title inline-flex"},PG={key:1,class:"product-variation-title"},NG={class:"product-details-content-second"},KG={class:"more-btn"},GG={__name:"ProductDownload",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=e,a=function(s){ue.get(`products/getDownloadableUrl/${s.id}`).then(i=>{Zl.copy(i.url)}).catch(i=>{z.error({title:u("Error"),message:u("Failed to copy file URL")})})},l=s=>{s.action==="copy-download-link"?a(s.data):s.action==="delete"&&t.productDownloadableModel.deleteDownloadableFile(s.data.id,s.idx)};return(s,i)=>{const c=C("el-switch"),p=C("el-popover"),f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",IG,[n(Be,null,{default:d(()=>{var y;return[n(Qe,{class:"pb-5"},{action:d(()=>[e.product.detail?(r(),E(c,{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":s.$t("Downloadable Asset(s)"),onChange:i[1]||(i[1]=v=>{(v.toString()==="0"||e.productDownloadableModel.hasDownloadableFiles())&&e.productEditModel.setHasChange(!0)})},null,8,["modelValue","active-text"])):B("",!0)]),_:1}),n(va,{visible:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:d(()=>[n(Ce,{class:"p-0"},{default:d(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),h("div",QG,[o("div",DG,[(r(!0),h(H,null,ae(e.productDownloadableModel.downloadableFiles,(v,b)=>(r(),h("div",{class:"fct-media-content-list-item",key:b},[o("div",VG,m(v.type),1),o("div",TG,[o("div",MG,[o("div",LG,[o("div",RG,[R(m(v.title)+" ",1),v.driver!=="local"?(r(),h("span",OG," - "+m(v.driver),1)):B("",!0)]),e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product).length?(r(),E(p,{key:0,placement:"top",trigger:"hover",width:200},{reference:d(()=>[o("div",HG," – "+m(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:d(()=>[(r(!0),h(H,null,ae(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(k,w)=>(r(),h("div",{style:{"margin-top":"4px"},key:w},m(k),1))),128))]),_:2},1024)):(r(),h("div",PG," – "+m(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",NG,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:l},{dropdown:d(()=>[n(_,null,{default:d(()=>[n(f,{class:"item-link"},{default:d(()=>[n(UG,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:b},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),n(f,{command:{action:"copy-download-link",data:v}},{default:d(()=>[n(J,{name:"Copy"}),R(" "+m(A(u)("Copy Download Link")),1)]),_:2},1032,["command"]),n(f,{command:{action:"delete",data:v,idx:b},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",KG,[n(J,{name:"More"})])]),_:2},1024)])])])]))),128))])])):B("",!0),n(FG,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},jG={class:"fct-product-status-wrap"},zG={class:"fct-admin-summary-item-list"},qG={class:"fct-admin-summary-item"},YG={class:"fct-admin-summary-item-title"},WG={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},JG={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},XG={key:0,style:{"margin-top":"20px"}},ZG={class:"title"},ej={key:1},tj={class:"text-sm text-gray-500 mt-4"},aj={class:"capitalize"},lj={key:1},sj={class:"fct-admin-summary-item"},nj={class:"fct-admin-summary-item-title flex items-center gap-1"},oj=["href"],ij={class:"fct-product-url-slug-container"},rj={class:"filter-popover-item fct-admin-summary-popover-item"},dj={class:"filter-popover-title"},uj={class:"filter-popover-input-group"},cj={class:"fct-product-url-label"},Aj=["href"],pj={class:"fct-product-url-slug"},fj={key:0,class:"fct-admin-summary-item"},mj={class:"fct-admin-summary-item-title"},hj={class:"fct-admin-summary-item-select"},_j={key:1,class:"fct-admin-summary-item"},vj={class:"fct-admin-summary-item-title"},gj={key:0,class:"fct-admin-summary-item-select"},yj={key:0,class:"mt-4 pt-4"},nc={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M(""),l=M(""),s=M(""),i=M(!1),c=v=>Ln(v,Go(t.product))||v.variation_title;be(()=>{var v,b,k;return[(b=(v=t.product)==null?void 0:v.detail)==null?void 0:b.default_variation_id,(k=t.product)==null?void 0:k.variants]},([v,b])=>{var S;if(!v||!((S=t.product)!=null&&S.detail))return;(Array.isArray(b)?b:[]).some($=>String($.id)===String(v))||(t.product.detail.default_variation_id="",t.productEditModel&&typeof t.productEditModel.onChangeInputField=="function"&&t.productEditModel.onChangeInputField("default_variation_id",""))},{immediate:!0,deep:!1});const p=u("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">'+u("URL")+"</a>"),f=()=>t.product.variants.filter(b=>b.created_at).length>0,_=v=>{t.productEditModel.onChangeInputField("post_status",v),(v==="draft"||v==="publish")&&(i.value=!1)},g=()=>u("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."),y={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no"};return be(()=>t.product.detail,v=>{v&&(!v.other_info||Object.keys(v.other_info).length===0)&&(t.product.detail.other_info={...y})},{immediate:!0}),Ie(()=>{a.value=window.location.protocol,l.value=window.location.hostname,s.value=`${a.value}//${l.value}`}),(v,b)=>{const k=C("el-radio"),w=C("el-radio-group"),S=C("el-date-picker"),$=C("el-button"),V=C("el-popover"),F=C("el-input"),x=C("el-option"),Q=C("el-select"),D=C("el-checkbox");return r(),h("div",jG,[n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>{var T,U;return[o("ul",zG,[o("li",qG,[o("span",YG,[n(fa,{title:A(u)("Status"),content:g()},null,8,["title","content"])]),o("div",WG,[f()?(r(),E(V,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:d(()=>[f()?(r(),E($,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",aj,m(e.product.post_status==="future"?A(u)("Scheduled"):e.product.post_status),1),n(J,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",lj,m(A(ca).headline(e.product.post_status)),1))]),default:d(()=>[o("div",JG,[n(w,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":b[0]||(b[0]=I=>e.product.post_status=I),onChange:_},{default:d(()=>[n(k,{value:"draft"},{default:d(()=>[R(m(A(u)("Draft")),1)]),_:1}),n(k,{value:"future"},{default:d(()=>[R(m(A(u)("Scheduled")),1)]),_:1}),n(k,{value:"private"},{default:d(()=>[R(m(A(u)("Private (Invisible except Admin)")),1)]),_:1}),n(k,{value:"publish"},{default:d(()=>[R(m(A(u)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",XG,[o("h3",ZG,m(A(u)("Scheduled Date")),1),n(S,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":b[1]||(b[1]=I=>e.product.post_date=I),type:"datetime",placeholder:A(u)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:b[2]||(b[2]=I=>{e.productEditModel.onChangeInputField("post_date",I)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",ej,[o("p",tj,m(A(u)("Note: Private products are only visible to administrators but can be purchased via direct purchase link.")),1)])):B("",!0)])]),_:1})):B("",!0)])]),o("li",sj,[o("span",nj,[R(m(A(u)("URL Slug"))+" ",1),o("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[n(J,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,oj)]),o("div",ij,[n(V,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:d(()=>[n($,{type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",null,m(e.product.post_name),1),n(J,{name:"ChevronUpDown"})]),_:1})]),default:d(()=>[o("div",rj,[o("h3",dj,m(A(u)("URL")),1),o("div",uj,[n(fa,{title:A(u)("Permalink"),content:A(p),hideAfter:300},null,8,["title","content"]),n(F,{placeholder:A(u)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":b[3]||(b[3]=I=>e.product.post_name=I),onInput:b[4]||(b[4]=I=>{e.productEditModel.onChangeInputField("post_name",I)})},null,8,["placeholder","modelValue"])]),o("div",cj,m(A(u)("View Product")),1),o("a",{class:"fct-product-url-slug-wrap",target:"_blank",href:e.product.view_url,rel:"external noreferrer noopener"},[o("span",pj,m(e.product.view_url),1),n(Ia,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:A(u)("Copy Link")},null,8,["text","tooltipText"])],8,Aj)])]),_:1})])]),((T=e.product.detail)==null?void 0:T.variation_type)==="simple_variations"||((U=e.product.detail)==null?void 0:U.variation_type)==="advanced_variations"?(r(),h("li",fj,[o("span",mj,[n(fa,{title:A(u)("Default Variant"),content:A(u)("Select the default variant that users will see pre-selected on the product page.")},null,8,["title","content"])]),o("div",hj,[n(Q,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":b[5]||(b[5]=I=>e.product.detail.default_variation_id=I),placeholder:A(u)("Select Default Variant"),onChange:b[6]||(b[6]=I=>{e.productEditModel.onChangeInputField("default_variation_id",I)}),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,I=>(r(),E(x,{key:I.id,label:c(I),value:I.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):B("",!0),e.product.detail&&e.product.detail.variation_type==="simple_variations"?(r(),h("li",_j,[o("span",vj,[n(fa,{title:A(u)("Pricing Table Layout"),content:A(u)("Organize product variations by repeat interval (Monthly, Yearly) or payment term (One time, Subscription).")},null,8,["title","content"])]),e.product.detail?(r(),h("div",gj,[n(Q,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":b[7]||(b[7]=I=>e.product.detail.other_info.group_pricing_by=I),placeholder:A(u)("Pricing Table Layout"),onChange:b[8]||(b[8]=I=>{e.productEditModel.onChangeInputField("group_pricing_by",I)})},{default:d(()=>[n(x,{label:A(u)("Payment Term"),value:"payment_type"},null,8,["label"]),n(x,{label:A(u)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),n(x,{label:A(u)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):B("",!0)])):B("",!0)]),e.product.detail?(r(),h("div",yj,[n(D,{onChange:b[9]||(b[9]=I=>{e.productEditModel.onChangeInputField("sold_individually",I)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":b[10]||(b[10]=I=>e.product.detail.other_info.sold_individually=I),"true-value":"yes","false-value":"no"},{default:d(()=>[R(m(A(u)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"])])):B("",!0)]}),_:1})]),_:1})])}}},bj={class:"fct-product-media-wrap"},wj={class:"fct-admin-summary-item"},oc={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",bj,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",wj,[n(hl,{modelValue:e.product.gallery,"onUpdate:modelValue":a[0]||(a[0]=l=>e.product.gallery=l),compact:!1,title:t.$t("Product Gallery"),onChange:a[1]||(a[1]=l=>e.productEditModel.updateMedia("gallery",l))},null,8,["modelValue","title"])])]),_:1})]),_:1})]))}},Cj={class:"fct-term-input-item"},kj={class:"el-tag__content"},Bj=["innerHTML"],xj=["innerHTML"],Sj={class:"pt-1.5 text-right"},Fj={class:"relative w-3 h-3"},$j={class:"fct-term-add-input-wrap"},Ej={__name:"TermInput",props:{modelValue:Array,taxonomy:Object,product_id:Number},emits:["update:modelValue","onChanged"],setup(e,{emit:t}){Yt().ctx;const a=e,l=t,s=M([]),i=M(!1),c=M(),p=M(""),f=M([]),_=M(""),g=M(!1);Ie(()=>{s.value=a.modelValue,f.value=a.taxonomy.terms,be(()=>a.taxonomy.terms,(Q,D)=>{f.value=Q}),be(()=>a.modelValue,(Q,D)=>{g.value=!0,s.value=Q})});const y=Q=>{Q.stopPropagation(),Q.preventDefault(),S()},v=()=>{g.value&&ue.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(Q=>{z.success(Q.message),l("update:modelValue",s.value)}).catch(Q=>{var D;Q.status_code=="422"?z.validationErrors(Q):z.error((D=Q.data)==null?void 0:D.message)}).finally(()=>{g.value=!1})},b=id.debounce(Q=>{w(Q)},1200),k=()=>{l("update:modelValue",s.value)},w=Q=>{g.value=!1,ue.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:Q}).then(D=>{tn(D.message),l("update:modelValue",s.value)}).catch(D=>{var T;D.status_code=="422"?z.validationErrors(D):z.error((T=D.data)==null?void 0:T.message)}).finally(()=>{g.value=!1})};[...s.value];const S=()=>{g.value=!0,ue.post("products/add-product-terms",{term:{name:p.value,taxonomy:a.taxonomy.name,parent:_.value}}).then(Q=>{i.value=!1,p.value="",Q.term_ids.forEach(function(D,T){f.value.push({value:D,label:Q.names[T]}),s.value.push(D)}),v()}).catch(Q=>{})},$=()=>{i.value=!i.value,i.value&&ke(()=>{c.value.focus()})},V={categories:"Category",types:"Type"};N(()=>{let Q=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(V).forEach(D=>{Q.toLowerCase().includes(D)&&(Q=Q.replace(new RegExp(D,"i"),V[D]))}),Q});const F=Q=>{const D=s.value.indexOf(Q);D>-1&&s.value.splice(D,1),g.value=!1,b(Q)},x=Q=>{const D=T=>{for(const U of T){if(U.value==Q)return U.label;if(U.children&&U.children.length>0){const I=D(U.children);if(I)return I}}return null};return D(f.value)};return(Q,D)=>{const T=C("el-tag"),U=C("el-tree-select"),I=C("el-button"),O=C("el-input");return r(),h("div",Cj,[n(U,{modelValue:s.value,"onUpdate:modelValue":D[0]||(D[0]=L=>s.value=L),data:f.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:k,onRemoveTag:D[2]||(D[2]=L=>{g.value=!1,A(b)(L)})},{tag:d(()=>[(r(!0),h(H,null,ae(s.value,(L,P)=>(r(),E(T,{key:P,closable:"",onClose:q=>F(L)},{default:d(()=>[o("span",kj,[o("span",{class:"el-select__tags-text",innerHTML:x(L)},null,8,Bj)])]),_:2},1032,["onClose"]))),128))]),default:d(({data:L})=>[o("span",{innerHTML:L.label},null,8,xj)]),_:1},8,["modelValue","data"]),o("div",Sj,[n(I,{text:"",onClick:$,size:"small"},{default:d(()=>[o("span",Fj,[n(va,{visible:i.value,fade:""},{default:d(()=>[n(J,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),n(va,{visible:!i.value,fade:""},{default:d(()=>[n(J,{name:"Plus",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"])]),R(" "+m(A(u)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),n(va,{visible:i.value,accordion:""},{default:d(()=>[o("div",$j,[n(O,{modelValue:p.value,"onUpdate:modelValue":D[3]||(D[3]=L=>p.value=L),ref_key:"inputRef",ref:c,onKeydown:xa(y,["enter"])},null,8,["modelValue"]),n(I,{type:"info",plain:"",onClick:S,class:"el-button--x-small"},{default:d(()=>[R(m(A(u)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},Uj={class:"fct-product-simple-wrap"},Ij={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",Uj,[n(Be,null,{default:d(()=>[n(Qe,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[(r(!0),h(H,null,ae(e.product.taxonomies,l=>(r(),h("div",{class:"fct-admin-summary-item",key:l.id},[o("h4",null,m(l.labels.name),1),n(Ej,{product_id:e.product.ID,taxonomy:l,modelValue:e.product.product_terms[l.name],"onUpdate:modelValue":s=>e.product.product_terms[l.name]=s},null,8,["product_id","taxonomy","modelValue","onUpdate:modelValue"])]))),128))]),_:1})]),_:1})]))}};class Qj extends Za{constructor(){super(...arguments);Re(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});Re(this,"generateDownloadableVariationName",(a,l)=>{if(!a)return u("For all variants");let s=[];if(typeof a=="string")try{s=JSON.parse(a)}catch{}else typeof a=="object"&&(s=Object.values(a));if(s.length===0)return u("For all variants");const i=Go(l),c=l.variants.reduce((f,_)=>(f[_.id]=Ln(_,i),f),{}),p=s.map(f=>c[f]).filter(Boolean);return p.length===0?"--":p.length===1?p[0]:`${p[0]} +${p.length-1}`});Re(this,"deleteDownloadableFile",(a,l)=>{Dn.ofDelete(u("Deleting this asset will break the download link in existing purchase emails. To update the file, edit the asset instead of deleting it.")).then(()=>{ue.delete(`products/${a}/delete`).then(()=>{z.success(u("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(l,1)}).catch(s=>{z.error(u("Failed To Delete"))})}).catch(()=>{})});Re(this,"addDummyDownloadableFileForAllVariant",a=>{this.data.addModal.files=this.data.addModal.files.filter(l=>Object.values(l).every(s=>s!=null&&s!=="")),Object.values(this.generateVariantOptions(a)).forEach(l=>{l.id>0&&this.addDummyInsertableFile(l.id)})});Re(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});Re(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});Re(this,"attachInsertableFiles",a=>{this.setSaving(!0),ue.post(`products/${a}/sync-downloadable-files`,{downloadable_files:this.insertableFiles}).then(l=>{this.setDownloadableFiles(l.downloadable_files),this.syncToSourceProduct(),this.closeAddModal(),z.success(u("Variations Synced Successfully"))}).catch(l=>{this.setSaving(!1),l.status_code=="422"?this.setValidationError(l.data):z.error(u("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});Re(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});Re(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});Re(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});Re(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()});Re(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);Re(this,"setValidationError",a=>{this.data.validationErrors=a});Re(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));Re(this,"clearValidationError",()=>{this.data.validationErrors={}});Re(this,"deleteValidationError",a=>{this.data.validationErrors.hasOwnProperty(a)&&delete this.data.validationErrors[a]})}setDownloadableFiles(a,l=null){a=a.map(s=>{if(typeof s.settings=="string")try{s.settings=JSON.parse(s.settings)}catch{}return s}),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 s=[];if(typeof a=="string")try{s=JSON.parse(a)}catch{return[]}else typeof a=="object"&&(s=Object.values(a));const i=Go(l),c=l.variants.reduce((f,_)=>(f[_.id]=Ln(_,i),f),{});return s.map(f=>c[f]).filter(Boolean).slice(1)}generateVariantOptions(a){return[...a.variants.filter(s=>s.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),ue.put("products/"+a.id+"/update",a).then(s=>{this.closeEditModal(l),z.success(s.message),this.downloadableFiles[l]={...a},this.syncToSourceProduct()}).catch(s=>{s.hasOwnProperty("message")?z.error(s.message):z.error(u("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function Dj(){return Qj.init()}const Vj={class:"fct-product-simple-wrap"},Tj={class:"flex items-center gap-1 justify-between w-full"},Mj={class:"fct-shipping-class-select-wrap relative"},Lj={class:"fct-select-option-with-leftright-value"},Rj={class:"text-sm text-gray-500"},Oj={class:"pt-1.5 text-right"},Hj={key:0},Pj={class:"mb-0 mt-2"},Nj={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M(it.get(t,"product.detail.other_info.shipping_class")),l=M(),s=M(!1),i=M(!1),c=M([]),p=Ge.get("admin_url")+"settings/shipping/shipping_classes",f=(k="")=>{i.value=!0,c.value=[],ue.get("shipping/classes",{search:k}).then(w=>{c.value=w.shipping_classes.data,g()}).finally(()=>{i.value=!1})},_=k=>{f(),k.id&&(a.value=k.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const k=it.where(c.value,"id",a.value);l.value=it.get(k,"0")},y=()=>{s.value=!0},v=()=>{a.value&&ue.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(k=>{z.success(k.message)}).catch(k=>{var w;k.status_code=="422"?z.validationErrors(k):z.error((w=k.data)==null?void 0:w.message)})},b=()=>{ue.post("products/"+t.product.ID+"/shipping-class/remove").then(k=>{z.success(k.message)}).catch(k=>{var w;k.status_code=="422"?z.validationErrors(k):z.error((w=k.data)==null?void 0:w.message)})};return Ie(()=>{f()}),(k,w)=>{const S=C("el-option"),$=C("el-select"),V=C("el-button");return r(),h("div",Vj,[n(Be,null,{default:d(()=>[n(Qe,{border_bottom:""},{default:d(()=>[o("div",Tj,[n(fa,{title:A(u)("Shipping Class"),content:A(u)("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"},[n(J,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),n(Ce,null,{default:d(()=>[o("div",Mj,[n($,{modelValue:a.value,"onUpdate:modelValue":w[0]||(w[0]=F=>a.value=F),remote:"",placeholder:A(u)("Search Shipping Class"),"remote-method":f,loading:i.value,filterable:"",clearable:"",onChange:v,onClear:b,"popper-class":"fct-shipping-class-select"},{default:d(()=>[(r(!0),h(H,null,ae(c.value,F=>(r(),E(S,{key:F.id,label:F.name,value:F.id},{default:d(()=>[o("div",Lj,[R(m(F.name)+" ",1),o("span",Rj,m(F.type==="percentage"?F.cost+"%":A(pt).formatNumber(F.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",Oj,[n(V,{onClick:Ne(y,["stop"]),size:"small",text:""},{default:d(()=>[n(J,{name:"Plus",class:"w-3 h-3"}),R(" "+m(A(u)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),h("div",Hj,[o("p",Pj,m(A(u)("Cost: %s",l.value.type==="percentage"?l.value.cost+"%":A(pt).formatNumber(l.value.cost*100,!0))),1)])):B("",!0)]),_:1})]),_:1}),n(Am,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=F=>s.value=F),onSaved:_},null,8,["modelValue"])])}}},Kj={key:0,class:"fct-product-inventory-wrap"},Gj={class:"fct-product-inventory-inner-wrap hide-on-mobile"},jj={class:"space-x-5"},zj={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"},qj={key:1},Yj={class:"fct-card-header-title"},Wj={class:"fct-product-inventory-pro-text"},Jj={class:"m-0"},Xj={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=Ge.get("app_config.isProActive"),s=M([]);Ie(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){p()}),p()});const i=(f,_)=>{ue.post(`products/save-bundle-info/${f}`,{bundle_child_ids:_}).then(g=>{z.success(u("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?z.validationErrors(g):z.error(g==null?void 0:g.message)})},c=M(!0),p=()=>{c.value=!0,ue.get(`products/get-bundle-info/${a.product.ID}`).then(f=>{s.value=f,c.value=!1})};return(f,_)=>{const g=C("el-table-column"),y=C("el-table");return A(l)?(r(),h("div",Kj,[n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Map bundle items")},null,8,["title"]),n(va,{visible:!0,accordion:""},{default:d(()=>[n(Ce,{class:"px-0 pb-0"},{default:d(()=>[o("div",Gj,[c.value?B("",!0):(r(),E(y,{key:0,data:s.value},{default:d(()=>[e.product.detail.variation_type!=="simple"?(r(),E(g,{key:0,label:A(u)("Title"),width:"140"},{default:d(v=>{var b;return[o("div",jj,[o("span",null,m(v.row.variation_title),1),((b=v.row.other_info)==null?void 0:b.payment_type)==="subscription"?(r(),h("span",zj,m(v.row.other_info.repeat_interval),1)):B("",!0)])]}),_:1},8,["label"])):B("",!0),n(g,{label:A(u)("Bundle Items"),width:"140"},{default:d(v=>[n(aA,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":b=>v.row.bundle_child_ids=b,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:b=>{b||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",qj,[n(Be,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h2",Yj,[R(m(A(u)("Map bundle items"))+" ",1),n(J,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),n(Ce,null,{default:d(()=>[o("div",Wj,[o("p",Jj,m(A(u)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},Zj={class:"fct-edit-product-wrapper fct-layout-width"},ez={class:"fct-btn-group sm"},tz={class:"hide-on-mobile"},az={class:"show-on-mobile"},lz=["href"],sz={key:1,class:"single-page-body"},nz=["innerHTML"],oz={class:"fct-product-edit"},iz={class:"fct-product-main"},rz={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},dz={class:"fct-product-aside"},uz={class:"el-form el-form--default el-form--label-top"},cz={key:1},Az={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=M(),l=OM();let s=null;const i=Dj();l.setProductDownloadableModel(i);const c=M(!1),p=b=>{var k,w;c.value=!1,l.setProduct(b),s=l.data.product,i.setDownloadableFiles(b.downloadable_files,b),s.gallery=((w=(k=s==null?void 0:s.detail)==null?void 0:k.gallery_image)==null?void 0:w.meta_value)??[],s.taxonomies=t.taxonomies,s.product_terms={},Object.keys(s.taxonomies).map(S=>{s.product_terms[S]=s[S]??[]}),l.saveSnapshot(),c.value=!0};HM().onSave(()=>{var b;l.data.metaValue=(b=a.value)==null?void 0:b.getFormStates(),l.update()});const _=_s();_.bind(["mod+s"],b=>{var k;b.preventDefault(),l.data.hasChange&&(i.isAddModalOpen()?i.attachInsertableFiles(t.product.ID):i.isEditModalOpen()?i.updateDownloadableFile():(l.data.metaValue=(k=a.value)==null?void 0:k.getFormStates(),l.update()))});const g=()=>{l.setHasChange(!0)},y=b=>{b==="delete"&&l.delete()};si("triggerChange",g);const v=ai("reload");return be(()=>t.product,(b,k)=>{b!==k&&p(b)}),Ie(()=>{p(t.product),l.setReloader(v);const b=document.querySelector(".fct-admin-product-header");b&&document.querySelector("#fluent_cart_plugin_app").prepend(b),l.addOnProductUpdatedListener("formreset",function(){var k;(k=a.value)==null||k.resetForms()})}),Dc(()=>{_.unbind("mod+s")}),(b,k)=>{const w=C("el-button"),S=C("el-dropdown-item"),$=C("el-dropdown-menu"),V=C("el-dropdown");return r(),h("div",Zj,[(r(),E(li,{to:"#fct-admin-product-header-buttons"},[o("div",ez,[n(V,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:d(()=>[n($,null,{default:d(()=>[n(S,{command:"preview",class:"item-link"},{default:d(()=>[o("a",{href:A(l).viewUrl(),target:"_blank"},[n(J,{name:"Eye"}),R(" "+m(A(u)("Preview")),1)],8,lz)]),_:1}),n(S,{command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:1})]),_:1})]),default:d(()=>[n(w,null,{default:d(()=>[o("span",tz,[R(m(A(u)("More Actions"))+" ",1),n(J,{name:"ChevronDown"})]),o("span",az,[n(J,{name:"More"})])]),_:1})]),_:1})])])),c.value?(r(),E(rn,{key:0,isActive:A(l).data.hasChange?"is-active":"",loading:A(l).data.saving,onDiscard:A(l).discard,onSave:k[0]||(k[0]=()=>{var F;A(l).data.metaValue=(F=a.value)==null?void 0:F.getFormStates(),A(l).update()}),saveButtonText:A(u)("Update"),"show-cmnd-icon":!0},null,8,["isActive","loading","onDiscard","saveButtonText"])):B("",!0),c.value?(r(),h("div",sz,[A(l).shouldShowShippingMethodAlert()?(r(),E(Xa,{key:0,class:"mb-3",type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",{innerHTML:A(u)("This Product has physical variants. Please %s",'<a href="'+A(l).shippingSettingsUrl()+'" target="_blank">'+A(u)("Add Shipping")+"</a>")},null,8,nz)]),_:1})):B("",!0),A(l).isInDraft()?(r(),E(Xa,{key:1,class:"mb-3",type:"warning",icon:"InformationFill",content:A(u)("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"])):B("",!0),o("div",oz,[o("div",iz,[n(r7,{product:A(s),productEditModel:A(l),reload:A(v)},null,8,["product","productEditModel","reload"]),o("div",rz,[(r(),E(nc,{key:A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(oc,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])]),n(iG,{product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]),n(bG,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).isBundleProduct()?(r(),E(Xj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):B("",!0),A(l).isBundleProduct()?B("",!0):(r(),E(GG,{key:1,product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",dz,[o("div",uz,[(r(),E(nc,{class:"fct-hide-on-tablet",key:"aside-"+A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(oc,{class:"fct-hide-on-tablet",product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),n(Ij,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).hasPhysicalVariation()?(r(),E(Nj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):B("",!0),A(s)?(r(),h("div",cz,[n(cn,{ref_key:"dynamicTemplates",ref:a,filter:"single_product_page","widgets-query":{product_id:A(s).ID},data:{editableProduct:A(s)}},null,8,["widgets-query","data"])])):B("",!0)])])])])):B("",!0)])}}},pz={class:"fct-upgrade-path-drawer-content"},fz={class:"fct-form-group"},mz={class:"fct-form-group"},hz={class:"fct-form-group"},_z={class:"fct-form-group"},vz={__name:"AddModal",props:{pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,productId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=M(!1),c=()=>{i.value=!0},p={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},f=M({...p}),_=M({}),g=Ge.get("shop.currency_sign"),y=()=>{_.value={};const k={...f.value};(!Array.isArray(k.to_variants)||k.to_variants.length===0)&&(k.to_variants=[]),ue.post(`products/${l.productId}/upgrade-path`,{...k}).then(w=>{z.success(w.message),f.value={...p},i.value=!1,s("pathGenerated")}).catch(w=>{if(_.value=w,w.message)return z.error(w.message)})},v=()=>f.value.from_variant?l.allVariants.filter(k=>{var w,S;return!((w=l.existingUpgradePathMap[f.value.from_variant])!=null&&w.includes(k.id)||(S=l.existingUpgradePathMap[f.value.from_variant])!=null&&S.includes(k.id.toString()))&&k.id!==f.value.from_variant}):[],b=k=>{let w=k==null?void 0:k.toString().replace(/^0+(?=\d)/,"");w===""&&(w="0"),parseInt(w)<0&&(w="0"),f.value.discount_amount=w};return t({openModal:c}),(k,w)=>{const S=C("el-option"),$=C("el-select"),V=C("el-checkbox"),F=C("el-input"),x=C("el-button"),Q=C("el-drawer");return r(),E(Q,{title:A(u)("Add Upgrade Path"),modelValue:i.value,"onUpdate:modelValue":w[5]||(w[5]=D=>i.value=D),onClosed:w[6]||(w[6]=()=>{i.value=!1,f.value={...p}}),"append-to-body":"",class:de(A(De).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:d(()=>[n(x,{onClick:w[4]||(w[4]=D=>i.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(x,{onClick:y,type:"primary"},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1})]),default:d(()=>[o("div",pz,[o("div",fz,[o("label",null,m(A(u)("From Plan")),1),n($,{modelValue:f.value.from_variant,"onUpdate:modelValue":w[0]||(w[0]=D=>f.value.from_variant=D),placeholder:A(u)("Select"),"popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,ae(e.pathOptions,D=>(r(),E(S,{key:D.id,label:D.variation_title,value:D.id,disabled:f.value.to_variants.includes(D.id)},{default:d(()=>[n(jo,{variant:D},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),_.value.hasOwnProperty("from_variant")?(r(),E(ra,{key:0,"validation-errors":_.value,"field-key":"from_variant"},null,8,["validation-errors"])):B("",!0)]),o("div",mz,[o("label",null,m(A(u)("To Plan(s)")),1),n($,{disabled:!f.value.from_variant,modelValue:f.value.to_variants,"onUpdate:modelValue":w[1]||(w[1]=D=>f.value.to_variants=D),multiple:"",placeholder:A(u)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,ae(v(),D=>(r(),E(S,{key:D.id,label:D.variation_title,value:D.id,disabled:D.id==f.value.from_variant},{default:d(()=>[n(jo,{variant:D},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),_.value.hasOwnProperty("to_variants")?(r(),E(ra,{key:0,"validation-errors":_.value,"field-key":"to_variants"},null,8,["validation-errors"])):B("",!0)]),o("div",hz,[n(V,{"true-value":"1","false-value":"0",modelValue:f.value.is_prorate,"onUpdate:modelValue":w[2]||(w[2]=D=>f.value.is_prorate=D)},{default:d(()=>[R(m(A(u)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",_z,[o("label",null,m(A(u)("Discount Amount")),1),n(F,{modelValue:f.value.discount_amount,"onUpdate:modelValue":w[3]||(w[3]=D=>f.value.discount_amount=D),type:"number",min:0,onInput:b},{prepend:d(()=>[R(m(A(g)),1)]),_:1},8,["modelValue"]),_.value.hasOwnProperty("discount_amount")?(r(),E(ra,{key:0,"validation-errors":_.value,"field-key":"discount_amount"},null,8,["validation-errors"])):B("",!0)])])]),_:1},8,["title","modelValue","class"])}}},gz={class:"fct-upgrade-path-drawer-content"},yz={class:"fct-form-group"},bz={class:"text"},wz={class:"fct-form-group"},Cz={class:"fct-form-group"},kz={class:"fct-form-group"},ic={__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}),s=t,i=M(!1),c={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},p=M({...c}),f=M({}),_=()=>{f.value={};const b={...p.value};(!Array.isArray(b.to_variants)||b.to_variants.length===0)&&(b.to_variants=[]),ue.post(`products/upgrade-path/${a.pathId}/update`,{...b}).then(k=>{z.success(k.message),p.value={...c},i.value=!1,s("pathGenerated")}).catch(k=>{if(f.value=k,k.message)return z.error(k.message)})},g=()=>p.value.from_variant?a.allVariants.filter(b=>{var k,w;return!((k=l[p.value.from_variant])!=null&&k.includes(b.id)||(w=l[p.value.from_variant])!=null&&w.includes(b.id.toString()))&&b.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 b of a.preSelectedToVariants)p.value.to_variants.push(parseInt(b))},v=b=>{let k=b==null?void 0:b.toString().replace(/^0+(?=\d)/,"");k===""&&(k="0"),parseInt(k)<0&&(k="0"),p.value.discount_amount=k};return Is(()=>{y()}),(b,k)=>{const w=C("el-option"),S=C("el-select"),$=C("el-checkbox"),V=C("el-input"),F=C("el-button"),x=C("el-drawer");return r(),h(H,null,[n(Ze,{size:"x-small",tag:"button",onClick:k[0]||(k[0]=()=>{i.value=!0})},{default:d(()=>[n(J,{name:"Edit"})]),_:1}),n(x,{modelValue:i.value,"onUpdate:modelValue":k[5]||(k[5]=Q=>i.value=Q),title:b.$t("Update Upgrade Path"),onClosed:k[6]||(k[6]=()=>{i.value=!1,p.value={...c}}),onOpen:y,"append-to-body":""},{footer:d(()=>[n(F,{onClick:k[4]||(k[4]=Q=>i.value=!1),size:"small"},{default:d(()=>[R(m(b.$t("Cancel")),1)]),_:1}),n(F,{onClick:_,size:"small",type:"primary"},{default:d(()=>[R(m(b.$t("Update")),1)]),_:1})]),default:d(()=>[o("div",gz,[o("div",yz,[o("label",null,m(b.$t("From Plan")),1),o("div",bz,m(e.fromName),1)]),o("div",wz,[o("label",null,m(b.$t("To Plan(s)")),1),n(S,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":k[1]||(k[1]=Q=>p.value.to_variants=Q),multiple:"",placeholder:b.$t("Select"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(g(),Q=>(r(),E(w,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:Q.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),f.value.hasOwnProperty("to_variants")?(r(),E(ra,{key:0,"validation-errors":f.value,"field-key":"to_variants"},null,8,["validation-errors"])):B("",!0)]),o("div",Cz,[n($,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":k[2]||(k[2]=Q=>p.value.is_prorate=Q)},{default:d(()=>[n(fa,{class:"flex items-center",title:b.$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",kz,[o("label",null,m(b.$t("Discount Amount")),1),n(V,{modelValue:p.value.discount_amount,"onUpdate:modelValue":k[3]||(k[3]=Q=>p.value.discount_amount=Q),type:"number",min:"0",onInput:v},null,8,["modelValue"]),f.value.hasOwnProperty("discount_amount")?(r(),E(ra,{key:0,"validation-errors":f.value,"field-key":"discount_amount"},null,8,["validation-errors"])):B("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},Bz={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-table-column"),c=C("el-table");return r(),E(c,{data:[1,2,3,4,5]},{default:d(()=>[n(i,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("To Plan"),width:200},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("Discount Amount"),width:110},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("Is Prorate"),width:100},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:100},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-3/5"})]),_:1})]),_:1})]),_:1})}}},xz={class:"fct-upgrade-paths-wrap fct-layout-width"},Sz={class:"grid gap-1"},Fz={class:"text-system-dark dark:text-gray-50"},$z={class:"text-xs text-system-mid dark:text-gray-300"},Ez={class:"flex gap-1 flex-wrap"},Uz={key:0},Iz={key:1},Qz={class:"fct-btn-group sm"},Dz={key:2,class:"fct-upgrade-paths-mobile"},Vz={class:"from-plan"},Tz={class:"title"},Mz={class:"plan-title"},Lz={key:0,class:"plan-billing-summary"},Rz={class:"to-plan"},Oz={class:"title"},Hz={class:"discount-amount"},Pz={class:"title"},Nz={key:0},Kz={key:1},Gz={class:"is-prorate"},jz={class:"title"},zz={class:"path-actions"},qz={class:"title"},Yz={class:"fct-btn-group sm mt-3"},Wz={key:0,class:"py-6 text-center"},Jz={key:1},Xz={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},Zz={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},eq={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=N(()=>it.get(t.product,"detail.other_info.is_bundle_product")==="yes"),l=M(!1),s=M(null);M([]),M({status:"yes",paths:{}});const i=Ge.get("app_config.isProActive"),c=M([]),p=N(()=>t.product.variants.filter(S=>{var V;return(((V=b.value[S.id])==null?void 0:V.length)||0)<v.value-1})),f=S=>{_()},_=async()=>{l.value=!0,ue.get(`products/${t.product_id}/upgrade-paths`).then(function(S){c.value=S.data,k()}).catch(function(S){}).finally(()=>{l.value=!1})},g=M({}),y=M({}),v=M(it.get(t.product,"variants",[]).length),b=M({}),k=()=>{t.product.variants.entries().forEach(([S,$])=>{g.value[$.id]=$.variation_title,y.value[$.id]=$.other_info.billing_summary}),b.value={},c.value.forEach(S=>{b.value.hasOwnProperty(S.object_id)?(b.value[S.object_id]=[...b.value[S.object_id].concat([...S.meta_value.to_variants])],b.value[S.object_id]=[...new Set(b.value[S.object_id])]):b.value[S.object_id]=[...S.meta_value.to_variants]})},w=S=>{ue.delete(`products/upgrade-path/${S}/delete`).then(function($){_(),z.success($.message)}).catch(function($){})};return Ie(()=>{_();const S=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");S&&document.querySelector("#fluent_cart_plugin_app").prepend(S)}),(S,$)=>{const V=C("el-table-column"),F=C("el-tag"),x=C("el-table"),Q=C("el-button");return r(),h(H,null,[o("div",xz,[n(A(Be),null,{default:d(()=>[n(A(Qe),{title:A(u)("Upgrade Paths")},null,8,["title"]),A(i)&&!a.value?(r(),h(H,{key:0},[n(A(Ce),{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),E(Bz,{key:0})):B("",!0),l.value?B("",!0):(r(),E(x,{key:1,class:"hide-on-mobile",data:c.value},{empty:d(()=>[R(m(A(u)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:d(()=>[n(V,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(D=>[o("div",Sz,[o("div",Fz,m(A(it).get(g.value,D.row.object_id,"")),1),o("div",$z,m(A(it).get(y.value,D.row.object_id,"")),1)])]),_:1},8,["label"]),n(V,{label:A(u)("To Plan"),width:200},{default:d(D=>[o("div",Ez,[(r(!0),h(H,null,ae(A(it).get(D.row,"meta_value.to_variants",[]),T=>(r(),h(H,{key:T},[A(it).get(g.value,T)?(r(),E(F,{key:0},{default:d(()=>[R(m(A(it).get(g.value,T)),1)]),_:2},1024)):B("",!0)],64))),128))])]),_:1},8,["label"]),n(V,{label:A(u)("Discount Amount"),width:110},{default:d(D=>[D.row.meta_value.discount_amount>0?(r(),h("span",Uz,m(A(it).get(D.row,"meta_value.discount_amount","0")),1)):(r(),h("span",Iz,"--"))]),_:1},8,["label"]),n(V,{label:A(u)("Is Prorate"),width:100},{default:d(D=>[R(m(A(it).get(D.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),n(V,{width:100},{default:d(D=>[o("div",Qz,[n(ic,{pathId:D.row.id,preSelectedToVariants:A(it).get(D.row,"meta_value.to_variants",[]),preSelectedIsProrate:A(it).get(D.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(it).get(D.row,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:b.value,fromName:A(it).get(g.value,D.row.object_id,""),preSelectedFromVariant:D.row.object_id,onPathGenerated:f},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(Ze,{size:"x-small",tag:"button",outline:"",onClick:()=>w(D.row.id)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?B("",!0):(r(),h("div",Dz,[(r(!0),h(H,null,ae(c.value,(D,T)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:T},[o("div",Vz,[o("div",Tz,m(A(u)("From Plan"))+": ",1),o("div",null,[o("div",Mz,m(A(it).get(g.value,D.object_id,"")),1),A(it).get(y.value,D.object_id,"")?(r(),h("div",Lz,m(A(it).get(y.value,D.object_id,"")),1)):B("",!0)])]),o("div",Rz,[o("div",Oz,m(A(u)("To Plan"))+": ",1),(r(!0),h(H,null,ae(A(it).get(D,"meta_value.to_variants",[]),U=>(r(),h(H,{key:U},[A(it).get(g.value,U)?(r(),E(F,{key:0},{default:d(()=>[R(m(A(it).get(g.value,U)),1)]),_:2},1024)):B("",!0)],64))),128))]),o("div",Hz,[o("div",Pz,m(A(u)("Discount Amount"))+": ",1),D.meta_value.discount_amount>0?(r(),h("span",Nz,m(A(it).get(D,"meta_value.discount_amount","0")),1)):(r(),h("span",Kz,"--"))]),o("div",Gz,[o("div",jz,m(A(u)("Is Prorate"))+": ",1),o("span",null,m(A(it).get(D,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),o("div",zz,[o("div",qz,m(A(u)("Actions"))+": ",1),o("div",Yz,[n(ic,{pathId:D.id,preSelectedToVariants:A(it).get(D,"meta_value.to_variants",[]),preSelectedIsProrate:A(it).get(D,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(it).get(D,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:b.value,fromName:A(it).get(g.value,D.object_id,""),preSelectedFromVariant:D.object_id,onPathGenerated:f},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(Ze,{size:"x-small",tag:"button",outline:"",onClick:()=>w(D.id)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),c.value.length==0?(r(),h("div",Wz,m(A(u)("No upgrade paths found.")),1)):B("",!0)]))]),_:1}),l.value?B("",!0):(r(),E(A(rd),{key:0},{default:d(()=>[p.value.length?(r(),E(Q,{key:0,text:"",onClick:$[0]||($[0]=()=>{var D;return(D=s.value)==null?void 0:D.openModal()})},{default:d(()=>[n(J,{name:"Plus"}),R(" "+m(A(u)("Add Path")),1)]),_:1})):(r(),h("span",Jz,m(A(u)("No more upgrade paths available")),1))]),_:1}))],64)):A(i)?a.value?(r(),h("div",Zz,[n(wt,{icon:"Empty/WebPage",title:A(u)("Upgrade Paths Temporarily Unavailable for Bundle Products"),text:A(u)("Upgrade paths feature is temporarily disabled for bundle products. This feature will be enabled in a future update.")},null,8,["title","text"])])):B("",!0):(r(),h("div",Xz,[n(on,{class:"py-7.5",placement:"feature_lock_upgrade_paths",title:A(u)("Get access to this feature by Upgrading to FluentCart Pro"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))]),_:1})]),a.value?B("",!0):(r(),E(vz,{key:0,productId:e.product.ID,onPathGenerated:f,ref_key:"addModalRef",ref:s,pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:b.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},tq={name:"ProductIntegrations",components:{IconButton:Ze,Empty:wt,DynamicIcon:J,CardFooter:rd,CardBody:Ce,CardHeader:Qe,CardContainer:Be},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 ca},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:od,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(s=>{this.handleSuccess(s.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})}}},aq={class:"fct-integration-settings fct-layout-width"},lq={key:0,class:"integration-actions"},sq={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},nq={class:"text-sm"},oq={key:1,class:"fct-integrations-table-wrap"},iq={class:"fct-integration-logo-wrap"},rq=["src","alt"],dq={class:"text-xs text-gray-700"},uq=["onClick"],cq={class:"fct-event-triggers"},Aq={class:"fct-event-triggers"},pq={class:"fct-btn-group sm"},fq={class:"fct-integration-table-footer"},mq=["href"],hq={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function _q(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button"),f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown"),y=C("CardHeader"),v=C("el-skeleton"),b=C("el-switch"),k=C("el-table-column"),w=C("el-tag"),S=C("el-popover"),$=C("IconButton"),V=C("el-tooltip"),F=C("Empty"),x=C("el-table"),Q=C("CardBody"),D=C("CardContainer"),T=Ma("loading");return r(),h("div",aq,[n(D,null,{default:d(()=>[n(y,{title:e.$t("Product Integrations")},{action:d(()=>[i.hasActiveModules?(r(),h("div",lq,[n(g,{onCommand:i.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(!0),h(H,null,ae(s.available_integrations,(U,I)=>(r(),E(f,{key:I,command:I},{default:d(()=>[R(m(U.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(p,{type:"info",plain:"",size:"small"},{default:d(()=>[R(m(e.$t("Add Integration"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):B("",!0)]),_:1},8,["title"]),n(Q,{class:"px-0 pb-0 pt-4"},{default:d(()=>[n(v,{class:"px-5 pb-5",loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?B("",!0):(r(),h(H,{key:0},[i.hasActiveModules?(r(),h("div",oq,[qt((r(),E(x,{data:s.feeds},{empty:d(()=>[n(F,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:d(()=>[n(k,{label:e.$t("Status"),width:90},{default:d(U=>[n(b,{"active-value":"yes","inactive-value":"no",onChange:I=>i.handleActive(U.row),modelValue:U.row.enabled,"onUpdate:modelValue":I=>U.row.enabled=I},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(k,{width:160,label:e.$t("Integration")},{default:d(U=>{var I,O;return[o("div",iq,[(I=s.available_integrations[U.row.provider])!=null&&I.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:s.available_integrations[U.row.provider].logo,alt:U.row.provider},null,8,rq)):B("",!0),o("span",dq,m(((O=s.available_integrations[U.row.provider])==null?void 0:O.title)||U.row.provider),1)])]}),_:1},8,["label"]),n(k,{"min-width":150,label:e.$t("Title")},{default:d(U=>[o("a",{class:"fct-action-link-btn",onClick:Ne(I=>i.edit(U.row),["prevent"]),href:"#"},m(U.row.name),9,uq)]),_:1},8,["label"]),n(k,{"min-width":150,label:e.$t("Triggers")},{default:d(U=>[o("div",cq,[(r(!0),h(H,null,ae((U.row.feed.event_trigger||[]).slice(0,2),(I,O)=>(r(),E(w,{key:I},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+m(i.Str.headline(I)),1)]),_:2},1024))),128)),(U.row.feed.event_trigger||[]).length>2?(r(),E(S,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(w,{type:"info"},{default:d(()=>[R(" +"+m((U.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",Aq,[(r(!0),h(H,null,ae((U.row.feed.event_trigger||[]).slice(2),(I,O)=>(r(),E(w,{key:I+O},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+m(i.Str.headline(I)),1)]),_:2},1024))),128))])]),_:2},1024)):B("",!0)])]),_:1},8,["label"]),n(k,{width:90},{default:d(U=>[o("div",pq,[n(V,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n($,{tag:"button",onClick:I=>i.edit(U.row),size:"x-small",hover:"primary"},{default:d(()=>[n(c,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(V,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n($,{tag:"button",size:"x-small",onClick:I=>i.remove(U.row.id,U),hover:"danger"},{default:d(()=>[n(c,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[T,s.loading]])])):(r(),h("div",sq,[o("p",nq,m(e.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),n(p,{tag:"a",type:"primary",href:s.all_module_config_url},{default:d(()=>[R(m(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),o("div",fq,[o("a",{href:s.all_module_config_url},m(e.$t("Check Global Integration Settings")),9,mq),o("a",hq,m(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const rc=lt(tq,[["render",_q]]),vq={name:"SingleIntegration",components:{CardFooter:rd,CardBody:Ce,CardHeader:Qe,CardContainer:Be},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,s)=>l[s],this.formData.values);return this.compare(a,e.dependency.operator,e.dependency.value)}return!0}}},gq={class:"fct-integration-settings fct-layout-width"};function yq(e,t,a,l,s,i){const c=C("el-button"),p=C("CardHeader"),f=C("el-input"),_=C("el-form-item"),g=C("el-option"),y=C("el-select"),v=C("el-form"),b=C("CardBody"),k=C("CardContainer");return r(),h("div",gq,[n(k,null,{default:d(()=>[n(p,{border_bottom:"",title:s.integration_id?e.$t("Edit Integration"):e.$t("Add Integration")},{action:d(()=>[n(c,{onClick:i.saveIntegration,type:"primary",loading:s.saving},{default:d(()=>[R(m(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),n(b,null,{default:d(()=>[n(v,{"label-position":"top",model:s.formData.values,class:"integration-form"},{default:d(()=>[n(_,{label:e.$t("Integration Name"),required:""},{default:d(()=>[n(f,{modelValue:s.formData.values.name,"onUpdate:modelValue":t[0]||(t[0]=w=>s.formData.values.name=w),placeholder:e.$t("Enter a name for this integration")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s.integration_id?B("",!0):(r(),E(_,{key:0,label:e.$t("Integration Type")},{default:d(()=>[n(y,{modelValue:s.formData.values.integrationName,"onUpdate:modelValue":t[1]||(t[1]=w=>s.formData.values.integrationName=w),disabled:"",class:"fct-select"},{default:d(()=>[(r(!0),h(H,null,ae(s.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(H,null,ae(s.formData.fields,(w,S)=>(r(),h(H,{key:S},[S!=="integrationName"&&i.dependancyPass(w)?(r(),E(_,{key:0,label:w.label},{default:d(()=>[w.type==="text"?(r(),E(f,{key:0,modelValue:s.formData.values[S],"onUpdate:modelValue":$=>s.formData.values[S]=$,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="select"?(r(),E(y,{key:1,modelValue:s.formData.values[S],"onUpdate:modelValue":$=>s.formData.values[S]=$,placeholder:w.placeholder,class:"fct-select"},{default:d(()=>[(r(!0),h(H,null,ae(w.options,$=>(r(),E(g,{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="textarea"?(r(),E(f,{key:2,type:"textarea",modelValue:s.formData.values[S],"onUpdate:modelValue":$=>s.formData.values[S]=$,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),_:2},1032,["label"])):B("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const bq=lt(vq,[["render",yq],["__scopeId","data-v-486bb338"]]),wq={class:"fct-reason-dropdown-wrap"},Cq={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,s=a,i=M(l.modelValue),c=M("");be(()=>l.modelValue,_=>{i.value=_});const p=()=>{s("update:modelValue",i.value),i.value==="other"&&s("update:customReason",c.value)},f=_=>{i.value=_,p()};return t({getValue:()=>i.value,getCustomReason:()=>c.value,setValue:_=>f(_),setCustomReason:_=>{c.value=_}}),(_,g)=>{const y=C("el-option"),v=C("el-select"),b=C("el-input");return r(),h("div",wq,[o("label",Cq,m(A(u)("Reason")),1),n(v,{modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=k=>i.value=k),placeholder:A(u)("Select reason"),class:"w-full",onChange:p},{default:d(()=>[n(y,{label:A(u)("Received Stock"),value:"received"},null,8,["label"]),n(y,{label:A(u)("Damage/Loss"),value:"damage"},null,8,["label"]),n(y,{label:A(u)("Return/Refund"),value:"return"},null,8,["label"]),n(y,{label:A(u)("Count Correction"),value:"correction"},null,8,["label"]),n(y,{label:A(u)("Inventory Transfer"),value:"transfer"},null,8,["label"]),n(y,{label:A(u)("Other"),value:"other"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),n(va,{visible:i.value==="other",accordion:"",duration:300},{default:d(()=>[n(b,{modelValue:c.value,"onUpdate:modelValue":g[1]||(g[1]=k=>c.value=k),type:"textarea",rows:3,placeholder:A(u)("Please describe the reason"),class:"fct-custom-reason-textarea",onInput:p},null,8,["modelValue","placeholder"])]),_:1},8,["visible"])])}}}),kq={class:"fct-adjust-by-wrap"},Bq={class:"fct-adjust-by-row"},xq={class:"fct-adjust-by-col"},Sq={class:"title"},Fq={class:"fct-adjust-by-col"},$q={class:"title"},Eq={class:"fct-stock-info"},Uq={class:"fct-adjust-reason-wrap"},Iq={class:"fct-adjust-by-action"},tf=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,s=ai("fctPendingStockSaves",null),i=N(()=>!!a.variant.stock_save_pending||!!(s!=null&&s.has(a.variant.id))),c=M(!1),p=M(0),f=M(a.variant.total_stock),_=M(""),g=M(""),y=M(null),v=M(null);be(i,($,V)=>{V&&!$&&c.value&&b()}),be(c,$=>{$&&(f.value=a.variant.total_stock,p.value=0,ke(()=>{var V,F,x;(V=y.value)==null||V.focus(),(x=(F=y.value)==null?void 0:F.select)==null||x.call(F)}))});const b=()=>{const $=p.value||0;let F=(parseInt(a.variant.total_stock)||0)+parseInt($);f.value=F<0?0:F},k=()=>{const $=f.value||0,V=parseInt(a.variant.total_stock)||0;p.value=parseInt($)-V},w=()=>{p.value=0,f.value=a.variant.total_stock,_.value="",g.value="",c.value=!1},S=()=>{i.value||(l("save",{variant:a.variant,newStock:f.value,adjustedQuantity:p.value,reason:_.value,customReason:_.value==="other"?g.value:""}),c.value=!1,w())};return($,V)=>{const F=C("el-input"),x=C("el-button"),Q=C("el-popover");return r(),E(Q,{visible:c.value,"popper-class":"fct-stock-dropdown fct-inventory-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[o("div",{class:"fct-stock-adjuster-trigger",onClick:V[4]||(V[4]=D=>c.value=!c.value)},[n(J,{name:"Configuration"})])]),default:d(()=>[o("div",kq,[o("div",Bq,[o("div",xq,[o("span",Sq,m(A(u)("Adjust by")),1),n(F,{ref_key:"adjustByInput",ref:y,size:"small",placeholder:A(u)("Quantity"),type:"number",modelValue:p.value,"onUpdate:modelValue":V[0]||(V[0]=D=>p.value=D),modelModifiers:{number:!0},onInput:b},null,8,["placeholder","modelValue"])]),o("div",Fq,[o("span",$q,m(A(u)("New Stock")),1),n(F,{size:"small",placeholder:A(u)("New Stock"),type:"number",modelValue:f.value,"onUpdate:modelValue":V[1]||(V[1]=D=>f.value=D),modelModifiers:{number:!0},onInput:k},null,8,["placeholder","modelValue"])])]),n(va,{visible:!!p.value,accordion:""},{default:d(()=>[o("div",Eq,[V[5]||(V[5]=R(" (Original quantity: ",-1)),o("strong",null,m(e.variant.total_stock),1),V[6]||(V[6]=R(") ",-1))])]),_:1},8,["visible"]),o("div",Uq,[n(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",Iq,[n(x,{size:"small",type:"info",soft:"",onClick:w},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(x,{size:"small",type:"primary",onClick:S,disabled:!_.value||i.value,loading:i.value},{default:d(()=>[R(m(A(u)("Apply")),1)]),_:1},8,["disabled","loading"])])])]),_:1},8,["visible"])}}}),Qq={class:"fct-inventory-row"},Dq={width:"50"},Vq={class:"flex items-center gap-1"},Tq=["src","alt"],Mq=["src","alt"],Lq={class:"fct-inventory-product-content"},Rq={class:"fct-inventory-product-title"},Oq={key:0},Hq={key:0},Pq={key:1,class:"text-system-mid dark:text-gray-300"},Nq={key:1},Kq={key:2},Gq={key:3},jq=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,c,p,f;const l=C("el-checkbox"),s=C("el-input");return r(),h("tr",Qq,[o("td",Dq,[o("div",Vq,[n(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,Tq)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,Mq)),o("div",Lq,[o("span",Rq,m(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),h("td",Oq,[e.row.variants[0].sku?(r(),h("span",Hq,m(e.row.variants[0].sku),1)):(r(),h("span",Pq,m(A(u)("No SKU")),1))])):B("",!0),o("td",null,[n(s,{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:d(()=>[n(tf,{variant:e.row.variants[0],onSave:a[2]||(a[2]=_=>t.$emit("stock-save",_))},null,8,["variant"])]),_:1},8,["modelValue"])]),(c=e.inventoryTable)!=null&&c.isColumnVisible("available")?(r(),h("td",Nq,[o("span",null,m(e.row.variants[0].available),1)])):B("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),h("td",Kq,[o("span",null,m(e.row.variants[0].on_hold),1)])):B("",!0),(f=e.inventoryTable)!=null&&f.isColumnVisible("committed")?(r(),h("td",Gq,[o("span",null,m(e.row.variants[0].committed),1)])):B("",!0),o("td",null,[n(Ze,{tag:"button",size:"small",onClick:a[4]||(a[4]=_=>t.$emit("open-history",e.row.variants[0]))},{default:d(()=>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]})])])}}}),zq={class:"fct-inventory-row fct-inventory-parent-row"},qq={width:"50"},Yq={class:"fct-inventory-row-selection"},Wq=["src","alt"],Jq=["src","alt"],Xq={class:"fct-inventory-product-content"},Zq={class:"fct-inventory-product-title"},eY={key:0},tY={class:"!pl-5"},aY={key:1},lY={key:2},sY={key:3},nY={class:"fct-inventory-variant-item"},oY={class:"fct-inventory-product-info"},iY=["src","alt"],rY=["src","alt"],dY={class:"fct-inventory-product-content"},uY={key:0},cY={key:1},AY={key:2},pY={key:3},fY={key:0,class:"fct-inventory-child-row fct-inventory-load-more-row"},mY=["colspan"],hY=["disabled"],_Y={class:"fct-inventory-load-more-count"},dc=10,vY=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}){ll();const a=e,l=t,s=M(!0),i=N(()=>s.value);be(()=>a.expanded,D=>{s.value=D});const c=()=>{s.value=!s.value},p=()=>i.value,f=D=>{var U,I;const T=(U=a.row.stock_totals)==null?void 0:U[D];return T??(((I=a.row.variants)==null?void 0:I.reduce((O,L)=>O+(L[D]||0),0))||0)},_=N(()=>f("total_stock")),g=N(()=>f("available")),y=N(()=>f("on_hold")),v=N(()=>f("committed")),b=M(!1),k=N(()=>{var D;return((D=a.row.variants)==null?void 0:D.length)||0}),w=N(()=>a.row.variants_total??k.value),S=N(()=>k.value<w.value),$=N(()=>{var U,I;return 3+(((I=(U=a.inventoryTable)==null?void 0:U.getToggleableColumns)==null?void 0:I.call(U))||[]).filter(O=>{var L;return(L=a.inventoryTable)==null?void 0:L.isColumnVisible(O.value)}).length}),V=()=>{if(b.value)return;b.value=!0;const D=a.row.variants||[],T=D.length?D[D.length-1].id:0;ue.get("inventory/variants",{post_id:a.row.ID,after_id:T,page:Math.floor(D.length/dc)+1,per_page:dc}).then(U=>{var L,P;const I=((L=U==null?void 0:U.variants)==null?void 0:L.data)||[],O=new Set((a.row.variants||[]).map(q=>q.id));I.forEach(q=>{O.has(q.id)||a.row.variants.push(q)}),((P=U==null?void 0:U.variants)==null?void 0:P.total)!==void 0&&(a.row.variants_total=U.variants.total),l("variants-loaded")}).catch(U=>{var I;U.status_code=="422"?z.validationErrors(U):z.error(((I=U.data)==null?void 0:I.message)||u("Failed to load more variants"))}).finally(()=>{b.value=!1})},F=()=>{const D=a.row.variants||[];return D.length>0&&D.every(T=>a.isRowSelected(T))},x=()=>{const D=a.row.variants||[],T=D.filter(U=>a.isRowSelected(U)).length;return T>0&&T<D.length},Q=D=>{var T;(T=a.row.variants)==null||T.forEach(U=>{D!==a.isRowSelected(U)&&a.toggleRowSelection(U)})};return(D,T)=>{var L,P,q,X;const U=C("el-checkbox"),I=C("router-link"),O=C("el-input");return r(),h(H,null,[o("tr",zq,[o("td",qq,[o("div",Yq,[n(U,{"model-value":F(),indeterminate:x(),onChange:Q,onClick:T[0]||(T[0]=Ne(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),o("div",{onClick:T[1]||(T[1]=G=>c()),class:"fct-inventory-row-toggle"},[n(J,{name:p()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:T[2]||(T[2]=G=>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,Wq)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,Jq)),o("div",Xq,[o("span",Zq,m(e.row.post_title),1)])])]),(L=e.inventoryTable)!=null&&L.isColumnVisible("sku")?(r(),h("td",eY,[qt(o("span",null,"--",512),[[Dl,!p()]])])):B("",!0),o("td",tY,[qt(o("span",null,m(_.value),513),[[Dl,!p()]])]),(P=e.inventoryTable)!=null&&P.isColumnVisible("available")?(r(),h("td",aY,[qt(o("span",null,m(g.value),513),[[Dl,!p()]])])):B("",!0),(q=e.inventoryTable)!=null&&q.isColumnVisible("on_hand")?(r(),h("td",lY,[qt(o("span",null,m(y.value),513),[[Dl,!p()]])])):B("",!0),(X=e.inventoryTable)!=null&&X.isColumnVisible("committed")?(r(),h("td",sY,[qt(o("span",null,m(v.value),513),[[Dl,!p()]])])):B("",!0),T[4]||(T[4]=o("td",null,null,-1))]),(r(!0),h(H,null,ae(e.row.variants,G=>{var te,ne,re,K,Y;return qt((r(),h("tr",{key:`child-${G.id}`,class:"fct-inventory-child-row"},[T[6]||(T[6]=o("td",null,null,-1)),o("td",null,[o("div",nY,[n(U,{"model-value":e.isRowSelected(G),onChange:W=>e.toggleRowSelection(G)},null,8,["model-value","onChange"]),o("div",oY,[G.thumbnail!==null?(r(),h("img",{key:0,src:G.thumbnail,alt:G.variation_title,class:"inventory-thumbnail"},null,8,iY)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:G.variation_title},null,8,rY)),o("div",dY,[n(I,{to:`/products/${G.post_id}`,class:"fct-inventory-product-title"},{default:d(()=>[R(m(G.variation_title),1)]),_:2},1032,["to"])])])])]),(te=e.inventoryTable)!=null&&te.isColumnVisible("sku")?(r(),h("td",uY,m(G.sku),1)):B("",!0),o("td",null,[n(O,{modelValue:G.total_stock,"onUpdate:modelValue":W=>G.total_stock=W,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(tf,{variant:G,onSave:T[3]||(T[3]=W=>D.$emit("stock-save",W))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(ne=e.inventoryTable)!=null&&ne.isColumnVisible("available")?(r(),h("td",cY,m(G.available),1)):B("",!0),(re=e.inventoryTable)!=null&&re.isColumnVisible("on_hand")?(r(),h("td",AY,m(G.on_hold),1)):B("",!0),(K=e.inventoryTable)!=null&&K.isColumnVisible("committed")?(r(),h("td",pY,m(G.committed),1)):B("",!0),o("td",null,[n(Ze,{tag:"button",size:"small",onClick:W=>D.$emit("open-history",G)},{default:d(()=>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"])])])),[[Dl,((Y=e.row.variants)==null?void 0:Y.length)>0&&p()]])}),128)),S.value?qt((r(),h("tr",fY,[T[7]||(T[7]=o("td",null,null,-1)),o("td",{colspan:$.value},[o("button",{class:"fct-inventory-load-more-btn",disabled:b.value,onClick:V},[n(J,{name:"Reload",class:de({"fct-spin":b.value})},null,8,["class"]),b.value?(r(),h(H,{key:0},[R(m(A(u)("Loading...")),1)],64)):(r(),h(H,{key:1},[R(m(A(u)("Load More"))+" ",1),o("span",_Y,"("+m(k.value)+"/"+m(w.value)+")",1)],64))],8,hY)],8,mY)],512)),[[Dl,i.value]]):B("",!0)],64)}}}),gY={class:"fct-adjustment-header"},yY={class:"fct-adjustment-product-name"},bY={key:0,class:"fct-adjustment-timeline-wrap"},wY={key:0,class:"fct-adjustment-timeline"},CY={class:"fct-timeline-node"},kY={class:"fct-timeline-content"},BY={class:"fct-timeline-header"},xY={class:"fct-timeline-time"},SY={class:"fct-stock-flow"},FY={class:"fct-stock-flow-item"},$Y={class:"fct-stock-entry"},EY={class:"fct-stock-label"},UY={class:"fct-stock-value"},IY={class:"fct-stock-entry new-stock-entry"},QY={class:"fct-stock-label"},DY={class:"fct-stock-value"},VY={class:"fct-stock-flow-item"},TY={class:"fct-stock-label"},MY={key:0,class:"fct-custom-reason-section"},LY={class:"fct-stock-label"},RY={class:"fct-custom-reason-text"},OY={key:1,class:"fct-timeline-empty"},HY={key:1,class:"fct-timeline-loading"},PY=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=M(!1),l=M(!1),s=M({id:null,name:""}),i=M([]),c=()=>{a.value=!1,i.value=[]},p=y=>{s.value=y,a.value=!0,f(y.id)},f=y=>{y&&(l.value=!0,ue.get("inventory/adjustment-history",{variant_id:y}).then(v=>{i.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{z.error(u("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 b=C("el-drawer");return r(),E(b,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=k=>a.value=k),title:A(u)("Stock Adjustment History"),onClose:c},{default:d(()=>[o("div",gY,[o("h3",yY,m(s.value.name),1)]),l.value?(r(),h("div",HY,[o("p",null,m(A(u)("Loading adjustment history...")),1)])):(r(),h("div",bY,[i.value.length>0?(r(),h("div",wY,[(r(!0),h(H,null,ae(i.value,(k,w)=>(r(),h("div",{key:w,class:"fct-timeline-item"},[o("div",CY,[o("span",{class:de(["fct-node-dot",`node-${k.reason}`])},null,2)]),o("div",kY,[o("div",BY,[o("span",xY,[n(Na,{"date-time":k.created_at},null,8,["date-time"]),R(" (by "+m(k.user_name)+") ",1)]),o("span",{class:de(["fct-timeline-reason-badge",`badge-${k.reason}`])},m(k.reason_label),3)]),o("div",SY,[o("div",FY,[o("div",$Y,[o("span",EY,m(A(u)("Previous Stock:")),1),o("span",UY,m(k.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",IY,[o("span",QY,m(A(u)("New Stock:")),1),o("span",DY,m(k.new_stock),1)])]),o("div",VY,[o("span",TY,m(A(u)("Change:")),1),o("span",{class:de(["fct-stock-value fct-stock-change",_(k.change)])},m(g(k.change))+" "+m(A(u)("units")),3)]),k.reason==="other"&&k.custom_reason?(r(),h("div",MY,[o("span",LY,m(A(u)("Details:")),1),o("p",RY,m(k.custom_reason),1)])):B("",!0)])])]))),128))])):(r(),h("div",OY,[n(wt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),NY={class:"fct-bulk-modal-content"},KY={class:"fct-inventory-mode-selection"},GY={class:"fct-inventory-input-section"},jY={key:0,class:"fct-inventory-mode-hint"},zY={class:"fct-inventory-selected-items"},qY={class:"fct-inventory-selected-items-count"},YY={key:0,class:"fct-inventory-selected-items-preview"},WY={class:"fct-inventory-selected-item-header"},JY={class:"variant-title"},XY={class:"total-stock"},ZY={class:"fct-inventory-selected-item-list"},eW={class:"fct-inventory-selected-item-info"},tW={class:"fct-inventory-selected-item-title"},aW={class:"fct-inventory-selected-item-stock-action"},lW={class:"total-stock"},sW={class:"stock-arrow"},nW={class:"bulk-stock-value"},oW={class:"fct-inventory-adjustment-reason"},iW={class:"dialog-footer"},rW=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,s=a,i=M(!1),c=M("add"),p=M(null),f=M(""),_=M(""),g=S=>c.value==="add"?S.total_stock+p.value:p.value,y=S=>p.value!==null&&p.value!==""&&g(S)!==S.total_stock,v=()=>{k(),i.value=!1},b=()=>{const S={mode:c.value,value:p.value,reason:f.value,customReason:f.value==="other"?_.value:"",items:l.selectedItems.map($=>({id:$.id,post_id:$.post_id}))};ue.post("inventory/bulk-update",S).then(()=>{z.success(u("Stock updated successfully")),k(),i.value=!1,s("bulk-update-success")}).catch($=>{var V;$.status_code===422?z.validationErrors($):z.error(((V=$.data)==null?void 0:V.message)||u("Failed to update stock"))})},k=()=>{p.value=null,c.value="add",f.value="",_.value=""};return t({openModal:()=>{k(),i.value=!0}}),(S,$)=>{const V=C("el-radio"),F=C("el-radio-group"),x=C("el-input"),Q=C("el-button"),D=C("el-dialog");return r(),E(D,{modelValue:i.value,"onUpdate:modelValue":$[4]||($[4]=T=>i.value=T),title:A(u)("Update Stocks")},{default:d(()=>{var T;return[o("div",NY,[o("div",KY,[n(F,{modelValue:c.value,"onUpdate:modelValue":$[0]||($[0]=U=>c.value=U),class:"fct-mode-radio-group"},{default:d(()=>[n(V,{value:"add"},{default:d(()=>[R(m(A(u)("Increase Stock")),1)]),_:1}),n(V,{value:"set"},{default:d(()=>[R(m(A(u)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),o("div",GY,[n(fa,{title:c.value==="add"?A(u)("Increase Stock by"):A(u)("Exact new stock"),content:c.value==="add"?A(u)("Increase stock by value (e.g. 10 + 5 = 15)"):A(u)("Set stock to exact value (e.g. 10 → 20)")},null,8,["title","content"]),n(x,{modelValue:p.value,"onUpdate:modelValue":$[1]||($[1]=U=>p.value=U),modelModifiers:{number:!0},type:"number",placeholder:c.value==="add"?A(u)("Enter amount to add"):A(u)("Enter exact stock value")},null,8,["modelValue","placeholder"]),c.value==="set"?(r(),h("div",jY,[n(J,{name:"Warning"}),R(" "+m(A(u)("Replaces current inventory")),1)])):B("",!0)]),o("div",zY,[o("div",qY,m(e.selectedItems.length)+" "+m(A(u)("variants will be changed:")),1),(T=e.selectedItems)!=null&&T.length?(r(),h("div",YY,[o("div",WY,[o("span",JY,m(A(u)("Variant")),1),o("span",XY,m(A(u)("Stock Change")),1)]),o("ul",ZY,[(r(!0),h(H,null,ae(e.selectedItems,U=>(r(),h("li",{key:U.id},[o("div",eW,[o("span",tW,m(U.variation_title),1)]),o("div",aW,[o("span",lW,m(U.total_stock),1),y(U)?(r(),h(H,{key:0},[o("span",sW,[n(J,{name:"ArrowRight"})]),o("span",nW,m(g(U)),1)],64)):B("",!0)])]))),128))])])):B("",!0)]),o("div",oW,[n(ef,{modelValue:f.value,"onUpdate:modelValue":$[2]||($[2]=U=>f.value=U),"onUpdate:customReason":$[3]||($[3]=U=>_.value=U)},null,8,["modelValue"])]),o("div",iW,[n(Q,{onClick:v},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:b,disabled:!f.value},{default:d(()=>[R(m(A(u)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),dW={class:"fct-advanced-inventory-table"},uW={class:"fct-inventory-toolbar-wrap"},cW={key:0,class:"fct-inventory-toolbar-selected"},AW={class:"fct-inventory-toolbar-actions ml-auto"},pW={key:0,class:"fct-advanced-inventory-table-wrap"},fW={class:"fct-advanced-inventory-table"},mW={key:0,width:"150"},hW={key:1,width:"100"},_W={key:2,width:"100"},vW={key:3,width:"100"},gW={width:"50"},yW={key:0},bW={key:1},wW={key:2},CW={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=ll(),l=e,s=t,i=M([]),c=M(!1),p=M(!1),f=M(null),_=M(null),g=M(!0);be(i,D=>{s("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}})},b=()=>{_.value&&_.value.openModal()},k=()=>{i.value=[],F(),s("bulk-update-success")},w=()=>l.data.flatMap(D=>D.variants&&D.variants.length>0?D.variants:[D]),S=D=>{D?i.value=w():i.value=[],F()},$=D=>{const T=i.value.findIndex(U=>U.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?(c.value=!1,p.value=!1):T===D.length?(c.value=!0,p.value=!1):(c.value=!1,p.value=!0)},x=D=>{f.value&&f.value.openHistory({id:D.id,name:D.variation_title||D.post_title})},Q=()=>{g.value=!g.value};return(D,T)=>{var O,L,P,q,X,G,te,ne;const U=C("el-button"),I=C("el-checkbox");return r(),h("div",dW,[o("div",uW,[i.value.length>0?(r(),h("div",cW,m(i.value.length)+" "+m(A(u)("selected")),1)):B("",!0),o("div",AW,[i.value.length>0?(r(),E(U,{key:0,type:"primary",size:"small",onClick:b},{default:d(()=>[R(m(A(u)("Update Stocks")),1)]),_:1})):B("",!0),n(U,{class:"fct-expand-row-button",size:"small",onClick:Q},{default:d(()=>[n(J,{name:g.value?"Expand":"Collapse"},null,8,["name"]),R(" "+m(g.value?A(u)("Collapse All"):A(u)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),h("div",pW,[o("table",fW,[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",mW)):B("",!0),T[5]||(T[5]=o("col",{width:"160"},null,-1)),(L=e.inventoryTable)!=null&&L.isColumnVisible("available")?(r(),h("col",hW)):B("",!0),(P=e.inventoryTable)!=null&&P.isColumnVisible("on_hand")?(r(),h("col",_W)):B("",!0),(q=e.inventoryTable)!=null&&q.isColumnVisible("committed")?(r(),h("col",vW)):B("",!0),T[6]||(T[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",gW,[n(I,{modelValue:c.value,"onUpdate:modelValue":T[0]||(T[0]=re=>c.value=re),indeterminate:p.value,onChange:S},null,8,["modelValue","indeterminate"])]),o("th",null,m(A(u)("Products")),1),(X=e.inventoryTable)!=null&&X.isColumnVisible("sku")?(r(),h("th",yW,m(A(u)("SKU")),1)):B("",!0),o("th",null,m(A(u)("Total Stock")),1),(G=e.inventoryTable)!=null&&G.isColumnVisible("available")?(r(),h("th",bW,m(A(u)("Available")),1)):B("",!0),(te=e.inventoryTable)!=null&&te.isColumnVisible("on_hand")?(r(),h("th",wW,m(A(u)("On hold")),1)):B("",!0),(ne=e.inventoryTable)!=null&&ne.isColumnVisible("committed")?(r(),h("th",CW,m(A(u)("Delivered")),1)):B("",!0),T[7]||(T[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(H,null,ae(e.data,re=>(r(),h(H,{key:y(re)},[!re.variants||re.variants.length===1?(r(),E(jq,{key:0,row:re,"inventory-table":e.inventoryTable,"is-row-selected":V,"toggle-row-selection":$,"navigate-to-product":v,"get-placeholder-image":D.getPlaceholderImage,onStockSave:T[1]||(T[1]=K=>s("stock-save",K)),onOpenHistory:x},null,8,["row","inventory-table","get-placeholder-image"])):B("",!0),re.variants&&re.variants.length>1?(r(),E(vY,{key:1,row:re,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":D.getPlaceholderImage,"is-row-selected":V,"toggle-row-selection":$,expanded:g.value,onStockSave:T[2]||(T[2]=K=>s("stock-save",K)),onOpenHistory:x,onVariantsLoaded:F},null,8,["row","inventory-table","get-placeholder-image","expanded"])):B("",!0)],64))),128))])])])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No inventory data")},null,8,["text"])),n(rW,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:k},null,8,["selected-items"]),n(PY,{ref_key:"historyRef",ref:f},null,512)])}}}),kW={class:"fct-advanced-inventory-table"},BW={class:"fct-inventory-toolbar-wrap"},xW={class:"fct-inventory-toolbar-actions ml-auto"},SW={class:"fct-advanced-inventory-table-wrap"},FW={class:"fct-advanced-inventory-table"},$W={key:0,width:"150"},EW={key:1,width:"100"},UW={key:2,width:"100"},IW={key:3,width:"100"},QW={width:"50"},DW={key:0},VW={key:1},TW={key:2},MW={key:3},LW={class:"fct-product-info-card"},RW={class:"fct-product-info-media"},OW={class:"fct-product-info-details"},HW={key:0},PW={key:1},NW={key:2},KW={key:3},GW={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=N(()=>Array.from({length:t.nextPageCount/2},(l,s)=>s+1));return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-skeleton");return r(),E(c,{animated:""},{template:d(()=>{var p,f,_,g,y,v,b,k;return[o("div",kW,[o("div",BW,[o("div",xW,[n(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",SW,[o("table",FW,[o("colgroup",null,[s[0]||(s[0]=o("col",{width:"50"},null,-1)),s[1]||(s[1]=o("col",null,null,-1)),(p=e.inventoryTable)!=null&&p.isColumnVisible("sku")?(r(),h("col",$W)):B("",!0),s[2]||(s[2]=o("col",{width:"160"},null,-1)),(f=e.inventoryTable)!=null&&f.isColumnVisible("available")?(r(),h("col",EW)):B("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),h("col",UW)):B("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",IW)):B("",!0),s[3]||(s[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",QW,[n(i,{variant:"p",class:"w-4 h-4"})]),o("th",null,[n(i,{variant:"p",class:"w-20"})]),(y=e.inventoryTable)!=null&&y.isColumnVisible("sku")?(r(),h("th",DW,[n(i,{variant:"p",class:"w-10"})])):B("",!0),o("th",null,[n(i,{variant:"p",class:"w-24"})]),(v=e.inventoryTable)!=null&&v.isColumnVisible("available")?(r(),h("th",VW,[n(i,{variant:"p",class:"w-20"})])):B("",!0),(b=e.inventoryTable)!=null&&b.isColumnVisible("on_hand")?(r(),h("th",TW,[n(i,{variant:"p",class:"w-16"})])):B("",!0),(k=e.inventoryTable)!=null&&k.isColumnVisible("committed")?(r(),h("th",MW,[n(i,{variant:"p",class:"w-20"})])):B("",!0),s[4]||(s[4]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(H,null,ae(a.value,w=>{var S,$,V,F;return r(),h("tr",{key:w},[o("td",null,[n(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",LW,[o("div",RW,[n(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",OW,[n(i,{variant:"p",class:"max-w-[180px]"})])])]),(S=e.inventoryTable)!=null&&S.isColumnVisible("sku")?(r(),h("td",HW,[n(i,{variant:"p",class:"w-20"})])):B("",!0),o("td",null,[n(i,{variant:"p",class:"w-16"})]),($=e.inventoryTable)!=null&&$.isColumnVisible("available")?(r(),h("td",PW,[n(i,{variant:"p",class:"w-10"})])):B("",!0),(V=e.inventoryTable)!=null&&V.isColumnVisible("on_hand")?(r(),h("td",NW,[n(i,{variant:"p",class:"w-10"})])):B("",!0),(F=e.inventoryTable)!=null&&F.isColumnVisible("committed")?(r(),h("td",KW,[n(i,{variant:"p",class:"w-10"})])):B("",!0),s[5]||(s[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},jW={class:"fct-module-disabled-notice"},zW={class:"fct-disabled-notice-title"},qW={class:"fct-disabled-notice-text"},YW=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=C("el-icon"),s=C("router-link");return r(),h("div",jW,[n(l,{class:"fct-disabled-notice-icon"},{default:d(()=>[n(A(Yf))]),_:1}),o("h3",zW,m(A(u)("Stock Management Inactive")),1),o("p",qW,[R(m(A(u)("Stock Management module is currently disabled. Please enable it in "))+" ",1),n(s,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[R(m(A(u)("module settings")),1)]),_:1}),R(" "+m(A(u)(" to use inventory features.")),1)])])}}});class WW extends Qs{getTabs(){return{all:u("All"),low_stock:u("Low Stock"),out_of_stock:u("Out of Stock")}}getToggleableColumns(){return[{label:u("SKU"),value:"sku"},{label:u("Available"),value:"available"},{label:u("On hold"),value:"on_hand"},{label:u("Committed"),value:"committed"}]}getSortableColumns(){return[{label:u("Product ID"),value:"id"},{label:u("Product Title"),value:"post_title"}]}getSearchHint(){return u("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 JW(e){return WW.init(e)}const XW={class:"fct-all-inventory-page fct-layout-width"},ZW={class:"fct-inventory-wrap"},eJ={key:2,class:"py-10"},tJ={class:"fct-pro-feature-text"},aJ=Object.assign({name:"AdvancedInventory"},{__name:"Inventory",setup(e){const t=Ge.get("app_config"),a=N(()=>t==null?void 0:t.isProActive),l=Ge.get("modules_settings"),s=N(()=>{var V;return((V=l==null?void 0:l.stock_management)==null?void 0:V.active)==="yes"}),i=N(()=>{var V;return((V=l==null?void 0:l.stock_management)==null?void 0:V.enable_advanced_inventory)==="yes"}),c=N(()=>a.value&&s.value&&i.value),p=JW({instance:Yt(),fetch:!1}),f=M(0),_=M([]),g=V=>{f.value=V.count,_.value=V.selectedItems||[]},y=()=>{p.fetch()},v=new Map,b=Js(new Set);si("fctPendingStockSaves",b);const k=V=>{const{variant:F,newStock:x,reason:Q,customReason:D}=V,T=parseInt(x);if(isNaN(T)||T<0){z.error(u("Please enter a valid stock quantity"));return}const U={variantId:F.id,postId:F.post_id,newStock:T,reason:Q,customReason:D||""},I=v.get(U.postId)||{inFlight:!1,pending:new Map};if(v.set(U.postId,I),b.add(U.variantId),I.inFlight){I.pending.set(U.variantId,U);return}I.inFlight=!0,$(U,I)},w=V=>p.getTableData().find(F=>F.ID===V),S=(V,F,x)=>{var D;const Q=w(V);return((D=Q==null?void 0:Q.variants)==null?void 0:D.find(T=>T.id===F))||x},$=(V,F)=>{ue.post("inventory/update-stock",{variant_id:V.variantId,post_id:V.postId,new_stock:V.newStock,reason:V.reason,customReason:V.customReason}).then(x=>{const Q=S(V.postId,V.variantId,null);if(Q){const D=parseInt(x.new_stock);if(Q.total_stock=isNaN(D)?V.newStock:D,x.available!==void 0)Q.available=parseInt(x.available)||0;else{const T=Q.total_stock-(parseInt(Q.committed)||0)-(parseInt(Q.on_hold)||0);Q.available=T<0?0:T}}if(x.stock_totals){const D=w(V.postId);D&&D.stock_totals&&(D.stock_totals=x.stock_totals)}z.success(x.message?u(x.message):u("Stock updated successfully"))}).catch(x=>{var Q;F.pending.has(V.variantId)||((x==null?void 0:x.status_code)=="422"?z.validationErrors(x):z.error(((Q=x==null?void 0:x.data)==null?void 0:Q.message)||u("Failed to update stock")))}).finally(()=>{if(!F.pending.has(V.variantId)){b.delete(V.variantId);const Q=S(V.postId,V.variantId,null);Q&&(Q.stock_save_pending=!1)}const x=F.pending.entries().next().value;x?(F.pending.delete(x[0]),$(x[1],F)):(F.inFlight=!1,v.delete(V.postId))})};return Ie(()=>{c.value&&p.fetch()}),(V,F)=>{const x=C("router-link");return r(),h("div",XW,[n(nl,{title:A(u)("Inventory")},{action:d(()=>[n(Rt,{permission:"products/view"})]),_:1},8,["title"]),c.value?(r(),E(Rt,{key:0,permission:"products/view"},{default:d(()=>[o("div",ZW,[n(Ds,{table:A(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[n(uc,{data:A(p).getTableData(),"inventory-table":A(p),onStockSave:k,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:d(()=>[A(p).isLoading()?(r(),E(GW,{key:0,"next-page-count":A(p).nextPageCount,"inventory-table":A(p)},null,8,["next-page-count","inventory-table"])):(r(),E(uc,{key:1,data:A(p).getTableData(),"inventory-table":A(p),onStockSave:k,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):s.value?(r(),h("div",eJ,[n(on,{placement:"feature_lock_advanced_inventory",title:A(u)("Advanced Inventory")},{default:d(()=>[o("p",tJ,[R(m(A(u)("This feature is only available in FluentCart Pro with "))+" ",1),n(x,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[R(m(A(u)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),E(YW,{key:1}))])}}}),lJ={class:"setting-wrap"},sJ={class:"setting-wrap-inner"},nJ={key:0,class:"fct-all-notification-table-wrap"},oJ={class:"fct-card-header"},iJ={class:"w-full pb-2"},rJ={class:"flex items-center justify-between gap-2 pb-2"},dJ={class:"flex-1"},uJ={style:{width:"120px"}},cJ={class:"flex items-center justify-between gap-3",style:{width:"220px"}},AJ={key:1,class:"fct-all-notification-table-wrap"},pJ=["id"],fJ={class:"fct-card-header"},mJ={class:"w-full pb-2"},hJ={class:"flex items-center justify-between gap-2 pb-2"},_J={class:"fct-card-header-title"},vJ={class:"text-xs text-system-mid dark:text-gray-300"},gJ={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},yJ={class:"fct-card-body px-0 pb-0 pt-0"},bJ={class:"m-0 mb-1"},wJ={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},CJ={class:"m-0 text-sm"},kJ={class:"fct-all-notification-actions flex items-center justify-between gap-3"},BJ={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},xJ={class:"fct-btn-group sm flex-shrink-0"},SJ={__name:"EmailNotificationSettings",setup(e){const t=sl(),a=M(!0),l=M([]),s=N(()=>{if(!l.value.length)return[];const p={};return l.value.forEach(f=>{const _=(f==null?void 0:f.group)||"other";p[_]||(p[_]={key:_,label:(f==null?void 0:f.group_label)||u("Other Actions"),items:[]}),p[_].items.push(f)}),Object.values(p)}),i=()=>{a.value=!0,ue.get("email-notification").then(p=>{l.value=Object.values(p.data)}).catch(p=>{}).finally(()=>{a.value=!1,ke(()=>{requestAnimationFrame(()=>ln.scrollToHashSection(t.hash))})})},c=(p,f)=>{ue.post("email-notification/enable-notification/"+f,{active:p}).then(_=>{z.success(_.message)}).catch(_=>{var g;_.status_code=="422"?z.validationErrors(_):z.error((g=_.data)==null?void 0:g.message)}).finally(()=>{})};return Ie(()=>{i()}),(p,f)=>{const _=C("el-skeleton-item"),g=C("el-skeleton"),y=C("router-link"),v=C("el-table-column"),b=C("el-switch"),k=C("el-tooltip"),w=C("el-table");return r(),h("div",lJ,[n(Qa,{heading:A(u)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",sJ,[n(Da),a.value?(r(),h("div",nJ,[(r(),h(H,null,ae(2,S=>o("div",{key:S,class:"fct-card fct-notification-group mb-4 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[n(g,{animated:""},{template:d(()=>[o("div",oJ,[o("div",iJ,[o("div",rJ,[n(_,{variant:"text",style:{width:"140px",height:"16px"}}),n(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(H,null,ae(4,$=>o("div",{key:$,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",dJ,[n(_,{variant:"text",style:{width:"50%",height:"14px",display:"block","margin-bottom":"8px"}}),n(_,{variant:"text",style:{width:"75%",height:"12px",display:"block"}})]),o("div",uJ,[n(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",cJ,[n(_,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px",display:"block"}}),n(_,{variant:"text",style:{width:"28px",height:"28px","border-radius":"6px",display:"block"}})])])),64))]),_:1})])),64))])):(r(),h("div",AJ,[s.value.length?(r(!0),h(H,{key:0},ae(s.value,S=>(r(),h("div",{key:S.key,id:S.key,class:"fct-card fct-notification-group overflow-hidden"},[o("div",fJ,[o("div",mJ,[o("div",hJ,[o("h4",_J,m(S.label),1),o("span",vJ,m(S.items.length)+" "+m(A(u)("Notifications")),1)]),S.key==="scheduler"?(r(),h("p",gJ,[R(m(A(u)("This notification trigger is controlled from the Reminders section. You can configure it from"))+" ",1),n(y,{to:{path:"/settings/email_mailing_settings/reminders"},class:"underline hover:no-underline font-medium text-inherit hover:text-inherit"},{default:d(()=>[R(m(A(u)("reminder settings")),1)]),_:1})])):B("",!0)])]),o("div",yJ,[n(w,{data:S.items,"show-header":!0},{default:d(()=>[n(v,{prop:"title",label:A(u)("Notification Name"),"min-width":"320"},{default:d($=>[o("h4",bJ,m($.row.title),1),o("p",wJ,m($.row.description),1)]),_:1},8,["label"]),n(v,{prop:"recipient",label:A(u)("Recipient"),"min-width":"120"},{default:d($=>[o("p",CJ,m(A(ca).headline($.row.recipient)),1)]),_:1},8,["label"]),n(v,{label:A(u)("Enabled"),"min-width":"220"},{default:d($=>{var V,F,x;return[o("div",kJ,[((V=$.row)==null?void 0:V.manage_toggle)!=="no"?(r(),E(b,{key:0,onChange:Q=>c(Q,$.row.name),modelValue:$.row.settings.active,"onUpdate:modelValue":Q=>$.row.settings.active=Q,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):B("",!0),((F=$.row)==null?void 0:F.manage_toggle)==="no"?(r(),h("span",BJ,m(((x=$.row)==null?void 0:x.toggle_label)||A(u)("Auto-enabled")),1)):B("",!0),o("div",xJ,[n(k,{effect:"dark",content:A(u)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{to:{name:"email_notifications/edit",params:{name:$.row.name}},size:"x-small",hover:"primary"},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])])],8,pJ))),128)):(r(),E(wt,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:A(u)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},FJ={__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=Ge.get("app_config.isProActive"),l=Ge.get("app_config.proVersion"),s=a&&l&&l.localeCompare(t.minVersion,void 0,{numeric:!0})<0,i=u("This feature requires FluentCart Pro v%s or later. Please update FluentCart Pro to use this feature.").replace("%s",t.minVersion);return(c,p)=>{const f=C("el-alert");return A(a)&&!A(s)?ba(c.$slots,"default",{key:0}):A(s)?(r(),E(f,{key:1,type:"warning","show-icon":"",closable:!1,title:A(u)("Update Required"),description:A(i)},null,8,["title","description"])):(r(),E(on,{key:2,title:e.featureTitle,text:e.featureText,placement:e.placement},null,8,["title","text","placement"]))}}},$J={class:"setting-wrap fct-edit-email-notification-wrapper"},EJ={class:"capitalize"},UJ={class:"setting-wrap-inner"},IJ={class:"mb-5"},QJ={class:"setting-switcher flex items-center gap-3"},DJ={class:"text-sm text-system-dark dark:text-gray-50"},VJ={class:"fct-card p-6"},TJ={class:"mb-5"},MJ={class:"el-form-item__label block mb-2"},LJ={class:"mb-5"},RJ={class:"el-form-item__label block mb-2"},OJ={class:"el-form-item__label block mb-2"},HJ={class:"mb-5"},PJ={key:0,class:"setting-switcher"},NJ={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},KJ={class:"fct-seg-wrap"},GJ={key:0,class:"fct-default-template-preview"},jJ={class:"el-form-item__label"},zJ={key:1,class:"fct-default-template-frame"},qJ=["srcdoc"],YJ={key:0,class:"el-form-item__label"},WJ={key:1,class:"text-system-mid mb-3"},JJ={key:2,class:"mb-4"},XJ={class:"setting-save-action"},ZJ={key:0,style:{height:"300px"}},eX={class:"fct-preview-toolbar"},tX={class:"fct-preview-device-toggle"},aX={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=Ge.get("app_config.isProActive"),a=e,l=M(!1),s=M(!1),i=M(a.name),c=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),f=M({}),_=M([]),g=M(),y=(G,te={})=>!G||typeof G!="object"?[]:(G.schema?[[G.form_name||"form",G]]:Object.entries(G)).filter(([,re])=>(re==null?void 0:re.schema)&&Object.keys(re.schema).length).map(([re,K])=>({...K,form_key:re,values:{...K.values||{},...te[re]||{}}})),v=()=>{const te=[].concat(g.value||[]).reduce((ne,re)=>typeof(re==null?void 0:re.getState)=="function"?{...ne,...re.getState()}:ne,{});return Object.keys(te).length?{[i.value]:te}:null},b=M(!1),k=M(!1),w=M([]),S=M(!1),$=M(!1),V=M(""),F=M("desktop"),x=M(null),Q=()=>{S.value=!0,$.value=!0,V.value="",ue.post("email-notification/preview",{notification_name:i.value,block_content:c.value.settings.email_body||""}).then(G=>{V.value=G.html,$.value=!1,ke(()=>D())}).catch(G=>{var te;z.error(((te=G.data)==null?void 0:te.message)||"Failed to generate preview"),S.value=!1,$.value=!1})},D=()=>{const G=x.value;if(!G||!V.value)return;const te=G.contentDocument||G.contentWindow&&G.contentWindow.document;te&&(te.open(),te.write(V.value),te.close())},T=()=>{ke(()=>{V.value&&D()})},U=()=>{S.value=!1,V.value="",F.value="desktop"},I=M(""),O=M(!1),L=()=>{var te;const G=(te=c.value)==null?void 0:te.template_path;!G||I.value||(O.value=!0,ue.post("email-notification/preview-default-template",{template:G}).then(ne=>{var re;I.value=((re=ne.data)==null?void 0:re.content)||""}).catch(()=>{}).finally(()=>{O.value=!1}))};be(()=>c.value.settings.is_default_body,G=>{G==="yes"&&!I.value&&L()});const P=G=>{c.value.settings.subject+=G},q=()=>{l.value=!0,ue.get("email-notification/"+i.value).then(G=>{var ne;c.value=G.data,f.value=G.shortcodes,k.value=G.has_fluent_pdf||!1,w.value=G.pdf_templates||[];const te=((ne=c.value.settings.extra)==null?void 0:ne[i.value])||{};_.value=y(c.value.extra_fields,te),c.value.settings.is_default_body==="yes"&&L()}).catch(G=>{var te;G.status_code=="422"?z.validationErrors(G):z.error((te=G.data)==null?void 0:te.message)}).finally(()=>{l.value=!1})},X=()=>{s.value=!0;const G=JSON.parse(JSON.stringify(c.value)),te=v();te&&(G.settings.extra=te),G.settings.is_default_body==="no"&&p.value&&p.value.forceAutosave(),ue.put("email-notification/"+i.value,G).then(ne=>{z.success(ne.message)}).catch(ne=>{var re;ne.status_code=="422"?z.validationErrors(ne):z.error((re=ne.data)==null?void 0:re.message)}).finally(()=>{s.value=!1})};return Ie(()=>{q()}),(G,te)=>{var tt;const ne=C("el-breadcrumb-item"),re=C("el-breadcrumb"),K=C("el-skeleton-item"),Y=C("el-skeleton"),W=C("el-switch"),j=C("el-input"),ie=C("el-form-item"),he=C("el-form"),me=C("el-option"),ye=C("el-select"),se=C("el-button"),fe=C("el-drawer"),$e=Ma("loading");return r(),h("div",$J,[n(Qa,{loading:s.value,"loading-text":A(u)("Updating"),"save-button-text":A(u)("Update"),onOnSave:X},{heading:d(()=>[n(re,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(ne,{to:{path:"/settings/email_notifications"}},{default:d(()=>[R(m(G.$t("Email Notifications")),1)]),_:1}),n(ne,null,{default:d(()=>[o("span",EJ,m(c.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",UJ,[n(Da),l.value?(r(),E(Y,{key:0,animated:""},{template:d(()=>[o("div",IJ,[o("div",QJ,[n(K,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",DJ,m(A(u)("Enable this email notification!")),1)])]),o("div",VJ,[o("div",TJ,[o("label",MJ,m(A(u)("Email Subject")),1),n(K,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",LJ,[o("label",RJ,m(A(u)("Email Body Type")),1),n(K,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",OJ,m(A(u)("Email Body")),1),n(pr)])])]),_:1})):B("",!0),l.value?B("",!0):(r(),h(H,{key:1},[o("div",HJ,[((tt=c.value)==null?void 0:tt.manage_toggle)!=="no"?(r(),h("div",PJ,[n(W,{modelValue:c.value.settings.active,"onUpdate:modelValue":te[0]||(te[0]=ve=>c.value.settings.active=ve),"active-value":"yes","inactive-value":"no","active-text":A(u)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",NJ,m(A(u)("Auto-enabled for offline payments")),1))]),n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(he,{"label-position":"top"},{default:d(()=>[n(ie,{label:A(u)("Email Subject")},{default:d(()=>[n(j,{modelValue:c.value.settings.subject,"onUpdate:modelValue":te[1]||(te[1]=ve=>c.value.settings.subject=ve),autocomplete:"rutjfkde",class:de({"is-focus":b.value}),onFocus:te[2]||(te[2]=ve=>b.value=!0),onBlur:te[3]||(te[3]=ve=>b.value=!1),label:A(u)("Email Subject")},{append:d(()=>[n(eA,{data:f.value,onCommand:P,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:d(()=>[R(m(A(u)("Add ShortCodes")),1)]),_:1},8,["data"])]),_:1},8,["modelValue","class","label"])]),_:1},8,["label"]),n(ie,{label:A(u)("Email Body Type")},{default:d(()=>[o("div",KJ,[o("button",{type:"button",class:de(["fct-seg-btn",{active:c.value.settings.is_default_body==="yes"}]),onClick:te[4]||(te[4]=ve=>c.value.settings.is_default_body="yes")},[te[13]||(te[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(" "+m(A(u)("Default Body")),1)],2),o("button",{type:"button",class:de(["fct-seg-btn",{active:c.value.settings.is_default_body==="no"}]),onClick:te[5]||(te[5]=ve=>c.value.settings.is_default_body="no")},[te[14]||(te[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(" "+m(A(u)("Customized Body"))+" ",1),A(t)?B("",!0):(r(),E(J,{key:0,name:"Crown",class:"fct-pro-icon",style:{"margin-left":"4px",display:"inline-flex"}}))],2)])]),_:1},8,["label"]),c.value.settings.is_default_body==="yes"?(r(),h("div",GJ,[o("label",jJ,m(A(u)("Email Body")),1),O.value?(r(),E(pr,{key:0})):I.value?(r(),h("div",zJ,[n(wo,{type:"warning",class:"mb-3","show-icon":"",description:A(u)("The preview shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("iframe",{srcdoc:I.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,qJ)])):B("",!0)])):B("",!0),c.value.settings.is_default_body==="no"&&!l.value?(r(),E(FJ,{key:1,"min-version":"1.3.15",placement:"feature_lock_email_templates","feature-title":A(u)("Custom Email Templates"),"feature-text":A(u)("Design beautiful email templates with a drag-and-drop block editor, shortcodes, and conditional content.")},{default:d(()=>[n(ie,{label:A(u)("Email Body")},{default:d(()=>[n(wo,{class:"mb-3",type:"warning","show-icon":"",description:A(u)("Shortcodes/Blocks shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),n(iA,{ref_key:"editorFrameRef",ref:p,editorParams:{block_type:"template",campaign_title:c.value.settings.subject,bid:c.value.name},frameHeight:"calc(100vh - 60px)",documentTitle:c.value.settings.subject,onTitleUpdated:te[6]||(te[6]=ve=>{c.value.settings.subject=ve}),onPreviewRequest:Q,modelValue:c.value.settings.email_body,"onUpdate:modelValue":te[7]||(te[7]=ve=>c.value.settings.email_body=ve)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):B("",!0)]),_:1})]),_:1})]),_:1}),(r(!0),h(H,null,ae(_.value,ve=>(r(),E(Be,{key:ve.form_key,class:"mt-4"},{default:d(()=>[n(Ce,null,{default:d(()=>[ve.title?(r(),h("h3",YJ,m(ve.title),1)):B("",!0),ve.sub_title?(r(),h("p",WJ,m(ve.sub_title),1)):B("",!0),n(Sp,{schema:ve.schema,values:ve.values,form_name:ve.form_key,ref_for:!0,ref_key:"extraFormRefs",ref:g},null,8,["schema","values","form_name"])]),_:2},1024)]),_:2},1024))),128))],64)),k.value&&w.value.length?(r(),h("div",JJ,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(he,{"label-position":"top"},{default:d(()=>[n(ie,{label:A(u)("Attach PDF Template")},{default:d(()=>[n(ye,{modelValue:c.value.settings.attach_pdf_template,"onUpdate:modelValue":te[8]||(te[8]=ve=>c.value.settings.attach_pdf_template=ve),placeholder:A(u)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:d(()=>[(r(!0),h(H,null,ae(w.value,ve=>(r(),E(me,{key:ve.id,label:ve.title,value:ve.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):B("",!0),o("div",XJ,[n(se,{onClick:X,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(m(A(u)("Update")),1)]),_:1},8,["disabled","loading"])])]),n(fe,{modelValue:S.value,"onUpdate:modelValue":te[12]||(te[12]=ve=>S.value=ve),direction:"rtl",size:"70%",title:A(u)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:T},{footer:d(()=>[n(se,{onClick:U},{default:d(()=>[R(m(A(u)("Close")),1)]),_:1})]),default:d(()=>[$.value?qt((r(),h("div",ZJ,null,512)),[[$e,!0]]):B("",!0),!$.value&&V.value?(r(),h(H,{key:1},[o("div",eX,[o("div",tX,[o("button",{type:"button",class:de(["fct-device-btn",{active:F.value==="desktop"}]),onClick:te[9]||(te[9]=ve=>F.value="desktop")},[te[15]||(te[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,m(A(u)("Desktop")),1)],2),o("button",{type:"button",class:de(["fct-device-btn",{active:F.value==="tablet"}]),onClick:te[10]||(te[10]=ve=>F.value="tablet")},[te[16]||(te[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,m(A(u)("Tablet")),1)],2),o("button",{type:"button",class:de(["fct-device-btn",{active:F.value==="mobile"}]),onClick:te[11]||(te[11]=ve=>F.value="mobile")},[te[17]||(te[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,m(A(u)("Mobile")),1)],2)])]),n(wo,{class:"mb-3",type:"warning","show-icon":"",description:A(u)("The preview shown here uses sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("div",{class:de(["fct-preview-stage","fct-preview-stage--"+F.value])},[o("div",{class:de(["fct-device-frame","fct-device-frame--"+F.value])},[o("iframe",{ref_key:"previewIframe",ref:x,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):B("",!0)]),_:1},8,["modelValue","title"])])}}},lX={name:"StorageSettings",components:{Badge:ma,CardBody:Ce,CardContainer:Be,SettingsHeader:Qa,AdminNotice:Da,DynamicIcon:J},props:["settings"],data(){return{loading:!1,availableDrivers:[]}},mounted(){this.getStorageDrivers()},methods:{translate:u,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})}}},sX={class:"setting-wrap"},nX={class:"setting-wrap-inner"},oX={key:0,class:"storage-setting-list fct-content-card-list"},iX=["role","tabindex","aria-label","onClick","onKeydown"],rX={class:"flex items-start gap-3"},dX=["src","alt"],uX=["src","alt"],cX={class:"flex-1 min-w-0 pl-15"},AX={class:"fct-content-card-list-head"},pX={class:"title-wrap"},fX={class:"fct-content-card-list-content"};function mX(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-skeleton"),_=C("Badge"),g=C("el-switch"),y=C("DynamicIcon"),v=C("el-button"),b=C("CardBody"),k=C("CardContainer");return r(),h("div",sX,[n(c,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",nX,[n(p),n(k,null,{default:d(()=>[n(b,null,{default:d(()=>[n(f,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?B("",!0):(r(),h("div",oX,[(r(!0),h(H,null,ae(s.availableDrivers,(w,S)=>(r(),h("div",{key:w.route||S,class:de(["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:$=>i.handleDriverAction(w),onKeydown:[xa(Ne($=>i.handleDriverAction(w),["prevent"]),["enter"]),xa(Ne($=>i.handleDriverAction(w),["prevent"]),["space"])]},[o("div",rX,[o("div",{class:de(`fct-content-card-list-icon ${w.title.toLowerCase()}`)},[o("img",{class:de({"dark:hidden":i.getDarkLogo(w.dark_logo)}),src:i.getLogo(w.logo),alt:w.title},null,10,dX),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,uX)):B("",!0)],2),o("div",cX,[o("div",AX,[o("div",pX,[o("h6",null,m(w.title),1)]),n(_,{size:"small",status:w.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",fX,[o("p",null,m(w.description),1)])]),i.canToggle(w)?(r(),h("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=Ne(()=>{},["stop"])),onKeydown:t[1]||(t[1]=Ne(()=>{},["stop"]))},[n(g,{modelValue:w.is_active_input,"onUpdate:modelValue":$=>w.is_active_input=$,"active-value":"yes","inactive-value":"no",loading:w.saving,"aria-label":i.getToggleLabel(w),onChange:$=>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]=Ne(()=>{},["stop"])),onKeydown:t[3]||(t[3]=Ne(()=>{},["stop"]))},[n(v,{type:"primary",class:"el-button--x-small",tag:"a",href:w.upgrade_url,target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[n(y,{name:"Crown"}),R(" "+m(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]=Ne(()=>{},["stop"])),onKeydown:t[5]||(t[5]=Ne(()=>{},["stop"]))},[n(v,{class:"el-button--x-small",onClick:$=>i.handleDriverAction(w)},{default:d(()=>[R(m(i.translate("Manage")),1)]),_:2},1032,["onClick"])],32)):B("",!0)])],42,iX))),128))]))]),_:1})]),_:1})])])}const hX=lt(lX,[["render",mX]]),_X={class:"fct-setting-header"},vX={key:0,class:"fct-setting-header-action"},gX={class:"setting-wrap-inner"},cc={__name:"GlobalStorageComponents",setup(e){const t=M({}),a=M(""),l=M({}),s=M(!1),i=M(!1),c=M(""),p=_d(),f=M({}),_=N(()=>!!a.value),g=sl(),y=vs(),v=()=>{i.value=!0,ue.get("settings/storage-drivers/"+c.value).then(w=>{t.value=w.settings||{},a.value=w.template||"",l.value=w.template_payload||{},f.value={},w.template||p.setSchema(w.fields).setDefaults(w.settings).initForm()}).catch(w=>{var S;t.value={},a.value="",l.value={},f.value={},p.setSchema({}).setDefaults({}),z.error(((S=w==null?void 0:w.data)==null?void 0:S.message)||u("Failed to load storage settings."))}).finally(()=>{i.value=!1})},b=()=>{if(_.value)return;let w=p.values;s.value=!0,ue.post("settings/storage-drivers",{settings:{...w},driver:c.value}).then(S=>{var $;t.value.is_active=($=S.data)==null?void 0:$.is_active,z.success(S.message||u("Storage Settings updated!")),p.values=S.data,S.data.shouldReload&&v()}).catch(S=>{var $;S.status_code=="422"?z.validationErrors(S):z.error(($=S.data)==null?void 0:$.message)}).finally(()=>{s.value=!1})},k=()=>{c.value=g.name};return be(g,(w,S)=>{k(),v()}),y.onSave(()=>{_.value||b()}),Ie(()=>{k(),v()}),(w,S)=>{const $=C("el-breadcrumb-item"),V=C("el-breadcrumb"),F=C("el-button"),x=C("el-skeleton");return r(),h("div",{class:de(["setting-wrap",c.value])},[o("div",_X,[n(V,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n($,{to:{name:"storage"}},{default:d(()=>[R(m(A(u)("Storage Providers")),1)]),_:1}),A(ca).headline(c.value)?(r(),E($,{key:0},{default:d(()=>[R(m(A(ca).headline(c.value)),1)]),_:1})):B("",!0)]),_:1},8,["separator-icon"]),_.value?B("",!0):(r(),h("div",vX,[n(F,{type:"primary",onClick:b,loading:s.value,disabled:s.value||i.value,size:"small"},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading","disabled"])]))]),o("div",gX,[n(Da),i.value?(r(),E(Be,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(x,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(H,{key:1},[_.value?(r(),E(Fp,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:c.value}},null,8,["widget","data"])):(r(),E(ki,{key:1,form:A(p),showSubmitButton:!1,loading:s.value,onOnChange:S[0]||(S[0]=Q=>{}),"validation-errors":f.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},yX=["innerHTML"],bX={class:"fct-select-template-wrap"},wX={class:"fct-select-template-wrap flex gap-2 flex-row"},CX={class:"setting-save-action"},kX={__name:"AddEmailNotification",setup(e){const t=Yt().ctx,a=M(),l=M(!0),s=M(!1),i=M({}),c=M(),p=M([{label:u("After Order Created"),value:"fluent_cart/order_created"},{label:u("After Order Updated"),value:"fluent_cart/order_updated"},{label:u("After Payment Paid"),value:"fluent_cart/order_paid"},{label:u("After User Created"),value:"fluent_cart/user_created"},{label:u("After Refund made"),value:"fluent_cart/order_refunded"}]),f=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({});ll(),sl();let v=null;const b=M([]),k=M([]),w=M({});vs().onSave(()=>{x()});const $=O=>{const L=O;t.$post("email-notification/getTemplate/",{template:L}).then(P=>{var q;i.value.content=P.data.content,(q=a.value)==null||q.setContent(i.value.content)}).catch(P=>{}).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=>{f.value=O.data.shortcodes,g.value=O.data.email_templates,y.value=Object.keys(O.data.buttons).map(L=>({[L]:O.data.buttons[L]}))}).catch(O=>{}).finally(()=>{l.value=!1})},x=O=>{O&&O.preventDefault(),w.value={},l.value=!0,t.$post("email-notification/create",i.value).then(L=>{t.handleSuccess(L)}).catch(L=>{var P;L.status_code=="422"?(z.validationErrors(L),w.value=L.data):z.error((P=L.data)==null?void 0:P.message)}).finally(()=>{l.value=!1})},Q=()=>{s.value=!0,c.value=i.value.content};Ie(()=>{F()});const D=O=>{v=O},T=O=>{w.value&&w.value.hasOwnProperty(O)&&delete w.value[O]},U=()=>{i.value.to=b.value},I=()=>{i.value.from=k.value};return(O,L)=>{const P=C("el-dialog"),q=C("el-input"),X=C("el-form-item"),G=C("el-option"),te=C("el-select"),ne=C("el-col"),re=C("el-row"),K=C("el-tooltip"),Y=C("el-button"),W=C("el-form");return r(),E(Be,null,{default:d(()=>[n(Qe,{title:i.value.title?i.value.title:A(u)("Add Notification"),title_size:"small",border_bottom:"",icon:"Message"},{action:d(()=>L[20]||(L[20]=[])),_:1},8,["title"]),n(Ce,null,{default:d(()=>[n(P,{modelValue:s.value,"onUpdate:modelValue":L[0]||(L[0]=j=>s.value=j),title:O.$t("Preview")},{default:d(()=>[o("div",{innerHTML:c.value},null,8,yX)]),_:1},8,["modelValue","title"]),n(W,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(X,{label:O.$t("Notification Name"),required:""},{default:d(()=>{var j,ie;return[n(q,{modelValue:i.value.title,"onUpdate:modelValue":L[1]||(L[1]=he=>i.value.title=he),onFocus:L[2]||(L[2]=he=>T("title"))},null,8,["modelValue"]),n(fl,{"validation-errors":(ie=(j=w.value)==null?void 0:j.title)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(X,{label:O.$t("Select notification event"),required:""},{default:d(()=>{var j,ie;return[n(te,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":L[3]||(L[3]=he=>i.value.events=he),placeholder:O.$t("Select Events"),onFocus:L[4]||(L[4]=he=>T("events")),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(p.value,he=>(r(),E(G,{key:he.value,label:he.label,value:he.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(ie=(j=w.value)==null?void 0:j.events)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(re,{gutter:15},{default:d(()=>[n(ne,{lg:12},{default:d(()=>[n(X,{label:O.$t("Mail From:"),required:""},{default:d(()=>{var j,ie;return[n(q,{modelValue:i.value.from,"onUpdate:modelValue":L[7]||(L[7]=he=>i.value.from=he),onFocus:L[8]||(L[8]=he=>T("from")),placeholder:O.$t("Select a Field or Type Custom Value")},{append:d(()=>[n(te,{modelValue:k.value,"onUpdate:modelValue":L[5]||(L[5]=he=>k.value=he),onChange:L[6]||(L[6]=he=>I()),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,he=>(r(),E(G,{key:he.value,label:he.label,value:he.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(ie=(j=w.value)==null?void 0:j.from)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(ne,{lg:12},{default:d(()=>[n(X,{label:O.$t("Send Mail To:"),required:""},{default:d(()=>{var j,ie;return[n(q,{modelValue:i.value.to,"onUpdate:modelValue":L[11]||(L[11]=he=>i.value.to=he),onFocus:L[12]||(L[12]=he=>T("to"))},{append:d(()=>[n(te,{modelValue:b.value,"onUpdate:modelValue":L[9]||(L[9]=he=>b.value=he),onChange:L[10]||(L[10]=he=>U()),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,he=>(r(),E(G,{key:he.value,label:he.label,value:he.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),n(fl,{"validation-errors":(ie=(j=w.value)==null?void 0:j.to)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),n(X,{label:O.$t("Cc:")},{default:d(()=>[n(q,{modelValue:i.value.cc,"onUpdate:modelValue":L[13]||(L[13]=j=>i.value.cc=j)},null,8,["modelValue"])]),_:1},8,["label"]),n(X,{label:O.$t("Mail Subject:"),required:""},{default:d(()=>{var j,ie;return[n(q,{modelValue:i.value.subject,"onUpdate:modelValue":L[14]||(L[14]=he=>i.value.subject=he),onFocus:L[15]||(L[15]=he=>T("subject"))},null,8,["modelValue"]),n(fl,{"validation-errors":(ie=(j=w.value)==null?void 0:j.subject)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o("div",null,[n(es,{ref_key:"wpEditor",ref:a,"short-codes":f.value,buttons:y.value,onOnEditorReady:D,onUpdate:L[18]||(L[18]=j=>{i.value.content=j}),modelValue:i.value.content,"onUpdate:modelValue":L[19]||(L[19]=j=>i.value.content=j)},{action:d(()=>[o("div",bX,[n(te,{onChange:L[16]||(L[16]=j=>{var ie;(ie=a.value)==null||ie.setContent(j)}),placeholder:O.$t("Select button"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(y.value,(j,ie)=>(r(),E(G,{key:ie,label:Object.keys(j)[0],value:Object.values(j)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",wX,[n(te,{onChange:L[17]||(L[17]=j=>{$(j)}),placeholder:O.$t("Select template"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(g.value,(j,ie)=>(r(),E(G,{key:ie,label:j.label,value:j.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),o("span",null,[n(K,{effect:"dark",content:O.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{onClick:Ne(V,["prevent"]),tag:"button"},{default:d(()=>[n(J,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:d(()=>[A(v)!==null?(r(),E(K,{key:0,effect:"dark",content:O.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{onClick:Ne(Q,["prevent"]),tag:"button"},{default:d(()=>[n(J,{name:"Eye"})]),_:1})]),_:1},8,["content"])):B("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",CX,[n(Y,{onClick:x,type:"primary",disabled:l.value,loading:l.value},{default:d(()=>[R(m(O.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class BX extends Qs{getTabs(){return{all:u("All"),success:u("Success"),warning:u("Warning"),error:u("Error"),failed:u("Failed"),info:u("Info"),api:u("API Only")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Content",value:"content"},{label:"Date",value:"date"},{label:"Actions",value:"actions"}]}getSearchHint(){return u("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 xX(e){return BX.init(e)}const SX={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},FX={class:"fct-table-mobile-header"},$X={class:"fct-table-date-col"},EX={class:"mark-read-unread-wrap"},UX=["onClick","title"],IX=["onClick","title"],QX=["title"],DX={class:"fct-table-mobile-body"},VX={key:0,class:"fct-table-title-col"},TX={key:1,class:"fct-table-content-col"},MX={class:"fct-table-mobile-footer"},LX={class:"fct-table-mobile-footer-row"},RX={class:"fct-table-status-col"},OX={class:"title"},HX={class:"fct-table-module-col"},PX={class:"title"},NX={class:"value"},KX={key:0,class:"fct-table-actions-col"},GX={class:"title"},jX={__name:"LogsTableMobile",props:{table:{type:Object}},emits:["changeStatus"],setup(e,{emit:t}){const a=t,l=(s,i)=>{a("changeStatus",s,i)};return(s,i)=>{const c=C("el-icon"),p=C("router-link");return r(),h("div",SX,[(r(!0),h(H,null,ae(e.table.getTableData(),(f,_)=>(r(),h("div",{key:f.id,class:"fct-table-mobile-row"},[o("div",FX,[o("div",$X,[o("div",EX,[f.read_status!=="unread"?(r(),h("span",{key:0,onClick:g=>l(f,"unread"),title:A(u)("Mark as unread")},[n(c,null,{default:d(()=>[n(A(Eo))]),_:1})],8,UX)):(r(),h("span",{key:1,onClick:g=>l(f,"read"),title:A(u)("Mark as read")},[n(c,null,{default:d(()=>[n(A(ni))]),_:1})],8,IX))]),o("div",{title:A(u)("Logs ID: %s",f.id),class:"invoice-no"}," #"+m(f.id),9,QX),e.table.isColumnVisible("date")?(r(),h(H,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),n(Na,{class:"date","date-time":f.created_at,"with-time":!0},null,8,["date-time"])],64)):B("",!0)])]),o("div",DX,[e.table.isColumnVisible("title")?(r(),h("div",VX,m(f.title),1)):B("",!0),e.table.isColumnVisible("content")?(r(),h("div",TX,m(f.content),1)):B("",!0)]),o("div",MX,[o("div",LX,[o("div",RX,[o("div",OX,m(A(u)("Status")),1),(r(),E(ma,{status:f.status,size:"small",key:f.id},null,8,["status"]))]),o("div",HX,[o("div",PX,m(A(u)("Module")),1),o("div",NX,m(f.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",KX,[o("div",GX,m(A(u)("Actions")),1),f.module_id&&f.module_name.toLowerCase()==="order"?(r(),E(p,{key:0,class:"value",to:{name:"view_order",params:{order_id:f.module_id}}},{default:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):B("",!0),f.module_id&&f.module_name.toLowerCase()==="subscription"?(r(),E(p,{key:1,class:"value",to:{name:"view_subscription",params:{subscription_id:f.module_id}}},{default:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):B("",!0)])):B("",!0)])])]))),128))])}}},zX={},qX={class:"px-4 py-3"},YX={class:"grid grid-cols-3 gap-5 mt-5"};function WX(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",qX,[(r(),h(H,null,ae(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",YX,[(r(),h(H,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const JX=lt(zX,[["render",WX]]),XX={class:"table-cell"},ZX={class:"table-cell"},eZ={class:"table-cell"},tZ={class:"table-cell"},aZ={class:"table-cell"},lZ={class:"table-cell"},sZ={class:"table-cell"},nZ={__name:"LogsLoader",props:{nextPageCount:{type:Number,default:0},logTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-skeleton"),p=C("el-table-column"),f=C("el-table");return r(),E(f,{data:A(a),class:"w-full compact-table full-compact"},{default:d(()=>[n(p,{width:143,label:A(u)("ID")},{default:d(()=>[o("div",XX,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(r(),E(p,{key:0,label:A(u)("Date"),width:172},{default:d(()=>[o("div",ZX,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.logTable.isColumnVisible("title")?(r(),E(p,{key:1,label:A(u)("Title"),width:287},{default:d(()=>[o("div",eZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.logTable.isColumnVisible("content")?(r(),E(p,{key:2,label:A(u)("Content"),width:287},{default:d(()=>[o("div",tZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(p,{label:A(u)("Status"),width:143},{default:d(()=>[o("div",aZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Module"),width:143},{default:d(()=>[o("div",lZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(r(),E(p,{key:3,label:A(u)("Actions"),width:114},{default:d(()=>[o("div",sZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},oZ={class:"fct-all-logs-page fct-layout-width"},iZ={key:1},rZ={class:"inline-flex items-center gap-1"},dZ=["onClick","title"],uZ=["onClick","title"],cZ={__name:"Logs",setup(e){const t=Yt().ctx,a=xX(),l=M([]),s=(i,c)=>{t.$put("activity/"+i.id+"/mark-read",{id:i.id,status:c}).then(p=>{l.value.find(f=>f.id===i.id).read_status=c,t.handleSuccess(p)}).catch(p=>{var f;p.status_code=="422"?z.validationErrors(p):z.error((f=p.data)==null?void 0:f.message)})};return a.onDataLoaded(function(){l.value=a.getTableData()}),(i,c)=>{const p=C("el-icon"),f=C("el-table-column"),_=C("el-button"),g=C("el-table");return r(),h("div",oZ,[n(nl,{title:A(u)("Logs")},null,8,["title"]),n(Ds,{table:A(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(a).isLoading()?(r(),E(JX,{key:0})):B("",!0),A(a).isLoading()?B("",!0):(r(),E(jX,{key:1,table:A(a),onChangeStatus:s},null,8,["table"]))]),default:d(()=>[A(a).isLoading()?(r(),E(nZ,{key:0,logTable:A(a),"next-page-count":A(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",iZ,[n(g,{class:"w-full",data:A(a).getTableData()},{empty:d(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any logs matching your filter.")},null,8,["text"])]),default:d(()=>[n(f,{label:A(u)("ID"),width:100},{default:d(y=>[o("div",rZ,[y.row.read_status!=="unread"?(r(),h("span",{key:0,onClick:v=>s(y.row,"unread"),title:A(u)("Mark as unread"),class:"cursor-pointer"},[n(p,null,{default:d(()=>[n(A(Eo))]),_:1})],8,dZ)):(r(),h("span",{key:1,onClick:v=>s(y.row,"read"),title:A(u)("Mark as read"),class:"cursor-pointer"},[n(p,null,{default:d(()=>[n(A(ni))]),_:1})],8,uZ)),R(" #"+m(A(ta)(y.row.id)),1)])]),_:1},8,["label"]),A(a).isColumnVisible("date")?(r(),E(f,{key:0,label:A(u)("Date"),width:120},{default:d(y=>[n(Na,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):B("",!0),A(a).isColumnVisible("title")?(r(),E(f,{key:1,label:A(u)("Title"),width:200},{default:d(y=>[R(m(y.row.title),1)]),_:1},8,["label"])):B("",!0),A(a).isColumnVisible("content")?(r(),E(f,{key:2,label:A(u)("Content"),width:200},{default:d(y=>[R(m(y.row.content),1)]),_:1},8,["label"])):B("",!0),n(f,{label:A(u)("Status"),width:100},{default:d(y=>[(r(),E(ma,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),n(f,{label:A(u)("Module"),width:100},{default:d(y=>[R(m(y.row.module_name),1)]),_:1},8,["label"]),A(a).isColumnVisible("actions")?(r(),E(f,{key:3,label:A(u)("Actions"),width:80},{default:d(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:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):B("",!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:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},AZ=["title"],pZ={__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,s=()=>{l("remove",{filterKey:a.filterKey,itemId:a.itemId})};return(i,c)=>(r(),h("button",{class:"fct-applied-filter-remove",onClick:s,title:i.$t("Remove")},[n(J,{name:"Close"})],8,AZ))}},fZ={__name:"StatusFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const a=e.filterState;return(l,s)=>{const i=C("el-option"),c=C("el-select");return r(),E(c,{modelValue:A(a).data.selectedFilters[e.filterItemKey].value,"onUpdate:modelValue":s[0]||(s[0]=p=>A(a).data.selectedFilters[e.filterItemKey].value=p),placeholder:l.$t("Select Status"),filterable:"",onChange:A(a).applyFilterChange,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(H,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"])}}},af={__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,s=a.filterState,i=M(null),c=N({get:()=>a.modelValue,set:g=>l("update:modelValue",g)}),p=N(()=>Ge.get("app_config.isProActive"));function f(g){l("change",g)}function _(){s.data.dateRange=[pa.withTimezone(et().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),pa.withTimezone(et().format("YYYY-MM-DD 23:59:59"))],l("change",s.data.dateRange)}return vl(()=>{}),(g,y)=>{const v=C("el-date-picker"),b=Ma("translate-numbers");return r(),h("div",{class:de(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[qt(n(v,{ref_key:"datePickerRef",ref:i,modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=k=>c.value=k),type:e.type,"range-separator":e.separator,"start-placeholder":e.startPlaceholder||A(u)("Start date"),"end-placeholder":e.endPlaceholder||A(u)("End date"),"unlink-panels":e.unlinkPanels,clearable:e.clearable,shortcuts:A(Zc),onChange:f,placement:e.placement,disabled:e.disabled||!p.value},null,8,["modelValue","type","range-separator","start-placeholder","end-placeholder","unlink-panels","clearable","shortcuts","placement","disabled"]),[[b,"translate-numbers"]]),e.showArrow?(r(),E(J,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):B("",!0),p.value&&e.clearable?(r(),E(J,{key:1,onClick:_,name:"CircleClose",class:"fct-applied-filter-clear-all"})):B("",!0)],2)}}},lf={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=N({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=c=>{l("change",c)};return(c,p)=>{const f=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),placeholder:c.$t("Select Currency"),filterable:"",onChange:i,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(H,null,ae(e.currencies,(g,y)=>(r(),E(f,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},mZ={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("button",{onClick:s[0]||(s[0]=(...i)=>A(a).resetFilters&&A(a).resetFilters(...i)),class:"reset-filters-btn"},m(l.$t("Reset Filters")),1))}},hZ={__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=N({get:()=>{var s;return((s=a.data.selectedFilters[t.filterItemKey])==null?void 0:s.value)??[]},set:s=>{a.setMultiSelectChange(t.filterItemKey,s)}});return(s,i)=>{const c=C("el-option"),p=C("el-select");return r(),E(p,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=f=>l.value=f),placeholder:s.$t("Select Order Type"),multiple:"",filterable:"","popper-class":"fct-dropdown-compact fct-multi-select-filter",size:"small"},{default:d(()=>[(r(!0),h(H,null,ae(e.filterItem.options,f=>(r(),E(c,{key:f.value,label:f.label,value:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},_Z={class:"fct-compare-to-filter"},vZ={class:"fct-applied-filter-label"},gZ={class:"fct-applied-filter-actions"},yZ={class:"fct-compare-to-select"},bZ={class:"fct-compare-to-date"},wZ={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=N({get:()=>{var f;return((f=s.data.selectedFilters.compareType)==null?void 0:f.value)??s.data.compareType},set:f=>{s.setCompareTypeChange(f),l("selectChange",f)}}),c=N({get:()=>{var f;return((f=s.data.selectedFilters.compareDate)==null?void 0:f.value)??s.data.compareDate},set:f=>{s.setCompareDateChange(f),l("dateChange",f)}}),p=N(()=>Ge.get("app_config.isProActive"));return(f,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-date-picker");return r(),h("div",_Z,[o("div",vZ,m(A(u)("Compare to")),1),o("div",gZ,[o("div",yZ,[n(y,{modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=b=>i.value=b),"popper-class":"fct-dropdown-compact",disabled:!p.value},{default:d(()=>[n(g,{label:A(u)("Previous Period"),value:"previous_period"},null,8,["label"]),n(g,{label:A(u)("Previous Month"),value:"previous_month"},null,8,["label"]),n(g,{label:A(u)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),n(g,{label:A(u)("Previous Year"),value:"previous_year"},null,8,["label"]),n(g,{label:A(u)("Custom"),value:"custom"},null,8,["label"]),n(g,{label:A(u)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),o("div",bZ,[i.value==="custom"?(r(),E(v,{key:0,modelValue:c.value,"onUpdate:modelValue":_[1]||(_[1]=b=>c.value=b),type:"date",size:"small",placeholder:A(u)("Select Date")},null,8,["modelValue","placeholder"])):B("",!0)])])])}}},CZ={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},kZ={key:0},sf={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,l=M([]),s=M([]),i=M(!1),c=Yt().ctx;let p=0;const f=k=>{const w=Qt.get("product_variations");w&&(l.value=w);const S=++p;if(l.value.length&&!k){s.value=[...l.value],i.value=!1;return}i.value=!0,c.$get("products/searchVariantByName",{name:k}).then($=>{S===p&&(s.value=$,k||(l.value=$,Qt.set("product_variations",$)))}).catch(()=>{}).finally(()=>{S===p&&(i.value=!1)})},_=id.debounce(f),g=(k,w)=>{const S=w.checkedNodes||[],$={};[...S,...w.halfCheckedNodes||[]].forEach(V=>{(V.children||[]).forEach(F=>{$[F.value]=V.label})}),a.setTreeSelectItem(S.map(V=>({...V,productName:$[V.value]})))},y=k=>{a.removeTreeSelectItem(k)},v=()=>{a.clearTreeSelect()},b=N(()=>{var S;const k=((S=a.data.selectedFilters.variation_ids)==null?void 0:S.value)||[];let w={};return k.forEach($=>{const V=$.productName||"Unknown";w[V]||(w[V]=[]),w[V].push($.label||$.id)}),w});return Ie(()=>{const k=a.retrieveSavedReportFilters();k&&k.variation_ids&&(a.data.variation_ids=k.variation_ids),f("")}),(k,w)=>{const S=C("el-tag"),$=C("el-tree-select");return r(),E($,{placeholder:k.$t("Select Products"),modelValue:A(a).data.variation_ids,"onUpdate:modelValue":w[0]||(w[0]=V=>A(a).data.variation_ids=V),data:s.value,"filter-method":A(_),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:i.value,onCheck:g,"popper-class":"fct-tooltip-long",onRemoveTag:y,onClear:v,size:"small"},{tag:d(()=>[o("div",CZ,[(r(!0),h(H,null,ae(b.value,(V,F)=>(r(),E(S,{style:{"margin-right":"4px"}},{default:d(()=>[R(m(F)+" ",1),V.length?(r(),h("span",kZ," | "+m(V.join(", ")),1)):B("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},BZ={class:"fct-applied-filters-wrap"},xZ={class:"fct-applied-filter-list"},SZ={class:"fct-applied-filter fct-applied-filter-date"},FZ={class:"fct-applied-filter-label"},$Z={class:"fct-applied-filter-value"},EZ={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},UZ={class:"fct-applied-filter-label"},IZ={class:"fct-applied-filter-value"},QZ={key:2,class:"fct-applied-filter-clear-wrap"},DZ={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=sl(),s=({filterKey:f,itemId:_})=>{a.removeFilter(f,_)},i=f=>!(["dateRange","compareType","compareDate"].includes(f)||l.name==="reports_customer"||l.name==="reports_sources"),c=N(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(l.name)),p=N(()=>Object.keys(a.data.selectedFilters).filter(f=>!(f==="orderTypes"&&l.name==="reports_subscriptions")).reduce((f,_)=>(f[_]=a.data.selectedFilters[_],f),{}));return be(a.data.dateRange,f=>{}),(f,_)=>(r(),h("div",BZ,[o("ul",xZ,[o("li",SZ,[o("div",FZ,m(f.$t("Date:")),1),o("div",$Z,[n(af,{modelValue:A(a).data.dateRange,"onUpdate:modelValue":_[0]||(_[0]=g=>A(a).data.dateRange=g),placement:"bottom-start",reRenderDate:A(a).data.reRenderDate,showArrow:!0,size:"small",onChange:A(a).setDateRange,clearable:"",filterState:A(a)},null,8,["modelValue","reRenderDate","onChange","filterState"])])]),c.value?(r(),h("li",EZ,[n(wZ,{filterState:A(a)},null,8,["filterState"])])):B("",!0),Object.keys(p.value).length?(r(!0),h(H,{key:1},ae(p.value,(g,y)=>(r(),h(H,{key:y},[i(y)?(r(),h("li",{key:0,class:de(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",UZ,m(g.label)+":",1),o("div",IZ,[g.type==="list"?(r(),E(fZ,{key:0,"filter-state":A(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):B("",!0),g.type==="multi-list"?(r(),E(hZ,{key:1,"filter-state":A(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):y==="variation_ids"?(r(),E(sf,{key:2,"filter-state":A(a)},null,8,["filter-state"])):y==="currency"?(r(),E(lf,{key:3,modelValue:A(a).data.currency,"onUpdate:modelValue":_[1]||(_[1]=v=>A(a).data.currency=v),currencies:A(a).currencies,onChange:v=>{A(a).setSelectChange(v,{...g,value:y})}},null,8,["modelValue","currencies","onChange"])):B("",!0)]),y!=="variation_ids"?(r(),E(pZ,{key:0,filterKey:y,itemId:y==="variation_ids"?g.value[0].id:null,onRemove:s},null,8,["filterKey","itemId"])):B("",!0)],2)):B("",!0)],64))),128)):B("",!0),Object.keys(p.value).length?(r(),h("li",QZ,[n(mZ,{"filter-state":A(a)},null,8,["filter-state"])])):B("",!0)])]))}},VZ={class:"fct-filter-dropdown-header"},TZ={key:0,class:"fct-filter-back-wrapper"},MZ={class:"fct-filter-active-label"},LZ={key:1,class:"fct-filter-dropdown-search-input"},RZ={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>{const i=C("el-input");return r(),h("div",VZ,[A(a).data.activeFilter!=null?(r(),h("div",TZ,[o("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=c=>A(a).selectActiveFilter(null))},[n(J,{name:"ArrowLeft"})]),o("span",MZ,m(A(a).activeFilterOptions.label),1)])):(r(),h("div",LZ,[n(i,{modelValue:A(a).data.searchQuery,"onUpdate:modelValue":s[1]||(s[1]=c=>A(a).data.searchQuery=c),placeholder:l.$t("Search Filter..."),clearable:""},null,8,["modelValue","placeholder"])]))])}}},OZ={class:"fct-filter-dropdown-active-filter-list"},HZ=["onClick"],PZ={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",OZ,[(r(!0),h(H,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:de(["fct-filter-active-option-item",{"is-selected":A(a).isFilterOptionSelected(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>A(a).selectFilterOption(i)},m(i.label),9,HZ)],2))),128))]))}},NZ={class:"fct-filter-dropdown-active-filter-list is-multi-list"},KZ=["onClick"],GZ={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",NZ,[(r(!0),h(H,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:de(["fct-filter-active-option-item",{"is-selected":A(a).isFilterOptionSelectedMulti(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>A(a).selectFilterOptionMulti(i)},m(i.label),9,KZ)],2))),128))]))}},jZ={class:"fct-filter-dropdown-active-filter"},zZ={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("div",jZ,[A(a).activeFilterOptions.type==="list"?(r(),E(PZ,{key:0,"filter-state":A(a)},null,8,["filter-state"])):B("",!0),A(a).activeFilterOptions.type==="multi-list"?(r(),E(GZ,{key:1,"filter-state":A(a)},null,8,["filter-state"])):B("",!0),A(a).activeFilterOptions.type==="date"?(r(),E(af,{key:2,modelValue:A(a).data.dateRange,"onUpdate:modelValue":s[0]||(s[0]=i=>A(a).data.dateRange=i),onChange:A(a).setDateRange},null,8,["modelValue","onChange"])):B("",!0),A(a).activeFilterOptions.type==="currency"?(r(),E(lf,{key:3,modelValue:A(a).data.currency,"onUpdate:modelValue":s[1]||(s[1]=i=>A(a).data.currency=i),currencies:A(a).currencies,onChange:A(a).setSelectChange},null,8,["modelValue","currencies","onChange"])):B("",!0),A(a).activeFilterOptions.type==="tree-select"?(r(),E(sf,{key:4,"filter-state":A(a)},null,8,["filter-state"])):B("",!0)]))}},qZ={class:"fct-filter-dropdown-list"},YZ=["onClick"],WZ={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},JZ={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",qZ,[A(a).visibleFilters.length?(r(!0),h(H,{key:0},ae(A(a).visibleFilters,(i,c)=>(r(),h("li",{class:"fct-filter-dropdown-list-item",key:c},[o("div",{class:"fct-filter-dropdown-button",onClick:p=>A(a).selectActiveFilter(i)},[n(J,{name:i.icon},null,8,["name"]),R(" "+m(i.label),1)],8,YZ)]))),128)):(r(),h("li",WZ,m(A(a).data.searchQuery?A(u)("No filter found"):A(u)("All filters selected")),1))]))}},XZ={key:0,class:"fct-filter-dropdown"},ZZ={class:"fct-filter-dropdown-body"},eee={key:1},tee={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=M(null),l=t.filterState,s=Ge.get("app_config.isProActive"),i=[{label:u("Order Type"),icon:"AppsLine",type:"multi-list",value:"orderTypes",disableRoutes:["reports_customer","reports_subscriptions"],options:[{label:u("All"),value:"all"},{label:u("One time"),value:"payment"},{label:u("Subscription"),value:"subscription"},{label:u("Renewal"),value:"renewal"}]},{label:u("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:u("Active"),value:"subscription"},{label:u("Renewal"),value:"renewal"},{label:u("Expired"),value:"expired"},{label:u("Canceled"),value:"canceled"}]},{label:u("Currency"),icon:"Currency",type:"currency",value:"currency",disableRoutes:["reports_products","reports_customer","reports_subscriptions"]},{label:u("Products"),icon:"ListView",type:"tree-select",value:"variation_ids",disableRoutes:["reports_customer"]}];l.setFilterOption(i);const c=p=>{const f=a.value,_=p.target,g=document.querySelectorAll(".el-picker-panel"),y=Array.from(g).some(v=>v.contains(_));f!=null&&f.contains(_)||y||(l.data.searchQuery="",l.dropdownOpen&&l.toggleDropdown())};return Ie(()=>{document.addEventListener("click",c)}),vl(()=>{document.removeEventListener("click",c)}),(p,f)=>(r(),h("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:f[0]||(f[0]=Ne(()=>{},["stop"]))},[n(Ze,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:A(l).toggleDropdown},{default:d(()=>[n(J,{name:"Filter"})]),_:1},8,["onClick"]),n(Wl,{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:d(()=>[A(l).dropdownOpen?(r(),h("div",XZ,[A(s)?(r(),h(H,{key:0},[n(RZ,{"filter-state":A(l)},null,8,["filter-state"]),o("div",ZZ,[A(l).data.activeFilter!=null?(r(),E(zZ,{key:0,"filter-state":A(l)},null,8,["filter-state"])):(r(),E(JZ,{key:1,"filter-state":A(l)},null,8,["filter-state"]))])],64)):(r(),h("div",eee,[n(on,{class:"py-7.5",placement:"feature_lock_report_advanced_filtering",title:A(u)("Upgrade to Pro for filtering"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))])):B("",!0)]),_:1})],512))}},aee={class:"fct-report-nav-links-wrap"},lee={class:"fct-settings-nav-collapse-button-wrapper"},see={class:"fct-menu-collapse-button-text"},nee=["onClick"],oee=["src","alt"],iee=["src","alt"],ree={class:"fct-settings-nav-link-text"},dee={class:"fct-settings-nav-child-list"},uee=["onClick"],cee={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=ll(),l=sl(),s=[{route:"reports_overview",label:u("Overview"),url:"/reports/overview",icon:"Overview"},{route:"reports_sales",label:u("Sales"),url:"/reports/sales",icon:"LineChart"},{route:"reports_orders",label:u("Orders"),url:"/reports/orders",icon:"Cart"},{route:"reports_revenue",label:u("Revenue"),url:"/reports/revenue",icon:"Revenue"},{route:"reports_refunds",label:u("Refunds"),url:"/reports/refunds",icon:"Refund"},{route:"reports_subscriptions",label:u("Subscriptions"),url:"/reports/subscriptions",icon:"Subscription",always_open:!0,child:[{route:"subscriptions-retention",label:u("Retention"),url:"/reports/subscriptions/subscriptions-retention"},{route:"subscriptions-cohorts",label:u("Cohorts"),url:"/reports/subscriptions/subscriptions-cohorts"},{route:"future_renewals",label:u("Future Renewals"),url:"/reports/subscriptions/future-renewals"}]},{route:"reports_products",label:u("Products"),url:"/reports/products",icon:"Product"},{route:"reports_customer",label:u("Customers"),url:"/reports/customer",icon:"Users"},{route:"reports_sources",label:u("Sources"),url:"/reports/sources",icon:"Source"}];Ge.get("addon_report_sidebar",[]).forEach(Q=>s.push(Q));const i=M(!1),c=M(!1),p=M(window.innerWidth>=1024),f=t,_=M(null),g=M(null),y=Q=>!Q.child||!(!F.value||x.value)?!1:v(Q)||Q.always_open,v=Q=>{const D=l.path;return!!(Q.child&&Q.child.length&&Q.child.some(U=>D===U.url||D.includes(U.url))||D===Q.url||D.includes(Q.url))},b=(Q,D,T)=>l.path===Q.url,k=Q=>{a.push({name:Q.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,c.value=!1},S=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},$=()=>{const Q=window.innerWidth,D=p.value;p.value=Q>=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,c,p],()=>{f("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:c.value,isDesktopView:p.value})},{immediate:!0});const F=N(()=>i.value),x=N(()=>p.value&&i.value&&c.value);return Ie(()=>{$(),window.addEventListener("resize",$)}),xt(()=>{window.removeEventListener("resize",$)}),(Q,D)=>{const T=C("el-button"),U=C("el-tooltip");return r(),h("div",aee,[o("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:S},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:de(["fct-settings-nav-container",{"is-collapsed":F.value,"is-expanded":x.value}])},[o("div",lee,[n(U,{content:A(u)("Toggle reports"),placement:"right"},{default:d(()=>[n(T,{onClick:w},{default:d(()=>[n(J,{name:"Window"}),o("span",see,m(A(u)("Reports")),1)]),_:1})]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:D[0]||(D[0]=I=>p.value&&i.value&&(c.value=!0)),onMouseleave:D[1]||(D[1]=I=>c.value=!1)},[(r(),h(H,null,ae(s,(I,O)=>o("li",{key:O,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(I)}])},[o("div",{onClick:L=>k(I),class:"fct-settings-nav-link"},[I.icon_img?(r(),h(H,{key:0},[o("img",{src:I.icon_img,alt:I.label,class:de(I.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,oee),I.icon_img_dark?(r(),h("img",{key:0,src:I.icon_img_dark,alt:I.label,class:"w-5 h-5 hidden dark:block"},null,8,iee)):B("",!0)],64)):I.icon?(r(),E(J,{key:1,name:I.icon,class:"w-5 h-5"},null,8,["name"])):B("",!0),o("span",ree,[R(m(I.label)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,nee),n(va,{accordion:"",visible:y(I),class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",dee,[(r(!0),h(H,null,ae(I.child,(L,P)=>(r(),h("li",{key:P,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":b(L,P,I)}])},[o("div",{onClick:q=>k(L),class:"fct-settings-nav-link"},m(L.label),9,uee)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},Aee={class:"fct-reports-view-inner"},pee={class:"fct-report-body",id:"fct-report-body"},fee={key:0,class:"fct-report-filter-wrap"},mee={key:1,class:"fct-report-filter-button"},hee={class:"fct-report-body-inner"},_ee={__name:"ReportsView",setup(e){var v;const t=M({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=$p(),l=sl(),s=M((v=l.meta)==null?void 0:v.title),i=N(()=>ja.data);a.onFilterChanged(b=>{_(b)});const c=N(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(l.name)),p=N(()=>["reports_overview","reports","future_renewals"].includes(l.name));let f=null;const _=b=>{Object.entries(b).forEach(([k,w])=>{let S=w.value;switch(w.type==="multi-list"&&(S=w.value.map($=>$.value)),k){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":ja.data[k]=S;break;case"dateRange":ja.data.dateRange=w.value,ja.data.rangeKey=w.rangeKey;break;case"variation_ids":ja.data[k]=Array.isArray(w.value)?w.value.map($=>$.id):[];break}}),ja.onFilterChange()},g=()=>{var k,w;const b=a.retrieveSavedFilters();b?(a.data.selectedFilters={...b},((w=(k=b.dateRange)==null?void 0:k.value)==null?void 0:w.length)===2&&(a.data.dateRange=[b.dateRange.value[0],b.dateRange.value[1]])):a.data.selectedFilters={}},y=b=>{t.value=b};return be(()=>l.name,(b,k)=>{var w;s.value=((w=l.meta)==null?void 0:w.title)||"Reports"}),Ie(()=>{ja.fetchReportMeta(),g(),f=document.getElementById("fluent_cart_plugin_app"),f&&f.classList.add("fct_report_page_plugin_app_wrap")}),xt(()=>{f&&f.classList.remove("fct_report_page_plugin_app_wrap")}),vl(()=>{Qt.remove("product_variations")}),(b,k)=>{const w=C("router-view");return r(),h("div",{class:de(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",Aee,[n(cee,{"onUpdate:menuState":y}),o("div",pee,[n(Qa,{heading:A(u)(s.value),"show-save-button":!1},null,8,["heading"]),!p.value||c.value?(r(),h("div",fee,[p.value?B("",!0):(r(),E(DZ,{key:0,"filter-state":A(a)},null,8,["filter-state"])),!p.value&&c.value?(r(),h("div",mee,[n(tee,{"filter-state":A(a)},null,8,["filter-state"])])):B("",!0)])):B("",!0),o("div",hee,[n(Da),i.value.storeMode!==i.value.filterMode&&i.value.filterMode&&i.value.filterMode!==""?(r(),E(Xa,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:b.$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"])):B("",!0),n(w,null,{default:d(({Component:S})=>[(r(),E(Bl(S),{reportFilter:A(ja)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},vee=lt(_ee,[["__scopeId","data-v-081223ea"]]),gee={__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,b,k)=>({name:y,type:v,data:b,smooth:!0,color:k,showSymbol:!0,areaStyle:{color:new Ar(0,0,0,1,t.backgroundGradient.map(w=>({offset:w.offset,color:w.color})))}}),s=()=>{const y=[];return y.push(l("","line",t.yAxis,t.lineColor)),y},i=y=>{const v=y.split("-");if(v.length===3){const[b,k,w]=v;return`${Pa[parseInt(k)-1]} ${w}, ${b}`}else if(v.length===2){const[b,k]=v;return`${Pa[parseInt(k)-1]} ${b}`}else if(v.length===1){const[b]=v;return`${b}`}},c=N(()=>t.xAxis.map(y=>i(y)));let p=null;const f=()=>{if(a.value&&p==null){p=aa(a.value);const y={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?qa(v*100):v},grid:{show:!1,left:"10%",right:"10%",bottom:"80%"},xAxis:{type:"category",data:c.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:s()};p.setOption(y),window.addEventListener("resize",()=>{p.resize()})}},_=()=>{p&&p.setOption({xAxis:{data:t.xAxis},series:s()})};be(()=>[t.xAxis,t.yAxis],()=>{ke(()=>{_()})});const g=()=>{_()};return Ie(()=>{window.addEventListener("fluentCartCurrencyChange",g),ke(()=>{f()})}),xt(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},yee=lt(gee,[["__scopeId","data-v-b4cb951c"]]);function nf(e){return Number(e)>0}function cs(e){return nf(e)?"text-red-500":""}function $l(e,t=null){return(t!==null?t:nf(e))?`(${pt.scaled(e)})`:pt.scaled(e)}const bee=["innerHTML"],Ms={__name:"ReportSummary",props:{amount:{type:[Number,String],required:!0},placement:{type:String,default:"top"},title:{type:String,default:""}},setup(e){const t=e,a=N(()=>t.title?t.title+" "+t.amount:t.amount);return(l,s)=>{const i=C("el-tooltip");return r(),E(i,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[o("span",null,m(a.value),1)]),default:d(()=>[o("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,bee)]),_:1},8,["placement"])}}},ml={__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=N(()=>ja.data.compareType!=="no_comparison"),l=N(()=>Aa(t.fluctuation)),s=N(()=>(t.hasCurrency?pt.scaled:Aa)(t.amount)),i=N(()=>(t.title?t.title:u("Previously"))+" "+s.value+(t.isPercentage?"%":"")),c=N(()=>{if(t.fluctuation===0)return"text-system-light";const f=t.fluctuation>0;return(t.isLiability?!f:f)?"text-success-500":"text-red-500"}),p=N(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(f,_)=>{const g=C("el-tooltip");return a.value?(r(),h("div",{key:0,class:de(["percentage",c.value])},[e.fluctuation!==0?(r(),E(J,{key:0,class:"w-2",name:p.value},null,8,["name"])):B("",!0),n(g,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[o("span",null,m(i.value),1)]),default:d(()=>[o("span",{class:de(["cursor-pointer",c.value])},[R(m(l.value)+"% ",1),e.fluctuationSuffix?(r(),h(H,{key:0},[R(m(e.fluctuationSuffix),1)],64)):B("",!0)],2)]),_:1},8,["placement"])],2)):B("",!0)}}},wee={class:"fct-report-result"},Cee={key:0,class:"fct-report-result-content"},kee={key:1,class:"fct-report-result-content"},Bee={class:"title flex items-center gap-1"},xee={class:"value"},See={class:"inline-flex"},Fee={key:2,class:"fct-report-result-chart"},$ee={key:3,class:"fct-report-result-chart"},Eee={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;N(()=>reportFilter.currentCurrencySign),N(()=>defaultReport.data.isBusy.salesReport);const a=(f,_)=>{const g=parseInt(f.replace("#",""),16),y=g>>16&255,v=g>>8&255,b=g&255;return`rgba(${y}, ${v}, ${b}, ${_})`},l=De.colors.report,s=M([{title:u("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:u("The total sales you had in this period.")},{title:u("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:u("Refunds made in this period. This is deducted from gross sales to calculate revenue."),liability:!0},{title:u("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:u("Gross sales less refunds, taxes, shipping, fees.")},{title:u("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:u("The total number of orders placed in this period.")},{title:u("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:u("The total number of items sold in this period.")},{title:u("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:u("Total refunds count including partially refunds.")}]),i=N(()=>s.value.map(f=>({...f,value:t.defaultReport.summaryData[f.key]||0,fluctuation:t.defaultReport.fluctuations[f.key]||0,graph:t.defaultReport.data.graphs[f.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[f.graph]||!1,liability:f.liability||!1}))),c=f=>["net_revenue","total_refunded_amount","gross_sale"].includes(f),p=f=>c(f.key)?$l(f.value,f.liability):Aa(f.value);return(f,_)=>{const g=C("el-skeleton"),y=C("el-tooltip"),v=C("el-skeleton-item"),b=C("el-col"),k=C("el-row");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[n(k,{gutter:16,class:"gap-y-4"},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(w,S)=>(r(),E(b,{lg:8,md:12,key:S},{default:d(()=>[n(Pn,{class:"fct-report-summary-card h-[100px]"},{default:d(()=>[o("div",wee,[w.dataBusy?(r(),h("div",Cee,[n(g,{animated:"",rows:1})])):(r(),h("div",kee,[o("div",Bee,[R(m(w.title)+" ",1),n(y,{"popper-class":"fct-tooltip",content:w.info,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",xee,[o("div",See,[n(Ms,{amount:p(w),title:w.title},null,8,["amount","title"])]),n(ml,{fluctuation:w.fluctuation,amount:e.defaultReport.data.previousSummary[w.key],"is-liability":w.liability,"has-currency":c(w.key)},null,8,["fluctuation","amount","is-liability","has-currency"])])])),w.dataBusy?(r(),h("div",Fee,[n(g,{animated:"",class:"flex items-center justify-end"},{template:d(()=>[n(v,{variant:"circle",class:"w-12.5 h-12.5 flex-none"})]),_:1})])):B("",!0),!w.dataBusy&&Object.keys(w.graph).length>0?(r(),h("div",$ee,[n(yee,{ref_for:!0,ref:"lineChart",xAxis:Object.keys(w.graph),yAxis:Object.values(w.graph),lineColor:w.lineColor,backgroundGradient:w.backgroundGradient,"has-currency":c(w.key)},null,8,["xAxis","yAxis","lineColor","backgroundGradient","has-currency"])])):B("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const Uee={key:0,class:"fct-report-sold-product-list has-scroll"},Iee={class:"list-left-content"},Qee={class:"list-image"},Dee=["src","alt"],Vee=["src"],Tee={class:"list-title"},Mee={class:"list-title-inner"},Lee={class:"list-id"},Ree={class:"list-right-content"},Oee={class:"list-value"},Hee={class:"list-price"},Pee={class:"inline-flex"},Nee={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=Ql.data,a=N(()=>Ql.data.isBusy.topSoldVariants);return(l,s)=>{const i=C("el-skeleton"),c=C("router-link");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[n(Pn,{class:"top-sold-variants","card-options":{heading:A(u)("Top Sold Variants")}},{default:d(()=>{var p,f;return[a.value?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[((f=(p=A(t))==null?void 0:p.topSoldVariants)==null?void 0:f.length)>0?(r(),h("ul",Uee,[(r(!0),h(H,null,ae(A(t).topSoldVariants,_=>(r(),h("li",{key:_.product_id},[n(c,{to:{name:"product_edit",params:{product_id:_.product_id}}},{default:d(()=>{var g;return[o("div",Iee,[o("div",Qee,[_.media_url!==null?(r(),h("img",{key:0,src:_.media_url,alt:(g=_.media)==null?void 0:g.title},null,8,Dee)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,Vee))]),o("div",Tee,[o("div",Mee,m(_.variation_name),1),o("div",Lee,[o("strong",null,m(_.product_name),1)])])]),o("div",Ree,[o("div",Oee,m(_.quantity)+" "+m(A(u)(" Sold")),1),o("div",Hee,[o("div",Pee,m(A(pt).scaled(_.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))],64))]}),_:1},8,["card-options"])]),_:1})}}},Kee={key:0,class:"flex items-center gap-2 justify-between"},Gee={class:"fct-btn-group sm"},jee={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=De.colors,l=M(null),s=M(De.isDark()),i=M("revenue"),c=M({}),p=$=>{const V=["#F6B51E","#855EF8","#47C2FF"],F=["#E6A819","#693EE0","#35ADE9"];return(s.value?F:V)[$]},f=N(()=>{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 $={onetime:u("Onetime Payments"),renewal:u("Renewals"),subscription:u("Subscriptions")},V=t.data.order_count,F=[];return Object.keys($).forEach((x,Q)=>{F.push({name:$[x],value:t.data[x+"_count"]||0,count:t.data[x+"_count"]||0,gross:t.data[x+"_gross"]||0,net:t.data[x+"_net"]||0,percentage:V?(t.data[x+"_count"]/V*100).toFixed(2):0,color:p(Q),visible:c.value[$[x]]!==!1})}),F}),_=N(()=>!f.value.length),g=N(()=>Ql.data.isBusy.salesReport),y=N(()=>f.value.filter($=>c.value[$.name]!==!1).map(($,V)=>({value:i.value==="revenue"?$.net:$.count,count:$.count,name:$.name,gross:$.gross,net:$.net,itemStyle:{color:p(f.value.findIndex(F=>F.name===$.name))}})));let v=null;const b=()=>{v&&(v.dispose(),v=null),ke(()=>{l.value&&(v=aa(l.value),k())})},k=()=>{if(!v)return;const $={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",confine:!0,position:gl,formatterr:"{b}: {c} ({d}%)",formatter:function(V){const F=s.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};">${u("Orders")}</span>
158 <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};">
159 ${Aa(V.data.count)}
160 </span>
161 </div>
162 <div>
163 <span style="color: ${F};">${u("Gross Sales")}</span>
164 <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};">
165 ${qa(V.data.gross*100)}
166 </span>
167 </div>
168 <div>
169 <span style="color: ${F};">${u("Revenue")}</span>
170 <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};">
171 ${qa(V.data.net*100)}
172 </span>
173 </div>
174 `},borderRadius:8,backgroundColor:s.value?"#38485a":"#ffffff",textStyle:{color:s.value?a.gray[25]:a.system.mid},borderColor:s.value?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"70%",data:y.value,label:{show:!0,color:s.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($,{notMerge:!0,replaceMerge:["series"]})};be([()=>f.value],()=>{ke(k)},{deep:!0}),be(_,$=>{$||b()}),be(g,$=>{$||b()}),be(i,()=>{k()});const w=$=>{s.value=De.isDark(),k()},S=()=>{k()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",S),ke(b)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),($,V)=>{const F=C("el-button"),x=C("el-button-group"),Q=C("el-skeleton");return r(),E(Pn,{class:"sales-sources","card-options":{heading:A(u)("Sources")}},{action:d(()=>[_.value?B("",!0):(r(),h("div",Kee,[n(x,{class:"left"},{default:d(()=>[n(F,{size:"small",onClick:V[0]||(V[0]=D=>i.value="revenue"),type:i.value==="revenue"?"primary":""},{default:d(()=>[R(m(A(u)("Revenue")),1)]),_:1},8,["type"]),n(F,{size:"small",onClick:V[1]||(V[1]=D=>i.value="orders"),type:i.value==="orders"?"primary":""},{default:d(()=>[R(m(A(u)("Orders")),1)]),_:1},8,["type"])]),_:1}),o("div",Gee,[n(Fa,{targetRef:l.value},null,8,["targetRef"])])]))]),default:d(()=>[g.value?(r(),E(Q,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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"])}}},zee={class:"fct-default-report-page"},qee={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M(t.reportFilter),l=async s=>{s&&(await Ql.getSalesReport(s),await Ql.getTopSoldProducts(s),await Ql.getTopSoldVariants(s))};return Ie(()=>{a.value&&a.value.addListener("default-report",l)}),xt(()=>{a.value&&a.value.removeListener("default-report")}),be(()=>t.reportFilter,s=>{a.value&&a.value.removeListener("default-report"),a.value=s,a.value&&(a.value.addListener("default-report",l),l(a.value.applicableFilters))},{immediate:!0}),(s,i)=>{const c=C("el-col"),p=C("el-row");return r(),h("div",zee,[n(Eee,{"default-report":A(Ql)},null,8,["default-report"]),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(Cd,{data:A(Ql).data.topSoldProducts,loading:A(Ql).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(Nee,{"default-report":A(Ql)},null,8,["default-report"])]),_:1}),B("",!0)]),_:1}),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(jee,{data:A(Ql).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class Yee extends Za{constructor(){super(...arguments);Re(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"]});Re(this,"storageKey","report-checkbox-filter");Re(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 s=this.data[a];s.includes(l)?this.data[a]=s.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 Hl=Yee.init();function An(e,t){const a=N(()=>{if(t.value&&t.value!=="default")return u("Auto");const[s,i]=e.data.dateRange||[];if(!s||!i)return u("Auto");const c=Math.floor(Math.abs(new Date(i)-new Date(s))/(1e3*60*60*24));let p;return c<=91?p=u("Daily"):c<=365?p=u("Monthly"):p=u("Yearly"),u("Auto (%1$s)",p)});return{groupKeys:N(()=>[{value:"default",label:a.value},{value:"daily",label:u("Daily")},{value:"monthly",label:u("Monthly")},{value:"yearly",label:u("Yearly")}])}}const Wee={class:"fct-revenue-line-chart-wrap"},Jee={class:"flex items-center gap-2"},Xee={class:"fct-card-header-title is-small"},Zee={class:"fct-chart-select"},ete={class:"fct-btn-group sm"},tte={key:2,class:"chart-action-wrap"},ate={class:"chart-change-wrap"},lte={class:"chart-change"},ste={class:"text"},nte={class:"chart-change"},ote={class:"text"},ite={__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),s=M(ga.getChartType("revenue","revenue_chart")||"line"),i=M(!1),c=De.colors.report,p=M(De.isDark()),f=(T,U,I,O,L,P=!1)=>({name:T,type:U,barMaxWidth:30,yAxisIndex:I,data:O,smooth:!1,color:L,hidden:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:L},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ya(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M(a.appliedGroupKey);be(()=>a.appliedGroupKey,T=>{_.value=T});const{groupKeys:g}=An(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},b=N(()=>a.reportFilter.data.compareType!=="no_comparison"),k=N(()=>{let T=[{name:u("Current Revenue"),key:"net_revenue",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(U=>U.net_revenue)}];return b.value&&T.unshift({name:u("Compare Revenue"),key:"net_revenue",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(U=>({value:U.net_revenue,date:U.group})),hidden:!1}),T.map(U=>f(U.name,U.type,0,U.data,U.color,U.hidden))});let w=null;const S=()=>{w&&(w.dispose(),w=null),ke(()=>{l.value&&(w=aa(l.value),F())})},$=N(()=>{const T=Vs(a.reportFilter.data.dateRange);return u("This report looks at the revenue you received ")+T}),V=N(()=>ul(a.chartData.length)),F=()=>{if(!w)return;const T=Ml(a.chartData),U={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"},selected:Object.fromEntries(k.value.map(I=>[I.name,!I.hidden]))},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ul(p.value,c.dark_cyan_blue_16,c.light_gray_blue,s.value),confine:!0,position:gl,alwaysShowContent:!1,valueFormatter:I=>qa(I*100),formatter:I=>{let O="";const L=p.value?"#ffffff":"#565865";return I.forEach(function(P,q){const G=typeof P.data=="object"&&P.data!==null?Ts(P.data.date):P.name,te=qa(P.value*100),ne=I.length>1&&q===0;ne&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${G}</div>`,O+=`<div>
175 ${P.marker}
176 <span style="color: ${L}">${P.seriesName}</span>
177 <span style="float: right; margin-left: 20px; color: ${L}">
178 ${Aa(te)}
179 </span>
180 </div>`,ne&&(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:I=>`${pt.scaled(I)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:k.value};w.setOption(U,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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()},Q=T=>{ga.onChange("revenue","revenue_chart",T),s.value!==T&&(i.value=!1,s.value=T,F())};be([()=>a.chartData,_],()=>{ke(F)},{deep:!0}),be(()=>Hl.data.revenue,()=>{ke(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||S()}),be(()=>a.loading,T=>{T||S()});const D=()=>{p.value=De.isDark(),ke(()=>{F()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("fluentCartCurrencyChange",D,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("fluentCartCurrencyChange",D),ke(()=>{S()})}),(T,U)=>{const I=C("el-tooltip"),O=C("el-option"),L=C("el-select"),P=C("el-skeleton");return r(),h("div",Wee,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Jee,[o("h5",Xee,m(A(u)("Revenue Chart")),1),n(I,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Zee,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=q=>_.value=q),onChange:v},{default:d(()=>[(r(!0),h(H,null,ae(A(g),q=>(r(),E(O,{key:q.value,label:A(u)(q.label),value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",ete,[n(Nl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:x,class:de(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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?B("",!0):(r(),h("div",tte,[o("div",ate,[o("div",lte,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",ste,m(A(u)("Data")),1)]),o("div",nte,[o("span",ote,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},rte={components:{DynamicIcon:J},props:{data:{type:Array,required:!0},filename:{type:String,default:"data.csv"}},methods:{exportCSV(){const t=(s=>{const i=_=>_.replace(/_/g," ").replace(/\b\w/g,g=>g.toUpperCase()),c=Object.keys(s[0]),f=[c.map(i).join(",")];return s.forEach(_=>{const g=c.map(y=>{let v=_[y];return typeof v=="object"&&(v=JSON.stringify(v)),typeof v=="string"&&(v=`"${v.replace(/"/g,'""')}"`),v});f.push(g.join(","))}),f.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 dte(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button");return r(),E(p,{onClick:i.exportCSV,size:"small"},{default:d(()=>[n(c,{name:"Download"}),R(" "+m(e.$t("Export")),1)]),_:1},8,["onClick"])}const Kn=lt(rte,[["render",dte]]),ute=["innerHTML"],cte=["innerHTML"],Ate=["innerHTML"],pte=["innerHTML"],fte=["innerHTML"],mte=["innerHTML"],hte=["innerHTML"],_te=["innerHTML"],vte={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?"MMMM DD, YYYY":e.length===2?"MMMM YYYY":""},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){const t={year:"numeric",month:"long",day:"numeric"};return new Date(e).toLocaleDateString(void 0,t)},formatCurrency(e){return pt.scaled(e)},liabilityClass:cs,maybeLiability:$l}},gte=Object.assign(vte,{setup(e){return(t,a)=>{const l=C("el-skeleton"),s=C("el-table-column"),i=C("el-table"),c=C("el-empty");return r(),E(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Revenue Breakdown"),title_size:"small"},oa({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[n(Kn,{data:e.revenueReport,filename:"revenue.csv"},null,8,["data"])]),key:"0"}]),1032,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[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:d(()=>[n(c,{description:A(u)("No data available")},null,8,["description"])]),default:d(()=>[t.dateFormat?(r(),E(s,{key:0,type:"expand"},{default:d(p=>[n(i,{data:p.row.items,"row-key":"month",size:"small",border:"",class:"w-full"},{default:d(()=>[n(s,{prop:"group",label:A(u)("Date"),"min-width":"160"},{default:d(f=>[R(m(A(et)(f.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),n(s,{prop:"order_count",label:A(u)("Order Count"),"min-width":"140"},{default:d(f=>[R(m(A(u)(A(Aa)(f.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"total_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(f=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(f.row.total_sales))},null,8,ute)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(f=>[o("div",{class:de(["inline-flex",A(cs)(f.row.total_refunds)]),innerHTML:A($l)(f.row.total_refunds)},null,10,cte)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:0,prop:"total_tax",label:A(u)("Taxes"),"min-width":"150"},{default:d(f=>[o("div",{class:de(["inline-flex",A(cs)(f.row.total_tax)])},m(A($l)(f.row.total_tax)),3)]),_:1},8,["label"])):B("",!0),t.shipping_total>0?(r(),E(s,{key:1,prop:"shipping_total",label:A(u)("Shipping"),"min-width":"150"},{default:d(f=>[o("div",{class:de(["inline-flex",A(cs)(f.row.shipping_total)])},m(A($l)(f.row.shipping_total)),3)]),_:1},8,["label"])):B("",!0),n(s,{prop:"net_revenue",label:A(u)("Revenue"),"min-width":"180"},{default:d(f=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(f.row.net_revenue))},null,8,Ate)]),_:1},8,["label"])]),_:2},1032,["data"])]),_:1})):B("",!0),n(s,{prop:"year",label:A(u)("Year"),"min-width":"50",fixed:""},null,8,["label"]),n(s,{prop:"order_count",label:A(u)("Order Count"),"min-width":"120"},{default:d(p=>[R(m(A(u)(A(Aa)(p.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"gross_sale",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.gross_sale)},null,8,pte)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(p=>[o("div",{class:de(["inline-flex",A(cs)(p.row.total_refunded_amount)]),innerHTML:A($l)(p.row.total_refunded_amount)},null,10,fte)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:1,prop:"tax_total",label:A(u)("Taxes"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.tax_total)},null,8,mte)]),_:1},8,["label"])):B("",!0),t.shipping_total>0?(r(),E(s,{key:2,prop:"shipping_total",label:A(u)("Shipping"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.shipping_total)},null,8,hte)]),_:1},8,["label"])):B("",!0),n(s,{prop:"net_revenue",label:A(u)("Revenue"),"min-width":"180"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.net_revenue)},null,8,_te)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function Us(e){var t;return((t=pm.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const yte={class:"px-5 pb-4"},bte={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),E(s,{loading:e.loading,animated:""},{template:d(()=>[o("div",yte,[n(l,{class:"w-full h-7"})]),(r(),h(H,null,ae(8,i=>o("div",{key:i,class:"flex items-center gap-5 px-5"},[n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"})])),64))]),_:1},8,["loading"])}}},wte={class:"fct-btn-group sm w-[240px] gap-2"},Cte={class:"capitalize"},kte={class:"capitalize"},Bte=["innerHTML"],xte=["innerHTML"],Ste=["innerHTML"],Fte=["innerHTML"],$te=["innerHTML"],Ete={__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;N(()=>a.reportFilter.currentCurrencySign);const s=[{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"),c=()=>{l("fetch-data-by-group",i.value)};return(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:p.$t("Grouped by"),title_size:"small"},{action:d(()=>[o("div",wte,[n(g,{class:"el-select--x-small",modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=b=>i.value=b),onChange:c,placeholder:p.$t("Select Group")},{default:d(()=>[(r(),h(H,null,ae(s,b=>n(_,{key:b.value,label:p.$t(b.label),value:b.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(Kn,{data:e.tableData,filename:"revenue grouped by.csv",class:"!ml-0"},null,8,["data"])])]),_:1},8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[n(bte,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?B("",!0):(r(),E(v,{key:0,data:e.tableData,"max-height":"390"},{empty:d(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:p.$t("Currently there is no data!")},null,8,["text"])]),default:d(()=>[i.value==="country"?(r(),E(y,{key:0,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(b=>[R(m(b.row.country),1)]),_:1},8,["label"])):B("",!0),i.value==="shipping_country"?(r(),E(y,{key:1,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(b=>[o("span",Cte,m(A(Us)(b.row.shipping_country)),1)]),_:1},8,["label"])):B("",!0),i.value==="billing_country"?(r(),E(y,{key:2,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(b=>[o("span",kte,m(A(Us)(b.row.billing_country)),1)]),_:1},8,["label"])):B("",!0),i.value==="payment_method"?(r(),E(y,{key:3,prop:"payment_method",label:p.$t("Payment Method"),"min-width":"150"},{default:d(b=>[R(m(b.row.payment_method),1)]),_:1},8,["label"])):B("",!0),n(y,{prop:"order_count",label:p.$t("Order Count"),"min-width":"150"},{default:d(b=>[R(m(A(u)(b.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"total_sales",label:p.$t("Gross Sales"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:A(pt).scaled(b.row.gross_sale)},null,8,Bte)]),_:1},8,["label"]),n(y,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:d(b=>[o("div",{class:de(["inline-flex",A(cs)(b.row.total_refunds)]),innerHTML:A($l)(b.row.total_refunds)},null,10,xte)]),_:1},8,["label"]),p.total_tax>0?(r(),E(y,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:d(b=>[o("div",{class:de(["inline-flex",A(cs)(b.row.total_tax)]),innerHTML:A($l)(b.row.total_tax)},null,10,Ste)]),_:1},8,["label"])):B("",!0),p.shipping_total>0?(r(),E(y,{key:5,prop:"shipping_total",label:p.$t("Shipping"),"min-width":"150"},{default:d(b=>[o("div",{class:de(["inline-flex",A(cs)(b.row.shipping_total)]),innerHTML:A($l)(b.row.shipping_total)},null,10,Fte)]),_:1},8,["label"])):B("",!0),n(y,{prop:"net_revenue",label:p.$t("Revenue"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:A(pt).scaled(b.row.net_sale)},null,8,$te)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class Ute extends Za{constructor(){super(...arguments);Re(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,s,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const c=ue.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{s&&(this.data.isBusy[s]=!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 Va=Ute.init(),Pl={__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"),s=C("el-skeleton");return r(),E(s,{loading:"loading",animated:""},{template:d(()=>[o("div",{class:de(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:ua(`--loader-grid-cols: ${e.count};`)},[(r(!0),h(H,null,ae(e.rows,i=>(r(),h(H,{key:i},[(r(!0),h(H,null,ae(e.count,c=>(r(),h("div",{key:c},[n(l),n(l,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},Ite={class:"summary-item-inner"},Qte={class:"value"},Dte={class:"inner-value"},Vte={class:"title"},Tte={__name:"RevenueReportSummary",props:{reportFilter:{type:Object}},setup(e){const t=[{title:u("Gross Sales"),key:"gross_sale",info:u("The total sales you had in this period.")},{title:u("Refunds"),key:"total_refunded_amount",liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Taxes"),key:"tax_total",liability:!0,info:u("Taxes paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Shipping"),key:"shipping_total",liability:!0,info:u("Shipping paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",info:u("Gross sales less refunds, taxes, shipping, fees.")}],a=N(()=>t.map(s=>({key:s.key,title:s.title,value:Va.data.summary[s.key]||0,fluctuation:Va.data.fluctuations[s.key]||0,liability:s.liability||!1,info:s.info})).filter(s=>["tax_total","shipping_total"].includes(s.key)?s.value!==0:!0)),l=N(()=>Va.data.isBusy.revenueReport);return(s,i)=>{const c=C("el-tooltip");return l.value?(r(),E(Pl,{key:0,loading:l.value,count:a.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:"fct-report-order-summary",style:ua(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(H,null,ae(a.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",Ite,[o("div",Qte,[o("div",Dte,[n(Ms,{amount:A($l)(p.value,p.liability),title:p.title},null,8,["amount","title"])]),n(ml,{fluctuation:p.fluctuation,amount:A(Va).data.previousSummary[p.key],"is-liability":p.liability},null,8,["fluctuation","amount","is-liability"])]),o("div",Vte,[R(m(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},Mte={name:"Comparison",components:{CardContainer:Be,CardHeader:Qe,CardBody:Ce},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 s={group:this.formatDate(t.group),net_revenue:l};if(this.hasComparison){const i=this.previousMetrics[a];if(i){const c=parseFloat(i.net_revenue),p=c?((l-c)/c*100).toFixed(2):"n/a";s.previous_revenue=c,s.percent_change=p,s.group=`${this.formatDate(t.group)} vs ${this.formatDate(i.group)}`}}e.push(s)}),e}},methods:{translate:u,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,s]=t;return`${Pa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}},formatCurrency(e){return pt.scaled(e)}}},Lte={class:"fct-revenue-comparison"},Rte=["innerHTML"],Ote=["innerHTML"];function Hte(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),f=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",Lte,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[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:d(()=>[n(f,{label:i.translate("Period")},{default:d(v=>[R(m(v.row.group),1)]),_:1},8,["label"]),n(f,{label:i.translate("Current Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.net_revenue)},null,8,Rte)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(f,{label:i.translate("Compare Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.previous_revenue)},null,8,Ote)]),_:1},8,["label"]),n(f,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},m(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Pte=lt(Mte,[["render",Hte]]),Nte={class:"fct-revenue-report-page"},Kte={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M("default"),l=t.reportFilter,s=l.applicableFilters,i=(g,y="default")=>{Va.getReportData({params:{...g.params,groupKey:y}})},c=g=>{Va.getReportData({params:{...s.params,groupKey:g}})},p=g=>{g!==Va.data.appliedGroupKey&&(a.value=g,i(s,a.value))},f=g=>{Va.getReportByGroup({params:{...s.params,groupKey:g}})},_=g=>{i(g,a.value),Va.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return Ie(()=>{l.addListener("revenue-report",_),_(s)}),xt(()=>{l.removeListener("revenue-report")}),(g,y)=>(r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",Nte,[n(Tte,{reportFilter:A(l)},null,8,["reportFilter"]),n(ite,{chartData:A(Va).data.revenueReport,compareData:A(Va).data.previousMetrics,reportFilter:A(l),appliedGroupKey:a.value,onFilterData:p,"is-empty":!A(Va).data.summary.gross_sale,loading:A(Va).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(Pte,{class:"my-7.5",currentMetrics:A(Va).data.revenueReport,previousMetrics:A(Va).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(l),loading:A(Va).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(gte,{revenueReport:A(Va).data.revenueReport,appliedGroupKey:a.value,onFetchData:c,loading:A(Va).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),n(Ete,{tableData:A(Va).data.netRevenueByGroup,reportFilter:A(l),revenueReport:A(Va),onFetchDataByGroup:f},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class Gte extends Za{constructor(){super(...arguments);Re(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,s,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const c=ue.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!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 Vt=Gte.init(),jte={key:1,class:"fct-report-order-summary summary-col-4"},zte={class:"summary-item-inner"},qte={class:"value"},Yte={key:0,class:"summary-checkbox"},Wte={class:"inner-value"},Jte={class:"title"},Xte={__name:"Summary",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=[{title:u("Gross Sales"),key:"gross_sale",content:u("The total sales you had in this period."),checkable:!0,hasCurrency:!0},{title:u("Refunds"),key:"total_refund",liability:!0,hasCurrency:!0,content:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",hasCurrency:!0,content:u("Gross sales less refunds, taxes, shipping, fees."),checkable:!0},{title:u("Orders"),key:"order_count",content:u("The total number of orders placed in this period."),checkable:!0,hideCurrency:!0},{title:u("Items"),key:"total_item_count",content:u("The total number of items sold in this period."),hideCurrency:!0},{title:u("Average Gross"),key:"average_gross",hasCurrency:!0,content:u("Average gross sales per order in this period.")},{title:u("Average Revenue"),key:"average_net",hasCurrency:!0,content:u("Average revenue per order in this period.")},{title:u("Average Order Items"),key:"average_order_items_count",content:u("Average number of items per order in this period."),hideCurrency:!0}],l=N(()=>a.map(f=>({...f,value:t.orderReport.data.summary[f.key]||0,fluctuation:t.orderReport.data.fluctuations[f.key]||0,liability:f.liability||!1,hasCurrency:f.hasCurrency||!1}))),s=N(()=>a.filter(f=>!f.hideCurrency).map(f=>f.key)),i=N(()=>t.orderReport.data.isBusy.orderChartData),c=f=>{Hl.onCheckBoxChange("order",f)},p=f=>s.value.includes(f.key)?$l(f.value,f.liability):Aa(f.value);return(f,_)=>{const g=C("el-checkbox"),y=C("el-tooltip");return i.value?(r(),E(Pl,{key:0,count:4,rows:2})):(r(),h("div",jte,[(r(!0),h(H,null,ae(l.value,(v,b)=>(r(),h("div",{class:"summary-item",key:b},[o("div",zte,[o("div",qte,[v.checkable?(r(),h("div",Yte,[n(g,{"true-value":!0,"false-value":!1,"model-value":A(Hl).data.order.includes(v.key),onChange:()=>c(v.key)},null,8,["model-value","onChange"])])):B("",!0),o("div",Wte,[n(Ms,{amount:p(v),title:v.title},null,8,["amount","title"])]),n(ml,{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",Jte,[R(m(v.title)+" ",1),n(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Zte={__name:"OrderHeatMap",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let l=null;const s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=De.colors,c=M(De.isDark()),p=N(()=>{const k=[];return t.chartData.forEach((w,S)=>{s.forEach(($,V)=>{k.push([S,V,w[$]])})}),k}),f=N(()=>t.chartData.length?Math.max(...t.chartData.flatMap(k=>s.map(w=>k[w]||0))):0),_=N(()=>c.value?["#000000",i.blue[500]]:["#ffffff",i.blue[600]]),g=N(()=>Object.values(t.chartData).every(k=>k.order_count===0)),y=N(()=>Vt.data.isBusy.orderByDayAndHour),v=()=>{l&&(l.dispose(),l=null),ke(()=>{if(a.value){l=aa(a.value,null,{renderer:"svg"});const k=t.chartData.map($=>$.hour),w=s,S={tooltip:{position:"top",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},formatter:$=>{const V=c.value?"#ffffff":"#000000";let F=`<div style="color: ${V};"><div>${s[$.data[1]]}, ${$.name||"-"}</div>`;return F+=`<div style="color: ${V};">
182 ${$.marker}
183 <span style="color: ${V};">${$.seriesName}</span>
184 <span style="float: right; margin-left: 20px; color: ${V};">
185 ${$.data[2]}
186 </span>
187 </div>`,F+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:k,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},yAxis:{type:"category",data:w,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},visualMap:{min:0,max:f.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:_.value}},series:[{name:u("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(S)}})};be([p,f],()=>{ke(()=>{v()})}),be(g,k=>{k||v()}),be(y,k=>{k||v()});const b=()=>{c.value=De.isDark(),ke(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),ke(()=>{v(),window.addEventListener("resize",()=>l==null?void 0:l.resize())})}),vl(()=>{l&&(window.removeEventListener("resize",()=>l==null?void 0:l.resize()),window.removeEventListener("onFluentCartThemeChange",b,!1),l.dispose(),l=null)}),(k,w)=>{const S=C("el-skeleton");return r(),E(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[y.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(H,{key:1},[g.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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})}}},eae={class:"fct-gross-sale-vs-net-revenue-wrap"},tae={class:"flex items-center gap-2"},aae={class:"fct-card-header-title is-small"},lae={class:"fct-chart-select"},sae={class:"fct-btn-group sm"},nae={key:2,class:"chart-action-wrap"},oae={class:"chart-change-wrap"},iae={class:"chart-change"},rae={class:"text"},dae={class:"chart-change"},uae={class:"text"},cae={__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),s=M("default"),i=M(ga.getChartType("order","order_chart")||"line"),c=M(!1),p=De.colors.report,f=M(De.isDark()),{groupKeys:_}=An(a.reportFilter,s),g=t,y=()=>{g("fetch-chart-data",s.value)},v=N(()=>Vt.data.isBusy.orderChartData),b=N(()=>[{title:u("Orders"),key:"order_count",color:f.value?p.dark_cyan_blue_16:p.light_gray,yAxisIndex:1,type:"bar"},{title:u("Gross Sales"),key:"gross_sale",color:f.value?p.blue_dark_mode:p.blue,yAxisIndex:0,type:"line"},{title:u("Revenue"),key:"net_revenue",color:f.value?p.purple_dark_mode:p.purple,yAxisIndex:0,type:"line"}].filter(({key:I})=>Hl.data.order.includes(I)).map(({title:I,key:O,color:L,yAxisIndex:P,type:q})=>Q(I,q,P,a.chartData.map(X=>X[O]),L))),k=N(()=>a.chartData.map(I=>Ts(I.group)));let w=null;const S=M(!0),$=()=>{w&&(w.dispose(),w=null),ke(()=>{l.value&&(w=aa(l.value),x(),w.on("legendselectchanged",I=>{S.value=I.selected.Orders}))})},V=N(()=>{const I=Vs(a.reportFilter.data.dateRange);return u("This report looks at orders created ")+I}),F=N(()=>ul(a.chartData.length)),x=()=>{if(!w)return;const I={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:f.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:f.value?"#253241":"#ffffff",borderColor:f.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:f.value?"#ffffff":"#565865"},axisPointer:Ul(f.value,p.dark_cyan_blue_16,p.light_gray_blue),confine:!0,position:gl,formatter:O=>{let L=O[0].axisValue;const P=f.value?"#ffffff":"#565865";return O.forEach(function(q,X){const G=X===0?q.value:qa(q.value*100);L+=`<div>
188 ${q.marker}
189 <span style="color: ${P};">${q.seriesName}</span>
190 <span style="float: right; margin-left: 20px; color: ${P};">
191 ${G}
192 </span>
193 </div>`}),L}},xAxis:{type:"category",data:k.value,axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12,interval:F.value.interval},axisLine:{lineStyle:{type:"dashed",color:f.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Sales"),type:"value",position:"left",axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12,formatter:O=>`${pt.scaled(O)}`},splitLine:{show:!0,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:u("Orders"),type:"value",position:"right",axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:b.value};w.setOption(I,{notMerge:!0,replaceMerge:["series"]})},Q=(I,O,L,P,q)=>({name:I,type:O,yAxisIndex:L,barMaxWidth:30,data:P,smooth:!1,color:q,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:q,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ya(q)},lineStyle:{color:q},areaStyle:{opacity:.3,color:q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),D=()=>{c.value=!c.value,c.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}]}):x()};be([()=>a.chartData,i],()=>{ke(x)},{deep:!0}),be(()=>Hl.data.order,()=>{ke(()=>{x()})},{deep:!0}),be(()=>a.isEmpty,I=>{I||$()}),be(v,I=>{I||$()}),be(S,()=>{if(!w)return;const O=w.getOption().series.map(L=>L.type==="line"?{...L,areaStyle:S.value?void 0:{opacity:.3}}:L);ke(()=>{w.setOption({series:O})})});const T=()=>{f.value=De.isDark(),ke(()=>{x()})},U=()=>{ke(()=>{x()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("fluentCartCurrencyChange",U,!1)}),Ie(()=>{ke($),window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("fluentCartCurrencyChange",U)}),(I,O)=>{const L=C("el-tooltip"),P=C("el-option"),q=C("el-select"),X=C("el-skeleton");return r(),h("div",eae,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",tae,[o("h5",aae,m(A(u)("Order Chart")),1),n(L,{"popper-class":"fct-tooltip",content:V.value,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",lae,[n(q,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":O[0]||(O[0]=G=>s.value=G),onChange:y},{default:d(()=>[(r(!0),h(H,null,ae(A(_),G=>(r(),E(P,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",sae,[n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:D,class:de(c.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,null,{default:d(()=>[v.value?(r(),E(X,{key:0,animated:"",rows:4})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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?B("",!0):(r(),h("div",nae,[o("div",oae,[o("div",iae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",rae,m(A(u)("Data")),1)]),o("div",dae,[o("span",uae,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Aae={class:"fct-report-monthly-list"},pae={class:"list-left-content"},fae={class:"list-title"},mae={class:"list-right-content"},hae={class:"list-value"},_ae={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=N(()=>ja.currentCurrencySign),l=[{title:u("Average Monthly Gross"),key:"monthly_gross",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Revenue"),key:"monthly_net",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Orders"),key:"monthly_orders"},{title:u("Average Monthly Items"),key:"monthly_items"}],s=N(()=>l.map(c=>({...c,value:t.orderReport.data.summary[c.key]||0,fluctuation:t.orderReport.data.fluctuations[c.key]||0,hasCurrency:c.hasCurrency||!1}))),i=c=>["monthly_net","monthly_gross"].includes(c.key)?pt.scaled(c.value):Aa(c.value);return(c,p)=>(r(),h("ul",Aae,[(r(!0),h(H,null,ae(s.value,(f,_)=>(r(),h("li",{key:_},[o("div",pae,[o("div",fae,m(f.title),1)]),o("div",mae,[o("div",hae,[n(Ms,{amount:i(f),title:f.title},null,8,["amount","title"]),n(ml,{fluctuation:f.fluctuation,amount:e.orderReport.data.previousSummary[f.key],"is-liability":!1,"has-currency":f.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},vae={class:"fct-report-result-content"},gae={class:"value"},yae={class:"inline-flex"},bae={class:"title"},wae={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=N(()=>t.reportFilter.currentCurrencySign),l=[{title:u("Taxes"),content:u("Total amount of taxes"),key:"tax_total",currencySign:a.value},{title:u("Shipping"),content:u("Total amount of shipping costs"),key:"shipping_total",currencySign:a.value}],s=N(()=>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,c)=>{const p=C("el-tooltip");return r(),h("div",{class:"fct-report-avg-wrap mb-7.5",style:ua(`--avg-grid-cols: ${s.value.length}`)},[(r(!0),h(H,null,ae(s.value,f=>(r(),h("div",{class:"fct-report-result",key:f.title},[o("div",vae,[o("div",gae,[o("span",yae,m(A(pt).scaled(f.value)),1),f.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:ua({color:f.fluctuation>0?"green":"red"})},[f.fluctuation>0?(r(),E(J,{key:0,class:"w-2",name:"CaretUp"})):B("",!0),f.fluctuation<0?(r(),E(J,{key:1,class:"w-2",name:"CaretDown"})):B("",!0),R(" "+m(A(Aa)(f.fluctuation))+"% ",1)],4)):B("",!0)]),o("div",bae,[R(m(f.title)+" ",1),f.content?(r(),E(p,{key:0,"popper-class":"fct-tooltip",content:f.content,placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):B("",!0)])])]))),128))],4)}}},Cae={class:"flex items-center gap-2"},kae={class:"fct-card-header-title is-small"},Bae={class:"fct-btn-group sm"},xae=["innerHTML"],Sae=["innerHTML"],Fae=["innerHTML"],$ae=["innerHTML"],Eae={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;M("number");const a=M(!1),l=N(()=>Vt.data.isBusy.newVsReturning),s=N(()=>{if(a.value===!0){const c=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],p={customer_type:"New"},f={customer_type:"Returning"};return c.forEach(_=>{const g=parseFloat(t.tableData[0][_]),y=parseFloat(t.tableData[1][_]),v=g+y;p[_]=g*100/v,f[_]=y*100/v}),[p,f]}return t.tableData});N(()=>t.reportFilter.currentCurrencySign),Ie(()=>{});const i=c=>`${parseFloat(c).toFixed(2)}%`;return(c,p)=>{const f=C("el-tooltip"),_=C("el-checkbox"),g=C("el-skeleton"),y=C("el-table-column"),v=C("el-empty"),b=C("el-table");return r(),E(Be,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small"},{title:d(()=>[o("div",Cae,[o("h5",kae,m(A(u)("New vs. Returning Customers")),1),n(f,{"popper-class":"fct-tooltip",content:A(u)("Returning customers are those who first ordered before this period."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:d(()=>[o("div",Bae,[n(_,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=k=>a.value=k),onChange:c.selectGroupKey},{default:d(()=>[R(m(A(u)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),n(Kn,{data:s.value,filename:"order_report.csv"},null,8,["data"])])]),_:1}),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),E(g,{key:0,animated:"",rows:3,class:"p-3"})):(r(),E(b,{key:1,data:s.value,border:""},{empty:d(()=>[n(v,{text:A(u)("No data available")},null,8,["text"])]),default:d(()=>[n(y,{prop:"customer_type",label:A(u)("Type"),"min-width":"90"},{default:d(k=>[R(m(k.row.customer_type),1)]),_:1},8,["label"]),n(y,{prop:"customer_count",label:A(u)("Customer Count"),"min-width":"120"},{default:d(k=>[R(m(a.value?i(k.row.customer_count):k.row.customer_count),1)]),_:1},8,["label"]),n(y,{prop:"order_count",label:A(u)("Order Count"),"min-width":"150"},{default:d(k=>[R(m(a.value?i(k.row.order_count):k.row.order_count),1)]),_:1},8,["label"]),n(y,{prop:"gross_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.gross_sales):A(pt).scaled(k.row.gross_sales)},null,8,xae)]),_:1},8,["label"]),n(y,{prop:"average_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.average_gross):A(pt).scaled(k.row.average_gross)},null,8,Sae)]),_:1},8,["label"]),n(y,{prop:"net_sales",label:A(u)("Revenue"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.net_sales):A(pt).scaled(k.row.net_sales)},null,8,Fae)]),_:1},8,["label"]),n(y,{prop:"average_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.average_net):A(pt).scaled(k.row.average_net)},null,8,$ae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Uae=lt(Eae,[["__scopeId","data-v-7818e7a0"]]),Iae={class:"w-[240px] fct-btn-group gap-1.5"},Qae={class:"capitalize"},Dae={class:"capitalize"},Vae=["innerHTML"],Tae=["innerHTML"],Mae=["innerHTML"],Lae=["innerHTML"],Rae={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,l=M("billing_country"),s=a.applicableFilters;N(()=>a.currentCurrencySign);const i=()=>{Vt.getOrderByGroup({params:{...s.params,groupKey:l.value}})},c=[{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}];return Ie(()=>{i()}),(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(Be,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Qe,{title:A(u)("Orders grouped by"),title_size:"small"},{action:d(()=>[o("div",Iae,[n(g,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=b=>l.value=b),onChange:i,placeholder:A(u)("Select Group")},{default:d(()=>[(r(),h(H,null,ae(c,b=>n(_,{key:b.value,label:b.label,value:b.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(Kn,{data:A(Vt).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[n(v,{data:A(Vt).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:d(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[l.value==="payment_method"?(r(),E(y,{key:0,prop:"payment_method",label:A(u)("Payment Method"),"min-width":"150"},{default:d(b=>[R(m(b.row.payment_method),1)]),_:1},8,["label"])):B("",!0),l.value==="shipping_country"?(r(),E(y,{key:1,prop:"shipping_country",label:A(u)("Country"),"min-width":"150"},{default:d(b=>[o("span",Qae,m(A(Us)(b.row.shipping_country)),1)]),_:1},8,["label"])):B("",!0),l.value==="billing_country"?(r(),E(y,{key:2,prop:"billing_country",label:A(u)("Billing Country"),"min-width":"150"},{default:d(b=>[o("span",Dae,m(A(Us)(b.row.billing_country)),1)]),_:1},8,["label"])):B("",!0),n(y,{prop:"orders",label:A(u)("Orders"),"min-width":"150"},{default:d(b=>[R(m(A(u)(b.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"gross_sale",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:A(pt).scaled(b.row.gross_sale)},null,8,Vae)]),_:1},8,["label"]),n(y,{prop:"average_order_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:A(pt).scaled(b.row.average_order_gross)},null,8,Tae)]),_:1},8,["label"]),n(y,{prop:"net_sale",label:A(u)("Revenue"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:A(pt).scaled(b.row.net_sale)},null,8,Mae)]),_:1},8,["label"]),n(y,{prop:"average_order_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:A(pt).scaled(b.row.average_order_net)},null,8,Lae)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},Oae={class:"fct-report-spend-by-day-wrap"},Hae={class:"flex items-center gap-2"},Pae={class:"fct-card-header-title is-small"},Nae={class:"fct-btn-group sm"},Kae={key:2,class:"chart-action-wrap"},Gae={class:"chart-change-wrap"},jae={class:"chart-change"},zae={class:"text"},qae={class:"chart-change"},Yae={class:"text"},Wae={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=M(null);let l=null;M(ga.getChartType("order","gross_sale_by_day_chart")||"line");const s=M(!1),i=N(()=>{const $=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort((F,x)=>F.day-x.day).map(F=>$[F.day-1])}),c=N(()=>Object.values(t.chartData).every($=>$.order_count===0)),p=N(()=>Vt.data.isBusy.orderByDayAndHour),f=De.colors.report,_=M(De.isDark()),g=N(()=>[y("Gross Sale","line",0,t.chartData.map($=>$.gross_sale),_.value?f.blue_dark_mode:f.blue),y("Orders","bar",1,t.chartData.map($=>$.order_count),_.value?f.dark_cyan_blue_16:f.light_gray)]),y=($,V,F,x,Q)=>({name:$,type:V,barMaxWidth:30,data:x,smooth:!1,color:Q,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},yAxisIndex:F,emphasis:{scale:2,itemStyle:{color:Ya(Q)},lineStyle:{color:Q},areaStyle:{opacity:.3,color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!l)return;const $={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:Ul(_.value,f.dark_cyan_blue_16,f.light_gray_blue),confine:!0,position:gl,formatter:V=>{let F=V[0].name;return V.forEach(x=>{const Q=x.seriesName==="Gross Sale"?qa(x.value*100):x.value,D=_.value?"#ffffff":"#565865";F+=`<div>
194 ${x.marker}
195 <span style="color: ${D};">${x.seriesName}</span>
196 <span style="float: right; margin-left: 20px; color: ${D};">
197 ${Q}
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=>`${pt.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:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:g.value};l.setOption($)},b=()=>{l&&(l.dispose(),l=null),ke(()=>{a.value&&(l=aa(a.value),v())})},k=()=>{s.value=!s.value,s.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(()=>[Vt.data.grossSaleByDay],()=>{ke(()=>{v()})},{deep:!0}),be(c,$=>{$||b()}),be(p,$=>{$||b()});const w=()=>{_.value=De.isDark(),ke(()=>{v()})},S=()=>{ke(()=>{v()})};return Ie(()=>{ke(()=>{b(),t.reportFilter.addListener("spend-by-day",b),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",S)})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1),t.reportFilter.removeListener("spend-by-day",b,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,V)=>{const F=C("el-tooltip"),x=C("el-skeleton");return r(),h("div",Oae,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Hae,[o("h5",Pae,m(A(u)("Spend by day")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Gross sales grouped by the days of the week."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",Nae,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:k,class:de(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),E(x,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[c.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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)),c.value?B("",!0):(r(),h("div",Kae,[o("div",Gae,[o("div",jae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",zae,m($.$t("Gross Sale")),1)]),o("div",qae,[o("span",Yae,m($.$t("Days of the week")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Jae={class:"fct-report-item-count-distribution-wrap"},Xae={class:"flex items-center gap-2"},Zae={class:"fct-card-header-title is-small"},ele={class:"fct-btn-group sm"},tle={key:2,class:"chart-action-wrap"},ale={class:"chart-change-wrap"},lle={class:"chart-change"},sle={class:"text"},nle={class:"chart-change"},ole={class:"text"},ile={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);M(t.chartData.length<=1?"bar":ga.getChartType("order","item_count_distribtion_chart")||"bar");const l=M(!1);N(()=>{const $=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort((F,x)=>F.day-x.day).map(F=>$[F.day-1])});const s=De.colors,i=M(De.isDark());let c=null;const p=()=>{l.value=!l.value,l.value?c.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}]}):c.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})},f=()=>{c&&c.resize()},_=N(()=>i.value?s.blue[500]+"52":s.blue[300]),g=N(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map($=>$.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?s.blue[800]:s.blue[400]},lineStyle:{color:_.value},areaStyle:{opacity:.3,color:_.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=N(()=>({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?s.report.dark_cyan_blue_16:s.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:t.chartData.map($=>$.item_count),axisLabel:{color:i.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:u("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=N(()=>Object.values(t.chartData).every($=>$.order_count===0)),b=N(()=>Vt.data.isBusy.orderByDayAndHour),k=()=>{c&&(c.dispose(),c=null),ke(()=>{a.value&&(c=aa(a.value),c.setOption(y.value),window.addEventListener("resize",f))})},w=()=>{c&&c.setOption(y.value)};be(()=>t.chartData,()=>{c?c.setOption(y.value):ke(()=>{k()})}),be(v,$=>{$||k()}),be(b,$=>{$||k()});const S=()=>{i.value=De.isDark(),ke(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),ke(()=>{k()})}),xt(()=>{c&&(c.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",f))}),($,V)=>{const F=C("el-tooltip"),x=C("el-skeleton");return r(),h("div",Jae,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Xae,[o("h5",Zae,m(A(u)("Item count distribution")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Grouping the orders by the number of items in each order."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",ele,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:p,class:de(l.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[b.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(H,{key:1},[v.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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?B("",!0):(r(),h("div",tle,[o("div",ale,[o("div",lle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",sle,m($.$t("Order Count")),1)]),o("div",nle,[o("span",ole,m($.$t("Item Count")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},rle={class:"fct-report-spend-by-hour-wrap"},dle={class:"flex items-center gap-2"},ule={class:"fct-card-header-title is-small"},cle={class:"fct-btn-group sm"},Ale={key:2,class:"chart-action-wrap"},ple={class:"chart-change-wrap"},fle={class:"chart-change"},mle={class:"text"},hle={class:"chart-change"},_le={class:"text"},vle={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=M(null);let l=null;M(ga.getChartType("order","gross_sale_by_hour_chart")||"line");const s=M(!1),i=N(()=>t.chartData.map($=>$.hour)),c=N(()=>Object.values(t.chartData).every($=>$.order_count===0)),p=N(()=>Vt.data.isBusy.orderByDayAndHour),f=De.colors.report,_=M(De.isDark()),g=($,V,F,x,Q)=>({name:$,type:V,barMaxWidth:30,data:F,smooth:!1,color:x,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:x,borderRadius:[4,4,0,0]},yAxisIndex:Q,emphasis:{scale:2,itemStyle:{color:Ya(x)},lineStyle:{color:x},areaStyle:{opacity:.3,color:x}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=N(()=>[{name:u("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map($=>$.gross_sale),color:_.value?f.purple_dark_mode:f.purple},{name:u("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map($=>$.order_count),color:_.value?f.dark_cyan_blue_16:f.light_gray}].map($=>g($.name,$.type,$.data,$.color,$.yAxisIndex))),v=()=>{if(!l)return;const $={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:Ul(_.value,f.dark_cyan_blue_16,f.light_gray_blue),confine:!0,position:gl,formatter:V=>{let F=V[0].name;return V.forEach(x=>{const Q=x.seriesName==="Gross Sale"?qa(x.value*100):x.value,D=_.value?"#ffffff":"#565865";F+=`<div>
200 ${x.marker}
201 <span style="color: ${D};">${x.seriesName}</span>
202 <span style="float: right; margin-left: 20px; color: ${D};">
203 ${Q}
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:u("Gross Sale"),axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:V=>`${pt.scaled(V)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:u("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:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value};l.setOption($)},b=()=>{l&&(l.dispose(),l=null),ke(()=>{a.value&&(l=aa(a.value),v())})},k=()=>{s.value=!s.value,s.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,()=>{ke(()=>v())}),be(c,$=>{$||b()}),be(p,$=>{$||b()});const w=()=>{_.value=De.isDark(),ke(()=>{v()})},S=()=>{ke(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",S),ke(()=>b())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,V)=>{const F=C("el-tooltip"),x=C("el-skeleton");return r(),h("div",rle,[n(Be,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",dle,[o("h5",ule,m(A(u)("Spend by hour ")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Gross Sales grouped by the hours of the day."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",cle,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:k,class:de(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),E(x,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(H,{key:1},[c.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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)),c.value?B("",!0):(r(),h("div",Ale,[o("div",ple,[o("div",fle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",mle,m($.$t("Gross Sale")),1)]),o("div",hle,[o("span",_le,m($.$t("Hour")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},gle={class:"fct-report-order-completion-time-wrap"},yle={class:"flex items-center gap-2"},ble={class:"fct-card-header-title is-small"},wle={class:"fct-btn-group sm"},Cle={key:2,class:"chart-action-wrap"},kle={class:"chart-change-wrap"},Ble={class:"chart-change"},xle={class:"text"},Sle={class:"chart-change"},Fle={class:"text"},$le={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let l=null;M(ga.getChartType("order","order_completion_time_chart")||"bar");const s=M(!1),i=N(()=>t.chartData.map($=>$.hour)),c=De.colors,p=M(De.isDark()),f=N(()=>p.value?c.blue[500]+"52":c.blue[300]),_=N(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map($=>$.orders),smooth:!1,color:f.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=N(()=>Object.values(t.chartData).every($=>$.orders===0)),y=N(()=>Vt.data.isBusy.orderCompletionTime),v=()=>{l&&l.resize()},b=()=>{if(!l)return;const $={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?c.report.dark_cyan_blue_16:c.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:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption($)},k=()=>{l&&(l.dispose(),l=null),ke(()=>{a.value&&(l=aa(a.value),b())})},w=()=>{s.value=!s.value,s.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?b():ke(()=>{k()})}),be(g,$=>{$||k()}),be(y,$=>{$||k()});const S=()=>{p.value=De.isDark(),ke(()=>{b()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),ke(()=>k())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",v))}),($,V)=>{const F=C("el-tooltip"),x=C("el-skeleton");return r(),h("div",gle,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",yle,[o("h5",ble,m(A(u)("Time between an order's created & completed date")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Orders grouped by based on their completion time in Hours."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",wle,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[g.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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?B("",!0):(r(),h("div",Cle,[o("div",kle,[o("div",Ble,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",xle,m(A(u)("Order Count")),1)]),o("div",Sle,[o("span",Fle,m(A(u)("Hours")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Ele={class:"fct-report-order-value-distribution-wrap"},Ule={class:"flex items-center gap-2"},Ile={class:"fct-card-header-title is-small"},Qle={class:"fct-btn-group sm"},Dle={key:2,class:"chart-action-wrap"},Vle={class:"chart-change-wrap"},Tle={class:"chart-change"},Mle={class:"text"},Lle={class:"chart-change"},Rle={class:"text"},Ole={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let l=null;M(ga.getChartType("order","order_value_distribution_chart")||"bar");const s=M(!1),i=N(()=>Object.keys(t.chartData)),c=De.colors,p=M(De.isDark()),f=N(()=>p.value?c.blue[500]+"52":c.blue[300]),_=N(()=>!Object.values(t.chartData).every($=>$&&$!==0)),g=N(()=>Vt.data.isBusy.orderValueDistribution),y=N(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),smooth:!1,color:f.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=N(()=>({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?c.report.dark_cyan_blue_16:c.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:u("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:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value})),b=()=>{l&&(l.dispose(),l=null),ke(()=>{a.value?(l=aa(a.value),l.setOption(v.value),window.addEventListener("resize",()=>{l.resize()})):l&&l.setOption(v.value)})},k=()=>{l&&l.setOption(v.value)},w=()=>{s.value=!s.value,s.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(_,$=>{$||b()}),be(g,$=>{$||b()});const S=()=>{p.value=De.isDark(),ke(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),ke(()=>{b()})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,V)=>{const F=C("el-tooltip"),x=C("el-skeleton");return r(),h("div",Ele,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Ule,[o("h5",Ile,m(A(u)("Order value distribution")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Orders grouped by based on their order value in different ranges."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[_.value?void 0:{name:"action",fn:d(()=>[o("div",Qle,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[g.value?(r(),E(x,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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?B("",!0):(r(),h("div",Dle,[o("div",Vle,[o("div",Tle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Mle,m($.$t("Order Count")),1)]),o("div",Lle,[o("span",Rle,m($.$t("Order Value Ranges")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Hle={class:"fct-report-average-order-gross-wrap"},Ple={class:"flex items-center gap-2"},Nle={class:"fct-card-header-title is-small"},Kle={class:"fct-btn-group sm"},Gle={key:2,class:"chart-action-wrap"},jle={class:"chart-change-wrap"},zle={class:"chart-change"},qle={class:"text"},Yle={class:"chart-change"},Wle={class:"text"},Jle={__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 s=M(!1),i=De.colors.report,c=M(De.isDark()),p=N(()=>c.value?i.blue_dark_mode:i.blue),f=N(()=>Vt.data.isBusy.orderChartData),_=N(()=>[{name:u("Average Order Gross"),type:"line",barMaxWidth:30,data:t.chartData.map($=>$.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:Ya(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=N(()=>ul(t.chartData.length)),y=()=>{l&&l.resize()},v=()=>{if(!l)return;const $=Ml(t.chartData),V={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:Ul(c.value,i.dark_cyan_blue_16,i.light_gray_cyan_blue),confine:!0,position:gl,valueFormatter:F=>qa(F*100)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:$,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:g.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption(V)},b=()=>{l&&(l.dispose(),l=null),ke(()=>{a.value&&(l=aa(a.value),v())})},k=()=>{s.value=!s.value,s.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,()=>{ke(()=>v())}),be(t.isEmpty,$=>{$||b()}),be(f,$=>{$||b()});const w=()=>{c.value=De.isDark(),ke(()=>{v()})},S=()=>{v()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",S),ke(()=>b())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),($,V)=>{const F=C("el-tooltip"),x=C("el-skeleton");return r(),h("div",Hle,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small"},oa({title:d(()=>[o("div",Ple,[o("h5",Nle,m(A(u)("Average Order Gross ")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Average Order Gross grouped by date period."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",Kle,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:k,class:de(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[f.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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?B("",!0):(r(),h("div",Gle,[o("div",jle,[o("div",zle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",qle,m($.$t("Average Order Gross")),1)]),o("div",Yle,[o("span",Wle,m($.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Xle={class:"fct-report-average-order-items-wrap"},Zle={class:"flex items-center gap-2"},ese={class:"fct-card-header-title is-small"},tse={class:"fct-btn-group sm"},ase={key:2,class:"chart-action-wrap"},lse={class:"chart-change-wrap"},sse={class:"chart-change"},nse={class:"text"},ose={class:"chart-change"},ise={class:"text"},rse={__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(ga.getChartType("order","avg_order_items_chart")||"line");const s=M(!1),i=De.colors.report,c=M(De.isDark()),p=N(()=>c.value?i.purple_dark_mode:i.purple),f=N(()=>[{name:u("Average Order Items"),type:"line",barMaxWidth:30,data:Array.isArray(t.chartData)?t.chartData.map($=>$.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:Ya(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),_=N(()=>ul(t.chartData.length)),g=N(()=>{const $=Ml(t.chartData);return{title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:$,axisLabel:{color:c.value?"#FFFFFF":"#696778",fontSize:12,interval:_.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{name:"Order Items",type:"value",axisLabel:{formatter:"{value}",color:c.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:f.value}}),y=N(()=>Vt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},b=()=>{l&&(l.dispose(),l=null),ke(()=>{a.value?(l=aa(a.value),l.setOption(g.value),window.addEventListener("resize",v)):l&&l.setOption(g.value)})},k=()=>{l&&l.setOption(g.value)},w=()=>{s.value=!s.value,s.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,$=>{$||b()}),be(y,$=>{$||b()});const S=()=>{c.value=De.isDark(),ke(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S),ke(()=>{b(),window.addEventListener("resize",v)})}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),($,V)=>{const F=C("el-tooltip"),x=C("el-skeleton");return r(),h("div",Xle,[n(Be,null,{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small"},oa({title:d(()=>[o("div",Zle,[o("h5",ese,m(A(u)("Average Order Items ")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Average Order Items grouped by date period."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",tse,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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?B("",!0):(r(),h("div",ase,[o("div",lse,[o("div",sse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",nse,m($.$t("Average Order Items")),1)]),o("div",ose,[o("span",ise,m($.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},dse={class:"fct-order-report-page"},use={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=i=>{i&&(Vt.getOrderChartData({params:{...i.params,groupKey:"default"}}),Vt.getNewVsReturningCustomer(i),Vt.getReportByDayAndHour(i),Vt.getItemCountDistribution(i),Vt.getOrderCompletionTime(i),Vt.getOrderValueDistribution(i))},s=i=>{const c=a.applicableFilters;c&&Vt.getOrderChartData({params:{...c.params,groupKey:i}})};return Ie(()=>{a.addListener("order-report",l),l(a.applicableFilters),a.value}),xt(()=>{a.removeListener("order-report",l,!1),a.value}),(i,c)=>{const p=C("el-col"),f=C("el-row");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",dse,[n(Xte,{orderReport:A(Vt),reportFilter:A(a)},null,8,["orderReport","reportFilter"]),n(cae,{chartData:A(Vt).data.orderChartData,reportFilter:A(a),onFetchChartData:s,"is-empty":!A(Vt).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),n(_ae,{orderReport:A(Vt)},null,8,["orderReport"]),A(Vt).data.summary.tax_total||A(Vt).data.summary.shipping_total?(r(),E(wae,{key:0,orderReport:A(Vt),reportFilter:A(a)},null,8,["orderReport","reportFilter"])):B("",!0),n(Uae,{tableData:A(Vt).data.newVsReturning,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(Rae,{tableData:A(Vt).data.orderByGroup,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(Zte,{chartData:A(Vt).data.orderByDayAndHour},null,8,["chartData"]),n(f,{gutter:30},{default:d(()=>[n(p,{lg:12},{default:d(()=>[n(Wae,{reportFilter:A(a),ref:"chartRef",chartData:A(Vt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(vle,{chartData:A(Vt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(ile,{ref:"chartRef",chartData:A(Vt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Ole,{chartData:A(Vt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Jle,{chartData:A(Vt).data.orderChartData,"is-empty":!A(Vt).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(rse,{chartData:A(Vt).data.orderChartData,"is-empty":!A(Vt).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n($le,{chartData:A(Vt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},cse={class:"fct-gross-sale-vs-net-revenue-wrap"},Ase={class:"flex items-center gap-2"},pse={class:"fct-card-header-title is-small"},fse={class:"fct-chart-select"},mse={class:"fct-btn-group sm"},hse={class:"chart-action-wrap"},_se={class:"chart-change-wrap"},vse={class:"chart-change"},gse={class:"text"},yse={class:"chart-change"},bse={class:"text"},wse={__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=De.colors.report,s=M(De.isDark()),i=M(null),c=M("default"),p=M(ga.getChartType("refund","refund_chart")||"line"),f=M(!1);N(()=>a.reportFilter.currentCurrencySign);const{groupKeys:_}=An(a.reportFilter,c),g=t,y=()=>{g("fetch-chart-data",c.value)},v=N(()=>a.reportFilter.data.compareType!=="no_comparison"),b=(T,U,I,O,L,P=!0)=>({name:T,type:U,barMaxWidth:30,data:I,smooth:!1,color:O,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},yAxisIndex:L,emphasis:{scale:2,itemStyle:{color:Ya(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:P,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),k=N(()=>{let T=[{name:u("Refunded Amount"),key:"refunded_amount",type:"line",color:s.value?l.blue_dark_mode:l.blue,yAxisIndex:0,data:a.chartData.map(U=>U.refunded_amount),animation:!1},{name:u("Total Refunds"),key:"refund_count",type:"bar",color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,yAxisIndex:1,data:a.chartData.map(U=>U.refund_count),animation:!1}];return v.value&&T.unshift({name:u("Previous Refunded Amount"),key:"refunded_amount_compare",type:"line",color:s.value?l.purple_dark_mode:l.purple,yAxisIndex:0,data:a.compareData.map(U=>U.refunded_amount),animation:!1},{name:u("Previous Total Refunds"),key:"refund_count_compare",type:"bar",color:s.value?l.dark_cyan_blue_16:l.light_gray,yAxisIndex:1,data:a.compareData.map(U=>U.refund_count),animation:!0}),T.map(U=>b(U.name,U.type,U.data,U.color,U.yAxisIndex,U.animation))});let w=null;const S=M(!0),$=()=>{w&&(w.dispose(),w=null),ke(()=>{i.value&&(w=aa(i.value),x(),w.on("legendselectchanged",T=>{S.value=T.selected["Total Refunds"]||T.selected["Previous Total Refunds"]}))})},V=N(()=>{const T=Vs(a.reportFilter.data.dateRange);return u("This report looks at refunds made for successful orders created ")+T}),F=N(()=>ul(a.chartData.length)),x=()=>{if(!w)return;const T=Ml(a.chartData),U={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:Ul(s.value,l.dark_cyan_blue_16,l.light_gray_blue),confine:!0,position:gl,formatter:I=>{let O=I[0].name;return I.forEach(L=>{const P=[0,2].includes(L.seriesIndex)?qa(L.value*100):L.value,q=s.value?"#ffffff":"#565865";O+=`<div>
206 ${L.marker}
207 <span style="color: ${q};">${L.seriesName}</span>
208 <span style="float: right; margin-left: 20px; color: ${q};">
209 ${P}
210 </span>
211 </div>`}),O}},xAxis:{type:"category",data:T,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:F.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:I=>`${pt.scaled(I)}`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",axisLabel:{color:s.value?"#253241":"#D6DAE1",fontSize:12},splitLine:{show:!1}}],series:k.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};w.setOption(U,{notMerge:!0,replaceMerge:["series"]})},Q=()=>{f.value=!f.value,f.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}]}):x()};be([()=>a.chartData,p],()=>{ke(x)},{deep:!0}),be(()=>Hl.data.refund,()=>{ke(()=>{x()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||$()}),be(()=>a.loading,T=>{T||$()}),be(S,()=>{if(!w)return;const U=w.getOption().series.map(I=>I.type==="line"?{...I,areaStyle:S.value?void 0:{opacity:.3}}:I);ke(()=>{w.setOption({series:U})})});const D=()=>{s.value=De.isDark(),ke(()=>{x()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("fluentCartCurrencyChange",D,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("fluentCartCurrencyChange",D),ke($)}),(T,U)=>{const I=C("el-tooltip"),O=C("el-option"),L=C("el-select"),P=C("el-skeleton");return r(),h("div",cse,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Ase,[o("h5",pse,m(A(u)("Refunds Chart")),1),n(I,{"popper-class":"fct-tooltip",content:V.value,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",fse,[n(L,{class:"el-select--x-small",modelValue:c.value,"onUpdate:modelValue":U[0]||(U[0]=q=>c.value=q),onChange:y},{default:d(()=>[(r(!0),h(H,null,ae(A(_),q=>(r(),E(O,{key:q.value,label:T.$t(q.label),value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",mse,[n(Ze,{tag:"button",size:"small",title:T.$t("Zoom Chart"),onClick:Q,class:de(f.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?B("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:i},null,512)),o("div",hse,[o("div",_se,[o("div",vse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",gse,m(T.$t("Data")),1)]),o("div",yse,[o("span",bse,m(T.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Cse extends Za{constructor(){super(...arguments);Re(this,"data",{refundData:[],previousMetrics:[],summary:{},previousSummary:{},fluctuations:{},chartData:[],weeksBetweenRefund:[],isBusy:{chartData:!0,weeksBetweenRefund:!0,refundData:!0}})}get controllerKey(){return"RefundReportController"}makeRequest(a,l,s,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const c=ue.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{s&&(this.data.isBusy[s]=!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 ka=Cse.init(),kse={key:1,class:"fct-report-order-summary summary-col-4"},Bse={class:"summary-item-inner"},xse={class:"value"},Sse={class:"inner-value"},Fse=["innerHTML"],$se={class:"title"},Ese={__name:"Summary",setup(e){const t=N(()=>[{title:u("Refunds"),value:ka.data.summary.refund_count,key:"refund_count",percentage:ka.data.fluctuations.refund_count,info:u("Total refunds count including partially refunds."),no_currency:!0},{title:u("Refunded"),value:ka.data.summary.refunded_amount,key:"refunded_amount",percentage:ka.data.fluctuations.refunded_amount,info:u("Total Refunded Amount")},{title:u("Avgerage Amount"),value:ka.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:ka.data.fluctuations.average_refunded_amount,info:u("Total Refunded Amount / Total Refund count")},{title:u("Refund Rate"),value:ka.data.summary.refund_rate,key:"refund_rate",percentage:ka.data.fluctuations.refund_rate,info:u("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=N(()=>ka.data.isBusy.chartData),l=s=>{const i=s.no_currency?Aa(s.value):pt.scaled(s.value);return s.is_percentage?`${i}%`:i};return(s,i)=>{const c=C("el-tooltip");return a.value?(r(),E(Pl,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",kse,[(r(!0),h(H,null,ae(t.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",Bse,[o("div",xse,[o("div",Sse,[o("span",{innerHTML:l(p)},null,8,Fse)]),n(ml,{fluctuation:p.percentage,amount:A(ka).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",$se,[R(m(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Use={class:"fct-report-refund-weeks-between-an-order-wrap"},Ise={class:"fct-btn-group sm"},Qse={class:"chart-action-wrap"},Dse={class:"chart-change-wrap"},Vse={class:"chart-change"},Tse={class:"text"},Mse={class:"chart-change"},Lse={class:"text"},Rse={__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 s=null;const i=De.colors.report,c=M(De.isDark()),p=N(()=>c.value?i.dark_cyan_blue_16:i.light_gray),f=N(()=>[{name:u("Refund Count"),type:l.value,data:t.chartData.map(k=>k.occurrence),smooth:!0,color:p.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:Ya(p.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),_=N(()=>ul(t.chartData.length)),g=()=>({title:{text:t.chartTitle,left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:t.chartData.map(k=>k.weekBetween),axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:_.value.interval,formatter:k=>k>1?`${k} weeks`:`${k} week`},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1"}}},series:f.value}),y=()=>{s&&(s.dispose(),s=null),ke(()=>{a.value&&(s=aa(a.value),s.setOption(g()),window.addEventListener("resize",()=>{s.resize()}))})};be(()=>t.chartData,()=>{s&&s.setOption(g())}),be(()=>t.isEmpty,k=>{k||y()}),be(()=>t.loading,k=>{k||y()});const v=()=>{c.value=De.isDark(),ke(()=>{b()})};xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const b=k=>{s&&s.setOption(g(),!0)};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",v),ke(()=>{y()})}),(k,w)=>{const S=C("el-skeleton");return r(),h("div",Use,[n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},oa({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Ise,[n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(S,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?B("",!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",Qse,[o("div",Dse,[o("div",Vse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Tse,m(A(u)("Refund Count")),1)]),o("div",Mse,[o("span",Lse,m(A(u)("Weeks")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Ose={class:"fct-btn-group sm w-[240px] gap-2"},Hse={key:0},Pse={key:1},Nse={class:"inline-flex"},Kse={class:"inline-flex"},Gse={__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:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}]),s=M("billing_country"),i=N(()=>{var p;return((p=l.value.find(f=>f.value===s.value))==null?void 0:p.label)||""}),c=()=>{a("group-data",s.value)};return(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-skeleton"),v=C("el-table-column"),b=C("el-table");return r(),E(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Refunds Grouped By"),title_size:"small"},oa({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[o("div",Ose,[n(g,{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=k=>s.value=k),onChange:c,class:"el-select--x-small",placeholder:A(u)("Select Group")},{default:d(()=>[(r(!0),h(H,null,ae(l.value,k=>(r(),E(_,{key:k.value,label:A(u)(k.label),value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(Kn,{data:e.tableData,filename:"refund.csv",class:"!ml-0"},null,8,["data"])])]),key:"0"}]),1032,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),E(y,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(b,{key:1,data:e.tableData,height:"330"},{empty:d(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[n(v,{prop:s.value,label:A(u)(i.value),"min-width":"150"},{default:d(k=>[s.value!=="payment_method"?(r(),h("span",Hse,m(A(Us)(k.row[s.value])),1)):(r(),h("span",Pse,m(k.row[s.value]),1))]),_:1},8,["prop","label"]),n(v,{prop:"refunds",label:A(u)("Refunds"),"min-width":"150"},{default:d(k=>f[1]||(f[1]=[])),_:1},8,["label"]),n(v,{prop:"refunded_amount",label:A(u)("Refunded Amount"),"min-width":"150"},{default:d(k=>[o("div",Nse,m(A(pt).scaled(k.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),n(v,{prop:"average_refund",label:A(u)("Average Refund"),"min-width":"150"},{default:d(k=>[o("div",Kse,m(A(pt).scaled(k.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},jse={class:"fct-refund-report-page"},zse={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=p=>{ka.getRefundChartData({params:{...p.params,groupKey:"default"}}),ka.getWeeksBetweenRefund(p),s(p)},s=p=>{ka.getRefundDataByGroup({params:{...p.params,groupKey:"billing_country"}})},i=p=>{const f=a.applicableFilters;ka.getRefundDataByGroup({params:{...f.params,groupKey:p}})},c=p=>{const f=a.applicableFilters;f&&ka.getRefundChartData({params:{...f.params,groupKey:p}})};return Ie(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),xt(()=>{a.removeListener("refund-report")}),(p,f)=>(r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",jse,[n(Ese),n(wse,{ref:"refundChart",chartData:A(ka).data.chartData,compareData:A(ka).data.previousMetrics,reportFilter:A(a),onFetchChartData:c,"is-empty":!A(ka).data.summary.refund_count,loading:A(ka).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),n(Rse,{chartData:A(ka).data.weeksBetweenRefund,"is-empty":!A(ka).data.weeksBetweenRefund.length,loading:A(ka).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),n(Gse,{tableData:A(ka).data.refundData,currencySign:A(a).currentCurrencySign,onGroupData:i,loading:A(ka).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},qse={class:"fct-gross-sale-vs-net-revenue-wrap"},Yse={class:"fct-chart-select"},Wse={class:"fct-btn-group sm"},Jse={class:"chart-action-wrap"},Xse={class:"chart-change-wrap"},Zse={class:"chart-change"},ene={class:"text"},tne={class:"chart-change"},ane={class:"text"},lne={__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),s=M(ga.getChartType("subscription","retention_chart")||"line"),i=M(!1),c=M(null);M([]);const p=De.colors.report,f=M(De.isDark()),_=(x,Q,D,T)=>({name:x,type:Q,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:Ya(T)},lineStyle:{color:T},areaStyle:{opacity:.3,color:T}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=N(()=>Object.keys(a.chartData).map(Q=>Q.startsWith("day_")?u("%s Days",Q.replace("day_","")):Q==="more_than_year"?u("More than Year"):Q)),y=N(()=>Object.keys(a.chartData).map(Q=>a.chartData[Q]||0)),v=N(()=>[_(u("Customers"),s.value,y.value,f.value?p.dark_cyan_blue_16:p.light_gray)]);let b=null;const k=()=>{b&&(b.dispose(),b=null),ke(()=>{l.value&&(b=aa(l.value),w())})},w=()=>{if(!b)return;const x={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:f.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:f.value?"#253241":"#ffffff",borderColor:f.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:f.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:f.value?p.dark_cyan_blue_16:p.light_gray_blue}}},xAxis:{type:"category",data:g.value,axisLabel:{color:f.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:f.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:f.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};b.setOption(x,{notMerge:!0,replaceMerge:["series"]})},S=x=>{ga.onChange("subscription","retention_chart",x),s.value!==x&&(i.value=!1,s.value=x,w())},$=t,V=()=>{$("fetch-custom-chart-data",c.value)};be(()=>a.chartData,()=>{ke(w)},{deep:!0}),be(()=>Hl.data.refund,()=>{ke(w)},{deep:!0}),be(()=>a.isEmpty,x=>{x||k()}),be(()=>a.loading,x=>{x||k()});const F=()=>{f.value=De.isDark(),ke(()=>{w()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",F,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",F),ke(k)}),(x,Q)=>{const D=C("el-input"),T=C("el-skeleton");return r(),h("div",qse,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title:A(u)("Retention Chart"),title_size:"small",border_bottom:""},oa({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Yse,[n(D,{type:"text",modelValue:c.value,"onUpdate:modelValue":Q[0]||(Q[0]=U=>c.value=U),placeholder:A(u)("Enter custom days"),class:"el-input--x-small",onKeyup:xa(V,["enter"])},null,8,["modelValue","placeholder"])]),o("div",Wse,[n(Nl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:S},null,8,["activeType"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(T,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[o("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512),o("div",Jse,[o("div",Xse,[o("div",Zse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",ene,m(A(u)("Data")),1)]),o("div",tne,[o("span",ane,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},sne={class:"fct-revenue-line-chart-wrap"},nne={class:"flex items-center gap-2"},one={class:"fct-card-header-title is-small"},ine={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},rne={class:"chart-action-wrap"},dne={class:"chart-change-wrap"},une={class:"chart-change"},cne={class:"text"},Ane={class:"chart-change"},pne={class:"text"},fne={__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),s=M(ga.getChartType("subscription","subscription_chart")||"line"),i=M(!1),c=De.colors.report,p=M(De.isDark()),f=(T,U,I,O,L)=>({name:T,type:U,barMaxWidth:30,yAxisIndex:I,data:O,smooth:!1,color:L,lineStyle:{width:3},areaStyle:{opacity:.3,color:L},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ya(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M(a.appliedGroupKey);be(()=>a.appliedGroupKey,T=>{_.value=T});const{groupKeys:g}=An(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},b=N(()=>a.reportFilter.data.compareType!=="no_comparison"),k=N(()=>{let T=[{name:u("Current Range"),key:"count",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(U=>U.count)}];return b.value&&T.unshift({name:u("Compare Range"),key:"count",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(U=>({value:U.count,date:U.group}))}),T.map(U=>f(U.name,U.type,0,U.data,U.color))});let w=null;const S=()=>{w&&(w.dispose(),w=null),ke(()=>{l.value&&(w=aa(l.value),F())})},$=N(()=>{const T=Vs(a.reportFilter.data.dateRange);return u("This report looks at the subscription you received ")+T}),V=N(()=>ul(a.chartData.length)),F=()=>{if(!w)return;const T=Ml(a.chartData),U={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?c.dark_cyan_blue_16:c.light_gray_blue}},alwaysShowContent:!1,formatter:I=>{let O="";return I.forEach(function(L,P){const q=typeof L.data=="object"&&L.data!==null,X=q?Ts(L.data.date):L.name,G=q?L.data.value:L.value,te=I.length>1&&P===0;te&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${X}</div>`,O+=`<div>
212 <span style="color:${L.color}">●</span>
213 <span>${u("Subscription")}</span>
214 <span style="float: right; margin-left: 20px;">
215 ${Aa(G)}
216 </span>
217 </div>`,te&&(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:k.value};w.setOption(U,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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()},Q=T=>{ga.onChange("subscription","subscription_chart",T),s.value!==T&&(i.value=!1,s.value=T,F())};be([()=>a.chartData,_],()=>{ke(F)},{deep:!0}),be(()=>Hl.data.revenue,()=>{ke(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||S()}),be(()=>a.loading,T=>{T||S()});const D=()=>{p.value=De.isDark(),ke(()=>{F()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",D),ke(()=>{S()})}),(T,U)=>{const I=C("el-tooltip"),O=C("el-option"),L=C("el-select"),P=C("el-skeleton");return r(),h("div",sne,[n(Be,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",nne,[o("h4",one,m(A(u)("Subscription Chart")),1),n(I,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",ine,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=q=>_.value=q),onChange:v},{default:d(()=>[(r(!0),h(H,null,ae(A(g),q=>(r(),E(O,{key:q.value,label:A(u)(q.label),value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(Nl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:x,class:de(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?B("",!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",rne,[o("div",dne,[o("div",une,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",cne,m(A(u)("Data")),1)]),o("div",Ane,[o("span",pne,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class mne extends Za{constructor(){super(...arguments);Re(this,"data",{overviews:[],fluctuations:[],chartData:[],productList:[],customerList:[],revenueChurnRateNet:{title:u("Revenue Churn Rate"),isCurrency:!1,value:0},netNewMrr:{title:u("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,s,i){typeof l!="object"&&(l={}),this.data.isBusy[i]=!0;const c=ue.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null||(this.data[s]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!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,ue.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,ue.get("reports/get-subscription-overview/net-new-mrr",a).then(l=>{this.data.netNewMrr=l.data}).finally(()=>{this.data.isBusy.netNewMrr=!1})}}const Gs=mne.init(),hne={key:1,class:"fct-report-order-summary summary-col-4"},_ne={class:"summary-item-inner"},vne={class:"value"},gne={class:"inner-value"},yne={class:"title"},bne={__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;N(()=>{var s;return((s=t.reportFilter)==null?void 0:s.currentCurrencySign)||""});const a=[{title:u("Future Installments"),key:"future_installments",info:u("The total amount expected from future installments."),hasCurrency:!0}],l=N(()=>!t.summaryData||!t.fluctuations?[]:a.map(s=>({...s,title:s.title,value:t.summaryData[s.key]||0,fluctuation:t.fluctuations[s.key]||0,hasCurrency:s.hasCurrency})));return(s,i)=>{const c=C("el-tooltip");return e.loading?(r(),E(Pl,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",hne,[(r(!0),h(H,null,ae(l.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",_ne,[o("div",vne,[o("div",gne,[n(Ms,{amount:A(pt).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",yne,[R(m(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},wne={class:"chart-action-wrap"},Cne={class:"chart-change-wrap"},kne={class:"chart-change"},Bne={class:"text"},xne={class:"chart-change"},Sne={class:"text"},Fne={__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),s=M(a.chartData);t({chartRef:l}),be(()=>a.chartData,$=>{s.value=$},{deep:!0});const i=De.colors.report,c=M(De.isDark()),p=N(()=>({textColor:c.value?"#ffffff":"#000000",borderColor:c.value?"#4a5a6b":"#c0c4ca",splitLineColor:c.value?"#253241":"#D6DAE1",bgColor:c.value?"#2d3748":"#ffffff"})),f=N(()=>c.value?i.dark_cyan_blue_16:i.light_gray),_=N(()=>s.value.map($=>Ts($.label))),g=N(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map($=>$.value),smooth:!1,color:f.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:f.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ya(f.value)},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let y=null;const v=()=>{y&&(y.dispose(),y=null),ke(()=>{l.value&&(y=aa(l.value),k())})},b=N(()=>ul(a.chartData.length)),k=()=>{if(!y)return;const $={legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:_.value,axisLabel:{color:p.value.textColor,fontSize:12,interval:b.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($,{notMerge:!0,replaceMerge:["series"]})},w=$=>{$?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}]}):k()};be([()=>s.value,()=>a.chartType,()=>De.isDark(),()=>a.loading],()=>{v()},{deep:!0}),be(()=>a.zoomIsActive,$=>{w($)});const S=()=>{c.value=De.isDark(),ke(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S),window.addEventListener("fluentCartCurrencyChange",k),ke(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),($,V)=>{const F=C("el-skeleton");return e.loading?(r(),E(F,{key:0,animated:"",rows:8})):(r(),h(H,{key:1},[s.value.length?(r(),h(H,{key:0},[s.value.length?(r(),h("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:l},null,512)):B("",!0),o("div",wne,[o("div",Cne,[o("div",kne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Bne,m($.$t("Data")),1)]),o("div",xne,[o("span",Sne,m($.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],64))}}},$ne={class:"fct-daily-signup-chart-wrap"},Ene={class:"fct-btn-group sm gap-2 lg:gap-0"},Une={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=M(ga.getChartType("subscription","daily_signups_chart")||"line"),l=M([]),s=M(""),i=M(!1),c=M(!0),p=_=>{c.value=!0,ue.get("reports/daily-signups",{params:{..._}}).then(g=>{l.value=g.signups,l.value.forEach(y=>{y.label=y.trend_date})}).finally(()=>c.value=!1)},f=_=>{ga.onChange("subscription","daily_signups_chart",_),a.value!==_&&(a.value=_)};return Ie(()=>{p(t.reportFilter.applicableFilters.params),t.reportFilter.addListener("daily-signup-chart",_=>{p(_.params)})}),(_,g)=>(r(),h("div",$ne,[n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Daily Signups"),title_size:"small",border_bottom:""},oa({_:2},[l.value.length&&!c.value?{name:"action",fn:d(()=>[o("div",Ene,[n(Nl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:f},null,8,["activeType"]),s.value?(r(),E(Fa,{key:0,targetRef:s.value.chartRef},null,8,["targetRef"])):B("",!0)])]),key:"0"}:void 0]),1032,["title"]),n(Ce,null,{default:d(()=>[n(Fne,{chartData:l.value,"chart-title":A(u)("Signups"),chartType:a.value,zoomIsActive:i.value,ref_key:"lineChartRef",ref:s,loading:c.value},null,8,["chartData","chart-title","chartType","zoomIsActive","loading"])]),_:1})]),_:1})]))}};const Ine={name:"Comparison",components:{CardContainer:Be,CardHeader:Qe,CardBody:Ce},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],s=t.count,i=l.count,c=i?((s-i)/i*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(l.group)}`,count:Aa(s),previous_count:Aa(i),percent_change:c})}}),e):this.currentMetrics}},methods:{translate:u,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,s]=t;return`${Pa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},Qne={class:"fct-revenue-comparison"},Dne={class:"inline-flex"},Vne={class:"inline-flex"};function Tne(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),f=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",Qne,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[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:d(()=>[n(f,{label:"Date"},{default:d(v=>[R(m(v.row.group),1)]),_:1}),n(f,{label:i.translate("Current Range")},{default:d(v=>[o("div",Dne,m(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(f,{label:i.translate("Compare Range")},{default:d(v=>[o("div",Vne,m(v.row.previous_count),1)]),_:1},8,["label"]),n(f,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},m(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Mne=lt(Ine,[["render",Tne]]),Lne={class:"fct-refund-report-page"};const Rne={__name:"SubscriptionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M({summary:{},fluctuations:{},currentMetrics:[],compareMetrics:[],loading:!0}),l=t.reportFilter,s=M("default"),i=N(()=>l.currentCurrencySign);l.applicableFilters;const c=M(""),p=M(""),f=N(()=>{var $;const w=(($=Gs.data)==null?void 0:$.productList)||[],S=c.value.toLowerCase();return w.filter(V=>V.product_name.toLowerCase().includes(S))}),_=N(()=>{var $;const w=(($=Gs.data)==null?void 0:$.customerList)||[],S=p.value.toLowerCase();return w.filter(V=>V.customer_name.toLowerCase().includes(S)||V.email.toLowerCase().includes(S))}),g=w=>{y(w),b(w)},y=(w,S="default")=>{a.value.loading=!0,ue.get("reports/subscription-chart",{params:{...w.params,groupKey:S}}).then($=>{a.value=$}).finally(()=>a.value.loading=!1)},v=w=>{s.value!==w&&(s.value=w,y(l.applicableFilters.params,w))},b=(w,S=null)=>{Gs.getRetentionChart({params:{...w.params,customDays:S}})},k=w=>{b(l.applicableFilters,w)};return Ie(()=>{l.addListener("subscription-report",w=>{g(w)}),g(l.applicableFilters)}),xt(()=>{l.removeListener("subscription-report")}),(w,S)=>{const $=C("el-col"),V=C("el-row"),F=C("el-input"),x=C("el-table-column"),Q=C("el-empty"),D=C("el-table");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",Lne,[n(bne,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:A(Gs),reportFilter:A(l),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),n(fne,{ref:"subscriptionChart",chartData:a.value.currentMetrics,compareData:a.value.compareMetrics,reportFilter:A(l),appliedGroupKey:s.value,onFilterData:v,"is-empty":!a.value.summary.total_subscriptions,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(Mne,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.compareMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(l),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(V,{gutter:30},{default:d(()=>[n($,{lg:12},{default:d(()=>[n(lne,{ref:"subscriptionChart",chartData:A(Gs).data.chartData,onFetchCustomChartData:k,"is-empty":!a.value.summary.total_subscriptions,loading:A(Gs).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),n($,{lg:12},{default:d(()=>[n(Une,{reportFilter:A(l),"is-empty":!a.value.summary.total_subscriptions},null,8,["reportFilter","is-empty"])]),_:1})]),_:1}),B("",!0),B("",!0),B("",!0),B("",!0)])]),_:1})}}},One={class:"fct-refund-report-page"},Hne={key:1},Pne={key:1,class:"fct-report-order-summary summary-col-2"},Nne={class:"summary-item-inner"},Kne={class:"value"},Gne={class:"inner-value"},jne=["innerHTML"],zne={class:"title"},qne={class:"fct-revenue-line-chart-wrap"},Yne={class:"flex items-center gap-2"},Wne={class:"fct-card-header-title is-small"},Jne={class:"fct-btn-group sm"},Xne={class:"chart-action-wrap"},Zne={class:"chart-change-wrap"},eoe={class:"chart-change"},toe={class:"text"},aoe={class:"chart-change"},loe={class:"text"},soe={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=M(!1),s=De.colors.report,i=M(De.isDark()),c=M(null);let p=null;const f=M({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=M(!0),g=(Q,D="monthly")=>{_.value=!0,ue.get("reports/future-renewals",{params:{...Q.params,groupKey:D}}).then(T=>{f.value=T}).finally(()=>_.value=!1)},y=(Q,D,T,U,I)=>({name:Q,type:D,barMaxWidth:30,yAxisIndex:T,data:U,smooth:!1,color:I,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:I,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ya(I)},lineStyle:{color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{p&&(p.dispose(),p=null),ke(()=>{c.value&&(p=aa(c.value),b())})},b=()=>{if(!p)return;const Q=Ml(f.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:Ul(i.value,s.dark_cyan_blue_16,s.light_gray_blue),confine:!0,position:gl,formatter:T=>{let U=T[0].name;return T.forEach((I,O)=>{const L=O===0?qa(I.value):Aa(I.value),P=i.value?"#ffffff":"#565865";U+=`<div>
218 ${I.marker}
219 <span style="color: ${P};">${I.seriesName}</span>
220 <span style="float: right; margin-left: 20px; color: ${P};">
221 ${L}
222 </span>
223 </div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:Q,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=>`${pt.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:$.value};p.setOption(D,{notMerge:!0,replaceMerge:["series"]})},k=()=>{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}]}):b()},w=()=>{i.value=De.isDark(),ke(()=>{b()})},S=N(()=>{const Q=Vs(f.value.period);return u("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+Q}),$=N(()=>[{name:u("Revenue"),key:"count",type:"line",color:i.value?s.blue_dark_mode:s.blue,data:f.value.projections.map(D=>D.projected_amount)},{name:u("Count"),key:"count",type:"bar",color:i.value?s.dark_cyan_blue_16:s.light_gray,data:f.value.projections.map(D=>D.renewals_count)}].map((D,T)=>y(D.name,D.type,T,D.data,D.color))),V=N(()=>ul(f.value.projections.length)),F=N(()=>[{title:u("Renewal Revenue"),value:pt.formatScaled(f.value.totalProjected),key:"renewal_revenue"},{title:u("Renewals"),value:Aa(f.value.totalRenewals),key:"renewals_count",no_currency:!0}]),x=N(()=>!f.value.totalRenewals);return be([()=>f.value],()=>{ke(b)},{deep:!0}),be(x,Q=>{Q||v()}),be(_,Q=>{Q||v()}),Ie(()=>{g(a.applicableFilters),ke(()=>{v()}),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",b)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1)}),(Q,D)=>{const T=C("el-skeleton");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",One,[n(nl,{title:A(u)("Subscription Future Revenue")},null,8,["title"])]),n(Be,null,{default:d(()=>[n(Ce,{class:"p-3"},{default:d(()=>[_.value?(r(),E(Pl,{key:0,loading:_.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),h("div",Hne,m(S.value),1))]),_:1})]),_:1}),_.value?(r(),E(Pl,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),h("div",Pne,[(r(!0),h(H,null,ae(F.value,(U,I)=>(r(),h("div",{class:"summary-item",key:I},[o("div",Nne,[o("div",Kne,[o("div",Gne,[o("span",{innerHTML:U.value},null,8,jne)])]),o("div",zne,m(U.title),1)])]))),128))])),o("div",qne,[n(Be,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Yne,[o("h4",Wne,m(A(u)("Upcoming Renewal Revenue")),1)])]),_:2},[f.value.totalRenewals&&!_.value?{name:"action",fn:d(()=>[o("div",Jne,[n(Ze,{tag:"button",size:"small",title:Q.$t("Zoom Chart"),onClick:k,class:de(l.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:c.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[_.value?(r(),E(T,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[x.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[x.value?B("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:c},null,512)),o("div",Xne,[o("div",Zne,[o("div",eoe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",toe,m(A(u)("Data")),1)]),o("div",aoe,[o("span",loe,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},noe={class:"fct-retention-lifetime"},ooe={class:"flex items-center gap-2"},ioe={class:"fct-card-header-title is-small"},roe={key:0},doe={class:"mt-2"},uoe={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=N(()=>{var s;return((s=t.data)==null?void 0:s.retention_data)??[]}),l=N(()=>{const s=a.value;if(!s.length)return null;const c=s.reduce((S,$)=>S+parseFloat($.retention_rate),0)/s.length,p=c/100;let f=0;p<1?f=1/(1-p):f=s.length;const _=s[s.length-1],g=parseInt(_.active_subscriptions),y=parseFloat(_.mrr);let v=0;g>0&&(v=y/g);const b=v*f,k=new Date(_.day),w=Pa[k.getMonth()]+" "+k.getFullYear().toString();return{expected_lifetime_text:u("Based on an average monthly subscription retention rate of %1$s, your expected subscription lifetime is %2$s months.",`${c.toFixed(1)}%`,f.toFixed(1)),ltv_text:u("In %1$s, your average monthly revenue per subscriber was %2$s, giving you an expected subscription lifetime value of %3$s.",w,pt.scaled(v),pt.scaled(b))}});return(s,i)=>{const c=C("el-skeleton");return r(),h("div",noe,[n(Be,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},{title:d(()=>[o("div",ooe,[o("h4",ioe,m(A(u)("Lifetime")),1)])]),_:1}),n(Ce,null,{default:d(()=>[e.loading?(r(),E(c,{key:0,animated:"",rows:1})):(r(),h(H,{key:1},[l.value?(r(),h("div",roe,[o("div",null,m(l.value.expected_lifetime_text),1),o("div",doe,m(l.value.ltv_text),1)])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Not enough data to calculate lifetime metrics."),class:"fct-report-empty-state"},null,8,["text"]))],64))]),_:1})]),_:1})])}}},coe={class:"summary-item-inner"},Aoe={class:"title text-[16px] mb-2.5"},poe={class:"grid grid-cols-2 items-center"},foe={class:"value"},moe={class:"sub-value mt-1.5"},hoe={class:"value"},_oe={class:"sub-value mt-1.5"},voe={class:"description leading-[1.6] mt-3.5"},goe={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=De.colors.report,l=M(De.isDark()),s=N(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=N(()=>{const p=s.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 b="",k=0,w=0;if(p.length>1){const D=p[p.length-2],T=new Date(D.day);b=Pa[T.getMonth()]+" "+T.getFullYear().toString(),k=parseInt(D.active_subscriptions),w=parseFloat(D.mrr)}else{const D=new Date(v.day);D.setMonth(D.getMonth()-1),b=Pa[D.getMonth()]+" "+D.getFullYear().toString();const T=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);k=v.retention_rate>0?Math.round(T/(v.retention_rate/100)):0;const U=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);w=v.retention_rate_money>0?U/(v.retention_rate_money/100):0}const S=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),$=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),V=parseFloat(v.retention_rate),F=parseFloat(v.retention_rate_money),x=new Date(v.day),Q=Pa[x.getMonth()]+" "+x.getFullYear().toString();return[{title:u("Subscription Retention"),value:`${V}%`,average_value:`${_}%`,month_name:Q,sub_title:u("Average in period"),description:u("You retained %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${v.retention_rate}%`,Aa(S),b,Aa(k)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Retention"),value:`${F}%`,average_value:`${y}%`,month_name:Q,sub_title:u("Average in period"),description:u("You retained %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${v.retention_rate_money}%`,pt.scaled($),b,pt.scaled(w)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=De.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,f)=>{var _,g;return e.loading?(r(),E(Pl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:de(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(H,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",coe,[o("div",Aoe,m(y.title),1),o("div",poe,[o("div",null,[o("div",foe,m(y.value),1),o("div",moe,m(y.month_name),1)]),o("div",null,[o("div",hoe,m(y.average_value),1),o("div",_oe,m(y.sub_title),1)])]),o("div",voe,m(y.description),1)])]))),128)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},yoe={class:"fct-revenue-line-chart-wrap"},boe={class:"flex items-center gap-2"},woe={class:"fct-card-header-title is-small"},Coe={class:"fct-btn-group sm"},koe={class:"chart-action-wrap"},Boe={class:"chart-change-wrap"},xoe={class:"chart-change"},Soe={class:"text"},Foe={class:"chart-change"},$oe={class:"text"},Eoe={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=M(!1),l=De.colors.report,s=M(De.isDark()),i=M(null);let c=null;const p=M(ga.getChartType("subscription","retention_chart")||"line"),f=(V,F,x,Q,D)=>({name:V,type:F,barMaxWidth:30,yAxisIndex:x,data:Q,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:Ya(D)},lineStyle:{color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),ke(()=>{i.value&&(c=aa(i.value),g())})},g=()=>{if(!c)return;const V=Ml(k.value),F={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:x=>{let Q=x[0].name;return x.forEach((D,T)=>{const U=Aa(D.value)+"%",I=s.value?"#ffffff":"#565865";Q+=`<div>
224 ${D.marker}
225 <span style="color: ${I};">${D.seriesName}</span>
226 <span style="float: right; margin-left: 20px; color: ${I};">
227 ${U}
228 </span>
229 </div>`}),Q}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:S.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:x=>`${x}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};c.setOption(F,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?c.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=()=>{s.value=De.isDark(),ke(()=>{g()})},b=V=>{ga.onChange("subscription","retention_chart",V),p.value!==V&&(a.value=!1,p.value=V,g())},k=N(()=>{var V;return((V=t.data)==null?void 0:V.retention_data)??[]}),w=N(()=>[{name:u("Subscription Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:k.value.map(F=>F.retention_rate)},{name:u("MRR Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:k.value.map(F=>F.retention_rate_money)}].map((F,x)=>f(F.name,F.type,0,F.data,F.color))),S=N(()=>ul(k.value.length)),$=N(()=>!k.value||!k.value.length);return be([()=>t.data],()=>{ke(_)},{deep:!0}),be($,V=>{V||_()}),be(t.loading,V=>{V||_()}),Ie(()=>{ke(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(V,F)=>{const x=C("el-skeleton");return r(),h("div",yoe,[n(Be,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",boe,[o("h4",woe,m(A(u)("Retention Rate")),1)])]),_:2},[!$.value&&!e.loading?{name:"action",fn:d(()=>[o("div",Coe,[n(Nl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:b},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:V.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(x,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[$.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[$.value?B("",!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",koe,[o("div",Boe,[o("div",xoe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Soe,m(A(u)("Data")),1)]),o("div",Foe,[o("span",$oe,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Uoe={class:"summary-item-inner"},Ioe={class:"title text-[16px] mb-2.5"},Qoe={class:"grid grid-cols-2 items-center"},Doe={class:"value"},Voe={class:"sub-value mt-1.5"},Toe={class:"value"},Moe={class:"sub-value mt-1.5"},Loe={class:"description leading-[1.6] mt-3.5"},Roe={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=De.colors.report,l=M(De.isDark()),s=N(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=N(()=>{const p=s.value;if(!p.length)return[];const f=p.map((T,U)=>{const I=U>0?parseInt(p[U-1].active_subscriptions)||0:parseInt(T.active_subscriptions)-parseInt(T.new_subscriptions)||0,O=parseInt(T.churned_subscriptions)||0;return I>0?O/I*100:0}),_=p.map((T,U)=>{const I=U>0?parseFloat(p[U-1].mrr)||0:parseFloat(T.mrr)-parseFloat(T.new_subscriptions_mrr)||0,O=parseFloat(T.churned_subscriptions_mrr)||0;return I>0?O/I*100:0}),g=(f.reduce((T,U)=>T+U,0)/f.length).toFixed(1),y=(_.reduce((T,U)=>T+U,0)/_.length).toFixed(1),v=p[p.length-1],b=p.length-1,k=b>0?parseInt(p[b-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,w=b>0?parseFloat(p[b-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,S=parseInt(v.churned_subscriptions)||0,$=parseFloat(v.churned_subscriptions_mrr)||0,V=k>0?(S/k*100).toFixed(1):0,F=w>0?($/w*100).toFixed(1):0,x=new Date(v.day),Q=Pa[x.getMonth()]+" "+x.getFullYear().toString();let D="";if(p.length>1){const T=p[p.length-2],U=new Date(T.day);D=Pa[U.getMonth()]+" "+U.getFullYear().toString()}else{const T=new Date(v.day);T.setMonth(T.getMonth()-1),D=Pa[T.getMonth()]+" "+T.getFullYear().toString()}return[{title:u("Subscription Churn"),value:`${V}%`,average_value:`${g}%`,month_name:Q,sub_title:u("Average in period"),description:u("You lost %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${V}%`,Aa(S),D,Aa(k)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Churn"),value:`${F}%`,average_value:`${y}%`,month_name:Q,sub_title:u("Average in period"),description:u("You lost %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${F}%`,pt.scaled($),D,pt.scaled(w)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=De.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,f)=>{var _,g;return e.loading?(r(),E(Pl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:de(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(H,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",Uoe,[o("div",Ioe,m(y.title),1),o("div",Qoe,[o("div",null,[o("div",Doe,m(y.value),1),o("div",Voe,m(y.month_name),1)]),o("div",null,[o("div",Toe,m(y.average_value),1),o("div",Moe,m(y.sub_title),1)])]),o("div",Loe,m(y.description),1)])]))),128)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},Ooe={class:"fct-revenue-line-chart-wrap"},Hoe={class:"flex items-center gap-2"},Poe={class:"fct-card-header-title is-small"},Noe={class:"fct-btn-group sm"},Koe={class:"chart-action-wrap"},Goe={class:"chart-change-wrap"},joe={class:"chart-change"},zoe={class:"text"},qoe={class:"chart-change"},Yoe={class:"text"},Woe={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=M(!1),l=De.colors.report,s=M(De.isDark()),i=M(null);let c=null;const p=M(ga.getChartType("subscription","churn_chart")||"line"),f=(V,F,x,Q,D)=>({name:V,type:F,barMaxWidth:30,yAxisIndex:x,data:Q,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:Ya(D)},lineStyle:{color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),ke(()=>{i.value&&(c=aa(i.value),g())})},g=()=>{if(!c)return;const V=Ml(k.value),F={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:x=>{let Q=x[0].name;return x.forEach((D,T)=>{const U=Aa(D.value)+"%",I=s.value?"#ffffff":"#565865";Q+=`<div>
230 ${D.marker}
231 <span style="color: ${I};">${D.seriesName}</span>
232 <span style="float: right; margin-left: 20px; color: ${I};">
233 ${U}
234 </span>
235 </div>`}),Q}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:S.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:x=>`${x}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};c.setOption(F,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?c.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=()=>{s.value=De.isDark(),ke(()=>{g()})},b=V=>{ga.onChange("subscription","churn_chart",V),p.value!==V&&(a.value=!1,p.value=V,g())},k=N(()=>{var V;return((V=t.data)==null?void 0:V.retention_data)??[]}),w=N(()=>{const V=k.value.map((Q,D)=>{const T=D>0?parseInt(k.value[D-1].active_subscriptions)||0:parseInt(Q.active_subscriptions)-parseInt(Q.new_subscriptions)||0,U=parseInt(Q.churned_subscriptions)||0;return T>0?(U/T*100).toFixed(2):0}),F=k.value.map((Q,D)=>{const T=D>0?parseFloat(k.value[D-1].mrr)||0:parseFloat(Q.mrr)-parseFloat(Q.new_subscriptions_mrr)||0,U=parseFloat(Q.churned_subscriptions_mrr)||0;return T>0?(U/T*100).toFixed(2):0});return[{name:u("Subscription Churn"),type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:V},{name:u("MRR Churn"),type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:F}].map((Q,D)=>f(Q.name,Q.type,0,Q.data,Q.color))}),S=N(()=>ul(k.value.length)),$=N(()=>!k.value||!k.value.length);return be([()=>t.data],()=>{ke(_)},{deep:!0}),be($,V=>{V||_()}),be(t.loading,V=>{V||_()}),Ie(()=>{ke(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(V,F)=>{const x=C("el-skeleton");return r(),h("div",Ooe,[n(Be,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Hoe,[o("h4",Poe,m(A(u)("Churn Rate")),1)])]),_:2},[!$.value&&!e.loading?{name:"action",fn:d(()=>[o("div",Noe,[n(Nl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:b},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:V.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(x,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[$.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[$.value?B("",!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",Koe,[o("div",Goe,[o("div",joe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",zoe,m(A(u)("Data")),1)]),o("div",qoe,[o("span",Yoe,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Joe={class:"fct-retention-report-page"},Xoe={class:"page-title"},Zoe={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=M({retention_data:[]}),s=M(!0),i=(c,p="monthly")=>{s.value=!0,ue.get("reports/subscription-retention",{params:{...c.params,groupKey:p}}).then(f=>{l.value=f}).finally(()=>s.value=!1)};return Ie(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(c,p)=>{const f=C("el-tooltip");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",Joe,[n(nl,null,{title:d(()=>[o("h1",Xoe,[R(m(A(u)("Subscription Retention"))+" ",1),n(f,{"popper-class":"fct-tooltip",content:A(u)("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:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),n(goe,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Eoe,{data:l.value,loading:s.value},null,8,["data","loading"]),n(uoe,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Roe,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Woe,{data:l.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},eie={key:1,class:"fct-report-order-summary"},tie={class:"summary-item-inner"},aie={class:"value"},lie={class:"inner-value"},sie={class:"title"},nie={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:u("Customer Growth"),key:"customer_count"}],l=N(()=>t.customerReport.loading),s=N(()=>a.map(i=>({key:i.key,title:i.title,value:t.customerReport.summary[i.key],fluctuation:t.customerReport.fluctuations[i.key]})));return(i,c)=>l.value?(r(),E(Pl,{key:0,count:s.value.length},null,8,["count"])):(r(),h("div",eie,[(r(!0),h(H,null,ae(s.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",tie,[o("div",aie,[o("div",lie,m(A(Aa)(p.value)),1),n(ml,{fluctuation:p.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[p.key]},null,8,["fluctuation","amount"])]),o("div",sie,m(p.title),1)])]))),128))]))}},oie={class:"fct-revenue-line-chart-wrap"},iie={class:"flex items-center gap-2"},rie={class:"fct-card-header-title is-small"},die={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},uie={class:"chart-action-wrap"},cie={class:"chart-change-wrap"},Aie={class:"chart-change"},pie={class:"text"},fie={class:"chart-change"},mie={class:"text"},hie={__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),s=M(ga.getChartType("revenue","revenue_chart")||"line"),i=M(!1),c=De.colors.report,p=M(De.isDark()),f=(T,U,I,O,L)=>({name:T,type:U,barMaxWidth:30,yAxisIndex:I,data:O,smooth:!1,color:L,lineStyle:{width:3},areaStyle:{opacity:.3,color:L},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ya(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M(a.appliedGroupKey);be(()=>a.appliedGroupKey,T=>{_.value=T});const{groupKeys:g}=An(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},b=N(()=>a.reportFilter.data.compareType!=="no_comparison"),k=N(()=>{var U;let T=[{name:u("Current Range"),key:"customer_count",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(I=>I.customer_count)}];return b.value&&T.unshift({name:u("Compare Range"),key:"customer_count",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:(U=a.compareData)==null?void 0:U.map(I=>({value:I.customer_count,date:I.group}))}),T.map(I=>f(I.name,I.type,0,I.data,I.color))});let w=null;const S=()=>{w&&(w.dispose(),w=null),ke(()=>{l.value&&(w=aa(l.value),F())})},$=N(()=>{const T=Vs(a.reportFilter.data.dateRange);return u("Customers that first ordered ")+T}),V=N(()=>ul(a.chartData.length)),F=()=>{if(!w)return;const T=Ml(a.chartData),U={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?c.dark_cyan_blue_16:c.light_gray_blue}},alwaysShowContent:!1,formatter:I=>{let O="";const L=p.value?"#ffffff":"#565865";return I.forEach(function(P,q){const X=typeof P.data=="object"&&P.data!==null,G=X?Ts(P.data.date):P.name,te=X?P.data.value:P.value,ne=I.length>1&&q===0;ne&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${G}</div>`,O+=`<div>
236 ${P.marker}
237 <span style="color: ${L}">${u("Customer")}</span>
238 <span style="float: right; margin-left: 20px; color: ${L}">
239 ${Aa(te)}
240 </span>
241 </div>`,ne&&(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:k.value};w.setOption(U,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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()},Q=T=>{ga.onChange("revenue","revenue_chart",T),s.value!==T&&(i.value=!1,s.value=T,F())};be([()=>a.chartData,_],()=>{ke(F)},{deep:!0}),be(()=>Hl.data.revenue,()=>{ke(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,T=>{T||S()}),be(()=>a.loading,T=>{T||S()});const D=()=>{p.value=De.isDark(),ke(()=>{F()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",D),ke(()=>{S()})}),(T,U)=>{const I=C("el-tooltip"),O=C("el-option"),L=C("el-select"),P=C("el-skeleton");return r(),h("div",oie,[n(Be,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",iie,[o("h5",rie,m(A(u)("New Customers")),1),n(I,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",die,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=q=>_.value=q),onChange:v},{default:d(()=>[(r(!0),h(H,null,ae(A(g),q=>(r(),E(O,{key:q.value,label:A(u)(q.label),value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(Nl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:x,class:de(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:6,class:"p-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[o("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512),o("div",uie,[o("div",cie,[o("div",Aie,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",pie,m(A(u)("Data")),1)]),o("div",fie,[o("span",mie,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},_ie={name:"Comparison",components:{CardContainer:Be,CardHeader:Qe,CardBody:Ce},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 s=this.previousMetrics[a],i=t.customer_count,c=s.customer_count,p=c?((i-c)/c*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(s.group)}`,count:i,previous_count:c,percent_change:p})}}),e):this.currentMetrics}},methods:{translate:u,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,s]=t;return`${Pa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},vie={class:"fct-revenue-comparison"},gie={class:"inline-flex"},yie={class:"inline-flex"};function bie(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),f=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",vie,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[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:d(()=>[n(f,{label:"Date"},{default:d(v=>[R(m(v.row.group),1)]),_:1}),n(f,{label:i.translate("Current Range")},{default:d(v=>[o("div",gie,m(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(f,{label:i.translate("Compare Range")},{default:d(v=>[o("div",yie,m(v.row.previous_count),1)]),_:1},8,["label"]),n(f,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},m(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const wie=lt(_ie,[["render",bie]]),Cie={class:"fct-customer-report-page"},kie={__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"),s=t.reportFilter,i=s.applicableFilters.params,c=(f,_="default")=>{a.value.loading=!0,ue.get("reports/customer-report",{params:{...f,groupKey:_}}).then(g=>{a.value=g}).finally(()=>{a.value.loading=!1})},p=f=>{l.value!==f&&(l.value=f,c(i,f))};return Ie(()=>{c(i),t.reportFilter.addListener("customer-report",f=>{c(f.params,l.value)})}),(f,_)=>(r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",Cie,[n(nl,{title:A(u)("Customers")},null,8,["title"]),n(nie,{reportFilter:A(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),n(hie,{chartData:a.value.currentMetrics,compareData:a.value.previousMetrics,reportFilter:A(s),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"]),n(wie,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(s),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"])])]),_:1}))}},Bie="source_report";class xie extends Za{constructor(a={}){super();Re(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 Bie}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 Ge.get("app_config.isProActive")}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}isUsingSimpleFilter(){return this.data.filterType==="simple"}getAdvanceFilterOptions(){return it.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||Tc.showFeaturesCTA(u("Advanced Filter"),u("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 Sie={class:"fct-revenue-report-page"},Fie={class:"fct-revenue-comparison fct-table-wrapper"},$ie={class:"fct-card"},Eie={class:"fct-card-header"},Uie={class:"fct-card-header-top"},Iie={key:0,class:"fct-card-header-left flex-1"},Qie={class:"search-bar is-transparent"},Die={class:"text-xs text-system-light pt-1 dark:text-gray-300"},Vie={key:1,class:"flex-1"},Tie={class:"fct-card-header-actions"},Mie={key:0,class:"fct-advanced-filter-toggle-wrapper"},Lie={class:"w-[130px]"},Rie={class:"fct-btn-group sm"},Oie={class:"filter-popover-item"},Hie={class:"filter-popover-title"},Pie={class:"fct-card-body"},Nie={key:1},Kie={key:2,class:"unknown"},Gie={key:1},jie={key:2,class:"unknown"},zie={key:1},qie={key:2,class:"unknown"},Yie={key:1},Wie={key:2,class:"unknown"},Jie={key:1},Xie={key:2,class:"unknown"},Zie={key:1},ere={key:2,class:"unknown"},tre={class:"inline-flex items-center gap-2"},are={class:"inline-flex items-center gap-2"},lre={class:"inline-flex items-center gap-2"},sre={class:"inline-flex items-center gap-2"},nre={class:"inline-flex items-center gap-2"},ore=4,ire={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M([]),l=M({}),s=M(!1),i=M({utm_campaign:u("UTM Campaign"),utm_source:u("UTM Source"),utm_medium:u("UTM Medium"),utm_term:u("UTM Term"),utm_content:u("UTM Content"),utm_id:u("UTM ID")}),c=M(["utm_campaign","utm_source","utm_medium"]),p=M(!0),f=M(""),_=N(()=>a.value.filter(S=>{if(!f.value)return!0;const $=f.value.toLowerCase();return S.utm_campaign&&S.utm_campaign.toLowerCase().includes($)||S.utm_source&&S.utm_source.toLowerCase().includes($)||S.utm_medium&&S.utm_medium.toLowerCase().includes($)||S.utm_term&&S.utm_term.toLowerCase().includes($)||S.utm_content&&S.utm_content.toLowerCase().includes($)||S.utm_id&&S.utm_id.toLowerCase().includes($)}));let g=0;const y=()=>{const S=++g;p.value=!0;const $={params:{...t.reportFilter.applicableFilters.params,...v.getQueryParams()}};ue.get("/reports/sources",$).then(V=>{S===g&&(a.value=V.sourceReportData,l.value=V.fluctuations||{})}).catch(V=>{var F;S===g&&z.error(((F=V==null?void 0:V.data)==null?void 0:F.message)||u("Failed to load the order sources report"))}).finally(()=>{S===g&&(p.value=!1)})},v=xie.init({instance:Yt(),onApply:()=>y()}),b=N(()=>!v.isUsingAdvanceFilter()),k=S=>{S==="advanced"&&(f.value=""),v.onFilterTypeChanged(S)},w=S=>c.value.includes(S)?!1:c.value.length>=ore;return Ie(()=>{y(),t.reportFilter.addListener("product-top-chart",()=>{y()})}),(S,$)=>{const V=C("el-input"),F=C("el-switch"),x=C("el-checkbox"),Q=C("el-checkbox-group"),D=C("el-tooltip"),T=C("el-popover"),U=C("el-skeleton"),I=C("el-table-column"),O=C("el-table");return r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",Sie,[n(nl,{title:A(u)("Order Sources")},null,8,["title"]),o("div",Fie,[o("div",$ie,[o("div",Eie,[o("div",Uie,[A(v).isUsingAdvanceFilter()?(r(),h("div",Vie)):(r(),h("div",Iie,[o("div",Qie,[n(V,{placeholder:A(u)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:f.value,"onUpdate:modelValue":$[0]||($[0]=L=>f.value=L)},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",Die,m(A(u)("Filter results by UTM values")),1)])),o("div",Tie,[A(v).isAdvanceFilterEnabled()?(r(),h("div",Mie,[n(F,{class:"fct-advanced-filter-toggle",onChange:$[1]||($[1]=L=>{k(L)}),"active-value":"advanced","inactive-value":"simple",modelValue:A(v).data.filterType,"onUpdate:modelValue":$[2]||($[2]=L=>A(v).data.filterType=L),"active-text":A(u)("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):B("",!0),o("div",Lie,[n(F,{modelValue:s.value,"onUpdate:modelValue":$[3]||($[3]=L=>s.value=L),"active-text":A(u)("Net"),"inactive-text":A(u)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),o("div",Rie,[n(T,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(D,{effect:"light",content:A(u)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button"},{default:d(()=>[n(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",Oie,[o("h3",Hie,m(S.$t("Columns")),1),n(Q,{class:"fct-checkbox-blocks",modelValue:c.value,"onUpdate:modelValue":$[4]||($[4]=L=>c.value=L)},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(L,P)=>(r(),E(x,{label:L,value:P,disabled:w(P)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])]),n(Mc,{table:A(v),"show-save-view":!1},null,8,["table"])]),o("div",Pie,[p.value?(r(),E(U,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),E(O,{key:1,data:_.value,class:"w-full fct-source-report"},{empty:d(()=>[n(wt,{icon:"Empty/Order","has-dark":"",text:A(u)("No data available")},null,8,["text"])]),default:d(()=>[c.value.includes("utm_campaign")?(r(),E(I,{key:0,label:A(u)("UTM Campaign"),width:"180"},{default:d(L=>[L.row.utm_campaign&&b.value?(r(),E(A(Ls),{key:0,class:"font-normal",underline:"always",onClick:P=>f.value=L.row.utm_campaign},{default:d(()=>[R(m(L.row.utm_campaign),1)]),_:2},1032,["onClick"])):L.row.utm_campaign?(r(),h("span",Nie,m(L.row.utm_campaign),1)):(r(),h("span",Kie,m(A(u)("Unknown")),1))]),_:1},8,["label"])):B("",!0),c.value.includes("utm_source")?(r(),E(I,{key:1,label:A(u)("UTM Source"),width:"150"},{default:d(L=>[L.row.utm_source&&b.value?(r(),E(A(Ls),{key:0,class:"font-normal",underline:"always",onClick:P=>f.value=L.row.utm_source},{default:d(()=>[R(m(L.row.utm_source),1)]),_:2},1032,["onClick"])):L.row.utm_source?(r(),h("span",Gie,m(L.row.utm_source),1)):(r(),h("span",jie,m(A(u)("Unknown")),1))]),_:1},8,["label"])):B("",!0),c.value.includes("utm_medium")?(r(),E(I,{key:2,label:A(u)("UTM Medium"),width:"150"},{default:d(L=>[L.row.utm_medium&&b.value?(r(),E(A(Ls),{key:0,class:"font-normal",underline:"always",onClick:P=>f.value=L.row.utm_medium},{default:d(()=>[R(m(L.row.utm_medium),1)]),_:2},1032,["onClick"])):L.row.utm_medium?(r(),h("span",zie,m(L.row.utm_medium),1)):(r(),h("span",qie,m(A(u)("Unknown")),1))]),_:1},8,["label"])):B("",!0),c.value.includes("utm_term")?(r(),E(I,{key:3,label:A(u)("UTM Term"),width:"150"},{default:d(L=>[L.row.utm_term&&b.value?(r(),E(A(Ls),{key:0,class:"font-normal",underline:"always",onClick:P=>f.value=L.row.utm_term},{default:d(()=>[R(m(L.row.utm_term),1)]),_:2},1032,["onClick"])):L.row.utm_term?(r(),h("span",Yie,m(L.row.utm_term),1)):(r(),h("span",Wie,m(A(u)("Unknown")),1))]),_:1},8,["label"])):B("",!0),c.value.includes("utm_content")?(r(),E(I,{key:4,label:A(u)("UTM Content"),width:"150"},{default:d(L=>[L.row.utm_content&&b.value?(r(),E(A(Ls),{key:0,class:"font-normal",underline:"always",onClick:P=>f.value=L.row.utm_content},{default:d(()=>[R(m(L.row.utm_content),1)]),_:2},1032,["onClick"])):L.row.utm_content?(r(),h("span",Jie,m(L.row.utm_content),1)):(r(),h("span",Xie,m(A(u)("Unknown")),1))]),_:1},8,["label"])):B("",!0),c.value.includes("utm_id")?(r(),E(I,{key:5,label:A(u)("UTM ID"),width:"100"},{default:d(L=>[L.row.utm_id&&b.value?(r(),E(A(Ls),{key:0,class:"font-normal",underline:"always",onClick:P=>f.value=L.row.utm_id},{default:d(()=>[R(m(L.row.utm_id),1)]),_:2},1032,["onClick"])):L.row.utm_id?(r(),h("span",Zie,m(L.row.utm_id),1)):(r(),h("span",ere,m(A(u)("Unknown")),1))]),_:1},8,["label"])):B("",!0),n(I,{label:A(u)("Orders"),width:"200"},{default:d(L=>{var P,q;return[o("div",tre,[R(m(A(Aa)(L.row.orders))+" ",1),n(ml,{class:"flex",fluctuation:((P=l.value[L.row.utm_key])==null?void 0:P.orders_fluctuation)||0,amount:((q=l.value[L.row.utm_key])==null?void 0:q.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s.value?(r(),h(H,{key:6},[n(I,{label:A(u)("Net Sales"),width:"200"},{default:d(L=>{var P,q;return[o("div",are,[R(m(A(pt).scaled(L.row.net_sales))+" ",1),n(ml,{class:"flex",fluctuation:((P=l.value[L.row.utm_key])==null?void 0:P.net_sales_fluctuation)||0,amount:((q=l.value[L.row.utm_key])==null?void 0:q.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(I,{label:A(u)("Average Order Net"),width:"200"},{default:d(L=>{var P,q;return[o("div",lre,[R(m(A(pt).scaled(L.row.average_net_order))+" ",1),n(ml,{class:"flex",fluctuation:((P=l.value[L.row.utm_key])==null?void 0:P.average_net_order_fluctuation)||0,amount:((q=l.value[L.row.utm_key])==null?void 0:q.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),h(H,{key:7},[n(I,{label:A(u)("Gross Sales"),width:"200"},{default:d(L=>{var P,q;return[o("div",sre,[R(m(A(pt).scaled(L.row.gross_sales))+" ",1),n(ml,{class:"flex",fluctuation:((P=l.value[L.row.utm_key])==null?void 0:P.gross_sales_fluctuation)||0,amount:((q=l.value[L.row.utm_key])==null?void 0:q.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(I,{label:A(u)("Average Order"),width:"200"},{default:d(L=>{var P,q;return[o("div",nre,[R(m(A(pt).scaled(L.row.average_order))+" ",1),n(ml,{class:"flex",fluctuation:((P=l.value[L.row.utm_key])==null?void 0:P.average_order_fluctuation)||0,amount:((q=l.value[L.row.utm_key])==null?void 0:q.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},rre={class:"fct-revenue-line-chart-wrap"},dre={class:"flex items-center gap-2"},ure={class:"fct-card-header-title is-small"},cre={class:"fct-chart-select"},Are={class:"fct-btn-group sm"},pre={class:"chart-action-wrap"},fre={class:"chart-change-wrap"},mre={class:"chart-change"},hre={class:"text"},_re={class:"chart-change"},vre={class:"text"},gre={__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),s=M(ga.getChartType("product","product_chart")||"bar"),i=M(!1),c=De.colors.report,p=M(De.isDark()),f=(U,I,O,L,P)=>({name:U,type:I,barMaxWidth:30,yAxisIndex:O,data:L,smooth:!1,color:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:P},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:P,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ya(P)},lineStyle:{color:P},areaStyle:{opacity:.3,color:P}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=M("default"),{groupKeys:g}=An(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},b=N(()=>a.reportFilter.data.compareType!=="no_comparison"),k=N(()=>{let U=[{name:u("Current Range"),key:"units_sold",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(I=>I.units_sold)}];return b.value&&U.unshift({name:u("Compare Range"),key:"units_sold",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(I=>({value:I.units_sold,date:I.group}))}),U.map(I=>f(I.name,I.type,0,I.data,I.color))});let w=null;const S=()=>{w&&(w.dispose(),w=null),ke(()=>{l.value&&(w=aa(l.value),F())})},$=N(()=>{const U=Vs(a.reportFilter.data.dateRange);return u("This report looks at the units sold ")+U}),V=N(()=>ul(a.chartData.length)),F=()=>{if(!w)return;const U=Ml(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?c.dark_cyan_blue_16:c.light_gray_blue}},formatter:O=>{let L="";const P=p.value?"#ffffff":"#565865";return O.forEach(function(q,X){const G=typeof q.data=="object"&&q.data!==null,te=G?Ts(q.data.date):q.name,ne=G?q.data.value:q.value,re=O.length>1&&X===0;re&&(L+='<div style="margin-bottom: 10px">'),L+=`<div>${te}</div>`,L+=`<div>
242 ${q.marker}
243 <span style="color: ${P}">${u("Units Sold")}</span>
244 <span style="float: right; margin-left: 20px; color: ${P}">
245 ${Aa(ne)}
246 </span>
247 </div>`,re&&(L+="</div>")}),L}},grid:{show:!1},xAxis:{type:"category",data:U,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:k.value};w.setOption(I,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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()},Q=U=>{ga.onChange("revenue","revenue_chart",U),s.value!==U&&(i.value=!1,s.value=U,F())};be([()=>a.chartData,_],()=>{ke(()=>{F()})},{deep:!0}),be(()=>Hl.data.product,()=>{ke(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,U=>{U||S()}),be(()=>a.loading,U=>{U||S()});const D=()=>{w&&w.resize()},T=()=>{p.value=De.isDark(),ke(()=>{F()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("resize",D),setTimeout(()=>{S()},100)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("resize",D),w&&(w.dispose(),w=null)}),(U,I)=>{const O=C("el-tooltip"),L=C("el-option"),P=C("el-select"),q=C("el-skeleton");return r(),h("div",rre,[n(Be,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",dre,[o("h5",ure,m(A(u)("Product Report Chart")),1),n(O,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",cre,[n(P,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=X=>_.value=X),onChange:v},{default:d(()=>[(r(!0),h(H,null,ae(A(g),X=>(r(),E(L,{key:X.value,label:A(u)(X.label),value:X.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",Are,[n(Nl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:x,class:de(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(q,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?B("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:l},null,512)),o("div",pre,[o("div",fre,[o("div",mre,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",hre,m(A(u)("Data")),1)]),o("div",_re,[o("span",vre,m(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},yre=lt(gre,[["__scopeId","data-v-8add5f1e"]]);class bre extends Za{constructor(){super(...arguments);Re(this,"data",{summary:{},previousSummary:{},fluctuations:{},isBusy:!0,currentMetrics:[],previousMetrics:[],chartData:[],topSoldProducts:[]})}get controllerKey(){return"ProductReportController"}makeRequest(a,l,s,i){this.data.isBusy=!0,typeof l!="object"&&(l={});const c=ue.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=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 wl=bre.init(),wre={class:"summary-item-inner"},Cre={class:"value"},kre={class:"inner-value"},Bre={class:"title"},xre={__name:"Summary",props:{reportFilter:{type:Object}},setup(e){e.reportFilter;const a=[{title:"Units Sold",key:"units_sold",info:u("The total number of units sold in this period.")},{title:"Gross Sale",key:"gross_sale",hasCurrency:!0,info:u("The total sales you had in this period.")},{title:"Refunds",key:"total_refunds",hasCurrency:!0,liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:"Revenue",key:"net_sale",hasCurrency:!0,info:u("Gross sales less refunds, taxes, shipping, fees.")}],l=N(()=>wl.data.isBusy),s=N(()=>a.map(p=>({key:p.key,title:p.title,value:wl.data.summary[p.key]||0,fluctuation:wl.data.fluctuations[p.key]||0,info:p.info,liability:p.liability||!1,hasCurrency:p.hasCurrency||!1}))),i=N(()=>a.filter(p=>p.hasCurrency).map(p=>p.key)),c=p=>i.value.includes(p.key)?$l(p.value,p.liability):Aa(p.value);return(p,f)=>{const _=C("el-tooltip");return l.value?(r(),E(Pl,{key:0,loading:l.value,count:s.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:de(["fct-report-order-summary",l.value?"":"summary-col-4"])},[(r(!0),h(H,null,ae(s.value,(g,y)=>(r(),h("div",{class:"summary-item",key:y},[o("div",wre,[o("div",Cre,[o("div",kre,[n(Ms,{amount:c(g),title:g.title},null,8,["amount","title"])]),n(ml,{fluctuation:g.fluctuation,amount:A(wl).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",Bre,[R(m(A(u)(g.title))+" ",1),n(_,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},Sre={class:"fct-product-performance-chart"},Fre={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},$re={class:"flex items-center gap-3 flex-wrap"},Ere={class:"selector-group"},Ure={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"},Ire={class:"selector-group"},Qre={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"},Dre={class:"text-xs font-medium text-gray-500"},Vre={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"},Tre={class:"text-xs font-medium text-gray-500"},Mre={key:0,class:"comparison-results"},Lre={class:"legend flex items-center gap-4 mb-4"},Rre={class:"flex items-center"},Ore={class:"text-xs text-gray-600"},Hre={class:"flex items-center"},Pre={class:"text-xs text-gray-600"},Nre={class:"comparison-table"},Kre={class:"w-full"},Gre={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},jre={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"},zre={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"},qre={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"},Yre={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Wre={class:"py-3"},Jre={class:"dual-bar-container"},Xre={class:"bar-label"},Zre={class:"dual-bar-wrapper"},ede=["onMouseenter"],tde=["onMouseenter"],ade={class:"py-3 text-right"},lde={key:0},sde={colspan:"3",class:"py-4 text-center text-gray-500"},nde={class:"text-sm"},ode={key:1,class:"current-period-data"},ide={class:"legend flex items-center gap-4 mb-4"},rde={class:"flex items-center"},dde={class:"text-xs text-gray-600"},ude={class:"current-period-table"},cde={class:"w-full"},Ade={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},pde={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"},fde={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"},mde={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},hde={class:"py-3"},_de={class:"single-bar-container"},vde=["onMouseenter"],gde={class:"single-bar-wrapper"},yde=["onMouseenter"],bde={key:0},wde={colspan:"2",class:"py-4 text-center text-gray-500"},Cde={class:"text-sm"},kde={key:2,class:"no-comparison-message"},Bde={class:"flex flex-col items-center justify-center text-center py-8"},xde={class:"text-gray-500 text-sm"},Sde={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){Lf(W=>({38870964:a.value?"#1C2732":"#F9FAFB","38e9f3a8":P.value,"71ec137a":q.value,"2fc09a58":X.value}));const t=e,a=M(De.isDark()),l=M(!0);Ie(()=>{i(),t.reportFilter.addListener("product-top-chart",()=>{i()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=De.isDark()})}),M({});const s=M({}),i=()=>{l.value=!0;const W=t.reportFilter.applicableFilters;ue.get("reports/product-performance",W).then(j=>{s.value=j.productPerformance,b(),V(!0)}).finally(()=>l.value=!1)},c=N(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),p=M(""),f=M(""),_=M(""),g=M(""),y=W=>W.sort((j,ie)=>et(j.value).diff(et(ie.value))),v=M([]),b=()=>{const W=new Set;Object.keys(s.value).forEach(j=>{const ie=j.split("-")[0];W.add(ie)}),v.value=Array.from(W).sort()},k=W=>{if(!W)return[];const j=[];return Object.keys(s.value).forEach(ie=>{ie.startsWith(W)&&j.push({value:ie,label:et(ie).format("MMMM")})}),y(j)},w=N(()=>{if(!p.value||!_.value)return!1;const W=!!f.value,j=!!g.value;return!W&&!j?p.value!==_.value:W&&j?f.value!==g.value:!0}),S=N(()=>f.value?et(f.value).format("MMM YYYY"):p.value),$=N(()=>g.value?et(g.value).format("MMM YYYY"):_.value),V=(W=!1)=>{const j=v.value;if(j.length){if(!p.value||W){p.value=j[0];const ie=k(p.value);ie.length&&(f.value=ie[0].value)}if(!_.value||W){_.value=j[j.length-1];const ie=k(_.value);ie.length&&(g.value=ie[ie.length-1].value)}}},F=W=>s.value[W]||[],x=W=>{const j={};Object.entries(s.value).forEach(([he,me])=>{he.startsWith(W)&&me.forEach(ye=>{j[ye.name]||(j[ye.variation_id]={...ye,value:0}),j[ye.variation_id].value+=ye.value})});const ie=[];return Object.values(j).forEach(he=>{ie.push(he)}),ie},Q=(W,j)=>j?F(j):(x(W),x(W)),D=N(()=>p.value?[...Q(p.value,f.value)].sort((j,ie)=>ie.value-j.value):[]),T=N(()=>D.value.length?Math.max(...D.value.map(W=>W.value))*1.1:100),U=W=>W===0||T.value===0?0:W/T.value*100,I=N(()=>{if(!w.value)return[];const W=Q(p.value,f.value),j=Q(_.value,g.value),ie=new Set;return W.forEach(ye=>ie.add(ye.variation_id)),j.forEach(ye=>ie.add(ye.variation_id)),Array.from(ie).map(ye=>{const se=W.find(Je=>Je.variation_id===ye),fe=(se==null?void 0:se.value)||0,$e=j.find(Je=>Je.variation_id===ye),tt=($e==null?void 0:$e.value)||0;let ve=0;return fe>0?ve=(tt-fe)/fe*100:tt>0&&(ve=100),{name:(se==null?void 0:se.name)||($e==null?void 0:$e.name)||"",post_title:(se==null?void 0:se.post_title)||($e==null?void 0:$e.post_title)||"",primaryValue:fe,comparisonValue:tt,growthRate:parseFloat(ve.toFixed(1))}}).sort((ye,se)=>Math.abs(se.growthRate)-Math.abs(ye.growthRate))}),O=(W,j)=>{if(W===0&&j===0)return{primaryWidth:0,comparisonWidth:0};const ie=W+j,he=W/ie*100,me=j/ie*100;return{primaryWidth:he,comparisonWidth:me}},L=W=>W>0?"positive":W<0?"negative":"neutral",P=N(()=>a.value?De.colors.report.dark_cyan_blue_16:De.colors.report.light_gray),q=N(()=>a.value?De.colors.report.dark_cyan_blue_36:De.colors.report.light_gray_cyan_blue),X=N(()=>a.value?"#ffffff":De.colors.system.mid),G=(W,j)=>`${W} ${Fo("unit","units",W)} sold in ${j}`,te=M(!1),ne=M(""),re=M(null);function K(W,j){re.value=W.currentTarget,ne.value=j,setTimeout(()=>{te.value=!0},150)}function Y(){te.value=!1}return(W,j)=>{const ie=C("el-skeleton"),he=C("el-option"),me=C("el-select"),ye=C("el-tooltip");return r(),h("div",Sre,[n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),n(Ce,{class:"pt-6"},{default:d(()=>[l.value?(r(),E(ie,{key:0,animated:"",rows:8})):(r(),h(H,{key:1},[c.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[o("div",Fre,[o("div",$re,[o("div",Ere,[n(me,{modelValue:p.value,"onUpdate:modelValue":j[0]||(j[0]=se=>p.value=se),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(v.value,se=>(r(),E(he,{key:se,label:se,value:se},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(me,{modelValue:f.value,"onUpdate:modelValue":j[1]||(j[1]=se=>f.value=se),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!p.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(k(p.value),se=>(r(),E(he,{key:se.value,label:se.label,value:se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",Ure,m(A(u)("vs")),1),o("div",Ire,[n(me,{modelValue:_.value,"onUpdate:modelValue":j[2]||(j[2]=se=>_.value=se),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(v.value,se=>(r(),E(he,{key:se,label:se,value:se},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(me,{modelValue:g.value,"onUpdate:modelValue":j[3]||(j[3]=se=>g.value=se),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!_.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(k(_.value),se=>(r(),E(he,{key:se.value,label:se.label,value:se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),w.value?(r(),h("div",Qre,[o("span",Dre,m(A(u)("Comparing %s with %s",S.value,$.value)),1)])):p.value?(r(),h("div",Vre,[o("span",Tre,m(A(u)("Viewing %s",S.value)),1)])):B("",!0)]),w.value?(r(),h("div",Mre,[o("div",Lre,[o("div",Rre,[j[5]||(j[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",Ore,m(S.value),1)]),o("div",Hre,[j[6]||(j[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",Pre,m($.value),1)])]),o("div",Nre,[o("table",Kre,[o("thead",Gre,[o("tr",null,[o("th",jre,m(A(u)("Product")),1),o("th",zre,m(A(u)("Sales")),1),o("th",qre,m(A(u)("Change")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(I.value,(se,fe)=>(r(),h("tr",{key:fe,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Yre,[R(m(se.post_title)+" ",1),j[7]||(j[7]=o("br",null,null,-1)),R(" "+m(se.name),1)]),o("td",Wre,[o("div",Jre,[o("span",Xre,m(se.primaryValue)+m(" vs "+se.comparisonValue)+" "+m(A(u)("Units")),1),o("div",Zre,[o("div",{class:"dual-bar-segment primary-segment",style:ua({width:`${O(se.primaryValue,se.comparisonValue).primaryWidth}%`}),onMouseenter:$e=>K($e,G(se.primaryValue,S.value)),onMouseleave:Y},null,44,ede),o("div",{class:"dual-bar-segment comparison-segment",style:ua({width:`${O(se.primaryValue,se.comparisonValue).comparisonWidth}%`}),onMouseenter:$e=>K($e,G(se.comparisonValue,$.value)),onMouseleave:Y},null,44,tde)])])]),o("td",ade,[o("div",{class:de(["growth-pill",L(se.growthRate)])},m(se.growthRate>0?"+":"")+m(se.growthRate)+"% ",3)])]))),128)),I.value.length===0?(r(),h("tr",lde,[o("td",sde,[o("span",nde,m(A(u)("No comparison data available")),1)])])):B("",!0)])])])])):p.value&&D.value.length>0?(r(),h("div",ode,[o("div",ide,[o("div",rde,[j[8]||(j[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",dde,m(S.value),1)])]),o("div",ude,[o("table",cde,[o("thead",Ade,[o("tr",null,[o("th",pde,m(A(u)("Product")),1),o("th",fde,m(A(u)("Sales")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(D.value,(se,fe)=>(r(),h("tr",{key:fe,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",mde,[R(m(se.post_title)+" ",1),j[9]||(j[9]=o("br",null,null,-1)),R(" "+m(se.name),1)]),o("td",hde,[o("div",_de,[o("span",{class:"bar-label",onMouseenter:$e=>K($e,G(se.value,$.value)),onMouseleave:Y},m(se.value)+" "+m(A(Fo)("Unit","Units",se.value)),41,vde),o("div",gde,[o("div",{class:"single-bar-segment",style:ua({width:`${U(se.value)}%`}),onMouseenter:$e=>K($e,G(se.value,$.value)),onMouseleave:Y},null,44,yde)])])])]))),128)),D.value.length===0?(r(),h("tr",bde,[o("td",wde,[o("span",Cde,m(A(u)("No data available for this period")),1)])])):B("",!0)])])])])):(r(),h("div",kde,[o("div",Bde,[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",xde,m(A(u)("Please select a time period to view sales data")),1)])])),n(ye,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:te.value,"onUpdate:visible":j[4]||(j[4]=se=>te.value=se),content:ne.value,"virtual-ref":re.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},Fde=lt(Sde,[["__scopeId","data-v-5cf85c06"]]),$de={class:"fct-revenue-report-page"},Ede={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=p=>{wl.getProductReportData({params:{...p.params,groupKey:c.value}}),wl.getTopSoldProducts(p)},l=p=>{c.value!==p&&(c.value=p,a(i))},s=t.reportFilter,i=s.applicableFilters,c=M("default");return Ie(()=>{s.addListener("product-report",a),a(i)}),xt(()=>{s.removeListener("product-report",!1)}),(p,f)=>(r(),E(Rt,{permission:"reports/view"},{default:d(()=>[o("div",$de,[n(nl,{title:A(u)("Products")},null,8,["title"]),n(xre,{reportFilter:A(s)},null,8,["reportFilter"]),n(yre,{chartData:A(wl).data.currentMetrics,compareData:A(wl).data.previousMetrics,appliedGroupKey:c.value,reportFilter:t.reportFilter,onFilterData:l,"is-empty":!A(wl).data.summary.gross_sale,loading:A(wl).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),n(Cd,{data:A(wl).data.topSoldProducts,loading:A(wl).data.isBusy},null,8,["data","loading"]),n(Fde,{reportFilter:A(s)},null,8,["reportFilter"])])]),_:1}))}},Ude={class:"fct-overview-chart-wrap"},Ide={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Qde={__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),s=M("bar"),i=M(null),c=De.colors,p=M(De.isDark()),f=N(()=>p.value?c.blue[500]+"52":c.blue[300]),_={current:u("Current"),prev:u("Previous"),yoy_growth:u("YoY Growth")},g=N(()=>{try{return Object.keys(t.data).map(V=>({label:V,value:t.data[V][t.dataKey]||0}))}catch($){return i.value=`Error processing data: ${$.message}`,[]}}),y=N(()=>g.value.length?t.dateRange?g.value.map($=>{try{const[V,F]=$.label.split("-");return new Date(V,F-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return $.label}}):g.value.map($=>$.label):[]),v=N(()=>g.value.length?[{title:_[t.dataKey]||t.dataKey,data:g.value.map(V=>V.value),color:f.value,yAxisIndex:0}].map(({title:V,data:F,color:x,yAxisIndex:Q})=>S(V,s.value,F,x,Q)):[]);let b=null;const k=()=>{if(a.value&&b===null)try{b=aa(a.value),w()}catch($){i.value=`Error initializing chart: ${$.message}`}},w=()=>{if(!b||i.value)return;p.value=De.isDark();const $={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:Ul(p.value,c.report.dark_cyan_blue_16,c.report.light_gray_cyan_blue,s.value),confine:!0,position:gl,formatter:V=>{let F=V[0].name;const x=p.value?"#ffffff":"#565865";return V.forEach(Q=>{const D=qa(Q.value);F+=`<div>
248 ${Q.marker}
249 <span style="color: ${x};">${Q.seriesName}</span>
250 <span style="float: right; margin-left: 20px; color: ${x};">
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=>`${pt.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{b.setOption($,{notMerge:!0,replaceMerge:["series"]})}catch(V){i.value=`Error updating chart: ${V.message}`}},S=($,V,F,x,Q)=>({name:$,type:V,barMaxWidth:t.barMaxWidth,areaStyle:V==="line"?{}:void 0,data:F,smooth:!0,color:x,lineStyle:{width:2},yAxisIndex:Q,emphasis:{itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,()=>t.dataKey,()=>t.labelSet,s],()=>{ke(w)},{deep:!0}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),b&&(b.dispose(),b=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),ke(k)}),($,V)=>(r(),h("div",Ude,[n(Be,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Ce,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",Ide,m(i.value),1)):B("",!0),e.isEmpty?(r(),E(wt,{key:2,icon:"Empty/ListView","has-dark":!0,text:A(u)("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)]))}},vo=lt(Qde,[["__scopeId","data-v-291d9a6e"]]),Dde={class:"fct-gross-volume-chart-wrap"},Vde={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Tde={__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),s=M("bar"),i=M(null),c=De.colors,p=M(De.isDark()),f={current:u("Current"),prev:u("Previous"),prev_year:u("Previous"),yoy_growth:u("YoY Growth")},_=N(()=>{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($){return i.value=`Error processing data: ${$.message}`,[]}}),g=N(()=>_.value.length?_.value.map($=>{if(t.isDate)try{const[V,F]=$.label.split("-");return new Date(V,F-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return $.label}else return $.label}):[]),y=N(()=>_.value.length?[{title:f[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:p.value?c.report.blue_dark_mode:c.report.blue},{title:f[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:p.value?c.blue[500]+"52":c.blue[300]}].map(({title:$,dataKey:V,type:F,color:x})=>S($,F,_.value.map(Q=>Q[V]),x)):[]),v=N(()=>_.value.length?_.value.map(V=>V.growth):[]);let b=null;const k=()=>{if(a.value&&b===null)try{b=aa(a.value),w()}catch($){i.value=`Error initializing chart: ${$.message}`}},w=()=>{if(!b||i.value)return;p.value=De.isDark();const $={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:Ul(p.value,c.report.dark_cyan_blue_16,c.report.light_gray_cyan_blue),confine:!0,position:gl,formatter:V=>{let F=V[0].name;const x=p.value?"#ffffff":"#565865",Q=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:u("YoY Growth"),value:isNaN(Q)?"N/A":Q.toFixed(2)+"%"});const D=p.value?c.report.dark_cyan_blue_16:c.report.light_gray_blue;return V.forEach(function(T,U){const I=U===V.length-1,O=I?T.value:qa(T.value);I?F+=`<div style="border-top: 1px solid ${D}; margin-top: 5px; padding-top: 5px;">`:F+="<div>",F+=`
254 ${T.marker}
255 <span style="color: ${x};">${T.seriesName}</span>
256 <span style="float: right; margin-left: 20px; color: ${x};">
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:u("Volume (%s)",pt.currencySign),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:V=>pt.formatScaledChart(V)},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:u("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{b.setOption($,{notMerge:!0,replaceMerge:["series"]})}catch(V){i.value=`Error updating chart: ${V.message}`}},S=($,V,F,x,Q=0)=>({name:$,type:V,barMaxWidth:t.barMaxWidth,areaStyle:V==="line"?null:void 0,data:F,smooth:V==="line",color:x,lineStyle:V==="line"?{width:2}:void 0,yAxisIndex:Q,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,s],()=>{ke(w)},{deep:!0}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),b&&(b.dispose(),b=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),ke(k)}),($,V)=>(r(),h("div",Dde,[n(Be,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Qe,{title:A(u)(e.title),title_size:"small",border_bottom:""},{action:d(()=>V[0]||(V[0]=[])),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",Vde,m(i.value),1)):B("",!0),e.isEmpty?(r(),E(wt,{key:2,icon:"Empty/ListView","has-dark":!0,text:A(u)("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)]))}},Ac=lt(Tde,[["__scopeId","data-v-101c1068"]]),Mde={class:"fct-country-volume-chart-wrap"},Lde={class:"fct-btn-group sm"},Rde=.05,Ode={__name:"CountryVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=M(null),l=M(null);let s=null;const i=M("bar");M("");const c=M(De.isDark()),p=N(()=>c.value?["#8FC0F5","#4E90E8","#2E6BC4","#1E4C90","#143562"]:["#9CC9FA","#3E9DF6","#1573D5","#0B57A3","#083C73"]),f=F=>{const x=F.replace("#",""),Q=parseInt(x.substring(0,2),16),D=parseInt(x.substring(2,4),16),T=parseInt(x.substring(4,6),16);return(Q*299+D*587+T*114)/1e3>150?"#0B3A66":"#ffffff"},_=N(()=>{const F=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!F.length||!F.every(x=>!!x)}),g=De.colors,y=N(()=>{const F=t.data.by_month||{};return Object.keys(F).sort().map(Q=>{const D=F[Q],T=Object.values(D).reduce((I,O)=>I+O,0),U=Object.entries(D).sort((I,O)=>I[1]-O[1]).reduce((I,[O,L])=>({...I,[O]:L}),{});return{label:Q,countries:U,total:T}})}),v=N(()=>y.value.length?y.value.map(F=>{try{const[x,Q]=F.label.split("-");return et(new Date(x,Q-1)).format("MMM YYYY")}catch{return F.label}}):[]),b=N(()=>{const F={};Object.values(t.data.by_month||{}).forEach(D=>{Object.entries(D).forEach(([T,U])=>{F[T]=(F[T]||0)+U})}),Object.entries(t.data.by_countries||{}).forEach(([D,T])=>{F[D]=T});const x=p.value,Q=x[x.length-1];return Object.keys(F).sort((D,T)=>F[T]-F[D]).reduce((D,T,U)=>(D[T]=x[U]||Q,D),{})}),k=N(()=>y.value.reduce((F,x)=>Math.max(F,x.total),0)),w=N(()=>{const F=t.data.by_month||{},x=new Set;Object.values(F).forEach(T=>{Object.keys(T).forEach(U=>x.add(U))});const Q=p.value,D=k.value;return Array.from(x).reverse().map(T=>{const U=b.value[T]||Q[Q.length-1],I=f(U),O=y.value.map(L=>{const P=L.countries[T]||0,q=D>0&&P/D>=Rde;return{value:P/100,label:{show:P>0&&q,position:"inside",formatter:T,color:I,fontSize:10,fontWeight:"bold"}}});return{name:T,type:i.value,stack:"total",data:O,itemStyle:{color:U},lineStyle:{color:U}}})}),S=()=>{if(!a.value)return;s=aa(a.value);const F={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",textStyle:{color:c.value?g.gray[25]:g.system.mid},borderColor:c.value?"#2C3C4E":"#c0c4ca",axisPointer:Ul(c.value,g.report.dark_cyan_blue_16,g.report.light_gray_cyan_blue,i.value),borderWidth:1,confine:!0,position:gl,formatter:x=>{const Q=c.value?"#ffffff":"#565865",D=c.value?g.report.dark_cyan_blue_16:g.report.light_gray_blue,T=y.value[x[0].dataIndex].total;let U=x[0].axisValue;return x.filter(I=>I.value>0).sort((I,O)=>O.value-I.value).forEach(I=>{const O=qa(I.value*100);U+=`
260 <div>
261 ${I.marker}
262 <span style="color: ${Q};">${Us(I.seriesName)}</span>
263 <span style="float: right; margin-left: 20px; color: ${Q};">
264 ${O}
265 </span>
266 </div>`}),U+=`
267 <div style="border-top: 1px solid ${D}; margin-top: 5px; padding-top: 5px;">
268 <span style="color: ${Q}; font-weight: 600;">${u("Total")}</span>
269 <span style="float: right; margin-left: 20px; color: ${Q}; font-weight: 600;">
270 ${qa(T)}
271 </span>
272 </div>`,U}},xAxis:{type:"category",data:v.value,axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",position:"left",name:u("Volume (%s)",pt.currencySign),axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:x=>pt.formatScaled(x*100)},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:w.value};s.setOption(F)},$=()=>{c.value=De.isDark(),ke(()=>{S()})},V=()=>{s&&(s.dispose(),s=null),S()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",$),window.addEventListener("fluentCartCurrencyChange",V),ke(S)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",$,!1),window.removeEventListener("fluentCartCurrencyChange",V,!1)}),be(()=>c.value,()=>{s&&(s.dispose(),S())}),be(()=>t.data,()=>{s&&S()}),(F,x)=>(r(),h("div",Mde,[n(Be,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Qe,{title:e.title,title_size:"small",border_bottom:""},{action:d(()=>[o("div",Lde,[n(Sm,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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)]))}},pc=lt(Ode,[["__scopeId","data-v-b6ca7579"]]),Hde={class:"fct-card-header-title is-small"},fc={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=De.colors.report,l=M(De.isDark()),s=M(null),i=M("line"),c=M(t.data),p=N(()=>({textColor:l.value?"#ffffff":"#696778",borderColor:l.value?"#2C3C4E":"#c0c4ca",splitLineColor:l.value?"#253241":"#D6DAE1",bgColor:l.value?"#2d3748":"#ffffff"})),f=N(()=>Object.values(c.value).every(w=>w===0)),_=N(()=>Object.keys(c.value)),g=N(()=>[{name:u("Current"),type:i.value,data:Object.values(c.value),smooth:!0,color:l.value?a.purple_dark_mode:a.purple,lineStyle:{width:2},barMaxWidth:30}]);let y=null;const v=()=>{s.value&&!y&&(y=aa(s.value),b())},b=()=>{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:Ul(l.value,a.dark_cyan_blue_16,a.light_gray_blue,i.value),confine:!0,position:gl,formatter:S=>{let $=Us(S[0].name);const V=l.value?"#ffffff":"#565865";return S.forEach(F=>{const x=qa(F.value);$+=`<div>
273 ${F.marker}
274 <span style="color: ${V};">${F.seriesName}</span>
275 <span style="float: right; margin-left: 20px; color: ${V};">
276 ${x}
277 </span>
278 </div>`}),$}},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:S=>pt.formatScaled(S)},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([()=>c.value,i,()=>l.value],()=>{ke(b)},{deep:!0});const k=()=>{l.value=De.isDark(),ke(()=>{b()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),window.addEventListener("fluentCartCurrencyChange",b),ke(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1)}),(w,S)=>(r(),E(Be,null,{default:d(()=>[e.title!==""?(r(),E(Qe,{key:0,border_bottom:!0},{title:d(()=>[o("h3",Hde,m(e.title),1)]),_:1})):B("",!0),n(Ce,null,{default:d(()=>[f.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("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:s},null,512))]),_:1})]),_:1}))}},Pde={class:"fct-overview-report-loader-wrap"},Nde={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Kde={class:"fct-card-header-title is-small"},Gde={class:"flex gap-2 mt-1"},jde={class:"py-6"},zde={class:"grid grid-cols-1"},qde={class:"fct-card-header-title is-small"},Yde={class:"py-6"},Wde={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Jde={class:"fct-card-header-title is-small"},Xde={class:"flex gap-2 mt-1"},Zde={class:"py-6"},eue={class:"grid grid-cols-1"},tue={class:"fct-card-header-title is-small"},aue={class:"py-6"},lue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},sue={class:"fct-card-header-title is-small"},nue={class:"py-6"},oue={__name:"OverviewLoading",setup(e){const t=[{title:u("Gross Summary"),key:"gross_summary"},{title:u("Gross Revenue Quarterly"),key:"net_summary"}],a=[{title:u("Net Revenue"),key:"net_revenue"},{title:u("Net Revenue Quarterly"),key:"net_revenue_quarterly"}],l=[{title:u("Top Country Gross Volume"),key:"top_country_gross"},{title:u("Top Country Net Volume"),key:"top_country_net"}],s=[{title:u("Top Countries Gross Revenue"),key:"top_country_revenue"},{title:u("Top Countries Net Revenue"),key:"top_country_net_revenue"}];return(i,c)=>{const p=C("el-skeleton-item"),f=C("el-skeleton");return r(),h("div",Pde,[o("div",Nde,[(r(),h(H,null,ae(t,(_,g)=>o("div",{key:g},[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",Kde,m(_.title),1),o("div",Gde,[n(f,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",jde,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",zde,[(r(),h(H,null,ae(2,_=>o("div",{key:_},[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(f,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-2/3"})]),_:1}),n(Qe,{border_bottom:!0},{title:d(()=>[o("h2",qde,m(A(u)("Gross Volume Breakdown")),1)]),_:1}),o("div",Yde,[n(f,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",Wde,[(r(),h(H,null,ae(a,(_,g)=>o("div",{key:g},[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",Jde,m(_.title),1),o("div",Xde,[n(f,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",Zde,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",eue,[(r(),h(H,null,ae(l,(_,g)=>o("div",{key:g},[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h2",tue,m(_.title),1)]),_:2},1024),o("div",aue,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",lue,[(r(),h(H,null,ae(s,(_,g)=>o("div",{key:g},[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",sue,m(_.title),1)]),_:2},1024),o("div",nue,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},iue={class:"overview-summary-report-inline"},rue={class:"inner-value"},due={__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",iue,[o("div",rue,[n(Ms,{amount:A(pt).formatScaled(e.current),title:A(u)(e.title)},null,8,["amount","title"])]),n(ml,{fluctuation:e.fluctuation,amount:e.previous/100,fluctuationSuffix:A(u)("YoY")},null,8,["fluctuation","amount","fluctuationSuffix"])]))}},go=lt(due,[["__scopeId","data-v-b394c9f1"]]),uue={class:"report-overview-page"},cue={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},Aue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},pue={class:"fct-card-header-title is-small"},fue={class:"fct-card-header-title is-small"},mue={class:"grid grid-cols-1"},hue=["innerHTML"],_ue=["innerHTML"],vue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},gue={class:"fct-card-header-title is-small"},yue={class:"fct-card-header-title is-small"},bue={class:"grid gap-4 grid-cols-1"},wue={class:"grid gap-4 grid-cols-1"},Cue={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},kue={__name:"Overview",setup(e){const t=M({}),a=M(!0),l=M({gross_revenue_quarterly:{},net_revenue_quarterly:{}}),s=()=>{ue.get("reports/overview").then(p=>{t.value=p.data,i()}).catch(p=>{}).finally(()=>{a.value=!1})},i=()=>{l.value.gross_revenue_quarterly=c(t.value.gross_revenue_quarterly,"current","prev_year"),l.value.net_revenue_quarterly=c(t.value.net_revenue_quarterly,"current","prev_year")},c=(p,f="current",_="prev")=>{const g=it.sum(p,"*."+f),y=it.sum(p,"*."+_),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return N(()=>{var p,f;return((p=t.value.gross_summary)==null?void 0:p.yoy_growth)<0?"danger":((f=t.value.gross_summary)==null?void 0:f.yoy_growth)===null?"warning":"success"}),Ie(()=>{s()}),(p,f)=>(r(),h("div",uue,[o("div",cue,[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+m(A(u)("Last %s Months",A(u)(12))),1)]),a.value?(r(),E(oue,{key:0})):(r(),h(H,{key:1},[o("div",Aue,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h3",pue,m(A(u)("Gross Summary")),1),n(go,{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}),n(vo,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h3",fue,m(A(u)("Gross Revenue Quarterly")),1),n(go,{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}),n(vo,{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",mue,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(pt).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,hue),n(Ac,{title:A(u)("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}),n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(pt).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,_ue),n(Ac,{title:A(u)("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",vue,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",gue,m(A(u)("Net Revenue")),1),n(go,{title:A(u)("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}),n(vo,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",yue,m(A(u)("Net Revenue Quarterly")),1),n(go,{title:A(u)("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}),n(vo,{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",bue,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(pc,{data:t.value.top_country_gross,title:A(u)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",wue,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(pc,{data:t.value.top_country_net,title:A(u)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Cue,[n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>{var _;return[n(fc,{data:(_=t.value.top_country_gross)==null?void 0:_.by_countries,title:A(u)("Top Countries Gross Revenue")},null,8,["data","title"])]}),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Ce,null,{default:d(()=>{var _;return[n(fc,{data:(_=t.value.top_country_net)==null?void 0:_.by_countries,title:A(u)("Top Countries Net Revenue")},null,8,["data","title"])]}),_:1})]),_:1})])],64))]))}},Bue={class:"setting-wrap"},xue={class:"setting-wrap-inner"},Sue={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},Fue={class:"grid gap-3 mb-6"},$ue={class:"grid gap-3 mb-6"},Eue={class:"grid gap-3 mb-6"},Uue={class:"grid gap-3"},Iue={class:"payment-method-list fct-content-card-list"},Que=["id"],Due={class:"flex items-start gap-3"},Vue={class:"grid gap-2 flex-1"},Tue={key:0,class:"fct-content-card-list-head stripe"},Mue=["src","alt"],Lue=["src","alt"],Rue={class:"block font-semibold text-system-dark dark:text-gray-50"},Oue={class:"fct-content-card-list-content"},Hue={class:"fct-content-card-list-action flex items-center gap-2"},Pue={key:0},Nue=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=Op(),{form:a}=t.data,l=vs(),s=M([]),i=M([]),c=M(!0),p=M(!1),f=M(!0),_=M({}),g=M(!1),y=M({}),v=M(!1),b=M(""),k=M(""),w=M(""),S=N(()=>Object.keys(y.value).length>0),$=()=>{p.value=!0;let T=a.values;ue.post("settings/modules",{...T}).then(U=>{z.success(u("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(U=>{if(U&&U.message)return z.error(U);_.value=U}).finally(()=>{p.value=!1,f.value=!1,c.value=!1})},V=()=>{c.value=!0,ue.get("settings/modules",{}).then(T=>{var O,L;a.setSchema(T.fields).setDefaults(T.settings).initForm(),s.value=T.settings,i.value=T.fields,f.value=!1,p.value=!1;const U=((L=(O=T.fields)==null?void 0:O.modules_settings)==null?void 0:L.schema)||[];let I=!1;Array.isArray(U)?I=U.length>0:I=Object.keys(U).length>0,g.value=I}).finally(()=>{c.value=!1})},F=()=>{v.value=!0,ue.get("settings/modules/plugin-addons",{}).then(T=>{y.value=T.addons||{},w.value&&ke(()=>ln.scrollToHashSection(w.value))}).catch(T=>{z.error(T)}).finally(()=>{v.value=!1})},x=Ge.get("app_config.isProActive"),Q=(T,U)=>{if(!x){window.open(T.repo_link,"_blank","noopener,noreferrer");return}b.value=U,ue.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(I=>{I.action==="copy"&&I.url?(Zl.copy(I.url,{successMessage:u("Download link copied to your clipboard")}),window.open(I.url,"_blank","noopener,noreferrer")):I.action==="reload"?(z.success(I.message||u("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):z.success(I.message||u("Addon installed successfully"))}).catch(I=>{z.error(I)}).finally(()=>{b.value=""})},D=(T,U)=>{k.value=U,ue.post("settings/modules/plugin-addons/activate",{plugin_file:T.plugin_file}).then(I=>{z.success(I.message||u("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(I=>{z.error(I)}).finally(()=>{k.value=""})};return Ie(()=>{const T=window.location.hash||"",U=T.lastIndexOf("#");U>0&&(w.value=T.substring(U+1)),V(),F()}),l.onSave($),(T,U)=>{const I=C("el-skeleton-item"),O=C("el-skeleton"),L=C("el-form"),P=C("el-button"),q=C("el-icon"),X=C("router-link");return r(),h("div",Bue,[n(Qa,{heading:A(u)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",xue,[n(Da),f.value?(r(),h("div",Sue,[n(O,{loading:f.value,animated:""},{template:d(()=>[o("div",Fue,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})]),o("div",$ue,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})]),o("div",Eue,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})]),o("div",Uue,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),f.value?B("",!0):(r(),h(H,{key:1},[A(a).isReady?(r(),E(L,{key:0},{default:d(()=>[g.value?(r(),E(ki,{key:0,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:$,submitButtonText:A(u)("Save Settings"),loading:p.value,onOnChange:U[0]||(U[0]=G=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):S.value?B("",!0):(r(),E(Be,{key:1},{default:d(()=>[n(Qe,{title:A(u)("Features & addon"),border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[n(wt,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:A(u)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):B("",!0),S.value?(r(),E(Be,{key:1,class:"mt-6"},{default:d(()=>[n(Qe,{title:A(u)("Plugin Addons"),border_bottom:""},null,8,["title"]),n(Ce,{class:"py-0"},{default:d(()=>[o("div",Iue,[(r(!0),h(H,null,ae(y.value,(G,te)=>(r(),h("div",{key:te,class:"fct-content-card-list-item",id:G.plugin_slug===w.value?w.value:null},[o("div",Due,[o("div",Vue,[G.logo?(r(),h("div",Tue,[o("img",{class:de({"dark:hidden":G.dark_logo}),src:G.logo,alt:G.title},null,10,Mue),G.dark_logo?(r(),h("img",{key:0,src:G.dark_logo,alt:G.title,class:"hidden dark:block"},null,8,Lue)):B("",!0),o("span",Rue,m(G.title),1),G.is_active?(r(),E(ma,{key:1,status:"active",text:A(u)("Active")},null,8,["text"])):B("",!0)])):B("",!0),o("div",Oue,[o("p",null,m(G.description),1)])]),o("div",Hue,[G.upcoming?(r(),h("div",Pue,m(A(u)("Coming Soon")),1)):(r(),h(H,{key:1},[G.is_installed?G.is_installed&&!G.is_active&&(A(x)||G.source_type!=="github")?(r(),E(P,{key:1,type:"success",size:"small",loading:k.value===te,disabled:k.value===te,onClick:ne=>D(G,te)},{default:d(()=>[R(m(A(u)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):B("",!0):(r(),E(P,{key:0,type:"primary",size:"small",loading:b.value===te,disabled:b.value===te,onClick:ne=>Q(G,te)},{default:d(()=>[R(m(A(x)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),G.is_active&&te==="fluent-pdf"?(r(),E(X,{key:2,to:{path:"/settings/pdf-template"}},{default:d(()=>[n(q,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:d(()=>[n(A(Rc))]),_:1})]),_:1})):B("",!0)],64))])])],8,Que))),128))])]),_:1})]),_:1})):B("",!0)],64))])])}}}),Kue=lt(Nue,[["__scopeId","data-v-a315b5d5"]]),Gue={class:"form-note"},jue={class:"form-note"},zue={class:"form-note"},que={class:"form-note"},Yue={class:"el-form-item__label"},Wue={class:"h-[297px] w-full relative"},Jue={class:"mt-2 mb-2"},Xue={class:"form-note"},Zue={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"},ece={class:"setting-html-wrapper"},tce={class:"setting-label"},ace={class:"form-note"},lce={class:"setting-fields-inner w-full"},sce={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-form-item"),c=C("el-col"),p=C("el-row");return r(),E(Ce,null,{default:d(()=>[n(p,{gutter:15},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("From Name"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9 gap-2"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),a[0]||(a[0]=o("br",null,null,-1)),o("div",null,[o("div",Gue,[o("p",null,m(A(u)("Name that will be used to send emails")),1)])])]),_:1,__:[0]},8,["label"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("From Email"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",jue,[o("p",null,m(A(u)(`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}),n(p,{gutter:15},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",zue,[o("p",null,m(A(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",que,[o("p",null,m(A(u)(`If someone replies to your notification email, this is where you would like to
280 receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,null,{default:d(()=>[o("div",Yue,m(A(u)("Email Footer")),1),o("div",Wue,[n(s,{animated:"",rows:7})]),o("div",Jue,[o("div",Xue,[o("p",null,m(A(u)(`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",Zue,[n(s,{animated:"",class:"h-5"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,null,{default:d(()=>[n(i,null,{default:d(()=>[n(p,{gutter:15,class:"w-full"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[o("div",ece,[o("span",tce,m(A(u)("Admin Email Address")),1),o("div",ace,[o("p",null,m(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(c,{lg:12},{default:d(()=>[o("div",lce,[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},nce={class:"setting-wrap"},oce={class:"setting-wrap-inner"},ice={class:"form-note"},rce={class:"form-note"},dce={class:"form-note"},uce={class:"form-note"},cce={class:"el-form-item__label"},Ace={class:"mt-2 mb-2"},pce={class:"form-note"},fce={class:"fct-powered-by-email-footer-checkbox"},mce={class:"setting-html-wrapper"},hce={class:"setting-label"},_ce={class:"form-note"},vce={class:"setting-fields-inner w-full"},gce={class:"setting-save-action"},yce={__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=Ge.get("app_config.isProActive"),l=M(!1),s=M({}),i=M({}),c=()=>{l.value=!0,ue.get("email-notification/get-settings").then(f=>{var _,g,y,v,b,k,w;t.value={from_name:(_=f.data)==null?void 0:_.from_name,from_email:(g=f.data)==null?void 0:g.from_email,reply_to_name:(y=f.data)==null?void 0:y.reply_to_name,reply_to_email:(v=f.data)==null?void 0:v.reply_to_email,email_footer:(b=f.data)==null?void 0:b.email_footer,admin_email:(k=f.data)==null?void 0:k.admin_email,show_email_footer:((w=f.data)==null?void 0:w.show_email_footer)||"yes"},i.value=f.shortcodes}).catch(f=>{}).finally(()=>{l.value=!1})},p=()=>{l.value=!0,s.value={},ue.post("email-notification/save-settings",t.value).then(f=>{z.success(f.message)}).catch(f=>{f.status_code===422&&f.data?s.value=f.data:f.message?z.error(f.message):(z.error(u("Something went wrong")),s.value=f)}).finally(()=>{l.value=!1})};return Ie(()=>{c()}),(f,_)=>{const g=C("el-input"),y=C("el-form-item"),v=C("el-col"),b=C("el-row"),k=C("el-tooltip"),w=C("el-checkbox"),S=C("el-button");return r(),h("div",nce,[n(Qa,{heading:A(u)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",oce,[n(Da),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Email Configuration"),text:A(u)("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(sce,{key:0})):(r(),E(Ce,{key:1},{default:d(()=>[n(b,{gutter:15},{default:d(()=>[n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("From Name"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.from_name,"onUpdate:modelValue":_[0]||(_[0]=$=>t.value.from_name=$)},null,8,["modelValue"]),_[9]||(_[9]=o("br",null,null,-1)),o("div",null,[n(fl,{"validation-errors":s.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),o("div",ice,[o("p",null,m(A(u)("Name that will be used to send emails")),1)])])]),_:1,__:[9]},8,["label"])]),_:1}),n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("From Email"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.from_email,"onUpdate:modelValue":_[1]||(_[1]=$=>t.value.from_email=$)},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":s.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),o("div",rce,[o("p",null,m(A(u)(`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}),n(b,{gutter:15},{default:d(()=>[n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":_[2]||(_[2]=$=>t.value.reply_to_name=$)},null,8,["modelValue"]),o("div",dce,[o("p",null,m(A(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":_[3]||(_[3]=$=>t.value.reply_to_email=$)},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":s.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),o("div",uce,[o("p",null,m(A(u)(`If someone replies to your notification email, this is where you would like to
283 receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(b,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[o("div",cce,m(A(u)("Email Footer")),1),n(es,{"short-codes":i.value,modelValue:t.value.email_footer,"onUpdate:modelValue":_[4]||(_[4]=$=>t.value.email_footer=$),onUpdate:_[5]||(_[5]=$=>{t.value.email_footer=$})},null,8,["short-codes","modelValue"]),o("div",Ace,[n(fl,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",pce,[o("p",null,m(A(u)(`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",fce,[n(w,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":_[6]||(_[6]=$=>t.value.show_email_footer=$),"true-value":"yes","false-value":"no",disabled:!A(a)},{default:d(()=>[R(m(A(u)("Enable powered by FluentCart in the email footer"))+" ",1),A(a)?B("",!0):(r(),E(k,{key:0,"popper-class":"fct-tooltip",placement:"top"},{content:d(()=>[R(m(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),n(b,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[n(y,null,{default:d(()=>[n(b,{gutter:15,class:"w-full"},{default:d(()=>[n(v,{lg:12},{default:d(()=>[o("div",mce,[o("span",hce,m(A(u)("Admin Email Address")),1),o("div",_ce,[o("p",null,m(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(v,{lg:12},{default:d(()=>[o("div",vce,[n(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":_[7]||(_[7]=$=>t.value.admin_email=$)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),o("div",gce,[n(S,{type:"primary",onClick:_[8]||(_[8]=$=>p()),loading:l.value},{default:d(()=>[R(m(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},bce={class:"setting-wrap"},wce={class:"setting-wrap-inner"},Cce={class:"form-note"},kce={class:"form-note"},Bce={class:"form-note",style:{"padding-top":"6px"}},xce={class:"form-note"},Sce={class:"setting-save-action"},mc="{{wp.admin_email}}",Fce={__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({}),s=M(""),i=[{key:"daily",label:u("Daily digest"),desc:u("Yesterday's performance, sent every morning.")},{key:"weekly",label:u("Weekly digest"),desc:u("The previous 7 days, sent on your chosen day.")},{key:"monthly",label:u("Monthly digest"),desc:u("The previous calendar month, sent on the 1st.")}],c=u("Comma-separate multiple addresses. %1$s resolves to the site admin email.",mc),p=N(()=>{const v=[];for(let b=0;b<24;b++)v.push({value:b,label:String(b).padStart(2,"0")+":00"});return v}),f=[{value:1,label:u("Monday")},{value:2,label:u("Tuesday")},{value:3,label:u("Wednesday")},{value:4,label:u("Thursday")},{value:5,label:u("Friday")},{value:6,label:u("Saturday")},{value:7,label:u("Sunday")}],_=()=>{a.value=!0,ue.get("email-notification/digest-settings").then(v=>{v.data&&(t.value=v.data)}).catch(()=>{}).finally(()=>{a.value=!1})},g=()=>{a.value=!0,l.value={},ue.post("email-notification/digest-settings",t.value).then(v=>{z.success(v.message)}).catch(v=>{v.status_code===422&&v.data?l.value=v.data:v.message?z.error(v.message):z.error(u("Something went wrong"))}).finally(()=>{a.value=!1})},y=v=>{s.value=v,ue.post("email-notification/digest-settings/send-test",{frequency:v}).then(b=>{z.success(b.message)}).catch(b=>{z.error(b.message||u("Could not send the test email."))}).finally(()=>{s.value=""})};return Ie(()=>{_()}),(v,b)=>{const k=C("el-input"),w=C("el-form-item"),S=C("el-col"),$=C("el-checkbox"),V=C("el-row"),F=C("el-switch"),x=C("el-option"),Q=C("el-select"),D=C("el-button");return r(),h("div",bce,[n(Qa,{heading:A(u)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",wce,[n(Da),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Recipients & General"),text:A(u)("A system email summarising your store activity. Numbers match the Reports dashboard."),border_bottom:""},null,8,["title","text"]),n(Ce,null,{default:d(()=>[n(V,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(w,{label:A(u)("Recipient email addresses"),"label-position":"top"},{default:d(()=>[n(k,{modelValue:t.value.recipients,"onUpdate:modelValue":b[0]||(b[0]=T=>t.value.recipients=T),placeholder:mc},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",Cce,[o("p",null,m(A(c)),1)])])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(w,{label:A(u)("Empty periods"),"label-position":"top"},{default:d(()=>[n($,{modelValue:t.value.send_when_empty,"onUpdate:modelValue":b[1]||(b[1]=T=>t.value.send_when_empty=T),"true-value":"yes","false-value":"no"},{default:d(()=>[R(m(A(u)("Send even when there was no activity")),1)]),_:1},8,["modelValue"]),o("div",kce,[o("p",null,m(A(u)("When off, a digest is skipped for any period with no paid orders.")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),(r(),h(H,null,ae(i,T=>n(Be,{key:T.key,class:"fct-mt-4"},{default:d(()=>[n(Qe,{title:T.label,text:T.desc,border_bottom:""},null,8,["title","text"]),n(Ce,null,{default:d(()=>[n(V,{gutter:15,align:"middle"},{default:d(()=>[n(S,{lg:6},{default:d(()=>[n(w,{label:A(u)("Enable"),"label-position":"top"},{default:d(()=>[n(F,{modelValue:t.value[T.key].enabled,"onUpdate:modelValue":U=>t.value[T.key].enabled=U,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),n(S,{lg:6},{default:d(()=>[n(w,{label:A(u)("Send time"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:t.value[T.key].send_hour,"onUpdate:modelValue":U=>t.value[T.key].send_hour=U,class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(p.value,U=>(r(),E(x,{key:U.value,label:U.label,value:U.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),T.key==="weekly"?(r(),E(S,{key:0,lg:6},{default:d(()=>[n(w,{label:A(u)("Day of week"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":b[2]||(b[2]=U=>t.value.weekly.send_dow=U),class:"w-full"},{default:d(()=>[(r(),h(H,null,ae(f,U=>n(x,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):B("",!0),T.key==="monthly"?(r(),E(S,{key:1,lg:6},{default:d(()=>[n(w,{label:A(u)("Send day"),"label-position":"top"},{default:d(()=>[o("div",Bce,[o("p",null,m(A(u)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):B("",!0),n(S,{lg:6},{default:d(()=>[n(w,{label:" ","label-position":"top"},{default:d(()=>[n(D,{loading:s.value===T.key,onClick:U=>y(T.key),class:"mt-2"},{default:d(()=>[R(m(A(u)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),o("div",xce,[o("p",null,m(A(u)("Send time is in your store timezone. Test emails use your saved recipients.")),1)])]),_:2},1024)]),_:2},1024)),64)),o("div",Sce,[n(D,{type:"primary",onClick:b[3]||(b[3]=T=>g()),loading:a.value},{default:d(()=>[R(m(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},$ce={};function Ece(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const Uce=lt($ce,[["render",Ece]]),Ice={},Qce={class:"fct-setting-form-row"},Dce={class:"w-[300px]"},Vce={class:"flex-grow flex-shrink flex-basis-0 self-center"},Tce={class:"fct-setting-form-row"},Mce={class:"w-[300px]"},Lce={class:"flex-grow flex-shrink flex-basis-0 self-center"},Rce={class:"fct-setting-form-row"},Oce={class:"w-[300px]"},Hce={class:"flex-grow flex-shrink flex-basis-0 self-center"};function Pce(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",null,[o("div",Qce,[o("div",Dce,[n(l,{animated:"",class:"max-w-[70%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-[80%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"}),n(a,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),o("div",Vce,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",Tce,[o("div",Mce,[n(l,{animated:"",class:"max-w-[60%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",Lce,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",Rce,[o("div",Oce,[n(l,{animated:"",class:"max-w-[50%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",Hce,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const Nce=lt(Ice,[["render",Pce]]),Kce={name:"TaxConfigurations",components:{TaxConfigurationsLoader:Nce,CardContainer:Be,CardBody:Ce,CardHeader:Qe,LabelHint:fa,SettingsHeader:Qa,AdminNotice:Da,Animation:va},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:u,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,Ge.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=_s(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.saveSettings()})},unbindSaveShortcut(){var e;(e=this.keyboardShortcuts)!=null&&e.unbind&&this.keyboardShortcuts.unbind("mod+s")}}},Gce={class:"setting-wrap"},jce={class:"setting-wrap-inner"},zce={class:"fct-setting-form-row"},qce={class:"fct-setting-form-content flex gap-3.5 flex-1"},Yce={class:"fct-inline-tip"},Wce={key:1},Jce={class:"fct-setting-form-row"},Xce={class:"fct-setting-form-content"},Zce={class:"fct-inline-tip"},eAe={class:"fct-setting-form-fields self-center"},tAe={class:"fct-inline-tip mt-2"},aAe={class:"fct-setting-form-row"},lAe={class:"fct-setting-form-content"},sAe={class:"fct-inline-tip"},nAe={class:"fct-setting-form-fields self-center"},oAe={class:"flex flex-col"},iAe={class:"price-mode-label"},rAe={class:"price-mode-text"},dAe={class:"flex flex-col"},uAe={class:"price-mode-label"},cAe={class:"price-mode-text"},AAe={class:"fct-setting-form-row"},pAe={class:"fct-setting-form-content"},fAe={class:"fct-inline-tip"},mAe={class:"fct-setting-form-fields self-center"},hAe={class:"fct-setting-form-row"},_Ae={class:"fct-setting-form-content"},vAe={class:"fct-inline-tip"},gAe={class:"fct-setting-form-fields self-center"},yAe={class:"fct-setting-form-row"},bAe={class:"fct-setting-form-content"},wAe={class:"fct-inline-tip"},CAe={class:"fct-setting-form-fields self-center"},kAe={class:"fct-setting-form-row"},BAe={class:"fct-setting-form-content"},xAe={class:"fct-inline-tip"},SAe={class:"fct-setting-form-fields self-center"},FAe={key:0,class:"fct-setting-form-row"},$Ae={class:"fct-setting-form-content"},EAe={class:"fct-inline-tip"},UAe={class:"fct-setting-form-fields self-center"},IAe={class:"fct-setting-form-row"},QAe={class:"fct-setting-form-content"},DAe={class:"fct-inline-tip"},VAe={class:"fct-setting-form-fields"},TAe={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},MAe={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},LAe={class:"fct-inline-tip"},RAe={class:"fct-vat-excluded-categories"},OAe={class:"fct-inline-tip"};function HAe(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-switch"),_=C("LabelHint"),g=C("TaxConfigurationsLoader"),y=C("el-radio"),v=C("el-radio-group"),b=C("el-option"),k=C("el-select"),w=C("el-input"),S=C("Animation"),$=C("CardBody"),V=C("CardContainer"),F=Ma("loading");return r(),h("div",Gce,[n(c,{heading:i.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",jce,[n(p),n(V,null,{default:d(()=>[n($,null,{default:d(()=>[o("div",zce,[o("div",qce,[n(f,{modelValue:s.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=x=>s.settings.enable_tax=x),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Enable Tax")},null,8,["title"]),o("p",Yce,m(s.settings.enable_tax==="yes"?i.translate("This store is now collecting tax."):i.translate("This store is not collecting tax.")),1)])])]),n(S,{visible:s.settings.enable_tax==="yes",accordion:""},{default:d(()=>[s.loading?(r(),E(g,{key:0})):B("",!0),s.loading?B("",!0):(r(),h("div",Wce,[o("div",Jce,[o("div",Xce,[n(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",Zce,m(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",eAe,[n(v,{modelValue:s.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=x=>s.settings.tax_inclusion=x)},{default:d(()=>[n(y,{value:"included"},{default:d(()=>[R(m(i.translate("Included")),1)]),_:1}),n(y,{value:"excluded"},{default:d(()=>[R(m(i.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),o("p",tAe,m(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",aAe,[o("div",lAe,[n(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",sAe,m(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",nAe,[n(v,{modelValue:s.settings.eu_vat_settings.reverse_charge_price_mode,"onUpdate:modelValue":t[2]||(t[2]=x=>s.settings.eu_vat_settings.reverse_charge_price_mode=x),class:"fct-reverse-charge-price-mode"},{default:d(()=>[n(y,{value:"fixed"},{default:d(()=>[o("div",oAe,[o("span",iAe,m(i.translate("Fixed")),1),o("span",rAe,m(i.translate("Listed price stays unchanged on reverse charge. Only the tax line is zeroed on the invoice.")),1)])]),_:1}),n(y,{value:"dynamic"},{default:d(()=>[o("div",dAe,[o("span",uAe,m(i.translate("Dynamic")),1),o("span",cAe,m(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",AAe,[o("div",pAe,[n(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",fAe,m(i.translate("Determine the location used for tax calculations.")),1)]),o("div",mAe,[n(k,{modelValue:s.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=x=>s.settings.tax_calculation_basis=x),clearable:""},{default:d(()=>[n(b,{value:"shipping",label:i.translate("Customer Shipping Address")},null,8,["label"]),n(b,{value:"billing",label:i.translate("Customer Billing Address")},null,8,["label"]),n(b,{value:"store",label:i.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),o("div",hAe,[o("div",_Ae,[n(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",vAe,m(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",gAe,[n(w,{modelValue:s.settings.price_suffix_included,"onUpdate:modelValue":t[4]||(t[4]=x=>s.settings.price_suffix_included=x),placeholder:i.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),o("div",yAe,[o("div",bAe,[n(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",wAe,m(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",CAe,[n(w,{modelValue:s.settings.price_suffix_excluded,"onUpdate:modelValue":t[5]||(t[5]=x=>s.settings.price_suffix_excluded=x),placeholder:i.translate("e.g. (+ tax)")},null,8,["modelValue","placeholder"])])]),o("div",kAe,[o("div",BAe,[n(_,{title:i.translate("Tax Display Style")},null,8,["title"]),o("p",xAe,m(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",SAe,[n(k,{modelValue:s.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=x=>s.settings.checkout_tax_breakdown_display=x)},{default:d(()=>[n(b,{value:"simplified",label:i.translate("Simplified (single line + details)")},null,8,["label"]),n(b,{value:"itemized",label:i.translate("Itemized (per-item tax + breakdown)")},null,8,["label"])]),_:1},8,["modelValue"])])]),s.settings.checkout_tax_breakdown_display==="simplified"?(r(),h("div",FAe,[o("div",$Ae,[n(_,{title:i.translate("Tax Line Label")},null,8,["title"]),o("p",EAe,m(i.translate("The single-line tax label shown in Simplified mode, e.g. VAT, MwSt, GST.")),1)]),o("div",UAe,[n(w,{modelValue:s.settings.tax_display_label,"onUpdate:modelValue":t[7]||(t[7]=x=>s.settings.tax_display_label=x),placeholder:i.translate("e.g. Tax")},null,8,["modelValue","placeholder"])])])):B("",!0),o("div",IAe,[o("div",QAe,[n(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",DAe,m(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",VAe,[o("div",TAe,[o("div",MAe,[n(f,{modelValue:s.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[8]||(t[8]=x=>s.settings.eu_vat_settings.local_reverse_charge=x),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Local Reverse Charge")},null,8,["title"]),o("p",LAe,m(i.translate("If enabled, apply reverse charge when applicable even when customers are in your home country.")),1)])]),n(S,{visible:i.handlePriceMode,accordion:""},{default:d(()=>[o("div",RAe,[n(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",OAe,m(i.translate("Select product categories that should NOT get VAT reverse charge !")),1),qt((r(),E(k,{modelValue:s.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[9]||(t[9]=x=>s.settings.eu_vat_settings.vat_reverse_excluded_categories=x),filterable:"",multiple:"",clearable:"",placeholder:i.translate("Select Product Categories"),class:"w-full mt-4"},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,x=>(r(),E(b,{key:x.value||x.term_id,label:x.label||x.name,value:x.value||x.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[F,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const PAe=lt(Kce,[["render",HAe]]),NAe={class:"fct-tax-rates-wrap-loader px-5"},KAe={__name:"TaxRatesLoader",setup(e){const t=M(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,l)=>{const s=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",NAe,[(r(!0),h(H,null,ae(t.value,(c,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"},[n(i,{animated:"",style:ua({width:c}),class:"h-4"},{template:d(()=>[n(s,{variant:"p",class:"h-4"})]),_:2},1032,["style"]),n(i,{animated:"",class:"w-[100px] h-4"},{template:d(()=>[n(s,{variant:"p",class:"h-4"})]),_:1})]))),128))])}}},GAe={class:"setting-wrap"},jAe={class:"setting-wrap-inner"},zAe={class:"fct-all-tax-classes-page"},qAe={class:"flex items-center justify-end gap-4"},YAe={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},WAe={class:"inline-flex items-center gap-2"},JAe={class:"inline-flex items-center gap-2"},XAe=["src","alt"],ZAe={key:0,class:"text-gray-400 dark:text-gray-300"},epe={key:1,class:"text-success-500"},tpe={key:2,class:"text-system-mid dark:text-gray-300"},ape={key:3,class:"text-gray-400 dark:text-gray-300"},lpe={key:1,class:"text-gray-400"},spe={__name:"TaxRates",setup(e){const t=M({}),a=M([]),l=M({}),s=M({}),i=N(()=>!!Ge.get("is_tax_enabled")),c=M(!1),p=M({}),f={};let _=0;const g=M(""),y=M(!1),v={XI:"gb"},b=U=>(v[U]||U).toLowerCase(),k=N(()=>{const U=new Set;for(const I of a.value)for(const O of I.countries||[])U.add(O.country_code);return U}),w=U=>!U||!Object.prototype.hasOwnProperty.call(s.value,U)?!0:s.value[U],S=U=>!U||!U.vat?!1:U.rates&&typeof U.rates=="object"&&Object.keys(U.rates).length?Object.values(U.rates).some(I=>I&&parseFloat(I.rate)>0):parseFloat(U.rate)>0,$=N(()=>{const U=l.value||{},I=Array.isArray(U.country_registrations)?U.country_registrations:[],O=U.method||"",L=I.some(S);if(O==="oss")return!!U.oss_country;if(O==="home"){const P=U.home_country||"",q=I.find(X=>X.country===P);if(P&&q&&S(q))return!0}return O==="specific"?!!U.home_country:L}),V=N(()=>{const U=l.value||{},I=Array.isArray(U.country_registrations)?U.country_registrations:[],O=U.method||"";return O==="oss"?!!U.oss_country:O==="home"?!!U.home_country&&I.some(L=>L.country===U.home_country):O==="specific"?!!U.home_country:I.some(S)}),F=N(()=>{const U=[],I=Object.values(t.value||{});for(const P of I)if(P.group_code==="EU")U.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:V.value,enabled:w("EU"),collecting:V.value&&$.value&&w("EU")});else for(const q of P.countries||[]){const X=k.value.has(q.country_code),G=w(q.country_code);U.push({country_code:q.country_code,country_name:q.country_name,isEU:!1,group_code:P.group_code,hasConfig:X,enabled:G,collecting:X&&G})}const O=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],L=new Set(O);return U.sort((P,q)=>{if(P.hasConfig!==q.hasConfig)return P.hasConfig?-1:1;const X=L.has(P.country_code),G=L.has(q.country_code);return X&&G?O.indexOf(P.country_code)-O.indexOf(q.country_code):X?-1:G?1:P.country_name.localeCompare(q.country_name)}),U}),x=N(()=>{const U=g.value.trim().toLowerCase();return F.value.filter(I=>y.value&&(!i.value||!I.collecting)?!1:U?I.country_name.toLowerCase().includes(U)||I.country_code.toLowerCase().includes(U):!0)}),Q=N(()=>{if(!i.value)return!1;const U=F.value.filter(O=>O.enabled).length,I=F.value.filter(O=>!O.enabled).length;return U>0&&I>0}),D=()=>{c.value=!0,Promise.all([ue.get("tax/configuration/rates"),ue.get("tax/rates"),ue.get("tax/configuration/settings")]).then(([U,I,O])=>{var L;t.value=U.tax_rates,a.value=I.tax_rates,s.value=I.country_enabled_map||{},l.value=((L=O.settings)==null?void 0:L.eu_vat_settings)||{}}).catch(U=>{}).finally(()=>{c.value=!1})},T=(U,I)=>{const O=w(U.country_code),L=++_;f[U.country_code]=L,s.value={...s.value,[U.country_code]:I},p.value={...p.value,[U.country_code]:!0},ue.post("tax/country-status/"+U.country_code,{enabled:I?1:0}).then(P=>{f[U.country_code]===L&&(z.success(P.message),s.value={...s.value,[U.country_code]:P.enabled})}).catch(P=>{var q;f[U.country_code]===L&&(s.value={...s.value,[U.country_code]:O},z.error(((q=P==null?void 0:P.data)==null?void 0:q.message)||u("Failed to update tax status")))}).finally(()=>{if(f[U.country_code]===L){const P={...p.value};delete P[U.country_code],p.value=P}})};return Ie(()=>{D()}),(U,I)=>{const O=C("el-checkbox"),L=C("el-input"),P=C("el-table-column"),q=C("el-switch"),X=C("el-table");return r(),h("div",GAe,[n(Qa,{heading:A(u)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",jAe,[n(Da),o("div",zAe,[n(Be,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Tax Regions"),text:A(u)("Manage tax rates for different regions")},{action:d(()=>[o("div",qAe,[Q.value?(r(),E(O,{key:0,modelValue:y.value,"onUpdate:modelValue":I[0]||(I[0]=G=>y.value=G)},{default:d(()=>[R(m(A(u)("Collecting Tax")),1)]),_:1},8,["modelValue"])):B("",!0),n(L,{modelValue:g.value,"onUpdate:modelValue":I[1]||(I[1]=G=>g.value=G),class:"w-[200px]",placeholder:A(u)("Search regions..."),size:"small",clearable:""},{prefix:d(()=>[n(J,{name:"Search",class:"w-4 h-4"})]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["title","text"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[!c.value&&!i.value?(r(),h("div",YAe,[n(Xa,{type:"warning",icon:"AlertTriangle",content:A(u)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):B("",!0),c.value?(r(),E(KAe,{key:1})):(r(),E(X,{key:2,data:x.value,"max-height":"500",class:"w-full compact-table fct-tax-rates-regions-table"},{default:d(()=>[n(P,{label:A(u)("Region"),"min-width":"300"},{default:d(({row:G})=>[G.isEU?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:d(()=>[o("div",WAe,[I[2]||(I[2]=o("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),R(" "+m(G.country_name),1)])]),_:2},1024)):(r(),E(Ba,{key:1,to:{name:"tax-rates-country-single",params:{country:G.country_code,group:G.group_code}},class:"fct-tax-region-link hover:no-underline"},{default:d(()=>[o("div",JAe,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${b(G.country_code)}.png`,alt:G.country_code},null,8,XAe),R(" "+m(G.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),n(P,{label:A(u)("Collecting"),width:"200"},{default:d(({row:G})=>[i.value?G.collecting?(r(),h("span",epe,m(A(u)("Collecting tax")),1)):G.hasConfig&&!G.enabled?(r(),h("span",tpe,m(A(u)("Disabled")),1)):(r(),h("span",ape,"—")):(r(),h("span",ZAe,"—"))]),_:1},8,["label"]),n(P,{label:A(u)("Enabled"),width:"140",align:"center"},{default:d(({row:G})=>[G.hasConfig?(r(),E(q,{key:0,"model-value":i.value?G.enabled:!1,loading:!!p.value[G.country_code],disabled:!i.value,onChange:te=>T(G,te)},null,8,["model-value","loading","disabled","onChange"])):(r(),h("span",lpe,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},npe={class:"fct-base-taxes"},ope={class:"fct-tax-class-tabs"},ipe={class:"fct-tax-class-tabs__list"},rpe={class:"fct-base-taxes__header"},dpe={class:"fct-base-taxes__header-label"},upe={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},cpe={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},Ape={class:"fct-base-taxes__state-fields"},ppe={class:"fct-base-taxes__region-name"},fpe={class:"fct-base-taxes__state-fields"},mpe={__name:"CountryTaxRatesLoader",setup(e){const t=[1,2,3];return(a,l)=>{const s=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",null,[o("div",npe,[o("div",ope,[o("div",ipe,[(r(),h(H,null,ae(3,c=>o("div",{key:c,class:"fct-tax-class-tabs__tab"},[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-16 h-5"})]),_:1})])),64)),n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-5 h-5"})]),_:1})])]),o("div",rpe,[o("span",dpe,m(A(u)("Regions")),1)]),o("div",upe,[o("div",cpe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",Ape,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{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(H,null,ae(t,c=>o("div",{key:c,class:"fct-base-taxes__state-row"},[o("div",ppe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",fpe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-compound h-8"})]),_:1})])])),64))])])}}},hpe={class:"fct-tax-class-tabs"},_pe={class:"fct-tax-class-tabs__list"},vpe=["onClick"],gpe=["title","onClick"],ype=["disabled","title"],bpe=["disabled","title"],wpe=["disabled"],Cpe=["disabled","title"],kpe={class:"fct-tax-class-tabs__search"},of={__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,s=M(!1),i=M(""),c=M(null),p=M(!1),f=N(()=>[...a.classes].sort((w,S)=>w.slug==="standard"&&S.slug!=="standard"?-1:w.slug!=="standard"&&S.slug==="standard"?1:0)),_=N(()=>["reduced","zero"].filter(w=>!a.classes.find(S=>S.slug===w))),g=()=>{i.value="",p.value=!1,s.value=!0,ke(()=>{var w;return(w=c.value)==null?void 0:w.focus()})},y=w=>{if(w==="custom"){g();return}l("add",w)},v=()=>{const w=i.value.trim();if(!w){b();return}l("create-custom",w)},b=()=>{s.value=!1,i.value="",p.value=!1},k=()=>{!a.creating&&!i.value.trim()&&b()};return be([()=>a.classes.length,()=>a.creating],([w,S],[$,V])=>{if(s.value){if(w>$){b();return}V&&!S&&(p.value=!0)}}),be(i,()=>{p.value=!1}),(w,S)=>{const $=C("el-input"),V=C("el-dropdown-item"),F=C("el-dropdown-menu"),x=C("el-dropdown");return r(),h("div",hpe,[o("div",_pe,[(r(!0),h(H,null,ae(f.value,Q=>(r(),h("button",{key:Q.id,class:de(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==Q.id}]),onClick:D=>l("switch",Q)},[R(m(Q.title)+" ",1),Q.slug!=="standard"?(r(),h("span",{key:0,class:"fct-tax-class-tabs__delete",title:A(u)("Delete tax class"),onClick:Ne(D=>l("delete",Q),["stop"])},[n(J,{name:"Close"})],8,gpe)):B("",!0)],10,vpe))),128)),e.classes.length<e.maxClasses?(r(),h(H,{key:0},[s.value?(r(),h("div",{key:0,class:de(["fct-tax-class-tabs__inline-create",{"fct-tax-class-tabs__inline-create--error":p.value}])},[n($,{ref_key:"inlineInput",ref:c,modelValue:i.value,"onUpdate:modelValue":S[0]||(S[0]=Q=>i.value=Q),size:"small",maxlength:"30",disabled:e.creating,placeholder:A(u)("e.g. Luxury"),onKeyup:[xa(v,["enter"]),xa(b,["esc"])],onBlur:k},null,8,["modelValue","disabled","placeholder"]),o("button",{class:"fct-tax-class-tabs__inline-confirm",disabled:e.creating||!i.value.trim(),title:A(u)("Create tax class"),onMousedown:S[1]||(S[1]=Ne(()=>{},["prevent"])),onClick:v},[n(J,{name:"Check"})],40,ype),o("button",{class:"fct-tax-class-tabs__inline-cancel",disabled:e.creating,title:A(u)("Cancel"),onMousedown:S[2]||(S[2]=Ne(()=>{},["prevent"])),onClick:b},[n(J,{name:"Close"})],40,bpe)],2)):_.value.length?(r(),E(x,{key:1,trigger:"click",disabled:e.creating,onCommand:y,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(F,null,{default:d(()=>[_.value.includes("reduced")?(r(),E(V,{key:0,command:"reduced"},{default:d(()=>[R(m(A(u)("Reduced")),1)]),_:1})):B("",!0),_.value.includes("zero")?(r(),E(V,{key:1,command:"zero"},{default:d(()=>[R(m(A(u)("Zero")),1)]),_:1})):B("",!0),n(V,{command:"custom"},{default:d(()=>[R(m(A(u)("Custom Class...")),1)]),_:1})]),_:1})]),default:d(()=>[o("button",{class:"fct-tax-class-tabs__add",disabled:e.creating},[n(J,{name:"Plus"})],8,wpe)]),_:1},8,["disabled"])):(r(),h("button",{key:2,class:"fct-tax-class-tabs__add",disabled:e.creating,title:A(u)("Add custom tax class"),onClick:g},[n(J,{name:"Plus"})],8,Cpe))],64)):B("",!0)]),o("div",kpe,[n($,{"model-value":e.search,placeholder:A(u)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":S[3]||(S[3]=Q=>l("update:search",Q)),onClear:S[4]||(S[4]=Q=>l("update:search",""))},{prefix:d(()=>[n(J,{name:"Search",class:"w-3.5 h-3.5 text-system-light dark:text-gray-400"})]),_:1},8,["model-value","placeholder"]),ba(w.$slots,"search-actions")])])}}},Bpe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,Id=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||Bpe(e),xpe=({classes:e=[],previousIds:t=new Set,createdSlug:a=null})=>{if(a){const l=e.find(s=>s.slug===a);if(l)return l}return e.find(l=>!t.has(l.id))||null},zo=async({payload:e,createdSlug:t=null,currentClasses:a=[],reloadClasses:l})=>{const s=new Set((a||[]).map(p=>p.id)),i=await ue.post("tax/classes",e),c=await l();return{response:i,classes:c,createdClass:xpe({classes:c,previousIds:s,createdSlug:t})}},rf=async({classId:e,currentActiveId:t=null,reloadClasses:a})=>{const l=await ue.delete("tax/classes/"+e),s=await a();return{response:l,classes:s,nextActiveClass:Id({classes:s,activeId:t})}};function en(e){return e==null||e===""?"":String(e)}const Spe={class:"setting-wrap"},Fpe={class:"setting-wrap-inner"},$pe={class:"fct-single-tax-rates-country-single-page"},Epe={class:"fct-single-tax-rates-country-single"},Upe={class:"single-page-header flex items-center justify-between"},Ipe={key:0,class:"flex items-center gap-2"},Qpe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},Dpe={class:"mt-3 flex justify-end"},Vpe={key:1,class:"fct-base-taxes"},Tpe={class:"fct-btn-group mt-4 justify-end sm"},Mpe={class:"fct-tax-rates-country-view"},Lpe={key:0},Rpe={key:1},Ope={key:0},Hpe={key:1},Ppe={class:"fct-btn-group sm justify-end"},hc={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=M(!1),l=M([]),s=M(""),i=N(()=>!!Ge.get("is_tax_enabled")),c=M([]),p=M(null),f=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}),b=M({rate:0,name:""}),k=M([]),w=M({}),S=M(""),$=N(()=>{const Z=S.value.trim().toLowerCase();return Z?k.value.filter(we=>we.stateName&&we.stateName.toLowerCase().includes(Z)):k.value}),V=N(()=>t.group==="EU"),F=N(()=>[v.value,...$.value]),x=M([]),Q=M(!1),D=M([]),T=M([]),U=M(!1),I=M(new Set),O=M(0),L=M([]),P=M(!1),q=M(!1),X=M(!1),G=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:""}),te=N(()=>{const Z=v.value.rate||0;return[{label:u("added to")+` ${Z}% `+u("federal tax"),is_compound:"0",for_order:0},{label:u("instead of")+` ${Z}% `+u("federal tax"),is_compound:"0",for_order:1},{label:u("compounded on top of")+` ${Z}% `+u("federal tax"),is_compound:"1",for_order:0}]}),ne=Z=>String(Z.is_compound)==="1"?"1_0":Z.for_order==1?"0_1":"0_0",re=(Z,we)=>{const[le,pe]=we.split("_");Z.is_compound=le,Z.for_order=parseInt(pe)},K=Z=>Z&&Z.replace(/\s*\(Standard\)\s*/gi,"").trim(),Y=M(!1),W=M({}),j=M(!1),ie=M(""),he=M(""),me=M(""),ye=M(!1),se=M(!1),fe=M(!0),$e=M(!1),tt=M(!1),ve=M(!1),Je=N(()=>u("Toggle tax collection for %1$s",s.value||t.country)),vt=()=>ue.get("tax/classes").then(Z=>{c.value=Z.classes||[],y.value=Z.max_classes||6,g.value=Z.next_builtin||null;const we=Id({classes:c.value,activeId:p.value});return we&&(p.value=we.id,f.value=we.slug),c.value}).catch(Z=>c.value),Ye=(Z="")=>{if(!Z)return v.value.name||"Tax";const we=k.value.find(le=>le.state===Z);return we!=null&&we.name?we.name:v.value.name||"Tax"},xe=Z=>{v.value={...Z.federalRate},b.value={...Z.federalOriginal},k.value=Z.stateRows.map(we=>({...we})),w.value={...Z.stateOriginals}},Ee=()=>({federalRate:{...v.value},federalOriginal:{...b.value},stateRows:k.value.map(Z=>({...Z})),stateOriginals:{...w.value}}),Oe=()=>{p.value&&(W.value[p.value]=Ee())},Me=async Z=>{Oe(),p.value=Z.id,f.value=Z.slug,W.value[Z.id]?(xe(W.value[Z.id]),await mt()):await jt()},gt=Z=>{_.value=!0,zo({payload:{slug:Z},createdSlug:Z,currentClasses:c.value,reloadClasses:vt}).then(({response:we,createdClass:le})=>{if(z.success(we.message),le)return Me(le)}).catch(we=>{var le;z.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},yt=Z=>{_.value=!0,zo({payload:{title:Z},currentClasses:c.value,reloadClasses:vt}).then(({response:we,createdClass:le})=>{if(z.success(we.message),le)return Me(le)}).catch(we=>{var le;z.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},Mt=Z=>{const we=p.value===Z.id;rl(u("All rates for this class will be deleted. Products using it will default to Standard."),u("Delete")+" "+Z.title+"?",{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{rf({classId:Z.id,currentActiveId:p.value,reloadClasses:vt}).then(({response:le,nextActiveClass:pe})=>{if(delete W.value[Z.id],z.success(le.message),pe)return we&&(p.value=null),Me(pe)}).catch(le=>{var pe;z.error(((pe=le==null?void 0:le.data)==null?void 0:pe.message)||"Failed to delete tax class")})}).catch(()=>{})},Ut=()=>ue.get("address-info/get-country-info",{country_code:t.country}).then(Z=>{l.value=Z.states||[],s.value=Z.country_name||t.country}).catch(Z=>{z.error(u("Failed to load country data. Please refresh the page."))}),Dt=()=>V.value?(he.value="",me.value="",Promise.resolve()):(ye.value=!0,ue.get("tax/country-tax-id/"+t.country).then(Z=>{var le;const we=((le=Z==null?void 0:Z.tax_data)==null?void 0:le.tax_id)||"";he.value=we,me.value=we}).catch(Z=>{var we;z.error(((we=Z==null?void 0:Z.data)==null?void 0:we.message)||u("Failed to load tax ID"))}).finally(()=>{ye.value=!1})),ht=({hydrateClassData:Z=!0}={})=>ue.get("tax/rates/country/rates/"+t.country).then(we=>{const le=we.tax_rates||[],pe=le.filter(Ke=>Ke.for_shipping!==null),je=p.value?le.filter(Ke=>Number(Ke.class_id)===Number(p.value)):le;D.value=je.filter(Ke=>!Ke.city&&!Ke.postcode).map(Ke=>({name:Ke.name,value:Ke.id,state:Ke.state||""}));const at=It(je);return ve.value=le.length>0,Z&&(xe(at),Oe(),fe.value=!!we.tax_enabled,tt.value=!0),{allRates:le,shippingOverrides:pe,classEntry:at}}).catch(we=>(z.error(u("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),Pt=()=>ue.get("tax/product-overrides/"+t.country).then(Z=>Z.overrides||[]).catch(()=>[]),Ct=()=>{L.value.length>0||(P.value=!0,ue.get("products/fetch-term").then(Z=>{const we=Z.taxonomies&&Z.taxonomies["product-categories"]?Z.taxonomies["product-categories"].terms||[]:[];L.value=we.map(le=>({...le,value:en(le.value)}))}).catch(()=>{}).finally(()=>{P.value=!1}))};let St=0;const Ot=Z=>{const we=++St;return!Z||Number(Z)===Number(p.value)?(T.value=D.value.slice(),U.value=!1,Promise.resolve()):(U.value=!0,T.value=[],ue.get("tax/rates/country/rates/"+t.country,{class_id:Z}).then(le=>{if(we!==St)return;const pe=le.tax_rates||[];T.value=pe.filter(je=>!je.city&&!je.postcode).map(je=>({name:je.name,value:je.id,state:je.state||""}))}).catch(()=>{we===St&&(T.value=[],z.error(u("Failed to load tax rates for the selected tax class")))}).finally(()=>{we===St&&(U.value=!1)}))},Ht=(Z,we)=>{var pe,je;const le=[];for(const at of Z){const Ke=at.state?((pe=l.value.find(Xe=>Xe.value===at.state))==null?void 0:pe.name)||at.state:s.value||t.country,qe=Ye(at.state||""),ft=c.value.find(Xe=>Number(Xe.id)===Number(at.class_id));le.push({id:at.id,type:"shipping",label:qe,tax_label:qe,category_name:"",location:Ke,city:at.city||"",postcode:at.postcode||"",rate:at.for_shipping,class_id:Number(at.class_id)||0,class_label:ft?ft.title:"",_raw:at})}for(const at of we){const Ke=at.meta_value||at,qe=Ke.state||"",ft=qe?((je=l.value.find(Xt=>Xt.value===qe))==null?void 0:je.name)||qe:s.value||t.country,Xe=Number(at.class_id)||0,Et=Xe?c.value.find(Xt=>Number(Xt.id)===Xe):null;le.push({id:at.id,type:"products",label:Ke.category_name||"",tax_label:Ke.tax_label||"",category_name:Ke.category_name||"",location:ft,city:Ke.city||"",postcode:Ke.postcode||"",rate:Ke.rate,class_id:Xe,class_label:Et?Et.title:"",_raw:at})}x.value=le},It=Z=>{const we=Xe=>(!Xe.state||Xe.state==="")&&(!Xe.city||Xe.city==="")&&(!Xe.postcode||Xe.postcode===""),le=Z.find(we),pe=Z.filter(Xe=>Xe.state&&Xe.state!==""&&(!Xe.city||Xe.city==="")&&(!Xe.postcode||Xe.postcode===""));let je,at;if(le){const Xe=K(le.name)||"Tax";je={...le,name:Xe},at={rate:le.rate,name:Xe}}else je={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},at={rate:0,name:"Tax"};const Ke={};for(const Xe of pe)Ke[Xe.state]=Xe;const qe=[],ft={};for(const Xe of l.value){const Et=Ke[Xe.value];if(Et){const Xt=K(Et.name)||"State Tax";qe.push({id:Et.id,state:Xe.value,stateName:Xe.name,rate:Et.rate,name:Xt,is_compound:String(Et.is_compound||"0"),for_order:Et.for_order||0}),ft[Xe.value]={rate:Et.rate,name:Xt,is_compound:String(Et.is_compound||"0"),for_order:Et.for_order||0}}else qe.push({id:null,state:Xe.value,stateName:Xe.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),ft[Xe.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:je,federalOriginal:at,stateRows:qe,stateOriginals:ft}},mt=async()=>{const[{shippingOverrides:Z},we]=await Promise.all([ht({hydrateClassData:!1}),Pt()]);Ht(Z,we)},jt=async()=>{a.value=!0;try{const[{shippingOverrides:Z},we]=await Promise.all([ht(),Pt()]);Ht(Z,we)}finally{a.value=!1}},ge=async()=>{a.value=!0;try{await Promise.all([vt(),Ut(),Dt()]),await jt()}finally{a.value=!1}},Fe=()=>{V.value||se.value||ye.value||(se.value=!0,ue.post("tax/country-tax-id/"+t.country,{tax_id:he.value||""}).then(Z=>{me.value=he.value||"",z.success(Z.message||u("Tax ID has been saved successfully"))}).catch(Z=>{var we;z.error(((we=Z==null?void 0:Z.data)==null?void 0:we.message)||u("Failed to save tax ID"))}).finally(()=>{se.value=!1}))},nt=Z=>{if($e.value)return;const we=fe.value;fe.value=Z,$e.value=!0,ue.post("tax/country-status/"+t.country,{enabled:Z?1:0}).then(le=>{fe.value=le.enabled,z.success(le.message)}).catch(le=>{var pe;fe.value=we,z.error(((pe=le==null?void 0:le.data)==null?void 0:pe.message)||u("Failed to update tax status"))}).finally(()=>{$e.value=!1})},bt=async()=>{try{await rl(u("This will overwrite your current rates with preset defaults. Continue?"),u("Reset to default tax rates"),{confirmButtonText:u("Reset"),cancelButtonText:u("Cancel"),type:"warning"})}catch{return}j.value=!0;try{const we=(await ue.get("tax/configuration/rates")).tax_rates||{};let le=[];for(const qe in we){const ft=we[qe];for(const Xe of ft.countries||[])if(Xe.country_code===t.country){le=Xe.rates||[];break}if(le.length)break}if(!le.length){z.error(u("No preset rates found for this country"));return}const pe=le.find(qe=>(!qe.state||qe.state==="")&&qe.type==="standard"),je=le.filter(qe=>qe.state&&qe.state!==""&&qe.type==="standard"),at=[];pe&&pe.rate>0&&(v.value.rate=pe.rate,v.value.name=K(pe.name||"")||u("Tax"),at.push(Bt()));const Ke=[];for(const qe of je){const ft=k.value.find(Xe=>Xe.state===qe.state);ft&&(ft.rate=qe.rate,ft.name=K(qe.name)||u("State Tax"),ft.is_compound=qe.compound?"1":"0",Ke.push(Wt(ft)))}await Promise.all([...at,...Ke]),Oe(),await mt(),z.success(u("Tax rates have been reset to defaults"))}catch{z.error(u("Failed to reset tax rates"))}finally{j.value=!1}},Bt=()=>{const Z={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?ue.put("tax/country/rate/"+v.value.id,Z):ue.post("tax/country/rate",Z)).then(le=>{le.tax_rate&&(v.value.id=le.tax_rate.id),b.value={rate:v.value.rate,name:v.value.name}})},Wt=Z=>{const we={country:t.country,state:Z.state,rate:Z.rate,name:Z.name,is_compound:Z.is_compound,for_order:Z.for_order,group:t.group,class_id:p.value||""};return(Z.id?ue.put("tax/country/rate/"+Z.id,we):ue.post("tax/country/rate",we)).then(pe=>{pe.tax_rate&&(Z.id=pe.tax_rate.id),w.value[Z.state]={rate:Z.rate,name:Z.name,is_compound:String(Z.is_compound),for_order:Z.for_order}})},_t=async()=>{Y.value=!0;try{const Z=[];(String(v.value.rate)!==String(b.value.rate)||v.value.name!==b.value.name)&&Z.push(Bt());for(const le of k.value){const pe=w.value[le.state];(!pe||String(le.rate)!==String(pe.rate)||le.name!==pe.name||String(le.is_compound)!==String(pe.is_compound)||le.for_order!=pe.for_order)&&Z.push(Wt(le))}await Promise.all(Z),Oe(),await mt(),z.success(u("Tax rates saved"))}catch{z.error(u("Failed to save rates"))}finally{Y.value=!1}},la=()=>{I.value=new Set,O.value=0},sa=()=>{const Z=Ye();X.value=!1,G.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:Z,tax_rate:0,override_state_tax:!0,class_id:Number(p.value)||0,id:"",previous_id:""},ie.value=Z,T.value=D.value.slice(),Q.value=!0,Ct()},Nt=Z=>{if(X.value=!0,Ct(),Z.type==="shipping"){const we=Z._raw.state||"",le=Ye(we),pe=Number(Z._raw.class_id)||Number(p.value)||0;G.value={type:"shipping",original_type:"shipping",original_id:Z.id,category_id:"",category_name:"",state:we||"__country__",city:Z._raw.city||"",postcode:Z._raw.postcode||"",tax_label:le,tax_rate:Z.rate,override_state_tax:!0,class_id:pe,id:Z.id,previous_id:Z.id},ie.value=le,O.value=pe,Ot(pe);const je=Z._raw.city||"",at=Z._raw.postcode||"",Ke=new Set;for(const qe of x.value)qe.type==="shipping"&&(qe._raw.state||"")===we&&(qe._raw.city||"")===je&&(qe._raw.postcode||"")===at&&Ke.add(Number(qe.class_id));I.value=Ke}else{const we=Z._raw.meta_value||Z._raw,le=we.state||"",pe=Ye(le),je=Z.tax_label||pe;G.value={type:"products",original_type:"products",original_id:Z.id,category_id:en(we.category_id),category_name:Z.category_name,state:le||"__country__",tax_label:je,tax_rate:Z.rate,override_state_tax:we.override_state_tax==="yes",city:we.city||"",postcode:we.postcode||"",class_id:Z.class_id||0,id:Z.id,previous_id:""},ie.value=pe}Q.value=!0},ia=N(()=>{const Z=[{label:s.value||t.country,value:"__country__"}];for(const we of l.value)Z.push({label:we.name,value:we.value});return Z}),el=N(()=>{if(!T.value.length)return ia.value;const Z=new Set(T.value.map(we=>we.state||""));return ia.value.filter(we=>{const le=we.value==="__country__"?"":we.value;return Z.has(le)})}),Ll=Z=>{const we=en(Z),le=L.value.find(pe=>pe.value===we);le&&(G.value.category_name=le.label)},Ra=Z=>{rl(u("Are you sure you want to delete this override?"),u("Confirm Delete"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{const we=Z.type==="shipping"?"tax/rates/country/override/"+Z.id:"tax/product-overrides/"+Z.id;ue.delete(we).then(le=>{z.success(le.message),x.value=x.value.filter(pe=>!(pe.id===Z.id&&pe.type===Z.type))}).catch(le=>{var pe;z.error(((pe=le==null?void 0:le.data)==null?void 0:pe.message)||u("Failed to delete override"))})}).catch(()=>{})},na=async()=>{var we;const Z=G.value.state==="__country__"?"":G.value.state;if(G.value.type==="products"&&!G.value.category_id){z.error(u("Please select a category"));return}if(G.value.type==="shipping"){if(!G.value.class_id){z.error(u("Please select a tax class"));return}if(U.value){z.error(u("Please wait for the province rates to finish loading"));return}const le=T.value.find(pe=>(pe.state||"")===Z);G.value.id=le?le.value:0}q.value=!0;try{let le;if(G.value.type==="products"){const pe=G.value.state==="__country__"?"":G.value.state;le=await ue.post("tax/product-overrides",{id:X.value&&G.value.original_type==="products"?G.value.original_id:"",source_type:G.value.original_type,source_id:G.value.original_id,country:t.country,state:pe,category_id:G.value.category_id,category_name:G.value.category_name,tax_label:G.value.tax_label,rate:G.value.tax_rate,override_state_tax:G.value.override_state_tax===!0?"yes":"no",city:G.value.city||"",postcode:G.value.postcode||"",class_id:G.value.class_id||0})}else le=await ue.post("tax/rates/country/override",{id:G.value.id,country:t.country,state:Z,previous_id:X.value&&G.value.original_type==="shipping"?G.value.previous_id:"",source_type:G.value.original_type,source_id:G.value.original_id,class_id:G.value.class_id||p.value||"",override_tax_rate:G.value.tax_rate,city:G.value.city||"",postcode:G.value.postcode||""});z.success(le.message),Q.value=!1,await mt()}catch(le){const pe=((we=le==null?void 0:le.data)==null?void 0:we.message)||(le==null?void 0:le.message)||"Failed to save override";z.error(pe)}finally{q.value=!1}};return be(()=>G.value.type,Z=>{Z==="shipping"&&(G.value.class_id||(G.value.class_id=p.value||0),Ot(G.value.class_id))}),be(()=>G.value.class_id,Z=>{G.value.type!=="shipping"||!Q.value||Ot(Z).then(()=>{const we=G.value.state==="__country__"?"":G.value.state,le=T.value.map(pe=>pe.state||"");we!==""&&!le.includes(we)&&(G.value.state="__country__")})}),be(()=>G.value.state,Z=>{if(!Q.value||G.value.type!=="products"||X.value)return;const we=Ye(Z==="__country__"?"":Z);(!G.value.tax_label||G.value.tax_label===ie.value)&&(G.value.tax_label=we),ie.value=we}),Ie(()=>{ge()}),(Z,we)=>{const le=C("el-breadcrumb-item"),pe=C("el-breadcrumb"),je=C("el-switch"),at=C("el-skeleton"),Ke=C("el-input"),qe=C("el-form-item"),ft=C("el-form"),Xe=C("el-button"),Et=C("el-table-column"),Xt=C("el-option"),Ae=C("el-select"),_e=C("el-table"),Le=C("el-tag"),Ve=C("el-radio"),ee=C("el-radio-group"),He=C("el-checkbox"),ut=C("el-dialog");return r(),h("div",Spe,[o("div",Fpe,[o("div",$pe,[o("div",Epe,[o("div",Upe,[n(pe,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[e.group==="EU"?(r(),E(le,{key:0,to:{name:"eu"}},{default:d(()=>[R(m(A(u)("Tax Regions")),1)]),_:1})):(r(),E(le,{key:1,to:{name:"tax_rates"}},{default:d(()=>[R(m(A(u)("Tax Regions")),1)]),_:1})),n(le,null,{default:d(()=>[R(m(s.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),tt.value&&ve.value?(r(),h("div",Ipe,[i.value?(r(),h("span",{key:0,class:de(["text-sm",fe.value?"text-success-500":"text-system-mid dark:text-gray-300"])},m(fe.value?A(u)("Collecting tax"):A(u)("Disabled")),3)):B("",!0),n(je,{"model-value":i.value?fe.value:!1,loading:$e.value,disabled:!i.value,"aria-label":Je.value,onChange:nt},null,8,["model-value","loading","disabled","aria-label"])])):B("",!0)]),!a.value&&!i.value?(r(),h("div",Qpe,[n(Xa,{type:"warning",icon:"AlertTriangle",content:A(u)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):B("",!0),V.value?B("",!0):(r(),E(Be,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[ye.value?(r(),E(at,{key:0,animated:"",rows:2})):(r(),E(ft,{key:1,"label-position":"top"},{default:d(()=>[n(qe,{label:A(u)("VAT/GST/Tax Number"),class:"mb-0"},{default:d(()=>[n(Ke,{modelValue:he.value,"onUpdate:modelValue":we[0]||(we[0]=Se=>he.value=Se),placeholder:A(u)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",Dpe,[n(Xe,{type:"primary",size:"small",loading:se.value,disabled:ye.value||se.value||he.value===me.value,onClick:Fe},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Base taxes")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(Xa,{type:"info"},{content:d(()=>[o("span",null,m(A(u)("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"))+" + "+m(A(u)("button to add tax classes.")),1)]),_:1}),a.value?(r(),E(mpe,{key:0})):(r(),h("div",Vpe,[n(of,{classes:c.value,"active-id":p.value,"max-classes":y.value,creating:_.value,search:S.value,onSwitch:Me,onDelete:Mt,onAdd:gt,onCreateCustom:yt,"onUpdate:search":we[1]||(we[1]=Se=>S.value=Se)},null,8,["classes","active-id","max-classes","creating","search"]),n(_e,{data:F.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:d(()=>[n(Et,{label:A(u)("Region")},{default:d(({row:Se})=>[o("span",{class:de(["fct-base-taxes__region-name",Se.state?"":"fct-base-taxes__region-name--federal"])},m(Se.state?Se.stateName:s.value||e.country),3)]),_:1},8,["label"]),n(Et,{label:A(u)("Rate"),width:"130"},{default:d(({row:Se})=>[n(Ke,{modelValue:Se.rate,"onUpdate:modelValue":kt=>Se.rate=kt,size:"small",type:"number",step:"0.01",min:"0"},{suffix:d(()=>we[18]||(we[18]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(Et,{label:A(u)("Tax Label"),width:"200"},{default:d(({row:Se})=>[n(Ke,{modelValue:Se.name,"onUpdate:modelValue":kt=>Se.name=kt,size:"small",placeholder:A(u)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),k.value.length>0?(r(),E(Et,{key:0,label:A(u)("Compound"),width:"310"},{default:d(({row:Se})=>[Se.state?(r(),E(Ae,{key:0,"model-value":ne(Se),size:"small",style:{width:"100%"},onChange:kt=>re(Se,kt)},{default:d(()=>[n(Xt,{value:"0_0",label:te.value[0].label},null,8,["label"]),n(Xt,{value:"0_1",label:te.value[1].label},null,8,["label"]),n(Xt,{value:"1_0",label:te.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]),o("div",Tpe,[f.value==="standard"?(r(),E(Xe,{key:0,loading:j.value,size:"small",onClick:bt,type:"danger",soft:""},{default:d(()=>[R(m(A(u)("Reset to default")),1)]),_:1},8,["loading"])):B("",!0),n(Xe,{type:"primary",size:"small",loading:Y.value,onClick:_t},{default:d(()=>[R(m(A(u)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Tax overrides"),text:A(u)("Override tax rates for specific product categories or shipping.")},{action:d(()=>[n(Xe,{size:"small",onClick:sa},{default:d(()=>[R(m(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[o("div",Mpe,[n(_e,{data:x.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n(Et,{label:A(u)("Type"),width:"110"},{default:d(({row:Se})=>[n(Le,{type:Se.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(m(Se.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n(Et,{label:A(u)("Category")},{default:d(({row:Se})=>[R(m(Se.category_name||"—"),1)]),_:1},8,["label"]),n(Et,{label:A(u)("Tax Label")},{default:d(({row:Se})=>[R(m(Se.tax_label||"—"),1)]),_:1},8,["label"]),n(Et,{label:A(u)("Location")},{default:d(({row:Se})=>[R(m(Se.location),1)]),_:1},8,["label"]),n(Et,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:Se})=>[Se.type==="products"?(r(),h("span",Lpe,m(Se.class_label||A(u)("All")),1)):(r(),h("span",Rpe,m(Se.class_label||"—"),1))]),_:1},8,["label"]),n(Et,{label:A(u)("City / Postcode")},{default:d(({row:Se})=>[Se.city||Se.postcode?(r(),h("span",Ope,m([Se.city,Se.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",Hpe,"—"))]),_:1},8,["label"]),n(Et,{label:A(u)("Rate"),width:"100"},{default:d(({row:Se})=>[R(m(Se.rate)+"% ",1)]),_:1},8,["label"]),n(Et,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:Se})=>[o("div",Ppe,[n(Ze,{tag:"button",size:"small",onClick:kt=>Nt(Se)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ze,{tag:"button",size:"small",onClick:kt=>Ra(Se),bg:"danger",outline:""},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),n(ut,{modelValue:Q.value,"onUpdate:modelValue":we[17]||(we[17]=Se=>Q.value=Se),title:(X.value?A(u)("Edit tax override for"):A(u)("Add tax override for"))+" "+(s.value||e.country),width:"520px","append-to-body":!0,onClose:la},{footer:d(()=>[n(Xe,{onClick:we[16]||(we[16]=Se=>Q.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(Xe,{type:"primary",loading:q.value,onClick:na},{default:d(()=>[R(m(X.value?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(ft,{"label-position":"top",model:G.value},{default:d(()=>[n(qe,{label:A(u)("Override type")},{default:d(()=>[n(ee,{modelValue:G.value.type,"onUpdate:modelValue":we[2]||(we[2]=Se=>G.value.type=Se)},{default:d(()=>[n(Ve,{value:"products"},{default:d(()=>[R(m(A(u)("Products")),1)]),_:1}),n(Ve,{value:"shipping"},{default:d(()=>[R(m(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),G.value.type==="products"?(r(),h(H,{key:0},[n(qe,{label:A(u)("Category")},{default:d(()=>[n(Ae,{modelValue:G.value.category_id,"onUpdate:modelValue":we[3]||(we[3]=Se=>G.value.category_id=Se),filterable:"",placeholder:A(u)("Select a category"),loading:P.value,style:{width:"100%"},onChange:Ll},{default:d(()=>[(r(!0),h(H,null,ae(L.value,Se=>(r(),E(Xt,{key:Se.value,label:Se.label,value:Se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax Class")},{default:d(()=>[n(Ae,{modelValue:G.value.class_id,"onUpdate:modelValue":we[4]||(we[4]=Se=>G.value.class_id=Se),style:{width:"100%"}},{default:d(()=>[n(Xt,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(H,null,ae(c.value,Se=>(r(),E(Xt,{key:Se.id,value:Number(Se.id),label:Se.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax label")},{default:d(()=>[n(Ke,{modelValue:G.value.tax_label,"onUpdate:modelValue":we[5]||(we[5]=Se=>G.value.tax_label=Se),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Location")},{default:d(()=>[n(Ae,{modelValue:G.value.state,"onUpdate:modelValue":we[6]||(we[6]=Se=>G.value.state=Se),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(ia.value,Se=>(r(),E(Xt,{key:Se.value,label:Se.label,value:Se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("City (optional)")},{default:d(()=>[n(Ke,{modelValue:G.value.city,"onUpdate:modelValue":we[7]||(we[7]=Se=>G.value.city=Se),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Ke,{modelValue:G.value.postcode,"onUpdate:modelValue":we[8]||(we[8]=Se=>G.value.postcode=Se),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Ke,{modelValue:G.value.tax_rate,"onUpdate:modelValue":we[9]||(we[9]=Se=>G.value.tax_rate=Se),type:"number",step:"0.01",min:"0",placeholder:A(u)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),k.value.length>0?(r(),E(qe,{key:0},{default:d(()=>[n(He,{modelValue:G.value.override_state_tax,"onUpdate:modelValue":we[10]||(we[10]=Se=>G.value.override_state_tax=Se)},{default:d(()=>[R(m(A(u)("Also override state/provincial taxes")),1)]),_:1},8,["modelValue"])]),_:1})):B("",!0)],64)):(r(),h(H,{key:1},[n(qe,{label:A(u)("Tax Class")},{default:d(()=>[n(Ae,{modelValue:G.value.class_id,"onUpdate:modelValue":we[11]||(we[11]=Se=>G.value.class_id=Se),style:{width:"100%"},loading:U.value},{default:d(()=>[(r(!0),h(H,null,ae(c.value,Se=>(r(),E(Xt,{key:Se.id,value:Number(Se.id),label:Se.title,disabled:X.value&&Number(Se.id)!==Number(O.value)&&I.value.has(Number(Se.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),n(qe,{label:A(u)("Location")},{default:d(()=>[n(Ae,{modelValue:G.value.state,"onUpdate:modelValue":we[12]||(we[12]=Se=>G.value.state=Se),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(el.value,Se=>(r(),E(Xt,{key:Se.value,label:Se.label,value:Se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("City (optional)")},{default:d(()=>[n(Ke,{modelValue:G.value.city,"onUpdate:modelValue":we[13]||(we[13]=Se=>G.value.city=Se),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Ke,{modelValue:G.value.postcode,"onUpdate:modelValue":we[14]||(we[14]=Se=>G.value.postcode=Se),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Ke,{modelValue:G.value.tax_rate,"onUpdate:modelValue":we[15]||(we[15]=Se=>G.value.tax_rate=Se),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])])])])}}};class Npe extends Qs{getTabs(){return{all:u("All"),filed:u("Filed"),not_filed:u("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 u("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 Kpe(e){return Npe.init(e)}const Gpe=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),jpe=e=>{const t=Object.keys(e[0]),l=[t.map(Gpe).join(",")];return e.forEach(s=>{const i=t.map(c=>{let p=s[c];return typeof p=="object"&&(p=JSON.stringify(p)),typeof p=="string"&&(p=`"${p.replace(/"/g,'""')}"`),p});l.push(i.join(","))}),l.join(`
285 `)},zpe=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=jpe(e),i=new Blob([s],{type:"text/csv"}),c=document.createElement("a"),p=()=>{window.removeEventListener("focus",p),a()};window.addEventListener("focus",p),c.href=URL.createObjectURL(i),c.download=t,c.click(),URL.revokeObjectURL(c.href),setTimeout(()=>{a()},200)}catch(s){l(s)}}),qpe={class:"table-cell"},Ype={class:"table-cell"},Wpe={class:"table-cell"},Jpe={class:"table-cell"},Xpe={class:"table-cell"},Zpe={class:"table-cell"},efe={class:"table-cell"},tfe={class:"table-cell"},afe={class:"table-cell"},lfe={__name:"TaxesLoader",props:{nextPageCount:{type:Number,default:0},taxTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-table-column"),c=C("el-skeleton-item"),p=C("el-skeleton"),f=C("el-table");return r(),E(f,{data:A(a),class:"w-full compact-table full-compact"},{default:d(()=>[n(i,{type:"selection",width:45}),e.taxTable.isColumnVisible("id")?(r(),E(i,{key:0,width:100,label:A(u)("ID")},{default:d(()=>[o("div",qpe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.taxTable.isColumnVisible("order_id")?(r(),E(i,{key:1,label:A(u)("Order ID"),width:100},{default:d(()=>[o("div",Ype,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(i,{label:A(u)("Tax Country"),width:120},{default:d(()=>[o("div",Wpe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),n(i,{label:A(u)("Tax Region"),width:120},{default:d(()=>[o("div",Jpe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("postcode")?(r(),E(i,{key:2,label:A(u)("Zip Code"),width:120},{default:d(()=>[o("div",Xpe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(i,{label:A(u)("Tax Name"),width:120},{default:d(()=>[o("div",Zpe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("rate")?(r(),E(i,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(()=>[o("div",efe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(i,{label:A(u)("Sale Taxes"),width:120},{default:d(()=>[o("div",tfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("filed_at")?(r(),E(i,{key:4,label:A(u)("Filed"),width:120},{default:d(()=>[o("div",afe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},sfe={class:"table-cell"},nfe={class:"table-cell"},ofe={class:"table-cell"},ife={class:"table-cell"},rfe={class:"table-cell"},dfe={class:"table-cell"},ufe={class:"table-cell"},cfe={class:"table-cell"},Afe={class:"table-cell"},pfe={__name:"AllCouponsLoader",props:{nextPageCount:{type:Number,default:0},couponTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-skeleton"),p=C("el-table-column"),f=C("el-table");return r(),E(f,{data:A(a),class:"w-full compact-table responsive full-compact"},{default:d(()=>[n(p,{width:103,label:A(u)("ID")},{default:d(()=>[o("div",sfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(r(),E(p,{key:0,label:A(u)("Title"),width:227},{default:d(()=>[o("div",nfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[180px]"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(p,{label:A(u)("Code"),width:206},{default:d(()=>[o("div",ofe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[130px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Amount"),width:124},{default:d(()=>[o("div",ife,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Usage"),width:155},{default:d(()=>[o("div",rfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(r(),E(p,{key:1,label:A(u)("Stackable"),width:124},{default:d(()=>[o("div",dfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[80px]"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(p,{label:A(u)("Status"),width:124},{default:d(()=>[o("div",ufe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Expiry Date"),width:124},{default:d(()=>[o("div",cfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(r(),E(p,{key:2,label:A(u)("Actions"),width:103,align:"right"},{default:d(()=>[o("div",Afe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},ffe={class:"fct-taxes-page fct-layout-width"},mfe={key:1},hfe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},_fe={class:"fct-tax-filing-wrap"},vfe={class:"fct-tax-filing-summary"},gfe={class:"summary-item"},yfe={class:"summary-label"},bfe={class:"summary-value"},wfe={class:"summary-item"},Cfe={class:"summary-label"},kfe={class:"summary-value"},Bfe={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},xfe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Sfe={class:"dialog-footer"},Ffe={class:"fct-tax-filing-success-wrap"},$fe={class:"fct-tax-filling-success-icon"},Efe={class:"dialog-footer"},Ufe={__name:"Taxes",setup(e){const t=Object.fromEntries(rm.map(x=>[x.value,x.label])),a=x=>t[x]||x;Yt().ctx;const l=Kpe(),s=M(!1),i=M(!1),c=M(!1),p=M([]),f=N(()=>l.getTableData().map(x=>{var Q,D,T,U,I,O,L,P,q,X,G;return{id:x.id,order_id:x.order_id,country:a(((Q=x.tax_rate)==null?void 0:Q.country)??((D=x.meta)==null?void 0:D.tax_country)??""),state:((T=x.tax_rate)==null?void 0:T.formatted_state)??((U=x.tax_rate)==null?void 0:U.state)??"",postcode:((I=x.tax_rate)==null?void 0:I.postcode)??"",name:((O=x.tax_rate)==null?void 0:O.name)??((L=x.meta)==null?void 0:L.label)??"",reverse_charge:!!((P=x.meta)!=null&&P.reverse_charge_applied),rate:((q=x.tax_rate)==null?void 0:q.rate)??((X=x.meta)==null?void 0:X.rate_percent)??"",total_tax:String(parseFloat((x.total_tax/100).toFixed(2))),currency:((G=x.order)==null?void 0:G.currency)||"",total_tax:String(parseFloat((x.total_tax/100).toFixed(2))),filed_at:x.filed_at?u("Yes"):u("No")}})),_=()=>{s.value=!0,i.value=!1},g=()=>{s.value=!1,i.value=!0},y=async()=>{try{await zpe($.value),g()}catch{}},v=()=>{i.value=!1},b=()=>{const x=$.value.map(Q=>Q.id);ue.post(l.getFetchUrl(),{ids:x}).then(Q=>{z.success(Q.message),l.fetch()}).catch(Q=>{z.error(Q)}).finally(()=>{v()})},k=x=>{p.value=x,c.value=x.length>0},w=x=>{$.value=x},S=M(null),$=M([]),V=N(()=>{const x=$.value.reduce((D,T)=>D+parseFloat(T.total_tax||0),0),Q=[...new Set($.value.map(D=>D.order_id))];return{totalTax:pt.formatNumber(Math.round(x*100),!1),totalOrders:Q.length,items:$.value}}),F=()=>{ke(()=>{$.value=[...p.value],p.value.forEach(x=>{S.value.toggleRowSelection(x,!0)})})};return(x,Q)=>{const D=C("el-button"),T=C("el-tooltip"),U=C("el-table-column"),I=C("router-link"),O=C("el-tag"),L=C("el-table"),P=C("el-dialog");return r(),h("div",ffe,[n(nl,{title:A(u)("Taxes")},{action:d(()=>[c.value?(r(),E(D,{key:1,type:"primary",onClick:_,disabled:!c.value},{default:d(()=>[R(m(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])):(r(),E(T,{key:0,"popper-class":"fct-tooltip",effect:"dark",content:A(u)("Please select the taxes you want to file"),placement:"top-start"},{default:d(()=>[n(D,{type:"primary",disabled:!c.value},{default:d(()=>[R(m(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),n(Ds,{table:A(l),"has-mobile-slot":!1},{default:d(()=>[A(l).isLoading()?(r(),E(lfe,{key:0,taxTable:A(l),"next-page-count":A(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",mfe,[n(L,{class:"w-full",data:f.value,onSelectionChange:k},{empty:d(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(U,{type:"selection",width:45}),A(l).isColumnVisible("id")?(r(),E(U,{key:0,label:A(u)("ID"),width:100},{default:d(q=>[o("span",null,"#"+m(A(u)(q.row.id)),1)]),_:1},8,["label"])):B("",!0),A(l).isColumnVisible("order_id")?(r(),E(U,{key:1,label:A(u)("Order ID"),width:100},{default:d(q=>[o("span",hfe,[n(I,{class:"link",to:{name:"view_order",params:{order_id:q.row.order_id}}},{default:d(()=>[R(" #"+m(q.row.order_id),1)]),_:2},1032,["to"]),q.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[R(m(A(u)("Reverse Charge")),1)]),_:1})):B("",!0)])]),_:1},8,["label"])):B("",!0),n(U,{label:A(u)("Tax Country"),width:120},{default:d(q=>[o("span",null,m(q.row.country),1)]),_:1},8,["label"]),n(U,{label:A(u)("Tax Region"),width:120},{default:d(q=>[o("span",null,m(q.row.state),1)]),_:1},8,["label"]),A(l).isColumnVisible("postcode")?(r(),E(U,{key:2,label:A(u)("Zip Code"),width:120},{default:d(q=>[o("span",null,m(q.row.postcode),1)]),_:1},8,["label"])):B("",!0),n(U,{label:A(u)("Tax Name"),width:120},{default:d(q=>[o("span",null,m(q.row.name),1)]),_:1},8,["label"]),A(l).isColumnVisible("rate")?(r(),E(U,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(q=>[o("span",null,m(q.row.rate)+"%",1)]),_:1},8,["label"])):B("",!0),n(U,{label:A(u)("Sale Taxes"),width:120},{default:d(q=>[o("span",null,m(A(pt).formatForOrder(q.row.total_tax_cents,q.row.currency)),1)]),_:1},8,["label"]),A(l).isColumnVisible("filed_at")?(r(),E(U,{key:4,label:A(u)("Filed"),width:120},{default:d(q=>[o("span",null,m(q.row.filed_at),1)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),n(P,{modelValue:s.value,"onUpdate:modelValue":Q[1]||(Q[1]=q=>s.value=q),title:A(u)("Tax Filing"),onOpen:F,class:"fct-tax-filling-modal"},{footer:d(()=>[o("div",Sfe,[n(D,{onClick:Q[0]||(Q[0]=()=>{s.value=!1})},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(D,{type:"primary",onClick:y},{default:d(()=>[n(J,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+m(A(u)("Download & Continue")),1)]),_:1})])]),default:d(()=>[o("div",_fe,[o("div",vfe,[o("div",gfe,[o("span",yfe,m(A(u)("Taxable Amount")),1),o("span",bfe,m(V.value.totalTax),1)]),o("div",wfe,[o("span",Cfe,m(A(u)("Total Orders")),1),o("span",kfe,m(A(u)(V.value.totalOrders)),1)])]),o("div",Bfe,[n(L,{ref_key:"selectedTaxesTableRef",ref:S,data:p.value,onSelectionChange:w},{empty:d(()=>[n(wt,{icon:"Empty/ListView",text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(U,{type:"selection",width:45}),n(U,{label:A(u)("ID"),width:100},{default:d(q=>[o("span",null,m(q.row.id),1)]),_:1},8,["label"]),n(U,{label:A(u)("Order ID"),"min-width":100},{default:d(q=>[o("span",xfe,[o("span",null,m(q.row.order_id),1),q.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[R(m(A(u)("Reverse Charge")),1)]),_:1})):B("",!0)])]),_:1},8,["label"]),n(U,{width:120,label:A(u)("Tax Country")},{default:d(q=>[o("span",null,m(q.row.country),1)]),_:1},8,["label"]),n(U,{width:120,label:A(u)("Tax Region")},{default:d(q=>[o("span",null,m(q.row.state),1)]),_:1},8,["label"]),n(U,{label:A(u)("Zip Code"),width:120},{default:d(q=>[o("span",null,m(q.row.postcode),1)]),_:1},8,["label"]),n(U,{width:120,label:A(u)("Tax Name")},{default:d(q=>[o("span",null,m(q.row.name),1)]),_:1},8,["label"]),n(U,{label:A(u)("Tax Rate"),width:120},{default:d(q=>[o("span",null,m(q.row.rate)+"%",1)]),_:1},8,["label"]),n(U,{width:150,label:A(u)("Sale Taxes")},{default:d(q=>[o("span",null,m(A(pt).formatForOrder(q.row.total_tax_cents,q.row.currency)),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),n(P,{modelValue:i.value,"onUpdate:modelValue":Q[2]||(Q[2]=q=>i.value=q),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:d(()=>[o("div",Efe,[n(D,{onClick:v},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(D,{type:"primary",onClick:b},{default:d(()=>[R(m(A(u)("Mark as Filed")),1)]),_:1})])]),default:d(()=>[o("div",Ffe,[o("div",$fe,[n(J,{name:"CheckCircleFill"})]),o("div",null,[o("h4",null,m(A(u)("Don't Forget to Save Your Tax File")),1),o("p",null,m(A(u)("You're about to mark this tax report as filed.")),1),o("p",null,[R(m(A(u)("Make sure you've downloaded and saved the CSV file for your records before proceeding."))+" ",1),o("a",{onClick:Ne(y,["prevent"]),class:"cursor-pointer"},m(A(u)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},Ife={class:"fct-card fct-card-border fct-vat-card"},Qfe={class:"fct-card-body"},Dfe={class:"fct-vat-card-header"},Vfe={class:"fct-vat-card-title"},Tfe={class:"fct-card fct-card-border fct-vat-card mt-5"},Mfe={class:"fct-card-body"},Lfe={class:"fct-vat-card-header"},Rfe={class:"fct-vat-card-title"},Ofe={class:"fct-tax-rates-country-view"},Hfe={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Pfe={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},Nfe={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),h("div",null,[o("div",Ife,[o("div",Qfe,[o("div",Dfe,[o("div",Vfe,[o("h3",null,m(A(u)("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",Tfe,[o("div",Mfe,[o("div",Lfe,[o("div",Rfe,[o("h3",null,m(A(u)("Tax overrides")),1)])]),o("div",Ofe,[o("div",Hfe,[o("div",Pfe,[(r(),h(H,null,ae(6,s=>o("div",{key:"header-"+s,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(H,null,ae(t,s=>o("div",{key:"override-row-"+s,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]=[Un('<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))])])])])]))}},Kfe={class:"fct-modal-body"},Gfe={class:"fct-radio-option-fields"},jfe={class:"form-note"},zfe={class:"fct-radio-option-fields"},qfe={class:"fct-radio-option-fields-desc"},Yfe={class:"form-note"},Wfe={key:0,class:"fct-info-box mt-3"},Jfe={class:"text-xs text-system-mid"},Xfe={class:"fct-radio-option-fields"},Zfe={class:"fct-radio-option-fields-desc"},eme={__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,s=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||"",b=a.currentForm||{};s.value={method:b.method||"oss",oss_country:b.oss_country||y,oss_vat:b.oss_vat||v,home_country:b.home_country||y,home_vat:b.home_vat||v}}else s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}});function c(_){const g=a.countries.find(y=>y.value===_);return g?parseFloat(g.default_rate||0):0}function p(){return a.initialRegistrations.some(_=>_.country===s.value.home_country)}function f(){if(!s.value.method){z.error(u("Select a cross-border registration type"));return}if(s.value.method==="oss"){if(!s.value.oss_country){z.error(u("Select your country of OSS registration"));return}}else if(s.value.method==="home"&&!s.value.home_country){z.error(u("Select your country of registration"));return}i.value=!0,(s.value.method==="home"&&!p()?ue.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.home_country,vat:s.value.home_vat,rate:c(s.value.home_country)}):Promise.resolve()).then(()=>ue.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:s.value})).then(g=>{z.success(g.message),l("saved",{method:s.value.method,oss_country:s.value.oss_country,oss_vat:s.value.oss_vat,home_country:s.value.home_country,home_country_vat:s.value.home_vat}),l("update:modelValue",!1)}).catch(g=>{var y;z.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"),b=C("el-select"),k=C("el-form-item"),w=C("el-input"),S=C("el-radio-group"),$=C("el-form"),V=C("el-button"),F=C("el-dialog");return r(),E(F,{"model-value":e.modelValue,title:A(u)("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]=x=>l("update:modelValue",x))},{footer:d(()=>[n(V,{onClick:g[8]||(g[8]=x=>l("update:modelValue",!1))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(V,{type:"primary",onClick:f,loading:i.value},{default:d(()=>[R(m(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",Kfe,[n($,{"label-position":"top"},{default:d(()=>[n(S,{modelValue:s.value.method,"onUpdate:modelValue":g[7]||(g[7]=x=>s.value.method=x),class:"fct-cross-border-radios"},{default:d(()=>[o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="oss"}]),onClick:g[2]||(g[2]=x=>s.value.method="oss")},[n(y,{value:"oss"},{default:d(()=>[R(m(A(u)("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),n(va,{accordion:"",visible:s.value.method==="oss"},{default:d(()=>[o("div",Gfe,[n(k,{label:A(u)("Country of OSS registration")},{default:d(()=>[n(b,{modelValue:s.value.oss_country,"onUpdate:modelValue":g[0]||(g[0]=x=>s.value.oss_country=x),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,x=>(r(),E(v,{key:x.value,label:x.label,value:x.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(k,{label:A(u)("VAT number")},{default:d(()=>[n(w,{modelValue:s.value.oss_vat,"onUpdate:modelValue":g[1]||(g[1]=x=>s.value.oss_vat=x),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",jfe,[o("p",null,m(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="home"}]),onClick:g[5]||(g[5]=x=>s.value.method="home")},[n(y,{value:"home"},{default:d(()=>[R(m(A(u)("Collect using your home country registration")),1)]),_:1}),n(va,{accordion:"",visible:s.value.method==="home"},{default:d(()=>[o("div",zfe,[o("p",qfe,m(A(u)("Applies to micro-businesses located in one EU country and making less than €10,000 in sales to other EU countries each year")),1),n(k,{label:A(u)("Country of registration")},{default:d(()=>[n(b,{modelValue:s.value.home_country,"onUpdate:modelValue":g[3]||(g[3]=x=>s.value.home_country=x),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,x=>(r(),E(v,{key:x.value,label:x.label,value:x.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(k,{label:A(u)("VAT number")},{default:d(()=>[n(w,{modelValue:s.value.home_vat,"onUpdate:modelValue":g[4]||(g[4]=x=>s.value.home_vat=x),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",Yfe,[o("p",null,m(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?B("",!0):(r(),h("div",Wfe,[n(J,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",Jfe,m(A(u)("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:de(["fct-radio-option",{"is-active":s.value.method==="specific"}]),onClick:g[6]||(g[6]=x=>s.value.method="specific")},[n(y,{value:"specific"},{default:d(()=>[R(m(A(u)("Collect using specific country registrations")),1)]),_:1}),n(va,{accordion:"",visible:s.value.method==="specific"},{default:d(()=>[o("div",Xfe,[o("p",Zfe,m(A(u)("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"])}}},tme={key:0,class:"fct-country-registrations-list mt-4"},ame={class:"fct-home-country-header"},lme=["src","alt"],sme={class:"fct-vat-country-name"},nme={key:0,class:"fct-collecting-badge"},ome={class:"fct-home-country-body"},ime={class:"fct-vat-home-field"},rme={class:"fct-vat-home-field__label"},dme={class:"fct-reg-rates-section"},ume={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},cme={class:"fct-reg-rates-row fct-reg-rates-header"},Ame={class:"fct-reg-rates-cell-label"},pme={class:"fct-reg-rates-cell-label"},fme={key:1,class:"fct-reg-class-name"},mme={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},hme={class:"fct-reg-rates-cell-input"},_me={class:"fct-reg-rates-cell-action"},vme=["title","onClick"],gme={key:0,class:"fct-reg-add-class px-5"},yme={type:"button",class:"fct-reg-add-class-btn"},bme={class:"fct-vat-home-actions"},wme={__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,s=M({country:"",vat:"",rates:{}}),i=M([]),c=N(()=>a.homeCountry&&a.countries.find(x=>x.value===a.homeCountry)||null),p=N(()=>a.homeCountry&&a.registrations.find(x=>x.country===a.homeCountry)||null),f=N(()=>{const x=p.value;return!x||!x.vat?!1:x.rates&&typeof x.rates=="object"&&Object.keys(x.rates).length?Object.values(x.rates).some(function(Q){return Q&&parseFloat(Q.rate)>0}):parseFloat(x.rate)>0}),_=N(()=>[...a.taxClasses,...i.value]),g=N(()=>_.value.length?_.value:[{slug:"standard",title:u("Standard")}]),y=N(()=>{if(_.value.length>=6)return[];const x=_.value.map(D=>D.slug).filter(Boolean),Q=[];return x.includes("reduced")||Q.push({command:"reduced",label:u("Reduced")}),x.includes("zero")||Q.push({command:"zero",label:u("Zero")}),Q.push({command:"custom",label:u("Custom Class...")}),Q});be([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const x=p.value,Q={};a.taxClasses.forEach(D=>{var O;const T=(O=x==null?void 0:x.rates)==null?void 0:O[D.slug],U=D.slug==="standard"?(x==null?void 0:x.rate)??"":"",I=D.slug==="standard"?(x==null?void 0:x.tax_label)??"":"";T&&typeof T=="object"?Q[D.slug]={rate:T.rate??"",label:T.label??""}:Q[D.slug]={rate:T??U,label:I}}),i.value.forEach(D=>{const T=v(D);Q[T]=s.value.rates[T]||{rate:"",label:""}}),Q.standard||(Q.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(x==null?void 0:x.vat)||a.homeVat||"",rates:Q}},{immediate:!0});function v(x){return x.tempKey||x.slug}function b(x){if(x==="custom"){w();return}const Q=x==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:x,title:Q,tempKey:x}),s.value.rates[x]={rate:"",label:""}}let k=0;function w(){const x="_new_"+k++;i.value.push({slug:null,title:"",tempKey:x,isNew:!0}),s.value.rates[x]={rate:"",label:""}}function S(x){return x.slug?x.title||x.slug:x.title&&x.title.trim()?x.title.trim():u("Custom")}function $(x){if(x.hasError=!1,x.created)return Promise.resolve(null);if(!x.slug&&!(x.title&&x.title.trim()))return x.hasError=!0,Promise.reject(new Error(u("Please enter a name for the custom tax class")));const Q=x.slug?{slug:x.slug}:{title:x.title.trim()};return ue.post("tax/classes",Q).then(D=>{const T=(D==null?void 0:D.class)||{},U=T.slug||x.slug;if(!U)throw new Error(u("Tax class creation returned an invalid response"));return!x.slug&&s.value.rates[x.tempKey]!==void 0&&(s.value.rates[U]=s.value.rates[x.tempKey],delete s.value.rates[x.tempKey],x.tempKey=null),x.slug=U,x.title=T.title||x.title,x.created=!0,T}).catch(D=>{var U;x.hasError=!0;const T=((U=D==null?void 0:D.data)==null?void 0:U.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",T,S(x)))})}function V(x){const Q=v(x);if(i.value.some(T=>v(T)===Q)){i.value=i.value.filter(T=>v(T)!==Q),delete s.value.rates[Q];return}rl(u('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?',x.title),u("Delete Tax Class"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ue.delete("tax/classes/"+x.id).then(()=>{l("class-changed")}).catch(T=>{var U;z.error(((U=T==null?void 0:T.data)==null?void 0:U.message)||u("Failed to delete tax class"))})}).catch(()=>{})}function F(){const x=i.value.map($);Promise.all(x).then(()=>{i.value=[],l("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(Q=>{z.error((Q==null?void 0:Q.message)||u("Failed to create tax class"))})}return(x,Q)=>{const D=C("el-input"),T=C("el-dropdown-item"),U=C("el-dropdown-menu"),I=C("el-dropdown"),O=C("el-button");return c.value?(r(),h("div",tme,[o("div",ame,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:c.value.label,class:"fct-flag-icon"},null,8,lme),o("span",sme,m(c.value.label),1),f.value?(r(),h("span",nme,[Q[1]||(Q[1]=o("span",{class:"fct-green-dot"},null,-1)),R(" "+m(A(u)("Collecting")),1)])):B("",!0)]),o("div",ome,[o("div",ime,[o("label",rme,m(A(u)("VAT number")),1),n(D,{modelValue:s.value.vat,"onUpdate:modelValue":Q[0]||(Q[0]=L=>s.value.vat=L),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",dme,[o("div",ume,[o("div",cme,[o("div",Ame,m(A(u)("Tax Classes")),1),Q[2]||(Q[2]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),Q[3]||(Q[3]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),Q[4]||(Q[4]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),h(H,null,ae(g.value,L=>(r(),h("div",{key:v(L),class:"fct-reg-rates-row"},[o("div",pme,[L.isNew?(r(),E(D,{key:0,modelValue:L.title,"onUpdate:modelValue":P=>L.title=P,size:"small",placeholder:A(u)("Class name"),class:de(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":L.hasError}]),onInput:P=>L.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",fme,m(L.title),1))]),o("div",mme,[n(D,{modelValue:s.value.rates[v(L)].rate,"onUpdate:modelValue":P=>s.value.rates[v(L)].rate=P,type:"number",step:"0.01",min:"0",size:"small"},{suffix:d(()=>Q[5]||(Q[5]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",hme,[n(D,{modelValue:s.value.rates[v(L)].label,"onUpdate:modelValue":P=>s.value.rates[v(L)].label=P,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",_me,[L.slug!=="standard"?(r(),h("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:A(u)("Delete class"),onClick:P=>V(L)},[n(J,{name:"Delete"})],8,vme)):B("",!0)])]))),128))]),y.value.length?(r(),h("div",gme,[y.value.length===1&&y.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:w},[n(J,{name:"Plus",class:"w-3 h-3"}),R(" "+m(A(u)("Add class")),1)])):(r(),E(I,{key:1,trigger:"click",onCommand:b,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(U,null,{default:d(()=>[(r(!0),h(H,null,ae(y.value,L=>(r(),E(T,{key:L.command,command:L.command},{default:d(()=>[R(m(L.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",yme,[n(J,{name:"Plus",class:"w-3 h-3"}),R(" "+m(A(u)("Add class")),1)])]),_:1}))])):B("",!0)]),o("div",bme,[n(O,{type:"primary",size:"small",onClick:F},{default:d(()=>[R(m(A(u)("Save VAT")),1)]),_:1})])])])):B("",!0)}}},Cme={class:"fct-modal-body fct-country-reg-modal"},kme={class:"fct-country-reg-text"},Bme={class:"form-note"},xme={class:"fct-reg-rates-table"},Sme={class:"fct-reg-rates-row fct-reg-rates-header"},Fme={class:"fct-reg-rates-cell-label"},$me={class:"fct-reg-rates-cell-label"},Eme={key:1,class:"fct-reg-class-name"},Ume={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Ime={class:"fct-reg-rates-cell-input"},Qme={key:1,class:"fct-reg-rates-row"},Dme={class:"fct-reg-rates-cell-label"},Vme={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Tme={class:"fct-reg-rates-cell-input"},Mme={key:0,class:"fct-reg-add-class"},Lme={type:"button",class:"fct-reg-add-class-btn"},Rme={__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,s=M({country:"",vat:"",rates:{},isEdit:!1}),i=M([]),c=M(!1),p=N(()=>[...a.taxClasses,...i.value]),f=N(()=>{if(p.value.length>=6)return[];const V=p.value.map(x=>x.slug).filter(Boolean),F=[];return V.includes("reduced")||F.push({command:"reduced",label:u("Reduced")}),V.includes("zero")||F.push({command:"zero",label:u("Zero")}),F.push({command:"custom",label:u("Custom Class...")}),F}),_=N(()=>s.value.isEdit?a.countries:a.countries.filter(V=>!a.registeredCountries.includes(V.value)));be(()=>a.modelValue,V=>{if(V){const F=a.initialForm||{},x=F.rates?JSON.parse(JSON.stringify(F.rates)):{};a.taxClasses.forEach(Q=>{x[Q.slug]||(x[Q.slug]={rate:"",label:""})}),x.standard||(x.standard={rate:"",label:""}),s.value={country:F.country||"",vat:F.vat||"",rates:x,isEdit:F.isEdit||!1},i.value=[]}});function g(V){return V.tempKey||V.slug}function y(V){const F=a.countries.find(x=>x.value===V);if(F&&F.default_rate){const x=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},x,{rate:F.default_rate})})}}function v(V){if(V==="custom"){k();return}const F=V==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:V,title:F,tempKey:V}),s.value.rates[V]={rate:"",label:""}}let b=0;function k(){const V="_new_"+b++;i.value.push({slug:null,title:"",tempKey:V,isNew:!0}),s.value.rates[V]={rate:"",label:""}}function w(V){return V.slug?V.title||V.slug:V.title&&V.title.trim()?V.title.trim():u("Custom")}function S(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(u("Please enter a name for the custom tax class")));const F=V.slug?{slug:V.slug}:{title:V.title.trim()};return ue.post("tax/classes",F).then(x=>{const Q=(x==null?void 0:x.class)||{},D=Q.slug||V.slug;if(!D)throw new Error(u("Tax class creation returned an invalid response"));return!V.slug&&s.value.rates[V.tempKey]!==void 0&&(s.value.rates[D]=s.value.rates[V.tempKey],delete s.value.rates[V.tempKey],V.tempKey=null),V.slug=D,V.title=Q.title||V.title,V.created=!0,Q}).catch(x=>{var D;V.hasError=!0;const Q=((D=x==null?void 0:x.data)==null?void 0:D.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",Q,w(V)))})}function $(){if(!s.value.country){z.error(u("Select a registration country"));return}const V=s.value.rates;if(!Object.values(V).some(Q=>parseFloat(Q.rate)>0)){z.error(u("At least one tax rate must be greater than 0%"));return}c.value=!0;const x=i.value.map(S);Promise.all(x).then(()=>ue.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.country,vat:s.value.vat,rates:s.value.rates})).then(Q=>{z.success(Q.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(Q=>{var D;z.error((Q==null?void 0:Q.message)||((D=Q==null?void 0:Q.data)==null?void 0:D.message)||u("Failed to save VAT registration"))}).finally(()=>{c.value=!1})}return(V,F)=>{const x=C("el-option"),Q=C("el-select"),D=C("el-form-item"),T=C("el-input"),U=C("el-dropdown-item"),I=C("el-dropdown-menu"),O=C("el-dropdown"),L=C("el-form"),P=C("el-button"),q=C("el-dialog");return r(),E(q,{"model-value":e.modelValue,title:s.value.isEdit?A(u)("Edit VAT registration"):A(u)("Collect VAT"),"close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":F[5]||(F[5]=X=>l("update:modelValue",X))},{footer:d(()=>[n(P,{onClick:F[4]||(F[4]=X=>l("update:modelValue",!1))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:$,loading:c.value},{default:d(()=>[R(m(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",Cme,[o("p",kme,m(A(u)("Make sure you're registered for VAT when collecting in the EU.")),1),n(L,{"label-position":"top"},{default:d(()=>[n(D,{label:A(u)("Registration country")},{default:d(()=>[n(Q,{modelValue:s.value.country,"onUpdate:modelValue":F[0]||(F[0]=X=>s.value.country=X),placeholder:A(u)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:y},{default:d(()=>[(r(!0),h(H,null,ae(_.value,X=>(r(),E(x,{key:X.value,label:X.label,value:X.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),n(D,{label:A(u)("VAT number")},{default:d(()=>[n(T,{modelValue:s.value.vat,"onUpdate:modelValue":F[1]||(F[1]=X=>s.value.vat=X),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",Bme,[o("p",null,m(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",xme,[o("div",Sme,[o("div",Fme,m(A(u)("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(H,{key:0},ae(p.value,X=>(r(),h("div",{key:X.tempKey||X.slug,class:"fct-reg-rates-row"},[o("div",$me,[X.isNew?(r(),E(T,{key:0,modelValue:X.title,"onUpdate:modelValue":G=>X.title=G,size:"small",placeholder:A(u)("Class name"),class:de(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":X.hasError}]),onInput:G=>X.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",Eme,m(X.title),1))]),o("div",Ume,[n(T,{modelValue:s.value.rates[g(X)].rate,"onUpdate:modelValue":G=>s.value.rates[g(X)].rate=G,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:X.slug==="standard"?"19":"0"},{suffix:d(()=>F[8]||(F[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Ime,[n(T,{modelValue:s.value.rates[g(X)].label,"onUpdate:modelValue":G=>s.value.rates[g(X)].label=G,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),h("div",Qme,[o("div",Dme,m(A(u)("Standard")),1),o("div",Vme,[n(T,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":F[2]||(F[2]=X=>s.value.rates.standard.rate=X),modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:"19"},{suffix:d(()=>F[9]||(F[9]=[R("%",-1)])),_:1},8,["modelValue"])]),o("div",Tme,[n(T,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":F[3]||(F[3]=X=>s.value.rates.standard.label=X),size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),f.value.length?(r(),h("div",Mme,[f.value.length===1&&f.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:k},[n(J,{name:"Plus"}),R(" "+m(A(u)("Add class")),1)])):(r(),E(O,{key:1,trigger:"click",onCommand:v},{dropdown:d(()=>[n(I,null,{default:d(()=>[(r(!0),h(H,null,ae(f.value,X=>(r(),E(U,{key:X.command,command:X.command},{default:d(()=>[R(m(X.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",Lme,[n(J,{name:"Plus"}),R(" "+m(A(u)("Add class")),1)])]),_:1}))])):B("",!0)]),_:1})])]),_:1},8,["model-value","title"])}}},Ome={class:"fct-oss-rates-section"},Hme=["aria-expanded"],Pme={class:"inline-flex items-center gap-2"},Nme={class:"fct-oss-rates-count"},Kme={class:"fct-oss-rates-table"},Gme={key:1,class:"text-system-mid"},jme={class:"fct-btn-group mt-4 justify-end sm"},zme={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=M([]),l=M([]),s=M(null),i=M("standard"),c=M(!1),p=M(!1),f=M(!1),_=M(!1),g=M(6),y=M(!1),v=M(""),b=N(()=>a.value),k=N(()=>{const D=v.value.trim().toLowerCase();return D?b.value.filter(T=>T.label&&T.label.toLowerCase().includes(D)):b.value});function w(){return c.value=!0,ue.get("tax/configuration/settings/eu-vat/oss-rates").then(D=>{a.value=D.rates||[],l.value=D.classes||[];const T=Id({classes:l.value,activeId:s.value});return T&&(s.value=T.id,i.value=T.slug),l.value}).catch(D=>{var T;z.error((T=D==null?void 0:D.data)==null?void 0:T.message)}).finally(()=>{c.value=!1})}function S(D){s.value=D.id,i.value=D.slug}function $(D){y.value=!0,zo({payload:{slug:D},createdSlug:D,currentClasses:l.value,reloadClasses:w}).then(({createdClass:T})=>{T&&S(T)}).catch(T=>{var U;z.error((U=T==null?void 0:T.data)==null?void 0:U.message)}).finally(()=>{y.value=!1})}function V(D){y.value=!0,zo({payload:{title:D},currentClasses:l.value,reloadClasses:w}).then(({createdClass:T})=>{T&&S(T)}).catch(T=>{var U;z.error((U=T==null?void 0:T.data)==null?void 0:U.message)}).finally(()=>{y.value=!1})}function F(D){D.slug!=="standard"&&rl(u('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),u("Delete Tax Class"),{confirmButtonText:u("Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{c.value=!0,rf({classId:D.id,currentActiveId:s.value===D.id?null:s.value,reloadClasses:w}).then(({nextActiveClass:T})=>{T&&S(T)}).catch(T=>{var U;z.error((U=T==null?void 0:T.data)==null?void 0:U.message),c.value=!1})}).catch(()=>{})}function x(){p.value=!0,ue.post("tax/configuration/settings/eu-vat/oss-rates",{rates:b.value.map(D=>({country:D.country,rate:D.rate,tax_label:D.tax_label||"",class_rates:D.class_rates||{}}))}).then(D=>{z.success(D.message)}).catch(D=>{var T;z.error((T=D==null?void 0:D.data)==null?void 0:T.message)}).finally(()=>{p.value=!1})}function Q(){rl(u("This will overwrite all EU destination country standard rates with preset defaults. Continue?"),u("Reset to default tax rates"),{confirmButtonText:u("Reset"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{f.value=!0,ue.post("tax/configuration/settings/eu-vat/reset-rates").then(()=>w()).then(()=>{z.success(u("EU tax rates have been reset to defaults"))}).catch(D=>{var T;z.error(((T=D==null?void 0:D.data)==null?void 0:T.message)||u("Failed to reset rates"))}).finally(()=>{f.value=!1})}).catch(()=>{})}return Ie(w),t({loadRates:w}),(D,T)=>{const U=C("el-icon"),I=C("el-table-column"),O=C("el-input"),L=C("el-table"),P=C("el-button"),q=Ma("loading");return r(),h("div",Ome,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:T[0]||(T[0]=X=>{_.value=!_.value,_.value||(v.value="")}),onKeydown:[T[1]||(T[1]=xa(Ne(X=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["enter"])),T[2]||(T[2]=xa(Ne(X=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["space"]))]},[o("span",Pme,[R(m(A(u)("Destination country rates"))+" ",1),o("span",Nme," ("+m(b.value.length)+") ",1)]),n(U,{class:de(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:d(()=>[n(J,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,Hme),n(Wl,{name:"fct-collapse"},{default:d(()=>[qt(o("div",Kme,[n(Xa,{type:"info"},{content:d(()=>[o("span",null,m(A(u)("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"))+" + "+m(A(u)("button to add tax classes.")),1)]),_:1}),n(of,{classes:l.value,"active-id":s.value,"max-classes":g.value,creating:y.value,search:v.value,onSwitch:S,onDelete:F,onAdd:$,onCreateCustom:V,"onUpdate:search":T[3]||(T[3]=X=>v.value=X)},null,8,["classes","active-id","max-classes","creating","search"]),qt((r(),E(L,{data:k.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":A(u)("No rates found")},{default:d(()=>[n(I,{label:A(u)("Country"),"min-width":"160"},{default:d(({row:X})=>[R(m(X.label),1)]),_:1},8,["label"]),n(I,{label:A(u)("Tax Label"),"min-width":"150"},{default:d(({row:X})=>[X.class_rates&&X.class_rates[i.value]?(r(),E(O,{key:0,modelValue:X.class_rates[i.value].label,"onUpdate:modelValue":G=>X.class_rates[i.value].label=G,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),_:1},8,["label"]),n(I,{label:A(u)("Rate"),"min-width":"120"},{default:d(({row:X})=>[X.class_rates&&X.class_rates[i.value]?(r(),E(O,{key:0,modelValue:X.class_rates[i.value].rate,"onUpdate:modelValue":G=>X.class_rates[i.value].rate=G,modelModifiers:{number:!0},size:"small",type:"number",min:0,max:100,step:"0.5"},{suffix:d(()=>T[4]||(T[4]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),h("span",Gme,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[q,c.value]]),o("div",jme,[i.value==="standard"?(r(),E(P,{key:0,size:"small",loading:f.value,onClick:Q,type:"danger",soft:""},{default:d(()=>[R(m(A(u)("Reset to default")),1)]),_:1},8,["loading"])):B("",!0),n(P,{type:"primary",size:"small",loading:p.value,onClick:x},{default:d(()=>[R(m(A(u)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Dl,_.value]])]),_:1})])}}},qme={class:"fct-vat-card-header"},Yme={class:"fct-vat-card-title"},Wme={class:"fct-vat-card-body"},Jme={class:"fct-vat-reg-info"},Xme={class:"fct-vat-country-name"},Zme={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},ehe={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},the={key:2,class:"fct-country-registrations-list mt-4"},ahe={class:"fct-reg-rows"},lhe={key:0,class:"fct-vat-registration-row"},she={class:"fct-vat-reg-info"},nhe=["src","alt"],ohe={class:"fct-vat-country-name"},ihe={class:"fct-vat-reg-info"},rhe=["src","alt"],dhe={class:"fct-vat-country-name"},uhe={key:0,class:"fct-vat-number"},che={key:1,class:"fct-vat-missing-badge"},Ahe={class:"fct-vat-reg-actions"},phe={key:1,class:"fct-vat-empty-state"},fhe={class:"text-system-mid text-sm"},mhe={key:0,class:"px-5 py-3"},hhe={key:1,class:"fct-vat-cross-border-empty"},_he={class:"fct-vat-cross-border-empty-text"},vhe={class:"fct-vat-cross-border-empty-title"},ghe={class:"fct-vat-cross-border-empty-desc"},yhe={__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,s=M({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=M(!1),c=M(null),p=M([]),f=M(!1),_=M({country:"",vat:"",rates:{},isEdit:!1}),g=N(()=>a.countries.length||28),y=N(()=>a.initialRegistrations.filter(V).length),v=N(()=>a.storeCountry&&a.countries.find(te=>te.value===a.storeCountry)||null),b=N(()=>a.storeCountry?a.initialRegistrations.some(te=>te.country===a.storeCountry):!1),k=N(()=>{if(s.value.method!=="home"||!s.value.home_country)return!1;const te=a.initialRegistrations.find(ne=>ne.country===s.value.home_country);return!!te&&V(te)}),w=N(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function S(te){if(!te||!Array.isArray(a.countries))return te;const ne=a.countries.find(re=>re.value===te);return ne?ne.label:te}function $(te){return te?te.rates&&typeof te.rates=="object"&&Object.keys(te.rates).length?Object.values(te.rates).some(ne=>ne&&parseFloat(ne.rate)>0):parseFloat(te.rate)>0:!1}function V(te){return!!te&&!!te.vat&&$(te)}function F(te){return $(te)&&!te.vat}function x(){return ue.get("tax/classes").then(te=>{p.value=te.classes||[]}).catch(()=>{z.error(u("Failed to load tax classes"))})}function Q(te){const ne={};return p.value.forEach(re=>{ne[re.slug]={rate:re.slug==="standard"&&te||"",label:""}}),ne}function D(){const te=v.value&&!b.value?a.storeCountry:"",ne=te&&v.value&&v.value.default_rate||"";_.value={country:te,vat:"",rates:Q(ne),isEdit:!1},f.value=!0}function T(te){const ne=te.rates||{},re={};p.value.forEach(K=>{const Y=ne[K.slug];if(Y&&typeof Y=="object")re[K.slug]={rate:Y.rate||"",label:Y.label||""};else{const W=K.slug==="standard"?te.rate||"":Y||"";re[K.slug]={rate:W,label:K.slug==="standard"&&te.tax_label||""}}}),_.value={country:te.country,vat:te.vat||"",rates:re,isEdit:!0},f.value=!0}function U(){x(),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}function I(te){ue.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:te.country,vat:te.vat,rates:te.rates}).then(ne=>{z.success(ne.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:te.vat})}).catch(ne=>{var re;z.error(((re=ne==null?void 0:ne.data)==null?void 0:re.message)||u("Failed to save VAT registration"))})}function O(te){rl(u("Are you sure you want to remove this country registration?"),u("Confirm Remove"),{confirmButtonText:u("Yes, Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ue.post("tax/configuration/settings/eu-vat",{action:"deleteCountryRegistration",country:te}).then(ne=>{z.success(ne.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}).catch(ne=>{var re;z.error((re=ne==null?void 0:ne.data)==null?void 0:re.message)})}).catch(()=>{})}function L(){return y.value===1?u("Collecting in 1 country"):u("Collecting in %1$s countries",y.value)}const P=N(()=>g.value===1?u("Collecting in 1 region"):u("Collecting in %1$s regions",g.value));function q(te){s.value={method:te.method,oss_country:te.oss_country,oss_vat:te.oss_vat,home_country:te.home_country,home_vat:te.home_country_vat},te.method==="oss"&&ke(()=>{var ne;return(ne=c.value)==null?void 0:ne.loadRates()}),l("method-changed",{method:te.method,home_country:te.home_country,home_vat:te.home_country_vat})}function X(te){te==="edit"?i.value=!0:te==="stop"&&G()}function G(){rl(u("Are you sure you want to stop collecting cross-border VAT? This will clear your OSS/home country registration."),u("Stop Collecting"),{confirmButtonText:u("Yes, Stop"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ue.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(te=>{z.success(te.message),s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},l("method-changed",{method:"",home_country:"",home_vat:""})}).catch(te=>{var ne;z.error((ne=te==null?void 0:te.data)==null?void 0:ne.message)})}).catch(()=>{})}return be(()=>a.initialForm,te=>{const ne=te||{};s.value={method:ne.method||"",oss_country:ne.oss_country||"",oss_vat:ne.oss_vat||"",home_country:ne.home_country||"",home_vat:ne.home_vat||""}},{immediate:!0}),be(()=>a.countries,te=>{te&&te.length&&x()},{immediate:!0}),(te,ne)=>{const re=C("el-tooltip"),K=C("el-dropdown-item"),Y=C("el-dropdown-menu"),W=C("el-dropdown"),j=C("el-button");return r(),h(H,null,[n(Be,{class:"fct-vat-card"},{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",qme,[o("div",Yme,[o("h3",null,m(A(u)("Collect VAT cross-border")),1),n(re,{content:A(u)("Choose how to collect VAT for sales to other EU countries."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),w.value?(r(),E(W,{key:0,trigger:"click",onCommand:X,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:d(()=>[n(Y,null,{default:d(()=>[n(K,{command:"edit"},{default:d(()=>[R(m(A(u)("Edit registration")),1)]),_:1}),n(K,{command:"stop"},{default:d(()=>[R(m(A(u)("Stop collecting")),1)]),_:1})]),_:1})]),default:d(()=>[n(Ze,{border:"none",size:"small",tag:"button"},{default:d(()=>[n(J,{name:"More"})]),_:1})]),_:1})):B("",!0)]),o("div",Wme,[w.value?(r(),h(H,{key:0},[o("div",Jme,[ne[4]||(ne[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",Xme,m(s.value.method==="oss"?A(u)("EU (OSS)"):s.value.method==="home"?A(u)("EU (micro-business)"):A(u)("EU (specific countries)")),1),e.isTaxEnabled&&(s.value.method!=="specific"||y.value>0)?(r(),h("span",Zme,[ne[3]||(ne[3]=o("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(r(),h(H,{key:0},[R(m(L()),1)],64)):(r(),h(H,{key:1},[R(m(P.value),1)],64))])):B("",!0),e.isTaxEnabled?B("",!0):(r(),h("span",ehe,m(A(u)("Tax disabled")),1))]),s.value.method==="home"?(r(),E(Xa,{key:0,type:k.value?"info":"warning",icon:"Info",class:"mb-4 mt-4",content:k.value?A(u)("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.",S(s.value.home_country)):A(u)("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.",S(s.value.home_country))},null,8,["type","content"])):B("",!0),s.value.method==="home"?(r(),E(wme,{key:1,countries:e.countries,"home-country":s.value.home_country,"home-vat":s.value.home_vat,"tax-classes":p.value,registrations:e.initialRegistrations,onSaveHome:I,onClassChanged:x},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):B("",!0),s.value.method==="specific"?(r(),h("div",the,[o("div",ahe,[v.value&&!b.value?(r(),h("div",lhe,[o("div",she,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,nhe),o("span",ohe,m(v.value.label),1)]),n(j,{size:"small",onClick:D},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:1})])):B("",!0),(r(!0),h(H,null,ae(e.initialRegistrations,ie=>(r(),h("div",{key:ie.country,class:"fct-vat-registration-row"},[o("div",ihe,[o("img",{src:`https://flagcdn.com/w40/${ie.country.toLowerCase()}.png`,alt:S(ie.country),class:"fct-flag-icon"},null,8,rhe),o("span",dhe,m(S(ie.country)),1),ie.vat?(r(),h("span",uhe,m(ie.vat),1)):F(ie)?(r(),h("span",che,m(A(u)("VAT ID missing")),1)):B("",!0)]),o("div",Ahe,[$(ie)?(r(),E(Ze,{key:0,border:"none",size:"small",tag:"button",title:A(u)("Edit"),onClick:he=>T(ie)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),E(j,{key:1,size:"small",onClick:he=>T(ie)},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:2},1032,["onClick"])),n(Ze,{border:"none",size:"small",tag:"button",title:A(u)("Delete"),onClick:he=>O(ie.country)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),h("div",phe,[o("p",fhe,m(A(u)("No country VAT registrations configured.")),1),n(j,{type:"primary",size:"small",onClick:D},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:1})])):B("",!0)]),e.initialRegistrations.length||v.value?(r(),h("div",mhe,[n(j,{type:"primary",link:"",onClick:D},{default:d(()=>[R(" + "+m(A(u)("Collect in another country")),1)]),_:1})])):B("",!0)])):B("",!0),s.value.method==="oss"?(r(),E(zme,{key:3,ref_key:"ossRatesRef",ref:c},null,512)):B("",!0)],64)):(r(),h("div",hhe,[ne[5]||(ne[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",_he,[o("p",vhe,m(A(u)("Not collecting cross-border VAT")),1),o("p",ghe,m(A(u)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),n(j,{size:"small",onClick:ne[0]||(ne[0]=ie=>i.value=!0),type:"primary"},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),n(eme,{modelValue:i.value,"onUpdate:modelValue":ne[1]||(ne[1]=ie=>i.value=ie),countries:e.countries,"current-form":s.value,"initial-registrations":e.initialRegistrations,onSaved:q},null,8,["modelValue","countries","current-form","initial-registrations"]),n(Rme,{modelValue:f.value,"onUpdate:modelValue":ne[2]||(ne[2]=ie=>f.value=ie),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(ie=>ie.country),onSaved:U},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},bhe={__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,s=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([]),c=M(!1),p=M(!1);function f(){return a.taxClasses&&a.taxClasses.length>0&&Number(a.taxClasses[0].id)||0}function _(){s.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")s.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)||f(),id:w.id};else{const S=w._raw.meta_value||w._raw;s.value={type:"products",original_type:"products",original_id:w.id,category_id:en(S.category_id),category_name:w.category_name,country:S.country||"",city:S.city||"",postcode:S.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(()=>s.value.type,w=>{w==="shipping"&&!s.value.class_id&&(s.value.class_id=f())}),be(()=>a.taxClasses,w=>{s.value.type==="shipping"&&!s.value.class_id&&w&&w.length>0&&(s.value.class_id=Number(w[0].id)||0)});function y(){i.value.length>0||(c.value=!0,ue.get("products/fetch-term").then(w=>{const S=w.taxonomies&&w.taxonomies["product-categories"]?w.taxonomies["product-categories"].terms||[]:[];i.value=S.map($=>({...$,value:en($.value)}))}).catch(()=>{z.error(u("Failed to load product categories"))}).finally(()=>{c.value=!1}))}function v(w,S){return ue.get("tax/rates/country/rates/"+w,{class_id:S}).then($=>{const F=($&&$.tax_rates?$.tax_rates:[]).find(function(Q){return!Q.state&&!Q.city&&!Q.postcode});if(F)return F;const x=a.countries.find(function(Q){return Q.value===w});return ue.post("tax/country/rate",{country:w,state:"",rate:x&&x.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:S}).then(function(Q){return Q&&Q.tax_rate?Q.tax_rate:null})})}function b(w){const S=en(w),$=i.value.find(V=>V.value===S);$&&(s.value.category_name=$.label)}function k(){if(s.value.type==="products"&&!s.value.category_id){z.error(u("Please select a category"));return}if(!s.value.country){z.error(u("Please select a location"));return}if(s.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){z.error(u("Tax classes are not available. Please reload the page and try again."));return}if(!s.value.class_id){z.error(u("Please select a tax class"));return}}if(p.value=!0,s.value.type==="products")ue.post("tax/product-overrides",{id:s.value.original_type==="products"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,country:s.value.country,state:"",city:s.value.city||"",postcode:s.value.postcode||"",category_id:s.value.category_id,category_name:s.value.category_name,tax_label:s.value.tax_label,rate:s.value.tax_rate,override_state_tax:"no",class_id:s.value.class_id||0}).then(w=>{z.success(w.message),l("saved"),l("update:modelValue",!1)}).catch(w=>{z.error(w&&w.data?w.data.message:w&&w.message?w.message:"")}).finally(()=>{p.value=!1});else{const w=s.value.class_id;v(s.value.country,w).then(S=>S?ue.post("tax/rates/country/override",{id:S.id,previous_id:s.value.original_type==="shipping"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,class_id:w,override_tax_rate:s.value.tax_rate,city:s.value.city||"",postcode:s.value.postcode||""}).then($=>{z.success($.message),l("saved"),l("update:modelValue",!1)}).catch($=>{z.error($&&$.data?$.data.message:$&&$.message?$.message:"")}).finally(()=>{p.value=!1}):(z.error(u("No tax rate found for the selected country and tax class")),p.value=!1,null)).catch(S=>{z.error(S&&S.data?S.data.message:S&&S.message?S.message:""),p.value=!1})}}return(w,S)=>{const $=C("el-radio"),V=C("el-radio-group"),F=C("el-form-item"),x=C("el-option"),Q=C("el-select"),D=C("el-input"),T=C("el-form"),U=C("el-button"),I=C("el-dialog");return r(),E(I,{"model-value":e.modelValue,title:e.editRow?A(u)("Edit tax override"):A(u)("Add tax override"),width:"520px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":S[14]||(S[14]=O=>l("update:modelValue",O))},{footer:d(()=>[n(U,{onClick:S[13]||(S[13]=O=>l("update:modelValue",!1))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(U,{type:"primary",loading:p.value,onClick:k},{default:d(()=>[R(m(e.editRow?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(T,{"label-position":"top",model:s.value},{default:d(()=>[n(F,{label:A(u)("Override type")},{default:d(()=>[n(V,{modelValue:s.value.type,"onUpdate:modelValue":S[0]||(S[0]=O=>s.value.type=O)},{default:d(()=>[n($,{value:"products"},{default:d(()=>[R(m(A(u)("Products")),1)]),_:1}),n($,{value:"shipping"},{default:d(()=>[R(m(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.value.type==="products"?(r(),h(H,{key:0},[n(F,{label:A(u)("Category")},{default:d(()=>[n(Q,{modelValue:s.value.category_id,"onUpdate:modelValue":S[1]||(S[1]=O=>s.value.category_id=O),filterable:"",placeholder:A(u)("Select a category"),loading:c.value,style:{width:"100%"},onChange:b},{default:d(()=>[(r(!0),h(H,null,ae(i.value,O=>(r(),E(x,{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:A(u)("Tax Class")},{default:d(()=>[n(Q,{modelValue:s.value.class_id,"onUpdate:modelValue":S[2]||(S[2]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[n(x,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(H,null,ae(e.taxClasses,O=>(r(),E(x,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):B("",!0),n(F,{label:A(u)("Tax label")},{default:d(()=>[n(D,{modelValue:s.value.tax_label,"onUpdate:modelValue":S[3]||(S[3]=O=>s.value.tax_label=O),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Location")},{default:d(()=>[n(Q,{modelValue:s.value.country,"onUpdate:modelValue":S[4]||(S[4]=O=>s.value.country=O),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,O=>(r(),E(x,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("City (optional)")},{default:d(()=>[n(D,{modelValue:s.value.city,"onUpdate:modelValue":S[5]||(S[5]=O=>s.value.city=O),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(D,{modelValue:s.value.postcode,"onUpdate:modelValue":S[6]||(S[6]=O=>s.value.postcode=O),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(D,{modelValue:s.value.tax_rate,"onUpdate:modelValue":S[7]||(S[7]=O=>s.value.tax_rate=O),type:"number",step:"0.01",min:"0",placeholder:A(u)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):(r(),h(H,{key:1},[n(F,{label:A(u)("Location")},{default:d(()=>[n(Q,{modelValue:s.value.country,"onUpdate:modelValue":S[8]||(S[8]=O=>s.value.country=O),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,O=>(r(),E(x,{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:A(u)("Tax Class")},{default:d(()=>[n(Q,{modelValue:s.value.class_id,"onUpdate:modelValue":S[9]||(S[9]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(e.taxClasses,O=>(r(),E(x,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):B("",!0),n(F,{label:A(u)("City (optional)")},{default:d(()=>[n(D,{modelValue:s.value.city,"onUpdate:modelValue":S[10]||(S[10]=O=>s.value.city=O),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(D,{modelValue:s.value.postcode,"onUpdate:modelValue":S[11]||(S[11]=O=>s.value.postcode=O),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(D,{modelValue:s.value.tax_rate,"onUpdate:modelValue":S[12]||(S[12]=O=>s.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"])}}},whe={class:"fct-tax-rates-country-view"},Che={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},khe={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"},Bhe={key:0},xhe={key:1},She={class:"fct-btn-group sm justify-end"},Fhe={__name:"EUVatTaxOverridesCard",props:{countries:{type:Array,default:()=>[]}},setup(e){const t=e,a=M([]),l=M(!1),s=M(!1),i=M(null),c=M([]);function p(b){if(!b||!Array.isArray(t.countries))return b;const k=t.countries.find(w=>w.value===b);return k?k.label:b}function f(){ue.get("tax/classes").then(b=>{c.value=b.classes||[]}).catch(()=>{z.error(u("Failed to load tax classes"))})}function _(){l.value=!0,ue.get("tax/configuration/settings/eu-vat/product-overrides").then(b=>{const k=[],w=b.overrides||[];for(const $ of w){const V=$.meta_value||$;k.push({id:$.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($.class_id)||0,class_label:$.class_label||"",_raw:$})}const S=b.shipping_overrides||[];for(const $ of S)k.push({id:$.id,type:"shipping",tax_label:$.name||"",category_name:"",location:p($.country),city:$.city||"",postcode:$.postcode||"",rate:$.for_shipping,class_id:Number($.class_id)||0,class_label:$.class_label||"",_raw:$});a.value=k}).catch(()=>{a.value=[]}).finally(()=>{l.value=!1})}function g(){i.value=null,s.value=!0}function y(b){i.value=b,s.value=!0}function v(b){rl(u("Are you sure you want to delete this override?"),u("Confirm Delete"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{const k=b.type==="shipping"?"tax/rates/country/override/"+b.id:"tax/product-overrides/"+b.id;ue.delete(k).then(w=>{z.success(w.message),a.value=a.value.filter(S=>!(S.id===b.id&&S.type===b.type))}).catch(w=>{var S;z.error((S=w==null?void 0:w.data)==null?void 0:S.message)})}).catch(()=>{})}return Ie(()=>{f(),_()}),(b,k)=>{const w=C("el-button"),S=C("el-tag"),$=C("el-table-column"),V=C("el-table");return r(),h(H,null,[n(Be,{class:"fct-vat-card"},{default:d(()=>[n(Qe,{title:A(u)("Tax overrides"),text:A(u)("Override tax rates for specific product categories or shipping.")},{action:d(()=>[n(w,{size:"small",onClick:g},{default:d(()=>[R(m(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[o("div",whe,[l.value?(r(),h("div",Che,[o("div",khe,[(r(),h(H,null,ae(6,F=>o("div",{key:"loading-header-"+F,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(H,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"},k[2]||(k[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":A(u)("No overrides configured")},{default:d(()=>[n($,{label:A(u)("Type"),width:"110"},{default:d(({row:F})=>[n(S,{type:F.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(m(F.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n($,{label:A(u)("Category")},{default:d(({row:F})=>[R(m(F.category_name||"—"),1)]),_:1},8,["label"]),n($,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:F})=>[R(m(F.class_label||A(u)("All")),1)]),_:1},8,["label"]),n($,{label:A(u)("Tax Label")},{default:d(({row:F})=>[R(m(F.tax_label||"—"),1)]),_:1},8,["label"]),n($,{label:A(u)("Location")},{default:d(({row:F})=>[R(m(F.location),1)]),_:1},8,["label"]),n($,{label:A(u)("City / Postcode")},{default:d(({row:F})=>[F.city||F.postcode?(r(),h("span",Bhe,m([F.city,F.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",xhe,"—"))]),_:1},8,["label"]),n($,{label:A(u)("Rate"),width:"100"},{default:d(({row:F})=>[R(m(F.rate)+"% ",1)]),_:1},8,["label"]),n($,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:F})=>[o("div",She,[n(Ze,{tag:"button",size:"small",onClick:x=>y(F)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ze,{tag:"button",size:"small",onClick:x=>v(F),bg:"danger",outline:""},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),n(bhe,{modelValue:s.value,"onUpdate:modelValue":[k[0]||(k[0]=F=>s.value=F),k[1]||(k[1]=F=>!F&&(i.value=null))],countries:e.countries,"tax-classes":c.value,"edit-row":i.value,onSaved:_},null,8,["modelValue","countries","tax-classes","edit-row"])],64)}}},$he={class:"setting-wrap"},Ehe={class:"setting-wrap-inner"},Uhe={class:"fct-tax-collection-page"},Ihe={__name:"EUVatSettings",setup(e){const t=M(!0),a=Ge.get("eu_vat_county_options",[]),l=M(""),s=M(""),i=M([]),c=M({}),p=N(()=>!!Ge.get("is_tax_enabled"));function f(){return t.value=!0,ue.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||[],c.value=y,s.value=y.method||""}).catch(g=>{var y;z.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{t.value=!1})}function _({method:g}){s.value=g||"",f()}return Ie(f),(g,y)=>(r(),h("div",$he,[n(Qa,{heading:A(u)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",Ehe,[n(Da),o("div",Uhe,[t.value?(r(),E(Nfe,{key:0})):(r(),h(H,{key:1},[n(yhe,{countries:A(a),"initial-form":c.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"]),n(Fhe,{countries:A(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class Qhe extends Qs{getTabs(){return{all:u("All"),active:u("Active"),expired:u("Inactive")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Stackable",value:"stackable"},{label:"Actions",value:"actions"}]}getSearchHint(){return u("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 df(e){return Qhe.init(e)}const Dhe={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},Vhe={class:"fct-table-mobile-header"},The={class:"fct-table-mobile-header-left"},Mhe={class:"fct-table-id-col"},Lhe={class:"fct-table-status-col"},Rhe=["onClick"],Ohe={class:"title"},Hhe={class:"value"},Phe={key:0,class:"fct-table-action-col"},Nhe={class:"more-btn pr-0"},Khe={class:"fct-table-mobile-body"},Ghe=["onClick"],jhe={key:0,class:"fct-table-coupon-title-col"},zhe={class:"fct-table-coupon-code-col"},qhe=["onClick"],Yhe={class:"fct-table-mobile-footer"},Whe=["onClick"],Jhe={class:"fct-table-date-col grid"},Xhe={class:"title"},Zhe={class:"value"},e_e={key:0,class:"fct-table-stackable-col"},t_e={class:"title"},a_e={class:"value"},l_e={class:"fct-table-amount-col"},s_e={class:"title"},n_e={class:"value"},o_e={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){et.extend(di);const t=e,a=s=>{if(!s||s==="0000-00-00 00:00:00")return!1;const i=et.utc(s).local();return i.isValid()?i.isBefore(et()):!1},l=s=>{let i=u("Are you sure you want to delete this %s coupon. This action is not recoverable",s.coupon.title);s.action==="delete"&&rl(i,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ue.delete("coupons/"+s.coupon.id).then(c=>{z.success(c.message),t.table.fetch()}).catch(c=>{z.error(c)}).finally(()=>{})}).catch(()=>{})};return(s,i)=>{const c=C("router-link"),p=C("el-tooltip"),f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",Dhe,[(r(!0),h(H,null,ae(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[o("div",Vhe,[o("div",The,[o("div",Mhe,[n(c,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:d(()=>[R(" #"+m(y.id),1)]),_:2},1032,["to"])]),o("div",Lhe,[n(ma,{status:y.status},{default:d(()=>[R(m(a(y.end_date)?A(u)("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:d(()=>[R(m(A(u)("Available On: %s",A($s)(y.start_date,!0))),1)]),default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):B("",!0)]),o("div",{class:"fct-table-usage-col",onClick:b=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",Ohe,m(A(u)("Usage:")),1),o("div",Hhe,[R(m(y.use_count??0)+" ",1),i[0]||(i[0]=o("span",null,"/",-1)),R(" "+m(y.conditions.max_uses>0?y.conditions.max_uses:A(u)("Unlimited")),1)])],8,Rhe)]),e.table.isColumnVisible("actions")?(r(),h("div",Phe,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(_,null,{default:d(()=>[y.id?(r(),E(f,{key:0,class:"item-link"},{default:d(()=>[n(c,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id,action:"edit"}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(f,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",Nhe,[n(J,{name:"More"})])]),_:2},1024)])):B("",!0)]),o("div",Khe,[o("div",{class:"fct-table-coupon-code-wrapper-col",onClick:b=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(r(),h("div",jhe,m(y.title),1)):B("",!0),o("div",zhe,[o("code",{class:"copyable-content",onClick:b=>{A(Zl).copy(y.code)}},m(y.code),9,qhe)])],8,Ghe)]),o("div",Yhe,[o("div",{class:"fct-table-mobile-footer-row items-start",onClick:b=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",Jhe,[o("div",Xhe,m(A(u)("Expiry Date")),1),o("div",Zhe,[isNaN(Date.parse(y.end_date))?(r(),h(H,{key:1},[R("n/a")],64)):(r(),E(Na,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),h("div",e_e,[o("div",t_e,m(A(u)("Stackable")),1),o("div",a_e,m(y.stackable),1)])):B("",!0),o("div",l_e,[o("div",s_e,m(A(u)("Amount")),1),o("div",n_e,m(y.type!=="percentage"?A(Gt)(y.amount,!0):y.amount+"%"),1)])],8,Whe)])]))),128))])}}},i_e={},r_e={class:"px-4 py-3"},d_e={class:"grid grid-cols-3 gap-5 mt-5"};function u_e(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",r_e,[(r(),h(H,null,ae(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",d_e,[(r(),h(H,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const c_e=lt(i_e,[["render",u_e]]),A_e={class:"fct-all-coupons-page fct-layout-width"},p_e={class:"fct-all-coupons-wrap"},f_e={key:1},m_e=["onClick"],h_e={class:"capitalize"},__e={class:"more-btn mr-2"},_c={__name:"AllCoupons",setup(e){et.extend(di);const t=df(),a=M(!1),l=c=>{let p=u("Are you sure you want to delete this %s coupon. This action is not recoverable",c.coupon.title);c.action==="delete"&&rl(p,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ue.delete("coupons/"+c.coupon.id).then(f=>{z.success(f.message),t.fetch()}).catch(f=>{var _;f.status_code=="422"?z.validationErrors(f):z.error((_=f.data)==null?void 0:_.message)}).finally(()=>{})}).catch(()=>{})},s=()=>{ue.get("coupons/getSettings").then(c=>{a.value=!!parseInt(c.show_on_checkout)}).catch(c=>{var p;c.status_code=="422"?z.validationErrors(c):z.error((p=c.data)==null?void 0:p.message)}).finally(()=>{})},i=c=>{if(!c||c==="0000-00-00 00:00:00")return!1;const p=et.utc(c).local();return p.isValid()?p.isBefore(et()):!1};return Ie(()=>{s()}),(c,p)=>{const f=C("el-button"),_=C("el-table-column"),g=C("el-tooltip"),y=C("router-link"),v=C("el-dropdown-item"),b=C("el-dropdown-menu"),k=C("el-dropdown"),w=C("el-table");return r(),E(Rt,{permission:"coupons/view"},{default:d(()=>[o("div",A_e,[n(nl,{title:A(u)("Coupons")},{action:d(()=>[n(f,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:d(()=>[R(m(A(u)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),o("div",p_e,[n(Ds,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(c_e,{key:0})):B("",!0),A(t).isLoading()?B("",!0):(r(),E(o_e,{key:1,table:A(t)},null,8,["table"]))]),default:d(()=>[A(t).isLoading()?(r(),E(pfe,{key:0,couponTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",f_e,[n(w,{data:A(t).getTableData(),class:"w-full compact-table full-compact"},{empty:d(()=>[n(wt,{icon:"Empty/Order","has-dark":"",text:A(u)("No coupons available at the moment.")},null,8,["text"])]),default:d(()=>[n(_,{width:100,label:A(u)("ID")},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id}}},{default:d(()=>[R(" #"+m(A(ta)(S.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("title")?(r(),E(_,{key:0,label:A(u)("Title"),width:220},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[R(m(S.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:A(u)("Code"),width:200},{default:d(S=>[o("code",{class:"copyable-content",onClick:$=>{A(Zl).copy(S.row.code)}},m(S.row.code),9,m_e)]),_:1},8,["label"]),n(_,{label:A(u)("Amount"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[R(m(S.row.type!=="percentage"?A(Gt)(S.row.amount,!0):S.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:A(u)("Usage"),width:150},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[o("span",null,m(A(ta)(S.row.use_count??0)),1),p[0]||(p[0]=o("span",{class:"px-1"},"/",-1)),o("span",null,m(S.row.conditions.max_uses>0?S.row.conditions.max_uses:A(u)("Unlimited")),1)]),_:2,__:[0]},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("stackable")?(r(),E(_,{key:1,label:A(u)("Stackable"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[o("span",h_e,m(S.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:A(u)("Status"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[n(ma,{status:S.row.status},{default:d(()=>[R(m(i(S.row.end_date)?A(u)("Expired"):S.row.status),1)]),_:2},1032,["status"]),S.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:d(()=>[R(m(A(u)("Available On: %s",A($s)(S.row.start_date,!0))),1)]),default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):B("",!0)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:A(u)("Expiry Date"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[o("span",null,[isNaN(Date.parse(S.row.end_date))?(r(),h(H,{key:1},[R("n/a")],64)):(r(),E(Na,{key:0,"date-time":S.row.end_date,"with-time":!0},null,8,["date-time"]))])]),_:2},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("actions")?(r(),E(_,{key:2,label:A(u)("Actions"),width:100,align:"right",fixed:"right"},{default:d(S=>[n(k,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(b,null,{default:d(()=>[S.row.id?(r(),E(v,{key:0,class:"item-link"},{default:d(()=>[n(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(v,{command:{action:"delete",coupon:S.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",__e,[n(J,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},v_e={class:"fct-add-edit-coupon-wrapper fct-layout-width"},g_e={class:"single-page-header"},y_e={class:"single-page-body"},b_e={class:"fct-add-edit-coupon"},w_e={class:"fct-add-edit-coupon-main"},C_e={class:"fct-add-edit-coupon-aside"},k_e={class:"fct-admin-sidebar"},B_e={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-breadcrumb-item"),c=C("el-breadcrumb");return r(),h("div",v_e,[o("div",g_e,[n(c,{"separator-icon":A(dl)},{default:d(()=>[n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[60px] h-4"})]),_:1})]),_:1})]),_:1},8,["separator-icon"])]),o("div",y_e,[o("div",b_e,[o("div",w_e,[n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})]),o("div",C_e,[o("div",k_e,[n(Be,null,{default:d(()=>[n(Qe,{title:A(u)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})])])])])])}}};et.extend(di);et.extend(tA);const x_e={name:"AddOrEditCoupon",components:{CardContainer:Be,CardHeader:Qe,CardBody:Ce,LabelHint:fa,ValidationError:ra,CopyToClipboard:Ia,DynamicTemplates:cn,SaveBar:rn,ProductVariationSelector:aA,SingleCouponLoader:B_e,Activity:Yc},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 dl},maxDiscountAmount(){return this.coupon.type==="percentage"?100:999999}},watch:{coupon:{handler(){this.handleChangesMade()},deep:!0}},mounted(){this.keyboardShortcuts=_s(),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:u,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:et(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=Gt(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=Gt(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=Gt(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 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(){ue.get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},fetchCoupon(){this.fetchingCoupon=!0,this.isInitialLoading=!0,ue.get(`coupons/${this.coupon_id}`,{}).then(e=>{var l,s;const t=(l=e==null?void 0:e.coupon)==null?void 0:l.start_date,a=(s=e==null?void 0:e.coupon)==null?void 0:s.end_date;t&&t!=="0000-00-00 00:00:00"&&(e.coupon.start_date=et.utc(t).tz(et.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=et.utc(a).tz(et.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"?z.validationErrors(errors):z.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}}),ue.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}),z.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var l;a.status_code=="422"?(z.validationErrors(a),this.validationErrors=a):z.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}}),ue.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}),z.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var l;a.status_code=="422"?(z.validationErrors(a),this.validationErrors=a):z.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.creating=!1})}}},S_e={class:"fct-add-edit-coupon-wrapper fct-layout-width"},F_e={class:"single-page-header"},$_e={class:"single-page-body"},E_e={class:"fct-add-edit-coupon"},U_e={class:"fct-add-edit-coupon-main"},I_e={class:"flex gap-2 items-center justify-between w-full mb-2.5"},Q_e={class:"form-note"},D_e=["innerHTML"],V_e={key:1},T_e=["innerHTML"],M_e=["innerHTML"],L_e=["innerHTML"],R_e={class:"fct-add-edit-coupon-aside"},O_e={class:"fct-admin-sidebar"},H_e={class:"fct-admin-sidebar-item"},P_e={key:0,class:"flex items-center gap-1"},N_e={class:"text-sm font-medium text-system-dark dark:text-gray-300"},K_e={key:1},G_e={class:"fct-admin-sidebar-item mt-5 hidden"},j_e={class:"sidebar-title mb-3"},z_e={class:"fct-bullet-lists"},q_e={class:"fct-admin-sidebar-item mt-5 hidden"},Y_e={class:"sidebar-title mb-3"},W_e={class:"fct-bullet-lists"},J_e={key:0};function X_e(e,t,a,l,s,i){const c=C("SaveBar"),p=C("SingleCouponLoader"),f=C("el-breadcrumb-item"),_=C("el-breadcrumb"),g=C("CardHeader"),y=C("el-input"),v=C("ValidationError"),b=C("el-form-item"),k=C("el-col"),w=C("LabelHint"),S=C("el-row"),$=C("CardBody"),V=C("CardContainer"),F=C("el-option"),x=C("el-select"),Q=C("el-radio"),D=C("el-radio-group"),T=C("ProductVariationSelector"),U=C("el-checkbox"),I=C("el-form"),O=C("CopyToClipboard"),L=C("el-date-picker"),P=C("DynamicTemplates"),q=C("Activity");return r(),h("div",S_e,[n(c,{isActive:s.changes_made>0?"is-active":"",loading:a.coupon_id?s.updating:s.creating,onSave:t[0]||(t[0]=X=>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"]),s.fetchingCoupon?(r(),E(p,{key:0})):B("",!0),s.fetchingCoupon?B("",!0):(r(),h(H,{key:1},[o("div",F_e,[n(_,{"separator-icon":i.ArrowRight},{default:d(()=>[n(f,{to:{name:"coupons"}},{default:d(()=>[R(m(i.translate("Coupons")),1)]),_:1}),n(f,null,{default:d(()=>[R(m(a.coupon_id?i.translate("Edit Coupon"):i.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),E(f,{key:0},{default:d(()=>[R(m(s.coupon.title),1)]),_:1})):B("",!0)]),_:1},8,["separator-icon"])]),o("div",$_e,[o("div",E_e,[o("div",U_e,[n(I,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(V,null,{default:d(()=>[n(g,{title:i.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(b,{label:i.translate("Title"),required:""},{default:d(()=>{var X,G;return[n(y,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=te=>s.coupon.title=te),placeholder:i.translate("Enter title"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("title")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"title"},null,8,["validation-errors"])):B("",!0)]}),_:1},8,["label"])]),_:1}),n(k,{lg:12},{default:d(()=>[n(b,null,{default:d(()=>{var X,G;return[o("div",I_e,[n(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]=(...te)=>i.generateRandomCouponCode&&i.generateRandomCouponCode(...te))},m(i.translate("Generate Random Code")),1)]),n(y,{modelValue:s.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=te=>s.coupon.code=te),placeholder:i.translate("Eg. COUPON10"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("code")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"code"},null,8,["validation-errors"])):B("",!0),o("div",Q_e,[o("p",null,m(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),n(k,{lg:12},{default:d(()=>[n(b,null,{label:d(()=>[n(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:d(()=>{var X,G;return[n(y,{modelValue:s.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=te=>s.coupon.priority=te),type:"number",placeholder:i.translate("Enter priority"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=te=>{i.onChangeCouponInput("priority",te)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","onKeypress"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("priority")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"priority"},null,8,["validation-errors"])):B("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(V,null,{default:d(()=>[n(g,{title:i.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:8},{default:d(()=>[n(b,{label:i.translate("Type"),required:""},{default:d(()=>{var X;return[n(x,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=G=>s.coupon.type=G),placeholder:i.translate("Select coupon type"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:d(()=>[n(F,{label:i.translate("Fixed"),value:"fixed"},null,8,["label"]),n(F,{label:i.translate("Percentage"),value:"percentage"},null,8,["label"])]),_:1},8,["modelValue","placeholder","class"])]}),_:1},8,["label"])]),_:1}),s.coupon.type==="fixed"||s.coupon.type==="percentage"?(r(),h(H,{key:0},[n(k,{lg:8},{default:d(()=>[n(b,{label:s.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:d(()=>{var X;return[n(y,{modelValue:s.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=G=>s.coupon.amount=G),type:"number",placeholder:"0.00",min:s.minDiscountAmount,max:i.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=G=>{i.onChangeCouponInput("amount",G)}),onKeypress:t[9]||(t[9]=G=>i.preventInvalidChars(G,!0))},{prefix:d(()=>[s.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,D_e)):(r(),h("span",V_e,"%"))]),_:1},8,["modelValue","min","max"]),(X=s.validationErrors)!=null&&X.hasOwnProperty("amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"amount"},null,8,["validation-errors"])):B("",!0)]}),_:1},8,["label"])]),_:1}),s.coupon.type==="percentage"?(r(),E(k,{key:0,lg:8},{default:d(()=>[n(b,{label:i.translate("Max Discount Amount")},{default:d(()=>{var X;return[n(y,{modelValue:s.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=G=>s.coupon.conditions.max_discount_amount=G),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,T_e)]),_:1},8,["modelValue","placeholder","class"]),n(v,{"validation-errors":s.validationErrors,"field-key":"max_discount_amount"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})):B("",!0)],64)):B("",!0)]),_:1})]),_:1})]),_:1}),n(V,null,{default:d(()=>[n(g,{title:i.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(b,null,{label:d(()=>[n(w,{title:i.translate("Min Spend Amount"),content:i.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:d(()=>{var X,G;return[n(y,{modelValue:s.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=te=>s.coupon.conditions.min_purchase_amount=te),type:"number",placeholder:"0.00",class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,M_e)]),_:1},8,["modelValue","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("min_purchase_amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"min_purchase_amount"},null,8,["validation-errors"])):B("",!0)]}),_:1})]),_:1}),n(k,{lg:12},{default:d(()=>[n(b,null,{label:d(()=>[n(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:d(()=>{var X,G;return[n(y,{modelValue:s.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=te=>s.coupon.conditions.max_purchase_amount=te),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,L_e)]),_:1},8,["modelValue","placeholder","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("max_purchase_amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_purchase_amount"},null,8,["validation-errors"])):B("",!0)]}),_:1})]),_:1}),n(k,{lg:24},{default:d(()=>[n(b,null,{label:d(()=>[n(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:d(()=>[n(D,{modelValue:s.coupon.conditions.min_amount_basis,"onUpdate:modelValue":t[13]||(t[13]=X=>s.coupon.conditions.min_amount_basis=X)},{default:d(()=>[n(Q,{value:"subtotal",label:i.translate("Subtotal (items only)")},null,8,["label"]),n(Q,{value:"total",label:i.translate("Total (includes shipping & fees)")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),n(k,{md:12},{default:d(()=>[n(b,{label:i.translate("Include Categories")},{default:d(()=>[n(x,{modelValue:s.coupon.conditions.included_categories,"onUpdate:modelValue":t[14]||(t[14]=X=>s.coupon.conditions.included_categories=X),multiple:"",placeholder:i.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,X=>(r(),E(F,{key:X.value,label:X.label,value:X.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(k,{md:12},{default:d(()=>[n(b,{label:i.translate("Exclude Categories")},{default:d(()=>[n(x,{modelValue:s.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[15]||(t[15]=X=>s.coupon.conditions.excluded_categories=X),multiple:"",placeholder:i.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,X=>(r(),E(F,{key:X.value,label:X.label,value:X.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(b,{label:i.translate("Include Products")},{default:d(()=>[n(T,{modelValue:s.coupon.conditions.included_products,"onUpdate:modelValue":t[16]||(t[16]=X=>s.coupon.conditions.included_products=X)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(b,{label:i.translate("Excluded Products")},{default:d(()=>[n(T,{modelValue:s.coupon.conditions.excluded_products,"onUpdate:modelValue":t[17]||(t[17]=X=>s.coupon.conditions.excluded_products=X)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(b,null,{label:d(()=>[n(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:d(()=>{var X;return[n(y,{autocomplete:"off",modelValue:s.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[18]||(t[18]=G=>s.coupon.conditions.email_restrictions=G),type:"text",placeholder:i.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(X=s.validationErrors)!=null&&X.hasOwnProperty("email_restrictions")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"email_restrictions"},null,8,["validation-errors"])):B("",!0)]}),_:1})]),_:1}),n(k,{md:24},{default:d(()=>{var X;return[n(b,null,{label:d(()=>[n(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:d(()=>[n(U,{modelValue:s.coupon.conditions.is_recurring,"onUpdate:modelValue":t[19]||(t[19]=G=>s.coupon.conditions.is_recurring=G),label:i.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(X=s.validationErrors)!=null&&X.hasOwnProperty("is_recurring")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"is_recurring"},null,8,["validation-errors"])):B("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),n(V,null,{default:d(()=>[n(g,{title:i.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(b,null,{label:d(()=>[n(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:d(()=>{var X,G;return[n(y,{modelValue:s.coupon.conditions.max_uses,"onUpdate:modelValue":t[20]||(t[20]=te=>s.coupon.conditions.max_uses=te),type:"number",placeholder:i.translate("Total limit"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("max_uses")?"is-error":s.usageError),min:s.minLimit,max:s.maxLimit,onInput:t[21]||(t[21]=te=>{i.onChangeCouponInput("max_uses",te)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("max_uses")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_uses"},null,8,["validation-errors"])):B("",!0)]}),_:1})]),_:1}),n(k,{lg:12},{default:d(()=>[n(b,null,{label:d(()=>[n(w,{title:i.translate("Per User Limit"),content:i.translate("Maximum an user can use. 0 means unlimited")},null,8,["title","content"])]),default:d(()=>[n(y,{modelValue:s.coupon.conditions.max_per_customer,"onUpdate:modelValue":t[22]||(t[22]=X=>s.coupon.conditions.max_per_customer=X),type:"number",placeholder:i.translate("Max limit per user"),class:de(s.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:s.minLimit,max:s.maxLimit,onInput:t[23]||(t[23]=X=>{i.onChangeCouponInput("max_per_customer",X)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),n(v,{"validation-errors":s.validationErrors,"field-key":"max_per_customer"},null,8,["validation-errors"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(V,null,{default:d(()=>[n(g,{title:i.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(b,{label:i.translate("Status")},{default:d(()=>[n(D,{modelValue:s.coupon.status,"onUpdate:modelValue":t[24]||(t[24]=X=>s.coupon.status=X)},{default:d(()=>[n(Q,{value:"active",label:i.translate("Active")},null,8,["label"]),n(Q,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),n(Q,{disabled:"",value:"expired",label:i.translate("Expired")},null,8,["label"])]),_:1},8,["modelValue"]),n(v,{"validation-errors":s.validationErrors,"field-key":"status"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),n(k,{lg:24},{default:d(()=>[n(b,{label:i.translate("Internal Notes")},{default:d(()=>{var X;return[n(y,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[25]||(t[25]=G=>s.coupon.notes=G),type:"textarea",placeholder:i.translate("Enter note"),class:de((X=s.validationErrors)!=null&&X.hasOwnProperty("notes")?"is-error":"")},null,8,["modelValue","placeholder","class"]),n(v,{"validation-errors":s.validationErrors,"field-key":"notes"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(k,{lg:24},{default:d(()=>{var X;return[n(b,null,{label:d(()=>[n(w,{title:i.translate("Stackable"),content:i.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:d(()=>[n(D,{modelValue:s.coupon.stackable,"onUpdate:modelValue":t[26]||(t[26]=G=>s.coupon.stackable=G)},{default:d(()=>[n(Q,{value:"yes"},{default:d(()=>[R(m(i.translate("Yes")),1)]),_:1}),n(Q,{value:"no"},{default:d(()=>[R(m(i.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(X=s.validationErrors)!=null&&X.hasOwnProperty("stackable")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"stackable"},null,8,["validation-errors"])):B("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),o("div",R_e,[o("div",O_e,[n(V,null,{default:d(()=>[n(g,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,null,{default:d(()=>[o("div",H_e,[s.coupon.code?(r(),h("div",P_e,[o("span",N_e,m(i.translate("Coupon code"))+": "+m(s.coupon.code),1),n(O,{text:s.coupon.code,showMode:"basic_copy_btn",tooltipText:i.translate("Copy discount code")},null,8,["text","tooltipText"])])):(r(),h("div",K_e,m(i.translate("No discount code yet")),1))]),o("div",G_e,[o("h4",j_e,m(i.translate("Type & Method")),1),o("ul",z_e,[o("li",null,[o("span",null,m(i.translate("Amount off Products")),1)]),o("li",null,[o("span",null,m(i.translate("Code")),1)])])]),o("div",q_e,[o("h4",Y_e,m(i.translate("Details")),1),o("ul",W_e,[o("li",null,[o("span",null,m(i.translate("For Online Store")),1)]),o("li",null,[o("span",null,m(i.translate("No Min Purchase Requirement")),1)]),o("li",null,[o("span",null,m(i.translate("All Customers")),1)])])])]),_:1})]),_:1}),n(V,null,{default:d(()=>[n(g,{title:i.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(I,{"label-position":"top"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(b,{label:i.translate("Start Date & Time")},{default:d(()=>[n(L,{modelValue:s.coupon.start_date,"onUpdate:modelValue":t[27]||(t[27]=X=>s.coupon.start_date=X),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}),n(k,{lg:24},{default:d(()=>[n(b,null,{default:d(()=>[n(U,{modelValue:s.isEndDateEnabled,"onUpdate:modelValue":t[28]||(t[28]=X=>s.isEndDateEnabled=X),label:i.translate("Set end date & time"),onChange:t[29]||(t[29]=X=>{X||(s.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),s.isEndDateEnabled?(r(),E(k,{key:0,lg:24},{default:d(()=>[n(b,{label:i.translate("End Date & Time")},{default:d(()=>[n(L,{modelValue:s.coupon.end_date,"onUpdate:modelValue":t[30]||(t[30]=X=>s.coupon.end_date=X),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"]),s.validationErrors.hasOwnProperty("end_date")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"end_date"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])]),_:1})):B("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),s.showDynamicTemplates?(r(),h("div",J_e,[n(P,{filter:"fluent_cart_single_coupon_page",ref:"dynamic_templates",data:{coupon:s.coupon},widgetsQuery:{coupon_id:s.coupon.id},onChange:i.handleChangesMade},null,8,["data","widgetsQuery","onChange"])])):B("",!0),n(V,null,{default:d(()=>[n(g,{title:i.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,null,{default:d(()=>[n(q,{onReload:i.fetchCoupon,activities:s.coupon.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const Z_e=lt(x_e,[["render",X_e]]),eve={name:"CheckoutFields",components:{Animation:va,CardHeader:Qe,Card:Be,CardBody:Ce,SettingsHeader:Qa,AdminNotice:Da},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,s;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"||((s=e.legal_registration_id)==null?void 0:s.enabled)==="yes"||(e.b2b_only_mode.enabled="no")}}},mounted(){this.getFields()},methods:{translate:u,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,s,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"&&((s=a.vat_number)==null?void 0:s.enabled)!=="yes"&&((i=a.legal_registration_id)==null?void 0:i.enabled)!=="yes"},shouldDimLabel(e,t){var a,l,s,i,c,p,f;return((s=(l=(a=this.settings)==null?void 0:a[e])==null?void 0:l[t])==null?void 0:s.enabled)==="no"?!0:e==="basic_info"&&t==="full_name"?((c=(i=this.settings.basic_info)==null?void 0:i.first_name)==null?void 0:c.enabled)==="yes"||((f=(p=this.settings.basic_info)==null?void 0:p.last_name)==null?void 0:f.enabled)==="yes":!1},isVisible(e,t){var a,l,s,i;return t==="full_name"?((l=(a=this.settings.basic_info)==null?void 0:a.first_name)==null?void 0:l.enabled)!=="yes"&&((i=(s=this.settings.basic_info)==null?void 0:s.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())}}},tve={class:"setting-wrap"},ave={class:"setting-wrap-inner"},lve={class:"fct-checkout-fields-wrapp"},sve={class:"field-heading"},nve={class:"fct-checkout-fields"},ove={key:0,class:"fct-checkout-field"},ive={class:"fct-checkout-field-info"},rve={class:"fct-checkout-field-label-wrap"},dve={class:"fct-checkout-field-tags"},uve={key:0,class:"fct-checkout-field-info-desc"},cve={key:0,class:"fct-checkout-field-action"},Ave={key:1,class:"fct-checkout-field-input"},pve={class:"fct-checkout-field-info"},fve={class:"fct-checkout-field-label-wrap"},mve={key:1,class:"fct-checkout-field-tags"},hve={key:0,class:"fct-checkout-field-info-desc"},_ve={key:0,class:"fct-checkout-field-action"},vve={class:"form-section-save-action"};function gve(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-skeleton"),_=C("el-switch"),g=C("el-tag"),y=C("el-checkbox"),v=C("el-input"),b=C("CardBody"),k=C("Card"),w=C("el-button");return r(),h("div",tve,[n(c,{heading:i.translate("Checkout Fields"),loading:s.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",ave,[n(p),o("div",lve,[n(k,null,{default:d(()=>[n(b,null,{default:d(()=>[n(f,{loading:s.fetching,animated:"",rows:5},null,8,["loading"]),s.fetching?B("",!0):(r(!0),h(H,{key:0},ae(s.fields,(S,$)=>(r(),h("div",{key:$,class:"fct-checkout-field-section"},[o("h3",sve,m(i.formatSectionTitle($)),1),o("div",nve,[S.label?(r(),h("div",ove,[o("div",ive,[o("div",rve,[S.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[$].enabled,"onUpdate:modelValue":V=>s.settings[$].enabled=V,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):B("",!0),o("span",{class:de(`fct-checkout-field-label ${s.settings[$].enabled==="no"?"opacity-50":""}`)},m(S.label),3),o("div",dve,[S.can_alter!=="yes"&&s.settings[$].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:d(()=>[R(m(i.translate("System")),1)]),_:1})):B("",!0),s.settings[$].required==="yes"&&s.settings[$].enabled==="yes"?(r(),E(g,{key:1,size:"small"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:1})):B("",!0)])]),S.help_text?(r(),h("div",uve,m(S.help_text),1)):B("",!0)]),S.can_alter==="yes"?(r(),h("div",cve,[n(y,{modelValue:s.settings[$].required,"onUpdate:modelValue":V=>s.settings[$].required=V,"true-label":"yes","false-label":"no",disabled:s.settings[$].enabled!=="yes"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),s.settings[$].hasOwnProperty("text")&&s.settings[$].enabled==="yes"?(r(),h("div",Ave,[n(v,{type:"textarea",modelValue:s.settings[$].text,"onUpdate:modelValue":V=>s.settings[$].text=V,disabled:s.settings[$].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0)])):(r(!0),h(H,{key:1},ae(S,(V,F)=>(r(),h("div",{key:F,class:"fct-checkout-field"},[o("div",pve,[o("div",fve,[V.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[$][F].enabled,"onUpdate:modelValue":x=>s.settings[$][F].enabled=x,"active-value":"yes","inactive-value":"no",disabled:i.isFirstNameDisabled($,F)||i.isB2BOnlyModeDisabled($,F)},null,8,["modelValue","onUpdate:modelValue","disabled"])):B("",!0),o("span",{class:de(["fct-checkout-field-label",i.shouldDimLabel($,F)?"opacity-50":""])},m(V.label),3),i.isVisible(V,F)?(r(),h("div",mve,[V.can_alter!=="yes"&&s.settings[$][F].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:d(()=>[R(m(i.translate("System")),1)]),_:1})):B("",!0),s.settings[$][F].required==="yes"&&s.settings[$][F].enabled==="yes"?(r(),E(g,{key:1,size:"small"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:1})):B("",!0)])):B("",!0)]),V.help_text?(r(),h("div",hve,m(V.help_text),1)):B("",!0)]),V.can_alter==="yes"&&F!=="first_name"&&F!=="b2b_only_mode"?(r(),h("div",_ve,[n(y,{modelValue:s.settings[$][F].required,"onUpdate:modelValue":x=>s.settings[$][F].required=x,"true-label":"yes","false-label":"no",disabled:s.settings[$][F].enabled!=="yes"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0)]))),128))])]))),128))]),_:1})]),_:1}),o("div",vve,[n(w,{type:"primary",onClick:i.saveFields,loading:s.saving},{default:d(()=>[R(m(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const yve=lt(eve,[["render",gve]]);var So={exports:{}};/* @license
286 Papa Parse
287 v5.5.3
288 https://github.com/mholt/PapaParse
289 License: MIT
290 */var bve=So.exports,vc;function wve(){return vc||(vc=1,function(e,t){((a,l)=>{e.exports=l()})(bve,function a(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},s,i=!l.document&&!!l.postMessage,c=l.IS_PAPA_WORKER||!1,p={},f=0,_={};function g(U){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(I){var O=Q(I);O.chunkSize=parseInt(O.chunkSize),I.step||I.chunk||(O.chunkSize=null),this._handle=new w(O),(this._handle.streamer=this)._config=O}).call(this,U),this.parseChunk=function(I,O){var L=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<L){let q=this._config.newline;q||(P=this._config.quoteChar||'"',q=this._handle.guessLineEndings(I,P)),I=[...I.split(q).slice(L)].join(q)}this.isFirstChunk&&T(this._config.beforeFirstChunk)&&(P=this._config.beforeFirstChunk(I))!==void 0&&(I=P),this.isFirstChunk=!1,this._halted=!1;var L=this._partialLine+I,P=(this._partialLine="",this._handle.parse(L,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(I=P.meta.cursor,L=(this._finished||(this._partialLine=L.substring(I-this._baseIndex),this._baseIndex=I),P&&P.data&&(this._rowCount+=P.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),c)l.postMessage({results:P,workerId:_.WORKER_ID,finished:L});else if(T(this._config.chunk)&&!O){if(this._config.chunk(P,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=P=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(P.data),this._completeResults.errors=this._completeResults.errors.concat(P.errors),this._completeResults.meta=P.meta),this._completed||!L||!T(this._config.complete)||P&&P.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),L||P&&P.meta.paused||this._nextChunk(),P}this._halted=!0},this._sendError=function(I){T(this._config.error)?this._config.error(I):c&&this._config.error&&l.postMessage({workerId:_.WORKER_ID,error:I,finished:!1})}}function y(U){var I;(U=U||{}).chunkSize||(U.chunkSize=_.RemoteChunkSize),g.call(this,U),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(I=new XMLHttpRequest,this._config.withCredentials&&(I.withCredentials=this._config.withCredentials),i||(I.onload=D(this._chunkLoaded,this),I.onerror=D(this._chunkError,this)),I.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var O,L=this._config.downloadRequestHeaders;for(O in L)I.setRequestHeader(O,L[O])}var P;this._config.chunkSize&&(P=this._start+this._config.chunkSize-1,I.setRequestHeader("Range","bytes="+this._start+"-"+P));try{I.send(this._config.downloadRequestBody)}catch(q){this._chunkError(q.message)}i&&I.status===0&&this._chunkError()}},this._chunkLoaded=function(){I.readyState===4&&(I.status<200||400<=I.status?this._chunkError():(this._start+=this._config.chunkSize||I.responseText.length,this._finished=!this._config.chunkSize||this._start>=(O=>(O=O.getResponseHeader("Content-Range"))!==null?parseInt(O.substring(O.lastIndexOf("/")+1)):-1)(I),this.parseChunk(I.responseText)))},this._chunkError=function(O){O=I.statusText||O,this._sendError(new Error(O))}}function v(U){(U=U||{}).chunkSize||(U.chunkSize=_.LocalChunkSize),g.call(this,U);var I,O,L=typeof FileReader<"u";this.stream=function(P){this._input=P,O=P.slice||P.webkitSlice||P.mozSlice,L?((I=new FileReader).onload=D(this._chunkLoaded,this),I.onerror=D(this._chunkError,this)):I=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var P=this._input,q=(this._config.chunkSize&&(q=Math.min(this._start+this._config.chunkSize,this._input.size),P=O.call(P,this._start,q)),I.readAsText(P,this._config.encoding));L||this._chunkLoaded({target:{result:q}})},this._chunkLoaded=function(P){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(P.target.result)},this._chunkError=function(){this._sendError(I.error)}}function b(U){var I;g.call(this,U=U||{}),this.stream=function(O){return I=O,this._nextChunk()},this._nextChunk=function(){var O,L;if(!this._finished)return O=this._config.chunkSize,I=O?(L=I.substring(0,O),I.substring(O)):(L=I,""),this._finished=!I,this.parseChunk(L)}}function k(U){g.call(this,U=U||{});var I=[],O=!0,L=!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(P){this._input=P,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){L&&I.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),I.length?this.parseChunk(I.shift()):O=!0},this._streamData=D(function(P){try{I.push(typeof P=="string"?P:P.toString(this._config.encoding)),O&&(O=!1,this._checkIsFinished(),this.parseChunk(I.shift()))}catch(q){this._streamError(q)}},this),this._streamError=D(function(P){this._streamCleanUp(),this._sendError(P)},this),this._streamEnd=D(function(){this._streamCleanUp(),L=!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(U){var I,O,L,P,q=Math.pow(2,53),X=-q,G=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,te=/^((\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)))$/,ne=this,re=0,K=0,Y=!1,W=!1,j=[],ie={data:[],errors:[],meta:{}};function he(fe){return U.skipEmptyLines==="greedy"?fe.join("").trim()==="":fe.length===1&&fe[0].length===0}function me(){if(ie&&L&&(se("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+_.DefaultDelimiter+"'"),L=!1),U.skipEmptyLines&&(ie.data=ie.data.filter(function(ve){return!he(ve)})),ye()){let ve=function(Je,vt){T(U.transformHeader)&&(Je=U.transformHeader(Je,vt)),j.push(Je)};if(ie)if(Array.isArray(ie.data[0])){for(var fe=0;ye()&&fe<ie.data.length;fe++)ie.data[fe].forEach(ve);ie.data.splice(0,1)}else ie.data.forEach(ve)}function $e(ve,Je){for(var vt=U.header?{}:[],Ye=0;Ye<ve.length;Ye++){var xe=Ye,Ee=ve[Ye],Ee=((Oe,Me)=>(gt=>(U.dynamicTypingFunction&&U.dynamicTyping[gt]===void 0&&(U.dynamicTyping[gt]=U.dynamicTypingFunction(gt)),(U.dynamicTyping[gt]||U.dynamicTyping)===!0))(Oe)?Me==="true"||Me==="TRUE"||Me!=="false"&&Me!=="FALSE"&&((gt=>{if(G.test(gt)&&(gt=parseFloat(gt),X<gt&&gt<q))return 1})(Me)?parseFloat(Me):te.test(Me)?new Date(Me):Me===""?null:Me):Me)(xe=U.header?Ye>=j.length?"__parsed_extra":j[Ye]:xe,Ee=U.transform?U.transform(Ee,xe):Ee);xe==="__parsed_extra"?(vt[xe]=vt[xe]||[],vt[xe].push(Ee)):vt[xe]=Ee}return U.header&&(Ye>j.length?se("FieldMismatch","TooManyFields","Too many fields: expected "+j.length+" fields but parsed "+Ye,K+Je):Ye<j.length&&se("FieldMismatch","TooFewFields","Too few fields: expected "+j.length+" fields but parsed "+Ye,K+Je)),vt}var tt;ie&&(U.header||U.dynamicTyping||U.transform)&&(tt=1,!ie.data.length||Array.isArray(ie.data[0])?(ie.data=ie.data.map($e),tt=ie.data.length):ie.data=$e(ie.data,0),U.header&&ie.meta&&(ie.meta.fields=j),K+=tt)}function ye(){return U.header&&j.length===0}function se(fe,$e,tt,ve){fe={type:fe,code:$e,message:tt},ve!==void 0&&(fe.row=ve),ie.errors.push(fe)}T(U.step)&&(P=U.step,U.step=function(fe){ie=fe,ye()?me():(me(),ie.data.length!==0&&(re+=fe.data.length,U.preview&&re>U.preview?O.abort():(ie.data=ie.data[0],P(ie,ne))))}),this.parse=function(fe,$e,tt){var ve=U.quoteChar||'"',ve=(U.newline||(U.newline=this.guessLineEndings(fe,ve)),L=!1,U.delimiter?T(U.delimiter)&&(U.delimiter=U.delimiter(fe),ie.meta.delimiter=U.delimiter):((ve=((Je,vt,Ye,xe,Ee)=>{var Oe,Me,gt,yt;Ee=Ee||[","," ","|",";",_.RECORD_SEP,_.UNIT_SEP];for(var Mt=0;Mt<Ee.length;Mt++){for(var Ut,Dt=Ee[Mt],ht=0,Pt=0,Ct=0,St=(gt=void 0,new $({comments:xe,delimiter:Dt,newline:vt,preview:10}).parse(Je)),Ot=0;Ot<St.data.length;Ot++)Ye&&he(St.data[Ot])?Ct++:(Ut=St.data[Ot].length,Pt+=Ut,gt===void 0?gt=Ut:0<Ut&&(ht+=Math.abs(Ut-gt),gt=Ut));0<St.data.length&&(Pt/=St.data.length-Ct),(Me===void 0||ht<=Me)&&(yt===void 0||yt<Pt)&&1.99<Pt&&(Me=ht,Oe=Dt,yt=Pt)}return{successful:!!(U.delimiter=Oe),bestDelimiter:Oe}})(fe,U.newline,U.skipEmptyLines,U.comments,U.delimitersToGuess)).successful?U.delimiter=ve.bestDelimiter:(L=!0,U.delimiter=_.DefaultDelimiter),ie.meta.delimiter=U.delimiter),Q(U));return U.preview&&U.header&&ve.preview++,I=fe,O=new $(ve),ie=O.parse(I,$e,tt),me(),Y?{meta:{paused:!0}}:ie||{meta:{paused:!1}}},this.paused=function(){return Y},this.pause=function(){Y=!0,O.abort(),I=T(U.chunk)?"":I.substring(O.getCharIndex())},this.resume=function(){ne.streamer._halted?(Y=!1,ne.streamer.parseChunk(I,!0)):setTimeout(ne.resume,3)},this.aborted=function(){return W},this.abort=function(){W=!0,O.abort(),ie.meta.aborted=!0,T(U.complete)&&U.complete(ie),I=""},this.guessLineEndings=function(Je,ve){Je=Je.substring(0,1048576);var ve=new RegExp(S(ve)+"([^]*?)"+S(ve),"gm"),tt=(Je=Je.replace(ve,"")).split("\r"),ve=Je.split(`
291 `),Je=1<ve.length&&ve[0].length<tt[0].length;if(tt.length===1||Je)return`
292 `;for(var vt=0,Ye=0;Ye<tt.length;Ye++)tt[Ye][0]===`
293 `&&vt++;return vt>=tt.length/2?`\r
294 `:"\r"}}function S(U){return U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(U){var I=(U=U||{}).delimiter,O=U.newline,L=U.comments,P=U.step,q=U.preview,X=U.fastMode,G=null,te=!1,ne=U.quoteChar==null?'"':U.quoteChar,re=ne;if(U.escapeChar!==void 0&&(re=U.escapeChar),(typeof I!="string"||-1<_.BAD_DELIMITERS.indexOf(I))&&(I=","),L===I)throw new Error("Comment character same as delimiter");L===!0?L="#":(typeof L!="string"||-1<_.BAD_DELIMITERS.indexOf(L))&&(L=!1),O!==`
295 `&&O!=="\r"&&O!==`\r
296 `&&(O=`
297 `);var K=0,Y=!1;this.parse=function(W,j,ie){if(typeof W!="string")throw new Error("Input must be a string");var he=W.length,me=I.length,ye=O.length,se=L.length,fe=T(P),$e=[],tt=[],ve=[],Je=K=0;if(!W)return ht();if(X||X!==!1&&W.indexOf(ne)===-1){for(var vt=W.split(O),Ye=0;Ye<vt.length;Ye++){if(ve=vt[Ye],K+=ve.length,Ye!==vt.length-1)K+=O.length;else if(ie)return ht();if(!L||ve.substring(0,se)!==L){if(fe){if($e=[],yt(ve.split(I)),Pt(),Y)return ht()}else yt(ve.split(I));if(q&&q<=Ye)return $e=$e.slice(0,q),ht(!0)}}return ht()}for(var xe=W.indexOf(I,K),Ee=W.indexOf(O,K),Oe=new RegExp(S(re)+S(ne),"g"),Me=W.indexOf(ne,K);;)if(W[K]===ne)for(Me=K,K++;;){if((Me=W.indexOf(ne,Me+1))===-1)return ie||tt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:$e.length,index:K}),Ut();if(Me===he-1)return Ut(W.substring(K,Me).replace(Oe,ne));if(ne===re&&W[Me+1]===re)Me++;else if(ne===re||Me===0||W[Me-1]!==re){xe!==-1&&xe<Me+1&&(xe=W.indexOf(I,Me+1));var gt=Mt((Ee=Ee!==-1&&Ee<Me+1?W.indexOf(O,Me+1):Ee)===-1?xe:Math.min(xe,Ee));if(W.substr(Me+1+gt,me)===I){ve.push(W.substring(K,Me).replace(Oe,ne)),W[K=Me+1+gt+me]!==ne&&(Me=W.indexOf(ne,K)),xe=W.indexOf(I,K),Ee=W.indexOf(O,K);break}if(gt=Mt(Ee),W.substring(Me+1+gt,Me+1+gt+ye)===O){if(ve.push(W.substring(K,Me).replace(Oe,ne)),Dt(Me+1+gt+ye),xe=W.indexOf(I,K),Me=W.indexOf(ne,K),fe&&(Pt(),Y))return ht();if(q&&$e.length>=q)return ht(!0);break}tt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:$e.length,index:K}),Me++}}else if(L&&ve.length===0&&W.substring(K,K+se)===L){if(Ee===-1)return ht();K=Ee+ye,Ee=W.indexOf(O,K),xe=W.indexOf(I,K)}else if(xe!==-1&&(xe<Ee||Ee===-1))ve.push(W.substring(K,xe)),K=xe+me,xe=W.indexOf(I,K);else{if(Ee===-1)break;if(ve.push(W.substring(K,Ee)),Dt(Ee+ye),fe&&(Pt(),Y))return ht();if(q&&$e.length>=q)return ht(!0)}return Ut();function yt(Ct){$e.push(Ct),Je=K}function Mt(Ct){var St=0;return St=Ct!==-1&&(Ct=W.substring(Me+1,Ct))&&Ct.trim()===""?Ct.length:St}function Ut(Ct){return ie||(Ct===void 0&&(Ct=W.substring(K)),ve.push(Ct),K=he,yt(ve),fe&&Pt()),ht()}function Dt(Ct){K=Ct,yt(ve),ve=[],Ee=W.indexOf(O,K)}function ht(Ct){if(U.header&&!j&&$e.length&&!te){var St=$e[0],Ot=Object.create(null),Ht=new Set(St);let It=!1;for(let mt=0;mt<St.length;mt++){let jt=St[mt];if(Ot[jt=T(U.transformHeader)?U.transformHeader(jt,mt):jt]){let ge,Fe=Ot[jt];for(;ge=jt+"_"+Fe,Fe++,Ht.has(ge););Ht.add(ge),St[mt]=ge,Ot[jt]++,It=!0,(G=G===null?{}:G)[ge]=jt}else Ot[jt]=1,St[mt]=jt;Ht.add(jt)}It&&console.warn("Duplicate headers found and renamed."),te=!0}return{data:$e,errors:tt,meta:{delimiter:I,linebreak:O,aborted:Y,truncated:!!Ct,cursor:Je+(j||0),renamedHeaders:G}}}function Pt(){P(ht()),$e=[],tt=[]}},this.abort=function(){Y=!0},this.getCharIndex=function(){return K}}function V(U){var I=U.data,O=p[I.workerId],L=!1;if(I.error)O.userError(I.error,I.file);else if(I.results&&I.results.data){var P={abort:function(){L=!0,F(I.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:x,resume:x};if(T(O.userStep)){for(var q=0;q<I.results.data.length&&(O.userStep({data:I.results.data[q],errors:I.results.errors,meta:I.results.meta},P),!L);q++);delete I.results}else T(O.userChunk)&&(O.userChunk(I.results,P,I.file),delete I.results)}I.finished&&!L&&F(I.workerId,I.results)}function F(U,I){var O=p[U];T(O.userComplete)&&O.userComplete(I),O.terminate(),delete p[U]}function x(){throw new Error("Not implemented.")}function Q(U){if(typeof U!="object"||U===null)return U;var I,O=Array.isArray(U)?[]:{};for(I in U)O[I]=Q(U[I]);return O}function D(U,I){return function(){U.apply(I,arguments)}}function T(U){return typeof U=="function"}return _.parse=function(U,I){var O=(I=I||{}).dynamicTyping||!1;if(T(O)&&(I.dynamicTypingFunction=O,O={}),I.dynamicTyping=O,I.transform=!!T(I.transform)&&I.transform,!I.worker||!_.WORKERS_SUPPORTED)return O=null,_.NODE_STREAM_INPUT,typeof U=="string"?(U=(L=>L.charCodeAt(0)!==65279?L:L.slice(1))(U),O=new(I.download?y:b)(I)):U.readable===!0&&T(U.read)&&T(U.on)?O=new k(I):(l.File&&U instanceof File||U instanceof Object)&&(O=new v(I)),O.stream(U);(O=(()=>{var L;return!!_.WORKERS_SUPPORTED&&(L=(()=>{var P=l.URL||l.webkitURL||null,q=a.toString();return _.BLOB_URL||(_.BLOB_URL=P.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; ","(",q,")();"],{type:"text/javascript"})))})(),(L=new l.Worker(L)).onmessage=V,L.id=f++,p[L.id]=L)})()).userStep=I.step,O.userChunk=I.chunk,O.userComplete=I.complete,O.userError=I.error,I.step=T(I.step),I.chunk=T(I.chunk),I.complete=T(I.complete),I.error=T(I.error),delete I.worker,O.postMessage({input:U,config:I,workerId:O.id})},_.unparse=function(U,I){var O=!1,L=!0,P=",",q=`\r
298 `,X='"',G=X+X,te=!1,ne=null,re=!1,K=((()=>{if(typeof I=="object"){if(typeof I.delimiter!="string"||_.BAD_DELIMITERS.filter(function(j){return I.delimiter.indexOf(j)!==-1}).length||(P=I.delimiter),typeof I.quotes!="boolean"&&typeof I.quotes!="function"&&!Array.isArray(I.quotes)||(O=I.quotes),typeof I.skipEmptyLines!="boolean"&&typeof I.skipEmptyLines!="string"||(te=I.skipEmptyLines),typeof I.newline=="string"&&(q=I.newline),typeof I.quoteChar=="string"&&(X=I.quoteChar),typeof I.header=="boolean"&&(L=I.header),Array.isArray(I.columns)){if(I.columns.length===0)throw new Error("Option columns is empty");ne=I.columns}I.escapeChar!==void 0&&(G=I.escapeChar+X),I.escapeFormulae instanceof RegExp?re=I.escapeFormulae:typeof I.escapeFormulae=="boolean"&&I.escapeFormulae&&(re=/^[=+\-@\t\r].*$/)}})(),new RegExp(S(X),"g"));if(typeof U=="string"&&(U=JSON.parse(U)),Array.isArray(U)){if(!U.length||Array.isArray(U[0]))return Y(null,U,te);if(typeof U[0]=="object")return Y(ne||Object.keys(U[0]),U,te)}else if(typeof U=="object")return typeof U.data=="string"&&(U.data=JSON.parse(U.data)),Array.isArray(U.data)&&(U.fields||(U.fields=U.meta&&U.meta.fields||ne),U.fields||(U.fields=Array.isArray(U.data[0])?U.fields:typeof U.data[0]=="object"?Object.keys(U.data[0]):[]),Array.isArray(U.data[0])||typeof U.data[0]=="object"||(U.data=[U.data])),Y(U.fields||[],U.data||[],te);throw new Error("Unable to serialize unrecognized input");function Y(j,ie,he){var me="",ye=(typeof j=="string"&&(j=JSON.parse(j)),typeof ie=="string"&&(ie=JSON.parse(ie)),Array.isArray(j)&&0<j.length),se=!Array.isArray(ie[0]);if(ye&&L){for(var fe=0;fe<j.length;fe++)0<fe&&(me+=P),me+=W(j[fe],fe);0<ie.length&&(me+=q)}for(var $e=0;$e<ie.length;$e++){var tt=(ye?j:ie[$e]).length,ve=!1,Je=ye?Object.keys(ie[$e]).length===0:ie[$e].length===0;if(he&&!ye&&(ve=he==="greedy"?ie[$e].join("").trim()==="":ie[$e].length===1&&ie[$e][0].length===0),he==="greedy"&&ye){for(var vt=[],Ye=0;Ye<tt;Ye++){var xe=se?j[Ye]:Ye;vt.push(ie[$e][xe])}ve=vt.join("").trim()===""}if(!ve){for(var Ee=0;Ee<tt;Ee++){0<Ee&&!Je&&(me+=P);var Oe=ye&&se?j[Ee]:Ee;me+=W(ie[$e][Oe],Ee)}$e<ie.length-1&&(!he||0<tt&&!Je)&&(me+=q)}}return me}function W(j,ie){var he,me;return j==null?"":j.constructor===Date?JSON.stringify(j).slice(1,25):(me=!1,re&&typeof j=="string"&&re.test(j)&&(j="'"+j,me=!0),he=j.toString().replace(K,G),(me=me||O===!0||typeof O=="function"&&O(j,ie)||Array.isArray(O)&&O[ie]||((ye,se)=>{for(var fe=0;fe<se.length;fe++)if(-1<ye.indexOf(se[fe]))return!0;return!1})(he,_.BAD_DELIMITERS)||-1<he.indexOf(P)||he.charAt(0)===" "||he.charAt(he.length-1)===" ")?X+he+X:he)}},_.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=$,_.ParserHandle=w,_.NetworkStreamer=y,_.FileStreamer=v,_.StringStreamer=b,_.ReadableStreamStreamer=k,l.jQuery&&((s=l.jQuery).fn.parse=function(U){var I=U.config||{},O=[];return this.each(function(q){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&l.FileReader)||!this.files||this.files.length===0)return!0;for(var X=0;X<this.files.length;X++)O.push({file:this.files[X],inputElem:this,instanceConfig:s.extend({},I)})}),L(),this;function L(){if(O.length===0)T(U.complete)&&U.complete();else{var q,X,G,te,ne=O[0];if(T(U.before)){var re=U.before(ne.file,ne.inputElem);if(typeof re=="object"){if(re.action==="abort")return q="AbortError",X=ne.file,G=ne.inputElem,te=re.reason,void(T(U.error)&&U.error({name:q},X,G,te));if(re.action==="skip")return void P();typeof re.config=="object"&&(ne.instanceConfig=s.extend(ne.instanceConfig,re.config))}else if(re==="skip")return void P()}var K=ne.instanceConfig.complete;ne.instanceConfig.complete=function(Y){T(K)&&K(Y,ne.file,ne.inputElem),P()},_.parse(ne.file,ne.instanceConfig)}}function P(){O.splice(0,1),L()}}),c&&(l.onmessage=function(U){U=U.data,_.WORKER_ID===void 0&&U&&(_.WORKER_ID=U.workerId),typeof U.input=="string"?l.postMessage({workerId:_.WORKER_ID,results:_.parse(U.input,U.config),finished:!0}):(l.File&&U.input instanceof File||U.input instanceof Object)&&(U=_.parse(U.input,U.config))&&l.postMessage({workerId:_.WORKER_ID,results:U,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(b.prototype=Object.create(b.prototype)).constructor=b,(k.prototype=Object.create(g.prototype)).constructor=k,_})}(So)),So.exports}var Cve=wve();const gc=dm(Cve),kve={class:"el-upload__text"},Bve={class:"fct-import-map-table-wrap"},xve={class:"fct-import-map-heading"},Sve={class:"fct-import-map-table"},Fve={width:"50%"},$ve={class:"dialog-footer"},Eve={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=Yt().ctx,l=M(!1),s=M(),i=M(),c=M([]),p=M([]),f=M({}),_=M({}),g=M(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const b=M(!1),k=Np(Ge.get("shop.decimal_separator","")),w=G=>J7(G,k.thousand),S=G=>{G&&gc.parse(G,{header:!0,complete:function(te){p.value=te.data,c.value=te.meta.fields,g.value=c.value.includes("Type")&&c.value.includes("Parent"),V(),g.value&&Q(),b.value=!0}})},$=()=>{_.value={},c.value=[],p.value=[],b.value=!1,g.value=!1},V=()=>{const G=[],te=[];let ne=0;c.value.forEach(re=>{let K=null,Y=null;const W=re.toString();for(const[j,ie]of y.entries())if(W.toLocaleLowerCase().startsWith(ie)){const he=re.toString().match(/ \d+ /g);if(Array.isArray(he)&&he.length===1){let me=he[0];ne=me>ne?me:ne,K=re.toString().replace(he[0]," %d "),Y=re.toString().replace(he[0]," ");break}}K!=null?G.includes(K)||(G.push(K),te.push({title:Y,value:K})):te.push({title:re,value:re})}),_.value=te,v=ne},F=()=>window.fluentCartRestVars.rest.url+"/files/upload",x={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"]},Q=()=>{for(const[G,te]of Object.entries(x))if(f.value[G]){for(const ne of te)if(c.value.includes(ne)){f.value[G].value=ne;break}}},D=G=>G?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[G.trim().toLowerCase()]||G:"",T=G=>{if(!G)return"";const te=G.split(",").map(ne=>ne.trim().toLowerCase());return te.includes("variation")?"variation":te.includes("variable")?"variable":te.includes("subscription")?"subscription":te.includes("simple")?"simple":te[0]||""},U=(G=!0)=>{const te=[],ne={},re=f.value,K={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"},Y=j=>{const ie=[];for(let he=1;he<=10;he++){const me=`Attribute ${he} name`,ye=`Attribute ${he} value(s)`;j[me]&&j[ye]&&ie.push(j[ye])}return ie.join(" - ")},W=j=>j==="1"||j===1?"published":j==="0"||j===0?"draft":j||"published";p.value.forEach(j=>{var tt,ve,Je,vt,Ye,xe,Ee,Oe,Me,gt,yt,Mt,Ut,Dt,ht,Pt,Ct,St,Ot,Ht;const ie=T(j.Type);if(ie!=="simple"&&ie!=="variable"&&ie!=="subscription")return;const he={};he._cid=Al(),he.post_title=j[(tt=re.post_title)==null?void 0:tt.value]||"",he.post_name=j[(ve=re.post_name)==null?void 0:ve.value]||he.post_title,he.ID=j[(Je=re.post_id)==null?void 0:Je.value]||"",he.post_content=j[(vt=re.post_content)==null?void 0:vt.value]||"",he.post_excerpt=j[(Ye=re.post_excerpt)==null?void 0:Ye.value]||"",he.post_status=W(j[(xe=re.post_status)==null?void 0:xe.value]);const me={variation_type:ie==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},ye=j[(Ee=re.images)==null?void 0:Ee.value]||"",se=[];ye&&ye.split(",").map(It=>It.trim()).filter(Boolean).forEach(It=>{const mt=It.split("/").pop().split("?")[0]||"image";se.push({id:0,url:It,title:mt})}),he.detail=me,he.gallery=se,he.variants=[];const fe=j[(Oe=re.categories)==null?void 0:Oe.value]||"";if(fe?he.categories=fe.split(",").map(It=>It.trim()).filter(Boolean):he.categories=[],ie==="simple"||ie==="subscription"){const It=w(j[(Me=re.item_price)==null?void 0:Me.value]||""),mt=w(j[(gt=re.compare_price)==null?void 0:gt.value]||""),jt=j[(yt=re.sku)==null?void 0:yt.value]||"",ge=ie==="subscription"?"subscription":j[(Mt=re.payment_type)==null?void 0:Mt.value]||"onetime",Fe=D(j[(Ut=re.repeat_interval)==null?void 0:Ut.value]||""),nt=j[(Dt=re.trial_days)==null?void 0:Dt.value]||"",bt=j[(ht=re.installment)==null?void 0:ht.value]||"",Bt=j[(Pt=re.installment_count)==null?void 0:Pt.value]||"",Wt=j[(Ct=re.manage_setup_fee)==null?void 0:Ct.value]||"",_t=j[(St=re.signup_fee_name)==null?void 0:St.value]||"",la=w(j[(Ot=re.signup_fee)==null?void 0:Ot.value]||"");(It||he.post_title)&&he.variants.push({_cid:Al(),variation_title:he.post_title,sku:jt,item_price:It,compare_price:mt,other_info:{...K,payment_type:ge,repeat_interval:Fe,trial_days:nt,installment:bt==="yes"?"yes":"no",times:Bt,manage_setup_fee:Wt==="yes"?"yes":"no",signup_fee_name:_t,signup_fee:la},media:[]})}const $e=j[(Ht=re.sku)==null?void 0:Ht.value]||"";ie==="variable"&&$e&&(ne[$e]=he),te.push(he)}),p.value.forEach(j=>{var gt,yt,Mt,Ut,Dt,ht,Pt,Ct,St,Ot,Ht,It;if(T(j.Type)!=="variation")return;const ie=j.Parent;if(!ie||!ne[ie])return;const he=Y(j),me=w(j[(gt=re.item_price)==null?void 0:gt.value]||""),ye=w(j[(yt=re.compare_price)==null?void 0:yt.value]||""),se=j[(Mt=re.images)==null?void 0:Mt.value]||"",fe=[];se&&se.split(",").map(mt=>mt.trim()).filter(Boolean).forEach(mt=>{const jt=mt.split("/").pop().split("?")[0]||"image";fe.push({id:0,url:mt,title:jt})});const $e=j[(Ut=re.sku)==null?void 0:Ut.value]||"",tt=j[(Dt=re.payment_type)==null?void 0:Dt.value]||"onetime",ve=D(j[(ht=re.repeat_interval)==null?void 0:ht.value]||""),Je=j[(Pt=re.trial_days)==null?void 0:Pt.value]||"",vt=j[(Ct=re.installment)==null?void 0:Ct.value]||"",Ye=j[(St=re.installment_count)==null?void 0:St.value]||"",xe=j[(Ot=re.manage_setup_fee)==null?void 0:Ot.value]||"",Ee=j[(Ht=re.signup_fee_name)==null?void 0:Ht.value]||"",Oe=w(j[(It=re.signup_fee)==null?void 0:It.value]||""),Me={_cid:Al(),variation_title:he||j.Name||"",sku:$e,item_price:me,compare_price:ye,other_info:{...K,payment_type:tt,repeat_interval:ve,trial_days:Je,installment:vt==="yes"?"yes":"no",times:Ye,manage_setup_fee:xe==="yes"?"yes":"no",signup_fee_name:Ee,signup_fee:Oe},media:fe};ne[ie].variants.push(Me)}),X("onDataPopulated",{products:te,concat:G})},I=(G=!0)=>{if(g.value)return U(G);const te=[];p.value.forEach(ne=>{var Ye,xe,Ee,Oe,Me,gt,yt,Mt,Ut,Dt,ht,Pt;const re={};re._cid=Al();const K=f.value;re.post_title=ne[K.post_title.value]??"",re.post_name=ne[K.post_name.value]??re.post_title,re.ID=ne[K.post_id.value]??"",re.post_content=ne[K.post_content.value]??"",re.post_excerpt=ne[K.post_excerpt.value]??"",re.post_status=ne[(Ye=K.post_status)==null?void 0:Ye.value]||"published",re.comment_status="close";const Y=ne[(xe=K.images)==null?void 0:xe.value]||"",W=[];Y&&Y.split(",").map(Ct=>Ct.trim()).filter(Boolean).forEach(Ct=>{const St=Ct.split("/").pop().split("?")[0]||"image";W.push({id:0,url:Ct,title:St})});const j=ne[(Ee=K.categories)==null?void 0:Ee.value]||"";j?re.categories=j.split(",").map(Ct=>Ct.trim()).filter(Boolean):re.categories=[];const ie=ne[(Oe=K.sku)==null?void 0:Oe.value]||"",he=ne[(Me=K.payment_type)==null?void 0:Me.value]||"onetime",me=ne[(gt=K.repeat_interval)==null?void 0:gt.value]||"",ye=ne[(yt=K.trial_days)==null?void 0:yt.value]||"",se=ne[(Mt=K.installment)==null?void 0:Mt.value]||"",fe=ne[(Ut=K.installment_count)==null?void 0:Ut.value]||"",$e=ne[(Dt=K.manage_setup_fee)==null?void 0:Dt.value]||"",tt=ne[(ht=K.signup_fee_name)==null?void 0:ht.value]||"",ve=w(ne[(Pt=K.signup_fee)==null?void 0:Pt.value]||""),Je={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},vt={description:"",payment_type:he,times:fe,repeat_interval:me,trial_days:ye,billing_summary:"",manage_setup_fee:$e==="yes"?"yes":"no",signup_fee_name:tt,signup_fee:ve,setup_fee_per_item:"no",installment:se==="yes"?"yes":"no"};re.gallery=W,re.variants=[];for(let Ct=1;Ct<=v;Ct++){const St={};["variation_title","item_price","compare_price"].forEach(Ot=>{var It;const Ht=((It=K[Ot])==null?void 0:It.value)??"";if(Ht.length>0){const mt=Ht.replace("%d",Ct.toString()),jt=ne[mt];St[Ot]=Ot==="variation_title"?jt:w(jt)}}),P(St)&&(St._cid=Al(),St.sku=ie,St.other_info={...vt},St.media=[],re.variants.push(St))}re.variants.length>0?(Je.variation_type="simple_variations",re.detail=Je,te.push(re)):P(re)&&(re.variants.push({_cid:Al(),variation_title:"",sku:ie,item_price:0,compare_price:0,other_info:{...vt},media:[]}),re.detail=Je,te.push(re))}),X("onDataPopulated",{products:te,concat:G})},O=()=>{l.value=!1,s.value=[],i.value=null,$()},L=(G=!0)=>{I(G),O()},P=G=>{let te=!1;for(const[ne,re]of Object.entries(G))if(typeof re!==null&&typeof re<"u"&&(Array.isArray(re)&&re.length>0||re.toString().length>0)){te=!0;break}return te};Ie(()=>{f.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 q=()=>{const G=[{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":""}],te=gc.unparse(G),ne=new Blob([te],{type:"text/csv;charset=utf-8;"}),re=URL.createObjectURL(ne),K=document.createElement("a");K.href=re,K.download="fluent-cart-sample-import.csv",document.body.appendChild(K),K.click(),document.body.removeChild(K),URL.revokeObjectURL(re)},X=t;return(G,te)=>{const ne=C("el-button"),re=C("el-upload"),K=C("el-option"),Y=C("el-select"),W=C("el-dialog");return r(),h(H,null,[n(ne,{onClick:te[0]||(te[0]=j=>l.value=!0)},{default:d(()=>[R(m(G.$t("Import")),1)]),_:1}),n(W,{modelValue:l.value,"onUpdate:modelValue":te[4]||(te[4]=j=>l.value=j),"append-to-body":!0,title:G.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:d(()=>[b.value?B("",!0):(r(),E(re,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":te[1]||(te[1]=j=>s.value=j),drag:"",action:F(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":j=>{$(),i.value=j,S(j==null?void 0:j.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:d(()=>[n(Ze,{circle:"",bg:"primary",soft:""},{default:d(()=>[n(J,{name:"Upload"})]),_:1}),o("div",kve,[R(m(G.$t("Drag & Drop or"))+" ",1),o("em",null,m(G.$t("Browse/Upload")),1),R(" "+m(G.$t("Files"))+" ",1),o("span",null,m(A(u)("Any Format upto %s",A(Qt).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),b.value?B("",!0):(r(),E(ne,{key:1,onClick:q,link:""},{default:d(()=>[n(J,{name:"Download"}),R(" "+m(G.$t("Download a Sample CSV File")),1)]),_:1})),b.value?(r(),h(H,{key:2},[o("div",Bve,[o("h4",xve,m(G.$t("Map Columns")),1),o("table",Sve,[o("thead",null,[o("tr",null,[o("th",null,m(G.$t("Products Fields")),1),o("th",null,m(G.$t("CSV Headers")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(f.value,(j,ie)=>(r(),h("tr",null,[o("td",null,m(j.title),1),o("td",Fve,[n(Y,{modelValue:j.value,"onUpdate:modelValue":he=>j.value=he,filterable:"",clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,he=>(r(),E(K,{key:he.value,label:he.title,value:he.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",$ve,[n(ne,{onClick:te[2]||(te[2]=j=>L())},{default:d(()=>[R(m(G.$t("Add Products")),1)]),_:1}),n(ne,{onClick:te[3]||(te[3]=j=>L(!1))},{default:d(()=>[R(m(G.$t("Clear and Add Products")),1)]),_:1})])],64)):B("",!0)]),_:1},8,["modelValue","title"])],64)}}};class Uve extends Ed{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=Al(),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(([s])=>!s.startsWith("variants.")).map(([,s])=>s).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const s=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(s))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const s=`variants.${a}.`;return Object.entries(l.fields).filter(([c])=>c.startsWith(s)).map(([,c])=>c).join("; ")}hasFieldError(t,a){var s;const l=this.data.productErrors.get(t);return!!((s=l==null?void 0:l.fields)!=null&&s[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}chunkArray(t,a){const l=[];for(let s=0;s<t.length;s+=a)l.push(t.slice(s,s+a));return l}async saveProducts(){var s,i;const t=this.data.products,a=t.filter(c=>!this.data.savedIds.has(c._cid));if(a.length===0){z.error(u("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 f of l){const _=f.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 ue.post("products/bulk-insert",{products:f});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(b=>b._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=(s=g==null?void 0:g.data)==null?void 0:s.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 b of _)this.data.productErrors.set(b,{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:c,errors:p}=this.data.saveProgress;p.length===0?z.success(`${c.length} product(s) created successfully`):c.length>0?z.info(`${c.length} product(s) created, ${p.length} error(s)`):z.error(u("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 ue.delete(`products/${t.ID}`)}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to delete product from server";z.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=Al(),a.post_title=a.post_title?a.post_title+" (Copy)":"",a.variants&&Array.isArray(a.variants)&&a.variants.forEach(s=>{s.sku="",s._cid=Al()});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=Al(),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((c,p)=>i.has(p)),l.variants.forEach(c=>{c.sku="",c._cid=Al()})}const s=this.data.products.indexOf(t);this.data.products.splice(s+1,0,l)}duplicateVariant(t,a){const l=JSON.parse(JSON.stringify(a));l._cid=Al(),l.variation_title=l.variation_title?l.variation_title+" (Copy)":"",l.sku="";const s=t.variants.indexOf(a);t.variants.splice(s+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 s;const l=[];for(const i of t){const c=a?`${a} > ${i.label}`:i.label;l.push({label:c,value:c}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,c))}return l}async fetchCategories(){try{const a=(await ue.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(s=>s.name==="product-categories");l!=null&&l.terms&&(this.data.categoryOptions=this.flattenCategoryTree(l.terms))}catch{}}}const Ft=Uve.init(),Ive={class:"max-w-full overflow-x-scroll"},Qve={class:"relative"},Dve={key:0,class:"bulk-checkbox-cell"},Vve=["onMousedown","onTouchstart"],uf={__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=Rf(),s=Xr("table"),i=M(null);let c=null;Ie(()=>{ke(()=>{const g=s.value.querySelectorAll("th"),y=l["header-first"]?1:0;Array.from(g).forEach((v,b)=>{const k=b-y;k<0||k>=p.columns.length||(p.columns[k].width=v.offsetWidth,p.columns[k].minWidth||(p.columns[k].minWidth=v.offsetWidth))}),c=new ResizeObserver(()=>{s.value.style.setProperty("--resizer-height",s.value.offsetHeight+"px");const v=s.value.querySelector("th");v&&s.value.style.setProperty("--header-height",v.offsetHeight+"px")}),c.observe(s.value)})}),vl(()=>{c&&c.disconnect()});const p=e,f=N(()=>{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,b=p.columns[y].width,k=p.columns[y].minWidth||50;i.value=y;const w=$=>{const V=b+($.clientX-v);V>=k&&(p.columns[y].width=V)},S=()=>{i.value=null,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S),a("resize-end")};document.addEventListener("mousemove",w),document.addEventListener("mouseup",S)};return(g,y)=>(r(),h("div",Ive,[o("div",{class:de(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[o("div",Qve,[o("table",{id:"tb",ref_key:"table",ref:s,style:ua({tableLayout:"fixed",width:f.value+"px"})},[o("thead",null,[o("tr",null,[g.$slots["header-first"]?(r(),h("th",Dve,[ba(g.$slots,"header-first")])):B("",!0),(r(!0),h(H,null,ae(e.columns,(v,b)=>(r(),h("th",{class:de({"sticky-col":b===0,"sticky-col sticky-col-right":b===e.columns.length-1&&e.stickyLast}),style:ua({width:v.width+"px",zIndex:b===0||b===e.columns.length-1&&e.stickyLast?70:e.columns.length-b+50,left:b===0&&g.$slots["header-first"]?"40px":b===0?"0px":void 0}),key:v.key||b},[b===e.columns.length-1?ba(g.$slots,"header-last",{key:0},()=>[R(m(v.title),1)]):(r(),h(H,{key:1},[R(m(v.title),1)],64)),b<e.columns.length-1?(r(),h("span",{key:2,class:de(["resizer",{"is-active":i.value===b}]),onMousedown:k=>_(k,b),onTouchstart:k=>_(k,b)},null,42,Vve)):B("",!0)],6))),128))])]),o("tbody",null,[ba(g.$slots,"default")])],4)])],34)]))}},Tve={class:"bulk-setup-fee-badge"},Mve={key:1,class:"text-gray-300 text-sm flex justify-center"},qo={__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,s)=>{var c;const i=C("el-tooltip");return e.variant?(r(),E(Yl,{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":s[0]||(s[0]=p=>{e.variant.item_price=p,a("change")})},oa({_:2},[((c=e.variant.other_info)==null?void 0:c.manage_setup_fee)==="yes"&&e.variant.other_info.signup_fee?{name:"suffix",fn:d(()=>[n(i,{content:(e.variant.other_info.signup_fee_name||l.$t("Setup fee"))+": "+A(Gt)(e.variant.other_info.signup_fee,!0),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o("span",Tve,"+ "+m(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["error-class","model-value","placeholder","disabled"])):(r(),h("span",Mve,"—"))}}},Lve=["disabled"],Rve={key:0,class:"fct-bulk-sub-count"},Ove={class:"fct-bulk-sub-popover-body"},Hve={class:"fct-bulk-sub-popover-title"},Pve={class:"fct-bulk-sub-section"},Nve={class:"fct-bulk-sub-row"},Kve={class:"fct-bulk-sub-row"},Gve={class:"fct-bulk-sub-label"},jve={class:"fct-bulk-sub-row"},zve={class:"fct-bulk-sub-label"},qve=["innerHTML"],Yve={class:"fct-bulk-sub-section"},Wve={class:"fct-bulk-sub-row"},Jve={class:"fct-bulk-sub-row"},Xve={class:"fct-bulk-sub-label"},Zve={class:"fct-bulk-sub-row"},ege={class:"fct-bulk-sub-label"},tge={class:"fct-bulk-sub-footer"},or=2,age={__name:"BulkSubscriptionPopover",props:{variant:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:["changed"],setup(e,{emit:t}){const a=e,l=t,s=Yt().ctx,i=Ge.get(),c=Ge.get("app_config.isProActive"),p=M(!1);N(()=>{var F;return((F=i==null?void 0:i.shop)==null?void 0:F.currency_sign)||"$"});const f=N(()=>{var F;return((F=a.variant)==null?void 0:F.other_info)||{}}),_=N(()=>f.value.payment_type==="subscription"),g=N(()=>f.value.installment==="yes"),y=N(()=>Number(f.value.times)||1),v=N(()=>{var x;const F=Number((x=a.variant)==null?void 0:x.item_price)||0;return g.value?F*y.value:F}),b=N(()=>{const F=[];if(g.value&&F.push(s.$t("Installment")+": "+y.value+"x"),f.value.manage_setup_fee==="yes"){const x=f.value.signup_fee_name||s.$t("Setup fee"),Q=f.value.signup_fee||0;F.push(s.$t("Setup fee")+": "+x+" ("+Gt(Q,!0)+")")}return F.length>0?F.join(`
300 `):s.$t("Subscription settings")}),k=F=>{F==="no"?a.variant.other_info.times="":w(),l("changed")},w=()=>{const F=Number(a.variant.other_info.times);(!Number.isFinite(F)||F<or)&&(a.variant.other_info.times=or)},S=F=>{F==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},$=()=>{l("changed")},V=()=>{p.value=!1};return(F,x)=>{const Q=C("el-checkbox"),D=C("el-tooltip"),T=C("el-input"),U=C("el-switch"),I=C("el-button"),O=C("el-popover");return r(),E(D,{content:b.value,placement:"top",disabled:!_.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:d(()=>[n(O,{visible:p.value,"onUpdate:visible":x[6]||(x[6]=L=>p.value=L),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!_.value,"popper-class":"bulk-sub-popover"},{reference:d(()=>[o("button",{class:de(["fc-bulk-sub-icon-btn",{"is-active":_.value,"is-configured":_.value&&(g.value||f.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!_.value,onClick:x[0]||(x[0]=Ne(()=>{},["prevent"]))},[x[7]||(x[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",Rve,m(y.value),1)):B("",!0)],10,Lve)]),default:d(()=>[o("div",Ove,[o("h4",Hve,m(F.$t("Subscription Settings")),1),o("div",Pve,[o("div",Nve,[n(Q,{"true-value":"yes","false-value":"no",label:F.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":x[1]||(x[1]=L=>e.variant.other_info.installment=L),disabled:!A(c)||e.disabled,onChange:k},null,8,["label","modelValue","disabled"]),A(c)?B("",!0):(r(),E(D,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(m(F.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),f.value.installment==="yes"?(r(),h(H,{key:0},[o("div",Kve,[o("label",Gve,m(F.$t("Installment Count")),1),n(T,{type:"number",min:or,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":x[2]||(x[2]=L=>e.variant.other_info.times=L),modelModifiers:{number:!0},placeholder:F.$t("Count"),style:{width:"100px"},onInput:$,onChange:w},null,8,["modelValue","placeholder"])]),o("div",jve,[o("span",zve,m(F.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:A(Gt)(v.value,!0)},null,8,qve)])],64)):B("",!0)]),o("div",Yve,[o("div",Wve,[n(U,{"active-text":F.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":x[3]||(x[3]=L=>e.variant.other_info.manage_setup_fee=L),"active-value":"yes","inactive-value":"no",disabled:!A(c)||e.disabled,size:"small",onChange:S},null,8,["active-text","modelValue","disabled"]),A(c)?B("",!0):(r(),E(D,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(m(F.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),f.value.manage_setup_fee==="yes"?(r(),h(H,{key:0},[o("div",Jve,[o("label",Xve,m(F.$t("Label")),1),n(T,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":x[4]||(x[4]=L=>e.variant.other_info.signup_fee_name=L),placeholder:F.$t("e.g. Initial Setup"),onInput:$},null,8,["modelValue","placeholder"])]),o("div",Zve,[o("label",ege,m(F.$t("Amount")),1),n(Yl,{size:"small","model-value":e.variant.other_info.signup_fee,placeholder:F.$t("Amount"),"onUpdate:modelValue":x[5]||(x[5]=L=>{e.variant.other_info.signup_fee=L,$()})},null,8,["model-value","placeholder"])])],64)):B("",!0)]),o("div",tge,[n(I,{size:"small",type:"primary",onClick:V},{default:d(()=>[R(m(F.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},lge={key:0,class:"flex items-center"},sge={key:1,class:"text-gray-300 text-sm flex justify-center"},Yo={__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,s=()=>{var i;return(i=a.variant)==null?void 0:i.other_info};return(i,c)=>{const p=C("el-option"),f=C("el-select");return e.variant&&s()?(r(),h("div",lge,[n(f,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.payment_type=_),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:c[1]||(c[1]=_=>l("payment-type-change",e.variant))},{default:d(()=>[n(p,{label:i.$t("One Time"),value:"onetime"},null,8,["label"]),n(p,{label:i.$t("Subscription"),value:"subscription"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"]),n(age,{variant:e.variant,disabled:e.disabled,onChanged:c[2]||(c[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),h("span",sge,"—"))}}},nge={key:1,class:"text-gray-300 text-sm flex justify-center"},Wo={__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,s=()=>{var i,c;return((c=(i=a.variant)==null?void 0:i.other_info)==null?void 0:c.payment_type)==="subscription"};return(i,c)=>{const p=C("el-option"),f=C("el-select");return e.variant&&s()?(r(),E(f,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.repeat_interval=_),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:c[1]||(c[1]=_=>l("change"))},{default:d(()=>[n(p,{label:i.$t("Yearly"),value:"yearly"},null,8,["label"]),n(p,{label:i.$t("Half Yearly"),value:"half_yearly"},null,8,["label"]),n(p,{label:i.$t("Quarterly"),value:"quarterly"},null,8,["label"]),n(p,{label:i.$t("Monthly"),value:"monthly"},null,8,["label"]),n(p,{label:i.$t("Weekly"),value:"weekly"},null,8,["label"]),n(p,{label:i.$t("Daily"),value:"daily"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"])):(r(),h("span",nge,"—"))}}},oge={key:1,class:"text-gray-300 text-sm flex justify-center"},Jo={__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,s=()=>{var i,c;return((c=(i=a.variant)==null?void 0:i.other_info)==null?void 0:c.payment_type)==="subscription"};return(i,c)=>{const p=C("el-input");return e.variant&&s()?(r(),E(p,{key:0,class:de(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":c[0]||(c[0]=f=>e.variant.other_info.trial_days=f),placeholder:"0",disabled:e.disabled,onChange:c[1]||(c[1]=f=>l("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),h("span",oge,"—"))}}},ige={key:1,class:"text-gray-300 text-sm flex justify-center"},Xo={__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,s)=>e.variant?(r(),E(Yl,{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":s[0]||(s[0]=i=>{e.variant.compare_price=i,a("change")})},null,8,["error-class","model-value","placeholder","disabled"])):(r(),h("span",ige,"—"))}},cf={__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=s=>{a("update:modelValue",s),a("change",s)};return(s,i)=>{const c=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:s.$t("Select or type..."),disabled:e.disabled,"onUpdate:modelValue":l},{default:d(()=>[(r(!0),h(H,null,ae(e.options,f=>(r(),E(c,{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},rge=["textContent"],dge={key:1,class:"fct-bulk-editor-placeholder"},Zo={__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:m(e.value)},null,8,rge)):(r(),h("span",dge,m(e.placeholder),1))]))}};function Af(){const e=M(new Set),t=M(null),a=M(!1),l=(y,v,b)=>{if(v.shiftKey&&t.value!==null){const w=b.indexOf(t.value),S=b.indexOf(y);if(w!==-1&&S!==-1){const $=Math.min(w,S),V=Math.max(w,S),F=new Set(e.value);for(let x=$;x<=V;x++)F.add(b[x]);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}},s=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)},c=()=>{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 f=y=>e.value.has(y),_=N(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:l,toggleSelectAll:s,selectAll:i,deselectAll:c,toggleLinkMode:p,isSelected:f,selectedCount:_,pruneStaleKeys:y=>{const v=new Set(y);let b=!1;const k=new Set;for(const w of e.value)v.has(w)?k.add(w):b=!0;b&&(e.value=k),t.value&&!v.has(t.value)&&(t.value=null)}}}const uge={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},pf={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]}}},cge={...pf,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}}},Age={...pf,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 ff(e,t,a,l,s,i,c){const p=c[e];if(p)for(const f of l){if(f===a)continue;const _=s(f);if(!_)continue;const g=p[_.type];g&&(g.set(_.data,t),i&&i(_.product))}}const pge={class:"fct-bulk-insert-page fct-layout-width"},fge={class:"fct-btn-group sm justify-end"},mge={class:"filter-popover-item"},hge={class:"filter-popover-title"},_ge={key:0,"aria-hidden":"true"},vge=["colspan"],gge=["onClick"],yge=["onClick"],bge={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},wge={class:"flex items-center"},Cge=["onClick","title"],kge={key:0,class:"bulk-collapse-count"},Bge=["title"],xge=["title"],Sge={class:"bulk-status-icon is-error"},Fge={key:0,class:"fct-bulk-sku-cell"},$ge={key:1,class:"text-gray-300 text-sm flex justify-center"},Ege={key:1,class:"fct-bulk-media-cell"},Uge={key:2,class:"fct-bulk-categories-cell"},Ige={key:3,class:"fct-bulk-desc-cell"},Qge={key:4,class:"fct-bulk-short-desc-cell"},Dge={key:5,class:"fct-bulk-status-cell"},Vge={key:6,class:"fct-bulk-product-type-cell"},Tge={key:7,class:"fct-bulk-product-type-cell"},Mge={key:8,class:"fct-bulk-pricing-type-cell"},Lge={key:9,class:"fct-bulk-pricing-type-cell"},Rge={key:10,class:"fct-bulk-payment-type-cell"},Oge={key:11,class:"fct-bulk-interval-cell"},Hge={key:12,class:"fct-bulk-trial-days-cell"},Pge={key:13,class:"fct-bulk-best-price-cell"},Nge={key:14,class:"fct-bulk-compare-price-cell"},Kge={key:15,class:"fct-bulk-qty-cell !pl-5"},Gge={key:16,class:"fct-bulk-stock-cell"},jge={key:1,class:"text-gray-300 text-sm pl-5"},zge={class:"fct-btn-group xs justify-end"},qge=["href","title"],Yge={key:0,class:"bulk-variants-block-row"},Wge=["colspan"],Jge={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Xge=["onClick"],Zge={class:"bulk-checkbox-cell"},e1e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},t1e={class:"flex items-center gap-1 pl-4"},a1e={class:"bulk-status-icon is-error"},l1e={key:0,class:"fct-bulk-sku-cell"},s1e={key:1,class:"fct-bulk-media-cell"},n1e={key:2},o1e={key:3},i1e={key:4},r1e={key:5},d1e={key:6},u1e={key:7},c1e={key:8},A1e={key:9},p1e={key:10},f1e={key:11},m1e={key:12},h1e={key:13,class:"text-center"},_1e={key:14},v1e={key:1,class:"text-gray-300 text-sm flex justify-center"},g1e={class:"fct-btn-group sm justify-end"},y1e={class:"bulk-add-variant-row"},b1e=["colspan"],w1e={class:"sticky left-0 inline-block pl-6"},C1e={key:1,"aria-hidden":"true"},k1e=["colspan"],ir=43,B1e=10,x1e=800,yc=100,S1e={__name:"BulkInsert",setup(e){const{options:t,products:a}=Ft.data,l=ge=>{var Fe;return((Fe=ge==null?void 0:ge.detail)==null?void 0:Fe.variation_type)==="simple"},s=N(()=>Ft.data.saving),i=N(()=>Ft.data.saveProgress),c=N(()=>{const ge=Ft.data.saveProgress;return ge.total?Math.round(ge.completed/ge.total*100):0}),p=()=>{Ft.saveProducts()},f=ge=>Ft.isSaving(ge._cid),_=ge=>Ft.isSaved(ge._cid),g=ge=>Ft.isRowDisabled(ge._cid),y=ge=>Ft.hasError(ge._cid),v=ge=>Ft.getError(ge._cid),b=ge=>Ft.hasProductLevelError(ge._cid),k=(ge,Fe)=>Ft.hasVariantError(ge._cid,Fe),w=(ge,Fe)=>Ft.getVariantError(ge._cid,Fe),S=(ge,Fe)=>Ft.hasFieldError(ge._cid,Fe),$=(ge,Fe,nt)=>Ft.hasVariantFieldError(ge._cid,Fe,nt),V=async ge=>{const Fe=ge.post_title||P.$t("Untitled product"),nt=Array.isArray(ge.variants)?ge.variants.length:0,bt=Ft.isSaved(ge._cid);let Bt=nt>0?P.$t('This will remove "%1$s" and its %2$s variant(s).',Fe,nt):P.$t('This will remove "%1$s".',Fe);bt&&(Bt+=" "+P.$t("This product was already saved and will be permanently deleted."));try{await xl.confirm(Bt,P.$t("Remove Product"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}await Ft.removeProduct(ge)},F=(ge,Fe)=>{const nt=Fe.variation_title||P.$t("Untitled variant");xl.confirm(P.$t('This will remove the variant "%1$s".',nt),P.$t("Remove Variant"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),confirmButtonClass:"el-button--small",cancelButtonClass:"el-button--small",type:"warning"}).then(()=>{Ft.removeVariant(ge,Fe)}).catch(()=>{})},x=ge=>Ft.duplicateProduct(ge),Q=(ge,Fe)=>Ft.duplicateVariant(ge,Fe),D=()=>{const ge=[];for(const Fe of a){const nt=`p:${Fe._cid}`,bt=Y.value.has(nt),Bt=[];Fe.variants&&Fe.variants.forEach((Wt,_t)=>{Y.value.has(`v:${Fe._cid}:${_t}`)&&Bt.push(_t)}),!(!bt&&Bt.length===0)&&(bt&&Bt.length===0?ge.push({product:Fe,type:"full"}):!bt&&Bt.length>0?ge.push({product:Fe,type:"variants-only",variantIndexes:Bt}):ge.push({product:Fe,type:"partial",variantIndexes:Bt}))}return ge},T=()=>{const ge=D();if(!ge.length)return;const Fe=ge.filter(_t=>_t.type==="full").length,nt=ge.filter(_t=>_t.type==="partial").length,Bt=ge.filter(_t=>_t.type==="variants-only").reduce((_t,la)=>_t+la.variantIndexes.length,0),Wt=[];Fe>0&&Wt.push(`${Fe} product(s) with all variants`),nt>0&&Wt.push(`${nt} product(s) with selected variants`),Bt>0&&Wt.push(`${Bt} variant(s)`),xl.confirm(P.$t("Duplicate %s?").replace("%s",Wt.join(", ")),P.$t("Bulk Duplicate"),{confirmButtonText:P.$t("Duplicate"),cancelButtonText:P.$t("Cancel"),type:"info"}).then(()=>{for(const _t of ge)if(_t.type==="full")Ft.duplicateProduct(_t.product);else if(_t.type==="variants-only")for(const la of _t.variantIndexes){const sa=_t.product.variants[la];sa&&Ft.duplicateVariant(_t.product,sa)}else _t.type==="partial"&&Ft.duplicateProductWithVariants(_t.product,_t.variantIndexes);he()}).catch(()=>{})},U=async()=>{const ge=[],Fe=[];for(const _t of a){const la=`p:${_t._cid}`;if(Y.value.has(la)){ge.push(_t);continue}const Nt=[];_t.variants&&_t.variants.forEach((ia,el)=>{Y.value.has(`v:${_t._cid}:${el}`)&&Nt.push(ia)}),Nt.length>0&&Fe.push({product:_t,variants:Nt})}if(!ge.length&&!Fe.length)return;const nt=ge.filter(_t=>Ft.isSaved(_t._cid)).length,bt=Fe.reduce((_t,la)=>_t+la.variants.length,0),Bt=[];ge.length>0&&Bt.push(`${ge.length} product(s)`),bt>0&&Bt.push(`${bt} variant(s)`);let Wt=P.$t("Remove %s?").replace("%s",Bt.join(" and "));nt>0&&(Wt+=" "+P.$t("%s already saved will be permanently deleted.").replace("%s",`${nt}`));try{await xl.confirm(Wt,P.$t("Bulk Remove"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}for(const _t of ge)await Ft.removeProduct(_t);for(const{product:_t,variants:la}of Fe)for(const sa of la)Ft.removeVariant(_t,sa);he()},I=ge=>{Ft.resetPaymentTypeDefaults(ge)},O=(ge,Fe)=>{const nt=Ft.data.categoryOptions;for(const bt of Fe)nt.find(Bt=>Bt.value===bt)||nt.push({label:bt,value:bt})},L=()=>{Ft.populateDummyProduct()},P=Yt().ctx,q=ge=>{const Fe=Ft.data.products;ge.concat||(Fe.splice(0,Fe.length),Ft.data.savedIds=new Set,Ft.data.savingIds=new Set,Ft.data.productErrors=new Map),Fe.push(...ge.products)},X=M({visible:!1,field:"",product:null,value:""}),G=(ge,Fe)=>{X.value={visible:!0,field:Fe,product:ge,value:ge[Fe]||""}},te=ge=>{X.value.value=ge},ne=()=>{const{product:ge,field:Fe,value:nt}=X.value;ge&&(ge[Fe]=nt),X.value.visible=!1},re=N(()=>X.value.field==="post_content"?P.$t("Edit Description"):P.$t("Edit Short Description")),K=M(!0),{selectedKeys:Y,handleRowClick:W,toggleSelectAll:j,selectAll:ie,deselectAll:he,isSelected:me,selectedCount:ye,isLinkMode:se,toggleLinkMode:fe}=Af(),$e=N(()=>{const ge=[];for(const Fe of ht.value)if(ge.push(`p:${Fe.productId}`),Fe.hasVariants&&!Fe.collapsed)for(let nt=0;nt<Fe.product.variants.length;nt++)ge.push(`v:${Fe.productId}:${nt}`);return ge}),tt=ge=>{var Fe;if(ge.startsWith("p:")){const nt=ge.slice(2),bt=a.find(Bt=>Bt._cid===nt);return bt?{type:"product",data:bt,product:bt}:null}else if(ge.startsWith("v:")){const nt=ge.split(":"),bt=nt[1],Bt=parseInt(nt[2]),Wt=a.find(_t=>_t._cid===bt);if(Wt&&((Fe=Wt.variants)!=null&&Fe[Bt]))return{type:"variant",data:Wt.variants[Bt],product:Wt}}return null},ve=(ge,Fe,nt)=>{!se.value||!me(nt)||ff(ge,Fe,nt,Y.value,tt,null,cge)},Je=M(!1),vt=ge=>{ge.key==="Shift"&&(Je.value=!0)},Ye=ge=>{ge.key==="Shift"&&(Je.value=!1)},xe=(ge,Fe)=>{if(!Fe.shiftKey||Fe.target.closest(".bulk-checkbox-cell"))return;Fe.preventDefault();const nt=new Set(Y.value);nt.has(ge)?nt.delete(ge):nt.add(ge),Y.value=nt},Ee=M([]),Oe=N(()=>Ee.value.filter(ge=>ge.key==="title"||ge.key==="actions"?!0:Ft.isColumnVisible(ge.key))),Me=ge=>Ft.isColumnVisible(ge),gt=()=>{Ft.saveColumnWidths(Ee.value)},yt=M(new Set),Mt=ge=>{const Fe=ge._cid;yt.value.has(Fe)?yt.value.delete(Fe):yt.value.add(Fe),yt.value=new Set(yt.value)},Ut=ge=>yt.value.has(ge._cid),Dt=M(0),ht=N(()=>{let ge=0;return a.map(Fe=>{var Nt;const nt=Fe._cid,bt=((Nt=Fe.detail)==null?void 0:Nt.variation_type)!=="simple"&&Array.isArray(Fe.variants),Bt=bt?Fe.variants.length:0,Wt=yt.value.has(nt),_t=bt&&!Wt?(Bt+1)*ir:0,la=ir+_t,sa={product:Fe,productId:nt,hasVariants:bt,variantCount:Bt,collapsed:Wt,groupHeight:la,offset:ge};return ge+=la,sa})}),Pt=N(()=>{const ge=ht.value;if(ge.length===0)return 0;const Fe=ge[ge.length-1];return Fe.offset+Fe.groupHeight}),Ct=N(()=>{const ge=ht.value,Fe=Dt.value,nt=Fe+x1e,bt=B1e*ir;return ge.filter(Bt=>Bt.offset+Bt.groupHeight>=Fe-bt&&Bt.offset<=nt+bt)}),St=N(()=>Ct.value.length===0?0:Ct.value[0].offset),Ot=N(()=>{if(Ct.value.length===0)return 0;const ge=Ct.value[Ct.value.length-1];return Pt.value-ge.offset-ge.groupHeight});let Ht=null,It=0;const mt=ge=>{const Fe=ge.target,nt=Date.now();Ht&&clearTimeout(Ht),nt-It>=yc?(Dt.value=Fe.scrollTop,It=nt):Ht=setTimeout(()=>{Dt.value=Fe.scrollTop,It=Date.now(),Ht=null},yc)};let jt=null;return Ie(async()=>{jt=_s(),jt.bind("mod+a",ge=>{var nt,bt;const Fe=(nt=document.activeElement)==null?void 0:nt.tagName;Fe==="INPUT"||Fe==="TEXTAREA"||(bt=document.activeElement)!=null&&bt.isContentEditable||(ge.preventDefault(),ie($e.value))}),jt.bind("escape",()=>{var Fe,nt;const ge=(Fe=document.activeElement)==null?void 0:Fe.tagName;ge==="INPUT"||ge==="TEXTAREA"||(nt=document.activeElement)!=null&&nt.isContentEditable||(se.value?fe():he())}),Ee.value=[{key:"title",title:P.$t("Title"),width:150,minWidth:100},{key:"sku",title:P.$t("SKU"),width:120,minWidth:80},{key:"media",title:P.$t("Media"),width:100,minWidth:50},{key:"categories",title:P.$t("Categories"),width:200,minWidth:150},{key:"description",title:P.$t("Description"),width:200,minWidth:150},{key:"short_description",title:P.$t("Short Description"),width:150,minWidth:100},{key:"status",title:P.$t("Status"),width:100,minWidth:50},{key:"product_type",title:P.$t("Product Type"),width:200,minWidth:150},{key:"pricing_type",title:P.$t("Pricing Type"),width:200,minWidth:150},{key:"payment_type",title:P.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:P.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:P.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:P.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:P.$t("Compare-at Price"),width:200,minWidth:150},{key:"track_quantity",title:P.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:P.$t("Stock"),width:150,minWidth:150},{key:"actions",title:"",width:110,minWidth:110}],Ft.restoreColumnWidths(Ee.value),Ft.setupColumnVisibility(),Ft.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",vt),window.addEventListener("keyup",Ye)}),vl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",vt),window.removeEventListener("keyup",Ye),jt&&jt.reset()}),(ge,Fe)=>{const nt=C("el-button"),bt=C("el-progress"),Bt=C("el-checkbox"),Wt=C("el-checkbox-group"),_t=C("el-tooltip"),la=C("el-popover"),sa=C("el-input"),Nt=C("el-icon"),ia=C("el-option"),el=C("el-select"),Ll=C("el-switch"),Ra=C("el-dialog");return r(),h("div",pge,[n(nl,{title:ge.$t("Bulk Insert")},{action:d(()=>[n(Eve,{onOnDataPopulated:q}),n(nt,{onClick:L},{default:d(()=>[R(m(ge.$t("Add Product")),1)]),_:1}),n(nt,{type:"primary",onClick:p,loading:s.value,disabled:s.value||A(a).length===0},{default:d(()=>[R(m(s.value?ge.$t("Saving %s/%s...").replace("%s",i.value.completed).replace("%s",i.value.total):ge.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),s.value?(r(),E(bt,{key:0,percentage:c.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):B("",!0),n(Be,null,{default:d(()=>{var na;return[A(a).length>0?(r(),E(Qe,{key:0,title:((na=A(a))==null?void 0:na.length)===1?ge.$t("Product"):ge.$t("Products"),border_bottom:""},{action:d(()=>[o("div",fge,[n(nt,{disabled:A(ye)===0,onClick:U,size:"small",type:"danger",soft:""},{default:d(()=>[Fe[8]||(Fe[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(" "+m(ge.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),n(nt,{disabled:A(ye)===0,onClick:T,size:"small",type:"info",soft:""},{default:d(()=>[Fe[9]||(Fe[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(" "+m(ge.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),n(nt,{class:de({"is-active":A(se)}),disabled:A(ye)<2&&!A(se),onClick:A(fe),size:"small",type:"info",soft:""},{default:d(()=>[Fe[10]||(Fe[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(" "+m(A(se)?ge.$t("Unlink"):ge.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),n(Bt,{modelValue:K.value,"onUpdate:modelValue":Fe[0]||(Fe[0]=Z=>K.value=Z),label:ge.$t("Pin Actions")},null,8,["modelValue","label"]),n(la,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(_t,{effect:"light",content:ge.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",size:"small"},{default:d(()=>[n(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",mge,[o("h3",hge,m(ge.$t("Columns")),1),n(Wt,{modelValue:A(Ft).data.visibleColumns,"onUpdate:modelValue":Fe[1]||(Fe[1]=Z=>A(Ft).data.visibleColumns=Z),class:"fct-checkbox-blocks",onChange:Fe[2]||(Fe[2]=Z=>A(Ft).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,ae(A(Ft).getToggleableColumns(),Z=>(r(),E(Bt,{key:Z.value,value:Z.value,label:ge.$t(Z.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):B("",!0),n(Ce,{class:"p-0"},{default:d(()=>[A(a).length>0?(r(),h("div",{key:0,class:de(["relative",{"is-link-mode":A(se),"is-shift-held":Je.value}])},[n(uf,{columns:Oe.value,"sticky-last":K.value,onScroll:mt,onResizeEnd:gt},{"header-first":d(()=>[n(Bt,{"model-value":A(ye)>0&&A(ye)===$e.value.length,indeterminate:A(ye)>0&&A(ye)<$e.value.length,onChange:Fe[3]||(Fe[3]=Z=>A(j)($e.value))},null,8,["model-value","indeterminate"])]),"header-last":d(()=>[R(m(ge.$t("Actions")),1)]),default:d(()=>[St.value>0?(r(),h("tr",_ge,[o("td",{colspan:Oe.value.length+1,style:ua({height:St.value+"px",padding:0,border:"none"})},null,12,vge)])):B("",!0),(r(!0),h(H,null,ae(Ct.value,Z=>{var we,le,pe,je,at,Ke,qe,ft,Xe,Et,Xt,Ae,_e,Le,Ve;return r(),h(H,{key:Z.productId},[o("tr",{class:de(["bulk-product-row",{"is-saving":f(Z.product),"is-saved":_(Z.product),"has-product-error":y(Z.product),"is-selected":A(me)(`p:${Z.productId}`)}]),onClick:ee=>xe(`p:${Z.productId}`,ee)},[o("td",{class:"bulk-checkbox-cell",onClick:ee=>A(W)(`p:${Z.productId}`,ee,$e.value)},[n(Bt,{"model-value":A(me)(`p:${Z.productId}`),tabindex:"-1"},null,8,["model-value"])],8,yge),o("td",bge,[o("div",wge,[Z.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(ee=>Mt(Z.product),["prevent"]),title:Ut(Z.product)?ge.$t("Expand variants"):ge.$t("Collapse variants")},[(r(),h("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":Ut(Z.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},Fe[11]||(Fe[11]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),Ut(Z.product)?(r(),h("span",kge,m(Z.variantCount),1)):B("",!0)],8,Cge)):B("",!0),n(sa,{class:de(["fct-bulk-input",{"is-error":S(Z.product,"post_title")}]),modelValue:Z.product.post_title,"onUpdate:modelValue":ee=>Z.product.post_title=ee,placeholder:ge.$t("Product title"),size:"small",disabled:g(Z.product),onInput:ee=>ve("title",ee,`p:${Z.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),f(Z.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:ge.$t("Saving...")},[n(Nt,{class:"is-loading",size:14},{default:d(()=>[n(A(Xs))]),_:1})],8,Bge)):_(Z.product)?(r(),h("span",{key:2,class:"bulk-status-icon is-saved",title:ge.$t("Saved")},Fe[12]||(Fe[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,xge)):b(Z.product)||l(Z.product)&&y(Z.product)?(r(),E(_t,{key:3,content:v(Z.product),placement:"top"},{default:d(()=>[o("span",Sge,[n(Nt,{size:16},{default:d(()=>[n(A(Uo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Me("sku")?(r(),h("td",Fge,[((le=(we=Z.product)==null?void 0:we.detail)==null?void 0:le.variation_type)==="simple"&&((pe=Z.product.variants)!=null&&pe[0])?(r(),E(sa,{key:0,class:de(["fct-bulk-input",{"is-error":S(Z.product,"variants.0.sku")}]),modelValue:Z.product.variants[0].sku,"onUpdate:modelValue":[ee=>Z.product.variants[0].sku=ee,ee=>ve("sku",ee,`p:${Z.productId}`)],placeholder:"SKU",size:"small",disabled:g(Z.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",$ge,"—"))])):B("",!0),Me("media")?(r(),h("td",Ege,[n(hl,{modelValue:Z.product.gallery,"onUpdate:modelValue":ee=>Z.product.gallery=ee,"show-url-tab":"",disabled:g(Z.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Me("categories")?(r(),h("td",Uge,[n(cf,{modelValue:Z.product.categories,"onUpdate:modelValue":ee=>Z.product.categories=ee,options:A(Ft).data.categoryOptions,disabled:g(Z.product),onChange:ee=>{O(Z.product,ee),ve("categories",Z.product.categories,`p:${Z.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),Me("description")?(r(),h("td",Ige,[n(Zo,{value:Z.product.post_content,placeholder:ge.$t("Description"),onClick:ee=>G(Z.product,"post_content")},null,8,["value","placeholder","onClick"])])):B("",!0),Me("short_description")?(r(),h("td",Qge,[n(Zo,{value:Z.product.post_excerpt,placeholder:ge.$t("Short description"),onClick:ee=>G(Z.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):B("",!0),Me("status")?(r(),h("td",Dge,[n(el,{modelValue:Z.product.post_status,"onUpdate:modelValue":ee=>Z.product.post_status=ee,size:"small",class:de({"is-field-error":S(Z.product,"post_status")}),disabled:g(Z.product),onChange:ee=>ve("status",Z.product.post_status,`p:${Z.productId}`)},{default:d(()=>[(r(!0),h(H,null,ae(A(t).status,ee=>(r(),E(ia,{key:ee.value,label:ge.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):B("",!0),Me("product_type")&&((je=Z.product)!=null&&je.detail)?(r(),h("td",Vge,[n(el,{modelValue:Z.product.detail.fulfillment_type,"onUpdate:modelValue":ee=>Z.product.detail.fulfillment_type=ee,size:"small",class:de({"is-field-error":S(Z.product,"detail.fulfillment_type")}),disabled:g(Z.product),onChange:ee=>ve("product_type",Z.product.detail.fulfillment_type,`p:${Z.productId}`)},{default:d(()=>[(r(!0),h(H,null,ae(A(t).fulfilment,ee=>(r(),E(ia,{key:ee.value,label:ge.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Me("product_type")?(r(),h("td",Tge)):B("",!0),Me("pricing_type")&&((at=Z.product)!=null&&at.detail)?(r(),h("td",Mge,[n(el,{modelValue:Z.product.detail.variation_type,"onUpdate:modelValue":ee=>Z.product.detail.variation_type=ee,size:"small",class:de({"is-field-error":S(Z.product,"detail.variation_type")}),disabled:g(Z.product),onChange:ee=>{A(Ft).handleVariationChanged(Z.product,ee),ve("pricing_type",ee,`p:${Z.productId}`)}},{default:d(()=>[(r(!0),h(H,null,ae(A(t).variation,ee=>(r(),E(ia,{key:ee.value,label:ge.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Me("pricing_type")?(r(),h("td",Lge)):B("",!0),Me("payment_type")?(r(),h("td",Rge,[n(Yo,{variant:l(Z.product)?(Ke=Z.product.variants)==null?void 0:Ke[0]:null,disabled:g(Z.product),"has-error":S(Z.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:ee=>{var He;I(ee),ve("payment_type",(He=ee.other_info)==null?void 0:He.payment_type,`p:${Z.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):B("",!0),Me("interval")?(r(),h("td",Oge,[n(Wo,{variant:l(Z.product)?(qe=Z.product.variants)==null?void 0:qe[0]:null,disabled:g(Z.product),"has-error":S(Z.product,"variants.0.other_info.repeat_interval"),onChange:ee=>{var He,ut,Se;return ve("interval",(Se=(ut=(He=Z.product.variants)==null?void 0:He[0])==null?void 0:ut.other_info)==null?void 0:Se.repeat_interval,`p:${Z.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("trial_days")?(r(),h("td",Hge,[n(Jo,{variant:l(Z.product)?(ft=Z.product.variants)==null?void 0:ft[0]:null,disabled:g(Z.product),"has-error":S(Z.product,"variants.0.other_info.trial_days"),onChange:ee=>{var He,ut,Se;return ve("trial_days",(Se=(ut=(He=Z.product.variants)==null?void 0:He[0])==null?void 0:ut.other_info)==null?void 0:Se.trial_days,`p:${Z.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("best_price")?(r(),h("td",Pge,[n(qo,{variant:l(Z.product)?(Xe=Z.product.variants)==null?void 0:Xe[0]:null,disabled:g(Z.product),"has-error":S(Z.product,"variants.0.item_price"),onChange:ee=>{var He,ut;return ve("price",(ut=(He=Z.product.variants)==null?void 0:He[0])==null?void 0:ut.item_price,`p:${Z.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("compare_price")?(r(),h("td",Nge,[n(Xo,{variant:l(Z.product)?(Et=Z.product.variants)==null?void 0:Et[0]:null,disabled:g(Z.product),"has-error":S(Z.product,"variants.0.compare_price"),onChange:ee=>{var He,ut;return ve("compare_price",(ut=(He=Z.product.variants)==null?void 0:He[0])==null?void 0:ut.compare_price,`p:${Z.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("track_quantity")?(r(),h("td",Kge,[(Xt=Z.product)!=null&&Xt.detail?(r(),E(Ll,{key:0,modelValue:Z.product.detail.manage_stock,"onUpdate:modelValue":ee=>Z.product.detail.manage_stock=ee,"active-value":"1","inactive-value":"0",disabled:g(Z.product),onChange:ee=>{A(Ft).syncStockStatus(Z.product),ve("manage_stock",Z.product.detail.manage_stock,`p:${Z.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):B("",!0)])):B("",!0),Me("stock")?(r(),h("td",Gge,[((_e=(Ae=Z.product)==null?void 0:Ae.detail)==null?void 0:_e.manage_stock)==="1"&&((Ve=(Le=Z.product)==null?void 0:Le.detail)==null?void 0:Ve.variation_type)==="simple"?(r(),E(sa,{key:0,modelValue:Z.product.detail.total_stock,"onUpdate:modelValue":[ee=>Z.product.detail.total_stock=ee,ee=>{var He;(He=Z.product.variants)!=null&&He[0]&&(Z.product.variants[0].total_stock=ee,Z.product.variants[0].available=ee),A(Ft).syncStockStatus(Z.product),ve("stock",ee,`p:${Z.productId}`)}],disabled:g(Z.product),size:"small",placeholder:ge.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",jge,"—"))])):B("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":K.value}])},[o("div",zge,[_(Z.product)&&Z.product.view_url?(r(),h("a",{key:0,href:Z.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:ge.$t("View Product")},[n(J,{name:"External"})],8,qge)):B("",!0),n(Ze,{tag:"button",size:"x-small",onClick:Ne(ee=>x(Z.product),["prevent"]),disabled:s.value||g(Z.product),title:ge.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(ee=>V(Z.product),["prevent"]),disabled:s.value||g(Z.product),title:ge.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,gge),Z.hasVariants?(r(),h("tr",Yge,[o("td",{colspan:Oe.value.length+1,class:"!p-0 !border-b-0"},[n(va,{accordion:"",visible:!Z.collapsed,duration:200},{default:d(()=>[o("table",Jge,[o("colgroup",null,[Fe[13]||(Fe[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,ae(Oe.value,(ee,He)=>(r(),h("col",{key:He,style:ua({width:ee.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(H,null,ae(Z.product.variants,(ee,He)=>{var ut,Se;return r(),h("tr",{key:He,class:de(["bulk-variation-row",{"is-selected":A(me)(`v:${Z.productId}:${He}`)}]),onClick:kt=>xe(`v:${Z.productId}:${He}`,kt)},[o("td",Zge,[n(Bt,{"model-value":A(me)(`v:${Z.productId}:${He}`),tabindex:"-1",onChange:kt=>A(W)(`v:${Z.productId}:${He}`,kt,$e.value)},null,8,["model-value","onChange"])]),o("td",e1e,[o("div",t1e,[Fe[14]||(Fe[14]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(sa,{size:"small",modelValue:ee.variation_title,"onUpdate:modelValue":[kt=>ee.variation_title=kt,kt=>ve("title",kt,`v:${Z.productId}:${He}`)],placeholder:ge.$t("Variation title"),disabled:g(Z.product),class:de({"is-error":$(Z.product,He,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),k(Z.product,He)?(r(),E(_t,{key:0,content:w(Z.product,He),placement:"top"},{default:d(()=>[o("span",a1e,[n(Nt,{size:14},{default:d(()=>[n(A(Uo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Me("sku")?(r(),h("td",l1e,[n(sa,{size:"small",modelValue:ee.sku,"onUpdate:modelValue":[kt=>ee.sku=kt,kt=>ve("sku",kt,`v:${Z.productId}:${He}`)],placeholder:"SKU",disabled:g(Z.product),class:de({"is-error":$(Z.product,He,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):B("",!0),Me("media")?(r(),h("td",s1e,[n(hl,{modelValue:ee.media,"onUpdate:modelValue":kt=>ee.media=kt,"show-url-tab":"",disabled:g(Z.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Me("categories")?(r(),h("td",n1e,Fe[15]||(Fe[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("description")?(r(),h("td",o1e,Fe[16]||(Fe[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("short_description")?(r(),h("td",i1e,Fe[17]||(Fe[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("status")?(r(),h("td",r1e,Fe[18]||(Fe[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("product_type")?(r(),h("td",d1e,Fe[19]||(Fe[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("pricing_type")?(r(),h("td",u1e,Fe[20]||(Fe[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("payment_type")?(r(),h("td",c1e,[n(Yo,{variant:ee,disabled:g(Z.product),"has-error":$(Z.product,He,"other_info.payment_type"),onPaymentTypeChange:kt=>{var wa;I(kt),ve("payment_type",(wa=kt.other_info)==null?void 0:wa.payment_type,`v:${Z.productId}:${He}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):B("",!0),Me("interval")?(r(),h("td",A1e,[n(Wo,{variant:ee,disabled:g(Z.product),"has-error":$(Z.product,He,"other_info.repeat_interval"),onChange:kt=>{var wa;return ve("interval",(wa=ee.other_info)==null?void 0:wa.repeat_interval,`v:${Z.productId}:${He}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("trial_days")?(r(),h("td",p1e,[n(Jo,{variant:ee,disabled:g(Z.product),"has-error":$(Z.product,He,"other_info.trial_days"),onChange:kt=>{var wa;return ve("trial_days",(wa=ee.other_info)==null?void 0:wa.trial_days,`v:${Z.productId}:${He}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("best_price")?(r(),h("td",f1e,[n(qo,{variant:ee,disabled:g(Z.product),"has-error":$(Z.product,He,"item_price"),onChange:kt=>ve("price",ee.item_price,`v:${Z.productId}:${He}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("compare_price")?(r(),h("td",m1e,[n(Xo,{variant:ee,disabled:g(Z.product),"has-error":$(Z.product,He,"compare_price"),onChange:kt=>ve("compare_price",ee.compare_price,`v:${Z.productId}:${He}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("track_quantity")?(r(),h("td",h1e,Fe[21]||(Fe[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("stock")?(r(),h("td",_1e,[((Se=(ut=Z.product)==null?void 0:ut.detail)==null?void 0:Se.manage_stock)==="1"?(r(),E(sa,{key:0,class:"fc-bulk-input",size:"small",modelValue:ee.total_stock,"onUpdate:modelValue":[kt=>ee.total_stock=kt,kt=>{ee.available=kt,A(Ft).syncStockStatus(Z.product),ve("stock",kt,`v:${Z.productId}:${He}`)}],disabled:g(Z.product),placeholder:ge.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",v1e,"—"))])):B("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":K.value}])},[o("div",g1e,[n(Ze,{tag:"button",size:"x-small",onClick:Ne(kt=>Q(Z.product,ee),["prevent"]),disabled:s.value||g(Z.product),title:ge.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(kt=>F(Z.product,ee),["prevent"]),disabled:s.value||g(Z.product),title:ge.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Xge)}),128)),o("tr",y1e,[o("td",{colspan:Oe.value.length+1},[o("div",w1e,[n(nt,{size:"small",text:"",type:"primary",onClick:Ne(ee=>A(Ft).addVariationToProduct(Z.product),["prevent"])},{default:d(()=>[R(" + "+m(ge.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,b1e)])])])]),_:2},1032,["visible"])],8,Wge)])):B("",!0)],64)}),128)),Ot.value>0?(r(),h("tr",C1e,[o("td",{colspan:Oe.value.length+1,style:ua({height:Ot.value+"px",padding:0,border:"none"})},null,12,k1e)])):B("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No products yet. Import a CSV or add products manually.")},null,8,["text"]))]),_:1})]}),_:1}),n(Ra,{modelValue:X.value.visible,"onUpdate:modelValue":Fe[6]||(Fe[6]=na=>X.value.visible=na),title:re.value,width:"700px","close-on-click-modal":!1,onClosed:Fe[7]||(Fe[7]=na=>X.value.product=null)},{footer:d(()=>[n(nt,{onClick:Fe[5]||(Fe[5]=na=>X.value.visible=!1)},{default:d(()=>[R(m(ge.$t("Cancel")),1)]),_:1}),n(nt,{type:"primary",onClick:ne},{default:d(()=>[R(m(ge.$t("Save")),1)]),_:1})]),default:d(()=>[X.value.visible&&X.value.field==="post_content"?(r(),E(es,{key:0,"model-value":X.value.value,height:300,onUpdate:te},null,8,["model-value"])):B("",!0),X.value.visible&&X.value.field==="post_excerpt"?(r(),E(sa,{key:1,modelValue:X.value.value,"onUpdate:modelValue":Fe[4]||(Fe[4]=na=>X.value.value=na),type:"textarea",rows:6,placeholder:ge.$t("Short description")},null,8,["modelValue","placeholder"])):B("",!0)]),_:1},8,["modelValue","title"])])}}};class F1e extends Ed{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:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("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 u("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 s=0;s<t.length;s+=a)l.push(t.slice(s,s+a));return l}async fetchProducts(t={},a=!1,l="",s=""){var i;this.data.loading=!0;try{l&&(this.data.constrainedProductIds=l,this.data.constrainedVariantIds=s);const c=l||this.data.constrainedProductIds,p=s||this.data.constrainedVariantIds,f={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};c&&(f.product_ids=c,f.variant_ids=p),this.data.filterType==="advanced"?(f.advanced_filters=JSON.stringify(this.data.advanceFilters),f.filter_type="advanced"):(this.data.search&&(f.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(f.active_view=this.data.selectedView)),Object.assign(f,t);const _=await ue.get("products/bulk-edit-data",f),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),ke(()=>{this._suppressDirty=!1}),this.data.pagination={page:_.page||f.page,per_page:_.per_page||f.per_page,total:_.total||0,hasMore:_.page*_.per_page<_.total}}catch(c){const p=((i=c==null?void 0:c.data)==null?void 0:i.message)||"Failed to fetch products";z.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(([s])=>!s.startsWith("variants.")).map(([,s])=>s).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const s=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(s))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const s=`variants.${a}.`;return Object.entries(l.fields).filter(([c])=>c.startsWith(s)).map(([,c])=>c).join("; ")}hasFieldError(t,a){var s;const l=this.data.productErrors.get(t);return!!((s=l==null?void 0:l.fields)!=null&&s[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}async saveProduct(t){var l,s,i,c;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 ue.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),z.success(u("Product updated successfully"));else if((s=p.errors)!=null&&s.length){const f=p.errors[0];f!=null&&f.fields&&(this.data.productErrors.set(a,f),this.data.productErrors=new Map(this.data.productErrors)),z.error((f==null?void 0:f.message)||"Failed to save product")}}catch(p){const f=((i=p==null?void 0:p.data)==null?void 0:i.message)||"Failed to save product",_=(c=p==null?void 0:p.data)==null?void 0:c.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))}z.error(f)}finally{this.data.savingIds.delete(a),this.data.savingIds=new Set(this.data.savingIds)}}}async saveProducts(){var l,s;const t=this.getDirtyProducts().filter(i=>!this.data.savedIds.has(i.ID));if(t.length===0){z.info(u("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 f=p.map(_=>_.ID);for(const _ of f)this.data.savingIds.add(_);this.data.savingIds=new Set(this.data.savingIds);try{const _=await ue.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=(s=_==null?void 0:_.data)==null?void 0:s.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 f)this.data.savingIds.delete(_);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{updatedIds:i,errors:c}=this.data.saveProgress;c.length===0?z.success(`${i.length} product(s) updated successfully`):i.length>0?z.info(`${i.length} product(s) updated, ${c.length} error(s)`):z.error(u("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 ue.post(`products/${a}/duplicate`,{})).product_id;if(i){const p=(await ue.get("products/bulk-edit-data",{search:i,per_page:1})).products||[];if(p.length>0){const f=this.data.products.indexOf(t);this.data.products.splice(f+1,0,p[0])}}}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to duplicate product";z.error(i)}finally{this.data.duplicatingIds.delete(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}async duplicateProductWithVariants(t,a){var s;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 c=(await ue.post(`products/${l}/duplicate`,{})).product_id;if(!c)return;const f=(await ue.get("products/bulk-edit-data",{search:c,per_page:1})).products||[];if(!f.length)return;const _=f[0],g=t.variants||[],y=new Set;for(const b of g)a.includes(b.id)&&b.serial_index!=null&&y.add(b.serial_index);_.variants&&y.size>0&&(_.variants=_.variants.filter(b=>y.has(b.serial_index)));const v=this.data.products.indexOf(t);this.data.products.splice(v+1,0,_),this.markDirty(_.ID)}catch(i){const c=((s=i==null?void 0:i.data)==null?void 0:s.message)||"Failed to duplicate product";z.error(c)}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 s=t.variants.indexOf(a);t.variants.splice(s+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 ue.delete(`products/${a}`);const s=this.data.products.indexOf(t);s!==-1&&this.data.products.splice(s,1),this.data.dirty.delete(a),this.data.savedIds.delete(a)}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to delete product";z.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 z.error(u("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 s;const l=[];for(const i of t){const c=a?`${a} > ${i.label}`:i.label;l.push({label:c,value:c}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,c))}return l}async fetchCategories(){try{const a=(await ue.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(s=>s.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 st=F1e.init(),$1e={class:"fct-bulk-edit-page fct-layout-width"},E1e={class:"fct-table-wrapper"},U1e={class:"fct-card-header-top"},I1e={class:"fct-card-header-left flex-1"},Q1e={class:"fct-card-header-actions"},D1e={key:0,class:"fct-advanced-filter-toggle-wrapper"},V1e={key:1,class:"fct-btn-group sm hidden md:flex"},T1e={key:0,class:"filter-search-wrap"},M1e={class:"search-bar"},L1e={class:"text-xs text-system-light pt-2 dark:text-gray-300"},R1e={class:"fct-bulk-edit-table-wrap"},O1e={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"},H1e={class:"m-0 text-base"},P1e={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},N1e={class:"fct-btn-group sm justify-end"},K1e={class:"filter-popover-item"},G1e={class:"filter-popover-title"},j1e={class:"fct-bulk-edit-table"},z1e={key:0,"aria-hidden":"true"},q1e=["colspan"],Y1e=["onClick"],W1e=["onClick"],J1e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},X1e={class:"flex items-center"},Z1e=["onClick","title"],eye={key:0,class:"bulk-collapse-count"},tye=["title"],aye={class:"bulk-status-icon is-error"},lye=["disabled","onClick","title"],sye={key:0,class:"fct-bulk-media-cell"},nye={key:1,class:"fct-bulk-sku-cell"},oye={key:1,class:"text-gray-300 text-sm flex justify-center"},iye={key:2,class:"fct-bulk-categories-cell"},rye={key:3,class:"fct-bulk-desc-cell"},dye={key:4,class:"fct-bulk-short-desc-cell"},uye={key:5,class:"fct-bulk-status-cell"},cye={key:6,class:"fct-bulk-product-type-cell"},Aye={class:"bulk-readonly-label"},pye={key:7,class:"fct-bulk-pricing-type-cell"},fye={class:"bulk-readonly-label"},mye={key:8,class:"fct-bulk-payment-type-cell"},hye={key:9,class:"fct-bulk-interval-cell"},_ye={key:10,class:"fct-bulk-trial-days-cell"},vye={key:11,class:"fct-bulk-best-price-cell"},gye={key:12,class:"fct-bulk-compare-price-cell"},yye={key:13,class:"fct-bulk-qty-cell !pl-5"},bye={key:14,class:"fct-bulk-stock-cell"},wye={key:1,class:"text-gray-300 text-sm flex justify-center"},Cye={class:"fct-btn-group sm justify-end"},kye={key:0,class:"bulk-variants-block-row"},Bye=["colspan"],xye={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Sye=["onClick"],Fye={class:"bulk-checkbox-cell"},$ye={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Eye={class:"flex items-center gap-1 pl-4"},Uye={class:"bulk-status-icon is-error"},Iye={key:0},Qye={key:1},Dye={key:2},Vye={key:3},Tye={key:4},Mye={key:5},Lye={key:6},Rye={key:7},Oye={key:8},Hye={key:9},Pye={key:10},Nye={key:11},Kye={key:12},Gye={key:13,class:"text-center"},jye={key:14},zye={key:1,class:"text-gray-300 text-sm flex justify-center"},qye={class:"fct-btn-group sm justify-end"},Yye={key:1,"aria-hidden":"true"},Wye=["colspan"],Jye={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},Xye={class:"text-system-mid text-sm"},Zye={key:2,class:"flex items-center justify-center py-8"},ebe={class:"text-system-mid text-sm"},tbe={key:1,class:"flex items-center justify-center py-3 border-top"},abe={class:"text-system-mid text-sm"},rr=43,lbe=10,bc=800,wc=100,sbe=200,nbe={__name:"BulkEdit",setup(e){const t=Yt().ctx,a=sl(),{options:l}=st.data,s=le=>{var pe;return((pe=le==null?void 0:le.detail)==null?void 0:pe.variation_type)==="simple"},i=N(()=>st.data.products),c=N(()=>st.data.loading),p=N(()=>st.data.saving),f=N(()=>st.data.saveProgress),_=N(()=>st.data.pagination),g=N(()=>st.data.dirty),y=N(()=>g.value.size),v=N(()=>Math.max(0,_.value.total-i.value.length)),b=N(()=>Math.min(_.value.per_page,v.value)),k=N(()=>{const le=st.data.saveProgress;return le.total?Math.round(le.completed/le.total*100):0}),w=Xr("search-input"),S=()=>{st.openSearch(),ke(()=>{var le;(le=w.value)==null||le.focus()})},$=(le=!1)=>{st.fetchProducts({},le)},V=()=>{st.saveProducts()},F=le=>{st.markDirty(le.ID)},x=(le,pe)=>{st.resetPaymentTypeDefaults(pe),F(le)},Q=(le,pe)=>{const je=st.data.categoryOptions;for(const at of pe)je.find(Ke=>Ke.value===at)||je.push({label:at,value:at});F(le)},D=le=>st.isDirty(le.ID),T=le=>st.isSavingProduct(le.ID),U=le=>st.isSaved(le.ID),I=le=>st.isRowDisabled(le.ID),O=le=>st.isDuplicating(le.ID),L=le=>st.isDeleting(le.ID),P=le=>st.hasError(le.ID),q=le=>st.getError(le.ID),X=le=>st.hasProductLevelError(le.ID),G=(le,pe)=>st.hasVariantError(le.ID,pe),te=(le,pe)=>st.getVariantError(le.ID,pe),ne=(le,pe)=>st.hasFieldError(le.ID,pe),re=(le,pe,je)=>st.hasVariantFieldError(le.ID,pe,je),K=le=>st.saveProduct(le),Y=le=>st.duplicateProduct(le),W=(le,pe)=>st.duplicateVariant(le,pe),j=M(!0),{selectedKeys:ie,handleRowClick:he,toggleSelectAll:me,selectAll:ye,deselectAll:se,isSelected:fe,selectedCount:$e,isLinkMode:tt,toggleLinkMode:ve}=Af(),Je=N(()=>{const le=[];for(const pe of Bt.value)if(le.push(`p:${pe.productId}`),pe.hasVariants&&!pe.collapsed)for(const je of pe.product.variants)le.push(`v:${je.id}`);return le}),vt=le=>{var pe;if(le.startsWith("p:")){const je=parseInt(le.slice(2)),at=Bt.value.find(Ke=>Ke.productId===je);return at?{type:"product",data:at.product,product:at.product}:null}else if(le.startsWith("v:")){const je=parseInt(le.slice(2));for(const at of Bt.value){const Ke=(pe=at.product.variants)==null?void 0:pe.find(qe=>qe.id===je);if(Ke)return{type:"variant",data:Ke,product:at.product}}}return null},Ye=(le,pe,je)=>{!tt.value||!fe(je)||ff(le,pe,je,ie.value,vt,F,Age)},xe=M(!1),Ee=le=>{le.key==="Shift"&&(xe.value=!0)},Oe=le=>{le.key==="Shift"&&(xe.value=!1)},Me=(le,pe)=>{if(!pe.shiftKey||pe.target.closest(".bulk-checkbox-cell"))return;pe.preventDefault();const je=new Set(ie.value);je.has(le)?je.delete(le):je.add(le),ie.value=je},gt=()=>{const le=[];for(const pe of Bt.value){const je=`p:${pe.productId}`,at=ie.value.has(je),Ke=[];if(pe.product.variants)for(const qe of pe.product.variants)ie.value.has(`v:${qe.id}`)&&Ke.push(qe.id);!at&&Ke.length===0||(at&&Ke.length===0?le.push({product:pe.product,type:"full"}):!at&&Ke.length>0?le.push({product:pe.product,type:"variants-only",variantIds:Ke}):le.push({product:pe.product,type:"partial",variantIds:Ke}))}return le},yt=async()=>{const le=gt();if(!le.length)return;const pe=le.filter(ft=>ft.type==="full").length,je=le.filter(ft=>ft.type==="partial").length,Ke=le.filter(ft=>ft.type==="variants-only").reduce((ft,Xe)=>ft+Xe.variantIds.length,0),qe=[];pe>0&&qe.push(`${pe} product(s) with all variants`),je>0&&qe.push(`${je} product(s) with selected variants`),Ke>0&&qe.push(`${Ke} variant(s)`);try{await xl.confirm(t.$t("Duplicate %s?").replace("%s",qe.join(", ")),t.$t("Bulk Duplicate"),{confirmButtonText:t.$t("Duplicate"),cancelButtonText:t.$t("Cancel"),type:"info"})}catch{return}for(const ft of le)if(ft.type==="full")await st.duplicateProduct(ft.product);else if(ft.type==="variants-only")for(const Xe of ft.variantIds){const Et=ft.product.variants.find(Xt=>Xt.id===Xe);Et&&st.duplicateVariant(ft.product,Et)}else ft.type==="partial"&&await st.duplicateProductWithVariants(ft.product,ft.variantIds);se()},Mt=async()=>{const le=[],pe=[];for(const Ke of Bt.value){const qe=`p:${Ke.productId}`;if(ie.value.has(qe)){le.push(Ke.product);continue}const Xe=[];if(Ke.product.variants)for(const Et of Ke.product.variants)ie.value.has(`v:${Et.id}`)&&Xe.push(Et);Xe.length>0&&pe.push({product:Ke.product,variants:Xe})}if(!le.length&&!pe.length)return;const je=pe.reduce((Ke,qe)=>Ke+qe.variants.length,0),at=[];le.length>0&&at.push(`${le.length} product(s)`),je>0&&at.push(`${je} variant(s)`);try{await xl.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",at.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const Ke of le)await st.deleteProduct(Ke);for(const{product:Ke,variants:qe}of pe)for(const ft of qe)st.removeVariant(Ke,ft);se()},Ut=async le=>{const pe=le.ID;if(!pe||st.isDeleting(pe))return;const je=le.post_title||t.$t("Untitled product"),at=Array.isArray(le.variants)?le.variants.length:0,Ke=at>0?t.$t('This will permanently delete "%1$s" and its %2$s variant(s).',je,at):t.$t('This will permanently delete "%1$s".',je);try{await xl.confirm(Ke,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}st.deleteProduct(le)},Dt=(le,pe)=>{if(le.variants.length<=1){st.removeVariant(le,pe);return}const je=pe.variation_title||t.$t("Untitled variant");xl.confirm(t.$t('This will remove the variant "%1$s".',je),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{st.removeVariant(le,pe)}).catch(()=>{})},ht=M({visible:!1,field:"",product:null,value:""}),Pt=(le,pe)=>{ht.value={visible:!0,field:pe,product:le,value:le[pe]||""}},Ct=le=>{ht.value.value=le},St=()=>{const{product:le,field:pe,value:je}=ht.value;le&&(le[pe]=je,F(le)),ht.value.visible=!1},Ot=N(()=>ht.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),Ht=M([]),It=N(()=>Ht.value.filter(le=>le.key==="title"||le.key==="actions"?!0:st.isColumnVisible(le.key))),mt=le=>st.isColumnVisible(le),jt=()=>{st.saveColumnWidths(Ht.value)},ge=M(new Set),Fe=le=>{const pe=le.ID;ge.value.has(pe)?ge.value.delete(pe):ge.value.add(pe),ge.value=new Set(ge.value)},nt=le=>ge.value.has(le.ID),bt=M(0),Bt=N(()=>{let le=0;return i.value.map(pe=>{var Xt;const je=pe.ID,at=((Xt=pe.detail)==null?void 0:Xt.variation_type)!=="simple"&&Array.isArray(pe.variants)&&pe.variants.length>0,Ke=at?pe.variants.length:0,qe=ge.value.has(je),ft=at&&!qe?Ke*rr:0,Xe=rr+ft,Et={product:pe,productId:je,hasVariants:at,variantCount:Ke,collapsed:qe,groupHeight:Xe,offset:le};return le+=Xe,Et})}),Wt=N(()=>{const le=Bt.value;if(le.length===0)return 0;const pe=le[le.length-1];return pe.offset+pe.groupHeight}),_t=N(()=>{const le=Bt.value,pe=bt.value,je=pe+bc,at=lbe*rr;return le.filter(Ke=>Ke.offset+Ke.groupHeight>=pe-at&&Ke.offset<=je+at)}),la=N(()=>_t.value.length===0?0:_t.value[0].offset),sa=N(()=>{if(_t.value.length===0)return 0;const le=_t.value[_t.value.length-1];return Wt.value-le.offset-le.groupHeight});let Nt=null,ia=0;const el=()=>{if(c.value||!_.value.hasMore||i.value.length===0)return;Wt.value-(bt.value+bc)<sbe&&$(!0)},Ll=le=>{const pe=le.target,je=Date.now();Nt&&clearTimeout(Nt),je-ia>=wc?(bt.value=pe.scrollTop,ia=je,el()):Nt=setTimeout(()=>{bt.value=pe.scrollTop,ia=Date.now(),Nt=null,el()},wc)},Ra=le=>({physical:"Physical",digital:"Digital"})[le]||le||"—",na=le=>({simple:"Simple",simple_variations:"Variable"})[le]||le||"—";let Z=null;const we=()=>{const le=a.query.product_ids,pe=a.query.variant_ids;le&&pe?st.fetchProducts({},!1,le,pe):$(!1)};return Ie(async()=>{Z=_s(),Z.bind("mod+a",le=>{var je,at;const pe=(je=document.activeElement)==null?void 0:je.tagName;pe==="INPUT"||pe==="TEXTAREA"||(at=document.activeElement)!=null&&at.isContentEditable||(le.preventDefault(),ye(Je.value))}),Z.bind("escape",()=>{var pe,je;const le=(pe=document.activeElement)==null?void 0:pe.tagName;le==="INPUT"||le==="TEXTAREA"||(je=document.activeElement)!=null&&je.isContentEditable||(tt.value?ve():se())}),Ht.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}],st.restoreColumnWidths(Ht.value),st.setupColumnVisibility(),st.setupSavedViews(),st.fetchCategories(),we(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",Ee),window.addEventListener("keyup",Oe)}),vl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",Ee),window.removeEventListener("keyup",Oe),Z&&Z.reset()}),(le,pe)=>{const je=C("el-button"),at=C("el-progress"),Ke=C("el-switch"),qe=C("el-tooltip"),ft=C("el-input"),Xe=C("el-checkbox"),Et=C("el-checkbox-group"),Xt=C("el-popover"),Ae=C("el-icon"),_e=C("el-option"),Le=C("el-select"),Ve=C("el-dialog");return r(),h("div",$1e,[n(nl,{title:le.$t("Bulk Edit")},{action:d(()=>[n(je,{type:"primary",onClick:V,loading:p.value,disabled:p.value||y.value===0},{default:d(()=>[R(m(p.value?le.$t("Saving %s/%s...").replace("%s",f.value.completed).replace("%s",f.value.total):y.value>0?le.$t("Save Changes")+` (${y.value})`:le.$t("Save Changes")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),p.value?(r(),E(at,{key:0,percentage:k.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):B("",!0),o("div",E1e,[n(Be,null,{default:d(()=>[n(Qe,{border_bottom:""},{default:d(()=>[o("div",U1e,[o("div",I1e,[A(st).getTabsCount()&&!A(st).isUsingAdvanceFilter()?(r(),E(Nf,{key:0,class:de("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:A(st)},null,8,["table"])):B("",!0)]),o("div",Q1e,[A(st).isAdvanceFilterEnabled()?(r(),h("div",D1e,[n(Ke,{class:"fct-advanced-filter-toggle",onChange:pe[0]||(pe[0]=ee=>{A(st).onFilterTypeChanged(ee)}),"active-value":"advanced","inactive-value":"simple",modelValue:A(st).data.filterType,"onUpdate:modelValue":pe[1]||(pe[1]=ee=>A(st).data.filterType=ee),"active-text":le.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):B("",!0),A(st).isUsingAdvanceFilter()?B("",!0):(r(),h("div",V1e,[A(st).isSearching()?B("",!0):(r(),E(qe,{key:0,effect:"light",content:le.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",onClick:Ne(S,["prevent"])},{default:d(()=>[n(J,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),n(Mc,{table:A(st)},null,8,["table"]),A(st).isSearching()&&!A(st).isUsingAdvanceFilter()?(r(),h("div",T1e,[o("div",M1e,[n(ft,{ref:"search-input",onClear:pe[2]||(pe[2]=()=>{A(st).search()}),onKeyup:pe[3]||(pe[3]=xa(()=>{A(st).search()},["enter"])),modelValue:A(st).data.search,"onUpdate:modelValue":pe[4]||(pe[4]=ee=>A(st).data.search=ee),type:"text",placeholder:le.$t("Search"),clearable:""},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",L1e,m(A(st).getSearchHint()),1)]),n(je,{text:"",onClick:pe[5]||(pe[5]=()=>{A(st).closeSearch()})},{default:d(()=>[R(m(le.$t("Cancel")),1)]),_:1})])):B("",!0)]),_:1}),n(Ce,{class:"p-0"},{default:d(()=>[o("div",R1e,[i.value.length>0?(r(),h("div",O1e,[o("h5",H1e,[R(m(i.value.length)+" "+m(i.value.length===1?le.$t("Product"):le.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),h("span",P1e,m(le.$t("of"))+" "+m(_.value.total)+" "+m(le.$t("total"))+" · "+m(b.value)+" "+m(le.$t("next")),1)):B("",!0)]),o("div",N1e,[n(je,{disabled:A($e)===0,onClick:yt,size:"small"},{default:d(()=>[pe[14]||(pe[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(" "+m(le.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),n(je,{disabled:A($e)===0,onClick:Mt,size:"small",type:"danger",plain:""},{default:d(()=>[pe[15]||(pe[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(" "+m(le.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),n(je,{class:de({"is-active":A(tt)}),disabled:A($e)<2&&!A(tt),onClick:A(ve),size:"small"},{default:d(()=>[pe[16]||(pe[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(" "+m(A(tt)?le.$t("Unlink"):le.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),n(Xe,{modelValue:j.value,"onUpdate:modelValue":pe[6]||(pe[6]=ee=>j.value=ee),label:le.$t("Pin Actions")},null,8,["modelValue","label"]),n(Xt,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(qe,{effect:"light",content:le.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",size:"small"},{default:d(()=>[n(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",K1e,[o("h3",G1e,m(le.$t("Columns")),1),n(Et,{modelValue:A(st).data.visibleColumns,"onUpdate:modelValue":pe[7]||(pe[7]=ee=>A(st).data.visibleColumns=ee),class:"fct-checkbox-blocks",onChange:pe[8]||(pe[8]=ee=>A(st).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,ae(A(st).getToggleableColumns(),ee=>(r(),E(Xe,{key:ee.value,value:ee.value,label:le.$t(ee.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):B("",!0),o("div",j1e,[i.value.length>0?(r(),h("div",{key:0,class:de(["relative",{"is-link-mode":A(tt),"is-shift-held":xe.value}])},[n(uf,{columns:It.value,"sticky-last":j.value,onScroll:Ll,onResizeEnd:jt},{"header-first":d(()=>[qt(n(Xe,{checked:A($e)>0&&A($e)===Je.value.length,onChange:pe[9]||(pe[9]=ee=>A(me)(Je.value))},null,8,["checked"]),[[A(uge),A($e)>0&&A($e)<Je.value.length]])]),"header-last":d(()=>[R(m(le.$t("Actions")),1)]),default:d(()=>[la.value>0?(r(),h("tr",z1e,[o("td",{colspan:It.value.length+1,style:ua({height:la.value+"px",padding:0,border:"none"})},null,12,q1e)])):B("",!0),(r(!0),h(H,null,ae(_t.value,ee=>{var He,ut,Se,kt,wa,ce,oe,Ue,Te,Pe,ct,At,rt,Lt,$a,zt,ha,Sa;return r(),h(H,{key:ee.productId},[o("tr",{class:de(["bulk-product-row",{"is-dirty":D(ee.product),"is-saving":T(ee.product),"is-saved":U(ee.product),"has-product-error":P(ee.product),"is-selected":A(fe)(`p:${ee.productId}`)}]),onClick:We=>Me(`p:${ee.productId}`,We)},[o("td",{class:"bulk-checkbox-cell",onClick:We=>A(he)(`p:${ee.productId}`,We,Je.value)},[n(Xe,{"model-value":A(fe)(`p:${ee.productId}`),tabindex:"-1"},null,8,["model-value"])],8,W1e),o("td",J1e,[o("div",X1e,[ee.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(We=>Fe(ee.product),["prevent"]),title:nt(ee.product)?le.$t("Expand variants"):le.$t("Collapse variants")},[(r(),h("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":nt(ee.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},pe[17]||(pe[17]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),nt(ee.product)?(r(),h("span",eye,m(ee.variantCount),1)):B("",!0)],8,Z1e)):B("",!0),n(ft,{class:de(["fct-bulk-input",{"is-error":ne(ee.product,"post_title")}]),modelValue:ee.product.post_title,"onUpdate:modelValue":[We=>ee.product.post_title=We,We=>{F(ee.product),Ye("title",We,`p:${ee.productId}`)}],placeholder:le.$t("Product title"),disabled:I(ee.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),T(ee.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:le.$t("Saving...")},[n(Ae,{class:"is-loading",size:14},{default:d(()=>[n(A(Xs))]),_:1})],8,tye)):X(ee.product)||s(ee.product)&&P(ee.product)?(r(),E(qe,{key:2,content:q(ee.product),placement:"top"},{default:d(()=>[o("span",aye,[n(Ae,{size:16},{default:d(()=>[n(A(Uo))]),_:1})])]),_:2},1032,["content"])):D(ee.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:I(ee.product),onClick:Ne(We=>K(ee.product),["prevent"]),title:le.$t("Save")},pe[18]||(pe[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,lye)):B("",!0)])]),mt("image")?(r(),h("td",sye,[n(hl,{modelValue:ee.product.gallery,"onUpdate:modelValue":We=>ee.product.gallery=We,onChange:We=>F(ee.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):B("",!0),mt("sku")?(r(),h("td",nye,[((ut=(He=ee.product)==null?void 0:He.detail)==null?void 0:ut.variation_type)==="simple"&&((Se=ee.product.variants)!=null&&Se[0])?(r(),E(ft,{key:0,class:de(["fct-bulk-input",{"is-error":ne(ee.product,"variants.0.sku")}]),modelValue:ee.product.variants[0].sku,"onUpdate:modelValue":[We=>ee.product.variants[0].sku=We,We=>{F(ee.product),Ye("sku",We,`p:${ee.productId}`)}],placeholder:"SKU",size:"small",disabled:I(ee.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),h("span",oye,"—"))])):B("",!0),mt("categories")?(r(),h("td",iye,[n(cf,{modelValue:ee.product.categories,"onUpdate:modelValue":We=>ee.product.categories=We,options:A(st).data.categoryOptions,disabled:I(ee.product),onChange:We=>{Q(ee.product,We),Ye("categories",ee.product.categories,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),mt("description")?(r(),h("td",rye,[n(Zo,{value:ee.product.post_content,placeholder:le.$t("Description"),onClick:We=>Pt(ee.product,"post_content")},null,8,["value","placeholder","onClick"])])):B("",!0),mt("short_description")?(r(),h("td",dye,[n(Zo,{value:ee.product.post_excerpt,placeholder:le.$t("Short description"),onClick:We=>Pt(ee.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):B("",!0),mt("status")?(r(),h("td",uye,[n(Le,{modelValue:ee.product.post_status,"onUpdate:modelValue":We=>ee.product.post_status=We,size:"small",class:de({"is-field-error":ne(ee.product,"post_status")}),disabled:I(ee.product),onChange:We=>{F(ee.product),Ye("status",ee.product.post_status,`p:${ee.productId}`)}},{default:d(()=>[n(_e,{label:le.$t("Published"),value:"publish"},null,8,["label"]),n(_e,{label:le.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):B("",!0),mt("product_type")?(r(),h("td",cye,[o("span",Aye,m(Ra((wa=(kt=ee.product)==null?void 0:kt.detail)==null?void 0:wa.fulfillment_type)),1)])):B("",!0),mt("pricing_type")?(r(),h("td",pye,[o("span",fye,m(na((oe=(ce=ee.product)==null?void 0:ce.detail)==null?void 0:oe.variation_type)),1)])):B("",!0),mt("payment_type")?(r(),h("td",mye,[n(Yo,{variant:s(ee.product)?(Ue=ee.product.variants)==null?void 0:Ue[0]:null,disabled:I(ee.product),"has-error":ne(ee.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:We=>{var Zt;x(ee.product,We),Ye("payment_type",(Zt=We.other_info)==null?void 0:Zt.payment_type,`p:${ee.productId}`)},onChange:We=>F(ee.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):B("",!0),mt("interval")?(r(),h("td",hye,[n(Wo,{variant:s(ee.product)?(Te=ee.product.variants)==null?void 0:Te[0]:null,disabled:I(ee.product),"has-error":ne(ee.product,"variants.0.other_info.repeat_interval"),onChange:We=>{var Zt,Ka,ze;F(ee.product),Ye("interval",(ze=(Ka=(Zt=ee.product.variants)==null?void 0:Zt[0])==null?void 0:Ka.other_info)==null?void 0:ze.repeat_interval,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("trial_days")?(r(),h("td",_ye,[n(Jo,{variant:s(ee.product)?(Pe=ee.product.variants)==null?void 0:Pe[0]:null,disabled:I(ee.product),"has-error":ne(ee.product,"variants.0.other_info.trial_days"),onChange:We=>{var Zt,Ka,ze;F(ee.product),Ye("trial_days",(ze=(Ka=(Zt=ee.product.variants)==null?void 0:Zt[0])==null?void 0:Ka.other_info)==null?void 0:ze.trial_days,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("best_price")?(r(),h("td",vye,[n(qo,{variant:s(ee.product)?(ct=ee.product.variants)==null?void 0:ct[0]:null,disabled:I(ee.product),"has-error":ne(ee.product,"variants.0.item_price"),onChange:We=>{var Zt,Ka;F(ee.product),Ye("price",(Ka=(Zt=ee.product.variants)==null?void 0:Zt[0])==null?void 0:Ka.item_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("compare_price")?(r(),h("td",gye,[n(Xo,{variant:s(ee.product)?(At=ee.product.variants)==null?void 0:At[0]:null,disabled:I(ee.product),"has-error":ne(ee.product,"variants.0.compare_price"),onChange:We=>{var Zt,Ka;F(ee.product),Ye("compare_price",(Ka=(Zt=ee.product.variants)==null?void 0:Zt[0])==null?void 0:Ka.compare_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("track_quantity")?(r(),h("td",yye,[(rt=ee.product)!=null&&rt.detail?(r(),E(Ke,{key:0,modelValue:ee.product.detail.manage_stock,"onUpdate:modelValue":We=>ee.product.detail.manage_stock=We,"active-value":1,"inactive-value":0,disabled:I(ee.product),onChange:We=>{F(ee.product),A(st).syncStockStatus(ee.product),Ye("manage_stock",ee.product.detail.manage_stock,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):B("",!0)])):B("",!0),mt("stock")?(r(),h("td",bye,[($a=(Lt=ee.product)==null?void 0:Lt.detail)!=null&&$a.manage_stock&&((ha=(zt=ee.product)==null?void 0:zt.detail)==null?void 0:ha.variation_type)==="simple"&&((Sa=ee.product.variants)!=null&&Sa[0])?(r(),E(ft,{key:0,class:"fct-bulk-input",placeholder:le.$t("e.g 10"),size:"small",modelValue:ee.product.variants[0].available,"onUpdate:modelValue":[We=>ee.product.variants[0].available=We,We=>{ee.product.variants[0].total_stock=We,F(ee.product),A(st).syncStockStatus(ee.product),Ye("stock",We,`p:${ee.productId}`)}],disabled:I(ee.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",wye,"—"))])):B("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":j.value}])},[o("div",Cye,[ee.product.view_url?(r(),E(Ze,{key:0,tag:"a",size:"x-small",href:ee.product.view_url,target:"_blank",title:le.$t("View Product")},{default:d(()=>[n(J,{name:"External"})]),_:2},1032,["href","title"])):B("",!0),n(Ze,{tag:"button",size:"x-small",onClick:Ne(We=>Y(ee.product),["prevent"]),disabled:p.value||I(ee.product)||O(ee.product),title:le.$t("Duplicate")},{default:d(()=>[O(ee.product)?(r(),E(Ae,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(Xs))]),_:1})):(r(),E(J,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(We=>Ut(ee.product),["prevent"]),disabled:p.value||I(ee.product)||L(ee.product),title:le.$t("Delete")},{default:d(()=>[L(ee.product)?(r(),E(Ae,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(Xs))]),_:1})):(r(),E(J,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,Y1e),ee.hasVariants?(r(),h("tr",kye,[o("td",{colspan:It.value.length+1,class:"!p-0 !border-b-0"},[n(va,{accordion:"",visible:!ee.collapsed,duration:200},{default:d(()=>[o("table",xye,[o("colgroup",null,[pe[19]||(pe[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,ae(It.value,(We,Zt)=>(r(),h("col",{key:Zt,style:ua({width:We.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(H,null,ae(ee.product.variants,(We,Zt)=>{var Ka,ze;return r(),h("tr",{key:We.id||Zt,class:de(["bulk-variation-row",{"is-selected":A(fe)(`v:${We.id}`)}]),onClick:Tt=>Me(`v:${We.id}`,Tt)},[o("td",Fye,[n(Xe,{"model-value":A(fe)(`v:${We.id}`),tabindex:"-1",onChange:Tt=>A(he)(`v:${We.id}`,Tt,Je.value)},null,8,["model-value","onChange"])]),o("td",$ye,[o("div",Eye,[pe[20]||(pe[20]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(ft,{size:"small",modelValue:We.variation_title,"onUpdate:modelValue":[Tt=>We.variation_title=Tt,Tt=>{F(ee.product),Ye("title",Tt,`v:${We.id}`)}],placeholder:le.$t("Variation title"),disabled:I(ee.product),class:de({"is-error":re(ee.product,Zt,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),G(ee.product,Zt)?(r(),E(qe,{key:0,content:te(ee.product,Zt),placement:"top"},{default:d(()=>[o("span",Uye,[n(Ae,{size:14},{default:d(()=>[n(A(Uo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),mt("image")?(r(),h("td",Iye,[n(hl,{modelValue:We.media,"onUpdate:modelValue":Tt=>We.media=Tt,onChange:Tt=>F(ee.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):B("",!0),mt("sku")?(r(),h("td",Qye,[n(ft,{class:de(["fct-bulk-input",{"is-error":re(ee.product,Zt,"sku")}]),size:"small",modelValue:We.sku,"onUpdate:modelValue":[Tt=>We.sku=Tt,Tt=>{F(ee.product),Ye("sku",Tt,`v:${We.id}`)}],placeholder:le.$t("SKU"),disabled:I(ee.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):B("",!0),mt("categories")?(r(),h("td",Dye,pe[21]||(pe[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),mt("description")?(r(),h("td",Vye,pe[22]||(pe[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),mt("short_description")?(r(),h("td",Tye,pe[23]||(pe[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),mt("status")?(r(),h("td",Mye,pe[24]||(pe[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),mt("product_type")?(r(),h("td",Lye,pe[25]||(pe[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),mt("pricing_type")?(r(),h("td",Rye,pe[26]||(pe[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),mt("payment_type")?(r(),h("td",Oye,[n(Yo,{variant:We,disabled:I(ee.product),"has-error":re(ee.product,Zt,"other_info.payment_type"),onPaymentTypeChange:Tt=>{var ls;x(ee.product,Tt),Ye("payment_type",(ls=Tt.other_info)==null?void 0:ls.payment_type,`v:${We.id}`)},onChange:Tt=>F(ee.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):B("",!0),mt("interval")?(r(),h("td",Hye,[n(Wo,{variant:We,disabled:I(ee.product),"has-error":re(ee.product,Zt,"other_info.repeat_interval"),onChange:Tt=>{var ls;F(ee.product),Ye("interval",(ls=We.other_info)==null?void 0:ls.repeat_interval,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("trial_days")?(r(),h("td",Pye,[n(Jo,{variant:We,disabled:I(ee.product),"has-error":re(ee.product,Zt,"other_info.trial_days"),onChange:Tt=>{var ls;F(ee.product),Ye("trial_days",(ls=We.other_info)==null?void 0:ls.trial_days,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("best_price")?(r(),h("td",Nye,[n(qo,{variant:We,disabled:I(ee.product),"has-error":re(ee.product,Zt,"item_price"),onChange:Tt=>{F(ee.product),Ye("price",We.item_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("compare_price")?(r(),h("td",Kye,[n(Xo,{variant:We,disabled:I(ee.product),"has-error":re(ee.product,Zt,"compare_price"),onChange:Tt=>{F(ee.product),Ye("compare_price",We.compare_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),mt("track_quantity")?(r(),h("td",Gye,pe[27]||(pe[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),mt("stock")?(r(),h("td",jye,[(ze=(Ka=ee.product)==null?void 0:Ka.detail)!=null&&ze.manage_stock?(r(),E(ft,{key:0,class:"fct-bulk-input",placeholder:le.$t("e.g 10"),size:"small",modelValue:We.available,"onUpdate:modelValue":[Tt=>We.available=Tt,Tt=>{We.total_stock=Tt,F(ee.product),A(st).syncStockStatus(ee.product),Ye("stock",Tt,`v:${We.id}`)}],disabled:I(ee.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",zye,"—"))])):B("",!0),o("td",{class:de(["text-center",{"sticky-col sticky-col-right":j.value}])},[o("div",qye,[n(Ze,{tag:"button",size:"x-small",onClick:Ne(Tt=>W(ee.product,We),["prevent"]),disabled:p.value||I(ee.product),title:le.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(Tt=>Dt(ee.product,We),["prevent"]),disabled:p.value||I(ee.product),title:le.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Sye)}),128))])])]),_:2},1032,["visible"])],8,Bye)])):B("",!0)],64)}),128)),sa.value>0?(r(),h("tr",Yye,[o("td",{colspan:It.value.length+1,style:ua({height:sa.value+"px",padding:0,border:"none"})},null,12,Wye)])):B("",!0)]),_:1},8,["columns","sticky-last"])],2)):c.value?c.value?(r(),h("div",Zye,[n(Ae,{class:"is-loading mr-2"},{default:d(()=>pe[28]||(pe[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",ebe,m(le.$t("Loading products...")),1)])):B("",!0):(r(),h("div",Jye,[o("p",Xye,m(le.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&c.value?(r(),h("div",tbe,[n(Ae,{class:"is-loading mr-2"},{default:d(()=>pe[29]||(pe[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",abe,m(le.$t("Loading"))+" "+m(b.value)+" "+m(le.$t("more...")),1)])):B("",!0)])]),_:1})]),_:1})]),n(Ve,{modelValue:ht.value.visible,"onUpdate:modelValue":pe[12]||(pe[12]=ee=>ht.value.visible=ee),title:Ot.value,width:"700px","close-on-click-modal":!1,onClosed:pe[13]||(pe[13]=ee=>ht.value.product=null)},{footer:d(()=>[n(je,{onClick:pe[11]||(pe[11]=ee=>ht.value.visible=!1)},{default:d(()=>[R(m(le.$t("Cancel")),1)]),_:1}),n(je,{type:"primary",onClick:St},{default:d(()=>[R(m(le.$t("Save")),1)]),_:1})]),default:d(()=>[ht.value.visible&&ht.value.field==="post_content"?(r(),E(es,{key:0,"model-value":ht.value.value,height:300,onUpdate:Ct},null,8,["model-value"])):B("",!0),ht.value.visible&&ht.value.field==="post_excerpt"?(r(),E(ft,{key:1,modelValue:ht.value.value,"onUpdate:modelValue":pe[10]||(pe[10]=ee=>ht.value.value=ee),type:"textarea",rows:6,placeholder:le.$t("Short description")},null,8,["modelValue","placeholder"])):B("",!0)]),_:1},8,["modelValue","title"])])}}},mf=Ge.get("payment_routes");for(const e of mf)e.props=!0;const obe=Ge.get("storage_driver_routes"),hf=(obe||[]).filter(e=>e.name!=="s3");for(const e of hf)e.props=!0;var ibe={dashboard:{name:"dashboard",path:"/",component:gB,meta:{active_menu:"dashboard",title:u("Dashboard")}},orders:{path:"/orders",component:XF,meta:{active_menu:"orders",title:u("Orders")},children:[{name:"orders",path:"",component:q_,meta:{active_menu:"orders",title:u("Orders"),permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:uD,props:!0,meta:{active_menu:"orders",title:u("View Order"),permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:PD,props:!0,meta:{active_menu:"orders",title:u("Create Order"),permission:"orders/create"}}]},products:{name:"products",path:"/products",component:MM,meta:{active_menu:"products",title:u("Products"),permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:IV,name:"product_route",meta:{active_menu:"products",title:u("Products"),permission:["products/view","products/edit","integrations/manage"]},props:!0,children:[{name:"product_edit",path:"",props:!0,component:Az,meta:{active_menu:"products",title:u("Product Edit"),permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:rc,meta:{active_menu:"products",title:u("Integrations"),permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:Wu,meta:{active_menu:"products",title:u("Edit Integration"),permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:bq,meta:{active_menu:"products",title:u("Integrations"),permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:eq,meta:{active_menu:"products",title:u("Upgrade Paths"),permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:rc,meta:{active_menu:"integrations",title:u("Product Integrations"),permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:S1e,meta:{active_menu:"products",title:u("Product Bulk Insert"),permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:nbe,meta:{active_menu:"products",title:u("Product Bulk Edit"),permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:_m,meta:{active_menu:"products",title:u("Attributes"),permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:aJ,meta:{active_menu:"products",title:u("Inventory"),permission:"products/view"}},customers:{path:"/customers",component:rg,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:Dh,meta:{active_menu:"customers",title:u("Customers"),permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:WE,props:!0,meta:{active_menu:"customers",title:u("View Customer"),permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:vee,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:kue,meta:{title:u("Overview"),permission:"reports/view"}},{name:"reports_sales",path:"sales",component:qee,meta:{title:u("Sales"),permission:"reports/view"}},{name:"reports_orders",path:"orders",component:use,meta:{title:u("Orders"),permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:Kte,meta:{title:u("Revenue"),permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:zse,meta:{title:u("Refunds"),permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:Rne,meta:{title:u("Subscriptions"),permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:Zoe,meta:{title:u("Retention"),permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>Jt(()=>import("./chunks/Cohort.js?ver=1.6.2"),[],import.meta.url),meta:{title:u("Cohorts"),permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:soe,meta:{title:u("Future Renewals"),permission:"reports/view"}},{name:"reports_products",path:"products",component:Ede,meta:{title:u("Product"),permission:"reports/view"}},{name:"reports_customer",path:"customer",component:kie,meta:{title:u("Customer"),permission:"reports/view"}},{name:"reports_sources",path:"sources",component:ire,meta:{title:u("Sources"),permission:"reports/view"}}]},settings:{path:"/settings",component:P$,meta:{active_menu:"settings",title:u("Settings"),permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:ZD,meta:{active_menu:"settings",title:u("Settings"),permission:"store/settings"},children:[{name:"store_setup",path:"",component:ws,meta:{title:u("Store Setup")}},{name:"pages_setup",path:"pages_setup",component:ws,meta:{title:u("Pages Setup")}},{name:"single_product_setup",path:"single_product_setup",component:ws,meta:{title:u("Product Page")}},{name:"cart_and_checkout",path:"cart_and_checkout",component:ws,meta:{title:u("Cart & Checkout")}},{name:"subscriptions_setup",path:"subscriptions_setup",component:ws,meta:{title:u("Subscriptions")}},{name:"checkout_fields",path:"checkout_fields",component:yve,meta:{}}]},...Ge.get("addon_settings_routes",[]).map(e=>({component:ws,...e})),{name:"email_notifications",path:"email_notifications",component:SJ,meta:{active_menu:"settings",title:u("Notifications"),permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:yce,meta:{active_menu:"settings",title:u("Mailing Settings"),permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:ws,meta:{active_menu:"settings",title:u("Reminders"),permission:"store/sensitive"}},{name:"email_digest_settings",path:"email_digest_settings",component:Fce,meta:{active_menu:"settings",title:u("Store Digest"),permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:aX,meta:{active_menu:"settings",title:u("Edit Notification"),permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:kX,meta:{active_menu:"settings",title:u("Add Notification"),permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:wV,meta:{active_menu:"settings",title:u("Licensing"),permission:"store/sensitive"}},{name:"payments",path:"payments",component:A$,meta:{active_menu:"settings",title:u("Payment Settings"),permission:"is_super_admin"}},{name:"gateway",component:O3,path:"payments",children:mf,props:!0,meta:{active_menu:"settings",title:u("Payment Settings"),permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:ev,meta:{active_menu:"settings",title:u("Invoice & Packing"),permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:av,meta:{active_menu:"settings",title:u("PDF Templates"),permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:gv,meta:{active_menu:"settings",title:u("PDF Templates"),permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:sg,meta:{active_menu:"settings",title:u("PDF Template Settings"),permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:Lv,props:!0,meta:{active_menu:"settings",title:u("Edit PDF Template"),permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:I$,meta:{active_menu:"settings",title:u("Role Settings"),permission:"is_super_admin"}},{name:"addons",path:"addons",component:Kue,meta:{active_menu:"settings",title:u("Features & addon"),permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:_c,meta:{active_menu:"coupons",title:u("Coupons Settings"),permission:"is_super_admin"}},{name:"storage",path:"storage",component:hX,meta:{active_menu:"settings",title:u("Storage Providers"),permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:cc,props:!0,meta:{active_menu:"settings",title:u("S3"),permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:G3,meta:{active_menu:"settings",title:u("Gateway"),permission:"is_super_admin"},props:!0},{name:"drivers",component:cc,path:"storage",children:hf,props:!0,meta:{active_menu:"settings",title:u("Storage Settings"),permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:Uce,meta:{active_menu:"settings",title:u("Tax Settings"),permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:PAe,meta:{}},{name:"tax_rates",path:"tax_rates",component:spe,meta:{}},{name:"eu",path:"eu",component:Ihe,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:hc,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:hc,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:Q4,meta:{active_menu:"integrations",title:u("Integrations"),permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:Wu,meta:{active_menu:"integrations",title:u("Global Integrations"),permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:mS,meta:{active_menu:"integrations",title:u("Integrations"),permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:_c,meta:{active_menu:"coupons",title:u("Coupons"),permission:"coupons/view"}},logs:{name:"logs",path:"/logs",component:cZ,meta:{active_menu:"logs",title:u("Logs"),permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:Ufe,meta:{active_menu:"taxes",title:u("Taxes"),permission:"is_super_admin"}},add_or_edit_coupon_route:{name:"add_or_edit_coupon",path:"/coupons/add_or_edit_coupon/:coupon_id?",component:Z_e,props:!0,meta:{active_menu:"coupons",title:u("Coupons"),permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:WF,name:"onboarding",meta:{active_menu:"dashboard",title:u("Onboarding"),permission:"is_super_admin"}}};const rbe={class:"fct-theme-button-container"},dbe={class:"theme-selected-button"},ube={__name:"ThemeToggle",setup(e){const t=M(De.MODE_LIGHT),a=c=>{t.value!==c&&(t.value=c,De.apply(c))},l=[{value:"light",label:u("Light"),icon:"Sun"},{value:"dark",label:u("Dark"),icon:"Moon"},{value:"system",label:u("System"),icon:"Tools"}];Is(()=>{const c=document.getElementById("theme-button-container");if(c){const p=c.querySelector(".fct-theme-button-container");p&&p.remove()}t.value=De.getCurrentTheme(),t.value.toString().startsWith(De.MODE_SYSTEM)&&(t.value=De.MODE_SYSTEM)});const s=c=>{ke(()=>{t.value=De.getCurrentTheme()})},i=c=>{a(c)};return Ie(()=>{window.addEventListener(De.THEME_CHANGE_EVENT,s,!1)}),vl(()=>{window.removeEventListener(De.THEME_CHANGE_EVENT,s,!1)}),(c,p)=>{const f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",rbe,[n(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:i},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(),h(H,null,ae(l,y=>n(f,{key:y.value,command:y.value,class:de({active:t.value===y.value})},{default:d(()=>[n(J,{name:y.icon},null,8,["name"]),R(" "+m(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:d(()=>[o("div",dbe,[t.value==="light"?(r(),E(J,{key:0,name:"Sun"})):t.value==="dark"?(r(),E(J,{key:1,name:"Moon"})):t.value==="system"?(r(),E(J,{key:2,name:"Tools"})):B("",!0)])]),_:1})])}}};function as(e){return Array.isArray?Array.isArray(e):gf(e)==="[object Array]"}function cbe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Abe(e){return e==null?"":cbe(e)}function Ol(e){return typeof e=="string"}function _f(e){return typeof e=="number"}function pbe(e){return e===!0||e===!1||fbe(e)&&gf(e)=="[object Boolean]"}function vf(e){return typeof e=="object"}function fbe(e){return vf(e)&&e!==null}function pl(e){return e!=null}function dr(e){return!e.trim().length}function gf(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const mbe="Incorrect 'index' type",hbe=e=>`Invalid value for key ${e}`,_be=e=>`Pattern length exceeds max of ${e}.`,vbe=e=>`Missing ${e} property in key`,gbe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Cc=Object.prototype.hasOwnProperty;class ybe{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let s=yf(l);this._keys.push(s),this._keyMap[s.id]=s,a+=s.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 yf(e){let t=null,a=null,l=null,s=1,i=null;if(Ol(e)||as(e))l=e,t=kc(e),a=Kr(e);else{if(!Cc.call(e,"name"))throw new Error(vbe("name"));const c=e.name;if(l=c,Cc.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(gbe(c));t=kc(c),a=Kr(c),i=e.getFn}return{path:t,id:a,weight:s,src:l,getFn:i}}function kc(e){return as(e)?e:e.split(".")}function Kr(e){return as(e)?e.join("."):e}function bbe(e,t){let a=[],l=!1;const s=(i,c,p)=>{if(pl(i))if(!c[p])a.push(i);else{let f=c[p];const _=i[f];if(!pl(_))return;if(p===c.length-1&&(Ol(_)||_f(_)||pbe(_)))a.push(Abe(_));else if(as(_)){l=!0;for(let g=0,y=_.length;g<y;g+=1)s(_[g],c,p+1)}else c.length&&s(_,c,p+1)}};return s(e,Ol(t)?t.split("."):t,0),l?a:a[0]}const wbe={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Cbe={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},kbe={location:0,threshold:.6,distance:100},Bbe={useExtendedSearch:!1,getFn:bbe,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var $t={...Cbe,...wbe,...kbe,...Bbe};const xbe=/[^ ]+/g;function Sbe(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(s){const i=s.match(xbe).length;if(a.has(i))return a.get(i);const c=1/Math.pow(i,.5*e),p=parseFloat(Math.round(c*l)/l);return a.set(i,p),p},clear(){a.clear()}}}class Qd{constructor({getFn:t=$t.getFn,fieldNormWeight:a=$t.fieldNormWeight}={}){this.norm=Sbe(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,Ol(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();Ol(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(!pl(t)||dr(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((s,i)=>{let c=s.getFn?s.getFn(t):this.getFn(t,s.path);if(pl(c)){if(as(c)){let p=[];const f=[{nestedArrIndex:-1,value:c}];for(;f.length;){const{nestedArrIndex:_,value:g}=f.pop();if(pl(g))if(Ol(g)&&!dr(g)){let y={v:g,i:_,n:this.norm.get(g)};p.push(y)}else as(g)&&g.forEach((y,v)=>{f.push({nestedArrIndex:v,value:y})})}l.$[i]=p}else if(Ol(c)&&!dr(c)){let p={v:c,n:this.norm.get(c)};l.$[i]=p}}}),this.records.push(l)}toJSON(){return{keys:this.keys,records:this.records}}}function bf(e,t,{getFn:a=$t.getFn,fieldNormWeight:l=$t.fieldNormWeight}={}){const s=new Qd({getFn:a,fieldNormWeight:l});return s.setKeys(e.map(yf)),s.setSources(t),s.create(),s}function Fbe(e,{getFn:t=$t.getFn,fieldNormWeight:a=$t.fieldNormWeight}={}){const{keys:l,records:s}=e,i=new Qd({getFn:t,fieldNormWeight:a});return i.setKeys(l),i.setIndexRecords(s),i}function yo(e,{errors:t=0,currentLocation:a=0,expectedLocation:l=0,distance:s=$t.distance,ignoreLocation:i=$t.ignoreLocation}={}){const c=t/e.length;if(i)return c;const p=Math.abs(l-a);return s?c+p/s:p?1:c}function $be(e=[],t=$t.minMatchCharLength){let a=[],l=-1,s=-1,i=0;for(let c=e.length;i<c;i+=1){let p=e[i];p&&l===-1?l=i:!p&&l!==-1&&(s=i-1,s-l+1>=t&&a.push([l,s]),l=-1)}return e[i-1]&&i-l>=t&&a.push([l,i-1]),a}const ks=32;function Ebe(e,t,a,{location:l=$t.location,distance:s=$t.distance,threshold:i=$t.threshold,findAllMatches:c=$t.findAllMatches,minMatchCharLength:p=$t.minMatchCharLength,includeMatches:f=$t.includeMatches,ignoreLocation:_=$t.ignoreLocation}={}){if(t.length>ks)throw new Error(_be(ks));const g=t.length,y=e.length,v=Math.max(0,Math.min(l,y));let b=i,k=v;const w=p>1||f,S=w?Array(y):[];let $;for(;($=e.indexOf(t,k))>-1;){let T=yo(t,{currentLocation:$,expectedLocation:v,distance:s,ignoreLocation:_});if(b=Math.min(T,b),k=$+g,w){let U=0;for(;U<g;)S[$+U]=1,U+=1}}k=-1;let V=[],F=1,x=g+y;const Q=1<<g-1;for(let T=0;T<g;T+=1){let U=0,I=x;for(;U<I;)yo(t,{errors:T,currentLocation:v+I,expectedLocation:v,distance:s,ignoreLocation:_})<=b?U=I:x=I,I=Math.floor((x-U)/2+U);x=I;let O=Math.max(1,v-I+1),L=c?y:Math.min(v+I,y)+g,P=Array(L+2);P[L+1]=(1<<T)-1;for(let X=L;X>=O;X-=1){let G=X-1,te=a[e.charAt(G)];if(w&&(S[G]=+!!te),P[X]=(P[X+1]<<1|1)&te,T&&(P[X]|=(V[X+1]|V[X])<<1|1|V[X+1]),P[X]&Q&&(F=yo(t,{errors:T,currentLocation:G,expectedLocation:v,distance:s,ignoreLocation:_}),F<=b)){if(b=F,k=G,k<=v)break;O=Math.max(1,2*v-k)}}if(yo(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:s,ignoreLocation:_})>b)break;V=P}const D={isMatch:k>=0,score:Math.max(.001,F)};if(w){const T=$be(S,p);T.length?f&&(D.indices=T):D.isMatch=!1}return D}function Ube(e){let t={};for(let a=0,l=e.length;a<l;a+=1){const s=e.charAt(a);t[s]=(t[s]||0)|1<<l-a-1}return t}const ei=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 wf{constructor(t,{location:a=$t.location,threshold:l=$t.threshold,distance:s=$t.distance,includeMatches:i=$t.includeMatches,findAllMatches:c=$t.findAllMatches,minMatchCharLength:p=$t.minMatchCharLength,isCaseSensitive:f=$t.isCaseSensitive,ignoreDiacritics:_=$t.ignoreDiacritics,ignoreLocation:g=$t.ignoreLocation}={}){if(this.options={location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:f,ignoreDiacritics:_,ignoreLocation:g},t=f?t:t.toLowerCase(),t=_?ei(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(b,k)=>{this.chunks.push({pattern:b,alphabet:Ube(b),startIndex:k})},v=this.pattern.length;if(v>ks){let b=0;const k=v%ks,w=v-k;for(;b<w;)y(this.pattern.substr(b,ks),b),b+=ks;if(k){const S=v-ks;y(this.pattern.substr(S),S)}}else y(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s}=this.options;if(t=a?t:t.toLowerCase(),t=l?ei(t):t,this.pattern===t){let w={isMatch:!0,score:0};return s&&(w.indices=[[0,t.length-1]]),w}const{location:i,distance:c,threshold:p,findAllMatches:f,minMatchCharLength:_,ignoreLocation:g}=this.options;let y=[],v=0,b=!1;this.chunks.forEach(({pattern:w,alphabet:S,startIndex:$})=>{const{isMatch:V,score:F,indices:x}=Ebe(t,w,S,{location:i+$,distance:c,threshold:p,findAllMatches:f,minMatchCharLength:_,includeMatches:s,ignoreLocation:g});V&&(b=!0),v+=F,V&&x&&(y=[...y,...x])});let k={isMatch:b,score:b?v/this.chunks.length:1};return b&&s&&(k.indices=y),k}}class gs{constructor(t){this.pattern=t}static isMultiMatch(t){return Bc(t,this.multiRegex)}static isSingleMatch(t){return Bc(t,this.singleRegex)}search(){}}function Bc(e,t){const a=e.match(t);return a?a[1]:null}class Ibe extends gs{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 Qbe extends gs{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 Dbe extends gs{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 Vbe extends gs{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 Tbe extends gs{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 Mbe extends gs{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 Cf extends gs{constructor(t,{location:a=$t.location,threshold:l=$t.threshold,distance:s=$t.distance,includeMatches:i=$t.includeMatches,findAllMatches:c=$t.findAllMatches,minMatchCharLength:p=$t.minMatchCharLength,isCaseSensitive:f=$t.isCaseSensitive,ignoreDiacritics:_=$t.ignoreDiacritics,ignoreLocation:g=$t.ignoreLocation}={}){super(t),this._bitapSearch=new wf(t,{location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:f,ignoreDiacritics:_,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class kf extends gs{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let a=0,l;const s=[],i=this.pattern.length;for(;(l=t.indexOf(this.pattern,a))>-1;)a=l+i,s.push([l,a-1]);const c=!!s.length;return{isMatch:c,score:c?0:1,indices:s}}}const Gr=[Ibe,kf,Dbe,Vbe,Mbe,Tbe,Qbe,Cf],xc=Gr.length,Lbe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Rbe="|";function Obe(e,t={}){return e.split(Rbe).map(a=>{let l=a.trim().split(Lbe).filter(i=>i&&!!i.trim()),s=[];for(let i=0,c=l.length;i<c;i+=1){const p=l[i];let f=!1,_=-1;for(;!f&&++_<xc;){const g=Gr[_];let y=g.isMultiMatch(p);y&&(s.push(new g(y,t)),f=!0)}if(!f)for(_=-1;++_<xc;){const g=Gr[_];let y=g.isSingleMatch(p);if(y){s.push(new g(y,t));break}}}return s})}const Hbe=new Set([Cf.type,kf.type]);class Pbe{constructor(t,{isCaseSensitive:a=$t.isCaseSensitive,ignoreDiacritics:l=$t.ignoreDiacritics,includeMatches:s=$t.includeMatches,minMatchCharLength:i=$t.minMatchCharLength,ignoreLocation:c=$t.ignoreLocation,findAllMatches:p=$t.findAllMatches,location:f=$t.location,threshold:_=$t.threshold,distance:g=$t.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s,minMatchCharLength:i,findAllMatches:p,ignoreLocation:c,location:f,threshold:_,distance:g},t=a?t:t.toLowerCase(),t=l?ei(t):t,this.pattern=t,this.query=Obe(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:s,ignoreDiacritics:i}=this.options;t=s?t:t.toLowerCase(),t=i?ei(t):t;let c=0,p=[],f=0;for(let _=0,g=a.length;_<g;_+=1){const y=a[_];p.length=0,c=0;for(let v=0,b=y.length;v<b;v+=1){const k=y[v],{isMatch:w,indices:S,score:$}=k.search(t);if(w){if(c+=1,f+=$,l){const V=k.constructor.type;Hbe.has(V)?p=[...p,...S]:p.push(S)}}else{f=0,c=0,p.length=0;break}}if(c){let v={isMatch:!0,score:f/c};return l&&(v.indices=p),v}}return{isMatch:!1,score:1}}}const jr=[];function Nbe(...e){jr.push(...e)}function zr(e,t){for(let a=0,l=jr.length;a<l;a+=1){let s=jr[a];if(s.condition(e,t))return new s(e,t)}return new wf(e,t)}const ti={AND:"$and",OR:"$or"},qr={PATH:"$path",PATTERN:"$val"},Yr=e=>!!(e[ti.AND]||e[ti.OR]),Kbe=e=>!!e[qr.PATH],Gbe=e=>!as(e)&&vf(e)&&!Yr(e),Sc=e=>({[ti.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Bf(e,t,{auto:a=!0}={}){const l=s=>{let i=Object.keys(s);const c=Kbe(s);if(!c&&i.length>1&&!Yr(s))return l(Sc(s));if(Gbe(s)){const f=c?s[qr.PATH]:i[0],_=c?s[qr.PATTERN]:s[f];if(!Ol(_))throw new Error(hbe(f));const g={keyId:Kr(f),pattern:_};return a&&(g.searcher=zr(_,t)),g}let p={children:[],operator:i[0]};return i.forEach(f=>{const _=s[f];as(_)&&_.forEach(g=>{p.children.push(l(g))})}),p};return Yr(e)||(e=Sc(e)),l(e)}function jbe(e,{ignoreFieldNorm:t=$t.ignoreFieldNorm}){e.forEach(a=>{let l=1;a.matches.forEach(({key:s,norm:i,score:c})=>{const p=s?s.weight:null;l*=Math.pow(c===0&&p?Number.EPSILON:c,(p||1)*(t?1:i))}),a.score=l})}function zbe(e,t){const a=e.matches;t.matches=[],pl(a)&&a.forEach(l=>{if(!pl(l.indices)||!l.indices.length)return;const{indices:s,value:i}=l;let c={indices:s,value:i};l.key&&(c.key=l.key.src),l.idx>-1&&(c.refIndex=l.idx),t.matches.push(c)})}function qbe(e,t){t.score=e.score}function Ybe(e,t,{includeMatches:a=$t.includeMatches,includeScore:l=$t.includeScore}={}){const s=[];return a&&s.push(zbe),l&&s.push(qbe),e.map(i=>{const{idx:c}=i,p={item:t[c],refIndex:c};return s.length&&s.forEach(f=>{f(i,p)}),p})}class pn{constructor(t,a={},l){this.options={...$t,...a},this.options.useExtendedSearch,this._keyStore=new ybe(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof Qd))throw new Error(mbe);this._myIndex=a||bf(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){pl(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const a=[];for(let l=0,s=this._docs.length;l<s;l+=1){const i=this._docs[l];t(i,l)&&(this.removeAt(l),l-=1,s-=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:s,shouldSort:i,sortFn:c,ignoreFieldNorm:p}=this.options;let f=Ol(t)?Ol(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return jbe(f,{ignoreFieldNorm:p}),i&&f.sort(c),_f(a)&&a>-1&&(f=f.slice(0,a)),Ybe(f,this._docs,{includeMatches:l,includeScore:s})}_searchStringList(t){const a=zr(t,this.options),{records:l}=this._myIndex,s=[];return l.forEach(({v:i,i:c,n:p})=>{if(!pl(i))return;const{isMatch:f,score:_,indices:g}=a.searchIn(i);f&&s.push({item:i,idx:c,matches:[{score:_,value:i,norm:p,indices:g}]})}),s}_searchLogical(t){const a=Bf(t,this.options),l=(p,f,_)=>{if(!p.children){const{keyId:y,searcher:v}=p,b=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(f,y),searcher:v});return b&&b.length?[{idx:_,item:f,matches:b}]:[]}const g=[];for(let y=0,v=p.children.length;y<v;y+=1){const b=p.children[y],k=l(b,f,_);if(k.length)g.push(...k);else if(p.operator===ti.AND)return[]}return g},s=this._myIndex.records,i={},c=[];return s.forEach(({$:p,i:f})=>{if(pl(p)){let _=l(a,p,f);_.length&&(i[f]||(i[f]={idx:f,item:p,matches:[]},c.push(i[f])),_.forEach(({matches:g})=>{i[f].matches.push(...g)}))}}),c}_searchObjectList(t){const a=zr(t,this.options),{keys:l,records:s}=this._myIndex,i=[];return s.forEach(({$:c,i:p})=>{if(!pl(c))return;let f=[];l.forEach((_,g)=>{f.push(...this._findMatches({key:_,value:c[g],searcher:a}))}),f.length&&i.push({idx:p,item:c,matches:f})}),i}_findMatches({key:t,value:a,searcher:l}){if(!pl(a))return[];let s=[];if(as(a))a.forEach(({v:i,i:c,n:p})=>{if(!pl(i))return;const{isMatch:f,score:_,indices:g}=l.searchIn(i);f&&s.push({score:_,key:t,value:i,idx:c,norm:p,indices:g})});else{const{v:i,n:c}=a,{isMatch:p,score:f,indices:_}=l.searchIn(i);p&&s.push({score:f,key:t,value:i,norm:c,indices:_})}return s}}pn.version="7.1.0";pn.createIndex=bf;pn.parseIndex=Fbe;pn.config=$t;pn.parseQuery=Bf;Nbe(Pbe);const Wbe=(Ge.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:u("Manage %1$s",t),path:"/settings/payments/"+e.path}}),Jbe=[{title:u("Dashboard"),path:"/"},{title:u("Orders"),path:"/orders"},{title:u("Create Order"),path:"/orders/add"},{title:u("Customers"),path:"/customers"},{title:u("Products"),path:"/products"},{title:u("Product Inventory"),path:"/products/inventory"},{title:u("Bulk Import Products"),path:"/products/bulk-insert"},{title:u("Integrations"),path:"/integrations"},{title:u("Coupons"),path:"/coupons"},{title:u("Logs"),path:"/logs"},{title:u("Taxes"),path:"/taxes"},{title:u("Reports"),path:"/reports/overview"},{title:u("Sales Report"),path:"/reports/sales"},{title:u("Orders Report"),path:"/reports/orders"},{title:u("Revenue Report"),path:"/reports/revenue"},{title:u("Refunds Report"),path:"/reports/refunds"},{title:u("Subscriptions Report"),path:"/reports/subscriptions"},{title:u("Future Renewals Report"),path:"/reports/subscriptions/future-renewals"},{title:u("Product Report"),path:"/reports/products"},{title:u("Customer Report"),path:"/reports/customer"},{title:u("Traffic Sources Report"),path:"/reports/sources"},...Wbe],Xbe=Jbe.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}})),Zbe=[{title:"Theme",title_resolver:()=>{let t=(De.isDark()?"dark":"light")==="light"?u("Dark"):u("Light");return u("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(De.isDark()?"dark":"light")==="light"?"dark":"light";De.apply(t,{fromShortcut:!0})}}}],Fc={"/settings/store-settings":u("Store Setup"),"/settings/store-settings/pages_setup":u("Pages Setup"),"/settings/store-settings/single_product_setup":u("Single Product & Order Setup"),"/settings/store-settings/cart_and_checkout":u("Cart and Checkout"),"/settings/store-settings/subscriptions_setup":u("Subscriptions Setup"),"/settings/store-settings/checkout_fields":u("Checkout Fields"),"/settings/email_notifications":u("Email Notifications"),"/settings/email_mailing_settings":u("Mailing Settings"),"/settings/email_mailing_settings/reminders":u("Reminders"),"/settings/licensing":u("Licensing"),"/settings/payments":u("Payment Settings"),"/settings/invoice-packing":u("Invoice & Packing Slips"),"/settings/pdf-template":u("PDF Templates"),"/settings/roles":u("Role Settings"),"/settings/addons":u("Features & Addons"),"/settings/tax_settings":u("Tax Settings"),"/settings/tax_settings/tax_rates":u("Tax Rates"),"/settings/tax_settings/eu":u("EU VAT Settings"),"/settings/storage":u("Storage Providers"),"/settings/coupons":u("Coupon Settings")};let xf=[];Object.keys(Fc).forEach(e=>{const t=Fc[e];xf.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:u("Go to %1$s",t),show_description:!1}})});const e0e=[],t0e={Menu:Xbe,Actions:Zbe,Settings:xf,Shortcuts:e0e},Wr=[];Object.entries(t0e).forEach(([e,t])=>{t.forEach((a,l)=>{Wr.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const a0e=()=>({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}]}),l0e={class:"navigable-list-container fct-global-search-result-container"},s0e={key:0,class:"no-results fct-global-search-result-not-found"},n0e={key:1},o0e=["tabindex","onClick","onKeydown"],i0e={__name:"NavigableList",props:{items:{type:Array,required:!0,default:()=>[]},noResultsText:{type:String,default:u("No results found")},onAction:{type:Function,required:!0}},setup(e,{expose:t}){const a=e,l=M(-1),s=Xr("listContainer"),i=M({}),c=(k,w)=>{w&&(i.value[k]=w)},p=k=>{const w=a.items.length;if(w===0)return;const S=w-1;k==="up"?l.value=l.value<=0?S:l.value-1:k==="down"&&(l.value=l.value>=S?0:l.value+1),f()},f=()=>{const k=s.value,w=i.value[l.value];w&&k&&(w.scrollIntoView({behavior:"smooth",block:"nearest"}),ke(()=>{w.focus()}))},_=k=>{l.value=k,g(k)},g=k=>{k>=0&&k<a.items.length&&a.onAction(a.items[k],k)},y=()=>{l.value=-1};return t({focusList:k=>{k=k??a.items.length-1,k>=0&&(l.value=k,ke(()=>{i.value[k]&&i.value[k].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(l.value=0,setTimeout(()=>{g(0)},200)):l.value=-1}}),be(()=>a.items,k=>{y(),k.length>0&&ke(()=>{})},{immediate:!0}),be(l,()=>{}),(k,w)=>(r(),h("div",l0e,[e.items.length===0?(r(),h("div",s0e,[n(J,{name:"Empty/GlobalSearch"}),R(" "+m(e.noResultsText),1)])):(r(),h("div",n0e,[o("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(H,null,ae(e.items,(S,$)=>(r(),h("li",{key:$,ref_for:!0,ref:V=>c($,V),class:de({selected:$===l.value}),tabindex:$,onClick:V=>_($),onKeydown:[w[0]||(w[0]=xa(Ne(V=>p("up"),["prevent"]),["arrow-up"])),w[1]||(w[1]=xa(Ne(V=>p("down"),["prevent"]),["arrow-down"])),xa(V=>g($),["enter"])]},[ba(k.$slots,"default",{item:S,index:$,isSelected:$===l.value},void 0,!0)],42,o0e))),128))],512)]))]))}},Jr=lt(i0e,[["__scopeId","data-v-2379fe26"]]),r0e={class:"fct-search-result-label"},d0e={class:"fct-search-result-title"},u0e={key:0,class:"fct-search-result-subtitle"},c0e={key:1,class:"fct-search-result-subtitle"},A0e={class:"action-icon"},p0e={class:"recent-search-title"},f0e={class:"fct-search-result-label"},m0e={class:"fct-search-result-title"},h0e={key:0,class:"fct-search-result-subtitle"},_0e={key:1,class:"fct-search-result-subtitle"},v0e={class:"action-icon"},ur="recent_actions",g0e={__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=ll();Yt().ctx;const l=e,s=M(0),i=M({}),c=M(),p=(S,$)=>{const F=S.item.data,x=_(F.type);if(x==="link"){let Q=_(F.url);_(F.new_tab)?window.open(Q,"_blank"):window.location.href=Q}else x==="action"&&_(F.action);f(S),l.onActionPerformed()},f=S=>{const $=S.item.id;let V=Qt.get(ur)||[];V=V.filter(F=>F!==$),V.unshift($),V=V.slice(0,5),Qt.set(ur,V)},_=S=>typeof S=="function"?g(S):S,g=async S=>await S({query:l.query,router:a}),y=()=>{var S;(S=c.value)==null||S.resetSelection()},v=()=>{var S;(S=c.value)==null||S.focusList(0)},b=()=>{var S;(S=c.value)==null||S.performFirstAction()};be(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},s.value=Object.keys(i.value).length-1;let S=i.value;for(const $ of Object.keys(S)){const V=S[$];V.item.title_resolver&&(S[$].item.title=await _(V.item.title_resolver))}i.value={...S}});const k=M([]),w=async()=>{const S=Qt.get(ur)||[];let $=it.whereIn(l.searchData,"id",S),V=[];for(const F of $)typeof F.title_resolver=="function"&&(F.title=await _(F.title_resolver)),V.push({item:F});k.value=V};return Ie(()=>{w()}),t({focusList:v,resetSelection:y,performFirstAction:b,fetchRecentActions:w}),(S,$)=>(r(),h(H,null,[e.query||k.value.length<1?(r(),E(Jr,{key:0,items:e.searchResults,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:V,index:F,isSelected:x})=>{var Q,D,T;return[o("span",r0e,[o("span",d0e,m(V.item.title),1),(Q=V.item)!=null&&Q.subtitle?(r(),h("span",u0e,m(V.item.subtitle),1)):((T=(D=V.item)==null?void 0:D.data)==null?void 0:T.show_description)===!0?(r(),h("span",c0e,m(V.item.data.description),1)):B("",!0)]),o("div",A0e,[n(J,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):B("",!0),!e.query&&k.value.length>0?(r(),h(H,{key:1},[o("span",p0e,m(A(u)("Recent Actions")),1),n(Jr,{items:k.value,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:V,index:F,isSelected:x})=>{var Q,D,T;return[o("span",f0e,[o("span",m0e,m(V.item.title),1),(Q=V.item)!=null&&Q.subtitle?(r(),h("span",h0e,m(V.item.subtitle),1)):((T=(D=V.item)==null?void 0:D.data)==null?void 0:T.show_description)===!0?(r(),h("span",_0e,m(V.item.data.description),1)):B("",!0)]),o("div",v0e,[n(J,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):B("",!0)],64))}},y0e=lt(g0e,[["__scopeId","data-v-ccb0ebef"]]),b0e={class:"fct-global-search-product-wrap"},w0e={class:"fct-global-search-product-left-info"},C0e={key:0,class:"type"},k0e={key:0,class:"price-and-status"},B0e={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=l=>l.min_price===l.max_price?Gt(l.min_price,!0):`${Gt(l.min_price,!0)} - ${Gt(l.max_price,!0)}`,a=l=>l==="publish"?u("published"):l==="future"?u("scheduled"):l;return(l,s)=>(r(),h("div",b0e,[o("div",w0e,[n(ld,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",C0e,[R(m(A(ca).headline(e.product.detail.variation_type))+" ",1),s[0]||(s[0]=o("br",null,null,-1)),R(" "+m(A(ca).headline(e.product.detail.fulfillment_type)),1)])):B("",!0)]),e.product.detail?(r(),h("span",k0e,[R(m(t(e.product.detail))+" ",1),(r(),E(ma,{key:e.product.ID,status:e.product.post_status},{default:d(()=>[R(m(a(e.product.post_status)),1)]),_:1},8,["status"]))])):B("",!0)]))}},x0e={class:"fct-global-search-order-wrap"},S0e={class:"fct-global-search-order-header"},F0e={class:"fct-global-search-order-id"},$0e={class:"items"},E0e={class:"fct-global-search-order-header-meta"},U0e={class:"date"},I0e=["innerHTML"],Q0e={class:"customer-name"},D0e={class:"fct-global-search-order-status-wrapper"},V0e=["src","alt"],T0e={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>it.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,l)=>{var i;const s=C("el-tag");return r(),h("div",x0e,[o("div",S0e,[o("div",F0e,[R(" #"+m(e.order.id)+" ",1),o("span",$0e,m(A(u)("%s Items",e.order.order_items.length)),1)]),o("div",E0e,[o("span",U0e,[n(Na,{"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:A(Gt)(e.order.total_amount,!0,!1,e.order.currency)},null,8,I0e),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",Q0e,m(((i=e.order.customer)==null?void 0:i.full_name)||A(u)("No Name")),1)])]),o("div",D0e,[n(ma,{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:A(ca).headline(e.order.payment_method)},null,8,V0e)):(r(),E(s,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:d(()=>[R(m(A(ca).headline(e.order.payment_method)),1)]),_:1}))])])}}},M0e={class:"fct-global-search-customer-wrap"},L0e={class:"fct-customer-card"},R0e={class:"fct-customer-avatar"},O0e=["src"],H0e={class:"fct-customer-details"},P0e={class:"fct-customer-name"},N0e={class:"fct-customer-id"},K0e={class:"fct-customer-email"},G0e={class:"purchase-count"},j0e={class:"date"},z0e={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",M0e,[o("div",L0e,[o("div",R0e,[o("img",{src:e.customer.photo,alt:"avatar"},null,8,O0e)]),o("div",H0e,[o("div",P0e,[R(m(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",N0e,"#"+m(e.customer.id),1)]),o("div",K0e,[R(m(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),o("span",G0e,"Purchase: "+m(e.customer.purchase_count),1)])])]),o("span",j0e,[n(Na,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},q0e={class:"fct-global-search-coupon-wrap"},Y0e={class:"amount"},W0e={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",q0e,[o("span",null,m(e.coupon.title),1),o("span",null,m(e.coupon.code),1),o("span",Y0e,m(A(Gt)(e.coupon.amount,!0)),1)]))}},J0e={class:"fct-global-remote-result-container"},X0e={class:"fct-global-remote-result-label"},Z0e={class:"text"},ewe={class:"navigable-content"},twe={class:"action-icon"},awe={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,s=ll(),i=M({}),c=M(""),p=M(),f=M({}),_=M([]),g=T=>{y.value=!1,_.value=S.data.tableData,l("onRemoteSearchStateChange",!1)},y=M(!1),v={orders:nA({fetch:!1}),products:Hp({fetch:!1}),customers:sA({fetch:!1}),coupons:df({fetch:!1})},b=()=>{},k=()=>{var T;(T=p.value)==null||T.focusList(0)},w=()=>{var T;(T=p.value)==null||T.performFirstAction()};Is(()=>{for(const T of Object.keys(v))v[T].onDataLoaded(g)});let S=null;const $=()=>{S=v[i.value.key],S.data.search=c.value,y.value=!0,S.fetch(),l("onRemoteSearchStateChange",!0)},V=id.debounce($,800),F=(T,U)=>{if(_.value=[],S&&(S.data.search=""),i.value=U,f.value={title:U.title,key:U.key},!T){c.value="";return}c.value=T,V()},x=()=>{s.push({name:f.value.key,query:{search:c.value}}),l("close-modal")},Q={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 Q&&(s.push({name:Q[i.value.key].name,params:{[Q[i.value.key].key]:T.id||T.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:F,focusList:k,resetSelection:b,performFirstAction:w}),(T,U)=>(r(),h("div",J0e,[o("div",X0e,[o("span",Z0e,m(i.value.title),1),f.value.key?(r(),h("span",{key:0,class:"view-all",onClick:x},m(c.value?A(u)('Search "%1$s" in %2$s',c.value,f.value.title):A(u)("See All %s",f.value.title)),1)):B("",!0)]),n(Jr,{items:_.value,"on-action":I=>{D(I)},"no-results-text":c.value?A(u)("No matches found for %s",i.value.title):A(u)("Type something to find %s",i.value.title),ref_key:"navigableList",ref:p},{default:d(({item:I,index:O,isSelected:L})=>[o("div",ewe,[i.value.key==="products"?(r(),E(B0e,{key:0,product:I},null,8,["product"])):B("",!0),i.value.key==="orders"?(r(),E(T0e,{key:1,order:I},null,8,["order"])):B("",!0),i.value.key==="customers"?(r(),E(z0e,{key:2,customer:I},null,8,["customer"])):B("",!0),i.value.key==="coupons"?(r(),E(W0e,{key:3,coupon:I},null,8,["coupon"])):B("",!0)]),o("div",twe,[n(J,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},lwe={class:"fct-global-search-input-wrap"},swe=["aria-label"],nwe={class:"fct-setting-search-icon"},owe={class:"fct-global-search-input-container"},iwe={key:0,class:"searched-item"},rwe={class:"fct-global-searching-for"},dwe={class:"fct-global-searching-for-label"},uwe={class:"fct-global-searching-suggestion-list"},cwe=["onClick"],Awe={class:"dialog-footer is-border"},pwe={class:"fct-search-commands"},fwe={class:"command-key"},mwe={class:"command-key"},hwe={class:"label"},_we={class:"command-key"},vwe={class:"label"},gwe={class:"label"},ywe={__name:"GlobalSearch",setup(e){Yt().ctx,ll();const t=M(!1),a=M(""),l=M({}),s=M(),i=M(""),c=M([u("orders"),u("products"),u("customers"),u("coupons"),u("settings"),u("menus"),u("shortcuts...")]),p=M(0),f=M(!0),_=M(0),g=M(null),y=M(null),v=M(70),b=M(40),k=M(1700),w=()=>{ke(()=>{$()})},S=()=>{var W,j;D.value?(W=X.value)==null||W.resetSelection():(j=F.value)==null||j.resetSelection(),D.value=!1,P.value=!1,V()},$=()=>{var W;(W=s.value)==null||W.focus()},V=()=>{D.value=!1,l.value=[],t.value=!1,a.value="",T.value=null},F=M(),x=W=>{let j=W.includes(","),ie={},he=[];(j?W.split(","):[W]).forEach(se=>{se.includes(":")?Q(se,ie,he):he.push(se)});let ye=[];return Object.keys(ie).forEach(se=>{const fe=ie[se];fe.length>0?fe.forEach($e=>{$e.length>0?ye.push({group:"'"+se,title:$e}):ye.push({group:"'"+se})}):ye.push({group:"'"+se})}),he.forEach(se=>{se.length>0&&ye.push({title:se})}),ye},Q=(W,j,ie)=>{if(W.length===1)return;let he=W.split(":"),me=he[0],ye=he[1];me.length>0?(j.hasOwnProperty(me)||(j[me]=[]),ye.length>0&&j[me].push(ye)):ie.push(ye)},D=M(!1),T=M(null),U=M({o:{key:"orders",title:u("Orders")},p:{key:"products",title:u("Products")},c:{key:"customers",title:u("Customers")},d:{key:"coupons",title:u("Coupons")}}),I=W=>{T.value=W,D.value=!0,l.value={},ke(()=>{var j,ie;(j=X.value)==null||j.fetchData(a.value,W),(ie=s.value)==null||ie.focus()})},O=()=>{var W;l.value=[],T.value=null,a.value="",D.value=!1,(W=s.value)==null||W.focus(),P.value=!1},L=()=>{var W;(W=X.value)==null||W.fetchData(a.value,T.value)},P=M(!1),q=W=>{P.value=W,ke(()=>{var j;(j=s.value)==null||j.focus()})},X=M(),G=_s(),te=()=>{if(t.value){$();return}const W=["o","p","c","d"];G.bind(W,j=>{j.preventDefault();const ie=U.value[j.key];ie&&I(ie)}),t.value=!0,ke(()=>{var j;(j=F.value)==null||j.fetchRecentActions()}),setTimeout(()=>{G.unbind(W)},800)};G.bind(["/"],W=>{!t.value&&ne()||(W.preventDefault(),te())});const ne=()=>{const W=document.activeElement;if(!W)return!1;const j=W.tagName;return j==="INPUT"||j==="TEXTAREA"||j==="SELECT"||W.isContentEditable},re=()=>{if(g.value)return;const W=()=>{if(s.value&&s.value.length>0)return;const ie=c.value[p.value];if(f.value)_.value<ie.length?(i.value=ie.slice(0,_.value+1),_.value++):(f.value=!1,clearTimeout(y.value),y.value=setTimeout(()=>{y.value=null},k.value));else{if(y.value)return;_.value>0?(_.value--,i.value=ie.slice(0,_.value)):(f.value=!0,p.value=(p.value+1)%c.value.length)}},j=()=>{W();const ie=f.value?v.value:y.value?120:b.value;g.value=setTimeout(j,ie)};j()},K=M(!1);let Y;return Ie(()=>{re(),Y=new pn(Wr,a0e());const W=document.getElementById("fct_admin_menu_search");if(W){const j=W.querySelector(".fct-global-search-input-wrap");j&&j.remove()}K.value=!!W,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=te}),xt(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(W,j)=>{const ie=C("el-input"),he=C("el-dialog");return r(),h(H,null,[K.value?(r(),E(li,{key:0,to:"#fct_admin_menu_search"},[o("div",lwe,[o("button",{onClick:te,type:"button",class:"fct-setting-search-button","aria-label":A(u)("Search")},[o("span",nwe,[n(J,{name:"Search"})]),j[6]||(j[6]=o("span",{class:"fct-global-search-button-keys"},[o("kbd",{class:"fct-global-search-button-key"},"/")],-1))],8,swe)])])):B("",!0),n(he,{modelValue:t.value,"onUpdate:modelValue":j[5]||(j[5]=me=>t.value=me),onOpened:w,onClosed:S,class:"fct-global-search-container","append-to-body":!0},{header:d(()=>[o("div",owe,[n(J,{name:"Search",class:"search-icon"}),T.value!=null?(r(),h("div",iwe,[R(m(T.value.title)+" ",1),n(J,{name:"Cross",class:"searched-item-remove",onClick:O})])):B("",!0),n(ie,{class:"mousetrap",placeholder:A(u)("Search for %1$s",i.value),autofocus:"",ref_key:"searchRef",ref:s,id:"fct-global-search-input",disabled:P.value,onKeydown:[j[0]||(j[0]=xa(Ne(()=>{var me,ye;if(D.value){(me=X.value)==null||me.focusList();return}(ye=F.value)==null||ye.focusList()},["prevent"]),["arrow-down"])),j[1]||(j[1]=xa(Ne(()=>{var me,ye;if(D.value){(me=X.value)==null||me.performFirstAction();return}(ye=F.value)==null||ye.performFirstAction()},["prevent"]),["enter"])),j[2]||(j[2]=xa(()=>{a.value.length===0&&(T.value=null,D.value=!1)},["backspace"]))],onInput:j[3]||(j[3]=()=>{if(D.value){L();return}let me=a.value.includes(","),ye=a.value.includes(":");if(!me&&!ye)l.value.value=A(Y).search(a.value);else{const se=x(a.value);l.value.value=A(Y).search({$or:se})}}),modelValue:a.value,"onUpdate:modelValue":j[4]||(j[4]=me=>a.value=me),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:d(()=>[n(va,{visible:!T.value&&a.value.length===0,accordion:""},{default:d(()=>[o("div",rwe,[o("div",dwe,m(A(u)("Searching for")),1),o("div",uwe,[(r(!0),h(H,null,ae(U.value,me=>{var ye;return r(),h("div",{key:me.key,onClick:se=>I(me),class:de(["fct-global-searching-suggestion",((ye=T.value)==null?void 0:ye.key)===me.key?"active":""])},m(me.title),11,cwe)}),128))])])]),_:1},8,["visible"]),D.value?(r(),E(awe,{key:0,ref_key:"remoteResultRef",ref:X,query:a.value,tag:T.value,onCloseModal:V,onOnRemoteSearchStateChange:q},null,8,["query","tag"])):(r(),E(y0e,{key:1,ref_key:"resultListRef",ref:F,query:a.value,"search-results":l.value.value,onActionPerformed:V,focusInput:$,searchData:A(Wr)},null,8,["query","search-results","searchData"])),o("div",Awe,[o("ul",pwe,[o("li",null,[o("span",fwe,[n(J,{name:"ArrowUp"})]),o("span",mwe,[n(J,{name:"ArrowDown"})]),o("span",hwe,m(A(u)("To navigate")),1)]),o("li",null,[o("span",_we,[n(J,{name:"Enter"})]),o("span",vwe,m(A(u)("To select")),1)]),o("li",null,[j[7]||(j[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",gwe,m(A(u)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},bwe={class:"fl_app fluent-cart-admin-pages"},wwe=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=M("");Ie(()=>{jQuery(".notice:not(.fluent-cart), .error:not(.fluent-cart), #ehp-admin-cb").remove(),t.value=a(),l.value=!!document.getElementById("theme-button-container");const c=document.querySelector(".fct_admin_menu_wrap"),p=()=>{window.scrollY>10?c==null||c.classList.add("scroll-header"):c==null||c.classList.remove("scroll-header")};window.addEventListener("scroll",p)});const a=()=>window.location.href,l=M(!1),s=sl();be(()=>s.fullPath,()=>{t.value=a()});const i=N(()=>!(s.fullPath.includes("reports")||s.fullPath.includes("settings")));return(c,p)=>{const f=C("router-view");return r(),h("div",null,[n(ywe),i.value?(r(),E(Da,{key:0})):B("",!0),o("div",bwe,[n(f)]),l.value?(r(),E(li,{key:1,to:"#theme-button-container"},[n(ube)])):B("",!0)])}}});let $c=!1;function Cwe(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:ue.get,$post:ue.post,$put:ue.put,$del:ue.delete,$t:u,$n:Fo,formatMoney(t,a,l=!1){return!t&&l?"":(t||(t="0.00"),Ge.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),Ge.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,l=!1,s){return pt.formatNumber(t,a,l,s)},formatNumberForOrder(t,a,l=!0,s=!1){return pt.formatForOrder(t,a,l,s)},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(s=>!!s).join(", "),l||"no "+a+" address"},getOrderAddress(t,a="billing",l=!1){return fm(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=>{z.success(t)},handleMessage:(t,a="info",l=40,s=1e3)=>{Tc.show(t,a,l,s)},Storage:()=>Qt,buildFormRendererValue(t,a){let l={};return Object.keys(t).forEach(s=>{let i=t[s];["grid"].includes(i.type??"")?l[s]=this.buildFormRendererValue(i.schema??{},a[s]??{}):l[s]=a[s]??""}),l},registerCopyAction(){$c||($c=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&Zl.copy(t.target.textContent)}))},currencySign(){return Ge.get("shop.currency_sign")},getPlaceholderImage(){return ms.getUrl("images/placeholder.svg")},saveLocal(t,a){Qt.set(t,a)},getLocal(t){return Qt.get(t)},hasPermission(t){return In.hasPermission(t)}}}}function kwe(e){e.beforeEach((t,a,l)=>{const s=it.get(t,"meta.permission");return s?In.resolve({permission:s,permissionType:it.get(t,"meta.permissionType")})?l():l({name:"unauthorized"}):(Ge.get("app_config.env"),l())})}function Bwe(e){const t={fluent_cart_products:["fluent_cart_inventory","fluent_cart_attributes"]},a=l=>{if(!l)return;const s="fluent_cart_"+l;Object.entries(t).forEach(([i,c])=>{const p=s===i;c.forEach(f=>{const _=jQuery(".toplevel_page_fluent-cart li."+f);p?_.show():_.hide()})})};e.afterEach((l,s)=>{const i=l.meta.active_menu;jQuery(".fct_menu li").removeClass("active_admin_menu"),jQuery(".fct_menu li.fct_menu_item_"+i).addClass("active_admin_menu"),jQuery(".toplevel_page_fluent-cart li").removeClass("current"),jQuery(".toplevel_page_fluent-cart li.fluent_cart_"+i).addClass("current"),a(i),l.meta.title&&jQuery("head title").text(l.meta.title+" - FluentCart")})}const xwe={mounted(e,t){const a=t.value,l=1e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,f=Math.min(p/l,1),_=(s+f*(a-s)).toFixed(2);e.textContent=_,f<1&&requestAnimationFrame(c)};c()},updated(e,t){const a=t.value,l=2e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,f=Math.min(p/l,1),_=(s+f*(a-s)).toFixed(2);e.textContent=_,f<1&&requestAnimationFrame(c)};c()}},Swe={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,m(A(u)("You are not allowed")),1))}},Fwe=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",ibe);let Ec=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Ec||xl.alert(u("Your session has expired due to inactivity. Please refresh the page to continue."),u("Session Expired"),{confirmButtonText:u("Reload"),callback:t=>{Ec=!1,window.location.reload()}})});const $we=[Wf,Jf,Xf,Lc,Zf,ed,em,tm,ni,am,lm,Oc],jl=Of(wwe);jl.config.globalProperties.appVars=Ge.get();jl.provide("appVars",Ge.get());jl.mixin(Cwe());jl.directive("loading",gm);jl.directive("animate",xwe);Fm(jl);const Dd=Hf({routes:[...Object.values(Fwe),{path:"/unauthorized",name:"unauthorized",component:Swe,props:!0},{path:"/:path(.*)*",name:"NotFound",component:ri,props:!0}],history:Pf(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});jl.use(Dd);kwe(Dd);Bwe(Dd);$we.forEach(e=>{jl.component(e.name,e)});const Vd=Ge.get("el_strings"),Sf=Ge.get("datei18");Vd.el.datepicker.weeks=Sf.weekdaysShort;Vd.el.datepicker.months=Sf.monthsShort;jl.use(ym,{locale:Vd});jl.mount("#fluent_cart_plugin_app");if(Ge.get("has_data_migrations")){let e=0;const t=()=>{ue.post("data-backfills/run").then(a=>{a&&a.status==="running"&&++e<100&&t()}).catch(()=>{})};t()}export{Kn as E};
301