PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.0
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.0, at assets/app.js

295 lines 1.7 MB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var Af=Object.defineProperty;var pf=(e,t,a)=>t in e?Af(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Re=(e,t,a)=>pf(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 L,t as f,F as H,g as ae,h as T,i as Ie,j as Bt,k as qt,l as K,m as Ba,n as re,p as la,q as Ne,s as Fn,T as Gl,v as be,x as Be,y as Gr,z as xa,A as _l,B as Sl,C as ff,D as ya,E as Cl,G as ra,H as mf,I as jl,J as bn,K as vl,L as Xo,M as hf,N as xc,V as Sc,O as Ss,P as _f,Q as jr,R as Ma,S as Gt,U as Vl,W as vf,X as gf,Y as yf,Z as Gs,_ as bf,$ as wf,a0 as Cf,a1 as zr,a2 as kf}from"./chunks/vue.esm-bundler.js?ver=1.6.0";import{u as al,a as ll,o as Fc,c as Bf,b as xf}from"./chunks/vue-router.js?ver=1.6.0";import{_ as J,a as zt}from"./chunks/DynamicIcon.js?ver=1.6.0";import{T as Fs,_ as $s,a as qr,F as Co,b as Ja,P as ln,B as fa,c as $c,d as Sf,e as Ff,m as $f}from"./chunks/Badge.js?ver=1.6.0";import{t as u,a as Zt,A as je,p as ko}from"./chunks/Translator.js?ver=1.6.0";import{_ as bt,P as sl}from"./chunks/Empty.js?ver=1.6.0";import{_ as Yr,a as Ia,b as Ec,c as Uc,L as Wr,d as Jo,O as Ic,e as Zo,P as Xr,C as Yl}from"./chunks/OrderCustomerInformation.js?ver=1.6.0";import{_ as Nt,p as Xs}from"./chunks/UserCan.js?ver=1.6.0";import{C as et}from"./chunks/CurrencyFormatter.js?ver=1.6.0";import{_ as Na,a as Jr,b as Zr,c as Ef,S as Qc,d as Dc,e as Uf,A as Vc,f as Tc}from"./chunks/CancelSubscription.js?ver=1.6.0";import{_ as ka,C as Qe,a as Ce,b as xe}from"./chunks/CardBody.js?ver=1.6.0";import{_ as st}from"./chunks/_plugin-vue_export-helper.js?ver=1.6.0";import{c as If,S as Ot,u as Qf,h as Js,a as sr,g as Mc,f as Df,b as Bs,$ as rl,d as Vf}from"./chunks/common.js?ver=1.6.0";import{I as Ze}from"./chunks/IconButton.js?ver=1.6.0";import{M as nl}from"./chunks/Model.js?ver=1.6.0";import{R as ue}from"./chunks/Rest.js?ver=1.6.0";import{d as at,g as Tf}from"./chunks/dayjs.min.js?ver=1.6.0";import{a as ei,E as Xa,m as Mf,b as dl,d as gs,i as tl,c as Lf,s as Lc,e as Bo,f as ed,r as td,g as Rc,p as Id,w as Rf,h as ti,l as Of,j as qs,k as Hf,n as Pf,o as xo,t as Nf,q as Kf,u as Gf,v as jf,x as zf,y as qf,z as Yf,A as Wf}from"./chunks/index.js?ver=1.6.0";import{n as Y}from"./chunks/Notify.js?ver=1.6.0";import{_ as va}from"./chunks/Animation.js?ver=1.6.0";import{_ as Wl,T as Ve,m as Pa,a as Rl,i as ea,r as Xf,L as nr,b as Oc,d as Hc,c as Pc}from"./chunks/dateShortCuts.js?ver=1.6.0";import{S as Qa,_ as Da,u as ps,a as Jf,b as Zf,c as em}from"./chunks/countries.js?ver=1.6.0";import{u as fs,L as pa,_ as ai}from"./chunks/NotFound.js?ver=1.6.0";import{A as cs}from"./chunks/Asset.js?ver=1.6.0";import{E as tm}from"./chunks/index2.js?ver=1.6.0";import{S as da}from"./chunks/Str.js?ver=1.6.0";import{A as rt}from"./chunks/Arr.js?ver=1.6.0";import{C as hs,V as Zs,_ as oa,c as $n,a as ho,b as am,d as lm}from"./chunks/AttrGroups.js?ver=1.6.0";import{U as en}from"./chunks/Url.js?ver=1.6.0";import{u as li,t as Nc}from"./chunks/timezone.js?ver=1.6.0";import{e as En,i as ad,U as ld,p as sm}from"./chunks/Utils.js?ver=1.6.0";import{_ as sn,P as Kc}from"./chunks/ProductVariationSelector.js?ver=1.6.0";import{f as _a,a as nm,p as om,b as im,g as rm,c as dm,d as um}from"./chunks/productService.js?ver=1.6.0";import{B as So}from"./chunks/BundleProducts.js?ver=1.6.0";import{E as Qd}from"./chunks/index3.js?ver=1.6.0";import{T as Dd}from"./chunks/TransitionAccordion.js?ver=1.6.0";import{_ as Gc}from"./chunks/FileUploaderDialog.js?ver=1.6.0";import{E as Qs,v as cm,i as Am}from"./chunks/defaults.js?ver=1.6.0";import pm from"./chunks/Screenshot.js?ver=1.6.0";import{u as fm}from"./chunks/useElementPlusComponents.js?ver=1.6.0";import"./chunks/AddressComponent2.js?ver=1.6.0";import"./chunks/index4.js?ver=1.6.0";class mm extends Fs{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"}]}getSortableColumns(){return[{label:u("Customer ID"),value:"id"},{label:u("Name"),value:"first_name"},{label:u("Purchases"),value:"purchase_count"},{label:u("Lifetime Value (LTV)"),value:"ltv"},{label:u("Last Purchase Date"),value:"last_purchase_date"},{label:u("Customer Since"),value:"created_at"}]}getSearchHint(){return u("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}}function jc(e){return mm.init(e)}const hm={class:"table-cell"},_m={class:"fct-product-info-card w-full"},vm={class:"fct-product-info-media"},gm={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},ym={class:"fct-product-info-name flex flex-col items-start gap-3"},bm={class:"table-cell"},wm={class:"table-cell"},Cm={class:"table-cell"},km={class:"table-cell"},Bm={class:"table-cell"},xm={__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"),m=C("el-skeleton");return r(),E(m,{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",hm,[o("div",_m,[o("div",vm,[n(i,{variant:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",gm,[o("div",ym,[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",bm,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{label:l.$t("Purchases"),width:"102"},{default:d(()=>[o("div",wm,[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",Cm,[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",km,[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",Bm,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]),_:1})}}},Sm={key:0,class:"fct-customer-card"},Fm={class:"fct-customer-avatar"},$m=["src"],Em={class:"fct-customer-details"},Um={class:"fct-customer-name"},Im={class:"fct-customer-id"},Qm={class:"fct-customer-email"},Dm=["innerHTML"],Vm={key:1},Tm={__name:"CustomersTable",props:{table:{type:Object,required:!0}},setup(e){return(t,a)=>{const l=C("el-table-column"),s=C("el-table");return r(),E(s,{data:e.table.getTableData(),class:"w-full compact-table"},{empty:d(()=>[n(bt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No customer found!")},null,8,["text"])]),default:d(()=>[B("",!0),n(l,{label:A(u)("Customer"),width:"300"},{default:d(i=>{var c;return[n(ka,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>{var p,m,_,g,y;return[(p=i.row)!=null&&p.id?(r(),h("div",Sm,[o("div",Fm,[o("span",null,[o("img",{src:(m=i.row)==null?void 0:m.photo,alt:"avatar"},null,8,$m)])]),o("div",Em,[o("div",Um,[L(f(((_=i.row)==null?void 0:_.full_name)||A(u)("No Name"))+" ",1),o("span",Im,"#"+f(A(Zt)((g=i.row)==null?void 0:g.id)),1)]),o("div",Qm,f((y=i.row)==null?void 0:y.email),1)])])):B("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),n(l,{label:A(u)("Address"),width:"300"},{default:d(i=>{var c;return[n(ka,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[L(f(t.getOrderAddress(i.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),n(l,{label:A(u)("Purchases"),width:90},{default:d(i=>{var c;return[n(ka,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[L(f(A(Zt)(i.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),E(l,{key:1,label:A(u)("LTV"),width:100},{default:d(i=>{var c;return[n(ka,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[o("span",{innerHTML:A(et).formatNumber(i.row.ltv,!0,!1)},null,8,Dm)]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),E(l,{key:2,label:A(u)("Last Purchase Date"),width:"200"},{default:d(i=>{var c;return[n(ka,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[i.row.last_purchase_date?(r(),E(Na,{key:0,"date-time":i.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",Vm,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0),e.table.isColumnVisible("customer_since")?(r(),E(l,{key:3,label:A(u)("Customer Since"),width:"150"},{default:d(i=>{var c;return[n(ka,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[n(Na,{"date-time":i.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},Mm={class:"fct-customer-table-mobile-wrap"},Lm=["onClick"],Rm={class:"fct-customer-table-mobile-header"},Om={key:0,class:"fct-customer-table-customer-col fct-customer-card"},Hm={class:"fct-customer-avatar"},Pm=["src"],Nm={class:"fct-customer-details"},Km={class:"fct-customer-name"},Gm={class:"fct-customer-id"},jm={class:"fct-customer-email"},zm={class:"fct-customer-table-purchases-col"},qm={class:"fct-customer-table-mobile-body"},Ym={class:"fct-customer-table-mobile-body-list"},Wm={key:0,class:"fct-customer-table-ltv-col"},Xm={class:"label"},Jm=["innerHTML"],Zm={key:1,class:"fct-customer-table-last-purchase-date-col"},eh={class:"label"},th={class:"value"},ah={key:2,class:"fct-customer-table-customer-since-col"},lh={class:"label"},sh={class:"value"},nh={class:"fct-customer-table-mobile-footer"},oh={class:"fct-customer-table-address-col"},ih={key:0,class:"py-6 text-center"},rh={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",Mm,[(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",Rm,[l!=null&&l.id?(r(),h("div",Om,[o("div",Hm,[o("img",{src:l==null?void 0:l.photo,alt:"avatar"},null,8,Pm)]),o("div",Nm,[o("div",Km,[L(f((l==null?void 0:l.full_name)||A(u)("No Name"))+" ",1),o("span",Gm,"#"+f(l==null?void 0:l.id),1)]),o("div",jm,f(l==null?void 0:l.email),1)])])):B("",!0),o("div",zm,f(l.purchase_count)+" "+f(l.purchase_count>1?A(u)("Purchases"):A(u)("Purchase")),1)]),o("div",qm,[o("ul",Ym,[e.table.isColumnVisible("ltv")?(r(),h("li",Wm,[o("div",Xm,f(A(u)("LTV:")),1),o("div",{class:"value",innerHTML:A(et).formatNumber(l.ltv,!0,!1)},null,8,Jm)])):B("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",Zm,[o("div",eh,f(A(u)("Last Purchase Date:")),1),o("div",th,[n(Na,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):B("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",ah,[o("div",lh,f(A(u)("Customer Since:")),1),o("div",sh,[n(Na,{"date-time":l.created_at},null,8,["date-time"])])])):B("",!0)])]),o("div",nh,[o("div",oh,[n(J,{name:"LocationPin"}),L(" "+f(t.getOrderAddress(l)),1)])])],8,Lm))),128)),e.table.getTableData().length===0?(r(),h("div",ih,[n(bt,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):B("",!0)]))}},dh={},uh={class:"px-4 py-3"},ch={class:"flex items-center justify-between mb-3"},Ah={class:"flex items-center justify-between mb-3"},ph={class:"flex items-center justify-between mb-3"},fh={class:"flex items-center justify-between mb-3"};function mh(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",uh,[o("div",ch,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",Ah,[n(a,{varient:"p",class:"w-[50px]"}),n(a,{varient:"p",class:"w-[80px]"})]),o("div",ph,[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 hh=st(dh,[["render",mh]]),_h={class:"fct-all-customers-page fct-layout-width"},vh={class:"fct-all-customers-wrap"},gh={key:1},yh={__name:"AllCustomers",setup(e){const t=jc(),a=T({showModal:!1,action:"create",title:u("Create New Customer"),customer:{}}),l=T(!1),s=()=>{l.value=window.innerWidth<768};return Ie(()=>{s(),window.addEventListener("resize",s)}),Bt(()=>{window.removeEventListener("resize",s)}),(i,c)=>{const p=C("el-button");return r(),h("div",_h,[n(Nt,{permission:"customers/manage"},{default:d(()=>[n(sl,{title:A(u)("Customers")},{action:d(()=>[n(p,{type:"primary",onClick:c[0]||(c[0]=m=>a.value.showModal=!0)},{default:d(()=>[L(f(A(u)("Add Customer")),1)]),_:1})]),_:1},8,["title"])]),_:1}),n(Nt,{permission:"customers/view"},{default:d(()=>[o("div",vh,[n($s,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(hh,{key:0})):B("",!0),n(rh,{table:A(t)},null,8,["table"])]),default:d(()=>[A(t).isLoading()?(r(),E(xm,{key:0,customerTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",gh,[n(Tm,{table:A(t)},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),n(Nt,{permission:"customers/manage"},{default:d(()=>[n(Yr,{"onUpdate:customerModal":c[1]||(c[1]=()=>{a.value.showModal=!1,a.value.customer={},A(t).fetch()}),customerModalInfos:a.value,customer_id:a.value.customer_id,customer:a.value.customer,onCloseModal:c[2]||(c[2]=m=>a.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"])]),_:1})])}}};class bh extends Fs{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"}]}getSortableColumns(){return[{label:u("Order ID"),value:"id"},{label:u("Total"),value:"total_amount"},{label:u("Payment Status"),value:"payment_status"},{label:u("Order Status"),value:"status"}]}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["customer.primary_billing_address","order_items"]}}function zc(e){return bh.init(e)}const wh={class:"fct-order-stats-card"},Ch={class:"fct-order-stats-card-head"},kh={class:"fct-order-stats-card-head-content"},Bh={class:"text"},xh={key:0,class:"value"},Sh={class:"fct-order-stats-card-body"},Fh={key:0,class:"change-wrap"},$h={key:0,class:"change-title"},Eh={key:1,class:"change-title"},Uh={key:1,class:"change-wrap"},Ih={class:"change-title"},Qh={__name:"StatCard",props:{direction:String,stat:Object,statRanges:Object,currentRange:String|Number,statKey:String|Number,loading:Boolean},setup(e){const t=qt().ctx,a=e,l=K(()=>{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=K(()=>c.value===0?"":c.value>0?"success":"danger"),i=m=>m.is_cents?t.formatNumber(m.current_count):Zt(m.current_count),c=K(()=>{let m=If(a.stat.current_count,a.stat.compare_count)??0;return m===""?0:m}),p=K(()=>a.statRanges[a.currentRange].label);return(m,_)=>{const g=C("el-skeleton"),y=C("el-skeleton-item");return r(),h("div",wh,[o("div",Ch,[n(Ze,{size:"large",bg:l.value,soft:""},{default:d(()=>[Ba(m.$slots,"icon")]),_:3},8,["bg"]),o("div",kh,[n(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",Bh,f(e.stat.title),1),e.loading?B("",!0):(r(),h("div",xh,f(i(e.stat)),1))])]),o("div",Sh,[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",Fh,[o("span",{class:re("change "+s.value)},[c.value!==0?(r(),E(J,{key:0,name:c.value>0?"CaretUp":"CaretDown"},null,8,["name"])):B("",!0),L(" "+f(c.value===0?m.$t("Same as previous"):Math.abs(c.value)+"%"),1)],2),c.value>0?(r(),h("span",$h,f(A(u)("More than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):c.value<0?(r(),h("span",Eh,f(A(u)("Less than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):B("",!0)])):B("",!0),!e.loading&&e.currentRange==="all_time"?(r(),h("div",Uh,[o("span",Ih,f(m.$t("All Time")),1)])):B("",!0)])])}}},Dh={name:"CardFooter"},Vh={class:"fct-card-footer"};function Th(e,t,a,l,s,i){return r(),h("div",Vh,[Ba(e.$slots,"default")])}const sd=st(Dh,[["render",Th]]);class qc{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 rs{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 Mh extends nl{constructor(){super(...arguments);Re(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:je.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=Mh.init(),Lh={},Rh={class:"fct-order-stats-row"},Oh={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},Hh={class:"flex items-center gap-2 mb-3"},Ph={class:"right flex flex-col flex-1 gap-2"};function Nh(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",Rh,[(r(),h(H,null,ae(4,s=>n(l,{animated:"",key:s},{template:d(()=>[o("div",Oh,[o("div",Hh,[n(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",Ph,[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 Kh=st(Lh,[["render",Nh]]),Gh={class:"fct-order-stats-wrap"},jh={class:"fct-order-stats-actions flex items-center gap-2.5"},zh={class:"fct-order-stats-body"},qh={key:1,class:"fct-order-stats-row"},Yh={class:"flex justify-end mt-2"},Wh=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=T(Ot.get("order_stat_collapse",!1)),a=T(""),l=qt().ctx,s=T(!1),i=T(!0),c=T(!1),p=T("-7 days"),m=al(),_=T({"-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,Ot.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":[at().startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],"-7 days":[at().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],"-30 days":[at().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],this_month:[at().startOf("month").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[w,k]=v[p.value]||[at().startOf("month"),at().endOf("day")],b={startDate:w,endDate:k,paymentStatus:"all"};ol.getDashboardStats({params:{...b}}).then(()=>{s.value=ol.data.dashBoardStats}).catch(x=>{}).finally(()=>{i.value=!1})};return Ie(()=>{p.value=Ot.get("order_quick_stat_bar_range","-0 days");let v=Ot.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,y()}),(v,w)=>{const k=C("el-button");return r(),h("div",Gh,[n(xe,null,{default:d(()=>[n(Qe,{title:A(u)("Order Stats Overview"),border_bottom:""},{action:d(()=>[o("div",jh,[n(qr,{class:"hide-animation-on-mobile"},{default:d(()=>[(r(!0),h(H,null,ae(_.value,(b,x)=>(r(),E(Co,{title:`${A(u)("Order Stats Overview of")} ${b.label}`,tabindex:"0",key:x,onClick:F=>g(x),class:re(x===p.value?"active":"")},{default:d(()=>[L(f(b.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>[o("div",zh,[i.value?(r(),E(Kh,{key:0})):(r(),h("div",qh,[(r(!0),h(H,null,ae(s.value,(b,x)=>(r(),h("div",{key:x,class:"fct-order-stats-col cursor-pointer",onClick:w[0]||(w[0]=F=>A(m).push({name:"reports_orders"}))},[(r(),E(Qh,{key:x,stat:b,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":x},{icon:d(()=>[n(J,{name:b.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",Yh,[n(k,{text:"",class:"underline-link-button",onClick:w[1]||(w[1]=b=>A(m).push({name:"reports_orders"}))},{default:d(()=>[L(f(A(u)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),Xh={class:"table-cell"},Jh={class:"table-cell"},Zh={class:"table-cell"},e_={class:"table-cell"},t_={class:"table-cell items-center gap-1"},a_={class:"table-cell"},l_={class:"table-cell"},s_={class:"table-cell"},n_={__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"),m=C("el-table"),_=C("el-skeleton");return r(),E(_,{animated:""},{template:d(()=>[n(m,{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",Xh,[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",Jh,[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",Zh,[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",e_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{width:"150",label:s.$t("Payment Status")},{default:d(()=>[o("div",t_,[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",a_,[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",l_,[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",s_,[n(p,{variant:"p",class:"w-3/5"})])]),_:1})):B("",!0)]),_:1},8,["data"])]),_:1})}}},o_={},i_={class:"px-4 py-3"},r_={class:"grid grid-cols-3 gap-5 mt-5"};function d_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",i_,[(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",r_,[(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 u_=st(o_,[["render",d_]]),c_={class:"fct-all-orders-page fct-layout-width"},A_={class:"fct-delete-test-orders-content"},p_={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},f_={class:"fct-delete-test-orders-meta"},m_={class:"fct-delete-test-orders-text"},h_={key:0,class:"fct-delete-test-orders-loading"},__={class:"fct-test-orders-loading-content"},v_={class:"fct-loading-bars"},g_=["id"],y_={class:"fct-delete-test-orders-percentage"},b_={class:"fct-delete-test-orders-stats"},w_={class:"fct-delete-test-orders-stat-row"},C_={class:"fct-delete-test-orders-stat-label"},k_={class:"fct-delete-test-orders-stat-value"},B_={class:"fct-delete-test-orders-stat-row"},x_={class:"fct-delete-test-orders-stat-label"},S_={class:"fct-delete-test-orders-stat-value is-success"},F_={class:"fct-delete-test-orders-stat-row"},$_={class:"fct-delete-test-orders-stat-label"},E_={class:"fct-delete-test-orders-stat-value is-danger"},U_={key:1,class:"fct-delete-test-orders-message"},I_={key:0,class:"dialog-footer"},Q_={class:"fct-all-orders-wrap"},D_={__name:"AllOrders",setup(e){const t=zc({instance:qt()}),a=T(!1),l=T(!1),s=T(!1),i=T(!1),c=T({total:0,processed:0,deleted:0,failed:0}),p=T(""),m=K(()=>c.value.total?Math.min(100,Math.round(c.value.processed/c.value.total*100)):0),_=K(()=>{if(!c.value.total)return"";const F=Math.min(c.value.processed,c.value.total);return s.value?u("Deleting %1$s of %2$s Test Orders",F,c.value.total):u("Deleted %1$s of %2$s Test Orders",F,c.value.total)}),g=K(()=>c.value.total?s.value?u("Deleting... %s%",m.value):u("Completed"):""),y=()=>{l.value=window.innerWidth<768},v=()=>{c.value={total:0,processed:0,deleted:0,failed:0},p.value=""},w=F=>{F==="show_order_stats"&&(Ot.set("show_order_stats",!a.value),a.value=!a.value),F==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),F==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),F==="delete_test_orders"&&k()},k=async()=>{var F,M;if(!s.value){try{await Xa.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 $=0,S=0,I=0;for(;;){const D=await ue.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:$}),V=D||{};if(S=S||Number(V.total_count||0),I+=Number(V.batch_count||0),c.value={total:S,processed:I,deleted:c.value.deleted+Number(V.deleted_count||0),failed:c.value.failed+Number(V.failed_count||0)},p.value=V.has_more?u("Processed %1$s of %2$s test orders...",Math.min(I,S),S):(D==null?void 0:D.message)||"",!V.has_more)break;$=Number(V.last_attempted_order_id||0),await new Promise(U=>setTimeout(U,100))}if(!c.value.total){i.value=!1,Y.info(u("No test orders found to delete"));return}const Q=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=Q,Y.success(Q),t.fetch()}catch($){p.value=((F=$==null?void 0:$.data)==null?void 0:F.message)||u("Failed to delete test orders"),Y.error(((M=$==null?void 0:$.data)==null?void 0:M.message)||u("Failed to delete test orders"))}finally{s.value=!1}}},b=()=>{i.value=!1},x=()=>{const F=Ot.get("show_order_stats");F&&(a.value=F)};return Ie(()=>{x(),y(),window.addEventListener("resize",y)}),Bt(()=>{window.removeEventListener("resize",y)}),(F,M)=>{const $=C("el-icon"),S=C("el-button"),I=C("el-dropdown-item"),Q=C("el-dropdown-menu"),D=C("el-dropdown"),V=C("el-tag"),U=C("el-progress"),O=C("el-dialog");return r(),h("div",c_,[n(sl,{title:A(u)("Orders")},{action:d(()=>[n(Nt,{permission:["reports/view","orders/manage"]},{default:d(()=>[n(D,{trigger:"click","popper-class":"fct-dropdown",onCommand:w,placement:"bottom-end"},{dropdown:d(()=>[n(Q,null,{default:d(()=>[n(Nt,{permission:"reports/view"},{default:d(()=>[n(I,{command:"show_order_stats"},{default:d(()=>[a.value?(r(),h(H,{key:1},[n(J,{name:"EyeOff"}),L(" "+f(A(u)("Hide Order Stats")),1)],64)):(r(),h(H,{key:0},[n(J,{name:"Eye"}),L(" "+f(A(u)("Show Order Stats")),1)],64))]),_:1}),A(t).data.showDeleteBulkAction?B("",!0):(r(),E(I,{key:0,command:"show_delete_bulk_action"},{default:d(()=>[n(J,{name:"Eye"}),L(" "+f(A(u)("Show Bulk Actions")),1)]),_:1})),A(t).data.showDeleteBulkAction?(r(),E(I,{key:1,command:"hide_delete_bulk_action"},{default:d(()=>[n(J,{name:"EyeOff"}),L(" "+f(A(u)("Hide Bulk Actions")),1)]),_:1})):B("",!0)]),_:1}),n(Nt,{permission:"orders/manage"},{default:d(()=>[n(I,{command:"delete_test_orders",disabled:s.value,class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(s.value?A(u)("Deleting Test Orders..."):A(u)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),default:d(()=>[n(S,null,{default:d(()=>[L(f(A(u)("More actions"))+" ",1),n($,null,{default:d(()=>[n(A(ei))]),_:1})]),_:1})]),_:1})]),_:1}),n(Nt,{permission:"orders/create"},{default:d(()=>[n(S,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:d(()=>[L(f(A(u)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(O,{modelValue:i.value,"onUpdate:modelValue":M[0]||(M[0]=R=>i.value=R),title:A(u)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:b,class:"fct-delete-test-orders-modal"},{footer:d(()=>[s.value?B("",!0):(r(),h("div",I_,[n(S,{type:"primary",onClick:b},{default:d(()=>[L(f(A(u)("Done")),1)]),_:1})]))]),default:d(()=>[o("div",A_,[o("div",p_,f(_.value),1),o("div",f_,[o("div",m_,f(s.value?A(u)("You can close this — deletion will continue in the background"):A(u)("Test order deletion completed.")),1),g.value?(r(),E(V,{key:0,type:"success",class:re(["fct-delete-test-orders-status",{"is-complete":!s.value}])},{default:d(()=>[L(f(g.value),1)]),_:1},8,["class"])):B("",!0)]),s.value?(r(),h("div",h_,[o("div",__,[o("div",v_,[(r(),h(H,null,ae(8,R=>o("div",{key:R,class:"bar-block",id:`bar-block-${R+1}`},null,8,g_)),64))]),L(" "+f(A(u)("Deleting...")),1)]),o("span",y_,f(m.value)+"% ",1)])):B("",!0),n(va,{visible:s.value,fade:"",duration:300},{default:d(()=>[n(U,{percentage:m.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",b_,[o("div",w_,[M[1]||(M[1]=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",C_,f(A(u)("Processed")),1),o("span",k_,f(c.value.processed)+" / "+f(c.value.total),1)]),o("div",B_,[M[2]||(M[2]=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",x_,f(A(u)("Deleted")),1),o("span",S_,f(c.value.deleted),1)]),o("div",F_,[M[3]||(M[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:"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",$_,f(A(u)("Failed")),1),o("span",E_,f(c.value.failed),1)])]),p.value&&!s.value?(r(),h("p",U_,f(p.value),1)):B("",!0)])]),_:1},8,["modelValue","title"]),n(Nt,{permission:"reports/view"},{default:d(()=>[a.value?(r(),E(Wh,{key:0})):B("",!0)]),_:1}),n(Nt,{permission:"orders/view"},{default:d(()=>[o("div",Q_,[n($s,{table:A(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(u_,{key:0})):B("",!0),A(t).isLoading()?B("",!0):(r(),E(Zr,{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(n_,{key:0,orderTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),E(Jr,{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"]))]),_:1},8,["table"])])]),_:1})])}}},V_={class:"setting-wrap"},T_={class:"setting-wrap-inner"},M_={class:"setting-confirmation-content"},L_={class:"custom-wp-editor-wrapper"},R_={class:"setting-save-action"},O_={__name:"InvoicePacking",setup(e){const t=T([]),a=T([]),l=T(!1),s=T(!1);fs().onSave(()=>{_()});const c=T([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=>{Y.error(g)}).finally(()=>{l.value=!1})},m=()=>{l.value=!0,ue.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{Y.error(g)}).finally(()=>{l.value=!1})},_=()=>{s.value=!0,ue.put("templates/print-templates",{templates:t.value}).then(g=>{Y.success(g.message)}).catch(g=>{Y.error(g)}).finally(()=>{s.value=!1})};return Ie(()=>{p(),m()}),(g,y)=>{const v=C("el-skeleton");return C("el-button"),r(),h("div",V_,[n(Qa,{heading:A(u)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",T_,[n(Da),n(Ja,{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,(w,k)=>(r(),E(xe,{key:k},{default:d(()=>[n(Qe,{title:w,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,(w,k)=>(r(),E(xe,{key:k},{default:d(()=>[n(Qe,{title:w.title+" (Under Development)",border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",M_,[o("div",L_,[n(Wl,{"short-codes":a.value,modelValue:w.content,"onUpdate:modelValue":b=>w.content=b,onUpdate:b=>{w.content=b}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",R_,[B("",!0)])],64)):B("",!0)])])}}},H_={key:0,class:"bg-white p-10 rounded m-10 dark:bg-dark-600"},P_={__name:"PdfTemplateRoute",setup(e){const t=je.get("app_config.isProActive");return(a,l)=>{const s=C("router-view");return A(t)?(r(),E(s,{key:1})):(r(),h("div",H_,[n(ln,{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"])]))}}},N_={class:"setting-wrap"},K_={class:"setting-wrap-inner"},G_={class:"flex gap-5"},j_={class:"flex flex-col items-center justify-center py-12 text-center"},z_={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},q_={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},Y_={class:"fct-pdf-template-desc"},W_={class:"fct-pdf-template-grid"},X_={class:"fct-pdf-template-preview"},J_={class:"fct-pdf-template-preview-placeholder"},Z_={class:"fct-pdf-placeholder-text"},ev={class:"fct-pdf-template-overlay"},tv={class:"fct-pdf-template-footer"},av={class:"fct-pdf-template-name-row"},lv={class:"fct-pdf-template-title"},sv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},nv={__name:"PdfTemplateIndex",setup(e){const t=al(),a=T(!0),l=T(!1),s=T({}),i=T(!1),c=T(""),p=T(!1),m=T(""),_=T(null),g=T(!1),y=T(!1),v=je.get("app_config.isProActive"),w=()=>{a.value=!0,ue.get("settings/pdf-templates/receipt").then($=>{s.value=$.templates||{},l.value=$.has_fluent_pdf||!1,_.value=$.addon_info||null}).catch($=>{var S;Y.error(((S=$.data)==null?void 0:S.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($=>{Y.success($.message||u("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var S;Y.error(((S=$.data)==null?void 0:S.message)||u("Failed to install plugin"))}).finally(()=>{g.value=!1})}},b=()=>{_.value&&(y.value=!0,ue.post("settings/modules/plugin-addons/activate",{plugin_file:_.value.plugin_file}).then($=>{Y.success($.message||u("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var S;Y.error(((S=$.data)==null?void 0:S.message)||u("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},x=()=>{c.value="",i.value=!0},F=()=>{if(!c.value.trim()){Y.error(u("Please enter a template name"));return}p.value=!0,ue.post("settings/pdf-templates/create",{title:c.value.trim()}).then($=>{i.value=!1,Y.success($.message||u("Template created")),$.slug?t.push({name:"edit-pdf-template",params:{template:$.slug}}):w()}).catch($=>{var S;Y.error(((S=$.data)==null?void 0:S.message)||u("Failed to create template"))}).finally(()=>{p.value=!1})},M=$=>{m.value=$,ue.delete("settings/pdf-templates/delete/"+$).then(S=>{Y.success(S.message||u("Template deleted")),w()}).catch(S=>{var I;Y.error(((I=S.data)==null?void 0:I.message)||u("Failed to delete template"))}).finally(()=>{m.value=""})};return Ie(()=>{w()}),($,S)=>{const I=C("el-button"),Q=C("el-skeleton-item"),D=C("el-skeleton"),V=C("el-popconfirm"),U=C("el-input"),O=C("el-form-item"),R=C("el-form"),P=C("el-dialog");return r(),h("div",N_,[n(Qa,{heading:A(u)("PDF Templates"),"show-save-button":!1},la({_:2},[l.value?{name:"action",fn:d(()=>[n(I,{type:"primary",size:"small",onClick:x},{default:d(()=>[L(f(A(u)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",K_,[n(Da),a.value?(r(),E(xe,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(D,{animated:""},{template:d(()=>[n(Q,{variant:"text",class:"w-[300px] mb-4"}),o("div",G_,[n(Q,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),n(Q,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):B("",!0),!a.value&&!l.value&&_.value?(r(),E(xe,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",j_,[S[3]||(S[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",z_,f(A(u)("Fluent PDF Required")),1),o("p",q_,f(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(I,{key:1,type:"success",loading:y.value,onClick:b},{default:d(()=>[L(f(A(u)("Activate Plugin")),1)]),_:1},8,["loading"])):B("",!0):(r(),E(I,{key:0,type:"primary",loading:g.value,onClick:k},{default:d(()=>[L(f(A(v)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):B("",!0),!a.value&&l.value?(r(),E(xe,{key:2},{default:d(()=>[n(Ce,null,{default:d(()=>[o("p",Y_,f(A(u)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",W_,[(r(!0),h(H,null,ae(s.value,(j,q)=>(r(),h("div",{key:q,class:"fct-pdf-template-card"},[o("div",X_,[o("div",J_,[S[4]||(S[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",Z_,f(j.title||A(u)("Receipt Template")),1)]),o("div",ev,[n(I,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:q}}},{default:d(()=>[L(f(A(u)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",tv,[o("div",av,[o("span",lv,f(j.title||q),1),j.is_default?(r(),h("span",sv,f(A(u)("Built-in")),1)):B("",!0)]),j.is_default?B("",!0):(r(),E(V,{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:z=>M(q)},{reference:d(()=>[n(I,{type:"danger",size:"small",text:"",loading:m.value===q,class:"fct-pdf-delete-btn"},{default:d(()=>S[5]||(S[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":S[2]||(S[2]=j=>i.value=j),title:A(u)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:d(()=>[n(I,{onClick:S[1]||(S[1]=j=>i.value=!1)},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(I,{type:"primary",onClick:F,loading:p.value},{default:d(()=>[L(f(A(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[n(R,{onSubmit:Ne(F,["prevent"]),"label-position":"top"},{default:d(()=>[n(O,{label:A(u)("Template Name")},{default:d(()=>[n(U,{modelValue:c.value,"onUpdate:modelValue":S[0]||(S[0]=j=>c.value=j),placeholder:A(u)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},ov={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},iv={class:"fct-email-body-skeleton"},rv={class:"fct-email-body-skeleton__page"},dv={key:0,class:"fct-ebs__badge"},uv={class:"fct-ebs__badge-text"};function cv(e,t,a,l,s,i){return r(),h("div",iv,[o("div",rv,[t[3]||(t[3]=Fn('<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",dv,[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",uv,f(e.$t("Loading block editor…")),1)])):B("",!0)])])}const or=st(ov,[["render",cv]]),Av={name:"NewEditorFrame",components:{EmailBodySkeleton:or},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)}}},pv={style:{width:"100%"}},fv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},mv={class:"editor-container",style:{position:"relative"}},hv={key:0,class:"fct-editor-skeleton"},_v={ref:"iframeContainer",class:"iframe-container"};function vv(e,t,a,l,s,i){const c=C("EmailBodySkeleton");return r(),h("div",pv,[i.editorFailed?(r(),h("div",fv,[o("p",null,f(e.$t("Problem with loading the editor. Please reload the page.")),1)])):B("",!0),o("div",mv,[n(Gl,{name:"fct-skeleton-fade"},{default:d(()=>[s.editorContentReady?B("",!0):(r(),h("div",hv,[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",_v,null,512)])])}const Yc=st(Av,[["render",vv],["__scopeId","data-v-e5dae537"]]),gv={class:"setting-wrap fct-pdf-template-edit-wrapper"},yv={class:"capitalize"},bv={class:"setting-wrap-inner"},wv={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},Cv={class:"setting-save-action"},kv={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=al(),l=T(!0),s=T(!1),i=T(!1),c=T(!1),p=T(null),m=T(null),_=T(""),g=S=>{const I=atob(S),Q=new Array(I.length);for(let D=0;D<I.length;D++)Q[D]=I.charCodeAt(D);return new Blob([new Uint8Array(Q)],{type:"application/pdf"})},y=async()=>{const S=await ue.post("settings/pdf-templates/download",{template_id:t.template});if(!(S!=null&&S.pdf_base64))throw new Error(u("Failed to generate PDF"));return S},v=()=>{l.value=!0,ue.get("settings/pdf-templates/receipt/"+t.template).then(S=>{var Q,D,V;p.value=S.template;const I=(V=(D=(Q=S.template)==null?void 0:Q.pdf_settings)==null?void 0:D[0])==null?void 0:V.pdf_structure;I&&(_.value=I.content||"")}).catch(S=>{var I;Y.error(((I=S.data)==null?void 0:I.message)||u("Failed to load template"))}).finally(()=>{l.value=!1})},w=async({showSuccess:S=!0}={})=>{var Q,D,V,U;s.value=!0,m.value&&await m.value.forceAutosave();const I=((V=(D=(Q=p.value)==null?void 0:Q.pdf_settings)==null?void 0:D[0])==null?void 0:V.pdf_structure)||{};I.content=_.value;try{const O=await ue.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:I});return S&&Y.success(O.message||u("Template saved")),!0}catch(O){return Y.error(((U=O.data)==null?void 0:U.message)||u("Failed to save template")),!1}finally{s.value=!1}},k=()=>{i.value=!0,y().then(S=>{const I=g(S.pdf_base64),Q=URL.createObjectURL(I),D=document.createElement("a");D.href=Q,D.download=S.filename||"receipt-test.pdf",document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(Q),Y.success(u("PDF downloaded"))}).catch(S=>{var I;Y.error(((I=S.data)==null?void 0:I.message)||S.message||u("Failed to generate PDF"))}).finally(()=>{i.value=!1})},b=async()=>{var S;c.value=!0;try{const I=await y(),Q=g(I.pdf_base64),D=URL.createObjectURL(Q),V=document.createElement("a");V.href=D,V.target="_blank",V.rel="noopener",document.body.appendChild(V),V.click(),document.body.removeChild(V),setTimeout(()=>{URL.revokeObjectURL(D)},1e4)}catch(I){Y.error(((S=I.data)==null?void 0:S.message)||I.message||u("Failed to generate PDF"))}finally{c.value=!1}},x=async()=>{s.value||i.value||c.value||!await w({showSuccess:!1})||await b()},F=()=>p.value&&!p.value.is_default,M=()=>{ue.delete("settings/pdf-templates/delete/"+t.template).then(S=>{Y.success(S.message||u("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(S=>{var I;Y.error(((I=S.data)==null?void 0:I.message)||u("Failed to delete template"))})},$=()=>{ue.get("settings/pdf-templates/factory-default").then(S=>{var D,V,U;const I=(D=S.templates)==null?void 0:D[t.template];if(!I)return;const Q=((U=(V=I.pdf_settings)==null?void 0:V[0])==null?void 0:U.pdf_structure)||{};return ue.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:Q}).then(()=>{Y.success(u("Reverted to default template")),v()})}).catch(S=>{var I;Y.error(((I=S.data)==null?void 0:I.message)||u("Failed to revert template"))})};return Ie(()=>{v()}),(S,I)=>{const Q=C("el-breadcrumb-item"),D=C("el-breadcrumb"),V=C("el-icon"),U=C("el-button"),O=C("el-dropdown-item"),R=C("el-dropdown-menu"),P=C("el-dropdown"),j=C("el-skeleton-item"),q=C("el-skeleton");return r(),h("div",gv,[n(Qa,{loading:s.value,"loading-text":A(u)("Saving"),"save-button-text":A(u)("Save Template"),onOnSave:w},{heading:d(()=>[n(D,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(Q,{to:{path:"/settings/pdf-template"}},{default:d(()=>[L(f(A(u)("PDF Templates")),1)]),_:1}),n(Q,null,{default:d(()=>{var z;return[o("span",yv,f(((z=p.value)==null?void 0:z.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(R,null,{default:d(()=>[n(O,{onClick:k,disabled:i.value},{default:d(()=>[L(f(i.value?A(u)("Downloading..."):A(u)("Test Download")),1)]),_:1},8,["disabled"]),n(O,{onClick:$},{default:d(()=>[L(f(A(u)("Revert to Default")),1)]),_:1}),F()?(r(),E(O,{key:0,divided:"",onClick:M,style:{color:"#F56C6C"}},{default:d(()=>[L(f(A(u)("Delete Template")),1)]),_:1})):B("",!0)]),_:1})]),default:d(()=>[n(U,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:d(()=>[n(V,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:d(()=>[n(A(Mf))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",bv,[n(Da),n(q,{loading:l.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:d(()=>[n(j,{variant:"h3",class:"w-[200px] mb-5"}),n(j,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!l.value&&p.value?(r(),h(H,{key:0},[o("div",wv,[n(Yc,{ref_key:"editorFrameRef",ref:m,editorParams:{block_type:"pdf_template",campaign_title:p.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:p.value.title||A(u)("Receipt Template"),onPreviewRequest:x,modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=z=>_.value=z)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",Cv,[n(U,{onClick:w,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[L(f(A(u)("Save Template")),1)]),_:1},8,["disabled","loading"]),n(U,{onClick:k,disabled:i.value,loading:i.value},{default:d(()=>[L(f(A(u)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):B("",!0)])])}}},Bv={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",Bv,[(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,"")},f(l),1))),128))]))}}),_o={__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"])}}},xv={class:"setting-wrap"},Sv={class:"setting-wrap-inner"},Fv={class:"grid gap-3 mb-6"},$v={class:"grid gap-3 mb-6"},Ev={class:"grid gap-3 mb-6"},Uv={class:"grid gap-3"},Iv={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},Qv=["href"],Dv={class:"form-note"},Vv={class:"form-note"},Tv=["href"],Mv={class:"mb-4"},Lv={class:"mb-4"},Rv={class:"form-note"},Ov={class:"form-note"},Hv={class:"form-note"},Pv={class:"form-note"},Nv={class:"setting-save-action"},Kv={__name:"PdfTemplateSettings",setup(e){const t=T(!0),a=T(!1),l=T({}),s=T(!0),i=T(""),c=T({zugferd_enabled:"0",zugferd_profile:"en16931",seller_legal_registration_scheme:"",seller_contact_name:"",seller_contact_email:"",seller_contact_phone:"",seller_bank_iban:"",seller_bank_bic:"",seller_bank_account_name:"",seller_electronic_address:""}),p=[{label:"EN 16931 (ZUGFeRD)",value:"en16931"}],m=[{value:"",label: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"}];fs().onSave(()=>{y()});const g=()=>{t.value=!0,ue.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(c.value).forEach(w=>{v.seller_details[w]!==void 0&&(c.value[w]=v.seller_details[w])}),s.value=v.store_country_set!==!1,i.value=v.store_settings_url||""}).catch(v=>{var w;Y.error(((w=v.data)==null?void 0:w.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=>{Y.success(v.message||u("Settings saved"))}).catch(v=>{var w,k;v.status_code===422&&((w=v.data)!=null&&w.data)&&(l.value=v.data.data),Y.error(((k=v.data)==null?void 0:k.message)||u("Failed to save settings"))}).finally(()=>{a.value=!1})};return Ie(()=>{g()}),(v,w)=>{const k=C("el-skeleton-item"),b=C("el-skeleton"),x=C("el-switch"),F=C("el-option"),M=C("el-select"),$=C("el-form-item"),S=C("el-col"),I=C("el-row"),Q=C("el-input"),D=C("el-divider"),V=C("el-button");return r(),h("div",xv,[n(Qa,{heading:A(u)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",Sv,[n(Da),t.value?(r(),E(xe,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(b,{animated:""},{template:d(()=>[o("div",Fv,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",$v,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",Ev,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",Uv,[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",Iv,[o("strong",null,f(A(u)("Store country is not configured.")),1),L(" "+f(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"},f(A(u)("Go to Store Settings")),9,Qv)):B("",!0)])):B("",!0),n(xe,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(x,{modelValue:c.value.zugferd_enabled,"onUpdate:modelValue":w[0]||(w[0]=U=>c.value.zugferd_enabled=U),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[n(I,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("ZUGFeRD Profile"),"label-position":"top"},{default:d(()=>[n(M,{modelValue:c.value.zugferd_profile,"onUpdate:modelValue":w[1]||(w[1]=U=>c.value.zugferd_profile=U)},{default:d(()=>[(r(),h(H,null,ae(p,U=>n(F,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",Dv,[o("p",null,f(A(u)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Legal Registration Scheme"),"label-position":"top"},{default:d(()=>[n(M,{modelValue:c.value.seller_legal_registration_scheme,"onUpdate:modelValue":w[2]||(w[2]=U=>c.value.seller_legal_registration_scheme=U),placeholder:A(u)("Select scheme"),clearable:"",filterable:""},{default:d(()=>[(r(),h(H,null,ae(m,U=>n(F,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",Vv,[o("p",null,f(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(_o,{type:"info",closable:!1,"show-icon":"",class:"mb-4"},{default:d(()=>[L(f(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:""},f(A(u)("Store Settings → Business Details")),9,Tv)):B("",!0)]),_:1}),o("h4",Mv,f(A(u)("Seller Contact")),1),n(I,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Contact Name"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_contact_name,"onUpdate:modelValue":w[3]||(w[3]=U=>c.value.seller_contact_name=U)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Contact Email"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_contact_email,"onUpdate:modelValue":w[4]||(w[4]=U=>c.value.seller_contact_email=U),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(I,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Contact Phone"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_contact_phone,"onUpdate:modelValue":w[5]||(w[5]=U=>c.value.seller_contact_phone=U)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n(D),o("h4",Lv,f(A(u)("Seller Bank Details")),1),n(I,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Bank IBAN"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_bank_iban,"onUpdate:modelValue":w[6]||(w[6]=U=>c.value.seller_bank_iban=U)},null,8,["modelValue"]),n(fl,{"validation-errors":l.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),o("div",Rv,[o("p",null,f(A(u)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Bank BIC"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_bank_bic,"onUpdate:modelValue":w[7]||(w[7]=U=>c.value.seller_bank_bic=U)},null,8,["modelValue"]),o("div",Ov,[o("p",null,f(A(u)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),n(I,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Bank Account Name"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_bank_account_name,"onUpdate:modelValue":w[8]||(w[8]=U=>c.value.seller_bank_account_name=U)},null,8,["modelValue"]),o("div",Hv,[o("p",null,f(A(u)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n($,{label:A(u)("Electronic Address"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_electronic_address,"onUpdate:modelValue":w[9]||(w[9]=U=>c.value.seller_electronic_address=U)},null,8,["modelValue"]),o("div",Pv,[o("p",null,f(A(u)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),o("div",Nv,[n(V,{type:"primary",onClick:w[10]||(w[10]=U=>y()),loading:a.value},{default:d(()=>[L(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},Gv={name:"CustomersRoute"},jv={class:"fca_customers_route"};function zv(e,t,a,l,s,i){const c=C("router-view");return r(),h("div",jv,[n(c)])}const qv=st(Gv,[["render",zv]]);/*!
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 ir=function(e,t){return ir=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])},ir(e,t)};function Ul(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ir(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var rr=function(){return rr=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},rr.apply(this,arguments)};function el(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 m(g){try{_(l.throw(g))}catch(y){c(y)}}function _(g){g.done?i(g.value):s(g.value).then(p,m)}_((l=l.apply(e,[])).next())})}function qa(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 m([_,g])}}function m(_){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 Hn(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 Xl=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}(),si=function(e,t){return Xl.fromClientRect(e,t.getBoundingClientRect())},Yv=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 Xl(0,0,l,s)},ni=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},Vd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wv=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Pn=0;Pn<Vd.length;Pn++)Wv[Vd.charCodeAt(Pn)]=Pn;var Td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Nn=0;Nn<Td.length;Nn++)fn[Td.charCodeAt(Nn)]=Nn;var Xv=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,m;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=fn[e.charCodeAt(l)],c=fn[e.charCodeAt(l+1)],p=fn[e.charCodeAt(l+2)],m=fn[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|m&63;return _},Jv=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},Zv=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},Cs=5,nd=11,wi=2,eg=nd-Cs,Wc=65536>>Cs,tg=1<<Cs,Ci=tg-1,ag=1024>>Cs,lg=Wc+ag,sg=lg,ng=32,og=sg+ng,ig=65536>>nd,rg=1<<eg,dg=rg-1,Md=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},ug=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},cg=function(e,t){var a=Xv(e),l=Array.isArray(a)?Zv(a):new Uint32Array(a),s=Array.isArray(a)?Jv(a):new Uint16Array(a),i=24,c=Md(s,i/2,l[4]/2),p=l[5]===2?Md(s,(i+l[4])/2):ug(l,Math.ceil((i+l[4])/4));return new Ag(l[0],l[1],l[2],l[3],c,p)},Ag=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>>Cs],a=(a<<wi)+(t&Ci),this.data[a];if(t<=65535)return a=this.index[Wc+(t-55296>>Cs)],a=(a<<wi)+(t&Ci),this.data[a];if(t<this.highStart)return a=og-ig+(t>>nd),a=this.index[a],a+=t>>Cs&dg,a=this.index[a],a=(a<<wi)+(t&Ci),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Ld="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Kn=0;Kn<Ld.length;Kn++)pg[Ld.charCodeAt(Kn)]=Kn;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==",Rd=50,mg=1,Xc=2,Jc=3,hg=4,_g=5,Od=7,Zc=8,Hd=9,ss=10,dr=11,Pd=12,ur=13,vg=14,mn=15,cr=16,Gn=17,un=18,gg=19,Nd=20,Ar=21,cn=22,ki=23,Ds=24,cl=25,hn=26,_n=27,Vs=28,yg=29,ys=30,bg=31,jn=32,zn=33,pr=34,fr=35,mr=36,Un=37,hr=38,vo=39,go=40,Bi=41,eA=42,wg=43,Cg=[9001,65288],tA="!",Pt="×",qn="÷",_r=cg(fg),Nl=[ys,mr],vr=[mg,Xc,Jc,_g],aA=[ss,Zc],Kd=[_n,hn],kg=vr.concat(aA),Gd=[hr,vo,go,pr,fr],Bg=[mn,ur],xg=function(e,t){t===void 0&&(t="strict");var a=[],l=[],s=[];return e.forEach(function(i,c){var p=_r.get(i);if(p>Rd?(s.push(!0),p-=Rd):s.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return l.push(c),a.push(cr);if(p===hg||p===dr){if(c===0)return l.push(c),a.push(ys);var m=a[c-1];return kg.indexOf(m)===-1?(l.push(l[c-1]),a.push(m)):(l.push(c),a.push(ys))}if(l.push(c),p===bg)return a.push(t==="strict"?Ar:Un);if(p===eA||p===yg)return a.push(ys);if(p===wg)return i>=131072&&i<=196605||i>=196608&&i<=262141?a.push(Un):a.push(ys);a.push(p)}),[l,a,s]},xi=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!==ss)break}if(s===ss)for(var i=a;i>0;){i--;var p=l[i];if(Array.isArray(e)?e.indexOf(p)!==-1:e===p)for(var m=a;m<=l.length;){m++;var c=l[m];if(c===t)return!0;if(c!==ss)break}if(p!==ss)break}return!1},jd=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===ss)a--;else return l}return 0},Sg=function(e,t,a,l,s){if(a[l]===0)return Pt;var i=l-1;if(Array.isArray(s)&&s[i]===!0)return Pt;var c=i-1,p=i+1,m=t[i],_=c>=0?t[c]:0,g=t[p];if(m===Xc&&g===Jc)return Pt;if(vr.indexOf(m)!==-1)return tA;if(vr.indexOf(g)!==-1||aA.indexOf(g)!==-1)return Pt;if(jd(i,t)===Zc)return qn;if(_r.get(e[i])===dr||(m===jn||m===zn)&&_r.get(e[p])===dr||m===Od||g===Od||m===Hd||[ss,ur,mn].indexOf(m)===-1&&g===Hd||[Gn,un,gg,Ds,Vs].indexOf(g)!==-1||jd(i,t)===cn||xi(ki,cn,i,t)||xi([Gn,un],Ar,i,t)||xi(Pd,Pd,i,t))return Pt;if(m===ss)return qn;if(m===ki||g===ki)return Pt;if(g===cr||m===cr)return qn;if([ur,mn,Ar].indexOf(g)!==-1||m===vg||_===mr&&Bg.indexOf(m)!==-1||m===Vs&&g===mr||g===Nd||Nl.indexOf(g)!==-1&&m===cl||Nl.indexOf(m)!==-1&&g===cl||m===_n&&[Un,jn,zn].indexOf(g)!==-1||[Un,jn,zn].indexOf(m)!==-1&&g===hn||Nl.indexOf(m)!==-1&&Kd.indexOf(g)!==-1||Kd.indexOf(m)!==-1&&Nl.indexOf(g)!==-1||[_n,hn].indexOf(m)!==-1&&(g===cl||[cn,mn].indexOf(g)!==-1&&t[p+1]===cl)||[cn,mn].indexOf(m)!==-1&&g===cl||m===cl&&[cl,Vs,Ds].indexOf(g)!==-1)return Pt;if([cl,Vs,Ds,Gn,un].indexOf(g)!==-1)for(var y=i;y>=0;){var v=t[y];if(v===cl)return Pt;if([Vs,Ds].indexOf(v)!==-1)y--;else break}if([_n,hn].indexOf(g)!==-1)for(var y=[Gn,un].indexOf(m)!==-1?c:i;y>=0;){var v=t[y];if(v===cl)return Pt;if([Vs,Ds].indexOf(v)!==-1)y--;else break}if(hr===m&&[hr,vo,pr,fr].indexOf(g)!==-1||[vo,pr].indexOf(m)!==-1&&[vo,go].indexOf(g)!==-1||[go,fr].indexOf(m)!==-1&&g===go||Gd.indexOf(m)!==-1&&[Nd,hn].indexOf(g)!==-1||Gd.indexOf(g)!==-1&&m===_n||Nl.indexOf(m)!==-1&&Nl.indexOf(g)!==-1||m===Ds&&Nl.indexOf(g)!==-1||Nl.concat(cl).indexOf(m)!==-1&&g===cn&&Cg.indexOf(e[p])===-1||Nl.concat(cl).indexOf(g)!==-1&&m===un)return Pt;if(m===Bi&&g===Bi){for(var w=a[i],k=1;w>0&&(w--,t[w]===Bi);)k++;if(k%2!==0)return Pt}return m===jn&&g===zn?Pt:qn},Fg=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=xg(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,ys,eA].indexOf(p)!==-1?Un:p}));var c=t.wordBreak==="keep-all"?i.map(function(p,m){return p&&e[m]>=19968&&e[m]<=40959}):void 0;return[l,s,c]},$g=function(){function e(t,a,l,s){this.codePoints=t,this.required=a===tA,this.start=l,this.end=s}return e.prototype.slice=function(){return Ua.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Eg=function(e,t){var a=ni(e),l=Fg(a,t),s=l[0],i=l[1],c=l[2],p=a.length,m=0,_=0;return{next:function(){if(_>=p)return{done:!0,value:null};for(var g=Pt;_<p&&(g=Sg(a,i,s,++_,c))===Pt;);if(g!==Pt||_===p){var y=new $g(a,g,m,_);return m=_,{value:y,done:!1}}return{done:!0,value:null}}}},Ug=1,Ig=2,Tn=4,zd=8,Fo=10,qd=47,wn=92,Qg=9,Dg=32,Yn=34,An=61,Vg=35,Tg=36,Mg=37,Wn=39,Xn=40,pn=41,Lg=95,il=45,Rg=33,Og=60,Hg=62,Pg=64,Ng=91,Kg=93,Gg=61,jg=123,Jn=63,zg=125,Yd=124,qg=126,Yg=128,Wd=65533,Si=42,ws=43,Wg=44,Xg=58,Jg=59,In=46,Zg=0,ey=8,ty=11,ay=14,ly=31,sy=127,Dl=-1,lA=48,sA=97,nA=101,ny=102,oy=117,iy=122,oA=65,iA=69,rA=70,ry=85,dy=90,Wa=function(e){return e>=lA&&e<=57},uy=function(e){return e>=55296&&e<=57343},Ts=function(e){return Wa(e)||e>=oA&&e<=rA||e>=sA&&e<=ny},cy=function(e){return e>=sA&&e<=iy},Ay=function(e){return e>=oA&&e<=dy},py=function(e){return cy(e)||Ay(e)},fy=function(e){return e>=Yg},Zn=function(e){return e===Fo||e===Qg||e===Dg},$o=function(e){return py(e)||fy(e)||e===Lg},Xd=function(e){return $o(e)||Wa(e)||e===il},my=function(e){return e>=Zg&&e<=ey||e===ty||e>=ay&&e<=ly||e===sy},ls=function(e,t){return e!==wn?!1:t!==Fo},eo=function(e,t,a){return e===il?$o(t)||ls(t,a):$o(e)?!0:!!(e===wn&&ls(e,t))},Fi=function(e,t,a){return e===ws||e===il?Wa(t)?!0:t===In&&Wa(a):Wa(e===In?t:e)},hy=function(e){var t=0,a=1;(e[t]===ws||e[t]===il)&&(e[t]===il&&(a=-1),t++);for(var l=[];Wa(e[t]);)l.push(e[t++]);var s=l.length?parseInt(Ua.apply(void 0,l),10):0;e[t]===In&&t++;for(var i=[];Wa(e[t]);)i.push(e[t++]);var c=i.length,p=c?parseInt(Ua.apply(void 0,i),10):0;(e[t]===iA||e[t]===nA)&&t++;var m=1;(e[t]===ws||e[t]===il)&&(e[t]===il&&(m=-1),t++);for(var _=[];Wa(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,m*g)},_y={type:2},vy={type:3},gy={type:4},yy={type:13},by={type:8},wy={type:21},Cy={type:9},ky={type:10},By={type:11},xy={type:12},Sy={type:14},to={type:23},Fy={type:1},$y={type:25},Ey={type:24},Uy={type:26},Iy={type:27},Qy={type:28},Dy={type:29},Vy={type:31},gr={type:32},dA=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(ni(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==gr;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case Yn:return this.consumeStringToken(Yn);case Vg:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Xd(a)||ls(l,s)){var i=eo(a,l,s)?Ig:Ug,c=this.consumeName();return{type:5,value:c,flags:i}}break;case Tg:if(this.peekCodePoint(0)===An)return this.consumeCodePoint(),yy;break;case Wn:return this.consumeStringToken(Wn);case Xn:return _y;case pn:return vy;case Si:if(this.peekCodePoint(0)===An)return this.consumeCodePoint(),Sy;break;case ws:if(Fi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Wg:return gy;case il:var p=t,m=this.peekCodePoint(0),_=this.peekCodePoint(1);if(Fi(p,m,_))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(eo(p,m,_))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(m===il&&_===Hg)return this.consumeCodePoint(),this.consumeCodePoint(),Ey;break;case In:if(Fi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case qd:if(this.peekCodePoint(0)===Si)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===Si&&(g=this.consumeCodePoint(),g===qd))return this.consumeToken();if(g===Dl)return this.consumeToken()}break;case Xg:return Uy;case Jg:return Iy;case Og:if(this.peekCodePoint(0)===Rg&&this.peekCodePoint(1)===il&&this.peekCodePoint(2)===il)return this.consumeCodePoint(),this.consumeCodePoint(),$y;break;case Pg:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),w=this.peekCodePoint(2);if(eo(y,v,w)){var c=this.consumeName();return{type:7,value:c}}break;case Ng:return Qy;case wn:if(ls(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case Kg:return Dy;case Gg:if(this.peekCodePoint(0)===An)return this.consumeCodePoint(),by;break;case jg:return By;case zg:return xy;case oy:case ry:var k=this.peekCodePoint(0),b=this.peekCodePoint(1);return k===ws&&(Ts(b)||b===Jn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case Yd:if(this.peekCodePoint(0)===An)return this.consumeCodePoint(),Cy;if(this.peekCodePoint(0)===Yd)return this.consumeCodePoint(),wy;break;case qg:if(this.peekCodePoint(0)===An)return this.consumeCodePoint(),ky;break;case Dl:return gr}return Zn(t)?(this.consumeWhiteSpace(),Vy):Wa(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):$o(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();Ts(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var l=!1;a===Jn&&t.length<6;)t.push(a),a=this.consumeCodePoint(),l=!0;if(l){var s=parseInt(Ua.apply(void 0,t.map(function(m){return m===Jn?lA:m})),16),i=parseInt(Ua.apply(void 0,t.map(function(m){return m===Jn?rA:m})),16);return{type:30,start:s,end:i}}var c=parseInt(Ua.apply(void 0,t),16);if(this.peekCodePoint(0)===il&&Ts(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var p=[];Ts(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)===Xn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Xn?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dl)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===Wn||a===Yn){var l=this.consumeStringToken(this.consumeCodePoint());return l.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dl||this.peekCodePoint(0)===pn)?(this.consumeCodePoint(),{type:22,value:l.value}):(this.consumeBadUrlRemnants(),to)}for(;;){var s=this.consumeCodePoint();if(s===Dl||s===pn)return{type:22,value:Ua.apply(void 0,t)};if(Zn(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Dl||this.peekCodePoint(0)===pn?(this.consumeCodePoint(),{type:22,value:Ua.apply(void 0,t)}):(this.consumeBadUrlRemnants(),to);if(s===Yn||s===Wn||s===Xn||my(s))return this.consumeBadUrlRemnants(),to;if(s===wn)if(ls(s,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),to;else t.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;Zn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===pn||t===Dl)return;ls(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===Dl||s===void 0||s===t)return a+=this.consumeStringSlice(l),{type:0,value:a};if(s===Fo)return this._value.splice(0,l),Fy;if(s===wn){var i=this._value[l+1];i!==Dl&&i!==void 0&&(i===Fo?(a+=this.consumeStringSlice(l),l=-1,this._value.shift()):ls(s,i)&&(a+=this.consumeStringSlice(l),a+=Ua(this.consumeEscapedCodePoint()),l=-1))}l++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=Tn,l=this.peekCodePoint(0);for((l===ws||l===il)&&t.push(this.consumeCodePoint());Wa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(l===In&&Wa(s))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=zd;Wa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===iA||l===nA)&&((s===ws||s===il)&&Wa(i)||Wa(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=zd;Wa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[hy(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(eo(s,i,c)){var p=this.consumeName();return{type:15,number:a,flags:l,unit:p}}return s===Mg?(this.consumeCodePoint(),{type:16,number:a,flags:l}):{type:17,number:a,flags:l}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(Ts(t)){for(var a=Ua(t);Ts(this.peekCodePoint(0))&&a.length<6;)a+=Ua(this.consumeCodePoint());Zn(this.peekCodePoint(0))&&this.consumeCodePoint();var l=parseInt(a,16);return l===0||uy(l)||l>1114111?Wd:l}return t===Dl?Wd:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(Xd(a))t+=Ua(a);else if(ls(a,this.peekCodePoint(0)))t+=Ua(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),uA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new dA;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||My(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"?gr:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),Mn=function(e){return e.type===15},nn=function(e){return e.type===17},ia=function(e){return e.type===20},Ty=function(e){return e.type===0},yr=function(e,t){return ia(e)&&e.value===t},cA=function(e){return e.type!==31},tn=function(e){return e.type!==31&&e.type!==4},Ol=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},My=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},As=function(e){return e.type===17||e.type===15},Ta=function(e){return e.type===16||As(e)},AA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},ja={type:17,number:0,flags:Tn},od={type:16,number:50,flags:Tn},ns={type:16,number:100,flags:Tn},vn=function(e,t,a){var l=e[0],s=e[1];return[ha(l,t),ha(typeof s<"u"?s:l,a)]},ha=function(e,t){if(e.type===16)return e.number/100*t;if(Mn(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},pA="deg",fA="grad",mA="rad",hA="turn",oi={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case pA:return Math.PI*t.number/180;case fA:return Math.PI/200*t.number;case mA:return t.number;case hA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},_A=function(e){return e.type===15&&(e.unit===pA||e.unit===fA||e.unit===mA||e.unit===hA)},vA=function(e){var t=e.filter(ia).map(function(a){return a.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ja,ja];case"to top":case"bottom":return kl(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ja,ns];case"to right":case"left":return kl(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ns,ns];case"to bottom":case"top":return kl(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ns,ja];case"to left":case"right":return kl(270)}return 0},kl=function(e){return Math.PI*e/180},ds={name:"color",parse:function(e,t){if(t.type===18){var a=Ly[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 os(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 os(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 os(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 os(parseInt(l,16),parseInt(s,16),parseInt(i,16),parseInt(c,16)/255)}}if(t.type===20){var p=zl[t.value.toUpperCase()];if(typeof p<"u")return p}return zl.TRANSPARENT}},us=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+")"},os=function(e,t,a,l){return(e<<24|t<<16|a<<8|Math.round(l*255)<<0)>>>0},Jd=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},Zd=function(e,t){var a=t.filter(tn);if(a.length===3){var l=a.map(Jd),s=l[0],i=l[1],c=l[2];return os(s,i,c,1)}if(a.length===4){var p=a.map(Jd),s=p[0],i=p[1],c=p[2],m=p[3];return os(s,i,c,m)}return 0};function $i(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 eu=function(e,t){var a=t.filter(tn),l=a[0],s=a[1],i=a[2],c=a[3],p=(l.type===17?kl(l.number):oi.parse(e,l))/(Math.PI*2),m=Ta(s)?s.number/100:0,_=Ta(i)?i.number/100:0,g=typeof c<"u"&&Ta(c)?ha(c,1):1;if(m===0)return os(_*255,_*255,_*255,1);var y=_<=.5?_*(m+1):_+m-_*m,v=_*2-y,w=$i(v,y,p+1/3),k=$i(v,y,p),b=$i(v,y,p-1/3);return os(w*255,k*255,b*255,g)},Ly={hsl:eu,hsla:eu,rgb:Zd,rgba:Zd},Cn=function(e,t){return ds.parse(e,uA.create(t).parseComponentValue())},zl={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},Ry={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(ia(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Oy={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ii=function(e,t){var a=ds.parse(e,t[0]),l=t[1];return l&&Ta(l)?{color:a,stop:l}:{color:a,stop:null}},tu=function(e,t){var a=e[0],l=e[e.length-1];a.stop===null&&(a.stop=ja),l.stop===null&&(l.stop=ns);for(var s=[],i=0,c=0;c<e.length;c++){var p=e[c].stop;if(p!==null){var m=ha(p,t);m>i?s.push(m):s.push(i),i=m}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],w=(g-v)/(y+1),k=1;k<=y;k++)s[_+k-1]=w*k;_=null}}return e.map(function(b,x){var F=b.color;return{color:F,stop:Math.max(Math.min(1,s[x]/t),0)}})},Hy=function(e,t,a){var l=t/2,s=a/2,i=ha(e[0],t)-l,c=s-ha(e[1],a);return(Math.atan2(c,i)+Math.PI*2)%(Math.PI*2)},Py=function(e,t,a){var l=typeof e=="number"?e:Hy(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,m=Math.sin(l-Math.PI/2)*p,_=Math.cos(l-Math.PI/2)*p;return[s,i-_,i+_,c-m,c+m]},Fl=function(e,t){return Math.sqrt(e*e+t*t)},au=function(e,t,a,l,s){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(c,p){var m=p[0],_=p[1],g=Fl(a-m,l-_);return(s?g<c.optimumDistance:g>c.optimumDistance)?{optimumCorner:p,optimumDistance:g}:c},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},Ny=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(Fl(t,a),Fl(t,a-s),Fl(t-l,a),Fl(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)),m=au(l,s,t,a,!0),_=m[0],g=m[1];i=Fl(_-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(Fl(t,a),Fl(t,a-s),Fl(t-l,a),Fl(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=au(l,s,t,a,!1),_=y[0],g=y[1];i=Fl(_-t,(g-a)/p),c=p*i}break}return Array.isArray(e.size)&&(i=ha(e.size[0],l),c=e.size.length===2?ha(e.size[1],s):i),[i,c]},Ky=function(e,t){var a=kl(180),l=[];return Ol(t).forEach(function(s,i){if(i===0){var c=s[0];if(c.type===20&&c.value==="to"){a=vA(s);return}else if(_A(c)){a=oi.parse(e,c);return}}var p=ii(e,s);l.push(p)}),{angle:a,stops:l,type:1}},ao=function(e,t){var a=kl(180),l=[];return Ol(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=vA(s);return}else if(_A(c)){a=(oi.parse(e,c)+kl(270))%kl(360);return}}var p=ii(e,s);l.push(p)}),{angle:a,stops:l,type:1}},Gy=function(e,t){var a=kl(180),l=[],s=1,i=0,c=3,p=[];return Ol(t).forEach(function(m,_){var g=m[0];if(_===0){if(ia(g)&&g.value==="linear"){s=1;return}else if(ia(g)&&g.value==="radial"){s=2;return}}if(g.type===18){if(g.name==="from"){var y=ds.parse(e,g.values[0]);l.push({stop:ja,color:y})}else if(g.name==="to"){var y=ds.parse(e,g.values[0]);l.push({stop:ns,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(tn);if(v.length===2){var y=ds.parse(e,v[1]),w=v[0];nn(w)&&l.push({stop:{type:16,number:w.number*100,flags:w.flags},color:y})}}}}),s===1?{angle:(a+kl(180))%kl(360),stops:l,type:s}:{size:c,shape:i,stops:l,position:p,type:s}},gA="closest-side",yA="farthest-side",bA="closest-corner",wA="farthest-corner",CA="circle",kA="ellipse",BA="cover",xA="contain",jy=function(e,t){var a=0,l=3,s=[],i=[];return Ol(t).forEach(function(c,p){var m=!0;if(p===0){var _=!1;m=c.reduce(function(y,v){if(_)if(ia(v))switch(v.value){case"center":return i.push(od),y;case"top":case"left":return i.push(ja),y;case"right":case"bottom":return i.push(ns),y}else(Ta(v)||As(v))&&i.push(v);else if(ia(v))switch(v.value){case CA:return a=0,!1;case kA:return a=1,!1;case"at":return _=!0,!1;case gA:return l=0,!1;case BA:case yA:return l=1,!1;case xA:case bA:return l=2,!1;case wA:return l=3,!1}else if(As(v)||Ta(v))return Array.isArray(l)||(l=[]),l.push(v),!1;return y},m)}if(m){var g=ii(e,c);s.push(g)}}),{size:l,shape:a,stops:s,position:i,type:2}},lo=function(e,t){var a=0,l=3,s=[],i=[];return Ol(t).forEach(function(c,p){var m=!0;if(p===0?m=c.reduce(function(g,y){if(ia(y))switch(y.value){case"center":return i.push(od),!1;case"top":case"left":return i.push(ja),!1;case"right":case"bottom":return i.push(ns),!1}else if(Ta(y)||As(y))return i.push(y),!1;return g},m):p===1&&(m=c.reduce(function(g,y){if(ia(y))switch(y.value){case CA:return a=0,!1;case kA:return a=1,!1;case xA:case gA:return l=0,!1;case yA:return l=1,!1;case bA:return l=2,!1;case BA:case wA:return l=3,!1}else if(As(y)||Ta(y))return Array.isArray(l)||(l=[]),l.push(y),!1;return g},m)),m){var _=ii(e,c);s.push(_)}}),{size:l,shape:a,stops:s,position:i,type:2}},zy=function(e){return e.type===1},qy=function(e){return e.type===2},id={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=SA[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 Yy(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!SA[e.name])}var SA={"linear-gradient":Ky,"-moz-linear-gradient":ao,"-ms-linear-gradient":ao,"-o-linear-gradient":ao,"-webkit-linear-gradient":ao,"radial-gradient":jy,"-moz-radial-gradient":lo,"-ms-radial-gradient":lo,"-o-radial-gradient":lo,"-webkit-radial-gradient":lo,"-webkit-gradient":Gy},Wy={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 tn(l)&&Yy(l)}).map(function(l){return id.parse(e,l)})}},Xy={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(ia(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Jy={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(Ta)}).map(AA)}},Zy={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(ia).map(function(l){return l.value}).join(" ")}).map(e1)}},e1=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}},Ys;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(Ys||(Ys={}));var t1={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(a1)})}},a1=function(e){return ia(e)||Ta(e)},ri=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},l1=ri("top"),s1=ri("right"),n1=ri("bottom"),o1=ri("left"),di=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return AA(a.filter(Ta))}}},i1=di("top-left"),r1=di("top-right"),d1=di("bottom-right"),u1=di("bottom-left"),ui=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}}},c1=ui("top"),A1=ui("right"),p1=ui("bottom"),f1=ui("left"),ci=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return Mn(a)?a.number:0}}},m1=ci("top"),h1=ci("right"),_1=ci("bottom"),v1=ci("left"),g1={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},y1={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},b1={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(ia).reduce(function(a,l){return a|w1(l.value)},0)}},w1=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},C1={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}},k1={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}},Eo;(function(e){e.NORMAL="normal",e.STRICT="strict"})(Eo||(Eo={}));var B1={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return Eo.STRICT;case"normal":default:return Eo.NORMAL}}},x1={name:"line-height",initialValue:"normal",prefix:!1,type:4},lu=function(e,t){return ia(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Ta(e)?ha(e,t):t},S1={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:id.parse(e,t)}},F1={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}}},br={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}}},Ai=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},$1=Ai("top"),E1=Ai("right"),U1=Ai("bottom"),I1=Ai("left"),Q1={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(ia).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}})}},D1={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"}}},pi=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},V1=pi("top"),T1=pi("right"),M1=pi("bottom"),L1=pi("left"),R1={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}}},O1={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}},H1={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&yr(t[0],"none")?[]:Ol(t).map(function(a){for(var l={color:zl.TRANSPARENT,offsetX:ja,offsetY:ja,blur:ja},s=0,i=0;i<a.length;i++){var c=a[i];As(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:l.blur=c,s++):l.color=ds.parse(e,c)}return l})}},P1={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}},N1={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=j1[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},K1=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},G1=function(e){var t=e.filter(function(m){return m.type===17}).map(function(m){return m.number}),a=t[0],l=t[1];t[2],t[3];var 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},j1={matrix:K1,matrix3d:G1},su={type:16,number:50,flags:Tn},z1=[su,su],q1={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Ta);return a.length!==2?z1:[a[0],a[1]]}},Y1={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}}},kn;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(kn||(kn={}));var W1={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return kn.BREAK_ALL;case"keep-all":return kn.KEEP_ALL;case"normal":default:return kn.NORMAL}}},X1={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(nn(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},FA={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")}},J1={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return nn(t)?t.number:1}},Z1={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},eb={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(ia).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})}},tb={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+"'"})}},ab={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},lb={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(nn(t))return t.number;if(ia(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},sb={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(ia).map(function(a){return a.value})}},nb={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},ob={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}},ib={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 m=p&&nn(p)?p.number:1;l.push({counter:c.value,increment:m})}}return l}},rb={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(ia(i)&&i.value!=="none"){var p=c&&nn(c)?c.number:0;a.push({counter:i.value,reset:p})}}return a}},db={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Mn).map(function(a){return FA.parse(e,a)})}},ub={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(Ty);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}},nu=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},cb={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&yr(t[0],"none")?[]:Ol(t).map(function(a){for(var l={color:255,offsetX:ja,offsetY:ja,blur:ja,spread:ja,inset:!1},s=0,i=0;i<a.length;i++){var c=a[i];yr(c,"inset")?l.inset=!0:As(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:s===2?l.blur=c:l.spread=c,s++):l.color=ds.parse(e,c)}return l})}},Ab={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],l=[];return t.filter(ia).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}},pb={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 Mn(t)?t.number:0}},mb=function(){function e(t,a){var l,s;this.animationDuration=At(t,db,a.animationDuration),this.backgroundClip=At(t,Ry,a.backgroundClip),this.backgroundColor=At(t,Oy,a.backgroundColor),this.backgroundImage=At(t,Wy,a.backgroundImage),this.backgroundOrigin=At(t,Xy,a.backgroundOrigin),this.backgroundPosition=At(t,Jy,a.backgroundPosition),this.backgroundRepeat=At(t,Zy,a.backgroundRepeat),this.backgroundSize=At(t,t1,a.backgroundSize),this.borderTopColor=At(t,l1,a.borderTopColor),this.borderRightColor=At(t,s1,a.borderRightColor),this.borderBottomColor=At(t,n1,a.borderBottomColor),this.borderLeftColor=At(t,o1,a.borderLeftColor),this.borderTopLeftRadius=At(t,i1,a.borderTopLeftRadius),this.borderTopRightRadius=At(t,r1,a.borderTopRightRadius),this.borderBottomRightRadius=At(t,d1,a.borderBottomRightRadius),this.borderBottomLeftRadius=At(t,u1,a.borderBottomLeftRadius),this.borderTopStyle=At(t,c1,a.borderTopStyle),this.borderRightStyle=At(t,A1,a.borderRightStyle),this.borderBottomStyle=At(t,p1,a.borderBottomStyle),this.borderLeftStyle=At(t,f1,a.borderLeftStyle),this.borderTopWidth=At(t,m1,a.borderTopWidth),this.borderRightWidth=At(t,h1,a.borderRightWidth),this.borderBottomWidth=At(t,_1,a.borderBottomWidth),this.borderLeftWidth=At(t,v1,a.borderLeftWidth),this.boxShadow=At(t,cb,a.boxShadow),this.color=At(t,g1,a.color),this.direction=At(t,y1,a.direction),this.display=At(t,b1,a.display),this.float=At(t,C1,a.cssFloat),this.fontFamily=At(t,tb,a.fontFamily),this.fontSize=At(t,ab,a.fontSize),this.fontStyle=At(t,nb,a.fontStyle),this.fontVariant=At(t,sb,a.fontVariant),this.fontWeight=At(t,lb,a.fontWeight),this.letterSpacing=At(t,k1,a.letterSpacing),this.lineBreak=At(t,B1,a.lineBreak),this.lineHeight=At(t,x1,a.lineHeight),this.listStyleImage=At(t,S1,a.listStyleImage),this.listStylePosition=At(t,F1,a.listStylePosition),this.listStyleType=At(t,br,a.listStyleType),this.marginTop=At(t,$1,a.marginTop),this.marginRight=At(t,E1,a.marginRight),this.marginBottom=At(t,U1,a.marginBottom),this.marginLeft=At(t,I1,a.marginLeft),this.opacity=At(t,J1,a.opacity);var i=At(t,Q1,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=At(t,D1,a.overflowWrap),this.paddingTop=At(t,V1,a.paddingTop),this.paddingRight=At(t,T1,a.paddingRight),this.paddingBottom=At(t,M1,a.paddingBottom),this.paddingLeft=At(t,L1,a.paddingLeft),this.paintOrder=At(t,Ab,a.paintOrder),this.position=At(t,O1,a.position),this.textAlign=At(t,R1,a.textAlign),this.textDecorationColor=At(t,Z1,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=At(t,eb,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=At(t,H1,a.textShadow),this.textTransform=At(t,P1,a.textTransform),this.transform=At(t,N1,a.transform),this.transformOrigin=At(t,q1,a.transformOrigin),this.visibility=At(t,Y1,a.visibility),this.webkitTextStrokeColor=At(t,pb,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=At(t,fb,a.webkitTextStrokeWidth),this.wordBreak=At(t,W1,a.wordBreak),this.zIndex=At(t,X1,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return us(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}(),hb=function(){function e(t,a){this.content=At(t,ob,a.content),this.quotes=At(t,ub,a.quotes)}return e}(),ou=function(){function e(t,a){this.counterIncrement=At(t,ib,a.counterIncrement),this.counterReset=At(t,rb,a.counterReset)}return e}(),At=function(e,t,a){var l=new dA,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(s);var i=new uA(l.read());switch(t.type){case 2:var c=i.parseComponentValue();return t.parse(e,ia(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 oi.parse(e,i.parseComponentValue());case"color":return ds.parse(e,i.parseComponentValue());case"image":return id.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return As(p)?p:ja;case"length-percentage":var m=i.parseComponentValue();return Ta(m)?m:ja;case"time":return FA.parse(e,i.parseComponentValue())}break}},_b="data-html2canvas-debug",vb=function(e){var t=e.getAttribute(_b);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},wr=function(e,t){var a=vb(e);return a===1||t===a},Hl=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,wr(a,3))debugger;this.styles=new mb(t,window.getComputedStyle(a,null)),Br(a)&&(this.styles.animationDuration.some(function(l){return l>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=si(this.context,a),wr(a,4)&&(this.flags|=16)}return e}(),gb="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",iu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var so=0;so<iu.length;so++)gn[iu.charCodeAt(so)]=so;var yb=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,m;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=gn[e.charCodeAt(l)],c=gn[e.charCodeAt(l+1)],p=gn[e.charCodeAt(l+2)],m=gn[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|m&63;return _},bb=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},wb=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},ks=5,rd=11,Ei=2,Cb=rd-ks,$A=65536>>ks,kb=1<<ks,Ui=kb-1,Bb=1024>>ks,xb=$A+Bb,Sb=xb,Fb=32,$b=Sb+Fb,Eb=65536>>rd,Ub=1<<Cb,Ib=Ub-1,ru=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},Qb=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},Db=function(e,t){var a=yb(e),l=Array.isArray(a)?wb(a):new Uint32Array(a),s=Array.isArray(a)?bb(a):new Uint16Array(a),i=24,c=ru(s,i/2,l[4]/2),p=l[5]===2?ru(s,(i+l[4])/2):Qb(l,Math.ceil((i+l[4])/4));return new Vb(l[0],l[1],l[2],l[3],c,p)},Vb=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>>ks],a=(a<<Ei)+(t&Ui),this.data[a];if(t<=65535)return a=this.index[$A+(t-55296>>ks)],a=(a<<Ei)+(t&Ui),this.data[a];if(t<this.highStart)return a=$b-Eb+(t>>rd),a=this.index[a],a+=t>>ks&Ib,a=this.index[a],a=(a<<Ei)+(t&Ui),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),du="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tb=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var no=0;no<du.length;no++)Tb[du.charCodeAt(no)]=no;var Mb=1,Ii=2,Qi=3,uu=4,cu=5,Lb=7,Au=8,Di=9,Vi=10,pu=11,fu=12,mu=13,hu=14,Ti=15,Rb=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},Ob=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},Hb=Db(gb),gl="×",Mi="÷",Pb=function(e){return Hb.get(e)},Nb=function(e,t,a){var l=a-2,s=t[l],i=t[a-1],c=t[a];if(i===Ii&&c===Qi)return gl;if(i===Ii||i===Qi||i===uu||c===Ii||c===Qi||c===uu)return Mi;if(i===Au&&[Au,Di,pu,fu].indexOf(c)!==-1||(i===pu||i===Di)&&(c===Di||c===Vi)||(i===fu||i===Vi)&&c===Vi||c===mu||c===cu||c===Lb||i===Mb)return gl;if(i===mu&&c===hu){for(;s===cu;)s=t[--l];if(s===hu)return gl}if(i===Ti&&c===Ti){for(var p=0;s===Ti;)p++,s=t[--l];if(p%2===0)return gl}return Mi},Kb=function(e){var t=Rb(e),a=t.length,l=0,s=0,i=t.map(Pb);return{next:function(){if(l>=a)return{done:!0,value:null};for(var c=gl;l<a&&(c=Nb(t,i,++l))===gl;);if(c!==gl||l===a){var p=Ob.apply(null,t.slice(s,l));return s=l,{value:p,done:!1}}return{done:!0,value:null}}}},Gb=function(e){for(var t=Kb(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},jb=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},zb=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=ni(l.data).map(function(m){return Ua(m)}),i=0,c={},p=s.every(function(m,_){a.setStart(l,i),a.setEnd(l,i+m.length);var g=a.getBoundingClientRect();i+=m.length;var y=g.x>c.x||g.y>c.y;return c=g,_===0?!0:y});return e.body.removeChild(t),p},qb=function(){return typeof new Image().crossOrigin<"u"},Yb=function(){return typeof new XMLHttpRequest().responseType=="string"},Wb=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},_u=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Xb=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=Cr(a,a,0,0,s);return l.fillStyle="red",l.fillRect(0,0,a,a),vu(c).then(function(p){l.drawImage(p,0,0);var m=l.getImageData(0,0,a,a).data;l.fillStyle="red",l.fillRect(0,0,a,a);var _=e.createElement("div");return _.style.backgroundImage="url("+i+")",_.style.height=a+"px",_u(m)?vu(Cr(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),_u(l.getImageData(0,0,a,a).data)}).catch(function(){return!1})},Cr=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},vu=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=jb(document);return Object.defineProperty(Ga,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Ga.SUPPORT_RANGE_BOUNDS&&zb(document);return Object.defineProperty(Ga,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Wb(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"?Xb(document):Promise.resolve(!1);return Object.defineProperty(Ga,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=qb();return Object.defineProperty(Ga,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=Yb();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}},Bn=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),Jb=function(e,t,a,l){var s=t0(t,a),i=[],c=0;return s.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(Ga.SUPPORT_RANGE_BOUNDS){var m=gu(l,c,p.length).getClientRects();if(m.length>1){var _=dd(p),g=0;_.forEach(function(v){i.push(new Bn(v,Xl.fromDOMRectList(e,gu(l,g+c,v.length).getClientRects()))),g+=v.length})}else i.push(new Bn(p,Xl.fromDOMRectList(e,m)))}else{var y=l.splitText(p.length);i.push(new Bn(p,Zb(e,l))),l=y}else Ga.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));c+=p.length}),i},Zb=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=si(e,l);return l.firstChild&&s.replaceChild(l.firstChild,l),i}}return Xl.EMPTY},gu=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},dd=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 Gb(e)},e0=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 l0(e,t)},t0=function(e,t){return t.letterSpacing!==0?dd(e):e0(e,t)},a0=[32,160,4961,65792,65793,4153,4241],l0=function(e,t){for(var a=Eg(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=ni(c),m="";p.forEach(function(_){a0.indexOf(_)===-1?m+=Ua(_):(m.length&&l.push(m),l.push(Ua(_)),m="")}),m.length&&l.push(m)}};!(s=a.next()).done;)i();return l},s0=function(){function e(t,a,l){this.text=n0(a.data,l.textTransform),this.textBounds=Jb(t,this.text,l,a)}return e}(),n0=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(o0,i0);case 2:return e.toUpperCase();default:return e}},o0=/(^|\s|:|-|\(|\))([a-z])/g,i0=function(e,t,a){return e.length>0?t+a.toUpperCase():e},EA=function(e){Ul(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}(Hl),UA=function(e){Ul(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}(Hl),IA=function(e){Ul(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=new XMLSerializer,c=si(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}(Hl),QA=function(e){Ul(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Hl),kr=function(e){Ul(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}(Hl),r0=[{type:15,flags:0,unit:"px",number:3}],d0=[{type:16,flags:0,number:50}],u0=function(e){return e.width>e.height?new Xl(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new Xl(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},c0=function(e){var t=e.type===A0?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},Uo="checkbox",Io="radio",A0="password",yu=707406591,ud=function(e){Ul(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=c0(l),(s.type===Uo||s.type===Io)&&(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=u0(s.bounds)),s.type){case Uo:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=r0;break;case Io:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=d0;break}return s}return t}(Hl),DA=function(e){Ul(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}(Hl),VA=function(e){Ul(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Hl),TA=function(e){Ul(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=LA(a,l.contentWindow.document.documentElement);var i=l.contentWindow.document.documentElement?Cn(a,getComputedStyle(l.contentWindow.document.documentElement).backgroundColor):zl.TRANSPARENT,c=l.contentWindow.document.body?Cn(a,getComputedStyle(l.contentWindow.document.body).backgroundColor):zl.TRANSPARENT;s.backgroundColor=us(i)?us(c)?s.styles.backgroundColor:c:i}}catch{}return s}return t}(Hl),p0=["OL","UL","MENU"],yo=function(e,t,a,l){for(var s=t.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,RA(s)&&s.data.trim().length>0)a.textNodes.push(new s0(e,s,a.styles));else if(js(s))if(NA(s)&&s.assignedNodes)s.assignedNodes().forEach(function(p){return yo(e,p,a,l)});else{var c=MA(e,s);c.styles.isVisible()&&(f0(s,c,l)?c.flags|=4:m0(c.styles)&&(c.flags|=2),p0.indexOf(s.tagName)!==-1&&(c.flags|=8),a.elements.push(c),s.slot,s.shadowRoot?yo(e,s.shadowRoot,c,l):!Qo(s)&&!OA(s)&&!Do(s)&&yo(e,s,c,l))}},MA=function(e,t){return xr(t)?new EA(e,t):HA(t)?new UA(e,t):OA(t)?new IA(e,t):h0(t)?new QA(e,t):_0(t)?new kr(e,t):v0(t)?new ud(e,t):Do(t)?new DA(e,t):Qo(t)?new VA(e,t):PA(t)?new TA(e,t):new Hl(e,t)},LA=function(e,t){var a=MA(e,t);return a.flags|=4,yo(e,t,a,a),a},f0=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||cd(e)&&a.styles.isTransparent()},m0=function(e){return e.isPositioned()||e.isFloating()},RA=function(e){return e.nodeType===Node.TEXT_NODE},js=function(e){return e.nodeType===Node.ELEMENT_NODE},Br=function(e){return js(e)&&typeof e.style<"u"&&!bo(e)},bo=function(e){return typeof e.className=="object"},h0=function(e){return e.tagName==="LI"},_0=function(e){return e.tagName==="OL"},v0=function(e){return e.tagName==="INPUT"},g0=function(e){return e.tagName==="HTML"},OA=function(e){return e.tagName==="svg"},cd=function(e){return e.tagName==="BODY"},HA=function(e){return e.tagName==="CANVAS"},bu=function(e){return e.tagName==="VIDEO"},xr=function(e){return e.tagName==="IMG"},PA=function(e){return e.tagName==="IFRAME"},wu=function(e){return e.tagName==="STYLE"},y0=function(e){return e.tagName==="SCRIPT"},Qo=function(e){return e.tagName==="TEXTAREA"},Do=function(e){return e.tagName==="SELECT"},NA=function(e){return e.tagName==="SLOT"},Cu=function(e){return e.tagName.indexOf("-")>0},b0=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 m=a.counters[p.counter];m&&p.increment!==0&&(i=!1,m.length||m.push(1),m[Math.max(0,m.length-1)]+=p.increment)});var c=[];return i&&s.forEach(function(p){var m=a.counters[p.counter];c.push(p.counter),m||(m=a.counters[p.counter]=[]),m.push(p.reset)}),c},e}(),ku={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Bu={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},w0={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},C0={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Ms=function(e,t,a,l,s,i){return e<t||e>a?Qn(e,s,i.length>0):l.integers.reduce(function(c,p,m){for(;e>=p;)e-=p,c+=l.values[m];return c},"")+i},KA=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?"-":"")+(KA(Math.abs(e),i,l,function(c){return Ua(Math.floor(c%i)+t)})+s)},_s=function(e,t,a){a===void 0&&(a=". ");var l=t.length;return KA(Math.abs(e),l,!1,function(s){return t[Math.floor(s%l)]})+a},Hs=1,ts=2,as=4,yn=8,Kl=function(e,t,a,l,s,i){if(e<-9999||e>9999)return Qn(e,4,s.length>0);var c=Math.abs(e),p=s;if(c===0)return t[0]+p;for(var m=0;c>0&&m<=4;m++){var _=c%10;_===0&&La(i,Hs)&&p!==""?p=t[_]+p:_>1||_===1&&m===0||_===1&&m===1&&La(i,ts)||_===1&&m===1&&La(i,as)&&e>100||_===1&&m>1&&La(i,yn)?p=t[_]+(m>0?a[m-1]:"")+p:_===1&&m>0&&(p=a[m-1]+p),c=Math.floor(c/10)}return(e<0?l:"")+p},xu="十百千萬",Su="拾佰仟萬",Fu="マイナス",Li="마이너스",Qn=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 _s(e,"〇一二三四五六七八九",s);case 6:return Ms(e,1,3999,ku,3,l).toLowerCase();case 7:return Ms(e,1,3999,ku,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 Ms(e,1,9999,Bu,3,l);case 35:return Ms(e,1,9999,Bu,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 _s(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return _s(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return Kl(e,"零一二三四五六七八九",xu,"負",s,ts|as|yn);case 47:return Kl(e,"零壹貳參肆伍陸柒捌玖",Su,"負",s,Hs|ts|as|yn);case 42:return Kl(e,"零一二三四五六七八九",xu,"负",s,ts|as|yn);case 41:return Kl(e,"零壹贰叁肆伍陆柒捌玖",Su,"负",s,Hs|ts|as|yn);case 26:return Kl(e,"〇一二三四五六七八九","十百千万",Fu,s,0);case 25:return Kl(e,"零壱弐参四伍六七八九","拾百千万",Fu,s,Hs|ts|as);case 31:return Kl(e,"영일이삼사오육칠팔구","십백천만",Li,i,Hs|ts|as);case 33:return Kl(e,"零一二三四五六七八九","十百千萬",Li,i,0);case 32:return Kl(e,"零壹貳參四五六七八九","拾百千",Li,i,Hs|ts|as);case 18:return Ea(e,2406,2415,!0,l);case 20:return Ms(e,1,19999,C0,3,l);case 21:return Ea(e,2790,2799,!0,l);case 22:return Ea(e,2662,2671,!0,l);case 22:return Ms(e,1,10999,w0,3,l);case 23:return _s(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return _s(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ea(e,3302,3311,!0,l);case 28:return _s(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return _s(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)}},GA="data-html2canvas-ignore",$u=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new b0,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=k0(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,m=p.document,_=S0(s).then(function(){return el(l,void 0,void 0,function(){var g,y;return qa(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(U0),p&&(p.scrollTo(a.left,a.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(p.scrollY!==a.top||p.scrollX!==a.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(p.scrollX-a.left,p.scrollY-a.top,0,0))),g=this.options.onclone,y=this.clonedReferenceElement,typeof y>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:m.fonts&&m.fonts.ready?[4,m.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,x0(m)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof g=="function"?[2,Promise.resolve().then(function(){return g(m,y)}).then(function(){return s})]:[2,s]}})})});return m.open(),m.write($0(document.doctype)+"<html></html>"),E0(this.referenceElement.ownerDocument,i,c),m.replaceChild(m.adoptNode(this.documentElement),m.documentElement),m.close(),_},e.prototype.createElementClone=function(t){if(wr(t,2))debugger;if(HA(t))return this.createCanvasClone(t);if(bu(t))return this.createVideoClone(t);if(wu(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return xr(a)&&(xr(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Cu(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return Ri(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 m=p.getContextAttributes();(m==null?void 0:m.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}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){(!js(a)||!y0(a)&&!a.hasAttribute(GA)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!js(a)||!wu(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(js(i)&&NA(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(RA(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var l=t.ownerDocument.defaultView;if(l&&js(t)&&(Br(t)||bo(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&&Br(s)&&(this.clonedReferenceElement=s),cd(s)&&D0(s);var m=this.counters.parse(new ou(this.context,i)),_=this.resolvePseudoContent(t,s,c,xn.BEFORE);Cu(t)&&(a=!0),bu(t)||this.cloneChildNodes(t,s,a),_&&s.insertBefore(_,s.firstChild);var g=this.resolvePseudoContent(t,s,p,xn.AFTER);return g&&s.appendChild(g),this.counters.pop(m),(i&&(this.options.copyStyles||bo(t))&&!PA(t)||a)&&Ri(i,s),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([s,t.scrollLeft,t.scrollTop]),(Qo(t)||Do(t))&&(Qo(s)||Do(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 ou(this.context,l));var m=new hb(this.context,l),_=p.createElement("html2canvaspseudoelement");Ri(l,_),m.content.forEach(function(y){if(y.type===0)_.appendChild(p.createTextNode(y.value));else if(y.type===22){var v=p.createElement("img");v.src=y.value,v.style.opacity="1",_.appendChild(v)}else if(y.type===18){if(y.name==="attr"){var w=y.values.filter(ia);w.length&&_.appendChild(p.createTextNode(t.getAttribute(w[0].value)||""))}else if(y.name==="counter"){var k=y.values.filter(tn),b=k[0],x=k[1];if(b&&ia(b)){var F=i.counters.getCounterValue(b.value),M=x&&ia(x)?br.parse(i.context,x.value):3;_.appendChild(p.createTextNode(Qn(F,M,!1)))}}else if(y.name==="counters"){var $=y.values.filter(tn),b=$[0],S=$[1],x=$[2];if(b&&ia(b)){var I=i.counters.getCounterValues(b.value),Q=x&&ia(x)?br.parse(i.context,x.value):3,D=S&&S.type===0?S.value:"",V=I.map(function(R){return Qn(R,Q,!1)}).join(D);_.appendChild(p.createTextNode(V))}}}else if(y.type===20)switch(y.value){case"open-quote":_.appendChild(p.createTextNode(nu(m.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(nu(m.quotes,--i.quoteDepth,!1)));break;default:_.appendChild(p.createTextNode(y.value))}}),_.className=Sr+" "+Fr;var g=s===xn.BEFORE?" "+Sr:" "+Fr;return bo(a)?a.className.baseValue+=g:a.className+=g,_}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),xn;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(xn||(xn={}));var k0=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(GA,"true"),e.body.appendChild(a),a},B0=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},x0=function(e){return Promise.all([].slice.call(e.images,0).map(B0))},S0=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)}})},F0=["all","d","content"],Ri=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);F0.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},$0=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},E0=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},U0=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},I0=":before",Q0=":after",Sr="___html2canvas___pseudoelement_before",Fr="___html2canvas___pseudoelement_after",Eu=`{
19 content: "" !important;
20 display: none !important;
21 }`,D0=function(e){V0(e,"."+Sr+I0+Eu+`
22 .`+Fr+Q0+Eu)},V0=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},jA=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}(),T0=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)||(Hi(t)||O0(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 el(this,void 0,void 0,function(){var a,l,s,i,c=this;return qa(this,function(p){switch(p.label){case 0:return a=jA.isSameOrigin(t),l=!Oi(t)&&this._options.useCORS===!0&&Ga.SUPPORT_CORS_IMAGES&&!a,s=!Oi(t)&&!a&&!Hi(t)&&typeof this._options.proxy=="string"&&Ga.SUPPORT_CORS_XHR&&!l,!a&&this._options.allowTaint===!1&&!Oi(t)&&!Hi(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(m,_){var g=new Image;g.onload=function(){return m(g)},g.onerror=_,(H0(i)||l)&&(g.crossOrigin="anonymous"),g.src=i,g.complete===!0&&setTimeout(function(){return m(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",m=new XMLHttpRequest;m.onload=function(){if(m.status===200)if(p==="text")i(m.response);else{var y=new FileReader;y.addEventListener("load",function(){return i(y.result)},!1),y.addEventListener("error",function(v){return c(v)},!1),y.readAsDataURL(m.response)}else c("Failed to proxy resource "+s+" with status code "+m.status)},m.onerror=c;var _=l.indexOf("?")>-1?"&":"?";if(m.open("GET",""+l+_+"url="+encodeURIComponent(t)+"&responseType="+p),p!=="text"&&m instanceof XMLHttpRequest&&(m.responseType=p),a._options.imageTimeout){var g=a._options.imageTimeout;m.timeout=g,m.ontimeout=function(){return c("Timed out ("+g+"ms) proxying "+s)}}m.send()})},e}(),M0=/^data:image\/svg\+xml/i,L0=/^data:image\/.*;base64,/i,R0=/^data:image\/.*/i,O0=function(e){return Ga.SUPPORT_SVG_DRAWING||!P0(e)},Oi=function(e){return R0.test(e)},H0=function(e){return L0.test(e)},Hi=function(e){return e.substr(0,4)==="blob"},P0=function(e){return e.substr(-3).toLowerCase()==="svg"||M0.test(e)},it=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}(),Ls=function(e,t,a){return new it(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},oo=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=Ls(this.start,this.startControl,t),s=Ls(this.startControl,this.endControl,t),i=Ls(this.endControl,this.end,t),c=Ls(l,s,t),p=Ls(s,i,t),m=Ls(c,p,t);return a?new e(this.start,l,c,m):new e(m,p,i,this.end)},e.prototype.add=function(t,a){return new e(this.start.add(t,a),this.startControl.add(t,a),this.endControl.add(t,a),this.end.add(t,a))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),wl=function(e){return e.type===1},N0=function(){function e(t){var a=t.styles,l=t.bounds,s=vn(a.borderTopLeftRadius,l.width,l.height),i=s[0],c=s[1],p=vn(a.borderTopRightRadius,l.width,l.height),m=p[0],_=p[1],g=vn(a.borderBottomRightRadius,l.width,l.height),y=g[0],v=g[1],w=vn(a.borderBottomLeftRadius,l.width,l.height),k=w[0],b=w[1],x=[];x.push((i+m)/l.width),x.push((k+y)/l.width),x.push((c+b)/l.height),x.push((_+v)/l.height);var F=Math.max.apply(Math,x);F>1&&(i/=F,c/=F,m/=F,_/=F,y/=F,v/=F,k/=F,b/=F);var M=l.width-m,$=l.height-v,S=l.width-y,I=l.height-b,Q=a.borderTopWidth,D=a.borderRightWidth,V=a.borderBottomWidth,U=a.borderLeftWidth,O=ha(a.paddingTop,t.bounds.width),R=ha(a.paddingRight,t.bounds.width),P=ha(a.paddingBottom,t.bounds.width),j=ha(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||c>0?wa(l.left+U/3,l.top+Q/3,i-U/3,c-Q/3,Jt.TOP_LEFT):new it(l.left+U/3,l.top+Q/3),this.topRightBorderDoubleOuterBox=i>0||c>0?wa(l.left+M,l.top+Q/3,m-D/3,_-Q/3,Jt.TOP_RIGHT):new it(l.left+l.width-D/3,l.top+Q/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?wa(l.left+S,l.top+$,y-D/3,v-V/3,Jt.BOTTOM_RIGHT):new it(l.left+l.width-D/3,l.top+l.height-V/3),this.bottomLeftBorderDoubleOuterBox=k>0||b>0?wa(l.left+U/3,l.top+I,k-U/3,b-V/3,Jt.BOTTOM_LEFT):new it(l.left+U/3,l.top+l.height-V/3),this.topLeftBorderDoubleInnerBox=i>0||c>0?wa(l.left+U*2/3,l.top+Q*2/3,i-U*2/3,c-Q*2/3,Jt.TOP_LEFT):new it(l.left+U*2/3,l.top+Q*2/3),this.topRightBorderDoubleInnerBox=i>0||c>0?wa(l.left+M,l.top+Q*2/3,m-D*2/3,_-Q*2/3,Jt.TOP_RIGHT):new it(l.left+l.width-D*2/3,l.top+Q*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?wa(l.left+S,l.top+$,y-D*2/3,v-V*2/3,Jt.BOTTOM_RIGHT):new it(l.left+l.width-D*2/3,l.top+l.height-V*2/3),this.bottomLeftBorderDoubleInnerBox=k>0||b>0?wa(l.left+U*2/3,l.top+I,k-U*2/3,b-V*2/3,Jt.BOTTOM_LEFT):new it(l.left+U*2/3,l.top+l.height-V*2/3),this.topLeftBorderStroke=i>0||c>0?wa(l.left+U/2,l.top+Q/2,i-U/2,c-Q/2,Jt.TOP_LEFT):new it(l.left+U/2,l.top+Q/2),this.topRightBorderStroke=i>0||c>0?wa(l.left+M,l.top+Q/2,m-D/2,_-Q/2,Jt.TOP_RIGHT):new it(l.left+l.width-D/2,l.top+Q/2),this.bottomRightBorderStroke=y>0||v>0?wa(l.left+S,l.top+$,y-D/2,v-V/2,Jt.BOTTOM_RIGHT):new it(l.left+l.width-D/2,l.top+l.height-V/2),this.bottomLeftBorderStroke=k>0||b>0?wa(l.left+U/2,l.top+I,k-U/2,b-V/2,Jt.BOTTOM_LEFT):new it(l.left+U/2,l.top+l.height-V/2),this.topLeftBorderBox=i>0||c>0?wa(l.left,l.top,i,c,Jt.TOP_LEFT):new it(l.left,l.top),this.topRightBorderBox=m>0||_>0?wa(l.left+M,l.top,m,_,Jt.TOP_RIGHT):new it(l.left+l.width,l.top),this.bottomRightBorderBox=y>0||v>0?wa(l.left+S,l.top+$,y,v,Jt.BOTTOM_RIGHT):new it(l.left+l.width,l.top+l.height),this.bottomLeftBorderBox=k>0||b>0?wa(l.left,l.top+I,k,b,Jt.BOTTOM_LEFT):new it(l.left,l.top+l.height),this.topLeftPaddingBox=i>0||c>0?wa(l.left+U,l.top+Q,Math.max(0,i-U),Math.max(0,c-Q),Jt.TOP_LEFT):new it(l.left+U,l.top+Q),this.topRightPaddingBox=m>0||_>0?wa(l.left+Math.min(M,l.width-D),l.top+Q,M>l.width+D?0:Math.max(0,m-D),Math.max(0,_-Q),Jt.TOP_RIGHT):new it(l.left+l.width-D,l.top+Q),this.bottomRightPaddingBox=y>0||v>0?wa(l.left+Math.min(S,l.width-U),l.top+Math.min($,l.height-V),Math.max(0,y-D),Math.max(0,v-V),Jt.BOTTOM_RIGHT):new it(l.left+l.width-D,l.top+l.height-V),this.bottomLeftPaddingBox=k>0||b>0?wa(l.left+U,l.top+Math.min(I,l.height-V),Math.max(0,k-U),Math.max(0,b-V),Jt.BOTTOM_LEFT):new it(l.left+U,l.top+l.height-V),this.topLeftContentBox=i>0||c>0?wa(l.left+U+j,l.top+Q+O,Math.max(0,i-(U+j)),Math.max(0,c-(Q+O)),Jt.TOP_LEFT):new it(l.left+U+j,l.top+Q+O),this.topRightContentBox=m>0||_>0?wa(l.left+Math.min(M,l.width+U+j),l.top+Q+O,M>l.width+U+j?0:m-U+j,_-(Q+O),Jt.TOP_RIGHT):new it(l.left+l.width-(D+R),l.top+Q+O),this.bottomRightContentBox=y>0||v>0?wa(l.left+Math.min(S,l.width-(U+j)),l.top+Math.min($,l.height+Q+O),Math.max(0,y-(D+R)),v-(V+P),Jt.BOTTOM_RIGHT):new it(l.left+l.width-(D+R),l.top+l.height-(V+P)),this.bottomLeftContentBox=k>0||b>0?wa(l.left+U+j,l.top+I,Math.max(0,k-(U+j)),b-(V+P),Jt.BOTTOM_LEFT):new it(l.left+U+j,l.top+l.height-(V+P))}return e}(),Jt;(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"})(Jt||(Jt={}));var wa=function(e,t,a,l,s){var i=4*((Math.sqrt(2)-1)/3),c=a*i,p=l*i,m=e+a,_=t+l;switch(s){case Jt.TOP_LEFT:return new oo(new it(e,_),new it(e,_-p),new it(m-c,t),new it(m,t));case Jt.TOP_RIGHT:return new oo(new it(e,t),new it(e+c,t),new it(m,_-p),new it(m,_));case Jt.BOTTOM_RIGHT:return new oo(new it(m,t),new it(m,t+p),new it(e+c,_),new it(e,_));case Jt.BOTTOM_LEFT:default:return new oo(new it(m,_),new it(m-c,_),new it(e,t+p),new it(e,t))}},Vo=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},K0=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},To=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},G0=function(){function e(t,a,l){this.offsetX=t,this.offsetY=a,this.matrix=l,this.type=0,this.target=6}return e}(),io=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),j0=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),z0=function(e){return e.type===0},zA=function(e){return e.type===1},q0=function(e){return e.type===2},Uu=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},Y0=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})},qA=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),YA=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new N0(this.container),this.container.styles.opacity<1&&this.effects.push(new j0(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 G0(l,s,i))}if(this.container.styles.overflowX!==0){var c=Vo(this.curves),p=To(this.curves);Uu(c,p)?this.effects.push(new io(c,6)):(this.effects.push(new io(c,2)),this.effects.push(new io(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(m){return!zA(m)});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=Vo(l.curves),p=To(l.curves);Uu(c,p)||s.unshift(new io(p,6))}}else s.unshift.apply(s,i);l=l.parent}return s.filter(function(m){return La(m.target,t)})},e}(),$r=function(e,t,a,l){e.container.elements.forEach(function(s){var i=La(s.flags,4),c=La(s.flags,2),p=new YA(s,e);La(s.styles.display,2048)&&l.push(p);var m=La(s.flags,8)?[]:l;if(i||c){var _=i||s.styles.isPositioned()?a:t,g=new qA(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,b){return y>k.element.container.styles.zIndex.order?(v=b,!1):v>0}),_.negativeZIndex.splice(v,0,g)}else if(y>0){var w=0;_.positiveZIndex.some(function(k,b){return y>=k.element.container.styles.zIndex.order?(w=b+1,!1):w>0}),_.positiveZIndex.splice(w,0,g)}else _.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else s.styles.isFloating()?_.nonPositionedFloats.push(g):_.nonPositionedInlineLevel.push(g);$r(p,g,i?g:a,m)}else s.styles.isInlineLevel()?t.inlineLevel.push(p):t.nonInlineLevel.push(p),$r(p,t,a,m);La(s.flags,8)&&WA(s,m)})},WA=function(e,t){for(var a=e instanceof kr?e.start:1,l=e instanceof kr?e.reversed:!1,s=0;s<t.length;s++){var i=t[s];i.container instanceof QA&&typeof i.container.value=="number"&&i.container.value!==0&&(a=i.container.value),i.listValue=Qn(a,i.container.styles.listStyleType,!0),a+=l?-1:1}},W0=function(e){var t=new YA(e,null),a=new qA(t),l=[];return $r(t,a,a,l),WA(t.container,l),a},Iu=function(e,t){switch(t){case 0:return Bl(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return Bl(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return Bl(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return Bl(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},X0=function(e,t){switch(t){case 0:return Bl(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return Bl(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return Bl(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return Bl(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},J0=function(e,t){switch(t){case 0:return Bl(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return Bl(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return Bl(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return Bl(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Z0=function(e,t){switch(t){case 0:return ro(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return ro(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return ro(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return ro(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},ro=function(e,t){var a=[];return wl(e)?a.push(e.subdivide(.5,!1)):a.push(e),wl(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},Bl=function(e,t,a,l){var s=[];return wl(e)?s.push(e.subdivide(.5,!1)):s.push(e),wl(a)?s.push(a.subdivide(.5,!0)):s.push(a),wl(l)?s.push(l.subdivide(.5,!0).reverse()):s.push(l),wl(t)?s.push(t.subdivide(.5,!1).reverse()):s.push(t),s},XA=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},Mo=function(e){var t=e.styles,a=e.bounds,l=ha(t.paddingLeft,a.width),s=ha(t.paddingRight,a.width),i=ha(t.paddingTop,a.width),c=ha(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))},ew=function(e,t){return e===0?t.bounds:e===2?Mo(t):XA(t)},tw=function(e,t){return e===0?t.bounds:e===2?Mo(t):XA(t)},Pi=function(e,t,a){var l=ew(Ps(e.styles.backgroundOrigin,t),e),s=tw(Ps(e.styles.backgroundClip,t),e),i=aw(Ps(e.styles.backgroundSize,t),a,l),c=i[0],p=i[1],m=vn(Ps(e.styles.backgroundPosition,t),l.width-c,l.height-p),_=lw(Ps(e.styles.backgroundRepeat,t),m,i,l,s),g=Math.round(l.left+m[0]),y=Math.round(l.top+m[1]);return[_,g,y,c,p]},Rs=function(e){return ia(e)&&e.value===Ys.AUTO},uo=function(e){return typeof e=="number"},aw=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[ha(c,a.width),ha(p,a.height)];var m=uo(i);if(ia(c)&&(c.value===Ys.CONTAIN||c.value===Ys.COVER)){if(uo(i)){var _=a.width/a.height;return _<i!=(c.value===Ys.COVER)?[a.width,a.width/i]:[a.height*i,a.height]}return[a.width,a.height]}var g=uo(l),y=uo(s),v=g||y;if(Rs(c)&&(!p||Rs(p))){if(g&&y)return[l,s];if(!m&&!v)return[a.width,a.height];if(v&&m){var w=g?l:s*i,k=y?s:l/i;return[w,k]}var b=g?l:a.width,x=y?s:a.height;return[b,x]}if(m){var F=0,M=0;return Ta(c)?F=ha(c,a.width):Ta(p)&&(M=ha(p,a.height)),Rs(c)?F=M*i:(!p||Rs(p))&&(M=F/i),[F,M]}var $=null,S=null;if(Ta(c)?$=ha(c,a.width):p&&Ta(p)&&(S=ha(p,a.height)),$!==null&&(!p||Rs(p))&&(S=g&&y?$/l*s:a.height),S!==null&&Rs(c)&&($=g&&y?S/s*l:a.width),$!==null&&S!==null)return[$,S];throw new Error("Unable to calculate background-size for element")},Ps=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},lw=function(e,t,a,l,s){var i=t[0],c=t[1],p=a[0],m=a[1];switch(e){case 2:return[new it(Math.round(l.left),Math.round(l.top+c)),new it(Math.round(l.left+l.width),Math.round(l.top+c)),new it(Math.round(l.left+l.width),Math.round(m+l.top+c)),new it(Math.round(l.left),Math.round(m+l.top+c))];case 3:return[new it(Math.round(l.left+i),Math.round(l.top)),new it(Math.round(l.left+i+p),Math.round(l.top)),new it(Math.round(l.left+i+p),Math.round(l.height+l.top)),new it(Math.round(l.left+i),Math.round(l.height+l.top))];case 1:return[new it(Math.round(l.left+i),Math.round(l.top+c)),new it(Math.round(l.left+i+p),Math.round(l.top+c)),new it(Math.round(l.left+i+p),Math.round(l.top+c+m)),new it(Math.round(l.left+i),Math.round(l.top+c+m))];default:return[new it(Math.round(s.left),Math.round(s.top)),new it(Math.round(s.left+s.width),Math.round(s.top)),new it(Math.round(s.left+s.width),Math.round(s.height+s.top)),new it(Math.round(s.left),Math.round(s.height+s.top))]}},sw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Qu="Hidden Text",nw=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=sw,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(Qu)),l.appendChild(i),l.appendChild(s);var p=s.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(Qu)),l.style.lineHeight="normal",s.style.verticalAlign="super";var m=s.offsetTop-l.offsetTop+2;return c.removeChild(l),{baseline:p,middle:m}},e.prototype.getMetrics=function(t,a){var l=t+" "+a;return typeof this._data[l]>"u"&&(this._data[l]=this.parseMetrics(t,a)),this._data[l]},e}(),JA=function(){function e(t,a){this.context=t,this.options=a}return e}(),ow=1e4,iw=function(e){Ul(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 nw(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(),q0(a)&&(this.ctx.globalAlpha=a.opacity),z0(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)),zA(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 el(this,void 0,void 0,function(){var l;return qa(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 el(this,void 0,void 0,function(){return qa(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=dd(a.text);c.reduce(function(p,m){return i.ctx.fillText(m,p,a.bounds.top+s),p+i.ctx.measureText(m).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var l=a.fontVariant.filter(function(c){return c==="normal"||c==="small-caps"}).join(""),s=Aw(a.fontFamily).join(", "),i=Mn(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 el(this,void 0,void 0,function(){var s,i,c,p,m,_,g,y,v=this;return qa(this,function(w){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",m=this.fontMetrics.getMetrics(c,p),_=m.baseline,g=m.middle,y=l.paintOrder,a.textBounds.forEach(function(k){y.forEach(function(b){switch(b){case 0:v.ctx.fillStyle=Ha(l.color),v.renderTextWithLetterSpacing(k,l.letterSpacing,_);var x=l.textShadow;x.length&&k.text.trim().length&&(x.slice(0).reverse().forEach(function(F){v.ctx.shadowColor=Ha(F.color),v.ctx.shadowOffsetX=F.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=F.offsetY.number*v.options.scale,v.ctx.shadowBlur=F.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(F){switch(F){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=Mo(a),c=To(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 el(this,void 0,void 0,function(){var l,s,i,c,p,m,M,M,_,g,y,v,S,w,k,I,b,x,F,M,$,S,I;return qa(this,function(Q){switch(Q.label){case 0:this.applyEffects(a.getEffects(4)),l=a.container,s=a.curves,i=l.styles,c=0,p=l.textNodes,Q.label=1;case 1:return c<p.length?(m=p[c],[4,this.renderTextNode(m,i)]):[3,4];case 2:Q.sent(),Q.label=3;case 3:return c++,[3,1];case 4:if(!(l instanceof EA))return[3,8];Q.label=5;case 5:return Q.trys.push([5,7,,8]),[4,this.context.cache.match(l.src)];case 6:return M=Q.sent(),this.renderReplacedElement(l,s,M),[3,8];case 7:return Q.sent(),this.context.logger.error("Error loading image "+l.src),[3,8];case 8:if(l instanceof UA&&this.renderReplacedElement(l,s,l.canvas),!(l instanceof IA))return[3,12];Q.label=9;case 9:return Q.trys.push([9,11,,12]),[4,this.context.cache.match(l.svg)];case 10:return M=Q.sent(),this.renderReplacedElement(l,s,M),[3,12];case 11:return Q.sent(),this.context.logger.error("Error loading svg "+l.svg.substring(0,255)),[3,12];case 12:return l instanceof TA&&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=Q.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),Q.label=14;case 14:if(l instanceof ud&&(y=Math.min(l.bounds.width,l.bounds.height),l.type===Uo?l.checked&&(this.ctx.save(),this.path([new it(l.bounds.left+y*.39363,l.bounds.top+y*.79),new it(l.bounds.left+y*.16,l.bounds.top+y*.5549),new it(l.bounds.left+y*.27347,l.bounds.top+y*.44071),new it(l.bounds.left+y*.39694,l.bounds.top+y*.5649),new it(l.bounds.left+y*.72983,l.bounds.top+y*.23),new it(l.bounds.left+y*.84,l.bounds.top+y*.34085),new it(l.bounds.left+y*.39363,l.bounds.top+y*.79)]),this.ctx.fillStyle=Ha(yu),this.ctx.fill(),this.ctx.restore()):l.type===Io&&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(yu),this.ctx.fill(),this.ctx.restore())),rw(l)&&l.value.length){switch(v=this.createFontStyle(i),S=v[0],w=v[1],k=this.fontMetrics.getMetrics(S,w).baseline,this.ctx.font=S,this.ctx.fillStyle=Ha(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=uw(l.styles.textAlign),I=Mo(l),b=0,l.styles.textAlign){case 1:b+=I.width/2;break;case 2:b+=I.width;break}x=I.add(b,0,0,-I.height/2+1),this.ctx.save(),this.path([new it(I.left,I.top),new it(I.left+I.width,I.top),new it(I.left+I.width,I.top+I.height),new it(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Bn(l.value,x),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(F=l.styles.listStyleImage,F.type!==0)return[3,18];M=void 0,$=F.url,Q.label=15;case 15:return Q.trys.push([15,17,,18]),[4,this.context.cache.match($)];case 16:return M=Q.sent(),this.ctx.drawImage(M,l.bounds.left-(M.width+10),l.bounds.top),[3,18];case 17:return Q.sent(),this.context.logger.error("Error loading list-style-image "+$),[3,18];case 18:return[3,20];case 19:a.listValue&&l.styles.listStyleType!==-1&&(S=this.createFontStyle(i)[0],this.ctx.font=S,this.ctx.fillStyle=Ha(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new Xl(l.bounds.left,l.bounds.top+ha(l.styles.paddingTop,l.bounds.width),l.bounds.width,lu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Bn(a.listValue,I),i.letterSpacing,lu(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),Q.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(a){return el(this,void 0,void 0,function(){var l,s,F,i,c,F,p,m,F,_,g,F,y,v,F,w,k,F,b,x,F;return qa(this,function(M){switch(M.label){case 0:if(La(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:M.sent(),l=0,s=a.negativeZIndex,M.label=2;case 2:return l<s.length?(F=s[l],[4,this.renderStack(F)]):[3,5];case 3:M.sent(),M.label=4;case 4:return l++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:M.sent(),i=0,c=a.nonInlineLevel,M.label=7;case 7:return i<c.length?(F=c[i],[4,this.renderNode(F)]):[3,10];case 8:M.sent(),M.label=9;case 9:return i++,[3,7];case 10:p=0,m=a.nonPositionedFloats,M.label=11;case 11:return p<m.length?(F=m[p],[4,this.renderStack(F)]):[3,14];case 12:M.sent(),M.label=13;case 13:return p++,[3,11];case 14:_=0,g=a.nonPositionedInlineLevel,M.label=15;case 15:return _<g.length?(F=g[_],[4,this.renderStack(F)]):[3,18];case 16:M.sent(),M.label=17;case 17:return _++,[3,15];case 18:y=0,v=a.inlineLevel,M.label=19;case 19:return y<v.length?(F=v[y],[4,this.renderNode(F)]):[3,22];case 20:M.sent(),M.label=21;case 21:return y++,[3,19];case 22:w=0,k=a.zeroOrAutoZIndexOrTransformedOrOpacity,M.label=23;case 23:return w<k.length?(F=k[w],[4,this.renderStack(F)]):[3,26];case 24:M.sent(),M.label=25;case 25:return w++,[3,23];case 26:b=0,x=a.positiveZIndex,M.label=27;case 27:return b<x.length?(F=x[b],[4,this.renderStack(F)]):[3,30];case 28:M.sent(),M.label=29;case 29:return b++,[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=wl(s)?s.start:s;i===0?l.ctx.moveTo(c.x,c.y):l.ctx.lineTo(c.x,c.y),wl(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 m=p.getContext("2d");return m.drawImage(a,0,0,a.width,a.height,0,0,l,s),p},t.prototype.renderBackgroundImage=function(a){return el(this,void 0,void 0,function(){var l,s,i,c,p,m;return qa(this,function(_){switch(_.label){case 0:l=a.styles.backgroundImage.length-1,s=function(g){var y,v,w,O,X,ne,j,q,V,k,O,X,ne,j,q,b,x,F,M,$,S,I,Q,D,V,U,O,R,P,j,q,z,X,ne,he,N,G,Z,W,ie,ye,fe;return qa(this,function(ge){switch(ge.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,ge.label=1;case 1:return ge.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return y=ge.sent(),[3,4];case 3:return ge.sent(),i.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(w=Pi(a,l,[y.width,y.height,y.width/y.height]),O=w[0],X=w[1],ne=w[2],j=w[3],q=w[4],V=i.ctx.createPattern(i.resizeImage(y,j,q),"repeat"),i.renderRepeat(O,V,X,ne)),[3,6];case 5:zy(g)?(k=Pi(a,l,[null,null,null]),O=k[0],X=k[1],ne=k[2],j=k[3],q=k[4],b=Py(g.angle,j,q),x=b[0],F=b[1],M=b[2],$=b[3],S=b[4],I=document.createElement("canvas"),I.width=j,I.height=q,Q=I.getContext("2d"),D=Q.createLinearGradient(F,$,M,S),tu(g.stops,x).forEach(function(se){return D.addColorStop(se.stop,Ha(se.color))}),Q.fillStyle=D,Q.fillRect(0,0,j,q),j>0&&q>0&&(V=i.ctx.createPattern(I,"repeat"),i.renderRepeat(O,V,X,ne))):qy(g)&&(U=Pi(a,l,[null,null,null]),O=U[0],R=U[1],P=U[2],j=U[3],q=U[4],z=g.position.length===0?[od]:g.position,X=ha(z[0],j),ne=ha(z[z.length-1],q),he=Ny(g,X,ne,j,q),N=he[0],G=he[1],N>0&&G>0&&(Z=i.ctx.createRadialGradient(R+X,P+ne,0,R+X,P+ne,N),tu(g.stops,N*2).forEach(function(se){return Z.addColorStop(se.stop,Ha(se.color))}),i.path(O),i.ctx.fillStyle=Z,N!==G?(W=a.bounds.left+.5*a.bounds.width,ie=a.bounds.top+.5*a.bounds.height,ye=G/N,fe=1/ye,i.ctx.save(),i.ctx.translate(W,ie),i.ctx.transform(1,0,0,ye,0,0),i.ctx.translate(-W,-ie),i.ctx.fillRect(R,fe*(P-ie)+ie,j,q*fe),i.ctx.restore()):i.ctx.fill())),ge.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?(m=p[c],[5,s(m)]):[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 el(this,void 0,void 0,function(){return qa(this,function(i){return this.path(Iu(s,l)),this.ctx.fillStyle=Ha(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,l,s,i){return el(this,void 0,void 0,function(){var c,p;return qa(this,function(m){switch(m.label){case 0:return l<3?[4,this.renderSolidBorder(a,s,i)]:[3,2];case 1:return m.sent(),[2];case 2:return c=X0(i,s),this.path(c),this.ctx.fillStyle=Ha(a),this.ctx.fill(),p=J0(i,s),this.path(p),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return el(this,void 0,void 0,function(){var l,s,i,c,p,m,_,g,y=this;return qa(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),l=a.container.styles,s=!us(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=dw(Ps(l.backgroundClip,0),a.curves),s||l.boxShadow.length?(this.ctx.save(),this.path(c),this.ctx.clip(),us(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(w){y.ctx.save();var k=Vo(a.curves),b=w.inset?0:ow,x=Y0(k,-b+(w.inset?1:-1)*w.spread.number,(w.inset?1:-1)*w.spread.number,w.spread.number*(w.inset?-2:2),w.spread.number*(w.inset?-2:2));w.inset?(y.path(k),y.ctx.clip(),y.mask(x)):(y.mask(k),y.ctx.clip(),y.path(x)),y.ctx.shadowOffsetX=w.offsetX.number+b,y.ctx.shadowOffsetY=w.offsetY.number,y.ctx.shadowColor=Ha(w.color),y.ctx.shadowBlur=w.blur.number,y.ctx.fillStyle=w.inset?Ha(w.color):"rgba(0,0,0,1)",y.ctx.fill(),y.ctx.restore()}),v.label=2;case 2:p=0,m=0,_=i,v.label=3;case 3:return m<_.length?(g=_[m],g.style!==0&&!us(g.color)&&g.width>0?g.style!==2?[3,5]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return g.style!==3?[3,7]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,3)];case 6:return v.sent(),[3,11];case 7:return g.style!==4?[3,9]:[4,this.renderDoubleBorder(g.color,g.width,p,a.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(g.color,p,a.curves)];case 10:v.sent(),v.label=11;case 11:p++,v.label=12;case 12:return m++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,l,s,i,c){return el(this,void 0,void 0,function(){var p,m,_,g,y,v,w,k,b,x,F,M,$,S,I,Q,I,Q;return qa(this,function(D){return this.ctx.save(),p=Z0(i,s),m=Iu(i,s),c===2&&(this.path(m),this.ctx.clip()),wl(m[0])?(_=m[0].start.x,g=m[0].start.y):(_=m[0].x,g=m[0].y),wl(m[1])?(y=m[1].end.x,v=m[1].end.y):(y=m[1].x,v=m[1].y),s===0||s===2?w=Math.abs(_-y):w=Math.abs(g-v),this.ctx.beginPath(),c===3?this.formatPath(p):this.formatPath(m.slice(0,2)),k=l<3?l*3:l*2,b=l<3?l*2:l,c===3&&(k=l,b=l),x=!0,w<=k*2?x=!1:w<=k*2+b?(F=w/(2*k+b),k*=F,b*=F):(M=Math.floor((w+b)/(k+b)),$=(w-M*k)/(M-1),S=(w-(M+1)*k)/M,b=S<=0||Math.abs(b-$)<Math.abs(b-S)?$:S),x&&(c===3?this.ctx.setLineDash([0,k+b]):this.ctx.setLineDash([k,b])),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&&(wl(m[0])&&(I=m[3],Q=m[0],this.ctx.beginPath(),this.formatPath([new it(I.end.x,I.end.y),new it(Q.start.x,Q.start.y)]),this.ctx.stroke()),wl(m[1])&&(I=m[1],Q=m[2],this.ctx.beginPath(),this.formatPath([new it(I.end.x,I.end.y),new it(Q.start.x,Q.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return el(this,void 0,void 0,function(){var l;return qa(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=W0(a),[4,this.renderStack(l)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(JA),rw=function(e){return e instanceof VA||e instanceof DA?!0:e instanceof ud&&e.type!==Io&&e.type!==Uo},dw=function(e,t){switch(e){case 0:return Vo(t);case 2:return K0(t);case 1:default:return To(t)}},uw=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},cw=["-apple-system","system-ui"],Aw=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return cw.indexOf(t)===-1}):e},pw=function(e){Ul(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 el(this,void 0,void 0,function(){var l,s;return qa(this,function(i){switch(i.label){case 0:return l=Cr(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}(JA),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))})},mw=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,Hn([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,Hn([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,Hn([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,Hn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),hw=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new mw({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new T0(this,t)}return e.instanceCount=1,e}(),_w=function(e,t){return t===void 0&&(t={}),vw(e,t)};typeof window<"u"&&jA.setContext(window);var vw=function(e,t){return el(void 0,void 0,void 0,function(){var a,l,s,i,c,p,m,_,g,y,v,w,k,b,x,F,M,$,S,I,D,Q,D,V,U,O,R,P,j,q,z,X,ne,he,N,G,Z,W,ie,ye;return qa(this,function(fe){switch(fe.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:(V=t.allowTaint)!==null&&V!==void 0?V:!1,imageTimeout:(U=t.imageTimeout)!==null&&U!==void 0?U:15e3,proxy:t.proxy,useCORS:(O=t.useCORS)!==null&&O!==void 0?O:!1},i=rr({logging:(R=t.logging)!==null&&R!==void 0?R:!0,cache:t.cache},s),c={windowWidth:(P=t.windowWidth)!==null&&P!==void 0?P:l.innerWidth,windowHeight:(j=t.windowHeight)!==null&&j!==void 0?j:l.innerHeight,scrollX:(q=t.scrollX)!==null&&q!==void 0?q:l.pageXOffset,scrollY:(z=t.scrollY)!==null&&z!==void 0?z:l.pageYOffset},p=new Xl(c.scrollX,c.scrollY,c.windowWidth,c.windowHeight),m=new hw(i,p),_=(X=t.foreignObjectRendering)!==null&&X!==void 0?X:!1,g={allowTaint:(ne=t.allowTaint)!==null&&ne!==void 0?ne:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:_,copyStyles:_},m.logger.debug("Starting document clone with size "+p.width+"x"+p.height+" scrolled to "+-p.left+","+-p.top),y=new $u(m,e,g),v=y.clonedReferenceElement,v?[4,y.toIFrame(a,p)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return w=fe.sent(),k=cd(v)||g0(v)?Yv(v.ownerDocument):si(m,v),b=k.width,x=k.height,F=k.left,M=k.top,$=gw(m,v,t.backgroundColor),S={canvas:t.canvas,backgroundColor:$,scale:(N=(he=t.scale)!==null&&he!==void 0?he:l.devicePixelRatio)!==null&&N!==void 0?N:1,x:((G=t.x)!==null&&G!==void 0?G:0)+F,y:((Z=t.y)!==null&&Z!==void 0?Z:0)+M,width:(W=t.width)!==null&&W!==void 0?W:Math.ceil(b),height:(ie=t.height)!==null&&ie!==void 0?ie:Math.ceil(x)},_?(m.logger.debug("Document cloned, using foreign object rendering"),D=new pw(m,S),[4,D.render(v)]):[3,3];case 2:return I=fe.sent(),[3,5];case 3:return m.logger.debug("Document cloned, element located at "+F+","+M+" with size "+b+"x"+x+" using computed rendering"),m.logger.debug("Starting DOM parsing"),Q=LA(m,v),$===Q.styles.backgroundColor&&(Q.styles.backgroundColor=zl.TRANSPARENT),m.logger.debug("Starting renderer for element at "+S.x+","+S.y+" with size "+S.width+"x"+S.height),D=new iw(m,S),[4,D.render(Q)];case 4:I=fe.sent(),fe.label=5;case 5:return(!((ye=t.removeContainer)!==null&&ye!==void 0)||ye)&&($u.destroy(w)||m.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),m.logger.debug("Finished rendering"),[2,I]}})})},gw=function(e,t,a){var l=t.ownerDocument,s=l.documentElement?Cn(e,getComputedStyle(l.documentElement).backgroundColor):zl.TRANSPARENT,i=l.body?Cn(e,getComputedStyle(l.body).backgroundColor):zl.TRANSPARENT,c=typeof a=="string"?Cn(e,a):a===null?zl.TRANSPARENT:4294967295;return t===l.documentElement?us(s)?us(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&&_w(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 Ni={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 Du;function yw(){return Du||(Du=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 w=c.listSchemes(_,g);if(!w.length)return null;_=w[(y||0)%w.length]}var k=l(arguments,2);return k[0]=g,_.apply(_,k)};c.Scheme=function(_,g){var y={},v=0,w=i,k=function(){if(arguments.length<=1)return b.color_func.bind(b);var x=l(arguments);return function(F){return x[0]=F,b.color_func.apply(b,x)}},b=function(x,F){if(x|=0,!x)return[];var M=x;if(x=Math.abs(x),x<=v){for(var $=Math.max(x,w);!($ in y);++$);var S=y[$];if($>x){var I="shrinking_takes_head"in S?S.shrinking_takes_head:b.shrinking_takes_head;if(I)S=S.slice(0,x),$=x;else return c.generate(function(Q){return S[Math.round(Q)]},M,0,S.length-1)}return S=S.slice(),M<0&&S.reverse(),S}else return b.color_func?c.generate(k.apply(b,arguments),M,0,1,b.color_func_cyclic):null};return b.scheme_name=_,b.groups=g?typeof g=="string"?[g]:g:[],b.max=0,b.cbf_max=i,b.addPalette=function(x,F){var M=x.length;M&&(y[M]=x,w=Math.min(w,M),v=Math.max(v,M),b.max=Math.max(b.max,M),!F&&M!=1&&(b.cbf_max=Math.min(b.cbf_max,M-1)))},b.addPalettes=function(x,F,M){F=F||x.length;for(var $=0;$<F;++$)$ in x&&b.addPalette(x[$],!0);b.cbf_max=Math.min(b.cbf_max,M||1)},b.shrinkByTakingHead=function(x,F){F!==void 0?F in y&&(y[F].shrinking_takes_head=!!x):b.shrinking_takes_head=!!x},b.setColorFunction=function(x,F,M){b.color_func=x,b.color_func_cyclic=!!M,b.max=i,!F&&b.cbf_max===i&&(b.cbf_max=1)},b.color=function(x,F){return b.color_func?b.color_func.apply(this,arguments):null},b},c.Scheme.fromPalettes=function(_,g,y,v,w){var k=c.Scheme(_,g);return k.addPalettes.apply(k,l(arguments,2)),k},c.Scheme.withColorFunction=function(_,g,y,v,w){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 w=v.substring(v.length-4)==="-cbf";w&&(v=v.substring(0,v.length-4));for(var k=p["g-"+v]||p["n-"+v]||[],b=0,x;x=k[b];++b)(w?x.cbf:x.max)>=g&&y.push(x)}),y.sort(function(v,w){return v.scheme_name>=w.scheme_name?v.scheme_name>w.scheme_name?1:0:-1}),y},c.generate=function(_,g,y,v,w){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),b=y,x=[],F=(v-y)/(w?k:k-1);--k>=0;b+=F)x.push(_(b));return g<0&&x.reverse(),x};var m=function(_){return _>0?_<1?_:1:0};return c.rgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=Number(Math.round(m(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},c.linearRgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=m(v),v<=.0031308?v=12.92*v:v=1.055*Math.pow(v,.4166666666666667)-.055,v=Number(Math.round(v*255)).toString(16),v.length==1?"0"+v:v}).join("")},c.hsvColor=function(_,g,y){_*=6;var v=g===void 0?1:m(g),w=y===void 0?1:m(y),k=w*(1-v*Math.abs(_%2-1)),b=w*(1-v);switch(Math.floor(_)%6){case 0:return c.rgbColor(w,k,b);case 1:return c.rgbColor(k,w,b);case 2:return c.rgbColor(b,w,k);case 3:return c.rgbColor(b,k,w);case 4:return c.rgbColor(k,b,w);default:return c.rgbColor(w,b,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,m=arguments[p];p>1;)m=m*i+arguments[--p];return m},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)}(Ni)),Ni.exports}yw();class bw extends nl{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=Ot.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(){Ot.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=bw.init();function Es(e){const t=at(e[0]).format("MMMM D, YYYY"),a=at(e[1]).format("MMMM D, YYYY");return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Us(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 Il(e){return e.map(t=>Us(t.group))}const Oa=Ve.colors.report,ww={[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 za(e){return ww[e]}function ul(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const Cw={class:"fct-gross-sale-vs-net-revenue-wrap"},kw={class:"fct-btn-group sm"},Bw={__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=T(null),s=T(null);T("daily");const i=T(ga.getChartType("order","sales_growth_chart")||"line"),c=Ve.colors.report,p=T(Ve.isDark()),m=K(()=>a.chartData.every($=>$.orders===0)),_=K(()=>p.value?c.dark_cyan_blue_16:c.light_gray),g=K(()=>p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue),y=K(()=>[{title:u("Orders"),key:"orders",color:_.value,yAxisIndex:1},{title:u("Revenue"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:$,key:S,color:I,yAxisIndex:Q})=>F($,i.value,a.chartData.map(D=>D[S]),I,Q)));Pa.map($=>$.slice(0,3));const v=K(()=>Il(a.chartData));let w=null;const k=()=>{w&&(w.dispose(),w=null),Be(()=>{l.value&&(w=ea(l.value),x())})},b=K(()=>ul(a.chartData.length)),x=()=>{if(!w)return;p.value=Ve.isDark();const $={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:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},formatter:S=>{let I=S[0].name;return S.forEach(Q=>{const D=Q.seriesIndex===1?`${et.scaled(Q.value)}`:Q.value,V=p.value?"#ffffff":"#565865";I+=`<div>
101 ${Q.marker}
102 <span style="color: ${V};">${Q.seriesName}</span>
103 <span style="float: right; margin-left: 20px; color: ${V};">
104 ${D}
105 </span>
106 </div>`}),I}},xAxis:{type:"category",data:v.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,interval:b.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Revenue"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:S=>`${et.scaledChart(S)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:u("Orders"),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};w.setOption($,{notMerge:!0,replaceMerge:["series"]})},F=($,S,I,Q,D)=>({name:$,type:S,barMaxWidth:30,data:I,smooth:!1,color:Q,lineStyle:{width:3},areaStyle:{opacity:.3,color:Q},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},yAxisIndex:D,emphasis:{scale:2,itemStyle:{color:za(Q)},lineStyle:{color:Q},areaStyle:{opacity:.3,color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),M=$=>{i.value!==$&&(i.value=$,ga.onChange("order","sales_growth_chart",$),x())};return be([()=>a.chartData,i],()=>{Be(x)},{deep:!0}),be(m,$=>{$||k()}),be(()=>a.loading,$=>{$||k()}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",x),Be(k)}),($,S)=>{const I=C("el-skeleton");return r(),h("div",Cw,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[n(Qe,{title:$.$t("Sales Growth"),border_bottom:""},la({_:2},[!m.value&&!e.loading?{name:"action",fn:d(()=>[o("div",kw,[n(Rl,{activeType:i.value,types:{bar:"BarChart",line:"LineChart"},onChange:M},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(I,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(H,{key:1},[m.value?(r(),E(bt,{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)])}}},xw={class:"fct-gross-sale-vs-net-revenue-wrap"},Sw={class:"fct-btn-group sm"},Fw={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},$w={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},Vu=.5,Ki=6,co=1.2,Ew={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=Ve.colors,l=T(null),s=T(null),i=T(!1),c=T("world"),p=T(92),m=T(100);T(!1);let _=null,g=null,y=50;const v=T(1.2),w=T(),k=a.blue,b=K(()=>{const G=m.value-p.value,Z=t.data?t.data.length:0;return G<60||Z<15}),x=G=>{G=G.replace(/^#/,"");const Z=parseInt(G.substring(0,2),16),W=parseInt(G.substring(2,4),16),ie=parseInt(G.substring(4,6),16);return[Z,W,ie]},F=()=>Ve.isDark()?a.gray[50]:a.gray[600],M=x(k[500]),$=async()=>{const G=cs.getUrl("world.geo.json"),W=await(await fetch(G)).json();Xf("world",W)},S=G=>{if(!G||isNaN(G))return`rgba(${M.join(",")}, 0)`;const Z=Math.log(G+1)/Math.log(y+1);return`rgba(${M.join(",")}, ${Z})`},I=G=>{c.value=G,q(),_&&(_.clear(),_.setOption(P()),G==="bar"&&Q()),g&&i.value&&(g.clear(),g.setOption(P()),G==="bar"&&D())},Q=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(G){G.batch&&G.batch[0]?(p.value=G.batch[0].start||0,m.value=G.batch[0].end||100):(p.value=G.start||0,m.value=G.end||100),setTimeout(()=>{q()},100)}))},D=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(G){G.batch&&G.batch[0]?(p.value=G.batch[0].start||0,m.value=G.batch[0].end||100):(p.value=G.start||0,m.value=G.end||100),setTimeout(()=>{g&&g.setOption(P())},100)}))},V=K(()=>(t.data||[]).map(G=>({...G,value:G.value||0,itemStyle:{color:S(G.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),U=()=>({backgroundColor:Ve.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:G=>u("%1$s%2$s Orders: %3$s",G.name,"<br>",G.value||0),borderRadius:8,backgroundColor:Ve.isDark()?"#38485a":"#ffffff",borderColor:Ve.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Ve.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:w.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:V.value}]}),O=K(()=>{const G=t.data.length,Z=m.value-p.value,W=Math.ceil(G*Z/100);let ie=0;return W>100?ie=9:W>50?ie=4:W>30?ie=2:W>20&&(ie=1),ie}),R=()=>{const G=b.value;return{backgroundColor:Ve.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(Z){const W=Z[0];return`${W.name}<br/>${u("Orders")}: ${W.value||0}`},backgroundColor:Ve.isDark()?"#38485a":"#ffffff",textStyle:{color:Ve.isDark()?a.gray[25]:a.system.mid},borderColor:Ve.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:p.value,end:m.value},{type:"slider",yAxisIndex:0,start:p.value,end:m.value,width:25,top:10,right:10,textStyle:{color:F()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:G?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:G},splitLine:{show:!1},axisLine:{show:G,lineStyle:{color:F()}},axisLabel:{show:G,interval:O.value,color:F(),fontSize:11},data:t.data.map(Z=>Z.name)},xAxis:{type:"value",axisLabel:{show:!0,color:F(),formatter:function(Z){return Z.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Ve.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new nr(0,0,1,0,[{offset:0,color:k[400]},{offset:1,color:k[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new nr(0,0,1,0,[{offset:0,color:k[500]},{offset:1,color:k[700]}])}},data:t.data.map(Z=>Z.value),label:{show:G,formatter:"{c}",position:"right",color:F(),fontSize:10}}]}},P=()=>c.value==="bar"?R():U(),j=async()=>{await $(),l.value&&(_=ea(l.value),_.setOption(P()),c.value==="bar"&&Q(),_.on("georoam",()=>{const Z=_.getOption().series[0].zoom;if(Z!==v.value)if(Z<co||Z>Ki){const W=Math.max(co,Math.min(Ki,Z));_.setOption({series:[{zoom:W}]},!1),v.value=W}else v.value=Z}))},q=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(G=>G.value||0)):y=1,_&&_.setOption(P(),{notMerge:!0})},z=()=>{v.value=Math.min(v.value+Vu,Ki),w.value=!0,_.setOption({series:[{zoom:v.value,roam:w.value}]})},X=()=>{v.value=Math.max(v.value-Vu,co),w.value=!0,_.setOption({series:[{zoom:v.value,roam:w.value}]})},ne=()=>{c.value==="bar"?(p.value=92,m.value=100,_&&_.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=co,w.value="move",_&&(_.clear(),_.setOption(P())))},he=async()=>{i.value=!0,await Be(),g?g.clear():g=ea(s.value),g.setOption(P()),c.value==="bar"&&D()},N=G=>{F(),_&&_.setOption(P())};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",N),w.value="move",Be(j)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",N),_&&(_.dispose(),_=null),g&&(g.dispose(),g=null)}),be(()=>t.data,()=>q(),{deep:!0}),be(b,()=>{c.value==="bar"&&Be(()=>{q()})}),(G,Z)=>(r(),h("div",xw,[n(xe,{id:"chartContainer",class:"mb-0"},{default:d(()=>[n(Qe,{title:G.$t("Order Heat Map"),border_bottom:""},{action:d(()=>[o("div",Sw,[n(Rl,{activeType:c.value,types:{world:"Globe",bar:"BarChart"},onChange:I},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",Fw,[n(Ze,{tag:"button",size:"small",onClick:z},{default:d(()=>[n(J,{name:"Plus"})]),_:1}),n(Ze,{tag:"button",size:"small",onClick:X},{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:he},{default:d(()=>[n(J,{name:"Eye"})]),_:1})])):B("",!0),c.value==="bar"?(r(),h("div",$w,[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(tm),{modelValue:i.value,"onUpdate:modelValue":Z[0]||(Z[0]=W=>i.value=W),title:G.$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"])]))}},Uw=st(Ew,[["__scopeId","data-v-36a900c8"]]),Iw={class:"fct-report-card"},Qw={key:0,class:"fct-report-card-header"},Dw={key:0,class:"flex items-center gap-2"},Vw={class:"title"},Tw={class:"actions"},Mw={class:"fct-report-card-body flex h-full"},Lw={class:"w-full"},Ln={__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",Iw,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",Qw,[e.cardOptions.heading?(r(),h("div",Dw,[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",Vw,f(e.cardOptions.heading),1)])):B("",!0),o("div",Tw,[e.cardOptions.linkButtonText?(r(),E(l,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:d(()=>[L(f(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):B("",!0),Ba(t.$slots,"action")])])):B("",!0),o("div",Mw,[o("div",Lw,[Ba(t.$slots,"default")])])])}}},Rw={key:0,class:"fct-report-sold-product-list has-scroll"},Ow={class:"list-left-content"},Hw={class:"list-title"},Pw={class:"list-title-inner"},Nw={class:"list-id"},Kw={class:"list-right-content"},Gw=["innerHTML"],jw={class:"list-price"},zw={__name:"RecentOrders",setup(e){const t=ol.data;return(a,l)=>{const s=C("router-link");return r(),E(Ln,{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",Rw,[(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",Ow,[o("div",Hw,[o("div",Pw,f(p.customer_name)+" #"+f(A(Zt)(p.id)),1),o("div",Nw,[n(Na,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",Kw,[o("div",{class:"list-value",innerHTML:A(et).scaled(p.total_amount)},null,8,Gw),o("div",jw,f(A(Zt)(p.order_items_count))+" "+f(A(u)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),E(bt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},qw={key:0},Yw={key:1,class:"fc_dashboard_onboarding_wrap"},Ww={class:"fc_dashboard_onboarding_title"},Xw={class:"fc_dashboard_onboarding_lists"},Jw=["href"],Zw={class:"circle-shape"},eC={class:"fc_dashboard_onboarding_item__title"},tC={__name:"Onboarding",setup(e){const t=T(0),a=T(!1);qt().ctx;const l=T([]),s=T(!0);T(localStorage.getItem("started_content_collapse")==="true"||!1),K(()=>{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=Gr("dashboardTogglePageNotification");return Ie(async()=>{a.value=!0,ue.get("dashboard").then(p=>{var _;l.value=p.data.steps,t.value=p.data.completed,s.value=Object.keys(l.value).length!==t.value,a.value=!1;let m=((_=l.value.page_setup)==null?void 0:_.completed)||!1;c&&c(!m)}).catch(p=>{a.value=!1})}),(p,m)=>{const _=C("el-skeleton"),g=C("Check"),y=C("el-icon");return s.value?(r(),h("div",qw,[a.value?(r(),E(_,{key:0,rows:3,animated:""})):(r(),h("div",Yw,[o("h3",Ww,f(p.$t("Getting Started")),1),o("div",Xw,[(r(!0),h(H,null,ae(l.value,(v,w)=>(r(),h("a",{key:w,href:i(v),class:re([v.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",Zw,[v.completed===!0?(r(),E(y,{key:0},{default:d(()=>[n(g)]),_:1})):B("",!0)]),o("div",eC,f(v.title),1)],10,Jw))),128))])]))])):B("",!0)}}},aC={class:"fct-dashboard-recent-activities-wrap"},lC={class:"fct-dashboard-recent-activities__header"},sC={class:"fct-dashboard-recent-activities__header_title"},nC={class:"fct-dashboard-recent-activities__header_desc"},oC={key:0,class:"fct-dashboard-recent-activities__body"},iC={class:"content"},rC={class:"title"},dC=["onClick"],uC={class:"date"},cC=["innerHTML"],AC={class:"created_by"},pC={key:1,class:"fct-dashboard-recent-activities__empty"},fC={class:"fct-dashboard-recent-activities__empty_text"},mC={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=al(),l=T([{label:u("All"),value:"all"},{label:u("Today"),value:"today"},{label:u("Yesterday"),value:"yesterday"},{label:u("This Week"),value:"this_week"}]),s=T("all"),i=()=>{switch(s.value){case"all":return u("all");case"today":return u("today");case"yesterday":return u("yesterday");case"this_week":return u("this week");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"},m={order:{name:"view_order",param:"order_id",permission:"orders/view"},payment:{name:"view_order",param:"order_id",permission:"orders/view"},product:{name:"view_product",param:"product_id",permission:"products/view"},customer:{name:"view_customer",param:"customer_id",permission:"customers/view"},coupon:{name:"view_coupon",param:"coupon_id",permission:"coupons/view"},subscription:{name:"view_subscription",param:"subscription_id",permission:"subscriptions/view"}},_=v=>{var b;let w=(b=v==null?void 0:v.module_name)==null?void 0:b.toLowerCase();const k=m[w];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 w=rt.get(p,da.capitalize(v.module_name));return w?Xs.has(w):!1},y=K(()=>ol.data.recentActivities.filter(v=>g(v)));return Ie(()=>{c()}),(v,w)=>{const k=C("el-radio-button"),b=C("el-radio-group");return r(),h("div",aC,[o("div",lC,[o("h4",sC,f(A(u)("Recent Activities")),1),o("p",nC,[s.value==="all"?(r(),h(H,{key:0},[L(f(A(u)("%1$s new activities",A(Zt)(y.value.length))),1)],64)):(r(),h(H,{key:1},[L(f(A(u)("%1$s new activities %2$s",A(Zt)(y.value.length),i())),1)],64))]),n(b,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":w[0]||(w[0]=x=>s.value=x),onChange:c,size:"large"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,(x,F)=>(r(),E(k,{key:F,label:x.label,value:x.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),y.value.length?(r(),h("div",oC,[(r(!0),h(H,null,ae(y.value,(x,F)=>{var M;return r(),h("div",{key:F,class:"fct-dashboard-recent-activities__item has-icon"},[w[1]||(w[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",iC,[o("h3",rC,[m[(M=x.module_name)==null?void 0:M.toLowerCase()]?(r(),h("span",{key:0,onClick:$=>_(x),class:"cursor-pointer"},f(x.title||"--"),9,dC)):(r(),h(H,{key:1},[L(f(x.title||"--"),1)],64)),o("span",uC,[n(Na,{"date-time":x.created_at},null,8,["date-time"])])]),o("p",{innerHTML:x.content,class:"description"},null,8,cC),o("span",AC,f(A(u)("By %s",x.created_by)),1)])])}),128))])):(r(),h("div",pC,[o("div",fC,f(A(u)("No activity found.")),1)]))])}}},hC={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},_C={__name:"SideBar",setup(e){return(t,a)=>(r(),h("div",hC,[n(Nt,{permission:"is_super_admin"},{default:d(()=>[n(tC)]),_:1}),n(mC,{onReload:a[0]||(a[0]=()=>{})})]))}},vC={class:"fct-product-create"},gC={class:"fct-product-step"},yC={class:"fct-product-item-selector"},bC=["onClick"],wC={class:"fct-product-item-selector-content"},CC={class:"fct-bundle-product-condition"},kC={class:"condition-text"},BC={class:"dialog-footer"},fi={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,l=t,s=al(),i=je.get("variation_types",{}),c=T({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"}],m=T(!1),_=T(null),g=w=>{c.value.detail.fulfillment_type=w},y=()=>{m.value=!0,ue.post("products",{...c.value}).then(w=>{if(Y.success(w.message),a.customModal==="order_modal"){const k={id:w.data.product_variants.id,object_id:w.data.product_variants.post_id,variation_id:w.data.product_variants.id,item_name:w.data.product_variants.variation_title,item_price:w.data.product_variants.item_price,quantity:1,stock:100,object_type:w.data.product_details.fulfillment_type,item_total:w.data.product_variants.item_price,line_total:w.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:w.data.ID}})}).catch(w=>{var k;w.status_code=="422"?Y.validationErrors(w):Y.error((k=w.data)==null?void 0:k.message)}).finally(()=>{m.value=!1})},v=w=>{w.stopPropagation(),w.preventDefault(),y()};return Ie(()=>{Be(()=>{setTimeout(()=>{var w;(w=_.value)==null||w.focus()},10)})}),(w,k)=>{const b=C("el-input"),x=C("el-form-item"),F=C("el-option"),M=C("el-select"),$=C("el-checkbox"),S=C("el-form"),I=C("el-button");return r(),h("div",vC,[o("div",gC,[n(S,{"label-position":"top",model:c.value,"require-asterisk-position":"right"},{default:d(()=>[n(x,{label:c.value.detail.other_info.is_bundle_product==="yes"?A(u)("Bundle Title"):A(u)("Product Title"),required:""},{default:d(()=>[n(b,{type:"text",modelValue:c.value.post_title,"onUpdate:modelValue":k[0]||(k[0]=Q=>c.value.post_title=Q),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(x,{key:0,label:A(u)("Variation Type")},{default:d(()=>[n(M,{modelValue:c.value.detail.variation_type,"onUpdate:modelValue":k[1]||(k[1]=Q=>c.value.detail.variation_type=Q),placeholder:A(u)("Select Variation Type"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(A(i),(Q,D)=>(r(),E(F,{key:D,label:Q,value:D},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):B("",!0),n(x,null,{default:d(()=>[o("ul",yC,[(r(),h(H,null,ae(p,Q=>o("li",{key:Q.type,class:re({active:Q.type===c.value.detail.fulfillment_type}),onClick:D=>g(Q.type)},[o("div",wC,[n(J,{name:Q.icon},null,8,["name"]),L(" "+f(Q.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,bC)),64))])]),_:1}),n(x,null,{default:d(()=>[o("div",CC,[n($,{modelValue:c.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":k[2]||(k[2]=Q=>c.value.detail.other_info.is_bundle_product=Q),"true-value":"yes","false-value":"no"},{default:d(()=>[L(f(A(u)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),o("span",kC,f(A(u)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",BC,[n(I,{disabled:!c.value.post_title||m.value,loading:m.value,onClick:y,type:"primary"},{default:d(()=>[L(f(m.value?A(u)("Creating"):A(u)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class Ad{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new Ad().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 xC={class:"fct-current-user-info-wrap"},SC={class:"fct-current-user-info-content"},FC={class:"image"},$C=["src","alt"],EC={class:"content"},UC={key:0,class:"fct-current-user-info-action"},IC={__name:"CurrentUserInfo",setup(e){const t=T(!1),a=T(je.get("me")),l=()=>je.get("shop.store_name"),s=je.get("total_products_count");return(i,c)=>{const p=C("el-button"),m=C("el-dialog");return r(),h("div",xC,[o("div",SC,[o("div",FC,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,$C)]),o("div",EC,[o("h4",null,f(A(Ad).greeting())+" "+f(a.value.full_name)+" 👋🏻",1),o("p",null,f(A(u)("Welcome to %1$s",l())),1)])]),n(Nt,{permission:"products/create"},{default:d(()=>[A(s)==0?(r(),h("div",UC,[n(p,{onClick:c[0]||(c[0]=_=>t.value=!0),type:"primary"},{default:d(()=>[L(f(A(u)("Add Product")),1)]),_:1})])):B("",!0)]),_:1}),n(m,{"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(fi)]),_:1},8,["modelValue","title"])])}}};class QC{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 DC{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 VC{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 Er?this.value.setModifiers([]).build():this.value}}}class Er{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 VC?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class xs{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 xs||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 xs?s.build.bind(s)():s),{condition_type:this.conditionType,conditions:l}}const t=this.key instanceof Er?this.key.build():this.key,a=this.value instanceof Er?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class TC{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 QC,this.modifier=new DC}match(t,a,l,s=!0){let i="",c=this.matcher.getMatchingMethod(a);return c!=null?i=c:i=da.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 xs){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(rt.get(s,"conditions")))i=this.evaluate(s.conditions,rt.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=rt.resolvePath(this.stateKey,rt.get(t,"key.accessor")):a=rt.resolvePath(this.stateKey,t.key);let s=rt.get(this.data,a);if(typeof t.value=="object"){const i=rt.resolvePath(this.stateKey,rt.get(t,"value.accessor"));l=rt.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=da.camel("apply"+i),c in this.modifier&&typeof this.modifier[c]=="function"){let m=s.value;typeof m=="object"&&m!==null&&(m=rt.getByPath(this.data,l,rt.get(m,"accessor"))),t=this.modifier[c](t,m,i,l,this.data)}}),t}}class ZA{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 xs||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 xs?a.build.bind(a)():a):t}}class ep{constructor(){Re(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class Lo{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new Lo;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 Ur{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="",rs.install(this,qc),rs.install(this,ep),rs.install(this,ZA),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 xs?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(da.headline(this._key)),label:this._label??u(da.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 Lo?this._suffix.build():this._suffix,prefix:this._prefix instanceof Lo?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Ir{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,rs.install(this,qc),rs.install(this,ep),rs.install(this,ZA)}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=an.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 Tu{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");rs.install(this,Ur,{key:t}),rs.install(this,Ir,{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=an.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??u(da.headline(this._key)),label:this._label??u(da.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 an{static build(t){return Array.isArray(t)?an.buildFromArray(t):typeof t=="object"?an.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((l,s)=>{const i=t[l];i instanceof Ur||i instanceof Ir||i instanceof Tu?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 Ur||l instanceof Ir||l instanceof Tu){let s=l.build.bind(l)();a[s.key]=s}else a[l.key]=l}),a}}class MC extends nl{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=an.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 TC(l,this.values).evaluate(rt.get(a,"conditions"),rt.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){rt.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 pd(){return MC.init()}const LC=["innerHTML"],Qr={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,LC))}},RC=Object.freeze(Object.defineProperty({__proto__:null,default:Qr},Symbol.toStringTag,{value:"Module"})),Mu=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:re(`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,"")},f(l),1))),128))],2)):B("",!0)}}),tp={__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=Sl(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>zt(()=>import("./chunks/Test.js?ver=1.6.0"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>zt(()=>Promise.resolve().then(()=>JC),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>zt(()=>Promise.resolve().then(()=>A2),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>zt(()=>Promise.resolve().then(()=>p2),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>zt(()=>Promise.resolve().then(()=>RC),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>zt(()=>Promise.resolve().then(()=>a2),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>zt(()=>Promise.resolve().then(()=>L2),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>zt(()=>Promise.resolve().then(()=>e2),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>zt(()=>Promise.resolve().then(()=>_2),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>zt(()=>Promise.resolve().then(()=>h2),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>zt(()=>Promise.resolve().then(()=>XC),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>zt(()=>Promise.resolve().then(()=>f2),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>zt(()=>Promise.resolve().then(()=>HC),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>zt(()=>Promise.resolve().then(()=>zC),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>zt(()=>Promise.resolve().then(()=>qC),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>zt(()=>Promise.resolve().then(()=>YC),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>zt(()=>import("./chunks/BuyProducts.js?ver=1.6.0"),[],import.meta.url),"./Coupon/Categories.vue":()=>zt(()=>import("./chunks/Categories.js?ver=1.6.0"),[],import.meta.url),"./Coupon/Code.vue":()=>zt(()=>import("./chunks/Code.js?ver=1.6.0"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>zt(()=>import("./chunks/GetProducts.js?ver=1.6.0"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>zt(()=>import("./chunks/Categories2.js?ver=1.6.0"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>zt(()=>import("./chunks/Product.js?ver=1.6.0"),[],import.meta.url),"./Coupon/Products.vue":()=>zt(()=>import("./chunks/Products.js?ver=1.6.0"),[],import.meta.url),"./McpSettings.vue":()=>zt(()=>import("./chunks/McpSettings.js?ver=1.6.0"),[],import.meta.url),"./ModuleSettings.vue":()=>zt(()=>import("./chunks/ModuleSettings.js?ver=1.6.0"),[],import.meta.url),"./PaymentView.vue":()=>zt(()=>import("./chunks/PaymentView.js?ver=1.6.0"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>zt(()=>import("./chunks/AddressComponent.js?ver=1.6.0"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>zt(()=>import("./chunks/CreatePageButton.js?ver=1.6.0"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>zt(()=>import("./chunks/PageSelector.js?ver=1.6.0"),[],import.meta.url),"./StoreSettings/SubscriptionModeManager.vue":()=>zt(()=>import("./chunks/SubscriptionModeManager.js?ver=1.6.0"),[],import.meta.url),"./TurnstileSettings.vue":()=>zt(()=>import("./chunks/TurnstileSettings.js?ver=1.6.0"),[],import.meta.url)}),l=ff(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(Cl(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]=m=>t.value=m)}),null,16,["modelValue"])),Ba(c.$slots,"fieldNote"),Ba(c.$slots,"validationError")],64))}},OC=["id"],fd={__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,m,_,g,y,v;return r(),h("div",{class:"gap-2 grid grid-cols-dynamic sm:grid-cols-sm-dynamic md:grid-cols-md-dynamic lg:grid-cols-lg--dynamic",id:e.field.id||"",style:ra({"--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)??((m=e.field.columns)==null?void 0:m.default)??2,"--lg-grid-columns":((_=e.field.columns)==null?void 0:_.lg)??((g=e.field.columns)==null?void 0:g.md)??((y=e.field.columns)==null?void 0:y.sm)??((v=e.field.columns)==null?void 0:v.default)??2})},[n(_i,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],12,OC)}}},HC=Object.freeze(Object.defineProperty({__proto__:null,default:fd},Symbol.toStringTag,{value:"Module"})),PC={key:0,class:"fct-content-card-header"},NC={key:0,class:"title"},KC={key:1,class:"fct-content-card-action"},GC={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:re({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",PC,[e.title||t.$slots.title?(r(),h("div",NC,[Ba(t.$slots,"title",{},()=>[L(f(e.title),1)])])):B("",!0),t.$slots.action?(r(),h("div",KC,[Ba(t.$slots,"action")])):B("",!0)])):B("",!0),o("div",{class:re({"fct-content-card-body":e.show_heading!==!1})},[Ba(t.$slots,"default")],2)],2))}},jC=["id"],ap={__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(xe,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(fd,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,jC))}},zC=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"})),lp={__name:"FormTab",props:{field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){const t=e,a=T(""),l=T([]),s=al(),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 m;return Ie(()=>{m=s.beforeEach((_,g,y)=>{y(),setTimeout(()=>{p()},200)}),p()}),Bt(()=>{m&&m()}),(_,g)=>{const y=C("el-tabs");return r(),E(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:re(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:i,type:"card"},{default:d(()=>[n(_i,{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"])}}},qC=Object.freeze(Object.defineProperty({__proto__:null,default:lp},Symbol.toStringTag,{value:"Module"})),sp={__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(_i,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},YC=Object.freeze(Object.defineProperty({__proto__:null,default:sp},Symbol.toStringTag,{value:"Module"}));class md{}Re(md,"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 WC={__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;qt().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=T(!1),s=T({});return Ie(async()=>{s.value=await md.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(fd,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(lp,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(sp,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(ap,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))}},np={__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=Sl(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"])}}},XC=Object.freeze(Object.defineProperty({__proto__:null,default:np},Symbol.toStringTag,{value:"Module"})),op={__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=Sl(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(()=>[L(f(e.label),1)]),_:1},16,["modelValue","disabled"])}}},JC=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"})),ZC=["innerHTML"],ip={__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=Sl(e,"modelValue"),a=e,l=T([]),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"),m=C("el-radio-group");return r(),E(m,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:re(_.option_class)},[n(p,{value:_.value},{default:d(()=>[L(f(_.label),1)]),_:2},1032,["value"]),_.note?(r(),h("div",{key:0,innerHTML:_.note,class:"radio-option-note"},null,8,ZC)):B("",!0)],2))),128))]),_:1},16,["modelValue"])}}},e2=Object.freeze(Object.defineProperty({__proto__:null,default:ip},Symbol.toStringTag,{value:"Module"})),t2=["innerHTML"],Ns={__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=qt().ctx,a=Sl(e,"modelValue"),l=e,s=T(),i=async()=>{typeof l.field.prefix=="function"?s.value=await l.callback(l.field.prefix):s.value=l.field.prefix};return Ie(()=>{i()}),mf(()=>{i()}),K(()=>l.fieldKey==="amount"?l.form.data.values.type==="fixed"?je.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(c,p)=>{var _;const m=C("el-input");return r(),E(m,ya({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),la({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:d(()=>[n(tp,{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,t2)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},a2=Object.freeze(Object.defineProperty({__proto__:null,default:Ns},Symbol.toStringTag,{value:"Module"})),l2={key:0,class:"fct-color-presets-section"},s2=["aria-label"],n2=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],o2={class:"fct-color-custom-row"},i2={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},r2={key:1,class:"fct-color-picker-box"},d2={class:"fct-color-picker-trigger-wrap"},u2={key:0,class:"text-xs text-system-light"},c2={key:1,class:"fct-color-picker-action-wrap"},hd={__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=Sl(e,"modelValue"),a=()=>{t.value=""},l=m=>m?hs.findIndex(_=>_.toLowerCase()===m.toLowerCase()):-1,s=T(Math.max(0,l(t.value)));be(t,m=>{const _=l(m);_>=0&&(s.value=_)});const i=T([]),c=(m,_)=>{t.value=m,s.value=_},p=(m,_)=>{let g=_;if(m.key==="ArrowRight"||m.key==="ArrowDown")g=(_+1)%hs.length;else if(m.key==="ArrowLeft"||m.key==="ArrowUp")g=(_-1+hs.length)%hs.length;else if(m.key==="Home")g=0;else if(m.key==="End")g=hs.length-1;else return;m.preventDefault(),c(hs[g],g),Be(()=>{i.value[g]&&i.value[g].focus()})};return(m,_)=>{const g=C("el-color-picker"),y=C("el-input");return e.withPresets?(r(),h("div",l2,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":A(u)("Color presets")},[(r(!0),h(H,null,ae(A(hs),(v,w)=>(r(),h("button",{key:v,ref_for:!0,ref:k=>i.value[w]=k,type:"button",class:re(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===v.toLowerCase()}]),style:ra({background:v,"--swatch-color":v}),"aria-label":A(u)("Select color %1$s",v),"aria-pressed":!!(t.value&&t.value.toLowerCase()===v.toLowerCase()),tabindex:w===s.value?0:-1,onClick:k=>c(v,w),onKeydown:k=>p(k,w)},null,46,n2))),128))],8,s2),o("div",o2,[o("div",i2,[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",r2,[o("div",d2,[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",u2,f(A(u)("Add...")),1)),t.value?(r(),h("div",c2,[o("span",null,f(t.value),1),n(J,{name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})])):B("",!0)]))}}},A2=Object.freeze(Object.defineProperty({__proto__:null,default:hd},Symbol.toStringTag,{value:"Module"})),rp={__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=Sl(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"])}}},p2=Object.freeze(Object.defineProperty({__proto__:null,default:rp},Symbol.toStringTag,{value:"Module"})),dp={__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=Sl(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:dp},Symbol.toStringTag,{value:"Module"})),m2={key:0},up={__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=Sl(e,"modelValue"),a=e,l=T([]),s=T(!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,m)=>{const _=C("el-option"),g=C("el-select");return r(),E(g,ya({modelValue:t.value,"onUpdate:modelValue":m[0]||(m[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",m2,f(y.slot),1)):B("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},h2=Object.freeze(Object.defineProperty({__proto__:null,default:up},Symbol.toStringTag,{value:"Module"})),cp={__name:"RemoteSearchableSelect",props:_l({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue"),a=e,l=T(!1),s=T(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 m=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=g=>t.value=g),filterable:"",remote:"",placeholder:e.field.placeholder??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(m,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},_2=Object.freeze(Object.defineProperty({__proto__:null,default:cp},Symbol.toStringTag,{value:"Module"}));function on(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))}}on(".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}");on('.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)}}');on(".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}");on(".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}");on(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");on(".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 bl="vel",El=jl({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>n("svg",{class:`${bl}-icon icon`,"aria-hidden":"true"},[n("use",{"xlink:href":`#icon-${e.type}`},null)])}),mi=typeof window<"u",Ks=()=>{};let Ap=!1;if(mi)try{const e={};Object.defineProperty(e,"passive",{get(){Ap=!0}}),window.addEventListener("test-passive",Ks,e)}catch{}const Lu=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];mi&&e.addEventListener(t,a,!!Ap&&{capture:!1,passive:l})},Ru=(e,t,a)=>{mi&&e.removeEventListener(t,a)},v2=e=>{e.preventDefault()},g2=Object.prototype.toString,_d=e=>t=>g2.call(t).slice(8,-1)===e,y2=e=>!!e&&_d("Object")(e),Ou=e=>!!e&&_d("String")(e);function b2(e){return e!=null}const w2=jl({name:"Toolbar",props:{zoomIn:{type:Function,default:Ks},zoomOut:{type:Function,default:Ks},rotateLeft:{type:Function,default:Ks},rotateRight:{type:Function,default:Ks},resize:{type:Function,default:Ks},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>n("div",{class:`${bl}-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(El,{type:"zoomin"},null)]),n("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[n(El,{type:"zoomout"},null)])]),n("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[n(El,{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(El,{type:"rotate-left"},null)]),n("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[n(El,{type:"rotate-right"},null)])])])}),C2=()=>n("div",{class:`${bl}-loading`},[n("div",{class:"ring"},null)]),k2=()=>n("div",{class:`${bl}-on-error`},[n("div",{class:"ring"},null),n(El,{type:"img-broken"},null)]),B2=(e,t)=>{let{slots:a}=t;return n("div",{class:`${bl}-img-title`},[a.default?a.default():""])},x2=jl({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)])])}),Sn=mi?window:global;let Hu=Date.now();function S2(e){const t=Date.now(),a=Math.max(0,16-(t-Hu)),l=setTimeout(e,a);return Hu=t+a,l}function Gi(e){return(Sn.requestAnimationFrame||S2).call(Sn,e)}function Pu(e){(Sn.cancelAnimationFrame||Sn.clearTimeout).call(Sn,e)}function Nu(e,t){const a=e.clientX-t.clientX,l=e.clientY-t.clientY;return Math.sqrt(a*a+l*l)}function ji(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!hf(e)}var zi=jl({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 Se=T(),Ee=bn({width:0,height:0,maxScale:1});return{imgRef:Se,imgState:Ee,setImgSize:()=>{if(Se.value){const{width:Oe,height:Me,naturalWidth:_t}=Se.value;Ee.maxScale=_t/Oe,Ee.width=Oe,Ee.height=Me}}}})(),p=T(e.index),m=T(""),_=bn({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=bn({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=K(()=>{return Se=e.imgs,_d("Array")(Se)?e.imgs.map(Ee=>typeof Ee=="string"?{src:Ee}:function(Oe){return y2(Oe)&&Ou(Oe.src)}(Ee)?Ee:void 0).filter(b2):Ou(e.imgs)?[{src:e.imgs}]:[];var Se}),v=K(()=>y.value[p.value]),w=K(()=>{var Se;return(Se=y.value[p.value])==null?void 0:Se.src}),k=K(()=>{var Se;return(Se=y.value[p.value])==null?void 0:Se.title}),b=K(()=>{var Se;return(Se=y.value[p.value])==null?void 0:Se.alt}),x=K(()=>({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)`})),F=()=>{a("hide")},M=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},$=(Se,Ee)=>{const Oe=p.value;M(),p.value=Se,y.value[p.value]===y.value[Se]&&Be(()=>{g.loading=!1}),e.visible&&Oe!==Se&&(Ee&&Ee(Oe,Se),a("on-index-change",Oe,Se))},S=()=>{const Se=p.value,Ee=e.loop?(Se+1)%y.value.length:Se+1;!e.loop&&Ee>y.value.length-1||$(Ee,(Oe,Me)=>{a("on-next",Oe,Me),a("on-next-click",Oe,Me)})},I=()=>{const Se=p.value;let Ee=Se-1;if(Se===0){if(!e.loop)return;Ee=y.value.length-1}$(Ee,(Oe,Me)=>{a("on-prev",Oe,Me),a("on-prev-click",Oe,Me)})},Q=Se=>{Math.abs(1-Se)<.05?Se=1:Math.abs(i.maxScale-Se)<.05&&(Se=i.maxScale),_.lastScale=_.scale,_.scale=Se},D=()=>{const Se=_.scale+e.zoomScale;Se<i.maxScale*e.maxZoom&&Q(Se)},V=()=>{const Se=_.scale-e.zoomScale;Se>e.minZoom&&Q(Se)},U=()=>{const Se=_.rotateDeg%360;a("on-rotate",Math.abs(Se<0?Se+360:Se))},O=()=>{_.rotateDeg-=90,U()},R=()=>{_.rotateDeg+=90,U()},P=()=>{_.scale=1,_.top=0,_.left=0},j=function(){let Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&Se===0},{onMouseDown:q,onMouseMove:z,onMouseUp:X}=((Se,Ee,Oe)=>{let Me,_t=!1;return{onMouseDown:vt=>{Se.initX=Se.lastX=vt.clientX,Se.initY=Se.lastY=vt.clientY,Ee.dragging=!0,_t=!1,vt.stopPropagation()},onMouseUp:vt=>{Oe(vt.button)&&Pu(Me),Ee.dragging=!1,_t=!1},onMouseMove:vt=>{if(Ee.dragging)if(Oe(vt.button)){if(_t)return;_t=!0,Me=Gi(()=>{const{top:Lt,left:Et,lastY:Dt,lastX:dt}=Se;Se.top=Lt-Dt+vt.clientY,Se.left=Et-dt+vt.clientX,Se.lastX=vt.clientX,Se.lastY=vt.clientY,_t=!1})}else Se.lastX=vt.clientX,Se.lastY=vt.clientY;vt.stopPropagation()}}})(_,g,j),{onTouchStart:ne,onTouchMove:he,onTouchEnd:N}=((Se,Ee,Oe,Me,_t)=>{let vt,Lt=!1;return{onTouchStart:Et=>{const{touches:Dt}=Et;Dt.length>1&&_t()?(Oe.gesturing=!0,Ee.touches=Dt):(Ee.initX=Ee.lastX=Dt[0].clientX,Ee.initY=Ee.lastY=Dt[0].clientY,Oe.dragging=!0),Et.stopPropagation()},onTouchMove:Et=>{if(Lt)return;const{touches:Dt}=Et,{lastX:dt,lastY:Ut,left:Ft,top:It,scale:Qt}=Ee;if(!Oe.gesturing&&Oe.dragging){if(!Dt[0])return;const{clientX:Tt,clientY:Wt}=Dt[0];Me()?vt=Gi(()=>{Ee.lastX=Tt,Ee.lastY=Wt,Ee.top=It-Ut+Wt,Ee.left=Ft-dt+Tt,Lt=!1}):(Ee.lastX=Tt,Ee.lastY=Wt)}else Oe.gesturing&&Ee.touches.length>1&&Dt.length>1&&_t()&&(vt=Gi(()=>{const Tt=(Nu(Ee.touches[0],Ee.touches[1])-Nu(Dt[0],Dt[1]))/Se.width;Ee.touches=Dt;const Wt=Qt-1.3*Tt;Wt>.5&&Wt<1.5*Se.maxScale&&(Ee.scale=Wt),Lt=!1}))},onTouchEnd:()=>{Pu(vt),Oe.dragging=!1,Oe.gesturing=!1,Lt=!1}}})(i,_,g,j,()=>!e.pinchDisabled),G=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},Z=Se=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),Se.deltaY<0?D():V())},W=Se=>{const Ee=Se;e.visible&&(!e.escDisabled&&Ee.key==="Escape"&&e.visible&&F(),Ee.key==="ArrowLeft"&&(e.rtl?S():I()),Ee.key==="ArrowRight"&&(e.rtl?I():S()))},ie=()=>{e.maskClosable&&F()},ye=()=>{c()},fe=()=>{g.loading=!1},ge=Se=>{g.loading=!1,g.loadError=!0,a("on-error",Se)},se=()=>{e.visible&&c()};be(()=>e.index,Se=>{Se<0||Se>=y.value.length||$(Se)}),be(()=>g.dragging,(Se,Ee)=>{const Oe=!Se&&Ee;if(!j()&&Oe){const Me=_.lastX-_.initX,_t=_.lastY-_.initY,vt=e.swipeTolerance;Math.abs(Me)>Math.abs(_t)&&(Me<-1*vt?S():Me>vt&&I())}}),be(()=>e.visible,Se=>{if(Se){M();const Ee=y.value.length;if(Ee===0)return p.value=0,g.loading=!1,void Be(()=>g.loadError=!0);p.value=e.index>=Ee?Ee-1:e.index<0?0:e.index,e.scrollDisabled&&pe()}else e.scrollDisabled&&$e()});const pe=()=>{document&&(m.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},$e=()=>{document&&(document.body.style.overflowY=m.value)};Ie(()=>{Lu(document,"keydown",W),Lu(window,"resize",se)}),vl(()=>{Ru(document,"keydown",W),Ru(window,"resize",se),e.scrollDisabled&&$e()});const tt=()=>g.loading?l.loading?l.loading({key:"loading"}):n(C2,{key:"img-loading"},null):g.loadError?l.onerror?l.onerror({key:"onerror"}):n(k2,{key:"img-on-error"},null):n("div",{class:`${bl}-img-wrapper`,style:x.value,key:"img-wrapper"},[n("img",{alt:b.value,ref:s,draggable:"false",class:`${bl}-img`,src:w.value,onMousedown:q,onMouseup:X,onMousemove:z,onTouchstart:ne,onTouchmove:he,onTouchend:N,onLoad:ye,onDblclick:G,onDragstart:Se=>{Se.preventDefault()}},null)]),_e=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:I});if(y.value.length<=1)return;const Se=!e.loop&&p.value<=0;return n("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(Se?"disable":""),onClick:I},[e.rtl?n(El,{type:"next"},null):n(El,{type:"prev"},null)])},Xe=()=>{if(l["next-btn"])return l["next-btn"]({next:S});if(y.value.length<=1)return;const Se=!e.loop&&p.value>=y.value.length-1;return n("div",{role:"button","aria-label":"next image button",class:"btn__next "+(Se?"disable":""),onClick:S},[e.rtl?n(El,{type:"prev"},null):n(El,{type:"next"},null)])},ht=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return l.title?l.title({currentImg:v.value}):k.value?n(B2,null,{default:()=>[k.value]}):void 0},Ye=()=>{let Se;if(e.visible)return n("div",{onTouchmove:v2,class:[`${bl}-modal`,e.rtl?"is-rtl":""],onClick:Ne(ie,["self"]),onWheel:Z},[n(x2,null,null),n(Gl,{name:`${bl}-fade`,mode:"out-in"},ji(Se=tt())?Se:{default:()=>[Se]}),n("img",{style:"display:none;",src:w.value,onError:ge,onLoad:fe},null),n("div",{class:`${bl}-btns-wrapper`},[_e(),Xe(),ht(),l["close-btn"]?l["close-btn"]({close:F}):n("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:F},[n(El,{type:"close"},null)]),l.toolbar?l.toolbar({toolbarMethods:{zoomIn:D,zoomOut:V,rotate:O,rotateLeft:O,rotateRight:R,resize:P},zoomIn:D,zoomOut:V,rotate:O,rotateLeft:O,rotateRight:R,resize:P}):n(w2,{zoomIn:D,zoomOut:V,resize:P,rotateLeft:O,rotateRight:R,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let Se;if(e.teleport){let Ee;return n(Xo,{to:e.teleport},{default:()=>[n(Gl,{name:`${bl}-fade`},ji(Ee=Ye())?Ee:{default:()=>[Ee]})]})}return n(Gl,{name:`${bl}-fade`},ji(Se=Ye())?Se:{default:()=>[Se]})}}});const F2=Object.assign(zi,{install:e=>{e.component(zi.name,zi)}}),$2={name:"Attachments",components:{MediaButton:Oc,VueEasyLightbox:F2,IconButton:Ze,Delete:gs},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:T([])}},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)}}},E2={class:"fct-attachments-wrap",style:{position:"relative"}},U2={class:"fct-attachment-img-wrap"},I2=["src","alt","onClick"],Q2={class:"fct-attachments-button"};function D2(e,t,a,l,s,i){const c=C("VueEasyLightbox"),p=C("MediaButton"),m=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",E2,[a.attachments?(r(),h("ul",{key:0,class:re(`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:re([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",U2,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{s.imageIndex=y,s.visible=!0}},null,8,I2)):B("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),E(m,{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",Q2,[a.showDeleteButton?(r(),E(m,{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},[L(f(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):B("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),E(m,{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:re([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 pp=st($2,[["render",D2]]),V2={key:0},T2={key:0,class:"setting-label"},hi={__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=T();let i=T([]);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=[],m()});const m=()=>{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=[],m()}),(_,g)=>(r(),h(H,null,[n(pp,{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",V2,[e.field&&e.field.label?(r(),h("label",T2,f(e.field.label),1)):B("",!0),o("span",null,f(A(u)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):B("",!0)],64))}},M2={class:"setting-media-wrap"},fp={__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=Sl(e,"modelValue");return(a,l)=>(r(),h("div",M2,[n(hi,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"])]))}},L2=Object.freeze(Object.defineProperty({__proto__:null,default:fp},Symbol.toStringTag,{value:"Module"})),R2={__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;T(!1),qt().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=T(!1);let i={};Ie(async()=>{i=await md.attributesBuilders(t.field,l,t.form),s.value=!0});const c={switch:np,checkbox:op,radio:ip,input:Ns,text:Ns,email:Ns,number:Ns,textarea:Ns,color:hd,date:rp,time:dp,select:up,media:fp,remote_select:cp},p=K(()=>c[t.field.type]||null),m=K(()=>({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(Wl,{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(Cl(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)},m.value),null,16,["modelValue"])):B("",!0)}},O2=["innerHTML"],H2={key:0},P2={key:0},_i={__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"];T(!1),qt().ctx;const s=(c,p)=>{if(typeof c.label=="function"){let m=i(c)?a:p+".",_=i(c)?t.value:t.value[p];return c.label(_,m,t.form)}return c.label},i=c=>c.disable_nesting!==!1;return(c,p)=>(r(!0),h(H,null,ae(e.schema,(m,_)=>(r(),h(H,{key:_},[e.form.isVisible(m,e.statePath+_)?(r(),h(H,{key:0},[m.type==="html"?(r(),h("div",{key:0,class:re(`setting-html-wrapper ${m.wrapperClass??""}`),innerHTML:m.value},null,10,O2)):(r(),h(H,{key:1},[m.component?(r(),h("div",{key:0,class:re(m.wrapperClass??"")},[m.component&&m.label?(r(),E(pa,{key:0,title:s(m,_),content:m.tooltip,class:"setting-label",placement:m.tooltip_placement},{default:d(()=>[m.labelOptional?(r(),h("span",H2,"("+f(m.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(tp,{modelValue:e.value[_],"onUpdate:modelValue":g=>e.value[_]=g,name:m.component,form:e.form,statePath:i(m)?A(a):_+".",field:m,"field-key":_,value:i(m)?e.value:e.value[_],nesting:i(m)},{fieldNote:d(()=>[m.note&&m.hide_note!==!0?(r(),E(Qr,{key:0,note:m.note},null,8,["note"])):B("",!0)]),validationError:d(()=>[n(Mu,{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(m.type)?(r(),E(WC,{key:1,form:e.form,field:m,value:e.value,"full-state-path":A(a),statePath:i(m)?A(a):_+".","field-key":_},null,8,["form","field","value","full-state-path","statePath","field-key"])):B("",!0),typeof m.type<"u"&&!l.includes(m.type)&&!["custom","component","html","hidden"].includes(m.type)?(r(),h("div",{key:2,class:re(`setting-fields-inner ${m.wrapperClass??""}`)},[m.type!=="checkbox"&&!m.component&&m.label!==!1?(r(),E(pa,{key:0,class:"setting-label",title:s(m,_),content:m.tooltip,placement:m.tooltip_placement},{default:d(()=>[m.labelOptional?(r(),h("span",P2,"("+f(m.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(R2,{form:e.form,field:m,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"]),m.note&&!m.component?(r(),E(Qr,{key:1,note:m.note},null,8,["note"])):B("",!0),m.component?B("",!0):(r(),E(Mu,{key:2,form:e.form,"error-key":A(a)+_},null,8,["form","error-key"]))],2)):B("",!0)],64))],64)):B("",!0)],64))),128))}},N2={key:0,class:"vue-form-wrap"},K2={key:0,class:"form-section-save-action"},G2={key:0,class:"cmd block leading-none"},vi={__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=ll(),s=e,i=a;be(()=>s.form.isReady,()=>{Be(()=>en.scrollToHashSection(l.hash))},{once:!0}),Ie(()=>{Be(()=>{c.registerCopyAction(),s.form.isReady&&en.scrollToHashSection(l.hash)})}),T({});const c=qt().ctx,p=()=>{i("onSubmitButtonClick")};return t({getState:()=>s.form.values}),(_,g)=>{const y=C("el-button");return e.form.isReady?(r(),h("div",N2,[n(_i,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),h("div",K2,[n(y,{onClick:p,type:"primary",loading:e.loading},{default:d(()=>[e.loading?B("",!0):(r(),h("span",G2,"⌘s")),L(" "+f(e.submitButtonText),1)]),_:1},8,["loading"])])):B("",!0)])):B("",!0)}}},j2={key:0},mp={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=pd();const s=a,i=e,c=()=>{const g=i.form_name,y={};return y[g]={...l.values},y},p=()=>{l.reset()},m=()=>{var g;return((g=i.widget)==null?void 0:g.reset_on_save)==!0},_=Gr("triggerChange");return Ie(()=>{l.setSchema(i.schema).setDefaults(i.values).initForm(),l.onDataChanged(g=>{_==null||_(),s("change")})}),t({getState:c,resetForm:p,resetOnSave:m}),(g,y)=>A(l).isReady?(r(),h("div",j2,[n(vi,{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)}},z2={__name:"EChart",props:{option:{type:Object,required:!0},height:{type:String,default:"400px"},width:{type:String,default:"100%"}},setup(e){const t=e,a=T(null);let l=null;const s=()=>{a.value&&(l=ea(a.value),l.setOption(t.option))};be(()=>t.option,m=>{l&&m&&l.setOption(m,!0)},{deep:!0});const i=(m,_)=>{if(m==null||m==="")return _;const g=Number(m);return isNaN(g)?m:`${g}px`},c=K(()=>i(t.height,"400px")),p=K(()=>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()}),(m,_)=>(r(),h("div",{ref_key:"chartRef",ref:a,style:ra({width:p.value,height:c.value})},null,4))}},q2={class:"fct-step-indicator"},Y2={class:"indicator-title"},W2={class:"indicator-steps"},X2={class:"indicator-progress"},J2={class:"indicator-steps-bar"},Z2=["onClick"],ek={__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",q2,[o("div",Y2,f(e.steps[e.currentStep-1].label),1),o("div",W2,[o("div",X2,f(e.currentStep)+"/"+f(e.steps.length)+" "+f(l.$t("Completed")),1),o("div",J2,[(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:re(["indicator-step-bar",c<e.currentStep?"is-completed":""])},null,2)],8,Z2))),128))])])]))}},tk=["type","disabled","aria-disabled"],ak={key:0,class:"fct-btn-spinner"},lk="6px",sk={__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=K(()=>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 w=y.scrollWidth+"px";y.style.transition=i(),requestAnimationFrame(()=>{y.style.width=w,y.style.opacity="1",y.style.marginRight=""}),setTimeout(()=>v(),a.duration)},m=y=>{y.style.width="auto",y.style.overflow="",y.style.marginRight=""},_=y=>{y.style.width=y.scrollWidth+"px",y.style.opacity="1",y.style.overflow="hidden",y.style.marginRight=lk},g=(y,v)=>{y.offsetHeight,y.style.transition=i(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const w=k=>{k.propertyName==="width"&&(y.removeEventListener("transitionend",w),v())};y.addEventListener("transitionend",w)};return(y,v)=>(r(),h("button",{type:e.nativeType,class:re(["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]=w=>l("click",w))},[n(Gl,{onBeforeEnter:c,onEnter:p,onAfterEnter:m,onBeforeLeave:_,onLeave:g},{default:d(()=>[e.loading?(r(),h("span",ak,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,tk))}},nk=st(sk,[["__scopeId","data-v-fa8794a2"]]),hp={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var _,g,y,v,w,k;const t=xc(Sc),a=Object.freeze({get:(...b)=>ue.get(...b),post:(...b)=>ue.post(...b),put:(...b)=>ue.put(...b),delete:(...b)=>ue.delete(...b),patch:(...b)=>ue.patch(...b),upload:(...b)=>ue.upload(...b),getNonce:()=>ue.getNonce()}),l=Object.freeze({success:(...b)=>Y.success(...b),error:(...b)=>Y.error(...b),info:(...b)=>Y.info(...b),validationErrors:(...b)=>Y.validationErrors(...b)}),s=Object.freeze({clipboard:(_=window==null?void 0:window.navigator)==null?void 0:_.clipboard,userAgent:(g=window==null?void 0:window.navigator)==null?void 0:g.userAgent,language:(y=window==null?void 0:window.navigator)==null?void 0:y.language,languages:(v=window==null?void 0:window.navigator)==null?void 0:v.languages,onLine:(w=window==null?void 0:window.navigator)==null?void 0:w.onLine,platform:(k=window==null?void 0:window.navigator)==null?void 0:k.platform}),i=[{pattern:/\balert\s*\(/,label:"alert()"},{pattern:/\bconfirm\s*\(/,label:"confirm()"},{pattern:/\bprompt\s*\(/,label:"prompt()"},{pattern:/\bsetTimeout\s*\(/,label:"setTimeout()"},{pattern:/\bsetInterval\s*\(/,label:"setInterval()"},{pattern:/\brequestAnimationFrame\s*\(/,label:"requestAnimationFrame()"},{pattern:/\bcancelAnimationFrame\s*\(/,label:"cancelAnimationFrame()"},{pattern:/\bqueueMicrotask\s*\(/,label:"queueMicrotask()"},{pattern:/\bfetch\s*\(/,label:"fetch()"},{pattern:/\bXMLHttpRequest\b/,label:"XMLHttpRequest"},{pattern:/\bWebSocket\b/,label:"WebSocket"},{pattern:/\bWorker\b/,label:"Worker"},{pattern:/\bSharedWorker\b/,label:"SharedWorker"},{pattern:/\bEventSource\b/,label:"EventSource"},{pattern:/\bMessageChannel\b/,label:"MessageChannel"},{pattern:/\bBroadcastChannel\b/,label:"BroadcastChannel"},{pattern:/\bwindow\b/,label:"window"},{pattern:/\bdocument\b/,label:"document"},{pattern:/\bnavigator\.(?:serviceWorker|sendBeacon|geolocation|mediaDevices|bluetooth|usb|serial|hid|credentials|locks|wakeLock)\b/,label:"navigator privileged API"},{pattern:/\bglobalThis\b/,label:"globalThis"},{pattern:/\bself\b/,label:"self"},{pattern:/\bparent\b/,label:"parent"},{pattern:/\btop\b/,label:"top"},{pattern:/\bframes\b/,label:"frames"},{pattern:/\blocalStorage\b/,label:"localStorage"},{pattern:/\bsessionStorage\b/,label:"sessionStorage"},{pattern:/\bindexedDB\b/,label:"indexedDB"},{pattern:/\bpostMessage\s*\(/,label:"postMessage()"},{pattern:/\bopen\s*\(/,label:"open()"},{pattern:/\bFileReader\b/,label:"FileReader"},{pattern:/\bBlob\b/,label:"Blob"},{pattern:/\bURL\.createObjectURL\b/,label:"URL.createObjectURL"},{pattern:/\bMutationObserver\b/,label:"MutationObserver"},{pattern:/\bResizeObserver\b/,label:"ResizeObserver"},{pattern:/\bIntersectionObserver\b/,label:"IntersectionObserver"},{pattern:/\bhistory\.(?:pushState|replaceState|go|back|forward)\s*\(/,label:"history navigation"},{pattern:/\blocation\.(?:assign|replace|reload)\s*\(/,label:"location navigation"},{pattern:/\blocation\.href\s*=/,label:"location.href assignment"},{pattern:/\bFunction\b/,label:"Function"},{pattern:/\beval\s*\(/,label:"eval()"},{pattern:/\bnew\s+Function\b/,label:"new Function"},{pattern:/\brequire\s*\(/,label:"require()"},{pattern:/\bimport\s*\(/,label:"import()"},{pattern:/\bReflect\b/,label:"Reflect"},{pattern:/\bProxy\b/,label:"Proxy"},{pattern:/\bprocess\b/,label:"process"},{pattern:/\bmodule\b/,label:"module"},{pattern:/\bexports\b/,label:"exports"},{pattern:/\b__proto__\b/,label:"__proto__"},{pattern:/\b__defineGetter__\b/,label:"__defineGetter__"},{pattern:/\b__defineSetter__\b/,label:"__defineSetter__"}],c=b=>{for(const x of i)if(x.pattern.test(b))return!1;return!0},p=b=>{var x,F;try{if(typeof b!="string")return null;const M=b.match(/<template(?:\s[^>]*)?>|<template>/i);if(!M)return null;const $=M.index+M[0].length;let S=1,I=$,Q=-1;for(;I<b.length&&S>0;){const O=b.indexOf("<template",I),R=b.indexOf("</template>",I);if(R===-1)return null;O!==-1&&O<R?(S++,I=O+9):(S--,S===0&&(Q=R),I=R+11)}if(Q===-1)return null;const D=b.substring($,Q).trim(),V=b.match(/<script>([\s\S]*?)<\/script>/i);let U={};if(V){const O=V[1].trim();if(!/export\s+default/.test(O)||!c(O))return null;const R=O.replace(/export\s+default/,"return");U=new Function("Vue","Rest","Notify","translate","Animation","StepIndicator","LoadingButton","ElMessage","ElMessageBox","alert","confirm","prompt","setTimeout","setInterval","requestAnimationFrame","cancelAnimationFrame","queueMicrotask","fetch","XMLHttpRequest","WebSocket","Worker","SharedWorker","EventSource","MessageChannel","BroadcastChannel","window","document","navigator","globalThis","self","parent","top","frames","localStorage","sessionStorage","indexedDB","postMessage","open","FileReader","Blob","URL","MutationObserver","ResizeObserver","IntersectionObserver","history","location","Function","Reflect","Proxy","process","module","exports","require",`"use strict";
107 ${R}`)(t,a,l,u,va,ek,nk,(x=window==null?void 0:window.ELEMENT)==null?void 0:x.ElMessage,(F=window==null?void 0:window.ELEMENT)==null?void 0:F.ElMessageBox,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,s,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)||{}}return jl({...U,template:D})}catch{return null}},m=b=>{if(typeof b=="string"){const x=p(b);return x?jl(x):null}return jl(b)};return(b,x)=>(r(),E(Cl(m(e.widget.component)),ya({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},ok=["innerHTML"],rn={__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}){qt().ctx;const l=a,s=e,i=T([]),c=xc(Sc),p={},m=M=>{window.fluent_cart_admin.app={vue:c,components:M,xhr:ue,notify:Y},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],c,M).forEach(({name:S,component:I})=>{p[S]=jl(I)})};Ss(()=>{let $=qt().appContext.components;m($);let S=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],c,$);Array.isArray(S)&&(i.value=i.value.concat(S));const I={filter:s.filter,data:s.widgetsQuery};ue.get("widgets",I).then(Q=>{Array.isArray(Q.widgets)&&(i.value=i.value.concat(Q.widgets))}),s.widgetsQuery});const _=M=>jl(M),g=M=>p[M]||null,y=T([]),v=async(M,$)=>{const S=y.value.map(I=>typeof I[M]=="function"?I[M]($):Promise.resolve());return await Promise.all(S),!0};t({beforeUpdatingData:async M=>await v("beforeUpdatingData",M),afterUpdatingData:async M=>await v("afterUpdatingData",M),getFormStates:()=>{let M=[];if(Array.isArray(F.value))for(let $ of F.value)M={...M,...$.getState()};return M},resetForms:()=>{if(Array.isArray(F.value))for(let M of F.value)M.resetOnSave()&&M.resetForm()}});const F=T();return(M,$)=>(r(!0),h(H,null,ae(i.value,S=>(r(),h(H,null,[S.type!=="vue-component"&&S.type!=="vue-template"||S.use_card==!0?(r(),E(xe,{key:0},{default:d(()=>[n(Qe,{title:S.title,subtitle:S.subtitle,border_bottom:""},null,8,["title","subtitle"]),n(Ce,null,{default:d(()=>[S.type==="html"?(r(),h("div",{key:0,innerHTML:S.content},null,8,ok)):S.type==="chart"?(r(),E(z2,{key:1,option:S.data,height:`${S.height||400}`,width:`${S.width||"100%"}`},null,8,["option","height","width"])):S.type==="form"?(r(),E(mp,{key:2,schema:S.schema,values:S.values,submit_button_text:S.submit_button_text,form_name:S.form_name,ref_for:!0,ref_key:"formRefs",ref:F,widget:S,onChange:$[0]||($[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof S.component=="object"?(r(),E(Cl(_(S.component)),ya({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),E(Cl(g(S.component)),ya({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):(r(),h(H,{key:5},[L(f(S.content),1)],64))]),_:2},1024)]),_:2},1024)):S.type==="vue-component"?(r(),h(H,{key:1},[typeof S.component=="object"?(r(),E(Cl(_(S.component)),ya({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),E(Cl(g(S.component)),ya({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):B("",!0)],64)):S.type==="vue-template"?(r(),E(hp,{key:2,widget:S,data:e.data},null,8,["widget","data"])):B("",!0)],64))),256))}},ua=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,ik={class:"fct-dashboard-stat-widgets"},rk={class:"right w-full"},dk=["href"],uk={class:"fct-dashboard-stat-widget__icon"},ck={class:"fct-dashboard-stat-widget__content"},Ak={class:"fct-dashboard-stat-widget__title"},pk={class:"fct-dashboard-stat-widget__value inner-value"},fk=["innerHTML"],mk={key:1,class:"fct-dashboard-stat-widget__inner"},hk={class:"fct-dashboard-stat-widget__content"},_k={class:"fct-dashboard-stat-widget__title"},vk=["href"],gk={key:1},yk={class:"fct-dashboard-stat-widget__value"},bk={__name:"StatsWidget",setup(e){const t=T(!0),a=T([]),l=()=>{t.value=!0,ue.get("dashboard/stats").then(s=>{a.value=s.stats}).catch(s=>{Y.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",ik,[t.value?(r(),h(H,{key:0},ae(4,m=>n(p,{key:m,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:d(()=>[n(c,{variant:"circle",class:"w-10 h-10 flex-none"}),o("div",rk,[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,(m,_)=>(r(),h("div",{key:_,class:"fct-dashboard-stat-widget"},[m.url?(r(),h("a",{key:0,href:m.url,class:"fct-dashboard-stat-widget__inner no-underline"},[o("div",uk,[n(J,{class:"w-5",name:m.icon},null,8,["name"])]),o("div",ck,[o("h3",Ak,[o("span",null,f(m.title),1)]),o("span",pk,[m.has_currency?(r(),h("span",{key:0,innerHTML:A(et).scaled(m.current_count)},null,8,fk)):(r(),h(H,{key:1},[L(f(A(Zt)(A(ua)(m.current_count))||0),1)],64))])])],8,dk)):(r(),h("div",mk,[i[0]||(i[0]=Fn('<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",hk,[o("h3",_k,[m.url?(r(),h("a",{key:0,class:"link",href:m.url},f(m.title),9,vk)):(r(),h("span",gk,f(m.title),1))]),o("span",yk,f(m.current_count),1)])]))]))),128)),n(rn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},Ku=200,wk=800,Ck=.1,kk=.3,Gu=.5,Bk=.5,xk=12,Sk=800,Fk=1600,$k=150,Ek=3500,Uk=["#FFC700","#FF0000","#2E3191","#41BBC7"];var vd={props:{particleCount:{type:Number,default:$k},particleSize:{type:Number,default:xk},duration:{type:Number,default:Ek},colors:{type:Array,default:Uk},force:{type:Number,default:Bk},stageHeight:{type:Number,default:Sk},stageWidth:{type:Number,default:Fk},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=T(!0),a=($,S)=>{M($,{degree:S})},l=K(()=>i(e.particleCount,e.colors));_f(()=>{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=K(()=>F(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=($,S)=>{const I=360/$;return Array.from({length:$},(Q,D)=>({color:S[D%S.length],degree:D*I}))},c=$=>new Promise(S=>setTimeout(S,$));function p($){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round(($+Number.EPSILON)*10**S)/10**S}function m($,S){if($===S)return!0;if($==null||S==null||$.length!==S.length)return!1;for(let I=0;I<$.length;I++)if($[I]!==S[I])return!1;return!0}const _=($,S,I,Q,D)=>($-S)*(D-Q)/(I-S)+Q,g=($,S)=>{const I=$+S;return I>360?I-360:I},y=()=>Math.random()>.5,v=[0,0,1],w=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],k=$=>!m(w[$],v)&&y(),b=$=>typeof $>"u",x=$=>{console.error($)};function F($,S,I,Q,D,V,U){const O=Number.isSafeInteger;return!b($)&&O($)&&$<0?(x("particleCount must be a positive integer"),!1):!b(S)&&O(S)&&S<0?(x("duration must be a positive integer"),!1):!b(I)&&!Array.isArray(I)?(x("colors must be an array of strings"),!1):!b(Q)&&O(Q)&&Q<0?(x("particleSize must be a positive integer"),!1):!b(D)&&O(D)&&(D<0||D>1)?(x("force must be a positive integer and should be within 0 and 1"),!1):!b(V)&&typeof V=="number"&&O(V)&&V<0?(x("floorHeight must be a positive integer"),!1):!b(U)&&typeof U=="number"&&O(U)&&U<0?(x("floorWidth must be a positive integer"),!1):!0}function M($,S){let{degree:I}=S;const Q=_(Math.abs(g(I,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),D=Math.random()*(wk-Ku)+Ku,V=Math.round(Math.random()*(w.length-1)),U=e.duration-Math.round(Math.random()*1e3),O=Math.random()<Ck,R=k(V),P=O?p(Math.random()*kk,2):0,j=P*-1,q=P,z=p(Math.abs(_(Math.abs(g(I,90)-180),0,180,-1,1)),4),X=p(Math.random()*Gu,4),ne=p(Math.random()*e.force*(y()?1:-1),4),he=Gu,N=p(Math.max(_(Math.abs(I-180),0,180,e.force,-e.force),0),4),G=(Z,W)=>$==null?void 0:$.style.setProperty(Z,W+"");G("--x-landing-point",`${Q}px`),G("--duration-chaos",`${U}ms`),G("--x1",`${P}`),G("--x2",`${j}`),G("--x3",`${q}`),G("--x4",`${z}`),G("--y1",`${X}`),G("--y2",`${ne}`),G("--y3",`${he}`),G("--y4",`${N}`),G("--width",`${R?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),G("--height",(R?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),G("--rotation",`${w[V].join()}`),G("--rotation-duration",`${D}ms`),G("--border-radius",`${R?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function Ik(e,t,a,l,s,i){return l.isVisible&&l.isValid?(r(),h("div",{key:0,class:"confetti-container",style:ra(`--floor-height: ${l.stageHeight}px;`)},[(r(!0),h(H,null,ae(l.particles,c=>{let{color:p,degree:m}=c;return r(),h("div",{key:m,class:"particle",ref:_=>l.setItemRef(_,m)},[o("div",{style:ra(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):B("",!0)}function Qk(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 Dk=`
108 @keyframes y-axis-4ff796ae {
109 to {
110 transform: translate3d(0, var(--floor-height), 0);
111 }
112 }
113 @keyframes x-axis-4ff796ae {
114 to {
115 transform: translate3d(var(--x-landing-point), 0, 0);
116 }
117 }
118 @keyframes rotation-4ff796ae {
119 to {
120 transform: rotate3d(var(--rotation), 360deg);
121 }
122 }
123 .confetti-container[data-v-4ff796ae] {
124 width: 0;
125 height: 0;
126 overflow: visible;
127 position: relative;
128 transform: translate3d(var(--x, 0), var(--y, 0), 0);
129 z-index: 1200;
130 }
131 .confetti-container > .particle[data-v-4ff796ae] {
132 animation: x-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--x1), var(--x2), var(--x3), var(--x4));
133 }
134 .confetti-container > .particle div[data-v-4ff796ae] {
135 position: absolute;
136 top: 0;
137 left: 0;
138 animation: y-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--y1), var(--y2), var(--y3), var(--y4));
139 width: var(--width);
140 height: var(--height);
141 }
142 .confetti-container > .particle div[data-v-4ff796ae]:before {
143 display: block;
144 height: 100%;
145 width: 100%;
146 content: "";
147 background-color: var(--bgcolor);
148 animation: rotation-4ff796ae var(--rotation-duration) infinite linear;
149 border-radius: var(--border-radius);
150 }
151 `;Qk(Dk);vd.render=Ik;vd.__scopeId="data-v-4ff796ae";var Vk=(()=>{const e=vd;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();at.extend(li);at.extend(Nc);let Aa=class{static withTimezone(t){const a=at(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class Tk extends nl{constructor(){super(...arguments);Re(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[Aa.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59")),subscriptionType:""})}get dropdownOpen(){return this.data.showDropdown}toggleDropdown(){this.data.showDropdown=!this.data.showDropdown}setFilterOption(a){this.data.filterOptions=a}get filters(){return this.data.filterOptions}get filteredFilters(){var l;const a=(l=this.data.searchQuery)==null?void 0:l.toLowerCase().trim();return this.filters.filter(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=at(a[0]),s=at(a[1]);this.data.selectedFilters.dateRange={label:u("Date"),value:[l,s],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[Ya.data.dateRange[0],Ya.data.dateRange[1]],this.data.selectedFilters.dateRange={label:u("Date"),value:[Aa.withTimezone(at(this.data.dateRange[0])),Aa.withTimezone(at(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}));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=[],Ya.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:Aa.withTimezone(at(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(Ya.data.currencies).map(([a,l])=>({label:a,value:a}))}shouldRenderOption(a){const l=a.disableRoutes||[],s=ll();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=[Aa.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=Aa.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Ya.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,l){l!=null?(this.removeFilterItem(a,l),Ya.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],Ya.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=Ot.get(a)||{},s=this.applicableFilters(),i={...l,...s};Ot.set(a,i),Ot.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return Ot.get(this.data.storageKey)}retrieveSavedReportFilters(){return Ot.get("report-filter")}}function _p(){return Tk.init()}class Mk extends nl{constructor(){super(...arguments);Re(this,"filterState",null);Re(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[Aa.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:Aa.withTimezone(at().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=Ot.get(this.storageKey),l=Ot.get(this.currencyStorageKey);(!a||!l)&&this.fetchReportMeta()}mergeWithStorage(){const a=Ot.get(this.storageKey),l=Ot.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:je.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=at(a.first_order_date||at().startOf("month")).format("YYYY-MM-DD 00:00:00"),this.syncStorage()}).catch(a=>{}).finally(()=>{this.data.loading=!1})}get currentCurrencySign(){return this.data.currencies&&this.data.currencies.hasOwnProperty(this.data.currency)?this.data.currencies[this.data.currency]:""}addListener(a,l){this.listeners[a]=l,this.data.active_tab=a}async onFilterChange(){this.syncStorage(),this.setDateDiff();for(let a in this.listeners)this.listeners[a](this.applicableFilters)}onModeChange(a){this.data.filterMode=a,this.syncStorage()}syncStorage(){Ot.set(this.storageKey,this.applicableFilters.params),Ot.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=Hc.find(p=>p.text===this.data.rangeKey);let l,s;if(a){const[p,m]=a.value();l=this.data.rangeKey==="All Time"?Aa.withTimezone(at(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):Aa.withTimezone(at(p).format("YYYY-MM-DD 00:00:00")),s=Aa.withTimezone(at(m).format("YYYY-MM-DD 23:59:59"))}else l=Aa.withTimezone(at(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),s=Aa.withTimezone(at(this.data.dateRange[1]).format("YYYY-MM-DD 23:59:59"));const i={orderStatus:this.data.orderStatus,paymentStatus:this.data.paymentStatus,currency:this.data.currency,startDate:je.get("app_config.isProActive")?l:Aa.withTimezone(at().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:je.get("app_config.isProActive")?s:Aa.withTimezone(at().endOf("month").format("YYYY-MM-DD 23:59:59")),rangeKey:this.data.rangeKey,variation_ids:this.data.variation_ids,filterMode:this.data.filterMode,storeMode:this.data.storeMode,firstOrderDate:this.data.firstOrderDate,compareType:this.data.compareType,compareDate:this.data.compareDate,subscriptionType:this.data.subscriptionType};let 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=at(l).diff(at(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[Aa.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=Aa.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"))),a==="subscriptionType"&&(this.data.subscriptionType=""),a==="orderTypes"&&(this.data.orderTypes=["all"]),(a==="orderStatus"||a==="paymentStatus")&&(this.data[a]=["all"]),a==="variation_ids"&&(this.data.variation_ids=[]),a==="dateRange"&&(this.data[a]=[Aa.withTimezone(at().startOf("month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return Ot.get(this.data.storageKey)}}const Ya=Mk.init();class Lk extends nl{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):rt.set(this.data,s,rt.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 $l=Lk.init(),Rk={key:0,class:"fct-report-sold-product-list has-scroll"},Ok={class:"list-left-content"},Hk={class:"list-image"},Pk=["src"],Nk=["src"],Kk={class:"list-title"},Gk=["title"],jk={class:"list-id"},zk={class:"list-right-content"},qk={class:"list-value"},Yk=["innerHTML"],gd={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=K(()=>t.data);return(l,s)=>{const i=C("el-skeleton"),c=C("router-link");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[n(Ln,{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",Rk,[(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",Ok,[o("div",Hk,[p.media!==null?(r(),h("img",{key:0,src:p.media,alt:""},null,8,Pk)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,Nk))]),o("div",Kk,[o("div",{class:"list-title-inner",title:p.product_name},f(p.product_name),9,Gk),o("div",jk,"#"+f(A(Zt)(p.product_id)),1)])]),o("div",zk,[o("div",qk,f(A(Zt)(p.quantity_sold))+" "+f(A(u)(" Sold")),1),o("div",{class:"list-price",innerHTML:A(et).scaled(p.total_amount)},null,8,Yk)])]),_:2},1032,["to"])]))),128))])):(r(),E(bt,{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})}}},Wk={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},Xk=["innerHTML"],Jk={class:"fluent_cart_dashboard_inner"},Zk={class:"fluent_cart_dashboard_main"},eB={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},tB={class:"fluent_cart_dashboard_aside"},aB={class:"fct-congrats-dialog-content"},lB={class:"fct-congrats-dialog-content-inner"},sB={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},nB=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=T(!1),a=T([]),l=T(!1);jr("dashboardTogglePageNotification",y=>{l.value=y});const i=()=>{const[y,v]=[at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),at().format("YYYY-MM-DD 23:59:59")],w={startDate:y,endDate:v,paymentStatus:"all"};ol.getSalesGrowthChart({params:{...w,groupKey:"daily"}})},c=()=>{ol.getRecentOrders({params:null})},p=()=>{const y={paymentStatus:"all"};ol.getCountryHeatMap({params:{...y,groupKey:"daily"}})},m=()=>{const[y,v]=[at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),at().format("YYYY-MM-DD 23:59:59")],w={startDate:y,endDate:v};ol.getTopSoldProducts({params:{...w}})},_=()=>{en.getVueParams(),Ot.get("onboarding_congratulations","no")!=="yes"&&je.get("total_products_count")==0&&(Ot.set("onboarding_congratulations","yes"),t.value=!0)},g=()=>je.get("admin_url")+"settings/store-settings/pages_setup";return Ie(()=>{window.addEventListener("getSalesGrowth",i),a.value=je.get("dummy_product_info"),i(),p(),c(),_(),m()}),(y,v)=>{const w=C("el-col"),k=C("el-row"),b=C("el-button"),x=C("el-dialog");return r(),h("div",Wk,[l.value?(r(),E(Ja,{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="'+g()+'" target="_blank">'+A(u)("Set up your pages")+"</a>")},null,8,Xk)]),_:1})):B("",!0),o("div",Jk,[o("div",Zk,[n(IC),n(Nt,{permission:"dashboard_stats/view"},{default:d(()=>[o("div",eB,[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),L(" "+f(A(u)("Last %s Days",A(Zt)(30))),1)]),n(bk)]),_:1}),n(Nt,{permission:"reports/view"},{default:d(()=>[n(Bw,{chartData:A(ol).data.salesGrowthChart,loading:A(ol).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),n(k,{gutter:24},{default:d(()=>[n(Nt,{permission:"reports/view"},{default:d(()=>[n(w,{lg:12},{default:d(()=>[n(zw)]),_:1})]),_:1}),n(Nt,{permission:"reports/view"},{default:d(()=>[n(w,{lg:12,class:"mt-6 xl:mt-0"},{default:d(()=>[n(gd,{data:A(ol).topSoldProducts,loading:A(ol).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),n(Nt,{permission:"reports/view"},{default:d(()=>[n(w,{class:"mt-6"},{default:d(()=>[n(Uw,{data:A(ol).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",tB,[n(_C)])]),n(x,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":v[1]||(v[1]=F=>t.value=F),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:d(()=>[o("div",aB,[o("div",lB,[v[2]||(v[2]=o("div",{class:"icon"},"🎉",-1)),o("h3",null,f(A(u)("Congratulations!")),1),o("p",null,f(A(u)("You successfully finished your onboarding & your store is ready.")),1),n(b,{type:"primary",onClick:v[0]||(v[0]=F=>t.value=!1)},{default:d(()=>[L(f(A(u)("Let's go")),1)]),_:1})])]),o("div",sB,[n(A(Vk),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),oB={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)}}},iB={key:2},rB=["onClick"],dB=["onClick"];function uB(e,t,a,l,s,i){const c=C("el-checkbox"),p=C("el-option"),m=C("el-select"),_=C("el-col"),g=C("el-option-group"),y=C("el-input"),v=C("el-row");return r(),h("div",null,[a.disabled?(r(),E(c,{key:1,disabled:"",onClick:t[1]||(t[1]=w=>s.comingSoon=!0)},{default:d(()=>[L(f(a.labels.status_label),1)]),_:1})):(r(),E(c,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=w=>a.conditionals.status=w)},{default:d(()=>[L(f(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),h("div",iB,[L(f(a.labels.notification_if_start)+" ",1),n(m,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=w=>a.conditionals.type=w)},{default:d(()=>[(r(),h(H,null,ae({all:"All",any:"Any"},(w,k)=>n(p,{key:k,value:k},{default:d(()=>[L(f(w),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),L(" "+f(a.labels.notification_if_end)+" ",1),(r(!0),h(H,null,ae(i.items,(w,k)=>(r(),E(v,{key:k,style:{"margin-top":"15px"},gutter:10},{default:d(()=>[n(_,{md:8},{default:d(()=>[n(m,{size:"default",modelValue:i.items[k].field,"onUpdate:modelValue":b=>i.items[k].field=b,style:{width:"100%"},onChange:b=>i.items[k].value=""},{default:d(()=>[(r(!0),h(H,null,ae(a.fields,(b,x)=>(r(),E(p,{key:x,label:b.admin_label,value:x},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),n(_,{md:5},{default:d(()=>[n(m,{size:"default",modelValue:i.items[k].operator,"onUpdate:modelValue":b=>i.items[k].operator=b},{default:d(()=>[n(g,{label:"General Operators"},{default:d(()=>[n(p,{value:"=",label:"equals"}),n(p,{value:"!=",label:"not equal"}),a.fields[w.field]&&!Object.keys(a.fields[w.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":b=>i.items[k].value=b},null,8,["modelValue","onUpdate:modelValue"])):(r(),h(H,{key:1},[a.fields[w.field]&&Object.keys(a.fields[w.field].options).length?(r(),E(m,{key:0,size:"default",modelValue:i.items[k].value,"onUpdate:modelValue":b=>i.items[k].value=b,style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(a.fields[w.field].options,(b,x)=>(r(),E(p,{key:x,label:b,value:x},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":b=>i.items[k].value=b},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),n(_,{md:3,class:"action-btns"},{default:d(()=>[o("i",{class:"el-icon-plus",onClick:b=>i.add(k)},null,8,rB),i.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:b=>i.remove(k)},null,8,dB)):B("",!0)]),_:2},1024)]),_:2},1024))),128))])):B("",!0)])}const cB=st(oB,[["render",uB]]),AB={name:"ErrorView",props:["field","errors"],computed:{Str(){return da}}},pB={key:0,class:"fct-inline-error ff"};function fB(e,t,a,l,s,i){return a.errors.has(a.field)?(r(),h("p",pB,f(a.errors.errors[a.field].required?i.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):B("",!0)}const Ro=st(AB,[["render",fB]]),mB={name:"InputPopover",components:{Popover:Pc},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)}}},hB={class:"flex-1"},_B={key:0,class:"input-textarea-value"};function vB(e,t,a,l,s,i){const c=C("el-input"),p=C("Popover");return r(),h("div",{class:re(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",hB,[a.fieldType=="textarea"?(r(),h("div",_B,[n(c,{placeholder:a.placeholder,type:"textarea",modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=m=>s.model=m)},null,8,["placeholder","modelValue"])])):(r(),E(c,{key:1,placeholder:a.placeholder,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=m=>s.model=m),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),n(p,{class:re(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const gB=st(mB,[["render",vB]]),yB={name:"FieldGeneral",components:{inputPopover:gB},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)}}},bB={class:"fct-field-general"};function wB(e,t,a,l,s,i){const c=C("input-popover");return r(),h("div",bB,[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 ql=st(yB,[["render",wB]]),CB={key:0,class:"fct-merge-fields"},kB={class:"fct-merge-fields-container"},BB={key:3},xB={name:"FieldMaps",components:{ErrorView:Ro,FieldGeneral:ql},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}}},SB=Object.assign(xB,{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",CB,[o("div",kB,[(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":m=>e.settings[c.key]=m,placeholder:t.$t("Select a Field"),clearable:"",class:re(e.errors.errors[c.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,ae(e.inputs,(m,_)=>(r(),h(H,{key:_},[(m==null?void 0:m.attributes.type)==="email"?(r(),E(l,{key:0,value:m==null?void 0:m.attributes.code,label:m==null?void 0:m.attributes.name},null,8,["value","label"])):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":m=>e.settings[c.key]=m,placeholder:t.$t("Select a Field"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.inputs,(m,_)=>(r(),E(l,{key:_,value:m.attributes.name,label:m.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),E(ql,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[c.key],modelValue:e.settings[c.key],"onUpdate:modelValue":m=>e.settings[c.key]=m},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),c.help_text?(r(),h("div",BB,f(c.help_text),1)):B("",!0),n(Ro,{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(ql,{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(Ro,{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(ql,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[p],onOnValueUpdated:function(m){t.onValueUpdated(m,p)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):B("",!0)}}}),FB={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 En(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},$B={class:"fluent_cart_list_select_filter"};function EB(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select");return r(),h("div",$B,[n(p,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=m=>a.settings[a.field.key]=m),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(H,null,ae(i.listItems,m=>(r(),E(c,{key:m.label,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const UB=st(FB,[["render",EB]]),IB={name:"DropdownLabelRepeater",components:{FieldGeneral:ql},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})}}},QB={class:"dropdown_label_repeater"},DB={key:0,class:"fluent_cart-table"};function VB(e,t,a,l,s,i){const c=C("el-input"),p=C("FieldGeneral"),m=C("el-button"),_=C("el-button-group");return r(),h("div",QB,[s.loading?B("",!0):(r(),h("table",DB,[o("thead",null,[o("tr",null,[o("th",null,f(a.field.field_label||"Field Label"),1),o("th",null,f(a.field.value_label||"Field Value"),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(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(m,{type:"success",onClick:v=>i.addItemAfter(y)},{default:d(()=>t[1]||(t[1]=[L("+",-1)])),_:2,__:[1]},1032,["onClick"]),n(m,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>i.removeItem(y)},{default:d(()=>t[2]||(t[2]=[L("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const TB=st(IB,[["render",VB]]),MB={name:"DropdownManyFields",components:{FieldGeneral:ql,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)}}},LB={class:"dropdown_label_repeater w-full"},RB={class:"fluent_cart-table w-full text-left"},OB={class:"action-btns"},HB={class:"dropdown_label_repeater_footer"};function PB(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),m=C("FieldGeneral"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-button");return r(),h("div",LB,[o("table",RB,[t[1]||(t[1]=o("colgroup",null,[o("col",{width:"25%"}),o("col",{width:"70%"}),o("col",{width:"10%"})],-1)),o("thead",null,[o("tr",null,[o("th",null,f(s.rendered_labels.remote_text),1),o("th",null,f(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,w)=>(r(),h("tr",{key:"item_"+w},[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,b)=>(r(),E(c,{key:b,label:k,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[n(m,{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",OB,[n(g,{size:"x-small",tag:"button",onClick:Ne(k=>i.removeItem(w),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:d(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),o("div",HB,[n(y,{text:"",onClick:Ne(i.addNewItem,["prevent"])},{default:d(()=>[n(_,{name:"Plus"}),L(" "+f(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const NB=st(MB,[["render",PB]]),KB={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()}}},GB={class:"fluent_cart_chained_filter"};function jB(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),m=Ma("loading");return Gt((r(),h("div",GB,[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"]),Gt(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"]),[[Vl,s.chained_settings.category]])])),[[m,s.loading]])}const zB=st(KB,[["render",jB]]),qB={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;En(t,(a,l)=>{this.$set(this.field,l,a)})}).catch(e=>{})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),En(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}}},YB={class:"fluent_cart_chained_filter"};function WB(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),m=C("el-col"),_=C("el-row"),g=Ma("loading");return Gt((r(),h("div",YB,[n(_,{gutter:0},{default:d(()=>[(r(!0),h(H,null,ae(a.field.fields_options,(y,v)=>(r(),E(m,{span:12,key:v,class:"fluent_carteach_filter"},{default:d(()=>[o("label",null,f(a.field.options_labels[v].label),1),n(p,{onChange:w=>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":w=>a.value[v]=w},{default:d(()=>[(r(!0),h(H,null,ae(y,(w,k)=>(r(),E(c,{key:k,value:k,label:w},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,s.loading]])}const XB=st(qB,[["render",WB]]),JB={name:"RoutingFilterFields",components:{DynamicIcon:J,IconButton:Ze,FieldGeneral:ql},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)}}},ZB={class:"fluent_cart_routing_fields"},e8={key:0,class:"fluent_cart_routing_table"},t8={class:"fluent_cart_inline"},a8={class:"action-btns"};function l8(e,t,a,l,s,i){const c=C("el-input"),p=C("el-option"),m=C("el-select"),_=C("FieldGeneral"),g=C("DynamicIcon"),y=C("IconButton");return r(),h("div",ZB,[a.disabled?B("",!0):(r(),h("table",e8,[o("tbody",null,[(r(!0),h(H,null,ae(a.routings,(v,w)=>(r(),h("tr",{key:w},[o("td",null,[o("label",t8,f(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(m,{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,b)=>(r(),E(p,{key:b,label:k,value:b},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(m,{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(m,{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,b)=>(r(),E(p,{key:b,label:k,value:b},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",a8,[n(y,{size:"x-small",tag:"button",onClick:Ne(k=>i.add(w),["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(w),["prevent"])},{default:d(()=>[n(g,{name:"Minus"})]),_:2},1032,["onClick"])):B("",!0)])])]))),128))])]))])}const s8=st(JB,[["render",l8]]),n8={name:"SelectionRouting",components:{RoutingFilterFields:s8,FiledGeneral:ql},props:["field","settings","inputs","editorShortcodes"]},o8={class:"fluent_cart_field_routing"},i8={class:"mb-4"},r8={key:3};function d8(e,t,a,l,s,i){const c=C("el-checkbox"),p=C("el-option"),m=C("el-select"),_=C("el-input"),g=C("FiledGeneral"),y=C("RoutingFilterFields");return r(),h("div",o8,[o("div",i8,[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(()=>[L(f(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),o("div",null,[a.field.simple_component=="select"?(r(),E(m,{key:0,disabled:a.settings[a.field.routing_key]!="simple",filterable:"",clearable:"",multiple:a.field.is_multiple,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[1]||(t[1]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(H,null,ae(a.field.options,(v,w)=>(r(),E(p,{key:w,value:w,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",r8,f(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 u8=st(n8,[["render",d8]]),c8={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=vf(e).bind(this);return gf(t,{settings:this.settings,app:this})}return null}},A8={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"}}}},p8={class:"fct-feed-header mb-5"},f8={class:"mb-5 flex items-center justify-between"},m8={class:"capitalize"};function h8(e,t,a,l,s,i){const c=C("el-breadcrumb-item"),p=C("el-breadcrumb"),m=C("el-switch");return r(),h("div",p8,[o("div",f8,[n(p,{"separator-icon":i.ArrowRight},{default:d(()=>[n(c,{to:i.prevRoute},{default:d(()=>[L(f(e.$t("Integrations")),1)]),_:1},8,["to"]),n(c,null,{default:d(()=>[o("span",m8,f(a.integration_name),1)]),_:1})]),_:1},8,["separator-icon"]),n(m,{modelValue:a.settings.enabled,"onUpdate:modelValue":t[0]||(t[0]=_=>a.settings.enabled=_),"active-value":"yes","inactive-value":"no","active-text":e.$t("Enable this Integration")},null,8,["modelValue","active-text"])])])}const _8=st(A8,[["render",h8]]);class v8{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 g8={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 y8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),m=Ma("loading");return Gt((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"])),[[m,s.loading]])}const b8=st(g8,[["render",y8]]),w8={name:"FeedEditor",components:{FilterFields:cB,MergeFieldMapper:SB,FiledGeneral:ql,ListSelectFilter:UB,DropDownLabelRepeater:TB,DropDownManyFields:NB,ChainedFields:zB,ChainedSelects:XB,SelectionRouting:u8,CardContainer:xe,CardBody:Ce,CardHeader:Qe,LabelHint:pa,FeedHeader:_8,ErrorView:Ro,CustomComponentRender:c8,RestSelector:b8},data(){return{loading_app:!1,loading_list:!1,errors:new v8,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"?Y.validationErrors(t):Y.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]={}}}},C8={class:"fct-integration-container fct-layout-width"},k8={class:"fct-add-integration py-7.5"},B8={class:"grid gap-5"},x8={key:0,class:"fct-setting-form-content"},S8=["innerHTML"],F8={class:"fct-setting-form-fields"},$8=["innerHTML"],E8=["innerHTML"],U8=["innerHTML"],I8={key:0,class:"fct-setting-form-row"},Q8={class:"fct-setting-form-content"},D8={class:"fct-setting-form-content"},V8={class:"fct-setting-form-fields"},T8={class:"fct-inline-tip pl-6"},M8={key:0,class:"setting-save-action"};function L8(e,t,a,l,s,i){const c=C("el-skeleton-item"),p=C("el-skeleton"),m=C("FeedHeader"),_=C("LabelHint"),g=C("el-input"),y=C("ErrorView"),v=C("el-option"),w=C("el-select"),k=C("MergeFieldMapper"),b=C("el-checkbox"),x=C("el-checkbox-group"),F=C("el-option-group"),M=C("FilterFields"),$=C("FiledGeneral"),S=C("ListSelectFilter"),I=C("DropDownLabelRepeater"),Q=C("DropDownManyFields"),D=C("el-radio"),V=C("el-radio-group"),U=C("el-input-number"),O=C("ChainedFields"),R=C("ChainedSelects"),P=C("SelectionRouting"),j=C("RestSelector"),q=C("CardBody"),z=C("CardContainer"),X=C("el-button"),ne=C("el-form"),he=Ma("loading");return r(),h("div",C8,[o("div",k8,[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",B8,[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(m,{settings:s.settings,integration_name:s.integration_name},null,8,["settings","integration_name"]),n(z,null,{default:d(()=>[n(q,null,{default:d(()=>[(r(!0),h(H,null,ae(s.settings_fields.fields,(N,G)=>(r(),h("div",{key:G,class:re(["fct-setting-form-row",N.key])},[N.label?(r(),h("div",x8,[N.tips?(r(),E(_,{key:0,title:N.label,content:N.tips,placement:"top-start",required:N.required},null,8,["title","content","required"])):(r(),E(_,{key:1,title:N.label,required:N.required},null,8,["title","required"])),N.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:N.inline_tip},null,8,S8)):B("",!0)])):B("",!0),o("div",F8,[N.component==="text"?(r(),h(H,{key:0},[n(g,{placeholder:N.placeholder,modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z,class:re(s.errors.errors[N.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),n(y,{field:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="list_ajax_options"?(r(),h(H,{key:1},[Gt((r(),E(w,{onChange:t[0]||(t[0]=Z=>i.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=Z=>s.settings.list_id=Z),placeholder:N.placeholder,clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(Z,W)=>(r(),E(v,{key:W,value:W,label:Z},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[he,s.loading_list]]),n(y,{field:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="map_fields"?(r(),E(k,{key:2,onSetMergeModelObj:Z=>i.setMergeModel(N),errors:s.errors,inputs:s.inputs,field:N,settings:s.settings,editorShortcodes:s.editorShortcodes,merge_model:s.settings[N.key],merge_fields:s.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):N.component==="select"?(r(),h(H,{key:3},[n(w,{filterable:"",clearable:"",multiple:N.is_multiple,modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z,placeholder:N.placeholder},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(Z,W)=>(r(),E(v,{key:W,value:W,label:Z},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),n(y,{field:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="checkbox-single"?(r(),h(H,{key:4},[n(b,{modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z},{default:d(()=>[L(f(N.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:N.inline_tip},null,8,$8)):B("",!0)],64)):N.component==="yes-no-checkbox"?(r(),h(H,{key:5},[n(b,{"true-value":"yes","false-value":"no",modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z},{default:d(()=>[L(f(N.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:N.inline_tip},null,8,E8)):B("",!0)],64)):N.component==="checkbox-multiple"?(r(),E(x,{key:6,modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(Z,W)=>(r(),E(b,{key:W,label:Number(W)},{default:d(()=>[L(f(Z),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):N.component==="selection_group"?(r(),h(H,{key:7},[n(w,{modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z,placeholder:N.placeholder,multiple:"",class:re(s.errors.errors[N.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(Z,W)=>(r(),E(F,{key:W,label:Z.label},{default:d(()=>[(r(!0),h(H,null,ae(Z.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:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="conditional_block"?(r(),E(M,{key:8,fields:s.inputs,conditionals:s.settings[N.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):N.component==="value_text"?(r(),E($,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[N.key],modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):N.component==="value_textarea"?(r(),E($,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[N.key],modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):N.component==="list_select_filter"?(r(),E(S,{key:11,settings:s.settings,field:N},null,8,["settings","field"])):N.component==="dropdown_label_repeater"?(r(),E(I,{key:12,errors:s.errors,inputs:s.inputs,field:N,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):N.component==="dropdown_many_fields"?(r(),E(Q,{key:13,errors:s.errors,inputs:s.inputs,field:N,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):N.component==="radio_choice"?(r(),E(V,{key:14,modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(Z,W)=>(r(),E(D,{key:W,label:W},{default:d(()=>[L(f(Z),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):N.component==="number"?(r(),E(U,{key:15,size:"default",modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z},null,8,["modelValue","onUpdate:modelValue"])):N.component==="chained_fields"?(r(),E(O,{key:16,settings:s.settings,modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z,field:N},null,8,["settings","modelValue","onUpdate:modelValue","field"])):N.component==="chained_select"?(r(),E(R,{key:17,settings:s.settings,modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z,field:N},null,8,["settings","modelValue","onUpdate:modelValue","field"])):N.component==="html_info"?(r(),h("div",{key:18,innerHTML:N.html_info},null,8,U8)):N.component==="selection_routing"?(r(),E(P,{key:19,inputs:s.inputs,field:N,editorShortcodes:s.editorShortcodes,settings:s.settings},null,8,["inputs","field","editorShortcodes","settings"])):N.component==="rest_selector"?(r(),E(j,{key:20,field:N,modelValue:s.settings[N.key],"onUpdate:modelValue":Z=>s.settings[N.key]=Z},null,8,["field","modelValue","onUpdate:modelValue"])):N.component==="custom_component"?(r(),E(Cl("custom-component-render"),{key:21,field:N,settings:s.settings},null,8,["field","settings"])):B("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(r(),h("div",I8,[o("div",Q8,[o("div",D8,[n(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",V8,[n(w,{filterable:"",clearable:"",multiple:!0,modelValue:s.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=N=>s.settings.conditional_variation_ids=N),placeholder:e.$t("Leave empty for all the variations")},{default:d(()=>[(r(!0),h(H,null,ae(s.product_variations,N=>(r(),E(v,{key:N.id,value:N.id,label:N.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),o("p",T8,f(e.$t("Leave empty to run this feed for all variations")),1)])])):B("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),h("div",M8,[n(X,{type:"primary",loading:s.saving,onClick:i.saveNotification},{default:d(()=>[L(f(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 ju=st(w8,[["render",L8]]),R8={class:"setting-wrap"},O8={key:0,class:"integration-actions"},H8={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},P8={class:"text-base"},N8={key:1,class:"fct-integrations-table-wrap"},K8={class:"fct-integration-logo-wrap"},G8=["src","alt"],j8={class:"text-xs text-gray-700"},z8=["onClick"],q8={class:"fct-event-triggers"},Y8={class:"fct-event-triggers"},W8={class:"fct-btn-group sm"},X8={key:2,class:"fct-integration-table-footer"},J8={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},Z8={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:ad}},e4=Object.assign(Z8,{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"),m=C("el-switch"),_=C("el-table-column"),g=C("el-tag"),y=C("el-popover"),v=C("el-tooltip"),w=C("el-table"),k=Ma("loading");return r(),h("div",R8,[n(xe,{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",O8,[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,(b,x)=>(r(),E(s,{key:x,command:x},{default:d(()=>[L(f(b.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(l,{type:"info",plain:"",size:"small"},{default:d(()=>[L(f(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",N8,[Gt((r(),E(w,{data:t.feeds},{empty:d(()=>[n(bt,{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(b=>[n(m,{"active-value":"yes","inactive-value":"no",onChange:x=>t.handleActive(b.row),modelValue:b.row.enabled,"onUpdate:modelValue":x=>b.row.enabled=x},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(_,{width:120,label:t.$t("Integration")},{default:d(b=>{var x,F;return[o("div",K8,[(x=t.available_integrations[b.row.provider])!=null&&x.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:t.available_integrations[b.row.provider].logo,alt:b.row.provider},null,8,G8)):B("",!0),o("span",j8,f(((F=t.available_integrations[b.row.provider])==null?void 0:F.title)||b.row.provider),1)])]}),_:1},8,["label"]),n(_,{width:220,label:t.$t("Title")},{default:d(b=>[o("a",{class:"fct-action-link-btn",onClick:Ne(x=>t.edit(b.row),["prevent"]),href:"#"},f(b.row.name),9,z8)]),_:1},8,["label"]),n(_,{width:160,label:t.$t("Triggers")},{default:d(b=>[o("div",q8,[(r(!0),h(H,null,ae((b.row.feed.event_trigger||[]).slice(0,2),(x,F)=>(r(),E(g,{key:x},{default:d(()=>[n(J,{name:"Trigger"}),L(" "+f(A(da).headline(x)),1)]),_:2},1024))),128)),(b.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(()=>[L(" +"+f((b.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",Y8,[(r(!0),h(H,null,ae((b.row.feed.event_trigger||[]).slice(2),(x,F)=>(r(),E(g,{key:x+F},{default:d(()=>[n(J,{name:"Trigger"}),L(" "+f(A(da).headline(x)),1)]),_:2},1024))),128))])]),_:2},1024)):B("",!0)])]),_:1},8,["label"]),n(_,{width:80},{default:d(b=>[o("div",W8,[n(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",onClick:x=>t.edit(b.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:x=>t.removeFeed(b.row.id,b),hover:"danger"},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[k,t.loading]])])):(r(),h("div",H8,[o("p",P8,f(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(()=>[L(f(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?B("",!0):(r(),h("div",X8,[o("a",J8,f(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),t4={name:"Integrations",components:{Badge:fa,FluidTabItem:Co,FluidTab:qr,CardBody:Ce,CardContainer:xe,CardHeader:Qe,PageHeading:sl,IconButton:Ze,DynamicIcon:J,Empty:bt,GlobalIntegrationFeeds:e4},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:je.get("admin_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};En(e,(a,l)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[l]=a)}),e=t}if(this.module_type!="all"){let t={};En(e,(a,l)=>{a.categories&&a.categories.includes(this.module_type)&&(t[l]=a)}),e=t}return e},is_no_modules(){return ad(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{upgradeUrl:Qf,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=""})}}},a4={class:"fct-integration-container fct-layout-width"},l4={class:"fct-integration-content mt-8"},s4={class:"fct-integration-content-head"},n4={class:"fct-card-header-title mb-1"},o4={class:"card-header-text mt-0"},i4={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"},r4={class:"fct-integration-search"},d4={key:1},u4={class:"fct-integration-card-content"},c4={class:"fct-integration-card-content-inner"},A4={class:"fct-integration-card-logo"},p4=["src","alt"],f4={class:"title"},m4={class:"desc"},h4={key:0,class:"mt-2"},_4={key:1,class:"mt-2"};function v4(e,t,a,l,s,i){const c=C("PageHeading"),p=C("GlobalIntegrationFeeds"),m=C("DynamicIcon"),_=C("IconButton"),g=C("FluidTabItem"),y=C("FluidTab"),v=C("el-input"),w=C("el-skeleton"),k=C("Badge"),b=C("el-button"),x=C("Empty"),F=C("CardBody"),M=C("CardContainer");return r(),h("div",a4,[n(c,{title:e.$t("Integrations & Addons")},null,8,["title"]),n(p),o("div",l4,[n(M,null,{default:d(()=>[n(F,null,{default:d(()=>[o("div",s4,[n(_,{circle:"",size:"large"},{default:d(()=>[n(m,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",n4,f(e.$t("Integration Modules")),1),o("p",o4,f(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",i4,[n(y,null,{default:d(()=>[(r(!0),h(H,null,ae(s.modules,($,S)=>(r(),E(g,{key:S,class:re(["uppercase",$===s.module_type?"active":""]),onClick:I=>i.changeModuleType($)},{default:d(()=>[L(f($),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",r4,[n(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=$=>s.search=$)},{prefix:d(()=>[n(m,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(r(),E(w,{key:0,loading:!0,animated:"",rows:4})):B("",!0),s.fetching?B("",!0):(r(),h("div",d4,[(r(!0),h(H,null,ae(i.filteredAddons,($,S)=>(r(),h("div",{key:S,class:re(["fct-integration-card","addon-enabled-"+$.enabled])},[o("div",u4,[o("div",c4,[o("div",A4,[$.logo?(r(),h("img",{key:0,src:$.logo,alt:$.title},null,8,p4)):B("",!0)]),o("div",null,[o("h5",f4,[L(f($.title)+" ",1),$.is_pro&&!$.enabled?(r(),E(k,{key:0,status:"warning",text:"Pro"})):(r(),E(k,{key:1,status:$.enabled?"active":"info",text:$.enabled?"enabled":"disabled"},null,8,["status","text"]))]),o("p",m4,f($.description),1),$.is_pro&&!$.is_pro_active?(r(),h("div",h4,[n(b,{type:"warning",size:"small",tag:"a",href:i.upgradeUrl("feature_lock_integrations"),target:"_blank"},{default:d(()=>[n(m,{name:"Crown",class:"mr-1"}),L(" "+f(i.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!$.enabled&&$.installable?(r(),h("div",_4,[n(b,{loading:s.installingAdding==S,disabled:s.installingAdding==S,onClick:I=>i.installAddon($,S),type:"primary",size:"small"},{default:d(()=>[L(f(i.translate("Install %s",$.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):B("",!0)])])])],2))),128))])),i.is_no_modules&&!s.fetching?(r(),E(x,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):B("",!0)]),_:1})]),_:1})])])}const g4=st(t4,[["render",v4]]),y4={class:"fct-connect-details"},b4={key:0,class:"fct-connect-require"},w4=["src"],C4={key:1,class:"fct-connect-success"},k4={class:"inline-flex items-center gap-3"},B4={key:0,class:"display-name"},x4={class:"display-role"},S4={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)})}}},zu=Object.assign(S4,{setup(e){return(t,a)=>{var c;const l=C("el-button"),s=C("el-tag"),i=C("el-popconfirm");return r(),h("div",y4,[!e.connect||e.connect.error?(r(),h("div",b4,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,w4),o("h4",null,f(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:ra({backgroundColor:e.brandColor,borderColor:e.brandColor,color:"white"})},{default:d(()=>[L(f(A(u)("Connect with %1$s",e.methodLabel)),1)]),_:1},8,["href","style"])])):(r(),h("div",C4,[o("div",k4,[o("div",null,[e.connect.display_name?(r(),h("p",B4,f(e.connect.display_name),1)):B("",!0),o("h4",x4,f(t.$t("Administrator"))+" ("+f(t.$t("Owner"))+") ",1)]),n(s,{size:"small",type:"success"},{default:d(()=>[L(f(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(()=>[L(f(A(u)("Disconnect")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])]))])}}}),F4={__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(yd,{fields:i.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},$4={class:"setting-label"},E4=["innerHTML"],U4={key:0},I4={__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",$4,[L(f(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,E4)]),default:d(()=>[n(l,null,{default:d(()=>[n(A(tl))]),_: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,m)=>(r(),E(i,{label:p,value:m,key:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),a[1]||(a[1]=o("br",null,null,-1)),a[2]||(a[2]=o("br",null,null,-1)),(r(!0),h(H,null,ae(e.fields[e.index].dependants,(p,m)=>(r(),h("div",{key:m},[e.settings[e.index]===p.value?(r(),h("div",U4,[n(yd,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):B("",!0)]))),128))],64)}}},Q4={name:"PayPalWebhookSetup",components:{Notify:Y},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",Y.success(e.message),this.$emit("reload_settings",!0)}).catch(e=>{this.isLoading=!1,this.setupStatus="error",Y.error(e.message),setTimeout(()=>{window.location.reload()},2e3)})}}},D4={key:0,class:"fluent_cart_paypal_webhook_setup"},V4={class:"fluent_cart_paypal_webhook_setup_title"},T4=["innerHTML"],M4={key:1};function L4(e,t,a,l,s,i){const c=C("el-button"),p=Ma("loading");return i.isConnected?(r(),h("div",D4,[o("p",V4,"PayPal "+f(a.mode)+" webhook setup",1),a.webhook_info?Gt((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,T4)),[[p,s.checkingWebhook]]):(r(),h("div",M4,[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 R4=st(Q4,[["render",L4],["__scopeId","data-v-f187f73f"]]),O4={key:0,class:"fct-col"},H4=["innerHTML"],P4={key:1,class:"fct-col"},N4={class:"font-bold p-6 mt-6 text-center bg-gray-200"},K4={key:2,class:"fct-col"},G4={class:"bg-gray-25 dark:bg-dark-500 p-5 rounded flex flex-col"},j4={class:"text-red-700"},z4={key:1},q4={key:0},Y4={class:"flex items-center justify-between"},W4={key:1,class:"flex items-center justify-between"},X4={class:"text-red-700"},J4={key:3,class:"fct-col"},Z4={class:"setting-label"},ex=["innerHTML"],tx={key:0,class:"fct-settings-description"},ax={key:4,class:"fct-col"},lx=["innerHTML"],sx={key:0,class:"fct-settings-description"},nx={key:5,class:"fct-col"},ox={class:"setting-label"},ix=["innerHTML"],rx={key:0,class:"fct-settings-description"},dx={key:6,class:"fct-col"},ux={class:"setting-label flex items-center gap-1"},cx=["innerHTML"],Ax={class:"options-img"},px=["src"],fx={class:"options-name"},mx={class:"options-text"},hx={key:0,class:"fct-settings-description"},_x={key:7,class:"fct-col"},vx={key:0},gx=["innerHTML"],yx={key:8,class:"fct-col"},bx={class:"setting-label"},wx={key:0,class:"fct-settings-description"},Cx={key:9,class:"fct-col"},kx={class:"setting-label"},Bx={key:0,class:"fct-settings-description"},xx={key:10,class:"fct-col"},Sx={class:"setting-label"},Fx={key:0,class:"fct-settings-description"},$x={key:11,class:"fct-col"},Ex={class:"setting-label"},Ux=["innerHTML"],Ix={key:0,class:"fct-settings-description"},Qx={key:12,class:"fct-col"},Dx={class:"setting-label"},Vx=["innerHTML"],Tx={key:0,class:"fct-settings-description"},Mx={key:13,class:"fct-col"},Lx={class:"setting-label"},Rx=["innerHTML"],Ox={key:0,class:"fct-settings-description"},Hx={key:14,class:"fct-col"},Px={class:"setting-label"},Nx={key:0,class:"fct-settings-description"},Kx={key:15,class:"fct-col"},Gx=["innerHTML"],jx={key:1},zx={key:0,class:"setting-label"},qx={key:1,class:"copyable-content"},Yx={key:2},Wx={key:0,class:"setting-label"},Xx={class:"fct-payment-steps-list"},Jx={class:"fct-payment-steps-number"},Zx=["innerHTML"],e3={key:4,class:"fct-events-wrap"},t3={class:"setting-label"},a3={class:"flex items-center gap-2 flex-wrap"},l3={class:"copyable-content"},s3={key:5,class:"fct-webhook-notice"},n3={class:"fct-webhook-notice-title"},o3={class:"fct-webhook-notice-desc"},i3={key:0},r3={key:16,class:"fct-col"},d3={key:0},u3={key:0},c3={class:"setting-label"},A3={class:"flex flex-wrap gap-2"},p3=["href"],f3={key:1},m3={class:"setting-label"},h3={class:"flex flex-wrap gap-2"},_3=["href"],v3={key:17,class:"fct-col"},g3={key:18,class:"fct-col"},yd={__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=qt().ctx,l=T({}),s=T(null),i=T(null),c=T(!1),p=T({}),m=je.get("shop.order_mode"),_=e,g=t,y=K(()=>{var $,S,I;return(($=_.settings)==null?void 0:$.payment_mode)==="test"?(S=_.settings)==null?void 0:S.define_test_keys:(I=_.settings)==null?void 0:I.define_live_keys});K(()=>{var $,S;return($=_.fields)!=null&&$.payment_mode&&((S=_.settings)==null?void 0:S.payment_mode)!==m&&g("onSettingsChange",{..._.settings,payment_mode:m}),!0});const v=K(()=>{var $;return(($=_.settings)==null?void 0:$.payment_mode)==="test"?"test":"live"}),w=()=>{c.value=!0,a.$get("settings/payment-methods/connect/info",{method:_.routeName}).then($=>{$&&(c.value=!1,l.value=$.connect_config,g("onSettingsChange",$.settings),s.value=$.live_account,i.value=$.test_account,s.value.error&&(p.value=s.value),i.value.error&&(p.value=i.value),c.value=!1)}).catch($=>{c.value=!1,p.value=$}).finally(()=>{c.value=!1})},k=$=>{const S=$.target;if(S.classList.contains("fct-install-addon-btn")||S.closest(".fct-install-addon-btn")){$.preventDefault(),$.stopPropagation();const I=S.classList.contains("fct-install-addon-btn")?S:S.closest(".fct-install-addon-btn"),Q=I.getAttribute("data-addon-slug"),D=I.getAttribute("data-addon-file"),V=I.getAttribute("data-source-type"),U=I.getAttribute("data-source-link"),O=I.getAttribute("data-repo-link");Q&&D&&O&&x({slug:Q,source_type:V||"github",source_link:U||"",repo_link:O||""});return}if(S.classList.contains("fct-activate-addon-btn")||S.closest(".fct-activate-addon-btn")){$.preventDefault(),$.stopPropagation();const Q=(S.classList.contains("fct-activate-addon-btn")?S:S.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");Q&&F({file:Q})}},b=je.get("app_config.isProActive"),x=$=>{if(!b){window.open($.repo_link,"_blank","noopener,noreferrer");return}const S=document.querySelector(`[data-addon-slug="${$.slug}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+u("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:$.slug,source_type:$.source_type,source_link:$.source_link}).then(I=>{Y.success({message:I.message||u("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(I=>{Y.error({message:(I==null?void 0:I.message)||u("Failed to install addon")}),S&&(S.disabled=!1,S.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 S=document.querySelector(`[data-addon-file="${$.file}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+u("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:$.file}).then(I=>{Y.success({message:I.message||u("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(I=>{Y.error({message:(I==null?void 0:I.message)||u("Failed to activate addon")}),S&&(S.disabled=!1,S.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"))})},M=$=>$?Array.isArray($)?$:$[v.value]??[]:[];return Ie(()=>{w(),document.addEventListener("click",k)}),Bt(()=>{document.removeEventListener("click",k)}),($,S)=>{const I=C("el-skeleton-item"),Q=C("el-skeleton"),D=C("el-icon"),V=C("el-tooltip"),U=C("el-switch"),O=C("el-checkbox"),R=C("el-option"),P=C("el-select"),j=C("el-radio"),q=C("el-radio-group"),z=C("el-input"),X=C("el-input-number"),ne=C("el-checkbox-group"),he=C("el-tag");return r(),h("div",{class:re([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(H,null,ae(e.fields,(N,G)=>{var Z,W,ie,ye,fe,ge;return r(),h("div",{class:"fct-setting-row fct-row",key:G},[N.type==="notice"?(r(),h("div",O4,[o("p",{innerHTML:N.value},null,8,H4)])):B("",!0),N.type==="upcoming"?(r(),h("div",P4,[o("h1",N4,f(A(u)("Upcoming")),1)])):B("",!0),N.type==="provider"?(r(),h("div",K4,[N.value=="connect"?(r(),h(H,{key:0},[e.settings.payment_mode=="test"?(r(),h(H,{key:0},[n(Q,{loading:c.value,animated:""},{template:d(()=>[n(I,{variant:"h3",class:"w-[150px] mb-3"}),n(I,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),c.value?B("",!0):(r(),E(zu,{key:0,onReload_settings:S[0]||(S[0]=se=>w()),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(Q,{loading:c.value,animated:""},{template:d(()=>[o("div",G4,[n(I,{variant:"h3",class:"w-9 h-9 mb-7 mx-auto rounded"}),n(I,{variant:"h3",class:"w-[200px] mx-auto mb-3"}),n(I,{variant:"h3",class:"w-[120px] h-7.5 mx-auto"})])]),_:1},8,["loading"]),c.value?B("",!0):(r(),E(zu,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:S[1]||(S[1]=se=>w()),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",j4,f((Z=p.value)==null?void 0:Z.error),1)],64)):(r(),h("div",z4,[y.value?(r(),h("div",q4,[o("div",null,[n(GC,{title:A(u)("Your API setup is Up & Running 🎉")},{default:d(()=>[o("div",Y4,[o("div",null,[o("b",null,f(A(u)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),h("div",W4,[o("div",null,[o("b",null,f(A(u)("Payment API settings is not enabled by API keys / Connect")),1),S[3]||(S[3]=o("br",null,null,-1)),o("p",null,f(A(u)("You can Set Up API keys defined as constant, Or use connect.")),1),o("p",X4,f((W=p.value)==null?void 0:W.error),1)])]))]))])):B("",!0),N.type==="enable"?(r(),h("div",J4,[o("p",Z4,[L(f(N.label)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,ex)]),default:d(()=>[n(D,null,{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),n(U,{modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=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"]),N.description?(r(),h("p",tx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="checkbox"?(r(),h("div",ax,[n(O,{"true-value":"yes","false-value":"no",modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,disabled:N.disabled},{default:d(()=>[L(f(N.label)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,lx)]),default:d(()=>[n(D,{class:"text-gray-500"},{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),N.description?(r(),h("p",sx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="select"?(r(),h("div",nx,[o("p",ox,[L(f(N.label)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,ix)]),default:d(()=>[n(D,{class:"text-gray-500"},{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),n(P,{placeholder:N.placeholder,modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,filterable:N.filterable!==!1},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(se,pe)=>(r(),E(R,{label:se.label,value:se.value,key:pe},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),N.description?(r(),h("p",rx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="radio"?(r(),h("div",dx,[o("p",ux,[L(f(N.label)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,cx)]),default:d(()=>[n(D,{class:"text-gray-500"},{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),n(q,{modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,class:re({"fct-payment-setting-radio-box":typeof Object.values(N.options)[0]=="object"})},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(se,pe)=>(r(),h(H,{key:pe},[typeof se=="object"?(r(),E(j,{key:0,value:pe},{default:d(()=>[o("div",Ax,[o("img",{src:se.icon,alt:""},null,8,px)]),o("div",null,[o("span",fx,f(se.label),1),o("span",mx,f(se.text),1)])]),_:2},1032,["value"])):(r(),E(j,{key:1,value:pe},{default:d(()=>[L(f(se),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),N.description?(r(),h("p",hx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="webhook_info"&&((ie=e.settings)==null?void 0:ie.payment_mode)===N.mode?(r(),h("div",_x,[e.routeName==="paypal"&&!y.value?(r(),h("div",vx,[n(R4,{testConnect:i.value,liveConnect:s.value,webhook_info:N.info,onReload_settings:S[2]||(S[2]=se=>w()),mode:N==null?void 0:N.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):N.info?(r(),h("div",{key:1,innerHTML:N.info},null,8,gx)):B("",!0)])):B("",!0),N.type==="input"||N.type==="password"?(r(),h("div",yx,[o("p",bx,f(N.label),1),n(z,{type:N.type,placeholder:N.placeholder,modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,maxlength:N.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),N.description?(r(),h("p",wx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="email"?(r(),h("div",Cx,[o("p",kx,f(N.label),1),n(z,{type:"email",placeholder:N.placeholder,modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se},null,8,["placeholder","modelValue","onUpdate:modelValue"]),N.description?(r(),h("p",Bx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="number"?(r(),h("div",xx,[o("p",Sx,f(N.label),1),n(X,{placeholder:N.placeholder,modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,max:N.max,min:N.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),N.description?(r(),h("p",Fx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="text"?(r(),h("div",$x,[o("p",Ex,[L(f(N.label)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,Ux)]),default:d(()=>[n(D,{class:"text-gray-500"},{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),n(z,{type:"text",placeholder:N.placeholder,modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,disabled:N.disabled,maxlength:N.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),N.description?(r(),h("p",Ix,f(N.description),1)):B("",!0)])):B("",!0),N.type==="color"?(r(),h("div",Qx,[o("p",Dx,[L(f(N.label)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,Vx)]),default:d(()=>[n(D,{class:"text-gray-500"},{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),n(hd,{modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,field:N},null,8,["modelValue","onUpdate:modelValue","field"]),N.description?(r(),h("p",Tx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="file"?(r(),h("div",Mx,[o("p",Lx,[L(f(N.label)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,Rx)]),default:d(()=>[n(D,{class:"text-gray-500"},{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),n(hi,{modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se,icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),N.description?(r(),h("p",Ox,f(N.description),1)):B("",!0)])):B("",!0),N.type==="checkbox_group"?(r(),h("div",Hx,[o("p",Px,[L(f(N.title)+" ",1),N.tooltip?(r(),E(V,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",null,f(N.tooltip),1)]),default:d(()=>[n(D,{class:"text-gray-500"},{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),n(ne,{modelValue:e.settings[G],"onUpdate:modelValue":se=>e.settings[G]=se},{default:d(()=>[(r(!0),h(H,null,ae(N.options,(se,pe)=>(r(),E(O,{label:pe,key:pe},{default:d(()=>[L(f(se),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.description?(r(),h("p",Nx,f(N.description),1)):B("",!0)])):B("",!0),N.type==="html_attr"?(r(),h("div",Kx,[typeof N.value=="string"?(r(),h("div",{key:0,innerHTML:N.value},null,8,Gx)):typeof N.value=="object"&&N.value!==null?(r(),h("div",jx,[N.value.title?(r(),h("p",zx,f(N.value.title),1)):B("",!0),N.value.webhook_url?(r(),h("code",qx,f(N.value.webhook_url),1)):B("",!0),N.value.description?(r(),h("p",Yx,f(N.value.description),1)):B("",!0),N.value.steps?(r(),h(H,{key:3},[N.value.steps.title?(r(),h("p",Wx,f(N.value.steps.title),1)):B("",!0),o("ul",Xx,[(r(!0),h(H,null,ae(M(N.value.steps.list),(se,pe)=>(r(),h("li",{key:pe},[o("span",Jx,f(pe+1),1),o("span",{innerHTML:se},null,8,Zx)]))),128))])],64)):B("",!0),N.value.events?(r(),h("div",e3,[o("p",t3,f(N.value.events.title),1),o("ul",a3,[(r(!0),h(H,null,ae(M(N.value.events.list),(se,pe)=>(r(),h("li",{key:pe},[o("code",l3,f(se),1)]))),128))])])):B("",!0),N.value.webhook_notice?(r(),h("div",s3,[o("h4",n3,f(N.value.webhook_notice.title),1),o("div",o3,f(N.value.webhook_notice.description),1),N.value.webhook_notice.list&&N.value.webhook_notice.list.length?(r(),h("ul",i3,[(r(!0),h(H,null,ae(N.value.webhook_notice.list,(se,pe)=>(r(),h("li",{key:pe},f(se),1))),128))])):B("",!0)])):B("",!0)])):B("",!0)])):B("",!0),N.type==="active_methods"?(r(),h("div",r3,[(ye=N.value)!=null&&ye.activated_methods?(r(),h("div",d3,[e.settings.payment_mode==="live"&&G==="live_active_methods"?(r(),h("div",u3,[o("p",c3,f(N.label),1),L(" "+f($.active_methods)+" ",1),o("ul",A3,[(r(!0),h(H,null,ae(N.value.activated_methods,(se,pe)=>(r(),E(he,{key:pe},{default:d(()=>[L(f(se!=null&&se.name?se.name:se),1)]),_:2},1024))),128))]),o("p",null,[L(f(A(u)("You can configure methods "))+" ",1),o("a",{href:(fe=N.value)==null?void 0:fe.configure_url,target:"_blank"},f(A(u)("here")),9,p3)])])):B("",!0),e.settings.payment_mode==="test"&&G==="test_active_methods"?(r(),h("div",f3,[o("p",m3,f(N.label),1),o("ul",h3,[L(f($.active_methods)+" ",1),(r(!0),h(H,null,ae(N.value.activated_methods,(se,pe)=>(r(),E(he,{key:pe},{default:d(()=>[L(f(se!=null&&se.name?se.name:se),1)]),_:2},1024))),128))]),o("p",null,[L(f(A(u)("You can configure methods "))+" ",1),o("a",{href:(ge=N.value)==null?void 0:ge.configure_url,target:"_blank"},f(A(u)("here")),9,_3)])])):B("",!0)])):B("",!0)])):B("",!0),N.type==="tabs"?(r(),h("div",v3,[n(F4,{fields:e.fields,settings:e.settings,index:G,tabs:e.fields[G]},null,8,["fields","settings","index","tabs"])])):B("",!0),N.type==="radio-select-dependants"?(r(),h("div",g3,[n(I4,{fields:e.fields,settings:e.settings,index:G},null,8,["fields","settings","index"])])):B("",!0)])}),128))],2)}}},y3={class:"setting-wrap"},b3={class:"setting-wrap-inner"},w3={class:"mb-5 flex items-center justify-between"},C3={class:"setting-switcher flex items-center gap-3"},k3={class:"setting-save-action"},B3={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,Js("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return cs.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,sr(((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,Js("Settings updated!")}).catch(e=>{var t;this.saving=!1,sr(((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,m;this.route_name=this.$route.name,this.methodName=(e=this.$route)==null?void 0:e.name,(a=(t=this.$route)==null?void 0:t.meta)!=null&&a.admin_title?this.methodTitle=(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=(m=(p=this.$route)==null?void 0:p.meta)==null?void 0:m.label,this.fetchRoute=`settings/payments/${this.$route.name}`},getPageName(){let e="";return this.$route.meta.title?e=this.$route.meta.title+" Settings":e=this.$route.name.charAt(0).toUpperCase()+this.$route.name.slice(1).toLowerCase()+" Settings",e}}},x3=Object.assign(B3,{setup(e){const t=qt().ctx;return fs().onSave(()=>{t.saveSettings()}),(l,s)=>{const i=C("el-breadcrumb-item"),c=C("el-breadcrumb"),p=C("el-switch"),m=C("Edit"),_=C("el-icon"),g=C("el-skeleton"),y=C("el-button");return r(),h("div",y3,[o("div",b3,[o("div",w3,[n(c,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(i,{to:{path:"/settings/payments"}},{default:d(()=>[L(f(l.$t("Payment Settings")),1)]),_:1}),n(i,null,{default:d(()=>[o("span",null,f(l.methodTitle),1)]),_:1})]),_:1},8,["separator-icon"]),o("div",C3,[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(xe,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(m)]),_: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(yd,{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",k3,[n(y,{onClick:s[1]||(s[1]=v=>l.saveSettings()),type:"primary",loading:l.saving},{default:d(()=>[L(f(l.$t("Save Settings")),1)]),_:1},8,["loading"])])])])}}}),S3={class:"setting-wrap"},F3={class:"setting-wrap-inner"},$3={class:"setting-save-action"},E3={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,Js("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,sr("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)}}},U3=Object.assign(E3,{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"),m=C("el-input"),_=C("el-form-item"),g=C("el-form");return r(),h("div",S3,[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(()=>[L(f(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))},f(t.$route.params.method),1)]),_:1}),n(l,null,{default:d(()=>[o("span",null,f(t.$t("Checkout Customization")),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["onOnSave","loading","save-button-text","loading-text"]),o("div",F3,[n(xe,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(Lf))]),_:1},8,["onClick"]),L(" "+f(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(m,{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(hi,{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(pa,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),n(Wl,{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(pa,{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(Wl,{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",$3,[n(c,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:d(()=>[L(f(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),I3={class:"fct-integration-setting-content"},Q3={class:"fct-integration-setting-head"},D3={class:"flex items-center gap-3 mb-2"},V3=["src"],T3={class:"title"},M3=["innerHTML"],L3={key:0,class:"integration_success_state"},R3=["innerHTML"],O3={key:1,class:"fct-integration-setting-body"},H3={class:"fct-integration-setting-body-inner"},P3=["innerHTML"],N3=["innerHTML"],K3=["target","href"],G3={key:0},j3={key:0,class:"fct-integration-setting-body-footer"},z3={key:2},q3={name:"GeneralIntegration",components:{InfoFilled:tl,Setting:Lc},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)})}}},Y3=Object.assign(q3,{setup(e){const t=qt().ctx;return fs().onSave(()=>{t.integration.status||t.save()}),(l,s)=>{const i=C("el-button"),c=C("el-icon"),p=C("el-tooltip"),m=C("el-option"),_=C("el-select"),g=C("el-input"),y=C("el-form-item"),v=C("el-form"),w=Ma("loading");return r(),h("div",I3,[o("div",Q3,[o("div",D3,[l.settings.logo?(r(),h("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,V3)):B("",!0),o("h3",T3,f(l.settings.menu_title),1)]),o("p",{class:"desc",innerHTML:l.settings.menu_description},null,8,M3)]),l.settings.hide_on_valid&&l.integration.status?(r(),h("div",L3,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,R3),o("div",null,[n(i,{onClick:s[0]||(s[0]=k=>l.disconnect(l.settings.discard_settings.data)),type:"danger",plain:""},{default:d(()=>[L(f(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(()=>[L(f(l.settings.discard_settings.verify_button_text),1)]),_:1})):B("",!0)])])):Gt((r(),h("div",O3,[o("div",H3,[l.settings.config_instruction&&!l.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,P3)):B("",!0),n(v,{"label-width":"205px","label-position":"top"},{default:d(()=>[(r(!0),h(H,null,ae(l.settings.fields,(k,b)=>(r(),E(y,{key:b},{label:d(()=>[L(f(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,N3)]),default:d(()=>[n(c,null,{default:d(()=>[n(A(tl))]),_:1})]),_:2},1024)):B("",!0)]),default:d(()=>[k.type=="authenticate-button"?(r(),E(i,{key:0,onClick:x=>l.authenticate(k.end_point,k.params)},{default:d(()=>[L(f(k.button_text),1)]),_:2},1032,["onClick"])):k.type=="select"?(r(),E(_,{key:1,modelValue:l.integration[b],"onUpdate:modelValue":x=>l.integration[b]=x},{default:d(()=>[(r(!0),h(H,null,ae(k.options,(x,F)=>(r(),E(m,{key:F,label:x,value:F},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):k.type=="link"?(r(),h(H,{key:2},[o("a",{target:k.target,class:re(k.btn_class),href:k.link},f(k.link_text),11,K3),o("p",null,f(k.tips),1)],64)):(r(),h(H,{key:3},[n(g,{placeholder:k.placeholder,type:k.type,modelValue:l.integration[b],"onUpdate:modelValue":x=>l.integration[b]=x},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),k.tips?(r(),h("p",G3,f(k.tips),1)):B("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?B("",!0):(r(),h("div",j3,[n(i,{type:"primary",onClick:l.save},{default:d(()=>[L(f(l.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[w,l.loading]]),l.error_message?(r(),h("p",z3,f(l.error_message),1)):B("",!0)])}}}),W3={class:"fct-integration-setting-container fct-layout-width"},X3={class:"single-page-header"},J3={class:"single-page-body"},Z3={class:"fct-integration-setting-wrap"},eS={name:"IntegrationEditor"},tS=Object.assign(eS,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb");return r(),h("div",W3,[o("div",X3,[n(s,{"separator-icon":A(dl)},{default:d(()=>[n(l,{to:{name:"integrations"}},{default:d(()=>[L(f(t.$t("Integrations")),1)]),_:1}),n(l,null,{default:d(()=>[L(f(A(da).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),o("div",J3,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",Z3,[n(Y3,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),aS={class:"fct-form-group"},lS={for:"store-country"},sS={class:"fct-form-group"},nS={class:"fct-form-group"},oS={class:"fct-form-group"},iS={__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=T({store_name:"",store_logo:"",store_country:"",currency:""});be(()=>l.savedFormData??l.initialSettings,m=>{m&&(i.value.store_name=m.store_name??"",i.value.store_logo=m.store_logo??"",i.value.store_country=m.store_country??"",i.value.currency=m.currency??"")},{immediate:!0});const c=m=>{s("storeCountryChanged",m),m&&ue.post("settings/store",{store_country:m,store_name:i.value.store_name,settings_name:"store_setup"}).catch(()=>{})};return t({onNextStep:async()=>{const m=Array.isArray(i.value.store_logo)&&i.value.store_logo.length>0?i.value.store_logo[0]:i.value.store_logo;try{await ue.post("onboarding/",{store_name:i.value.store_name,store_logo:m,store_country:i.value.store_country,currency:i.value.currency})}catch{Y.warning(u("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...i.value})}),(m,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-input");return r(),h(H,null,[o("div",aS,[o("label",lS,f(A(u)("Store Country")),1),n(y,{modelValue:i.value.store_country,"onUpdate:modelValue":_[0]||(_[0]=w=>i.value.store_country=w),placeholder:A(u)("Store Country"),onChange:c,filterable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,(w,k)=>(r(),E(g,{key:k,label:w.name,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",sS,[o("label",null,f(A(u)("Shop Name")),1),n(v,{modelValue:i.value.store_name,"onUpdate:modelValue":_[1]||(_[1]=w=>i.value.store_name=w)},null,8,["modelValue"])]),o("div",nS,[o("label",null,f(A(u)("Store Currency")),1),n(y,{modelValue:i.value.currency,"onUpdate:modelValue":_[2]||(_[2]=w=>i.value.currency=w),filterable:"",placeholder:A(u)("Select")},{default:d(()=>[(r(!0),h(H,null,ae(e.currencies,(w,k)=>(r(),E(g,{key:k,label:w.label,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",oS,[o("label",null,f(A(u)("Shop Image/Logo")),1),n(hi,{modelValue:i.value.store_logo,"onUpdate:modelValue":_[3]||(_[3]=w=>i.value.store_logo=w),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"],rS=[...bd,"GB","AU","NZ","CA","IN"],dS=[...bd,"GB","AU","NZ"],uS={class:"fct-tax-step"},cS={class:"fct-tax-step-toggle-row"},AS={class:"fct-tax-step-toggle-row__label"},pS={class:"fct-alert-content"},fS={class:"fct-alert-text"},mS={class:"fct-form-group"},hS={key:0,class:"fct-tax-step-country-chip"},_S={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},vS={class:"fct-form-group"},gS={class:"fct-tax-step-radio-group",role:"radiogroup"},yS=["aria-checked"],bS={class:"fct-tax-step-radio-card__label"},wS={class:"fct-tax-step-radio-card__desc"},CS=["aria-checked"],kS={class:"fct-tax-step-radio-card__label"},BS={class:"fct-tax-step-radio-card__desc"},xS={key:0,class:"fct-form-group"},SS={class:"fct-tax-step-radio-group",role:"radiogroup"},FS=["aria-checked"],$S={class:"fct-tax-step-radio-card__label"},ES={class:"fct-tax-step-radio-card__desc"},US=["aria-checked"],IS={class:"fct-tax-step-radio-card__label"},QS={class:"fct-tax-step-radio-card__desc"},DS=["aria-checked"],VS={class:"fct-tax-step-radio-card__label"},TS={class:"fct-tax-step-radio-card__desc"},MS={class:"fct-form-group"},LS={class:"fct-tax-step-optional"},RS={class:"fct-form-help-text"},OS={class:"fct-alert-content"},HS={class:"fct-alert-text"},PS={__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=T({collectTaxes:!1,taxInclusion:"excluded",euMethod:"oss",vatNumber:""}),s=K(()=>bd.includes(a.storeCountry)),i=y=>{l.value={...l.value,...y}},c=K(()=>{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=K(()=>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.")),m=y=>{l.value={collectTaxes:rS.includes(y),taxInclusion:dS.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};be(()=>a.storeCountry,m),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||""}:m(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{Y.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 w=C("el-switch"),k=C("el-input");return r(),h("div",uS,[o("div",cS,[o("span",AS,f(A(u)("Collect taxes for my store")),1),n(w,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=b=>i({collectTaxes:b}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),h(H,{key:1},[o("div",mS,[o("label",null,f(A(u)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),h("span",hS,[n(J,{name:"Globe"}),L(" "+f(e.countryName||e.storeCountry),1)])):(r(),h("span",_S,f(A(u)("Not set")),1))])]),e.storeCountry?(r(),h(H,{key:0},[o("div",vS,[o("label",null,f(A(u)("How do you display your prices?")),1),o("div",gS,[o("div",{class:re(["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]=b=>i({taxInclusion:"included"})),onKeydown:v[2]||(v[2]=b=>g(b,{taxInclusion:"included"}))},[o("span",{class:re(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="included"}])},null,2),o("div",null,[o("div",bS,f(A(u)("Prices include tax")),1),o("div",wS,f(A(u)("Tax is already factored into your listed price.")),1)])],42,yS),o("div",{class:re(["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]=b=>i({taxInclusion:"excluded"})),onKeydown:v[4]||(v[4]=b=>g(b,{taxInclusion:"excluded"}))},[o("span",{class:re(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="excluded"}])},null,2),o("div",null,[o("div",kS,f(A(u)("Add tax at checkout")),1),o("div",BS,f(A(u)("Tax is shown separately and added to the subtotal.")),1)])],42,CS)])]),s.value?(r(),h("div",xS,[o("label",null,f(A(u)("Cross-border compliance")),1),o("div",SS,[o("div",{class:re(["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]=b=>i({euMethod:"oss",vatNumber:""})),onKeydown:v[6]||(v[6]=b=>g(b,{euMethod:"oss",vatNumber:""}))},[o("span",{class:re(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="oss"}])},null,2),o("div",null,[o("div",$S,f(A(u)("OSS (One Stop Shop)")),1),o("div",ES,f(A(u)("Charge each EU customer their country's VAT rate.")),1)])],42,FS),o("div",{class:re(["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]=b=>i({euMethod:"home",vatNumber:""})),onKeydown:v[8]||(v[8]=b=>g(b,{euMethod:"home",vatNumber:""}))},[o("span",{class:re(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="home"}])},null,2),o("div",null,[o("div",IS,f(A(u)("Home Country Only")),1),o("div",QS,f(A(u)("Charge all EU customers your home country's rate.")),1)])],42,US),o("div",{class:re(["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]=b=>i({euMethod:"specific",vatNumber:""})),onKeydown:v[10]||(v[10]=b=>g(b,{euMethod:"specific",vatNumber:""}))},[o("span",{class:re(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="specific"}])},null,2),o("div",null,[o("div",VS,f(A(u)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",TS,f(A(u)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,DS)])])):B("",!0),o("div",MS,[o("label",null,[L(f(c.value)+" ",1),o("span",LS,f(A(u)("(optional)")),1)]),n(k,{"model-value":l.value.vatNumber,"onUpdate:modelValue":v[11]||(v[11]=b=>i({vatNumber:b})),placeholder:s.value?"DE123456789":""},null,8,["model-value","placeholder"]),o("p",RS,f(A(u)("Your registration number, printed on invoices")),1)]),n(Ja,{icon:"Info"},{content:d(()=>[o("div",OS,[o("p",HS,f(p.value),1)])]),_:1})],64)):B("",!0)],64)):(r(),E(Ja,{key:0},{content:d(()=>[o("div",pS,[o("p",fS,f(A(u)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},NS={class:"dialog-footer"},KS={__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=T(!1),i=T(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,Y.success(u("The page created successfully."))}).catch(p=>{if(p&&p.hasOwnProperty("page_name")){const m=Object.entries(p.page_name).length;let _="",g=0;for(const y in p.page_name)_+=p.page_name[y],g!==m&&(_+=`
152 `),g++;Y.error(_)}else Y.error(u("Sorry, Unable To Create Page!!"))})};return(p,m)=>{const _=C("el-input"),g=C("el-form-item"),y=C("el-form"),v=C("el-button"),w=C("el-dialog");return r(),h(H,null,[n(Ze,{onClick:m[0]||(m[0]=Ne(k=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:d(()=>[n(J,{name:"Plus"})]),_:1}),n(w,{modelValue:s.value,"onUpdate:modelValue":m[3]||(m[3]=k=>s.value=k),title:A(u)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:d(()=>[o("div",NS,[n(v,{onClick:m[2]||(m[2]=k=>s.value=!1),type:"info",soft:""},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(v,{type:"primary",onClick:c},{default:d(()=>[L(f(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":m[1]||(m[1]=k=>i.value=k),placeholder:A(u)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},GS={class:"fct-form-group"},jS={class:"fct-form-group-inner"},zS={class:"input-prepend"},qS={class:"input-append"},YS={__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=Sl(e,"modelValue",{get:c=>c?typeof c=="string"?Number(c):c:""}),l=t,s=T(!1),i=c=>{s.value=c};return(c,p)=>{const m=C("el-option"),_=C("el-select");return r(),h("div",GS,[o("label",null,f(e.title),1),o("div",jS,[o("div",{class:re(["fct-input-group w-full",{focused:s.value}])},[o("div",zS,[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(m,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",qS,[n(KS,{title:e.title,onOnPageCreated:p[3]||(p[3]=g=>l("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},WS={__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=T(Object.fromEntries(l.map(v=>[v,""])));be(()=>a.initialSettings,v=>{if(a.savedFormData){l.forEach(w=>{i.value[w]=a.savedFormData[w]??""});return}v&&l.forEach(w=>{i.value[w]=v[w]??""})},{immediate:!0});const c=T(!1),p=T(!1),m=()=>{p.value=!0,ue.post("onboarding/create-pages",{}).then(v=>{l.forEach(w=>{var k;i.value[w]=String(((k=v.default_settings)==null?void 0:k[w])??"")}),c.value=!0,a.onPagesUpdated(v.pages)}).finally(()=>{p.value=!1})},_=(v,w)=>{i.value[w]=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:m,pageGenerated:c,generating:p}),(v,w)=>(r(),h(H,null,ae(l,k=>o("div",{key:k,class:"fct-form-group"},[n(YS,{title:s[k](),pages:e.pages,modelId:k,modelValue:i.value[k],"onUpdate:modelValue":b=>i.value[k]=b,onOnPageCreated:_},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))}},XS={class:"fct-form-group"},JS={class:"label"},ZS={class:"marker"},eF={class:"label"},tF={class:"marker"},aF={__name:"OnboardingProductsStep",props:{dummyProductInfo:{type:Object,default:()=>({})}},setup(e,{expose:t}){const a=e,l=T("start-from-scratch"),s=(p=0)=>{if(!l.value||l.value==="start-from-scratch")return;const m=a.dummyProductInfo[l.value];!m||p>m.count-1||ue.post("products/create-dummy",{category:m.category,index:p}).then(()=>{s(p+1)}).catch(_=>{_.status_code!==400&&s(p+1)})},i=()=>{let p=je.get("dashboard_url");l.value&&l.value!=="start-from-scratch"&&(p=en.appendToVueUrl(p,{import_product:l.value})),window.location.href=p};return t({onNextStep:async()=>{s();try{await ue.post("onboarding/",{category:l.value})}catch{}return setTimeout(i,300),!1}}),(p,m)=>{const _=C("el-icon"),g=C("el-radio-button"),y=C("el-radio-group");return r(),h("div",XS,[n(y,{class:"fct-import-onboarding-products",modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=v=>l.value=v),size:"large"},{default:d(()=>[n(g,{value:"start-from-scratch"},{default:d(()=>[n(J,{name:"Scratch"}),o("span",JS,[L(f(A(u)("Start"))+" ",1),m[1]||(m[1]=o("br",null,null,-1)),L(" "+f(A(u)("From scratch")),1)]),o("span",ZS,[n(_,null,{default:d(()=>[n(A(Bo))]),_:1})])]),_:1}),(r(!0),h(H,null,ae(e.dummyProductInfo,(v,w)=>(r(),E(g,{key:w,value:w},{default:d(()=>[n(J,{name:v.icon},null,8,["name"]),o("span",eF,f(v.title),1),o("span",tF,[n(_,null,{default:d(()=>[n(A(Bo))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])}}},lF={class:"fct-onboarding-wrap"},sF={key:0,class:"fct-onboarding-card"},nF={class:"fct-onboarding-card-body"},oF={class:"fct-onboarding-content-box"},iF={class:"fct-onboarding-card-head"},rF={class:"fct-onboarding-card-head-top"},dF=["src","alt"],uF={class:"fct-onboarding-steps-count"},cF={class:"fct-onboarding-card-head-content"},AF={class:"flex-1"},pF={class:"fct-onboarding-card-title"},fF={class:"fct-onboarding-card-text"},mF={key:0,class:"fct-onboarding-card-head-action"},hF={class:"fct-onboarding-content-box-inner"},_F={key:0,class:"fct-onboarding-load-error"},vF={key:1,class:"fct-onboarding-form-wrap active"},gF={class:"fct-onboarding-form-body"},yF={key:0,class:"fct-onboarding-bottom"},bF={class:"fct-onboarding-bottom-left"},wF={class:"fct-onboarding-bottom-right"},CF={key:0,class:"cmd"},kF={__name:"Onboarding",setup(e){const t=T(!1),a=T([]),l=T({}),s=T([]),i=T([]),c=T(null),p=T(null),m=T(null),_=T(null),g=T(null),y=T(""),v=K(()=>{if(!y.value)return"";const N=s.value.find(G=>G.value===y.value);return N?N.name:y.value}),w=[{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:iS,props:()=>({savedFormData:m.value,initialSettings:c.value,countries:s.value,currencies:l.value,onStoreCountryChanged:N=>{y.value=N}})},{key:"tax",title:()=>u("Set Up Tax Collection"),text:()=>u("Configure tax rates so checkout calculates correctly."),component:PS,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:WS,props:()=>({pages:a.value,initialSettings:c.value,savedFormData:g.value,onPagesUpdated:N=>{a.value=N}})},{key:"products",title:()=>u("Setup Your Products"),text:()=>u("Add your first products and start building your business catalog."),component:aF,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],k=w.length+1,b=T(1),x=K(()=>w[b.value-1]),F=K(()=>{var N;return((N=x.value)==null?void 0:N.title())??""}),M=K(()=>{var N;return((N=x.value)==null?void 0:N.text())??""}),$=T(null),S=T(!1),I=()=>{b.value++},Q=()=>{var G,Z;const N=(Z=(G=$.value)==null?void 0:G.getFormData)==null?void 0:Z.call(G);N&&(x.value.key==="store-info"?m.value=N:x.value.key==="tax"?_.value=N:x.value.key==="pages"&&(g.value=N))},D=async()=>{var N,G;if(!S.value){S.value=!0;try{Q(),await((G=(N=$.value)==null?void 0:N.onNextStep)==null?void 0:G.call(N))!==!1&&I()}finally{S.value=!1}}},V=()=>{var N,G;Q(),(G=(N=$.value)==null?void 0:N.onPreviousStep)==null||G.call(N),b.value>1&&b.value--},U=()=>{I()},O=()=>{var N,G;(G=(N=$.value)==null?void 0:N.onSkipAll)==null||G.call(N),window.location.href=je.get("dashboard_url")};fs().onSave(()=>{var N;(N=x.value)!=null&&N.isFinal&&D()});const P=T(!1),j=()=>{t.value=!0,P.value=!1,ue.get("onboarding/").then(N=>{var G;a.value=N.pages,l.value=N.currencies,c.value=N.default_settings,y.value=((G=N.default_settings)==null?void 0:G.store_country)??"",p.value=N.tax_settings??null}).catch(()=>{P.value=!0}).finally(()=>{t.value=!1})},q=()=>{ue.get("address-info/countries").then(N=>{s.value=N.data})},z=cs.getUrl("images/logo/logo-full-dark.svg"),X=cs.getUrl("images/logo/logo-full.svg"),ne=T(je.get("asset_url")+"/images/logo/logo-full-dark.svg"),he=()=>{ne.value=Ve.isDark()?X:z};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",he),i.value=je.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),ne.value=Ve.isDark()?X:z,j(),q()}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",he),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(N,G)=>{const Z=C("el-progress"),W=C("el-button"),ie=Ma("loading");return r(),h(H,null,[o("div",lF,[b.value<k?(r(),h("div",sF,[Gt((r(),h("div",nF,[o("div",oF,[o("div",iF,[o("div",rF,[o("img",{src:ne.value,alt:A(u)("Fluent Cart")},null,8,dF),o("div",uF,f(A(u)("Step %1$s of %2$s",b.value,w.length)),1),n(Z,{percentage:b.value/w.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("div",cF,[o("div",AF,[o("h2",pF,f(F.value),1),o("p",fF,f(M.value),1)]),x.value.key==="pages"&&$.value&&!$.value.pageGenerated?(r(),h("div",mF,[n(W,{onClick:G[0]||(G[0]=ye=>$.value.createAllPage()),loading:$.value.generating,size:"small"},{default:d(()=>[$.value.generating?B("",!0):(r(),E(J,{key:0,name:"MagicPen"})),L(" "+f(A(u)("Generate All Pages")),1)]),_:1},8,["loading"])])):B("",!0)])]),o("div",hF,[P.value?(r(),h("div",_F,[o("p",null,f(A(u)("Failed to load settings. Please refresh and try again.")),1),n(W,{onClick:j},{default:d(()=>[L(f(A(u)("Retry")),1)]),_:1})])):(r(),h("div",vF,[o("div",gF,[(r(),E(Cl(x.value.component),ya({key:x.value.key,ref_key:"stepRef",ref:$},x.value.props()),null,16))])]))])])])),[[ie,t.value]])])):B("",!0)]),b.value<k?(r(),h("div",yF,[o("div",bF,[b.value>1?(r(),E(W,{key:0,text:"",onClick:O},{default:d(()=>[L(f(A(u)("Skip All")),1)]),_:1})):B("",!0)]),o("div",wF,[n(W,{onClick:V,type:"info",plain:"",disabled:b.value===1},{default:d(()=>[L(f(A(u)("Go Back")),1)]),_:1},8,["disabled"]),x.value.canSkip?(r(),E(W,{key:0,text:"",onClick:U,disabled:S.value},{default:d(()=>[L(f(A(u)("Skip for now")),1)]),_:1},8,["disabled"])):B("",!0),x.value.isFinal?(r(),E(W,{key:2,type:"primary",loading:S.value,onClick:D},{default:d(()=>[S.value?B("",!0):(r(),h("span",CF,"⌘s")),L(" "+f(S.value?A(u)("Saving"):A(u)("Save")),1)]),_:1},8,["loading"])):(r(),E(W,{key:1,type:"primary",loading:S.value,disabled:P.value,onClick:D},{default:d(()=>[L(f(A(u)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):B("",!0)],64)}}},BF={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",BF,[n(l)])}}}),SF={class:"setting-wrap"},FF={class:"setting-wrap-inner"},$F={key:0,class:"payment-method-list fct-content-card-list"},EF={class:"flex items-start gap-3"},UF=["title"],IF=["onClick"],QF=["src","alt"],DF=["src","alt"],VF={key:1,class:"fct_payment_method_tag"},TF={class:"fct-content-card-list-content"},MF={class:"fct-content-card-list-action"},LF={key:0},RF=["src"],OF={__name:"PaymentSettings",setup(e){const t=qt().ctx,a=T(!1),l=T([]),s=je.get("app_config.isProActive"),i=K(()=>({animation:200,ghostClass:"ghost"})),c=g=>{var y;return(g==null?void 0:g.upcoming)!=!0&&(!(g!=null&&g.requires_pro)||(g==null?void 0:g.requires_pro)&&s)&&((g==null?void 0:g.is_addon)!=!0||(g==null?void 0:g.is_addon)&&((y=g==null?void 0:g.addon_status)==null?void 0:y.is_installed))},p=g=>g===!0?"active":"inactive",m=()=>{a.value=!0,t.$get("settings/payment-methods/all",{}).then(g=>{l.value=g.gateways}).catch(g=>{}).finally(()=>{a.value=!1})},_=()=>{const g=l.value.map(y=>y.route);t.$post("settings/payment-methods/reorder",{order:g}).then(y=>{Y.success(y.message)}).catch(y=>{})};return Ie(()=>{m()}),(g,y)=>{const v=C("el-skeleton"),w=C("el-button");return r(),h("div",SF,[n(Qa,{heading:A(u)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",FF,[n(Da),n(xe,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",$F,[n(A(Zs),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:re(k!=null&&k.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",EF,[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,UF),o("div",{onClick:()=>{var b;!((b=k==null?void 0:k.addon_status)!=null&&b.is_installed)&&(k!=null&&k.addon_source)||g.$router.push({name:k.route})},class:"cursor-pointer grid gap-2 flex-1"},[o("div",{class:re(["fct-content-card-list-head",k.route])},[o("img",{src:k.logo,alt:k.admin_title||k.title,class:re(k.logo_light?"dark:hidden":"")},null,10,QF),k.logo_light?(r(),h("img",{key:0,src:k.logo_light,alt:k.admin_title||k.title,class:"hidden dark:block"},null,8,DF)):B("",!0),k!=null&&k.tag?(r(),h("span",VF,[n(fa,{size:"small",status:"info",text:k.tag},null,8,["text"])])):B("",!0),c(k)?(r(),E(fa,{key:2,size:"small",status:k.status?"active":"disabled","hide-icon":!0},{default:d(()=>[L(f(p(k.status)),1)]),_:2},1032,["status"])):B("",!0)],2),o("div",TF,[o("p",null,f(k.description),1)])],8,IF),o("div",MF,[k!=null&&k.upcoming?(r(),h("div",LF,f(A(u)("Coming Soon!")),1)):(r(),E(w,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:k.route})},{default:d(()=>{var b;return[L(f(A(u)("Manage"))+" ",1),k!=null&&k.requires_pro?(r(),h("img",{key:0,src:((b=g.appVars)==null?void 0:b.asset_url)+"images/crown.svg",alt:"pro feature",class:"pro-feature-icon"},null,8,RF)):B("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},HF={class:"role-form"},PF={class:"select-use-option"},NF={class:"select-label"},KF={key:0,class:"select-desc"},GF={class:"dialog-footer"},jF={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const l=T(!1),s=a,i=T(!1),c=T(null),p=T(null),m=T(!1),_=T(null),g=T(null),y=T({}),v=T(!1),w=S=>{if(!S){_.value=[];return}ue.get("roles/user-list",{search:S}).then(I=>{_.value=I.users.data}).finally(()=>{})},k=()=>{ue.get("roles").then(S=>{g.value=S.roles}).catch(S=>{if(S.message){Y.error(S.message);return}}).finally(()=>{})},b=()=>{y.value={},i.value=!0,ue.post("roles",{user_id:c.value,role_key:p.value}).then((S,I)=>{l.value=!1,Y.success(S.message),s("fetchRoles")}).catch(S=>{var I;(I=S.data)!=null&&I.message?Y.error(S.data.message):y.value=S.data}).finally(()=>{i.value=!1})},x=()=>{c.value=null,p.value=null,m.value=!1,y.value={},l.value=!1},F=T(""),M=K(()=>m.value?u("Edit %1$s's Role",F.value):u("Add Role"));return t({openModal:(S,I,Q,D=!1)=>{c.value=S,p.value=I,F.value=Q,l.value=!0,m.value=D,k()}}),(S,I)=>{const Q=C("el-option"),D=C("el-select"),V=C("el-form-item"),U=C("el-form"),O=C("el-button"),R=C("el-dialog");return r(),E(R,{title:M.value,modelValue:l.value,"onUpdate:modelValue":I[4]||(I[4]=P=>l.value=P),onClosed:x,"append-to-body":!0},{footer:d(()=>[o("span",GF,[n(O,{onClick:x},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(O,{type:"primary",onClick:b,loading:i.value,disabled:i.value},{default:d(()=>[L(f(m.value?A(u)("Update Role"):A(u)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[o("div",HF,[n(U,{"label-position":"top"},{default:d(()=>[m.value?B("",!0):(r(),E(V,{key:0,label:A(u)("Select User")},{default:d(()=>[n(D,{modelValue:c.value,"onUpdate:modelValue":I[0]||(I[0]=P=>c.value=P),remote:!0,"remote-method":w,loading:v.value,filterable:"",clearable:"",placeholder:A(u)("Type to search user"),class:"w-full",onChange:I[1]||(I[1]=()=>{delete y.value.user_id})},{default:d(()=>[(r(!0),h(H,null,ae(_.value,P=>(r(),E(Q,{key:P.ID,label:P.name,value:P.ID},{default:d(()=>[o("div",PF,[o("span",null,f(P.name),1),o("span",null,f(P.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(r(),E(oa,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])),n(V,{label:A(u)("Select Role")},{default:d(()=>[n(D,{onChange:I[2]||(I[2]=P=>{delete y.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":I[3]||(I[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,j)=>(r(),E(Q,{key:j,label:P.title,value:j},{default:d(()=>[o("div",NF,f(P.title),1),P.description?(r(),h("div",KF,f(P.description),1)):B("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),E(oa,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},zF=st(jF,[["__scopeId","data-v-b3e8599d"]]),qF={class:"setting-wrap"},YF={class:"setting-wrap-inner"},WF={key:0,class:"fct-setting-header-action"},XF={class:"fct-role-settings"},JF={class:"fct-customer-card"},ZF={class:"fct-customer-details"},e$={class:"fct-customer-name"},t$={class:"fct-customer-id"},a$={class:"fct-customer-email"},l$={class:"role-title flex items-center gap-1 capitalize"},s$={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},n$={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},o$={__name:"RoleSettings",setup(e){const t=T(!1),a=T([]),l=T(),s=T(!1),i=je.get("app_config.isProActive"),c=()=>{t.value=!0,ue.get("roles/managers").then(m=>{a.value=m.managers}).finally(()=>{t.value=!1})},p=m=>{s.value=!0,ue.delete("roles/"+m.shop_role,{user_id:m.id}).then(_=>{a.value=a.value.filter(g=>g.id!==m.id),Y.success(_.message)}).catch(_=>{if(_.message)return Y.error(_.message)}).finally(()=>{s.value=!1})};return Ie(()=>{i&&c()}),(m,_)=>{const g=C("el-button"),y=C("el-table-column"),v=C("el-popconfirm"),w=C("el-table"),k=Ma("loading");return r(),h("div",qF,[n(Qa,{heading:A(u)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",YF,[n(Da),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Existing Roles & Permissions")},{action:d(()=>[A(i)?(r(),h("div",WF,[n(g,{type:"primary",size:"small",onClick:_[0]||(_[0]=()=>{var b;(b=l.value)==null||b.openModal()})},{default:d(()=>[L(f(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",XF,[Gt((r(),E(w,{data:a.value},{empty:d(()=>[n(bt,{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(b=>{var x,F,M;return[o("div",JF,[o("div",ZF,[o("div",e$,[L(f(((x=b.row)==null?void 0:x.display_name)||A(u)("No Name"))+" ",1),o("span",t$,"#"+f((F=b.row)==null?void 0:F.id),1)]),o("div",a$,f((M=b.row)==null?void 0:M.email),1)])])]}),_:1},8,["label"]),n(y,{prop:"shop_role",label:A(u)("Role Title"),width:100},{default:d(b=>[o("span",l$,f(A(da).headline(b.row.shop_role)),1)]),_:1},8,["label"]),n(y,{prop:"description",label:A(u)("Roles"),width:100},{default:d(b=>[o("span",s$,f(b.row.description),1)]),_:1},8,["label"]),n(y,{width:100},{default:d(b=>[o("div",n$,[n(Ze,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var x;(x=l.value)==null||x.openModal(b.row.id,b.row.shop_role,b.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:x=>p(b.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(ln,{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(zF,{ref_key:"roleModal",ref:l,onFetchRoles:c},null,512)])])}}},i$={class:"fct-settings-nav-wrap"},r$={class:"fct-settings-nav-collapse-button-wrapper"},d$={class:"fct-menu-collapse-button-text"},u$=["src","alt"],c$=["src","alt"],A$={class:"fct-settings-nav-link-text"},p$={class:"fct-settings-nav-child-list"},f$={class:"fct-settings-nav-content"},m$={class:"fct-settings-nav-content-inner"},h$=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=ll(),a=al(),l=T(window.innerWidth>=1024),s=T(!1),i=T(!1),c=T(null),p=T(null),m=T(null);Xs.has("store/settings");const _=T([{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"}),je.get("app_config.isProActive")&&_.value.push({name:u("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"}),je.get("addon_settings_sidebar",[]).forEach($=>_.value.push($));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"))},w=$=>$.child?(!b.value||x.value)&&F($):!1,k=()=>{const $=window.innerWidth,S=l.value;l.value=$>=1024,!S&&l.value&&(c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open")),S&&!l.value&&(s.value=!1)};Ie(()=>{m.value=document.getElementById("fluent_cart_plugin_app"),m.value&&m.value.classList.add("fct_settings_page_plugin_app_wrap"),k(),window.addEventListener("resize",k)}),Bt(()=>{m.value&&m.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",k)});const b=K(()=>s.value),x=K(()=>l.value&&s.value&&i.value),F=$=>{const S=t.path;return!!($.child&&$.child.length&&$.child.some(Q=>S===Q.url||S.includes(Q.url))||S===$.url||S.includes($.url))},M=($,S,I)=>{const Q=t.path;return!!(Q===$.url||$.activeFor&&$.activeFor.some(D=>Q.startsWith(D))||Q===I.url&&S===0)};return($,S)=>{const I=C("el-button"),Q=C("el-tooltip"),D=C("router-link"),V=C("router-view");return r(),h("div",{class:re(["fct-setting-container setting-container",{"is-collapsed":b.value,"is-expanded":x.value}])},[o("div",{ref_key:"overlayRef",ref:p,class:"fct-settings-menu-overlay",onClick:v},null,512),o("div",i$,[o("div",{ref_key:"sidebarRef",ref:c,class:re(["fct-settings-nav-container",{"is-collapsed":b.value,"is-expanded":x.value}])},[o("div",r$,[n(Q,{content:A(u)("Toggle settings"),placement:"right"},{default:d(()=>[n(I,{onClick:y,"aria-label":A(u)("Toggle settings navigation"),"aria-expanded":!b.value},{default:d(()=>[n(J,{name:"Window"}),o("span",d$,f(A(u)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:S[0]||(S[0]=U=>l.value&&s.value&&(i.value=!0)),onMouseleave:S[1]||(S[1]=U=>i.value=!1)},[(r(!0),h(H,null,ae(_.value,(U,O)=>(r(),h("li",{key:O,class:re(["fct-settings-nav-item",{"fct-settings-nav-item-active":F(U)}])},[A(Xs).hasAny(U.permission)?(r(),E(D,{key:0,to:U.url,class:"fct-settings-nav-link"},{default:d(()=>[U.icon_img?(r(),h(H,{key:0},[o("img",{src:U.icon_img,alt:U.name,class:re(U.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,u$),U.icon_img_dark?(r(),h("img",{key:0,src:U.icon_img_dark,alt:U.name,class:"w-5 h-5 hidden dark:block"},null,8,c$)):B("",!0)],64)):(r(),E(J,{key:1,name:U.icon},null,8,["name"])),o("span",A$,[L(f(U.name)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):B("",!0),n(va,{visible:w(U),accordion:"",class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",p$,[(r(!0),h(H,null,ae(U.child,(R,P)=>(r(),h("li",{key:P,class:re(["fct-settings-nav-item",{"fct-settings-nav-item-active":M(R,P,U)}])},[n(D,{to:R.url,class:"fct-settings-nav-link"},{default:d(()=>[L(f(R.name),1)]),_:2},1032,["to"])],2))),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),o("div",f$,[o("div",m$,[n(V)])])])],2)}}}),_$={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},v$={__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"),m=C("el-table");return r(),E(m,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default: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(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"},y$={class:"dialog-footer"},vp={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=T(!1),l=T([]),s=T(null),i=T({}),c=T(!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,Y.success(g.message),t.customer.user_id=s.value}).catch(g=>{if(g.message)return Y.error(g.message);i.value=g}).finally(()=>{c.value=!1})},m=()=>{s.value=null,i.value={},a.value=!1},_=()=>{ue.get("customers/attachable-user").then(g=>{l.value=rt.get(g,"users")})};return Ie(()=>{_()}),(g,y)=>{C("el-link");const v=C("el-option"),w=C("el-select"),k=C("el-form-item"),b=C("el-form"),x=C("el-button"),F=C("el-dialog");return r(),h(H,null,[B("",!0),n(F,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=M=>a.value=M),title:A(u)("Attach User"),onClosed:m},{footer:d(()=>[o("span",y$,[n(x,{onClick:m},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(x,{type:"primary",onClick:p,loading:c.value,disabled:c.value},{default:d(()=>[L(f(A(u)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[n(b,{"label-position":"top"},{default:d(()=>[n(k,{label:g.$t("Select User")},{default:d(()=>[n(w,{id:"user_id",modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=M=>s.value=M),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,M=>(r(),E(v,{key:M.ID,label:M.display_name,value:M.ID},{default:d(()=>[o("div",g$,[o("span",null,f(M.display_name),1),o("span",null,f(M.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i.value.hasOwnProperty("user_id")?(r(),E(oa,{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)}}},b$={class:"more-btn"},w$={class:"fct-admin-sidebar-item"},C$={class:"fct-profile-card"},k$={class:"fct-profile-image"},B$=["src","alt"],x$={class:"fct-profile-details"},S$={class:"title"},F$={class:"text"},$$={key:0},E$={class:"text"},U$={key:0,class:"flex items-center gap-2 mt-1.5"},I$={class:"user-info"},Q$=["href"],D$={key:1},V$={class:"fct-admin-sidebar-item mt-5"},T$={class:"sidebar-title"},M$={class:"fct-contact-info-list"},L$={class:"flex items-center justify-between gap-2"},R$=["href"],O$={class:"fct-admin-sidebar-item mt-5"},H$={class:"sidebar-title"},P$={key:0,class:"fct-address-copy-wrap"},N$={class:"text"},K$={key:0,class:"pr-1"},G$=["innerHTML"],j$={key:1,class:"mt-3"},z$={class:"pr-1"},q$=["href"],Y$={key:0,class:"no-address-text"},W$={class:"fct-admin-sidebar-item mt-5"},X$={class:"sidebar-title"},J$={key:0,class:"fct-address-copy-wrap"},Z$={class:"text"},eE={key:0,class:"pr-1"},tE=["innerHTML"],aE={key:1,class:"mt-3"},lE={class:"pr-1"},sE=["href"],nE={key:0,class:"no-address-text"},oE={class:"fct-customer-address-wrap"},iE={name:"CustomerInformations",components:{CustomerPurchaseValue:Ef,NewCustomerModal:Yr,ManageAddressModal:Uc,AddOrEditAddressModal:Ec,DynamicIcon:J,CopyToClipboard:Ia,UserAttchModal:vp,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})}}},gp=Object.assign(iE,{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"),m=C("el-tag"),_=C("el-icon"),g=C("el-dialog"),y=Ma("loading");return r(),h("div",null,[n(xe,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(()=>[L(f(t.$t("Edit customer information")),1)]),_:1}),n(l,{command:"manage_shipping_address"},{default:d(()=>[L(f(t.$t("Manage shipping address")),1)]),_:1}),n(l,{command:"manage_billing_address"},{default:d(()=>[L(f(t.$t("Manage billing address")),1)]),_:1}),n(l,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:d(()=>[L(f(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:d(()=>[o("span",b$,[n(J,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>{var v,w,k,b;return[o("div",w$,[o("div",C$,[o("div",k$,[o("img",{src:(v=e.customer)==null?void 0:v.photo,alt:t.customerDisplayName},null,8,B$)]),o("div",x$,[o("div",S$,f(t.customerDisplayName),1),o("span",F$,[e.customer.purchase_count>0?(r(),h("span",$$,f(A(Zt)(e.customer.purchase_count)),1)):B("",!0),L(" "+f(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),o("span",E$,f(A(_a)((w=e.customer)==null?void 0:w.ltv,!0))+" "+f(A(u)("Lifetime Value")),1)])])]),o("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),h("div",U$,[o("div",I$,[a[6]||(a[6]=L(" 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"},[L(" #"+f(A(Zt)(e.customer.user_id))+" ",1),n(J,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,Q$)]),B("",!0)])):(r(),h("div",D$,[n(vp,{customer:e.customer},null,8,["customer"])]))]),o("div",V$,[o("h4",T$,f(t.$t("Contact Information")),1),o("ul",M$,[o("li",null,[o("div",L$,[o("a",{class:"text",href:"mailto:"+((k=e.customer)==null?void 0:k.email)},f((b=e.customer)==null?void 0:b.email),9,R$),n(Ia,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",O$,[o("h4",H$,[L(f(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:d(()=>[L(f(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),h(H,null,ae(t.shippingAddress,(x,F)=>(r(),h(H,null,[x.is_primary==="1"?(r(),h("div",P$,[o("span",N$,[x.name?(r(),h("strong",K$,f(x.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(x,"shipping",!0)},null,8,G$),x.phone?(r(),h("span",j$,[o("strong",z$,f(A(u)("Phone"))+":",1),o("a",{href:"tel:"+x.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(x.phone),9,q$)])):B("",!0)]),n(Ia,{text:t.getOrderAddress(x),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):B("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",Y$,f(t.$t("No default address found.")),1)):B("",!0)]),o("div",W$,[o("h4",X$,[L(f(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:d(()=>[L(f(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),h(H,null,ae(t.billingAddress,(x,F)=>(r(),h(H,null,[x.is_primary==="1"?(r(),h("div",J$,[o("span",Z$,[x.name?(r(),h("strong",eE,f(x.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(x,"billing",!0)},null,8,tE),x.phone?(r(),h("span",aE,[o("strong",lE,f(A(u)("Phone"))+":",1),o("a",{href:"tel:"+x.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(x.phone),9,sE)])):B("",!0)]),n(Ia,{text:t.getOrderAddress(x),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):B("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),h("p",nE,f(t.$t("No default address found.")),1)):B("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),E(Yr,{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(Uc,{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",oE,[n(c,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:d(()=>[n(_,null,{default:d(()=>[n(A(ed))]),_:1}),L(" "+f(t.$t("Manage address")),1)]),_:1}),n(Ec,{"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"])])}}}),rE={class:"fct-single-customer-loader-wrap fct-layout-width"},dE={class:"single-page-header fct-page-loader-header flex items-start justify-between"},uE={class:"single-page-body"},cE={class:"fct-single-order"},AE={class:"fct-single-order-main"},pE={class:"fct-single-order-aside"},fE={class:"fct-admin-sidebar"},yp={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",rE,[o("div",dE,[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",uE,[o("div",cE,[o("div",AE,[n(xe,{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",pE,[o("div",fE,[n(xe,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(xe,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})])])])])])}}},mE={key:2},hE={key:0,class:"fct-single-customer-wrapper fct-layout-width"},_E={class:"single-page-header"},vE={class:"single-page-header-title-wrap"},gE={key:0},yE={key:0,class:"single-page-body"},bE={class:"fct-admin-sidebar"},wE={key:0},CE={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:Jr,IconButton:Ze,Empty:bt,DynamicIcon:J,Badge:fa,SaveBar:sn,CustomerInformation:gp,Labels:Jo,DynamicTemplates:rn,ArrowDown:ei,ArrowRight:dl,CardContainer:xe,CardHeader:Qe,CardBody:Ce,LicenseTable:Wr,OrdersTableMobile:Zr,SubscriptionsTable:Dc,SingleCustomerLoader:yp,SubscriptionsTableMobile:Qc},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=>{Y.success(e)}).catch(e=>{var t;e.status_code=="422"?Y.validationErrors(e):Y.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:["shipping_address","billing_address","labels","subscriptions"]}).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=rt.get(e,"data.buttonText"),this.notFound.message=rt.get(e,"data.message"),this.notFound.route=rt.get(e,"data.route")):e.status_code=="422"?Y.validationErrors(e):Y.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:["order_items"],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"?Y.validationErrors(e):Y.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},exportOrders(){location.href=window.ajaxurl+"?"+jQuery.param({action:"fluent_cart_admin_ajax",route:"export_orders",customer_id:this.customer_id,search:this.search,format:"csv"})}},mounted(){this.fetch(),this.getCustomerOrders()}},kE=Object.assign(CE,{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(yp,{key:0})):B("",!0),t.notFound.show?(r(),E(ai,{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",mE,[t.loading?B("",!0):(r(),h("div",hE,[n(sn,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",_E,[o("div",vE,[n(s,{"separator-icon":A(dl)},{default:d(()=>[n(l,{to:{name:"customers"}},{default:d(()=>[L(f(A(u)("Customers")),1)]),_:1}),n(l,null,{default:d(()=>[t.customer?(r(),h("span",gE,f(t.customer.full_name),1)):B("",!0)]),_:1}),n(l,null,{default:d(()=>[L(f(A(u)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(r(),h("div",yE,[n(p,{gutter:30},{default:d(()=>[n(c,{lg:17,xs:24},{default:d(()=>[n(A(xe),{class:"overflow-hidden fct-customer-orders-items"},{default:d(()=>[n(A(Qe),{title:A(u)("Orders (%s)",A(Zt)(t.customerOrders.total||0)),title_size:"small"},{action:d(()=>[n(i,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=m=>t.search=m),onKeyup:a[1]||(a[1]=xa(m=>t.getCustomerOrders(),["enter"])),placeholder:A(u)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=m=>t.getCustomerOrders()),class:re(`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]=m=>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(v$,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(H,{key:1},[n(Jr,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),n(Zr,{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($c,{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(xe),{key:0,class:"overflow-hidden"},{default:d(()=>[n(A(Qe),{title:A(u)("Subscriptions")+" ("+A(Zt)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),n(A(Ce),{class:"px-0 pb-0"},{default:d(()=>[n(Dc,{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(Qc,{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(xe),{key:1,class:"overflow-hidden"},{default:d(()=>[n(A(Qe),{title:A(u)("Licenses")+" ("+A(Zt)(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(Wr,{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",bE,[n(gp,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),n(Jo,{"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",wE,[n(rn,{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)}}}),BE={components:{BundleProducts:So,Empty:bt,Pagination:$c,Badge:fa,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 et},Asset(){return cs},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:Zt,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,Y.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;Be(()=>{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:["detail.variants.media","detail.variants.bundleChildren","categories"]};ue.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=om(a.data,this.order_id),delete a.data,this.paginate=a,this.searching=!1}).catch(t=>{var a;t.status_code=="422"?Y.validationErrors(t):Y.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1})},formatCapitalized(e){return nm(e)}}},xE={class:"fluent-cart-admin-pages"},SE={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},FE={class:"px-5"},$E={class:"fc_product_search_table",ref:"fc_product_search_table"},EE={class:"fct-collapsible-list"},UE={class:"fct-collapsible-list-item-inner"},IE={class:"fct-collapsible-item"},QE={class:"fct-collapsible-content-wrapper"},DE=["onClick"],VE={key:1,class:"content-indent"},TE={class:"content-checkbox"},ME={class:"content-img"},LE=["src","alt"],RE={class:"content-title"},OE={class:"title"},HE={key:0,class:"text-gray-500 dark:text-gray-400"},PE={key:1,class:"text"},NE={key:0,class:"fct-collapsible-stock-wrapper"},KE={key:0},GE={key:1,class:"text-red-500"},jE={class:"fct-collapsible-value-wrapper"},zE={key:0},qE={key:1},YE={class:"fct-collapsible-item-child-inner"},WE={class:"fct-collapsible-item"},XE={class:"fct-collapsible-content-wrapper"},JE={class:"fct-collapsible-content-group"},ZE={class:"content-checkbox"},eU={class:"content-img"},tU=["src","alt"],aU={class:"content-title"},lU={class:"title title--wrap"},sU={key:0,class:"text"},nU={key:0},oU={key:1,class:"text already-added"},iU={class:"fct-collapsible-stock-wrapper"},rU={key:0},dU={key:1,class:"text-red-500"},uU={class:"fct-collapsible-value-wrapper"},cU={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},AU={class:"dialog-footer"};function pU(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-input"),m=C("el-skeleton"),_=C("el-checkbox"),g=C("BundleProducts"),y=C("Empty"),v=C("Pagination"),w=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]=b=>i.searchQuery=""),modelValue:s.orderAddModal,"onUpdate:modelValue":t[4]||(t[4]=b=>s.orderAddModal=b),title:e.$t("Add Items")},{default:d(()=>[o("div",SE,[o("div",FE,[n(p,{placeholder:e.$t("Search products"),autofocus:"",ref:"fc_product_search_new",onInput:t[0]||(t[0]=b=>i.fetchBySearch()),modelValue:i.searchQuery,"onUpdate:modelValue":t[1]||(t[1]=b=>i.searchQuery=b),clearable:""},{prefix:d(()=>[n(c,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),o("div",$E,[n(m,{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",EE,[(r(!0),h(H,null,ae(s.availableProducts,(b,x)=>{var F,M,$,S,I,Q,D,V,U;return r(),h("li",{class:"fct-collapsible-list-item",key:x},[o("div",UE,[o("div",IE,[o("div",QE,[((F=b==null?void 0:b.children)==null?void 0:F.length)>0?(r(),h("div",{key:0,class:re(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[x]}]),onClick:O=>i.handleToggleCollapse(x)},[n(c,{name:"CaretRight"})],10,DE)):B("",!0),!((M=b==null?void 0:b.children)!=null&&M.length)>0?(r(),h("div",VE)):B("",!0),o("div",TE,[n(_,{modelValue:b.checked,"onUpdate:modelValue":O=>b.checked=O,onChange:O=>i.handleCheckboxChange(x,b),disabled:b.disable===!0||i.isAlreadyAdded(b.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",ME,[o("img",{src:b.featured_media!=null?b.featured_media:i.Asset.getUrl("images/placeholder-small.svg"),alt:b.title},null,8,LE)]),o("div",RE,[o("div",OE,f(b.post_title),1),(($=b==null?void 0:b.other_info)==null?void 0:$.payment_type)==="subscription"&&((S=b.other_info)==null?void 0:S.billing_summary)!==""?(r(),h("small",HE,f((I=b.other_info)==null?void 0:I.billing_summary),1)):B("",!0),i.isAlreadyAdded(b.object_id)?(r(),h("div",PE,f(e.$t("Item already added")),1)):B("",!0)])]),((Q=b==null?void 0:b.children)==null?void 0:Q.length)==0?(r(),h("div",NE,[b.stockStatus=="in-stock"?(r(),h("span",KE,f(b.available!==1/0?b.available+i.translate(" Available"):i.translate("Unlimited")),1)):B("",!0),b.stockStatus==="out-of-stock"?(r(),h("span",GE,f(i.formatCapitalized(b.stockStatus)),1)):B("",!0)])):B("",!0),o("div",jE,[((D=b==null?void 0:b.children)==null?void 0:D.length)>0?(r(),h("span",zE,f(b.min_price!=b.max_price?e.formatNumber(b.min_price)+" - "+e.formatNumber(b.max_price):e.formatNumber(b.min_price)),1)):(r(),h("span",qE,f(e.formatNumber(b.price)),1))])]),((V=b==null?void 0:b.children)==null?void 0:V.length)>0?(r(),h("div",{key:0,class:re(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},null,2)):B("",!0),((U=b==null?void 0:b.children)==null?void 0:U.length)>0?(r(),h("div",{key:1,class:re(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},[o("ul",YE,[(r(!0),h(H,null,ae(b.children,(O,R)=>{var P,j,q,z,X;return r(),h("li",{key:R},[o("div",WE,[o("div",XE,[o("div",JE,[o("div",ZE,[n(_,{modelValue:O.checked,"onUpdate:modelValue":ne=>O.checked=ne,onChange:ne=>i.handleCheckboxChange(R,O),disabled:O.disable===!0||i.isAlreadyAdded(O.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",eU,[o("img",{src:O.featured_media!=null?O.featured_media:e.appVars.asset_url+"images/placeholder-small.svg",alt:O.title},null,8,tU)])]),o("div",aU,[o("div",lU,f(O.variation_display_title||O.title),1),((P=O==null?void 0:O.other_info)==null?void 0:P.payment_type)==="subscription"&&((j=O.other_info)==null?void 0:j.billing_summary)!==""?(r(),h("small",sU,[L(f(i.CurrencyFormatter.currencySign)+" "+f((q=O.other_info)==null?void 0:q.billing_summary)+" ",1),((z=O.other_info)==null?void 0:z.trial_days)>0?(r(),h("span",nU,[t[5]||(t[5]=o("br",null,null,-1)),L(" "+f(i.translate("Trial Days"))+": "+f((X=O.other_info)==null?void 0:X.trial_days),1)])):B("",!0)])):B("",!0),i.isAlreadyAdded(O.object_id)?(r(),h("div",oU,f(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",iU,[O.stockStatus=="in-stock"?(r(),h("span",rU,f(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",dU,f(i.formatCapitalized(O.stockStatus)),1)):B("",!0)]),o("div",uU,f(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",cU,[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",AU,[n(w,{onClick:t[2]||(t[2]=b=>s.orderAddModal=!1)},{default:d(()=>[L(f(i.translate("Cancel")),1)]),_:1}),n(w,{disabled:!s.selectedProducts.length,type:"primary",onClick:i.processProducts},{default:d(()=>[L(f(i.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const bp=st(BE,[["render",pU]]),Dn=(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 m=parseInt(p&&p.group_id,10);if(l){const _=l.indexOf(m);return _===-1?Number.MAX_SAFE_INTEGER:_}return m||0},c=[...a].sort((p,m)=>s(p)-s(m)).map(p=>p&&p.title?String(p.title).trim():"").filter(Boolean);if(c.length)return c.join(" / ")}return e.variation_title||""},Oo=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},fU={key:0,class:"fct-downloadable-variation-selector"},mU={class:"price-info"},hU={key:0},Ho={__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",fU,[o("span",null,f(A(Dn)(e.variant,e.groupOrder)),1),o("span",mU,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),h("span",hU,f(A(da).capitalize(e.variant.other_info.repeat_interval)),1)):B("",!0),o("span",null,f(A(_a)(e.variant.item_price*100,!0)),1)])])):B("",!0)}}},_U={name:"Refund",components:{Badge:fa,VariationSelector:Ho,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 et},orderCurrencySign(){const e=je.get("currency_signs",{}),t=je.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=rt.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(t=>t.restore_quantity>0).map(t=>({id:t.id,variation_id:t.object_id,quantity:t.quantity,restore_quantity:t.restore_quantity}));this.refund.refunded_items=e,this.$post("orders/"+this.order_id+"/refund",{refund_info:this.refund,refunded_items:e}).then(t=>{this.refundNote=t}).catch(t=>{this.handleError(t)}).finally(()=>{this.updateRefundable(),this.refundProcessing=!1})}}},vU={key:0,class:"fct-refund-note-list"},gU={class:"message"},yU={key:1},bU={class:"refund-item-info"},wU={class:"right"},CU={class:"price"},kU={class:"price light"},BU={class:"form-note"},xU={style:{color:"#F04438","font-weight":"500"}},SU={class:"form-note form-note-tooltip"},FU={class:"dialog-footer is-border"},$U={key:0};function EU(e,t,a,l,s,i){const c=C("Badge"),p=C("el-option"),m=C("el-select"),_=C("el-form-item"),g=C("el-input"),y=C("el-checkbox"),v=C("el-col"),w=C("el-table-column"),k=C("el-input-number"),b=C("el-table"),x=C("DynamicIcon"),F=C("el-tooltip"),M=C("el-row"),$=C("el-form"),S=C("el-button");return r(),h("div",null,[s.refundNote?(r(),h("div",vU,[(r(!0),h(H,null,ae(s.refundNote,(I,Q)=>(r(),h("div",{key:Q,class:"fct-refund-note-item"},[o("span",gU,f(I.message),1),n(c,{status:I.status},null,8,["status"])]))),128))])):(r(),h("div",yU,[n($,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(M,{gutter:10},{default:d(()=>[n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Refund with transaction"),required:""},{default:d(()=>[n(m,{modelValue:s.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=I=>s.refund.transaction_id=I),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,ae(s.refundableTransactions,I=>(r(),E(p,{key:I.id,label:i.translate("#%1$s - Paid %2$s",I.id,i.formatNumber(I.refundable,!0)),value:I.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(_,{label:e.$t("Select Item/s")},{default:d(()=>[n(m,{modelValue:s.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=I=>s.refund.item_ids=I),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,ae(a.order.order_items,I=>(r(),E(p,{key:I.id,value:I.id,label:I.post_title+" - "+(I.variation_display_title||I.title)+" "+i.formatNumber(I.line_total-I.refund_total),class:"refund-item",disabled:Number(I.line_total)-Number(I.refund_total)<=0},{default:d(()=>[o("div",bU,[o("p",null,[L(f(I.post_title)+" ",1),o("span",null,"-"+f(I.variation_display_title||I.title),1)]),o("div",wU,[o("span",CU,f(i.translate("Refundable: %1$s",i.formatNumber(I.line_total-I.refund_total))),1),o("span",kU,f(i.translate("Item price: %1$s",i.formatNumber(I.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]=I=>s.refund.amount=I),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:d(()=>[L(f(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",BU,[o("p",null,[L(f(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",xU,f(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]=I=>s.refund.cancelSubscription=I)},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]=I=>s.refund.manageStock=I)},{default:d(()=>[L(f(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(b,{data:i.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:d(()=>[n(w,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:d(({row:I})=>[o("span",null,f(I.post_title)+" - "+f(I.title),1)]),_:1},8,["label"]),n(w,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:d(({row:I})=>[o("span",null,f(I.quantity),1)]),_:1},8,["label"]),n(w,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:d(({row:I})=>[n(k,{modelValue:I.restore_quantity,"onUpdate:modelValue":Q=>I.restore_quantity=Q,min:0,max:I.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]=I=>s.refund.reason=I)},null,8,["modelValue"]),o("div",SU,[o("p",null,[L(f(i.translate("Your customers can see this reason"))+" ",1),o("span",null,[n(F,{"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(x,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",FU,[n(S,{type:"primary",onClick:Ne(i.processRefund,["prevent"]),loading:s.refundProcessing,disabled:s.refund.amount<=0},{default:d(()=>[L(f(s.refundProcessing?i.translate("Processing"):i.translate("Refund"))+" ",1),s.refund.amount?(r(),h("span",$U)):B("",!0),L(f(i.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const UU=st(_U,[["render",EU]]),IU={class:"fct-number-input"},QU=["disabled","min","max"],DU={class:"fct-number-input-buttons"},VU=["disabled"],TU=["disabled"],MU={style:{color:"red"}},wp={__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 F,M,$,S,I;const a=t,l=e,s=T(""),i=()=>{var Q,D,V,U;return(((Q=l.item)==null?void 0:Q.manage_stock)||((U=(V=(D=l.item)==null?void 0:D.variants)==null?void 0:V.product_detail)==null?void 0:U.manage_stock))==1},c=T(((F=l.item)==null?void 0:F.quantity)||l.min),p=T(c.value),m=T(i()?((M=l.item)==null?void 0:M.available)||((S=($=l.item)==null?void 0:$.variants)==null?void 0:S.available):l.max),_=T(i()?(I=l.item)==null?void 0:I.updated_stock:l.max);qt().ctx;const g=K(()=>p.value<=l.min),y=K(()=>p.value>=_.value),v=()=>{s.value="",p.value<_.value&&(c.value++,p.value=c.value,a("update:value",c.value,_.value,l.item))},w=()=>{s.value="",p.value>l.min&&(c.value--,p.value=c.value,a("update:value",c.value,_.value,l.item))},k=(Q,D)=>{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)},b=Q=>{Q.key==="ArrowDown"&&p.value<=l.min&&Q.preventDefault()},x=()=>{var Q,D,V,U,O;s.value="",c.value=((Q=l.item)==null?void 0:Q.quantity)||l.min,p.value=c.value,m.value=i()?((D=l.item)==null?void 0:D.available)||((U=(V=l.item)==null?void 0:V.variants)==null?void 0:U.available):l.max,_.value=i()?(O=l.item)==null?void 0:O.updated_stock:l.max};return Ss(()=>{x()}),be(()=>l.item,Q=>{x()},{deep:!0}),(Q,D)=>(r(),h(H,null,[o("div",IU,[Gt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":D[0]||(D[0]=V=>p.value=V),type:"number",onInput:D[1]||(D[1]=V=>{k()}),min:e.min,max:e.max,onKeydown:b},null,40,QU),[[yf,p.value,void 0,{number:!0}]]),o("div",DU,[o("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[n(J,{name:"ChevronUp"})],8,VU),o("button",{onClick:w,class:"decrement-btn",disabled:g.value||e.isDisabled},[n(J,{name:"ChevronDown"})],8,TU)])]),o("span",MU,f(s.value),1)],64))}},LU={name:"PaymentLink",components:{IconButton:Ze,DynamicIcon:J,CopyToClipboard:Ia,InfoFilled:tl},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 je.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}}},RU=["element-loading-text"],OU={class:"fct-payment-link-block"},HU={key:1,class:"fct-payment-link-block"};function PU(e,t,a,l,s,i){const c=C("CopyToClipboard"),p=C("el-button"),m=C("el-input"),_=C("el-form-item"),g=C("el-col"),y=C("el-row"),v=Ma("loading");return Gt((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",OU,[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(()=>[L(f(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(m,{modelValue:s.business_email,"onUpdate:modelValue":t[0]||(t[0]=w=>s.business_email=w),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(m,{modelValue:s.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=w=>s.buyer_email=w),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",HU,[n(p,{type:"primary",onClick:i.getPaymentLink},{default:d(()=>[L(f(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):B("",!0)],8,RU)),[[v,s.fetchLink]])}const NU=st(LU,[["render",PU]]),KU={class:"fct-single-order-loader-wrap fct-layout-width"},GU={class:"single-page-header fct-page-loader-header flex items-start justify-between"},jU={class:"single-page-body"},zU={class:"fct-single-order"},qU={class:"fct-single-order-main"},YU={class:"fct-single-order-aside"},WU={class:"fct-admin-sidebar"},XU={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",KU,[o("div",GU,[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",jU,[o("div",zU,[o("div",qU,[n(xe,{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(xe,{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(xe,{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(xe,{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",YU,[o("div",WU,[n(xe,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(xe,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(xe,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})])])])])])}}},JU={name:"_Plans.vue",components:{Badge:fa},props:["subscription","header","order","getOrderUrl"],data(){return{}},computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:u}},ZU={class:"fct-subscription-plan-wrap"},e5={class:"fct-subs-status-wrap float-end"},t5={class:"fct-subs-title underline"},a5=["innerHTML"],l5={key:0,class:"cursor-pointer"};function s5(e,t,a,l,s,i){var m,_,g,y;const c=C("Badge"),p=C("router-link");return r(),h("div",ZU,[o("div",e5,[n(c,{status:i.subscriptionStatus},null,8,["status"])]),n(p,{to:{name:"view_subscription",params:{subscription_id:(m=a.subscription)==null?void 0:m.id}}},{default:d(()=>{var v;return[o("p",t5,f(e.$t((v=a.subscription)==null?void 0:v.display_item_name)),1)]}),_:1},8,["to"]),o("p",{innerHTML:(_=a.subscription)==null?void 0:_.payment_info},null,8,a5),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",l5,[L(f(i.translate("Parent Order:"))+" ",1),o("a",{onClick:t[0]||(t[0]=v=>{var w;return a.getOrderUrl((w=a.order)==null?void 0:w.parent_id)})},"#"+f((y=a.order)==null?void 0:y.parent_id),1)])):B("",!0)])}const Cp=st(JU,[["render",s5]]),n5={name:"SubscriptionPlanItem",components:{CardContainer:xe,CardHeader:Qe,CardBody:Ce,Plans:Cp,Refresh:td,Delete:gs,DynamicIcon:J,CancelSubscription:Uf},props:["subscription","order","orderId","index","getOrderUrl"],emits:["reload","fetchOrder","cancelSubscription"],data(){return{loadingState:{pause:!1,resume:!1,cancel:!1,fetch:!1,reactivate:!1},cancelSubscriptionModal:!1,cancelReason:""}},computed:{permissions(){var a;const e=((a=this.subscription)==null?void 0:a.permissions)||{},t=Xs.resolve({permission:"subscriptions/manage"});return{canFetch:t&&!!e.canFetch,canPause:t&&!!e.canPause,canResume:t&&!!e.canResume,canCancel:t&&!!e.canCancel}},paymentMethod(){var e;return((e=this.order)==null?void 0:e.payment_method)||""}},methods:{handleSubscriptionAction(e){e==="fetch_subscription"?this.confirmFetch():e==="pause_subscription"?this.confirmPause():e==="resume_subscription"?this.confirmResume():e==="cancel_subscription"&&this.confirmCancel()},confirmFetch(){var e;!this.subscription.vendor_subscription_id&&((e=this.order)==null?void 0:e.payment_method)!=="offline_payment"||Xa.confirm("Fetch from remote and update the subscription?","Warning",{type:"warning",icon:Gs(gs),cancelButtonText:"Back",confirmButtonText:"Fetch subscription!",beforeClose:async(t,a,l)=>{var s,i;if(t==="confirm")try{a.confirmButtonLoading=!0,this.loadingState.fetch=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/fetch`,{data:{vendor_charge_id:this.subscription.vendor_subscription_id}}),this.$notify({type:"success",title:"Success",message:"Subscription fetched successfully"}),this.$emit("reload")}catch(c){this.$notify({type:"error",title:"Error",message:u(((i=(s=c.response)==null?void 0:s.data)==null?void 0:i.message)||"Failed to fetch subscription")})}finally{a.confirmButtonLoading=!1,this.loadingState.fetch=!1,l()}else l()}})},confirmPause(){this.subscription.vendor_subscription_id&&Xa.prompt("Pause the active subscription?","Warning",{type:"warning",icon:Gs(gs),inputPlaceholder:"Enter reason for pausing",inputPattern:/.+/,inputErrorMessage:"Reason is required",cancelButtonText:"Back",confirmButtonText:"Pause Subscription!",beforeClose:async(e,t,a)=>{var l,s;if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.pause=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/pause`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id,reason:t.inputValue}}),this.$notify({type:"success",title:"Success",message:"Subscription paused successfully"}),this.$emit("reload")}catch(i){this.$notify({type:"error",title:"Error",message:u(((s=(l=i.response)==null?void 0:l.data)==null?void 0:s.message)||"Failed to pause subscription")})}finally{t.confirmButtonLoading=!1,this.loadingState.pause=!1,a()}else a()}})},confirmResume(){this.subscription.vendor_subscription_id&&Xa.prompt(u("Resume the paused subscription?"),u("Warning"),{type:"warning",icon:Gs(gs),inputPlaceholder:u("Enter reason for resuming"),inputPattern:/.+/,inputErrorMessage:u("Reason is required"),cancelButtonText:u("Back"),confirmButtonText:u("Resume Subscription!"),beforeClose:async(e,t,a)=>{if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.resume=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/resume`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id,reason:t.inputValue}}),this.$notify({type:"success",title:"Success",message:"Subscription resumed successfully"}),this.$emit("reload")}catch{this.$notify({type:"error",title:"Error",message:"Failed to resume subscription"})}finally{t.confirmButtonLoading=!1,this.loadingState.resume=!1,a()}else a()}})},confirmCancel(){this.subscription.vendor_subscription_id&&(this.cancelSubscriptionModal=!0)},confirmReactivate(){this.subscription.vendor_subscription_id&&Xa.confirm("Reactivate the canceled subscription?","Warning",{type:"warning",icon:Gs(gs),cancelButtonText:"Back",confirmButtonText:u("Reactivate Subscription!"),beforeClose:async(e,t,a)=>{var l,s;if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.reactivate=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/reactivate`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id}}),this.$notify({type:"success",title:"Success",message:"Subscription reactivated successfully"}),this.$emit("reload")}catch(i){this.$notify({type:"error",title:"Error",message:u(((s=(l=i.response)==null?void 0:l.data)==null?void 0:s.message)||"Failed to reactivate subscription")})}finally{t.confirmButtonLoading=!1,this.loadingState.reactivate=!1,a()}else a()}})}}},o5={class:"more-btn"},i5={class:"text-red-600"};function r5(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("Refresh"),m=C("el-icon"),_=C("el-dropdown-item"),g=C("Delete"),y=C("el-dropdown-menu"),v=C("el-dropdown"),w=C("CardHeader"),k=C("Plans"),b=C("CardBody"),x=C("CardContainer"),F=C("CancelSubscription");return r(),h(H,null,[n(x,null,{default:d(()=>[n(w,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},{default:d(()=>[i.permissions.canFetch||i.permissions.canPause||i.permissions.canResume||i.permissions.canCancel?(r(),E(v,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t[0]||(t[0]=M=>i.handleSubscriptionAction(M))},{dropdown:d(()=>[n(y,null,{default:d(()=>[i.permissions.canFetch?(r(),E(_,{key:0,command:"fetch_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(p)]),_:1}),L(" "+f(e.$t("Fetch subscription -"))+" "+f(i.paymentMethod),1)]),_:1})):B("",!0),i.permissions.canPause?(r(),E(_,{key:1,command:"pause_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(p)]),_:1}),L(" "+f(e.$t("Pause subscription -"))+" "+f(i.paymentMethod),1)]),_:1})):B("",!0),i.permissions.canResume?(r(),E(_,{key:2,command:"resume_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(p)]),_:1}),L(" "+f(e.$t("Resume subscription -"))+" "+f(i.paymentMethod),1)]),_:1})):B("",!0),i.permissions.canCancel?(r(),E(_,{key:3,command:"cancel_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(g)]),_:1}),o("span",i5,f(e.$t("Cancel subscription")),1)]),_:1})):B("",!0)]),_:1})]),default:d(()=>[o("span",o5,[n(c,{name:"More"})])]),_:1})):B("",!0)]),_:1},8,["title"]),n(b,null,{default:d(()=>[n(k,{onReload:t[1]||(t[1]=M=>e.$emit("reload")),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}),n(F,{subscription:a.subscription,orderId:a.orderId,onClose:t[2]||(t[2]=M=>s.cancelSubscriptionModal=!1),modelValue:s.cancelSubscriptionModal,"onUpdate:modelValue":t[3]||(t[3]=M=>s.cancelSubscriptionModal=M),onReload:t[4]||(t[4]=M=>e.$emit("reload")),onCancelSubscription:i.confirmCancel},null,8,["subscription","orderId","modelValue","onCancelSubscription"])],64)}const d5=st(n5,[["render",r5]]),u5={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,payment_status:this.order.payment_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=>{Js(e.message),this.$router.replace({name:"orders"})}).catch(e=>{e.status_code=="422"?Y.validationErrors(e):Y.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=>{Y.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?Y.validationErrors(e):Y.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=>{Y.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?Y.validationErrors(t):Y.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=>{Y.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?Y.validationErrors(e):Y.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},c5={class:"fct-order-bulk-action-modal"},A5={key:1,class:"more-btn"},p5={key:0},f5=["href"],m5={class:"dialog-footer"};function h5(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button"),m=C("el-dropdown-item"),_=C("el-tooltip"),g=C("el-dropdown-menu"),y=C("el-dropdown"),v=C("el-option"),w=C("el-select"),k=C("el-form-item"),b=C("el-form"),x=C("el-dialog");return r(),h("div",c5,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:d(()=>[n(g,null,{default:d(()=>{var F,M;return[a.trigger_action!=="add"?(r(),h("div",p5,[!s.isCancelled&&((F=a.order)==null?void 0:F.fulfillment_type)==="physical"?(r(),E(m,{key:0,command:"shipping_status"},{default:d(()=>[n(c,{name:"ShipmentStatus"}),L(" "+f(i.translate("Change Shipping Status")),1)]),_:1})):B("",!0),a.order.mode==="test"||s.isCancelled?(r(),E(m,{key:1,command:"delete_order",class:"item-destructive"},{default:d(()=>[n(c,{name:"Delete"}),L(" "+f(i.translate("Delete order")),1)]),_:1})):B("",!0),a.order.status==="processing"?(r(),E(m,{key:2,command:"order_complete"},{default:d(()=>[n(c,{name:"Check"}),L(" "+f(i.translate("Mark As Complete")),1)]),_:1})):B("",!0),s.isCancelled?B("",!0):(r(),E(m,{key:3,command:"order_cancel"},{default:d(()=>[n(c,{name:"Cross"}),L(" "+f(i.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(r(),E(m,{key:4,command:"order_processing"},{default:d(()=>[n(c,{name:"Refresh"}),L(" "+f(i.translate("Back to processing")),1)]),_:1})):B("",!0),!s.isCompleted&&!s.isCancelled?(r(),E(m,{key:5,command:"sync_order_statuses"},{default:d(()=>[n(c,{name:"Refresh"}),L(" "+f(i.translate("Sync Order Statuses")),1)]),_:1})):B("",!0),n(m,{command:"order_receipt",class:"item-link"},{default:d(()=>[o("a",{target:"_blank",href:a.order.receipt_url},[n(c,{name:"External"}),L(" "+f(i.translate("Receipt")),1)],8,f5)]),_:1}),(M=a.order)!=null&&M.has_missing_licenses?(r(),E(m,{key:6,command:"generate_missing_licenses"},{default:d(()=>[n(c,{name:"Files"}),L(" "+f(i.translate("Generate missing licenses")),1)]),_:1})):B("",!0),a.shouldShowRefund?(r(),E(m,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:d(()=>[n(c,{name:"Money"}),L(" "+f(i.translate("Refund")),1)]),_:1})):B("",!0),n(m,{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},[L(f(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(()=>[L(f(a.warningMessage),1)]),default:d(()=>[L(" "+f(i.translate("Edit")),1)]),_:1})):(r(),h(H,{key:1},[L(f(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(()=>[L(f(i.translate("More Action"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})):(r(),h("span",A5,[n(c,{name:"More"})]))]),_:1},8,["onCommand"]),n(x,{modelValue:s.showModal,"onUpdate:modelValue":t[2]||(t[2]=F=>s.showModal=F),title:i.translate("Update Shipping Status")},{default:d(()=>[n(b,{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(w,{modelValue:s.status_data.shipping_status,"onUpdate:modelValue":t[0]||(t[0]=F=>s.status_data.shipping_status=F),placeholder:i.translate("Select Shipping Status")},{default:d(()=>[(r(!0),h(H,null,ae(e.appVars.shipping_statuses,(F,M)=>(r(),E(v,{key:M,label:F,value:M},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]),o("span",m5,[n(p,{onClick:t[1]||(t[1]=F=>i.changeShippingStatus()),type:"primary"},{default:d(()=>[L(f(i.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const wd=st(u5,[["render",h5]]),_5={name:"Transaction",computed:{Str(){return da}},components:{ConvertedTime:Na,ArrowDown:Gs(ei),Check:Rc,Badge:fa,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:Mc,translateNumber:Zt,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}))}}},v5={key:0,class:"fct-transaction-details -mt-[1px]"},g5={class:"fct-table-wrap"},y5={class:"p-0 m-0 text-xs text-gray-500"},b5={key:0},w5=["href"],C5={class:"flex items-center gap-2.5"},k5={key:0,class:"w-7"},B5=["title","src","alt"],x5={key:1,class:"capitalize"},S5={key:2},F5={class:"text-sm"},$5={class:"text-sm text-gray-700"},E5={class:"text-sm flex gap-2"},U5=["href"];function I5(e,t,a,l,s,i){var F,M;const c=C("ConvertedTime"),p=C("el-table-column"),m=C("Badge"),_=C("el-tooltip"),g=C("el-button"),y=C("DynamicIcon"),v=C("el-table"),w=C("el-form-item"),k=C("el-input"),b=C("el-form"),x=C("el-dialog");return a.transactions.length>0?(r(),h("div",v5,[o("div",g5,[n(v,{data:a.transactions,class:"w-full"},{default:d(()=>[n(p,{label:i.translate("# Date"),width:"auto"},{default:d($=>[o("div",null,[o("p",y5,"#"+f(i.translateNumber($.row.id)),1),n(c,{"date-time":$.row.created_at},null,8,["date-time"])])]),_:1},8,["label"]),n(p,{label:i.translate("Gateway ID"),width:"160"},{default:d($=>[$.row.vendor_charge_id==""?(r(),h("span",b5,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:$.row.url},f($.row.vendor_charge_id),9,w5))]),_:1},8,["label"]),n(p,{label:i.translate("Payment Method"),width:"140"},{default:d($=>[o("div",C5,[i.getCardBrand($.row.card_brand,$.row.payment_method_type)?(r(),h("div",k5,[o("img",{class:"w-full",title:$.row.payment_method,src:i.getCardBrand($.row.card_brand,$.row.payment_method_type),alt:$.row.card_brand},null,8,B5)])):(r(),h("span",x5,f($.row.payment_method_type),1)),$.row.card_last_4&&$.row.card_last_4!="0"?(r(),h("span",S5,f("..."+$.row.card_last_4),1)):B("",!0)])]),_:1},8,["label"]),n(p,{label:i.translate("Total"),width:"auto"},{default:d($=>[o("span",null,f(e.formatNumberForOrder($.row.total,a.orderCurrency)),1)]),_:1},8,["label"]),n(p,{label:i.translate("Status"),width:"120"},{default:d($=>{var S,I,Q,D,V,U;return[$.row.transaction_type=="dispute"?(r(),E(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((I=(S=$.row)==null?void 0:S.meta)==null?void 0:I.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>[n(m,{class:"m-2 b-red",status:"dispute"},{default:d(()=>t[3]||(t[3]=[L(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):B("",!0),(D=(Q=$.row)==null?void 0:Q.meta)!=null&&D.reason?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate((U=(V=$.row)==null?void 0:V.meta)==null?void 0:U.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var O,R,P,j;return[((R=(O=$.row)==null?void 0:O.meta)==null?void 0:R.disputed)=="yes"&&((j=(P=$.row)==null?void 0:P.meta)==null?void 0:j.dispute_resolved)=="no"?(r(),E(m,{key:0,status:$.row.status},{default:d(()=>{var q;return[L(f($.row.status)+" "+f((q=$==null?void 0:$.row)==null?void 0:q.transaction_type),1)]}),_:2},1032,["status"])):(r(),E(m,{key:1,status:$.row.status},{default:d(()=>[L(f($.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(m,{key:2,status:$.row.status},{default:d(()=>[L(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($=>[$.row.transaction_type=="dispute"&&$.row.status=="succeeded"?(r(),E(g,{key:0,type:"warning",size:"small",onClick:S=>i.handleDispute($.row)},{default:d(()=>[L(f(i.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):B("",!0),$.row.transaction_type=="charge"&&$.row.status=="pending"&&$.row.vendor_charge_id?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",$.row.payment_method),"popper-class":"fct-tooltip"},{default:d(()=>[n(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",$.row.payment_method),loading:s.syncing_transaction===$.row.id,onClick:S=>i.syncTransaction($.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(x,{modelValue:s.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=$=>s.disputeHandleModal=$),title:"Handle Dispute #"+((M=(F=s.disputeTransaction)==null?void 0:F.meta)==null?void 0:M.dispute_id),width:"800px"},{footer:d(()=>{var $,S,I,Q,D,V;return[o("a",{href:($=s.disputeTransaction)==null?void 0:$.url,target:"_blank",class:"el-button el-button--warning is-link"},f(i.translate("See dispute on ")+((S=s.disputeTransaction)==null?void 0:S.payment_method)),9,U5),(Q=(I=s.disputeTransaction)==null?void 0:I.meta)!=null&&Q.is_charge_refundable?(r(),E(g,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:s.loadingDisputeAction},{default:d(()=>[L(f(i.translate("Refund customer")),1)]),_:1},8,["loading"])):B("",!0),(V=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&V.is_dispute_actionable?(r(),E(g,{key:1,type:"primary",onClick:i.handleDisputeSubmit,loading:s.loadingDisputeAction},{default:d(()=>[L(f(i.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):B("",!0)]}),default:d(()=>{var $,S,I,Q,D,V;return[(S=($=s.disputeTransaction)==null?void 0:$.meta)!=null&&S.dispute_reason?(r(),E(w,{key:0},{default:d(()=>{var U,O;return[o("div",F5," Dispute Reason: "+f((O=(U=s.disputeTransaction)==null?void 0:U.meta)==null?void 0:O.dispute_reason),1)]}),_:1})):B("",!0),n(w,null,{default:d(()=>[o("div",$5,f(i.translate("You may either counter the dispute by providing evidence to prove that the cardholder is the legitimate purchaser, or you can accept this dispute immediately to refund the cardholder and close the dispute.")),1)]),_:1}),(Q=(I=s.disputeTransaction)==null?void 0:I.meta)!=null&&Q.is_dispute_actionable?(r(),E(b,{key:1,model:s.disputeForm,"label-position":"top"},{default:d(()=>[n(w,{label:i.translate("Note"),prop:"dispute_note"},{default:d(()=>[n(k,{modelValue:s.disputeForm.dispute_note,"onUpdate:modelValue":t[0]||(t[0]=U=>s.disputeForm.dispute_note=U),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):B("",!0),(V=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&V.is_charge_refundable?(r(),E(w,{key:2},{default:d(()=>[o("div",E5,[n(y,{class:"w-6 h-6",name:"Information"}),L(" "+f(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 Cd=st(_5,[["render",I5]]),kd=(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 m=i.unit_price*i.quantity;if(i.subtotal=m-i.cost,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=m-i.discount_total,l+=m,i.payment_type=="subscription"&&i.other_info.manage_setup_fee=="yes"){let _=parseInt(i.other_info.signup_fee);i.other_info.setup_fee_per_item=="yes"&&(_=_*i.quantity),l+=_}}),e.subtotal=l,e.coupon_discount_total=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),Q5(e),e},qu=(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),kp(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},Q5=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),kp=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),D5={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")}}},V5={class:"fct-note-modal"},T5={class:"dialog-footer"};function M5(e,t,a,l,s,i){const c=C("el-input"),p=C("el-form-item"),m=C("el-form"),_=C("el-button");return r(),h("div",V5,[n(m,{"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",T5,[n(_,{type:"info",soft:"",onClick:i.closeModal},{default:d(()=>[L(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(_,{type:"primary",onClick:i.saveNote},{default:d(()=>[L(f(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const Bp=st(D5,[["render",M5]]),L5={class:"fct-admin-sidebar-item"},R5={key:0},O5={name:"Notes",components:{IconButton:Ze,NoteModal:Bp,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=>{Y.success(a.message),this.noteCopy=e}).catch(a=>{Y.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},gi=Object.assign(O5,{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(xe,{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:re(t.noteNeedsCollapse?"pb-0":"")},{default:d(()=>[o("div",L5,[t.loading?(r(),E(s,{key:0,animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})):(r(),h(H,{key:1},[o("span",null,f(t.noteCopy?t.noteTextToDisplay:t.$t("No notes")),1),t.noteNeedsCollapse?(r(),E(i,{key:0,class:"fct-show-more-button",onClick:t.toggleNoteText,text:""},{default:d(()=>[t.isNoteExpanded?(r(),h(H,{key:0},[L(f(t.$t("Show less"))+" ",1),n(J,{name:"ChevronUp"})],64)):(r(),h(H,{key:1},[L(f(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",R5,[n(Bp,{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"])])}}}),H5={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"?Y.validationErrors(a):Y.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},applyCoupon(){if(this.coupons&&this.coupons.find(e=>e.code===this.newCoupon)){Y.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"?Y.validationErrors(e):Y.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"?Y.validationErrors(a):Y.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"?Y.validationErrors(e):Y.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,kd(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},P5={colspan:"3"},N5={class:"fct-add-coupon-wrap"},K5={key:0,class:"fct-add-coupon-input-label"},G5={key:1,class:"fct-add-coupon-input-label"},j5={key:2,class:"fct-add-coupon-input-wrap"},z5={class:"flex gap-0.5 items-center"};function q5(e,t,a,l,s,i){const c=C("el-autocomplete"),p=C("el-button"),m=C("el-alert"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-popconfirm");return r(),h(H,null,[o("tr",null,[o("td",P5,[o("div",N5,[a.action==="create_order"?(r(),h("div",K5,f(e.$t("Have a Coupon?")),1)):(r(),h("div",G5,f(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",j5,[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(()=>[L(f(e.$t("Apply")),1)]),_:1},8,["onClick"])])):B("",!0),!s.hasCoupon&&a.shouldManageCoupon?(r(),E(m,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):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",z5,[o("span",null,f(v.code),1),a.action==="create_order"?(r(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ne(w=>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:w=>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,"- "+f(e.formatNumberForOrder(v.amount,a.order)),1)]))),128))],64)}const yi=st(H5,[["render",q5]]),Y5={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=bn({...e.discount}),l=T([{label:u("Amount"),value:"amount"}]),s=T("");return{discountOptions:l,applyDiscount:()=>{const m=parseInt(a.value);isNaN(m)||m<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{s.value="";const m=parseInt(a.value);let _=m||0;const g=e.totalAmount/100;return a.type=="percentage"?(_=g*m/100,(m>100||_>g)&&(s.value=u("Discount should not exceed the full product price (100%).")),isNaN(m)||m<1||m>100):(_>g&&(s.value=u("Discount should not exceed the full product price (%s).",im(g))),isNaN(m)||m<1||_>g)},error:s}}},W5={class:"fct-discount-modal"},X5=["innerHTML"],J5={key:1},Z5={style:{color:"red"}},eI={class:"form-note"},tI={class:"dialog-footer"};function aI(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),m=C("el-form-item"),_=C("el-col"),g=C("el-input"),y=C("el-row"),v=C("el-form"),w=C("el-button");return r(),h("div",W5,[n(v,{"label-position":"top"},{default:d(()=>[n(y,{gutter:20},{default:d(()=>[n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(m,{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(m,{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,X5)):(r(),h("span",J5,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",Z5,f(l.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),n(y,null,{default:d(()=>[n(_,{md:24,sm:12,xs:24},{default:d(()=>[n(m,{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",eI,[o("p",null,f(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",tI,[n(w,{type:"info",onClick:l.cancelDiscount,soft:""},{default:d(()=>[L(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(w,{type:"primary",disabled:l.isDisabledApplyButton(),onClick:l.applyDiscount},{default:d(()=>[L(f(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const lI=st(Y5,[["render",aI]]),sI={name:"CustomDiscount",components:{IconButton:Ze,DynamicIcon:J,DiscountModal:lI},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={},qu(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,qu(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},nI={key:0},oI={key:1},iI={key:2},rI={style:{"font-size":"12px",color:"rgb(107,114,128)"}},dI={style:{"padding-left":"16px"}},uI={style:{"font-size":"12px",color:"rgb(107,114,128)"}},cI={style:{"padding-left":"16px"}},AI={key:0};function pI(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("DiscountModal"),m=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",nI,[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"]))},[L(f(i.getDiscountButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",oI,f(i.getDiscountButtonLabel()),1)),s.discount.label?(r(),h("span",iI,f(s.discount.label),1)):B("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(H,{key:3},[t[4]||(t[4]=L(" | ",-1)),o("a",{href:"#",onClick:t[1]||(t[1]=Ne(_=>i.removeDiscount(),["prevent"]))},f(i.translate("Remove Discount")),1)],64)):B("",!0)]),o("td",null,f(s.discount.reason?s.discount.reason:"__"),1),o("td",null,[o("span",null,"- "+f(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",rI,[o("td",dI,f(i.translate("Upgrade Discount")),1),t[5]||(t[5]=o("td",null,null,-1)),o("td",null,f(e.formatNumberForOrder(a.order.manual_discount_total-a.order.config.prorate_credit,a.order)),1)]),o("tr",uI,[o("td",cI,f(i.translate("Prorate Credit")),1),t[6]||(t[6]=o("td",null,null,-1)),o("td",null,f(e.formatNumberForOrder(a.order.config.prorate_credit,a.order)),1)])],64)):B("",!0),n(m,{"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",AI,[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 bi=st(sI,[["render",pI]]),fI={name:"ShippingModal",props:["shipping","shipping_type"],setup(e,{emit:t}){const a=T(e.shipping_type);return{availableOptions:T([{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}}},mI={class:"fct-shipping-modal"},hI=["innerHTML"],_I={class:"dialog-footer"};function vI(e,t,a,l,s,i){const c=C("el-radio"),p=C("el-radio-group"),m=C("el-form-item"),_=C("el-col"),g=C("el-row"),y=C("el-input"),v=C("el-form"),w=C("el-button");return r(),h("div",mI,[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(m,{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,b)=>(r(),E(c,{label:k.value,key:b},{default:d(()=>[L(f(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(m,{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(m,{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,hI)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):B("",!0)]),_:1}),o("div",_I,[a.shipping.type?(r(),E(w,{key:0,type:"danger",onClick:l.removeShipping},{default:d(()=>[L(f(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):B("",!0),n(w,{type:"primary",onClick:l.updatingIsDone,disabled:l.isDisabledApplyButton()},{default:d(()=>[L(f(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const gI=st(fI,[["render",vI]]),yI={name:"Shipping",components:{IconButton:Ze,DynamicIcon:J,ShippingModal:gI},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=je.get("currency_signs",{}),t=je.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"?Y.validationErrors(t):Y.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>")}}},bI={key:1},wI={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},CI={key:0},kI={key:1,class:"max-w-[120px] block ml-auto text-right"},BI={key:2},xI={key:0},SI={key:0,class:"fct-shipping-methods-list-wrap"},FI={key:0,class:"charge"},$I={key:1,class:"fct-other-shipping-methods-list-wrap"},EI={key:0,class:"charge"},UI={key:1,class:"fct-no-shipping-methods-found"},II=["innerHTML"];function QI(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-input"),m=C("el-radio"),_=C("el-radio-group"),g=C("el-button"),y=C("el-dialog");return r(),h(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"]))},[L(f(i.getShippingButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",bI,f(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),h("div",wI,f(i.shippingTitle),1)):B("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),h("span",CI,[o("del",null,f(e.formatNumberForOrder(a.order.shipping_total,a.order)),1),L(" "+f(i.translate("Free")),1)])):B("",!0),a.shouldEnableEditing&&!i.hasFreeShipping()?(r(),h("span",kI,[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(()=>[L(f(i.currency),1)]),_:1},8,["modelValue"])])):(r(),h("span",BI,f(e.formatNumberForOrder(a.order.shipping_total-(a.order.tax_summary&&a.order.tax_summary.rcShippingAdjustment?a.order.tax_summary.rcShippingAdjustment:0))),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")},la({default:d(()=>[s.shippingModalIsOpen?(r(),h("div",xI,[s.shippingMethods.length||s.otherShippingMethods.length?(r(),h(H,{key:0},[s.shippingMethods.length?(r(),h("div",SI,[o("h3",null,f(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,w)=>(r(),E(m,{label:v.id,key:w},{default:d(()=>[L(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",FI,f(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",$I,[o("h3",null,f(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,w)=>(r(),E(m,{label:v.id,key:w},{default:d(()=>[L(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",EI,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):B("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):B("",!0)],64)):(r(),h("div",UI,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,II)]))])):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(()=>[L(f(i.translate("Cancel")),1)]),_:1}),n(g,{type:"primary",onClick:i.updateShipping},{default:d(()=>[L(f(i.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const Bd=st(yI,[["render",QI]]),DI={key:0},VI={class:"fct-admin-sidebar-item"},TI={class:"fct-admin-summary-item-list"},MI={class:"fct-admin-summary-item"},LI={class:"font-medium"},RI={key:0,class:"fct-admin-summary-item"},OI={class:"font-medium"},HI={key:1,class:"fct-admin-summary-item"},PI={class:"font-medium"},NI={key:2,class:"fct-admin-summary-item"},KI={class:"font-medium"},GI={key:3,class:"fct-admin-summary-item"},jI={class:"font-medium"},zI={key:4,class:"fct-admin-summary-item"},qI={class:"font-medium"},YI={key:5,class:"fct-admin-summary-item"},WI={class:"font-medium"},XI={class:"fct-admin-summary-item"},JI={class:"font-medium"},ZI={name:"UtmDetails",props:{order_operation:{type:Object}}},xp=Object.assign(ZI,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",DI,[n(xe,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",VI,[o("ul",TI,[o("li",MI,[o("span",LI,f(t.$t("UTM Campaign")),1),o("span",null,f(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",RI,[o("span",OI,f(t.$t("UTM Medium")),1),o("span",null,f(e.order_operation.utm_medium||"--"),1)])):B("",!0),e.order_operation.utm_source?(r(),h("li",HI,[o("span",PI,f(t.$t("UTM Source")),1),o("span",null,f(e.order_operation.utm_source||"--"),1)])):B("",!0),e.order_operation.utm_content?(r(),h("li",NI,[o("span",KI,f(t.$t("UTM Content")),1),o("span",null,f(e.order_operation.utm_content||"--"),1)])):B("",!0),e.order_operation.utm_id?(r(),h("li",GI,[o("span",jI,f(t.$t("UTM ID")),1),o("span",null,f(e.order_operation.utm_id||"--"),1)])):B("",!0),e.order_operation.utm_term?(r(),h("li",zI,[o("span",qI,f(t.$t("UTM Term")),1),o("span",null,f(e.order_operation.utm_term||"--"),1)])):B("",!0),e.order_operation.refer_url?(r(),h("li",YI,[o("span",WI,f(t.$t("Refer Url")),1),o("span",null,f(e.order_operation.refer_url||"--"),1)])):B("",!0),Array.isArray(e.order_operation.meta)?(r(!0),h(H,{key:6},ae(e.order_operation.meta,(l,s)=>(r(),h("li",XI,[o("span",JI,f(s),1),o("span",null,f(l||"--"),1)]))),256)):B("",!0)])])]),_:1})]),_:1})])):B("",!0)}}),e6={name:"TaxBreakdownBox",components:{InfoFilled:tl},props:{taxSummary:{type:Object,required:!0},order:{type:Object,required:!0},taxBreakdownShouldShow:{type:Boolean,default:!1}},methods:{translate:u}},t6={class:"fct-tax-sum-box"},a6={class:"fct-tax-sum-row fct-tax-breakdown-heading"},l6={class:"fct-tax-sum-row fct-tax-breakdown-col-headers"},s6={class:"fct-tax-breakdown-col-rate"},n6={class:"fct-tax-breakdown-col-base"},o6={class:"fct-tax-breakdown-col-tax"},i6={class:"fct-tax-breakdown-col-rate"},r6={class:"fct-tax-breakdown-col-base"},d6={class:"fct-tax-breakdown-col-tax"},u6={key:0,class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider fct-tax-sum-row--reversed"},c6={key:0},A6={key:1},p6={class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider"},f6={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},m6={key:1,class:"fct-tax-sum-row fct-tax-sum-row--divider"},h6={key:1,class:"fct-tax-sum-row fct-tax-sum-row--muted"},_6={key:2,class:"fct-tax-sum-row"},v6={key:5,class:"fct-tax-sum-row total-pay total-payable-tax-row"},g6={key:6,class:"fct-tax-sum-row fct-tax-sum-row--muted"},y6={key:2,class:"fct-tax-sum-row"},b6={class:"fct-tax-amount fct-tax-amount--reversed"},w6={key:3,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},C6={key:4,class:"fct-tax-sum-row fct-tax-sum-row--reversed"};function k6(e,t,a,l,s,i){const c=C("InfoFilled"),p=C("el-icon");return r(),h("div",t6,[a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length?(r(),h(H,{key:0},[o("div",a6,[o("span",null,f(i.translate("Tax breakdown by rate")),1),n(p,{class:"fct-tax-breakdown-info"},{default:d(()=>[n(c)]),_:1})]),o("div",l6,[o("span",s6,f(i.translate("Rate")),1),o("span",n6,f(i.translate("Taxable base")),1),o("span",o6,f(i.translate("Tax")),1)]),(r(!0),h(H,null,ae(a.taxSummary.foldedRateLines,(m,_)=>(r(),h("div",{key:"folded-rate-"+_,class:re(["fct-tax-sum-row fct-tax-breakdown-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",i6,f(m.label),1),o("span",r6,f(e.formatNumber(m.base)),1),o("span",d6,f(e.formatNumber(m.tax)),1)],2))),128)),a.order.is_reverse_charge_tax_order?(r(),h("div",u6,[o("span",null,f(i.translate("VAT reversed")),1),a.taxSummary.reversedTaxTotal>0?(r(),h("span",c6,f(e.formatNumber(a.taxSummary.reversedTaxTotal)),1)):(r(),h("span",A6,f(i.translate("Charge reversed")),1))])):(r(),h(H,{key:1},[o("div",p6,[o("span",null,f(i.translate("Total tax")),1),o("span",null,f(e.formatNumber(a.taxSummary.totalOrderTax)),1)]),a.taxSummary.includedInPrices>0?(r(),h("div",f6,[o("span",null,f(i.translate("of which included in prices")),1),o("span",null,f(e.formatNumber(a.taxSummary.includedInPrices)),1)])):B("",!0),a.taxSummary.payableTax>0&&a.taxSummary.includedInPrices>0?(r(),h("div",m6,[o("span",null,f(i.translate("Payable now (added)")),1),o("span",null,f(e.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,m=>(r(),h("div",{key:"tax-rate-line-"+m.rate_id+"-"+m.label,class:re(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.label),1),o("span",null,f(e.formatNumber(m.order_tax)),1)],2))),128)):B("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.inclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",h6,[o("span",null,f(i.translate("Included in item prices")),1),o("span",null,f(e.formatNumber(a.taxSummary.inclusiveTax)),1)])):B("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.exclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",_6,[o("span",null,f(i.translate("Added on products")),1),o("span",null,f(e.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,(m,_)=>(r(),h("div",{key:_,class:re(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.display_label),1),o("span",null,f(e.formatNumber(m.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,m=>(r(),h("div",{key:m.label,class:re(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(m.label),1),o("span",null,f(e.formatNumber(m.shipping_tax)),1)],2))),128)):(r(),h("div",{key:1,class:re(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(a.taxSummary.isShippingInclusive?i.translate("Included in shipping prices"):i.translate("Added on shipping")),1),o("span",null,f(e.formatNumber(a.taxSummary.shippingTax)),1)],2))],64)):B("",!0),a.taxSummary.payableTax>0?(r(),h("div",v6,[o("span",null,f(i.translate("Total payable tax")),1),o("span",null,f(e.formatNumber(a.taxSummary.payableTax)),1)])):B("",!0),a.taxSummary.inclusiveTax>0||a.taxSummary.inclusiveFeeTax>0?(r(),h("div",g6,[o("span",null,f(i.translate("Total tax in this order")),1),o("span",null,f(e.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",y6,[o("span",null,f(i.translate("Added on shipping")),1),o("span",b6,f(e.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",w6,[o("span",null,f(i.translate("Tax reversed")),1),o("span",null,f(e.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",C6,[o("span",null,f(i.translate("VAT reversed")),1),o("span",null,f(i.translate("Charge reversed")),1)])):B("",!0)])}const Dr=st(e6,[["render",k6]]),B6={name:"Transaction",components:{ConvertedTime:Na,Badge:fa,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 da}},methods:{translate:u,getCardBrand:Mc,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}))}}},x6={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},S6={class:"fct-table-mobile-header"},F6={class:"fct-table-mobile-header-left"},$6={class:"fct-table-status-col"},E6={class:"fct-table-date-col"},U6={class:"id"},I6={class:"fct-table-price-col"},Q6={class:"fct-table-mobile-body"},D6={class:"fct-table-mobile-body-list"},V6={class:"fct-table-mobile-method-col"},T6={class:"label"},M6={class:"value"},L6={class:"flex items-center gap-2.5"},R6={key:0,class:"w-7"},O6=["title","src","alt"],H6={key:1,class:"capitalize"},P6={key:2},N6={class:"fct-table-mobile-gateway-col"},K6={class:"label"},G6={class:"value"},j6={key:0},z6=["href"];function q6(e,t,a,l,s,i){const c=C("Badge"),p=C("el-tooltip"),m=C("ConvertedTime"),_=C("DynamicIcon"),g=C("el-button");return r(),h("div",x6,[(r(!0),h(H,null,ae(a.transactions,(y,v)=>{var w,k;return r(),h("div",{class:"fct-table-mobile-row",key:v},[o("div",S6,[o("div",F6,[o("div",$6,[(w=y==null?void 0:y.meta)!=null&&w.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 b,x;return[((b=y==null?void 0:y.meta)==null?void 0:b.disputed)==="yes"&&((x=y==null?void 0:y.meta)==null?void 0:x.dispute_resolved)==="no"?(r(),E(c,{key:0,status:y.status},{default:d(()=>[L(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"])):(r(),E(c,{key:1,status:y.status},{default:d(()=>[L(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(c,{key:1,status:y.status},{default:d(()=>[L(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]),o("div",E6,[o("span",U6,"#"+f(y.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),n(m,{"date-time":y.created_at},null,8,["date-time"])])]),o("div",I6,f(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:b=>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",Q6,[o("ul",D6,[o("li",V6,[o("div",T6,f(i.translate("Payment Method:")),1),o("div",M6,[o("div",L6,[i.getCardBrand(y.card_brand,y.payment_method_type)?(r(),h("div",R6,[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,O6)])):(r(),h("span",H6,f(y.payment_method_type),1)),y.card_last_4&&y.card_last_4!="0"?(r(),h("span",P6,f("..."+y.card_last_4),1)):B("",!0)])])]),o("li",N6,[o("div",K6,f(i.translate("Gateway ID:")),1),o("div",G6,[y.vendor_charge_id===""?(r(),h("span",j6,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:y.url},f(y.vendor_charge_id),9,z6))])])])])])}),128))])}const Sp=st(B6,[["render",q6]]),Y6={key:1,class:"fct-single-order-page"},W6={key:1,class:"fct-single-order-wrapper fct-layout-width"},X6={class:"single-page-header flex items-start justify-between"},J6={class:"single-page-header-title-wrap"},Z6={key:1},e9={key:2},t9={class:"single-page-header-status-wrap"},a9={class:"single-page-header-text"},l9={class:"capitalize"},s9={class:"fct-btn-group sm"},n9={class:"single-page-body"},o9={class:"fct-single-order"},i9={class:"fct-single-order-main"},r9={class:"fct-card-header-title is-small"},d9={key:0,class:"fct-browse-product-form-group pb-5"},u9={class:"fct-ordered-product-list-container"},c9={key:0,class:"fct-ordered-product-list-wrapper"},A9={class:"fct-media-content-list -mt-4 w-full"},p9={class:"align-top"},f9=["rowspan"],m9={class:"product-thumbnail w-[46px] flex-shrink-0"},h9=["href"],_9=["src","alt"],v9=["src","alt"],g9={class:""},y9={class:"product-details-content-row"},b9={class:"product-details-content-first flex flex-col"},w9={class:"product-title m-0"},C9=["href"],k9={key:0,class:"product-variation-title m-0"},B9={key:2,class:"product-subscription-info"},x9=["innerHTML"],S9=["innerHTML"],F9={key:0,class:"product-details-quantity"},$9={key:1,class:"product-details-price-mobile"},E9={class:"product-details-quantity"},U9={key:0,class:"del"},I9={class:"product-details-price-mobile"},Q9={key:0,class:"del"},D9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},V9={key:0,class:"del"},T9={class:"fct-order-item-qty-col text-right whitespace-nowrap"},M9={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},L9={class:"product-details-quantity"},R9={key:0,class:"del"},O9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},H9={class:"fct-order-item-price-col text-right whitespace-nowrap"},P9={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},N9={key:0,class:"flex items-center"},K9={class:"del line-through text-xs font-normal opacity-60 leading-tight"},G9={colspan:"2",class:""},j9={class:"fct-tax-badge"},z9={class:"text-right"},q9={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},Y9={class:"pb-2"},W9={key:1},X9={colspan:"2",class:""},J9={class:"text-xs text-system-mid dark:text-gray-300"},Z9={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},eQ={colspan:"2",class:"pb-2"},tQ={class:"fct-tax-badge"},aQ={class:"text-right pb-2"},lQ={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},sQ={class:"pb-2"},nQ={key:3},oQ={colspan:"3"},iQ={class:"product-details-action-row"},rQ=["onClick"],dQ=["onClick"],uQ={key:1,class:"m-0 text-center"},cQ={class:"fct-card-header-title is-small"},AQ={class:"fct-table-border fct-table-order-details"},pQ={key:0},fQ={key:3},mQ={key:4},hQ={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},_Q={key:5},vQ={colspan:"3",class:"fct-tax-summary-cell"},gQ={key:0,class:"fct-tax-simple-line",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},yQ={style:{display:"flex","align-items":"center",gap:"6px"}},bQ={href:"javascript:void(0)",class:"fct-tax-see-details"},wQ={class:"total-amount-tr"},CQ={class:"payment-tr"},kQ={key:6,class:"payment-tr"},BQ={key:7,class:"payment-tr"},xQ={class:"font-semibold"},SQ={key:8,class:"payment-tr"},FQ={class:"font-semibold"},$Q={key:9,class:"payment-tr total-refund-owed-tr"},EQ={class:"flex flex-end m-0 items-center"},UQ={class:"font-semibold"},IQ={class:"fct-single-order-aside"},QQ={class:"fct-admin-sidebar"},DQ={key:0},VQ={class:"fct-adjust-quantity-modal-content"},TQ={class:"title"},MQ={class:"fct-form-group"},LQ={class:"dialog-footer"},RQ={key:0},OQ={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:wd,Alert:Ja,Transaction:Cd,Plans:Cp,Badge:fa,Refresh:td,ElMessageBox:Xa,CopyToClipboard:Ia,Notes:gi,Coupon:yi,CustomDiscount:bi,OrderCustomerInformation:Zo,ShippingComponent:Bd,UtmDetails:xp,TaxBreakdownBox:Dr,OrderUpDownIndicator:Ic,TransactionMobile:Sp,BundleProducts:So,Promotion:Id},provide(){return{triggerChange:this.triggerChange}},data(){return{notFound:{show:!1,message:"",buttonText:"",route:""},warningMessage:"",loading:!1,calculating:!1,customModal:!1,canceling_subscription:!1,reactivate_subscription:!1,fetching_subscription:!1,pausing_subscription:!1,resuming_subscription:!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`${je.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(){Xa.confirm(u("Are you sure you want to send a payment reminder email for this order?"),u("Send Payment Reminder"),{type:"info",icon:Gs(Id),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});Y.success(s.message||u("Payment reminder sent successfully"))}catch(s){Y.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,Y.success(e.message),this.fetch()}).catch(e=>{var t;this.markingOrderAsPaid=!1,e.status_code=="422"?Y.validationErrors(e):Y.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=je.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?Y.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():kd(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=>{Y.success(l.message),this.fetch()}).catch(l=>{var s;l.status_code=="422"?Y.validationErrors(l):Y.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=rm(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}),kp(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(),Be(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(Y.error(rt.get(e,"data.message")||u("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?Y.validationErrors(e):Y.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"?Y.validationErrors(t):Y.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:Df,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},(je.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)}},HQ=Object.assign(OQ,{setup(e){const t=T(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(s,i)=>{var U,O;const c=C("el-breadcrumb-item"),p=C("el-tooltip"),m=C("el-breadcrumb"),_=C("el-button"),g=C("el-input"),y=C("router-link"),v=C("el-icon"),w=C("el-popover"),k=C("el-dropdown-item"),b=C("el-dropdown-menu"),x=C("el-dropdown"),F=C("el-option"),M=C("el-select"),$=C("el-form-item"),S=C("el-form"),I=C("el-dialog"),Q=C("el-skeleton-item"),D=C("el-skeleton"),V=Ma("loading");return r(),h(H,null,[s.notFound.show?(r(),E(ai,{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",Y6,[n(sn,{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(XU,{key:0})):B("",!0),s.order?(r(),h("div",W6,[!s.loading&&s.order?(r(),h(H,{key:0},[o("div",X6,[o("div",null,[o("div",J6,[n(m,{"separator-icon":A(dl)},{default:d(()=>[n(c,{to:{name:"orders"}},{default:d(()=>[L(f(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]=R=>s.getOrderUrl(s.parentOrderId))}," #"+f(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,"#"+f(s.orderUuidDisplay),1)]),_:1},8,["content"])):s.orderUuid?(r(),h("span",Z6,"#"+f(s.orderUuidDisplay),1)):(r(),h("span",e9,"#"+f(A(Zt)(e.order_id)),1))]),_:1})]),_:1},8,["separator-icon"]),o("div",t9,[n(fa,{status:s.order.status},null,8,["status"]),s.order.is_b2b_order?(r(),E(fa,{key:0,type:"blue",text:A(u)("B2B")},null,8,["text"])):B("",!0),n(Ic,{order:s.order},null,8,["order"])])]),o("div",a9,[n(Na,{"date-time":s.order.created_at,"with-time":""},null,8,["date-time"]),i[23]||(i[23]=o("span",{class:"fct_separator"},null,-1)),s.order.invoice_no?(r(),h(H,{key:0},[o("span",null,f(s.order.invoice_no),1),i[22]||(i[22]=o("span",{class:"fct_separator"},null,-1))],64)):B("",!0),o("span",l9,f(s.order.type),1)])]),o("div",s9,[s.shouldShowRefund()?(r(),E(_,{key:0,onClick:i[1]||(i[1]=R=>s.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:d(()=>[L(f(A(u)("Refund")),1)]),_:1})):B("",!0),s.isEditingItem?(r(),E(_,{key:2,onClick:s.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[L(f(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(()=>[L(f(s.warningMessage),1)]),default:d(()=>[L(" "+f(A(u)("Edit")),1)]),_:1})):(r(),h(H,{key:1},[L(f(A(u)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),n(wd,{onReload:i[2]||(i[2]=R=>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",n9,[(r(!0),h(H,null,ae(s.actionableActivities,R=>(r(),E(Ja,{class:"mb-5",type:"error",key:R.id,content:R==null?void 0:R.content,closable:"",onClose:P=>s.clearActivityAction(R)},null,8,["content","onClose"]))),128)),o("div",o9,[o("div",i9,[n(xe,{class:"overflow-hidden fct-order-items-card"},{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>{var R,P;return[o("h2",r9,[L(f(A(u)("Order items"))+" ",1),((R=s.order)==null?void 0:R.fulfillment_type)==="physical"?(r(),E(fa,{key:0,status:(P=s.order)==null?void 0:P.shipping_status},{default:d(()=>{var j;return[L(f((j=s.order)==null?void 0:j.shipping_status),1)]}),_:1},8,["status"])):B("",!0)])]}),_:1}),n(Ce,null,{default:d(()=>[s.isEditingItem?(r(),h("div",d9,[n(g,{placeholder:A(u)("Search products..."),onKeyup:i[3]||(i[3]=R=>a()),modelValue:s.searchQuery,"onUpdate:modelValue":i[4]||(i[4]=R=>s.searchQuery=R)},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(_,{onClick:l,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[L(f(A(u)("Browse")),1)]),_:1})])):B("",!0),o("div",u9,[s.order.order_items.length>0?(r(),h("div",c9,[o("table",A9,[o("tbody",null,[(r(!0),h(H,null,ae(s.order.order_items,(R,P)=>{var j,q,z,X,ne,he,N,G,Z,W,ie,ye,fe,ge;return r(),h(H,{key:P},[R.payment_type!=="signup_fee"&&R.payment_type!=="fee"&&((j=R==null?void 0:R.other_info)==null?void 0:j.item_status)!=="adjusted"&&s.shouldSkipAdjustmentItem(R)?(r(),h(H,{key:0},[o("tr",p9,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(R)},[o("div",m9,[R!=null&&R.is_custom?(r(),h("a",{key:0,href:(q=R==null?void 0:R.other_info)==null?void 0:q.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[o("img",{src:R.featured_media!=null?R.featured_media:s.getImageUrl(R),alt:R.title,class:re([s.getClass(R),"h-full object-contain rounded"])},null,10,_9)],8,h9)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:R==null?void 0:R.post_id}}},{default:d(()=>[o("img",{src:R.featured_media!=null?R.featured_media:s.getImageUrl(R),alt:R.title,class:re([s.getClass(R),"h-full object-contain rounded"])},null,10,v9)]),_:2},1032,["to"]))])],8,f9),o("td",g9,[o("div",y9,[o("div",b9,[o("div",w9,[R!=null&&R.is_custom?(r(),h("a",{key:0,href:(z=R==null?void 0:R.other_info)==null?void 0:z.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},f(R==null?void 0:R.post_title),9,C9)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:R==null?void 0:R.post_id}}},{default:d(()=>[L(f(R==null?void 0:R.post_title),1)]),_:2},1032,["to"]))]),(R!=null&&R.variation_display_title||R!=null&&R.title)&&(R==null?void 0:R.title)!==(R==null?void 0:R.post_title)?(r(),h("div",k9," – "+f((R==null?void 0:R.variation_display_title)||(R==null?void 0:R.title)),1)):B("",!0),R.bundle_items.length>0?(r(),E(So,{key:1,product:R},null,8,["product"])):B("",!0),(R==null?void 0:R.payment_type)==="subscription"?(r(),h("div",B9,[o("div",{innerHTML:R==null?void 0:R.payment_info},null,8,x9),((X=R==null?void 0:R.other_info)==null?void 0:X.manage_setup_fee)==="yes"?(r(),h("div",{key:0,innerHTML:R==null?void 0:R.setup_info},null,8,S9)):B("",!0)])):B("",!0)]),s.isEditingItem?(r(),h("div",F9,[o("span",null,f(s.formatNumber(R.unit_price)),1),i[24]||(i[24]=o("span",null,"x",-1)),o("span",null,f(A(Zt)(R.quantity)),1)])):B("",!0),s.isEditingItem?B("",!0):(r(),h("div",$9,[o("div",E9,[((ne=R==null?void 0:R.variants)==null?void 0:ne.length)>0?(r(),h("span",U9,f(s.formatNumber(R.variants.compare_price)),1)):B("",!0),o("span",null,f(s.formatNumber(R.unit_price)),1),i[25]||(i[25]=o("span",null,"x",-1)),o("span",null,f(A(Zt)(R.quantity)),1)])])),R.bundle_items.length>0?(r(),E(So,{key:2,product:R},null,8,["product"])):B("",!0)]),o("div",I9,[((he=R==null?void 0:R.variants)==null?void 0:he.length)>0?(r(),h("span",Q9,f(s.formatNumber(R.variants.compare_price)),1)):B("",!0),R.line_meta&&R.line_meta.original_unit_price?(r(),h("span",D9,f(s.formatNumber(R.line_meta.original_unit_price)),1)):B("",!0),o("span",null,f(s.formatNumber(R.unit_price)),1),i[27]||(i[27]=o("span",null,"×",-1)),o("span",null,f(A(Zt)(R.quantity)),1),((N=R==null?void 0:R.other_info)==null?void 0:N.item_status)!=="adjusted"?(r(),h(H,{key:2},[i[26]||(i[26]=o("span",{class:"text-system-mid"},"·",-1)),R.coupon_discount>0?(r(),h("span",V9,f(s.formatNumber(R.subtotal)),1)):B("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(R))),1)],64)):B("",!0)])]),o("td",T9,[s.isEditingItem?B("",!0):(r(),h("div",M9,[o("div",L9,[((G=R==null?void 0:R.variants)==null?void 0:G.length)>0?(r(),h("span",R9,f(s.formatNumber(R.variants.compare_price)),1)):B("",!0),R.line_meta&&R.line_meta.original_unit_price?(r(),h("span",O9,f(s.formatNumber(R.line_meta.original_unit_price)),1)):B("",!0),o("span",null,f(s.formatNumber(R.unit_price)),1),i[28]||(i[28]=o("span",null,"x",-1)),o("span",null,f(A(Zt)(R.quantity)),1),s.shouldShowUnitPriceRoundingTooltip(R)?(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(tl))]),_:1})]),_:1},8,["content"])):B("",!0)])]))]),o("td",H9,[o("div",P9,[((Z=R==null?void 0:R.other_info)==null?void 0:Z.item_status)!=="adjusted"?(r(),h(H,{key:0},[R.coupon_discount>0?(r(),h("div",N9,[o("span",K9,f(s.formatNumber(R.subtotal)),1)])):B("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(R))),1)],64)):B("",!0)])])]),s.taxSummary.displayMode!=="simplified"?(r(),h(H,{key:0},[s.getItemTaxRates(R).length?(r(!0),h(H,{key:0},ae(s.getItemTaxRates(R),(se,pe)=>{var $e,tt,_e;return r(),h("tr",{key:"tax-rate-"+pe,class:re(R.line_meta&&R.line_meta.tax_config&&R.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[o("td",G9,[o("span",j9,f(s.formatTaxRateBadge(se)),1)]),o("td",z9,[o("span",{class:re(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!((tt=($e=R.line_meta)==null?void 0:$e.tax_config)!=null&&tt.inclusive)||((_e=s.orderSettings)==null?void 0:_e.reverse_charge_price_mode)==="dynamic")}])},[R.line_meta&&R.line_meta.tax_config&&R.line_meta.tax_config.inclusive?(r(),h(H,{key:0},[L(f(A(u)("incl.")),1)],64)):(r(),h(H,{key:1},[L("+")],64)),L(" "+f(s.formatNumber(se.tax_amount)),1)],2)])],2)}),128)):R.tax_amount>0?(r(),h("tr",q9,[o("td",Y9,f(A(u)("Tax"))+": "+f(s.formatNumber(R.tax_amount)),1)])):B("",!0)],64)):B("",!0),((W=R==null?void 0:R.other_info)==null?void 0:W.manage_setup_fee)==="yes"?(r(),h("tr",W9,[o("td",X9,[o("span",J9,f(R==null?void 0:R.other_info.signup_fee_name),1)]),o("td",Z9," + "+f(s.formatNumber(((ie=R==null?void 0:R.other_info)==null?void 0:ie.setup_fee_per_item)==="yes"?R.other_info.signup_fee*R.quantity:R.other_info.signup_fee)),1)])):B("",!0),s.taxSummary.displayMode!=="simplified"?(r(),h(H,{key:2},[s.getSubscriptionSetupFeeTaxRates(R).length?(r(!0),h(H,{key:0},ae(s.getSubscriptionSetupFeeTaxRates(R),(se,pe)=>{var $e;return r(),h("tr",{key:"setup-tax-rate-"+pe,class:re(s.isSubscriptionSetupFeeInclusive(R)?"is-inclusive":"is-exclusive")},[o("td",eQ,[o("span",tQ,f(A(u)("Setup fee"))+": "+f(s.formatTaxRateBadge(se)),1)]),o("td",aQ,[o("span",{class:re(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(R)||(($e=s.orderSettings)==null?void 0:$e.reverse_charge_price_mode)==="dynamic")}])},[s.isSubscriptionSetupFeeInclusive(R)?(r(),h(H,{key:0},[L(f(A(u)("incl.")),1)],64)):B("",!0),L(f(s.formatNumber(se.tax_amount)),1)],2)])],2)}),128)):((ye=R==null?void 0:R.other_info)==null?void 0:ye.signup_fee_tax)>0&&((fe=R==null?void 0:R.other_info)==null?void 0:fe.manage_setup_fee)==="yes"?(r(),h("tr",lQ,[o("td",sQ,[L(f(A(u)("Setup fee tax"))+": ",1),o("span",{class:re(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(R)||((ge=s.orderSettings)==null?void 0:ge.reverse_charge_price_mode)==="dynamic")}])},f(s.formatNumber(R.other_info.signup_fee_tax)),3)])])):B("",!0)],64)):B("",!0),s.isEditingItem?(r(),h("tr",nQ,[o("td",oQ,[o("div",iQ,[o("a",{href:"#",onClick:Ne(se=>s.handleAdjustQuantityModal(R),["prevent"])},f(A(u)("Adjust Quantity")),9,rQ),o("a",{href:"#",onClick:Ne(se=>s.deleteProduct(P,R),["prevent"])},f(A(u)("Remove Item")),9,dQ)])])])):B("",!0),i[29]||(i[29]=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",uQ,f(A(u)("No items found.")),1)):B("",!0)])]),_:1})]),_:1}),n(xe,{class:"fct-order-payment-card"},{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h2",cQ,[o("span",null,f(A(u)("Payment")),1),n(fa,{status:s.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),n(Ce,null,{default:d(()=>{var R,P,j,q,z,X,ne;return[o("table",AQ,[o("tbody",null,[o("tr",null,[o("td",null,f(A(u)("Subtotal")),1),o("td",null,[s.order.order_items.length>0?(r(),h("span",pQ,f(A(Zt)(s.uniqueItemsCount))+" "+f(A(ko)("item","items",s.uniqueItemsCount)),1)):B("",!0)]),o("td",null,f(s.formatNumber(s.order.subtotal)),1)]),n(Bd,{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,he=>(r(),h("tr",{key:"fee-"+he.id},[o("td",null,f(he.title),1),i[30]||(i[30]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(he.subtotal)),1)]))),128)):B("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(r(),E(yi,{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(bi,{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",fQ,[o("td",null,f(A(u)("Coupon Discount")),1),i[31]||(i[31]=o("td",null,null,-1)),o("td",null,"- "+f(s.formatNumber(s.order.coupon_discount_total)),1)])):B("",!0),s.isEditingItem?(r(),h("tr",mQ,[o("td",hQ,f(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",_Q,[o("td",vQ,[s.taxSummary.displayMode==="simplified"&&s.taxSummary.simpleLine?(r(),h("div",gQ,[o("span",yQ,[o("span",null,f(s.taxSummary.simpleLine.label),1),s.taxSummary.simpleLine.hasDetails?(r(),E(w,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:d(()=>[o("a",bQ,f(A(u)("See details"))+" ▾",1)]),default:d(()=>[n(Dr,{"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,f(s.taxSummary.simpleLine.value),1)])):(r(),E(Dr,{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",wQ,[o("td",null,f(A(u)("Total")),1),i[32]||(i[32]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(s.order.total_amount-(s.taxSummary.rcTotalAdjustment||0))),1)]),o("tr",CQ,[o("td",null,f(A(u)("Total Paid")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",null,f(s.formatNumber((R=s.order)==null?void 0:R.total_paid)),1)]),((P=s.order)==null?void 0:P.total_refund)>0?(r(),h("tr",kQ,[o("td",null,f(A(u)("Total Refund")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",null,"- "+f(s.formatNumber((j=s.order)==null?void 0:j.total_refund)),1)])):B("",!0),s.order.total_paid-((q=s.order)==null?void 0:q.total_refund)!=0?(r(),h("tr",BQ,[o("td",null,f(A(u)("Net Payment")),1),i[35]||(i[35]=o("td",null,null,-1)),o("td",xQ,f(s.getNetPayment()),1)])):B("",!0),s.order.total_amount-((z=s.order)==null?void 0:z.total_paid)>0?(r(),h("tr",SQ,[o("td",null,f(A(u)("Total Due")),1),i[36]||(i[36]=o("td",null,null,-1)),o("td",FQ,f(s.getTotalDue()),1)])):B("",!0),s.order.total_amount-(((X=s.order)==null?void 0:X.total_paid)-((ne=s.order)==null?void 0:ne.total_refund))<0?(r(),h("tr",$Q,[o("td",null,[o("p",EQ,[n(A(Rf),{class:"w-6 text-amber-500 mr-2"}),L(" "+f(A(u)("Total Refund Owed")),1)])]),i[37]||(i[37]=o("td",null,null,-1)),o("td",UQ,f(s.getDueRefund()),1)])):B("",!0)])])]}),_:1})]),_:1}),s.order.transactions&&s.order.transactions.length?Gt((r(),E(xe,{key:0,"element-loading-text":"Cancelling in progress...",class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Transaction Details"),border_bottom:"",title_size:"small"},{action:d(()=>{var R;return[s.order.total_amount-((R=s.order)==null?void 0:R.total_paid)>0&&s.order.status!=="canceled"&&s.markingOrderAsPaid===!1?(r(),E(x,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s.handleCommand},{dropdown:d(()=>[n(b,null,{default:d(()=>[n(k,{command:"custom-payment-link"},{default:d(()=>[L(f(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(tl))]),_:1})]),_:1},8,["content"])]),_:1}),n(k,{command:"mark-order-paid"},{default:d(()=>[L(f(A(u)("Mark order as paid")),1)]),_:1}),s.canSendPaymentReminder?(r(),E(k,{key:0,command:"send-payment-reminder",disabled:s.sendingPaymentReminder},{default:d(()=>[L(f(A(u)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):B("",!0)]),_:1})]),default:d(()=>[n(_,{size:"small"},{default:d(()=>[L(f(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(Cd,{onReload:i[5]||(i[5]=R=>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(Sp,{onReload:i[6]||(i[6]=R=>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})),[[V,s.canceling_subscription]]):B("",!0),n(I,{title:A(u)("Mark as paid"),modelValue:s.transactionMedium,"onUpdate:modelValue":i[10]||(i[10]=R=>s.transactionMedium=R)},{footer:d(()=>[Gt((r(),E(_,{plan:"",type:"primary",onClick:s.markOrderAsPaid,disabled:s.markingOrderAsPaid},{default:d(()=>[L(f(A(u)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[V,s.markingOrderAsPaid]])]),default:d(()=>[o("div",null,[n(S,{"label-position":"top"},{default:d(()=>[n($,{"label-position":"top",label:A(u)("Payment method")},{default:d(()=>[n(M,{modelValue:s.otherData.payment_method,"onUpdate:modelValue":i[7]||(i[7]=R=>s.otherData.payment_method=R)},{default:d(()=>[(r(!0),h(H,null,ae(s.paymentMethodOption,R=>(r(),E(F,{key:R.value,label:R.name,value:R.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n($,{"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]=R=>s.otherData.vendor_charge_id=R)},null,8,["modelValue"])]),_:1},8,["label"]),n($,{"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]=R=>s.otherData.mark_paid_note=R)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),s.order.licenses?(r(),E(xe,{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(Wr,{licenses:s.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):B("",!0),n(xe,{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(Vc,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",IQ,[o("div",QQ,[(r(!0),h(H,null,ae(s.order.subscriptions,(R,P)=>(r(),E(d5,{key:R.id,subscription:R,order:s.order,orderId:e.order_id,index:P,onFetchOrder:i[11]||(i[11]=j=>s.$emit("fetch")),onReload:i[12]||(i[12]=j=>s.reloadOrder()),getOrderUrl:s.getOrderUrl},null,8,["subscription","order","orderId","index","getOrderUrl"]))),128)),s.order.customer?(r(),E(Zo,{key:0,order:s.order,shouldEnableEditing:!0,onOnOrderUpdated:s.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):B("",!0),n(gi,{orderId:s.order.id,note:s.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),n(Jo,{"bind-to-id":s.order.id,"bind-to-type":"Order",selectedLabels:s.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(U=s.order)!=null&&U.order_operation?(r(),E(xp,{key:1,order_operation:(O=s.order)==null?void 0:O.order_operation},null,8,["order_operation"])):B("",!0)]),s.order?(r(),h("div",DQ,[n(rn,{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(I,{modelValue:s.adjustQuantityModal,"onUpdate:modelValue":i[15]||(i[15]=R=>s.adjustQuantityModal=R),title:A(u)("Adjust Quantity"),width:"35%","align-center":"","append-to-body":!0,class:"fct-adjust-quantity-modal",onClose:i[16]||(i[16]=()=>{s.adjustQuantityModal=!1,s.adjustItem={},s.tmpAdjustedItem={}})},{footer:d(()=>[o("div",LQ,[n(_,{onClick:i[13]||(i[13]=R=>s.adjustQuantityModal=!1),type:"info",soft:""},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(_,{type:"primary",onClick:i[14]||(i[14]=R=>s.saveAdjustedProductQuantity(s.tmpAdjustedItem))},{default:d(()=>[L(f(A(u)("Done")),1)]),_:1})])]),default:d(()=>[o("div",VQ,[o("div",TQ,[i[38]||(i[38]=L(" Adjust the quantity for ",-1)),o("strong",null,f(s.adjustItem.variation_display_title||s.adjustItem.title),1)]),o("div",MQ,[o("label",null,f(A(u)("Quantity")),1),s.isEditingItem?(r(),E(wp,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):B("",!0)])])]),_:1},8,["modelValue","title"]),n(bp,{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(I,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":i[17]||(i[17]=R=>s.createProductModal=R),title:A(u)("Add New Product")},{default:d(()=>[s.createProductModal?(r(),h("div",RQ,[n(fi,{customModal:"order_modal","onUpdate:createProductModal":s.updateProductModal,onProcess_custom:s.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"]),n(I,{"append-to-body":!0,modelValue:s.showRefundModal,"onUpdate:modelValue":i[19]||(i[19]=R=>s.showRefundModal=R),title:A(u)("Refund Transaction"),onClose:i[20]||(i[20]=()=>{s.changes_made=0,s.showRefundModal=!1,s.fetch()})},{default:d(()=>[Gt(n(UU,{"element-loading-text":A(u)("Refund initiating on remote..."),order_id:e.order_id,order:s.order,showRefundModal:s.showRefundModal,onProcessing_refund:i[18]||(i[18]=R=>s.processing_refund=R),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"]),[[V,s.processing_refund]])]),_:1},8,["modelValue","title"]),s.loading?(r(),E(D,{key:0,animated:""},{default:d(()=>[n(Q),n(Q),n(Q)]),_:1})):B("",!0),n(I,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":i[21]||(i[21]=R=>s.nextInvoiceModal=R),title:A(u)("Custom payment link")},{default:d(()=>[n(NU,{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)}}}),PQ={class:"fct-create-order-wrapper fct-layout-width"},NQ={class:"single-page-header"},KQ={class:"single-page-header-title-wrap"},GQ={class:"single-page-body"},jQ={class:"fct-create-order"},zQ={class:"fct-create-order-main"},qQ={class:"fct-browse-product-form-group pb-5 mx-5"},YQ={key:0,class:"fct-table-wrap fct-table-transparent-header"},WQ={class:"fct-product-info-card"},XQ={class:"fct-product-info-media"},JQ=["src","alt"],ZQ={class:"fct-product-info-details"},eD={class:"fct-product-info-name"},tD={class:"product-sub-name product-sub-name--wrap"},aD={class:"mt-1"},lD={key:0,class:"line-through mr-3"},sD={key:1},nD={key:0},oD={class:"fct-input-number-wrap"},iD={key:0},rD={key:0},dD={key:1},uD={key:0},cD={class:"fct-table-border fct-table-order-details"},AD={key:0},pD={key:3},fD={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},mD={class:"fct-create-order-aside"},hD={class:"fct-admin-sidebar"},_D={key:0},vD={name:"CreateOrder",components:{OrderBulkActions:wd,Transaction:Cd,Badge:fa,IconButton:Ze,CopyToClipboard:Ia,Notes:gi,Coupon:yi,CustomDiscount:bi,OrderCustomerInformation:Zo,Shipping:Bd},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():kd(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:at.tz.guess(),trigger:"on_admin_create"}).then(t=>{Y.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"?Y.validationErrors(t):Y.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=rt.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}}},gD=Object.assign(vD,{setup(e){const t=T(),a=T(!0),l=()=>t.value.fetchBySearch(),s=()=>{l()};return(i,c)=>{const p=C("el-breadcrumb-item"),m=C("el-breadcrumb"),_=C("el-input"),g=C("el-button"),y=C("router-link"),v=C("el-table-column"),w=C("el-input-number"),k=C("el-table"),b=C("el-dialog"),x=Ma("loading");return r(),h("div",PQ,[n(sn,{isActive:i.changes_made>0?"is-active":"",onDiscard:i.reloadOrder,onSave:i.update,loading:i.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",NQ,[o("div",KQ,[n(m,{"separator-icon":A(dl)},{default:d(()=>[n(p,{to:{name:"orders"}},{default:d(()=>[L(f(i.$t("Orders")),1)]),_:1}),n(p,null,{default:d(()=>[L(f(i.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),o("div",GQ,[o("div",jQ,[o("div",zQ,[n(xe,{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",qQ,[n(_,{placeholder:i.$t("Search products..."),onKeyup:c[0]||(c[0]=F=>l()),modelValue:i.searchQuery,"onUpdate:modelValue":c[1]||(c[1]=F=>i.searchQuery=F)},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(g,{onClick:s,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[L(f(i.$t("Browse")),1)]),_:1})]),i.order.order_items.length>0?(r(),h("div",YQ,[Gt((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(F=>{var M,$,S,I;return[o("div",WQ,[o("div",XQ,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:F.row.post_id}}},{default:d(()=>[o("img",{src:i.getImageUrl(F.row.featured_media,i.appVars.asset_url),alt:F.row.title,class:re(i.getClass(F.row.featured_media))},null,10,JQ)]),_:2},1032,["to"])]),o("div",ZQ,[o("div",eD,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:F.row.post_id}}},{default:d(()=>[L(f(F.row.post_title)+" ",1),o("span",tD,"- "+f(F.row.variation_display_title||F.row.title),1)]),_:2},1032,["to"])]),o("div",aD,[L(f(i.formatNumber(F.row.price))+" ",1),parseInt(F.row.unit_price)>parseInt(F.row.price)?(r(),h("span",lD,f(i.formatNumber(F.row.unit_price)),1)):B("",!0),F.row.payment_type==="subscription"&&(($=(M=F.row)==null?void 0:M.other_info)==null?void 0:$.manage_setup_fee)==="yes"?(r(),h("div",sD,[o("span",null,f(F.row.other_info.signup_fee_name)+" : "+f(i.formatNumber(F.row.other_info.signup_fee)),1),((I=(S=F.row)==null?void 0:S.other_info)==null?void 0:I.setup_fee_per_item)=="yes"?(r(),h("span",nD,[c[6]||(c[6]=o("span",null,"x",-1)),o("span",null,f(F.row.quantity),1)])):B("",!0)])):B("",!0)])])])]}),_:1},8,["label"]),n(v,{width:"120",label:i.$t("Quantity")},{default:d(F=>[o("div",oD,[n(wp,{item:F.row,"onUpdate:value":i.updateQuantity,isDisabled:i.isDisabled(F.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),n(v,{width:120,label:i.$t("Total")},{default:d(F=>{var M,$,S,I;return[o("div",null,f(i.formatNumber(F.row.line_total)),1),F.row.payment_type=="subscription"&&(($=(M=F.row)==null?void 0:M.other_info)==null?void 0:$.manage_setup_fee)=="yes"?(r(),h("div",iD,[c[7]||(c[7]=o("span",null,"+",-1)),((I=(S=F.row)==null?void 0:S.other_info)==null?void 0:I.setup_fee_per_item)=="yes"?(r(),h("span",rD,[o("span",null,f(i.formatNumber(F.row.other_info.signup_fee*F.row.quantity)),1)])):(r(),h("span",dD,f(i.formatNumber(F.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(F=>[F.row.payment_type==="subscription"?(r(),h("div",uD,[n(w,{modelValue:F.row.custom_price,"onUpdate:modelValue":M=>F.row.custom_price=M,min:0,precision:2,step:.01,"controls-position":"right",placeholder:i.$t("Custom price"),size:"small",onChange:M=>i.updateCustomPrice(F.row),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder","onChange"])])):B("",!0)]),_:1},8,["label"])):B("",!0),n(v,{width:50},{default:d(F=>[n(Ze,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ne(M=>i.deleteProduct(F.$index,F.row),["prevent"])},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[x,i.calculating]])])):B("",!0)]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Qe,{border_bottom:"",title:i.$t("Payment"),title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("table",cD,[o("tbody",null,[o("tr",null,[o("td",null,f(i.$t("Subtotal")),1),o("td",null,[i.order.order_items.length>0?(r(),h("span",AD,f(A(Zt)(i.order.order_items.length))+" "+f(i.order.order_items.length===1?i.$t("item"):i.$t("items")),1)):B("",!0)]),o("td",null,f(i.formatNumber(i.order.subtotal)),1)]),i.order.order_items.length>0&&!i.discount.value?(r(),E(yi,{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(bi,{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",pD,[o("td",fD,f(i.$t("Tax will be calculated on save")),1)])):B("",!0)]),o("tfoot",null,[o("tr",null,[o("td",null,f(i.$t("Total")),1),c[8]||(c[8]=o("td",null,null,-1)),o("td",null,f(i.formatNumber(i.order.total_amount)),1)])])])]),_:1})]),_:1})]),o("div",mD,[o("div",hD,[n(gi,{note:i.order.note,onWhenNoteEditIsDone:c[2]||(c[2]=F=>{i.saveNoteModal(F)})},null,8,["note"]),n(Zo,{order:i.order,onOnAddressSelected:c[3]||(c[3]=F=>{if(i.fetchShippingMethods(),F===null){i.selectedCustomerCountry="",i.selectedCustomerAddress=null;return}i.selectedCustomerCountry=F.country,i.selectedCustomerAddress=F,F.type==="shipping"?i.order.shipping_address_id=F.id:i.order.billing_address_id=F.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(Jo,{selectedLabels:i.selectedLabels,"onUpdate:updateLabel":i.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),n(bp,{ref_key:"productItemModal",ref:t,searchQueryParent:i.searchQuery,orderParent:i.order,"onUpdate:searchQuery":i.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),n(b,{"append-to-body":!0,modelValue:i.createProductModal,"onUpdate:modelValue":c[5]||(c[5]=F=>i.createProductModal=F),title:i.$t("Add New Product")},{default:d(()=>[i.createProductModal?(r(),h("div",_D,[n(fi,{customModal:"order_modal","onUpdate:createProductModal":i.updateProductModal,onProcess_custom:i.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"])])])}}});class yD extends nl{constructor(){super(...arguments);Re(this,"data",{form:pd()})}get controllerKey(){return"Customer"}}function Fp(){return yD.init()}const bD={class:"setting-wrap"},wD={class:"setting-wrap-inner"},CD={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},kD={class:"grid gap-3 mb-6"},BD={class:"grid gap-3 mb-6"},xD={class:"grid gap-3 mb-6"},SD={class:"grid gap-3"},vs=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=Fp(),{form:a}=t.data,l=ps(),s=T([]),i=T([]),c=T(!0),p=T(!1),m=T(!0),_=T({}),g=ll(),y=T(g.name),v=T(g.meta.title||"Store Settings"),w=()=>y.value==="reminders",k=()=>w()?"email-notification/reminders":"settings/store",b=()=>{var S;p.value=!0;let $=a.values;Array.isArray($.store_logo)&&$.store_logo.length>0&&($.store_logo=(S=$.store_logo)==null?void 0:S[0]),w()||($.settings_name=y.value),ue.post(k(),{...$}).then(I=>{if(Y.success(u("Settings saved successfully")),y.value==="store_setup"){const Q=["currency","currency_position","currency_separator","decimal_separator","decimal_points","order_mode","store_name","store_logo","weight_unit","dimension_unit"],D={};if(Q.forEach(function(R){a.values[R]!==void 0&&(D[R]=a.values[R])}),D.currency){const R=je.get("currency_signs",{});R[D.currency]!==void 0&&(D.currency_sign=R[D.currency])}D.decimal_points!==void 0&&(D.is_zero_decimal=parseInt(D.decimal_points,10)===0);const V=je.get("shop",{}),O=["currency","currency_position","decimal_separator","decimal_points"].some(function(R){return D[R]!==void 0&&D[R]!==V[R]});je.mergeConfig({shop:Object.assign({},V,D)}),et.setLocale(),O&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(I=>{var Q;I.status_code=="422"?Y.validationErrors(I):Y.error((Q=I.data)==null?void 0:Q.message),a.setValidationErrors(I),_.value=I}).finally(()=>{p.value=!1,m.value=!1,c.value=!1})},x=T(!1),F=()=>{c.value=!0,x.value=!1;const $=w()?{}:{settings_name:y.value};ue.get(k(),$).then(S=>{a.setSchema(S.fields).setDefaults(S.settings).initForm(),s.value=S.settings,i.value=S.fields,c.value=!1,m.value=!1,p.value=!1}).catch(S=>{x.value=!0,c.value=!1,m.value=!1,p.value=!1})},M=()=>{l.bind(["mod+s"],$=>{$.preventDefault(),b()})};return be(()=>g.name,($,S)=>{var I;y.value=$,v.value=((I=g.meta)==null?void 0:I.title)||"Store Settings",l.unbind("mod+s"),M(),F()}),Ie(()=>{M(),F()}),Fc(()=>{l.unbind("mod+s")}),($,S)=>{const I=C("el-skeleton-item"),Q=C("el-skeleton"),D=C("el-form");return r(),h("div",bD,[n(Qa,{heading:v.value,loading:p.value,onOnSave:b},null,8,["heading","loading"]),o("div",wD,[n(Da),x.value?(r(),E(xe,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[o("p",null,f(A(u)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(r(),h(H,{key:0},[m.value?(r(),h("div",CD,[n(Q,{loading:m.value,animated:""},{template:d(()=>[o("div",kD,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})]),o("div",BD,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})]),o("div",xD,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})]),o("div",SD,[n(I,{variant:"p",class:"w-[20%]"}),n(I,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),m.value?B("",!0):(r(),h(H,{key:1},[A(a).isReady?(r(),E(D,{key:0,class:"relative"},{default:d(()=>[c.value?(r(),E(xe,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(Q,{rows:5,animated:""},{default:d(()=>[n(I),n(I,{variant:"text"}),n(I,{variant:"text"})]),_:1})]),_:1})]),_:1})):B("",!0),c.value?B("",!0):(r(),E(vi,{key:1,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:b,submitButtonText:A(u)("Save"),loading:p.value,onOnChange:S[0]||(S[0]=V=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"]))]),_:1})):B("",!0)],64))],64))])])}}}),FD={};function $D(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const ED=st(FD,[["render",$D]]),UD={name:"Licensing",components:{Lock:Of,Refresh:td,CircleCheck:ti,Badge:fa,DynamicIcon:J,CopyToClipboard:Ia,SettingsHeader:Qa,CardBody:Ce,CardContainer:xe,AdminNotice:Da},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return je.get("purchase_fluent_cart_link")}},mounted(){this.disabled||this.getSettings()},methods:{formatDate:Bs,translate:u,getSettings(){this.errorMessage="",this.loading=!0,ue.get("settings/license",{verify:!0}).then(e=>{this.licenseData=e}).catch(e=>{Y.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){Y.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"?Y.validationErrors(e):Y.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=>{Y.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}`}}},ID={class:"setting-wrap"},QD={class:"setting-wrap-inner"},DD={key:0,class:"fluent_cart_configure_integration_body"},VD={key:0,class:"fct-license-box-content"},TD=["href"],MD={class:"fct-license-box-content-details"},LD={class:"label"},RD={class:"license-key"},OD={class:"label"},HD={key:1,class:"w-full items-start"},PD={key:1,class:"fct-license-box-content"},ND={class:"fct-license-box-content-details"},KD={key:0},GD={class:"label"},jD={class:"license-key"},zD={class:"label"},qD={key:2,class:"fct-license-box-content"},YD={key:0},WD=["href"],XD=["innerHTML"];function JD(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("DynamicIcon"),g=C("CopyToClipboard"),y=C("el-input"),v=C("el-button"),w=C("CardBody"),k=C("CardContainer"),b=Ma("loading");return r(),h("div",ID,[n(c,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",QD,[n(p),n(k,null,{default:d(()=>[n(w,null,{default:d(()=>[n(m,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),o("div",null,[!a.disabled&&!s.loading?Gt((r(),h("div",DD,[o("div",{class:re(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(r(),h("div",VD,[s.showNewLicenseInput?(r(),h("div",HD,[o("h3",null,f(i.translate("Your License Key")),1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=x=>s.licenseKey=x),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"])])):(r(),h(H,{key:0},[n(_,{name:"GradientWarningCircle"}),o("h3",null,f(i.translate("Looks like your license key has been Expired!")),1),o("p",null,[L(f(i.translate("Have a new license Key?"))+" ",1),o("a",{onClick:t[0]||(t[0]=Ne(x=>s.showNewLicenseInput=!s.showNewLicenseInput,["prevent"])),href:"#"},f(i.translate("Click here")),1),t[7]||(t[7]=L()),s.licenseData.renew_url?(r(),h(H,{key:0},[t[6]||(t[6]=L("or ",-1)),o("a",{href:s.licenseData.renew_url,target:"_blank"},f(i.translate("Purchase a new license")),9,TD)],64)):B("",!0)]),o("div",MD,[o("p",null,[o("span",LD,f(i.translate("License Key")),1),o("span",RD,[L(f(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",OD,f(i.translate("Expired At")),1),L(" "+f(i.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(r(),h("div",PD,[n(_,{name:"GradientCheckCircle"}),o("h3",null,f(i.translate("Congratulations! Your license key is valid and activated")),1),o("p",null,[L(f(i.translate("Want to deactivate this license?"))+" ",1),o("a",{onClick:t[2]||(t[2]=Ne(x=>i.deactivateLicense(),["prevent"])),href:"#"},f(i.translate("Click here")),1)]),o("div",ND,[s.licenseData.license_key?(r(),h("p",KD,[o("span",GD,f(i.translate("License Key")),1),o("span",jD,f(i.maskLicense(s.licenseData.license_key)),1)])):B("",!0),o("p",null,[o("span",zD,f(i.translate("Expires")),1),L(" "+f(s.licenseData.expires!=="lifetime"?i.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(r(),h("div",qD,[o("h3",null,f(i.translate("Please Provide a license key of"))+" FluentCart ",1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=x=>s.licenseKey=x),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"]),s.showNewLicenseInput?B("",!0):(r(),h("p",YD,[L(f(i.translate("Don't have a license key?"))+" ",1),o("a",{target:"_blank",href:i.purchaseLink},[L(f(i.translate("Purchase one here"))+" ",1),n(_,{name:"External",class:"w-4 h-4"})],8,WD)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,XD),s.licenseData.status==="expired"&&s.showNewLicenseInput?(r(),E(v,{key:3,type:"primary",onClick:t[4]||(t[4]=x=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),L(" "+f(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]=x=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),L(" "+f(i.translate("Verify License")),1)]),_:1}))],2)])),[[b,s.verifying]]):B("",!0)])]),_:1})]),_:1})])])}const ZD=st(UD,[["render",JD]]),eV={class:"fct-single-order-loader-wrap fct-layout-width"},tV={class:"single-page-header fct-page-loader-header flex items-start justify-between"},aV={class:"single-page-body"},lV={class:"fct-single-order"},sV={class:"fct-single-order-main"},nV={class:"fct-single-order-aside"},oV={class:"fct-admin-sidebar"},iV={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",eV,[o("div",tV,[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",aV,[o("div",lV,[o("div",sV,[n(xe,{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(xe,{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(xe,{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(xe,{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",nV,[o("div",oV,[n(xe,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(xe,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(xe,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(xe,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})])])])])])}}},rV={class:"fct-product-route-wrap"},dV={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=bn({show:!1,message:"",buttonText:"",route:""}),l=T(!1),s=T(!1),i=T(!1),c=ll(),p=T(!0),m=()=>{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=at.utc(l.value.post_date).local().format("YYYY-MM-DDTHH:mm:ssZ"),p.value&&jQuery("#fct_admin_menu_holder").append(v.product_menu),g(!0)}).catch(v=>{var w;(v==null?void 0:v.code)==="fluent_cart_entity_not_found"?(a.show=!0,a.buttonText=rt.get(v,"data.buttonText"),a.message=rt.get(v,"data.message"),a.route=rt.get(v,"data.route"),jQuery(".fct-admin-product-header").remove()):v.status_code=="422"?Y.validationErrors(v):Y.error((w=v.data)==null?void 0:w.message)}).finally(()=>{i.value=!1})},_=v=>{let w={};return v.forEach((k,b)=>{k.item_price=k.item_price?_a(k.item_price,!1):0,k.item_cost=k.item_cost?_a(k.item_cost,!1):0,k.compare_price=k.compare_price?_a(k.compare_price,!1):"",k.other_info&&(k.other_info.signup_fee=k.other_info.signup_fee?_a(k.other_info.signup_fee,!1):0),k.rowId=b,w[k.id]=k}),v},g=(v=!1)=>{let w=jQuery(".fct-admin-product-menu"),k=c.name;w.length&&(w.find("li").removeClass("active-menu"),w.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,w)=>{v!==w&&m()}),Ie(()=>{m(),g(),window.addEventListener("hashchange",g)}),vl(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),jr("reload",()=>{p.value=!1,m()}),(v,w)=>{const k=C("router-view");return r(),h("div",rV,[A(c).name==="product_edit"&&i.value?(r(),E(iV,{key:0})):B("",!0),a.show?(r(),E(ai,{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 uV extends Fs{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"}]}getSortableColumns(){return[{label:u("Product ID"),value:"ID"},{label:u("Title"),value:"post_title"},{label:u("Created at"),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["detail","variants:post_id,available"]}}function $p(e){return uV.init(e)}const cV={key:0,class:"fct-dummy-product-content"},AV={key:0,class:"title"},pV={class:"text"},fV={class:"fct-dummy-product-loading"},mV={class:"fct-loading-bars"},hV=["id"],_V={key:1,class:"fct-form-group"},vV={class:"required"},gV={class:"dialog-footer"},yV={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,l=qt().ctx,s=T(!1),i=T([]),c=T(null),p=T(0),m=T(!1),_=T(null),g=T(0),y=k=>{s.value=k},v=(k=0)=>{if(c.value===null){w();return}m.value=!0;const b=i.value[c.value];if(_.value=b,k>b.count-1){setTimeout(()=>{w(),s.value=!1,a("onProductCreated")},1e3);return}p.value=k,l.$post("products/create-dummy",{category:b.category,index:k}).then(x=>{g.value=parseFloat(((k+1)/b.count*100).toFixed(0)),v(k+1)}).catch(x=>{x.code===400?w():v(k+1),l.handleError(x)})},w=()=>{g.value=0,p.value=0,m.value=!1,_.value=null};return Ie(()=>{i.value=je.get("dummy_product_info")}),(k,b)=>{const x=C("el-button"),F=C("el-progress"),M=C("el-option"),$=C("el-select"),S=C("el-dialog");return r(),h(H,null,[n(x,{onClick:b[0]||(b[0]=I=>y(!0))},{default:d(()=>[n(J,{name:"Stars",class:"hidden lg:inline"}),L(" "+f(k.$t("Add Dummy Product")),1)]),_:1}),n(S,{modelValue:s.value,"onUpdate:modelValue":b[4]||(b[4]=I=>s.value=I),title:k.$t("Create Dummy Product"),"append-to-body":!0},la({default:d(()=>[m.value?(r(),h("div",cV,[_.value!=null?(r(),h("div",AV,f(A(u)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):B("",!0),o("div",pV,[L(f(k.$t("Can close the window - product will continue to insert."))+" ",1),o("div",fV,[o("div",mV,[(r(),h(H,null,ae(8,I=>o("div",{key:I,class:"bar-block",id:`bar-block-${I+1}`},null,8,hV)),64))]),L(" "+f(A(u)("Uploading... %s%",g.value)),1)])]),n(F,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",_V,[o("label",vV,f(k.$t("Product Category")),1),n($,{modelValue:c.value,"onUpdate:modelValue":b[1]||(b[1]=I=>c.value=I),clearable:"",placeholder:k.$t("Select a Product Category")},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(I,Q)=>(r(),E(M,{key:Q,label:I.title,value:Q},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[m.value?void 0:{name:"footer",fn:d(()=>[o("div",gV,[n(x,{onClick:b[2]||(b[2]=I=>y(!1))},{default:d(()=>[L(f(k.$t("Cancel")),1)]),_:1}),n(x,{type:"primary",onClick:b[3]||(b[3]=()=>{v()}),disabled:!c.value},{default:d(()=>[L(f(k.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},bV={class:"table-cell"},wV={class:"fct-product-info-card w-full"},CV={class:"fct-product-info-media"},kV={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},BV={class:"fct-product-info-name flex flex-col items-start gap-3"},xV={class:"table-cell"},SV={class:"table-cell"},FV={class:"table-cell"},$V={class:"table-cell"},EV={class:"table-cell"},UV={class:"table-cell"},IV={class:"table-cell"},QV={__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"),m=C("el-skeleton");return r(),E(m,{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",bV,[o("div",wV,[o("div",CV,[n(c,{variant:"image",class:"w-10 h-10.5 flex-none rounded-md"})]),o("div",kV,[o("div",BV,[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",xV,[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",SV,[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",FV,[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",$V,[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",EV,[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",UV,[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",IV,[n(c,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},DV={},VV={class:"px-4 py-3"},TV={class:"flex items-center justify-between mb-3"},MV={class:"grid grid-cols-3 gap-5 mt-5"};function LV(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",VV,[o("div",TV,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",MV,[(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 RV=st(DV,[["render",LV]]),OV={class:"fct-product-action show-on-mobile absolute right-0 top-1"},HV={class:"more-btn pr-3"},PV={class:"flex items-center gap-2"},NV={key:0},KV={key:1},GV={key:2},jV={key:0},zV={key:1},qV={key:0},YV={key:1},WV={key:0},XV={key:1},JV={class:"flex items-center gap-0.5"},ZV={key:0},eT={key:1},tT=["innerHTML"],aT=["innerHTML"],lT={class:"fct-product-id hidden",title:"Product ID"},sT={class:"more-btn pr-3"},nT={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const l=a,s=T(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?_a(y.min_price,!0):`${_a(y.min_price,!0)} - ${_a(y.max_price,!0)}`,p=y=>{switch(y){case"physical":return u("Physical");case"digital":return u("Digital");case"bundle":return u("Bundle");default:da.headline(y)}},m=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?da.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 w=C("el-table-column"),k=C("router-link"),b=C("el-dropdown-item"),x=C("el-dropdown-menu"),F=C("el-dropdown"),M=C("el-tooltip"),$=C("el-table");return r(),E($,{ref_key:"elTableRef",ref:s,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:_},{empty:d(()=>[n(bt,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:d(()=>[n(w,{type:"selection",width:"45"}),n(w,{label:A(u)("Products"),width:"380"},{default:d(S=>[n(ka,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(Xr,{product:S.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",OV,[n(F,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(x,null,{default:d(()=>[S.row.ID?(r(),E(b,{key:0,class:"item-link"},{default:d(()=>[n(k,{to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(b,{command:{action:"duplicate",product:S.row}},{default:d(()=>[n(J,{name:"Duplicate"}),L(" "+f(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:S.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",HV,[n(J,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(w,{key:0,label:A(u)("Type"),width:"170"},{default:d(S=>[n(ka,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>{var I,Q;return[o("div",PV,[((Q=(I=S.row.detail)==null?void 0:I.other_info)==null?void 0:Q.is_bundle_product)==="yes"?(r(),h("span",NV,f(A(u)("Bundle"))+" - ",1)):B("",!0),S.row.detail?(r(),h("span",KV,f(p(S.row.detail.fulfillment_type)),1)):(r(),h("span",GV,f(A(u)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(w,{key:1,label:A(u)("Variation"),width:"150"},{default:d(S=>[n(ka,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",jV,f(m(S.row.detail.variation_type)),1)):(r(),h("span",zV,f("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(w,{key:2,label:A(u)("Price"),width:"130"},{default:d(S=>[n(ka,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",qV,f(c(S.row.detail)),1)):(r(),h("span",YV,f(A(u)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(w,{key:3,label:A(u)("Stock"),width:"100"},{default:d(S=>[n(ka,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",WV,[S.row.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[L(f(A(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[L(f(A(Zt)(A(rt).sum(S.row.variants,"available"))),1)],64))])):(r(),h("span",XV,f("")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(w,{key:4,label:A(u)("Status"),width:"130"},{default:d(S=>[n(ka,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[o("div",JV,[(r(),E(fa,{key:S.row.ID,status:S.row.post_status==="future"?"scheduled":S.row.post_status},null,8,["status"])),S.row.post_status==="future"?(r(),E(M,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[L(f(A(u)("Publishes On: %s",A(Bs)(S.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(w,{key:5,label:A(u)("Date"),width:"100"},{default:d(S=>[n(ka,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(Na,{"date-time":S.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(),S=>(r(),E(w,{label:S.label},{default:d(I=>[S.render_template?(r(),h("div",ZV,[(r(),E(Cl(Tc),{templateContent:S.template,data:{column:S,product:I.row,index:I.$index}},null,8,["templateContent","data"]))])):(r(),h("div",eT,[S.as_link!==!1?(r(),E(ka,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:I.row.ID}}},{default:d(()=>[o("div",{innerHTML:A(rt).get(I.row,S.accessor)},null,8,tT)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(rt).get(I.row,S.accessor)},null,8,aT))]))]),_:2},1032,["label"]))),256)),n(w,{label:A(u)("Actions"),width:"90",align:"right"},{default:d(S=>[o("span",lT,"ID: "+f(S.row.ID),1),n(F,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(x,null,{default:d(()=>[S.row.ID?(r(),E(b,{key:0,class:"item-link"},{default:d(()=>[n(k,{to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(b,{command:{action:"duplicate",product:S.row}},{default:d(()=>[n(J,{name:"Duplicate"}),L(" "+f(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:S.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(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"])}}},oT={class:"fct-product-table-mobile-wrap"},iT={class:"fct-product-table-mobile-header"},rT={key:0,class:"fct-product-table-post-status-col"},dT={class:"flex items-center gap-1.5"},uT={class:"fct-product-action"},cT={class:"more-btn"},AT=["onClick"],pT={class:"fct-product-table-mobile-body-header"},fT={class:"fct-product-table-date-col"},mT={class:"invoice-no",title:"Product ID"},hT={key:0,class:"fct-product-table-price-col"},_T={key:0},vT={key:1},gT={class:"fct-product-table-product-col"},yT=["onClick"],bT={key:0,class:"fct-product-table-product-type"},wT={class:"title"},CT={key:0,class:"value"},kT={key:1,class:"value"},BT={key:1,class:"fct-product-table-variation-col"},xT={class:"title"},ST={key:0,class:"value"},FT={key:1,class:"value"},$T={key:2,class:"fct-product-table-stock-col"},ET={class:"title"},UT={key:0,class:"value"},IT={key:1},QT={key:0,class:"fct-product-table-mobile-footer"},DT={class:"fct-product-table-stock-col"},VT={key:0,class:"title"},TT=["innerHTML"],MT=["innerHTML"],LT={__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(m=>{})},s=p=>p.min_price===p.max_price?_a(p.min_price,!0):`${_a(p.min_price,!0)} - ${_a(p.max_price,!0)}`,i=p=>{switch(p){case"physical":return u("Physical");case"digital":return u("Digital");default:da.headline(p)}},c=p=>{switch(p){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");default:da.headline(p)}};return(p,m)=>{const _=C("el-tooltip"),g=C("router-link"),y=C("el-dropdown-item"),v=C("el-dropdown-menu"),w=C("el-dropdown");return r(),h("div",oT,[(r(!0),h(H,null,ae(e.productTable.getTableData(),(k,b)=>(r(),h("div",{key:k.id,class:"fct-product-table-mobile-row"},[o("div",iT,[e.productTable.isColumnVisible("post_status")?(r(),h("div",rT,[o("div",dT,[(r(),E(fa,{key:k.ID,status:k.post_status,onClick:x=>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(()=>[L(f(A(u)("Publishes On: %s",A(Bs)(k.post_date,!0))),1)]),default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):B("",!0)])])):B("",!0),o("div",uT,[n(w,{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"}),L(" "+f(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"}),L(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",cT,[n(J,{name:"More"})])]),_:2},1024)])]),o("div",{class:"fct-product-table-mobile-body",onClick:x=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},[o("div",pT,[o("div",fT,[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"]),m[0]||(m[0]=o("span",{class:"bullet"},"•",-1))],64)):B("",!0),o("span",mT,"#"+f(k.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",hT,[k.detail?(r(),h("span",_T,f(s(k.detail)),1)):(r(),h("span",vT,f(A(u)("Set Price")),1))])):B("",!0)]),o("div",gT,[n(Xr,{product:k},null,8,["product"])])],8,AT),o("div",{class:"fct-product-table-mobile-footer",onClick:x=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),h("div",bT,[o("div",wT,f(A(u)("Type")),1),k.detail?(r(),h("span",CT,f(i(k.detail.fulfillment_type)),1)):(r(),h("span",kT,f("N/A")))])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",BT,[o("div",xT,f(A(u)("Variation")),1),k.detail?(r(),h("span",ST,f(c(k.detail.variation_type)),1)):(r(),h("span",FT,f("N/A")))])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",$T,[o("div",ET,f(A(u)("Stock")),1),k.detail?(r(),h("span",UT,[k.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[L(f(A(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[L(f(A(Zt)(A(rt).sum(k.variants,"available"))),1)],64))])):(r(),h("span",IT,f("")))])):B("",!0)],8,yT),e.productTable.getCustomColumns()?(r(),h("div",QT,[(r(!0),h(H,null,ae(e.productTable.getCustomColumns(),x=>(r(),h("div",DT,[x.label?(r(),h("div",VT,f(x.label),1)):B("",!0),x.render_template?(r(),E(Cl(Tc),{key:1,templateContent:x.template,data:x,column:x,row:k},null,8,["templateContent","data","column","row"])):(r(),h(H,{key:2},[x.as_link!==!1?(r(),E(ka,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:k.ID}}},{default:d(()=>[o("div",{innerHTML:A(rt).get(k,x.accessor)},null,8,TT)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(rt).get(k,x.accessor)},null,8,MT))],64))]))),256))])):B("",!0)]))),128))])}}},RT={class:"product-action-modal"},OT={class:"fct-alert-content"},HT={class:"fct-alert-title"},PT={class:"fct-alert-text"},NT={class:"fct-alert-subtext"},KT={key:1,class:"product-info"},GT={class:"info-text"},jT={key:0},zT={key:1},qT={key:2},YT={key:2,class:"options-wrapper"},WT={key:4,class:"products-preview"},XT={class:"preview-title"},JT={class:"product-list"},ZT={class:"product-name"},eM={key:0,class:"remaining-count"},tM={key:5,class:"progress-section"},aM={class:"progress-text"},lM={key:6,class:"results-section"},sM={class:"dialog-footer"},nM={key:0,class:"el-icon-delete"},oM={__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=T(a.modelValue),i=T(!1),c=T(!1),p=T(!1),m=T(0),_=T(0),g=T(0),y=T({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=je.get("app_config.isProActive"),w=je.get("modules_settings.stock_management.active"),k=K(()=>a.action==="duplicate"),b=K(()=>a.action==="delete"),x=K(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),F=K(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),M=K(()=>x.value?u(k.value?"Bulk Duplicate Products":"Bulk Delete Products"):u(k.value?"Duplicate Product":"Delete Product")),$=K(()=>b.value?u(x.value?"Delete Products":"Delete Product"):u(x.value?"Duplicate Products":"Duplicate Product")),S=K(()=>a.products.slice(0,5)),I=K(()=>{const ne=F.value-5;return ne>0?ne:0}),Q=K(()=>F.value===0?0:Math.round(m.value/F.value*100)),D=K(()=>{if(g.value>0&&m.value===F.value)return"exception";if(m.value===F.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,m.value=0,_.value=0,g.value=0,i.value=!1)}),be(s,ne=>{l("update:modelValue",ne)});const V=()=>{!c.value&&!i.value&&(s.value=!1,(p.value&&_.value>0||!x.value&&!p.value)&&l("completed"))},U=()=>{x.value?j():O()},O=()=>{i.value=!0,k.value?R():P()},R=()=>{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=>{Y.success(ne.message||u("Product duplicated successfully")),l("completed"),V()}).catch(ne=>{var he,N;((he=ne.status_code)==null?void 0:he.toString())==="422"?Y.validationErrors(ne):Y.error(((N=ne.data)==null?void 0:N.message)||u("Failed to duplicate product"))}).finally(()=>{i.value=!1})},P=()=>{ue.delete(`products/${a.productId}`).then(ne=>{Y.success(ne.message||u("Product deleted successfully")),l("completed"),V()}).catch(ne=>{var he,N;((he=ne.status_code)==null?void 0:he.toString())==="422"?Y.validationErrors(ne):Y.error(((N=ne.data)==null?void 0:N.message)||u("Failed to delete product"))}).finally(()=>{i.value=!1})},j=async()=>{c.value=!0,m.value=0,_.value=0,g.value=0,k.value?await q():await z(),c.value=!1,p.value=!0,X()},q=async()=>{const ne={import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles},he=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(N=>N.ID);for(const N of he){try{await ue.post(`products/${N}/duplicate`,ne),_.value++}catch{g.value++}m.value++}},z=async()=>{const ne=a.products&&a.products.length>0?a.products:[];for(const he of ne){try{await ue.delete(`products/${he.ID}`),_.value++}catch{g.value++}m.value++}},X=()=>{const ne=k.value?"duplicated":"deleted";_.value>0&&g.value===0?Y.success({message:u(`All products ${ne} successfully`)}):_.value>0&&g.value>0?Y.warning({message:u(`Some products were ${ne} successfully`)}):Y.error({message:u(`Failed to ${ne.replace("ed","")} products`)})};return(ne,he)=>{const N=C("el-checkbox"),G=C("el-progress"),Z=C("el-alert"),W=C("el-button"),ie=C("el-dialog");return r(),E(ie,{modelValue:s.value,"onUpdate:modelValue":he[3]||(he[3]=ye=>s.value=ye),title:M.value,"append-to-body":!0,width:"500px",onClose:V,"modal-class":"fct-duplicate-product-modal"},{footer:d(()=>[o("div",sM,[n(W,{onClick:V,disabled:c.value},{default:d(()=>[L(f(c.value||p.value?A(u)("Close"):A(u)("Cancel")),1)]),_:1},8,["disabled"]),p.value?B("",!0):(r(),E(W,{key:0,type:b.value?"danger":"primary",loading:i.value||c.value,disabled:i.value||c.value,onClick:U},{default:d(()=>[b.value?(r(),h("i",nM)):B("",!0),L(" "+f($.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:d(()=>[o("div",RT,[b.value?(r(),E(Ja,{key:0,icon:"WarningFill",type:"error"},{content:d(()=>[o("div",OT,[o("h3",HT,f(A(u)("Are you sure?")),1),o("p",PT,[L(f(A(u)("You are about to permanently delete"))+" ",1),o("strong",null,f(F.value),1),L(" "+f(A(u)(F.value===1?"product":"products"))+". ",1)]),o("p",NT,f(A(u)("This action cannot be undone.")),1)])]),_:1})):B("",!0),k.value?(r(),h("div",KT,[o("div",GT,[L(f(A(u)(x.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),x.value?(r(),h("strong",jT,f(F.value),1)):(r(),h("strong",zT,f(e.productName),1)),x.value?(r(),h("span",qT,f(A(u)(F.value===1?"product":"products")),1)):B("",!0)])])):B("",!0),k.value?(r(),h("div",YT,[n(N,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":he[0]||(he[0]=ye=>y.value.importDownloadableFiles=ye),label:A(u)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),n(N,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":he[1]||(he[1]=ye=>y.value.importLicenseSettings=ye),label:A(u)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),A(w)==="yes"?(r(),h(H,{key:0},[A(v)?(r(),E(N,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":he[2]||(he[2]=ye=>y.value.importStockManagement=ye),label:A(u)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),E(N,{key:1,disabled:!0,size:"large"},{default:d(()=>[L(f(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(Ja,{key:3,type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",null,f(A(u)(x.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):B("",!0),b.value&&x.value&&!c.value&&!p.value?(r(),h("div",WT,[o("p",XT,f(A(u)("Products to be deleted:")),1),o("ul",JT,[(r(!0),h(H,null,ae(S.value,ye=>(r(),h("li",{key:ye.ID,class:"product-item"},[o("span",ZT,f(ye.post_title),1)]))),128)),I.value>0?(r(),h("li",eM,f(A(u)("... and %s more",I.value)),1)):B("",!0)])])):B("",!0),x.value&&c.value?(r(),h("div",tM,[n(G,{percentage:Q.value,status:D.value},null,8,["percentage","status"]),o("p",aM,f(A(u)(b.value?"Deleting":"Duplicating"))+" "+f(m.value)+" / "+f(F.value),1)])):B("",!0),x.value&&p.value?(r(),h("div",lM,[_.value>0?(r(),E(Z,{key:0,title:A(u)(b.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(Z,{key:1,title:A(u)(b.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"])}}},iM={class:"fct-all-products-page fct-layout-width"},rM={class:"fct-all-products-wrap"},dM={key:0,class:"bulk-actions-bar"},uM={class:"bulk-left flex items-center gap-2"},cM={class:"bulk-right"},AM={key:1,class:"fct-products-table-wrap"},pM={__name:"AllProducts",setup(e){const t=$p({instance:qt()}),a=T(!1),l=T(!1),s=T("duplicate"),i=T(null),c=T([]),p=T(""),m=T(!1),_=()=>{m.value=window.innerWidth<768},g=Q=>{ue.delete(`products/${Q}`).then(D=>{Y.success(D),t.fetch()}).catch(D=>{var V;D.status_code.toString()==="422"?Y.validationErrors(D):Y.error((V=D.data)==null?void 0:V.message)})},y=Q=>{i.value=Q,c.value=[],s.value="duplicate",l.value=!0},v=()=>{t.fetch(),i.value=null,c.value=[]},w=()=>{var Q,D;t.fetch(),c.value=[],p.value="",(D=(Q=I.value)==null?void 0:Q.clearSelection)==null||D.call(Q)},k=Q=>{c.value=Q},b=()=>{if(c.value.length===0){Y.warning({message:u("Please select at least one product to duplicate")});return}i.value=null,s.value="duplicate",l.value=!0},x=()=>{if(c.value.length===0){Y.warning({message:u("Please select at least one product to delete")});return}i.value=null,s.value="delete",l.value=!0},F=()=>{if(!p.value){Y.warning({message:u("Please select a bulk action")});return}p.value==="duplicate"?b():p.value==="delete"&&x()},M=K(()=>c.value.map(Q=>Q.ID)),$=K(()=>c.value.length>0),S=K(()=>c.value.length>0),I=T(null);return Ie(()=>{_(),window.addEventListener("resize",_)}),Bt(()=>{window.removeEventListener("resize",_)}),(Q,D)=>{const V=C("el-icon"),U=C("el-button"),O=C("el-dropdown-item"),R=C("el-dropdown-menu"),P=C("el-dropdown"),j=C("el-option"),q=C("el-select"),z=C("el-dialog");return r(),h("div",iM,[n(sl,{title:A(u)("Products")},{action:d(()=>[n(Nt,{permission:"products/create"},{default:d(()=>[n(P,{trigger:"click","popper-class":"fct-dropdown",onCommand:D[3]||(D[3]=()=>{}),placement:"bottom-end"},{dropdown:d(()=>[n(R,null,{default:d(()=>[n(O,{class:"item-link"},{default:d(()=>[n(yV,{onOnProductCreated:D[0]||(D[0]=X=>A(t).fetch()),products:A(t).getTableData()},null,8,["products"])]),_:1}),n(O,{onClick:D[1]||(D[1]=X=>Q.$router.push({name:"product_bulk_insert"}))},{default:d(()=>[n(J,{name:"Insert"}),L(" "+f(A(u)("Bulk Product Insert")),1)]),_:1}),n(O,{onClick:D[2]||(D[2]=X=>Q.$router.push({name:"product_bulk_edit"}))},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(A(u)("Bulk Product Edit")),1)]),_:1})]),_:1})]),default:d(()=>[n(U,null,{default:d(()=>[L(f(A(u)("More actions"))+" ",1),n(V,null,{default:d(()=>[n(A(ei))]),_:1})]),_:1})]),_:1}),n(U,{type:"primary",onClick:D[4]||(D[4]=()=>{a.value=!0})},{default:d(()=>[L(f(A(u)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Nt,{permission:"products/view"},{default:d(()=>[o("div",rM,[n($s,{table:A(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(RV,{key:0})):B("",!0),n(LT,{"product-table":A(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:d(()=>[n(Gl,{name:"slide-fade"},{default:d(()=>[$.value?(r(),h("div",dM,[o("div",uM,[n(q,{size:"small",class:"bulk-select min-w-[180px]",placeholder:A(u)("Select Bulk Action"),modelValue:p.value,"onUpdate:modelValue":D[5]||(D[5]=X=>p.value=X)},{default:d(()=>[n(j,{label:A(u)("Duplicate"),value:"duplicate"},null,8,["label"]),n(j,{label:A(u)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),n(U,{size:"small",type:p.value==="delete"?"danger":"primary",onClick:F},{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"})),L(" "+f(A(u)("Confirm")),1)]),_:1},8,["type"])]),o("div",cM,f(c.value.length)+" "+f(A(u)("item(s) selected")),1)])):B("",!0)]),_:1}),A(t).isLoading()?(r(),E(QV,{key:0,productTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",AM,[n(nT,{ref_key:"productTableRef",ref:I,"product-table":A(t),onDelete:g,onDuplicate:y,onSelectionChange:k},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),n(Nt,{permission:"products/create"},{default:d(()=>{var X,ne;return[n(z,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":D[6]||(D[6]=he=>a.value=he),title:A(u)("Add New Product")},{default:d(()=>[a.value?(r(),E(fi,{key:0})):B("",!0)]),_:1},8,["modelValue","title"]),n(oM,{modelValue:l.value,"onUpdate:modelValue":D[7]||(D[7]=he=>l.value=he),action:s.value,"product-id":(X=i.value)==null?void 0:X.ID,"product-name":(ne=i.value)==null?void 0:ne.post_title,products:S.value?c.value:[],"product-ids":S.value?M.value:[],onCompleted:D[8]||(D[8]=he=>S.value?w():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},fM=st(pM,[["__scopeId","data-v-cd57428c"]]);let mM=0;function Al(){return"_cid_"+ ++mM}const es={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class xd extends nl{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:es.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:es.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)}),Ot.set(l,s)}restoreColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s=Ot.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=Ot.get(a);Array.isArray(l)?this.data.visibleColumns=l:this.data.visibleColumns=this.getToggleableColumns().map(s=>s.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&Ot.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=es.IN_STOCK;a.detail&&(a.detail.stock_availability=es.IN_STOCK);return}let s=!0;for(const c of a.variants){const p=parseInt(c.available,10)||0;c.stock_status=p>0?es.IN_STOCK:es.OUT_OF_STOCK,p>0&&(s=!1)}a.detail&&(a.detail.stock_availability=s?es.OUT_OF_STOCK:es.IN_STOCK)}addDummyDownloadableFiles(a){const l=a;Array.isArray(l.downloadable_files)||(l.downloadable_files=[]),l.downloadable_files.push(this.downloadableFileSchema)}}class hM extends xd{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",al());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 m=i[p.id];m&&Object.keys(m).forEach(_=>{if(c.has(_))return;const g=m[_];_==="other_info"&&p.other_info?this._mergeOtherInfo(p.other_info,g):p[_]=g!==null&&typeof g=="object"?JSON.parse(JSON.stringify(g)):g})})}});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=>{let l={};return a.forEach((s,i)=>{s.item_price=s.item_price?_a(s.item_price,!1):0,s.item_cost=s.item_cost?_a(s.item_cost,!1):0,s.compare_price=s.compare_price?_a(s.compare_price,!1):0,s.other_info.signup_fee=s.other_info.signup_fee?_a(s.other_info.signup_fee,!1):0,s.rowId=i,l[s.id]=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=>{Y.success(l.message)}).catch(l=>{l&&l.message&&Y.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");return this.data.product_changes.variants[s].billing_summary=`${a.item_price} ${a.other_info.repeat_interval} ${c}`,this.data.product_changes.variants[s].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=`${a.item_price} ${a.other_info.repeat_interval} ${c}`}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=>{Y.success(c.message)}).catch(c=>{var p;c.status_code=="422"?Y.validationErrors(c):Y.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=>(Y.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"?(Y.validationErrors(s),this.setValidationErrors(s.data)):Y.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)=>$n.ofDelete(u("Are you sure, you want to delete this price?")).then(()=>{if(a!==void 0)return ue.delete(`products/variants/${a}`).then(s=>{Y.success(s.message),this.afterDeletingPricing(l),this.saveSnapshot()}).catch(s=>{throw(s==null?void 0:s.status_code)=="422"?Y.validationErrors(s):Y.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,m,_;if(a==="post_title"&&this.product.detail.variation_type==="simple"&&Array.isArray(this.product.variants)&&this.variantsLength()>0&&(this.product.variants[0].variation_title=l,(i=this.data.product_changes)!=null&&i.variants||(this.data.product_changes.variants=[]),this.ensureVariationIndex(0),this.data.product_changes.variants[0].variation_title=l,this.data.product_changes.variants[0].id=this.product.variants[0].id),a==="post_date"&&(this.product[a]=at(l).format("YYYY-MM-DDTHH:mm:ssZ"),this.data.product_changes[a]=this.product[a]),a==="default_variation_id"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),this.data.product_changes.detail.default_variation_id=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={}),(m=this.product.detail)!=null&&m.other_info||(this.product.detail.other_info={}),(_=this.data.product_changes.detail)!=null&&_.other_info||(this.data.product_changes.detail.other_info={}),this.product.detail.other_info[a]=l,this.data.product_changes.detail.other_info[a]=l,this.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,m;if(a==null)return!0;const l=(m=(p=this.product)==null?void 0:p.variants)==null?void 0:m[a];if(!l)return!0;const 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,m,_,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),((m=l.detail)==null?void 0:m.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(w=>{v.push({id:w.id,variation_title:w.variation_title,sku:w.sku,item_price:w.item_price,compare_price:w.compare_price,item_cost:w.item_cost,manage_cost:w.manage_cost,fulfillment_type:w.fulfillment_type,shipping_class:w.shipping_class,other_info:w.other_info,manage_stock:w.manage_stock,serial_index:w.serial_index,total_stock:w.total_stock,available:w.available,committed:w.committed,on_hold:w.on_hold,stock_status:w.stock_status,sold_individually:w.sold_individually,media:w.media,downloadable:w.downloadable,payment_type:w.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=>{Y.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",Bs(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((w,k,b)=>k===b.findIndex(x=>x.id===w.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(w=>{typeof w=="function"&&w(this.product)})}).catch(v=>{var w,k;((w=v==null?void 0:v.status_code)==null?void 0:w.toString())==="422"?(Y.validationErrors(v),this.setValidationErrors(v)):Y.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=>{Y.success(a.message),this.router.push({name:"products"})}).catch(a=>{var l;a.status_code=="422"?Y.validationErrors(a):Y.error((l=a.data)==null?void 0:l.message)})}).catch(()=>{})});Re(this,"updateVariationType",(a,l)=>{var p,m;const s=this.product.detail[a];this.product.detail[a]=l;let i={variation_type:l,variation_ids:[(m=(p=this.product)==null?void 0:p.variants[0])==null?void 0:m.id],action:"change_variation_type"};const c=ue.post(`products/detail/${this.product.detail.id}`,i);return c.then(_=>{Y.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"?Y.validationErrors(_):Y.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",()=>je.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",()=>je.get("is_tax_enabled"));Re(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Re(this,"isBundleProduct",()=>rt.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=qt().ctx}setProduct(a){let l=document.querySelector(".fct-admin-product-info .badge");l&&a.post_status==="future"&&(l.innerText=u("Publishes on: %s",Bs(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 je.get("admin_url")+"settings/shipping"}}function _M(){return hM.init()}function vM(){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 gM={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},yM={key:0,class:"iframe-loader"},bM=["src"],wM={class:"iframe-controls"},CM={class:"dialog-header"},kM={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},BM={key:0,class:"iframe-loader"},xM=["src"],SM={__name:"GutenbergEditor",props:{post_id:{required:!0},product:{type:Object},reload:Function,productEditModel:Object},setup(e){const t=e,a=T(!1),l=T(!0),s=T(!0),i=T(),c=T(null),p=T(null);ll();const m=()=>{i.value=je.get("wp_admin_url",window.location.origin+"/wp-admin")},_=()=>{setTimeout(()=>{l.value=!1},500)},g=()=>{var x;s.value=!1,setTimeout(()=>{},500);try{const F=(x=p.value)==null?void 0:x.contentDocument;F&&F.addEventListener("click",M=>{const $=M.target.closest("a[href]");if($&&!$.target&&!$.getAttribute("onclick")){const S=$.getAttribute("href");S&&(S.startsWith("/")||S.startsWith("http"))&&(M.preventDefault(),window.parent.postMessage({type:"navigateTo",content:S},"*"))}},!0)}catch{}},y=()=>{a.value=!0,s.value=!0},v=()=>{s.value=!1,a.value=!1,t.productEditModel.data.reloader()},w=()=>{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())},b=x=>{const{type:F,content:M}=x.data;F==="gutenbergContentChanged"&&w(),F==="navigateTo"&&(v(),window.location.href=M)};return Ie(()=>{m(),window.addEventListener("message",b)}),(x,F)=>{const M=C("el-icon"),$=C("el-button"),S=C("el-breadcrumb-item"),I=C("el-breadcrumb"),Q=C("el-dialog");return r(),h(H,null,[o("div",gM,[F[2]||(F[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),h("div",yM,[o("span",null,[L(f(A(u)("Loading preview..."))+" ",1),n(M,{class:"is-loading"},{default:d(()=>[n(A(qs))]),_: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:ra({visibility:l.value?"hidden":"visible"})},null,44,bM)]),o("div",wM,[n($,{onClick:y},{default:d(()=>[L(f(A(u)("Show Content Editor")),1)]),_:1})]),n(Q,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":F[0]||(F[0]=D=>a.value=D),onClose:v,onOpen:F[1]||(F[1]=()=>{k()})},{header:d(()=>[o("div",CM,[n(I,{separator:"/"},{default:d(()=>[n(S,null,{default:d(()=>[o("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:v},f(e.product.post_title),1)]),_:1}),n(S,null,{default:d(()=>F[3]||(F[3]=[L("Editor",-1)])),_:1,__:[3]})]),_:1}),s.value?B("",!0):(r(),E($,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:v},{default:d(()=>[n(J,{name:"Cross"}),L(" "+f(A(u)("Close")),1)]),_:1}))])]),default:d(()=>[o("div",kM,[s.value?(r(),h("div",BM,[o("span",null,[L(f(A(u)("Loading editor..."))+" ",1),n(M,{class:"is-loading"},{default:d(()=>[n(A(qs))]),_: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:ra({visibility:s.value?"hidden":"visible"})},null,44,xM)])]),_:1},8,["modelValue"])],64)}}},FM={class:"fct-product-info-wrap"},$M={class:"fct-admin-input-wrapper"},EM={class:"fct-admin-input-wrapper"},UM={class:"form-note"},IM={class:"fct-excerpt-word-counter mt-[7px]"},QM={class:"editor-tabs-nav"},DM={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},VM={class:"custom-wp-editor-wrapper relative"},TM={class:"relative rounded overflow-hidden"},MM={class:"editor-tab-content fct-wp-editor-tab-content"},LM={class:"editor-tab-content fct-gutenberg-tab-content"},RM={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=T(!1),l=T("wp-editor");T("#gt"),ll();const s=T(),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,m,_,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((m=t.product)==null?void 0:m.post_excerpt.toString().split(" ").length),(y=(g=(_=t.product)==null?void 0:_.detail)==null?void 0:g.other_info)!=null&&y.active_editor&&(l.value=t.product.detail.other_info.active_editor)}),be(()=>t.productEditModel.data.discardKey,()=>{s.value&&s.value.resetContent(t.product.post_content)}),(c,p)=>{const m=C("el-input"),_=C("el-form-item"),g=C("el-form"),y=Ma("loading");return r(),h("div",FM,[n(xe,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",$M,[n(_,{label:A(u)("Title"),required:""},{default:d(()=>[n(m,{class:re(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(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),o("div",EM,[n(_,{label:A(u)("Short description")},{default:d(()=>[n(m,{class:"fct-short-desc-input",onInput:p[3]||(p[3]=v=>{e.productEditModel.onChangeInputField("post_excerpt",v)}),modelValue:e.product.post_excerpt,"onUpdate:modelValue":p[4]||(p[4]=v=>e.product.post_excerpt=v),rows:2,type:"textarea",onFocus:p[5]||(p[5]=v=>e.productEditModel.clearValidationError("post_excerpt"))},null,8,["modelValue"]),o("div",null,[o("div",UM,[o("p",IM,f(A(u)("%1$s Words of %2$s",A(u)(e.productEditModel.data.excerptWordCount),A(u)(e.productEditModel.maxExcerptWordCount))),1)]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Qe,{title:A(u)("Long Description")},{action:d(()=>[Gt((r(),h("div",QM,[n(qr,null,{default:d(()=>[n(Co,{label:A(u)("Classic Editor"),class:re(l.value==="wp-editor"?"active":""),onClick:p[7]||(p[7]=v=>i("wp-editor"))},null,8,["label","class"]),n(Co,{label:A(u)("Builder"),class:re(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",DM,[n(_,null,{default:d(()=>[o("div",VM,[o("div",TM,[Gt(o("div",MM,[n(Wl,{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),[[Vl,l.value==="wp-editor"]]),Gt(o("div",LM,[n(SM,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[Vl,l.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},OM=["aria-label"],HM=["src","alt"],PM={class:"fmp-featured__edit-icon"},NM=["src","alt"],KM={key:0,class:"fmp-count"},GM={key:0,class:"fmp-preview-grid"},jM=["src","alt"],zM={key:0,class:"fmp-preview-more"},qM={key:1,class:"fmp-add-full",type:"button"},YM={class:"fmp-modal-body"},WM=["src","alt"],XM=["onClick","title"],JM={key:1,class:"fmp-empty"},ZM={class:"fmp-url-list"},e7=["src","alt"],t7={class:"fmp-url-info"},a7={class:"fmp-url-title"},l7={class:"fmp-url-text"},s7=["onClick","title"],n7={class:"fmp-url-add"},o7={class:"dialog-footer"},i7={class:"fct-media-picker-footer-actions"},r7={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=cs.getUrl("images/placeholder.svg"),l=U=>{U.target&&U.target.src!==a&&(U.target.src=a)},s=e,i=t,c=T(!1),p=T([]),m=T("gallery"),_=T(""),g=T(!1),y=K(()=>s.title||u("Manage Media")),v=K(()=>s.selectedCount>0?u("Apply to all (%1$s)",s.selectedCount):u("Apply to all")),w=K(()=>p.value.filter(U=>U.id>0)),k=K(()=>p.value.filter(U=>!U.id)),b=K(()=>s.showUrlTab),x=K(()=>Array.isArray(s.modelValue)?s.modelValue:[]),F=K(()=>x.value.filter(U=>U&&U.url)),M=()=>{p.value=JSON.parse(JSON.stringify(x.value)),m.value="gallery",_.value="",g.value=s.defaultApplyToAll,c.value=!0},$=()=>{(JSON.stringify(p.value)!==JSON.stringify(x.value)||g.value)&&(i("update:modelValue",p.value),i("change",p.value,{applyToAll:g.value})),c.value=!1},S=()=>{c.value=!1},I=U=>{p.value.splice(U,1)},Q=U=>{const O=U.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 R=new Set(p.value.map(P=>P.url));for(const P of O)R.has(P.url)||(p.value.push(P),R.add(P.url))},D=()=>{const U=_.value.trim();if(!U)return;if(p.value.some(P=>P.url===U)){_.value="";return}const O=U.split("/").pop().split("?")[0]||"image",R={id:0,url:U,title:O};s.multiple?p.value.push(R):p.value=[R],_.value=""},V=U=>{const O=p.value.findIndex(R=>R.url===U);O!==-1&&p.value.splice(O,1)};return(U,O)=>{const R=C("el-tag"),P=C("el-button"),j=C("el-tab-pane"),q=C("el-input"),z=C("el-tabs"),X=C("el-checkbox"),ne=C("el-dialog");return r(),h(H,null,[o("div",{class:re(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured,"is-square":e.square}]),onClick:M},[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,HM),o("span",PM,[n(J,{name:"Edit"})]),e.modelValue.length>1?(r(),E(R,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:d(()=>[L(f(e.modelValue.length)+" "+f(U.$t("images")),1)]),_:1})):B("",!0)],8,OM)):(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},[F.value.length?(r(),h("div",{key:0,class:re(["fmp-stack",{"is-square":e.square}])},[(r(!0),h(H,null,ae(F.value.slice(0,e.maxThumbs),(he,N)=>(r(),h("span",{key:N,class:"fmp-thumb-wrap",style:ra({zIndex:e.maxThumbs-N})},[o("img",{src:he.url,alt:he.title||"",class:"fmp-thumb",onError:l},null,40,NM)],4))),128)),F.value.length>e.maxThumbs?(r(),h("span",KM,"+"+f(F.value.length-e.maxThumbs),1)):B("",!0),O[4]||(O[4]=Fn('<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",GM,[(r(!0),h(H,null,ae(e.modelValue.slice(0,4),(he,N)=>(r(),h("div",{class:"fmp-preview-item",key:N},[o("img",{src:he.url,alt:he.title||""},null,8,jM),N===3&&e.modelValue.length>4?(r(),h("span",zM,"+"+f(e.modelValue.length-4),1)):B("",!0)]))),128))])):(r(),h("button",qM,[O[5]||(O[5]=Fn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="none" width="20" height="20"><path d="M9.5 10C10.6046 10 11.5 9.10457 11.5 8C11.5 6.89543 10.6046 6 9.5 6C8.39543 6 7.5 6.89543 7.5 8C7.5 9.10457 8.39543 10 9.5 10Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13.5 2H9.5C4.5 2 2.5 4 2.5 9V15C2.5 20 4.5 22 9.5 22H15.5C20.5 22 22.5 20 22.5 15V10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.25 5H21.75" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M19 7.75V2.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M3.16992 18.9501L8.09992 15.6401C8.88992 15.1101 10.0299 15.1701 10.7399 15.7801L11.0699 16.0701C11.8499 16.7401 13.1099 16.7401 13.8899 16.0701L18.0499 12.5001C18.8299 11.8301 20.0899 11.8301 20.8699 12.5001L22.4999 13.9001" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)),o("span",null,f(U.$t("Add Media")),1)]))],64))],2),c.value?(r(),E(ne,{key:0,modelValue:c.value,"onUpdate:modelValue":O[3]||(O[3]=he=>c.value=he),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,onClose:S,class:"fct-bulk-media-picker-modal"},{default:d(()=>[o("div",YM,[n(z,{modelValue:m.value,"onUpdate:modelValue":O[1]||(O[1]=he=>m.value=he)},{default:d(()=>[n(j,{label:U.$t("Gallery"),name:"gallery"},{default:d(()=>[p.value.length?(r(),E(A(Zs),{key:0,list:p.value,class:"fmp-grid",tag:"div",animation:200},{default:d(()=>[(r(!0),h(H,null,ae(p.value,(he,N)=>(r(),h("div",{class:"fmp-grid-item",key:he.url||N},[o("img",{src:he.url,alt:he.title||""},null,8,WM),N===0?(r(),E(R,{key:0,type:"primary",size:"small",class:"fmp-featured-tag"},{default:d(()=>[L(f(U.$t("Featured")),1)]),_:1})):B("",!0),o("button",{type:"button",class:"fmp-remove-btn",onClick:Ne(G=>I(N),["stop"]),title:U.$t("Remove")}," × ",8,XM)]))),128))]),_:1},8,["list"])):(r(),h("div",JM,[o("p",null,f(U.$t("No media added yet.")),1)]))]),_:1},8,["label"]),b.value?(r(),E(j,{key:0,name:"imported-urls"},{label:d(()=>[L(f(U.$t("Add by URL"))+" ",1),k.value.length?(r(),E(R,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:d(()=>[L(f(k.value.length),1)]),_:1})):B("",!0)]),default:d(()=>[o("div",ZM,[(r(!0),h(H,null,ae(k.value,he=>(r(),h("div",{class:"fmp-url-item",key:he.url},[o("img",{src:he.url,alt:he.title||"",class:"fmp-url-thumb"},null,8,e7),o("div",t7,[o("span",a7,f(he.title),1),o("span",l7,f(he.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ne(N=>V(he.url),["stop"]),title:U.$t("Remove")}," × ",8,s7)]))),128)),o("div",n7,[n(q,{modelValue:_.value,"onUpdate:modelValue":O[0]||(O[0]=he=>_.value=he),placeholder:U.$t("Paste image URL..."),size:"small",onKeyup:xa(D,["enter"])},null,8,["modelValue","placeholder"]),n(P,{size:"small",onClick:D,disabled:!_.value.trim()},{default:d(()=>[L(f(U.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):B("",!0)]),_:1},8,["modelValue"])]),o("div",o7,[n(Oc,{attachments:w.value,multiple:e.multiple,onOnMediaSelected:Q},null,8,["attachments","multiple"]),o("div",i7,[e.showApplyToAll?(r(),h("label",{key:0,class:re(["fct-media-picker-apply-to-group-label",{"is-enabled":g.value}])},[n(X,{modelValue:g.value,"onUpdate:modelValue":O[2]||(O[2]=he=>g.value=he),"aria-label":U.$t("Apply media to all variants in this group")},null,8,["modelValue","aria-label"]),L(" "+f(v.value),1)],2)):B("",!0),o("div",r7,[n(P,{onClick:S},{default:d(()=>[L(f(U.$t("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:$},{default:d(()=>[L(f(U.$t("Save")),1)]),_:1})])])])]),_:1},8,["modelValue","title"])):B("",!0)],64)}}},d7={},u7={class:"fct-shared-variant-item-box"},c7={key:0,class:"fct-shared-variant-item-box__header"},A7={class:"fct-shared-variant-item-box__label"},p7={class:"fct-shared-variant-item-box__action"},f7={class:"fct-shared-variant-item-box__body"};function m7(e,t){return r(),h("div",u7,[e.$slots.label||e.$slots.action?(r(),h("div",c7,[o("div",A7,[Ba(e.$slots,"label")]),o("div",p7,[Ba(e.$slots,"action")])])):B("",!0),o("div",f7,[Ba(e.$slots,"default")])])}const Rn=st(d7,[["render",m7]]),h7={class:"fct-product-media-row"},_7={key:0,class:"fct-variant-title-readonly"},v7={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},g7={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},y7={class:"fct-admin-input-wrapper"},b7={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,titleInfo:Object},setup(e){const t=e,a=K(()=>{var s;return["simple_variations","advanced_variations"].includes((s=t.product.detail)==null?void 0:s.variation_type)}),l=K(()=>{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(Rn,{key:0,class:"fct-product-media-and-title"},{default:d(()=>[o("div",h7,[n(hl,{modelValue:e.variant.media,"onUpdate:modelValue":i[0]||(i[0]=m=>e.variant.media=m),featured:!0,compact:!1,onChange:i[1]||(i[1]=m=>e.productEditModel.updatePricingOtherValue("media",m,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),l.value?(r(),h("div",_7,[e.titleInfo&&e.titleInfo.group?(r(),h("div",v7,f(e.titleInfo.group),1)):B("",!0),o("div",g7,f(e.titleInfo&&e.titleInfo.detail||e.variant.variation_title),1)])):(r(),E(p,{key:1,label:A(u)("Variation Title")},{default:d(()=>[o("div",y7,[n(c,{class:re(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]=m=>e.variant.variation_title=m),onInput:i[3]||(i[3]=m=>{e.productEditModel.updatePricingValue("variation_title",m,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):B("",!0)}}},w7=st(b7,[["__scopeId","data-v-81001ec3"]]),C7={class:"fct-variant-item-collapse"},k7={class:"fct-variant-item-collapse-header"},B7={class:"fct-variant-item-collapse-body"},Ep={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=K({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=K(()=>s.value.includes("1"));return(c,p)=>{const m=C("el-collapse-item"),_=C("el-collapse");return r(),h("div",C7,[n(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),accordion:""},{default:d(()=>[n(m,{name:"1",icon:A(Hf)},{title:d(()=>[o("div",k7,[Ba(c.$slots,"header",{isOpen:i.value})])]),default:d(()=>[o("div",B7,[Ba(c.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},x7=["innerHTML"],zs={__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:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=K(()=>je.get("shop.currency_sign","$")),i=K(()=>a.numberFormat==="dot_comma"),c=K(()=>{const U=je.get("shop.decimal_separator","");return U==="comma"?",":U==="dot"?".":i.value?",":"."}),p=K(()=>c.value===","?".":","),m=K(()=>c.value===","?"de-DE":"en-US"),_=/[\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=>String(U||"").replace(/^0+(?=\d)/,""),v=U=>String(U??"").replace(/[^\d.,]/g,""),w=U=>{const O=v(U);if(!O)return"";const R=O.lastIndexOf("."),P=O.lastIndexOf(","),j=Math.max(R,P);if(j===-1)return y(O.replace(/[.,]/g,""));const q=y(O.slice(0,j).replace(/[^\d]/g,"")),z=O.slice(j+1).replace(/[^\d]/g,""),X=O.charAt(j),ne=(O.match(new RegExp(`\\${X}`,"g"))||[]).length,he=j===O.length-1,N=O.includes(".")&&O.includes(",");if(!he&&!N&&X===p.value&&(ne>1||z.length>2))return y(O.replace(/[^\d]/g,""));const Z=q||"0";return he?`${Z}.`:`${Z}.${z.slice(0,2)}`},k=U=>{if(U==null||U==="")return NaN;const O=typeof U=="number"?String(U):w(U);return O?parseFloat(O.replace(/\.$/,"")):NaN},b=U=>{const O=k(U);return isNaN(O)?"":O.toLocaleString(m.value,{minimumFractionDigits:0,maximumFractionDigits:2})},x=U=>{if(!U)return"";const O=U.endsWith("."),[R="",P=""]=U.split("."),j=(R||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return O?`${j}${c.value}`:P?`${j}${c.value}${P}`:j},F=(U,O=!1)=>{const R=k(U);return isNaN(R)?"":(O?M(R):R).toFixed(2)},M=U=>a.min===null||a.min===void 0||isNaN(U)?U:U<a.min?a.min:U,$=T(""),S=T(""),I=T(!1),Q=U=>{const O=F(U);if(!O){$.value="",S.value="";return}$.value=b(O),S.value=O},D=U=>{const O=w(U);if(S.value=O,$.value=x(O),I.value=!0,O===""){l("update:modelValue","");return}const R=F(O);R!==""&&R!==F(a.modelValue)&&l("update:modelValue",R)},V=()=>{const U=I.value?S.value:a.modelValue;if(U==="")l("update:modelValue",""),l("change",""),$.value="",S.value="";else{const O=F(U,!0);O===""?Q(a.modelValue):(l("update:modelValue",O),O!==F(a.modelValue)&&l("change",O),$.value=b(O),S.value=O)}I.value=!1};return be([()=>a.modelValue,()=>a.numberFormat],([U])=>{I.value||Q(U)}),Q(a.modelValue),(U,O)=>{const R=C("el-input");return r(),E(R,{class:re(e.errorClass),id:e.id,placeholder:e.placeholder,"model-value":$.value,disabled:e.disabled,onBlur:V,onInput:D,onKeydown:g},la({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]),1032,["class","id","placeholder","model-value","disabled"])}}},S7={key:0,class:"fct-shared-variant-item-box__switch"},F7={class:"fct-shared-variant-item-box__hint"},$7={key:1,class:"fct-inline-select-wrap"},E7={class:"fct-price-with-inclusion"},U7={key:0,class:"fct-required"},I7={class:"fct-admin-input-wrapper"},Q7={key:0},D7={key:0,class:"fct-collapse-heading"},V7={key:1,class:"fct-tag-group"},T7={class:"fct-tag-item"},M7={class:"fct-tags-internal"},L7={key:0,class:"fct-tag-item"},R7={class:"fct-tags-internal"},O7={key:1,class:"fct-tag-item"},H7={class:"fct-tags-internal"},P7={key:2,class:"fct-tag-item"},N7={class:"fct-tags-internal"},K7={class:"fct-tag-item"},G7={class:"fct-tags-internal"},j7={class:"fct-shared-variant-pricing-additional"},z7={class:"fct-admin-input-wrapper"},q7={class:"fct-admin-input-wrapper"},Y7={class:"fct-admin-input-wrapper"},W7={key:0},X7={class:"fct-admin-input-wrapper"},J7={class:"fct-admin-input-wrapper"},Z7={class:"fct-admin-input-wrapper"},eL={class:"fct-admin-input-wrapper"},tL={class:"fct-admin-input-wrapper"},aL={class:"fct-admin-input-wrapper"},lL={class:"fct-admin-input-wrapper"},qi=2,Up={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=je.get("app_config.isProActive"),l=T(),s=T([""]),i=T(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 b;return(b=t.variant)==null?void 0:b.id},()=>{var b,x;i.value=Number((x=(b=t.variant)==null?void 0:b.other_info)==null?void 0:x.signup_fee)||0}),be(()=>{var b,x;return(x=(b=t.variant)==null?void 0:b.other_info)==null?void 0:x.payment_type},b=>{b==="subscription"&&(s.value="1")}),be(()=>{var b;return(b=t.productEditModel)==null?void 0:b.validationErrors},b=>{if(!b||Object.keys(b).length===0)return;Object.keys(b).some(F=>{for(const M of c)if(F.includes(M))return!0;return!1})&&(s.value="1")},{deep:!0});let p=t.product.variants.length>0;const m=K(()=>{var b;return((b=window.fluentCartAdminApp)==null?void 0:b.subscription_intervals)??[]}),_=()=>{var b,x,F;return((b=t.variant)==null?void 0:b.other_info)&&["subscription"].includes((F=(x=t.variant)==null?void 0:x.other_info)==null?void 0:F.payment_type)},g=(b,x,F,M)=>{t.productEditModel.updatePricingOtherValue(b,x,F,M,t.modeType)},y=(b,x,F)=>{const M=Number(b);(!Number.isFinite(M)||M<qi)&&g("times",qi,x,F)},v=b=>{t.productEditModel.updatePricingOtherValue("manage_setup_fee",b,t.fieldKey,t.variant,t.modeType),b==="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)},w=K(()=>{var F,M;const b=Number(t.variant.item_price)||0,x=Number((M=(F=t.variant)==null?void 0:F.other_info)==null?void 0:M.times)||1;return b*x}),k=b=>{const x=m.value.find(M=>M.value===b);return!(x!=null&&x.label)&&!b?"":((x==null?void 0:x.label)||b).split(" ").map(M=>M.charAt(0).toUpperCase()).join("")};return(b,x)=>{const F=C("el-switch"),M=C("el-option"),$=C("el-select"),S=C("el-form-item"),I=C("el-col"),Q=C("el-input"),D=C("el-row"),V=C("el-checkbox"),U=C("el-tooltip");return r(),E(Rn,null,{label:d(()=>[L(f(A(u)("Pricing")),1)]),action:d(()=>{var O;return[(O=e.variant)!=null&&O.other_info?(r(),h("div",S7,[e.isGroupMode?(r(),h("div",$7,[o("label",null,f(A(u)("Payment Type"))+":",1),n($,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":x[1]||(x[1]=R=>e.variant.other_info.payment_type=R),"popper-class":"fct-group-select-popper",onChange:x[2]||(x[2]=R=>{R==="subscription"&&!e.variant.other_info.repeat_interval&&Be(()=>{e.variant.other_info.repeat_interval="yearly"})}),class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(M,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(M,{value:"subscription",label:A(u)("Subscription")},null,8,["label"]),n(M,{value:"onetime",label:A(u)("One-time")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(H,{key:0},[o("span",F7,f(A(u)("Subscription")),1),n(F,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:x[0]||(x[0]=R=>{const P=R?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",P,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",R&&Be(()=>{var j;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((j=l.value.value)==null||j.focus())})})},null,8,["model-value"])],64))])):B("",!0)]}),default:d(()=>[o("div",E7,[n(S,{class:"fct-price-with-inclusion__price"},{label:d(()=>{var O,R;return[L(f(((R=(O=e.variant)==null?void 0:O.other_info)==null?void 0:R.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"))+" ",1),e.isGroupMode?B("",!0):(r(),h("span",U7,"*"))]}),default:d(()=>{var O,R;return[o("div",I7,[n(zs,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):((R=(O=e.variant)==null?void 0:O.other_info)==null?void 0:R.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":x[3]||(x[3]=P=>{e.variant.item_price=P,e.productEditModel.updatePricingValue("item_price",P,e.fieldKey,e.variant,e.modeType)})},{suffix:d(()=>{var P,j,q,z;return[((j=(P=e.variant)==null?void 0:P.other_info)==null?void 0:j.installment)==="yes"?(r(),h("span",Q7," x "+f((z=(q=e.variant)==null?void 0:q.other_info)==null?void 0:z.times),1)):B("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(r(),E(S,{key:0,class:"fct-price-with-inclusion__tax"},{label:d(()=>[L(f(A(u)("Tax")),1)]),default:d(()=>{var O,R;return[e.isGroupMode?(r(),E($,{key:0,modelValue:e.variant.other_info.tax_inclusion,"onUpdate:modelValue":x[4]||(x[4]=P=>e.variant.other_info.tax_inclusion=P),"popper-class":"fct-group-select-popper"},{default:d(()=>[n(M,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(M,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(M,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E($,{key:1,"model-value":((R=(O=e.variant)==null?void 0:O.other_info)==null?void 0:R.tax_inclusion)||"_default_",onChange:x[5]||(x[5]=P=>{const j=P==="_default_"?"":P;e.variant.other_info&&(e.variant.other_info.tax_inclusion=j),e.productEditModel.updatePricingOtherValue("tax_inclusion",j,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[n(M,{value:"_default_",label:A(u)("Store default")},null,8,["label"]),n(M,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(M,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"]))]}),_:1})):B("",!0)]),n(Ep,{modelValue:s.value,"onUpdate:modelValue":x[27]||(x[27]=O=>s.value=O)},{header:d(({isOpen:O})=>{var R,P,j,q,z,X;return[O?(r(),h("div",D7,f(A(u)("Additional display prices")),1)):(r(),h("div",V7,[o("div",T7,[L(f(A(u)("Compare-at"))+" ",1),o("span",M7,f((R=e.variant)!=null&&R.compare_price?b.appVars.shop.currency_sign+e.variant.compare_price:0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),h("div",L7,[L(f(A(u)("Installment"))+" ",1),o("span",R7,f(((j=(P=e.variant)==null?void 0:P.other_info)==null?void 0:j.installment)==="yes"?A(u)("Yes"):A(u)("No")),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",O7,[L(f(A(u)("Interval"))+" ",1),o("span",H7,f(k(e.variant.other_info.repeat_interval)),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",P7,[L(f(A(u)("Trial Days"))+" ",1),o("span",N7,f(((z=(q=e.variant)==null?void 0:q.other_info)==null?void 0:z.trial_days)??0),1)])):B("",!0),o("div",K7,[L(f(A(u)("Cost Per Item"))+" ",1),o("span",G7,f((X=e.variant)!=null&&X.item_cost?b.appVars.shop.currency_sign+e.variant.item_cost:A(u)("N/A")),1)])]))]}),default:d(()=>[o("div",j7,[n(D,{gutter:15},{default:d(()=>[n(I,{lg:12},{default:d(()=>[o("div",z7,[n(S,null,{label:d(()=>[n(pa,{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(zs,{"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":x[6]||(x[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(oa,{"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(I,{lg:12},{default:d(()=>[o("div",q7,[n(S,{label:A(u)("Interval"),required:""},{default:d(()=>[n($,{class:re(["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":x[7]||(x[7]=O=>e.variant.other_info.repeat_interval=O),placeholder:A(u)("Interval"),onChange:x[8]||(x[8]=O=>{e.productEditModel.updatePricingOtherValue("repeat_interval",O,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[(r(!0),h(H,null,ae(m.value,O=>(r(),E(M,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),n(I,{lg:12},{default:d(()=>[n(S,{class:"has-tooltip"},{label:d(()=>[n(pa,{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(Q,{class:re(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":x[9]||(x[9]=O=>e.variant.other_info.trial_days=O),modelModifiers:{number:!0},autofocus:"",onInput:x[10]||(x[10]=O=>{e.productEditModel.updatePricingOtherValue("trial_days",O,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(oa,{"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(D,{key:0},{default:d(()=>{var O;return[n(I,{lg:24},{default:d(()=>[n(S,null,{default:d(()=>[n(V,{"true-value":"yes","false-value":"no",label:A(u)("Enable installment payment"),class:re(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":x[11]||(x[11]=R=>e.variant.other_info.installment=R),modelModifiers:{number:!0},disabled:!A(a),onChange:x[12]||(x[12]=R=>{if(g("installment",R,e.fieldKey,e.variant),R==="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(U,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[L(f(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(oa,{"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(D,{gutter:15},{default:d(()=>{var R;return[n(I,{lg:12},{default:d(()=>[n(S,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(pa,{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(Q,{class:re(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:A(u)("Installment Count"),type:"number",min:qi,modelValue:e.variant.other_info.times,"onUpdate:modelValue":x[13]||(x[13]=P=>e.variant.other_info.times=P),modelModifiers:{number:!0},onInput:x[14]||(x[14]=P=>{g("times",P,e.fieldKey,e.variant)}),onChange:x[15]||(x[15]=P=>{y(P,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:l},null,8,["class","id","placeholder","modelValue"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((R=e.variant.other_info)==null?void 0:R.installment)==="yes"?(r(),E(I,{key:0,lg:12},{default:d(()=>[n(S,null,{label:d(()=>[n(pa,{title:A(u)("Total Price"),content:A(u)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:d(()=>[n(Q,{id:`${e.fieldKey}.total_price`,type:"number",min:1,disabled:"","model-value":w.value,autofocus:""},{prefix:d(()=>[o("span",null,f(b.appVars.shop.currency_sign),1)]),_:1},8,["id","model-value"]),n(oa,{"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(D,{key:1,gutter:15},{default:d(()=>{var O,R;return[n(I,{lg:24},{default:d(()=>[o("div",Y7,[n(S,{label:e.isGroupMode?A(u)("Setup fee"):void 0,class:re(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E($,{key:0,size:"small",modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":x[16]||(x[16]=P=>e.variant.other_info.manage_setup_fee=P),style:{width:"160px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(M,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(M,{value:"yes",label:A(u)("Setup fee: Yes")},null,8,["label"]),n(M,{value:"no",label:A(u)("Setup fee: No")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),h(H,{key:1},[n(F,{size:"small",disabled:!A(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":x[17]||(x[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",W7,[n(U,{"popper-class":"fct-tooltip"},{content:d(()=>[L(f(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:((R=(O=e.variant)==null?void 0:O.other_info)==null?void 0:R.manage_setup_fee)=="yes",accordion:""},{default:d(()=>[n(D,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:d(()=>[n(I,{lg:12},{default:d(()=>[o("div",X7,[n(S,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(pa,{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(Q,{class:re(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":x[18]||(x[18]=P=>e.variant.other_info.signup_fee_name=P),onInput:x[19]||(x[19]=P=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",P,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),n(I,{lg:12},{default:d(()=>[o("div",J7,[n(S,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(pa,{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(zs,{"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":x[20]||(x[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(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"]),n(oa,{"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(D,{gutter:15},{default:d(()=>[e.variant.manage_cost||e.isGroupMode?(r(),E(I,{key:0,lg:24,class:"fct-manage-cost-col"},{default:d(()=>[o("div",Z7,[n(S,{label:e.isGroupMode?A(u)("Calculate profit/cost"):void 0,class:re(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E($,{key:0,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":x[21]||(x[21]=O=>e.variant.manage_cost=O),style:{width:"200px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(M,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(M,{value:"true",label:A(u)("Enable")},null,8,["label"]),n(M,{value:"false",label:A(u)("Disable")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(F,{key:1,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":x[22]||(x[22]=O=>e.variant.manage_cost=O),"active-value":"true","inactive-value":"false",onChange:x[23]||(x[23]=O=>{A(p)&&e.productEditModel.updatePricingOtherValue("manage_cost",O,e.fieldKey,e.variant,e.modeType),bf(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(D,{gutter:15,class:"fct-cost-profit-wrap"},{default:d(()=>{var O,R,P;return[n(I,{lg:e.isGroupMode?24:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?12:8},{default:d(()=>[o("div",eL,[n(S,null,{label:d(()=>[n(pa,{title:A(u)("Cost per item"),content:A(u)("Customers won't see this")},null,8,["title","content"])]),default:d(()=>[n(zs,{"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":x[24]||(x[24]=j=>{e.variant.item_cost=j,e.productEditModel.updatePricingValue("item_cost",j,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(oa,{"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(I,{key:0,lg:((R=e.product.detail)==null?void 0:R.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",tL,[n(S,{label:A(u)("Profit")},{default:d(()=>[n(Q,{disabled:"",class:"fct-profit-display",value:A(dm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?B("",!0):(r(),E(I,{key:1,lg:((P=e.product.detail)==null?void 0:P.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",aL,[n(S,{label:A(u)("Margin")},{default:d(()=>[n(Q,{disabled:"",class:"fct-margin-display",value:A(um)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),n(I,{lg:24},{default:d(()=>[o("div",lL,[(e.variant.other_info,B("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},sL={class:"fct-adjust-by-wrap"},nL={class:"fct-adjust-by-row"},oL={class:"fct-adjust-by-col"},iL={class:"title"},rL={class:"fct-adjust-by-col"},dL={class:"title"},uL={class:"fct-adjust-by-action"},Vr={__name:"StockAdjuster",props:{variant:Object,fieldKey:String,productEditModel:Object},emits:["save"],setup(e,{expose:t,emit:a}){const l=a,s=T(!1);return t({toggle:()=>s.value=!s.value}),(i,c)=>{const p=C("el-input"),m=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",sL,[o("div",nL,[o("div",oL,[o("span",iL,f(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",rL,[o("span",dL,f(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",uL,[n(m,{size:"small",type:"info",soft:"",onClick:c[5]||(c[5]=g=>s.value=!1)},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(m,{size:"small",type:"primary",onClick:c[6]||(c[6]=g=>{s.value=!1,l("save")}),disabled:e.variant.new_stock===""},{default:d(()=>[L(f(A(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},cL={class:"fct-shared-variant-item-box__switch"},AL={key:1,class:"fct-inline-select-wrap"},pL={key:0,class:"fct-variant-stock-grid"},fL={class:"fct-variant-stock-box"},mL={class:"fct-stock-box-label"},hL={class:"fct-stock-box-content fct-stock-box-total-content"},_L={class:"fct-stock-number"},vL={class:"fct-variant-stock-box"},gL={class:"fct-stock-box-label"},yL={class:"fct-stock-box-content"},bL={class:"fct-stock-number"},wL={class:"fct-variant-stock-box"},CL={class:"fct-stock-box-label"},kL={class:"fct-stock-box-content"},BL={class:"fct-stock-number"},xL={class:"fct-variant-stock-box"},SL={class:"fct-stock-box-label"},FL={class:"fct-stock-box-content"},$L={class:"fct-stock-number"},EL={key:1,class:"fct-admin-input-wrapper"},UL={key:0,class:"fct-collapse-heading"},IL={key:1,class:"fct-tag-group"},QL={class:"fct-tag-item"},DL={class:"fct-admin-input-wrapper"},VL={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},TL=["disabled"],Ip={__name:"VariantInventory",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=T(!1),l=K(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),s=K(()=>{var m;return["simple_variations","advanced_variations"].includes((m=t.product.detail)==null?void 0:m.variation_type)}),i=m=>{t.productEditModel.updatePricingValue("manage_stock",m,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 c=()=>{let m=parseInt(t.variant.new_stock)||0;const _=t.variant.total_stock,g=t.variant.available;t.variant.total_stock=m<0?0:m;let y=(parseInt(t.variant.total_stock)||0)-(parseInt(t.variant.committed)||0)-(parseInt(t.variant.on_hold)||0);t.variant.available=y<0?0:y,t.variant.adjusted_quantity=0,t.variant.new_stock=t.variant.total_stock,ue.put(`products/${t.product.ID}/update-inventory/${t.variant.id}`,{total_stock:t.variant.total_stock,available:t.variant.available}).then(v=>{Y.success(v.message)}).catch(v=>{var w;t.variant.total_stock=_,t.variant.available=g,t.variant.new_stock=_,Y.error(((w=v==null?void 0:v.data)==null?void 0:w.message)||u("Failed to update inventory"))})},p=()=>{var v;if(a.value)return;const m=t.product.post_title||"";if(!m)return;const g=["simple_variations","advanced_variations"].includes((v=t.product.detail)==null?void 0:v.variation_type)&&t.variant.variation_title||"",y=t.variant.id||0;a.value=!0,ue.get("products/suggest-sku",{title:m,variant_title:g,exclude_id:y}).then(w=>{w!=null&&w.sku&&(t.variant.sku=w.sku,t.productEditModel.updatePricingValue("sku",w.sku,t.fieldKey,t.variant,t.modeType))}).catch(w=>{var b;const k=((b=w==null?void 0:w.data)==null?void 0:b.message)||u("Failed to generate SKU.");Y.error(k)}).finally(()=>{a.value=!1})};return(m,_)=>{var b;const g=C("el-switch"),y=C("el-option"),v=C("el-select"),w=C("el-input"),k=C("el-form-item");return r(),E(Rn,{class:re(["fct-variant-inventory",((b=e.product.detail)==null?void 0:b.variation_type)==="simple"?"fct-variant-inventory--simple":""])},la({default:d(()=>[l.value&&s.value&&!e.isGroupMode?(r(),h("div",pL,[o("div",fL,[o("div",mL,f(A(u)("Total Stock")),1),o("div",hL,[o("div",_L,f(e.variant.total_stock),1),n(Vr,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:c},null,8,["variant","field-key","product-edit-model"])])]),o("div",vL,[o("div",gL,f(A(u)("Available")),1),o("div",yL,[o("div",bL,f(e.variant.available),1)])]),o("div",wL,[o("div",CL,f(A(u)("On Hold")),1),o("div",kL,[o("div",BL,f(e.variant.on_hold),1)])]),o("div",xL,[o("div",SL,f(A(u)("Delivered")),1),o("div",FL,[o("div",$L,f(e.variant.committed),1)])])])):B("",!0),l.value&&s.value&&e.isGroupMode?(r(),h("div",EL,[n(k,{label:A(u)("Total Stock")},{default:d(()=>[n(w,{type:"number",min:0,placeholder:A(u)("Unchanged"),modelValue:e.variant.total_stock,"onUpdate:modelValue":_[2]||(_[2]=x=>e.variant.total_stock=x)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])])):B("",!0),e.isGroupMode?B("",!0):(r(),E(Ep,{key:2},{header:d(({isOpen:x})=>[x?(r(),h("div",UL,f(A(u)("More details")),1)):B("",!0),x?B("",!0):(r(),h("div",IL,[o("div",QL,f(A(u)("SKU")),1)]))]),default:d(()=>[o("div",DL,[n(k,null,{label:d(()=>[o("div",VL,[n(pa,{title:A(u)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),o("button",{type:"button",onClick:p,disabled:!e.product.post_title||a.value,class:"underline-link-button fct-generate-sku-btn"},f(a.value?A(u)("Generating..."):A(u)("Generate SKU")),9,TL)])]),default:d(()=>[n(w,{class:re(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:A(u)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":_[3]||(_[3]=x=>e.variant.sku=x),maxlength:"30","show-word-limit":"",onInput:_[4]||(_[4]=x=>{e.productEditModel.updatePricingValue("sku",x,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}))]),_:2},[s.value?{name:"label",fn:d(()=>[L(f(A(u)("Inventory")),1)]),key:"0"}:void 0,s.value?{name:"action",fn:d(()=>[o("div",cL,[e.isGroupMode?(r(),h("div",AL,[o("label",null,f(A(u)("Manage Stock"))+":",1),n(v,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":_[1]||(_[1]=x=>e.variant.manage_stock=x),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(y,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(y,{value:"1",label:A(u)("Manage stock")},null,8,["label"]),n(y,{value:"0",label:A(u)("Don't manage")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),E(g,{key:0,size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":_[0]||(_[0]=x=>e.variant.manage_stock=x),onChange:i,"active-value":"1","inactive-value":"0"},null,8,["modelValue"]))])]),key:"1"}:void 0]),1032,["class"])}}},ML={class:"fct-shared-variant-item-box__switch"},LL={class:"fct-shared-variant-item-box__hint"},RL={key:1,class:"fct-inline-select-wrap"},OL={key:0,class:"fct-package-select-icon"},HL={class:"fct-add-new-package-option"},PL={class:"fct-package-options"},NL={class:"fct-package-options-info"},KL={class:"fct-package-options-name"},GL={class:"fct-package-options-dimensions"},jL={class:"fct-product-weight-input"},Qp={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){var k,b;const t=e,a=T(!1),l=T(!1),s=T(je.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=K(()=>{var F,M;const x=(M=(F=t.variant)==null?void 0:F.other_info)==null?void 0:M.package_slug;return x?s.value.find($=>$.slug===x)||null:s.value.find($=>$.is_default)||null}),m=x=>{if(!x)return u("Select a package");const F=x.type==="envelope"?x.length+" × "+x.width+" "+x.dimension_unit:x.length+" × "+x.width+" × "+x.height+" "+x.dimension_unit;return(x.is_default?u("Store default")+" · ":"")+x.name+" - "+F+", "+x.weight+" "+x.weight_unit},_=()=>ue.get("shipping/packages").then(x=>{s.value=x.packages||s.value}).catch(()=>{Qd({message:u("Failed to load packages."),type:"error"})}),g=T(((b=(k=t.variant)==null?void 0:k.other_info)==null?void 0:b.package_slug)||""),y=async x=>{if(x==="__add_new__"){t.variant.other_info.package_slug=g.value,await _(),a.value=!0;return}g.value=x||"",t.productEditModel.updatePricingOtherValue("package_slug",x,t.fieldKey,t.variant,t.modeType)},v=x=>{t.productEditModel.updatePricingOtherValue("weight_unit",x,t.fieldKey,t.variant,t.modeType)},w=x=>{const F=JSON.parse(JSON.stringify(s.value));x.is_default&&s.value.forEach(S=>{S.is_default=!1});let M=x.slug,$=1;for(;s.value.some(S=>S.slug===M);)M=x.slug+"-"+$,$++;x.slug=M,s.value.push(x),l.value=!0,ue.post("shipping/packages",{packages:s.value}).then(S=>{s.value=S.packages||s.value,a.value=!1,y(x.slug)}).catch(()=>{s.value=F,Qd({message:u("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(x,F)=>{const M=C("el-switch"),$=C("el-option"),S=C("el-select"),I=C("el-form-item"),Q=C("el-col"),D=C("el-input"),V=C("el-row");return r(),h(H,null,[e.variant.other_info?(r(),E(Rn,{key:0},{label:d(()=>[L(f(A(u)("Shipping")),1)]),action:d(()=>[o("div",ML,[e.isGroupMode?(r(),h("div",RL,[o("label",null,f(A(u)("Fulfillment Type"))+":",1),n(S,{size:"small",modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":F[2]||(F[2]=U=>e.variant.fulfillment_type=U),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n($,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n($,{value:"physical",label:A(u)("Physical")},null,8,["label"]),n($,{value:"digital",label:A(u)("Digital")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(H,{key:0},[o("span",LL,f(A(u)("Physical Product")),1),n(M,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":F[0]||(F[0]=U=>e.variant.fulfillment_type=U),"active-value":"physical","inactive-value":"digital",onChange:F[1]||(F[1]=U=>{e.productEditModel.updatePricingValue("fulfillment_type",U,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(V,{gutter:10,class:"fct-physical-product-meta-row"},{default:d(()=>[n(Q,{xs:24,sm:14,lg:14},{default:d(()=>[n(I,null,{label:d(()=>[L(f(A(u)("Package")),1)]),default:d(()=>[n(S,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":F[3]||(F[3]=U=>e.variant.other_info.package_slug=U),placeholder:A(u)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:d(()=>[p.value?(r(),h("span",OL,[n(J,{name:c[p.value.type]||"Box"},null,8,["name"])])):B("",!0)]),default:d(()=>[n($,{value:"__add_new__",label:A(u)("Add new package")},{default:d(()=>[o("div",HL," + "+f(A(u)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(H,null,ae(s.value,U=>(r(),E($,{key:U.slug,label:m(U),value:U.slug},{default:d(()=>[o("div",PL,[n(J,{name:c[U.type]||"Box"},null,8,["name"]),o("div",NL,[o("span",KL,f(U.is_default?A(u)("Store default")+" · ":"")+f(U.name),1),o("span",GL,f(U.type==="envelope"?U.length+" × "+U.width:U.length+" × "+U.width+" × "+U.height)+" "+f(U.dimension_unit)+", "+f(U.weight)+" "+f(U.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),n(Q,{xs:24,sm:10,lg:10},{default:d(()=>[n(I,null,{label:d(()=>[L(f(A(u)("Product weight")),1)]),default:d(()=>[o("div",jL,[n(D,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":F[5]||(F[5]=U=>e.variant.other_info.weight=U),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:F[6]||(F[6]=U=>{e.productEditModel.updatePricingOtherValue("weight",U,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:d(()=>[n(S,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":F[4]||(F[4]=U=>e.variant.other_info.weight_unit=U),onChange:v,class:"fct-product-weight-unit"},{default:d(()=>[(r(),h(H,null,ae(i,U=>n($,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):B("",!0),n(Jf,{modelValue:a.value,"onUpdate:modelValue":F[7]||(F[7]=U=>a.value=U),saving:l.value,onSave:w},null,8,["modelValue","saving"])],64)}}},zL={key:0,class:"fct-tax-class-control"},qL={class:"fct-inline-select-wrap"},YL={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},WL=["title"],XL={key:1,class:"fct-tax-class-control"},JL={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},ZL=["title"],Dp={__name:"VariationTaxClass",props:{variant:Object,productEditModel:Object,fieldKey:String,modeType:String,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=T([]),l=x=>{if(!x)return"standard";const F=a.value.find($=>String($.slug)===String(x));if(F)return F.slug;const M=a.value.find($=>String($.id)===String(x));return M?M.slug:x},s=K(()=>rt.get(t.variant,"other_info.tax_exempt","no")),i=K(()=>{const x=rt.get(t.variant,"other_info.tax_class","standard");return l(x)||"standard"}),c=T(s.value!=="yes"),p=T(i.value||"standard");be([s,i,a],([x,F])=>{c.value=x!=="yes",p.value=F||"standard"});const m=()=>{t.variant.other_info||(t.variant.other_info={})},_=(x,F)=>{m(),t.variant.other_info.tax_exempt=x,t.variant.other_info.tax_class=F||"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(x=>{a.value=x.classes||[]}).catch(()=>{Y.error(u("Failed to load tax classes"))})},y=x=>{const F=p.value||i.value||"standard";c.value=x,p.value=F,_(x?"no":"yes",F)},v=x=>{p.value=x,c.value=!0,_("no",x)},w=()=>{const x=a.value.find(F=>F.slug===p.value);return x?x.title:"Standard"},k=()=>{var M,$;const x=($=(M=t.variant)==null?void 0:M.other_info)==null?void 0:$.tax_class;if(!x)return u("Unchanged");const F=a.value.find(S=>S.slug===x);return F?F.title:x},b=x=>{t.variant.other_info&&(t.variant.other_info.tax_class=x)};return Ie(()=>{g()}),(x,F)=>{const M=C("el-option"),$=C("el-select"),S=C("el-dropdown-item"),I=C("el-dropdown-menu"),Q=C("el-dropdown"),D=C("el-checkbox");return r(),E(Rn,null,{label:d(()=>[L(f(A(u)("Tax")),1)]),default:d(()=>[e.isGroupMode?(r(),h("div",zL,[o("div",qL,[o("label",null,f(A(u)("Tax Exemption"))+":",1),n($,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":F[0]||(F[0]=V=>e.variant.other_info.tax_exempt=V),size:"small",class:"fct-inline-select",placement:"bottom","popper-class":"fct-group-select-popper"},{default:d(()=>[n(M,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(M,{value:"no",label:A(u)("Charge tax")},null,8,["label"]),n(M,{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",YL,[o("span",null,[L(f(A(u)("Class:"))+" ",1),o("strong",{class:re(e.variant.other_info.tax_class&&e.variant.other_info.tax_class!=="standard"?"text-red-500 dark:text-red-400":"")},f(k()),3)]),a.value.length>1?(r(),E(Q,{key:0,trigger:"click",onCommand:b},{dropdown:d(()=>[n(I,null,{default:d(()=>[n(S,{command:null,class:re({"is-active":!e.variant.other_info.tax_class})},{default:d(()=>[L(f(A(u)("Unchanged")),1)]),_:1},8,["class"]),(r(!0),h(H,null,ae(a.value,V=>(r(),E(S,{key:V.slug,command:V.slug,class:re({"is-active":e.variant.other_info.tax_class===V.slug})},{default:d(()=>[L(f(V.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")},F[2]||(F[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,WL)]),_:1})):B("",!0)])):B("",!0)])):(r(),h("div",XL,[n(D,{class:"fct-tax-class-control__checkbox",modelValue:c.value,"onUpdate:modelValue":F[1]||(F[1]=V=>c.value=V),onChange:y},{default:d(()=>[L(f(A(u)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),c.value&&a.value.length>=1?(r(),h("div",JL,[o("span",null,[L(f(A(u)("Class:"))+" ",1),o("strong",{class:re(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},f(w()),3)]),a.value.length>1?(r(),E(Q,{key:0,trigger:"click",onCommand:v},{dropdown:d(()=>[n(I,null,{default:d(()=>[(r(!0),h(H,null,ae(a.value,V=>(r(),E(S,{key:V.slug,command:V.slug,class:re({"is-active":p.value===V.slug})},{default:d(()=>[L(f(V.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")},F[3]||(F[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,ZL)]),_:1})):B("",!0)])):B("",!0)]))]),_:1})}}},eR={class:"fct-product-pricing-form-wrap"},tR={class:"fct-product-pricing-form-inner"},aR={key:0,class:"dialog-footer"},lR={class:"fct-btn-group sm"},Sd={__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=T({}),i=a,c=ps(),p=T(0),m=T(!1),_=T({}),g=T(null),y=T(!1),v=R=>R?JSON.parse(JSON.stringify(R)):{},w=(R=l.modeType,P=l.index)=>{var q,z,X;if(R==="create")return"create";if(R==="duplicate"){const ne=(q=l.product.variants)==null?void 0:q[P];return`duplicate-${(ne==null?void 0:ne.id)??P??"draft"}`}if(((z=l.product.detail)==null?void 0:z.variation_type)==="simple")return"simple-0";const j=(X=l.product.variants)==null?void 0:X[P];return`update-${(j==null?void 0:j.id)??P??"draft"}`},k=(R=l.modeType,P=l.index,j=s.value)=>({modeType:R,index:P,variant:v(j)}),b=()=>{if(y.value){y.value=!1;return}!g.value||m.value||!p.value||(_.value[g.value]=k())},x=()=>{var R;(R=s.value)!=null&&R.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=S.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},F=async()=>{var P,j,q,z;b(),m.value=!0,p.value=0,g.value=w();const R=(P=_.value[g.value])==null?void 0:P.variant;if(R){s.value=v(R),x(),await Be(),p.value=1,m.value=!1;return}((j=l.product.detail)==null?void 0:j.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((q=l.product.variants)==null?void 0:q[l.index]):l.modeType==="duplicate"?(s.value=v((z=l.product.variants)==null?void 0:z[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={},x(),await Be(),p.value=0,m.value=!1},M=async()=>{var R;try{let P=l.index;const j=v(s.value);l.modeType==="duplicate"&&(P=l.productEditModel.variantsLength(),j.rowId=(j.rowId??0)+1);let q=await l.productEditModel.createOrUpdatePricing(j);return(R=q==null?void 0:q.data)!=null&&R.id?(j.id=q.data.id,l.productEditModel.afterCreatingOrUpdatingPricing(P,j),P==null&&(P=l.product.variants.findIndex(z=>(z==null?void 0:z.id)===j.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(j)}),{index:P,modeType:l.modeType,variant:v(j)}):null}catch{return null}},$=async()=>M(),S=K(()=>je.get("shop.weight_unit")||"kg"),I=()=>{const R={..._.value};return g.value&&p.value&&(R[g.value]=k()),Object.entries(R)},Q=()=>I().length>0,D=()=>I().length,V=K(()=>I().length),U=async()=>{y.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await F()};return be(s,()=>{m.value||p.value++},{deep:!0}),be(()=>[l.modeType,l.index],()=>{F()},{immediate:!0}),be(V,R=>{i("dirtyStateChange",!!R)},{immediate:!0}),c.bind(["mod+s"],R=>{var P,j;((j=(P=l.product)==null?void 0:P.detail)==null?void 0:j.variation_type)!=="simple"&&(R.preventDefault(),p.value&&$())}),Bt(()=>{c.unbind("mod+s")}),t({hasDirtyDrafts:Q,getDirtyDraftCount:D,discardDrafts:U,saveCurrentDraft:M,loadVariantFromProps:F,getVariantData:()=>v(s.value)}),(R,P)=>{const j=C("el-form"),q=C("el-button");return r(),h("div",eR,[o("div",tR,[n(j,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(w7,{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(Up,{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(Ip,{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-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),E(Dp,{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",aR,[o("div",lR,[V.value?(r(),E(q,{key:0,onClick:U},{default:d(()=>[L(f(A(u)("Discard")),1)]),_:1})):B("",!0),n(q,{onClick:P[0]||(P[0]=()=>{i("closeModal")})},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(q,{disabled:e.productEditModel.saving||e.modeType==="update"&&!V.value,onClick:$,type:"primary",loading:e.productEditModel.saving},{default:d(()=>[L(f(typeof s.value.id>"u"?A(u)("Save"):A(u)("Update")),1)]),_:1},8,["disabled","loading"])])])):B("",!0)])}}},sR={class:"fct-product-button-and-drawer-wrap"},nR={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},oR={key:1,class:"fct-btn-group sm"},iR={class:"more-btn"},Yi={__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=T(null);const i=T(1),c=(v="update")=>{l("open-editor",{modeType:v,index:a.index??null})},p=K(()=>{var v;return{product:a.product,variant:a.variant,index:a.index,productEditModel:a.productEditModel,openPricingModal:w=>{c(w)},vueContext:(v=qt())==null?void 0:v.ctx}}),m=T([]),_=()=>{var b,x;const v=((b=window==null?void 0:window.fluent_cart_admin)==null?void 0:b.hooks)||(window==null?void 0:window.fluentCartAdminHooks),w=[],k=(x=v==null?void 0:v.applyFilters)==null?void 0:x.call(v,"fluent_cart_product_pricing_actions_dropdown_items",w,p.value);m.value=Array.isArray(k)?k:w},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 w,k;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const b=((w=window==null?void 0:window.fluent_cart_admin)==null?void 0:w.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(k=b==null?void 0:b.doAction)==null?void 0:k.call(b,"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,w)=>{const k=C("el-button"),b=C("el-checkbox"),x=C("el-dropdown-item"),F=C("el-dropdown-menu"),M=C("el-dropdown");return r(),h("div",sR,[a.modeType=="add"?(r(),h("div",nR,[e.product.detail.variation_type!=="simple"?(r(),E(k,{key:0,text:"",type:"primary",onClick:w[0]||(w[0]=$=>c("create"))},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(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",oR,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:w[1]||(w[1]=$=>c("update"))},{default:d(()=>[n(J,{name:"Edit"})]),_:1}),n(M,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:w[5]||(w[5]=$=>{$&&_()})},{dropdown:d(()=>[n(F,null,{default:d(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),E(x,{key:0,class:"item-checkbox"},{default:d(()=>[n(b,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":w[2]||(w[2]=$=>e.variant.manage_stock=$),onChange:w[3]||(w[3]=$=>{e.productEditModel.onChangePricing("manage_stock",A(s),$)}),"true-value":"0","false-value":"1"},{default:d(()=>[L(f(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):B("",!0),n(x,{class:"show-on-mobile",onClick:w[4]||(w[4]=$=>c("update"))},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),E(x,{key:1,command:"duplicate_pricing"},{default:d(()=>[n(J,{name:"Duplicate"}),L(" "+f(v.$t("Duplicate")),1)]),_:1})):B("",!0),n(x,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(x,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:d(()=>{var $;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:(($=v.appVars)==null?void 0:$.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"}),L(" "+f(v.$t("Direct Checkout"))+" ",1),n(pa,{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(m.value,($,S)=>(r(),E(x,{key:"js_item_"+S,command:$,class:re($==null?void 0:$.class),divided:!!($!=null&&$.divided),disabled:g($)},{default:d(()=>[$!=null&&$.icon?(r(),E(J,{key:0,name:$.icon},null,8,["name"])):B("",!0),L(" "+f($==null?void 0:$.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>i.value?(r(),E(x,{key:2,command:"delete_variant",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(v.$t("Delete")),1)]),_:1})):B("",!0)]),_:1})]),default:d(()=>[o("span",iR,[n(J,{name:"More"})])]),_:1})])):B("",!0)])}}},rR={class:"fct-variant-pricing-add-button-wrap"},dR={__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 m=C("el-button");return r(),h("div",rR,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),E(m,{key:0,text:"",type:"primary",disabled:i(),onClick:s,size:"small"},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(e.product.variants.length>0?c.$t("Add more"):c.$t("Add Pricing")),1)]),_:1},8,["disabled"])):B("",!0)])}}},uR={class:"fct-shared-variant-nav__summary"},cR={class:"fct-shared-variant-nav__summary-product"},AR={class:"fct-shared-variant-nav__summary-product-name"},pR={class:"fct-shared-variant-nav__summary-meta"},fR={class:"fct-shared-variant-nav__status"},mR={class:"fct-shared-variant-nav__variant-count"},Tr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",uR,[o("div",cR,[o("h3",AR,f(e.product.post_title||A(u)("Untitled product")),1)]),o("div",pR,[o("span",fR,[n(fa,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",mR,f(e.product.variants.length)+" "+f(A(u)("variants")),1)])]))}},hR={class:"fct-shared-variant-nav__group-header"},_R=["aria-expanded","onClick"],vR={class:"fct-shared-variant-nav__group-caret"},gR={class:"fct-shared-variant-nav__group-title"},yR={class:"fct-shared-variant-nav__group-count"},bR=["aria-label","onClick"],wR={class:"fct-shared-variant-nav__group-body"},CR=["disabled","aria-current","onClick"],kR={class:"fct-shared-variant-nav__item-image-wrapper"},BR={class:"fct-shared-variant-nav__item-image"},xR=["src","alt"],SR=["src","alt"],FR={key:0,class:"fct-shared-variant-nav__item-dot"},$R={class:"fct-shared-variant-nav__item-content"},ER={class:"fct-shared-variant-nav__item-title"},UR={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},IR={class:"fct-shared-variant-nav__item-meta"},QR=["disabled","aria-label"],DR=["disabled","aria-label"],VR={class:"more-btn"},TR=["disabled","aria-current","onClick"],MR={class:"fct-shared-variant-nav__item-image-wrapper"},LR={class:"fct-shared-variant-nav__item-image"},RR=["src","alt"],OR=["src","alt"],HR={key:0,class:"fct-shared-variant-nav__item-dot"},PR={class:"fct-shared-variant-nav__item-content"},NR={class:"fct-shared-variant-nav__item-title"},KR={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},GR={class:"fct-shared-variant-nav__item-meta"},jR=["disabled","aria-label"],zR=["disabled","aria-label"],qR={class:"more-btn"},Vp={__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=()=>cs.getUrl("images/placeholder.svg"),l=e,s=k=>{const b=l.isDirty&&l.activeKey!==k.key,x=l.drawerMode==="create"&&k.key!=="draft-variation";return b||x},i=t,c=K(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=T(null),m=(k,b)=>{for(const x of k||[])if((x.items||[]).some(F=>F.key===b))return String(x.termId);return null};be(()=>l.groupedItems,k=>{if(!Array.isArray(k)||!k.length){p.value=null;return}p.value=m(k,l.activeKey)||String(k[0].termId)},{immediate:!0}),be(()=>l.activeKey,k=>{if(!c.value||k==null)return;const b=m(l.groupedItems,k);b&&(p.value=b)});const _=k=>String(k.termId)===p.value,g=k=>{const b=String(k.termId);p.value=p.value===b?null:b},y=T(null);let v=null;const w=()=>{v&&clearTimeout(v),Be(()=>{v=setTimeout(()=>{var b;v=null;const k=(b=y.value)==null?void 0:b.querySelector(".fct-shared-variant-nav__item-shell.is-active");k&&k.scrollIntoView({block:"center"})},240)})};return Ie(w),be(()=>l.activeKey,()=>w()),vl(()=>{v&&clearTimeout(v)}),(k,b)=>{const x=C("el-dropdown-item"),F=C("el-dropdown-menu"),M=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,$=>(r(),h("div",{key:"g-"+$.termId,class:re(["fct-shared-variant-nav__group",{"is-collapsed":!_($)}])},[o("div",hR,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_($)?"true":"false",onClick:S=>g($)},[o("span",vR,[n(J,{name:_($)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",gR,f($.title),1),o("span",yR,f(A(u)("%1$s variants",$.count)),1)],8,_R),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":A(u)("Edit group"),onClick:Ne(S=>i("edit-group",$),["stop"])},[n(J,{name:"Edit"})],8,bR)]),n(va,{visible:_($),accordion:"",duration:220},{default:d(()=>[o("div",wR,[(r(!0),h(H,null,ae($.items,S=>{var I,Q,D,V,U,O,R,P;return r(),h("div",{key:S.key,class:re(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===S.key,"is-draft":S.isDraft}])},[o("button",{type:"button",class:re(["fct-shared-variant-nav__item",{"is-disabled":s(S)}]),disabled:s(S),"aria-current":e.activeKey===S.key?"true":void 0,onClick:j=>!s(S)&&i("select",S)},[o("div",kR,[o("div",BR,[(D=(Q=(I=S.variant)==null?void 0:I.media)==null?void 0:Q[0])!=null&&D.url?(r(),h("img",{key:0,src:(O=(U=(V=S.variant)==null?void 0:V.media)==null?void 0:U[0])==null?void 0:O.url,alt:S.label},null,8,xR)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:S.label},null,8,SR))]),e.activeKey===S.key?(r(),h("span",FR)):B("",!0)]),o("div",$R,[o("span",ER,[L(f(S.label)+" ",1),((R=S.variant)==null?void 0:R.item_status)==="inactive"&&((P=e.product.detail)==null?void 0:P.variation_type)==="advanced_variations"?(r(),h("span",UR,f(A(u)("Inactive")),1)):B("",!0)]),o("span",IR,f(S.meta),1)])],10,CR),e.isDirty&&e.activeKey===S.key?(r(),h("button",{key:0,type:"button",class:re(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[0]||(b[0]=j=>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,QR)):B("",!0),S.isDraft?B("",!0):(r(),E(M,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s(S),onCommand:j=>!s(S)&&i("command",j,S)},{dropdown:d(()=>[n(F,null,{default:d(()=>{var j,q,z,X,ne;return[["simple","advanced_variations"].includes((j=e.product.detail)==null?void 0:j.variation_type)?B("",!0):(r(),E(x,{key:0,command:"duplicate"},{default:d(()=>[n(J,{name:"Duplicate"}),L(" "+f(A(u)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:d(()=>[n(J,{name:"Copy"}),L(" "+f(A(u)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(S)},{default:d(()=>[n(J,{name:"Copy"}),L(" "+f(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(q=S.variant)!=null&&q.id&&((z=e.product.detail)==null?void 0:z.variation_type)==="advanced_variations"?(r(),E(x,{key:1,command:"toggle_status",class:re({"item-destructive":((X=S.variant)==null?void 0:X.item_status)!=="inactive"})},{default:d(()=>{var he,N;return[n(J,{name:((he=S.variant)==null?void 0:he.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),L(" "+f(((N=S.variant)==null?void 0:N.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(x,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(A(u)("Delete")),1)]),_:1})):B("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:re(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(S)}]),disabled:s(S),onClick:b[1]||(b[1]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",VR,[n(J,{name:"More"})])],10,DR)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),h(H,{key:1},ae(e.items,$=>{var S,I,Q,D,V,U,O,R;return r(),h("div",{key:$.key,class:re(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===$.key,"is-draft":$.isDraft}])},[o("button",{type:"button",class:re(["fct-shared-variant-nav__item",{"is-disabled":s($)}]),disabled:s($),"aria-current":e.activeKey===$.key?"true":void 0,onClick:P=>!s($)&&i("select",$)},[o("div",MR,[o("div",LR,[(Q=(I=(S=$.variant)==null?void 0:S.media)==null?void 0:I[0])!=null&&Q.url?(r(),h("img",{key:0,src:(U=(V=(D=$.variant)==null?void 0:D.media)==null?void 0:V[0])==null?void 0:U.url,alt:$.label},null,8,RR)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:$.label},null,8,OR))]),e.activeKey===$.key?(r(),h("span",HR)):B("",!0)]),o("div",PR,[o("span",NR,[L(f($.label)+" ",1),((O=$.variant)==null?void 0:O.item_status)==="inactive"&&((R=e.product.detail)==null?void 0:R.variation_type)==="advanced_variations"?(r(),h("span",KR,f(A(u)("Inactive")),1)):B("",!0)]),o("span",GR,f($.meta),1)])],10,TR),e.isDirty&&e.activeKey===$.key?(r(),h("button",{key:0,type:"button",class:re(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[2]||(b[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,jR)):B("",!0),$.isDraft?B("",!0):(r(),E(M,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s($),onCommand:P=>!s($)&&i("command",P,$)},{dropdown:d(()=>[n(F,null,{default:d(()=>{var P,j,q,z,X;return[["simple","advanced_variations"].includes((P=e.product.detail)==null?void 0:P.variation_type)?B("",!0):(r(),E(x,{key:0,command:"duplicate"},{default:d(()=>[n(J,{name:"Duplicate"}),L(" "+f(A(u)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:d(()=>[n(J,{name:"Copy"}),L(" "+f(A(u)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout($)},{default:d(()=>[n(J,{name:"Copy"}),L(" "+f(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(j=$.variant)!=null&&j.id&&((q=e.product.detail)==null?void 0:q.variation_type)==="advanced_variations"?(r(),E(x,{key:1,command:"toggle_status",class:re({"item-destructive":((z=$.variant)==null?void 0:z.item_status)!=="inactive"})},{default:d(()=>{var ne,he;return[n(J,{name:((ne=$.variant)==null?void 0:ne.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),L(" "+f(((he=$.variant)==null?void 0:he.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):B("",!0),((X=e.product.detail)==null?void 0:X.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(x,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(A(u)("Delete")),1)]),_:1})):B("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:re(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s($)}]),disabled:s($),onClick:b[3]||(b[3]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",qR,[n(J,{name:"More"})])],10,zR)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},YR={class:"fct-shared-variant-nav-mobile"},WR=["disabled","onClick"],Tp={__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",YR,[(r(!0),h(H,null,ae(e.items,i=>(r(),h("button",{key:`mobile-${i.key}`,type:"button",class:re(["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)},f(i.label),11,WR))),128))]))}},XR={class:"fct-product-pricing-table-wrap"},JR={class:"fct-table-draggable hide-on-mobile"},ZR={class:"is-right"},eO={key:0,class:"fct-drag-handle drag-icon"},tO=["src","alt"],aO=["src"],lO={class:"fct-product-pricing-table-item"},sO={key:0,class:"fct-variant-badge"},nO={class:"fct-product-pricing-table-item"},oO={key:0,class:"fct-variant-badge fct-variant-badge--light"},iO={class:"fct-product-pricing-table-item"},rO={class:"is-right"},dO={class:"fct-product-pricing-table-item"},uO={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},cO={key:0,class:"fct-drag-handle drag-icon"},AO={class:"fct-product-pricing-table-mobile-item-inner"},pO={class:"fct-product-pricing-table-item"},fO={class:"media"},mO=["src","alt"],hO=["src"],_O={class:"fct-product-pricing-table-item-content"},vO={class:"title"},gO={key:0,class:"fct-variant-badge"},yO={key:0,class:"compare-price"},bO={class:"price"},wO={key:0,class:"capitalize"},CO={key:0,class:"fct-product-pricing-table-item-action"},kO={class:"fct-shared-variant-drawer__layout"},BO={key:0,class:"fct-shared-variant-nav"},xO={class:"fct-shared-variant-drawer__content"},SO={class:"fct-shared-variant-drawer__form"},FO={class:"fct-variant-dirty-dialog__header"},$O={class:"dialog-footer"},EO={class:"fct-btn-group sm"},Yu=1040,UO=1060,IO={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=T(typeof window<"u"?window.innerWidth:Yu),l=T(0),s=()=>{if(typeof window>"u")return 0;const fe=document.querySelector("#adminmenuwrap");if(!fe)return 0;const ge=window.getComputedStyle(fe);return ge.display==="none"||ge.visibility==="hidden"?0:Math.round(fe.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(ge=>{ge.addEventListener("wheel",se=>{document.activeElement===ge&&se.preventDefault()})}),t.product.variants.filter(ge=>{const se=ge.media?ge.media.meta_value||[]:[];return ge.media=se})},50)}),Bt(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const c=K(()=>({animation:600,ghostClass:"ghost"})),p=T(!1),m=T("update"),_=T(null),g=T(null),y=T(!1),v=T(!1),w=T(null),k=T(!1),b=K(()=>Math.max(a.value-l.value,360)),x=K(()=>b.value<=UO),F=K(()=>{let fe=24;a.value<=640?fe=12:a.value<=900&&(fe=16);const ge=Math.max(b.value-fe,320);return`${Math.min(Yu,ge)}px`}),M=(fe,ge)=>(fe==null?void 0:fe.variation_title)||`${u("Variation")} ${ge+1}`,$=fe=>{var se,pe;const ge=(fe==null?void 0:fe.item_price)??"";return ge===""||ge===null||ge===void 0?u("No price set"):`${((pe=(se=window.appVars)==null?void 0:se.shop)==null?void 0:pe.currency_sign)||"$"} ${ge}`},S=fe=>typeof fe=="number"&&fe>=0&&fe<t.product.variants.length?fe:t.product.variants.length?0:null,I=({modeType:fe="update",index:ge=null}={})=>{m.value=fe,_.value=fe==="create"?null:S(ge),k.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},Q=()=>{k.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},D=()=>{y.value=!1,v.value=!1,w.value=null},V=()=>{var fe,ge;return((ge=(fe=g.value)==null?void 0:fe.hasDirtyDrafts)==null?void 0:ge.call(fe))??!1},U=fe=>{fe&&(m.value=fe.modeType,_.value=fe.index,t.productEditModel.setValidationErrors({}))},O=async(fe,ge)=>{var se,pe;if(!(!ge||!fe)){if(fe==="duplicate"){I({modeType:"duplicate",index:ge.index});return}if(fe==="delete"&&((se=ge.variant)!=null&&se.id)){t.productEditModel.deletePricing(ge.variant.id,ge.index).then(async()=>{var $e,tt;await Be(),t.product.variants.length>0?(m.value="update",_.value=Math.min(ge.index,t.product.variants.length-1),k.value=!1,(tt=($e=g.value)==null?void 0:$e.loadVariantFromProps)==null||tt.call($e)):Q()}).catch(()=>{});return}if(fe==="copy_variation_id"&&((pe=ge.variant)!=null&&pe.id)){Yl.copy(String(ge.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}fe==="copy_direct_checkout"&&R(ge)&&Yl.copy(P(ge),{successMessage:u("Direct checkout link copied to clipboard")})}},R=fe=>{var ge,se;return!!((ge=fe==null?void 0:fe.variant)!=null&&ge.id)&&["publish","private"].includes((se=t.product)==null?void 0:se.post_status)},P=fe=>`${je.get("frontend_url")}=instant_checkout&item_id=${fe.variant.id}&quantity=1`,j=()=>{const fe=w.value;if(D(),!!fe&&fe.type==="close"){if(typeof fe.done=="function"){fe.done();return}Q()}},q=()=>{D()},z=async()=>{var fe,ge;await((ge=(fe=g.value)==null?void 0:fe.discardDrafts)==null?void 0:ge.call(fe)),j()},X=async()=>{var ge;if(!((ge=g.value)!=null&&ge.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){j();return}v.value=!1,q()},ne=fe=>{if(!V()){fe();return}w.value={type:"close",done:fe},y.value=!0},he=()=>{ne(()=>{Q()})},N=fe=>{k.value=fe},G=fe=>{fe&&(m.value="update",typeof fe.index=="number"&&fe.index>=0?_.value=fe.index:_.value=S(_.value),k.value=!1,t.productEditModel.setValidationErrors({}))},Z=(fe,ge)=>{const se=M(fe,ge);return`${u("Copy of")} ${se}`},W=K(()=>{var ge;const fe=(t.product.variants||[]).map((se,pe)=>({key:(se==null?void 0:se.id)??`variant-${pe}`,index:pe,variant:se,label:M(se,pe),meta:$(se),modeType:"update",isDraft:!1}));if(p.value&&m.value==="create"&&fe.push({key:"draft-variation",index:null,label:u("New variation"),meta:u("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&m.value==="duplicate"){const se=(ge=t.product.variants)==null?void 0:ge[_.value];fe.push({key:"duplicate-variation",index:_.value,variant:se,label:Z(se,_.value??0),meta:u("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return fe}),ie=K(()=>{var ge;if(m.value==="create"&&_.value===null)return"draft-variation";if(m.value==="duplicate")return"duplicate-variation";const fe=(ge=t.product.variants)==null?void 0:ge[_.value];return(fe==null?void 0:fe.id)??`variant-${_.value??0}`}),ye=fe=>{fe&&(k.value&&ie.value!==fe.key||U(fe))};return(fe,ge)=>{const se=C("el-input"),pe=C("el-drawer"),$e=C("el-button"),tt=C("el-dialog");return r(),h("div",XR,[o("div",JR,[o("table",null,[ge[5]||(ge[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,[ge[4]||(ge[4]=o("th",null,null,-1)),o("th",null,f(fe.$t("Image")),1),o("th",null,f(fe.$t("Title")),1),o("th",null,f(fe.$t("Price")),1),o("th",null,f(fe.$t("Compare at price")),1),o("th",ZR,f(fe.$t("Action")),1)])]),n(A(Zs),ya(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:ge[0]||(ge[0]=_e=>{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,(_e,Xe)=>{var ht,Ye,Se,Ee;return r(),h("tr",{key:_e.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),h("span",eO,[n(J,{name:"ReorderDotsVertical"})])):B("",!0)]),o("td",null,[e.readonly?_e.media&&_e.media[0]?(r(),h("img",{key:1,src:_e.media[0].url,alt:_e.variation_title,class:"fct-variant-thumb-readonly"},null,8,tO)):(r(),h("img",{key:2,src:fe.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,aO)):(r(),E(hl,{key:0,modelValue:_e.media,"onUpdate:modelValue":Oe=>_e.media=Oe,compact:!0,"max-thumbs":1,onChange:Oe=>e.productEditModel.onUploadPricingMedia("media",Xe,Oe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("td",null,[o("div",lO,[n(se,{class:re(e.productEditModel.hasValidationError(`variants.${Xe}.variation_title`)?"is-error":""),id:`variants.${Xe}.variation_title`,placeholder:fe.$t("e.g. Small, Medium, Large"),type:"text",modelValue:_e.variation_title,"onUpdate:modelValue":Oe=>_e.variation_title=Oe,onInput:Oe=>{e.productEditModel.onChangePricing("variation_title",Xe,Oe)},disabled:((Ye=(ht=e.product)==null?void 0:ht.detail)==null?void 0:Ye.variation_type)==="simple"||e.readonly,onFocus:Oe=>e.productEditModel.clearValidationError(`variants.${Xe}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((Se=_e.other_info)==null?void 0:Se.installment)==="yes"?(r(),h("span",sO,f(_e.other_info.times)+" "+f(A(u)("Installment")),1)):B("",!0)])]),o("td",null,[o("div",nO,[n(zs,{placeholder:fe.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Xe}.item_price`)?"is-error":"",id:`variants.${Xe}.item_price`,"model-value":_e.item_price,disabled:_e.expanded||e.readonly,"onUpdate:modelValue":Oe=>{e.readonly||(_e.item_price=Oe,e.productEditModel.onChangePricing("item_price",Xe,Oe),e.productEditModel.clearValidationError(`variants.${Xe}.item_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((Ee=_e.other_info)==null?void 0:Ee.payment_type)==="subscription"?(r(),h("span",oO,f(_e.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",iO,[n(zs,{placeholder:fe.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${Xe}.compare_price`)?"is-error":"",id:`variants.${Xe}.compare_price`,"model-value":_e.compare_price,disabled:_e.expanded||e.readonly,"onUpdate:modelValue":Oe=>{e.readonly||(_e.compare_price=Oe,e.productEditModel.onChangePricing("compare_price",Xe,Oe),e.productEditModel.clearValidationError(`variants.${Xe}.compare_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),o("td",rO,[o("div",dO,[e.readonly?B("",!0):(r(),E(Yi,{key:0,modeType:"action",index:Xe,variant:_e,product:e.product,productEditModel:e.productEditModel,onOpenEditor:I},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",uO,[n(A(Zs),ya(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:ge[1]||(ge[1]=_e=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,(_e,Xe)=>{var ht,Ye;return r(),h("div",{key:_e.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),h("span",cO,[n(J,{name:"ReorderDotsVertical"})])):B("",!0),o("div",AO,[o("div",pO,[o("div",fO,[e.readonly?_e.media&&_e.media[0]?(r(),h("img",{key:1,src:_e.media[0].url,alt:_e.variation_title,class:"fct-variant-thumb-readonly"},null,8,mO)):(r(),h("img",{key:2,src:fe.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,hO)):(r(),E(hl,{key:0,modelValue:_e.media,"onUpdate:modelValue":Se=>_e.media=Se,compact:!0,"max-thumbs":1,onChange:Se=>e.productEditModel.onUploadPricingMedia("media",Xe,Se)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",_O,[o("div",vO,[L(f(_e.variation_title)+" ",1),((ht=_e.other_info)==null?void 0:ht.installment)==="yes"?(r(),h("span",gO,f(_e.other_info.times)+" "+f(A(u)("Installment")),1)):B("",!0)]),o("ul",null,[o("li",null,[_e.compare_price?(r(),h("div",yO,[o("span",null,f(fe.appVars.shop.currency_sign),1),L(" "+f(_e.compare_price),1)])):B("",!0),o("div",bO,[o("span",null,f(fe.appVars.shop.currency_sign),1),L(" "+f(_e.item_price),1)])]),((Ye=_e.other_info)==null?void 0:Ye.payment_type)==="subscription"?(r(),h("li",wO,f(_e.other_info.repeat_interval),1)):B("",!0)])])]),e.readonly?B("",!0):(r(),h("div",CO,[n(Yi,{modeType:"action",index:Xe,variant:_e,product:e.product,productEditModel:e.productEditModel,onOpenEditor:I},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?B("",!0):(r(),E(Yi,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:I},null,8,["product","productEditModel"])),n(pe,{modelValue:p.value,"onUpdate:modelValue":ge[2]||(ge[2]=_e=>p.value=_e),title:fe.$t("Pricing"),size:F.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:Q},{default:d(()=>[o("div",kO,[x.value?B("",!0):(r(),h("aside",BO,[n(Tr,{product:e.product},null,8,["product"]),n(Vp,{items:W.value,"active-key":ie.value,"is-dirty":k.value,"drawer-mode":m.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":R,"is-saving":v.value,onSelect:ye,onCommand:O,onSave:X},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),n(dR,{product:e.product,"drawer-mode":m.value,"is-variation-dirty":k.value,onOpenEditor:I},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",xO,[x.value?(r(),E(Tp,{key:0,items:W.value,"active-key":ie.value,"is-dirty":k.value,onSelect:ye},null,8,["items","active-key","is-dirty"])):B("",!0),o("div",SO,[n(Sd,{ref_key:"pricingFormRef",ref:g,index:_.value,modeType:m.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:G,onCloseModal:he,onDirtyStateChange:N},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),n(tt,{modelValue:y.value,"onUpdate:modelValue":ge[3]||(ge[3]=_e=>y.value=_e),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:q},{header:d(()=>[o("div",FO,[o("h3",null,f(A(u)("Unsaved changes")),1)])]),default:d(()=>[o("p",null,f(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",$O,[o("div",EO,[n($e,{disabled:v.value,onClick:q,size:"small"},{default:d(()=>[L(f(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n($e,{disabled:v.value,onClick:z,size:"small"},{default:d(()=>[L(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n($e,{type:"primary",loading:v.value,onClick:X,size:"small"},{default:d(()=>[L(f(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},QO={key:0,class:"fct-adv-groupby-bar"},DO={class:"fct-adv-groupby-label"},VO={__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=K({get(){return l.modelValue},set(p){s("update:modelValue",p)}}),c=K(()=>{var m,_,g;const p=(g=(_=(m=l.product)==null?void 0:m.detail)==null?void 0:_.other_info)==null?void 0:g.attribute_config;return!p||!Array.isArray(p)?[]:p.map(y=>{const v=l.attributeGroups.find(w=>String(w.id)===String(y.group_id));return v?{id:v.id,title:v.title}:null}).filter(Boolean)});return t({configuredGroups:c}),(p,m)=>{const _=C("el-option"),g=C("el-select");return c.value.length>=2?(r(),h("div",QO,[o("span",DO,f(p.$t("Group by")),1),n(g,{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[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)}}},TO={key:0,class:"fct-adv-bulk-bar"},MO={class:"fct-adv-bulk-count"},LO=["textContent"],RO={__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=K({get(){return a.bulkAction},set(p){l("update:bulkAction",p)}}),i=K({get(){return a.bulkValue},set(p){l("update:bulkValue",p)}}),c=K(()=>a.bulkAction==="set_price");return(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-input"),v=C("el-button");return e.selectedCount>0?(r(),h("div",TO,[o("span",MO,f(p.$t("%1$s selected",e.selectedCount)),1),o("button",{type:"button",class:"fct-adv-bulk-clear",onClick:m[0]||(m[0]=w=>p.$emit("clear"))},f(p.$t("Clear")),1),n(g,{modelValue:s.value,"onUpdate:modelValue":m[1]||(m[1]=w=>s.value=w),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":m[2]||(m[2]=w=>i.value=w),placeholder:p.$t("Value"),size:"small",type:"number"},{prefix:d(()=>[o("span",{textContent:f(p.appVars.shop.currency_sign)},null,8,LO)]),_:1},8,["modelValue","placeholder"])):B("",!0),n(v,{type:"primary",size:"small",loading:e.saving,disabled:!e.bulkAction||e.selectedCount===0,onClick:m[3]||(m[3]=w=>p.$emit("apply"))},{default:d(()=>[L(f(p.$t("Apply")),1)]),_:1},8,["loading","disabled"])])):B("",!0)}}},OO={class:"fct-grouped-variant-table fct-adv-table-desktop"},HO={class:"is-right"},PO=["aria-expanded","aria-label"],NO=["onClick"],KO={class:"fct-adv-group-header"},GO={class:"fct-adv-group-count"},jO={class:"fct-product-pricing-table-item"},zO=["textContent"],qO={class:"is-right"},YO={class:"fct-adv-group-actions"},WO=["aria-expanded","aria-label","onClick"],XO={class:"fct-adv-slot-row"},JO={colspan:"6"},ZO={class:"fct-product-pricing-table-item"},eH={class:"fct-product-pricing-table-item fct-adv-child-title"},tH={class:"fct-adv-title-cell"},aH={class:"fct-adv-title-main"},lH={class:"fct-adv-variant-title"},sH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},nH={class:"fct-product-pricing-table-item"},oH=["textContent"],iH={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},rH={class:"fct-product-pricing-table-item"},dH=["textContent"],uH={class:"is-right"},cH={class:"fct-product-pricing-table-item"},AH={class:"fct-btn-group sm justify-end"},pH=["aria-label"],fH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},mH={colspan:"6"},hH={class:"fct-grouped-variant-table fct-adv-table-mobile"},_H={class:"is-right"},vH=["aria-expanded","aria-label"],gH=["onClick"],yH={class:"fct-adv-group-header"},bH={class:"fct-adv-group-count"},wH={class:"is-right"},CH={class:"fct-adv-group-actions"},kH=["aria-expanded","aria-label","onClick"],BH={class:"fct-adv-slot-row"},xH={colspan:"4"},SH={class:"fct-product-pricing-table-item"},FH={class:"fct-product-pricing-table-item fct-adv-child-title"},$H={class:"fct-adv-title-cell"},EH={class:"fct-adv-title-main"},UH={class:"fct-adv-variant-title"},IH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},QH={class:"fct-adv-variant-price"},DH={key:0,class:"fct-adv-variant-compare"},VH={class:"is-right"},TH={class:"fct-product-pricing-table-item"},MH={class:"fct-btn-group sm justify-end"},LH=["aria-label"],RH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},OH={colspan:"6"},Wu=30,HH=30,PH={__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=K(()=>{var fe,ge,se;const G=a.groupById?parseInt(a.groupById):null,Z=(((se=(ge=(fe=a.product)==null?void 0:fe.detail)==null?void 0:ge.other_info)==null?void 0:se.attribute_config)||[]).map(pe=>parseInt(pe.group_id)).filter(Boolean),W=pe=>{const $e=Z.indexOf(pe);return $e===-1?Number.MAX_SAFE_INTEGER:$e},ie={};(a.attributeGroups||[]).forEach(pe=>{const $e={};(pe.terms||[]).forEach(tt=>{$e[parseInt(tt.id)]=tt.title}),ie[parseInt(pe.id)]=$e});const ye={};return(a.groupedVariants||[]).forEach(pe=>{(pe.variants||[]).forEach($e=>{const tt=$e.attr_map||[];if(!tt.length){ye[$e.id]="";return}const _e=[...tt].sort((Xe,ht)=>W(parseInt(Xe.group_id))-W(parseInt(ht.group_id))).map(Xe=>{const ht=parseInt(Xe.group_id);if(G&&ht===G)return null;const Ye=ie[ht];return Ye&&Ye[parseInt(Xe.term_id)]||null}).filter(Boolean);ye[$e.id]=_e.join(" / ")})}),ye}),s=T(new Set),i=G=>{s.value.has(G)||(s.value=new Set(s.value).add(G))},c=T({}),p=G=>c.value[G]||Wu,m=G=>{const Z=G.variants||[],W=p(G.termId);return W>=Z.length?Z:Z.slice(0,W)},_=G=>(G.variants||[]).length>p(G.termId),g=(G,Z)=>{const W=c.value[G]||Wu;W>=Z||(c.value={...c.value,[G]:Math.min(W+HH,Z)})};be(()=>a.expandedGroups,G=>{const Z=Object.keys(c.value);if(!Z.length)return;const W={};Z.forEach(ie=>{G&&(G.has(ie)||G.has(Number(ie)))&&(W[ie]=c.value[ie])}),Object.keys(W).length!==Z.length&&(c.value=W)});let y=null;const v={},w=G=>{let Z=G&&G.parentElement;for(;Z;){const W=getComputedStyle(Z).overflowY;if(W==="auto"||W==="scroll"||W==="overlay")return Z;Z=Z.parentElement}return null},k=G=>{y||(y=new IntersectionObserver(Z=>{Z.forEach(W=>{W.isIntersecting&&g(W.target.dataset.termId,parseInt(W.target.dataset.total,10)||0)})},{root:w(G),rootMargin:"300px 0px"}))},b=(G,Z)=>W=>{W?(W.dataset.termId=G,W.dataset.total=Z,k(W),v[G]=W,y.observe(W)):v[G]&&(y&&y.unobserve(v[G]),delete v[G])};Bt(()=>{y&&(y.disconnect(),y=null)});const x=G=>{if(!a.productEditModel)return!1;const Z=a.product.variants.findIndex(W=>W.id===G.id);return Z===-1?!1:a.productEditModel.hasValidationError(`variants.${Z}.compare_price`)},F=t,M=T({});be(()=>{var G,Z;return(Z=(G=a.productEditModel)==null?void 0:G.data)==null?void 0:Z.discardKey},()=>{M.value={}});const $=K(()=>a.groupedVariants.every(G=>a.expandedGroups.has(G.termId))),S=()=>{const G=$.value?new Set:new Set(a.groupedVariants.map(Z=>Z.termId));F("update:expandedGroups",G)},I=G=>{const Z=new Set(a.expandedGroups);Z.has(G)?Z.delete(G):Z.add(G),F("update:expandedGroups",Z)},Q=G=>a.expandedGroups.has(G),D=G=>G.variants.length>0&&G.variants.every(Z=>a.selectedVariants.includes(Z.id)),V=G=>{if(G.variants.length===0)return!1;const Z=G.variants.filter(W=>a.selectedVariants.includes(W.id)).length;return Z>0&&Z<G.variants.length},U=(G,Z)=>{let W;if(Z){const ie=new Set(a.selectedVariants);G.variants.forEach(ye=>ie.add(ye.id)),W=Array.from(ie)}else{const ie=new Set(G.variants.map(ye=>ye.id));W=a.selectedVariants.filter(ye=>!ie.has(ye))}F("update:selectedVariants",W)},O=(G,Z)=>{let W;Z?W=[...a.selectedVariants,G]:W=a.selectedVariants.filter(ie=>ie!==G),F("update:selectedVariants",W)},R=(G,Z)=>{F("groupPriceApply",G,Z)},P=G=>{const Z=G.variants.map(ye=>parseFloat(ye.item_price)).filter(ye=>!isNaN(ye));if(!Z.length)return"";const W=Math.min(...Z),ie=Math.max(...Z);return W===ie?String(W):`${W} – ${ie}`},j=T(null),q=G=>j.value===G.termId?"":P(G)||"",z=G=>{j.value=G.termId},X=()=>{j.value=null},ne=G=>{const Z=new Set,W=[];return(G.variants||[]).forEach(ie=>{Array.isArray(ie==null?void 0:ie.media)&&ie.media.forEach(ye=>{const fe=(ye==null?void 0:ye.id)||(ye==null?void 0:ye.url);fe&&!Z.has(fe)&&(Z.add(fe),W.push(ye))})}),W},he=(G,Z,W)=>{!W||!W.applyToAll||F("groupMediaUploaded",G,Z)},N=(G,Z,W,ie)=>{ie&&ie.applyToAll?F("groupMediaUploaded",G,W):F("mediaUploaded",Z,W)};return(G,Z)=>{const W=C("el-checkbox"),ie=C("el-input"),ye=C("el-dropdown-item"),fe=C("el-dropdown-menu"),ge=C("el-dropdown");return r(),h(H,null,[o("div",OO,[o("table",null,[Z[11]||(Z[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(W,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":G.$t("Select all variants"),"onUpdate:modelValue":Z[0]||(Z[0]=se=>G.$emit("update:isAllSelected",se))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(G.$t("Image")),1),o("th",null,f(G.$t("Variant")),1),o("th",null,f(G.$t("Price")),1),o("th",null,f(G.$t("Compare at price")),1),o("th",HO,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":$.value,"aria-label":$.value?G.$t("Collapse all groups"):G.$t("Expand all groups"),onClick:S},[o("span",{class:re(["fct-adv-group-chevron",{"is-expanded":$.value}])},[n(J,{name:"ChevronDown"})],2)],8,PO)])])]),o("tbody",null,[(r(!0),h(H,null,ae(e.groupedVariants,se=>(r(),h(H,{key:se.termId},[o("tr",{class:re(["fct-adv-group-row",{"is-expanded":Q(se.termId)}]),onClick:pe=>I(se.termId)},[o("td",null,[n(W,{onClick:Z[1]||(Z[1]=Ne(()=>{},["stop"])),"model-value":D(se),indeterminate:V(se),"aria-label":A(u)("Select all variants in %1$s",se.title),onChange:pe=>U(se,pe)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:Z[2]||(Z[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:(pe,$e)=>he(se,pe,$e)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",KO,[o("strong",null,f(se.title),1),o("span",GO,f(se.variants.length)+" "+f(se.variants.length===1?G.$t("variant"):G.$t("variants")),1)])]),o("td",null,[o("div",jO,[n(ie,{onClick:Z[3]||(Z[3]=Ne(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:q(se),type:"number",min:0,size:"small",modelValue:M.value[se.termId],"onUpdate:modelValue":pe=>M.value[se.termId]=pe,onFocus:pe=>z(se),onBlur:X,onKeyup:xa(pe=>R(se.termId,M.value[se.termId]),["enter"]),onChange:pe=>R(se.termId,pe)},{prefix:d(()=>[o("span",{textContent:f(G.appVars.shop.currency_sign)},null,8,zO)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","onFocus","onKeyup","onChange"])])]),Z[9]||(Z[9]=o("td",null,null,-1)),o("td",qO,[o("div",YO,[Q(se.termId)?(r(),E(Ze,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":G.$t("Edit group %1$s",se.title),onClick:Ne(pe=>G.$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":Q(se.termId),"aria-label":G.$t("Toggle %1$s variants",se.title),onClick:Ne(pe=>I(se.termId),["stop"])},[o("span",{class:re(["fct-adv-group-chevron",{"is-expanded":Q(se.termId)}])},[n(J,{name:"ChevronDown"})],2)],8,WO)])])],10,NO),o("tr",XO,[o("td",JO,[n(Dd,{visible:Q(se.termId),duration:220},{default:d(()=>[o("table",null,[Z[10]||(Z[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(m(se),pe=>{var $e,tt;return r(),h("tr",{key:pe.id,class:"fct-adv-group-child-row"},[o("td",{onClick:Z[4]||(Z[4]=Ne(()=>{},["stop"]))},[n(W,{"model-value":e.selectedVariants.includes(pe.id),"aria-label":A(u)("Select variant %1$s",pe.variation_title),onChange:_e=>O(pe.id,_e)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",ZO,[n(hl,{modelValue:pe.media,"onUpdate:modelValue":_e=>pe.media=_e,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(_e,Xe)=>N(se,pe,_e,Xe)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",eH,[o("div",tH,[o("div",aH,[o("span",lH,f(l.value[pe.id]||pe.variation_title),1),pe.item_status==="inactive"?(r(),h("span",sH,f(A(u)("Inactive")),1)):B("",!0)])])])]),o("td",null,[o("div",nH,[n(ie,{placeholder:G.$t("Price"),type:"number",min:0,"model-value":pe.item_price,onInput:_e=>G.$emit("inlinePriceChange",pe,"item_price",_e),onChange:_e=>G.$emit("inlinePriceCommit",pe)},{prefix:d(()=>[o("span",{textContent:f(G.appVars.shop.currency_sign)},null,8,oH)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),(($e=pe.other_info)==null?void 0:$e.payment_type)==="subscription"&&((tt=pe.other_info)!=null&&tt.repeat_interval)?(r(),h("span",iH,f(pe.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",rH,[n(ie,{placeholder:G.$t("Compare price"),type:"number",min:0,class:re({"is-error":x(pe)}),title:x(pe)?G.$t("Compare price must be greater than or equal to item price."):null,"model-value":pe.compare_price,onInput:_e=>G.$emit("inlinePriceChange",pe,"compare_price",_e),onChange:_e=>G.$emit("inlinePriceCommit",pe)},{prefix:d(()=>[o("span",{textContent:f(G.appVars.shop.currency_sign)},null,8,dH)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",uH,[o("div",cH,[o("div",AH,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:_e=>G.$emit("editVariant",pe)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(ge,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:_e=>_e&&i(pe.id),onCommand:_e=>{_e==="toggle_status"&&G.$emit("toggleStatus",pe)}},{dropdown:d(()=>[n(fe,null,{default:d(()=>[s.value.has(pe.id)?(r(),h(H,{key:0},[n(ye,{class:"show-on-mobile",onClick:_e=>G.$emit("editVariant",pe)},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(G.$t("Edit")),1)]),_:2},1032,["onClick"]),n(ye,null,{default:d(()=>[pe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(pe.id),showMode:"icon_with_text",buttonText:G.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(ye,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!pe.id},{default:d(()=>{var _e;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&pe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:((_e=G.appVars)==null?void 0:_e.frontend_url)+"=instant_checkout&item_id="+pe.id+"&quantity=1",showMode:"icon_with_text",buttonText:G.$t("Direct Checkout"),tooltipContent:G.$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"}),L(" "+f(G.$t("Direct Checkout"))+" ",1),n(pa,{content:G.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),pe.id?(r(),E(ye,{key:0,command:"toggle_status",class:re({"item-destructive":pe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:pe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),L(" "+f(pe.item_status==="inactive"?G.$t("Set Active"):G.$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",fH,[o("td",mH,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(se.termId,se.variants.length)},null,512)])])):B("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])]),o("div",hH,[o("table",null,[Z[13]||(Z[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(W,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":G.$t("Select all variants"),"onUpdate:modelValue":Z[5]||(Z[5]=se=>G.$emit("update:isAllSelected",se))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(G.$t("Image")),1),o("th",null,f(G.$t("Variant")),1),o("th",_H,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":$.value,"aria-label":$.value?G.$t("Collapse all groups"):G.$t("Expand all groups"),onClick:S},[o("span",{class:re(["fct-adv-group-chevron",{"is-expanded":$.value}])},[n(J,{name:"ChevronDown"})],2)],8,vH)])])]),o("tbody",null,[(r(!0),h(H,null,ae(e.groupedVariants,se=>(r(),h(H,{key:se.termId},[o("tr",{class:re(["fct-adv-group-row",{"is-expanded":Q(se.termId)}]),onClick:pe=>I(se.termId)},[o("td",null,[n(W,{onClick:Z[6]||(Z[6]=Ne(()=>{},["stop"])),"model-value":D(se),indeterminate:V(se),"aria-label":A(u)("Select all variants in %1$s",se.title),onChange:pe=>U(se,pe)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:Z[7]||(Z[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:(pe,$e)=>he(se,pe,$e)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",yH,[o("strong",null,f(se.title),1),o("span",bH,f(se.variants.length)+" "+f(se.variants.length===1?G.$t("variant"):G.$t("variants")),1)])]),o("td",wH,[o("div",CH,[Q(se.termId)?(r(),E(Ze,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":G.$t("Edit group %1$s",se.title),onClick:Ne(pe=>G.$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":Q(se.termId),"aria-label":G.$t("Toggle %1$s variants",se.title),onClick:Ne(pe=>I(se.termId),["stop"])},[o("span",{class:re(["fct-adv-group-chevron",{"is-expanded":Q(se.termId)}])},[n(J,{name:"ChevronDown"})],2)],8,kH)])])],10,gH),o("tr",BH,[o("td",xH,[n(Dd,{visible:Q(se.termId),duration:220},{default:d(()=>[o("table",null,[Z[12]||(Z[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(m(se),pe=>(r(),h("tr",{key:pe.id,class:"fct-adv-group-child-row"},[o("td",{onClick:Z[8]||(Z[8]=Ne(()=>{},["stop"]))},[n(W,{"model-value":e.selectedVariants.includes(pe.id),"aria-label":A(u)("Select variant %1$s",pe.variation_title),onChange:$e=>O(pe.id,$e)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",SH,[n(hl,{modelValue:pe.media,"onUpdate:modelValue":$e=>pe.media=$e,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:($e,tt)=>N(se,pe,$e,tt)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",FH,[o("div",$H,[o("div",EH,[o("span",UH,f(l.value[pe.id]||pe.variation_title),1),pe.item_status==="inactive"?(r(),h("span",IH,f(A(u)("Inactive")),1)):B("",!0)]),o("span",QH,[pe.compare_price?(r(),h("span",DH,f(G.appVars.shop.currency_sign)+f(pe.compare_price),1)):B("",!0),o("span",null,f(G.appVars.shop.currency_sign)+f(pe.item_price||"0"),1)])])])]),o("td",VH,[o("div",TH,[o("div",MH,[n(ge,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:$e=>$e&&i(pe.id),onCommand:$e=>{$e==="toggle_status"&&G.$emit("toggleStatus",pe)}},{dropdown:d(()=>[n(fe,null,{default:d(()=>[s.value.has(pe.id)?(r(),h(H,{key:0},[n(ye,{onClick:$e=>G.$emit("editVariant",pe)},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(G.$t("Edit")),1)]),_:2},1032,["onClick"]),n(ye,null,{default:d(()=>[pe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(pe.id),showMode:"icon_with_text",buttonText:G.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(ye,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!pe.id},{default:d(()=>{var $e;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&pe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:(($e=G.appVars)==null?void 0:$e.frontend_url)+"=instant_checkout&item_id="+pe.id+"&quantity=1",showMode:"icon_with_text",buttonText:G.$t("Direct Checkout"),tooltipContent:G.$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"}),L(" "+f(G.$t("Direct Checkout"))+" ",1),n(pa,{content:G.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),pe.id?(r(),E(ye,{key:0,command:"toggle_status",class:re({"item-destructive":pe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:pe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),L(" "+f(pe.item_status==="inactive"?G.$t("Set Active"):G.$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,LH)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(se)?(r(),h("tr",RH,[o("td",OH,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(se.termId,se.variants.length)},null,512)])])):B("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])])],64)}}},NH={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},KH={class:"is-right"},GH={class:"fct-product-pricing-table-item"},jH={class:"fct-product-pricing-table-item"},zH={class:"fct-adv-title-cell"},qH={class:"fct-adv-title-main"},YH={class:"fct-adv-variant-title"},WH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},XH={key:0,class:"fct-adv-attr-breadcrumb"},JH={class:"fct-product-pricing-table-item"},ZH=["textContent"],eP={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},tP={class:"fct-product-pricing-table-item"},aP=["textContent"],lP={class:"is-right"},sP={class:"fct-product-pricing-table-item"},nP={class:"fct-btn-group sm"},oP=["aria-label"],iP={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},Xu=30,rP=30,dP={__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=K(()=>a.variants??a.product.variants),s=T(Xu),i=K(()=>{const b=l.value;return b.length<=s.value?b:b.slice(0,s.value)}),c=K(()=>l.value.length>s.value);be(l,()=>{s.value=Xu});let p=null,m=null;const _=b=>{let x=b&&b.parentElement;for(;x;){const F=getComputedStyle(x).overflowY;if(F==="auto"||F==="scroll"||F==="overlay")return x;x=x.parentElement}return null},g=b=>{b?(p||(p=new IntersectionObserver(x=>{x.some(F=>F.isIntersecting)&&(s.value=Math.min(s.value+rP,l.value.length))},{root:_(b),rootMargin:"300px 0px"})),m=b,p.observe(b)):m&&(p&&p.unobserve(m),m=null)};Bt(()=>{p&&(p.disconnect(),p=null)});const y=b=>{if(!a.productEditModel)return!1;const x=a.product.variants.findIndex(F=>F.id===b.id);return x===-1?!1:a.productEditModel.hasValidationError(`variants.${x}.compare_price`)},v=b=>{var S,I,Q;const x=b.attr_map||[];if(!x.length)return"";const F=(((Q=(I=(S=a.product)==null?void 0:S.detail)==null?void 0:I.other_info)==null?void 0:Q.attribute_config)||[]).map(D=>parseInt(D.group_id)).filter(Boolean),M=D=>{const V=F.indexOf(D);return V===-1?Number.MAX_SAFE_INTEGER:V};return[...x].sort((D,V)=>M(parseInt(D.group_id))-M(parseInt(V.group_id))).map(D=>{const V=a.attributeGroups.find(O=>O.id===parseInt(D.group_id));if(!V)return null;const U=(V.terms||[]).find(O=>O.id===parseInt(D.term_id));return U?U.title:null}).filter(Boolean).join(" / ")},w=t,k=(b,x)=>{let F;x?F=[...a.selectedVariants,b]:F=a.selectedVariants.filter(M=>M!==b),w("update:selectedVariants",F)};return(b,x)=>{const F=C("el-checkbox"),M=C("el-input"),$=C("el-dropdown-item"),S=C("el-dropdown-menu"),I=C("el-dropdown");return r(),h("div",NH,[o("table",null,[x[1]||(x[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(F,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":b.$t("Select all variants"),"onUpdate:modelValue":x[0]||(x[0]=Q=>b.$emit("update:isAllSelected",Q))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(b.$t("Image")),1),o("th",null,f(b.$t("Title")),1),o("th",null,f(b.$t("Price")),1),o("th",null,f(b.$t("Compare at price")),1),o("th",KH,f(b.$t("Action")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(i.value,Q=>{var D,V;return r(),h("tr",{key:Q.id},[o("td",null,[n(F,{"model-value":e.selectedVariants.includes(Q.id),"aria-label":A(u)("Select variant %1$s",Q.variation_title),onChange:U=>k(Q.id,U)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",GH,[n(hl,{modelValue:Q.media,"onUpdate:modelValue":U=>Q.media=U,compact:!0,"max-thumbs":1,square:!0,onChange:U=>b.$emit("mediaUploaded",Q,U)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",jH,[o("div",zH,[o("div",qH,[o("span",YH,f(Q.variation_title),1),Q.item_status==="inactive"?(r(),h("span",WH,f(A(u)("Inactive")),1)):B("",!0)]),v(Q)&&v(Q)!==Q.variation_title?(r(),h("span",XH,f(v(Q)),1)):B("",!0)])])]),o("td",null,[o("div",JH,[n(M,{placeholder:b.$t("Price"),type:"number",min:0,"model-value":Q.item_price,onInput:U=>b.$emit("inlinePriceChange",Q,"item_price",U),onChange:U=>b.$emit("inlinePriceCommit",Q)},{prefix:d(()=>[o("span",{textContent:f(b.appVars.shop.currency_sign)},null,8,ZH)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),((D=Q.other_info)==null?void 0:D.payment_type)==="subscription"&&((V=Q.other_info)!=null&&V.repeat_interval)?(r(),h("span",eP,f(Q.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",tP,[n(M,{placeholder:b.$t("Compare price"),type:"number",min:0,class:re({"is-error":y(Q)}),title:y(Q)?b.$t("Compare price must be greater than or equal to item price."):null,"model-value":Q.compare_price,onInput:U=>b.$emit("inlinePriceChange",Q,"compare_price",U),onChange:U=>b.$emit("inlinePriceCommit",Q)},{prefix:d(()=>[o("span",{textContent:f(b.appVars.shop.currency_sign)},null,8,aP)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",lP,[o("div",sP,[o("div",nP,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:U=>b.$emit("editVariant",Q)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(I,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:U=>{U==="toggle_status"&&b.$emit("toggleStatus",Q)}},{dropdown:d(()=>[n(S,null,{default:d(()=>[n($,{class:"show-on-mobile",onClick:U=>b.$emit("editVariant",Q)},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(b.$t("Edit")),1)]),_:2},1032,["onClick"]),n($,null,{default:d(()=>[Q.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(Q.id),showMode:"icon_with_text",buttonText:b.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n($,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Q.id},{default:d(()=>{var U;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Q.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:((U=b.appVars)==null?void 0:U.frontend_url)+"=instant_checkout&item_id="+Q.id+"&quantity=1",showMode:"icon_with_text",buttonText:b.$t("Direct Checkout"),tooltipContent:b.$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"}),L(" "+f(b.$t("Direct Checkout"))+" ",1),n(pa,{content:b.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),Q.id?(r(),E($,{key:0,command:"toggle_status",class:re({"item-destructive":Q.item_status!=="inactive"})},{default:d(()=>[n(J,{name:Q.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),L(" "+f(Q.item_status==="inactive"?b.$t("Set Active"):b.$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,oP)]),_:2},1032,["onCommand"])])])])])}),128)),c.value?(r(),h("tr",iP,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:g})])])):B("",!0)])])])}}},uP={class:"fct-product-pricing-form-wrap"},cP={class:"fct-product-pricing-form-inner"},AP={class:"dialog-footer"},pP={class:"fct-btn-group sm"},fP={__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=T(i()),p=T(0),m=T(!1),_=T(!1);Ie(async()=>{await Be(),_.value=!0});const g=()=>{const v=c.value||{},w={};["item_price","compare_price","item_cost","manage_cost","sku","manage_stock","total_stock","fulfillment_type"].forEach(M=>{const $=v[M];$!=null&&$!==""&&$!=="__unchanged__"&&(w[M]=$)});const b=v.other_info||{},x={};Object.keys(b).forEach(M=>{if(M==="billing_summary")return;const $=b[M];$!=null&&$!==""&&$!=="__unchanged__"&&(x[M]=$)});const F={...w};return Object.keys(x).length>0&&(F.other_info=x),F},y=async()=>{if(!l.groupVariantIds.length)return Y.error(u("Please select at least one variant to update.")),null;const v=g();if(!Object.keys(v).length)return Y.error(u("Please fill in at least one field to update.")),null;l.productEditModel.setSaving(!0);try{const w=await ue.post("products/variants/group-bulk-update",{variant_ids:l.groupVariantIds,...v});return Y.success(w.message||u("Variants updated successfully")),p.value=0,s("createOrUpdateVariant",{group:!0,count:l.groupVariantIds.length}),w}catch(w){return w&&(w.status_code===422||w.status===422)?Y.validationErrors(w):Y.error(w&&w.data&&w.data.message||u("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return be(c,()=>{m.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()=>{m.value=!0,c.value=i(),await Be(),p.value=0,m.value=!1},saveCurrentDraft:y}),(v,w)=>{const k=C("el-form"),b=C("el-button");return r(),h("div",uP,[o("div",cP,[n(k,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(Up,{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(Ip,{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-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),E(Dp,{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",AP,[o("div",pP,[n(b,{onClick:w[0]||(w[0]=x=>s("closeModal"))},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(b,{type:"primary",loading:e.productEditModel.saving,disabled:e.productEditModel.saving,onClick:y},{default:d(()=>[L(f(A(u)("Update %1$s variants",e.groupVariantIds.length)),1)]),_:1},8,["loading","disabled"])])])])}}},mP={class:"fct-adv-variant-table-wrap"},hP={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},_P={class:"flex items-center flex-wrap gap-2 ml-auto"},vP=["aria-label"],gP={key:0,class:"fct-adv-filters-panel-wrap"},yP={class:"fct-adv-variant-search-row"},bP={key:0,class:"fct-adv-variant-filters"},wP=["aria-pressed"],CP={key:0,class:"fct-adv-filter-chip__count"},kP={class:"fct-adv-filter-options"},BP={class:"fct-adv-filter-options__header"},xP=["onClick"],SP={class:"fct-adv-filter-options__list"},FP={key:0,class:"fct-adv-filter-count"},$P={key:0,class:"fct-adv-variant-empty"},EP={class:"fct-adv-variant-empty__title"},UP={class:"fct-adv-variant-empty__hint"},IP=["aria-label"],QP={class:"fct-grouped-variant-skeleton"},DP={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},VP={class:"fct-product-pricing-table-mobile-item-inner"},TP={class:"fct-product-pricing-table-item"},MP={class:"media relative"},LP={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},RP={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},OP=["src","alt"],HP=["src","alt"],PP={class:"fct-product-pricing-table-item-content"},NP={class:"title"},KP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},GP={class:"fct-adv-attr-breadcrumb"},jP={key:0,class:"compare-price"},zP=["textContent"],qP={class:"price"},YP=["textContent"],WP={class:"fct-product-pricing-table-item-action"},XP={class:"fct-btn-group sm"},JP=["aria-label"],ZP={class:"fct-shared-variant-drawer__layout"},eN={key:0,class:"fct-shared-variant-nav"},tN={class:"fct-group-edit-aside"},aN={class:"fct-group-edit-aside__label flex items-center gap-2"},lN={class:"fct-group-edit-aside__title"},sN={class:"fct-group-edit-aside__hint"},nN={class:"fct-group-edit-aside__list"},oN={key:1,class:"fct-shared-variant-nav"},iN={class:"fct-shared-variant-nav__filters"},rN={key:0,class:"fct-shared-variant-nav__chips"},dN=["aria-pressed"],uN={key:0,class:"fct-adv-filter-chip__count"},cN={class:"fct-adv-filter-options"},AN={class:"fct-adv-filter-options__header"},pN=["onClick"],fN={class:"fct-adv-filter-options__list"},mN={class:"fct-shared-variant-drawer__content"},hN={key:0,class:"fct-compact-group-edit-summary"},_N={class:"fct-compact-group-edit-summary__title"},vN={class:"fct-compact-group-edit-summary__count"},gN={class:"fct-compact-group-edit-summary__list"},yN={key:0,class:"fct-compact-group-edit-bar"},bN=["disabled","aria-label","onClick"],wN={class:"fct-shared-variant-drawer__form"},CN={class:"fct-variant-dirty-dialog__header"},kN=["id"],BN={class:"dialog-footer"},xN={class:"fct-btn-group sm"},Ju=200,SN={__name:"AdvancedVariationTable",props:{product:Object,productEditModel:Object,attributeGroups:{type:Array,default:()=>[]},externalBusy:{type:Boolean,default:!1}},setup(e){var Ke,qe,mt,Je,$t,Yt;const t=e,a=T([]),l=T(!1),s=T(!1),i=T(null),c=T(!1),p=T(new Set),m=T(new Set),_=T(0),g=()=>{_.value++},y=()=>{_.value=Math.max(0,_.value-1)},v=K(()=>_.value>0||l.value||t.externalBusy),w=T(((Yt=($t=(Je=(mt=(qe=(Ke=t.product)==null?void 0:Ke.detail)==null?void 0:qe.other_info)==null?void 0:mt.attribute_config)==null?void 0:Je[0])==null?void 0:$t.variants)==null?void 0:Yt.length)||6),k=T(!1),b=T(null),x=T(null),F=T(!1),M=T(!1),$=T(!1),S=T(null),I=T(""),Q=T(""),D=T(null),V=T(""),U=T(!1),O=T({}),R=()=>{U.value=!U.value},P=()=>{O.value={},V.value="",U.value=!1},j=ce=>{ce.style.opacity="0",ce.style.overflow="hidden"},q=ce=>{const me=ce.scrollHeight+"px";ce.style.height="0",ce.offsetHeight,ce.style.transition="height 0.25s ease, opacity 0.2s ease",ce.style.height=me,ce.style.opacity="1"},z=ce=>{ce.style.height="",ce.style.overflow="",ce.style.transition="",ce.style.opacity=""},X=ce=>{ce.style.height=ce.scrollHeight+"px",ce.style.overflow="hidden",ce.offsetHeight,ce.style.transition="height 0.25s ease, opacity 0.2s ease",ce.style.height="0",ce.style.opacity="0"},ne=ce=>{ce.style.height="",ce.style.overflow="",ce.style.transition="",ce.style.opacity=""},he=K(()=>{var me,Le,De;const ce=(De=(Le=(me=t.product)==null?void 0:me.detail)==null?void 0:Le.other_info)==null?void 0:De.attribute_config;return!ce||!Array.isArray(ce)?[]:ce.map(te=>{const He=parseInt(te.group_id,10),ut=t.attributeGroups.find(ke=>parseInt(ke.id,10)===He);return ut?{id:parseInt(ut.id,10),title:ut.title}:null}).filter(Boolean)}),N=K(()=>he.value.map(ce=>{const me=t.attributeGroups.find(Le=>Le.id===ce.id);return me?{id:me.id,title:me.title,terms:me.terms||[]}:null}).filter(Boolean)),G=(ce,me)=>{const Le=O.value[ce];return Le?Le.has(me):!1},Z=(ce,me)=>{const Le={...O.value},De=Le[ce]?new Set(Le[ce]):new Set;De.has(me)?De.delete(me):De.add(me),De.size===0?delete Le[ce]:Le[ce]=De,O.value=Le},W=ce=>{var me;return((me=O.value[ce])==null?void 0:me.size)||0},ie=ce=>{if(!O.value[ce])return;const me={...O.value};delete me[ce],O.value=me},ye=()=>{O.value={},V.value=""},fe=K(()=>Object.keys(O.value).length>0||V.value.trim()!==""),ge=K(()=>fe.value&&t.product.variants.length>0&&se.value.length===0),se=K(()=>{let ce=t.product.variants;const me=Object.keys(O.value);me.length>0&&(ce=ce.filter(De=>me.every(te=>{const He=O.value[te];if(!He||He.size===0)return!0;const ut=(De.attr_map||[]).find(ke=>parseInt(ke.group_id)===parseInt(te));return ut&&He.has(parseInt(ut.term_id))})));const Le=V.value.trim().toLowerCase();return Le&&(ce=ce.filter(De=>(De.variation_title||"").toLowerCase().includes(Le)?!0:(De.attr_map||[]).map(ut=>{const ke=t.attributeGroups.find(ba=>ba.id===parseInt(ut.group_id));if(!ke)return"";const wt=(ke.terms||[]).find(ba=>ba.id===parseInt(ut.term_id));return wt?wt.title.toLowerCase():""}).join(" ").includes(Le))),ce}),pe=K(()=>{if(!D.value)return null;const ce=parseInt(D.value,10),me=t.attributeGroups.find(te=>parseInt(te.id,10)===ce);if(!me)return null;const Le=[],De={};for(const te of se.value){const He=(te.attr_map||[]).find(ke=>parseInt(ke.group_id,10)===ce);if(!He)continue;const ut=parseInt(He.term_id,10);if(!De[ut]){const ke=(me.terms||[]).find(wt=>parseInt(wt.id,10)===ut);De[ut]={termId:ut,title:ke?ke.title:"Unknown",variants:[]},Le.push(De[ut])}De[ut].variants.push(te)}return Le}),$e=K(()=>!!D.value&&pe.value&&pe.value.length>0);be(pe,ce=>{Array.isArray(ce)&&ce.length>0&&(w.value=ce.length)},{immediate:!0});const tt=ce=>t.productEditModel.validateComparePrice(ce),_e=(ce,me)=>{const Le=pe.value?pe.value.find(ut=>ut.termId===ce):null;if(!Le||me===""||me===null||me===void 0)return;const De=parseFloat(me);if(isNaN(De)||De<0){Y.error(u("Please enter a valid price."));return}const te=Le.variants.filter(ut=>a.value.includes(ut.id));(te.length?te:Le.variants).forEach(ut=>{const ke=t.product.variants.findIndex(wt=>wt.id===ut.id);ke!==-1&&(t.productEditModel.onChangePricing("item_price",ke,De),tt(ke))})},Xe=ce=>{const me=t.product.variants.findIndex(De=>De.id===ce.id);if(me===-1)return;tt(me)||Y.error(u("Compare price must be greater than or equal to item price."))};be(()=>t.product.variants,ce=>{Array.isArray(ce)&&(ce.forEach(me=>{const Le=me.media?me.media.meta_value||me.media:[];me.media=Array.isArray(Le)?Le:[]}),c.value&&(c.value=!1,Ft()))},{immediate:!0,deep:!1});const ht=[];Ie(async()=>{await Be(),document.querySelectorAll(".fct-adv-variant-table-wrap .el-input__wrapper input[type='number']").forEach(me=>{const Le=De=>{document.activeElement===me&&De.preventDefault()};me.addEventListener("wheel",Le),ht.push({input:me,handler:Le})})}),Bt(()=>{ht.forEach(({input:ce,handler:me})=>{ce.removeEventListener("wheel",me)}),ht.length=0}),be(()=>{var ce;return(ce=he.value[0])==null?void 0:ce.id},ce=>{if(he.value.length<2||!ce){D.value=null;return}D.value=parseInt(ce,10)},{immediate:!0}),be(()=>he.value.length,ce=>{ce<2&&(D.value=null)}),be([D,he],([ce,me])=>{var te;if(!Array.isArray(me)||me.length<2)return;const Le=(te=me[0])==null?void 0:te.id;if(!Le)return;const De=me.map(He=>parseInt(He.id,10));(ce==null||!De.includes(parseInt(ce,10)))&&(D.value=parseInt(Le,10))},{deep:!0});const Ye=(ce,me,Le)=>{const De=parseFloat(Le)||0,te=t.product.variants.findIndex(He=>He.id===ce.id);te!==-1&&t.productEditModel.onChangePricing(me,te,De)},Se=(ce,me)=>{const Le=ce.media;ce.media=me,g(),ue.post(`products/variants/${ce.id}/setMedia`,{media:me}).then(De=>{Y.success(De.message||u("Thumbnail set successfully"))}).catch(De=>{var te;ce.media=Le,Y.error(((te=De==null?void 0:De.data)==null?void 0:te.message)||(De==null?void 0:De.message)||u("Failed to save thumbnail"))}).finally(y)},Ee=async(ce,me)=>{const Le=ce.variants.filter(ke=>a.value.includes(ke.id)),De=Le.length?Le:ce.variants;De.forEach(ke=>{ke.media=me});const te=De.map(ke=>ke.id),He=5;let ut=0;g();try{for(let ke=0;ke<te.length;ke+=He){const wt=await Promise.allSettled(te.slice(ke,ke+He).map(ba=>ue.post(`products/variants/${ba}/setMedia`,{media:me})));ut+=wt.filter(ba=>ba.status==="rejected").length}}finally{y()}ut===0?Y.success(u("Thumbnail applied to %1$s variants",De.length)):Y.error(u("Failed to apply thumbnail to %1$s variants",ut))},Oe=K({get(){const ce=se.value.map(me=>me.id);return ce.length===0?!1:ce.every(me=>a.value.includes(me))},set(ce){const me=se.value.map(Le=>Le.id);if(ce){const Le=new Set([...a.value,...me]);a.value=Array.from(Le)}else{const Le=new Set(me);a.value=a.value.filter(De=>!Le.has(De))}}}),Me=K(()=>{const ce=se.value.map(Le=>Le.id);if(ce.length===0)return!1;const me=ce.filter(Le=>a.value.includes(Le)).length;return me>0&&me<ce.length}),_t=()=>{if(l.value||!I.value||a.value.length===0)return;if(I.value==="delete"){$n.confirmDeleteWithInput("delete",u("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{vt()}).catch(()=>{});return}const ce=I.value==="set_price";let me=null;if(ce&&(me=parseFloat(Q.value),Q.value===""||isNaN(me)||me<0)){Y.error(u("Please enter a valid price."));return}if(ce&&a.value.slice(0,Ju).map(te=>t.product.variants.find(He=>He.id===te)).filter(te=>{if(!te)return!1;const He=parseFloat(te.compare_price);return!isNaN(He)&&He>0&&He<me}).length){Y.error(u("Compare price must be greater than or equal to item price."));return}const Le=a.value.slice(0,Ju).map(De=>{const te={id:De};return I.value==="set_price"?te.item_price=me:I.value==="set_status_active"?te.item_status="active":I.value==="set_status_inactive"&&(te.item_status="inactive"),te});l.value=!0,t.productEditModel.bulkUpdateVariants(Le).then(De=>{Y.success((De==null?void 0:De.message)||u("Variants updated successfully")),t.productEditModel.data.reloader(),a.value=[],I.value="",Q.value=""}).catch(De=>{var te;Y.error(((te=De==null?void 0:De.data)==null?void 0:te.message)||u("Bulk action failed"))}).finally(()=>{l.value=!1})},vt=async()=>{const ce=[...a.value],me=5;g();try{for(let Le=0;Le<ce.length;Le+=me)await Promise.all(ce.slice(Le,Le+me).map(De=>ue.delete(`products/variants/${De}`)));Y.success(u("Variants deleted successfully")),t.productEditModel.data.reloader(),a.value=[]}catch{Y.error(u("Failed to delete some variants"))}finally{y()}},Lt=ce=>{if(!ce||!ce.id)return;const me=ce.item_status==="inactive"?"active":"inactive";g(),t.productEditModel.bulkUpdateVariants([{id:ce.id,item_status:me}]).then(Le=>{ce.item_status=me,Y.success((Le==null?void 0:Le.message)||u("Variant updated successfully")),t.productEditModel.data.reloader()}).catch(Le=>{var De;Y.error(((De=Le==null?void 0:Le.data)==null?void 0:De.message)||u("Failed to update variant"))}).finally(y)},Et=ce=>{const me=ce.attr_map||[];return me.length?me.map(De=>{const te=t.attributeGroups.find(ut=>ut.id===parseInt(De.group_id));if(!te)return null;const He=(te.terms||[]).find(ut=>ut.id===parseInt(De.term_id));return He?He.title:null}).filter(Boolean).join(" / "):""},Dt=(ce,me)=>{const Le=ce.attr_map||[];if(!Le.length)return"";const De=parseInt(me);return Le.filter(He=>parseInt(He.group_id)!==De).map(He=>{const ut=t.attributeGroups.find(wt=>wt.id===parseInt(He.group_id));if(!ut)return null;const ke=(ut.terms||[]).find(wt=>wt.id===parseInt(He.term_id));return ke?ke.title:null}).filter(Boolean).join(" / ")},dt=ce=>{const me=t.product.variants.findIndex(Le=>Le.id===ce.id);me!==-1&&(t.productEditModel.setValidationErrors({}),b.value=me,k.value=!0)},Ut=()=>{t.productEditModel.setValidationErrors({}),$.value=!1,k.value=!1,b.value=null,s.value=!1,i.value=null,c.value=!1},Ft=()=>{t.productEditModel.setValidationErrors({}),$.value=!1,s.value=!1,i.value=null,p.value=new Set},It=K(()=>!i.value||!i.value.items?[]:i.value.items.filter(ce=>p.value.has(ce.key)).map(ce=>ce.variant&&ce.variant.id?ce.variant.id:null).filter(Boolean)),Qt=ce=>{const me=new Set(p.value);me.has(ce)?me.delete(ce):me.add(ce),p.value=me},Tt=()=>{F.value=!1,M.value=!1,S.value=null},Wt=()=>{var ce,me;return((me=(ce=x.value)==null?void 0:ce.hasDirtyDrafts)==null?void 0:me.call(ce))??!1},kt=ce=>{$.value=ce},sa=()=>{const ce=S.value;if(Tt(),!!ce&&ce.type==="close"){if(typeof ce.done=="function"){ce.done();return}Ut()}},ve=()=>{Tt()},Fe=async()=>{var ce,me;await((me=(ce=x.value)==null?void 0:ce.discardDrafts)==null?void 0:me.call(ce)),$.value=!1,sa()},ot=async()=>{var me;if(!((me=x.value)!=null&&me.saveCurrentDraft)||M.value)return;if(M.value=!0,await x.value.saveCurrentDraft()){$.value=!1,sa();return}M.value=!1,ve()},gt=ce=>{if(!Wt()){ce();return}S.value={type:"close",done:ce},F.value=!0},Ct=()=>{if(s.value){gt(Ft);return}gt(Ut)},jt=ce=>{if($.value=!1,t.productEditModel.setValidationErrors({}),s.value){c.value=!0,t.productEditModel.data.reloader();return}ce&&typeof ce.index=="number"&&ce.index>=0&&(b.value=ce.index)},yt=ce=>{const me=Ra.value?Ra.value.find(Le=>Le.termId===ce.termId):null;me&&ca(me)},ca=ce=>{if(!ce||!ce.items||!ce.items.length||$.value)return;i.value=ce,p.value=new Set(ce.items.map(Le=>Le.key)),s.value=!0;const me=ce.items[0];t.productEditModel.setValidationErrors({}),b.value=typeof me.index=="number"?me.index:null,k.value=!0},ta=T(typeof window<"u"?window.innerWidth:1280);let Ht=null;Ie(()=>{typeof window>"u"||(Ht=()=>{ta.value=window.innerWidth},window.addEventListener("resize",Ht))}),Bt(()=>{Ht&&(window.removeEventListener("resize",Ht),Ht=null)});const na=K(()=>ta.value<=900),Za=K(()=>ta.value<=640?"100%":ta.value<=900?"95%":"920px"),Ql=K(()=>{const ce=new Map;return(t.product.variants||[]).forEach((me,Le)=>{me&&me.id!=null&&ce.set(me.id,Le)}),(se.value||[]).map(me=>{var De,te;const Le=ce.get(me==null?void 0:me.id);return{key:(me==null?void 0:me.id)??`variant-${Le}`,index:Le,variant:me,label:Et(me)||(me==null?void 0:me.variation_title)||`${u("Variant")} ${Le+1}`,meta:(me==null?void 0:me.item_price)!==void 0&&(me==null?void 0:me.item_price)!==null&&(me==null?void 0:me.item_price)!==""?`${((te=(De=window.appVars)==null?void 0:De.shop)==null?void 0:te.currency_sign)||"$"} ${me.item_price}`:u("No price set"),modeType:"update",isDraft:!1}})}),Ra=K(()=>{if(!pe.value||pe.value.length===0)return null;const ce=new Map;(t.product.variants||[]).forEach((De,te)=>{De&&De.id!=null&&ce.set(De.id,te)});const me=D.value,Le=De=>{var ut,ke;const te=ce.get(De==null?void 0:De.id),He=me?Dt(De,me):Et(De);return{key:(De==null?void 0:De.id)??`variant-${te}`,index:te,variant:De,label:He||(De==null?void 0:De.variation_title)||`${u("Variant")} ${te+1}`,meta:(De==null?void 0:De.item_price)!==void 0&&(De==null?void 0:De.item_price)!==null&&(De==null?void 0:De.item_price)!==""?`${((ke=(ut=window.appVars)==null?void 0:ut.shop)==null?void 0:ke.currency_sign)||"$"} ${De.item_price}`:u("No price set"),modeType:"update",isDraft:!1}};return pe.value.map(De=>({termId:De.termId,title:De.title,count:De.variants.length,items:De.variants.map(Le)}))}),aa=K(()=>{var me;const ce=(me=t.product.variants)==null?void 0:me[b.value];return(ce==null?void 0:ce.id)??`variant-${b.value??0}`}),ee=(ce,me)=>{const Le=parseInt(me,10),De=(ce.attr_map||[]).find(ke=>parseInt(ke.group_id,10)===Le);if(!De)return"";const te=t.attributeGroups.find(ke=>parseInt(ke.id,10)===Le);if(!te)return"";const He=parseInt(De.term_id,10),ut=(te.terms||[]).find(ke=>parseInt(ke.id,10)===He);return ut?ut.title:""},we=K(()=>{var me;if(b.value===null)return{group:"",detail:""};const ce=(me=t.product.variants)==null?void 0:me[b.value];return ce?D.value?{group:ee(ce,D.value),detail:Dt(ce,D.value)}:{group:"",detail:Et(ce)}:{group:"",detail:""}}),le=ce=>{ce&&($.value&&aa.value!==ce.key||typeof ce.index=="number"&&(t.productEditModel.setValidationErrors({}),b.value=ce.index))},Ae=ce=>{var me,Le;return!!((me=ce==null?void 0:ce.variant)!=null&&me.id)&&["publish","private"].includes((Le=t.product)==null?void 0:Le.post_status)},Ge=ce=>`${je.get("frontend_url")}=instant_checkout&item_id=${ce.variant.id}&quantity=1`,lt=(ce,me)=>{var Le,De;if(!(!me||!ce)){if(ce==="copy_variation_id"&&((Le=me.variant)!=null&&Le.id)){Yl.copy(String(me.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}if(ce==="copy_direct_checkout"&&Ae(me)){Yl.copy(Ge(me),{successMessage:u("Direct checkout link copied to clipboard")});return}ce==="toggle_status"&&((De=me.variant)!=null&&De.id)&&Lt(me.variant)}};return(ce,me)=>{const Le=C("el-button"),De=C("el-input"),te=C("el-checkbox"),He=C("el-popover"),ut=C("el-dropdown-item"),ke=C("el-dropdown-menu"),wt=C("el-dropdown"),ba=C("el-drawer"),de=C("el-dialog");return r(),h("div",mP,[o("div",hP,[n(VO,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:D.value,"onUpdate:modelValue":me[0]||(me[0]=oe=>D.value=oe)},null,8,["product","attribute-groups","modelValue"]),o("div",_P,[U.value?(r(),E(Le,{key:1,onClick:P},{default:d(()=>[L(f(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:R},[n(J,{name:"Search"}),n(J,{name:"Filter"})],8,vP))])]),n(Gl,{onBeforeEnter:j,onEnter:q,onAfterEnter:z,onLeave:X,onAfterLeave:ne},{default:d(()=>[U.value?(r(),h("div",gP,[o("div",yP,[n(De,{modelValue:V.value,"onUpdate:modelValue":me[1]||(me[1]=oe=>V.value=oe),placeholder:A(u)("Search variants"),size:"small",clearable:""},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),N.value.length>0?(r(),h("div",bP,[(r(!0),h(H,null,ae(N.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:re(["fct-adv-filter-chip",{"is-active":W(oe.id)>0}]),"aria-pressed":W(oe.id)>0,type:"button"},[o("span",null,f(oe.title),1),W(oe.id)>0?(r(),h("span",CP,f(W(oe.id)),1)):B("",!0),n(J,{name:"ChevronDown"})],10,wP)]),default:d(()=>[o("div",kP,[o("div",BP,[o("span",null,f(A(u)("Filter by %1$s",oe.title)),1),W(oe.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Ue=>ie(oe.id)},f(A(u)("Clear")),9,xP)):B("",!0)]),o("ul",SP,[(r(!0),h(H,null,ae(oe.terms,Ue=>(r(),h("li",{key:Ue.id},[n(te,{"model-value":G(oe.id,Ue.id),onChange:Te=>Z(oe.id,Ue.id)},{default:d(()=>[L(f(Ue.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),fe.value&&!ge.value?(r(),h("span",FP,f(A(u)("Showing %1$s of %2$s variants",se.value.length,e.product.variants.length)),1)):B("",!0),fe.value?(r(),h("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:ye},f(A(u)("Clear filters")),1)):B("",!0)])):B("",!0)])):B("",!0)]),_:1}),n(RO,{"selected-count":a.value.length,"bulk-action":I.value,"onUpdate:bulkAction":me[2]||(me[2]=oe=>I.value=oe),"bulk-value":Q.value,"onUpdate:bulkValue":me[3]||(me[3]=oe=>Q.value=oe),saving:l.value,onApply:_t,onClear:me[4]||(me[4]=oe=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),ge.value?(r(),h("div",$P,[n(J,{name:"Search"}),o("p",EP,f(A(u)("No variants match your filters")),1),o("p",UP,f(A(u)("Try a different search term or clear some filters.")),1),n(Le,{size:"small",onClick:ye},{default:d(()=>[L(f(A(u)("Clear filters")),1)]),_:1})])):B("",!0),v.value&&!ge.value?(r(),h("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":ce.$t("Updating variants")},[o("table",null,[me[16]||(me[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,[me[13]||(me[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,f(ce.$t("Image")),1),o("th",null,f(ce.$t("Variant")),1),o("th",null,f(ce.$t("Price")),1),o("th",null,f(ce.$t("Compare at price")),1),me[14]||(me[14]=o("th",null,null,-1))])]),o("tbody",QP,[(r(!0),h(H,null,ae(Math.min(w.value,8),oe=>(r(),h("tr",{key:"wrap-skel-"+oe},me[15]||(me[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,IP)):$e.value&&!ge.value?(r(),E(PH,{key:2,product:e.product,"product-edit-model":e.productEditModel,"attribute-groups":e.attributeGroups,"grouped-variants":pe.value,"selected-variants":a.value,"is-all-selected":Oe.value,"is-selection-indeterminate":Me.value,"group-by-id":D.value,"expanded-groups":m.value,"onUpdate:selectedVariants":me[5]||(me[5]=oe=>a.value=oe),"onUpdate:isAllSelected":me[6]||(me[6]=oe=>Oe.value=oe),"onUpdate:expandedGroups":me[7]||(me[7]=oe=>m.value=oe),onEditVariant:dt,onEditGroup:yt,onToggleStatus:Lt,onInlinePriceChange:Ye,onInlinePriceCommit:Xe,onMediaUploaded:Se,onGroupPriceApply:_e,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&&!ge.value?(r(),E(dP,{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":me[8]||(me[8]=oe=>a.value=oe),"onUpdate:isAllSelected":me[9]||(me[9]=oe=>Oe.value=oe),onEditVariant:dt,onToggleStatus:Lt,onInlinePriceChange:Ye,onInlinePriceCommit:Xe,onMediaUploaded:Se},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",DP,[(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",VP,[o("div",TP,[o("div",MP,[o("div",LP,[n(pp,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:Pe=>Se(oe,Pe)},null,8,["onMediaUploaded"])]),((Ue=oe==null?void 0:oe.media)==null?void 0:Ue.length)>0?(r(),h("div",RP,[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,OP)])):(r(),h("img",{key:1,src:ce.appVars.asset_url+"images/empty-image.svg",alt:A(u)("No Image")},null,8,HP))]),o("div",PP,[o("div",NP,[L(f(oe.variation_title)+" ",1),oe.item_status==="inactive"?(r(),h("span",KP,f(A(u)("Inactive")),1)):B("",!0)]),o("div",GP,f(Et(oe)||"—"),1),o("ul",null,[o("li",null,[oe.compare_price?(r(),h("div",jP,[o("span",{textContent:f(ce.appVars.shop.currency_sign)},null,8,zP),L(" "+f(oe.compare_price),1)])):B("",!0),o("div",qP,[o("span",{textContent:f(ce.appVars.shop.currency_sign)},null,8,YP),L(" "+f(oe.item_price),1)])])])])]),o("div",WP,[o("div",XP,[n(Ze,{size:"small",tag:"button",onClick:Pe=>dt(oe)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(wt,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:Pe=>{Pe==="toggle_status"&&Lt(oe)}},{dropdown:d(()=>[n(ke,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:re({"item-destructive":oe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:oe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),L(" "+f(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,JP)]),_:2},1032,["onCommand"])])])])])}),128))])),n(ba,{modelValue:k.value,"onUpdate:modelValue":me[11]||(me[11]=oe=>k.value=oe),title:A(u)("Pricing"),size:Za.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":gt,class:"fct-shared-variant-drawer",onClose:Ut},{default:d(()=>{var oe,Ue,Te,Pe,pt,ft;return[o("div",ZP,[!na.value&&s.value?(r(),h("aside",eN,[n(Tr,{product:e.product},null,8,["product"]),o("div",tN,[o("p",aN,[L(f(A(u)("Editing group"))+": ",1),o("span",lN,f((oe=i.value)==null?void 0:oe.title),1)]),o("p",sN,f(A(u)("Changes will apply to %1$s of %2$s variants in this group.",It.value.length,(Ue=i.value)==null?void 0:Ue.count)),1),o("ul",nN,[(r(!0),h(H,null,ae((Te=i.value)==null?void 0:Te.items,ct=>(r(),h("li",{key:ct.key,class:"fct-group-edit-aside__item"},[n(te,{"model-value":p.value.has(ct.key),onChange:Rt=>Qt(ct.key)},{default:d(()=>[L(f(ct.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])])):na.value?B("",!0):(r(),h("aside",oN,[n(Tr,{product:e.product},null,8,["product"]),o("div",iN,[n(De,{modelValue:V.value,"onUpdate:modelValue":me[10]||(me[10]=ct=>V.value=ct),placeholder:A(u)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),N.value.length>0?(r(),h("div",rN,[(r(!0),h(H,null,ae(N.value,ct=>(r(),E(He,{key:"nav-chip-"+ct.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:re(["fct-adv-filter-chip",{"is-active":W(ct.id)>0}]),"aria-pressed":W(ct.id)>0,type:"button"},[o("span",null,f(ct.title),1),W(ct.id)>0?(r(),h("span",uN,f(W(ct.id)),1)):B("",!0),n(J,{name:"ChevronDown"})],10,dN)]),default:d(()=>[o("div",cN,[o("div",AN,[o("span",null,f(A(u)("Filter by %1$s",ct.title)),1),W(ct.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Rt=>ie(ct.id)},f(A(u)("Clear")),9,pN)):B("",!0)]),o("ul",fN,[(r(!0),h(H,null,ae(ct.terms,Rt=>(r(),h("li",{key:Rt.id},[n(te,{"model-value":G(ct.id,Rt.id),onChange:$a=>Z(ct.id,Rt.id)},{default:d(()=>[L(f(Rt.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128))])):B("",!0),fe.value?(r(),h("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:ye},f(A(u)("Clear filters")),1)):B("",!0)]),n(Vp,{items:Ql.value,"grouped-items":Ra.value,"active-key":aa.value,"is-dirty":$.value,"is-saving":M.value,"drawer-mode":"update",product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":Ae,onSelect:le,onSave:ot,onCommand:lt,onEditGroup:ca},null,8,["items","grouped-items","active-key","is-dirty","is-saving","product","product-edit-model"])])),o("div",mN,[na.value&&s.value?(r(),h("div",hN,[o("div",_N,[L(f(A(u)("Editing group"))+": ",1),o("span",null,f((Pe=i.value)==null?void 0:Pe.title),1)]),o("div",vN,f(A(u)("Changes will apply to %1$s of %2$s variants in this group.",It.value.length,(pt=i.value)==null?void 0:pt.count)),1),o("ul",gN,[(r(!0),h(H,null,ae((ft=i.value)==null?void 0:ft.items,ct=>(r(),h("li",{key:ct.key},[n(te,{"model-value":p.value.has(ct.key),onChange:Rt=>Qt(ct.key)},{default:d(()=>[L(f(ct.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])):na.value?(r(),h(H,{key:1},[Ra.value&&Ra.value.length?(r(),h("div",yN,[(r(!0),h(H,null,ae(Ra.value,ct=>(r(),h("button",{key:"cge-"+ct.termId,type:"button",class:"fct-compact-group-edit-bar__btn",disabled:$.value,"aria-label":A(u)("Edit group %1$s",ct.title),onClick:Rt=>ca(ct)},[n(J,{name:"Edit"}),o("span",null,f(ct.title),1)],8,bN))),128))])):B("",!0),n(Tp,{items:Ql.value,"active-key":aa.value,"is-dirty":$.value,onSelect:le},null,8,["items","active-key","is-dirty"])],64)):B("",!0),o("div",wN,[k.value&&b.value!==null&&!s.value?(r(),E(Sd,{ref_key:"pricingFormRef",ref:x,key:aa.value,index:b.value,modeType:"update",fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,"variant-title-info":we.value,onCreateOrUpdateVariant:jt,onCloseModal:Ct,onDirtyStateChange:kt},null,8,["index","product","productEditModel","variant-title-info"])):k.value&&s.value&&i.value?(r(),E(fP,{ref_key:"pricingFormRef",ref:x,key:`group-${i.value.termId}`,"group-variant-ids":It.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:jt,onCloseModal:Ct,onDirtyStateChange:kt},null,8,["group-variant-ids","product","productEditModel"])):B("",!0)])])])]}),_:1},8,["modelValue","title","size"]),n(de,{modelValue:F.value,"onUpdate:modelValue":me[12]||(me[12]=oe=>F.value=oe),"close-on-click-modal":!1,"close-on-press-escape":!M.value,"show-close":!M.value,class:"fct-variant-dirty-dialog",onClose:ve},{header:d(({titleId:oe})=>[o("div",CN,[o("h3",{id:oe},f(A(u)("Unsaved changes")),9,kN)])]),default:d(()=>[o("p",null,f(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",BN,[o("div",xN,[n(Le,{disabled:M.value,size:"small",onClick:ve},{default:d(()=>[L(f(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n(Le,{disabled:M.value,size:"small",onClick:Fe},{default:d(()=>[L(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(Le,{type:"primary",loading:M.value,size:"small",onClick:ot},{default:d(()=>[L(f(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},FN=["src","alt"],$N={class:"fct-swatch-tag-label"},EN=["aria-label","onClick","onKeydown"],Wi={__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=K({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)},m=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(Zs),{modelValue:i.value,"onUpdate:modelValue":v[2]||(v[2]=w=>i.value=w),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,w=>(r(),h("span",{key:String(w),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:ra(m(w))},null,4)):e.type==="image"?(r(),h("img",{key:2,class:"fct-swatch-tag-img",src:_(w),alt:p(w)},null,8,FN)):B("",!0),o("span",$N,f(p(w)),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(w),["stop"]),onKeydown:xa(Ne(k=>g(w),["prevent"]),["enter","space"])},"×",40,EN)]))),128))]),_:1},8,["modelValue","disabled"]))}},UN={class:"fct-add-term-modal"},IN={class:"dialog-footer"},QN={__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=T(!1),i=T({}),c=T(null),p=K(()=>{const y=a.group&&a.group.settings;return y&&y.type?y.type:"options"}),m=T({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=K(()=>(m.value.title||"").trim()!==""),g=()=>{if(!_.value||s.value)return;s.value=!0,i.value={};const y={terms:[{title:m.value.title.trim(),settings:{color:m.value.settings.color||"",image:m.value.settings.image||""}}]};ue.post("options/attr/group/"+a.groupId+"/terms",y).then(v=>{Js(v.message);const w=Array.isArray(v.data)?v.data[0]:v.data;l("isTermCreatingDone",w)}).catch(v=>{var w;(v==null?void 0:v.status_code)==422&&v.data?i.value=v.data:Y.error(((w=v==null?void 0:v.data)==null?void 0:w.message)||(v==null?void 0:v.message)||u("Failed to add the term."))}).finally(()=>{s.value=!1})};return(y,v)=>{const w=C("el-button");return r(),h("div",UN,[n(ho,{ref_key:"formRef",ref:c,term:m.value,"group-type":p.value,"show-remove-button":!1,"validation-errors":i.value,"field-key":"terms.0",onSubmit:g,onRemove:v[0]||(v[0]=k=>l("isTermCreatingDone"))},null,8,["term","group-type","validation-errors"]),o("div",IN,[n(w,{disabled:!_.value||s.value,loading:s.value,type:"primary",onClick:g},{default:d(()=>[L(f(A(u)("Add term")),1)]),_:1},8,["disabled","loading"])])])}}},DN={class:"fct-advanced-variation-config"},VN={class:"fct-adv-var-attributes"},TN={key:0,class:"fct-adv-var-loading"},MN={key:1,class:"fct-adv-var-empty-hint"},LN={key:2,class:"fct-adv-var-empty-state"},RN={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},ON={class:"fct-adv-var-empty-state__copy"},HN=["aria-expanded","onClick","onKeydown"],PN={class:"fct-option-card-summary"},NN={class:"fct-option-card-summary-header"},KN={key:0,class:"fct-option-card-chips"},GN=["src","alt"],jN={class:"fct-option-value-chip-label"},zN=["aria-label","title","onClick"],qN={key:0,class:"fct-option-card-body"},YN={class:"fct-option-label"},WN={key:0,class:"mt-2"},XN={key:1,class:"fct-option-error"},JN={class:"fct-option-label"},ZN={key:0,class:"fct-select-all-header"},eK={class:"fct-option-item"},tK={class:"fct-option-item"},aK={key:1,class:"fct-picker-inline-form-body"},lK={class:"fct-picker-inline-form-actions"},sK={key:1,class:"fct-option-field-values"},nK={class:"fct-option-empty-default"},oK={key:0,class:"fct-select-all-header"},iK={class:"fct-color-option"},rK={key:1,class:"fct-picker-inline-form-body"},dK={class:"fct-picker-inline-form-actions"},uK={key:2,class:"fct-option-field-values"},cK={class:"fct-option-empty-default"},AK={key:0,class:"fct-select-all-header"},pK={class:"fct-image-option"},fK=["src"],mK={key:1,class:"fct-picker-inline-form-body"},hK={class:"fct-picker-inline-form-actions"},_K={key:3,class:"fct-option-error"},vK={class:"fct-option-card-actions"},gK=["title"],yK={key:5,class:"fct-adv-order-save-bar"},bK={class:"fct-adv-order-save-bar__msg"},wK={class:"fct-adv-order-save-bar__actions"},CK={key:6},kK={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},BK={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},xK={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},SK={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},Ao=200,Xi=10,Ji=100,Zu=200,FK={__name:"AdvancedVariationConfig",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T([]),l=T([]),s=T(!1),i=T(!1),c=T(!1),p=T(null),m=T(!1),_=T(null),g=T(!1),y=T(null),v=T(null),w=T([]),k=T([]),b=T(""),x=de=>JSON.stringify(de.map(oe=>({group_id:oe.group_id||null,variants:[...oe.variants||[]].map(Ue=>String(Ue))}))),F=()=>{k.value=l.value.map(de=>({group_id:de.group_id||null,title:de.title||"",variants:Array.isArray(de.variants)?[...de.variants]:[]})),b.value=x(l.value)},M=K(()=>{const de=l.value.filter(oe=>oe.group_id&&Array.isArray(oe.variants)&&oe.variants.length>0);return de.length===0?b.value!==x([]):x(de)!==b.value}),$=K(()=>l.value.length===0?u("All options removed. Save to delete all variations."):u("Option config changed. Save to update variants.")),S=K(()=>{if(p.value===null||!v.value)return!1;const de=l.value[p.value];if(!de)return!1;if(String(de.group_id||"")!==String(v.value.group_id||"")||(de.title||"")!==(v.value.title||""))return!0;const oe=Array.isArray(de.variants)?de.variants:[],Ue=Array.isArray(v.value.variants)?v.value.variants:[];if(oe.length!==Ue.length)return!0;const Te=oe.map(pt=>String(pt)),Pe=Ue.map(pt=>String(pt));return Te.some((pt,ft)=>pt!==Pe[ft])});Ie(()=>{Q(),I()}),Bt(()=>{He()});const I=()=>{c.value=!0,ue.get("options/attr/groups/library").then(de=>{a.value=(de.groups||[]).slice(0,Zu),l.value.forEach(oe=>O(oe.group_id))}).catch(de=>{var oe;Y.error(((oe=de==null?void 0:de.data)==null?void 0:oe.message)||u("Failed to load attribute groups"))}).finally(()=>{c.value=!1})},Q=()=>{var Ue,Te;const de=(Te=(Ue=t.product)==null?void 0:Ue.detail)==null?void 0:Te.other_info,oe=de==null?void 0:de.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(pt=>parseInt(pt,10)).filter(Number.isFinite),errors:{name:"",values:""}}))),ne(),F()},D=new Set,V=T({}),U=K(()=>{if(!v.value||!v.value.group_id)return!1;const de=parseInt(v.value.group_id,10);return!!V.value[de]}),O=de=>{if(!/^\d+$/.test(String(de)))return;const oe=parseInt(de,10),Ue=a.value.find(Pe=>Ee(Pe.id,oe));if(!Ue||Array.isArray(Ue.terms)||D.has(oe))return;D.add(oe),V.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 pt;Y.error(((pt=Pe==null?void 0:Pe.data)==null?void 0:pt.message)||u("Failed to load option values"))}).finally(()=>{D.delete(oe),delete V.value[oe]})},R=new Set;let P=null;const j=(de,oe)=>{const Ue=(oe||"").trim();if(!Ue||!/^\d+$/.test(String(de)))return;const Te=parseInt(de,10),Pe=a.value.find(ct=>Ee(ct.id,Te));if(!Pe)return;const pt=Array.isArray(Pe.terms)?Pe.terms.length:0,ft=parseInt(Pe.terms_count,10)||0;ft&&pt>=ft||Array.isArray(Pe.terms)&&Pe.terms.some(ct=>(ct.title||"").trim().toLowerCase()===Ue.toLowerCase())||(P&&clearTimeout(P),P=setTimeout(()=>{const ct=Te+":"+Ue.toLowerCase();R.has(ct)||(R.add(ct),ue.get("options/attr/group/"+Te+"/terms",{search:Ue,per_page:50}).then(Rt=>{const $a=Rt.terms&&Rt.terms.data||[];if(!$a.length)return;Array.isArray(Pe.terms)||(Pe.terms=[]);const Kt=new Set(Pe.terms.map(Sa=>Sa.id)),ma=$a.filter(Sa=>!Kt.has(Sa.id));ma.length&&(Pe.terms=[...Pe.terms,...ma])}).catch(()=>{}).finally(()=>{R.delete(ct)}))},250))},q=de=>{if(!/^\d+$/.test(String(de)))return;const oe=parseInt(de,10),Ue=a.value.find(Pe=>Ee(Pe.id,oe));if(!Ue||D.has(oe))return;D.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 pt=Pe.terms&&Pe.terms.data||[],ft=new Map((Array.isArray(Ue.terms)?Ue.terms:[]).map(Rt=>[Rt.id,Rt]));pt.forEach(Rt=>ft.set(Rt.id,Rt)),Ue.terms=Array.from(ft.values());const ct=Pe.terms&&Pe.terms.total;typeof ct=="number"&&(Ue.terms_count=ct)}).catch(()=>{}).finally(()=>{D.delete(oe)})};let z=!1;const X=()=>{z||(z=!0,ue.get("options/attr/groups/library").then(de=>{const oe=(de.groups||[]).slice(0,Zu),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(()=>{z=!1}))},ne=()=>{w.value=l.value.map(de=>de.group_id).filter(Boolean)},he=()=>{v.value=null,p.value=null,l.value=k.value.map(de=>({group_id:de.group_id,title:de.title,variants:[...de.variants],errors:{name:"",values:""}}))},N=async()=>{if(p.value!==null&&(await fe(p.value),p.value!==null))return;if(i.value=!0,!await ot()){i.value=!1;return}sa({silent:!1})},G=de=>{const oe=l.value.filter((Ue,Te)=>Te!==de).map(Ue=>Ue.group_id).filter(Boolean);return a.value.filter(Ue=>!oe.includes(Ue.id))},Z=async()=>{if(p.value!==null&&(await fe(p.value),p.value!==null))return;l.value.push({group_id:null,title:"",variants:[],errors:{name:"",values:""}});const de=l.value.length-1;ye(de)},W=de=>{l.value.splice(de,1),p.value===de?(p.value=null,v.value=null):p.value!==null&&p.value>de&&p.value--},ie=de=>{p.value===de?fe(de):ye(de)},ye=de=>{const oe=l.value[de];v.value={group_id:oe.group_id||null,title:oe.title||"",variants:Array.isArray(oe.variants)?[...oe.variants]:[],errors:{name:"",values:""}},p.value=de,O(oe.group_id)},fe=async de=>{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[de];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},ge=T(""),se=de=>{ge.value=de||""},pe=de=>{if(de){X();return}ge.value=""},$e=de=>{const oe=G(de),Ue=ge.value.trim().toLowerCase();return Ue?oe.filter(Te=>typeof Te.title=="string"&&Te.title.toLowerCase().includes(Ue)):oe},tt=K(()=>{const de=ge.value.trim().toLowerCase();return de?!a.value.some(oe=>typeof oe.title=="string"&&oe.title.trim().toLowerCase()===de):!0}),_e=de=>{if(v.value){if(typeof de=="string"&&de!==""){const oe=de.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=de,v.value.variants=[])}else{const oe=a.value.find(Ue=>Ee(Ue.id,de));oe&&(v.value.title=oe.title,v.value.variants=[]),O(de)}v.value.errors&&(v.value.errors.name="")}},Xe=K(()=>v.value?typeof v.value.group_id=="string"&&v.value.group_id.trim()!=="":!1),ht=T(!1),Ye=async de=>{var Pe;if(!de||typeof de.group_id!="string"||de.group_id.trim()==="")return de?de.group_id:null;const oe=de.group_id.trim(),Ue=oe.toLowerCase(),Te=a.value.find(pt=>typeof pt.title=="string"&&pt.title.trim().toLowerCase()===Ue);if(Te)return de.group_id=Te.id,de.title=Te.title,O(Te.id),Te.id;ht.value=!0;try{const pt=await ue.post("options/attr/group/",{title:oe,slug:oe}),ft=pt.data||pt.group||pt;if(!ft||!ft.id)return Y.error(u("Failed to create attribute group")),null;a.value=[...a.value,{...ft,terms:ft.terms||[]}];const ct=parseInt(ft.id,10);return de.group_id=ct,de.title=ft.title||oe,ct}catch(pt){let ft="";if((pt==null?void 0:pt.status_code)===422||(pt==null?void 0:pt.status)===422){Y.validationErrors(pt);const ct=pt!=null&&pt.data&&typeof pt.data=="object"?pt.data:{},Rt=Object.values(ct)[0],$a=Rt&&typeof Rt=="object"?Object.values(Rt)[0]:Rt;ft=typeof $a=="string"?$a:u("Failed to create attribute group")}else ft=((Pe=pt==null?void 0:pt.data)==null?void 0:Pe.message)||u("Failed to create attribute group"),Y.error(ft);return de.errors&&(de.errors.name=ft),null}finally{ht.value=!1}},Se=async()=>!v.value||!Xe.value?!0:await Ye(v.value)!==null,Ee=(de,oe)=>String(de)===String(oe),Oe=de=>{const oe=a.value.find(Ue=>Ee(Ue.id,de));return oe?oe.terms||[]:[]},Me=de=>{if(!v.value||!Ee(v.value.group_id,de))return[];const oe=Oe(de).map(Ue=>Ue.title.toLowerCase());return(v.value.variants||[]).filter(Ue=>typeof Ue=="string"&&Ue.trim()!==""&&!oe.includes(Ue.toLowerCase()))},_t=K(function(){if(!v.value||!v.value.group_id)return!1;var de=Oe(v.value.group_id);return de.length?de.every(function(oe){return v.value.variants.some(function(Ue){return Ee(Ue,oe.id)})}):!1}),vt=K(function(){if(!v.value||!v.value.group_id)return!1;var de=Oe(v.value.group_id),oe=de.filter(function(Ue){return v.value.variants.some(function(Te){return Ee(Te,Ue.id)})}).length;return oe>0&&oe<de.length}),Lt=function(de){if(v.value){var oe=String(de),Ue=v.value.variants.findIndex(function(Te){return String(Te)===oe});Ue===-1?v.value.variants.push(de):v.value.variants.splice(Ue,1)}},Et=function(de){if(v.value){var oe=Oe(v.value.group_id);v.value.variants=de?oe.map(function(Ue){return Ue.id}):[]}},Dt=(de,oe)=>{const Ue=p.value===oe&&v.value?v.value:de;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")},dt=K(()=>{const de=l.value.map(oe=>oe.group_id).filter(Boolean);return new Set(de).size!==de.length}),Ut=K(()=>l.value.length>Xi),Ft=K(()=>l.value.length>0&&l.value.length<=Xi&&!dt.value&&l.value.every(de=>de.group_id&&de.variants&&de.variants.length>0&&de.variants.every(oe=>typeof oe=="number"))),It=K(()=>Ft.value?l.value.reduce((de,oe)=>de*(oe.variants?oe.variants.length:0),1):0),Qt=K(()=>It.value>Ao),Tt=K(()=>{const de=l.value.filter(oe=>oe.group_id&&Array.isArray(oe.variants)&&oe.variants.length>0);return de.length?de.reduce((oe,Ue)=>oe*Ue.variants.length,1):0}),Wt=K(()=>{const de=l.value.filter(Ue=>Array.isArray(Ue.variants)&&Ue.variants.length>0);if(!de.length)return 0;let oe=de.length-1;return de.forEach(Ue=>{const Te=Ue.variants.map(pt=>parseInt(pt,10)).filter(Number.isFinite),Pe=Te.length?Math.max(...Te):0;oe+=String(Pe).length}),oe}),kt=K(()=>Wt.value>Ji),sa=({silent:de=!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(),F(),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;Y.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(!Ft.value){de||Y.error(u("Please select at least one term for each attribute.")),i.value=!1;return}if(Qt.value){de||Y.error(u("Too many combinations (%1$s). Maximum allowed is %2$s.",It.value,Ao)),i.value=!1;return}if(kt.value){de||Y.error(u("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",Ji)),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=>{de||(Ue=Te.message||u("Variations generated successfully!")),ne(),F();const Pe=Te&&Array.isArray(Te.data)?Te.data:null,pt=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Pe&&pt&&(pt.variants=Pe),t.productEditModel.data.reloader(),typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(Te=>{var Pe;Y.error(((Pe=Te==null?void 0:Te.data)==null?void 0:Pe.message)||u("Failed to generate variations"))}).finally(async()=>{var ct,Rt;await Be();const Te=(Rt=(ct=t.productEditModel)==null?void 0:ct.data)==null?void 0:Rt.product,Pe=()=>{const $a=Te?Te.variants:null;return Array.isArray($a)&&$a.some(Kt=>Array.isArray(Kt.attr_map)&&Kt.attr_map.length>0)},pt=2500,ft=Date.now();for(;!Pe()&&Date.now()-ft<pt;)await new Promise($a=>setTimeout($a,50));await Be(),s.value=!1,await Be(),await Be(),i.value=!1,Ue&&(Y.success(Ue),Ue=null)})},ve=de=>{v.value&&v.value.errors&&de&&de.length>0&&(v.value.errors.values="")},Fe=async(de,{silent:oe=!1}={})=>{var pt;const Ue=Oe(de.group_id).map(ft=>ft.title.toLowerCase()),Te=(de.variants||[]).filter(ft=>typeof ft=="string"&&!Ue.includes(ft.toLowerCase()));if(!Te.length)return!0;const Pe=a.value.find(ft=>Ee(ft.id,de.group_id));try{const ft=await ue.post("options/attr/group/"+de.group_id+"/terms",{terms:Te.map(Rt=>({title:Rt}))}),ct=ft.data;Pe&&(Array.isArray(Pe.terms)||(Pe.terms=[]),Pe.terms=[...Pe.terms,...ct]),ct.forEach(Rt=>{de.variants=de.variants.map($a=>typeof $a=="string"&&$a.toLowerCase()===Rt.title.toLowerCase()?Rt.id:$a)}),de.variants=de.variants.filter(Rt=>typeof Rt!="string"),oe||Y.success(ft.message||u("Option values created successfully"))}catch(ft){return de.variants=de.variants.filter(ct=>typeof ct!="string"),Y.error(((pt=ft==null?void 0:ft.data)==null?void 0:pt.message)||u("Failed to create option values")),!1}return!0},ot=async()=>{for(const de of l.value)if(typeof de.group_id=="string"&&de.group_id.trim()!==""&&!await Ye(de)||!await Fe(de,{silent:!0}))return!1;return!0},gt=de=>{const oe=a.value.find(Ue=>Ee(Ue.id,de));return oe&&oe.settings&&oe.settings.type?oe.settings.type:"options"},Ct=de=>({options:u("Text"),color:u("Color"),image:u("Image")})[gt(de)]||gt(de),jt=de=>({options:"info",color:"warning",image:"success"})[gt(de)]||"info",yt=de=>{if(!de.variants||de.variants.length===0)return[];const oe=Oe(de.group_id);return de.variants.map(Ue=>typeof Ue=="string"?{id:Ue,title:Ue}:oe.find(Te=>Ee(Te.id,Ue))).filter(Boolean)},ca=de=>de.title?u("Add %1$s",de.title.toLowerCase()):u("Add more value"),ta=T(""),Ht=T(""),na=T("");let Za=null;const Ql=de=>{Za=de},Ra=T(!1),aa=T({title:"",settings:{color:"",image:""}}),ee=T(!1),we=T({}),le=de=>{Ht.value=de||"",v.value&&j(v.value.group_id,de)},Ae=K(()=>{if(!v.value||!v.value.group_id)return[];const de=Oe(v.value.group_id),oe=Ht.value.trim().toLowerCase();return oe?de.filter(Ue=>(Ue.title||"").toLowerCase().includes(oe)):de}),Ge=()=>{const de=Ht.value.trim();if(!de||!v.value||!v.value.group_id)return;const oe=gt(v.value.group_id);oe!=="color"&&oe!=="image"||te(de)},lt=(de,oe)=>{if(!de||de.key!=="Enter"||!v.value||!v.value.group_id)return;const Ue=gt(v.value.group_id);if(Ue!=="color"&&Ue!=="image")return;const Te=de.target,Pe=(Te&&typeof Te.value=="string"?Te.value:"").trim();!Pe||Oe(v.value.group_id).find(ft=>typeof ft.title=="string"&&ft.title.trim().toLowerCase()===Pe.toLowerCase())||(de.preventDefault(),de.stopPropagation(),te(Pe))};let Ke=null,qe=null,mt=null,Je=null;const $t=de=>{Ke=de},Yt=de=>{y.value=de,g.value=!0},ce=de=>{if(!de||!de.id){g.value=!1,y.value=null;return}const oe=y.value;a.value=[...a.value,{...de,terms:de.terms||[]}],oe!==null&&v.value&&p.value===oe&&(v.value.group_id=parseInt(de.id,10),v.value.title=de.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),O(parseInt(de.id,10))),g.value=!1,y.value=null},me=de=>{na.value=de||"",v.value&&j(v.value.group_id,de)},Le=K(()=>{if(!v.value||!v.value.group_id)return[];const de=Oe(v.value.group_id),oe=na.value.trim().toLowerCase();return oe?de.filter(Ue=>(Ue.title||"").toLowerCase().includes(oe)):de}),De=K(()=>{if(!v.value||!v.value.group_id)return[];const de=Me(v.value.group_id),oe=na.value.trim().toLowerCase();return oe?de.filter(Ue=>(Ue||"").toLowerCase().includes(oe)):de}),te=de=>{aa.value={title:(de||"").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),mt=function(oe){var Ue=document.querySelector(".el-color-picker__panel");Ue&&Ue.contains(oe.target)&&oe.stopPropagation()},document.body.addEventListener("mousedown",mt)),Je&&document.removeEventListener("keyup",Je,!0),Je=function(oe){oe.key==="Enter"&&(oe.stopPropagation(),document.removeEventListener("keyup",Je,!0),Je=null)},document.addEventListener("keyup",Je,!0),Be(()=>{var oe=document.querySelector(".fct-option-values-select");if(oe){var Ue=Ke||Za;if(Ue){var Te=Ue.$el||Ue,Pe=Te?Te.getBoundingClientRect().width:0;Pe>0&&(oe.style.maxWidth=Pe+"px")}}})},He=()=>{Ra.value=!1,aa.value={title:"",settings:{color:"",image:""}},we.value={},qe&&(document.removeEventListener("mousedown",qe,!0),qe=null),mt&&(document.body.removeEventListener("mousedown",mt),mt=null),Je&&(document.removeEventListener("keyup",Je,!0),Je=null);var de=document.querySelector(".fct-option-values-select");de&&(de.style.maxWidth="")},ut=async de=>{const oe=(aa.value.title||"").trim();if(!oe||ee.value||!v.value||!v.value.group_id)return;ee.value=!0,we.value={};const Ue={terms:[{title:oe,settings:{color:aa.value.settings.color||"",image:aa.value.settings.image||""}}]};try{if(Xe.value&&!await Se())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=de,ba(Pe),He(),Ht.value="",na.value=""}catch(Te){Te&&Te.status_code===422&&Te.data?we.value=Te.data:Y.error(Te&&Te.data&&Te.data.message||Te&&Te.message||u("Failed to add the term."))}finally{ee.value=!1}},ke=de=>{if(de){v.value&&q(v.value.group_id);return}He(),Ht.value=""},wt=de=>{if(de){v.value&&q(v.value.group_id);return}He(),na.value=""},ba=de=>{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),pt=a.value.find(ft=>Ee(ft.id,Pe));if(pt&&de&&Array.isArray(pt.terms)?pt.terms.push(de):(pt&&delete pt.terms,O(Pe)),de&&v.value&&Array.isArray(v.value.variants)){const ft=(de.title||"").trim().toLowerCase();v.value.variants=v.value.variants.filter(function(ct){return!(typeof ct=="string"&&ct.trim().toLowerCase()===ft)}),v.value.variants.some(function(ct){return String(ct)===String(de.id)})||v.value.variants.push(de.id)}}Y.success(u("Term created successfully"))}m.value=!1,_.value=null,ta.value=""};return(de,oe)=>{var $a;const Ue=C("router-link"),Te=C("el-tag"),Pe=C("el-option"),pt=C("el-select"),ft=C("el-button"),ct=C("el-checkbox"),Rt=C("el-dialog");return r(),h("div",DN,[o("div",VN,[c.value?(r(),h("div",TN,[(r(!0),h(H,null,ae(l.value.length||3,Kt=>(r(),h("div",{key:Kt,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",MN,[L(f(A(u)("No attribute groups found."))+" ",1),n(Ue,{to:{name:"attributes"}},{default:d(()=>[L(f(A(u)("Create attribute groups")),1)]),_:1})])):l.value.length===0&&!c.value?(r(),h("div",LN,[o("span",RN,[n(J,{name:"Information"})]),o("div",ON,[o("strong",null,f(A(u)("No options added yet.")),1),o("span",null,f(A(u)("Add options like Color, Size etc. to create variations.")),1)])])):B("",!0),l.value.length>0&&!c.value?(r(),E(A(Zs),{key:3,modelValue:l.value,"onUpdate:modelValue":oe[22]||(oe[22]=Kt=>l.value=Kt),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,(Kt,ma)=>(r(),h("div",{key:Kt.group_id||"new-"+ma,class:"fct-option-card"},[o("div",{class:"fct-option-card-collapsed",role:"button",tabindex:"0","aria-expanded":p.value===ma,onClick:Sa=>ie(ma),onKeydown:xa(Ne(Sa=>ie(ma),["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",PN,[o("div",NN,[o("strong",null,f(Dt(Kt,ma)),1),Kt.group_id?(r(),E(Te,{key:0,size:"small",type:jt(Kt.group_id),class:"fct-group-type-badge"},{default:d(()=>[L(f(Ct(Kt.group_id)),1)]),_:2},1032,["type"])):B("",!0)]),yt(Kt).length?(r(),h("div",KN,[(r(!0),h(H,null,ae(yt(Kt),Sa=>(r(),h("span",{key:Sa.id,class:re(["fct-option-value-chip",`fct-option-value-chip--${gt(Kt.group_id)}`])},[gt(Kt.group_id)==="color"?(r(),h("span",{key:0,class:"fct-option-value-swatch",style:ra({background:Sa.settings&&Sa.settings.color?Sa.settings.color:""})},null,4)):gt(Kt.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,GN)):B("",!0),o("span",jN,f(Sa.title),1)],2))),128))])):B("",!0)]),p.value===ma?(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=>fe(ma),["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,zN)):B("",!0)],40,HN),n(va,{accordion:"",visible:p.value===ma},{default:d(()=>{var Sa,We,Xt,Ka;return[p.value===ma&&v.value?(r(),h("div",qN,[o("div",{class:re(["fct-option-field",{"fct-option-field--error":(Sa=v.value.errors)==null?void 0:Sa.name}])},[o("label",YN,f(A(u)("Option name")),1),n(pt,{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=>_e(ze)),onVisibleChange:pe},{default:d(()=>[(r(!0),h(H,null,ae($e(ma),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",WN,[n(ft,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:ze=>Yt(ma)},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(A(u)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(We=v.value.errors)!=null&&We.name?(r(),h("div",XN,[n(J,{name:"AlertIcon"}),o("span",null,f(v.value.errors.name),1)])):B("",!0)],2),o("div",{class:re(["fct-option-field",{"fct-option-field--error":(Xt=v.value.errors)==null?void 0:Xt.values}])},[o("label",JN,f(A(u)("Option values")),1),gt(v.value.group_id)==="options"?(r(),E(pt,{key:0,ref_for:!0,ref:Ql,modelValue:v.value.variants,"onUpdate:modelValue":oe[8]||(oe[8]=ze=>v.value.variants=ze),multiple:"",filterable:"","allow-create":"","default-first-option":"","filter-method":me,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ca(v.value),disabled:!v.value.group_id,loading:U.value,"loading-text":A(u)("Loading..."),onChange:oe[9]||(oe[9]=ze=>ve(ze)),onVisibleChange:wt},{tag:d(()=>[n(Wi,{modelValue:v.value.variants,"onUpdate:modelValue":oe[3]||(oe[3]=ze=>v.value.variants=ze),terms:Oe(v.value.group_id),type:gt(v.value.group_id)},null,8,["modelValue","terms","type"])]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",ZN,[n(ct,{"model-value":_t.value,indeterminate:vt.value,onChange:Et},null,8,["model-value","indeterminate"]),o("span",null,f(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",aK,[n(ho,{term:aa.value,"group-type":"options","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ma),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",lK,[n(ft,{type:"primary",size:"small",loading:ee.value,disabled:!aa.value.title.trim()||ee.value,onClick:ze=>ut(ma)},{default:d(()=>[L(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(ft,{size:"small",onClick:He},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[na.value.trim()&&!Oe(v.value.group_id).some(function(ze){return ze.title.toLowerCase()===na.value.trim().toLowerCase()})?(r(),E(ft,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[6]||(oe[6]=ze=>te(na.value))},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(A(u)('Add "%1$s" as new value',na.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",eK,[n(ct,{"model-value":v.value.variants.some(function(Mt){return Ee(Mt,ze.id)}),tabindex:"-1",onClick:oe[4]||(oe[4]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze.id)},null,8,["model-value","onChange"]),o("span",null,f(ze.title),1)])]),_:2},1032,["label","value"]))),128)),(r(!0),h(H,null,ae(De.value,ze=>(r(),E(Pe,{key:ze,label:ze,value:ze},{default:d(()=>[o("div",tK,[n(ct,{"model-value":!0,tabindex:"-1",onClick:oe[5]||(oe[5]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze)},null,8,["onChange"]),o("span",null,f(ze),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text"])):gt(v.value.group_id)==="color"?(r(),h("div",sK,[n(pt,{ref_for:!0,ref:$t,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:ca(v.value),disabled:!v.value.group_id,loading:U.value,"loading-text":A(u)("Loading..."),onKeydownCapture:ze=>lt(ze,ma),onVisibleChange:ke},{empty:d(()=>[o("div",nK,f(A(u)("No matching data")),1)]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",oK,[n(ct,{"model-value":_t.value,indeterminate:vt.value,onChange:Et},null,8,["model-value","indeterminate"]),o("span",null,f(A(u)("Select all")),1)])):B("",!0)]),tag:d(()=>[n(Wi,{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",rK,[n(ho,{term:aa.value,"group-type":"color","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ma),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",dK,[n(ft,{type:"primary",size:"small",loading:ee.value,disabled:!aa.value.title.trim()||ee.value,onClick:ze=>ut(ma)},{default:d(()=>[L(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(ft,{size:"small",onClick:He},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[Ht.value.trim()&&!Ae.value.some(function(ze){return ze.title.toLowerCase()===Ht.value.trim().toLowerCase()})?(r(),E(ft,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[12]||(oe[12]=ze=>Ge())},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(A(u)('Add "%1$s" as new value',Ht.value.trim())),1)]),_:1})):(r(),E(ft,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[13]||(oe[13]=ze=>te(""))},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(Ae.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",iK,[n(ct,{"model-value":v.value.variants.some(function(Mt){return Ee(Mt,ze.id)}),tabindex:"-1",onClick:oe[11]||(oe[11]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze.id)},null,8,["model-value","onChange"]),o("span",{class:"fct-color-dot",style:ra({background:ze.settings&&ze.settings.color?ze.settings.color:""})},null,4),L(" "+f(ze.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):gt(v.value.group_id)==="image"?(r(),h("div",uK,[n(pt,{ref_for:!0,ref:$t,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:ca(v.value),disabled:!v.value.group_id,loading:U.value,"loading-text":A(u)("Loading..."),onKeydownCapture:ze=>lt(ze,ma),onVisibleChange:ke},{empty:d(()=>[o("div",cK,f(A(u)("No matching data")),1)]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",AK,[n(ct,{"model-value":_t.value,indeterminate:vt.value,onChange:Et},null,8,["model-value","indeterminate"]),o("span",null,f(A(u)("Select all")),1)])):B("",!0)]),tag:d(()=>[n(Wi,{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",mK,[n(ho,{term:aa.value,"group-type":"image","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ma),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",hK,[n(ft,{type:"primary",size:"small",loading:ee.value,disabled:!aa.value.title.trim()||ee.value,onClick:ze=>ut(ma)},{default:d(()=>[L(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(ft,{size:"small",onClick:He},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[Ht.value.trim()&&!Ae.value.some(function(ze){return ze.title.toLowerCase()===Ht.value.trim().toLowerCase()})?(r(),E(ft,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[18]||(oe[18]=ze=>te(Ht.value))},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(A(u)('Add "%1$s" as new value',Ht.value.trim())),1)]),_:1})):(r(),E(ft,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:oe[19]||(oe[19]=ze=>te(""))},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(Ae.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",pK,[n(ct,{"model-value":v.value.variants.some(function(Mt){return Ee(Mt,ze.id)}),tabindex:"-1",onClick:oe[17]||(oe[17]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze.id)},null,8,["model-value","onChange"]),o("img",{src:ze.settings&&ze.settings.image?ze.settings.image:"",alt:""},null,8,fK),L(" "+f(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",_K,[n(J,{name:"AlertIcon"}),o("span",null,f(v.value.errors.values),1)])):B("",!0)],2),o("div",vK,[n(ft,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:ze=>W(ma)},{default:d(()=>[L(f(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:re(["fct-option-add-wrap",{"fct-option-add-wrap--empty":l.value.length===0}])},[n(ft,{class:re(["fct-option-add",{"fct-option-add--empty":l.value.length===0}]),size:"small",onClick:Z},{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)),L(" "+f(l.value.length===0?A(u)("Add options like size or color"):A(u)("Add more")),1)]),_:1,__:[28]},8,["class"]),Tt.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)",Ao)},f(A(u)("%1$s combinations",Tt.value)),9,gK)):B("",!0)],2)):B("",!0),(M.value||S.value)&&!i.value?(r(),h("div",yK,[o("span",bK,f($.value),1),o("div",wK,[n(ft,{size:"small",disabled:s.value,onClick:he},{default:d(()=>[L(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(ft,{size:"small",type:"primary",loading:s.value,onClick:N},{default:d(()=>[L(f(A(u)("Save")),1)]),_:1},8,["loading"])])])):B("",!0),Qt.value||Ut.value||dt.value||kt.value?(r(),h("div",CK,[Ut.value?(r(),h("div",kK,[o("span",null,f(A(u)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",Xi)),1)])):dt.value?(r(),h("div",BK,[o("span",null,f(A(u)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Qt.value?(r(),h("div",xK,[o("span",null,f(A(u)("Too many combinations (%1$s). Maximum allowed is %2$s. Remove some option values.",It.value,Ao)),1)])):kt.value?(r(),h("div",SK,[o("span",null,f(A(u)("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",Ji)),1)])):B("",!0)])):B("",!0)]),l.value.some(Kt=>Kt.group_id&&Kt.variants&&Kt.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(SN,{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(Rt,{"append-to-body":!0,modelValue:m.value,"onUpdate:modelValue":oe[23]||(oe[23]=Kt=>m.value=Kt),title:A(u)("Add new attribute term"),onClose:oe[24]||(oe[24]=Kt=>ta.value="")},{default:d(()=>[m.value&&_.value!==null&&v.value?(r(),E(QN,{key:0,"group-id":v.value.group_id,group:a.value.find(Kt=>Ee(Kt.id,v.value.group_id)),"initial-title":ta.value,onIsTermCreatingDone:ba},null,8,["group-id","group","initial-title"])):B("",!0)]),_:1},8,["modelValue","title"]),n(Rt,{"append-to-body":!0,width:"50%",modelValue:g.value,"onUpdate:modelValue":oe[25]||(oe[25]=Kt=>g.value=Kt),title:A(u)("Add new attribute group")},{default:d(()=>[g.value?(r(),E(am,{key:0,onWhenGroupCreateIsDone:ce})):B("",!0)]),_:1},8,["modelValue","title"])])}}},$K={class:"fct-product-pricing-wrap"},EK={class:"w-[150px] fct-select-gray"},UK={key:1,class:"fct-simple-product-actions"},IK={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var p,m;const t=e;T(!1);const a=T((m=(p=t.product)==null?void 0:p.detail)==null?void 0:m.variation_type),l=T(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,$n.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,$n.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 w,k;const y=C("el-option"),v=C("el-select");return r(),h("div",$K,[n(xe,{class:re(((k=(w=e.product)==null?void 0:w.detail)==null?void 0:k.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:d(()=>{var b,x;return[n(Qe,{title:_.$t("Pricing"),border_bottom:""},{action:d(()=>[o("div",EK,[e.product.detail?(r(),E(v,{key:0,size:"small",class:re(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=F=>a.value=F),placeholder:_.$t("Select Variation"),onChange:s},{default:d(()=>[(r(!0),h(H,null,ae(_.appVars.variation_types,(F,M)=>{var $,S;return r(),E(y,{key:M,label:F,value:M,disabled:((S=($=e.product)==null?void 0:$.detail)==null?void 0:S.variation_type)==="advanced_variations"&&M!=="advanced_variations"},null,8,["label","value","disabled"])}),128))]),_:1},8,["class","modelValue","placeholder"])):B("",!0)])]),_:1},8,["title"]),n(Ce,{class:re(((x=(b=e.product)==null?void 0:b.detail)==null?void 0:x.variation_type)==="simple_variations"?"pb-0":"")},{default:d(()=>{var F,M,$,S,I,Q,D,V,U,O,R,P,j,q,z,X,ne;return[((M=(F=e.product)==null?void 0:F.detail)==null?void 0:M.variation_type)==="simple"?(r(),E(Sd,{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),((S=($=e.product)==null?void 0:$.detail)==null?void 0:S.variation_type)==="simple"&&((Q=(I=e.product)==null?void 0:I.variants[0])!=null&&Q.id)?(r(),h("div",UK,[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"]),((V=(D=e.product)==null?void 0:D.detail)==null?void 0:V.variation_type)==="simple"&&(((U=e.product)==null?void 0:U.post_status)==="publish"||((O=e.product)==null?void 0:O.post_status)==="private")&&((P=(R=e.product)==null?void 0:R.variants[0])!=null&&P.id)?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline mt-3",text:((j=_.appVars)==null?void 0:j.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),((z=(q=e.product)==null?void 0:q.detail)==null?void 0:z.variation_type)==="simple_variations"?(r(),E(IO,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0),((ne=(X=e.product)==null?void 0:X.detail)==null?void 0:ne.variation_type)==="advanced_variations"?(r(),E(FK,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},QK={class:"fct-sku-input-wrap"},DK={class:"fct-sku-edit-actions"},ec={__name:"SkuInput",props:{variant:{type:Object,required:!0},productTitle:{type:String,default:""}},emits:["saved"],setup(e,{emit:t}){const a=e,l=t,s=T(a.variant.sku||""),i=T(a.variant.sku||""),c=T(!1),p=T(!1),m=T(!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(w=>{s.value=i.value,l("saved",i.value),c.value=!1,Y.success(w.message)}).catch(w=>{var k;w.status_code=="422"?Y.validationErrors(w):Y.error((k=w.data)==null?void 0:k.message)}).finally(()=>{p.value=!1})},v=()=>{m.value=!0,ue.get("products/suggest-sku",{title:a.productTitle,variant_title:a.variant.variation_title||"",exclude_id:a.variant.id}).then(w=>{i.value=w.sku,c.value=!0}).catch(w=>{var k;Y.error((k=w.data)==null?void 0:k.message)}).finally(()=>{m.value=!1})};return(w,k)=>{const b=C("el-input"),x=C("el-button");return r(),h("div",QK,[n(b,{modelValue:i.value,"onUpdate:modelValue":k[0]||(k[0]=F=>i.value=F),size:"small",placeholder:A(u)("No SKU"),onInput:_,onKeydown:[k[1]||(k[1]=xa(Ne(F=>c.value&&y(),["prevent"]),["enter"])),xa(g,["escape"])]},null,8,["modelValue","placeholder"]),o("div",DK,[c.value?(r(),h(H,{key:0},[n(x,{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(x,{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(x,{key:1,size:"small",class:"fct-sku-suggest-btn",loading:m.value,title:A(u)("Generate SKU"),onClick:v},{default:d(()=>[n(J,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},VK={key:0,class:"fct-product-inventory-wrap"},TK={class:"fct-product-inventory-inner-wrap hide-on-mobile"},MK={key:0,class:"fct-variant-badge fct-variant-badge--light"},LK={class:"fct-inventory-cell-text pl-5"},RK={class:"fct-inventory-cell-text pl-5"},OK={class:"fct-inventory-cell-text pl-5"},HK={class:"fct-product-inventory-inner-wrap-mobile"},PK={class:"fct-product-inventory-mobile-col"},NK={class:"title"},KK={class:"fct-product-inventory-mobile-col"},GK={class:"fct-product-inventory-mobile-col"},jK={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=je.get("modules_settings.stock_management.active"),s=T([]),i=T({}),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":"",m=y=>a.product.detail.variation_type==="simple_variations"&&y.manage_stock==0?"disable_inventory_row":"",_=y=>{let v=parseInt(a.product.variants[y].new_stock);a.product.variants[y].total_stock=v<0?0:v;let w=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=w<0?0:w,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=>{Y.success(k.message)}).catch(k=>{var b;k.status_code=="422"?Y.validationErrors(k):Y.error((b=k.data)==null?void 0:b.message)})},g=y=>{ue.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(v=>{Y.success(v.message),a.product.variants.forEach(w=>{w.manage_stock=y})}).catch(v=>{var w;v.status_code=="422"?Y.validationErrors(v):Y.error((w=v.data)==null?void 0:w.message)})};return(y,v)=>{const w=C("el-switch"),k=C("el-tooltip"),b=C("el-table-column"),x=C("el-input"),F=C("el-table");return A(l)==="yes"?(r(),h("div",VK,[n(xe,{class:"overflow-hidden"},{default:d(()=>{var M,$;return[n(Qe,{class:re(((M=e.product.detail)==null?void 0:M.manage_stock.toString())==="0"?"pb-5":"")},{action:d(()=>{var S;return[(S=e.product.detail)!=null&&S.manage_stock?(r(),E(w,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=I=>e.product.detail.manage_stock=I),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:(($=e.product.detail)==null?void 0:$.manage_stock.toString())==="1",accordion:""},{default:d(()=>[n(Ce,{class:"px-0 pb-0"},{default:d(()=>[o("div",TK,[n(F,{data:e.product.variants,"row-class-name":p},{default:d(()=>[n(b,{label:A(u)("Title"),width:"180"},{default:d(S=>{var I,Q;return[o("div",{class:re(["relative",{"fct-inventory-title-cell--has-badge":((I=S.row.other_info)==null?void 0:I.payment_type)==="subscription"}])},[n(k,{content:S.row.variation_title,placement:"top","show-after":300,disabled:!i.value[`title_${S.$index}`]},{default:d(()=>[o("span",{class:"fct-inventory-cell-text truncate block",ref:D=>c(D,`title_${S.$index}`)},f(S.row.variation_title||"--"),513)]),_:2},1032,["content","disabled"]),((Q=S.row.other_info)==null?void 0:Q.payment_type)==="subscription"?(r(),h("span",MK,f(S.row.other_info.repeat_interval),1)):B("",!0)],2)]}),_:1},8,["label"]),n(b,{label:A(u)("SKU"),width:"220"},{default:d(S=>[n(ec,{variant:S.row,"product-title":e.product.post_title,onSaved:I=>S.row.sku=I},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),n(b,{label:A(u)("Total Stock"),width:"120"},{default:d(S=>[o("div",null,[n(x,{modelValue:S.row.total_stock,"onUpdate:modelValue":I=>S.row.total_stock=I,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:I=>{var Q;return(Q=s.value[S.$index])==null?void 0:Q.toggle()}},{append:d(()=>[n(Vr,{ref:I=>s.value[S.$index]=I,variant:S.row,"field-key":S.$index,"product-edit-model":e.productEditModel,onSave:I=>_(S.$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(b,{label:A(u)("Available"),width:"100"},{default:d(S=>[o("span",LK,f(A(u)(S.row.available)),1)]),_:1},8,["label"]),n(b,{label:A(u)("On hold"),width:"100"},{default:d(S=>[o("span",RK,f(A(u)(S.row.on_hold)),1)]),_:1},8,["label"]),n(b,{label:A(u)("Delivered"),width:"100"},{default:d(S=>[o("span",OK,f(A(u)(S.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",HK,[(r(!0),h(H,null,ae(e.product.variants,(S,I)=>(r(),h("div",{key:I,class:re(["fct-product-inventory-mobile-row",m(S)])},[o("div",PK,[o("div",NK,f(S.variation_title||"--"),1),n(ec,{variant:S,"product-title":e.product.post_title,class:"mt-1 mb-2",onSaved:Q=>S.sku=Q},null,8,["variant","product-title","onSaved"])]),o("div",KK,[n(x,{modelValue:S.total_stock,"onUpdate:modelValue":Q=>S.total_stock=Q,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(Vr,{variant:S,"field-key":I,"product-edit-model":e.productEditModel,onSave:Q=>_(I)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",GK,[o("ul",null,[o("li",null,[o("span",null,f(A(u)("Available"))+":",1),L(" "+f(S.available.toString()),1)]),o("li",null,[o("span",null,f(A(u)("On Hold"))+":",1),L(" "+f(S.on_hold.toString()),1)]),o("li",null,[o("span",null,f(A(u)("Delivered"))+":",1),L(" "+f(S.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):B("",!0)}}},zK={class:"el-form el-form--default el-form--label-top"},Mp={__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=K(()=>Oo(t.product));return Ss(()=>{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"),m=C("el-input");return r(),h("div",zK,[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(Dn)(_,a.value),value:_.id},{default:d(()=>[n(Ho,{variant:_,"group-order":a.value},null,8,["variant","group-order"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),n(oa,{"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(Gc,{isMultiple:!e.singleMode,onOnFileSelected:s[1]||(s[1]=_=>{const g=e.index,y=_;y.forEach((v,w)=>{e.isEditing?(y[w].serial=g+1,y[w].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[g].settings.download_limit,y[w].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[g].settings.download_expiry,y.length>1?(y[w].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file=y[w]):(y[w].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file.file_name=y[w].file_name,e.file.file_path=y[w].file_path,e.file.file_size=y[w].file_size,e.file.file_url=y[w].file_url,e.file.title=y[w].title,e.file.type=y[w].type,e.file.settings=y[w].settings)):(y[w].serial=g+1,y[w].settings.download_limit=e.productDownloadableModel.insertableFiles[g].settings.download_limit,y[w].settings.download_expiry=e.productDownloadableModel.insertableFiles[g].settings.download_expiry,y.length>1?(y[w].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g+w]=y[w]):(y[w].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g]=y[w]))})})},null,8,["isMultiple"]),n(oa,{"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,f(e.file.title),1),B("",!0),n(oa,{"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,f(A(u)("Driver: %s",e.file.driver)),1)]),_:1})):B("",!0)])}}},qK={key:0,class:"text-right"},YK={key:1,class:"px-6 py-3"},WK={class:"fct-product-download-inner-wrap flex flex-col gap-4"},XK={class:"fct-product-download-form-box"},JK={key:1},ZK={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=K(()=>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:re(["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",qK,[n(s,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(a.$t("Add")),1)]),_:1})])):(r(),h("div",YK,f(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(pa,{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(()=>[L(f(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(()=>[L(f(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:d(()=>[o("div",WK,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(H,{key:0},ae(e.productDownloadableModel.insertableFiles,(c,p)=>(r(),h("div",XK,[e.productDownloadableModel.insertableFiles.length>1?(r(),E(s,{key:0,onClick:m=>e.productDownloadableModel.deleteInsertableFile(p),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])):B("",!0),n(Mp,{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",JK,[n(Gc,{uploadBtnText:A(u)("Add More Files"),onOnFileSelected:l[1]||(l[1]=c=>{const p=e.productDownloadableModel.insertableFiles.length-1,m=c;m.value.forEach((_,g)=>{m.value[g].serial=p+1,m.value[g].settings.download_limit=e.productDownloadableModel.insertableFiles[p].settings.download_limit,m.value[g].settings.download_expiry=e.productDownloadableModel.insertableFiles[p].settings.download_expiry,m.value[g].product_variation_id=e.productDownloadableModel.insertableFiles[p].product_variation_id,e.productDownloadableModel.insertableFiles.push(m.value[g])})})},null,8,["uploadBtnText"])])):B("",!0),(r(!0),h(H,null,ae(e.product.variants,(c,p)=>(r(),h("div",{key:p},[n(oa,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${p}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},eG={class:"fct-product-download-form-wrap"},tG={class:"fct-product-download-form-box"},aG={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=K(()=>window.innerWidth<=768?"90%":"40%"),l=T({...t.productDownloadable}),s=t.productDownloadableModel.data.editModal.states;return Ss(()=>{s[t.index]={},s[t.index].visible=!1}),(i,c)=>{const p=C("el-button"),m=C("el-drawer");return r(),h(H,null,[n(m,{"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(()=>[L(f(A(u)("Update")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",eG,[o("div",tG,[n(Mp,{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"}),L(" "+f(A(u)("Edit")),1)])],64)}}},lG={class:"fct-product-download-wrap"},sG={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},nG={class:"fct-media-content-list"},oG={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},iG={class:"product-details"},rG={class:"product-details-content-row"},dG={class:"product-details-content-first"},uG={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},cG={key:0,class:"font-normal text-system-mid"},AG={class:"product-variation-title inline-flex"},pG={key:1,class:"product-variation-title"},fG={class:"product-details-content-second"},mG={class:"more-btn"},hG={__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=>{Yl.copy(i.url)}).catch(i=>{Y.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"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",lG,[n(xe,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",sG,[o("div",nG,[(r(!0),h(H,null,ae(e.productDownloadableModel.downloadableFiles,(v,w)=>(r(),h("div",{class:"fct-media-content-list-item",key:w},[o("div",oG,f(v.type),1),o("div",iG,[o("div",rG,[o("div",dG,[o("div",uG,[L(f(v.title)+" ",1),v.driver!=="local"?(r(),h("span",cG," - "+f(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",AG," – "+f(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,b)=>(r(),h("div",{style:{"margin-top":"4px"},key:b},f(k),1))),128))]),_:2},1024)):(r(),h("div",pG," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",fG,[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(m,{class:"item-link"},{default:d(()=>[n(aG,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:w},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),n(m,{command:{action:"copy-download-link",data:v}},{default:d(()=>[n(J,{name:"Copy"}),L(" "+f(A(u)("Copy Download Link")),1)]),_:2},1032,["command"]),n(m,{command:{action:"delete",data:v,idx:w},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",mG,[n(J,{name:"More"})])]),_:2},1024)])])])]))),128))])])):B("",!0),n(ZK,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},_G={class:"fct-product-status-wrap"},vG={class:"fct-admin-summary-item-list"},gG={class:"fct-admin-summary-item"},yG={class:"fct-admin-summary-item-title"},bG={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},wG={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},CG={key:0,style:{"margin-top":"20px"}},kG={class:"title"},BG={key:1},xG={class:"text-sm text-gray-500 mt-4"},SG={class:"capitalize"},FG={key:1},$G={class:"fct-admin-summary-item"},EG={class:"fct-admin-summary-item-title flex items-center gap-1"},UG=["href"],IG={class:"fct-product-url-slug-container"},QG={class:"filter-popover-item fct-admin-summary-popover-item"},DG={class:"filter-popover-title"},VG={class:"filter-popover-input-group"},TG={class:"fct-product-url-label"},MG=["href"],LG={class:"fct-product-url-slug"},RG={key:0,class:"fct-admin-summary-item"},OG={class:"fct-admin-summary-item-title"},HG={class:"fct-admin-summary-item-select"},PG={key:1,class:"fct-admin-summary-item"},NG={class:"fct-admin-summary-item-title"},KG={key:0,class:"fct-admin-summary-item-select"},GG={key:0,class:"mt-4 pt-4"},tc={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T(""),l=T(""),s=T(""),i=T(!1),c=v=>Dn(v,Oo(t.product))||v.variation_title;be(()=>{var v,w,k;return[(w=(v=t.product)==null?void 0:v.detail)==null?void 0:w.default_variation_id,(k=t.product)==null?void 0:k.variants]},([v,w])=>{var x;if(!v||!((x=t.product)!=null&&x.detail))return;(Array.isArray(w)?w:[]).some(F=>String(F.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>"),m=()=>t.product.variants.filter(w=>w.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,w)=>{const k=C("el-radio"),b=C("el-radio-group"),x=C("el-date-picker"),F=C("el-button"),M=C("el-popover"),$=C("el-input"),S=C("el-option"),I=C("el-select"),Q=C("el-checkbox");return r(),h("div",_G,[n(xe,null,{default:d(()=>[n(Qe,{title:A(u)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>{var D,V;return[o("ul",vG,[o("li",gG,[o("span",yG,[n(pa,{title:A(u)("Status"),content:g()},null,8,["title","content"])]),o("div",bG,[m()?(r(),E(M,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:d(()=>[m()?(r(),E(F,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",SG,f(e.product.post_status==="future"?A(u)("Scheduled"):e.product.post_status),1),n(J,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",FG,f(A(da).headline(e.product.post_status)),1))]),default:d(()=>[o("div",wG,[n(b,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":w[0]||(w[0]=U=>e.product.post_status=U),onChange:_},{default:d(()=>[n(k,{value:"draft"},{default:d(()=>[L(f(A(u)("Draft")),1)]),_:1}),n(k,{value:"future"},{default:d(()=>[L(f(A(u)("Scheduled")),1)]),_:1}),n(k,{value:"private"},{default:d(()=>[L(f(A(u)("Private (Invisible except Admin)")),1)]),_:1}),n(k,{value:"publish"},{default:d(()=>[L(f(A(u)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",CG,[o("h3",kG,f(A(u)("Scheduled Date")),1),n(x,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":w[1]||(w[1]=U=>e.product.post_date=U),type:"datetime",placeholder:A(u)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:w[2]||(w[2]=U=>{e.productEditModel.onChangeInputField("post_date",U)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",BG,[o("p",xG,f(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",$G,[o("span",EG,[L(f(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,UG)]),o("div",IG,[n(M,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:d(()=>[n(F,{type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",null,f(e.product.post_name),1),n(J,{name:"ChevronUpDown"})]),_:1})]),default:d(()=>[o("div",QG,[o("h3",DG,f(A(u)("URL")),1),o("div",VG,[n(pa,{title:A(u)("Permalink"),content:A(p),hideAfter:300},null,8,["title","content"]),n($,{placeholder:A(u)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":w[3]||(w[3]=U=>e.product.post_name=U),onInput:w[4]||(w[4]=U=>{e.productEditModel.onChangeInputField("post_name",U)})},null,8,["placeholder","modelValue"])]),o("div",TG,f(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",LG,f(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,MG)])]),_:1})])]),((D=e.product.detail)==null?void 0:D.variation_type)==="simple_variations"||((V=e.product.detail)==null?void 0:V.variation_type)==="advanced_variations"?(r(),h("li",RG,[o("span",OG,[n(pa,{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",HG,[n(I,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":w[5]||(w[5]=U=>e.product.detail.default_variation_id=U),placeholder:A(u)("Select Default Variant"),onChange:w[6]||(w[6]=U=>{e.productEditModel.onChangeInputField("default_variation_id",U)}),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,U=>(r(),E(S,{key:U.id,label:c(U),value:U.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",PG,[o("span",NG,[n(pa,{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",KG,[n(I,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":w[7]||(w[7]=U=>e.product.detail.other_info.group_pricing_by=U),placeholder:A(u)("Pricing Table Layout"),onChange:w[8]||(w[8]=U=>{e.productEditModel.onChangeInputField("group_pricing_by",U)})},{default:d(()=>[n(S,{label:A(u)("Payment Term"),value:"payment_type"},null,8,["label"]),n(S,{label:A(u)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),n(S,{label:A(u)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):B("",!0)])):B("",!0)]),e.product.detail?(r(),h("div",GG,[n(Q,{onChange:w[9]||(w[9]=U=>{e.productEditModel.onChangeInputField("sold_individually",U)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":w[10]||(w[10]=U=>e.product.detail.other_info.sold_individually=U),"true-value":"yes","false-value":"no"},{default:d(()=>[L(f(A(u)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"])])):B("",!0)]}),_:1})]),_:1})])}}},jG={class:"fct-product-media-wrap"},zG={class:"fct-admin-summary-item"},ac={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",jG,[n(xe,null,{default:d(()=>[n(Qe,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",zG,[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})]))}},qG={class:"fct-term-input-item"},YG={class:"el-tag__content"},WG=["innerHTML"],XG=["innerHTML"],JG={class:"pt-1.5 text-right"},ZG={class:"relative w-3 h-3"},ej={class:"fct-term-add-input-wrap"},tj={__name:"TermInput",props:{modelValue:Array,taxonomy:Object,product_id:Number},emits:["update:modelValue","onChanged"],setup(e,{emit:t}){qt().ctx;const a=e,l=t,s=T([]),i=T(!1),c=T(),p=T(""),m=T([]),_=T(""),g=T(!1);Ie(()=>{s.value=a.modelValue,m.value=a.taxonomy.terms,be(()=>a.taxonomy.terms,(I,Q)=>{m.value=I}),be(()=>a.modelValue,(I,Q)=>{g.value=!0,s.value=I})});const y=I=>{I.stopPropagation(),I.preventDefault(),x()},v=()=>{g.value&&ue.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(I=>{Y.success(I.message),l("update:modelValue",s.value)}).catch(I=>{var Q;I.status_code=="422"?Y.validationErrors(I):Y.error((Q=I.data)==null?void 0:Q.message)}).finally(()=>{g.value=!1})},w=ld.debounce(I=>{b(I)},1200),k=()=>{l("update:modelValue",s.value)},b=I=>{g.value=!1,ue.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:I}).then(Q=>{Js(Q.message),l("update:modelValue",s.value)}).catch(Q=>{var D;Q.status_code=="422"?Y.validationErrors(Q):Y.error((D=Q.data)==null?void 0:D.message)}).finally(()=>{g.value=!1})};[...s.value];const x=()=>{g.value=!0,ue.post("products/add-product-terms",{term:{name:p.value,taxonomy:a.taxonomy.name,parent:_.value}}).then(I=>{i.value=!1,p.value="",I.term_ids.forEach(function(Q,D){m.value.push({value:Q,label:I.names[D]}),s.value.push(Q)}),v()}).catch(I=>{})},F=()=>{i.value=!i.value,i.value&&Be(()=>{c.value.focus()})},M={categories:"Category",types:"Type"};K(()=>{let I=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(M).forEach(Q=>{I.toLowerCase().includes(Q)&&(I=I.replace(new RegExp(Q,"i"),M[Q]))}),I});const $=I=>{const Q=s.value.indexOf(I);Q>-1&&s.value.splice(Q,1),g.value=!1,w(I)},S=I=>{const Q=D=>{for(const V of D){if(V.value==I)return V.label;if(V.children&&V.children.length>0){const U=Q(V.children);if(U)return U}}return null};return Q(m.value)};return(I,Q)=>{const D=C("el-tag"),V=C("el-tree-select"),U=C("el-button"),O=C("el-input");return r(),h("div",qG,[n(V,{modelValue:s.value,"onUpdate:modelValue":Q[0]||(Q[0]=R=>s.value=R),data:m.value,multiple:"","render-after-expand":!1,"show-checkbox":"","check-strictly":"","check-on-click-node":"",onCheck:Q[1]||(Q[1]=()=>{g.value=!0}),onBlur:v,onChange:k,onRemoveTag:Q[2]||(Q[2]=R=>{g.value=!1,A(w)(R)})},{tag:d(()=>[(r(!0),h(H,null,ae(s.value,(R,P)=>(r(),E(D,{key:P,closable:"",onClose:j=>$(R)},{default:d(()=>[o("span",YG,[o("span",{class:"el-select__tags-text",innerHTML:S(R)},null,8,WG)])]),_:2},1032,["onClose"]))),128))]),default:d(({data:R})=>[o("span",{innerHTML:R.label},null,8,XG)]),_:1},8,["modelValue","data"]),o("div",JG,[n(U,{text:"",onClick:F,size:"small"},{default:d(()=>[o("span",ZG,[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"])]),L(" "+f(A(u)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),n(va,{visible:i.value,accordion:""},{default:d(()=>[o("div",ej,[n(O,{modelValue:p.value,"onUpdate:modelValue":Q[3]||(Q[3]=R=>p.value=R),ref_key:"inputRef",ref:c,onKeydown:xa(y,["enter"])},null,8,["modelValue"]),n(U,{type:"info",plain:"",onClick:x,class:"el-button--x-small"},{default:d(()=>[L(f(A(u)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},aj={class:"fct-product-simple-wrap"},lj={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",aj,[n(xe,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,f(l.labels.name),1),n(tj,{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 sj extends nl{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=Oo(l),c=l.variants.reduce((m,_)=>(m[_.id]=Dn(_,i),m),{}),p=s.map(m=>c[m]).filter(Boolean);return p.length===0?"--":p.length===1?p[0]:`${p[0]} +${p.length-1}`});Re(this,"deleteDownloadableFile",(a,l)=>{$n.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(()=>{Y.success(u("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(l,1)}).catch(s=>{Y.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(),Y.success(u("Variations Synced Successfully"))}).catch(l=>{this.setSaving(!1),l.status_code=="422"?this.setValidationError(l.data):Y.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=Oo(l),c=l.variants.reduce((m,_)=>(m[_.id]=Dn(_,i),m),{});return s.map(m=>c[m]).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),Y.success(s.message),this.downloadableFiles[l]={...a},this.syncToSourceProduct()}).catch(s=>{s.hasOwnProperty("message")?Y.error(s.message):Y.error(u("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function nj(){return sj.init()}const oj={class:"fct-product-simple-wrap"},ij={class:"flex items-center gap-1 justify-between w-full"},rj={class:"fct-shipping-class-select-wrap relative"},dj={class:"fct-select-option-with-leftright-value"},uj={class:"text-sm text-gray-500"},cj={class:"pt-1.5 text-right"},Aj={key:0},pj={class:"mb-0 mt-2"},fj={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T(rt.get(t,"product.detail.other_info.shipping_class")),l=T(),s=T(!1),i=T(!1),c=T([]),p=je.get("admin_url")+"settings/shipping/shipping_classes",m=(k="")=>{i.value=!0,c.value=[],ue.get("shipping/classes",{search:k}).then(b=>{c.value=b.shipping_classes.data,g()}).finally(()=>{i.value=!1})},_=k=>{m(),k.id&&(a.value=k.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const k=rt.where(c.value,"id",a.value);l.value=rt.get(k,"0")},y=()=>{s.value=!0},v=()=>{a.value&&ue.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(k=>{Y.success(k.message)}).catch(k=>{var b;k.status_code=="422"?Y.validationErrors(k):Y.error((b=k.data)==null?void 0:b.message)})},w=()=>{ue.post("products/"+t.product.ID+"/shipping-class/remove").then(k=>{Y.success(k.message)}).catch(k=>{var b;k.status_code=="422"?Y.validationErrors(k):Y.error((b=k.data)==null?void 0:b.message)})};return Ie(()=>{m()}),(k,b)=>{const x=C("el-option"),F=C("el-select"),M=C("el-button");return r(),h("div",oj,[n(xe,null,{default:d(()=>[n(Qe,{border_bottom:""},{default:d(()=>[o("div",ij,[n(pa,{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",rj,[n(F,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=$=>a.value=$),remote:"",placeholder:A(u)("Search Shipping Class"),"remote-method":m,loading:i.value,filterable:"",clearable:"",onChange:v,onClear:w,"popper-class":"fct-shipping-class-select"},{default:d(()=>[(r(!0),h(H,null,ae(c.value,$=>(r(),E(x,{key:$.id,label:$.name,value:$.id},{default:d(()=>[o("div",dj,[L(f($.name)+" ",1),o("span",uj,f($.type==="percentage"?$.cost+"%":A(et).formatNumber($.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",cj,[n(M,{onClick:Ne(y,["stop"]),size:"small",text:""},{default:d(()=>[n(J,{name:"Plus",class:"w-3 h-3"}),L(" "+f(A(u)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),h("div",Aj,[o("p",pj,f(A(u)("Cost: %s",l.value.type==="percentage"?l.value.cost+"%":A(et).formatNumber(l.value.cost*100,!0))),1)])):B("",!0)]),_:1})]),_:1}),n(Zf,{modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=$=>s.value=$),onSaved:_},null,8,["modelValue"])])}}},mj={key:0,class:"fct-product-inventory-wrap"},hj={class:"fct-product-inventory-inner-wrap hide-on-mobile"},_j={class:"space-x-5"},vj={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"},gj={key:1},yj={class:"fct-card-header-title"},bj={class:"fct-product-inventory-pro-text"},wj={class:"m-0"},Cj={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=je.get("app_config.isProActive"),s=T([]);Ie(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){p()}),p()});const i=(m,_)=>{ue.post(`products/save-bundle-info/${m}`,{bundle_child_ids:_}).then(g=>{Y.success(u("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?Y.validationErrors(g):Y.error(g==null?void 0:g.message)})},c=T(!0),p=()=>{c.value=!0,ue.get(`products/get-bundle-info/${a.product.ID}`).then(m=>{s.value=m,c.value=!1})};return(m,_)=>{const g=C("el-table-column"),y=C("el-table");return A(l)?(r(),h("div",mj,[n(xe,{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",hj,[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 w;return[o("div",_j,[o("span",null,f(v.row.variation_title),1),((w=v.row.other_info)==null?void 0:w.payment_type)==="subscription"?(r(),h("span",vj,f(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(Kc,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":w=>v.row.bundle_child_ids=w,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:w=>{w||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",gj,[n(xe,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h2",yj,[L(f(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",bj,[o("p",wj,f(A(u)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},kj={class:"fct-edit-product-wrapper fct-layout-width"},Bj={class:"fct-btn-group sm"},xj={class:"hide-on-mobile"},Sj={class:"show-on-mobile"},Fj=["href"],$j={key:1,class:"single-page-body"},Ej=["innerHTML"],Uj={class:"fct-product-edit"},Ij={class:"fct-product-main"},Qj={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},Dj={class:"fct-product-aside"},Vj={class:"el-form el-form--default el-form--label-top"},Tj={key:1},Mj={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=T(),l=_M();let s=null;const i=nj();l.setProductDownloadableModel(i);const c=T(!1),p=w=>{var k,b;c.value=!1,l.setProduct(w),s=l.data.product,i.setDownloadableFiles(w.downloadable_files,w),s.gallery=((b=(k=s==null?void 0:s.detail)==null?void 0:k.gallery_image)==null?void 0:b.meta_value)??[],s.taxonomies=t.taxonomies,s.product_terms={},Object.keys(s.taxonomies).map(x=>{s.product_terms[x]=s[x]??[]}),l.saveSnapshot(),c.value=!0};vM().onSave(()=>{var w;l.data.metaValue=(w=a.value)==null?void 0:w.getFormStates(),l.update()});const _=ps();_.bind(["mod+s"],w=>{var k;w.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=w=>{w==="delete"&&l.delete()};jr("triggerChange",g);const v=Gr("reload");return be(()=>t.product,(w,k)=>{w!==k&&p(w)}),Ie(()=>{p(t.product),l.setReloader(v);const w=document.querySelector(".fct-admin-product-header");w&&document.querySelector("#fluent_cart_plugin_app").prepend(w),l.addOnProductUpdatedListener("formreset",function(){var k;(k=a.value)==null||k.resetForms()})}),Fc(()=>{_.unbind("mod+s")}),(w,k)=>{const b=C("el-button"),x=C("el-dropdown-item"),F=C("el-dropdown-menu"),M=C("el-dropdown");return r(),h("div",kj,[(r(),E(Xo,{to:"#fct-admin-product-header-buttons"},[o("div",Bj,[n(M,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:d(()=>[n(F,null,{default:d(()=>[n(x,{command:"preview",class:"item-link"},{default:d(()=>[o("a",{href:A(l).viewUrl(),target:"_blank"},[n(J,{name:"Eye"}),L(" "+f(A(u)("Preview")),1)],8,Fj)]),_:1}),n(x,{command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(A(u)("Delete")),1)]),_:1})]),_:1})]),default:d(()=>[n(b,null,{default:d(()=>[o("span",xj,[L(f(A(u)("More Actions"))+" ",1),n(J,{name:"ChevronDown"})]),o("span",Sj,[n(J,{name:"More"})])]),_:1})]),_:1})])])),c.value?(r(),E(sn,{key:0,isActive:A(l).data.hasChange?"is-active":"",loading:A(l).data.saving,onDiscard:A(l).discard,onSave:k[0]||(k[0]=()=>{var $;A(l).data.metaValue=($=a.value)==null?void 0:$.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",$j,[A(l).shouldShowShippingMethodAlert()?(r(),E(Ja,{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,Ej)]),_:1})):B("",!0),A(l).isInDraft()?(r(),E(Ja,{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",Uj,[o("div",Ij,[n(RM,{product:A(s),productEditModel:A(l),reload:A(v)},null,8,["product","productEditModel","reload"]),o("div",Qj,[(r(),E(tc,{key:A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(ac,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])]),n(IK,{product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]),n(jK,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).isBundleProduct()?(r(),E(Cj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):B("",!0),A(l).isBundleProduct()?B("",!0):(r(),E(hG,{key:1,product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",Dj,[o("div",Vj,[(r(),E(tc,{class:"fct-hide-on-tablet",key:"aside-"+A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(ac,{class:"fct-hide-on-tablet",product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),n(lj,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).hasPhysicalVariation()?(r(),E(fj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):B("",!0),A(s)?(r(),h("div",Tj,[n(rn,{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)])}}},Lj={class:"fct-upgrade-path-drawer-content"},Rj={class:"fct-form-group"},Oj={class:"fct-form-group"},Hj={class:"fct-form-group"},Pj={class:"fct-form-group"},Nj={__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=T(!1),c=()=>{i.value=!0},p={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},m=T({...p}),_=T({}),g=je.get("shop.currency_sign"),y=()=>{_.value={};const k={...m.value};(!Array.isArray(k.to_variants)||k.to_variants.length===0)&&(k.to_variants=[]),ue.post(`products/${l.productId}/upgrade-path`,{...k}).then(b=>{Y.success(b.message),m.value={...p},i.value=!1,s("pathGenerated")}).catch(b=>{if(_.value=b,b.message)return Y.error(b.message)})},v=()=>m.value.from_variant?l.allVariants.filter(k=>{var b,x;return!((b=l.existingUpgradePathMap[m.value.from_variant])!=null&&b.includes(k.id)||(x=l.existingUpgradePathMap[m.value.from_variant])!=null&&x.includes(k.id.toString()))&&k.id!==m.value.from_variant}):[],w=k=>{let b=k==null?void 0:k.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),m.value.discount_amount=b};return t({openModal:c}),(k,b)=>{const x=C("el-option"),F=C("el-select"),M=C("el-checkbox"),$=C("el-input"),S=C("el-button"),I=C("el-drawer");return r(),E(I,{title:A(u)("Add Upgrade Path"),modelValue:i.value,"onUpdate:modelValue":b[5]||(b[5]=Q=>i.value=Q),onClosed:b[6]||(b[6]=()=>{i.value=!1,m.value={...p}}),"append-to-body":"",class:re(A(Ve).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:d(()=>[n(S,{onClick:b[4]||(b[4]=Q=>i.value=!1)},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(S,{onClick:y,type:"primary"},{default:d(()=>[L(f(A(u)("Save")),1)]),_:1})]),default:d(()=>[o("div",Lj,[o("div",Rj,[o("label",null,f(A(u)("From Plan")),1),n(F,{modelValue:m.value.from_variant,"onUpdate:modelValue":b[0]||(b[0]=Q=>m.value.from_variant=Q),placeholder:A(u)("Select"),"popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,ae(e.pathOptions,Q=>(r(),E(x,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:m.value.to_variants.includes(Q.id)},{default:d(()=>[n(Ho,{variant:Q},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),_.value.hasOwnProperty("from_variant")?(r(),E(oa,{key:0,"validation-errors":_.value,"field-key":"from_variant"},null,8,["validation-errors"])):B("",!0)]),o("div",Oj,[o("label",null,f(A(u)("To Plan(s)")),1),n(F,{disabled:!m.value.from_variant,modelValue:m.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=Q=>m.value.to_variants=Q),multiple:"",placeholder:A(u)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,ae(v(),Q=>(r(),E(x,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:Q.id==m.value.from_variant},{default:d(()=>[n(Ho,{variant:Q},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),_.value.hasOwnProperty("to_variants")?(r(),E(oa,{key:0,"validation-errors":_.value,"field-key":"to_variants"},null,8,["validation-errors"])):B("",!0)]),o("div",Hj,[n(M,{"true-value":"1","false-value":"0",modelValue:m.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=Q=>m.value.is_prorate=Q)},{default:d(()=>[L(f(A(u)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",Pj,[o("label",null,f(A(u)("Discount Amount")),1),n($,{modelValue:m.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=Q=>m.value.discount_amount=Q),type:"number",min:0,onInput:w},{prepend:d(()=>[L(f(A(g)),1)]),_:1},8,["modelValue"]),_.value.hasOwnProperty("discount_amount")?(r(),E(oa,{key:0,"validation-errors":_.value,"field-key":"discount_amount"},null,8,["validation-errors"])):B("",!0)])])]),_:1},8,["title","modelValue","class"])}}},Kj={class:"fct-upgrade-path-drawer-content"},Gj={class:"fct-form-group"},jj={class:"text"},zj={class:"fct-form-group"},qj={class:"fct-form-group"},Yj={class:"fct-form-group"},lc={__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=T({...a.existingUpgradePathMap}),s=t,i=T(!1),c={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},p=T({...c}),m=T({}),_=()=>{m.value={};const w={...p.value};(!Array.isArray(w.to_variants)||w.to_variants.length===0)&&(w.to_variants=[]),ue.post(`products/upgrade-path/${a.pathId}/update`,{...w}).then(k=>{Y.success(k.message),p.value={...c},i.value=!1,s("pathGenerated")}).catch(k=>{if(m.value=k,k.message)return Y.error(k.message)})},g=()=>p.value.from_variant?a.allVariants.filter(w=>{var k,b;return!((k=l[p.value.from_variant])!=null&&k.includes(w.id)||(b=l[p.value.from_variant])!=null&&b.includes(w.id.toString()))&&w.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 w of a.preSelectedToVariants)p.value.to_variants.push(parseInt(w))},v=w=>{let k=w==null?void 0:w.toString().replace(/^0+(?=\d)/,"");k===""&&(k="0"),parseInt(k)<0&&(k="0"),p.value.discount_amount=k};return Ss(()=>{y()}),(w,k)=>{const b=C("el-option"),x=C("el-select"),F=C("el-checkbox"),M=C("el-input"),$=C("el-button"),S=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(S,{modelValue:i.value,"onUpdate:modelValue":k[5]||(k[5]=I=>i.value=I),title:w.$t("Update Upgrade Path"),onClosed:k[6]||(k[6]=()=>{i.value=!1,p.value={...c}}),onOpen:y,"append-to-body":""},{footer:d(()=>[n($,{onClick:k[4]||(k[4]=I=>i.value=!1),size:"small"},{default:d(()=>[L(f(w.$t("Cancel")),1)]),_:1}),n($,{onClick:_,size:"small",type:"primary"},{default:d(()=>[L(f(w.$t("Update")),1)]),_:1})]),default:d(()=>[o("div",Kj,[o("div",Gj,[o("label",null,f(w.$t("From Plan")),1),o("div",jj,f(e.fromName),1)]),o("div",zj,[o("label",null,f(w.$t("To Plan(s)")),1),n(x,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":k[1]||(k[1]=I=>p.value.to_variants=I),multiple:"",placeholder:w.$t("Select"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(g(),I=>(r(),E(b,{key:I.id,label:I.variation_title,value:I.id,disabled:I.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),m.value.hasOwnProperty("to_variants")?(r(),E(oa,{key:0,"validation-errors":m.value,"field-key":"to_variants"},null,8,["validation-errors"])):B("",!0)]),o("div",qj,[n(F,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":k[2]||(k[2]=I=>p.value.is_prorate=I)},{default:d(()=>[n(pa,{class:"flex items-center",title:w.$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.
153 `},null,8,["title"])]),_:1},8,["modelValue"])]),o("div",Yj,[o("label",null,f(w.$t("Discount Amount")),1),n(M,{modelValue:p.value.discount_amount,"onUpdate:modelValue":k[3]||(k[3]=I=>p.value.discount_amount=I),type:"number",min:"0",onInput:v},null,8,["modelValue"]),m.value.hasOwnProperty("discount_amount")?(r(),E(oa,{key:0,"validation-errors":m.value,"field-key":"discount_amount"},null,8,["validation-errors"])):B("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},Wj={__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})}}},Xj={class:"fct-upgrade-paths-wrap fct-layout-width"},Jj={class:"grid gap-1"},Zj={class:"text-system-dark dark:text-gray-50"},ez={class:"text-xs text-system-mid dark:text-gray-300"},tz={class:"flex gap-1 flex-wrap"},az={key:0},lz={key:1},sz={class:"fct-btn-group sm"},nz={key:2,class:"fct-upgrade-paths-mobile"},oz={class:"from-plan"},iz={class:"title"},rz={class:"plan-title"},dz={key:0,class:"plan-billing-summary"},uz={class:"to-plan"},cz={class:"title"},Az={class:"discount-amount"},pz={class:"title"},fz={key:0},mz={key:1},hz={class:"is-prorate"},_z={class:"title"},vz={class:"path-actions"},gz={class:"title"},yz={class:"fct-btn-group sm mt-3"},bz={key:0,class:"py-6 text-center"},wz={key:1},Cz={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},kz={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},Bz={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=K(()=>rt.get(t.product,"detail.other_info.is_bundle_product")==="yes"),l=T(!1),s=T(null);T([]),T({status:"yes",paths:{}});const i=je.get("app_config.isProActive"),c=T([]),p=K(()=>t.product.variants.filter(x=>{var M;return(((M=w.value[x.id])==null?void 0:M.length)||0)<v.value-1})),m=x=>{_()},_=async()=>{l.value=!0,ue.get(`products/${t.product_id}/upgrade-paths`).then(function(x){c.value=x.data,k()}).catch(function(x){}).finally(()=>{l.value=!1})},g=T({}),y=T({}),v=T(rt.get(t.product,"variants",[]).length),w=T({}),k=()=>{t.product.variants.entries().forEach(([x,F])=>{g.value[F.id]=F.variation_title,y.value[F.id]=F.other_info.billing_summary}),w.value={},c.value.forEach(x=>{w.value.hasOwnProperty(x.object_id)?(w.value[x.object_id]=[...w.value[x.object_id].concat([...x.meta_value.to_variants])],w.value[x.object_id]=[...new Set(w.value[x.object_id])]):w.value[x.object_id]=[...x.meta_value.to_variants]})},b=x=>{ue.delete(`products/upgrade-path/${x}/delete`).then(function(F){_(),Y.success(F.message)}).catch(function(F){})};return Ie(()=>{_();const x=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");x&&document.querySelector("#fluent_cart_plugin_app").prepend(x)}),(x,F)=>{const M=C("el-table-column"),$=C("el-tag"),S=C("el-table"),I=C("el-button");return r(),h(H,null,[o("div",Xj,[n(A(xe),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(Wj,{key:0})):B("",!0),l.value?B("",!0):(r(),E(S,{key:1,class:"hide-on-mobile",data:c.value},{empty:d(()=>[L(f(A(u)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:d(()=>[n(M,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(Q=>[o("div",Jj,[o("div",Zj,f(A(rt).get(g.value,Q.row.object_id,"")),1),o("div",ez,f(A(rt).get(y.value,Q.row.object_id,"")),1)])]),_:1},8,["label"]),n(M,{label:A(u)("To Plan"),width:200},{default:d(Q=>[o("div",tz,[(r(!0),h(H,null,ae(A(rt).get(Q.row,"meta_value.to_variants",[]),D=>(r(),h(H,{key:D},[A(rt).get(g.value,D)?(r(),E($,{key:0},{default:d(()=>[L(f(A(rt).get(g.value,D)),1)]),_:2},1024)):B("",!0)],64))),128))])]),_:1},8,["label"]),n(M,{label:A(u)("Discount Amount"),width:110},{default:d(Q=>[Q.row.meta_value.discount_amount>0?(r(),h("span",az,f(A(rt).get(Q.row,"meta_value.discount_amount","0")),1)):(r(),h("span",lz,"--"))]),_:1},8,["label"]),n(M,{label:A(u)("Is Prorate"),width:100},{default:d(Q=>[L(f(A(rt).get(Q.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),n(M,{width:100},{default:d(Q=>[o("div",sz,[n(lc,{pathId:Q.row.id,preSelectedToVariants:A(rt).get(Q.row,"meta_value.to_variants",[]),preSelectedIsProrate:A(rt).get(Q.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(rt).get(Q.row,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:w.value,fromName:A(rt).get(g.value,Q.row.object_id,""),preSelectedFromVariant:Q.row.object_id,onPathGenerated:m},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(Ze,{size:"x-small",tag:"button",outline:"",onClick:()=>b(Q.row.id)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?B("",!0):(r(),h("div",nz,[(r(!0),h(H,null,ae(c.value,(Q,D)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:D},[o("div",oz,[o("div",iz,f(A(u)("From Plan"))+": ",1),o("div",null,[o("div",rz,f(A(rt).get(g.value,Q.object_id,"")),1),A(rt).get(y.value,Q.object_id,"")?(r(),h("div",dz,f(A(rt).get(y.value,Q.object_id,"")),1)):B("",!0)])]),o("div",uz,[o("div",cz,f(A(u)("To Plan"))+": ",1),(r(!0),h(H,null,ae(A(rt).get(Q,"meta_value.to_variants",[]),V=>(r(),h(H,{key:V},[A(rt).get(g.value,V)?(r(),E($,{key:0},{default:d(()=>[L(f(A(rt).get(g.value,V)),1)]),_:2},1024)):B("",!0)],64))),128))]),o("div",Az,[o("div",pz,f(A(u)("Discount Amount"))+": ",1),Q.meta_value.discount_amount>0?(r(),h("span",fz,f(A(rt).get(Q,"meta_value.discount_amount","0")),1)):(r(),h("span",mz,"--"))]),o("div",hz,[o("div",_z,f(A(u)("Is Prorate"))+": ",1),o("span",null,f(A(rt).get(Q,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),o("div",vz,[o("div",gz,f(A(u)("Actions"))+": ",1),o("div",yz,[n(lc,{pathId:Q.id,preSelectedToVariants:A(rt).get(Q,"meta_value.to_variants",[]),preSelectedIsProrate:A(rt).get(Q,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(rt).get(Q,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:w.value,fromName:A(rt).get(g.value,Q.object_id,""),preSelectedFromVariant:Q.object_id,onPathGenerated:m},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(Ze,{size:"x-small",tag:"button",outline:"",onClick:()=>b(Q.id)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),c.value.length==0?(r(),h("div",bz,f(A(u)("No upgrade paths found.")),1)):B("",!0)]))]),_:1}),l.value?B("",!0):(r(),E(A(sd),{key:0},{default:d(()=>[p.value.length?(r(),E(I,{key:0,text:"",onClick:F[0]||(F[0]=()=>{var Q;return(Q=s.value)==null?void 0:Q.openModal()})},{default:d(()=>[n(J,{name:"Plus"}),L(" "+f(A(u)("Add Path")),1)]),_:1})):(r(),h("span",wz,f(A(u)("No more upgrade paths available")),1))]),_:1}))],64)):A(i)?a.value?(r(),h("div",kz,[n(bt,{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",Cz,[n(ln,{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(Nj,{key:0,productId:e.product.ID,onPathGenerated:m,ref_key:"addModalRef",ref:s,pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:w.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},xz={name:"ProductIntegrations",components:{IconButton:Ze,Empty:bt,DynamicIcon:J,CardFooter:sd,CardBody:Ce,CardHeader:Qe,CardContainer:xe},props:["product","product_id"],data(){return{product_id:this.product_id,selectedIntegrationType:"",integrationLists:[],showIntegrationDialog:!1,feeds:[],available_integrations:{},all_module_config_url:{},totalActiveModules:0,loading:!1}},computed:{Str(){return da},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:ad,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})}}},Sz={class:"fct-integration-settings fct-layout-width"},Fz={key:0,class:"integration-actions"},$z={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},Ez={class:"text-sm"},Uz={key:1,class:"fct-integrations-table-wrap"},Iz={class:"fct-integration-logo-wrap"},Qz=["src","alt"],Dz={class:"text-xs text-gray-700"},Vz=["onClick"],Tz={class:"fct-event-triggers"},Mz={class:"fct-event-triggers"},Lz={class:"fct-btn-group sm"},Rz={class:"fct-integration-table-footer"},Oz=["href"],Hz={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function Pz(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown"),y=C("CardHeader"),v=C("el-skeleton"),w=C("el-switch"),k=C("el-table-column"),b=C("el-tag"),x=C("el-popover"),F=C("IconButton"),M=C("el-tooltip"),$=C("Empty"),S=C("el-table"),I=C("CardBody"),Q=C("CardContainer"),D=Ma("loading");return r(),h("div",Sz,[n(Q,null,{default:d(()=>[n(y,{title:e.$t("Product Integrations")},{action:d(()=>[i.hasActiveModules?(r(),h("div",Fz,[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,(V,U)=>(r(),E(m,{key:U,command:U},{default:d(()=>[L(f(V.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(p,{type:"info",plain:"",size:"small"},{default:d(()=>[L(f(e.$t("Add Integration"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):B("",!0)]),_:1},8,["title"]),n(I,{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",Uz,[Gt((r(),E(S,{data:s.feeds},{empty:d(()=>[n($,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:d(()=>[n(k,{label:e.$t("Status"),width:90},{default:d(V=>[n(w,{"active-value":"yes","inactive-value":"no",onChange:U=>i.handleActive(V.row),modelValue:V.row.enabled,"onUpdate:modelValue":U=>V.row.enabled=U},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(k,{width:160,label:e.$t("Integration")},{default:d(V=>{var U,O;return[o("div",Iz,[(U=s.available_integrations[V.row.provider])!=null&&U.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:s.available_integrations[V.row.provider].logo,alt:V.row.provider},null,8,Qz)):B("",!0),o("span",Dz,f(((O=s.available_integrations[V.row.provider])==null?void 0:O.title)||V.row.provider),1)])]}),_:1},8,["label"]),n(k,{"min-width":150,label:e.$t("Title")},{default:d(V=>[o("a",{class:"fct-action-link-btn",onClick:Ne(U=>i.edit(V.row),["prevent"]),href:"#"},f(V.row.name),9,Vz)]),_:1},8,["label"]),n(k,{"min-width":150,label:e.$t("Triggers")},{default:d(V=>[o("div",Tz,[(r(!0),h(H,null,ae((V.row.feed.event_trigger||[]).slice(0,2),(U,O)=>(r(),E(b,{key:U},{default:d(()=>[n(c,{name:"Trigger"}),L(" "+f(i.Str.headline(U)),1)]),_:2},1024))),128)),(V.row.feed.event_trigger||[]).length>2?(r(),E(x,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(b,{type:"info"},{default:d(()=>[L(" +"+f((V.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",Mz,[(r(!0),h(H,null,ae((V.row.feed.event_trigger||[]).slice(2),(U,O)=>(r(),E(b,{key:U+O},{default:d(()=>[n(c,{name:"Trigger"}),L(" "+f(i.Str.headline(U)),1)]),_:2},1024))),128))])]),_:2},1024)):B("",!0)])]),_:1},8,["label"]),n(k,{width:90},{default:d(V=>[o("div",Lz,[n(M,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(F,{tag:"button",onClick:U=>i.edit(V.row),size:"x-small",hover:"primary"},{default:d(()=>[n(c,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(M,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(F,{tag:"button",size:"x-small",onClick:U=>i.remove(V.row.id,V),hover:"danger"},{default:d(()=>[n(c,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[D,s.loading]])])):(r(),h("div",$z,[o("p",Ez,f(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(()=>[L(f(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),o("div",Rz,[o("a",{href:s.all_module_config_url},f(e.$t("Check Global Integration Settings")),9,Oz),o("a",Hz,f(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const sc=st(xz,[["render",Pz]]),Nz={name:"SingleIntegration",components:{CardFooter:sd,CardBody:Ce,CardHeader:Qe,CardContainer:xe},props:["product","product_id","integration_id","integration_type"],data(){return{integration_id:this.integration_id,product_id:this.product_id,integration_type:this.integration_type||"",saving:!1,formData:{values:{name:"",integrationName:this.integration_type||"",description:""},fields:{integrationName:{type:"select",label:"Integration Type",placeholder:"Select Integration",options:[]}}}}},mounted(){this.fetchIntegrationData()},methods:{saveIntegration(){if(!this.formData.values.name){this.$notify({type:"error",message:"Integration name is required",offset:40});return}this.saving=!0;const e=this.integration_id?`products/${this.product_id}/integrations/${this.integration_id}`:`products/${this.product_id}/integrations`,t=this.integration_id?"put":"post";this[`$${t}`](e,{integration:this.formData.values}).then(a=>{this.saving=!1,this.$notify({type:"success",message:a.message||"Integration saved successfully",offset:40}),this.$router.push({name:"ProductIntegrations",params:{product_id:this.product_id}})}).catch(a=>{this.saving=!1,this.$notify({type:"error",message:(a==null?void 0:a.message)||"Failed to save integration",offset:40})})},fetchIntegrationData(){if(!this.integration_id){this.fetchIntegrationType();return}this.$get(`products/${this.product_id}/integrations/${this.integration_id}`).then(e=>{e.integration&&(this.formData.values={...e.integration},this.integration_type=e.integration.integrationName,this.fetchIntegrationType())}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration data",offset:40})})},fetchIntegrationType(){this.integration_type&&this.$get(`integration/settings?integration_name=${this.integration_type}`).then(e=>{e.settings_fields&&(this.formData.fields=e.settings_fields),Object.keys(this.formData.fields).forEach(t=>{this.formData.values[t]===void 0&&(this.formData.values[t]="")})}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration fields",offset:40})})},compare(e,t,a){switch(t){case"=":return e===a;case"!=":return e!==a;default:return!0}},dependancyPass(e){if(e.dependency){const a=e.dependency.depends_on.split("/").reduce((l,s)=>l[s],this.formData.values);return this.compare(a,e.dependency.operator,e.dependency.value)}return!0}}},Kz={class:"fct-integration-settings fct-layout-width"};function Gz(e,t,a,l,s,i){const c=C("el-button"),p=C("CardHeader"),m=C("el-input"),_=C("el-form-item"),g=C("el-option"),y=C("el-select"),v=C("el-form"),w=C("CardBody"),k=C("CardContainer");return r(),h("div",Kz,[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(()=>[L(f(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),n(w,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(m,{modelValue:s.formData.values.name,"onUpdate:modelValue":t[0]||(t[0]=b=>s.formData.values.name=b),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]=b=>s.formData.values.integrationName=b),disabled:"",class:"fct-select"},{default:d(()=>[(r(!0),h(H,null,ae(s.formData.fields.integrationName.options,b=>(r(),E(g,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(r(!0),h(H,null,ae(s.formData.fields,(b,x)=>(r(),h(H,{key:x},[x!=="integrationName"&&i.dependancyPass(b)?(r(),E(_,{key:0,label:b.label},{default:d(()=>[b.type==="text"?(r(),E(m,{key:0,modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="select"?(r(),E(y,{key:1,modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:b.placeholder,class:"fct-select"},{default:d(()=>[(r(!0),h(H,null,ae(b.options,F=>(r(),E(g,{key:F.value,label:F.label,value:F.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="textarea"?(r(),E(m,{key:2,type:"textarea",modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),_:2},1032,["label"])):B("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const jz=st(Nz,[["render",Gz],["__scopeId","data-v-486bb338"]]),zz={class:"fct-reason-dropdown-wrap"},qz={class:"fct-reason-label"},Lp=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=T(l.modelValue),c=T("");be(()=>l.modelValue,_=>{i.value=_});const p=()=>{s("update:modelValue",i.value),i.value==="other"&&s("update:customReason",c.value)},m=_=>{i.value=_,p()};return t({getValue:()=>i.value,getCustomReason:()=>c.value,setValue:_=>m(_),setCustomReason:_=>{c.value=_}}),(_,g)=>{const y=C("el-option"),v=C("el-select"),w=C("el-input");return r(),h("div",zz,[o("label",qz,f(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(w,{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"])])}}}),Yz={class:"fct-adjust-by-wrap"},Wz={class:"fct-adjust-by-row"},Xz={class:"fct-adjust-by-col"},Jz={class:"title"},Zz={class:"fct-adjust-by-col"},eq={class:"title"},tq={class:"fct-stock-info"},aq={class:"fct-adjust-reason-wrap"},lq={class:"fct-adjust-by-action"},Rp=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,s=T(!1),i=T(0),c=T(a.variant.total_stock),p=T(""),m=T(""),_=T(null),g=T(null);be(s,b=>{b&&Be(()=>{var x,F,M;(x=_.value)==null||x.focus(),(M=(F=_.value)==null?void 0:F.select)==null||M.call(F)})});const y=()=>{const b=i.value||0;let F=(parseInt(a.variant.total_stock)||0)+parseInt(b);c.value=F<0?0:F},v=()=>{const b=c.value||0,x=parseInt(a.variant.total_stock)||0;i.value=parseInt(b)-x},w=()=>{i.value=0,c.value=a.variant.total_stock,p.value="",m.value="",s.value=!1},k=()=>{l("save",{variant:a.variant,newStock:c.value,adjustedQuantity:i.value,reason:p.value,customReason:p.value==="other"?m.value:""}),s.value=!1,w()};return(b,x)=>{const F=C("el-input"),M=C("el-button"),$=C("el-popover");return r(),E($,{visible:s.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:x[4]||(x[4]=S=>s.value=!s.value)},[n(J,{name:"Configuration"})])]),default:d(()=>[o("div",Yz,[o("div",Wz,[o("div",Xz,[o("span",Jz,f(A(u)("Adjust by")),1),n(F,{ref_key:"adjustByInput",ref:_,size:"small",placeholder:A(u)("Quantity"),type:"number",modelValue:i.value,"onUpdate:modelValue":x[0]||(x[0]=S=>i.value=S),modelModifiers:{number:!0},onInput:y},null,8,["placeholder","modelValue"])]),o("div",Zz,[o("span",eq,f(A(u)("New Stock")),1),n(F,{size:"small",placeholder:A(u)("New Stock"),type:"number",modelValue:c.value,"onUpdate:modelValue":x[1]||(x[1]=S=>c.value=S),modelModifiers:{number:!0},onInput:v},null,8,["placeholder","modelValue"])])]),n(va,{visible:!!i.value,accordion:""},{default:d(()=>[o("div",tq,[x[5]||(x[5]=L(" (Original quantity: ",-1)),o("strong",null,f(e.variant.total_stock),1),x[6]||(x[6]=L(") ",-1))])]),_:1},8,["visible"]),o("div",aq,[n(Lp,{ref_key:"reasonDropdownRef",ref:g,modelValue:p.value,"onUpdate:modelValue":x[2]||(x[2]=S=>p.value=S),"onUpdate:customReason":x[3]||(x[3]=S=>m.value=S)},null,8,["modelValue"])]),o("div",lq,[n(M,{size:"small",type:"info",soft:"",onClick:w},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(M,{size:"small",type:"primary",onClick:k,disabled:!p.value},{default:d(()=>[L(f(A(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}}),sq={class:"fct-inventory-row"},nq={width:"50"},oq={class:"flex items-center gap-1"},iq=["src","alt"],rq=["src","alt"],dq={class:"fct-inventory-product-content"},uq={class:"fct-inventory-product-title"},cq={key:0},Aq={key:0},pq={key:1,class:"text-system-mid dark:text-gray-300"},fq={key:1},mq={key:2},hq={key:3},_q=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,m;const l=C("el-checkbox"),s=C("el-input");return r(),h("tr",sq,[o("td",nq,[o("div",oq,[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,iq)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,rq)),o("div",dq,[o("span",uq,f(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),h("td",cq,[e.row.variants[0].sku?(r(),h("span",Aq,f(e.row.variants[0].sku),1)):(r(),h("span",pq,f(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(Rp,{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",fq,[o("span",null,f(e.row.variants[0].available),1)])):B("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),h("td",mq,[o("span",null,f(e.row.variants[0].on_hold),1)])):B("",!0),(m=e.inventoryTable)!=null&&m.isColumnVisible("committed")?(r(),h("td",hq,[o("span",null,f(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]})])])}}}),vq={class:"fct-inventory-row fct-inventory-parent-row"},gq={width:"50"},yq={class:"fct-inventory-row-selection"},bq=["src","alt"],wq=["src","alt"],Cq={class:"fct-inventory-product-content"},kq={class:"fct-inventory-product-title"},Bq={key:0},xq={class:"!pl-5"},Sq={key:1},Fq={key:2},$q={key:3},Eq={class:"fct-inventory-variant-item"},Uq={class:"fct-inventory-product-info"},Iq=["src","alt"],Qq=["src","alt"],Dq={class:"fct-inventory-product-content"},Vq={key:0},Tq={key:1},Mq={key:2},Lq={key:3},Rq=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"],setup(e){al();const t=e,a=T(!0),l=K(()=>a.value);be(()=>t.expanded,w=>{a.value=w});const s=()=>{a.value=!a.value},i=()=>l.value,c=K(()=>{var w;return((w=t.row.variants)==null?void 0:w.reduce((k,b)=>k+(b.total_stock||0),0))||0}),p=K(()=>{var w;return((w=t.row.variants)==null?void 0:w.reduce((k,b)=>k+(b.available||0),0))||0}),m=K(()=>{var w;return((w=t.row.variants)==null?void 0:w.reduce((k,b)=>k+(b.on_hold||0),0))||0}),_=K(()=>{var w;return((w=t.row.variants)==null?void 0:w.reduce((k,b)=>k+(b.committed||0),0))||0}),g=()=>{const w=t.row.variants||[];return w.length>0&&w.every(k=>t.isRowSelected(k))},y=()=>{const w=t.row.variants||[],k=w.filter(b=>t.isRowSelected(b)).length;return k>0&&k<w.length},v=w=>{var k;(k=t.row.variants)==null||k.forEach(b=>{w!==t.isRowSelected(b)&&t.toggleRowSelection(b)})};return(w,k)=>{var M,$,S,I;const b=C("el-checkbox"),x=C("router-link"),F=C("el-input");return r(),h(H,null,[o("tr",vq,[o("td",gq,[o("div",yq,[n(b,{"model-value":g(),indeterminate:y(),onChange:v,onClick:k[0]||(k[0]=Ne(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),o("div",{onClick:k[1]||(k[1]=Q=>s()),class:"fct-inventory-row-toggle"},[n(J,{name:i()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:k[2]||(k[2]=Q=>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,bq)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,wq)),o("div",Cq,[o("span",kq,f(e.row.post_title),1)])])]),(M=e.inventoryTable)!=null&&M.isColumnVisible("sku")?(r(),h("td",Bq,[Gt(o("span",null,"--",512),[[Vl,!i()]])])):B("",!0),o("td",xq,[Gt(o("span",null,f(c.value),513),[[Vl,!i()]])]),($=e.inventoryTable)!=null&&$.isColumnVisible("available")?(r(),h("td",Sq,[Gt(o("span",null,f(p.value),513),[[Vl,!i()]])])):B("",!0),(S=e.inventoryTable)!=null&&S.isColumnVisible("on_hand")?(r(),h("td",Fq,[Gt(o("span",null,f(m.value),513),[[Vl,!i()]])])):B("",!0),(I=e.inventoryTable)!=null&&I.isColumnVisible("committed")?(r(),h("td",$q,[Gt(o("span",null,f(_.value),513),[[Vl,!i()]])])):B("",!0),k[4]||(k[4]=o("td",null,null,-1))]),(r(!0),h(H,null,ae(e.row.variants,Q=>{var D,V,U,O,R;return Gt((r(),h("tr",{key:`child-${Q.id}`,class:"fct-inventory-child-row"},[k[6]||(k[6]=o("td",null,null,-1)),o("td",null,[o("div",Eq,[n(b,{"model-value":e.isRowSelected(Q),onChange:P=>e.toggleRowSelection(Q)},null,8,["model-value","onChange"]),o("div",Uq,[Q.thumbnail!==null?(r(),h("img",{key:0,src:Q.thumbnail,alt:Q.variation_title,class:"inventory-thumbnail"},null,8,Iq)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:Q.variation_title},null,8,Qq)),o("div",Dq,[n(x,{to:`/products/${Q.post_id}`,class:"fct-inventory-product-title"},{default:d(()=>[L(f(Q.variation_title),1)]),_:2},1032,["to"])])])])]),(D=e.inventoryTable)!=null&&D.isColumnVisible("sku")?(r(),h("td",Vq,f(Q.sku),1)):B("",!0),o("td",null,[n(F,{modelValue:Q.total_stock,"onUpdate:modelValue":P=>Q.total_stock=P,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(Rp,{variant:Q,onSave:k[3]||(k[3]=P=>w.$emit("stock-save",P))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(V=e.inventoryTable)!=null&&V.isColumnVisible("available")?(r(),h("td",Tq,f(Q.available),1)):B("",!0),(U=e.inventoryTable)!=null&&U.isColumnVisible("on_hand")?(r(),h("td",Mq,f(Q.on_hold),1)):B("",!0),(O=e.inventoryTable)!=null&&O.isColumnVisible("committed")?(r(),h("td",Lq,f(Q.committed),1)):B("",!0),o("td",null,[n(Ze,{tag:"button",size:"small",onClick:P=>w.$emit("open-history",Q)},{default:d(()=>k[5]||(k[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"])])])),[[Vl,((R=e.row.variants)==null?void 0:R.length)>0&&i()]])}),128))],64)}}}),Oq={class:"fct-adjustment-header"},Hq={class:"fct-adjustment-product-name"},Pq={key:0,class:"fct-adjustment-timeline-wrap"},Nq={key:0,class:"fct-adjustment-timeline"},Kq={class:"fct-timeline-node"},Gq={class:"fct-timeline-content"},jq={class:"fct-timeline-header"},zq={class:"fct-timeline-time"},qq={class:"fct-stock-flow"},Yq={class:"fct-stock-flow-item"},Wq={class:"fct-stock-entry"},Xq={class:"fct-stock-label"},Jq={class:"fct-stock-value"},Zq={class:"fct-stock-entry new-stock-entry"},eY={class:"fct-stock-label"},tY={class:"fct-stock-value"},aY={class:"fct-stock-flow-item"},lY={class:"fct-stock-label"},sY={key:0,class:"fct-custom-reason-section"},nY={class:"fct-stock-label"},oY={class:"fct-custom-reason-text"},iY={key:1,class:"fct-timeline-empty"},rY={key:1,class:"fct-timeline-loading"},dY=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=T(!1),l=T(!1),s=T({id:null,name:""}),i=T([]),c=()=>{a.value=!1,i.value=[]},p=y=>{s.value=y,a.value=!0,m(y.id)},m=y=>{y&&(l.value=!0,ue.get("inventory/adjustment-history",{variant_id:y}).then(v=>{i.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{Y.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 w=C("el-drawer");return r(),E(w,{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",Oq,[o("h3",Hq,f(s.value.name),1)]),l.value?(r(),h("div",rY,[o("p",null,f(A(u)("Loading adjustment history...")),1)])):(r(),h("div",Pq,[i.value.length>0?(r(),h("div",Nq,[(r(!0),h(H,null,ae(i.value,(k,b)=>(r(),h("div",{key:b,class:"fct-timeline-item"},[o("div",Kq,[o("span",{class:re(["fct-node-dot",`node-${k.reason}`])},null,2)]),o("div",Gq,[o("div",jq,[o("span",zq,[n(Na,{"date-time":k.created_at},null,8,["date-time"]),L(" (by "+f(k.user_name)+") ",1)]),o("span",{class:re(["fct-timeline-reason-badge",`badge-${k.reason}`])},f(k.reason_label),3)]),o("div",qq,[o("div",Yq,[o("div",Wq,[o("span",Xq,f(A(u)("Previous Stock:")),1),o("span",Jq,f(k.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",Zq,[o("span",eY,f(A(u)("New Stock:")),1),o("span",tY,f(k.new_stock),1)])]),o("div",aY,[o("span",lY,f(A(u)("Change:")),1),o("span",{class:re(["fct-stock-value fct-stock-change",_(k.change)])},f(g(k.change))+" "+f(A(u)("units")),3)]),k.reason==="other"&&k.custom_reason?(r(),h("div",sY,[o("span",nY,f(A(u)("Details:")),1),o("p",oY,f(k.custom_reason),1)])):B("",!0)])])]))),128))])):(r(),h("div",iY,[n(bt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),uY={class:"fct-bulk-modal-content"},cY={class:"fct-inventory-mode-selection"},AY={class:"fct-inventory-input-section"},pY={key:0,class:"fct-inventory-mode-hint"},fY={class:"fct-inventory-selected-items"},mY={class:"fct-inventory-selected-items-count"},hY={key:0,class:"fct-inventory-selected-items-preview"},_Y={class:"fct-inventory-selected-item-header"},vY={class:"variant-title"},gY={class:"total-stock"},yY={class:"fct-inventory-selected-item-list"},bY={class:"fct-inventory-selected-item-info"},wY={class:"fct-inventory-selected-item-title"},CY=["innerHTML"],kY={class:"fct-inventory-selected-item-stock-action"},BY={class:"total-stock"},xY={class:"stock-arrow"},SY={class:"bulk-stock-value"},FY={class:"fct-inventory-adjustment-reason"},$Y={class:"dialog-footer"},EY=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=T(!1),c=T("add"),p=T(null),m=T(""),_=T(""),g=x=>c.value==="add"?x.total_stock+p.value:p.value,y=x=>p.value!==null&&p.value!==""&&g(x)!==x.total_stock,v=()=>{k(),i.value=!1},w=()=>{const x={mode:c.value,value:p.value,reason:m.value,customReason:m.value==="other"?_.value:"",items:l.selectedItems.map(F=>({id:F.id,post_id:F.post_id}))};ue.post("inventory/bulk-update",x).then(()=>{Y.success(u("Stock updated successfully")),k(),i.value=!1,s("bulk-update-success")}).catch(F=>{var M;F.status_code===422?Y.validationErrors(F):Y.error(((M=F.data)==null?void 0:M.message)||u("Failed to update stock"))})},k=()=>{p.value=null,c.value="add",m.value="",_.value=""};return t({openModal:()=>{k(),i.value=!0}}),(x,F)=>{const M=C("el-radio"),$=C("el-radio-group"),S=C("el-input"),I=C("el-button"),Q=C("el-dialog");return r(),E(Q,{modelValue:i.value,"onUpdate:modelValue":F[4]||(F[4]=D=>i.value=D),title:A(u)("Update Stocks")},{default:d(()=>{var D;return[o("div",uY,[o("div",cY,[n($,{modelValue:c.value,"onUpdate:modelValue":F[0]||(F[0]=V=>c.value=V),class:"fct-mode-radio-group"},{default:d(()=>[n(M,{value:"add"},{default:d(()=>[L(f(A(u)("Increase Stock")),1)]),_:1}),n(M,{value:"set"},{default:d(()=>[L(f(A(u)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),o("div",AY,[n(pa,{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(S,{modelValue:p.value,"onUpdate:modelValue":F[1]||(F[1]=V=>p.value=V),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",pY,[n(J,{name:"Warning"}),L(" "+f(A(u)("Replaces current inventory")),1)])):B("",!0)]),o("div",fY,[o("div",mY,f(e.selectedItems.length)+" "+f(A(u)("variants will be changed:")),1),(D=e.selectedItems)!=null&&D.length?(r(),h("div",hY,[o("div",_Y,[o("span",vY,f(A(u)("Variant")),1),o("span",gY,f(A(u)("Stock Change")),1)]),o("ul",yY,[(r(!0),h(H,null,ae(e.selectedItems,V=>(r(),h("li",{key:V.id},[o("div",bY,[o("span",wY,f(V.variation_title),1),o("span",{class:"fct-inventory-selected-item-price",innerHTML:V.formatted_total},null,8,CY)]),o("div",kY,[o("span",BY,f(V.total_stock),1),y(V)?(r(),h(H,{key:0},[o("span",xY,[n(J,{name:"ArrowRight"})]),o("span",SY,f(g(V)),1)],64)):B("",!0)])]))),128))])])):B("",!0)]),o("div",FY,[n(Lp,{modelValue:m.value,"onUpdate:modelValue":F[2]||(F[2]=V=>m.value=V),"onUpdate:customReason":F[3]||(F[3]=V=>_.value=V)},null,8,["modelValue"])]),o("div",$Y,[n(I,{onClick:v},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(I,{type:"primary",onClick:w,disabled:!m.value},{default:d(()=>[L(f(A(u)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),UY={class:"fct-advanced-inventory-table"},IY={class:"fct-inventory-toolbar-wrap"},QY={key:0,class:"fct-inventory-toolbar-selected"},DY={class:"fct-inventory-toolbar-actions ml-auto"},VY={key:0,class:"fct-advanced-inventory-table-wrap"},TY={class:"fct-advanced-inventory-table"},MY={key:0,width:"150"},LY={key:1,width:"100"},RY={key:2,width:"100"},OY={key:3,width:"100"},HY={width:"50"},PY={key:0},NY={key:1},KY={key:2},GY={key:3},nc=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=al(),l=e,s=t,i=T([]),c=T(!1),p=T(!1),m=T(null),_=T(null),g=T(!0);be(i,Q=>{s("selection-changed",{selectedItems:Q,count:Q.length})},{deep:!0});const y=Q=>Q.post_id?`variant-${Q.id}`:`product-${Q.id}`,v=Q=>{a.push({name:"product_edit",params:{product_id:Q}})},w=()=>{_.value&&_.value.openModal()},k=()=>{i.value=[],$(),s("bulk-update-success")},b=()=>l.data.flatMap(Q=>Q.variants&&Q.variants.length>0?Q.variants:[Q]),x=Q=>{Q?i.value=b():i.value=[],$()},F=Q=>{const D=i.value.findIndex(V=>V.id===Q.id);D>-1?i.value.splice(D,1):i.value.push(Q),$()},M=Q=>i.value.some(D=>D.id===Q.id),$=()=>{const Q=b(),D=i.value.length;D===0?(c.value=!1,p.value=!1):D===Q.length?(c.value=!0,p.value=!1):(c.value=!1,p.value=!0)},S=Q=>{m.value&&m.value.openHistory({id:Q.id,name:Q.variation_title||Q.post_title})},I=()=>{g.value=!g.value};return(Q,D)=>{var O,R,P,j,q,z,X,ne;const V=C("el-button"),U=C("el-checkbox");return r(),h("div",UY,[o("div",IY,[i.value.length>0?(r(),h("div",QY,f(i.value.length)+" "+f(A(u)("selected")),1)):B("",!0),o("div",DY,[i.value.length>0?(r(),E(V,{key:0,type:"primary",size:"small",onClick:w},{default:d(()=>[L(f(A(u)("Update Stocks")),1)]),_:1})):B("",!0),n(V,{class:"fct-expand-row-button",size:"small",onClick:I},{default:d(()=>[n(J,{name:g.value?"Expand":"Collapse"},null,8,["name"]),L(" "+f(g.value?A(u)("Collapse All"):A(u)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),h("div",VY,[o("table",TY,[o("colgroup",null,[D[3]||(D[3]=o("col",{width:"50"},null,-1)),D[4]||(D[4]=o("col",null,null,-1)),(O=e.inventoryTable)!=null&&O.isColumnVisible("sku")?(r(),h("col",MY)):B("",!0),D[5]||(D[5]=o("col",{width:"160"},null,-1)),(R=e.inventoryTable)!=null&&R.isColumnVisible("available")?(r(),h("col",LY)):B("",!0),(P=e.inventoryTable)!=null&&P.isColumnVisible("on_hand")?(r(),h("col",RY)):B("",!0),(j=e.inventoryTable)!=null&&j.isColumnVisible("committed")?(r(),h("col",OY)):B("",!0),D[6]||(D[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",HY,[n(U,{modelValue:c.value,"onUpdate:modelValue":D[0]||(D[0]=he=>c.value=he),indeterminate:p.value,onChange:x},null,8,["modelValue","indeterminate"])]),o("th",null,f(A(u)("Products")),1),(q=e.inventoryTable)!=null&&q.isColumnVisible("sku")?(r(),h("th",PY,f(A(u)("SKU")),1)):B("",!0),o("th",null,f(A(u)("Total Stock")),1),(z=e.inventoryTable)!=null&&z.isColumnVisible("available")?(r(),h("th",NY,f(A(u)("Available")),1)):B("",!0),(X=e.inventoryTable)!=null&&X.isColumnVisible("on_hand")?(r(),h("th",KY,f(A(u)("On hold")),1)):B("",!0),(ne=e.inventoryTable)!=null&&ne.isColumnVisible("committed")?(r(),h("th",GY,f(A(u)("Delivered")),1)):B("",!0),D[7]||(D[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(H,null,ae(e.data,he=>(r(),h(H,{key:y(he)},[!he.variants||he.variants.length===1?(r(),E(_q,{key:0,row:he,"inventory-table":e.inventoryTable,"is-row-selected":M,"toggle-row-selection":F,"navigate-to-product":v,"get-placeholder-image":Q.getPlaceholderImage,onStockSave:D[1]||(D[1]=N=>s("stock-save",N)),onOpenHistory:S},null,8,["row","inventory-table","get-placeholder-image"])):B("",!0),he.variants&&he.variants.length>1?(r(),E(Rq,{key:1,row:he,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":Q.getPlaceholderImage,"is-row-selected":M,"toggle-row-selection":F,expanded:g.value,onStockSave:D[2]||(D[2]=N=>s("stock-save",N)),onOpenHistory:S},null,8,["row","inventory-table","get-placeholder-image","expanded"])):B("",!0)],64))),128))])])])):(r(),E(bt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No inventory data")},null,8,["text"])),n(EY,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:k},null,8,["selected-items"]),n(dY,{ref_key:"historyRef",ref:m},null,512)])}}}),jY={class:"fct-advanced-inventory-table"},zY={class:"fct-inventory-toolbar-wrap"},qY={class:"fct-inventory-toolbar-actions ml-auto"},YY={class:"fct-advanced-inventory-table-wrap"},WY={class:"fct-advanced-inventory-table"},XY={key:0,width:"150"},JY={key:1,width:"100"},ZY={key:2,width:"100"},eW={key:3,width:"100"},tW={width:"50"},aW={key:0},lW={key:1},sW={key:2},nW={key:3},oW={class:"fct-product-info-card"},iW={class:"fct-product-info-media"},rW={class:"fct-product-info-details"},dW={key:0},uW={key:1},cW={key:2},AW={key:3},pW={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=K(()=>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,m,_,g,y,v,w,k;return[o("div",jY,[o("div",zY,[o("div",qY,[n(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",YY,[o("table",WY,[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",XY)):B("",!0),s[2]||(s[2]=o("col",{width:"160"},null,-1)),(m=e.inventoryTable)!=null&&m.isColumnVisible("available")?(r(),h("col",JY)):B("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),h("col",ZY)):B("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",eW)):B("",!0),s[3]||(s[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",tW,[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",aW,[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",lW,[n(i,{variant:"p",class:"w-20"})])):B("",!0),(w=e.inventoryTable)!=null&&w.isColumnVisible("on_hand")?(r(),h("th",sW,[n(i,{variant:"p",class:"w-16"})])):B("",!0),(k=e.inventoryTable)!=null&&k.isColumnVisible("committed")?(r(),h("th",nW,[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,b=>{var x,F,M,$;return r(),h("tr",{key:b},[o("td",null,[n(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",oW,[o("div",iW,[n(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",rW,[n(i,{variant:"p",class:"max-w-[180px]"})])])]),(x=e.inventoryTable)!=null&&x.isColumnVisible("sku")?(r(),h("td",dW,[n(i,{variant:"p",class:"w-20"})])):B("",!0),o("td",null,[n(i,{variant:"p",class:"w-16"})]),(F=e.inventoryTable)!=null&&F.isColumnVisible("available")?(r(),h("td",uW,[n(i,{variant:"p",class:"w-10"})])):B("",!0),(M=e.inventoryTable)!=null&&M.isColumnVisible("on_hand")?(r(),h("td",cW,[n(i,{variant:"p",class:"w-10"})])):B("",!0),($=e.inventoryTable)!=null&&$.isColumnVisible("committed")?(r(),h("td",AW,[n(i,{variant:"p",class:"w-10"})])):B("",!0),s[5]||(s[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},fW={class:"fct-module-disabled-notice"},mW={class:"fct-disabled-notice-title"},hW={class:"fct-disabled-notice-text"},_W=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=C("el-icon"),s=C("router-link");return r(),h("div",fW,[n(l,{class:"fct-disabled-notice-icon"},{default:d(()=>[n(A(Pf))]),_:1}),o("h3",mW,f(A(u)("Stock Management Inactive")),1),o("p",hW,[L(f(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(()=>[L(f(A(u)("module settings")),1)]),_:1}),L(" "+f(A(u)(" to use inventory features.")),1)])])}}});class vW extends Fs{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["detail","variants"]}}function gW(e){return vW.init(e)}const yW={class:"fct-all-inventory-page fct-layout-width"},bW={class:"fct-inventory-wrap"},wW={key:2,class:"py-10"},CW={class:"fct-pro-feature-text"},kW=Object.assign({name:"Inventory"},{__name:"Inventory",setup(e){const t=je.get("app_config"),a=K(()=>t==null?void 0:t.isProActive),l=je.get("modules_settings"),s=K(()=>{var w;return((w=l==null?void 0:l.stock_management)==null?void 0:w.active)==="yes"}),i=K(()=>{var w;return((w=l==null?void 0:l.stock_management)==null?void 0:w.enable_advanced_inventory)==="yes"}),c=K(()=>a.value&&s.value&&i.value),p=gW({instance:qt(),fetch:!1}),m=T(0),_=T([]),g=w=>{m.value=w.count,_.value=w.selectedItems||[]},y=()=>{p.fetch()},v=w=>{const{variant:k,newStock:b,reason:x,customReason:F}=w;let M=parseInt(b);k.total_stock=M<0?0:M;let $=parseInt(k.total_stock)-parseInt(k.committed)-parseInt(k.on_hold);k.available=$<0?0:$,ue.post("inventory/update-stock",{variant_id:k.id,post_id:k.post_id,new_stock:k.total_stock,reason:x,customReason:F||""}).then(S=>{Y.success(u(S.message))}).catch(S=>{var I;S.status_code=="422"?Y.validationErrors(S):Y.error((I=S.data)==null?void 0:I.message)})};return Ie(()=>{c.value&&p.fetch()}),(w,k)=>{const b=C("router-link");return r(),h("div",yW,[n(sl,{title:A(u)("Inventory")},{action:d(()=>[n(Nt,{permission:"products/view"})]),_:1},8,["title"]),c.value?(r(),E(Nt,{key:0,permission:"products/view"},{default:d(()=>[o("div",bW,[n($s,{table:A(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[n(nc,{data:A(p).getTableData(),"inventory-table":A(p),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:d(()=>[A(p).isLoading()?(r(),E(pW,{key:0,"next-page-count":A(p).nextPageCount,"inventory-table":A(p)},null,8,["next-page-count","inventory-table"])):(r(),E(nc,{key:1,data:A(p).getTableData(),"inventory-table":A(p),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):s.value?(r(),h("div",wW,[n(ln,{placement:"feature_lock_advanced_inventory",title:A(u)("Advanced Inventory")},{default:d(()=>[o("p",CW,[L(f(A(u)("This feature is only available in FluentCart Pro with "))+" ",1),n(b,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[L(f(A(u)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),E(_W,{key:1}))])}}}),BW={class:"setting-wrap"},xW={class:"setting-wrap-inner"},SW={key:0,class:"fct-all-notification-table-wrap"},FW={class:"fct-card-header"},$W={class:"w-full pb-2"},EW={class:"flex items-center justify-between gap-2 pb-2"},UW={class:"flex-1"},IW={style:{width:"120px"}},QW={class:"flex items-center justify-between gap-3",style:{width:"220px"}},DW={key:1,class:"fct-all-notification-table-wrap"},VW=["id"],TW={class:"fct-card-header"},MW={class:"w-full pb-2"},LW={class:"flex items-center justify-between gap-2 pb-2"},RW={class:"fct-card-header-title"},OW={class:"text-xs text-system-mid dark:text-gray-300"},HW={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},PW={class:"fct-card-body px-0 pb-0 pt-0"},NW={class:"m-0 mb-1"},KW={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},GW={class:"m-0 text-sm"},jW={class:"fct-all-notification-actions flex items-center justify-between gap-3"},zW={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},qW={class:"fct-btn-group sm flex-shrink-0"},YW={__name:"EmailNotificationSettings",setup(e){const t=ll(),a=T(!0),l=T([]),s=K(()=>{if(!l.value.length)return[];const p={};return l.value.forEach(m=>{const _=(m==null?void 0:m.group)||"other";p[_]||(p[_]={key:_,label:(m==null?void 0:m.group_label)||u("Other Actions"),items:[]}),p[_].items.push(m)}),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,Be(()=>{requestAnimationFrame(()=>en.scrollToHashSection(t.hash))})})},c=(p,m)=>{ue.post("email-notification/enable-notification/"+m,{active:p}).then(_=>{Y.success(_.message)}).catch(_=>{var g;_.status_code=="422"?Y.validationErrors(_):Y.error((g=_.data)==null?void 0:g.message)}).finally(()=>{})};return Ie(()=>{i()}),(p,m)=>{const _=C("el-skeleton-item"),g=C("el-skeleton"),y=C("router-link"),v=C("el-table-column"),w=C("el-switch"),k=C("el-tooltip"),b=C("el-table");return r(),h("div",BW,[n(Qa,{heading:A(u)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",xW,[n(Da),a.value?(r(),h("div",SW,[(r(),h(H,null,ae(2,x=>o("div",{key:x,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",FW,[o("div",$W,[o("div",EW,[n(_,{variant:"text",style:{width:"140px",height:"16px"}}),n(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(H,null,ae(4,F=>o("div",{key:F,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",UW,[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",IW,[n(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",QW,[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",DW,[s.value.length?(r(!0),h(H,{key:0},ae(s.value,x=>(r(),h("div",{key:x.key,id:x.key,class:"fct-card fct-notification-group overflow-hidden"},[o("div",TW,[o("div",MW,[o("div",LW,[o("h4",RW,f(x.label),1),o("span",OW,f(x.items.length)+" "+f(A(u)("Notifications")),1)]),x.key==="scheduler"?(r(),h("p",HW,[L(f(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(()=>[L(f(A(u)("reminder settings")),1)]),_:1})])):B("",!0)])]),o("div",PW,[n(b,{data:x.items,"show-header":!0},{default:d(()=>[n(v,{prop:"title",label:A(u)("Notification Name"),"min-width":"320"},{default:d(F=>[o("h4",NW,f(F.row.title),1),o("p",KW,f(F.row.description),1)]),_:1},8,["label"]),n(v,{prop:"recipient",label:A(u)("Recipient"),"min-width":"120"},{default:d(F=>[o("p",GW,f(A(da).headline(F.row.recipient)),1)]),_:1},8,["label"]),n(v,{label:A(u)("Enabled"),"min-width":"220"},{default:d(F=>{var M,$,S;return[o("div",jW,[((M=F.row)==null?void 0:M.manage_toggle)!=="no"?(r(),E(w,{key:0,onChange:I=>c(I,F.row.name),modelValue:F.row.settings.active,"onUpdate:modelValue":I=>F.row.settings.active=I,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):B("",!0),(($=F.row)==null?void 0:$.manage_toggle)==="no"?(r(),h("span",zW,f(((S=F.row)==null?void 0:S.toggle_label)||A(u)("Auto-enabled")),1)):B("",!0),o("div",qW,[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:F.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,VW))),128)):(r(),E(bt,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:A(u)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},WW={__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=je.get("app_config.isProActive"),l=je.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 m=C("el-alert");return A(a)&&!A(s)?Ba(c.$slots,"default",{key:0}):A(s)?(r(),E(m,{key:1,type:"warning","show-icon":"",closable:!1,title:A(u)("Update Required"),description:A(i)},null,8,["title","description"])):(r(),E(ln,{key:2,title:e.featureTitle,text:e.featureText,placement:e.placement},null,8,["title","text","placement"]))}}},XW={class:"setting-wrap fct-edit-email-notification-wrapper"},JW={class:"capitalize"},ZW={class:"setting-wrap-inner"},eX={class:"mb-5"},tX={class:"setting-switcher flex items-center gap-3"},aX={class:"text-sm text-system-dark dark:text-gray-50"},lX={class:"fct-card p-6"},sX={class:"mb-5"},nX={class:"el-form-item__label block mb-2"},oX={class:"mb-5"},iX={class:"el-form-item__label block mb-2"},rX={class:"el-form-item__label block mb-2"},dX={class:"mb-5"},uX={key:0,class:"setting-switcher"},cX={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},AX={class:"fct-seg-wrap"},pX={key:0,class:"fct-default-template-preview"},fX={class:"el-form-item__label"},mX={key:1,class:"fct-default-template-frame"},hX=["srcdoc"],_X={key:0,class:"el-form-item__label"},vX={key:1,class:"text-system-mid mb-3"},gX={key:2,class:"mb-4"},yX={class:"setting-save-action"},bX={key:0,style:{height:"300px"}},wX={class:"fct-preview-toolbar"},CX={class:"fct-preview-device-toggle"},kX={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=je.get("app_config.isProActive"),a=e,l=T(!1),s=T(!1),i=T(a.name),c=T({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=T(null),m=T({}),_=T([]),g=T(),y=(z,X={})=>!z||typeof z!="object"?[]:(z.schema?[[z.form_name||"form",z]]:Object.entries(z)).filter(([,he])=>(he==null?void 0:he.schema)&&Object.keys(he.schema).length).map(([he,N])=>({...N,form_key:he,values:{...N.values||{},...X[he]||{}}})),v=()=>{const X=[].concat(g.value||[]).reduce((ne,he)=>typeof(he==null?void 0:he.getState)=="function"?{...ne,...he.getState()}:ne,{});return Object.keys(X).length?{[i.value]:X}:null},w=T(!1),k=T(!1),b=T([]),x=T(!1),F=T(!1),M=T(""),$=T("desktop"),S=T(null),I=()=>{x.value=!0,F.value=!0,M.value="",ue.post("email-notification/preview",{notification_name:i.value,block_content:c.value.settings.email_body||""}).then(z=>{M.value=z.html,F.value=!1,Be(()=>Q())}).catch(z=>{var X;Y.error(((X=z.data)==null?void 0:X.message)||"Failed to generate preview"),x.value=!1,F.value=!1})},Q=()=>{const z=S.value;if(!z||!M.value)return;const X=z.contentDocument||z.contentWindow&&z.contentWindow.document;X&&(X.open(),X.write(M.value),X.close())},D=()=>{Be(()=>{M.value&&Q()})},V=()=>{x.value=!1,M.value="",$.value="desktop"},U=T(""),O=T(!1),R=()=>{var X;const z=(X=c.value)==null?void 0:X.template_path;!z||U.value||(O.value=!0,ue.post("email-notification/preview-default-template",{template:z}).then(ne=>{var he;U.value=((he=ne.data)==null?void 0:he.content)||""}).catch(()=>{}).finally(()=>{O.value=!1}))};be(()=>c.value.settings.is_default_body,z=>{z==="yes"&&!U.value&&R()});const P=z=>{c.value.settings.subject+=z},j=()=>{l.value=!0,ue.get("email-notification/"+i.value).then(z=>{var ne;c.value=z.data,m.value=z.shortcodes,k.value=z.has_fluent_pdf||!1,b.value=z.pdf_templates||[];const X=((ne=c.value.settings.extra)==null?void 0:ne[i.value])||{};_.value=y(c.value.extra_fields,X),c.value.settings.is_default_body==="yes"&&R()}).catch(z=>{var X;z.status_code=="422"?Y.validationErrors(z):Y.error((X=z.data)==null?void 0:X.message)}).finally(()=>{l.value=!1})},q=()=>{s.value=!0;const z=JSON.parse(JSON.stringify(c.value)),X=v();X&&(z.settings.extra=X),z.settings.is_default_body==="no"&&p.value&&p.value.forceAutosave(),ue.put("email-notification/"+i.value,z).then(ne=>{Y.success(ne.message)}).catch(ne=>{var he;ne.status_code=="422"?Y.validationErrors(ne):Y.error((he=ne.data)==null?void 0:he.message)}).finally(()=>{s.value=!1})};return Ie(()=>{j()}),(z,X)=>{var tt;const ne=C("el-breadcrumb-item"),he=C("el-breadcrumb"),N=C("el-skeleton-item"),G=C("el-skeleton"),Z=C("el-switch"),W=C("el-input"),ie=C("el-form-item"),ye=C("el-form"),fe=C("el-option"),ge=C("el-select"),se=C("el-button"),pe=C("el-drawer"),$e=Ma("loading");return r(),h("div",XW,[n(Qa,{loading:s.value,"loading-text":A(u)("Updating"),"save-button-text":A(u)("Update"),onOnSave:q},{heading:d(()=>[n(he,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(ne,{to:{path:"/settings/email_notifications"}},{default:d(()=>[L(f(z.$t("Email Notifications")),1)]),_:1}),n(ne,null,{default:d(()=>[o("span",JW,f(c.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",ZW,[n(Da),l.value?(r(),E(G,{key:0,animated:""},{template:d(()=>[o("div",eX,[o("div",tX,[n(N,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",aX,f(A(u)("Enable this email notification!")),1)])]),o("div",lX,[o("div",sX,[o("label",nX,f(A(u)("Email Subject")),1),n(N,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",oX,[o("label",iX,f(A(u)("Email Body Type")),1),n(N,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",rX,f(A(u)("Email Body")),1),n(or)])])]),_:1})):B("",!0),l.value?B("",!0):(r(),h(H,{key:1},[o("div",dX,[((tt=c.value)==null?void 0:tt.manage_toggle)!=="no"?(r(),h("div",uX,[n(Z,{modelValue:c.value.settings.active,"onUpdate:modelValue":X[0]||(X[0]=_e=>c.value.settings.active=_e),"active-value":"yes","inactive-value":"no","active-text":A(u)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",cX,f(A(u)("Auto-enabled for offline payments")),1))]),n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(ye,{"label-position":"top"},{default:d(()=>[n(ie,{label:A(u)("Email Subject")},{default:d(()=>[n(W,{modelValue:c.value.settings.subject,"onUpdate:modelValue":X[1]||(X[1]=_e=>c.value.settings.subject=_e),autocomplete:"rutjfkde",class:re({"is-focus":w.value}),onFocus:X[2]||(X[2]=_e=>w.value=!0),onBlur:X[3]||(X[3]=_e=>w.value=!1),label:A(u)("Email Subject")},{append:d(()=>[n(Pc,{data:m.value,onCommand:P,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:d(()=>[L(f(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",AX,[o("button",{type:"button",class:re(["fct-seg-btn",{active:c.value.settings.is_default_body==="yes"}]),onClick:X[4]||(X[4]=_e=>c.value.settings.is_default_body="yes")},[X[13]||(X[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)),L(" "+f(A(u)("Default Body")),1)],2),o("button",{type:"button",class:re(["fct-seg-btn",{active:c.value.settings.is_default_body==="no"}]),onClick:X[5]||(X[5]=_e=>c.value.settings.is_default_body="no")},[X[14]||(X[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)),L(" "+f(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",pX,[o("label",fX,f(A(u)("Email Body")),1),O.value?(r(),E(or,{key:0})):U.value?(r(),h("div",mX,[n(_o,{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:U.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,hX)])):B("",!0)])):B("",!0),c.value.settings.is_default_body==="no"&&!l.value?(r(),E(WW,{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(_o,{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(Yc,{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:X[6]||(X[6]=_e=>{c.value.settings.subject=_e}),onPreviewRequest:I,modelValue:c.value.settings.email_body,"onUpdate:modelValue":X[7]||(X[7]=_e=>c.value.settings.email_body=_e)},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,_e=>(r(),E(xe,{key:_e.form_key,class:"mt-4"},{default:d(()=>[n(Ce,null,{default:d(()=>[_e.title?(r(),h("h3",_X,f(_e.title),1)):B("",!0),_e.sub_title?(r(),h("p",vX,f(_e.sub_title),1)):B("",!0),n(mp,{schema:_e.schema,values:_e.values,form_name:_e.form_key,ref_for:!0,ref_key:"extraFormRefs",ref:g},null,8,["schema","values","form_name"])]),_:2},1024)]),_:2},1024))),128))],64)),k.value&&b.value.length?(r(),h("div",gX,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(ye,{"label-position":"top"},{default:d(()=>[n(ie,{label:A(u)("Attach PDF Template")},{default:d(()=>[n(ge,{modelValue:c.value.settings.attach_pdf_template,"onUpdate:modelValue":X[8]||(X[8]=_e=>c.value.settings.attach_pdf_template=_e),placeholder:A(u)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:d(()=>[(r(!0),h(H,null,ae(b.value,_e=>(r(),E(fe,{key:_e.id,label:_e.title,value:_e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):B("",!0),o("div",yX,[n(se,{onClick:q,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[L(f(A(u)("Update")),1)]),_:1},8,["disabled","loading"])])]),n(pe,{modelValue:x.value,"onUpdate:modelValue":X[12]||(X[12]=_e=>x.value=_e),direction:"rtl",size:"70%",title:A(u)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:D},{footer:d(()=>[n(se,{onClick:V},{default:d(()=>[L(f(A(u)("Close")),1)]),_:1})]),default:d(()=>[F.value?Gt((r(),h("div",bX,null,512)),[[$e,!0]]):B("",!0),!F.value&&M.value?(r(),h(H,{key:1},[o("div",wX,[o("div",CX,[o("button",{type:"button",class:re(["fct-device-btn",{active:$.value==="desktop"}]),onClick:X[9]||(X[9]=_e=>$.value="desktop")},[X[15]||(X[15]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o("path",{d:"M8 21h8"}),o("path",{d:"M12 17v4"})],-1)),o("span",null,f(A(u)("Desktop")),1)],2),o("button",{type:"button",class:re(["fct-device-btn",{active:$.value==="tablet"}]),onClick:X[10]||(X[10]=_e=>$.value="tablet")},[X[16]||(X[16]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,f(A(u)("Tablet")),1)],2),o("button",{type:"button",class:re(["fct-device-btn",{active:$.value==="mobile"}]),onClick:X[11]||(X[11]=_e=>$.value="mobile")},[X[17]||(X[17]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,f(A(u)("Mobile")),1)],2)])]),n(_o,{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:re(["fct-preview-stage","fct-preview-stage--"+$.value])},[o("div",{class:re(["fct-device-frame","fct-device-frame--"+$.value])},[o("iframe",{ref_key:"previewIframe",ref:S,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):B("",!0)]),_:1},8,["modelValue","title"])])}}},BX={name:"StorageSettings",components:{Badge:fa,CardBody:Ce,CardContainer:xe,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})}}},xX={class:"setting-wrap"},SX={class:"setting-wrap-inner"},FX={key:0,class:"storage-setting-list fct-content-card-list"},$X=["role","tabindex","aria-label","onClick","onKeydown"],EX={class:"flex items-start gap-3"},UX=["src","alt"],IX=["src","alt"],QX={class:"flex-1 min-w-0 pl-15"},DX={class:"fct-content-card-list-head"},VX={class:"title-wrap"},TX={class:"fct-content-card-list-content"};function MX(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("Badge"),g=C("el-switch"),y=C("DynamicIcon"),v=C("el-button"),w=C("CardBody"),k=C("CardContainer");return r(),h("div",xX,[n(c,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",SX,[n(p),n(k,null,{default:d(()=>[n(w,null,{default:d(()=>[n(m,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?B("",!0):(r(),h("div",FX,[(r(!0),h(H,null,ae(s.availableDrivers,(b,x)=>(r(),h("div",{key:b.route||x,class:re(["fct-content-card-list-item",i.canManage(b)?"cursor-pointer":""]),role:i.canManage(b)?"button":void 0,tabindex:i.canManage(b)?0:-1,"aria-label":i.getRowLabel(b),onClick:F=>i.handleDriverAction(b),onKeydown:[xa(Ne(F=>i.handleDriverAction(b),["prevent"]),["enter"]),xa(Ne(F=>i.handleDriverAction(b),["prevent"]),["space"])]},[o("div",EX,[o("div",{class:re(`fct-content-card-list-icon ${b.title.toLowerCase()}`)},[o("img",{class:re({"dark:hidden":i.getDarkLogo(b.dark_logo)}),src:i.getLogo(b.logo),alt:b.title},null,10,UX),i.getDarkLogo(b.dark_logo)?(r(),h("img",{key:0,src:i.getDarkLogo(b.dark_logo),alt:b.title,class:"hidden dark:block"},null,8,IX)):B("",!0)],2),o("div",QX,[o("div",DX,[o("div",VX,[o("h6",null,f(b.title),1)]),n(_,{size:"small",status:b.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",TX,[o("p",null,f(b.description),1)])]),i.canToggle(b)?(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:b.is_active_input,"onUpdate:modelValue":F=>b.is_active_input=F,"active-value":"yes","inactive-value":"no",loading:b.saving,"aria-label":i.getToggleLabel(b),onChange:F=>i.toggleStatus(b)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):i.isProLocked(b)?(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:b.upgrade_url,target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[n(y,{name:"Crown"}),L(" "+f(i.translate("Upgrade to Pro")),1)]),_:2},1032,["href"])],32)):i.canManage(b)?(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:F=>i.handleDriverAction(b)},{default:d(()=>[L(f(i.translate("Manage")),1)]),_:2},1032,["onClick"])],32)):B("",!0)])],42,$X))),128))]))]),_:1})]),_:1})])])}const LX=st(BX,[["render",MX]]),RX={class:"fct-setting-header"},OX={key:0,class:"fct-setting-header-action"},HX={class:"setting-wrap-inner"},oc={__name:"GlobalStorageComponents",setup(e){const t=T({}),a=T(""),l=T({}),s=T(!1),i=T(!1),c=T(""),p=pd(),m=T({}),_=K(()=>!!a.value),g=ll(),y=fs(),v=()=>{i.value=!0,ue.get("settings/storage-drivers/"+c.value).then(b=>{t.value=b.settings||{},a.value=b.template||"",l.value=b.template_payload||{},m.value={},b.template||p.setSchema(b.fields).setDefaults(b.settings).initForm()}).catch(b=>{var x;t.value={},a.value="",l.value={},m.value={},p.setSchema({}).setDefaults({}),Y.error(((x=b==null?void 0:b.data)==null?void 0:x.message)||u("Failed to load storage settings."))}).finally(()=>{i.value=!1})},w=()=>{if(_.value)return;let b=p.values;s.value=!0,ue.post("settings/storage-drivers",{settings:{...b},driver:c.value}).then(x=>{var F;t.value.is_active=(F=x.data)==null?void 0:F.is_active,Y.success(x.message||u("Storage Settings updated!")),p.values=x.data,x.data.shouldReload&&v()}).catch(x=>{var F;x.status_code=="422"?Y.validationErrors(x):Y.error((F=x.data)==null?void 0:F.message)}).finally(()=>{s.value=!1})},k=()=>{c.value=g.name};return be(g,(b,x)=>{k(),v()}),y.onSave(()=>{_.value||w()}),Ie(()=>{k(),v()}),(b,x)=>{const F=C("el-breadcrumb-item"),M=C("el-breadcrumb"),$=C("el-button"),S=C("el-skeleton");return r(),h("div",{class:re(["setting-wrap",c.value])},[o("div",RX,[n(M,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(F,{to:{name:"storage"}},{default:d(()=>[L(f(A(u)("Storage Providers")),1)]),_:1}),A(da).headline(c.value)?(r(),E(F,{key:0},{default:d(()=>[L(f(A(da).headline(c.value)),1)]),_:1})):B("",!0)]),_:1},8,["separator-icon"]),_.value?B("",!0):(r(),h("div",OX,[n($,{type:"primary",onClick:w,loading:s.value,disabled:s.value||i.value,size:"small"},{default:d(()=>[L(f(A(u)("Save")),1)]),_:1},8,["loading","disabled"])]))]),o("div",HX,[n(Da),i.value?(r(),E(xe,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(S,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(H,{key:1},[_.value?(r(),E(hp,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:c.value}},null,8,["widget","data"])):(r(),E(vi,{key:1,form:A(p),showSubmitButton:!1,loading:s.value,onOnChange:x[0]||(x[0]=I=>{}),"validation-errors":m.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},PX=["innerHTML"],NX={class:"fct-select-template-wrap"},KX={class:"fct-select-template-wrap flex gap-2 flex-row"},GX={class:"setting-save-action"},jX={__name:"AddEmailNotification",setup(e){const t=qt().ctx,a=T(),l=T(!0),s=T(!1),i=T({}),c=T(),p=T([{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"}]),m=T({}),_=T([{label:"Admin Email",value:"{wp.admin_email}"},{label:"Customer Email",value:"{order.customer.email}"},{label:"User Email",value:"{user.user_email}"}]),g=T({}),y=T({});al(),ll();let v=null;const w=T([]),k=T([]),b=T({});fs().onSave(()=>{S()});const F=O=>{const R=O;t.$post("email-notification/getTemplate/",{template:R}).then(P=>{var j;i.value.content=P.data.content,(j=a.value)==null||j.setContent(i.value.content)}).catch(P=>{}).finally(()=>{l.value=!1})},M=()=>{var O;(O=a.value)==null||O.setContent("")},$=()=>{l.value=!0,t.$get("email-notification/get-short-codes").then(O=>{m.value=O.data.shortcodes,g.value=O.data.email_templates,y.value=Object.keys(O.data.buttons).map(R=>({[R]:O.data.buttons[R]}))}).catch(O=>{}).finally(()=>{l.value=!1})},S=O=>{O&&O.preventDefault(),b.value={},l.value=!0,t.$post("email-notification/create",i.value).then(R=>{t.handleSuccess(R)}).catch(R=>{var P;R.status_code=="422"?(Y.validationErrors(R),b.value=R.data):Y.error((P=R.data)==null?void 0:P.message)}).finally(()=>{l.value=!1})},I=()=>{s.value=!0,c.value=i.value.content};Ie(()=>{$()});const Q=O=>{v=O},D=O=>{b.value&&b.value.hasOwnProperty(O)&&delete b.value[O]},V=()=>{i.value.to=w.value},U=()=>{i.value.from=k.value};return(O,R)=>{const P=C("el-dialog"),j=C("el-input"),q=C("el-form-item"),z=C("el-option"),X=C("el-select"),ne=C("el-col"),he=C("el-row"),N=C("el-tooltip"),G=C("el-button"),Z=C("el-form");return r(),E(xe,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(()=>R[20]||(R[20]=[])),_:1},8,["title"]),n(Ce,null,{default:d(()=>[n(P,{modelValue:s.value,"onUpdate:modelValue":R[0]||(R[0]=W=>s.value=W),title:O.$t("Preview")},{default:d(()=>[o("div",{innerHTML:c.value},null,8,PX)]),_:1},8,["modelValue","title"]),n(Z,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(q,{label:O.$t("Notification Name"),required:""},{default:d(()=>{var W,ie;return[n(j,{modelValue:i.value.title,"onUpdate:modelValue":R[1]||(R[1]=ye=>i.value.title=ye),onFocus:R[2]||(R[2]=ye=>D("title"))},null,8,["modelValue"]),n(fl,{"validation-errors":(ie=(W=b.value)==null?void 0:W.title)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(q,{label:O.$t("Select notification event"),required:""},{default:d(()=>{var W,ie;return[n(X,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":R[3]||(R[3]=ye=>i.value.events=ye),placeholder:O.$t("Select Events"),onFocus:R[4]||(R[4]=ye=>D("events")),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(p.value,ye=>(r(),E(z,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(ie=(W=b.value)==null?void 0:W.events)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(he,{gutter:15},{default:d(()=>[n(ne,{lg:12},{default:d(()=>[n(q,{label:O.$t("Mail From:"),required:""},{default:d(()=>{var W,ie;return[n(j,{modelValue:i.value.from,"onUpdate:modelValue":R[7]||(R[7]=ye=>i.value.from=ye),onFocus:R[8]||(R[8]=ye=>D("from")),placeholder:O.$t("Select a Field or Type Custom Value")},{append:d(()=>[n(X,{modelValue:k.value,"onUpdate:modelValue":R[5]||(R[5]=ye=>k.value=ye),onChange:R[6]||(R[6]=ye=>U()),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,ye=>(r(),E(z,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(ie=(W=b.value)==null?void 0:W.from)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(ne,{lg:12},{default:d(()=>[n(q,{label:O.$t("Send Mail To:"),required:""},{default:d(()=>{var W,ie;return[n(j,{modelValue:i.value.to,"onUpdate:modelValue":R[11]||(R[11]=ye=>i.value.to=ye),onFocus:R[12]||(R[12]=ye=>D("to"))},{append:d(()=>[n(X,{modelValue:w.value,"onUpdate:modelValue":R[9]||(R[9]=ye=>w.value=ye),onChange:R[10]||(R[10]=ye=>V()),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,ye=>(r(),E(z,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),n(fl,{"validation-errors":(ie=(W=b.value)==null?void 0:W.to)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),n(q,{label:O.$t("Cc:")},{default:d(()=>[n(j,{modelValue:i.value.cc,"onUpdate:modelValue":R[13]||(R[13]=W=>i.value.cc=W)},null,8,["modelValue"])]),_:1},8,["label"]),n(q,{label:O.$t("Mail Subject:"),required:""},{default:d(()=>{var W,ie;return[n(j,{modelValue:i.value.subject,"onUpdate:modelValue":R[14]||(R[14]=ye=>i.value.subject=ye),onFocus:R[15]||(R[15]=ye=>D("subject"))},null,8,["modelValue"]),n(fl,{"validation-errors":(ie=(W=b.value)==null?void 0:W.subject)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o("div",null,[n(Wl,{ref_key:"wpEditor",ref:a,"short-codes":m.value,buttons:y.value,onOnEditorReady:Q,onUpdate:R[18]||(R[18]=W=>{i.value.content=W}),modelValue:i.value.content,"onUpdate:modelValue":R[19]||(R[19]=W=>i.value.content=W)},{action:d(()=>[o("div",NX,[n(X,{onChange:R[16]||(R[16]=W=>{var ie;(ie=a.value)==null||ie.setContent(W)}),placeholder:O.$t("Select button"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(y.value,(W,ie)=>(r(),E(z,{key:ie,label:Object.keys(W)[0],value:Object.values(W)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",KX,[n(X,{onChange:R[17]||(R[17]=W=>{F(W)}),placeholder:O.$t("Select template"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(g.value,(W,ie)=>(r(),E(z,{key:ie,label:W.label,value:W.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),o("span",null,[n(N,{effect:"dark",content:O.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{onClick:Ne(M,["prevent"]),tag:"button"},{default:d(()=>[n(J,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:d(()=>[A(v)!==null?(r(),E(N,{key:0,effect:"dark",content:O.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{onClick:Ne(I,["prevent"]),tag:"button"},{default:d(()=>[n(J,{name:"Eye"})]),_:1})]),_:1},8,["content"])):B("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",GX,[n(G,{onClick:S,type:"primary",disabled:l.value,loading:l.value},{default:d(()=>[L(f(O.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class zX extends Fs{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"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Title"),value:"title"},{label:u("Created At"),value:"created_at"}]}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 qX(e){return zX.init(e)}const YX={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},WX={class:"fct-table-mobile-header"},XX={class:"fct-table-date-col"},JX={class:"mark-read-unread-wrap"},ZX=["onClick","title"],eJ=["onClick","title"],tJ=["title"],aJ={class:"fct-table-mobile-body"},lJ={key:0,class:"fct-table-title-col"},sJ={key:1,class:"fct-table-content-col"},nJ={class:"fct-table-mobile-footer"},oJ={class:"fct-table-mobile-footer-row"},iJ={class:"fct-table-status-col"},rJ={class:"title"},dJ={class:"fct-table-module-col"},uJ={class:"title"},cJ={class:"value"},AJ={key:0,class:"fct-table-actions-col"},pJ={class:"title"},fJ={__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",YX,[(r(!0),h(H,null,ae(e.table.getTableData(),(m,_)=>(r(),h("div",{key:m.id,class:"fct-table-mobile-row"},[o("div",WX,[o("div",XX,[o("div",JX,[m.read_status!=="unread"?(r(),h("span",{key:0,onClick:g=>l(m,"unread"),title:A(u)("Mark as unread")},[n(c,null,{default:d(()=>[n(A(Bo))]),_:1})],8,ZX)):(r(),h("span",{key:1,onClick:g=>l(m,"read"),title:A(u)("Mark as read")},[n(c,null,{default:d(()=>[n(A(ti))]),_:1})],8,eJ))]),o("div",{title:A(u)("Logs ID: %s",m.id),class:"invoice-no"}," #"+f(m.id),9,tJ),e.table.isColumnVisible("date")?(r(),h(H,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),n(Na,{class:"date","date-time":m.created_at,"with-time":!0},null,8,["date-time"])],64)):B("",!0)])]),o("div",aJ,[e.table.isColumnVisible("title")?(r(),h("div",lJ,f(m.title),1)):B("",!0),e.table.isColumnVisible("content")?(r(),h("div",sJ,f(m.content),1)):B("",!0)]),o("div",nJ,[o("div",oJ,[o("div",iJ,[o("div",rJ,f(A(u)("Status")),1),(r(),E(fa,{status:m.status,size:"small",key:m.id},null,8,["status"]))]),o("div",dJ,[o("div",uJ,f(A(u)("Module")),1),o("div",cJ,f(m.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",AJ,[o("div",pJ,f(A(u)("Actions")),1),m.module_id&&m.module_name.toLowerCase()==="order"?(r(),E(p,{key:0,class:"value",to:{name:"view_order",params:{order_id:m.module_id}}},{default:d(()=>[L(f(A(u)("View")),1)]),_:2},1032,["to"])):B("",!0),m.module_id&&m.module_name.toLowerCase()==="subscription"?(r(),E(p,{key:1,class:"value",to:{name:"view_subscription",params:{subscription_id:m.module_id}}},{default:d(()=>[L(f(A(u)("View")),1)]),_:2},1032,["to"])):B("",!0)])):B("",!0)])])]))),128))])}}},mJ={},hJ={class:"px-4 py-3"},_J={class:"grid grid-cols-3 gap-5 mt-5"};function vJ(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",hJ,[(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",_J,[(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 gJ=st(mJ,[["render",vJ]]),yJ={class:"table-cell"},bJ={class:"table-cell"},wJ={class:"table-cell"},CJ={class:"table-cell"},kJ={class:"table-cell"},BJ={class:"table-cell"},xJ={class:"table-cell"},SJ={__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"),m=C("el-table");return r(),E(m,{data:A(a),class:"w-full compact-table full-compact"},{default:d(()=>[n(p,{width:143,label:A(u)("ID")},{default:d(()=>[o("div",yJ,[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",bJ,[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",wJ,[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",CJ,[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",kJ,[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",BJ,[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",xJ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},FJ={class:"fct-all-logs-page fct-layout-width"},$J={key:1},EJ={class:"inline-flex items-center gap-1"},UJ=["onClick","title"],IJ=["onClick","title"],QJ={__name:"Logs",setup(e){const t=qt().ctx,a=qX(),l=T([]),s=(i,c)=>{t.$put("activity/"+i.id+"/mark-read",{id:i.id,status:c}).then(p=>{l.value.find(m=>m.id===i.id).read_status=c,t.handleSuccess(p)}).catch(p=>{var m;p.status_code=="422"?Y.validationErrors(p):Y.error((m=p.data)==null?void 0:m.message)})};return a.onDataLoaded(function(){l.value=a.getTableData()}),(i,c)=>{const p=C("el-icon"),m=C("el-table-column"),_=C("el-button"),g=C("el-table");return r(),h("div",FJ,[n(sl,{title:A(u)("Logs")},null,8,["title"]),n($s,{table:A(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(a).isLoading()?(r(),E(gJ,{key:0})):B("",!0),A(a).isLoading()?B("",!0):(r(),E(fJ,{key:1,table:A(a),onChangeStatus:s},null,8,["table"]))]),default:d(()=>[A(a).isLoading()?(r(),E(SJ,{key:0,logTable:A(a),"next-page-count":A(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",$J,[n(g,{class:"w-full",data:A(a).getTableData()},{empty:d(()=>[n(bt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any logs matching your filter.")},null,8,["text"])]),default:d(()=>[n(m,{label:A(u)("ID"),width:100},{default:d(y=>[o("div",EJ,[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(Bo))]),_:1})],8,UJ)):(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(ti))]),_:1})],8,IJ)),L(" #"+f(A(Zt)(y.row.id)),1)])]),_:1},8,["label"]),A(a).isColumnVisible("date")?(r(),E(m,{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(m,{key:1,label:A(u)("Title"),width:200},{default:d(y=>[L(f(y.row.title),1)]),_:1},8,["label"])):B("",!0),A(a).isColumnVisible("content")?(r(),E(m,{key:2,label:A(u)("Content"),width:200},{default:d(y=>[L(f(y.row.content),1)]),_:1},8,["label"])):B("",!0),n(m,{label:A(u)("Status"),width:100},{default:d(y=>[(r(),E(fa,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),n(m,{label:A(u)("Module"),width:100},{default:d(y=>[L(f(y.row.module_name),1)]),_:1},8,["label"]),A(a).isColumnVisible("actions")?(r(),E(m,{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(()=>[L(f(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(()=>[L(f(A(u)("View")),1)]),_:2},1032,["to"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},DJ=["title"],VJ={__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,DJ))}},TJ={__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"])}}},Op={__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=T(null),c=K({get:()=>a.modelValue,set:g=>l("update:modelValue",g)}),p=K(()=>je.get("app_config.isProActive"));function m(g){l("change",g)}function _(){s.data.dateRange=[Aa.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],l("change",s.data.dateRange)}return vl(()=>{}),(g,y)=>{const v=C("el-date-picker"),w=Ma("translate-numbers");return r(),h("div",{class:re(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Gt(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(Hc),onChange:m,placement:e.placement,disabled:e.disabled||!p.value},null,8,["modelValue","type","range-separator","start-placeholder","end-placeholder","unlink-panels","clearable","shortcuts","placement","disabled"]),[[w,"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)}}},Hp={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=K({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=c=>{l("change",c)};return(c,p)=>{const m=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(m,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},MJ={__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"},f(l.$t("Reset Filters")),1))}},LJ={__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=K({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]=m=>l.value=m),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,m=>(r(),E(c,{key:m.value,label:m.label,value:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},RJ={class:"fct-compare-to-filter"},OJ={class:"fct-applied-filter-label"},HJ={class:"fct-applied-filter-actions"},PJ={class:"fct-compare-to-select"},NJ={class:"fct-compare-to-date"},KJ={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=K({get:()=>{var m;return((m=s.data.selectedFilters.compareType)==null?void 0:m.value)??s.data.compareType},set:m=>{s.setCompareTypeChange(m),l("selectChange",m)}}),c=K({get:()=>{var m;return((m=s.data.selectedFilters.compareDate)==null?void 0:m.value)??s.data.compareDate},set:m=>{s.setCompareDateChange(m),l("dateChange",m)}}),p=K(()=>je.get("app_config.isProActive"));return(m,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-date-picker");return r(),h("div",RJ,[o("div",OJ,f(A(u)("Compare to")),1),o("div",HJ,[o("div",PJ,[n(y,{modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=w=>i.value=w),"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",NJ,[i.value==="custom"?(r(),E(v,{key:0,modelValue:c.value,"onUpdate:modelValue":_[1]||(_[1]=w=>c.value=w),type:"date",size:"small",placeholder:A(u)("Select Date")},null,8,["modelValue","placeholder"])):B("",!0)])])])}}},GJ={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},jJ={key:0},Pp={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,l=T([]),s=T([]),i=T(!1),c=qt().ctx,p=v=>{const w=Ot.get("product_variations");if(w&&(l.value=w),l.value.length&&!v){s.value=[...l.value];return}if(v&&l.value.length){s.value=l.value.filter(k=>k.label.toLowerCase().includes(v.toLowerCase()));return}i.value=!0,c.$get("products/searchVariantByName",{name:v}).then(k=>{l.value=k,s.value=k,Ot.set("product_variations",k)}).catch(()=>{}).finally(()=>{i.value=!1})},m=(v,w)=>{const k=w.checkedNodes||[];a.setTreeSelectItem(k)},_=v=>{a.removeTreeSelectItem(v)},g=()=>{a.clearTreeSelect()},y=K(()=>{let v={},w={};s.value.forEach(b=>{v[b.label]=b.children,b.children.forEach(x=>{w[x.value]={productName:b.label,variationName:x.label}})});let k={};return a.data.variation_ids.forEach(b=>{if(w[b]){let x=w[b];k[x.productName]||(k[x.productName]=[]),k[x.productName].push(x.variationName)}else k.Unknown||(k.Unknown=[]),k.Unknown.push(b)}),Object.keys(k).forEach(b=>{var x;k[b].length===((x=v[b])==null?void 0:x.length)&&(k[b]=[])}),k});return Ie(()=>{const v=a.retrieveSavedReportFilters();v&&v.variation_ids&&(a.data.variation_ids=v.variation_ids),p("")}),(v,w)=>{const k=C("el-tag"),b=C("el-tree-select");return r(),E(b,{placeholder:v.$t("Select Products"),modelValue:A(a).data.variation_ids,"onUpdate:modelValue":w[0]||(w[0]=x=>A(a).data.variation_ids=x),data:s.value,"filter-method":A(ld).debounce(p),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:i.value,onCheck:m,"popper-class":"fct-tooltip-long",onRemoveTag:_,onClear:g,size:"small"},{tag:d(()=>[o("div",GJ,[(r(!0),h(H,null,ae(y.value,(x,F)=>(r(),E(k,{style:{"margin-right":"4px"}},{default:d(()=>[L(f(F)+" ",1),x.length?(r(),h("span",jJ," | "+f(x.join(", ")),1)):B("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},zJ={class:"fct-applied-filters-wrap"},qJ={class:"fct-applied-filter-list"},YJ={class:"fct-applied-filter fct-applied-filter-date"},WJ={class:"fct-applied-filter-label"},XJ={class:"fct-applied-filter-value"},JJ={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},ZJ={class:"fct-applied-filter-label"},eZ={class:"fct-applied-filter-value"},tZ={key:2,class:"fct-applied-filter-clear-wrap"},aZ={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=ll(),s=({filterKey:m,itemId:_})=>{a.removeFilter(m,_)},i=m=>!(["dateRange","compareType","compareDate"].includes(m)||l.name==="reports_customer"),c=K(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(l.name)),p=K(()=>Object.keys(a.data.selectedFilters).filter(m=>!(m==="orderTypes"&&l.name==="reports_subscriptions")).reduce((m,_)=>(m[_]=a.data.selectedFilters[_],m),{}));return be(a.data.dateRange,m=>{}),(m,_)=>(r(),h("div",zJ,[o("ul",qJ,[o("li",YJ,[o("div",WJ,f(m.$t("Date:")),1),o("div",XJ,[n(Op,{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",JJ,[n(KJ,{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:re(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",ZJ,f(g.label)+":",1),o("div",eZ,[g.type==="list"?(r(),E(TJ,{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(LJ,{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(Pp,{key:2,"filter-state":A(a)},null,8,["filter-state"])):y==="currency"?(r(),E(Hp,{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(VJ,{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",tZ,[n(MJ,{"filter-state":A(a)},null,8,["filter-state"])])):B("",!0)])]))}},lZ={class:"fct-filter-dropdown-header"},sZ={key:0,class:"fct-filter-back-wrapper"},nZ={class:"fct-filter-active-label"},oZ={key:1,class:"fct-filter-dropdown-search-input"},iZ={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>{const i=C("el-input");return r(),h("div",lZ,[A(a).data.activeFilter!=null?(r(),h("div",sZ,[o("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=c=>A(a).selectActiveFilter(null))},[n(J,{name:"ArrowLeft"})]),o("span",nZ,f(A(a).activeFilterOptions.label),1)])):(r(),h("div",oZ,[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"])]))])}}},rZ={class:"fct-filter-dropdown-active-filter-list"},dZ=["onClick"],uZ={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",rZ,[(r(!0),h(H,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:re(["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)},f(i.label),9,dZ)],2))),128))]))}},cZ={class:"fct-filter-dropdown-active-filter-list is-multi-list"},AZ=["onClick"],pZ={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",cZ,[(r(!0),h(H,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:re(["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)},f(i.label),9,AZ)],2))),128))]))}},fZ={class:"fct-filter-dropdown-active-filter"},mZ={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("div",fZ,[A(a).activeFilterOptions.type==="list"?(r(),E(uZ,{key:0,"filter-state":A(a)},null,8,["filter-state"])):B("",!0),A(a).activeFilterOptions.type==="multi-list"?(r(),E(pZ,{key:1,"filter-state":A(a)},null,8,["filter-state"])):B("",!0),A(a).activeFilterOptions.type==="date"?(r(),E(Op,{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(Hp,{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(Pp,{key:4,"filter-state":A(a)},null,8,["filter-state"])):B("",!0)]))}},hZ={class:"fct-filter-dropdown-list"},_Z=["onClick"],vZ={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},gZ={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",hZ,[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"]),L(" "+f(i.label),1)],8,_Z)]))),128)):(r(),h("li",vZ,f(A(a).data.searchQuery?A(u)("No filter found"):A(u)("All filters selected")),1))]))}},yZ={key:0,class:"fct-filter-dropdown"},bZ={class:"fct-filter-dropdown-body"},wZ={key:1},CZ={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=T(null),l=t.filterState,s=je.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 m=a.value,_=p.target,g=document.querySelectorAll(".el-picker-panel"),y=Array.from(g).some(v=>v.contains(_));m!=null&&m.contains(_)||y||(l.data.searchQuery="",l.dropdownOpen&&l.toggleDropdown())};return Ie(()=>{document.addEventListener("click",c)}),vl(()=>{document.removeEventListener("click",c)}),(p,m)=>(r(),h("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:m[0]||(m[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(Gl,{name:"fade-scale","enter-active-class":"transition ease-out duration-200","leave-active-class":"transition ease-in duration-150","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:d(()=>[A(l).dropdownOpen?(r(),h("div",yZ,[A(s)?(r(),h(H,{key:0},[n(iZ,{"filter-state":A(l)},null,8,["filter-state"]),o("div",bZ,[A(l).data.activeFilter!=null?(r(),E(mZ,{key:0,"filter-state":A(l)},null,8,["filter-state"])):(r(),E(gZ,{key:1,"filter-state":A(l)},null,8,["filter-state"]))])],64)):(r(),h("div",wZ,[n(ln,{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))}},kZ={class:"fct-report-nav-links-wrap"},BZ={class:"fct-settings-nav-collapse-button-wrapper"},xZ={class:"fct-menu-collapse-button-text"},SZ=["onClick"],FZ=["src","alt"],$Z=["src","alt"],EZ={class:"fct-settings-nav-link-text"},UZ={class:"fct-settings-nav-child-list"},IZ=["onClick"],QZ={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=al(),l=ll(),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"}];je.get("addon_report_sidebar",[]).forEach(I=>s.push(I));const i=T(!1),c=T(!1),p=T(window.innerWidth>=1024),m=t,_=T(null),g=T(null),y=I=>!I.child||!(!$.value||S.value)?!1:v(I)||I.always_open,v=I=>{const Q=l.path;return!!(I.child&&I.child.length&&I.child.some(V=>Q===V.url||Q.includes(V.url))||Q===I.url||Q.includes(I.url))},w=(I,Q,D)=>l.path===I.url,k=I=>{a.push({name:I.route}).catch(D=>{D.name});const Q=document.querySelector("#fct-report-body");Q&&(Q.scrollTop=0)},b=()=>{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},x=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},F=()=>{const I=window.innerWidth,Q=p.value;p.value=I>=1024,!Q&&p.value&&(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open")),Q&&!p.value&&(i.value=!1)};be([i,c,p],()=>{m("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:c.value,isDesktopView:p.value})},{immediate:!0});const $=K(()=>i.value),S=K(()=>p.value&&i.value&&c.value);return Ie(()=>{F(),window.addEventListener("resize",F)}),Bt(()=>{window.removeEventListener("resize",F)}),(I,Q)=>{const D=C("el-button"),V=C("el-tooltip");return r(),h("div",kZ,[o("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:x},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:re(["fct-settings-nav-container",{"is-collapsed":$.value,"is-expanded":S.value}])},[o("div",BZ,[n(V,{content:A(u)("Toggle reports"),placement:"right"},{default:d(()=>[n(D,{onClick:b},{default:d(()=>[n(J,{name:"Window"}),o("span",xZ,f(A(u)("Reports")),1)]),_:1})]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:Q[0]||(Q[0]=U=>p.value&&i.value&&(c.value=!0)),onMouseleave:Q[1]||(Q[1]=U=>c.value=!1)},[(r(),h(H,null,ae(s,(U,O)=>o("li",{key:O,class:re(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(U)}])},[o("div",{onClick:R=>k(U),class:"fct-settings-nav-link"},[U.icon_img?(r(),h(H,{key:0},[o("img",{src:U.icon_img,alt:U.label,class:re(U.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,FZ),U.icon_img_dark?(r(),h("img",{key:0,src:U.icon_img_dark,alt:U.label,class:"w-5 h-5 hidden dark:block"},null,8,$Z)):B("",!0)],64)):U.icon?(r(),E(J,{key:1,name:U.icon,class:"w-5 h-5"},null,8,["name"])):B("",!0),o("span",EZ,[L(f(U.label)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,SZ),n(va,{accordion:"",visible:y(U),class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",UZ,[(r(!0),h(H,null,ae(U.child,(R,P)=>(r(),h("li",{key:P,class:re(["fct-settings-nav-item",{"fct-settings-nav-item-active":w(R,P,U)}])},[o("div",{onClick:j=>k(R),class:"fct-settings-nav-link"},f(R.label),9,IZ)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},DZ={class:"fct-reports-view-inner"},VZ={class:"fct-report-body",id:"fct-report-body"},TZ={key:0,class:"fct-report-filter-wrap"},MZ={key:1,class:"fct-report-filter-button"},LZ={class:"fct-report-body-inner"},RZ={__name:"ReportsView",setup(e){var v;const t=T({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=_p(),l=ll(),s=T((v=l.meta)==null?void 0:v.title),i=K(()=>Ya.data);a.onFilterChanged(w=>{_(w)});const c=K(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(l.name)),p=K(()=>["reports_overview","reports","future_renewals"].includes(l.name));let m=null;const _=w=>{Object.entries(w).forEach(([k,b])=>{let x=b.value;switch(b.type==="multi-list"&&(x=b.value.map(F=>F.value)),k){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":Ya.data[k]=x;break;case"dateRange":Ya.data.dateRange=b.value,Ya.data.rangeKey=b.rangeKey;break;case"variation_ids":Ya.data[k]=Array.isArray(b.value)?b.value.map(F=>F.id):[];break}}),Ya.onFilterChange()},g=()=>{var k,b;const w=a.retrieveSavedFilters();w?(a.data.selectedFilters={...w},((b=(k=w.dateRange)==null?void 0:k.value)==null?void 0:b.length)===2&&(a.data.dateRange=[w.dateRange.value[0],w.dateRange.value[1]])):a.data.selectedFilters={}},y=w=>{t.value=w};return be(()=>l.name,(w,k)=>{var b;s.value=((b=l.meta)==null?void 0:b.title)||"Reports"}),Ie(()=>{Ya.fetchReportMeta(),g(),m=document.getElementById("fluent_cart_plugin_app"),m&&m.classList.add("fct_report_page_plugin_app_wrap")}),Bt(()=>{m&&m.classList.remove("fct_report_page_plugin_app_wrap")}),vl(()=>{Ot.remove("product_variations")}),(w,k)=>{const b=C("router-view");return r(),h("div",{class:re(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",DZ,[n(QZ,{"onUpdate:menuState":y}),o("div",VZ,[n(Qa,{heading:A(u)(s.value),"show-save-button":!1},null,8,["heading"]),!p.value||c.value?(r(),h("div",TZ,[p.value?B("",!0):(r(),E(aZ,{key:0,"filter-state":A(a)},null,8,["filter-state"])),!p.value&&c.value?(r(),h("div",MZ,[n(CZ,{"filter-state":A(a)},null,8,["filter-state"])])):B("",!0)])):B("",!0),o("div",LZ,[n(Da),i.value.storeMode!==i.value.filterMode&&i.value.filterMode&&i.value.filterMode!==""?(r(),E(Ja,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:w.$t(`Your store is in ${i.value.storeMode} mode but you are watching data in ${i.value.filterMode} mode.`)},null,8,["content"])):B("",!0),n(b,null,{default:d(({Component:x})=>[(r(),E(Cl(x),{reportFilter:A(Ya)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},OZ=st(RZ,[["__scopeId","data-v-15c60072"]]),HZ={__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=T(null),l=(y,v,w,k)=>({name:y,type:v,data:w,smooth:!0,color:k,showSymbol:!0,areaStyle:{color:new nr(0,0,0,1,t.backgroundGradient.map(b=>({offset:b.offset,color:b.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[w,k,b]=v;return`${Pa[parseInt(k)-1]} ${b}, ${w}`}else if(v.length===2){const[w,k]=v;return`${Pa[parseInt(k)-1]} ${w}`}else if(v.length===1){const[w]=v;return`${w}`}},c=K(()=>t.xAxis.map(y=>i(y)));let p=null;const m=()=>{if(a.value&&p==null){p=ea(a.value);const y={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?`${et.scaled(v)}`: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],()=>{Be(()=>{_()})});const g=()=>{_()};return Ie(()=>{window.addEventListener("fluentCartCurrencyChange",g),Be(()=>{m()})}),Bt(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},PZ=st(HZ,[["__scopeId","data-v-e1491f3e"]]);function Np(e){return Number(e)>0}function is(e){return Np(e)?"text-red-500":""}function xl(e,t=null){return(t!==null?t:Np(e))?`(${et.scaled(e)})`:et.scaled(e)}const NZ=["innerHTML"],Is={__name:"ReportSummary",props:{amount:{type:[Number,String],required:!0},placement:{type:String,default:"top"},title:{type:String,default:""}},setup(e){const t=e,a=K(()=>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,f(a.value),1)]),default:d(()=>[o("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,NZ)]),_: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=K(()=>ua(t.fluctuation)),l=K(()=>(t.hasCurrency?et.scaled:ua)(t.amount)),s=K(()=>(t.title?t.title:u("Previously"))+" "+l.value+(t.isPercentage?"%":"")),i=K(()=>{if(t.fluctuation===0)return"text-system-light";const p=t.fluctuation>0;return(t.isLiability?!p:p)?"text-success-500":"text-red-500"}),c=K(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(p,m)=>{const _=C("el-tooltip");return r(),h("div",{class:re(["percentage",i.value])},[e.fluctuation!==0?(r(),E(J,{key:0,class:"w-2",name:c.value},null,8,["name"])):B("",!0),n(_,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[o("span",null,f(s.value),1)]),default:d(()=>[o("span",{class:re(["cursor-pointer",i.value])},[L(f(a.value)+"% ",1),e.fluctuationSuffix?(r(),h(H,{key:0},[L(f(e.fluctuationSuffix),1)],64)):B("",!0)],2)]),_:1},8,["placement"])],2)}}},KZ={class:"fct-report-result"},GZ={key:0,class:"fct-report-result-content"},jZ={key:1,class:"fct-report-result-content"},zZ={class:"title flex items-center gap-1"},qZ={class:"value"},YZ={class:"inline-flex"},WZ={key:2,class:"fct-report-result-chart"},XZ={key:3,class:"fct-report-result-chart"},JZ={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;K(()=>reportFilter.currentCurrencySign),K(()=>defaultReport.data.isBusy.salesReport);const a=(m,_)=>{const g=parseInt(m.replace("#",""),16),y=g>>16&255,v=g>>8&255,w=g&255;return`rgba(${y}, ${v}, ${w}, ${_})`},l=Ve.colors.report,s=T([{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=K(()=>s.value.map(m=>({...m,value:t.defaultReport.summaryData[m.key]||0,fluctuation:t.defaultReport.fluctuations[m.key]||0,graph:t.defaultReport.data.graphs[m.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[m.graph]||!1,liability:m.liability||!1}))),c=m=>["net_revenue","total_refunded_amount","gross_sale"].includes(m),p=m=>c(m.key)?xl(m.value,m.liability):ua(m.value);return(m,_)=>{const g=C("el-skeleton"),y=C("el-tooltip"),v=C("el-skeleton-item"),w=C("el-col"),k=C("el-row");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[n(k,{gutter:16,class:"gap-y-4"},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(b,x)=>(r(),E(w,{lg:8,md:12,key:x},{default:d(()=>[n(Ln,{class:"fct-report-summary-card h-[100px]"},{default:d(()=>[o("div",KZ,[b.dataBusy?(r(),h("div",GZ,[n(g,{animated:"",rows:1})])):(r(),h("div",jZ,[o("div",zZ,[L(f(b.title)+" ",1),n(y,{"popper-class":"fct-tooltip",content:b.info,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",qZ,[o("div",YZ,[n(Is,{amount:p(b),title:b.title},null,8,["amount","title"])]),n(ml,{fluctuation:b.fluctuation,amount:e.defaultReport.data.previousSummary[b.key],"is-liability":b.liability,"has-currency":c(b.key)},null,8,["fluctuation","amount","is-liability","has-currency"])])])),b.dataBusy?(r(),h("div",WZ,[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),!b.dataBusy&&Object.keys(b.graph).length>0?(r(),h("div",XZ,[n(PZ,{ref_for:!0,ref:"lineChart",xAxis:Object.keys(b.graph),yAxis:Object.values(b.graph),lineColor:b.lineColor,backgroundGradient:b.backgroundGradient,"has-currency":c(b.key)},null,8,["xAxis","yAxis","lineColor","backgroundGradient","has-currency"])])):B("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const ZZ={key:0,class:"fct-report-sold-product-list has-scroll"},eee={class:"list-left-content"},tee={class:"list-image"},aee=["src","alt"],lee=["src"],see={class:"list-title"},nee={class:"list-title-inner"},oee={class:"list-id"},iee={class:"list-right-content"},ree={class:"list-value"},dee={class:"list-price"},uee={class:"inline-flex"},cee={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=$l.data,a=K(()=>$l.data.isBusy.topSoldVariants);return(l,s)=>{const i=C("el-skeleton"),c=C("router-link");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[n(Ln,{class:"top-sold-variants","card-options":{heading:A(u)("Top Sold Variants")}},{default:d(()=>{var p,m;return[a.value?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[((m=(p=A(t))==null?void 0:p.topSoldVariants)==null?void 0:m.length)>0?(r(),h("ul",ZZ,[(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",eee,[o("div",tee,[_.media_url!==null?(r(),h("img",{key:0,src:_.media_url,alt:(g=_.media)==null?void 0:g.title},null,8,aee)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,lee))]),o("div",see,[o("div",nee,f(_.variation_name),1),o("div",oee,[o("strong",null,f(_.product_name),1)])])]),o("div",iee,[o("div",ree,f(_.quantity)+" "+f(A(u)(" Sold")),1),o("div",dee,[o("div",uee,f(A(et).scaled(_.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),E(bt,{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})}}},Aee={key:0,class:"flex items-center gap-2 justify-between"},pee={class:"fct-btn-group sm"},fee={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=Ve.colors,l=T(null),s=T(Ve.isDark()),i=T("revenue"),c=T({}),p=F=>{const M=["#F6B51E","#855EF8","#47C2FF"],$=["#E6A819","#693EE0","#35ADE9"];return(s.value?$:M)[F]},m=K(()=>{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 F={onetime:u("Onetime Payments"),renewal:u("Renewals"),subscription:u("Subscriptions")},M=t.data.order_count,$=[];return Object.keys(F).forEach((S,I)=>{$.push({name:F[S],value:t.data[S+"_count"]||0,count:t.data[S+"_count"]||0,gross:t.data[S+"_gross"]||0,net:t.data[S+"_net"]||0,percentage:M?(t.data[S+"_count"]/M*100).toFixed(2):0,color:p(I),visible:c.value[F[S]]!==!1})}),$}),_=K(()=>!m.value.length),g=K(()=>$l.data.isBusy.salesReport),y=K(()=>m.value.filter(F=>c.value[F.name]!==!1).map((F,M)=>({value:i.value==="revenue"?F.net:F.count,count:F.count,name:F.name,gross:F.gross,net:F.net,itemStyle:{color:p(m.value.findIndex($=>$.name===F.name))}})));let v=null;const w=()=>{v&&(v.dispose(),v=null),Be(()=>{l.value&&(v=ea(l.value),k())})},k=()=>{if(!v)return;const F={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",formatterr:"{b}: {c} ({d}%)",formatter:function(M){const $=s.value?"#ffffff":"#565865";return`
154 <div style="font-weight: bold; margin-bottom: 4px;">
155 ${M.marker} ${M.name} (${M.percent}%)
156 </div>
157 <div>
158 <span style="color: ${$};">${u("Orders")}</span>
159 <span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};">
160 ${ua(M.data.count)}
161 </span>
162 </div>
163 <div>
164 <span style="color: ${$};">${u("Gross Sales")}</span>
165 <span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};">
166 ${et.scaled(M.data.gross)}
167 </span>
168 </div>
169 <div>
170 <span style="color: ${$};">${u("Revenue")}</span>
171 <span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};">
172 ${et.scaled(M.data.net)}
173 </span>
174 </div>
175 `},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(F,{notMerge:!0,replaceMerge:["series"]})};be([()=>m.value],()=>{Be(k)},{deep:!0}),be(_,F=>{F||w()}),be(g,F=>{F||w()}),be(i,()=>{k()});const b=F=>{s.value=Ve.isDark(),k()},x=()=>{k()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",x),Be(w)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),(F,M)=>{const $=C("el-button"),S=C("el-button-group"),I=C("el-skeleton");return r(),E(Ln,{class:"sales-sources","card-options":{heading:A(u)("Sources")}},{action:d(()=>[_.value?B("",!0):(r(),h("div",Aee,[n(S,{class:"left"},{default:d(()=>[n($,{size:"small",onClick:M[0]||(M[0]=Q=>i.value="revenue"),type:i.value==="revenue"?"primary":""},{default:d(()=>[L(f(A(u)("Revenue")),1)]),_:1},8,["type"]),n($,{size:"small",onClick:M[1]||(M[1]=Q=>i.value="orders"),type:i.value==="orders"?"primary":""},{default:d(()=>[L(f(A(u)("Orders")),1)]),_:1},8,["type"])]),_:1}),o("div",pee,[n(Fa,{targetRef:l.value},null,8,["targetRef"])])]))]),default:d(()=>[g.value?(r(),E(I,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[_.value?(r(),E(bt,{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"])}}},mee={class:"fct-default-report-page"},hee={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T(t.reportFilter),l=async s=>{s&&(await $l.getSalesReport(s),await $l.getTopSoldProducts(s),await $l.getTopSoldVariants(s))};return Ie(()=>{a.value&&a.value.addListener("default-report",l)}),Bt(()=>{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",mee,[n(JZ,{"default-report":A($l)},null,8,["default-report"]),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(gd,{data:A($l).data.topSoldProducts,loading:A($l).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(cee,{"default-report":A($l)},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(fee,{data:A($l).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class _ee extends nl{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=Ot.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(){Ot.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 Ml=_ee.init(),vee={class:"fct-revenue-line-chart-wrap"},gee={class:"flex items-center gap-2"},yee={class:"fct-card-header-title is-small"},bee={class:"fct-chart-select"},wee={class:"fct-btn-group sm"},Cee={key:2,class:"chart-action-wrap"},kee={class:"chart-change-wrap"},Bee={class:"chart-change"},xee={class:"text"},See={class:"chart-change"},Fee={class:"text"},$ee={__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=T(null),s=T(ga.getChartType("revenue","revenue_chart")||"line"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(D,V,U,O,R,P=!1)=>({name:D,type:V,barMaxWidth:30,yAxisIndex:U,data:O,smooth:!1,color:R,hidden:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:R},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:R,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(R)},lineStyle:{color:R},areaStyle:{opacity:.3,color:R}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);be(()=>a.appliedGroupKey,D=>{_.value=D});const g=[{label:u("Default"),value:"default"},{label:u("Monthly"),value:"monthly"},{label:u("Yearly"),value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{let D=[{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(V=>V.net_revenue)}];return w.value&&D.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(V=>({value:V.net_revenue,date:V.group})),hidden:!1}),D.map(V=>m(V.name,V.type,0,V.data,V.color,V.hidden))});let b=null;const x=()=>{b&&(b.dispose(),b=null),Be(()=>{l.value&&(b=ea(l.value),$())})},F=K(()=>{const D=Es(a.reportFilter.data.dateRange);return u("This report looks at the revenue you received ")+D}),M=K(()=>ul(a.chartData.length)),$=()=>{if(!b)return;const D=Il(a.chartData),V={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(U=>[U.name,!U.hidden]))},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,valueFormatter:U=>`${et.scaled(U)}`,formatter:U=>{let O="";const R=p.value?"#ffffff":"#565865";return U.forEach(function(P,j){const z=typeof P.data=="object"&&P.data!==null?Us(P.data.date):P.name,X=et.scaled(P.value),ne=U.length>1&&j===0;ne&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${z}</div>`,O+=`<div>
176 ${P.marker}
177 <span style="color: ${R}">${P.seriesName}</span>
178 <span style="float: right; margin-left: 20px; color: ${R}">
179 ${ua(X)}
180 </span>
181 </div>`,ne&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,formatter:U=>`${et.scaled(U)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:k.value};b.setOption(V,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value?b.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}]}):$()},I=D=>{ga.onChange("revenue","revenue_chart",D),s.value!==D&&(i.value=!1,s.value=D,$())};be([()=>a.chartData,_],()=>{Be($)},{deep:!0}),be(()=>Ml.data.revenue,()=>{Be(()=>{$()})},{deep:!0}),be(()=>a.isEmpty,D=>{D||x()}),be(()=>a.loading,D=>{D||x()});const Q=()=>{p.value=Ve.isDark(),Be(()=>{$()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),window.addEventListener("fluentCartCurrencyChange",Q),Be(()=>{x()})}),(D,V)=>{const U=C("el-tooltip"),O=C("el-option"),R=C("el-select"),P=C("el-skeleton");return r(),h("div",vee,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",gee,[o("h5",yee,f(A(u)("Revenue Chart")),1),n(U,{"popper-class":"fct-tooltip",content:F.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",bee,[n(R,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":V[0]||(V[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,j=>n(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",wee,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:re(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(bt,{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",Cee,[o("div",kee,[o("div",Bee,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",xee,f(A(u)("Data")),1)]),o("div",See,[o("span",Fee,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Eee={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]),m=[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});m.push(g.join(","))}),m.join(`
182 `)})(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 Uee(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"}),L(" "+f(e.$t("Export")),1)]),_:1},8,["onClick"])}const On=st(Eee,[["render",Uee]]),Iee=["innerHTML"],Qee=["innerHTML"],Dee=["innerHTML"],Vee=["innerHTML"],Tee=["innerHTML"],Mee=["innerHTML"],Lee=["innerHTML"],Ree=["innerHTML"],Oee={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 et.scaled(e)},liabilityClass:is,maybeLiability:xl}},Hee=Object.assign(Oee,{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(xe,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Revenue Breakdown"),title_size:"small"},la({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[n(On,{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(m=>[L(f(A(at)(m.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),n(s,{prop:"order_count",label:A(u)("Order Count"),"min-width":"140"},{default:d(m=>[L(f(A(u)(A(ua)(m.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"total_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.total_sales))},null,8,Iee)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(m=>[o("div",{class:re(["inline-flex",A(is)(m.row.total_refunds)]),innerHTML:A(xl)(m.row.total_refunds)},null,10,Qee)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:0,prop:"total_tax",label:A(u)("Taxes"),"min-width":"150"},{default:d(m=>[o("div",{class:re(["inline-flex",A(is)(m.row.total_tax)])},f(A(xl)(m.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(m=>[o("div",{class:re(["inline-flex",A(is)(m.row.shipping_total)])},f(A(xl)(m.row.shipping_total)),3)]),_:1},8,["label"])):B("",!0),n(s,{prop:"net_revenue",label:A(u)("Revenue"),"min-width":"180"},{default:d(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.net_revenue))},null,8,Dee)]),_: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=>[L(f(A(u)(A(ua)(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,Vee)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(p=>[o("div",{class:re(["inline-flex",A(is)(p.row.total_refunded_amount)]),innerHTML:A(xl)(p.row.total_refunded_amount)},null,10,Tee)]),_: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,Mee)]),_: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,Lee)]),_: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,Ree)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function Vn(e){var t;return((t=em.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const Pee={class:"px-5 pb-4"},Nee={__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",Pee,[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"])}}},Kee={class:"fct-btn-group sm w-[240px] gap-2"},Gee={class:"capitalize"},jee={class:"capitalize"},zee=["innerHTML"],qee=["innerHTML"],Yee=["innerHTML"],Wee=["innerHTML"],Xee=["innerHTML"],Jee={__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;K(()=>a.reportFilter.currentCurrencySign);const s=[{label:"Billing Country",value:"billing_country"},{label:"Shipping Country",value:"shipping_country"},{label:"Payment Method",value:"payment_method"}];T({offline_payment:"Cash On Delivery",paypal:"PayPal",stripe:"Stripe"});const i=T("billing_country"),c=()=>{l("fetch-data-by-group",i.value)};return(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(xe,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:p.$t("Grouped by"),title_size:"small"},{action:d(()=>[o("div",Kee,[n(g,{class:"el-select--x-small",modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=w=>i.value=w),onChange:c,placeholder:p.$t("Select Group")},{default:d(()=>[(r(),h(H,null,ae(s,w=>n(_,{key:w.value,label:p.$t(w.label),value:w.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(On,{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(Nee,{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(bt,{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(w=>[L(f(w.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(w=>[o("span",Gee,f(A(Vn)(w.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(w=>[o("span",jee,f(A(Vn)(w.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(w=>[L(f(w.row.payment_method),1)]),_:1},8,["label"])):B("",!0),n(y,{prop:"order_count",label:p.$t("Order Count"),"min-width":"150"},{default:d(w=>[L(f(A(u)(w.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"total_sales",label:p.$t("Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(et).scaled(w.row.gross_sale)},null,8,zee)]),_:1},8,["label"]),n(y,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:d(w=>[o("div",{class:re(["inline-flex",A(is)(w.row.total_refunds)]),innerHTML:A(xl)(w.row.total_refunds)},null,10,qee)]),_:1},8,["label"]),p.total_tax>0?(r(),E(y,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:d(w=>[o("div",{class:re(["inline-flex",A(is)(w.row.total_tax)]),innerHTML:A(xl)(w.row.total_tax)},null,10,Yee)]),_: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(w=>[o("div",{class:re(["inline-flex",A(is)(w.row.shipping_total)]),innerHTML:A(xl)(w.row.shipping_total)},null,10,Wee)]),_:1},8,["label"])):B("",!0),n(y,{prop:"net_revenue",label:p.$t("Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(et).scaled(w.row.net_sale)},null,8,Xee)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class Zee extends nl{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=Zee.init(),Ll={__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:re(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:ra(`--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})}}},ete={class:"summary-item-inner"},tte={class:"value"},ate={class:"inner-value"},lte={class:"title"},ste={__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=K(()=>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=K(()=>Va.data.isBusy.revenueReport);return(s,i)=>{const c=C("el-tooltip");return l.value?(r(),E(Ll,{key:0,loading:l.value,count:a.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:"fct-report-order-summary",style:ra(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(H,null,ae(a.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",ete,[o("div",tte,[o("div",ate,[n(Is,{amount:A(xl)(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",lte,[L(f(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))}}},nte={name:"Comparison",components:{CardContainer:xe,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 et.scaled(e)}}},ote={class:"fct-revenue-comparison"},ite=["innerHTML"],rte=["innerHTML"];function dte(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",ote,[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(m,{label:i.translate("Period")},{default:d(v=>[L(f(v.row.group),1)]),_:1},8,["label"]),n(m,{label:i.translate("Current Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.net_revenue)},null,8,ite)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(m,{label:i.translate("Compare Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.previous_revenue)},null,8,rte)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:re(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const ute=st(nte,[["render",dte]]),cte={class:"fct-revenue-report-page"},Ate={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T("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))},m=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)}),Bt(()=>{l.removeListener("revenue-report")}),(g,y)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",cte,[n(ste,{reportFilter:A(l)},null,8,["reportFilter"]),n($ee,{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(ute,{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(Hee,{revenueReport:A(Va).data.revenueReport,appliedGroupKey:a.value,onFetchData:c,loading:A(Va).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),n(Jee,{tableData:A(Va).data.netRevenueByGroup,reportFilter:A(l),revenueReport:A(Va),onFetchDataByGroup:m},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class pte extends nl{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=pte.init(),fte={key:1,class:"fct-report-order-summary summary-col-4"},mte={class:"summary-item-inner"},hte={class:"value"},_te={key:0,class:"summary-checkbox"},vte={class:"inner-value"},gte={class:"title"},yte={__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=K(()=>a.map(m=>({...m,value:t.orderReport.data.summary[m.key]||0,fluctuation:t.orderReport.data.fluctuations[m.key]||0,liability:m.liability||!1,hasCurrency:m.hasCurrency||!1}))),s=K(()=>a.filter(m=>!m.hideCurrency).map(m=>m.key)),i=K(()=>t.orderReport.data.isBusy.orderChartData),c=m=>{Ml.onCheckBoxChange("order",m)},p=m=>s.value.includes(m.key)?xl(m.value,m.liability):ua(m.value);return(m,_)=>{const g=C("el-checkbox"),y=C("el-tooltip");return i.value?(r(),E(Ll,{key:0,count:4,rows:2})):(r(),h("div",fte,[(r(!0),h(H,null,ae(l.value,(v,w)=>(r(),h("div",{class:"summary-item",key:w},[o("div",mte,[o("div",hte,[v.checkable?(r(),h("div",_te,[n(g,{"true-value":!0,"false-value":!1,"model-value":A(Ml).data.order.includes(v.key),onChange:()=>c(v.key)},null,8,["model-value","onChange"])])):B("",!0),o("div",vte,[n(Is,{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",gte,[L(f(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))]))}}},bte={__name:"OrderHeatMap",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;const s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=Ve.colors,c=T(Ve.isDark()),p=K(()=>{const k=[];return t.chartData.forEach((b,x)=>{s.forEach((F,M)=>{k.push([x,M,b[F]])})}),k}),m=K(()=>t.chartData.length?Math.max(...t.chartData.flatMap(k=>s.map(b=>k[b]||0))):0),_=K(()=>c.value?["#000000",i.blue[500]]:["#ffffff",i.blue[600]]),g=K(()=>Object.values(t.chartData).every(k=>k.order_count===0)),y=K(()=>Vt.data.isBusy.orderByDayAndHour),v=()=>{l&&(l.dispose(),l=null),Be(()=>{if(a.value){l=ea(a.value,null,{renderer:"svg"});const k=t.chartData.map(F=>F.hour),b=s,x={tooltip:{position:"top",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},formatter:F=>{const M=c.value?"#ffffff":"#000000";let $=`<div style="color: ${M};"><div>${s[F.data[1]]}, ${F.name||"-"}</div>`;return $+=`<div style="color: ${M};">
183 ${F.marker}
184 <span style="color: ${M};">${F.seriesName}</span>
185 <span style="float: right; margin-left: 20px; color: ${M};">
186 ${F.data[2]}
187 </span>
188 </div>`,$+"</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:b,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},visualMap:{min:0,max:m.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:_.value}},series:[{name: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(x)}})};be([p,m],()=>{Be(()=>{v()})}),be(g,k=>{k||v()}),be(y,k=>{k||v()});const w=()=>{c.value=Ve.isDark(),Be(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",w),Be(()=>{v(),window.addEventListener("resize",()=>l==null?void 0:l.resize())})}),vl(()=>{l&&(window.removeEventListener("resize",()=>l==null?void 0:l.resize()),window.removeEventListener("onFluentCartThemeChange",w,!1),l.dispose(),l=null)}),(k,b)=>{const x=C("el-skeleton");return r(),E(xe,{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(x,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(H,{key:1},[g.value?(r(),E(bt,{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})}}},wte={class:"fct-gross-sale-vs-net-revenue-wrap"},Cte={class:"flex items-center gap-2"},kte={class:"fct-card-header-title is-small"},Bte={class:"fct-chart-select"},xte={class:"fct-btn-group sm"},Ste={key:2,class:"chart-action-wrap"},Fte={class:"chart-change-wrap"},$te={class:"chart-change"},Ete={class:"text"},Ute={class:"chart-change"},Ite={class:"text"},Qte={__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=T(null),s=T("default"),i=T(ga.getChartType("order","order_chart")||"line"),c=T(!1),p=Ve.colors.report,m=T(Ve.isDark()),_=[{value:"default",label:u("Default")},{value:"monthly",label:u("Monthly")},{value:"yearly",label:u("Yearly")}],g=t,y=()=>{g("fetch-chart-data",s.value)},v=K(()=>Vt.data.isBusy.orderChartData),w=K(()=>[{title:u("Orders"),key:"order_count",color:m.value?p.dark_cyan_blue_16:p.light_gray,yAxisIndex:1,type:"bar"},{title:u("Gross Sales"),key:"gross_sale",color:m.value?p.blue_dark_mode:p.blue,yAxisIndex:0,type:"line"},{title:u("Revenue"),key:"net_revenue",color:m.value?p.purple_dark_mode:p.purple,yAxisIndex:0,type:"line"}].filter(({key:U})=>Ml.data.order.includes(U)).map(({title:U,key:O,color:R,yAxisIndex:P,type:j})=>I(U,j,P,a.chartData.map(q=>q[O]),R))),k=K(()=>a.chartData.map(U=>Us(U.group)));let b=null;const x=T(!0),F=()=>{b&&(b.dispose(),b=null),Be(()=>{l.value&&(b=ea(l.value),S(),b.on("legendselectchanged",U=>{x.value=U.selected.Orders}))})},M=K(()=>{const U=Es(a.reportFilter.data.dateRange);return u("This report looks at orders created ")+U}),$=K(()=>ul(a.chartData.length)),S=()=>{if(!b)return;const U={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:m.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:m.value?p.dark_cyan_blue_16:p.light_gray_blue}},formatter:O=>{let R=O[0].axisValue;const P=m.value?"#ffffff":"#565865";return O.forEach(function(j,q){const z=q===0?j.value:et.scaled(j.value);R+=`<div>
189 ${j.marker}
190 <span style="color: ${P};">${j.seriesName}</span>
191 <span style="float: right; margin-left: 20px; color: ${P};">
192 ${z}
193 </span>
194 </div>`}),R}},xAxis:{type:"category",data:k.value,axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,interval:$.value.interval},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Sales"),type:"value",position:"left",axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,formatter:O=>`${et.scaled(O)}`},splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:u("Orders"),type:"value",position:"right",axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:w.value};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},I=(U,O,R,P,j)=>({name:U,type:O,yAxisIndex:R,barMaxWidth:30,data:P,smooth:!1,color:j,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:j,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(j)},lineStyle:{color:j},areaStyle:{opacity:.3,color:j}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),Q=()=>{c.value=!c.value,c.value?b.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}]}):S()};be([()=>a.chartData,i],()=>{Be(S)},{deep:!0}),be(()=>Ml.data.order,()=>{Be(()=>{S()})},{deep:!0}),be(()=>a.isEmpty,U=>{U||F()}),be(v,U=>{U||F()}),be(x,()=>{if(!b)return;const O=b.getOption().series.map(R=>R.type==="line"?{...R,areaStyle:x.value?void 0:{opacity:.3}}:R);Be(()=>{b.setOption({series:O})})});const D=()=>{m.value=Ve.isDark(),Be(()=>{S()})},V=()=>{Be(()=>{S()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("fluentCartCurrencyChange",V,!1)}),Ie(()=>{Be(F),window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("fluentCartCurrencyChange",V)}),(U,O)=>{const R=C("el-tooltip"),P=C("el-option"),j=C("el-select"),q=C("el-skeleton");return r(),h("div",wte,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Cte,[o("h5",kte,f(A(u)("Order Chart")),1),n(R,{"popper-class":"fct-tooltip",content:M.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",Bte,[n(j,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":O[0]||(O[0]=z=>s.value=z),onChange:y},{default:d(()=>[(r(),h(H,null,ae(_,z=>n(P,{key:z.value,label:z.label,value:z.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",xte,[n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:Q,class:re(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(q,{key:0,animated:"",rows:4})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",Ste,[o("div",Fte,[o("div",$te,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Ete,f(A(u)("Data")),1)]),o("div",Ute,[o("span",Ite,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Dte={class:"fct-report-monthly-list"},Vte={class:"list-left-content"},Tte={class:"list-title"},Mte={class:"list-right-content"},Lte={class:"list-value"},Rte={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=K(()=>Ya.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=K(()=>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)?et.scaled(c.value):ua(c.value);return(c,p)=>(r(),h("ul",Dte,[(r(!0),h(H,null,ae(s.value,(m,_)=>(r(),h("li",{key:_},[o("div",Vte,[o("div",Tte,f(m.title),1)]),o("div",Mte,[o("div",Lte,[n(Is,{amount:i(m),title:m.title},null,8,["amount","title"]),n(ml,{fluctuation:m.fluctuation,amount:e.orderReport.data.previousSummary[m.key],"is-liability":!1,"has-currency":m.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},Ote={class:"fct-report-result-content"},Hte={class:"value"},Pte={class:"inline-flex"},Nte={class:"title"},Kte={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=K(()=>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=K(()=>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:ra(`--avg-grid-cols: ${s.value.length}`)},[(r(!0),h(H,null,ae(s.value,m=>(r(),h("div",{class:"fct-report-result",key:m.title},[o("div",Ote,[o("div",Hte,[o("span",Pte,f(A(et).scaled(m.value)),1),m.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:ra({color:m.fluctuation>0?"green":"red"})},[m.fluctuation>0?(r(),E(J,{key:0,class:"w-2",name:"CaretUp"})):B("",!0),m.fluctuation<0?(r(),E(J,{key:1,class:"w-2",name:"CaretDown"})):B("",!0),L(" "+f(A(ua)(m.fluctuation))+"% ",1)],4)):B("",!0)]),o("div",Nte,[L(f(m.title)+" ",1),m.content?(r(),E(p,{key:0,"popper-class":"fct-tooltip",content:m.content,placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):B("",!0)])])]))),128))],4)}}},Gte={class:"flex items-center gap-2"},jte={class:"fct-card-header-title is-small"},zte={class:"fct-btn-group sm"},qte=["innerHTML"],Yte=["innerHTML"],Wte=["innerHTML"],Xte=["innerHTML"],Jte={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;T("number");const a=T(!1),l=K(()=>Vt.data.isBusy.newVsReturning),s=K(()=>{if(a.value===!0){const c=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],p={customer_type:"New"},m={customer_type:"Returning"};return c.forEach(_=>{const g=parseFloat(t.tableData[0][_]),y=parseFloat(t.tableData[1][_]),v=g+y;p[_]=g*100/v,m[_]=y*100/v}),[p,m]}return t.tableData});K(()=>t.reportFilter.currentCurrencySign),Ie(()=>{});const i=c=>`${parseFloat(c).toFixed(2)}%`;return(c,p)=>{const m=C("el-tooltip"),_=C("el-checkbox"),g=C("el-skeleton"),y=C("el-table-column"),v=C("el-empty"),w=C("el-table");return r(),E(xe,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small"},{title:d(()=>[o("div",Gte,[o("h5",jte,f(A(u)("New vs. Returning Customers")),1),n(m,{"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",zte,[n(_,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=k=>a.value=k),onChange:c.selectGroupKey},{default:d(()=>[L(f(A(u)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),n(On,{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(w,{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=>[L(f(k.row.customer_type),1)]),_:1},8,["label"]),n(y,{prop:"customer_count",label:A(u)("Customer Count"),"min-width":"120"},{default:d(k=>[L(f(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=>[L(f(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(et).scaled(k.row.gross_sales)},null,8,qte)]),_: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(et).scaled(k.row.average_gross)},null,8,Yte)]),_: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(et).scaled(k.row.net_sales)},null,8,Wte)]),_: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(et).scaled(k.row.average_net)},null,8,Xte)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Zte=st(Jte,[["__scopeId","data-v-7818e7a0"]]),eae={class:"w-[240px] fct-btn-group gap-1.5"},tae={class:"capitalize"},aae={class:"capitalize"},lae=["innerHTML"],sae=["innerHTML"],nae=["innerHTML"],oae=["innerHTML"],iae={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,l=T("billing_country"),s=a.applicableFilters;K(()=>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,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(xe,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Qe,{title:A(u)("Orders grouped by"),title_size:"small"},{action:d(()=>[o("div",eae,[n(g,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=w=>l.value=w),onChange:i,placeholder:A(u)("Select Group")},{default:d(()=>[(r(),h(H,null,ae(c,w=>n(_,{key:w.value,label:w.label,value:w.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(On,{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(bt,{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(w=>[L(f(w.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(w=>[o("span",tae,f(A(Vn)(w.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(w=>[o("span",aae,f(A(Vn)(w.row.billing_country)),1)]),_:1},8,["label"])):B("",!0),n(y,{prop:"orders",label:A(u)("Orders"),"min-width":"150"},{default:d(w=>[L(f(A(u)(w.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"gross_sale",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(et).scaled(w.row.gross_sale)},null,8,lae)]),_:1},8,["label"]),n(y,{prop:"average_order_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(et).scaled(w.row.average_order_gross)},null,8,sae)]),_:1},8,["label"]),n(y,{prop:"net_sale",label:A(u)("Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(et).scaled(w.row.net_sale)},null,8,nae)]),_:1},8,["label"]),n(y,{prop:"average_order_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(et).scaled(w.row.average_order_net)},null,8,oae)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},rae={class:"fct-report-spend-by-day-wrap"},dae={class:"flex items-center gap-2"},uae={class:"fct-card-header-title is-small"},cae={class:"fct-btn-group sm"},Aae={key:2,class:"chart-action-wrap"},pae={class:"chart-change-wrap"},fae={class:"chart-change"},mae={class:"text"},hae={class:"chart-change"},_ae={class:"text"},vae={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","gross_sale_by_day_chart")||"line");const s=T(!1),i=K(()=>{const F=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort(($,S)=>$.day-S.day).map($=>F[$.day-1])}),c=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),p=K(()=>Vt.data.isBusy.orderByDayAndHour),m=Ve.colors.report,_=T(Ve.isDark()),g=K(()=>[y("Gross Sale","line",0,t.chartData.map(F=>F.gross_sale),_.value?m.blue_dark_mode:m.blue),y("Orders","bar",1,t.chartData.map(F=>F.order_count),_.value?m.dark_cyan_blue_16:m.light_gray)]),y=(F,M,$,S,I)=>({name:F,type:M,barMaxWidth:30,data:S,smooth:!1,color:I,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:I,borderRadius:[4,4,0,0]},yAxisIndex:$,emphasis:{scale:2,itemStyle:{color:za(I)},lineStyle:{color:I},areaStyle:{opacity:.3,color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!l)return;const F={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:{type:"line",lineStyle:{type:"solid",width:2,color:_.value?m.dark_cyan_blue_16:m.light_gray_blue}},formatter:M=>{let $=M[0].name;return M.forEach(S=>{const I=S.seriesName==="Gross Sale"?`${et.scaled(S.value)}`:S.value,Q=_.value?"#ffffff":"#565865";$+=`<div>
195 ${S.marker}
196 <span style="color: ${Q};">${S.seriesName}</span>
197 <span style="float: right; margin-left: 20px; color: ${Q};">
198 ${I}
199 </span>
200 </div>`}),$}},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:M=>`${et.scaled(M)}`},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(F)},w=()=>{l&&(l.dispose(),l=null),Be(()=>{a.value&&(l=ea(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],()=>{Be(()=>{v()})},{deep:!0}),be(c,F=>{F||w()}),be(p,F=>{F||w()});const b=()=>{_.value=Ve.isDark(),Be(()=>{v()})},x=()=>{Be(()=>{v()})};return Ie(()=>{Be(()=>{w(),t.reportFilter.addListener("spend-by-day",w),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",x)})}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),t.reportFilter.removeListener("spend-by-day",w,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,M)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",rae,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",dae,[o("h5",uae,f(A(u)("Spend by day")),1),n($,{"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",cae,[n(Ze,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:k,class:re(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(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[c.value?(r(),E(bt,{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",Aae,[o("div",pae,[o("div",fae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",mae,f(F.$t("Gross Sale")),1)]),o("div",hae,[o("span",_ae,f(F.$t("Days of the week")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},gae={class:"fct-report-item-count-distribution-wrap"},yae={class:"flex items-center gap-2"},bae={class:"fct-card-header-title is-small"},wae={class:"fct-btn-group sm"},Cae={key:2,class:"chart-action-wrap"},kae={class:"chart-change-wrap"},Bae={class:"chart-change"},xae={class:"text"},Sae={class:"chart-change"},Fae={class:"text"},$ae={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);T(t.chartData.length<=1?"bar":ga.getChartType("order","item_count_distribtion_chart")||"bar");const l=T(!1);K(()=>{const F=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort(($,S)=>$.day-S.day).map($=>F[$.day-1])});const s=Ve.colors,i=T(Ve.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"]})},m=()=>{c&&c.resize()},_=K(()=>i.value?s.blue[500]+"52":s.blue[300]),g=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(F=>F.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=K(()=>({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(F=>F.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=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),w=K(()=>Vt.data.isBusy.orderByDayAndHour),k=()=>{c&&(c.dispose(),c=null),Be(()=>{a.value&&(c=ea(a.value),c.setOption(y.value),window.addEventListener("resize",m))})},b=()=>{c&&c.setOption(y.value)};be(()=>t.chartData,()=>{c?c.setOption(y.value):Be(()=>{k()})}),be(v,F=>{F||k()}),be(w,F=>{F||k()});const x=()=>{i.value=Ve.isDark(),Be(()=>{b()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Be(()=>{k()})}),Bt(()=>{c&&(c.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",m))}),(F,M)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",gae,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",yae,[o("h5",bae,f(A(u)("Item count distribution")),1),n($,{"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",wae,[n(Ze,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:p,class:re(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(()=>[w.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(H,{key:1},[v.value?(r(),E(bt,{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",Cae,[o("div",kae,[o("div",Bae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",xae,f(F.$t("Order Count")),1)]),o("div",Sae,[o("span",Fae,f(F.$t("Item Count")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Eae={class:"fct-report-spend-by-hour-wrap"},Uae={class:"flex items-center gap-2"},Iae={class:"fct-card-header-title is-small"},Qae={class:"fct-btn-group sm"},Dae={key:2,class:"chart-action-wrap"},Vae={class:"chart-change-wrap"},Tae={class:"chart-change"},Mae={class:"text"},Lae={class:"chart-change"},Rae={class:"text"},Oae={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","gross_sale_by_hour_chart")||"line");const s=T(!1),i=K(()=>t.chartData.map(F=>F.hour)),c=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),p=K(()=>Vt.data.isBusy.orderByDayAndHour),m=Ve.colors.report,_=T(Ve.isDark()),g=(F,M,$,S,I)=>({name:F,type:M,barMaxWidth:30,data:$,smooth:!1,color:S,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:S,borderRadius:[4,4,0,0]},yAxisIndex:I,emphasis:{scale:2,itemStyle:{color:za(S)},lineStyle:{color:S},areaStyle:{opacity:.3,color:S}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=K(()=>[{name:u("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map(F=>F.gross_sale),color:_.value?m.purple_dark_mode:m.purple},{name:u("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map(F=>F.order_count),color:_.value?m.dark_cyan_blue_16:m.light_gray}].map(F=>g(F.name,F.type,F.data,F.color,F.yAxisIndex))),v=()=>{if(!l)return;const F={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:{type:"line",lineStyle:{type:"solid",width:2,color:_.value?m.dark_cyan_blue_16:m.light_gray_blue}},formatter:M=>{let $=M[0].name;return M.forEach(S=>{const I=S.seriesName==="Gross Sale"?`${et.scaled(S.value)}`:S.value,Q=_.value?"#ffffff":"#565865";$+=`<div>
201 ${S.marker}
202 <span style="color: ${Q};">${S.seriesName}</span>
203 <span style="float: right; margin-left: 20px; color: ${Q};">
204 ${I}
205 </span>
206 </div>`}),$}},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:M=>`${et.scaled(M)}`},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(F)},w=()=>{l&&(l.dispose(),l=null),Be(()=>{a.value&&(l=ea(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,()=>{Be(()=>v())}),be(c,F=>{F||w()}),be(p,F=>{F||w()});const b=()=>{_.value=Ve.isDark(),Be(()=>{v()})},x=()=>{Be(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",x),Be(()=>w())}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,M)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",Eae,[n(xe,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Uae,[o("h5",Iae,f(A(u)("Spend by hour ")),1),n($,{"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",Qae,[n(Ze,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:k,class:re(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(S,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(H,{key:1},[c.value?(r(),E(bt,{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",Dae,[o("div",Vae,[o("div",Tae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Mae,f(F.$t("Gross Sale")),1)]),o("div",Lae,[o("span",Rae,f(F.$t("Hour")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Hae={class:"fct-report-order-completion-time-wrap"},Pae={class:"flex items-center gap-2"},Nae={class:"fct-card-header-title is-small"},Kae={class:"fct-btn-group sm"},Gae={key:2,class:"chart-action-wrap"},jae={class:"chart-change-wrap"},zae={class:"chart-change"},qae={class:"text"},Yae={class:"chart-change"},Wae={class:"text"},Xae={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","order_completion_time_chart")||"bar");const s=T(!1),i=K(()=>t.chartData.map(F=>F.hour)),c=Ve.colors,p=T(Ve.isDark()),m=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(F=>F.orders),smooth:!1,color:m.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=K(()=>Object.values(t.chartData).every(F=>F.orders===0)),y=K(()=>Vt.data.isBusy.orderCompletionTime),v=()=>{l&&l.resize()},w=()=>{if(!l)return;const F={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(F)},k=()=>{l&&(l.dispose(),l=null),Be(()=>{a.value&&(l=ea(a.value),w())})},b=()=>{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?w():Be(()=>{k()})}),be(g,F=>{F||k()}),be(y,F=>{F||k()});const x=()=>{p.value=Ve.isDark(),Be(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Be(()=>k())}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",v))}),(F,M)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",Hae,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Pae,[o("h5",Nae,f(A(u)("Time between an order's created & completed date")),1),n($,{"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",Kae,[n(Ze,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:re(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(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[g.value?(r(),E(bt,{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",Gae,[o("div",jae,[o("div",zae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",qae,f(A(u)("Order Count")),1)]),o("div",Yae,[o("span",Wae,f(A(u)("Hours")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Jae={class:"fct-report-order-value-distribution-wrap"},Zae={class:"flex items-center gap-2"},ele={class:"fct-card-header-title is-small"},tle={class:"fct-btn-group sm"},ale={key:2,class:"chart-action-wrap"},lle={class:"chart-change-wrap"},sle={class:"chart-change"},nle={class:"text"},ole={class:"chart-change"},ile={class:"text"},rle={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","order_value_distribution_chart")||"bar");const s=T(!1),i=K(()=>Object.keys(t.chartData)),c=Ve.colors,p=T(Ve.isDark()),m=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_=K(()=>!Object.values(t.chartData).every(F=>F&&F!==0)),g=K(()=>Vt.data.isBusy.orderValueDistribution),y=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),smooth:!1,color:m.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=K(()=>({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})),w=()=>{l&&(l.dispose(),l=null),Be(()=>{a.value?(l=ea(a.value),l.setOption(v.value),window.addEventListener("resize",()=>{l.resize()})):l&&l.setOption(v.value)})},k=()=>{l&&l.setOption(v.value)},b=()=>{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(_,F=>{F||w()}),be(g,F=>{F||w()});const x=()=>{p.value=Ve.isDark(),Be(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Be(()=>{w()})}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,M)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",Jae,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Zae,[o("h5",ele,f(A(u)("Order value distribution")),1),n($,{"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",tle,[n(Ze,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:re(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(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[_.value?(r(),E(bt,{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",ale,[o("div",lle,[o("div",sle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",nle,f(F.$t("Order Count")),1)]),o("div",ole,[o("span",ile,f(F.$t("Order Value Ranges")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},dle={class:"fct-report-average-order-gross-wrap"},ule={class:"flex items-center gap-2"},cle={class:"fct-card-header-title is-small"},Ale={class:"fct-btn-group sm"},ple={key:2,class:"chart-action-wrap"},fle={class:"chart-change-wrap"},mle={class:"chart-change"},hle={class:"text"},_le={class:"chart-change"},vle={class:"text"},gle={__name:"AverageOrderGross",props:{chartData:{type:Array,required:!0},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=T(null);let l=null;T("line");const s=T(!1),i=Ve.colors.report,c=T(Ve.isDark()),p=K(()=>c.value?i.blue_dark_mode:i.blue),m=K(()=>Vt.data.isBusy.orderChartData),_=K(()=>[{name:u("Average Order Gross"),type:"line",barMaxWidth:30,data:t.chartData.map(F=>F.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:za(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=K(()=>ul(t.chartData.length)),y=()=>{l&&l.resize()},v=()=>{if(!l)return;const F=Il(t.chartData),M={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}},valueFormatter:$=>et.scaled($)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:F,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(M)},w=()=>{l&&(l.dispose(),l=null),Be(()=>{a.value&&(l=ea(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,()=>{Be(()=>v())}),be(t.isEmpty,F=>{F||w()}),be(m,F=>{F||w()});const b=()=>{c.value=Ve.isDark(),Be(()=>{v()})},x=()=>{v()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",x),Be(()=>w())}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),(F,M)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",dle,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small"},la({title:d(()=>[o("div",ule,[o("h5",cle,f(A(u)("Average Order Gross ")),1),n($,{"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",Ale,[n(Ze,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:k,class:re(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(()=>[m.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",ple,[o("div",fle,[o("div",mle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",hle,f(F.$t("Average Order Gross")),1)]),o("div",_le,[o("span",vle,f(F.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},yle={class:"fct-report-average-order-items-wrap"},ble={class:"flex items-center gap-2"},wle={class:"fct-card-header-title is-small"},Cle={class:"fct-btn-group sm"},kle={key:2,class:"chart-action-wrap"},Ble={class:"chart-change-wrap"},xle={class:"chart-change"},Sle={class:"text"},Fle={class:"chart-change"},$le={class:"text"},Ele={__name:"AverageOrderItems",props:{chartData:{type:Array,required:!0},chartRef:{},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","avg_order_items_chart")||"line");const s=T(!1),i=Ve.colors.report,c=T(Ve.isDark()),p=K(()=>c.value?i.purple_dark_mode:i.purple),m=K(()=>[{name:u("Average Order Items"),type:"line",barMaxWidth:30,data:Array.isArray(t.chartData)?t.chartData.map(F=>F.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:za(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),_=K(()=>ul(t.chartData.length)),g=K(()=>{const F=Il(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:F,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:m.value}}),y=K(()=>Vt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},w=()=>{l&&(l.dispose(),l=null),Be(()=>{a.value?(l=ea(a.value),l.setOption(g.value),window.addEventListener("resize",v)):l&&l.setOption(g.value)})},k=()=>{l&&l.setOption(g.value)},b=()=>{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,F=>{F||w()}),be(y,F=>{F||w()});const x=()=>{c.value=Ve.isDark(),Be(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x),Be(()=>{w(),window.addEventListener("resize",v)})}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),(F,M)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",yle,[n(xe,null,{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small"},la({title:d(()=>[o("div",ble,[o("h5",wle,f(A(u)("Average Order Items ")),1),n($,{"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",Cle,[n(Ze,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:re(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(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",kle,[o("div",Ble,[o("div",xle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Sle,f(F.$t("Average Order Items")),1)]),o("div",Fle,[o("span",$le,f(F.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Ule={class:"fct-order-report-page"},Ile={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=i=>{i&&(Vt.getOrderChartData({params:{...i.params,groupKey:""}}),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}),Bt(()=>{a.removeListener("order-report",l,!1),a.value}),(i,c)=>{const p=C("el-col"),m=C("el-row");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",Ule,[n(yte,{orderReport:A(Vt),reportFilter:A(a)},null,8,["orderReport","reportFilter"]),n(Qte,{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(Rte,{orderReport:A(Vt)},null,8,["orderReport"]),A(Vt).data.summary.tax_total||A(Vt).data.summary.shipping_total?(r(),E(Kte,{key:0,orderReport:A(Vt),reportFilter:A(a)},null,8,["orderReport","reportFilter"])):B("",!0),n(Zte,{tableData:A(Vt).data.newVsReturning,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(iae,{tableData:A(Vt).data.orderByGroup,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(bte,{chartData:A(Vt).data.orderByDayAndHour},null,8,["chartData"]),n(m,{gutter:30},{default:d(()=>[n(p,{lg:12},{default:d(()=>[n(vae,{reportFilter:A(a),ref:"chartRef",chartData:A(Vt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Oae,{chartData:A(Vt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n($ae,{ref:"chartRef",chartData:A(Vt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(rle,{chartData:A(Vt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(gle,{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(Ele,{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(Xae,{chartData:A(Vt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},Qle={class:"fct-gross-sale-vs-net-revenue-wrap"},Dle={class:"flex items-center gap-2"},Vle={class:"fct-card-header-title is-small"},Tle={class:"fct-chart-select"},Mle={class:"fct-btn-group sm"},Lle={class:"chart-action-wrap"},Rle={class:"chart-change-wrap"},Ole={class:"chart-change"},Hle={class:"text"},Ple={class:"chart-change"},Nle={class:"text"},Kle={__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=Ve.colors.report,s=T(Ve.isDark()),i=T(null),c=T("default"),p=T(ga.getChartType("refund","refund_chart")||"line"),m=T(!1);K(()=>a.reportFilter.currentCurrencySign);const _=[{label:u("Default"),value:"default"},{label:u("Monthly"),value:"monthly"},{label:u("Yearly"),value:"yearly"}],g=t,y=()=>{g("fetch-chart-data",c.value)},v=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=(D,V,U,O,R,P=!0)=>({name:D,type:V,barMaxWidth:30,data:U,smooth:!1,color:O,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},yAxisIndex:R,emphasis:{scale:2,itemStyle:{color:za(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:P,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),k=K(()=>{let D=[{name:u("Refunded Amount"),key:"refunded_amount",type:"line",color:s.value?l.blue_dark_mode:l.blue,yAxisIndex:0,data:a.chartData.map(V=>V.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(V=>V.refund_count),animation:!1}];return v.value&&D.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(V=>V.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(V=>V.refund_count),animation:!0}),D.map(V=>w(V.name,V.type,V.data,V.color,V.yAxisIndex,V.animation))});let b=null;const x=T(!0),F=()=>{b&&(b.dispose(),b=null),Be(()=>{i.value&&(b=ea(i.value),S(),b.on("legendselectchanged",D=>{x.value=D.selected["Total Refunds"]||D.selected["Previous Total Refunds"]}))})},M=K(()=>{const D=Es(a.reportFilter.data.dateRange);return u("This report looks at refunds made for successful orders created ")+D}),$=K(()=>ul(a.chartData.length)),S=()=>{if(!b)return;const D=Il(a.chartData),V={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:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:U=>{let O=U[0].name;return U.forEach(R=>{const P=[0,2].includes(R.seriesIndex)?`${et.scaled(R.value)}`:R.value,j=s.value?"#ffffff":"#565865";O+=`<div>
207 ${R.marker}
208 <span style="color: ${j};">${R.seriesName}</span>
209 <span style="float: right; margin-left: 20px; color: ${j};">
210 ${P}
211 </span>
212 </div>`}),O}},xAxis:{type:"category",data:D,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:$.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:U=>`${et.scaled(U)}`},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"};b.setOption(V,{notMerge:!0,replaceMerge:["series"]})},I=()=>{m.value=!m.value,m.value?b.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}]}):S()};be([()=>a.chartData,p],()=>{Be(S)},{deep:!0}),be(()=>Ml.data.refund,()=>{Be(()=>{S()})},{deep:!0}),be(()=>a.isEmpty,D=>{D||F()}),be(()=>a.loading,D=>{D||F()}),be(x,()=>{if(!b)return;const V=b.getOption().series.map(U=>U.type==="line"?{...U,areaStyle:x.value?void 0:{opacity:.3}}:U);Be(()=>{b.setOption({series:V})})});const Q=()=>{s.value=Ve.isDark(),Be(()=>{S()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),window.addEventListener("fluentCartCurrencyChange",Q),Be(F)}),(D,V)=>{const U=C("el-tooltip"),O=C("el-option"),R=C("el-select"),P=C("el-skeleton");return r(),h("div",Qle,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Dle,[o("h5",Vle,f(A(u)("Refunds Chart")),1),n(U,{"popper-class":"fct-tooltip",content:M.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",Tle,[n(R,{class:"el-select--x-small",modelValue:c.value,"onUpdate:modelValue":V[0]||(V[0]=j=>c.value=j),onChange:y},{default:d(()=>[(r(),h(H,null,ae(_,j=>n(O,{key:j.value,label:D.$t(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",Mle,[n(Ze,{tag:"button",size:"small",title:D.$t("Zoom Chart"),onClick:I,class:re(m.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(bt,{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",Lle,[o("div",Rle,[o("div",Ole,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Hle,f(D.$t("Data")),1)]),o("div",Ple,[o("span",Nle,f(D.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Gle extends nl{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 Ca=Gle.init(),jle={key:1,class:"fct-report-order-summary summary-col-4"},zle={class:"summary-item-inner"},qle={class:"value"},Yle={class:"inner-value"},Wle=["innerHTML"],Xle={class:"title"},Jle={__name:"Summary",setup(e){const t=K(()=>[{title:u("Refunds"),value:Ca.data.summary.refund_count,key:"refund_count",percentage:Ca.data.fluctuations.refund_count,info:u("Total refunds count including partially refunds."),no_currency:!0},{title:u("Refunded"),value:Ca.data.summary.refunded_amount,key:"refunded_amount",percentage:Ca.data.fluctuations.refunded_amount,info:u("Total Refunded Amount")},{title:u("Avgerage Amount"),value:Ca.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:Ca.data.fluctuations.average_refunded_amount,info:u("Total Refunded Amount / Total Refund count")},{title:u("Refund Rate"),value:Ca.data.summary.refund_rate,key:"refund_rate",percentage:Ca.data.fluctuations.refund_rate,info:u("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=K(()=>Ca.data.isBusy.chartData),l=s=>{const i=s.no_currency?ua(s.value):et.scaled(s.value);return s.is_percentage?`${i}%`:i};return(s,i)=>{const c=C("el-tooltip");return a.value?(r(),E(Ll,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",jle,[(r(!0),h(H,null,ae(t.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",zle,[o("div",qle,[o("div",Yle,[o("span",{innerHTML:l(p)},null,8,Wle)]),n(ml,{fluctuation:p.percentage,amount:A(Ca).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",Xle,[L(f(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))]))}}},Zle={class:"fct-report-refund-weeks-between-an-order-wrap"},ese={class:"fct-btn-group sm"},tse={class:"chart-action-wrap"},ase={class:"chart-change-wrap"},lse={class:"chart-change"},sse={class:"text"},nse={class:"chart-change"},ose={class:"text"},ise={__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=T(null),l=T("bar");let s=null;const i=Ve.colors.report,c=T(Ve.isDark()),p=K(()=>c.value?i.dark_cyan_blue_16:i.light_gray),m=K(()=>[{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:za(p.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),_=K(()=>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:m.value}),y=()=>{s&&(s.dispose(),s=null),Be(()=>{a.value&&(s=ea(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=Ve.isDark(),Be(()=>{w()})};Bt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const w=k=>{s&&s.setOption(g(),!0)};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",v),Be(()=>{y()})}),(k,b)=>{const x=C("el-skeleton");return r(),h("div",Zle,[n(xe,null,{default:d(()=>[n(Qe,{title:A(u)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},la({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",ese,[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(x,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",tse,[o("div",ase,[o("div",lse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",sse,f(A(u)("Refund Count")),1)]),o("div",nse,[o("span",ose,f(A(u)("Weeks")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},rse={class:"fct-btn-group sm w-[240px] gap-2"},dse={key:0},use={key:1},cse={class:"inline-flex"},Ase={class:"inline-flex"},pse={__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;T([]);const l=T([{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}]),s=T("billing_country"),i=K(()=>{var p;return((p=l.value.find(m=>m.value===s.value))==null?void 0:p.label)||""}),c=()=>{a("group-data",s.value)};return(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-skeleton"),v=C("el-table-column"),w=C("el-table");return r(),E(xe,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Refunds Grouped By"),title_size:"small"},la({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[o("div",rse,[n(g,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[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(On,{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(w,{key:1,data:e.tableData,height:"330"},{empty:d(()=>[n(bt,{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",dse,f(A(Vn)(k.row[s.value])),1)):(r(),h("span",use,f(k.row[s.value]),1))]),_:1},8,["prop","label"]),n(v,{prop:"refunds",label:A(u)("Refunds"),"min-width":"150"},{default:d(k=>m[1]||(m[1]=[])),_:1},8,["label"]),n(v,{prop:"refunded_amount",label:A(u)("Refunded Amount"),"min-width":"150"},{default:d(k=>[o("div",cse,f(A(et).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",Ase,f(A(et).scaled(k.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},fse={class:"fct-refund-report-page"},mse={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=p=>{Ca.getRefundChartData({params:{...p.params,groupKey:"default"}}),Ca.getWeeksBetweenRefund(p),s(p)},s=p=>{Ca.getRefundDataByGroup({params:{...p.params,groupKey:"billing_country"}})},i=p=>{const m=a.applicableFilters;Ca.getRefundDataByGroup({params:{...m.params,groupKey:p}})},c=p=>{const m=a.applicableFilters;m&&Ca.getRefundChartData({params:{...m.params,groupKey:p}})};return Ie(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),Bt(()=>{a.removeListener("refund-report")}),(p,m)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",fse,[n(Jle),n(Kle,{ref:"refundChart",chartData:A(Ca).data.chartData,compareData:A(Ca).data.previousMetrics,reportFilter:A(a),onFetchChartData:c,"is-empty":!A(Ca).data.summary.refund_count,loading:A(Ca).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),n(ise,{chartData:A(Ca).data.weeksBetweenRefund,"is-empty":!A(Ca).data.weeksBetweenRefund.length,loading:A(Ca).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),n(pse,{tableData:A(Ca).data.refundData,currencySign:A(a).currentCurrencySign,onGroupData:i,loading:A(Ca).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},hse={class:"fct-gross-sale-vs-net-revenue-wrap"},_se={class:"fct-chart-select"},vse={class:"fct-btn-group sm"},gse={class:"chart-action-wrap"},yse={class:"chart-change-wrap"},bse={class:"chart-change"},wse={class:"text"},Cse={class:"chart-change"},kse={class:"text"},Bse={__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=T(null),s=T(ga.getChartType("subscription","retention_chart")||"line"),i=T(!1),c=T(null);T([]);const p=Ve.colors.report,m=T(Ve.isDark()),_=(S,I,Q,D)=>({name:S,type:I,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]},emphasis:{scale:2,itemStyle:{color:za(D)},lineStyle:{color:D},areaStyle:{opacity:.3,color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=K(()=>Object.keys(a.chartData).map(I=>I.startsWith("day_")?u("%s Days",I.replace("day_","")):I==="more_than_year"?u("More than Year"):I)),y=K(()=>Object.keys(a.chartData).map(I=>a.chartData[I]||0)),v=K(()=>[_(u("Customers"),s.value,y.value,m.value?p.dark_cyan_blue_16:p.light_gray)]);let w=null;const k=()=>{w&&(w.dispose(),w=null),Be(()=>{l.value&&(w=ea(l.value),b())})},b=()=>{if(!w)return;const S={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:m.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:m.value?p.dark_cyan_blue_16:p.light_gray_blue}}},xAxis:{type:"category",data:g.value,axisLabel:{color:m.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:m.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};w.setOption(S,{notMerge:!0,replaceMerge:["series"]})},x=S=>{ga.onChange("subscription","retention_chart",S),s.value!==S&&(i.value=!1,s.value=S,b())},F=t,M=()=>{F("fetch-custom-chart-data",c.value)};be(()=>a.chartData,()=>{Be(b)},{deep:!0}),be(()=>Ml.data.refund,()=>{Be(b)},{deep:!0}),be(()=>a.isEmpty,S=>{S||k()}),be(()=>a.loading,S=>{S||k()});const $=()=>{m.value=Ve.isDark(),Be(()=>{b()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",$,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",$),Be(k)}),(S,I)=>{const Q=C("el-input"),D=C("el-skeleton");return r(),h("div",hse,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title:A(u)("Retention Chart"),title_size:"small",border_bottom:""},la({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",_se,[n(Q,{type:"text",modelValue:c.value,"onUpdate:modelValue":I[0]||(I[0]=V=>c.value=V),placeholder:A(u)("Enter custom days"),class:"el-input--x-small",onKeyup:xa(M,["enter"])},null,8,["modelValue","placeholder"])]),o("div",vse,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:x},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(D,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",gse,[o("div",yse,[o("div",bse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",wse,f(A(u)("Data")),1)]),o("div",Cse,[o("span",kse,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},xse={class:"fct-revenue-line-chart-wrap"},Sse={class:"flex items-center gap-2"},Fse={class:"fct-card-header-title is-small"},$se={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},Ese={class:"chart-action-wrap"},Use={class:"chart-change-wrap"},Ise={class:"chart-change"},Qse={class:"text"},Dse={class:"chart-change"},Vse={class:"text"},Tse={__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=T(null),s=T(ga.getChartType("subscription","subscription_chart")||"line"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(D,V,U,O,R)=>({name:D,type:V,barMaxWidth:30,yAxisIndex:U,data:O,smooth:!1,color:R,lineStyle:{width:3},areaStyle:{opacity:.3,color:R},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:R,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(R)},lineStyle:{color:R},areaStyle:{opacity:.3,color:R}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);be(()=>a.appliedGroupKey,D=>{_.value=D});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{let D=[{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(V=>V.count)}];return w.value&&D.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(V=>({value:V.count,date:V.group}))}),D.map(V=>m(V.name,V.type,0,V.data,V.color))});let b=null;const x=()=>{b&&(b.dispose(),b=null),Be(()=>{l.value&&(b=ea(l.value),$())})},F=K(()=>{const D=Es(a.reportFilter.data.dateRange);return u("This report looks at the subscription you received ")+D}),M=K(()=>ul(a.chartData.length)),$=()=>{if(!b)return;const D=Il(a.chartData),V={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:U=>{let O="";return U.forEach(function(R,P){const j=typeof R.data=="object"&&R.data!==null,q=j?Us(R.data.date):R.name,z=j?R.data.value:R.value,X=U.length>1&&P===0;X&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${q}</div>`,O+=`<div>
213 <span style="color:${R.color}">●</span>
214 <span>${u("Subscription")}</span>
215 <span style="float: right; margin-left: 20px;">
216 ${ua(z)}
217 </span>
218 </div>`,X&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.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};b.setOption(V,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value?b.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}]}):$()},I=D=>{ga.onChange("subscription","subscription_chart",D),s.value!==D&&(i.value=!1,s.value=D,$())};be([()=>a.chartData,_],()=>{Be($)},{deep:!0}),be(()=>Ml.data.revenue,()=>{Be(()=>{$()})},{deep:!0}),be(()=>a.isEmpty,D=>{D||x()}),be(()=>a.loading,D=>{D||x()});const Q=()=>{p.value=Ve.isDark(),Be(()=>{$()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),Be(()=>{x()})}),(D,V)=>{const U=C("el-tooltip"),O=C("el-option"),R=C("el-select"),P=C("el-skeleton");return r(),h("div",xse,[n(xe,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Sse,[o("h4",Fse,f(A(u)("Subscription Chart")),1),n(U,{"popper-class":"fct-tooltip",content:F.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",$se,[n(R,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":V[0]||(V[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,j=>n(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:re(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(bt,{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",Ese,[o("div",Use,[o("div",Ise,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Qse,f(A(u)("Data")),1)]),o("div",Dse,[o("span",Vse,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Mse extends nl{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 Os=Mse.init(),Lse={key:1,class:"fct-report-order-summary summary-col-4"},Rse={class:"summary-item-inner"},Ose={class:"value"},Hse={class:"inner-value"},Pse={class:"title"},Nse={__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;K(()=>{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=K(()=>!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(Ll,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",Lse,[(r(!0),h(H,null,ae(l.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Rse,[o("div",Ose,[o("div",Hse,[n(Is,{amount:A(et).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",Pse,[L(f(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))]))}}},Kse={class:"chart-action-wrap"},Gse={class:"chart-change-wrap"},jse={class:"chart-change"},zse={class:"text"},qse={class:"chart-change"},Yse={class:"text"},Wse={__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=T(null),s=T(a.chartData);t({chartRef:l}),be(()=>a.chartData,F=>{s.value=F},{deep:!0});const i=Ve.colors.report,c=T(Ve.isDark()),p=K(()=>({textColor:c.value?"#ffffff":"#000000",borderColor:c.value?"#4a5a6b":"#c0c4ca",splitLineColor:c.value?"#253241":"#D6DAE1",bgColor:c.value?"#2d3748":"#ffffff"})),m=K(()=>c.value?i.dark_cyan_blue_16:i.light_gray),_=K(()=>s.value.map(F=>Us(F.label))),g=K(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map(F=>F.value),smooth:!1,color:m.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:m.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(m.value)},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let y=null;const v=()=>{y&&(y.dispose(),y=null),Be(()=>{l.value&&(y=ea(l.value),k())})},w=K(()=>ul(a.chartData.length)),k=()=>{if(!y)return;const F={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:w.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(F,{notMerge:!0,replaceMerge:["series"]})},b=F=>{F?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,()=>Ve.isDark(),()=>a.loading],()=>{v()},{deep:!0}),be(()=>a.zoomIsActive,F=>{b(F)});const x=()=>{c.value=Ve.isDark(),Be(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",k),Be(v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),(F,M)=>{const $=C("el-skeleton");return e.loading?(r(),E($,{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",Kse,[o("div",Gse,[o("div",jse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",zse,f(F.$t("Data")),1)]),o("div",qse,[o("span",Yse,f(F.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),E(bt,{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))}}},Xse={class:"fct-daily-signup-chart-wrap"},Jse={class:"fct-btn-group sm gap-2 lg:gap-0"},Zse={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=T(ga.getChartType("subscription","daily_signups_chart")||"line"),l=T([]),s=T(""),i=T(!1),c=T(!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)},m=_=>{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",Xse,[n(xe,null,{default:d(()=>[n(Qe,{title:A(u)("Daily Signups"),title_size:"small",border_bottom:""},la({_:2},[l.value.length&&!c.value?{name:"action",fn:d(()=>[o("div",Jse,[n(Rl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:m},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(Wse,{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 ene={name:"Comparison",components:{CardContainer:xe,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:ua(s),previous_count:ua(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}`}}}},tne={class:"fct-revenue-comparison"},ane={class:"inline-flex"},lne={class:"inline-flex"};function sne(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",tne,[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(m,{label:"Date"},{default:d(v=>[L(f(v.row.group),1)]),_:1}),n(m,{label:i.translate("Current Range")},{default:d(v=>[o("div",ane,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(m,{label:i.translate("Compare Range")},{default:d(v=>[o("div",lne,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:re(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const nne=st(ene,[["render",sne]]),one={class:"fct-refund-report-page"};const ine={__name:"SubscriptionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T({summary:{},fluctuations:{},currentMetrics:[],compareMetrics:[],loading:!0}),l=t.reportFilter,s=T("default"),i=K(()=>l.currentCurrencySign);l.applicableFilters;const c=T(""),p=T(""),m=K(()=>{var F;const b=((F=Os.data)==null?void 0:F.productList)||[],x=c.value.toLowerCase();return b.filter(M=>M.product_name.toLowerCase().includes(x))}),_=K(()=>{var F;const b=((F=Os.data)==null?void 0:F.customerList)||[],x=p.value.toLowerCase();return b.filter(M=>M.customer_name.toLowerCase().includes(x)||M.email.toLowerCase().includes(x))}),g=b=>{y(b),w(b)},y=(b,x="default")=>{a.value.loading=!0,ue.get("reports/subscription-chart",{params:{...b.params,groupKey:x}}).then(F=>{a.value=F}).finally(()=>a.value.loading=!1)},v=b=>{s.value!==b&&(s.value=b,y(l.applicableFilters.params,b))},w=(b,x=null)=>{Os.getRetentionChart({params:{...b.params,customDays:x}})},k=b=>{w(l.applicableFilters,b)};return Ie(()=>{l.addListener("subscription-report",b=>{g(b)}),g(l.applicableFilters)}),Bt(()=>{l.removeListener("subscription-report")}),(b,x)=>{const F=C("el-col"),M=C("el-row"),$=C("el-input"),S=C("el-table-column"),I=C("el-empty"),Q=C("el-table");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",one,[n(Nse,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:A(Os),reportFilter:A(l),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),n(Tse,{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(nne,{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(M,{gutter:30},{default:d(()=>[n(F,{lg:12},{default:d(()=>[n(Bse,{ref:"subscriptionChart",chartData:A(Os).data.chartData,onFetchCustomChartData:k,"is-empty":!a.value.summary.total_subscriptions,loading:A(Os).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),n(F,{lg:12},{default:d(()=>[n(Zse,{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})}}},rne={class:"fct-refund-report-page"},dne={key:1},une={key:1,class:"fct-report-order-summary summary-col-2"},cne={class:"summary-item-inner"},Ane={class:"value"},pne={class:"inner-value"},fne=["innerHTML"],mne={class:"title"},hne={class:"fct-revenue-line-chart-wrap"},_ne={class:"flex items-center gap-2"},vne={class:"fct-card-header-title is-small"},gne={class:"fct-btn-group sm"},yne={class:"chart-action-wrap"},bne={class:"chart-change-wrap"},wne={class:"chart-change"},Cne={class:"text"},kne={class:"chart-change"},Bne={class:"text"},xne={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=T(!1),s=Ve.colors.report,i=T(Ve.isDark()),c=T(null);let p=null;const m=T({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=T(!0),g=(I,Q="monthly")=>{_.value=!0,ue.get("reports/future-renewals",{params:{...I.params,groupKey:Q}}).then(D=>{m.value=D}).finally(()=>_.value=!1)},y=(I,Q,D,V,U)=>({name:I,type:Q,barMaxWidth:30,yAxisIndex:D,data:V,smooth:!1,color:U,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:U,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(U)},lineStyle:{color:U}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{p&&(p.dispose(),p=null),Be(()=>{c.value&&(p=ea(c.value),w())})},w=()=>{if(!p)return;const I=Il(m.value.projections),Q={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:{type:"line",lineStyle:{type:"solid",width:2,color:i.value?s.dark_cyan_blue_16:s.light_gray_blue}},formatter:D=>{let V=D[0].name;return D.forEach((U,O)=>{const R=O===0?`${et.formatScaled(U.value)}`:ua(U.value),P=i.value?"#ffffff":"#565865";V+=`<div>
219 ${U.marker}
220 <span style="color: ${P};">${U.seriesName}</span>
221 <span style="float: right; margin-left: 20px; color: ${P};">
222 ${R}
223 </span>
224 </div>`}),V}},grid:{show:!1},xAxis:{type:"category",data:I,axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,formatter:D=>`${et.formatScaledChart(D)}`},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:F.value};p.setOption(Q,{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}]}):w()},b=()=>{i.value=Ve.isDark(),Be(()=>{w()})},x=K(()=>{const I=Es(m.value.period);return u("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+I}),F=K(()=>[{name:u("Revenue"),key:"count",type:"line",color:i.value?s.blue_dark_mode:s.blue,data:m.value.projections.map(Q=>Q.projected_amount)},{name:u("Count"),key:"count",type:"bar",color:i.value?s.dark_cyan_blue_16:s.light_gray,data:m.value.projections.map(Q=>Q.renewals_count)}].map((Q,D)=>y(Q.name,Q.type,D,Q.data,Q.color))),M=K(()=>ul(m.value.projections.length)),$=K(()=>[{title:u("Renewal Revenue"),value:et.formatScaled(m.value.totalProjected),key:"renewal_revenue"},{title:u("Renewals"),value:ua(m.value.totalRenewals),key:"renewals_count",no_currency:!0}]),S=K(()=>!m.value.totalRenewals);return be([()=>m.value],()=>{Be(w)},{deep:!0}),be(S,I=>{I||v()}),be(_,I=>{I||v()}),Ie(()=>{g(a.applicableFilters),Be(()=>{v()}),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",w)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),(I,Q)=>{const D=C("el-skeleton");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",rne,[n(sl,{title:A(u)("Subscription Future Revenue")},null,8,["title"])]),n(xe,null,{default:d(()=>[n(Ce,{class:"p-3"},{default:d(()=>[_.value?(r(),E(Ll,{key:0,loading:_.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),h("div",dne,f(x.value),1))]),_:1})]),_:1}),_.value?(r(),E(Ll,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),h("div",une,[(r(!0),h(H,null,ae($.value,(V,U)=>(r(),h("div",{class:"summary-item",key:U},[o("div",cne,[o("div",Ane,[o("div",pne,[o("span",{innerHTML:V.value},null,8,fne)])]),o("div",mne,f(V.title),1)])]))),128))])),o("div",hne,[n(xe,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",_ne,[o("h4",vne,f(A(u)("Upcoming Renewal Revenue")),1)])]),_:2},[m.value.totalRenewals&&!_.value?{name:"action",fn:d(()=>[o("div",gne,[n(Ze,{tag:"button",size:"small",title:I.$t("Zoom Chart"),onClick:k,class:re(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(D,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[S.value?(r(),E(bt,{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},[S.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",yne,[o("div",bne,[o("div",wne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Cne,f(A(u)("Data")),1)]),o("div",kne,[o("span",Bne,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},Sne={class:"fct-retention-lifetime"},Fne={class:"flex items-center gap-2"},$ne={class:"fct-card-header-title is-small"},Ene={key:0},Une={class:"mt-2"},Ine={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=K(()=>{var s;return((s=t.data)==null?void 0:s.retention_data)??[]}),l=K(()=>{const s=a.value;if(!s.length)return null;const c=s.reduce((x,F)=>x+parseFloat(F.retention_rate),0)/s.length,p=c/100;let m=0;p<1?m=1/(1-p):m=s.length;const _=s[s.length-1],g=parseInt(_.active_subscriptions),y=parseFloat(_.mrr);let v=0;g>0&&(v=y/g);const w=v*m,k=new Date(_.day),b=Pa[k.getMonth()]+" "+k.getFullYear().toString();return{expected_lifetime_text:u(`Based on an average monthly subscription retention rate of ${c.toFixed(1)}%, your expected subscription lifetime is ${m.toFixed(1)} months.`),ltv_text:u(`In ${b}, your average monthly revenue per subscriber was ${et.scaled(v)}, giving you an expected subscription lifetime value of ${et.scaled(w)}.`)}});return(s,i)=>{const c=C("el-skeleton");return r(),h("div",Sne,[n(xe,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},{title:d(()=>[o("div",Fne,[o("h4",$ne,f(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",Ene,[o("div",null,f(l.value.expected_lifetime_text),1),o("div",Une,f(l.value.ltv_text),1)])):(r(),E(bt,{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})])}}},Qne={class:"summary-item-inner"},Dne={class:"title text-[16px] mb-2.5"},Vne={class:"grid grid-cols-2 items-center"},Tne={class:"value"},Mne={class:"sub-value mt-1.5"},Lne={class:"value"},Rne={class:"sub-value mt-1.5"},One={class:"description leading-[1.6] mt-3.5"},Hne={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Ve.colors.report,l=T(Ve.isDark()),s=K(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=K(()=>{const p=s.value;if(!p.length)return[];const _=(p.reduce((Q,D)=>Q+parseFloat(D.retention_rate),0)/p.length).toFixed(1),y=(p.reduce((Q,D)=>Q+parseFloat(D.retention_rate_money),0)/p.length).toFixed(1),v=p[p.length-1];let w="",k=0,b=0;if(p.length>1){const Q=p[p.length-2],D=new Date(Q.day);w=Pa[D.getMonth()]+" "+D.getFullYear().toString(),k=parseInt(Q.active_subscriptions),b=parseFloat(Q.mrr)}else{const Q=new Date(v.day);Q.setMonth(Q.getMonth()-1),w=Pa[Q.getMonth()]+" "+Q.getFullYear().toString();const D=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);k=v.retention_rate>0?Math.round(D/(v.retention_rate/100)):0;const V=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);b=v.retention_rate_money>0?V/(v.retention_rate_money/100):0}const x=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),F=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),M=parseFloat(v.retention_rate),$=parseFloat(v.retention_rate_money),S=new Date(v.day),I=Pa[S.getMonth()]+" "+S.getFullYear().toString();return[{title:u("Subscription Retention"),value:`${M}%`,average_value:`${_}%`,month_name:I,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate}% (${ua(x)}) of your ${w} subscriptions (${ua(k)}).`),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Retention"),value:`${$}%`,average_value:`${y}%`,month_name:I,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate_money}% (${et.scaled(F)}) of your ${w} subscription MRR (${et.scaled(b)}).`),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Ve.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,m)=>{var _,g;return e.loading?(r(),E(Ll,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:re(`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",Qne,[o("div",Dne,f(y.title),1),o("div",Vne,[o("div",null,[o("div",Tne,f(y.value),1),o("div",Mne,f(y.month_name),1)]),o("div",null,[o("div",Lne,f(y.average_value),1),o("div",Rne,f(y.sub_title),1)])]),o("div",One,f(y.description),1)])]))),128)):(r(),E(bt,{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))}}},Pne={class:"fct-revenue-line-chart-wrap"},Nne={class:"flex items-center gap-2"},Kne={class:"fct-card-header-title is-small"},Gne={class:"fct-btn-group sm"},jne={class:"chart-action-wrap"},zne={class:"chart-change-wrap"},qne={class:"chart-change"},Yne={class:"text"},Wne={class:"chart-change"},Xne={class:"text"},Jne={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Ve.colors.report,s=T(Ve.isDark()),i=T(null);let c=null;const p=T(ga.getChartType("subscription","retention_chart")||"line"),m=(M,$,S,I,Q)=>({name:M,type:$,barMaxWidth:30,yAxisIndex:S,data:I,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:za(Q)},lineStyle:{color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),Be(()=>{i.value&&(c=ea(i.value),g())})},g=()=>{if(!c)return;const M=Il(k.value),$={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:S=>{let I=S[0].name;return S.forEach((Q,D)=>{const V=ua(Q.value)+"%",U=s.value?"#ffffff":"#565865";I+=`<div>
225 ${Q.marker}
226 <span style="color: ${U};">${Q.seriesName}</span>
227 <span style="float: right; margin-left: 20px; color: ${U};">
228 ${V}
229 </span>
230 </div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:M,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:x.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:S=>`${S}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:b.value};c.setOption($,{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=Ve.isDark(),Be(()=>{g()})},w=M=>{ga.onChange("subscription","retention_chart",M),p.value!==M&&(a.value=!1,p.value=M,g())},k=K(()=>{var M;return((M=t.data)==null?void 0:M.retention_data)??[]}),b=K(()=>[{name:u("Subscription Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:k.value.map($=>$.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($=>$.retention_rate_money)}].map(($,S)=>m($.name,$.type,0,$.data,$.color))),x=K(()=>ul(k.value.length)),F=K(()=>!k.value||!k.value.length);return be([()=>t.data],()=>{Be(_)},{deep:!0}),be(F,M=>{M||_()}),be(t.loading,M=>{M||_()}),Ie(()=>{Be(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(M,$)=>{const S=C("el-skeleton");return r(),h("div",Pne,[n(xe,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Nne,[o("h4",Kne,f(A(u)("Retention Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:d(()=>[o("div",Gne,[n(Rl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:w},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:M.$t("Zoom Chart"),onClick:y,class:re(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(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[F.value?(r(),E(bt,{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},[F.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",jne,[o("div",zne,[o("div",qne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Yne,f(A(u)("Data")),1)]),o("div",Wne,[o("span",Xne,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Zne={class:"summary-item-inner"},eoe={class:"title text-[16px] mb-2.5"},toe={class:"grid grid-cols-2 items-center"},aoe={class:"value"},loe={class:"sub-value mt-1.5"},soe={class:"value"},noe={class:"sub-value mt-1.5"},ooe={class:"description leading-[1.6] mt-3.5"},ioe={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Ve.colors.report,l=T(Ve.isDark()),s=K(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=K(()=>{const p=s.value;if(!p.length)return[];const m=p.map((D,V)=>{const U=V>0?parseInt(p[V-1].active_subscriptions)||0:parseInt(D.active_subscriptions)-parseInt(D.new_subscriptions)||0,O=parseInt(D.churned_subscriptions)||0;return U>0?O/U*100:0}),_=p.map((D,V)=>{const U=V>0?parseFloat(p[V-1].mrr)||0:parseFloat(D.mrr)-parseFloat(D.new_subscriptions_mrr)||0,O=parseFloat(D.churned_subscriptions_mrr)||0;return U>0?O/U*100:0}),g=(m.reduce((D,V)=>D+V,0)/m.length).toFixed(1),y=(_.reduce((D,V)=>D+V,0)/_.length).toFixed(1),v=p[p.length-1],w=p.length-1,k=w>0?parseInt(p[w-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,b=w>0?parseFloat(p[w-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,x=parseInt(v.churned_subscriptions)||0,F=parseFloat(v.churned_subscriptions_mrr)||0,M=k>0?(x/k*100).toFixed(1):0,$=b>0?(F/b*100).toFixed(1):0,S=new Date(v.day),I=Pa[S.getMonth()]+" "+S.getFullYear().toString();let Q="";if(p.length>1){const D=p[p.length-2],V=new Date(D.day);Q=Pa[V.getMonth()]+" "+V.getFullYear().toString()}else{const D=new Date(v.day);D.setMonth(D.getMonth()-1),Q=Pa[D.getMonth()]+" "+D.getFullYear().toString()}return[{title:u("Subscription Churn"),value:`${M}%`,average_value:`${g}%`,month_name:I,sub_title:u("Average in period"),description:u(`You lost ${M}% (${ua(x)}) of your ${Q} subscriptions (${ua(k)}).`),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Churn"),value:`${$}%`,average_value:`${y}%`,month_name:I,sub_title:u("Average in period"),description:u(`You lost ${$}% (${et.scaled(F)}) of your ${Q} subscription MRR (${et.scaled(b)}).`),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Ve.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,m)=>{var _,g;return e.loading?(r(),E(Ll,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:re(`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",Zne,[o("div",eoe,f(y.title),1),o("div",toe,[o("div",null,[o("div",aoe,f(y.value),1),o("div",loe,f(y.month_name),1)]),o("div",null,[o("div",soe,f(y.average_value),1),o("div",noe,f(y.sub_title),1)])]),o("div",ooe,f(y.description),1)])]))),128)):(r(),E(bt,{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))}}},roe={class:"fct-revenue-line-chart-wrap"},doe={class:"flex items-center gap-2"},uoe={class:"fct-card-header-title is-small"},coe={class:"fct-btn-group sm"},Aoe={class:"chart-action-wrap"},poe={class:"chart-change-wrap"},foe={class:"chart-change"},moe={class:"text"},hoe={class:"chart-change"},_oe={class:"text"},voe={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Ve.colors.report,s=T(Ve.isDark()),i=T(null);let c=null;const p=T(ga.getChartType("subscription","churn_chart")||"line"),m=(M,$,S,I,Q)=>({name:M,type:$,barMaxWidth:30,yAxisIndex:S,data:I,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:za(Q)},lineStyle:{color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),Be(()=>{i.value&&(c=ea(i.value),g())})},g=()=>{if(!c)return;const M=Il(k.value),$={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:S=>{let I=S[0].name;return S.forEach((Q,D)=>{const V=ua(Q.value)+"%",U=s.value?"#ffffff":"#565865";I+=`<div>
231 ${Q.marker}
232 <span style="color: ${U};">${Q.seriesName}</span>
233 <span style="float: right; margin-left: 20px; color: ${U};">
234 ${V}
235 </span>
236 </div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:M,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:x.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:S=>`${S}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:b.value};c.setOption($,{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=Ve.isDark(),Be(()=>{g()})},w=M=>{ga.onChange("subscription","churn_chart",M),p.value!==M&&(a.value=!1,p.value=M,g())},k=K(()=>{var M;return((M=t.data)==null?void 0:M.retention_data)??[]}),b=K(()=>{const M=k.value.map((I,Q)=>{const D=Q>0?parseInt(k.value[Q-1].active_subscriptions)||0:parseInt(I.active_subscriptions)-parseInt(I.new_subscriptions)||0,V=parseInt(I.churned_subscriptions)||0;return D>0?(V/D*100).toFixed(2):0}),$=k.value.map((I,Q)=>{const D=Q>0?parseFloat(k.value[Q-1].mrr)||0:parseFloat(I.mrr)-parseFloat(I.new_subscriptions_mrr)||0,V=parseFloat(I.churned_subscriptions_mrr)||0;return D>0?(V/D*100).toFixed(2):0});return[{name:u("Subscription Churn"),type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:M},{name:u("MRR Churn"),type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:$}].map((I,Q)=>m(I.name,I.type,0,I.data,I.color))}),x=K(()=>ul(k.value.length)),F=K(()=>!k.value||!k.value.length);return be([()=>t.data],()=>{Be(_)},{deep:!0}),be(F,M=>{M||_()}),be(t.loading,M=>{M||_()}),Ie(()=>{Be(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(M,$)=>{const S=C("el-skeleton");return r(),h("div",roe,[n(xe,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",doe,[o("h4",uoe,f(A(u)("Churn Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:d(()=>[o("div",coe,[n(Rl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:w},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:M.$t("Zoom Chart"),onClick:y,class:re(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(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[F.value?(r(),E(bt,{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},[F.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",Aoe,[o("div",poe,[o("div",foe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",moe,f(A(u)("Data")),1)]),o("div",hoe,[o("span",_oe,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},goe={class:"fct-retention-report-page"},yoe={class:"page-title"},boe={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=T({retention_data:[]}),s=T(!0),i=(c,p="monthly")=>{s.value=!0,ue.get("reports/subscription-retention",{params:{...c.params,groupKey:p}}).then(m=>{l.value=m}).finally(()=>s.value=!1)};return Ie(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(c,p)=>{const m=C("el-tooltip");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",goe,[n(sl,null,{title:d(()=>[o("h1",yoe,[L(f(A(u)("Subscription Retention"))+" ",1),n(m,{"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(Hne,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Jne,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Ine,{data:l.value,loading:s.value},null,8,["data","loading"]),n(ioe,{data:l.value,loading:s.value},null,8,["data","loading"]),n(voe,{data:l.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},woe={key:1,class:"fct-report-order-summary"},Coe={class:"summary-item-inner"},koe={class:"value"},Boe={class:"inner-value"},xoe={class:"title"},Soe={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:u("Customer Growth"),key:"customer_count"}],l=K(()=>t.customerReport.loading),s=K(()=>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(Ll,{key:0,count:s.value.length},null,8,["count"])):(r(),h("div",woe,[(r(!0),h(H,null,ae(s.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Coe,[o("div",koe,[o("div",Boe,f(A(ua)(p.value)),1),n(ml,{fluctuation:p.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[p.key]},null,8,["fluctuation","amount"])]),o("div",xoe,f(p.title),1)])]))),128))]))}},Foe={class:"fct-revenue-line-chart-wrap"},$oe={class:"flex items-center gap-2"},Eoe={class:"fct-card-header-title is-small"},Uoe={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},Ioe={class:"chart-action-wrap"},Qoe={class:"chart-change-wrap"},Doe={class:"chart-change"},Voe={class:"text"},Toe={class:"chart-change"},Moe={class:"text"},Loe={__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=T(null),s=T(ga.getChartType("revenue","revenue_chart")||"line"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(D,V,U,O,R)=>({name:D,type:V,barMaxWidth:30,yAxisIndex:U,data:O,smooth:!1,color:R,lineStyle:{width:3},areaStyle:{opacity:.3,color:R},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:R,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(R)},lineStyle:{color:R},areaStyle:{opacity:.3,color:R}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);be(()=>a.appliedGroupKey,D=>{_.value=D});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{var V;let D=[{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(U=>U.customer_count)}];return w.value&&D.unshift({name:u("Compare Range"),key:"customer_count",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:(V=a.compareData)==null?void 0:V.map(U=>({value:U.customer_count,date:U.group}))}),D.map(U=>m(U.name,U.type,0,U.data,U.color))});let b=null;const x=()=>{b&&(b.dispose(),b=null),Be(()=>{l.value&&(b=ea(l.value),$())})},F=K(()=>{const D=Es(a.reportFilter.data.dateRange);return u("Customers that first ordered ")+D}),M=K(()=>ul(a.chartData.length)),$=()=>{if(!b)return;const D=Il(a.chartData),V={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:U=>{let O="";const R=p.value?"#ffffff":"#565865";return U.forEach(function(P,j){const q=typeof P.data=="object"&&P.data!==null,z=q?Us(P.data.date):P.name,X=q?P.data.value:P.value,ne=U.length>1&&j===0;ne&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${z}</div>`,O+=`<div>
237 ${P.marker}
238 <span style="color: ${R}">${u("Customer")}</span>
239 <span style="float: right; margin-left: 20px; color: ${R}">
240 ${ua(X)}
241 </span>
242 </div>`,ne&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.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};b.setOption(V,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value?b.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}]}):$()},I=D=>{ga.onChange("revenue","revenue_chart",D),s.value!==D&&(i.value=!1,s.value=D,$())};be([()=>a.chartData,_],()=>{Be($)},{deep:!0}),be(()=>Ml.data.revenue,()=>{Be(()=>{$()})},{deep:!0}),be(()=>a.isEmpty,D=>{D||x()}),be(()=>a.loading,D=>{D||x()});const Q=()=>{p.value=Ve.isDark(),Be(()=>{$()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),Be(()=>{x()})}),(D,V)=>{const U=C("el-tooltip"),O=C("el-option"),R=C("el-select"),P=C("el-skeleton");return r(),h("div",Foe,[n(xe,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",$oe,[o("h5",Eoe,f(A(u)("New Customers")),1),n(U,{"popper-class":"fct-tooltip",content:F.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",Uoe,[n(R,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":V[0]||(V[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,j=>n(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:re(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(bt,{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",Ioe,[o("div",Qoe,[o("div",Doe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Voe,f(A(u)("Data")),1)]),o("div",Toe,[o("span",Moe,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Roe={name:"Comparison",components:{CardContainer:xe,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}`}}}},Ooe={class:"fct-revenue-comparison"},Hoe={class:"inline-flex"},Poe={class:"inline-flex"};function Noe(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",Ooe,[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(m,{label:"Date"},{default:d(v=>[L(f(v.row.group),1)]),_:1}),n(m,{label:i.translate("Current Range")},{default:d(v=>[o("div",Hoe,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(m,{label:i.translate("Compare Range")},{default:d(v=>[o("div",Poe,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:re(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Koe=st(Roe,[["render",Noe]]),Goe={class:"fct-customer-report-page"},joe={__name:"CustomerReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T({summary:{},previousSummary:{},fluctuations:{},currentMetrics:[],previousMetrics:[],loading:!0}),l=T("default"),s=t.reportFilter,i=s.applicableFilters.params,c=(m,_="default")=>{a.value.loading=!0,ue.get("reports/customer-report",{params:{...m,groupKey:_}}).then(g=>{a.value=g}).finally(()=>{a.value.loading=!1})},p=m=>{l.value!==m&&(l.value=m,c(i,m))};return Ie(()=>{c(i),t.reportFilter.addListener("customer-report",m=>{c(m.params,l.value)})}),(m,_)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",Goe,[n(sl,{title:A(u)("Customers")},null,8,["title"]),n(Soe,{reportFilter:A(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),n(Loe,{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(Koe,{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}))}},zoe={class:"fct-revenue-report-page"},qoe={class:"fct-revenue-comparison fct-table-wrapper"},Yoe={class:"fct-card"},Woe={class:"fct-card-header"},Xoe={class:"fct-card-header-top"},Joe={class:"fct-card-header-left flex-1"},Zoe={class:"search-bar is-transparent"},eie={class:"text-xs text-system-light pt-1 dark:text-gray-300"},tie={class:"fct-card-header-actions"},aie={class:"w-[130px]"},lie={class:"fct-btn-group sm"},sie={class:"filter-popover-item"},nie={class:"filter-popover-title"},oie={class:"fct-card-body"},iie={key:1,class:"unknown"},rie={key:1,class:"unknown"},die={key:1,class:"unknown"},uie={key:1,class:"unknown"},cie={key:1,class:"unknown"},Aie={key:1,class:"unknown"},pie={class:"inline-flex items-center gap-2"},fie={class:"inline-flex items-center gap-2"},mie={class:"inline-flex items-center gap-2"},hie={class:"inline-flex items-center gap-2"},_ie={class:"inline-flex items-center gap-2"},vie=4,gie={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T([]),l=T({}),s=T(!1),i=T({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=T(["utm_campaign","utm_source","utm_medium"]),p=T(!0),m=T(""),_=K(()=>a.value.filter(v=>{if(!m.value)return!0;const w=m.value.toLowerCase();return v.utm_campaign&&v.utm_campaign.toLowerCase().includes(w)||v.utm_source&&v.utm_source.toLowerCase().includes(w)||v.utm_medium&&v.utm_medium.toLowerCase().includes(w)||v.utm_term&&v.utm_term.toLowerCase().includes(w)||v.utm_content&&v.utm_content.toLowerCase().includes(w)||v.utm_id&&v.utm_id.toLowerCase().includes(w)})),g=()=>{p.value=!0,ue.get("/reports/sources",t.reportFilter.applicableFilters).then(v=>{a.value=v.sourceReportData,l.value=v.fluctuations||{}}).finally(()=>{p.value=!1})},y=v=>c.value.includes(v)?!1:c.value.length>=vie;return Ie(()=>{g(),t.reportFilter.addListener("product-top-chart",()=>{g()})}),(v,w)=>{const k=C("el-input"),b=C("el-switch"),x=C("el-checkbox"),F=C("el-checkbox-group"),M=C("el-tooltip"),$=C("el-popover"),S=C("el-skeleton"),I=C("el-table-column"),Q=C("el-table");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",zoe,[n(sl,{title:A(u)("Order Sources")},null,8,["title"]),o("div",qoe,[o("div",Yoe,[o("div",Woe,[o("div",Xoe,[o("div",Joe,[o("div",Zoe,[n(k,{placeholder:A(u)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:m.value,"onUpdate:modelValue":w[0]||(w[0]=D=>m.value=D)},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",eie,f(A(u)("Filter results by UTM values")),1)]),o("div",tie,[o("div",aie,[n(b,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=D=>s.value=D),"active-text":A(u)("Net"),"inactive-text":A(u)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),o("div",lie,[n($,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(M,{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",sie,[o("h3",nie,f(v.$t("Columns")),1),n(F,{class:"fct-checkbox-blocks",modelValue:c.value,"onUpdate:modelValue":w[2]||(w[2]=D=>c.value=D)},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(D,V)=>(r(),E(x,{label:D,value:V,disabled:y(V)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])])]),o("div",oie,[p.value?(r(),E(S,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),E(Q,{key:1,data:_.value,class:"w-full fct-source-report"},{empty:d(()=>[n(bt,{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(D=>[D.row.utm_campaign?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:V=>m.value=D.row.utm_campaign},{default:d(()=>[L(f(D.row.utm_campaign),1)]),_:2},1032,["onClick"])):(r(),h("span",iie,f(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(D=>[D.row.utm_source?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:V=>m.value=D.row.utm_source},{default:d(()=>[L(f(D.row.utm_source),1)]),_:2},1032,["onClick"])):(r(),h("span",rie,f(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(D=>[D.row.utm_medium?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:V=>m.value=D.row.utm_medium},{default:d(()=>[L(f(D.row.utm_medium),1)]),_:2},1032,["onClick"])):(r(),h("span",die,f(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(D=>[D.row.utm_term?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:V=>m.value=D.row.utm_term},{default:d(()=>[L(f(D.row.utm_term),1)]),_:2},1032,["onClick"])):(r(),h("span",uie,f(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(D=>[D.row.utm_content?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:V=>m.value=D.row.utm_content},{default:d(()=>[L(f(D.row.utm_content),1)]),_:2},1032,["onClick"])):(r(),h("span",cie,f(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(D=>[D.row.utm_id?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:V=>m.value=D.row.utm_id},{default:d(()=>[L(f(D.row.utm_id),1)]),_:2},1032,["onClick"])):(r(),h("span",Aie,f(A(u)("Unknown")),1))]),_:1},8,["label"])):B("",!0),n(I,{label:A(u)("Orders"),width:"200"},{default:d(D=>{var V,U;return[o("div",pie,[L(f(A(ua)(D.row.orders))+" ",1),n(ml,{class:"flex",fluctuation:((V=l.value[D.row.utm_key])==null?void 0:V.orders_fluctuation)||0,amount:((U=l.value[D.row.utm_key])==null?void 0:U.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(D=>{var V,U;return[o("div",fie,[L(f(A(et).scaled(D.row.net_sales))+" ",1),n(ml,{class:"flex",fluctuation:((V=l.value[D.row.utm_key])==null?void 0:V.net_sales_fluctuation)||0,amount:((U=l.value[D.row.utm_key])==null?void 0:U.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(I,{label:A(u)("Average Order Net"),width:"200"},{default:d(D=>{var V,U;return[o("div",mie,[L(f(A(et).scaled(D.row.average_net_order))+" ",1),n(ml,{class:"flex",fluctuation:((V=l.value[D.row.utm_key])==null?void 0:V.average_net_order_fluctuation)||0,amount:((U=l.value[D.row.utm_key])==null?void 0:U.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(D=>{var V,U;return[o("div",hie,[L(f(A(et).scaled(D.row.gross_sales))+" ",1),n(ml,{class:"flex",fluctuation:((V=l.value[D.row.utm_key])==null?void 0:V.gross_sales_fluctuation)||0,amount:((U=l.value[D.row.utm_key])==null?void 0:U.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(I,{label:A(u)("Average Order"),width:"200"},{default:d(D=>{var V,U;return[o("div",_ie,[L(f(A(et).scaled(D.row.average_order))+" ",1),n(ml,{class:"flex",fluctuation:((V=l.value[D.row.utm_key])==null?void 0:V.average_order_fluctuation)||0,amount:((U=l.value[D.row.utm_key])==null?void 0:U.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},yie={class:"fct-revenue-line-chart-wrap"},bie={class:"flex items-center gap-2"},wie={class:"fct-card-header-title is-small"},Cie={class:"fct-chart-select"},kie={class:"fct-btn-group sm"},Bie={class:"chart-action-wrap"},xie={class:"chart-change-wrap"},Sie={class:"chart-change"},Fie={class:"text"},$ie={class:"chart-change"},Eie={class:"text"},Uie={__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=T(null),s=T(ga.getChartType("product","product_chart")||"bar"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(V,U,O,R,P)=>({name:V,type:U,barMaxWidth:30,yAxisIndex:O,data:R,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:za(P)},lineStyle:{color:P},areaStyle:{opacity:.3,color:P}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T("default"),g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{let V=[{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(U=>U.units_sold)}];return w.value&&V.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(U=>({value:U.units_sold,date:U.group}))}),V.map(U=>m(U.name,U.type,0,U.data,U.color))});let b=null;const x=()=>{b&&(b.dispose(),b=null),Be(()=>{l.value&&(b=ea(l.value),$())})},F=K(()=>{const V=Es(a.reportFilter.data.dateRange);return u("This report looks at the units sold ")+V}),M=K(()=>ul(a.chartData.length)),$=()=>{if(!b)return;const V=Il(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}},formatter:O=>{let R="";const P=p.value?"#ffffff":"#565865";return O.forEach(function(j,q){const z=typeof j.data=="object"&&j.data!==null,X=z?Us(j.data.date):j.name,ne=z?j.data.value:j.value,he=O.length>1&&q===0;he&&(R+='<div style="margin-bottom: 10px">'),R+=`<div>${X}</div>`,R+=`<div>
243 ${j.marker}
244 <span style="color: ${P}">${u("Units Sold")}</span>
245 <span style="float: right; margin-left: 20px; color: ${P}">
246 ${ua(ne)}
247 </span>
248 </div>`,he&&(R+="</div>")}),R}},grid:{show:!1},xAxis:{type:"category",data:V,splitNumber:M.value.splitNumber,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.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};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value&&b?b.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&&$()},I=V=>{ga.onChange("revenue","revenue_chart",V),s.value!==V&&(i.value=!1,s.value=V,$())};be([()=>a.chartData,_],()=>{Be(()=>{$()})},{deep:!0}),be(()=>Ml.data.product,()=>{Be(()=>{$()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||x()}),be(()=>a.loading,V=>{V||x()});const Q=()=>{b&&b.resize()},D=()=>{p.value=Ve.isDark(),Be(()=>{$()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("resize",Q),setTimeout(()=>{x()},100)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("resize",Q),b&&(b.dispose(),b=null)}),(V,U)=>{const O=C("el-tooltip"),R=C("el-option"),P=C("el-select"),j=C("el-skeleton");return r(),h("div",yie,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",bie,[o("h5",wie,f(A(u)("Product Report Chart")),1),n(O,{"popper-class":"fct-tooltip",content:F.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",Cie,[n(P,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=q=>_.value=q),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,q=>n(R,{key:q.value,label:A(u)(q.label),value:q.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",kie,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:re(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(j,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",Bie,[o("div",xie,[o("div",Sie,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Fie,f(A(u)("Data")),1)]),o("div",$ie,[o("span",Eie,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Iie=st(Uie,[["__scopeId","data-v-259e83ce"]]);class Qie extends nl{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 yl=Qie.init(),Die={class:"summary-item-inner"},Vie={class:"value"},Tie={class:"inner-value"},Mie={class:"title"},Lie={__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=K(()=>yl.data.isBusy),s=K(()=>a.map(p=>({key:p.key,title:p.title,value:yl.data.summary[p.key]||0,fluctuation:yl.data.fluctuations[p.key]||0,info:p.info,liability:p.liability||!1,hasCurrency:p.hasCurrency||!1}))),i=K(()=>a.filter(p=>p.hasCurrency).map(p=>p.key)),c=p=>i.value.includes(p.key)?xl(p.value,p.liability):ua(p.value);return(p,m)=>{const _=C("el-tooltip");return l.value?(r(),E(Ll,{key:0,loading:l.value,count:s.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:re(["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",Die,[o("div",Vie,[o("div",Tie,[n(Is,{amount:c(g),title:g.title},null,8,["amount","title"])]),n(ml,{fluctuation:g.fluctuation,amount:A(yl).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",Mie,[L(f(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))}}},Rie={class:"fct-product-performance-chart"},Oie={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},Hie={class:"flex items-center gap-3 flex-wrap"},Pie={class:"selector-group"},Nie={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"},Kie={class:"selector-group"},Gie={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"},jie={class:"text-xs font-medium text-gray-500"},zie={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"},qie={class:"text-xs font-medium text-gray-500"},Yie={key:0,class:"comparison-results"},Wie={class:"legend flex items-center gap-4 mb-4"},Xie={class:"flex items-center"},Jie={class:"text-xs text-gray-600"},Zie={class:"flex items-center"},ere={class:"text-xs text-gray-600"},tre={class:"comparison-table"},are={class:"w-full"},lre={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},sre={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"},nre={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"},ore={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"},ire={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},rre={class:"py-3"},dre={class:"dual-bar-container"},ure={class:"bar-label"},cre={class:"dual-bar-wrapper"},Are=["onMouseenter"],pre=["onMouseenter"],fre={class:"py-3 text-right"},mre={key:0},hre={colspan:"3",class:"py-4 text-center text-gray-500"},_re={class:"text-sm"},vre={key:1,class:"current-period-data"},gre={class:"legend flex items-center gap-4 mb-4"},yre={class:"flex items-center"},bre={class:"text-xs text-gray-600"},wre={class:"current-period-table"},Cre={class:"w-full"},kre={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Bre={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"},xre={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"},Sre={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Fre={class:"py-3"},$re={class:"single-bar-container"},Ere=["onMouseenter"],Ure={class:"single-bar-wrapper"},Ire=["onMouseenter"],Qre={key:0},Dre={colspan:"2",class:"py-4 text-center text-gray-500"},Vre={class:"text-sm"},Tre={key:2,class:"no-comparison-message"},Mre={class:"flex flex-col items-center justify-center text-center py-8"},Lre={class:"text-gray-500 text-sm"},Rre={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){wf(Z=>({38870964:a.value?"#1C2732":"#F9FAFB","38e9f3a8":P.value,"71ec137a":j.value,"2fc09a58":q.value}));const t=e,a=T(Ve.isDark()),l=T(!0);Ie(()=>{i(),t.reportFilter.addListener("product-top-chart",()=>{i()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=Ve.isDark()})}),T({});const s=T({}),i=()=>{l.value=!0;const Z=t.reportFilter.applicableFilters;ue.get("reports/product-performance",Z).then(W=>{s.value=W.productPerformance,w(),M(!0)}).finally(()=>l.value=!1)},c=K(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),p=T(""),m=T(""),_=T(""),g=T(""),y=Z=>Z.sort((W,ie)=>at(W.value).diff(at(ie.value))),v=T([]),w=()=>{const Z=new Set;Object.keys(s.value).forEach(W=>{const ie=W.split("-")[0];Z.add(ie)}),v.value=Array.from(Z).sort()},k=Z=>{if(!Z)return[];const W=[];return Object.keys(s.value).forEach(ie=>{ie.startsWith(Z)&&W.push({value:ie,label:at(ie).format("MMMM")})}),y(W)},b=K(()=>{if(!p.value||!_.value)return!1;const Z=!!m.value,W=!!g.value;return!Z&&!W?p.value!==_.value:Z&&W?m.value!==g.value:!0}),x=K(()=>m.value?at(m.value).format("MMM YYYY"):p.value),F=K(()=>g.value?at(g.value).format("MMM YYYY"):_.value),M=(Z=!1)=>{const W=v.value;if(W.length){if(!p.value||Z){p.value=W[0];const ie=k(p.value);ie.length&&(m.value=ie[0].value)}if(!_.value||Z){_.value=W[W.length-1];const ie=k(_.value);ie.length&&(g.value=ie[ie.length-1].value)}}},$=Z=>s.value[Z]||[],S=Z=>{const W={};Object.entries(s.value).forEach(([ye,fe])=>{ye.startsWith(Z)&&fe.forEach(ge=>{W[ge.name]||(W[ge.variation_id]={...ge,value:0}),W[ge.variation_id].value+=ge.value})});const ie=[];return Object.values(W).forEach(ye=>{ie.push(ye)}),ie},I=(Z,W)=>W?$(W):(S(Z),S(Z)),Q=K(()=>p.value?[...I(p.value,m.value)].sort((W,ie)=>ie.value-W.value):[]),D=K(()=>Q.value.length?Math.max(...Q.value.map(Z=>Z.value))*1.1:100),V=Z=>Z===0||D.value===0?0:Z/D.value*100,U=K(()=>{if(!b.value)return[];const Z=I(p.value,m.value),W=I(_.value,g.value),ie=new Set;return Z.forEach(ge=>ie.add(ge.variation_id)),W.forEach(ge=>ie.add(ge.variation_id)),Array.from(ie).map(ge=>{const se=Z.find(Xe=>Xe.variation_id===ge),pe=(se==null?void 0:se.value)||0,$e=W.find(Xe=>Xe.variation_id===ge),tt=($e==null?void 0:$e.value)||0;let _e=0;return pe>0?_e=(tt-pe)/pe*100:tt>0&&(_e=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:pe,comparisonValue:tt,growthRate:parseFloat(_e.toFixed(1))}}).sort((ge,se)=>Math.abs(se.growthRate)-Math.abs(ge.growthRate))}),O=(Z,W)=>{if(Z===0&&W===0)return{primaryWidth:0,comparisonWidth:0};const ie=Z+W,ye=Z/ie*100,fe=W/ie*100;return{primaryWidth:ye,comparisonWidth:fe}},R=Z=>Z>0?"positive":Z<0?"negative":"neutral",P=K(()=>a.value?Ve.colors.report.dark_cyan_blue_16:Ve.colors.report.light_gray),j=K(()=>a.value?Ve.colors.report.dark_cyan_blue_36:Ve.colors.report.light_gray_cyan_blue),q=K(()=>a.value?"#ffffff":Ve.colors.system.mid),z=(Z,W)=>`${Z} ${ko("unit","units",Z)} sold in ${W}`,X=T(!1),ne=T(""),he=T(null);function N(Z,W){he.value=Z.currentTarget,ne.value=W,setTimeout(()=>{X.value=!0},150)}function G(){X.value=!1}return(Z,W)=>{const ie=C("el-skeleton"),ye=C("el-option"),fe=C("el-select"),ge=C("el-tooltip");return r(),h("div",Rie,[n(xe,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(bt,{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",Oie,[o("div",Hie,[o("div",Pie,[n(fe,{modelValue:p.value,"onUpdate:modelValue":W[0]||(W[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(ye,{key:se,label:se,value:se},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fe,{modelValue:m.value,"onUpdate:modelValue":W[1]||(W[1]=se=>m.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(ye,{key:se.value,label:se.label,value:se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",Nie,f(A(u)("vs")),1),o("div",Kie,[n(fe,{modelValue:_.value,"onUpdate:modelValue":W[2]||(W[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(ye,{key:se,label:se,value:se},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fe,{modelValue:g.value,"onUpdate:modelValue":W[3]||(W[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(ye,{key:se.value,label:se.label,value:se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),b.value?(r(),h("div",Gie,[o("span",jie,f(A(u)("Comparing %s with %s",x.value,F.value)),1)])):p.value?(r(),h("div",zie,[o("span",qie,f(A(u)("Viewing %s",x.value)),1)])):B("",!0)]),b.value?(r(),h("div",Yie,[o("div",Wie,[o("div",Xie,[W[5]||(W[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",Jie,f(x.value),1)]),o("div",Zie,[W[6]||(W[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",ere,f(F.value),1)])]),o("div",tre,[o("table",are,[o("thead",lre,[o("tr",null,[o("th",sre,f(A(u)("Product")),1),o("th",nre,f(A(u)("Sales")),1),o("th",ore,f(A(u)("Change")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(U.value,(se,pe)=>(r(),h("tr",{key:pe,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",ire,[L(f(se.post_title)+" ",1),W[7]||(W[7]=o("br",null,null,-1)),L(" "+f(se.name),1)]),o("td",rre,[o("div",dre,[o("span",ure,f(se.primaryValue)+f(" vs "+se.comparisonValue)+" "+f(A(u)("Units")),1),o("div",cre,[o("div",{class:"dual-bar-segment primary-segment",style:ra({width:`${O(se.primaryValue,se.comparisonValue).primaryWidth}%`}),onMouseenter:$e=>N($e,z(se.primaryValue,x.value)),onMouseleave:G},null,44,Are),o("div",{class:"dual-bar-segment comparison-segment",style:ra({width:`${O(se.primaryValue,se.comparisonValue).comparisonWidth}%`}),onMouseenter:$e=>N($e,z(se.comparisonValue,F.value)),onMouseleave:G},null,44,pre)])])]),o("td",fre,[o("div",{class:re(["growth-pill",R(se.growthRate)])},f(se.growthRate>0?"+":"")+f(se.growthRate)+"% ",3)])]))),128)),U.value.length===0?(r(),h("tr",mre,[o("td",hre,[o("span",_re,f(A(u)("No comparison data available")),1)])])):B("",!0)])])])])):p.value&&Q.value.length>0?(r(),h("div",vre,[o("div",gre,[o("div",yre,[W[8]||(W[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",bre,f(x.value),1)])]),o("div",wre,[o("table",Cre,[o("thead",kre,[o("tr",null,[o("th",Bre,f(A(u)("Product")),1),o("th",xre,f(A(u)("Sales")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(Q.value,(se,pe)=>(r(),h("tr",{key:pe,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Sre,[L(f(se.post_title)+" ",1),W[9]||(W[9]=o("br",null,null,-1)),L(" "+f(se.name),1)]),o("td",Fre,[o("div",$re,[o("span",{class:"bar-label",onMouseenter:$e=>N($e,z(se.value,F.value)),onMouseleave:G},f(se.value)+" "+f(A(ko)("Unit","Units",se.value)),41,Ere),o("div",Ure,[o("div",{class:"single-bar-segment",style:ra({width:`${V(se.value)}%`}),onMouseenter:$e=>N($e,z(se.value,F.value)),onMouseleave:G},null,44,Ire)])])])]))),128)),Q.value.length===0?(r(),h("tr",Qre,[o("td",Dre,[o("span",Vre,f(A(u)("No data available for this period")),1)])])):B("",!0)])])])])):(r(),h("div",Tre,[o("div",Mre,[W[10]||(W[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",Lre,f(A(u)("Please select a time period to view sales data")),1)])])),n(ge,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:X.value,"onUpdate:visible":W[4]||(W[4]=se=>X.value=se),content:ne.value,"virtual-ref":he.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},Ore=st(Rre,[["__scopeId","data-v-5cf85c06"]]),Hre={class:"fct-revenue-report-page"},Pre={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=p=>{yl.getProductReportData({params:{...p.params,groupKey:c.value}}),yl.getTopSoldProducts(p)},l=p=>{c.value!==p&&(c.value=p,a(i))},s=t.reportFilter,i=s.applicableFilters,c=T("default");return Ie(()=>{s.addListener("product-report",a),a(i)}),Bt(()=>{s.removeListener("product-report",!1)}),(p,m)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",Hre,[n(sl,{title:A(u)("Products")},null,8,["title"]),n(Lie,{reportFilter:A(s)},null,8,["reportFilter"]),n(Iie,{chartData:A(yl).data.currentMetrics,compareData:A(yl).data.previousMetrics,appliedGroupKey:c.value,reportFilter:t.reportFilter,onFilterData:l,"is-empty":!A(yl).data.summary.gross_sale,loading:A(yl).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),n(gd,{data:A(yl).data.topSoldProducts,loading:A(yl).data.isBusy},null,8,["data","loading"]),n(Ore,{reportFilter:A(s)},null,8,["reportFilter"])])]),_:1}))}},Nre={class:"fct-overview-chart-wrap"},Kre={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Gre={__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=T(null),l=T(null),s=T("bar"),i=T(null),c=Ve.colors,p=T(Ve.isDark()),m=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_={current:u("Current"),prev:u("Previous"),yoy_growth:u("YoY Growth")},g=K(()=>{try{return Object.keys(t.data).map(M=>({label:M,value:t.data[M][t.dataKey]||0}))}catch(F){return i.value=`Error processing data: ${F.message}`,[]}}),y=K(()=>g.value.length?t.dateRange?g.value.map(F=>{try{const[M,$]=F.label.split("-");return new Date(M,$-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return F.label}}):g.value.map(F=>F.label):[]),v=K(()=>g.value.length?[{title:_[t.dataKey]||t.dataKey,data:g.value.map(M=>M.value),color:m.value,yAxisIndex:0}].map(({title:M,data:$,color:S,yAxisIndex:I})=>x(M,s.value,$,S,I)):[]);let w=null;const k=()=>{if(a.value&&w===null)try{w=ea(a.value),b()}catch(F){i.value=`Error initializing chart: ${F.message}`}},b=()=>{if(!w||i.value)return;p.value=Ve.isDark();const F={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:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}},formatter:M=>{let $=M[0].name;const S=p.value?"#ffffff":"#565865";return M.forEach(I=>{const Q=et.formatScaled(I.value);$+=`<div>
249 ${I.marker}
250 <span style="color: ${S};">${I.seriesName}</span>
251 <span style="float: right; margin-left: 20px; color: ${S};">
252 ${Q}
253 </span>
254 </div>`}),$}},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:M=>`${et.formatScaledChart(M)}`},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{w.setOption(F,{notMerge:!0,replaceMerge:["series"]})}catch(M){i.value=`Error updating chart: ${M.message}`}},x=(F,M,$,S,I)=>({name:F,type:M,barMaxWidth:t.barMaxWidth,areaStyle:M==="line"?{}:void 0,data:$,smooth:!0,color:S,lineStyle:{width:2},yAxisIndex:I,emphasis:{itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,()=>t.dataKey,()=>t.labelSet,s],()=>{Be(b)},{deep:!0}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),w&&(w.dispose(),w=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),Be(k)}),(F,M)=>(r(),h("div",Nre,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Ce,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",Kre,f(i.value),1)):B("",!0),e.isEmpty?(r(),E(bt,{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)]))}},po=st(Gre,[["__scopeId","data-v-c9fd4c06"]]),jre={class:"fct-gross-volume-chart-wrap"},zre={key:0,class:"error-message",style:{color:"red",padding:"10px"}},qre={__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=T(null),l=T(null),s=T("bar"),i=T(null),c=Ve.colors,p=T(Ve.isDark()),m={current:u("Current"),prev:u("Previous"),prev_year:u("Previous"),yoy_growth:u("YoY Growth")},_=K(()=>{if(!t.data||typeof t.data!="object")return i.value="Invalid or missing data prop",[];try{return Object.keys(t.data).map(M=>{const $=t.data[M];return{label:M,current:$[t.currentKey]?parseInt($[t.currentKey]):0,prev:$[t.prevKey]?parseInt($[t.prevKey]):0,growth:$[t.labelKey]?parseFloat($[t.labelKey]):0}})}catch(F){return i.value=`Error processing data: ${F.message}`,[]}}),g=K(()=>_.value.length?_.value.map(F=>{if(t.isDate)try{const[M,$]=F.label.split("-");return new Date(M,$-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return F.label}else return F.label}):[]),y=K(()=>_.value.length?[{title:m[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:p.value?c.report.blue_dark_mode:c.report.blue},{title:m[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:p.value?c.blue[500]+"52":c.blue[300]}].map(({title:F,dataKey:M,type:$,color:S})=>x(F,$,_.value.map(I=>I[M]),S)):[]),v=K(()=>_.value.length?_.value.map(M=>M.growth):[]);let w=null;const k=()=>{if(a.value&&w===null)try{w=ea(a.value),b()}catch(F){i.value=`Error initializing chart: ${F.message}`}},b=()=>{if(!w||i.value)return;p.value=Ve.isDark();const F={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:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}},formatter:M=>{let $=M[0].name;const S=p.value?"#ffffff":"#565865",I=v.value[M[0].dataIndex];M.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(I)?"N/A":I.toFixed(2)+"%"});const Q=p.value?c.report.dark_cyan_blue_16:c.report.light_gray_blue;return M.forEach(function(D,V){const U=V===M.length-1,O=U?D.value:et.formatScaled(D.value);U?$+=`<div style="border-top: 1px solid ${Q}; margin-top: 5px; padding-top: 5px;">`:$+="<div>",$+=`
255 ${D.marker}
256 <span style="color: ${S};">${D.seriesName}</span>
257 <span style="float: right; margin-left: 20px; color: ${S};">
258 ${O}
259 </span>
260 </div>`}),$}},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)",et.currencySign),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:M=>et.formatScaledChart(M)},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:"YoY Growth (%)",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:"{value}%"},splitLine:{show:!1},min:Math.min(...v.value.filter(M=>!isNaN(M)),0)-5,max:Math.max(...v.value.filter(M=>!isNaN(M)),0)+5}],series:y.value};try{w.setOption(F,{notMerge:!0,replaceMerge:["series"]})}catch(M){i.value=`Error updating chart: ${M.message}`}},x=(F,M,$,S,I=0)=>({name:F,type:M,barMaxWidth:t.barMaxWidth,areaStyle:M==="line"?null:void 0,data:$,smooth:M==="line",color:S,lineStyle:M==="line"?{width:2}:void 0,yAxisIndex:I,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,s],()=>{Be(b)},{deep:!0}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),w&&(w.dispose(),w=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),Be(k)}),(F,M)=>(r(),h("div",jre,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Qe,{title:A(u)(e.title),title_size:"small",border_bottom:""},{action:d(()=>M[0]||(M[0]=[])),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",zre,f(i.value),1)):B("",!0),e.isEmpty?(r(),E(bt,{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)]))}},ic=st(qre,[["__scopeId","data-v-f7c41726"]]),Yre={class:"fct-country-volume-chart-wrap"},Wre={class:"fct-btn-group sm"},Xre={__name:"CountryVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=T(null),l=T(null);let s=null;const i=T("bar");T("");const c=T(Ve.isDark()),p=K(()=>[c.value?"#032647":"#3e9df6",c.value?"#04315b":"#1589f4",c.value?"#053c70":"#0a73d5",c.value?"#064784":"#0968c1",c.value?"#075298":"#085dad"]),m=K(()=>{const x=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!x.length||!x.every(F=>!!F)}),_=Ve.colors,g=K(()=>{const x=t.data.by_month||{};return Object.keys(x).sort().map(M=>{const $=x[M],S=Object.values($).reduce((Q,D)=>Q+D,0),I=Object.entries($).sort((Q,D)=>Q[1]-D[1]).reduce((Q,[D,V])=>({...Q,[D]:V}),{});return{label:M,countries:I,total:S}})}),y=K(()=>g.value.length?g.value.map(x=>{try{const[F,M]=x.label.split("-");return at(new Date(F,M-1)).format("MMM YYYY")}catch{return x.label}}):[]),v=K(()=>{const x=t.data.by_month||{},F=Object.keys(x).sort(),M=new Set;return Object.values(x).forEach($=>{Object.keys($).forEach(S=>M.add(S))}),Array.from(M).reverse().map($=>{let S;const I=g.value.map((Q,D)=>{const V=x[F[D]],O=Object.entries(V).sort((j,q)=>q[1]-j[1]).map(([j])=>j).indexOf($),R=Q.countries[$]||0,P=O<5?O:4;return!S&&P>=0&&(S=p.value[P]||p.value[4]),{value:R/100,label:{show:R>0,position:"inside",formatter:$,color:(c.value,"#fff"),fontSize:10,fontWeight:"bold"}}});return{name:$,type:i.value,stack:"total",data:I,itemStyle:{color:S},lineStyle:{color:S}}})}),w=()=>{if(!a.value)return;s=ea(a.value);const x={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",textStyle:{color:c.value?_.gray[25]:_.system.mid},borderColor:c.value?"#2C3C4E":"#c0c4ca",axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?_.report.dark_cyan_blue_16:_.report.light_gray_cyan_blue}},borderWidth:1,formatter:F=>{let M=F[0].axisValue;const $=c.value?"#ffffff":"#565865",S=g.value[F[0].dataIndex].total;F=F.sort((Q,D)=>D.value-Q.value).filter(Q=>Q.value>0),F.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:u("Total"),value:S/100});const I=c.value?_.report.dark_cyan_blue_16:_.report.light_gray_blue;return F.forEach(function(Q,D){const V=D===F.length-1;if(!V&&Q.value===0)return;const U=et.scaled(Q.value);V?M+=`<div style="border-top: 1px solid ${I}; margin-top: 5px; padding-top: 5px;">`:M+="<div>",M+=`
261 ${Q.marker}
262 <span style="color: ${$};">${Q.seriesName}</span>
263 <span style="float: right; margin-left: 20px; color: ${$};">
264 ${U}
265 </span>
266 </div>`}),M}},xAxis:{type:"category",data:y.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)",et.currencySign),axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:F=>et.formatScaled(F*100)},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:v.value};s.setOption(x)},k=()=>{c.value=Ve.isDark(),Be(()=>{w()})},b=()=>{s&&(s.dispose(),s=null),w()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",k),window.addEventListener("fluentCartCurrencyChange",b),Be(w)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1)}),be(()=>c.value,()=>{s&&(s.dispose(),w())}),be(()=>t.data,()=>{s&&w()}),(x,F)=>(r(),h("div",Yre,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Qe,{title:e.title,title_size:"small",border_bottom:""},{action:d(()=>[o("div",Wre,[n(pm,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[m.value?(r(),E(bt,{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)]))}},rc=st(Xre,[["__scopeId","data-v-89fa1969"]]),Jre={class:"fct-card-header-title is-small"},dc={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=Ve.colors.report,l=T(Ve.isDark()),s=T(null),i=T("line"),c=T(t.data),p=K(()=>({textColor:l.value?"#ffffff":"#696778",borderColor:l.value?"#2C3C4E":"#c0c4ca",splitLineColor:l.value?"#253241":"#D6DAE1",bgColor:l.value?"#2d3748":"#ffffff"})),m=K(()=>Object.values(c.value).every(b=>b===0)),_=K(()=>Object.keys(c.value)),g=K(()=>[{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=ea(s.value),w())},w=()=>{if(!y)return;const b={legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:p.value.bgColor,borderColor:p.value.borderColor,borderWidth:1,textStyle:{color:p.value.textColor},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:l.value?a.dark_cyan_blue_16:a.light_gray_blue}},formatter:x=>{let F=x[0].name;const M=l.value?"#ffffff":"#565865";return x.forEach($=>{const S=et.formatScaled($.value);F+=`<div>
267 ${$.marker}
268 <span style="color: ${M};">${$.seriesName}</span>
269 <span style="float: right; margin-left: 20px; color: ${M};">
270 ${S}
271 </span>
272 </div>`}),F}},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:x=>et.formatScaled(x)},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(b,{notMerge:!0,replaceMerge:["series"]})};be([()=>c.value,i,()=>l.value],()=>{Be(w)},{deep:!0});const k=()=>{l.value=Ve.isDark(),Be(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),window.addEventListener("fluentCartCurrencyChange",w),Be(v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),(b,x)=>(r(),E(xe,null,{default:d(()=>[e.title!==""?(r(),E(Qe,{key:0,border_bottom:!0},{title:d(()=>[o("h3",Jre,f(e.title),1)]),_:1})):B("",!0),n(Ce,null,{default:d(()=>[m.value?(r(),E(bt,{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}))}},Zre={class:"fct-overview-report-loader-wrap"},ede={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},tde={class:"fct-card-header-title is-small"},ade={class:"flex gap-2 mt-1"},lde={class:"py-6"},sde={class:"grid grid-cols-1"},nde={class:"fct-card-header-title is-small"},ode={class:"py-6"},ide={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},rde={class:"fct-card-header-title is-small"},dde={class:"flex gap-2 mt-1"},ude={class:"py-6"},cde={class:"grid grid-cols-1"},Ade={class:"fct-card-header-title is-small"},pde={class:"py-6"},fde={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},mde={class:"fct-card-header-title is-small"},hde={class:"py-6"},_de={__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"),m=C("el-skeleton");return r(),h("div",Zre,[o("div",ede,[(r(),h(H,null,ae(t,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",tde,f(_.title),1),o("div",ade,[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",lde,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",sde,[(r(),h(H,null,ae(2,_=>o("div",{key:_},[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-2/3"})]),_:1}),n(Qe,{border_bottom:!0},{title:d(()=>[o("h2",nde,f(A(u)("Gross Volume Breakdown")),1)]),_:1}),o("div",ode,[n(m,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",ide,[(r(),h(H,null,ae(a,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",rde,f(_.title),1),o("div",dde,[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",ude,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",cde,[(r(),h(H,null,ae(l,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h2",Ade,f(_.title),1)]),_:2},1024),o("div",pde,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",fde,[(r(),h(H,null,ae(s,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",mde,f(_.title),1)]),_:2},1024),o("div",hde,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},vde={class:"overview-summary-report-inline"},gde={class:"inner-value"},yde={__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",vde,[o("div",gde,[n(Is,{amount:A(et).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"])]))}},fo=st(yde,[["__scopeId","data-v-b394c9f1"]]),bde={class:"report-overview-page"},wde={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},Cde={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"},Bde={class:"fct-card-header-title is-small"},xde={class:"grid grid-cols-1"},Sde=["innerHTML"],Fde=["innerHTML"],$de={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Ede={class:"fct-card-header-title is-small"},Ude={class:"fct-card-header-title is-small"},Ide={class:"grid gap-4 grid-cols-1"},Qde={class:"grid gap-4 grid-cols-1"},Dde={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},Vde={__name:"Overview",setup(e){const t=T({}),a=T(!0),l=T({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,m="current",_="prev")=>{const g=rt.sum(p,"*."+m),y=rt.sum(p,"*."+_),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return K(()=>{var p,m;return((p=t.value.gross_summary)==null?void 0:p.yoy_growth)<0?"danger":((m=t.value.gross_summary)==null?void 0:m.yoy_growth)===null?"warning":"success"}),Ie(()=>{s()}),(p,m)=>(r(),h("div",bde,[o("div",wde,[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),L(" "+f(A(u)("Last %s Months",A(u)(12))),1)]),a.value?(r(),E(_de,{key:0})):(r(),h(H,{key:1},[o("div",Cde,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h3",kde,f(A(u)("Gross Summary")),1),n(fo,{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(po,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h3",Bde,f(A(u)("Gross Revenue Quarterly")),1),n(fo,{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(po,{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",xde,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(et).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,Sde),n(ic,{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(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(et).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,Fde),n(ic,{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",$de,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",Ede,f(A(u)("Net Revenue")),1),n(fo,{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(po,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",Ude,f(A(u)("Net Revenue Quarterly")),1),n(fo,{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(po,{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",Ide,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(rc,{data:t.value.top_country_gross,title:A(u)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Qde,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(rc,{data:t.value.top_country_net,title:A(u)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Dde,[n(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>{var _;return[n(dc,{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(xe,null,{default:d(()=>[n(Ce,null,{default:d(()=>{var _;return[n(dc,{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))]))}},Tde={class:"setting-wrap"},Mde={class:"setting-wrap-inner"},Lde={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},Rde={class:"grid gap-3 mb-6"},Ode={class:"grid gap-3 mb-6"},Hde={class:"grid gap-3 mb-6"},Pde={class:"grid gap-3"},Nde={class:"payment-method-list fct-content-card-list"},Kde=["id"],Gde={class:"flex items-start gap-3"},jde={class:"grid gap-2 flex-1"},zde={key:0,class:"fct-content-card-list-head stripe"},qde=["src","alt"],Yde=["src","alt"],Wde={class:"block font-semibold text-system-dark dark:text-gray-50"},Xde={class:"fct-content-card-list-content"},Jde={class:"fct-content-card-list-action flex items-center gap-2"},Zde={key:0},eue=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=Fp(),{form:a}=t.data,l=fs(),s=T([]),i=T([]),c=T(!0),p=T(!1),m=T(!0),_=T({}),g=T(!1),y=T({}),v=T(!1),w=T(""),k=T(""),b=T(""),x=K(()=>Object.keys(y.value).length>0),F=()=>{p.value=!0;let D=a.values;ue.post("settings/modules",{...D}).then(V=>{Y.success(u("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(V=>{if(V&&V.message)return Y.error(V);_.value=V}).finally(()=>{p.value=!1,m.value=!1,c.value=!1})},M=()=>{c.value=!0,ue.get("settings/modules",{}).then(D=>{var O,R;a.setSchema(D.fields).setDefaults(D.settings).initForm(),s.value=D.settings,i.value=D.fields,m.value=!1,p.value=!1;const V=((R=(O=D.fields)==null?void 0:O.modules_settings)==null?void 0:R.schema)||[];let U=!1;Array.isArray(V)?U=V.length>0:U=Object.keys(V).length>0,g.value=U}).finally(()=>{c.value=!1})},$=()=>{v.value=!0,ue.get("settings/modules/plugin-addons",{}).then(D=>{y.value=D.addons||{},b.value&&Be(()=>en.scrollToHashSection(b.value))}).catch(D=>{Y.error(D)}).finally(()=>{v.value=!1})},S=je.get("app_config.isProActive"),I=(D,V)=>{if(!S){window.open(D.repo_link,"_blank","noopener,noreferrer");return}w.value=V,ue.post("settings/modules/plugin-addons/install",{plugin_slug:D.plugin_slug,source_type:D.source_type||"wordpress",source_link:D.source_link||"",asset_path:D.asset_path||""}).then(U=>{U.action==="copy"&&U.url?(Yl.copy(U.url,{successMessage:u("Download link copied to your clipboard")}),window.open(U.url,"_blank","noopener,noreferrer")):U.action==="reload"?(Y.success(U.message||u("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):Y.success(U.message||u("Addon installed successfully"))}).catch(U=>{Y.error(U)}).finally(()=>{w.value=""})},Q=(D,V)=>{k.value=V,ue.post("settings/modules/plugin-addons/activate",{plugin_file:D.plugin_file}).then(U=>{Y.success(U.message||u("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(U=>{Y.error(U)}).finally(()=>{k.value=""})};return Ie(()=>{const D=window.location.hash||"",V=D.lastIndexOf("#");V>0&&(b.value=D.substring(V+1)),M(),$()}),l.onSave(F),(D,V)=>{const U=C("el-skeleton-item"),O=C("el-skeleton"),R=C("el-form"),P=C("el-button"),j=C("el-icon"),q=C("router-link");return r(),h("div",Tde,[n(Qa,{heading:A(u)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",Mde,[n(Da),m.value?(r(),h("div",Lde,[n(O,{loading:m.value,animated:""},{template:d(()=>[o("div",Rde,[n(U,{variant:"p",class:"w-[20%]"}),n(U,{variant:"p"})]),o("div",Ode,[n(U,{variant:"p",class:"w-[20%]"}),n(U,{variant:"p"})]),o("div",Hde,[n(U,{variant:"p",class:"w-[20%]"}),n(U,{variant:"p"})]),o("div",Pde,[n(U,{variant:"p",class:"w-[20%]"}),n(U,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),m.value?B("",!0):(r(),h(H,{key:1},[A(a).isReady?(r(),E(R,{key:0},{default:d(()=>[g.value?(r(),E(vi,{key:0,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:F,submitButtonText:A(u)("Save Settings"),loading:p.value,onOnChange:V[0]||(V[0]=z=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):x.value?B("",!0):(r(),E(xe,{key:1},{default:d(()=>[n(Qe,{title:A(u)("Features & addon"),border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[n(bt,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:A(u)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):B("",!0),x.value?(r(),E(xe,{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",Nde,[(r(!0),h(H,null,ae(y.value,(z,X)=>(r(),h("div",{key:X,class:"fct-content-card-list-item",id:z.plugin_slug===b.value?b.value:null},[o("div",Gde,[o("div",jde,[z.logo?(r(),h("div",zde,[o("img",{class:re({"dark:hidden":z.dark_logo}),src:z.logo,alt:z.title},null,10,qde),z.dark_logo?(r(),h("img",{key:0,src:z.dark_logo,alt:z.title,class:"hidden dark:block"},null,8,Yde)):B("",!0),o("span",Wde,f(z.title),1),z.is_active?(r(),E(fa,{key:1,status:"active",text:A(u)("Active")},null,8,["text"])):B("",!0)])):B("",!0),o("div",Xde,[o("p",null,f(z.description),1)])]),o("div",Jde,[z.upcoming?(r(),h("div",Zde,f(A(u)("Coming Soon")),1)):(r(),h(H,{key:1},[z.is_installed?z.is_installed&&!z.is_active&&(A(S)||z.source_type!=="github")?(r(),E(P,{key:1,type:"success",size:"small",loading:k.value===X,disabled:k.value===X,onClick:ne=>Q(z,X)},{default:d(()=>[L(f(A(u)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):B("",!0):(r(),E(P,{key:0,type:"primary",size:"small",loading:w.value===X,disabled:w.value===X,onClick:ne=>I(z,X)},{default:d(()=>[L(f(A(S)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),z.is_active&&X==="fluent-pdf"?(r(),E(q,{key:2,to:{path:"/settings/pdf-template"}},{default:d(()=>[n(j,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:d(()=>[n(A(Lc))]),_:1})]),_:1})):B("",!0)],64))])])],8,Kde))),128))])]),_:1})]),_:1})):B("",!0)],64))])])}}}),tue=st(eue,[["__scopeId","data-v-a315b5d5"]]),aue={class:"form-note"},lue={class:"form-note"},sue={class:"form-note"},nue={class:"form-note"},oue={class:"el-form-item__label"},iue={class:"h-[297px] w-full relative"},rue={class:"mt-2 mb-2"},due={class:"form-note"},uue={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"},cue={class:"setting-html-wrapper"},Aue={class:"setting-label"},pue={class:"form-note"},fue={class:"setting-fields-inner w-full"},mue={__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",aue,[o("p",null,f(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",lue,[o("p",null,f(A(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This
273 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",sue,[o("p",null,f(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",nue,[o("p",null,f(A(u)(`If someone replies to your notification email, this is where you would like to
274 receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,null,{default:d(()=>[o("div",oue,f(A(u)("Email Footer")),1),o("div",iue,[n(s,{animated:"",rows:7})]),o("div",rue,[o("div",due,[o("p",null,f(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
275 compliance.`)),1)])]),o("div",uue,[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",cue,[o("span",Aue,f(A(u)("Admin Email Address")),1),o("div",pue,[o("p",null,f(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(c,{lg:12},{default:d(()=>[o("div",fue,[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},hue={class:"setting-wrap"},_ue={class:"setting-wrap-inner"},vue={class:"form-note"},gue={class:"form-note"},yue={class:"form-note"},bue={class:"form-note"},wue={class:"el-form-item__label"},Cue={class:"mt-2 mb-2"},kue={class:"form-note"},Bue={class:"fct-powered-by-email-footer-checkbox"},xue={class:"setting-html-wrapper"},Sue={class:"setting-label"},Fue={class:"form-note"},$ue={class:"setting-fields-inner w-full"},Eue={class:"setting-save-action"},Uue={__name:"MailingSettings",setup(e){const t=T({from_name:"",from_email:"",reply_to_name:"",reply_to_email:"",email_footer:"",show_email_footer:"yes",admin_email:"{{wp.admin_email}}"}),a=je.get("app_config.isProActive"),l=T(!1),s=T({}),i=T({}),c=()=>{l.value=!0,ue.get("email-notification/get-settings").then(m=>{var _,g,y,v,w,k,b;t.value={from_name:(_=m.data)==null?void 0:_.from_name,from_email:(g=m.data)==null?void 0:g.from_email,reply_to_name:(y=m.data)==null?void 0:y.reply_to_name,reply_to_email:(v=m.data)==null?void 0:v.reply_to_email,email_footer:(w=m.data)==null?void 0:w.email_footer,admin_email:(k=m.data)==null?void 0:k.admin_email,show_email_footer:((b=m.data)==null?void 0:b.show_email_footer)||"yes"},i.value=m.shortcodes}).catch(m=>{}).finally(()=>{l.value=!1})},p=()=>{l.value=!0,s.value={},ue.post("email-notification/save-settings",t.value).then(m=>{Y.success(m.message)}).catch(m=>{m.status_code===422&&m.data?s.value=m.data:m.message?Y.error(m.message):(Y.error(u("Something went wrong")),s.value=m)}).finally(()=>{l.value=!1})};return Ie(()=>{c()}),(m,_)=>{const g=C("el-input"),y=C("el-form-item"),v=C("el-col"),w=C("el-row"),k=C("el-tooltip"),b=C("el-checkbox"),x=C("el-button");return r(),h("div",hue,[n(Qa,{heading:A(u)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",_ue,[n(Da),n(xe,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(mue,{key:0})):(r(),E(Ce,{key:1},{default:d(()=>[n(w,{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]=F=>t.value.from_name=F)},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",vue,[o("p",null,f(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]=F=>t.value.from_email=F)},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":s.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),o("div",gue,[o("p",null,f(A(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This
276 email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(w,{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]=F=>t.value.reply_to_name=F)},null,8,["modelValue"]),o("div",yue,[o("p",null,f(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]=F=>t.value.reply_to_email=F)},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",bue,[o("p",null,f(A(u)(`If someone replies to your notification email, this is where you would like to
277 receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(w,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[o("div",wue,f(A(u)("Email Footer")),1),n(Wl,{"short-codes":i.value,modelValue:t.value.email_footer,"onUpdate:modelValue":_[4]||(_[4]=F=>t.value.email_footer=F),onUpdate:_[5]||(_[5]=F=>{t.value.email_footer=F})},null,8,["short-codes","modelValue"]),o("div",Cue,[n(fl,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",kue,[o("p",null,f(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
278 compliance.`)),1)])]),o("div",Bue,[n(b,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":_[6]||(_[6]=F=>t.value.show_email_footer=F),"true-value":"yes","false-value":"no",disabled:!A(a)},{default:d(()=>[L(f(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(()=>[L(f(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(w,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[n(y,null,{default:d(()=>[n(w,{gutter:15,class:"w-full"},{default:d(()=>[n(v,{lg:12},{default:d(()=>[o("div",xue,[o("span",Sue,f(A(u)("Admin Email Address")),1),o("div",Fue,[o("p",null,f(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(v,{lg:12},{default:d(()=>[o("div",$ue,[n(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":_[7]||(_[7]=F=>t.value.admin_email=F)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),o("div",Eue,[n(x,{type:"primary",onClick:_[8]||(_[8]=F=>p()),loading:l.value},{default:d(()=>[L(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},Iue={class:"setting-wrap"},Que={class:"setting-wrap-inner"},Due={class:"form-note"},Vue={class:"form-note"},Tue={class:"form-note",style:{"padding-top":"6px"}},Mue={class:"form-note"},Lue={class:"setting-save-action"},uc="{{wp.admin_email}}",Rue={__name:"StoreDigestSettings",setup(e){const t=T({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=T(!1),l=T({}),s=T(""),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.",uc),p=K(()=>{const v=[];for(let w=0;w<24;w++)v.push({value:w,label:String(w).padStart(2,"0")+":00"});return v}),m=[{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=>{Y.success(v.message)}).catch(v=>{v.status_code===422&&v.data?l.value=v.data:v.message?Y.error(v.message):Y.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(w=>{Y.success(w.message)}).catch(w=>{Y.error(w.message||u("Could not send the test email."))}).finally(()=>{s.value=""})};return Ie(()=>{_()}),(v,w)=>{const k=C("el-input"),b=C("el-form-item"),x=C("el-col"),F=C("el-checkbox"),M=C("el-row"),$=C("el-switch"),S=C("el-option"),I=C("el-select"),Q=C("el-button");return r(),h("div",Iue,[n(Qa,{heading:A(u)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",Que,[n(Da),n(xe,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(M,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(b,{label:A(u)("Recipient email addresses"),"label-position":"top"},{default:d(()=>[n(k,{modelValue:t.value.recipients,"onUpdate:modelValue":w[0]||(w[0]=D=>t.value.recipients=D),placeholder:uc},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",Due,[o("p",null,f(A(c)),1)])])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:d(()=>[n(b,{label:A(u)("Empty periods"),"label-position":"top"},{default:d(()=>[n(F,{modelValue:t.value.send_when_empty,"onUpdate:modelValue":w[1]||(w[1]=D=>t.value.send_when_empty=D),"true-value":"yes","false-value":"no"},{default:d(()=>[L(f(A(u)("Send even when there was no activity")),1)]),_:1},8,["modelValue"]),o("div",Vue,[o("p",null,f(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,D=>n(xe,{key:D.key,class:"fct-mt-4"},{default:d(()=>[n(Qe,{title:D.label,text:D.desc,border_bottom:""},null,8,["title","text"]),n(Ce,null,{default:d(()=>[n(M,{gutter:15,align:"middle"},{default:d(()=>[n(x,{lg:6},{default:d(()=>[n(b,{label:A(u)("Enable"),"label-position":"top"},{default:d(()=>[n($,{modelValue:t.value[D.key].enabled,"onUpdate:modelValue":V=>t.value[D.key].enabled=V,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),n(x,{lg:6},{default:d(()=>[n(b,{label:A(u)("Send time"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:t.value[D.key].send_hour,"onUpdate:modelValue":V=>t.value[D.key].send_hour=V,class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(p.value,V=>(r(),E(S,{key:V.value,label:V.label,value:V.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),D.key==="weekly"?(r(),E(x,{key:0,lg:6},{default:d(()=>[n(b,{label:A(u)("Day of week"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":w[2]||(w[2]=V=>t.value.weekly.send_dow=V),class:"w-full"},{default:d(()=>[(r(),h(H,null,ae(m,V=>n(S,{key:V.value,label:V.label,value:V.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):B("",!0),D.key==="monthly"?(r(),E(x,{key:1,lg:6},{default:d(()=>[n(b,{label:A(u)("Send day"),"label-position":"top"},{default:d(()=>[o("div",Tue,[o("p",null,f(A(u)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):B("",!0),n(x,{lg:6},{default:d(()=>[n(b,{label:" ","label-position":"top"},{default:d(()=>[n(Q,{loading:s.value===D.key,onClick:V=>y(D.key),class:"mt-2"},{default:d(()=>[L(f(A(u)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),o("div",Mue,[o("p",null,f(A(u)("Send time is in your store timezone. Test emails use your saved recipients.")),1)])]),_:2},1024)]),_:2},1024)),64)),o("div",Lue,[n(Q,{type:"primary",onClick:w[3]||(w[3]=D=>g()),loading:a.value},{default:d(()=>[L(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},Oue={};function Hue(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const Pue=st(Oue,[["render",Hue]]),Nue={},Kue={class:"fct-setting-form-row"},Gue={class:"w-[300px]"},jue={class:"flex-grow flex-shrink flex-basis-0 self-center"},zue={class:"fct-setting-form-row"},que={class:"w-[300px]"},Yue={class:"flex-grow flex-shrink flex-basis-0 self-center"},Wue={class:"fct-setting-form-row"},Xue={class:"w-[300px]"},Jue={class:"flex-grow flex-shrink flex-basis-0 self-center"};function Zue(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",null,[o("div",Kue,[o("div",Gue,[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",jue,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",zue,[o("div",que,[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",Yue,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",Wue,[o("div",Xue,[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",Jue,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const ece=st(Nue,[["render",Zue]]),tce={name:"TaxConfigurations",components:{TaxConfigurationsLoader:ece,CardContainer:xe,CardBody:Ce,CardHeader:Qe,LabelHint:pa,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,je.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=ps(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.saveSettings()})},unbindSaveShortcut(){var e;(e=this.keyboardShortcuts)!=null&&e.unbind&&this.keyboardShortcuts.unbind("mod+s")}}},ace={class:"setting-wrap"},lce={class:"setting-wrap-inner"},sce={class:"fct-setting-form-row"},nce={class:"fct-setting-form-content flex gap-3.5 flex-1"},oce={class:"fct-inline-tip"},ice={key:1},rce={class:"fct-setting-form-row"},dce={class:"fct-setting-form-content"},uce={class:"fct-inline-tip"},cce={class:"fct-setting-form-fields self-center"},Ace={class:"fct-inline-tip mt-2"},pce={class:"fct-setting-form-row"},fce={class:"fct-setting-form-content"},mce={class:"fct-inline-tip"},hce={class:"fct-setting-form-fields self-center"},_ce={class:"flex flex-col"},vce={class:"price-mode-label"},gce={class:"price-mode-text"},yce={class:"flex flex-col"},bce={class:"price-mode-label"},wce={class:"price-mode-text"},Cce={class:"fct-setting-form-row"},kce={class:"fct-setting-form-content"},Bce={class:"fct-inline-tip"},xce={class:"fct-setting-form-fields self-center"},Sce={class:"fct-setting-form-row"},Fce={class:"fct-setting-form-content"},$ce={class:"fct-inline-tip"},Ece={class:"fct-setting-form-fields self-center"},Uce={class:"fct-setting-form-row"},Ice={class:"fct-setting-form-content"},Qce={class:"fct-inline-tip"},Dce={class:"fct-setting-form-fields self-center"},Vce={class:"fct-setting-form-row"},Tce={class:"fct-setting-form-content"},Mce={class:"fct-inline-tip"},Lce={class:"fct-setting-form-fields self-center"},Rce={key:0,class:"fct-setting-form-row"},Oce={class:"fct-setting-form-content"},Hce={class:"fct-inline-tip"},Pce={class:"fct-setting-form-fields self-center"},Nce={class:"fct-setting-form-row"},Kce={class:"fct-setting-form-content"},Gce={class:"fct-inline-tip"},jce={class:"fct-setting-form-fields"},zce={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},qce={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},Yce={class:"fct-inline-tip"},Wce={class:"fct-vat-excluded-categories"},Xce={class:"fct-inline-tip"};function Jce(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-switch"),_=C("LabelHint"),g=C("TaxConfigurationsLoader"),y=C("el-radio"),v=C("el-radio-group"),w=C("el-option"),k=C("el-select"),b=C("el-input"),x=C("Animation"),F=C("CardBody"),M=C("CardContainer"),$=Ma("loading");return r(),h("div",ace,[n(c,{heading:i.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",lce,[n(p),n(M,null,{default:d(()=>[n(F,null,{default:d(()=>[o("div",sce,[o("div",nce,[n(m,{modelValue:s.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=S=>s.settings.enable_tax=S),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Enable Tax")},null,8,["title"]),o("p",oce,f(s.settings.enable_tax==="yes"?i.translate("This store is now collecting tax."):i.translate("This store is not collecting tax.")),1)])])]),n(x,{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",ice,[o("div",rce,[o("div",dce,[n(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",uce,f(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",cce,[n(v,{modelValue:s.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=S=>s.settings.tax_inclusion=S)},{default:d(()=>[n(y,{value:"included"},{default:d(()=>[L(f(i.translate("Included")),1)]),_:1}),n(y,{value:"excluded"},{default:d(()=>[L(f(i.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),o("p",Ace,f(i.translate("Shipping tax always follows the store-level tax mode (Included or Excluded). Product-specific tax settings do not apply to shipping.")),1)])]),o("div",pce,[o("div",fce,[n(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",mce,f(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",hce,[n(v,{modelValue:s.settings.eu_vat_settings.reverse_charge_price_mode,"onUpdate:modelValue":t[2]||(t[2]=S=>s.settings.eu_vat_settings.reverse_charge_price_mode=S),class:"fct-reverse-charge-price-mode"},{default:d(()=>[n(y,{value:"fixed"},{default:d(()=>[o("div",_ce,[o("span",vce,f(i.translate("Fixed")),1),o("span",gce,f(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",yce,[o("span",bce,f(i.translate("Dynamic")),1),o("span",wce,f(i.translate("VAT is stripped from the price on reverse charge. Customer pays the net (ex-VAT) amount.")),1)])]),_:1})]),_:1},8,["modelValue"])])]),o("div",Cce,[o("div",kce,[n(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",Bce,f(i.translate("Determine the location used for tax calculations.")),1)]),o("div",xce,[n(k,{modelValue:s.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=S=>s.settings.tax_calculation_basis=S),clearable:""},{default:d(()=>[n(w,{value:"shipping",label:i.translate("Customer Shipping Address")},null,8,["label"]),n(w,{value:"billing",label:i.translate("Customer Billing Address")},null,8,["label"]),n(w,{value:"store",label:i.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),o("div",Sce,[o("div",Fce,[n(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",$ce,f(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",Ece,[n(b,{modelValue:s.settings.price_suffix_included,"onUpdate:modelValue":t[4]||(t[4]=S=>s.settings.price_suffix_included=S),placeholder:i.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),o("div",Uce,[o("div",Ice,[n(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",Qce,f(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",Dce,[n(b,{modelValue:s.settings.price_suffix_excluded,"onUpdate:modelValue":t[5]||(t[5]=S=>s.settings.price_suffix_excluded=S),placeholder:i.translate("e.g. (+ tax)")},null,8,["modelValue","placeholder"])])]),o("div",Vce,[o("div",Tce,[n(_,{title:i.translate("Tax Display Style")},null,8,["title"]),o("p",Mce,f(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",Lce,[n(k,{modelValue:s.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=S=>s.settings.checkout_tax_breakdown_display=S)},{default:d(()=>[n(w,{value:"simplified",label:i.translate("Simplified (single line + details)")},null,8,["label"]),n(w,{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",Rce,[o("div",Oce,[n(_,{title:i.translate("Tax Line Label")},null,8,["title"]),o("p",Hce,f(i.translate("The single-line tax label shown in Simplified mode, e.g. VAT, MwSt, GST.")),1)]),o("div",Pce,[n(b,{modelValue:s.settings.tax_display_label,"onUpdate:modelValue":t[7]||(t[7]=S=>s.settings.tax_display_label=S),placeholder:i.translate("e.g. Tax")},null,8,["modelValue","placeholder"])])])):B("",!0),o("div",Nce,[o("div",Kce,[n(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",Gce,f(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",jce,[o("div",zce,[o("div",qce,[n(m,{modelValue:s.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[8]||(t[8]=S=>s.settings.eu_vat_settings.local_reverse_charge=S),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Local Reverse Charge")},null,8,["title"]),o("p",Yce,f(i.translate("If enabled, apply reverse charge when applicable even when customers are in your home country.")),1)])]),n(x,{visible:i.handlePriceMode,accordion:""},{default:d(()=>[o("div",Wce,[n(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",Xce,f(i.translate("Select product categories that should NOT get VAT reverse charge !")),1),Gt((r(),E(k,{modelValue:s.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[9]||(t[9]=S=>s.settings.eu_vat_settings.vat_reverse_excluded_categories=S),filterable:"",multiple:"",clearable:"",placeholder:i.translate("Select Product Categories"),class:"w-full mt-4"},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,S=>(r(),E(w,{key:S.value||S.term_id,label:S.label||S.name,value:S.value||S.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[$,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const Zce=st(tce,[["render",Jce]]),eAe={class:"fct-tax-rates-wrap-loader px-5"},tAe={__name:"TaxRatesLoader",setup(e){const t=T(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",eAe,[(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:ra({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))])}}},aAe={class:"setting-wrap"},lAe={class:"setting-wrap-inner"},sAe={class:"fct-all-tax-classes-page"},nAe={class:"flex items-center justify-end gap-4"},oAe={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},iAe={class:"inline-flex items-center gap-2"},rAe={class:"inline-flex items-center gap-2"},dAe=["src","alt"],uAe={key:0,class:"text-gray-400 dark:text-gray-300"},cAe={key:1,class:"text-success-500"},AAe={key:2,class:"text-system-mid dark:text-gray-300"},pAe={key:3,class:"text-gray-400 dark:text-gray-300"},fAe={key:1,class:"text-gray-400"},mAe={__name:"TaxRates",setup(e){const t=T({}),a=T([]),l=T({}),s=T({}),i=K(()=>!!je.get("is_tax_enabled")),c=T(!1),p=T({}),m={};let _=0;const g=T(""),y=T(!1),v={XI:"gb"},w=V=>(v[V]||V).toLowerCase(),k=K(()=>{const V=new Set;for(const U of a.value)for(const O of U.countries||[])V.add(O.country_code);return V}),b=V=>!V||!Object.prototype.hasOwnProperty.call(s.value,V)?!0:s.value[V],x=V=>!V||!V.vat?!1:V.rates&&typeof V.rates=="object"&&Object.keys(V.rates).length?Object.values(V.rates).some(U=>U&&parseFloat(U.rate)>0):parseFloat(V.rate)>0,F=K(()=>{const V=l.value||{},U=Array.isArray(V.country_registrations)?V.country_registrations:[],O=V.method||"",R=U.some(x);if(O==="oss")return!!V.oss_country;if(O==="home"){const P=V.home_country||"",j=U.find(q=>q.country===P);if(P&&j&&x(j))return!0}return O==="specific"?!!V.home_country:R}),M=K(()=>{const V=l.value||{},U=Array.isArray(V.country_registrations)?V.country_registrations:[],O=V.method||"";return O==="oss"?!!V.oss_country:O==="home"?!!V.home_country&&U.some(R=>R.country===V.home_country):O==="specific"?!!V.home_country:U.some(x)}),$=K(()=>{const V=[],U=Object.values(t.value||{});for(const P of U)if(P.group_code==="EU")V.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:M.value,enabled:b("EU"),collecting:M.value&&F.value&&b("EU")});else for(const j of P.countries||[]){const q=k.value.has(j.country_code),z=b(j.country_code);V.push({country_code:j.country_code,country_name:j.country_name,isEU:!1,group_code:P.group_code,hasConfig:q,enabled:z,collecting:q&&z})}const O=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],R=new Set(O);return V.sort((P,j)=>{if(P.hasConfig!==j.hasConfig)return P.hasConfig?-1:1;const q=R.has(P.country_code),z=R.has(j.country_code);return q&&z?O.indexOf(P.country_code)-O.indexOf(j.country_code):q?-1:z?1:P.country_name.localeCompare(j.country_name)}),V}),S=K(()=>{const V=g.value.trim().toLowerCase();return $.value.filter(U=>y.value&&(!i.value||!U.collecting)?!1:V?U.country_name.toLowerCase().includes(V)||U.country_code.toLowerCase().includes(V):!0)}),I=K(()=>{if(!i.value)return!1;const V=$.value.filter(O=>O.enabled).length,U=$.value.filter(O=>!O.enabled).length;return V>0&&U>0}),Q=()=>{c.value=!0,Promise.all([ue.get("tax/configuration/rates"),ue.get("tax/rates"),ue.get("tax/configuration/settings")]).then(([V,U,O])=>{var R;t.value=V.tax_rates,a.value=U.tax_rates,s.value=U.country_enabled_map||{},l.value=((R=O.settings)==null?void 0:R.eu_vat_settings)||{}}).catch(V=>{}).finally(()=>{c.value=!1})},D=(V,U)=>{const O=b(V.country_code),R=++_;m[V.country_code]=R,s.value={...s.value,[V.country_code]:U},p.value={...p.value,[V.country_code]:!0},ue.post("tax/country-status/"+V.country_code,{enabled:U?1:0}).then(P=>{m[V.country_code]===R&&(Y.success(P.message),s.value={...s.value,[V.country_code]:P.enabled})}).catch(P=>{var j;m[V.country_code]===R&&(s.value={...s.value,[V.country_code]:O},Y.error(((j=P==null?void 0:P.data)==null?void 0:j.message)||u("Failed to update tax status")))}).finally(()=>{if(m[V.country_code]===R){const P={...p.value};delete P[V.country_code],p.value=P}})};return Ie(()=>{Q()}),(V,U)=>{const O=C("el-checkbox"),R=C("el-input"),P=C("el-table-column"),j=C("el-switch"),q=C("el-table");return r(),h("div",aAe,[n(Qa,{heading:A(u)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",lAe,[n(Da),o("div",sAe,[n(xe,{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",nAe,[I.value?(r(),E(O,{key:0,modelValue:y.value,"onUpdate:modelValue":U[0]||(U[0]=z=>y.value=z)},{default:d(()=>[L(f(A(u)("Collecting Tax")),1)]),_:1},8,["modelValue"])):B("",!0),n(R,{modelValue:g.value,"onUpdate:modelValue":U[1]||(U[1]=z=>g.value=z),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",oAe,[n(Ja,{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(tAe,{key:1})):(r(),E(q,{key:2,data:S.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:z})=>[z.isEU?(r(),E(ka,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:d(()=>[o("div",iAe,[U[2]||(U[2]=o("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),L(" "+f(z.country_name),1)])]),_:2},1024)):(r(),E(ka,{key:1,to:{name:"tax-rates-country-single",params:{country:z.country_code,group:z.group_code}},class:"fct-tax-region-link hover:no-underline"},{default:d(()=>[o("div",rAe,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${w(z.country_code)}.png`,alt:z.country_code},null,8,dAe),L(" "+f(z.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),n(P,{label:A(u)("Collecting"),width:"200"},{default:d(({row:z})=>[i.value?z.collecting?(r(),h("span",cAe,f(A(u)("Collecting tax")),1)):z.hasConfig&&!z.enabled?(r(),h("span",AAe,f(A(u)("Disabled")),1)):(r(),h("span",pAe,"—")):(r(),h("span",uAe,"—"))]),_:1},8,["label"]),n(P,{label:A(u)("Enabled"),width:"140",align:"center"},{default:d(({row:z})=>[z.hasConfig?(r(),E(j,{key:0,"model-value":i.value?z.enabled:!1,loading:!!p.value[z.country_code],disabled:!i.value,onChange:X=>D(z,X)},null,8,["model-value","loading","disabled","onChange"])):(r(),h("span",fAe,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},hAe={class:"fct-base-taxes"},_Ae={class:"fct-tax-class-tabs"},vAe={class:"fct-tax-class-tabs__list"},gAe={class:"fct-base-taxes__header"},yAe={class:"fct-base-taxes__header-label"},bAe={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},wAe={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},CAe={class:"fct-base-taxes__state-fields"},kAe={class:"fct-base-taxes__region-name"},BAe={class:"fct-base-taxes__state-fields"},xAe={__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",hAe,[o("div",_Ae,[o("div",vAe,[(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",gAe,[o("span",yAe,f(A(u)("Regions")),1)]),o("div",bAe,[o("div",wAe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",CAe,[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",kAe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",BAe,[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))])])}}},SAe={class:"fct-tax-class-tabs"},FAe={class:"fct-tax-class-tabs__list"},$Ae=["onClick"],EAe=["title","onClick"],UAe=["disabled","title"],IAe=["disabled","title"],QAe=["disabled"],DAe=["disabled","title"],VAe={class:"fct-tax-class-tabs__search"},Kp={__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=T(!1),i=T(""),c=T(null),p=T(!1),m=K(()=>[...a.classes].sort((b,x)=>b.slug==="standard"&&x.slug!=="standard"?-1:b.slug!=="standard"&&x.slug==="standard"?1:0)),_=K(()=>["reduced","zero"].filter(b=>!a.classes.find(x=>x.slug===b))),g=()=>{i.value="",p.value=!1,s.value=!0,Be(()=>{var b;return(b=c.value)==null?void 0:b.focus()})},y=b=>{if(b==="custom"){g();return}l("add",b)},v=()=>{const b=i.value.trim();if(!b){w();return}l("create-custom",b)},w=()=>{s.value=!1,i.value="",p.value=!1},k=()=>{!a.creating&&!i.value.trim()&&w()};return be([()=>a.classes.length,()=>a.creating],([b,x],[F,M])=>{if(s.value){if(b>F){w();return}M&&!x&&(p.value=!0)}}),be(i,()=>{p.value=!1}),(b,x)=>{const F=C("el-input"),M=C("el-dropdown-item"),$=C("el-dropdown-menu"),S=C("el-dropdown");return r(),h("div",SAe,[o("div",FAe,[(r(!0),h(H,null,ae(m.value,I=>(r(),h("button",{key:I.id,class:re(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==I.id}]),onClick:Q=>l("switch",I)},[L(f(I.title)+" ",1),I.slug!=="standard"?(r(),h("span",{key:0,class:"fct-tax-class-tabs__delete",title:A(u)("Delete tax class"),onClick:Ne(Q=>l("delete",I),["stop"])},[n(J,{name:"Close"})],8,EAe)):B("",!0)],10,$Ae))),128)),e.classes.length<e.maxClasses?(r(),h(H,{key:0},[s.value?(r(),h("div",{key:0,class:re(["fct-tax-class-tabs__inline-create",{"fct-tax-class-tabs__inline-create--error":p.value}])},[n(F,{ref_key:"inlineInput",ref:c,modelValue:i.value,"onUpdate:modelValue":x[0]||(x[0]=I=>i.value=I),size:"small",maxlength:"30",disabled:e.creating,placeholder:A(u)("e.g. Luxury"),onKeyup:[xa(v,["enter"]),xa(w,["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:x[1]||(x[1]=Ne(()=>{},["prevent"])),onClick:v},[n(J,{name:"Check"})],40,UAe),o("button",{class:"fct-tax-class-tabs__inline-cancel",disabled:e.creating,title:A(u)("Cancel"),onMousedown:x[2]||(x[2]=Ne(()=>{},["prevent"])),onClick:w},[n(J,{name:"Close"})],40,IAe)],2)):_.value.length?(r(),E(S,{key:1,trigger:"click",disabled:e.creating,onCommand:y,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n($,null,{default:d(()=>[_.value.includes("reduced")?(r(),E(M,{key:0,command:"reduced"},{default:d(()=>[L(f(A(u)("Reduced")),1)]),_:1})):B("",!0),_.value.includes("zero")?(r(),E(M,{key:1,command:"zero"},{default:d(()=>[L(f(A(u)("Zero")),1)]),_:1})):B("",!0),n(M,{command:"custom"},{default:d(()=>[L(f(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,QAe)]),_: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,DAe))],64)):B("",!0)]),o("div",VAe,[n(F,{"model-value":e.search,placeholder:A(u)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":x[3]||(x[3]=I=>l("update:search",I)),onClear:x[4]||(x[4]=I=>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(b.$slots,"search-actions")])])}}},TAe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,Fd=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||TAe(e),MAe=({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},Po=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:MAe({classes:c,previousIds:s,createdSlug:t})}},Gp=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:Fd({classes:s,activeId:t})}};function Ws(e){return e==null||e===""?"":String(e)}const LAe={class:"setting-wrap"},RAe={class:"setting-wrap-inner"},OAe={class:"fct-single-tax-rates-country-single-page"},HAe={class:"fct-single-tax-rates-country-single"},PAe={class:"single-page-header flex items-center justify-between"},NAe={key:0,class:"flex items-center gap-2"},KAe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},GAe={class:"mt-3 flex justify-end"},jAe={key:1,class:"fct-base-taxes"},zAe={class:"fct-btn-group mt-4 justify-end sm"},qAe={class:"fct-tax-rates-country-view"},YAe={key:0},WAe={key:1},XAe={key:0},JAe={key:1},ZAe={class:"fct-btn-group sm justify-end"},cc={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=T(!1),l=T([]),s=T(""),i=K(()=>!!je.get("is_tax_enabled")),c=T([]),p=T(null),m=T("standard"),_=T(!1),g=T(null),y=T(6),v=T({id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0}),w=T({rate:0,name:""}),k=T([]),b=T({}),x=T(""),F=K(()=>{const ee=x.value.trim().toLowerCase();return ee?k.value.filter(we=>we.stateName&&we.stateName.toLowerCase().includes(ee)):k.value}),M=K(()=>t.group==="EU"),$=K(()=>[v.value,...F.value]),S=T([]),I=T(!1),Q=T([]),D=T([]),V=T(!1),U=T(new Set),O=T(0),R=T([]),P=T(!1),j=T(!1),q=T(!1),z=T({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:""}),X=K(()=>{const ee=v.value.rate||0;return[{label:u("added to")+` ${ee}% `+u("federal tax"),is_compound:"0",for_order:0},{label:u("instead of")+` ${ee}% `+u("federal tax"),is_compound:"0",for_order:1},{label:u("compounded on top of")+` ${ee}% `+u("federal tax"),is_compound:"1",for_order:0}]}),ne=ee=>String(ee.is_compound)==="1"?"1_0":ee.for_order==1?"0_1":"0_0",he=(ee,we)=>{const[le,Ae]=we.split("_");ee.is_compound=le,ee.for_order=parseInt(Ae)},N=ee=>ee&&ee.replace(/\s*\(Standard\)\s*/gi,"").trim(),G=T(!1),Z=T({}),W=T(!1),ie=T(""),ye=T(""),fe=T(""),ge=T(!1),se=T(!1),pe=T(!0),$e=T(!1),tt=T(!1),_e=T(!1),Xe=K(()=>u("Toggle tax collection for %1$s",s.value||t.country)),ht=()=>ue.get("tax/classes").then(ee=>{c.value=ee.classes||[],y.value=ee.max_classes||6,g.value=ee.next_builtin||null;const we=Fd({classes:c.value,activeId:p.value});return we&&(p.value=we.id,m.value=we.slug),c.value}).catch(ee=>c.value),Ye=(ee="")=>{if(!ee)return v.value.name||"Tax";const we=k.value.find(le=>le.state===ee);return we!=null&&we.name?we.name:v.value.name||"Tax"},Se=ee=>{v.value={...ee.federalRate},w.value={...ee.federalOriginal},k.value=ee.stateRows.map(we=>({...we})),b.value={...ee.stateOriginals}},Ee=()=>({federalRate:{...v.value},federalOriginal:{...w.value},stateRows:k.value.map(ee=>({...ee})),stateOriginals:{...b.value}}),Oe=()=>{p.value&&(Z.value[p.value]=Ee())},Me=async ee=>{Oe(),p.value=ee.id,m.value=ee.slug,Z.value[ee.id]?(Se(Z.value[ee.id]),await kt()):await sa()},_t=ee=>{_.value=!0,Po({payload:{slug:ee},createdSlug:ee,currentClasses:c.value,reloadClasses:ht}).then(({response:we,createdClass:le})=>{if(Y.success(we.message),le)return Me(le)}).catch(we=>{var le;Y.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},vt=ee=>{_.value=!0,Po({payload:{title:ee},currentClasses:c.value,reloadClasses:ht}).then(({response:we,createdClass:le})=>{if(Y.success(we.message),le)return Me(le)}).catch(we=>{var le;Y.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},Lt=ee=>{const we=p.value===ee.id;rl(u("All rates for this class will be deleted. Products using it will default to Standard."),u("Delete")+" "+ee.title+"?",{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Gp({classId:ee.id,currentActiveId:p.value,reloadClasses:ht}).then(({response:le,nextActiveClass:Ae})=>{if(delete Z.value[ee.id],Y.success(le.message),Ae)return we&&(p.value=null),Me(Ae)}).catch(le=>{var Ae;Y.error(((Ae=le==null?void 0:le.data)==null?void 0:Ae.message)||"Failed to delete tax class")})}).catch(()=>{})},Et=()=>ue.get("address-info/get-country-info",{country_code:t.country}).then(ee=>{l.value=ee.states||[],s.value=ee.country_name||t.country}).catch(ee=>{Y.error(u("Failed to load country data. Please refresh the page."))}),Dt=()=>M.value?(ye.value="",fe.value="",Promise.resolve()):(ge.value=!0,ue.get("tax/country-tax-id/"+t.country).then(ee=>{var le;const we=((le=ee==null?void 0:ee.tax_data)==null?void 0:le.tax_id)||"";ye.value=we,fe.value=we}).catch(ee=>{var we;Y.error(((we=ee==null?void 0:ee.data)==null?void 0:we.message)||u("Failed to load tax ID"))}).finally(()=>{ge.value=!1})),dt=({hydrateClassData:ee=!0}={})=>ue.get("tax/rates/country/rates/"+t.country).then(we=>{const le=we.tax_rates||[],Ae=le.filter(Ke=>Ke.for_shipping!==null),Ge=p.value?le.filter(Ke=>Number(Ke.class_id)===Number(p.value)):le;Q.value=Ge.filter(Ke=>!Ke.city&&!Ke.postcode).map(Ke=>({name:Ke.name,value:Ke.id,state:Ke.state||""}));const lt=Wt(Ge);return _e.value=le.length>0,ee&&(Se(lt),Oe(),pe.value=!!we.tax_enabled,tt.value=!0),{allRates:le,shippingOverrides:Ae,classEntry:lt}}).catch(we=>(Y.error(u("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),Ut=()=>ue.get("tax/product-overrides/"+t.country).then(ee=>ee.overrides||[]).catch(()=>[]),Ft=()=>{R.value.length>0||(P.value=!0,ue.get("products/fetch-term").then(ee=>{const we=ee.taxonomies&&ee.taxonomies["product-categories"]?ee.taxonomies["product-categories"].terms||[]:[];R.value=we.map(le=>({...le,value:Ws(le.value)}))}).catch(()=>{}).finally(()=>{P.value=!1}))};let It=0;const Qt=ee=>{const we=++It;return!ee||Number(ee)===Number(p.value)?(D.value=Q.value.slice(),V.value=!1,Promise.resolve()):(V.value=!0,D.value=[],ue.get("tax/rates/country/rates/"+t.country,{class_id:ee}).then(le=>{if(we!==It)return;const Ae=le.tax_rates||[];D.value=Ae.filter(Ge=>!Ge.city&&!Ge.postcode).map(Ge=>({name:Ge.name,value:Ge.id,state:Ge.state||""}))}).catch(()=>{we===It&&(D.value=[],Y.error(u("Failed to load tax rates for the selected tax class")))}).finally(()=>{we===It&&(V.value=!1)}))},Tt=(ee,we)=>{var Ae,Ge;const le=[];for(const lt of ee){const Ke=lt.state?((Ae=l.value.find(Je=>Je.value===lt.state))==null?void 0:Ae.name)||lt.state:s.value||t.country,qe=Ye(lt.state||""),mt=c.value.find(Je=>Number(Je.id)===Number(lt.class_id));le.push({id:lt.id,type:"shipping",label:qe,tax_label:qe,category_name:"",location:Ke,city:lt.city||"",postcode:lt.postcode||"",rate:lt.for_shipping,class_id:Number(lt.class_id)||0,class_label:mt?mt.title:"",_raw:lt})}for(const lt of we){const Ke=lt.meta_value||lt,qe=Ke.state||"",mt=qe?((Ge=l.value.find(Yt=>Yt.value===qe))==null?void 0:Ge.name)||qe:s.value||t.country,Je=Number(lt.class_id)||0,$t=Je?c.value.find(Yt=>Number(Yt.id)===Je):null;le.push({id:lt.id,type:"products",label:Ke.category_name||"",tax_label:Ke.tax_label||"",category_name:Ke.category_name||"",location:mt,city:Ke.city||"",postcode:Ke.postcode||"",rate:Ke.rate,class_id:Je,class_label:$t?$t.title:"",_raw:lt})}S.value=le},Wt=ee=>{const we=Je=>(!Je.state||Je.state==="")&&(!Je.city||Je.city==="")&&(!Je.postcode||Je.postcode===""),le=ee.find(we),Ae=ee.filter(Je=>Je.state&&Je.state!==""&&(!Je.city||Je.city==="")&&(!Je.postcode||Je.postcode===""));let Ge,lt;if(le){const Je=N(le.name)||"Tax";Ge={...le,name:Je},lt={rate:le.rate,name:Je}}else Ge={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},lt={rate:0,name:"Tax"};const Ke={};for(const Je of Ae)Ke[Je.state]=Je;const qe=[],mt={};for(const Je of l.value){const $t=Ke[Je.value];if($t){const Yt=N($t.name)||"State Tax";qe.push({id:$t.id,state:Je.value,stateName:Je.name,rate:$t.rate,name:Yt,is_compound:String($t.is_compound||"0"),for_order:$t.for_order||0}),mt[Je.value]={rate:$t.rate,name:Yt,is_compound:String($t.is_compound||"0"),for_order:$t.for_order||0}}else qe.push({id:null,state:Je.value,stateName:Je.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),mt[Je.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:Ge,federalOriginal:lt,stateRows:qe,stateOriginals:mt}},kt=async()=>{const[{shippingOverrides:ee},we]=await Promise.all([dt({hydrateClassData:!1}),Ut()]);Tt(ee,we)},sa=async()=>{a.value=!0;try{const[{shippingOverrides:ee},we]=await Promise.all([dt(),Ut()]);Tt(ee,we)}finally{a.value=!1}},ve=async()=>{a.value=!0;try{await Promise.all([ht(),Et(),Dt()]),await sa()}finally{a.value=!1}},Fe=()=>{M.value||se.value||ge.value||(se.value=!0,ue.post("tax/country-tax-id/"+t.country,{tax_id:ye.value||""}).then(ee=>{fe.value=ye.value||"",Y.success(ee.message||u("Tax ID has been saved successfully"))}).catch(ee=>{var we;Y.error(((we=ee==null?void 0:ee.data)==null?void 0:we.message)||u("Failed to save tax ID"))}).finally(()=>{se.value=!1}))},ot=ee=>{if($e.value)return;const we=pe.value;pe.value=ee,$e.value=!0,ue.post("tax/country-status/"+t.country,{enabled:ee?1:0}).then(le=>{pe.value=le.enabled,Y.success(le.message)}).catch(le=>{var Ae;pe.value=we,Y.error(((Ae=le==null?void 0:le.data)==null?void 0:Ae.message)||u("Failed to update tax status"))}).finally(()=>{$e.value=!1})},gt=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}W.value=!0;try{const we=(await ue.get("tax/configuration/rates")).tax_rates||{};let le=[];for(const qe in we){const mt=we[qe];for(const Je of mt.countries||[])if(Je.country_code===t.country){le=Je.rates||[];break}if(le.length)break}if(!le.length){Y.error(u("No preset rates found for this country"));return}const Ae=le.find(qe=>(!qe.state||qe.state==="")&&qe.type==="standard"),Ge=le.filter(qe=>qe.state&&qe.state!==""&&qe.type==="standard"),lt=[];Ae&&Ae.rate>0&&(v.value.rate=Ae.rate,v.value.name=N(Ae.name||"")||u("Tax"),lt.push(Ct()));const Ke=[];for(const qe of Ge){const mt=k.value.find(Je=>Je.state===qe.state);mt&&(mt.rate=qe.rate,mt.name=N(qe.name)||u("State Tax"),mt.is_compound=qe.compound?"1":"0",Ke.push(jt(mt)))}await Promise.all([...lt,...Ke]),Oe(),await kt(),Y.success(u("Tax rates have been reset to defaults"))}catch{Y.error(u("Failed to reset tax rates"))}finally{W.value=!1}},Ct=()=>{const ee={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,ee):ue.post("tax/country/rate",ee)).then(le=>{le.tax_rate&&(v.value.id=le.tax_rate.id),w.value={rate:v.value.rate,name:v.value.name}})},jt=ee=>{const we={country:t.country,state:ee.state,rate:ee.rate,name:ee.name,is_compound:ee.is_compound,for_order:ee.for_order,group:t.group,class_id:p.value||""};return(ee.id?ue.put("tax/country/rate/"+ee.id,we):ue.post("tax/country/rate",we)).then(Ae=>{Ae.tax_rate&&(ee.id=Ae.tax_rate.id),b.value[ee.state]={rate:ee.rate,name:ee.name,is_compound:String(ee.is_compound),for_order:ee.for_order}})},yt=async()=>{G.value=!0;try{const ee=[];(String(v.value.rate)!==String(w.value.rate)||v.value.name!==w.value.name)&&ee.push(Ct());for(const le of k.value){const Ae=b.value[le.state];(!Ae||String(le.rate)!==String(Ae.rate)||le.name!==Ae.name||String(le.is_compound)!==String(Ae.is_compound)||le.for_order!=Ae.for_order)&&ee.push(jt(le))}await Promise.all(ee),Oe(),await kt(),Y.success(u("Tax rates saved"))}catch{Y.error(u("Failed to save rates"))}finally{G.value=!1}},ca=()=>{U.value=new Set,O.value=0},ta=()=>{const ee=Ye();q.value=!1,z.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:ee,tax_rate:0,override_state_tax:!0,class_id:Number(p.value)||0,id:"",previous_id:""},ie.value=ee,D.value=Q.value.slice(),I.value=!0,Ft()},Ht=ee=>{if(q.value=!0,Ft(),ee.type==="shipping"){const we=ee._raw.state||"",le=Ye(we),Ae=Number(ee._raw.class_id)||Number(p.value)||0;z.value={type:"shipping",original_type:"shipping",original_id:ee.id,category_id:"",category_name:"",state:we||"__country__",city:ee._raw.city||"",postcode:ee._raw.postcode||"",tax_label:le,tax_rate:ee.rate,override_state_tax:!0,class_id:Ae,id:ee.id,previous_id:ee.id},ie.value=le,O.value=Ae,Qt(Ae);const Ge=ee._raw.city||"",lt=ee._raw.postcode||"",Ke=new Set;for(const qe of S.value)qe.type==="shipping"&&(qe._raw.state||"")===we&&(qe._raw.city||"")===Ge&&(qe._raw.postcode||"")===lt&&Ke.add(Number(qe.class_id));U.value=Ke}else{const we=ee._raw.meta_value||ee._raw,le=we.state||"",Ae=Ye(le),Ge=ee.tax_label||Ae;z.value={type:"products",original_type:"products",original_id:ee.id,category_id:Ws(we.category_id),category_name:ee.category_name,state:le||"__country__",tax_label:Ge,tax_rate:ee.rate,override_state_tax:we.override_state_tax==="yes",city:we.city||"",postcode:we.postcode||"",class_id:ee.class_id||0,id:ee.id,previous_id:""},ie.value=Ae}I.value=!0},na=K(()=>{const ee=[{label:s.value||t.country,value:"__country__"}];for(const we of l.value)ee.push({label:we.name,value:we.value});return ee}),Za=K(()=>{if(!D.value.length)return na.value;const ee=new Set(D.value.map(we=>we.state||""));return na.value.filter(we=>{const le=we.value==="__country__"?"":we.value;return ee.has(le)})}),Ql=ee=>{const we=Ws(ee),le=R.value.find(Ae=>Ae.value===we);le&&(z.value.category_name=le.label)},Ra=ee=>{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=ee.type==="shipping"?"tax/rates/country/override/"+ee.id:"tax/product-overrides/"+ee.id;ue.delete(we).then(le=>{Y.success(le.message),S.value=S.value.filter(Ae=>!(Ae.id===ee.id&&Ae.type===ee.type))}).catch(le=>{var Ae;Y.error(((Ae=le==null?void 0:le.data)==null?void 0:Ae.message)||u("Failed to delete override"))})}).catch(()=>{})},aa=async()=>{var we;const ee=z.value.state==="__country__"?"":z.value.state;if(z.value.type==="products"&&!z.value.category_id){Y.error(u("Please select a category"));return}if(z.value.type==="shipping"){if(!z.value.class_id){Y.error(u("Please select a tax class"));return}if(V.value){Y.error(u("Please wait for the province rates to finish loading"));return}const le=D.value.find(Ae=>(Ae.state||"")===ee);z.value.id=le?le.value:0}j.value=!0;try{let le;if(z.value.type==="products"){const Ae=z.value.state==="__country__"?"":z.value.state;le=await ue.post("tax/product-overrides",{id:q.value&&z.value.original_type==="products"?z.value.original_id:"",source_type:z.value.original_type,source_id:z.value.original_id,country:t.country,state:Ae,category_id:z.value.category_id,category_name:z.value.category_name,tax_label:z.value.tax_label,rate:z.value.tax_rate,override_state_tax:z.value.override_state_tax===!0?"yes":"no",city:z.value.city||"",postcode:z.value.postcode||"",class_id:z.value.class_id||0})}else le=await ue.post("tax/rates/country/override",{id:z.value.id,country:t.country,state:ee,previous_id:q.value&&z.value.original_type==="shipping"?z.value.previous_id:"",source_type:z.value.original_type,source_id:z.value.original_id,class_id:z.value.class_id||p.value||"",override_tax_rate:z.value.tax_rate,city:z.value.city||"",postcode:z.value.postcode||""});Y.success(le.message),I.value=!1,await kt()}catch(le){const Ae=((we=le==null?void 0:le.data)==null?void 0:we.message)||(le==null?void 0:le.message)||"Failed to save override";Y.error(Ae)}finally{j.value=!1}};return be(()=>z.value.type,ee=>{ee==="shipping"&&(z.value.class_id||(z.value.class_id=p.value||0),Qt(z.value.class_id))}),be(()=>z.value.class_id,ee=>{z.value.type!=="shipping"||!I.value||Qt(ee).then(()=>{const we=z.value.state==="__country__"?"":z.value.state,le=D.value.map(Ae=>Ae.state||"");we!==""&&!le.includes(we)&&(z.value.state="__country__")})}),be(()=>z.value.state,ee=>{if(!I.value||z.value.type!=="products"||q.value)return;const we=Ye(ee==="__country__"?"":ee);(!z.value.tax_label||z.value.tax_label===ie.value)&&(z.value.tax_label=we),ie.value=we}),Ie(()=>{ve()}),(ee,we)=>{const le=C("el-breadcrumb-item"),Ae=C("el-breadcrumb"),Ge=C("el-switch"),lt=C("el-skeleton"),Ke=C("el-input"),qe=C("el-form-item"),mt=C("el-form"),Je=C("el-button"),$t=C("el-table-column"),Yt=C("el-option"),ce=C("el-select"),me=C("el-table"),Le=C("el-tag"),De=C("el-radio"),te=C("el-radio-group"),He=C("el-checkbox"),ut=C("el-dialog");return r(),h("div",LAe,[o("div",RAe,[o("div",OAe,[o("div",HAe,[o("div",PAe,[n(Ae,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[e.group==="EU"?(r(),E(le,{key:0,to:{name:"eu"}},{default:d(()=>[L(f(A(u)("Tax Regions")),1)]),_:1})):(r(),E(le,{key:1,to:{name:"tax_rates"}},{default:d(()=>[L(f(A(u)("Tax Regions")),1)]),_:1})),n(le,null,{default:d(()=>[L(f(s.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),tt.value&&_e.value?(r(),h("div",NAe,[i.value?(r(),h("span",{key:0,class:re(["text-sm",pe.value?"text-success-500":"text-system-mid dark:text-gray-300"])},f(pe.value?A(u)("Collecting tax"):A(u)("Disabled")),3)):B("",!0),n(Ge,{"model-value":i.value?pe.value:!1,loading:$e.value,disabled:!i.value,"aria-label":Xe.value,onChange:ot},null,8,["model-value","loading","disabled","aria-label"])])):B("",!0)]),!a.value&&!i.value?(r(),h("div",KAe,[n(Ja,{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),M.value?B("",!0):(r(),E(xe,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[ge.value?(r(),E(lt,{key:0,animated:"",rows:2})):(r(),E(mt,{key:1,"label-position":"top"},{default:d(()=>[n(qe,{label:A(u)("VAT/GST/Tax Number"),class:"mb-0"},{default:d(()=>[n(Ke,{modelValue:ye.value,"onUpdate:modelValue":we[0]||(we[0]=ke=>ye.value=ke),placeholder:A(u)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",GAe,[n(Je,{type:"primary",size:"small",loading:se.value,disabled:ge.value||se.value||ye.value===fe.value,onClick:Fe},{default:d(()=>[L(f(A(u)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),n(xe,null,{default:d(()=>[n(Qe,{title:A(u)("Base taxes")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(Ja,{type:"info"},{content:d(()=>[o("span",null,f(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"))+" + "+f(A(u)("button to add tax classes.")),1)]),_:1}),a.value?(r(),E(xAe,{key:0})):(r(),h("div",jAe,[n(Kp,{classes:c.value,"active-id":p.value,"max-classes":y.value,creating:_.value,search:x.value,onSwitch:Me,onDelete:Lt,onAdd:_t,onCreateCustom:vt,"onUpdate:search":we[1]||(we[1]=ke=>x.value=ke)},null,8,["classes","active-id","max-classes","creating","search"]),n(me,{data:$.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:d(()=>[n($t,{label:A(u)("Region")},{default:d(({row:ke})=>[o("span",{class:re(["fct-base-taxes__region-name",ke.state?"":"fct-base-taxes__region-name--federal"])},f(ke.state?ke.stateName:s.value||e.country),3)]),_:1},8,["label"]),n($t,{label:A(u)("Rate"),width:"130"},{default:d(({row:ke})=>[n(Ke,{modelValue:ke.rate,"onUpdate:modelValue":wt=>ke.rate=wt,size:"small",type:"number",step:"0.01",min:"0"},{suffix:d(()=>we[18]||(we[18]=[L("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n($t,{label:A(u)("Tax Label"),width:"200"},{default:d(({row:ke})=>[n(Ke,{modelValue:ke.name,"onUpdate:modelValue":wt=>ke.name=wt,size:"small",placeholder:A(u)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),k.value.length>0?(r(),E($t,{key:0,label:A(u)("Compound"),width:"310"},{default:d(({row:ke})=>[ke.state?(r(),E(ce,{key:0,"model-value":ne(ke),size:"small",style:{width:"100%"},onChange:wt=>he(ke,wt)},{default:d(()=>[n(Yt,{value:"0_0",label:X.value[0].label},null,8,["label"]),n(Yt,{value:"0_1",label:X.value[1].label},null,8,["label"]),n(Yt,{value:"1_0",label:X.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]),o("div",zAe,[m.value==="standard"?(r(),E(Je,{key:0,loading:W.value,size:"small",onClick:gt,type:"danger",soft:""},{default:d(()=>[L(f(A(u)("Reset to default")),1)]),_:1},8,["loading"])):B("",!0),n(Je,{type:"primary",size:"small",loading:G.value,onClick:yt},{default:d(()=>[L(f(A(u)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),n(xe,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(Je,{size:"small",onClick:ta},{default:d(()=>[L(f(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[o("div",qAe,[n(me,{data:S.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n($t,{label:A(u)("Type"),width:"110"},{default:d(({row:ke})=>[n(Le,{type:ke.type==="products"?"primary":"info",size:"small"},{default:d(()=>[L(f(ke.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n($t,{label:A(u)("Category")},{default:d(({row:ke})=>[L(f(ke.category_name||"—"),1)]),_:1},8,["label"]),n($t,{label:A(u)("Tax Label")},{default:d(({row:ke})=>[L(f(ke.tax_label||"—"),1)]),_:1},8,["label"]),n($t,{label:A(u)("Location")},{default:d(({row:ke})=>[L(f(ke.location),1)]),_:1},8,["label"]),n($t,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:ke})=>[ke.type==="products"?(r(),h("span",YAe,f(ke.class_label||A(u)("All")),1)):(r(),h("span",WAe,f(ke.class_label||"—"),1))]),_:1},8,["label"]),n($t,{label:A(u)("City / Postcode")},{default:d(({row:ke})=>[ke.city||ke.postcode?(r(),h("span",XAe,f([ke.city,ke.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",JAe,"—"))]),_:1},8,["label"]),n($t,{label:A(u)("Rate"),width:"100"},{default:d(({row:ke})=>[L(f(ke.rate)+"% ",1)]),_:1},8,["label"]),n($t,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:ke})=>[o("div",ZAe,[n(Ze,{tag:"button",size:"small",onClick:wt=>Ht(ke)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ze,{tag:"button",size:"small",onClick:wt=>Ra(ke),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:I.value,"onUpdate:modelValue":we[17]||(we[17]=ke=>I.value=ke),title:(q.value?A(u)("Edit tax override for"):A(u)("Add tax override for"))+" "+(s.value||e.country),width:"520px","append-to-body":!0,onClose:ca},{footer:d(()=>[n(Je,{onClick:we[16]||(we[16]=ke=>I.value=!1)},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(Je,{type:"primary",loading:j.value,onClick:aa},{default:d(()=>[L(f(q.value?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(mt,{"label-position":"top",model:z.value},{default:d(()=>[n(qe,{label:A(u)("Override type")},{default:d(()=>[n(te,{modelValue:z.value.type,"onUpdate:modelValue":we[2]||(we[2]=ke=>z.value.type=ke)},{default:d(()=>[n(De,{value:"products"},{default:d(()=>[L(f(A(u)("Products")),1)]),_:1}),n(De,{value:"shipping"},{default:d(()=>[L(f(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),z.value.type==="products"?(r(),h(H,{key:0},[n(qe,{label:A(u)("Category")},{default:d(()=>[n(ce,{modelValue:z.value.category_id,"onUpdate:modelValue":we[3]||(we[3]=ke=>z.value.category_id=ke),filterable:"",placeholder:A(u)("Select a category"),loading:P.value,style:{width:"100%"},onChange:Ql},{default:d(()=>[(r(!0),h(H,null,ae(R.value,ke=>(r(),E(Yt,{key:ke.value,label:ke.label,value:ke.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax Class")},{default:d(()=>[n(ce,{modelValue:z.value.class_id,"onUpdate:modelValue":we[4]||(we[4]=ke=>z.value.class_id=ke),style:{width:"100%"}},{default:d(()=>[n(Yt,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(H,null,ae(c.value,ke=>(r(),E(Yt,{key:ke.id,value:Number(ke.id),label:ke.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax label")},{default:d(()=>[n(Ke,{modelValue:z.value.tax_label,"onUpdate:modelValue":we[5]||(we[5]=ke=>z.value.tax_label=ke),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Location")},{default:d(()=>[n(ce,{modelValue:z.value.state,"onUpdate:modelValue":we[6]||(we[6]=ke=>z.value.state=ke),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(na.value,ke=>(r(),E(Yt,{key:ke.value,label:ke.label,value:ke.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:z.value.city,"onUpdate:modelValue":we[7]||(we[7]=ke=>z.value.city=ke),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:z.value.postcode,"onUpdate:modelValue":we[8]||(we[8]=ke=>z.value.postcode=ke),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:z.value.tax_rate,"onUpdate:modelValue":we[9]||(we[9]=ke=>z.value.tax_rate=ke),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:z.value.override_state_tax,"onUpdate:modelValue":we[10]||(we[10]=ke=>z.value.override_state_tax=ke)},{default:d(()=>[L(f(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(ce,{modelValue:z.value.class_id,"onUpdate:modelValue":we[11]||(we[11]=ke=>z.value.class_id=ke),style:{width:"100%"},loading:V.value},{default:d(()=>[(r(!0),h(H,null,ae(c.value,ke=>(r(),E(Yt,{key:ke.id,value:Number(ke.id),label:ke.title,disabled:q.value&&Number(ke.id)!==Number(O.value)&&U.value.has(Number(ke.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),n(qe,{label:A(u)("Location")},{default:d(()=>[n(ce,{modelValue:z.value.state,"onUpdate:modelValue":we[12]||(we[12]=ke=>z.value.state=ke),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(Za.value,ke=>(r(),E(Yt,{key:ke.value,label:ke.label,value:ke.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:z.value.city,"onUpdate:modelValue":we[13]||(we[13]=ke=>z.value.city=ke),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:z.value.postcode,"onUpdate:modelValue":we[14]||(we[14]=ke=>z.value.postcode=ke),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:z.value.tax_rate,"onUpdate:modelValue":we[15]||(we[15]=ke=>z.value.tax_rate=ke),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])])])])}}};class epe extends Fs{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"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Tax Country"),value:"country"}]}getSearchHint(){return u("Search by id, title, content or module.")}getFetchUrl(){return"taxes"}parseResponse(t){return t.taxes}getTableName(){return"taxes_table"}with(){return["tax_rate","order:id,currency"]}scopes(){return["validOrder"]}}function tpe(e){return epe.init(e)}const ape=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),lpe=e=>{const t=Object.keys(e[0]),l=[t.map(ape).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(`
279 `)},spe=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=lpe(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)}}),npe={class:"table-cell"},ope={class:"table-cell"},ipe={class:"table-cell"},rpe={class:"table-cell"},dpe={class:"table-cell"},upe={class:"table-cell"},cpe={class:"table-cell"},Ape={class:"table-cell"},ppe={class:"table-cell"},fpe={__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"),m=C("el-table");return r(),E(m,{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",npe,[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",ope,[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",ipe,[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",rpe,[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",dpe,[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",upe,[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",cpe,[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",Ape,[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",ppe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},mpe={class:"table-cell"},hpe={class:"table-cell"},_pe={class:"table-cell"},vpe={class:"table-cell"},gpe={class:"table-cell"},ype={class:"table-cell"},bpe={class:"table-cell"},wpe={class:"table-cell"},Cpe={class:"table-cell"},kpe={__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"),m=C("el-table");return r(),E(m,{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",mpe,[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",hpe,[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",_pe,[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",vpe,[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",gpe,[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",ype,[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",bpe,[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",wpe,[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",Cpe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},Bpe={class:"fct-taxes-page fct-layout-width"},xpe={key:1},Spe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Fpe={class:"fct-tax-filing-wrap"},$pe={class:"fct-tax-filing-summary"},Epe={class:"summary-item"},Upe={class:"summary-label"},Ipe={class:"summary-value"},Qpe={class:"summary-item"},Dpe={class:"summary-label"},Vpe={class:"summary-value"},Tpe={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},Mpe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Lpe={class:"dialog-footer"},Rpe={class:"fct-tax-filing-success-wrap"},Ope={class:"fct-tax-filling-success-icon"},Hpe={class:"dialog-footer"},Ppe={__name:"Taxes",setup(e){const t=Object.fromEntries(Vf.map(S=>[S.value,S.label])),a=S=>t[S]||S;qt().ctx;const l=tpe(),s=T(!1),i=T(!1),c=T(!1),p=T([]),m=K(()=>l.getTableData().map(S=>{var I,Q,D,V,U,O,R,P,j,q,z;return{id:S.id,order_id:S.order_id,country:a(((I=S.tax_rate)==null?void 0:I.country)??((Q=S.meta)==null?void 0:Q.tax_country)??""),state:((D=S.tax_rate)==null?void 0:D.formatted_state)??((V=S.tax_rate)==null?void 0:V.state)??"",postcode:((U=S.tax_rate)==null?void 0:U.postcode)??"",name:((O=S.tax_rate)==null?void 0:O.name)??((R=S.meta)==null?void 0:R.label)??"",reverse_charge:!!((P=S.meta)!=null&&P.reverse_charge_applied),rate:((j=S.tax_rate)==null?void 0:j.rate)??((q=S.meta)==null?void 0:q.rate_percent)??"",total_tax:String(parseFloat((S.total_tax/100).toFixed(2))),currency:((z=S.order)==null?void 0:z.currency)||"",total_tax:String(parseFloat((S.total_tax/100).toFixed(2))),filed_at:S.filed_at?"Yes":"No"}})),_=()=>{s.value=!0,i.value=!1},g=()=>{s.value=!1,i.value=!0},y=async()=>{try{await spe(F.value),g()}catch{}},v=()=>{i.value=!1},w=()=>{const S=F.value.map(I=>I.id);ue.post(l.getFetchUrl(),{ids:S}).then(I=>{Y.success(I.message),l.fetch()}).catch(I=>{Y.error(I)}).finally(()=>{v()})},k=S=>{p.value=S,c.value=S.length>0},b=S=>{F.value=S},x=T(null),F=T([]),M=K(()=>{const S=F.value.reduce((Q,D)=>Q+parseFloat(D.total_tax||0),0),I=[...new Set(F.value.map(Q=>Q.order_id))];return{totalTax:et.formatNumber(Math.round(S*100),!1),totalOrders:I.length,items:F.value}}),$=()=>{Be(()=>{F.value=[...p.value],p.value.forEach(S=>{x.value.toggleRowSelection(S,!0)})})};return(S,I)=>{const Q=C("el-button"),D=C("el-tooltip"),V=C("el-table-column"),U=C("router-link"),O=C("el-tag"),R=C("el-table"),P=C("el-dialog");return r(),h("div",Bpe,[n(sl,{title:A(u)("Taxes")},{action:d(()=>[c.value?(r(),E(Q,{key:1,type:"primary",onClick:_,disabled:!c.value},{default:d(()=>[L(f(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])):(r(),E(D,{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(Q,{type:"primary",disabled:!c.value},{default:d(()=>[L(f(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),n($s,{table:A(l),"has-mobile-slot":!1},{default:d(()=>[A(l).isLoading()?(r(),E(fpe,{key:0,taxTable:A(l),"next-page-count":A(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",xpe,[n(R,{class:"w-full",data:m.value,onSelectionChange:k},{empty:d(()=>[n(bt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(V,{type:"selection",width:45}),A(l).isColumnVisible("id")?(r(),E(V,{key:0,label:A(u)("ID"),width:100},{default:d(j=>[o("span",null,"#"+f(A(u)(j.row.id)),1)]),_:1},8,["label"])):B("",!0),A(l).isColumnVisible("order_id")?(r(),E(V,{key:1,label:A(u)("Order ID"),width:100},{default:d(j=>[o("span",Spe,[n(U,{class:"link",to:{name:"view_order",params:{order_id:j.row.order_id}}},{default:d(()=>[L(" #"+f(j.row.order_id),1)]),_:2},1032,["to"]),j.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[L(f(A(u)("Reverse Charge")),1)]),_:1})):B("",!0)])]),_:1},8,["label"])):B("",!0),n(V,{label:A(u)("Tax Country"),width:120},{default:d(j=>[o("span",null,f(j.row.country),1)]),_:1},8,["label"]),n(V,{label:A(u)("Tax Region"),width:120},{default:d(j=>[o("span",null,f(j.row.state),1)]),_:1},8,["label"]),A(l).isColumnVisible("postcode")?(r(),E(V,{key:2,label:A(u)("Zip Code"),width:120},{default:d(j=>[o("span",null,f(j.row.postcode),1)]),_:1},8,["label"])):B("",!0),n(V,{label:A(u)("Tax Name"),width:120},{default:d(j=>[o("span",null,f(j.row.name),1)]),_:1},8,["label"]),A(l).isColumnVisible("rate")?(r(),E(V,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(j=>[o("span",null,f(j.row.rate)+"%",1)]),_:1},8,["label"])):B("",!0),n(V,{label:A(u)("Sale Taxes"),width:120},{default:d(j=>[o("span",null,f(A(et).formatForOrder(j.row.total_tax_cents,j.row.currency)),1)]),_:1},8,["label"]),A(l).isColumnVisible("filed_at")?(r(),E(V,{key:4,label:A(u)("Filed"),width:120},{default:d(j=>[o("span",null,f(j.row.filed_at),1)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),n(P,{modelValue:s.value,"onUpdate:modelValue":I[1]||(I[1]=j=>s.value=j),title:A(u)("Tax Filing"),onOpen:$,class:"fct-tax-filling-modal"},{footer:d(()=>[o("div",Lpe,[n(Q,{onClick:I[0]||(I[0]=()=>{s.value=!1})},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:y},{default:d(()=>[n(J,{name:"Download",style:{width:"16px",height:"16px"}}),L(" "+f(A(u)("Download & Continue")),1)]),_:1})])]),default:d(()=>[o("div",Fpe,[o("div",$pe,[o("div",Epe,[o("span",Upe,f(A(u)("Taxable Amount")),1),o("span",Ipe,f(M.value.totalTax),1)]),o("div",Qpe,[o("span",Dpe,f(A(u)("Total Orders")),1),o("span",Vpe,f(A(u)(M.value.totalOrders)),1)])]),o("div",Tpe,[n(R,{ref_key:"selectedTaxesTableRef",ref:x,data:p.value,onSelectionChange:b},{empty:d(()=>[n(bt,{icon:"Empty/ListView",text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(V,{type:"selection",width:45}),n(V,{label:A(u)("ID"),width:100},{default:d(j=>[o("span",null,f(j.row.id),1)]),_:1},8,["label"]),n(V,{label:A(u)("Order ID"),"min-width":100},{default:d(j=>[o("span",Mpe,[o("span",null,f(j.row.order_id),1),j.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[L(f(A(u)("Reverse Charge")),1)]),_:1})):B("",!0)])]),_:1},8,["label"]),n(V,{width:120,label:A(u)("Tax Country")},{default:d(j=>[o("span",null,f(j.row.country),1)]),_:1},8,["label"]),n(V,{width:120,label:A(u)("Tax Region")},{default:d(j=>[o("span",null,f(j.row.state),1)]),_:1},8,["label"]),n(V,{label:A(u)("Zip Code"),width:120},{default:d(j=>[o("span",null,f(j.row.postcode),1)]),_:1},8,["label"]),n(V,{width:120,label:A(u)("Tax Name")},{default:d(j=>[o("span",null,f(j.row.name),1)]),_:1},8,["label"]),n(V,{label:A(u)("Tax Rate"),width:120},{default:d(j=>[o("span",null,f(j.row.rate)+"%",1)]),_:1},8,["label"]),n(V,{width:150,label:A(u)("Sale Taxes")},{default:d(j=>[o("span",null,f(A(et).formatForOrder(j.row.total_tax_cents,j.row.currency)),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),n(P,{modelValue:i.value,"onUpdate:modelValue":I[2]||(I[2]=j=>i.value=j),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:d(()=>[o("div",Hpe,[n(Q,{onClick:v},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:w},{default:d(()=>[L(f(A(u)("Mark as Filed")),1)]),_:1})])]),default:d(()=>[o("div",Rpe,[o("div",Ope,[n(J,{name:"CheckCircleFill"})]),o("div",null,[o("h4",null,f(A(u)("Don't Forget to Save Your Tax File")),1),o("p",null,f(A(u)("You're about to mark this tax report as filed.")),1),o("p",null,[L(f(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"},f(A(u)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},Npe={class:"fct-card fct-card-border fct-vat-card"},Kpe={class:"fct-card-body"},Gpe={class:"fct-vat-card-header"},jpe={class:"fct-vat-card-title"},zpe={class:"fct-card fct-card-border fct-vat-card mt-5"},qpe={class:"fct-card-body"},Ype={class:"fct-vat-card-header"},Wpe={class:"fct-vat-card-title"},Xpe={class:"fct-tax-rates-country-view"},Jpe={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Zpe={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},efe={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),h("div",null,[o("div",Npe,[o("div",Kpe,[o("div",Gpe,[o("div",jpe,[o("h3",null,f(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",zpe,[o("div",qpe,[o("div",Ype,[o("div",Wpe,[o("h3",null,f(A(u)("Tax overrides")),1)])]),o("div",Xpe,[o("div",Jpe,[o("div",Zpe,[(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]=[Fn('<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))])])])])]))}},tfe={class:"fct-modal-body"},afe={class:"fct-radio-option-fields"},lfe={class:"form-note"},sfe={class:"fct-radio-option-fields"},nfe={class:"fct-radio-option-fields-desc"},ofe={class:"form-note"},ife={key:0,class:"fct-info-box mt-3"},rfe={class:"text-xs text-system-mid"},dfe={class:"fct-radio-option-fields"},ufe={class:"fct-radio-option-fields-desc"},cfe={__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=T({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=T(!1);be(()=>a.modelValue,_=>{if(_){const g=a.initialRegistrations.length?a.initialRegistrations[0]:null,y=g?g.country:"",v=g&&g.vat||"",w=a.currentForm||{};s.value={method:w.method||"oss",oss_country:w.oss_country||y,oss_vat:w.oss_vat||v,home_country:w.home_country||y,home_vat:w.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 m(){if(!s.value.method){Y.error(u("Select a cross-border registration type"));return}if(s.value.method==="oss"){if(!s.value.oss_country){Y.error(u("Select your country of OSS registration"));return}}else if(s.value.method==="home"&&!s.value.home_country){Y.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=>{Y.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;Y.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"),w=C("el-select"),k=C("el-form-item"),b=C("el-input"),x=C("el-radio-group"),F=C("el-form"),M=C("el-button"),$=C("el-dialog");return r(),E($,{"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]=S=>l("update:modelValue",S))},{footer:d(()=>[n(M,{onClick:g[8]||(g[8]=S=>l("update:modelValue",!1))},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(M,{type:"primary",onClick:m,loading:i.value},{default:d(()=>[L(f(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",tfe,[n(F,{"label-position":"top"},{default:d(()=>[n(x,{modelValue:s.value.method,"onUpdate:modelValue":g[7]||(g[7]=S=>s.value.method=S),class:"fct-cross-border-radios"},{default:d(()=>[o("div",{class:re(["fct-radio-option",{"is-active":s.value.method==="oss"}]),onClick:g[2]||(g[2]=S=>s.value.method="oss")},[n(y,{value:"oss"},{default:d(()=>[L(f(A(u)("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),n(va,{accordion:"",visible:s.value.method==="oss"},{default:d(()=>[o("div",afe,[n(k,{label:A(u)("Country of OSS registration")},{default:d(()=>[n(w,{modelValue:s.value.oss_country,"onUpdate:modelValue":g[0]||(g[0]=S=>s.value.oss_country=S),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,S=>(r(),E(v,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(k,{label:A(u)("VAT number")},{default:d(()=>[n(b,{modelValue:s.value.oss_vat,"onUpdate:modelValue":g[1]||(g[1]=S=>s.value.oss_vat=S),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",lfe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),o("div",{class:re(["fct-radio-option",{"is-active":s.value.method==="home"}]),onClick:g[5]||(g[5]=S=>s.value.method="home")},[n(y,{value:"home"},{default:d(()=>[L(f(A(u)("Collect using your home country registration")),1)]),_:1}),n(va,{accordion:"",visible:s.value.method==="home"},{default:d(()=>[o("div",sfe,[o("p",nfe,f(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(w,{modelValue:s.value.home_country,"onUpdate:modelValue":g[3]||(g[3]=S=>s.value.home_country=S),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,S=>(r(),E(v,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(k,{label:A(u)("VAT number")},{default:d(()=>[n(b,{modelValue:s.value.home_vat,"onUpdate:modelValue":g[4]||(g[4]=S=>s.value.home_vat=S),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",ofe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?B("",!0):(r(),h("div",ife,[n(J,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",rfe,f(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:re(["fct-radio-option",{"is-active":s.value.method==="specific"}]),onClick:g[6]||(g[6]=S=>s.value.method="specific")},[n(y,{value:"specific"},{default:d(()=>[L(f(A(u)("Collect using specific country registrations")),1)]),_:1}),n(va,{accordion:"",visible:s.value.method==="specific"},{default:d(()=>[o("div",dfe,[o("p",ufe,f(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"])}}},Afe={key:0,class:"fct-country-registrations-list mt-4"},pfe={class:"fct-home-country-header"},ffe=["src","alt"],mfe={class:"fct-vat-country-name"},hfe={key:0,class:"fct-collecting-badge"},_fe={class:"fct-home-country-body"},vfe={class:"fct-vat-home-field"},gfe={class:"fct-vat-home-field__label"},yfe={class:"fct-reg-rates-section"},bfe={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},wfe={class:"fct-reg-rates-row fct-reg-rates-header"},Cfe={class:"fct-reg-rates-cell-label"},kfe={class:"fct-reg-rates-cell-label"},Bfe={key:1,class:"fct-reg-class-name"},xfe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Sfe={class:"fct-reg-rates-cell-input"},Ffe={class:"fct-reg-rates-cell-action"},$fe=["title","onClick"],Efe={key:0,class:"fct-reg-add-class px-5"},Ufe={type:"button",class:"fct-reg-add-class-btn"},Ife={class:"fct-vat-home-actions"},Qfe={__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=T({country:"",vat:"",rates:{}}),i=T([]),c=K(()=>a.homeCountry&&a.countries.find(S=>S.value===a.homeCountry)||null),p=K(()=>a.homeCountry&&a.registrations.find(S=>S.country===a.homeCountry)||null),m=K(()=>{const S=p.value;return!S||!S.vat?!1:S.rates&&typeof S.rates=="object"&&Object.keys(S.rates).length?Object.values(S.rates).some(function(I){return I&&parseFloat(I.rate)>0}):parseFloat(S.rate)>0}),_=K(()=>[...a.taxClasses,...i.value]),g=K(()=>_.value.length?_.value:[{slug:"standard",title:u("Standard")}]),y=K(()=>{if(_.value.length>=6)return[];const S=_.value.map(Q=>Q.slug).filter(Boolean),I=[];return S.includes("reduced")||I.push({command:"reduced",label:u("Reduced")}),S.includes("zero")||I.push({command:"zero",label:u("Zero")}),I.push({command:"custom",label:u("Custom Class...")}),I});be([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const S=p.value,I={};a.taxClasses.forEach(Q=>{var O;const D=(O=S==null?void 0:S.rates)==null?void 0:O[Q.slug],V=Q.slug==="standard"?(S==null?void 0:S.rate)??"":"",U=Q.slug==="standard"?(S==null?void 0:S.tax_label)??"":"";D&&typeof D=="object"?I[Q.slug]={rate:D.rate??"",label:D.label??""}:I[Q.slug]={rate:D??V,label:U}}),i.value.forEach(Q=>{const D=v(Q);I[D]=s.value.rates[D]||{rate:"",label:""}}),I.standard||(I.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(S==null?void 0:S.vat)||a.homeVat||"",rates:I}},{immediate:!0});function v(S){return S.tempKey||S.slug}function w(S){if(S==="custom"){b();return}const I=S==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:S,title:I,tempKey:S}),s.value.rates[S]={rate:"",label:""}}let k=0;function b(){const S="_new_"+k++;i.value.push({slug:null,title:"",tempKey:S,isNew:!0}),s.value.rates[S]={rate:"",label:""}}function x(S){return S.slug?S.title||S.slug:S.title&&S.title.trim()?S.title.trim():u("Custom")}function F(S){if(S.hasError=!1,S.created)return Promise.resolve(null);if(!S.slug&&!(S.title&&S.title.trim()))return S.hasError=!0,Promise.reject(new Error(u("Please enter a name for the custom tax class")));const I=S.slug?{slug:S.slug}:{title:S.title.trim()};return ue.post("tax/classes",I).then(Q=>{const D=(Q==null?void 0:Q.class)||{},V=D.slug||S.slug;if(!V)throw new Error(u("Tax class creation returned an invalid response"));return!S.slug&&s.value.rates[S.tempKey]!==void 0&&(s.value.rates[V]=s.value.rates[S.tempKey],delete s.value.rates[S.tempKey],S.tempKey=null),S.slug=V,S.title=D.title||S.title,S.created=!0,D}).catch(Q=>{var V;S.hasError=!0;const D=((V=Q==null?void 0:Q.data)==null?void 0:V.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",D,x(S)))})}function M(S){const I=v(S);if(i.value.some(D=>v(D)===I)){i.value=i.value.filter(D=>v(D)!==I),delete s.value.rates[I];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?',S.title),u("Delete Tax Class"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ue.delete("tax/classes/"+S.id).then(()=>{l("class-changed")}).catch(D=>{var V;Y.error(((V=D==null?void 0:D.data)==null?void 0:V.message)||u("Failed to delete tax class"))})}).catch(()=>{})}function $(){const S=i.value.map(F);Promise.all(S).then(()=>{i.value=[],l("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(I=>{Y.error((I==null?void 0:I.message)||u("Failed to create tax class"))})}return(S,I)=>{const Q=C("el-input"),D=C("el-dropdown-item"),V=C("el-dropdown-menu"),U=C("el-dropdown"),O=C("el-button");return c.value?(r(),h("div",Afe,[o("div",pfe,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:c.value.label,class:"fct-flag-icon"},null,8,ffe),o("span",mfe,f(c.value.label),1),m.value?(r(),h("span",hfe,[I[1]||(I[1]=o("span",{class:"fct-green-dot"},null,-1)),L(" "+f(A(u)("Collecting")),1)])):B("",!0)]),o("div",_fe,[o("div",vfe,[o("label",gfe,f(A(u)("VAT number")),1),n(Q,{modelValue:s.value.vat,"onUpdate:modelValue":I[0]||(I[0]=R=>s.value.vat=R),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",yfe,[o("div",bfe,[o("div",wfe,[o("div",Cfe,f(A(u)("Tax Classes")),1),I[2]||(I[2]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),I[3]||(I[3]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),I[4]||(I[4]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),h(H,null,ae(g.value,R=>(r(),h("div",{key:v(R),class:"fct-reg-rates-row"},[o("div",kfe,[R.isNew?(r(),E(Q,{key:0,modelValue:R.title,"onUpdate:modelValue":P=>R.title=P,size:"small",placeholder:A(u)("Class name"),class:re(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":R.hasError}]),onInput:P=>R.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",Bfe,f(R.title),1))]),o("div",xfe,[n(Q,{modelValue:s.value.rates[v(R)].rate,"onUpdate:modelValue":P=>s.value.rates[v(R)].rate=P,type:"number",step:"0.01",min:"0",size:"small"},{suffix:d(()=>I[5]||(I[5]=[L("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",Sfe,[n(Q,{modelValue:s.value.rates[v(R)].label,"onUpdate:modelValue":P=>s.value.rates[v(R)].label=P,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Ffe,[R.slug!=="standard"?(r(),h("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:A(u)("Delete class"),onClick:P=>M(R)},[n(J,{name:"Delete"})],8,$fe)):B("",!0)])]))),128))]),y.value.length?(r(),h("div",Efe,[y.value.length===1&&y.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:b},[n(J,{name:"Plus",class:"w-3 h-3"}),L(" "+f(A(u)("Add class")),1)])):(r(),E(U,{key:1,trigger:"click",onCommand:w,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(V,null,{default:d(()=>[(r(!0),h(H,null,ae(y.value,R=>(r(),E(D,{key:R.command,command:R.command},{default:d(()=>[L(f(R.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",Ufe,[n(J,{name:"Plus",class:"w-3 h-3"}),L(" "+f(A(u)("Add class")),1)])]),_:1}))])):B("",!0)]),o("div",Ife,[n(O,{type:"primary",size:"small",onClick:$},{default:d(()=>[L(f(A(u)("Save VAT")),1)]),_:1})])])])):B("",!0)}}},Dfe={class:"fct-modal-body fct-country-reg-modal"},Vfe={class:"fct-country-reg-text"},Tfe={class:"form-note"},Mfe={class:"fct-reg-rates-table"},Lfe={class:"fct-reg-rates-row fct-reg-rates-header"},Rfe={class:"fct-reg-rates-cell-label"},Ofe={class:"fct-reg-rates-cell-label"},Hfe={key:1,class:"fct-reg-class-name"},Pfe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Nfe={class:"fct-reg-rates-cell-input"},Kfe={key:1,class:"fct-reg-rates-row"},Gfe={class:"fct-reg-rates-cell-label"},jfe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},zfe={class:"fct-reg-rates-cell-input"},qfe={key:0,class:"fct-reg-add-class"},Yfe={type:"button",class:"fct-reg-add-class-btn"},Wfe={__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=T({country:"",vat:"",rates:{},isEdit:!1}),i=T([]),c=T(!1),p=K(()=>[...a.taxClasses,...i.value]),m=K(()=>{if(p.value.length>=6)return[];const M=p.value.map(S=>S.slug).filter(Boolean),$=[];return M.includes("reduced")||$.push({command:"reduced",label:u("Reduced")}),M.includes("zero")||$.push({command:"zero",label:u("Zero")}),$.push({command:"custom",label:u("Custom Class...")}),$}),_=K(()=>s.value.isEdit?a.countries:a.countries.filter(M=>!a.registeredCountries.includes(M.value)));be(()=>a.modelValue,M=>{if(M){const $=a.initialForm||{},S=$.rates?JSON.parse(JSON.stringify($.rates)):{};a.taxClasses.forEach(I=>{S[I.slug]||(S[I.slug]={rate:"",label:""})}),S.standard||(S.standard={rate:"",label:""}),s.value={country:$.country||"",vat:$.vat||"",rates:S,isEdit:$.isEdit||!1},i.value=[]}});function g(M){return M.tempKey||M.slug}function y(M){const $=a.countries.find(S=>S.value===M);if($&&$.default_rate){const S=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},S,{rate:$.default_rate})})}}function v(M){if(M==="custom"){k();return}const $=M==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:M,title:$,tempKey:M}),s.value.rates[M]={rate:"",label:""}}let w=0;function k(){const M="_new_"+w++;i.value.push({slug:null,title:"",tempKey:M,isNew:!0}),s.value.rates[M]={rate:"",label:""}}function b(M){return M.slug?M.title||M.slug:M.title&&M.title.trim()?M.title.trim():u("Custom")}function x(M){if(M.hasError=!1,M.created)return Promise.resolve(null);if(!M.slug&&!(M.title&&M.title.trim()))return M.hasError=!0,Promise.reject(new Error(u("Please enter a name for the custom tax class")));const $=M.slug?{slug:M.slug}:{title:M.title.trim()};return ue.post("tax/classes",$).then(S=>{const I=(S==null?void 0:S.class)||{},Q=I.slug||M.slug;if(!Q)throw new Error(u("Tax class creation returned an invalid response"));return!M.slug&&s.value.rates[M.tempKey]!==void 0&&(s.value.rates[Q]=s.value.rates[M.tempKey],delete s.value.rates[M.tempKey],M.tempKey=null),M.slug=Q,M.title=I.title||M.title,M.created=!0,I}).catch(S=>{var Q;M.hasError=!0;const I=((Q=S==null?void 0:S.data)==null?void 0:Q.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",I,b(M)))})}function F(){if(!s.value.country){Y.error(u("Select a registration country"));return}const M=s.value.rates;if(!Object.values(M).some(I=>parseFloat(I.rate)>0)){Y.error(u("At least one tax rate must be greater than 0%"));return}c.value=!0;const S=i.value.map(x);Promise.all(S).then(()=>ue.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.country,vat:s.value.vat,rates:s.value.rates})).then(I=>{Y.success(I.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(I=>{var Q;Y.error((I==null?void 0:I.message)||((Q=I==null?void 0:I.data)==null?void 0:Q.message)||u("Failed to save VAT registration"))}).finally(()=>{c.value=!1})}return(M,$)=>{const S=C("el-option"),I=C("el-select"),Q=C("el-form-item"),D=C("el-input"),V=C("el-dropdown-item"),U=C("el-dropdown-menu"),O=C("el-dropdown"),R=C("el-form"),P=C("el-button"),j=C("el-dialog");return r(),E(j,{"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":$[5]||($[5]=q=>l("update:modelValue",q))},{footer:d(()=>[n(P,{onClick:$[4]||($[4]=q=>l("update:modelValue",!1))},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:F,loading:c.value},{default:d(()=>[L(f(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",Dfe,[o("p",Vfe,f(A(u)("Make sure you're registered for VAT when collecting in the EU.")),1),n(R,{"label-position":"top"},{default:d(()=>[n(Q,{label:A(u)("Registration country")},{default:d(()=>[n(I,{modelValue:s.value.country,"onUpdate:modelValue":$[0]||($[0]=q=>s.value.country=q),placeholder:A(u)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:y},{default:d(()=>[(r(!0),h(H,null,ae(_.value,q=>(r(),E(S,{key:q.value,label:q.label,value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),n(Q,{label:A(u)("VAT number")},{default:d(()=>[n(D,{modelValue:s.value.vat,"onUpdate:modelValue":$[1]||($[1]=q=>s.value.vat=q),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",Tfe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",Mfe,[o("div",Lfe,[o("div",Rfe,f(A(u)("Tax Classes")),1),$[6]||($[6]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),$[7]||($[7]=o("div",{class:"fct-reg-rates-cell-input"},null,-1))]),p.value.length?(r(!0),h(H,{key:0},ae(p.value,q=>(r(),h("div",{key:q.tempKey||q.slug,class:"fct-reg-rates-row"},[o("div",Ofe,[q.isNew?(r(),E(D,{key:0,modelValue:q.title,"onUpdate:modelValue":z=>q.title=z,size:"small",placeholder:A(u)("Class name"),class:re(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":q.hasError}]),onInput:z=>q.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",Hfe,f(q.title),1))]),o("div",Pfe,[n(D,{modelValue:s.value.rates[g(q)].rate,"onUpdate:modelValue":z=>s.value.rates[g(q)].rate=z,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:q.slug==="standard"?"19":"0"},{suffix:d(()=>$[8]||($[8]=[L("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Nfe,[n(D,{modelValue:s.value.rates[g(q)].label,"onUpdate:modelValue":z=>s.value.rates[g(q)].label=z,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),h("div",Kfe,[o("div",Gfe,f(A(u)("Standard")),1),o("div",jfe,[n(D,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":$[2]||($[2]=q=>s.value.rates.standard.rate=q),modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:"19"},{suffix:d(()=>$[9]||($[9]=[L("%",-1)])),_:1},8,["modelValue"])]),o("div",zfe,[n(D,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":$[3]||($[3]=q=>s.value.rates.standard.label=q),size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),m.value.length?(r(),h("div",qfe,[m.value.length===1&&m.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:k},[n(J,{name:"Plus"}),L(" "+f(A(u)("Add class")),1)])):(r(),E(O,{key:1,trigger:"click",onCommand:v},{dropdown:d(()=>[n(U,null,{default:d(()=>[(r(!0),h(H,null,ae(m.value,q=>(r(),E(V,{key:q.command,command:q.command},{default:d(()=>[L(f(q.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",Yfe,[n(J,{name:"Plus"}),L(" "+f(A(u)("Add class")),1)])]),_:1}))])):B("",!0)]),_:1})])]),_:1},8,["model-value","title"])}}},Xfe={class:"fct-oss-rates-section"},Jfe=["aria-expanded"],Zfe={class:"inline-flex items-center gap-2"},eme={class:"fct-oss-rates-count"},tme={class:"fct-oss-rates-table"},ame={key:1,class:"text-system-mid"},lme={class:"fct-btn-group mt-4 justify-end sm"},sme={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=T([]),l=T([]),s=T(null),i=T("standard"),c=T(!1),p=T(!1),m=T(!1),_=T(!1),g=T(6),y=T(!1),v=T(""),w=K(()=>a.value),k=K(()=>{const Q=v.value.trim().toLowerCase();return Q?w.value.filter(D=>D.label&&D.label.toLowerCase().includes(Q)):w.value});function b(){return c.value=!0,ue.get("tax/configuration/settings/eu-vat/oss-rates").then(Q=>{a.value=Q.rates||[],l.value=Q.classes||[];const D=Fd({classes:l.value,activeId:s.value});return D&&(s.value=D.id,i.value=D.slug),l.value}).catch(Q=>{var D;Y.error((D=Q==null?void 0:Q.data)==null?void 0:D.message)}).finally(()=>{c.value=!1})}function x(Q){s.value=Q.id,i.value=Q.slug}function F(Q){y.value=!0,Po({payload:{slug:Q},createdSlug:Q,currentClasses:l.value,reloadClasses:b}).then(({createdClass:D})=>{D&&x(D)}).catch(D=>{var V;Y.error((V=D==null?void 0:D.data)==null?void 0:V.message)}).finally(()=>{y.value=!1})}function M(Q){y.value=!0,Po({payload:{title:Q},currentClasses:l.value,reloadClasses:b}).then(({createdClass:D})=>{D&&x(D)}).catch(D=>{var V;Y.error((V=D==null?void 0:D.data)==null?void 0:V.message)}).finally(()=>{y.value=!1})}function $(Q){Q.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?',Q.title),u("Delete Tax Class"),{confirmButtonText:u("Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{c.value=!0,Gp({classId:Q.id,currentActiveId:s.value===Q.id?null:s.value,reloadClasses:b}).then(({nextActiveClass:D})=>{D&&x(D)}).catch(D=>{var V;Y.error((V=D==null?void 0:D.data)==null?void 0:V.message),c.value=!1})}).catch(()=>{})}function S(){p.value=!0,ue.post("tax/configuration/settings/eu-vat/oss-rates",{rates:w.value.map(Q=>({country:Q.country,rate:Q.rate,tax_label:Q.tax_label||"",class_rates:Q.class_rates||{}}))}).then(Q=>{Y.success(Q.message)}).catch(Q=>{var D;Y.error((D=Q==null?void 0:Q.data)==null?void 0:D.message)}).finally(()=>{p.value=!1})}function I(){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(()=>{m.value=!0,ue.post("tax/configuration/settings/eu-vat/reset-rates").then(()=>b()).then(()=>{Y.success(u("EU tax rates have been reset to defaults"))}).catch(Q=>{var D;Y.error(((D=Q==null?void 0:Q.data)==null?void 0:D.message)||u("Failed to reset rates"))}).finally(()=>{m.value=!1})}).catch(()=>{})}return Ie(b),t({loadRates:b}),(Q,D)=>{const V=C("el-icon"),U=C("el-table-column"),O=C("el-input"),R=C("el-table"),P=C("el-button"),j=Ma("loading");return r(),h("div",Xfe,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:D[0]||(D[0]=q=>{_.value=!_.value,_.value||(v.value="")}),onKeydown:[D[1]||(D[1]=xa(Ne(q=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["enter"])),D[2]||(D[2]=xa(Ne(q=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["space"]))]},[o("span",Zfe,[L(f(A(u)("Destination country rates"))+" ",1),o("span",eme," ("+f(w.value.length)+") ",1)]),n(V,{class:re(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:d(()=>[n(J,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,Jfe),n(Gl,{name:"fct-collapse"},{default:d(()=>[Gt(o("div",tme,[n(Ja,{type:"info"},{content:d(()=>[o("span",null,f(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"))+" + "+f(A(u)("button to add tax classes.")),1)]),_:1}),n(Kp,{classes:l.value,"active-id":s.value,"max-classes":g.value,creating:y.value,search:v.value,onSwitch:x,onDelete:$,onAdd:F,onCreateCustom:M,"onUpdate:search":D[3]||(D[3]=q=>v.value=q)},null,8,["classes","active-id","max-classes","creating","search"]),Gt((r(),E(R,{data:k.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":A(u)("No rates found")},{default:d(()=>[n(U,{label:A(u)("Country"),"min-width":"160"},{default:d(({row:q})=>[L(f(q.label),1)]),_:1},8,["label"]),n(U,{label:A(u)("Tax Label"),"min-width":"150"},{default:d(({row:q})=>[q.class_rates&&q.class_rates[i.value]?(r(),E(O,{key:0,modelValue:q.class_rates[i.value].label,"onUpdate:modelValue":z=>q.class_rates[i.value].label=z,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),_:1},8,["label"]),n(U,{label:A(u)("Rate"),"min-width":"120"},{default:d(({row:q})=>[q.class_rates&&q.class_rates[i.value]?(r(),E(O,{key:0,modelValue:q.class_rates[i.value].rate,"onUpdate:modelValue":z=>q.class_rates[i.value].rate=z,modelModifiers:{number:!0},size:"small",type:"number",min:0,max:100,step:"0.5"},{suffix:d(()=>D[4]||(D[4]=[L("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),h("span",ame,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[j,c.value]]),o("div",lme,[i.value==="standard"?(r(),E(P,{key:0,size:"small",loading:m.value,onClick:I,type:"danger",soft:""},{default:d(()=>[L(f(A(u)("Reset to default")),1)]),_:1},8,["loading"])):B("",!0),n(P,{type:"primary",size:"small",loading:p.value,onClick:S},{default:d(()=>[L(f(A(u)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Vl,_.value]])]),_:1})])}}},nme={class:"fct-vat-card-header"},ome={class:"fct-vat-card-title"},ime={class:"fct-vat-card-body"},rme={class:"fct-vat-reg-info"},dme={class:"fct-vat-country-name"},ume={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},cme={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},Ame={key:2,class:"fct-country-registrations-list mt-4"},pme={class:"fct-reg-rows"},fme={key:0,class:"fct-vat-registration-row"},mme={class:"fct-vat-reg-info"},hme=["src","alt"],_me={class:"fct-vat-country-name"},vme={class:"fct-vat-reg-info"},gme=["src","alt"],yme={class:"fct-vat-country-name"},bme={key:0,class:"fct-vat-number"},wme={key:1,class:"fct-vat-missing-badge"},Cme={class:"fct-vat-reg-actions"},kme={key:1,class:"fct-vat-empty-state"},Bme={class:"text-system-mid text-sm"},xme={key:0,class:"px-5 py-3"},Sme={key:1,class:"fct-vat-cross-border-empty"},Fme={class:"fct-vat-cross-border-empty-text"},$me={class:"fct-vat-cross-border-empty-title"},Eme={class:"fct-vat-cross-border-empty-desc"},Ume={__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=T({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=T(!1),c=T(null),p=T([]),m=T(!1),_=T({country:"",vat:"",rates:{},isEdit:!1}),g=K(()=>a.countries.length||28),y=K(()=>a.initialRegistrations.filter(M).length),v=K(()=>a.storeCountry&&a.countries.find(X=>X.value===a.storeCountry)||null),w=K(()=>a.storeCountry?a.initialRegistrations.some(X=>X.country===a.storeCountry):!1),k=K(()=>{if(s.value.method!=="home"||!s.value.home_country)return!1;const X=a.initialRegistrations.find(ne=>ne.country===s.value.home_country);return!!X&&M(X)}),b=K(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function x(X){if(!X||!Array.isArray(a.countries))return X;const ne=a.countries.find(he=>he.value===X);return ne?ne.label:X}function F(X){return X?X.rates&&typeof X.rates=="object"&&Object.keys(X.rates).length?Object.values(X.rates).some(ne=>ne&&parseFloat(ne.rate)>0):parseFloat(X.rate)>0:!1}function M(X){return!!X&&!!X.vat&&F(X)}function $(X){return F(X)&&!X.vat}function S(){return ue.get("tax/classes").then(X=>{p.value=X.classes||[]}).catch(()=>{Y.error(u("Failed to load tax classes"))})}function I(X){const ne={};return p.value.forEach(he=>{ne[he.slug]={rate:he.slug==="standard"&&X||"",label:""}}),ne}function Q(){const X=v.value&&!w.value?a.storeCountry:"",ne=X&&v.value&&v.value.default_rate||"";_.value={country:X,vat:"",rates:I(ne),isEdit:!1},m.value=!0}function D(X){const ne=X.rates||{},he={};p.value.forEach(N=>{const G=ne[N.slug];if(G&&typeof G=="object")he[N.slug]={rate:G.rate||"",label:G.label||""};else{const Z=N.slug==="standard"?X.rate||"":G||"";he[N.slug]={rate:Z,label:N.slug==="standard"&&X.tax_label||""}}}),_.value={country:X.country,vat:X.vat||"",rates:he,isEdit:!0},m.value=!0}function V(){S(),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}function U(X){ue.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:X.country,vat:X.vat,rates:X.rates}).then(ne=>{Y.success(ne.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:X.vat})}).catch(ne=>{var he;Y.error(((he=ne==null?void 0:ne.data)==null?void 0:he.message)||u("Failed to save VAT registration"))})}function O(X){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:X}).then(ne=>{Y.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 he;Y.error((he=ne==null?void 0:ne.data)==null?void 0:he.message)})}).catch(()=>{})}function R(){return y.value===1?u("Collecting in 1 country"):u("Collecting in %1$s countries",y.value)}const P=K(()=>g.value===1?u("Collecting in 1 region"):u("Collecting in %1$s regions",g.value));function j(X){s.value={method:X.method,oss_country:X.oss_country,oss_vat:X.oss_vat,home_country:X.home_country,home_vat:X.home_country_vat},X.method==="oss"&&Be(()=>{var ne;return(ne=c.value)==null?void 0:ne.loadRates()}),l("method-changed",{method:X.method,home_country:X.home_country,home_vat:X.home_country_vat})}function q(X){X==="edit"?i.value=!0:X==="stop"&&z()}function z(){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(X=>{Y.success(X.message),s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},l("method-changed",{method:"",home_country:"",home_vat:""})}).catch(X=>{var ne;Y.error((ne=X==null?void 0:X.data)==null?void 0:ne.message)})}).catch(()=>{})}return be(()=>a.initialForm,X=>{const ne=X||{};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,X=>{X&&X.length&&S()},{immediate:!0}),(X,ne)=>{const he=C("el-tooltip"),N=C("el-dropdown-item"),G=C("el-dropdown-menu"),Z=C("el-dropdown"),W=C("el-button");return r(),h(H,null,[n(xe,{class:"fct-vat-card"},{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",nme,[o("div",ome,[o("h3",null,f(A(u)("Collect VAT cross-border")),1),n(he,{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"])]),b.value?(r(),E(Z,{key:0,trigger:"click",onCommand:q,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:d(()=>[n(G,null,{default:d(()=>[n(N,{command:"edit"},{default:d(()=>[L(f(A(u)("Edit registration")),1)]),_:1}),n(N,{command:"stop"},{default:d(()=>[L(f(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",ime,[b.value?(r(),h(H,{key:0},[o("div",rme,[ne[4]||(ne[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",dme,f(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",ume,[ne[3]||(ne[3]=o("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(r(),h(H,{key:0},[L(f(R()),1)],64)):(r(),h(H,{key:1},[L(f(P.value),1)],64))])):B("",!0),e.isTaxEnabled?B("",!0):(r(),h("span",cme,f(A(u)("Tax disabled")),1))]),s.value.method==="home"?(r(),E(Ja,{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.",x(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.",x(s.value.home_country))},null,8,["type","content"])):B("",!0),s.value.method==="home"?(r(),E(Qfe,{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:U,onClassChanged:S},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):B("",!0),s.value.method==="specific"?(r(),h("div",Ame,[o("div",pme,[v.value&&!w.value?(r(),h("div",fme,[o("div",mme,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,hme),o("span",_me,f(v.value.label),1)]),n(W,{size:"small",onClick:Q},{default:d(()=>[L(f(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",vme,[o("img",{src:`https://flagcdn.com/w40/${ie.country.toLowerCase()}.png`,alt:x(ie.country),class:"fct-flag-icon"},null,8,gme),o("span",yme,f(x(ie.country)),1),ie.vat?(r(),h("span",bme,f(ie.vat),1)):$(ie)?(r(),h("span",wme,f(A(u)("VAT ID missing")),1)):B("",!0)]),o("div",Cme,[F(ie)?(r(),E(Ze,{key:0,border:"none",size:"small",tag:"button",title:A(u)("Edit"),onClick:ye=>D(ie)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),E(W,{key:1,size:"small",onClick:ye=>D(ie)},{default:d(()=>[L(f(A(u)("Configure")),1)]),_:2},1032,["onClick"])),n(Ze,{border:"none",size:"small",tag:"button",title:A(u)("Delete"),onClick:ye=>O(ie.country)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),h("div",kme,[o("p",Bme,f(A(u)("No country VAT registrations configured.")),1),n(W,{type:"primary",size:"small",onClick:Q},{default:d(()=>[L(f(A(u)("Configure")),1)]),_:1})])):B("",!0)]),e.initialRegistrations.length||v.value?(r(),h("div",xme,[n(W,{type:"primary",link:"",onClick:Q},{default:d(()=>[L(" + "+f(A(u)("Collect in another country")),1)]),_:1})])):B("",!0)])):B("",!0),s.value.method==="oss"?(r(),E(sme,{key:3,ref_key:"ossRatesRef",ref:c},null,512)):B("",!0)],64)):(r(),h("div",Sme,[ne[5]||(ne[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",Fme,[o("p",$me,f(A(u)("Not collecting cross-border VAT")),1),o("p",Eme,f(A(u)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),n(W,{size:"small",onClick:ne[0]||(ne[0]=ie=>i.value=!0),type:"primary"},{default:d(()=>[L(f(A(u)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),n(cfe,{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:j},null,8,["modelValue","countries","current-form","initial-registrations"]),n(Wfe,{modelValue:m.value,"onUpdate:modelValue":ne[2]||(ne[2]=ie=>m.value=ie),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(ie=>ie.country),onSaved:V},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},Ime={__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=T({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}),i=T([]),c=T(!1),p=T(!1);function m(){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(b){if(b.type==="shipping")s.value={type:"shipping",original_type:"shipping",original_id:b.id,category_id:"",category_name:"",country:b._raw.country||"",city:b._raw.city||"",postcode:b._raw.postcode||"",tax_label:b.tax_label,tax_rate:b.rate,class_id:Number(b._raw.class_id)||m(),id:b.id};else{const x=b._raw.meta_value||b._raw;s.value={type:"products",original_type:"products",original_id:b.id,category_id:Ws(x.category_id),category_name:b.category_name,country:x.country||"",city:x.city||"",postcode:x.postcode||"",tax_label:b.tax_label,tax_rate:b.rate,class_id:Number(b.class_id)||0,id:b.id}}}be(()=>a.modelValue,b=>{b&&(a.editRow?g(a.editRow):_(),y())}),be(()=>s.value.type,b=>{b==="shipping"&&!s.value.class_id&&(s.value.class_id=m())}),be(()=>a.taxClasses,b=>{s.value.type==="shipping"&&!s.value.class_id&&b&&b.length>0&&(s.value.class_id=Number(b[0].id)||0)});function y(){i.value.length>0||(c.value=!0,ue.get("products/fetch-term").then(b=>{const x=b.taxonomies&&b.taxonomies["product-categories"]?b.taxonomies["product-categories"].terms||[]:[];i.value=x.map(F=>({...F,value:Ws(F.value)}))}).catch(()=>{Y.error(u("Failed to load product categories"))}).finally(()=>{c.value=!1}))}function v(b,x){return ue.get("tax/rates/country/rates/"+b,{class_id:x}).then(F=>{const $=(F&&F.tax_rates?F.tax_rates:[]).find(function(I){return!I.state&&!I.city&&!I.postcode});if($)return $;const S=a.countries.find(function(I){return I.value===b});return ue.post("tax/country/rate",{country:b,state:"",rate:S&&S.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:x}).then(function(I){return I&&I.tax_rate?I.tax_rate:null})})}function w(b){const x=Ws(b),F=i.value.find(M=>M.value===x);F&&(s.value.category_name=F.label)}function k(){if(s.value.type==="products"&&!s.value.category_id){Y.error(u("Please select a category"));return}if(!s.value.country){Y.error(u("Please select a location"));return}if(s.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){Y.error(u("Tax classes are not available. Please reload the page and try again."));return}if(!s.value.class_id){Y.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(b=>{Y.success(b.message),l("saved"),l("update:modelValue",!1)}).catch(b=>{Y.error(b&&b.data?b.data.message:b&&b.message?b.message:"")}).finally(()=>{p.value=!1});else{const b=s.value.class_id;v(s.value.country,b).then(x=>x?ue.post("tax/rates/country/override",{id:x.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:b,override_tax_rate:s.value.tax_rate,city:s.value.city||"",postcode:s.value.postcode||""}).then(F=>{Y.success(F.message),l("saved"),l("update:modelValue",!1)}).catch(F=>{Y.error(F&&F.data?F.data.message:F&&F.message?F.message:"")}).finally(()=>{p.value=!1}):(Y.error(u("No tax rate found for the selected country and tax class")),p.value=!1,null)).catch(x=>{Y.error(x&&x.data?x.data.message:x&&x.message?x.message:""),p.value=!1})}}return(b,x)=>{const F=C("el-radio"),M=C("el-radio-group"),$=C("el-form-item"),S=C("el-option"),I=C("el-select"),Q=C("el-input"),D=C("el-form"),V=C("el-button"),U=C("el-dialog");return r(),E(U,{"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":x[14]||(x[14]=O=>l("update:modelValue",O))},{footer:d(()=>[n(V,{onClick:x[13]||(x[13]=O=>l("update:modelValue",!1))},{default:d(()=>[L(f(A(u)("Cancel")),1)]),_:1}),n(V,{type:"primary",loading:p.value,onClick:k},{default:d(()=>[L(f(e.editRow?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(D,{"label-position":"top",model:s.value},{default:d(()=>[n($,{label:A(u)("Override type")},{default:d(()=>[n(M,{modelValue:s.value.type,"onUpdate:modelValue":x[0]||(x[0]=O=>s.value.type=O)},{default:d(()=>[n(F,{value:"products"},{default:d(()=>[L(f(A(u)("Products")),1)]),_:1}),n(F,{value:"shipping"},{default:d(()=>[L(f(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.value.type==="products"?(r(),h(H,{key:0},[n($,{label:A(u)("Category")},{default:d(()=>[n(I,{modelValue:s.value.category_id,"onUpdate:modelValue":x[1]||(x[1]=O=>s.value.category_id=O),filterable:"",placeholder:A(u)("Select a category"),loading:c.value,style:{width:"100%"},onChange:w},{default:d(()=>[(r(!0),h(H,null,ae(i.value,O=>(r(),E(S,{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($,{key:0,label:A(u)("Tax Class")},{default:d(()=>[n(I,{modelValue:s.value.class_id,"onUpdate:modelValue":x[2]||(x[2]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[n(S,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(H,null,ae(e.taxClasses,O=>(r(),E(S,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):B("",!0),n($,{label:A(u)("Tax label")},{default:d(()=>[n(Q,{modelValue:s.value.tax_label,"onUpdate:modelValue":x[3]||(x[3]=O=>s.value.tax_label=O),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:A(u)("Location")},{default:d(()=>[n(I,{modelValue:s.value.country,"onUpdate:modelValue":x[4]||(x[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(S,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:A(u)("City (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.city,"onUpdate:modelValue":x[5]||(x[5]=O=>s.value.city=O),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.postcode,"onUpdate:modelValue":x[6]||(x[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($,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Q,{modelValue:s.value.tax_rate,"onUpdate:modelValue":x[7]||(x[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($,{label:A(u)("Location")},{default:d(()=>[n(I,{modelValue:s.value.country,"onUpdate:modelValue":x[8]||(x[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(S,{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($,{key:0,label:A(u)("Tax Class")},{default:d(()=>[n(I,{modelValue:s.value.class_id,"onUpdate:modelValue":x[9]||(x[9]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(e.taxClasses,O=>(r(),E(S,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):B("",!0),n($,{label:A(u)("City (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.city,"onUpdate:modelValue":x[10]||(x[10]=O=>s.value.city=O),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.postcode,"onUpdate:modelValue":x[11]||(x[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($,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Q,{modelValue:s.value.tax_rate,"onUpdate:modelValue":x[12]||(x[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"])}}},Qme={class:"fct-tax-rates-country-view"},Dme={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Vme={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"},Tme={key:0},Mme={key:1},Lme={class:"fct-btn-group sm justify-end"},Rme={__name:"EUVatTaxOverridesCard",props:{countries:{type:Array,default:()=>[]}},setup(e){const t=e,a=T([]),l=T(!1),s=T(!1),i=T(null),c=T([]);function p(w){if(!w||!Array.isArray(t.countries))return w;const k=t.countries.find(b=>b.value===w);return k?k.label:w}function m(){ue.get("tax/classes").then(w=>{c.value=w.classes||[]}).catch(()=>{Y.error(u("Failed to load tax classes"))})}function _(){l.value=!0,ue.get("tax/configuration/settings/eu-vat/product-overrides").then(w=>{const k=[],b=w.overrides||[];for(const F of b){const M=F.meta_value||F;k.push({id:F.id,type:"products",tax_label:M.tax_label||"",category_name:M.category_name||"",location:p(M.country),city:M.city||"",postcode:M.postcode||"",rate:M.rate,class_id:Number(F.class_id)||0,class_label:F.class_label||"",_raw:F})}const x=w.shipping_overrides||[];for(const F of x)k.push({id:F.id,type:"shipping",tax_label:F.name||"",category_name:"",location:p(F.country),city:F.city||"",postcode:F.postcode||"",rate:F.for_shipping,class_id:Number(F.class_id)||0,class_label:F.class_label||"",_raw:F});a.value=k}).catch(()=>{a.value=[]}).finally(()=>{l.value=!1})}function g(){i.value=null,s.value=!0}function y(w){i.value=w,s.value=!0}function v(w){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=w.type==="shipping"?"tax/rates/country/override/"+w.id:"tax/product-overrides/"+w.id;ue.delete(k).then(b=>{Y.success(b.message),a.value=a.value.filter(x=>!(x.id===w.id&&x.type===w.type))}).catch(b=>{var x;Y.error((x=b==null?void 0:b.data)==null?void 0:x.message)})}).catch(()=>{})}return Ie(()=>{m(),_()}),(w,k)=>{const b=C("el-button"),x=C("el-tag"),F=C("el-table-column"),M=C("el-table");return r(),h(H,null,[n(xe,{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(b,{size:"small",onClick:g},{default:d(()=>[L(f(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[o("div",Qme,[l.value?(r(),h("div",Dme,[o("div",Vme,[(r(),h(H,null,ae(6,$=>o("div",{key:"loading-header-"+$,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(H,null,ae(3,$=>o("div",{key:"loading-row-"+$,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(M,{key:1,data:a.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n(F,{label:A(u)("Type"),width:"110"},{default:d(({row:$})=>[n(x,{type:$.type==="products"?"primary":"info",size:"small"},{default:d(()=>[L(f($.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n(F,{label:A(u)("Category")},{default:d(({row:$})=>[L(f($.category_name||"—"),1)]),_:1},8,["label"]),n(F,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:$})=>[L(f($.class_label||A(u)("All")),1)]),_:1},8,["label"]),n(F,{label:A(u)("Tax Label")},{default:d(({row:$})=>[L(f($.tax_label||"—"),1)]),_:1},8,["label"]),n(F,{label:A(u)("Location")},{default:d(({row:$})=>[L(f($.location),1)]),_:1},8,["label"]),n(F,{label:A(u)("City / Postcode")},{default:d(({row:$})=>[$.city||$.postcode?(r(),h("span",Tme,f([$.city,$.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",Mme,"—"))]),_:1},8,["label"]),n(F,{label:A(u)("Rate"),width:"100"},{default:d(({row:$})=>[L(f($.rate)+"% ",1)]),_:1},8,["label"]),n(F,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:$})=>[o("div",Lme,[n(Ze,{tag:"button",size:"small",onClick:S=>y($)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ze,{tag:"button",size:"small",onClick:S=>v($),bg:"danger",outline:""},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),n(Ime,{modelValue:s.value,"onUpdate:modelValue":[k[0]||(k[0]=$=>s.value=$),k[1]||(k[1]=$=>!$&&(i.value=null))],countries:e.countries,"tax-classes":c.value,"edit-row":i.value,onSaved:_},null,8,["modelValue","countries","tax-classes","edit-row"])],64)}}},Ome={class:"setting-wrap"},Hme={class:"setting-wrap-inner"},Pme={class:"fct-tax-collection-page"},Nme={__name:"EUVatSettings",setup(e){const t=T(!0),a=je.get("eu_vat_county_options",[]),l=T(""),s=T(""),i=T([]),c=T({}),p=K(()=>!!je.get("is_tax_enabled"));function m(){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;Y.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{t.value=!1})}function _({method:g}){s.value=g||"",m()}return Ie(m),(g,y)=>(r(),h("div",Ome,[n(Qa,{heading:A(u)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",Hme,[n(Da),o("div",Pme,[t.value?(r(),E(efe,{key:0})):(r(),h(H,{key:1},[n(Ume,{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(Rme,{countries:A(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class Kme extends Fs{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"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Title"),value:"title"},{label:u("Code"),value:"code"},{label:u("Amount"),value:"amount"},{label:u("Max Uses"),value:"max_uses"},{label:u("Stackable"),value:"stackable"},{label:u("Status"),value:"status"},{label:u("Expiry Date"),value:"expiry_date"}]}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["appliedCouponsCount"]}}function jp(e){return Kme.init(e)}const Gme={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},jme={class:"fct-table-mobile-header"},zme={class:"fct-table-mobile-header-left"},qme={class:"fct-table-id-col"},Yme={class:"fct-table-status-col"},Wme=["onClick"],Xme={class:"title"},Jme={class:"value"},Zme={key:0,class:"fct-table-action-col"},ehe={class:"more-btn pr-0"},the={class:"fct-table-mobile-body"},ahe=["onClick"],lhe={key:0,class:"fct-table-coupon-title-col"},she={class:"fct-table-coupon-code-col"},nhe=["onClick"],ohe={class:"fct-table-mobile-footer"},ihe=["onClick"],rhe={class:"fct-table-date-col grid"},dhe={class:"title"},uhe={class:"value"},che={key:0,class:"fct-table-stackable-col"},Ahe={class:"title"},phe={class:"value"},fhe={class:"fct-table-amount-col"},mhe={class:"title"},hhe={class:"value"},_he={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){at.extend(li);const t=e,a=s=>{if(!s||s==="0000-00-00 00:00:00")return!1;const i=at.utc(s).local();return i.isValid()?i.isBefore(at()):!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=>{Y.success(c.message),t.table.fetch()}).catch(c=>{Y.error(c)}).finally(()=>{})}).catch(()=>{})};return(s,i)=>{const c=C("router-link"),p=C("el-tooltip"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",Gme,[(r(!0),h(H,null,ae(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[o("div",jme,[o("div",zme,[o("div",qme,[n(c,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:d(()=>[L(" #"+f(y.id),1)]),_:2},1032,["to"])]),o("div",Yme,[n(fa,{status:y.status},{default:d(()=>[L(f(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(()=>[L(f(A(u)("Available On: %s",A(Bs)(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:w=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",Xme,f(A(u)("Usage:")),1),o("div",Jme,[L(f(y.use_count??0)+" ",1),i[0]||(i[0]=o("span",null,"/",-1)),L(" "+f(y.conditions.max_uses>0?y.conditions.max_uses:A(u)("Unlimited")),1)])],8,Wme)]),e.table.isColumnVisible("actions")?(r(),h("div",Zme,[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(m,{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"}),L(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(m,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",ehe,[n(J,{name:"More"})])]),_:2},1024)])):B("",!0)]),o("div",the,[o("div",{class:"fct-table-coupon-code-wrapper-col",onClick:w=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(r(),h("div",lhe,f(y.title),1)):B("",!0),o("div",she,[o("code",{class:"copyable-content",onClick:w=>{A(Yl).copy(y.code)}},f(y.code),9,nhe)])],8,ahe)]),o("div",ohe,[o("div",{class:"fct-table-mobile-footer-row items-start",onClick:w=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",rhe,[o("div",dhe,f(A(u)("Expiry Date")),1),o("div",uhe,[isNaN(Date.parse(y.end_date))?(r(),h(H,{key:1},[L("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",che,[o("div",Ahe,f(A(u)("Stackable")),1),o("div",phe,f(y.stackable),1)])):B("",!0),o("div",fhe,[o("div",mhe,f(A(u)("Amount")),1),o("div",hhe,f(y.type!=="percentage"?A(_a)(y.amount,!0):y.amount+"%"),1)])],8,ihe)])]))),128))])}}},vhe={},ghe={class:"px-4 py-3"},yhe={class:"grid grid-cols-3 gap-5 mt-5"};function bhe(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",ghe,[(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",yhe,[(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 whe=st(vhe,[["render",bhe]]),Che={class:"fct-all-coupons-page fct-layout-width"},khe={class:"fct-all-coupons-wrap"},Bhe={key:1},xhe=["onClick"],She={class:"capitalize"},Fhe={class:"more-btn mr-2"},Ac={__name:"AllCoupons",setup(e){at.extend(li);const t=jp(),a=T(!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(m=>{Y.success(m.message),t.fetch()}).catch(m=>{var _;m.status_code=="422"?Y.validationErrors(m):Y.error((_=m.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"?Y.validationErrors(c):Y.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=at.utc(c).local();return p.isValid()?p.isBefore(at()):!1};return Ie(()=>{s()}),(c,p)=>{const m=C("el-button"),_=C("el-table-column"),g=C("el-tooltip"),y=C("router-link"),v=C("el-dropdown-item"),w=C("el-dropdown-menu"),k=C("el-dropdown"),b=C("el-table");return r(),E(Nt,{permission:"coupons/view"},{default:d(()=>[o("div",Che,[n(sl,{title:A(u)("Coupons")},{action:d(()=>[n(m,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:d(()=>[L(f(A(u)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),o("div",khe,[n($s,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(whe,{key:0})):B("",!0),A(t).isLoading()?B("",!0):(r(),E(_he,{key:1,table:A(t)},null,8,["table"]))]),default:d(()=>[A(t).isLoading()?(r(),E(kpe,{key:0,couponTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",Bhe,[n(b,{data:A(t).getTableData(),class:"w-full compact-table full-compact"},{empty:d(()=>[n(bt,{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(x=>[n(ka,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id}}},{default:d(()=>[L(" #"+f(A(Zt)(x.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(x=>[n(ka,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[L(f(x.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:A(u)("Code"),width:200},{default:d(x=>[o("code",{class:"copyable-content",onClick:F=>{A(Yl).copy(x.row.code)}},f(x.row.code),9,xhe)]),_:1},8,["label"]),n(_,{label:A(u)("Amount"),width:120},{default:d(x=>[n(ka,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[L(f(x.row.type!=="percentage"?A(_a)(x.row.amount,!0):x.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:A(u)("Usage"),width:150},{default:d(x=>[n(ka,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[o("span",null,f(A(Zt)(x.row.use_count??0)),1),p[0]||(p[0]=o("span",{class:"px-1"},"/",-1)),o("span",null,f(x.row.conditions.max_uses>0?x.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(x=>[n(ka,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[o("span",She,f(x.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:A(u)("Status"),width:120},{default:d(x=>[n(ka,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[n(fa,{status:x.row.status},{default:d(()=>[L(f(i(x.row.end_date)?A(u)("Expired"):x.row.status),1)]),_:2},1032,["status"]),x.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(()=>[L(f(A(u)("Available On: %s",A(Bs)(x.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(x=>[n(ka,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[o("span",null,[isNaN(Date.parse(x.row.end_date))?(r(),h(H,{key:1},[L("n/a")],64)):(r(),E(Na,{key:0,"date-time":x.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(x=>[n(k,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(w,null,{default:d(()=>[x.row.id?(r(),E(v,{key:0,class:"item-link"},{default:d(()=>[n(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[n(J,{name:"Edit"}),L(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(v,{command:{action:"delete",coupon:x.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),L(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",Fhe,[n(J,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},$he={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Ehe={class:"single-page-header"},Uhe={class:"single-page-body"},Ihe={class:"fct-add-edit-coupon"},Qhe={class:"fct-add-edit-coupon-main"},Dhe={class:"fct-add-edit-coupon-aside"},Vhe={class:"fct-admin-sidebar"},The={__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",$he,[o("div",Ehe,[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",Uhe,[o("div",Ihe,[o("div",Qhe,[n(xe,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(xe,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(xe,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(xe,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(xe,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",Dhe,[o("div",Vhe,[n(xe,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})])])])])])}}};at.extend(li);at.extend(Nc);const Mhe={name:"AddOrEditCoupon",components:{CardContainer:xe,CardHeader:Qe,CardBody:Ce,LabelHint:pa,ValidationError:oa,CopyToClipboard:Ia,DynamicTemplates:rn,SaveBar:sn,ProductVariationSelector:Kc,SingleCouponLoader:The,Activity:Vc},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=ps(),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:at(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=_a(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=_a(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=_a(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"?Y.validationErrors(e):Y.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=at.utc(t).tz(at.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=at.utc(a).tz(at.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),e=e.coupon,this.coupon=e,this.coupon.start_date=this.formatDate(this.coupon.start_date),this.coupon.end_date=this.formatDate(this.coupon.end_date),this.coupon.end_date!==null&&(this.isEndDateEnabled=!0),this.coupon.end_date=this.coupon.end_date!==null&&this.coupon.end_date!=="Invalid date"?this.coupon.end_date:null,this.coupon.conditions.excluded_products=this.parseProductIds(e.conditions.excluded_products),this.coupon.conditions.included_products=this.parseProductIds(e.conditions.included_products),this.coupon.conditions.min_amount_basis||(this.coupon.conditions.min_amount_basis="total"),this.formatAmount(),this.setDefaultStatus(),this.showDynamicTemplates=!0}).catch(e=>{var t;errors.status_code=="422"?Y.validationErrors(errors):Y.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}),Y.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var l;a.status_code=="422"?(Y.validationErrors(a),this.validationErrors=a):Y.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}),Y.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var l;a.status_code=="422"?(Y.validationErrors(a),this.validationErrors=a):Y.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.creating=!1})}}},Lhe={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Rhe={class:"single-page-header"},Ohe={class:"single-page-body"},Hhe={class:"fct-add-edit-coupon"},Phe={class:"fct-add-edit-coupon-main"},Nhe={class:"flex gap-2 items-center justify-between w-full mb-2.5"},Khe={class:"form-note"},Ghe=["innerHTML"],jhe={key:1},zhe=["innerHTML"],qhe=["innerHTML"],Yhe=["innerHTML"],Whe={class:"fct-add-edit-coupon-aside"},Xhe={class:"fct-admin-sidebar"},Jhe={class:"fct-admin-sidebar-item"},Zhe={key:0,class:"flex items-center gap-1"},e_e={class:"text-sm font-medium text-system-dark dark:text-gray-300"},t_e={key:1},a_e={class:"fct-admin-sidebar-item mt-5 hidden"},l_e={class:"sidebar-title mb-3"},s_e={class:"fct-bullet-lists"},n_e={class:"fct-admin-sidebar-item mt-5 hidden"},o_e={class:"sidebar-title mb-3"},i_e={class:"fct-bullet-lists"},r_e={key:0};function d_e(e,t,a,l,s,i){const c=C("SaveBar"),p=C("SingleCouponLoader"),m=C("el-breadcrumb-item"),_=C("el-breadcrumb"),g=C("CardHeader"),y=C("el-input"),v=C("ValidationError"),w=C("el-form-item"),k=C("el-col"),b=C("LabelHint"),x=C("el-row"),F=C("CardBody"),M=C("CardContainer"),$=C("el-option"),S=C("el-select"),I=C("el-radio"),Q=C("el-radio-group"),D=C("ProductVariationSelector"),V=C("el-checkbox"),U=C("el-form"),O=C("CopyToClipboard"),R=C("el-date-picker"),P=C("DynamicTemplates"),j=C("Activity");return r(),h("div",Lhe,[n(c,{isActive:s.changes_made>0?"is-active":"",loading:a.coupon_id?s.updating:s.creating,onSave:t[0]||(t[0]=q=>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",Rhe,[n(_,{"separator-icon":i.ArrowRight},{default:d(()=>[n(m,{to:{name:"coupons"}},{default:d(()=>[L(f(i.translate("Coupons")),1)]),_:1}),n(m,null,{default:d(()=>[L(f(a.coupon_id?i.translate("Edit Coupon"):i.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),E(m,{key:0},{default:d(()=>[L(f(s.coupon.title),1)]),_:1})):B("",!0)]),_:1},8,["separator-icon"])]),o("div",Ohe,[o("div",Hhe,[o("div",Phe,[n(U,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(M,null,{default:d(()=>[n(g,{title:i.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(w,{label:i.translate("Title"),required:""},{default:d(()=>{var q,z;return[n(y,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=X=>s.coupon.title=X),placeholder:i.translate("Enter title"),class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(z=s.validationErrors)!=null&&z.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(w,null,{default:d(()=>{var q,z;return[o("div",Nhe,[n(b,{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]=(...X)=>i.generateRandomCouponCode&&i.generateRandomCouponCode(...X))},f(i.translate("Generate Random Code")),1)]),n(y,{modelValue:s.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=X=>s.coupon.code=X),placeholder:i.translate("Eg. COUPON10"),class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(z=s.validationErrors)!=null&&z.hasOwnProperty("code")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"code"},null,8,["validation-errors"])):B("",!0),o("div",Khe,[o("p",null,f(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{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 q,z;return[n(y,{modelValue:s.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=X=>s.coupon.priority=X),type:"number",placeholder:i.translate("Enter priority"),class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=X=>{i.onChangeCouponInput("priority",X)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","onKeypress"]),(z=s.validationErrors)!=null&&z.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(M,null,{default:d(()=>[n(g,{title:i.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(k,{lg:8},{default:d(()=>[n(w,{label:i.translate("Type"),required:""},{default:d(()=>{var q;return[n(S,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=z=>s.coupon.type=z),placeholder:i.translate("Select coupon type"),class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:d(()=>[n($,{label:i.translate("Fixed"),value:"fixed"},null,8,["label"]),n($,{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(w,{label:s.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:d(()=>{var q;return[n(y,{modelValue:s.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=z=>s.coupon.amount=z),type:"number",placeholder:"0.00",min:s.minDiscountAmount,max:i.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=z=>{i.onChangeCouponInput("amount",z)}),onKeypress:t[9]||(t[9]=z=>i.preventInvalidChars(z,!0))},{prefix:d(()=>[s.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,Ghe)):(r(),h("span",jhe,"%"))]),_:1},8,["modelValue","min","max"]),(q=s.validationErrors)!=null&&q.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(w,{label:i.translate("Max Discount Amount")},{default:d(()=>{var q;return[n(y,{modelValue:s.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=z=>s.coupon.conditions.max_discount_amount=z),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,zhe)]),_: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(M,null,{default:d(()=>[n(g,{title:i.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("Min Spend Amount"),content:i.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:d(()=>{var q,z;return[n(y,{modelValue:s.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=X=>s.coupon.conditions.min_purchase_amount=X),type:"number",placeholder:"0.00",class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,qhe)]),_:1},8,["modelValue","class"]),(z=s.validationErrors)!=null&&z.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(w,null,{label:d(()=>[n(b,{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 q,z;return[n(y,{modelValue:s.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=X=>s.coupon.conditions.max_purchase_amount=X),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Yhe)]),_:1},8,["modelValue","placeholder","class"]),(z=s.validationErrors)!=null&&z.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(w,null,{label:d(()=>[n(b,{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(Q,{modelValue:s.coupon.conditions.min_amount_basis,"onUpdate:modelValue":t[13]||(t[13]=q=>s.coupon.conditions.min_amount_basis=q)},{default:d(()=>[n(I,{value:"subtotal",label:i.translate("Subtotal (items only)")},null,8,["label"]),n(I,{value:"total",label:i.translate("Total (includes shipping & fees)")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),n(k,{md:12},{default:d(()=>[n(w,{label:i.translate("Include Categories")},{default:d(()=>[n(S,{modelValue:s.coupon.conditions.included_categories,"onUpdate:modelValue":t[14]||(t[14]=q=>s.coupon.conditions.included_categories=q),multiple:"",placeholder:i.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,q=>(r(),E($,{key:q.value,label:q.label,value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(k,{md:12},{default:d(()=>[n(w,{label:i.translate("Exclude Categories")},{default:d(()=>[n(S,{modelValue:s.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[15]||(t[15]=q=>s.coupon.conditions.excluded_categories=q),multiple:"",placeholder:i.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,q=>(r(),E($,{key:q.value,label:q.label,value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(w,{label:i.translate("Include Products")},{default:d(()=>[n(D,{modelValue:s.coupon.conditions.included_products,"onUpdate:modelValue":t[16]||(t[16]=q=>s.coupon.conditions.included_products=q)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(w,{label:i.translate("Excluded Products")},{default:d(()=>[n(D,{modelValue:s.coupon.conditions.excluded_products,"onUpdate:modelValue":t[17]||(t[17]=q=>s.coupon.conditions.excluded_products=q)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{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 q;return[n(y,{autocomplete:"off",modelValue:s.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[18]||(t[18]=z=>s.coupon.conditions.email_restrictions=z),type:"text",placeholder:i.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(q=s.validationErrors)!=null&&q.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 q;return[n(w,null,{label:d(()=>[n(b,{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(V,{modelValue:s.coupon.conditions.is_recurring,"onUpdate:modelValue":t[19]||(t[19]=z=>s.coupon.conditions.is_recurring=z),label:i.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(q=s.validationErrors)!=null&&q.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(M,null,{default:d(()=>[n(g,{title:i.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{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 q,z;return[n(y,{modelValue:s.coupon.conditions.max_uses,"onUpdate:modelValue":t[20]||(t[20]=X=>s.coupon.conditions.max_uses=X),type:"number",placeholder:i.translate("Total limit"),class:re((q=s.validationErrors)!=null&&q.hasOwnProperty("max_uses")?"is-error":s.usageError),min:s.minLimit,max:s.maxLimit,onInput:t[21]||(t[21]=X=>{i.onChangeCouponInput("max_uses",X)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),(z=s.validationErrors)!=null&&z.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(w,null,{label:d(()=>[n(b,{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]=q=>s.coupon.conditions.max_per_customer=q),type:"number",placeholder:i.translate("Max limit per user"),class:re(s.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:s.minLimit,max:s.maxLimit,onInput:t[23]||(t[23]=q=>{i.onChangeCouponInput("max_per_customer",q)}),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(M,null,{default:d(()=>[n(g,{title:i.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(w,{label:i.translate("Status")},{default:d(()=>[n(Q,{modelValue:s.coupon.status,"onUpdate:modelValue":t[24]||(t[24]=q=>s.coupon.status=q)},{default:d(()=>[n(I,{value:"active",label:i.translate("Active")},null,8,["label"]),n(I,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),n(I,{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(w,{label:i.translate("Internal Notes")},{default:d(()=>{var q;return[n(y,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[25]||(t[25]=z=>s.coupon.notes=z),type:"textarea",placeholder:i.translate("Enter note"),class:re((q=s.validationErrors)!=null&&q.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 q;return[n(w,null,{label:d(()=>[n(b,{title:i.translate("Stackable"),content:i.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:d(()=>[n(Q,{modelValue:s.coupon.stackable,"onUpdate:modelValue":t[26]||(t[26]=z=>s.coupon.stackable=z)},{default:d(()=>[n(I,{value:"yes"},{default:d(()=>[L(f(i.translate("Yes")),1)]),_:1}),n(I,{value:"no"},{default:d(()=>[L(f(i.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(q=s.validationErrors)!=null&&q.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",Whe,[o("div",Xhe,[n(M,null,{default:d(()=>[n(g,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:d(()=>[o("div",Jhe,[s.coupon.code?(r(),h("div",Zhe,[o("span",e_e,f(i.translate("Coupon code"))+": "+f(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",t_e,f(i.translate("No discount code yet")),1))]),o("div",a_e,[o("h4",l_e,f(i.translate("Type & Method")),1),o("ul",s_e,[o("li",null,[o("span",null,f(i.translate("Amount off Products")),1)]),o("li",null,[o("span",null,f(i.translate("Code")),1)])])]),o("div",n_e,[o("h4",o_e,f(i.translate("Details")),1),o("ul",i_e,[o("li",null,[o("span",null,f(i.translate("For Online Store")),1)]),o("li",null,[o("span",null,f(i.translate("No Min Purchase Requirement")),1)]),o("li",null,[o("span",null,f(i.translate("All Customers")),1)])])])]),_:1})]),_:1}),n(M,null,{default:d(()=>[n(g,{title:i.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(U,{"label-position":"top"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(w,{label:i.translate("Start Date & Time")},{default:d(()=>[n(R,{modelValue:s.coupon.start_date,"onUpdate:modelValue":t[27]||(t[27]=q=>s.coupon.start_date=q),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(w,null,{default:d(()=>[n(V,{modelValue:s.isEndDateEnabled,"onUpdate:modelValue":t[28]||(t[28]=q=>s.isEndDateEnabled=q),label:i.translate("Set end date & time"),onChange:t[29]||(t[29]=q=>{q||(s.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),s.isEndDateEnabled?(r(),E(k,{key:0,lg:24},{default:d(()=>[n(w,{label:i.translate("End Date & Time")},{default:d(()=>[n(R,{modelValue:s.coupon.end_date,"onUpdate:modelValue":t[30]||(t[30]=q=>s.coupon.end_date=q),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",r_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(M,null,{default:d(()=>[n(g,{title:i.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:d(()=>[n(j,{onReload:i.fetchCoupon,activities:s.coupon.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const u_e=st(Mhe,[["render",d_e]]),c_e={name:"CheckoutFields",components:{Animation:va,CardHeader:Qe,Card:xe,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,m;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"||((m=(p=this.settings.basic_info)==null?void 0:p.last_name)==null?void 0:m.enabled)==="yes":!1},isVisible(e,t){var a,l,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())}}},A_e={class:"setting-wrap"},p_e={class:"setting-wrap-inner"},f_e={class:"fct-checkout-fields-wrapp"},m_e={class:"field-heading"},h_e={class:"fct-checkout-fields"},__e={key:0,class:"fct-checkout-field"},v_e={class:"fct-checkout-field-info"},g_e={class:"fct-checkout-field-label-wrap"},y_e={class:"fct-checkout-field-tags"},b_e={key:0,class:"fct-checkout-field-info-desc"},w_e={key:0,class:"fct-checkout-field-action"},C_e={key:1,class:"fct-checkout-field-input"},k_e={class:"fct-checkout-field-info"},B_e={class:"fct-checkout-field-label-wrap"},x_e={key:1,class:"fct-checkout-field-tags"},S_e={key:0,class:"fct-checkout-field-info-desc"},F_e={key:0,class:"fct-checkout-field-action"},$_e={class:"form-section-save-action"};function E_e(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("el-switch"),g=C("el-tag"),y=C("el-checkbox"),v=C("el-input"),w=C("CardBody"),k=C("Card"),b=C("el-button");return r(),h("div",A_e,[n(c,{heading:i.translate("Checkout Fields"),loading:s.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",p_e,[n(p),o("div",f_e,[n(k,null,{default:d(()=>[n(w,null,{default:d(()=>[n(m,{loading:s.fetching,animated:"",rows:5},null,8,["loading"]),s.fetching?B("",!0):(r(!0),h(H,{key:0},ae(s.fields,(x,F)=>(r(),h("div",{key:F,class:"fct-checkout-field-section"},[o("h3",m_e,f(i.formatSectionTitle(F)),1),o("div",h_e,[x.label?(r(),h("div",__e,[o("div",v_e,[o("div",g_e,[x.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[F].enabled,"onUpdate:modelValue":M=>s.settings[F].enabled=M,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):B("",!0),o("span",{class:re(`fct-checkout-field-label ${s.settings[F].enabled==="no"?"opacity-50":""}`)},f(x.label),3),o("div",y_e,[x.can_alter!=="yes"&&s.settings[F].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:d(()=>[L(f(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(()=>[L(f(i.translate("Required")),1)]),_:1})):B("",!0)])]),x.help_text?(r(),h("div",b_e,f(x.help_text),1)):B("",!0)]),x.can_alter==="yes"?(r(),h("div",w_e,[n(y,{modelValue:s.settings[F].required,"onUpdate:modelValue":M=>s.settings[F].required=M,"true-label":"yes","false-label":"no",disabled:s.settings[F].enabled!=="yes"},{default:d(()=>[L(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),s.settings[F].hasOwnProperty("text")&&s.settings[F].enabled==="yes"?(r(),h("div",C_e,[n(v,{type:"textarea",modelValue:s.settings[F].text,"onUpdate:modelValue":M=>s.settings[F].text=M,disabled:s.settings[F].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0)])):(r(!0),h(H,{key:1},ae(x,(M,$)=>(r(),h("div",{key:$,class:"fct-checkout-field"},[o("div",k_e,[o("div",B_e,[M.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[F][$].enabled,"onUpdate:modelValue":S=>s.settings[F][$].enabled=S,"active-value":"yes","inactive-value":"no",disabled:i.isFirstNameDisabled(F,$)||i.isB2BOnlyModeDisabled(F,$)},null,8,["modelValue","onUpdate:modelValue","disabled"])):B("",!0),o("span",{class:re(["fct-checkout-field-label",i.shouldDimLabel(F,$)?"opacity-50":""])},f(M.label),3),i.isVisible(M,$)?(r(),h("div",x_e,[M.can_alter!=="yes"&&s.settings[F][$].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:d(()=>[L(f(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(()=>[L(f(i.translate("Required")),1)]),_:1})):B("",!0)])):B("",!0)]),M.help_text?(r(),h("div",S_e,f(M.help_text),1)):B("",!0)]),M.can_alter==="yes"&&$!=="first_name"&&$!=="b2b_only_mode"?(r(),h("div",F_e,[n(y,{modelValue:s.settings[F][$].required,"onUpdate:modelValue":S=>s.settings[F][$].required=S,"true-label":"yes","false-label":"no",disabled:s.settings[F][$].enabled!=="yes"},{default:d(()=>[L(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0)]))),128))])]))),128))]),_:1})]),_:1}),o("div",$_e,[n(b,{type:"primary",onClick:i.saveFields,loading:s.saving},{default:d(()=>[L(f(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const U_e=st(c_e,[["render",E_e]]);var wo={exports:{}};/* @license
280 Papa Parse
281 v5.5.3
282 https://github.com/mholt/PapaParse
283 License: MIT
284 */var I_e=wo.exports,pc;function Q_e(){return pc||(pc=1,function(e,t){((a,l)=>{e.exports=l()})(I_e,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={},m=0,_={};function g(V){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(U){var O=I(U);O.chunkSize=parseInt(O.chunkSize),U.step||U.chunk||(O.chunkSize=null),this._handle=new b(O),(this._handle.streamer=this)._config=O}).call(this,V),this.parseChunk=function(U,O){var R=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<R){let j=this._config.newline;j||(P=this._config.quoteChar||'"',j=this._handle.guessLineEndings(U,P)),U=[...U.split(j).slice(R)].join(j)}this.isFirstChunk&&D(this._config.beforeFirstChunk)&&(P=this._config.beforeFirstChunk(U))!==void 0&&(U=P),this.isFirstChunk=!1,this._halted=!1;var R=this._partialLine+U,P=(this._partialLine="",this._handle.parse(R,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(U=P.meta.cursor,R=(this._finished||(this._partialLine=R.substring(U-this._baseIndex),this._baseIndex=U),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:R});else if(D(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||!R||!D(this._config.complete)||P&&P.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),R||P&&P.meta.paused||this._nextChunk(),P}this._halted=!0},this._sendError=function(U){D(this._config.error)?this._config.error(U):c&&this._config.error&&l.postMessage({workerId:_.WORKER_ID,error:U,finished:!1})}}function y(V){var U;(V=V||{}).chunkSize||(V.chunkSize=_.RemoteChunkSize),g.call(this,V),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(U=new XMLHttpRequest,this._config.withCredentials&&(U.withCredentials=this._config.withCredentials),i||(U.onload=Q(this._chunkLoaded,this),U.onerror=Q(this._chunkError,this)),U.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var O,R=this._config.downloadRequestHeaders;for(O in R)U.setRequestHeader(O,R[O])}var P;this._config.chunkSize&&(P=this._start+this._config.chunkSize-1,U.setRequestHeader("Range","bytes="+this._start+"-"+P));try{U.send(this._config.downloadRequestBody)}catch(j){this._chunkError(j.message)}i&&U.status===0&&this._chunkError()}},this._chunkLoaded=function(){U.readyState===4&&(U.status<200||400<=U.status?this._chunkError():(this._start+=this._config.chunkSize||U.responseText.length,this._finished=!this._config.chunkSize||this._start>=(O=>(O=O.getResponseHeader("Content-Range"))!==null?parseInt(O.substring(O.lastIndexOf("/")+1)):-1)(U),this.parseChunk(U.responseText)))},this._chunkError=function(O){O=U.statusText||O,this._sendError(new Error(O))}}function v(V){(V=V||{}).chunkSize||(V.chunkSize=_.LocalChunkSize),g.call(this,V);var U,O,R=typeof FileReader<"u";this.stream=function(P){this._input=P,O=P.slice||P.webkitSlice||P.mozSlice,R?((U=new FileReader).onload=Q(this._chunkLoaded,this),U.onerror=Q(this._chunkError,this)):U=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,j=(this._config.chunkSize&&(j=Math.min(this._start+this._config.chunkSize,this._input.size),P=O.call(P,this._start,j)),U.readAsText(P,this._config.encoding));R||this._chunkLoaded({target:{result:j}})},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(U.error)}}function w(V){var U;g.call(this,V=V||{}),this.stream=function(O){return U=O,this._nextChunk()},this._nextChunk=function(){var O,R;if(!this._finished)return O=this._config.chunkSize,U=O?(R=U.substring(0,O),U.substring(O)):(R=U,""),this._finished=!U,this.parseChunk(R)}}function k(V){g.call(this,V=V||{});var U=[],O=!0,R=!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(){R&&U.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),U.length?this.parseChunk(U.shift()):O=!0},this._streamData=Q(function(P){try{U.push(typeof P=="string"?P:P.toString(this._config.encoding)),O&&(O=!1,this._checkIsFinished(),this.parseChunk(U.shift()))}catch(j){this._streamError(j)}},this),this._streamError=Q(function(P){this._streamCleanUp(),this._sendError(P)},this),this._streamEnd=Q(function(){this._streamCleanUp(),R=!0,this._streamData("")},this),this._streamCleanUp=Q(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(V){var U,O,R,P,j=Math.pow(2,53),q=-j,z=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,X=/^((\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,he=0,N=0,G=!1,Z=!1,W=[],ie={data:[],errors:[],meta:{}};function ye(pe){return V.skipEmptyLines==="greedy"?pe.join("").trim()==="":pe.length===1&&pe[0].length===0}function fe(){if(ie&&R&&(se("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+_.DefaultDelimiter+"'"),R=!1),V.skipEmptyLines&&(ie.data=ie.data.filter(function(_e){return!ye(_e)})),ge()){let _e=function(Xe,ht){D(V.transformHeader)&&(Xe=V.transformHeader(Xe,ht)),W.push(Xe)};if(ie)if(Array.isArray(ie.data[0])){for(var pe=0;ge()&&pe<ie.data.length;pe++)ie.data[pe].forEach(_e);ie.data.splice(0,1)}else ie.data.forEach(_e)}function $e(_e,Xe){for(var ht=V.header?{}:[],Ye=0;Ye<_e.length;Ye++){var Se=Ye,Ee=_e[Ye],Ee=((Oe,Me)=>(_t=>(V.dynamicTypingFunction&&V.dynamicTyping[_t]===void 0&&(V.dynamicTyping[_t]=V.dynamicTypingFunction(_t)),(V.dynamicTyping[_t]||V.dynamicTyping)===!0))(Oe)?Me==="true"||Me==="TRUE"||Me!=="false"&&Me!=="FALSE"&&((_t=>{if(z.test(_t)&&(_t=parseFloat(_t),q<_t&&_t<j))return 1})(Me)?parseFloat(Me):X.test(Me)?new Date(Me):Me===""?null:Me):Me)(Se=V.header?Ye>=W.length?"__parsed_extra":W[Ye]:Se,Ee=V.transform?V.transform(Ee,Se):Ee);Se==="__parsed_extra"?(ht[Se]=ht[Se]||[],ht[Se].push(Ee)):ht[Se]=Ee}return V.header&&(Ye>W.length?se("FieldMismatch","TooManyFields","Too many fields: expected "+W.length+" fields but parsed "+Ye,N+Xe):Ye<W.length&&se("FieldMismatch","TooFewFields","Too few fields: expected "+W.length+" fields but parsed "+Ye,N+Xe)),ht}var tt;ie&&(V.header||V.dynamicTyping||V.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),V.header&&ie.meta&&(ie.meta.fields=W),N+=tt)}function ge(){return V.header&&W.length===0}function se(pe,$e,tt,_e){pe={type:pe,code:$e,message:tt},_e!==void 0&&(pe.row=_e),ie.errors.push(pe)}D(V.step)&&(P=V.step,V.step=function(pe){ie=pe,ge()?fe():(fe(),ie.data.length!==0&&(he+=pe.data.length,V.preview&&he>V.preview?O.abort():(ie.data=ie.data[0],P(ie,ne))))}),this.parse=function(pe,$e,tt){var _e=V.quoteChar||'"',_e=(V.newline||(V.newline=this.guessLineEndings(pe,_e)),R=!1,V.delimiter?D(V.delimiter)&&(V.delimiter=V.delimiter(pe),ie.meta.delimiter=V.delimiter):((_e=((Xe,ht,Ye,Se,Ee)=>{var Oe,Me,_t,vt;Ee=Ee||[","," ","|",";",_.RECORD_SEP,_.UNIT_SEP];for(var Lt=0;Lt<Ee.length;Lt++){for(var Et,Dt=Ee[Lt],dt=0,Ut=0,Ft=0,It=(_t=void 0,new F({comments:Se,delimiter:Dt,newline:ht,preview:10}).parse(Xe)),Qt=0;Qt<It.data.length;Qt++)Ye&&ye(It.data[Qt])?Ft++:(Et=It.data[Qt].length,Ut+=Et,_t===void 0?_t=Et:0<Et&&(dt+=Math.abs(Et-_t),_t=Et));0<It.data.length&&(Ut/=It.data.length-Ft),(Me===void 0||dt<=Me)&&(vt===void 0||vt<Ut)&&1.99<Ut&&(Me=dt,Oe=Dt,vt=Ut)}return{successful:!!(V.delimiter=Oe),bestDelimiter:Oe}})(pe,V.newline,V.skipEmptyLines,V.comments,V.delimitersToGuess)).successful?V.delimiter=_e.bestDelimiter:(R=!0,V.delimiter=_.DefaultDelimiter),ie.meta.delimiter=V.delimiter),I(V));return V.preview&&V.header&&_e.preview++,U=pe,O=new F(_e),ie=O.parse(U,$e,tt),fe(),G?{meta:{paused:!0}}:ie||{meta:{paused:!1}}},this.paused=function(){return G},this.pause=function(){G=!0,O.abort(),U=D(V.chunk)?"":U.substring(O.getCharIndex())},this.resume=function(){ne.streamer._halted?(G=!1,ne.streamer.parseChunk(U,!0)):setTimeout(ne.resume,3)},this.aborted=function(){return Z},this.abort=function(){Z=!0,O.abort(),ie.meta.aborted=!0,D(V.complete)&&V.complete(ie),U=""},this.guessLineEndings=function(Xe,_e){Xe=Xe.substring(0,1048576);var _e=new RegExp(x(_e)+"([^]*?)"+x(_e),"gm"),tt=(Xe=Xe.replace(_e,"")).split("\r"),_e=Xe.split(`
285 `),Xe=1<_e.length&&_e[0].length<tt[0].length;if(tt.length===1||Xe)return`
286 `;for(var ht=0,Ye=0;Ye<tt.length;Ye++)tt[Ye][0]===`
287 `&&ht++;return ht>=tt.length/2?`\r
288 `:"\r"}}function x(V){return V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(V){var U=(V=V||{}).delimiter,O=V.newline,R=V.comments,P=V.step,j=V.preview,q=V.fastMode,z=null,X=!1,ne=V.quoteChar==null?'"':V.quoteChar,he=ne;if(V.escapeChar!==void 0&&(he=V.escapeChar),(typeof U!="string"||-1<_.BAD_DELIMITERS.indexOf(U))&&(U=","),R===U)throw new Error("Comment character same as delimiter");R===!0?R="#":(typeof R!="string"||-1<_.BAD_DELIMITERS.indexOf(R))&&(R=!1),O!==`
289 `&&O!=="\r"&&O!==`\r
290 `&&(O=`
291 `);var N=0,G=!1;this.parse=function(Z,W,ie){if(typeof Z!="string")throw new Error("Input must be a string");var ye=Z.length,fe=U.length,ge=O.length,se=R.length,pe=D(P),$e=[],tt=[],_e=[],Xe=N=0;if(!Z)return dt();if(q||q!==!1&&Z.indexOf(ne)===-1){for(var ht=Z.split(O),Ye=0;Ye<ht.length;Ye++){if(_e=ht[Ye],N+=_e.length,Ye!==ht.length-1)N+=O.length;else if(ie)return dt();if(!R||_e.substring(0,se)!==R){if(pe){if($e=[],vt(_e.split(U)),Ut(),G)return dt()}else vt(_e.split(U));if(j&&j<=Ye)return $e=$e.slice(0,j),dt(!0)}}return dt()}for(var Se=Z.indexOf(U,N),Ee=Z.indexOf(O,N),Oe=new RegExp(x(he)+x(ne),"g"),Me=Z.indexOf(ne,N);;)if(Z[N]===ne)for(Me=N,N++;;){if((Me=Z.indexOf(ne,Me+1))===-1)return ie||tt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:$e.length,index:N}),Et();if(Me===ye-1)return Et(Z.substring(N,Me).replace(Oe,ne));if(ne===he&&Z[Me+1]===he)Me++;else if(ne===he||Me===0||Z[Me-1]!==he){Se!==-1&&Se<Me+1&&(Se=Z.indexOf(U,Me+1));var _t=Lt((Ee=Ee!==-1&&Ee<Me+1?Z.indexOf(O,Me+1):Ee)===-1?Se:Math.min(Se,Ee));if(Z.substr(Me+1+_t,fe)===U){_e.push(Z.substring(N,Me).replace(Oe,ne)),Z[N=Me+1+_t+fe]!==ne&&(Me=Z.indexOf(ne,N)),Se=Z.indexOf(U,N),Ee=Z.indexOf(O,N);break}if(_t=Lt(Ee),Z.substring(Me+1+_t,Me+1+_t+ge)===O){if(_e.push(Z.substring(N,Me).replace(Oe,ne)),Dt(Me+1+_t+ge),Se=Z.indexOf(U,N),Me=Z.indexOf(ne,N),pe&&(Ut(),G))return dt();if(j&&$e.length>=j)return dt(!0);break}tt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:$e.length,index:N}),Me++}}else if(R&&_e.length===0&&Z.substring(N,N+se)===R){if(Ee===-1)return dt();N=Ee+ge,Ee=Z.indexOf(O,N),Se=Z.indexOf(U,N)}else if(Se!==-1&&(Se<Ee||Ee===-1))_e.push(Z.substring(N,Se)),N=Se+fe,Se=Z.indexOf(U,N);else{if(Ee===-1)break;if(_e.push(Z.substring(N,Ee)),Dt(Ee+ge),pe&&(Ut(),G))return dt();if(j&&$e.length>=j)return dt(!0)}return Et();function vt(Ft){$e.push(Ft),Xe=N}function Lt(Ft){var It=0;return It=Ft!==-1&&(Ft=Z.substring(Me+1,Ft))&&Ft.trim()===""?Ft.length:It}function Et(Ft){return ie||(Ft===void 0&&(Ft=Z.substring(N)),_e.push(Ft),N=ye,vt(_e),pe&&Ut()),dt()}function Dt(Ft){N=Ft,vt(_e),_e=[],Ee=Z.indexOf(O,N)}function dt(Ft){if(V.header&&!W&&$e.length&&!X){var It=$e[0],Qt=Object.create(null),Tt=new Set(It);let Wt=!1;for(let kt=0;kt<It.length;kt++){let sa=It[kt];if(Qt[sa=D(V.transformHeader)?V.transformHeader(sa,kt):sa]){let ve,Fe=Qt[sa];for(;ve=sa+"_"+Fe,Fe++,Tt.has(ve););Tt.add(ve),It[kt]=ve,Qt[sa]++,Wt=!0,(z=z===null?{}:z)[ve]=sa}else Qt[sa]=1,It[kt]=sa;Tt.add(sa)}Wt&&console.warn("Duplicate headers found and renamed."),X=!0}return{data:$e,errors:tt,meta:{delimiter:U,linebreak:O,aborted:G,truncated:!!Ft,cursor:Xe+(W||0),renamedHeaders:z}}}function Ut(){P(dt()),$e=[],tt=[]}},this.abort=function(){G=!0},this.getCharIndex=function(){return N}}function M(V){var U=V.data,O=p[U.workerId],R=!1;if(U.error)O.userError(U.error,U.file);else if(U.results&&U.results.data){var P={abort:function(){R=!0,$(U.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:S,resume:S};if(D(O.userStep)){for(var j=0;j<U.results.data.length&&(O.userStep({data:U.results.data[j],errors:U.results.errors,meta:U.results.meta},P),!R);j++);delete U.results}else D(O.userChunk)&&(O.userChunk(U.results,P,U.file),delete U.results)}U.finished&&!R&&$(U.workerId,U.results)}function $(V,U){var O=p[V];D(O.userComplete)&&O.userComplete(U),O.terminate(),delete p[V]}function S(){throw new Error("Not implemented.")}function I(V){if(typeof V!="object"||V===null)return V;var U,O=Array.isArray(V)?[]:{};for(U in V)O[U]=I(V[U]);return O}function Q(V,U){return function(){V.apply(U,arguments)}}function D(V){return typeof V=="function"}return _.parse=function(V,U){var O=(U=U||{}).dynamicTyping||!1;if(D(O)&&(U.dynamicTypingFunction=O,O={}),U.dynamicTyping=O,U.transform=!!D(U.transform)&&U.transform,!U.worker||!_.WORKERS_SUPPORTED)return O=null,_.NODE_STREAM_INPUT,typeof V=="string"?(V=(R=>R.charCodeAt(0)!==65279?R:R.slice(1))(V),O=new(U.download?y:w)(U)):V.readable===!0&&D(V.read)&&D(V.on)?O=new k(U):(l.File&&V instanceof File||V instanceof Object)&&(O=new v(U)),O.stream(V);(O=(()=>{var R;return!!_.WORKERS_SUPPORTED&&(R=(()=>{var P=l.URL||l.webkitURL||null,j=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; ","(",j,")();"],{type:"text/javascript"})))})(),(R=new l.Worker(R)).onmessage=M,R.id=m++,p[R.id]=R)})()).userStep=U.step,O.userChunk=U.chunk,O.userComplete=U.complete,O.userError=U.error,U.step=D(U.step),U.chunk=D(U.chunk),U.complete=D(U.complete),U.error=D(U.error),delete U.worker,O.postMessage({input:V,config:U,workerId:O.id})},_.unparse=function(V,U){var O=!1,R=!0,P=",",j=`\r
292 `,q='"',z=q+q,X=!1,ne=null,he=!1,N=((()=>{if(typeof U=="object"){if(typeof U.delimiter!="string"||_.BAD_DELIMITERS.filter(function(W){return U.delimiter.indexOf(W)!==-1}).length||(P=U.delimiter),typeof U.quotes!="boolean"&&typeof U.quotes!="function"&&!Array.isArray(U.quotes)||(O=U.quotes),typeof U.skipEmptyLines!="boolean"&&typeof U.skipEmptyLines!="string"||(X=U.skipEmptyLines),typeof U.newline=="string"&&(j=U.newline),typeof U.quoteChar=="string"&&(q=U.quoteChar),typeof U.header=="boolean"&&(R=U.header),Array.isArray(U.columns)){if(U.columns.length===0)throw new Error("Option columns is empty");ne=U.columns}U.escapeChar!==void 0&&(z=U.escapeChar+q),U.escapeFormulae instanceof RegExp?he=U.escapeFormulae:typeof U.escapeFormulae=="boolean"&&U.escapeFormulae&&(he=/^[=+\-@\t\r].*$/)}})(),new RegExp(x(q),"g"));if(typeof V=="string"&&(V=JSON.parse(V)),Array.isArray(V)){if(!V.length||Array.isArray(V[0]))return G(null,V,X);if(typeof V[0]=="object")return G(ne||Object.keys(V[0]),V,X)}else if(typeof V=="object")return typeof V.data=="string"&&(V.data=JSON.parse(V.data)),Array.isArray(V.data)&&(V.fields||(V.fields=V.meta&&V.meta.fields||ne),V.fields||(V.fields=Array.isArray(V.data[0])?V.fields:typeof V.data[0]=="object"?Object.keys(V.data[0]):[]),Array.isArray(V.data[0])||typeof V.data[0]=="object"||(V.data=[V.data])),G(V.fields||[],V.data||[],X);throw new Error("Unable to serialize unrecognized input");function G(W,ie,ye){var fe="",ge=(typeof W=="string"&&(W=JSON.parse(W)),typeof ie=="string"&&(ie=JSON.parse(ie)),Array.isArray(W)&&0<W.length),se=!Array.isArray(ie[0]);if(ge&&R){for(var pe=0;pe<W.length;pe++)0<pe&&(fe+=P),fe+=Z(W[pe],pe);0<ie.length&&(fe+=j)}for(var $e=0;$e<ie.length;$e++){var tt=(ge?W:ie[$e]).length,_e=!1,Xe=ge?Object.keys(ie[$e]).length===0:ie[$e].length===0;if(ye&&!ge&&(_e=ye==="greedy"?ie[$e].join("").trim()==="":ie[$e].length===1&&ie[$e][0].length===0),ye==="greedy"&&ge){for(var ht=[],Ye=0;Ye<tt;Ye++){var Se=se?W[Ye]:Ye;ht.push(ie[$e][Se])}_e=ht.join("").trim()===""}if(!_e){for(var Ee=0;Ee<tt;Ee++){0<Ee&&!Xe&&(fe+=P);var Oe=ge&&se?W[Ee]:Ee;fe+=Z(ie[$e][Oe],Ee)}$e<ie.length-1&&(!ye||0<tt&&!Xe)&&(fe+=j)}}return fe}function Z(W,ie){var ye,fe;return W==null?"":W.constructor===Date?JSON.stringify(W).slice(1,25):(fe=!1,he&&typeof W=="string"&&he.test(W)&&(W="'"+W,fe=!0),ye=W.toString().replace(N,z),(fe=fe||O===!0||typeof O=="function"&&O(W,ie)||Array.isArray(O)&&O[ie]||((ge,se)=>{for(var pe=0;pe<se.length;pe++)if(-1<ge.indexOf(se[pe]))return!0;return!1})(ye,_.BAD_DELIMITERS)||-1<ye.indexOf(P)||ye.charAt(0)===" "||ye.charAt(ye.length-1)===" ")?q+ye+q:ye)}},_.RECORD_SEP="",_.UNIT_SEP="",_.BYTE_ORDER_MARK="\uFEFF",_.BAD_DELIMITERS=["\r",`
293 `,'"',_.BYTE_ORDER_MARK],_.WORKERS_SUPPORTED=!i&&!!l.Worker,_.NODE_STREAM_INPUT=1,_.LocalChunkSize=10485760,_.RemoteChunkSize=5242880,_.DefaultDelimiter=",",_.Parser=F,_.ParserHandle=b,_.NetworkStreamer=y,_.FileStreamer=v,_.StringStreamer=w,_.ReadableStreamStreamer=k,l.jQuery&&((s=l.jQuery).fn.parse=function(V){var U=V.config||{},O=[];return this.each(function(j){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 q=0;q<this.files.length;q++)O.push({file:this.files[q],inputElem:this,instanceConfig:s.extend({},U)})}),R(),this;function R(){if(O.length===0)D(V.complete)&&V.complete();else{var j,q,z,X,ne=O[0];if(D(V.before)){var he=V.before(ne.file,ne.inputElem);if(typeof he=="object"){if(he.action==="abort")return j="AbortError",q=ne.file,z=ne.inputElem,X=he.reason,void(D(V.error)&&V.error({name:j},q,z,X));if(he.action==="skip")return void P();typeof he.config=="object"&&(ne.instanceConfig=s.extend(ne.instanceConfig,he.config))}else if(he==="skip")return void P()}var N=ne.instanceConfig.complete;ne.instanceConfig.complete=function(G){D(N)&&N(G,ne.file,ne.inputElem),P()},_.parse(ne.file,ne.instanceConfig)}}function P(){O.splice(0,1),R()}}),c&&(l.onmessage=function(V){V=V.data,_.WORKER_ID===void 0&&V&&(_.WORKER_ID=V.workerId),typeof V.input=="string"?l.postMessage({workerId:_.WORKER_ID,results:_.parse(V.input,V.config),finished:!0}):(l.File&&V.input instanceof File||V.input instanceof Object)&&(V=_.parse(V.input,V.config))&&l.postMessage({workerId:_.WORKER_ID,results:V,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(w.prototype=Object.create(w.prototype)).constructor=w,(k.prototype=Object.create(g.prototype)).constructor=k,_})}(wo)),wo.exports}var D_e=Q_e();const fc=Tf(D_e),V_e={class:"el-upload__text"},T_e={class:"fct-import-map-table-wrap"},M_e={class:"fct-import-map-heading"},L_e={class:"fct-import-map-table"},R_e={width:"50%"},O_e={class:"dialog-footer"},H_e={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=qt().ctx,l=T(!1),s=T(),i=T(),c=T([]),p=T([]),m=T({}),_=T({}),g=T(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const w=T(!1),k=j=>{j&&fc.parse(j,{header:!0,complete:function(q){p.value=q.data,c.value=q.meta.fields,g.value=c.value.includes("Type")&&c.value.includes("Parent"),x(),g.value&&$(),w.value=!0}})},b=()=>{_.value={},c.value=[],p.value=[],w.value=!1,g.value=!1},x=()=>{const j=[],q=[];let z=0;c.value.forEach(X=>{let ne=null,he=null;const N=X.toString();for(const[G,Z]of y.entries())if(N.toLocaleLowerCase().startsWith(Z)){const W=X.toString().match(/ \d+ /g);if(Array.isArray(W)&&W.length===1){let ie=W[0];z=ie>z?ie:z,ne=X.toString().replace(W[0]," %d "),he=X.toString().replace(W[0]," ");break}}ne!=null?j.includes(ne)||(j.push(ne),q.push({title:he,value:ne})):q.push({title:X,value:X})}),_.value=q,v=z},F=()=>window.fluentCartRestVars.rest.url+"/files/upload",M={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"]},$=()=>{for(const[j,q]of Object.entries(M))if(m.value[j]){for(const z of q)if(c.value.includes(z)){m.value[j].value=z;break}}},S=j=>j?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[j.trim().toLowerCase()]||j:"",I=j=>{if(!j)return"";const q=j.split(",").map(z=>z.trim().toLowerCase());return q.includes("variation")?"variation":q.includes("variable")?"variable":q.includes("subscription")?"subscription":q.includes("simple")?"simple":q[0]||""},Q=(j=!0)=>{const q=[],z={},X=m.value,ne={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"},he=G=>{const Z=[];for(let W=1;W<=10;W++){const ie=`Attribute ${W} name`,ye=`Attribute ${W} value(s)`;G[ie]&&G[ye]&&Z.push(G[ye])}return Z.join(" - ")},N=G=>G==="1"||G===1?"published":G==="0"||G===0?"draft":G||"published";p.value.forEach(G=>{var pe,$e,tt,_e,Xe,ht,Ye,Se,Ee,Oe,Me,_t,vt,Lt,Et,Dt,dt,Ut,Ft,It;const Z=I(G.Type);if(Z!=="simple"&&Z!=="variable"&&Z!=="subscription")return;const W={};W._cid=Al(),W.post_title=G[(pe=X.post_title)==null?void 0:pe.value]||"",W.post_name=G[($e=X.post_name)==null?void 0:$e.value]||W.post_title,W.ID=G[(tt=X.post_id)==null?void 0:tt.value]||"",W.post_content=G[(_e=X.post_content)==null?void 0:_e.value]||"",W.post_excerpt=G[(Xe=X.post_excerpt)==null?void 0:Xe.value]||"",W.post_status=N(G[(ht=X.post_status)==null?void 0:ht.value]);const ie={variation_type:Z==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},ye=G[(Ye=X.images)==null?void 0:Ye.value]||"",fe=[];ye&&ye.split(",").map(Qt=>Qt.trim()).filter(Boolean).forEach(Qt=>{const Tt=Qt.split("/").pop().split("?")[0]||"image";fe.push({id:0,url:Qt,title:Tt})}),W.detail=ie,W.gallery=fe,W.variants=[];const ge=G[(Se=X.categories)==null?void 0:Se.value]||"";if(ge?W.categories=ge.split(",").map(Qt=>Qt.trim()).filter(Boolean):W.categories=[],Z==="simple"||Z==="subscription"){const Qt=G[(Ee=X.item_price)==null?void 0:Ee.value]||"",Tt=G[(Oe=X.compare_price)==null?void 0:Oe.value]||"",Wt=G[(Me=X.sku)==null?void 0:Me.value]||"",kt=Z==="subscription"?"subscription":G[(_t=X.payment_type)==null?void 0:_t.value]||"onetime",sa=S(G[(vt=X.repeat_interval)==null?void 0:vt.value]||""),ve=G[(Lt=X.trial_days)==null?void 0:Lt.value]||"",Fe=G[(Et=X.installment)==null?void 0:Et.value]||"",ot=G[(Dt=X.installment_count)==null?void 0:Dt.value]||"",gt=G[(dt=X.manage_setup_fee)==null?void 0:dt.value]||"",Ct=G[(Ut=X.signup_fee_name)==null?void 0:Ut.value]||"",jt=G[(Ft=X.signup_fee)==null?void 0:Ft.value]||"";(Qt||W.post_title)&&W.variants.push({_cid:Al(),variation_title:W.post_title,sku:Wt,item_price:Qt,compare_price:Tt,other_info:{...ne,payment_type:kt,repeat_interval:sa,trial_days:ve,installment:Fe==="yes"?"yes":"no",times:ot,manage_setup_fee:gt==="yes"?"yes":"no",signup_fee_name:Ct,signup_fee:jt},media:[]})}const se=G[(It=X.sku)==null?void 0:It.value]||"";Z==="variable"&&se&&(z[se]=W),q.push(W)}),p.value.forEach(G=>{var Oe,Me,_t,vt,Lt,Et,Dt,dt,Ut,Ft,It,Qt;if(I(G.Type)!=="variation")return;const Z=G.Parent;if(!Z||!z[Z])return;const W=he(G),ie=G[(Oe=X.item_price)==null?void 0:Oe.value]||"",ye=G[(Me=X.compare_price)==null?void 0:Me.value]||"",fe=G[(_t=X.images)==null?void 0:_t.value]||"",ge=[];fe&&fe.split(",").map(Tt=>Tt.trim()).filter(Boolean).forEach(Tt=>{const Wt=Tt.split("/").pop().split("?")[0]||"image";ge.push({id:0,url:Tt,title:Wt})});const se=G[(vt=X.sku)==null?void 0:vt.value]||"",pe=G[(Lt=X.payment_type)==null?void 0:Lt.value]||"onetime",$e=S(G[(Et=X.repeat_interval)==null?void 0:Et.value]||""),tt=G[(Dt=X.trial_days)==null?void 0:Dt.value]||"",_e=G[(dt=X.installment)==null?void 0:dt.value]||"",Xe=G[(Ut=X.installment_count)==null?void 0:Ut.value]||"",ht=G[(Ft=X.manage_setup_fee)==null?void 0:Ft.value]||"",Ye=G[(It=X.signup_fee_name)==null?void 0:It.value]||"",Se=G[(Qt=X.signup_fee)==null?void 0:Qt.value]||"",Ee={_cid:Al(),variation_title:W||G.Name||"",sku:se,item_price:ie,compare_price:ye,other_info:{...ne,payment_type:pe,repeat_interval:$e,trial_days:tt,installment:_e==="yes"?"yes":"no",times:Xe,manage_setup_fee:ht==="yes"?"yes":"no",signup_fee_name:Ye,signup_fee:Se},media:ge};z[Z].variants.push(Ee)}),P("onDataPopulated",{products:q,concat:j})},D=(j=!0)=>{if(g.value)return Q(j);const q=[];p.value.forEach(z=>{var Xe,ht,Ye,Se,Ee,Oe,Me,_t,vt,Lt,Et,Dt;const X={};X._cid=Al();const ne=m.value;X.post_title=z[ne.post_title.value]??"",X.post_name=z[ne.post_name.value]??X.post_title,X.ID=z[ne.post_id.value]??"",X.post_content=z[ne.post_content.value]??"",X.post_excerpt=z[ne.post_excerpt.value]??"",X.post_status=z[(Xe=ne.post_status)==null?void 0:Xe.value]||"published",X.comment_status="close";const he=z[(ht=ne.images)==null?void 0:ht.value]||"",N=[];he&&he.split(",").map(dt=>dt.trim()).filter(Boolean).forEach(dt=>{const Ut=dt.split("/").pop().split("?")[0]||"image";N.push({id:0,url:dt,title:Ut})});const G=z[(Ye=ne.categories)==null?void 0:Ye.value]||"";G?X.categories=G.split(",").map(dt=>dt.trim()).filter(Boolean):X.categories=[];const Z=z[(Se=ne.sku)==null?void 0:Se.value]||"",W=z[(Ee=ne.payment_type)==null?void 0:Ee.value]||"onetime",ie=z[(Oe=ne.repeat_interval)==null?void 0:Oe.value]||"",ye=z[(Me=ne.trial_days)==null?void 0:Me.value]||"",fe=z[(_t=ne.installment)==null?void 0:_t.value]||"",ge=z[(vt=ne.installment_count)==null?void 0:vt.value]||"",se=z[(Lt=ne.manage_setup_fee)==null?void 0:Lt.value]||"",pe=z[(Et=ne.signup_fee_name)==null?void 0:Et.value]||"",$e=z[(Dt=ne.signup_fee)==null?void 0:Dt.value]||"",tt={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},_e={description:"",payment_type:W,times:ge,repeat_interval:ie,trial_days:ye,billing_summary:"",manage_setup_fee:se==="yes"?"yes":"no",signup_fee_name:pe,signup_fee:$e,setup_fee_per_item:"no",installment:fe==="yes"?"yes":"no"};X.gallery=N,X.variants=[];for(let dt=1;dt<=v;dt++){const Ut={};["variation_title","item_price","compare_price"].forEach(Ft=>{var Qt;const It=((Qt=ne[Ft])==null?void 0:Qt.value)??"";if(It.length>0){const Tt=It.replace("%d",dt.toString());Ut[Ft]=z[Tt]}}),O(Ut)&&(Ut._cid=Al(),Ut.sku=Z,Ut.other_info={..._e},Ut.media=[],X.variants.push(Ut))}X.variants.length>0?(tt.variation_type="simple_variations",X.detail=tt,q.push(X)):O(X)&&(X.variants.push({_cid:Al(),variation_title:"",sku:Z,item_price:0,compare_price:0,other_info:{..._e},media:[]}),X.detail=tt,q.push(X))}),P("onDataPopulated",{products:q,concat:j})},V=()=>{l.value=!1,s.value=[],i.value=null,b()},U=(j=!0)=>{D(j),V()},O=j=>{let q=!1;for(const[z,X]of Object.entries(j))if(typeof X!==null&&typeof X<"u"&&(Array.isArray(X)&&X.length>0||X.toString().length>0)){q=!0;break}return q};Ie(()=>{m.value={post_id:{title:a.$t("Post ID"),value:""},post_title:{title:a.$t("Post Title"),value:""},post_name:{title:a.$t("Post Name"),value:""},post_content:{title:a.$t("Post Content"),value:""},post_excerpt:{title:a.$t("Post Excerpt"),value:""},post_status:{title:a.$t("Post Status"),value:""},post_date:{title:a.$t("Post Date"),value:""},comment_status:{title:a.$t("Comment Status"),value:""},images:{title:a.$t("Images"),value:""},variation_title:{title:a.$t("Variation Title"),value:""},item_price:{title:a.$t("Variation Price"),value:""},compare_price:{title:a.$t("Variation Compare Price"),value:""},sku:{title:a.$t("SKU"),value:""},categories:{title:a.$t("Categories"),value:""},payment_type:{title:a.$t("Payment Type"),value:""},repeat_interval:{title:a.$t("Subscription Interval"),value:""},trial_days:{title:a.$t("Trial Days"),value:""},installment:{title:a.$t("Installment"),value:""},installment_count:{title:a.$t("Installment Count"),value:""},manage_setup_fee:{title:a.$t("Setup Fee"),value:""},signup_fee_name:{title:a.$t("Setup Fee Name"),value:""},signup_fee:{title:a.$t("Setup Fee Amount"),value:""}}});const R=()=>{const j=[{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":""}],q=fc.unparse(j),z=new Blob([q],{type:"text/csv;charset=utf-8;"}),X=URL.createObjectURL(z),ne=document.createElement("a");ne.href=X,ne.download="fluent-cart-sample-import.csv",document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(X)},P=t;return(j,q)=>{const z=C("el-button"),X=C("el-upload"),ne=C("el-option"),he=C("el-select"),N=C("el-dialog");return r(),h(H,null,[n(z,{onClick:q[0]||(q[0]=G=>l.value=!0)},{default:d(()=>[L(f(j.$t("Import")),1)]),_:1}),n(N,{modelValue:l.value,"onUpdate:modelValue":q[4]||(q[4]=G=>l.value=G),"append-to-body":!0,title:j.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:d(()=>[w.value?B("",!0):(r(),E(X,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":q[1]||(q[1]=G=>s.value=G),drag:"",action:F(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":G=>{b(),i.value=G,k(G==null?void 0:G.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",V_e,[L(f(j.$t("Drag & Drop or"))+" ",1),o("em",null,f(j.$t("Browse/Upload")),1),L(" "+f(j.$t("Files"))+" ",1),o("span",null,f(A(u)("Any Format upto %s",A(Ot).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),w.value?B("",!0):(r(),E(z,{key:1,onClick:R,link:""},{default:d(()=>[n(J,{name:"Download"}),L(" "+f(j.$t("Download a Sample CSV File")),1)]),_:1})),w.value?(r(),h(H,{key:2},[o("div",T_e,[o("h4",M_e,f(j.$t("Map Columns")),1),o("table",L_e,[o("thead",null,[o("tr",null,[o("th",null,f(j.$t("Products Fields")),1),o("th",null,f(j.$t("CSV Headers")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(m.value,(G,Z)=>(r(),h("tr",null,[o("td",null,f(G.title),1),o("td",R_e,[n(he,{modelValue:G.value,"onUpdate:modelValue":W=>G.value=W,filterable:"",clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,W=>(r(),E(ne,{key:W.value,label:W.title,value:W.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",O_e,[n(z,{onClick:q[2]||(q[2]=G=>U())},{default:d(()=>[L(f(j.$t("Add Products")),1)]),_:1}),n(z,{onClick:q[3]||(q[3]=G=>U(!1))},{default:d(()=>[L(f(j.$t("Clear and Add Products")),1)]),_:1})])],64)):B("",!0)]),_:1},8,["modelValue","title"])],64)}}};class P_e extends xd{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){Y.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 m of l){const _=m.map(g=>g._cid);for(const g of _)this.data.savingIds.add(g);this.data.savingIds=new Set(this.data.savingIds);try{const g=await ue.post("products/bulk-insert",{products:m});if(g.created&&g.created.length){this.data.saveProgress.createdIds.push(...g.created);for(const y of g.created){this.data.savedIds.add(y._cid);const v=t.find(w=>w._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 w of _)this.data.productErrors.set(w,{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?Y.success(`${c.length} product(s) created successfully`):c.length>0?Y.info(`${c.length} product(s) created, ${p.length} error(s)`):Y.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";Y.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 xt=P_e.init(),N_e={class:"max-w-full overflow-x-scroll"},K_e={class:"relative"},G_e={key:0,class:"bulk-checkbox-cell"},j_e=["onMousedown","onTouchstart"],zp={__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=Cf(),s=zr("table"),i=T(null);let c=null;Ie(()=>{Be(()=>{const g=s.value.querySelectorAll("th"),y=l["header-first"]?1:0;Array.from(g).forEach((v,w)=>{const k=w-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,m=K(()=>{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,w=p.columns[y].width,k=p.columns[y].minWidth||50;i.value=y;const b=F=>{const M=w+(F.clientX-v);M>=k&&(p.columns[y].width=M)},x=()=>{i.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",x),a("resize-end")};document.addEventListener("mousemove",b),document.addEventListener("mouseup",x)};return(g,y)=>(r(),h("div",N_e,[o("div",{class:re(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[o("div",K_e,[o("table",{id:"tb",ref_key:"table",ref:s,style:ra({tableLayout:"fixed",width:m.value+"px"})},[o("thead",null,[o("tr",null,[g.$slots["header-first"]?(r(),h("th",G_e,[Ba(g.$slots,"header-first")])):B("",!0),(r(!0),h(H,null,ae(e.columns,(v,w)=>(r(),h("th",{class:re({"sticky-col":w===0,"sticky-col sticky-col-right":w===e.columns.length-1&&e.stickyLast}),style:ra({width:v.width+"px",zIndex:w===0||w===e.columns.length-1&&e.stickyLast?70:e.columns.length-w+50,left:w===0&&g.$slots["header-first"]?"40px":w===0?"0px":void 0}),key:v.key||w},[w===e.columns.length-1?Ba(g.$slots,"header-last",{key:0},()=>[L(f(v.title),1)]):(r(),h(H,{key:1},[L(f(v.title),1)],64)),w<e.columns.length-1?(r(),h("span",{key:2,class:re(["resizer",{"is-active":i.value===w}]),onMousedown:k=>_(k,w),onTouchstart:k=>_(k,w)},null,42,j_e)):B("",!0)],6))),128))])]),o("tbody",null,[Ba(g.$slots,"default")])],4)])],34)]))}},z_e={class:"bulk-setup-fee-badge"},q_e={key:1,class:"text-gray-300 text-sm flex justify-center"},No={__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 p;const i=C("el-tooltip"),c=C("el-input");return e.variant?(r(),E(c,{key:0,size:"small",class:re({"is-error":e.hasError}),modelValue:e.variant.item_price,"onUpdate:modelValue":s[0]||(s[0]=m=>e.variant.item_price=m),placeholder:l.$t("Price"),type:"number",disabled:e.disabled,onInput:s[1]||(s[1]=m=>a("change"))},la({_:2},[((p=e.variant.other_info)==null?void 0:p.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"))+": "+l.currencySign()+e.variant.other_info.signup_fee,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o("span",z_e,"+ "+f(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["class","modelValue","placeholder","disabled"])):(r(),h("span",q_e,"—"))}}},Y_e=["disabled"],W_e={key:0,class:"fct-bulk-sub-count"},X_e={class:"fct-bulk-sub-popover-body"},J_e={class:"fct-bulk-sub-popover-title"},Z_e={class:"fct-bulk-sub-section"},eve={class:"fct-bulk-sub-row"},tve={class:"fct-bulk-sub-row"},ave={class:"fct-bulk-sub-label"},lve={class:"fct-bulk-sub-row"},sve={class:"fct-bulk-sub-label"},nve=["innerHTML"],ove={class:"fct-bulk-sub-section"},ive={class:"fct-bulk-sub-row"},rve={class:"fct-bulk-sub-row"},dve={class:"fct-bulk-sub-label"},uve={class:"fct-bulk-sub-row"},cve={class:"fct-bulk-sub-label"},Ave=["innerHTML"],pve={class:"fct-bulk-sub-footer"},Zi=2,fve={__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=qt().ctx,i=je.get(),c=je.get("app_config.isProActive"),p=T(!1),m=K(()=>{var S;return((S=i==null?void 0:i.shop)==null?void 0:S.currency_sign)||"$"}),_=K(()=>{var S;return((S=a.variant)==null?void 0:S.other_info)||{}}),g=K(()=>_.value.payment_type==="subscription"),y=K(()=>_.value.installment==="yes"),v=K(()=>Number(_.value.times)||1),w=K(()=>{var I;const S=Number((I=a.variant)==null?void 0:I.item_price)||0;return y.value?S*v.value:S}),k=K(()=>{const S=[];if(y.value&&S.push(s.$t("Installment")+": "+v.value+"x"),_.value.manage_setup_fee==="yes"){const I=_.value.signup_fee_name||s.$t("Setup fee"),Q=_.value.signup_fee||0;S.push(s.$t("Setup fee")+": "+I+" ("+m.value+Q+")")}return S.length>0?S.join(`
294 `):s.$t("Subscription settings")}),b=S=>{S==="no"?a.variant.other_info.times="":x(),l("changed")},x=()=>{const S=Number(a.variant.other_info.times);(!Number.isFinite(S)||S<Zi)&&(a.variant.other_info.times=Zi)},F=S=>{S==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},M=()=>{l("changed")},$=()=>{p.value=!1};return(S,I)=>{const Q=C("el-checkbox"),D=C("el-tooltip"),V=C("el-input"),U=C("el-switch"),O=C("el-button"),R=C("el-popover");return r(),E(D,{content:k.value,placement:"top",disabled:!g.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:d(()=>[n(R,{visible:p.value,"onUpdate:visible":I[6]||(I[6]=P=>p.value=P),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!g.value,"popper-class":"bulk-sub-popover"},{reference:d(()=>[o("button",{class:re(["fc-bulk-sub-icon-btn",{"is-active":g.value,"is-configured":g.value&&(y.value||_.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!g.value,onClick:I[0]||(I[0]=Ne(()=>{},["prevent"]))},[I[7]||(I[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)),y.value?(r(),h("span",W_e,f(v.value),1)):B("",!0)],10,Y_e)]),default:d(()=>[o("div",X_e,[o("h4",J_e,f(S.$t("Subscription Settings")),1),o("div",Z_e,[o("div",eve,[n(Q,{"true-value":"yes","false-value":"no",label:S.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":I[1]||(I[1]=P=>e.variant.other_info.installment=P),disabled:!A(c)||e.disabled,onChange:b},null,8,["label","modelValue","disabled"]),A(c)?B("",!0):(r(),E(D,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[L(f(S.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_.value.installment==="yes"?(r(),h(H,{key:0},[o("div",tve,[o("label",ave,f(S.$t("Installment Count")),1),n(V,{type:"number",min:Zi,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":I[2]||(I[2]=P=>e.variant.other_info.times=P),modelModifiers:{number:!0},placeholder:S.$t("Count"),style:{width:"100px"},onInput:M,onChange:x},null,8,["modelValue","placeholder"])]),o("div",lve,[o("span",sve,f(S.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:m.value+w.value},null,8,nve)])],64)):B("",!0)]),o("div",ove,[o("div",ive,[n(U,{"active-text":S.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":I[3]||(I[3]=P=>e.variant.other_info.manage_setup_fee=P),"active-value":"yes","inactive-value":"no",disabled:!A(c)||e.disabled,size:"small",onChange:F},null,8,["active-text","modelValue","disabled"]),A(c)?B("",!0):(r(),E(D,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[L(f(S.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_.value.manage_setup_fee==="yes"?(r(),h(H,{key:0},[o("div",rve,[o("label",dve,f(S.$t("Label")),1),n(V,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":I[4]||(I[4]=P=>e.variant.other_info.signup_fee_name=P),placeholder:S.$t("e.g. Initial Setup"),onInput:M},null,8,["modelValue","placeholder"])]),o("div",uve,[o("label",cve,f(S.$t("Amount")),1),n(V,{size:"small",type:"number",min:0,modelValue:e.variant.other_info.signup_fee,"onUpdate:modelValue":I[5]||(I[5]=P=>e.variant.other_info.signup_fee=P),modelModifiers:{number:!0},placeholder:S.$t("Amount"),onInput:M},{prefix:d(()=>[o("span",{innerHTML:m.value},null,8,Ave)]),_:1},8,["modelValue","placeholder"])])],64)):B("",!0)]),o("div",pve,[n(O,{size:"small",type:"primary",onClick:$},{default:d(()=>[L(f(S.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},mve={key:0,class:"flex items-center"},hve={key:1,class:"text-gray-300 text-sm flex justify-center"},Ko={__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"),m=C("el-select");return e.variant&&s()?(r(),h("div",mve,[n(m,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.payment_type=_),size:"small",class:re({"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(fve,{variant:e.variant,disabled:e.disabled,onChanged:c[2]||(c[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),h("span",hve,"—"))}}},_ve={key:1,class:"text-gray-300 text-sm flex justify-center"},Go={__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"),m=C("el-select");return e.variant&&s()?(r(),E(m,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.repeat_interval=_),size:"small",class:re({"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",_ve,"—"))}}},vve={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:re(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":c[0]||(c[0]=m=>e.variant.other_info.trial_days=m),placeholder:"0",disabled:e.disabled,onChange:c[1]||(c[1]=m=>l("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),h("span",vve,"—"))}}},gve={key:1,class:"text-gray-300 text-sm flex justify-center"},zo={__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)=>{const i=C("el-input");return e.variant?(r(),E(i,{key:0,size:"small",class:re({"is-error":e.hasError}),modelValue:e.variant.compare_price,"onUpdate:modelValue":s[0]||(s[0]=c=>e.variant.compare_price=c),placeholder:l.$t("Compare price"),disabled:e.disabled,onInput:s[1]||(s[1]=c=>a("change"))},null,8,["class","modelValue","placeholder","disabled"])):(r(),h("span",gve,"—"))}}},qp={__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,m=>(r(),E(c,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},yve=["textContent"],bve={key:1,class:"fct-bulk-editor-placeholder"},qo={__name:"BulkEditorCell",props:{value:{type:String,default:""},placeholder:{type:String,default:""}},emits:["click"],setup(e){return(t,a)=>(r(),h("div",{class:"fct-bulk-editor",onClick:a[0]||(a[0]=l=>t.$emit("click"))},[e.value?(r(),h("span",{key:0,class:"bulk-editor-preview",textContent:f(e.value)},null,8,yve)):(r(),h("span",bve,f(e.placeholder),1))]))}};function Yp(){const e=T(new Set),t=T(null),a=T(!1),l=(y,v,w)=>{if(v.shiftKey&&t.value!==null){const b=w.indexOf(t.value),x=w.indexOf(y);if(b!==-1&&x!==-1){const F=Math.min(b,x),M=Math.max(b,x),$=new Set(e.value);for(let S=F;S<=M;S++)$.add(w[S]);e.value=$}}else{const b=new Set(e.value);b.has(y)?b.delete(y):b.add(y),e.value=b,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 m=y=>e.value.has(y),_=K(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:l,toggleSelectAll:s,selectAll:i,deselectAll:c,toggleLinkMode:p,isSelected:m,selectedCount:_,pruneStaleKeys:y=>{const v=new Set(y);let w=!1;const k=new Set;for(const b of e.value)v.has(b)?k.add(b):w=!0;w&&(e.value=k),t.value&&!v.has(t.value)&&(t.value=null)}}}const wve={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},Wp={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]}}},Cve={...Wp,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}}},kve={...Wp,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 Xp(e,t,a,l,s,i,c){const p=c[e];if(p)for(const m of l){if(m===a)continue;const _=s(m);if(!_)continue;const g=p[_.type];g&&(g.set(_.data,t),i&&i(_.product))}}const Bve={class:"fct-bulk-insert-page fct-layout-width"},xve={class:"fct-btn-group sm justify-end"},Sve={class:"filter-popover-item"},Fve={class:"filter-popover-title"},$ve={key:0,"aria-hidden":"true"},Eve=["colspan"],Uve=["onClick"],Ive=["onClick"],Qve={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Dve={class:"flex items-center"},Vve=["onClick","title"],Tve={key:0,class:"bulk-collapse-count"},Mve=["title"],Lve=["title"],Rve={class:"bulk-status-icon is-error"},Ove={key:0,class:"fct-bulk-sku-cell"},Hve={key:1,class:"text-gray-300 text-sm flex justify-center"},Pve={key:1,class:"fct-bulk-media-cell"},Nve={key:2,class:"fct-bulk-categories-cell"},Kve={key:3,class:"fct-bulk-desc-cell"},Gve={key:4,class:"fct-bulk-short-desc-cell"},jve={key:5,class:"fct-bulk-status-cell"},zve={key:6,class:"fct-bulk-product-type-cell"},qve={key:7,class:"fct-bulk-product-type-cell"},Yve={key:8,class:"fct-bulk-pricing-type-cell"},Wve={key:9,class:"fct-bulk-pricing-type-cell"},Xve={key:10,class:"fct-bulk-payment-type-cell"},Jve={key:11,class:"fct-bulk-interval-cell"},Zve={key:12,class:"fct-bulk-trial-days-cell"},ege={key:13,class:"fct-bulk-best-price-cell"},tge={key:14,class:"fct-bulk-compare-price-cell"},age={key:15,class:"fct-bulk-qty-cell !pl-5"},lge={key:16,class:"fct-bulk-stock-cell"},sge={key:1,class:"text-gray-300 text-sm pl-5"},nge={class:"fct-btn-group xs justify-end"},oge=["href","title"],ige={key:0,class:"bulk-variants-block-row"},rge=["colspan"],dge={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},uge=["onClick"],cge={class:"bulk-checkbox-cell"},Age={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},pge={class:"flex items-center gap-1 pl-4"},fge={class:"bulk-status-icon is-error"},mge={key:0,class:"fct-bulk-sku-cell"},hge={key:1,class:"fct-bulk-media-cell"},_ge={key:2},vge={key:3},gge={key:4},yge={key:5},bge={key:6},wge={key:7},Cge={key:8},kge={key:9},Bge={key:10},xge={key:11},Sge={key:12},Fge={key:13,class:"text-center"},$ge={key:14},Ege={key:1,class:"text-gray-300 text-sm flex justify-center"},Uge={class:"fct-btn-group sm justify-end"},Ige={class:"bulk-add-variant-row"},Qge=["colspan"],Dge={class:"sticky left-0 inline-block pl-6"},Vge={key:1,"aria-hidden":"true"},Tge=["colspan"],er=43,Mge=10,Lge=800,mc=100,Rge={__name:"BulkInsert",setup(e){const{options:t,products:a}=xt.data,l=ve=>{var Fe;return((Fe=ve==null?void 0:ve.detail)==null?void 0:Fe.variation_type)==="simple"},s=K(()=>xt.data.saving),i=K(()=>xt.data.saveProgress),c=K(()=>{const ve=xt.data.saveProgress;return ve.total?Math.round(ve.completed/ve.total*100):0}),p=()=>{xt.saveProducts()},m=ve=>xt.isSaving(ve._cid),_=ve=>xt.isSaved(ve._cid),g=ve=>xt.isRowDisabled(ve._cid),y=ve=>xt.hasError(ve._cid),v=ve=>xt.getError(ve._cid),w=ve=>xt.hasProductLevelError(ve._cid),k=(ve,Fe)=>xt.hasVariantError(ve._cid,Fe),b=(ve,Fe)=>xt.getVariantError(ve._cid,Fe),x=(ve,Fe)=>xt.hasFieldError(ve._cid,Fe),F=(ve,Fe,ot)=>xt.hasVariantFieldError(ve._cid,Fe,ot),M=async ve=>{const Fe=ve.post_title||P.$t("Untitled product"),ot=Array.isArray(ve.variants)?ve.variants.length:0,gt=xt.isSaved(ve._cid);let Ct=ot>0?P.$t('This will remove "%s" and its %s variant(s).').replace("%s",Fe).replace("%s",ot):P.$t('This will remove "%s".').replace("%s",Fe);gt&&(Ct+=" "+P.$t("This product was already saved and will be permanently deleted."));try{await Xa.confirm(Ct,P.$t("Remove Product"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}await xt.removeProduct(ve)},$=(ve,Fe)=>{const ot=Fe.variation_title||P.$t("Untitled variant");Xa.confirm(P.$t('This will remove the variant "%s".').replace("%s",ot),P.$t("Remove Variant"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),confirmButtonClass:"el-button--small",cancelButtonClass:"el-button--small",type:"warning"}).then(()=>{xt.removeVariant(ve,Fe)}).catch(()=>{})},S=ve=>xt.duplicateProduct(ve),I=(ve,Fe)=>xt.duplicateVariant(ve,Fe),Q=()=>{const ve=[];for(const Fe of a){const ot=`p:${Fe._cid}`,gt=G.value.has(ot),Ct=[];Fe.variants&&Fe.variants.forEach((jt,yt)=>{G.value.has(`v:${Fe._cid}:${yt}`)&&Ct.push(yt)}),!(!gt&&Ct.length===0)&&(gt&&Ct.length===0?ve.push({product:Fe,type:"full"}):!gt&&Ct.length>0?ve.push({product:Fe,type:"variants-only",variantIndexes:Ct}):ve.push({product:Fe,type:"partial",variantIndexes:Ct}))}return ve},D=()=>{const ve=Q();if(!ve.length)return;const Fe=ve.filter(yt=>yt.type==="full").length,ot=ve.filter(yt=>yt.type==="partial").length,Ct=ve.filter(yt=>yt.type==="variants-only").reduce((yt,ca)=>yt+ca.variantIndexes.length,0),jt=[];Fe>0&&jt.push(`${Fe} product(s) with all variants`),ot>0&&jt.push(`${ot} product(s) with selected variants`),Ct>0&&jt.push(`${Ct} variant(s)`),Xa.confirm(P.$t("Duplicate %s?").replace("%s",jt.join(", ")),P.$t("Bulk Duplicate"),{confirmButtonText:P.$t("Duplicate"),cancelButtonText:P.$t("Cancel"),type:"info"}).then(()=>{for(const yt of ve)if(yt.type==="full")xt.duplicateProduct(yt.product);else if(yt.type==="variants-only")for(const ca of yt.variantIndexes){const ta=yt.product.variants[ca];ta&&xt.duplicateVariant(yt.product,ta)}else yt.type==="partial"&&xt.duplicateProductWithVariants(yt.product,yt.variantIndexes);ye()}).catch(()=>{})},V=async()=>{const ve=[],Fe=[];for(const yt of a){const ca=`p:${yt._cid}`;if(G.value.has(ca)){ve.push(yt);continue}const Ht=[];yt.variants&&yt.variants.forEach((na,Za)=>{G.value.has(`v:${yt._cid}:${Za}`)&&Ht.push(na)}),Ht.length>0&&Fe.push({product:yt,variants:Ht})}if(!ve.length&&!Fe.length)return;const ot=ve.filter(yt=>xt.isSaved(yt._cid)).length,gt=Fe.reduce((yt,ca)=>yt+ca.variants.length,0),Ct=[];ve.length>0&&Ct.push(`${ve.length} product(s)`),gt>0&&Ct.push(`${gt} variant(s)`);let jt=P.$t("Remove %s?").replace("%s",Ct.join(" and "));ot>0&&(jt+=" "+P.$t("%s already saved will be permanently deleted.").replace("%s",`${ot}`));try{await Xa.confirm(jt,P.$t("Bulk Remove"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}for(const yt of ve)await xt.removeProduct(yt);for(const{product:yt,variants:ca}of Fe)for(const ta of ca)xt.removeVariant(yt,ta);ye()},U=ve=>{xt.resetPaymentTypeDefaults(ve)},O=(ve,Fe)=>{const ot=xt.data.categoryOptions;for(const gt of Fe)ot.find(Ct=>Ct.value===gt)||ot.push({label:gt,value:gt})},R=()=>{xt.populateDummyProduct()},P=qt().ctx,j=ve=>{const Fe=xt.data.products;ve.concat||(Fe.splice(0,Fe.length),xt.data.savedIds=new Set,xt.data.savingIds=new Set,xt.data.productErrors=new Map),Fe.push(...ve.products)},q=T({visible:!1,field:"",product:null,value:""}),z=(ve,Fe)=>{q.value={visible:!0,field:Fe,product:ve,value:ve[Fe]||""}},X=ve=>{q.value.value=ve},ne=()=>{const{product:ve,field:Fe,value:ot}=q.value;ve&&(ve[Fe]=ot),q.value.visible=!1},he=K(()=>q.value.field==="post_content"?P.$t("Edit Description"):P.$t("Edit Short Description")),N=T(!0),{selectedKeys:G,handleRowClick:Z,toggleSelectAll:W,selectAll:ie,deselectAll:ye,isSelected:fe,selectedCount:ge,isLinkMode:se,toggleLinkMode:pe}=Yp(),$e=K(()=>{const ve=[];for(const Fe of dt.value)if(ve.push(`p:${Fe.productId}`),Fe.hasVariants&&!Fe.collapsed)for(let ot=0;ot<Fe.product.variants.length;ot++)ve.push(`v:${Fe.productId}:${ot}`);return ve}),tt=ve=>{var Fe;if(ve.startsWith("p:")){const ot=ve.slice(2),gt=a.find(Ct=>Ct._cid===ot);return gt?{type:"product",data:gt,product:gt}:null}else if(ve.startsWith("v:")){const ot=ve.split(":"),gt=ot[1],Ct=parseInt(ot[2]),jt=a.find(yt=>yt._cid===gt);if(jt&&((Fe=jt.variants)!=null&&Fe[Ct]))return{type:"variant",data:jt.variants[Ct],product:jt}}return null},_e=(ve,Fe,ot)=>{!se.value||!fe(ot)||Xp(ve,Fe,ot,G.value,tt,null,Cve)},Xe=T(!1),ht=ve=>{ve.key==="Shift"&&(Xe.value=!0)},Ye=ve=>{ve.key==="Shift"&&(Xe.value=!1)},Se=(ve,Fe)=>{if(!Fe.shiftKey||Fe.target.closest(".bulk-checkbox-cell"))return;Fe.preventDefault();const ot=new Set(G.value);ot.has(ve)?ot.delete(ve):ot.add(ve),G.value=ot},Ee=T([]),Oe=K(()=>Ee.value.filter(ve=>ve.key==="title"||ve.key==="actions"?!0:xt.isColumnVisible(ve.key))),Me=ve=>xt.isColumnVisible(ve),_t=()=>{xt.saveColumnWidths(Ee.value)},vt=T(new Set),Lt=ve=>{const Fe=ve._cid;vt.value.has(Fe)?vt.value.delete(Fe):vt.value.add(Fe),vt.value=new Set(vt.value)},Et=ve=>vt.value.has(ve._cid),Dt=T(0),dt=K(()=>{let ve=0;return a.map(Fe=>{var Ht;const ot=Fe._cid,gt=((Ht=Fe.detail)==null?void 0:Ht.variation_type)!=="simple"&&Array.isArray(Fe.variants),Ct=gt?Fe.variants.length:0,jt=vt.value.has(ot),yt=gt&&!jt?(Ct+1)*er:0,ca=er+yt,ta={product:Fe,productId:ot,hasVariants:gt,variantCount:Ct,collapsed:jt,groupHeight:ca,offset:ve};return ve+=ca,ta})}),Ut=K(()=>{const ve=dt.value;if(ve.length===0)return 0;const Fe=ve[ve.length-1];return Fe.offset+Fe.groupHeight}),Ft=K(()=>{const ve=dt.value,Fe=Dt.value,ot=Fe+Lge,gt=Mge*er;return ve.filter(Ct=>Ct.offset+Ct.groupHeight>=Fe-gt&&Ct.offset<=ot+gt)}),It=K(()=>Ft.value.length===0?0:Ft.value[0].offset),Qt=K(()=>{if(Ft.value.length===0)return 0;const ve=Ft.value[Ft.value.length-1];return Ut.value-ve.offset-ve.groupHeight});let Tt=null,Wt=0;const kt=ve=>{const Fe=ve.target,ot=Date.now();Tt&&clearTimeout(Tt),ot-Wt>=mc?(Dt.value=Fe.scrollTop,Wt=ot):Tt=setTimeout(()=>{Dt.value=Fe.scrollTop,Wt=Date.now(),Tt=null},mc)};let sa=null;return Ie(async()=>{sa=ps(),sa.bind("mod+a",ve=>{var ot,gt;const Fe=(ot=document.activeElement)==null?void 0:ot.tagName;Fe==="INPUT"||Fe==="TEXTAREA"||(gt=document.activeElement)!=null&&gt.isContentEditable||(ve.preventDefault(),ie($e.value))}),sa.bind("escape",()=>{var Fe,ot;const ve=(Fe=document.activeElement)==null?void 0:Fe.tagName;ve==="INPUT"||ve==="TEXTAREA"||(ot=document.activeElement)!=null&&ot.isContentEditable||(se.value?pe():ye())}),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}],xt.restoreColumnWidths(Ee.value),xt.setupColumnVisibility(),xt.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",ht),window.addEventListener("keyup",Ye)}),vl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",ht),window.removeEventListener("keyup",Ye),sa&&sa.reset()}),(ve,Fe)=>{const ot=C("el-button"),gt=C("el-progress"),Ct=C("el-checkbox"),jt=C("el-checkbox-group"),yt=C("el-tooltip"),ca=C("el-popover"),ta=C("el-input"),Ht=C("el-icon"),na=C("el-option"),Za=C("el-select"),Ql=C("el-switch"),Ra=C("el-dialog");return r(),h("div",Bve,[n(sl,{title:ve.$t("Bulk Insert")},{action:d(()=>[n(H_e,{onOnDataPopulated:j}),n(ot,{onClick:R},{default:d(()=>[L(f(ve.$t("Add Product")),1)]),_:1}),n(ot,{type:"primary",onClick:p,loading:s.value,disabled:s.value||A(a).length===0},{default:d(()=>[L(f(s.value?ve.$t("Saving %s/%s...").replace("%s",i.value.completed).replace("%s",i.value.total):ve.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),s.value?(r(),E(gt,{key:0,percentage:c.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):B("",!0),n(xe,null,{default:d(()=>{var aa;return[A(a).length>0?(r(),E(Qe,{key:0,title:((aa=A(a))==null?void 0:aa.length)===1?ve.$t("Product"):ve.$t("Products"),border_bottom:""},{action:d(()=>[o("div",xve,[n(ot,{disabled:A(ge)===0,onClick:V,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)),L(" "+f(ve.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),n(ot,{disabled:A(ge)===0,onClick:D,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)),L(" "+f(ve.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),n(ot,{class:re({"is-active":A(se)}),disabled:A(ge)<2&&!A(se),onClick:A(pe),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)),L(" "+f(A(se)?ve.$t("Unlink"):ve.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),n(Ct,{modelValue:N.value,"onUpdate:modelValue":Fe[0]||(Fe[0]=ee=>N.value=ee),label:ve.$t("Pin Actions")},null,8,["modelValue","label"]),n(ca,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(yt,{effect:"light",content:ve.$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",Sve,[o("h3",Fve,f(ve.$t("Columns")),1),n(jt,{modelValue:A(xt).data.visibleColumns,"onUpdate:modelValue":Fe[1]||(Fe[1]=ee=>A(xt).data.visibleColumns=ee),class:"fct-checkbox-blocks",onChange:Fe[2]||(Fe[2]=ee=>A(xt).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,ae(A(xt).getToggleableColumns(),ee=>(r(),E(Ct,{key:ee.value,value:ee.value,label:ve.$t(ee.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:re(["relative",{"is-link-mode":A(se),"is-shift-held":Xe.value}])},[n(zp,{columns:Oe.value,"sticky-last":N.value,onScroll:kt,onResizeEnd:_t},{"header-first":d(()=>[n(Ct,{"model-value":A(ge)>0&&A(ge)===$e.value.length,indeterminate:A(ge)>0&&A(ge)<$e.value.length,onChange:Fe[3]||(Fe[3]=ee=>A(W)($e.value))},null,8,["model-value","indeterminate"])]),"header-last":d(()=>[L(f(ve.$t("Actions")),1)]),default:d(()=>[It.value>0?(r(),h("tr",$ve,[o("td",{colspan:Oe.value.length+1,style:ra({height:It.value+"px",padding:0,border:"none"})},null,12,Eve)])):B("",!0),(r(!0),h(H,null,ae(Ft.value,ee=>{var we,le,Ae,Ge,lt,Ke,qe,mt,Je,$t,Yt,ce,me,Le,De;return r(),h(H,{key:ee.productId},[o("tr",{class:re(["bulk-product-row",{"is-saving":m(ee.product),"is-saved":_(ee.product),"has-product-error":y(ee.product),"is-selected":A(fe)(`p:${ee.productId}`)}]),onClick:te=>Se(`p:${ee.productId}`,te)},[o("td",{class:"bulk-checkbox-cell",onClick:te=>A(Z)(`p:${ee.productId}`,te,$e.value)},[n(Ct,{"model-value":A(fe)(`p:${ee.productId}`),tabindex:"-1"},null,8,["model-value"])],8,Ive),o("td",Qve,[o("div",Dve,[ee.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(te=>Lt(ee.product),["prevent"]),title:Et(ee.product)?ve.$t("Expand variants"):ve.$t("Collapse variants")},[(r(),h("svg",{class:re(["bulk-collapse-icon",{"is-collapsed":Et(ee.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)),Et(ee.product)?(r(),h("span",Tve,f(ee.variantCount),1)):B("",!0)],8,Vve)):B("",!0),n(ta,{class:re(["fct-bulk-input",{"is-error":x(ee.product,"post_title")}]),modelValue:ee.product.post_title,"onUpdate:modelValue":te=>ee.product.post_title=te,placeholder:ve.$t("Product title"),size:"small",disabled:g(ee.product),onInput:te=>_e("title",te,`p:${ee.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),m(ee.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:ve.$t("Saving...")},[n(Ht,{class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})],8,Mve)):_(ee.product)?(r(),h("span",{key:2,class:"bulk-status-icon is-saved",title:ve.$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,Lve)):w(ee.product)||l(ee.product)&&y(ee.product)?(r(),E(yt,{key:3,content:v(ee.product),placement:"top"},{default:d(()=>[o("span",Rve,[n(Ht,{size:16},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Me("sku")?(r(),h("td",Ove,[((le=(we=ee.product)==null?void 0:we.detail)==null?void 0:le.variation_type)==="simple"&&((Ae=ee.product.variants)!=null&&Ae[0])?(r(),E(ta,{key:0,class:re(["fct-bulk-input",{"is-error":x(ee.product,"variants.0.sku")}]),modelValue:ee.product.variants[0].sku,"onUpdate:modelValue":[te=>ee.product.variants[0].sku=te,te=>_e("sku",te,`p:${ee.productId}`)],placeholder:"SKU",size:"small",disabled:g(ee.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",Hve,"—"))])):B("",!0),Me("media")?(r(),h("td",Pve,[n(hl,{modelValue:ee.product.gallery,"onUpdate:modelValue":te=>ee.product.gallery=te,"show-url-tab":"",disabled:g(ee.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Me("categories")?(r(),h("td",Nve,[n(qp,{modelValue:ee.product.categories,"onUpdate:modelValue":te=>ee.product.categories=te,options:A(xt).data.categoryOptions,disabled:g(ee.product),onChange:te=>{O(ee.product,te),_e("categories",ee.product.categories,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),Me("description")?(r(),h("td",Kve,[n(qo,{value:ee.product.post_content,placeholder:ve.$t("Description"),onClick:te=>z(ee.product,"post_content")},null,8,["value","placeholder","onClick"])])):B("",!0),Me("short_description")?(r(),h("td",Gve,[n(qo,{value:ee.product.post_excerpt,placeholder:ve.$t("Short description"),onClick:te=>z(ee.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):B("",!0),Me("status")?(r(),h("td",jve,[n(Za,{modelValue:ee.product.post_status,"onUpdate:modelValue":te=>ee.product.post_status=te,size:"small",class:re({"is-field-error":x(ee.product,"post_status")}),disabled:g(ee.product),onChange:te=>_e("status",ee.product.post_status,`p:${ee.productId}`)},{default:d(()=>[(r(!0),h(H,null,ae(A(t).status,te=>(r(),E(na,{key:te.value,label:ve.$t(te.title),value:te.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):B("",!0),Me("product_type")&&((Ge=ee.product)!=null&&Ge.detail)?(r(),h("td",zve,[n(Za,{modelValue:ee.product.detail.fulfillment_type,"onUpdate:modelValue":te=>ee.product.detail.fulfillment_type=te,size:"small",class:re({"is-field-error":x(ee.product,"detail.fulfillment_type")}),disabled:g(ee.product),onChange:te=>_e("product_type",ee.product.detail.fulfillment_type,`p:${ee.productId}`)},{default:d(()=>[(r(!0),h(H,null,ae(A(t).fulfilment,te=>(r(),E(na,{key:te.value,label:ve.$t(te.title),value:te.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Me("product_type")?(r(),h("td",qve)):B("",!0),Me("pricing_type")&&((lt=ee.product)!=null&&lt.detail)?(r(),h("td",Yve,[n(Za,{modelValue:ee.product.detail.variation_type,"onUpdate:modelValue":te=>ee.product.detail.variation_type=te,size:"small",class:re({"is-field-error":x(ee.product,"detail.variation_type")}),disabled:g(ee.product),onChange:te=>{A(xt).handleVariationChanged(ee.product,te),_e("pricing_type",te,`p:${ee.productId}`)}},{default:d(()=>[(r(!0),h(H,null,ae(A(t).variation,te=>(r(),E(na,{key:te.value,label:ve.$t(te.title),value:te.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Me("pricing_type")?(r(),h("td",Wve)):B("",!0),Me("payment_type")?(r(),h("td",Xve,[n(Ko,{variant:l(ee.product)?(Ke=ee.product.variants)==null?void 0:Ke[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:te=>{var He;U(te),_e("payment_type",(He=te.other_info)==null?void 0:He.payment_type,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):B("",!0),Me("interval")?(r(),h("td",Jve,[n(Go,{variant:l(ee.product)?(qe=ee.product.variants)==null?void 0:qe[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.other_info.repeat_interval"),onChange:te=>{var He,ut,ke;return _e("interval",(ke=(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.other_info)==null?void 0:ke.repeat_interval,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("trial_days")?(r(),h("td",Zve,[n(jo,{variant:l(ee.product)?(mt=ee.product.variants)==null?void 0:mt[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.other_info.trial_days"),onChange:te=>{var He,ut,ke;return _e("trial_days",(ke=(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.other_info)==null?void 0:ke.trial_days,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("best_price")?(r(),h("td",ege,[n(No,{variant:l(ee.product)?(Je=ee.product.variants)==null?void 0:Je[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.item_price"),onChange:te=>{var He,ut;return _e("price",(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.item_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("compare_price")?(r(),h("td",tge,[n(zo,{variant:l(ee.product)?($t=ee.product.variants)==null?void 0:$t[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.compare_price"),onChange:te=>{var He,ut;return _e("compare_price",(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.compare_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("track_quantity")?(r(),h("td",age,[(Yt=ee.product)!=null&&Yt.detail?(r(),E(Ql,{key:0,modelValue:ee.product.detail.manage_stock,"onUpdate:modelValue":te=>ee.product.detail.manage_stock=te,"active-value":"1","inactive-value":"0",disabled:g(ee.product),onChange:te=>{A(xt).syncStockStatus(ee.product),_e("manage_stock",ee.product.detail.manage_stock,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):B("",!0)])):B("",!0),Me("stock")?(r(),h("td",lge,[((me=(ce=ee.product)==null?void 0:ce.detail)==null?void 0:me.manage_stock)==="1"&&((De=(Le=ee.product)==null?void 0:Le.detail)==null?void 0:De.variation_type)==="simple"?(r(),E(ta,{key:0,modelValue:ee.product.detail.total_stock,"onUpdate:modelValue":[te=>ee.product.detail.total_stock=te,te=>{var He;(He=ee.product.variants)!=null&&He[0]&&(ee.product.variants[0].total_stock=te,ee.product.variants[0].available=te),A(xt).syncStockStatus(ee.product),_e("stock",te,`p:${ee.productId}`)}],disabled:g(ee.product),size:"small",placeholder:ve.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",sge,"—"))])):B("",!0),o("td",{class:re(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":N.value}])},[o("div",nge,[_(ee.product)&&ee.product.view_url?(r(),h("a",{key:0,href:ee.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:ve.$t("View Product")},[n(J,{name:"External"})],8,oge)):B("",!0),n(Ze,{tag:"button",size:"x-small",onClick:Ne(te=>S(ee.product),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(te=>M(ee.product),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Uve),ee.hasVariants?(r(),h("tr",ige,[o("td",{colspan:Oe.value.length+1,class:"!p-0 !border-b-0"},[n(va,{accordion:"",visible:!ee.collapsed,duration:200},{default:d(()=>[o("table",dge,[o("colgroup",null,[Fe[13]||(Fe[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,ae(Oe.value,(te,He)=>(r(),h("col",{key:He,style:ra({width:te.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(H,null,ae(ee.product.variants,(te,He)=>{var ut,ke;return r(),h("tr",{key:He,class:re(["bulk-variation-row",{"is-selected":A(fe)(`v:${ee.productId}:${He}`)}]),onClick:wt=>Se(`v:${ee.productId}:${He}`,wt)},[o("td",cge,[n(Ct,{"model-value":A(fe)(`v:${ee.productId}:${He}`),tabindex:"-1",onChange:wt=>A(Z)(`v:${ee.productId}:${He}`,wt,$e.value)},null,8,["model-value","onChange"])]),o("td",Age,[o("div",pge,[Fe[14]||(Fe[14]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(ta,{size:"small",modelValue:te.variation_title,"onUpdate:modelValue":[wt=>te.variation_title=wt,wt=>_e("title",wt,`v:${ee.productId}:${He}`)],placeholder:ve.$t("Variation title"),disabled:g(ee.product),class:re({"is-error":F(ee.product,He,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),k(ee.product,He)?(r(),E(yt,{key:0,content:b(ee.product,He),placement:"top"},{default:d(()=>[o("span",fge,[n(Ht,{size:14},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Me("sku")?(r(),h("td",mge,[n(ta,{size:"small",modelValue:te.sku,"onUpdate:modelValue":[wt=>te.sku=wt,wt=>_e("sku",wt,`v:${ee.productId}:${He}`)],placeholder:"SKU",disabled:g(ee.product),class:re({"is-error":F(ee.product,He,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):B("",!0),Me("media")?(r(),h("td",hge,[n(hl,{modelValue:te.media,"onUpdate:modelValue":wt=>te.media=wt,"show-url-tab":"",disabled:g(ee.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Me("categories")?(r(),h("td",_ge,Fe[15]||(Fe[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("description")?(r(),h("td",vge,Fe[16]||(Fe[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("short_description")?(r(),h("td",gge,Fe[17]||(Fe[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("status")?(r(),h("td",yge,Fe[18]||(Fe[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("product_type")?(r(),h("td",bge,Fe[19]||(Fe[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("pricing_type")?(r(),h("td",wge,Fe[20]||(Fe[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("payment_type")?(r(),h("td",Cge,[n(Ko,{variant:te,disabled:g(ee.product),"has-error":F(ee.product,He,"other_info.payment_type"),onPaymentTypeChange:wt=>{var ba;U(wt),_e("payment_type",(ba=wt.other_info)==null?void 0:ba.payment_type,`v:${ee.productId}:${He}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):B("",!0),Me("interval")?(r(),h("td",kge,[n(Go,{variant:te,disabled:g(ee.product),"has-error":F(ee.product,He,"other_info.repeat_interval"),onChange:wt=>{var ba;return _e("interval",(ba=te.other_info)==null?void 0:ba.repeat_interval,`v:${ee.productId}:${He}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("trial_days")?(r(),h("td",Bge,[n(jo,{variant:te,disabled:g(ee.product),"has-error":F(ee.product,He,"other_info.trial_days"),onChange:wt=>{var ba;return _e("trial_days",(ba=te.other_info)==null?void 0:ba.trial_days,`v:${ee.productId}:${He}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("best_price")?(r(),h("td",xge,[n(No,{variant:te,disabled:g(ee.product),"has-error":F(ee.product,He,"item_price"),onChange:wt=>_e("price",te.item_price,`v:${ee.productId}:${He}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("compare_price")?(r(),h("td",Sge,[n(zo,{variant:te,disabled:g(ee.product),"has-error":F(ee.product,He,"compare_price"),onChange:wt=>_e("compare_price",te.compare_price,`v:${ee.productId}:${He}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Me("track_quantity")?(r(),h("td",Fge,Fe[21]||(Fe[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Me("stock")?(r(),h("td",$ge,[((ke=(ut=ee.product)==null?void 0:ut.detail)==null?void 0:ke.manage_stock)==="1"?(r(),E(ta,{key:0,class:"fc-bulk-input",size:"small",modelValue:te.total_stock,"onUpdate:modelValue":[wt=>te.total_stock=wt,wt=>{te.available=wt,A(xt).syncStockStatus(ee.product),_e("stock",wt,`v:${ee.productId}:${He}`)}],disabled:g(ee.product),placeholder:ve.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",Ege,"—"))])):B("",!0),o("td",{class:re(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":N.value}])},[o("div",Uge,[n(Ze,{tag:"button",size:"x-small",onClick:Ne(wt=>I(ee.product,te),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(wt=>$(ee.product,te),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,uge)}),128)),o("tr",Ige,[o("td",{colspan:Oe.value.length+1},[o("div",Dge,[n(ot,{size:"small",text:"",type:"primary",onClick:Ne(te=>A(xt).addVariationToProduct(ee.product),["prevent"])},{default:d(()=>[L(" + "+f(ve.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,Qge)])])])]),_:2},1032,["visible"])],8,rge)])):B("",!0)],64)}),128)),Qt.value>0?(r(),h("tr",Vge,[o("td",{colspan:Oe.value.length+1,style:ra({height:Qt.value+"px",padding:0,border:"none"})},null,12,Tge)])):B("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),E(bt,{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:q.value.visible,"onUpdate:modelValue":Fe[6]||(Fe[6]=aa=>q.value.visible=aa),title:he.value,width:"700px","close-on-click-modal":!1,onClosed:Fe[7]||(Fe[7]=aa=>q.value.product=null)},{footer:d(()=>[n(ot,{onClick:Fe[5]||(Fe[5]=aa=>q.value.visible=!1)},{default:d(()=>[L(f(ve.$t("Cancel")),1)]),_:1}),n(ot,{type:"primary",onClick:ne},{default:d(()=>[L(f(ve.$t("Save")),1)]),_:1})]),default:d(()=>[q.value.visible&&q.value.field==="post_content"?(r(),E(Wl,{key:0,"model-value":q.value.value,height:300,onUpdate:X},null,8,["model-value"])):B("",!0),q.value.visible&&q.value.field==="post_excerpt"?(r(),E(ta,{key:1,modelValue:q.value.value,"onUpdate:modelValue":Fe[4]||(Fe[4]=aa=>q.value.value=aa),type:"textarea",rows:6,placeholder:ve.$t("Short description")},null,8,["modelValue","placeholder"])):B("",!0)]),_:1},8,["modelValue","title"])])}}};class Oge extends xd{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,m={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};c&&(m.product_ids=c,m.variant_ids=p),this.data.filterType==="advanced"?(m.advanced_filters=JSON.stringify(this.data.advanceFilters),m.filter_type="advanced"):(this.data.search&&(m.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(m.active_view=this.data.selectedView)),Object.assign(m,t);const _=await ue.get("products/bulk-edit-data",m),g=_.products||[];this._suppressDirty=!0,a?this.data.products.push(...g):(this.data.products=g,this.data.dirty=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map),Be(()=>{this._suppressDirty=!1}),this.data.pagination={page:_.page||m.page,per_page:_.per_page||m.per_page,total:_.total||0,hasMore:_.page*_.per_page<_.total}}catch(c){const p=((i=c==null?void 0:c.data)==null?void 0:i.message)||"Failed to fetch products";Y.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),Y.success(u("Product updated successfully"));else if((s=p.errors)!=null&&s.length){const m=p.errors[0];m!=null&&m.fields&&(this.data.productErrors.set(a,m),this.data.productErrors=new Map(this.data.productErrors)),Y.error((m==null?void 0:m.message)||"Failed to save product")}}catch(p){const m=((i=p==null?void 0:p.data)==null?void 0:i.message)||"Failed to save product",_=(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))}Y.error(m)}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){Y.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 m=p.map(_=>_.ID);for(const _ of m)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 m)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?Y.success(`${i.length} product(s) updated successfully`):i.length>0?Y.info(`${i.length} product(s) updated, ${c.length} error(s)`):Y.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 m=this.data.products.indexOf(t);this.data.products.splice(m+1,0,p[0])}}}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to duplicate product";Y.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 m=(await ue.get("products/bulk-edit-data",{search:c,per_page:1})).products||[];if(!m.length)return;const _=m[0],g=t.variants||[],y=new Set;for(const w of g)a.includes(w.id)&&w.serial_index!=null&&y.add(w.serial_index);_.variants&&y.size>0&&(_.variants=_.variants.filter(w=>y.has(w.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";Y.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";Y.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 Y.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 nt=Oge.init(),Hge={class:"fct-bulk-edit-page fct-layout-width"},Pge={class:"fct-table-wrapper"},Nge={class:"fct-card-header-top"},Kge={class:"fct-card-header-left flex-1"},Gge={class:"fct-card-header-actions"},jge={key:0,class:"fct-advanced-filter-toggle-wrapper"},zge={key:1,class:"fct-btn-group sm hidden md:flex"},qge={key:0,class:"filter-search-wrap"},Yge={class:"search-bar"},Wge={class:"text-xs text-system-light pt-2 dark:text-gray-300"},Xge={class:"fct-bulk-edit-table-wrap"},Jge={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"},Zge={class:"m-0 text-base"},eye={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},tye={class:"fct-btn-group sm justify-end"},aye={class:"filter-popover-item"},lye={class:"filter-popover-title"},sye={class:"fct-bulk-edit-table"},nye={key:0,"aria-hidden":"true"},oye=["colspan"],iye=["onClick"],rye=["onClick"],dye={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},uye={class:"flex items-center"},cye=["onClick","title"],Aye={key:0,class:"bulk-collapse-count"},pye=["title"],fye={class:"bulk-status-icon is-error"},mye=["disabled","onClick","title"],hye={key:0,class:"fct-bulk-media-cell"},_ye={key:1,class:"fct-bulk-sku-cell"},vye={key:1,class:"text-gray-300 text-sm flex justify-center"},gye={key:2,class:"fct-bulk-categories-cell"},yye={key:3,class:"fct-bulk-desc-cell"},bye={key:4,class:"fct-bulk-short-desc-cell"},wye={key:5,class:"fct-bulk-status-cell"},Cye={key:6,class:"fct-bulk-product-type-cell"},kye={class:"bulk-readonly-label"},Bye={key:7,class:"fct-bulk-pricing-type-cell"},xye={class:"bulk-readonly-label"},Sye={key:8,class:"fct-bulk-payment-type-cell"},Fye={key:9,class:"fct-bulk-interval-cell"},$ye={key:10,class:"fct-bulk-trial-days-cell"},Eye={key:11,class:"fct-bulk-best-price-cell"},Uye={key:12,class:"fct-bulk-compare-price-cell"},Iye={key:13,class:"fct-bulk-qty-cell !pl-5"},Qye={key:14,class:"fct-bulk-stock-cell"},Dye={key:1,class:"text-gray-300 text-sm flex justify-center"},Vye={class:"fct-btn-group sm justify-end"},Tye={key:0,class:"bulk-variants-block-row"},Mye=["colspan"],Lye={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Rye=["onClick"],Oye={class:"bulk-checkbox-cell"},Hye={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Pye={class:"flex items-center gap-1 pl-4"},Nye={class:"bulk-status-icon is-error"},Kye={key:0},Gye={key:1},jye={key:2},zye={key:3},qye={key:4},Yye={key:5},Wye={key:6},Xye={key:7},Jye={key:8},Zye={key:9},e1e={key:10},t1e={key:11},a1e={key:12},l1e={key:13,class:"text-center"},s1e={key:14},n1e={key:1,class:"text-gray-300 text-sm flex justify-center"},o1e={class:"fct-btn-group sm justify-end"},i1e={key:1,"aria-hidden":"true"},r1e=["colspan"],d1e={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},u1e={class:"text-system-mid text-sm"},c1e={key:2,class:"flex items-center justify-center py-8"},A1e={class:"text-system-mid text-sm"},p1e={key:1,class:"flex items-center justify-center py-3 border-top"},f1e={class:"text-system-mid text-sm"},tr=43,m1e=10,hc=800,_c=100,h1e=200,_1e={__name:"BulkEdit",setup(e){const t=qt().ctx,a=ll(),{options:l}=nt.data,s=le=>{var Ae;return((Ae=le==null?void 0:le.detail)==null?void 0:Ae.variation_type)==="simple"},i=K(()=>nt.data.products),c=K(()=>nt.data.loading),p=K(()=>nt.data.saving),m=K(()=>nt.data.saveProgress),_=K(()=>nt.data.pagination),g=K(()=>nt.data.dirty),y=K(()=>g.value.size),v=K(()=>Math.max(0,_.value.total-i.value.length)),w=K(()=>Math.min(_.value.per_page,v.value)),k=K(()=>{const le=nt.data.saveProgress;return le.total?Math.round(le.completed/le.total*100):0}),b=zr("search-input"),x=()=>{nt.openSearch(),Be(()=>{var le;(le=b.value)==null||le.focus()})},F=(le=!1)=>{nt.fetchProducts({},le)},M=()=>{nt.saveProducts()},$=le=>{nt.markDirty(le.ID)},S=(le,Ae)=>{nt.resetPaymentTypeDefaults(Ae),$(le)},I=(le,Ae)=>{const Ge=nt.data.categoryOptions;for(const lt of Ae)Ge.find(Ke=>Ke.value===lt)||Ge.push({label:lt,value:lt});$(le)},Q=le=>nt.isDirty(le.ID),D=le=>nt.isSavingProduct(le.ID),V=le=>nt.isSaved(le.ID),U=le=>nt.isRowDisabled(le.ID),O=le=>nt.isDuplicating(le.ID),R=le=>nt.isDeleting(le.ID),P=le=>nt.hasError(le.ID),j=le=>nt.getError(le.ID),q=le=>nt.hasProductLevelError(le.ID),z=(le,Ae)=>nt.hasVariantError(le.ID,Ae),X=(le,Ae)=>nt.getVariantError(le.ID,Ae),ne=(le,Ae)=>nt.hasFieldError(le.ID,Ae),he=(le,Ae,Ge)=>nt.hasVariantFieldError(le.ID,Ae,Ge),N=le=>nt.saveProduct(le),G=le=>nt.duplicateProduct(le),Z=(le,Ae)=>nt.duplicateVariant(le,Ae),W=T(!0),{selectedKeys:ie,handleRowClick:ye,toggleSelectAll:fe,selectAll:ge,deselectAll:se,isSelected:pe,selectedCount:$e,isLinkMode:tt,toggleLinkMode:_e}=Yp(),Xe=K(()=>{const le=[];for(const Ae of Ct.value)if(le.push(`p:${Ae.productId}`),Ae.hasVariants&&!Ae.collapsed)for(const Ge of Ae.product.variants)le.push(`v:${Ge.id}`);return le}),ht=le=>{var Ae;if(le.startsWith("p:")){const Ge=parseInt(le.slice(2)),lt=Ct.value.find(Ke=>Ke.productId===Ge);return lt?{type:"product",data:lt.product,product:lt.product}:null}else if(le.startsWith("v:")){const Ge=parseInt(le.slice(2));for(const lt of Ct.value){const Ke=(Ae=lt.product.variants)==null?void 0:Ae.find(qe=>qe.id===Ge);if(Ke)return{type:"variant",data:Ke,product:lt.product}}}return null},Ye=(le,Ae,Ge)=>{!tt.value||!pe(Ge)||Xp(le,Ae,Ge,ie.value,ht,$,kve)},Se=T(!1),Ee=le=>{le.key==="Shift"&&(Se.value=!0)},Oe=le=>{le.key==="Shift"&&(Se.value=!1)},Me=(le,Ae)=>{if(!Ae.shiftKey||Ae.target.closest(".bulk-checkbox-cell"))return;Ae.preventDefault();const Ge=new Set(ie.value);Ge.has(le)?Ge.delete(le):Ge.add(le),ie.value=Ge},_t=()=>{const le=[];for(const Ae of Ct.value){const Ge=`p:${Ae.productId}`,lt=ie.value.has(Ge),Ke=[];if(Ae.product.variants)for(const qe of Ae.product.variants)ie.value.has(`v:${qe.id}`)&&Ke.push(qe.id);!lt&&Ke.length===0||(lt&&Ke.length===0?le.push({product:Ae.product,type:"full"}):!lt&&Ke.length>0?le.push({product:Ae.product,type:"variants-only",variantIds:Ke}):le.push({product:Ae.product,type:"partial",variantIds:Ke}))}return le},vt=async()=>{const le=_t();if(!le.length)return;const Ae=le.filter(mt=>mt.type==="full").length,Ge=le.filter(mt=>mt.type==="partial").length,Ke=le.filter(mt=>mt.type==="variants-only").reduce((mt,Je)=>mt+Je.variantIds.length,0),qe=[];Ae>0&&qe.push(`${Ae} product(s) with all variants`),Ge>0&&qe.push(`${Ge} product(s) with selected variants`),Ke>0&&qe.push(`${Ke} variant(s)`);try{await Xa.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 mt of le)if(mt.type==="full")await nt.duplicateProduct(mt.product);else if(mt.type==="variants-only")for(const Je of mt.variantIds){const $t=mt.product.variants.find(Yt=>Yt.id===Je);$t&&nt.duplicateVariant(mt.product,$t)}else mt.type==="partial"&&await nt.duplicateProductWithVariants(mt.product,mt.variantIds);se()},Lt=async()=>{const le=[],Ae=[];for(const Ke of Ct.value){const qe=`p:${Ke.productId}`;if(ie.value.has(qe)){le.push(Ke.product);continue}const Je=[];if(Ke.product.variants)for(const $t of Ke.product.variants)ie.value.has(`v:${$t.id}`)&&Je.push($t);Je.length>0&&Ae.push({product:Ke.product,variants:Je})}if(!le.length&&!Ae.length)return;const Ge=Ae.reduce((Ke,qe)=>Ke+qe.variants.length,0),lt=[];le.length>0&&lt.push(`${le.length} product(s)`),Ge>0&&lt.push(`${Ge} variant(s)`);try{await Xa.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",lt.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const Ke of le)await nt.deleteProduct(Ke);for(const{product:Ke,variants:qe}of Ae)for(const mt of qe)nt.removeVariant(Ke,mt);se()},Et=async le=>{const Ae=le.ID;if(!Ae||nt.isDeleting(Ae))return;const Ge=le.post_title||t.$t("Untitled product"),lt=Array.isArray(le.variants)?le.variants.length:0,Ke=lt>0?t.$t('This will permanently delete "%s" and its %s variant(s).').replace("%s",Ge).replace("%s",lt):t.$t('This will permanently delete "%s".').replace("%s",Ge);try{await Xa.confirm(Ke,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}nt.deleteProduct(le)},Dt=(le,Ae)=>{if(le.variants.length<=1){nt.removeVariant(le,Ae);return}const Ge=Ae.variation_title||t.$t("Untitled variant");Xa.confirm(t.$t('This will remove the variant "%s".').replace("%s",Ge),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{nt.removeVariant(le,Ae)}).catch(()=>{})},dt=T({visible:!1,field:"",product:null,value:""}),Ut=(le,Ae)=>{dt.value={visible:!0,field:Ae,product:le,value:le[Ae]||""}},Ft=le=>{dt.value.value=le},It=()=>{const{product:le,field:Ae,value:Ge}=dt.value;le&&(le[Ae]=Ge,$(le)),dt.value.visible=!1},Qt=K(()=>dt.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),Tt=T([]),Wt=K(()=>Tt.value.filter(le=>le.key==="title"||le.key==="actions"?!0:nt.isColumnVisible(le.key))),kt=le=>nt.isColumnVisible(le),sa=()=>{nt.saveColumnWidths(Tt.value)},ve=T(new Set),Fe=le=>{const Ae=le.ID;ve.value.has(Ae)?ve.value.delete(Ae):ve.value.add(Ae),ve.value=new Set(ve.value)},ot=le=>ve.value.has(le.ID),gt=T(0),Ct=K(()=>{let le=0;return i.value.map(Ae=>{var Yt;const Ge=Ae.ID,lt=((Yt=Ae.detail)==null?void 0:Yt.variation_type)!=="simple"&&Array.isArray(Ae.variants)&&Ae.variants.length>0,Ke=lt?Ae.variants.length:0,qe=ve.value.has(Ge),mt=lt&&!qe?Ke*tr:0,Je=tr+mt,$t={product:Ae,productId:Ge,hasVariants:lt,variantCount:Ke,collapsed:qe,groupHeight:Je,offset:le};return le+=Je,$t})}),jt=K(()=>{const le=Ct.value;if(le.length===0)return 0;const Ae=le[le.length-1];return Ae.offset+Ae.groupHeight}),yt=K(()=>{const le=Ct.value,Ae=gt.value,Ge=Ae+hc,lt=m1e*tr;return le.filter(Ke=>Ke.offset+Ke.groupHeight>=Ae-lt&&Ke.offset<=Ge+lt)}),ca=K(()=>yt.value.length===0?0:yt.value[0].offset),ta=K(()=>{if(yt.value.length===0)return 0;const le=yt.value[yt.value.length-1];return jt.value-le.offset-le.groupHeight});let Ht=null,na=0;const Za=()=>{if(c.value||!_.value.hasMore||i.value.length===0)return;jt.value-(gt.value+hc)<h1e&&F(!0)},Ql=le=>{const Ae=le.target,Ge=Date.now();Ht&&clearTimeout(Ht),Ge-na>=_c?(gt.value=Ae.scrollTop,na=Ge,Za()):Ht=setTimeout(()=>{gt.value=Ae.scrollTop,na=Date.now(),Ht=null,Za()},_c)},Ra=le=>({physical:"Physical",digital:"Digital"})[le]||le||"—",aa=le=>({simple:"Simple",simple_variations:"Variable"})[le]||le||"—";let ee=null;const we=()=>{const le=a.query.product_ids,Ae=a.query.variant_ids;le&&Ae?nt.fetchProducts({},!1,le,Ae):F(!1)};return Ie(async()=>{ee=ps(),ee.bind("mod+a",le=>{var Ge,lt;const Ae=(Ge=document.activeElement)==null?void 0:Ge.tagName;Ae==="INPUT"||Ae==="TEXTAREA"||(lt=document.activeElement)!=null&&lt.isContentEditable||(le.preventDefault(),ge(Xe.value))}),ee.bind("escape",()=>{var Ae,Ge;const le=(Ae=document.activeElement)==null?void 0:Ae.tagName;le==="INPUT"||le==="TEXTAREA"||(Ge=document.activeElement)!=null&&Ge.isContentEditable||(tt.value?_e():se())}),Tt.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}],nt.restoreColumnWidths(Tt.value),nt.setupColumnVisibility(),nt.setupSavedViews(),nt.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),ee&&ee.reset()}),(le,Ae)=>{const Ge=C("el-button"),lt=C("el-progress"),Ke=C("el-switch"),qe=C("el-tooltip"),mt=C("el-input"),Je=C("el-checkbox"),$t=C("el-checkbox-group"),Yt=C("el-popover"),ce=C("el-icon"),me=C("el-option"),Le=C("el-select"),De=C("el-dialog");return r(),h("div",Hge,[n(sl,{title:le.$t("Bulk Edit")},{action:d(()=>[n(Ge,{type:"primary",onClick:M,loading:p.value,disabled:p.value||y.value===0},{default:d(()=>[L(f(p.value?le.$t("Saving %s/%s...").replace("%s",m.value.completed).replace("%s",m.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(lt,{key:0,percentage:k.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):B("",!0),o("div",Pge,[n(xe,null,{default:d(()=>[n(Qe,{border_bottom:""},{default:d(()=>[o("div",Nge,[o("div",Kge,[A(nt).getTabsCount()&&!A(nt).isUsingAdvanceFilter()?(r(),E(Sf,{key:0,class:re("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:A(nt)},null,8,["table"])):B("",!0)]),o("div",Gge,[A(nt).isAdvanceFilterEnabled()?(r(),h("div",jge,[n(Ke,{class:"fct-advanced-filter-toggle",onChange:Ae[0]||(Ae[0]=te=>{A(nt).onFilterTypeChanged(te)}),"active-value":"advanced","inactive-value":"simple",modelValue:A(nt).data.filterType,"onUpdate:modelValue":Ae[1]||(Ae[1]=te=>A(nt).data.filterType=te),"active-text":le.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):B("",!0),A(nt).isUsingAdvanceFilter()?B("",!0):(r(),h("div",zge,[A(nt).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(x,["prevent"])},{default:d(()=>[n(J,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),n(Ff,{table:A(nt)},null,8,["table"]),A(nt).isSearching()&&!A(nt).isUsingAdvanceFilter()?(r(),h("div",qge,[o("div",Yge,[n(mt,{ref:"search-input",onClear:Ae[2]||(Ae[2]=()=>{A(nt).search()}),onKeyup:Ae[3]||(Ae[3]=xa(()=>{A(nt).search()},["enter"])),modelValue:A(nt).data.search,"onUpdate:modelValue":Ae[4]||(Ae[4]=te=>A(nt).data.search=te),type:"text",placeholder:le.$t("Search"),clearable:""},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",Wge,f(A(nt).getSearchHint()),1)]),n(Ge,{text:"",onClick:Ae[5]||(Ae[5]=()=>{A(nt).closeSearch()})},{default:d(()=>[L(f(le.$t("Cancel")),1)]),_:1})])):B("",!0)]),_:1}),n(Ce,{class:"p-0"},{default:d(()=>[o("div",Xge,[i.value.length>0?(r(),h("div",Jge,[o("h5",Zge,[L(f(i.value.length)+" "+f(i.value.length===1?le.$t("Product"):le.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),h("span",eye,f(le.$t("of"))+" "+f(_.value.total)+" "+f(le.$t("total"))+" · "+f(w.value)+" "+f(le.$t("next")),1)):B("",!0)]),o("div",tye,[n(Ge,{disabled:A($e)===0,onClick:vt,size:"small"},{default:d(()=>[Ae[14]||(Ae[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)),L(" "+f(le.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),n(Ge,{disabled:A($e)===0,onClick:Lt,size:"small",type:"danger",plain:""},{default:d(()=>[Ae[15]||(Ae[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)),L(" "+f(le.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),n(Ge,{class:re({"is-active":A(tt)}),disabled:A($e)<2&&!A(tt),onClick:A(_e),size:"small"},{default:d(()=>[Ae[16]||(Ae[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)),L(" "+f(A(tt)?le.$t("Unlink"):le.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),n(Je,{modelValue:W.value,"onUpdate:modelValue":Ae[6]||(Ae[6]=te=>W.value=te),label:le.$t("Pin Actions")},null,8,["modelValue","label"]),n(Yt,{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",aye,[o("h3",lye,f(le.$t("Columns")),1),n($t,{modelValue:A(nt).data.visibleColumns,"onUpdate:modelValue":Ae[7]||(Ae[7]=te=>A(nt).data.visibleColumns=te),class:"fct-checkbox-blocks",onChange:Ae[8]||(Ae[8]=te=>A(nt).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,ae(A(nt).getToggleableColumns(),te=>(r(),E(Je,{key:te.value,value:te.value,label:le.$t(te.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):B("",!0),o("div",sye,[i.value.length>0?(r(),h("div",{key:0,class:re(["relative",{"is-link-mode":A(tt),"is-shift-held":Se.value}])},[n(zp,{columns:Wt.value,"sticky-last":W.value,onScroll:Ql,onResizeEnd:sa},{"header-first":d(()=>[Gt(n(Je,{checked:A($e)>0&&A($e)===Xe.value.length,onChange:Ae[9]||(Ae[9]=te=>A(fe)(Xe.value))},null,8,["checked"]),[[A(wve),A($e)>0&&A($e)<Xe.value.length]])]),"header-last":d(()=>[L(f(le.$t("Actions")),1)]),default:d(()=>[ca.value>0?(r(),h("tr",nye,[o("td",{colspan:Wt.value.length+1,style:ra({height:ca.value+"px",padding:0,border:"none"})},null,12,oye)])):B("",!0),(r(!0),h(H,null,ae(yt.value,te=>{var He,ut,ke,wt,ba,de,oe,Ue,Te,Pe,pt,ft,ct,Rt,$a,Kt,ma,Sa;return r(),h(H,{key:te.productId},[o("tr",{class:re(["bulk-product-row",{"is-dirty":Q(te.product),"is-saving":D(te.product),"is-saved":V(te.product),"has-product-error":P(te.product),"is-selected":A(pe)(`p:${te.productId}`)}]),onClick:We=>Me(`p:${te.productId}`,We)},[o("td",{class:"bulk-checkbox-cell",onClick:We=>A(ye)(`p:${te.productId}`,We,Xe.value)},[n(Je,{"model-value":A(pe)(`p:${te.productId}`),tabindex:"-1"},null,8,["model-value"])],8,rye),o("td",dye,[o("div",uye,[te.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(We=>Fe(te.product),["prevent"]),title:ot(te.product)?le.$t("Expand variants"):le.$t("Collapse variants")},[(r(),h("svg",{class:re(["bulk-collapse-icon",{"is-collapsed":ot(te.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},Ae[17]||(Ae[17]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),ot(te.product)?(r(),h("span",Aye,f(te.variantCount),1)):B("",!0)],8,cye)):B("",!0),n(mt,{class:re(["fct-bulk-input",{"is-error":ne(te.product,"post_title")}]),modelValue:te.product.post_title,"onUpdate:modelValue":[We=>te.product.post_title=We,We=>{$(te.product),Ye("title",We,`p:${te.productId}`)}],placeholder:le.$t("Product title"),disabled:U(te.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),D(te.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:le.$t("Saving...")},[n(ce,{class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})],8,pye)):q(te.product)||s(te.product)&&P(te.product)?(r(),E(qe,{key:2,content:j(te.product),placement:"top"},{default:d(()=>[o("span",fye,[n(ce,{size:16},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):Q(te.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:U(te.product),onClick:Ne(We=>N(te.product),["prevent"]),title:le.$t("Save")},Ae[18]||(Ae[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,mye)):B("",!0)])]),kt("image")?(r(),h("td",hye,[n(hl,{modelValue:te.product.gallery,"onUpdate:modelValue":We=>te.product.gallery=We,onChange:We=>$(te.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):B("",!0),kt("sku")?(r(),h("td",_ye,[((ut=(He=te.product)==null?void 0:He.detail)==null?void 0:ut.variation_type)==="simple"&&((ke=te.product.variants)!=null&&ke[0])?(r(),E(mt,{key:0,class:re(["fct-bulk-input",{"is-error":ne(te.product,"variants.0.sku")}]),modelValue:te.product.variants[0].sku,"onUpdate:modelValue":[We=>te.product.variants[0].sku=We,We=>{$(te.product),Ye("sku",We,`p:${te.productId}`)}],placeholder:"SKU",size:"small",disabled:U(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),h("span",vye,"—"))])):B("",!0),kt("categories")?(r(),h("td",gye,[n(qp,{modelValue:te.product.categories,"onUpdate:modelValue":We=>te.product.categories=We,options:A(nt).data.categoryOptions,disabled:U(te.product),onChange:We=>{I(te.product,We),Ye("categories",te.product.categories,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),kt("description")?(r(),h("td",yye,[n(qo,{value:te.product.post_content,placeholder:le.$t("Description"),onClick:We=>Ut(te.product,"post_content")},null,8,["value","placeholder","onClick"])])):B("",!0),kt("short_description")?(r(),h("td",bye,[n(qo,{value:te.product.post_excerpt,placeholder:le.$t("Short description"),onClick:We=>Ut(te.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):B("",!0),kt("status")?(r(),h("td",wye,[n(Le,{modelValue:te.product.post_status,"onUpdate:modelValue":We=>te.product.post_status=We,size:"small",class:re({"is-field-error":ne(te.product,"post_status")}),disabled:U(te.product),onChange:We=>{$(te.product),Ye("status",te.product.post_status,`p:${te.productId}`)}},{default:d(()=>[n(me,{label:le.$t("Published"),value:"publish"},null,8,["label"]),n(me,{label:le.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):B("",!0),kt("product_type")?(r(),h("td",Cye,[o("span",kye,f(Ra((ba=(wt=te.product)==null?void 0:wt.detail)==null?void 0:ba.fulfillment_type)),1)])):B("",!0),kt("pricing_type")?(r(),h("td",Bye,[o("span",xye,f(aa((oe=(de=te.product)==null?void 0:de.detail)==null?void 0:oe.variation_type)),1)])):B("",!0),kt("payment_type")?(r(),h("td",Sye,[n(Ko,{variant:s(te.product)?(Ue=te.product.variants)==null?void 0:Ue[0]:null,disabled:U(te.product),"has-error":ne(te.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:We=>{var Xt;S(te.product,We),Ye("payment_type",(Xt=We.other_info)==null?void 0:Xt.payment_type,`p:${te.productId}`)},onChange:We=>$(te.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):B("",!0),kt("interval")?(r(),h("td",Fye,[n(Go,{variant:s(te.product)?(Te=te.product.variants)==null?void 0:Te[0]:null,disabled:U(te.product),"has-error":ne(te.product,"variants.0.other_info.repeat_interval"),onChange:We=>{var Xt,Ka,ze;$(te.product),Ye("interval",(ze=(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.other_info)==null?void 0:ze.repeat_interval,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("trial_days")?(r(),h("td",$ye,[n(jo,{variant:s(te.product)?(Pe=te.product.variants)==null?void 0:Pe[0]:null,disabled:U(te.product),"has-error":ne(te.product,"variants.0.other_info.trial_days"),onChange:We=>{var Xt,Ka,ze;$(te.product),Ye("trial_days",(ze=(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.other_info)==null?void 0:ze.trial_days,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("best_price")?(r(),h("td",Eye,[n(No,{variant:s(te.product)?(pt=te.product.variants)==null?void 0:pt[0]:null,disabled:U(te.product),"has-error":ne(te.product,"variants.0.item_price"),onChange:We=>{var Xt,Ka;$(te.product),Ye("price",(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.item_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("compare_price")?(r(),h("td",Uye,[n(zo,{variant:s(te.product)?(ft=te.product.variants)==null?void 0:ft[0]:null,disabled:U(te.product),"has-error":ne(te.product,"variants.0.compare_price"),onChange:We=>{var Xt,Ka;$(te.product),Ye("compare_price",(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.compare_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("track_quantity")?(r(),h("td",Iye,[(ct=te.product)!=null&&ct.detail?(r(),E(Ke,{key:0,modelValue:te.product.detail.manage_stock,"onUpdate:modelValue":We=>te.product.detail.manage_stock=We,"active-value":1,"inactive-value":0,disabled:U(te.product),onChange:We=>{$(te.product),A(nt).syncStockStatus(te.product),Ye("manage_stock",te.product.detail.manage_stock,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):B("",!0)])):B("",!0),kt("stock")?(r(),h("td",Qye,[($a=(Rt=te.product)==null?void 0:Rt.detail)!=null&&$a.manage_stock&&((ma=(Kt=te.product)==null?void 0:Kt.detail)==null?void 0:ma.variation_type)==="simple"&&((Sa=te.product.variants)!=null&&Sa[0])?(r(),E(mt,{key:0,class:"fct-bulk-input",placeholder:le.$t("e.g 10"),size:"small",modelValue:te.product.variants[0].available,"onUpdate:modelValue":[We=>te.product.variants[0].available=We,We=>{te.product.variants[0].total_stock=We,$(te.product),A(nt).syncStockStatus(te.product),Ye("stock",We,`p:${te.productId}`)}],disabled:U(te.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",Dye,"—"))])):B("",!0),o("td",{class:re(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":W.value}])},[o("div",Vye,[te.product.view_url?(r(),E(Ze,{key:0,tag:"a",size:"x-small",href:te.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=>G(te.product),["prevent"]),disabled:p.value||U(te.product)||O(te.product),title:le.$t("Duplicate")},{default:d(()=>[O(te.product)?(r(),E(ce,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_: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=>Et(te.product),["prevent"]),disabled:p.value||U(te.product)||R(te.product),title:le.$t("Delete")},{default:d(()=>[R(te.product)?(r(),E(ce,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})):(r(),E(J,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,iye),te.hasVariants?(r(),h("tr",Tye,[o("td",{colspan:Wt.value.length+1,class:"!p-0 !border-b-0"},[n(va,{accordion:"",visible:!te.collapsed,duration:200},{default:d(()=>[o("table",Lye,[o("colgroup",null,[Ae[19]||(Ae[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,ae(Wt.value,(We,Xt)=>(r(),h("col",{key:Xt,style:ra({width:We.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(H,null,ae(te.product.variants,(We,Xt)=>{var Ka,ze;return r(),h("tr",{key:We.id||Xt,class:re(["bulk-variation-row",{"is-selected":A(pe)(`v:${We.id}`)}]),onClick:Mt=>Me(`v:${We.id}`,Mt)},[o("td",Oye,[n(Je,{"model-value":A(pe)(`v:${We.id}`),tabindex:"-1",onChange:Mt=>A(ye)(`v:${We.id}`,Mt,Xe.value)},null,8,["model-value","onChange"])]),o("td",Hye,[o("div",Pye,[Ae[20]||(Ae[20]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(mt,{size:"small",modelValue:We.variation_title,"onUpdate:modelValue":[Mt=>We.variation_title=Mt,Mt=>{$(te.product),Ye("title",Mt,`v:${We.id}`)}],placeholder:le.$t("Variation title"),disabled:U(te.product),class:re({"is-error":he(te.product,Xt,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),z(te.product,Xt)?(r(),E(qe,{key:0,content:X(te.product,Xt),placement:"top"},{default:d(()=>[o("span",Nye,[n(ce,{size:14},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),kt("image")?(r(),h("td",Kye,[n(hl,{modelValue:We.media,"onUpdate:modelValue":Mt=>We.media=Mt,onChange:Mt=>$(te.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):B("",!0),kt("sku")?(r(),h("td",Gye,[n(mt,{class:re(["fct-bulk-input",{"is-error":he(te.product,Xt,"sku")}]),size:"small",modelValue:We.sku,"onUpdate:modelValue":[Mt=>We.sku=Mt,Mt=>{$(te.product),Ye("sku",Mt,`v:${We.id}`)}],placeholder:le.$t("SKU"),disabled:U(te.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):B("",!0),kt("categories")?(r(),h("td",jye,Ae[21]||(Ae[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),kt("description")?(r(),h("td",zye,Ae[22]||(Ae[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),kt("short_description")?(r(),h("td",qye,Ae[23]||(Ae[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),kt("status")?(r(),h("td",Yye,Ae[24]||(Ae[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),kt("product_type")?(r(),h("td",Wye,Ae[25]||(Ae[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),kt("pricing_type")?(r(),h("td",Xye,Ae[26]||(Ae[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),kt("payment_type")?(r(),h("td",Jye,[n(Ko,{variant:We,disabled:U(te.product),"has-error":he(te.product,Xt,"other_info.payment_type"),onPaymentTypeChange:Mt=>{var Zl;S(te.product,Mt),Ye("payment_type",(Zl=Mt.other_info)==null?void 0:Zl.payment_type,`v:${We.id}`)},onChange:Mt=>$(te.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):B("",!0),kt("interval")?(r(),h("td",Zye,[n(Go,{variant:We,disabled:U(te.product),"has-error":he(te.product,Xt,"other_info.repeat_interval"),onChange:Mt=>{var Zl;$(te.product),Ye("interval",(Zl=We.other_info)==null?void 0:Zl.repeat_interval,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("trial_days")?(r(),h("td",e1e,[n(jo,{variant:We,disabled:U(te.product),"has-error":he(te.product,Xt,"other_info.trial_days"),onChange:Mt=>{var Zl;$(te.product),Ye("trial_days",(Zl=We.other_info)==null?void 0:Zl.trial_days,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("best_price")?(r(),h("td",t1e,[n(No,{variant:We,disabled:U(te.product),"has-error":he(te.product,Xt,"item_price"),onChange:Mt=>{$(te.product),Ye("price",We.item_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("compare_price")?(r(),h("td",a1e,[n(zo,{variant:We,disabled:U(te.product),"has-error":he(te.product,Xt,"compare_price"),onChange:Mt=>{$(te.product),Ye("compare_price",We.compare_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),kt("track_quantity")?(r(),h("td",l1e,Ae[27]||(Ae[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),kt("stock")?(r(),h("td",s1e,[(ze=(Ka=te.product)==null?void 0:Ka.detail)!=null&&ze.manage_stock?(r(),E(mt,{key:0,class:"fct-bulk-input",placeholder:le.$t("e.g 10"),size:"small",modelValue:We.available,"onUpdate:modelValue":[Mt=>We.available=Mt,Mt=>{We.total_stock=Mt,$(te.product),A(nt).syncStockStatus(te.product),Ye("stock",Mt,`v:${We.id}`)}],disabled:U(te.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",n1e,"—"))])):B("",!0),o("td",{class:re(["text-center",{"sticky-col sticky-col-right":W.value}])},[o("div",o1e,[n(Ze,{tag:"button",size:"x-small",onClick:Ne(Mt=>Z(te.product,We),["prevent"]),disabled:p.value||U(te.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(Mt=>Dt(te.product,We),["prevent"]),disabled:p.value||U(te.product),title:le.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Rye)}),128))])])]),_:2},1032,["visible"])],8,Mye)])):B("",!0)],64)}),128)),ta.value>0?(r(),h("tr",i1e,[o("td",{colspan:Wt.value.length+1,style:ra({height:ta.value+"px",padding:0,border:"none"})},null,12,r1e)])):B("",!0)]),_:1},8,["columns","sticky-last"])],2)):c.value?c.value?(r(),h("div",c1e,[n(ce,{class:"is-loading mr-2"},{default:d(()=>Ae[28]||(Ae[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",A1e,f(le.$t("Loading products...")),1)])):B("",!0):(r(),h("div",d1e,[o("p",u1e,f(le.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&c.value?(r(),h("div",p1e,[n(ce,{class:"is-loading mr-2"},{default:d(()=>Ae[29]||(Ae[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",f1e,f(le.$t("Loading"))+" "+f(w.value)+" "+f(le.$t("more...")),1)])):B("",!0)])]),_:1})]),_:1})]),n(De,{modelValue:dt.value.visible,"onUpdate:modelValue":Ae[12]||(Ae[12]=te=>dt.value.visible=te),title:Qt.value,width:"700px","close-on-click-modal":!1,onClosed:Ae[13]||(Ae[13]=te=>dt.value.product=null)},{footer:d(()=>[n(Ge,{onClick:Ae[11]||(Ae[11]=te=>dt.value.visible=!1)},{default:d(()=>[L(f(le.$t("Cancel")),1)]),_:1}),n(Ge,{type:"primary",onClick:It},{default:d(()=>[L(f(le.$t("Save")),1)]),_:1})]),default:d(()=>[dt.value.visible&&dt.value.field==="post_content"?(r(),E(Wl,{key:0,"model-value":dt.value.value,height:300,onUpdate:Ft},null,8,["model-value"])):B("",!0),dt.value.visible&&dt.value.field==="post_excerpt"?(r(),E(mt,{key:1,modelValue:dt.value.value,"onUpdate:modelValue":Ae[10]||(Ae[10]=te=>dt.value.value=te),type:"textarea",rows:6,placeholder:le.$t("Short description")},null,8,["modelValue","placeholder"])):B("",!0)]),_:1},8,["modelValue","title"])])}}},Jp=je.get("payment_routes");for(const e of Jp)e.props=!0;const v1e=je.get("storage_driver_routes"),Zp=(v1e||[]).filter(e=>e.name!=="s3");for(const e of Zp)e.props=!0;var g1e={dashboard:{name:"dashboard",path:"/",component:nB,meta:{active_menu:"dashboard",title:"Dashboard"}},orders:{path:"/orders",component:xF,meta:{active_menu:"orders",title:"Orders"},children:[{name:"orders",path:"",component:D_,meta:{active_menu:"orders",title:"Orders",permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:HQ,props:!0,meta:{active_menu:"orders",title:"View Order",permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:gD,props:!0,meta:{active_menu:"orders",title:"Create Order",permission:"orders/create"}}]},products:{name:"products",path:"/products",component:fM,meta:{active_menu:"products",title:"Products",permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:dV,name:"product_route",meta:{active_menu:"products",title:"Products",permission:["products/view","products/edit","integrations/manage"]},props:!0,children:[{name:"product_edit",path:"",props:!0,component:Mj,meta:{active_menu:"products",title:"Product Edit",permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:sc,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:ju,meta:{active_menu:"products",title:"Edit Integration",permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:jz,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:Bz,meta:{active_menu:"products",title:"Upgrade Paths",permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:sc,meta:{active_menu:"integrations",title:"Product Integrations",permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:Rge,meta:{active_menu:"products",title:"Product Bulk Insert",permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:_1e,meta:{active_menu:"products",title:"Product Bulk Edit",permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:lm,meta:{active_menu:"products",title:"Attributes",permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:kW,meta:{active_menu:"products",title:"Inventory",permission:"products/view"}},customers:{path:"/customers",component:qv,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:yh,meta:{active_menu:"customers",title:"Customers",permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:kE,props:!0,meta:{active_menu:"customers",title:"View Customer",permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:OZ,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:Vde,meta:{title:"Overview",permission:"reports/view"}},{name:"reports_sales",path:"sales",component:hee,meta:{title:"Sales",permission:"reports/view"}},{name:"reports_orders",path:"orders",component:Ile,meta:{title:"Orders",permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:Ate,meta:{title:"Revenue",permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:mse,meta:{title:"Refunds",permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:ine,meta:{title:"Subscriptions",permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:boe,meta:{title:"Retention",permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>zt(()=>import("./chunks/Cohort.js?ver=1.6.0"),[],import.meta.url),meta:{title:"Cohorts",permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:xne,meta:{title:"Future Renewals",permission:"reports/view"}},{name:"reports_products",path:"products",component:Pre,meta:{title:"Product",permission:"reports/view"}},{name:"reports_customer",path:"customer",component:joe,meta:{title:"Customer",permission:"reports/view"}},{name:"reports_sources",path:"sources",component:gie,meta:{title:"Sources",permission:"reports/view"}}]},settings:{path:"/settings",component:h$,meta:{active_menu:"settings",title:"Settings",permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:ED,meta:{active_menu:"settings",title:"Settings",permission:"store/settings"},children:[{name:"store_setup",path:"",component:vs,meta:{title:"Store Setup"}},{name:"pages_setup",path:"pages_setup",component:vs,meta:{title:"Pages Setup"}},{name:"single_product_setup",path:"single_product_setup",component:vs,meta:{title:"Product Page"}},{name:"cart_and_checkout",path:"cart_and_checkout",component:vs,meta:{title:"Cart & Checkout"}},{name:"subscriptions_setup",path:"subscriptions_setup",component:vs,meta:{title:"Subscriptions"}},{name:"checkout_fields",path:"checkout_fields",component:U_e,meta:{}}]},...je.get("addon_settings_routes",[]).map(e=>({component:vs,...e})),{name:"email_notifications",path:"email_notifications",component:YW,meta:{active_menu:"settings",title:"Notifications",permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:Uue,meta:{active_menu:"settings",title:"Mailing Settings",permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:vs,meta:{active_menu:"settings",title:"Reminders",permission:"store/sensitive"}},{name:"email_digest_settings",path:"email_digest_settings",component:Rue,meta:{active_menu:"settings",title:"Store Digest",permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:kX,meta:{active_menu:"settings",title:"Edit Notification",permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:jX,meta:{active_menu:"settings",title:"Add Notification",permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:ZD,meta:{active_menu:"settings",title:"Licensing",permission:"store/sensitive"}},{name:"payments",path:"payments",component:OF,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"gateway",component:x3,path:"payments",children:Jp,props:!0,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:O_,meta:{active_menu:"settings",title:"Invoice & Packing",permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:P_,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:nv,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:Kv,meta:{active_menu:"settings",title:"PDF Template Settings",permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:kv,props:!0,meta:{active_menu:"settings",title:"Edit PDF Template",permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:o$,meta:{active_menu:"settings",title:"Role Settings",permission:"is_super_admin"}},{name:"addons",path:"addons",component:tue,meta:{active_menu:"settings",title:"Features & addon",permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:Ac,meta:{active_menu:"coupons",title:"Coupons Settings",permission:"is_super_admin"}},{name:"storage",path:"storage",component:LX,meta:{active_menu:"settings",title:"Storage Providers",permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:oc,props:!0,meta:{active_menu:"settings",title:"S3",permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:U3,meta:{active_menu:"settings",title:"Gateway",permission:"is_super_admin"},props:!0},{name:"drivers",component:oc,path:"storage",children:Zp,props:!0,meta:{active_menu:"settings",title:"Storage Settings",permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:Pue,meta:{active_menu:"settings",title:"Tax Settings",permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:Zce,meta:{}},{name:"tax_rates",path:"tax_rates",component:mAe,meta:{}},{name:"eu",path:"eu",component:Nme,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:cc,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:cc,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:g4,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:ju,meta:{active_menu:"integrations",title:"Global Integrations",permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:tS,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:Ac,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/view"}},logs:{name:"logs",path:"/logs",component:QJ,meta:{active_menu:"logs",title:"Logs",permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:Ppe,meta:{active_menu:"taxes",title:"taxes",permission:"is_super_admin"}},add_or_edit_coupon_route:{name:"add_or_edit_coupon",path:"/coupons/add_or_edit_coupon/:coupon_id?",component:u_e,props:!0,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:kF,name:"onboarding",meta:{active_menu:"dashboard",title:"Onboarding",permission:"is_super_admin"}}};const y1e={class:"fct-theme-button-container"},b1e={class:"theme-selected-button"},w1e={__name:"ThemeToggle",setup(e){const t=T(Ve.MODE_LIGHT),a=c=>{t.value!==c&&(t.value=c,Ve.apply(c))},l=[{value:"light",label:u("Light"),icon:"Sun"},{value:"dark",label:u("Dark"),icon:"Moon"},{value:"system",label:u("System"),icon:"Tools"}];Ss(()=>{const c=document.getElementById("theme-button-container");if(c){const p=c.querySelector(".fct-theme-button-container");p&&p.remove()}t.value=Ve.getCurrentTheme(),t.value.toString().startsWith(Ve.MODE_SYSTEM)&&(t.value=Ve.MODE_SYSTEM)});const s=c=>{Be(()=>{t.value=Ve.getCurrentTheme()})},i=c=>{a(c)};return Ie(()=>{window.addEventListener(Ve.THEME_CHANGE_EVENT,s,!1)}),vl(()=>{window.removeEventListener(Ve.THEME_CHANGE_EVENT,s,!1)}),(c,p)=>{const m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",y1e,[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(m,{key:y.value,command:y.value,class:re({active:t.value===y.value})},{default:d(()=>[n(J,{name:y.icon},null,8,["name"]),L(" "+f(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:d(()=>[o("div",b1e,[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 Jl(e){return Array.isArray?Array.isArray(e):af(e)==="[object Array]"}function C1e(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function k1e(e){return e==null?"":C1e(e)}function Tl(e){return typeof e=="string"}function ef(e){return typeof e=="number"}function B1e(e){return e===!0||e===!1||x1e(e)&&af(e)=="[object Boolean]"}function tf(e){return typeof e=="object"}function x1e(e){return tf(e)&&e!==null}function pl(e){return e!=null}function ar(e){return!e.trim().length}function af(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const S1e="Incorrect 'index' type",F1e=e=>`Invalid value for key ${e}`,$1e=e=>`Pattern length exceeds max of ${e}.`,E1e=e=>`Missing ${e} property in key`,U1e=e=>`Property 'weight' in key '${e}' must be a positive integer`,vc=Object.prototype.hasOwnProperty;class I1e{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let s=lf(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 lf(e){let t=null,a=null,l=null,s=1,i=null;if(Tl(e)||Jl(e))l=e,t=gc(e),a=Mr(e);else{if(!vc.call(e,"name"))throw new Error(E1e("name"));const c=e.name;if(l=c,vc.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(U1e(c));t=gc(c),a=Mr(c),i=e.getFn}return{path:t,id:a,weight:s,src:l,getFn:i}}function gc(e){return Jl(e)?e:e.split(".")}function Mr(e){return Jl(e)?e.join("."):e}function Q1e(e,t){let a=[],l=!1;const s=(i,c,p)=>{if(pl(i))if(!c[p])a.push(i);else{let m=c[p];const _=i[m];if(!pl(_))return;if(p===c.length-1&&(Tl(_)||ef(_)||B1e(_)))a.push(k1e(_));else if(Jl(_)){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,Tl(t)?t.split("."):t,0),l?a:a[0]}const D1e={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},V1e={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},T1e={location:0,threshold:.6,distance:100},M1e={useExtendedSearch:!1,getFn:Q1e,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var St={...V1e,...D1e,...T1e,...M1e};const L1e=/[^ ]+/g;function R1e(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(s){const i=s.match(L1e).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 $d{constructor({getFn:t=St.getFn,fieldNormWeight:a=St.fieldNormWeight}={}){this.norm=R1e(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,Tl(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();Tl(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)||ar(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(Jl(c)){let p=[];const m=[{nestedArrIndex:-1,value:c}];for(;m.length;){const{nestedArrIndex:_,value:g}=m.pop();if(pl(g))if(Tl(g)&&!ar(g)){let y={v:g,i:_,n:this.norm.get(g)};p.push(y)}else Jl(g)&&g.forEach((y,v)=>{m.push({nestedArrIndex:v,value:y})})}l.$[i]=p}else if(Tl(c)&&!ar(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 sf(e,t,{getFn:a=St.getFn,fieldNormWeight:l=St.fieldNormWeight}={}){const s=new $d({getFn:a,fieldNormWeight:l});return s.setKeys(e.map(lf)),s.setSources(t),s.create(),s}function O1e(e,{getFn:t=St.getFn,fieldNormWeight:a=St.fieldNormWeight}={}){const{keys:l,records:s}=e,i=new $d({getFn:t,fieldNormWeight:a});return i.setKeys(l),i.setIndexRecords(s),i}function mo(e,{errors:t=0,currentLocation:a=0,expectedLocation:l=0,distance:s=St.distance,ignoreLocation:i=St.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 H1e(e=[],t=St.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 bs=32;function P1e(e,t,a,{location:l=St.location,distance:s=St.distance,threshold:i=St.threshold,findAllMatches:c=St.findAllMatches,minMatchCharLength:p=St.minMatchCharLength,includeMatches:m=St.includeMatches,ignoreLocation:_=St.ignoreLocation}={}){if(t.length>bs)throw new Error($1e(bs));const g=t.length,y=e.length,v=Math.max(0,Math.min(l,y));let w=i,k=v;const b=p>1||m,x=b?Array(y):[];let F;for(;(F=e.indexOf(t,k))>-1;){let D=mo(t,{currentLocation:F,expectedLocation:v,distance:s,ignoreLocation:_});if(w=Math.min(D,w),k=F+g,b){let V=0;for(;V<g;)x[F+V]=1,V+=1}}k=-1;let M=[],$=1,S=g+y;const I=1<<g-1;for(let D=0;D<g;D+=1){let V=0,U=S;for(;V<U;)mo(t,{errors:D,currentLocation:v+U,expectedLocation:v,distance:s,ignoreLocation:_})<=w?V=U:S=U,U=Math.floor((S-V)/2+V);S=U;let O=Math.max(1,v-U+1),R=c?y:Math.min(v+U,y)+g,P=Array(R+2);P[R+1]=(1<<D)-1;for(let q=R;q>=O;q-=1){let z=q-1,X=a[e.charAt(z)];if(b&&(x[z]=+!!X),P[q]=(P[q+1]<<1|1)&X,D&&(P[q]|=(M[q+1]|M[q])<<1|1|M[q+1]),P[q]&I&&($=mo(t,{errors:D,currentLocation:z,expectedLocation:v,distance:s,ignoreLocation:_}),$<=w)){if(w=$,k=z,k<=v)break;O=Math.max(1,2*v-k)}}if(mo(t,{errors:D+1,currentLocation:v,expectedLocation:v,distance:s,ignoreLocation:_})>w)break;M=P}const Q={isMatch:k>=0,score:Math.max(.001,$)};if(b){const D=H1e(x,p);D.length?m&&(Q.indices=D):Q.isMatch=!1}return Q}function N1e(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 Yo=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 nf{constructor(t,{location:a=St.location,threshold:l=St.threshold,distance:s=St.distance,includeMatches:i=St.includeMatches,findAllMatches:c=St.findAllMatches,minMatchCharLength:p=St.minMatchCharLength,isCaseSensitive:m=St.isCaseSensitive,ignoreDiacritics:_=St.ignoreDiacritics,ignoreLocation:g=St.ignoreLocation}={}){if(this.options={location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:_,ignoreLocation:g},t=m?t:t.toLowerCase(),t=_?Yo(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(w,k)=>{this.chunks.push({pattern:w,alphabet:N1e(w),startIndex:k})},v=this.pattern.length;if(v>bs){let w=0;const k=v%bs,b=v-k;for(;w<b;)y(this.pattern.substr(w,bs),w),w+=bs;if(k){const x=v-bs;y(this.pattern.substr(x),x)}}else y(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s}=this.options;if(t=a?t:t.toLowerCase(),t=l?Yo(t):t,this.pattern===t){let b={isMatch:!0,score:0};return s&&(b.indices=[[0,t.length-1]]),b}const{location:i,distance:c,threshold:p,findAllMatches:m,minMatchCharLength:_,ignoreLocation:g}=this.options;let y=[],v=0,w=!1;this.chunks.forEach(({pattern:b,alphabet:x,startIndex:F})=>{const{isMatch:M,score:$,indices:S}=P1e(t,b,x,{location:i+F,distance:c,threshold:p,findAllMatches:m,minMatchCharLength:_,includeMatches:s,ignoreLocation:g});M&&(w=!0),v+=$,M&&S&&(y=[...y,...S])});let k={isMatch:w,score:w?v/this.chunks.length:1};return w&&s&&(k.indices=y),k}}class ms{constructor(t){this.pattern=t}static isMultiMatch(t){return yc(t,this.multiRegex)}static isSingleMatch(t){return yc(t,this.singleRegex)}search(){}}function yc(e,t){const a=e.match(t);return a?a[1]:null}class K1e extends ms{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 G1e extends ms{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 j1e extends ms{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 z1e extends ms{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 q1e extends ms{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 Y1e extends ms{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 of extends ms{constructor(t,{location:a=St.location,threshold:l=St.threshold,distance:s=St.distance,includeMatches:i=St.includeMatches,findAllMatches:c=St.findAllMatches,minMatchCharLength:p=St.minMatchCharLength,isCaseSensitive:m=St.isCaseSensitive,ignoreDiacritics:_=St.ignoreDiacritics,ignoreLocation:g=St.ignoreLocation}={}){super(t),this._bitapSearch=new nf(t,{location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:_,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class rf extends ms{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 Lr=[K1e,rf,j1e,z1e,Y1e,q1e,G1e,of],bc=Lr.length,W1e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,X1e="|";function J1e(e,t={}){return e.split(X1e).map(a=>{let l=a.trim().split(W1e).filter(i=>i&&!!i.trim()),s=[];for(let i=0,c=l.length;i<c;i+=1){const p=l[i];let m=!1,_=-1;for(;!m&&++_<bc;){const g=Lr[_];let y=g.isMultiMatch(p);y&&(s.push(new g(y,t)),m=!0)}if(!m)for(_=-1;++_<bc;){const g=Lr[_];let y=g.isSingleMatch(p);if(y){s.push(new g(y,t));break}}}return s})}const Z1e=new Set([of.type,rf.type]);class ebe{constructor(t,{isCaseSensitive:a=St.isCaseSensitive,ignoreDiacritics:l=St.ignoreDiacritics,includeMatches:s=St.includeMatches,minMatchCharLength:i=St.minMatchCharLength,ignoreLocation:c=St.ignoreLocation,findAllMatches:p=St.findAllMatches,location:m=St.location,threshold:_=St.threshold,distance:g=St.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s,minMatchCharLength:i,findAllMatches:p,ignoreLocation:c,location:m,threshold:_,distance:g},t=a?t:t.toLowerCase(),t=l?Yo(t):t,this.pattern=t,this.query=J1e(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?Yo(t):t;let c=0,p=[],m=0;for(let _=0,g=a.length;_<g;_+=1){const y=a[_];p.length=0,c=0;for(let v=0,w=y.length;v<w;v+=1){const k=y[v],{isMatch:b,indices:x,score:F}=k.search(t);if(b){if(c+=1,m+=F,l){const M=k.constructor.type;Z1e.has(M)?p=[...p,...x]:p.push(x)}}else{m=0,c=0,p.length=0;break}}if(c){let v={isMatch:!0,score:m/c};return l&&(v.indices=p),v}}return{isMatch:!1,score:1}}}const Rr=[];function tbe(...e){Rr.push(...e)}function Or(e,t){for(let a=0,l=Rr.length;a<l;a+=1){let s=Rr[a];if(s.condition(e,t))return new s(e,t)}return new nf(e,t)}const Wo={AND:"$and",OR:"$or"},Hr={PATH:"$path",PATTERN:"$val"},Pr=e=>!!(e[Wo.AND]||e[Wo.OR]),abe=e=>!!e[Hr.PATH],lbe=e=>!Jl(e)&&tf(e)&&!Pr(e),wc=e=>({[Wo.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function df(e,t,{auto:a=!0}={}){const l=s=>{let i=Object.keys(s);const c=abe(s);if(!c&&i.length>1&&!Pr(s))return l(wc(s));if(lbe(s)){const m=c?s[Hr.PATH]:i[0],_=c?s[Hr.PATTERN]:s[m];if(!Tl(_))throw new Error(F1e(m));const g={keyId:Mr(m),pattern:_};return a&&(g.searcher=Or(_,t)),g}let p={children:[],operator:i[0]};return i.forEach(m=>{const _=s[m];Jl(_)&&_.forEach(g=>{p.children.push(l(g))})}),p};return Pr(e)||(e=wc(e)),l(e)}function sbe(e,{ignoreFieldNorm:t=St.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 nbe(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 obe(e,t){t.score=e.score}function ibe(e,t,{includeMatches:a=St.includeMatches,includeScore:l=St.includeScore}={}){const s=[];return a&&s.push(nbe),l&&s.push(obe),e.map(i=>{const{idx:c}=i,p={item:t[c],refIndex:c};return s.length&&s.forEach(m=>{m(i,p)}),p})}class dn{constructor(t,a={},l){this.options={...St,...a},this.options.useExtendedSearch,this._keyStore=new I1e(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof $d))throw new Error(S1e);this._myIndex=a||sf(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 m=Tl(t)?Tl(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return sbe(m,{ignoreFieldNorm:p}),i&&m.sort(c),ef(a)&&a>-1&&(m=m.slice(0,a)),ibe(m,this._docs,{includeMatches:l,includeScore:s})}_searchStringList(t){const a=Or(t,this.options),{records:l}=this._myIndex,s=[];return l.forEach(({v:i,i:c,n:p})=>{if(!pl(i))return;const{isMatch:m,score:_,indices:g}=a.searchIn(i);m&&s.push({item:i,idx:c,matches:[{score:_,value:i,norm:p,indices:g}]})}),s}_searchLogical(t){const a=df(t,this.options),l=(p,m,_)=>{if(!p.children){const{keyId:y,searcher:v}=p,w=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(m,y),searcher:v});return w&&w.length?[{idx:_,item:m,matches:w}]:[]}const g=[];for(let y=0,v=p.children.length;y<v;y+=1){const w=p.children[y],k=l(w,m,_);if(k.length)g.push(...k);else if(p.operator===Wo.AND)return[]}return g},s=this._myIndex.records,i={},c=[];return s.forEach(({$:p,i:m})=>{if(pl(p)){let _=l(a,p,m);_.length&&(i[m]||(i[m]={idx:m,item:p,matches:[]},c.push(i[m])),_.forEach(({matches:g})=>{i[m].matches.push(...g)}))}}),c}_searchObjectList(t){const a=Or(t,this.options),{keys:l,records:s}=this._myIndex,i=[];return s.forEach(({$:c,i:p})=>{if(!pl(c))return;let m=[];l.forEach((_,g)=>{m.push(...this._findMatches({key:_,value:c[g],searcher:a}))}),m.length&&i.push({idx:p,item:c,matches:m})}),i}_findMatches({key:t,value:a,searcher:l}){if(!pl(a))return[];let s=[];if(Jl(a))a.forEach(({v:i,i:c,n:p})=>{if(!pl(i))return;const{isMatch:m,score:_,indices:g}=l.searchIn(i);m&&s.push({score:_,key:t,value:i,idx:c,norm:p,indices:g})});else{const{v:i,n:c}=a,{isMatch:p,score:m,indices:_}=l.searchIn(i);p&&s.push({score:m,key:t,value:i,norm:c,indices:_})}return s}}dn.version="7.1.0";dn.createIndex=sf;dn.parseIndex=O1e;dn.config=St;dn.parseQuery=df;tbe(ebe);const rbe=(je.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}}),dbe=[{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"},...rbe],ube=dbe.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}})),cbe=[{title:"Theme",title_resolver:()=>{let t=(Ve.isDark()?"dark":"light")==="light"?u("Dark"):u("Light");return u("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(Ve.isDark()?"dark":"light")==="light"?"dark":"light";Ve.apply(t,{fromShortcut:!0})}}}],Cc={"/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 uf=[];Object.keys(Cc).forEach(e=>{const t=Cc[e];uf.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:u("Go to %1$s",t),show_description:!1}})});const Abe=[],pbe={Menu:ube,Actions:cbe,Settings:uf,Shortcuts:Abe},Nr=[];Object.entries(pbe).forEach(([e,t])=>{t.forEach((a,l)=>{Nr.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const fbe=()=>({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}]}),mbe={class:"navigable-list-container fct-global-search-result-container"},hbe={key:0,class:"no-results fct-global-search-result-not-found"},_be={key:1},vbe=["tabindex","onClick","onKeydown"],gbe={__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=T(-1),s=zr("listContainer"),i=T({}),c=(k,b)=>{b&&(i.value[k]=b)},p=k=>{const b=a.items.length;if(b===0)return;const x=b-1;k==="up"?l.value=l.value<=0?x:l.value-1:k==="down"&&(l.value=l.value>=x?0:l.value+1),m()},m=()=>{const k=s.value,b=i.value[l.value];b&&k&&(b.scrollIntoView({behavior:"smooth",block:"nearest"}),Be(()=>{b.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,Be(()=>{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&&Be(()=>{})},{immediate:!0}),be(l,()=>{}),(k,b)=>(r(),h("div",mbe,[e.items.length===0?(r(),h("div",hbe,[n(J,{name:"Empty/GlobalSearch"}),L(" "+f(e.noResultsText),1)])):(r(),h("div",_be,[o("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(H,null,ae(e.items,(x,F)=>(r(),h("li",{key:F,ref_for:!0,ref:M=>c(F,M),class:re({selected:F===l.value}),tabindex:F,onClick:M=>_(F),onKeydown:[b[0]||(b[0]=xa(Ne(M=>p("up"),["prevent"]),["arrow-up"])),b[1]||(b[1]=xa(Ne(M=>p("down"),["prevent"]),["arrow-down"])),xa(M=>g(F),["enter"])]},[Ba(k.$slots,"default",{item:x,index:F,isSelected:F===l.value},void 0,!0)],42,vbe))),128))],512)]))]))}},Kr=st(gbe,[["__scopeId","data-v-2379fe26"]]),ybe={class:"fct-search-result-label"},bbe={class:"fct-search-result-title"},wbe={key:0,class:"fct-search-result-subtitle"},Cbe={key:1,class:"fct-search-result-subtitle"},kbe={class:"action-icon"},Bbe={class:"recent-search-title"},xbe={class:"fct-search-result-label"},Sbe={class:"fct-search-result-title"},Fbe={key:0,class:"fct-search-result-subtitle"},$be={key:1,class:"fct-search-result-subtitle"},Ebe={class:"action-icon"},lr="recent_actions",Ube={__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=al();qt().ctx;const l=e,s=T(0),i=T({}),c=T(),p=(x,F)=>{const $=x.item.data,S=_($.type);if(S==="link"){let I=_($.url);_($.new_tab)?window.open(I,"_blank"):window.location.href=I}else S==="action"&&_($.action);m(x),l.onActionPerformed()},m=x=>{const F=x.item.id;let M=Ot.get(lr)||[];M=M.filter($=>$!==F),M.unshift(F),M=M.slice(0,5),Ot.set(lr,M)},_=x=>typeof x=="function"?g(x):x,g=async x=>await x({query:l.query,router:a}),y=()=>{var x;(x=c.value)==null||x.resetSelection()},v=()=>{var x;(x=c.value)==null||x.focusList(0)},w=()=>{var x;(x=c.value)==null||x.performFirstAction()};be(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},s.value=Object.keys(i.value).length-1;let x=i.value;for(const F of Object.keys(x)){const M=x[F];M.item.title_resolver&&(x[F].item.title=await _(M.item.title_resolver))}i.value={...x}});const k=T([]),b=async()=>{const x=Ot.get(lr)||[];let F=rt.whereIn(l.searchData,"id",x),M=[];for(const $ of F)typeof $.title_resolver=="function"&&($.title=await _($.title_resolver)),M.push({item:$});k.value=M};return Ie(()=>{b()}),t({focusList:v,resetSelection:y,performFirstAction:w,fetchRecentActions:b}),(x,F)=>(r(),h(H,null,[e.query||k.value.length<1?(r(),E(Kr,{key:0,items:e.searchResults,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:M,index:$,isSelected:S})=>{var I,Q,D;return[o("span",ybe,[o("span",bbe,f(M.item.title),1),(I=M.item)!=null&&I.subtitle?(r(),h("span",wbe,f(M.item.subtitle),1)):((D=(Q=M.item)==null?void 0:Q.data)==null?void 0:D.show_description)===!0?(r(),h("span",Cbe,f(M.item.data.description),1)):B("",!0)]),o("div",kbe,[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",Bbe,f(A(u)("Recent Actions")),1),n(Kr,{items:k.value,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:M,index:$,isSelected:S})=>{var I,Q,D;return[o("span",xbe,[o("span",Sbe,f(M.item.title),1),(I=M.item)!=null&&I.subtitle?(r(),h("span",Fbe,f(M.item.subtitle),1)):((D=(Q=M.item)==null?void 0:Q.data)==null?void 0:D.show_description)===!0?(r(),h("span",$be,f(M.item.data.description),1)):B("",!0)]),o("div",Ebe,[n(J,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):B("",!0)],64))}},Ibe=st(Ube,[["__scopeId","data-v-ccb0ebef"]]),Qbe={class:"fct-global-search-product-wrap"},Dbe={class:"fct-global-search-product-left-info"},Vbe={key:0,class:"type"},Tbe={key:0,class:"price-and-status"},Mbe={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=l=>l.min_price===l.max_price?_a(l.min_price,!0):`${_a(l.min_price,!0)} - ${_a(l.max_price,!0)}`,a=l=>l==="publish"?u("published"):l==="future"?u("scheduled"):l;return(l,s)=>(r(),h("div",Qbe,[o("div",Dbe,[n(Xr,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",Vbe,[L(f(A(da).headline(e.product.detail.variation_type))+" ",1),s[0]||(s[0]=o("br",null,null,-1)),L(" "+f(A(da).headline(e.product.detail.fulfillment_type)),1)])):B("",!0)]),e.product.detail?(r(),h("span",Tbe,[L(f(t(e.product.detail))+" ",1),(r(),E(fa,{key:e.product.ID,status:e.product.post_status},{default:d(()=>[L(f(a(e.product.post_status)),1)]),_:1},8,["status"]))])):B("",!0)]))}},Lbe={class:"fct-global-search-order-wrap"},Rbe={class:"fct-global-search-order-header"},Obe={class:"fct-global-search-order-id"},Hbe={class:"items"},Pbe={class:"fct-global-search-order-header-meta"},Nbe={class:"date"},Kbe=["innerHTML"],Gbe={class:"customer-name"},jbe={class:"fct-global-search-order-status-wrapper"},zbe=["src","alt"],qbe={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>rt.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,l)=>{var i;const s=C("el-tag");return r(),h("div",Lbe,[o("div",Rbe,[o("div",Obe,[L(" #"+f(e.order.id)+" ",1),o("span",Hbe,f(A(u)("%s Items",e.order.order_items.length)),1)]),o("div",Pbe,[o("span",Nbe,[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(_a)(e.order.total_amount,!0,!1,e.order.currency)},null,8,Kbe),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",Gbe,f(((i=e.order.customer)==null?void 0:i.full_name)||A(u)("No Name")),1)])]),o("div",jbe,[n(fa,{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(da).headline(e.order.payment_method)},null,8,zbe)):(r(),E(s,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:d(()=>[L(f(A(da).headline(e.order.payment_method)),1)]),_:1}))])])}}},Ybe={class:"fct-global-search-customer-wrap"},Wbe={class:"fct-customer-card"},Xbe={class:"fct-customer-avatar"},Jbe=["src"],Zbe={class:"fct-customer-details"},e0e={class:"fct-customer-name"},t0e={class:"fct-customer-id"},a0e={class:"fct-customer-email"},l0e={class:"purchase-count"},s0e={class:"date"},n0e={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Ybe,[o("div",Wbe,[o("div",Xbe,[o("img",{src:e.customer.photo,alt:"avatar"},null,8,Jbe)]),o("div",Zbe,[o("div",e0e,[L(f(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",t0e,"#"+f(e.customer.id),1)]),o("div",a0e,[L(f(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=L()),o("span",l0e,"Purchase: "+f(e.customer.purchase_count),1)])])]),o("span",s0e,[n(Na,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},o0e={class:"fct-global-search-coupon-wrap"},i0e={class:"amount"},r0e={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",o0e,[o("span",null,f(e.coupon.title),1),o("span",null,f(e.coupon.code),1),o("span",i0e,f(A(_a)(e.coupon.amount,!0)),1)]))}},d0e={class:"fct-global-remote-result-container"},u0e={class:"fct-global-remote-result-label"},c0e={class:"text"},A0e={class:"navigable-content"},p0e={class:"action-icon"},f0e={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,s=al(),i=T({}),c=T(""),p=T(),m=T({}),_=T([]),g=D=>{y.value=!1,_.value=x.data.tableData,l("onRemoteSearchStateChange",!1)},y=T(!1),v={orders:zc({fetch:!1}),products:$p({fetch:!1}),customers:jc({fetch:!1}),coupons:jp({fetch:!1})},w=()=>{},k=()=>{var D;(D=p.value)==null||D.focusList(0)},b=()=>{var D;(D=p.value)==null||D.performFirstAction()};Ss(()=>{for(const D of Object.keys(v))v[D].onDataLoaded(g)});let x=null;const F=()=>{x=v[i.value.key],x.data.search=c.value,y.value=!0,x.fetch(),l("onRemoteSearchStateChange",!0)},M=ld.debounce(F,800),$=(D,V)=>{if(_.value=[],x&&(x.data.search=""),i.value=V,m.value={title:V.title,key:V.key},!D){c.value="";return}c.value=D,M()},S=()=>{s.push({name:m.value.key,query:{search:c.value}}),l("close-modal")},I={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"}},Q=D=>{i.value.key in I&&(s.push({name:I[i.value.key].name,params:{[I[i.value.key].key]:D.id||D.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:$,focusList:k,resetSelection:w,performFirstAction:b}),(D,V)=>(r(),h("div",d0e,[o("div",u0e,[o("span",c0e,f(i.value.title),1),m.value.key?(r(),h("span",{key:0,class:"view-all",onClick:S},f(c.value?A(u)('Search "%1$s" in %2$s',c.value,m.value.title):A(u)("See All %s",m.value.title)),1)):B("",!0)]),n(Kr,{items:_.value,"on-action":U=>{Q(U)},"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:U,index:O,isSelected:R})=>[o("div",A0e,[i.value.key==="products"?(r(),E(Mbe,{key:0,product:U},null,8,["product"])):B("",!0),i.value.key==="orders"?(r(),E(qbe,{key:1,order:U},null,8,["order"])):B("",!0),i.value.key==="customers"?(r(),E(n0e,{key:2,customer:U},null,8,["customer"])):B("",!0),i.value.key==="coupons"?(r(),E(r0e,{key:3,coupon:U},null,8,["coupon"])):B("",!0)]),o("div",p0e,[n(J,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},m0e={class:"fct-global-search-input-wrap"},h0e=["aria-label"],_0e={class:"fct-setting-search-icon"},v0e={class:"fct-global-search-input-container"},g0e={key:0,class:"searched-item"},y0e={class:"fct-global-searching-for"},b0e={class:"fct-global-searching-for-label"},w0e={class:"fct-global-searching-suggestion-list"},C0e=["onClick"],k0e={class:"dialog-footer is-border"},B0e={class:"fct-search-commands"},x0e={class:"command-key"},S0e={class:"command-key"},F0e={class:"label"},$0e={class:"command-key"},E0e={class:"label"},U0e={class:"label"},I0e={__name:"GlobalSearch",setup(e){qt().ctx,al();const t=T(!1),a=T(""),l=T({}),s=T(),i=T(""),c=T([u("orders"),u("products"),u("customers"),u("coupons"),u("settings"),u("menus"),u("shortcuts...")]),p=T(0),m=T(!0),_=T(0),g=T(null),y=T(null),v=T(70),w=T(40),k=T(1700),b=()=>{Be(()=>{F()})},x=()=>{var Z,W;Q.value?(Z=q.value)==null||Z.resetSelection():(W=$.value)==null||W.resetSelection(),Q.value=!1,P.value=!1,M()},F=()=>{var Z;(Z=s.value)==null||Z.focus()},M=()=>{Q.value=!1,l.value=[],t.value=!1,a.value="",D.value=null},$=T(),S=Z=>{let W=Z.includes(","),ie={},ye=[];(W?Z.split(","):[Z]).forEach(se=>{se.includes(":")?I(se,ie,ye):ye.push(se)});let ge=[];return Object.keys(ie).forEach(se=>{const pe=ie[se];pe.length>0?pe.forEach($e=>{$e.length>0?ge.push({group:"'"+se,title:$e}):ge.push({group:"'"+se})}):ge.push({group:"'"+se})}),ye.forEach(se=>{se.length>0&&ge.push({title:se})}),ge},I=(Z,W,ie)=>{if(Z.length===1)return;let ye=Z.split(":"),fe=ye[0],ge=ye[1];fe.length>0?(W.hasOwnProperty(fe)||(W[fe]=[]),ge.length>0&&W[fe].push(ge)):ie.push(ge)},Q=T(!1),D=T(null),V=T({o:{key:"orders",title:u("Orders")},p:{key:"products",title:u("Products")},c:{key:"customers",title:u("Customers")},d:{key:"coupons",title:u("Coupons")}}),U=Z=>{D.value=Z,Q.value=!0,l.value={},Be(()=>{var W,ie;(W=q.value)==null||W.fetchData(a.value,Z),(ie=s.value)==null||ie.focus()})},O=()=>{var Z;l.value=[],D.value=null,a.value="",Q.value=!1,(Z=s.value)==null||Z.focus(),P.value=!1},R=()=>{var Z;(Z=q.value)==null||Z.fetchData(a.value,D.value)},P=T(!1),j=Z=>{P.value=Z,Be(()=>{var W;(W=s.value)==null||W.focus()})},q=T(),z=ps(),X=()=>{if(t.value){F();return}const Z=["o","p","c","d"];z.bind(Z,W=>{W.preventDefault();const ie=V.value[W.key];ie&&U(ie)}),t.value=!0,Be(()=>{var W;(W=$.value)==null||W.fetchRecentActions()}),setTimeout(()=>{z.unbind(Z)},800)};z.bind(["/"],Z=>{!t.value&&ne()||(Z.preventDefault(),X())});const ne=()=>{const Z=document.activeElement;if(!Z)return!1;const W=Z.tagName;return W==="INPUT"||W==="TEXTAREA"||W==="SELECT"||Z.isContentEditable},he=()=>{if(g.value)return;const Z=()=>{if(s.value&&s.value.length>0)return;const ie=c.value[p.value];if(m.value)_.value<ie.length?(i.value=ie.slice(0,_.value+1),_.value++):(m.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)):(m.value=!0,p.value=(p.value+1)%c.value.length)}},W=()=>{Z();const ie=m.value?v.value:y.value?120:w.value;g.value=setTimeout(W,ie)};W()},N=T(!1);let G;return Ie(()=>{he(),G=new dn(Nr,fbe());const Z=document.getElementById("fct_admin_menu_search");if(Z){const W=Z.querySelector(".fct-global-search-input-wrap");W&&W.remove()}N.value=!!Z,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=X}),Bt(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(Z,W)=>{const ie=C("el-input"),ye=C("el-dialog");return r(),h(H,null,[N.value?(r(),E(Xo,{key:0,to:"#fct_admin_menu_search"},[o("div",m0e,[o("button",{onClick:X,type:"button",class:"fct-setting-search-button","aria-label":A(u)("Search")},[o("span",_0e,[n(J,{name:"Search"})]),W[6]||(W[6]=o("span",{class:"fct-global-search-button-keys"},[o("kbd",{class:"fct-global-search-button-key"},"/")],-1))],8,h0e)])])):B("",!0),n(ye,{modelValue:t.value,"onUpdate:modelValue":W[5]||(W[5]=fe=>t.value=fe),onOpened:b,onClosed:x,class:"fct-global-search-container","append-to-body":!0},{header:d(()=>[o("div",v0e,[n(J,{name:"Search",class:"search-icon"}),D.value!=null?(r(),h("div",g0e,[L(f(D.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:[W[0]||(W[0]=xa(Ne(()=>{var fe,ge;if(Q.value){(fe=q.value)==null||fe.focusList();return}(ge=$.value)==null||ge.focusList()},["prevent"]),["arrow-down"])),W[1]||(W[1]=xa(Ne(()=>{var fe,ge;if(Q.value){(fe=q.value)==null||fe.performFirstAction();return}(ge=$.value)==null||ge.performFirstAction()},["prevent"]),["enter"])),W[2]||(W[2]=xa(()=>{a.value.length===0&&(D.value=null,Q.value=!1)},["backspace"]))],onInput:W[3]||(W[3]=()=>{if(Q.value){R();return}let fe=a.value.includes(","),ge=a.value.includes(":");if(!fe&&!ge)l.value.value=A(G).search(a.value);else{const se=S(a.value);l.value.value=A(G).search({$or:se})}}),modelValue:a.value,"onUpdate:modelValue":W[4]||(W[4]=fe=>a.value=fe),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:d(()=>[n(va,{visible:!D.value&&a.value.length===0,accordion:""},{default:d(()=>[o("div",y0e,[o("div",b0e,f(A(u)("Searching for")),1),o("div",w0e,[(r(!0),h(H,null,ae(V.value,fe=>{var ge;return r(),h("div",{key:fe.key,onClick:se=>U(fe),class:re(["fct-global-searching-suggestion",((ge=D.value)==null?void 0:ge.key)===fe.key?"active":""])},f(fe.title),11,C0e)}),128))])])]),_:1},8,["visible"]),Q.value?(r(),E(f0e,{key:0,ref_key:"remoteResultRef",ref:q,query:a.value,tag:D.value,onCloseModal:M,onOnRemoteSearchStateChange:j},null,8,["query","tag"])):(r(),E(Ibe,{key:1,ref_key:"resultListRef",ref:$,query:a.value,"search-results":l.value.value,onActionPerformed:M,focusInput:F,searchData:A(Nr)},null,8,["query","search-results","searchData"])),o("div",k0e,[o("ul",B0e,[o("li",null,[o("span",x0e,[n(J,{name:"ArrowUp"})]),o("span",S0e,[n(J,{name:"ArrowDown"})]),o("span",F0e,f(A(u)("To navigate")),1)]),o("li",null,[o("span",$0e,[n(J,{name:"Enter"})]),o("span",E0e,f(A(u)("To select")),1)]),o("li",null,[W[7]||(W[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",U0e,f(A(u)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},Q0e={class:"fl_app fluent-cart-admin-pages"},D0e=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=T("");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=T(!1),s=ll();be(()=>s.fullPath,()=>{t.value=a()});const i=K(()=>!(s.fullPath.includes("reports")||s.fullPath.includes("settings")));return(c,p)=>{const m=C("router-view");return r(),h("div",null,[n(I0e),i.value?(r(),E(Da,{key:0})):B("",!0),o("div",Q0e,[n(m)]),l.value?(r(),E(Xo,{key:1,to:"#theme-button-container"},[n(w1e)])):B("",!0)])}}});let kc=!1;function V0e(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:ue.get,$post:ue.post,$put:ue.put,$del:ue.delete,$t:u,$n:ko,formatMoney(t,a,l=!1){return!t&&l?"":(t||(t="0.00"),je.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),je.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,l=!1,s){return et.formatNumber(t,a,l,s)},formatNumberForOrder(t,a,l=!0,s=!1){return et.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 sm(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=>{Y.success(t)},handleMessage:(t,a="info",l=40,s=1e3)=>{$f.show(t,a,l,s)},Storage:()=>Ot,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(){kc||(kc=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&Yl.copy(t.target.textContent)}))},currencySign(){return je.get("shop.currency_sign")},getPlaceholderImage(){return cs.getUrl("images/placeholder.svg")},saveLocal(t,a){Ot.set(t,a)},getLocal(t){return Ot.get(t)},hasPermission(t){return Xs.hasPermission(t)}}}}function T0e(e){e.beforeEach((t,a,l)=>{const s=rt.get(t,"meta.permission");return s?Xs.resolve({permission:s,permissionType:rt.get(t,"meta.permissionType")})?l():l({name:"unauthorized"}):(je.get("app_config.env"),l())})}function M0e(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(m=>{const _=jQuery(".toplevel_page_fluent-cart li."+m);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 L0e={mounted(e,t){const a=t.value,l=1e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(s+m*(a-s)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(c)};c()},updated(e,t){const a=t.value,l=2e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(s+m*(a-s)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(c)};c()}},R0e={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,f(A(u)("You are not allowed")),1))}},O0e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",g1e);let Bc=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Bc||Xa.alert(u("Your session has expired due to inactivity. Please refresh the page to continue."),u("Session Expired"),{confirmButtonText:u("Reload"),callback:t=>{Bc=!1,window.location.reload()}})});const H0e=[Nf,Kf,Gf,gs,jf,ed,zf,qf,ti,Yf,Wf,Rc],Pl=kf(D0e);Pl.config.globalProperties.appVars=je.get();Pl.provide("appVars",je.get());Pl.mixin(V0e());Pl.directive("loading",cm);Pl.directive("animate",L0e);fm(Pl);const Ed=Bf({routes:[...Object.values(O0e),{path:"/unauthorized",name:"unauthorized",component:R0e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:ai,props:!0}],history:xf(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});Pl.use(Ed);T0e(Ed);M0e(Ed);H0e.forEach(e=>{Pl.component(e.name,e)});const Ud=je.get("el_strings"),cf=je.get("datei18");Ud.el.datepicker.weeks=cf.weekdaysShort;Ud.el.datepicker.months=cf.monthsShort;Pl.use(Am,{locale:Ud});Pl.mount("#fluent_cart_plugin_app");if(je.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{On as E};
295