| 1 |
var Hm=Object.defineProperty;var Pm=(e,t,a)=>t in e?Hm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Ee=(e,t,a)=>Pm(e,typeof t!="symbol"?t+"":t,a);import{r as C,c as E,o as d,w as i,a as l,u as p,b as x,d as r,e as _,f as R,t as h,F as H,g as ee,h as V,i as Be,j as At,k as Qt,l as j,m as oa,n as de,p as Rt,q as Xe,s as ao,T as vs,v as ge,x as ye,y as Gd,z as Pa,A as pn,B as kn,C as Nm,D as la,E as bn,G as ia,H as Km,I as Hn,J as Kl,K as xn,L as Rr,M as Gm,N as zA,V as YA,O as Ks,P as jm,Q as jd,R as Dt,S as Ca,U as Rn,W as zm,X as Zi,Y as Ym,Z as pl,_ as qm,$ as Wm,a0 as Xm,a1 as zd,a2 as Jm}from"./chunks/vue.esm-bundler.js?ver=1.4.1";import{u as ja,a as fn,o as qA,c as Zm,b as eh}from"./chunks/vue-router.js?ver=1.4.1";import{_ as W,a as It}from"./chunks/DynamicIcon.js?ver=1.4.1";import{T as Gs,_ as na,a as js,b as Yd,F as rr,c as Na,P as co,d as WA,e as th,f as ah,m as nh}from"./chunks/RouteCell.js?ver=1.4.1";import{t as c,a as Kt,A as Ie,p as ir}from"./chunks/Translator.js?ver=1.4.1";import{_ as at,P as za}from"./chunks/Empty.js?ver=1.4.1";import{_ as St,a as qd,p as no,b as Za,c as XA,d as JA,L as Wd,e as Or,O as ZA,f as Hr,P as Xd,C as Os}from"./chunks/OrderCustomerInformation.js?ver=1.4.1";import{C as Te,f as Jt,a as sh,p as lh,b as oh,g as rh,c as ih,d as dh}from"./chunks/productService.js?ver=1.4.1";import{_ as $a}from"./chunks/ConvertedTime.js?ver=1.4.1";import{_ as He}from"./chunks/_plugin-vue_export-helper.js?ver=1.4.1";import{I as Oe,S as vt}from"./chunks/IconButton.js?ver=1.4.1";import{c as uh,h as so,a as ep,g as tp,f as ch,b as Hs,$ as en,d as Ah}from"./chunks/common.js?ver=1.4.1";import{C as Ce,a as me,b as he,B as qt}from"./chunks/Badge.js?ver=1.4.1";import{M as Ya}from"./chunks/Model.js?ver=1.4.1";import{R as re}from"./chunks/Rest.js?ver=1.4.1";import{d as Re,g as ph}from"./chunks/dayjs.min.js?ver=1.4.1";import{a as Pr,E as Ea,m as fh,b as tn,d as Is,i as Xa,c as mh,s as ap,e as dr,f as Jd,r as Zd,g as np,p as Yu,w as hh,h as Nr,l as _h,j as _l,k as gh,n as vh,o as ur,t as yh,q as bh,u as wh,v as Ch,x as Bh,y as kh,z as xh,A as Sh}from"./chunks/index.js?ver=1.4.1";import{_ as eu,a as tu,b as Fh,S as sp,c as lp,d as Eh,A as op,e as rp}from"./chunks/CancelSubscription.js?ver=1.4.1";import{n as q}from"./chunks/Notify.js?ver=1.4.1";import{_ as ra}from"./chunks/Animation.js?ver=1.4.1";import{_ as ts,T as ke,m as Ua,a as jn,i as Mt,r as Uh,L as ed,b as ip,d as dp,c as up}from"./chunks/dateShortCuts.js?ver=1.4.1";import{S as ha,_ as _a,u as ks,a as $h,b as Dh,c as Qh}from"./chunks/countries.js?ver=1.4.1";import{u as xs,L as sa,_ as Kr}from"./chunks/NotFound.js?ver=1.4.1";import{A as Ps}from"./chunks/Asset.js?ver=1.4.1";import{E as Ih}from"./chunks/index2.js?ver=1.4.1";import{S as Gt}from"./chunks/Str.js?ver=1.4.1";import{A as Ke}from"./chunks/Arr.js?ver=1.4.1";import{U as td}from"./chunks/Url.js?ver=1.4.1";import{u as Gr,t as cp}from"./chunks/timezone.js?ver=1.4.1";import{e as lo,i as au,U as nu,p as Th}from"./chunks/Utils.js?ver=1.4.1";import{_ as Bl,P as Ap}from"./chunks/ProductVariationSelector.js?ver=1.4.1";import{B as su}from"./chunks/BundleProducts.js?ver=1.4.1";import{E as qu}from"./chunks/index3.js?ver=1.4.1";import{_ as pp}from"./chunks/FileUploaderDialog.js?ver=1.4.1";import{E as Xs,v as Vh,i as Mh}from"./chunks/defaults.js?ver=1.4.1";import Lh from"./chunks/Screenshot.js?ver=1.4.1";import{u as Rh}from"./chunks/useElementPlusComponents.js?ver=1.4.1";import"./chunks/TransitionAccordion.js?ver=1.4.1";import"./chunks/AddressComponent2.js?ver=1.4.1";import"./chunks/index4.js?ver=1.4.1";class Oh extends Gs{getTabs(){return{}}getToggleableColumns(){return[{label:c("Lifetime Value (LTV)"),value:"ltv"},{label:c("Customer Since"),value:"customer_since"},{label:c("Last Purchase Date"),value:"last_purchase_date"}]}getSortableColumns(){return[{label:c("Customer ID"),value:"id"},{label:c("Name"),value:"first_name"},{label:c("Purchases"),value:"purchase_count"},{label:c("Lifetime Value (LTV)"),value:"ltv"},{label:c("Last Purchase Date"),value:"last_purchase_date"},{label:c("Customer Since"),value:"created_at"}]}getSearchHint(){return c("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}}function fp(e){return Oh.init(e)}const Hh={class:"table-cell"},Ph={class:"fct-product-info-card w-full"},Nh={class:"fct-product-info-media"},Kh={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},Gh={class:"fct-product-info-name flex flex-col items-start gap-3"},jh={class:"table-cell"},zh={class:"table-cell"},Yh={class:"table-cell"},qh={class:"table-cell"};const Wh={__name:"CustomersLoader",props:{nextPageCount:{type:Number,default:0},customerTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(n,s)=>s+1);return(n,s)=>{const o=C("el-table-column"),u=C("el-skeleton-item"),A=C("el-table"),f=C("el-skeleton");return d(),E(f,{animated:""},{template:i(()=>[l(A,{data:p(a),class:"w-full compact-table responsive"},{empty:i(()=>s[0]||(s[0]=[])),default:i(()=>[x("",!0),l(o,{label:n.$t("Customer"),width:"300"},{default:i(()=>[r("div",Hh,[r("div",Ph,[r("div",Nh,[l(u,{varient:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),r("div",Kh,[r("div",Gh,[l(u,{varient:"p",class:"max-w-[190px]"}),l(u,{varient:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),l(o,{label:n.$t("Address"),width:"300"},{default:i(()=>[r("div",jh,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),l(o,{label:n.$t("Purchases"),width:"150"},{default:i(()=>[r("div",zh,[l(u,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("last_purchase_date")?(d(),E(o,{key:1,label:n.$t("Last Purchase Date"),width:"200"},{default:i(()=>[r("div",Yh,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.customerTable.isColumnVisible("customer_since")?(d(),E(o,{key:2,label:n.$t("Customer Since"),width:"150"},{default:i(()=>[r("div",qh,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),(e.customerTable.isColumnVisible("actions"),x("",!0))]),_:1},8,["data"])]),_:1})}}},Xh={key:0,class:"fct-customer-card"},Jh={class:"fct-customer-avatar"},Zh=["src"],e_={class:"fct-customer-details"},t_={class:"fct-customer-name"},a_={class:"fct-customer-id"},n_={class:"fct-customer-email"},s_=["innerHTML"],l_={key:1},o_={__name:"CustomersTable",props:{table:{type:Object,required:!0}},setup(e){return(t,a)=>{const n=C("el-table-column"),s=C("el-table");return d(),E(s,{data:e.table.getTableData(),class:"w-full compact-table"},{empty:i(()=>[l(at,{icon:"Empty/ListView","has-dark":!0,text:p(c)("No customer found!")},null,8,["text"])]),default:i(()=>[x("",!0),l(n,{label:p(c)("Customer"),width:"300"},{default:i(o=>{var u;return[l(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(u=o.row)==null?void 0:u.id}}},{default:i(()=>{var A,f,m,g,y;return[(A=o.row)!=null&&A.id?(d(),_("div",Xh,[r("div",Jh,[r("span",null,[r("img",{src:(f=o.row)==null?void 0:f.photo,alt:"avatar"},null,8,Zh)])]),r("div",e_,[r("div",t_,[R(h(((m=o.row)==null?void 0:m.full_name)||p(c)("No Name"))+" ",1),r("span",a_,"#"+h(p(Kt)((g=o.row)==null?void 0:g.id)),1)]),r("div",n_,h((y=o.row)==null?void 0:y.email),1)])])):x("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),l(n,{label:p(c)("Address"),width:"300"},{default:i(o=>{var u;return[l(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(u=o.row)==null?void 0:u.id}}},{default:i(()=>[R(h(t.getOrderAddress(o.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),l(n,{label:p(c)("Purchases"),width:90},{default:i(o=>{var u;return[l(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(u=o.row)==null?void 0:u.id}}},{default:i(()=>[R(h(p(Kt)(o.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(d(),E(n,{key:1,label:p(c)("LTV"),width:100},{default:i(o=>{var u;return[l(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(u=o.row)==null?void 0:u.id}}},{default:i(()=>[r("span",{innerHTML:p(Te).formatNumber(o.row.ltv,!0,!1)},null,8,s_)]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(d(),E(n,{key:2,label:p(c)("Last Purchase Date"),width:"200"},{default:i(o=>{var u;return[l(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(u=o.row)==null?void 0:u.id}}},{default:i(()=>[o.row.last_purchase_date?(d(),E($a,{key:0,"date-time":o.row.last_purchase_date},null,8,["date-time"])):(d(),_("span",l_,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("customer_since")?(d(),E(n,{key:3,label:p(c)("Customer Since"),width:"150"},{default:i(o=>{var u;return[l(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(u=o.row)==null?void 0:u.id}}},{default:i(()=>[l($a,{"date-time":o.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},r_={class:"fct-customer-table-mobile-wrap"},i_=["onClick"],d_={class:"fct-customer-table-mobile-header"},u_={key:0,class:"fct-customer-table-customer-col fct-customer-card"},c_={class:"fct-customer-avatar"},A_=["src"],p_={class:"fct-customer-details"},f_={class:"fct-customer-name"},m_={class:"fct-customer-id"},h_={class:"fct-customer-email"},__={class:"fct-customer-table-purchases-col"},g_={class:"fct-customer-table-mobile-body"},v_={class:"fct-customer-table-mobile-body-list"},y_={key:0,class:"fct-customer-table-ltv-col"},b_={class:"label"},w_=["innerHTML"],C_={key:1,class:"fct-customer-table-last-purchase-date-col"},B_={class:"label"},k_={class:"value"},x_={key:2,class:"fct-customer-table-customer-since-col"},S_={class:"label"},F_={class:"value"},E_={class:"fct-customer-table-mobile-footer"},U_={class:"fct-customer-table-address-col"},$_={key:0,class:"py-6 text-center"},D_={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:c("No customers found.")}},setup(e){return(t,a)=>(d(),_("div",r_,[(d(!0),_(H,null,ee(e.table.getTableData(),(n,s)=>(d(),_("div",{key:n.id,class:"fct-customer-table-mobile-row",onClick:o=>t.$router.push({name:"view_customer",params:{customer_id:n.id}})},[r("div",d_,[n!=null&&n.id?(d(),_("div",u_,[r("div",c_,[r("img",{src:n==null?void 0:n.photo,alt:"avatar"},null,8,A_)]),r("div",p_,[r("div",f_,[R(h((n==null?void 0:n.full_name)||p(c)("No Name"))+" ",1),r("span",m_,"#"+h(n==null?void 0:n.id),1)]),r("div",h_,h(n==null?void 0:n.email),1)])])):x("",!0),r("div",__,h(n.purchase_count)+" "+h(n.purchase_count>1?p(c)("Purchases"):p(c)("Purchase")),1)]),r("div",g_,[r("ul",v_,[e.table.isColumnVisible("ltv")?(d(),_("li",y_,[r("div",b_,h(p(c)("LTV:")),1),r("div",{class:"value",innerHTML:p(Te).formatNumber(n.ltv,!0,!1)},null,8,w_)])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(d(),_("li",C_,[r("div",B_,h(p(c)("Last Purchase Date:")),1),r("div",k_,[l($a,{"date-time":n.last_purchase_date},null,8,["date-time"])])])):x("",!0),e.table.isColumnVisible("customer_since")?(d(),_("li",x_,[r("div",S_,h(p(c)("Customer Since:")),1),r("div",F_,[l($a,{"date-time":n.created_at},null,8,["date-time"])])])):x("",!0)])]),r("div",E_,[r("div",U_,[l(W,{name:"LocationPin"}),R(" "+h(t.getOrderAddress(n)),1)])])],8,i_))),128)),e.table.getTableData().length===0?(d(),_("div",$_,[l(at,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):x("",!0)]))}},Q_={},I_={class:"px-4 py-3"},T_={class:"flex items-center justify-between mb-3"},V_={class:"flex items-center justify-between mb-3"},M_={class:"flex items-center justify-between mb-3"},L_={class:"flex items-center justify-between mb-3"};function R_(e,t){const a=C("el-skeleton-item"),n=C("el-skeleton");return d(),E(n,{animated:""},{template:i(()=>[r("div",I_,[r("div",T_,[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})]),r("div",V_,[l(a,{varient:"p",class:"w-[50px]"}),l(a,{varient:"p",class:"w-[80px]"})]),r("div",M_,[l(a,{varient:"p",class:"w-[120px]"}),l(a,{varient:"p",class:"w-[100px]"})]),r("div",L_,[l(a,{varient:"p",class:"w-[100px]"}),l(a,{varient:"p",class:"w-[100px]"})]),l(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const O_=He(Q_,[["render",R_]]),H_={class:"fct-all-customers-page fct-layout-width"},P_={class:"fct-all-customers-wrap"},N_={key:1},K_={__name:"AllCustomers",setup(e){const t=fp(),a=V({showModal:!1,action:"create",title:c("Create New Customer"),customer:{}}),n=V(!1),s=()=>{n.value=window.innerWidth<768};return Be(()=>{s(),window.addEventListener("resize",s)}),At(()=>{window.removeEventListener("resize",s)}),(o,u)=>{const A=C("el-button");return d(),_("div",H_,[l(St,{permission:"customers/manage"},{default:i(()=>[l(za,{title:p(c)("Customers")},{action:i(()=>[l(A,{type:"primary",onClick:u[0]||(u[0]=f=>a.value.showModal=!0)},{default:i(()=>[R(h(p(c)("Add Customer")),1)]),_:1})]),_:1},8,["title"])]),_:1}),l(St,{permission:"customers/view"},{default:i(()=>[r("div",P_,[l(js,{table:p(t),"has-mobile-slot":!0},{mobile:i(()=>[p(t).isLoading()?(d(),E(O_,{key:0})):x("",!0),l(D_,{table:p(t)},null,8,["table"])]),default:i(()=>[p(t).isLoading()?(d(),E(Wh,{key:0,customerTable:p(t),"next-page-count":p(t).nextPageCount},null,8,["customerTable","next-page-count"])):(d(),_("div",N_,[l(o_,{table:p(t)},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),l(St,{permission:"customers/manage"},{default:i(()=>[l(qd,{"onUpdate:customerModal":u[1]||(u[1]=()=>{a.value.showModal=!1,a.value.customer={},p(t).fetch()}),customerModalInfos:a.value,customer_id:a.value.customer_id,customer:a.value.customer,onCloseModal:u[2]||(u[2]=f=>a.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"])]),_:1})])}}};class G_ extends Gs{getTabs(){return{all:c("All"),completed:c("Completed"),processing:c("Processing"),"on-hold":c("On Hold"),paid:c("Paid"),subscription:c("Subscription"),renewal:c("Renewal"),refunded:c("Refunded"),partially_refunded:c("Partially Refunded"),upgraded_from:{title:c("Upgraded From"),description:c("Orders upgraded from another order")},upgraded_to:{title:c("Upgraded To"),description:c("Orders upgraded to another order")}}}getToggleableColumns(){return[{label:c("Customer"),value:"customer"},{label:c("Items"),value:"order_items"},{label:c("Order Status"),value:"status"},{label:c("Order Type"),value:"type"},{label:c("Actions"),value:"actions"}]}getSortableColumns(){return[{label:c("Order ID"),value:"id"},{label:c("Total"),value:"total_amount"},{label:c("Payment Status"),value:"payment_status"},{label:c("Order Status"),value:"status"}]}getSearchHint(){return c("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 mp(e){return G_.init(e)}const j_={class:"fct-order-stats-card"},z_={class:"fct-order-stats-card-head"},Y_={class:"fct-order-stats-card-head-content"},q_={class:"text"},W_={key:0,class:"value"},X_={class:"fct-order-stats-card-body"},J_={key:0,class:"change-wrap"},Z_={key:0,class:"change-title"},eg={key:1,class:"change-title"},tg={key:1,class:"change-wrap"},ag={class:"change-title"},ng={__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,n=j(()=>{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=j(()=>u.value===0?"":u.value>0?"success":"danger"),o=f=>f.is_cents?t.formatNumber(f.current_count):Kt(f.current_count),u=j(()=>{let f=uh(a.stat.current_count,a.stat.compare_count)??0;return f===""?0:f}),A=j(()=>a.statRanges[a.currentRange].label);return(f,m)=>{const g=C("el-skeleton"),y=C("el-skeleton-item");return d(),_("div",j_,[r("div",z_,[l(Oe,{size:"large",bg:n.value,soft:""},{default:i(()=>[oa(f.$slots,"icon")]),_:3},8,["bg"]),r("div",Y_,[l(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),r("span",q_,h(e.stat.title),1),e.loading?x("",!0):(d(),_("div",W_,h(o(e.stat)),1))])]),r("div",X_,[l(g,{loading:e.loading,animated:""},{template:i(()=>[l(y,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(d(),_("div",J_,[r("span",{class:de("change "+s.value)},[u.value!==0?(d(),E(W,{key:0,name:u.value>0?"CaretUp":"CaretDown"},null,8,["name"])):x("",!0),R(" "+h(u.value===0?f.$t("Same as previous"):Math.abs(u.value)+"%"),1)],2),u.value>0?(d(),_("span",Z_,h(p(c)("More than %s",A.value==="Today"?f.$t("Yesterday"):f.$t(A.value))),1)):u.value<0?(d(),_("span",eg,h(p(c)("Less than %s",A.value==="Today"?f.$t("Yesterday"):f.$t(A.value))),1)):x("",!0)])):x("",!0),!e.loading&&e.currentRange==="all_time"?(d(),_("div",tg,[r("span",ag,h(f.$t("All Time")),1)])):x("",!0)])])}}},sg={name:"CardFooter"},lg={class:"fct-card-footer"};function og(e,t,a,n,s,o){return d(),_("div",lg,[oa(e.$slots,"default")])}const lu=He(sg,[["render",og]]);class hp{constructor(){Ee(this,"_attributes",{})}attribute(t,a){return this._attributes[t]=a,this}setAttribute(t){return this._attributes=typeof t=="object"?t:this._attributes,this}}class ys{static install(t,a,n={},s=!1){const o=new a(...Object.values(n));Object.keys(o).forEach(u=>{(s||!t.hasOwnProperty(u))&&(t[u]=o[u])}),Object.getOwnPropertyNames(a.prototype).forEach(u=>{u!=="constructor"&&typeof o[u]=="function"&&(s||typeof t[u]!="function")&&(t[u]=o[u].bind(t))})}}class rg extends Ya{constructor(){super(...arguments);Ee(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:Ie.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,n,s,o){this.data.isBusy[o]=!0,typeof n!="object"&&(n={});const u=re.get(`reports/${a}`,n);return this.resolvePromiseResponse(u,s,o),u}resolvePromiseResponse(a,n=null,s=null){a.then(o=>{s==null||n==null||(this.data[s]=o[n])}).catch(o=>{}).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 Ia=rg.init(),ig={},dg={class:"fct-order-stats-row"},ug={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},cg={class:"flex items-center gap-2 mb-3"},Ag={class:"right flex flex-col flex-1 gap-2"};function pg(e,t){const a=C("el-skeleton-item"),n=C("el-skeleton");return d(),_("div",dg,[(d(),_(H,null,ee(4,s=>l(n,{animated:"",key:s},{template:i(()=>[r("div",ug,[r("div",cg,[l(a,{variant:"p",class:"rounded w-10 h-10 block"}),r("div",Ag,[l(a,{variant:"p",class:"rounded w-4/5 block"}),l(a,{variant:"p",class:"rounded w-1/2 block"})])]),r("div",null,[l(a,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64))])}const fg=He(ig,[["render",pg]]),mg={class:"fct-order-stats-wrap"},hg={class:"fct-order-stats-actions flex items-center gap-2.5"},_g={class:"fct-order-stats-body"},gg={key:1,class:"fct-order-stats-row"},vg={class:"flex justify-end mt-2"},yg=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=V(vt.get("order_stat_collapse",!1)),a=V(""),n=Qt().ctx,s=V(!1),o=V(!0),u=V(!1),A=V("-7 days"),f=ja(),m=V({"-0 days":{label:c("Today"),desc:c("Compared to yesterday")},"-7 days":{label:c("Last 7 days"),desc:c("Compared to the previous 7 days")},"-30 days":{label:c("Last 30 days"),desc:c("Compared to the previous 30 days")},this_month:{label:c("This Month"),desc:c("Compared to the previous Month")},all_time:{label:c("All Time"),desc:c("See All time Sales Stat")}}),g=async v=>{if(A.value!==v)try{A.value=v,a.value="collapse",t.value===!0&&(t.value=!1,vt.set("order_stat_collapse",t.value)),await Promise.all([n.Storage().set("order_quick_stat_bar_range",A.value),y()])}catch{}},y=()=>{u.value=!1,o.value=!0;const v={"-0 days":[Re().startOf("day").format("YYYY-MM-DD"),Re().endOf("day").format("YYYY-MM-DD")],"-7 days":[Re().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),Re().endOf("day").format("YYYY-MM-DD")],"-30 days":[Re().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),Re().endOf("day").format("YYYY-MM-DD")],this_month:[Re().startOf("month").format("YYYY-MM-DD"),Re().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[B,b]=v[A.value]||[Re().startOf("month"),Re().endOf("day")],w={startDate:B,endDate:b,paymentStatus:"all"};Ia.getDashboardStats({params:{...w}}).then(()=>{s.value=Ia.data.dashBoardStats}).catch(k=>{}).finally(()=>{o.value=!1})};return Be(()=>{A.value=vt.get("order_quick_stat_bar_range","-0 days");let v=vt.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,y()}),(v,B)=>{const b=C("el-button");return d(),_("div",mg,[l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Order Stats Overview"),border_bottom:""},{action:i(()=>[r("div",hg,[l(Yd,{class:"hide-animation-on-mobile"},{default:i(()=>[(d(!0),_(H,null,ee(m.value,(w,k)=>(d(),E(rr,{title:`${p(c)("Order Stats Overview of")} ${w.label}`,tabindex:"0",key:k,onClick:S=>g(k),class:de(k===A.value?"active":"")},{default:i(()=>[R(h(w.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),l(me,null,{default:i(()=>[r("div",_g,[o.value?(d(),E(fg,{key:0})):(d(),_("div",gg,[(d(!0),_(H,null,ee(s.value,(w,k)=>(d(),_("div",{key:k,class:"fct-order-stats-col cursor-pointer",onClick:B[0]||(B[0]=S=>p(f).push({name:"reports_orders"}))},[(d(),E(ng,{key:k,stat:w,"current-range":A.value,"stat-ranges":m.value,loading:o.value,"stat-key":k},{icon:i(()=>[l(W,{name:w.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),r("div",vg,[l(b,{text:"",class:"underline-link-button",onClick:B[1]||(B[1]=w=>p(f).push({name:"reports_orders"}))},{default:i(()=>[R(h(p(c)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),bg={class:"table-cell"},wg={class:"table-cell"},Cg={class:"table-cell"},Bg={class:"table-cell"},kg={class:"table-cell items-center gap-1"},xg={class:"table-cell"},Sg={class:"table-cell"},Fg={class:"table-cell"},Eg={__name:"OrdersLoader",props:{nextPageCount:{type:Number,default:0},orderTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=s=>t.orderTable.columns.includes(s),n=Array.from({length:t.nextPageCount},(s,o)=>o+1);return(s,o)=>{const u=C("el-table-column"),A=C("el-skeleton-item"),f=C("el-table"),m=C("el-skeleton");return d(),E(m,{animated:""},{template:i(()=>[l(f,{data:p(n),class:"w-full compact-table responsive"},{empty:i(()=>o[0]||(o[0]=[])),default:i(()=>[x("",!0),l(u,{label:s.$t("# Date"),width:140},{default:i(()=>[r("div",bg,[l(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(d(),E(u,{key:1,width:"100",label:s.$t("Customer")},{default:i(()=>[r("div",wg,[l(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("order_items")?(d(),E(u,{key:2,label:s.$t("Items"),width:"250"},{default:i(()=>[r("div",Cg,[l(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),l(u,{width:"100",label:s.$t("Total")},{default:i(()=>[r("div",Bg,[l(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),l(u,{width:"150",label:s.$t("Payment Status")},{default:i(()=>[r("div",kg,[l(A,{varient:"p",class:"w-4/5"}),l(A,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(d(),E(u,{key:3,width:"150",label:s.$t("Status")},{default:i(()=>[r("div",xg,[l(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("type")?(d(),E(u,{key:4,width:"110",label:s.$t("Order Type")},{default:i(()=>[r("div",Sg,[l(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("actions")?(d(),E(u,{key:5,width:"60",label:""},{default:i(()=>[r("div",Fg,[l(A,{varient:"p",class:"w-3/5"})])]),_:1})):x("",!0)]),_:1},8,["data"])]),_:1})}}},Ug={},$g={class:"px-4 py-3"},Dg={class:"grid grid-cols-3 gap-5 mt-5"};function Qg(e,t){const a=C("el-skeleton-item"),n=C("el-skeleton");return d(),E(n,{animated:""},{template:i(()=>[r("div",$g,[(d(),_(H,null,ee(2,s=>r("div",{key:s,class:"flex items-center justify-between mb-3"},[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})])),64)),r("div",Dg,[(d(),_(H,null,ee(3,s=>r("div",{key:s},[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const Ig=He(Ug,[["render",Qg]]),Tg={class:"fct-all-orders-page fct-layout-width"},Vg={class:"fct-delete-test-orders-content"},Mg={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},Lg={class:"fct-delete-test-orders-meta"},Rg={class:"fct-delete-test-orders-text"},Og={key:0,class:"fct-delete-test-orders-loading"},Hg={class:"fct-test-orders-loading-content"},Pg={class:"fct-loading-bars"},Ng=["id"],Kg={class:"fct-delete-test-orders-percentage"},Gg={class:"fct-delete-test-orders-stats"},jg={class:"fct-delete-test-orders-stat-row"},zg={class:"fct-delete-test-orders-stat-label"},Yg={class:"fct-delete-test-orders-stat-value"},qg={class:"fct-delete-test-orders-stat-row"},Wg={class:"fct-delete-test-orders-stat-label"},Xg={class:"fct-delete-test-orders-stat-value is-success"},Jg={class:"fct-delete-test-orders-stat-row"},Zg={class:"fct-delete-test-orders-stat-label"},ev={class:"fct-delete-test-orders-stat-value is-danger"},tv={key:1,class:"fct-delete-test-orders-message"},av={key:0,class:"dialog-footer"},nv={class:"fct-all-orders-wrap"},sv={__name:"AllOrders",setup(e){const t=mp({instance:Qt()}),a=V(!1),n=V(!1),s=V(!1),o=V(!1),u=V({total:0,processed:0,deleted:0,failed:0}),A=V(""),f=j(()=>u.value.total?Math.min(100,Math.round(u.value.processed/u.value.total*100)):0),m=j(()=>{if(!u.value.total)return"";const S=Math.min(u.value.processed,u.value.total);return s.value?c("Deleting %1$s of %2$s Test Orders",S,u.value.total):c("Deleted %1$s of %2$s Test Orders",S,u.value.total)}),g=j(()=>u.value.total?s.value?c("Deleting... %s%",f.value):c("Completed"):""),y=()=>{n.value=window.innerWidth<768},v=()=>{u.value={total:0,processed:0,deleted:0,failed:0},A.value=""},B=S=>{S==="show_order_stats"&&(vt.set("show_order_stats",!a.value),a.value=!a.value),S==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),S==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),S==="delete_test_orders"&&b()},b=async()=>{var S,M;if(!s.value){try{await Ea.confirm(c("Are you sure you want to delete all test orders? This action cannot be undone."),c("Confirm Delete!"),{confirmButtonText:c("Delete"),cancelButtonText:c("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"})}catch{return}s.value=!0,o.value=!0,v();try{let $=0,F=0,L=0;for(;;){const T=await re.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:$}),D=T||{};if(F=F||Number(D.total_count||0),L+=Number(D.batch_count||0),u.value={total:F,processed:L,deleted:u.value.deleted+Number(D.deleted_count||0),failed:u.value.failed+Number(D.failed_count||0)},A.value=D.has_more?c("Processed %1$s of %2$s test orders...",Math.min(L,F),F):(T==null?void 0:T.message)||"",!D.has_more)break;$=Number(D.last_attempted_order_id||0),await new Promise(U=>setTimeout(U,100))}if(!u.value.total){o.value=!1,q.info(c("No test orders found to delete"));return}const Q=u.value.failed?c("Deleted %1$s test orders. %2$s test orders could not be deleted.",u.value.deleted,u.value.failed):c("Deleted %s test orders successfully",u.value.deleted);A.value=Q,q.success(Q),t.fetch()}catch($){A.value=((S=$==null?void 0:$.data)==null?void 0:S.message)||c("Failed to delete test orders"),q.error(((M=$==null?void 0:$.data)==null?void 0:M.message)||c("Failed to delete test orders"))}finally{s.value=!1}}},w=()=>{o.value=!1},k=()=>{const S=vt.get("show_order_stats");S&&(a.value=S)};return Be(()=>{k(),y(),window.addEventListener("resize",y)}),At(()=>{window.removeEventListener("resize",y)}),(S,M)=>{const $=C("el-icon"),F=C("el-button"),L=C("el-dropdown-item"),Q=C("el-dropdown-menu"),T=C("el-dropdown"),D=C("el-tag"),U=C("el-progress"),I=C("el-dialog");return d(),_("div",Tg,[l(za,{title:p(c)("Orders")},{action:i(()=>[l(St,{permission:["reports/view","orders/manage"]},{default:i(()=>[l(T,{trigger:"click","popper-class":"fct-dropdown",onCommand:B,placement:"bottom-end"},{dropdown:i(()=>[l(Q,null,{default:i(()=>[l(St,{permission:"reports/view"},{default:i(()=>[l(L,{command:"show_order_stats"},{default:i(()=>[a.value?(d(),_(H,{key:1},[l(W,{name:"EyeOff"}),R(" "+h(p(c)("Hide Order Stats")),1)],64)):(d(),_(H,{key:0},[l(W,{name:"Eye"}),R(" "+h(p(c)("Show Order Stats")),1)],64))]),_:1}),p(t).data.showDeleteBulkAction?x("",!0):(d(),E(L,{key:0,command:"show_delete_bulk_action"},{default:i(()=>[l(W,{name:"Eye"}),R(" "+h(p(c)("Show Bulk Actions")),1)]),_:1})),p(t).data.showDeleteBulkAction?(d(),E(L,{key:1,command:"hide_delete_bulk_action"},{default:i(()=>[l(W,{name:"EyeOff"}),R(" "+h(p(c)("Hide Bulk Actions")),1)]),_:1})):x("",!0)]),_:1}),l(St,{permission:"orders/manage"},{default:i(()=>[l(L,{command:"delete_test_orders",disabled:s.value,class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(s.value?p(c)("Deleting Test Orders..."):p(c)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),default:i(()=>[l(F,null,{default:i(()=>[R(h(p(c)("More actions"))+" ",1),l($,null,{default:i(()=>[l(p(Pr))]),_:1})]),_:1})]),_:1})]),_:1}),l(St,{permission:"orders/create"},{default:i(()=>[l(F,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:i(()=>[R(h(p(c)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),l(I,{modelValue:o.value,"onUpdate:modelValue":M[0]||(M[0]=O=>o.value=O),title:p(c)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:w,class:"fct-delete-test-orders-modal"},{footer:i(()=>[s.value?x("",!0):(d(),_("div",av,[l(F,{type:"primary",onClick:w},{default:i(()=>[R(h(p(c)("Done")),1)]),_:1})]))]),default:i(()=>[r("div",Vg,[r("div",Mg,h(m.value),1),r("div",Lg,[r("div",Rg,h(s.value?p(c)("You can close this — deletion will continue in the background"):p(c)("Test order deletion completed.")),1),g.value?(d(),E(D,{key:0,type:"success",class:de(["fct-delete-test-orders-status",{"is-complete":!s.value}])},{default:i(()=>[R(h(g.value),1)]),_:1},8,["class"])):x("",!0)]),s.value?(d(),_("div",Og,[r("div",Hg,[r("div",Pg,[(d(),_(H,null,ee(8,O=>r("div",{key:O,class:"bar-block",id:`bar-block-${O+1}`},null,8,Ng)),64))]),R(" "+h(p(c)("Deleting...")),1)]),r("span",Kg,h(f.value)+"% ",1)])):x("",!0),l(ra,{visible:s.value,fade:"",duration:300},{default:i(()=>[l(U,{percentage:f.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"]),r("div",Gg,[r("div",jg,[M[1]||(M[1]=r("span",{class:"fct-delete-test-orders-stat-icon"},[r("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[r("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"}),r("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)),r("span",zg,h(p(c)("Processed")),1),r("span",Yg,h(u.value.processed)+" / "+h(u.value.total),1)]),r("div",qg,[M[2]||(M[2]=r("span",{class:"fct-delete-test-orders-stat-icon"},[r("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[r("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"}),r("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)),r("span",Wg,h(p(c)("Deleted")),1),r("span",Xg,h(u.value.deleted),1)]),r("div",Jg,[M[3]||(M[3]=r("span",{class:"fct-delete-test-orders-stat-icon"},[r("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[r("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"}),r("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)),r("span",Zg,h(p(c)("Failed")),1),r("span",ev,h(u.value.failed),1)])]),A.value&&!s.value?(d(),_("p",tv,h(A.value),1)):x("",!0)])]),_:1},8,["modelValue","title"]),l(St,{permission:"reports/view"},{default:i(()=>[a.value?(d(),E(yg,{key:0})):x("",!0)]),_:1}),l(St,{permission:"orders/view"},{default:i(()=>[r("div",nv,[l(js,{table:p(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:i(()=>[p(t).isLoading()?(d(),E(Ig,{key:0})):x("",!0),p(t).isLoading()?x("",!0):(d(),E(tu,{key:1,table:p(t),orders:p(t).getTableData(),columns:p(t).data.columns,"empty-text":p(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),default:i(()=>[p(t).isLoading()?(d(),E(Eg,{key:0,orderTable:p(t),"next-page-count":p(t).nextPageCount},null,8,["orderTable","next-page-count"])):(d(),E(eu,{key:1,table:p(t),orders:p(t).getTableData(),columns:p(t).data.columns,"empty-text":p(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1})])}}},lv={class:"setting-wrap"},ov={class:"setting-wrap-inner"},rv={class:"setting-confirmation-content"},iv={class:"custom-wp-editor-wrapper"},dv={class:"setting-save-action"},uv={__name:"InvoicePacking",setup(e){const t=V([]),a=V([]),n=V(!1),s=V(!1);xs().onSave(()=>{m()});const u=V([c("Invoice Template"),c("Packing Slip Template"),c("Delivery Slip Template"),c("Shipping Slip Template"),c("Dispatch Slip Template")]),A=()=>{n.value=!0,re.get("templates/print-templates").then(g=>{t.value=g.templates,n.value=!1}).catch(g=>{q.error(g)}).finally(()=>{n.value=!1})},f=()=>{n.value=!0,re.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{q.error(g)}).finally(()=>{n.value=!1})},m=()=>{s.value=!0,re.put("templates/print-templates",{templates:t.value}).then(g=>{q.success(g.message)}).catch(g=>{q.error(g)}).finally(()=>{s.value=!1})};return Be(()=>{A(),f()}),(g,y)=>{const v=C("el-skeleton");return C("el-button"),d(),_("div",lv,[l(ha,{heading:p(c)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),r("div",ov,[l(_a),l(Na,{class:"mb-5",type:"information",content:p(c)("It will be available soon!")},null,8,["content"]),n.value?(d(!0),_(H,{key:0},ee(u.value,(B,b)=>(d(),E(he,{key:b},{default:i(()=>[l(Ce,{title:B,border_bottom:""},null,8,["title"]),l(me,null,{default:i(()=>[l(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):x("",!0),!n.value&&t.value.length>0?(d(),_(H,{key:1},[(d(!0),_(H,null,ee(t.value,(B,b)=>(d(),E(he,{key:b},{default:i(()=>[l(Ce,{title:B.title+" (Under Development)",border_bottom:""},null,8,["title"]),l(me,null,{default:i(()=>[r("div",rv,[r("div",iv,[l(ts,{"short-codes":a.value,modelValue:B.content,"onUpdate:modelValue":w=>B.content=w,onUpdate:w=>{B.content=w}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),r("div",dv,[x("",!0)])],64)):x("",!0)])])}}},cv={class:"fct-pdf-pro-gate"},Av={class:"fct-pdf-pro-gate-inner"},pv={class:"fct-pdf-pro-heading"},fv={class:"fct-pdf-pro-icon"},mv={class:"fct-pdf-pro-label"},hv={class:"fct-pdf-pro-badge"},_v={class:"fct-pdf-pro-desc"},gv={__name:"PdfTemplateProGate",setup(e){return(t,a)=>{const n=C("el-button");return d(),_("div",cv,[r("div",Av,[r("div",pv,[r("div",fv,[l(W,{name:"Crown"})]),r("span",mv,h(p(c)("PDF Templates")),1),r("span",hv,h(p(c)("Pro")),1)]),r("p",_v,h(p(c)("Customizable PDF receipts, invoices, and e-invoices with ZUGFeRD support.")),1),l(n,{type:"primary",size:"small",tag:"a",href:"https://fluentcart.com/pricing/",target:"_blank"},{default:i(()=>[l(W,{name:"Crown"}),R(" "+h(p(c)("Upgrade to Pro")),1)]),_:1})])])}}},vv=He(gv,[["__scopeId","data-v-83e6a503"]]),yv={__name:"PdfTemplateRoute",setup(e){const t=Ie.get("app_config.isProActive");return(a,n)=>{const s=C("router-view");return p(t)?(d(),E(s,{key:1})):(d(),E(vv,{key:0}))}}},bv={class:"setting-wrap"},wv={class:"setting-wrap-inner"},Cv={class:"flex gap-5"},Bv={class:"flex flex-col items-center justify-center py-12 text-center"},kv={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},xv={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},Sv={class:"fct-pdf-template-desc"},Fv={class:"fct-pdf-template-grid"},Ev={class:"fct-pdf-template-preview"},Uv={class:"fct-pdf-template-preview-placeholder"},$v={class:"fct-pdf-placeholder-text"},Dv={class:"fct-pdf-template-overlay"},Qv={class:"fct-pdf-template-footer"},Iv={class:"fct-pdf-template-name-row"},Tv={class:"fct-pdf-template-title"},Vv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},Mv={__name:"PdfTemplateIndex",setup(e){const t=ja(),a=V(!0),n=V(!1),s=V({}),o=V(!1),u=V(""),A=V(!1),f=V(""),m=V(null),g=V(!1),y=V(!1),v=Ie.get("app_config.isProActive"),B=()=>{a.value=!0,re.get("settings/pdf-templates/receipt").then($=>{s.value=$.templates||{},n.value=$.has_fluent_pdf||!1,m.value=$.addon_info||null}).catch($=>{var F;q.error(((F=$.data)==null?void 0:F.message)||c("Failed to load templates"))}).finally(()=>{a.value=!1})},b=()=>{if(m.value){if(!v&&m.value.repo_link){window.open(m.value.repo_link,"_blank","noopener,noreferrer");return}g.value=!0,re.post("settings/modules/plugin-addons/install",{plugin_slug:m.value.plugin_slug,source_type:m.value.source_type||"wordpress",source_link:m.value.source_link||"",asset_path:m.value.asset_path||""}).then($=>{q.success($.message||c("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var F;q.error(((F=$.data)==null?void 0:F.message)||c("Failed to install plugin"))}).finally(()=>{g.value=!1})}},w=()=>{m.value&&(y.value=!0,re.post("settings/modules/plugin-addons/activate",{plugin_file:m.value.plugin_file}).then($=>{q.success($.message||c("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var F;q.error(((F=$.data)==null?void 0:F.message)||c("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},k=()=>{u.value="",o.value=!0},S=()=>{if(!u.value.trim()){q.error(c("Please enter a template name"));return}A.value=!0,re.post("settings/pdf-templates/create",{title:u.value.trim()}).then($=>{o.value=!1,q.success($.message||c("Template created")),$.slug?t.push({name:"edit-pdf-template",params:{template:$.slug}}):B()}).catch($=>{var F;q.error(((F=$.data)==null?void 0:F.message)||c("Failed to create template"))}).finally(()=>{A.value=!1})},M=$=>{f.value=$,re.delete("settings/pdf-templates/delete/"+$).then(F=>{q.success(F.message||c("Template deleted")),B()}).catch(F=>{var L;q.error(((L=F.data)==null?void 0:L.message)||c("Failed to delete template"))}).finally(()=>{f.value=""})};return Be(()=>{B()}),($,F)=>{const L=C("el-button"),Q=C("el-skeleton-item"),T=C("el-skeleton"),D=C("el-popconfirm"),U=C("el-input"),I=C("el-form-item"),O=C("el-form"),P=C("el-dialog");return d(),_("div",bv,[l(ha,{heading:p(c)("PDF Templates"),"show-save-button":!1},Rt({_:2},[n.value?{name:"action",fn:i(()=>[l(L,{type:"primary",size:"small",onClick:k},{default:i(()=>[R(h(p(c)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),r("div",wv,[l(_a),a.value?(d(),E(he,{key:0},{default:i(()=>[l(me,null,{default:i(()=>[l(T,{animated:""},{template:i(()=>[l(Q,{variant:"text",class:"w-[300px] mb-4"}),r("div",Cv,[l(Q,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),l(Q,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):x("",!0),!a.value&&!n.value&&m.value?(d(),E(he,{key:1},{default:i(()=>[l(me,null,{default:i(()=>[r("div",Bv,[F[3]||(F[3]=r("svg",{class:"mb-4",width:"48",height:"48",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[r("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"}),r("path",{d:"M18 2v8h8"}),r("path",{d:"M12 18h8M12 22h6"})],-1)),r("h3",kv,h(p(c)("Fluent PDF Required")),1),r("p",xv,h(p(c)("To use PDF receipt templates, you need to install and activate the Fluent PDF plugin.")),1),m.value.is_installed?m.value.is_installed&&!m.value.is_active?(d(),E(L,{key:1,type:"success",loading:y.value,onClick:w},{default:i(()=>[R(h(p(c)("Activate Plugin")),1)]),_:1},8,["loading"])):x("",!0):(d(),E(L,{key:0,type:"primary",loading:g.value,onClick:b},{default:i(()=>[R(h(p(v)?p(c)("Install & Activate"):p(c)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):x("",!0),!a.value&&n.value?(d(),E(he,{key:2},{default:i(()=>[l(me,null,{default:i(()=>[r("p",Sv,h(p(c)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),r("div",Fv,[(d(!0),_(H,null,ee(s.value,(K,G)=>(d(),_("div",{key:G,class:"fct-pdf-template-card"},[r("div",Ev,[r("div",Uv,[F[4]||(F[4]=r("svg",{width:"40",height:"40",viewBox:"0 0 32 32",fill:"none",stroke:"#525866","stroke-width":"1.2"},[r("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"}),r("path",{d:"M18 2v8h8"}),r("path",{d:"M12 18h8M12 22h6"})],-1)),r("span",$v,h(K.title||p(c)("Receipt Template")),1)]),r("div",Dv,[l(L,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:G}}},{default:i(()=>[R(h(p(c)("Edit Template")),1)]),_:2},1032,["to"])])]),r("div",Qv,[r("div",Iv,[r("span",Tv,h(K.title||G),1),K.is_default?(d(),_("span",Vv,h(p(c)("Built-in")),1)):x("",!0)]),K.is_default?x("",!0):(d(),E(D,{key:0,title:p(c)("Delete this template?"),"confirm-button-text":p(c)("Delete"),"cancel-button-text":p(c)("Cancel"),"confirm-button-type":"danger",onConfirm:ne=>M(G)},{reference:i(()=>[l(L,{type:"danger",size:"small",text:"",loading:f.value===G,class:"fct-pdf-delete-btn"},{default:i(()=>F[5]||(F[5]=[r("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("path",{d:"M3 6h18"}),r("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1)])),_:2,__:[5]},1032,["loading"])]),_:2},1032,["title","confirm-button-text","cancel-button-text","onConfirm"]))])]))),128))])]),_:1})]),_:1})):x("",!0)]),l(P,{modelValue:o.value,"onUpdate:modelValue":F[2]||(F[2]=K=>o.value=K),title:p(c)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:i(()=>[l(L,{onClick:F[1]||(F[1]=K=>o.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(L,{type:"primary",onClick:S,loading:A.value},{default:i(()=>[R(h(p(c)("Create")),1)]),_:1},8,["loading"])]),default:i(()=>[l(O,{onSubmit:Xe(S,["prevent"]),"label-position":"top"},{default:i(()=>[l(I,{label:p(c)("Template Name")},{default:i(()=>[l(U,{modelValue:u.value,"onUpdate:modelValue":F[0]||(F[0]=K=>u.value=K),placeholder:p(c)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},Lv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},Rv={class:"fct-email-body-skeleton"},Ov={class:"fct-email-body-skeleton__page"},Hv={key:0,class:"fct-ebs__badge"},Pv={class:"fct-ebs__badge-text"};function Nv(e,t,a,n,s,o){return d(),_("div",Rv,[r("div",Ov,[t[3]||(t[3]=ao('<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?(d(),_("div",Hv,[t[0]||(t[0]=r("span",{class:"fct-ebs__dot"},null,-1)),t[1]||(t[1]=r("span",{class:"fct-ebs__dot"},null,-1)),t[2]||(t[2]=r("span",{class:"fct-ebs__dot"},null,-1)),r("span",Pv,h(e.$t("Loading block editor…")),1)])):x("",!0)])])}const ad=He(Lv,[["render",Nv]]),Kv={name:"NewEditorFrame",components:{EmailBodySkeleton:ad},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)}}},Gv={style:{width:"100%"}},jv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},zv={class:"editor-container",style:{position:"relative"}},Yv={key:0,class:"fct-editor-skeleton"},qv={ref:"iframeContainer",class:"iframe-container"};function Wv(e,t,a,n,s,o){const u=C("EmailBodySkeleton");return d(),_("div",Gv,[o.editorFailed?(d(),_("div",jv,[r("p",null,h(e.$t("Problem with loading the editor. Please reload the page.")),1)])):x("",!0),r("div",zv,[l(vs,{name:"fct-skeleton-fade"},{default:i(()=>[s.editorContentReady?x("",!0):(d(),_("div",Yv,[t[0]||(t[0]=r("div",{class:"fct-skel-menubar"},[r("div",{class:"fct-skel fct-skel-logo"}),r("div",{class:"fct-skel-slash"}),r("div",{class:"fct-skel fct-skel-name"}),r("div",{class:"fct-skel-spacer"}),r("div",{class:"fct-skel fct-skel-btn-wide"}),r("div",{class:"fct-skel-dot"}),r("div",{class:"fct-skel-dot"})],-1)),t[1]||(t[1]=r("div",{class:"fct-skel-toolbar"},[r("div",{class:"fct-skel fct-skel-tb-btn"}),r("div",{class:"fct-skel fct-skel-tb-btn"}),r("div",{class:"fct-skel fct-skel-tb-btn"}),r("div",{class:"fct-skel-sep"}),r("div",{class:"fct-skel fct-skel-tb-btn"}),r("div",{class:"fct-skel fct-skel-tb-btn"}),r("div",{class:"fct-skel-sep"}),r("div",{class:"fct-skel fct-skel-tb-wide"}),r("div",{class:"fct-skel fct-skel-tb-wide"}),r("div",{class:"fct-skel-sep"}),r("div",{class:"fct-skel fct-skel-tb-btn"})],-1)),l(u,{"show-loading-badge":!0})]))]),_:1}),r("div",qv,null,512)])])}const _p=He(Kv,[["render",Wv],["__scopeId","data-v-e5dae537"]]),Xv={class:"setting-wrap fct-pdf-template-edit-wrapper"},Jv={class:"capitalize"},Zv={class:"setting-wrap-inner"},e1={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},t1={class:"setting-save-action"},a1={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=ja(),n=V(!0),s=V(!1),o=V(!1),u=V(!1),A=V(null),f=V(null),m=V(""),g=F=>{const L=atob(F),Q=new Array(L.length);for(let T=0;T<L.length;T++)Q[T]=L.charCodeAt(T);return new Blob([new Uint8Array(Q)],{type:"application/pdf"})},y=async()=>{const F=await re.post("settings/pdf-templates/download",{template_id:t.template});if(!(F!=null&&F.pdf_base64))throw new Error(c("Failed to generate PDF"));return F},v=()=>{n.value=!0,re.get("settings/pdf-templates/receipt/"+t.template).then(F=>{var Q,T,D;A.value=F.template;const L=(D=(T=(Q=F.template)==null?void 0:Q.pdf_settings)==null?void 0:T[0])==null?void 0:D.pdf_structure;L&&(m.value=L.content||"")}).catch(F=>{var L;q.error(((L=F.data)==null?void 0:L.message)||c("Failed to load template"))}).finally(()=>{n.value=!1})},B=async({showSuccess:F=!0}={})=>{var Q,T,D,U;s.value=!0,f.value&&await f.value.forceAutosave();const L=((D=(T=(Q=A.value)==null?void 0:Q.pdf_settings)==null?void 0:T[0])==null?void 0:D.pdf_structure)||{};L.content=m.value;try{const I=await re.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:L});return F&&q.success(I.message||c("Template saved")),!0}catch(I){return q.error(((U=I.data)==null?void 0:U.message)||c("Failed to save template")),!1}finally{s.value=!1}},b=()=>{o.value=!0,y().then(F=>{const L=g(F.pdf_base64),Q=URL.createObjectURL(L),T=document.createElement("a");T.href=Q,T.download=F.filename||"receipt-test.pdf",document.body.appendChild(T),T.click(),document.body.removeChild(T),URL.revokeObjectURL(Q),q.success(c("PDF downloaded"))}).catch(F=>{var L;q.error(((L=F.data)==null?void 0:L.message)||F.message||c("Failed to generate PDF"))}).finally(()=>{o.value=!1})},w=async()=>{var F;u.value=!0;try{const L=await y(),Q=g(L.pdf_base64),T=URL.createObjectURL(Q),D=document.createElement("a");D.href=T,D.target="_blank",D.rel="noopener",document.body.appendChild(D),D.click(),document.body.removeChild(D),setTimeout(()=>{URL.revokeObjectURL(T)},1e4)}catch(L){q.error(((F=L.data)==null?void 0:F.message)||L.message||c("Failed to generate PDF"))}finally{u.value=!1}},k=async()=>{s.value||o.value||u.value||!await B({showSuccess:!1})||await w()},S=()=>A.value&&!A.value.is_default,M=()=>{re.delete("settings/pdf-templates/delete/"+t.template).then(F=>{q.success(F.message||c("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(F=>{var L;q.error(((L=F.data)==null?void 0:L.message)||c("Failed to delete template"))})},$=()=>{re.get("settings/pdf-templates/factory-default").then(F=>{var T,D,U;const L=(T=F.templates)==null?void 0:T[t.template];if(!L)return;const Q=((U=(D=L.pdf_settings)==null?void 0:D[0])==null?void 0:U.pdf_structure)||{};return re.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:Q}).then(()=>{q.success(c("Reverted to default template")),v()})}).catch(F=>{var L;q.error(((L=F.data)==null?void 0:L.message)||c("Failed to revert template"))})};return Be(()=>{v()}),(F,L)=>{const Q=C("el-breadcrumb-item"),T=C("el-breadcrumb"),D=C("el-icon"),U=C("el-button"),I=C("el-dropdown-item"),O=C("el-dropdown-menu"),P=C("el-dropdown"),K=C("el-skeleton-item"),G=C("el-skeleton");return d(),_("div",Xv,[l(ha,{loading:s.value,"loading-text":p(c)("Saving"),"save-button-text":p(c)("Save Template"),onOnSave:B},{heading:i(()=>[l(T,{class:"mb-0","separator-icon":p(tn)},{default:i(()=>[l(Q,{to:{path:"/settings/pdf-template"}},{default:i(()=>[R(h(p(c)("PDF Templates")),1)]),_:1}),l(Q,null,{default:i(()=>{var ne;return[r("span",Jv,h(((ne=A.value)==null?void 0:ne.title)||p(c)("Edit Template")),1)]}),_:1})]),_:1},8,["separator-icon"])]),action:i(()=>[l(P,{trigger:"click",style:{"margin-left":"12px",display:"inline-flex","align-items":"center"},"popper-class":"fct-dropdown"},{dropdown:i(()=>[l(O,null,{default:i(()=>[l(I,{onClick:b,disabled:o.value},{default:i(()=>[R(h(o.value?p(c)("Downloading..."):p(c)("Test Download")),1)]),_:1},8,["disabled"]),l(I,{onClick:$},{default:i(()=>[R(h(p(c)("Revert to Default")),1)]),_:1}),S()?(d(),E(I,{key:0,divided:"",onClick:M,style:{color:"#F56C6C"}},{default:i(()=>[R(h(p(c)("Delete Template")),1)]),_:1})):x("",!0)]),_:1})]),default:i(()=>[l(U,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:i(()=>[l(D,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:i(()=>[l(p(fh))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),r("div",Zv,[l(_a),l(G,{loading:n.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:i(()=>[l(K,{variant:"h3",class:"w-[200px] mb-5"}),l(K,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!n.value&&A.value?(d(),_(H,{key:0},[r("div",e1,[l(_p,{ref_key:"editorFrameRef",ref:f,editorParams:{block_type:"pdf_template",campaign_title:A.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:A.value.title||p(c)("Receipt Template"),onPreviewRequest:k,modelValue:m.value,"onUpdate:modelValue":L[0]||(L[0]=ne=>m.value=ne)},null,8,["editorParams","documentTitle","modelValue"])]),r("div",t1,[l(U,{onClick:B,type:"primary",disabled:s.value,loading:s.value},{default:i(()=>[R(h(p(c)("Save Template")),1)]),_:1},8,["disabled","loading"]),l(U,{onClick:b,disabled:o.value,loading:o.value},{default:i(()=>[R(h(p(c)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):x("",!0)])])}}},n1={class:"fluent-cart-admin-validation-error-wrapper `${fieldKey}`"},un=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:{type:String,default:""}},setup(e){return(t,a)=>(d(),_("div",n1,[(d(!0),_(H,null,ee(e.validationErrors,(n,s)=>(d(),_("span",{class:"fluent-cart-admin-validation-error",key:n.toLowerCase().replace(/\s/g,"")},h(n),1))),128))]))}}),Wo={__name:"Alert",props:{type:String,title:String,description:String,closable:Boolean,showIcon:Boolean},setup(e){return(t,a)=>{const n=C("el-alert");return d(),E(n,{title:e.title,type:e.type,description:e.description,"show-icon":e.showIcon,closable:e.closable,role:"alert"},{default:i(()=>[oa(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},s1={class:"setting-wrap"},l1={class:"setting-wrap-inner"},o1={class:"grid gap-3 mb-6"},r1={class:"grid gap-3 mb-6"},i1={class:"grid gap-3 mb-6"},d1={class:"grid gap-3"},u1={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},c1=["href"],A1={class:"form-note"},p1={class:"form-note"},f1=["href"],m1={class:"mb-4"},h1={class:"mb-4"},_1={class:"form-note"},g1={class:"form-note"},v1={class:"form-note"},y1={class:"form-note"},b1={class:"setting-save-action"},w1={__name:"PdfTemplateSettings",setup(e){const t=V(!0),a=V(!1),n=V({}),s=V(!0),o=V(""),u=V({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:""}),A=[{label:"EN 16931 (ZUGFeRD)",value:"en16931"}],f=[{value:"",label:c("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"}];xs().onSave(()=>{y()});const g=()=>{t.value=!0,re.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(u.value).forEach(B=>{v.seller_details[B]!==void 0&&(u.value[B]=v.seller_details[B])}),s.value=v.store_country_set!==!1,o.value=v.store_settings_url||""}).catch(v=>{var B;q.error(((B=v.data)==null?void 0:B.message)||c("Failed to load settings"))}).finally(()=>{t.value=!1})},y=()=>{a.value=!0,n.value={},re.post("settings/pdf-templates/seller-details",u.value).then(v=>{q.success(v.message||c("Settings saved"))}).catch(v=>{var B,b;v.status_code===422&&((B=v.data)!=null&&B.data)&&(n.value=v.data.data),q.error(((b=v.data)==null?void 0:b.message)||c("Failed to save settings"))}).finally(()=>{a.value=!1})};return Be(()=>{g()}),(v,B)=>{const b=C("el-skeleton-item"),w=C("el-skeleton"),k=C("el-switch"),S=C("el-option"),M=C("el-select"),$=C("el-form-item"),F=C("el-col"),L=C("el-row"),Q=C("el-input"),T=C("el-divider"),D=C("el-button");return d(),_("div",s1,[l(ha,{heading:p(c)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),r("div",l1,[l(_a),t.value?(d(),E(he,{key:0},{default:i(()=>[l(me,null,{default:i(()=>[l(w,{animated:""},{template:i(()=>[r("div",o1,[l(b,{variant:"p",class:"w-[20%]"}),l(b,{variant:"p"})]),r("div",r1,[l(b,{variant:"p",class:"w-[20%]"}),l(b,{variant:"p"})]),r("div",i1,[l(b,{variant:"p",class:"w-[20%]"}),l(b,{variant:"p"})]),r("div",d1,[l(b,{variant:"p",class:"w-[20%]"}),l(b,{variant:"p"})])]),_:1})]),_:1})]),_:1})):x("",!0),t.value?x("",!0):(d(),_(H,{key:1},[u.value.zugferd_enabled==="1"&&!s.value?(d(),_("div",u1,[r("strong",null,h(p(c)("Store country is not configured.")),1),R(" "+h(p(c)("ZUGFeRD XML cannot be embedded in PDFs until your store country is set."))+" ",1),o.value?(d(),_("a",{key:0,href:o.value,class:"underline ml-1"},h(p(c)("Go to Store Settings")),9,c1)):x("",!0)])):x("",!0),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("E-Invoice Configuration"),text:p(c)("Configure ZUGFeRD / Factur-X e-invoice encoding and seller details for your PDFs."),border_bottom:""},{action:i(()=>[l(k,{modelValue:u.value.zugferd_enabled,"onUpdate:modelValue":B[0]||(B[0]=U=>u.value.zugferd_enabled=U),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),l(me,null,{default:i(()=>[l(L,{gutter:15},{default:i(()=>[l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("ZUGFeRD Profile"),"label-position":"top"},{default:i(()=>[l(M,{modelValue:u.value.zugferd_profile,"onUpdate:modelValue":B[1]||(B[1]=U=>u.value.zugferd_profile=U)},{default:i(()=>[(d(),_(H,null,ee(A,U=>l(S,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),r("div",A1,[r("p",null,h(p(c)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Legal Registration Scheme"),"label-position":"top"},{default:i(()=>[l(M,{modelValue:u.value.seller_legal_registration_scheme,"onUpdate:modelValue":B[2]||(B[2]=U=>u.value.seller_legal_registration_scheme=U),placeholder:p(c)("Select scheme"),clearable:"",filterable:""},{default:i(()=>[(d(),_(H,null,ee(f,U=>l(S,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),r("div",p1,[r("p",null,h(p(c)("ISO 6523 ICD code for the legal registration identifier")),1)]),l(un,{"validation-errors":n.value.seller_legal_registration_scheme||{},"field-key":"seller_legal_registration_scheme"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),l(Wo,{type:"info",closable:!1,"show-icon":"",class:"mb-4"},{default:i(()=>[R(h(p(c)("Company Name, VAT ID, Tax ID, and Legal Registration ID are managed in"))+" ",1),o.value?(d(),_("a",{key:0,href:o.value,target:"_blank",class:""},h(p(c)("Store Settings → Business Details")),9,f1)):x("",!0)]),_:1}),r("h4",m1,h(p(c)("Seller Contact")),1),l(L,{gutter:15},{default:i(()=>[l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Contact Name"),"label-position":"top"},{default:i(()=>[l(Q,{modelValue:u.value.seller_contact_name,"onUpdate:modelValue":B[3]||(B[3]=U=>u.value.seller_contact_name=U)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Contact Email"),"label-position":"top"},{default:i(()=>[l(Q,{modelValue:u.value.seller_contact_email,"onUpdate:modelValue":B[4]||(B[4]=U=>u.value.seller_contact_email=U),type:"email"},null,8,["modelValue"]),l(un,{"validation-errors":n.value.seller_contact_email||{},"field-key":"seller_contact_email"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),l(L,{gutter:15},{default:i(()=>[l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Contact Phone"),"label-position":"top"},{default:i(()=>[l(Q,{modelValue:u.value.seller_contact_phone,"onUpdate:modelValue":B[5]||(B[5]=U=>u.value.seller_contact_phone=U)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),l(T),r("h4",h1,h(p(c)("Seller Bank Details")),1),l(L,{gutter:15},{default:i(()=>[l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Bank IBAN"),"label-position":"top"},{default:i(()=>[l(Q,{modelValue:u.value.seller_bank_iban,"onUpdate:modelValue":B[6]||(B[6]=U=>u.value.seller_bank_iban=U)},null,8,["modelValue"]),l(un,{"validation-errors":n.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),r("div",_1,[r("p",null,h(p(c)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Bank BIC"),"label-position":"top"},{default:i(()=>[l(Q,{modelValue:u.value.seller_bank_bic,"onUpdate:modelValue":B[7]||(B[7]=U=>u.value.seller_bank_bic=U)},null,8,["modelValue"]),r("div",g1,[r("p",null,h(p(c)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),l(L,{gutter:15},{default:i(()=>[l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Bank Account Name"),"label-position":"top"},{default:i(()=>[l(Q,{modelValue:u.value.seller_bank_account_name,"onUpdate:modelValue":B[8]||(B[8]=U=>u.value.seller_bank_account_name=U)},null,8,["modelValue"]),r("div",v1,[r("p",null,h(p(c)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),l(F,{lg:12},{default:i(()=>[l($,{label:p(c)("Electronic Address"),"label-position":"top"},{default:i(()=>[l(Q,{modelValue:u.value.seller_electronic_address,"onUpdate:modelValue":B[9]||(B[9]=U=>u.value.seller_electronic_address=U)},null,8,["modelValue"]),r("div",y1,[r("p",null,h(p(c)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),r("div",b1,[l(D,{type:"primary",onClick:B[10]||(B[10]=U=>y()),loading:a.value},{default:i(()=>[R(h(p(c)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},C1={name:"CustomersRoute"},B1={class:"fca_customers_route"};function k1(e,t,a,n,s,o){const u=C("router-view");return d(),_("div",B1,[l(u)])}const x1=He(C1,[["render",k1]]);/*! |
| 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 nd=function(e,t){return nd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,n){a.__proto__=n}||function(a,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(a[s]=n[s])},nd(e,t)};function Qn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");nd(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var sd=function(){return sd=Object.assign||function(t){for(var a,n=1,s=arguments.length;n<s;n++){a=arguments[n];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(t[o]=a[o])}return t},sd.apply(this,arguments)};function Ga(e,t,a,n){function s(o){return o instanceof a?o:new a(function(u){u(o)})}return new(a||(a=Promise))(function(o,u){function A(g){try{m(n.next(g))}catch(y){u(y)}}function f(g){try{m(n.throw(g))}catch(y){u(y)}}function m(g){g.done?o(g.value):s(g.value).then(A,f)}m((n=n.apply(e,[])).next())})}function Ra(e,t){var a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,u;return u={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function A(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,s&&(o=m[0]&2?s.return:m[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,m[1])).done)return o;switch(s=0,o&&(m=[m[0]&2,o.value]),m[0]){case 0:case 1:o=m;break;case 4:return a.label++,{value:m[1],done:!1};case 5:a.label++,s=m[1],m=[0];continue;case 7:m=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(m[0]===6||m[0]===2)){a=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[1]<o[3])){a.label=m[1];break}if(m[0]===6&&a.label<o[1]){a.label=o[1],o=m;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(m);break}o[2]&&a.ops.pop(),a.trys.pop();continue}m=t.call(e,a)}catch(g){m=[6,g],s=0}finally{n=o=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function vo(e,t,a){if(arguments.length===2)for(var n=0,s=t.length,o;n<s;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||t)}var as=function(){function e(t,a,n,s){this.left=t,this.top=a,this.width=n,this.height=s}return e.prototype.add=function(t,a,n,s){return new e(this.left+t,this.top+a,this.width+n,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 n=Array.from(a).find(function(s){return s.width!==0});return n?new e(n.left+t.windowBounds.left,n.top+t.windowBounds.top,n.width,n.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),jr=function(e,t){return as.fromClientRect(e,t.getBoundingClientRect())},S1=function(e){var t=e.body,a=e.documentElement;if(!t||!a)throw new Error("Unable to get document size");var n=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 as(0,0,n,s)},zr=function(e){for(var t=[],a=0,n=e.length;a<n;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<n){var o=e.charCodeAt(a++);(o&64512)===56320?t.push(((s&1023)<<10)+(o&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},ma=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 n=[],s=-1,o="";++s<a;){var u=e[s];u<=65535?n.push(u):(u-=65536,n.push((u>>10)+55296,u%1024+56320)),(s+1===a||n.length>16384)&&(o+=String.fromCharCode.apply(String,n),n.length=0)}return o},Wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",F1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var yo=0;yo<Wu.length;yo++)F1[Wu.charCodeAt(yo)]=yo;var Xu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Il=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var bo=0;bo<Xu.length;bo++)Il[Xu.charCodeAt(bo)]=bo;var E1=function(e){var t=e.length*.75,a=e.length,n,s=0,o,u,A,f;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var m=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(m)?m:new Uint8Array(m);for(n=0;n<a;n+=4)o=Il[e.charCodeAt(n)],u=Il[e.charCodeAt(n+1)],A=Il[e.charCodeAt(n+2)],f=Il[e.charCodeAt(n+3)],g[s++]=o<<2|u>>4,g[s++]=(u&15)<<4|A>>2,g[s++]=(A&3)<<6|f&63;return m},U1=function(e){for(var t=e.length,a=[],n=0;n<t;n+=2)a.push(e[n+1]<<8|e[n]);return a},$1=function(e){for(var t=e.length,a=[],n=0;n<t;n+=4)a.push(e[n+3]<<24|e[n+2]<<16|e[n+1]<<8|e[n]);return a},Ls=5,ou=11,ci=2,D1=ou-Ls,gp=65536>>Ls,Q1=1<<Ls,Ai=Q1-1,I1=1024>>Ls,T1=gp+I1,V1=T1,M1=32,L1=V1+M1,R1=65536>>ou,O1=1<<D1,H1=O1-1,Ju=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},P1=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},N1=function(e,t){var a=E1(e),n=Array.isArray(a)?$1(a):new Uint32Array(a),s=Array.isArray(a)?U1(a):new Uint16Array(a),o=24,u=Ju(s,o/2,n[4]/2),A=n[5]===2?Ju(s,(o+n[4])/2):P1(n,Math.ceil((o+n[4])/4));return new K1(n[0],n[1],n[2],n[3],u,A)},K1=function(){function e(t,a,n,s,o,u){this.initialValue=t,this.errorValue=a,this.highStart=n,this.highValueIndex=s,this.index=o,this.data=u}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Ls],a=(a<<ci)+(t&Ai),this.data[a];if(t<=65535)return a=this.index[gp+(t-55296>>Ls)],a=(a<<ci)+(t&Ai),this.data[a];if(t<this.highStart)return a=L1-R1+(t>>ou),a=this.index[a],a+=t>>Ls&H1,a=this.index[a],a=(a<<ci)+(t&Ai),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Zu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",G1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var wo=0;wo<Zu.length;wo++)G1[Zu.charCodeAt(wo)]=wo;var j1="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==",ec=50,z1=1,vp=2,yp=3,Y1=4,q1=5,tc=7,bp=8,ac=9,fs=10,ld=11,nc=12,od=13,W1=14,Tl=15,rd=16,Co=17,Ul=18,X1=19,sc=20,id=21,$l=22,pi=23,Js=24,sn=25,Vl=26,Ml=27,Zs=28,J1=29,Ts=30,Z1=31,Bo=32,ko=33,dd=34,ud=35,cd=36,oo=37,Ad=38,Xo=39,Jo=40,fi=41,wp=42,ey=43,ty=[9001,65288],Cp="!",wt="×",xo="÷",pd=N1(j1),Wn=[Ts,cd],fd=[z1,vp,yp,q1],Bp=[fs,bp],lc=[Ml,Vl],ay=fd.concat(Bp),oc=[Ad,Xo,Jo,dd,ud],ny=[Tl,od],sy=function(e,t){t===void 0&&(t="strict");var a=[],n=[],s=[];return e.forEach(function(o,u){var A=pd.get(o);if(A>ec?(s.push(!0),A-=ec):s.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(o)!==-1)return n.push(u),a.push(rd);if(A===Y1||A===ld){if(u===0)return n.push(u),a.push(Ts);var f=a[u-1];return ay.indexOf(f)===-1?(n.push(n[u-1]),a.push(f)):(n.push(u),a.push(Ts))}if(n.push(u),A===Z1)return a.push(t==="strict"?id:oo);if(A===wp||A===J1)return a.push(Ts);if(A===ey)return o>=131072&&o<=196605||o>=196608&&o<=262141?a.push(oo):a.push(Ts);a.push(A)}),[n,a,s]},mi=function(e,t,a,n){var s=n[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var o=a;o<=n.length;){o++;var u=n[o];if(u===t)return!0;if(u!==fs)break}if(s===fs)for(var o=a;o>0;){o--;var A=n[o];if(Array.isArray(e)?e.indexOf(A)!==-1:e===A)for(var f=a;f<=n.length;){f++;var u=n[f];if(u===t)return!0;if(u!==fs)break}if(A!==fs)break}return!1},rc=function(e,t){for(var a=e;a>=0;){var n=t[a];if(n===fs)a--;else return n}return 0},ly=function(e,t,a,n,s){if(a[n]===0)return wt;var o=n-1;if(Array.isArray(s)&&s[o]===!0)return wt;var u=o-1,A=o+1,f=t[o],m=u>=0?t[u]:0,g=t[A];if(f===vp&&g===yp)return wt;if(fd.indexOf(f)!==-1)return Cp;if(fd.indexOf(g)!==-1||Bp.indexOf(g)!==-1)return wt;if(rc(o,t)===bp)return xo;if(pd.get(e[o])===ld||(f===Bo||f===ko)&&pd.get(e[A])===ld||f===tc||g===tc||f===ac||[fs,od,Tl].indexOf(f)===-1&&g===ac||[Co,Ul,X1,Js,Zs].indexOf(g)!==-1||rc(o,t)===$l||mi(pi,$l,o,t)||mi([Co,Ul],id,o,t)||mi(nc,nc,o,t))return wt;if(f===fs)return xo;if(f===pi||g===pi)return wt;if(g===rd||f===rd)return xo;if([od,Tl,id].indexOf(g)!==-1||f===W1||m===cd&&ny.indexOf(f)!==-1||f===Zs&&g===cd||g===sc||Wn.indexOf(g)!==-1&&f===sn||Wn.indexOf(f)!==-1&&g===sn||f===Ml&&[oo,Bo,ko].indexOf(g)!==-1||[oo,Bo,ko].indexOf(f)!==-1&&g===Vl||Wn.indexOf(f)!==-1&&lc.indexOf(g)!==-1||lc.indexOf(f)!==-1&&Wn.indexOf(g)!==-1||[Ml,Vl].indexOf(f)!==-1&&(g===sn||[$l,Tl].indexOf(g)!==-1&&t[A+1]===sn)||[$l,Tl].indexOf(f)!==-1&&g===sn||f===sn&&[sn,Zs,Js].indexOf(g)!==-1)return wt;if([sn,Zs,Js,Co,Ul].indexOf(g)!==-1)for(var y=o;y>=0;){var v=t[y];if(v===sn)return wt;if([Zs,Js].indexOf(v)!==-1)y--;else break}if([Ml,Vl].indexOf(g)!==-1)for(var y=[Co,Ul].indexOf(f)!==-1?u:o;y>=0;){var v=t[y];if(v===sn)return wt;if([Zs,Js].indexOf(v)!==-1)y--;else break}if(Ad===f&&[Ad,Xo,dd,ud].indexOf(g)!==-1||[Xo,dd].indexOf(f)!==-1&&[Xo,Jo].indexOf(g)!==-1||[Jo,ud].indexOf(f)!==-1&&g===Jo||oc.indexOf(f)!==-1&&[sc,Vl].indexOf(g)!==-1||oc.indexOf(g)!==-1&&f===Ml||Wn.indexOf(f)!==-1&&Wn.indexOf(g)!==-1||f===Js&&Wn.indexOf(g)!==-1||Wn.concat(sn).indexOf(f)!==-1&&g===$l&&ty.indexOf(e[A])===-1||Wn.concat(sn).indexOf(g)!==-1&&f===Ul)return wt;if(f===fi&&g===fi){for(var B=a[o],b=1;B>0&&(B--,t[B]===fi);)b++;if(b%2!==0)return wt}return f===Bo&&g===ko?wt:xo},oy=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=sy(e,t.lineBreak),n=a[0],s=a[1],o=a[2];(t.wordBreak==="break-all"||t.wordBreak==="break-word")&&(s=s.map(function(A){return[sn,Ts,wp].indexOf(A)!==-1?oo:A}));var u=t.wordBreak==="keep-all"?o.map(function(A,f){return A&&e[f]>=19968&&e[f]<=40959}):void 0;return[n,s,u]},ry=function(){function e(t,a,n,s){this.codePoints=t,this.required=a===Cp,this.start=n,this.end=s}return e.prototype.slice=function(){return ma.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),iy=function(e,t){var a=zr(e),n=oy(a,t),s=n[0],o=n[1],u=n[2],A=a.length,f=0,m=0;return{next:function(){if(m>=A)return{done:!0,value:null};for(var g=wt;m<A&&(g=ly(a,o,s,++m,u))===wt;);if(g!==wt||m===A){var y=new ry(a,g,f,m);return f=m,{value:y,done:!1}}return{done:!0,value:null}}}},dy=1,uy=2,Ao=4,ic=8,cr=10,dc=47,Gl=92,cy=9,Ay=32,So=34,Dl=61,py=35,fy=36,my=37,Fo=39,Eo=40,Ql=41,hy=95,Ja=45,_y=33,gy=60,vy=62,yy=64,by=91,wy=93,Cy=61,By=123,Uo=63,ky=125,uc=124,xy=126,Sy=128,cc=65533,hi=42,Ms=43,Fy=44,Ey=58,Uy=59,ro=46,$y=0,Dy=8,Qy=11,Iy=14,Ty=31,Vy=127,Mn=-1,kp=48,xp=97,Sp=101,My=102,Ly=117,Ry=122,Fp=65,Ep=69,Up=70,Oy=85,Hy=90,Ha=function(e){return e>=kp&&e<=57},Py=function(e){return e>=55296&&e<=57343},el=function(e){return Ha(e)||e>=Fp&&e<=Up||e>=xp&&e<=My},Ny=function(e){return e>=xp&&e<=Ry},Ky=function(e){return e>=Fp&&e<=Hy},Gy=function(e){return Ny(e)||Ky(e)},jy=function(e){return e>=Sy},$o=function(e){return e===cr||e===cy||e===Ay},Ar=function(e){return Gy(e)||jy(e)||e===hy},Ac=function(e){return Ar(e)||Ha(e)||e===Ja},zy=function(e){return e>=$y&&e<=Dy||e===Qy||e>=Iy&&e<=Ty||e===Vy},cs=function(e,t){return e!==Gl?!1:t!==cr},Do=function(e,t,a){return e===Ja?Ar(t)||cs(t,a):Ar(e)?!0:!!(e===Gl&&cs(e,t))},_i=function(e,t,a){return e===Ms||e===Ja?Ha(t)?!0:t===ro&&Ha(a):Ha(e===ro?t:e)},Yy=function(e){var t=0,a=1;(e[t]===Ms||e[t]===Ja)&&(e[t]===Ja&&(a=-1),t++);for(var n=[];Ha(e[t]);)n.push(e[t++]);var s=n.length?parseInt(ma.apply(void 0,n),10):0;e[t]===ro&&t++;for(var o=[];Ha(e[t]);)o.push(e[t++]);var u=o.length,A=u?parseInt(ma.apply(void 0,o),10):0;(e[t]===Ep||e[t]===Sp)&&t++;var f=1;(e[t]===Ms||e[t]===Ja)&&(e[t]===Ja&&(f=-1),t++);for(var m=[];Ha(e[t]);)m.push(e[t++]);var g=m.length?parseInt(ma.apply(void 0,m),10):0;return a*(s+A*Math.pow(10,-u))*Math.pow(10,f*g)},qy={type:2},Wy={type:3},Xy={type:4},Jy={type:13},Zy={type:8},eb={type:21},tb={type:9},ab={type:10},nb={type:11},sb={type:12},lb={type:14},Qo={type:23},ob={type:1},rb={type:25},ib={type:24},db={type:26},ub={type:27},cb={type:28},Ab={type:29},pb={type:31},md={type:32},$p=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(zr(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==md;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case So:return this.consumeStringToken(So);case py:var a=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Ac(a)||cs(n,s)){var o=Do(a,n,s)?uy:dy,u=this.consumeName();return{type:5,value:u,flags:o}}break;case fy:if(this.peekCodePoint(0)===Dl)return this.consumeCodePoint(),Jy;break;case Fo:return this.consumeStringToken(Fo);case Eo:return qy;case Ql:return Wy;case hi:if(this.peekCodePoint(0)===Dl)return this.consumeCodePoint(),lb;break;case Ms:if(_i(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Fy:return Xy;case Ja:var A=t,f=this.peekCodePoint(0),m=this.peekCodePoint(1);if(_i(A,f,m))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(Do(A,f,m))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(f===Ja&&m===vy)return this.consumeCodePoint(),this.consumeCodePoint(),ib;break;case ro:if(_i(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case dc:if(this.peekCodePoint(0)===hi)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===hi&&(g=this.consumeCodePoint(),g===dc))return this.consumeToken();if(g===Mn)return this.consumeToken()}break;case Ey:return db;case Uy:return ub;case gy:if(this.peekCodePoint(0)===_y&&this.peekCodePoint(1)===Ja&&this.peekCodePoint(2)===Ja)return this.consumeCodePoint(),this.consumeCodePoint(),rb;break;case yy:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),B=this.peekCodePoint(2);if(Do(y,v,B)){var u=this.consumeName();return{type:7,value:u}}break;case by:return cb;case Gl:if(cs(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case wy:return Ab;case Cy:if(this.peekCodePoint(0)===Dl)return this.consumeCodePoint(),Zy;break;case By:return nb;case ky:return sb;case Ly:case Oy:var b=this.peekCodePoint(0),w=this.peekCodePoint(1);return b===Ms&&(el(w)||w===Uo)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case uc:if(this.peekCodePoint(0)===Dl)return this.consumeCodePoint(),tb;if(this.peekCodePoint(0)===uc)return this.consumeCodePoint(),eb;break;case xy:if(this.peekCodePoint(0)===Dl)return this.consumeCodePoint(),ab;break;case Mn:return md}return $o(t)?(this.consumeWhiteSpace(),pb):Ha(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):Ar(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:ma(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();el(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var n=!1;a===Uo&&t.length<6;)t.push(a),a=this.consumeCodePoint(),n=!0;if(n){var s=parseInt(ma.apply(void 0,t.map(function(f){return f===Uo?kp:f})),16),o=parseInt(ma.apply(void 0,t.map(function(f){return f===Uo?Up:f})),16);return{type:30,start:s,end:o}}var u=parseInt(ma.apply(void 0,t),16);if(this.peekCodePoint(0)===Ja&&el(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var A=[];el(a)&&A.length<6;)A.push(a),a=this.consumeCodePoint();var o=parseInt(ma.apply(void 0,A),16);return{type:30,start:u,end:o}}else return{type:30,start:u,end:u}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===Eo?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Eo?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Mn)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===Fo||a===So){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Mn||this.peekCodePoint(0)===Ql)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),Qo)}for(;;){var s=this.consumeCodePoint();if(s===Mn||s===Ql)return{type:22,value:ma.apply(void 0,t)};if($o(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Mn||this.peekCodePoint(0)===Ql?(this.consumeCodePoint(),{type:22,value:ma.apply(void 0,t)}):(this.consumeBadUrlRemnants(),Qo);if(s===So||s===Fo||s===Eo||zy(s))return this.consumeBadUrlRemnants(),Qo;if(s===Gl)if(cs(s,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Qo;else t.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;$o(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===Ql||t===Mn)return;cs(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(t){for(var a=5e4,n="";t>0;){var s=Math.min(a,t);n+=ma.apply(void 0,this._value.splice(0,s)),t-=s}return this._value.shift(),n},e.prototype.consumeStringToken=function(t){var a="",n=0;do{var s=this._value[n];if(s===Mn||s===void 0||s===t)return a+=this.consumeStringSlice(n),{type:0,value:a};if(s===cr)return this._value.splice(0,n),ob;if(s===Gl){var o=this._value[n+1];o!==Mn&&o!==void 0&&(o===cr?(a+=this.consumeStringSlice(n),n=-1,this._value.shift()):cs(s,o)&&(a+=this.consumeStringSlice(n),a+=ma(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=Ao,n=this.peekCodePoint(0);for((n===Ms||n===Ja)&&t.push(this.consumeCodePoint());Ha(this.peekCodePoint(0));)t.push(this.consumeCodePoint());n=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(n===ro&&Ha(s))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=ic;Ha(this.peekCodePoint(0));)t.push(this.consumeCodePoint());n=this.peekCodePoint(0),s=this.peekCodePoint(1);var o=this.peekCodePoint(2);if((n===Ep||n===Sp)&&((s===Ms||s===Ja)&&Ha(o)||Ha(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=ic;Ha(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[Yy(t),a]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),a=t[0],n=t[1],s=this.peekCodePoint(0),o=this.peekCodePoint(1),u=this.peekCodePoint(2);if(Do(s,o,u)){var A=this.consumeName();return{type:15,number:a,flags:n,unit:A}}return s===my?(this.consumeCodePoint(),{type:16,number:a,flags:n}):{type:17,number:a,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(el(t)){for(var a=ma(t);el(this.peekCodePoint(0))&&a.length<6;)a+=ma(this.consumeCodePoint());$o(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(a,16);return n===0||Py(n)||n>1114111?cc:n}return t===Mn?cc:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(Ac(a))t+=ma(a);else if(cs(a,this.peekCodePoint(0)))t+=ma(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),Dp=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new $p;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:[]},n=this.consumeToken();;){if(n.type===32||mb(n,t))return a;this.reconsumeToken(n),a.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(t){for(var a={name:t.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return a;this.reconsumeToken(n),a.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var t=this._tokens.shift();return typeof t>"u"?md:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),po=function(e){return e.type===15},kl=function(e){return e.type===17},Nt=function(e){return e.type===20},fb=function(e){return e.type===0},hd=function(e,t){return Nt(e)&&e.value===t},Qp=function(e){return e.type!==31},bl=function(e){return e.type!==31&&e.type!==4},zn=function(e){var t=[],a=[];return e.forEach(function(n){if(n.type===4){if(a.length===0)throw new Error("Error parsing function args, zero tokens for arg");t.push(a),a=[];return}n.type!==31&&a.push(n)}),a.length&&t.push(a),t},mb=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},Cs=function(e){return e.type===17||e.type===15},wa=function(e){return e.type===16||Cs(e)},Ip=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},Va={type:17,number:0,flags:Ao},ru={type:16,number:50,flags:Ao},ms={type:16,number:100,flags:Ao},Ll=function(e,t,a){var n=e[0],s=e[1];return[Xt(n,t),Xt(typeof s<"u"?s:n,a)]},Xt=function(e,t){if(e.type===16)return e.number/100*t;if(po(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},Tp="deg",Vp="grad",Mp="rad",Lp="turn",Yr={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case Tp:return Math.PI*t.number/180;case Vp:return Math.PI/200*t.number;case Mp:return t.number;case Lp:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},Rp=function(e){return e.type===15&&(e.unit===Tp||e.unit===Vp||e.unit===Mp||e.unit===Lp)},Op=function(e){var t=e.filter(Nt).map(function(a){return a.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Va,Va];case"to top":case"bottom":return wn(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Va,ms];case"to right":case"left":return wn(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ms,ms];case"to bottom":case"top":return wn(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ms,Va];case"to left":case"right":return wn(270)}return 0},wn=function(e){return Math.PI*e/180},bs={name:"color",parse:function(e,t){if(t.type===18){var a=hb[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 n=t.value.substring(0,1),s=t.value.substring(1,2),o=t.value.substring(2,3);return hs(parseInt(n+n,16),parseInt(s+s,16),parseInt(o+o,16),1)}if(t.value.length===4){var n=t.value.substring(0,1),s=t.value.substring(1,2),o=t.value.substring(2,3),u=t.value.substring(3,4);return hs(parseInt(n+n,16),parseInt(s+s,16),parseInt(o+o,16),parseInt(u+u,16)/255)}if(t.value.length===6){var n=t.value.substring(0,2),s=t.value.substring(2,4),o=t.value.substring(4,6);return hs(parseInt(n,16),parseInt(s,16),parseInt(o,16),1)}if(t.value.length===8){var n=t.value.substring(0,2),s=t.value.substring(2,4),o=t.value.substring(4,6),u=t.value.substring(6,8);return hs(parseInt(n,16),parseInt(s,16),parseInt(o,16),parseInt(u,16)/255)}}if(t.type===20){var A=Jn[t.value.toUpperCase()];if(typeof A<"u")return A}return Jn.TRANSPARENT}},ws=function(e){return(255&e)===0},Fa=function(e){var t=255&e,a=255&e>>8,n=255&e>>16,s=255&e>>24;return t<255?"rgba("+s+","+n+","+a+","+t/255+")":"rgb("+s+","+n+","+a+")"},hs=function(e,t,a,n){return(e<<24|t<<16|a<<8|Math.round(n*255)<<0)>>>0},pc=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},fc=function(e,t){var a=t.filter(bl);if(a.length===3){var n=a.map(pc),s=n[0],o=n[1],u=n[2];return hs(s,o,u,1)}if(a.length===4){var A=a.map(pc),s=A[0],o=A[1],u=A[2],f=A[3];return hs(s,o,u,f)}return 0};function gi(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 mc=function(e,t){var a=t.filter(bl),n=a[0],s=a[1],o=a[2],u=a[3],A=(n.type===17?wn(n.number):Yr.parse(e,n))/(Math.PI*2),f=wa(s)?s.number/100:0,m=wa(o)?o.number/100:0,g=typeof u<"u"&&wa(u)?Xt(u,1):1;if(f===0)return hs(m*255,m*255,m*255,1);var y=m<=.5?m*(f+1):m+f-m*f,v=m*2-y,B=gi(v,y,A+1/3),b=gi(v,y,A),w=gi(v,y,A-1/3);return hs(B*255,b*255,w*255,g)},hb={hsl:mc,hsla:mc,rgb:fc,rgba:fc},jl=function(e,t){return bs.parse(e,Dp.create(t).parseComponentValue())},Jn={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},_b={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(Nt(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},gb={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},qr=function(e,t){var a=bs.parse(e,t[0]),n=t[1];return n&&wa(n)?{color:a,stop:n}:{color:a,stop:null}},hc=function(e,t){var a=e[0],n=e[e.length-1];a.stop===null&&(a.stop=Va),n.stop===null&&(n.stop=ms);for(var s=[],o=0,u=0;u<e.length;u++){var A=e[u].stop;if(A!==null){var f=Xt(A,t);f>o?s.push(f):s.push(o),o=f}else s.push(null)}for(var m=null,u=0;u<s.length;u++){var g=s[u];if(g===null)m===null&&(m=u);else if(m!==null){for(var y=u-m,v=s[m-1],B=(g-v)/(y+1),b=1;b<=y;b++)s[m+b-1]=B*b;m=null}}return e.map(function(w,k){var S=w.color;return{color:S,stop:Math.max(Math.min(1,s[k]/t),0)}})},vb=function(e,t,a){var n=t/2,s=a/2,o=Xt(e[0],t)-n,u=s-Xt(e[1],a);return(Math.atan2(u,o)+Math.PI*2)%(Math.PI*2)},yb=function(e,t,a){var n=typeof e=="number"?e:vb(e,t,a),s=Math.abs(t*Math.sin(n))+Math.abs(a*Math.cos(n)),o=t/2,u=a/2,A=s/2,f=Math.sin(n-Math.PI/2)*A,m=Math.cos(n-Math.PI/2)*A;return[s,o-m,o+m,u-f,u+f]},Un=function(e,t){return Math.sqrt(e*e+t*t)},_c=function(e,t,a,n,s){var o=[[0,0],[0,t],[e,0],[e,t]];return o.reduce(function(u,A){var f=A[0],m=A[1],g=Un(a-f,n-m);return(s?g<u.optimumDistance:g>u.optimumDistance)?{optimumCorner:A,optimumDistance:g}:u},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},bb=function(e,t,a,n,s){var o=0,u=0;switch(e.size){case 0:e.shape===0?o=u=Math.min(Math.abs(t),Math.abs(t-n),Math.abs(a),Math.abs(a-s)):e.shape===1&&(o=Math.min(Math.abs(t),Math.abs(t-n)),u=Math.min(Math.abs(a),Math.abs(a-s)));break;case 2:if(e.shape===0)o=u=Math.min(Un(t,a),Un(t,a-s),Un(t-n,a),Un(t-n,a-s));else if(e.shape===1){var A=Math.min(Math.abs(a),Math.abs(a-s))/Math.min(Math.abs(t),Math.abs(t-n)),f=_c(n,s,t,a,!0),m=f[0],g=f[1];o=Un(m-t,(g-a)/A),u=A*o}break;case 1:e.shape===0?o=u=Math.max(Math.abs(t),Math.abs(t-n),Math.abs(a),Math.abs(a-s)):e.shape===1&&(o=Math.max(Math.abs(t),Math.abs(t-n)),u=Math.max(Math.abs(a),Math.abs(a-s)));break;case 3:if(e.shape===0)o=u=Math.max(Un(t,a),Un(t,a-s),Un(t-n,a),Un(t-n,a-s));else if(e.shape===1){var A=Math.max(Math.abs(a),Math.abs(a-s))/Math.max(Math.abs(t),Math.abs(t-n)),y=_c(n,s,t,a,!1),m=y[0],g=y[1];o=Un(m-t,(g-a)/A),u=A*o}break}return Array.isArray(e.size)&&(o=Xt(e.size[0],n),u=e.size.length===2?Xt(e.size[1],s):o),[o,u]},wb=function(e,t){var a=wn(180),n=[];return zn(t).forEach(function(s,o){if(o===0){var u=s[0];if(u.type===20&&u.value==="to"){a=Op(s);return}else if(Rp(u)){a=Yr.parse(e,u);return}}var A=qr(e,s);n.push(A)}),{angle:a,stops:n,type:1}},Io=function(e,t){var a=wn(180),n=[];return zn(t).forEach(function(s,o){if(o===0){var u=s[0];if(u.type===20&&["top","left","right","bottom"].indexOf(u.value)!==-1){a=Op(s);return}else if(Rp(u)){a=(Yr.parse(e,u)+wn(270))%wn(360);return}}var A=qr(e,s);n.push(A)}),{angle:a,stops:n,type:1}},Cb=function(e,t){var a=wn(180),n=[],s=1,o=0,u=3,A=[];return zn(t).forEach(function(f,m){var g=f[0];if(m===0){if(Nt(g)&&g.value==="linear"){s=1;return}else if(Nt(g)&&g.value==="radial"){s=2;return}}if(g.type===18){if(g.name==="from"){var y=bs.parse(e,g.values[0]);n.push({stop:Va,color:y})}else if(g.name==="to"){var y=bs.parse(e,g.values[0]);n.push({stop:ms,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(bl);if(v.length===2){var y=bs.parse(e,v[1]),B=v[0];kl(B)&&n.push({stop:{type:16,number:B.number*100,flags:B.flags},color:y})}}}}),s===1?{angle:(a+wn(180))%wn(360),stops:n,type:s}:{size:u,shape:o,stops:n,position:A,type:s}},Hp="closest-side",Pp="farthest-side",Np="closest-corner",Kp="farthest-corner",Gp="circle",jp="ellipse",zp="cover",Yp="contain",Bb=function(e,t){var a=0,n=3,s=[],o=[];return zn(t).forEach(function(u,A){var f=!0;if(A===0){var m=!1;f=u.reduce(function(y,v){if(m)if(Nt(v))switch(v.value){case"center":return o.push(ru),y;case"top":case"left":return o.push(Va),y;case"right":case"bottom":return o.push(ms),y}else(wa(v)||Cs(v))&&o.push(v);else if(Nt(v))switch(v.value){case Gp:return a=0,!1;case jp:return a=1,!1;case"at":return m=!0,!1;case Hp:return n=0,!1;case zp:case Pp:return n=1,!1;case Yp:case Np:return n=2,!1;case Kp:return n=3,!1}else if(Cs(v)||wa(v))return Array.isArray(n)||(n=[]),n.push(v),!1;return y},f)}if(f){var g=qr(e,u);s.push(g)}}),{size:n,shape:a,stops:s,position:o,type:2}},To=function(e,t){var a=0,n=3,s=[],o=[];return zn(t).forEach(function(u,A){var f=!0;if(A===0?f=u.reduce(function(g,y){if(Nt(y))switch(y.value){case"center":return o.push(ru),!1;case"top":case"left":return o.push(Va),!1;case"right":case"bottom":return o.push(ms),!1}else if(wa(y)||Cs(y))return o.push(y),!1;return g},f):A===1&&(f=u.reduce(function(g,y){if(Nt(y))switch(y.value){case Gp:return a=0,!1;case jp:return a=1,!1;case Yp:case Hp:return n=0,!1;case Pp:return n=1,!1;case Np:return n=2,!1;case zp:case Kp:return n=3,!1}else if(Cs(y)||wa(y))return Array.isArray(n)||(n=[]),n.push(y),!1;return g},f)),f){var m=qr(e,u);s.push(m)}}),{size:n,shape:a,stops:s,position:o,type:2}},kb=function(e){return e.type===1},xb=function(e){return e.type===2},iu={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 n=qp[t.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return n(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function Sb(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!qp[e.name])}var qp={"linear-gradient":wb,"-moz-linear-gradient":Io,"-ms-linear-gradient":Io,"-o-linear-gradient":Io,"-webkit-linear-gradient":Io,"radial-gradient":Bb,"-moz-radial-gradient":To,"-ms-radial-gradient":To,"-o-radial-gradient":To,"-webkit-radial-gradient":To,"-webkit-gradient":Cb},Fb={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(n){return bl(n)&&Sb(n)}).map(function(n){return iu.parse(e,n)})}},Eb={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(Nt(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ub={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return zn(t).map(function(a){return a.filter(wa)}).map(Ip)}},$b={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return zn(t).map(function(a){return a.filter(Nt).map(function(n){return n.value}).join(" ")}).map(Db)}},Db=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}},gl;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(gl||(gl={}));var Qb={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return zn(t).map(function(a){return a.filter(Ib)})}},Ib=function(e){return Nt(e)||wa(e)},Wr=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Tb=Wr("top"),Vb=Wr("right"),Mb=Wr("bottom"),Lb=Wr("left"),Xr=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return Ip(a.filter(wa))}}},Rb=Xr("top-left"),Ob=Xr("top-right"),Hb=Xr("bottom-right"),Pb=Xr("bottom-left"),Jr=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}}},Nb=Jr("top"),Kb=Jr("right"),Gb=Jr("bottom"),jb=Jr("left"),Zr=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return po(a)?a.number:0}}},zb=Zr("top"),Yb=Zr("right"),qb=Zr("bottom"),Wb=Zr("left"),Xb={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Jb={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},Zb={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(Nt).reduce(function(a,n){return a|e0(n.value)},0)}},e0=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},t0={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}},a0={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}},pr;(function(e){e.NORMAL="normal",e.STRICT="strict"})(pr||(pr={}));var n0={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return pr.STRICT;case"normal":default:return pr.NORMAL}}},s0={name:"line-height",initialValue:"normal",prefix:!1,type:4},gc=function(e,t){return Nt(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:wa(e)?Xt(e,t):t},l0={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:iu.parse(e,t)}},o0={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}}},_d={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}}},ei=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},r0=ei("top"),i0=ei("right"),d0=ei("bottom"),u0=ei("left"),c0={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(Nt).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}})}},A0={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"}}},ti=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},p0=ti("top"),f0=ti("right"),m0=ti("bottom"),h0=ti("left"),_0={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}}},g0={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}},v0={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&hd(t[0],"none")?[]:zn(t).map(function(a){for(var n={color:Jn.TRANSPARENT,offsetX:Va,offsetY:Va,blur:Va},s=0,o=0;o<a.length;o++){var u=a[o];Cs(u)?(s===0?n.offsetX=u:s===1?n.offsetY=u:n.blur=u,s++):n.color=bs.parse(e,u)}return n})}},y0={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}},b0={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=B0[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},w0=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},C0=function(e){var t=e.filter(function(f){return f.type===17}).map(function(f){return f.number}),a=t[0],n=t[1];t[2],t[3];var s=t[4],o=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var u=t[12],A=t[13];return t[14],t[15],t.length===16?[a,n,s,o,u,A]:null},B0={matrix:w0,matrix3d:C0},vc={type:16,number:50,flags:Ao},k0=[vc,vc],x0={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(wa);return a.length!==2?k0:[a[0],a[1]]}},S0={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}}},zl;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(zl||(zl={}));var F0={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return zl.BREAK_ALL;case"keep-all":return zl.KEEP_ALL;case"normal":default:return zl.NORMAL}}},E0={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(kl(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},Wp={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")}},U0={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return kl(t)?t.number:1}},$0={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},D0={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(Nt).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})}},Q0={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var a=[],n=[];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:n.push(a.join(" ")),a.length=0;break}}),a.length&&n.push(a.join(" ")),n.map(function(s){return s.indexOf(" ")===-1?s:"'"+s+"'"})}},I0={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},T0={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(kl(t))return t.number;if(Nt(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},V0={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(Nt).map(function(a){return a.value})}},M0={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"}}},xa=function(e,t){return(e&t)!==0},L0={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}},R0={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 n=[],s=t.filter(Qp),o=0;o<s.length;o++){var u=s[o],A=s[o+1];if(u.type===20){var f=A&&kl(A)?A.number:1;n.push({counter:u.value,increment:f})}}return n}},O0={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],n=t.filter(Qp),s=0;s<n.length;s++){var o=n[s],u=n[s+1];if(Nt(o)&&o.value!=="none"){var A=u&&kl(u)?u.number:0;a.push({counter:o.value,reset:A})}}return a}},H0={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(po).map(function(a){return Wp.parse(e,a)})}},P0={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 n=[],s=t.filter(fb);if(s.length%2!==0)return null;for(var o=0;o<s.length;o+=2){var u=s[o].value,A=s[o+1].value;n.push({open:u,close:A})}return n}},yc=function(e,t,a){if(!e)return"";var n=e[Math.min(t,e.length-1)];return n?a?n.open:n.close:""},N0={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&hd(t[0],"none")?[]:zn(t).map(function(a){for(var n={color:255,offsetX:Va,offsetY:Va,blur:Va,spread:Va,inset:!1},s=0,o=0;o<a.length;o++){var u=a[o];hd(u,"inset")?n.inset=!0:Cs(u)?(s===0?n.offsetX=u:s===1?n.offsetY=u:s===2?n.blur=u:n.spread=u,s++):n.color=bs.parse(e,u)}return n})}},K0={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],n=[];return t.filter(Nt).forEach(function(s){switch(s.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2);break}}),a.forEach(function(s){n.indexOf(s)===-1&&n.push(s)}),n}},G0={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},j0={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return po(t)?t.number:0}},z0=function(){function e(t,a){var n,s;this.animationDuration=ze(t,H0,a.animationDuration),this.backgroundClip=ze(t,_b,a.backgroundClip),this.backgroundColor=ze(t,gb,a.backgroundColor),this.backgroundImage=ze(t,Fb,a.backgroundImage),this.backgroundOrigin=ze(t,Eb,a.backgroundOrigin),this.backgroundPosition=ze(t,Ub,a.backgroundPosition),this.backgroundRepeat=ze(t,$b,a.backgroundRepeat),this.backgroundSize=ze(t,Qb,a.backgroundSize),this.borderTopColor=ze(t,Tb,a.borderTopColor),this.borderRightColor=ze(t,Vb,a.borderRightColor),this.borderBottomColor=ze(t,Mb,a.borderBottomColor),this.borderLeftColor=ze(t,Lb,a.borderLeftColor),this.borderTopLeftRadius=ze(t,Rb,a.borderTopLeftRadius),this.borderTopRightRadius=ze(t,Ob,a.borderTopRightRadius),this.borderBottomRightRadius=ze(t,Hb,a.borderBottomRightRadius),this.borderBottomLeftRadius=ze(t,Pb,a.borderBottomLeftRadius),this.borderTopStyle=ze(t,Nb,a.borderTopStyle),this.borderRightStyle=ze(t,Kb,a.borderRightStyle),this.borderBottomStyle=ze(t,Gb,a.borderBottomStyle),this.borderLeftStyle=ze(t,jb,a.borderLeftStyle),this.borderTopWidth=ze(t,zb,a.borderTopWidth),this.borderRightWidth=ze(t,Yb,a.borderRightWidth),this.borderBottomWidth=ze(t,qb,a.borderBottomWidth),this.borderLeftWidth=ze(t,Wb,a.borderLeftWidth),this.boxShadow=ze(t,N0,a.boxShadow),this.color=ze(t,Xb,a.color),this.direction=ze(t,Jb,a.direction),this.display=ze(t,Zb,a.display),this.float=ze(t,t0,a.cssFloat),this.fontFamily=ze(t,Q0,a.fontFamily),this.fontSize=ze(t,I0,a.fontSize),this.fontStyle=ze(t,M0,a.fontStyle),this.fontVariant=ze(t,V0,a.fontVariant),this.fontWeight=ze(t,T0,a.fontWeight),this.letterSpacing=ze(t,a0,a.letterSpacing),this.lineBreak=ze(t,n0,a.lineBreak),this.lineHeight=ze(t,s0,a.lineHeight),this.listStyleImage=ze(t,l0,a.listStyleImage),this.listStylePosition=ze(t,o0,a.listStylePosition),this.listStyleType=ze(t,_d,a.listStyleType),this.marginTop=ze(t,r0,a.marginTop),this.marginRight=ze(t,i0,a.marginRight),this.marginBottom=ze(t,d0,a.marginBottom),this.marginLeft=ze(t,u0,a.marginLeft),this.opacity=ze(t,U0,a.opacity);var o=ze(t,c0,a.overflow);this.overflowX=o[0],this.overflowY=o[o.length>1?1:0],this.overflowWrap=ze(t,A0,a.overflowWrap),this.paddingTop=ze(t,p0,a.paddingTop),this.paddingRight=ze(t,f0,a.paddingRight),this.paddingBottom=ze(t,m0,a.paddingBottom),this.paddingLeft=ze(t,h0,a.paddingLeft),this.paintOrder=ze(t,K0,a.paintOrder),this.position=ze(t,g0,a.position),this.textAlign=ze(t,_0,a.textAlign),this.textDecorationColor=ze(t,$0,(n=a.textDecorationColor)!==null&&n!==void 0?n:a.color),this.textDecorationLine=ze(t,D0,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=ze(t,v0,a.textShadow),this.textTransform=ze(t,y0,a.textTransform),this.transform=ze(t,b0,a.transform),this.transformOrigin=ze(t,x0,a.transformOrigin),this.visibility=ze(t,S0,a.visibility),this.webkitTextStrokeColor=ze(t,G0,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=ze(t,j0,a.webkitTextStrokeWidth),this.wordBreak=ze(t,F0,a.wordBreak),this.zIndex=ze(t,E0,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return ws(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 xa(this.display,4)||xa(this.display,33554432)||xa(this.display,268435456)||xa(this.display,536870912)||xa(this.display,67108864)||xa(this.display,134217728)},e}(),Y0=function(){function e(t,a){this.content=ze(t,L0,a.content),this.quotes=ze(t,P0,a.quotes)}return e}(),bc=function(){function e(t,a){this.counterIncrement=ze(t,R0,a.counterIncrement),this.counterReset=ze(t,O0,a.counterReset)}return e}(),ze=function(e,t,a){var n=new $p,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;n.write(s);var o=new Dp(n.read());switch(t.type){case 2:var u=o.parseComponentValue();return t.parse(e,Nt(u)?u.value:t.initialValue);case 0:return t.parse(e,o.parseComponentValue());case 1:return t.parse(e,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(t.format){case"angle":return Yr.parse(e,o.parseComponentValue());case"color":return bs.parse(e,o.parseComponentValue());case"image":return iu.parse(e,o.parseComponentValue());case"length":var A=o.parseComponentValue();return Cs(A)?A:Va;case"length-percentage":var f=o.parseComponentValue();return wa(f)?f:Va;case"time":return Wp.parse(e,o.parseComponentValue())}break}},q0="data-html2canvas-debug",W0=function(e){var t=e.getAttribute(q0);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},gd=function(e,t){var a=W0(e);return a===1||t===a},Yn=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,gd(a,3))debugger;this.styles=new z0(t,window.getComputedStyle(a,null)),bd(a)&&(this.styles.animationDuration.some(function(n){return n>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=jr(this.context,a),gd(a,4)&&(this.flags|=16)}return e}(),X0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",wc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rl=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Vo=0;Vo<wc.length;Vo++)Rl[wc.charCodeAt(Vo)]=Vo;var J0=function(e){var t=e.length*.75,a=e.length,n,s=0,o,u,A,f;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var m=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(m)?m:new Uint8Array(m);for(n=0;n<a;n+=4)o=Rl[e.charCodeAt(n)],u=Rl[e.charCodeAt(n+1)],A=Rl[e.charCodeAt(n+2)],f=Rl[e.charCodeAt(n+3)],g[s++]=o<<2|u>>4,g[s++]=(u&15)<<4|A>>2,g[s++]=(A&3)<<6|f&63;return m},Z0=function(e){for(var t=e.length,a=[],n=0;n<t;n+=2)a.push(e[n+1]<<8|e[n]);return a},ew=function(e){for(var t=e.length,a=[],n=0;n<t;n+=4)a.push(e[n+3]<<24|e[n+2]<<16|e[n+1]<<8|e[n]);return a},Rs=5,du=11,vi=2,tw=du-Rs,Xp=65536>>Rs,aw=1<<Rs,yi=aw-1,nw=1024>>Rs,sw=Xp+nw,lw=sw,ow=32,rw=lw+ow,iw=65536>>du,dw=1<<tw,uw=dw-1,Cc=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},cw=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},Aw=function(e,t){var a=J0(e),n=Array.isArray(a)?ew(a):new Uint32Array(a),s=Array.isArray(a)?Z0(a):new Uint16Array(a),o=24,u=Cc(s,o/2,n[4]/2),A=n[5]===2?Cc(s,(o+n[4])/2):cw(n,Math.ceil((o+n[4])/4));return new pw(n[0],n[1],n[2],n[3],u,A)},pw=function(){function e(t,a,n,s,o,u){this.initialValue=t,this.errorValue=a,this.highStart=n,this.highValueIndex=s,this.index=o,this.data=u}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Rs],a=(a<<vi)+(t&yi),this.data[a];if(t<=65535)return a=this.index[Xp+(t-55296>>Rs)],a=(a<<vi)+(t&yi),this.data[a];if(t<this.highStart)return a=rw-iw+(t>>du),a=this.index[a],a+=t>>Rs&uw,a=this.index[a],a=(a<<vi)+(t&yi),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Bc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fw=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Mo=0;Mo<Bc.length;Mo++)fw[Bc.charCodeAt(Mo)]=Mo;var mw=1,bi=2,wi=3,kc=4,xc=5,hw=7,Sc=8,Ci=9,Bi=10,Fc=11,Ec=12,Uc=13,$c=14,ki=15,_w=function(e){for(var t=[],a=0,n=e.length;a<n;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<n){var o=e.charCodeAt(a++);(o&64512)===56320?t.push(((s&1023)<<10)+(o&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},gw=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 n=[],s=-1,o="";++s<a;){var u=e[s];u<=65535?n.push(u):(u-=65536,n.push((u>>10)+55296,u%1024+56320)),(s+1===a||n.length>16384)&&(o+=String.fromCharCode.apply(String,n),n.length=0)}return o},vw=Aw(X0),hn="×",xi="÷",yw=function(e){return vw.get(e)},bw=function(e,t,a){var n=a-2,s=t[n],o=t[a-1],u=t[a];if(o===bi&&u===wi)return hn;if(o===bi||o===wi||o===kc||u===bi||u===wi||u===kc)return xi;if(o===Sc&&[Sc,Ci,Fc,Ec].indexOf(u)!==-1||(o===Fc||o===Ci)&&(u===Ci||u===Bi)||(o===Ec||o===Bi)&&u===Bi||u===Uc||u===xc||u===hw||o===mw)return hn;if(o===Uc&&u===$c){for(;s===xc;)s=t[--n];if(s===$c)return hn}if(o===ki&&u===ki){for(var A=0;s===ki;)A++,s=t[--n];if(A%2===0)return hn}return xi},ww=function(e){var t=_w(e),a=t.length,n=0,s=0,o=t.map(yw);return{next:function(){if(n>=a)return{done:!0,value:null};for(var u=hn;n<a&&(u=bw(t,o,++n))===hn;);if(u!==hn||n===a){var A=gw.apply(null,t.slice(s,n));return s=n,{value:A,done:!1}}return{done:!0,value:null}}}},Cw=function(e){for(var t=ww(e),a=[],n;!(n=t.next()).done;)n.value&&a.push(n.value.slice());return a},Bw=function(e){var t=123;if(e.createRange){var a=e.createRange();if(a.getBoundingClientRect){var n=e.createElement("boundtest");n.style.height=t+"px",n.style.display="block",e.body.appendChild(n),a.selectNode(n);var s=a.getBoundingClientRect(),o=Math.round(s.height);if(e.body.removeChild(n),o===t)return!0}}return!1},kw=function(e){var t=e.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",e.body.appendChild(t);var a=e.createRange();t.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var n=t.firstChild,s=zr(n.data).map(function(f){return ma(f)}),o=0,u={},A=s.every(function(f,m){a.setStart(n,o),a.setEnd(n,o+f.length);var g=a.getBoundingClientRect();o+=f.length;var y=g.x>u.x||g.y>u.y;return u=g,m===0?!0:y});return e.body.removeChild(t),A},xw=function(){return typeof new Image().crossOrigin<"u"},Sw=function(){return typeof new XMLHttpRequest().responseType=="string"},Fw=function(e){var t=new Image,a=e.createElement("canvas"),n=a.getContext("2d");if(!n)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(t,0,0),a.toDataURL()}catch{return!1}return!0},Dc=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Ew=function(e){var t=e.createElement("canvas"),a=100;t.width=a,t.height=a;var n=t.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,a,a);var s=new Image,o=t.toDataURL();s.src=o;var u=vd(a,a,0,0,s);return n.fillStyle="red",n.fillRect(0,0,a,a),Qc(u).then(function(A){n.drawImage(A,0,0);var f=n.getImageData(0,0,a,a).data;n.fillStyle="red",n.fillRect(0,0,a,a);var m=e.createElement("div");return m.style.backgroundImage="url("+o+")",m.style.height=a+"px",Dc(f)?Qc(vd(a,a,0,0,m)):Promise.reject(!1)}).then(function(A){return n.drawImage(A,0,0),Dc(n.getImageData(0,0,a,a).data)}).catch(function(){return!1})},vd=function(e,t,a,n,s){var o="http://www.w3.org/2000/svg",u=document.createElementNS(o,"svg"),A=document.createElementNS(o,"foreignObject");return u.setAttributeNS(null,"width",e.toString()),u.setAttributeNS(null,"height",t.toString()),A.setAttributeNS(null,"width","100%"),A.setAttributeNS(null,"height","100%"),A.setAttributeNS(null,"x",a.toString()),A.setAttributeNS(null,"y",n.toString()),A.setAttributeNS(null,"externalResourcesRequired","true"),u.appendChild(A),A.appendChild(s),u},Qc=function(e){return new Promise(function(t,a){var n=new Image;n.onload=function(){return t(n)},n.onerror=a,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},Ta={get SUPPORT_RANGE_BOUNDS(){var e=Bw(document);return Object.defineProperty(Ta,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Ta.SUPPORT_RANGE_BOUNDS&&kw(document);return Object.defineProperty(Ta,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Fw(document);return Object.defineProperty(Ta,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?Ew(document):Promise.resolve(!1);return Object.defineProperty(Ta,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=xw();return Object.defineProperty(Ta,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=Sw();return Object.defineProperty(Ta,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ta,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ta,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Yl=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),Uw=function(e,t,a,n){var s=Qw(t,a),o=[],u=0;return s.forEach(function(A){if(a.textDecorationLine.length||A.trim().length>0)if(Ta.SUPPORT_RANGE_BOUNDS){var f=Ic(n,u,A.length).getClientRects();if(f.length>1){var m=uu(A),g=0;m.forEach(function(v){o.push(new Yl(v,as.fromDOMRectList(e,Ic(n,g+u,v.length).getClientRects()))),g+=v.length})}else o.push(new Yl(A,as.fromDOMRectList(e,f)))}else{var y=n.splitText(A.length);o.push(new Yl(A,$w(e,n))),n=y}else Ta.SUPPORT_RANGE_BOUNDS||(n=n.splitText(A.length));u+=A.length}),o},$w=function(e,t){var a=t.ownerDocument;if(a){var n=a.createElement("html2canvaswrapper");n.appendChild(t.cloneNode(!0));var s=t.parentNode;if(s){s.replaceChild(n,t);var o=jr(e,n);return n.firstChild&&s.replaceChild(n.firstChild,n),o}}return as.EMPTY},Ic=function(e,t,a){var n=e.ownerDocument;if(!n)throw new Error("Node has no owner document");var s=n.createRange();return s.setStart(e,t),s.setEnd(e,t+a),s},uu=function(e){if(Ta.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 Cw(e)},Dw=function(e,t){if(Ta.SUPPORT_NATIVE_TEXT_SEGMENTATION){var a=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(a.segment(e)).map(function(n){return n.segment})}return Tw(e,t)},Qw=function(e,t){return t.letterSpacing!==0?uu(e):Dw(e,t)},Iw=[32,160,4961,65792,65793,4153,4241],Tw=function(e,t){for(var a=iy(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),n=[],s,o=function(){if(s.value){var u=s.value.slice(),A=zr(u),f="";A.forEach(function(m){Iw.indexOf(m)===-1?f+=ma(m):(f.length&&n.push(f),n.push(ma(m)),f="")}),f.length&&n.push(f)}};!(s=a.next()).done;)o();return n},Vw=function(){function e(t,a,n){this.text=Mw(a.data,n.textTransform),this.textBounds=Uw(t,this.text,n,a)}return e}(),Mw=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Lw,Rw);case 2:return e.toUpperCase();default:return e}},Lw=/(^|\s|:|-|\(|\))([a-z])/g,Rw=function(e,t,a){return e.length>0?t+a.toUpperCase():e},Jp=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;return s.src=n.currentSrc||n.src,s.intrinsicWidth=n.naturalWidth,s.intrinsicHeight=n.naturalHeight,s.context.cache.addImage(s.src),s}return t}(Yn),Zp=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;return s.canvas=n,s.intrinsicWidth=n.width,s.intrinsicHeight=n.height,s}return t}(Yn),ef=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this,o=new XMLSerializer,u=jr(a,n);return n.setAttribute("width",u.width+"px"),n.setAttribute("height",u.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(o.serializeToString(n)),s.intrinsicWidth=n.width.baseVal.value,s.intrinsicHeight=n.height.baseVal.value,s.context.cache.addImage(s.svg),s}return t}(Yn),tf=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;return s.value=n.value,s}return t}(Yn),yd=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;return s.start=n.start,s.reversed=typeof n.reversed=="boolean"&&n.reversed===!0,s}return t}(Yn),Ow=[{type:15,flags:0,unit:"px",number:3}],Hw=[{type:16,flags:0,number:50}],Pw=function(e){return e.width>e.height?new as(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new as(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},Nw=function(e){var t=e.type===Kw?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},fr="checkbox",mr="radio",Kw="password",Tc=707406591,cu=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;switch(s.type=n.type.toLowerCase(),s.checked=n.checked,s.value=Nw(n),(s.type===fr||s.type===mr)&&(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=Pw(s.bounds)),s.type){case fr:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=Ow;break;case mr:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=Hw;break}return s}return t}(Yn),af=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this,o=n.options[n.selectedIndex||0];return s.value=o&&o.text||"",s}return t}(Yn),nf=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;return s.value=n.value,s}return t}(Yn),sf=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;s.src=n.src,s.width=parseInt(n.width,10)||0,s.height=parseInt(n.height,10)||0,s.backgroundColor=s.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){s.tree=of(a,n.contentWindow.document.documentElement);var o=n.contentWindow.document.documentElement?jl(a,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):Jn.TRANSPARENT,u=n.contentWindow.document.body?jl(a,getComputedStyle(n.contentWindow.document.body).backgroundColor):Jn.TRANSPARENT;s.backgroundColor=ws(o)?ws(u)?s.styles.backgroundColor:u:o}}catch{}return s}return t}(Yn),Gw=["OL","UL","MENU"],Zo=function(e,t,a,n){for(var s=t.firstChild,o=void 0;s;s=o)if(o=s.nextSibling,rf(s)&&s.data.trim().length>0)a.textNodes.push(new Vw(e,s,a.styles));else if(fl(s))if(Af(s)&&s.assignedNodes)s.assignedNodes().forEach(function(A){return Zo(e,A,a,n)});else{var u=lf(e,s);u.styles.isVisible()&&(jw(s,u,n)?u.flags|=4:zw(u.styles)&&(u.flags|=2),Gw.indexOf(s.tagName)!==-1&&(u.flags|=8),a.elements.push(u),s.slot,s.shadowRoot?Zo(e,s.shadowRoot,u,n):!hr(s)&&!df(s)&&!_r(s)&&Zo(e,s,u,n))}},lf=function(e,t){return wd(t)?new Jp(e,t):uf(t)?new Zp(e,t):df(t)?new ef(e,t):Yw(t)?new tf(e,t):qw(t)?new yd(e,t):Ww(t)?new cu(e,t):_r(t)?new af(e,t):hr(t)?new nf(e,t):cf(t)?new sf(e,t):new Yn(e,t)},of=function(e,t){var a=lf(e,t);return a.flags|=4,Zo(e,t,a,a),a},jw=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Au(e)&&a.styles.isTransparent()},zw=function(e){return e.isPositioned()||e.isFloating()},rf=function(e){return e.nodeType===Node.TEXT_NODE},fl=function(e){return e.nodeType===Node.ELEMENT_NODE},bd=function(e){return fl(e)&&typeof e.style<"u"&&!er(e)},er=function(e){return typeof e.className=="object"},Yw=function(e){return e.tagName==="LI"},qw=function(e){return e.tagName==="OL"},Ww=function(e){return e.tagName==="INPUT"},Xw=function(e){return e.tagName==="HTML"},df=function(e){return e.tagName==="svg"},Au=function(e){return e.tagName==="BODY"},uf=function(e){return e.tagName==="CANVAS"},Vc=function(e){return e.tagName==="VIDEO"},wd=function(e){return e.tagName==="IMG"},cf=function(e){return e.tagName==="IFRAME"},Mc=function(e){return e.tagName==="STYLE"},Jw=function(e){return e.tagName==="SCRIPT"},hr=function(e){return e.tagName==="TEXTAREA"},_r=function(e){return e.tagName==="SELECT"},Af=function(e){return e.tagName==="SLOT"},Lc=function(e){return e.tagName.indexOf("-")>0},Zw=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(n){return a.counters[n].pop()})},e.prototype.parse=function(t){var a=this,n=t.counterIncrement,s=t.counterReset,o=!0;n!==null&&n.forEach(function(A){var f=a.counters[A.counter];f&&A.increment!==0&&(o=!1,f.length||f.push(1),f[Math.max(0,f.length-1)]+=A.increment)});var u=[];return o&&s.forEach(function(A){var f=a.counters[A.counter];u.push(A.counter),f||(f=a.counters[A.counter]=[]),f.push(A.reset)}),u},e}(),Rc={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"]},Oc={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},eC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},tC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},tl=function(e,t,a,n,s,o){return e<t||e>a?io(e,s,o.length>0):n.integers.reduce(function(u,A,f){for(;e>=A;)e-=A,u+=n.values[f];return u},"")+o},pf=function(e,t,a,n){var s="";do a||e--,s=n(e)+s,e/=t;while(e*t>=t);return s},fa=function(e,t,a,n,s){var o=a-t+1;return(e<0?"-":"")+(pf(Math.abs(e),o,n,function(u){return ma(Math.floor(u%o)+t)})+s)},Us=function(e,t,a){a===void 0&&(a=". ");var n=t.length;return pf(Math.abs(e),n,!1,function(s){return t[Math.floor(s%n)]})+a},il=1,ds=2,us=4,Ol=8,Xn=function(e,t,a,n,s,o){if(e<-9999||e>9999)return io(e,4,s.length>0);var u=Math.abs(e),A=s;if(u===0)return t[0]+A;for(var f=0;u>0&&f<=4;f++){var m=u%10;m===0&&xa(o,il)&&A!==""?A=t[m]+A:m>1||m===1&&f===0||m===1&&f===1&&xa(o,ds)||m===1&&f===1&&xa(o,us)&&e>100||m===1&&f>1&&xa(o,Ol)?A=t[m]+(f>0?a[f-1]:"")+A:m===1&&f>0&&(A=a[f-1]+A),u=Math.floor(u/10)}return(e<0?n:"")+A},Hc="十百千萬",Pc="拾佰仟萬",Nc="マイナス",Si="마이너스",io=function(e,t,a){var n=a?". ":"",s=a?"、":"",o=a?", ":"",u=a?" ":"";switch(t){case 0:return"•"+u;case 1:return"◦"+u;case 2:return"◾"+u;case 5:var A=fa(e,48,57,!0,n);return A.length<4?"0"+A:A;case 4:return Us(e,"〇一二三四五六七八九",s);case 6:return tl(e,1,3999,Rc,3,n).toLowerCase();case 7:return tl(e,1,3999,Rc,3,n);case 8:return fa(e,945,969,!1,n);case 9:return fa(e,97,122,!1,n);case 10:return fa(e,65,90,!1,n);case 11:return fa(e,1632,1641,!0,n);case 12:case 49:return tl(e,1,9999,Oc,3,n);case 35:return tl(e,1,9999,Oc,3,n).toLowerCase();case 13:return fa(e,2534,2543,!0,n);case 14:case 30:return fa(e,6112,6121,!0,n);case 15:return Us(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return Us(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return Xn(e,"零一二三四五六七八九",Hc,"負",s,ds|us|Ol);case 47:return Xn(e,"零壹貳參肆伍陸柒捌玖",Pc,"負",s,il|ds|us|Ol);case 42:return Xn(e,"零一二三四五六七八九",Hc,"负",s,ds|us|Ol);case 41:return Xn(e,"零壹贰叁肆伍陆柒捌玖",Pc,"负",s,il|ds|us|Ol);case 26:return Xn(e,"〇一二三四五六七八九","十百千万",Nc,s,0);case 25:return Xn(e,"零壱弐参四伍六七八九","拾百千万",Nc,s,il|ds|us);case 31:return Xn(e,"영일이삼사오육칠팔구","십백천만",Si,o,il|ds|us);case 33:return Xn(e,"零一二三四五六七八九","十百千萬",Si,o,0);case 32:return Xn(e,"零壹貳參四五六七八九","拾百千",Si,o,il|ds|us);case 18:return fa(e,2406,2415,!0,n);case 20:return tl(e,1,19999,tC,3,n);case 21:return fa(e,2790,2799,!0,n);case 22:return fa(e,2662,2671,!0,n);case 22:return tl(e,1,10999,eC,3,n);case 23:return Us(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Us(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return fa(e,3302,3311,!0,n);case 28:return Us(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return Us(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return fa(e,3792,3801,!0,n);case 37:return fa(e,6160,6169,!0,n);case 38:return fa(e,4160,4169,!0,n);case 39:return fa(e,2918,2927,!0,n);case 40:return fa(e,1776,1785,!0,n);case 43:return fa(e,3046,3055,!0,n);case 44:return fa(e,3174,3183,!0,n);case 45:return fa(e,3664,3673,!0,n);case 46:return fa(e,3872,3881,!0,n);case 3:default:return fa(e,48,57,!0,n)}},ff="data-html2canvas-ignore",Kc=function(){function e(t,a,n){if(this.context=t,this.options=n,this.scrolledElements=[],this.referenceElement=a,this.counters=new Zw,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 n=this,s=aC(t,a);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var o=t.defaultView.pageXOffset,u=t.defaultView.pageYOffset,A=s.contentWindow,f=A.document,m=lC(s).then(function(){return Ga(n,void 0,void 0,function(){var g,y;return Ra(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(dC),A&&(A.scrollTo(a.left,a.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(A.scrollY!==a.top||A.scrollX!==a.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(A.scrollX-a.left,A.scrollY-a.top,0,0))),g=this.options.onclone,y=this.clonedReferenceElement,typeof y>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:f.fonts&&f.fonts.ready?[4,f.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,sC(f)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof g=="function"?[2,Promise.resolve().then(function(){return g(f,y)}).then(function(){return s})]:[2,s]}})})});return f.open(),f.write(rC(document.doctype)+"<html></html>"),iC(this.referenceElement.ownerDocument,o,u),f.replaceChild(f.adoptNode(this.documentElement),f.documentElement),f.close(),m},e.prototype.createElementClone=function(t){if(gd(t,2))debugger;if(uf(t))return this.createCanvasClone(t);if(Vc(t))return this.createVideoClone(t);if(Mc(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return wd(a)&&(wd(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Lc(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return Fi(t.style,a),a},e.prototype.createStyleClone=function(t){try{var a=t.sheet;if(a&&a.cssRules){var n=[].slice.call(a.cssRules,0).reduce(function(o,u){return u&&typeof u.cssText=="string"?o+u.cssText:o},""),s=t.cloneNode(!1);return s.textContent=n,s}}catch(o){if(this.context.logger.error("Unable to access cssRules property",o),o.name!=="SecurityError")throw o}return t.cloneNode(!1)},e.prototype.createCanvasClone=function(t){var a;if(this.options.inlineImages&&t.ownerDocument){var n=t.ownerDocument.createElement("img");try{return n.src=t.toDataURL(),n}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 o=t.getContext("2d"),u=s.getContext("2d");if(u)if(!this.options.allowTaint&&o)u.putImageData(o.getImageData(0,0,t.width,t.height),0,0);else{var A=(a=t.getContext("webgl2"))!==null&&a!==void 0?a:t.getContext("webgl");if(A){var f=A.getContextAttributes();(f==null?void 0:f.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}u.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 n=a.getContext("2d");try{return n&&(n.drawImage(t,0,0,a.width,a.height),this.options.allowTaint||n.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,n){(!fl(a)||!Jw(a)&&!a.hasAttribute(ff)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!fl(a)||!Mc(a))&&t.appendChild(this.cloneNode(a,n))},e.prototype.cloneChildNodes=function(t,a,n){for(var s=this,o=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;o;o=o.nextSibling)if(fl(o)&&Af(o)&&typeof o.assignedNodes=="function"){var u=o.assignedNodes();u.length&&u.forEach(function(A){return s.appendChildNode(a,A,n)})}else this.appendChildNode(a,o,n)},e.prototype.cloneNode=function(t,a){if(rf(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var n=t.ownerDocument.defaultView;if(n&&fl(t)&&(bd(t)||er(t))){var s=this.createElementClone(t);s.style.transitionProperty="none";var o=n.getComputedStyle(t),u=n.getComputedStyle(t,":before"),A=n.getComputedStyle(t,":after");this.referenceElement===t&&bd(s)&&(this.clonedReferenceElement=s),Au(s)&&AC(s);var f=this.counters.parse(new bc(this.context,o)),m=this.resolvePseudoContent(t,s,u,ql.BEFORE);Lc(t)&&(a=!0),Vc(t)||this.cloneChildNodes(t,s,a),m&&s.insertBefore(m,s.firstChild);var g=this.resolvePseudoContent(t,s,A,ql.AFTER);return g&&s.appendChild(g),this.counters.pop(f),(o&&(this.options.copyStyles||er(t))&&!cf(t)||a)&&Fi(o,s),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([s,t.scrollLeft,t.scrollTop]),(hr(t)||_r(t))&&(hr(s)||_r(s))&&(s.value=t.value),s}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,a,n,s){var o=this;if(n){var u=n.content,A=a.ownerDocument;if(!(!A||!u||u==="none"||u==="-moz-alt-content"||n.display==="none")){this.counters.parse(new bc(this.context,n));var f=new Y0(this.context,n),m=A.createElement("html2canvaspseudoelement");Fi(n,m),f.content.forEach(function(y){if(y.type===0)m.appendChild(A.createTextNode(y.value));else if(y.type===22){var v=A.createElement("img");v.src=y.value,v.style.opacity="1",m.appendChild(v)}else if(y.type===18){if(y.name==="attr"){var B=y.values.filter(Nt);B.length&&m.appendChild(A.createTextNode(t.getAttribute(B[0].value)||""))}else if(y.name==="counter"){var b=y.values.filter(bl),w=b[0],k=b[1];if(w&&Nt(w)){var S=o.counters.getCounterValue(w.value),M=k&&Nt(k)?_d.parse(o.context,k.value):3;m.appendChild(A.createTextNode(io(S,M,!1)))}}else if(y.name==="counters"){var $=y.values.filter(bl),w=$[0],F=$[1],k=$[2];if(w&&Nt(w)){var L=o.counters.getCounterValues(w.value),Q=k&&Nt(k)?_d.parse(o.context,k.value):3,T=F&&F.type===0?F.value:"",D=L.map(function(O){return io(O,Q,!1)}).join(T);m.appendChild(A.createTextNode(D))}}}else if(y.type===20)switch(y.value){case"open-quote":m.appendChild(A.createTextNode(yc(f.quotes,o.quoteDepth++,!0)));break;case"close-quote":m.appendChild(A.createTextNode(yc(f.quotes,--o.quoteDepth,!1)));break;default:m.appendChild(A.createTextNode(y.value))}}),m.className=Cd+" "+Bd;var g=s===ql.BEFORE?" "+Cd:" "+Bd;return er(a)?a.className.baseValue+=g:a.className+=g,m}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),ql;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(ql||(ql={}));var aC=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(ff,"true"),e.body.appendChild(a),a},nC=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},sC=function(e){return Promise.all([].slice.call(e.images,0).map(nC))},lC=function(e){return new Promise(function(t,a){var n=e.contentWindow;if(!n)return a("No window assigned for iframe");var s=n.document;n.onload=e.onload=function(){n.onload=e.onload=null;var o=setInterval(function(){s.body.childNodes.length>0&&s.readyState==="complete"&&(clearInterval(o),t(e))},50)}})},oC=["all","d","content"],Fi=function(e,t){for(var a=e.length-1;a>=0;a--){var n=e.item(a);oC.indexOf(n)===-1&&t.style.setProperty(n,e.getPropertyValue(n))}return t},rC=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},iC=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},dC=function(e){var t=e[0],a=e[1],n=e[2];t.scrollLeft=a,t.scrollTop=n},uC=":before",cC=":after",Cd="___html2canvas___pseudoelement_before",Bd="___html2canvas___pseudoelement_after",Gc=`{ |
| 19 |
content: "" !important; |
| 20 |
display: none !important; |
| 21 |
}`,AC=function(e){pC(e,"."+Cd+uC+Gc+` |
| 22 |
.`+Bd+cC+Gc)},pC=function(e,t){var a=e.ownerDocument;if(a){var n=a.createElement("style");n.textContent=t,e.appendChild(n)}},mf=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}(),fC=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)||(Ui(t)||gC(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 Ga(this,void 0,void 0,function(){var a,n,s,o,u=this;return Ra(this,function(A){switch(A.label){case 0:return a=mf.isSameOrigin(t),n=!Ei(t)&&this._options.useCORS===!0&&Ta.SUPPORT_CORS_IMAGES&&!a,s=!Ei(t)&&!a&&!Ui(t)&&typeof this._options.proxy=="string"&&Ta.SUPPORT_CORS_XHR&&!n,!a&&this._options.allowTaint===!1&&!Ei(t)&&!Ui(t)&&!s&&!n?[2]:(o=t,s?[4,this.proxy(o)]:[3,2]);case 1:o=A.sent(),A.label=2;case 2:return this.context.logger.debug("Added image "+t.substring(0,256)),[4,new Promise(function(f,m){var g=new Image;g.onload=function(){return f(g)},g.onerror=m,(vC(o)||n)&&(g.crossOrigin="anonymous"),g.src=o,g.complete===!0&&setTimeout(function(){return f(g)},500),u._options.imageTimeout>0&&setTimeout(function(){return m("Timed out ("+u._options.imageTimeout+"ms) loading image")},u._options.imageTimeout)})];case 3:return[2,A.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,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var s=t.substring(0,256);return new Promise(function(o,u){var A=Ta.SUPPORT_RESPONSE_TYPE?"blob":"text",f=new XMLHttpRequest;f.onload=function(){if(f.status===200)if(A==="text")o(f.response);else{var y=new FileReader;y.addEventListener("load",function(){return o(y.result)},!1),y.addEventListener("error",function(v){return u(v)},!1),y.readAsDataURL(f.response)}else u("Failed to proxy resource "+s+" with status code "+f.status)},f.onerror=u;var m=n.indexOf("?")>-1?"&":"?";if(f.open("GET",""+n+m+"url="+encodeURIComponent(t)+"&responseType="+A),A!=="text"&&f instanceof XMLHttpRequest&&(f.responseType=A),a._options.imageTimeout){var g=a._options.imageTimeout;f.timeout=g,f.ontimeout=function(){return u("Timed out ("+g+"ms) proxying "+s)}}f.send()})},e}(),mC=/^data:image\/svg\+xml/i,hC=/^data:image\/.*;base64,/i,_C=/^data:image\/.*/i,gC=function(e){return Ta.SUPPORT_SVG_DRAWING||!yC(e)},Ei=function(e){return _C.test(e)},vC=function(e){return hC.test(e)},Ui=function(e){return e.substr(0,4)==="blob"},yC=function(e){return e.substr(-3).toLowerCase()==="svg"||mC.test(e)},Ne=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}(),al=function(e,t,a){return new Ne(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},Lo=function(){function e(t,a,n,s){this.type=1,this.start=t,this.startControl=a,this.endControl=n,this.end=s}return e.prototype.subdivide=function(t,a){var n=al(this.start,this.startControl,t),s=al(this.startControl,this.endControl,t),o=al(this.endControl,this.end,t),u=al(n,s,t),A=al(s,o,t),f=al(u,A,t);return a?new e(this.start,n,u,f):new e(f,A,o,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}(),yn=function(e){return e.type===1},bC=function(){function e(t){var a=t.styles,n=t.bounds,s=Ll(a.borderTopLeftRadius,n.width,n.height),o=s[0],u=s[1],A=Ll(a.borderTopRightRadius,n.width,n.height),f=A[0],m=A[1],g=Ll(a.borderBottomRightRadius,n.width,n.height),y=g[0],v=g[1],B=Ll(a.borderBottomLeftRadius,n.width,n.height),b=B[0],w=B[1],k=[];k.push((o+f)/n.width),k.push((b+y)/n.width),k.push((u+w)/n.height),k.push((m+v)/n.height);var S=Math.max.apply(Math,k);S>1&&(o/=S,u/=S,f/=S,m/=S,y/=S,v/=S,b/=S,w/=S);var M=n.width-f,$=n.height-v,F=n.width-y,L=n.height-w,Q=a.borderTopWidth,T=a.borderRightWidth,D=a.borderBottomWidth,U=a.borderLeftWidth,I=Xt(a.paddingTop,t.bounds.width),O=Xt(a.paddingRight,t.bounds.width),P=Xt(a.paddingBottom,t.bounds.width),K=Xt(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=o>0||u>0?ea(n.left+U/3,n.top+Q/3,o-U/3,u-Q/3,Vt.TOP_LEFT):new Ne(n.left+U/3,n.top+Q/3),this.topRightBorderDoubleOuterBox=o>0||u>0?ea(n.left+M,n.top+Q/3,f-T/3,m-Q/3,Vt.TOP_RIGHT):new Ne(n.left+n.width-T/3,n.top+Q/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?ea(n.left+F,n.top+$,y-T/3,v-D/3,Vt.BOTTOM_RIGHT):new Ne(n.left+n.width-T/3,n.top+n.height-D/3),this.bottomLeftBorderDoubleOuterBox=b>0||w>0?ea(n.left+U/3,n.top+L,b-U/3,w-D/3,Vt.BOTTOM_LEFT):new Ne(n.left+U/3,n.top+n.height-D/3),this.topLeftBorderDoubleInnerBox=o>0||u>0?ea(n.left+U*2/3,n.top+Q*2/3,o-U*2/3,u-Q*2/3,Vt.TOP_LEFT):new Ne(n.left+U*2/3,n.top+Q*2/3),this.topRightBorderDoubleInnerBox=o>0||u>0?ea(n.left+M,n.top+Q*2/3,f-T*2/3,m-Q*2/3,Vt.TOP_RIGHT):new Ne(n.left+n.width-T*2/3,n.top+Q*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?ea(n.left+F,n.top+$,y-T*2/3,v-D*2/3,Vt.BOTTOM_RIGHT):new Ne(n.left+n.width-T*2/3,n.top+n.height-D*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||w>0?ea(n.left+U*2/3,n.top+L,b-U*2/3,w-D*2/3,Vt.BOTTOM_LEFT):new Ne(n.left+U*2/3,n.top+n.height-D*2/3),this.topLeftBorderStroke=o>0||u>0?ea(n.left+U/2,n.top+Q/2,o-U/2,u-Q/2,Vt.TOP_LEFT):new Ne(n.left+U/2,n.top+Q/2),this.topRightBorderStroke=o>0||u>0?ea(n.left+M,n.top+Q/2,f-T/2,m-Q/2,Vt.TOP_RIGHT):new Ne(n.left+n.width-T/2,n.top+Q/2),this.bottomRightBorderStroke=y>0||v>0?ea(n.left+F,n.top+$,y-T/2,v-D/2,Vt.BOTTOM_RIGHT):new Ne(n.left+n.width-T/2,n.top+n.height-D/2),this.bottomLeftBorderStroke=b>0||w>0?ea(n.left+U/2,n.top+L,b-U/2,w-D/2,Vt.BOTTOM_LEFT):new Ne(n.left+U/2,n.top+n.height-D/2),this.topLeftBorderBox=o>0||u>0?ea(n.left,n.top,o,u,Vt.TOP_LEFT):new Ne(n.left,n.top),this.topRightBorderBox=f>0||m>0?ea(n.left+M,n.top,f,m,Vt.TOP_RIGHT):new Ne(n.left+n.width,n.top),this.bottomRightBorderBox=y>0||v>0?ea(n.left+F,n.top+$,y,v,Vt.BOTTOM_RIGHT):new Ne(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=b>0||w>0?ea(n.left,n.top+L,b,w,Vt.BOTTOM_LEFT):new Ne(n.left,n.top+n.height),this.topLeftPaddingBox=o>0||u>0?ea(n.left+U,n.top+Q,Math.max(0,o-U),Math.max(0,u-Q),Vt.TOP_LEFT):new Ne(n.left+U,n.top+Q),this.topRightPaddingBox=f>0||m>0?ea(n.left+Math.min(M,n.width-T),n.top+Q,M>n.width+T?0:Math.max(0,f-T),Math.max(0,m-Q),Vt.TOP_RIGHT):new Ne(n.left+n.width-T,n.top+Q),this.bottomRightPaddingBox=y>0||v>0?ea(n.left+Math.min(F,n.width-U),n.top+Math.min($,n.height-D),Math.max(0,y-T),Math.max(0,v-D),Vt.BOTTOM_RIGHT):new Ne(n.left+n.width-T,n.top+n.height-D),this.bottomLeftPaddingBox=b>0||w>0?ea(n.left+U,n.top+Math.min(L,n.height-D),Math.max(0,b-U),Math.max(0,w-D),Vt.BOTTOM_LEFT):new Ne(n.left+U,n.top+n.height-D),this.topLeftContentBox=o>0||u>0?ea(n.left+U+K,n.top+Q+I,Math.max(0,o-(U+K)),Math.max(0,u-(Q+I)),Vt.TOP_LEFT):new Ne(n.left+U+K,n.top+Q+I),this.topRightContentBox=f>0||m>0?ea(n.left+Math.min(M,n.width+U+K),n.top+Q+I,M>n.width+U+K?0:f-U+K,m-(Q+I),Vt.TOP_RIGHT):new Ne(n.left+n.width-(T+O),n.top+Q+I),this.bottomRightContentBox=y>0||v>0?ea(n.left+Math.min(F,n.width-(U+K)),n.top+Math.min($,n.height+Q+I),Math.max(0,y-(T+O)),v-(D+P),Vt.BOTTOM_RIGHT):new Ne(n.left+n.width-(T+O),n.top+n.height-(D+P)),this.bottomLeftContentBox=b>0||w>0?ea(n.left+U+K,n.top+L,Math.max(0,b-(U+K)),w-(D+P),Vt.BOTTOM_LEFT):new Ne(n.left+U+K,n.top+n.height-(D+P))}return e}(),Vt;(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"})(Vt||(Vt={}));var ea=function(e,t,a,n,s){var o=4*((Math.sqrt(2)-1)/3),u=a*o,A=n*o,f=e+a,m=t+n;switch(s){case Vt.TOP_LEFT:return new Lo(new Ne(e,m),new Ne(e,m-A),new Ne(f-u,t),new Ne(f,t));case Vt.TOP_RIGHT:return new Lo(new Ne(e,t),new Ne(e+u,t),new Ne(f,m-A),new Ne(f,m));case Vt.BOTTOM_RIGHT:return new Lo(new Ne(f,t),new Ne(f,t+A),new Ne(e+u,m),new Ne(e,m));case Vt.BOTTOM_LEFT:default:return new Lo(new Ne(f,m),new Ne(f-u,m),new Ne(e,t+A),new Ne(e,t))}},gr=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},wC=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},vr=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},CC=function(){function e(t,a,n){this.offsetX=t,this.offsetY=a,this.matrix=n,this.type=0,this.target=6}return e}(),Ro=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),BC=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),kC=function(e){return e.type===0},hf=function(e){return e.type===1},xC=function(e){return e.type===2},jc=function(e,t){return e.length===t.length?e.some(function(a,n){return a===t[n]}):!1},SC=function(e,t,a,n,s){return e.map(function(o,u){switch(u){case 0:return o.add(t,a);case 1:return o.add(t+n,a);case 2:return o.add(t+n,a+s);case 3:return o.add(t,a+s)}return o})},_f=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),gf=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new bC(this.container),this.container.styles.opacity<1&&this.effects.push(new BC(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,o=this.container.styles.transform;this.effects.push(new CC(n,s,o))}if(this.container.styles.overflowX!==0){var u=gr(this.curves),A=vr(this.curves);jc(u,A)?this.effects.push(new Ro(u,6)):(this.effects.push(new Ro(u,2)),this.effects.push(new Ro(A,4)))}}return e.prototype.getEffects=function(t){for(var a=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,s=this.effects.slice(0);n;){var o=n.effects.filter(function(f){return!hf(f)});if(a||n.container.styles.position!==0||!n.parent){if(s.unshift.apply(s,o),a=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var u=gr(n.curves),A=vr(n.curves);jc(u,A)||s.unshift(new Ro(A,6))}}else s.unshift.apply(s,o);n=n.parent}return s.filter(function(f){return xa(f.target,t)})},e}(),kd=function(e,t,a,n){e.container.elements.forEach(function(s){var o=xa(s.flags,4),u=xa(s.flags,2),A=new gf(s,e);xa(s.styles.display,2048)&&n.push(A);var f=xa(s.flags,8)?[]:n;if(o||u){var m=o||s.styles.isPositioned()?a:t,g=new _f(A);if(s.styles.isPositioned()||s.styles.opacity<1||s.styles.isTransformed()){var y=s.styles.zIndex.order;if(y<0){var v=0;m.negativeZIndex.some(function(b,w){return y>b.element.container.styles.zIndex.order?(v=w,!1):v>0}),m.negativeZIndex.splice(v,0,g)}else if(y>0){var B=0;m.positiveZIndex.some(function(b,w){return y>=b.element.container.styles.zIndex.order?(B=w+1,!1):B>0}),m.positiveZIndex.splice(B,0,g)}else m.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else s.styles.isFloating()?m.nonPositionedFloats.push(g):m.nonPositionedInlineLevel.push(g);kd(A,g,o?g:a,f)}else s.styles.isInlineLevel()?t.inlineLevel.push(A):t.nonInlineLevel.push(A),kd(A,t,a,f);xa(s.flags,8)&&vf(s,f)})},vf=function(e,t){for(var a=e instanceof yd?e.start:1,n=e instanceof yd?e.reversed:!1,s=0;s<t.length;s++){var o=t[s];o.container instanceof tf&&typeof o.container.value=="number"&&o.container.value!==0&&(a=o.container.value),o.listValue=io(a,o.container.styles.listStyleType,!0),a+=n?-1:1}},FC=function(e){var t=new gf(e,null),a=new _f(t),n=[];return kd(t,a,a,n),vf(t.container,n),a},zc=function(e,t){switch(t){case 0:return Cn(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return Cn(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return Cn(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return Cn(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},EC=function(e,t){switch(t){case 0:return Cn(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return Cn(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return Cn(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return Cn(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},UC=function(e,t){switch(t){case 0:return Cn(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return Cn(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return Cn(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return Cn(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},$C=function(e,t){switch(t){case 0:return Oo(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return Oo(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return Oo(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return Oo(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},Oo=function(e,t){var a=[];return yn(e)?a.push(e.subdivide(.5,!1)):a.push(e),yn(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},Cn=function(e,t,a,n){var s=[];return yn(e)?s.push(e.subdivide(.5,!1)):s.push(e),yn(a)?s.push(a.subdivide(.5,!0)):s.push(a),yn(n)?s.push(n.subdivide(.5,!0).reverse()):s.push(n),yn(t)?s.push(t.subdivide(.5,!1).reverse()):s.push(t),s},yf=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},yr=function(e){var t=e.styles,a=e.bounds,n=Xt(t.paddingLeft,a.width),s=Xt(t.paddingRight,a.width),o=Xt(t.paddingTop,a.width),u=Xt(t.paddingBottom,a.width);return a.add(n+t.borderLeftWidth,o+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+n+s),-(t.borderTopWidth+t.borderBottomWidth+o+u))},DC=function(e,t){return e===0?t.bounds:e===2?yr(t):yf(t)},QC=function(e,t){return e===0?t.bounds:e===2?yr(t):yf(t)},$i=function(e,t,a){var n=DC(dl(e.styles.backgroundOrigin,t),e),s=QC(dl(e.styles.backgroundClip,t),e),o=IC(dl(e.styles.backgroundSize,t),a,n),u=o[0],A=o[1],f=Ll(dl(e.styles.backgroundPosition,t),n.width-u,n.height-A),m=TC(dl(e.styles.backgroundRepeat,t),f,o,n,s),g=Math.round(n.left+f[0]),y=Math.round(n.top+f[1]);return[m,g,y,u,A]},nl=function(e){return Nt(e)&&e.value===gl.AUTO},Ho=function(e){return typeof e=="number"},IC=function(e,t,a){var n=t[0],s=t[1],o=t[2],u=e[0],A=e[1];if(!u)return[0,0];if(wa(u)&&A&&wa(A))return[Xt(u,a.width),Xt(A,a.height)];var f=Ho(o);if(Nt(u)&&(u.value===gl.CONTAIN||u.value===gl.COVER)){if(Ho(o)){var m=a.width/a.height;return m<o!=(u.value===gl.COVER)?[a.width,a.width/o]:[a.height*o,a.height]}return[a.width,a.height]}var g=Ho(n),y=Ho(s),v=g||y;if(nl(u)&&(!A||nl(A))){if(g&&y)return[n,s];if(!f&&!v)return[a.width,a.height];if(v&&f){var B=g?n:s*o,b=y?s:n/o;return[B,b]}var w=g?n:a.width,k=y?s:a.height;return[w,k]}if(f){var S=0,M=0;return wa(u)?S=Xt(u,a.width):wa(A)&&(M=Xt(A,a.height)),nl(u)?S=M*o:(!A||nl(A))&&(M=S/o),[S,M]}var $=null,F=null;if(wa(u)?$=Xt(u,a.width):A&&wa(A)&&(F=Xt(A,a.height)),$!==null&&(!A||nl(A))&&(F=g&&y?$/n*s:a.height),F!==null&&nl(u)&&($=g&&y?F/s*n:a.width),$!==null&&F!==null)return[$,F];throw new Error("Unable to calculate background-size for element")},dl=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},TC=function(e,t,a,n,s){var o=t[0],u=t[1],A=a[0],f=a[1];switch(e){case 2:return[new Ne(Math.round(n.left),Math.round(n.top+u)),new Ne(Math.round(n.left+n.width),Math.round(n.top+u)),new Ne(Math.round(n.left+n.width),Math.round(f+n.top+u)),new Ne(Math.round(n.left),Math.round(f+n.top+u))];case 3:return[new Ne(Math.round(n.left+o),Math.round(n.top)),new Ne(Math.round(n.left+o+A),Math.round(n.top)),new Ne(Math.round(n.left+o+A),Math.round(n.height+n.top)),new Ne(Math.round(n.left+o),Math.round(n.height+n.top))];case 1:return[new Ne(Math.round(n.left+o),Math.round(n.top+u)),new Ne(Math.round(n.left+o+A),Math.round(n.top+u)),new Ne(Math.round(n.left+o+A),Math.round(n.top+u+f)),new Ne(Math.round(n.left+o),Math.round(n.top+u+f))];default:return[new Ne(Math.round(s.left),Math.round(s.top)),new Ne(Math.round(s.left+s.width),Math.round(s.top)),new Ne(Math.round(s.left+s.width),Math.round(s.height+s.top)),new Ne(Math.round(s.left),Math.round(s.height+s.top))]}},VC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Yc="Hidden Text",MC=function(){function e(t){this._data={},this._document=t}return e.prototype.parseMetrics=function(t,a){var n=this._document.createElement("div"),s=this._document.createElement("img"),o=this._document.createElement("span"),u=this._document.body;n.style.visibility="hidden",n.style.fontFamily=t,n.style.fontSize=a,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",u.appendChild(n),s.src=VC,s.width=1,s.height=1,s.style.margin="0",s.style.padding="0",s.style.verticalAlign="baseline",o.style.fontFamily=t,o.style.fontSize=a,o.style.margin="0",o.style.padding="0",o.appendChild(this._document.createTextNode(Yc)),n.appendChild(o),n.appendChild(s);var A=s.offsetTop-o.offsetTop+2;n.removeChild(o),n.appendChild(this._document.createTextNode(Yc)),n.style.lineHeight="normal",s.style.verticalAlign="super";var f=s.offsetTop-n.offsetTop+2;return u.removeChild(n),{baseline:A,middle:f}},e.prototype.getMetrics=function(t,a){var n=t+" "+a;return typeof this._data[n]>"u"&&(this._data[n]=this.parseMetrics(t,a)),this._data[n]},e}(),bf=function(){function e(t,a){this.context=t,this.options=a}return e}(),LC=1e4,RC=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;return s._activeEffects=[],s.canvas=n.canvas?n.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),n.canvas||(s.canvas.width=Math.floor(n.width*n.scale),s.canvas.height=Math.floor(n.height*n.scale),s.canvas.style.width=n.width+"px",s.canvas.style.height=n.height+"px"),s.fontMetrics=new MC(document),s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-n.x,-n.y),s.ctx.textBaseline="bottom",s._activeEffects=[],s.context.logger.debug("Canvas renderer initialized ("+n.width+"x"+n.height+") with scale "+n.scale),s}return t.prototype.applyEffects=function(a){for(var n=this;this._activeEffects.length;)this.popEffect();a.forEach(function(s){return n.applyEffect(s)})},t.prototype.applyEffect=function(a){this.ctx.save(),xC(a)&&(this.ctx.globalAlpha=a.opacity),kC(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)),hf(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 Ga(this,void 0,void 0,function(){var n;return Ra(this,function(s){switch(s.label){case 0:return n=a.element.container.styles,n.isVisible()?[4,this.renderStackContent(a)]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(a){return Ga(this,void 0,void 0,function(){return Ra(this,function(n){switch(n.label){case 0:if(xa(a.container.flags,16))debugger;return a.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(a)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(a)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.renderTextWithLetterSpacing=function(a,n,s){var o=this;if(n===0)this.ctx.fillText(a.text,a.bounds.left,a.bounds.top+s);else{var u=uu(a.text);u.reduce(function(A,f){return o.ctx.fillText(f,A,a.bounds.top+s),A+o.ctx.measureText(f).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var n=a.fontVariant.filter(function(u){return u==="normal"||u==="small-caps"}).join(""),s=KC(a.fontFamily).join(", "),o=po(a.fontSize)?""+a.fontSize.number+a.fontSize.unit:a.fontSize.number+"px";return[[a.fontStyle,n,a.fontWeight,o,s].join(" "),s,o]},t.prototype.renderTextNode=function(a,n){return Ga(this,void 0,void 0,function(){var s,o,u,A,f,m,g,y,v=this;return Ra(this,function(B){return s=this.createFontStyle(n),o=s[0],u=s[1],A=s[2],this.ctx.font=o,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",f=this.fontMetrics.getMetrics(u,A),m=f.baseline,g=f.middle,y=n.paintOrder,a.textBounds.forEach(function(b){y.forEach(function(w){switch(w){case 0:v.ctx.fillStyle=Fa(n.color),v.renderTextWithLetterSpacing(b,n.letterSpacing,m);var k=n.textShadow;k.length&&b.text.trim().length&&(k.slice(0).reverse().forEach(function(S){v.ctx.shadowColor=Fa(S.color),v.ctx.shadowOffsetX=S.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=S.offsetY.number*v.options.scale,v.ctx.shadowBlur=S.blur.number,v.renderTextWithLetterSpacing(b,n.letterSpacing,m)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),n.textDecorationLine.length&&(v.ctx.fillStyle=Fa(n.textDecorationColor||n.color),n.textDecorationLine.forEach(function(S){switch(S){case 1:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+m),b.bounds.width,1);break;case 2:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:v.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+g),b.bounds.width,1);break}}));break;case 1:n.webkitTextStrokeWidth&&b.text.trim().length&&(v.ctx.strokeStyle=Fa(n.webkitTextStrokeColor),v.ctx.lineWidth=n.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(b.text,b.bounds.left,b.bounds.top+m)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},t.prototype.renderReplacedElement=function(a,n,s){if(s&&a.intrinsicWidth>0&&a.intrinsicHeight>0){var o=yr(a),u=vr(n);this.path(u),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(s,0,0,a.intrinsicWidth,a.intrinsicHeight,o.left,o.top,o.width,o.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(a){return Ga(this,void 0,void 0,function(){var n,s,o,u,A,f,M,M,m,g,y,v,F,B,b,L,w,k,S,M,$,F,L;return Ra(this,function(Q){switch(Q.label){case 0:this.applyEffects(a.getEffects(4)),n=a.container,s=a.curves,o=n.styles,u=0,A=n.textNodes,Q.label=1;case 1:return u<A.length?(f=A[u],[4,this.renderTextNode(f,o)]):[3,4];case 2:Q.sent(),Q.label=3;case 3:return u++,[3,1];case 4:if(!(n instanceof Jp))return[3,8];Q.label=5;case 5:return Q.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return M=Q.sent(),this.renderReplacedElement(n,s,M),[3,8];case 7:return Q.sent(),this.context.logger.error("Error loading image "+n.src),[3,8];case 8:if(n instanceof Zp&&this.renderReplacedElement(n,s,n.canvas),!(n instanceof ef))return[3,12];Q.label=9;case 9:return Q.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return M=Q.sent(),this.renderReplacedElement(n,s,M),[3,12];case 11:return Q.sent(),this.context.logger.error("Error loading svg "+n.svg.substring(0,255)),[3,12];case 12:return n instanceof sf&&n.tree?(m=new t(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,m.render(n.tree)]):[3,14];case 13:g=Q.sent(),n.width&&n.height&&this.ctx.drawImage(g,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),Q.label=14;case 14:if(n instanceof cu&&(y=Math.min(n.bounds.width,n.bounds.height),n.type===fr?n.checked&&(this.ctx.save(),this.path([new Ne(n.bounds.left+y*.39363,n.bounds.top+y*.79),new Ne(n.bounds.left+y*.16,n.bounds.top+y*.5549),new Ne(n.bounds.left+y*.27347,n.bounds.top+y*.44071),new Ne(n.bounds.left+y*.39694,n.bounds.top+y*.5649),new Ne(n.bounds.left+y*.72983,n.bounds.top+y*.23),new Ne(n.bounds.left+y*.84,n.bounds.top+y*.34085),new Ne(n.bounds.left+y*.39363,n.bounds.top+y*.79)]),this.ctx.fillStyle=Fa(Tc),this.ctx.fill(),this.ctx.restore()):n.type===mr&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+y/2,n.bounds.top+y/2,y/4,0,Math.PI*2,!0),this.ctx.fillStyle=Fa(Tc),this.ctx.fill(),this.ctx.restore())),OC(n)&&n.value.length){switch(v=this.createFontStyle(o),F=v[0],B=v[1],b=this.fontMetrics.getMetrics(F,B).baseline,this.ctx.font=F,this.ctx.fillStyle=Fa(o.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=PC(n.styles.textAlign),L=yr(n),w=0,n.styles.textAlign){case 1:w+=L.width/2;break;case 2:w+=L.width;break}k=L.add(w,0,0,-L.height/2+1),this.ctx.save(),this.path([new Ne(L.left,L.top),new Ne(L.left+L.width,L.top),new Ne(L.left+L.width,L.top+L.height),new Ne(L.left,L.top+L.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Yl(n.value,k),o.letterSpacing,b),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!xa(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(S=n.styles.listStyleImage,S.type!==0)return[3,18];M=void 0,$=S.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,n.bounds.left-(M.width+10),n.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&&n.styles.listStyleType!==-1&&(F=this.createFontStyle(o)[0],this.ctx.font=F,this.ctx.fillStyle=Fa(o.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",L=new as(n.bounds.left,n.bounds.top+Xt(n.styles.paddingTop,n.bounds.width),n.bounds.width,gc(o.lineHeight,o.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Yl(a.listValue,L),o.letterSpacing,gc(o.lineHeight,o.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 Ga(this,void 0,void 0,function(){var n,s,S,o,u,S,A,f,S,m,g,S,y,v,S,B,b,S,w,k,S;return Ra(this,function(M){switch(M.label){case 0:if(xa(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:M.sent(),n=0,s=a.negativeZIndex,M.label=2;case 2:return n<s.length?(S=s[n],[4,this.renderStack(S)]):[3,5];case 3:M.sent(),M.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:M.sent(),o=0,u=a.nonInlineLevel,M.label=7;case 7:return o<u.length?(S=u[o],[4,this.renderNode(S)]):[3,10];case 8:M.sent(),M.label=9;case 9:return o++,[3,7];case 10:A=0,f=a.nonPositionedFloats,M.label=11;case 11:return A<f.length?(S=f[A],[4,this.renderStack(S)]):[3,14];case 12:M.sent(),M.label=13;case 13:return A++,[3,11];case 14:m=0,g=a.nonPositionedInlineLevel,M.label=15;case 15:return m<g.length?(S=g[m],[4,this.renderStack(S)]):[3,18];case 16:M.sent(),M.label=17;case 17:return m++,[3,15];case 18:y=0,v=a.inlineLevel,M.label=19;case 19:return y<v.length?(S=v[y],[4,this.renderNode(S)]):[3,22];case 20:M.sent(),M.label=21;case 21:return y++,[3,19];case 22:B=0,b=a.zeroOrAutoZIndexOrTransformedOrOpacity,M.label=23;case 23:return B<b.length?(S=b[B],[4,this.renderStack(S)]):[3,26];case 24:M.sent(),M.label=25;case 25:return B++,[3,23];case 26:w=0,k=a.positiveZIndex,M.label=27;case 27:return w<k.length?(S=k[w],[4,this.renderStack(S)]):[3,30];case 28:M.sent(),M.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},t.prototype.mask=function(a){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(a.slice(0).reverse()),this.ctx.closePath()},t.prototype.path=function(a){this.ctx.beginPath(),this.formatPath(a),this.ctx.closePath()},t.prototype.formatPath=function(a){var n=this;a.forEach(function(s,o){var u=yn(s)?s.start:s;o===0?n.ctx.moveTo(u.x,u.y):n.ctx.lineTo(u.x,u.y),yn(s)&&n.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,n,s,o){this.path(a),this.ctx.fillStyle=n,this.ctx.translate(s,o),this.ctx.fill(),this.ctx.translate(-s,-o)},t.prototype.resizeImage=function(a,n,s){var o;if(a.width===n&&a.height===s)return a;var u=(o=this.canvas.ownerDocument)!==null&&o!==void 0?o:document,A=u.createElement("canvas");A.width=Math.max(1,n),A.height=Math.max(1,s);var f=A.getContext("2d");return f.drawImage(a,0,0,a.width,a.height,0,0,n,s),A},t.prototype.renderBackgroundImage=function(a){return Ga(this,void 0,void 0,function(){var n,s,o,u,A,f;return Ra(this,function(m){switch(m.label){case 0:n=a.styles.backgroundImage.length-1,s=function(g){var y,v,B,I,Y,N,K,G,D,b,I,Y,N,K,G,w,k,S,M,$,F,L,Q,T,D,U,I,O,P,K,G,ne,Y,N,oe,Z,le,te,X,ie,be,se;return Ra(this,function(ce){switch(ce.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,ce.label=1;case 1:return ce.trys.push([1,3,,4]),[4,o.context.cache.match(v)];case 2:return y=ce.sent(),[3,4];case 3:return ce.sent(),o.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(B=$i(a,n,[y.width,y.height,y.width/y.height]),I=B[0],Y=B[1],N=B[2],K=B[3],G=B[4],D=o.ctx.createPattern(o.resizeImage(y,K,G),"repeat"),o.renderRepeat(I,D,Y,N)),[3,6];case 5:kb(g)?(b=$i(a,n,[null,null,null]),I=b[0],Y=b[1],N=b[2],K=b[3],G=b[4],w=yb(g.angle,K,G),k=w[0],S=w[1],M=w[2],$=w[3],F=w[4],L=document.createElement("canvas"),L.width=K,L.height=G,Q=L.getContext("2d"),T=Q.createLinearGradient(S,$,M,F),hc(g.stops,k).forEach(function(pe){return T.addColorStop(pe.stop,Fa(pe.color))}),Q.fillStyle=T,Q.fillRect(0,0,K,G),K>0&&G>0&&(D=o.ctx.createPattern(L,"repeat"),o.renderRepeat(I,D,Y,N))):xb(g)&&(U=$i(a,n,[null,null,null]),I=U[0],O=U[1],P=U[2],K=U[3],G=U[4],ne=g.position.length===0?[ru]:g.position,Y=Xt(ne[0],K),N=Xt(ne[ne.length-1],G),oe=bb(g,Y,N,K,G),Z=oe[0],le=oe[1],Z>0&&le>0&&(te=o.ctx.createRadialGradient(O+Y,P+N,0,O+Y,P+N,Z),hc(g.stops,Z*2).forEach(function(pe){return te.addColorStop(pe.stop,Fa(pe.color))}),o.path(I),o.ctx.fillStyle=te,Z!==le?(X=a.bounds.left+.5*a.bounds.width,ie=a.bounds.top+.5*a.bounds.height,be=le/Z,se=1/be,o.ctx.save(),o.ctx.translate(X,ie),o.ctx.transform(1,0,0,be,0,0),o.ctx.translate(-X,-ie),o.ctx.fillRect(O,se*(P-ie)+ie,K,G*se),o.ctx.restore()):o.ctx.fill())),ce.label=6;case 6:return n--,[2]}})},o=this,u=0,A=a.styles.backgroundImage.slice(0).reverse(),m.label=1;case 1:return u<A.length?(f=A[u],[5,s(f)]):[3,4];case 2:m.sent(),m.label=3;case 3:return u++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(a,n,s){return Ga(this,void 0,void 0,function(){return Ra(this,function(o){return this.path(zc(s,n)),this.ctx.fillStyle=Fa(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,n,s,o){return Ga(this,void 0,void 0,function(){var u,A;return Ra(this,function(f){switch(f.label){case 0:return n<3?[4,this.renderSolidBorder(a,s,o)]:[3,2];case 1:return f.sent(),[2];case 2:return u=EC(o,s),this.path(u),this.ctx.fillStyle=Fa(a),this.ctx.fill(),A=UC(o,s),this.path(A),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return Ga(this,void 0,void 0,function(){var n,s,o,u,A,f,m,g,y=this;return Ra(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),n=a.container.styles,s=!ws(n.backgroundColor)||n.backgroundImage.length,o=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],u=HC(dl(n.backgroundClip,0),a.curves),s||n.boxShadow.length?(this.ctx.save(),this.path(u),this.ctx.clip(),ws(n.backgroundColor)||(this.ctx.fillStyle=Fa(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(a.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(B){y.ctx.save();var b=gr(a.curves),w=B.inset?0:LC,k=SC(b,-w+(B.inset?1:-1)*B.spread.number,(B.inset?1:-1)*B.spread.number,B.spread.number*(B.inset?-2:2),B.spread.number*(B.inset?-2:2));B.inset?(y.path(b),y.ctx.clip(),y.mask(k)):(y.mask(b),y.ctx.clip(),y.path(k)),y.ctx.shadowOffsetX=B.offsetX.number+w,y.ctx.shadowOffsetY=B.offsetY.number,y.ctx.shadowColor=Fa(B.color),y.ctx.shadowBlur=B.blur.number,y.ctx.fillStyle=B.inset?Fa(B.color):"rgba(0,0,0,1)",y.ctx.fill(),y.ctx.restore()}),v.label=2;case 2:A=0,f=0,m=o,v.label=3;case 3:return f<m.length?(g=m[f],g.style!==0&&!ws(g.color)&&g.width>0?g.style!==2?[3,5]:[4,this.renderDashedDottedBorder(g.color,g.width,A,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,A,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,A,a.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(g.color,A,a.curves)];case 10:v.sent(),v.label=11;case 11:A++,v.label=12;case 12:return f++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,n,s,o,u){return Ga(this,void 0,void 0,function(){var A,f,m,g,y,v,B,b,w,k,S,M,$,F,L,Q,L,Q;return Ra(this,function(T){return this.ctx.save(),A=$C(o,s),f=zc(o,s),u===2&&(this.path(f),this.ctx.clip()),yn(f[0])?(m=f[0].start.x,g=f[0].start.y):(m=f[0].x,g=f[0].y),yn(f[1])?(y=f[1].end.x,v=f[1].end.y):(y=f[1].x,v=f[1].y),s===0||s===2?B=Math.abs(m-y):B=Math.abs(g-v),this.ctx.beginPath(),u===3?this.formatPath(A):this.formatPath(f.slice(0,2)),b=n<3?n*3:n*2,w=n<3?n*2:n,u===3&&(b=n,w=n),k=!0,B<=b*2?k=!1:B<=b*2+w?(S=B/(2*b+w),b*=S,w*=S):(M=Math.floor((B+w)/(b+w)),$=(B-M*b)/(M-1),F=(B-(M+1)*b)/M,w=F<=0||Math.abs(w-$)<Math.abs(w-F)?$:F),k&&(u===3?this.ctx.setLineDash([0,b+w]):this.ctx.setLineDash([b,w])),u===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=Fa(a),this.ctx.stroke(),this.ctx.setLineDash([]),u===2&&(yn(f[0])&&(L=f[3],Q=f[0],this.ctx.beginPath(),this.formatPath([new Ne(L.end.x,L.end.y),new Ne(Q.start.x,Q.start.y)]),this.ctx.stroke()),yn(f[1])&&(L=f[1],Q=f[2],this.ctx.beginPath(),this.formatPath([new Ne(L.end.x,L.end.y),new Ne(Q.start.x,Q.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return Ga(this,void 0,void 0,function(){var n;return Ra(this,function(s){switch(s.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Fa(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=FC(a),[4,this.renderStack(n)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(bf),OC=function(e){return e instanceof nf||e instanceof af?!0:e instanceof cu&&e.type!==mr&&e.type!==fr},HC=function(e,t){switch(e){case 0:return gr(t);case 2:return wC(t);case 1:default:return vr(t)}},PC=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},NC=["-apple-system","system-ui"],KC=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return NC.indexOf(t)===-1}):e},GC=function(e){Qn(t,e);function t(a,n){var s=e.call(this,a,n)||this;return s.canvas=n.canvas?n.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),s.options=n,s.canvas.width=Math.floor(n.width*n.scale),s.canvas.height=Math.floor(n.height*n.scale),s.canvas.style.width=n.width+"px",s.canvas.style.height=n.height+"px",s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-n.x,-n.y),s.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+n.width+"x"+n.height+" at "+n.x+","+n.y+") with scale "+n.scale),s}return t.prototype.render=function(a){return Ga(this,void 0,void 0,function(){var n,s;return Ra(this,function(o){switch(o.label){case 0:return n=vd(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,jC(n)];case 1:return s=o.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Fa(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}(bf),jC=function(e){return new Promise(function(t,a){var n=new Image;n.onload=function(){t(n)},n.onerror=a,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},zC=function(){function e(t){var a=t.id,n=t.enabled;this.id=a,this.enabled=n,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,vo([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,vo([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,vo([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,vo([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),YC=function(){function e(t,a){var n;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new zC({id:this.instanceName,enabled:t.logging}),this.cache=(n=t.cache)!==null&&n!==void 0?n:new fC(this,t)}return e.instanceCount=1,e}(),qC=function(e,t){return t===void 0&&(t={}),WC(e,t)};typeof window<"u"&&mf.setContext(window);var WC=function(e,t){return Ga(void 0,void 0,void 0,function(){var a,n,s,o,u,A,f,m,g,y,v,B,b,w,k,S,M,$,F,L,T,Q,T,D,U,I,O,P,K,G,ne,Y,N,oe,Z,le,te,X,ie,be;return Ra(this,function(se){switch(se.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(n=a.defaultView,!n)throw new Error("Document is not attached to a Window");return s={allowTaint:(D=t.allowTaint)!==null&&D!==void 0?D:!1,imageTimeout:(U=t.imageTimeout)!==null&&U!==void 0?U:15e3,proxy:t.proxy,useCORS:(I=t.useCORS)!==null&&I!==void 0?I:!1},o=sd({logging:(O=t.logging)!==null&&O!==void 0?O:!0,cache:t.cache},s),u={windowWidth:(P=t.windowWidth)!==null&&P!==void 0?P:n.innerWidth,windowHeight:(K=t.windowHeight)!==null&&K!==void 0?K:n.innerHeight,scrollX:(G=t.scrollX)!==null&&G!==void 0?G:n.pageXOffset,scrollY:(ne=t.scrollY)!==null&&ne!==void 0?ne:n.pageYOffset},A=new as(u.scrollX,u.scrollY,u.windowWidth,u.windowHeight),f=new YC(o,A),m=(Y=t.foreignObjectRendering)!==null&&Y!==void 0?Y:!1,g={allowTaint:(N=t.allowTaint)!==null&&N!==void 0?N:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:m,copyStyles:m},f.logger.debug("Starting document clone with size "+A.width+"x"+A.height+" scrolled to "+-A.left+","+-A.top),y=new Kc(f,e,g),v=y.clonedReferenceElement,v?[4,y.toIFrame(a,A)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return B=se.sent(),b=Au(v)||Xw(v)?S1(v.ownerDocument):jr(f,v),w=b.width,k=b.height,S=b.left,M=b.top,$=XC(f,v,t.backgroundColor),F={canvas:t.canvas,backgroundColor:$,scale:(Z=(oe=t.scale)!==null&&oe!==void 0?oe:n.devicePixelRatio)!==null&&Z!==void 0?Z:1,x:((le=t.x)!==null&&le!==void 0?le:0)+S,y:((te=t.y)!==null&&te!==void 0?te:0)+M,width:(X=t.width)!==null&&X!==void 0?X:Math.ceil(w),height:(ie=t.height)!==null&&ie!==void 0?ie:Math.ceil(k)},m?(f.logger.debug("Document cloned, using foreign object rendering"),T=new GC(f,F),[4,T.render(v)]):[3,3];case 2:return L=se.sent(),[3,5];case 3:return f.logger.debug("Document cloned, element located at "+S+","+M+" with size "+w+"x"+k+" using computed rendering"),f.logger.debug("Starting DOM parsing"),Q=of(f,v),$===Q.styles.backgroundColor&&(Q.styles.backgroundColor=Jn.TRANSPARENT),f.logger.debug("Starting renderer for element at "+F.x+","+F.y+" with size "+F.width+"x"+F.height),T=new RC(f,F),[4,T.render(Q)];case 4:L=se.sent(),se.label=5;case 5:return(!((be=t.removeContainer)!==null&&be!==void 0)||be)&&(Kc.destroy(B)||f.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),f.logger.debug("Finished rendering"),[2,L]}})})},XC=function(e,t,a){var n=t.ownerDocument,s=n.documentElement?jl(e,getComputedStyle(n.documentElement).backgroundColor):Jn.TRANSPARENT,o=n.body?jl(e,getComputedStyle(n.body).backgroundColor):Jn.TRANSPARENT,u=typeof a=="string"?jl(e,a):a===null?Jn.TRANSPARENT:4294967295;return t===n.documentElement?ws(s)?ws(o)?u:o:s:u};const pa={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef&&qC(a.targetRef,{useCORS:!0,scale:2,backgroundColor:null,scrollY:-window.scrollY}).then(s=>{const o=document.createElement("a");o.download="chart-screenshot.png",o.href=s.toDataURL(),o.click()})},a=e;return(n,s)=>(d(),E(Oe,{tag:"button",onClick:t,size:e.size,title:n.$t("Screenshot")},{default:i(()=>[l(W,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var Di={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 qc;function JC(){return qc||(qc=1,function(e){var t=function(){var a=Array.prototype,n=function(m,g,y){return a.slice.apply(m,a.slice.call(arguments,1))},s="function",o=1e9,u=function(m,g,y,v){if(g|=0,g==0)return[];if(typeof m!==s){var B=u.listSchemes(m,g);if(!B.length)return null;m=B[(y||0)%B.length]}var b=n(arguments,2);return b[0]=g,m.apply(m,b)};u.Scheme=function(m,g){var y={},v=0,B=o,b=function(){if(arguments.length<=1)return w.color_func.bind(w);var k=n(arguments);return function(S){return k[0]=S,w.color_func.apply(w,k)}},w=function(k,S){if(k|=0,!k)return[];var M=k;if(k=Math.abs(k),k<=v){for(var $=Math.max(k,B);!($ in y);++$);var F=y[$];if($>k){var L="shrinking_takes_head"in F?F.shrinking_takes_head:w.shrinking_takes_head;if(L)F=F.slice(0,k),$=k;else return u.generate(function(Q){return F[Math.round(Q)]},M,0,F.length-1)}return F=F.slice(),M<0&&F.reverse(),F}else return w.color_func?u.generate(b.apply(w,arguments),M,0,1,w.color_func_cyclic):null};return w.scheme_name=m,w.groups=g?typeof g=="string"?[g]:g:[],w.max=0,w.cbf_max=o,w.addPalette=function(k,S){var M=k.length;M&&(y[M]=k,B=Math.min(B,M),v=Math.max(v,M),w.max=Math.max(w.max,M),!S&&M!=1&&(w.cbf_max=Math.min(w.cbf_max,M-1)))},w.addPalettes=function(k,S,M){S=S||k.length;for(var $=0;$<S;++$)$ in k&&w.addPalette(k[$],!0);w.cbf_max=Math.min(w.cbf_max,M||1)},w.shrinkByTakingHead=function(k,S){S!==void 0?S in y&&(y[S].shrinking_takes_head=!!k):w.shrinking_takes_head=!!k},w.setColorFunction=function(k,S,M){w.color_func=k,w.color_func_cyclic=!!M,w.max=o,!S&&w.cbf_max===o&&(w.cbf_max=1)},w.color=function(k,S){return w.color_func?w.color_func.apply(this,arguments):null},w},u.Scheme.fromPalettes=function(m,g,y,v,B){var b=u.Scheme(m,g);return b.addPalettes.apply(b,n(arguments,2)),b},u.Scheme.withColorFunction=function(m,g,y,v,B){var b=u.Scheme(m,g);return b.setColorFunction.apply(b,n(arguments,2)),b};var A={};u.register=function(m){A["n-"+m.scheme_name]=[m],m.groups.forEach(function(g){(A["g-"+g]=A["g-"+g]||[]).push(m)}),(A["g-all"]=A["g-all"]||[]).push(m)},u.listSchemes=function(m,g){g?g<0&&(g=-g):g=2;var y=[];return(typeof m=="string"?[m]:m).forEach(function(v){var B=v.substring(v.length-4)==="-cbf";B&&(v=v.substring(0,v.length-4));for(var b=A["g-"+v]||A["n-"+v]||[],w=0,k;k=b[w];++w)(B?k.cbf:k.max)>=g&&y.push(k)}),y.sort(function(v,B){return v.scheme_name>=B.scheme_name?v.scheme_name>B.scheme_name?1:0:-1}),y},u.generate=function(m,g,y,v,B){if(Math.abs(g)<1)return[];if(y=y===void 0?0:y,v=v===void 0?1:v,Math.abs(g)<2)return[m(y)];for(var b=Math.abs(g),w=y,k=[],S=(v-y)/(B?b:b-1);--b>=0;w+=S)k.push(m(w));return g<0&&k.reverse(),k};var f=function(m){return m>0?m<1?m:1:0};return u.rgbColor=function(m,g,y){return[m,g,y].map(function(v){return v=Number(Math.round(f(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},u.linearRgbColor=function(m,g,y){return[m,g,y].map(function(v){return v=f(v),v<=.0031308?v=12.92*v:v=1.055*Math.pow(v,.4166666666666667)-.055,v=Number(Math.round(v*255)).toString(16),v.length==1?"0"+v:v}).join("")},u.hsvColor=function(m,g,y){m*=6;var v=g===void 0?1:f(g),B=y===void 0?1:f(y),b=B*(1-v*Math.abs(m%2-1)),w=B*(1-v);switch(Math.floor(m)%6){case 0:return u.rgbColor(B,b,w);case 1:return u.rgbColor(b,B,w);case 2:return u.rgbColor(w,B,b);case 3:return u.rgbColor(w,b,B);case 4:return u.rgbColor(b,w,B);default:return u.rgbColor(B,w,b)}},u.register(u.Scheme.withColorFunction("rainbow","qualitative",u.hsvColor,!1,!0)),u}();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,n=function(o,u){for(var A=arguments.length-1,f=arguments[A];A>1;)f=f*o+arguments[--A];return f},s=function(o){var u=n(Math.abs(o),1,.278393,.230389,972e-6,.078108);return u*=u,u*=u,u=1-1/u,o<0?-u:u};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(o){return a(1-.392*(1+s((o-.869)/.255)),1.021-.456*(1+s((o-.527)/.376)),1-.493*(1+s((o-.272)/.309)))},t.register(t.Scheme.withColorFunction("tol-sq","sequential",t.tolSequentialColor,!0)),t.tolDivergingColor=function(o){var u=n(o,.572,1.524,-1.811)/n(o,1,-.291,.1574);return a(n(o,.235,-2.13,26.92,-65.5,63.5,-22.36),u*u,1/n(o,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(o){return a(n(o,.472,-.567,4.05)/n(o,1,8.72,-19.17,14.1),n(o,.108932,-1.22635,27.284,-98.577,163.3,-131.395,40.634),1/n(o,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 n in a){var s=a[n];s=t.Scheme.fromPalettes("cb-"+n,[s.type,"cb-"+s.type],s,12,s.cbf),t.register(s)}}(),e.exports&&(e.exports=t)}(Di)),Di.exports}JC();class ZC extends Ya{constructor(){super(...arguments);Ee(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"}]});Ee(this,"storageKey","chart-type");Ee(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=vt.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,n){this.listeners[a]=n}async onChange(a,n,s){const u=this.data[a].findIndex(A=>A.name===n);u!==-1?this.data[a][u].type=s:this.data[a].push({name:n,type:s}),this.syncStorage();for(let A in this.listeners)this.listeners[A](this.applicableFilters)}getChartType(a,n){const o=this.data[a].find(u=>u.name===n);return o?o.type:null}syncStorage(){vt.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 Zt=ZC.init();function zs(e){const t=Re(e[0]).format("MMMM D, YYYY"),a=Re(e[1]).format("MMMM D, YYYY");return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Ys(e){const t=e.split("-");if(t.length===3){const[a,n,s]=t;return`${Ua[parseInt(n)-1]} ${s}`}else if(t.length===2){const[a,n]=t;return`${Ua[parseInt(n)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}function In(e){return e.map(t=>Ys(t.group))}const Sa=ke.colors.report,e2={[Sa.light_gray]:Sa.cyan_blue,[Sa.light_gray_cyan_blue]:Sa.cyan_blue_dark,[Sa.blue]:Sa.royal_blue,[Sa.royal_blue]:Sa.dark_blue,[Sa.medium_slate_blue]:Sa.dark_purple,[Sa.dark_cyan_blue_16]:Sa.dark_cyan_blue_40,[Sa.dark_cyan_blue_24]:Sa.dark_cyan_blue_40,[Sa.blue]:Sa.blue_dark_mode,[Sa.purple]:Sa.purple_dark_mode};function Ma(e){return e2[e]}function an(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const t2={class:"fct-gross-sale-vs-net-revenue-wrap"},a2={class:"fct-btn-group sm"},n2={__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,n=V(null),s=V(null);V("daily");const o=V(Zt.getChartType("order","sales_growth_chart")||"line"),u=ke.colors.report,A=V(ke.isDark()),f=j(()=>a.chartData.every($=>$.orders===0)),m=j(()=>A.value?u.dark_cyan_blue_16:u.light_gray),g=j(()=>A.value?u.dark_cyan_blue_36:u.light_gray_cyan_blue),y=j(()=>[{title:c("Orders"),key:"orders",color:m.value,yAxisIndex:1},{title:c("Revenue"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:$,key:F,color:L,yAxisIndex:Q})=>S($,o.value,a.chartData.map(T=>T[F]),L,Q)));Ua.map($=>$.slice(0,3));const v=j(()=>In(a.chartData));let B=null;const b=()=>{B&&(B.dispose(),B=null),ye(()=>{n.value&&(B=Mt(n.value),k())})},w=j(()=>an(a.chartData.length)),k=()=>{if(!B)return;A.value=ke.isDark();const $={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.dark_cyan_blue_16:u.light_gray_blue}},formatter:F=>{let L=F[0].name;return F.forEach(Q=>{const T=Q.seriesIndex===1?`${Te.scaled(Q.value)}`:Q.value,D=A.value?"#ffffff":"#565865";L+=`<div> |
| 101 |
${Q.marker} |
| 102 |
<span style="color: ${D};">${Q.seriesName}</span> |
| 103 |
<span style="float: right; margin-left: 20px; color: ${D};"> |
| 104 |
${T} |
| 105 |
</span> |
| 106 |
</div>`}),L}},xAxis:{type:"category",data:v.value,axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12,interval:w.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:[{name:c("Revenue"),type:"value",position:"left",axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12,formatter:F=>`${Te.scaledChart(F)}`},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:c("Orders"),type:"value",position:"right",axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:y.value};B.setOption($,{notMerge:!0,replaceMerge:["series"]})},S=($,F,L,Q,T)=>({name:$,type:F,barMaxWidth:30,data:L,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:T,emphasis:{scale:2,itemStyle:{color:Ma(Q)},lineStyle:{color:Q},areaStyle:{opacity:.3,color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),M=$=>{o.value!==$&&(o.value=$,Zt.onChange("order","sales_growth_chart",$),k())};return ge([()=>a.chartData,o],()=>{ye(k)},{deep:!0}),ge(f,$=>{$||b()}),ge(()=>a.loading,$=>{$||b()}),At(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",k),window.addEventListener("fluentCartCurrencyChange",k),ye(b)}),($,F)=>{const L=C("el-skeleton");return d(),_("div",t2,[l(he,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:i(()=>[l(Ce,{title:$.$t("Sales Growth"),border_bottom:""},Rt({_:2},[!f.value&&!e.loading?{name:"action",fn:i(()=>[r("div",a2,[l(jn,{activeType:o.value,types:{bar:"BarChart",line:"LineChart"},onChange:M},null,8,["activeType"]),l(pa,{targetRef:n.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),l(me,{class:"p-0"},{default:i(()=>[e.loading?(d(),E(L,{key:0,animated:"",rows:5,class:"p-4"})):(d(),_(H,{key:1},[f.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-chart-wrap fct-gross-sale-vs-net-revenue-chart",ref_key:"chartRef",ref:n},null,512))],64))]),_:1})]),_:1},512)])}}},s2={class:"fct-gross-sale-vs-net-revenue-wrap"},l2={class:"fct-btn-group sm"},o2={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},r2={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},Wc=.5,Qi=6,Po=1.2,i2={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=ke.colors,n=V(null),s=V(null),o=V(!1),u=V("world"),A=V(92),f=V(100);V(!1);let m=null,g=null,y=50;const v=V(1.2),B=V(),b=a.blue,w=j(()=>{const le=f.value-A.value,te=t.data?t.data.length:0;return le<60||te<15}),k=le=>{le=le.replace(/^#/,"");const te=parseInt(le.substring(0,2),16),X=parseInt(le.substring(2,4),16),ie=parseInt(le.substring(4,6),16);return[te,X,ie]},S=()=>ke.isDark()?a.gray[50]:a.gray[600],M=k(b[500]),$=async()=>{const le=Ps.getUrl("world.geo.json"),X=await(await fetch(le)).json();Uh("world",X)},F=le=>{if(!le||isNaN(le))return`rgba(${M.join(",")}, 0)`;const te=Math.log(le+1)/Math.log(y+1);return`rgba(${M.join(",")}, ${te})`},L=le=>{u.value=le,G(),m&&(m.clear(),m.setOption(P()),le==="bar"&&Q()),g&&o.value&&(g.clear(),g.setOption(P()),le==="bar"&&T())},Q=()=>{m&&(m.off("dataZoom"),m.on("dataZoom",function(le){le.batch&&le.batch[0]?(A.value=le.batch[0].start||0,f.value=le.batch[0].end||100):(A.value=le.start||0,f.value=le.end||100),setTimeout(()=>{G()},100)}))},T=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(le){le.batch&&le.batch[0]?(A.value=le.batch[0].start||0,f.value=le.batch[0].end||100):(A.value=le.start||0,f.value=le.end||100),setTimeout(()=>{g&&g.setOption(P())},100)}))},D=j(()=>(t.data||[]).map(le=>({...le,value:le.value||0,itemStyle:{color:F(le.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),U=()=>({backgroundColor:ke.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:le=>c("%1$s%2$s Orders: %3$s",le.name,"<br>",le.value||0),borderRadius:8,backgroundColor:ke.isDark()?"#38485a":"#ffffff",borderColor:ke.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:ke.isDark()?"#ffffff":"#565865"}},visualMap:{min:0,max:y,left:o.value?"5%":"center",bottom:o.value?"center":"4%",text:[c("High"),c("Low")],orient:o.value?"vertical":"horizontal",calculable:!0,inRange:{color:[b[100],b[500]]},textStyle:{color:a.gray[800]}},series:[{name:"Orders",type:"map",map:"world",roam:B.value,zoom:v.value,label:{show:!1,emphasis:{show:!0,color:a.gray[1e3],fontWeight:"bold",textShadowColor:a.gray[50],textShadowBlur:3,textShadowOffsetX:0,textShadowOffsetY:0}},emphasis:{itemStyle:{areaColor:b[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:D.value}]}),I=j(()=>{const le=t.data.length,te=f.value-A.value,X=Math.ceil(le*te/100);let ie=0;return X>100?ie=9:X>50?ie=4:X>30?ie=2:X>20&&(ie=1),ie}),O=()=>{const le=w.value;return{backgroundColor:ke.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(te){const X=te[0];return`${X.name}<br/>${c("Orders")}: ${X.value||0}`},backgroundColor:ke.isDark()?"#38485a":"#ffffff",textStyle:{color:ke.isDark()?a.gray[25]:a.system.mid},borderColor:ke.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:A.value,end:f.value},{type:"slider",yAxisIndex:0,start:A.value,end:f.value,width:25,top:10,right:10,textStyle:{color:S()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:le?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:le},splitLine:{show:!1},axisLine:{show:le,lineStyle:{color:S()}},axisLabel:{show:le,interval:I.value,color:S(),fontSize:11},data:t.data.map(te=>te.name)},xAxis:{type:"value",axisLabel:{show:!0,color:S(),formatter:function(te){return te.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:ke.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new ed(0,0,1,0,[{offset:0,color:b[400]},{offset:1,color:b[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new ed(0,0,1,0,[{offset:0,color:b[500]},{offset:1,color:b[700]}])}},data:t.data.map(te=>te.value),label:{show:le,formatter:"{c}",position:"right",color:S(),fontSize:10}}]}},P=()=>u.value==="bar"?O():U(),K=async()=>{await $(),n.value&&(m=Mt(n.value),m.setOption(P()),u.value==="bar"&&Q(),m.on("georoam",()=>{const te=m.getOption().series[0].zoom;if(te!==v.value)if(te<Po||te>Qi){const X=Math.max(Po,Math.min(Qi,te));m.setOption({series:[{zoom:X}]},!1),v.value=X}else v.value=te}))},G=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(le=>le.value||0)):y=1,m&&m.setOption(P(),{notMerge:!0})},ne=()=>{v.value=Math.min(v.value+Wc,Qi),B.value=!0,m.setOption({series:[{zoom:v.value,roam:B.value}]})},Y=()=>{v.value=Math.max(v.value-Wc,Po),B.value=!0,m.setOption({series:[{zoom:v.value,roam:B.value}]})},N=()=>{u.value==="bar"?(A.value=92,f.value=100,m&&m.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=Po,B.value="move",m&&(m.clear(),m.setOption(P())))},oe=async()=>{o.value=!0,await ye(),g?g.clear():g=Mt(s.value),g.setOption(P()),u.value==="bar"&&T()},Z=le=>{S(),m&&m.setOption(P())};return Be(()=>{window.addEventListener("onFluentCartThemeChange",Z),B.value="move",ye(K)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",Z),m&&(m.dispose(),m=null),g&&(g.dispose(),g=null)}),ge(()=>t.data,()=>G(),{deep:!0}),ge(w,()=>{u.value==="bar"&&ye(()=>{G()})}),(le,te)=>(d(),_("div",s2,[l(he,{id:"chartContainer",class:"mb-0"},{default:i(()=>[l(Ce,{title:le.$t("Order Heat Map"),border_bottom:""},{action:i(()=>[r("div",l2,[l(jn,{activeType:u.value,types:{world:"Globe",bar:"BarChart"},onChange:L},null,8,["activeType"]),l(pa,{targetRef:n.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),l(me,{class:"p-0 pt-0 relative"},{default:i(()=>[u.value==="world"?(d(),_("div",o2,[l(Oe,{tag:"button",size:"small",onClick:ne},{default:i(()=>[l(W,{name:"Plus"})]),_:1}),l(Oe,{tag:"button",size:"small",onClick:Y},{default:i(()=>[l(W,{name:"Minus"})]),_:1}),l(Oe,{tag:"button",size:"small",onClick:N},{default:i(()=>[l(W,{name:"Reload"})]),_:1}),l(Oe,{tag:"button",size:"small lg:hidden",onClick:oe},{default:i(()=>[l(W,{name:"Eye"})]),_:1})])):x("",!0),u.value==="bar"?(d(),_("div",r2,[l(Oe,{tag:"button",size:"small",onClick:N},{default:i(()=>[l(W,{name:"Reload"})]),_:1})])):x("",!0),r("div",{class:"fct-chart-wrap rounded-[0px] bg-transparent",ref_key:"chartRef",ref:n},null,512)]),_:1})]),_:1}),l(p(Ih),{modelValue:o.value,"onUpdate:modelValue":te[0]||(te[0]=X=>o.value=X),title:le.$t("Order Heat Map"),class:"country-heat-map-dialog"},{default:i(()=>[r("div",{class:"fct-chart-wrap",ref_key:"modalChartRef",ref:s},null,512)]),_:1},8,["modelValue","title"])]))}},d2=He(i2,[["__scopeId","data-v-36a900c8"]]),u2={class:"fct-report-card"},c2={key:0,class:"fct-report-card-header"},A2={key:0,class:"flex items-center gap-2"},p2={class:"title"},f2={class:"actions"},m2={class:"fct-report-card-body flex h-full"},h2={class:"w-full"},fo={__name:"ReportCard",props:{cardOptions:{type:Object,default:()=>({heading:"",linkButtonText:"",linkButtonUrl:"",headingIcon:{type:Boolean,default:!1}})}},setup(e){return(t,a)=>{const n=C("router-link");return d(),_("div",u2,[e.cardOptions.heading||e.cardOptions.linkButtonText?(d(),_("div",c2,[e.cardOptions.heading?(d(),_("div",A2,[e.cardOptions.headingIcon?(d(),E(Oe,{key:0,size:"x-small",bg:"danger",soft:""},{default:i(()=>[l(W,{name:"FailedCircle"})]),_:1})):x("",!0),r("h4",p2,h(e.cardOptions.heading),1)])):x("",!0),r("div",f2,[e.cardOptions.linkButtonText?(d(),E(n,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:i(()=>[R(h(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):x("",!0),oa(t.$slots,"action")])])):x("",!0),r("div",m2,[r("div",h2,[oa(t.$slots,"default")])])])}}},_2={key:0,class:"fct-report-sold-product-list has-scroll"},g2={class:"list-left-content"},v2={class:"list-title"},y2={class:"list-title-inner"},b2={class:"list-id"},w2={class:"list-right-content"},C2=["innerHTML"],B2={class:"list-price"},k2={__name:"RecentOrders",setup(e){const t=Ia.data;return(a,n)=>{const s=C("router-link");return d(),E(fo,{class:"top-sold-products","card-options":{heading:p(c)("Recent Orders"),linkButtonText:p(c)("View All"),linkButtonUrl:"orders"}},{default:i(()=>{var o,u;return[((u=(o=p(t))==null?void 0:o.recentOrders)==null?void 0:u.length)>0?(d(),_("ul",_2,[(d(!0),_(H,null,ee(p(t).recentOrders,A=>(d(),_("li",{key:A.id},[l(s,{class:"no-underline",to:{name:"view_order",params:{order_id:A.id}}},{default:i(()=>[r("div",g2,[r("div",v2,[r("div",y2,h(A.customer_name)+" #"+h(p(Kt)(A.id)),1),r("div",b2,[l($a,{"date-time":A.created_at},null,8,["date-time"])])])]),r("div",w2,[r("div",{class:"list-value",innerHTML:p(Te).scaled(A.total_amount)},null,8,C2),r("div",B2,h(p(Kt)(A.order_items_count))+" "+h(p(c)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},x2={key:0},S2={key:1,class:"fc_dashboard_onboarding_wrap"},F2={class:"fc_dashboard_onboarding_title"},E2={class:"fc_dashboard_onboarding_lists"},U2=["href"],$2={class:"circle-shape"},D2={class:"fc_dashboard_onboarding_item__title"},Q2={__name:"Onboarding",setup(e){const t=V(0),a=V(!1);Qt().ctx;const n=V([]),s=V(!0);V(localStorage.getItem("started_content_collapse")==="true"||!1),j(()=>{const u=Object.keys(n.value).length;return u?Math.round(t.value/u*100):0});const o=Gd("dashboardTogglePageNotification");return Be(async()=>{a.value=!0,re.get("dashboard").then(u=>{var f;n.value=u.data.steps,t.value=u.data.completed,s.value=Object.keys(n.value).length!==t.value,a.value=!1;let A=((f=n.value.page_setup)==null?void 0:f.completed)||!1;o&&o(!A)}).catch(u=>{a.value=!1})}),(u,A)=>{const f=C("el-skeleton"),m=C("Check"),g=C("el-icon");return s.value?(d(),_("div",x2,[a.value?(d(),E(f,{key:0,rows:3,animated:""})):(d(),_("div",S2,[r("h3",F2,h(u.$t("Onboarding Checklist")),1),r("div",E2,[(d(!0),_(H,null,ee(n.value,(y,v)=>(d(),_("a",{key:v,href:y.url,class:de([y.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[r("span",$2,[y.completed===!0?(d(),E(g,{key:0},{default:i(()=>[l(m)]),_:1})):x("",!0)]),r("div",D2,h(y.title),1)],10,U2))),128))])]))])):x("",!0)}}},I2={class:"fct-dashboard-recent-activities-wrap"},T2={class:"fct-dashboard-recent-activities__header"},V2={class:"fct-dashboard-recent-activities__header_title"},M2={class:"fct-dashboard-recent-activities__header_desc"},L2={key:0,class:"fct-dashboard-recent-activities__body"},R2={key:0,class:"fct-dashboard-recent-activities__item has-icon"},O2={class:"content"},H2={class:"title"},P2=["onClick"],N2={class:"date"},K2=["innerHTML"],G2={class:"created_by"},j2={key:1,class:"fct-dashboard-recent-activities__empty"},z2={class:"fct-dashboard-recent-activities__empty_text"},Y2={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=ja(),n=V([{label:c("All"),value:"all"},{label:c("Today"),value:"today"},{label:c("Yesterday"),value:"yesterday"},{label:c("This Week"),value:"this_week"}]),s=V("all"),o=()=>{switch(s.value){case"all":return c("all");case"today":return c("today");case"yesterday":return c("yesterday");case"this_week":return c("this week");default:return s.value}},u=()=>{o(),Ia.getRecentActivities({groupKey:s.value})},A={Order:"orders/view",Payment:"orders/view",Product:"products/view",Customer:"customers/view",Coupon:"coupons/view"},f=g=>{var b;const y={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"}};let v=(b=g==null?void 0:g.module_name)==null?void 0:b.toLowerCase();const B=y[v];B&&g.module_id&&m(g)&&a.push({name:B.name,params:{[B.param]:g.module_id}})},m=g=>{if(!g.module_name)return!0;const y=Ke.get(A,Gt.capitalize(g.module_name));return y?no.has(y):!1};return Be(()=>{u()}),(g,y)=>{const v=C("el-radio-button"),B=C("el-radio-group");return d(),_("div",I2,[r("div",T2,[r("h4",V2,h(p(c)("Recent Activities")),1),r("p",M2,[s.value==="all"?(d(),_(H,{key:0},[R(h(p(c)("%s new activities",p(Kt)(p(Ia).data.recentActivities.length))),1)],64)):(d(),_(H,{key:1},[R(h(p(c)("%1$s new activities %2$s",p(Kt)(p(Ia).data.recentActivities.length),o())),1)],64))]),l(B,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=b=>s.value=b),onChange:u,size:"large"},{default:i(()=>[(d(!0),_(H,null,ee(n.value,(b,w)=>(d(),E(v,{key:w,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),p(Ia).data.recentActivities.length?(d(),_("div",L2,[(d(!0),_(H,null,ee(p(Ia).data.recentActivities,(b,w)=>(d(),_(H,{key:w},[m(b)?(d(),_("div",R2,[y[1]||(y[1]=r("span",{class:"icon"},[r("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[r("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)),r("div",O2,[r("h3",H2,[b.module_name!==""?(d(),_("span",{key:0,onClick:k=>f(b),class:"cursor-pointer"},h(b.title||"--"),9,P2)):(d(),_(H,{key:1},[R(h(b.title),1)],64)),r("span",N2,[l($a,{"date-time":b.created_at},null,8,["date-time"])])]),r("p",{innerHTML:b.content,class:"description"},null,8,K2),r("span",G2,h(p(c)("By %s",b.created_by)),1)])])):x("",!0)],64))),128))])):(d(),_("div",j2,[r("div",z2,h(p(c)("No activity found.")),1)]))])}}},q2={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},W2={__name:"SideBar",setup(e){return(t,a)=>(d(),_("div",q2,[l(St,{permission:"is_super_admin"},{default:i(()=>[l(Q2)]),_:1}),l(Y2,{onReload:a[0]||(a[0]=()=>{})})]))}},X2={class:"fct-product-create"},J2={class:"fct-product-step"},Z2={class:"fct-product-item-selector"},eB=["onClick"],tB={class:"fct-product-item-selector-content"},aB={class:"fct-bundle-product-condition"},nB={class:"condition-text"},sB={class:"dialog-footer"},ai={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,n=t,s=ja(),o=V({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"}}}),u=[{type:"physical",title:c("Physical Product"),icon:"Gift"},{type:"digital",title:c("Digital Product"),icon:"Code"}],A=V(!1),f=V(null),m=v=>{o.value.detail.fulfillment_type=v},g=()=>{A.value=!0,re.post("products",{...o.value}).then(v=>{if(q.success(v.message),a.customModal==="order_modal"){const B={id:v.data.product_variants.id,object_id:v.data.product_variants.post_id,variation_id:v.data.product_variants.id,item_name:v.data.product_variants.variation_title,item_price:v.data.product_variants.item_price,quantity:1,stock:100,object_type:v.data.product_details.fulfillment_type,item_total:v.data.product_variants.item_price,line_total:v.data.product_variants.item_price,tax_amount:0,discount_total:0};n("process_custom",B),n("update:createProductModal",!1)}else s.push({name:"product_edit",params:{product_id:v.data.ID}})}).catch(v=>{var B;v.status_code=="422"?q.validationErrors(v):q.error((B=v.data)==null?void 0:B.message)}).finally(()=>{A.value=!1})},y=v=>{v.stopPropagation(),v.preventDefault(),g()};return Be(()=>{ye(()=>{setTimeout(()=>{var v;(v=f.value)==null||v.focus()},10)})}),(v,B)=>{const b=C("el-input"),w=C("el-form-item"),k=C("el-checkbox"),S=C("el-form"),M=C("el-button");return d(),_("div",X2,[r("div",J2,[l(S,{"label-position":"top",model:o.value,"require-asterisk-position":"right"},{default:i(()=>[l(w,{label:o.value.detail.other_info.is_bundle_product==="yes"?p(c)("Bundle Title"):p(c)("Product Title"),required:""},{default:i(()=>[l(b,{type:"text",modelValue:o.value.post_title,"onUpdate:modelValue":B[0]||(B[0]=$=>o.value.post_title=$),placeholder:o.value.detail.other_info.is_bundle_product==="yes"?p(c)("Bundle Title"):p(c)("Product Title"),minlength:"3",maxlength:"200","show-word-limit":"",autofocus:"",ref_key:"fcProductTitle",ref:f,onKeydown:Pa(y,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(w,null,{default:i(()=>[r("ul",Z2,[(d(),_(H,null,ee(u,$=>r("li",{key:$.type,class:de({active:$.type===o.value.detail.fulfillment_type}),onClick:F=>m($.type)},[r("div",tB,[l(W,{name:$.icon},null,8,["name"]),R(" "+h($.title),1)]),B[2]||(B[2]=r("div",{class:"fct-product-item-selector-dot-wrap"},[r("span",{class:"fct-product-item-selector-dot"})],-1))],10,eB)),64))])]),_:1}),l(w,null,{default:i(()=>[r("div",aB,[l(k,{modelValue:o.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":B[1]||(B[1]=$=>o.value.detail.other_info.is_bundle_product=$),"true-value":"yes","false-value":"no"},{default:i(()=>[R(h(p(c)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),r("span",nB,h(p(c)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),r("div",sB,[l(M,{disabled:!o.value.post_title||A.value,loading:A.value,onClick:g,type:"primary"},{default:i(()=>[R(h(A.value?p(c)("Creating"):p(c)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class pu{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new pu().getHours();if(t>=5&&t<12)return c("Good morning");if(t>=12&&t<17)return c("Good afternoon");if(t>=17&&t<21)return c("Good evening");{const a=[c("Step into the moonlight!"),c("Evening vibes!"),c("The night's still young!")];return a[Math.floor(Math.random()*a.length)]}}}const lB={class:"fct-current-user-info-wrap"},oB={class:"fct-current-user-info-content"},rB={class:"image"},iB=["src","alt"],dB={class:"content"},uB={key:0,class:"fct-current-user-info-action"},cB={__name:"CurrentUserInfo",setup(e){const t=V(!1),a=V(Ie.get("me")),n=()=>Ie.get("shop.store_name"),s=Ie.get("total_products_count");return(o,u)=>{const A=C("el-button"),f=C("el-dialog");return d(),_("div",lB,[r("div",oB,[r("div",rB,[r("img",{src:a.value.avatar,alt:a.value.full_name},null,8,iB)]),r("div",dB,[r("h4",null,h(p(pu).greeting())+" "+h(a.value.full_name)+" 👋🏻",1),r("p",null,h(p(c)("Welcome to %1$s",n())),1)])]),l(St,{permission:"products/create"},{default:i(()=>[p(s)==0?(d(),_("div",uB,[l(A,{onClick:u[0]||(u[0]=m=>t.value=!0),type:"primary"},{default:i(()=>[R(h(p(c)("Add Product")),1)]),_:1})])):x("",!0)]),_:1}),l(f,{"append-to-body":!0,modelValue:t.value,"onUpdate:modelValue":u[1]||(u[1]=m=>t.value=m),onClose:u[2]||(u[2]=m=>t.value=!1),title:p(c)("Add New Product")},{default:i(()=>[l(ai)]),_:1},8,["modelValue","title"])])}}};class AB{constructor(){Ee(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});Ee(this,"defaultMatcherMethod",null)}getMatchingMethod(t){return t==="=="||t==="==="?"matchEqual":this.operatorMap.hasOwnProperty(t)?this.operatorMap[t]:this.defaultMatcherMethod}defaultMatcher(t,a,n){}matchEqual(t,a,n){return n==="==="?t===a:t==a}matchNotEqual(t,a,n){return n==="!=="?t!==a:t!=a}matchContains(t,a,n){return a instanceof String||Array.isArray(a)?a.includes(t):typeof a=="object"?a.hasOwnProperty(t):!1}matchIn(t,a,n){return this.matchContains(t,a,n)}matchNotIn(t,a,n){return!this.matchContains(t,a,n)}}class pB{constructor(){Ee(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});Ee(this,"defaultModifierMethod",null)}getModificationMethod(t){return t==="=="||t==="==="?"matchEqual":this.modifierMap.hasOwnProperty(t)?this.modifierMap[t]:this.defaultModifierMethod}applyAddition(t,a,n,s,o){return t+a}}class fB{constructor(t,a){Ee(this,"value");Ee(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 xd?this.value.setModifiers([]).build():this.value}}}class xd{constructor(t,a){Ee(this,"accessor");Ee(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 fB?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class Ns{constructor(t,a,n,s,o){Ee(this,"conditionType");Ee(this,"conditions");Ee(this,"key");Ee(this,"operator");Ee(this,"value");this.key=t,this.value=a,this.operator=n,this.conditions=[],this.conditionType=this.buildConditionType(s),this.setConditions(o)}static make(t,a,n,s){return new this(t,a,n,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 Ns||typeof t=="function"?t:this.conditions,this}build(){if(Array.isArray(this.conditions)&&this.conditions.length>0){let n=[];return n=this.conditions.map(s=>s instanceof Ns?s.build.bind(s)():s),{condition_type:this.conditionType,conditions:n}}const t=this.key instanceof xd?this.key.build():this.key,a=this.value instanceof xd?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class mB{constructor(t,a){Ee(this,"data");Ee(this,"conditions");Ee(this,"stateKey");Ee(this,"matcher");Ee(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new AB,this.modifier=new pB}match(t,a,n,s=!0){let o="",u=this.matcher.getMatchingMethod(a);return u!=null?o=u:o=Gt.camel("match"+a),o in this.matcher&&typeof this.matcher[o]=="function"?this.matcher[o](t,n,a,s):s}evaluate(t,a="and"){if(t instanceof Ns){const s=t.build.bind(t)();s.hasOwnProperty("conditions")?(t=s.conditions,a=s.condition_type):t=[s]}a=a==="or"?"or":"and";let n=a==="and";if(typeof t=="function")return t(this.stateKey,this.data);if(!Array.isArray(t))return!0;for(let s of t){let o=null;if(Array.isArray(Ke.get(s,"conditions")))o=this.evaluate(s.conditions,Ke.get(s,"condition_type","and"));else{if(s.key===null||s.key===void 0){n=!0;continue}o=this.applyCondition(s)}n=a==="and"?n&&o:n||o}return n}applyCondition(t){let a="",n=null;typeof t.key=="object"?a=Ke.resolvePath(this.stateKey,Ke.get(t,"key.accessor")):a=Ke.resolvePath(this.stateKey,t.key);let s=Ke.get(this.data,a);if(typeof t.value=="object"){const o=Ke.resolvePath(this.stateKey,Ke.get(t,"value.accessor"));n=Ke.get(this.data,o)}else n=t.value;return s=this.applyModification(s,t.key.modifiers,this.stateKey),n=this.applyModification(n,t.value.modifiers,this.stateKey),this.match(s,t.operator,n)}applyModification(t,a,n){return Array.isArray(a)&&a.forEach(s=>{let o=s.operator,u="",A=this.modifier.getModificationMethod(o);if(A!=null?u=A:u=Gt.camel("apply"+o),u in this.modifier&&typeof this.modifier[u]=="function"){let f=s.value;typeof f=="object"&&f!==null&&(f=Ke.getByPath(this.data,n,Ke.get(f,"accessor"))),t=this.modifier[u](t,f,o,n,this.data)}}),t}}class wf{constructor(){Ee(this,"_conditionType","and");Ee(this,"_conditions",null)}conditionType(t){return this._conditionType=t,this}conditions(t){return this._conditions=Array.isArray(t)||t instanceof Ns||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 Ns?a.build.bind(a)():a):t}}class Cf{constructor(){Ee(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class br{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new br;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 Sd{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="",ys.install(this,hp),ys.install(this,Cf),ys.install(this,wf),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 Ns?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??c(Gt.headline(this._key)),label:this._label??c(Gt.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 br?this._suffix.build():this._suffix,prefix:this._prefix instanceof br?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Fd{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,ys.install(this,hp),ys.install(this,Cf),ys.install(this,wf)}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=wl.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 Xc{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");ys.install(this,Sd,{key:t}),ys.install(this,Fd,{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=wl.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??c(Gt.headline(this._key)),label:this._label??c(Gt.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 wl{static build(t){return Array.isArray(t)?wl.buildFromArray(t):typeof t=="object"?wl.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((n,s)=>{const o=t[n];o instanceof Sd||o instanceof Fd||o instanceof Xc?a[n]=o.build.bind(o)():a[n]=t[n]}),a}static buildFromArray(t){let a={};return Array.isArray(t)&&t.forEach(n=>{if(n instanceof Sd||n instanceof Fd||n instanceof Xc){let s=n.build.bind(n)();a[s.key]=s}else a[n.key]=n}),a}}class hB extends Ya{constructor(){super(...arguments);Ee(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});Ee(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);Ee(this,"ignorableFormLayouts",["grid"])}get hasChange(){return this.data.hasChange}setSchema(a){return this.data.schema=wl.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,n={}){return Object.keys(a).reduce((s,o)=>{const u=a[o];if(u.type==="html")return s;if(this.nestedFormLayouts.includes(u.type??""))if(u.disable_nesting===!0){const A=this.ensureNestedDataProperties(u.schema??{},n??{});s={...s,...A}}else s[o]=this.ensureNestedDataProperties(u.schema??{},n[o]??{});else s[o]=n[o]??u.value??"";return s},{})}isVisible(a,n){return a.hasOwnProperty("conditions")?new mB(n,this.values).evaluate(Ke.get(a,"conditions"),Ke.get(a,"condition_type","and")):!0}triggerChange(a){for(let n of this.data.onChangeCallback)n(a)}onDataChanged(a){this.data.onChangeCallback.push(a)}setValue(a,n){Ke.set(this.data.values,a,n),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 n=a?this.data._originalDefaults:this.data.defaults;return this.data.values=this.ensureNestedDataProperties(this.data.schema,JSON.parse(JSON.stringify(n))),this.data.validationErrors={},this.data.hasChange=!1,this.data.initialized=!0,this}}function fu(){return hB.init()}const _B=["innerHTML"],Ed={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(d(),_("div",{class:"form-note",innerHTML:e.note},null,8,_B))}},gB=Object.freeze(Object.defineProperty({__proto__:null,default:Ed},Symbol.toStringTag,{value:"Module"})),Jc=Object.assign({name:"ValidationError"},{__name:"ValidationErrorNew",props:{errorKey:String,form:{type:Object,required:!0}},setup(e){return(t,a)=>e.form.hasValidationError(e.errorKey)?(d(),_("div",{key:0,class:de(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(d(!0),_(H,null,ee(e.form.getValidationError(e.errorKey),(n,s)=>(d(),_("span",{class:"fluent-cart-admin-validation-error",key:n.toLowerCase().replace(/\s/g,"")},h(n),1))),128))],2)):x("",!0)}}),Bf={__name:"Resolver",props:pn({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=kn(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>It(()=>import("./chunks/Test.js?ver=1.4.1"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>It(()=>Promise.resolve().then(()=>UB),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>It(()=>Promise.resolve().then(()=>RB),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>It(()=>Promise.resolve().then(()=>OB),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>It(()=>Promise.resolve().then(()=>gB),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>It(()=>Promise.resolve().then(()=>IB),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>It(()=>Promise.resolve().then(()=>Ak),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>It(()=>Promise.resolve().then(()=>DB),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>It(()=>Promise.resolve().then(()=>KB),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>It(()=>Promise.resolve().then(()=>NB),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>It(()=>Promise.resolve().then(()=>EB),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>It(()=>Promise.resolve().then(()=>HB),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>It(()=>Promise.resolve().then(()=>yB),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>It(()=>Promise.resolve().then(()=>kB),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>It(()=>Promise.resolve().then(()=>xB),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>It(()=>Promise.resolve().then(()=>SB),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>It(()=>import("./chunks/BuyProducts.js?ver=1.4.1"),[],import.meta.url),"./Coupon/Categories.vue":()=>It(()=>import("./chunks/Categories.js?ver=1.4.1"),[],import.meta.url),"./Coupon/Code.vue":()=>It(()=>import("./chunks/Code.js?ver=1.4.1"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>It(()=>import("./chunks/GetProducts.js?ver=1.4.1"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>It(()=>import("./chunks/Categories2.js?ver=1.4.1"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>It(()=>import("./chunks/Product.js?ver=1.4.1"),[],import.meta.url),"./Coupon/Products.vue":()=>It(()=>import("./chunks/Products.js?ver=1.4.1"),[],import.meta.url),"./McpSettings.vue":()=>It(()=>import("./chunks/McpSettings.js?ver=1.4.1"),[],import.meta.url),"./ModuleSettings.vue":()=>It(()=>import("./chunks/ModuleSettings.js?ver=1.4.1"),[],import.meta.url),"./PaymentView.vue":()=>It(()=>import("./chunks/PaymentView.js?ver=1.4.1"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>It(()=>import("./chunks/AddressComponent.js?ver=1.4.1"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>It(()=>import("./chunks/CreatePageButton.js?ver=1.4.1"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>It(()=>import("./chunks/PageSelector.js?ver=1.4.1"),[],import.meta.url),"./TurnstileSettings.vue":()=>It(()=>import("./chunks/TurnstileSettings.js?ver=1.4.1"),[],import.meta.url)}),n=Nm(null);Be(()=>{s(o.name)});const s=async u=>{const A=`./${u}.vue`;a[A]&&(n.value=(await a[A]()).default)},o=e;return(u,A)=>(d(),_(H,null,[(d(),E(bn(n.value),la({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":A[0]||(A[0]=f=>t.value=f)}),null,16,["modelValue"])),oa(u.$slots,"fieldNote"),oa(u.$slots,"validationError")],64))}},vB=["id"],mu={__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 n,s,o,u,A,f,m,g,y,v;return d(),_("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:ia({"--grid-columns":((n=e.field.columns)==null?void 0:n.default)??2,"--sm-grid-columns":((s=e.field.columns)==null?void 0:s.sm)??((o=e.field.columns)==null?void 0:o.default)??2,"--md-grid-columns":((u=e.field.columns)==null?void 0:u.sm)??((A=e.field.columns)==null?void 0:A.md)??((f=e.field.columns)==null?void 0:f.default)??2,"--lg-grid-columns":((m=e.field.columns)==null?void 0:m.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})},[l(li,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],12,vB)}}},yB=Object.freeze(Object.defineProperty({__proto__:null,default:mu},Symbol.toStringTag,{value:"Module"})),bB={key:0,class:"fct-content-card-header"},wB={key:0,class:"title"},CB={key:1,class:"fct-content-card-action"},kf={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(d(),_("div",{class:de({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(d(),_("div",bB,[e.title||t.$slots.title?(d(),_("div",wB,[oa(t.$slots,"title",{},()=>[R(h(e.title),1)])])):x("",!0),t.$slots.action?(d(),_("div",CB,[oa(t.$slots,"action")])):x("",!0)])):x("",!0),r("div",{class:de({"fct-content-card-body":e.show_heading!==!1})},[oa(t.$slots,"default")],2)],2))}},BB=["id"],xf={__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)=>(d(),_("div",{class:"form-section",id:e.field.id||""},[l(he,null,{default:i(()=>[e.field.show_title!==!1?(d(),E(Ce,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):x("",!0),l(me,null,{default:i(()=>[l(mu,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,BB))}},kB=Object.freeze(Object.defineProperty({__proto__:null,default:xf},Symbol.toStringTag,{value:"Module"})),Sf={__name:"FormTab",props:{field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){const t=e,a=V(""),n=V([]),s=ja(),o=m=>{const g=m.props.name;u(g)},u=m=>{const g=new URL(window.location.href);g.hash=`#/settings/${m}`,window.history.replaceState(null,"",g.toString())},A=()=>{const g=window.location.hash.split("/").pop().split("#")[0];n.value=Object.keys(t.field.schema);const y=n.value.find(v=>v===g);y?a.value=y:a.value=t.field.default_tab};let f;return Be(()=>{f=s.beforeEach((m,g,y)=>{y(),setTimeout(()=>{A()},200)}),A()}),At(()=>{f&&f()}),(m,g)=>{const y=C("el-tabs");return d(),E(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:de(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:o,type:"card"},{default:i(()=>[l(li,{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"])}}},xB=Object.freeze(Object.defineProperty({__proto__:null,default:Sf},Symbol.toStringTag,{value:"Module"})),Ff={__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 n=C("el-tab-pane");return d(),E(n,{label:e.field.title,name:e.fieldKey},{default:i(()=>[l(li,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},SB=Object.freeze(Object.defineProperty({__proto__:null,default:Ff},Symbol.toStringTag,{value:"Module"}));class hu{}Ee(hu,"attributesBuilders",async(t,a,n)=>{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=(...o)=>{n.data.hasChange=!0,s.onChange(o)}:s.onChange=()=>{n.data.hasChange=!0};for(let o in t.events)s[o]=(...u)=>{a(t.events[o],u)};for(let o in t.attributes??{}){let u=t.attributes[o];typeof u=="function"&&await a(u,{})}return{...t.attributes??{},...s}});const FB={__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=(o,u)=>{if(typeof o=="function")return o({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(u)&&u.length===1?u[0]:u})},n=V(!1),s=V({});return Be(async()=>{s.value=await hu.attributesBuilders(t.field,a,t.form),n.value=!0}),(o,u)=>(d(),_(H,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(d(),E(mu,la({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"])):x("",!0),e.field.type==="tab"&&typeof e.field.schema<"u"?(d(),E(Sf,la({key:1,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},s.value),null,16,["form","field","value","statePath"])):x("",!0),e.field.type==="tab-pane"&&typeof e.field.schema<"u"&&typeof e.field.title<"u"?(d(),E(Ff,la({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"])):x("",!0),e.field.type==="section"?(d(),E(xf,la({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"])):x("",!0)],64))}},Ef={__name:"Switch",props:pn({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=kn(e,"modelValue");return(a,n)=>{const s=C("el-switch");return d(),E(s,la({modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=o=>t.value=o),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},EB=Object.freeze(Object.defineProperty({__proto__:null,default:Ef},Symbol.toStringTag,{value:"Module"})),Uf={__name:"Checkbox",props:pn({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=kn(e,"modelValue");return(a,n)=>{const s=C("el-checkbox");return d(),E(s,la({modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=o=>t.value=o)},e.attribute,{"true-value":"yes","false-value":"no",disabled:e.field.disabled}),{default:i(()=>[R(h(e.label),1)]),_:1},16,["modelValue","disabled"])}}},UB=Object.freeze(Object.defineProperty({__proto__:null,default:Uf},Symbol.toStringTag,{value:"Module"})),$B=["innerHTML"],$f={__name:"RadioGroup",props:pn({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=kn(e,"modelValue"),a=e,n=V([]),s=async(o="")=>{if(typeof a.field.options=="function")return n.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:o});if(Array.isArray(a.field.options))return n.value=[...a.field.options]};return Be(async()=>{await s()}),(o,u)=>{const A=C("el-radio"),f=C("el-radio-group");return d(),E(f,la({modelValue:t.value,"onUpdate:modelValue":u[0]||(u[0]=m=>t.value=m)},e.attribute),{default:i(()=>[(d(!0),_(H,null,ee(e.field.options,(m,g)=>(d(),E(A,{key:g,value:m.value,class:de(m.option_class)},{default:i(()=>[r("div",null,h(m.label),1),r("div",{innerHTML:m.note},null,8,$B)]),_:2},1032,["value","class"]))),128))]),_:1},16,["modelValue"])}}},DB=Object.freeze(Object.defineProperty({__proto__:null,default:$f},Symbol.toStringTag,{value:"Module"})),QB=["innerHTML"],ul={__name:"Input",props:pn({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=kn(e,"modelValue"),n=e,s=V(),o=async()=>{typeof n.field.prefix=="function"?s.value=await n.callback(n.field.prefix):s.value=n.field.prefix};return Be(()=>{o()}),Km(()=>{o()}),j(()=>n.fieldKey==="amount"?n.form.data.values.type==="fixed"?Ie.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(u,A)=>{var m;const f=C("el-input");return d(),E(f,la({modelValue:a.value,"onUpdate:modelValue":A[0]||(A[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),Rt({_:2},[(m=e.field.prefix)!=null&&m.component?{name:"prefix",fn:i(()=>[l(Bf,{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:i(()=>[r("div",{innerHTML:s.value},null,8,QB)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},IB=Object.freeze(Object.defineProperty({__proto__:null,default:ul},Symbol.toStringTag,{value:"Module"})),TB={class:"fct-color-picker-box"},VB={class:"fct-color-picker-trigger-wrap"},MB={key:0,class:"text-xs text-system-light"},LB={key:1,class:"fct-color-picker-action-wrap"},_u={__name:"ColorPicker",props:pn({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=kn(e,"modelValue"),a=n=>{t.value=""};return(n,s)=>{const o=C("el-color-picker");return d(),_("div",TB,[r("div",VB,[l(o,la({modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=u=>t.value=u)},e.attribute,{disabled:e.field.disabled,"popper-class":"fct-color-picker-popover"}),null,16,["modelValue","disabled"]),t.value?x("",!0):(d(),E(W,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),t.value?x("",!0):(d(),_("span",MB,h(p(c)("Add...")),1)),t.value?(d(),_("div",LB,[r("span",null,h(t.value),1),l(W,{name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:s[1]||(s[1]=u=>a(n.fieldKey))})])):x("",!0)])}}},RB=Object.freeze(Object.defineProperty({__proto__:null,default:_u},Symbol.toStringTag,{value:"Module"})),Df={__name:"Date",props:pn({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=kn(e,"modelValue");return(a,n)=>{const s=C("el-date-picker");return d(),E(s,la({modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=o=>t.value=o)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},OB=Object.freeze(Object.defineProperty({__proto__:null,default:Df},Symbol.toStringTag,{value:"Module"})),Qf={__name:"Time",props:pn({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=kn(e,"modelValue");return(a,n)=>{const s=C("el-time-select");return d(),E(s,la({modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=o=>t.value=o)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},HB=Object.freeze(Object.defineProperty({__proto__:null,default:Qf},Symbol.toStringTag,{value:"Module"})),PB={key:0},If={__name:"Select",props:pn({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=kn(e,"modelValue"),a=e,n=V([]),s=V(!1),o=async(A="")=>{s.value=!0,typeof a.field.options=="function"&&(n.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:A})),Array.isArray(a.field.options)&&(n.value=[...a.field.options]),s.value=!1};Be(async()=>{await o()});const u=A=>typeof A.disabled=="function"?a.callback(A.disabled,{}):A.disabled;return(A,f)=>{const m=C("el-option"),g=C("el-select");return d(),E(g,la({modelValue:t.value,"onUpdate:modelValue":f[0]||(f[0]=y=>t.value=y)},e.attribute,{"remote-method":o,loading:s.value,filterable:e.field.filterable===!0,clearable:e.field.clearable===!0,disabled:e.field.disabled}),{default:i(()=>[(d(!0),_(H,null,ee(n.value,(y,v)=>(d(),E(m,{key:v,value:y.value,label:y.label,disabled:u(y)},{default:i(()=>[y.slot?(d(),_("span",PB,h(y.slot),1)):x("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},NB=Object.freeze(Object.defineProperty({__proto__:null,default:If},Symbol.toStringTag,{value:"Module"})),Tf={__name:"RemoteSearchableSelect",props:pn({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=kn(e,"modelValue"),a=e,n=V(!1),s=V(a.field.options||[]),o=u=>{if(a.field.search_only_on_type===!0){if(u.query.length===0)return}else if(u.query.length<1&&s.value.length>0)return;n.value=!0,re.get("forms/search_options",{search_by:u.query,search_for:u.key}).then(A=>{s.value=A.options,n.value=!1})};return(u,A)=>{const f=C("el-option"),m=C("el-select");return d(),E(m,{modelValue:t.value,"onUpdate:modelValue":A[0]||(A[0]=g=>t.value=g),filterable:"",remote:"",placeholder:e.field.placeholder??p(c)("Please enter a keyword"),"remote-method":g=>{o({query:g,key:e.field.remote_key})},loading:n.value,multiple:e.field.multiple},{default:i(()=>[(d(!0),_(H,null,ee(s.value,g=>(d(),E(f,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},KB=Object.freeze(Object.defineProperty({__proto__:null,default:Tf},Symbol.toStringTag,{value:"Module"}));function xl(e,t){t===void 0&&(t={});var a=t.insertAt;if(e&&typeof document<"u"){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}xl(".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}");xl('.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)}}');xl(".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}");xl(".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}");xl(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");xl(".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 vn="vel",Dn=Hn({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>l("svg",{class:`${vn}-icon icon`,"aria-hidden":"true"},[l("use",{"xlink:href":`#icon-${e.type}`},null)])}),ni=typeof window<"u",cl=()=>{};let Vf=!1;if(ni)try{const e={};Object.defineProperty(e,"passive",{get(){Vf=!0}}),window.addEventListener("test-passive",cl,e)}catch{}const Zc=function(e,t,a){let n=arguments.length>3&&arguments[3]!==void 0&&arguments[3];ni&&e.addEventListener(t,a,!!Vf&&{capture:!1,passive:n})},eA=(e,t,a)=>{ni&&e.removeEventListener(t,a)},GB=e=>{e.preventDefault()},jB=Object.prototype.toString,gu=e=>t=>jB.call(t).slice(8,-1)===e,zB=e=>!!e&&gu("Object")(e),tA=e=>!!e&&gu("String")(e);function YB(e){return e!=null}const qB=Hn({name:"Toolbar",props:{zoomIn:{type:Function,default:cl},zoomOut:{type:Function,default:cl},rotateLeft:{type:Function,default:cl},rotateRight:{type:Function,default:cl},resize:{type:Function,default:cl},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>l("div",{class:`${vn}-toolbar`},[!e.zoomDisabled&&l(H,null,[l("div",{role:"button","aria-label":"zoom in button",class:"toolbar-btn toolbar-btn__zoomin",onClick:e.zoomIn},[l(Dn,{type:"zoomin"},null)]),l("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[l(Dn,{type:"zoomout"},null)])]),l("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[l(Dn,{type:"resize"},null)]),!e.rotateDisabled&&l(H,null,[l("div",{role:"button","aria-label":"image rotate left button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateLeft},[l(Dn,{type:"rotate-left"},null)]),l("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[l(Dn,{type:"rotate-right"},null)])])])}),WB=()=>l("div",{class:`${vn}-loading`},[l("div",{class:"ring"},null)]),XB=()=>l("div",{class:`${vn}-on-error`},[l("div",{class:"ring"},null),l(Dn,{type:"img-broken"},null)]),JB=(e,t)=>{let{slots:a}=t;return l("div",{class:`${vn}-img-title`},[a.default?a.default():""])},ZB=Hn({name:"DefaultIcons",setup:()=>()=>l("svg",{"aria-hidden":!0,style:"position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden;"},[l("symbol",{id:"icon-rotate-right",viewBox:"0 0 1024 1024"},[l("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)]),l("symbol",{id:"icon-rotate-left",viewBox:"0 0 1024 1024"},[l("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)]),l("symbol",{id:"icon-resize",viewBox:"0 0 1024 1024"},[l("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)]),l("symbol",{id:"icon-img-broken",viewBox:"0 0 1024 1024"},[l("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)]),l("symbol",{id:"icon-prev",viewBox:"0 0 1024 1024"},[l("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)]),l("symbol",{id:"icon-next",viewBox:"0 0 1024 1024"},[l("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)]),l("symbol",{id:"icon-zoomin",viewBox:"0 0 1024 1024"},[l("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),l("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null),l("path",{d:"M367.488 238.144h127.104v390.72H367.488z"},null)]),l("symbol",{id:"icon-close",viewBox:"0 0 1024 1024"},[l("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)]),l("symbol",{id:"icon-zoomout",viewBox:"0 0 1024 1024"},[l("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),l("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null)])])}),Wl=ni?window:global;let aA=Date.now();function ek(e){const t=Date.now(),a=Math.max(0,16-(t-aA)),n=setTimeout(e,a);return aA=t+a,n}function Ii(e){return(Wl.requestAnimationFrame||ek).call(Wl,e)}function nA(e){(Wl.cancelAnimationFrame||Wl.clearTimeout).call(Wl,e)}function sA(e,t){const a=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.sqrt(a*a+n*n)}function Ti(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Gm(e)}var Vi=Hn({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:n}=t;const{imgRef:s,imgState:o,setImgSize:u}=(()=>{const _e=V(),xe=Kl({width:0,height:0,maxScale:1});return{imgRef:_e,imgState:xe,setImgSize:()=>{if(_e.value){const{width:Me,height:Fe,naturalWidth:nt}=_e.value;xe.maxScale=nt/Me,xe.width=Me,xe.height=Fe}}}})(),A=V(e.index),f=V(""),m=Kl({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=Kl({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=j(()=>{return _e=e.imgs,gu("Array")(_e)?e.imgs.map(xe=>typeof xe=="string"?{src:xe}:function(Me){return zB(Me)&&tA(Me.src)}(xe)?xe:void 0).filter(YB):tA(e.imgs)?[{src:e.imgs}]:[];var _e}),v=j(()=>y.value[A.value]),B=j(()=>{var _e;return(_e=y.value[A.value])==null?void 0:_e.src}),b=j(()=>{var _e;return(_e=y.value[A.value])==null?void 0:_e.title}),w=j(()=>{var _e;return(_e=y.value[A.value])==null?void 0:_e.alt}),k=j(()=>({cursor:g.loadError?"default":e.moveDisabled?g.dragging?"grabbing":"grab":"move",top:`calc(50% + ${m.top}px)`,left:`calc(50% + ${m.left}px)`,transition:g.dragging||g.gesturing?"none":"",transform:`translate(-50%, -50%) scale(${m.scale}) rotate(${m.rotateDeg}deg)`})),S=()=>{a("hide")},M=()=>{m.scale=1,m.lastScale=1,m.rotateDeg=0,m.top=0,m.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},$=(_e,xe)=>{const Me=A.value;M(),A.value=_e,y.value[A.value]===y.value[_e]&&ye(()=>{g.loading=!1}),e.visible&&Me!==_e&&(xe&&xe(Me,_e),a("on-index-change",Me,_e))},F=()=>{const _e=A.value,xe=e.loop?(_e+1)%y.value.length:_e+1;!e.loop&&xe>y.value.length-1||$(xe,(Me,Fe)=>{a("on-next",Me,Fe),a("on-next-click",Me,Fe)})},L=()=>{const _e=A.value;let xe=_e-1;if(_e===0){if(!e.loop)return;xe=y.value.length-1}$(xe,(Me,Fe)=>{a("on-prev",Me,Fe),a("on-prev-click",Me,Fe)})},Q=_e=>{Math.abs(1-_e)<.05?_e=1:Math.abs(o.maxScale-_e)<.05&&(_e=o.maxScale),m.lastScale=m.scale,m.scale=_e},T=()=>{const _e=m.scale+e.zoomScale;_e<o.maxScale*e.maxZoom&&Q(_e)},D=()=>{const _e=m.scale-e.zoomScale;_e>e.minZoom&&Q(_e)},U=()=>{const _e=m.rotateDeg%360;a("on-rotate",Math.abs(_e<0?_e+360:_e))},I=()=>{m.rotateDeg-=90,U()},O=()=>{m.rotateDeg+=90,U()},P=()=>{m.scale=1,m.top=0,m.left=0},K=function(){let _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&_e===0},{onMouseDown:G,onMouseMove:ne,onMouseUp:Y}=((_e,xe,Me)=>{let Fe,nt=!1;return{onMouseDown:st=>{_e.initX=_e.lastX=st.clientX,_e.initY=_e.lastY=st.clientY,xe.dragging=!0,nt=!1,st.stopPropagation()},onMouseUp:st=>{Me(st.button)&&nA(Fe),xe.dragging=!1,nt=!1},onMouseMove:st=>{if(xe.dragging)if(Me(st.button)){if(nt)return;nt=!0,Fe=Ii(()=>{const{top:Ot,left:Ct,lastY:yt,lastX:Ze}=_e;_e.top=Ot-yt+st.clientY,_e.left=Ct-Ze+st.clientX,_e.lastX=st.clientX,_e.lastY=st.clientY,nt=!1})}else _e.lastX=st.clientX,_e.lastY=st.clientY;st.stopPropagation()}}})(m,g,K),{onTouchStart:N,onTouchMove:oe,onTouchEnd:Z}=((_e,xe,Me,Fe,nt)=>{let st,Ot=!1;return{onTouchStart:Ct=>{const{touches:yt}=Ct;yt.length>1&&nt()?(Me.gesturing=!0,xe.touches=yt):(xe.initX=xe.lastX=yt[0].clientX,xe.initY=xe.lastY=yt[0].clientY,Me.dragging=!0),Ct.stopPropagation()},onTouchMove:Ct=>{if(Ot)return;const{touches:yt}=Ct,{lastX:Ze,lastY:Bt,left:ht,top:Ft,scale:kt}=xe;if(!Me.gesturing&&Me.dragging){if(!yt[0])return;const{clientX:xt,clientY:Ht}=yt[0];Fe()?st=Ii(()=>{xe.lastX=xt,xe.lastY=Ht,xe.top=Ft-Bt+Ht,xe.left=ht-Ze+xt,Ot=!1}):(xe.lastX=xt,xe.lastY=Ht)}else Me.gesturing&&xe.touches.length>1&&yt.length>1&&nt()&&(st=Ii(()=>{const xt=(sA(xe.touches[0],xe.touches[1])-sA(yt[0],yt[1]))/_e.width;xe.touches=yt;const Ht=kt-1.3*xt;Ht>.5&&Ht<1.5*_e.maxScale&&(xe.scale=Ht),Ot=!1}))},onTouchEnd:()=>{nA(st),Me.dragging=!1,Me.gesturing=!1,Ot=!1}}})(o,m,g,K,()=>!e.pinchDisabled),le=()=>{e.dblclickDisabled||(m.scale!==o.maxScale?(m.lastScale=m.scale,m.scale=o.maxScale):m.scale=m.lastScale)},te=_e=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),_e.deltaY<0?T():D())},X=_e=>{const xe=_e;e.visible&&(!e.escDisabled&&xe.key==="Escape"&&e.visible&&S(),xe.key==="ArrowLeft"&&(e.rtl?F():L()),xe.key==="ArrowRight"&&(e.rtl?L():F()))},ie=()=>{e.maskClosable&&S()},be=()=>{u()},se=()=>{g.loading=!1},ce=_e=>{g.loading=!1,g.loadError=!0,a("on-error",_e)},pe=()=>{e.visible&&u()};ge(()=>e.index,_e=>{_e<0||_e>=y.value.length||$(_e)}),ge(()=>g.dragging,(_e,xe)=>{const Me=!_e&&xe;if(!K()&&Me){const Fe=m.lastX-m.initX,nt=m.lastY-m.initY,st=e.swipeTolerance;Math.abs(Fe)>Math.abs(nt)&&(Fe<-1*st?F():Fe>st&&L())}}),ge(()=>e.visible,_e=>{if(_e){M();const xe=y.value.length;if(xe===0)return A.value=0,g.loading=!1,void ye(()=>g.loadError=!0);A.value=e.index>=xe?xe-1:e.index<0?0:e.index,e.scrollDisabled&&De()}else e.scrollDisabled&&$e()});const De=()=>{document&&(f.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},$e=()=>{document&&(document.body.style.overflowY=f.value)};Be(()=>{Zc(document,"keydown",X),Zc(window,"resize",pe)}),xn(()=>{eA(document,"keydown",X),eA(window,"resize",pe),e.scrollDisabled&&$e()});const Je=()=>g.loading?n.loading?n.loading({key:"loading"}):l(WB,{key:"img-loading"},null):g.loadError?n.onerror?n.onerror({key:"onerror"}):l(XB,{key:"img-on-error"},null):l("div",{class:`${vn}-img-wrapper`,style:k.value,key:"img-wrapper"},[l("img",{alt:w.value,ref:s,draggable:"false",class:`${vn}-img`,src:B.value,onMousedown:G,onMouseup:Y,onMousemove:ne,onTouchstart:N,onTouchmove:oe,onTouchend:Z,onLoad:be,onDblclick:le,onDragstart:_e=>{_e.preventDefault()}},null)]),we=()=>{if(n["prev-btn"])return n["prev-btn"]({prev:L});if(y.value.length<=1)return;const _e=!e.loop&&A.value<=0;return l("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(_e?"disable":""),onClick:L},[e.rtl?l(Dn,{type:"next"},null):l(Dn,{type:"prev"},null)])},Ye=()=>{if(n["next-btn"])return n["next-btn"]({next:F});if(y.value.length<=1)return;const _e=!e.loop&&A.value>=y.value.length-1;return l("div",{role:"button","aria-label":"next image button",class:"btn__next "+(_e?"disable":""),onClick:F},[e.rtl?l(Dn,{type:"prev"},null):l(Dn,{type:"next"},null)])},ft=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return n.title?n.title({currentImg:v.value}):b.value?l(JB,null,{default:()=>[b.value]}):void 0},Ge=()=>{let _e;if(e.visible)return l("div",{onTouchmove:GB,class:[`${vn}-modal`,e.rtl?"is-rtl":""],onClick:Xe(ie,["self"]),onWheel:te},[l(ZB,null,null),l(vs,{name:`${vn}-fade`,mode:"out-in"},Ti(_e=Je())?_e:{default:()=>[_e]}),l("img",{style:"display:none;",src:B.value,onError:ce,onLoad:se},null),l("div",{class:`${vn}-btns-wrapper`},[we(),Ye(),ft(),n["close-btn"]?n["close-btn"]({close:S}):l("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:S},[l(Dn,{type:"close"},null)]),n.toolbar?n.toolbar({toolbarMethods:{zoomIn:T,zoomOut:D,rotate:I,rotateLeft:I,rotateRight:O,resize:P},zoomIn:T,zoomOut:D,rotate:I,rotateLeft:I,rotateRight:O,resize:P}):l(qB,{zoomIn:T,zoomOut:D,resize:P,rotateLeft:I,rotateRight:O,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let _e;if(e.teleport){let xe;return l(Rr,{to:e.teleport},{default:()=>[l(vs,{name:`${vn}-fade`},Ti(xe=Ge())?xe:{default:()=>[xe]})]})}return l(vs,{name:`${vn}-fade`},Ti(_e=Ge())?_e:{default:()=>[_e]})}}});const tk=Object.assign(Vi,{install:e=>{e.component(Vi.name,Vi)}}),ak={name:"Attachments",components:{MediaButton:ip,VueEasyLightbox:tk,IconButton:Oe,Delete:Is},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:V([])}},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,n)=>{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:c,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)}}},nk={class:"fct-attachments-wrap",style:{position:"relative"}},sk={class:"fct-attachment-img-wrap"},lk=["src","alt","onClick"],ok={class:"fct-attachments-button"};function rk(e,t,a,n,s,o){const u=C("VueEasyLightbox"),A=C("MediaButton"),f=C("IconButton"),m=C("Delete");return d(),_(H,null,[l(u,{visible:s.visible,imgs:s.lightboxData,index:s.imageIndex,onHide:t[0]||(t[0]=()=>{s.visible=!1})},null,8,["visible","imgs","index"]),r("div",nk,[a.attachments?(d(),_("ul",{key:0,class:de(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(d(!0),_(H,{key:0},ee(a.attachments,(g,y)=>(d(),_("li",{key:y,class:de([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[r("div",sk,[a.previewImage?(d(),_("img",{key:0,src:g.url,alt:g.title,onClick:()=>{s.imageIndex=y,s.visible=!0}},null,8,lk)):x("",!0),o.showMediaButtonAsIcon&&!a.multiple?(d(),E(f,{key:1,size:"x-small"},{default:i(()=>[l(A,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:o.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)]),r("div",ok,[a.showDeleteButton?(d(),E(f,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:Xe(v=>o.removeImageEvent(y),["prevent"]),title:o.translate("Delete media")},{default:i(()=>[a.multiple?(d(),E(m,{key:0})):(d(),_(H,{key:1},[R(h(o.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):x("",!0),o.showMediaButtonAsIcon&&a.multiple?(d(),E(f,{key:1,size:"x-small"},{default:i(()=>[l(A,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:o.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)])],2))),128)):x("",!0),o.showMediaButtonAsIcon?x("",!0):(d(),_("li",{key:1,class:de([a.mediaInputSize,a.mediaInputBg])},[l(A,{"icon-mode":!1,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:o.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])],2))],2)):x("",!0),oa(e.$slots,"default")])],64)}const ik=He(ak,[["render",rk]]),dk={key:0},uk={key:0,class:"setting-label"},si={__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,n=t,s=V();let o=V([]);const u=()=>{a.multiple?s.value=[]:s.value="",o.value=[],n("update:modelValue",s.value)},A=m=>{if(m.length)if(a.multiple){s.value=[],o.value=[];for(const g of m)s.value.push(g),o.value.push(g)}else s.value=m,o.value=m;n("update:modelValue",s.value)};ge(()=>a.modelValue,m=>{Array.isArray(m)&&m.length>0?s.value=m:m&&typeof m=="string"&&m!==""?s.value=[m]:m&&typeof m=="object"?s.value=[m]:s.value=[],f()});const f=()=>{o.value=[],Object.values(s.value).forEach((m,g)=>{m!==void 0&&m!==""&&o.value.push(m)})};return Be(()=>{Array.isArray(a.modelValue)&&a.modelValue.length>0?s.value=a.modelValue:a.modelValue&&typeof a.modelValue=="string"&&a.modelValue!==""?s.value=[a.modelValue]:a.modelValue&&typeof a.modelValue=="object"?s.value=[a.modelValue]:s.value=[],f()}),(m,g)=>(d(),_(H,null,[l(ik,{attachments:p(o),onMediaUploaded:A,onRemoveImage:u,icon:e.icon,title:e.title,mediaInputSize:e.mediaInputSize,mediaInputBg:e.mediaInputBg},null,8,["attachments","icon","title","mediaInputSize","mediaInputBg"]),e.showSupported?(d(),_("div",dk,[e.field&&e.field.label?(d(),_("label",uk,h(e.field.label),1)):x("",!0),r("span",null,h(p(c)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):x("",!0)],64))}},ck={class:"setting-media-wrap"},Mf={__name:"Media",props:pn({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=kn(e,"modelValue");return(a,n)=>(d(),_("div",ck,[l(si,la({modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=s=>t.value=s),field:e.field,icon:"Upload"},e.attribute),null,16,["modelValue","field"])]))}},Ak=Object.freeze(Object.defineProperty({__proto__:null,default:Mf},Symbol.toStringTag,{value:"Module"})),pk={__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;V(!1),Qt().ctx;const a=m=>typeof m.label=="function"?m.label(t.value,t.statePath,t.form):m.label,n=(m,g)=>{if(typeof m=="function")return m({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(g)&&g.length===1?g[0]:g})},s=V(!1);let o={};Be(async()=>{o=await hu.attributesBuilders(t.field,n,t.form),s.value=!0});const u={switch:Ef,checkbox:Uf,radio:$f,input:ul,text:ul,email:ul,number:ul,textarea:ul,color:_u,date:Df,time:Qf,select:If,media:Mf,remote_select:Tf},A=j(()=>u[t.field.type]||null),f=j(()=>({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:o,callback:n}));return(m,g)=>e.field.type==="wp-editor"?(d(),E(ts,{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"])):A.value&&s.value?(d(),E(bn(A.value),la({key:1,onChange:g[1]||(g[1]=y=>{e.form.triggerChange(y)}),onInput:g[2]||(g[2]=y=>{e.form.triggerChange(e.value[e.fieldKey])}),modelValue:e.value[e.fieldKey],"onUpdate:modelValue":g[3]||(g[3]=y=>e.value[e.fieldKey]=y)},f.value),null,16,["modelValue"])):x("",!0)}},fk=["innerHTML"],mk={key:0},hk={key:0},li={__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??"",n=["grid","section","tab","tab-pane"];V(!1),Qt().ctx;const s=(u,A)=>{if(typeof u.label=="function"){let f=o(u)?a:A+".",m=o(u)?t.value:t.value[A];return u.label(m,f,t.form)}return u.label},o=u=>u.disable_nesting!==!1;return(u,A)=>(d(!0),_(H,null,ee(e.schema,(f,m)=>(d(),_(H,{key:m},[e.form.isVisible(f,e.statePath+m)?(d(),_(H,{key:0},[f.type==="html"?(d(),_("div",{key:0,class:de(`setting-html-wrapper ${f.wrapperClass??""}`),innerHTML:f.value},null,10,fk)):(d(),_(H,{key:1},[f.component?(d(),_("div",{key:0,class:de(f.wrapperClass??"")},[f.component&&f.label?(d(),E(sa,{key:0,title:s(f,m),content:f.tooltip,class:"setting-label",placement:f.tooltip_placement},{default:i(()=>[f.labelOptional?(d(),_("span",mk,"("+h(f.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),l(Bf,{modelValue:e.value[m],"onUpdate:modelValue":g=>e.value[m]=g,name:f.component,form:e.form,statePath:o(f)?p(a):m+".",field:f,"field-key":m,value:o(f)?e.value:e.value[m],nesting:o(f)},{fieldNote:i(()=>[f.note&&f.hide_note!==!0?(d(),E(Ed,{key:0,note:f.note},null,8,["note"])):x("",!0)]),validationError:i(()=>[l(Jc,{form:e.form,"error-key":p(a)+m},null,8,["form","error-key"])]),_:2},1032,["modelValue","onUpdate:modelValue","name","form","statePath","field","field-key","value","nesting"])],2)):x("",!0),n.includes(f.type)?(d(),E(FB,{key:1,form:e.form,field:f,value:e.value,"full-state-path":p(a),statePath:o(f)?p(a):m+".","field-key":m},null,8,["form","field","value","full-state-path","statePath","field-key"])):x("",!0),typeof f.type<"u"&&!n.includes(f.type)&&!["custom","component","html","hidden"].includes(f.type)?(d(),_("div",{key:2,class:de(`setting-fields-inner ${f.wrapperClass??""}`)},[f.type!=="checkbox"&&!f.component&&f.label!==!1?(d(),E(sa,{key:0,class:"setting-label",title:s(f,m),content:f.tooltip,placement:f.tooltip_placement},{default:i(()=>[f.labelOptional?(d(),_("span",hk,"("+h(f.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),l(pk,{form:e.form,field:f,value:e.value,"full-state-path":p(a),"state-path":e.statePath,"field-key":m},null,8,["form","field","value","full-state-path","state-path","field-key"]),f.note&&!f.component?(d(),E(Ed,{key:1,note:f.note},null,8,["note"])):x("",!0),f.component?x("",!0):(d(),E(Jc,{key:2,form:e.form,"error-key":p(a)+m},null,8,["form","error-key"]))],2)):x("",!0)],64))],64)):x("",!0)],64))),128))}},_k={key:0,class:"vue-form-wrap"},gk={key:0,class:"form-section-save-action"},vk={key:0,class:"cmd block leading-none"},oi={__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 n=()=>{const m=window.location.hash.split("#"),g=m.length>1?m[m.length-1]:"";if(!g)return;const y=document.getElementById(g);y&&(y.scrollIntoView({behavior:"smooth",block:"start"}),y.classList.add("fct-scroll-highlight"),y.addEventListener("animationend",()=>y.classList.remove("fct-scroll-highlight"),{once:!0}))},s=e,o=a;ge(()=>s.form.isReady,()=>{ye(()=>n())},{once:!0}),Be(()=>{ye(()=>{u.registerCopyAction(),s.form.isReady&&n()})}),V({});const u=Qt().ctx,A=()=>{o("onSubmitButtonClick")};return t({getState:()=>s.form.values}),(m,g)=>{const y=C("el-button");return e.form.isReady?(d(),_("div",_k,[l(li,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(d(),_("div",gk,[l(y,{onClick:A,type:"primary",loading:e.loading},{default:i(()=>[e.loading?x("",!0):(d(),_("span",vk,"⌘s")),R(" "+h(e.submitButtonText),1)]),_:1},8,["loading"])])):x("",!0)])):x("",!0)}}},yk={key:0},bk={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let n=fu();const s=a,o=e,u=()=>{const g=o.form_name,y={};return y[g]={...n.values},y},A=()=>{n.reset()},f=()=>{var g;return((g=o.widget)==null?void 0:g.reset_on_save)==!0},m=Gd("triggerChange");return Be(()=>{n.setSchema(o.schema).setDefaults(o.values).initForm(),n.onDataChanged(g=>{m==null||m(),s("change")})}),t({getState:u,resetForm:A,resetOnSave:f}),(g,y)=>p(n).isReady?(d(),_("div",yk,[l(oi,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:p(n),onOnSubmitButtonClick:y[0]||(y[0]=()=>{p(n).values}),onOnChange:y[1]||(y[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):x("",!0)}},wk={__name:"EChart",props:{option:{type:Object,required:!0},height:{type:String,default:"400px"},width:{type:String,default:"100%"}},setup(e){const t=e,a=V(null);let n=null;const s=()=>{a.value&&(n=Mt(a.value),n.setOption(t.option))};ge(()=>t.option,f=>{n&&f&&n.setOption(f,!0)},{deep:!0});const o=(f,m)=>{if(f==null||f==="")return m;const g=Number(f);return isNaN(g)?f:`${g}px`},u=j(()=>o(t.height,"400px")),A=j(()=>o(t.width,"100%"));return Be(()=>{s(),window.addEventListener("resize",()=>n==null?void 0:n.resize())}),xn(()=>{window.removeEventListener("resize",()=>n==null?void 0:n.resize()),n==null||n.dispose()}),(f,m)=>(d(),_("div",{ref_key:"chartRef",ref:a,style:ia({width:A.value,height:u.value})},null,4))}},Ck={class:"fct-step-indicator"},Bk={class:"indicator-title"},kk={class:"indicator-steps"},xk={class:"indicator-progress"},Sk={class:"indicator-steps-bar"},Fk=["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(n,s)=>(d(),_("div",Ck,[r("div",Bk,h(e.steps[e.currentStep-1].label),1),r("div",kk,[r("div",xk,h(e.currentStep)+"/"+h(e.steps.length)+" "+h(n.$t("Completed")),1),r("div",Sk,[(d(!0),_(H,null,ee(e.steps,(o,u)=>(d(),_("div",{key:u,class:"indicator-step",onClick:A=>a("step-click",u+1)},[r("div",{class:de(["indicator-step-bar",u<e.currentStep?"is-completed":""])},null,2)],8,Fk))),128))])])]))}},Uk=["type","disabled","aria-disabled"],$k={key:0,class:"fct-btn-spinner"},Dk="6px",Qk={__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,n=t,s=j(()=>a.disabled||a.loading),o=()=>`width ${a.duration}ms ease, opacity ${a.duration}ms ease, margin-right ${a.duration}ms ease`,u=y=>{y.style.width="0",y.style.opacity="0",y.style.overflow="hidden",y.style.marginRight="6px"},A=(y,v)=>{const B=y.scrollWidth+"px";y.style.transition=o(),requestAnimationFrame(()=>{y.style.width=B,y.style.opacity="1",y.style.marginRight=""}),setTimeout(()=>v(),a.duration)},f=y=>{y.style.width="auto",y.style.overflow="",y.style.marginRight=""},m=y=>{y.style.width=y.scrollWidth+"px",y.style.opacity="1",y.style.overflow="hidden",y.style.marginRight=Dk},g=(y,v)=>{y.offsetHeight,y.style.transition=o(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const B=b=>{b.propertyName==="width"&&(y.removeEventListener("transitionend",B),v())};y.addEventListener("transitionend",B)};return(y,v)=>(d(),_("button",{type:e.nativeType,class:de(["el-button",e.type&&`el-button--${e.type}`,e.size&&`el-button--${e.size}`,{"is-plain":e.plain,"is-loading":e.loading,"is-disabled":s.value}]),disabled:s.value,"aria-disabled":s.value,onClick:v[0]||(v[0]=B=>n("click",B))},[l(vs,{onBeforeEnter:u,onEnter:A,onAfterEnter:f,onBeforeLeave:m,onLeave:g},{default:i(()=>[e.loading?(d(),_("span",$k,v[1]||(v[1]=[r("i",{class:"el-icon is-loading"},[r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[r("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})])],-1)]))):x("",!0)]),_:1}),r("span",null,[oa(y.$slots,"default",{},void 0,!0)])],10,Uk))}},Ik=He(Qk,[["__scopeId","data-v-fa8794a2"]]),Lf={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var m,g,y,v,B,b;const t=zA(YA),a=Object.freeze({get:(...w)=>re.get(...w),post:(...w)=>re.post(...w),put:(...w)=>re.put(...w),delete:(...w)=>re.delete(...w),patch:(...w)=>re.patch(...w),upload:(...w)=>re.upload(...w),getNonce:()=>re.getNonce()}),n=Object.freeze({success:(...w)=>q.success(...w),error:(...w)=>q.error(...w),info:(...w)=>q.info(...w),validationErrors:(...w)=>q.validationErrors(...w)}),s=Object.freeze({clipboard:(m=window==null?void 0:window.navigator)==null?void 0:m.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:(B=window==null?void 0:window.navigator)==null?void 0:B.onLine,platform:(b=window==null?void 0:window.navigator)==null?void 0:b.platform}),o=[{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__"}],u=w=>{for(const k of o)if(k.pattern.test(w))return!1;return!0},A=w=>{var k,S;try{if(typeof w!="string")return null;const M=w.match(/<template(?:\s[^>]*)?>|<template>/i);if(!M)return null;const $=M.index+M[0].length;let F=1,L=$,Q=-1;for(;L<w.length&&F>0;){const I=w.indexOf("<template",L),O=w.indexOf("</template>",L);if(O===-1)return null;I!==-1&&I<O?(F++,L=I+9):(F--,F===0&&(Q=O),L=O+11)}if(Q===-1)return null;const T=w.substring($,Q).trim(),D=w.match(/<script>([\s\S]*?)<\/script>/i);let U={};if(D){const I=D[1].trim();if(!/export\s+default/.test(I)||!u(I))return null;const O=I.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 |
${O}`)(t,a,n,c,ra,Ek,Ik,(k=window==null?void 0:window.ELEMENT)==null?void 0:k.ElMessage,(S=window==null?void 0:window.ELEMENT)==null?void 0:S.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 Hn({...U,template:T})}catch{return null}},f=w=>{if(typeof w=="string"){const k=A(w);return k?Hn(k):null}return Hn(w)};return(w,k)=>(d(),E(bn(f(e.widget.component)),la({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},Tk=["innerHTML"],Sl={__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 n=a,s=e,o=V([]),u=zA(YA),A={},f=M=>{window.fluent_cart_admin.app={vue:u,components:M,xhr:re,notify:q},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],u,M).forEach(({name:F,component:L})=>{A[F]=Hn(L)})};Ks(()=>{let $=Qt().appContext.components;f($);let F=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],u,$);Array.isArray(F)&&(o.value=o.value.concat(F));const L={filter:s.filter,data:s.widgetsQuery};re.get("widgets",L).then(Q=>{Array.isArray(Q.widgets)&&(o.value=o.value.concat(Q.widgets))}),s.widgetsQuery});const m=M=>Hn(M),g=M=>A[M]||null,y=V([]),v=async(M,$)=>{const F=y.value.map(L=>typeof L[M]=="function"?L[M]($):Promise.resolve());return await Promise.all(F),!0};t({beforeUpdatingData:async M=>await v("beforeUpdatingData",M),afterUpdatingData:async M=>await v("afterUpdatingData",M),getFormStates:()=>{let M=[];if(Array.isArray(S.value))for(let $ of S.value)M={...M,...$.getState()};return M},resetForms:()=>{if(Array.isArray(S.value))for(let M of S.value)M.resetOnSave()&&M.resetForm()}});const S=V();return(M,$)=>(d(!0),_(H,null,ee(o.value,F=>(d(),_(H,null,[F.type!=="vue-component"&&F.type!=="vue-template"||F.use_card==!0?(d(),E(he,{key:0},{default:i(()=>[l(Ce,{title:F.title,subtitle:F.subtitle,border_bottom:""},null,8,["title","subtitle"]),l(me,null,{default:i(()=>[F.type==="html"?(d(),_("div",{key:0,innerHTML:F.content},null,8,Tk)):F.type==="chart"?(d(),E(wk,{key:1,option:F.data,height:`${F.height||400}`,width:`${F.width||"100%"}`},null,8,["option","height","width"])):F.type==="form"?(d(),E(bk,{key:2,schema:F.schema,values:F.values,submit_button_text:F.submit_button_text,form_name:F.form_name,ref_for:!0,ref_key:"formRefs",ref:S,widget:F,onChange:$[0]||($[0]=()=>n("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof F.component=="object"?(d(),E(bn(m(F.component)),la({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...F,data:e.data}),null,16)):g(F.component)?(d(),E(bn(g(F.component)),la({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...F,data:e.data}),null,16)):(d(),_(H,{key:5},[R(h(F.content),1)],64))]),_:2},1024)]),_:2},1024)):F.type==="vue-component"?(d(),_(H,{key:1},[typeof F.component=="object"?(d(),E(bn(m(F.component)),la({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...F,data:e.data}),null,16)):g(F.component)?(d(),E(bn(g(F.component)),la({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...F,data:e.data}),null,16)):x("",!0)],64)):F.type==="vue-template"?(d(),E(Lf,{key:2,widget:F,data:e.data},null,8,["widget","data"])):x("",!0)],64))),256))}},jt=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,Vk={class:"fct-dashboard-stat-widgets"},Mk={class:"right w-full"},Lk=["href"],Rk={class:"fct-dashboard-stat-widget__icon"},Ok={class:"fct-dashboard-stat-widget__content"},Hk={class:"fct-dashboard-stat-widget__title"},Pk={class:"fct-dashboard-stat-widget__value inner-value"},Nk=["innerHTML"],Kk={key:1,class:"fct-dashboard-stat-widget__inner"},Gk={class:"fct-dashboard-stat-widget__content"},jk={class:"fct-dashboard-stat-widget__title"},zk=["href"],Yk={key:1},qk={class:"fct-dashboard-stat-widget__value"},Wk={__name:"StatsWidget",setup(e){const t=V(!0),a=V([]),n=()=>{t.value=!0,re.get("dashboard/stats").then(s=>{a.value=s.stats}).catch(s=>{q.error(s)}).finally(()=>{t.value=!1})};return Be(()=>{n()}),(s,o)=>{const u=C("el-skeleton-item"),A=C("el-skeleton");return d(),_("div",Vk,[t.value?(d(),_(H,{key:0},ee(4,f=>l(A,{key:f,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:i(()=>[l(u,{variant:"circle",class:"w-10 h-10 flex-none"}),r("div",Mk,[l(u,{variant:"p",class:"w-full"}),l(u,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(d(),_(H,{key:1},[(d(!0),_(H,null,ee(a.value,(f,m)=>(d(),_("div",{key:m,class:"fct-dashboard-stat-widget"},[f.url?(d(),_("a",{key:0,href:f.url,class:"fct-dashboard-stat-widget__inner no-underline"},[r("div",Rk,[l(W,{class:"w-5",name:f.icon},null,8,["name"])]),r("div",Ok,[r("h3",Hk,[r("span",null,h(f.title),1)]),r("span",Pk,[f.has_currency?(d(),_("span",{key:0,innerHTML:p(Te).scaled(f.current_count)},null,8,Nk)):(d(),_(H,{key:1},[R(h(p(Kt)(p(jt)(f.current_count))||0),1)],64))])])],8,Lk)):(d(),_("div",Kk,[o[0]||(o[0]=ao('<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)),r("div",Gk,[r("h3",jk,[f.url?(d(),_("a",{key:0,class:"link",href:f.url},h(f.title),9,zk)):(d(),_("span",Yk,h(f.title),1))]),r("span",qk,h(f.current_count),1)])]))]))),128)),l(Sl,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},lA=200,Xk=800,Jk=.1,Zk=.3,oA=.5,e8=.5,t8=12,a8=800,n8=1600,s8=150,l8=3500,o8=["#FFC700","#FF0000","#2E3191","#41BBC7"];var vu={props:{particleCount:{type:Number,default:s8},particleSize:{type:Number,default:t8},duration:{type:Number,default:l8},colors:{type:Array,default:o8},force:{type:Number,default:e8},stageHeight:{type:Number,default:a8},stageWidth:{type:Number,default:n8},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=V(!0),a=($,F)=>{M($,{degree:F})},n=j(()=>o(e.particleCount,e.colors));jm(()=>{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=j(()=>S(e.particleCount,e.duration,e.colors,e.particleSize,e.force,e.stageHeight,e.stageWidth));Be(async()=>{await u(e.duration),e.shouldDestroyAfterDone&&(t.value=!1)});const o=($,F)=>{const L=360/$;return Array.from({length:$},(Q,T)=>({color:F[T%F.length],degree:T*L}))},u=$=>new Promise(F=>setTimeout(F,$));function A($){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round(($+Number.EPSILON)*10**F)/10**F}function f($,F){if($===F)return!0;if($==null||F==null||$.length!==F.length)return!1;for(let L=0;L<$.length;L++)if($[L]!==F[L])return!1;return!0}const m=($,F,L,Q,T)=>($-F)*(T-Q)/(L-F)+Q,g=($,F)=>{const L=$+F;return L>360?L-360:L},y=()=>Math.random()>.5,v=[0,0,1],B=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],b=$=>!f(B[$],v)&&y(),w=$=>typeof $>"u",k=$=>{console.error($)};function S($,F,L,Q,T,D,U){const I=Number.isSafeInteger;return!w($)&&I($)&&$<0?(k("particleCount must be a positive integer"),!1):!w(F)&&I(F)&&F<0?(k("duration must be a positive integer"),!1):!w(L)&&!Array.isArray(L)?(k("colors must be an array of strings"),!1):!w(Q)&&I(Q)&&Q<0?(k("particleSize must be a positive integer"),!1):!w(T)&&I(T)&&(T<0||T>1)?(k("force must be a positive integer and should be within 0 and 1"),!1):!w(D)&&typeof D=="number"&&I(D)&&D<0?(k("floorHeight must be a positive integer"),!1):!w(U)&&typeof U=="number"&&I(U)&&U<0?(k("floorWidth must be a positive integer"),!1):!0}function M($,F){let{degree:L}=F;const Q=m(Math.abs(g(L,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),T=Math.random()*(Xk-lA)+lA,D=Math.round(Math.random()*(B.length-1)),U=e.duration-Math.round(Math.random()*1e3),I=Math.random()<Jk,O=b(D),P=I?A(Math.random()*Zk,2):0,K=P*-1,G=P,ne=A(Math.abs(m(Math.abs(g(L,90)-180),0,180,-1,1)),4),Y=A(Math.random()*oA,4),N=A(Math.random()*e.force*(y()?1:-1),4),oe=oA,Z=A(Math.max(m(Math.abs(L-180),0,180,e.force,-e.force),0),4),le=(te,X)=>$==null?void 0:$.style.setProperty(te,X+"");le("--x-landing-point",`${Q}px`),le("--duration-chaos",`${U}ms`),le("--x1",`${P}`),le("--x2",`${K}`),le("--x3",`${G}`),le("--x4",`${ne}`),le("--y1",`${Y}`),le("--y2",`${N}`),le("--y3",`${oe}`),le("--y4",`${Z}`),le("--width",`${O?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),le("--height",(O?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),le("--rotation",`${B[D].join()}`),le("--rotation-duration",`${T}ms`),le("--border-radius",`${O?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:n,setItemRef:a}}};function r8(e,t,a,n,s,o){return n.isVisible&&n.isValid?(d(),_("div",{key:0,class:"confetti-container",style:ia(`--floor-height: ${n.stageHeight}px;`)},[(d(!0),_(H,null,ee(n.particles,u=>{let{color:A,degree:f}=u;return d(),_("div",{key:f,class:"particle",ref:m=>n.setItemRef(m,f)},[r("div",{style:ia(`--bgcolor: ${A};`)},null,4)],512)}),128))],4)):x("",!0)}function i8(e,t){t===void 0&&(t={});var a=t.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var d8=` |
| 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 |
`;i8(d8);vu.render=r8;vu.__scopeId="data-v-4ff796ae";var u8=(()=>{const e=vu;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();Re.extend(Gr);Re.extend(cp);let Yt=class{static withTimezone(t){const a=Re(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class c8 extends Ya{constructor(){super(...arguments);Ee(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[Yt.withTimezone(Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:Yt.withTimezone(Re().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 n;const a=(n=this.data.searchQuery)==null?void 0:n.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 n=this.activeFilterOptions;n&&(this.data.selectedFilters[n.value]={label:n.label,value:a.value,type:n.type,options:n.options},this.data[n.value]=a.value,this.triggerFilterChanged())}selectFilterOptionMulti(a){const n=this.activeFilterOptions;if(!n)return;this.data.selectedFilters[n.value]||(this.data.selectedFilters[n.value]={label:n.label,value:[],type:n.type,options:n.options});let s=this.data.selectedFilters[n.value].value;if(a.value==="all")this.data.selectedFilters[n.value].value=[{label:a.label,value:a.value}],this.data[n.value]=["all"];else{const o=s.findIndex(A=>A.value===a.value);o>-1?s.splice(o,1):s.push({label:a.label,value:a.value});const u=s.findIndex(A=>A.value==="all");u>-1&&s.splice(u,1),this.data[n.value]=s.map(A=>A.value)}this.triggerFilterChanged()}setDateRange(a){const n=Re(a[0]),s=Re(a[1]);this.data.selectedFilters.dateRange={label:c("Date"),value:[n,s],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[Oa.data.dateRange[0],Oa.data.dateRange[1]],this.data.selectedFilters.dateRange={label:c("Date"),value:[Yt.withTimezone(Re(this.data.dateRange[0])),Yt.withTimezone(Re(this.data.dateRange[1]))],type:"date",rangeKey:this.data.rangeKey},this.data.reRenderDate=!0,this.triggerFilterChanged()}setSelectChange(a,n=null){const s=n||this.activeFilterOptions;s&&(this.data.selectedFilters[s.value]={label:s.label,value:a,type:s.type},this.triggerFilterChanged())}setTreeSelectItem(a){const n=a.filter(s=>!s.children||s.children.length===0).map(s=>({id:s.value,label:s.label}));this.handleTreeSelections(n),this.triggerFilterChanged()}removeTreeSelectItem(a){var o;const s=(((o=this.data.selectedFilters.variation_ids)==null?void 0:o.value)||[]).filter(u=>u.id!==a);this.handleTreeSelections(s),this.data.variation_ids=this.data.variation_ids.filter(u=>u!==a),this.triggerFilterChanged()}handleTreeSelections(a){a.length?(this.data.selectedFilters.variation_ids||(this.data.selectedFilters.variation_ids={label:c("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=[],Oa.resetFilterToDefault("variation_ids"),this.triggerFilterChanged()}isFilterOptionSelected(a){const n=this.activeFilterOptions;if(!n)return!1;const s=this.data.selectedFilters[n.value];return s?s.value===a.value:this.data[n.value]===a.value}isFilterOptionSelectedMulti(a){const n=this.activeFilterOptions,s=this.data.selectedFilters[n==null?void 0:n.value];return s?s.value.some(u=>u.value===a.value):!1}setMultiSelectChange(a,n){this.data.selectedFilters[a]||(this.data.selectedFilters[a]={});const s=n.some(u=>u.value==="all"),o=this.data.selectedFilters[a].value||[];s?o.length===1&&o[0].value==="all"&&n.length>1?this.data.selectedFilters[a].value=n.filter(u=>u.value!=="all"):this.data.selectedFilters[a].value=[n.find(u=>u.value==="all")]:this.data.selectedFilters[a].value=n,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:Yt.withTimezone(Re(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(Oa.data.currencies).map(([a,n])=>({label:a,value:a}))}shouldRenderOption(a){const n=a.disableRoutes||[],s=fn();return n.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=[Yt.withTimezone(Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=Yt.withTimezone(Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Oa.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,n){n!=null?(this.removeFilterItem(a,n),Oa.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],Oa.resetFilterToDefault(a),this.triggerFilterChanged())}removeFilterItem(a,n){const s=this.data.selectedFilters[a];if(!s)return;const o=s.value.filter(u=>u.id!==n);o.length?this.data.selectedFilters[a].value=o:delete this.data.selectedFilters[a],a==="variation_ids"&&(this.data.variation_ids=this.data.variation_ids.filter(u=>u!==n)),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(n=>[n,this.data[n]]))}storeSelectedFilters(){const a="report-filter",n=vt.get(a)||{},s=this.applicableFilters(),o={...n,...s};vt.set(a,o),vt.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return vt.get(this.data.storageKey)}retrieveSavedReportFilters(){return vt.get("report-filter")}}function Rf(){return c8.init()}class A8 extends Ya{constructor(){super(...arguments);Ee(this,"filterState",null);Ee(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[Yt.withTimezone(Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});Ee(this,"storageKey","report-filter");Ee(this,"currencyStorageKey",`${this.storageKey}_currencies`);Ee(this,"listeners",{})}beforeInit(){this.filterState=Rf(),this.mergeWithStorage();const a=vt.get(this.storageKey),n=vt.get(this.currencyStorageKey);(!a||!n)&&this.fetchReportMeta()}mergeWithStorage(){const a=vt.get(this.storageKey),n=vt.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:Ie.get("shop.currency"),this.data.dateRange=[a.startDate??this.data.dateRange[0],a.endDate??this.data.dateRange[1]],this.data.currencies=n??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(){re.get("reports/fetch-report-meta",this.applicableFilters).then(a=>{this.data.currencies=a.currencies,this.data.dateRange[0]=a.min_date;const[n,s]=Object.entries(a.currencies)[0];this.applicableFilters.params.currency===""&&(this.data.currency=n),this.data.currencySign=s,this.data.storeMode=a.storeMode,this.data.firstOrderDate=Re(a.first_order_date||Re().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,n){this.listeners[a]=n,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(){vt.set(this.storageKey,this.applicableFilters.params),vt.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=dp.find(A=>A.text===this.data.rangeKey);let n,s;if(a){const[A,f]=a.value();n=this.data.rangeKey==="All Time"?Yt.withTimezone(Re(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):Yt.withTimezone(Re(A).format("YYYY-MM-DD 00:00:00")),s=Yt.withTimezone(Re(f).format("YYYY-MM-DD 23:59:59"))}else n=Yt.withTimezone(Re(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),s=Yt.withTimezone(Re(this.data.dateRange[1]).format("YYYY-MM-DD 23:59:59"));const o={orderStatus:this.data.orderStatus,paymentStatus:this.data.paymentStatus,currency:this.data.currency,startDate:Ie.get("app_config.isProActive")?n:Yt.withTimezone(Re().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:Ie.get("app_config.isProActive")?s:Yt.withTimezone(Re().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 u=this.data.orderTypes;return u.includes("all")||(o.orderTypes=u),{params:o}}setDateDiff(){if(!this.data.dateRange||this.data.dateRange.length<2)return 0;const[a,n]=this.data.dateRange;this.data.dateDiff=Re(n).diff(Re(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[Yt.withTimezone(Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=Yt.withTimezone(Re().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]=[Yt.withTimezone(Re().startOf("month").format("YYYY-MM-DD 00:00:00")),Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return vt.get(this.data.storageKey)}}const Oa=A8.init();class p8 extends Ya{constructor(){super(...arguments);Ee(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,n,s,o){if(o&&o.startsWith("graphs.")){const A=o.split(".")[1];this.data.isBusy.graphs[A]=!0}else this.data.isBusy[o]=!0;let u;return typeof n=="object"?u=re.get("reports/"+a,n):u=re.get("reports/"+a),this.resolvePromiseResponse(u,s,o),u}resolvePromiseResponse(a,n=null,s=null){a.then(o=>{s==null||n==null?Object.assign(this.data,o):Ke.set(this.data,s,Ke.get(o,n))}).catch(o=>{}).finally(()=>{if(s&&s.startsWith("graphs.")){const o=s.split(".")[1];this.data.isBusy.graphs[o]=!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 $n=p8.init(),f8={key:0,class:"fct-report-sold-product-list has-scroll"},m8={class:"list-left-content"},h8={class:"list-image"},_8=["src"],g8=["src"],v8={class:"list-title"},y8=["title"],b8={class:"list-id"},w8={class:"list-right-content"},C8={class:"list-value"},B8=["innerHTML"],yu={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=j(()=>t.data);return(n,s)=>{const o=C("el-skeleton"),u=C("router-link");return d(),E(St,{permission:"reports/view"},{default:i(()=>[l(fo,{class:"top-sold-products","card-options":{heading:p(c)("Top Sold Products"),linkButtonText:p(c)("View All"),linkButtonUrl:"products"}},{default:i(()=>[e.loading?(d(),E(o,{key:0,animated:"",rows:7})):(d(),_(H,{key:1},[a.value.length>0?(d(),_("ul",f8,[(d(!0),_(H,null,ee(a.value,A=>(d(),_("li",{key:A.product_id},[l(u,{to:{name:"product_edit",params:{product_id:A.product_id}}},{default:i(()=>[r("div",m8,[r("div",h8,[A.media!==null?(d(),_("img",{key:0,src:A.media,alt:""},null,8,_8)):(d(),_("img",{key:1,src:n.getPlaceholderImage(),alt:""},null,8,g8))]),r("div",v8,[r("div",{class:"list-title-inner",title:A.product_name},h(A.product_name),9,y8),r("div",b8,"#"+h(p(Kt)(A.product_id)),1)])]),r("div",w8,[r("div",C8,h(p(Kt)(A.quantity_sold))+" "+h(p(c)(" Sold")),1),r("div",{class:"list-price",innerHTML:p(Te).scaled(A.total_amount)},null,8,B8)])]),_:2},1032,["to"])]))),128))])):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no item!")},null,8,["text"]))],64))]),_:1},8,["card-options"])]),_:1})}}},k8={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},x8=["innerHTML"],S8={class:"fluent_cart_dashboard_inner"},F8={class:"fluent_cart_dashboard_main"},E8={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},U8={class:"fluent_cart_dashboard_aside"},$8={class:"fct-congrats-dialog-content"},D8={class:"fct-congrats-dialog-content-inner"},Q8={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},I8=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=V(!1),a=V([]),n=V(!1);jd("dashboardTogglePageNotification",y=>{n.value=y});const o=()=>{const[y,v]=[Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),Re().format("YYYY-MM-DD 23:59:59")],B={startDate:y,endDate:v,paymentStatus:"all"};Ia.getSalesGrowthChart({params:{...B,groupKey:"daily"}})},u=()=>{Ia.getRecentOrders({params:null})},A=()=>{const y={paymentStatus:"all"};Ia.getCountryHeatMap({params:{...y,groupKey:"daily"}})},f=()=>{const[y,v]=[Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),Re().format("YYYY-MM-DD 23:59:59")],B={startDate:y,endDate:v};Ia.getTopSoldProducts({params:{...B}})},m=()=>{td.getVueParams(),vt.get("onboarding_congratulations","no")!=="yes"&&Ie.get("total_products_count")==0&&(vt.set("onboarding_congratulations","yes"),t.value=!0)},g=()=>Ie.get("admin_url")+"settings/store-settings/pages_setup";return Be(()=>{window.addEventListener("getSalesGrowth",o),a.value=Ie.get("dummy_product_info"),o(),A(),u(),m(),f()}),(y,v)=>{const B=C("el-col"),b=C("el-row"),w=C("el-button"),k=C("el-dialog");return d(),_("div",k8,[n.value?(d(),E(Na,{key:0,class:"mb-5",type:"warning",icon:"InformationFill"},{default:i(()=>[r("span",{innerHTML:p(c)("Set up your pages first to get started %s",'<a href="'+g()+'" target="_blank">'+p(c)("Set up your pages")+"</a>")},null,8,x8)]),_:1})):x("",!0),r("div",S8,[r("div",F8,[l(cB),l(St,{permission:"dashboard_stats/view"},{default:i(()=>[r("div",E8,[l(W,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+h(p(c)("Last %s Days",p(Kt)(30))),1)]),l(Wk)]),_:1}),l(St,{permission:"reports/view"},{default:i(()=>[l(n2,{chartData:p(Ia).data.salesGrowthChart,loading:p(Ia).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),l(b,{gutter:24},{default:i(()=>[l(St,{permission:"reports/view"},{default:i(()=>[l(B,{lg:12},{default:i(()=>[l(k2)]),_:1})]),_:1}),l(St,{permission:"reports/view"},{default:i(()=>[l(B,{lg:12,class:"mt-6 xl:mt-0"},{default:i(()=>[l(yu,{data:p(Ia).topSoldProducts,loading:p(Ia).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),l(St,{permission:"reports/view"},{default:i(()=>[l(B,{class:"mt-6"},{default:i(()=>[l(d2,{data:p(Ia).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),r("div",U8,[l(W2)])]),l(k,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":v[1]||(v[1]=S=>t.value=S),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:i(()=>[r("div",$8,[r("div",D8,[v[2]||(v[2]=r("div",{class:"icon"},"🎉",-1)),r("h3",null,h(p(c)("Congratulations!")),1),r("p",null,h(p(c)("You successfully finished your onboarding & your store is ready.")),1),l(w,{type:"primary",onClick:v[0]||(v[0]=S=>t.value=!1)},{default:i(()=>[R(h(p(c)("Let's go")),1)]),_:1})])]),r("div",Q8,[l(p(u8),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),T8={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)}}},V8={key:2},M8=["onClick"],L8=["onClick"];function R8(e,t,a,n,s,o){const u=C("el-checkbox"),A=C("el-option"),f=C("el-select"),m=C("el-col"),g=C("el-option-group"),y=C("el-input"),v=C("el-row");return d(),_("div",null,[a.disabled?(d(),E(u,{key:1,disabled:"",onClick:t[1]||(t[1]=B=>s.comingSoon=!0)},{default:i(()=>[R(h(a.labels.status_label),1)]),_:1})):(d(),E(u,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=B=>a.conditionals.status=B)},{default:i(()=>[R(h(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(d(),_("div",V8,[R(h(a.labels.notification_if_start)+" ",1),l(f,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=B=>a.conditionals.type=B)},{default:i(()=>[(d(),_(H,null,ee({all:"All",any:"Any"},(B,b)=>l(A,{key:b,value:b},{default:i(()=>[R(h(B),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+h(a.labels.notification_if_end)+" ",1),(d(!0),_(H,null,ee(o.items,(B,b)=>(d(),E(v,{key:b,style:{"margin-top":"15px"},gutter:10},{default:i(()=>[l(m,{md:8},{default:i(()=>[l(f,{size:"default",modelValue:o.items[b].field,"onUpdate:modelValue":w=>o.items[b].field=w,style:{width:"100%"},onChange:w=>o.items[b].value=""},{default:i(()=>[(d(!0),_(H,null,ee(a.fields,(w,k)=>(d(),E(A,{key:k,label:w.admin_label,value:k},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),l(m,{md:5},{default:i(()=>[l(f,{size:"default",modelValue:o.items[b].operator,"onUpdate:modelValue":w=>o.items[b].operator=w},{default:i(()=>[l(g,{label:"General Operators"},{default:i(()=>[l(A,{value:"=",label:"equals"}),l(A,{value:"!=",label:"not equal"}),a.fields[B.field]&&!Object.keys(a.fields[B.field].options).length?(d(),_(H,{key:0},[l(A,{value:">",label:"greater than"}),l(A,{value:"<",label:"less than"}),l(A,{value:">=",label:"greater than or equal"}),l(A,{value:"<=",label:"less than or equal"}),l(A,{value:"contains",label:"contains"}),l(A,{value:"doNotContains",label:"do not contains"}),l(A,{value:"startsWith",label:"starts with"}),l(A,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1024),l(g,{label:"Advanced Operators"},{default:i(()=>[l(A,{value:"length_equal",label:"Equal to Data Length"}),l(A,{value:"length_less_than",label:"Less than to Data length"}),l(A,{value:"length_greater_than",label:"Greater than to Data Length"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),l(m,{md:8},{default:i(()=>[o.items[b].operator=="length_equal"||o.items[b].operator=="length_less_than"||o.items[b].operator=="length_greater_than"?(d(),E(y,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:o.items[b].value,"onUpdate:modelValue":w=>o.items[b].value=w},null,8,["modelValue","onUpdate:modelValue"])):(d(),_(H,{key:1},[a.fields[B.field]&&Object.keys(a.fields[B.field].options).length?(d(),E(f,{key:0,size:"default",modelValue:o.items[b].value,"onUpdate:modelValue":w=>o.items[b].value=w,style:{width:"100%"}},{default:i(()=>[(d(!0),_(H,null,ee(a.fields[B.field].options,(w,k)=>(d(),E(A,{key:k,label:w,value:k},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(d(),E(y,{key:1,size:"default",placeholder:"Enter a value",modelValue:o.items[b].value,"onUpdate:modelValue":w=>o.items[b].value=w},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),l(m,{md:3,class:"action-btns"},{default:i(()=>[r("i",{class:"el-icon-plus",onClick:w=>o.add(b)},null,8,M8),o.items.length>1?(d(),_("i",{key:0,class:"el-icon-minus",onClick:w=>o.remove(b)},null,8,L8)):x("",!0)]),_:2},1024)]),_:2},1024))),128))])):x("",!0)])}const O8=He(T8,[["render",R8]]),H8={name:"ErrorView",props:["field","errors"],computed:{Str(){return Gt}}},P8={key:0,class:"fct-inline-error ff"};function N8(e,t,a,n,s,o){return a.errors.has(a.field)?(d(),_("p",P8,h(a.errors.errors[a.field].required?o.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):x("",!0)}const wr=He(H8,[["render",N8]]),K8={name:"InputPopover",components:{Popover:up},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)}}},G8={class:"flex-1"},j8={key:0,class:"input-textarea-value"};function z8(e,t,a,n,s,o){const u=C("el-input"),A=C("Popover");return d(),_("div",{class:de(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[r("div",G8,[a.fieldType=="textarea"?(d(),_("div",j8,[l(u,{placeholder:a.placeholder,type:"textarea",modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=f=>s.model=f)},null,8,["placeholder","modelValue"])])):(d(),E(u,{key:1,placeholder:a.placeholder,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=f=>s.model=f),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),l(A,{class:de(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:o.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const Y8=He(K8,[["render",z8]]),q8={name:"FieldGeneral",components:{inputPopover:Y8},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)}}},W8={class:"fct-field-general"};function X8(e,t,a,n,s,o){const u=C("input-popover");return d(),_("div",W8,[l(u,{fieldType:a.field_type,placeholder:e.$t("Select a Field or Type Custom value"),modelValue:s.fieldValue,"onUpdate:modelValue":t[0]||(t[0]=A=>s.fieldValue=A),icon:"el-icon-arrow-down",data:a.editorShortcodes,onOnValueUpdated:t[1]||(t[1]=function(A){o.onValueUpdated(A)}),defaultValue:s.fieldValue},null,8,["fieldType","placeholder","modelValue","data","defaultValue"])])}const Zn=He(q8,[["render",X8]]),J8={key:0,class:"fct-merge-fields"},Z8={class:"fct-merge-fields-container"},e4={key:3},t4={name:"FieldMaps",components:{ErrorView:wr,FieldGeneral:Zn},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}}},a4=Object.assign(t4,{setup(e){return(t,a)=>{const n=C("el-option"),s=C("el-select"),o=C("el-form-item");return t.appReady?(d(),_("div",J8,[r("div",Z8,[(d(!0),_(H,null,ee(e.field.primary_fileds,(u,A)=>(d(),_("div",{class:"fct-merge-fields-item",key:A},[l(o,{label:u.label,required:u.required},{default:i(()=>[u.input_options==="emails"?(d(),E(s,{key:0,modelValue:e.settings[u.key],"onUpdate:modelValue":f=>e.settings[u.key]=f,placeholder:t.$t("Select a Field"),clearable:"",class:de(e.errors.errors[u.key]?"is-error":"")},{default:i(()=>[(d(!0),_(H,null,ee(e.inputs,(f,m)=>(d(),_(H,{key:m},[(f==null?void 0:f.attributes.type)==="email"?(d(),E(n,{key:0,value:f==null?void 0:f.attributes.code,label:f==null?void 0:f.attributes.name},null,8,["value","label"])):x("",!0)],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"])):u.input_options==="all"?(d(),E(s,{key:1,modelValue:e.settings[u.key],"onUpdate:modelValue":f=>e.settings[u.key]=f,placeholder:t.$t("Select a Field"),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(e.inputs,(f,m)=>(d(),E(n,{key:m,value:f.attributes.name,label:f.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(d(),E(Zn,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[u.key],modelValue:e.settings[u.key],"onUpdate:modelValue":f=>e.settings[u.key]=f},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),u.help_text?(d(),_("div",e4,h(u.help_text),1)):x("",!0),l(wr,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(d(!0),_(H,{key:0},ee(e.field.default_fields,u=>(d(),_("div",{class:"fct-merge-fields-item",key:u.name},[l(o,{label:u.label,required:u.required},{default:i(()=>[l(Zn,{editorShortcodes:e.editorShortcodes,defaultValue:e.settings[t.primary_field.key],modelValue:e.settings.default_fields[u.name],"onUpdate:modelValue":A=>e.settings.default_fields[u.name]=A},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"]),l(wr,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):x("",!0),(d(!0),_(H,null,ee(e.merge_fields,(u,A)=>(d(),_("div",{class:"fct-merge-fields-item",key:A},[l(o,{label:u},{default:i(()=>[l(Zn,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[A],onOnValueUpdated:function(f){t.onValueUpdated(f,A)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):x("",!0)}}}),n4={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 lo(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},s4={class:"fluent_cart_list_select_filter"};function l4(e,t,a,n,s,o){const u=C("el-option"),A=C("el-select");return d(),_("div",s4,[l(A,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=f=>a.settings[a.field.key]=f),placeholder:a.field.placeholder},{default:i(()=>[(d(!0),_(H,null,ee(o.listItems,f=>(d(),E(u,{key:f.label,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const o4=He(n4,[["render",l4]]),r4={name:"DropdownLabelRepeater",components:{FieldGeneral:Zn},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})}}},i4={class:"dropdown_label_repeater"},d4={key:0,class:"fluent_cart-table"};function u4(e,t,a,n,s,o){const u=C("el-input"),A=C("FieldGeneral"),f=C("el-button"),m=C("el-button-group");return d(),_("div",i4,[s.loading?x("",!0):(d(),_("table",d4,[r("thead",null,[r("tr",null,[r("th",null,h(a.field.field_label||"Field Label"),1),r("th",null,h(a.field.value_label||"Field Value"),1),t[0]||(t[0]=r("th",null,null,-1))])]),r("tbody",null,[(d(!0),_(H,null,ee(a.settings[a.field.key],(g,y)=>(d(),_("tr",{key:"item_"+y},[r("td",null,[l(u,{placeholder:a.field.field_label||"Field Label",modelValue:g.label,"onUpdate:modelValue":v=>g.label=v},null,8,["placeholder","modelValue","onUpdate:modelValue"])]),r("td",null,[l(A,{editorShortcodes:a.editorShortcodes,modelValue:g.item_value,"onUpdate:modelValue":v=>g.item_value=v},null,8,["editorShortcodes","modelValue","onUpdate:modelValue"])]),r("td",null,[l(m,null,{default:i(()=>[l(f,{type:"success",onClick:v=>o.addItemAfter(y)},{default:i(()=>t[1]||(t[1]=[R("+",-1)])),_:2,__:[1]},1032,["onClick"]),l(f,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>o.removeItem(y)},{default:i(()=>t[2]||(t[2]=[R("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const c4=He(r4,[["render",u4]]),A4={name:"DropdownManyFields",components:{FieldGeneral:Zn,DynamicIcon:W,IconButton:Oe},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)}}},p4={class:"dropdown_label_repeater w-full"},f4={class:"fluent_cart-table w-full text-left"},m4={class:"action-btns"},h4={class:"dropdown_label_repeater_footer"};function _4(e,t,a,n,s,o){const u=C("el-option"),A=C("el-select"),f=C("FieldGeneral"),m=C("DynamicIcon"),g=C("IconButton"),y=C("el-button");return d(),_("div",p4,[r("table",f4,[t[1]||(t[1]=r("colgroup",null,[r("col",{width:"25%"}),r("col",{width:"70%"}),r("col",{width:"10%"})],-1)),r("thead",null,[r("tr",null,[r("th",null,h(s.rendered_labels.remote_text),1),r("th",null,h(s.rendered_labels.local_text),1),t[0]||(t[0]=r("th",null,null,-1))])]),r("tbody",null,[(d(!0),_(H,null,ee(a.settings[a.field.key],(v,B)=>(d(),_("tr",{key:"item_"+B},[r("td",null,[l(A,{modelValue:v.label,"onUpdate:modelValue":b=>v.label=b},{default:i(()=>[(d(!0),_(H,null,ee(a.field.options,(b,w)=>(d(),E(u,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),r("td",null,[l(f,{editorShortcodes:a.editorShortcodes,defaultValue:typeof v.item_value=="object"?"":v.item_value,modelValue:v.item_value,"onUpdate:modelValue":b=>v.item_value=b},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),r("td",null,[r("div",m4,[l(g,{size:"x-small",tag:"button",onClick:Xe(b=>o.removeItem(B),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:i(()=>[l(m,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),r("div",h4,[l(y,{text:"",onClick:Xe(o.addNewItem,["prevent"])},{default:i(()=>[l(m,{name:"Plus"}),R(" "+h(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const g4=He(A4,[["render",_4]]),v4={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()}}},y4={class:"fluent_cart_chained_filter"};function b4(e,t,a,n,s,o){const u=C("el-option"),A=C("el-select"),f=Ca("loading");return Dt((d(),_("div",y4,[l(A,{onChange:t[0]||(t[0]=m=>o.handleCategoryChange()),clearable:"",modelValue:s.chained_settings.category,"onUpdate:modelValue":t[1]||(t[1]=m=>s.chained_settings.category=m),placeholder:a.field.category_label},{default:i(()=>[(d(!0),_(H,null,ee(s.categories,m=>(d(),E(u,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),Dt(l(A,{modelValue:s.chained_settings.sub_category,"onUpdate:modelValue":t[2]||(t[2]=m=>s.chained_settings.sub_category=m),clearable:"",placeholder:a.field.subcategory_label},{default:i(()=>[(d(!0),_(H,null,ee(s.subcategories,m=>(d(),E(u,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),[[Rn,s.chained_settings.category]])])),[[f,s.loading]])}const w4=He(v4,[["render",b4]]),C4={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;lo(t,(a,n)=>{this.$set(this.field,n,a)})}).catch(e=>{})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),lo(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}}},B4={class:"fluent_cart_chained_filter"};function k4(e,t,a,n,s,o){const u=C("el-option"),A=C("el-select"),f=C("el-col"),m=C("el-row"),g=Ca("loading");return Dt((d(),_("div",B4,[l(m,{gutter:0},{default:i(()=>[(d(!0),_(H,null,ee(a.field.fields_options,(y,v)=>(d(),E(f,{span:12,key:v,class:"fluent_carteach_filter"},{default:i(()=>[r("label",null,h(a.field.options_labels[v].label),1),l(A,{onChange:B=>o.handleSlectChange(v),filterable:"",clearable:"",placeholder:a.field.options_labels[v].placeholder,multiple:a.field.options_labels[v].type=="multi-select",modelValue:a.value[v],"onUpdate:modelValue":B=>a.value[v]=B},{default:i(()=>[(d(!0),_(H,null,ee(y,(B,b)=>(d(),E(u,{key:b,value:b,label:B},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,s.loading]])}const x4=He(C4,[["render",k4]]),S4={name:"RoutingFilterFields",components:{DynamicIcon:W,IconButton:Oe,FieldGeneral:Zn},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)}}},F4={class:"fluent_cart_routing_fields"},E4={key:0,class:"fluent_cart_routing_table"},U4={class:"fluent_cart_inline"},$4={class:"action-btns"};function D4(e,t,a,n,s,o){const u=C("el-input"),A=C("el-option"),f=C("el-select"),m=C("FieldGeneral"),g=C("DynamicIcon"),y=C("IconButton");return d(),_("div",F4,[a.disabled?x("",!0):(d(),_("table",E4,[r("tbody",null,[(d(!0),_(H,null,ee(a.routings,(v,B)=>(d(),_("tr",{key:B},[r("td",null,[r("label",U4,h(a.labels.input_label),1),a.input_type=="text"?(d(),E(u,{key:0,placeholder:a.labels.input_placeholder,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(d(),E(f,{key:1,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b,placeholder:a.labels.input_placeholder},{default:i(()=>[(d(!0),_(H,null,ee(a.input_options,(b,w)=>(d(),E(A,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),t[0]||(t[0]=r("td",null,"If",-1)),r("td",null,[l(m,{editorShortcodes:a.editorShortcodes,modelValue:v.field,"onUpdate:modelValue":b=>v.field=b,defaultValue:v.field,onChange:b=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),r("td",null,[l(f,{modelValue:v.operator,"onUpdate:modelValue":b=>v.operator=b,class:"w-[100px]"},{default:i(()=>[l(A,{value:"=",label:"equal"}),l(A,{value:"!=",label:"not equal"}),l(A,{value:">",label:"greater than"}),l(A,{value:"<",label:"less than"}),l(A,{value:">=",label:"greater than or equal"}),l(A,{value:"<=",label:"less than or equal"}),a.fields[v.field]&&!Object.keys(a.fields[v.field].options).length?(d(),_(H,{key:0},[l(A,{value:">",label:"greater than"}),l(A,{value:"<",label:"less than"}),l(A,{value:">=",label:"greater than or equal"}),l(A,{value:"<=",label:"less than or equal"}),l(A,{value:"contains",label:"contains"}),l(A,{value:"doNotContains",label:"do not contains"}),l(A,{value:"startsWith",label:"starts with"}),l(A,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),r("td",null,[a.fields[v.field]&&Object.keys(a.fields[v.field].options).length?(d(),E(f,{key:0,modelValue:v.value,"onUpdate:modelValue":b=>v.value=b,style:{width:"100%"}},{default:i(()=>[(d(!0),_(H,null,ee(a.fields[v.field].options,(b,w)=>(d(),E(A,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(d(),E(u,{key:1,placeholder:"Enter a value",modelValue:v.value,"onUpdate:modelValue":b=>v.value=b},null,8,["modelValue","onUpdate:modelValue"]))]),r("td",null,[r("div",$4,[l(y,{size:"x-small",tag:"button",onClick:Xe(b=>o.add(B),["prevent"])},{default:i(()=>[l(g,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(d(),E(y,{key:0,size:"x-small",tag:"button",onClick:Xe(b=>o.remove(B),["prevent"])},{default:i(()=>[l(g,{name:"Minus"})]),_:2},1032,["onClick"])):x("",!0)])])]))),128))])]))])}const Q4=He(S4,[["render",D4]]),I4={name:"SelectionRouting",components:{RoutingFilterFields:Q4,FiledGeneral:Zn},props:["field","settings","inputs","editorShortcodes"]},T4={class:"fluent_cart_field_routing"},V4={class:"mb-4"},M4={key:3};function L4(e,t,a,n,s,o){const u=C("el-checkbox"),A=C("el-option"),f=C("el-select"),m=C("el-input"),g=C("FiledGeneral"),y=C("RoutingFilterFields");return d(),_("div",T4,[r("div",V4,[l(u,{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:i(()=>[R(h(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),r("div",null,[a.field.simple_component=="select"?(d(),E(f,{key:0,disabled:a.settings[a.field.routing_key]!="simple",filterable:"",clearable:"",multiple:a.field.is_multiple,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[1]||(t[1]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},{default:i(()=>[(d(!0),_(H,null,ee(a.field.options,(v,B)=>(d(),E(A,{key:B,value:B,label:v},null,8,["value","label"]))),128))]),_:1},8,["disabled","multiple","modelValue","placeholder"])):a.field.simple_component=="text"?(d(),E(m,{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"?(d(),E(g,{key:2,editorShortcodes:a.editorShortcodes,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[3]||(t[3]=v=>a.settings[a.field.key]=v)},null,8,["editorShortcodes","modelValue"])):x("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(d(),_("p",M4,h(a.field.inline_tip),1)):x("",!0)]),a.settings[a.field.routing_key]=="routing"?(d(),E(y,{key:0,routings:a.settings[a.field.settings_key],input_type:a.field.routing_input_type,fields:a.inputs,labels:a.field.labels,input_options:a.field.options,editorShortcodes:a.editorShortcodes},null,8,["routings","input_type","fields","labels","input_options","editorShortcodes"])):x("",!0)])}const R4=He(I4,[["render",L4]]),O4={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=zm(e).bind(this);return Zi(t,{settings:this.settings,app:this})}return null}},H4={name:"FeedHeader",props:{integration_name:String,settings:Object},computed:{ArrowRight(){return tn},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},P4={class:"fct-feed-header mb-5"},N4={class:"mb-5 flex items-center justify-between"},K4={class:"capitalize"};function G4(e,t,a,n,s,o){const u=C("el-breadcrumb-item"),A=C("el-breadcrumb"),f=C("el-switch");return d(),_("div",P4,[r("div",N4,[l(A,{"separator-icon":o.ArrowRight},{default:i(()=>[l(u,{to:o.prevRoute},{default:i(()=>[R(h(e.$t("Integrations")),1)]),_:1},8,["to"]),l(u,null,{default:i(()=>[r("span",K4,h(a.integration_name),1)]),_:1})]),_:1},8,["separator-icon"]),l(f,{modelValue:a.settings.enabled,"onUpdate:modelValue":t[0]||(t[0]=m=>a.settings.enabled=m),"active-value":"yes","inactive-value":"no","active-text":e.$t("Enable this Integration")},null,8,["modelValue","active-text"])])])}const j4=He(H4,[["render",G4]]);class z4{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 Y4={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 n={search:e,values:this.model,option_key:t};this.field.sub_option_key&&(n.sub_option_key=this.field.sub_option_key),this.$get("integration/feed/dynamic_options",n).then(s=>{this.options=s.options,a&&s.options&&(window[a]=s.options)}).catch(s=>{this.handleError(s)}).finally(()=>{this.loading=!1})}}};function q4(e,t,a,n,s,o){const u=C("el-option"),A=C("el-select"),f=Ca("loading");return Dt((d(),E(A,{modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=m=>s.model=m),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":o.fetchOptions},{default:i(()=>[(d(!0),_(H,null,ee(s.options,m=>(d(),E(u,{key:m.id,label:m.title,value:m.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","multiple","remote","clearable","disabled","allow-create","size","placeholder","remote-method"])),[[f,s.loading]])}const W4=He(Y4,[["render",q4]]),X4={name:"FeedEditor",components:{FilterFields:O8,MergeFieldMapper:a4,FiledGeneral:Zn,ListSelectFilter:o4,DropDownLabelRepeater:c4,DropDownManyFields:g4,ChainedFields:w4,ChainedSelects:x4,SelectionRouting:R4,CardContainer:he,CardBody:me,CardHeader:Ce,LabelHint:sa,FeedHeader:j4,ErrorView:wr,CustomComponentRender:O4,RestSelector:W4},data(){return{loading_app:!1,loading_list:!1,errors:new z4,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:c,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"?q.validationErrors(t):q.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 n;this.errors.record(((n=a==null?void 0:a.data)==null?void 0:n.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]={}}}},J4={class:"fct-integration-container fct-layout-width"},Z4={class:"fct-add-integration py-7.5"},ex={class:"grid gap-5"},tx={key:0,class:"fct-setting-form-content"},ax=["innerHTML"],nx={class:"fct-setting-form-fields"},sx=["innerHTML"],lx=["innerHTML"],ox=["innerHTML"],rx={key:0,class:"fct-setting-form-row"},ix={class:"fct-setting-form-content"},dx={class:"fct-setting-form-content"},ux={class:"fct-setting-form-fields"},cx={class:"fct-inline-tip pl-6"},Ax={key:0,class:"setting-save-action"};function px(e,t,a,n,s,o){const u=C("el-skeleton-item"),A=C("el-skeleton"),f=C("FeedHeader"),m=C("LabelHint"),g=C("el-input"),y=C("ErrorView"),v=C("el-option"),B=C("el-select"),b=C("MergeFieldMapper"),w=C("el-checkbox"),k=C("el-checkbox-group"),S=C("el-option-group"),M=C("FilterFields"),$=C("FiledGeneral"),F=C("ListSelectFilter"),L=C("DropDownLabelRepeater"),Q=C("DropDownManyFields"),T=C("el-radio"),D=C("el-radio-group"),U=C("el-input-number"),I=C("ChainedFields"),O=C("ChainedSelects"),P=C("SelectionRouting"),K=C("RestSelector"),G=C("CardBody"),ne=C("CardContainer"),Y=C("el-button"),N=C("el-form"),oe=Ca("loading");return d(),_("div",J4,[r("div",Z4,[l(A,{loading:s.loading_app,class:"bg-white rounded p-6 mb-7.5 dark:bg-dark-700",animated:""},{template:i(()=>[l(u,{variant:"h3",class:"w-[150px] mb-5"}),r("div",ex,[r("div",null,[l(u,{variant:"h3",class:"w-[50px] mb-3"}),l(u,{variant:"p"})]),r("div",null,[l(u,{variant:"h3",class:"w-[50px] mb-3"}),l(u,{variant:"p"})])])]),_:1},8,["loading"]),s.loading_app?x("",!0):(d(),E(N,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:i(()=>[l(f,{settings:s.settings,integration_name:s.integration_name},null,8,["settings","integration_name"]),l(ne,null,{default:i(()=>[l(G,null,{default:i(()=>[(d(!0),_(H,null,ee(s.settings_fields.fields,(Z,le)=>(d(),_("div",{key:le,class:de(["fct-setting-form-row",Z.key])},[Z.label?(d(),_("div",tx,[Z.tips?(d(),E(m,{key:0,title:Z.label,content:Z.tips,placement:"top-start",required:Z.required},null,8,["title","content","required"])):(d(),E(m,{key:1,title:Z.label,required:Z.required},null,8,["title","required"])),Z.inline_tip?(d(),_("p",{key:2,class:"fct-inline-tip",innerHTML:Z.inline_tip},null,8,ax)):x("",!0)])):x("",!0),r("div",nx,[Z.component==="text"?(d(),_(H,{key:0},[l(g,{placeholder:Z.placeholder,modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te,class:de(s.errors.errors[Z.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),l(y,{field:Z.key,errors:s.errors},null,8,["field","errors"])],64)):Z.component==="list_ajax_options"?(d(),_(H,{key:1},[Dt((d(),E(B,{onChange:t[0]||(t[0]=te=>o.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=te=>s.settings.list_id=te),placeholder:Z.placeholder,clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(Z.options,(te,X)=>(d(),E(v,{key:X,value:X,label:te},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[oe,s.loading_list]]),l(y,{field:Z.key,errors:s.errors},null,8,["field","errors"])],64)):Z.component==="map_fields"?(d(),E(b,{key:2,onSetMergeModelObj:te=>o.setMergeModel(Z),errors:s.errors,inputs:s.inputs,field:Z,settings:s.settings,editorShortcodes:s.editorShortcodes,merge_model:s.settings[Z.key],merge_fields:s.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):Z.component==="select"?(d(),_(H,{key:3},[l(B,{filterable:"",clearable:"",multiple:Z.is_multiple,modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te,placeholder:Z.placeholder},{default:i(()=>[(d(!0),_(H,null,ee(Z.options,(te,X)=>(d(),E(v,{key:X,value:X,label:te},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),l(y,{field:Z.key,errors:s.errors},null,8,["field","errors"])],64)):Z.component==="checkbox-single"?(d(),_(H,{key:4},[l(w,{modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te},{default:i(()=>[R(h(Z.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),Z.inline_tip?(d(),_("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:Z.inline_tip},null,8,sx)):x("",!0)],64)):Z.component==="yes-no-checkbox"?(d(),_(H,{key:5},[l(w,{"true-value":"yes","false-value":"no",modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te},{default:i(()=>[R(h(Z.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),Z.inline_tip?(d(),_("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:Z.inline_tip},null,8,lx)):x("",!0)],64)):Z.component==="checkbox-multiple"?(d(),E(k,{key:6,modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te},{default:i(()=>[(d(!0),_(H,null,ee(Z.options,(te,X)=>(d(),E(w,{key:X,label:Number(X)},{default:i(()=>[R(h(te),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):Z.component==="selection_group"?(d(),_(H,{key:7},[l(B,{modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te,placeholder:Z.placeholder,multiple:"",class:de(s.errors.errors[Z.key]?"is-error":"")},{default:i(()=>[(d(!0),_(H,null,ee(Z.options,(te,X)=>(d(),E(S,{key:X,label:te.label},{default:i(()=>[(d(!0),_(H,null,ee(te.options,ie=>(d(),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"]),l(y,{field:Z.key,errors:s.errors},null,8,["field","errors"])],64)):Z.component==="conditional_block"?(d(),E(M,{key:8,fields:s.inputs,conditionals:s.settings[Z.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):Z.component==="value_text"?(d(),E($,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[Z.key],modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):Z.component==="value_textarea"?(d(),E($,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[Z.key],modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):Z.component==="list_select_filter"?(d(),E(F,{key:11,settings:s.settings,field:Z},null,8,["settings","field"])):Z.component==="dropdown_label_repeater"?(d(),E(L,{key:12,errors:s.errors,inputs:s.inputs,field:Z,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):Z.component==="dropdown_many_fields"?(d(),E(Q,{key:13,errors:s.errors,inputs:s.inputs,field:Z,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):Z.component==="radio_choice"?(d(),E(D,{key:14,modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te},{default:i(()=>[(d(!0),_(H,null,ee(Z.options,(te,X)=>(d(),E(T,{key:X,label:X},{default:i(()=>[R(h(te),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):Z.component==="number"?(d(),E(U,{key:15,size:"default",modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te},null,8,["modelValue","onUpdate:modelValue"])):Z.component==="chained_fields"?(d(),E(I,{key:16,settings:s.settings,modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te,field:Z},null,8,["settings","modelValue","onUpdate:modelValue","field"])):Z.component==="chained_select"?(d(),E(O,{key:17,settings:s.settings,modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te,field:Z},null,8,["settings","modelValue","onUpdate:modelValue","field"])):Z.component==="html_info"?(d(),_("div",{key:18,innerHTML:Z.html_info},null,8,ox)):Z.component==="selection_routing"?(d(),E(P,{key:19,inputs:s.inputs,field:Z,editorShortcodes:s.editorShortcodes,settings:s.settings},null,8,["inputs","field","editorShortcodes","settings"])):Z.component==="rest_selector"?(d(),E(K,{key:20,field:Z,modelValue:s.settings[Z.key],"onUpdate:modelValue":te=>s.settings[Z.key]=te},null,8,["field","modelValue","onUpdate:modelValue"])):Z.component==="custom_component"?(d(),E(bn("custom-component-render"),{key:21,field:Z,settings:s.settings},null,8,["field","settings"])):x("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(d(),_("div",rx,[r("div",ix,[r("div",dx,[l(m,{title:o.translate("Run on Selected Variations Only")},null,8,["title"])])]),r("div",ux,[l(B,{filterable:"",clearable:"",multiple:!0,modelValue:s.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=Z=>s.settings.conditional_variation_ids=Z),placeholder:e.$t("Leave empty for all the variations")},{default:i(()=>[(d(!0),_(H,null,ee(s.product_variations,Z=>(d(),E(v,{key:Z.id,value:Z.id,label:Z.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),r("p",cx,h(e.$t("Leave empty to run this feed for all variations")),1)])])):x("",!0)]),_:1})]),_:1}),o.maybeShowSaveButton?(d(),_("div",Ax,[l(Y,{type:"primary",loading:s.saving,onClick:o.saveNotification},{default:i(()=>[R(h(s.integration_id?`Update ${s.settings_fields.integration_title} Feed`:`Create ${s.settings_fields.integration_title} Feed`),1)]),_:1},8,["loading","onClick"])])):x("",!0)]),_:1}))])])}const rA=He(X4,[["render",px]]),fx={class:"setting-wrap"},mx={key:0,class:"integration-actions"},hx={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},_x={class:"text-base"},gx={key:1,class:"fct-integrations-table-wrap"},vx={class:"fct-integration-logo-wrap"},yx=["src","alt"],bx={class:"text-xs text-gray-700"},wx=["onClick"],Cx={class:"fct-event-triggers"},Bx={class:"fct-event-triggers"},kx={class:"fct-btn-group sm"},xx={key:2,class:"fct-integration-table-footer"},Sx={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},Fx={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 n;this.handleError((n=a==null?void 0:a.data)==null?void 0:n.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(n=>{this.handleSuccess(n.message),this.feeds.splice(a,1)}).catch(n=>{var s;this.handleError(((s=n==null?void 0:n.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:au}},Ex=Object.assign(Fx,{setup(e){return(t,a)=>{const n=C("el-button"),s=C("el-dropdown-item"),o=C("el-dropdown-menu"),u=C("el-dropdown"),A=C("el-skeleton"),f=C("el-switch"),m=C("el-table-column"),g=C("el-tag"),y=C("el-popover"),v=C("el-tooltip"),B=C("el-table"),b=Ca("loading");return d(),_("div",fx,[l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:t.$t("Global Integrations Feeds"),text:t.$t("These integration feeds will be applied globally across all your orders and related actions.")},{action:i(()=>[t.hasActiveIntegrations?(d(),_("div",mx,[l(u,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:i(()=>[l(o,null,{default:i(()=>[(d(!0),_(H,null,ee(t.available_integrations,(w,k)=>(d(),E(s,{key:k,command:k},{default:i(()=>[R(h(w.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:i(()=>[l(n,{type:"info",plain:"",size:"small"},{default:i(()=>[R(h(t.$t("Add Integration"))+" ",1),l(W,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title","text"]),l(me,{class:"px-0 pb-0 pt-4"},{default:i(()=>[l(A,{class:"px-5 pb-5",loading:t.loading,animated:"",rows:6},null,8,["loading"]),t.loading?x("",!0):(d(),_(H,{key:0},[t.hasActiveIntegrations?(d(),_("div",gx,[Dt((d(),E(B,{data:t.feeds},{empty:i(()=>[l(at,{icon:"Folder",text:t.$t("You did not add any integration actions yet.")},null,8,["text"])]),default:i(()=>[l(m,{label:t.$t("Enabled"),width:60},{default:i(w=>[l(f,{"active-value":"yes","inactive-value":"no",onChange:k=>t.handleActive(w.row),modelValue:w.row.enabled,"onUpdate:modelValue":k=>w.row.enabled=k},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),l(m,{width:120,label:t.$t("Integration")},{default:i(w=>{var k,S;return[r("div",vx,[(k=t.available_integrations[w.row.provider])!=null&&k.logo?(d(),_("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:t.available_integrations[w.row.provider].logo,alt:w.row.provider},null,8,yx)):x("",!0),r("span",bx,h(((S=t.available_integrations[w.row.provider])==null?void 0:S.title)||w.row.provider),1)])]}),_:1},8,["label"]),l(m,{width:220,label:t.$t("Title")},{default:i(w=>[r("a",{class:"fct-action-link-btn",onClick:Xe(k=>t.edit(w.row),["prevent"]),href:"#"},h(w.row.name),9,wx)]),_:1},8,["label"]),l(m,{width:160,label:t.$t("Triggers")},{default:i(w=>[r("div",Cx,[(d(!0),_(H,null,ee((w.row.feed.event_trigger||[]).slice(0,2),(k,S)=>(d(),E(g,{key:k},{default:i(()=>[l(W,{name:"Trigger"}),R(" "+h(p(Gt).headline(k)),1)]),_:2},1024))),128)),(w.row.feed.event_trigger||[]).length>2?(d(),E(y,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:i(()=>[l(g,{type:"info"},{default:i(()=>[R(" +"+h((w.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:i(()=>[r("div",Bx,[(d(!0),_(H,null,ee((w.row.feed.event_trigger||[]).slice(2),(k,S)=>(d(),E(g,{key:k+S},{default:i(()=>[l(W,{name:"Trigger"}),R(" "+h(p(Gt).headline(k)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),l(m,{width:80},{default:i(w=>[r("div",kx,[l(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{tag:"button",onClick:k=>t.edit(w.row),size:"x-small",hover:"primary"},{default:i(()=>[l(W,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),l(v,{effect:"dark",content:t.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{tag:"button",size:"x-small",onClick:k=>t.removeFeed(w.row.id,w),hover:"danger"},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[b,t.loading]])])):(d(),_("div",hx,[r("p",_x,h(t.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),l(n,{tag:"a",type:"primary",href:t.all_module_config_url},{default:i(()=>[R(h(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?x("",!0):(d(),_("div",xx,[r("a",Sx,h(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),Ux={name:"Integrations",components:{Badge:qt,FluidTabItem:rr,FluidTab:Yd,CardBody:me,CardContainer:he,CardHeader:Ce,PageHeading:za,IconButton:Oe,DynamicIcon:W,Empty:at,GlobalIntegrationFeeds:Ex},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:Ie.get("admin_url"),upgradeUrl:Ie.get("app_config.upgrade_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};lo(e,(a,n)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[n]=a)}),e=t}if(this.module_type!="all"){let t={};lo(e,(a,n)=>{a.categories&&a.categories.includes(this.module_type)&&(t[n]=a)}),e=t}return e},is_no_modules(){return au(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{fetchAddons(){this.fetching=!0,this.$get("integration/addons").then(e=>{this.addOns=e.addons}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},translate:c,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=""})}}},$x={class:"fct-integration-container fct-layout-width"},Dx={style:{"margin-top":"100px"},class:"fct-integration-content"},Qx={class:"fct-integration-content-head"},Ix={class:"fct-card-header-title mb-1"},Tx={class:"card-header-text mt-0"},Vx={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"},Mx={class:"fct-integration-search"},Lx={key:1},Rx={class:"fct-integration-card-content"},Ox={class:"fct-integration-card-content-inner"},Hx={class:"fct-integration-card-logo"},Px=["src","alt"],Nx={class:"title"},Kx={class:"desc"},Gx={key:0,class:"mt-2"},jx={key:1,class:"mt-2"};function zx(e,t,a,n,s,o){const u=C("PageHeading"),A=C("GlobalIntegrationFeeds"),f=C("DynamicIcon"),m=C("IconButton"),g=C("FluidTabItem"),y=C("FluidTab"),v=C("el-input"),B=C("el-skeleton"),b=C("Badge"),w=C("el-button"),k=C("Empty"),S=C("CardBody"),M=C("CardContainer");return d(),_("div",$x,[l(u,{title:e.$t("Integrations & Addons")},null,8,["title"]),l(A),r("div",Dx,[l(M,null,{default:i(()=>[l(S,null,{default:i(()=>[r("div",Qx,[l(m,{circle:"",size:"large"},{default:i(()=>[l(f,{name:"EqualizerLine"})]),_:1}),r("div",null,[r("h2",Ix,h(e.$t("Integration Modules")),1),r("p",Tx,h(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),r("div",Vx,[l(y,null,{default:i(()=>[(d(!0),_(H,null,ee(s.modules,($,F)=>(d(),E(g,{key:F,class:de(["uppercase",$===s.module_type?"active":""]),onClick:L=>o.changeModuleType($)},{default:i(()=>[R(h($),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),r("div",Mx,[l(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=$=>s.search=$)},{prefix:i(()=>[l(f,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(d(),E(B,{key:0,loading:!0,animated:"",rows:4})):x("",!0),s.fetching?x("",!0):(d(),_("div",Lx,[(d(!0),_(H,null,ee(o.filteredAddons,($,F)=>(d(),_("div",{key:F,class:de(["fct-integration-card","addon-enabled-"+$.enabled])},[r("div",Rx,[r("div",Ox,[r("div",Hx,[$.logo?(d(),_("img",{key:0,src:$.logo,alt:$.title},null,8,Px)):x("",!0)]),r("div",null,[r("h5",Nx,[R(h($.title)+" ",1),$.is_pro&&!$.enabled?(d(),E(b,{key:0,status:"warning",text:"Pro"})):(d(),E(b,{key:1,status:$.enabled?"active":"info",text:$.enabled?"enabled":"disabled"},null,8,["status","text"]))]),r("p",Kx,h($.description),1),$.is_pro&&!$.is_pro_active?(d(),_("div",Gx,[l(w,{type:"warning",size:"small",tag:"a",href:s.upgradeUrl,target:"_blank"},{default:i(()=>[l(f,{name:"Crown",class:"mr-1"}),R(" "+h(o.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!$.enabled&&$.installable?(d(),_("div",jx,[l(w,{loading:s.installingAdding==F,disabled:s.installingAdding==F,onClick:L=>o.installAddon($,F),type:"primary",size:"small"},{default:i(()=>[R(h(o.translate("Install %s",$.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):x("",!0)])])])],2))),128))])),o.is_no_modules&&!s.fetching?(d(),E(k,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):x("",!0)]),_:1})]),_:1})])])}const Yx=He(Ux,[["render",zx]]),qx={class:"fct-connect-details"},Wx={key:0,class:"fct-connect-require"},Xx={class:"flex items-center justify-between"},Jx={key:0,class:"display-name"},Zx={name:"ConnectAccount",props:["connect","connect_config","mode","method","methodName","methodLabel"],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)})}}},iA=Object.assign(Zx,{setup(e){return(t,a)=>{const n=C("el-button"),s=C("el-popconfirm");return d(),_("div",qx,[!e.connect||e.connect.error?(d(),_("div",Wx,[r("h4",null,h(p(c)("Connect Your %s Account to your website to accept Payments",e.methodName)),1),l(n,{tag:"a",type:"info",plain:"",href:e.connect_config[e.mode+"_redirect"]},{default:i(()=>[l(W,{name:"ArrowLeftRight"}),R(" "+h(p(c)("Connect with %s",e.methodLabel)),1)]),_:1},8,["href"])])):(d(),E(kf,{key:1,title:p(c)("Your %s Account is Up & Running 🎉",e.methodLabel)},{default:i(()=>{var o;return[r("div",Xx,[r("div",null,[e.connect.display_name?(d(),_("p",Jx,h(e.connect.display_name),1)):x("",!0),r("h4",null,h(t.$t("Administrator"))+" ("+h(t.$t("Owner"))+")",1)]),l(s,{width:"230","confirm-button-text":t.$t("Confirm"),"cancel-button-text":t.$t("No, Thanks"),icon:"el-icon-info","icon-color":"red",title:((o=e.connect_config)==null?void 0:o.disconnect_note)??t.$t("Are you sure to disconnect?"),position:"top",onConfirm:t.disconnect},{reference:i(()=>[l(n,{type:"danger",plain:""},{default:i(()=>[R(h(p(c)("Disconnect %s",e.methodLabel)),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])]}),_:1},8,["title"]))])}}}),e3={__name:"Tabs",props:{fields:Object,settings:Object,tabs:Object,index:[String,Number]},setup(e){return(t,a)=>{const n=C("el-tab-pane"),s=C("el-tabs");return d(),E(s,{class:"demo-tabs",modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=o=>e.settings[e.index]=o)},{default:i(()=>[(d(!0),_(H,null,ee(e.tabs.schema,(o,u)=>(d(),E(n,{label:o.label,name:o.value,key:u},{default:i(()=>[r("div",null,[l(bu,{fields:o.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},t3={class:"setting-label"},a3=["innerHTML"],n3={key:0},s3={__name:"RadioSelectDependants",props:{fields:Object,settings:Object,index:[String,Number]},setup(e){return(t,a)=>{const n=C("el-icon"),s=C("el-tooltip"),o=C("el-radio"),u=C("el-radio-group");return d(),_(H,null,[r("p",t3,[R(h(e.fields[e.index].label)+" ",1),e.fields[e.index].tooltip?(d(),E(s,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:e.fields[e.index].tooltip},null,8,a3)]),default:i(()=>[l(n,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:1})):x("",!0)]),l(u,{modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=A=>e.settings[e.index]=A)},{default:i(()=>[(d(!0),_(H,null,ee(e.fields[e.index].options,(A,f)=>(d(),E(o,{label:A,value:f,key:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),a[1]||(a[1]=r("br",null,null,-1)),a[2]||(a[2]=r("br",null,null,-1)),(d(!0),_(H,null,ee(e.fields[e.index].dependants,(A,f)=>(d(),_("div",{key:f},[e.settings[e.index]===A.value?(d(),_("div",n3,[l(bu,{fields:A.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):x("",!0)]))),128))],64)}}},l3={name:"PayPalWebhookSetup",components:{Notify:q},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",q.success(e.message),this.$emit("reload_settings",!0)}).catch(e=>{this.isLoading=!1,this.setupStatus="error",q.error(e.message),setTimeout(()=>{window.location.reload()},2e3)})}}},o3={key:0,class:"fluent_cart_paypal_webhook_setup"},r3={class:"fluent_cart_paypal_webhook_setup_title"},i3=["innerHTML"],d3={key:1};function u3(e,t,a,n,s,o){const u=C("el-button"),A=Ca("loading");return o.isConnected?(d(),_("div",o3,[r("p",r3,"PayPal "+h(a.mode)+" webhook setup",1),a.webhook_info?Dt((d(),_("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,i3)),[[A,s.checkingWebhook]]):(d(),_("div",d3,[t[1]||(t[1]=r("p",{class:"fluent_cart_paypal_webhook_setup_description"}," Configure PayPal webhooks to receive real-time payment notifications ",-1)),t[2]||(t[2]=r("br",null,null,-1)),l(u,{type:e.text,loading:s.isLoading,onClick:o.setupWebhook,disabled:s.isLoading,class:"setup-button",size:"small"},{default:i(()=>t[0]||(t[0]=[r("span",null,"Setup Webhook",-1)])),_:1,__:[0]},8,["type","loading","onClick","disabled"])]))])):x("",!0)}const c3=He(l3,[["render",u3],["__scopeId","data-v-f187f73f"]]),A3={key:0,class:"fct-col"},p3=["innerHTML"],f3={key:1,class:"fct-col"},m3={class:"font-bold p-6 mt-6 text-center bg-gray-200"},h3={key:2,class:"fct-col"},_3={class:"text-red-700"},g3={key:1},v3={key:0},y3={class:"flex items-center justify-between"},b3={key:1,class:"flex items-center justify-between"},w3={class:"text-red-700"},C3={key:3,class:"fct-col"},B3={class:"setting-label"},k3=["innerHTML"],x3={key:0,class:"fct-settings-description"},S3={key:4,class:"fct-col"},F3=["innerHTML"],E3={key:0,class:"fct-settings-description"},U3={key:5,class:"fct-col"},$3={class:"setting-label"},D3=["innerHTML"],Q3={key:0,class:"fct-settings-description"},I3={key:6,class:"fct-col"},T3={class:"setting-label"},V3=["innerHTML"],M3={key:0,class:"fct-settings-description"},L3={key:7,class:"fct-col"},R3={key:0},O3=["innerHTML"],H3={key:8,class:"fct-col"},P3={class:"setting-label"},N3={key:0,class:"fct-settings-description"},K3={key:9,class:"fct-col"},G3={class:"setting-label"},j3={key:0,class:"fct-settings-description"},z3={key:10,class:"fct-col"},Y3={class:"setting-label"},q3={key:0,class:"fct-settings-description"},W3={key:11,class:"fct-col"},X3={class:"setting-label"},J3=["innerHTML"],Z3={key:0,class:"fct-settings-description"},eS={key:12,class:"fct-col"},tS={class:"setting-label"},aS=["innerHTML"],nS={key:0,class:"fct-settings-description"},sS={key:13,class:"fct-col"},lS={class:"setting-label"},oS=["innerHTML"],rS={key:0,class:"fct-settings-description"},iS={key:14,class:"fct-col"},dS={class:"setting-label"},uS={key:0,class:"fct-settings-description"},cS={key:15,class:"fct-col"},AS=["innerHTML"],pS={key:16,class:"fct-col"},fS={key:0},mS={key:0},hS={class:"setting-label"},_S={class:"flex flex-wrap gap-2"},gS={class:"mt-4 text-gray-700 dark:text-gray-300"},vS=["href"],yS={key:1},bS={class:"setting-label"},wS={class:"flex flex-wrap gap-2"},CS={class:"mt-4 text-gray-700 dark:text-gray-300"},BS=["href"],kS={key:17,class:"fct-col"},xS={key:18,class:"fct-col"},bu={__name:"Renderer",props:{fields:Object,settings:Object,route_name:String,methodName:String,methodTitle:String,methodLabel:String},emits:["onSettingsChange"],setup(e,{emit:t}){const a=Qt().ctx,n=V({}),s=V(null),o=V(null),u=V(!1),A=V({}),f=Ie.get("shop.order_mode"),m=e,g=t,y=j(()=>{var M,$,F;return((M=m.settings)==null?void 0:M.payment_mode)==="test"?($=m.settings)==null?void 0:$.define_test_keys:(F=m.settings)==null?void 0:F.define_live_keys});j(()=>{var M,$;return(M=m.fields)!=null&&M.payment_mode&&(($=m.settings)==null?void 0:$.payment_mode)!==f&&g("onSettingsChange",{...m.settings,payment_mode:f}),!0});const v=j(()=>{var M;return((M=m.settings)==null?void 0:M.payment_mode)==="test"?"test":"live"}),B=()=>{u.value=!0,a.$get("settings/payment-methods/connect/info",{method:m.route_name}).then(M=>{M&&(u.value=!1,n.value=M.connect_config,g("onSettingsChange",M.settings),s.value=M.live_account,o.value=M.test_account,s.value.error&&(A.value=s.value),o.value.error&&(A.value=o.value),u.value=!1)}).catch(M=>{u.value=!1,A.value=M}).finally(()=>{u.value=!1})},b=M=>{const $=M.target;if($.classList.contains("fct-install-addon-btn")||$.closest(".fct-install-addon-btn")){M.preventDefault(),M.stopPropagation();const F=$.classList.contains("fct-install-addon-btn")?$:$.closest(".fct-install-addon-btn"),L=F.getAttribute("data-addon-slug"),Q=F.getAttribute("data-addon-file"),T=F.getAttribute("data-source-type"),D=F.getAttribute("data-source-link"),U=F.getAttribute("data-repo-link");L&&Q&&U&&k({slug:L,source_type:T||"github",source_link:D||"",repo_link:U||""});return}if($.classList.contains("fct-activate-addon-btn")||$.closest(".fct-activate-addon-btn")){M.preventDefault(),M.stopPropagation();const L=($.classList.contains("fct-activate-addon-btn")?$:$.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");L&&S({file:L})}},w=Ie.get("app_config.isProActive"),k=M=>{if(!w){window.open(M.repo_link,"_blank","noopener,noreferrer");return}const $=document.querySelector(`[data-addon-slug="${M.slug}"]`);$&&($.disabled=!0,$.innerHTML='<span class="el-icon-loading"></span> '+c("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:M.slug,source_type:M.source_type,source_link:M.source_link}).then(F=>{q.success({message:F.message||c("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(F=>{q.error({message:(F==null?void 0:F.message)||c("Failed to install addon")}),$&&($.disabled=!1,$.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 10H18L12 16L6 10H11V3H13V10M4 19H20V12H22V20C22 20.5304 21.7893 21.0391 21.4142 21.4142C21.0391 21.7893 20.5304 22 20 22H4C3.46957 22 2.96086 21.7893 2.58579 21.4142C2.21071 21.0391 2 20.5304 2 20V12H4V19Z"/></svg>'+c("Install Addon"))})},S=M=>{const $=document.querySelector(`[data-addon-file="${M.file}"]`);$&&($.disabled=!0,$.innerHTML='<span class="el-icon-loading"></span> '+c("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:M.file}).then(F=>{q.success({message:F.message||c("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(F=>{q.error({message:(F==null?void 0:F.message)||c("Failed to activate addon")}),$&&($.disabled=!1,$.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>'+c("Activate Addon"))})};return Be(()=>{B(),document.addEventListener("click",b)}),At(()=>{document.removeEventListener("click",b)}),(M,$)=>{const F=C("el-skeleton-item"),L=C("el-skeleton"),Q=C("el-icon"),T=C("el-tooltip"),D=C("el-switch"),U=C("el-checkbox"),I=C("el-option"),O=C("el-select"),P=C("el-radio"),K=C("el-radio-group"),G=C("el-input"),ne=C("el-input-number"),Y=C("el-checkbox-group");return d(),_("div",{class:de([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(d(!0),_(H,null,ee(e.fields,(N,oe)=>{var Z,le,te,X,ie,be;return d(),_("div",{class:"fct-setting-row fct-row",key:oe},[N.type==="notice"?(d(),_("div",A3,[r("p",{innerHTML:N.value},null,8,p3)])):x("",!0),N.type==="upcoming"?(d(),_("div",f3,[r("h1",m3,h(p(c)("Upcoming")),1)])):x("",!0),N.type==="provider"?(d(),_("div",h3,[N.value=="connect"?(d(),_(H,{key:0},[e.settings.payment_mode=="test"?(d(),_(H,{key:0},[l(L,{loading:u.value,animated:""},{template:i(()=>[l(F,{variant:"h3",class:"w-[150px] mb-3"}),l(F,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),u.value?x("",!0):(d(),E(iA,{key:0,onReload_settings:$[0]||($[0]=se=>B()),method:e.route_name,methodName:e.methodName,methodLabel:e.methodLabel,connect_config:n.value,mode:"test",connect:o.value},null,8,["method","methodName","methodLabel","connect_config","connect"]))],64)):e.settings.payment_mode=="live"?(d(),_(H,{key:1},[u.value?x("",!0):(d(),E(iA,{key:0,method:e.route_name,methodName:e.methodName,onReload_settings:$[1]||($[1]=se=>B()),connect_config:n.value,mode:"live",methodLabel:e.methodLabel,connect:s.value},null,8,["method","methodName","connect_config","methodLabel","connect"]))],64)):x("",!0),$[3]||($[3]=r("br",null,null,-1)),r("p",_3,h((Z=A.value)==null?void 0:Z.error),1)],64)):(d(),_("div",g3,[y.value?(d(),_("div",v3,[r("div",null,[l(kf,{title:p(c)("Your API setup is Up & Running 🎉")},{default:i(()=>[r("div",y3,[r("div",null,[r("b",null,h(p(c)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(d(),_("div",b3,[r("div",null,[r("b",null,h(p(c)("Payment API settings is not enabled by API keys / Connect")),1),$[4]||($[4]=r("br",null,null,-1)),r("p",null,h(p(c)("You can Set Up API keys defined as constant, Or use connect.")),1),r("p",w3,h((le=A.value)==null?void 0:le.error),1)])]))]))])):x("",!0),N.type==="enable"?(d(),_("div",C3,[r("p",B3,[R(h(N.label)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:N.tooltip},null,8,k3)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),l(D,{modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,"active-value":"yes","inactive-value":"no","active-text":p(c)("Active"),"inactive-text":p(c)("Inactive")},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text"]),N.description?(d(),_("p",x3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="checkbox"?(d(),_("div",S3,[l(U,{"true-value":"yes","false-value":"no",modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,disabled:N.disabled},{default:i(()=>[R(h(N.label)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:N.tooltip},null,8,F3)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),N.description?(d(),_("p",E3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="select"?(d(),_("div",U3,[r("p",$3,[R(h(N.label)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:N.tooltip},null,8,D3)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),l(O,{placeholder:N.placeholder,modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,filterable:N.filterable!==!1},{default:i(()=>[(d(!0),_(H,null,ee(N.options,(se,ce)=>(d(),E(I,{label:se.label,value:se.value,key:ce},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),N.description?(d(),_("p",Q3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="radio"?(d(),_("div",I3,[r("p",T3,[R(h(N.label)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:N.tooltip},null,8,V3)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),l(K,{modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se},{default:i(()=>[(d(!0),_(H,null,ee(N.options,(se,ce)=>(d(),E(P,{label:se,value:ce,key:ce},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.description?(d(),_("p",M3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="webhook_info"&&((te=e.settings)==null?void 0:te.payment_mode)===N.mode?(d(),_("div",L3,[e.route_name==="paypal"&&!y.value?(d(),_("div",R3,[l(c3,{testConnect:o.value,liveConnect:s.value,webhook_info:N.info,onReload_settings:$[2]||($[2]=se=>B()),mode:N==null?void 0:N.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):N.info?(d(),_("div",{key:1,innerHTML:N.info},null,8,O3)):x("",!0)])):x("",!0),N.type==="input"||N.type==="password"?(d(),_("div",H3,[r("p",P3,h(N.label),1),l(G,{type:N.type,placeholder:N.placeholder,modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,maxlength:N.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),N.description?(d(),_("p",N3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="email"?(d(),_("div",K3,[r("p",G3,h(N.label),1),l(G,{type:"email",placeholder:N.placeholder,modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se},null,8,["placeholder","modelValue","onUpdate:modelValue"]),N.description?(d(),_("p",j3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="number"?(d(),_("div",z3,[r("p",Y3,h(N.label),1),l(ne,{placeholder:N.placeholder,modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,max:N.max,min:N.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),N.description?(d(),_("p",q3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="text"?(d(),_("div",W3,[r("p",X3,[R(h(N.label)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:N.tooltip},null,8,J3)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),l(G,{type:"text",placeholder:N.placeholder,modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,disabled:N.disabled,maxlength:N.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),N.description?(d(),_("p",Z3,h(N.description),1)):x("",!0)])):x("",!0),N.type==="color"?(d(),_("div",eS,[r("p",tS,[R(h(N.label)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:N.tooltip},null,8,aS)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),l(_u,{modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,field:N},null,8,["modelValue","onUpdate:modelValue","field"]),N.description?(d(),_("p",nS,h(N.description),1)):x("",!0)])):x("",!0),N.type==="file"?(d(),_("div",sS,[r("p",lS,[R(h(N.label)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",{innerHTML:N.tooltip},null,8,oS)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),l(si,{modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se,icon:"Upload",title:p(c)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),N.description?(d(),_("p",rS,h(N.description),1)):x("",!0)])):x("",!0),N.type==="checkbox_group"?(d(),_("div",iS,[r("p",dS,[R(h(N.title)+" ",1),N.tooltip?(d(),E(T,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:i(()=>[r("p",null,h(N.tooltip),1)]),default:i(()=>[l(Q,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),l(Y,{modelValue:e.settings[oe],"onUpdate:modelValue":se=>e.settings[oe]=se},{default:i(()=>[(d(!0),_(H,null,ee(N.options,(se,ce)=>(d(),E(U,{label:ce,key:ce},{default:i(()=>[R(h(se),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.description?(d(),_("p",uS,h(N.description),1)):x("",!0)])):x("",!0),N.type==="html_attr"?(d(),_("div",cS,[r("div",{innerHTML:N.value},null,8,AS)])):x("",!0),N.type==="active_methods"?(d(),_("div",pS,[(X=N.value)!=null&&X.activated_methods?(d(),_("div",fS,[e.settings.payment_mode==="live"&&oe==="live_active_methods"?(d(),_("div",mS,[r("p",hS,h(N.label),1),R(" "+h(M.active_methods)+" ",1),r("ul",_S,[(d(!0),_(H,null,ee(N.value.activated_methods,(se,ce)=>(d(),_("li",{class:"bg-gray-50 dark:bg-gray-800 p-2 rounded text-sm text-gray-600 dark:text-gray-200 border border-gray-100 dark:border-gray-700",key:ce},h(se!=null&&se.name?se.name:se),1))),128))]),r("p",gS,[R(h(p(c)("You can configure methods ")),1),r("a",{href:(ie=N.value)==null?void 0:ie.configure_url,target:"_blank",class:"underline text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300"},h(p(c)("here")),9,vS)])])):x("",!0),e.settings.payment_mode==="test"&&oe==="test_active_methods"?(d(),_("div",yS,[r("p",bS,h(N.label),1),r("ul",wS,[R(h(M.active_methods)+" ",1),(d(!0),_(H,null,ee(N.value.activated_methods,(se,ce)=>(d(),_("li",{class:"bg-gray-50 dark:bg-gray-800 p-2 rounded text-sm text-gray-600 dark:text-gray-200 border border-gray-100 dark:border-gray-700",key:ce},h(se!=null&&se.name?se.name:se),1))),128))]),r("p",CS,[R(h(p(c)("You can configure methods ")),1),r("a",{href:(be=N.value)==null?void 0:be.configure_url,target:"_blank",class:"underline text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300"},h(p(c)("here")),9,BS)])])):x("",!0)])):x("",!0)])):x("",!0),N.type==="tabs"?(d(),_("div",kS,[l(e3,{fields:e.fields,settings:e.settings,index:oe,tabs:e.fields[oe]},null,8,["fields","settings","index","tabs"])])):x("",!0),N.type==="radio-select-dependants"?(d(),_("div",xS,[l(s3,{fields:e.fields,settings:e.settings,index:oe},null,8,["fields","settings","index"])])):x("",!0)])}),128))],2)}}},SS={class:"setting-wrap"},FS={class:"setting-wrap-inner"},ES={class:"mb-5 flex items-center justify-between"},US={class:"setting-switcher flex items-center gap-3"},$S={class:"setting-save-action"},DS={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:"",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,so("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return Ps.getUrl("images/payment-methods/"+t+"-icon.svg")},updateSettings(e){this.settings=e},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,n,s,o,u,A;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=(n=this.settings)==null?void 0:n.checkout_logo,this.checkout_instructions=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((o=this.settings)==null?void 0:o.thank_you_page_instructions)||"",this.mediaSelection=(u=this.settings)!=null&&u.checkout_logo?{url:(A=this.settings)==null?void 0:A.checkout_logo,id:0,title:"Checkout Logo"}:""})},saveSettings(){this.saving=!0,this.$post("settings/payment-methods",{settings:this.settings,method:this.route_name}).then(e=>{this.saving=!1,so("Settings updated!")}).catch(e=>{var t;this.saving=!1,ep(((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,n,s,o,u,A,f;this.route_name=this.$route.name,this.methodName=(e=this.$route)==null?void 0:e.name,(a=(t=this.$route)==null?void 0:t.meta)!=null&&a.admin_title?this.methodTitle=(s=(n=this.$route)==null?void 0:n.meta)==null?void 0:s.admin_title:this.methodTitle=(u=(o=this.$route)==null?void 0:o.meta)==null?void 0:u.title,this.methodLabel=(f=(A=this.$route)==null?void 0:A.meta)==null?void 0:f.label,this.fetchRoute=`settings/payments/${this.$route.name}`},getPageName(){let e="";return this.$route.meta.title?e=this.$route.meta.title+" Settings":e=this.$route.name.charAt(0).toUpperCase()+this.$route.name.slice(1).toLowerCase()+" Settings",e}}},QS=Object.assign(DS,{setup(e){const t=Qt().ctx;return xs().onSave(()=>{t.saveSettings()}),(n,s)=>{const o=C("el-breadcrumb-item"),u=C("el-breadcrumb"),A=C("el-switch"),f=C("Edit"),m=C("el-icon"),g=C("el-skeleton"),y=C("el-button");return d(),_("div",SS,[r("div",FS,[r("div",ES,[l(u,{class:"mb-0","separator-icon":p(tn)},{default:i(()=>[l(o,{to:{path:"/settings/payments"}},{default:i(()=>[R(h(n.$t("Payment Settings")),1)]),_:1}),l(o,null,{default:i(()=>[r("span",null,h(n.methodTitle),1)]),_:1})]),_:1},8,["separator-icon"]),r("div",US,[l(A,{modelValue:n.settings.is_active,"onUpdate:modelValue":s[0]||(s[0]=v=>n.settings.is_active=v),"active-value":"yes","inactive-value":"no","inactive-text":n.$t("Payment Activation")},null,8,["modelValue","inactive-text"])])]),l(he,null,{default:i(()=>[l(Ce,{title:n.methodTitle,border_bottom:""},{action:i(()=>[l(m,{class:"text-gray-500 cursor-pointer",onClick:n.editDesign},{default:i(()=>[l(f)]),_:1},8,["onClick"])]),_:1},8,["title"]),l(me,{class:"pt-0"},{default:i(()=>[l(g,{loading:n.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),n.fetching?x("",!0):(d(),E(bu,{key:0,onOnSettingsChange:n.updateSettings,route_name:n.route_name,methodName:n.methodName,methodTitle:n.methodTitle,methodLabel:n.methodLabel,fields:n.fields,settings:n.settings},null,8,["onOnSettingsChange","route_name","methodName","methodTitle","methodLabel","fields","settings"]))]),_:1})]),_:1}),r("div",$S,[l(y,{onClick:s[1]||(s[1]=v=>n.saveSettings()),type:"primary",loading:n.saving},{default:i(()=>[R(h(n.$t("Save Settings")),1)]),_:1},8,["loading"])])])])}}}),IS={class:"setting-wrap"},TS={class:"setting-wrap-inner"},VS={class:"setting-save-action"},MS={name:"PaymentDesign",components:{SettingsHeader:ha},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,so("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,ep("Something went wrong!")})},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,n,s,o,u,A;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=(n=this.settings)==null?void 0:n.checkout_logo,this.checkout_instructions=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((o=this.settings)==null?void 0:o.thank_you_page_instructions)||"",this.mediaSelection=(u=this.settings)!=null&&u.checkout_logo?[{url:(A=this.settings)==null?void 0:A.checkout_logo,id:0,title:"Checkout Logo"}]:""}).catch(()=>{this.fetching=!1})},initRouteData(){var a,n,s,o,u,A;this.route_name=this.$route.params.method||this.$route.name,(n=(a=this.$route)==null?void 0:a.meta)!=null&&n.admin_title?this.methodTitle=(o=(s=this.$route)==null?void 0:s.meta)==null?void 0:o.admin_title:this.methodTitle=((A=(u=this.$route)==null?void 0:u.meta)==null?void 0:A.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)}}},LS=Object.assign(MS,{setup(e){return(t,a)=>{const n=C("el-breadcrumb-item"),s=C("el-breadcrumb"),o=C("el-icon"),u=C("el-button"),A=C("el-skeleton"),f=C("el-input"),m=C("el-form-item"),g=C("el-form");return d(),_("div",IS,[l(ha,{onOnSave:t.savePaymentDesign,loading:t.saving,"save-button-text":t.$t("Update"),"loading-text":t.$t("Updating")},{heading:i(()=>[l(s,{class:"mb-0","separator-icon":p(tn)},{default:i(()=>[l(n,{to:{path:"/settings/payments"}},{default:i(()=>[R(h(t.$t("Payment Settings")),1)]),_:1}),l(n,null,{default:i(()=>[r("span",{class:"cursor-pointer",onClick:a[0]||(a[0]=(...y)=>t.goBack&&t.goBack(...y))},h(t.$route.params.method),1)]),_:1}),l(n,null,{default:i(()=>[r("span",null,h(t.$t("Checkout Customization")),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["onOnSave","loading","save-button-text","loading-text"]),r("div",TS,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Customization"),border_bottom:""},{action:i(()=>[l(u,{onClick:t.goBack,type:"text",class:"cursor-pointer border-none p-0"},{default:i(()=>[l(o,{class:"text-gray-500 cursor-pointer",onClick:t.goBack},{default:i(()=>[l(p(mh))]),_:1},8,["onClick"]),R(" "+h(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),l(me,null,{default:i(()=>[l(A,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?x("",!0):(d(),E(g,{key:0,"label-position":"left"},{default:i(()=>[l(m,{label:t.$t("Checkout Label")},{default:i(()=>[l(f,{type:"text",modelValue:t.checkout_label,"onUpdate:modelValue":a[1]||(a[1]=y=>t.checkout_label=y)},null,8,["modelValue"])]),_:1},8,["label"]),l(m,{label:t.$t("Checkout Logo")},{default:i(()=>[l(si,{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"]),l(m,{"label-position":"top"},{default:i(()=>[l(sa,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),l(ts,{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]=r("div",{class:"h-10"},null,-1)),l(m,{"label-position":"top"},{default:i(()=>[l(sa,{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"]),l(ts,{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}),r("div",VS,[l(u,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:i(()=>[R(h(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),RS={class:"fct-integration-setting-content"},OS={class:"fct-integration-setting-head"},HS={class:"flex items-center gap-3 mb-2"},PS=["src"],NS={class:"title"},KS=["innerHTML"],GS={key:0,class:"integration_success_state"},jS=["innerHTML"],zS={key:1,class:"fct-integration-setting-body"},YS={class:"fct-integration-setting-body-inner"},qS=["innerHTML"],WS=["innerHTML"],XS=["target","href"],JS={key:0},ZS={key:0,class:"fct-integration-setting-body-footer"},eF={key:2},tF={name:"GeneralIntegration",components:{InfoFilled:Xa,Setting:ap},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)})}}},aF=Object.assign(tF,{setup(e){const t=Qt().ctx;return xs().onSave(()=>{t.integration.status||t.save()}),(n,s)=>{const o=C("el-button"),u=C("el-icon"),A=C("el-tooltip"),f=C("el-option"),m=C("el-select"),g=C("el-input"),y=C("el-form-item"),v=C("el-form"),B=Ca("loading");return d(),_("div",RS,[r("div",OS,[r("div",HS,[n.settings.logo?(d(),_("img",{key:0,class:"h-8",src:n.settings.logo,alt:""},null,8,PS)):x("",!0),r("h3",NS,h(n.settings.menu_title),1)]),r("p",{class:"desc",innerHTML:n.settings.menu_description},null,8,KS)]),n.settings.hide_on_valid&&n.integration.status?(d(),_("div",GS,[r("p",{innerHTML:n.settings.discard_settings.section_description},null,8,jS),r("div",null,[l(o,{onClick:s[0]||(s[0]=b=>n.disconnect(n.settings.discard_settings.data)),type:"danger",plain:""},{default:i(()=>[R(h(n.settings.discard_settings.disconnect_button_text),1)]),_:1}),n.settings.discard_settings.show_verify?(d(),E(o,{key:0,onClick:s[1]||(s[1]=b=>n.save()),type:"primary"},{default:i(()=>[R(h(n.settings.discard_settings.verify_button_text),1)]),_:1})):x("",!0)])])):Dt((d(),_("div",zS,[r("div",YS,[n.settings.config_instruction&&!n.integration.status?(d(),_("div",{key:0,class:"integration_instraction",innerHTML:n.settings.config_instruction},null,8,qS)):x("",!0),l(v,{"label-width":"205px","label-position":"top"},{default:i(()=>[(d(!0),_(H,null,ee(n.settings.fields,(b,w)=>(d(),E(y,{key:w},{label:i(()=>[R(h(b.label)+" ",1),b.label_tips?(d(),E(A,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:i(()=>[r("div",{innerHTML:b.label_tips},null,8,WS)]),default:i(()=>[l(u,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:2},1024)):x("",!0)]),default:i(()=>[b.type=="authenticate-button"?(d(),E(o,{key:0,onClick:k=>n.authenticate(b.end_point,b.params)},{default:i(()=>[R(h(b.button_text),1)]),_:2},1032,["onClick"])):b.type=="select"?(d(),E(m,{key:1,modelValue:n.integration[w],"onUpdate:modelValue":k=>n.integration[w]=k},{default:i(()=>[(d(!0),_(H,null,ee(b.options,(k,S)=>(d(),E(f,{key:S,label:k,value:S},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):b.type=="link"?(d(),_(H,{key:2},[r("a",{target:b.target,class:de(b.btn_class),href:b.link},h(b.link_text),11,XS),r("p",null,h(b.tips),1)],64)):(d(),_(H,{key:3},[l(g,{placeholder:b.placeholder,type:b.type,modelValue:n.integration[w],"onUpdate:modelValue":k=>n.integration[w]=k},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),b.tips?(d(),_("p",JS,h(b.tips),1)):x("",!0)],64))]),_:2},1024))),128))]),_:1})]),n.loading?x("",!0):(d(),_("div",ZS,[l(o,{type:"primary",onClick:n.save},{default:i(()=>[R(h(n.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[B,n.loading]]),n.error_message?(d(),_("p",eF,h(n.error_message),1)):x("",!0)])}}}),nF={class:"fct-integration-setting-container fct-layout-width"},sF={class:"single-page-header"},lF={class:"single-page-body"},oF={class:"fct-integration-setting-wrap"},rF={name:"IntegrationEditor"},iF=Object.assign(rF,{setup(e){return(t,a)=>{const n=C("el-breadcrumb-item"),s=C("el-breadcrumb");return d(),_("div",nF,[r("div",sF,[l(s,{"separator-icon":p(tn)},{default:i(()=>[l(n,{to:{name:"integrations"}},{default:i(()=>[R(h(t.$t("Integrations")),1)]),_:1}),l(n,null,{default:i(()=>[R(h(p(Gt).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),r("div",lF,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[r("div",oF,[l(aF,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),dF={class:"fct-form-group"},uF={for:"store-country"},cF={class:"fct-form-group"},AF={class:"fct-form-group"},pF={class:"fct-form-group"},fF={__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 n=e,s=a,o=V({store_name:"",store_logo:"",store_country:"",currency:""});ge(()=>n.savedFormData??n.initialSettings,f=>{f&&(o.value.store_name=f.store_name??"",o.value.store_logo=f.store_logo??"",o.value.store_country=f.store_country??"",o.value.currency=f.currency??"")},{immediate:!0});const u=f=>{s("storeCountryChanged",f),f&&re.post("settings/store",{store_country:f,store_name:o.value.store_name,settings_name:"store_setup"}).catch(()=>{})};return t({onNextStep:async()=>{const f=Array.isArray(o.value.store_logo)&&o.value.store_logo.length>0?o.value.store_logo[0]:o.value.store_logo;try{await re.post("onboarding/",{store_name:o.value.store_name,store_logo:f,store_country:o.value.store_country,currency:o.value.currency})}catch{q.warning(c("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...o.value})}),(f,m)=>{const g=C("el-option"),y=C("el-select"),v=C("el-input");return d(),_(H,null,[r("div",dF,[r("label",uF,h(p(c)("Store Country")),1),l(y,{modelValue:o.value.store_country,"onUpdate:modelValue":m[0]||(m[0]=B=>o.value.store_country=B),placeholder:p(c)("Store Country"),onChange:u,filterable:""},{default:i(()=>[(d(!0),_(H,null,ee(e.countries,(B,b)=>(d(),E(g,{key:b,label:B.name,value:B.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),r("div",cF,[r("label",null,h(p(c)("Shop Name")),1),l(v,{modelValue:o.value.store_name,"onUpdate:modelValue":m[1]||(m[1]=B=>o.value.store_name=B)},null,8,["modelValue"])]),r("div",AF,[r("label",null,h(p(c)("Store Currency")),1),l(y,{modelValue:o.value.currency,"onUpdate:modelValue":m[2]||(m[2]=B=>o.value.currency=B),filterable:"",placeholder:p(c)("Select")},{default:i(()=>[(d(!0),_(H,null,ee(e.currencies,(B,b)=>(d(),E(g,{key:b,label:B.label,value:B.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),r("div",pF,[r("label",null,h(p(c)("Shop Image/Logo")),1),l(si,{modelValue:o.value.store_logo,"onUpdate:modelValue":m[3]||(m[3]=B=>o.value.store_logo=B),showSupported:"",icon:"Upload",title:p(c)("Upload")},null,8,["modelValue","title"])])],64)}}},wu=["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"],mF=[...wu,"GB","AU","NZ","CA","IN"],hF=[...wu,"GB","AU","NZ"],_F={class:"fct-tax-step"},gF={class:"fct-tax-step-toggle-row"},vF={class:"fct-tax-step-toggle-row__label"},yF={class:"fct-alert-content"},bF={class:"fct-alert-text"},wF={class:"fct-form-group"},CF={key:0,class:"fct-tax-step-country-chip"},BF={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},kF={class:"fct-form-group"},xF={class:"fct-tax-step-radio-group",role:"radiogroup"},SF=["aria-checked"],FF={class:"fct-tax-step-radio-card__label"},EF={class:"fct-tax-step-radio-card__desc"},UF=["aria-checked"],$F={class:"fct-tax-step-radio-card__label"},DF={class:"fct-tax-step-radio-card__desc"},QF={key:0,class:"fct-form-group"},IF={class:"fct-tax-step-radio-group",role:"radiogroup"},TF=["aria-checked"],VF={class:"fct-tax-step-radio-card__label"},MF={class:"fct-tax-step-radio-card__desc"},LF=["aria-checked"],RF={class:"fct-tax-step-radio-card__label"},OF={class:"fct-tax-step-radio-card__desc"},HF=["aria-checked"],PF={class:"fct-tax-step-radio-card__label"},NF={class:"fct-tax-step-radio-card__desc"},KF={class:"fct-form-group"},GF={class:"fct-tax-step-optional"},jF={class:"fct-form-help-text"},zF={class:"fct-alert-content"},YF={class:"fct-alert-text"},qF={__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,n=V({collectTaxes:!1,taxInclusion:"excluded",euMethod:"oss",vatNumber:""}),s=j(()=>wu.includes(a.storeCountry)),o=y=>{n.value={...n.value,...y}},u=j(()=>{if(!s.value)return c("Tax ID / VAT Number");if(n.value.euMethod==="oss")return c("OSS VAT Number");if(n.value.euMethod==="specific"){const y=a.countryName||a.storeCountry;return c("%1$s VAT Number",y)}return c("Home VAT Number")}),A=j(()=>s.value?c("Standard EU VAT rates will be imported automatically for all EU countries."):a.countryName?c("A standard tax class will be created for %1$s. Add your rates in Tax → Tax Rates after setup.",a.countryName):c("A standard tax class will be created. Add your rates in Tax → Tax Rates after setup.")),f=y=>{n.value={collectTaxes:mF.includes(y),taxInclusion:hF.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};ge(()=>a.storeCountry,f),Be(()=>{if(a.savedFormData){n.value={...a.savedFormData};return}const y=a.initialTaxSettings;y&&y.enable_tax==="yes"?n.value={collectTaxes:!0,taxInclusion:y.tax_inclusion||"excluded",euMethod:y.eu_method||"oss",vatNumber:y.vat_number||""}:f(a.storeCountry)});const m=async()=>{try{await re.post("onboarding/save-tax",{enable_tax:n.value.collectTaxes?"yes":"no",store_country:a.storeCountry,tax_inclusion:n.value.taxInclusion,eu_method:n.value.euMethod,vat_number:n.value.vatNumber})}catch{q.warning(c("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(),o(v))};return t({onNextStep:m,getFormData:()=>({...n.value})}),(y,v)=>{const B=C("el-switch"),b=C("el-input");return d(),_("div",_F,[r("div",gF,[r("span",vF,h(p(c)("Collect taxes for my store")),1),l(B,{"model-value":n.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=w=>o({collectTaxes:w}))},null,8,["model-value"])]),n.value.collectTaxes?(d(),_(H,{key:1},[r("div",wF,[r("label",null,h(p(c)("Store country")),1),r("div",null,[e.countryName||e.storeCountry?(d(),_("span",CF,[l(W,{name:"Globe"}),R(" "+h(e.countryName||e.storeCountry),1)])):(d(),_("span",BF,h(p(c)("Not set")),1))])]),e.storeCountry?(d(),_(H,{key:0},[r("div",kF,[r("label",null,h(p(c)("How do you display your prices?")),1),r("div",xF,[r("div",{class:de(["fct-tax-step-radio-card",{"is-selected":n.value.taxInclusion==="included"}]),role:"radio",tabindex:"0","aria-checked":n.value.taxInclusion==="included",onClick:v[1]||(v[1]=w=>o({taxInclusion:"included"})),onKeydown:v[2]||(v[2]=w=>g(w,{taxInclusion:"included"}))},[r("span",{class:de(["fct-tax-step-radio-dot",{"is-active":n.value.taxInclusion==="included"}])},null,2),r("div",null,[r("div",FF,h(p(c)("Prices include tax")),1),r("div",EF,h(p(c)("Tax is already factored into your listed price.")),1)])],42,SF),r("div",{class:de(["fct-tax-step-radio-card",{"is-selected":n.value.taxInclusion==="excluded"}]),role:"radio",tabindex:"0","aria-checked":n.value.taxInclusion==="excluded",onClick:v[3]||(v[3]=w=>o({taxInclusion:"excluded"})),onKeydown:v[4]||(v[4]=w=>g(w,{taxInclusion:"excluded"}))},[r("span",{class:de(["fct-tax-step-radio-dot",{"is-active":n.value.taxInclusion==="excluded"}])},null,2),r("div",null,[r("div",$F,h(p(c)("Add tax at checkout")),1),r("div",DF,h(p(c)("Tax is shown separately and added to the subtotal.")),1)])],42,UF)])]),s.value?(d(),_("div",QF,[r("label",null,h(p(c)("Cross-border compliance")),1),r("div",IF,[r("div",{class:de(["fct-tax-step-radio-card",{"is-selected":n.value.euMethod==="oss"}]),role:"radio",tabindex:"0","aria-checked":n.value.euMethod==="oss",onClick:v[5]||(v[5]=w=>o({euMethod:"oss",vatNumber:""})),onKeydown:v[6]||(v[6]=w=>g(w,{euMethod:"oss",vatNumber:""}))},[r("span",{class:de(["fct-tax-step-radio-dot",{"is-active":n.value.euMethod==="oss"}])},null,2),r("div",null,[r("div",VF,h(p(c)("OSS (One Stop Shop)")),1),r("div",MF,h(p(c)("Charge each EU customer their country's VAT rate.")),1)])],42,TF),r("div",{class:de(["fct-tax-step-radio-card",{"is-selected":n.value.euMethod==="home"}]),role:"radio",tabindex:"0","aria-checked":n.value.euMethod==="home",onClick:v[7]||(v[7]=w=>o({euMethod:"home",vatNumber:""})),onKeydown:v[8]||(v[8]=w=>g(w,{euMethod:"home",vatNumber:""}))},[r("span",{class:de(["fct-tax-step-radio-dot",{"is-active":n.value.euMethod==="home"}])},null,2),r("div",null,[r("div",RF,h(p(c)("Home Country Only")),1),r("div",OF,h(p(c)("Charge all EU customers your home country's rate.")),1)])],42,LF),r("div",{class:de(["fct-tax-step-radio-card",{"is-selected":n.value.euMethod==="specific"}]),role:"radio",tabindex:"0","aria-checked":n.value.euMethod==="specific",onClick:v[9]||(v[9]=w=>o({euMethod:"specific",vatNumber:""})),onKeydown:v[10]||(v[10]=w=>g(w,{euMethod:"specific",vatNumber:""}))},[r("span",{class:de(["fct-tax-step-radio-dot",{"is-active":n.value.euMethod==="specific"}])},null,2),r("div",null,[r("div",PF,h(p(c)("Only for %1$s",e.countryName||e.storeCountry)),1),r("div",NF,h(p(c)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,HF)])])):x("",!0),r("div",KF,[r("label",null,[R(h(u.value)+" ",1),r("span",GF,h(p(c)("(optional)")),1)]),l(b,{"model-value":n.value.vatNumber,"onUpdate:modelValue":v[11]||(v[11]=w=>o({vatNumber:w})),placeholder:s.value?"DE123456789":""},null,8,["model-value","placeholder"]),r("p",jF,h(p(c)("Your registration number, printed on invoices")),1)]),l(Na,{icon:"Info"},{content:i(()=>[r("div",zF,[r("p",YF,h(A.value),1)])]),_:1})],64)):x("",!0)],64)):(d(),E(Na,{key:0},{content:i(()=>[r("div",yF,[r("p",bF,h(p(c)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},WF={class:"dialog-footer"},XF={__name:"CreatePageButton",props:{title:{default:c("Create Page")},content:{required:!0,type:String}},emits:["onPageCreated"],setup(e,{emit:t}){const a=e,n=t,s=V(!1),o=V(a.title),u=()=>{re.post("onboarding/create-page",{page_name:o.value,content:a.content}).then(A=>{n("onPageCreated",{value:A.page_id,label:`${o.value}( ${A.page_id})`,page_link:A.link}),o.value="",s.value=!1,q.success(c("The page created successfully."))}).catch(A=>{if(A&&A.hasOwnProperty("page_name")){const f=Object.entries(A.page_name).length;let m="",g=0;for(const y in A.page_name)m+=A.page_name[y],g!==f&&(m+=` |
| 152 |
`),g++;q.error(m)}else q.error(c("Sorry, Unable To Create Page!!"))})};return(A,f)=>{const m=C("el-input"),g=C("el-form-item"),y=C("el-form"),v=C("el-button"),B=C("el-dialog");return d(),_(H,null,[l(Oe,{onClick:f[0]||(f[0]=Xe(b=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:i(()=>[l(W,{name:"Plus"})]),_:1}),l(B,{modelValue:s.value,"onUpdate:modelValue":f[3]||(f[3]=b=>s.value=b),title:p(c)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:i(()=>[r("div",WF,[l(v,{onClick:f[2]||(f[2]=b=>s.value=!1),type:"info",soft:""},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(v,{type:"primary",onClick:u},{default:i(()=>[R(h(p(c)("Create Page")),1)]),_:1})])]),default:i(()=>[l(y,{"require-asterisk-position":"right","label-position":"top",onSubmit:Xe(u,["prevent"])},{default:i(()=>[l(g,{label:p(c)("Page Name"),required:""},{default:i(()=>[l(m,{modelValue:o.value,"onUpdate:modelValue":f[1]||(f[1]=b=>o.value=b),placeholder:p(c)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},JF={class:"fct-form-group"},ZF={class:"fct-form-group-inner"},eE={class:"input-prepend"},tE={class:"input-append"},aE={__name:"PageSelector",props:pn({title:{type:String,required:!0},pages:{type:Array,required:!0},modelId:{type:String,required:!0}},{modelValue:{},modelModifiers:{}}),emits:pn(["onPageCreated"],["update:modelValue"]),setup(e,{emit:t}){const a=kn(e,"modelValue",{get:u=>u?typeof u=="string"?Number(u):u:""}),n=t,s=V(!1),o=u=>{s.value=u};return(u,A)=>{const f=C("el-option"),m=C("el-select");return d(),_("div",JF,[r("label",null,h(e.title),1),r("div",ZF,[r("div",{class:de(["fct-input-group w-full",{focused:s.value}])},[r("div",eE,[l(m,{filterable:"",modelValue:a.value,"onUpdate:modelValue":A[0]||(A[0]=g=>a.value=g),onFocus:A[1]||(A[1]=g=>o(!0)),onBlur:A[2]||(A[2]=g=>o(!1)),placeholder:p(c)("Select"),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(e.pages,(g,y)=>(d(),E(f,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),r("div",tE,[l(XF,{title:e.title,onOnPageCreated:A[3]||(A[3]=g=>n("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},nE={class:"fct-onboarding-form-body-header"},sE={class:"left"},lE={class:"fct-onboarding-form-body-header__title"},oE={class:"fct-onboarding-form-body-header__desc"},rE={key:0,class:"fct-onboarding-form-body-header__action"},iE={__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,n=["checkout_page_id","cart_page_id","receipt_page_id","shop_page_id","customer_profile_page_id"],s={checkout_page_id:()=>c("Checkout"),cart_page_id:()=>c("Cart"),receipt_page_id:()=>c("Receipt"),shop_page_id:()=>c("Shop"),customer_profile_page_id:()=>c("Customer Profile")},o=V(Object.fromEntries(n.map(b=>[b,""])));ge(()=>a.initialSettings,b=>{if(a.savedFormData){n.forEach(w=>{o.value[w]=a.savedFormData[w]??""});return}b&&n.forEach(w=>{o.value[w]=b[w]??""})},{immediate:!0});const u=V(c("Select Pages")),A=V(c("Select the pages you'd like from your website")),f=V(!1),m=V(!1),g=()=>{m.value=!0,re.post("onboarding/create-pages",{}).then(b=>{n.forEach(w=>{var k;o.value[w]=String(((k=b.default_settings)==null?void 0:k[w])??"")}),f.value=!0,u.value=c("Existing Pages"),A.value=c("Select the pages you'd like from the list provided."),a.onPagesUpdated(b.pages)}).finally(()=>{m.value=!1})},y=(b,w)=>{o.value[w]=b.value,a.onPagesUpdated([...a.pages,b])};return t({onNextStep:async()=>{try{await re.post("onboarding/",{...o.value})}catch{}return!0},getFormData:()=>({...o.value})}),(b,w)=>{const k=C("el-button");return d(),_(H,null,[r("div",nE,[r("div",sE,[r("div",lE,h(u.value),1),r("div",oE,h(A.value),1)]),f.value?x("",!0):(d(),_("div",rE,[l(k,{onClick:g,loading:m.value},{default:i(()=>[m.value?x("",!0):(d(),E(W,{key:0,name:"MagicPen"})),R(" "+h(p(c)("Generate All Pages")),1)]),_:1},8,["loading"])]))]),(d(),_(H,null,ee(n,S=>r("div",{key:S,class:"fct-form-group"},[l(aE,{title:s[S](),pages:e.pages,modelId:S,modelValue:o.value[S],"onUpdate:modelValue":M=>o.value[S]=M,onOnPageCreated:y},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))],64)}}},dE={class:"fct-form-group"},uE={class:"marker"},cE={class:"label"},AE={class:"marker"},pE={__name:"OnboardingProductsStep",props:{dummyProductInfo:{type:Object,default:()=>({})}},setup(e,{expose:t}){const a=e,n=V("start-from-scratch"),s=(A=0)=>{if(!n.value||n.value==="start-from-scratch")return;const f=a.dummyProductInfo[n.value];!f||A>f.count-1||re.post("products/create-dummy",{category:f.category,index:A}).then(()=>{s(A+1)}).catch(m=>{m.status_code!==400&&s(A+1)})},o=()=>{if(n.value&&n.value!=="start-from-scratch"){const A=td.appendToVueUrl(null,{import_product:n.value});window.location.href=td.appendQueryParams(A);return}window.location.href=Ie.get("dashboard_url")};return t({onNextStep:async()=>{s();try{await re.post("onboarding/",{category:n.value})}catch{}return setTimeout(o,300),!1}}),(A,f)=>{const m=C("el-icon"),g=C("el-radio-button"),y=C("el-radio-group");return d(),_("div",dE,[l(y,{class:"fct-import-onboarding-products",modelValue:n.value,"onUpdate:modelValue":f[0]||(f[0]=v=>n.value=v),size:"large"},{default:i(()=>[l(g,{value:"start-from-scratch"},{default:i(()=>[l(W,{name:"Scratch"}),f[1]||(f[1]=r("span",{class:"label"},[R("Start "),r("br"),R("From scratch")],-1)),r("span",uE,[l(m,null,{default:i(()=>[l(p(dr))]),_:1})])]),_:1,__:[1]}),(d(!0),_(H,null,ee(e.dummyProductInfo,(v,B)=>(d(),E(g,{key:B,value:B},{default:i(()=>[l(W,{name:v.icon},null,8,["name"]),r("span",cE,h(v.title),1),r("span",AE,[l(m,null,{default:i(()=>[l(p(dr))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])}}},fE={class:"fct-onboarding-wrap"},mE={key:0,class:"fct-onboarding-card"},hE={class:"fct-onboarding-card-body"},_E={class:"fct-onboarding-content-box"},gE={class:"fct-onboarding-card-head"},vE={class:"fct-onboarding-card-head-top"},yE=["src","alt"],bE={class:"fct-onboarding-steps-count"},wE={class:"fct-onboarding-card-title"},CE={class:"fct-onboarding-card-text"},BE={class:"fct-onboarding-content-box-inner"},kE={key:0,class:"fct-onboarding-load-error"},xE={key:1,class:"fct-onboarding-form-wrap active"},SE={class:"fct-onboarding-form-body"},FE={key:0,class:"fct-onboarding-bottom"},EE={class:"fct-onboarding-bottom-left"},UE={class:"fct-onboarding-bottom-right"},$E={key:0,class:"cmd"},DE={__name:"Onboarding",setup(e){const t=V(!1),a=V([]),n=V({}),s=V([]),o=V([]),u=V(null),A=V(null),f=V(null),m=V(null),g=V(null),y=V(""),v=j(()=>{if(!y.value)return"";const oe=s.value.find(Z=>Z.value===y.value);return oe?oe.name:y.value}),B=[{key:"store-info",title:()=>c("Welcome aboard! Let's create your online store."),component:fF,props:()=>({savedFormData:f.value,initialSettings:u.value,countries:s.value,currencies:n.value,onStoreCountryChanged:oe=>{y.value=oe}})},{key:"tax",title:()=>c("Set Up Tax Collection"),component:qF,canSkip:!0,props:()=>({savedFormData:m.value,storeCountry:y.value,countryName:v.value,initialTaxSettings:A.value})},{key:"pages",title:()=>c("Setup Your Pages"),component:iE,props:()=>({pages:a.value,initialSettings:u.value,savedFormData:g.value,onPagesUpdated:oe=>{a.value=oe}})},{key:"products",title:()=>c("Setup Your Products"),component:pE,isFinal:!0,props:()=>({dummyProductInfo:o.value})}],b=B.length+1,w=V(1),k=j(()=>B[w.value-1]),S=j(()=>{var oe;return((oe=k.value)==null?void 0:oe.title())??""}),M=V(null),$=V(!1),F=()=>{w.value++},L=()=>{var Z,le;const oe=(le=(Z=M.value)==null?void 0:Z.getFormData)==null?void 0:le.call(Z);oe&&(k.value.key==="store-info"?f.value=oe:k.value.key==="tax"?m.value=oe:k.value.key==="pages"&&(g.value=oe))},Q=async()=>{var oe,Z;if(!$.value){$.value=!0;try{L(),await((Z=(oe=M.value)==null?void 0:oe.onNextStep)==null?void 0:Z.call(oe))!==!1&&F()}finally{$.value=!1}}},T=()=>{var oe,Z;L(),(Z=(oe=M.value)==null?void 0:oe.onPreviousStep)==null||Z.call(oe),w.value>1&&w.value--},D=()=>{F()},U=()=>{var oe,Z;(Z=(oe=M.value)==null?void 0:oe.onSkipAll)==null||Z.call(oe),window.location.href=Ie.get("dashboard_url")};xs().onSave(()=>{var oe;(oe=k.value)!=null&&oe.isFinal&&Q()});const O=V(!1),P=()=>{t.value=!0,O.value=!1,re.get("onboarding/").then(oe=>{var Z;a.value=oe.pages,n.value=oe.currencies,u.value=oe.default_settings,y.value=((Z=oe.default_settings)==null?void 0:Z.store_country)??"",A.value=oe.tax_settings??null}).catch(()=>{O.value=!0}).finally(()=>{t.value=!1})},K=()=>{re.get("address-info/countries").then(oe=>{s.value=oe.data})},G=Ps.getUrl("images/logo/logo-full-dark.svg"),ne=Ps.getUrl("images/logo/logo-full.svg"),Y=V(Ie.get("asset_url")+"/images/logo/logo-full-dark.svg"),N=()=>{Y.value=ke.isDark()?ne:G};return Be(()=>{window.addEventListener("onFluentCartThemeChange",N),o.value=Ie.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),Y.value=ke.isDark()?ne:G,P(),K()}),At(()=>{window.removeEventListener("onFluentCartThemeChange",N),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(oe,Z)=>{const le=C("el-progress"),te=C("el-button"),X=Ca("loading");return d(),_(H,null,[r("div",fE,[w.value<b?(d(),_("div",mE,[Dt((d(),_("div",hE,[r("div",_E,[r("div",gE,[r("div",vE,[r("img",{src:Y.value,alt:p(c)("Fluent Cart")},null,8,yE),r("div",bE,h(p(c)("Step %1$s of %2$s",w.value,B.length)),1),l(le,{percentage:w.value/B.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),r("h2",wE,h(S.value),1),r("p",CE,h(p(c)("You've successfully Installed The Plugin.")),1)]),r("div",BE,[O.value?(d(),_("div",kE,[r("p",null,h(p(c)("Failed to load settings. Please refresh and try again.")),1),l(te,{onClick:P},{default:i(()=>[R(h(p(c)("Retry")),1)]),_:1})])):(d(),_("div",xE,[r("div",SE,[(d(),E(bn(k.value.component),la({key:k.value.key,ref_key:"stepRef",ref:M},k.value.props()),null,16))])]))])])])),[[X,t.value]])])):x("",!0)]),w.value<b?(d(),_("div",FE,[r("div",EE,[w.value>1?(d(),E(te,{key:0,text:"",onClick:U},{default:i(()=>[R(h(p(c)("Skip All")),1)]),_:1})):x("",!0)]),r("div",UE,[l(te,{onClick:T,type:"info",plain:"",disabled:w.value===1},{default:i(()=>[R(h(p(c)("Go Back")),1)]),_:1},8,["disabled"]),k.value.canSkip?(d(),E(te,{key:0,text:"",onClick:D,disabled:$.value},{default:i(()=>[R(h(p(c)("Skip for now")),1)]),_:1},8,["disabled"])):x("",!0),k.value.isFinal?(d(),E(te,{key:2,type:"primary",loading:$.value,onClick:Q},{default:i(()=>[$.value?x("",!0):(d(),_("span",$E,"⌘s")),R(" "+h($.value?p(c)("Saving"):p(c)("Save")),1)]),_:1},8,["loading"])):(d(),E(te,{key:1,type:"primary",loading:$.value,disabled:O.value,onClick:Q},{default:i(()=>[R(h(p(c)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):x("",!0)],64)}}},QE={class:"fct-orders-route-wrap"},IE=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const n=C("router-view");return d(),_("div",QE,[l(n)])}}});/*! |
| 153 |
* vue-draggable-next v2.2.0 |
| 154 |
* (c) 2023 Anish George |
| 155 |
* @license MIT |
| 156 |
*//**! |
| 157 |
* Sortable 1.14.0 |
| 158 |
* @author RubaXa <[email protected]> |
| 159 |
* @author owenm <[email protected]> |
| 160 |
* @license MIT |
| 161 |
*/function dA(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),a.push.apply(a,n)}return a}function Nn(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?dA(Object(a),!0).forEach(function(n){TE(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):dA(Object(a)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function tr(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?tr=function(t){return typeof t}:tr=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tr(e)}function TE(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function ns(){return ns=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ns.apply(this,arguments)}function VE(e,t){if(e==null)return{};var a={},n=Object.keys(e),s,o;for(o=0;o<n.length;o++)s=n[o],!(t.indexOf(s)>=0)&&(a[s]=e[s]);return a}function ME(e,t){if(e==null)return{};var a=VE(e,t),n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)n=o[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var LE="1.14.0";function es(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var ls=es(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),mo=es(/Edge/i),uA=es(/firefox/i),Xl=es(/safari/i)&&!es(/chrome/i)&&!es(/android/i),Of=es(/iP(ad|od|hone)/i),RE=es(/chrome/i)&&es(/android/i),Hf={capture:!1,passive:!1};function Tt(e,t,a){e.addEventListener(t,a,!ls&&Hf)}function $t(e,t,a){e.removeEventListener(t,a,!ls&&Hf)}function Cr(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function OE(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Ln(e,t,a,n){if(e){a=a||document;do{if(t!=null&&(t[0]===">"?e.parentNode===a&&Cr(e,t):Cr(e,t))||n&&e===a)return e;if(e===a)break}while(e=OE(e))}return null}var cA=/\s+/g;function ln(e,t,a){if(e&&t)if(e.classList)e.classList[a?"add":"remove"](t);else{var n=(" "+e.className+" ").replace(cA," ").replace(" "+t+" "," ");e.className=(n+(a?" "+t:"")).replace(cA," ")}}function dt(e,t,a){var n=e&&e.style;if(n){if(a===void 0)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(a=e.currentStyle),t===void 0?a:a[t];!(t in n)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),n[t]=a+(typeof a=="string"?"":"px")}}function vl(e,t){var a="";if(typeof e=="string")a=e;else do{var n=dt(e,"transform");n&&n!=="none"&&(a=n+" "+a)}while(!t&&(e=e.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(a)}function Pf(e,t,a){if(e){var n=e.getElementsByTagName(t),s=0,o=n.length;if(a)for(;s<o;s++)a(n[s],s);return n}return[]}function Pn(){var e=document.scrollingElement;return e||document.documentElement}function ka(e,t,a,n,s){if(!(!e.getBoundingClientRect&&e!==window)){var o,u,A,f,m,g,y;if(e!==window&&e.parentNode&&e!==Pn()?(o=e.getBoundingClientRect(),u=o.top,A=o.left,f=o.bottom,m=o.right,g=o.height,y=o.width):(u=0,A=0,f=window.innerHeight,m=window.innerWidth,g=window.innerHeight,y=window.innerWidth),(t||a)&&e!==window&&(s=s||e.parentNode,!ls))do if(s&&s.getBoundingClientRect&&(dt(s,"transform")!=="none"||a&&dt(s,"position")!=="static")){var v=s.getBoundingClientRect();u-=v.top+parseInt(dt(s,"border-top-width")),A-=v.left+parseInt(dt(s,"border-left-width")),f=u+o.height,m=A+o.width;break}while(s=s.parentNode);if(n&&e!==window){var B=vl(s||e),b=B&&B.a,w=B&&B.d;B&&(u/=w,A/=b,y/=b,g/=w,f=u+g,m=A+y)}return{top:u,left:A,bottom:f,right:m,width:y,height:g}}}function AA(e,t,a){for(var n=_s(e,!0),s=ka(e)[t];n;){var o=ka(n)[a],u=void 0;if(u=s>=o,!u)return n;if(n===Pn())break;n=_s(n,!1)}return!1}function Cl(e,t,a,n){for(var s=0,o=0,u=e.children;o<u.length;){if(u[o].style.display!=="none"&&u[o]!==ut.ghost&&(n||u[o]!==ut.dragged)&&Ln(u[o],a.draggable,e,!1)){if(s===t)return u[o];s++}o++}return null}function Cu(e,t){for(var a=e.lastElementChild;a&&(a===ut.ghost||dt(a,"display")==="none"||t&&!Cr(a,t));)a=a.previousElementSibling;return a||null}function _n(e,t){var a=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==ut.clone&&(!t||Cr(e,t))&&a++;return a}function pA(e){var t=0,a=0,n=Pn();if(e)do{var s=vl(e),o=s.a,u=s.d;t+=e.scrollLeft*o,a+=e.scrollTop*u}while(e!==n&&(e=e.parentNode));return[t,a]}function HE(e,t){for(var a in e)if(e.hasOwnProperty(a)){for(var n in t)if(t.hasOwnProperty(n)&&t[n]===e[a][n])return Number(a)}return-1}function _s(e,t){if(!e||!e.getBoundingClientRect)return Pn();var a=e,n=!1;do if(a.clientWidth<a.scrollWidth||a.clientHeight<a.scrollHeight){var s=dt(a);if(a.clientWidth<a.scrollWidth&&(s.overflowX=="auto"||s.overflowX=="scroll")||a.clientHeight<a.scrollHeight&&(s.overflowY=="auto"||s.overflowY=="scroll")){if(!a.getBoundingClientRect||a===document.body)return Pn();if(n||t)return a;n=!0}}while(a=a.parentNode);return Pn()}function PE(e,t){if(e&&t)for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);return e}function Mi(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}var Jl;function Nf(e,t){return function(){if(!Jl){var a=arguments,n=this;a.length===1?e.call(n,a[0]):e.apply(n,a),Jl=setTimeout(function(){Jl=void 0},t)}}}function NE(){clearTimeout(Jl),Jl=void 0}function Kf(e,t,a){e.scrollLeft+=t,e.scrollTop+=a}function Gf(e){var t=window.Polymer,a=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):a?a(e).clone(!0)[0]:e.cloneNode(!0)}var cn="Sortable"+new Date().getTime();function KE(){var e=[],t;return{captureAnimationState:function(){if(e=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(s){if(!(dt(s,"display")==="none"||s===ut.ghost)){e.push({target:s,rect:ka(s)});var o=Nn({},e[e.length-1].rect);if(s.thisAnimationDuration){var u=vl(s,!0);u&&(o.top-=u.f,o.left-=u.e)}s.fromRect=o}})}},addAnimationState:function(n){e.push(n)},removeAnimationState:function(n){e.splice(HE(e,{target:n}),1)},animateAll:function(n){var s=this;if(!this.options.animation){clearTimeout(t),typeof n=="function"&&n();return}var o=!1,u=0;e.forEach(function(A){var f=0,m=A.target,g=m.fromRect,y=ka(m),v=m.prevFromRect,B=m.prevToRect,b=A.rect,w=vl(m,!0);w&&(y.top-=w.f,y.left-=w.e),m.toRect=y,m.thisAnimationDuration&&Mi(v,y)&&!Mi(g,y)&&(b.top-y.top)/(b.left-y.left)===(g.top-y.top)/(g.left-y.left)&&(f=jE(b,v,B,s.options)),Mi(y,g)||(m.prevFromRect=g,m.prevToRect=y,f||(f=s.options.animation),s.animate(m,b,y,f)),f&&(o=!0,u=Math.max(u,f),clearTimeout(m.animationResetTimer),m.animationResetTimer=setTimeout(function(){m.animationTime=0,m.prevFromRect=null,m.fromRect=null,m.prevToRect=null,m.thisAnimationDuration=null},f),m.thisAnimationDuration=f)}),clearTimeout(t),o?t=setTimeout(function(){typeof n=="function"&&n()},u):typeof n=="function"&&n(),e=[]},animate:function(n,s,o,u){if(u){dt(n,"transition",""),dt(n,"transform","");var A=vl(this.el),f=A&&A.a,m=A&&A.d,g=(s.left-o.left)/(f||1),y=(s.top-o.top)/(m||1);n.animatingX=!!g,n.animatingY=!!y,dt(n,"transform","translate3d("+g+"px,"+y+"px,0)"),this.forRepaintDummy=GE(n),dt(n,"transition","transform "+u+"ms"+(this.options.easing?" "+this.options.easing:"")),dt(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){dt(n,"transition",""),dt(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},u)}}}}function GE(e){return e.offsetWidth}function jE(e,t,a,n){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-a.top,2)+Math.pow(t.left-a.left,2))*n.animation}var sl=[],Li={initializeByDefault:!0},ho={mount:function(t){for(var a in Li)Li.hasOwnProperty(a)&&!(a in t)&&(t[a]=Li[a]);sl.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),sl.push(t)},pluginEvent:function(t,a,n){var s=this;this.eventCanceled=!1,n.cancel=function(){s.eventCanceled=!0};var o=t+"Global";sl.forEach(function(u){a[u.pluginName]&&(a[u.pluginName][o]&&a[u.pluginName][o](Nn({sortable:a},n)),a.options[u.pluginName]&&a[u.pluginName][t]&&a[u.pluginName][t](Nn({sortable:a},n)))})},initializePlugins:function(t,a,n,s){sl.forEach(function(A){var f=A.pluginName;if(!(!t.options[f]&&!A.initializeByDefault)){var m=new A(t,a,t.options);m.sortable=t,m.options=t.options,t[f]=m,ns(n,m.defaults)}});for(var o in t.options)if(t.options.hasOwnProperty(o)){var u=this.modifyOption(t,o,t.options[o]);typeof u<"u"&&(t.options[o]=u)}},getEventProperties:function(t,a){var n={};return sl.forEach(function(s){typeof s.eventProperties=="function"&&ns(n,s.eventProperties.call(a[s.pluginName],t))}),n},modifyOption:function(t,a,n){var s;return sl.forEach(function(o){t[o.pluginName]&&o.optionListeners&&typeof o.optionListeners[a]=="function"&&(s=o.optionListeners[a].call(t[o.pluginName],n))}),s}};function zE(e){var t=e.sortable,a=e.rootEl,n=e.name,s=e.targetEl,o=e.cloneEl,u=e.toEl,A=e.fromEl,f=e.oldIndex,m=e.newIndex,g=e.oldDraggableIndex,y=e.newDraggableIndex,v=e.originalEvent,B=e.putSortable,b=e.extraEventProperties;if(t=t||a&&a[cn],!!t){var w,k=t.options,S="on"+n.charAt(0).toUpperCase()+n.substr(1);window.CustomEvent&&!ls&&!mo?w=new CustomEvent(n,{bubbles:!0,cancelable:!0}):(w=document.createEvent("Event"),w.initEvent(n,!0,!0)),w.to=u||a,w.from=A||a,w.item=s||a,w.clone=o,w.oldIndex=f,w.newIndex=m,w.oldDraggableIndex=g,w.newDraggableIndex=y,w.originalEvent=v,w.pullMode=B?B.lastPutMode:void 0;var M=Nn(Nn({},b),ho.getEventProperties(n,t));for(var $ in M)w[$]=M[$];a&&a.dispatchEvent(w),k[S]&&k[S].call(t,w)}}var YE=["evt"],Wa=function(t,a){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=n.evt,o=ME(n,YE);ho.pluginEvent.bind(ut)(t,a,Nn({dragEl:Qe,parentEl:ca,ghostEl:mt,rootEl:ta,nextEl:Qs,lastDownEl:ar,cloneEl:Aa,cloneHidden:ps,dragStarted:Hl,putSortable:Qa,activeSortable:ut.active,originalEvent:s,oldIndex:ml,oldDraggableIndex:Zl,newIndex:on,newDraggableIndex:As,hideGhostForTarget:qf,unhideGhostForTarget:Wf,cloneNowHidden:function(){ps=!0},cloneNowShown:function(){ps=!1},dispatchSortableEvent:function(A){Ka({sortable:a,name:A,originalEvent:s})}},o))};function Ka(e){zE(Nn({putSortable:Qa,cloneEl:Aa,targetEl:Qe,rootEl:ta,oldIndex:ml,oldDraggableIndex:Zl,newIndex:on,newDraggableIndex:As},e))}var Qe,ca,mt,ta,Qs,ar,Aa,ps,ml,on,Zl,As,No,Qa,Al=!1,Br=!1,kr=[],$s,En,Ri,Oi,fA,mA,Hl,ll,eo,to=!1,Ko=!1,nr,La,Hi=[],Ud=!1,xr=[],ri=typeof document<"u",Go=Of,hA=mo||ls?"cssFloat":"float",qE=ri&&!RE&&!Of&&"draggable"in document.createElement("div"),jf=function(){if(ri){if(ls)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),zf=function(t,a){var n=dt(t),s=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Cl(t,0,a),u=Cl(t,1,a),A=o&&dt(o),f=u&&dt(u),m=A&&parseInt(A.marginLeft)+parseInt(A.marginRight)+ka(o).width,g=f&&parseInt(f.marginLeft)+parseInt(f.marginRight)+ka(u).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&A.float&&A.float!=="none"){var y=A.float==="left"?"left":"right";return u&&(f.clear==="both"||f.clear===y)?"vertical":"horizontal"}return o&&(A.display==="block"||A.display==="flex"||A.display==="table"||A.display==="grid"||m>=s&&n[hA]==="none"||u&&n[hA]==="none"&&m+g>s)?"vertical":"horizontal"},WE=function(t,a,n){var s=n?t.left:t.top,o=n?t.right:t.bottom,u=n?t.width:t.height,A=n?a.left:a.top,f=n?a.right:a.bottom,m=n?a.width:a.height;return s===A||o===f||s+u/2===A+m/2},XE=function(t,a){var n;return kr.some(function(s){var o=s[cn].options.emptyInsertThreshold;if(!(!o||Cu(s))){var u=ka(s),A=t>=u.left-o&&t<=u.right+o,f=a>=u.top-o&&a<=u.bottom+o;if(A&&f)return n=s}}),n},Yf=function(t){function a(o,u){return function(A,f,m,g){var y=A.options.group.name&&f.options.group.name&&A.options.group.name===f.options.group.name;if(o==null&&(u||y))return!0;if(o==null||o===!1)return!1;if(u&&o==="clone")return o;if(typeof o=="function")return a(o(A,f,m,g),u)(A,f,m,g);var v=(u?A:f).options.group.name;return o===!0||typeof o=="string"&&o===v||o.join&&o.indexOf(v)>-1}}var n={},s=t.group;(!s||tr(s)!="object")&&(s={name:s}),n.name=s.name,n.checkPull=a(s.pull,!0),n.checkPut=a(s.put),n.revertClone=s.revertClone,t.group=n},qf=function(){!jf&&mt&&dt(mt,"display","none")},Wf=function(){!jf&&mt&&dt(mt,"display","")};ri&&document.addEventListener("click",function(e){if(Br)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Br=!1,!1},!0);var Ds=function(t){if(Qe){t=t.touches?t.touches[0]:t;var a=XE(t.clientX,t.clientY);if(a){var n={};for(var s in t)t.hasOwnProperty(s)&&(n[s]=t[s]);n.target=n.rootEl=a,n.preventDefault=void 0,n.stopPropagation=void 0,a[cn]._onDragOver(n)}}},JE=function(t){Qe&&Qe.parentNode[cn]._isOutsideThisEl(t.target)};function ut(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=ns({},t),e[cn]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return zf(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(u,A){u.setData("Text",A.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:ut.supportPointer!==!1&&"PointerEvent"in window&&!Xl,emptyInsertThreshold:5};ho.initializePlugins(this,e,a);for(var n in a)!(n in t)&&(t[n]=a[n]);Yf(t);for(var s in this)s.charAt(0)==="_"&&typeof this[s]=="function"&&(this[s]=this[s].bind(this));this.nativeDraggable=t.forceFallback?!1:qE,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Tt(e,"pointerdown",this._onTapStart):(Tt(e,"mousedown",this._onTapStart),Tt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Tt(e,"dragover",this),Tt(e,"dragenter",this)),kr.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ns(this,KE())}ut.prototype={constructor:ut,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(ll=null)},_getDirection:function(t,a){return typeof this.options.direction=="function"?this.options.direction.call(this,t,a,Qe):this.options.direction},_onTapStart:function(t){if(t.cancelable){var a=this,n=this.el,s=this.options,o=s.preventOnFilter,u=t.type,A=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,f=(A||t).target,m=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||f,g=s.filter;if(oU(n),!Qe&&!(/mousedown|pointerdown/.test(u)&&t.button!==0||s.disabled)&&!m.isContentEditable&&!(!this.nativeDraggable&&Xl&&f&&f.tagName.toUpperCase()==="SELECT")&&(f=Ln(f,s.draggable,n,!1),!(f&&f.animated)&&ar!==f)){if(ml=_n(f),Zl=_n(f,s.draggable),typeof g=="function"){if(g.call(this,t,f,this)){Ka({sortable:a,rootEl:m,name:"filter",targetEl:f,toEl:n,fromEl:n}),Wa("filter",a,{evt:t}),o&&t.cancelable&&t.preventDefault();return}}else if(g&&(g=g.split(",").some(function(y){if(y=Ln(m,y.trim(),n,!1),y)return Ka({sortable:a,rootEl:y,name:"filter",targetEl:f,fromEl:n,toEl:n}),Wa("filter",a,{evt:t}),!0}),g)){o&&t.cancelable&&t.preventDefault();return}s.handle&&!Ln(m,s.handle,n,!1)||this._prepareDragStart(t,A,f)}}},_prepareDragStart:function(t,a,n){var s=this,o=s.el,u=s.options,A=o.ownerDocument,f;if(n&&!Qe&&n.parentNode===o){var m=ka(n);if(ta=o,Qe=n,ca=Qe.parentNode,Qs=Qe.nextSibling,ar=n,No=u.group,ut.dragged=Qe,$s={target:Qe,clientX:(a||t).clientX,clientY:(a||t).clientY},fA=$s.clientX-m.left,mA=$s.clientY-m.top,this._lastX=(a||t).clientX,this._lastY=(a||t).clientY,Qe.style["will-change"]="all",f=function(){if(Wa("delayEnded",s,{evt:t}),ut.eventCanceled){s._onDrop();return}s._disableDelayedDragEvents(),!uA&&s.nativeDraggable&&(Qe.draggable=!0),s._triggerDragStart(t,a),Ka({sortable:s,name:"choose",originalEvent:t}),ln(Qe,u.chosenClass,!0)},u.ignore.split(",").forEach(function(g){Pf(Qe,g.trim(),Pi)}),Tt(A,"dragover",Ds),Tt(A,"mousemove",Ds),Tt(A,"touchmove",Ds),Tt(A,"mouseup",s._onDrop),Tt(A,"touchend",s._onDrop),Tt(A,"touchcancel",s._onDrop),uA&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Qe.draggable=!0),Wa("delayStart",this,{evt:t}),u.delay&&(!u.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(mo||ls))){if(ut.eventCanceled){this._onDrop();return}Tt(A,"mouseup",s._disableDelayedDrag),Tt(A,"touchend",s._disableDelayedDrag),Tt(A,"touchcancel",s._disableDelayedDrag),Tt(A,"mousemove",s._delayedDragTouchMoveHandler),Tt(A,"touchmove",s._delayedDragTouchMoveHandler),u.supportPointer&&Tt(A,"pointermove",s._delayedDragTouchMoveHandler),s._dragStartTimer=setTimeout(f,u.delay)}else f()}},_delayedDragTouchMoveHandler:function(t){var a=t.touches?t.touches[0]:t;Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Qe&&Pi(Qe),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;$t(t,"mouseup",this._disableDelayedDrag),$t(t,"touchend",this._disableDelayedDrag),$t(t,"touchcancel",this._disableDelayedDrag),$t(t,"mousemove",this._delayedDragTouchMoveHandler),$t(t,"touchmove",this._delayedDragTouchMoveHandler),$t(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,a){a=a||t.pointerType=="touch"&&t,!this.nativeDraggable||a?this.options.supportPointer?Tt(document,"pointermove",this._onTouchMove):a?Tt(document,"touchmove",this._onTouchMove):Tt(document,"mousemove",this._onTouchMove):(Tt(Qe,"dragend",this),Tt(ta,"dragstart",this._onDragStart));try{document.selection?sr(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,a){if(Al=!1,ta&&Qe){Wa("dragStarted",this,{evt:a}),this.nativeDraggable&&Tt(document,"dragover",JE);var n=this.options;!t&&ln(Qe,n.dragClass,!1),ln(Qe,n.ghostClass,!0),ut.active=this,t&&this._appendGhost(),Ka({sortable:this,name:"start",originalEvent:a})}else this._nulling()},_emulateDragOver:function(){if(En){this._lastX=En.clientX,this._lastY=En.clientY,qf();for(var t=document.elementFromPoint(En.clientX,En.clientY),a=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(En.clientX,En.clientY),t!==a);)a=t;if(Qe.parentNode[cn]._isOutsideThisEl(t),a)do{if(a[cn]){var n=void 0;if(n=a[cn]._onDragOver({clientX:En.clientX,clientY:En.clientY,target:t,rootEl:a}),n&&!this.options.dragoverBubble)break}t=a}while(a=a.parentNode);Wf()}},_onTouchMove:function(t){if($s){var a=this.options,n=a.fallbackTolerance,s=a.fallbackOffset,o=t.touches?t.touches[0]:t,u=mt&&vl(mt,!0),A=mt&&u&&u.a,f=mt&&u&&u.d,m=Go&&La&&pA(La),g=(o.clientX-$s.clientX+s.x)/(A||1)+(m?m[0]-Hi[0]:0)/(A||1),y=(o.clientY-$s.clientY+s.y)/(f||1)+(m?m[1]-Hi[1]:0)/(f||1);if(!ut.active&&!Al){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(mt){u?(u.e+=g-(Ri||0),u.f+=y-(Oi||0)):u={a:1,b:0,c:0,d:1,e:g,f:y};var v="matrix(".concat(u.a,",").concat(u.b,",").concat(u.c,",").concat(u.d,",").concat(u.e,",").concat(u.f,")");dt(mt,"webkitTransform",v),dt(mt,"mozTransform",v),dt(mt,"msTransform",v),dt(mt,"transform",v),Ri=g,Oi=y,En=o}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!mt){var t=this.options.fallbackOnBody?document.body:ta,a=ka(Qe,!0,Go,!0,t),n=this.options;if(Go){for(La=t;dt(La,"position")==="static"&&dt(La,"transform")==="none"&&La!==document;)La=La.parentNode;La!==document.body&&La!==document.documentElement?(La===document&&(La=Pn()),a.top+=La.scrollTop,a.left+=La.scrollLeft):La=Pn(),Hi=pA(La)}mt=Qe.cloneNode(!0),ln(mt,n.ghostClass,!1),ln(mt,n.fallbackClass,!0),ln(mt,n.dragClass,!0),dt(mt,"transition",""),dt(mt,"transform",""),dt(mt,"box-sizing","border-box"),dt(mt,"margin",0),dt(mt,"top",a.top),dt(mt,"left",a.left),dt(mt,"width",a.width),dt(mt,"height",a.height),dt(mt,"opacity","0.8"),dt(mt,"position",Go?"absolute":"fixed"),dt(mt,"zIndex","100000"),dt(mt,"pointerEvents","none"),ut.ghost=mt,t.appendChild(mt),dt(mt,"transform-origin",fA/parseInt(mt.style.width)*100+"% "+mA/parseInt(mt.style.height)*100+"%")}},_onDragStart:function(t,a){var n=this,s=t.dataTransfer,o=n.options;if(Wa("dragStart",this,{evt:t}),ut.eventCanceled){this._onDrop();return}Wa("setupClone",this),ut.eventCanceled||(Aa=Gf(Qe),Aa.draggable=!1,Aa.style["will-change"]="",this._hideClone(),ln(Aa,this.options.chosenClass,!1),ut.clone=Aa),n.cloneId=sr(function(){Wa("clone",n),!ut.eventCanceled&&(n.options.removeCloneOnHide||ta.insertBefore(Aa,Qe),n._hideClone(),Ka({sortable:n,name:"clone"}))}),!a&&ln(Qe,o.dragClass,!0),a?(Br=!0,n._loopId=setInterval(n._emulateDragOver,50)):($t(document,"mouseup",n._onDrop),$t(document,"touchend",n._onDrop),$t(document,"touchcancel",n._onDrop),s&&(s.effectAllowed="move",o.setData&&o.setData.call(n,s,Qe)),Tt(document,"drop",n),dt(Qe,"transform","translateZ(0)")),Al=!0,n._dragStartId=sr(n._dragStarted.bind(n,a,t)),Tt(document,"selectstart",n),Hl=!0,Xl&&dt(document.body,"user-select","none")},_onDragOver:function(t){var a=this.el,n=t.target,s,o,u,A=this.options,f=A.group,m=ut.active,g=No===f,y=A.sort,v=Qa||m,B,b=this,w=!1;if(Ud)return;function k(oe,Z){Wa(oe,b,Nn({evt:t,isOwner:g,axis:B?"vertical":"horizontal",revert:u,dragRect:s,targetRect:o,canSort:y,fromSortable:v,target:n,completed:M,onMove:function(te,X){return jo(ta,a,Qe,s,te,ka(te),t,X)},changed:$},Z))}function S(){k("dragOverAnimationCapture"),b.captureAnimationState(),b!==v&&v.captureAnimationState()}function M(oe){return k("dragOverCompleted",{insertion:oe}),oe&&(g?m._hideClone():m._showClone(b),b!==v&&(ln(Qe,Qa?Qa.options.ghostClass:m.options.ghostClass,!1),ln(Qe,A.ghostClass,!0)),Qa!==b&&b!==ut.active?Qa=b:b===ut.active&&Qa&&(Qa=null),v===b&&(b._ignoreWhileAnimating=n),b.animateAll(function(){k("dragOverAnimationComplete"),b._ignoreWhileAnimating=null}),b!==v&&(v.animateAll(),v._ignoreWhileAnimating=null)),(n===Qe&&!Qe.animated||n===a&&!n.animated)&&(ll=null),!A.dragoverBubble&&!t.rootEl&&n!==document&&(Qe.parentNode[cn]._isOutsideThisEl(t.target),!oe&&Ds(t)),!A.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),w=!0}function $(){on=_n(Qe),As=_n(Qe,A.draggable),Ka({sortable:b,name:"change",toEl:a,newIndex:on,newDraggableIndex:As,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=Ln(n,A.draggable,a,!0),k("dragOver"),ut.eventCanceled)return w;if(Qe.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||b._ignoreWhileAnimating===n)return M(!1);if(Br=!1,m&&!A.disabled&&(g?y||(u=ca!==ta):Qa===this||(this.lastPutMode=No.checkPull(this,m,Qe,t))&&f.checkPut(this,m,Qe,t))){if(B=this._getDirection(t,n)==="vertical",s=ka(Qe),k("dragOverValid"),ut.eventCanceled)return w;if(u)return ca=ta,S(),this._hideClone(),k("revert"),ut.eventCanceled||(Qs?ta.insertBefore(Qe,Qs):ta.appendChild(Qe)),M(!0);var F=Cu(a,A.draggable);if(!F||aU(t,B,this)&&!F.animated){if(F===Qe)return M(!1);if(F&&a===t.target&&(n=F),n&&(o=ka(n)),jo(ta,a,Qe,s,n,o,t,!!n)!==!1)return S(),a.appendChild(Qe),ca=a,$(),M(!0)}else if(F&&tU(t,B,this)){var L=Cl(a,0,A,!0);if(L===Qe)return M(!1);if(n=L,o=ka(n),jo(ta,a,Qe,s,n,o,t,!1)!==!1)return S(),a.insertBefore(Qe,L),ca=a,$(),M(!0)}else if(n.parentNode===a){o=ka(n);var Q=0,T,D=Qe.parentNode!==a,U=!WE(Qe.animated&&Qe.toRect||s,n.animated&&n.toRect||o,B),I=B?"top":"left",O=AA(n,"top","top")||AA(Qe,"top","top"),P=O?O.scrollTop:void 0;ll!==n&&(T=o[I],to=!1,Ko=!U&&A.invertSwap||D),Q=nU(t,n,o,B,U?1:A.swapThreshold,A.invertedSwapThreshold==null?A.swapThreshold:A.invertedSwapThreshold,Ko,ll===n);var K;if(Q!==0){var G=_n(Qe);do G-=Q,K=ca.children[G];while(K&&(dt(K,"display")==="none"||K===mt))}if(Q===0||K===n)return M(!1);ll=n,eo=Q;var ne=n.nextElementSibling,Y=!1;Y=Q===1;var N=jo(ta,a,Qe,s,n,o,t,Y);if(N!==!1)return(N===1||N===-1)&&(Y=N===1),Ud=!0,setTimeout(eU,30),S(),Y&&!ne?a.appendChild(Qe):n.parentNode.insertBefore(Qe,Y?ne:n),O&&Kf(O,0,P-O.scrollTop),ca=Qe.parentNode,T!==void 0&&!Ko&&(nr=Math.abs(T-ka(n)[I])),$(),M(!0)}if(a.contains(Qe))return M(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){$t(document,"mousemove",this._onTouchMove),$t(document,"touchmove",this._onTouchMove),$t(document,"pointermove",this._onTouchMove),$t(document,"dragover",Ds),$t(document,"mousemove",Ds),$t(document,"touchmove",Ds)},_offUpEvents:function(){var t=this.el.ownerDocument;$t(t,"mouseup",this._onDrop),$t(t,"touchend",this._onDrop),$t(t,"pointerup",this._onDrop),$t(t,"touchcancel",this._onDrop),$t(document,"selectstart",this)},_onDrop:function(t){var a=this.el,n=this.options;if(on=_n(Qe),As=_n(Qe,n.draggable),Wa("drop",this,{evt:t}),ca=Qe&&Qe.parentNode,on=_n(Qe),As=_n(Qe,n.draggable),ut.eventCanceled){this._nulling();return}Al=!1,Ko=!1,to=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),$d(this.cloneId),$d(this._dragStartId),this.nativeDraggable&&($t(document,"drop",this),$t(a,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Xl&&dt(document.body,"user-select",""),dt(Qe,"transform",""),t&&(Hl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),mt&&mt.parentNode&&mt.parentNode.removeChild(mt),(ta===ca||Qa&&Qa.lastPutMode!=="clone")&&Aa&&Aa.parentNode&&Aa.parentNode.removeChild(Aa),Qe&&(this.nativeDraggable&&$t(Qe,"dragend",this),Pi(Qe),Qe.style["will-change"]="",Hl&&!Al&&ln(Qe,Qa?Qa.options.ghostClass:this.options.ghostClass,!1),ln(Qe,this.options.chosenClass,!1),Ka({sortable:this,name:"unchoose",toEl:ca,newIndex:null,newDraggableIndex:null,originalEvent:t}),ta!==ca?(on>=0&&(Ka({rootEl:ca,name:"add",toEl:ca,fromEl:ta,originalEvent:t}),Ka({sortable:this,name:"remove",toEl:ca,originalEvent:t}),Ka({rootEl:ca,name:"sort",toEl:ca,fromEl:ta,originalEvent:t}),Ka({sortable:this,name:"sort",toEl:ca,originalEvent:t})),Qa&&Qa.save()):on!==ml&&on>=0&&(Ka({sortable:this,name:"update",toEl:ca,originalEvent:t}),Ka({sortable:this,name:"sort",toEl:ca,originalEvent:t})),ut.active&&((on==null||on===-1)&&(on=ml,As=Zl),Ka({sortable:this,name:"end",toEl:ca,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Wa("nulling",this),ta=Qe=ca=mt=Qs=Aa=ar=ps=$s=En=Hl=on=As=ml=Zl=ll=eo=Qa=No=ut.dragged=ut.ghost=ut.clone=ut.active=null,xr.forEach(function(t){t.checked=!0}),xr.length=Ri=Oi=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Qe&&(this._onDragOver(t),ZE(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],a,n=this.el.children,s=0,o=n.length,u=this.options;s<o;s++)a=n[s],Ln(a,u.draggable,this.el,!1)&&t.push(a.getAttribute(u.dataIdAttr)||lU(a));return t},sort:function(t,a){var n={},s=this.el;this.toArray().forEach(function(o,u){var A=s.children[u];Ln(A,this.options.draggable,s,!1)&&(n[o]=A)},this),a&&this.captureAnimationState(),t.forEach(function(o){n[o]&&(s.removeChild(n[o]),s.appendChild(n[o]))}),a&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,a){return Ln(t,a||this.options.draggable,this.el,!1)},option:function(t,a){var n=this.options;if(a===void 0)return n[t];var s=ho.modifyOption(this,t,a);typeof s<"u"?n[t]=s:n[t]=a,t==="group"&&Yf(n)},destroy:function(){Wa("destroy",this);var t=this.el;t[cn]=null,$t(t,"mousedown",this._onTapStart),$t(t,"touchstart",this._onTapStart),$t(t,"pointerdown",this._onTapStart),this.nativeDraggable&&($t(t,"dragover",this),$t(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),kr.splice(kr.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!ps){if(Wa("hideClone",this),ut.eventCanceled)return;dt(Aa,"display","none"),this.options.removeCloneOnHide&&Aa.parentNode&&Aa.parentNode.removeChild(Aa),ps=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(ps){if(Wa("showClone",this),ut.eventCanceled)return;Qe.parentNode==ta&&!this.options.group.revertClone?ta.insertBefore(Aa,Qe):Qs?ta.insertBefore(Aa,Qs):ta.appendChild(Aa),this.options.group.revertClone&&this.animate(Qe,Aa),dt(Aa,"display",""),ps=!1}}};function ZE(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function jo(e,t,a,n,s,o,u,A){var f,m=e[cn],g=m.options.onMove,y;return window.CustomEvent&&!ls&&!mo?f=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(f=document.createEvent("Event"),f.initEvent("move",!0,!0)),f.to=t,f.from=e,f.dragged=a,f.draggedRect=n,f.related=s||t,f.relatedRect=o||ka(t),f.willInsertAfter=A,f.originalEvent=u,e.dispatchEvent(f),g&&(y=g.call(m,f,u)),y}function Pi(e){e.draggable=!1}function eU(){Ud=!1}function tU(e,t,a){var n=ka(Cl(a.el,0,a.options,!0)),s=10;return t?e.clientX<n.left-s||e.clientY<n.top&&e.clientX<n.right:e.clientY<n.top-s||e.clientY<n.bottom&&e.clientX<n.left}function aU(e,t,a){var n=ka(Cu(a.el,a.options.draggable)),s=10;return t?e.clientX>n.right+s||e.clientX<=n.right&&e.clientY>n.bottom&&e.clientX>=n.left:e.clientX>n.right&&e.clientY>n.top||e.clientX<=n.right&&e.clientY>n.bottom+s}function nU(e,t,a,n,s,o,u,A){var f=n?e.clientY:e.clientX,m=n?a.height:a.width,g=n?a.top:a.left,y=n?a.bottom:a.right,v=!1;if(!u){if(A&&nr<m*s){if(!to&&(eo===1?f>g+m*o/2:f<y-m*o/2)&&(to=!0),to)v=!0;else if(eo===1?f<g+nr:f>y-nr)return-eo}else if(f>g+m*(1-s)/2&&f<y-m*(1-s)/2)return sU(t)}return v=v||u,v&&(f<g+m*o/2||f>y-m*o/2)?f>g+m/2?1:-1:0}function sU(e){return _n(Qe)<_n(e)?1:-1}function lU(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,a=t.length,n=0;a--;)n+=t.charCodeAt(a);return n.toString(36)}function oU(e){xr.length=0;for(var t=e.getElementsByTagName("input"),a=t.length;a--;){var n=t[a];n.checked&&xr.push(n)}}function sr(e){return setTimeout(e,0)}function $d(e){return clearTimeout(e)}ri&&Tt(document,"touchmove",function(e){(ut.active||Al)&&e.cancelable&&e.preventDefault()});ut.utils={on:Tt,off:$t,css:dt,find:Pf,is:function(t,a){return!!Ln(t,a,t,!1)},extend:PE,throttle:Nf,closest:Ln,toggleClass:ln,clone:Gf,index:_n,nextTick:sr,cancelNextTick:$d,detectDirection:zf,getChild:Cl};ut.get=function(e){return e[cn]};ut.mount=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];t[0].constructor===Array&&(t=t[0]),t.forEach(function(n){if(!n.prototype||!n.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(n));n.utils&&(ut.utils=Nn(Nn({},ut.utils),n.utils)),ho.mount(n)})};ut.create=function(e,t){return new ut(e,t)};ut.version=LE;var ya=[],Pl,Dd,Qd=!1,Ni,Ki,Sr,Nl;function rU(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return e.prototype={dragStarted:function(a){var n=a.originalEvent;this.sortable.nativeDraggable?Tt(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Tt(document,"pointermove",this._handleFallbackAutoScroll):n.touches?Tt(document,"touchmove",this._handleFallbackAutoScroll):Tt(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(a){var n=a.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?$t(document,"dragover",this._handleAutoScroll):($t(document,"pointermove",this._handleFallbackAutoScroll),$t(document,"touchmove",this._handleFallbackAutoScroll),$t(document,"mousemove",this._handleFallbackAutoScroll)),_A(),lr(),NE()},nulling:function(){Sr=Dd=Pl=Qd=Nl=Ni=Ki=null,ya.length=0},_handleFallbackAutoScroll:function(a){this._handleAutoScroll(a,!0)},_handleAutoScroll:function(a,n){var s=this,o=(a.touches?a.touches[0]:a).clientX,u=(a.touches?a.touches[0]:a).clientY,A=document.elementFromPoint(o,u);if(Sr=a,n||this.options.forceAutoScrollFallback||mo||ls||Xl){Gi(a,this.options,A,n);var f=_s(A,!0);Qd&&(!Nl||o!==Ni||u!==Ki)&&(Nl&&_A(),Nl=setInterval(function(){var m=_s(document.elementFromPoint(o,u),!0);m!==f&&(f=m,lr()),Gi(a,s.options,m,n)},10),Ni=o,Ki=u)}else{if(!this.options.bubbleScroll||_s(A,!0)===Pn()){lr();return}Gi(a,this.options,_s(A,!1),!1)}}},ns(e,{pluginName:"scroll",initializeByDefault:!0})}function lr(){ya.forEach(function(e){clearInterval(e.pid)}),ya=[]}function _A(){clearInterval(Nl)}var Gi=Nf(function(e,t,a,n){if(t.scroll){var s=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,u=t.scrollSensitivity,A=t.scrollSpeed,f=Pn(),m=!1,g;Dd!==a&&(Dd=a,lr(),Pl=t.scroll,g=t.scrollFn,Pl===!0&&(Pl=_s(a,!0)));var y=0,v=Pl;do{var B=v,b=ka(B),w=b.top,k=b.bottom,S=b.left,M=b.right,$=b.width,F=b.height,L=void 0,Q=void 0,T=B.scrollWidth,D=B.scrollHeight,U=dt(B),I=B.scrollLeft,O=B.scrollTop;B===f?(L=$<T&&(U.overflowX==="auto"||U.overflowX==="scroll"||U.overflowX==="visible"),Q=F<D&&(U.overflowY==="auto"||U.overflowY==="scroll"||U.overflowY==="visible")):(L=$<T&&(U.overflowX==="auto"||U.overflowX==="scroll"),Q=F<D&&(U.overflowY==="auto"||U.overflowY==="scroll"));var P=L&&(Math.abs(M-s)<=u&&I+$<T)-(Math.abs(S-s)<=u&&!!I),K=Q&&(Math.abs(k-o)<=u&&O+F<D)-(Math.abs(w-o)<=u&&!!O);if(!ya[y])for(var G=0;G<=y;G++)ya[G]||(ya[G]={});(ya[y].vx!=P||ya[y].vy!=K||ya[y].el!==B)&&(ya[y].el=B,ya[y].vx=P,ya[y].vy=K,clearInterval(ya[y].pid),(P!=0||K!=0)&&(m=!0,ya[y].pid=setInterval((function(){n&&this.layer===0&&ut.active._onTouchMove(Sr);var ne=ya[this.layer].vy?ya[this.layer].vy*A:0,Y=ya[this.layer].vx?ya[this.layer].vx*A:0;typeof g=="function"&&g.call(ut.dragged.parentNode[cn],Y,ne,e,Sr,ya[this.layer].el)!=="continue"||Kf(ya[this.layer].el,Y,ne)}).bind({layer:y}),24))),y++}while(t.bubbleScroll&&v!==f&&(v=_s(v,!1)));Qd=m}},30),Xf=function(t){var a=t.originalEvent,n=t.putSortable,s=t.dragEl,o=t.activeSortable,u=t.dispatchSortableEvent,A=t.hideGhostForTarget,f=t.unhideGhostForTarget;if(a){var m=n||o;A();var g=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,y=document.elementFromPoint(g.clientX,g.clientY);f(),m&&!m.el.contains(y)&&(u("spill"),this.onSpill({dragEl:s,putSortable:n}))}};function Bu(){}Bu.prototype={startIndex:null,dragStart:function(t){var a=t.oldDraggableIndex;this.startIndex=a},onSpill:function(t){var a=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var s=Cl(this.sortable.el,this.startIndex,this.options);s?this.sortable.el.insertBefore(a,s):this.sortable.el.appendChild(a),this.sortable.animateAll(),n&&n.animateAll()},drop:Xf};ns(Bu,{pluginName:"revertOnSpill"});function ku(){}ku.prototype={onSpill:function(t){var a=t.dragEl,n=t.putSortable,s=n||this.sortable;s.captureAnimationState(),a.parentNode&&a.parentNode.removeChild(a),s.animateAll()},drop:Xf};ns(ku,{pluginName:"removeOnSpill"});ut.mount(new rU);ut.mount(ku,Bu);function iU(){return typeof window<"u"?window.console:global.console}const dU=iU();function uU(e){const t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}const cU=/-(\w)/g,gA=uU(e=>e.replace(cU,(t,a)=>a?a.toUpperCase():""));function ji(e){e.parentElement!==null&&e.parentElement.removeChild(e)}function vA(e,t,a){const n=a===0?e.children[0]:e.children[a-1].nextSibling;e.insertBefore(t,n)}function AU(e,t){return Object.values(e).indexOf(t)}function pU(e,t,a,n){if(!e)return[];const s=Object.values(e),o=t.length-n;return[...t].map((A,f)=>f>=o?s.length:s.indexOf(A))}function Jf(e,t){this.$nextTick(()=>this.$emit(e.toLowerCase(),t))}function fU(e){return t=>{this.realList!==null&&this["onDrag"+e](t),Jf.call(this,e,t)}}function mU(e){return["transition-group","TransitionGroup"].includes(e)}function hU(e){if(!e||e.length!==1)return!1;const[{type:t}]=e;return t?mU(t.name):!1}function _U(e,t){return t?{...t.props,...t.attrs}:e}const Id=["Start","Add","Remove","Update","End"],Td=["Choose","Unchoose","Sort","Filter","Clone"],gU=["Move",...Id,...Td].map(e=>"on"+e);let zi=null;const vU={options:Object,list:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:e=>e},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null},component:{type:String,default:null},modelValue:{type:Array,required:!1,default:null}},Fr=Hn({name:"VueDraggableNext",inheritAttrs:!1,emits:["update:modelValue","move","change",...Id.map(e=>e.toLowerCase()),...Td.map(e=>e.toLowerCase())],props:vU,data(){return{transitionMode:!1,noneFunctionalComponentMode:!1,headerOffset:0,footerOffset:0,_sortable:{},visibleIndexes:[],context:{}}},render(){const e=this.$slots.default?this.$slots.default():null,t=_U(this.$attrs,this.componentData);return e?(this.transitionMode=hU(e),Zi(this.getTag(),t,e)):Zi(this.getTag(),t,[])},created(){this.list!==null&&this.modelValue!==null&&dU.error("list props are mutually exclusive! Please set one.")},mounted(){const e={};Id.forEach(s=>{e["on"+s]=fU.call(this,s)}),Td.forEach(s=>{e["on"+s]=Jf.bind(this,s)});const t=Object.keys(this.$attrs).reduce((s,o)=>(s[gA(o)]=this.$attrs[o],s),{}),a=Object.assign({},t,e,{onMove:(s,o)=>this.onDragMove(s,o)});!("draggable"in a)&&(a.draggable=">*");const n=this.$el.nodeType===1?this.$el:this.$el.parentElement;this._sortable=new ut(n,a),n.__draggable_component__=this,this.computeIndexes()},beforeUnmount(){try{this._sortable!==void 0&&this._sortable.destroy()}catch{}},computed:{realList(){return this.list?this.list:this.modelValue}},watch:{$attrs:{handler(e){this.updateOptions(e)},deep:!0},realList(){this.computeIndexes()}},methods:{getTag(){return this.component?C(this.component):this.tag},updateOptions(e){for(var t in e){const a=gA(t);gU.indexOf(a)===-1&&this._sortable.option(a,e[t])}},getChildrenNodes(){return this.$el.children},computeIndexes(){this.$nextTick(()=>{this.visibleIndexes=pU(this.getChildrenNodes(),this.$el.children,this.transitionMode,this.footerOffset)})},getUnderlyingVm(e){const t=AU(this.getChildrenNodes()||[],e);if(t===-1)return null;const a=this.realList[t];return{index:t,element:a}},emitChanges(e){this.$nextTick(()=>{this.$emit("change",e)})},alterList(e){if(this.list){e(this.list);return}const t=[...this.modelValue];e(t),this.$emit("update:modelValue",t)},spliceList(){const e=t=>t.splice(...arguments);this.alterList(e)},updatePosition(e,t){const a=n=>n.splice(t,0,n.splice(e,1)[0]);this.alterList(a)},getVmIndex(e){const t=this.visibleIndexes,a=t.length;return e>a-1?a:t[e]},getComponent(){return this.$slots.default?this.$slots.default()[0].componentInstance:null},resetTransitionData(e){if(!this.noTransitionOnDrag||!this.transitionMode)return;var t=this.getChildrenNodes();t[e].data=null;const a=this.getComponent();a.children=[],a.kept=void 0},onDragStart(e){this.computeIndexes(),this.context=this.getUnderlyingVm(e.item),this.context&&(e.item._underlying_vm_=this.clone(this.context.element),zi=e.item)},onDragAdd(e){const t=e.item._underlying_vm_;if(t===void 0)return;ji(e.item);const a=this.getVmIndex(e.newIndex);this.spliceList(a,0,t),this.computeIndexes();const n={element:t,newIndex:a};this.emitChanges({added:n})},onDragRemove(e){if(vA(this.$el,e.item,e.oldIndex),e.pullMode==="clone"){ji(e.clone);return}if(!this.context)return;const t=this.context.index;this.spliceList(t,1);const a={element:this.context.element,oldIndex:t};this.resetTransitionData(t),this.emitChanges({removed:a})},onDragUpdate(e){ji(e.item),vA(e.from,e.item,e.oldIndex);const t=this.context.index,a=this.getVmIndex(e.newIndex);this.updatePosition(t,a);const n={element:this.context.element,oldIndex:t,newIndex:a};this.emitChanges({moved:n})},updateProperty(e,t){e.hasOwnProperty(t)&&(e[t]+=this.headerOffset)},onDragMove(e,t){const a=this.move;if(!a||!this.realList)return!0;const n=this.getRelatedContextFromMoveEvent(e),s=this.context,o=this.computeFutureIndex(n,e);Object.assign(s,{futureIndex:o});const u=Object.assign({},e,{relatedContext:n,draggedContext:s});return a(u,t)},onDragEnd(){this.computeIndexes(),zi=null},getTrargetedComponent(e){return e.__draggable_component__},getRelatedContextFromMoveEvent({to:e,related:t}){const a=this.getTrargetedComponent(e);if(!a)return{component:a};const n=a.realList,s={list:n,component:a};if(e!==t&&n&&a.getUnderlyingVm){const o=a.getUnderlyingVm(t);if(o)return Object.assign(o,s)}return s},computeFutureIndex(e,t){const a=[...t.to.children].filter(u=>u.style.display!=="none");if(a.length===0)return 0;const n=a.indexOf(t.related),s=e.component.getVmIndex(n);return a.indexOf(zi)!==-1||!t.willInsertAfter?s:s+1}}}),yU={class:"setting-wrap"},bU={class:"setting-wrap-inner"},wU={key:0,class:"payment-method-list fct-content-card-list"},CU={class:"flex items-start gap-3"},BU=["onClick"],kU=["src","alt"],xU={key:0,class:"fct_payment_method_tag"},SU={class:"fct-content-card-list-content"},FU={class:"fct-content-card-list-action"},EU={key:0},UU=["src"],$U={__name:"PaymentSettings",setup(e){const t=Qt().ctx,a=V(!1),n=V([]),s=Ie.get("app_config.isProActive"),o=j(()=>({animation:200,ghostClass:"ghost"})),u=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))},A=g=>g===!0?"active":"inactive",f=()=>{a.value=!0,t.$get("settings/payment-methods/all",{}).then(g=>{n.value=g.gateways}).catch(g=>{}).finally(()=>{a.value=!1})},m=()=>{const g=n.value.map(y=>y.route);t.$post("settings/payment-methods/reorder",{order:g}).then(y=>{q.success(y.message)}).catch(y=>{})};return Be(()=>{f()}),(g,y)=>{const v=C("el-skeleton"),B=C("el-button");return d(),_("div",yU,[l(ha,{heading:p(c)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),r("div",bU,[l(_a),l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?x("",!0):(d(),_("div",wU,[l(p(Fr),la(o.value,{list:n.value,"item-key":"route",handle:".drag-handle",onEnd:m}),{default:i(()=>[(d(!0),_(H,null,ee(n.value,b=>(d(),_("div",{key:b.route,class:de(b!=null&&b.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[r("div",CU,[y[0]||(y[0]=r("span",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 mt-1 w-7.5 h-7.5",title:"Drag to reorder"},[r("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[r("path",{d:"M8 6h8v2H8V6zm0 4h8v2H8v-2zm0 4h8v2H8v-2z"})])],-1)),r("div",{onClick:()=>{var w;!((w=b==null?void 0:b.addon_status)!=null&&w.is_installed)&&(b!=null&&b.addon_source)||g.$router.push({name:b.route})},class:"cursor-pointer grid gap-2 flex-1"},[r("div",{class:de(["fct-content-card-list-head",b.route])},[r("img",{src:b.icon,alt:b.admin_title||b.title},null,8,kU),b!=null&&b.tag?(d(),_("span",xU,[l(qt,{size:"small",status:"info",text:b.tag},null,8,["text"])])):x("",!0),u(b)?(d(),E(qt,{key:1,size:"small",status:b.status?"active":"disabled","hide-icon":!0},{default:i(()=>[R(h(A(b.status)),1)]),_:2},1032,["status"])):x("",!0)],2),r("div",SU,[r("p",null,h(b.description),1)])],8,BU),r("div",FU,[b!=null&&b.upcoming?(d(),_("div",EU,h(p(c)("Coming Soon!")),1)):(d(),E(B,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:b.route})},{default:i(()=>{var w;return[R(h(p(c)("Manage"))+" ",1),b!=null&&b.requires_pro?(d(),_("img",{key:0,src:((w=g.appVars)==null?void 0:w.asset_url)+"images/crown.svg",alt:"pro feature",class:"pro-feature-icon"},null,8,UU)):x("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},DU={key:0,class:"fluent-cart-admin-validation-error-wrapper"},Pt=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:String},setup(e){const t=e,a=()=>{if(typeof t.validationErrors[t.fieldKey]!="object")return"";const[[s,o]]=Object.entries(t.validationErrors[t.fieldKey]);return{[s]:o}};return(n,s)=>e.validationErrors&&e.validationErrors.hasOwnProperty(e.fieldKey)?(d(),_("div",DU,[(d(!0),_(H,null,ee(a(),(o,u)=>(d(),_("span",{class:"fluent-cart-admin-validation-error",key:o.toLowerCase().replace(/\s/g,"")},h(o),1))),128))])):x("",!0)}}),QU={class:"role-form"},IU={class:"select-use-option"},TU={class:"select-label"},VU={key:0,class:"select-desc"},MU={class:"dialog-footer"},LU={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const n=V(!1),s=a,o=V(!1),u=V(null),A=V(null),f=V(!1),m=V(null),g=V(null),y=V({}),v=V(!1),B=F=>{if(!F){m.value=[];return}re.get("roles/user-list",{search:F}).then(L=>{m.value=L.users.data}).finally(()=>{})},b=()=>{re.get("roles").then(F=>{g.value=F.roles}).catch(F=>{if(F.message){q.error(F.message);return}}).finally(()=>{})},w=()=>{y.value={},o.value=!0,re.post("roles",{user_id:u.value,role_key:A.value}).then((F,L)=>{n.value=!1,q.success(F.message),s("fetchRoles")}).catch(F=>{var L;(L=F.data)!=null&&L.message?q.error(F.data.message):y.value=F.data}).finally(()=>{o.value=!1})},k=()=>{u.value=null,A.value=null,f.value=!1,y.value={},n.value=!1},S=V(""),M=j(()=>f.value?c("Edit %1$s's Role",S.value):c("Add Role"));return t({openModal:(F,L,Q,T=!1)=>{u.value=F,A.value=L,S.value=Q,n.value=!0,f.value=T,b()}}),(F,L)=>{const Q=C("el-option"),T=C("el-select"),D=C("el-form-item"),U=C("el-form"),I=C("el-button"),O=C("el-dialog");return d(),E(O,{title:M.value,modelValue:n.value,"onUpdate:modelValue":L[4]||(L[4]=P=>n.value=P),onClosed:k,"append-to-body":!0},{footer:i(()=>[r("span",MU,[l(I,{onClick:k},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(I,{type:"primary",onClick:w,loading:o.value,disabled:o.value},{default:i(()=>[R(h(f.value?p(c)("Update Role"):p(c)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:i(()=>[r("div",QU,[l(U,{"label-position":"top"},{default:i(()=>[f.value?x("",!0):(d(),E(D,{key:0,label:p(c)("Select User")},{default:i(()=>[l(T,{modelValue:u.value,"onUpdate:modelValue":L[0]||(L[0]=P=>u.value=P),remote:!0,"remote-method":B,loading:v.value,filterable:"",clearable:"",placeholder:p(c)("Type to search user"),class:"w-full",onChange:L[1]||(L[1]=()=>{delete y.value.user_id})},{default:i(()=>[(d(!0),_(H,null,ee(m.value,P=>(d(),E(Q,{key:P.ID,label:P.name,value:P.ID},{default:i(()=>[r("div",IU,[r("span",null,h(P.name),1),r("span",null,h(P.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(d(),E(Pt,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])),l(D,{label:p(c)("Select Role")},{default:i(()=>[l(T,{onChange:L[2]||(L[2]=P=>{delete y.value.role_key}),id:"role_key",modelValue:A.value,"onUpdate:modelValue":L[3]||(L[3]=P=>A.value=P),placeholder:p(c)("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:i(()=>[(d(!0),_(H,null,ee(g.value,(P,K)=>(d(),E(Q,{key:K,label:P.title,value:K},{default:i(()=>[r("div",TU,h(P.title),1),P.description?(d(),_("div",VU,h(P.description),1)):x("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(d(),E(Pt,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},RU=He(LU,[["__scopeId","data-v-b3e8599d"]]),OU={class:"setting-wrap"},HU={class:"setting-wrap-inner"},PU={key:0,class:"fct-setting-header-action"},NU={class:"fct-role-settings"},KU={class:"fct-customer-card"},GU={class:"fct-customer-details"},jU={class:"fct-customer-name"},zU={class:"fct-customer-id"},YU={class:"fct-customer-email"},qU={class:"role-title flex items-center gap-1 capitalize"},WU={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},XU={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},JU={__name:"RoleSettings",setup(e){const t=V(!1),a=V([]),n=V(),s=V(!1),o=Ie.get("app_config.isProActive"),u=()=>{t.value=!0,re.get("roles/managers").then(f=>{a.value=f.managers}).finally(()=>{t.value=!1})},A=f=>{s.value=!0,re.delete("roles/"+f.shop_role,{user_id:f.id}).then(m=>{a.value=a.value.filter(g=>g.id!==f.id),q.success(m.message)}).catch(m=>{if(m.message)return q.error(m.message)}).finally(()=>{s.value=!1})};return Be(()=>{o&&u()}),(f,m)=>{const g=C("el-button"),y=C("el-table-column"),v=C("el-popconfirm"),B=C("el-table"),b=Ca("loading");return d(),_("div",OU,[l(ha,{heading:p(c)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),r("div",HU,[l(_a),l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Existing Roles & Permissions")},{action:i(()=>[p(o)?(d(),_("div",PU,[l(g,{type:"primary",size:"small",onClick:m[0]||(m[0]=()=>{var w;(w=n.value)==null||w.openModal()})},{default:i(()=>[R(h(p(c)("Add Role")),1)]),_:1})])):x("",!0)]),_:1},8,["title"]),p(o)?(d(),E(me,{key:0,class:"px-0 pb-0"},{default:i(()=>[r("div",NU,[Dt((d(),E(B,{data:a.value},{empty:i(()=>[l(at,{icon:"Empty/RoleAndPermission","has-dark":!0,text:p(c)("No roles found!")},null,8,["text"])]),default:i(()=>[l(y,{label:p(c)("User"),width:150},{default:i(w=>{var k,S,M;return[r("div",KU,[r("div",GU,[r("div",jU,[R(h(((k=w.row)==null?void 0:k.display_name)||p(c)("No Name"))+" ",1),r("span",zU,"#"+h((S=w.row)==null?void 0:S.id),1)]),r("div",YU,h((M=w.row)==null?void 0:M.email),1)])])]}),_:1},8,["label"]),l(y,{prop:"shop_role",label:p(c)("Role Title"),width:100},{default:i(w=>[r("span",qU,h(p(Gt).headline(w.row.shop_role)),1)]),_:1},8,["label"]),l(y,{prop:"description",label:p(c)("Roles"),width:100},{default:i(w=>[r("span",WU,h(w.row.description),1)]),_:1},8,["label"]),l(y,{width:100},{default:i(w=>[r("div",XU,[l(Oe,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var k;(k=n.value)==null||k.openModal(w.row.id,w.row.shop_role,w.row.display_name,!0)}},{default:i(()=>[l(W,{name:"Edit"})]),_:2},1032,["onClick"]),l(v,{width:235,"confirm-button-text":p(c)("Confirm"),"cancel-button-text":p(c)("No, Thanks"),"icon-color":"red",title:p(c)("Are you sure to delete this user?"),onConfirm:k=>A(w.row)},{reference:i(()=>[l(Oe,{tag:"a",size:"x-small",hover:"danger"},{default:i(()=>[l(W,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[b,t.value||s.value]])])]),_:1})):(d(),E(me,{key:1,class:"px-0 pb-0"},{default:i(()=>[l(co,{class:"py-7.5",title:p(c)("Upgrade to Pro for Roles & Permission"),text:p(c)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]),_:1}))]),_:1}),l(RU,{ref_key:"roleModal",ref:n,onFetchRoles:u},null,512)])])}}},ZU={class:"fct-settings-nav-wrap"},e$={class:"fct-settings-nav-collapse-button-wrapper"},t$={class:"fct-menu-collapse-button-text"},a$={class:"fct-settings-nav-link-text"},n$={class:"fct-settings-nav-child-list"},s$={class:"fct-settings-nav-content"},l$={class:"fct-settings-nav-content-inner"},o$=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=fn(),a=ja(),n=V(window.innerWidth>=1024),s=V(!1),o=V(!1),u=V(null),A=V(null),f=V(null);no.has("store/settings");const m=V([{name:c("Store Settings"),icon:"Gift",permission:["store/settings","store/sensitive"],url:"/settings/store-settings/",child:[{name:c("Store Setup"),url:"/settings/store-settings/"},{name:c("Pages Setup"),url:"/settings/store-settings/pages_setup"},{name:c("Product Page"),url:"/settings/store-settings/single_product_setup"},{name:c("Cart & Checkout"),url:"/settings/store-settings/cart_and_checkout"},{name:c("Subscriptions"),url:"/settings/store-settings/subscriptions"},{name:c("Checkout Fields"),url:"/settings/store-settings/checkout_fields"}]},{name:c("Payment Settings"),icon:"PaymentIcon",permission:["is_super_admin"],url:"/settings/payments"},{name:c("Invoice & Packing"),icon:"Invoice",permission:["is_super_admin"],url:"/settings/invoice-packing",child:[{name:c("Invoice & Packing"),url:"/settings/invoice-packing"},{name:c("PDF Templates"),url:"/settings/pdf-template"},{name:c("E-Invoice Settings"),url:"/settings/pdf-template/settings"}]},{name:c("Tax Settings"),icon:"Tax",permission:["is_super_admin"],url:"/settings/tax_settings",child:[{name:c("Configuration"),url:"/settings/tax_settings"},{name:c("Rates"),url:"/settings/tax_settings/tax_rates",activeFor:["/settings/tax_settings/eu","/settings/tax_settings/tax_rates_country_single"]}]},{name:c("Email Configuration"),icon:"Message",permission:["store/sensitive"],url:"/settings/email_mailing_settings",child:[{name:c("Mailing Settings"),url:"/settings/email_mailing_settings"},{name:c("Reminders"),url:"/settings/email_mailing_settings/reminders"},{name:c("Notifications"),url:"/settings/email_notifications"},{name:c("Store Digest"),url:"/settings/email_digest_settings"}]},{name:c("Roles and Permissions"),icon:"ShieldCheck",permission:["is_super_admin"],url:"/settings/roles"},{name:c("Storage Settings"),icon:"Database",permission:["is_super_admin"],url:"/settings/storage"}]);a.hasRoute("shipping")&&m.value.push({name:c("Shipping"),icon:"Truck",permission:["store/sensitive"],url:"/settings/shipping",child:[{name:c("Shipping Zones"),permission:["store/sensitive"],url:"/settings/shipping"},{name:c("Shipping Classes"),permission:["store/sensitive"],url:"/settings/shipping/shipping_classes"},{name:c("Packages"),permission:["store/sensitive"],url:"/settings/shipping/packages"}]}),m.value.push({name:c("Features & addon"),icon:"Module",permission:["is_super_admin"],url:"/settings/addons"}),Ie.get("app_config.isProActive")&&m.value.push({name:c("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"});const y=()=>{if(!n.value){u.value&&u.value.classList.remove("is-nav-open"),A.value&&A.value.classList.remove("is-overlay-open");return}s.value=!s.value,o.value=!1},v=()=>{n.value||(u.value&&u.value.classList.remove("is-nav-open"),A.value&&A.value.classList.remove("is-overlay-open"))},B=$=>$.child?(!w.value||k.value)&&S($):!1,b=()=>{const $=window.innerWidth,F=n.value;n.value=$>=1024,!F&&n.value&&(u.value&&u.value.classList.remove("is-nav-open"),A.value&&A.value.classList.remove("is-overlay-open")),F&&!n.value&&(s.value=!1)};Be(()=>{f.value=document.getElementById("fluent_cart_plugin_app"),f.value&&f.value.classList.add("fct_settings_page_plugin_app_wrap"),b(),window.addEventListener("resize",b)}),At(()=>{f.value&&f.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",b)});const w=j(()=>s.value),k=j(()=>n.value&&s.value&&o.value),S=$=>{const F=t.path;return!!($.child&&$.child.length&&$.child.some(Q=>F===Q.url||F.includes(Q.url))||F===$.url||F.includes($.url))},M=($,F,L)=>{const Q=t.path;return!!(Q===$.url||$.activeFor&&$.activeFor.some(T=>Q.startsWith(T))||Q===L.url&&F===0)};return($,F)=>{const L=C("el-button"),Q=C("el-tooltip"),T=C("router-link"),D=C("router-view");return d(),_("div",{class:de(["fct-setting-container setting-container",{"is-collapsed":w.value,"is-expanded":k.value}])},[r("div",{ref_key:"overlayRef",ref:A,class:"fct-settings-menu-overlay",onClick:v},null,512),r("div",ZU,[r("div",{ref_key:"sidebarRef",ref:u,class:de(["fct-settings-nav-container",{"is-collapsed":w.value,"is-expanded":k.value}])},[r("div",e$,[l(Q,{content:p(c)("Toggle settings"),placement:"right"},{default:i(()=>[l(L,{onClick:y,"aria-label":p(c)("Toggle settings navigation"),"aria-expanded":!w.value},{default:i(()=>[l(W,{name:"Window"}),r("span",t$,h(p(c)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),r("ul",{class:"fct-settings-nav",onMouseenter:F[0]||(F[0]=U=>n.value&&s.value&&(o.value=!0)),onMouseleave:F[1]||(F[1]=U=>o.value=!1)},[(d(!0),_(H,null,ee(m.value,(U,I)=>(d(),_("li",{key:I,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":S(U)}])},[p(no).hasAny(U.permission)?(d(),E(T,{key:0,to:U.url,class:"fct-settings-nav-link"},{default:i(()=>[l(W,{name:U.icon},null,8,["name"]),r("span",a$,[R(h(U.name)+" ",1),l(W,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):x("",!0),l(ra,{visible:B(U),accordion:"",class:"fct-settings-nav-child-wrap"},{default:i(()=>[r("ul",n$,[(d(!0),_(H,null,ee(U.child,(O,P)=>(d(),_("li",{key:P,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":M(O,P,U)}])},[l(T,{to:O.url,class:"fct-settings-nav-link"},{default:i(()=>[R(h(O.name),1)]),_:2},1032,["to"])],2))),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),r("div",s$,[r("div",l$,[l(D)])])])],2)}}}),r$={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},i$={__name:"CustomerOrdersLoader",props:{columns:{type:Array,default:()=>[]}},setup(e){const t=e,a=n=>t.columns.includes(n);return(n,s)=>{const o=C("el-table-column"),u=C("el-skeleton-item"),A=C("el-skeleton"),f=C("el-table");return d(),E(f,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default:i(()=>[a("selection")?(d(),E(o,{key:0,type:"selection",width:"45"})):x("",!0),l(o,{width:140,label:p(c)("# Date")},{default:i(()=>[r("div",r$,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p",class:"w-3/5"})]),_:1}),l(A,{animated:""},{template:i(()=>[l(u,{varient:"p",class:"w-4/5"})]),_:1})])]),_:1},8,["label"]),a("order_items")?(d(),E(o,{key:1,"min-width":200,label:p(c)("Items")},{default:i(()=>[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"])):x("",!0),l(o,{width:150,label:p(c)("Total")},{default:i(()=>[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),l(o,{width:150,label:p(c)("Payment Status")},{default:i(()=>[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),a("status")?(d(),E(o,{key:2,width:120,label:p(c)("Status")},{default:i(()=>[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0),a("type")?(d(),E(o,{key:3,width:140,label:p(c)("Order Type")},{default:i(()=>[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0)]),_:1})}}},d$={class:"select-use-option"},u$={class:"dialog-footer"},Zf={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=V(!1),n=V([]),s=V(null),o=V({}),u=V(!1),A=()=>{o.value={},u.value=!0,re.post(`customers/${t.customer.id}/attachable-user`,{user_id:s.value}).then((g,y)=>{a.value=!1,q.success(g.message),t.customer.user_id=s.value}).catch(g=>{if(g.message)return q.error(g.message);o.value=g}).finally(()=>{u.value=!1})},f=()=>{s.value=null,o.value={},a.value=!1},m=()=>{re.get("customers/attachable-user").then(g=>{n.value=Ke.get(g,"users")})};return Be(()=>{m()}),(g,y)=>{C("el-link");const v=C("el-option"),B=C("el-select"),b=C("el-form-item"),w=C("el-form"),k=C("el-button"),S=C("el-dialog");return d(),_(H,null,[x("",!0),l(S,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=M=>a.value=M),title:p(c)("Attach User"),onClosed:f},{footer:i(()=>[r("span",u$,[l(k,{onClick:f},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(k,{type:"primary",onClick:A,loading:u.value,disabled:u.value},{default:i(()=>[R(h(p(c)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:i(()=>[l(w,{"label-position":"top"},{default:i(()=>[l(b,{label:g.$t("Select User")},{default:i(()=>[l(B,{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:i(()=>[(d(!0),_(H,null,ee(n.value,M=>(d(),E(v,{key:M.ID,label:M.display_name,value:M.ID},{default:i(()=>[r("div",d$,[r("span",null,h(M.display_name),1),r("span",null,h(M.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),o.value.hasOwnProperty("user_id")?(d(),E(Pt,{key:0,"validation-errors":o.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},c$={class:"more-btn"},A$={class:"fct-admin-sidebar-item"},p$={class:"fct-profile-card"},f$={class:"fct-profile-image"},m$=["src","alt"],h$={class:"fct-profile-details"},_$={class:"title"},g$={class:"text"},v$={key:0},y$={class:"text"},b$={key:0,class:"flex items-center gap-2 mt-1.5"},w$={class:"user-info"},C$=["href"],B$={key:1},k$={class:"fct-admin-sidebar-item mt-5"},x$={class:"sidebar-title"},S$={class:"fct-contact-info-list"},F$={class:"flex items-center justify-between gap-2"},E$=["href"],U$={class:"fct-admin-sidebar-item mt-5"},$$={class:"sidebar-title"},D$={key:0,class:"fct-address-copy-wrap"},Q$={class:"text"},I$={key:0,class:"pr-1"},T$=["innerHTML"],V$={key:1,class:"mt-3"},M$={class:"pr-1"},L$=["href"],R$={key:0,class:"no-address-text"},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"},Y$=["href"],q$={key:0,class:"no-address-text"},W$={class:"fct-customer-address-wrap"},X$={name:"CustomerInformations",components:{CustomerPurchaseValue:Fh,NewCustomerModal:qd,ManageAddressModal:JA,AddOrEditAddressModal:XA,DynamicIcon:W,CopyToClipboard:Za,UserAttchModal:Zf,Back:Jd},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})}}},em=Object.assign(X$,{setup(e){return(t,a)=>{const n=C("el-dropdown-item"),s=C("el-dropdown-menu"),o=C("el-dropdown"),u=C("el-button"),A=C("el-popconfirm"),f=C("el-tag"),m=C("el-icon"),g=C("el-dialog"),y=Ca("loading");return d(),_("div",null,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Customer Information"),title_size:"small",border_bottom:""},{action:i(()=>[l(o,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleCustomerBulkCommand},{dropdown:i(()=>[l(s,null,{default:i(()=>[l(n,{command:"edit_customer_information"},{default:i(()=>[R(h(t.$t("Edit customer information")),1)]),_:1}),l(n,{command:"manage_shipping_address"},{default:i(()=>[R(h(t.$t("Manage shipping address")),1)]),_:1}),l(n,{command:"manage_billing_address"},{default:i(()=>[R(h(t.$t("Manage billing address")),1)]),_:1}),l(n,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:i(()=>[R(h(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:i(()=>[r("span",c$,[l(W,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),l(me,null,{default:i(()=>{var v,B,b,w;return[r("div",A$,[r("div",p$,[r("div",f$,[r("img",{src:(v=e.customer)==null?void 0:v.photo,alt:t.customerDisplayName},null,8,m$)]),r("div",h$,[r("div",_$,h(t.customerDisplayName),1),r("span",g$,[e.customer.purchase_count>0?(d(),_("span",v$,h(p(Kt)(e.customer.purchase_count)),1)):x("",!0),R(" "+h(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),r("span",y$,h(p(Jt)((B=e.customer)==null?void 0:B.ltv,!0))+" "+h(p(c)("Lifetime Value")),1)])])]),r("div",null,[e.customer.user_id&&e.customer.user_id>0?(d(),_("div",b$,[r("div",w$,[a[6]||(a[6]=R(" WP User: ",-1)),r("a",{href:e.customer.user_link,target:"_blank",class:"inline-flex items-center gap-1 dark:text-gray-100 text-primary-500 focus:shadow-none hover:!underline"},[R(" #"+h(p(Kt)(e.customer.user_id))+" ",1),l(W,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,C$)]),x("",!0)])):(d(),_("div",B$,[l(Zf,{customer:e.customer},null,8,["customer"])]))]),r("div",k$,[r("h4",x$,h(t.$t("Contact Information")),1),r("ul",S$,[r("li",null,[r("div",F$,[r("a",{class:"text",href:"mailto:"+((b=e.customer)==null?void 0:b.email)},h((w=e.customer)==null?void 0:w.email),9,E$),l(Za,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),r("div",U$,[r("h4",$$,[R(h(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(d(),E(f,{key:0,type:"info",round:""},{default:i(()=>[R(h(t.$t("Default")),1)]),_:1})):x("",!0)]),(d(!0),_(H,null,ee(t.shippingAddress,(k,S)=>(d(),_(H,null,[k.is_primary==="1"?(d(),_("div",D$,[r("span",Q$,[k.name?(d(),_("strong",I$,h(k.name),1)):x("",!0),r("span",{innerHTML:t.getOrderAddress(k,"shipping",!0)},null,8,T$),k.phone?(d(),_("span",V$,[r("strong",M$,h(p(c)("Phone"))+":",1),r("a",{href:"tel:"+k.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},h(k.phone),9,L$)])):x("",!0)]),l(Za,{text:t.getOrderAddress(k),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):x("",!0)],64))),256)),t.hasPrimaryShipping==-1?(d(),_("p",R$,h(t.$t("No default address found.")),1)):x("",!0)]),r("div",O$,[r("h4",H$,[R(h(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(d(),E(f,{key:0,type:"info",round:""},{default:i(()=>[R(h(t.$t("Default")),1)]),_:1})):x("",!0)]),(d(!0),_(H,null,ee(t.billingAddress,(k,S)=>(d(),_(H,null,[k.is_primary==="1"?(d(),_("div",P$,[r("span",N$,[k.name?(d(),_("strong",K$,h(k.name),1)):x("",!0),r("span",{innerHTML:t.getOrderAddress(k,"billing",!0)},null,8,G$),k.phone?(d(),_("span",j$,[r("strong",z$,h(p(c)("Phone"))+":",1),r("a",{href:"tel:"+k.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},h(k.phone),9,Y$)])):x("",!0)]),l(Za,{text:t.getOrderAddress(k),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):x("",!0)],64))),256)),t.hasPrimaryBilling===-1?(d(),_("p",q$,h(t.$t("No default address found.")),1)):x("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(d(),E(qd,{key:0,"onUpdate:customerModal":t.fetch,customerModalInfos:t.customerModalInfos,customer_id:t.customerModalInfos.customer_id,customer:t.customerModalInfos.customer,onCloseModal:a[0]||(a[0]=v=>t.customerModalInfos.showModal=!1)},null,8,["onUpdate:customerModal","customerModalInfos","customer_id","customer"])):x("",!0),l(JA,{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"]),l(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:i(()=>[r("div",W$,[l(u,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:i(()=>[l(m,null,{default:i(()=>[l(p(Jd))]),_:1}),R(" "+h(t.$t("Manage address")),1)]),_:1}),l(XA,{"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"])])}}}),J$={class:"fct-single-customer-loader-wrap fct-layout-width"},Z$={class:"single-page-header fct-page-loader-header flex items-start justify-between"},e5={class:"single-page-body"},t5={class:"fct-single-order"},a5={class:"fct-single-order-main"},n5={class:"fct-single-order-aside"},s5={class:"fct-admin-sidebar"},tm={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton");return d(),_("div",J$,[r("div",Z$,[l(s,{animated:"",class:"flex items-start gap-2"},{template:i(()=>[(d(),_(H,null,ee(3,o=>l(n,{key:o,class:"max-w-[100px]"})),64))]),_:1})]),r("div",e5,[r("div",t5,[r("div",a5,[l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:5})]),_:1})]),_:1})]),r("div",n5,[r("div",s5,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:5})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},l5={key:2},o5={key:0,class:"fct-single-customer-wrapper fct-layout-width"},r5={class:"single-page-header"},i5={class:"single-page-header-title-wrap"},d5={key:0},u5={key:0,class:"single-page-body"},c5={class:"fct-admin-sidebar"},A5={key:0},p5={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:eu,IconButton:Oe,Empty:at,DynamicIcon:W,Badge:qt,SaveBar:Bl,CustomerInformation:em,Labels:Or,DynamicTemplates:Sl,ArrowDown:Pr,ArrowRight:tn,CardContainer:he,CardHeader:Ce,CardBody:me,LicenseTable:Wd,OrdersTableMobile:tu,SubscriptionsTable:lp,SingleCustomerLoader:tm,SubscriptionsTableMobile:sp},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,re.put("customers/"+this.customer_id+"/additional-info",{labels:this.selectedLabels}).then(e=>{q.success(e)}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.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=[],re.get("customers/"+this.customer_id,{with:["shipping_address","billing_address","labels","subscriptions"]}).then(e=>{this.changeTitle(c("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=Ke.get(e,"data.buttonText"),this.notFound.message=Ke.get(e,"data.message"),this.notFound.route=Ke.get(e,"data.route")):e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},getCustomerOrders(){this.fetchingOrders=!0,re.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"?q.validationErrors(e):q.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()}},f5=Object.assign(p5,{setup(e){return(t,a)=>{const n=C("el-breadcrumb-item"),s=C("el-breadcrumb"),o=C("el-input"),u=C("el-col"),A=C("el-row");return d(),_(H,null,[t.loading?(d(),E(tm,{key:0})):x("",!0),t.notFound.show?(d(),E(Kr,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):x("",!0),t.notFound.show===!1?(d(),_("div",l5,[t.loading?x("",!0):(d(),_("div",o5,[l(Bl,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),r("div",r5,[r("div",i5,[l(s,{"separator-icon":p(tn)},{default:i(()=>[l(n,{to:{name:"customers"}},{default:i(()=>[R(h(p(c)("Customers")),1)]),_:1}),l(n,null,{default:i(()=>[t.customer?(d(),_("span",d5,h(t.customer.full_name),1)):x("",!0)]),_:1}),l(n,null,{default:i(()=>[R(h(p(c)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(d(),_("div",u5,[l(A,{gutter:30},{default:i(()=>[l(u,{lg:17,xs:24},{default:i(()=>[l(p(he),{class:"overflow-hidden fct-customer-orders-items"},{default:i(()=>[l(p(Ce),{title:p(c)("Orders (%s)",p(Kt)(t.customerOrders.total||0)),title_size:"small"},{action:i(()=>[l(o,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=f=>t.search=f),onKeyup:a[1]||(a[1]=Pa(f=>t.getCustomerOrders(),["enter"])),placeholder:p(c)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=f=>t.getCustomerOrders()),class:de(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),l(Oe,{tag:"button",size:"small",onClick:a[3]||(a[3]=f=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:i(()=>[t.showSearch?(d(),E(W,{key:0,name:"Cross"})):(d(),E(W,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),l(p(me),{class:"px-0 pb-0"},{default:i(()=>[t.fetchingOrders?(d(),E(i$,{key:0,columns:["items","order_items","total","type","status"]})):(d(),_(H,{key:1},[l(eu,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),l(tu,{class:"show-on-mobile",orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["orders"])],64)),t.paginate.total>10?(d(),E(WA,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):x("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(d(),E(p(he),{key:0,class:"overflow-hidden"},{default:i(()=>[l(p(Ce),{title:p(c)("Subscriptions")+" ("+p(Kt)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),l(p(me),{class:"px-0 pb-0"},{default:i(()=>[l(lp,{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"]),l(sp,{class:"show-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"])]),_:1})]),_:1})):x("",!0),t.customer.licenses?(d(),E(p(he),{key:1,class:"overflow-hidden"},{default:i(()=>[l(p(Ce),{title:p(c)("Licenses")+" ("+p(Kt)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),l(p(me),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:i(()=>[l(Wd,{columns:["product","order_id"],licenses:t.customer.licenses},null,8,["licenses"])]),_:1})]),_:1})):x("",!0)]),_:1}),l(u,{lg:7,xs:24},{default:i(()=>[r("div",c5,[l(em,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),l(Or,{"bind-to-id":t.customer.id,"bind-to-type":"Customer",selectedLabels:t.selectedLabels,shouldEnableEditing:!0},null,8,["bind-to-id","selectedLabels"]),t.customer?(d(),_("div",A5,[l(Sl,{filter:"customer",widgetsQuery:{customer_id:t.customer.id},data:{customer:t.customer}},null,8,["widgetsQuery","data"])])):x("",!0)])]),_:1})]),_:1})])):x("",!0)]))])):x("",!0)],64)}}}),m5={components:{BundleProducts:su,Empty:at,Pagination:WA,Badge:qt,DynamicIcon:W},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 Te},Asset(){return Ps},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:c,translateNumber:Kt,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(n=>n.variants&&n.variants.other_info&&n.variants.other_info.payment_type===t?!0:!!(n.other_info.payment_type&&n.other_info.payment_type===t)).length>0},validateShouldAddProduct(e){var o;const t=this.order.order_items.map(u=>u.object_id),a=this.selectedProducts.map(u=>u.object_id),n=((o=e==null?void 0:e.other_info)==null?void 0:o.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,n)){if(!this.hasSubscriptionProduct(this.selectedProducts,"subscription"))return!0}else if(!s&&!this.hasSubscriptionProduct(this.order.order_items,n)&&!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,q.error(c("You can purchase one subscription at a time."));else{const a=this.selectedProducts.findIndex(n=>n.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,n)=>{e[a.object_id]=a}),this.selectedProducts&&this.selectedProducts.forEach((a,n)=>{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,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 n=parseInt(e[a].other_info.signup_fee);e[a].other_info.setup_fee_per_item==="yes"&&(n=n*e[a].quantity),t+=n}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;ye(()=>{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"]};re.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=lh(a.data,this.order_id),delete a.data,this.paginate=a,this.searching=!1}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1})},formatCapitalized(e){return sh(e)}}},h5={class:"fluent-cart-admin-pages"},_5={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},g5={class:"px-5"},v5={class:"fc_product_search_table",ref:"fc_product_search_table"},y5={class:"fct-collapsible-list"},b5={class:"fct-collapsible-list-item-inner"},w5={class:"fct-collapsible-item"},C5={class:"fct-collapsible-content-wrapper"},B5=["onClick"],k5={key:1,class:"content-indent"},x5={class:"content-checkbox"},S5={class:"content-img"},F5=["src","alt"],E5={class:"content-title"},U5={class:"title"},$5={key:0,class:"text-gray-500 dark:text-gray-400"},D5={key:1,class:"text"},Q5={key:0,class:"fct-collapsible-stock-wrapper"},I5={key:0},T5={key:1,class:"text-red-500"},V5={class:"fct-collapsible-value-wrapper"},M5={key:0},L5={key:1},R5={class:"fct-collapsible-item-child-inner"},O5={class:"fct-collapsible-item"},H5={class:"fct-collapsible-content-wrapper"},P5={class:"fct-collapsible-content-group"},N5={class:"content-checkbox"},K5={class:"content-img"},G5=["src","alt"],j5={class:"content-title"},z5={class:"title"},Y5={key:0,class:"text"},q5={key:0},W5={key:1,class:"text already-added"},X5={class:"fct-collapsible-stock-wrapper"},J5={key:0},Z5={key:1,class:"text-red-500"},eD={class:"fct-collapsible-value-wrapper"},tD={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},aD={class:"dialog-footer"};function nD(e,t,a,n,s,o){const u=C("DynamicIcon"),A=C("el-input"),f=C("el-skeleton"),m=C("el-checkbox"),g=C("BundleProducts"),y=C("Empty"),v=C("Pagination"),B=C("el-button"),b=C("el-dialog");return d(),_("div",h5,[l(b,{class:"fct-add-product-item-modal",ref:"fc_product_search_container",onClose:t[3]||(t[3]=w=>o.searchQuery=""),modelValue:s.orderAddModal,"onUpdate:modelValue":t[4]||(t[4]=w=>s.orderAddModal=w),title:e.$t("Add Items")},{default:i(()=>[r("div",_5,[r("div",g5,[l(A,{placeholder:e.$t("Search products"),autofocus:"",ref:"fc_product_search_new",onInput:t[0]||(t[0]=w=>o.fetchBySearch()),modelValue:o.searchQuery,"onUpdate:modelValue":t[1]||(t[1]=w=>o.searchQuery=w),clearable:""},{prefix:i(()=>[l(u,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),r("div",v5,[l(f,{class:"px-5 py-4",loading:s.loading,rows:5,animated:""},null,8,["loading"]),s.loading?x("",!0):(d(),_(H,{key:0},[r("ul",y5,[(d(!0),_(H,null,ee(s.availableProducts,(w,k)=>{var S,M,$,F,L,Q,T,D,U;return d(),_("li",{class:"fct-collapsible-list-item",key:k},[r("div",b5,[r("div",w5,[r("div",C5,[((S=w==null?void 0:w.children)==null?void 0:S.length)>0?(d(),_("div",{key:0,class:de(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[k]}]),onClick:I=>o.handleToggleCollapse(k)},[l(u,{name:"CaretRight"})],10,B5)):x("",!0),!((M=w==null?void 0:w.children)!=null&&M.length)>0?(d(),_("div",k5)):x("",!0),r("div",x5,[l(m,{modelValue:w.checked,"onUpdate:modelValue":I=>w.checked=I,onChange:I=>o.handleCheckboxChange(k,w),disabled:w.disable===!0||o.isAlreadyAdded(w.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),r("div",S5,[r("img",{src:w.featured_media!=null?w.featured_media:o.Asset.getUrl("images/placeholder-small.svg"),alt:w.title},null,8,F5)]),r("div",E5,[r("div",U5,h(w.post_title),1),(($=w==null?void 0:w.other_info)==null?void 0:$.payment_type)==="subscription"&&((F=w.other_info)==null?void 0:F.billing_summary)!==""?(d(),_("small",$5,h((L=w.other_info)==null?void 0:L.billing_summary),1)):x("",!0),o.isAlreadyAdded(w.object_id)?(d(),_("div",D5,h(e.$t("Item already added")),1)):x("",!0)])]),((Q=w==null?void 0:w.children)==null?void 0:Q.length)==0?(d(),_("div",Q5,[w.stockStatus=="in-stock"?(d(),_("span",I5,h(w.available!==1/0?w.available+o.translate(" Available"):o.translate("Unlimited")),1)):x("",!0),w.stockStatus==="out-of-stock"?(d(),_("span",T5,h(o.formatCapitalized(w.stockStatus)),1)):x("",!0)])):x("",!0),r("div",V5,[((T=w==null?void 0:w.children)==null?void 0:T.length)>0?(d(),_("span",M5,h(w.min_price!=w.max_price?e.formatNumber(w.min_price)+" - "+e.formatNumber(w.max_price):e.formatNumber(w.min_price)),1)):(d(),_("span",L5,h(e.formatNumber(w.price)),1))])]),((D=w==null?void 0:w.children)==null?void 0:D.length)>0?(d(),_("div",{key:0,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[k]}])},null,2)):x("",!0),((U=w==null?void 0:w.children)==null?void 0:U.length)>0?(d(),_("div",{key:1,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[k]}])},[r("ul",R5,[(d(!0),_(H,null,ee(w.children,(I,O)=>{var P,K,G,ne,Y;return d(),_("li",{key:O},[r("div",O5,[r("div",H5,[r("div",P5,[r("div",N5,[l(m,{modelValue:I.checked,"onUpdate:modelValue":N=>I.checked=N,onChange:N=>o.handleCheckboxChange(O,I),disabled:I.disable===!0||o.isAlreadyAdded(I.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),r("div",K5,[r("img",{src:I.featured_media!=null?I.featured_media:e.appVars.asset_url+"images/placeholder-small.svg",alt:I.title},null,8,G5)])]),r("div",j5,[r("div",z5,h(I.title),1),((P=I==null?void 0:I.other_info)==null?void 0:P.payment_type)==="subscription"&&((K=I.other_info)==null?void 0:K.billing_summary)!==""?(d(),_("small",Y5,[R(h(o.CurrencyFormatter.currencySign)+" "+h((G=I.other_info)==null?void 0:G.billing_summary)+" ",1),((ne=I.other_info)==null?void 0:ne.trial_days)>0?(d(),_("span",q5,[t[5]||(t[5]=r("br",null,null,-1)),R(" "+h(o.translate("Trial Days"))+": "+h((Y=I.other_info)==null?void 0:Y.trial_days),1)])):x("",!0)])):x("",!0),o.isAlreadyAdded(I.object_id)?(d(),_("div",W5,h(o.translate("Item already added")),1)):x("",!0),I.bundle_items.length>0?(d(),E(g,{key:2,product:I,"title-key":"variation_title"},null,8,["product"])):x("",!0)])]),r("div",X5,[I.stockStatus=="in-stock"?(d(),_("span",J5,h(I.available!==1/0?o.translateNumber(I.available)+o.translate(" Available"):o.translate("Unlimited")),1)):x("",!0),I.stockStatus=="out-of-stock"?(d(),_("span",Z5,h(o.formatCapitalized(I.stockStatus)),1)):x("",!0)]),r("div",eD,h(e.formatNumber(I.price)),1)])])}),128))])],2)):x("",!0)])])}),128))]),s.availableProducts.length===0?(d(),E(y,{key:0,icon:"Empty/ListView",text:o.translate("We could't find any products matching your search.")},null,8,["text"])):x("",!0)],64))],512),r("div",tD,[l(v,{pagerSizes:!1,hide_on_single:!1,pagination:s.paginate,onFetch:o.doSearch,onCurrentPageChanged:o.onCurrentPageChanged,onOnPerPageChanged:o.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),r("div",aD,[l(B,{onClick:t[2]||(t[2]=w=>s.orderAddModal=!1)},{default:i(()=>[R(h(o.translate("Cancel")),1)]),_:1}),l(B,{disabled:!s.selectedProducts.length,type:"primary",onClick:o.processProducts},{default:i(()=>[R(h(o.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const am=He(m5,[["render",nD]]),sD={key:0,class:"fct-downloadable-variation-selector"},lD={class:"price-info"},oD={key:0},Er={__name:"VariationSelector",props:{variant:{type:Object,required:!0}},setup(e){return(t,a)=>{var n;return e.variant?(d(),_("div",sD,[r("span",null,h(e.variant.variation_title),1),r("span",lD,[(n=e.variant.other_info)!=null&&n.repeat_interval?(d(),_("span",oD,h(p(Gt).capitalize(e.variant.other_info.repeat_interval)),1)):x("",!0),r("span",null,h(p(Jt)(e.variant.item_price*100,!0)),1)])])):x("",!0)}}},rD={name:"Refund",components:{Badge:qt,VariationSelector:Er,DynamicIcon:W},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 Te},orderCurrencySign(){const e=Ie.get("currency_signs",{}),t=Ie.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:c,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=Ke.whereIn(this.order.order_items,"id",this.refund.item_ids),n=a.reduce((s,o)=>s+(o.line_total-o.refund_total)/100,0);this.refund.amount>n&&a.length>0&&(this.refund.amount=n),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})}}},iD={key:0,class:"fct-refund-note-list"},dD={class:"message"},uD={key:1},cD={class:"refund-item-info"},AD={class:"right"},pD={class:"price"},fD={class:"price light"},mD={class:"form-note"},hD={style:{color:"#F04438","font-weight":"500"}},_D={class:"form-note form-note-tooltip"},gD={class:"dialog-footer is-border"},vD={key:0};function yD(e,t,a,n,s,o){const u=C("Badge"),A=C("el-option"),f=C("el-select"),m=C("el-form-item"),g=C("el-input"),y=C("el-checkbox"),v=C("el-col"),B=C("el-table-column"),b=C("el-input-number"),w=C("el-table"),k=C("DynamicIcon"),S=C("el-tooltip"),M=C("el-row"),$=C("el-form"),F=C("el-button");return d(),_("div",null,[s.refundNote?(d(),_("div",iD,[(d(!0),_(H,null,ee(s.refundNote,(L,Q)=>(d(),_("div",{key:Q,class:"fct-refund-note-item"},[r("span",dD,h(L.message),1),l(u,{status:L.status},null,8,["status"])]))),128))])):(d(),_("div",uD,[l($,{"label-position":"top","require-asterisk-position":"right"},{default:i(()=>[l(M,{gutter:10},{default:i(()=>[l(v,{lg:24},{default:i(()=>[l(m,{label:e.$t("Refund with transaction"),required:""},{default:i(()=>[l(f,{modelValue:s.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=L=>s.refund.transaction_id=L),placeholder:e.$t("Select"),onChange:o.updateMaxRefund},{default:i(()=>[(d(!0),_(H,null,ee(s.refundableTransactions,L=>(d(),E(A,{key:L.id,label:o.translate("#%1$s - Paid %2$s",L.id,o.formatNumber(L.refundable,!0)),value:L.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),l(m,{label:e.$t("Select Item/s")},{default:i(()=>[l(f,{modelValue:s.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=L=>s.refund.item_ids=L),placeholder:e.$t("Select"),multiple:"",onChange:o.updateMaxRefund},{default:i(()=>[(d(!0),_(H,null,ee(a.order.order_items,L=>(d(),E(A,{key:L.id,value:L.id,label:L.post_title+" - "+L.title+" "+o.formatNumber(L.line_total-L.refund_total),class:"refund-item",disabled:Number(L.line_total)-Number(L.refund_total)<=0},{default:i(()=>[r("div",cD,[r("p",null,[R(h(L.post_title)+" ",1),r("span",null,"-"+h(L.title),1)]),r("div",AD,[r("span",pD,h(o.translate("Refundable: %1$s",o.formatNumber(L.line_total-L.refund_total))),1),r("span",fD,h(o.translate("Item price: %1$s",o.formatNumber(L.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),l(v,{lg:24},{default:i(()=>[l(m,{label:e.$t("Refund amount"),required:""},{default:i(()=>[l(g,{type:"number",min:1,max:s.maxRefundAmount,modelValue:s.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=L=>s.refund.amount=L),modelModifiers:{number:!0},onInput:o.checkMaxRefundAmount},{prefix:i(()=>[R(h(o.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),r("div",mD,[r("p",null,[R(h(e.$t("Max refund amount for this transaction:"))+" ",1),r("span",hD,h(o.formatNumber(s.maxRefundAmount*100)),1)])])]),_:1},8,["label"]),o.isSubscriptionCancelable?(d(),E(v,{key:0,lg:24},{default:i(()=>[l(m,{label:e.$t("Subscription")},{default:i(()=>[l(y,{label:e.$t("Cancel Subscription (if any)"),modelValue:s.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=L=>s.refund.cancelSubscription=L)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):x("",!0),o.isAnyProductManageStock?(d(),E(v,{key:1,lg:24},{default:i(()=>[l(m,null,{default:i(()=>[l(y,{modelValue:s.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=L=>s.refund.manageStock=L)},{default:i(()=>[R(h(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):x("",!0),s.refund.manageStock?(d(),E(v,{key:2,lg:24},{default:i(()=>[l(w,{data:o.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:i(()=>[l(B,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:i(({row:L})=>[r("span",null,h(L.post_title)+" - "+h(L.title),1)]),_:1},8,["label"]),l(B,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:i(({row:L})=>[r("span",null,h(L.quantity),1)]),_:1},8,["label"]),l(B,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:i(({row:L})=>[l(b,{modelValue:L.restore_quantity,"onUpdate:modelValue":Q=>L.restore_quantity=Q,min:0,max:L.quantity},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})):x("",!0),l(v,{lg:24},{default:i(()=>[l(m,{label:e.$t("Reason of refund")},{default:i(()=>[l(g,{modelValue:s.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=L=>s.refund.reason=L)},null,8,["modelValue"]),r("div",_D,[r("p",null,[R(h(o.translate("Your customers can see this reason"))+" ",1),r("span",null,[l(S,{"popper-class":"fct-tooltip",placement:"top",content:o.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:i(()=>[l(k,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),r("div",gD,[l(F,{type:"primary",onClick:Xe(o.processRefund,["prevent"]),loading:s.refundProcessing,disabled:s.refund.amount<=0},{default:i(()=>[R(h(s.refundProcessing?o.translate("Processing"):o.translate("Refund"))+" ",1),s.refund.amount?(d(),_("span",vD)):x("",!0),R(h(o.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const bD=He(rD,[["render",yD]]),wD={class:"fct-number-input"},CD=["disabled","min","max"],BD={class:"fct-number-input-buttons"},kD=["disabled"],xD=["disabled"],SD={style:{color:"red"}},nm={__name:"NumberInput",props:{min:{type:Number,default:1},max:{type:Number,default:999999},item:{type:Object,default:()=>({})},isDisabled:{type:Boolean,default:!1}},setup(e,{emit:t}){var S,M,$,F,L;const a=t,n=e,s=V(""),o=()=>{var Q,T,D,U;return(((Q=n.item)==null?void 0:Q.manage_stock)||((U=(D=(T=n.item)==null?void 0:T.variants)==null?void 0:D.product_detail)==null?void 0:U.manage_stock))==1},u=V(((S=n.item)==null?void 0:S.quantity)||n.min),A=V(u.value),f=V(o()?((M=n.item)==null?void 0:M.available)||((F=($=n.item)==null?void 0:$.variants)==null?void 0:F.available):n.max),m=V(o()?(L=n.item)==null?void 0:L.updated_stock:n.max);Qt().ctx;const g=j(()=>A.value<=n.min),y=j(()=>A.value>=m.value),v=()=>{s.value="",A.value<m.value&&(u.value++,A.value=u.value,a("update:value",u.value,m.value,n.item))},B=()=>{s.value="",A.value>n.min&&(u.value--,A.value=u.value,a("update:value",u.value,m.value,n.item))},b=(Q,T)=>{s.value="",A.value=parseInt(A.value),(isNaN(A.value)||A.value==="")&&(u.value=1),A.value<n.min?(u.value=n.min,A.value=u.value):A.value>n.max?(u.value=n.min,A.value=u.value,s.value=c("Unable to adjust quantity")):A.value>m.value?(u.value=m.value,A.value=u.value,s.value=c("Available: %s in stock",m.value)):A.value>=n.min&&(A.value===m.value||A.value<m.value)&&(u.value=A.value,A.value=u.value),a("update:value",u.value,m.value,n.item)},w=Q=>{Q.key==="ArrowDown"&&A.value<=n.min&&Q.preventDefault()},k=()=>{var Q,T,D,U,I;s.value="",u.value=((Q=n.item)==null?void 0:Q.quantity)||n.min,A.value=u.value,f.value=o()?((T=n.item)==null?void 0:T.available)||((U=(D=n.item)==null?void 0:D.variants)==null?void 0:U.available):n.max,m.value=o()?(I=n.item)==null?void 0:I.updated_stock:n.max};return Ks(()=>{k()}),ge(()=>n.item,Q=>{k()},{deep:!0}),(Q,T)=>(d(),_(H,null,[r("div",wD,[Dt(r("input",{disabled:e.isDisabled,"onUpdate:modelValue":T[0]||(T[0]=D=>A.value=D),type:"number",onInput:T[1]||(T[1]=D=>{b()}),min:e.min,max:e.max,onKeydown:w},null,40,CD),[[Ym,A.value,void 0,{number:!0}]]),r("div",BD,[r("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[l(W,{name:"ChevronUp"})],8,kD),r("button",{onClick:B,class:"decrement-btn",disabled:g.value||e.isDisabled},[l(W,{name:"ChevronDown"})],8,xD)])]),r("span",SD,h(s.value),1)],64))}},FD={name:"PaymentLink",components:{IconButton:Oe,DynamicIcon:W,CopyToClipboard:Za,InfoFilled:Xa},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 W},adminUrl(){return Ie.get("admin_url")}},mounted(){this.makeSelectableId(),this.generatePaymentUrl()},methods:{translate:c,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(n=>n.id==this.selectedTransaction&&n.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}}},ED=["element-loading-text"],UD={class:"fct-payment-link-block"},$D={key:1,class:"fct-payment-link-block"};function DD(e,t,a,n,s,o){const u=C("CopyToClipboard"),A=C("el-button"),f=C("el-input"),m=C("el-form-item"),g=C("el-col"),y=C("el-row"),v=Ca("loading");return Dt((d(),_("div",{class:"fct-payment-link grid gap-5","element-loading-text":o.translate("Please wait, Generating Payment link...")},[r("div",UD,[s.paymentUrl?(d(),E(u,{key:0,text:s.paymentUrl,tooltipText:o.translate("Copy Link"),placeholder:o.translate("No payment link available,Please setup custom checkout page!")},null,8,["text","tooltipText","placeholder"])):(d(),E(A,{key:1,target:"_blank",link:"",tag:"router-link",to:{name:"pages_setup"}},{default:i(()=>[R(h(o.translate("Create a custom checkout page to generate custom links.")),1)]),_:1}))]),s.selectedMethod==="paypal"&&s.use_vendor_checkout?(d(),E(y,{key:0,class:"el-form--label-top",gutter:20},{default:i(()=>[l(g,{md:24,lg:11},{default:i(()=>[l(m,{label:o.translate("PayPal Business/Seller Email")},{default:i(()=>[l(f,{modelValue:s.business_email,"onUpdate:modelValue":t[0]||(t[0]=B=>s.business_email=B),placeholder:o.translate("Enter your PayPal business/seller email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),l(g,{md:24,lg:11},{default:i(()=>[l(m,{label:o.translate("PayPal Buyer Email (optional)")},{default:i(()=>[l(f,{modelValue:s.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=B=>s.buyer_email=B),placeholder:o.translate("Enter The buyer email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0),s.use_vendor_checkout?(d(),_("div",$D,[l(A,{type:"primary",onClick:o.getPaymentLink},{default:i(()=>[R(h(o.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):x("",!0)],8,ED)),[[v,s.fetchLink]])}const QD=He(FD,[["render",DD]]),ID={class:"fct-single-order-loader-wrap fct-layout-width"},TD={class:"single-page-header fct-page-loader-header flex items-start justify-between"},VD={class:"single-page-body"},MD={class:"fct-single-order"},LD={class:"fct-single-order-main"},RD={class:"fct-single-order-aside"},OD={class:"fct-admin-sidebar"},HD={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton");return d(),_("div",ID,[r("div",TD,[l(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:i(()=>[l(n,{class:"max-w-180"}),l(n,{class:"max-w-[100px]"})]),_:1}),l(s,{animated:"",class:"flex gap-2 max-w-180"},{template:i(()=>[l(n,{class:"w-1/4"}),l(n,{class:"w-3/4"})]),_:1})]),r("div",VD,[r("div",MD,[r("div",LD,[l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:3})]),_:1})]),_:1}),l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:3})]),_:1})]),_:1}),l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:3})]),_:1})]),_:1}),l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:3})]),_:1})]),_:1})]),r("div",RD,[r("div",OD,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:3})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},PD={name:"_Plans.vue",components:{Badge:qt},props:["subscription","header","order","getOrderUrl"],data(){return{}},computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:c}},ND={class:"fct-subscription-plan-wrap"},KD={class:"fct-subs-status-wrap float-end"},GD={class:"fct-subs-title underline"},jD=["innerHTML"],zD={key:0,class:"cursor-pointer"};function YD(e,t,a,n,s,o){var f,m,g,y;const u=C("Badge"),A=C("router-link");return d(),_("div",ND,[r("div",KD,[l(u,{status:o.subscriptionStatus},null,8,["status"])]),l(A,{to:{name:"view_subscription",params:{subscription_id:(f=a.subscription)==null?void 0:f.id}}},{default:i(()=>{var v;return[r("p",GD,h(e.$t((v=a.subscription)==null?void 0:v.item_name)),1)]}),_:1},8,["to"]),r("p",{innerHTML:(m=a.subscription)==null?void 0:m.payment_info},null,8,jD),parseInt((g=a.order)==null?void 0:g.parent_id)?(d(),_("p",zD,[R(h(o.translate("Parent Order:"))+" ",1),r("a",{onClick:t[0]||(t[0]=v=>{var B;return a.getOrderUrl((B=a.order)==null?void 0:B.parent_id)})},"#"+h((y=a.order)==null?void 0:y.parent_id),1)])):x("",!0)])}const sm=He(PD,[["render",YD]]),qD={name:"SubscriptionPlanItem",components:{CardContainer:he,CardHeader:Ce,CardBody:me,Plans:sm,Refresh:Zd,Delete:Is,DynamicIcon:W,CancelSubscription:Eh},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,n;const e=(((a=this.subscription)==null?void 0:a.status)||"").toLowerCase();return{canFetch:!0,canPause:!1,canResume:!1,canCancel:((n=this.subscription)==null?void 0:n.vendor_subscription_id)&&!["canceled"].includes(e)}},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"||Ea.confirm("Fetch from remote and update the subscription?","Warning",{type:"warning",icon:pl(Is),cancelButtonText:"Back",confirmButtonText:"Fetch subscription!",beforeClose:async(t,a,n)=>{var s,o;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(u){this.$notify({type:"error",title:"Error",message:c(((o=(s=u.response)==null?void 0:s.data)==null?void 0:o.message)||"Failed to fetch subscription")})}finally{a.confirmButtonLoading=!1,this.loadingState.fetch=!1,n()}else n()}})},confirmPause(){this.subscription.vendor_subscription_id&&Ea.prompt("Pause the active subscription?","Warning",{type:"warning",icon:pl(Is),inputPlaceholder:"Enter reason for pausing",inputPattern:/.+/,inputErrorMessage:"Reason is required",cancelButtonText:"Back",confirmButtonText:"Pause Subscription!",beforeClose:async(e,t,a)=>{var n,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(o){this.$notify({type:"error",title:"Error",message:c(((s=(n=o.response)==null?void 0:n.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&&Ea.prompt(c("Resume the paused subscription?"),c("Warning"),{type:"warning",icon:pl(Is),inputPlaceholder:c("Enter reason for resuming"),inputPattern:/.+/,inputErrorMessage:c("Reason is required"),cancelButtonText:c("Back"),confirmButtonText:c("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&&Ea.confirm("Reactivate the canceled subscription?","Warning",{type:"warning",icon:pl(Is),cancelButtonText:"Back",confirmButtonText:c("Reactivate Subscription!"),beforeClose:async(e,t,a)=>{var n,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(o){this.$notify({type:"error",title:"Error",message:c(((s=(n=o.response)==null?void 0:n.data)==null?void 0:s.message)||"Failed to reactivate subscription")})}finally{t.confirmButtonLoading=!1,this.loadingState.reactivate=!1,a()}else a()}})}}},WD={class:"more-btn"},XD={class:"text-red-600"};function JD(e,t,a,n,s,o){const u=C("DynamicIcon"),A=C("Refresh"),f=C("el-icon"),m=C("el-dropdown-item"),g=C("Delete"),y=C("el-dropdown-menu"),v=C("el-dropdown"),B=C("CardHeader"),b=C("Plans"),w=C("CardBody"),k=C("CardContainer"),S=C("CancelSubscription");return d(),_(H,null,[l(k,null,{default:i(()=>[l(B,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},{default:i(()=>[o.permissions.canFetch||o.permissions.canPause||o.permissions.canResume||o.permissions.canCancel?(d(),E(v,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t[0]||(t[0]=M=>o.handleSubscriptionAction(M))},{dropdown:i(()=>[l(y,null,{default:i(()=>[o.permissions.canFetch?(d(),E(m,{key:0,command:"fetch_subscription"},{default:i(()=>[l(f,null,{default:i(()=>[l(A)]),_:1}),R(" "+h(e.$t("Fetch subscription -"))+" "+h(o.paymentMethod),1)]),_:1})):x("",!0),o.permissions.canPause?(d(),E(m,{key:1,command:"pause_subscription"},{default:i(()=>[l(f,null,{default:i(()=>[l(A)]),_:1}),R(" "+h(e.$t("Pause subscription -"))+" "+h(o.paymentMethod),1)]),_:1})):x("",!0),o.permissions.canResume?(d(),E(m,{key:2,command:"resume_subscription"},{default:i(()=>[l(f,null,{default:i(()=>[l(A)]),_:1}),R(" "+h(e.$t("Resume subscription -"))+" "+h(o.paymentMethod),1)]),_:1})):x("",!0),o.permissions.canCancel?(d(),E(m,{key:3,command:"cancel_subscription"},{default:i(()=>[l(f,null,{default:i(()=>[l(g)]),_:1}),r("span",XD,h(e.$t("Cancel subscription")),1)]),_:1})):x("",!0)]),_:1})]),default:i(()=>[r("span",WD,[l(u,{name:"More"})])]),_:1})):x("",!0)]),_:1},8,["title"]),l(w,null,{default:i(()=>[l(b,{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}),l(S,{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:o.confirmCancel},null,8,["subscription","orderId","modelValue","onCancelSubscription"])],64)}const ZD=He(qD,[["render",JD]]),eQ={name:"OrderBulkActions",components:{DynamicIcon:W},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:c,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(c("Are you sure you want to delete this order? This action can not be undone!"),c("Confirm Deleting"),{confirmButtonText:c("Yes, Delete"),cancelButtonText:c("Cancel"),cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteOrder()})},deleteOrder(){this.deleting=!0,this.$del("orders/"+this.order.id).then(e=>{so(e.message),this.$router.replace({name:"orders"})}).catch(e=>{e.status_code=="422"?q.validationErrors(e):q.error(e==null?void 0:e.data)}).finally(()=>{this.deleting=!1})},changeShipping(){this.showModal=!0},completeOrder(){this.$confirm(c("Are you sure you want to complete this order!"),c("Please confirm"),{confirmButtonText:c("Yes, Mark order as complete!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"completed"})})},generateMissingLicenses(){this.$confirm(c("Are you sure you want to generate missing licenses!"),c("Please confirm"),{confirmButtonText:c("Yes, Generate all missing licenses!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{this.generateLicenses()})},generateLicenses(){this.doing_actions=!0,this.$post("orders/"+this.order.id+"/generate-missing-licenses",{}).then(e=>{q.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},backToProcessing(){this.$confirm(c("Are you sure you want to revert back processing this order!"),c("Please confirm"),{confirmButtonText:c("Yes, Mark order as processing!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"processing"})})},cancelOrder(){this.$confirm(c("Are you sure you want to change the order status to Cancel? This action is irreversible and cannot be undone."),c("Please confirm"),{confirmButtonText:c("Yes, Changed status to Cancel"),cancelButtonText:c("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=>{q.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.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=>{q.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},tQ={class:"fct-order-bulk-action-modal"},aQ={key:1,class:"more-btn"},nQ={key:0},sQ=["href"],lQ={class:"dialog-footer"};function oQ(e,t,a,n,s,o){const u=C("DynamicIcon"),A=C("el-button"),f=C("el-dropdown-item"),m=C("el-tooltip"),g=C("el-dropdown-menu"),y=C("el-dropdown"),v=C("el-option"),B=C("el-select"),b=C("el-form-item"),w=C("el-form"),k=C("el-dialog");return d(),_("div",tQ,[l(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:o.handleCommandAction},{dropdown:i(()=>[l(g,null,{default:i(()=>{var S,M;return[a.trigger_action!=="add"?(d(),_("div",nQ,[!s.isCancelled&&((S=a.order)==null?void 0:S.fulfillment_type)==="physical"?(d(),E(f,{key:0,command:"shipping_status"},{default:i(()=>[l(u,{name:"ShipmentStatus"}),R(" "+h(o.translate("Change Shipping Status")),1)]),_:1})):x("",!0),a.order.mode==="test"||s.isCancelled?(d(),E(f,{key:1,command:"delete_order",class:"item-destructive"},{default:i(()=>[l(u,{name:"Delete"}),R(" "+h(o.translate("Delete order")),1)]),_:1})):x("",!0),a.order.status==="processing"?(d(),E(f,{key:2,command:"order_complete"},{default:i(()=>[l(u,{name:"Check"}),R(" "+h(o.translate("Mark As Complete")),1)]),_:1})):x("",!0),s.isCancelled?x("",!0):(d(),E(f,{key:3,command:"order_cancel"},{default:i(()=>[l(u,{name:"Cross"}),R(" "+h(o.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(d(),E(f,{key:4,command:"order_processing"},{default:i(()=>[l(u,{name:"Refresh"}),R(" "+h(o.translate("Back to processing")),1)]),_:1})):x("",!0),!s.isCompleted&&!s.isCancelled?(d(),E(f,{key:5,command:"sync_order_statuses"},{default:i(()=>[l(u,{name:"Refresh"}),R(" "+h(o.translate("Sync Order Statuses")),1)]),_:1})):x("",!0),l(f,{command:"order_receipt",class:"item-link"},{default:i(()=>[r("a",{target:"_blank",href:a.order.receipt_url},[l(u,{name:"External"}),R(" "+h(o.translate("Receipt")),1)],8,sQ)]),_:1}),(M=a.order)!=null&&M.has_missing_licenses?(d(),E(f,{key:6,command:"generate_missing_licenses"},{default:i(()=>[l(u,{name:"Files"}),R(" "+h(o.translate("Generate missing licenses")),1)]),_:1})):x("",!0),a.shouldShowRefund?(d(),E(f,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:i(()=>[l(u,{name:"Money"}),R(" "+h(o.translate("Refund")),1)]),_:1})):x("",!0),l(f,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:s.shouldDisableEditing},{default:i(()=>[l(u,{name:"Edit"}),a.isEditingItem?(d(),_(H,{key:1},[R(h(o.translate("Disable Editing")),1)],64)):(d(),_(H,{key:0},[s.shouldDisableEditing?(d(),E(m,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:i(()=>[R(h(a.warningMessage),1)]),default:i(()=>[R(" "+h(o.translate("Edit")),1)]),_:1})):(d(),_(H,{key:1},[R(h(o.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):x("",!0)]}),_:1})]),default:i(()=>[a.triggerMode==="button"?(d(),E(A,{key:0},{default:i(()=>[R(h(o.translate("More Action"))+" ",1),l(u,{name:"ChevronDown"})]),_:1})):(d(),_("span",aQ,[l(u,{name:"More"})]))]),_:1},8,["onCommand"]),l(k,{modelValue:s.showModal,"onUpdate:modelValue":t[2]||(t[2]=S=>s.showModal=S),title:o.translate("Update Shipping Status")},{default:i(()=>[l(w,{data:s.status_data,"label-position":"top"},{default:i(()=>[s.selected_action==="shipping_status"||s.selected_action==="all"?(d(),E(b,{key:0,label:o.translate("Shipping Status")},{default:i(()=>[l(B,{modelValue:s.status_data.shipping_status,"onUpdate:modelValue":t[0]||(t[0]=S=>s.status_data.shipping_status=S),placeholder:o.translate("Select Shipping Status")},{default:i(()=>[(d(!0),_(H,null,ee(e.appVars.shipping_statuses,(S,M)=>(d(),E(v,{key:M,label:S,value:M},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]),r("span",lQ,[l(A,{onClick:t[1]||(t[1]=S=>o.changeShippingStatus()),type:"primary"},{default:i(()=>[R(h(o.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const xu=He(eQ,[["render",oQ]]),rQ={name:"Transaction",computed:{Str(){return Gt}},components:{ConvertedTime:$a,ArrowDown:pl(Pr),Check:np,Badge:qt,DynamicIcon:W},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}},methods:{translate:c,getCardBrand:tp,translateNumber:Kt,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")}}},iQ={key:0,class:"fct-transaction-details -mt-[1px]"},dQ={class:"fct-table-wrap"},uQ={class:"p-0 m-0 text-xs text-gray-500"},cQ={key:0},AQ=["href"],pQ={class:"flex items-center gap-2.5"},fQ={key:0,class:"w-7"},mQ=["title","src","alt"],hQ={key:1,class:"capitalize"},_Q={key:2},gQ={class:"text-sm"},vQ={class:"text-sm text-gray-700"},yQ={class:"text-sm flex gap-2"},bQ=["href"];function wQ(e,t,a,n,s,o){var S,M;const u=C("ConvertedTime"),A=C("el-table-column"),f=C("Badge"),m=C("el-tooltip"),g=C("el-button"),y=C("el-table"),v=C("el-form-item"),B=C("el-input"),b=C("el-form"),w=C("DynamicIcon"),k=C("el-dialog");return a.transactions.length>0?(d(),_("div",iQ,[r("div",dQ,[l(y,{data:a.transactions,class:"w-full"},{default:i(()=>[l(A,{label:o.translate("# Date"),width:"auto"},{default:i($=>[r("div",null,[r("p",uQ,"#"+h(o.translateNumber($.row.id)),1),l(u,{"date-time":$.row.created_at},null,8,["date-time"])])]),_:1},8,["label"]),l(A,{label:o.translate("Gateway ID"),width:"160"},{default:i($=>[$.row.vendor_charge_id==""?(d(),_("span",cQ,"--")):(d(),_("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:$.row.url},h($.row.vendor_charge_id),9,AQ))]),_:1},8,["label"]),l(A,{label:o.translate("Payment Method"),width:"140"},{default:i($=>[r("div",pQ,[o.getCardBrand($.row.card_brand,$.row.payment_method_type)?(d(),_("div",fQ,[r("img",{class:"w-full",title:$.row.payment_method,src:o.getCardBrand($.row.card_brand,$.row.payment_method_type),alt:$.row.card_brand},null,8,mQ)])):(d(),_("span",hQ,h($.row.payment_method_type),1)),$.row.card_last_4&&$.row.card_last_4!="0"?(d(),_("span",_Q,h("..."+$.row.card_last_4),1)):x("",!0)])]),_:1},8,["label"]),l(A,{label:o.translate("Total"),width:"auto"},{default:i($=>[r("span",null,h(e.formatNumberForOrder($.row.total,a.orderCurrency)),1)]),_:1},8,["label"]),l(A,{label:o.translate("Status"),width:"120"},{default:i($=>{var F,L,Q,T,D,U;return[$.row.transaction_type=="dispute"?(d(),E(m,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((L=(F=$.row)==null?void 0:F.meta)==null?void 0:L.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:i(()=>[l(f,{class:"m-2 b-red",status:"dispute"},{default:i(()=>t[3]||(t[3]=[R(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):x("",!0),(T=(Q=$.row)==null?void 0:Q.meta)!=null&&T.reason?(d(),E(m,{key:1,effect:"dark",placement:"top",content:o.translate((U=(D=$.row)==null?void 0:D.meta)==null?void 0:U.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:i(()=>{var I,O,P,K;return[((O=(I=$.row)==null?void 0:I.meta)==null?void 0:O.disputed)=="yes"&&((K=(P=$.row)==null?void 0:P.meta)==null?void 0:K.dispute_resolved)=="no"?(d(),E(f,{key:0,status:$.row.status},{default:i(()=>{var G;return[R(h($.row.status)+" "+h((G=$==null?void 0:$.row)==null?void 0:G.transaction_type),1)]}),_:2},1032,["status"])):(d(),E(f,{key:1,status:$.row.status},{default:i(()=>[R(h($.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(d(),E(f,{key:2,status:$.row.status},{default:i(()=>[R(h($.row.status),1)]),_:2},1032,["status"]))]}),_:1},8,["label"]),o.hasDisputedTransaction(a.transactions)?(d(),E(A,{key:0,label:o.translate("Actions"),width:"140"},{default:i($=>[$.row.transaction_type=="dispute"&&$.row.status=="succeeded"?(d(),E(g,{key:0,type:"warning",size:"small",onClick:F=>o.handleDispute($.row)},{default:i(()=>[R(h(o.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]),l(k,{modelValue:s.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=$=>s.disputeHandleModal=$),title:"Handle Dispute #"+((M=(S=s.disputeTransaction)==null?void 0:S.meta)==null?void 0:M.dispute_id),width:"800px"},{footer:i(()=>{var $,F,L,Q,T,D;return[r("a",{href:($=s.disputeTransaction)==null?void 0:$.url,target:"_blank",class:"el-button el-button--warning is-link"},h(o.translate("See dispute on ")+((F=s.disputeTransaction)==null?void 0:F.payment_method)),9,bQ),(Q=(L=s.disputeTransaction)==null?void 0:L.meta)!=null&&Q.is_charge_refundable?(d(),E(g,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:s.loadingDisputeAction},{default:i(()=>[R(h(o.translate("Refund customer")),1)]),_:1},8,["loading"])):x("",!0),(D=(T=s.disputeTransaction)==null?void 0:T.meta)!=null&&D.is_dispute_actionable?(d(),E(g,{key:1,type:"primary",onClick:o.handleDisputeSubmit,loading:s.loadingDisputeAction},{default:i(()=>[R(h(o.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):x("",!0)]}),default:i(()=>{var $,F,L,Q,T,D;return[(F=($=s.disputeTransaction)==null?void 0:$.meta)!=null&&F.dispute_reason?(d(),E(v,{key:0},{default:i(()=>{var U,I;return[r("div",gQ," Dispute Reason: "+h((I=(U=s.disputeTransaction)==null?void 0:U.meta)==null?void 0:I.dispute_reason),1)]}),_:1})):x("",!0),l(v,null,{default:i(()=>[r("div",vQ,h(o.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=(L=s.disputeTransaction)==null?void 0:L.meta)!=null&&Q.is_dispute_actionable?(d(),E(b,{key:1,model:s.disputeForm,"label-position":"top"},{default:i(()=>[l(v,{label:o.translate("Note"),prop:"dispute_note"},{default:i(()=>[l(B,{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"])):x("",!0),(D=(T=s.disputeTransaction)==null?void 0:T.meta)!=null&&D.is_charge_refundable?(d(),E(v,{key:2},{default:i(()=>[r("div",yQ,[l(w,{class:"w-6 h-6",name:"Information"}),R(" "+h(o.translate("This dispute has refundable action, so you may refund the charge to the customer for a dispute resolution.")),1)])]),_:1})):x("",!0)]}),_:1},8,["modelValue","title"])])):x("",!0)}const Su=He(rQ,[["render",wQ]]),Fu=(e,t,a=0)=>{let n=0,s=0;return t&&(e.manual_discount_total=0),e.order_items&&e.order_items.forEach((o,u)=>{let A=o.updateStock||0;o.quantity<1?o.quantity=1:A!=0&&parseInt(o.quantity)>A&&(o.quantity=A),o.total=o.unit_price*o.quantity;let f=o.unit_price*o.quantity;if(o.subtotal=f-o.cost,e.manual_discount_total>0?o.discount_total=o.discount_total:t===!0?s+=o.discount_total:(!e.manual_discount_total===0?e.manual_discount_total-=o.discount_total:e.manual_discount_total=0,o.discount_total=0),o.line_total=f-o.discount_total,n+=f,o.payment_type=="subscription"&&o.other_info.manage_setup_fee=="yes"){let m=parseInt(o.other_info.signup_fee);o.other_info.setup_fee_per_item=="yes"&&(m=m*o.quantity),n+=m}}),e.subtotal=n,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),CQ(e),e},yA=(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),lm(t),a=parseInt(a),a>=0&&a<=parseInt(e.subtotal)&&(e.manual_discount_total=a);let n=e.subtotal*1+e.tax_total*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total;return n>=0&&(e.total_amount=n),e},CQ=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),lm=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),BQ={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")}}},kQ={class:"fct-note-modal"},xQ={class:"dialog-footer"};function SQ(e,t,a,n,s,o){const u=C("el-input"),A=C("el-form-item"),f=C("el-form"),m=C("el-button");return d(),_("div",kQ,[l(f,{"label-position":"top"},{default:i(()=>[l(A,null,{default:i(()=>[l(u,{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}),r("div",xQ,[l(m,{type:"info",soft:"",onClick:o.closeModal},{default:i(()=>[R(h(e.$t("Cancel")),1)]),_:1},8,["onClick"]),l(m,{type:"primary",onClick:o.saveNote},{default:i(()=>[R(h(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const om=He(BQ,[["render",SQ]]),FQ={class:"fct-admin-sidebar-item"},EQ={key:0},UQ={name:"Notes",components:{IconButton:Oe,NoteModal:om,DynamicIcon:W},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=>{q.success(a.message),this.noteCopy=e}).catch(a=>{q.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},ii=Object.assign(UQ,{setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton"),o=C("el-button"),u=C("el-dialog");return d(),_("div",null,[e.orderId?(d(),E(he,{key:0},{default:i(()=>[l(Ce,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:i(()=>[e.shouldEnableEditing?(d(),E(Oe,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=A=>t.noteModalIsOpen=!0)},{default:i(()=>[l(W,{name:"Edit"})]),_:1})):x("",!0)]),_:1},8,["title"]),l(me,{class:de(t.noteNeedsCollapse?"pb-0":"")},{default:i(()=>[r("div",FQ,[t.loading?(d(),E(s,{key:0,animated:""},{template:i(()=>[l(n,{variant:"p"})]),_:1})):(d(),_(H,{key:1},[r("span",null,h(t.noteCopy?t.noteTextToDisplay:t.$t("No notes")),1),t.noteNeedsCollapse?(d(),E(o,{key:0,class:"fct-show-more-button",onClick:t.toggleNoteText,text:""},{default:i(()=>[t.isNoteExpanded?(d(),_(H,{key:0},[R(h(t.$t("Show less"))+" ",1),l(W,{name:"ChevronUp"})],64)):(d(),_(H,{key:1},[R(h(t.$t("Show more"))+" ",1),l(W,{name:"ChevronDown"})],64))]),_:1},8,["onClick"])):x("",!0)],64))])]),_:1},8,["class"])]),_:1})):x("",!0),l(u,{"append-to-body":!0,width:"45%",modelValue:t.noteModalIsOpen,"onUpdate:modelValue":a[2]||(a[2]=A=>t.noteModalIsOpen=A),title:t.noteCopy?t.$t("Edit Note"):t.$t("Add Note")},{default:i(()=>[t.noteModalIsOpen?(d(),_("div",EQ,[l(om,{note:t.noteCopy,onWhenNoteEditIsDone:t.saveNoteModal,onCloseModal:a[1]||(a[1]=A=>t.noteModalIsOpen=!1)},null,8,["note","onWhenNoteEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])])}}}),$Q={name:"Coupon",components:{IconButton:Oe,DynamicIcon:W},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:c,searchCoupon(e,t){this.fetchCoupon(e,t)},fetchCoupon(e="",t=()=>{}){this.$get("coupons",{search:e,select:"code",scopes:["active"]}).then(a=>{var o;const n=(o=a.coupons)==null?void 0:o.data;this.availableCoupons=n.map(u=>u.code);const s=this.availableCoupons.filter(u=>u.toLowerCase().includes(e.toLowerCase())).map(u=>({value:u}));t(s)}).catch(a=>{var n;a.status_code=="422"?q.validationErrors(a):q.error((n=a.data)==null?void 0:n.message)}).finally(()=>{})},applyCoupon(){if(this.coupons&&this.coupons.find(e=>e.code===this.newCoupon)){q.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"?q.validationErrors(e):q.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 n;a.status_code=="422"?q.validationErrors(a):q.error((n=a.data)==null?void 0:n.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"?q.validationErrors(e):q.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 n=Object.values(e.calculated_items);this.order.order_items.forEach((s,o)=>{const u=n.find(A=>A.id==s.object_id||A.id==s.id);u!=null&&(this.order.order_items[o].price=u.price,this.order.order_items[o].unit_price=u.unit_price,this.order.order_items[o].line_total=u.unit_price*u.quantity-u.discount_total,t+=this.order.order_items[o].line_total,a+=u.discount_total,this.order.order_items[o].line_total_formatted=u.line_total_formatted,this.order.order_items[o].discount_total=u.discount_total,this.order.order_items[o].coupon_discount=u.coupon_discount||0,this.order.order_items[o].line_meta&&(this.order.order_items[o].line_meta.coupon_discount=u.coupon_discount||0))}),this.order.applied_coupon=e.applied_coupons,this.hasCoupon=this.coupons.length>0,Fu(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},DQ={colspan:"3"},QQ={class:"fct-add-coupon-wrap"},IQ={key:0,class:"fct-add-coupon-input-label"},TQ={key:1,class:"fct-add-coupon-input-label"},VQ={key:2,class:"fct-add-coupon-input-wrap"},MQ={class:"flex gap-0.5 items-center"};function LQ(e,t,a,n,s,o){const u=C("el-autocomplete"),A=C("el-button"),f=C("el-alert"),m=C("DynamicIcon"),g=C("IconButton"),y=C("el-popconfirm");return d(),_(H,null,[r("tr",null,[r("td",DQ,[r("div",QQ,[a.action==="create_order"?(d(),_("div",IQ,h(e.$t("Have a Coupon?")),1)):(d(),_("div",TQ,h(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(d(),_("div",VQ,[l(u,{modelValue:s.newCoupon,"onUpdate:modelValue":t[0]||(t[0]=v=>s.newCoupon=v),"fetch-suggestions":o.searchCoupon,"trigger-on-focus":!1,clearable:"",class:"w-full",placeholder:e.$t("Enter coupon code")},null,8,["modelValue","fetch-suggestions","placeholder"]),l(A,{onClick:o.applyCoupon,type:"info",soft:"",class:"el-button--x-small"},{default:i(()=>[R(h(e.$t("Apply")),1)]),_:1},8,["onClick"])])):x("",!0),!s.hasCoupon&&a.shouldManageCoupon?(d(),E(f,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):x("",!0),t[1]||(t[1]=r("span",null,null,-1))])])]),(d(!0),_(H,null,ee(s.coupons,v=>(d(),_("tr",{key:v.id,class:"fct-coupons-applied-row"},[r("td",null,[r("div",MQ,[r("span",null,h(v.code),1),a.action==="create_order"?(d(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Xe(B=>o.cancelCoupon(v.id,v),["prevent"]),class:"coupon-delete-btn"},{default:i(()=>[l(m,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),a.action==="edit_order"?(d(),E(y,{key:1,icon:"InfoFilled","icon-color":"#626AEF",title:o.translate("Are you sure to cancel this coupon? This action is not recoverable"),onConfirm:B=>o.cancelCoupon(v.id,v),width:"250"},{reference:i(()=>[a.shouldManageCoupon?(d(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",class:"coupon-delete-btn"},{default:i(()=>[l(m,{name:"Delete"})]),_:1})):x("",!0)]),_:2},1032,["title","onConfirm"])):x("",!0)])]),t[2]||(t[2]=r("td",null,null,-1)),r("td",null,"- "+h(e.formatNumberForOrder(v.amount,a.order)),1)]))),128))],64)}const di=He($Q,[["render",LQ]]),RQ={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=Kl({...e.discount}),n=V([{label:c("Amount"),value:"amount"}]),s=V("");return{discountOptions:n,applyDiscount:()=>{const f=parseInt(a.value);isNaN(f)||f<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{s.value="";const f=parseInt(a.value);let m=f||0;const g=e.totalAmount/100;return a.type=="percentage"?(m=g*f/100,(f>100||m>g)&&(s.value=c("Discount should not exceed the full product price (100%).")),isNaN(f)||f<1||f>100):(m>g&&(s.value=c("Discount should not exceed the full product price (%s).",oh(g))),isNaN(f)||f<1||m>g)},error:s}}},OQ={class:"fct-discount-modal"},HQ=["innerHTML"],PQ={key:1},NQ={style:{color:"red"}},KQ={class:"form-note"},GQ={class:"dialog-footer"};function jQ(e,t,a,n,s,o){const u=C("el-option"),A=C("el-select"),f=C("el-form-item"),m=C("el-col"),g=C("el-input"),y=C("el-row"),v=C("el-form"),B=C("el-button");return d(),_("div",OQ,[l(v,{"label-position":"top"},{default:i(()=>[l(y,{gutter:20},{default:i(()=>[l(m,{md:12,sm:12,xs:24},{default:i(()=>[l(f,{label:e.$t("Discount type")},{default:i(()=>[l(A,{modelValue:n.initialDiscount.type,"onUpdate:modelValue":t[0]||(t[0]=b=>n.initialDiscount.type=b),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=b=>{n.error=""})},{default:i(()=>[(d(!0),_(H,null,ee(n.discountOptions,b=>(d(),E(u,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),l(m,{md:12,sm:12,xs:24},{default:i(()=>[l(f,{label:e.$t("Discount value")},{default:i(()=>[l(g,{type:"number",min:1,modelValue:n.initialDiscount.value,"onUpdate:modelValue":t[2]||(t[2]=b=>n.initialDiscount.value=b),modelModifiers:{number:!0},onKeyup:n.isDisabledApplyButton},{prefix:i(()=>[n.initialDiscount.type==="amount"?(d(),_("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,HQ)):(d(),_("span",PQ,"%"))]),_:1},8,["modelValue","onKeyup"]),r("span",NQ,h(n.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),l(y,null,{default:i(()=>[l(m,{md:24,sm:12,xs:24},{default:i(()=>[l(f,{label:e.$t("Reason for discount")},{default:i(()=>[l(g,{modelValue:n.initialDiscount.reason,"onUpdate:modelValue":t[3]||(t[3]=b=>n.initialDiscount.reason=b),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),r("div",KQ,[r("p",null,h(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),r("div",GQ,[l(B,{type:"info",onClick:n.cancelDiscount,soft:""},{default:i(()=>[R(h(e.$t("Cancel")),1)]),_:1},8,["onClick"]),l(B,{type:"primary",disabled:n.isDisabledApplyButton(),onClick:n.applyDiscount},{default:i(()=>[R(h(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const zQ=He(RQ,[["render",jQ]]),YQ={name:"CustomDiscount",components:{IconButton:Oe,DynamicIcon:W,DiscountModal:zQ},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:c,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()?c("Prorate Credit"):c("Discount"):this.order.manual_discount_total!==0?c("Edit Discount"):c("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={},yA(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,yA(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},qQ={key:0},WQ={key:1},XQ={key:2},JQ={style:{"font-size":"12px",color:"rgb(107,114,128)"}},ZQ={style:{"padding-left":"16px"}},e6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},t6={style:{"padding-left":"16px"}},a6={key:0};function n6(e,t,a,n,s,o){const u=C("DynamicIcon"),A=C("DiscountModal"),f=C("el-dialog");return d(),_(H,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(d(),_("tr",qQ,[r("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(d(),_("a",{key:0,href:"#",onClick:t[0]||(t[0]=Xe(m=>o.manageDiscount(),["prevent"]))},[R(h(o.getDiscountButtonLabel())+" ",1),l(u,{name:"External"})])):(d(),_("span",WQ,h(o.getDiscountButtonLabel()),1)),s.discount.label?(d(),_("span",XQ,h(s.discount.label),1)):x("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(d(),_(H,{key:3},[t[4]||(t[4]=R(" | ",-1)),r("a",{href:"#",onClick:t[1]||(t[1]=Xe(m=>o.removeDiscount(),["prevent"]))},h(o.translate("Remove Discount")),1)],64)):x("",!0)]),r("td",null,h(s.discount.reason?s.discount.reason:"__"),1),r("td",null,[r("span",null,"- "+h(e.formatNumberForOrder(a.order.manual_discount_total,a.order)),1)])])):x("",!0),a.order.config&&a.order.config.prorate_credit>0&&a.order.manual_discount_total-a.order.config.prorate_credit>0?(d(),_(H,{key:1},[r("tr",JQ,[r("td",ZQ,h(o.translate("Upgrade Discount")),1),t[5]||(t[5]=r("td",null,null,-1)),r("td",null,h(e.formatNumberForOrder(a.order.manual_discount_total-a.order.config.prorate_credit,a.order)),1)]),r("tr",e6,[r("td",t6,h(o.translate("Prorate Credit")),1),t[6]||(t[6]=r("td",null,null,-1)),r("td",null,h(e.formatNumberForOrder(a.order.config.prorate_credit,a.order)),1)])],64)):x("",!0),l(f,{"append-to-body":!0,width:"50%",modelValue:s.discountModalIsOpen,"onUpdate:modelValue":t[3]||(t[3]=m=>s.discountModalIsOpen=m),title:a.order.manual_discount_total===0?o.translate("Add discount"):o.translate("Edit discount")},{default:i(()=>[s.discountModalIsOpen?(d(),_("div",a6,[l(A,{discount:s.discount,totalAmount:a.order.subtotal,onWhenDiscountEditIsDone:o.applyDiscount,onEmitCancelDiscountModal:t[2]||(t[2]=m=>s.discountModalIsOpen=!1)},null,8,["discount","totalAmount","onWhenDiscountEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])],64)}const ui=He(YQ,[["render",n6]]),s6={name:"ShippingModal",props:["shipping","shipping_type"],setup(e,{emit:t}){const a=V(e.shipping_type);return{availableOptions:V([{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 A=parseInt(e.shipping.custom_price);return isNaN(A)||A<0},shippingType:a}}},l6={class:"fct-shipping-modal"},o6=["innerHTML"],r6={class:"dialog-footer"};function i6(e,t,a,n,s,o){const u=C("el-radio"),A=C("el-radio-group"),f=C("el-form-item"),m=C("el-col"),g=C("el-row"),y=C("el-input"),v=C("el-form"),B=C("el-button");return d(),_("div",l6,[l(v,{"label-position":"top","require-asterisk-position":"right"},{default:i(()=>[l(g,{gutter:20},{default:i(()=>[l(m,{md:24,sm:24,xs:24},{default:i(()=>[l(f,{label:e.$t(""),required:""},{default:i(()=>[l(A,{modelValue:n.shippingType,"onUpdate:modelValue":t[0]||(t[0]=b=>n.shippingType=b)},{default:i(()=>[(d(!0),_(H,null,ee(n.availableOptions,(b,w)=>(d(),E(u,{label:b.value,key:w},{default:i(()=>[R(h(b.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n.shippingType==="custom"?(d(),E(g,{key:0,gutter:15},{default:i(()=>[l(m,{md:12,sm:12,xs:24},{default:i(()=>[l(f,{label:e.$t("Name")},{default:i(()=>[l(y,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=b=>a.shipping.rate_name=b)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),l(m,{md:12,sm:12,xs:24},{default:i(()=>[l(f,{label:e.$t("Price")},{default:i(()=>[l(y,{type:"number",min:1,modelValue:a.shipping.custom_price,"onUpdate:modelValue":t[2]||(t[2]=b=>a.shipping.custom_price=b),modelModifiers:{number:!0},onKeyup:n.isDisabledApplyButton},{prefix:i(()=>[r("span",{innerHTML:e.appVars.shop.currency_sign},null,8,o6)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0)]),_:1}),r("div",r6,[a.shipping.type?(d(),E(B,{key:0,type:"danger",onClick:n.removeShipping},{default:i(()=>[R(h(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):x("",!0),l(B,{type:"primary",onClick:n.updatingIsDone,disabled:n.isDisabledApplyButton()},{default:i(()=>[R(h(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const d6=He(s6,[["render",i6]]),u6={name:"Shipping",components:{IconButton:Oe,DynamicIcon:W,ShippingModal:d6},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=Ie.get("currency_signs",{}),t=Ie.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:c,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?c("Shipping"):this.shipping.id!==0?c("Edit Shipping"):c("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,n=this.shippingMethods.concat(this.otherShippingMethods).find(function(s){return s.id==t});return n?n.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})}),re.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"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.shippingModalIsOpen=!1})},getShippingMethodsNotFoundMessage(){const e=this.$router.resolve({name:"shipping"}).href;return c("No shipping methods found. You can add shipping methods from %1$s here %2$s",`<a href="${e}" target="_blank" class="link-text">`,"</a>")}}},c6={key:1},A6={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},p6={key:0},f6={key:1,class:"max-w-[120px] block ml-auto text-right"},m6={key:2},h6={key:0},_6={key:0,class:"fct-shipping-methods-list-wrap"},g6={key:0,class:"charge"},v6={key:1,class:"fct-other-shipping-methods-list-wrap"},y6={key:0,class:"charge"},b6={key:1,class:"fct-no-shipping-methods-found"},w6=["innerHTML"];function C6(e,t,a,n,s,o){const u=C("DynamicIcon"),A=C("el-input"),f=C("el-radio"),m=C("el-radio-group"),g=C("el-button"),y=C("el-dialog");return d(),_(H,null,[r("tr",null,[r("td",null,[a.shouldEnableEditing&&a.order.order_items.length>0?(d(),_("a",{key:0,href:"#",onClick:t[0]||(t[0]=Xe(v=>o.showShippingModal(),["prevent"]))},[R(h(o.getShippingButtonLabel())+" ",1),l(u,{name:"External"})])):(d(),_("span",c6,h(o.getShippingButtonLabel()),1)),o.shippingTitle?(d(),_("div",A6,h(o.shippingTitle),1)):x("",!0)]),t[7]||(t[7]=r("td",null,null,-1)),r("td",null,[o.hasFreeShipping()?(d(),_("span",p6,[r("del",null,h(e.formatNumberForOrder(a.order.shipping_total,a.order)),1),R(" "+h(o.translate("Free")),1)])):x("",!0),a.shouldEnableEditing&&!o.hasFreeShipping()?(d(),_("span",f6,[l(A,{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:i(()=>[R(h(o.currency),1)]),_:1},8,["modelValue"])])):(d(),_("span",m6,h(e.formatNumberForOrder(a.order.shipping_total-(a.order.tax_summary&&a.order.tax_summary.rcShippingAdjustment?a.order.tax_summary.rcShippingAdjustment:0))),1))])]),l(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")},Rt({default:i(()=>[s.shippingModalIsOpen?(d(),_("div",h6,[s.shippingMethods.length||s.otherShippingMethods.length?(d(),_(H,{key:0},[s.shippingMethods.length?(d(),_("div",_6,[r("h3",null,h(o.translate("Shipping Methods")),1),l(m,{modelValue:s.shipping.id,"onUpdate:modelValue":t[3]||(t[3]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:i(()=>[(d(!0),_(H,null,ee(s.shippingMethods,(v,B)=>(d(),E(f,{label:v.id,key:B},{default:i(()=>[R(h(v.title)+" ",1),v.shipping_charge?(d(),_("span",g6,h(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0),s.otherShippingMethods.length?(d(),_("div",v6,[r("h3",null,h(o.translate("Other Shipping Methods")),1),l(m,{modelValue:s.shipping.id,"onUpdate:modelValue":t[4]||(t[4]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:i(()=>[(d(!0),_(H,null,ee(s.otherShippingMethods,(v,B)=>(d(),E(f,{label:v.id,key:B},{default:i(()=>[R(h(v.title)+" ",1),v.shipping_charge?(d(),_("span",y6,h(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0)],64)):(d(),_("div",b6,[r("span",{innerHTML:o.getShippingMethodsNotFoundMessage()},null,8,w6)]))])):x("",!0)]),_:2},[s.shippingMethods.length||s.otherShippingMethods.length?{name:"footer",fn:i(()=>[l(g,{onClick:t[5]||(t[5]=v=>s.shippingModalIsOpen=!1)},{default:i(()=>[R(h(o.translate("Cancel")),1)]),_:1}),l(g,{type:"primary",onClick:o.updateShipping},{default:i(()=>[R(h(o.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const Eu=He(u6,[["render",C6]]),B6={key:0},k6={class:"fct-admin-sidebar-item"},x6={class:"fct-admin-summary-item-list"},S6={class:"fct-admin-summary-item"},F6={class:"font-medium"},E6={key:0,class:"fct-admin-summary-item"},U6={class:"font-medium"},$6={key:1,class:"fct-admin-summary-item"},D6={class:"font-medium"},Q6={key:2,class:"fct-admin-summary-item"},I6={class:"font-medium"},T6={key:3,class:"fct-admin-summary-item"},V6={class:"font-medium"},M6={key:4,class:"fct-admin-summary-item"},L6={class:"font-medium"},R6={key:5,class:"fct-admin-summary-item"},O6={class:"font-medium"},H6={class:"fct-admin-summary-item"},P6={class:"font-medium"},N6={name:"UtmDetails",props:{order_operation:{type:Object}}},rm=Object.assign(N6,{setup(e){return(t,a)=>e.order_operation?(d(),_("div",B6,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[r("div",k6,[r("ul",x6,[r("li",S6,[r("span",F6,h(t.$t("UTM Campaign")),1),r("span",null,h(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(d(),_("li",E6,[r("span",U6,h(t.$t("UTM Medium")),1),r("span",null,h(e.order_operation.utm_medium||"--"),1)])):x("",!0),e.order_operation.utm_source?(d(),_("li",$6,[r("span",D6,h(t.$t("UTM Source")),1),r("span",null,h(e.order_operation.utm_source||"--"),1)])):x("",!0),e.order_operation.utm_content?(d(),_("li",Q6,[r("span",I6,h(t.$t("UTM Content")),1),r("span",null,h(e.order_operation.utm_content||"--"),1)])):x("",!0),e.order_operation.utm_id?(d(),_("li",T6,[r("span",V6,h(t.$t("UTM ID")),1),r("span",null,h(e.order_operation.utm_id||"--"),1)])):x("",!0),e.order_operation.utm_term?(d(),_("li",M6,[r("span",L6,h(t.$t("UTM Term")),1),r("span",null,h(e.order_operation.utm_term||"--"),1)])):x("",!0),e.order_operation.refer_url?(d(),_("li",R6,[r("span",O6,h(t.$t("Refer Url")),1),r("span",null,h(e.order_operation.refer_url||"--"),1)])):x("",!0),Array.isArray(e.order_operation.meta)?(d(!0),_(H,{key:6},ee(e.order_operation.meta,(n,s)=>(d(),_("li",H6,[r("span",P6,h(s),1),r("span",null,h(n||"--"),1)]))),256)):x("",!0)])])]),_:1})]),_:1})])):x("",!0)}}),K6={name:"Transaction",components:{ConvertedTime:$a,Badge:qt},props:{transactions:{type:Array,required:!0},order_id:{type:Number,required:!0},orderCurrency:{type:String,default:null}},emits:["reload"],computed:{Str(){return Gt}},methods:{translate:c,getCardBrand:tp}},G6={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},j6={class:"fct-table-mobile-header"},z6={class:"fct-table-mobile-header-left"},Y6={class:"fct-table-status-col"},q6={class:"fct-table-date-col"},W6={class:"id"},X6={class:"fct-table-price-col"},J6={class:"fct-table-mobile-body"},Z6={class:"fct-table-mobile-body-list"},e9={class:"fct-table-mobile-method-col"},t9={class:"label"},a9={class:"value"},n9={class:"flex items-center gap-2.5"},s9={key:0,class:"w-7"},l9=["title","src","alt"],o9={key:1,class:"capitalize"},r9={key:2},i9={class:"fct-table-mobile-gateway-col"},d9={class:"label"},u9={class:"value"},c9={key:0},A9=["href"];function p9(e,t,a,n,s,o){const u=C("Badge"),A=C("el-tooltip"),f=C("ConvertedTime");return d(),_("div",G6,[(d(!0),_(H,null,ee(a.transactions,(m,g)=>{var y,v;return d(),_("div",{class:"fct-table-mobile-row",key:g},[r("div",j6,[r("div",z6,[r("div",Y6,[(y=m==null?void 0:m.meta)!=null&&y.reason?(d(),E(A,{key:0,effect:"dark",placement:"top",content:o.translate((v=m==null?void 0:m.meta)==null?void 0:v.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:i(()=>{var B,b;return[((B=m==null?void 0:m.meta)==null?void 0:B.disputed)==="yes"&&((b=m==null?void 0:m.meta)==null?void 0:b.dispute_resolved)==="no"?(d(),E(u,{key:0,status:m.status},{default:i(()=>[R(h(m.status==="paid"?"Completed":m.status),1)]),_:2},1032,["status"])):(d(),E(u,{key:1,status:m.status},{default:i(()=>[R(h(m.status==="paid"?"Completed":m.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(d(),E(u,{key:1,status:m.status},{default:i(()=>[R(h(m.status==="paid"?"Completed":m.status),1)]),_:2},1032,["status"]))]),r("div",q6,[r("span",W6,"#"+h(m.id),1),t[0]||(t[0]=r("span",{class:"bullet"},"•",-1)),l(f,{"date-time":m.created_at},null,8,["date-time"])])]),r("div",X6,h(e.formatNumberForOrder(m.total,a.orderCurrency)),1)]),r("div",J6,[r("ul",Z6,[r("li",e9,[r("div",t9,h(o.translate("Payment Method:")),1),r("div",a9,[r("div",n9,[o.getCardBrand(m.card_brand,m.payment_method_type)?(d(),_("div",s9,[r("img",{class:"w-full",title:m.payment_method,src:o.getCardBrand(m.card_brand,m.payment_method_type),alt:m.card_brand},null,8,l9)])):(d(),_("span",o9,h(m.payment_method_type),1)),m.card_last_4&&m.card_last_4!="0"?(d(),_("span",r9,h("..."+m.card_last_4),1)):x("",!0)])])]),r("li",i9,[r("div",d9,h(o.translate("Gateway ID:")),1),r("div",u9,[m.vendor_charge_id===""?(d(),_("span",c9,"--")):(d(),_("a",{key:1,class:"link",target:"_blank",href:m.url},h(m.vendor_charge_id),9,A9))])])])])])}),128))])}const im=He(K6,[["render",p9]]),f9={key:1,class:"fct-single-order-page"},m9={key:1,class:"fct-single-order-wrapper fct-layout-width"},h9={class:"single-page-header flex items-start justify-between"},_9={class:"single-page-header-title-wrap"},g9={class:"single-page-header-status-wrap"},v9={class:"single-page-header-text"},y9={class:"capitalize"},b9={class:"fct-btn-group sm"},w9={class:"single-page-body"},C9={class:"fct-single-order"},B9={class:"fct-single-order-main"},k9={class:"fct-card-header-title is-small"},x9={key:0,class:"fct-browse-product-form-group pb-5"},S9={class:"fct-ordered-product-list-container"},F9={key:0,class:"fct-ordered-product-list-wrapper"},E9={class:"fct-media-content-list -mt-4 w-full"},U9={class:"align-top"},$9=["rowspan"],D9={class:"product-thumbnail w-[46px] flex-shrink-0"},Q9=["href"],I9=["src","alt"],T9=["src","alt"],V9={class:""},M9={class:"product-details-content-row"},L9={class:"product-details-content-first flex flex-col"},R9={class:"product-title m-0"},O9=["href"],H9={key:0,class:"product-variation-title m-0"},P9={key:2,class:"product-subscription-info"},N9=["innerHTML"],K9={class:"product-details-price-mobile"},G9={key:0,class:"del"},j9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},z9={key:0,class:"del"},Y9={class:"fct-order-item-qty-col text-right whitespace-nowrap"},q9={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},W9={class:"product-details-quantity"},X9={key:0,class:"del"},J9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},Z9={class:"fct-order-item-price-col text-right whitespace-nowrap"},eI={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},tI={key:0,class:"flex items-center"},aI={class:"del line-through text-xs font-normal opacity-60 leading-tight"},nI={colspan:"2",class:""},sI={class:"fct-tax-badge"},lI={class:"text-right"},oI={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},rI={class:"pb-2"},iI={key:2},dI={colspan:"2",class:""},uI={class:"text-xs text-system-mid dark:text-gray-300"},cI={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},AI={colspan:"2",class:"pb-2"},pI={class:"fct-tax-badge"},fI={class:"text-right pb-2"},mI={key:4,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},hI={class:"pb-2"},_I={key:5},gI={colspan:"3"},vI={class:"product-details-action-row"},yI=["onClick"],bI=["onClick"],wI={key:1,class:"m-0 text-center"},CI={class:"fct-card-header-title is-small"},BI={class:"fct-table-border fct-table-order-details"},kI={key:0},xI={key:3},SI={key:4},FI={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},EI={key:5},UI={colspan:"3",class:"px-0"},$I={class:"fct-tax-sum-box"},DI={class:"fct-tax-sum-heading flex items-center justify-between"},QI={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},II={key:1,class:"fct-tax-sum-row"},TI={key:4,class:"fct-tax-sum-row total-pay total-payable-tax-row"},VI={key:5,class:"fct-tax-sum-row"},MI={class:"fct-tax-amount fct-tax-amount--reversed"},LI={key:6,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},RI={key:7,class:"fct-tax-sum-row fct-tax-sum-row--muted"},OI={class:"total-amount-tr"},HI={class:"payment-tr"},PI={key:6,class:"payment-tr"},NI={key:7,class:"payment-tr"},KI={class:"font-semibold"},GI={key:8,class:"payment-tr"},jI={class:"font-semibold"},zI={key:9,class:"payment-tr total-refund-owed-tr"},YI={class:"flex flex-end m-0 items-center"},qI={class:"font-semibold"},WI={class:"fct-single-order-aside"},XI={class:"fct-admin-sidebar"},JI={key:0},ZI={class:"fct-adjust-quantity-modal-content"},eT={class:"title"},tT={class:"fct-form-group"},aT={class:"dialog-footer"},nT={key:0},sT={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:xu,Alert:Na,Transaction:Su,Plans:sm,Badge:qt,Refresh:Zd,ElMessageBox:Ea,CopyToClipboard:Za,Notes:ii,Coupon:di,CustomDiscount:ui,OrderCustomerInformation:Hr,ShippingComponent:Eu,UtmDetails:rm,OrderUpDownIndicator:ZA,TransactionMobile:im,BundleProducts:su,Promotion:Yu},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},transactionType(){return"charge"},placeholderImage(){return`${Ie.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,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}},taxBreakdownShouldShow(){const e=this.taxSummary;let t=0;return 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(){Ea.confirm(c("Are you sure you want to send a payment reminder email for this order?"),c("Send Payment Reminder"),{type:"info",icon:pl(Yu),cancelButtonText:c("Cancel"),confirmButtonText:c("Send Now"),beforeClose:async(e,t,a)=>{var n;if(e==="confirm")try{t.confirmButtonLoading=!0,this.sendingPaymentReminder=!0;const s=await this.$post("email-notification/send-manual-reminder",{event:"invoice_reminder_overdue",entity_id:this.order.id});q.success(s.message||c("Payment reminder sent successfully"))}catch(s){q.error(((n=s.data)==null?void 0:n.message)||c("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,re.post("orders/"+this.order_id+"/mark-as-paid",{...this.otherData,transaction_type:this.transactionType}).then(e=>{this.markingOrderAsPaid=!1,this.transactionMedium=!1,q.success(e.message),this.fetch()}).catch(e=>{var t;this.markingOrderAsPaid=!1,e.status_code=="422"?q.validationErrors(e):q.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 n,s,o,u;const t=(n=e==null?void 0:e.variants)==null?void 0:n.media;if(t&&Array.isArray(t.meta_value)&&((s=t.meta_value[0])!=null&&s.url))return t.meta_value[0].url;const a=(u=(o=e==null?void 0:e.variants)==null?void 0:o.product_detail)==null?void 0:u.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=Ie.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?q.error(c("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():Fu(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};re.post("orders/"+this.order_id,t).then(n=>{q.success(n.message),this.fetch()}).catch(n=>{var s;n.status_code=="422"?q.validationErrors(n):q.error((s=n.data)==null?void 0:s.message)}).finally(()=>{this.loading=!1})},fetch(){this.notFound.show=!1,this.loading=!0,re.get("orders/"+this.order_id,{with:["widgets"]}).then(e=>{var t,a,n,s,o;this.coupons=e.order.applied_coupons||[],this.hasCoupon=this.coupons.length>0,this.appliedCoupons=this.coupons.map(u=>u.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=c("Order cannot be edited once it is %s",this.order.status)),this.order.payment_status==="paid"&&(this.warningMessage=c("Order cannot be edited once paid.")),this.isSubscription&&(this.warningMessage=c("Subscription Order cannot be edited.")),this.orderSettings=e.order_settings,this.widgets=e.widgets,this.selectedProducts=this.availableProducts=[],this.discount.value=((n=e.discount_meta)==null?void 0:n.value)||0,this.discount.reason=((s=e.discount_meta)==null?void 0:s.reason)||"",this.discount.type=((o=e.discount_meta)==null?void 0:o.type)||"amount",this.selectedLabels=e.selected_labels||[],this.uniqueItemsCount=rh(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}),lm(this.discount),this.order.order_items.find(u=>u.payment_type==="subscription"),this.order.order_items=this.order.order_items.map(u=>{var A;return{...u,quantity:Number(u.quantity),updated_stock:parseInt((u==null?void 0:u.available)||((A=u==null?void 0:u.variants)==null?void 0:A.available))+parseInt(u.quantity)}}),this.resetUnsaved(),this.renderActionables(),this.disableItemEditing(),ye(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(q.error(Ke.get(e,"data.message")||c("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?q.validationErrors(e):q.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){re.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"?q.validationErrors(t):q.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(n=>(n==null?void 0:n.read_status)==="unread"&&t.includes(n==null?void 0:n.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(n=>n.variants&&n.variants.other_info&&n.variants.other_info.payment_type===t?!0:!!(n.payment_type&&n.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})}),re.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:ch,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 n=this.getSubscriptionSetupFeeTaxRates(e);return n.length>0?t+=n.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(n){return n.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),n=parseInt(e.line_total||0);if(t<2||a<=0||n<=0)return!1;var s=Math.abs(a*t-n);return s>0&&s<=t},formatTaxRateBadge(e){return(e.label||c("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},(Ie.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)}},lT=Object.assign(sT,{setup(e){const t=V(),a=()=>t.value.fetchBySearch(),n=()=>{a()};return(s,o)=>{var D,U;const u=C("el-breadcrumb-item"),A=C("el-breadcrumb"),f=C("el-button"),m=C("el-tooltip"),g=C("el-input"),y=C("router-link"),v=C("el-icon"),B=C("el-dropdown-item"),b=C("el-dropdown-menu"),w=C("el-dropdown"),k=C("el-option"),S=C("el-select"),M=C("el-form-item"),$=C("el-form"),F=C("el-dialog"),L=C("el-skeleton-item"),Q=C("el-skeleton"),T=Ca("loading");return d(),_(H,null,[s.notFound.show?(d(),E(Kr,{key:0,"button-text":s.notFound.buttonText,message:s.notFound.message,route:s.notFound.route},null,8,["button-text","message","route"])):x("",!0),s.notFound.show===!1?(d(),_("div",f9,[l(Bl,{isActive:s.changes_made>=1&&!s.showRefundModal?"is-active":"",onDiscard:s.reloadOrder,onSave:s.update,loading:s.loading,saveButtonText:p(c)("Update")},null,8,["isActive","onDiscard","onSave","loading","saveButtonText"]),s.loading?(d(),E(HD,{key:0})):x("",!0),s.order?(d(),_("div",m9,[!s.loading&&s.order?(d(),_(H,{key:0},[r("div",h9,[r("div",null,[r("div",_9,[l(A,{"separator-icon":p(tn)},{default:i(()=>[l(u,{to:{name:"orders"}},{default:i(()=>[R(h(p(c)("Orders")),1)]),_:1}),s.parentOrderId?(d(),E(u,{key:0,to:{name:"view_order",params:{}}},{default:i(()=>[r("a",{onClick:o[0]||(o[0]=I=>s.getOrderUrl(s.parentOrderId))}," #"+h(s.parentOrderId),1)]),_:1})):x("",!0),l(u,null,{default:i(()=>[R(" #"+h(p(Kt)(e.order_id)),1)]),_:1})]),_:1},8,["separator-icon"]),r("div",g9,[l(qt,{status:s.order.status},null,8,["status"]),s.order.is_b2b_order?(d(),E(qt,{key:0,type:"blue",text:p(c)("B2B")},null,8,["text"])):x("",!0),l(ZA,{order:s.order},null,8,["order"])])]),r("div",v9,[l($a,{"date-time":s.order.created_at,"with-time":""},null,8,["date-time"]),o[23]||(o[23]=r("span",{class:"fct_separator"},null,-1)),s.order.invoice_no?(d(),_(H,{key:0},[r("span",null,h(s.order.invoice_no),1),o[22]||(o[22]=r("span",{class:"fct_separator"},null,-1))],64)):x("",!0),r("span",y9,h(s.order.type),1)])]),r("div",b9,[s.shouldShowRefund()?(d(),E(f,{key:0,onClick:o[1]||(o[1]=I=>s.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:i(()=>[R(h(p(c)("Refund")),1)]),_:1})):x("",!0),s.isEditingItem?(d(),E(f,{key:2,onClick:s.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:i(()=>[R(h(p(c)("Disable Editing")),1)]),_:1},8,["onClick"])):(d(),E(f,{key:1,onClick:s.enableItemEditing,disabled:s.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:i(()=>[s.shouldDisableEditing?(d(),E(m,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:i(()=>[R(h(s.warningMessage),1)]),default:i(()=>[R(" "+h(p(c)("Edit")),1)]),_:1})):(d(),_(H,{key:1},[R(h(p(c)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),l(xu,{onReload:o[2]||(o[2]=I=>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"])])]),r("div",w9,[(d(!0),_(H,null,ee(s.actionableActivities,I=>(d(),E(Na,{class:"mb-5",type:"error",key:I.id,content:I==null?void 0:I.content,closable:"",onClose:O=>s.clearActivityAction(I)},null,8,["content","onClose"]))),128)),r("div",C9,[r("div",B9,[l(he,{class:"overflow-hidden fct-order-items-card"},{default:i(()=>[l(Ce,{border_bottom:""},{title:i(()=>{var I,O;return[r("h2",k9,[R(h(p(c)("Order items"))+" ",1),((I=s.order)==null?void 0:I.fulfillment_type)==="physical"?(d(),E(qt,{key:0,status:(O=s.order)==null?void 0:O.shipping_status},{default:i(()=>{var P;return[R(h((P=s.order)==null?void 0:P.shipping_status),1)]}),_:1},8,["status"])):x("",!0)])]}),_:1}),l(me,null,{default:i(()=>[s.isEditingItem?(d(),_("div",x9,[l(g,{placeholder:p(c)("Search products..."),onKeyup:o[3]||(o[3]=I=>a()),modelValue:s.searchQuery,"onUpdate:modelValue":o[4]||(o[4]=I=>s.searchQuery=I)},{prefix:i(()=>[l(W,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),l(f,{onClick:n,type:"info",soft:"",class:"el-button--x-small"},{default:i(()=>[R(h(p(c)("Browse")),1)]),_:1})])):x("",!0),r("div",S9,[s.order.order_items.length>0?(d(),_("div",F9,[r("table",E9,[r("tbody",null,[(d(!0),_(H,null,ee(s.order.order_items,(I,O)=>{var P,K,G,ne,Y,N,oe,Z,le,te,X,ie;return d(),_(H,{key:O},[I.payment_type!=="signup_fee"&&I.payment_type!=="fee"&&((P=I==null?void 0:I.other_info)==null?void 0:P.item_status)!=="adjusted"&&s.shouldSkipAdjustmentItem(I)?(d(),_(H,{key:0},[r("tr",U9,[r("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(I)},[r("div",D9,[I!=null&&I.is_custom?(d(),_("a",{key:0,href:(K=I==null?void 0:I.other_info)==null?void 0:K.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[r("img",{src:I.featured_media!=null?I.featured_media:s.getImageUrl(I),alt:I.title,class:de([s.getClass(I),"h-full object-contain rounded"])},null,10,I9)],8,Q9)):(d(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:I==null?void 0:I.post_id}}},{default:i(()=>[r("img",{src:I.featured_media!=null?I.featured_media:s.getImageUrl(I),alt:I.title,class:de([s.getClass(I),"h-full object-contain rounded"])},null,10,T9)]),_:2},1032,["to"]))])],8,$9),r("td",V9,[r("div",M9,[r("div",L9,[r("div",R9,[I!=null&&I.is_custom?(d(),_("a",{key:0,href:(G=I==null?void 0:I.other_info)==null?void 0:G.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},h(I==null?void 0:I.post_title),9,O9)):(d(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:I==null?void 0:I.post_id}}},{default:i(()=>[R(h(I==null?void 0:I.post_title),1)]),_:2},1032,["to"]))]),(I==null?void 0:I.title)!==(I==null?void 0:I.post_title)?(d(),_("div",H9," – "+h(I==null?void 0:I.title),1)):x("",!0),I.bundle_items.length>0?(d(),E(su,{key:1,product:I},null,8,["product"])):x("",!0),(I==null?void 0:I.payment_type)==="subscription"?(d(),_("div",P9,[r("span",{innerHTML:I==null?void 0:I.payment_info},null,8,N9)])):x("",!0)])]),r("div",K9,[((ne=I==null?void 0:I.variants)==null?void 0:ne.length)>0?(d(),_("span",G9,h(s.formatNumber(I.variants.compare_price)),1)):x("",!0),I.line_meta&&I.line_meta.original_unit_price?(d(),_("span",j9,h(s.formatNumber(I.line_meta.original_unit_price)),1)):x("",!0),r("span",null,h(s.formatNumber(I.unit_price)),1),o[25]||(o[25]=r("span",null,"×",-1)),r("span",null,h(p(Kt)(I.quantity)),1),((Y=I==null?void 0:I.other_info)==null?void 0:Y.item_status)!=="adjusted"?(d(),_(H,{key:2},[o[24]||(o[24]=r("span",{class:"text-system-mid"},"·",-1)),I.coupon_discount>0?(d(),_("span",z9,h(s.formatNumber(I.subtotal)),1)):x("",!0),r("span",null,h(s.formatNumber(s.getItemDisplayLineTotal(I))),1)],64)):x("",!0)])]),r("td",Y9,[s.isEditingItem?x("",!0):(d(),_("div",q9,[r("div",W9,[((N=I==null?void 0:I.variants)==null?void 0:N.length)>0?(d(),_("span",X9,h(s.formatNumber(I.variants.compare_price)),1)):x("",!0),I.line_meta&&I.line_meta.original_unit_price?(d(),_("span",J9,h(s.formatNumber(I.line_meta.original_unit_price)),1)):x("",!0),r("span",null,h(s.formatNumber(I.unit_price)),1),o[26]||(o[26]=r("span",null,"x",-1)),r("span",null,h(p(Kt)(I.quantity)),1),s.shouldShowUnitPriceRoundingTooltip(I)?(d(),E(m,{key:2,effect:"dark",content:p(c)("Unit price is rounded for display. The line total is calculated at full precision."),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(v,{class:"fct-unit-price-rounding-icon"},{default:i(()=>[l(p(Xa))]),_:1})]),_:1},8,["content"])):x("",!0)])]))]),r("td",Z9,[r("div",eI,[((oe=I==null?void 0:I.other_info)==null?void 0:oe.item_status)!=="adjusted"?(d(),_(H,{key:0},[I.coupon_discount>0?(d(),_("div",tI,[r("span",aI,h(s.formatNumber(I.subtotal)),1)])):x("",!0),r("span",null,h(s.formatNumber(s.getItemDisplayLineTotal(I))),1)],64)):x("",!0)])])]),s.getItemTaxRates(I).length?(d(!0),_(H,{key:0},ee(s.getItemTaxRates(I),(be,se)=>{var ce,pe,De;return d(),_("tr",{key:"tax-rate-"+se,class:de(I.line_meta&&I.line_meta.tax_config&&I.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[r("td",nI,[r("span",sI,h(s.formatTaxRateBadge(be)),1)]),r("td",lI,[r("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!((pe=(ce=I.line_meta)==null?void 0:ce.tax_config)!=null&&pe.inclusive)||((De=s.orderSettings)==null?void 0:De.reverse_charge_price_mode)==="dynamic")}])},[I.line_meta&&I.line_meta.tax_config&&I.line_meta.tax_config.inclusive?(d(),_(H,{key:0},[R(h(p(c)("incl.")),1)],64)):(d(),_(H,{key:1},[R("+")],64)),R(" "+h(s.formatNumber(be.tax_amount)),1)],2)])],2)}),128)):I.tax_amount>0?(d(),_("tr",oI,[r("td",rI,h(p(c)("Tax"))+": "+h(s.formatNumber(I.tax_amount)),1)])):x("",!0),((Z=I==null?void 0:I.other_info)==null?void 0:Z.manage_setup_fee)==="yes"?(d(),_("tr",iI,[r("td",dI,[r("span",uI,h(I==null?void 0:I.other_info.signup_fee_name),1)]),r("td",cI," + "+h(s.formatNumber(((le=I==null?void 0:I.other_info)==null?void 0:le.setup_fee_per_item)==="yes"?I.other_info.signup_fee*I.quantity:I.other_info.signup_fee)),1)])):x("",!0),s.getSubscriptionSetupFeeTaxRates(I).length?(d(!0),_(H,{key:3},ee(s.getSubscriptionSetupFeeTaxRates(I),(be,se)=>{var ce;return d(),_("tr",{key:"setup-tax-rate-"+se,class:de(s.isSubscriptionSetupFeeInclusive(I)?"is-inclusive":"is-exclusive")},[r("td",AI,[r("span",pI,h(p(c)("Setup fee"))+": "+h(s.formatTaxRateBadge(be)),1)]),r("td",fI,[r("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(I)||((ce=s.orderSettings)==null?void 0:ce.reverse_charge_price_mode)==="dynamic")}])},[s.isSubscriptionSetupFeeInclusive(I)?(d(),_(H,{key:0},[R(h(p(c)("incl.")),1)],64)):x("",!0),R(h(s.formatNumber(be.tax_amount)),1)],2)])],2)}),128)):((te=I==null?void 0:I.other_info)==null?void 0:te.signup_fee_tax)>0&&((X=I==null?void 0:I.other_info)==null?void 0:X.manage_setup_fee)==="yes"?(d(),_("tr",mI,[r("td",hI,[R(h(p(c)("Setup fee tax"))+": ",1),r("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(I)||((ie=s.orderSettings)==null?void 0:ie.reverse_charge_price_mode)==="dynamic")}])},h(s.formatNumber(I.other_info.signup_fee_tax)),3)])])):x("",!0),s.isEditingItem?(d(),_("tr",_I,[r("td",gI,[r("div",vI,[r("a",{href:"#",onClick:Xe(be=>s.handleAdjustQuantityModal(I),["prevent"])},h(p(c)("Adjust Quantity")),9,yI),r("a",{href:"#",onClick:Xe(be=>s.deleteProduct(O,I),["prevent"])},h(p(c)("Remove Item")),9,bI)])])])):x("",!0),o[27]||(o[27]=r("tr",{class:"last:hidden"},[r("td",{colspan:"4",class:"pt-1"},[r("div",{class:"bg-gray-divider dark:bg-dark-400 h-[1px] w-full mb-1"})])],-1))],64)):x("",!0)],64)}),128))])])])):x("",!0),s.order.order_items.length==0?(d(),_("p",wI,h(p(c)("No items found.")),1)):x("",!0)])]),_:1})]),_:1}),l(he,{class:"fct-order-payment-card"},{default:i(()=>[l(Ce,{border_bottom:""},{title:i(()=>[r("h2",CI,[r("span",null,h(p(c)("Payment")),1),l(qt,{status:s.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),l(me,null,{default:i(()=>{var I,O,P,K,G,ne,Y;return[r("table",BI,[r("tbody",null,[r("tr",null,[r("td",null,h(p(c)("Subtotal")),1),r("td",null,[s.order.order_items.length>0?(d(),_("span",kI,h(p(Kt)(s.uniqueItemsCount))+" "+h(p(ir)("item","items",s.uniqueItemsCount)),1)):x("",!0)]),r("td",null,h(s.formatNumber(s.order.subtotal)),1)]),l(Eu,{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?(d(!0),_(H,{key:0},ee(s.feeItems,N=>(d(),_("tr",{key:"fee-"+N.id},[r("td",null,h(N.title),1),o[28]||(o[28]=r("td",null,null,-1)),r("td",null,h(s.formatNumber(N.subtotal)),1)]))),128)):x("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(d(),E(di,{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"])):x("",!0),s.hasCoupon?x("",!0):(d(),E(ui,{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?(d(),_("tr",xI,[r("td",null,h(p(c)("Coupon Discount")),1),o[29]||(o[29]=r("td",null,null,-1)),r("td",null,"- "+h(s.formatNumber(s.order.coupon_discount_total)),1)])):x("",!0),s.isEditingItem?(d(),_("tr",SI,[r("td",FI,h(p(c)("Tax will be recalculated on save")),1)])):s.taxSummary.payableTax>0||s.taxSummary.inclusiveTax>0||s.taxSummary.inclusiveFeeTax>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedTaxTotal>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedShippingTax>0?(d(),_("tr",EI,[r("td",UI,[r("div",$I,[r("div",DI,[r("span",null,h(p(c)("tax summary")),1)]),s.taxSummary.inclusiveTax>0&&s.taxBreakdownShouldShow?(d(),_("div",QI,[r("span",null,h(p(c)("Included in item prices")),1),r("span",null,h(s.formatNumber(s.taxSummary.inclusiveTax)),1)])):x("",!0),s.taxSummary.exclusiveTax>0&&s.taxBreakdownShouldShow?(d(),_("div",II,[r("span",null,h(p(c)("Added on products")),1),r("span",null,h(s.formatNumber(s.taxSummary.exclusiveTax)),1)])):x("",!0),s.taxSummary.feeTaxLineRows&&s.taxSummary.feeTaxLineRows.length&&s.taxBreakdownShouldShow?(d(!0),_(H,{key:2},ee(s.taxSummary.feeTaxLineRows,(N,oe)=>(d(),_("div",{key:oe,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":N.inclusive}])},[r("span",null,h(N.display_label),1),r("span",null,h(s.formatNumber(N.tax_amount)),1)],2))),128)):x("",!0),s.taxSummary.shippingTax>0&&s.taxBreakdownShouldShow?(d(),_(H,{key:3},[s.taxSummary.shippingTaxLines&&s.taxSummary.shippingTaxLines.length?(d(!0),_(H,{key:0},ee(s.taxSummary.shippingTaxLines,N=>(d(),_("div",{key:N.label,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":s.taxSummary.isShippingInclusive}])},[r("span",null,h(N.label),1),r("span",null,h(s.formatNumber(N.shipping_tax)),1)],2))),128)):(d(),_("div",{key:1,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":s.taxSummary.isShippingInclusive}])},[r("span",null,h(s.taxSummary.isShippingInclusive?p(c)("Included in shipping prices"):p(c)("Added on shipping")),1),r("span",null,h(s.formatNumber(s.taxSummary.shippingTax)),1)],2))],64)):x("",!0),s.taxSummary.payableTax>0?(d(),_("div",TI,[r("span",null,h(p(c)("Total payable tax")),1),r("span",null,h(s.formatNumber(s.taxSummary.payableTax)),1)])):x("",!0),s.order.is_reverse_charge_tax_order&&s.taxSummary.showRcShippingRow&&s.taxSummary.reversedShippingTax>0?(d(),_("div",VI,[r("span",null,h(p(c)("Added on shipping")),1),r("span",MI,h(s.formatNumber(s.taxSummary.reversedShippingTax)),1)])):x("",!0),s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedTaxTotal>0?(d(),_("div",LI,[r("span",null,h(p(c)("Tax reversed")),1),r("span",null,h(s.formatNumber(s.taxSummary.reversedTaxTotal)),1)])):x("",!0),s.taxSummary.inclusiveTax>0||s.taxSummary.inclusiveFeeTax>0?(d(),_("div",RI,[r("span",null,h(p(c)("Total tax in this order")),1),r("span",null,h(s.formatNumber(s.taxSummary.totalOrderTax)),1)])):x("",!0)])])])):x("",!0),r("tr",OI,[r("td",null,h(p(c)("Total")),1),o[30]||(o[30]=r("td",null,null,-1)),r("td",null,h(s.formatNumber(s.order.total_amount-(s.taxSummary.rcTotalAdjustment||0))),1)]),r("tr",HI,[r("td",null,h(p(c)("Total Paid")),1),o[31]||(o[31]=r("td",null,null,-1)),r("td",null,h(s.formatNumber((I=s.order)==null?void 0:I.total_paid)),1)]),((O=s.order)==null?void 0:O.total_refund)>0?(d(),_("tr",PI,[r("td",null,h(p(c)("Total Refund")),1),o[32]||(o[32]=r("td",null,null,-1)),r("td",null,"- "+h(s.formatNumber((P=s.order)==null?void 0:P.total_refund)),1)])):x("",!0),s.order.total_paid-((K=s.order)==null?void 0:K.total_refund)!=0?(d(),_("tr",NI,[r("td",null,h(p(c)("Net Payment")),1),o[33]||(o[33]=r("td",null,null,-1)),r("td",KI,h(s.getNetPayment()),1)])):x("",!0),s.order.total_amount-((G=s.order)==null?void 0:G.total_paid)>0?(d(),_("tr",GI,[r("td",null,h(p(c)("Total Due")),1),o[34]||(o[34]=r("td",null,null,-1)),r("td",jI,h(s.getTotalDue()),1)])):x("",!0),s.order.total_amount-(((ne=s.order)==null?void 0:ne.total_paid)-((Y=s.order)==null?void 0:Y.total_refund))<0?(d(),_("tr",zI,[r("td",null,[r("p",YI,[l(p(hh),{class:"w-6 text-amber-500 mr-2"}),R(" "+h(p(c)("Total Refund Owed")),1)])]),o[35]||(o[35]=r("td",null,null,-1)),r("td",qI,h(s.getTotalDue()),1)])):x("",!0)])])]}),_:1})]),_:1}),s.order.transactions&&s.order.transactions.length?Dt((d(),E(he,{key:0,"element-loading-text":"Cancelling in progress...",class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Transaction Details"),border_bottom:"",title_size:"small"},{action:i(()=>{var I;return[s.order.total_amount-((I=s.order)==null?void 0:I.total_paid)>0&&s.order.status!=="canceled"&&s.markingOrderAsPaid===!1?(d(),E(w,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s.handleCommand},{dropdown:i(()=>[l(b,null,{default:i(()=>[l(B,{command:"custom-payment-link"},{default:i(()=>[R(h(p(c)("Custom Payment Link"))+" ",1),l(m,{effect:"dark",content:p(c)("Due amount is remaining, Get a custom payment link to send to the customer."),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(v,null,{default:i(()=>[l(p(Xa))]),_:1})]),_:1},8,["content"])]),_:1}),l(B,{command:"mark-order-paid"},{default:i(()=>[R(h(p(c)("Mark order as paid")),1)]),_:1}),s.canSendPaymentReminder?(d(),E(B,{key:0,command:"send-payment-reminder",disabled:s.sendingPaymentReminder},{default:i(()=>[R(h(p(c)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):x("",!0)]),_:1})]),default:i(()=>[l(f,{size:"small"},{default:i(()=>[R(h(p(c)("Collect Payments"))+" ",1),l(W,{name:"ChevronDown"})]),_:1}),l(W,{name:"More"})]),_:1},8,["onCommand"])):x("",!0)]}),_:1},8,["title"]),l(me,{class:"p-0"},{default:i(()=>[l(Su,{onReload:o[5]||(o[5]=I=>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"]),l(im,{onReload:o[6]||(o[6]=I=>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})),[[T,s.canceling_subscription]]):x("",!0),l(F,{title:p(c)("Mark as paid"),modelValue:s.transactionMedium,"onUpdate:modelValue":o[10]||(o[10]=I=>s.transactionMedium=I)},{footer:i(()=>[Dt((d(),E(f,{plan:"",type:"primary",onClick:s.markOrderAsPaid,disabled:s.markingOrderAsPaid},{default:i(()=>[R(h(p(c)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[T,s.markingOrderAsPaid]])]),default:i(()=>[r("div",null,[l($,{"label-position":"top"},{default:i(()=>[l(M,{"label-position":"top",label:p(c)("Payment method")},{default:i(()=>[l(S,{modelValue:s.otherData.payment_method,"onUpdate:modelValue":o[7]||(o[7]=I=>s.otherData.payment_method=I)},{default:i(()=>[(d(!0),_(H,null,ee(s.paymentMethodOption,I=>(d(),E(k,{key:I.value,label:I.name,value:I.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),l(M,{"label-position":"top",label:p(c)("Vendor charge id")},{default:i(()=>[l(g,{modelValue:s.otherData.vendor_charge_id,"onUpdate:modelValue":o[8]||(o[8]=I=>s.otherData.vendor_charge_id=I)},null,8,["modelValue"])]),_:1},8,["label"]),l(M,{"label-position":"top",label:p(c)("Notes")},{default:i(()=>[l(g,{rows:2,type:"textarea",placeholder:p(c)("Please enter the payment note..."),modelValue:s.otherData.mark_paid_note,"onUpdate:modelValue":o[9]||(o[9]=I=>s.otherData.mark_paid_note=I)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),s.order.licenses?(d(),E(he,{key:1,class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Licenses"),title_size:"small"},null,8,["title"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[l(Wd,{licenses:s.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):x("",!0),l(he,{class:"overflow-hidden mb-0"},{default:i(()=>[l(Ce,{title:p(c)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(op,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),r("div",WI,[r("div",XI,[(d(!0),_(H,null,ee(s.order.subscriptions,(I,O)=>(d(),E(ZD,{key:I.id,subscription:I,order:s.order,orderId:e.order_id,index:O,onFetchOrder:o[11]||(o[11]=P=>s.$emit("fetch")),onReload:o[12]||(o[12]=P=>s.reloadOrder()),getOrderUrl:s.getOrderUrl},null,8,["subscription","order","orderId","index","getOrderUrl"]))),128)),s.order.customer?(d(),E(Hr,{key:0,order:s.order,shouldEnableEditing:!0,onOnOrderUpdated:s.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):x("",!0),l(ii,{orderId:s.order.id,note:s.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),l(Or,{"bind-to-id":s.order.id,"bind-to-type":"Order",selectedLabels:s.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(D=s.order)!=null&&D.order_operation?(d(),E(rm,{key:1,order_operation:(U=s.order)==null?void 0:U.order_operation},null,8,["order_operation"])):x("",!0)]),s.order?(d(),_("div",JI,[l(Sl,{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"])])):x("",!0)])]),l(F,{modelValue:s.adjustQuantityModal,"onUpdate:modelValue":o[15]||(o[15]=I=>s.adjustQuantityModal=I),title:p(c)("Adjust Quantity"),width:"35%","align-center":"","append-to-body":!0,class:"fct-adjust-quantity-modal",onClose:o[16]||(o[16]=()=>{s.adjustQuantityModal=!1,s.adjustItem={},s.tmpAdjustedItem={}})},{footer:i(()=>[r("div",aT,[l(f,{onClick:o[13]||(o[13]=I=>s.adjustQuantityModal=!1),type:"info",soft:""},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(f,{type:"primary",onClick:o[14]||(o[14]=I=>s.saveAdjustedProductQuantity(s.tmpAdjustedItem))},{default:i(()=>[R(h(p(c)("Done")),1)]),_:1})])]),default:i(()=>[r("div",ZI,[r("div",eT,[o[36]||(o[36]=R(" Adjust the quantity for ",-1)),r("strong",null,h(s.adjustItem.title),1)]),r("div",tT,[r("label",null,h(p(c)("Quantity")),1),s.isEditingItem?(d(),E(nm,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):x("",!0)])])]),_:1},8,["modelValue","title"]),l(am,{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"]),l(F,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":o[17]||(o[17]=I=>s.createProductModal=I),title:p(c)("Add New Product")},{default:i(()=>[s.createProductModal?(d(),_("div",nT,[l(ai,{customModal:"order_modal","onUpdate:createProductModal":s.updateProductModal,onProcess_custom:s.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"]),l(F,{"append-to-body":!0,modelValue:s.showRefundModal,"onUpdate:modelValue":o[19]||(o[19]=I=>s.showRefundModal=I),title:p(c)("Refund Transaction"),onClose:o[20]||(o[20]=()=>{s.changes_made=0,s.showRefundModal=!1,s.fetch()})},{default:i(()=>[Dt(l(bD,{"element-loading-text":p(c)("Refund initiating on remote..."),order_id:e.order_id,order:s.order,showRefundModal:s.showRefundModal,onProcessing_refund:o[18]||(o[18]=I=>s.processing_refund=I),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"]),[[T,s.processing_refund]])]),_:1},8,["modelValue","title"]),s.loading?(d(),E(Q,{key:0,animated:""},{default:i(()=>[l(L),l(L),l(L)]),_:1})):x("",!0),l(F,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":o[21]||(o[21]=I=>s.nextInvoiceModal=I),title:p(c)("Custom payment link")},{default:i(()=>[l(QD,{order_id:e.order_id,order:s.order,onReload:s.fetch},null,8,["order_id","order","onReload"])]),_:1},8,["modelValue","title"])])],64)):x("",!0)])):x("",!0)])):x("",!0)],64)}}}),oT={class:"fct-create-order-wrapper fct-layout-width"},rT={class:"single-page-header"},iT={class:"single-page-header-title-wrap"},dT={class:"single-page-body"},uT={class:"fct-create-order"},cT={class:"fct-create-order-main"},AT={class:"fct-browse-product-form-group pb-5 mx-5"},pT={key:0,class:"fct-table-wrap fct-table-transparent-header"},fT={class:"fct-product-info-card"},mT={class:"fct-product-info-media"},hT=["src","alt"],_T={class:"fct-product-info-details"},gT={class:"fct-product-info-name"},vT={class:"product-sub-name"},yT={class:"mt-1"},bT={key:0,class:"line-through mr-3"},wT={key:1},CT={key:0},BT={class:"fct-input-number-wrap"},kT={key:0},xT={key:0},ST={key:1},FT={class:"fct-table-border fct-table-order-details"},ET={key:0},UT={key:3},$T={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},DT={class:"fct-create-order-aside"},QT={class:"fct-admin-sidebar"},IT={key:0},TT={name:"CreateOrder",components:{OrderBulkActions:xu,Transaction:Su,Badge:qt,IconButton:Oe,CopyToClipboard:Za,Notes:ii,Coupon:di,CustomDiscount:ui,OrderCustomerInformation:Hr,Shipping:Eu},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()}},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():Fu(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,re.post("orders",{...e,discount:this.discount,shipping:this.shippingSettings,labels:this.selectedLabels,user_tz:Re.tz.guess(),trigger:"on_admin_create"}).then(t=>{q.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"?q.validationErrors(t):q.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((n,s)=>{n.shipping_charge=Ke.get(e,`${n.id}.shipping_charge`)}),this.order.shipping_total=t,this.changes_made++},isDisabled(e){var t;return((t=e==null?void 0:e.other_info)==null?void 0:t.payment_type)==="subscription"},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})}),re.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}}},VT=Object.assign(TT,{setup(e){const t=V(),a=V(!0),n=()=>t.value.fetchBySearch(),s=()=>{n()};return(o,u)=>{const A=C("el-breadcrumb-item"),f=C("el-breadcrumb"),m=C("el-input"),g=C("el-button"),y=C("router-link"),v=C("el-table-column"),B=C("el-table"),b=C("el-dialog"),w=Ca("loading");return d(),_("div",oT,[l(Bl,{isActive:o.changes_made>0?"is-active":"",onDiscard:o.reloadOrder,onSave:o.update,loading:o.loading},null,8,["isActive","onDiscard","onSave","loading"]),r("div",rT,[r("div",iT,[l(f,{"separator-icon":p(tn)},{default:i(()=>[l(A,{to:{name:"orders"}},{default:i(()=>[R(h(o.$t("Orders")),1)]),_:1}),l(A,null,{default:i(()=>[R(h(o.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),r("div",dT,[r("div",uT,[r("div",cT,[l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:o.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[r("div",AT,[l(m,{placeholder:o.$t("Search products..."),onKeyup:u[0]||(u[0]=k=>n()),modelValue:o.searchQuery,"onUpdate:modelValue":u[1]||(u[1]=k=>o.searchQuery=k)},{prefix:i(()=>[l(W,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),l(g,{onClick:s,type:"info",soft:"",class:"el-button--x-small"},{default:i(()=>[R(h(o.$t("Browse")),1)]),_:1})]),o.order.order_items.length>0?(d(),_("div",pT,[Dt((d(),E(B,{data:o.order.order_items,class:"fct-table w-full","row-key":"id","default-expand-all":"","element-loading-text":o.$t("Recalculating with product latest info...")},{default:i(()=>[l(v,{"min-width":"450",label:o.$t("Product")},{default:i(k=>{var S,M,$,F;return[r("div",fT,[r("div",mT,[l(y,{class:"link",to:{name:"product_edit",params:{product_id:k.row.post_id}}},{default:i(()=>[r("img",{src:o.getImageUrl(k.row.featured_media,o.appVars.asset_url),alt:k.row.title,class:de(o.getClass(k.row.featured_media))},null,10,hT)]),_:2},1032,["to"])]),r("div",_T,[r("div",gT,[l(y,{class:"link",to:{name:"product_edit",params:{product_id:k.row.post_id}}},{default:i(()=>[R(h(k.row.post_title)+" ",1),r("span",vT,"- "+h(k.row.title),1)]),_:2},1032,["to"])]),r("div",yT,[R(h(o.formatNumber(k.row.price))+" ",1),parseInt(k.row.unit_price)>parseInt(k.row.price)?(d(),_("span",bT,h(o.formatNumber(k.row.unit_price)),1)):x("",!0),k.row.payment_type==="subscription"&&((M=(S=k.row)==null?void 0:S.other_info)==null?void 0:M.manage_setup_fee)==="yes"?(d(),_("div",wT,[r("span",null,h(k.row.other_info.signup_fee_name)+" : "+h(o.formatNumber(k.row.other_info.signup_fee)),1),((F=($=k.row)==null?void 0:$.other_info)==null?void 0:F.setup_fee_per_item)=="yes"?(d(),_("span",CT,[u[6]||(u[6]=r("span",null,"x",-1)),r("span",null,h(k.row.quantity),1)])):x("",!0)])):x("",!0)])])])]}),_:1},8,["label"]),l(v,{width:"120",label:o.$t("Quantity")},{default:i(k=>[r("div",BT,[l(nm,{item:k.row,"onUpdate:value":o.updateQuantity,isDisabled:o.isDisabled(k.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),l(v,{width:120,label:o.$t("Total")},{default:i(k=>{var S,M,$,F;return[r("div",null,h(o.formatNumber(k.row.line_total)),1),k.row.payment_type=="subscription"&&((M=(S=k.row)==null?void 0:S.other_info)==null?void 0:M.manage_setup_fee)=="yes"?(d(),_("div",kT,[u[7]||(u[7]=r("span",null,"+",-1)),((F=($=k.row)==null?void 0:$.other_info)==null?void 0:F.setup_fee_per_item)=="yes"?(d(),_("span",xT,[r("span",null,h(o.formatNumber(k.row.other_info.signup_fee*k.row.quantity)),1)])):(d(),_("span",ST,h(o.formatNumber(k.row.other_info.signup_fee)),1))])):x("",!0)]}),_:1},8,["label"]),l(v,{width:50},{default:i(k=>[l(Oe,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Xe(S=>o.deleteProduct(k.$index,k.row),["prevent"])},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[w,o.calculating]])])):x("",!0)]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{border_bottom:"",title:o.$t("Payment"),title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[r("table",FT,[r("tbody",null,[r("tr",null,[r("td",null,h(o.$t("Subtotal")),1),r("td",null,[o.order.order_items.length>0?(d(),_("span",ET,h(p(Kt)(o.order.order_items.length))+" "+h(o.order.order_items.length===1?o.$t("item"):o.$t("items")),1)):x("",!0)]),r("td",null,h(o.formatNumber(o.order.subtotal)),1)]),o.order.order_items.length>0&&!o.discount.value?(d(),E(di,{key:0,order:o.order,couponsAttributes:[],hasCouponAttributes:!1,appliedCouponsAttributes:[],action:"create_order",shouldManageCoupon:!0,"onUpdate:coupons":o.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","onUpdate:coupons"])):x("",!0),o.hasCoupon?x("",!0):(d(),E(ui,{key:1,order:o.order,hasCoupon:o.hasCoupon,"onUpdate:customDiscount":o.updateCustomDiscount},null,8,["order","hasCoupon","onUpdate:customDiscount"])),x("",!0),o.selectedCustomerCountry&&o.order.order_items.length>0?(d(),_("tr",UT,[r("td",$T,h(o.$t("Tax will be calculated on save")),1)])):x("",!0)]),r("tfoot",null,[r("tr",null,[r("td",null,h(o.$t("Total")),1),u[8]||(u[8]=r("td",null,null,-1)),r("td",null,h(o.formatNumber(o.order.total_amount)),1)])])])]),_:1})]),_:1})]),r("div",DT,[r("div",QT,[l(ii,{note:o.order.note,onWhenNoteEditIsDone:u[2]||(u[2]=k=>{o.saveNoteModal(k)})},null,8,["note"]),l(Hr,{order:o.order,onOnAddressSelected:u[3]||(u[3]=k=>{if(o.fetchShippingMethods(),k===null){o.selectedCustomerCountry="",o.selectedCustomerAddress=null;return}o.selectedCustomerCountry=k.country,o.selectedCustomerAddress=k,k.type==="shipping"?o.order.shipping_address_id=k.id:o.order.billing_address_id=k.id}),onOnAddressRemove:u[4]||(u[4]=()=>{o.selectedCustomerCountry="",o.selectedCustomerAddress=null,o.order.billing_address_id=null,o.order.shipping_address_id=null,o.fetchShippingMethods()})},null,8,["order"]),l(Or,{selectedLabels:o.selectedLabels,"onUpdate:updateLabel":o.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),l(am,{ref_key:"productItemModal",ref:t,searchQueryParent:o.searchQuery,orderParent:o.order,"onUpdate:searchQuery":o.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),l(b,{"append-to-body":!0,modelValue:o.createProductModal,"onUpdate:modelValue":u[5]||(u[5]=k=>o.createProductModal=k),title:o.$t("Add New Product")},{default:i(()=>[o.createProductModal?(d(),_("div",IT,[l(ai,{customModal:"order_modal","onUpdate:createProductModal":o.updateProductModal,onProcess_custom:o.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"])])])}}});class MT extends Ya{constructor(){super(...arguments);Ee(this,"data",{form:fu()})}get controllerKey(){return"Customer"}}function dm(){return MT.init()}const LT={class:"setting-wrap"},RT={class:"setting-wrap-inner"},OT={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},HT={class:"grid gap-3 mb-6"},PT={class:"grid gap-3 mb-6"},NT={class:"grid gap-3 mb-6"},KT={class:"grid gap-3"},ol=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=dm(),{form:a}=t.data,n=ks(),s=V([]),o=V([]),u=V(!0),A=V(!1),f=V(!0),m=V({}),g=fn(),y=V(g.name),v=V(g.meta.title||"Store Settings"),B=()=>y.value==="reminders",b=()=>B()?"email-notification/reminders":"settings/store",w=()=>{var F;A.value=!0;let $=a.values;Array.isArray($.store_logo)&&$.store_logo.length>0&&($.store_logo=(F=$.store_logo)==null?void 0:F[0]),B()||($.settings_name=y.value),re.post(b(),{...$}).then(L=>{if(q.success(c("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"],T={};if(Q.forEach(function(O){a.values[O]!==void 0&&(T[O]=a.values[O])}),T.currency){const O=Ie.get("currency_signs",{});O[T.currency]!==void 0&&(T.currency_sign=O[T.currency])}T.decimal_points!==void 0&&(T.is_zero_decimal=parseInt(T.decimal_points,10)===0);const D=Ie.get("shop",{}),I=["currency","currency_position","decimal_separator","decimal_points"].some(function(O){return T[O]!==void 0&&T[O]!==D[O]});Ie.mergeConfig({shop:Object.assign({},D,T)}),Te.setLocale(),I&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(L=>{var Q;L.status_code=="422"?q.validationErrors(L):q.error((Q=L.data)==null?void 0:Q.message),a.setValidationErrors(L),m.value=L}).finally(()=>{A.value=!1,f.value=!1,u.value=!1})},k=V(!1),S=()=>{u.value=!0,k.value=!1;const $=B()?{}:{settings_name:y.value};re.get(b(),$).then(F=>{a.setSchema(F.fields).setDefaults(F.settings).initForm(),s.value=F.settings,o.value=F.fields,u.value=!1,f.value=!1,A.value=!1}).catch(F=>{k.value=!0,u.value=!1,f.value=!1,A.value=!1})},M=()=>{n.bind(["mod+s"],$=>{$.preventDefault(),w()})};return ge(()=>g.name,($,F)=>{var L;y.value=$,v.value=((L=g.meta)==null?void 0:L.title)||"Store Settings",n.unbind("mod+s"),M(),S()}),Be(()=>{M(),S()}),qA(()=>{n.unbind("mod+s")}),($,F)=>{const L=C("el-skeleton-item"),Q=C("el-skeleton"),T=C("el-form");return d(),_("div",LT,[l(ha,{heading:v.value,loading:A.value,onOnSave:w},null,8,["heading","loading"]),r("div",RT,[l(_a),k.value?(d(),E(he,{key:1},{default:i(()=>[l(me,null,{default:i(()=>[r("p",null,h(p(c)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(d(),_(H,{key:0},[f.value?(d(),_("div",OT,[l(Q,{loading:f.value,animated:""},{template:i(()=>[r("div",HT,[l(L,{variant:"p",class:"w-[20%]"}),l(L,{variant:"p"})]),r("div",PT,[l(L,{variant:"p",class:"w-[20%]"}),l(L,{variant:"p"})]),r("div",NT,[l(L,{variant:"p",class:"w-[20%]"}),l(L,{variant:"p"})]),r("div",KT,[l(L,{variant:"p",class:"w-[20%]"}),l(L,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),f.value?x("",!0):(d(),_(H,{key:1},[p(a).isReady?(d(),E(T,{key:0,class:"relative"},{default:i(()=>[u.value?(d(),E(he,{key:0},{default:i(()=>[l(me,null,{default:i(()=>[l(Q,{rows:5,animated:""},{default:i(()=>[l(L),l(L,{variant:"text"}),l(L,{variant:"text"})]),_:1})]),_:1})]),_:1})):x("",!0),u.value?x("",!0):(d(),E(oi,{key:1,form:p(a),showSubmitButton:!0,onOnSubmitButtonClick:w,submitButtonText:p(c)("Save"),loading:A.value,onOnChange:F[0]||(F[0]=D=>{}),"validation-errors":m.value},null,8,["form","submitButtonText","loading","validation-errors"]))]),_:1})):x("",!0)],64))],64))])])}}}),GT={};function jT(e,t){const a=C("router-view");return d(),_("div",null,[l(a)])}const zT=He(GT,[["render",jT]]),YT={name:"Licensing",components:{Lock:_h,Refresh:Zd,CircleCheck:Nr,Badge:qt,DynamicIcon:W,CopyToClipboard:Za,SettingsHeader:ha,CardBody:me,CardContainer:he,AdminNotice:_a},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return Ie.get("purchase_fluent_cart_link")}},mounted(){this.disabled||this.getSettings()},methods:{formatDate:Hs,translate:c,getSettings(){this.errorMessage="",this.loading=!0,re.get("settings/license",{verify:!0}).then(e=>{this.licenseData=e}).catch(e=>{q.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){q.error(c("Please provide a license key")),this.errorMessage=c("Please provide a license key");return}this.verifying=!0,this.errorMessage="",re.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"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.data)}).finally(()=>{this.verifying=!1})},deactivateLicense(){this.verifying=!0,re.delete("settings/license").then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{q.error(e)}).finally(()=>{this.verifying=!1})},maskLicense(e){if(!e)return"";const t=e.slice(0,4),a=e.slice(-4),n="*".repeat(e.length-8);return`${t}${n}${a}`}}},qT={class:"setting-wrap"},WT={class:"setting-wrap-inner"},XT={key:0,class:"fluent_cart_configure_integration_body"},JT={key:0,class:"fct-license-box-content"},ZT=["href"],eV={class:"fct-license-box-content-details"},tV={class:"label"},aV={class:"license-key"},nV={class:"label"},sV={key:1,class:"w-full items-start"},lV={key:1,class:"fct-license-box-content"},oV={class:"fct-license-box-content-details"},rV={key:0},iV={class:"label"},dV={class:"license-key"},uV={class:"label"},cV={key:2,class:"fct-license-box-content"},AV={key:0},pV=["href"],fV=["innerHTML"];function mV(e,t,a,n,s,o){const u=C("SettingsHeader"),A=C("AdminNotice"),f=C("el-skeleton"),m=C("DynamicIcon"),g=C("CopyToClipboard"),y=C("el-input"),v=C("el-button"),B=C("CardBody"),b=C("CardContainer"),w=Ca("loading");return d(),_("div",qT,[l(u,{heading:o.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),r("div",WT,[l(A),l(b,null,{default:i(()=>[l(B,null,{default:i(()=>[l(f,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),r("div",null,[!a.disabled&&!s.loading?Dt((d(),_("div",XT,[r("div",{class:de(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(d(),_("div",JT,[s.showNewLicenseInput?(d(),_("div",sV,[r("h3",null,h(o.translate("Your License Key")),1),l(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=k=>s.licenseKey=k),placeholder:o.translate("License Key")},null,8,["modelValue","placeholder"])])):(d(),_(H,{key:0},[l(m,{name:"GradientWarningCircle"}),r("h3",null,h(o.translate("Looks like your license key has been Expired!")),1),r("p",null,[R(h(o.translate("Have a new license Key?"))+" ",1),r("a",{onClick:t[0]||(t[0]=Xe(k=>s.showNewLicenseInput=!s.showNewLicenseInput,["prevent"])),href:"#"},h(o.translate("Click here")),1),t[7]||(t[7]=R()),s.licenseData.renew_url?(d(),_(H,{key:0},[t[6]||(t[6]=R("or ",-1)),r("a",{href:s.licenseData.renew_url,target:"_blank"},h(o.translate("Purchase a new license")),9,ZT)],64)):x("",!0)]),r("div",eV,[r("p",null,[r("span",tV,h(o.translate("License Key")),1),r("span",aV,[R(h(o.maskLicense(s.licenseData.license_key))+" ",1),l(g,{text:s.licenseData.license_key,showMode:"basic_copy_btn",tooltipText:o.translate("Copy License")},null,8,["text","tooltipText"])])]),r("p",null,[r("span",nV,h(o.translate("Expired At")),1),R(" "+h(o.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(d(),_("div",lV,[l(m,{name:"GradientCheckCircle"}),r("h3",null,h(o.translate("Congratulations! Your license key is valid and activated")),1),r("p",null,[R(h(o.translate("Want to deactivate this license?"))+" ",1),r("a",{onClick:t[2]||(t[2]=Xe(k=>o.deactivateLicense(),["prevent"])),href:"#"},h(o.translate("Click here")),1)]),r("div",oV,[s.licenseData.license_key?(d(),_("p",rV,[r("span",iV,h(o.translate("License Key")),1),r("span",dV,h(o.maskLicense(s.licenseData.license_key)),1)])):x("",!0),r("p",null,[r("span",uV,h(o.translate("Expires")),1),R(" "+h(s.licenseData.expires!=="lifetime"?o.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(d(),_("div",cV,[r("h3",null,h(o.translate("Please Provide a license key of"))+" FluentCart ",1),l(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=k=>s.licenseKey=k),placeholder:o.translate("License Key")},null,8,["modelValue","placeholder"]),s.showNewLicenseInput?x("",!0):(d(),_("p",AV,[R(h(o.translate("Don't have a license key?"))+" ",1),r("a",{target:"_blank",href:o.purchaseLink},[R(h(o.translate("Purchase one here"))+" ",1),l(m,{name:"External",class:"w-4 h-4"})],8,pV)]))])),r("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,fV),s.licenseData.status==="expired"&&s.showNewLicenseInput?(d(),E(v,{key:3,type:"primary",onClick:t[4]||(t[4]=k=>o.verifyLicense())},{default:i(()=>[l(m,{name:"Lock",class:"w-5 h-5"}),R(" "+h(o.translate("Click Here to Renew your License")),1)]),_:1})):["valid","expired"].includes(s.licenseData.status)?x("",!0):(d(),E(v,{key:4,type:"primary",onClick:t[5]||(t[5]=k=>o.verifyLicense())},{default:i(()=>[l(m,{name:"Lock",class:"w-5 h-5"}),R(" "+h(o.translate("Verify License")),1)]),_:1}))],2)])),[[w,s.verifying]]):x("",!0)])]),_:1})]),_:1})])])}const hV=He(YT,[["render",mV]]),_V={class:"fct-single-order-loader-wrap fct-layout-width"},gV={class:"single-page-header fct-page-loader-header flex items-start justify-between"},vV={class:"single-page-body"},yV={class:"fct-single-order"},bV={class:"fct-single-order-main"},wV={class:"fct-single-order-aside"},CV={class:"fct-admin-sidebar"},BV={__name:"SingleProductLoader",setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton");return d(),_("div",_V,[r("div",gV,[l(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:i(()=>[l(n,{class:"max-w-180"}),l(n,{class:"max-w-[100px]"})]),_:1}),l(s,{animated:"",class:"flex gap-2 max-w-[100px]"},{template:i(()=>[l(n,{class:"w-2/4"}),l(n,{class:"w-2/4"})]),_:1})]),r("div",vV,[r("div",yV,[r("div",bV,[l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:5})]),_:1})]),_:1}),l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:5})]),_:1})]),_:1}),l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:6})]),_:1})]),_:1}),l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:""},{template:i(()=>[l(n,{variant:"p"})]),_:1})]),_:1})]),_:1})]),r("div",wV,[r("div",CV,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:""},{template:i(()=>[l(n,{variant:"image",class:"rounded w-full h-[138px] mb-2"}),l(n,{variant:"image",class:"rounded w-[90px] h-[90px]"})]),_:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},kV={class:"fct-product-route-wrap"},xV={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=Kl({show:!1,message:"",buttonText:"",route:""}),n=V(!1),s=V(!1),o=V(!1),u=fn(),A=V(!0),f=()=>{o.value=!0,a.show=!1,re.get("products/"+t.product_id+"/pricing",{with:["product_menu"]}).then(v=>{n.value=v.product,n.value.variants=m(n.value.variants),s.value=v.taxonomies,n.value.post_date=Re.utc(n.value.post_date).local().format("YYYY-MM-DDTHH:mm:ssZ"),A.value&&jQuery("#fct_admin_menu_holder").append(v.product_menu),g(!0)}).catch(v=>{var B;(v==null?void 0:v.code)==="fluent_cart_entity_not_found"?(a.show=!0,a.buttonText=Ke.get(v,"data.buttonText"),a.message=Ke.get(v,"data.message"),a.route=Ke.get(v,"data.route"),jQuery(".fct-admin-product-header").remove()):v.status_code=="422"?q.validationErrors(v):q.error((B=v.data)==null?void 0:B.message)}).finally(()=>{o.value=!1})},m=v=>{let B={};return v.forEach((b,w)=>{b.item_price=b.item_price?Jt(b.item_price,!1):0,b.item_cost=b.item_cost?Jt(b.item_cost,!1):0,b.compare_price=b.compare_price?Jt(b.compare_price,!1):"",b.other_info&&(b.other_info.signup_fee=b.other_info.signup_fee?Jt(b.other_info.signup_fee,!1):0),b.rowId=w,B[b.id]=b}),v},g=(v=!1)=>{let B=jQuery(".fct-admin-product-menu"),b=u.name;B.length&&(B.find("li").removeClass("active-menu"),B.find(`li.fct_menu_${b}`).addClass("active-menu")),v&&n.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="'+n.value.guid+'" target="_blank">View Product</a></li>'))};return ge(()=>t.product_id,(v,B)=>{v!==B&&f()}),Be(()=>{f(),g(),window.addEventListener("hashchange",g)}),xn(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),jd("reload",()=>{A.value=!1,f()}),(v,B)=>{const b=C("router-view");return d(),_("div",kV,[p(u).name==="product_edit"&&o.value?(d(),E(BV,{key:0})):x("",!0),a.show?(d(),E(Kr,{key:1,"button-text":a.buttonText,message:a.message,route:a.route},null,8,["button-text","message","route"])):x("",!0),n.value&&a.show==!1?(d(),E(b,{key:2,product:n.value,taxonomies:s.value},null,8,["product","taxonomies"])):x("",!0)])}}};class SV extends Gs{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="ID"}getTabs(){return{all:c("All"),publish:c("Published"),draft:c("Draft"),physical:c("Physical"),digital:c("Digital"),subscribable:c("Subscribable"),bundle:c("Bundle"),non_bundle:c("Non Bundle")}}getToggleableColumns(){return[{label:c("Type"),value:"product_type"},{label:c("Variation"),value:"variation_type"},{label:c("Stock"),value:"stock_availability"},{label:c("Price"),value:"item_price"},{label:c("Status"),value:"post_status"},{label:c("Date"),value:"post_date"}]}getSortableColumns(){return[{label:c("Product ID"),value:"ID"},{label:c("Title"),value:"post_title"},{label:c("Created at"),value:"post_date"}]}getSearchHint(){return c("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 um(e){return SV.init(e)}const FV={key:0,class:"fct-dummy-product-content"},EV={key:0,class:"title"},UV={class:"text"},$V={class:"fct-dummy-product-loading"},DV={class:"fct-loading-bars"},QV=["id"],IV={key:1,class:"fct-form-group"},TV={class:"required"},VV={class:"dialog-footer"},MV={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,n=Qt().ctx,s=V(!1),o=V([]),u=V(null),A=V(0),f=V(!1),m=V(null),g=V(0),y=b=>{s.value=b},v=(b=0)=>{if(u.value===null){B();return}f.value=!0;const w=o.value[u.value];if(m.value=w,b>w.count-1){setTimeout(()=>{B(),s.value=!1,a("onProductCreated")},1e3);return}A.value=b,n.$post("products/create-dummy",{category:w.category,index:b}).then(k=>{g.value=parseFloat(((b+1)/w.count*100).toFixed(0)),v(b+1)}).catch(k=>{k.code===400?B():v(b+1),n.handleError(k)})},B=()=>{g.value=0,A.value=0,f.value=!1,m.value=null};return Be(()=>{o.value=Ie.get("dummy_product_info")}),(b,w)=>{const k=C("el-button"),S=C("el-progress"),M=C("el-option"),$=C("el-select"),F=C("el-dialog");return d(),_(H,null,[l(k,{onClick:w[0]||(w[0]=L=>y(!0))},{default:i(()=>[l(W,{name:"Stars",class:"hidden lg:inline"}),R(" "+h(b.$t("Add Dummy Product")),1)]),_:1}),l(F,{modelValue:s.value,"onUpdate:modelValue":w[4]||(w[4]=L=>s.value=L),title:b.$t("Create Dummy Product"),"append-to-body":!0},Rt({default:i(()=>[f.value?(d(),_("div",FV,[m.value!=null?(d(),_("div",EV,h(p(c)("Inserting %1$s of %2$s %3$s Product",A.value+1,m.value.count,m.value.title)),1)):x("",!0),r("div",UV,[R(h(b.$t("Can close the window - product will continue to insert."))+" ",1),r("div",$V,[r("div",DV,[(d(),_(H,null,ee(8,L=>r("div",{key:L,class:"bar-block",id:`bar-block-${L+1}`},null,8,QV)),64))]),R(" "+h(p(c)("Uploading... %s%",g.value)),1)])]),l(S,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(d(),_("div",IV,[r("label",TV,h(b.$t("Product Category")),1),l($,{modelValue:u.value,"onUpdate:modelValue":w[1]||(w[1]=L=>u.value=L),clearable:"",placeholder:b.$t("Select a Product Category")},{default:i(()=>[(d(!0),_(H,null,ee(o.value,(L,Q)=>(d(),E(M,{key:Q,label:L.title,value:Q},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[f.value?void 0:{name:"footer",fn:i(()=>[r("div",VV,[l(k,{onClick:w[2]||(w[2]=L=>y(!1))},{default:i(()=>[R(h(b.$t("Cancel")),1)]),_:1}),l(k,{type:"primary",onClick:w[3]||(w[3]=()=>{v()}),disabled:!u.value},{default:i(()=>[R(h(b.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},LV={class:"table-cell"},RV={class:"fct-product-info-card w-full"},OV={class:"fct-product-info-media"},HV={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},PV={class:"fct-product-info-name flex flex-col items-start gap-3"},NV={class:"table-cell"},KV={class:"table-cell"},GV={class:"table-cell"},jV={class:"table-cell"},zV={class:"table-cell"},YV={class:"table-cell"},qV={class:"table-cell"},WV={__name:"ProductsLoader",props:{nextPageCount:{type:Number,default:0},productTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(n,s)=>s+1);return(n,s)=>{const o=C("el-table-column"),u=C("el-skeleton-item"),A=C("el-table"),f=C("el-skeleton");return d(),E(f,{animated:""},{template:i(()=>[l(A,{data:p(a),class:"w-full compact-table responsive fct-loader-table"},{empty:i(()=>s[0]||(s[0]=[])),default:i(()=>[l(o,{selectable:()=>!1,type:"selection",width:"45"}),l(o,{label:n.$t("Products"),width:"380"},{default:i(()=>[r("div",LV,[r("div",RV,[r("div",OV,[l(u,{varient:"image",class:"w-10 h-10.5 flex-none"})]),r("div",HV,[r("div",PV,[l(u,{varient:"p",class:"max-w-[190px]"}),l(u,{varient:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(d(),E(o,{key:0,label:n.$t("Type"),width:"100"},{default:i(()=>[r("div",NV,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(d(),E(o,{key:1,label:n.$t("Variation"),width:"150"},{default:i(()=>[r("div",KV,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(d(),E(o,{key:2,label:n.$t("Price"),width:"130"},{default:i(()=>[r("div",GV,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(d(),E(o,{key:3,label:n.$t("Stock"),width:"100"},{default:i(()=>[r("div",jV,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(d(),E(o,{key:4,label:n.$t("Status"),width:"130"},{default:i(()=>[r("div",zV,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(d(),E(o,{key:5,label:n.$t("Date"),width:"120"},{default:i(()=>[r("div",YV,[l(u,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),l(o,{label:n.$t("Actions"),width:"80",align:"right"},{default:i(()=>[r("div",qV,[l(u,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},XV={},JV={class:"px-4 py-3"},ZV={class:"flex items-center justify-between mb-3"},eM={class:"grid grid-cols-3 gap-5 mt-5"};function tM(e,t){const a=C("el-skeleton-item"),n=C("el-skeleton");return d(),E(n,{animated:""},{template:i(()=>[r("div",JV,[r("div",ZV,[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})]),r("div",eM,[(d(),_(H,null,ee(3,s=>r("div",{key:s},[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const aM=He(XV,[["render",tM]]),nM={class:"fct-product-action show-on-mobile absolute right-0 top-1"},sM={class:"more-btn pr-3"},lM={class:"flex items-center gap-2"},oM={key:0},rM={key:1},iM={key:2},dM={key:0},uM={key:1},cM={key:0},AM={key:1},pM={key:0},fM={key:1},mM={class:"flex items-center gap-0.5"},hM={key:0},_M={key:1},gM=["innerHTML"],vM=["innerHTML"],yM={class:"fct-product-id hidden",title:"Product ID"},bM={class:"more-btn pr-3"},wM={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const n=a,s=V(null),o=y=>{y.action==="delete"?en(c("Are you sure you want to delete this product : %s ?",y.product.post_title),c("Confirm Delete!"),{confirmButtonText:c("Yes, Delete!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{n("delete",y.product.ID)}).catch(v=>{}):y.action==="duplicate"&&n("duplicate",y.product)},u=y=>y.min_price===y.max_price?Jt(y.min_price,!0):`${Jt(y.min_price,!0)} - ${Jt(y.max_price,!0)}`,A=y=>{switch(y){case"physical":return c("Physical");case"digital":return c("Digital");case"bundle":return c("Bundle");default:Gt.headline(y)}},f=y=>{switch(y){case"simple":return c("Simple");case"simple_variations":return c("Simple Variations");default:Gt.headline(y)}},m=y=>{n("selectionChange",y)};return t({clearSelection:()=>{var y,v;(v=(y=s.value)==null?void 0:y.clearSelection)==null||v.call(y)}}),(y,v)=>{const B=C("el-table-column"),b=C("router-link"),w=C("el-dropdown-item"),k=C("el-dropdown-menu"),S=C("el-dropdown"),M=C("el-tooltip"),$=C("el-table");return d(),E($,{ref_key:"elTableRef",ref:s,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:m},{empty:i(()=>[l(at,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:i(()=>[l(B,{type:"selection",width:"45"}),l(B,{label:p(c)("Products"),width:"380"},{default:i(F=>[l(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[l(Xd,{product:F.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),r("div",nM,[l(S,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:o,placement:"bottom-end"},{dropdown:i(()=>[l(k,null,{default:i(()=>[F.row.ID?(d(),E(w,{key:0,class:"item-link"},{default:i(()=>[l(b,{to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[l(W,{name:"Edit"}),R(" "+h(p(c)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),l(w,{command:{action:"duplicate",product:F.row}},{default:i(()=>[l(W,{name:"Duplicate"}),R(" "+h(p(c)("Duplicate")),1)]),_:2},1032,["command"]),l(w,{command:{action:"delete",product:F.row},class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:i(()=>[r("span",sM,[l(W,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(d(),E(B,{key:0,label:p(c)("Type"),width:"170"},{default:i(F=>[l(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>{var L,Q;return[r("div",lM,[((Q=(L=F.row.detail)==null?void 0:L.other_info)==null?void 0:Q.is_bundle_product)==="yes"?(d(),_("span",oM,h(p(c)("Bundle"))+" - ",1)):x("",!0),F.row.detail?(d(),_("span",rM,h(A(F.row.detail.fulfillment_type)),1)):(d(),_("span",iM,h(p(c)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(d(),E(B,{key:1,label:p(c)("Variation"),width:"150"},{default:i(F=>[l(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[F.row.detail?(d(),_("span",dM,h(f(F.row.detail.variation_type)),1)):(d(),_("span",uM,h("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(d(),E(B,{key:2,label:p(c)("Price"),width:"130"},{default:i(F=>[l(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[F.row.detail?(d(),_("span",cM,h(u(F.row.detail)),1)):(d(),_("span",AM,h(p(c)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(d(),E(B,{key:3,label:p(c)("Stock"),width:"100"},{default:i(F=>[l(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[F.row.detail?(d(),_("span",pM,[F.row.detail.manage_stock.toString()==="0"?(d(),_(H,{key:0},[R(h(p(c)("Unlimited")),1)],64)):(d(),_(H,{key:1},[R(h(p(Kt)(p(Ke).sum(F.row.variants,"available"))),1)],64))])):(d(),_("span",fM,h("")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(d(),E(B,{key:4,label:p(c)("Status"),width:"130"},{default:i(F=>[l(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[r("div",mM,[(d(),E(qt,{key:F.row.ID,status:F.row.post_status==="future"?"scheduled":F.row.post_status},null,8,["status"])),F.row.post_status==="future"?(d(),E(M,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:i(()=>[R(h(p(c)("Publishes On: %s",p(Hs)(F.row.post_date,!0))),1)]),default:i(()=>[l(W,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(d(),E(B,{key:5,label:p(c)("Date"),width:"120"},{default:i(F=>[l(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[l($a,{"date-time":F.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),(d(!0),_(H,null,ee(e.productTable.getCustomColumns(),F=>(d(),E(B,{label:F.label},{default:i(L=>[F.render_template?(d(),_("div",hM,[(d(),E(bn(rp),{templateContent:F.template,data:{column:F,product:L.row,index:L.$index}},null,8,["templateContent","data"]))])):(d(),_("div",_M,[F.as_link!==!1?(d(),E(na,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:L.row.ID}}},{default:i(()=>[r("div",{innerHTML:p(Ke).get(L.row,F.accessor)},null,8,gM)]),_:2},1032,["to"])):(d(),_("div",{key:1,innerHTML:p(Ke).get(L.row,F.accessor)},null,8,vM))]))]),_:2},1032,["label"]))),256)),l(B,{label:p(c)("Actions"),width:"80",align:"right"},{default:i(F=>[r("span",yM,"ID: "+h(F.row.ID),1),l(S,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:o,placement:"bottom-end"},{dropdown:i(()=>[l(k,null,{default:i(()=>[F.row.ID?(d(),E(w,{key:0,class:"item-link"},{default:i(()=>[l(b,{to:{name:"product_edit",params:{product_id:F.row.ID}}},{default:i(()=>[l(W,{name:"Edit"}),R(" "+h(p(c)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),l(w,{command:{action:"duplicate",product:F.row}},{default:i(()=>[l(W,{name:"Duplicate"}),R(" "+h(p(c)("Duplicate")),1)]),_:2},1032,["command"]),l(w,{command:{action:"delete",product:F.row},class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:i(()=>[r("span",bM,[l(W,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},CM={class:"fct-product-table-mobile-wrap"},BM={class:"fct-product-table-mobile-header"},kM={key:0,class:"fct-product-table-post-status-col"},xM={class:"flex items-center gap-1.5"},SM={class:"fct-product-action"},FM={class:"more-btn"},EM=["onClick"],UM={class:"fct-product-table-mobile-body-header"},$M={class:"fct-product-table-date-col"},DM={class:"invoice-no",title:"Product ID"},QM={key:0,class:"fct-product-table-price-col"},IM={key:0},TM={key:1},VM={class:"fct-product-table-product-col"},MM=["onClick"],LM={key:0,class:"fct-product-table-product-type"},RM={class:"title"},OM={key:0,class:"value"},HM={key:1,class:"value"},PM={key:1,class:"fct-product-table-variation-col"},NM={class:"title"},KM={key:0,class:"value"},GM={key:1,class:"value"},jM={key:2,class:"fct-product-table-stock-col"},zM={class:"title"},YM={key:0,class:"value"},qM={key:1},WM={key:0,class:"fct-product-table-mobile-footer"},XM={class:"fct-product-table-stock-col"},JM={key:0,class:"title"},ZM=["innerHTML"],e7=["innerHTML"],t7={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,n=A=>{A.action==="delete"&&en(c("Are you sure you want to delete this product : %s ?",A.product.post_title),c("Confirm Delete!"),{confirmButtonText:c("Yes, Delete!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{a("delete",A.product.ID)}).catch(f=>{})},s=A=>A.min_price===A.max_price?Jt(A.min_price,!0):`${Jt(A.min_price,!0)} - ${Jt(A.max_price,!0)}`,o=A=>{switch(A){case"physical":return c("Physical");case"digital":return c("Digital");default:Gt.headline(A)}},u=A=>{switch(A){case"simple":return c("Simple");case"simple_variations":return c("Simple Variations");default:Gt.headline(A)}};return(A,f)=>{const m=C("el-tooltip"),g=C("router-link"),y=C("el-dropdown-item"),v=C("el-dropdown-menu"),B=C("el-dropdown");return d(),_("div",CM,[(d(!0),_(H,null,ee(e.productTable.getTableData(),(b,w)=>(d(),_("div",{key:b.id,class:"fct-product-table-mobile-row"},[r("div",BM,[e.productTable.isColumnVisible("post_status")?(d(),_("div",kM,[r("div",xM,[(d(),E(qt,{key:b.ID,status:b.post_status,onClick:k=>A.$router.push({name:"product_edit",params:{product_id:b.ID}})},null,8,["status","onClick"])),b.post_status==="future"?(d(),E(m,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:i(()=>[R(h(p(c)("Publishes On: %s",p(Hs)(b.post_date,!0))),1)]),default:i(()=>[l(W,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):x("",!0)])])):x("",!0),r("div",SM,[l(B,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:n,placement:"bottom-end"},{dropdown:i(()=>[l(v,null,{default:i(()=>[b.ID?(d(),E(y,{key:0,class:"item-link"},{default:i(()=>[l(g,{to:{name:"product_edit",params:{product_id:b.ID}}},{default:i(()=>[l(W,{name:"Edit"}),R(" "+h(p(c)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),l(y,{command:{action:"delete",product:b},class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:i(()=>[r("span",FM,[l(W,{name:"More"})])]),_:2},1024)])]),r("div",{class:"fct-product-table-mobile-body",onClick:k=>A.$router.push({name:"product_edit",params:{product_id:b.ID}})},[r("div",UM,[r("div",$M,[e.productTable.isColumnVisible("post_date")?(d(),_(H,{key:0},[l($a,{class:"date","date-time":b.post_date,"with-time":!1},null,8,["date-time"]),f[0]||(f[0]=r("span",{class:"bullet"},"•",-1))],64)):x("",!0),r("span",DM,"#"+h(b.ID),1)]),e.productTable.isColumnVisible("item_price")?(d(),_("div",QM,[b.detail?(d(),_("span",IM,h(s(b.detail)),1)):(d(),_("span",TM,h(p(c)("Set Price")),1))])):x("",!0)]),r("div",VM,[l(Xd,{product:b},null,8,["product"])])],8,EM),r("div",{class:"fct-product-table-mobile-footer",onClick:k=>A.$router.push({name:"product_edit",params:{product_id:b.ID}})},[e.productTable.isColumnVisible("product_type")?(d(),_("div",LM,[r("div",RM,h(p(c)("Type")),1),b.detail?(d(),_("span",OM,h(o(b.detail.fulfillment_type)),1)):(d(),_("span",HM,h("N/A")))])):x("",!0),e.productTable.isColumnVisible("variation_type")?(d(),_("div",PM,[r("div",NM,h(p(c)("Variation")),1),b.detail?(d(),_("span",KM,h(u(b.detail.variation_type)),1)):(d(),_("span",GM,h("N/A")))])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(d(),_("div",jM,[r("div",zM,h(p(c)("Stock")),1),b.detail?(d(),_("span",YM,[b.detail.manage_stock.toString()==="0"?(d(),_(H,{key:0},[R(h(p(c)("Unlimited")),1)],64)):(d(),_(H,{key:1},[R(h(p(Kt)(p(Ke).sum(b.variants,"available"))),1)],64))])):(d(),_("span",qM,h("")))])):x("",!0)],8,MM),e.productTable.getCustomColumns()?(d(),_("div",WM,[(d(!0),_(H,null,ee(e.productTable.getCustomColumns(),k=>(d(),_("div",XM,[k.label?(d(),_("div",JM,h(k.label),1)):x("",!0),k.render_template?(d(),E(bn(rp),{key:1,templateContent:k.template,data:k,column:k,row:b},null,8,["templateContent","data","column","row"])):(d(),_(H,{key:2},[k.as_link!==!1?(d(),E(na,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:b.ID}}},{default:i(()=>[r("div",{innerHTML:p(Ke).get(b,k.accessor)},null,8,ZM)]),_:2},1032,["to"])):(d(),_("div",{key:1,innerHTML:p(Ke).get(b,k.accessor)},null,8,e7))],64))]))),256))])):x("",!0)]))),128))])}}},a7={class:"product-action-modal"},n7={class:"fct-alert-content"},s7={class:"fct-alert-title"},l7={class:"fct-alert-text"},o7={class:"fct-alert-subtext"},r7={key:1,class:"product-info"},i7={class:"info-text"},d7={key:0},u7={key:1},c7={key:2},A7={key:2,class:"options-wrapper"},p7={key:4,class:"products-preview"},f7={class:"preview-title"},m7={class:"product-list"},h7={class:"product-name"},_7={key:0,class:"remaining-count"},g7={key:5,class:"progress-section"},v7={class:"progress-text"},y7={key:6,class:"results-section"},b7={class:"dialog-footer"},w7={key:0,class:"el-icon-delete"},C7={__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,n=t,s=V(a.modelValue),o=V(!1),u=V(!1),A=V(!1),f=V(0),m=V(0),g=V(0),y=V({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=Ie.get("app_config.isProActive"),B=Ie.get("modules_settings.stock_management.active"),b=j(()=>a.action==="duplicate"),w=j(()=>a.action==="delete"),k=j(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),S=j(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),M=j(()=>k.value?c(b.value?"Bulk Duplicate Products":"Bulk Delete Products"):c(b.value?"Duplicate Product":"Delete Product")),$=j(()=>w.value?c(k.value?"Delete Products":"Delete Product"):c(k.value?"Duplicate Products":"Duplicate Product")),F=j(()=>a.products.slice(0,5)),L=j(()=>{const N=S.value-5;return N>0?N:0}),Q=j(()=>S.value===0?0:Math.round(f.value/S.value*100)),T=j(()=>{if(g.value>0&&f.value===S.value)return"exception";if(f.value===S.value)return"success"});ge(()=>a.modelValue,N=>{s.value=N,N&&(y.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},u.value=!1,A.value=!1,f.value=0,m.value=0,g.value=0,o.value=!1)}),ge(s,N=>{n("update:modelValue",N)});const D=()=>{!u.value&&!o.value&&(s.value=!1,(A.value&&m.value>0||!k.value&&!A.value)&&n("completed"))},U=()=>{k.value?K():I()},I=()=>{o.value=!0,b.value?O():P()},O=()=>{re.post(`products/${a.productId}/duplicate`,{import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles}).then(N=>{q.success(N.message||c("Product duplicated successfully")),n("completed"),D()}).catch(N=>{var oe,Z;((oe=N.status_code)==null?void 0:oe.toString())==="422"?q.validationErrors(N):q.error(((Z=N.data)==null?void 0:Z.message)||c("Failed to duplicate product"))}).finally(()=>{o.value=!1})},P=()=>{re.delete(`products/${a.productId}`).then(N=>{q.success(N.message||c("Product deleted successfully")),n("completed"),D()}).catch(N=>{var oe,Z;((oe=N.status_code)==null?void 0:oe.toString())==="422"?q.validationErrors(N):q.error(((Z=N.data)==null?void 0:Z.message)||c("Failed to delete product"))}).finally(()=>{o.value=!1})},K=async()=>{u.value=!0,f.value=0,m.value=0,g.value=0,b.value?await G():await ne(),u.value=!1,A.value=!0,Y()},G=async()=>{const N={import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles},oe=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(Z=>Z.ID);for(const Z of oe){try{await re.post(`products/${Z}/duplicate`,N),m.value++}catch{g.value++}f.value++}},ne=async()=>{const N=a.products&&a.products.length>0?a.products:[];for(const oe of N){try{await re.delete(`products/${oe.ID}`),m.value++}catch{g.value++}f.value++}},Y=()=>{const N=b.value?"duplicated":"deleted";m.value>0&&g.value===0?q.success({message:c(`All products ${N} successfully`)}):m.value>0&&g.value>0?q.warning({message:c(`Some products were ${N} successfully`)}):q.error({message:c(`Failed to ${N.replace("ed","")} products`)})};return(N,oe)=>{const Z=C("el-checkbox"),le=C("el-progress"),te=C("el-alert"),X=C("el-button"),ie=C("el-dialog");return d(),E(ie,{modelValue:s.value,"onUpdate:modelValue":oe[3]||(oe[3]=be=>s.value=be),title:M.value,"append-to-body":!0,width:"500px",onClose:D,"modal-class":"fct-duplicate-product-modal"},{footer:i(()=>[r("div",b7,[l(X,{onClick:D,disabled:u.value},{default:i(()=>[R(h(u.value||A.value?p(c)("Close"):p(c)("Cancel")),1)]),_:1},8,["disabled"]),A.value?x("",!0):(d(),E(X,{key:0,type:w.value?"danger":"primary",loading:o.value||u.value,disabled:o.value||u.value,onClick:U},{default:i(()=>[w.value?(d(),_("i",w7)):x("",!0),R(" "+h($.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:i(()=>[r("div",a7,[w.value?(d(),E(Na,{key:0,icon:"WarningFill",type:"error"},{content:i(()=>[r("div",n7,[r("h3",s7,h(p(c)("Are you sure?")),1),r("p",l7,[R(h(p(c)("You are about to permanently delete"))+" ",1),r("strong",null,h(S.value),1),R(" "+h(p(c)(S.value===1?"product":"products"))+". ",1)]),r("p",o7,h(p(c)("This action cannot be undone.")),1)])]),_:1})):x("",!0),b.value?(d(),_("div",r7,[r("div",i7,[R(h(p(c)(k.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),k.value?(d(),_("strong",d7,h(S.value),1)):(d(),_("strong",u7,h(e.productName),1)),k.value?(d(),_("span",c7,h(p(c)(S.value===1?"product":"products")),1)):x("",!0)])])):x("",!0),b.value?(d(),_("div",A7,[l(Z,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":oe[0]||(oe[0]=be=>y.value.importDownloadableFiles=be),label:p(c)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),l(Z,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":oe[1]||(oe[1]=be=>y.value.importLicenseSettings=be),label:p(c)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),p(B)==="yes"?(d(),_(H,{key:0},[p(v)?(d(),E(Z,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":oe[2]||(oe[2]=be=>y.value.importStockManagement=be),label:p(c)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(d(),E(Z,{key:1,disabled:!0,size:"large"},{default:i(()=>[R(h(p(c)("Import Stock Management"))+" ",1),l(W,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):x("",!0)])):x("",!0),b.value?(d(),E(Na,{key:3,type:"warning",icon:"InformationFill"},{default:i(()=>[r("span",null,h(p(c)(k.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):x("",!0),w.value&&k.value&&!u.value&&!A.value?(d(),_("div",p7,[r("p",f7,h(p(c)("Products to be deleted:")),1),r("ul",m7,[(d(!0),_(H,null,ee(F.value,be=>(d(),_("li",{key:be.ID,class:"product-item"},[r("span",h7,h(be.post_title),1)]))),128)),L.value>0?(d(),_("li",_7,h(p(c)("... and %s more",L.value)),1)):x("",!0)])])):x("",!0),k.value&&u.value?(d(),_("div",g7,[l(le,{percentage:Q.value,status:T.value},null,8,["percentage","status"]),r("p",v7,h(p(c)(w.value?"Deleting":"Duplicating"))+" "+h(f.value)+" / "+h(S.value),1)])):x("",!0),k.value&&A.value?(d(),_("div",y7,[m.value>0?(d(),E(te,{key:0,title:p(c)(w.value?"Successfully deleted %s product(s)":"Successfully duplicated %s product(s)",m.value),type:"success",closable:!1,"show-icon":""},null,8,["title"])):x("",!0),g.value>0?(d(),E(te,{key:1,title:p(c)(w.value?"Failed to delete %s product(s)":"Failed to duplicate %s product(s)",g.value),type:"error",closable:!1,"show-icon":"",style:{"margin-top":"10px"}},null,8,["title"])):x("",!0)])):x("",!0)])]),_:1},8,["modelValue","title"])}}},B7={class:"fct-all-products-page fct-layout-width"},k7={class:"fct-all-products-wrap"},x7={key:0,class:"bulk-actions-bar"},S7={class:"bulk-left flex items-center gap-2"},F7={class:"bulk-right"},E7={key:1,class:"fct-products-table-wrap"},U7={__name:"AllProducts",setup(e){const t=um({instance:Qt()}),a=V(!1),n=V(!1),s=V("duplicate"),o=V(null),u=V([]),A=V(""),f=V(!1),m=()=>{f.value=window.innerWidth<768},g=Q=>{re.delete(`products/${Q}`).then(T=>{q.success(T),t.fetch()}).catch(T=>{var D;T.status_code.toString()==="422"?q.validationErrors(T):q.error((D=T.data)==null?void 0:D.message)})},y=Q=>{o.value=Q,u.value=[],s.value="duplicate",n.value=!0},v=()=>{t.fetch(),o.value=null,u.value=[]},B=()=>{var Q,T;t.fetch(),u.value=[],A.value="",(T=(Q=L.value)==null?void 0:Q.clearSelection)==null||T.call(Q)},b=Q=>{u.value=Q},w=()=>{if(u.value.length===0){q.warning({message:c("Please select at least one product to duplicate")});return}o.value=null,s.value="duplicate",n.value=!0},k=()=>{if(u.value.length===0){q.warning({message:c("Please select at least one product to delete")});return}o.value=null,s.value="delete",n.value=!0},S=()=>{if(!A.value){q.warning({message:c("Please select a bulk action")});return}A.value==="duplicate"?w():A.value==="delete"&&k()},M=j(()=>u.value.map(Q=>Q.ID)),$=j(()=>u.value.length>0),F=j(()=>u.value.length>0),L=V(null);return Be(()=>{m(),window.addEventListener("resize",m)}),At(()=>{window.removeEventListener("resize",m)}),(Q,T)=>{const D=C("el-icon"),U=C("el-button"),I=C("el-dropdown-item"),O=C("el-dropdown-menu"),P=C("el-dropdown"),K=C("el-option"),G=C("el-select"),ne=C("el-dialog");return d(),_("div",B7,[l(za,{title:p(c)("Products")},{action:i(()=>[l(St,{permission:"products/create"},{default:i(()=>[l(P,{trigger:"click","popper-class":"fct-dropdown",onCommand:T[3]||(T[3]=()=>{}),placement:"bottom-end"},{dropdown:i(()=>[l(O,null,{default:i(()=>[l(I,{class:"item-link"},{default:i(()=>[l(MV,{onOnProductCreated:T[0]||(T[0]=Y=>p(t).fetch()),products:p(t).getTableData()},null,8,["products"])]),_:1}),l(I,{onClick:T[1]||(T[1]=Y=>Q.$router.push({name:"product_bulk_insert"}))},{default:i(()=>[l(W,{name:"Insert"}),R(" "+h(p(c)("Bulk Product Insert")),1)]),_:1}),l(I,{onClick:T[2]||(T[2]=Y=>Q.$router.push({name:"product_bulk_edit"}))},{default:i(()=>[l(W,{name:"Edit"}),R(" "+h(p(c)("Bulk Product Edit")),1)]),_:1})]),_:1})]),default:i(()=>[l(U,null,{default:i(()=>[R(h(p(c)("More actions"))+" ",1),l(D,null,{default:i(()=>[l(p(Pr))]),_:1})]),_:1})]),_:1}),l(U,{type:"primary",onClick:T[4]||(T[4]=()=>{a.value=!0})},{default:i(()=>[R(h(p(c)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),l(St,{permission:"products/view"},{default:i(()=>[r("div",k7,[l(js,{table:p(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:i(()=>[p(t).isLoading()?(d(),E(aM,{key:0})):x("",!0),l(t7,{"product-table":p(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:i(()=>[l(vs,{name:"slide-fade"},{default:i(()=>[$.value?(d(),_("div",x7,[r("div",S7,[l(G,{size:"small",class:"bulk-select min-w-[180px]",placeholder:p(c)("Select Bulk Action"),modelValue:A.value,"onUpdate:modelValue":T[5]||(T[5]=Y=>A.value=Y)},{default:i(()=>[l(K,{label:p(c)("Duplicate"),value:"duplicate"},null,8,["label"]),l(K,{label:p(c)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),l(U,{size:"small",type:A.value==="delete"?"danger":"primary",onClick:S},{default:i(()=>[A.value==="delete"?(d(),E(W,{key:0,name:"Delete",class:"w-4 h-4"})):(d(),E(W,{key:1,name:"Copy",class:"w-4 h-4"})),R(" "+h(p(c)("Confirm")),1)]),_:1},8,["type"])]),r("div",F7,h(u.value.length)+" "+h(p(c)("item(s) selected")),1)])):x("",!0)]),_:1}),p(t).isLoading()?(d(),E(WV,{key:0,productTable:p(t),"next-page-count":p(t).nextPageCount},null,8,["productTable","next-page-count"])):(d(),_("div",E7,[l(wM,{ref_key:"productTableRef",ref:L,"product-table":p(t),onDelete:g,onDuplicate:y,onSelectionChange:b},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),l(St,{permission:"products/create"},{default:i(()=>{var Y,N;return[l(ne,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":T[6]||(T[6]=oe=>a.value=oe),title:p(c)("Add New Product")},{default:i(()=>[a.value?(d(),E(ai,{key:0})):x("",!0)]),_:1},8,["modelValue","title"]),l(C7,{modelValue:n.value,"onUpdate:modelValue":T[7]||(T[7]=oe=>n.value=oe),action:s.value,"product-id":(Y=o.value)==null?void 0:Y.ID,"product-name":(N=o.value)==null?void 0:N.post_title,products:F.value?u.value:[],"product-ids":F.value?M.value:[],onCompleted:T[8]||(T[8]=oe=>F.value?B():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},$7=He(U7,[["__scopeId","data-v-cd57428c"]]);let D7=0;function rn(){return"_cid_"+ ++D7}const is={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Uu extends Ya{constructor(){super(...arguments);Ee(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:is.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:is.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}}});Ee(this,"ensureProductVariantIsArray",a=>{Array.isArray(a.variants)||(a.variants=[])})}getDummyVariation(a){var o;const n=a==null?void 0:a.variants,s={...this.data.dummies.variation};return s.serial_index=Array.isArray(n)?n.length+1:1,s.fulfillment_type=(o=a==null?void 0:a.detail)==null?void 0:o.fulfillment_type,s.other_info={...this.data.dummies.variationDetail},s.media=[],s._cid=rn(),s}addVariationToProduct(a){this.ensureProductVariantIsArray(a),a.variants.push(this.getDummyVariation(a))}handleVariationChanged(a,n){n==="simple_variations"?this.addVariationToProduct(a):a.variants=[]}getColumnWidthStorageKey(){return""}saveColumnWidths(a){const n=this.getColumnWidthStorageKey();if(!n)return;const s={};a.forEach(o=>{o.key&&(s[o.key]=o.width)}),vt.set(n,s)}restoreColumnWidths(a){const n=this.getColumnWidthStorageKey();if(!n)return;const s=vt.get(n);s&&typeof s=="object"&&a.forEach(o=>{o.key&&s[o.key]!==void 0&&(o.width=s[o.key])})}getColumnStorageKey(){return""}getToggleableColumns(){return[]}setupColumnVisibility(){const a=this.getColumnStorageKey();if(!a)return;const n=vt.get(a);Array.isArray(n)?this.data.visibleColumns=n:this.data.visibleColumns=this.getToggleableColumns().map(s=>s.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&vt.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 o;if(!Array.isArray(a.variants))return;if(!((o=a.detail)==null?void 0:o.manage_stock)){for(const u of a.variants)u.stock_status=is.IN_STOCK;a.detail&&(a.detail.stock_availability=is.IN_STOCK);return}let s=!0;for(const u of a.variants){const A=parseInt(u.available,10)||0;u.stock_status=A>0?is.IN_STOCK:is.OUT_OF_STOCK,A>0&&(s=!1)}a.detail&&(a.detail.stock_availability=s?is.OUT_OF_STOCK:is.IN_STOCK)}addDummyDownloadableFiles(a){const n=a;Array.isArray(n.downloadable_files)||(n.downloadable_files=[]),n.downloadable_files.push(this.downloadableFileSchema)}}class Q7{constructor(){Ee(this,"confirmBox",Ea.confirm);Ee(this,"promptBox",Ea.prompt)}confirm(t,a,n){return this.confirmBox(t,a,n)}ofDelete(t=null,a=null,n){return t===null&&(t=c("Are you sure you want to delete this?. This action is not recoverable")),a===null&&(a=c("Confirm Delete!")),n={confirmButtonText:c("Yes, Delete!"),cancelButtonText:c("Cancel"),confirmButtonClass:"el-button--primary",type:"warning",...n??{}},this.confirm(t,a,n)}confirmWithInput(t,a,n){return this.promptBox(t,a,n)}confirmDeleteWithInput(t,a=null,n=null,s){a===null&&(a=c("Are you sure you want to delete this?. This action is not recoverable"));const o=c('You must type "%s" exactly to proceed',`<span >${t}</span>`);return a=`<label for=""><p>${a}</p> |
| 162 |
<p>${o}</p></label>`,n===null&&(n=c("Confirm Delete!")),s={confirmButtonText:c("Yes, Delete!"),cancelButtonText:c("Cancel"),confirmButtonClass:"el-button--primary",inputPattern:new RegExp(`^${t}$`),inputErrorMessage:c("You must type %s exactly to proceed",t),dangerouslyUseHTMLString:!0,type:"warning",...s??{}},this.confirmWithInput(a,n,s)}}const $u=new Q7;class I7 extends Uu{constructor(){super(...arguments);Ee(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:{}});Ee(this,"router",ja());Ee(this,"_mergeOtherInfo",(a,n)=>{const s=JSON.parse(JSON.stringify(n));Object.keys(s).forEach(o=>{a[o]=s[o]}),Object.keys(a).forEach(o=>{o in s||delete a[o]})});Ee(this,"_mergeSnapshot",a=>{const n=this.data.product,s=new Set(["ID","guid","variants","detail","downloadable_files","product_terms","taxonomies","variantOptions"]);if(Object.keys(a).forEach(o=>{if(s.has(o))return;const u=a[o];n[o]=u!==null&&typeof u=="object"?JSON.parse(JSON.stringify(u)):u}),a.detail&&n.detail){const o=JSON.parse(JSON.stringify(a.detail));Object.keys(o).forEach(u=>{u!=="other_info"&&(n.detail[u]=o[u])}),o.other_info&&(n.detail.other_info||(n.detail.other_info={}),this._mergeOtherInfo(n.detail.other_info,o.other_info))}if(Array.isArray(a.variants)&&Array.isArray(n.variants)){const o={};a.variants.forEach(A=>{A.id&&(o[A.id]=A)});const u=new Set(["id","post_id","rowId","media","created_at","updated_at"]);n.variants.forEach(A=>{const f=o[A.id];f&&Object.keys(f).forEach(m=>{if(u.has(m))return;const g=f[m];m==="other_info"&&A.other_info?this._mergeOtherInfo(A.other_info,g):A[m]=g!==null&&typeof g=="object"?JSON.parse(JSON.stringify(g)):g})})}});Ee(this,"addDummyVariant",()=>{var a,n;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:((n=(a=window.fluentCartAdminApp)==null?void 0:a.shop)==null?void 0:n.weight_unit)||"kg"},downloadable:"true"}});Ee(this,"formatPricing",a=>{let n={};return a.forEach((s,o)=>{s.item_price=s.item_price?Jt(s.item_price,!1):0,s.item_cost=s.item_cost?Jt(s.item_cost,!1):0,s.compare_price=s.compare_price?Jt(s.compare_price,!1):0,s.other_info.signup_fee=s.other_info.signup_fee?Jt(s.other_info.signup_fee,!1):0,s.rowId=o,n[s.id]=s}),a});Ee(this,"onChangePricing",(a,n,s)=>{this.ensureVariationIndex(n),this.product.variants[n][a]=s,a==="item_price"&&this.onChangePricingPayment(this.product.variants[n],s,n),this.data.product_changes.detail||(this.data.product_changes.detail.id=this.product.detail.id),this.data.product_changes.variants[n][a]=s,this.data.product_changes.variants[n].id=this.product.variants[n].id,this.setHasChange(!0)});Ee(this,"updateLongDescEditorChange",a=>{this.setHasChangeLongDescEditor(!0),re.post(`products/${this.product.ID}/update-long-desc-editor-mode`,{active_editor:a??"wp-editor"}).then(n=>{q.success(n.message)}).catch(n=>{n&&n.message&&q.error(n)}).finally(()=>{this.setHasChangeLongDescEditor(!1)})});Ee(this,"onChangePricingPayment",(a,n,s)=>{var o;if(a.item_price!==""&&a.other_info.repeat_interval!==""){let u=parseInt(a.other_info.times)?c("for %s Times",(o=a==null?void 0:a.other_info)==null?void 0:o.times):c("Until Cancel");return this.data.product_changes.variants[s].billing_summary=`${a.item_price} ${a.other_info.repeat_interval} ${u}`,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} ${u}`}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=""});Ee(this,"onUploadPricingMedia",(a,n,s)=>{this.product.variants[n][a]=[],this.product.variants[n][a]=[...this.product.variants[n][a],...s];const o=this.product.variants[n].id;re.post(`products/variants/${o}/setMedia`,{media:this.product.variants[n].media}).then(u=>{q.success(u.message)}).catch(u=>{var A;u.status_code=="422"?q.validationErrors(u):q.error((A=u.data)==null?void 0:A.message)}).finally(()=>{})});Ee(this,"afterCreatingOrUpdatingPricing",(a,n)=>{n.created_at=n.created_at??new Date().toLocaleDateString()+""+new Date().toLocaleTimeString(),a!==void 0&&a!=null?this.product.variants[a]=n:(n.rowId=this.variantsLength()>0?this.data.product.variants[this.variantsLength()-1].rowId+1:this.variantsLength(),this.data.product.variants.push(n),a=this.variantsLength()-1),this.data.productDownloadableModel.setDownloadableFiles(this.data.product.downloadable_files)});Ee(this,"createOrUpdatePricing",a=>{this.setSaving(!0),this.setValidationErrors({});let n="";return a.id!=null?n=re.post(`products/variants/${a.id}`,{variants:a}):n=re.post("products/variants",{variants:a}),n.then(s=>(q.success(s.message),Object.values(this.data.onProductUpdatedListener).forEach(o=>{typeof o=="function"&&o(this.product)}),this.saveSnapshot(),s)).catch(s=>{var o;s.status_code=="422"?(q.validationErrors(s),this.setValidationErrors(s.data)):q.error((o=s.data)==null?void 0:o.message)}).finally(()=>{this.setSaving(!1)})});Ee(this,"updatePricingValue",(a,n,s,o,u)=>{if(s.includes(".")&&(s=s.split(".").pop()),this.ensureVariationIndex(s),s!==void 0&&this.clearValidationError(`${s}.${a}`),o[a]=n,a==="item_price"&&this.onChangePricingPayment(o,n,s),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.fulfillment_type=n,this.data.product_changes.variants[s].fulfillment_type=n),a==="item_cost"){const A=parseFloat(n);o.item_cost=isNaN(A)||A<0?0:A}parseFloat(o.item_cost)>parseFloat(o.item_price)&&(o.item_cost=0),this.data.product_changes.variants[s][a]=a==="item_cost"?o[a]:n,this.data.product_changes.variants[s].id=o.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=n,this.data.product_changes.variants[s].fulfillment_type=n),this.product.variants[0]=o,this.setHasChange(!0))});Ee(this,"updatePricingOtherValue",(a,n,s=null,o,u="")=>{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}`),o.other_info[a]=n,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]=n,o.other_info.payment_type==="subscription"&&(a==="times"&&parseInt(n)<0&&(o.other_info.times=0),o.other_info.times=o.other_info.times??"",o.other_info.repeat_interval=o.other_info.repeat_interval??"",o.other_info.trial_days=o.other_info.trial_days??0,o.other_info.billing_summary=o.other_info.billing_summary??"",o.other_info.manage_setup_fee=o.other_info.manage_setup_fee??"no",o.other_info.signup_fee_name=o.other_info.signup_fee_name??"",o.other_info.signup_fee=o.other_info.signup_fee??"",o.other_info.setup_fee_per_item=o.other_info.setup_fee_per_item??"no"),this.data.product_changes.variants[s].other_info=o.other_info,this.data.product_changes.variants[s].id=o.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(o,n,s)),["media"].includes(a)&&(o.media=[],o.media=[...o.media,...n],this.data.product_changes.variants[s].media=o.media,this.data.product_changes.variants[s].id=o.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={}),o.other_info[a]=n,this.data.product_changes.variants[s].other_info[a]=n,this.data.product_changes.variants[s].id=o.id,this.data.product_changes.detail.id=this.product.detail.id),this.product.detail.variation_type==="simple"&&(this.product.variants[0]=o,this.data.product_changes.variants=[],this.data.product_changes.variants[0]=o,this.data.product_changes.variants[0].id=o.id,this.data.product_changes.detail.id=this.product.detail.id),u==="add"&&this.setHasChange(!0)});Ee(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});Ee(this,"deletePricing",(a,n)=>$u.ofDelete(c("Are you sure, you want to delete this price?")).then(()=>{if(a!==void 0)return re.delete(`products/variants/${a}`).then(s=>{q.success(s.message),this.afterDeletingPricing(n),this.saveSnapshot()}).catch(s=>{throw(s==null?void 0:s.status_code)=="422"?q.validationErrors(s):q.error(s==null?void 0:s.data),s})}));Ee(this,"getDownloadableHeaderClass",()=>{var n;const a=this.product.downloadable_files&&Array.isArray(this.product.downloadable_files)&&this.product.downloadable_files.length>0;return{"!border-0":((n=this.product.detail)==null?void 0:n.manage_downloadable)=="0"||!a}});Ee(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(n=>n.manage_stock=a),this.setHasChange(!0)});Ee(this,"ensureVariationIndex",a=>{var n;(n=this.data.product_changes)!=null&&n.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]={})});Ee(this,"onChangeNewStock",(a,n,s)=>{this.product.variants[s]||(this.data.product_changes.variants=[]),this.ensureVariationIndex(s),n===""&&(this.product.variants[s].new_stock=0,this.data.product_changes.variants[s].new_stock=0);let o=this.product.variants[s].total_stock??0,u=this.product.variants[s].new_stock??0,A=parseInt(u.toString())-parseInt(o);this.product.variants[s].adjusted_quantity=A,this.data.product_changes.variants[s].adjusted_quantity=A,this.data.product_changes.variants[s].id=this.product.variants[s].id});Ee(this,"onChangeAdjustedQuantity",(a,n,s)=>{this.ensureVariationIndex(s),n===""&&(n=0);let o=this.product.variants[s].total_stock+parseInt(n);this.product.variants[s].new_stock=o<0?0:o});Ee(this,"onChangeInputField",(a,n,s=!0)=>{var o,u,A,f,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=n,(o=this.data.product_changes)!=null&&o.variants||(this.data.product_changes.variants=[]),this.ensureVariationIndex(0),this.data.product_changes.variants[0].variation_title=n,this.data.product_changes.variants[0].id=this.product.variants[0].id),a==="post_date"&&(this.product[a]=Re(n).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=n),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail.fulfillment_type=n,this.data.product_changes.detail.fulfillment_type=n,this.data.product_changes.detail.id=this.product.detail.id,this.product.variants.forEach((g,y)=>{this.product.variants[y].fulfillment_type=n,this.ensureVariationIndex(y),this.data.product_changes.variants[y].fulfillment_type=n,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={}),(u=this.product.detail)!=null&&u.other_info||(this.product.detail.other_info={}),this.product.detail.other_info[a]=n,(A=this.data.product_changes.detail)!=null&&A.other_info||(this.data.product_changes.detail.other_info={}),this.data.product_changes.detail.other_info[a]=n,this.product.variants.forEach((g,y)=>{this.product.variants[y].shipping_class=n,this.ensureVariationIndex(y),this.data.product_changes.variants[y].shipping_class=n,this.data.product_changes.variants[y].id=g.id})),["group_pricing_by","use_pricing_table","active_editor","sold_individually"].includes(a)&&(this.ensureVariationIndex(0),this.data.product_changes.detail||(this.data.product_changes.detail={}),(f=this.product.detail)!=null&&f.other_info||(this.product.detail.other_info={}),(m=this.data.product_changes.detail)!=null&&m.other_info||(this.data.product_changes.detail.other_info={}),this.product.detail.other_info[a]=n,this.data.product_changes.detail.other_info[a]=n,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]=n,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=n.trim();g.length===0?this.setExcerptWordCount(0):this.setExcerptWordCount(g.split(" ").length)}else this.product[a]=n,this.data.product_changes[a]=n,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id;s&&this.setHasChange(!0)});Ee(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));Ee(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});Ee(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))});Ee(this,"update",async(a=null)=>{var u,A,f,m,g,y;let n=this.data.product_changes;if(n={...this.product},n.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?((u=this.data.product_changes.detail)!=null&&u.fulfillment_type||(this.data.product_changes.detail.fulfillment_type=this.product.detail.fulfillment_type),(A=this.data.product_changes.detail)!=null&&A.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),n=this.data.product_changes,n.metaValue=this.data.metaValue,this.setValidationErrors({}),this.setSaving(!0),((f=n.detail)==null?void 0:f.variation_type)==="simple"&&(n.variants||(n.variants=[]),!Array.isArray(n.variants)||n.variants.length===0)){const v=((m=this.product.variants)==null?void 0:m[0])||{};n.variants[0]={id:v.id,variation_title:n.post_title||v.variation_title,item_price:v.item_price??"",post_id:this.product.ID}}if(delete n.taxonomies,delete n.product_terms,delete n.variantOptions,delete n.downloadable_files,((g=n.detail)==null?void 0:g.variation_type)!=="simple"&&n.variants){let v=[];n.variants.forEach(B=>{v.push({id:B.id,variation_title:B.variation_title,sku:B.sku,item_price:B.item_price,compare_price:B.compare_price,item_cost:B.item_cost,manage_cost:B.manage_cost,fulfillment_type:B.fulfillment_type,shipping_class:B.shipping_class,other_info:B.other_info,manage_stock:B.manage_stock,serial_index:B.serial_index,total_stock:B.total_stock,available:B.available,committed:B.committed,on_hold:B.on_hold,stock_status:B.stock_status,sold_individually:B.sold_individually,media:B.media,downloadable:B.downloadable,payment_type:B.payment_type})}),n.variants=v}((y=n.downloadable_files)==null?void 0:y.length)<1&&(n.variantOptions=[]);const s=re.post(`products/${this.product.ID}/pricing`,n);let o=document.querySelector(".fct-admin-product-info .badge");s.then(v=>{q.success(a||v.message),this.setHasChange(!1),o&&(o.innerText=v.data.post_status),this.product.view_url=v.data.viewUrl,o&&v.data.post_status==="publish"&&(o.classList.remove("warning"),o.classList.add("success")),o&&v.data.post_status==="future"&&(o.innerText=c("Publishes on: %s",Hs(v.data.post_date,!0)),o.classList.remove("success"),o.classList.add("warning")),o&&(v.data.post_status==="draft"?(o.classList.remove("success"),o.classList.add("info")):(o.classList.remove("info"),o.classList.add("success"))),this.product.detail.variation_type==="simple"&&Array.isArray(v.data.variants)&&v.data.variants.length>0&&(this.product.variants[0].id=v.data.variants[0].id,this.product.variants[0].created_at=v.data.variants[0].created_at),this.product.variants=this.product.variants.filter((B,b,w)=>b===w.findIndex(k=>k.id===B.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(B=>{typeof B=="function"&&B(this.product)})}).catch(v=>{var B,b;((B=v==null?void 0:v.status_code)==null?void 0:B.toString())==="422"?(q.validationErrors(v),this.setValidationErrors(v)):q.error(((b=v==null?void 0:v.data)==null?void 0:b.message)||(v==null?void 0:v.message)||c("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});Ee(this,"delete",()=>{en(c("Are you sure you want to delete this product?"),c("Confirm Delete!"),{confirmButtonText:c("Yes, Delete!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{this.setHasChange(!1),re.delete(`products/${this.product.ID}`).then(a=>{q.success(a.message),this.router.push({name:"products"})}).catch(a=>{var n;a.status_code=="422"?q.validationErrors(a):q.error((n=a.data)==null?void 0:n.message)})}).catch(()=>{})});Ee(this,"updateVariationType",(a,n)=>{var u,A;this.product.detail[a]=n;let s={variation_type:n,variation_ids:[(A=(u=this.product)==null?void 0:u.variants[0])==null?void 0:A.id],action:"change_variation_type"};re.post(`products/detail/${this.product.detail.id}`,s).then(f=>{q.info(f.message),a==="variation_type"&&n==="simple"&&(this.product.variants=this.product.variants.slice(0,1),this.variantsLength()>0&&(this.product.variants[0].manage_stock=this.product.detail.manage_stock))}).catch(f=>{var m;f.status_code=="422"?q.validationErrors(f):q.error((m=f.data)==null?void 0:m.message)}).finally(()=>{})});Ee(this,"getMaxExcerptWordCount",()=>{re.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});Ee(this,"shouldShowShippingMethodAlert",()=>Ie.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());Ee(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));Ee(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));Ee(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));Ee(this,"isTaxEnabled",()=>Ie.get("is_tax_enabled"));Ee(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Ee(this,"isBundleProduct",()=>Ke.get(this.data.product,"detail.other_info.is_bundle_product")==="yes")}addOnProductUpdatedListener(a,n){this.data.onProductUpdatedListener[a]=n}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 n=document.querySelector(".fct-admin-product-info .badge");n&&a.post_status==="future"&&(n.innerText=c("Publishes on: %s",Hs(a.post_date,!0)),n.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 n;a.forEach((s,o)=>{s.serial_index=o+1}),(n=this.data.product_changes)!=null&&n.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)}addDummyDownloadableFile(){super.addDummyDownloadableFiles(this.product),this.setHasChange(!0)}updateMedia(a,n){this.product[a]=n,this.data.product_changes[a]=n,this.setHasChange(!0)}shippingSettingsUrl(){return Ie.get("admin_url")+"settings/shipping"}}function T7(){return I7.init()}function V7(){Be(()=>{document.addEventListener("keydown",t)}),xn(()=>{document.removeEventListener("keydown",t)});let e;function t(n){(n.ctrlKey||n.metaKey)&&n.shiftKey&&n.keyCode===83&&(n.preventDefault(),typeof e=="function"&&e())}function a(n){e=n}return{onSave:a}}const M7={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},L7={key:0,class:"iframe-loader"},R7=["src"],O7={class:"iframe-controls"},H7={class:"dialog-header"},P7={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},N7={key:0,class:"iframe-loader"},K7=["src"],G7={__name:"GutenbergEditor",props:{post_id:{required:!0},product:{type:Object},reload:Function,productEditModel:Object},setup(e){const t=e,a=V(!1),n=V(!0),s=V(!0),o=V(),u=V(null),A=V(null);fn();const f=()=>{const k=window.location.origin;o.value=k+"/wp-admin"},m=()=>{setTimeout(()=>{n.value=!1},500)},g=()=>{var k;s.value=!1,setTimeout(()=>{},500);try{const S=(k=A.value)==null?void 0:k.contentDocument;S&&S.addEventListener("click",M=>{const $=M.target.closest("a[href]");if($&&!$.target&&!$.getAttribute("onclick")){const F=$.getAttribute("href");F&&(F.startsWith("/")||F.startsWith("http"))&&(M.preventDefault(),window.parent.postMessage({type:"navigateTo",content:F},"*"))}},!0)}catch{}},y=()=>{a.value=!0,s.value=!0},v=()=>{s.value=!1,a.value=!1,t.productEditModel.data.reloader()},B=()=>{n.value=!0,u.value&&(u.value.src=u.value.src.toString())},b=()=>{s.value=!0,A.value&&(A.value.src=A.value.src.toString())},w=k=>{const{type:S,content:M}=k.data;S==="gutenbergContentChanged"&&B(),S==="navigateTo"&&(v(),window.location.href=M)};return Be(()=>{f(),window.addEventListener("message",w)}),(k,S)=>{const M=C("el-icon"),$=C("el-button"),F=C("el-breadcrumb-item"),L=C("el-breadcrumb"),Q=C("el-dialog");return d(),_(H,null,[r("div",M7,[S[2]||(S[2]=r("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),n.value?(d(),_("div",L7,[r("span",null,[R(h(p(c)("Loading preview..."))+" ",1),l(M,{class:"is-loading"},{default:i(()=>[l(p(_l))]),_:1})])])):x("",!0),r("iframe",{ref_key:"previewIframeRef",ref:u,class:"scrollbar-none preview-iframe",src:`${o.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true&is-preview-mode=true`,width:"100%",height:"400px",onLoad:m,style:ia({visibility:n.value?"hidden":"visible"})},null,44,R7)]),r("div",O7,[l($,{onClick:y},{default:i(()=>[R(h(p(c)("Show Content Editor")),1)]),_:1})]),l(Q,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":S[0]||(S[0]=T=>a.value=T),onClose:v,onOpen:S[1]||(S[1]=()=>{b()})},{header:i(()=>[r("div",H7,[l(L,{separator:"/"},{default:i(()=>[l(F,null,{default:i(()=>[r("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:v},h(e.product.post_title),1)]),_:1}),l(F,null,{default:i(()=>S[3]||(S[3]=[R("Editor",-1)])),_:1,__:[3]})]),_:1}),s.value?x("",!0):(d(),E($,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:v},{default:i(()=>[l(W,{name:"Cross"}),R(" "+h(p(c)("Close")),1)]),_:1}))])]),default:i(()=>[r("div",P7,[s.value?(d(),_("div",N7,[r("span",null,[R(h(p(c)("Loading editor..."))+" ",1),l(M,{class:"is-loading"},{default:i(()=>[l(p(_l))]),_:1})])])):x("",!0),r("iframe",{ref_key:"dialogIframeRef",ref:A,class:"dialog-iframe",src:`${o.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:ia({visibility:s.value?"hidden":"visible"})},null,44,K7)])]),_:1},8,["modelValue"])],64)}}},j7=He(G7,[["__scopeId","data-v-2a0b985d"]]),z7={class:"fct-product-info-wrap"},Y7={class:"fct-admin-input-wrapper"},q7={class:"fct-admin-input-wrapper"},W7={class:"form-note"},X7={class:"fct-excerpt-word-counter mt-[7px]"},J7={class:"editor-tabs-nav"},Z7={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},eL={class:"custom-wp-editor-wrapper relative"},tL={class:"relative rounded overflow-hidden"},aL={class:"editor-tab-content fct-wp-editor-tab-content"},nL={class:"editor-tab-content fct-gutenberg-tab-content"},sL={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=V(!1),n=V("wp-editor");V("#gt"),fn();const s=V(),o=u=>{t.productEditModel.updateLongDescEditorChange(u),n.value=u};return ge(()=>t.product.post_title,u=>{const A=document.querySelector(".fct-admin-product-header .product-name");A&&(A.textContent=u&&u.trim()?u:c("Product Name"))}),Be(()=>{var u,A,f,m,g,y;a.value=!0,t.productEditModel.getMaxExcerptWordCount(),((u=t.product)==null?void 0:u.post_excerpt)!==void 0&&((A=t.product)==null?void 0:A.post_excerpt.toString().length)>0&&t.productEditModel.setExcerptWordCount((f=t.product)==null?void 0:f.post_excerpt.toString().split(" ").length),(y=(g=(m=t.product)==null?void 0:m.detail)==null?void 0:g.other_info)!=null&&y.active_editor&&(n.value=t.product.detail.other_info.active_editor)}),ge(()=>t.productEditModel.data.discardKey,()=>{s.value&&s.value.resetContent(t.product.post_content)}),(u,A)=>{const f=C("el-input"),m=C("el-form-item"),g=C("el-form"),y=Ca("loading");return d(),_("div",z7,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:A[6]||(A[6]=Xe(()=>{},["prevent"]))},{default:i(()=>[r("div",Y7,[l(m,{label:p(c)("Title"),required:""},{default:i(()=>[l(f,{class:de(e.productEditModel.hasValidationError("post_title")?"is-error":""),id:"post_title",placeholder:p(c)("Title"),type:"text",modelValue:e.product.post_title,"onUpdate:modelValue":A[0]||(A[0]=v=>e.product.post_title=v),onInput:A[1]||(A[1]=v=>{e.productEditModel.onChangeInputField("post_title",v)}),onFocus:A[2]||(A[2]=v=>e.productEditModel.clearValidationError("post_title"))},null,8,["class","placeholder","modelValue"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),r("div",q7,[l(m,{label:p(c)("Short description")},{default:i(()=>[l(f,{class:"fct-short-desc-input",onInput:A[3]||(A[3]=v=>{e.productEditModel.onChangeInputField("post_excerpt",v)}),modelValue:e.product.post_excerpt,"onUpdate:modelValue":A[4]||(A[4]=v=>e.product.post_excerpt=v),rows:2,type:"textarea",onFocus:A[5]||(A[5]=v=>e.productEditModel.clearValidationError("post_excerpt"))},null,8,["modelValue"]),r("div",null,[r("div",W7,[r("p",X7,h(p(c)("%1$s Words of %2$s",p(c)(e.productEditModel.data.excerptWordCount),p(c)(e.productEditModel.maxExcerptWordCount))),1)]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Long Description")},{action:i(()=>[Dt((d(),_("div",J7,[l(Yd,null,{default:i(()=>[l(rr,{label:p(c)("Classic Editor"),class:de(n.value==="wp-editor"?"active":""),onClick:A[7]||(A[7]=v=>o("wp-editor"))},null,8,["label","class"]),l(rr,{label:p(c)("Builder"),class:de(n.value==="gutenberg"?"active":""),onClick:A[8]||(A[8]=v=>o("gutenberg"))},null,8,["label","class"])]),_:1})])),[[y,e.productEditModel.hasChangeLongDescEditor]])]),_:1},8,["title"]),l(me,null,{default:i(()=>[l(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:A[10]||(A[10]=Xe(()=>{},["prevent"]))},{default:i(()=>[r("div",Z7,[l(m,null,{default:i(()=>[r("div",eL,[r("div",tL,[Dt(r("div",aL,[l(ts,{ref_key:"wpEditor",ref:s,modelValue:e.product.post_content,onUpdate:A[9]||(A[9]=v=>{e.productEditModel.onChangeInputField("post_content",v)})},null,8,["modelValue"])],512),[[Rn,n.value==="wp-editor"]]),Dt(r("div",nL,[l(j7,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[Rn,n.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},lL=["aria-label"],oL=["src","alt"],rL={class:"fmp-featured__edit-icon"},iL={key:0,class:"fmp-stack"},dL=["src","alt","onError","onLoad"],uL={key:0,class:"fmp-count"},cL={key:0,class:"fmp-preview-grid"},AL=["src","alt"],pL={key:0,class:"fmp-preview-more"},fL={key:1,class:"fmp-add-full",type:"button"},mL={class:"fmp-modal-body"},hL=["src","alt"],_L=["onClick","title"],gL={key:1,class:"fmp-empty"},vL={class:"fmp-url-list"},yL=["src","alt"],bL={class:"fmp-url-info"},wL={class:"fmp-url-title"},CL={class:"fmp-url-text"},BL=["onClick","title"],kL={class:"fmp-url-add"},xL={class:"dialog-footer"},SL={class:"fct-btn-group sm"},Bs={__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}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=V(new Set),n=Q=>{a.value=new Set([...a.value,Q])},s=Q=>{if(a.value.has(Q)){const T=new Set(a.value);T.delete(Q),a.value=T}},o=e,u=t,A=V(!1),f=V([]),m=V("gallery"),g=V(""),y=j(()=>o.title||c("Manage Media")),v=j(()=>f.value.filter(Q=>Q.id>0)),B=j(()=>f.value.filter(Q=>!Q.id)),b=j(()=>o.showUrlTab),w=()=>{f.value=JSON.parse(JSON.stringify(o.modelValue||[])),m.value="gallery",g.value="",A.value=!0},k=()=>{u("update:modelValue",f.value),u("change",f.value),A.value=!1},S=()=>{A.value=!1},M=Q=>{f.value.splice(Q,1)},$=Q=>{const T=Q.filter(U=>U.url).map(U=>({id:U.id,title:U.title,url:U.url}));if(!o.multiple){f.value=T.slice(0,1);return}const D=new Set(f.value.map(U=>U.url));for(const U of T)D.has(U.url)||(f.value.push(U),D.add(U.url))},F=()=>{const Q=g.value.trim();if(!Q)return;if(f.value.some(D=>D.url===Q)){g.value="";return}const T=Q.split("/").pop().split("?")[0]||"image";f.value.push({id:0,url:Q,title:T}),g.value=""},L=Q=>{const T=f.value.findIndex(D=>D.url===Q);T!==-1&&f.value.splice(T,1)};return(Q,T)=>{const D=C("el-tag"),U=C("el-button"),I=C("el-tab-pane"),O=C("el-input"),P=C("el-tabs"),K=C("el-dialog");return d(),_(H,null,[r("div",{class:de(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured}]),onClick:w},[e.featured?(d(),_(H,{key:0},[e.modelValue&&e.modelValue.length?(d(),_("button",{key:0,type:"button",class:"fmp-featured","aria-label":p(c)("Edit media")},[r("img",{src:e.modelValue[0].url,alt:e.modelValue[0].title||"",class:de(["fmp-featured__image",{"is-hidden":a.value.has(e.modelValue[0].url)}]),onError:T[0]||(T[0]=G=>n(e.modelValue[0].url)),onLoad:T[1]||(T[1]=G=>s(e.modelValue[0].url))},null,42,oL),r("span",rL,[l(W,{name:"Edit"})]),e.modelValue.length>1?(d(),E(D,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:i(()=>[R(h(e.modelValue.length)+" "+h(Q.$t("images")),1)]),_:1})):x("",!0)],8,lL)):(d(),E(U,{key:1,class:"fct-mp-add-featured"},{default:i(()=>[l(W,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(d(),_(H,{key:1},[e.modelValue&&e.modelValue.length?(d(),_("div",iL,[(d(!0),_(H,null,ee(e.modelValue.slice(0,e.maxThumbs),(G,ne)=>(d(),_("span",{key:ne,class:"fmp-thumb-wrap",style:ia({zIndex:e.maxThumbs-ne})},[r("img",{src:G.url,alt:G.title||"",class:de(["fmp-thumb",{"is-hidden":a.value.has(G.url)}]),onError:Y=>n(G.url),onLoad:Y=>s(G.url)},null,42,dL)],4))),128)),e.modelValue.length>e.maxThumbs?(d(),_("span",uL,"+"+h(e.modelValue.length-e.maxThumbs),1)):x("",!0),T[5]||(T[5]=ao('<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))])):(d(),E(U,{key:1,class:"fct-mp-add-compact"},{default:i(()=>[l(W,{name:"GalleryAdd"})]),_:1}))],64)):(d(),_(H,{key:2},[e.modelValue&&e.modelValue.length?(d(),_("div",cL,[(d(!0),_(H,null,ee(e.modelValue.slice(0,4),(G,ne)=>(d(),_("div",{class:"fmp-preview-item",key:ne},[r("img",{src:G.url,alt:G.title||""},null,8,AL),ne===3&&e.modelValue.length>4?(d(),_("span",pL,"+"+h(e.modelValue.length-4),1)):x("",!0)]))),128))])):(d(),_("button",fL,[T[6]||(T[6]=ao('<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)),r("span",null,h(Q.$t("Add Media")),1)]))],64))],2),A.value?(d(),E(K,{key:0,modelValue:A.value,"onUpdate:modelValue":T[4]||(T[4]=G=>A.value=G),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,onClose:S,class:"fct-bulk-media-picker-modal"},{default:i(()=>[r("div",mL,[l(P,{modelValue:m.value,"onUpdate:modelValue":T[3]||(T[3]=G=>m.value=G)},{default:i(()=>[l(I,{label:Q.$t("Gallery"),name:"gallery"},{default:i(()=>[f.value.length?(d(),E(p(Fr),{key:0,list:f.value,class:"fmp-grid",tag:"div",animation:200},{default:i(()=>[(d(!0),_(H,null,ee(f.value,(G,ne)=>(d(),_("div",{class:"fmp-grid-item",key:G.url||ne},[r("img",{src:G.url,alt:G.title||""},null,8,hL),ne===0?(d(),E(D,{key:0,type:"primary",size:"small",class:"fmp-featured-tag"},{default:i(()=>[R(h(Q.$t("Featured")),1)]),_:1})):x("",!0),r("button",{type:"button",class:"fmp-remove-btn",onClick:Xe(Y=>M(ne),["stop"]),title:Q.$t("Remove")}," × ",8,_L)]))),128))]),_:1},8,["list"])):(d(),_("div",gL,[r("p",null,h(Q.$t("No media added yet.")),1)]))]),_:1},8,["label"]),b.value?(d(),E(I,{key:0,name:"imported-urls"},{label:i(()=>[R(h(Q.$t("Add by URL"))+" ",1),B.value.length?(d(),E(D,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:i(()=>[R(h(B.value.length),1)]),_:1})):x("",!0)]),default:i(()=>[r("div",vL,[(d(!0),_(H,null,ee(B.value,G=>(d(),_("div",{class:"fmp-url-item",key:G.url},[r("img",{src:G.url,alt:G.title||"",class:"fmp-url-thumb"},null,8,yL),r("div",bL,[r("span",wL,h(G.title),1),r("span",CL,h(G.url),1)]),r("button",{type:"button",class:"fmp-url-delete",onClick:Xe(ne=>L(G.url),["stop"]),title:Q.$t("Remove")}," × ",8,BL)]))),128)),r("div",kL,[l(O,{modelValue:g.value,"onUpdate:modelValue":T[2]||(T[2]=G=>g.value=G),placeholder:Q.$t("Paste image URL..."),size:"small",onKeyup:Pa(F,["enter"])},null,8,["modelValue","placeholder"]),l(U,{size:"small",onClick:F,disabled:!g.value.trim()},{default:i(()=>[R(h(Q.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):x("",!0)]),_:1},8,["modelValue"])]),r("div",xL,[l(ip,{attachments:v.value,multiple:e.multiple,onOnMediaSelected:$},null,8,["attachments","multiple"]),r("div",SL,[l(U,{onClick:S},{default:i(()=>[R(h(Q.$t("Cancel")),1)]),_:1}),l(U,{type:"primary",onClick:k},{default:i(()=>[R(h(Q.$t("Save")),1)]),_:1})])])]),_:1},8,["modelValue","title"])):x("",!0)],64)}}},FL={},EL={class:"fct-shared-variant-item-box"},UL={key:0,class:"fct-shared-variant-item-box__header"},$L={class:"fct-shared-variant-item-box__label"},DL={class:"fct-shared-variant-item-box__action"},QL={class:"fct-shared-variant-item-box__body"};function IL(e,t){return d(),_("div",EL,[e.$slots.label||e.$slots.action?(d(),_("div",UL,[r("div",$L,[oa(e.$slots,"label")]),r("div",DL,[oa(e.$slots,"action")])])):x("",!0),r("div",QL,[oa(e.$slots,"default")])])}const _o=He(FL,[["render",IL]]),TL={class:"fct-product-media-row"},VL={class:"fct-admin-input-wrapper"},ML={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object},setup(e){return(t,a)=>{var o;const n=C("el-input"),s=C("el-form-item");return((o=e.product.detail)==null?void 0:o.variation_type)==="simple_variations"?(d(),E(_o,{key:0,class:"fct-product-media-and-title"},{default:i(()=>[r("div",TL,[l(Bs,{modelValue:e.variant.media,"onUpdate:modelValue":a[0]||(a[0]=u=>e.variant.media=u),featured:!0,compact:!1,onChange:a[1]||(a[1]=u=>e.productEditModel.updatePricingOtherValue("media",u,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),l(s,{label:p(c)("Variation Title")},{default:i(()=>[r("div",VL,[l(n,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.variation_title`)?"is-error":""),id:`${e.fieldKey}.variation_title`,placeholder:p(c)("e.g. Small, Medium, Large"),type:"text",modelValue:e.variant.variation_title,"onUpdate:modelValue":a[2]||(a[2]=u=>e.variant.variation_title=u),onInput:a[3]||(a[3]=u=>{e.productEditModel.updatePricingValue("variation_title",u,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"])])]),_:1})):x("",!0)}}},LL={class:"fct-variant-item-collapse"},RL={class:"fct-variant-item-collapse-header"},OL={class:"fct-variant-item-collapse-body"},cm={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,n=t,s=j({get:()=>a.modelValue,set:u=>n("update:modelValue",u)}),o=j(()=>s.value.includes("1"));return(u,A)=>{const f=C("el-collapse-item"),m=C("el-collapse");return d(),_("div",LL,[l(m,{modelValue:s.value,"onUpdate:modelValue":A[0]||(A[0]=g=>s.value=g),accordion:""},{default:i(()=>[l(f,{name:"1",icon:p(gh)},{title:i(()=>[r("div",RL,[oa(u.$slots,"header",{isOpen:o.value})])]),default:i(()=>[r("div",OL,[oa(u.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},HL=["innerHTML"],hl={__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,n=t,s=j(()=>Ie.get("shop.currency_sign","$")),o=j(()=>a.numberFormat==="dot_comma"),u=j(()=>{const U=Ie.get("shop.decimal_separator","");return U==="comma"?",":U==="dot"?".":o.value?",":"."}),A=j(()=>u.value===","?".":","),f=j(()=>u.value===","?"de-DE":"en-US"),m=/[\d.,]/,g=U=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(U.key)||U.ctrlKey||U.metaKey||m.test(U.key)||U.preventDefault()},y=U=>String(U||"").replace(/^0+(?=\d)/,""),v=U=>String(U??"").replace(/[^\d.,]/g,""),B=U=>{const I=v(U);if(!I)return"";const O=I.lastIndexOf("."),P=I.lastIndexOf(","),K=Math.max(O,P);if(K===-1)return y(I.replace(/[.,]/g,""));const G=y(I.slice(0,K).replace(/[^\d]/g,"")),ne=I.slice(K+1).replace(/[^\d]/g,""),Y=I.charAt(K),N=(I.match(new RegExp(`\\${Y}`,"g"))||[]).length,oe=K===I.length-1,Z=I.includes(".")&&I.includes(",");if(!oe&&!Z&&Y===A.value&&(N>1||ne.length>2))return y(I.replace(/[^\d]/g,""));const te=G||"0";return oe?`${te}.`:`${te}.${ne.slice(0,2)}`},b=U=>{if(U==null||U==="")return NaN;const I=typeof U=="number"?String(U):B(U);return I?parseFloat(I.replace(/\.$/,"")):NaN},w=U=>{const I=b(U);return isNaN(I)?"":I.toLocaleString(f.value,{minimumFractionDigits:0,maximumFractionDigits:2})},k=U=>{if(!U)return"";const I=U.endsWith("."),[O="",P=""]=U.split("."),K=(O||"0").replace(/\B(?=(\d{3})+(?!\d))/g,A.value);return I?`${K}${u.value}`:P?`${K}${u.value}${P}`:K},S=(U,I=!1)=>{const O=b(U);return isNaN(O)?"":(I?M(O):O).toFixed(2)},M=U=>a.min===null||a.min===void 0||isNaN(U)?U:U<a.min?a.min:U,$=V(""),F=V(""),L=V(!1),Q=U=>{const I=S(U);if(!I){$.value="",F.value="";return}$.value=w(I),F.value=I},T=U=>{const I=B(U);if(F.value=I,$.value=k(I),L.value=!0,I===""){n("update:modelValue","");return}const O=S(I);O!==""&&O!==S(a.modelValue)&&n("update:modelValue",O)},D=()=>{const U=L.value?F.value:a.modelValue;if(U==="")n("update:modelValue",""),n("change",""),$.value="",F.value="";else{const I=S(U,!0);I===""?Q(a.modelValue):(n("update:modelValue",I),I!==S(a.modelValue)&&n("change",I),$.value=w(I),F.value=I)}L.value=!1};return ge([()=>a.modelValue,()=>a.numberFormat],([U])=>{L.value||Q(U)}),Q(a.modelValue),(U,I)=>{const O=C("el-input");return d(),E(O,{class:de(e.errorClass),id:e.id,placeholder:e.placeholder,"model-value":$.value,disabled:e.disabled,onBlur:D,onInput:T,onKeydown:g},Rt({prefix:i(()=>[r("span",{innerHTML:s.value},null,8,HL)]),_:2},[U.$slots.suffix?{name:"suffix",fn:i(()=>[oa(U.$slots,"suffix")]),key:"0"}:void 0]),1032,["class","id","placeholder","model-value","disabled"])}}},PL={key:0,class:"fct-shared-variant-item-box__switch"},NL={class:"fct-shared-variant-item-box__hint"},KL={class:"fct-price-with-inclusion"},GL={class:"fct-admin-input-wrapper"},jL={key:0},zL={key:0,class:"fct-collapse-heading"},YL={key:1,class:"fct-tag-group"},qL={class:"fct-tag-item"},WL={class:"fct-tags-internal"},XL={key:0,class:"fct-tag-item"},JL={class:"fct-tags-internal"},ZL={key:1,class:"fct-tag-item"},eR={class:"fct-tags-internal"},tR={key:2,class:"fct-tag-item"},aR={class:"fct-tags-internal"},nR={class:"fct-tag-item"},sR={class:"fct-tags-internal"},lR={class:"fct-shared-variant-pricing-additional"},oR={class:"fct-admin-input-wrapper"},rR={class:"fct-admin-input-wrapper"},iR={class:"fct-admin-input-wrapper"},dR={key:0},uR={class:"fct-admin-input-wrapper"},cR={class:"fct-admin-input-wrapper"},AR={class:"fct-admin-input-wrapper"},pR={class:"fct-admin-input-wrapper"},fR={class:"fct-admin-input-wrapper"},mR={class:"fct-admin-input-wrapper"},hR={class:"fct-admin-input-wrapper"},_R={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object},setup(e){const t=e,a=Ie.get("app_config.isProActive"),n=V(),s=V([""]),o=V(0),u=new Set(["compare_price","repeat_interval","trial_days","times","signup_fee_name","signup_fee","setup_fee_per_item","item_cost","manage_cost"]);ge(()=>{var b;return(b=t.variant)==null?void 0:b.id},()=>{var b,w;o.value=Number((w=(b=t.variant)==null?void 0:b.other_info)==null?void 0:w.signup_fee)||0}),ge(()=>{var b,w;return(w=(b=t.variant)==null?void 0:b.other_info)==null?void 0:w.payment_type},b=>{b==="subscription"&&(s.value="1")}),ge(()=>{var b;return(b=t.productEditModel)==null?void 0:b.validationErrors},b=>{if(!b||Object.keys(b).length===0)return;Object.keys(b).some(k=>{for(const S of u)if(k.includes(S))return!0;return!1})&&(s.value="1")},{deep:!0});let A=t.product.variants.length>0;const f=j(()=>{var b;return((b=window.fluentCartAdminApp)==null?void 0:b.subscription_intervals)??[]}),m=()=>{var b,w,k;return((b=t.variant)==null?void 0:b.other_info)&&["subscription"].includes((k=(w=t.variant)==null?void 0:w.other_info)==null?void 0:k.payment_type)},g=(b,w,k,S)=>{t.productEditModel.updatePricingOtherValue(b,w,k,S,t.modeType)},y=b=>{t.productEditModel.updatePricingOtherValue("manage_setup_fee",b,t.fieldKey,t.variant,t.modeType),b==="no"?(o.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",o.value,t.fieldKey,t.variant,t.modeType)},v=j(()=>{var k,S;const b=Number(t.variant.item_price)||0,w=Number((S=(k=t.variant)==null?void 0:k.other_info)==null?void 0:S.times)||1;return b*w}),B=b=>{const w=f.value.find(S=>S.value===b);return!(w!=null&&w.label)&&!b?"":((w==null?void 0:w.label)||b).split(" ").map(S=>S.charAt(0).toUpperCase()).join("")};return(b,w)=>{const k=C("el-switch"),S=C("el-form-item"),M=C("el-option"),$=C("el-select"),F=C("el-col"),L=C("el-input"),Q=C("el-row"),T=C("el-checkbox"),D=C("el-tooltip");return d(),E(_o,null,{label:i(()=>[R(h(p(c)("Pricing")),1)]),action:i(()=>{var U;return[(U=e.variant)!=null&&U.other_info?(d(),_("div",PL,[r("span",NL,h(p(c)("Subscription")),1),l(k,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:w[0]||(w[0]=I=>{const O=I?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",O,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",I&&ye(()=>{var P;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((P=n.value.value)==null||P.focus())})})},null,8,["model-value"])])):x("",!0)]}),default:i(()=>[r("div",KL,[l(S,{class:"fct-price-with-inclusion__price"},{label:i(()=>{var U,I;return[R(h(((I=(U=e.variant)==null?void 0:U.other_info)==null?void 0:I.installment)==="yes"?p(c)("Installment Price"):p(c)("Price"))+" ",1),w[22]||(w[22]=r("span",{class:"fct-required"},"*",-1))]}),default:i(()=>{var U,I;return[r("div",GL,[l(hl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:((I=(U=e.variant)==null?void 0:U.other_info)==null?void 0:I.installment)==="yes"?p(c)("Installment Price"):p(c)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":w[1]||(w[1]=O=>{e.variant.item_price=O,e.productEditModel.updatePricingValue("item_price",O,e.fieldKey,e.variant,e.modeType)})},{suffix:i(()=>{var O,P,K,G;return[((P=(O=e.variant)==null?void 0:O.other_info)==null?void 0:P.installment)==="yes"?(d(),_("span",jL," x "+h((G=(K=e.variant)==null?void 0:K.other_info)==null?void 0:G.times),1)):x("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(d(),E(S,{key:0,class:"fct-price-with-inclusion__tax"},{label:i(()=>[R(h(p(c)("Tax")),1)]),default:i(()=>{var U,I;return[l($,{"model-value":((I=(U=e.variant)==null?void 0:U.other_info)==null?void 0:I.tax_inclusion)||"_default_",onChange:w[2]||(w[2]=O=>{const P=O==="_default_"?"":O;e.variant.other_info&&(e.variant.other_info.tax_inclusion=P),e.productEditModel.updatePricingOtherValue("tax_inclusion",P,e.fieldKey,e.variant,e.modeType)})},{default:i(()=>[l(M,{value:"_default_",label:p(c)("Store default")},null,8,["label"]),l(M,{value:"included",label:p(c)("Tax included")},null,8,["label"]),l(M,{value:"excluded",label:p(c)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"])]}),_:1})):x("",!0)]),l(cm,{modelValue:s.value,"onUpdate:modelValue":w[21]||(w[21]=U=>s.value=U)},{header:i(({isOpen:U})=>{var I,O,P,K,G,ne;return[U?(d(),_("div",zL,h(p(c)("Additional display prices")),1)):(d(),_("div",YL,[r("div",qL,[R(h(p(c)("Compare-at"))+" ",1),r("span",WL,h((I=e.variant)!=null&&I.compare_price?b.appVars.shop.currency_sign+e.variant.compare_price:0),1)]),e.variant.other_info.payment_type==="subscription"?(d(),_("div",XL,[R(h(p(c)("Installment"))+" ",1),r("span",JL,h(((P=(O=e.variant)==null?void 0:O.other_info)==null?void 0:P.installment)==="yes"?p(c)("Yes"):p(c)("No")),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(d(),_("div",ZL,[R(h(p(c)("Interval"))+" ",1),r("span",eR,h(B(e.variant.other_info.repeat_interval)),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(d(),_("div",tR,[R(h(p(c)("Trial Days"))+" ",1),r("span",aR,h(((G=(K=e.variant)==null?void 0:K.other_info)==null?void 0:G.trial_days)??0),1)])):x("",!0),r("div",nR,[R(h(p(c)("Cost Per Item"))+" ",1),r("span",sR,h((ne=e.variant)!=null&&ne.item_cost?b.appVars.shop.currency_sign+e.variant.item_cost:p(c)("N/A")),1)])]))]}),default:i(()=>[r("div",lR,[l(Q,{gutter:15},{default:i(()=>[l(F,{lg:12},{default:i(()=>[r("div",oR,[l(S,null,{label:i(()=>[l(sa,{title:p(c)("Compare at price"),content:p(c)("Set a higher price to show with a strike-through, highlighting a discount for sales")},null,8,["title","content"])]),default:i(()=>[l(hl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.compare_price`)?"is-error":"",id:`${e.fieldKey}.compare_price`,placeholder:p(c)("Compare at price"),"model-value":e.variant.compare_price,"onUpdate:modelValue":w[3]||(w[3]=U=>{e.variant.compare_price=U,e.productEditModel.updatePricingValue("compare_price",U,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),m()?(d(),_(H,{key:0},[l(F,{lg:12},{default:i(()=>[r("div",rR,[l(S,{label:p(c)("Interval"),required:""},{default:i(()=>[l($,{class:de(["fct-repeat-payment-every-select",e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.repeat_interval`)?"is-error":""]),id:`${e.fieldKey}.other_info.repeat_interval`,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":w[4]||(w[4]=U=>e.variant.other_info.repeat_interval=U),placeholder:p(c)("Interval"),onChange:w[5]||(w[5]=U=>{e.productEditModel.updatePricingOtherValue("repeat_interval",U,e.fieldKey,e.variant,e.modeType)})},{default:i(()=>[(d(!0),_(H,null,ee(f.value,U=>(d(),E(M,{key:U.value,label:U.label,value:U.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),l(F,{lg:12},{default:i(()=>[l(S,{class:"has-tooltip"},{label:i(()=>[l(sa,{title:p(c)("Trial Days"),content:p(c)("Enter the number of days the free trial will last. The trial period cannot exceed 365 days.")},null,8,["title","content"])]),default:i(()=>[l(L,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.trial_days`)?"is-error":""),id:`${e.fieldKey}.other_info.trial_days`,placeholder:p(c)("Trial Days"),type:"number",min:1,max:365,modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":w[6]||(w[6]=U=>e.variant.other_info.trial_days=U),modelModifiers:{number:!0},autofocus:"",onInput:w[7]||(w[7]=U=>{e.productEditModel.updatePricingOtherValue("trial_days",U,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.trial_days`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})],64)):x("",!0)]),_:1}),m()?(d(),E(Q,{key:0},{default:i(()=>{var U;return[l(F,{lg:24},{default:i(()=>[l(S,null,{default:i(()=>[l(T,{"true-value":"yes","false-value":"no",label:p(c)("Enable installment payment"),class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.installment`)?"is-error":""),id:`${e.fieldKey}.other_info.installment`,placeholder:p(c)("Occurrence"),type:"number",modelValue:e.variant.other_info.installment,"onUpdate:modelValue":w[8]||(w[8]=I=>e.variant.other_info.installment=I),modelModifiers:{number:!0},disabled:!p(a),onChange:w[9]||(w[9]=I=>{if(g("installment",I,e.fieldKey,e.variant),I==="no"){g("times",0,e.fieldKey,e.variant);return}e.variant.other_info.times||g("times",1,e.fieldKey,e.variant)}),autofocus:""},null,8,["label","class","id","placeholder","modelValue","disabled"]),p(a)?x("",!0):(d(),E(D,{key:0,"popper-class":"fct-tooltip"},{content:i(()=>[R(h(p(c)("This feature is available in pro version only.")),1)]),default:i(()=>[l(W,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),l(ra,{visible:((U=e.variant.other_info)==null?void 0:U.installment)==="yes",accordion:""},{default:i(()=>[l(Q,{gutter:15},{default:i(()=>{var I;return[l(F,{lg:12},{default:i(()=>[l(S,{required:"",class:"has-tooltip-and-required"},{label:i(()=>[l(sa,{title:p(c)("Installment Count"),content:p(c)("Number of payments to split the price over the installment period.")},null,8,["title","content"])]),default:i(()=>[l(L,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:p(c)("Installment Count"),type:"number",min:1,modelValue:e.variant.other_info.times,"onUpdate:modelValue":w[10]||(w[10]=O=>e.variant.other_info.times=O),modelModifiers:{number:!0},onInput:w[11]||(w[11]=O=>{g("times",O,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:n},null,8,["class","id","placeholder","modelValue"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((I=e.variant.other_info)==null?void 0:I.installment)==="yes"?(d(),E(F,{key:0,lg:12},{default:i(()=>[l(S,null,{label:i(()=>[l(sa,{title:p(c)("Total Price"),content:p(c)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:i(()=>[l(L,{id:`${e.fieldKey}.total_price`,type:"number",min:1,disabled:"","model-value":v.value,autofocus:""},{prefix:i(()=>[r("span",null,h(b.appVars.shop.currency_sign),1)]),_:1},8,["id","model-value"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})):x("",!0)]}),_:1})]),_:1},8,["visible"])]}),_:1})):x("",!0),m()?(d(),E(Q,{key:1,gutter:15},{default:i(()=>{var U,I;return[l(F,{lg:24},{default:i(()=>[r("div",iR,[l(S,null,{default:i(()=>[l(k,{size:"small",disabled:!p(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":w[12]||(w[12]=O=>e.variant.other_info.manage_setup_fee=O),"active-value":"yes","inactive-value":"no",onChange:y,"active-text":p(c)("Setup fee")},null,8,["disabled","modelValue","active-text"]),p(a)?x("",!0):(d(),_("span",dR,[l(D,{"popper-class":"fct-tooltip"},{content:i(()=>[R(h(p(c)("This feature is available in pro version only.")),1)]),default:i(()=>[l(W,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))]),_:1})])]),_:1}),l(ra,{visible:((I=(U=e.variant)==null?void 0:U.other_info)==null?void 0:I.manage_setup_fee)=="yes",accordion:""},{default:i(()=>[l(Q,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:i(()=>[l(F,{lg:12},{default:i(()=>[r("div",uR,[l(S,{required:"",class:"has-tooltip-and-required"},{label:i(()=>[l(sa,{title:p(c)("Setup fee label"),content:p(c)("Name the one-time setup fee (e.g., Initial Setup)")},null,8,["title","content"])]),default:i(()=>[l(L,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee_name`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee_name`,placeholder:p(c)("Setup fee name"),type:"text",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":w[13]||(w[13]=O=>e.variant.other_info.signup_fee_name=O),onInput:w[14]||(w[14]=O=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",O,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),l(F,{lg:12},{default:i(()=>[r("div",cR,[l(S,{required:"",class:"has-tooltip-and-required"},{label:i(()=>[l(sa,{title:p(c)("Setup fee amount"),content:p(c)("Set the one-time setup fee amount (e.g., $50) per order. This fee does not apply to quantity.")},null,8,["title","content"])]),default:i(()=>[l(hl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee`)?"is-error":"",id:`${e.fieldKey}.other_info.signup_fee`,placeholder:p(c)("Setup fee amount"),"model-value":e.variant.other_info.signup_fee,"onUpdate:modelValue":w[15]||(w[15]=O=>{e.variant.other_info.signup_fee=O,e.productEditModel.updatePricingOtherValue("signup_fee",O,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"]),l(Pt,{"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})):x("",!0),l(Q,{gutter:15},{default:i(()=>[e.variant.manage_cost?(d(),E(F,{key:0,lg:24,class:"fct-manage-cost-col"},{default:i(()=>[r("div",AR,[l(S,null,{default:i(()=>[l(k,{size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":w[16]||(w[16]=U=>e.variant.manage_cost=U),"active-value":"true","inactive-value":"false",onChange:w[17]||(w[17]=U=>{p(A)&&e.productEditModel.updatePricingOtherValue("manage_cost",U,e.fieldKey,e.variant,e.modeType),qm(A)?A.value=!0:A=!0}),"active-text":p(c)("Calculate profit/cost")},null,8,["modelValue","active-text"])]),_:1})])]),_:1})):x("",!0),l(ra,{visible:e.variant.manage_cost==="true",accordion:""},{default:i(()=>[l(Q,{gutter:15,class:"fct-cost-profit-wrap"},{default:i(()=>{var U,I,O;return[l(F,{lg:((U=e.product.detail)==null?void 0:U.variation_type)==="simple_variations"?12:8},{default:i(()=>[r("div",pR,[l(S,null,{label:i(()=>[l(sa,{title:p(c)("Cost per item"),content:p(c)("Customers won't see this")},null,8,["title","content"])]),default:i(()=>[l(hl,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_cost`)?"is-error":"",id:`${e.fieldKey}.item_cost`,placeholder:p(c)("Cost per item"),"model-value":e.variant.item_cost,"onUpdate:modelValue":w[18]||(w[18]=P=>{e.variant.item_cost=P,e.productEditModel.updatePricingValue("item_cost",P,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_cost`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1},8,["lg"]),l(F,{lg:((I=e.product.detail)==null?void 0:I.variation_type)==="simple_variations"?6:8},{default:i(()=>[r("div",fR,[l(S,{label:p(c)("Profit")},{default:i(()=>[l(L,{disabled:"",class:"fct-profit-display",value:p(ih)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]),l(F,{lg:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?6:8},{default:i(()=>[r("div",mR,[l(S,{label:p(c)("Margin")},{default:i(()=>[l(L,{disabled:"",class:"fct-margin-display",value:p(dh)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])]}),_:1})]),_:1},8,["visible"]),l(F,{lg:24},{default:i(()=>[r("div",hR,[(e.variant.other_info,x("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},gR={class:"fct-adjust-by-wrap"},vR={class:"fct-adjust-by-row"},yR={class:"fct-adjust-by-col"},bR={class:"title"},wR={class:"fct-adjust-by-col"},CR={class:"title"},BR={class:"fct-adjust-by-action"},Vd={__name:"StockAdjuster",props:{variant:Object,fieldKey:String,productEditModel:Object},emits:["save"],setup(e,{emit:t}){const a=t,n=V(!1);return(s,o)=>{const u=C("el-input"),A=C("el-button"),f=C("el-popover");return d(),E(f,{visible:n.value,"popper-class":"fct-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:i(()=>[r("div",{onClick:o[7]||(o[7]=m=>n.value=!n.value),class:"fct-stock-adjuster-trigger"},[l(W,{name:"Configuration"})])]),default:i(()=>[r("div",gR,[r("div",vR,[r("div",yR,[r("span",bR,h(p(c)("Adjust by")),1),l(u,{size:"small",placeholder:p(c)("Quantity"),type:"number",modelValue:e.variant.adjusted_quantity,"onUpdate:modelValue":o[0]||(o[0]=m=>e.variant.adjusted_quantity=m),modelModifiers:{number:!0},onKeyup:o[1]||(o[1]=m=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",m.target.value,e.fieldKey)}),onChange:o[2]||(o[2]=m=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",m,e.fieldKey)})},null,8,["placeholder","modelValue"])]),r("div",wR,[r("span",CR,h(p(c)("New Stock")),1),l(u,{size:"small",placeholder:p(c)("New Stock"),type:"number",min:1,modelValue:e.variant.new_stock,"onUpdate:modelValue":o[3]||(o[3]=m=>e.variant.new_stock=m),modelModifiers:{number:!0},onKeyup:o[4]||(o[4]=m=>{e.productEditModel.onChangeNewStock("new_stock",m.target.value,e.fieldKey)})},null,8,["placeholder","modelValue"])])]),r("div",BR,[l(A,{size:"small",type:"info",soft:"",onClick:o[5]||(o[5]=m=>n.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(A,{size:"small",type:"primary",onClick:o[6]||(o[6]=m=>{n.value=!1,a("save")}),disabled:e.variant.new_stock===""},{default:i(()=>[R(h(p(c)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},kR={class:"fct-shared-variant-item-box__switch"},xR={key:0,class:"fct-variant-stock-grid"},SR={class:"fct-variant-stock-box"},FR={class:"fct-stock-box-label"},ER={class:"fct-stock-box-content fct-stock-box-total-content"},UR={class:"fct-stock-number"},$R={class:"fct-variant-stock-box"},DR={class:"fct-stock-box-label"},QR={class:"fct-stock-box-content"},IR={class:"fct-stock-number"},TR={class:"fct-variant-stock-box"},VR={class:"fct-stock-box-label"},MR={class:"fct-stock-box-content"},LR={class:"fct-stock-number"},RR={class:"fct-variant-stock-box"},OR={class:"fct-stock-box-label"},HR={class:"fct-stock-box-content"},PR={class:"fct-stock-number"},NR={key:0,class:"fct-collapse-heading"},KR={key:1,class:"fct-tag-group"},GR={class:"fct-tag-item"},jR={class:"fct-admin-input-wrapper"},zR={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},YR=["disabled"],qR={__name:"VariantInventory",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object},setup(e){const t=e,a=V(!1),n=j(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),s=A=>{t.productEditModel.updatePricingValue("manage_stock",A,t.fieldKey,t.variant,t.modeType)};Be(()=>{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 o=()=>{let A=parseInt(t.variant.new_stock)||0;const f=t.variant.total_stock,m=t.variant.available;t.variant.total_stock=A<0?0:A;let g=(parseInt(t.variant.total_stock)||0)-(parseInt(t.variant.committed)||0)-(parseInt(t.variant.on_hold)||0);t.variant.available=g<0?0:g,t.variant.adjusted_quantity=0,t.variant.new_stock=t.variant.total_stock,re.put(`products/${t.product.ID}/update-inventory/${t.variant.id}`,{total_stock:t.variant.total_stock,available:t.variant.available}).then(y=>{q.success(y.message)}).catch(y=>{var v;t.variant.total_stock=f,t.variant.available=m,t.variant.new_stock=f,q.error(((v=y==null?void 0:y.data)==null?void 0:v.message)||c("Failed to update inventory"))})},u=()=>{var y;if(a.value)return;const A=t.product.post_title||"";if(!A)return;const m=((y=t.product.detail)==null?void 0:y.variation_type)==="simple_variations"&&t.variant.variation_title||"",g=t.variant.id||0;a.value=!0,re.get("products/suggest-sku",{title:A,variant_title:m,exclude_id:g}).then(v=>{v!=null&&v.sku&&(t.variant.sku=v.sku,t.productEditModel.updatePricingValue("sku",v.sku,t.fieldKey,t.variant,t.modeType))}).catch(v=>{var b;const B=((b=v==null?void 0:v.data)==null?void 0:b.message)||c("Failed to generate SKU.");q.error(B)}).finally(()=>{a.value=!1})};return(A,f)=>{var v,B,b;const m=C("el-switch"),g=C("el-input"),y=C("el-form-item");return d(),E(_o,{class:de(["fct-variant-inventory",((v=e.product.detail)==null?void 0:v.variation_type)==="simple"?"fct-variant-inventory--simple":""])},Rt({default:i(()=>{var w;return[n.value&&((w=e.product.detail)==null?void 0:w.variation_type)==="simple_variations"?(d(),_("div",xR,[r("div",SR,[r("div",FR,h(p(c)("Total Stock")),1),r("div",ER,[r("div",UR,h(e.variant.total_stock),1),l(Vd,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:o},null,8,["variant","field-key","product-edit-model"])])]),r("div",$R,[r("div",DR,h(p(c)("Available")),1),r("div",QR,[r("div",IR,h(e.variant.available),1)])]),r("div",TR,[r("div",VR,h(p(c)("On Hold")),1),r("div",MR,[r("div",LR,h(e.variant.on_hold),1)])]),r("div",RR,[r("div",OR,h(p(c)("Delivered")),1),r("div",HR,[r("div",PR,h(e.variant.committed),1)])])])):x("",!0),l(cm,null,{header:i(({isOpen:k})=>[k?(d(),_("div",NR,h(p(c)("More details")),1)):x("",!0),k?x("",!0):(d(),_("div",KR,[r("div",GR,h(p(c)("SKU")),1)]))]),default:i(()=>[r("div",jR,[l(y,null,{label:i(()=>[r("div",zR,[l(sa,{title:p(c)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),r("button",{type:"button",onClick:u,disabled:!e.product.post_title||a.value,class:"underline-link-button fct-generate-sku-btn"},h(a.value?p(c)("Generating..."):p(c)("Generate SKU")),9,YR)])]),default:i(()=>[l(g,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:p(c)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":f[1]||(f[1]=k=>e.variant.sku=k),maxlength:"30","show-word-limit":"",onInput:f[2]||(f[2]=k=>{e.productEditModel.updatePricingValue("sku",k,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),l(Pt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1})]}),_:2},[((B=e.product.detail)==null?void 0:B.variation_type)==="simple_variations"?{name:"label",fn:i(()=>[R(h(p(c)("Inventory")),1)]),key:"0"}:void 0,((b=e.product.detail)==null?void 0:b.variation_type)==="simple_variations"?{name:"action",fn:i(()=>[r("div",kR,[l(m,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":f[0]||(f[0]=w=>e.variant.manage_stock=w),onChange:s,"active-value":"1","inactive-value":"0"},null,8,["modelValue"])])]),key:"1"}:void 0]),1032,["class"])}}},WR={class:"fct-shared-variant-item-box__switch"},XR={class:"fct-shared-variant-item-box__hint"},JR={key:0,class:"fct-package-select-icon"},ZR={class:"fct-add-new-package-option"},eO={class:"fct-package-options"},tO={class:"fct-package-options-info"},aO={class:"fct-package-options-name"},nO={class:"fct-package-options-dimensions"},sO={class:"fct-product-weight-input"},lO={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object},setup(e){var b,w;const t=e,a=V(!1),n=V(!1),s=V(Ie.get("shop.shipping_packages")||[]),o=[{label:"kg",value:"kg"},{label:"g",value:"g"},{label:"lbs",value:"lbs"},{label:"oz",value:"oz"}],u={box:"Box",envelope:"Envelope",soft_package:"SoftPackage"},A=j(()=>{var S,M;const k=(M=(S=t.variant)==null?void 0:S.other_info)==null?void 0:M.package_slug;return k?s.value.find($=>$.slug===k)||null:s.value.find($=>$.is_default)||null}),f=k=>{if(!k)return c("Select a package");const S=k.type==="envelope"?k.length+" × "+k.width+" "+k.dimension_unit:k.length+" × "+k.width+" × "+k.height+" "+k.dimension_unit;return(k.is_default?c("Store default")+" · ":"")+k.name+" - "+S+", "+k.weight+" "+k.weight_unit},m=()=>re.get("shipping/packages").then(k=>{s.value=k.packages||s.value}).catch(()=>{qu({message:c("Failed to load packages."),type:"error"})}),g=V(((w=(b=t.variant)==null?void 0:b.other_info)==null?void 0:w.package_slug)||""),y=async k=>{if(k==="__add_new__"){t.variant.other_info.package_slug=g.value,await m(),a.value=!0;return}g.value=k||"",t.productEditModel.updatePricingOtherValue("package_slug",k,t.fieldKey,t.variant,t.modeType)},v=k=>{t.productEditModel.updatePricingOtherValue("weight_unit",k,t.fieldKey,t.variant,t.modeType)},B=k=>{const S=JSON.parse(JSON.stringify(s.value));k.is_default&&s.value.forEach(F=>{F.is_default=!1});let M=k.slug,$=1;for(;s.value.some(F=>F.slug===M);)M=k.slug+"-"+$,$++;k.slug=M,s.value.push(k),n.value=!0,re.post("shipping/packages",{packages:s.value}).then(F=>{s.value=F.packages||s.value,a.value=!1,y(k.slug)}).catch(()=>{s.value=S,qu({message:c("Failed to save package."),type:"error"})}).finally(()=>{n.value=!1})};return(k,S)=>{const M=C("el-switch"),$=C("el-option"),F=C("el-select"),L=C("el-form-item"),Q=C("el-col"),T=C("el-input"),D=C("el-row");return d(),_(H,null,[e.variant.other_info?(d(),E(_o,{key:0},{label:i(()=>[R(h(p(c)("Shipping")),1)]),action:i(()=>[r("div",WR,[r("span",XR,h(p(c)("Physical Product")),1),l(M,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":S[0]||(S[0]=U=>e.variant.fulfillment_type=U),"active-value":"physical","inactive-value":"digital",onChange:S[1]||(S[1]=U=>{e.productEditModel.updatePricingValue("fulfillment_type",U,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])])]),default:i(()=>[l(ra,{visible:e.variant.fulfillment_type==="physical",accordion:""},{default:i(()=>[l(D,{gutter:10,class:"fct-physical-product-meta-row"},{default:i(()=>[l(Q,{xs:24,sm:14,lg:14},{default:i(()=>[l(L,null,{label:i(()=>[R(h(p(c)("Package")),1)]),default:i(()=>[l(F,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":S[2]||(S[2]=U=>e.variant.other_info.package_slug=U),placeholder:p(c)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:i(()=>[A.value?(d(),_("span",JR,[l(W,{name:u[A.value.type]||"Box"},null,8,["name"])])):x("",!0)]),default:i(()=>[l($,{value:"__add_new__",label:p(c)("Add new package")},{default:i(()=>[r("div",ZR," + "+h(p(c)("Add new package")),1)]),_:1},8,["label"]),(d(!0),_(H,null,ee(s.value,U=>(d(),E($,{key:U.slug,label:f(U),value:U.slug},{default:i(()=>[r("div",eO,[l(W,{name:u[U.type]||"Box"},null,8,["name"]),r("div",tO,[r("span",aO,h(U.is_default?p(c)("Store default")+" · ":"")+h(U.name),1),r("span",nO,h(U.type==="envelope"?U.length+" × "+U.width:U.length+" × "+U.width+" × "+U.height)+" "+h(U.dimension_unit)+", "+h(U.weight)+" "+h(U.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),l(Q,{xs:24,sm:10,lg:10},{default:i(()=>[l(L,null,{label:i(()=>[R(h(p(c)("Product weight")),1)]),default:i(()=>[r("div",sO,[l(T,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":S[4]||(S[4]=U=>e.variant.other_info.weight=U),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:S[5]||(S[5]=U=>{e.productEditModel.updatePricingOtherValue("weight",U,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:i(()=>[l(F,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":S[3]||(S[3]=U=>e.variant.other_info.weight_unit=U),onChange:v,class:"fct-product-weight-unit"},{default:i(()=>[(d(),_(H,null,ee(o,U=>l($,{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})):x("",!0),l($h,{modelValue:a.value,"onUpdate:modelValue":S[6]||(S[6]=U=>a.value=U),saving:n.value,onSave:B},null,8,["modelValue","saving"])],64)}}},oO={class:"fct-tax-class-control"},rO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},iO=["title"],dO={__name:"VariationTaxClass",props:{variant:Object,productEditModel:Object,fieldKey:String,modeType:String},setup(e){const t=e,a=V([]),n=b=>{if(!b)return"standard";const w=a.value.find(S=>String(S.slug)===String(b));if(w)return w.slug;const k=a.value.find(S=>String(S.id)===String(b));return k?k.slug:b},s=j(()=>Ke.get(t.variant,"other_info.tax_exempt","no")),o=j(()=>{const b=Ke.get(t.variant,"other_info.tax_class","standard");return n(b)||"standard"}),u=V(s.value!=="yes"),A=V(o.value||"standard");ge([s,o,a],([b,w])=>{u.value=b!=="yes",A.value=w||"standard"});const f=()=>{t.variant.other_info||(t.variant.other_info={})},m=(b,w)=>{f(),t.variant.other_info.tax_exempt=b,t.variant.other_info.tax_class=w||"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=()=>{re.get("tax/classes").then(b=>{a.value=b.classes||[]}).catch(()=>{q.error(c("Failed to load tax classes"))})},y=b=>{const w=A.value||o.value||"standard";u.value=b,A.value=w,m(b?"no":"yes",w)},v=b=>{A.value=b,u.value=!0,m("no",b)},B=()=>{const b=a.value.find(w=>w.slug===A.value);return b?b.title:"Standard"};return Be(()=>{g()}),(b,w)=>{const k=C("el-checkbox"),S=C("el-dropdown-item"),M=C("el-dropdown-menu"),$=C("el-dropdown");return d(),E(_o,null,{label:i(()=>[R(h(p(c)("Tax")),1)]),default:i(()=>[r("div",oO,[l(k,{class:"fct-tax-class-control__checkbox",modelValue:u.value,"onUpdate:modelValue":w[0]||(w[0]=F=>u.value=F),onChange:y},{default:i(()=>[R(h(p(c)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),u.value&&a.value.length>=1?(d(),_("div",rO,[r("span",null,[R(h(p(c)("Class:"))+" ",1),r("strong",{class:de(A.value!=="standard"?"text-red-500 dark:text-red-400":"")},h(B()),3)]),a.value.length>1?(d(),E($,{key:0,trigger:"click",onCommand:v},{dropdown:i(()=>[l(M,null,{default:i(()=>[(d(!0),_(H,null,ee(a.value,F=>(d(),E(S,{key:F.slug,command:F.slug,class:de({"is-active":A.value===F.slug})},{default:i(()=>[R(h(F.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:i(()=>[r("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:p(c)("Change tax class")},w[1]||(w[1]=[r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[r("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,iO)]),_:1})):x("",!0)])):x("",!0)])]),_:1})}}},uO={class:"fct-product-pricing-form-wrap"},cO={class:"fct-product-pricing-form-inner"},AO={key:0,class:"dialog-footer"},pO={class:"fct-btn-group sm"},Am={__name:"ProductPricingForm",props:{modeType:String,index:Number,fieldKey:String,product:Object,productEditModel:Object},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const n=e,s=V({}),o=a,u=ks(),A=V(0),f=V(!1),m=V({}),g=V(null),y=V(!1),v=I=>I?JSON.parse(JSON.stringify(I)):{},B=(I=n.modeType,O=n.index)=>{var K,G,ne;if(I==="create")return"create";if(I==="duplicate"){const Y=(K=n.product.variants)==null?void 0:K[O];return`duplicate-${(Y==null?void 0:Y.id)??O??"draft"}`}if(((G=n.product.detail)==null?void 0:G.variation_type)==="simple")return"simple-0";const P=(ne=n.product.variants)==null?void 0:ne[O];return`update-${(P==null?void 0:P.id)??O??"draft"}`},b=(I=n.modeType,O=n.index,P=s.value)=>({modeType:I,index:O,variant:v(P)}),w=()=>{if(y.value){y.value=!1;return}!g.value||f.value||!A.value||(m.value[g.value]=b())},k=()=>{var I;(I=s.value)!=null&&I.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=F.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},S=async()=>{var O,P,K,G;w(),f.value=!0,A.value=0,g.value=B();const I=(O=m.value[g.value])==null?void 0:O.variant;if(I){s.value=v(I),k(),await ye(),A.value=1,f.value=!1;return}((P=n.product.detail)==null?void 0:P.variation_type)==="simple"?Array.isArray(n.product.variants)&&n.product.variants.length===0?(s.value=n.productEditModel.addDummyVariant(),s.value.variation_title=n.product.post_title):s.value=n.product.variants[0]:n.modeType==="create"?s.value=n.productEditModel.addDummyVariant():n.modeType==="update"?s.value=v((K=n.product.variants)==null?void 0:K[n.index]):n.modeType==="duplicate"?(s.value=v((G=n.product.variants)==null?void 0:G[n.index]),s.value.serial_index=n.productEditModel.variantsLength()+1,s.value.variation_title=`${c("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={},k(),await ye(),A.value=0,f.value=!1},M=async()=>{var I;try{let O=n.index;const P=v(s.value);n.modeType==="duplicate"&&(O=n.productEditModel.variantsLength(),P.rowId=(P.rowId??0)+1);let K=await n.productEditModel.createOrUpdatePricing(P);return(I=K==null?void 0:K.data)!=null&&I.id?(P.id=K.data.id,n.productEditModel.afterCreatingOrUpdatingPricing(O,P),O==null&&(O=n.product.variants.findIndex(G=>(G==null?void 0:G.id)===P.id),O===-1&&(O=n.product.variants.length-1)),g.value&&delete m.value[g.value],A.value=0,o("createOrUpdateVariant",{index:O,modeType:n.modeType,variant:v(P)}),{index:O,modeType:n.modeType,variant:v(P)}):null}catch{return null}},$=async()=>M(),F=j(()=>Ie.get("shop.weight_unit")||"kg"),L=()=>{const I={...m.value};return g.value&&A.value&&(I[g.value]=b()),Object.entries(I)},Q=()=>L().length>0,T=()=>L().length,D=j(()=>L().length),U=async()=>{y.value=!0,m.value={},A.value=0,n.productEditModel.setValidationErrors({}),await S()};return ge(s,()=>{f.value||A.value++},{deep:!0}),ge(()=>[n.modeType,n.index],()=>{S()},{immediate:!0}),ge(D,I=>{o("dirtyStateChange",!!I)},{immediate:!0}),u.bind(["mod+s"],I=>{var O,P;((P=(O=n.product)==null?void 0:O.detail)==null?void 0:P.variation_type)!=="simple"&&(I.preventDefault(),A.value&&$())}),At(()=>{u.unbind("mod+s")}),t({hasDirtyDrafts:Q,getDirtyDraftCount:T,discardDrafts:U,saveCurrentDraft:M,loadVariantFromProps:S}),(I,O)=>{const P=C("el-form"),K=C("el-button");return d(),_("div",uO,[r("div",cO,[l(P,{"label-position":"top","require-asterisk-position":"right"},{default:i(()=>[l(ML,{variant:s.value,"field-key":n.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),l(_R,{variant:s.value,"field-key":n.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),l(qR,{variant:s.value,"field-key":n.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),l(lO,{variant:s.value,"field-key":n.fieldKey,"mode-type":e.modeType,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product-edit-model"]),e.productEditModel.isTaxEnabled()?(d(),E(dO,{key:0,variant:s.value,"product-edit-model":e.productEditModel,"field-key":n.fieldKey,"mode-type":e.modeType},null,8,["variant","product-edit-model","field-key","mode-type"])):x("",!0)]),_:1})]),e.modeType!=="add"?(d(),_("div",AO,[r("div",pO,[D.value?(d(),E(K,{key:0,onClick:U},{default:i(()=>[R(h(p(c)("Discard")),1)]),_:1})):x("",!0),l(K,{onClick:O[0]||(O[0]=()=>{o("closeModal")})},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(K,{disabled:e.productEditModel.saving||e.modeType==="update"&&!D.value,onClick:$,type:"primary",loading:e.productEditModel.saving},{default:i(()=>[R(h(typeof s.value.id>"u"?p(c)("Save"):p(c)("Update")),1)]),_:1},8,["disabled","loading"])])])):x("",!0)])}}},fO={class:"fct-product-button-and-drawer-wrap"},mO={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},hO={key:1,class:"fct-btn-group sm"},_O={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,n=t;let s=V(null);const o=V(1),u=(v="update")=>{n("open-editor",{modeType:v,index:a.index??null})},A=j(()=>{var v;return{product:a.product,variant:a.variant,index:a.index,productEditModel:a.productEditModel,openPricingModal:B=>{u(B)},vueContext:(v=Qt())==null?void 0:v.ctx}}),f=V([]),m=()=>{var w,k;const v=((w=window==null?void 0:window.fluent_cart_admin)==null?void 0:w.hooks)||(window==null?void 0:window.fluentCartAdminHooks),B=[],b=(k=v==null?void 0:v.applyFilters)==null?void 0:k.call(v,"fluent_cart_product_pricing_actions_dropdown_items",B,A.value);f.value=Array.isArray(b)?b:B},g=v=>v?typeof v.disabled=="function"?!!v.disabled(A.value):!!v.disabled:!1;Be(()=>{s.value=a.index,m(),setTimeout(m,0)});const y=v=>{var B,b;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(A.value);if(v.command){const w=((B=window==null?void 0:window.fluent_cart_admin)==null?void 0:B.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(b=w==null?void 0:w.doAction)==null?void 0:b.call(w,"fluent_cart_product_pricing_actions_dropdown_command",v.command,A.value,v)}}v==="duplicate_pricing"?u("duplicate"):v==="delete_variant"&&a.productEditModel.deletePricing(a.variant.id,a.index)};return(v,B)=>{const b=C("el-button"),w=C("el-checkbox"),k=C("el-dropdown-item"),S=C("el-dropdown-menu"),M=C("el-dropdown");return d(),_("div",fO,[a.modeType=="add"?(d(),_("div",mO,[e.product.detail.variation_type!=="simple"?(d(),E(b,{key:0,text:"",type:"primary",onClick:B[0]||(B[0]=$=>u("create"))},{default:i(()=>[l(W,{name:"Plus"}),R(" "+h(e.product.variants.length>0?v.$t("Add more"):v.$t("Add Pricing")),1)]),_:1})):x("",!0)])):x("",!0),a.modeType=="action"?(d(),_("div",hO,[l(Oe,{class:"hide-on-mobile",size:"small",tag:"button",onClick:B[1]||(B[1]=$=>u("update"))},{default:i(()=>[l(W,{name:"Edit"})]),_:1}),l(M,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:B[5]||(B[5]=$=>{$&&m()})},{dropdown:i(()=>[l(S,null,{default:i(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(d(),E(k,{key:0,class:"item-checkbox"},{default:i(()=>[l(w,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":B[2]||(B[2]=$=>e.variant.manage_stock=$),onChange:B[3]||(B[3]=$=>{e.productEditModel.onChangePricing("manage_stock",p(s),$)}),"true-value":"0","false-value":"1"},{default:i(()=>[R(h(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):x("",!0),l(k,{class:"show-on-mobile",onClick:B[4]||(B[4]=$=>u("update"))},{default:i(()=>[l(W,{name:"Edit"}),R(" "+h(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(d(),E(k,{key:1,command:"duplicate_pricing"},{default:i(()=>[l(W,{name:"Duplicate"}),R(" "+h(v.$t("Duplicate")),1)]),_:1})):x("",!0),l(k,null,{default:i(()=>[e.variant.id?(d(),E(Za,{key:0,class:"fct-copy-wrap-inline",text:e.variant.id,showMode:"icon_with_text",buttonText:v.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:1}),l(k,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:i(()=>{var $;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(d(),E(Za,{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"])):(d(),_(H,{key:1},[l(W,{name:"Copy"}),R(" "+h(v.$t("Direct Checkout"))+" ",1),l(sa,{content:v.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:1},8,["disabled"]),(d(!0),_(H,null,ee(f.value,($,F)=>(d(),E(k,{key:"js_item_"+F,command:$,class:de($==null?void 0:$.class),divided:!!($!=null&&$.divided),disabled:g($)},{default:i(()=>[$!=null&&$.icon?(d(),E(W,{key:0,name:$.icon},null,8,["name"])):x("",!0),R(" "+h($==null?void 0:$.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>o.value?(d(),E(k,{key:2,command:"delete_variant",class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(v.$t("Delete")),1)]),_:1})):x("",!0)]),_:1})]),default:i(()=>[r("span",_O,[l(W,{name:"More"})])]),_:1})])):x("",!0)])}}},gO={class:"fct-variant-pricing-add-button-wrap"},vO={__name:"VariantPricingAddButton",props:{product:Object,drawerMode:String,isVariationDirty:Boolean},emits:["open-editor"],setup(e,{emit:t}){const a=e,n=t,s=()=>{n("open-editor",{modeType:"create"})},o=()=>a.drawerMode==="create"||a.isVariationDirty;return(u,A)=>{var m;const f=C("el-button");return d(),_("div",gO,[((m=e.product.detail)==null?void 0:m.variation_type)!=="simple"?(d(),E(f,{key:0,text:"",type:"primary",disabled:o(),onClick:s,size:"small"},{default:i(()=>[l(W,{name:"Plus"}),R(" "+h(e.product.variants.length>0?u.$t("Add more"):u.$t("Add Pricing")),1)]),_:1},8,["disabled"])):x("",!0)])}}},yO={class:"fct-shared-variant-nav__summary"},bO={class:"fct-shared-variant-nav__summary-product"},wO={class:"fct-shared-variant-nav__summary-product-name"},CO={class:"fct-shared-variant-nav__summary-meta"},BO={class:"fct-shared-variant-nav__status"},kO={class:"fct-shared-variant-nav__variant-count"},xO={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(d(),_("div",yO,[r("div",bO,[r("h3",wO,h(e.product.post_title||p(c)("Untitled product")),1)]),r("div",CO,[r("span",BO,[l(qt,{status:e.product.post_status||"draft"},null,8,["status"])]),r("span",kO,h(e.product.variants.length)+" "+h(p(c)("variants")),1)])]))}},SO={class:"fct-shared-variant-nav__list"},FO=["disabled","aria-current","onClick"],EO={class:"fct-shared-variant-nav__item-image-wrapper"},UO={class:"fct-shared-variant-nav__item-image"},$O=["src","alt"],DO=["src","alt"],QO={key:0,class:"fct-shared-variant-nav__item-dot"},IO={class:"fct-shared-variant-nav__item-content"},TO={class:"fct-shared-variant-nav__item-title"},VO={class:"fct-shared-variant-nav__item-meta"},MO=["disabled","aria-label"],LO=["disabled","aria-label"],RO={class:"more-btn"},OO={__name:"VariantNavList",props:{items:Array,activeKey:[String,Number],isDirty:Boolean,isSaving:Boolean,drawerMode:String,product:Object,productEditModel:Object,canCopyDirectCheckout:Function},emits:["select","command","save"],setup(e,{emit:t}){const a=()=>Ps.getUrl("images/placeholder.svg"),n=e,s=u=>{const A=n.isDirty&&n.activeKey!==u.key,f=n.drawerMode==="create"&&u.key!=="draft-variation";return A||f},o=t;return(u,A)=>{const f=C("el-dropdown-item"),m=C("el-dropdown-menu"),g=C("el-dropdown");return d(),_("div",SO,[(d(!0),_(H,null,ee(e.items,y=>{var v,B,b,w,k,S;return d(),_("div",{key:y.key,class:de(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===y.key,"is-draft":y.isDraft}])},[r("button",{type:"button",class:de(["fct-shared-variant-nav__item",{"is-disabled":s(y)}]),disabled:s(y),"aria-current":e.activeKey===y.key?"true":void 0,onClick:M=>!s(y)&&o("select",y)},[r("div",EO,[r("div",UO,[(b=(B=(v=y.variant)==null?void 0:v.media)==null?void 0:B[0])!=null&&b.url?(d(),_("img",{key:0,src:(S=(k=(w=y.variant)==null?void 0:w.media)==null?void 0:k[0])==null?void 0:S.url,alt:y.label},null,8,$O)):(d(),_("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:y.label},null,8,DO))]),e.activeKey===y.key?(d(),_("span",QO)):x("",!0)]),r("div",IO,[r("span",TO,h(y.label),1),r("span",VO,h(y.meta),1)])],10,FO),e.isDirty&&e.activeKey===y.key?(d(),_("button",{key:0,type:"button",class:de(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:A[0]||(A[0]=M=>o("save")),"aria-label":p(c)("Save variant")},[e.isSaving?(d(),E(W,{key:1,name:"Loading",class:"fct-rotation-icon"})):(d(),E(W,{key:0,name:"Save"}))],10,MO)):x("",!0),y.isDraft?x("",!0):(d(),E(g,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s(y),onCommand:M=>!s(y)&&o("command",M,y)},{dropdown:i(()=>[l(m,null,{default:i(()=>{var M;return[((M=e.product.detail)==null?void 0:M.variation_type)!=="simple"?(d(),E(f,{key:0,command:"duplicate"},{default:i(()=>[l(W,{name:"Duplicate"}),R(" "+h(p(c)("Duplicate")),1)]),_:1})):x("",!0),l(f,{command:"copy_variation_id"},{default:i(()=>[l(W,{name:"Copy"}),R(" "+h(p(c)("Copy Variation ID")),1)]),_:1}),l(f,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(y)},{default:i(()=>[l(W,{name:"Copy"}),R(" "+h(p(c)("Direct Checkout")),1)]),_:2},1032,["disabled"]),e.productEditModel.variantsLength()>1?(d(),E(f,{key:1,command:"delete",class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:1})):x("",!0)]}),_:2},1024)]),default:i(()=>[r("button",{type:"button",class:de(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(y)}]),disabled:s(y),onClick:A[1]||(A[1]=Xe(()=>{},["stop"])),"aria-label":p(c)("Variation actions")},[r("span",RO,[l(W,{name:"More"})])],10,LO)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])}}},HO={class:"fct-shared-variant-nav-mobile"},PO=["disabled","onClick"],NO={__name:"VariantNavMobile",props:{items:Array,activeKey:[String,Number],isDirty:Boolean},emits:["select"],setup(e,{emit:t}){const a=t;return(n,s)=>(d(),_("div",HO,[(d(!0),_(H,null,ee(e.items,o=>(d(),_("button",{key:`mobile-${o.key}`,type:"button",class:de(["fct-shared-variant-nav-mobile__item",{"is-active":e.activeKey===o.key,"is-draft":o.isDraft}]),disabled:e.isDirty&&e.activeKey!==o.key,onClick:u=>a("select",o)},h(o.label),11,PO))),128))]))}},KO={class:"fct-product-pricing-table-wrap"},GO={class:"fct-table-draggable hide-on-mobile"},jO={class:"is-right"},zO={key:0,class:"fct-drag-handle drag-icon"},YO={class:"fct-product-pricing-table-item"},qO={key:0,class:"fct-variant-badge"},WO={class:"fct-product-pricing-table-item"},XO={key:0,class:"fct-variant-badge"},JO={class:"fct-product-pricing-table-item"},ZO={class:"is-right"},eH={class:"fct-product-pricing-table-item"},tH={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},aH={key:0,class:"fct-drag-handle drag-icon"},nH={class:"fct-product-pricing-table-mobile-item-inner"},sH={class:"fct-product-pricing-table-item"},lH={class:"media"},oH={class:"fct-product-pricing-table-item-content"},rH={class:"title"},iH={key:0,class:"fct-variant-badge"},dH={key:0,class:"compare-price"},uH={class:"price"},cH={key:0,class:"capitalize"},AH={class:"fct-product-pricing-table-item-action"},pH={class:"fct-shared-variant-drawer__layout"},fH={key:0,class:"fct-shared-variant-nav"},mH={class:"fct-shared-variant-drawer__content"},hH={class:"fct-shared-variant-drawer__form"},_H={class:"fct-variant-dirty-dialog__header"},gH={class:"dialog-footer"},vH={class:"fct-btn-group sm"},bA=1040,yH=1060,bH={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=V(typeof window<"u"?window.innerWidth:bA),n=V(0),s=()=>{if(typeof window>"u")return 0;const se=document.querySelector("#adminmenuwrap");if(!se)return 0;const ce=window.getComputedStyle(se);return ce.display==="none"||ce.visibility==="hidden"?0:Math.round(se.getBoundingClientRect().width)},o=()=>{typeof window>"u"||(a.value=window.innerWidth,n.value=s())};Be(()=>{o(),window.addEventListener("resize",o),setTimeout(()=>{document.querySelectorAll(".el-input__wrapper input[type='number']").forEach(ce=>{ce.addEventListener("wheel",pe=>{document.activeElement===ce&&pe.preventDefault()})}),t.product.variants.filter(ce=>{const pe=ce.media?ce.media.meta_value||[]:[];return ce.media=pe})},50)}),At(()=>{typeof window>"u"||window.removeEventListener("resize",o)});const u=j(()=>({animation:600,ghostClass:"ghost"})),A=V(!1),f=V("update"),m=V(null),g=V(null),y=V(!1),v=V(!1),B=V(null),b=V(!1),w=j(()=>Math.max(a.value-n.value,360)),k=j(()=>w.value<=yH),S=j(()=>{let se=24;a.value<=640?se=12:a.value<=900&&(se=16);const ce=Math.max(w.value-se,320);return`${Math.min(bA,ce)}px`}),M=(se,ce)=>(se==null?void 0:se.variation_title)||`${c("Variation")} ${ce+1}`,$=se=>{var pe,De;const ce=(se==null?void 0:se.item_price)??"";return ce===""||ce===null||ce===void 0?c("No price set"):`${((De=(pe=window.appVars)==null?void 0:pe.shop)==null?void 0:De.currency_sign)||"$"} ${ce}`},F=se=>typeof se=="number"&&se>=0&&se<t.product.variants.length?se:t.product.variants.length?0:null,L=({modeType:se="update",index:ce=null}={})=>{f.value=se,m.value=se==="create"?null:F(ce),b.value=!1,t.productEditModel.setValidationErrors({}),A.value=!0},Q=()=>{b.value=!1,t.productEditModel.setValidationErrors({}),A.value=!1},T=()=>{y.value=!1,v.value=!1,B.value=null},D=()=>{var se,ce;return((ce=(se=g.value)==null?void 0:se.hasDirtyDrafts)==null?void 0:ce.call(se))??!1},U=se=>{se&&(f.value=se.modeType,m.value=se.index,t.productEditModel.setValidationErrors({}))},I=async(se,ce)=>{var pe,De;if(!(!ce||!se)){if(se==="duplicate"){L({modeType:"duplicate",index:ce.index});return}if(se==="delete"&&((pe=ce.variant)!=null&&pe.id)){t.productEditModel.deletePricing(ce.variant.id,ce.index).then(async()=>{var $e,Je;await ye(),t.product.variants.length>0?(f.value="update",m.value=Math.min(ce.index,t.product.variants.length-1),b.value=!1,(Je=($e=g.value)==null?void 0:$e.loadVariantFromProps)==null||Je.call($e)):Q()}).catch(()=>{});return}if(se==="copy_variation_id"&&((De=ce.variant)!=null&&De.id)){Os.copy(String(ce.variant.id),{successMessage:c("Variation ID copied to clipboard")});return}se==="copy_direct_checkout"&&O(ce)&&Os.copy(P(ce),{successMessage:c("Direct checkout link copied to clipboard")})}},O=se=>{var ce,pe;return!!((ce=se==null?void 0:se.variant)!=null&&ce.id)&&["publish","private"].includes((pe=t.product)==null?void 0:pe.post_status)},P=se=>`${Ie.get("frontend_url")}=instant_checkout&item_id=${se.variant.id}&quantity=1`,K=()=>{const se=B.value;if(T(),!!se&&se.type==="close"){if(typeof se.done=="function"){se.done();return}Q()}},G=()=>{T()},ne=async()=>{var se,ce;await((ce=(se=g.value)==null?void 0:se.discardDrafts)==null?void 0:ce.call(se)),K()},Y=async()=>{var ce;if(!((ce=g.value)!=null&&ce.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){K();return}v.value=!1,G()},N=se=>{if(!D()){se();return}B.value={type:"close",done:se},y.value=!0},oe=()=>{N(()=>{Q()})},Z=se=>{b.value=se},le=se=>{se&&(f.value="update",typeof se.index=="number"&&se.index>=0?m.value=se.index:m.value=F(m.value),b.value=!1,t.productEditModel.setValidationErrors({}))},te=(se,ce)=>{const pe=M(se,ce);return`${c("Copy of")} ${pe}`},X=j(()=>{var ce;const se=(t.product.variants||[]).map((pe,De)=>({key:(pe==null?void 0:pe.id)??`variant-${De}`,index:De,variant:pe,label:M(pe,De),meta:$(pe),modeType:"update",isDraft:!1}));if(A.value&&f.value==="create"&&se.push({key:"draft-variation",index:null,label:c("New variation"),meta:c("Unsaved draft"),modeType:"create",isDraft:!0}),A.value&&f.value==="duplicate"){const pe=(ce=t.product.variants)==null?void 0:ce[m.value];se.push({key:"duplicate-variation",index:m.value,variant:pe,label:te(pe,m.value??0),meta:c("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return se}),ie=j(()=>{var ce;if(f.value==="create"&&m.value===null)return"draft-variation";if(f.value==="duplicate")return"duplicate-variation";const se=(ce=t.product.variants)==null?void 0:ce[m.value];return(se==null?void 0:se.id)??`variant-${m.value??0}`}),be=se=>{se&&(b.value&&ie.value!==se.key||U(se))};return(se,ce)=>{const pe=C("el-input"),De=C("el-drawer"),$e=C("el-button"),Je=C("el-dialog");return d(),_("div",KO,[r("div",GO,[r("table",null,[ce[5]||(ce[5]=r("colgroup",null,[r("col"),r("col",{width:"50"}),r("col",{width:"300"}),r("col"),r("col"),r("col")],-1)),r("thead",null,[r("tr",null,[ce[4]||(ce[4]=r("th",null,null,-1)),r("th",null,h(se.$t("Image")),1),r("th",null,h(se.$t("Title")),1),r("th",null,h(se.$t("Price")),1),r("th",null,h(se.$t("Compare at price")),1),r("th",jO,h(se.$t("Action")),1)])]),l(p(Fr),la(u.value,{list:e.product.variants,"item-key":"id",onEnd:ce[0]||(ce[0]=we=>{e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:i(()=>[(d(!0),_(H,null,ee(e.product.variants,(we,Ye)=>{var ft,Ge,_e,xe;return d(),_("tr",{key:we.id},[r("td",null,[e.product.variants.length>1?(d(),_("span",zO,[l(W,{name:"ReorderDotsVertical"})])):x("",!0)]),r("td",null,[l(Bs,{modelValue:we.media,"onUpdate:modelValue":Me=>we.media=Me,compact:!0,"max-thumbs":1,onChange:Me=>e.productEditModel.onUploadPricingMedia("media",Ye,Me)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),r("td",null,[r("div",YO,[l(pe,{class:de(e.productEditModel.hasValidationError(`variants.${Ye}.variation_title`)?"is-error":""),id:`variants.${Ye}.variation_title`,placeholder:se.$t("e.g. Small, Medium, Large"),type:"text",modelValue:we.variation_title,"onUpdate:modelValue":Me=>we.variation_title=Me,onInput:Me=>{e.productEditModel.onChangePricing("variation_title",Ye,Me)},disabled:((Ge=(ft=e.product)==null?void 0:ft.detail)==null?void 0:Ge.variation_type)==="simple",onFocus:Me=>e.productEditModel.clearValidationError(`variants.${Ye}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((_e=we.other_info)==null?void 0:_e.installment)==="yes"?(d(),_("span",qO,h(we.other_info.times)+" "+h(p(c)("Installment")),1)):x("",!0)])]),r("td",null,[r("div",WO,[l(hl,{placeholder:se.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ye}.item_price`)?"is-error":"",id:`variants.${Ye}.item_price`,"model-value":we.item_price,disabled:we.expanded,"onUpdate:modelValue":Me=>{we.item_price=Me,e.productEditModel.onChangePricing("item_price",Ye,Me),e.productEditModel.clearValidationError(`variants.${Ye}.item_price`)}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((xe=we.other_info)==null?void 0:xe.payment_type)==="subscription"?(d(),_("span",XO,h(we.other_info.repeat_interval),1)):x("",!0)])]),r("td",null,[r("div",JO,[l(hl,{placeholder:se.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ye}.compare_price`)?"is-error":"",id:`variants.${Ye}.compare_price`,"model-value":we.compare_price,disabled:we.expanded,"onUpdate:modelValue":Me=>{we.compare_price=Me,e.productEditModel.onChangePricing("compare_price",Ye,Me),e.productEditModel.clearValidationError(`variants.${Ye}.compare_price`)}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),r("td",ZO,[r("div",eH,[l(Yi,{modeType:"action",index:Ye,variant:we,product:e.product,productEditModel:e.productEditModel,onOpenEditor:L},null,8,["index","variant","product","productEditModel"])])])])}),128))]),_:1},16,["list"])])]),r("div",tH,[l(p(Fr),la(u.value,{list:e.product.variants,"item-key":"id",onEnd:ce[1]||(ce[1]=we=>{e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:i(()=>[(d(!0),_(H,null,ee(e.product.variants,(we,Ye)=>{var ft,Ge;return d(),_("div",{key:we.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1?(d(),_("span",aH,[l(W,{name:"ReorderDotsVertical"})])):x("",!0),r("div",nH,[r("div",sH,[r("div",lH,[l(Bs,{modelValue:we.media,"onUpdate:modelValue":_e=>we.media=_e,compact:!0,"max-thumbs":1,onChange:_e=>e.productEditModel.onUploadPricingMedia("media",Ye,_e)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),r("div",oH,[r("div",rH,[R(h(we.variation_title)+" ",1),((ft=we.other_info)==null?void 0:ft.installment)==="yes"?(d(),_("span",iH,h(we.other_info.times)+" "+h(p(c)("Installment")),1)):x("",!0)]),r("ul",null,[r("li",null,[we.compare_price?(d(),_("div",dH,[r("span",null,h(se.appVars.shop.currency_sign),1),R(" "+h(we.compare_price),1)])):x("",!0),r("div",uH,[r("span",null,h(se.appVars.shop.currency_sign),1),R(" "+h(we.item_price),1)])]),((Ge=we.other_info)==null?void 0:Ge.payment_type)==="subscription"?(d(),_("li",cH,h(we.other_info.repeat_interval),1)):x("",!0)])])]),r("div",AH,[l(Yi,{modeType:"action",index:Ye,variant:we,product:e.product,productEditModel:e.productEditModel,onOpenEditor:L},null,8,["index","variant","product","productEditModel"])])])])}),128))]),_:1},16,["list"])]),l(Yi,{modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:L},null,8,["product","productEditModel"]),l(De,{modelValue:A.value,"onUpdate:modelValue":ce[2]||(ce[2]=we=>A.value=we),title:se.$t("Pricing"),size:S.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":N,class:"fct-shared-variant-drawer",onClose:Q},{default:i(()=>[r("div",pH,[k.value?x("",!0):(d(),_("aside",fH,[l(xO,{product:e.product},null,8,["product"]),l(OO,{items:X.value,"active-key":ie.value,"is-dirty":b.value,"drawer-mode":f.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":O,"is-saving":v.value,onSelect:be,onCommand:I,onSave:Y},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),l(vO,{product:e.product,"drawer-mode":f.value,"is-variation-dirty":b.value,onOpenEditor:L},null,8,["product","drawer-mode","is-variation-dirty"])])),r("div",mH,[k.value?(d(),E(NO,{key:0,items:X.value,"active-key":ie.value,"is-dirty":b.value,onSelect:be},null,8,["items","active-key","is-dirty"])):x("",!0),r("div",hH,[l(Am,{ref_key:"pricingFormRef",ref:g,index:m.value,modeType:f.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:le,onCloseModal:oe,onDirtyStateChange:Z},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),l(Je,{modelValue:y.value,"onUpdate:modelValue":ce[3]||(ce[3]=we=>y.value=we),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:G},{header:i(()=>[r("div",_H,[r("h3",null,h(p(c)("Unsaved changes")),1)])]),default:i(()=>[r("p",null,h(p(c)("You have unsaved variation changes. Discard them or save before continuing.")),1),r("div",gH,[r("div",vH,[l($e,{disabled:v.value,onClick:G,size:"small"},{default:i(()=>[R(h(p(c)("Continue editing")),1)]),_:1},8,["disabled"]),l($e,{disabled:v.value,onClick:ne,size:"small"},{default:i(()=>[R(h(p(c)("Discard")),1)]),_:1},8,["disabled"]),l($e,{type:"primary",loading:v.value,onClick:Y,size:"small"},{default:i(()=>[R(h(p(c)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},wH={class:"fct-product-pricing-wrap"},CH={class:"w-[150px] fct-select-gray"},BH={key:1,class:"fct-simple-product-actions"},kH={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var A,f;const t=e;V(!1);const a=V((f=(A=t.product)==null?void 0:A.detail)==null?void 0:f.variation_type),n=V(null),s=m=>{var y;const g=((y=t.product.variants)==null?void 0:y.length)??0;m==="simple"&&t.product.detail.variation_type==="simple_variations"&&g>1?(n.value=m,a.value=t.product.detail.variation_type,$u.confirmDeleteWithInput("proceed",c("Switching to 'Simple' will permanently delete all variations except the first one.")).then(()=>{o()}).catch(()=>{n.value||(n.value=null)})):u(m)},o=()=>{n.value&&u(n.value),n.value=null},u=m=>{a.value=m,t.productEditModel.updateVariationType("variation_type",m)};return(m,g)=>{var B,b;const y=C("el-option"),v=C("el-select");return d(),_("div",wH,[l(he,{class:de(((b=(B=e.product)==null?void 0:B.detail)==null?void 0:b.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:i(()=>{var w,k;return[l(Ce,{title:m.$t("Pricing"),border_bottom:""},{action:i(()=>[r("div",CH,[e.product.detail?(d(),E(v,{key:0,size:"small",class:de(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=S=>a.value=S),placeholder:m.$t("Select Variation"),onChange:s},{default:i(()=>[l(y,{label:m.$t("Simple"),value:"simple"},null,8,["label"]),l(y,{label:m.$t("Simple Variations"),value:"simple_variations"},null,8,["label"])]),_:1},8,["class","modelValue","placeholder"])):x("",!0)])]),_:1},8,["title"]),l(me,{class:de(((k=(w=e.product)==null?void 0:w.detail)==null?void 0:k.variation_type)==="simple_variations"?"pb-0":"")},{default:i(()=>{var S,M,$,F,L,Q,T,D,U,I,O,P,K,G,ne;return[((M=(S=e.product)==null?void 0:S.detail)==null?void 0:M.variation_type)==="simple"?(d(),E(Am,{key:0,class:"simple-product-pricing",index:0,modeType:"add",fieldKey:"variants.0",product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0),((F=($=e.product)==null?void 0:$.detail)==null?void 0:F.variation_type)==="simple"&&((Q=(L=e.product)==null?void 0:L.variants[0])!=null&&Q.id)?(d(),_("div",BH,[l(Za,{class:"fct-copy-wrap-inline",text:e.product.variants[0].id,showMode:"icon_with_text",buttonText:m.$t("Copy Variation ID")},null,8,["text","buttonText"]),((D=(T=e.product)==null?void 0:T.detail)==null?void 0:D.variation_type)==="simple"&&(((U=e.product)==null?void 0:U.post_status)==="publish"||((I=e.product)==null?void 0:I.post_status)==="private")&&((P=(O=e.product)==null?void 0:O.variants[0])!=null&&P.id)?(d(),E(Za,{key:0,class:"fct-copy-wrap-inline mt-3",text:((K=m.appVars)==null?void 0:K.frontend_url)+"=instant_checkout&item_id="+e.product.variants[0].id+"&quantity=1",showMode:"icon_with_text",placement:"top",buttonText:m.$t("Direct Checkout"),tooltipContent:m.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):x("",!0)])):x("",!0),((ne=(G=e.product)==null?void 0:G.detail)==null?void 0:ne.variation_type)==="simple_variations"?(d(),E(bH,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},xH={key:0,class:"fct-product-inventory-wrap"},SH={class:"fct-product-inventory-inner-wrap hide-on-mobile"},FH={class:"relative"},EH={key:0,class:"fct-variant-badge absolute -top-2 right-1.5 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"},UH={class:"fct-product-inventory-inner-wrap-mobile"},$H={key:0,class:"fct-product-inventory-mobile-col"},DH={class:"title"},QH={key:0,class:"text-xs text-gray-500 mt-1"},IH={class:"fct-product-inventory-mobile-col"},TH={class:"fct-product-inventory-mobile-col"},VH={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,n=Ie.get("modules_settings.stock_management.active");Be(()=>{a.product.variants.filter(f=>(f.new_stock=f.total_stock,f.adjusted_quantity=0,f))});const s=f=>a.product.detail.variation_type==="simple_variations"&&f.row.manage_stock==0?"disable_inventory_row":"",o=f=>a.product.detail.variation_type==="simple_variations"&&f.manage_stock==0?"disable_inventory_row":"",u=f=>{let m=parseInt(a.product.variants[f].new_stock);a.product.variants[f].total_stock=m<0?0:m;let g=parseInt(a.product.variants[f].total_stock)-parseInt(a.product.variants[f].committed)-parseInt(a.product.variants[f].on_hold);a.product.variants[f].available=g<0?0:g,a.product.variants[f].adjusted_quantity=0,a.product.variants[f].new_stock=a.product.variants[f].total_stock,re.put(`products/${a.product.ID}/update-inventory/${a.product.variants[f].id}`,{total_stock:a.product.variants[f].total_stock,available:a.product.variants[f].available}).then(y=>{q.success(y.message)}).catch(y=>{var v;y.status_code=="422"?q.validationErrors(y):q.error((v=y.data)==null?void 0:v.message)})},A=f=>{re.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(m=>{q.success(m.message),a.product.variants.forEach(g=>{g.manage_stock=f,g.total_stock=1,g.available=1})}).catch(m=>{var g;m.status_code=="422"?q.validationErrors(m):q.error((g=m.data)==null?void 0:g.message)})};return(f,m)=>{const g=C("el-switch"),y=C("el-input"),v=C("el-table-column"),B=C("el-table");return p(n)==="yes"?(d(),_("div",xH,[l(he,{class:"overflow-hidden"},{default:i(()=>{var b,w;return[l(Ce,{class:de(((b=e.product.detail)==null?void 0:b.manage_stock.toString())==="0"?"pb-5":"")},{action:i(()=>{var k;return[(k=e.product.detail)!=null&&k.manage_stock?(d(),E(g,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":m[0]||(m[0]=S=>e.product.detail.manage_stock=S),onChange:A,"active-value":"1","inactive-value":"0","active-text":p(c)("Inventory Management")},null,8,["modelValue","active-text"])):x("",!0)]}),_:1},8,["class"]),l(ra,{visible:((w=e.product.detail)==null?void 0:w.manage_stock.toString())==="1",accordion:""},{default:i(()=>[l(me,{class:"px-0 pb-0"},{default:i(()=>[r("div",SH,[l(B,{data:e.product.variants,"row-class-name":s},{default:i(()=>[e.product.detail.variation_type==="simple_variations"?(d(),E(v,{key:0,label:p(c)("Title"),width:"140"},{default:i(k=>{var S;return[r("div",FH,[l(y,{disabled:"",size:"small",modelValue:k.row.variation_title,"onUpdate:modelValue":M=>k.row.variation_title=M},null,8,["modelValue","onUpdate:modelValue"]),((S=k.row.other_info)==null?void 0:S.payment_type)==="subscription"?(d(),_("span",EH,h(k.row.other_info.repeat_interval),1)):x("",!0)])]}),_:1},8,["label"])):x("",!0),l(v,{label:p(c)("SKU"),width:"140"},{default:i(k=>[l(y,{disabled:"",size:"small",modelValue:k.row.sku,"onUpdate:modelValue":S=>k.row.sku=S,placeholder:p(c)("SKU")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),l(v,{label:p(c)("Total Stock"),width:"160"},{default:i(k=>[r("div",null,[l(y,{modelValue:k.row.total_stock,"onUpdate:modelValue":S=>k.row.total_stock=S,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:i(()=>[l(Vd,{variant:k.row,"field-key":k.$index,"product-edit-model":e.productEditModel,onSave:S=>u(k.$index)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])])]),_:1},8,["label"]),l(v,{label:p(c)("Available"),width:"100"},{default:i(k=>[l(y,{disabled:"",size:"small",placeholder:p(c)(k.row.available)},null,8,["placeholder"])]),_:1},8,["label"]),l(v,{label:p(c)("On hold"),width:"100"},{default:i(k=>[l(y,{disabled:"",size:"small",placeholder:p(c)(k.row.on_hold)},null,8,["placeholder"])]),_:1},8,["label"]),l(v,{label:p(c)("Delivered"),width:"100"},{default:i(k=>[l(y,{disabled:"",size:"small",placeholder:p(c)(k.row.committed)},null,8,["placeholder"])]),_:1},8,["label"])]),_:1},8,["data"])]),r("div",UH,[(d(!0),_(H,null,ee(e.product.variants,(k,S)=>(d(),_("div",{key:S,class:de(["fct-product-inventory-mobile-row",o(k)])},[e.product.detail.variation_type==="simple_variations"?(d(),_("div",$H,[r("div",DH,[R(h(k.variation_title)+" ",1),k.sku?(d(),_("div",QH,"SKU: "+h(k.sku),1)):x("",!0)])])):x("",!0),r("div",IH,[l(y,{modelValue:k.total_stock,"onUpdate:modelValue":M=>k.total_stock=M,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:i(()=>[l(Vd,{variant:k,"field-key":S,"product-edit-model":e.productEditModel,onSave:M=>u(S)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),r("div",TH,[r("ul",null,[r("li",null,[r("span",null,h(p(c)("Available"))+":",1),R(" "+h(k.available.toString()),1)]),r("li",null,[r("span",null,h(p(c)("On Hold"))+":",1),R(" "+h(k.on_hold.toString()),1)]),r("li",null,[r("span",null,h(p(c)("Delivered"))+":",1),R(" "+h(k.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):x("",!0)}}},MH={class:"el-form el-form--default el-form--label-top"},pm={__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;return Ks(()=>{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(a=>parseInt(a))}catch{}}),(a,n)=>{const s=C("el-option"),o=C("el-select"),u=C("el-form-item"),A=C("el-input");return d(),_("div",MH,[l(u,{label:a.$t("Choose variant")},{default:i(()=>[l(o,{class:"",size:"small",modelValue:e.file.product_variation_id,"onUpdate:modelValue":n[0]||(n[0]=f=>e.file.product_variation_id=f),multiple:"",id:`downloadable_files.${e.index}.product_variation_id`,placeholder:a.$t("Keep empty for all"),"popper-class":"fct-choose-variant-popover","collapse-tags":"","collapse-tags-tooltip":""},{default:i(()=>[(d(!0),_(H,null,ee(e.productDownloadableModel.generateVariantOptions(e.product),f=>(d(),E(s,{key:f.id,label:f.variation_title,value:f.id},{default:i(()=>[l(Er,{variant:f},null,8,["variant"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),l(Pt,{"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?(d(),E(u,{key:0},{default:i(()=>[l(pp,{isMultiple:!e.singleMode,onOnFileSelected:n[1]||(n[1]=f=>{const m=e.index,g=f;g.forEach((y,v)=>{e.isEditing?(g[v].serial=m+1,g[v].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[m].settings.download_limit,g[v].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[m].settings.download_expiry,g.length>1?(g[v].product_variation_id=e.productDownloadableModel.data.downloadableFiles[m].product_variation_id,e.file=g[v]):(g[v].product_variation_id=e.productDownloadableModel.data.downloadableFiles[m].product_variation_id,e.file.file_name=g[v].file_name,e.file.file_path=g[v].file_path,e.file.file_size=g[v].file_size,e.file.file_url=g[v].file_url,e.file.title=g[v].title,e.file.type=g[v].type,e.file.settings=g[v].settings)):(g[v].serial=m+1,g[v].settings.download_limit=e.productDownloadableModel.insertableFiles[m].settings.download_limit,g[v].settings.download_expiry=e.productDownloadableModel.insertableFiles[m].settings.download_expiry,g.length>1?(g[v].product_variation_id=e.productDownloadableModel.insertableFiles[m].product_variation_id,e.productDownloadableModel.insertableFiles[m+v]=g[v]):(g[v].product_variation_id=e.productDownloadableModel.insertableFiles[m].product_variation_id,e.productDownloadableModel.insertableFiles[m]=g[v]))})})},null,8,["isMultiple"]),l(Pt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.file_url`},null,8,["validation-errors","field-key"])]),_:1})):x("",!0),e.file.title?(d(),E(u,{key:1,label:a.$t("File Title")},{default:i(()=>[r("p",null,h(e.file.title),1),x("",!0),l(Pt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.title`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])):x("",!0),e.file.driver?(d(),E(u,{key:2},{default:i(()=>[r("p",null,h(p(c)("Driver: %s",e.file.driver)),1)]),_:1})):x("",!0)])}}},LH={key:0,class:"text-right"},RH={key:1,class:"px-6 py-3"},OH={class:"fct-product-download-inner-wrap flex flex-col gap-4"},HH={class:"fct-product-download-form-box"},PH={key:1},NH={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=j(()=>window.innerWidth<=768?"90%":"34%");return(a,n)=>{const s=C("el-button"),o=C("el-drawer");return d(),_(H,null,[r("div",{class:de(["add-download-btn",e.productDownloadableModel.hasVariationOption(e.product)?"px-6 py-3 border border-solid border-gray-divider border-x-0 border-b-0 dark:border-dark-400":""])},[e.productDownloadableModel.hasVariationOption(e.product)?(d(),_("div",LH,[l(s,{text:"",type:"primary",onClick:n[0]||(n[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:i(()=>[l(W,{name:"Plus"}),R(" "+h(a.$t("Add")),1)]),_:1})])):(d(),_("div",RH,h(a.$t("No pricing added yet")),1))],2),l(o,{modelValue:e.productDownloadableModel.data.addModal.isModalOpen,"onUpdate:modelValue":n[4]||(n[4]=u=>e.productDownloadableModel.data.addModal.isModalOpen=u),size:t.value,onClose:n[5]||(n[5]=()=>{e.productDownloadableModel.clearInsertableFile()}),onOpen:n[6]||(n[6]=()=>{e.productDownloadableModel.addDummyInsertableFile()})},{header:i(()=>[l(sa,{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:i(()=>[r("div",null,[l(s,{onClick:n[2]||(n[2]=u=>e.productDownloadableModel.data.addModal.isModalOpen=!1)},{default:i(()=>[R(h(a.$t("Cancel")),1)]),_:1}),l(s,{type:"primary",onClick:n[3]||(n[3]=()=>{e.productDownloadableModel.attachInsertableFiles(e.product.ID)}),loading:e.productDownloadableModel.data.saving},{default:i(()=>[R(h(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:i(()=>[r("div",OH,[e.productDownloadableModel.insertableFiles.length?(d(!0),_(H,{key:0},ee(e.productDownloadableModel.insertableFiles,(u,A)=>(d(),_("div",HH,[e.productDownloadableModel.insertableFiles.length>1?(d(),E(s,{key:0,onClick:f=>e.productDownloadableModel.deleteInsertableFile(A),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),l(pm,{product:e.product,file:u,index:A,productDownloadableModel:e.productDownloadableModel},null,8,["product","file","index","productDownloadableModel"])]))),256)):x("",!0),e.productDownloadableModel.insertableFiles.length>1?(d(),_("div",PH,[l(pp,{uploadBtnText:p(c)("Add More Files"),onOnFileSelected:n[1]||(n[1]=u=>{const A=e.productDownloadableModel.insertableFiles.length-1,f=u;f.value.forEach((m,g)=>{f.value[g].serial=A+1,f.value[g].settings.download_limit=e.productDownloadableModel.insertableFiles[A].settings.download_limit,f.value[g].settings.download_expiry=e.productDownloadableModel.insertableFiles[A].settings.download_expiry,f.value[g].product_variation_id=e.productDownloadableModel.insertableFiles[A].product_variation_id,e.productDownloadableModel.insertableFiles.push(f.value[g])})})},null,8,["uploadBtnText"])])):x("",!0),(d(!0),_(H,null,ee(e.product.variants,(u,A)=>(d(),_("div",{key:A},[l(Pt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${A}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},KH={class:"fct-product-download-form-wrap"},GH={class:"fct-product-download-form-box"},jH={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=j(()=>window.innerWidth<=768?"90%":"40%"),n=V({...t.productDownloadable}),s=t.productDownloadableModel.data.editModal.states;return Ks(()=>{s[t.index]={},s[t.index].visible=!1}),(o,u)=>{const A=C("el-button"),f=C("el-drawer");return d(),_(H,null,[l(f,{"append-to-body":"",modelValue:p(s)[e.index].visible,"onUpdate:modelValue":u[1]||(u[1]=m=>p(s)[e.index].visible=m),size:a.value,title:p(c)("Edit Downloadable Asset"),onClose:u[2]||(u[2]=()=>{e.productDownloadableModel.closeEditModal(e.index)})},{footer:i(()=>[l(A,{type:"primary",loading:e.productDownloadableModel.saving,onClick:u[0]||(u[0]=()=>{e.productDownloadableModel.updateDownloadableFile()})},{default:i(()=>[R(h(p(c)("Update")),1)]),_:1},8,["loading"])]),default:i(()=>[r("div",KH,[r("div",GH,[l(pm,{product:e.product,file:n.value,index:e.index,productDownloadableModel:e.productDownloadableModel,singleMode:!0,"is-editing":""},null,8,["product","file","index","productDownloadableModel"])])])]),_:1},8,["modelValue","size","title"]),r("div",{class:"el-dropdown-menu__item w-full",onClick:u[3]||(u[3]=Xe(()=>{p(s)[e.index].visible=!0,e.productDownloadableModel.openEditModal(e.index,n.value)},["prevent"]))},[l(W,{name:"Edit"}),R(" "+h(p(c)("Edit")),1)])],64)}}},zH={class:"fct-product-download-wrap"},YH={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},qH={class:"fct-media-content-list"},WH={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},XH={class:"product-details"},JH={class:"product-details-content-row"},ZH={class:"product-details-content-first"},eP={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},tP={key:0,class:"font-normal text-system-mid"},aP={class:"product-variation-title inline-flex"},nP={key:1,class:"product-variation-title"},sP={class:"product-details-content-second"},lP={class:"more-btn"},oP={__name:"ProductDownload",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=e,a=function(s){re.get(`products/getDownloadableUrl/${s.id}`).then(o=>{Os.copy(o.url)}).catch(o=>{q.error({title:c("Error"),message:c("Failed to copy file URL")})})},n=s=>{s.action==="copy-download-link"?a(s.data):s.action==="delete"&&t.productDownloadableModel.deleteDownloadableFile(s.data.id,s.idx)};return(s,o)=>{const u=C("el-switch"),A=C("el-popover"),f=C("el-dropdown-item"),m=C("el-dropdown-menu"),g=C("el-dropdown");return d(),_("div",zH,[l(he,null,{default:i(()=>{var y;return[l(Ce,{class:"pb-5"},{action:i(()=>[e.product.detail?(d(),E(u,{key:0,modelValue:e.product.detail.manage_downloadable,"onUpdate:modelValue":o[0]||(o[0]=v=>e.product.detail.manage_downloadable=v),"active-value":"1","inactive-value":"0","active-text":s.$t("Downloadable Asset(s)"),onChange:o[1]||(o[1]=v=>{(v.toString()==="0"||e.productDownloadableModel.hasDownloadableFiles())&&e.productEditModel.setHasChange(!0)})},null,8,["modelValue","active-text"])):x("",!0)]),_:1}),l(ra,{visible:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:i(()=>[l(me,{class:"p-0"},{default:i(()=>[e.productDownloadableModel.hasDownloadableFiles()?(d(),_("div",YH,[r("div",qH,[(d(!0),_(H,null,ee(e.productDownloadableModel.downloadableFiles,(v,B)=>(d(),_("div",{class:"fct-media-content-list-item",key:B},[r("div",WH,h(v.type),1),r("div",XH,[r("div",JH,[r("div",ZH,[r("div",eP,[R(h(v.title)+" ",1),v.driver!=="local"?(d(),_("span",tP," - "+h(v.driver),1)):x("",!0)]),e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product).length?(d(),E(A,{key:0,placement:"top",trigger:"hover",width:200},{reference:i(()=>[r("div",aP," – "+h(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:i(()=>[(d(!0),_(H,null,ee(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(b,w)=>(d(),_("div",{style:{"margin-top":"4px"},key:w},h(b),1))),128))]),_:2},1024)):(d(),_("div",nP," – "+h(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),r("div",sP,[l(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:n},{dropdown:i(()=>[l(m,null,{default:i(()=>[l(f,{class:"item-link"},{default:i(()=>[l(jH,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:B},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),l(f,{command:{action:"copy-download-link",data:v}},{default:i(()=>[l(W,{name:"Copy"}),R(" "+h(p(c)("Copy Download Link")),1)]),_:2},1032,["command"]),l(f,{command:{action:"delete",data:v,idx:B},class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:i(()=>[r("span",lP,[l(W,{name:"More"})])]),_:2},1024)])])])]))),128))])])):x("",!0),l(NH,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},rP={class:"fct-product-status-wrap"},iP={class:"fct-admin-summary-item-list"},dP={class:"fct-admin-summary-item"},uP={class:"fct-admin-summary-item-title"},cP={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},AP={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},pP={key:0,style:{"margin-top":"20px"}},fP={class:"title"},mP={key:1},hP={class:"text-sm text-gray-500 mt-4"},_P={class:"capitalize"},gP={key:1},vP={class:"fct-admin-summary-item"},yP={class:"fct-admin-summary-item-title flex items-center gap-1"},bP=["href"],wP={class:"fct-product-url-slug-container"},CP={class:"filter-popover-item fct-admin-summary-popover-item"},BP={class:"filter-popover-title"},kP={class:"filter-popover-input-group"},xP={class:"fct-product-url-label"},SP=["href"],FP={class:"fct-product-url-slug"},EP={key:0,class:"fct-admin-summary-item"},UP={class:"fct-admin-summary-item-title"},$P={class:"fct-admin-summary-item-select"},DP={key:1,class:"fct-admin-summary-item"},QP={class:"fct-admin-summary-item-title"},IP={key:0,class:"fct-admin-summary-item-select"},TP={key:0,class:"mt-4 pt-4"},wA={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=V(""),n=V(""),s=V(""),o=V(!1),u=c("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">'+c("URL")+"</a>"),A=()=>t.product.variants.filter(v=>v.created_at).length>0,f=y=>{t.productEditModel.onChangeInputField("post_status",y),(y==="draft"||y==="publish")&&(o.value=!1)},m=()=>c("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."),g={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no"};return ge(()=>t.product.detail,y=>{y&&(!y.other_info||Object.keys(y.other_info).length===0)&&(t.product.detail.other_info={...g})},{immediate:!0}),Be(()=>{a.value=window.location.protocol,n.value=window.location.hostname,s.value=`${a.value}//${n.value}`}),(y,v)=>{const B=C("el-radio"),b=C("el-radio-group"),w=C("el-date-picker"),k=C("el-button"),S=C("el-popover"),M=C("el-input"),$=C("el-option"),F=C("el-select"),L=C("el-checkbox");return d(),_("div",rP,[l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>{var Q,T;return[r("ul",iP,[r("li",dP,[r("span",uP,[l(sa,{title:p(c)("Status"),content:m()},null,8,["title","content"])]),r("div",cP,[A()?(d(),E(S,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:i(()=>[A()?(d(),E(k,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:i(()=>[r("span",_P,h(e.product.post_status==="future"?p(c)("Scheduled"):e.product.post_status),1),l(W,{name:"ChevronUpDown"})]),_:1})):(d(),_("span",gP,h(p(Gt).headline(e.product.post_status)),1))]),default:i(()=>[r("div",AP,[l(b,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":v[0]||(v[0]=D=>e.product.post_status=D),onChange:f},{default:i(()=>[l(B,{value:"draft"},{default:i(()=>[R(h(p(c)("Draft")),1)]),_:1}),l(B,{value:"future"},{default:i(()=>[R(h(p(c)("Scheduled")),1)]),_:1}),l(B,{value:"private"},{default:i(()=>[R(h(p(c)("Private (Invisible except Admin)")),1)]),_:1}),l(B,{value:"publish"},{default:i(()=>[R(h(p(c)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(d(),_("div",pP,[r("h3",fP,h(p(c)("Scheduled Date")),1),l(w,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":v[1]||(v[1]=D=>e.product.post_date=D),type:"datetime",placeholder:p(c)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:v[2]||(v[2]=D=>{e.productEditModel.onChangeInputField("post_date",D)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(d(),_("div",mP,[r("p",hP,h(p(c)("Note: Private products are only visible to administrators but can be purchased via direct purchase link.")),1)])):x("",!0)])]),_:1})):x("",!0)])]),r("li",vP,[r("span",yP,[R(h(p(c)("URL Slug"))+" ",1),r("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[l(W,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,bP)]),r("div",wP,[l(S,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:i(()=>[l(k,{type:"primary",class:"is-tertiary el-button--x-small"},{default:i(()=>[r("span",null,h(e.product.post_name),1),l(W,{name:"ChevronUpDown"})]),_:1})]),default:i(()=>[r("div",CP,[r("h3",BP,h(p(c)("URL")),1),r("div",kP,[l(sa,{title:p(c)("Permalink"),content:p(u),hideAfter:300},null,8,["title","content"]),l(M,{placeholder:p(c)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":v[3]||(v[3]=D=>e.product.post_name=D),onInput:v[4]||(v[4]=D=>{e.productEditModel.onChangeInputField("post_name",D)})},null,8,["placeholder","modelValue"])]),r("div",xP,h(p(c)("View Product")),1),r("a",{class:"fct-product-url-slug-wrap",target:"_blank",href:e.product.view_url,rel:"external noreferrer noopener"},[r("span",FP,h(e.product.view_url),1),l(Za,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:p(c)("Copy Link")},null,8,["text","tooltipText"])],8,SP)])]),_:1})])]),((Q=e.product.detail)==null?void 0:Q.variation_type)==="simple_variations"?(d(),_("li",EP,[r("span",UP,[l(sa,{title:p(c)("Default Variant"),content:p(c)("Select the default variant that users will see pre-selected on the product page.")},null,8,["title","content"])]),r("div",$P,[l(F,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":v[5]||(v[5]=D=>e.product.detail.default_variation_id=D),placeholder:p(c)("Select Default Variant"),onChange:v[6]||(v[6]=D=>{e.productEditModel.onChangeInputField("default_variation_id",D)}),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(e.product.variants,D=>(d(),E($,{key:D.id,label:D.variation_title,value:D.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):x("",!0),((T=e.product.detail)==null?void 0:T.variation_type)==="simple_variations"?(d(),_("li",DP,[r("span",QP,[l(sa,{title:p(c)("Group By"),content:p(c)("Organize product variations by repeat interval (Monthly, Yearly) or payment term (One time, Subscription).")},null,8,["title","content"])]),e.product.detail?(d(),_("div",IP,[l(F,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":v[7]||(v[7]=D=>e.product.detail.other_info.group_pricing_by=D),placeholder:p(c)("Group by"),onChange:v[8]||(v[8]=D=>{e.productEditModel.onChangeInputField("group_pricing_by",D)})},{default:i(()=>[l($,{label:p(c)("Payment Term"),value:"payment_type"},null,8,["label"]),l($,{label:p(c)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),l($,{label:p(c)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):x("",!0)])):x("",!0)]),e.product.detail?(d(),_("div",TP,[l(L,{onChange:v[9]||(v[9]=D=>{e.productEditModel.onChangeInputField("sold_individually",D)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":v[10]||(v[10]=D=>e.product.detail.other_info.sold_individually=D),"true-value":"yes","false-value":"no"},{default:i(()=>[R(h(p(c)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"])])):x("",!0)]}),_:1})]),_:1})])}}},VP={class:"fct-product-media-wrap"},MP={class:"fct-admin-summary-item"},CA={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(d(),_("div",VP,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[r("div",MP,[l(Bs,{modelValue:e.product.gallery,"onUpdate:modelValue":a[0]||(a[0]=n=>e.product.gallery=n),compact:!1,title:t.$t("Product Gallery"),onChange:a[1]||(a[1]=n=>e.productEditModel.updateMedia("gallery",n))},null,8,["modelValue","title"])])]),_:1})]),_:1})]))}},LP={class:"fct-term-input-item"},RP={class:"el-tag__content"},OP=["innerHTML"],HP=["innerHTML"],PP={class:"pt-1.5 text-right"},NP={class:"relative w-3 h-3"},KP={class:"fct-term-add-input-wrap"},GP={__name:"TermInput",props:{modelValue:Array,taxonomy:Object,product_id:Number},emits:["update:modelValue","onChanged"],setup(e,{emit:t}){Qt().ctx;const a=e,n=t,s=V([]),o=V(!1),u=V(),A=V(""),f=V([]),m=V(""),g=V(!1);Be(()=>{s.value=a.modelValue,f.value=a.taxonomy.terms,ge(()=>a.taxonomy.terms,(L,Q)=>{f.value=L}),ge(()=>a.modelValue,(L,Q)=>{g.value=!0,s.value=L})});const y=L=>{L.stopPropagation(),L.preventDefault(),k()},v=()=>{g.value&&re.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(L=>{q.success(L.message),n("update:modelValue",s.value)}).catch(L=>{var Q;L.status_code=="422"?q.validationErrors(L):q.error((Q=L.data)==null?void 0:Q.message)}).finally(()=>{g.value=!1})},B=nu.debounce(L=>{w(L)},1200),b=()=>{n("update:modelValue",s.value)},w=L=>{g.value=!1,re.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:L}).then(Q=>{so(Q.message),n("update:modelValue",s.value)}).catch(Q=>{var T;Q.status_code=="422"?q.validationErrors(Q):q.error((T=Q.data)==null?void 0:T.message)}).finally(()=>{g.value=!1})};[...s.value];const k=()=>{g.value=!0,re.post("products/add-product-terms",{term:{name:A.value,taxonomy:a.taxonomy.name,parent:m.value}}).then(L=>{o.value=!1,A.value="",L.term_ids.forEach(function(Q,T){f.value.push({value:Q,label:L.names[T]}),s.value.push(Q)}),v()}).catch(L=>{})},S=()=>{o.value=!o.value,o.value&&ye(()=>{u.value.focus()})},M={categories:"Category",types:"Type"};j(()=>{let L=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(M).forEach(Q=>{L.toLowerCase().includes(Q)&&(L=L.replace(new RegExp(Q,"i"),M[Q]))}),L});const $=L=>{const Q=s.value.indexOf(L);Q>-1&&s.value.splice(Q,1),g.value=!1,B(L)},F=L=>{const Q=T=>{for(const D of T){if(D.value==L)return D.label;if(D.children&&D.children.length>0){const U=Q(D.children);if(U)return U}}return null};return Q(f.value)};return(L,Q)=>{const T=C("el-tag"),D=C("el-tree-select"),U=C("el-button"),I=C("el-input");return d(),_("div",LP,[l(D,{modelValue:s.value,"onUpdate:modelValue":Q[0]||(Q[0]=O=>s.value=O),data:f.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:b,onRemoveTag:Q[2]||(Q[2]=O=>{g.value=!1,p(B)(O)})},{tag:i(()=>[(d(!0),_(H,null,ee(s.value,(O,P)=>(d(),E(T,{key:P,closable:"",onClose:K=>$(O)},{default:i(()=>[r("span",RP,[r("span",{class:"el-select__tags-text",innerHTML:F(O)},null,8,OP)])]),_:2},1032,["onClose"]))),128))]),default:i(({data:O})=>[r("span",{innerHTML:O.label},null,8,HP)]),_:1},8,["modelValue","data"]),r("div",PP,[l(U,{text:"",onClick:S,size:"small"},{default:i(()=>[r("span",NP,[l(ra,{visible:o.value,fade:""},{default:i(()=>[l(W,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),l(ra,{visible:!o.value,fade:""},{default:i(()=>[l(W,{name:"Plus",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"])]),R(" "+h(p(c)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),l(ra,{visible:o.value,accordion:""},{default:i(()=>[r("div",KP,[l(I,{modelValue:A.value,"onUpdate:modelValue":Q[3]||(Q[3]=O=>A.value=O),ref_key:"inputRef",ref:u,onKeydown:Pa(y,["enter"])},null,8,["modelValue"]),l(U,{type:"info",plain:"",onClick:k,class:"el-button--x-small"},{default:i(()=>[R(h(p(c)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},jP={class:"fct-product-simple-wrap"},zP={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(d(),_("div",jP,[l(he,null,{default:i(()=>[l(Ce,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[(d(!0),_(H,null,ee(e.product.taxonomies,n=>(d(),_("div",{class:"fct-admin-summary-item",key:n.id},[r("h4",null,h(n.labels.name),1),l(GP,{product_id:e.product.ID,taxonomy:n,modelValue:e.product.product_terms[n.name],"onUpdate:modelValue":s=>e.product.product_terms[n.name]=s},null,8,["product_id","taxonomy","modelValue","onUpdate:modelValue"])]))),128))]),_:1})]),_:1})]))}};class YP extends Ya{constructor(){super(...arguments);Ee(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});Ee(this,"generateDownloadableVariationName",(a,n)=>{if(!a)return c("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 c("For all variants");const o=n.variants.reduce((A,f)=>(A[f.id]=f.variation_title,A),{}),u=s.map(A=>o[A]).filter(Boolean);return u.length===0?"--":u.length===1?u[0]:`${u[0]} +${u.length-1}`});Ee(this,"deleteDownloadableFile",(a,n)=>{$u.ofDelete(c("Deleting this asset will break the download link in existing purchase emails. To update the file, edit the asset instead of deleting it.")).then(()=>{re.delete(`products/${a}/delete`).then(()=>{q.success(c("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(n,1)}).catch(s=>{q.error(c("Failed To Delete"))})}).catch(()=>{})});Ee(this,"addDummyDownloadableFileForAllVariant",a=>{this.data.addModal.files=this.data.addModal.files.filter(n=>Object.values(n).every(s=>s!=null&&s!=="")),Object.values(this.generateVariantOptions(a)).forEach(n=>{n.id>0&&this.addDummyInsertableFile(n.id)})});Ee(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});Ee(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});Ee(this,"attachInsertableFiles",a=>{this.setSaving(!0),re.post(`products/${a}/sync-downloadable-files`,{downloadable_files:this.insertableFiles}).then(n=>{this.setDownloadableFiles(n.downloadable_files),this.syncToSourceProduct(),this.closeAddModal(),q.success(c("Variations Synced Successfully"))}).catch(n=>{this.setSaving(!1),n.status_code=="422"?this.setValidationError(n.data):q.error(c("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});Ee(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});Ee(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});Ee(this,"openEditModal",(a,n)=>{this.data.editModal.isCurrentlyEditing=!0,this.data.editModal.states[a].visible=!0,this.data.editModal.states[a].file=n,this.data.editModal.currentIndex=a});Ee(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()});Ee(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);Ee(this,"setValidationError",a=>{this.data.validationErrors=a});Ee(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));Ee(this,"clearValidationError",()=>{this.data.validationErrors={}});Ee(this,"deleteValidationError",a=>{this.data.validationErrors.hasOwnProperty(a)&&delete this.data.validationErrors[a]})}setDownloadableFiles(a,n=null){a=a.map(s=>{if(typeof s.settings=="string")try{s.settings=JSON.parse(s.settings)}catch{}return s}),this.data.downloadableFiles=a,n&&(this.data.sourceProduct=n)}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,n){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 o=n.variants.reduce((A,f)=>(A[f.id]=f.variation_title,A),{});return s.map(A=>o[A]).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 n=this.downloadableFileSchema;a&&(n.product_variation_id=[a]),this.data.addModal.files.push(n)}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(),n=this.getCurrentEditableIndex();!a||n<0||(this.setSaving(!0),re.put("products/"+a.id+"/update",a).then(s=>{this.closeEditModal(n),q.success(s.message),this.downloadableFiles[n]={...a},this.syncToSourceProduct()}).catch(s=>{s.hasOwnProperty("message")?q.error(s.message):q.error(c("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function qP(){return YP.init()}const WP={class:"fct-product-simple-wrap"},XP={class:"flex items-center gap-1 justify-between w-full"},JP={class:"fct-shipping-class-select-wrap relative"},ZP={class:"fct-select-option-with-leftright-value"},eN={class:"text-sm text-gray-500"},tN={class:"pt-1.5 text-right"},aN={key:0},nN={class:"mb-0 mt-2"},sN={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=V(Ke.get(t,"product.detail.other_info.shipping_class")),n=V(),s=V(!1),o=V(!1),u=V([]),A=Ie.get("admin_url")+"settings/shipping/shipping_classes",f=(b="")=>{o.value=!0,u.value=[],re.get("shipping/classes",{search:b}).then(w=>{u.value=w.shipping_classes.data,g()}).finally(()=>{o.value=!1})},m=b=>{f(),b.id&&(a.value=b.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const b=Ke.where(u.value,"id",a.value);n.value=Ke.get(b,"0")},y=()=>{s.value=!0},v=()=>{a.value&&re.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(b=>{q.success(b.message)}).catch(b=>{var w;b.status_code=="422"?q.validationErrors(b):q.error((w=b.data)==null?void 0:w.message)})},B=()=>{re.post("products/"+t.product.ID+"/shipping-class/remove").then(b=>{q.success(b.message)}).catch(b=>{var w;b.status_code=="422"?q.validationErrors(b):q.error((w=b.data)==null?void 0:w.message)})};return Be(()=>{f()}),(b,w)=>{const k=C("el-option"),S=C("el-select"),M=C("el-button");return d(),_("div",WP,[l(he,null,{default:i(()=>[l(Ce,{border_bottom:""},{default:i(()=>[r("div",XP,[l(sa,{title:p(c)("Shipping Class"),content:p(c)("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"]),r("a",{href:A,class:"focus:outline-none focus:shadow-none w-4 h-4 inline-flex items-center justify-center",target:"_blank"},[l(W,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),l(me,null,{default:i(()=>[r("div",JP,[l(S,{modelValue:a.value,"onUpdate:modelValue":w[0]||(w[0]=$=>a.value=$),remote:"",placeholder:p(c)("Search Shipping Class"),"remote-method":f,loading:o.value,filterable:"",clearable:"",onChange:v,onClear:B,"popper-class":"fct-shipping-class-select"},{default:i(()=>[(d(!0),_(H,null,ee(u.value,$=>(d(),E(k,{key:$.id,label:$.name,value:$.id},{default:i(()=>[r("div",ZP,[R(h($.name)+" ",1),r("span",eN,h($.type==="percentage"?$.cost+"%":p(Te).formatNumber($.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),r("div",tN,[l(M,{onClick:Xe(y,["stop"]),size:"small",text:""},{default:i(()=>[l(W,{name:"Plus",class:"w-3 h-3"}),R(" "+h(p(c)("Add Shipping Class")),1)]),_:1})])]),n.value?(d(),_("div",aN,[r("p",nN,h(p(c)("Cost: %s",n.value.type==="percentage"?n.value.cost+"%":p(Te).formatNumber(n.value.cost*100,!0))),1)])):x("",!0)]),_:1})]),_:1}),l(Dh,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=$=>s.value=$),onSaved:m},null,8,["modelValue"])])}}},lN={key:0,class:"fct-product-inventory-wrap"},oN={class:"fct-product-inventory-inner-wrap hide-on-mobile"},rN={class:"space-x-5"},iN={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"},dN={key:1},uN={class:"fct-card-header-title"},cN={class:"fct-product-inventory-pro-text"},AN={class:"m-0"},pN={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,n=Ie.get("app_config.isProActive"),s=V([]);Be(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){A()}),A()});const o=(f,m)=>{re.post(`products/save-bundle-info/${f}`,{bundle_child_ids:m}).then(g=>{q.success(c("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?q.validationErrors(g):q.error(g==null?void 0:g.message)})},u=V(!0),A=()=>{u.value=!0,re.get(`products/get-bundle-info/${a.product.ID}`).then(f=>{s.value=f,u.value=!1})};return(f,m)=>{const g=C("el-table-column"),y=C("el-table");return p(n)?(d(),_("div",lN,[l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Map bundle items")},null,8,["title"]),l(ra,{visible:!0,accordion:""},{default:i(()=>[l(me,{class:"px-0 pb-0"},{default:i(()=>[r("div",oN,[u.value?x("",!0):(d(),E(y,{key:0,data:s.value},{default:i(()=>[e.product.detail.variation_type==="simple_variations"?(d(),E(g,{key:0,label:p(c)("Title"),width:"140"},{default:i(v=>{var B;return[r("div",rN,[r("span",null,h(v.row.variation_title),1),((B=v.row.other_info)==null?void 0:B.payment_type)==="subscription"?(d(),_("span",iN,h(v.row.other_info.repeat_interval),1)):x("",!0)])]}),_:1},8,["label"])):x("",!0),l(g,{label:p(c)("Bundle Items"),width:"140"},{default:i(v=>[l(Ap,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":B=>v.row.bundle_child_ids=B,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:B=>{B||o(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})])):(d(),_("div",dN,[l(he,null,{default:i(()=>[l(Ce,{border_bottom:""},{title:i(()=>[r("h2",uN,[R(h(p(c)("Map bundle items"))+" ",1),l(W,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),l(me,null,{default:i(()=>[r("div",cN,[r("p",AN,h(p(c)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},fN={class:"fct-edit-product-wrapper fct-layout-width"},mN={class:"fct-btn-group sm"},hN={class:"hide-on-mobile"},_N={class:"show-on-mobile"},gN=["href"],vN={key:1,class:"single-page-body"},yN=["innerHTML"],bN={class:"fct-product-edit"},wN={class:"fct-product-main"},CN={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},BN={class:"fct-product-aside"},kN={class:"el-form el-form--default el-form--label-top"},xN={key:1},SN={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=V(),n=T7();let s=null;const o=qP();n.setProductDownloadableModel(o);const u=V(!1),A=B=>{var b,w;u.value=!1,n.setProduct(B),s=n.data.product,o.setDownloadableFiles(B.downloadable_files,B),s.gallery=((w=(b=s==null?void 0:s.detail)==null?void 0:b.gallery_image)==null?void 0:w.meta_value)??[],s.taxonomies=t.taxonomies,s.product_terms={},Object.keys(s.taxonomies).map(k=>{s.product_terms[k]=s[k]??[]}),n.saveSnapshot(),u.value=!0};V7().onSave(()=>{var B;n.data.metaValue=(B=a.value)==null?void 0:B.getFormStates(),n.update()});const m=ks();m.bind(["mod+s"],B=>{var b;B.preventDefault(),n.data.hasChange&&(o.isAddModalOpen()?o.attachInsertableFiles(t.product.ID):o.isEditModalOpen()?o.updateDownloadableFile():(n.data.metaValue=(b=a.value)==null?void 0:b.getFormStates(),n.update()))});const g=()=>{n.setHasChange(!0)},y=B=>{B==="delete"&&n.delete()};jd("triggerChange",g);const v=Gd("reload");return ge(()=>t.product,(B,b)=>{B!==b&&A(B)}),Be(()=>{A(t.product),n.setReloader(v);const B=document.querySelector(".fct-admin-product-header");B&&document.querySelector("#fluent_cart_plugin_app").prepend(B),n.addOnProductUpdatedListener("formreset",function(){var b;(b=a.value)==null||b.resetForms()})}),qA(()=>{m.unbind("mod+s")}),(B,b)=>{const w=C("el-button"),k=C("el-dropdown-item"),S=C("el-dropdown-menu"),M=C("el-dropdown");return d(),_("div",fN,[(d(),E(Rr,{to:"#fct-admin-product-header-buttons"},[r("div",mN,[l(M,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:i(()=>[l(S,null,{default:i(()=>[l(k,{command:"preview",class:"item-link"},{default:i(()=>[r("a",{href:p(n).viewUrl(),target:"_blank"},[l(W,{name:"Eye"}),R(" "+h(p(c)("Preview")),1)],8,gN)]),_:1}),l(k,{command:"delete",class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:1})]),_:1})]),default:i(()=>[l(w,null,{default:i(()=>[r("span",hN,[R(h(p(c)("More Actions"))+" ",1),l(W,{name:"ChevronDown"})]),r("span",_N,[l(W,{name:"More"})])]),_:1})]),_:1})])])),u.value?(d(),E(Bl,{key:0,isActive:p(n).data.hasChange?"is-active":"",loading:p(n).data.saving,onDiscard:p(n).discard,onSave:b[0]||(b[0]=()=>{var $;p(n).data.metaValue=($=a.value)==null?void 0:$.getFormStates(),p(n).update()}),saveButtonText:p(c)("Update"),"show-cmnd-icon":!0},null,8,["isActive","loading","onDiscard","saveButtonText"])):x("",!0),u.value?(d(),_("div",vN,[p(n).shouldShowShippingMethodAlert()?(d(),E(Na,{key:0,class:"mb-3",type:"warning",icon:"InformationFill"},{default:i(()=>[r("span",{innerHTML:p(c)("This Product has physical variants. Please %s",'<a href="'+p(n).shippingSettingsUrl()+'" target="_blank">'+p(c)("Add Shipping")+"</a>")},null,8,yN)]),_:1})):x("",!0),p(n).isInDraft()?(d(),E(Na,{key:1,class:"mb-3",type:"warning",icon:"InformationFill",content:p(c)("This product is currently in draft and cannot be sold to customers. Please publish the product to make it available for purchase.")},null,8,["content"])):x("",!0),r("div",bN,[r("div",wN,[l(sL,{product:p(s),productEditModel:p(n),reload:p(v)},null,8,["product","productEditModel","reload"]),r("div",CN,[(d(),E(wA,{key:p(n).data.discardKey,product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"])),l(CA,{product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"])]),l(kH,{product:p(s),productEditModel:p(n),productDownloadableModel:p(o)},null,8,["product","productEditModel","productDownloadableModel"]),l(VH,{product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"]),p(n).isBundleProduct()?(d(),E(pN,{key:0,product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"])):x("",!0),p(n).isBundleProduct()?x("",!0):(d(),E(oP,{key:1,product:p(s),productEditModel:p(n),productDownloadableModel:p(o)},null,8,["product","productEditModel","productDownloadableModel"]))]),r("div",BN,[r("div",kN,[(d(),E(wA,{class:"fct-hide-on-tablet",key:"aside-"+p(n).data.discardKey,product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"])),l(CA,{class:"fct-hide-on-tablet",product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"]),l(zP,{product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"]),p(n).hasPhysicalVariation()?(d(),E(sN,{key:0,product:p(s),productEditModel:p(n)},null,8,["product","productEditModel"])):x("",!0),p(s)?(d(),_("div",xN,[l(Sl,{ref_key:"dynamicTemplates",ref:a,filter:"single_product_page","widgets-query":{product_id:p(s).ID},data:{editableProduct:p(s)}},null,8,["widgets-query","data"])])):x("",!0)])])])])):x("",!0)])}}},FN={class:"fct-upgrade-path-drawer-content"},EN={class:"fct-form-group"},UN={class:"fct-form-group"},$N={class:"fct-form-group"},DN={class:"fct-form-group"},QN={__name:"AddModal",props:{pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,productId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{expose:t,emit:a}){const n=e,s=a,o=V(!1),u=()=>{o.value=!0},A={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},f=V({...A}),m=V({}),g=Ie.get("shop.currency_sign"),y=()=>{m.value={};const b={...f.value};(!Array.isArray(b.to_variants)||b.to_variants.length===0)&&(b.to_variants=[]),re.post(`products/${n.productId}/upgrade-path`,{...b}).then(w=>{q.success(w.message),f.value={...A},o.value=!1,s("pathGenerated")}).catch(w=>{if(m.value=w,w.message)return q.error(w.message)})},v=()=>f.value.from_variant?n.allVariants.filter(b=>{var w,k;return!((w=n.existingUpgradePathMap[f.value.from_variant])!=null&&w.includes(b.id)||(k=n.existingUpgradePathMap[f.value.from_variant])!=null&&k.includes(b.id.toString()))&&b.id!==f.value.from_variant}):[],B=b=>{let w=b==null?void 0:b.toString().replace(/^0+(?=\d)/,"");w===""&&(w="0"),parseInt(w)<0&&(w="0"),f.value.discount_amount=w};return t({openModal:u}),(b,w)=>{const k=C("el-option"),S=C("el-select"),M=C("el-checkbox"),$=C("el-input"),F=C("el-button"),L=C("el-drawer");return d(),E(L,{title:p(c)("Add Upgrade Path"),modelValue:o.value,"onUpdate:modelValue":w[5]||(w[5]=Q=>o.value=Q),onClosed:w[6]||(w[6]=()=>{o.value=!1,f.value={...A}}),"append-to-body":"",class:de(p(ke).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:i(()=>[l(F,{onClick:w[4]||(w[4]=Q=>o.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(F,{onClick:y,type:"primary"},{default:i(()=>[R(h(p(c)("Save")),1)]),_:1})]),default:i(()=>[r("div",FN,[r("div",EN,[r("label",null,h(p(c)("From Plan")),1),l(S,{modelValue:f.value.from_variant,"onUpdate:modelValue":w[0]||(w[0]=Q=>f.value.from_variant=Q),placeholder:p(c)("Select"),"popper-class":"fct-variation-select"},{default:i(()=>[(d(!0),_(H,null,ee(e.pathOptions,Q=>(d(),E(k,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:f.value.to_variants.includes(Q.id)},{default:i(()=>[l(Er,{variant:Q},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),m.value.hasOwnProperty("from_variant")?(d(),E(Pt,{key:0,"validation-errors":m.value,"field-key":"from_variant"},null,8,["validation-errors"])):x("",!0)]),r("div",UN,[r("label",null,h(p(c)("To Plan(s)")),1),l(S,{disabled:!f.value.from_variant,modelValue:f.value.to_variants,"onUpdate:modelValue":w[1]||(w[1]=Q=>f.value.to_variants=Q),multiple:"",placeholder:p(c)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:i(()=>[(d(!0),_(H,null,ee(v(),Q=>(d(),E(k,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:Q.id==f.value.from_variant},{default:i(()=>[l(Er,{variant:Q},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),m.value.hasOwnProperty("to_variants")?(d(),E(Pt,{key:0,"validation-errors":m.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),r("div",$N,[l(M,{"true-value":"1","false-value":"0",modelValue:f.value.is_prorate,"onUpdate:modelValue":w[2]||(w[2]=Q=>f.value.is_prorate=Q)},{default:i(()=>[R(h(p(c)("Prorate")),1)]),_:1},8,["modelValue"])]),r("div",DN,[r("label",null,h(p(c)("Discount Amount")),1),l($,{modelValue:f.value.discount_amount,"onUpdate:modelValue":w[3]||(w[3]=Q=>f.value.discount_amount=Q),type:"number",min:0,onInput:B},{prepend:i(()=>[R(h(p(g)),1)]),_:1},8,["modelValue"]),m.value.hasOwnProperty("discount_amount")?(d(),E(Pt,{key:0,"validation-errors":m.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["title","modelValue","class"])}}},IN={class:"fct-upgrade-path-drawer-content"},TN={class:"fct-form-group"},VN={class:"text"},MN={class:"fct-form-group"},LN={class:"fct-form-group"},RN={class:"fct-form-group"},BA={__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,n=V({...a.existingUpgradePathMap}),s=t,o=V(!1),u={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},A=V({...u}),f=V({}),m=()=>{f.value={};const B={...A.value};(!Array.isArray(B.to_variants)||B.to_variants.length===0)&&(B.to_variants=[]),re.post(`products/upgrade-path/${a.pathId}/update`,{...B}).then(b=>{q.success(b.message),A.value={...u},o.value=!1,s("pathGenerated")}).catch(b=>{if(f.value=b,b.message)return q.error(b.message)})},g=()=>A.value.from_variant?a.allVariants.filter(B=>{var b,w;return!((b=n[A.value.from_variant])!=null&&b.includes(B.id)||(w=n[A.value.from_variant])!=null&&w.includes(B.id.toString()))&&B.id.toString()!==A.value.from_variant.toString()}):[],y=()=>{A.value.from_variant=a.preSelectedFromVariant,A.value.is_prorate=a.preSelectedIsProrate,A.value.discount_amount=a.preSelectedDiscountAmount,A.value.to_variants=[];for(const B of a.preSelectedToVariants)A.value.to_variants.push(parseInt(B))},v=B=>{let b=B==null?void 0:B.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),A.value.discount_amount=b};return Ks(()=>{y()}),(B,b)=>{const w=C("el-option"),k=C("el-select"),S=C("el-checkbox"),M=C("el-input"),$=C("el-button"),F=C("el-drawer");return d(),_(H,null,[l(Oe,{size:"x-small",tag:"button",onClick:b[0]||(b[0]=()=>{o.value=!0})},{default:i(()=>[l(W,{name:"Edit"})]),_:1}),l(F,{modelValue:o.value,"onUpdate:modelValue":b[5]||(b[5]=L=>o.value=L),title:B.$t("Update Upgrade Path"),onClosed:b[6]||(b[6]=()=>{o.value=!1,A.value={...u}}),onOpen:y,"append-to-body":""},{footer:i(()=>[l($,{onClick:b[4]||(b[4]=L=>o.value=!1),size:"small"},{default:i(()=>[R(h(B.$t("Cancel")),1)]),_:1}),l($,{onClick:m,size:"small",type:"primary"},{default:i(()=>[R(h(B.$t("Update")),1)]),_:1})]),default:i(()=>[r("div",IN,[r("div",TN,[r("label",null,h(B.$t("From Plan")),1),r("div",VN,h(e.fromName),1)]),r("div",MN,[r("label",null,h(B.$t("To Plan(s)")),1),l(k,{disabled:!A.value.from_variant,modelValue:A.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=L=>A.value.to_variants=L),multiple:"",placeholder:"Select",clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(g(),L=>(d(),E(w,{key:L.id,label:L.variation_title,value:L.id,disabled:L.id==A.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue"]),f.value.hasOwnProperty("to_variants")?(d(),E(Pt,{key:0,"validation-errors":f.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),r("div",LN,[l(S,{class:"m-2","true-value":"1","false-value":"0",modelValue:A.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=L=>A.value.is_prorate=L)},{default:i(()=>[l(sa,{class:"flex items-center",title:B.$t("Prorate"),content:`The prorated amount, based on the remaining days, will be credited to the new plan. Upgrading from one-time payment, the full amount will be credited. |
| 163 |
`},null,8,["title"])]),_:1},8,["modelValue"])]),r("div",RN,[r("label",null,h(B.$t("Discount Amount")),1),l(M,{modelValue:A.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=L=>A.value.discount_amount=L),type:"number",min:"0",onInput:v},null,8,["modelValue"]),f.value.hasOwnProperty("discount_amount")?(d(),E(Pt,{key:0,"validation-errors":f.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},ON={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton"),o=C("el-table-column"),u=C("el-table");return d(),E(u,{data:[1,2,3,4,5]},{default:i(()=>[l(o,{label:p(c)("From Plan"),prop:"object_id",width:300},{default:i(()=>[l(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:i(()=>[l(n,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),l(o,{label:p(c)("To Plan"),width:200},{default:i(()=>[l(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:i(()=>[l(n,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),l(o,{label:p(c)("Discount Amount"),width:110},{default:i(()=>[l(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:i(()=>[l(n,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),l(o,{label:p(c)("Is Prorate"),width:100},{default:i(()=>[l(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:i(()=>[l(n,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),l(o,{width:100},{default:i(()=>[l(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:i(()=>[l(n,{varient:"p",class:"w-3/5"})]),_:1})]),_:1})]),_:1})}}},HN={class:"fct-upgrade-paths-wrap fct-layout-width"},PN={class:"grid gap-1"},NN={class:"text-system-dark dark:text-gray-50"},KN={class:"text-xs text-system-mid dark:text-gray-300"},GN={class:"flex gap-1 flex-wrap"},jN={key:0},zN={key:1},YN={class:"fct-btn-group sm"},qN={key:2,class:"fct-upgrade-paths-mobile"},WN={class:"from-plan"},XN={class:"title"},JN={class:"plan-title"},ZN={key:0,class:"plan-billing-summary"},eK={class:"to-plan"},tK={class:"title"},aK={class:"discount-amount"},nK={class:"title"},sK={key:0},lK={key:1},oK={class:"is-prorate"},rK={class:"title"},iK={class:"path-actions"},dK={class:"title"},uK={class:"fct-btn-group sm mt-3"},cK={key:0,class:"py-6 text-center"},AK={key:1},pK={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},fK={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},mK={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=j(()=>Ke.get(t.product,"detail.other_info.is_bundle_product")==="yes"),n=V(!1),s=V(null);V([]),V({status:"yes",paths:{}});const o=Ie.get("app_config.isProActive"),u=V([]),A=j(()=>t.product.variants.filter(k=>{var M;return(((M=B.value[k.id])==null?void 0:M.length)||0)<v.value-1})),f=k=>{m()},m=async()=>{n.value=!0,re.get(`products/${t.product_id}/upgrade-paths`).then(function(k){u.value=k.data,b()}).catch(function(k){}).finally(()=>{n.value=!1})},g=V({}),y=V({}),v=V(Ke.get(t.product,"variants",[]).length),B=V({}),b=()=>{t.product.variants.entries().forEach(([k,S])=>{g.value[S.id]=S.variation_title,y.value[S.id]=S.other_info.billing_summary}),B.value={},u.value.forEach(k=>{B.value.hasOwnProperty(k.object_id)?(B.value[k.object_id]=[...B.value[k.object_id].concat([...k.meta_value.to_variants])],B.value[k.object_id]=[...new Set(B.value[k.object_id])]):B.value[k.object_id]=[...k.meta_value.to_variants]})},w=k=>{re.delete(`products/upgrade-path/${k}/delete`).then(function(S){m(),q.success(S.message)}).catch(function(S){})};return Be(()=>{m();const k=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");k&&document.querySelector("#fluent_cart_plugin_app").prepend(k)}),(k,S)=>{const M=C("el-table-column"),$=C("el-tag"),F=C("el-table"),L=C("el-button");return d(),_(H,null,[r("div",HN,[l(p(he),null,{default:i(()=>[l(p(Ce),{title:p(c)("Upgrade Paths")},null,8,["title"]),p(o)&&!a.value?(d(),_(H,{key:0},[l(p(me),{class:"px-0 pb-0"},{default:i(()=>[n.value?(d(),E(ON,{key:0})):x("",!0),n.value?x("",!0):(d(),E(F,{key:1,class:"hide-on-mobile",data:u.value},{empty:i(()=>[R(h(p(c)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:i(()=>[l(M,{label:p(c)("From Plan"),prop:"object_id",width:300},{default:i(Q=>[r("div",PN,[r("div",NN,h(p(Ke).get(g.value,Q.row.object_id,"")),1),r("div",KN,h(p(Ke).get(y.value,Q.row.object_id,"")),1)])]),_:1},8,["label"]),l(M,{label:p(c)("To Plan"),width:200},{default:i(Q=>[r("div",GN,[(d(!0),_(H,null,ee(p(Ke).get(Q.row,"meta_value.to_variants",[]),T=>(d(),_(H,{key:T},[p(Ke).get(g.value,T)?(d(),E($,{key:0},{default:i(()=>[R(h(p(Ke).get(g.value,T)),1)]),_:2},1024)):x("",!0)],64))),128))])]),_:1},8,["label"]),l(M,{label:p(c)("Discount Amount"),width:110},{default:i(Q=>[Q.row.meta_value.discount_amount>0?(d(),_("span",jN,h(p(Ke).get(Q.row,"meta_value.discount_amount","0")),1)):(d(),_("span",zN,"--"))]),_:1},8,["label"]),l(M,{label:p(c)("Is Prorate"),width:100},{default:i(Q=>[R(h(p(Ke).get(Q.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),l(M,{width:100},{default:i(Q=>[r("div",YN,[l(BA,{pathId:Q.row.id,preSelectedToVariants:p(Ke).get(Q.row,"meta_value.to_variants",[]),preSelectedIsProrate:p(Ke).get(Q.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:p(Ke).get(Q.row,"meta_value.discount_amount","0"),pathOptions:A.value,"all-variants":e.product.variants,existingUpgradePathMap:B.value,fromName:p(Ke).get(g.value,Q.row.object_id,""),preSelectedFromVariant:Q.row.object_id,onPathGenerated:f},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),l(Oe,{size:"x-small",tag:"button",outline:"",onClick:()=>w(Q.row.id)},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),n.value?x("",!0):(d(),_("div",qN,[(d(!0),_(H,null,ee(u.value,(Q,T)=>(d(),_("div",{class:"fct-upgrade-paths-mobile-row",key:T},[r("div",WN,[r("div",XN,h(p(c)("From Plan"))+": ",1),r("div",null,[r("div",JN,h(p(Ke).get(g.value,Q.object_id,"")),1),p(Ke).get(y.value,Q.object_id,"")?(d(),_("div",ZN,h(p(Ke).get(y.value,Q.object_id,"")),1)):x("",!0)])]),r("div",eK,[r("div",tK,h(p(c)("To Plan"))+": ",1),(d(!0),_(H,null,ee(p(Ke).get(Q,"meta_value.to_variants",[]),D=>(d(),_(H,{key:D},[p(Ke).get(g.value,D)?(d(),E($,{key:0},{default:i(()=>[R(h(p(Ke).get(g.value,D)),1)]),_:2},1024)):x("",!0)],64))),128))]),r("div",aK,[r("div",nK,h(p(c)("Discount Amount"))+": ",1),Q.meta_value.discount_amount>0?(d(),_("span",sK,h(p(Ke).get(Q,"meta_value.discount_amount","0")),1)):(d(),_("span",lK,"--"))]),r("div",oK,[r("div",rK,h(p(c)("Is Prorate"))+": ",1),r("span",null,h(p(Ke).get(Q,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),r("div",iK,[r("div",dK,h(p(c)("Actions"))+": ",1),r("div",uK,[l(BA,{pathId:Q.id,preSelectedToVariants:p(Ke).get(Q,"meta_value.to_variants",[]),preSelectedIsProrate:p(Ke).get(Q,"meta_value.is_prorate","0"),preSelectedDiscountAmount:p(Ke).get(Q,"meta_value.discount_amount","0"),pathOptions:A.value,"all-variants":e.product.variants,existingUpgradePathMap:B.value,fromName:p(Ke).get(g.value,Q.object_id,""),preSelectedFromVariant:Q.object_id,onPathGenerated:f},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),l(Oe,{size:"x-small",tag:"button",outline:"",onClick:()=>w(Q.id)},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),u.value.length==0?(d(),_("div",cK,h(p(c)("No upgrade paths found.")),1)):x("",!0)]))]),_:1}),n.value?x("",!0):(d(),E(p(lu),{key:0},{default:i(()=>[A.value.length?(d(),E(L,{key:0,text:"",onClick:S[0]||(S[0]=()=>{var Q;return(Q=s.value)==null?void 0:Q.openModal()})},{default:i(()=>[l(W,{name:"Plus"}),R(" "+h(p(c)("Add Path")),1)]),_:1})):(d(),_("span",AK,h(p(c)("No more upgrade paths available")),1))]),_:1}))],64)):p(o)?a.value?(d(),_("div",fK,[l(at,{icon:"Empty/WebPage",title:p(c)("Upgrade Paths Temporarily Unavailable for Bundle Products"),text:p(c)("Upgrade paths feature is temporarily disabled for bundle products. This feature will be enabled in a future update.")},null,8,["title","text"])])):x("",!0):(d(),_("div",pK,[l(co,{class:"py-7.5",title:p(c)("Get access to this feature by Upgrading to FluentCart Pro"),text:p(c)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))]),_:1})]),a.value?x("",!0):(d(),E(QN,{key:0,productId:e.product.ID,onPathGenerated:f,ref_key:"addModalRef",ref:s,pathOptions:A.value,"all-variants":e.product.variants,existingUpgradePathMap:B.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},hK={name:"ProductIntegrations",components:{IconButton:Oe,Empty:at,DynamicIcon:W,CardFooter:lu,CardBody:me,CardHeader:Ce,CardContainer:he},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 Gt},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:au,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,n={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}`,n).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})}}},_K={class:"fct-integration-settings fct-layout-width"},gK={key:0,class:"integration-actions"},vK={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},yK={class:"text-sm"},bK={key:1,class:"fct-integrations-table-wrap"},wK={class:"fct-integration-logo-wrap"},CK=["src","alt"],BK={class:"text-xs text-gray-700"},kK=["onClick"],xK={class:"fct-event-triggers"},SK={class:"fct-event-triggers"},FK={class:"fct-btn-group sm"},EK={class:"fct-integration-table-footer"},UK=["href"],$K={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function DK(e,t,a,n,s,o){const u=C("DynamicIcon"),A=C("el-button"),f=C("el-dropdown-item"),m=C("el-dropdown-menu"),g=C("el-dropdown"),y=C("CardHeader"),v=C("el-skeleton"),B=C("el-switch"),b=C("el-table-column"),w=C("el-tag"),k=C("el-popover"),S=C("IconButton"),M=C("el-tooltip"),$=C("Empty"),F=C("el-table"),L=C("CardBody"),Q=C("CardContainer"),T=Ca("loading");return d(),_("div",_K,[l(Q,null,{default:i(()=>[l(y,{title:e.$t("Product Integrations")},{action:i(()=>[o.hasActiveModules?(d(),_("div",gK,[l(g,{onCommand:o.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:i(()=>[l(m,null,{default:i(()=>[(d(!0),_(H,null,ee(s.available_integrations,(D,U)=>(d(),E(f,{key:U,command:U},{default:i(()=>[R(h(D.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:i(()=>[l(A,{type:"info",plain:"",size:"small"},{default:i(()=>[R(h(e.$t("Add Integration"))+" ",1),l(u,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title"]),l(L,{class:"px-0 pb-0 pt-4"},{default:i(()=>[l(v,{class:"px-5 pb-5",loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?x("",!0):(d(),_(H,{key:0},[o.hasActiveModules?(d(),_("div",bK,[Dt((d(),E(F,{data:s.feeds},{empty:i(()=>[l($,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:i(()=>[l(b,{label:e.$t("Status"),width:90},{default:i(D=>[l(B,{"active-value":"yes","inactive-value":"no",onChange:U=>o.handleActive(D.row),modelValue:D.row.enabled,"onUpdate:modelValue":U=>D.row.enabled=U},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),l(b,{width:160,label:e.$t("Integration")},{default:i(D=>{var U,I;return[r("div",wK,[(U=s.available_integrations[D.row.provider])!=null&&U.logo?(d(),_("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:s.available_integrations[D.row.provider].logo,alt:D.row.provider},null,8,CK)):x("",!0),r("span",BK,h(((I=s.available_integrations[D.row.provider])==null?void 0:I.title)||D.row.provider),1)])]}),_:1},8,["label"]),l(b,{"min-width":150,label:e.$t("Title")},{default:i(D=>[r("a",{class:"fct-action-link-btn",onClick:Xe(U=>o.edit(D.row),["prevent"]),href:"#"},h(D.row.name),9,kK)]),_:1},8,["label"]),l(b,{"min-width":150,label:e.$t("Triggers")},{default:i(D=>[r("div",xK,[(d(!0),_(H,null,ee((D.row.feed.event_trigger||[]).slice(0,2),(U,I)=>(d(),E(w,{key:U},{default:i(()=>[l(u,{name:"Trigger"}),R(" "+h(o.Str.headline(U)),1)]),_:2},1024))),128)),(D.row.feed.event_trigger||[]).length>2?(d(),E(k,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:i(()=>[l(w,{type:"info"},{default:i(()=>[R(" +"+h((D.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:i(()=>[r("div",SK,[(d(!0),_(H,null,ee((D.row.feed.event_trigger||[]).slice(2),(U,I)=>(d(),E(w,{key:U+I},{default:i(()=>[l(u,{name:"Trigger"}),R(" "+h(o.Str.headline(U)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),l(b,{width:90},{default:i(D=>[r("div",FK,[l(M,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(S,{tag:"button",onClick:U=>o.edit(D.row),size:"x-small",hover:"primary"},{default:i(()=>[l(u,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),l(M,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(S,{tag:"button",size:"x-small",onClick:U=>o.remove(D.row.id,D),hover:"danger"},{default:i(()=>[l(u,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[T,s.loading]])])):(d(),_("div",vK,[r("p",yK,h(e.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),l(A,{tag:"a",type:"primary",href:s.all_module_config_url},{default:i(()=>[R(h(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),r("div",EK,[r("a",{href:s.all_module_config_url},h(e.$t("Check Global Integration Settings")),9,UK),r("a",$K,h(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const kA=He(hK,[["render",DK]]),QK={name:"SingleIntegration",components:{CardFooter:lu,CardBody:me,CardHeader:Ce,CardContainer:he},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((n,s)=>n[s],this.formData.values);return this.compare(a,e.dependency.operator,e.dependency.value)}return!0}}},IK={class:"fct-integration-settings fct-layout-width"};function TK(e,t,a,n,s,o){const u=C("el-button"),A=C("CardHeader"),f=C("el-input"),m=C("el-form-item"),g=C("el-option"),y=C("el-select"),v=C("el-form"),B=C("CardBody"),b=C("CardContainer");return d(),_("div",IK,[l(b,null,{default:i(()=>[l(A,{border_bottom:"",title:s.integration_id?e.$t("Edit Integration"):e.$t("Add Integration")},{action:i(()=>[l(u,{onClick:o.saveIntegration,type:"primary",loading:s.saving},{default:i(()=>[R(h(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),l(B,null,{default:i(()=>[l(v,{"label-position":"top",model:s.formData.values,class:"integration-form"},{default:i(()=>[l(m,{label:e.$t("Integration Name"),required:""},{default:i(()=>[l(f,{modelValue:s.formData.values.name,"onUpdate:modelValue":t[0]||(t[0]=w=>s.formData.values.name=w),placeholder:"Enter a name for this integration"},null,8,["modelValue"])]),_:1},8,["label"]),s.integration_id?x("",!0):(d(),E(m,{key:0,label:e.$t("Integration Type")},{default:i(()=>[l(y,{modelValue:s.formData.values.integrationName,"onUpdate:modelValue":t[1]||(t[1]=w=>s.formData.values.integrationName=w),disabled:"",class:"fct-select"},{default:i(()=>[(d(!0),_(H,null,ee(s.formData.fields.integrationName.options,w=>(d(),E(g,{key:w.value,label:w.label,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(d(!0),_(H,null,ee(s.formData.fields,(w,k)=>(d(),_(H,{key:k},[k!=="integrationName"&&o.dependancyPass(w)?(d(),E(m,{key:0,label:w.label},{default:i(()=>[w.type==="text"?(d(),E(f,{key:0,modelValue:s.formData.values[k],"onUpdate:modelValue":S=>s.formData.values[k]=S,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="select"?(d(),E(y,{key:1,modelValue:s.formData.values[k],"onUpdate:modelValue":S=>s.formData.values[k]=S,placeholder:w.placeholder,class:"fct-select"},{default:i(()=>[(d(!0),_(H,null,ee(w.options,S=>(d(),E(g,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="textarea"?(d(),E(f,{key:2,type:"textarea",modelValue:s.formData.values[k],"onUpdate:modelValue":S=>s.formData.values[k]=S,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),_:2},1032,["label"])):x("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const VK=He(QK,[["render",TK],["__scopeId","data-v-07be2edd"]]),MK={class:"fct-reason-dropdown-wrap"},LK={class:"fct-reason-label"},fm=Object.assign({name:"ReasonDropdown"},{__name:"ReasonDropdown",props:{modelValue:{type:String,default:""}},emits:["update:modelValue","update:customReason"],setup(e,{expose:t,emit:a}){const n=e,s=a,o=V(n.modelValue),u=V("");ge(()=>n.modelValue,m=>{o.value=m});const A=()=>{s("update:modelValue",o.value),o.value==="other"&&s("update:customReason",u.value)},f=m=>{o.value=m,A()};return t({getValue:()=>o.value,getCustomReason:()=>u.value,setValue:m=>f(m),setCustomReason:m=>{u.value=m}}),(m,g)=>{const y=C("el-option"),v=C("el-select"),B=C("el-input");return d(),_("div",MK,[r("label",LK,h(p(c)("Reason")),1),l(v,{modelValue:o.value,"onUpdate:modelValue":g[0]||(g[0]=b=>o.value=b),placeholder:p(c)("Select reason"),class:"w-full",onChange:A},{default:i(()=>[l(y,{label:p(c)("Received Stock"),value:"received"},null,8,["label"]),l(y,{label:p(c)("Damage/Loss"),value:"damage"},null,8,["label"]),l(y,{label:p(c)("Return/Refund"),value:"return"},null,8,["label"]),l(y,{label:p(c)("Count Correction"),value:"correction"},null,8,["label"]),l(y,{label:p(c)("Inventory Transfer"),value:"transfer"},null,8,["label"]),l(y,{label:p(c)("Other"),value:"other"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),l(ra,{visible:o.value==="other",accordion:"",duration:300},{default:i(()=>[l(B,{modelValue:u.value,"onUpdate:modelValue":g[1]||(g[1]=b=>u.value=b),type:"textarea",rows:3,placeholder:p(c)("Please describe the reason"),class:"fct-custom-reason-textarea",onInput:A},null,8,["modelValue","placeholder"])]),_:1},8,["visible"])])}}}),RK={class:"fct-adjust-by-wrap"},OK={class:"fct-adjust-by-row"},HK={class:"fct-adjust-by-col"},PK={class:"title"},NK={class:"fct-adjust-by-col"},KK={class:"title"},GK={class:"fct-stock-info"},jK={class:"fct-adjust-reason-wrap"},zK={class:"fct-adjust-by-action"},mm=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,n=t,s=V(!1),o=V(0),u=V(a.variant.total_stock),A=V(""),f=V(""),m=V(null),g=V(null);ge(s,w=>{w&&ye(()=>{var k,S,M;(k=m.value)==null||k.focus(),(M=(S=m.value)==null?void 0:S.select)==null||M.call(S)})});const y=()=>{const w=o.value||0;let S=(parseInt(a.variant.total_stock)||0)+parseInt(w);u.value=S<0?0:S},v=()=>{const w=u.value||0,k=parseInt(a.variant.total_stock)||0;o.value=parseInt(w)-k},B=()=>{o.value=0,u.value=a.variant.total_stock,A.value="",f.value="",s.value=!1},b=()=>{n("save",{variant:a.variant,newStock:u.value,adjustedQuantity:o.value,reason:A.value,customReason:A.value==="other"?f.value:""}),s.value=!1,B()};return(w,k)=>{const S=C("el-input"),M=C("el-button"),$=C("el-popover");return d(),E($,{visible:s.value,"popper-class":"fct-stock-dropdown fct-inventory-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:i(()=>[r("div",{class:"fct-stock-adjuster-trigger",onClick:k[4]||(k[4]=F=>s.value=!s.value)},[l(W,{name:"Configuration"})])]),default:i(()=>[r("div",RK,[r("div",OK,[r("div",HK,[r("span",PK,h(p(c)("Adjust by")),1),l(S,{ref_key:"adjustByInput",ref:m,size:"small",placeholder:p(c)("Quantity"),type:"number",modelValue:o.value,"onUpdate:modelValue":k[0]||(k[0]=F=>o.value=F),modelModifiers:{number:!0},onInput:y},null,8,["placeholder","modelValue"])]),r("div",NK,[r("span",KK,h(p(c)("New Stock")),1),l(S,{size:"small",placeholder:p(c)("New Stock"),type:"number",modelValue:u.value,"onUpdate:modelValue":k[1]||(k[1]=F=>u.value=F),modelModifiers:{number:!0},onInput:v},null,8,["placeholder","modelValue"])])]),l(ra,{visible:!!o.value,accordion:""},{default:i(()=>[r("div",GK,[k[5]||(k[5]=R(" (Original quantity: ",-1)),r("strong",null,h(e.variant.total_stock),1),k[6]||(k[6]=R(") ",-1))])]),_:1},8,["visible"]),r("div",jK,[l(fm,{ref_key:"reasonDropdownRef",ref:g,modelValue:A.value,"onUpdate:modelValue":k[2]||(k[2]=F=>A.value=F),"onUpdate:customReason":k[3]||(k[3]=F=>f.value=F)},null,8,["modelValue"])]),r("div",zK,[l(M,{size:"small",type:"info",soft:"",onClick:B},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(M,{size:"small",type:"primary",onClick:b,disabled:!A.value},{default:i(()=>[R(h(p(c)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}}),YK={class:"fct-inventory-row"},qK={width:"50"},WK={class:"flex items-center gap-1"},XK=["src","alt"],JK=["src","alt"],ZK={class:"fct-inventory-product-content"},eG={class:"fct-inventory-product-title"},tG={key:0},aG={key:0},nG={key:1,class:"text-system-mid dark:text-gray-300"},sG={key:1},lG={key:2},oG={key:3},rG=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 o,u,A,f;const n=C("el-checkbox"),s=C("el-input");return d(),_("tr",YK,[r("td",qK,[r("div",WK,[l(n,{"model-value":e.isRowSelected(e.row.variants[0]),onChange:a[0]||(a[0]=m=>e.toggleRowSelection(e.row.variants[0]))},null,8,["model-value"])])]),r("td",null,[r("div",{class:"fct-inventory-product-info cursor-pointer",onClick:a[1]||(a[1]=m=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(d(),_("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,XK)):(d(),_("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,JK)),r("div",ZK,[r("span",eG,h(e.row.post_title),1)])])]),(o=e.inventoryTable)!=null&&o.isColumnVisible("sku")?(d(),_("td",tG,[e.row.variants[0].sku?(d(),_("span",aG,h(e.row.variants[0].sku),1)):(d(),_("span",nG,h(p(c)("No SKU")),1))])):x("",!0),r("td",null,[l(s,{modelValue:e.row.variants[0].total_stock,"onUpdate:modelValue":a[3]||(a[3]=m=>e.row.variants[0].total_stock=m),class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:i(()=>[l(mm,{variant:e.row.variants[0],onSave:a[2]||(a[2]=m=>t.$emit("stock-save",m))},null,8,["variant"])]),_:1},8,["modelValue"])]),(u=e.inventoryTable)!=null&&u.isColumnVisible("available")?(d(),_("td",sG,[r("span",null,h(e.row.variants[0].available),1)])):x("",!0),(A=e.inventoryTable)!=null&&A.isColumnVisible("on_hand")?(d(),_("td",lG,[r("span",null,h(e.row.variants[0].on_hold),1)])):x("",!0),(f=e.inventoryTable)!=null&&f.isColumnVisible("committed")?(d(),_("td",oG,[r("span",null,h(e.row.variants[0].committed),1)])):x("",!0),r("td",null,[l(Oe,{tag:"button",size:"small",onClick:a[4]||(a[4]=m=>t.$emit("open-history",e.row.variants[0]))},{default:i(()=>a[5]||(a[5]=[r("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[r("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]})])])}}}),iG={class:"fct-inventory-row fct-inventory-parent-row"},dG={width:"50"},uG={class:"fct-inventory-row-selection"},cG=["src","alt"],AG=["src","alt"],pG={class:"fct-inventory-product-content"},fG={class:"fct-inventory-product-title"},mG={key:0},hG={class:"!pl-5"},_G={key:1},gG={key:2},vG={key:3},yG={class:"fct-inventory-variant-item"},bG={class:"fct-inventory-product-info"},wG=["src","alt"],CG=["src","alt"],BG={class:"fct-inventory-product-content"},kG={key:0},xG={key:1},SG={key:2},FG={key:3},EG=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){ja();const t=e,a=V(!0),n=j(()=>a.value);ge(()=>t.expanded,B=>{a.value=B});const s=()=>{a.value=!a.value},o=()=>n.value,u=j(()=>{var B;return((B=t.row.variants)==null?void 0:B.reduce((b,w)=>b+(w.total_stock||0),0))||0}),A=j(()=>{var B;return((B=t.row.variants)==null?void 0:B.reduce((b,w)=>b+(w.available||0),0))||0}),f=j(()=>{var B;return((B=t.row.variants)==null?void 0:B.reduce((b,w)=>b+(w.on_hold||0),0))||0}),m=j(()=>{var B;return((B=t.row.variants)==null?void 0:B.reduce((b,w)=>b+(w.committed||0),0))||0}),g=()=>{const B=t.row.variants||[];return B.length>0&&B.every(b=>t.isRowSelected(b))},y=()=>{const B=t.row.variants||[],b=B.filter(w=>t.isRowSelected(w)).length;return b>0&&b<B.length},v=B=>{var b;(b=t.row.variants)==null||b.forEach(w=>{B!==t.isRowSelected(w)&&t.toggleRowSelection(w)})};return(B,b)=>{var M,$,F,L;const w=C("el-checkbox"),k=C("router-link"),S=C("el-input");return d(),_(H,null,[r("tr",iG,[r("td",dG,[r("div",uG,[l(w,{"model-value":g(),indeterminate:y(),onChange:v,onClick:b[0]||(b[0]=Xe(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),r("div",{onClick:b[1]||(b[1]=Q=>s()),class:"fct-inventory-row-toggle"},[l(W,{name:o()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),r("td",null,[r("div",{class:"fct-inventory-product-info cursor-pointer",onClick:b[2]||(b[2]=Q=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(d(),_("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,cG)):(d(),_("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,AG)),r("div",pG,[r("span",fG,h(e.row.post_title),1)])])]),(M=e.inventoryTable)!=null&&M.isColumnVisible("sku")?(d(),_("td",mG,[Dt(r("span",null,"--",512),[[Rn,!o()]])])):x("",!0),r("td",hG,[Dt(r("span",null,h(u.value),513),[[Rn,!o()]])]),($=e.inventoryTable)!=null&&$.isColumnVisible("available")?(d(),_("td",_G,[Dt(r("span",null,h(A.value),513),[[Rn,!o()]])])):x("",!0),(F=e.inventoryTable)!=null&&F.isColumnVisible("on_hand")?(d(),_("td",gG,[Dt(r("span",null,h(f.value),513),[[Rn,!o()]])])):x("",!0),(L=e.inventoryTable)!=null&&L.isColumnVisible("committed")?(d(),_("td",vG,[Dt(r("span",null,h(m.value),513),[[Rn,!o()]])])):x("",!0),b[4]||(b[4]=r("td",null,null,-1))]),(d(!0),_(H,null,ee(e.row.variants,Q=>{var T,D,U,I,O;return Dt((d(),_("tr",{key:`child-${Q.id}`,class:"fct-inventory-child-row"},[b[6]||(b[6]=r("td",null,null,-1)),r("td",null,[r("div",yG,[l(w,{"model-value":e.isRowSelected(Q),onChange:P=>e.toggleRowSelection(Q)},null,8,["model-value","onChange"]),r("div",bG,[Q.thumbnail!==null?(d(),_("img",{key:0,src:Q.thumbnail,alt:Q.variation_title,class:"inventory-thumbnail"},null,8,wG)):(d(),_("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:Q.variation_title},null,8,CG)),r("div",BG,[l(k,{to:`/products/${Q.post_id}`,class:"fct-inventory-product-title"},{default:i(()=>[R(h(Q.variation_title),1)]),_:2},1032,["to"])])])])]),(T=e.inventoryTable)!=null&&T.isColumnVisible("sku")?(d(),_("td",kG,h(Q.sku),1)):x("",!0),r("td",null,[l(S,{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:i(()=>[l(mm,{variant:Q,onSave:b[3]||(b[3]=P=>B.$emit("stock-save",P))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(D=e.inventoryTable)!=null&&D.isColumnVisible("available")?(d(),_("td",xG,h(Q.available),1)):x("",!0),(U=e.inventoryTable)!=null&&U.isColumnVisible("on_hand")?(d(),_("td",SG,h(Q.on_hold),1)):x("",!0),(I=e.inventoryTable)!=null&&I.isColumnVisible("committed")?(d(),_("td",FG,h(Q.committed),1)):x("",!0),r("td",null,[l(Oe,{tag:"button",size:"small",onClick:P=>B.$emit("open-history",Q)},{default:i(()=>b[5]||(b[5]=[r("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[r("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"])])])),[[Rn,((O=e.row.variants)==null?void 0:O.length)>0&&o()]])}),128))],64)}}}),UG={class:"fct-adjustment-header"},$G={class:"fct-adjustment-product-name"},DG={key:0,class:"fct-adjustment-timeline-wrap"},QG={key:0,class:"fct-adjustment-timeline"},IG={class:"fct-timeline-node"},TG={class:"fct-timeline-content"},VG={class:"fct-timeline-header"},MG={class:"fct-timeline-time"},LG={class:"fct-stock-flow"},RG={class:"fct-stock-flow-item"},OG={class:"fct-stock-entry"},HG={class:"fct-stock-label"},PG={class:"fct-stock-value"},NG={class:"fct-stock-entry new-stock-entry"},KG={class:"fct-stock-label"},GG={class:"fct-stock-value"},jG={class:"fct-stock-flow-item"},zG={class:"fct-stock-label"},YG={key:0,class:"fct-custom-reason-section"},qG={class:"fct-stock-label"},WG={class:"fct-custom-reason-text"},XG={key:1,class:"fct-timeline-empty"},JG={key:1,class:"fct-timeline-loading"},ZG=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=V(!1),n=V(!1),s=V({id:null,name:""}),o=V([]),u=()=>{a.value=!1,o.value=[]},A=y=>{s.value=y,a.value=!0,f(y.id)},f=y=>{y&&(n.value=!0,re.get("inventory/adjustment-history",{variant_id:y}).then(v=>{o.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{q.error(c("Failed to load adjustment history"))}).finally(()=>{n.value=!1}))},m=y=>y>0?"positive":y<0?"negative":"",g=y=>y>0?`+${y}`:`${y}`;return t({openHistory:A}),(y,v)=>{const B=C("el-drawer");return d(),E(B,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=b=>a.value=b),title:p(c)("Stock Adjustment History"),onClose:u},{default:i(()=>[r("div",UG,[r("h3",$G,h(s.value.name),1)]),n.value?(d(),_("div",JG,[r("p",null,h(p(c)("Loading adjustment history...")),1)])):(d(),_("div",DG,[o.value.length>0?(d(),_("div",QG,[(d(!0),_(H,null,ee(o.value,(b,w)=>(d(),_("div",{key:w,class:"fct-timeline-item"},[r("div",IG,[r("span",{class:de(["fct-node-dot",`node-${b.reason}`])},null,2)]),r("div",TG,[r("div",VG,[r("span",MG,[l($a,{"date-time":b.created_at},null,8,["date-time"]),R(" (by "+h(b.user_name)+") ",1)]),r("span",{class:de(["fct-timeline-reason-badge",`badge-${b.reason}`])},h(b.reason_label),3)]),r("div",LG,[r("div",RG,[r("div",OG,[r("span",HG,h(p(c)("Previous Stock:")),1),r("span",PG,h(b.old_stock),1)]),v[1]||(v[1]=r("span",{class:"fct-stock-arrow"},"→",-1)),r("div",NG,[r("span",KG,h(p(c)("New Stock:")),1),r("span",GG,h(b.new_stock),1)])]),r("div",jG,[r("span",zG,h(p(c)("Change:")),1),r("span",{class:de(["fct-stock-value fct-stock-change",m(b.change)])},h(g(b.change))+" "+h(p(c)("units")),3)]),b.reason==="other"&&b.custom_reason?(d(),_("div",YG,[r("span",qG,h(p(c)("Details:")),1),r("p",WG,h(b.custom_reason),1)])):x("",!0)])])]))),128))])):(d(),_("div",XG,[l(at,{icon:"Empty/ListView","has-dark":!0,text:p(c)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),ej={class:"fct-bulk-modal-content"},tj={class:"fct-inventory-mode-selection"},aj={class:"fct-inventory-input-section"},nj={key:0,class:"fct-inventory-mode-hint"},sj={class:"fct-inventory-selected-items"},lj={class:"fct-inventory-selected-items-count"},oj={key:0,class:"fct-inventory-selected-items-preview"},rj={class:"fct-inventory-selected-item-header"},ij={class:"variant-title"},dj={class:"total-stock"},uj={class:"fct-inventory-selected-item-list"},cj={class:"fct-inventory-selected-item-info"},Aj={class:"fct-inventory-selected-item-title"},pj=["innerHTML"],fj={class:"fct-inventory-selected-item-stock-action"},mj={class:"total-stock"},hj={class:"stock-arrow"},_j={class:"bulk-stock-value"},gj={class:"fct-inventory-adjustment-reason"},vj={class:"dialog-footer"},yj=Object.assign({name:"InventoryBulkAdjustModal"},{__name:"InventoryBulkAdjustModal",props:{selectedItems:{type:Array,required:!0}},emits:["bulk-update-success","close"],setup(e,{expose:t,emit:a}){const n=e,s=a,o=V(!1),u=V("add"),A=V(null),f=V(""),m=V(""),g=k=>u.value==="add"?k.total_stock+A.value:A.value,y=k=>A.value!==null&&A.value!==""&&g(k)!==k.total_stock,v=()=>{b(),o.value=!1},B=()=>{const k={mode:u.value,value:A.value,reason:f.value,customReason:f.value==="other"?m.value:"",items:n.selectedItems.map(S=>({id:S.id,post_id:S.post_id}))};re.post("inventory/bulk-update",k).then(()=>{q.success(c("Stock updated successfully")),b(),o.value=!1,s("bulk-update-success")}).catch(S=>{var M;S.status_code===422?q.validationErrors(S):q.error(((M=S.data)==null?void 0:M.message)||c("Failed to update stock"))})},b=()=>{A.value=null,u.value="add",f.value="",m.value=""};return t({openModal:()=>{b(),o.value=!0}}),(k,S)=>{const M=C("el-radio"),$=C("el-radio-group"),F=C("el-input"),L=C("el-button"),Q=C("el-dialog");return d(),E(Q,{modelValue:o.value,"onUpdate:modelValue":S[4]||(S[4]=T=>o.value=T),title:p(c)("Update Stocks")},{default:i(()=>{var T;return[r("div",ej,[r("div",tj,[l($,{modelValue:u.value,"onUpdate:modelValue":S[0]||(S[0]=D=>u.value=D),class:"fct-mode-radio-group"},{default:i(()=>[l(M,{value:"add"},{default:i(()=>[R(h(p(c)("Increase Stock")),1)]),_:1}),l(M,{value:"set"},{default:i(()=>[R(h(p(c)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),r("div",aj,[l(sa,{title:u.value==="add"?p(c)("Increase Stock by"):p(c)("Exact new stock"),content:u.value==="add"?p(c)("Increase stock by value (e.g. 10 + 5 = 15)"):p(c)("Set stock to exact value (e.g. 10 → 20)")},null,8,["title","content"]),l(F,{modelValue:A.value,"onUpdate:modelValue":S[1]||(S[1]=D=>A.value=D),modelModifiers:{number:!0},type:"number",placeholder:u.value==="add"?p(c)("Enter amount to add"):p(c)("Enter exact stock value")},null,8,["modelValue","placeholder"]),u.value==="set"?(d(),_("div",nj,[l(W,{name:"Warning"}),R(" "+h(p(c)("Replaces current inventory")),1)])):x("",!0)]),r("div",sj,[r("div",lj,h(e.selectedItems.length)+" "+h(p(c)("variants will be changed:")),1),(T=e.selectedItems)!=null&&T.length?(d(),_("div",oj,[r("div",rj,[r("span",ij,h(p(c)("Variant")),1),r("span",dj,h(p(c)("Stock Change")),1)]),r("ul",uj,[(d(!0),_(H,null,ee(e.selectedItems,D=>(d(),_("li",{key:D.id},[r("div",cj,[r("span",Aj,h(D.variation_title),1),r("span",{class:"fct-inventory-selected-item-price",innerHTML:D.formatted_total},null,8,pj)]),r("div",fj,[r("span",mj,h(D.total_stock),1),y(D)?(d(),_(H,{key:0},[r("span",hj,[l(W,{name:"ArrowRight"})]),r("span",_j,h(g(D)),1)],64)):x("",!0)])]))),128))])])):x("",!0)]),r("div",gj,[l(fm,{modelValue:f.value,"onUpdate:modelValue":S[2]||(S[2]=D=>f.value=D),"onUpdate:customReason":S[3]||(S[3]=D=>m.value=D)},null,8,["modelValue"])]),r("div",vj,[l(L,{onClick:v},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(L,{type:"primary",onClick:B,disabled:!f.value},{default:i(()=>[R(h(p(c)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),bj={class:"fct-advanced-inventory-table"},wj={class:"fct-inventory-toolbar-wrap"},Cj={key:0,class:"fct-inventory-toolbar-selected"},Bj={class:"fct-inventory-toolbar-actions ml-auto"},kj={key:0,class:"fct-advanced-inventory-table-wrap"},xj={class:"fct-advanced-inventory-table"},Sj={key:0,width:"150"},Fj={key:1,width:"100"},Ej={key:2,width:"100"},Uj={key:3,width:"100"},$j={width:"50"},Dj={key:0},Qj={key:1},Ij={key:2},Tj={key:3},xA=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=ja(),n=e,s=t,o=V([]),u=V(!1),A=V(!1),f=V(null),m=V(null),g=V(!0);ge(o,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}})},B=()=>{m.value&&m.value.openModal()},b=()=>{o.value=[],$(),s("bulk-update-success")},w=()=>n.data.flatMap(Q=>Q.variants&&Q.variants.length>0?Q.variants:[Q]),k=Q=>{Q?o.value=w():o.value=[],$()},S=Q=>{const T=o.value.findIndex(D=>D.id===Q.id);T>-1?o.value.splice(T,1):o.value.push(Q),$()},M=Q=>o.value.some(T=>T.id===Q.id),$=()=>{const Q=w(),T=o.value.length;T===0?(u.value=!1,A.value=!1):T===Q.length?(u.value=!0,A.value=!1):(u.value=!1,A.value=!0)},F=Q=>{f.value&&f.value.openHistory({id:Q.id,name:Q.variation_title||Q.post_title})},L=()=>{g.value=!g.value};return(Q,T)=>{var I,O,P,K,G,ne,Y,N;const D=C("el-button"),U=C("el-checkbox");return d(),_("div",bj,[r("div",wj,[o.value.length>0?(d(),_("div",Cj,h(o.value.length)+" "+h(p(c)("selected")),1)):x("",!0),r("div",Bj,[o.value.length>0?(d(),E(D,{key:0,type:"primary",size:"small",onClick:B},{default:i(()=>[R(h(p(c)("Update Stocks")),1)]),_:1})):x("",!0),l(D,{class:"fct-expand-row-button",size:"small",onClick:L},{default:i(()=>[l(W,{name:g.value?"Expand":"Collapse"},null,8,["name"]),R(" "+h(g.value?p(c)("Collapse All"):p(c)("Expand All")),1)]),_:1})])]),e.data.length>0?(d(),_("div",kj,[r("table",xj,[r("colgroup",null,[T[3]||(T[3]=r("col",{width:"50"},null,-1)),T[4]||(T[4]=r("col",null,null,-1)),(I=e.inventoryTable)!=null&&I.isColumnVisible("sku")?(d(),_("col",Sj)):x("",!0),T[5]||(T[5]=r("col",{width:"160"},null,-1)),(O=e.inventoryTable)!=null&&O.isColumnVisible("available")?(d(),_("col",Fj)):x("",!0),(P=e.inventoryTable)!=null&&P.isColumnVisible("on_hand")?(d(),_("col",Ej)):x("",!0),(K=e.inventoryTable)!=null&&K.isColumnVisible("committed")?(d(),_("col",Uj)):x("",!0),T[6]||(T[6]=r("col",{width:"40"},null,-1))]),r("thead",null,[r("tr",null,[r("th",$j,[l(U,{modelValue:u.value,"onUpdate:modelValue":T[0]||(T[0]=oe=>u.value=oe),indeterminate:A.value,onChange:k},null,8,["modelValue","indeterminate"])]),r("th",null,h(p(c)("Products")),1),(G=e.inventoryTable)!=null&&G.isColumnVisible("sku")?(d(),_("th",Dj,h(p(c)("SKU")),1)):x("",!0),r("th",null,h(p(c)("Total Stock")),1),(ne=e.inventoryTable)!=null&&ne.isColumnVisible("available")?(d(),_("th",Qj,h(p(c)("Available")),1)):x("",!0),(Y=e.inventoryTable)!=null&&Y.isColumnVisible("on_hand")?(d(),_("th",Ij,h(p(c)("On hold")),1)):x("",!0),(N=e.inventoryTable)!=null&&N.isColumnVisible("committed")?(d(),_("th",Tj,h(p(c)("Delivered")),1)):x("",!0),T[7]||(T[7]=r("th",null,null,-1))])]),r("tbody",null,[(d(!0),_(H,null,ee(e.data,oe=>(d(),_(H,{key:y(oe)},[!oe.variants||oe.variants.length===1?(d(),E(rG,{key:0,row:oe,"inventory-table":e.inventoryTable,"is-row-selected":M,"toggle-row-selection":S,"navigate-to-product":v,"get-placeholder-image":Q.getPlaceholderImage,onStockSave:T[1]||(T[1]=Z=>s("stock-save",Z)),onOpenHistory:F},null,8,["row","inventory-table","get-placeholder-image"])):x("",!0),oe.variants&&oe.variants.length>1?(d(),E(EG,{key:1,row:oe,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":Q.getPlaceholderImage,"is-row-selected":M,"toggle-row-selection":S,expanded:g.value,onStockSave:T[2]||(T[2]=Z=>s("stock-save",Z)),onOpenHistory:F},null,8,["row","inventory-table","get-placeholder-image","expanded"])):x("",!0)],64))),128))])])])):(d(),E(at,{key:1,icon:"Empty/ListView",text:p(c)("No inventory data")},null,8,["text"])),l(yj,{ref_key:"bulkAdjustModalRef",ref:m,"selected-items":o.value,onBulkUpdateSuccess:b},null,8,["selected-items"]),l(ZG,{ref_key:"historyRef",ref:f},null,512)])}}}),Vj={class:"fct-advanced-inventory-table"},Mj={class:"fct-inventory-toolbar-wrap"},Lj={class:"fct-inventory-toolbar-actions ml-auto"},Rj={class:"fct-advanced-inventory-table-wrap"},Oj={class:"fct-advanced-inventory-table"},Hj={key:0,width:"150"},Pj={key:1,width:"100"},Nj={key:2,width:"100"},Kj={key:3,width:"100"},Gj={width:"50"},jj={key:0},zj={key:1},Yj={key:2},qj={key:3},Wj={class:"fct-product-info-card"},Xj={class:"fct-product-info-media"},Jj={class:"fct-product-info-details"},Zj={key:0},ez={key:1},tz={key:2},az={key:3},nz={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=j(()=>Array.from({length:t.nextPageCount/2},(n,s)=>s+1));return(n,s)=>{const o=C("el-skeleton-item"),u=C("el-skeleton");return d(),E(u,{animated:""},{template:i(()=>{var A,f,m,g,y,v,B,b;return[r("div",Vj,[r("div",Mj,[r("div",Lj,[l(o,{variant:"button",class:"w-28 h-8 rounded"})])]),r("div",Rj,[r("table",Oj,[r("colgroup",null,[s[0]||(s[0]=r("col",{width:"50"},null,-1)),s[1]||(s[1]=r("col",null,null,-1)),(A=e.inventoryTable)!=null&&A.isColumnVisible("sku")?(d(),_("col",Hj)):x("",!0),s[2]||(s[2]=r("col",{width:"160"},null,-1)),(f=e.inventoryTable)!=null&&f.isColumnVisible("available")?(d(),_("col",Pj)):x("",!0),(m=e.inventoryTable)!=null&&m.isColumnVisible("on_hand")?(d(),_("col",Nj)):x("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(d(),_("col",Kj)):x("",!0),s[3]||(s[3]=r("col",{width:"40"},null,-1))]),r("thead",null,[r("tr",null,[r("th",Gj,[l(o,{variant:"p",class:"w-4 h-4"})]),r("th",null,[l(o,{variant:"p",class:"w-20"})]),(y=e.inventoryTable)!=null&&y.isColumnVisible("sku")?(d(),_("th",jj,[l(o,{variant:"p",class:"w-10"})])):x("",!0),r("th",null,[l(o,{variant:"p",class:"w-24"})]),(v=e.inventoryTable)!=null&&v.isColumnVisible("available")?(d(),_("th",zj,[l(o,{variant:"p",class:"w-20"})])):x("",!0),(B=e.inventoryTable)!=null&&B.isColumnVisible("on_hand")?(d(),_("th",Yj,[l(o,{variant:"p",class:"w-16"})])):x("",!0),(b=e.inventoryTable)!=null&&b.isColumnVisible("committed")?(d(),_("th",qj,[l(o,{variant:"p",class:"w-20"})])):x("",!0),s[4]||(s[4]=r("th",null,null,-1))])]),r("tbody",null,[(d(!0),_(H,null,ee(a.value,w=>{var k,S,M,$;return d(),_("tr",{key:w},[r("td",null,[l(o,{variant:"p",class:"w-4 h-4"})]),r("td",null,[r("div",Wj,[r("div",Xj,[l(o,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),r("div",Jj,[l(o,{variant:"p",class:"max-w-[180px]"})])])]),(k=e.inventoryTable)!=null&&k.isColumnVisible("sku")?(d(),_("td",Zj,[l(o,{variant:"p",class:"w-20"})])):x("",!0),r("td",null,[l(o,{variant:"p",class:"w-16"})]),(S=e.inventoryTable)!=null&&S.isColumnVisible("available")?(d(),_("td",ez,[l(o,{variant:"p",class:"w-10"})])):x("",!0),(M=e.inventoryTable)!=null&&M.isColumnVisible("on_hand")?(d(),_("td",tz,[l(o,{variant:"p",class:"w-10"})])):x("",!0),($=e.inventoryTable)!=null&&$.isColumnVisible("committed")?(d(),_("td",az,[l(o,{variant:"p",class:"w-10"})])):x("",!0),s[5]||(s[5]=r("td",null,null,-1))])}),128))])])])])]}),_:1})}}},sz={class:"fct-module-disabled-notice"},lz={class:"fct-disabled-notice-title"},oz={class:"fct-disabled-notice-text"},rz=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const n=C("el-icon"),s=C("router-link");return d(),_("div",sz,[l(n,{class:"fct-disabled-notice-icon"},{default:i(()=>[l(p(vh))]),_:1}),r("h3",lz,h(p(c)("Stock Management Inactive")),1),r("p",oz,[R(h(p(c)("Stock Management module is currently disabled. Please enable it in "))+" ",1),l(s,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:i(()=>[R(h(p(c)("module settings")),1)]),_:1}),R(" "+h(p(c)(" to use inventory features.")),1)])])}}});class iz extends Gs{getTabs(){return{all:c("All"),low_stock:c("Low Stock"),out_of_stock:c("Out of Stock")}}getToggleableColumns(){return[{label:c("SKU"),value:"sku"},{label:c("Available"),value:"available"},{label:c("On hold"),value:"on_hand"},{label:c("Committed"),value:"committed"}]}getSortableColumns(){return[{label:c("Product ID"),value:"id"},{label:c("Product Title"),value:"post_title"}]}getSearchHint(){return c("Search by product name, variation name or SKU")}getFetchUrl(){return"inventory"}parseResponse(t){return t.products||[]}getTableName(){return"inventory_table"}getAdvanceFilterOptions(){var t,a,n;return((n=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:n.advance)||null}getSearchGuideOptions(){return{}}getCustomColumns(){return{}}with(){return["detail","variants"]}}function dz(e){return iz.init(e)}const uz={class:"fct-all-inventory-page fct-layout-width"},cz={class:"fct-inventory-wrap"},Az={key:2,class:"py-10"},pz={class:"fct-pro-feature-text"},fz=Object.assign({name:"Inventory"},{__name:"Inventory",setup(e){const t=Ie.get("app_config"),a=j(()=>t==null?void 0:t.isProActive),n=Ie.get("modules_settings"),s=j(()=>{var B;return((B=n==null?void 0:n.stock_management)==null?void 0:B.active)==="yes"}),o=j(()=>{var B;return((B=n==null?void 0:n.stock_management)==null?void 0:B.enable_advanced_inventory)==="yes"}),u=j(()=>a.value&&s.value&&o.value),A=dz({instance:Qt(),fetch:!1}),f=V(0),m=V([]),g=B=>{f.value=B.count,m.value=B.selectedItems||[]},y=()=>{A.fetch()},v=B=>{const{variant:b,newStock:w,reason:k,customReason:S}=B;let M=parseInt(w);b.total_stock=M<0?0:M;let $=parseInt(b.total_stock)-parseInt(b.committed)-parseInt(b.on_hold);b.available=$<0?0:$,re.post("inventory/update-stock",{variant_id:b.id,post_id:b.post_id,new_stock:b.total_stock,reason:k,customReason:S||""}).then(F=>{q.success(c(F.message))}).catch(F=>{var L;F.status_code=="422"?q.validationErrors(F):q.error((L=F.data)==null?void 0:L.message)})};return Be(()=>{u.value&&A.fetch()}),(B,b)=>{const w=C("router-link");return d(),_("div",uz,[l(za,{title:p(c)("Inventory")},{action:i(()=>[l(St,{permission:"products/view"})]),_:1},8,["title"]),u.value?(d(),E(St,{key:0,permission:"products/view"},{default:i(()=>[r("div",cz,[l(js,{table:p(A),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:i(()=>[l(xA,{data:p(A).getTableData(),"inventory-table":p(A),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:i(()=>[p(A).isLoading()?(d(),E(nz,{key:0,"next-page-count":p(A).nextPageCount,"inventory-table":p(A)},null,8,["next-page-count","inventory-table"])):(d(),E(xA,{key:1,data:p(A).getTableData(),"inventory-table":p(A),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):s.value?(d(),_("div",Az,[l(co,{title:p(c)("Advanced Inventory")},{default:i(()=>[r("p",pz,[R(h(p(c)("This feature is only available in FluentCart Pro with "))+" ",1),l(w,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:i(()=>[R(h(p(c)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(d(),E(rz,{key:1}))])}}}),mz={class:"setting-wrap"},hz={class:"setting-wrap-inner"},_z={key:0,class:"fct-all-notification-table-wrap"},gz={class:"fct-card-header"},vz={class:"w-full pb-2"},yz={class:"flex items-center justify-between gap-2 pb-2"},bz={class:"flex-1"},wz={style:{width:"120px"}},Cz={class:"flex items-center justify-between gap-3",style:{width:"220px"}},Bz={key:1,class:"fct-all-notification-table-wrap"},kz={class:"fct-card-header"},xz={class:"w-full pb-2"},Sz={class:"flex items-center justify-between gap-2 pb-2"},Fz={class:"m-0 text-sm font-semibold text-system-dark dark:text-gray-50"},Ez={class:"text-xs text-system-mid dark:text-gray-300"},Uz={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},$z={class:"m-0 mb-1"},Dz={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},Qz={class:"m-0 text-sm"},Iz={class:"fct-all-notification-actions flex items-center justify-between gap-3"},Tz={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},Vz={class:"fct-btn-group sm flex-shrink-0"},Mz={__name:"EmailNotificationSettings",setup(e){const t=V(!0),a=V([]),n=j(()=>{if(!a.value.length)return[];const u={};return a.value.forEach(A=>{const f=(A==null?void 0:A.group)||"other";u[f]||(u[f]={key:f,label:(A==null?void 0:A.group_label)||c("Other Actions"),items:[]}),u[f].items.push(A)}),Object.values(u)}),s=()=>{t.value=!0,re.get("email-notification").then(u=>{a.value=Object.values(u.data)}).catch(u=>{}).finally(()=>{t.value=!1})},o=(u,A)=>{re.post("email-notification/enable-notification/"+A,{active:u}).then(f=>{q.success(f.message)}).catch(f=>{var m;f.status_code=="422"?q.validationErrors(f):q.error((m=f.data)==null?void 0:m.message)}).finally(()=>{})};return Be(()=>{s()}),(u,A)=>{const f=C("el-skeleton-item"),m=C("el-skeleton"),g=C("router-link"),y=C("el-table-column"),v=C("el-switch"),B=C("el-tooltip"),b=C("el-table");return d(),_("div",mz,[l(ha,{heading:p(c)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),r("div",hz,[l(_a),t.value?(d(),_("div",_z,[(d(),_(H,null,ee(2,w=>r("div",{key:w,class:"fct-card fct-notification-group mb-4 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[l(m,{animated:""},{template:i(()=>[r("div",gz,[r("div",vz,[r("div",yz,[l(f,{variant:"text",style:{width:"140px",height:"16px"}}),l(f,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(d(),_(H,null,ee(4,k=>r("div",{key:k,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"},[r("div",bz,[l(f,{variant:"text",style:{width:"50%",height:"14px",display:"block","margin-bottom":"8px"}}),l(f,{variant:"text",style:{width:"75%",height:"12px",display:"block"}})]),r("div",wz,[l(f,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),r("div",Cz,[l(f,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px",display:"block"}}),l(f,{variant:"text",style:{width:"28px",height:"28px","border-radius":"6px",display:"block"}})])])),64))]),_:1})])),64))])):(d(),_("div",Bz,[n.value.length?(d(!0),_(H,{key:0},ee(n.value,w=>(d(),_("div",{key:w.key,class:"fct-card fct-notification-group mx-5 mb-4 last:mb-0 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[r("div",kz,[r("div",xz,[r("div",Sz,[r("h4",Fz,h(w.label),1),r("span",Ez,h(w.items.length)+" "+h(p(c)("Notifications")),1)]),w.key==="scheduler"?(d(),_("p",Uz,[R(h(p(c)("This notification trigger is controlled from the Reminders section. You can configure it from"))+" ",1),l(g,{to:{path:"/settings/email_mailing_settings/reminders"},class:"underline hover:no-underline font-medium text-inherit hover:text-inherit"},{default:i(()=>[R(h(p(c)("reminder settings")),1)]),_:1})])):x("",!0)])]),l(b,{data:w.items,"show-header":!0},{default:i(()=>[l(y,{prop:"title",label:p(c)("Notification Name"),"min-width":"320"},{default:i(k=>[r("h4",$z,h(k.row.title),1),r("p",Dz,h(k.row.description),1)]),_:1},8,["label"]),l(y,{prop:"recipient",label:p(c)("Recipient"),"min-width":"120"},{default:i(k=>[r("p",Qz,h(p(Gt).headline(k.row.recipient)),1)]),_:1},8,["label"]),l(y,{label:p(c)("Enabled"),"min-width":"220"},{default:i(k=>{var S,M,$;return[r("div",Iz,[((S=k.row)==null?void 0:S.manage_toggle)!=="no"?(d(),E(v,{key:0,onChange:F=>o(F,k.row.name),modelValue:k.row.settings.active,"onUpdate:modelValue":F=>k.row.settings.active=F,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):x("",!0),((M=k.row)==null?void 0:M.manage_toggle)==="no"?(d(),_("span",Tz,h((($=k.row)==null?void 0:$.toggle_label)||p(c)("Auto-enabled")),1)):x("",!0),r("div",Vz,[l(B,{effect:"dark",content:p(c)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{to:{name:"email_notifications/edit",params:{name:k.row.name}},size:"x-small",hover:"primary"},{default:i(()=>[l(W,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])]))),128)):(d(),E(at,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:p(c)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},Lz={__name:"ProVersionGuard",props:{minVersion:{type:String,required:!0},featureTitle:{type:String,default:""},featureText:{type:String,default:""}},setup(e){const t=e,a=Ie.get("app_config.isProActive"),n=Ie.get("app_config.proVersion"),s=a&&n&&n.localeCompare(t.minVersion,void 0,{numeric:!0})<0,o=c("This feature requires FluentCart Pro v%s or later. Please update FluentCart Pro to use this feature.").replace("%s",t.minVersion);return(u,A)=>{const f=C("el-alert");return p(a)&&!p(s)?oa(u.$slots,"default",{key:0}):p(s)?(d(),E(f,{key:1,type:"warning","show-icon":"",closable:!1,title:p(c)("Update Required"),description:p(o)},null,8,["title","description"])):(d(),E(co,{key:2,title:e.featureTitle,text:e.featureText},null,8,["title","text"]))}}},Rz={class:"setting-wrap fct-edit-email-notification-wrapper"},Oz={class:"capitalize"},Hz={class:"setting-wrap-inner"},Pz={class:"mb-5"},Nz={class:"setting-switcher flex items-center gap-3"},Kz={class:"text-sm text-system-dark dark:text-gray-50"},Gz={class:"fct-card p-6"},jz={class:"mb-5"},zz={class:"el-form-item__label block mb-2"},Yz={class:"mb-5"},qz={class:"el-form-item__label block mb-2"},Wz={class:"el-form-item__label block mb-2"},Xz={class:"mb-5"},Jz={key:0,class:"setting-switcher"},Zz={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},eY={class:"fct-seg-wrap"},tY={key:0,class:"fct-default-template-preview"},aY={class:"el-form-item__label"},nY={key:1,class:"fct-default-template-frame"},sY=["srcdoc"],lY={key:2,class:"mb-4"},oY={class:"setting-save-action"},rY={key:0,style:{height:"300px"}},iY={class:"fct-preview-toolbar"},dY={class:"fct-preview-device-toggle"},uY={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=Ie.get("app_config.isProActive"),a=e,n=V(!1),s=V(!1),o=V(a.name),u=V({title:"",description:"",event:"",name:"",recipient:"",smartcode_groups:[],template_path:"",is_async:!1,settings:{active:"",is_default_body:"yes",email_body:"",subject:"",attach_pdf_template:""}}),A=V(null),f=V({}),m=V(!1),g=V(!1),y=V([]),v=V(!1),B=V(!1),b=V(""),w=V("desktop"),k=V(null),S=()=>{v.value=!0,B.value=!0,b.value="",re.post("email-notification/preview",{notification_name:o.value,block_content:u.value.settings.email_body||""}).then(O=>{b.value=O.html,B.value=!1,ye(()=>M())}).catch(O=>{var P;q.error(((P=O.data)==null?void 0:P.message)||"Failed to generate preview"),v.value=!1,B.value=!1})},M=()=>{const O=k.value;if(!O||!b.value)return;const P=O.contentDocument||O.contentWindow&&O.contentWindow.document;P&&(P.open(),P.write(b.value),P.close())},$=()=>{ye(()=>{b.value&&M()})},F=()=>{v.value=!1,b.value="",w.value="desktop"},L=V(""),Q=V(!1),T=()=>{var P;const O=(P=u.value)==null?void 0:P.template_path;!O||L.value||(Q.value=!0,re.post("email-notification/preview-default-template",{template:O}).then(K=>{var G;L.value=((G=K.data)==null?void 0:G.content)||""}).catch(()=>{}).finally(()=>{Q.value=!1}))};ge(()=>u.value.settings.is_default_body,O=>{O==="yes"&&!L.value&&T()});const D=O=>{u.value.settings.subject+=O},U=()=>{n.value=!0,re.get("email-notification/"+o.value).then(O=>{u.value=O.data,f.value=O.shortcodes,g.value=O.has_fluent_pdf||!1,y.value=O.pdf_templates||[],u.value.settings.is_default_body==="yes"&&T()}).catch(O=>{var P;O.status_code=="422"?q.validationErrors(O):q.error((P=O.data)==null?void 0:P.message)}).finally(()=>{n.value=!1})},I=()=>{s.value=!0;const O=JSON.parse(JSON.stringify(u.value));O.settings.is_default_body==="no"&&A.value&&A.value.forceAutosave(),re.put("email-notification/"+o.value,O).then(P=>{q.success(P.message)}).catch(P=>{var K;P.status_code=="422"?q.validationErrors(P):q.error((K=P.data)==null?void 0:K.message)}).finally(()=>{s.value=!1})};return Be(()=>{U()}),(O,P)=>{var ce;const K=C("el-breadcrumb-item"),G=C("el-breadcrumb"),ne=C("el-skeleton-item"),Y=C("el-skeleton"),N=C("el-switch"),oe=C("el-input"),Z=C("el-form-item"),le=C("el-form"),te=C("el-option"),X=C("el-select"),ie=C("el-button"),be=C("el-drawer"),se=Ca("loading");return d(),_("div",Rz,[l(ha,{loading:s.value,"loading-text":p(c)("Updating"),"save-button-text":p(c)("Update"),onOnSave:I},{heading:i(()=>[l(G,{class:"mb-0","separator-icon":p(tn)},{default:i(()=>[l(K,{to:{path:"/settings/email_notifications"}},{default:i(()=>[R(h(O.$t("Email Notifications")),1)]),_:1}),l(K,null,{default:i(()=>[r("span",Oz,h(u.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),r("div",Hz,[l(_a),n.value?(d(),E(Y,{key:0,animated:""},{template:i(()=>[r("div",Pz,[r("div",Nz,[l(ne,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),r("span",Kz,h(p(c)("Enable this email notification!")),1)])]),r("div",Gz,[r("div",jz,[r("label",zz,h(p(c)("Email Subject")),1),l(ne,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),r("div",Yz,[r("label",qz,h(p(c)("Email Body Type")),1),l(ne,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),r("div",null,[r("label",Wz,h(p(c)("Email Body")),1),l(ad)])])]),_:1})):x("",!0),n.value?x("",!0):(d(),_(H,{key:1},[r("div",Xz,[((ce=u.value)==null?void 0:ce.manage_toggle)!=="no"?(d(),_("div",Jz,[l(N,{modelValue:u.value.settings.active,"onUpdate:modelValue":P[0]||(P[0]=pe=>u.value.settings.active=pe),"active-value":"yes","inactive-value":"no","active-text":p(c)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(d(),_("div",Zz,h(p(c)("Auto-enabled for offline payments")),1))]),l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(le,{"label-position":"top"},{default:i(()=>[l(Z,{label:p(c)("Email Subject")},{default:i(()=>[l(oe,{modelValue:u.value.settings.subject,"onUpdate:modelValue":P[1]||(P[1]=pe=>u.value.settings.subject=pe),autocomplete:"rutjfkde",class:de({"is-focus":m.value}),onFocus:P[2]||(P[2]=pe=>m.value=!0),onBlur:P[3]||(P[3]=pe=>m.value=!1),label:p(c)("Email Subject")},{append:i(()=>[l(up,{data:f.value,onCommand:D,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:i(()=>[R(h(p(c)("Add ShortCodes")),1)]),_:1},8,["data"])]),_:1},8,["modelValue","class","label"])]),_:1},8,["label"]),l(Z,{label:p(c)("Email Body Type")},{default:i(()=>[r("div",eY,[r("button",{type:"button",class:de(["fct-seg-btn",{active:u.value.settings.is_default_body==="yes"}]),onClick:P[4]||(P[4]=pe=>u.value.settings.is_default_body="yes")},[P[13]||(P[13]=r("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"},[r("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),r("path",{d:"M9 9h6M9 13h6M9 17h4"})],-1)),R(" "+h(p(c)("Default Body")),1)],2),r("button",{type:"button",class:de(["fct-seg-btn",{active:u.value.settings.is_default_body==="no"}]),onClick:P[5]||(P[5]=pe=>u.value.settings.is_default_body="no")},[P[14]||(P[14]=r("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"},[r("path",{d:"M12 20h9"}),r("path",{d:"M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),R(" "+h(p(c)("Customized Body"))+" ",1),p(t)?x("",!0):(d(),E(W,{key:0,name:"Crown",class:"fct-pro-icon",style:{"margin-left":"4px",display:"inline-flex"}}))],2)])]),_:1},8,["label"]),u.value.settings.is_default_body==="yes"?(d(),_("div",tY,[r("label",aY,h(p(c)("Email Body")),1),Q.value?(d(),E(ad,{key:0})):L.value?(d(),_("div",nY,[l(Wo,{type:"warning",class:"mb-3","show-icon":"",description:p(c)("The preview shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),r("iframe",{srcdoc:L.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,sY)])):x("",!0)])):x("",!0),u.value.settings.is_default_body==="no"&&!n.value?(d(),E(Lz,{key:1,"min-version":"1.3.15","feature-title":p(c)("Custom Email Templates"),"feature-text":p(c)("Design beautiful email templates with a drag-and-drop block editor, shortcodes, and conditional content.")},{default:i(()=>[l(Z,{label:p(c)("Email Body")},{default:i(()=>[l(Wo,{class:"mb-3",type:"warning","show-icon":"",description:p(c)("Shortcodes/Blocks shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),l(_p,{ref_key:"editorFrameRef",ref:A,editorParams:{block_type:"template",campaign_title:u.value.settings.subject,bid:u.value.name},frameHeight:"calc(100vh - 60px)",documentTitle:u.value.settings.subject,onTitleUpdated:P[6]||(P[6]=pe=>{u.value.settings.subject=pe}),onPreviewRequest:S,modelValue:u.value.settings.email_body,"onUpdate:modelValue":P[7]||(P[7]=pe=>u.value.settings.email_body=pe)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):x("",!0)]),_:1})]),_:1})]),_:1})],64)),g.value&&y.value.length?(d(),_("div",lY,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(le,{"label-position":"top"},{default:i(()=>[l(Z,{label:p(c)("Attach PDF Template")},{default:i(()=>[l(X,{modelValue:u.value.settings.attach_pdf_template,"onUpdate:modelValue":P[8]||(P[8]=pe=>u.value.settings.attach_pdf_template=pe),placeholder:p(c)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:i(()=>[(d(!0),_(H,null,ee(y.value,pe=>(d(),E(te,{key:pe.id,label:pe.title,value:pe.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):x("",!0),r("div",oY,[l(ie,{onClick:I,type:"primary",disabled:s.value,loading:s.value},{default:i(()=>[R(h(p(c)("Update")),1)]),_:1},8,["disabled","loading"])])]),l(be,{modelValue:v.value,"onUpdate:modelValue":P[12]||(P[12]=pe=>v.value=pe),direction:"rtl",size:"70%",title:p(c)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:$},{footer:i(()=>[l(ie,{onClick:F},{default:i(()=>[R(h(p(c)("Close")),1)]),_:1})]),default:i(()=>[B.value?Dt((d(),_("div",rY,null,512)),[[se,!0]]):x("",!0),!B.value&&b.value?(d(),_(H,{key:1},[r("div",iY,[r("div",dY,[r("button",{type:"button",class:de(["fct-device-btn",{active:w.value==="desktop"}]),onClick:P[9]||(P[9]=pe=>w.value="desktop")},[P[15]||(P[15]=r("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),r("path",{d:"M8 21h8"}),r("path",{d:"M12 17v4"})],-1)),r("span",null,h(p(c)("Desktop")),1)],2),r("button",{type:"button",class:de(["fct-device-btn",{active:w.value==="tablet"}]),onClick:P[10]||(P[10]=pe=>w.value="tablet")},[P[16]||(P[16]=r("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}),r("path",{d:"M12 18h.01"})],-1)),r("span",null,h(p(c)("Tablet")),1)],2),r("button",{type:"button",class:de(["fct-device-btn",{active:w.value==="mobile"}]),onClick:P[11]||(P[11]=pe=>w.value="mobile")},[P[17]||(P[17]=r("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),r("path",{d:"M12 18h.01"})],-1)),r("span",null,h(p(c)("Mobile")),1)],2)])]),l(Wo,{class:"mb-3",type:"warning","show-icon":"",description:p(c)("The preview shown here uses sample data. Actual emails will be populated with real information.")},null,8,["description"]),r("div",{class:de(["fct-preview-stage","fct-preview-stage--"+w.value])},[r("div",{class:de(["fct-device-frame","fct-device-frame--"+w.value])},[r("iframe",{ref_key:"previewIframe",ref:k,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):x("",!0)]),_:1},8,["modelValue","title"])])}}},cY={name:"StorageSettings",components:{Badge:qt,CardBody:me,CardContainer:he,SettingsHeader:ha,AdminNotice:_a},props:["settings"],data(){return{loading:!1,availableDrivers:[]}},mounted(){this.getStorageDrivers()},methods:{translate:c,getLogo(e){return e},getDarkLogo(e){return e||null},getRowLabel(e){return`${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},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(n=>{e.status=t==="yes",this.$notify({type:"success",title:this.translate("Success"),message:n.message})}).catch(n=>{e.is_active_input=a,this.handleError(n)}).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})}}},AY={class:"setting-wrap"},pY={class:"setting-wrap-inner"},fY={key:0,class:"storage-setting-list fct-content-card-list"},mY=["role","tabindex","aria-label","onClick","onKeydown"],hY={class:"flex items-start gap-3"},_Y=["src","alt"],gY=["src","alt"],vY={class:"flex-1 min-w-0 pl-15"},yY={class:"fct-content-card-list-head"},bY={class:"title-wrap"},wY={class:"fct-content-card-list-content"},CY=["src","alt"];function BY(e,t,a,n,s,o){const u=C("SettingsHeader"),A=C("AdminNotice"),f=C("el-skeleton"),m=C("Badge"),g=C("el-switch"),y=C("el-button"),v=C("CardBody"),B=C("CardContainer");return d(),_("div",AY,[l(u,{heading:o.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),r("div",pY,[l(A),l(B,null,{default:i(()=>[l(v,null,{default:i(()=>[l(f,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?x("",!0):(d(),_("div",fY,[(d(!0),_(H,null,ee(s.availableDrivers,(b,w)=>(d(),_("div",{key:b.route||w,class:de(["fct-content-card-list-item",o.canManage(b)?"cursor-pointer":""]),role:o.canManage(b)?"button":void 0,tabindex:o.canManage(b)?0:-1,"aria-label":o.getRowLabel(b),onClick:k=>o.handleDriverAction(b),onKeydown:[Pa(Xe(k=>o.handleDriverAction(b),["prevent"]),["enter"]),Pa(Xe(k=>o.handleDriverAction(b),["prevent"]),["space"])]},[r("div",hY,[r("div",{class:de(`fct-content-card-list-icon ${b.title.toLowerCase()}`)},[r("img",{class:de({"dark:hidden":o.getDarkLogo(b.dark_logo)}),src:o.getLogo(b.logo),alt:b.title},null,10,_Y),o.getDarkLogo(b.dark_logo)?(d(),_("img",{key:0,src:o.getDarkLogo(b.dark_logo),alt:b.title,class:"hidden dark:block"},null,8,gY)):x("",!0)],2),r("div",vY,[r("div",yY,[r("div",bY,[r("h6",null,h(b.title),1)]),l(m,{size:"small",status:b.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),r("div",wY,[r("p",null,h(b.description),1)])]),o.canToggle(b)?(d(),_("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=Xe(()=>{},["stop"])),onKeydown:t[1]||(t[1]=Xe(()=>{},["stop"]))},[l(g,{modelValue:b.is_active_input,"onUpdate:modelValue":k=>b.is_active_input=k,"active-value":"yes","inactive-value":"no",loading:b.saving,"aria-label":o.getToggleLabel(b),onChange:k=>o.toggleStatus(b)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):o.canManage(b)?(d(),_("div",{key:1,class:"fct-content-card-list-action",onClick:t[2]||(t[2]=Xe(()=>{},["stop"])),onKeydown:t[3]||(t[3]=Xe(()=>{},["stop"]))},[l(y,{class:"el-button--x-small",onClick:k=>o.handleDriverAction(b)},{default:i(()=>{var k;return[b.requires_pro?(d(),_("img",{key:0,src:((k=e.appVars)==null?void 0:k.asset_url)+"images/crown.svg",alt:o.translate("Pro feature"),class:"pro-feature-icon"},null,8,CY)):x("",!0),R(" "+h(o.translate("Manage")),1)]}),_:2},1032,["onClick"])],32)):x("",!0)])],42,mY))),128))]))]),_:1})]),_:1})])])}const kY=He(cY,[["render",BY]]),xY={class:"fct-setting-header"},SY={key:0,class:"fct-setting-header-action"},FY={class:"setting-wrap-inner"},SA={__name:"GlobalStorageComponents",setup(e){const t=V({}),a=V(""),n=V({}),s=V(!1),o=V(!1),u=V(""),A=fu(),f=V({}),m=j(()=>!!a.value),g=fn(),y=xs(),v=()=>{o.value=!0,re.get("settings/storage-drivers/"+u.value).then(w=>{t.value=w.settings||{},a.value=w.template||"",n.value=w.template_payload||{},f.value={},w.template||A.setSchema(w.fields).setDefaults(w.settings).initForm()}).catch(w=>{var k;t.value={},a.value="",n.value={},f.value={},A.setSchema({}).setDefaults({}),q.error(((k=w==null?void 0:w.data)==null?void 0:k.message)||c("Failed to load storage settings."))}).finally(()=>{o.value=!1})},B=()=>{if(m.value)return;let w=A.values;s.value=!0,re.post("settings/storage-drivers",{settings:{...w},driver:u.value}).then(k=>{var S;t.value.is_active=(S=k.data)==null?void 0:S.is_active,q.success(k.message||c("Storage Settings updated!")),A.values=k.data,k.data.shouldReload&&v()}).catch(k=>{var S;k.status_code=="422"?q.validationErrors(k):q.error((S=k.data)==null?void 0:S.message)}).finally(()=>{s.value=!1})},b=()=>{u.value=g.name};return ge(g,(w,k)=>{b(),v()}),y.onSave(()=>{m.value||B()}),Be(()=>{b(),v()}),(w,k)=>{const S=C("el-breadcrumb-item"),M=C("el-breadcrumb"),$=C("el-button"),F=C("el-skeleton");return d(),_("div",{class:de(["setting-wrap",u.value])},[r("div",xY,[l(M,{class:"mb-0","separator-icon":p(tn)},{default:i(()=>[l(S,{to:{name:"storage"}},{default:i(()=>[R(h(p(c)("Storage Providers")),1)]),_:1}),p(Gt).headline(u.value)?(d(),E(S,{key:0},{default:i(()=>[R(h(p(Gt).headline(u.value)),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"]),m.value?x("",!0):(d(),_("div",SY,[l($,{type:"primary",onClick:B,loading:s.value,disabled:s.value||o.value,size:"small"},{default:i(()=>[R(h(p(c)("Save")),1)]),_:1},8,["loading","disabled"])]))]),r("div",FY,[l(_a),o.value?(d(),E(he,{key:0},{default:i(()=>[l(me,null,{default:i(()=>[l(F,{loading:o.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(d(),_(H,{key:1},[m.value?(d(),E(Lf,{key:0,widget:{type:"vue-template",component:a.value,payload:n.value},data:{route_name:u.value}},null,8,["widget","data"])):(d(),E(oi,{key:1,form:p(A),showSubmitButton:!1,loading:s.value,onOnChange:k[0]||(k[0]=L=>{}),"validation-errors":f.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},EY=["innerHTML"],UY={class:"fct-select-template-wrap"},$Y={class:"fct-select-template-wrap flex gap-2 flex-row"},DY={class:"setting-save-action"},QY={__name:"AddEmailNotification",setup(e){const t=Qt().ctx,a=V(),n=V(!0),s=V(!1),o=V({}),u=V(),A=V([{label:c("After Order Created"),value:"fluent_cart/order_created"},{label:c("After Order Updated"),value:"fluent_cart/order_updated"},{label:c("After Payment Paid"),value:"fluent_cart/order_paid"},{label:c("After User Created"),value:"fluent_cart/user_created"},{label:c("After Refund made"),value:"fluent_cart/order_refunded"}]),f=V({}),m=V([{label:"Admin Email",value:"{wp.admin_email}"},{label:"Customer Email",value:"{order.customer.email}"},{label:"User Email",value:"{user.user_email}"}]),g=V({}),y=V({});ja(),fn();let v=null;const B=V([]),b=V([]),w=V({});xs().onSave(()=>{F()});const S=I=>{const O=I;t.$post("email-notification/getTemplate/",{template:O}).then(P=>{var K;o.value.content=P.data.content,(K=a.value)==null||K.setContent(o.value.content)}).catch(P=>{}).finally(()=>{n.value=!1})},M=()=>{var I;(I=a.value)==null||I.setContent("")},$=()=>{n.value=!0,t.$get("email-notification/get-short-codes").then(I=>{f.value=I.data.shortcodes,g.value=I.data.email_templates,y.value=Object.keys(I.data.buttons).map(O=>({[O]:I.data.buttons[O]}))}).catch(I=>{}).finally(()=>{n.value=!1})},F=I=>{I&&I.preventDefault(),w.value={},n.value=!0,t.$post("email-notification/create",o.value).then(O=>{t.handleSuccess(O)}).catch(O=>{var P;O.status_code=="422"?(q.validationErrors(O),w.value=O.data):q.error((P=O.data)==null?void 0:P.message)}).finally(()=>{n.value=!1})},L=()=>{s.value=!0,u.value=o.value.content};Be(()=>{$()});const Q=I=>{v=I},T=I=>{w.value&&w.value.hasOwnProperty(I)&&delete w.value[I]},D=()=>{o.value.to=B.value},U=()=>{o.value.from=b.value};return(I,O)=>{const P=C("el-dialog"),K=C("el-input"),G=C("el-form-item"),ne=C("el-option"),Y=C("el-select"),N=C("el-col"),oe=C("el-row"),Z=C("el-tooltip"),le=C("el-button"),te=C("el-form");return d(),E(he,null,{default:i(()=>[l(Ce,{title:o.value.title?o.value.title:p(c)("Add Notification"),title_size:"small",border_bottom:"",icon:"Message"},{action:i(()=>O[20]||(O[20]=[])),_:1},8,["title"]),l(me,null,{default:i(()=>[l(P,{modelValue:s.value,"onUpdate:modelValue":O[0]||(O[0]=X=>s.value=X),title:I.$t("Preview")},{default:i(()=>[r("div",{innerHTML:u.value},null,8,EY)]),_:1},8,["modelValue","title"]),l(te,{"label-position":"top","require-asterisk-position":"right"},{default:i(()=>[l(G,{label:I.$t("Notification Name"),required:""},{default:i(()=>{var X,ie;return[l(K,{modelValue:o.value.title,"onUpdate:modelValue":O[1]||(O[1]=be=>o.value.title=be),onFocus:O[2]||(O[2]=be=>T("title"))},null,8,["modelValue"]),l(un,{"validation-errors":(ie=(X=w.value)==null?void 0:X.title)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),l(G,{label:I.$t("Select notification event"),required:""},{default:i(()=>{var X,ie;return[l(Y,{multiple:!0,modelValue:o.value.events,"onUpdate:modelValue":O[3]||(O[3]=be=>o.value.events=be),placeholder:I.$t("Select Events"),onFocus:O[4]||(O[4]=be=>T("events")),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(A.value,be=>(d(),E(ne,{key:be.value,label:be.label,value:be.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),l(un,{"validation-errors":(ie=(X=w.value)==null?void 0:X.events)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),l(oe,{gutter:15},{default:i(()=>[l(N,{lg:12},{default:i(()=>[l(G,{label:I.$t("Mail From:"),required:""},{default:i(()=>{var X,ie;return[l(K,{modelValue:o.value.from,"onUpdate:modelValue":O[7]||(O[7]=be=>o.value.from=be),onFocus:O[8]||(O[8]=be=>T("from")),placeholder:I.$t("Select a Field or Type Custom Value")},{append:i(()=>[l(Y,{modelValue:b.value,"onUpdate:modelValue":O[5]||(O[5]=be=>b.value=be),onChange:O[6]||(O[6]=be=>U()),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(m.value,be=>(d(),E(ne,{key:be.value,label:be.label,value:be.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),l(un,{"validation-errors":(ie=(X=w.value)==null?void 0:X.from)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),l(N,{lg:12},{default:i(()=>[l(G,{label:I.$t("Send Mail To:"),required:""},{default:i(()=>{var X,ie;return[l(K,{modelValue:o.value.to,"onUpdate:modelValue":O[11]||(O[11]=be=>o.value.to=be),onFocus:O[12]||(O[12]=be=>T("to"))},{append:i(()=>[l(Y,{modelValue:B.value,"onUpdate:modelValue":O[9]||(O[9]=be=>B.value=be),onChange:O[10]||(O[10]=be=>D()),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(m.value,be=>(d(),E(ne,{key:be.value,label:be.label,value:be.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),l(un,{"validation-errors":(ie=(X=w.value)==null?void 0:X.to)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),l(G,{label:I.$t("Cc:")},{default:i(()=>[l(K,{modelValue:o.value.cc,"onUpdate:modelValue":O[13]||(O[13]=X=>o.value.cc=X)},null,8,["modelValue"])]),_:1},8,["label"]),l(G,{label:I.$t("Mail Subject:"),required:""},{default:i(()=>{var X,ie;return[l(K,{modelValue:o.value.subject,"onUpdate:modelValue":O[14]||(O[14]=be=>o.value.subject=be),onFocus:O[15]||(O[15]=be=>T("subject"))},null,8,["modelValue"]),l(un,{"validation-errors":(ie=(X=w.value)==null?void 0:X.subject)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),r("div",null,[l(ts,{ref_key:"wpEditor",ref:a,"short-codes":f.value,buttons:y.value,onOnEditorReady:Q,onUpdate:O[18]||(O[18]=X=>{o.value.content=X}),modelValue:o.value.content,"onUpdate:modelValue":O[19]||(O[19]=X=>o.value.content=X)},{action:i(()=>[r("div",UY,[l(Y,{onChange:O[16]||(O[16]=X=>{var ie;(ie=a.value)==null||ie.setContent(X)}),placeholder:I.$t("Select button"),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(y.value,(X,ie)=>(d(),E(ne,{key:ie,label:Object.keys(X)[0],value:Object.values(X)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),r("div",$Y,[l(Y,{onChange:O[17]||(O[17]=X=>{S(X)}),placeholder:I.$t("Select template"),clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(g.value,(X,ie)=>(d(),E(ne,{key:ie,label:X.label,value:X.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),r("span",null,[l(Z,{effect:"dark",content:I.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{onClick:Xe(M,["prevent"]),tag:"button"},{default:i(()=>[l(W,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:i(()=>[p(v)!==null?(d(),E(Z,{key:0,effect:"dark",content:I.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{onClick:Xe(L,["prevent"]),tag:"button"},{default:i(()=>[l(W,{name:"Eye"})]),_:1})]),_:1},8,["content"])):x("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),r("div",DY,[l(le,{onClick:F,type:"primary",disabled:n.value,loading:n.value},{default:i(()=>[R(h(I.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class IY extends Gs{getTabs(){return{all:c("All"),success:c("Success"),warning:c("Warning"),error:c("Error"),failed:c("Failed"),info:c("Info"),api:c("API Only")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Content",value:"content"},{label:"Date",value:"date"},{label:"Actions",value:"actions"}]}getSortableColumns(){return[{label:c("ID"),value:"id"},{label:c("Title"),value:"title"},{label:c("Created At"),value:"created_at"}]}getSearchHint(){return c("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 TY(e){return IY.init(e)}const VY={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},MY={class:"fct-table-mobile-header"},LY={class:"fct-table-date-col"},RY={class:"mark-read-unread-wrap"},OY=["onClick","title"],HY=["onClick","title"],PY=["title"],NY={class:"fct-table-mobile-body"},KY={key:0,class:"fct-table-title-col"},GY={key:1,class:"fct-table-content-col"},jY={class:"fct-table-mobile-footer"},zY={class:"fct-table-mobile-footer-row"},YY={class:"fct-table-status-col"},qY={class:"title"},WY={class:"fct-table-module-col"},XY={class:"title"},JY={class:"value"},ZY={key:0,class:"fct-table-actions-col"},eq={class:"title"},tq={__name:"LogsTableMobile",props:{table:{type:Object}},emits:["changeStatus"],setup(e,{emit:t}){const a=t,n=(s,o)=>{a("changeStatus",s,o)};return(s,o)=>{const u=C("el-icon"),A=C("router-link");return d(),_("div",VY,[(d(!0),_(H,null,ee(e.table.getTableData(),(f,m)=>(d(),_("div",{key:f.id,class:"fct-table-mobile-row"},[r("div",MY,[r("div",LY,[r("div",RY,[f.read_status!=="unread"?(d(),_("span",{key:0,onClick:g=>n(f,"unread"),title:p(c)("Mark as unread")},[l(u,null,{default:i(()=>[l(p(dr))]),_:1})],8,OY)):(d(),_("span",{key:1,onClick:g=>n(f,"read"),title:p(c)("Mark as read")},[l(u,null,{default:i(()=>[l(p(Nr))]),_:1})],8,HY))]),r("div",{title:p(c)("Logs ID: %s",f.id),class:"invoice-no"}," #"+h(f.id),9,PY),e.table.isColumnVisible("date")?(d(),_(H,{key:0},[o[0]||(o[0]=r("span",{class:"bullet"},"•",-1)),l($a,{class:"date","date-time":f.created_at,"with-time":!0},null,8,["date-time"])],64)):x("",!0)])]),r("div",NY,[e.table.isColumnVisible("title")?(d(),_("div",KY,h(f.title),1)):x("",!0),e.table.isColumnVisible("content")?(d(),_("div",GY,h(f.content),1)):x("",!0)]),r("div",jY,[r("div",zY,[r("div",YY,[r("div",qY,h(p(c)("Status")),1),(d(),E(qt,{status:f.status,size:"small",key:f.id},null,8,["status"]))]),r("div",WY,[r("div",XY,h(p(c)("Module")),1),r("div",JY,h(f.module_name),1)]),e.table.isColumnVisible("actions")?(d(),_("div",ZY,[r("div",eq,h(p(c)("Actions")),1),f.module_id&&f.module_name.toLowerCase()==="order"?(d(),E(A,{key:0,class:"value",to:{name:"view_order",params:{order_id:f.module_id}}},{default:i(()=>[R(h(p(c)("View")),1)]),_:2},1032,["to"])):x("",!0),f.module_id&&f.module_name.toLowerCase()==="subscription"?(d(),E(A,{key:1,class:"value",to:{name:"view_subscription",params:{subscription_id:f.module_id}}},{default:i(()=>[R(h(p(c)("View")),1)]),_:2},1032,["to"])):x("",!0)])):x("",!0)])])]))),128))])}}},aq={},nq={class:"px-4 py-3"},sq={class:"grid grid-cols-3 gap-5 mt-5"};function lq(e,t){const a=C("el-skeleton-item"),n=C("el-skeleton");return d(),E(n,{animated:""},{template:i(()=>[r("div",nq,[(d(),_(H,null,ee(2,s=>r("div",{key:s,class:"flex items-center justify-between mb-3"},[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})])),64)),r("div",sq,[(d(),_(H,null,ee(3,s=>r("div",{key:s},[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const oq=He(aq,[["render",lq]]),rq={class:"table-cell"},iq={class:"table-cell"},dq={class:"table-cell"},uq={class:"table-cell"},cq={class:"table-cell"},Aq={class:"table-cell"},pq={class:"table-cell"},fq={__name:"LogsLoader",props:{nextPageCount:{type:Number,default:0},logTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(n,s)=>s+1);return(n,s)=>{const o=C("el-skeleton-item"),u=C("el-skeleton"),A=C("el-table-column"),f=C("el-table");return d(),E(f,{data:p(a),class:"w-full compact-table full-compact"},{default:i(()=>[l(A,{width:100,label:p(c)("ID")},{default:i(()=>[r("div",rq,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(d(),E(A,{key:0,label:p(c)("Date"),width:120},{default:i(()=>[r("div",iq,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("title")?(d(),E(A,{key:1,label:p(c)("Title"),width:200},{default:i(()=>[r("div",dq,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("content")?(d(),E(A,{key:2,label:p(c)("Content"),width:200},{default:i(()=>[r("div",uq,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),l(A,{label:p(c)("Status"),width:100},{default:i(()=>[r("div",cq,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p"})]),_:1})])]),_:1},8,["label"]),l(A,{label:p(c)("Module"),width:100},{default:i(()=>[r("div",Aq,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(d(),E(A,{key:3,label:p(c)("Actions"),width:100},{default:i(()=>[r("div",pq,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},mq={class:"fct-all-logs-page fct-layout-width"},hq={key:1},_q={class:"inline-flex items-center gap-1"},gq=["onClick","title"],vq=["onClick","title"],yq={__name:"Logs",setup(e){const t=Qt().ctx,a=TY(),n=V([]),s=(o,u)=>{t.$put("activity/"+o.id+"/mark-read",{id:o.id,status:u}).then(A=>{n.value.find(f=>f.id===o.id).read_status=u,t.handleSuccess(A)}).catch(A=>{var f;A.status_code=="422"?q.validationErrors(A):q.error((f=A.data)==null?void 0:f.message)})};return a.onDataLoaded(function(){n.value=a.getTableData()}),(o,u)=>{const A=C("el-icon"),f=C("el-table-column"),m=C("el-button"),g=C("el-table");return d(),_("div",mq,[l(za,{title:p(c)("Logs")},null,8,["title"]),l(js,{table:p(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:i(()=>[p(a).isLoading()?(d(),E(oq,{key:0})):x("",!0),p(a).isLoading()?x("",!0):(d(),E(tq,{key:1,table:p(a),onChangeStatus:s},null,8,["table"]))]),default:i(()=>[p(a).isLoading()?(d(),E(fq,{key:0,logTable:p(a),"next-page-count":p(a).nextPageCount},null,8,["logTable","next-page-count"])):(d(),_("div",hq,[l(g,{class:"w-full",data:p(a).getTableData()},{empty:i(()=>[l(at,{icon:"Empty/ListView","has-dark":!0,text:p(c)("We could't find any logs matching your filter.")},null,8,["text"])]),default:i(()=>[l(f,{label:p(c)("ID"),width:100},{default:i(y=>[r("div",_q,[y.row.read_status!=="unread"?(d(),_("span",{key:0,onClick:v=>s(y.row,"unread"),title:p(c)("Mark as unread"),class:"cursor-pointer"},[l(A,null,{default:i(()=>[l(p(dr))]),_:1})],8,gq)):(d(),_("span",{key:1,onClick:v=>s(y.row,"read"),title:p(c)("Mark as read"),class:"cursor-pointer"},[l(A,null,{default:i(()=>[l(p(Nr))]),_:1})],8,vq)),R(" #"+h(p(Kt)(y.row.id)),1)])]),_:1},8,["label"]),p(a).isColumnVisible("date")?(d(),E(f,{key:0,label:p(c)("Date"),width:120},{default:i(y=>[l($a,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):x("",!0),p(a).isColumnVisible("title")?(d(),E(f,{key:1,label:p(c)("Title"),width:200},{default:i(y=>[R(h(y.row.title),1)]),_:1},8,["label"])):x("",!0),p(a).isColumnVisible("content")?(d(),E(f,{key:2,label:p(c)("Content"),width:200},{default:i(y=>[R(h(y.row.content),1)]),_:1},8,["label"])):x("",!0),l(f,{label:p(c)("Status"),width:100},{default:i(y=>[(d(),E(qt,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),l(f,{label:p(c)("Module"),width:100},{default:i(y=>[R(h(y.row.module_name),1)]),_:1},8,["label"]),p(a).isColumnVisible("actions")?(d(),E(f,{key:3,label:p(c)("Actions"),width:80},{default:i(y=>[y.row.module_id&&y.row.module_name.toLowerCase()==="order"?(d(),E(m,{key:0,tag:"router-link",class:"el-button--x-small",to:{name:"view_order",params:{order_id:y.row.module_id}}},{default:i(()=>[R(h(p(c)("View")),1)]),_:2},1032,["to"])):x("",!0),y.row.module_id&&y.row.module_name.toLowerCase()==="subscription"?(d(),E(m,{key:1,tag:"router-link",class:"el-button--x-small",to:{name:"view_subscription",params:{subscription_id:y.row.module_id}}},{default:i(()=>[R(h(p(c)("View")),1)]),_:2},1032,["to"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},bq=["title"],wq={__name:"RemoveButton",props:{filterKey:{type:String,required:!0},itemId:{type:[String,Number],default:null}},emits:["remove"],setup(e,{emit:t}){const a=e,n=t,s=()=>{n("remove",{filterKey:a.filterKey,itemId:a.itemId})};return(o,u)=>(d(),_("button",{class:"fct-applied-filter-remove",onClick:s,title:o.$t("Remove")},[l(W,{name:"Close"})],8,bq))}},Cq={__name:"StatusFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const a=e.filterState;return(n,s)=>{const o=C("el-option"),u=C("el-select");return d(),E(u,{modelValue:p(a).data.selectedFilters[e.filterItemKey].value,"onUpdate:modelValue":s[0]||(s[0]=A=>p(a).data.selectedFilters[e.filterItemKey].value=A),placeholder:n.$t("Select Status"),filterable:"",onChange:p(a).applyFilterChange,"popper-class":"fct-dropdown-compact",size:"small"},{default:i(()=>[(d(!0),_(H,null,ee(e.filterItem.options,A=>(d(),E(o,{key:A.value,label:A.label,value:A.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])}}},hm={__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,n=t,s=a.filterState,o=V(null),u=j({get:()=>a.modelValue,set:g=>n("update:modelValue",g)}),A=j(()=>Ie.get("app_config.isProActive"));function f(g){n("change",g)}function m(){s.data.dateRange=[Yt.withTimezone(Re().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Yt.withTimezone(Re().format("YYYY-MM-DD 23:59:59"))],n("change",s.data.dateRange)}return xn(()=>{}),(g,y)=>{const v=C("el-date-picker"),B=Ca("translate-numbers");return d(),_("div",{class:de(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Dt(l(v,{ref_key:"datePickerRef",ref:o,modelValue:u.value,"onUpdate:modelValue":y[0]||(y[0]=b=>u.value=b),type:e.type,"range-separator":e.separator,"start-placeholder":e.startPlaceholder||p(c)("Start date"),"end-placeholder":e.endPlaceholder||p(c)("End date"),"unlink-panels":e.unlinkPanels,clearable:e.clearable,shortcuts:p(dp),onChange:f,placement:e.placement,disabled:e.disabled||!A.value},null,8,["modelValue","type","range-separator","start-placeholder","end-placeholder","unlink-panels","clearable","shortcuts","placement","disabled"]),[[B,"translate-numbers"]]),e.showArrow?(d(),E(W,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):x("",!0),A.value&&e.clearable?(d(),E(W,{key:1,onClick:m,name:"CircleClose",class:"fct-applied-filter-clear-all"})):x("",!0)],2)}}},_m={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,n=t,s=j({get:()=>a.modelValue,set:u=>n("update:modelValue",u)}),o=u=>{n("change",u)};return(u,A)=>{const f=C("el-option"),m=C("el-select");return d(),E(m,{modelValue:s.value,"onUpdate:modelValue":A[0]||(A[0]=g=>s.value=g),placeholder:u.$t("Select Currency"),filterable:"",onChange:o,"popper-class":"fct-dropdown-compact",size:"small"},{default:i(()=>[(d(!0),_(H,null,ee(e.currencies,(g,y)=>(d(),E(f,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},Bq={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(n,s)=>(d(),_("button",{onClick:s[0]||(s[0]=(...o)=>p(a).resetFilters&&p(a).resetFilters(...o)),class:"reset-filters-btn"},h(n.$t("Reset Filters")),1))}},kq={__name:"MultiselectFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const t=e,a=t.filterState,n=j({get:()=>{var s;return((s=a.data.selectedFilters[t.filterItemKey])==null?void 0:s.value)??[]},set:s=>{a.setMultiSelectChange(t.filterItemKey,s)}});return(s,o)=>{const u=C("el-option"),A=C("el-select");return d(),E(A,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=f=>n.value=f),placeholder:s.$t("Select Order Type"),multiple:"",filterable:"","popper-class":"fct-dropdown-compact fct-multi-select-filter",size:"small"},{default:i(()=>[(d(!0),_(H,null,ee(e.filterItem.options,f=>(d(),E(u,{key:f.value,label:f.label,value:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},xq={class:"fct-compare-to-filter"},Sq={class:"fct-applied-filter-label"},Fq={class:"fct-applied-filter-actions"},Eq={class:"fct-compare-to-select"},Uq={class:"fct-compare-to-date"},$q={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,n=t,s=a.filterState,o=j({get:()=>{var f;return((f=s.data.selectedFilters.compareType)==null?void 0:f.value)??s.data.compareType},set:f=>{s.setCompareTypeChange(f),n("selectChange",f)}}),u=j({get:()=>{var f;return((f=s.data.selectedFilters.compareDate)==null?void 0:f.value)??s.data.compareDate},set:f=>{s.setCompareDateChange(f),n("dateChange",f)}}),A=j(()=>Ie.get("app_config.isProActive"));return(f,m)=>{const g=C("el-option"),y=C("el-select"),v=C("el-date-picker");return d(),_("div",xq,[r("div",Sq,h(p(c)("Compare to")),1),r("div",Fq,[r("div",Eq,[l(y,{modelValue:o.value,"onUpdate:modelValue":m[0]||(m[0]=B=>o.value=B),"popper-class":"fct-dropdown-compact",disabled:!A.value},{default:i(()=>[l(g,{label:p(c)("Previous Period"),value:"previous_period"},null,8,["label"]),l(g,{label:p(c)("Previous Month"),value:"previous_month"},null,8,["label"]),l(g,{label:p(c)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),l(g,{label:p(c)("Previous Year"),value:"previous_year"},null,8,["label"]),l(g,{label:p(c)("Custom"),value:"custom"},null,8,["label"]),l(g,{label:p(c)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),r("div",Uq,[o.value==="custom"?(d(),E(v,{key:0,modelValue:u.value,"onUpdate:modelValue":m[1]||(m[1]=B=>u.value=B),type:"date",size:"small",placeholder:p(c)("Select Date")},null,8,["modelValue","placeholder"])):x("",!0)])])])}}},Dq={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},Qq={key:0},gm={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,n=V([]),s=V([]),o=V(!1),u=Qt().ctx,A=v=>{const B=vt.get("product_variations");if(B&&(n.value=B),n.value.length&&!v){s.value=[...n.value];return}if(v&&n.value.length){s.value=n.value.filter(b=>b.label.toLowerCase().includes(v.toLowerCase()));return}o.value=!0,u.$get("products/searchVariantByName",{name:v}).then(b=>{n.value=b,s.value=b,vt.set("product_variations",b)}).catch(()=>{}).finally(()=>{o.value=!1})},f=(v,B)=>{const b=B.checkedNodes||[];a.setTreeSelectItem(b)},m=v=>{a.removeTreeSelectItem(v)},g=()=>{a.clearTreeSelect()},y=j(()=>{let v={},B={};s.value.forEach(w=>{v[w.label]=w.children,w.children.forEach(k=>{B[k.value]={productName:w.label,variationName:k.label}})});let b={};return a.data.variation_ids.forEach(w=>{if(B[w]){let k=B[w];b[k.productName]||(b[k.productName]=[]),b[k.productName].push(k.variationName)}else b.Unknown||(b.Unknown=[]),b.Unknown.push(w)}),Object.keys(b).forEach(w=>{var k;b[w].length===((k=v[w])==null?void 0:k.length)&&(b[w]=[])}),b});return Be(()=>{const v=a.retrieveSavedReportFilters();v&&v.variation_ids&&(a.data.variation_ids=v.variation_ids),A("")}),(v,B)=>{const b=C("el-tag"),w=C("el-tree-select");return d(),E(w,{placeholder:v.$t("Select Products"),modelValue:p(a).data.variation_ids,"onUpdate:modelValue":B[0]||(B[0]=k=>p(a).data.variation_ids=k),data:s.value,"filter-method":p(nu).debounce(A),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:o.value,onCheck:f,"popper-class":"fct-tooltip-long",onRemoveTag:m,onClear:g,size:"small"},{tag:i(()=>[r("div",Dq,[(d(!0),_(H,null,ee(y.value,(k,S)=>(d(),E(b,{style:{"margin-right":"4px"}},{default:i(()=>[R(h(S)+" ",1),k.length?(d(),_("span",Qq," | "+h(k.join(", ")),1)):x("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},Iq={class:"fct-applied-filters-wrap"},Tq={class:"fct-applied-filter-list"},Vq={class:"fct-applied-filter fct-applied-filter-date"},Mq={class:"fct-applied-filter-label"},Lq={class:"fct-applied-filter-value"},Rq={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},Oq={class:"fct-applied-filter-label"},Hq={class:"fct-applied-filter-value"},Pq={key:2,class:"fct-applied-filter-clear-wrap"},Nq={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,n=fn(),s=({filterKey:f,itemId:m})=>{a.removeFilter(f,m)},o=f=>!(["dateRange","compareType","compareDate"].includes(f)||n.name==="reports_customer"),u=j(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(n.name)),A=j(()=>Object.keys(a.data.selectedFilters).filter(f=>!(f==="orderTypes"&&n.name==="reports_subscriptions")).reduce((f,m)=>(f[m]=a.data.selectedFilters[m],f),{}));return ge(a.data.dateRange,f=>{}),(f,m)=>(d(),_("div",Iq,[r("ul",Tq,[r("li",Vq,[r("div",Mq,h(f.$t("Date:")),1),r("div",Lq,[l(hm,{modelValue:p(a).data.dateRange,"onUpdate:modelValue":m[0]||(m[0]=g=>p(a).data.dateRange=g),placement:"bottom-start",reRenderDate:p(a).data.reRenderDate,showArrow:!0,size:"small",onChange:p(a).setDateRange,clearable:"",filterState:p(a)},null,8,["modelValue","reRenderDate","onChange","filterState"])])]),u.value?(d(),_("li",Rq,[l($q,{filterState:p(a)},null,8,["filterState"])])):x("",!0),Object.keys(A.value).length?(d(!0),_(H,{key:1},ee(A.value,(g,y)=>(d(),_(H,{key:y},[o(y)?(d(),_("li",{key:0,class:de(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[r("div",Oq,h(g.label)+":",1),r("div",Hq,[g.type==="list"?(d(),E(Cq,{key:0,"filter-state":p(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):x("",!0),g.type==="multi-list"?(d(),E(kq,{key:1,"filter-state":p(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):y==="variation_ids"?(d(),E(gm,{key:2,"filter-state":p(a)},null,8,["filter-state"])):y==="currency"?(d(),E(_m,{key:3,modelValue:p(a).data.currency,"onUpdate:modelValue":m[1]||(m[1]=v=>p(a).data.currency=v),currencies:p(a).currencies,onChange:v=>{p(a).setSelectChange(v,{...g,value:y})}},null,8,["modelValue","currencies","onChange"])):x("",!0)]),y!=="variation_ids"?(d(),E(wq,{key:0,filterKey:y,itemId:y==="variation_ids"?g.value[0].id:null,onRemove:s},null,8,["filterKey","itemId"])):x("",!0)],2)):x("",!0)],64))),128)):x("",!0),Object.keys(A.value).length?(d(),_("li",Pq,[l(Bq,{"filter-state":p(a)},null,8,["filter-state"])])):x("",!0)])]))}},Kq={class:"fct-filter-dropdown-header"},Gq={key:0,class:"fct-filter-back-wrapper"},jq={class:"fct-filter-active-label"},zq={key:1,class:"fct-filter-dropdown-search-input"},Yq={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(n,s)=>{const o=C("el-input");return d(),_("div",Kq,[p(a).data.activeFilter!=null?(d(),_("div",Gq,[r("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=u=>p(a).selectActiveFilter(null))},[l(W,{name:"ArrowLeft"})]),r("span",jq,h(p(a).activeFilterOptions.label),1)])):(d(),_("div",zq,[l(o,{modelValue:p(a).data.searchQuery,"onUpdate:modelValue":s[1]||(s[1]=u=>p(a).data.searchQuery=u),placeholder:n.$t("Search Filter..."),clearable:""},null,8,["modelValue","placeholder"])]))])}}},qq={class:"fct-filter-dropdown-active-filter-list"},Wq=["onClick"],Xq={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(n,s)=>(d(),_("ul",qq,[(d(!0),_(H,null,ee(p(a).activeFilterOptions.options,(o,u)=>(d(),_("li",{key:u,class:de(["fct-filter-active-option-item",{"is-selected":p(a).isFilterOptionSelected(o)}])},[r("div",{class:"fct-filter-dropdown-active-button",onClick:A=>p(a).selectFilterOption(o)},h(o.label),9,Wq)],2))),128))]))}},Jq={class:"fct-filter-dropdown-active-filter-list is-multi-list"},Zq=["onClick"],eW={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(n,s)=>(d(),_("ul",Jq,[(d(!0),_(H,null,ee(p(a).activeFilterOptions.options,(o,u)=>(d(),_("li",{key:u,class:de(["fct-filter-active-option-item",{"is-selected":p(a).isFilterOptionSelectedMulti(o)}])},[r("div",{class:"fct-filter-dropdown-active-button",onClick:A=>p(a).selectFilterOptionMulti(o)},h(o.label),9,Zq)],2))),128))]))}},tW={class:"fct-filter-dropdown-active-filter"},aW={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(n,s)=>(d(),_("div",tW,[p(a).activeFilterOptions.type==="list"?(d(),E(Xq,{key:0,"filter-state":p(a)},null,8,["filter-state"])):x("",!0),p(a).activeFilterOptions.type==="multi-list"?(d(),E(eW,{key:1,"filter-state":p(a)},null,8,["filter-state"])):x("",!0),p(a).activeFilterOptions.type==="date"?(d(),E(hm,{key:2,modelValue:p(a).data.dateRange,"onUpdate:modelValue":s[0]||(s[0]=o=>p(a).data.dateRange=o),onChange:p(a).setDateRange},null,8,["modelValue","onChange"])):x("",!0),p(a).activeFilterOptions.type==="currency"?(d(),E(_m,{key:3,modelValue:p(a).data.currency,"onUpdate:modelValue":s[1]||(s[1]=o=>p(a).data.currency=o),currencies:p(a).currencies,onChange:p(a).setSelectChange},null,8,["modelValue","currencies","onChange"])):x("",!0),p(a).activeFilterOptions.type==="tree-select"?(d(),E(gm,{key:4,"filter-state":p(a)},null,8,["filter-state"])):x("",!0)]))}},nW={class:"fct-filter-dropdown-list"},sW=["onClick"],lW={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},oW={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(n,s)=>(d(),_("ul",nW,[p(a).visibleFilters.length?(d(!0),_(H,{key:0},ee(p(a).visibleFilters,(o,u)=>(d(),_("li",{class:"fct-filter-dropdown-list-item",key:u},[r("div",{class:"fct-filter-dropdown-button",onClick:A=>p(a).selectActiveFilter(o)},[l(W,{name:o.icon},null,8,["name"]),R(" "+h(o.label),1)],8,sW)]))),128)):(d(),_("li",lW,h(p(a).data.searchQuery?p(c)("No filter found"):p(c)("All filters selected")),1))]))}},rW={key:0,class:"fct-filter-dropdown"},iW={class:"fct-filter-dropdown-body"},dW={key:1},uW={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=V(null),n=t.filterState,s=Ie.get("app_config.isProActive"),o=[{label:c("Order Type"),icon:"AppsLine",type:"multi-list",value:"orderTypes",disableRoutes:["reports_customer","reports_subscriptions"],options:[{label:c("All"),value:"all"},{label:c("One time"),value:"payment"},{label:c("Subscription"),value:"subscription"},{label:c("Renewal"),value:"renewal"}]},{label:c("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:c("Active"),value:"subscription"},{label:c("Renewal"),value:"renewal"},{label:c("Expired"),value:"expired"},{label:c("Canceled"),value:"canceled"}]},{label:c("Currency"),icon:"Currency",type:"currency",value:"currency",disableRoutes:["reports_products","reports_customer","reports_subscriptions"]},{label:c("Products"),icon:"ListView",type:"tree-select",value:"variation_ids",disableRoutes:["reports_customer"]}];n.setFilterOption(o);const u=A=>{const f=a.value,m=A.target,g=document.querySelectorAll(".el-picker-panel"),y=Array.from(g).some(v=>v.contains(m));f!=null&&f.contains(m)||y||(n.data.searchQuery="",n.dropdownOpen&&n.toggleDropdown())};return Be(()=>{document.addEventListener("click",u)}),xn(()=>{document.removeEventListener("click",u)}),(A,f)=>(d(),_("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:f[0]||(f[0]=Xe(()=>{},["stop"]))},[l(Oe,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:p(n).toggleDropdown},{default:i(()=>[l(W,{name:"Filter"})]),_:1},8,["onClick"]),l(vs,{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:i(()=>[p(n).dropdownOpen?(d(),_("div",rW,[p(s)?(d(),_(H,{key:0},[l(Yq,{"filter-state":p(n)},null,8,["filter-state"]),r("div",iW,[p(n).data.activeFilter!=null?(d(),E(aW,{key:0,"filter-state":p(n)},null,8,["filter-state"])):(d(),E(oW,{key:1,"filter-state":p(n)},null,8,["filter-state"]))])],64)):(d(),_("div",dW,[l(co,{class:"py-7.5",title:p(c)("Upgrade to Pro for filtering"),text:p(c)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))])):x("",!0)]),_:1})],512))}},cW={class:"fct-report-nav-links-wrap"},AW={class:"fct-settings-nav-collapse-button-wrapper"},pW={class:"fct-menu-collapse-button-text"},fW=["onClick"],mW={class:"fct-settings-nav-link-text"},hW={class:"fct-settings-nav-child-list"},_W=["onClick"],gW={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=ja(),n=fn(),s=[{route:"reports_overview",label:c("Overview"),url:"/reports/overview",icon:"Overview"},{route:"reports_sales",label:c("Sales"),url:"/reports/sales",icon:"LineChart"},{route:"reports_orders",label:c("Orders"),url:"/reports/orders",icon:"Cart"},{route:"reports_revenue",label:c("Revenue"),url:"/reports/revenue",icon:"Revenue"},{route:"reports_refunds",label:c("Refunds"),url:"/reports/refunds",icon:"Refund"},{route:"reports_subscriptions",label:c("Subscriptions"),url:"/reports/subscriptions",icon:"Subscription",always_open:!0,child:[{route:"subscriptions-retention",label:c("Retention"),url:"/reports/subscriptions/subscriptions-retention"},{route:"subscriptions-cohorts",label:c("Cohorts"),url:"/reports/subscriptions/subscriptions-cohorts"},{route:"future_renewals",label:c("Future Renewals"),url:"/reports/subscriptions/future-renewals"}]},{route:"reports_products",label:c("Products"),url:"/reports/products",icon:"Product"},{route:"reports_customer",label:c("Customers"),url:"/reports/customer",icon:"Users"},{route:"reports_sources",label:c("Sources"),url:"/reports/sources",icon:"Source"}],o=V(!1),u=V(!1),A=V(window.innerWidth>=1024),f=t,m=V(null),g=V(null),y=L=>!L.child||!(!$.value||F.value)?!1:v(L)||L.always_open,v=L=>{const Q=n.path;return!!(L.child&&L.child.length&&L.child.some(D=>Q===D.url||Q.includes(D.url))||Q===L.url||Q.includes(L.url))},B=(L,Q,T)=>n.path===L.url,b=L=>{a.push({name:L.route}).catch(T=>{T.name});const Q=document.querySelector("#fct-report-body");Q&&(Q.scrollTop=0)},w=()=>{if(!A.value){m.value&&m.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open");return}o.value=!o.value,u.value=!1},k=()=>{A.value||(m.value&&m.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},S=()=>{const L=window.innerWidth,Q=A.value;A.value=L>=1024,!Q&&A.value&&(m.value&&m.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open")),Q&&!A.value&&(o.value=!1)};ge([o,u,A],()=>{f("update:menuState",{isMenuCollapsed:o.value,isMenuExpanded:u.value,isDesktopView:A.value})},{immediate:!0});const $=j(()=>o.value),F=j(()=>A.value&&o.value&&u.value);return Be(()=>{S(),window.addEventListener("resize",S)}),At(()=>{window.removeEventListener("resize",S)}),(L,Q)=>{const T=C("el-button"),D=C("el-tooltip");return d(),_("div",cW,[r("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:k},null,512),r("div",{ref_key:"sidebarRef",ref:m,class:de(["fct-settings-nav-container",{"is-collapsed":$.value,"is-expanded":F.value}])},[r("div",AW,[l(D,{content:p(c)("Toggle reports"),placement:"right"},{default:i(()=>[l(T,{onClick:w},{default:i(()=>[l(W,{name:"Window"}),r("span",pW,h(p(c)("Reports")),1)]),_:1})]),_:1},8,["content"])]),r("ul",{class:"fct-settings-nav",onMouseenter:Q[0]||(Q[0]=U=>A.value&&o.value&&(u.value=!0)),onMouseleave:Q[1]||(Q[1]=U=>u.value=!1)},[(d(),_(H,null,ee(s,(U,I)=>r("li",{key:I,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(U)}])},[r("div",{onClick:O=>b(U),class:"fct-settings-nav-link"},[U.icon?(d(),E(W,{key:0,name:U.icon,class:"w-5 h-5"},null,8,["name"])):x("",!0),r("span",mW,[R(h(U.label)+" ",1),l(W,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,fW),l(ra,{accordion:"",visible:y(U),class:"fct-settings-nav-child-wrap"},{default:i(()=>[r("ul",hW,[(d(!0),_(H,null,ee(U.child,(O,P)=>(d(),_("li",{key:P,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":B(O,P,U)}])},[r("div",{onClick:K=>b(O),class:"fct-settings-nav-link"},h(O.label),9,_W)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},vW={class:"fct-reports-view-inner"},yW={class:"fct-report-body",id:"fct-report-body"},bW={key:0,class:"fct-report-filter-wrap"},wW={key:1,class:"fct-report-filter-button"},CW={class:"fct-report-body-inner"},BW={__name:"ReportsView",setup(e){var v;const t=V({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=Rf(),n=fn(),s=V((v=n.meta)==null?void 0:v.title),o=j(()=>Oa.data);a.onFilterChanged(B=>{m(B)});const u=j(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(n.name)),A=j(()=>["reports_overview","reports","future_renewals"].includes(n.name));let f=null;const m=B=>{Object.entries(B).forEach(([b,w])=>{let k=w.value;switch(w.type==="multi-list"&&(k=w.value.map(S=>S.value)),b){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":Oa.data[b]=k;break;case"dateRange":Oa.data.dateRange=w.value,Oa.data.rangeKey=w.rangeKey;break;case"variation_ids":Oa.data[b]=Array.isArray(w.value)?w.value.map(S=>S.id):[];break}}),Oa.onFilterChange()},g=()=>{var b,w;const B=a.retrieveSavedFilters();B?(a.data.selectedFilters={...B},((w=(b=B.dateRange)==null?void 0:b.value)==null?void 0:w.length)===2&&(a.data.dateRange=[B.dateRange.value[0],B.dateRange.value[1]])):a.data.selectedFilters={}},y=B=>{t.value=B};return ge(()=>n.name,(B,b)=>{var w;s.value=((w=n.meta)==null?void 0:w.title)||"Reports"}),Be(()=>{Oa.fetchReportMeta(),g(),f=document.getElementById("fluent_cart_plugin_app"),f&&f.classList.add("fct_report_page_plugin_app_wrap")}),At(()=>{f&&f.classList.remove("fct_report_page_plugin_app_wrap")}),xn(()=>{vt.remove("product_variations")}),(B,b)=>{const w=C("router-view");return d(),_("div",{class:de(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[r("div",vW,[l(gW,{"onUpdate:menuState":y}),r("div",yW,[l(ha,{heading:p(c)(s.value),"show-save-button":!1},null,8,["heading"]),!A.value||u.value?(d(),_("div",bW,[A.value?x("",!0):(d(),E(Nq,{key:0,"filter-state":p(a)},null,8,["filter-state"])),!A.value&&u.value?(d(),_("div",wW,[l(uW,{"filter-state":p(a)},null,8,["filter-state"])])):x("",!0)])):x("",!0),r("div",CW,[l(_a),o.value.storeMode!==o.value.filterMode&&o.value.filterMode&&o.value.filterMode!==""?(d(),E(Na,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:B.$t(`Your store is in ${o.value.storeMode} mode but you are watching data in ${o.value.filterMode} mode.`)},null,8,["content"])):x("",!0),l(w,null,{default:i(({Component:k})=>[(d(),E(bn(k),{reportFilter:p(Oa)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},kW=He(BW,[["__scopeId","data-v-15c60072"]]),xW={__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=V(null),n=(y,v,B,b)=>({name:y,type:v,data:B,smooth:!0,color:b,showSymbol:!0,areaStyle:{color:new ed(0,0,0,1,t.backgroundGradient.map(w=>({offset:w.offset,color:w.color})))}}),s=()=>{const y=[];return y.push(n("","line",t.yAxis,t.lineColor)),y},o=y=>{const v=y.split("-");if(v.length===3){const[B,b,w]=v;return`${Ua[parseInt(b)-1]} ${w}, ${B}`}else if(v.length===2){const[B,b]=v;return`${Ua[parseInt(b)-1]} ${B}`}else if(v.length===1){const[B]=v;return`${B}`}},u=j(()=>t.xAxis.map(y=>o(y)));let A=null;const f=()=>{if(a.value&&A==null){A=Mt(a.value);const y={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?`${Te.scaled(v)}`:v},grid:{show:!1,left:"10%",right:"10%",bottom:"80%"},xAxis:{type:"category",data:u.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()};A.setOption(y),window.addEventListener("resize",()=>{A.resize()})}},m=()=>{A&&A.setOption({xAxis:{data:t.xAxis},series:s()})};ge(()=>[t.xAxis,t.yAxis],()=>{ye(()=>{m()})});const g=()=>{m()};return Be(()=>{window.addEventListener("fluentCartCurrencyChange",g),ye(()=>{f()})}),At(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(d(),_("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},SW=He(xW,[["__scopeId","data-v-e1491f3e"]]);function vm(e){return Number(e)>0}function gs(e){return vm(e)?"text-red-500":""}function Bn(e,t=null){return(t!==null?t:vm(e))?`(${Te.scaled(e)})`:Te.scaled(e)}const FW=["innerHTML"],qs={__name:"ReportSummary",props:{amount:{type:[Number,String],required:!0},placement:{type:String,default:"top"},title:{type:String,default:""}},setup(e){const t=e,a=j(()=>t.title?t.title+" "+t.amount:t.amount);return(n,s)=>{const o=C("el-tooltip");return d(),E(o,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:i(()=>[r("span",null,h(a.value),1)]),default:i(()=>[r("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,FW)]),_:1},8,["placement"])}}},An={__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=j(()=>jt(t.fluctuation)),n=j(()=>(t.hasCurrency?Te.scaled:jt)(t.amount)),s=j(()=>(t.title?t.title:c("Previously"))+" "+n.value+(t.isPercentage?"%":"")),o=j(()=>{if(t.fluctuation===0)return"text-system-light";const A=t.fluctuation>0;return(t.isLiability?!A:A)?"text-success-500":"text-red-500"}),u=j(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(A,f)=>{const m=C("el-tooltip");return d(),_("div",{class:de(["percentage",o.value])},[e.fluctuation!==0?(d(),E(W,{key:0,class:"w-2",name:u.value},null,8,["name"])):x("",!0),l(m,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:i(()=>[r("span",null,h(s.value),1)]),default:i(()=>[r("span",{class:de(["cursor-pointer",o.value])},[R(h(a.value)+"% ",1),e.fluctuationSuffix?(d(),_(H,{key:0},[R(h(e.fluctuationSuffix),1)],64)):x("",!0)],2)]),_:1},8,["placement"])],2)}}},EW={class:"fct-report-result"},UW={key:0,class:"fct-report-result-content"},$W={key:1,class:"fct-report-result-content"},DW={class:"title flex items-center gap-1"},QW={class:"value"},IW={class:"inline-flex"},TW={key:2,class:"fct-report-result-chart"},VW={key:3,class:"fct-report-result-chart"},MW={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;j(()=>reportFilter.currentCurrencySign),j(()=>defaultReport.data.isBusy.salesReport);const a=(f,m)=>{const g=parseInt(f.replace("#",""),16),y=g>>16&255,v=g>>8&255,B=g&255;return`rgba(${y}, ${v}, ${B}, ${m})`},n=ke.colors.report,s=V([{title:c("Gross Sales"),key:"gross_sale",graph:"grossSaleGraph",lineColor:n.sea_green,backgroundGradient:[{offset:0,color:a(n.sea_green,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:c("The total sales you had in this period.")},{title:c("Refunds"),key:"total_refunded_amount",graph:"refundsGraph",lineColor:n.medium_slate_blue,backgroundGradient:[{offset:0,color:a(n.medium_slate_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:c("Refunds made in this period. This is deducted from gross sales to calculate revenue."),liability:!0},{title:c("Revenue"),key:"net_revenue",graph:"netRevenueGraph",lineColor:n.royal_blue,backgroundGradient:[{offset:0,color:a(n.royal_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:c("Gross sales less refunds, taxes, shipping, fees.")},{title:c("Orders"),key:"order_count",graph:"orderGraph",lineColor:n.medium_turquoise,backgroundGradient:[{offset:0,color:a(n.medium_turquoise,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:c("The total number of orders placed in this period.")},{title:c("Items"),key:"total_item_count",graph:"itemsSoldGraph",lineColor:n.deep_sky_blue,backgroundGradient:[{offset:0,color:a(n.deep_sky_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:c("The total number of items sold in this period.")},{title:c("Total Refunds"),key:"total_refunded",graph:"refundCountGraph",lineColor:n.golden_rod,backgroundGradient:[{offset:0,color:a(n.golden_rod,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:c("Total refunds count including partially refunds.")}]),o=j(()=>s.value.map(f=>({...f,value:t.defaultReport.summaryData[f.key]||0,fluctuation:t.defaultReport.fluctuations[f.key]||0,graph:t.defaultReport.data.graphs[f.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[f.graph]||!1,liability:f.liability||!1}))),u=f=>["net_revenue","total_refunded_amount","gross_sale"].includes(f),A=f=>u(f.key)?Bn(f.value,f.liability):jt(f.value);return(f,m)=>{const g=C("el-skeleton"),y=C("el-tooltip"),v=C("el-skeleton-item"),B=C("el-col"),b=C("el-row");return d(),E(St,{permission:"reports/view"},{default:i(()=>[l(b,{gutter:16,class:"gap-y-4"},{default:i(()=>[(d(!0),_(H,null,ee(o.value,(w,k)=>(d(),E(B,{lg:8,md:12,key:k},{default:i(()=>[l(fo,{class:"fct-report-summary-card h-[100px]"},{default:i(()=>[r("div",EW,[w.dataBusy?(d(),_("div",UW,[l(g,{animated:"",rows:1})])):(d(),_("div",$W,[r("div",DW,[R(h(w.title)+" ",1),l(y,{"popper-class":"fct-tooltip",content:w.info,placement:"top"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),r("div",QW,[r("div",IW,[l(qs,{amount:A(w),title:w.title},null,8,["amount","title"])]),l(An,{fluctuation:w.fluctuation,amount:e.defaultReport.data.previousSummary[w.key],"is-liability":w.liability,"has-currency":u(w.key)},null,8,["fluctuation","amount","is-liability","has-currency"])])])),w.dataBusy?(d(),_("div",TW,[l(g,{animated:"",class:"flex items-center justify-end"},{template:i(()=>[l(v,{variant:"circle",class:"w-12.5 h-12.5 flex-none"})]),_:1})])):x("",!0),!w.dataBusy&&Object.keys(w.graph).length>0?(d(),_("div",VW,[l(SW,{ref_for:!0,ref:"lineChart",xAxis:Object.keys(w.graph),yAxis:Object.values(w.graph),lineColor:w.lineColor,backgroundGradient:w.backgroundGradient,"has-currency":u(w.key)},null,8,["xAxis","yAxis","lineColor","backgroundGradient","has-currency"])])):x("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const LW={key:0,class:"fct-report-sold-product-list has-scroll"},RW={class:"list-left-content"},OW={class:"list-image"},HW=["src","alt"],PW=["src"],NW={class:"list-title"},KW={class:"list-title-inner"},GW={class:"list-id"},jW={class:"list-right-content"},zW={class:"list-value"},YW={class:"list-price"},qW={class:"inline-flex"},WW={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=$n.data,a=j(()=>$n.data.isBusy.topSoldVariants);return(n,s)=>{const o=C("el-skeleton"),u=C("router-link");return d(),E(St,{permission:"reports/view"},{default:i(()=>[l(fo,{class:"top-sold-variants","card-options":{heading:p(c)("Top Sold Variants")}},{default:i(()=>{var A,f;return[a.value?(d(),E(o,{key:0,animated:"",rows:7})):(d(),_(H,{key:1},[((f=(A=p(t))==null?void 0:A.topSoldVariants)==null?void 0:f.length)>0?(d(),_("ul",LW,[(d(!0),_(H,null,ee(p(t).topSoldVariants,m=>(d(),_("li",{key:m.product_id},[l(u,{to:{name:"product_edit",params:{product_id:m.product_id}}},{default:i(()=>{var g;return[r("div",RW,[r("div",OW,[m.media_url!==null?(d(),_("img",{key:0,src:m.media_url,alt:(g=m.media)==null?void 0:g.title},null,8,HW)):(d(),_("img",{key:1,src:n.getPlaceholderImage(),alt:""},null,8,PW))]),r("div",NW,[r("div",KW,h(m.variation_name),1),r("div",GW,[r("strong",null,h(m.product_name),1)])])]),r("div",jW,[r("div",zW,h(m.quantity)+" "+h(p(c)(" Sold")),1),r("div",YW,[r("div",qW,h(p(Te).scaled(m.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no item!")},null,8,["text"]))],64))]}),_:1},8,["card-options"])]),_:1})}}},XW={key:0,class:"flex items-center gap-2 justify-between"},JW={class:"fct-btn-group sm"},ZW={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=ke.colors,n=V(null),s=V(ke.isDark()),o=V("revenue"),u=V({}),A=S=>{const M=["#F6B51E","#855EF8","#47C2FF"],$=["#E6A819","#693EE0","#35ADE9"];return(s.value?$:M)[S]},f=j(()=>{if(typeof t.data.onetime_count===void 0)return[];if((t.data.onetime_count||0)===0&&(t.data.renewal_count||0)===0&&(t.data.subscription_count||0)===0)return[];const S={onetime:c("Onetime Payments"),renewal:c("Renewals"),subscription:c("Subscriptions")},M=t.data.order_count,$=[];return Object.keys(S).forEach((F,L)=>{$.push({name:S[F],value:t.data[F+"_count"]||0,count:t.data[F+"_count"]||0,gross:t.data[F+"_gross"]||0,net:t.data[F+"_net"]||0,percentage:M?(t.data[F+"_count"]/M*100).toFixed(2):0,color:A(L),visible:u.value[S[F]]!==!1})}),$}),m=j(()=>!f.value.length),g=j(()=>$n.data.isBusy.salesReport),y=j(()=>f.value.filter(S=>u.value[S.name]!==!1).map((S,M)=>({value:o.value==="revenue"?S.net:S.count,count:S.count,name:S.name,gross:S.gross,net:S.net,itemStyle:{color:A(f.value.findIndex($=>$.name===S.name))}})));let v=null;const B=()=>{v&&(v.dispose(),v=null),ye(()=>{n.value&&(v=Mt(n.value),b())})},b=()=>{if(!v)return;const S={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` |
| 164 |
<div style="font-weight: bold; margin-bottom: 4px;"> |
| 165 |
${M.marker} ${M.name} (${M.percent}%) |
| 166 |
</div> |
| 167 |
<div> |
| 168 |
<span style="color: ${$};">${c("Orders")}</span> |
| 169 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};"> |
| 170 |
${jt(M.data.count)} |
| 171 |
</span> |
| 172 |
</div> |
| 173 |
<div> |
| 174 |
<span style="color: ${$};">${c("Gross Sales")}</span> |
| 175 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};"> |
| 176 |
${Te.scaled(M.data.gross)} |
| 177 |
</span> |
| 178 |
</div> |
| 179 |
<div> |
| 180 |
<span style="color: ${$};">${c("Revenue")}</span> |
| 181 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};"> |
| 182 |
${Te.scaled(M.data.net)} |
| 183 |
</span> |
| 184 |
</div> |
| 185 |
`},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(S,{notMerge:!0,replaceMerge:["series"]})};ge([()=>f.value],()=>{ye(b)},{deep:!0}),ge(m,S=>{S||B()}),ge(g,S=>{S||B()}),ge(o,()=>{b()});const w=S=>{s.value=ke.isDark(),b()},k=()=>{b()};return Be(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",k),ye(B)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",w),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),(S,M)=>{const $=C("el-button"),F=C("el-button-group"),L=C("el-skeleton");return d(),E(fo,{class:"sales-sources","card-options":{heading:p(c)("Sources")}},{action:i(()=>[m.value?x("",!0):(d(),_("div",XW,[l(F,{class:"left"},{default:i(()=>[l($,{size:"small",onClick:M[0]||(M[0]=Q=>o.value="revenue"),type:o.value==="revenue"?"primary":""},{default:i(()=>[R(h(p(c)("Revenue")),1)]),_:1},8,["type"]),l($,{size:"small",onClick:M[1]||(M[1]=Q=>o.value="orders"),type:o.value==="orders"?"primary":""},{default:i(()=>[R(h(p(c)("Orders")),1)]),_:1},8,["type"])]),_:1}),r("div",JW,[l(pa,{targetRef:n.value},null,8,["targetRef"])])]))]),default:i(()=>[g.value?(d(),E(L,{key:0,animated:"",rows:7})):(d(),_(H,{key:1},[m.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("No relevant data to plot the chart")},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:n},null,512))],64))]),_:1},8,["card-options"])}}},eX={class:"fct-default-report-page"},tX={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V(t.reportFilter),n=async s=>{s&&(await $n.getSalesReport(s),await $n.getTopSoldProducts(s),await $n.getTopSoldVariants(s))};return Be(()=>{a.value&&a.value.addListener("default-report",n)}),At(()=>{a.value&&a.value.removeListener("default-report")}),ge(()=>t.reportFilter,s=>{a.value&&a.value.removeListener("default-report"),a.value=s,a.value&&(a.value.addListener("default-report",n),n(a.value.applicableFilters))},{immediate:!0}),(s,o)=>{const u=C("el-col"),A=C("el-row");return d(),_("div",eX,[l(MW,{"default-report":p($n)},null,8,["default-report"]),l(A,{gutter:30,class:"gap-y-4 my-5"},{default:i(()=>[l(u,{lg:12},{default:i(()=>[l(yu,{data:p($n).data.topSoldProducts,loading:p($n).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),l(u,{lg:12},{default:i(()=>[l(WW,{"default-report":p($n)},null,8,["default-report"])]),_:1}),x("",!0)]),_:1}),l(A,{gutter:30,class:"gap-y-4 my-5"},{default:i(()=>[l(u,{lg:12},{default:i(()=>[l(ZW,{data:p($n).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class aX extends Ya{constructor(){super(...arguments);Ee(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"]});Ee(this,"storageKey","report-checkbox-filter");Ee(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=vt.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,n){this.listeners[a]=n}async onCheckBoxChange(a,n){const s=this.data[a];s.includes(n)?this.data[a]=s.filter(o=>o!==n):this.data[a].push(n),this.syncStorage();for(let o in this.listeners)this.listeners[o](this.applicableFilters)}syncStorage(){vt.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 Kn=aX.init(),nX={class:"fct-revenue-line-chart-wrap"},sX={class:"flex items-center gap-2"},lX={class:"fct-card-header-title is-small"},oX={class:"fct-chart-select"},rX={class:"fct-btn-group sm"},iX={key:2,class:"chart-action-wrap"},dX={class:"chart-change-wrap"},uX={class:"chart-change"},cX={class:"text"},AX={class:"chart-change"},pX={class:"text"},fX={__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,n=V(null),s=V(Zt.getChartType("revenue","revenue_chart")||"line"),o=V(!1),u=ke.colors.report,A=V(ke.isDark()),f=(T,D,U,I,O,P=!1)=>({name:T,type:D,barMaxWidth:30,yAxisIndex:U,data:I,smooth:!1,color:O,hidden:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:O},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ma(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=V(a.appliedGroupKey);ge(()=>a.appliedGroupKey,T=>{m.value=T});const g=[{label:c("Default"),value:"default"},{label:c("Monthly"),value:"monthly"},{label:c("Yearly"),value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},B=j(()=>a.reportFilter.data.compareType!=="no_comparison"),b=j(()=>{let T=[{name:c("Current Revenue"),key:"net_revenue",type:s.value,color:A.value?u.dark_cyan_blue_36:u.light_gray_cyan_blue,data:a.chartData.map(D=>D.net_revenue)}];return B.value&&T.unshift({name:c("Compare Revenue"),key:"net_revenue",type:s.value,color:A.value?u.dark_cyan_blue_16:u.light_gray,data:a.compareData.map(D=>({value:D.net_revenue,date:D.group})),hidden:!1}),T.map(D=>f(D.name,D.type,0,D.data,D.color,D.hidden))});let w=null;const k=()=>{w&&(w.dispose(),w=null),ye(()=>{n.value&&(w=Mt(n.value),$())})},S=j(()=>{const T=zs(a.reportFilter.data.dateRange);return c("This report looks at the revenue you received ")+T}),M=j(()=>an(a.chartData.length)),$=()=>{if(!w)return;const T=In(a.chartData),D={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"},selected:Object.fromEntries(b.value.map(U=>[U.name,!U.hidden]))},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.dark_cyan_blue_16:u.light_gray_blue}},alwaysShowContent:!1,valueFormatter:U=>`${Te.scaled(U)}`,formatter:U=>{let I="";const O=A.value?"#ffffff":"#565865";return U.forEach(function(P,K){const ne=typeof P.data=="object"&&P.data!==null?Ys(P.data.date):P.name,Y=Te.scaled(P.value),N=U.length>1&&K===0;N&&(I+='<div style="margin-bottom: 10px">'),I+=`<div>${ne}</div>`,I+=`<div> |
| 186 |
${P.marker} |
| 187 |
<span style="color: ${O}">${P.seriesName}</span> |
| 188 |
<span style="float: right; margin-left: 20px; color: ${O}"> |
| 189 |
${jt(Y)} |
| 190 |
</span> |
| 191 |
</div>`,N&&(I+="</div>")}),I}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,formatter:U=>`${Te.scaled(U)}`},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(D,{notMerge:!0,replaceMerge:["series"]})},F=()=>{o.value=!o.value,o.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):$()},L=T=>{Zt.onChange("revenue","revenue_chart",T),s.value!==T&&(o.value=!1,s.value=T,$())};ge([()=>a.chartData,m],()=>{ye($)},{deep:!0}),ge(()=>Kn.data.revenue,()=>{ye(()=>{$()})},{deep:!0}),ge(()=>a.isEmpty,T=>{T||k()}),ge(()=>a.loading,T=>{T||k()});const Q=()=>{A.value=ke.isDark(),ye(()=>{$()})};return At(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",Q),window.addEventListener("fluentCartCurrencyChange",Q),ye(()=>{k()})}),(T,D)=>{const U=C("el-tooltip"),I=C("el-option"),O=C("el-select"),P=C("el-skeleton");return d(),_("div",nX,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",sX,[r("h5",lX,h(p(c)("Revenue Chart")),1),l(U,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:i(()=>[r("div",oX,[l(O,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":D[0]||(D[0]=K=>m.value=K),onChange:v},{default:i(()=>[(d(),_(H,null,ee(g,K=>l(I,{key:K.value,label:p(c)(K.label),value:K.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),r("div",rX,[l(jn,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:L},null,8,["activeType"]),l(Oe,{tag:"button",size:"small",title:p(c)("Zoom Chart"),onClick:F,class:de(o.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:n.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[e.loading?(d(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:n},null,512)),e.isEmpty?x("",!0):(d(),_("div",iX,[r("div",dX,[r("div",uX,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",cX,h(p(c)("Data")),1)]),r("div",AX,[r("span",pX,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},mX={components:{DynamicIcon:W},props:{data:{type:Array,required:!0},filename:{type:String,default:"data.csv"}},methods:{exportCSV(){const t=(s=>{const o=m=>m.replace(/_/g," ").replace(/\b\w/g,g=>g.toUpperCase()),u=Object.keys(s[0]),f=[u.map(o).join(",")];return s.forEach(m=>{const g=u.map(y=>{let v=m[y];return typeof v=="object"&&(v=JSON.stringify(v)),typeof v=="string"&&(v=`"${v.replace(/"/g,'""')}"`),v});f.push(g.join(","))}),f.join(` |
| 192 |
`)})(this.data),a=new Blob([t],{type:"text/csv"}),n=document.createElement("a");n.href=URL.createObjectURL(a),n.download=this.filename,n.click(),URL.revokeObjectURL(n.href)}}};function hX(e,t,a,n,s,o){const u=C("DynamicIcon"),A=C("el-button");return d(),E(A,{onClick:o.exportCSV,size:"small"},{default:i(()=>[l(u,{name:"Download"}),R(" "+h(e.$t("Export")),1)]),_:1},8,["onClick"])}const go=He(mX,[["render",hX]]),_X=["innerHTML"],gX=["innerHTML"],vX=["innerHTML"],yX=["innerHTML"],bX=["innerHTML"],wX=["innerHTML"],CX=["innerHTML"],BX=["innerHTML"],kX={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 n=a.year;return t[n]||(t[n]={year:n,order_count:0,net_revenue:0,gross_sale:0,total_refunded_amount:0,tax_total:0,shipping_total:0,items:[]}),t[n].order_count+=Number(a.order_count),t[n].net_revenue+=Number(a.net_revenue),t[n].gross_sale+=Number(a.total_sales),t[n].total_refunded_amount+=Number(a.total_refunds),t[n].tax_total+=Number(a.total_tax),t[n].shipping_total+=Number(a.shipping_total),t[n].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 Te.scaled(e)},liabilityClass:gs,maybeLiability:Bn}},xX=Object.assign(kX,{setup(e){return(t,a)=>{const n=C("el-skeleton"),s=C("el-table-column"),o=C("el-table"),u=C("el-empty");return d(),E(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Revenue Breakdown"),title_size:"small"},Rt({_:2},[e.loading?void 0:{name:"action",fn:i(()=>[l(go,{data:e.revenueReport,filename:"revenue.csv"},null,8,["data"])]),key:"0"}]),1032,["title"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[e.loading?(d(),E(n,{key:0,animated:"",rows:2,class:"p-4"})):(d(),E(o,{key:1,data:t.tableData,"row-key":"year","default-expand-all":!1,class:"w-full"},{empty:i(()=>[l(u,{description:p(c)("No data available")},null,8,["description"])]),default:i(()=>[t.dateFormat?(d(),E(s,{key:0,type:"expand"},{default:i(A=>[l(o,{data:A.row.items,"row-key":"month",size:"small",border:"",class:"w-full"},{default:i(()=>[l(s,{prop:"group",label:p(c)("Date"),"min-width":"160"},{default:i(f=>[R(h(p(Re)(f.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),l(s,{prop:"order_count",label:p(c)("Order Count"),"min-width":"140"},{default:i(f=>[R(h(p(c)(p(jt)(f.row.order_count))),1)]),_:1},8,["label"]),l(s,{prop:"total_sales",label:p(c)("Gross Sales"),"min-width":"150"},{default:i(f=>[r("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(f.row.total_sales))},null,8,_X)]),_:1},8,["label"]),l(s,{label:p(c)("Refunds"),"min-width":"150"},{default:i(f=>[r("div",{class:de(["inline-flex",p(gs)(f.row.total_refunds)]),innerHTML:p(Bn)(f.row.total_refunds)},null,10,gX)]),_:1},8,["label"]),t.tax_total>0?(d(),E(s,{key:0,prop:"total_tax",label:p(c)("Taxes"),"min-width":"150"},{default:i(f=>[r("div",{class:de(["inline-flex",p(gs)(f.row.total_tax)])},h(p(Bn)(f.row.total_tax)),3)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(d(),E(s,{key:1,prop:"shipping_total",label:p(c)("Shipping"),"min-width":"150"},{default:i(f=>[r("div",{class:de(["inline-flex",p(gs)(f.row.shipping_total)])},h(p(Bn)(f.row.shipping_total)),3)]),_:1},8,["label"])):x("",!0),l(s,{prop:"net_revenue",label:p(c)("Revenue"),"min-width":"180"},{default:i(f=>[r("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(f.row.net_revenue))},null,8,vX)]),_:1},8,["label"])]),_:2},1032,["data"])]),_:1})):x("",!0),l(s,{prop:"year",label:p(c)("Year"),"min-width":"50",fixed:""},null,8,["label"]),l(s,{prop:"order_count",label:p(c)("Order Count"),"min-width":"120"},{default:i(A=>[R(h(p(c)(p(jt)(A.row.order_count))),1)]),_:1},8,["label"]),l(s,{prop:"gross_sale",label:p(c)("Gross Sales"),"min-width":"150"},{default:i(A=>[r("div",{class:"inline-flex",innerHTML:t.formatCurrency(A.row.gross_sale)},null,8,yX)]),_:1},8,["label"]),l(s,{label:p(c)("Refunds"),"min-width":"150"},{default:i(A=>[r("div",{class:de(["inline-flex",p(gs)(A.row.total_refunded_amount)]),innerHTML:p(Bn)(A.row.total_refunded_amount)},null,10,bX)]),_:1},8,["label"]),t.tax_total>0?(d(),E(s,{key:1,prop:"tax_total",label:p(c)("Taxes"),"min-width":"150"},{default:i(A=>[r("div",{class:"inline-flex",innerHTML:t.formatCurrency(A.row.tax_total)},null,8,wX)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(d(),E(s,{key:2,prop:"shipping_total",label:p(c)("Shipping"),"min-width":"150"},{default:i(A=>[r("div",{class:"inline-flex",innerHTML:t.formatCurrency(A.row.shipping_total)},null,8,CX)]),_:1},8,["label"])):x("",!0),l(s,{prop:"net_revenue",label:p(c)("Revenue"),"min-width":"180"},{default:i(A=>[r("div",{class:"inline-flex",innerHTML:t.formatCurrency(A.row.net_revenue)},null,8,BX)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function uo(e){var t;return((t=Qh.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const SX={class:"px-5 pb-4"},FX={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton");return d(),E(s,{loading:e.loading,animated:""},{template:i(()=>[r("div",SX,[l(n,{class:"w-full h-7"})]),(d(),_(H,null,ee(8,o=>r("div",{key:o,class:"flex items-center gap-5 px-5"},[l(n,{class:"w-1/2 h-4 mb-3"}),l(n,{class:"w-1/2 h-4 mb-3"}),l(n,{class:"w-1/2 h-4 mb-3"}),l(n,{class:"w-1/2 h-4 mb-3"})])),64))]),_:1},8,["loading"])}}},EX={class:"fct-btn-group sm w-[240px] gap-2"},UX={class:"capitalize"},$X={class:"capitalize"},DX=["innerHTML"],QX=["innerHTML"],IX=["innerHTML"],TX=["innerHTML"],VX=["innerHTML"],MX={__name:"RevenueGroupedBy",props:{tableData:{type:Object},reportFilter:{type:Object},revenueReport:{type:Object}},emits:["fetch-data-by-group"],setup(e,{emit:t}){const a=e,n=t;j(()=>a.reportFilter.currentCurrencySign);const s=[{label:"Billing Country",value:"billing_country"},{label:"Shipping Country",value:"shipping_country"},{label:"Payment Method",value:"payment_method"}];V({offline_payment:"Cash On Delivery",paypal:"PayPal",stripe:"Stripe"});const o=V("billing_country"),u=()=>{n("fetch-data-by-group",o.value)};return(A,f)=>{const m=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return d(),E(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:A.$t("Grouped by"),title_size:"small"},{action:i(()=>[r("div",EX,[l(g,{class:"el-select--x-small",modelValue:o.value,"onUpdate:modelValue":f[0]||(f[0]=B=>o.value=B),onChange:u,placeholder:A.$t("Select Group")},{default:i(()=>[(d(),_(H,null,ee(s,B=>l(m,{key:B.value,label:A.$t(B.label),value:B.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),l(go,{data:e.tableData,filename:"revenue grouped by.csv",class:"!ml-0"},null,8,["data"])])]),_:1},8,["title"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[l(FX,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?x("",!0):(d(),E(v,{key:0,data:e.tableData,"max-height":"390"},{empty:i(()=>[l(at,{icon:"Empty/ListView","has-dark":!0,text:A.$t("Currently there is no data!")},null,8,["text"])]),default:i(()=>[o.value==="country"?(d(),E(y,{key:0,prop:"country",label:A.$t("Country"),"min-width":"150"},{default:i(B=>[R(h(B.row.country),1)]),_:1},8,["label"])):x("",!0),o.value==="shipping_country"?(d(),E(y,{key:1,prop:"country",label:A.$t("Country"),"min-width":"150"},{default:i(B=>[r("span",UX,h(p(uo)(B.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),o.value==="billing_country"?(d(),E(y,{key:2,prop:"country",label:A.$t("Country"),"min-width":"150"},{default:i(B=>[r("span",$X,h(p(uo)(B.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),o.value==="payment_method"?(d(),E(y,{key:3,prop:"payment_method",label:A.$t("Payment Method"),"min-width":"150"},{default:i(B=>[R(h(B.row.payment_method),1)]),_:1},8,["label"])):x("",!0),l(y,{prop:"order_count",label:A.$t("Order Count"),"min-width":"150"},{default:i(B=>[R(h(p(c)(B.row.orders)),1)]),_:1},8,["label"]),l(y,{prop:"total_sales",label:A.$t("Gross Sales"),"min-width":"150"},{default:i(B=>[r("div",{class:"inline-flex",innerHTML:p(Te).scaled(B.row.gross_sale)},null,8,DX)]),_:1},8,["label"]),l(y,{prop:"total_refunds",label:A.$t("Refunds"),"min-width":"150"},{default:i(B=>[r("div",{class:de(["inline-flex",p(gs)(B.row.total_refunds)]),innerHTML:p(Bn)(B.row.total_refunds)},null,10,QX)]),_:1},8,["label"]),A.total_tax>0?(d(),E(y,{key:4,prop:"total_tax",label:A.$t("Taxes"),"min-width":"150"},{default:i(B=>[r("div",{class:de(["inline-flex",p(gs)(B.row.total_tax)]),innerHTML:p(Bn)(B.row.total_tax)},null,10,IX)]),_:1},8,["label"])):x("",!0),A.shipping_total>0?(d(),E(y,{key:5,prop:"shipping_total",label:A.$t("Shipping"),"min-width":"150"},{default:i(B=>[r("div",{class:de(["inline-flex",p(gs)(B.row.shipping_total)]),innerHTML:p(Bn)(B.row.shipping_total)},null,10,TX)]),_:1},8,["label"])):x("",!0),l(y,{prop:"net_revenue",label:A.$t("Revenue"),"min-width":"150"},{default:i(B=>[r("div",{class:"inline-flex",innerHTML:p(Te).scaled(B.row.net_sale)},null,8,VX)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class LX extends Ya{constructor(){super(...arguments);Ee(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,n,s,o){o&&(this.data.isBusy[o]=!0),typeof n!="object"&&(n={});const u=re.get(`reports/${a}`,n);return this.resolvePromiseResponse(u,s,o),u}resolvePromiseResponse(a,n=null,s=null){a.then(o=>{s==null||n==null?Object.assign(this.data,o):this.data[s]=o[n]}).catch(o=>{}).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 ba=LX.init(),Gn={__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 n=C("el-skeleton-item"),s=C("el-skeleton");return d(),E(s,{loading:"loading",animated:""},{template:i(()=>[r("div",{class:de(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:ia(`--loader-grid-cols: ${e.count};`)},[(d(!0),_(H,null,ee(e.rows,o=>(d(),_(H,{key:o},[(d(!0),_(H,null,ee(e.count,u=>(d(),_("div",{key:u},[l(n),l(n,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},RX={class:"summary-item-inner"},OX={class:"value"},HX={class:"inner-value"},PX={class:"title"},NX={__name:"RevenueReportSummary",props:{reportFilter:{type:Object}},setup(e){const t=[{title:c("Gross Sales"),key:"gross_sale",info:c("The total sales you had in this period.")},{title:c("Refunds"),key:"total_refunded_amount",liability:!0,info:c("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:c("Taxes"),key:"tax_total",liability:!0,info:c("Taxes paid in orders. This is deducted from gross sales to calculate revenue.")},{title:c("Shipping"),key:"shipping_total",liability:!0,info:c("Shipping paid in orders. This is deducted from gross sales to calculate revenue.")},{title:c("Revenue"),key:"net_revenue",info:c("Gross sales less refunds, taxes, shipping, fees.")}],a=j(()=>t.map(s=>({key:s.key,title:s.title,value:ba.data.summary[s.key]||0,fluctuation:ba.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)),n=j(()=>ba.data.isBusy.revenueReport);return(s,o)=>{const u=C("el-tooltip");return n.value?(d(),E(Gn,{key:0,loading:n.value,count:a.value.length},null,8,["loading","count"])):(d(),_("div",{key:1,class:"fct-report-order-summary",style:ia(`--avg-grid-cols: ${a.value.length}`)},[(d(!0),_(H,null,ee(a.value,(A,f)=>(d(),_("div",{class:"summary-item",key:f},[r("div",RX,[r("div",OX,[r("div",HX,[l(qs,{amount:p(Bn)(A.value,A.liability),title:A.title},null,8,["amount","title"])]),l(An,{fluctuation:A.fluctuation,amount:p(ba).data.previousSummary[A.key],"is-liability":A.liability},null,8,["fluctuation","amount","is-liability"])]),r("div",PX,[R(h(A.title)+" ",1),l(u,{content:A.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},KX={name:"Comparison",components:{CardContainer:he,CardHeader:Ce,CardBody:me},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 n=parseFloat(t.net_revenue);let s={group:this.formatDate(t.group),net_revenue:n};if(this.hasComparison){const o=this.previousMetrics[a];if(o){const u=parseFloat(o.net_revenue),A=u?((n-u)/u*100).toFixed(2):"n/a";s.previous_revenue=u,s.percent_change=A,s.group=`${this.formatDate(t.group)} vs ${this.formatDate(o.group)}`}}e.push(s)}),e}},methods:{translate:c,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,n,s]=t;return`${Ua[parseInt(n)-1]} ${s}, ${a}`}else if(t.length===2){const[a,n]=t;return`${Ua[parseInt(n)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}},formatCurrency(e){return Te.scaled(e)}}},GX={class:"fct-revenue-comparison"},jX=["innerHTML"],zX=["innerHTML"];function YX(e,t,a,n,s,o){const u=C("CardHeader"),A=C("el-skeleton"),f=C("el-table-column"),m=C("el-table"),g=C("CardBody"),y=C("CardContainer");return d(),_("div",GX,[l(y,{class:"overflow-hidden"},{default:i(()=>[l(u,{title:o.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),l(g,{class:"px-0 pb-0"},{default:i(()=>[a.loading?(d(),E(A,{key:0,animated:"",rows:7,class:"p-4"})):(d(),E(m,{key:1,data:o.comparisonData,class:"w-full",maxHeight:"390"},{default:i(()=>[l(f,{label:o.translate("Period")},{default:i(v=>[R(h(v.row.group),1)]),_:1},8,["label"]),l(f,{label:o.translate("Current Revenue")},{default:i(v=>[r("div",{class:"inline-flex",innerHTML:o.formatCurrency(v.row.net_revenue)},null,8,jX)]),_:1},8,["label"]),a.hasComparison?(d(),_(H,{key:0},[l(f,{label:o.translate("Compare Revenue")},{default:i(v=>[r("div",{class:"inline-flex",innerHTML:o.formatCurrency(v.row.previous_revenue)},null,8,zX)]),_:1},8,["label"]),l(f,{label:o.translate("Change")+" (%)"},{default:i(v=>[r("span",{class:de(o.getPercentageClass(v.row.percent_change))},h(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const qX=He(KX,[["render",YX]]),WX={class:"fct-revenue-report-page"},XX={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V("default"),n=t.reportFilter,s=n.applicableFilters,o=(g,y="default")=>{ba.getReportData({params:{...g.params,groupKey:y}})},u=g=>{ba.getReportData({params:{...s.params,groupKey:g}})},A=g=>{g!==ba.data.appliedGroupKey&&(a.value=g,o(s,a.value))},f=g=>{ba.getReportByGroup({params:{...s.params,groupKey:g}})},m=g=>{o(g,a.value),ba.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return Be(()=>{n.addListener("revenue-report",m),m(s)}),At(()=>{n.removeListener("revenue-report")}),(g,y)=>(d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",WX,[l(NX,{reportFilter:p(n)},null,8,["reportFilter"]),l(fX,{chartData:p(ba).data.revenueReport,compareData:p(ba).data.previousMetrics,reportFilter:p(n),appliedGroupKey:a.value,onFilterData:A,"is-empty":!p(ba).data.summary.gross_sale,loading:p(ba).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),l(qX,{class:"my-7.5",currentMetrics:p(ba).data.revenueReport,previousMetrics:p(ba).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:p(n),loading:p(ba).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),l(xX,{revenueReport:p(ba).data.revenueReport,appliedGroupKey:a.value,onFetchData:u,loading:p(ba).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),l(MX,{tableData:p(ba).data.netRevenueByGroup,reportFilter:p(n),revenueReport:p(ba),onFetchDataByGroup:f},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class JX extends Ya{constructor(){super(...arguments);Ee(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,n,s,o){this.data.isBusy[o]=!0,typeof n!="object"&&(n={});const u=re.get(`reports/${a}`,n);return this.resolvePromiseResponse(u,s,o),u}resolvePromiseResponse(a,n=null,s=null){a.then(o=>{s==null||n==null?Object.assign(this.data,o):this.data[s]=o[n]}).catch(o=>{}).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 gt=JX.init(),ZX={key:1,class:"fct-report-order-summary summary-col-4"},eJ={class:"summary-item-inner"},tJ={class:"value"},aJ={key:0,class:"summary-checkbox"},nJ={class:"inner-value"},sJ={class:"title"},lJ={__name:"Summary",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=[{title:c("Gross Sales"),key:"gross_sale",content:c("The total sales you had in this period."),checkable:!0,hasCurrency:!0},{title:c("Refunds"),key:"total_refund",liability:!0,hasCurrency:!0,content:c("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:c("Revenue"),key:"net_revenue",hasCurrency:!0,content:c("Gross sales less refunds, taxes, shipping, fees."),checkable:!0},{title:c("Orders"),key:"order_count",content:c("The total number of orders placed in this period."),checkable:!0,hideCurrency:!0},{title:c("Items"),key:"total_item_count",content:c("The total number of items sold in this period."),hideCurrency:!0},{title:c("Average Gross"),key:"average_gross",hasCurrency:!0,content:c("Average gross sales per order in this period.")},{title:c("Average Revenue"),key:"average_net",hasCurrency:!0,content:c("Average revenue per order in this period.")},{title:c("Average Order Items"),key:"average_order_items_count",content:c("Average number of items per order in this period."),hideCurrency:!0}],n=j(()=>a.map(f=>({...f,value:t.orderReport.data.summary[f.key]||0,fluctuation:t.orderReport.data.fluctuations[f.key]||0,liability:f.liability||!1,hasCurrency:f.hasCurrency||!1}))),s=j(()=>a.filter(f=>!f.hideCurrency).map(f=>f.key)),o=j(()=>t.orderReport.data.isBusy.orderChartData),u=f=>{Kn.onCheckBoxChange("order",f)},A=f=>s.value.includes(f.key)?Bn(f.value,f.liability):jt(f.value);return(f,m)=>{const g=C("el-checkbox"),y=C("el-tooltip");return o.value?(d(),E(Gn,{key:0,count:4,rows:2})):(d(),_("div",ZX,[(d(!0),_(H,null,ee(n.value,(v,B)=>(d(),_("div",{class:"summary-item",key:B},[r("div",eJ,[r("div",tJ,[v.checkable?(d(),_("div",aJ,[l(g,{"true-value":!0,"false-value":!1,"model-value":p(Kn).data.order.includes(v.key),onChange:()=>u(v.key)},null,8,["model-value","onChange"])])):x("",!0),r("div",nJ,[l(qs,{amount:A(v),title:v.title},null,8,["amount","title"])]),l(An,{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"])]),r("div",sJ,[R(h(v.title)+" ",1),l(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},oJ={__name:"OrderHeatMap",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);let n=null;const s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],o=ke.colors,u=V(ke.isDark()),A=j(()=>{const b=[];return t.chartData.forEach((w,k)=>{s.forEach((S,M)=>{b.push([k,M,w[S]])})}),b}),f=j(()=>t.chartData.length?Math.max(...t.chartData.flatMap(b=>s.map(w=>b[w]||0))):0),m=j(()=>u.value?["#000000",o.blue[500]]:["#ffffff",o.blue[600]]),g=j(()=>Object.values(t.chartData).every(b=>b.order_count===0)),y=j(()=>gt.data.isBusy.orderByDayAndHour),v=()=>{n&&(n.dispose(),n=null),ye(()=>{if(a.value){n=Mt(a.value,null,{renderer:"svg"});const b=t.chartData.map(S=>S.hour),w=s,k={tooltip:{position:"top",backgroundColor:u.value?"#253241":"#ffffff",borderColor:u.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:u.value?"#ffffff":"#565865"},formatter:S=>{const M=u.value?"#ffffff":"#000000";let $=`<div style="color: ${M};"><div>${s[S.data[1]]}, ${S.name||"-"}</div>`;return $+=`<div style="color: ${M};"> |
| 193 |
${S.marker} |
| 194 |
<span style="color: ${M};">${S.seriesName}</span> |
| 195 |
<span style="float: right; margin-left: 20px; color: ${M};"> |
| 196 |
${S.data[2]} |
| 197 |
</span> |
| 198 |
</div>`,$+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:b,axisLabel:{color:u.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},yAxis:{type:"category",data:w,axisLabel:{color:u.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},visualMap:{min:0,max:f.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:m.value}},series:[{name:c("Orders"),type:"heatmap",data:A.value,label:{show:!0},itemStyle:{borderColor:"#e0e0e0",borderWidth:1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};n.setOption(k)}})};ge([A,f],()=>{ye(()=>{v()})}),ge(g,b=>{b||v()}),ge(y,b=>{b||v()});const B=()=>{u.value=ke.isDark(),ye(()=>{v()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",B),ye(()=>{v(),window.addEventListener("resize",()=>n==null?void 0:n.resize())})}),xn(()=>{n&&(window.removeEventListener("resize",()=>n==null?void 0:n.resize()),window.removeEventListener("onFluentCartThemeChange",B,!1),n.dispose(),n=null)}),(b,w)=>{const k=C("el-skeleton");return d(),E(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[y.value?(d(),E(k,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(d(),_(H,{key:1},[g.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512))],64))]),_:1})]),_:1})}}},rJ={class:"fct-gross-sale-vs-net-revenue-wrap"},iJ={class:"flex items-center gap-2"},dJ={class:"fct-card-header-title is-small"},uJ={class:"fct-chart-select"},cJ={class:"fct-btn-group sm"},AJ={key:2,class:"chart-action-wrap"},pJ={class:"chart-change-wrap"},fJ={class:"chart-change"},mJ={class:"text"},hJ={class:"chart-change"},_J={class:"text"},gJ={__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,n=V(null),s=V("default"),o=V(Zt.getChartType("order","order_chart")||"line"),u=V(!1),A=ke.colors.report,f=V(ke.isDark()),m=[{value:"default",label:c("Default")},{value:"monthly",label:c("Monthly")},{value:"yearly",label:c("Yearly")}],g=t,y=()=>{g("fetch-chart-data",s.value)},v=j(()=>gt.data.isBusy.orderChartData),B=j(()=>[{title:c("Orders"),key:"order_count",color:f.value?A.dark_cyan_blue_16:A.light_gray,yAxisIndex:1,type:"bar"},{title:c("Gross Sales"),key:"gross_sale",color:f.value?A.blue_dark_mode:A.blue,yAxisIndex:0,type:"line"},{title:c("Revenue"),key:"net_revenue",color:f.value?A.purple_dark_mode:A.purple,yAxisIndex:0,type:"line"}].filter(({key:U})=>Kn.data.order.includes(U)).map(({title:U,key:I,color:O,yAxisIndex:P,type:K})=>L(U,K,P,a.chartData.map(G=>G[I]),O))),b=j(()=>a.chartData.map(U=>Ys(U.group)));let w=null;const k=V(!0),S=()=>{w&&(w.dispose(),w=null),ye(()=>{n.value&&(w=Mt(n.value),F(),w.on("legendselectchanged",U=>{k.value=U.selected.Orders}))})},M=j(()=>{const U=zs(a.reportFilter.data.dateRange);return c("This report looks at orders created ")+U}),$=j(()=>an(a.chartData.length)),F=()=>{if(!w)return;const U={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:f.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:f.value?"#253241":"#ffffff",borderColor:f.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:f.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:f.value?A.dark_cyan_blue_16:A.light_gray_blue}},formatter:I=>{let O=I[0].axisValue;const P=f.value?"#ffffff":"#565865";return I.forEach(function(K,G){const ne=G===0?K.value:Te.scaled(K.value);O+=`<div> |
| 199 |
${K.marker} |
| 200 |
<span style="color: ${P};">${K.seriesName}</span> |
| 201 |
<span style="float: right; margin-left: 20px; color: ${P};"> |
| 202 |
${ne} |
| 203 |
</span> |
| 204 |
</div>`}),O}},xAxis:{type:"category",data:b.value,axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12,interval:$.value.interval},axisLine:{lineStyle:{type:"dashed",color:f.value?"#253241":"#D6DAE1"}}},yAxis:[{name:c("Sales"),type:"value",position:"left",axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12,formatter:I=>`${Te.scaled(I)}`},splitLine:{show:!0,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:c("Orders"),type:"value",position:"right",axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:B.value};w.setOption(U,{notMerge:!0,replaceMerge:["series"]})},L=(U,I,O,P,K)=>({name:U,type:I,yAxisIndex:O,barMaxWidth:30,data:P,smooth:!1,color:K,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:K,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ma(K)},lineStyle:{color:K},areaStyle:{opacity:.3,color:K}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),Q=()=>{u.value=!u.value,u.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()};ge([()=>a.chartData,o],()=>{ye(F)},{deep:!0}),ge(()=>Kn.data.order,()=>{ye(()=>{F()})},{deep:!0}),ge(()=>a.isEmpty,U=>{U||S()}),ge(v,U=>{U||S()}),ge(k,()=>{if(!w)return;const I=w.getOption().series.map(O=>O.type==="line"?{...O,areaStyle:k.value?void 0:{opacity:.3}}:O);ye(()=>{w.setOption({series:I})})});const T=()=>{f.value=ke.isDark(),ye(()=>{F()})},D=()=>{ye(()=>{F()})};return At(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("fluentCartCurrencyChange",D,!1)}),Be(()=>{ye(S),window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("fluentCartCurrencyChange",D)}),(U,I)=>{const O=C("el-tooltip"),P=C("el-option"),K=C("el-select"),G=C("el-skeleton");return d(),_("div",rJ,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",iJ,[r("h5",dJ,h(p(c)("Order Chart")),1),l(O,{"popper-class":"fct-tooltip",content:M.value,placement:"top"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:i(()=>[r("div",uJ,[l(K,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":I[0]||(I[0]=ne=>s.value=ne),onChange:y},{default:i(()=>[(d(),_(H,null,ee(m,ne=>l(P,{key:ne.value,label:ne.label,value:ne.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),r("div",cJ,[l(Oe,{tag:"button",size:"small",title:p(c)("Zoom Chart"),onClick:Q,class:de(u.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:n.value},null,8,["targetRef"])])]),key:"0"}]),1024),l(me,null,{default:i(()=>[v.value?(d(),E(G,{key:0,animated:"",rows:4})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-chart-wrap fct-order-line-chart",ref_key:"chartRef",ref:n},null,512)),e.isEmpty?x("",!0):(d(),_("div",AJ,[r("div",pJ,[r("div",fJ,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",mJ,h(p(c)("Data")),1)]),r("div",hJ,[r("span",_J,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},vJ={class:"fct-report-monthly-list"},yJ={class:"list-left-content"},bJ={class:"list-title"},wJ={class:"list-right-content"},CJ={class:"list-value"},BJ={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=j(()=>Oa.currentCurrencySign),n=[{title:c("Average Monthly Gross"),key:"monthly_gross",currencySign:a,hasCurrency:!0},{title:c("Average Monthly Revenue"),key:"monthly_net",currencySign:a,hasCurrency:!0},{title:c("Average Monthly Orders"),key:"monthly_orders"},{title:c("Average Monthly Items"),key:"monthly_items"}],s=j(()=>n.map(u=>({...u,value:t.orderReport.data.summary[u.key]||0,fluctuation:t.orderReport.data.fluctuations[u.key]||0,hasCurrency:u.hasCurrency||!1}))),o=u=>["monthly_net","monthly_gross"].includes(u.key)?Te.scaled(u.value):jt(u.value);return(u,A)=>(d(),_("ul",vJ,[(d(!0),_(H,null,ee(s.value,(f,m)=>(d(),_("li",{key:m},[r("div",yJ,[r("div",bJ,h(f.title),1)]),r("div",wJ,[r("div",CJ,[l(qs,{amount:o(f),title:f.title},null,8,["amount","title"]),l(An,{fluctuation:f.fluctuation,amount:e.orderReport.data.previousSummary[f.key],"is-liability":!1,"has-currency":f.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},kJ={class:"fct-report-result-content"},xJ={class:"value"},SJ={class:"inline-flex"},FJ={class:"title"},EJ={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=j(()=>t.reportFilter.currentCurrencySign),n=[{title:c("Taxes"),content:c("Total amount of taxes"),key:"tax_total",currencySign:a.value},{title:c("Shipping"),content:c("Total amount of shipping costs"),key:"shipping_total",currencySign:a.value}],s=j(()=>n.map(o=>({...o,value:t.orderReport.data.summary[o.key]||0,fluctuation:t.orderReport.data.fluctuations[o.key]||0})).filter(o=>o.value>0));return(o,u)=>{const A=C("el-tooltip");return d(),_("div",{class:"fct-report-avg-wrap mb-7.5",style:ia(`--avg-grid-cols: ${s.value.length}`)},[(d(!0),_(H,null,ee(s.value,f=>(d(),_("div",{class:"fct-report-result",key:f.title},[r("div",kJ,[r("div",xJ,[r("span",SJ,h(p(Te).scaled(f.value)),1),f.fluctuation!==0?(d(),_("div",{key:0,class:"percentage",style:ia({color:f.fluctuation>0?"green":"red"})},[f.fluctuation>0?(d(),E(W,{key:0,class:"w-2",name:"CaretUp"})):x("",!0),f.fluctuation<0?(d(),E(W,{key:1,class:"w-2",name:"CaretDown"})):x("",!0),R(" "+h(p(jt)(f.fluctuation))+"% ",1)],4)):x("",!0)]),r("div",FJ,[R(h(f.title)+" ",1),f.content?(d(),E(A,{key:0,"popper-class":"fct-tooltip",content:f.content,placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):x("",!0)])])]))),128))],4)}}},UJ={class:"flex items-center gap-2"},$J={class:"fct-card-header-title is-small"},DJ={class:"fct-btn-group sm"},QJ=["innerHTML"],IJ=["innerHTML"],TJ=["innerHTML"],VJ=["innerHTML"],MJ={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;V("number");const a=V(!1),n=j(()=>gt.data.isBusy.newVsReturning),s=j(()=>{if(a.value===!0){const u=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],A={customer_type:"New"},f={customer_type:"Returning"};return u.forEach(m=>{const g=parseFloat(t.tableData[0][m]),y=parseFloat(t.tableData[1][m]),v=g+y;A[m]=g*100/v,f[m]=y*100/v}),[A,f]}return t.tableData});j(()=>t.reportFilter.currentCurrencySign),Be(()=>{});const o=u=>`${parseFloat(u).toFixed(2)}%`;return(u,A)=>{const f=C("el-tooltip"),m=C("el-checkbox"),g=C("el-skeleton"),y=C("el-table-column"),v=C("el-empty"),B=C("el-table");return d(),E(he,{class:"overflow-hidden",id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small"},{title:i(()=>[r("div",UJ,[r("h5",$J,h(p(c)("New vs. Returning Customers")),1),l(f,{"popper-class":"fct-tooltip",content:p(c)("Returning customers are those who first ordered before this period."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:i(()=>[r("div",DJ,[l(m,{modelValue:a.value,"onUpdate:modelValue":A[0]||(A[0]=b=>a.value=b),onChange:u.selectGroupKey},{default:i(()=>[R(h(p(c)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),l(go,{data:s.value,filename:"order_report.csv"},null,8,["data"])])]),_:1}),l(me,{class:"px-0 pb-0"},{default:i(()=>[n.value?(d(),E(g,{key:0,animated:"",rows:3,class:"p-3"})):(d(),E(B,{key:1,data:s.value,border:""},{empty:i(()=>[l(v,{text:p(c)("No data available")},null,8,["text"])]),default:i(()=>[l(y,{prop:"customer_type",label:p(c)("Type"),"min-width":"90"},{default:i(b=>[R(h(b.row.customer_type),1)]),_:1},8,["label"]),l(y,{prop:"customer_count",label:p(c)("Customer Count"),"min-width":"120"},{default:i(b=>[R(h(a.value?o(b.row.customer_count):b.row.customer_count),1)]),_:1},8,["label"]),l(y,{prop:"order_count",label:p(c)("Order Count"),"min-width":"150"},{default:i(b=>[R(h(a.value?o(b.row.order_count):b.row.order_count),1)]),_:1},8,["label"]),l(y,{prop:"gross_sales",label:p(c)("Gross Sales"),"min-width":"150"},{default:i(b=>[r("div",{class:"inline-flex",innerHTML:a.value?o(b.row.gross_sales):p(Te).scaled(b.row.gross_sales)},null,8,QJ)]),_:1},8,["label"]),l(y,{prop:"average_gross",label:p(c)("Average Gross Sales"),"min-width":"150"},{default:i(b=>[r("div",{class:"inline-flex",innerHTML:a.value?o(b.row.average_gross):p(Te).scaled(b.row.average_gross)},null,8,IJ)]),_:1},8,["label"]),l(y,{prop:"net_sales",label:p(c)("Revenue"),"min-width":"150"},{default:i(b=>[r("div",{class:"inline-flex",innerHTML:a.value?o(b.row.net_sales):p(Te).scaled(b.row.net_sales)},null,8,TJ)]),_:1},8,["label"]),l(y,{prop:"average_net",label:p(c)("Average Revenue"),"min-width":"150"},{default:i(b=>[r("div",{class:"inline-flex",innerHTML:a.value?o(b.row.average_net):p(Te).scaled(b.row.average_net)},null,8,VJ)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},LJ=He(MJ,[["__scopeId","data-v-7818e7a0"]]),RJ={class:"w-[240px] fct-btn-group gap-1.5"},OJ={class:"capitalize"},HJ={class:"capitalize"},PJ=["innerHTML"],NJ=["innerHTML"],KJ=["innerHTML"],GJ=["innerHTML"],jJ={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,n=V("billing_country"),s=a.applicableFilters;j(()=>a.currentCurrencySign);const o=()=>{gt.getOrderByGroup({params:{...s.params,groupKey:n.value}})},u=[{label:c("Billing Country"),value:"billing_country"},{label:c("Shipping Country"),value:"shipping_country"},{label:c("Payment Method"),value:"payment_method"}];return Be(()=>{o()}),(A,f)=>{const m=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return d(),E(he,{class:"overflow-hidden",id:"chartContainer"},{default:i(()=>[l(Ce,{title:p(c)("Orders grouped by"),title_size:"small"},{action:i(()=>[r("div",RJ,[l(g,{class:"el-select--x-small",modelValue:n.value,"onUpdate:modelValue":f[0]||(f[0]=B=>n.value=B),onChange:o,placeholder:p(c)("Select Group")},{default:i(()=>[(d(),_(H,null,ee(u,B=>l(m,{key:B.value,label:B.label,value:B.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),l(go,{data:p(gt).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[l(v,{data:p(gt).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:i(()=>[l(at,{icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!")},null,8,["text"])]),default:i(()=>[n.value==="payment_method"?(d(),E(y,{key:0,prop:"payment_method",label:p(c)("Payment Method"),"min-width":"150"},{default:i(B=>[R(h(B.row.payment_method),1)]),_:1},8,["label"])):x("",!0),n.value==="shipping_country"?(d(),E(y,{key:1,prop:"shipping_country",label:p(c)("Country"),"min-width":"150"},{default:i(B=>[r("span",OJ,h(p(uo)(B.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),n.value==="billing_country"?(d(),E(y,{key:2,prop:"billing_country",label:p(c)("Billing Country"),"min-width":"150"},{default:i(B=>[r("span",HJ,h(p(uo)(B.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),l(y,{prop:"orders",label:p(c)("Orders"),"min-width":"150"},{default:i(B=>[R(h(p(c)(B.row.orders)),1)]),_:1},8,["label"]),l(y,{prop:"gross_sale",label:p(c)("Gross Sales"),"min-width":"150"},{default:i(B=>[r("div",{class:"inline-flex",innerHTML:p(Te).scaled(B.row.gross_sale)},null,8,PJ)]),_:1},8,["label"]),l(y,{prop:"average_order_gross",label:p(c)("Average Gross Sales"),"min-width":"150"},{default:i(B=>[r("div",{class:"inline-flex",innerHTML:p(Te).scaled(B.row.average_order_gross)},null,8,NJ)]),_:1},8,["label"]),l(y,{prop:"net_sale",label:p(c)("Revenue"),"min-width":"150"},{default:i(B=>[r("div",{class:"inline-flex",innerHTML:p(Te).scaled(B.row.net_sale)},null,8,KJ)]),_:1},8,["label"]),l(y,{prop:"average_order_net",label:p(c)("Average Revenue"),"min-width":"150"},{default:i(B=>[r("div",{class:"inline-flex",innerHTML:p(Te).scaled(B.row.average_order_net)},null,8,GJ)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},zJ={class:"fct-report-spend-by-day-wrap"},YJ={class:"flex items-center gap-2"},qJ={class:"fct-card-header-title is-small"},WJ={class:"fct-btn-group sm"},XJ={key:2,class:"chart-action-wrap"},JJ={class:"chart-change-wrap"},ZJ={class:"chart-change"},eZ={class:"text"},tZ={class:"chart-change"},aZ={class:"text"},nZ={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=V(null);let n=null;V(Zt.getChartType("order","gross_sale_by_day_chart")||"line");const s=V(!1),o=j(()=>{const S=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort(($,F)=>$.day-F.day).map($=>S[$.day-1])}),u=j(()=>Object.values(t.chartData).every(S=>S.order_count===0)),A=j(()=>gt.data.isBusy.orderByDayAndHour),f=ke.colors.report,m=V(ke.isDark()),g=j(()=>[y("Gross Sale","line",0,t.chartData.map(S=>S.gross_sale),m.value?f.blue_dark_mode:f.blue),y("Orders","bar",1,t.chartData.map(S=>S.order_count),m.value?f.dark_cyan_blue_16:f.light_gray)]),y=(S,M,$,F,L)=>({name:S,type:M,barMaxWidth:30,data:F,smooth:!1,color:L,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},yAxisIndex:$,emphasis:{scale:2,itemStyle:{color:Ma(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!n)return;const S={title:{text:t.chartTitle,left:"center"},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?f.dark_cyan_blue_16:f.light_gray_blue}},formatter:M=>{let $=M[0].name;return M.forEach(F=>{const L=F.seriesName==="Gross Sale"?`${Te.scaled(F.value)}`:F.value,Q=m.value?"#ffffff":"#565865";$+=`<div> |
| 205 |
${F.marker} |
| 206 |
<span style="color: ${Q};">${F.seriesName}</span> |
| 207 |
<span style="float: right; margin-left: 20px; color: ${Q};"> |
| 208 |
${L} |
| 209 |
</span> |
| 210 |
</div>`}),$}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:o.value,axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",name:"Gross Sale",axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12,formatter:M=>`${Te.scaled(M)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:"Orders",position:"right",axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:m.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};n.setOption(S)},B=()=>{n&&(n.dispose(),n=null),ye(()=>{a.value&&(n=Mt(a.value),v())})},b=()=>{s.value=!s.value,s.value?n.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):n.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};ge(()=>[gt.data.grossSaleByDay],()=>{ye(()=>{v()})},{deep:!0}),ge(u,S=>{S||B()}),ge(A,S=>{S||B()});const w=()=>{m.value=ke.isDark(),ye(()=>{v()})},k=()=>{ye(()=>{v()})};return Be(()=>{ye(()=>{B(),t.reportFilter.addListener("spend-by-day",B),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",k)})}),At(()=>{n&&(n.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1),t.reportFilter.removeListener("spend-by-day",B,!1),window.removeEventListener("resize",()=>{n.resize()}))}),(S,M)=>{const $=C("el-tooltip"),F=C("el-skeleton");return d(),_("div",zJ,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",YJ,[r("h5",qJ,h(p(c)("Spend by day")),1),l($,{"popper-class":"fct-tooltip",content:p(c)("Gross sales grouped by the days of the week."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[u.value?void 0:{name:"action",fn:i(()=>[r("div",WJ,[l(Oe,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[A.value?(d(),E(F,{key:0,animated:"",rows:4,class:"p-3"})):(d(),_(H,{key:1},[u.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-spend-by-day-chart",ref_key:"chartRef",ref:a},null,512)),u.value?x("",!0):(d(),_("div",XJ,[r("div",JJ,[r("div",ZJ,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",eZ,h(S.$t("Gross Sale")),1)]),r("div",tZ,[r("span",aZ,h(S.$t("Days of the week")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},sZ={class:"fct-report-item-count-distribution-wrap"},lZ={class:"flex items-center gap-2"},oZ={class:"fct-card-header-title is-small"},rZ={class:"fct-btn-group sm"},iZ={key:2,class:"chart-action-wrap"},dZ={class:"chart-change-wrap"},uZ={class:"chart-change"},cZ={class:"text"},AZ={class:"chart-change"},pZ={class:"text"},fZ={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);V(t.chartData.length<=1?"bar":Zt.getChartType("order","item_count_distribtion_chart")||"bar");const n=V(!1);j(()=>{const S=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort(($,F)=>$.day-F.day).map($=>S[$.day-1])});const s=ke.colors,o=V(ke.isDark());let u=null;const A=()=>{n.value=!n.value,n.value?u.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}]}):u.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})},f=()=>{u&&u.resize()},m=j(()=>o.value?s.blue[500]+"52":s.blue[300]),g=j(()=>[{name:c("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(S=>S.order_count),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:o.value?s.blue[800]:s.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=j(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:o.value?"#253241":"#ffffff",borderColor:o.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:o.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:o.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(S=>S.item_count),axisLabel:{color:o.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:o.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:c("Orders"),axisLabel:{formatter:"{value}",color:o.value?"#FFFFFF":"#696778",fontSize:12},min:0,splitLine:{show:!0,lineStyle:{color:o.value?"#253241":"#D6DAE1",type:"dashed"}}},dataZoom:[],series:g.value})),v=j(()=>Object.values(t.chartData).every(S=>S.order_count===0)),B=j(()=>gt.data.isBusy.orderByDayAndHour),b=()=>{u&&(u.dispose(),u=null),ye(()=>{a.value&&(u=Mt(a.value),u.setOption(y.value),window.addEventListener("resize",f))})},w=()=>{u&&u.setOption(y.value)};ge(()=>t.chartData,()=>{u?u.setOption(y.value):ye(()=>{b()})}),ge(v,S=>{S||b()}),ge(B,S=>{S||b()});const k=()=>{o.value=ke.isDark(),ye(()=>{w()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),ye(()=>{b()})}),At(()=>{u&&(u.dispose(),window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("resize",f))}),(S,M)=>{const $=C("el-tooltip"),F=C("el-skeleton");return d(),_("div",sZ,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",lZ,[r("h5",oZ,h(p(c)("Item count distribution")),1),l($,{"popper-class":"fct-tooltip",content:p(c)("Grouping the orders by the number of items in each order."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:i(()=>[r("div",rZ,[l(Oe,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:A,class:de(n.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[B.value?(d(),E(F,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(d(),_(H,{key:1},[v.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-item-count-distribution-chart",ref_key:"chartRef",ref:a},null,512)),v.value?x("",!0):(d(),_("div",iZ,[r("div",dZ,[r("div",uZ,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",cZ,h(S.$t("Order Count")),1)]),r("div",AZ,[r("span",pZ,h(S.$t("Item Count")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},mZ={class:"fct-report-spend-by-hour-wrap"},hZ={class:"flex items-center gap-2"},_Z={class:"fct-card-header-title is-small"},gZ={class:"fct-btn-group sm"},vZ={key:2,class:"chart-action-wrap"},yZ={class:"chart-change-wrap"},bZ={class:"chart-change"},wZ={class:"text"},CZ={class:"chart-change"},BZ={class:"text"},kZ={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=V(null);let n=null;V(Zt.getChartType("order","gross_sale_by_hour_chart")||"line");const s=V(!1),o=j(()=>t.chartData.map(S=>S.hour)),u=j(()=>Object.values(t.chartData).every(S=>S.order_count===0)),A=j(()=>gt.data.isBusy.orderByDayAndHour),f=ke.colors.report,m=V(ke.isDark()),g=(S,M,$,F,L)=>({name:S,type:M,barMaxWidth:30,data:$,smooth:!1,color:F,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:F,borderRadius:[4,4,0,0]},yAxisIndex:L,emphasis:{scale:2,itemStyle:{color:Ma(F)},lineStyle:{color:F},areaStyle:{opacity:.3,color:F}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=j(()=>[{name:c("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map(S=>S.gross_sale),color:m.value?f.purple_dark_mode:f.purple},{name:c("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map(S=>S.order_count),color:m.value?f.dark_cyan_blue_16:f.light_gray}].map(S=>g(S.name,S.type,S.data,S.color,S.yAxisIndex))),v=()=>{if(!n)return;const S={title:{text:t.chartTitle,left:"center"},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?f.dark_cyan_blue_16:f.light_gray_blue}},formatter:M=>{let $=M[0].name;return M.forEach(F=>{const L=F.seriesName==="Gross Sale"?`${Te.scaled(F.value)}`:F.value,Q=m.value?"#ffffff":"#565865";$+=`<div> |
| 211 |
${F.marker} |
| 212 |
<span style="color: ${Q};">${F.seriesName}</span> |
| 213 |
<span style="float: right; margin-left: 20px; color: ${Q};"> |
| 214 |
${L} |
| 215 |
</span> |
| 216 |
</div>`}),$}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:o.value,axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}},axisTick:{alignWithLabel:!0}},yAxis:[{type:"value",name:c("Gross Sale"),axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12,formatter:M=>`${Te.scaled(M)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:c("Orders"),position:"right",axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:m.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};n.setOption(S)},B=()=>{n&&(n.dispose(),n=null),ye(()=>{a.value&&(n=Mt(a.value),v())})},b=()=>{s.value=!s.value,s.value?n.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):n.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};ge(()=>t.chartData,()=>{ye(()=>v())}),ge(u,S=>{S||B()}),ge(A,S=>{S||B()});const w=()=>{m.value=ke.isDark(),ye(()=>{v()})},k=()=>{ye(()=>{v()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",k),ye(()=>B())}),At(()=>{n&&(n.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1),window.removeEventListener("resize",()=>{n.resize()}))}),(S,M)=>{const $=C("el-tooltip"),F=C("el-skeleton");return d(),_("div",mZ,[l(he,null,{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",hZ,[r("h5",_Z,h(p(c)("Spend by hour ")),1),l($,{"popper-class":"fct-tooltip",content:p(c)("Gross Sales grouped by the hours of the day."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[u.value?void 0:{name:"action",fn:i(()=>[r("div",gZ,[l(Oe,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[A.value?(d(),E(F,{key:0,animated:"",rows:10,class:"px-3"})):(d(),_(H,{key:1},[u.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-spend-by-hour-chart",ref_key:"chartRef",ref:a},null,512)),u.value?x("",!0):(d(),_("div",vZ,[r("div",yZ,[r("div",bZ,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",wZ,h(S.$t("Gross Sale")),1)]),r("div",CZ,[r("span",BZ,h(S.$t("Hour")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},xZ={class:"fct-report-order-completion-time-wrap"},SZ={class:"flex items-center gap-2"},FZ={class:"fct-card-header-title is-small"},EZ={class:"fct-btn-group sm"},UZ={key:2,class:"chart-action-wrap"},$Z={class:"chart-change-wrap"},DZ={class:"chart-change"},QZ={class:"text"},IZ={class:"chart-change"},TZ={class:"text"},VZ={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);let n=null;V(Zt.getChartType("order","order_completion_time_chart")||"bar");const s=V(!1),o=j(()=>t.chartData.map(S=>S.hour)),u=ke.colors,A=V(ke.isDark()),f=j(()=>A.value?u.blue[500]+"52":u.blue[300]),m=j(()=>[{name:c("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(S=>S.orders),smooth:!1,color:f.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:A.value?u.blue[800]:u.blue[400]},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=j(()=>Object.values(t.chartData).every(S=>S.orders===0)),y=j(()=>gt.data.isBusy.orderCompletionTime),v=()=>{n&&n.resize()},B=()=>{if(!n)return;const S={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.report.dark_cyan_blue_16:u.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:o.value,axisLabel:{color:A.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:A.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:m.value};n.setOption(S)},b=()=>{n&&(n.dispose(),n=null),ye(()=>{a.value&&(n=Mt(a.value),B())})},w=()=>{s.value=!s.value,s.value?n.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):n.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};ge(()=>t.chartData,()=>{n?B():ye(()=>{b()})}),ge(g,S=>{S||b()}),ge(y,S=>{S||b()});const k=()=>{A.value=ke.isDark(),ye(()=>{B()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),ye(()=>b())}),At(()=>{n&&(n.dispose(),window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("resize",v))}),(S,M)=>{const $=C("el-tooltip"),F=C("el-skeleton");return d(),_("div",xZ,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",SZ,[r("h5",FZ,h(p(c)("Time between an order's created & completed date")),1),l($,{"popper-class":"fct-tooltip",content:p(c)("Orders grouped by based on their completion time in Hours."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:i(()=>[r("div",EZ,[l(Oe,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[y.value?(d(),E(F,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(d(),_(H,{key:1},[g.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:a},null,512)),g.value?x("",!0):(d(),_("div",UZ,[r("div",$Z,[r("div",DZ,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",QZ,h(p(c)("Order Count")),1)]),r("div",IZ,[r("span",TZ,h(p(c)("Hours")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},MZ={class:"fct-report-order-value-distribution-wrap"},LZ={class:"flex items-center gap-2"},RZ={class:"fct-card-header-title is-small"},OZ={class:"fct-btn-group sm"},HZ={key:2,class:"chart-action-wrap"},PZ={class:"chart-change-wrap"},NZ={class:"chart-change"},KZ={class:"text"},GZ={class:"chart-change"},jZ={class:"text"},zZ={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);let n=null;V(Zt.getChartType("order","order_value_distribution_chart")||"bar");const s=V(!1),o=j(()=>Object.keys(t.chartData)),u=ke.colors,A=V(ke.isDark()),f=j(()=>A.value?u.blue[500]+"52":u.blue[300]),m=j(()=>!Object.values(t.chartData).every(S=>S&&S!==0)),g=j(()=>gt.data.isBusy.orderValueDistribution),y=j(()=>[{name:c("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),smooth:!1,color:f.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:A.value?u.blue[800]:u.blue[400]},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=j(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.report.dark_cyan_blue_16:u.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:o.value,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:c("Orders"),axisLabel:{formatter:"{value}",color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value})),B=()=>{n&&(n.dispose(),n=null),ye(()=>{a.value?(n=Mt(a.value),n.setOption(v.value),window.addEventListener("resize",()=>{n.resize()})):n&&n.setOption(v.value)})},b=()=>{n&&n.setOption(v.value)},w=()=>{s.value=!s.value,s.value?n.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):n.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};ge(()=>t.chartData,()=>{n&&n.setOption(v.value)}),ge(m,S=>{S||B()}),ge(g,S=>{S||B()});const k=()=>{A.value=ke.isDark(),ye(()=>{b()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),ye(()=>{B()})}),At(()=>{n&&(n.dispose(),window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("resize",()=>{n.resize()}))}),(S,M)=>{const $=C("el-tooltip"),F=C("el-skeleton");return d(),_("div",MZ,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",LZ,[r("h5",RZ,h(p(c)("Order value distribution")),1),l($,{"popper-class":"fct-tooltip",content:p(c)("Orders grouped by based on their order value in different ranges."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[m.value?void 0:{name:"action",fn:i(()=>[r("div",OZ,[l(Oe,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[g.value?(d(),E(F,{key:0,animated:"",rows:4,class:"p-3"})):(d(),_(H,{key:1},[m.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-order-value-distribution-chart",ref_key:"chartRef",ref:a},null,512)),m.value?x("",!0):(d(),_("div",HZ,[r("div",PZ,[r("div",NZ,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",KZ,h(S.$t("Order Count")),1)]),r("div",GZ,[r("span",jZ,h(S.$t("Order Value Ranges")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},YZ={class:"fct-report-average-order-gross-wrap"},qZ={class:"flex items-center gap-2"},WZ={class:"fct-card-header-title is-small"},XZ={class:"fct-btn-group sm"},JZ={key:2,class:"chart-action-wrap"},ZZ={class:"chart-change-wrap"},eee={class:"chart-change"},tee={class:"text"},aee={class:"chart-change"},nee={class:"text"},see={__name:"AverageOrderGross",props:{chartData:{type:Array,required:!0},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=V(null);let n=null;V("line");const s=V(!1),o=ke.colors.report,u=V(ke.isDark()),A=j(()=>u.value?o.blue_dark_mode:o.blue),f=j(()=>gt.data.isBusy.orderChartData),m=j(()=>[{name:c("Average Order Gross"),type:"line",barMaxWidth:30,data:t.chartData.map(S=>S.average_order_gross),smooth:!1,color:A.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:A.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:Ma(A.value)},lineStyle:{color:A.value},areaStyle:{opacity:.3,color:A.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=j(()=>an(t.chartData.length)),y=()=>{n&&n.resize()},v=()=>{if(!n)return;const S=In(t.chartData),M={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:u.value?"#253241":"#ffffff",borderColor:u.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:u.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:u.value?o.dark_cyan_blue_16:o.light_gray_cyan_blue}},valueFormatter:$=>Te.scaled($)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:S,axisLabel:{color:u.value?"#ffffff":"#000000",fontSize:12,interval:g.value.interval},axisLine:{lineStyle:{type:"dashed",color:u.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:u.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:u.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};n.setOption(M)},B=()=>{n&&(n.dispose(),n=null),ye(()=>{a.value&&(n=Mt(a.value),v())})},b=()=>{s.value=!s.value,s.value?n.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):n.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};ge(()=>t.chartData,()=>{ye(()=>v())}),ge(t.isEmpty,S=>{S||B()}),ge(f,S=>{S||B()});const w=()=>{u.value=ke.isDark(),ye(()=>{v()})},k=()=>{v()};return Be(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",k),ye(()=>B())}),At(()=>{n&&(n.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),(S,M)=>{const $=C("el-tooltip"),F=C("el-skeleton");return d(),_("div",YZ,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{border_bottom:"",title_size:"small"},Rt({title:i(()=>[r("div",qZ,[r("h5",WZ,h(p(c)("Average Order Gross ")),1),l($,{"popper-class":"fct-tooltip",content:p(c)("Average Order Gross grouped by date period."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:i(()=>[r("div",XZ,[l(Oe,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[f.value?(d(),E(F,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-average-order-gross-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(d(),_("div",JZ,[r("div",ZZ,[r("div",eee,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",tee,h(S.$t("Average Order Gross")),1)]),r("div",aee,[r("span",nee,h(S.$t("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},lee={class:"fct-report-average-order-items-wrap"},oee={class:"flex items-center gap-2"},ree={class:"fct-card-header-title is-small"},iee={class:"fct-btn-group sm"},dee={key:2,class:"chart-action-wrap"},uee={class:"chart-change-wrap"},cee={class:"chart-change"},Aee={class:"text"},pee={class:"chart-change"},fee={class:"text"},mee={__name:"AverageOrderItems",props:{chartData:{type:Array,required:!0},chartRef:{},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=V(null);let n=null;V(Zt.getChartType("order","avg_order_items_chart")||"line");const s=V(!1),o=ke.colors.report,u=V(ke.isDark()),A=j(()=>u.value?o.purple_dark_mode:o.purple),f=j(()=>[{name:c("Average Order Items"),type:"line",barMaxWidth:30,data:Array.isArray(t.chartData)?t.chartData.map(S=>S.average_order_items_count):[],smooth:!1,color:A.value,showSymbol:!0,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:A.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:Ma(A.value)},lineStyle:{color:A.value},areaStyle:{opacity:.3,color:A.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),m=j(()=>an(t.chartData.length)),g=j(()=>{const S=In(t.chartData);return{title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:u.value?"#253241":"#ffffff",borderColor:u.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:u.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:u.value?o.dark_cyan_blue_16:o.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:S,axisLabel:{color:u.value?"#FFFFFF":"#696778",fontSize:12,interval:m.value.interval},axisLine:{lineStyle:{type:"dashed",color:u.value?"#253241":"#D6DAE1"}}},yAxis:{name:"Order Items",type:"value",axisLabel:{formatter:"{value}",color:u.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:u.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:f.value}}),y=j(()=>gt.data.isBusy.orderChartData),v=()=>{n&&n.resize()},B=()=>{n&&(n.dispose(),n=null),ye(()=>{a.value?(n=Mt(a.value),n.setOption(g.value),window.addEventListener("resize",v)):n&&n.setOption(g.value)})},b=()=>{n&&n.setOption(g.value)},w=()=>{s.value=!s.value,s.value?n.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):n.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};ge(()=>t.chartData,()=>{n&&n.setOption(g.value)}),ge(t.isEmpty,S=>{S||B()}),ge(y,S=>{S||B()});const k=()=>{u.value=ke.isDark(),ye(()=>{b()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",k),ye(()=>{B(),window.addEventListener("resize",v)})}),At(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),n&&(window.removeEventListener("resize",v),n.dispose(),n=null)}),(S,M)=>{const $=C("el-tooltip"),F=C("el-skeleton");return d(),_("div",lee,[l(he,null,{default:i(()=>[l(Ce,{border_bottom:"",title_size:"small"},Rt({title:i(()=>[r("div",oee,[r("h5",ree,h(p(c)("Average Order Items ")),1),l($,{"popper-class":"fct-tooltip",content:p(c)("Average Order Items grouped by date period."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:i(()=>[r("div",iee,[l(Oe,{tag:"button",size:"x-small",title:S.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[y.value?(d(),E(F,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(d(),_("div",dee,[r("div",uee,[r("div",cee,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",Aee,h(S.$t("Average Order Items")),1)]),r("div",pee,[r("span",fee,h(S.$t("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},hee={class:"fct-order-report-page"},_ee={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,n=o=>{o&&(gt.getOrderChartData({params:{...o.params,groupKey:""}}),gt.getNewVsReturningCustomer(o),gt.getReportByDayAndHour(o),gt.getItemCountDistribution(o),gt.getOrderCompletionTime(o),gt.getOrderValueDistribution(o))},s=o=>{const u=a.applicableFilters;u&>.getOrderChartData({params:{...u.params,groupKey:o}})};return Be(()=>{a.addListener("order-report",n),n(a.applicableFilters),a.value}),At(()=>{a.removeListener("order-report",n,!1),a.value}),(o,u)=>{const A=C("el-col"),f=C("el-row");return d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",hee,[l(lJ,{orderReport:p(gt),reportFilter:p(a)},null,8,["orderReport","reportFilter"]),l(gJ,{chartData:p(gt).data.orderChartData,reportFilter:p(a),onFetchChartData:s,"is-empty":!p(gt).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),l(BJ,{orderReport:p(gt)},null,8,["orderReport"]),p(gt).data.summary.tax_total||p(gt).data.summary.shipping_total?(d(),E(EJ,{key:0,orderReport:p(gt),reportFilter:p(a)},null,8,["orderReport","reportFilter"])):x("",!0),l(LJ,{tableData:p(gt).data.newVsReturning,reportFilter:p(a)},null,8,["tableData","reportFilter"]),l(jJ,{tableData:p(gt).data.orderByGroup,reportFilter:p(a)},null,8,["tableData","reportFilter"]),l(oJ,{chartData:p(gt).data.orderByDayAndHour},null,8,["chartData"]),l(f,{gutter:30},{default:i(()=>[l(A,{lg:12},{default:i(()=>[l(nZ,{reportFilter:p(a),ref:"chartRef",chartData:p(gt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),l(A,{lg:12},{default:i(()=>[l(kZ,{chartData:p(gt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),l(A,{lg:12},{default:i(()=>[l(fZ,{ref:"chartRef",chartData:p(gt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),l(A,{lg:12},{default:i(()=>[l(zZ,{chartData:p(gt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),l(A,{lg:12},{default:i(()=>[l(see,{chartData:p(gt).data.orderChartData,"is-empty":!p(gt).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),l(A,{lg:12},{default:i(()=>[l(mee,{chartData:p(gt).data.orderChartData,"is-empty":!p(gt).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),l(A,{lg:12},{default:i(()=>[l(VZ,{chartData:p(gt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},gee={class:"fct-gross-sale-vs-net-revenue-wrap"},vee={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={class:"chart-action-wrap"},Bee={class:"chart-change-wrap"},kee={class:"chart-change"},xee={class:"text"},See={class:"chart-change"},Fee={class:"text"},Eee={__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,n=ke.colors.report,s=V(ke.isDark()),o=V(null),u=V("default"),A=V(Zt.getChartType("refund","refund_chart")||"line"),f=V(!1);j(()=>a.reportFilter.currentCurrencySign);const m=[{label:c("Default"),value:"default"},{label:c("Monthly"),value:"monthly"},{label:c("Yearly"),value:"yearly"}],g=t,y=()=>{g("fetch-chart-data",u.value)},v=j(()=>a.reportFilter.data.compareType!=="no_comparison"),B=(T,D,U,I,O,P=!0)=>({name:T,type:D,barMaxWidth:30,data:U,smooth:!1,color:I,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:I,borderRadius:[4,4,0,0]},yAxisIndex:O,emphasis:{scale:2,itemStyle:{color:Ma(I)},lineStyle:{color:I},areaStyle:{opacity:.3,color:I}},animation:P,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),b=j(()=>{let T=[{name:c("Refunded Amount"),key:"refunded_amount",type:"line",color:s.value?n.blue_dark_mode:n.blue,yAxisIndex:0,data:a.chartData.map(D=>D.refunded_amount),animation:!1},{name:c("Total Refunds"),key:"refund_count",type:"bar",color:s.value?n.dark_cyan_blue_36:n.light_gray_cyan_blue,yAxisIndex:1,data:a.chartData.map(D=>D.refund_count),animation:!1}];return v.value&&T.unshift({name:c("Previous Refunded Amount"),key:"refunded_amount_compare",type:"line",color:s.value?n.purple_dark_mode:n.purple,yAxisIndex:0,data:a.compareData.map(D=>D.refunded_amount),animation:!1},{name:c("Previous Total Refunds"),key:"refund_count_compare",type:"bar",color:s.value?n.dark_cyan_blue_16:n.light_gray,yAxisIndex:1,data:a.compareData.map(D=>D.refund_count),animation:!0}),T.map(D=>B(D.name,D.type,D.data,D.color,D.yAxisIndex,D.animation))});let w=null;const k=V(!0),S=()=>{w&&(w.dispose(),w=null),ye(()=>{o.value&&(w=Mt(o.value),F(),w.on("legendselectchanged",T=>{k.value=T.selected["Total Refunds"]||T.selected["Previous Total Refunds"]}))})},M=j(()=>{const T=zs(a.reportFilter.data.dateRange);return c("This report looks at refunds made for successful orders created ")+T}),$=j(()=>an(a.chartData.length)),F=()=>{if(!w)return;const T=In(a.chartData),D={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?n.dark_cyan_blue_16:n.light_gray_blue}},formatter:U=>{let I=U[0].name;return U.forEach(O=>{const P=[0,2].includes(O.seriesIndex)?`${Te.scaled(O.value)}`:O.value,K=s.value?"#ffffff":"#565865";I+=`<div> |
| 217 |
${O.marker} |
| 218 |
<span style="color: ${K};">${O.seriesName}</span> |
| 219 |
<span style="float: right; margin-left: 20px; color: ${K};"> |
| 220 |
${P} |
| 221 |
</span> |
| 222 |
</div>`}),I}},xAxis:{type:"category",data:T,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=>`${Te.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:b.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};w.setOption(D,{notMerge:!0,replaceMerge:["series"]})},L=()=>{f.value=!f.value,f.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()};ge([()=>a.chartData,A],()=>{ye(F)},{deep:!0}),ge(()=>Kn.data.refund,()=>{ye(()=>{F()})},{deep:!0}),ge(()=>a.isEmpty,T=>{T||S()}),ge(()=>a.loading,T=>{T||S()}),ge(k,()=>{if(!w)return;const D=w.getOption().series.map(U=>U.type==="line"?{...U,areaStyle:k.value?void 0:{opacity:.3}}:U);ye(()=>{w.setOption({series:D})})});const Q=()=>{s.value=ke.isDark(),ye(()=>{F()})};return At(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",Q),window.addEventListener("fluentCartCurrencyChange",Q),ye(S)}),(T,D)=>{const U=C("el-tooltip"),I=C("el-option"),O=C("el-select"),P=C("el-skeleton");return d(),_("div",gee,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",vee,[r("h5",yee,h(p(c)("Refunds Chart")),1),l(U,{"popper-class":"fct-tooltip",content:M.value,placement:"top"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:i(()=>[r("div",bee,[l(O,{class:"el-select--x-small",modelValue:u.value,"onUpdate:modelValue":D[0]||(D[0]=K=>u.value=K),onChange:y},{default:i(()=>[(d(),_(H,null,ee(m,K=>l(I,{key:K.value,label:T.$t(K.label),value:K.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),r("div",wee,[l(Oe,{tag:"button",size:"small",title:T.$t("Zoom Chart"),onClick:L,class:de(f.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:o.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0"},{default:i(()=>[e.loading?(d(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[e.isEmpty?x("",!0):(d(),_("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:o},null,512)),r("div",Cee,[r("div",Bee,[r("div",kee,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",xee,h(T.$t("Data")),1)]),r("div",See,[r("span",Fee,h(T.$t("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Uee extends Ya{constructor(){super(...arguments);Ee(this,"data",{refundData:[],previousMetrics:[],summary:{},previousSummary:{},fluctuations:{},chartData:[],weeksBetweenRefund:[],isBusy:{chartData:!0,weeksBetweenRefund:!0,refundData:!0}})}get controllerKey(){return"RefundReportController"}makeRequest(a,n,s,o){o&&(this.data.isBusy[o]=!0),typeof n!="object"&&(n={});const u=re.get(`reports/${a}`,n);return this.resolvePromiseResponse(u,s,o),u}resolvePromiseResponse(a,n=null,s=null){a.then(o=>{s==null||n==null?Object.assign(this.data,o):this.data[s]=o[n]}).catch(o=>{}).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 aa=Uee.init(),$ee={key:1,class:"fct-report-order-summary summary-col-4"},Dee={class:"summary-item-inner"},Qee={class:"value"},Iee={class:"inner-value"},Tee=["innerHTML"],Vee={class:"title"},Mee={__name:"Summary",setup(e){const t=j(()=>[{title:c("Refunds"),value:aa.data.summary.refund_count,key:"refund_count",percentage:aa.data.fluctuations.refund_count,info:c("Total refunds count including partially refunds."),no_currency:!0},{title:c("Refunded"),value:aa.data.summary.refunded_amount,key:"refunded_amount",percentage:aa.data.fluctuations.refunded_amount,info:c("Total Refunded Amount")},{title:c("Avgerage Amount"),value:aa.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:aa.data.fluctuations.average_refunded_amount,info:c("Total Refunded Amount / Total Refund count")},{title:c("Refund Rate"),value:aa.data.summary.refund_rate,key:"refund_rate",percentage:aa.data.fluctuations.refund_rate,info:c("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=j(()=>aa.data.isBusy.chartData),n=s=>{const o=s.no_currency?jt(s.value):Te.scaled(s.value);return s.is_percentage?`${o}%`:o};return(s,o)=>{const u=C("el-tooltip");return a.value?(d(),E(Gn,{key:0,loading:a.value,count:4},null,8,["loading"])):(d(),_("div",$ee,[(d(!0),_(H,null,ee(t.value,(A,f)=>(d(),_("div",{class:"summary-item",key:f},[r("div",Dee,[r("div",Qee,[r("div",Iee,[r("span",{innerHTML:n(A)},null,8,Tee)]),l(An,{fluctuation:A.percentage,amount:p(aa).data.previousSummary[A.key],"is-liability":!0,"has-currency":!A.no_currency,"is-percentage":A.is_percentage},null,8,["fluctuation","amount","has-currency","is-percentage"])]),r("div",Vee,[R(h(A.title)+" ",1),l(u,{content:A.info,placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Lee={class:"fct-report-refund-weeks-between-an-order-wrap"},Ree={class:"fct-btn-group sm"},Oee={class:"chart-action-wrap"},Hee={class:"chart-change-wrap"},Pee={class:"chart-change"},Nee={class:"text"},Kee={class:"chart-change"},Gee={class:"text"},jee={__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=V(null),n=V("bar");let s=null;const o=ke.colors.report,u=V(ke.isDark()),A=j(()=>u.value?o.dark_cyan_blue_16:o.light_gray),f=j(()=>[{name:c("Refund Count"),type:n.value,data:t.chartData.map(b=>b.occurrence),smooth:!0,color:A.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:Ma(A.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),m=j(()=>an(t.chartData.length)),g=()=>({title:{text:t.chartTitle,left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:u.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:u.value?"#253241":"#ffffff",borderColor:u.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:u.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:u.value?o.dark_cyan_blue_16:o.light_gray_blue}}},xAxis:{type:"category",data:t.chartData.map(b=>b.weekBetween),axisLabel:{color:u.value?"#ffffff":"#000000",fontSize:12,interval:m.value.interval,formatter:b=>b>1?`${b} weeks`:`${b} week`},axisLine:{lineStyle:{type:"dashed",color:u.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:u.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:u.value?"#253241":"#D6DAE1"}}},series:f.value}),y=()=>{s&&(s.dispose(),s=null),ye(()=>{a.value&&(s=Mt(a.value),s.setOption(g()),window.addEventListener("resize",()=>{s.resize()}))})};ge(()=>t.chartData,()=>{s&&s.setOption(g())}),ge(()=>t.isEmpty,b=>{b||y()}),ge(()=>t.loading,b=>{b||y()});const v=()=>{u.value=ke.isDark(),ye(()=>{B()})};At(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const B=b=>{s&&s.setOption(g(),!0)};return Be(()=>{window.addEventListener("onFluentCartThemeChange",v),ye(()=>{y()})}),(b,w)=>{const k=C("el-skeleton");return d(),_("div",Lee,[l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},Rt({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:i(()=>[r("div",Ree,[l(pa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),l(me,{class:"px-0"},{default:i(()=>[e.loading?(d(),E(k,{key:0,animated:"",rows:7,class:"p-4"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[e.isEmpty?x("",!0):(d(),_("div",{key:0,class:"fct-chart-wrap fct-refund-weeks-between-an-order-chart",ref_key:"chartRef",ref:a},null,512)),r("div",Oee,[r("div",Hee,[r("div",Pee,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",Nee,h(p(c)("Refund Count")),1)]),r("div",Kee,[r("span",Gee,h(p(c)("Weeks")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},zee={class:"fct-btn-group sm w-[240px] gap-2"},Yee={key:0},qee={key:1},Wee={class:"inline-flex"},Xee={class:"inline-flex"},Jee={__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;V([]);const n=V([{label:c("Billing Country"),value:"billing_country"},{label:c("Shipping Country"),value:"shipping_country"},{label:c("Payment Method"),value:"payment_method"}]),s=V("billing_country"),o=j(()=>{var A;return((A=n.value.find(f=>f.value===s.value))==null?void 0:A.label)||""}),u=()=>{a("group-data",s.value)};return(A,f)=>{const m=C("el-option"),g=C("el-select"),y=C("el-skeleton"),v=C("el-table-column"),B=C("el-table");return d(),E(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Refunds Grouped By"),title_size:"small"},Rt({_:2},[e.loading?void 0:{name:"action",fn:i(()=>[r("div",zee,[l(g,{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=b=>s.value=b),onChange:u,class:"el-select--x-small",placeholder:p(c)("Select Group")},{default:i(()=>[(d(!0),_(H,null,ee(n.value,b=>(d(),E(m,{key:b.value,label:p(c)(b.label),value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),l(go,{data:e.tableData,filename:"refund.csv",class:"!ml-0"},null,8,["data"])])]),key:"0"}]),1032,["title"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[e.loading?(d(),E(y,{key:0,animated:"",rows:7,class:"p-4"})):(d(),E(B,{key:1,data:e.tableData,height:"330"},{empty:i(()=>[l(at,{icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!")},null,8,["text"])]),default:i(()=>[l(v,{prop:s.value,label:p(c)(o.value),"min-width":"150"},{default:i(b=>[s.value!=="payment_method"?(d(),_("span",Yee,h(p(uo)(b.row[s.value])),1)):(d(),_("span",qee,h(b.row[s.value]),1))]),_:1},8,["prop","label"]),l(v,{prop:"refunds",label:p(c)("Refunds"),"min-width":"150"},{default:i(b=>f[1]||(f[1]=[])),_:1},8,["label"]),l(v,{prop:"refunded_amount",label:p(c)("Refunded Amount"),"min-width":"150"},{default:i(b=>[r("div",Wee,h(p(Te).scaled(b.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),l(v,{prop:"average_refund",label:p(c)("Average Refund"),"min-width":"150"},{default:i(b=>[r("div",Xee,h(p(Te).scaled(b.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Zee={class:"fct-refund-report-page"},ete={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,n=A=>{aa.getRefundChartData({params:{...A.params,groupKey:"default"}}),aa.getWeeksBetweenRefund(A),s(A)},s=A=>{aa.getRefundDataByGroup({params:{...A.params,groupKey:"billing_country"}})},o=A=>{const f=a.applicableFilters;aa.getRefundDataByGroup({params:{...f.params,groupKey:A}})},u=A=>{const f=a.applicableFilters;f&&aa.getRefundChartData({params:{...f.params,groupKey:A}})};return Be(()=>{a.addListener("refund-report",n),n(a.applicableFilters)}),At(()=>{a.removeListener("refund-report")}),(A,f)=>(d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",Zee,[l(Mee),l(Eee,{ref:"refundChart",chartData:p(aa).data.chartData,compareData:p(aa).data.previousMetrics,reportFilter:p(a),onFetchChartData:u,"is-empty":!p(aa).data.summary.refund_count,loading:p(aa).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),l(jee,{chartData:p(aa).data.weeksBetweenRefund,"is-empty":!p(aa).data.weeksBetweenRefund.length,loading:p(aa).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),l(Jee,{tableData:p(aa).data.refundData,currencySign:p(a).currentCurrencySign,onGroupData:o,loading:p(aa).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},tte={class:"fct-gross-sale-vs-net-revenue-wrap"},ate={class:"fct-chart-select"},nte={class:"fct-btn-group sm"},ste={class:"chart-action-wrap"},lte={class:"chart-change-wrap"},ote={class:"chart-change"},rte={class:"text"},ite={class:"chart-change"},dte={class:"text"},ute={__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,n=V(null),s=V(Zt.getChartType("subscription","retention_chart")||"line"),o=V(!1),u=V(null);V([]);const A=ke.colors.report,f=V(ke.isDark()),m=(F,L,Q,T)=>({name:F,type:L,barMaxWidth:30,data:Q,smooth:!1,color:T,lineStyle:{width:3},areaStyle:{opacity:.3,color:T},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:T,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ma(T)},lineStyle:{color:T},areaStyle:{opacity:.3,color:T}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=j(()=>Object.keys(a.chartData).map(L=>L.startsWith("day_")?c("%s Days",L.replace("day_","")):L==="more_than_year"?c("More than Year"):L)),y=j(()=>Object.keys(a.chartData).map(L=>a.chartData[L]||0)),v=j(()=>[m(c("Customers"),s.value,y.value,f.value?A.dark_cyan_blue_16:A.light_gray)]);let B=null;const b=()=>{B&&(B.dispose(),B=null),ye(()=>{n.value&&(B=Mt(n.value),w())})},w=()=>{if(!B)return;const F={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:f.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:f.value?"#253241":"#ffffff",borderColor:f.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:f.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:f.value?A.dark_cyan_blue_16:A.light_gray_blue}}},xAxis:{type:"category",data:g.value,axisLabel:{color:f.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:f.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:f.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};B.setOption(F,{notMerge:!0,replaceMerge:["series"]})},k=F=>{Zt.onChange("subscription","retention_chart",F),s.value!==F&&(o.value=!1,s.value=F,w())},S=t,M=()=>{S("fetch-custom-chart-data",u.value)};ge(()=>a.chartData,()=>{ye(w)},{deep:!0}),ge(()=>Kn.data.refund,()=>{ye(w)},{deep:!0}),ge(()=>a.isEmpty,F=>{F||b()}),ge(()=>a.loading,F=>{F||b()});const $=()=>{f.value=ke.isDark(),ye(()=>{w()})};return At(()=>{window.removeEventListener("onFluentCartThemeChange",$,!1)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",$),ye(b)}),(F,L)=>{const Q=C("el-input"),T=C("el-skeleton");return d(),_("div",tte,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title:p(c)("Retention Chart"),title_size:"small",border_bottom:""},Rt({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:i(()=>[r("div",ate,[l(Q,{type:"text",modelValue:u.value,"onUpdate:modelValue":L[0]||(L[0]=D=>u.value=D),placeholder:p(c)("Enter custom days"),class:"el-input--x-small",onKeyup:Pa(M,["enter"])},null,8,["modelValue","placeholder"])]),r("div",nte,[l(jn,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:k},null,8,["activeType"]),l(pa,{targetRef:n.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),l(me,{class:"px-0"},{default:i(()=>[e.loading?(d(),E(T,{key:0,animated:"",rows:7,class:"p-4"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[r("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:n},null,512),r("div",ste,[r("div",lte,[r("div",ote,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",rte,h(p(c)("Data")),1)]),r("div",ite,[r("span",dte,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},cte={class:"fct-revenue-line-chart-wrap"},Ate={class:"flex items-center gap-2"},pte={class:"fct-card-header-title is-small"},fte={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},mte={class:"chart-action-wrap"},hte={class:"chart-change-wrap"},_te={class:"chart-change"},gte={class:"text"},vte={class:"chart-change"},yte={class:"text"},bte={__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,n=V(null),s=V(Zt.getChartType("subscription","subscription_chart")||"line"),o=V(!1),u=ke.colors.report,A=V(ke.isDark()),f=(T,D,U,I,O)=>({name:T,type:D,barMaxWidth:30,yAxisIndex:U,data:I,smooth:!1,color:O,lineStyle:{width:3},areaStyle:{opacity:.3,color:O},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ma(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=V(a.appliedGroupKey);ge(()=>a.appliedGroupKey,T=>{m.value=T});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},B=j(()=>a.reportFilter.data.compareType!=="no_comparison"),b=j(()=>{let T=[{name:c("Current Range"),key:"count",type:s.value,color:A.value?u.dark_cyan_blue_36:u.light_gray_cyan_blue,data:a.chartData.map(D=>D.count)}];return B.value&&T.unshift({name:c("Compare Range"),key:"count",type:s.value,color:A.value?u.dark_cyan_blue_16:u.light_gray,data:a.compareData.map(D=>({value:D.count,date:D.group}))}),T.map(D=>f(D.name,D.type,0,D.data,D.color))});let w=null;const k=()=>{w&&(w.dispose(),w=null),ye(()=>{n.value&&(w=Mt(n.value),$())})},S=j(()=>{const T=zs(a.reportFilter.data.dateRange);return c("This report looks at the subscription you received ")+T}),M=j(()=>an(a.chartData.length)),$=()=>{if(!w)return;const T=In(a.chartData),D={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.dark_cyan_blue_16:u.light_gray_blue}},alwaysShowContent:!1,formatter:U=>{let I="";return U.forEach(function(O,P){const K=typeof O.data=="object"&&O.data!==null,G=K?Ys(O.data.date):O.name,ne=K?O.data.value:O.value,Y=U.length>1&&P===0;Y&&(I+='<div style="margin-bottom: 10px">'),I+=`<div>${G}</div>`,I+=`<div> |
| 223 |
<span style="color:${O.color}">●</span> |
| 224 |
<span>${c("Subscription")}</span> |
| 225 |
<span style="float: right; margin-left: 20px;"> |
| 226 |
${jt(ne)} |
| 227 |
</span> |
| 228 |
</div>`,Y&&(I+="</div>")}),I}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(D,{notMerge:!0,replaceMerge:["series"]})},F=()=>{o.value=!o.value,o.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):$()},L=T=>{Zt.onChange("subscription","subscription_chart",T),s.value!==T&&(o.value=!1,s.value=T,$())};ge([()=>a.chartData,m],()=>{ye($)},{deep:!0}),ge(()=>Kn.data.revenue,()=>{ye(()=>{$()})},{deep:!0}),ge(()=>a.isEmpty,T=>{T||k()}),ge(()=>a.loading,T=>{T||k()});const Q=()=>{A.value=ke.isDark(),ye(()=>{$()})};return At(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",Q),ye(()=>{k()})}),(T,D)=>{const U=C("el-tooltip"),I=C("el-option"),O=C("el-select"),P=C("el-skeleton");return d(),_("div",cte,[l(he,null,{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",Ate,[r("h4",pte,h(p(c)("Subscription Chart")),1),l(U,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:i(()=>[r("div",fte,[l(O,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":D[0]||(D[0]=K=>m.value=K),onChange:v},{default:i(()=>[(d(),_(H,null,ee(g,K=>l(I,{key:K.value,label:p(c)(K.label),value:K.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),l(jn,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:L},null,8,["activeType"]),l(Oe,{tag:"button",size:"small",title:p(c)("Zoom Chart"),onClick:F,class:de(o.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:n.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[e.loading?(d(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[e.isEmpty?x("",!0):(d(),_("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:n},null,512)),r("div",mte,[r("div",hte,[r("div",_te,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",gte,h(p(c)("Data")),1)]),r("div",vte,[r("span",yte,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class wte extends Ya{constructor(){super(...arguments);Ee(this,"data",{overviews:[],fluctuations:[],chartData:[],productList:[],customerList:[],revenueChurnRateNet:{title:c("Revenue Churn Rate"),isCurrency:!1,value:0},netNewMrr:{title:c("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,n,s,o){typeof n!="object"&&(n={}),this.data.isBusy[o]=!0;const u=re.get(`reports/${a}`,n);return this.resolvePromiseResponse(u,s,o),u}resolvePromiseResponse(a,n=null,s=null){a.then(o=>{s==null||n==null||(this.data[s]=o[n])}).catch(o=>{}).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(n=>{this.getRevenueChurnRateNet(a),this.getNetNewMrr(a)}).finally(()=>{})}getRevenueChurnRateNet(a={}){this.data.isBusy.revenueChurnRateNet=!0,re.get("reports/get-subscription-overview/revenue-churn-rate-net",a).then(n=>{this.data.revenueChurnRateNet=n.data}).finally(()=>{this.data.isBusy.revenueChurnRateNet=!1})}getNetNewMrr(a={}){this.data.isBusy.netNewMrr=!0,re.get("reports/get-subscription-overview/net-new-mrr",a).then(n=>{this.data.netNewMrr=n.data}).finally(()=>{this.data.isBusy.netNewMrr=!1})}}const rl=wte.init(),Cte={key:1,class:"fct-report-order-summary summary-col-4"},Bte={class:"summary-item-inner"},kte={class:"value"},xte={class:"inner-value"},Ste={class:"title"},Fte={__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;j(()=>{var s;return((s=t.reportFilter)==null?void 0:s.currentCurrencySign)||""});const a=[{title:c("Future Installments"),key:"future_installments",info:c("The total amount expected from future installments."),hasCurrency:!0}],n=j(()=>!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,o)=>{const u=C("el-tooltip");return e.loading?(d(),E(Gn,{key:0,loading:e.loading},null,8,["loading"])):(d(),_("div",Cte,[(d(!0),_(H,null,ee(n.value,(A,f)=>(d(),_("div",{class:"summary-item",key:f},[r("div",Bte,[r("div",kte,[r("div",xte,[l(qs,{amount:p(Te).scaled(A.value),title:A.title},null,8,["amount","title"])])]),r("div",Ste,[R(h(A.title)+" ",1),l(u,{content:A.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Ete={class:"chart-action-wrap"},Ute={class:"chart-change-wrap"},$te={class:"chart-change"},Dte={class:"text"},Qte={class:"chart-change"},Ite={class:"text"},Tte={__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,n=V(null),s=V(a.chartData);t({chartRef:n}),ge(()=>a.chartData,S=>{s.value=S},{deep:!0});const o=ke.colors.report,u=V(ke.isDark()),A=j(()=>({textColor:u.value?"#ffffff":"#000000",borderColor:u.value?"#4a5a6b":"#c0c4ca",splitLineColor:u.value?"#253241":"#D6DAE1",bgColor:u.value?"#2d3748":"#ffffff"})),f=j(()=>u.value?o.dark_cyan_blue_16:o.light_gray),m=j(()=>s.value.map(S=>Ys(S.label))),g=j(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map(S=>S.value),smooth:!1,color:f.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:f.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ma(f.value)},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let y=null;const v=()=>{y&&(y.dispose(),y=null),ye(()=>{n.value&&(y=Mt(n.value),b())})},B=j(()=>an(a.chartData.length)),b=()=>{if(!y)return;const S={legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:u.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:u.value?"#253241":"#ffffff",borderColor:u.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:u.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:u.value?o.dark_cyan_blue_16:o.light_gray_blue}}},xAxis:{type:"category",data:m.value,axisLabel:{color:A.value.textColor,fontSize:12,interval:B.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:A.value.textColor,fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value.splitLineColor,type:"dashed"}}},series:g.value};y.setOption(S,{notMerge:!0,replaceMerge:["series"]})},w=S=>{S?y.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):b()};ge([()=>s.value,()=>a.chartType,()=>ke.isDark(),()=>a.loading],()=>{v()},{deep:!0}),ge(()=>a.zoomIsActive,S=>{w(S)});const k=()=>{u.value=ke.isDark(),ye(()=>{b()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",k),window.addEventListener("fluentCartCurrencyChange",b),ye(v)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1)}),(S,M)=>{const $=C("el-skeleton");return e.loading?(d(),E($,{key:0,animated:"",rows:8})):(d(),_(H,{key:1},[s.value.length?(d(),_(H,{key:0},[s.value.length?(d(),_("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:n},null,512)):x("",!0),r("div",Ete,[r("div",Ute,[r("div",$te,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",Dte,h(S.$t("Data")),1)]),r("div",Qte,[r("span",Ite,h(S.$t("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],64))}}},Vte={class:"fct-daily-signup-chart-wrap"},Mte={class:"fct-btn-group sm gap-2 lg:gap-0"},Lte={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=V(Zt.getChartType("subscription","daily_signups_chart")||"line"),n=V([]),s=V(""),o=V(!1),u=V(!0),A=m=>{u.value=!0,re.get("reports/daily-signups",{params:{...m}}).then(g=>{n.value=g.signups,n.value.forEach(y=>{y.label=y.trend_date})}).finally(()=>u.value=!1)},f=m=>{Zt.onChange("subscription","daily_signups_chart",m),a.value!==m&&(a.value=m)};return Be(()=>{A(t.reportFilter.applicableFilters.params),t.reportFilter.addListener("daily-signup-chart",m=>{A(m.params)})}),(m,g)=>(d(),_("div",Vte,[l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Daily Signups"),title_size:"small",border_bottom:""},Rt({_:2},[n.value.length&&!u.value?{name:"action",fn:i(()=>[r("div",Mte,[l(jn,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:f},null,8,["activeType"]),s.value?(d(),E(pa,{key:0,targetRef:s.value.chartRef},null,8,["targetRef"])):x("",!0)])]),key:"0"}:void 0]),1032,["title"]),l(me,null,{default:i(()=>[l(Tte,{chartData:n.value,"chart-title":p(c)("Signups"),chartType:a.value,zoomIsActive:o.value,ref_key:"lineChartRef",ref:s,loading:u.value},null,8,["chartData","chart-title","chartType","zoomIsActive","loading"])]),_:1})]),_:1})]))}};const Rte={name:"Comparison",components:{CardContainer:he,CardHeader:Ce,CardBody:me},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 n=this.previousMetrics[a],s=t.count,o=n.count,u=o?((s-o)/o*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(n.group)}`,count:jt(s),previous_count:jt(o),percent_change:u})}}),e):this.currentMetrics}},methods:{translate:c,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,n,s]=t;return`${Ua[parseInt(n)-1]} ${s}, ${a}`}else if(t.length===2){const[a,n]=t;return`${Ua[parseInt(n)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},Ote={class:"fct-revenue-comparison"},Hte={class:"inline-flex"},Pte={class:"inline-flex"};function Nte(e,t,a,n,s,o){const u=C("CardHeader"),A=C("el-skeleton"),f=C("el-table-column"),m=C("el-table"),g=C("CardBody"),y=C("CardContainer");return d(),_("div",Ote,[l(y,{class:"overflow-hidden"},{default:i(()=>[l(u,{title:o.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),l(g,{class:"px-0 pb-0"},{default:i(()=>[a.loading?(d(),E(A,{key:0,animated:"",rows:7,class:"p-4"})):(d(),E(m,{key:1,data:o.comparisonData,class:"w-full",maxHeight:"390"},{default:i(()=>[l(f,{label:"Date"},{default:i(v=>[R(h(v.row.group),1)]),_:1}),l(f,{label:o.translate("Current Range")},{default:i(v=>[r("div",Hte,h(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(d(),_(H,{key:0},[l(f,{label:o.translate("Compare Range")},{default:i(v=>[r("div",Pte,h(v.row.previous_count),1)]),_:1},8,["label"]),l(f,{label:o.translate("Change")+" (%)"},{default:i(v=>[r("span",{class:de(o.getPercentageClass(v.row.percent_change))},h(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Kte=He(Rte,[["render",Nte]]),Gte={class:"fct-refund-report-page"};const jte={__name:"SubscriptionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V({summary:{},fluctuations:{},currentMetrics:[],compareMetrics:[],loading:!0}),n=t.reportFilter,s=V("default"),o=j(()=>n.currentCurrencySign);n.applicableFilters;const u=V(""),A=V(""),f=j(()=>{var S;const w=((S=rl.data)==null?void 0:S.productList)||[],k=u.value.toLowerCase();return w.filter(M=>M.product_name.toLowerCase().includes(k))}),m=j(()=>{var S;const w=((S=rl.data)==null?void 0:S.customerList)||[],k=A.value.toLowerCase();return w.filter(M=>M.customer_name.toLowerCase().includes(k)||M.email.toLowerCase().includes(k))}),g=w=>{y(w),B(w)},y=(w,k="default")=>{a.value.loading=!0,re.get("reports/subscription-chart",{params:{...w.params,groupKey:k}}).then(S=>{a.value=S}).finally(()=>a.value.loading=!1)},v=w=>{s.value!==w&&(s.value=w,y(n.applicableFilters.params,w))},B=(w,k=null)=>{rl.getRetentionChart({params:{...w.params,customDays:k}})},b=w=>{B(n.applicableFilters,w)};return Be(()=>{n.addListener("subscription-report",w=>{g(w)}),g(n.applicableFilters)}),At(()=>{n.removeListener("subscription-report")}),(w,k)=>{const S=C("el-col"),M=C("el-row"),$=C("el-input"),F=C("el-table-column"),L=C("el-empty"),Q=C("el-table");return d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",Gte,[l(Fte,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:p(rl),reportFilter:p(n),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),l(bte,{ref:"subscriptionChart",chartData:a.value.currentMetrics,compareData:a.value.compareMetrics,reportFilter:p(n),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"]),l(Kte,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.compareMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:p(n),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),l(M,{gutter:30},{default:i(()=>[l(S,{lg:12},{default:i(()=>[l(ute,{ref:"subscriptionChart",chartData:p(rl).data.chartData,onFetchCustomChartData:b,"is-empty":!a.value.summary.total_subscriptions,loading:p(rl).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),l(S,{lg:12},{default:i(()=>[l(Lte,{reportFilter:p(n),"is-empty":!a.value.summary.total_subscriptions},null,8,["reportFilter","is-empty"])]),_:1})]),_:1}),x("",!0),x("",!0),x("",!0),x("",!0)])]),_:1})}}},zte={class:"fct-refund-report-page"},Yte={key:1},qte={key:1,class:"fct-report-order-summary summary-col-2"},Wte={class:"summary-item-inner"},Xte={class:"value"},Jte={class:"inner-value"},Zte=["innerHTML"],eae={class:"title"},tae={class:"fct-revenue-line-chart-wrap"},aae={class:"flex items-center gap-2"},nae={class:"fct-card-header-title is-small"},sae={class:"fct-btn-group sm"},lae={class:"chart-action-wrap"},oae={class:"chart-change-wrap"},rae={class:"chart-change"},iae={class:"text"},dae={class:"chart-change"},uae={class:"text"},cae={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,n=V(!1),s=ke.colors.report,o=V(ke.isDark()),u=V(null);let A=null;const f=V({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),m=V(!0),g=(L,Q="monthly")=>{m.value=!0,re.get("reports/future-renewals",{params:{...L.params,groupKey:Q}}).then(T=>{f.value=T}).finally(()=>m.value=!1)},y=(L,Q,T,D,U)=>({name:L,type:Q,barMaxWidth:30,yAxisIndex:T,data:D,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:Ma(U)},lineStyle:{color:U}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{A&&(A.dispose(),A=null),ye(()=>{u.value&&(A=Mt(u.value),B())})},B=()=>{if(!A)return;const L=In(f.value.projections),Q={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:o.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:o.value?"#253241":"#ffffff",borderColor:o.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:o.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:o.value?s.dark_cyan_blue_16:s.light_gray_blue}},formatter:T=>{let D=T[0].name;return T.forEach((U,I)=>{const O=I===0?`${Te.formatScaled(U.value)}`:jt(U.value),P=o.value?"#ffffff":"#565865";D+=`<div> |
| 229 |
${U.marker} |
| 230 |
<span style="color: ${P};">${U.seriesName}</span> |
| 231 |
<span style="float: right; margin-left: 20px; color: ${P};"> |
| 232 |
${O} |
| 233 |
</span> |
| 234 |
</div>`}),D}},grid:{show:!1},xAxis:{type:"category",data:L,axisLabel:{color:o.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:o.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:o.value?"#ffffff":"#000000",fontSize:12,formatter:T=>`${Te.formatScaledChart(T)}`},splitLine:{show:!0,lineStyle:{color:o.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",axisLabel:{color:o.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!1}}],series:S.value};A.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},b=()=>{n.value=!n.value,n.value?A.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):B()},w=()=>{o.value=ke.isDark(),ye(()=>{B()})},k=j(()=>{const L=zs(f.value.period);return c("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+L}),S=j(()=>[{name:c("Revenue"),key:"count",type:"line",color:o.value?s.blue_dark_mode:s.blue,data:f.value.projections.map(Q=>Q.projected_amount)},{name:c("Count"),key:"count",type:"bar",color:o.value?s.dark_cyan_blue_16:s.light_gray,data:f.value.projections.map(Q=>Q.renewals_count)}].map((Q,T)=>y(Q.name,Q.type,T,Q.data,Q.color))),M=j(()=>an(f.value.projections.length)),$=j(()=>[{title:c("Renewal Revenue"),value:Te.formatScaled(f.value.totalProjected),key:"renewal_revenue"},{title:c("Renewals"),value:jt(f.value.totalRenewals),key:"renewals_count",no_currency:!0}]),F=j(()=>!f.value.totalRenewals);return ge([()=>f.value],()=>{ye(B)},{deep:!0}),ge(F,L=>{L||v()}),ge(m,L=>{L||v()}),Be(()=>{g(a.applicableFilters),ye(()=>{v()}),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",B)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",B,!1)}),(L,Q)=>{const T=C("el-skeleton");return d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",zte,[l(za,{title:p(c)("Subscription Future Revenue")},null,8,["title"])]),l(he,null,{default:i(()=>[l(me,{class:"p-3"},{default:i(()=>[m.value?(d(),E(Gn,{key:0,loading:m.value,"margin-bottom":0,padding:0},null,8,["loading"])):(d(),_("div",Yte,h(k.value),1))]),_:1})]),_:1}),m.value?(d(),E(Gn,{key:0,loading:m.value,count:2},null,8,["loading"])):(d(),_("div",qte,[(d(!0),_(H,null,ee($.value,(D,U)=>(d(),_("div",{class:"summary-item",key:U},[r("div",Wte,[r("div",Xte,[r("div",Jte,[r("span",{innerHTML:D.value},null,8,Zte)])]),r("div",eae,h(D.title),1)])]))),128))])),r("div",tae,[l(he,null,{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",aae,[r("h4",nae,h(p(c)("Upcoming Renewal Revenue")),1)])]),_:2},[f.value.totalRenewals&&!m.value?{name:"action",fn:i(()=>[r("div",sae,[l(Oe,{tag:"button",size:"small",title:L.$t("Zoom Chart"),onClick:b,class:de(n.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:u.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[m.value?(d(),E(T,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(d(),_(H,{key:1},[F.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[F.value?x("",!0):(d(),_("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:u},null,512)),r("div",lae,[r("div",oae,[r("div",rae,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",iae,h(p(c)("Data")),1)]),r("div",dae,[r("span",uae,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},Aae={class:"fct-retention-lifetime"},pae={class:"flex items-center gap-2"},fae={class:"fct-card-header-title is-small"},mae={key:0},hae={class:"mt-2"},_ae={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=j(()=>{var s;return((s=t.data)==null?void 0:s.retention_data)??[]}),n=j(()=>{const s=a.value;if(!s.length)return null;const u=s.reduce((k,S)=>k+parseFloat(S.retention_rate),0)/s.length,A=u/100;let f=0;A<1?f=1/(1-A):f=s.length;const m=s[s.length-1],g=parseInt(m.active_subscriptions),y=parseFloat(m.mrr);let v=0;g>0&&(v=y/g);const B=v*f,b=new Date(m.day),w=Ua[b.getMonth()]+" "+b.getFullYear().toString();return{expected_lifetime_text:c(`Based on an average monthly subscription retention rate of ${u.toFixed(1)}%, your expected subscription lifetime is ${f.toFixed(1)} months.`),ltv_text:c(`In ${w}, your average monthly revenue per subscriber was ${Te.scaled(v)}, giving you an expected subscription lifetime value of ${Te.scaled(B)}.`)}});return(s,o)=>{const u=C("el-skeleton");return d(),_("div",Aae,[l(he,null,{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},{title:i(()=>[r("div",pae,[r("h4",fae,h(p(c)("Lifetime")),1)])]),_:1}),l(me,null,{default:i(()=>[e.loading?(d(),E(u,{key:0,animated:"",rows:1})):(d(),_(H,{key:1},[n.value?(d(),_("div",mae,[r("div",null,h(n.value.expected_lifetime_text),1),r("div",hae,h(n.value.ltv_text),1)])):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Not enough data to calculate lifetime metrics."),class:"fct-report-empty-state"},null,8,["text"]))],64))]),_:1})]),_:1})])}}},gae={class:"summary-item-inner"},vae={class:"title text-[16px] mb-2.5"},yae={class:"grid grid-cols-2 items-center"},bae={class:"value"},wae={class:"sub-value mt-1.5"},Cae={class:"value"},Bae={class:"sub-value mt-1.5"},kae={class:"description leading-[1.6] mt-3.5"},xae={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=ke.colors.report,n=V(ke.isDark()),s=j(()=>{var A;return((A=t.data)==null?void 0:A.retention_data)??[]}),o=j(()=>{const A=s.value;if(!A.length)return[];const m=(A.reduce((Q,T)=>Q+parseFloat(T.retention_rate),0)/A.length).toFixed(1),y=(A.reduce((Q,T)=>Q+parseFloat(T.retention_rate_money),0)/A.length).toFixed(1),v=A[A.length-1];let B="",b=0,w=0;if(A.length>1){const Q=A[A.length-2],T=new Date(Q.day);B=Ua[T.getMonth()]+" "+T.getFullYear().toString(),b=parseInt(Q.active_subscriptions),w=parseFloat(Q.mrr)}else{const Q=new Date(v.day);Q.setMonth(Q.getMonth()-1),B=Ua[Q.getMonth()]+" "+Q.getFullYear().toString();const T=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);b=v.retention_rate>0?Math.round(T/(v.retention_rate/100)):0;const D=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);w=v.retention_rate_money>0?D/(v.retention_rate_money/100):0}const k=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),S=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),M=parseFloat(v.retention_rate),$=parseFloat(v.retention_rate_money),F=new Date(v.day),L=Ua[F.getMonth()]+" "+F.getFullYear().toString();return[{title:c("Subscription Retention"),value:`${M}%`,average_value:`${m}%`,month_name:L,sub_title:c("Average in period"),description:c(`You retained ${v.retention_rate}% (${jt(k)}) of your ${B} subscriptions (${jt(b)}).`),color:n.value?a.dark_cyan_blue_16:a.light_gray},{title:c("MRR Retention"),value:`${$}%`,average_value:`${y}%`,month_name:L,sub_title:c("Average in period"),description:c(`You retained ${v.retention_rate_money}% (${Te.scaled(S)}) of your ${B} subscription MRR (${Te.scaled(w)}).`),color:n.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),u=()=>{n.value=ke.isDark()};return Be(()=>{window.addEventListener("onFluentCartThemeChange",u)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",u,!1)}),(A,f)=>{var m,g;return e.loading?(d(),E(Gn,{key:0,loading:e.loading,count:2},null,8,["loading"])):(d(),_("div",{key:1,class:de(`fct-report-order-summary ${(m=o.value)!=null&&m.length?"summary-col-2":""}`)},[(g=o.value)!=null&&g.length?(d(!0),_(H,{key:0},ee(o.value,(y,v)=>(d(),_("div",{class:"summary-item",key:v},[r("div",gae,[r("div",vae,h(y.title),1),r("div",yae,[r("div",null,[r("div",bae,h(y.value),1),r("div",wae,h(y.month_name),1)]),r("div",null,[r("div",Cae,h(y.average_value),1),r("div",Bae,h(y.sub_title),1)])]),r("div",kae,h(y.description),1)])]))),128)):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},Sae={class:"fct-revenue-line-chart-wrap"},Fae={class:"flex items-center gap-2"},Eae={class:"fct-card-header-title is-small"},Uae={class:"fct-btn-group sm"},$ae={class:"chart-action-wrap"},Dae={class:"chart-change-wrap"},Qae={class:"chart-change"},Iae={class:"text"},Tae={class:"chart-change"},Vae={class:"text"},Mae={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=V(!1),n=ke.colors.report,s=V(ke.isDark()),o=V(null);let u=null;const A=V(Zt.getChartType("subscription","retention_chart")||"line"),f=(M,$,F,L,Q)=>({name:M,type:$,barMaxWidth:30,yAxisIndex:F,data:L,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:Ma(Q)},lineStyle:{color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),m=()=>{u&&(u.dispose(),u=null),ye(()=>{o.value&&(u=Mt(o.value),g())})},g=()=>{if(!u)return;const M=In(b.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?n.dark_cyan_blue_16:n.light_gray_blue}},formatter:F=>{let L=F[0].name;return F.forEach((Q,T)=>{const D=jt(Q.value)+"%",U=s.value?"#ffffff":"#565865";L+=`<div> |
| 235 |
${Q.marker} |
| 236 |
<span style="color: ${U};">${Q.seriesName}</span> |
| 237 |
<span style="float: right; margin-left: 20px; color: ${U};"> |
| 238 |
${D} |
| 239 |
</span> |
| 240 |
</div>`}),L}},grid:{show:!1},xAxis:{type:"category",data:M,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:k.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:F=>`${F}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};u.setOption($,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?u.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=ke.isDark(),ye(()=>{g()})},B=M=>{Zt.onChange("subscription","retention_chart",M),A.value!==M&&(a.value=!1,A.value=M,g())},b=j(()=>{var M;return((M=t.data)==null?void 0:M.retention_data)??[]}),w=j(()=>[{name:c("Subscription Retention"),key:"count",type:A.value,color:s.value?n.dark_cyan_blue_16:n.light_gray,data:b.value.map($=>$.retention_rate)},{name:c("MRR Retention"),key:"count",type:A.value,color:s.value?n.dark_cyan_blue_36:n.light_gray_cyan_blue,data:b.value.map($=>$.retention_rate_money)}].map(($,F)=>f($.name,$.type,0,$.data,$.color))),k=j(()=>an(b.value.length)),S=j(()=>!b.value||!b.value.length);return ge([()=>t.data],()=>{ye(m)},{deep:!0}),ge(S,M=>{M||m()}),ge(t.loading,M=>{M||m()}),Be(()=>{ye(()=>{m()}),window.addEventListener("onFluentCartThemeChange",v)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(M,$)=>{const F=C("el-skeleton");return d(),_("div",Sae,[l(he,null,{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",Fae,[r("h4",Eae,h(p(c)("Retention Rate")),1)])]),_:2},[!S.value&&!e.loading?{name:"action",fn:i(()=>[r("div",Uae,[l(jn,{activeType:A.value,types:{line:"LineChart",bar:"BarChart"},onChange:B},null,8,["activeType"]),l(Oe,{tag:"button",size:"small",title:M.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:o.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[e.loading?(d(),E(F,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(d(),_(H,{key:1},[S.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[S.value?x("",!0):(d(),_("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:o},null,512)),r("div",$ae,[r("div",Dae,[r("div",Qae,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",Iae,h(p(c)("Data")),1)]),r("div",Tae,[r("span",Vae,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Lae={class:"summary-item-inner"},Rae={class:"title text-[16px] mb-2.5"},Oae={class:"grid grid-cols-2 items-center"},Hae={class:"value"},Pae={class:"sub-value mt-1.5"},Nae={class:"value"},Kae={class:"sub-value mt-1.5"},Gae={class:"description leading-[1.6] mt-3.5"},jae={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=ke.colors.report,n=V(ke.isDark()),s=j(()=>{var A;return((A=t.data)==null?void 0:A.retention_data)??[]}),o=j(()=>{const A=s.value;if(!A.length)return[];const f=A.map((T,D)=>{const U=D>0?parseInt(A[D-1].active_subscriptions)||0:parseInt(T.active_subscriptions)-parseInt(T.new_subscriptions)||0,I=parseInt(T.churned_subscriptions)||0;return U>0?I/U*100:0}),m=A.map((T,D)=>{const U=D>0?parseFloat(A[D-1].mrr)||0:parseFloat(T.mrr)-parseFloat(T.new_subscriptions_mrr)||0,I=parseFloat(T.churned_subscriptions_mrr)||0;return U>0?I/U*100:0}),g=(f.reduce((T,D)=>T+D,0)/f.length).toFixed(1),y=(m.reduce((T,D)=>T+D,0)/m.length).toFixed(1),v=A[A.length-1],B=A.length-1,b=B>0?parseInt(A[B-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,w=B>0?parseFloat(A[B-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,k=parseInt(v.churned_subscriptions)||0,S=parseFloat(v.churned_subscriptions_mrr)||0,M=b>0?(k/b*100).toFixed(1):0,$=w>0?(S/w*100).toFixed(1):0,F=new Date(v.day),L=Ua[F.getMonth()]+" "+F.getFullYear().toString();let Q="";if(A.length>1){const T=A[A.length-2],D=new Date(T.day);Q=Ua[D.getMonth()]+" "+D.getFullYear().toString()}else{const T=new Date(v.day);T.setMonth(T.getMonth()-1),Q=Ua[T.getMonth()]+" "+T.getFullYear().toString()}return[{title:c("Subscription Churn"),value:`${M}%`,average_value:`${g}%`,month_name:L,sub_title:c("Average in period"),description:c(`You lost ${M}% (${jt(k)}) of your ${Q} subscriptions (${jt(b)}).`),color:n.value?a.dark_cyan_blue_16:a.light_gray},{title:c("MRR Churn"),value:`${$}%`,average_value:`${y}%`,month_name:L,sub_title:c("Average in period"),description:c(`You lost ${$}% (${Te.scaled(S)}) of your ${Q} subscription MRR (${Te.scaled(w)}).`),color:n.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),u=()=>{n.value=ke.isDark()};return Be(()=>{window.addEventListener("onFluentCartThemeChange",u)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",u,!1)}),(A,f)=>{var m,g;return e.loading?(d(),E(Gn,{key:0,loading:e.loading,count:2},null,8,["loading"])):(d(),_("div",{key:1,class:de(`fct-report-order-summary ${(m=o.value)!=null&&m.length?"summary-col-2":""}`)},[(g=o.value)!=null&&g.length?(d(!0),_(H,{key:0},ee(o.value,(y,v)=>(d(),_("div",{class:"summary-item",key:v},[r("div",Lae,[r("div",Rae,h(y.title),1),r("div",Oae,[r("div",null,[r("div",Hae,h(y.value),1),r("div",Pae,h(y.month_name),1)]),r("div",null,[r("div",Nae,h(y.average_value),1),r("div",Kae,h(y.sub_title),1)])]),r("div",Gae,h(y.description),1)])]))),128)):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},zae={class:"fct-revenue-line-chart-wrap"},Yae={class:"flex items-center gap-2"},qae={class:"fct-card-header-title is-small"},Wae={class:"fct-btn-group sm"},Xae={class:"chart-action-wrap"},Jae={class:"chart-change-wrap"},Zae={class:"chart-change"},ene={class:"text"},tne={class:"chart-change"},ane={class:"text"},nne={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=V(!1),n=ke.colors.report,s=V(ke.isDark()),o=V(null);let u=null;const A=V(Zt.getChartType("subscription","churn_chart")||"line"),f=(M,$,F,L,Q)=>({name:M,type:$,barMaxWidth:30,yAxisIndex:F,data:L,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:Ma(Q)},lineStyle:{color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),m=()=>{u&&(u.dispose(),u=null),ye(()=>{o.value&&(u=Mt(o.value),g())})},g=()=>{if(!u)return;const M=In(b.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?n.dark_cyan_blue_16:n.light_gray_blue}},formatter:F=>{let L=F[0].name;return F.forEach((Q,T)=>{const D=jt(Q.value)+"%",U=s.value?"#ffffff":"#565865";L+=`<div> |
| 241 |
${Q.marker} |
| 242 |
<span style="color: ${U};">${Q.seriesName}</span> |
| 243 |
<span style="float: right; margin-left: 20px; color: ${U};"> |
| 244 |
${D} |
| 245 |
</span> |
| 246 |
</div>`}),L}},grid:{show:!1},xAxis:{type:"category",data:M,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:k.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:F=>`${F}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};u.setOption($,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?u.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=ke.isDark(),ye(()=>{g()})},B=M=>{Zt.onChange("subscription","churn_chart",M),A.value!==M&&(a.value=!1,A.value=M,g())},b=j(()=>{var M;return((M=t.data)==null?void 0:M.retention_data)??[]}),w=j(()=>{const M=b.value.map((L,Q)=>{const T=Q>0?parseInt(b.value[Q-1].active_subscriptions)||0:parseInt(L.active_subscriptions)-parseInt(L.new_subscriptions)||0,D=parseInt(L.churned_subscriptions)||0;return T>0?(D/T*100).toFixed(2):0}),$=b.value.map((L,Q)=>{const T=Q>0?parseFloat(b.value[Q-1].mrr)||0:parseFloat(L.mrr)-parseFloat(L.new_subscriptions_mrr)||0,D=parseFloat(L.churned_subscriptions_mrr)||0;return T>0?(D/T*100).toFixed(2):0});return[{name:c("Subscription Churn"),type:A.value,color:s.value?n.dark_cyan_blue_16:n.light_gray,data:M},{name:c("MRR Churn"),type:A.value,color:s.value?n.dark_cyan_blue_36:n.light_gray_cyan_blue,data:$}].map((L,Q)=>f(L.name,L.type,0,L.data,L.color))}),k=j(()=>an(b.value.length)),S=j(()=>!b.value||!b.value.length);return ge([()=>t.data],()=>{ye(m)},{deep:!0}),ge(S,M=>{M||m()}),ge(t.loading,M=>{M||m()}),Be(()=>{ye(()=>{m()}),window.addEventListener("onFluentCartThemeChange",v)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(M,$)=>{const F=C("el-skeleton");return d(),_("div",zae,[l(he,null,{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",Yae,[r("h4",qae,h(p(c)("Churn Rate")),1)])]),_:2},[!S.value&&!e.loading?{name:"action",fn:i(()=>[r("div",Wae,[l(jn,{activeType:A.value,types:{line:"LineChart",bar:"BarChart"},onChange:B},null,8,["activeType"]),l(Oe,{tag:"button",size:"small",title:M.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:o.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[e.loading?(d(),E(F,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(d(),_(H,{key:1},[S.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[S.value?x("",!0):(d(),_("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:o},null,512)),r("div",Xae,[r("div",Jae,[r("div",Zae,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",ene,h(p(c)("Data")),1)]),r("div",tne,[r("span",ane,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},sne={class:"fct-retention-report-page"},lne={class:"page-title"},one={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,n=V({retention_data:[]}),s=V(!0),o=(u,A="monthly")=>{s.value=!0,re.get("reports/subscription-retention",{params:{...u.params,groupKey:A}}).then(f=>{n.value=f}).finally(()=>s.value=!1)};return Be(()=>{o(a.applicableFilters),a.addListener("retention-report",o)}),(u,A)=>{const f=C("el-tooltip");return d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",sne,[l(za,null,{title:i(()=>[r("h1",lne,[R(h(p(c)("Subscription Retention"))+" ",1),l(f,{"popper-class":"fct-tooltip",content:p(c)("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:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),l(xae,{data:n.value,loading:s.value},null,8,["data","loading"]),l(Mae,{data:n.value,loading:s.value},null,8,["data","loading"]),l(_ae,{data:n.value,loading:s.value},null,8,["data","loading"]),l(jae,{data:n.value,loading:s.value},null,8,["data","loading"]),l(nne,{data:n.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},rne={key:1,class:"fct-report-order-summary"},ine={class:"summary-item-inner"},dne={class:"value"},une={class:"inner-value"},cne={class:"title"},Ane={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:c("Customer Growth"),key:"customer_count"}],n=j(()=>t.customerReport.loading),s=j(()=>a.map(o=>({key:o.key,title:o.title,value:t.customerReport.summary[o.key],fluctuation:t.customerReport.fluctuations[o.key]})));return(o,u)=>n.value?(d(),E(Gn,{key:0,count:s.value.length},null,8,["count"])):(d(),_("div",rne,[(d(!0),_(H,null,ee(s.value,(A,f)=>(d(),_("div",{class:"summary-item",key:f},[r("div",ine,[r("div",dne,[r("div",une,h(p(jt)(A.value)),1),l(An,{fluctuation:A.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[A.key]},null,8,["fluctuation","amount"])]),r("div",cne,h(A.title),1)])]))),128))]))}},pne={class:"fct-revenue-line-chart-wrap"},fne={class:"flex items-center gap-2"},mne={class:"fct-card-header-title is-small"},hne={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},_ne={class:"chart-action-wrap"},gne={class:"chart-change-wrap"},vne={class:"chart-change"},yne={class:"text"},bne={class:"chart-change"},wne={class:"text"},Cne={__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,n=V(null),s=V(Zt.getChartType("revenue","revenue_chart")||"line"),o=V(!1),u=ke.colors.report,A=V(ke.isDark()),f=(T,D,U,I,O)=>({name:T,type:D,barMaxWidth:30,yAxisIndex:U,data:I,smooth:!1,color:O,lineStyle:{width:3},areaStyle:{opacity:.3,color:O},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Ma(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=V(a.appliedGroupKey);ge(()=>a.appliedGroupKey,T=>{m.value=T});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},B=j(()=>a.reportFilter.data.compareType!=="no_comparison"),b=j(()=>{var D;let T=[{name:c("Current Range"),key:"customer_count",type:s.value,color:A.value?u.dark_cyan_blue_36:u.light_gray_cyan_blue,data:a.chartData.map(U=>U.customer_count)}];return B.value&&T.unshift({name:c("Compare Range"),key:"customer_count",type:s.value,color:A.value?u.dark_cyan_blue_16:u.light_gray,data:(D=a.compareData)==null?void 0:D.map(U=>({value:U.customer_count,date:U.group}))}),T.map(U=>f(U.name,U.type,0,U.data,U.color))});let w=null;const k=()=>{w&&(w.dispose(),w=null),ye(()=>{n.value&&(w=Mt(n.value),$())})},S=j(()=>{const T=zs(a.reportFilter.data.dateRange);return c("Customers that first ordered ")+T}),M=j(()=>an(a.chartData.length)),$=()=>{if(!w)return;const T=In(a.chartData),D={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.dark_cyan_blue_16:u.light_gray_blue}},alwaysShowContent:!1,formatter:U=>{let I="";const O=A.value?"#ffffff":"#565865";return U.forEach(function(P,K){const G=typeof P.data=="object"&&P.data!==null,ne=G?Ys(P.data.date):P.name,Y=G?P.data.value:P.value,N=U.length>1&&K===0;N&&(I+='<div style="margin-bottom: 10px">'),I+=`<div>${ne}</div>`,I+=`<div> |
| 247 |
${P.marker} |
| 248 |
<span style="color: ${O}">${c("Customer")}</span> |
| 249 |
<span style="float: right; margin-left: 20px; color: ${O}"> |
| 250 |
${jt(Y)} |
| 251 |
</span> |
| 252 |
</div>`,N&&(I+="</div>")}),I}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(D,{notMerge:!0,replaceMerge:["series"]})},F=()=>{o.value=!o.value,o.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):$()},L=T=>{Zt.onChange("revenue","revenue_chart",T),s.value!==T&&(o.value=!1,s.value=T,$())};ge([()=>a.chartData,m],()=>{ye($)},{deep:!0}),ge(()=>Kn.data.revenue,()=>{ye(()=>{$()})},{deep:!0}),ge(()=>a.isEmpty,T=>{T||k()}),ge(()=>a.loading,T=>{T||k()});const Q=()=>{A.value=ke.isDark(),ye(()=>{$()})};return At(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",Q),ye(()=>{k()})}),(T,D)=>{const U=C("el-tooltip"),I=C("el-option"),O=C("el-select"),P=C("el-skeleton");return d(),_("div",pne,[l(he,null,{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",fne,[r("h5",mne,h(p(c)("New Customers")),1),l(U,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:i(()=>[r("div",hne,[l(O,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":D[0]||(D[0]=K=>m.value=K),onChange:v},{default:i(()=>[(d(),_(H,null,ee(g,K=>l(I,{key:K.value,label:p(c)(K.label),value:K.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),l(jn,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:L},null,8,["activeType"]),l(Oe,{tag:"button",size:"small",title:p(c)("Zoom Chart"),onClick:F,class:de(o.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:n.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0 pt-0"},{default:i(()=>[e.loading?(d(),E(P,{key:0,animated:"",rows:6,class:"p-5"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[r("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:n},null,512),r("div",_ne,[r("div",gne,[r("div",vne,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",yne,h(p(c)("Data")),1)]),r("div",bne,[r("span",wne,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Bne={name:"Comparison",components:{CardContainer:he,CardHeader:Ce,CardBody:me},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 n;if(a<((n=this.previousMetrics)==null?void 0:n.length)){const s=this.previousMetrics[a],o=t.customer_count,u=s.customer_count,A=u?((o-u)/u*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(s.group)}`,count:o,previous_count:u,percent_change:A})}}),e):this.currentMetrics}},methods:{translate:c,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,n,s]=t;return`${Ua[parseInt(n)-1]} ${s}, ${a}`}else if(t.length===2){const[a,n]=t;return`${Ua[parseInt(n)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},kne={class:"fct-revenue-comparison"},xne={class:"inline-flex"},Sne={class:"inline-flex"};function Fne(e,t,a,n,s,o){const u=C("CardHeader"),A=C("el-skeleton"),f=C("el-table-column"),m=C("el-table"),g=C("CardBody"),y=C("CardContainer");return d(),_("div",kne,[l(y,{class:"overflow-hidden"},{default:i(()=>[l(u,{title:o.translate("Comparison"),title_size:"small"},null,8,["title"]),l(g,{class:"px-0 pb-0"},{default:i(()=>[a.loading?(d(),E(A,{key:0,animated:"",rows:6,class:"p-5"})):(d(),E(m,{key:1,data:o.comparisonData,class:"w-full",maxHeight:"390"},{default:i(()=>[l(f,{label:"Date"},{default:i(v=>[R(h(v.row.group),1)]),_:1}),l(f,{label:o.translate("Current Range")},{default:i(v=>[r("div",xne,h(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(d(),_(H,{key:0},[l(f,{label:o.translate("Compare Range")},{default:i(v=>[r("div",Sne,h(v.row.previous_count),1)]),_:1},8,["label"]),l(f,{label:o.translate("Change")+" (%)"},{default:i(v=>[r("span",{class:de(o.getPercentageClass(v.row.percent_change))},h(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Ene=He(Bne,[["render",Fne]]),Une={class:"fct-customer-report-page"},$ne={__name:"CustomerReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V({summary:{},previousSummary:{},fluctuations:{},currentMetrics:[],previousMetrics:[],loading:!0}),n=V("default"),s=t.reportFilter,o=s.applicableFilters.params,u=(f,m="default")=>{a.value.loading=!0,re.get("reports/customer-report",{params:{...f,groupKey:m}}).then(g=>{a.value=g}).finally(()=>{a.value.loading=!1})},A=f=>{n.value!==f&&(n.value=f,u(o,f))};return Be(()=>{u(o),t.reportFilter.addListener("customer-report",f=>{u(f.params,n.value)})}),(f,m)=>(d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",Une,[l(za,{title:p(c)("Customers")},null,8,["title"]),l(Ane,{reportFilter:p(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),l(Cne,{chartData:a.value.currentMetrics,compareData:a.value.previousMetrics,reportFilter:p(s),appliedGroupKey:n.value,onFilterData:A,"is-empty":!a.value.summary.customer_count,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),l(Ene,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:p(s),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"])])]),_:1}))}},Dne={class:"fct-revenue-report-page"},Qne={class:"fct-revenue-comparison fct-table-wrapper"},Ine={class:"fct-card"},Tne={class:"fct-card-header"},Vne={class:"fct-card-header-top"},Mne={class:"fct-card-header-left flex-1"},Lne={class:"search-bar is-transparent"},Rne={class:"text-xs text-system-light pt-1 dark:text-gray-300"},One={class:"fct-card-header-actions"},Hne={class:"w-[130px]"},Pne={class:"fct-btn-group sm"},Nne={class:"filter-popover-item"},Kne={class:"filter-popover-title"},Gne={class:"fct-card-body"},jne={key:1,class:"unknown"},zne={key:1,class:"unknown"},Yne={key:1,class:"unknown"},qne={key:1,class:"unknown"},Wne={key:1,class:"unknown"},Xne={key:1,class:"unknown"},Jne={class:"inline-flex items-center gap-2"},Zne={class:"inline-flex items-center gap-2"},ese={class:"inline-flex items-center gap-2"},tse={class:"inline-flex items-center gap-2"},ase={class:"inline-flex items-center gap-2"},nse=4,sse={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V([]),n=V({}),s=V(!1),o=V({utm_campaign:c("UTM Campaign"),utm_source:c("UTM Source"),utm_medium:c("UTM Medium"),utm_term:c("UTM Term"),utm_content:c("UTM Content"),utm_id:c("UTM ID")}),u=V(["utm_campaign","utm_source","utm_medium"]),A=V(!0),f=V(""),m=j(()=>a.value.filter(v=>{if(!f.value)return!0;const B=f.value.toLowerCase();return v.utm_campaign&&v.utm_campaign.toLowerCase().includes(B)||v.utm_source&&v.utm_source.toLowerCase().includes(B)||v.utm_medium&&v.utm_medium.toLowerCase().includes(B)||v.utm_term&&v.utm_term.toLowerCase().includes(B)||v.utm_content&&v.utm_content.toLowerCase().includes(B)||v.utm_id&&v.utm_id.toLowerCase().includes(B)})),g=()=>{A.value=!0,re.get("/reports/sources",t.reportFilter.applicableFilters).then(v=>{a.value=v.sourceReportData,n.value=v.fluctuations||{}}).finally(()=>{A.value=!1})},y=v=>u.value.includes(v)?!1:u.value.length>=nse;return Be(()=>{g(),t.reportFilter.addListener("product-top-chart",()=>{g()})}),(v,B)=>{const b=C("el-input"),w=C("el-switch"),k=C("el-checkbox"),S=C("el-checkbox-group"),M=C("el-tooltip"),$=C("el-popover"),F=C("el-skeleton"),L=C("el-table-column"),Q=C("el-table");return d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",Dne,[l(za,{title:p(c)("Order Sources")},null,8,["title"]),r("div",Qne,[r("div",Ine,[r("div",Tne,[r("div",Vne,[r("div",Mne,[r("div",Lne,[l(b,{placeholder:p(c)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:f.value,"onUpdate:modelValue":B[0]||(B[0]=T=>f.value=T)},{prefix:i(()=>[l(W,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),r("div",Rne,h(p(c)("Filter results by UTM values")),1)]),r("div",One,[r("div",Hne,[l(w,{modelValue:s.value,"onUpdate:modelValue":B[1]||(B[1]=T=>s.value=T),"active-text":p(c)("Net"),"inactive-text":p(c)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),r("div",Pne,[l($,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:i(()=>[r("span",null,[l(M,{effect:"light",content:p(c)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{tag:"button"},{default:i(()=>[l(W,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:i(()=>[r("div",Nne,[r("h3",Kne,h(v.$t("Columns")),1),l(S,{class:"fct-checkbox-blocks",modelValue:u.value,"onUpdate:modelValue":B[2]||(B[2]=T=>u.value=T)},{default:i(()=>[(d(!0),_(H,null,ee(o.value,(T,D)=>(d(),E(k,{label:T,value:D,disabled:y(D)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])])]),r("div",Gne,[A.value?(d(),E(F,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(d(),E(Q,{key:1,data:m.value,class:"w-full fct-source-report"},{empty:i(()=>[l(at,{icon:"Empty/Order","has-dark":"",text:p(c)("No data available")},null,8,["text"])]),default:i(()=>[u.value.includes("utm_campaign")?(d(),E(L,{key:0,label:p(c)("UTM Campaign"),width:"180"},{default:i(T=>[T.row.utm_campaign?(d(),E(p(Xs),{key:0,class:"font-normal",underline:"always",onClick:D=>f.value=T.row.utm_campaign},{default:i(()=>[R(h(T.row.utm_campaign),1)]),_:2},1032,["onClick"])):(d(),_("span",jne,h(p(c)("Unknown")),1))]),_:1},8,["label"])):x("",!0),u.value.includes("utm_source")?(d(),E(L,{key:1,label:p(c)("UTM Source"),width:"150"},{default:i(T=>[T.row.utm_source?(d(),E(p(Xs),{key:0,class:"font-normal",underline:"always",onClick:D=>f.value=T.row.utm_source},{default:i(()=>[R(h(T.row.utm_source),1)]),_:2},1032,["onClick"])):(d(),_("span",zne,h(p(c)("Unknown")),1))]),_:1},8,["label"])):x("",!0),u.value.includes("utm_medium")?(d(),E(L,{key:2,label:p(c)("UTM Medium"),width:"150"},{default:i(T=>[T.row.utm_medium?(d(),E(p(Xs),{key:0,class:"font-normal",underline:"always",onClick:D=>f.value=T.row.utm_medium},{default:i(()=>[R(h(T.row.utm_medium),1)]),_:2},1032,["onClick"])):(d(),_("span",Yne,h(p(c)("Unknown")),1))]),_:1},8,["label"])):x("",!0),u.value.includes("utm_term")?(d(),E(L,{key:3,label:p(c)("UTM Term"),width:"150"},{default:i(T=>[T.row.utm_term?(d(),E(p(Xs),{key:0,class:"font-normal",underline:"always",onClick:D=>f.value=T.row.utm_term},{default:i(()=>[R(h(T.row.utm_term),1)]),_:2},1032,["onClick"])):(d(),_("span",qne,h(p(c)("Unknown")),1))]),_:1},8,["label"])):x("",!0),u.value.includes("utm_content")?(d(),E(L,{key:4,label:p(c)("UTM Content"),width:"150"},{default:i(T=>[T.row.utm_content?(d(),E(p(Xs),{key:0,class:"font-normal",underline:"always",onClick:D=>f.value=T.row.utm_content},{default:i(()=>[R(h(T.row.utm_content),1)]),_:2},1032,["onClick"])):(d(),_("span",Wne,h(p(c)("Unknown")),1))]),_:1},8,["label"])):x("",!0),u.value.includes("utm_id")?(d(),E(L,{key:5,label:p(c)("UTM ID"),width:"100"},{default:i(T=>[T.row.utm_id?(d(),E(p(Xs),{key:0,class:"font-normal",underline:"always",onClick:D=>f.value=T.row.utm_id},{default:i(()=>[R(h(T.row.utm_id),1)]),_:2},1032,["onClick"])):(d(),_("span",Xne,h(p(c)("Unknown")),1))]),_:1},8,["label"])):x("",!0),l(L,{label:p(c)("Orders"),width:"200"},{default:i(T=>{var D,U;return[r("div",Jne,[R(h(p(jt)(T.row.orders))+" ",1),l(An,{class:"flex",fluctuation:((D=n.value[T.row.utm_key])==null?void 0:D.orders_fluctuation)||0,amount:((U=n.value[T.row.utm_key])==null?void 0:U.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s.value?(d(),_(H,{key:6},[l(L,{label:p(c)("Net Sales"),width:"200"},{default:i(T=>{var D,U;return[r("div",Zne,[R(h(p(Te).scaled(T.row.net_sales))+" ",1),l(An,{class:"flex",fluctuation:((D=n.value[T.row.utm_key])==null?void 0:D.net_sales_fluctuation)||0,amount:((U=n.value[T.row.utm_key])==null?void 0:U.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),l(L,{label:p(c)("Average Order Net"),width:"200"},{default:i(T=>{var D,U;return[r("div",ese,[R(h(p(Te).scaled(T.row.average_net_order))+" ",1),l(An,{class:"flex",fluctuation:((D=n.value[T.row.utm_key])==null?void 0:D.average_net_order_fluctuation)||0,amount:((U=n.value[T.row.utm_key])==null?void 0:U.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(d(),_(H,{key:7},[l(L,{label:p(c)("Gross Sales"),width:"200"},{default:i(T=>{var D,U;return[r("div",tse,[R(h(p(Te).scaled(T.row.gross_sales))+" ",1),l(An,{class:"flex",fluctuation:((D=n.value[T.row.utm_key])==null?void 0:D.gross_sales_fluctuation)||0,amount:((U=n.value[T.row.utm_key])==null?void 0:U.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),l(L,{label:p(c)("Average Order"),width:"200"},{default:i(T=>{var D,U;return[r("div",ase,[R(h(p(Te).scaled(T.row.average_order))+" ",1),l(An,{class:"flex",fluctuation:((D=n.value[T.row.utm_key])==null?void 0:D.average_order_fluctuation)||0,amount:((U=n.value[T.row.utm_key])==null?void 0:U.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},lse={class:"fct-revenue-line-chart-wrap"},ose={class:"flex items-center gap-2"},rse={class:"fct-card-header-title is-small"},ise={class:"fct-chart-select"},dse={class:"fct-btn-group sm"},use={class:"chart-action-wrap"},cse={class:"chart-change-wrap"},Ase={class:"chart-change"},pse={class:"text"},fse={class:"chart-change"},mse={class:"text"},hse={__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,n=V(null),s=V(Zt.getChartType("product","product_chart")||"bar"),o=V(!1),u=ke.colors.report,A=V(ke.isDark()),f=(D,U,I,O,P)=>({name:D,type:U,barMaxWidth:30,yAxisIndex:I,data:O,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:Ma(P)},lineStyle:{color:P},areaStyle:{opacity:.3,color:P}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=V("default"),g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},B=j(()=>a.reportFilter.data.compareType!=="no_comparison"),b=j(()=>{let D=[{name:c("Current Range"),key:"units_sold",type:s.value,color:A.value?u.dark_cyan_blue_36:u.light_gray_cyan_blue,data:a.chartData.map(U=>U.units_sold)}];return B.value&&D.unshift({name:c("Compare Range"),key:"units_sold",type:s.value,color:A.value?u.dark_cyan_blue_16:u.light_gray,data:a.compareData.map(U=>({value:U.units_sold,date:U.group}))}),D.map(U=>f(U.name,U.type,0,U.data,U.color))});let w=null;const k=()=>{w&&(w.dispose(),w=null),ye(()=>{n.value&&(w=Mt(n.value),$())})},S=j(()=>{const D=zs(a.reportFilter.data.dateRange);return c("This report looks at the units sold ")+D}),M=j(()=>an(a.chartData.length)),$=()=>{if(!w)return;const D=In(a.chartData),U={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.dark_cyan_blue_16:u.light_gray_blue}},formatter:I=>{let O="";const P=A.value?"#ffffff":"#565865";return I.forEach(function(K,G){const ne=typeof K.data=="object"&&K.data!==null,Y=ne?Ys(K.data.date):K.name,N=ne?K.data.value:K.value,oe=I.length>1&&G===0;oe&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${Y}</div>`,O+=`<div> |
| 253 |
${K.marker} |
| 254 |
<span style="color: ${P}">${c("Units Sold")}</span> |
| 255 |
<span style="float: right; margin-left: 20px; color: ${P}"> |
| 256 |
${jt(N)} |
| 257 |
</span> |
| 258 |
</div>`,oe&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:D,splitNumber:M.value.splitNumber,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(U,{notMerge:!0,replaceMerge:["series"]})},F=()=>{o.value=!o.value,o.value&&w?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):w&&$()},L=D=>{Zt.onChange("revenue","revenue_chart",D),s.value!==D&&(o.value=!1,s.value=D,$())};ge([()=>a.chartData,m],()=>{ye(()=>{$()})},{deep:!0}),ge(()=>Kn.data.product,()=>{ye(()=>{$()})},{deep:!0}),ge(()=>a.isEmpty,D=>{D||k()}),ge(()=>a.loading,D=>{D||k()});const Q=()=>{w&&w.resize()},T=()=>{A.value=ke.isDark(),ye(()=>{$()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("resize",Q),setTimeout(()=>{k()},100)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("resize",Q),w&&(w.dispose(),w=null)}),(D,U)=>{const I=C("el-tooltip"),O=C("el-option"),P=C("el-select"),K=C("el-skeleton");return d(),_("div",lse,[l(he,{id:"chartContainer"},{default:i(()=>[l(Ce,{title_size:"small",border_bottom:""},Rt({title:i(()=>[r("div",ose,[r("h5",rse,h(p(c)("Product Report Chart")),1),l(I,{"popper-class":"fct-tooltip",content:S.value,placement:"top"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:i(()=>[r("div",ise,[l(P,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":U[0]||(U[0]=G=>m.value=G),onChange:v},{default:i(()=>[(d(),_(H,null,ee(g,G=>l(O,{key:G.value,label:p(c)(G.label),value:G.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),r("div",dse,[l(jn,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:L},null,8,["activeType"]),l(Oe,{tag:"button",size:"small",title:p(c)("Zoom Chart"),onClick:F,class:de(o.value?"primary":"")},{default:i(()=>[l(W,{name:"SearchAdd"})]),_:1},8,["title","class"]),l(pa,{targetRef:n.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),l(me,{class:"px-0"},{default:i(()=>[e.loading?(d(),E(K,{key:0,animated:"",rows:8,class:"p-5"})):(d(),_(H,{key:1},[e.isEmpty?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[e.isEmpty?x("",!0):(d(),_("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:n},null,512)),r("div",use,[r("div",cse,[r("div",Ase,[l(W,{name:"ArrowUp",class:"arrow-up"}),r("span",pse,h(p(c)("Data")),1)]),r("div",fse,[r("span",mse,h(p(c)("Timeline")),1),l(W,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},_se=He(hse,[["__scopeId","data-v-259e83ce"]]);class gse extends Ya{constructor(){super(...arguments);Ee(this,"data",{summary:{},previousSummary:{},fluctuations:{},isBusy:!0,currentMetrics:[],previousMetrics:[],chartData:[],topSoldProducts:[]})}get controllerKey(){return"ProductReportController"}makeRequest(a,n,s,o){this.data.isBusy=!0,typeof n!="object"&&(n={});const u=re.get(`reports/${a}`,n);return this.resolvePromiseResponse(u,s,o),u}resolvePromiseResponse(a,n=null,s=null){a.then(o=>{s==null||n==null?Object.assign(this.data,o):this.data[s]=o[n]}).catch(o=>{}).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 gn=gse.init(),vse={class:"summary-item-inner"},yse={class:"value"},bse={class:"inner-value"},wse={class:"title"},Cse={__name:"Summary",props:{reportFilter:{type:Object}},setup(e){e.reportFilter;const a=[{title:"Units Sold",key:"units_sold",info:c("The total number of units sold in this period.")},{title:"Gross Sale",key:"gross_sale",hasCurrency:!0,info:c("The total sales you had in this period.")},{title:"Refunds",key:"total_refunds",hasCurrency:!0,liability:!0,info:c("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:"Revenue",key:"net_sale",hasCurrency:!0,info:c("Gross sales less refunds, taxes, shipping, fees.")}],n=j(()=>gn.data.isBusy),s=j(()=>a.map(A=>({key:A.key,title:A.title,value:gn.data.summary[A.key]||0,fluctuation:gn.data.fluctuations[A.key]||0,info:A.info,liability:A.liability||!1,hasCurrency:A.hasCurrency||!1}))),o=j(()=>a.filter(A=>A.hasCurrency).map(A=>A.key)),u=A=>o.value.includes(A.key)?Bn(A.value,A.liability):jt(A.value);return(A,f)=>{const m=C("el-tooltip");return n.value?(d(),E(Gn,{key:0,loading:n.value,count:s.value.length},null,8,["loading","count"])):(d(),_("div",{key:1,class:de(["fct-report-order-summary",n.value?"":"summary-col-4"])},[(d(!0),_(H,null,ee(s.value,(g,y)=>(d(),_("div",{class:"summary-item",key:y},[r("div",vse,[r("div",yse,[r("div",bse,[l(qs,{amount:u(g),title:g.title},null,8,["amount","title"])]),l(An,{fluctuation:g.fluctuation,amount:p(gn).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),r("div",wse,[R(h(p(c)(g.title))+" ",1),l(m,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:i(()=>[l(W,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},Bse={class:"fct-product-performance-chart"},kse={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},xse={class:"flex items-center gap-3 flex-wrap"},Sse={class:"selector-group"},Fse={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"},Ese={class:"selector-group"},Use={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"},$se={class:"text-xs font-medium text-gray-500"},Dse={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"},Qse={class:"text-xs font-medium text-gray-500"},Ise={key:0,class:"comparison-results"},Tse={class:"legend flex items-center gap-4 mb-4"},Vse={class:"flex items-center"},Mse={class:"text-xs text-gray-600"},Lse={class:"flex items-center"},Rse={class:"text-xs text-gray-600"},Ose={class:"comparison-table"},Hse={class:"w-full"},Pse={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Nse={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"},Kse={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"},Gse={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"},jse={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},zse={class:"py-3"},Yse={class:"dual-bar-container"},qse={class:"bar-label"},Wse={class:"dual-bar-wrapper"},Xse=["onMouseenter"],Jse=["onMouseenter"],Zse={class:"py-3 text-right"},ele={key:0},tle={colspan:"3",class:"py-4 text-center text-gray-500"},ale={class:"text-sm"},nle={key:1,class:"current-period-data"},sle={class:"legend flex items-center gap-4 mb-4"},lle={class:"flex items-center"},ole={class:"text-xs text-gray-600"},rle={class:"current-period-table"},ile={class:"w-full"},dle={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},ule={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"},cle={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"},Ale={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},ple={class:"py-3"},fle={class:"single-bar-container"},mle=["onMouseenter"],hle={class:"single-bar-wrapper"},_le=["onMouseenter"],gle={key:0},vle={colspan:"2",class:"py-4 text-center text-gray-500"},yle={class:"text-sm"},ble={key:2,class:"no-comparison-message"},wle={class:"flex flex-col items-center justify-center text-center py-8"},Cle={class:"text-gray-500 text-sm"},Ble={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){Wm(te=>({38870964:a.value?"#1C2732":"#F9FAFB","38e9f3a8":P.value,"71ec137a":K.value,"2fc09a58":G.value}));const t=e,a=V(ke.isDark()),n=V(!0);Be(()=>{o(),t.reportFilter.addListener("product-top-chart",()=>{o()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=ke.isDark()})}),V({});const s=V({}),o=()=>{n.value=!0;const te=t.reportFilter.applicableFilters;re.get("reports/product-performance",te).then(X=>{s.value=X.productPerformance,B(),M(!0)}).finally(()=>n.value=!1)},u=j(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),A=V(""),f=V(""),m=V(""),g=V(""),y=te=>te.sort((X,ie)=>Re(X.value).diff(Re(ie.value))),v=V([]),B=()=>{const te=new Set;Object.keys(s.value).forEach(X=>{const ie=X.split("-")[0];te.add(ie)}),v.value=Array.from(te).sort()},b=te=>{if(!te)return[];const X=[];return Object.keys(s.value).forEach(ie=>{ie.startsWith(te)&&X.push({value:ie,label:Re(ie).format("MMMM")})}),y(X)},w=j(()=>{if(!A.value||!m.value)return!1;const te=!!f.value,X=!!g.value;return!te&&!X?A.value!==m.value:te&&X?f.value!==g.value:!0}),k=j(()=>f.value?Re(f.value).format("MMM YYYY"):A.value),S=j(()=>g.value?Re(g.value).format("MMM YYYY"):m.value),M=(te=!1)=>{const X=v.value;if(X.length){if(!A.value||te){A.value=X[0];const ie=b(A.value);ie.length&&(f.value=ie[0].value)}if(!m.value||te){m.value=X[X.length-1];const ie=b(m.value);ie.length&&(g.value=ie[ie.length-1].value)}}},$=te=>s.value[te]||[],F=te=>{const X={};Object.entries(s.value).forEach(([be,se])=>{be.startsWith(te)&&se.forEach(ce=>{X[ce.name]||(X[ce.variation_id]={...ce,value:0}),X[ce.variation_id].value+=ce.value})});const ie=[];return Object.values(X).forEach(be=>{ie.push(be)}),ie},L=(te,X)=>X?$(X):(F(te),F(te)),Q=j(()=>A.value?[...L(A.value,f.value)].sort((X,ie)=>ie.value-X.value):[]),T=j(()=>Q.value.length?Math.max(...Q.value.map(te=>te.value))*1.1:100),D=te=>te===0||T.value===0?0:te/T.value*100,U=j(()=>{if(!w.value)return[];const te=L(A.value,f.value),X=L(m.value,g.value),ie=new Set;return te.forEach(ce=>ie.add(ce.variation_id)),X.forEach(ce=>ie.add(ce.variation_id)),Array.from(ie).map(ce=>{const pe=te.find(Ye=>Ye.variation_id===ce),De=(pe==null?void 0:pe.value)||0,$e=X.find(Ye=>Ye.variation_id===ce),Je=($e==null?void 0:$e.value)||0;let we=0;return De>0?we=(Je-De)/De*100:Je>0&&(we=100),{name:(pe==null?void 0:pe.name)||($e==null?void 0:$e.name)||"",post_title:(pe==null?void 0:pe.post_title)||($e==null?void 0:$e.post_title)||"",primaryValue:De,comparisonValue:Je,growthRate:parseFloat(we.toFixed(1))}}).sort((ce,pe)=>Math.abs(pe.growthRate)-Math.abs(ce.growthRate))}),I=(te,X)=>{if(te===0&&X===0)return{primaryWidth:0,comparisonWidth:0};const ie=te+X,be=te/ie*100,se=X/ie*100;return{primaryWidth:be,comparisonWidth:se}},O=te=>te>0?"positive":te<0?"negative":"neutral",P=j(()=>a.value?ke.colors.report.dark_cyan_blue_16:ke.colors.report.light_gray),K=j(()=>a.value?ke.colors.report.dark_cyan_blue_36:ke.colors.report.light_gray_cyan_blue),G=j(()=>a.value?"#ffffff":ke.colors.system.mid),ne=(te,X)=>`${te} ${ir("unit","units",te)} sold in ${X}`,Y=V(!1),N=V(""),oe=V(null);function Z(te,X){oe.value=te.currentTarget,N.value=X,setTimeout(()=>{Y.value=!0},150)}function le(){Y.value=!1}return(te,X)=>{const ie=C("el-skeleton"),be=C("el-option"),se=C("el-select"),ce=C("el-tooltip");return d(),_("div",Bse,[l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),l(me,{class:"pt-6"},{default:i(()=>[n.value?(d(),E(ie,{key:0,animated:"",rows:8})):(d(),_(H,{key:1},[u.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_(H,{key:0},[r("div",kse,[r("div",xse,[r("div",Sse,[l(se,{modelValue:A.value,"onUpdate:modelValue":X[0]||(X[0]=pe=>A.value=pe),placeholder:p(c)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:i(()=>[(d(!0),_(H,null,ee(v.value,pe=>(d(),E(be,{key:pe,label:pe,value:pe},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),l(se,{modelValue:f.value,"onUpdate:modelValue":X[1]||(X[1]=pe=>f.value=pe),placeholder:p(c)("Month"),size:"small",clearable:"",class:"month-select",disabled:!A.value,"popper-class":"minimal-select"},{default:i(()=>[(d(!0),_(H,null,ee(b(A.value),pe=>(d(),E(be,{key:pe.value,label:pe.label,value:pe.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),r("div",Fse,h(p(c)("vs")),1),r("div",Ese,[l(se,{modelValue:m.value,"onUpdate:modelValue":X[2]||(X[2]=pe=>m.value=pe),placeholder:p(c)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:i(()=>[(d(!0),_(H,null,ee(v.value,pe=>(d(),E(be,{key:pe,label:pe,value:pe},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),l(se,{modelValue:g.value,"onUpdate:modelValue":X[3]||(X[3]=pe=>g.value=pe),placeholder:p(c)("Month"),size:"small",clearable:"",class:"month-select",disabled:!m.value,"popper-class":"minimal-select"},{default:i(()=>[(d(!0),_(H,null,ee(b(m.value),pe=>(d(),E(be,{key:pe.value,label:pe.label,value:pe.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),w.value?(d(),_("div",Use,[r("span",$se,h(p(c)("Comparing %s with %s",k.value,S.value)),1)])):A.value?(d(),_("div",Dse,[r("span",Qse,h(p(c)("Viewing %s",k.value)),1)])):x("",!0)]),w.value?(d(),_("div",Ise,[r("div",Tse,[r("div",Vse,[X[5]||(X[5]=r("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),r("span",Mse,h(k.value),1)]),r("div",Lse,[X[6]||(X[6]=r("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),r("span",Rse,h(S.value),1)])]),r("div",Ose,[r("table",Hse,[r("thead",Pse,[r("tr",null,[r("th",Nse,h(p(c)("Product")),1),r("th",Kse,h(p(c)("Sales")),1),r("th",Gse,h(p(c)("Change")),1)])]),r("tbody",null,[(d(!0),_(H,null,ee(U.value,(pe,De)=>(d(),_("tr",{key:De,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[r("td",jse,[R(h(pe.post_title)+" ",1),X[7]||(X[7]=r("br",null,null,-1)),R(" "+h(pe.name),1)]),r("td",zse,[r("div",Yse,[r("span",qse,h(pe.primaryValue)+h(" vs "+pe.comparisonValue)+" "+h(p(c)("Units")),1),r("div",Wse,[r("div",{class:"dual-bar-segment primary-segment",style:ia({width:`${I(pe.primaryValue,pe.comparisonValue).primaryWidth}%`}),onMouseenter:$e=>Z($e,ne(pe.primaryValue,k.value)),onMouseleave:le},null,44,Xse),r("div",{class:"dual-bar-segment comparison-segment",style:ia({width:`${I(pe.primaryValue,pe.comparisonValue).comparisonWidth}%`}),onMouseenter:$e=>Z($e,ne(pe.comparisonValue,S.value)),onMouseleave:le},null,44,Jse)])])]),r("td",Zse,[r("div",{class:de(["growth-pill",O(pe.growthRate)])},h(pe.growthRate>0?"+":"")+h(pe.growthRate)+"% ",3)])]))),128)),U.value.length===0?(d(),_("tr",ele,[r("td",tle,[r("span",ale,h(p(c)("No comparison data available")),1)])])):x("",!0)])])])])):A.value&&Q.value.length>0?(d(),_("div",nle,[r("div",sle,[r("div",lle,[X[8]||(X[8]=r("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),r("span",ole,h(k.value),1)])]),r("div",rle,[r("table",ile,[r("thead",dle,[r("tr",null,[r("th",ule,h(p(c)("Product")),1),r("th",cle,h(p(c)("Sales")),1)])]),r("tbody",null,[(d(!0),_(H,null,ee(Q.value,(pe,De)=>(d(),_("tr",{key:De,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[r("td",Ale,[R(h(pe.post_title)+" ",1),X[9]||(X[9]=r("br",null,null,-1)),R(" "+h(pe.name),1)]),r("td",ple,[r("div",fle,[r("span",{class:"bar-label",onMouseenter:$e=>Z($e,ne(pe.value,S.value)),onMouseleave:le},h(pe.value)+" "+h(p(ir)("Unit","Units",pe.value)),41,mle),r("div",hle,[r("div",{class:"single-bar-segment",style:ia({width:`${D(pe.value)}%`}),onMouseenter:$e=>Z($e,ne(pe.value,S.value)),onMouseleave:le},null,44,_le)])])])]))),128)),Q.value.length===0?(d(),_("tr",gle,[r("td",vle,[r("span",yle,h(p(c)("No data available for this period")),1)])])):x("",!0)])])])])):(d(),_("div",ble,[r("div",wle,[X[10]||(X[10]=r("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"},[r("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)),r("p",Cle,h(p(c)("Please select a time period to view sales data")),1)])])),l(ce,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:Y.value,"onUpdate:visible":X[4]||(X[4]=pe=>Y.value=pe),content:N.value,"virtual-ref":oe.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},kle=He(Ble,[["__scopeId","data-v-5cf85c06"]]),xle={class:"fct-revenue-report-page"},Sle={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=A=>{gn.getProductReportData({params:{...A.params,groupKey:u.value}}),gn.getTopSoldProducts(A)},n=A=>{u.value!==A&&(u.value=A,a(o))},s=t.reportFilter,o=s.applicableFilters,u=V("default");return Be(()=>{s.addListener("product-report",a),a(o)}),At(()=>{s.removeListener("product-report",!1)}),(A,f)=>(d(),E(St,{permission:"reports/view"},{default:i(()=>[r("div",xle,[l(za,{title:p(c)("Products")},null,8,["title"]),l(Cse,{reportFilter:p(s)},null,8,["reportFilter"]),l(_se,{chartData:p(gn).data.currentMetrics,compareData:p(gn).data.previousMetrics,appliedGroupKey:u.value,reportFilter:t.reportFilter,onFilterData:n,"is-empty":!p(gn).data.summary.gross_sale,loading:p(gn).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),l(yu,{data:p(gn).data.topSoldProducts,loading:p(gn).data.isBusy},null,8,["data","loading"]),l(kle,{reportFilter:p(s)},null,8,["reportFilter"])])]),_:1}))}},Fle={class:"fct-overview-chart-wrap"},Ele={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Ule={__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=V(null),n=V(null),s=V("bar"),o=V(null),u=ke.colors,A=V(ke.isDark()),f=j(()=>A.value?u.blue[500]+"52":u.blue[300]),m={current:c("Current"),prev:c("Previous"),yoy_growth:c("YoY Growth")},g=j(()=>{try{return Object.keys(t.data).map(M=>({label:M,value:t.data[M][t.dataKey]||0}))}catch(S){return o.value=`Error processing data: ${S.message}`,[]}}),y=j(()=>g.value.length?t.dateRange?g.value.map(S=>{try{const[M,$]=S.label.split("-");return new Date(M,$-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return S.label}}):g.value.map(S=>S.label):[]),v=j(()=>g.value.length?[{title:m[t.dataKey]||t.dataKey,data:g.value.map(M=>M.value),color:f.value,yAxisIndex:0}].map(({title:M,data:$,color:F,yAxisIndex:L})=>k(M,s.value,$,F,L)):[]);let B=null;const b=()=>{if(a.value&&B===null)try{B=Mt(a.value),w()}catch(S){o.value=`Error initializing chart: ${S.message}`}},w=()=>{if(!B||o.value)return;A.value=ke.isDark();const S={title:{text:"",left:"center"},legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:A.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.report.dark_cyan_blue_16:u.report.light_gray_cyan_blue}},formatter:M=>{let $=M[0].name;const F=A.value?"#ffffff":"#565865";return M.forEach(L=>{const Q=Te.formatScaled(L.value);$+=`<div> |
| 259 |
${L.marker} |
| 260 |
<span style="color: ${F};">${L.seriesName}</span> |
| 261 |
<span style="float: right; margin-left: 20px; color: ${F};"> |
| 262 |
${Q} |
| 263 |
</span> |
| 264 |
</div>`}),$}},xAxis:{type:"category",data:y.value,axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12,formatter:M=>`${Te.formatScaledChart(M)}`},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};try{B.setOption(S,{notMerge:!0,replaceMerge:["series"]})}catch(M){o.value=`Error updating chart: ${M.message}`}},k=(S,M,$,F,L)=>({name:S,type:M,barMaxWidth:t.barMaxWidth,areaStyle:M==="line"?{}:void 0,data:$,smooth:!0,color:F,lineStyle:{width:2},yAxisIndex:L,emphasis:{itemStyle:{color:A.value?u.blue[800]:u.blue[400]}}});return ge([()=>t.data,()=>t.dataKey,()=>t.labelSet,s],()=>{ye(w)},{deep:!0}),At(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),B&&(B.dispose(),B=null)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),ye(b)}),(S,M)=>(d(),_("div",Fle,[l(he,{id:"chartContainer",ref_key:"cardRef",ref:n},{default:i(()=>[l(me,{class:"p-0"},{default:i(()=>[o.value?(d(),_("div",Ele,h(o.value),1)):x("",!0),e.isEmpty?(d(),E(at,{key:2,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:1,class:"fct-chart-wrap fct-overview-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},zo=He(Ule,[["__scopeId","data-v-c9fd4c06"]]),$le={class:"fct-gross-volume-chart-wrap"},Dle={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Qle={__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=V(null),n=V(null),s=V("bar"),o=V(null),u=ke.colors,A=V(ke.isDark()),f={current:c("Current"),prev:c("Previous"),prev_year:c("Previous"),yoy_growth:c("YoY Growth")},m=j(()=>{if(!t.data||typeof t.data!="object")return o.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(S){return o.value=`Error processing data: ${S.message}`,[]}}),g=j(()=>m.value.length?m.value.map(S=>{if(t.isDate)try{const[M,$]=S.label.split("-");return new Date(M,$-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return S.label}else return S.label}):[]),y=j(()=>m.value.length?[{title:f[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:A.value?u.report.blue_dark_mode:u.report.blue},{title:f[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:A.value?u.blue[500]+"52":u.blue[300]}].map(({title:S,dataKey:M,type:$,color:F})=>k(S,$,m.value.map(L=>L[M]),F)):[]),v=j(()=>m.value.length?m.value.map(M=>M.growth):[]);let B=null;const b=()=>{if(a.value&&B===null)try{B=Mt(a.value),w()}catch(S){o.value=`Error initializing chart: ${S.message}`}},w=()=>{if(!B||o.value)return;A.value=ke.isDark();const S={legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:A.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?u.report.dark_cyan_blue_16:u.report.light_gray_cyan_blue}},formatter:M=>{let $=M[0].name;const F=A.value?"#ffffff":"#565865",L=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:c("YoY Growth"),value:isNaN(L)?"N/A":L.toFixed(2)+"%"});const Q=A.value?u.report.dark_cyan_blue_16:u.report.light_gray_blue;return M.forEach(function(T,D){const U=D===M.length-1,I=U?T.value:Te.formatScaled(T.value);U?$+=`<div style="border-top: 1px solid ${Q}; margin-top: 5px; padding-top: 5px;">`:$+="<div>",$+=` |
| 265 |
${T.marker} |
| 266 |
<span style="color: ${F};">${T.seriesName}</span> |
| 267 |
<span style="float: right; margin-left: 20px; color: ${F};"> |
| 268 |
${I} |
| 269 |
</span> |
| 270 |
</div>`}),$}},xAxis:{type:"category",data:g.value,axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",name:c("Volume (%s)",Te.currencySign),axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12,formatter:M=>Te.formatScaledChart(M)},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:"YoY Growth (%)",axisLabel:{color:A.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{B.setOption(S,{notMerge:!0,replaceMerge:["series"]})}catch(M){o.value=`Error updating chart: ${M.message}`}},k=(S,M,$,F,L=0)=>({name:S,type:M,barMaxWidth:t.barMaxWidth,areaStyle:M==="line"?null:void 0,data:$,smooth:M==="line",color:F,lineStyle:M==="line"?{width:2}:void 0,yAxisIndex:L,emphasis:{scale:2,itemStyle:{color:A.value?u.blue[800]:u.blue[400]}}});return ge([()=>t.data,s],()=>{ye(w)},{deep:!0}),At(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),B&&(B.dispose(),B=null)}),Be(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),ye(b)}),(S,M)=>(d(),_("div",$le,[l(he,{id:"chartContainer",ref_key:"cardRef",ref:n},{default:i(()=>[l(Ce,{title:p(c)(e.title),title_size:"small",border_bottom:""},{action:i(()=>M[0]||(M[0]=[])),_:1},8,["title"]),l(me,{class:"p-0"},{default:i(()=>[o.value?(d(),_("div",Dle,h(o.value),1)):x("",!0),e.isEmpty?(d(),E(at,{key:2,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:1,class:"fct-chart-wrap fct-gross-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},FA=He(Qle,[["__scopeId","data-v-f7c41726"]]),Ile={class:"fct-country-volume-chart-wrap"},Tle={class:"fct-btn-group sm"},Vle={__name:"CountryVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=V(null),n=V(null);let s=null;const o=V("bar");V("");const u=V(ke.isDark()),A=j(()=>[u.value?"#032647":"#3e9df6",u.value?"#04315b":"#1589f4",u.value?"#053c70":"#0a73d5",u.value?"#064784":"#0968c1",u.value?"#075298":"#085dad"]),f=j(()=>{const k=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!k.length||!k.every(S=>!!S)}),m=ke.colors,g=j(()=>{const k=t.data.by_month||{};return Object.keys(k).sort().map(M=>{const $=k[M],F=Object.values($).reduce((Q,T)=>Q+T,0),L=Object.entries($).sort((Q,T)=>Q[1]-T[1]).reduce((Q,[T,D])=>({...Q,[T]:D}),{});return{label:M,countries:L,total:F}})}),y=j(()=>g.value.length?g.value.map(k=>{try{const[S,M]=k.label.split("-");return Re(new Date(S,M-1)).format("MMM YYYY")}catch{return k.label}}):[]),v=j(()=>{const k=t.data.by_month||{},S=Object.keys(k).sort(),M=new Set;return Object.values(k).forEach($=>{Object.keys($).forEach(F=>M.add(F))}),Array.from(M).reverse().map($=>{let F;const L=g.value.map((Q,T)=>{const D=k[S[T]],I=Object.entries(D).sort((K,G)=>G[1]-K[1]).map(([K])=>K).indexOf($),O=Q.countries[$]||0,P=I<5?I:4;return!F&&P>=0&&(F=A.value[P]||A.value[4]),{value:O/100,label:{show:O>0,position:"inside",formatter:$,color:(u.value,"#fff"),fontSize:10,fontWeight:"bold"}}});return{name:$,type:o.value,stack:"total",data:L,itemStyle:{color:F},lineStyle:{color:F}}})}),B=()=>{if(!a.value)return;s=Mt(a.value);const k={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:u.value?"#253241":"#ffffff",textStyle:{color:u.value?m.gray[25]:m.system.mid},borderColor:u.value?"#2C3C4E":"#c0c4ca",axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:u.value?m.report.dark_cyan_blue_16:m.report.light_gray_cyan_blue}},borderWidth:1,formatter:S=>{let M=S[0].axisValue;const $=u.value?"#ffffff":"#565865",F=g.value[S[0].dataIndex].total;S=S.sort((Q,T)=>T.value-Q.value).filter(Q=>Q.value>0),S.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:c("Total"),value:F/100});const L=u.value?m.report.dark_cyan_blue_16:m.report.light_gray_blue;return S.forEach(function(Q,T){const D=T===S.length-1;if(!D&&Q.value===0)return;const U=Te.scaled(Q.value);D?M+=`<div style="border-top: 1px solid ${L}; margin-top: 5px; padding-top: 5px;">`:M+="<div>",M+=` |
| 271 |
${Q.marker} |
| 272 |
<span style="color: ${$};">${Q.seriesName}</span> |
| 273 |
<span style="float: right; margin-left: 20px; color: ${$};"> |
| 274 |
${U} |
| 275 |
</span> |
| 276 |
</div>`}),M}},xAxis:{type:"category",data:y.value,axisLabel:{color:u.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{color:u.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",position:"left",name:c("Volume (%s)",Te.currencySign),axisLabel:{color:u.value?"#ffffff":"#696778",fontSize:12,formatter:S=>Te.formatScaled(S*100)},splitLine:{show:!0,lineStyle:{color:u.value?"#253241":"#D6DAE1",type:"dashed"}}},series:v.value};s.setOption(k)},b=()=>{u.value=ke.isDark(),ye(()=>{B()})},w=()=>{s&&(s.dispose(),s=null),B()};return Be(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",w),ye(B)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),ge(()=>u.value,()=>{s&&(s.dispose(),B())}),ge(()=>t.data,()=>{s&&B()}),(k,S)=>(d(),_("div",Ile,[l(he,{id:"chartContainer",ref_key:"cardRef",ref:n},{default:i(()=>[l(Ce,{title:e.title,title_size:"small",border_bottom:""},{action:i(()=>[r("div",Tle,[l(Lh,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),l(me,{class:"p-0"},{default:i(()=>[f.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-chart-wrap fct-country-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},EA=He(Vle,[["__scopeId","data-v-89fa1969"]]),Mle={class:"fct-card-header-title is-small"},UA={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=ke.colors.report,n=V(ke.isDark()),s=V(null),o=V("line"),u=V(t.data),A=j(()=>({textColor:n.value?"#ffffff":"#696778",borderColor:n.value?"#2C3C4E":"#c0c4ca",splitLineColor:n.value?"#253241":"#D6DAE1",bgColor:n.value?"#2d3748":"#ffffff"})),f=j(()=>Object.values(u.value).every(w=>w===0)),m=j(()=>Object.keys(u.value)),g=j(()=>[{name:c("Current"),type:o.value,data:Object.values(u.value),smooth:!0,color:n.value?a.purple_dark_mode:a.purple,lineStyle:{width:2},barMaxWidth:30}]);let y=null;const v=()=>{s.value&&!y&&(y=Mt(s.value),B())},B=()=>{if(!y)return;const w={legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:A.value.bgColor,borderColor:A.value.borderColor,borderWidth:1,textStyle:{color:A.value.textColor},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:n.value?a.dark_cyan_blue_16:a.light_gray_blue}},formatter:k=>{let S=k[0].name;const M=n.value?"#ffffff":"#565865";return k.forEach($=>{const F=Te.formatScaled($.value);S+=`<div> |
| 277 |
${$.marker} |
| 278 |
<span style="color: ${M};">${$.seriesName}</span> |
| 279 |
<span style="float: right; margin-left: 20px; color: ${M};"> |
| 280 |
${F} |
| 281 |
</span> |
| 282 |
</div>`}),S}},xAxis:{type:"category",data:m.value,axisLabel:{color:A.value.textColor,fontSize:12},axisLine:{lineStyle:{type:"dashed",color:A.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:A.value.textColor,fontSize:12,formatter:k=>Te.formatScaled(k)},splitLine:{show:!0,lineStyle:{color:A.value.splitLineColor,type:"dashed"}}},series:g.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};y.setOption(w,{notMerge:!0,replaceMerge:["series"]})};ge([()=>u.value,o,()=>n.value],()=>{ye(B)},{deep:!0});const b=()=>{n.value=ke.isDark(),ye(()=>{B()})};return Be(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",B),ye(v)}),At(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",B,!1)}),(w,k)=>(d(),E(he,null,{default:i(()=>[e.title!==""?(d(),E(Ce,{key:0,border_bottom:!0},{title:i(()=>[r("h3",Mle,h(e.title),1)]),_:1})):x("",!0),l(me,null,{default:i(()=>[f.value?(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(d(),_("div",{key:0,class:"fct-chart-wrap h-[350px]",ref_key:"SubscriptionCountTrendChartRef",ref:s},null,512))]),_:1})]),_:1}))}},Lle={class:"fct-overview-report-loader-wrap"},Rle={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Ole={class:"fct-card-header-title is-small"},Hle={class:"flex gap-2 mt-1"},Ple={class:"py-6"},Nle={class:"grid grid-cols-1"},Kle={class:"fct-card-header-title is-small"},Gle={class:"py-6"},jle={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},zle={class:"fct-card-header-title is-small"},Yle={class:"flex gap-2 mt-1"},qle={class:"py-6"},Wle={class:"grid grid-cols-1"},Xle={class:"fct-card-header-title is-small"},Jle={class:"py-6"},Zle={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},eoe={class:"fct-card-header-title is-small"},toe={class:"py-6"},aoe={__name:"OverviewLoading",setup(e){const t=[{title:c("Gross Summary"),key:"gross_summary"},{title:c("Gross Revenue Quarterly"),key:"net_summary"}],a=[{title:c("Net Revenue"),key:"net_revenue"},{title:c("Net Revenue Quarterly"),key:"net_revenue_quarterly"}],n=[{title:c("Top Country Gross Volume"),key:"top_country_gross"},{title:c("Top Country Net Volume"),key:"top_country_net"}],s=[{title:c("Top Countries Gross Revenue"),key:"top_country_revenue"},{title:c("Top Countries Net Revenue"),key:"top_country_net_revenue"}];return(o,u)=>{const A=C("el-skeleton-item"),f=C("el-skeleton");return d(),_("div",Lle,[r("div",Rle,[(d(),_(H,null,ee(t,(m,g)=>r("div",{key:g},[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:!0},{title:i(()=>[r("h3",Ole,h(m.title),1),r("div",Hle,[l(f,{animated:""},{template:i(()=>[l(A,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),r("div",Ple,[l(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),r("div",Nle,[(d(),_(H,null,ee(2,m=>r("div",{key:m},[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(f,{animated:""},{template:i(()=>[l(A,{variant:"p",class:"w-2/3"})]),_:1}),l(Ce,{border_bottom:!0},{title:i(()=>[r("h2",Kle,h(p(c)("Gross Volume Breakdown")),1)]),_:1}),r("div",Gle,[l(f,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),r("div",jle,[(d(),_(H,null,ee(a,(m,g)=>r("div",{key:g},[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:!0},{title:i(()=>[r("h3",zle,h(m.title),1),r("div",Yle,[l(f,{animated:""},{template:i(()=>[l(A,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),r("div",qle,[l(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),r("div",Wle,[(d(),_(H,null,ee(n,(m,g)=>r("div",{key:g},[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:!0},{title:i(()=>[r("h2",Xle,h(m.title),1)]),_:2},1024),r("div",Jle,[l(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),r("div",Zle,[(d(),_(H,null,ee(s,(m,g)=>r("div",{key:g},[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:!0},{title:i(()=>[r("h3",eoe,h(m.title),1)]),_:2},1024),r("div",toe,[l(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},noe={class:"overview-summary-report-inline"},soe={class:"inner-value"},loe={__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)=>(d(),_("div",noe,[r("div",soe,[l(qs,{amount:p(Te).formatScaled(e.current),title:p(c)(e.title)},null,8,["amount","title"])]),l(An,{fluctuation:e.fluctuation,amount:e.previous/100,fluctuationSuffix:p(c)("YoY")},null,8,["fluctuation","amount","fluctuationSuffix"])]))}},Yo=He(loe,[["__scopeId","data-v-b394c9f1"]]),ooe={class:"report-overview-page"},roe={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},ioe={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},doe={class:"fct-card-header-title is-small"},uoe={class:"fct-card-header-title is-small"},coe={class:"grid grid-cols-1"},Aoe=["innerHTML"],poe=["innerHTML"],foe={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},moe={class:"fct-card-header-title is-small"},hoe={class:"fct-card-header-title is-small"},_oe={class:"grid gap-4 grid-cols-1"},goe={class:"grid gap-4 grid-cols-1"},voe={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},yoe={__name:"Overview",setup(e){const t=V({}),a=V(!0),n=V({gross_revenue_quarterly:{},net_revenue_quarterly:{}}),s=()=>{re.get("reports/overview").then(A=>{t.value=A.data,o()}).catch(A=>{}).finally(()=>{a.value=!1})},o=()=>{n.value.gross_revenue_quarterly=u(t.value.gross_revenue_quarterly,"current","prev_year"),n.value.net_revenue_quarterly=u(t.value.net_revenue_quarterly,"current","prev_year")},u=(A,f="current",m="prev")=>{const g=Ke.sum(A,"*."+f),y=Ke.sum(A,"*."+m),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return j(()=>{var A,f;return((A=t.value.gross_summary)==null?void 0:A.yoy_growth)<0?"danger":((f=t.value.gross_summary)==null?void 0:f.yoy_growth)===null?"warning":"success"}),Be(()=>{s()}),(A,f)=>(d(),_("div",ooe,[r("div",roe,[l(W,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+h(p(c)("Last %s Months",p(c)(12))),1)]),a.value?(d(),E(aoe,{key:0})):(d(),_(H,{key:1},[r("div",ioe,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:""},{title:i(()=>[r("h3",doe,h(p(c)("Gross Summary")),1),l(Yo,{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}),l(zo,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:""},{title:i(()=>[r("h3",uoe,h(p(c)("Gross Revenue Quarterly")),1),l(Yo,{current:n.value.gross_revenue_quarterly.current,previous:n.value.gross_revenue_quarterly.prev,fluctuation:n.value.gross_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),l(zo,{data:t.value.gross_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!n.value.gross_revenue_quarterly.current},null,8,["data","is-empty"])]),_:1})]),_:1})]),r("div",coe,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[r("div",{class:"mb-3",innerHTML:p(Te).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,Aoe),l(FA,{title:"Gross Volume Breakdown",data:t.value.gross_revenue,dataKey:"current","is-date":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[r("div",{class:"mb-3",innerHTML:p(Te).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,poe),l(FA,{title:p(c)("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})]),r("div",foe,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:!0},{title:i(()=>[r("h3",moe,h(p(c)("Net Revenue")),1),l(Yo,{title:"Net Revenue",current:t.value.net_summary.total,previous:t.value.net_summary.total_prev,fluctuation:t.value.net_summary.yoy_growth},null,8,["current","previous","fluctuation"])]),_:1}),l(zo,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(Ce,{border_bottom:!0},{title:i(()=>[r("h3",hoe,h(p(c)("Net Revenue Quarterly")),1),l(Yo,{title:"Net Revenue Quarterly",current:n.value.net_revenue_quarterly.current,previous:n.value.net_revenue_quarterly.prev,fluctuation:n.value.net_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),l(zo,{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})]),r("div",_oe,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(EA,{data:t.value.top_country_gross,title:p(c)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),r("div",goe,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>[l(EA,{data:t.value.top_country_net,title:p(c)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),r("div",voe,[l(he,null,{default:i(()=>[l(me,null,{default:i(()=>{var m;return[l(UA,{data:(m=t.value.top_country_gross)==null?void 0:m.by_countries,title:p(c)("Top Countries Gross Revenue")},null,8,["data","title"])]}),_:1})]),_:1}),l(he,null,{default:i(()=>[l(me,null,{default:i(()=>{var m;return[l(UA,{data:(m=t.value.top_country_net)==null?void 0:m.by_countries,title:p(c)("Top Countries Net Revenue")},null,8,["data","title"])]}),_:1})]),_:1})])],64))]))}},boe={class:"setting-wrap"},woe={class:"setting-wrap-inner"},Coe={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},Boe={class:"grid gap-3 mb-6"},koe={class:"grid gap-3 mb-6"},xoe={class:"grid gap-3 mb-6"},Soe={class:"grid gap-3"},Foe={class:"payment-method-list fct-content-card-list"},Eoe={class:"flex items-start gap-3"},Uoe={class:"grid gap-2 flex-1"},$oe={key:0,class:"fct-content-card-list-head stripe"},Doe=["src","alt"],Qoe=["src","alt"],Ioe={class:"block font-semibold text-system-dark dark:text-system-light"},Toe={class:"fct-content-card-list-content"},Voe={class:"fct-content-card-list-action flex items-center gap-2"},Moe={key:0},Loe=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=dm(),{form:a}=t.data,n=xs(),s=V([]),o=V([]),u=V(!0),A=V(!1),f=V(!0),m=V({}),g=V(!1),y=V({}),v=V(!1),B=V(""),b=V(""),w=j(()=>Object.keys(y.value).length>0),k=()=>{A.value=!0;let Q=a.values;re.post("settings/modules",{...Q}).then(T=>{q.success(c("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(T=>{if(T&&T.message)return q.error(T);m.value=T}).finally(()=>{A.value=!1,f.value=!1,u.value=!1})},S=()=>{u.value=!0,re.get("settings/modules",{}).then(Q=>{var U,I;a.setSchema(Q.fields).setDefaults(Q.settings).initForm(),s.value=Q.settings,o.value=Q.fields,f.value=!1,A.value=!1;const T=((I=(U=Q.fields)==null?void 0:U.modules_settings)==null?void 0:I.schema)||[];let D=!1;Array.isArray(T)?D=T.length>0:D=Object.keys(T).length>0,g.value=D}).finally(()=>{u.value=!1})},M=()=>{v.value=!0,re.get("settings/modules/plugin-addons",{}).then(Q=>{y.value=Q.addons||{}}).catch(Q=>{q.error(Q)}).finally(()=>{v.value=!1})},$=Ie.get("app_config.isProActive"),F=(Q,T)=>{if(!$){window.open(Q.repo_link,"_blank","noopener,noreferrer");return}B.value=T,re.post("settings/modules/plugin-addons/install",{plugin_slug:Q.plugin_slug,source_type:Q.source_type||"wordpress",source_link:Q.source_link||"",asset_path:Q.asset_path||""}).then(D=>{D.action==="copy"&&D.url?(Os.copy(D.url,{successMessage:c("Download link copied to your clipboard")}),window.open(D.url,"_blank","noopener,noreferrer")):D.action==="reload"?(q.success(D.message||c("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):q.success(D.message||c("Addon installed successfully"))}).catch(D=>{q.error(D)}).finally(()=>{B.value=""})},L=(Q,T)=>{b.value=T,re.post("settings/modules/plugin-addons/activate",{plugin_file:Q.plugin_file}).then(D=>{q.success(D.message||c("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(D=>{q.error(D)}).finally(()=>{b.value=""})};return Be(()=>{S(),M()}),n.onSave(k),(Q,T)=>{const D=C("el-skeleton-item"),U=C("el-skeleton"),I=C("el-form"),O=C("el-button"),P=C("el-icon"),K=C("router-link");return d(),_("div",boe,[l(ha,{heading:p(c)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),r("div",woe,[l(_a),f.value?(d(),_("div",Coe,[l(U,{loading:f.value,animated:""},{template:i(()=>[r("div",Boe,[l(D,{variant:"p",class:"w-[20%]"}),l(D,{variant:"p"})]),r("div",koe,[l(D,{variant:"p",class:"w-[20%]"}),l(D,{variant:"p"})]),r("div",xoe,[l(D,{variant:"p",class:"w-[20%]"}),l(D,{variant:"p"})]),r("div",Soe,[l(D,{variant:"p",class:"w-[20%]"}),l(D,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),f.value?x("",!0):(d(),_(H,{key:1},[p(a).isReady?(d(),E(I,{key:0},{default:i(()=>[g.value?(d(),E(oi,{key:0,form:p(a),showSubmitButton:!0,onOnSubmitButtonClick:k,submitButtonText:p(c)("Save Settings"),loading:A.value,onOnChange:T[0]||(T[0]=G=>{}),"validation-errors":m.value},null,8,["form","submitButtonText","loading","validation-errors"])):w.value?x("",!0):(d(),E(he,{key:1},{default:i(()=>[l(Ce,{title:p(c)("Features & addon"),border_bottom:""},null,8,["title"]),l(me,null,{default:i(()=>[l(at,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:p(c)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):x("",!0),w.value?(d(),E(he,{key:1,class:"mt-6"},{default:i(()=>[l(Ce,{title:p(c)("Plugin Addons"),border_bottom:""},null,8,["title"]),l(me,null,{default:i(()=>[r("div",Foe,[(d(!0),_(H,null,ee(y.value,(G,ne)=>(d(),_("div",{key:ne,class:"fct-content-card-list-item"},[r("div",Eoe,[r("div",Uoe,[G.logo?(d(),_("div",$oe,[r("img",{class:de({"dark:hidden":G.dark_logo}),src:G.logo,alt:G.title},null,10,Doe),G.dark_logo?(d(),_("img",{key:0,src:G.dark_logo,alt:G.title,class:"hidden dark:block"},null,8,Qoe)):x("",!0),r("span",Ioe,h(G.title),1),G.is_active?(d(),E(qt,{key:1,status:"active",text:p(c)("Active")},null,8,["text"])):x("",!0)])):x("",!0),r("div",Toe,[r("p",null,h(G.description),1)])]),r("div",Voe,[G.upcoming?(d(),_("div",Moe,h(p(c)("Coming Soon")),1)):(d(),_(H,{key:1},[G.is_installed?G.is_installed&&!G.is_active&&(p($)||G.source_type!=="github")?(d(),E(O,{key:1,type:"success",size:"small",loading:b.value===ne,disabled:b.value===ne,onClick:Y=>L(G,ne)},{default:i(()=>[R(h(p(c)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):x("",!0):(d(),E(O,{key:0,type:"primary",size:"small",loading:B.value===ne,disabled:B.value===ne,onClick:Y=>F(G,ne)},{default:i(()=>[R(h(p($)?p(c)("Install & Activate"):p(c)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),G.is_active&&ne==="fluent-pdf"?(d(),E(K,{key:2,to:{path:"/settings/pdf-template"}},{default:i(()=>[l(P,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:i(()=>[l(p(ap))]),_:1})]),_:1})):x("",!0)],64))])])]))),128))])]),_:1})]),_:1})):x("",!0)],64))])])}}}),Roe=He(Loe,[["__scopeId","data-v-68277391"]]),Ooe={class:"form-note"},Hoe={class:"form-note"},Poe={class:"form-note"},Noe={class:"form-note"},Koe={class:"el-form-item__label"},Goe={class:"h-[297px] w-full relative"},joe={class:"mt-2 mb-2"},zoe={class:"form-note"},Yoe={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"},qoe={class:"setting-html-wrapper"},Woe={class:"setting-label"},Xoe={class:"form-note"},Joe={class:"setting-fields-inner w-full"},Zoe={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton"),o=C("el-form-item"),u=C("el-col"),A=C("el-row");return d(),E(me,null,{default:i(()=>[l(A,{gutter:15},{default:i(()=>[l(u,{lg:12},{default:i(()=>[l(o,{label:p(c)("From Name"),"label-position":"top"},{default:i(()=>[l(s,{animated:"",class:"h-9 gap-2"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"})]),_:1}),a[0]||(a[0]=r("br",null,null,-1)),r("div",null,[r("div",Ooe,[r("p",null,h(p(c)("Name that will be used to send emails")),1)])])]),_:1,__:[0]},8,["label"])]),_:1}),l(u,{lg:12},{default:i(()=>[l(o,{label:p(c)("From Email"),"label-position":"top"},{default:i(()=>[l(s,{animated:"",class:"h-9"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"})]),_:1}),r("div",null,[r("div",Hoe,[r("p",null,h(p(c)(`Provide Valid Email Address email as per your domain/SMTP settings. This |
| 283 |
email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),l(A,{gutter:15},{default:i(()=>[l(u,{lg:12},{default:i(()=>[l(o,{label:p(c)("Reply to name (Optional)"),"label-position":"top"},{default:i(()=>[l(s,{animated:"",class:"h-9"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"})]),_:1}),r("div",Poe,[r("p",null,h(p(c)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),l(u,{lg:12},{default:i(()=>[l(o,{label:p(c)("Reply to email (Optional)"),"label-position":"top"},{default:i(()=>[l(s,{animated:"",class:"h-9"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"})]),_:1}),r("div",null,[r("div",Noe,[r("p",null,h(p(c)(`If someone replies to your notification email, this is where you would like to |
| 284 |
receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),l(A,{gutter:15},{default:i(()=>[l(u,null,{default:i(()=>[r("div",Koe,h(p(c)("Email Footer")),1),r("div",Goe,[l(s,{animated:"",rows:7})]),r("div",joe,[r("div",zoe,[r("p",null,h(p(c)(`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 |
| 285 |
compliance.`)),1)])]),r("div",Yoe,[l(s,{animated:"",class:"h-5"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1}),l(A,{gutter:15},{default:i(()=>[l(u,null,{default:i(()=>[l(o,null,{default:i(()=>[l(A,{gutter:15,class:"w-full"},{default:i(()=>[l(u,{lg:12},{default:i(()=>[r("div",qoe,[r("span",Woe,h(p(c)("Admin Email Address")),1),r("div",Xoe,[r("p",null,h(p(c)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),l(u,{lg:12},{default:i(()=>[r("div",Joe,[l(s,{animated:"",class:"h-9"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},ere={class:"setting-wrap"},tre={class:"setting-wrap-inner"},are={class:"form-note"},nre={class:"form-note"},sre={class:"form-note"},lre={class:"form-note"},ore={class:"el-form-item__label"},rre={class:"mt-2 mb-2"},ire={class:"form-note"},dre={class:"fct-powered-by-email-footer-checkbox"},ure={class:"setting-html-wrapper"},cre={class:"setting-label"},Are={class:"form-note"},pre={class:"setting-fields-inner w-full"},fre={class:"setting-save-action"},mre={__name:"MailingSettings",setup(e){const t=V({from_name:"",from_email:"",reply_to_name:"",reply_to_email:"",email_footer:"",show_email_footer:"yes",admin_email:"{{wp.admin_email}}"}),a=Ie.get("app_config.isProActive"),n=V(!1),s=V({}),o=V({}),u=()=>{n.value=!0,re.get("email-notification/get-settings").then(f=>{var m,g,y,v,B,b,w;t.value={from_name:(m=f.data)==null?void 0:m.from_name,from_email:(g=f.data)==null?void 0:g.from_email,reply_to_name:(y=f.data)==null?void 0:y.reply_to_name,reply_to_email:(v=f.data)==null?void 0:v.reply_to_email,email_footer:(B=f.data)==null?void 0:B.email_footer,admin_email:(b=f.data)==null?void 0:b.admin_email,show_email_footer:((w=f.data)==null?void 0:w.show_email_footer)||"yes"},o.value=f.shortcodes}).catch(f=>{}).finally(()=>{n.value=!1})},A=()=>{n.value=!0,s.value={},re.post("email-notification/save-settings",t.value).then(f=>{q.success(f.message)}).catch(f=>{f.status_code===422&&f.data?s.value=f.data:f.message?q.error(f.message):(q.error(c("Something went wrong")),s.value=f)}).finally(()=>{n.value=!1})};return Be(()=>{u()}),(f,m)=>{const g=C("el-input"),y=C("el-form-item"),v=C("el-col"),B=C("el-row"),b=C("el-tooltip"),w=C("el-checkbox"),k=C("el-button");return d(),_("div",ere,[l(ha,{heading:p(c)("Mailing Settings"),loading:n.value,onOnSave:A},null,8,["heading","loading"]),r("div",tre,[l(_a),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Email Configuration"),text:p(c)("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"]),n.value?(d(),E(Zoe,{key:0})):(d(),E(me,{key:1},{default:i(()=>[l(B,{gutter:15},{default:i(()=>[l(v,{lg:12},{default:i(()=>[l(y,{label:p(c)("From Name"),"label-position":"top"},{default:i(()=>[l(g,{modelValue:t.value.from_name,"onUpdate:modelValue":m[0]||(m[0]=S=>t.value.from_name=S)},null,8,["modelValue"]),m[9]||(m[9]=r("br",null,null,-1)),r("div",null,[l(un,{"validation-errors":s.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),r("div",are,[r("p",null,h(p(c)("Name that will be used to send emails")),1)])])]),_:1,__:[9]},8,["label"])]),_:1}),l(v,{lg:12},{default:i(()=>[l(y,{label:p(c)("From Email"),"label-position":"top"},{default:i(()=>[l(g,{modelValue:t.value.from_email,"onUpdate:modelValue":m[1]||(m[1]=S=>t.value.from_email=S)},null,8,["modelValue"]),r("div",null,[l(un,{"validation-errors":s.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),r("div",nre,[r("p",null,h(p(c)(`Provide Valid Email Address email as per your domain/SMTP settings. This |
| 286 |
email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),l(B,{gutter:15},{default:i(()=>[l(v,{lg:12},{default:i(()=>[l(y,{label:p(c)("Reply to name (Optional)"),"label-position":"top"},{default:i(()=>[l(g,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":m[2]||(m[2]=S=>t.value.reply_to_name=S)},null,8,["modelValue"]),r("div",sre,[r("p",null,h(p(c)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),l(v,{lg:12},{default:i(()=>[l(y,{label:p(c)("Reply to email (Optional)"),"label-position":"top"},{default:i(()=>[l(g,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":m[3]||(m[3]=S=>t.value.reply_to_email=S)},null,8,["modelValue"]),r("div",null,[l(un,{"validation-errors":s.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),r("div",lre,[r("p",null,h(p(c)(`If someone replies to your notification email, this is where you would like to |
| 287 |
receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),l(B,{gutter:15},{default:i(()=>[l(v,null,{default:i(()=>[r("div",ore,h(p(c)("Email Footer")),1),l(ts,{"short-codes":o.value,modelValue:t.value.email_footer,"onUpdate:modelValue":m[4]||(m[4]=S=>t.value.email_footer=S),onUpdate:m[5]||(m[5]=S=>{t.value.email_footer=S})},null,8,["short-codes","modelValue"]),r("div",rre,[l(un,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),r("div",ire,[r("p",null,h(p(c)(`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 |
| 288 |
compliance.`)),1)])]),r("div",dre,[l(w,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":m[6]||(m[6]=S=>t.value.show_email_footer=S),"true-value":"yes","false-value":"no",disabled:!p(a)},{default:i(()=>[R(h(p(c)("Enable powered by FluentCart in the email footer"))+" ",1),p(a)?x("",!0):(d(),E(b,{key:0,"popper-class":"fct-tooltip",placement:"top"},{content:i(()=>[R(h(p(c)("This feature is available in pro version only.")),1)]),default:i(()=>[l(W,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),l(B,{gutter:15},{default:i(()=>[l(v,null,{default:i(()=>[l(y,null,{default:i(()=>[l(B,{gutter:15,class:"w-full"},{default:i(()=>[l(v,{lg:12},{default:i(()=>[r("div",ure,[r("span",cre,h(p(c)("Admin Email Address")),1),r("div",Are,[r("p",null,h(p(c)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),l(v,{lg:12},{default:i(()=>[r("div",pre,[l(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":m[7]||(m[7]=S=>t.value.admin_email=S)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),r("div",fre,[l(k,{type:"primary",onClick:m[8]||(m[8]=S=>A()),loading:n.value},{default:i(()=>[R(h(p(c)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},hre={class:"setting-wrap"},_re={class:"setting-wrap-inner"},gre={class:"form-note"},vre={class:"form-note"},yre={class:"form-note",style:{"padding-top":"6px"}},bre={class:"form-note"},wre={class:"setting-save-action"},$A="{{wp.admin_email}}",Cre={__name:"StoreDigestSettings",setup(e){const t=V({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=V(!1),n=V({}),s=V(""),o=[{key:"daily",label:c("Daily digest"),desc:c("Yesterday's performance, sent every morning.")},{key:"weekly",label:c("Weekly digest"),desc:c("The previous 7 days, sent on your chosen day.")},{key:"monthly",label:c("Monthly digest"),desc:c("The previous calendar month, sent on the 1st.")}],u=c("Comma-separate multiple addresses. %1$s resolves to the site admin email.",$A),A=j(()=>{const v=[];for(let B=0;B<24;B++)v.push({value:B,label:String(B).padStart(2,"0")+":00"});return v}),f=[{value:1,label:c("Monday")},{value:2,label:c("Tuesday")},{value:3,label:c("Wednesday")},{value:4,label:c("Thursday")},{value:5,label:c("Friday")},{value:6,label:c("Saturday")},{value:7,label:c("Sunday")}],m=()=>{a.value=!0,re.get("email-notification/digest-settings").then(v=>{v.data&&(t.value=v.data)}).catch(()=>{}).finally(()=>{a.value=!1})},g=()=>{a.value=!0,n.value={},re.post("email-notification/digest-settings",t.value).then(v=>{q.success(v.message)}).catch(v=>{v.status_code===422&&v.data?n.value=v.data:v.message?q.error(v.message):q.error(c("Something went wrong"))}).finally(()=>{a.value=!1})},y=v=>{s.value=v,re.post("email-notification/digest-settings/send-test",{frequency:v}).then(B=>{q.success(B.message)}).catch(B=>{q.error(B.message||c("Could not send the test email."))}).finally(()=>{s.value=""})};return Be(()=>{m()}),(v,B)=>{const b=C("el-input"),w=C("el-form-item"),k=C("el-col"),S=C("el-checkbox"),M=C("el-row"),$=C("el-switch"),F=C("el-option"),L=C("el-select"),Q=C("el-button");return d(),_("div",hre,[l(ha,{heading:p(c)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),r("div",_re,[l(_a),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Recipients & General"),text:p(c)("A system email summarising your store activity. Numbers match the Reports dashboard."),border_bottom:""},null,8,["title","text"]),l(me,null,{default:i(()=>[l(M,{gutter:15},{default:i(()=>[l(k,{lg:12},{default:i(()=>[l(w,{label:p(c)("Recipient email addresses"),"label-position":"top"},{default:i(()=>[l(b,{modelValue:t.value.recipients,"onUpdate:modelValue":B[0]||(B[0]=T=>t.value.recipients=T),placeholder:$A},null,8,["modelValue"]),r("div",null,[l(un,{"validation-errors":n.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),r("div",gre,[r("p",null,h(p(u)),1)])])]),_:1},8,["label"])]),_:1}),l(k,{lg:12},{default:i(()=>[l(w,{label:p(c)("Empty periods"),"label-position":"top"},{default:i(()=>[l(S,{modelValue:t.value.send_when_empty,"onUpdate:modelValue":B[1]||(B[1]=T=>t.value.send_when_empty=T),"true-value":"yes","false-value":"no"},{default:i(()=>[R(h(p(c)("Send even when there was no activity")),1)]),_:1},8,["modelValue"]),r("div",vre,[r("p",null,h(p(c)("When off, a digest is skipped for any period with no paid orders.")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),(d(),_(H,null,ee(o,T=>l(he,{key:T.key,class:"fct-mt-4"},{default:i(()=>[l(Ce,{title:T.label,text:T.desc,border_bottom:""},null,8,["title","text"]),l(me,null,{default:i(()=>[l(M,{gutter:15,align:"middle"},{default:i(()=>[l(k,{lg:6},{default:i(()=>[l(w,{label:p(c)("Enable"),"label-position":"top"},{default:i(()=>[l($,{modelValue:t.value[T.key].enabled,"onUpdate:modelValue":D=>t.value[T.key].enabled=D,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),l(k,{lg:6},{default:i(()=>[l(w,{label:p(c)("Send time"),"label-position":"top"},{default:i(()=>[l(L,{modelValue:t.value[T.key].send_hour,"onUpdate:modelValue":D=>t.value[T.key].send_hour=D,class:"w-full"},{default:i(()=>[(d(!0),_(H,null,ee(A.value,D=>(d(),E(F,{key:D.value,label:D.label,value:D.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),T.key==="weekly"?(d(),E(k,{key:0,lg:6},{default:i(()=>[l(w,{label:p(c)("Day of week"),"label-position":"top"},{default:i(()=>[l(L,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":B[2]||(B[2]=D=>t.value.weekly.send_dow=D),class:"w-full"},{default:i(()=>[(d(),_(H,null,ee(f,D=>l(F,{key:D.value,label:D.label,value:D.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):x("",!0),T.key==="monthly"?(d(),E(k,{key:1,lg:6},{default:i(()=>[l(w,{label:p(c)("Send day"),"label-position":"top"},{default:i(()=>[r("div",yre,[r("p",null,h(p(c)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):x("",!0),l(k,{lg:6},{default:i(()=>[l(w,{label:" ","label-position":"top"},{default:i(()=>[l(Q,{loading:s.value===T.key,onClick:D=>y(T.key)},{default:i(()=>[R(h(p(c)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),r("div",bre,[r("p",null,h(p(c)("Send time is in your store timezone. Test emails use your saved recipients.")),1)])]),_:2},1024)]),_:2},1024)),64)),r("div",wre,[l(Q,{type:"primary",onClick:B[3]||(B[3]=T=>g()),loading:a.value},{default:i(()=>[R(h(p(c)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},Bre={};function kre(e,t){const a=C("router-view");return d(),_("div",null,[l(a)])}const xre=He(Bre,[["render",kre]]),Sre={},Fre={class:"fct-setting-form-row"},Ere={class:"w-[300px]"},Ure={class:"flex-grow flex-shrink flex-basis-0 self-center"},$re={class:"fct-setting-form-row"},Dre={class:"w-[300px]"},Qre={class:"flex-grow flex-shrink flex-basis-0 self-center"},Ire={class:"fct-setting-form-row"},Tre={class:"w-[300px]"},Vre={class:"flex-grow flex-shrink flex-basis-0 self-center"};function Mre(e,t){const a=C("el-skeleton-item"),n=C("el-skeleton");return d(),_("div",null,[r("div",Fre,[r("div",Ere,[l(n,{animated:"",class:"max-w-[70%]"},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1}),l(n,{animated:"",class:"max-w-[80%]"},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"}),l(a,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),r("div",Ure,[l(n,{animated:""},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),r("div",$re,[r("div",Dre,[l(n,{animated:"",class:"max-w-[60%]"},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1}),l(n,{animated:"",class:"max-w-full"},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1})]),r("div",Qre,[l(n,{animated:""},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),r("div",Ire,[r("div",Tre,[l(n,{animated:"",class:"max-w-[50%]"},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1}),l(n,{animated:"",class:"max-w-full"},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1})]),r("div",Vre,[l(n,{animated:""},{template:i(()=>[l(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const Lre=He(Sre,[["render",Mre]]),Rre={name:"TaxConfigurations",components:{TaxConfigurationsLoader:Lre,CardContainer:he,CardBody:me,CardHeader:Ce,LabelHint:sa,SettingsHeader:ha,AdminNotice:_a,Animation:ra},data(){return{settings:{enable_tax:"no",tax_inclusion:"included",tax_calculation_basis:"shipping",tax_rounding:"item",checkout_tax_breakdown_display:"both",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:c,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,Ie.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||{}},this.settings.checkout_tax_breakdown_display||(this.settings.checkout_tax_breakdown_display="both"),!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=ks(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.saveSettings()})},unbindSaveShortcut(){var e;(e=this.keyboardShortcuts)!=null&&e.unbind&&this.keyboardShortcuts.unbind("mod+s")}}},Ore={class:"setting-wrap"},Hre={class:"setting-wrap-inner"},Pre={class:"fct-setting-form-row"},Nre={class:"fct-setting-form-content flex gap-3.5 flex-1"},Kre={class:"fct-inline-tip"},Gre={key:1},jre={class:"fct-setting-form-row"},zre={class:"fct-setting-form-content"},Yre={class:"fct-inline-tip"},qre={class:"fct-setting-form-fields self-center"},Wre={class:"fct-inline-tip mt-2"},Xre={class:"fct-setting-form-row"},Jre={class:"fct-setting-form-content"},Zre={class:"fct-inline-tip"},eie={class:"fct-setting-form-fields self-center"},tie={class:"flex flex-col"},aie={class:"price-mode-label"},nie={class:"price-mode-text"},sie={class:"flex flex-col"},lie={class:"price-mode-label"},oie={class:"price-mode-text"},rie={class:"fct-setting-form-row"},iie={class:"fct-setting-form-content"},die={class:"fct-inline-tip"},uie={class:"fct-setting-form-fields self-center"},cie={class:"fct-setting-form-row"},Aie={class:"fct-setting-form-content"},pie={class:"fct-inline-tip"},fie={class:"fct-setting-form-fields self-center"},mie={class:"fct-setting-form-row"},hie={class:"fct-setting-form-content"},_ie={class:"fct-inline-tip"},gie={class:"fct-setting-form-fields self-center"},vie={class:"fct-setting-form-row"},yie={class:"fct-setting-form-content"},bie={class:"fct-inline-tip"},wie={class:"fct-setting-form-fields self-center"},Cie={class:"fct-setting-form-row"},Bie={class:"fct-setting-form-content"},kie={class:"fct-inline-tip"},xie={class:"fct-setting-form-fields"},Sie={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},Fie={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},Eie={class:"fct-inline-tip"},Uie={class:"fct-vat-excluded-categories"},$ie={class:"fct-inline-tip"};function Die(e,t,a,n,s,o){const u=C("SettingsHeader"),A=C("AdminNotice"),f=C("el-switch"),m=C("LabelHint"),g=C("TaxConfigurationsLoader"),y=C("el-radio"),v=C("el-radio-group"),B=C("el-option"),b=C("el-select"),w=C("el-input"),k=C("Animation"),S=C("CardBody"),M=C("CardContainer"),$=Ca("loading");return d(),_("div",Ore,[l(u,{heading:o.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:o.saveSettings},null,8,["heading","loading","onOnSave"]),r("div",Hre,[l(A),l(M,null,{default:i(()=>[l(S,null,{default:i(()=>[r("div",Pre,[r("div",Nre,[l(f,{modelValue:s.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=F=>s.settings.enable_tax=F),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),r("div",null,[l(m,{title:o.translate("Enable Tax")},null,8,["title"]),r("p",Kre,h(s.settings.enable_tax==="yes"?o.translate("This store is now collecting tax."):o.translate("This store is not collecting tax.")),1)])])]),l(k,{visible:s.settings.enable_tax==="yes",accordion:""},{default:i(()=>[s.loading?(d(),E(g,{key:0})):x("",!0),s.loading?x("",!0):(d(),_("div",Gre,[r("div",jre,[r("div",zre,[l(m,{title:o.translate("Prices entered with tax")},null,8,["title"]),r("p",Yre,h(o.translate("Choose whether product prices are entered including or excluding tax.")),1)]),r("div",qre,[l(v,{modelValue:s.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=F=>s.settings.tax_inclusion=F)},{default:i(()=>[l(y,{value:"included"},{default:i(()=>[R(h(o.translate("Included")),1)]),_:1}),l(y,{value:"excluded"},{default:i(()=>[R(h(o.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),r("p",Wre,h(o.translate("Shipping tax always follows the store-level tax mode (Included or Excluded). Product-specific tax settings do not apply to shipping.")),1)])]),r("div",Xre,[r("div",Jre,[l(m,{title:o.translate("Tax-Inclusive Price Mode")},null,8,["title"]),r("p",Zre,h(o.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),r("div",eie,[l(v,{modelValue:s.settings.eu_vat_settings.reverse_charge_price_mode,"onUpdate:modelValue":t[2]||(t[2]=F=>s.settings.eu_vat_settings.reverse_charge_price_mode=F),class:"fct-reverse-charge-price-mode"},{default:i(()=>[l(y,{value:"fixed"},{default:i(()=>[r("div",tie,[r("span",aie,h(o.translate("Fixed")),1),r("span",nie,h(o.translate("Listed price stays unchanged on reverse charge. Only the tax line is zeroed on the invoice.")),1)])]),_:1}),l(y,{value:"dynamic"},{default:i(()=>[r("div",sie,[r("span",lie,h(o.translate("Dynamic")),1),r("span",oie,h(o.translate("VAT is stripped from the price on reverse charge. Customer pays the net (ex-VAT) amount.")),1)])]),_:1})]),_:1},8,["modelValue"])])]),r("div",rie,[r("div",iie,[l(m,{title:o.translate("Calculate Tax Based On")},null,8,["title"]),r("p",die,h(o.translate("Determine the location used for tax calculations.")),1)]),r("div",uie,[l(b,{modelValue:s.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=F=>s.settings.tax_calculation_basis=F),clearable:""},{default:i(()=>[l(B,{value:"shipping",label:o.translate("Customer Shipping Address")},null,8,["label"]),l(B,{value:"billing",label:o.translate("Customer Billing Address")},null,8,["label"]),l(B,{value:"store",label:o.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),r("div",cie,[r("div",Aie,[l(m,{title:o.translate("Price Suffix (Tax Included)")},null,8,["title"]),r("p",pie,h(o.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),r("div",fie,[l(w,{modelValue:s.settings.price_suffix_included,"onUpdate:modelValue":t[4]||(t[4]=F=>s.settings.price_suffix_included=F),placeholder:o.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),r("div",mie,[r("div",hie,[l(m,{title:o.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),r("p",_ie,h(o.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),r("div",gie,[l(w,{modelValue:s.settings.price_suffix_excluded,"onUpdate:modelValue":t[5]||(t[5]=F=>s.settings.price_suffix_excluded=F),placeholder:o.translate("e.g. (+ tax)")},null,8,["modelValue","placeholder"])])]),r("div",vie,[r("div",yie,[l(m,{title:o.translate("Checkout Tax Breakdown Display")},null,8,["title"]),r("p",bie,h(o.translate("Choose how tax context appears on each checkout line item.")),1)]),r("div",wie,[l(b,{modelValue:s.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=F=>s.settings.checkout_tax_breakdown_display=F)},{default:i(()=>[l(B,{value:"both",label:o.translate("Item label and tooltip")},null,8,["label"]),l(B,{value:"label",label:o.translate("Item label only")},null,8,["label"]),l(B,{value:"tooltip",label:o.translate("Tooltip only")},null,8,["label"])]),_:1},8,["modelValue"])])]),r("div",Cie,[r("div",Bie,[l(m,{title:o.translate("VAT Reverse Charge Settings")},null,8,["title"]),r("p",kie,h(o.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),r("div",xie,[r("div",Sie,[r("div",Fie,[l(f,{modelValue:s.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[7]||(t[7]=F=>s.settings.eu_vat_settings.local_reverse_charge=F),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),r("div",null,[l(m,{title:o.translate("Local Reverse Charge")},null,8,["title"]),r("p",Eie,h(o.translate("If enabled, apply reverse charge when applicable even when customers are in your home country.")),1)])]),l(k,{visible:o.handlePriceMode,accordion:""},{default:i(()=>[r("div",Uie,[l(m,{title:o.translate("Exclude Categories from VAT reverse")},null,8,["title"]),r("p",$ie,h(o.translate("Select product categories that should NOT get VAT reverse charge !")),1),Dt((d(),E(b,{modelValue:s.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[8]||(t[8]=F=>s.settings.eu_vat_settings.vat_reverse_excluded_categories=F),filterable:"",multiple:"",clearable:"",placeholder:o.translate("Select Product Categories"),class:"w-full mt-4"},{default:i(()=>[(d(!0),_(H,null,ee(s.categories,F=>(d(),E(B,{key:F.value||F.term_id,label:F.label||F.name,value:F.value||F.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[$,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const Qie=He(Rre,[["render",Die]]),Iie={class:"fct-tax-rates-wrap-loader px-5"},Tie={__name:"TaxRatesLoader",setup(e){const t=V(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,n)=>{const s=C("el-skeleton-item"),o=C("el-skeleton");return d(),_("div",Iie,[(d(!0),_(H,null,ee(t.value,(u,A)=>(d(),_("div",{key:A,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"},[l(o,{animated:"",style:ia({width:u}),class:"h-4"},{template:i(()=>[l(s,{variant:"p",class:"h-4"})]),_:2},1032,["style"]),l(o,{animated:"",class:"w-[100px] h-4"},{template:i(()=>[l(s,{variant:"p",class:"h-4"})]),_:1})]))),128))])}}},Vie={class:"setting-wrap"},Mie={class:"setting-wrap-inner"},Lie={class:"fct-all-tax-classes-page"},Rie={class:"flex items-center justify-end gap-4"},Oie={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},Hie={class:"inline-flex items-center gap-2"},Pie={class:"inline-flex items-center gap-2"},Nie=["src","alt"],Kie={key:0,class:"text-gray-400 dark:text-gray-300"},Gie={key:1,class:"text-success-500"},jie={key:2,class:"text-system-mid dark:text-gray-300"},zie={key:3,class:"text-gray-400 dark:text-gray-300"},Yie={key:1,class:"text-gray-400"},qie={__name:"TaxRates",setup(e){const t=V({}),a=V([]),n=V({}),s=V({}),o=j(()=>!!Ie.get("is_tax_enabled")),u=V(!1),A=V({}),f={};let m=0;const g=V(""),y=V(!1),v={XI:"gb"},B=D=>(v[D]||D).toLowerCase(),b=j(()=>{const D=new Set;for(const U of a.value)for(const I of U.countries||[])D.add(I.country_code);return D}),w=D=>!D||!Object.prototype.hasOwnProperty.call(s.value,D)?!0:s.value[D],k=D=>!D||!D.vat?!1:D.rates&&typeof D.rates=="object"&&Object.keys(D.rates).length?Object.values(D.rates).some(U=>U&&parseFloat(U.rate)>0):parseFloat(D.rate)>0,S=j(()=>{const D=n.value||{},U=Array.isArray(D.country_registrations)?D.country_registrations:[],I=D.method||"",O=U.some(k);if(I==="oss")return!!D.oss_country;if(I==="home"){const P=D.home_country||"",K=U.find(G=>G.country===P);if(P&&K&&k(K))return!0}return I==="specific"?!!D.home_country:O}),M=j(()=>{const D=n.value||{},U=Array.isArray(D.country_registrations)?D.country_registrations:[],I=D.method||"";return I==="oss"?!!D.oss_country:I==="home"?!!D.home_country&&U.some(O=>O.country===D.home_country):I==="specific"?!!D.home_country:U.some(k)}),$=j(()=>{const D=[],U=Object.values(t.value||{});for(const P of U)if(P.group_code==="EU")D.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:M.value,enabled:w("EU"),collecting:M.value&&S.value&&w("EU")});else for(const K of P.countries||[]){const G=b.value.has(K.country_code),ne=w(K.country_code);D.push({country_code:K.country_code,country_name:K.country_name,isEU:!1,group_code:P.group_code,hasConfig:G,enabled:ne,collecting:G&&ne})}const I=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],O=new Set(I);return D.sort((P,K)=>{if(P.hasConfig!==K.hasConfig)return P.hasConfig?-1:1;const G=O.has(P.country_code),ne=O.has(K.country_code);return G&&ne?I.indexOf(P.country_code)-I.indexOf(K.country_code):G?-1:ne?1:P.country_name.localeCompare(K.country_name)}),D}),F=j(()=>{const D=g.value.trim().toLowerCase();return $.value.filter(U=>y.value&&(!o.value||!U.collecting)?!1:D?U.country_name.toLowerCase().includes(D)||U.country_code.toLowerCase().includes(D):!0)}),L=j(()=>{if(!o.value)return!1;const D=$.value.filter(I=>I.enabled).length,U=$.value.filter(I=>!I.enabled).length;return D>0&&U>0}),Q=()=>{u.value=!0,Promise.all([re.get("tax/configuration/rates"),re.get("tax/rates"),re.get("tax/configuration/settings")]).then(([D,U,I])=>{var O;t.value=D.tax_rates,a.value=U.tax_rates,s.value=U.country_enabled_map||{},n.value=((O=I.settings)==null?void 0:O.eu_vat_settings)||{}}).catch(D=>{}).finally(()=>{u.value=!1})},T=(D,U)=>{const I=w(D.country_code),O=++m;f[D.country_code]=O,s.value={...s.value,[D.country_code]:U},A.value={...A.value,[D.country_code]:!0},re.post("tax/country-status/"+D.country_code,{enabled:U?1:0}).then(P=>{f[D.country_code]===O&&(q.success(P.message),s.value={...s.value,[D.country_code]:P.enabled})}).catch(P=>{var K;f[D.country_code]===O&&(s.value={...s.value,[D.country_code]:I},q.error(((K=P==null?void 0:P.data)==null?void 0:K.message)||c("Failed to update tax status")))}).finally(()=>{if(f[D.country_code]===O){const P={...A.value};delete P[D.country_code],A.value=P}})};return Be(()=>{Q()}),(D,U)=>{const I=C("el-checkbox"),O=C("el-input"),P=C("el-table-column"),K=C("el-switch"),G=C("el-table");return d(),_("div",Vie,[l(ha,{heading:p(c)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),r("div",Mie,[l(_a),r("div",Lie,[l(he,{class:"overflow-hidden"},{default:i(()=>[l(Ce,{title:p(c)("Tax Regions"),text:p(c)("Manage tax rates for different regions")},{action:i(()=>[r("div",Rie,[L.value?(d(),E(I,{key:0,modelValue:y.value,"onUpdate:modelValue":U[0]||(U[0]=ne=>y.value=ne)},{default:i(()=>[R(h(p(c)("Collecting Tax")),1)]),_:1},8,["modelValue"])):x("",!0),l(O,{modelValue:g.value,"onUpdate:modelValue":U[1]||(U[1]=ne=>g.value=ne),class:"w-[200px]",placeholder:p(c)("Search regions..."),size:"small",clearable:""},{prefix:i(()=>[l(W,{name:"Search",class:"w-4 h-4"})]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["title","text"]),l(me,{class:"px-0 pb-0"},{default:i(()=>[!u.value&&!o.value?(d(),_("div",Oie,[l(Na,{type:"warning",icon:"AlertTriangle",content:p(c)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):x("",!0),u.value?(d(),E(Tie,{key:1})):(d(),E(G,{key:2,data:F.value,"max-height":"500",class:"w-full compact-table fct-tax-rates-regions-table"},{default:i(()=>[l(P,{label:p(c)("Region"),"min-width":"300"},{default:i(({row:ne})=>[ne.isEU?(d(),E(na,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:i(()=>[r("div",Hie,[U[2]||(U[2]=r("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),R(" "+h(ne.country_name),1)])]),_:2},1024)):(d(),E(na,{key:1,to:{name:"tax-rates-country-single",params:{country:ne.country_code,group:ne.group_code}},class:"fct-tax-region-link hover:no-underline"},{default:i(()=>[r("div",Pie,[r("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${B(ne.country_code)}.png`,alt:ne.country_code},null,8,Nie),R(" "+h(ne.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),l(P,{label:p(c)("Collecting"),width:"200"},{default:i(({row:ne})=>[o.value?ne.collecting?(d(),_("span",Gie,h(p(c)("Collecting tax")),1)):ne.hasConfig&&!ne.enabled?(d(),_("span",jie,h(p(c)("Disabled")),1)):(d(),_("span",zie,"—")):(d(),_("span",Kie,"—"))]),_:1},8,["label"]),l(P,{label:p(c)("Enabled"),width:"140",align:"center"},{default:i(({row:ne})=>[ne.hasConfig?(d(),E(K,{key:0,"model-value":o.value?ne.enabled:!1,loading:!!A.value[ne.country_code],disabled:!o.value,onChange:Y=>T(ne,Y)},null,8,["model-value","loading","disabled","onChange"])):(d(),_("span",Yie,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},Wie={class:"fct-base-taxes"},Xie={class:"fct-tax-class-tabs"},Jie={class:"fct-tax-class-tabs__list"},Zie={class:"fct-base-taxes__header"},ede={class:"fct-base-taxes__header-label"},tde={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},ade={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},nde={class:"fct-base-taxes__state-fields"},sde={class:"fct-base-taxes__region-name"},lde={class:"fct-base-taxes__state-fields"},ode={__name:"CountryTaxRatesLoader",setup(e){const t=[1,2,3];return(a,n)=>{const s=C("el-skeleton-item"),o=C("el-skeleton");return d(),_("div",null,[r("div",Wie,[r("div",Xie,[r("div",Jie,[(d(),_(H,null,ee(3,u=>r("div",{key:u,class:"fct-tax-class-tabs__tab"},[l(o,{animated:""},{template:i(()=>[l(s,{variant:"text",class:"w-16 h-5"})]),_:1})])),64)),l(o,{animated:""},{template:i(()=>[l(s,{variant:"text",class:"w-5 h-5"})]),_:1})])]),r("div",Zie,[r("span",ede,h(p(c)("Regions")),1)]),r("div",tde,[r("div",ade,[l(o,{animated:""},{template:i(()=>[l(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),r("div",nde,[l(o,{animated:""},{template:i(()=>[l(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),l(o,{animated:""},{template:i(()=>[l(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),n[0]||(n[0]=r("div",{class:"fct-base-taxes__field-compound"},null,-1))])]),n[1]||(n[1]=r("div",{class:"fct-base-taxes__divider"},null,-1)),(d(),_(H,null,ee(t,u=>r("div",{key:u,class:"fct-base-taxes__state-row"},[r("div",sde,[l(o,{animated:""},{template:i(()=>[l(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),r("div",lde,[l(o,{animated:""},{template:i(()=>[l(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),l(o,{animated:""},{template:i(()=>[l(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),l(o,{animated:""},{template:i(()=>[l(s,{variant:"rect",class:"fct-base-taxes__field-compound h-8"})]),_:1})])])),64))])])}}},rde={class:"fct-tax-class-tabs"},ide={class:"fct-tax-class-tabs__list"},dde=["onClick"],ude=["title","onClick"],cde=["disabled"],Ade={class:"fct-tax-class-tabs__search"},ym={__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","update:search"],setup(e,{emit:t}){const a=e,n=t,s=j(()=>[...a.classes].sort((o,u)=>o.slug==="standard"&&u.slug!=="standard"?-1:o.slug!=="standard"&&u.slug==="standard"?1:0));return(o,u)=>{const A=C("el-dropdown-item"),f=C("el-dropdown-menu"),m=C("el-dropdown"),g=C("el-input");return d(),_("div",rde,[r("div",ide,[(d(!0),_(H,null,ee(s.value,y=>(d(),_("button",{key:y.id,class:de(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==y.id}]),onClick:v=>n("switch",y)},[R(h(y.title)+" ",1),y.slug!=="standard"?(d(),_("span",{key:0,class:"fct-tax-class-tabs__delete",title:p(c)("Delete tax class"),onClick:Xe(v=>n("delete",y),["stop"])},[l(W,{name:"Close"})],8,ude)):x("",!0)],10,dde))),128)),e.classes.length<e.maxClasses?(d(),E(m,{key:0,trigger:"click",disabled:e.creating,onCommand:u[0]||(u[0]=y=>n("add",y)),"popper-class":"fct-dropdown"},{dropdown:i(()=>[l(f,null,{default:i(()=>[e.classes.find(y=>y.slug==="reduced")?x("",!0):(d(),E(A,{key:0,command:"reduced"},{default:i(()=>[R(h(p(c)("Reduced")),1)]),_:1})),e.classes.find(y=>y.slug==="zero")?x("",!0):(d(),E(A,{key:1,command:"zero"},{default:i(()=>[R(h(p(c)("Zero")),1)]),_:1})),l(A,{command:"custom"},{default:i(()=>[R(h(p(c)("Custom Class...")),1)]),_:1})]),_:1})]),default:i(()=>[r("button",{class:"fct-tax-class-tabs__add",disabled:e.creating},[l(W,{name:"Plus"})],8,cde)]),_:1},8,["disabled"])):x("",!0)]),r("div",Ade,[l(g,{"model-value":e.search,placeholder:p(c)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":u[1]||(u[1]=y=>n("update:search",y)),onClear:u[2]||(u[2]=y=>n("update:search",""))},{prefix:i(()=>[l(W,{name:"Search",class:"w-3.5 h-3.5 text-system-light dark:text-gray-400"})]),_:1},8,["model-value","placeholder"]),oa(o.$slots,"search-actions")])])}}},pde=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,Du=({classes:e=[],activeId:t=null})=>(t?e.find(n=>n.id===t):null)||pde(e),fde=({classes:e=[],previousIds:t=new Set,createdSlug:a=null})=>{if(a){const n=e.find(s=>s.slug===a);if(n)return n}return e.find(n=>!t.has(n.id))||null},Ur=async({payload:e,createdSlug:t=null,currentClasses:a=[],reloadClasses:n})=>{const s=new Set((a||[]).map(A=>A.id)),o=await re.post("tax/classes",e),u=await n();return{response:o,classes:u,createdClass:fde({classes:u,previousIds:s,createdSlug:t})}},bm=async({classId:e,currentActiveId:t=null,reloadClasses:a})=>{const n=await re.delete("tax/classes/"+e),s=await a();return{response:n,classes:s,nextActiveClass:Du({classes:s,activeId:t})}};function yl(e){return e==null||e===""?"":String(e)}const mde={class:"setting-wrap"},hde={class:"setting-wrap-inner"},_de={class:"fct-single-tax-rates-country-single-page"},gde={class:"fct-single-tax-rates-country-single"},vde={class:"single-page-header flex items-center justify-between"},yde={key:0,class:"flex items-center gap-2"},bde={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},wde={class:"mt-3 flex justify-end"},Cde={key:1,class:"fct-base-taxes"},Bde={class:"fct-btn-group mt-4 justify-end sm"},kde={class:"fct-tax-rates-country-view"},xde={key:0},Sde={key:1},Fde={key:0},Ede={key:1},Ude={class:"fct-btn-group sm justify-end"},DA={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=V(!1),n=V([]),s=V(""),o=j(()=>!!Ie.get("is_tax_enabled")),u=V([]),A=V(null),f=V("standard"),m=V(!1),g=V(null),y=V(6),v=V(!1),B=V(""),b=V({id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0}),w=V({rate:0,name:""}),k=V([]),S=V({}),M=V(""),$=j(()=>{const z=M.value.trim().toLowerCase();return z?k.value.filter(J=>J.stateName&&J.stateName.toLowerCase().includes(z)):k.value}),F=j(()=>t.group==="EU"),L=j(()=>[b.value,...$.value]),Q=V([]),T=V(!1),D=V([]),U=V([]),I=V(!1),O=V(new Set),P=V(0),K=V([]),G=V(!1),ne=V(!1),Y=V(!1),N=V({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:""}),oe=j(()=>{const z=b.value.rate||0;return[{label:c("added to")+` ${z}% `+c("federal tax"),is_compound:"0",for_order:0},{label:c("instead of")+` ${z}% `+c("federal tax"),is_compound:"0",for_order:1},{label:c("compounded on top of")+` ${z}% `+c("federal tax"),is_compound:"1",for_order:0}]}),Z=z=>String(z.is_compound)==="1"?"1_0":z.for_order==1?"0_1":"0_0",le=(z,J)=>{const[fe,Ue]=J.split("_");z.is_compound=fe,z.for_order=parseInt(Ue)},te=z=>z&&z.replace(/\s*\(Standard\)\s*/gi,"").trim(),X=V(!1),ie=V({}),be=V(!1),se=V(""),ce=V(""),pe=V(""),De=V(!1),$e=V(!1),Je=V(!0),we=V(!1),Ye=V(!1),ft=V(!1),Ge=j(()=>c("Toggle tax collection for %1$s",s.value||t.country)),_e=()=>re.get("tax/classes").then(z=>{u.value=z.classes||[],y.value=z.max_classes||6,g.value=z.next_builtin||null;const J=Du({classes:u.value,activeId:A.value});return J&&(A.value=J.id,f.value=J.slug),u.value}).catch(z=>u.value),xe=(z="")=>{if(!z)return b.value.name||"Tax";const J=k.value.find(fe=>fe.state===z);return J!=null&&J.name?J.name:b.value.name||"Tax"},Me=z=>{b.value={...z.federalRate},w.value={...z.federalOriginal},k.value=z.stateRows.map(J=>({...J})),S.value={...z.stateOriginals}},Fe=()=>({federalRate:{...b.value},federalOriginal:{...w.value},stateRows:k.value.map(z=>({...z})),stateOriginals:{...S.value}}),nt=()=>{A.value&&(ie.value[A.value]=Fe())},st=async z=>{nt(),A.value=z.id,f.value=z.slug,ie.value[z.id]?(Me(ie.value[z.id]),await ue()):await ve()},Ot=z=>{if(z==="custom"){B.value="",v.value=!0;return}m.value=!0,Ur({payload:{slug:z},createdSlug:z,currentClasses:u.value,reloadClasses:_e}).then(({response:J,createdClass:fe})=>{if(q.success(J.message),fe)return st(fe)}).catch(J=>{var fe;q.error(((fe=J==null?void 0:J.data)==null?void 0:fe.message)||"Failed to create tax class")}).finally(()=>{m.value=!1})},Ct=()=>{if(!B.value.trim()){q.error(c("Please enter a class name"));return}m.value=!0,Ur({payload:{title:B.value.trim()},currentClasses:u.value,reloadClasses:_e}).then(({response:z,createdClass:J})=>{if(q.success(z.message),v.value=!1,J)return st(J)}).catch(z=>{var J;q.error(((J=z==null?void 0:z.data)==null?void 0:J.message)||"Failed to create tax class")}).finally(()=>{m.value=!1})},yt=z=>{const J=A.value===z.id;en(c("All rates for this class will be deleted. Products using it will default to Standard."),c("Delete")+" "+z.title+"?",{confirmButtonText:c("Yes, Delete"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{bm({classId:z.id,currentActiveId:A.value,reloadClasses:_e}).then(({response:fe,nextActiveClass:Ue})=>{if(delete ie.value[z.id],q.success(fe.message),Ue)return J&&(A.value=null),st(Ue)}).catch(fe=>{var Ue;q.error(((Ue=fe==null?void 0:fe.data)==null?void 0:Ue.message)||"Failed to delete tax class")})}).catch(()=>{})},Ze=()=>re.get("address-info/get-country-info",{country_code:t.country}).then(z=>{n.value=z.states||[],s.value=z.country_name||t.country}).catch(z=>{q.error(c("Failed to load country data. Please refresh the page."))}),Bt=()=>F.value?(ce.value="",pe.value="",Promise.resolve()):(De.value=!0,re.get("tax/country-tax-id/"+t.country).then(z=>{var fe;const J=((fe=z==null?void 0:z.tax_data)==null?void 0:fe.tax_id)||"";ce.value=J,pe.value=J}).catch(z=>{var J;q.error(((J=z==null?void 0:z.data)==null?void 0:J.message)||c("Failed to load tax ID"))}).finally(()=>{De.value=!1})),ht=({hydrateClassData:z=!0}={})=>re.get("tax/rates/country/rates/"+t.country).then(J=>{const fe=J.tax_rates||[],Ue=fe.filter(Le=>Le.for_shipping!==null),je=A.value?fe.filter(Le=>Number(Le.class_id)===Number(A.value)):fe;D.value=je.filter(Le=>!Le.city&&!Le.postcode).map(Le=>({name:Le.name,value:Le.id,state:Le.state||""}));const et=da(je);return ft.value=fe.length>0,z&&(Me(et),nt(),Je.value=!!J.tax_enabled,Ye.value=!0),{allRates:fe,shippingOverrides:Ue,classEntry:et}}).catch(J=>(q.error(c("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),Ft=()=>re.get("tax/product-overrides/"+t.country).then(z=>z.overrides||[]).catch(()=>[]),kt=()=>{K.value.length>0||(G.value=!0,re.get("products/fetch-term").then(z=>{const J=z.taxonomies&&z.taxonomies["product-categories"]?z.taxonomies["product-categories"].terms||[]:[];K.value=J.map(fe=>({...fe,value:yl(fe.value)}))}).catch(()=>{}).finally(()=>{G.value=!1}))};let xt=0;const Ht=z=>{const J=++xt;return!z||Number(z)===Number(A.value)?(U.value=D.value.slice(),I.value=!1,Promise.resolve()):(I.value=!0,U.value=[],re.get("tax/rates/country/rates/"+t.country,{class_id:z}).then(fe=>{if(J!==xt)return;const Ue=fe.tax_rates||[];U.value=Ue.filter(je=>!je.city&&!je.postcode).map(je=>({name:je.name,value:je.id,state:je.state||""}))}).catch(()=>{J===xt&&(U.value=[],q.error(c("Failed to load tax rates for the selected tax class")))}).finally(()=>{J===xt&&(I.value=!1)}))},pt=(z,J)=>{var Ue,je;const fe=[];for(const et of z){const Le=et.state?((Ue=n.value.find(tt=>tt.value===et.state))==null?void 0:Ue.name)||et.state:s.value||t.country,qe=xe(et.state||""),Et=u.value.find(tt=>Number(tt.id)===Number(et.class_id));fe.push({id:et.id,type:"shipping",label:qe,tax_label:qe,category_name:"",location:Le,city:et.city||"",postcode:et.postcode||"",rate:et.for_shipping,class_id:Number(et.class_id)||0,class_label:Et?Et.title:"",_raw:et})}for(const et of J){const Le=et.meta_value||et,qe=Le.state||"",Et=qe?((je=n.value.find(ua=>ua.value===qe))==null?void 0:je.name)||qe:s.value||t.country,tt=Number(et.class_id)||0,bt=tt?u.value.find(ua=>Number(ua.id)===tt):null;fe.push({id:et.id,type:"products",label:Le.category_name||"",tax_label:Le.tax_label||"",category_name:Le.category_name||"",location:Et,city:Le.city||"",postcode:Le.postcode||"",rate:Le.rate,class_id:tt,class_label:bt?bt.title:"",_raw:et})}Q.value=fe},da=z=>{const J=tt=>(!tt.state||tt.state==="")&&(!tt.city||tt.city==="")&&(!tt.postcode||tt.postcode===""),fe=z.find(J),Ue=z.filter(tt=>tt.state&&tt.state!==""&&(!tt.city||tt.city==="")&&(!tt.postcode||tt.postcode===""));let je,et;if(fe){const tt=te(fe.name)||"Tax";je={...fe,name:tt},et={rate:fe.rate,name:tt}}else je={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},et={rate:0,name:"Tax"};const Le={};for(const tt of Ue)Le[tt.state]=tt;const qe=[],Et={};for(const tt of n.value){const bt=Le[tt.value];if(bt){const ua=te(bt.name)||"State Tax";qe.push({id:bt.id,state:tt.value,stateName:tt.name,rate:bt.rate,name:ua,is_compound:String(bt.is_compound||"0"),for_order:bt.for_order||0}),Et[tt.value]={rate:bt.rate,name:ua,is_compound:String(bt.is_compound||"0"),for_order:bt.for_order||0}}else qe.push({id:null,state:tt.value,stateName:tt.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),Et[tt.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:je,federalOriginal:et,stateRows:qe,stateOriginals:Et}},ue=async()=>{const[{shippingOverrides:z},J]=await Promise.all([ht({hydrateClassData:!1}),Ft()]);pt(z,J)},ve=async()=>{a.value=!0;try{const[{shippingOverrides:z},J]=await Promise.all([ht(),Ft()]);pt(z,J)}finally{a.value=!1}},We=async()=>{a.value=!0;try{await Promise.all([_e(),Ze(),Bt()]),await ve()}finally{a.value=!1}},_t=()=>{F.value||$e.value||De.value||($e.value=!0,re.post("tax/country-tax-id/"+t.country,{tax_id:ce.value||""}).then(z=>{pe.value=ce.value||"",q.success(z.message||c("Tax ID has been saved successfully"))}).catch(z=>{var J;q.error(((J=z==null?void 0:z.data)==null?void 0:J.message)||c("Failed to save tax ID"))}).finally(()=>{$e.value=!1}))},rt=z=>{if(we.value)return;const J=Je.value;Je.value=z,we.value=!0,re.post("tax/country-status/"+t.country,{enabled:z?1:0}).then(fe=>{Je.value=fe.enabled,q.success(fe.message)}).catch(fe=>{var Ue;Je.value=J,q.error(((Ue=fe==null?void 0:fe.data)==null?void 0:Ue.message)||c("Failed to update tax status"))}).finally(()=>{we.value=!1})},Wt=async()=>{try{await en(c("This will overwrite your current rates with preset defaults. Continue?"),c("Reset to default tax rates"),{confirmButtonText:c("Reset"),cancelButtonText:c("Cancel"),type:"warning"})}catch{return}be.value=!0;try{const J=(await re.get("tax/configuration/rates")).tax_rates||{};let fe=[];for(const qe in J){const Et=J[qe];for(const tt of Et.countries||[])if(tt.country_code===t.country){fe=tt.rates||[];break}if(fe.length)break}if(!fe.length){q.error(c("No preset rates found for this country"));return}const Ue=fe.find(qe=>(!qe.state||qe.state==="")&&qe.type==="standard"),je=fe.filter(qe=>qe.state&&qe.state!==""&&qe.type==="standard"),et=[];Ue&&Ue.rate>0&&(b.value.rate=Ue.rate,b.value.name=te(Ue.name||"")||c("Tax"),et.push(lt()));const Le=[];for(const qe of je){const Et=k.value.find(tt=>tt.state===qe.state);Et&&(Et.rate=qe.rate,Et.name=te(qe.name)||c("State Tax"),Et.is_compound=qe.compound?"1":"0",Le.push(ga(Et)))}await Promise.all([...et,...Le]),nt(),await ue(),q.success(c("Tax rates have been reset to defaults"))}catch{q.error(c("Failed to reset tax rates"))}finally{be.value=!1}},lt=()=>{const z={country:t.country,state:"",rate:b.value.rate,name:b.value.name||"Tax",is_compound:b.value.is_compound||"0",for_order:b.value.for_order||0,group:t.group,class_id:A.value||""};return(b.value.id?re.put("tax/country/rate/"+b.value.id,z):re.post("tax/country/rate",z)).then(fe=>{fe.tax_rate&&(b.value.id=fe.tax_rate.id),w.value={rate:b.value.rate,name:b.value.name}})},ga=z=>{const J={country:t.country,state:z.state,rate:z.rate,name:z.name,is_compound:z.is_compound,for_order:z.for_order,group:t.group,class_id:A.value||""};return(z.id?re.put("tax/country/rate/"+z.id,J):re.post("tax/country/rate",J)).then(Ue=>{Ue.tax_rate&&(z.id=Ue.tax_rate.id),S.value[z.state]={rate:z.rate,name:z.name,is_compound:String(z.is_compound),for_order:z.for_order}})},va=async()=>{X.value=!0;try{const z=[];(String(b.value.rate)!==String(w.value.rate)||b.value.name!==w.value.name)&&z.push(lt());for(const fe of k.value){const Ue=S.value[fe.state];(!Ue||String(fe.rate)!==String(Ue.rate)||fe.name!==Ue.name||String(fe.is_compound)!==String(Ue.is_compound)||fe.for_order!=Ue.for_order)&&z.push(ga(fe))}await Promise.all(z),nt(),await ue(),q.success(c("Tax rates saved"))}catch{q.error(c("Failed to save rates"))}finally{X.value=!1}},Da=()=>{O.value=new Set,P.value=0},Sn=()=>{const z=xe();Y.value=!1,N.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:z,tax_rate:0,override_state_tax:!0,class_id:Number(A.value)||0,id:"",previous_id:""},se.value=z,U.value=D.value.slice(),T.value=!0,kt()},Tn=z=>{if(Y.value=!0,kt(),z.type==="shipping"){const J=z._raw.state||"",fe=xe(J),Ue=Number(z._raw.class_id)||Number(A.value)||0;N.value={type:"shipping",original_type:"shipping",original_id:z.id,category_id:"",category_name:"",state:J||"__country__",city:z._raw.city||"",postcode:z._raw.postcode||"",tax_label:fe,tax_rate:z.rate,override_state_tax:!0,class_id:Ue,id:z.id,previous_id:z.id},se.value=fe,P.value=Ue,Ht(Ue);const je=z._raw.city||"",et=z._raw.postcode||"",Le=new Set;for(const qe of Q.value)qe.type==="shipping"&&(qe._raw.state||"")===J&&(qe._raw.city||"")===je&&(qe._raw.postcode||"")===et&&Le.add(Number(qe.class_id));O.value=Le}else{const J=z._raw.meta_value||z._raw,fe=J.state||"",Ue=xe(fe),je=z.tax_label||Ue;N.value={type:"products",original_type:"products",original_id:z.id,category_id:yl(J.category_id),category_name:z.category_name,state:fe||"__country__",tax_label:je,tax_rate:z.rate,override_state_tax:J.override_state_tax==="yes",city:J.city||"",postcode:J.postcode||"",class_id:z.class_id||0,id:z.id,previous_id:""},se.value=Ue}T.value=!0},Fs=j(()=>{const z=[{label:s.value||t.country,value:"__country__"}];for(const J of n.value)z.push({label:J.name,value:J.value});return z}),El=j(()=>{if(!U.value.length)return Fs.value;const z=new Set(U.value.map(J=>J.state||""));return Fs.value.filter(J=>{const fe=J.value==="__country__"?"":J.value;return z.has(fe)})}),mn=z=>{const J=yl(z),fe=K.value.find(Ue=>Ue.value===J);fe&&(N.value.category_name=fe.label)},Ae=z=>{en(c("Are you sure you want to delete this override?"),c("Confirm Delete"),{confirmButtonText:c("Yes, Delete"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{const J=z.type==="shipping"?"tax/rates/country/override/"+z.id:"tax/product-overrides/"+z.id;re.delete(J).then(fe=>{q.success(fe.message),Q.value=Q.value.filter(Ue=>!(Ue.id===z.id&&Ue.type===z.type))}).catch(fe=>{var Ue;q.error(((Ue=fe==null?void 0:fe.data)==null?void 0:Ue.message)||c("Failed to delete override"))})}).catch(()=>{})},Ws=async()=>{var J;const z=N.value.state==="__country__"?"":N.value.state;if(N.value.type==="products"&&!N.value.category_id){q.error(c("Please select a category"));return}if(N.value.type==="shipping"){if(!N.value.class_id){q.error(c("Please select a tax class"));return}if(I.value){q.error(c("Please wait for the province rates to finish loading"));return}const fe=U.value.find(Ue=>(Ue.state||"")===z);N.value.id=fe?fe.value:0}ne.value=!0;try{let fe;if(N.value.type==="products"){const Ue=N.value.state==="__country__"?"":N.value.state;fe=await re.post("tax/product-overrides",{id:Y.value&&N.value.original_type==="products"?N.value.original_id:"",source_type:N.value.original_type,source_id:N.value.original_id,country:t.country,state:Ue,category_id:N.value.category_id,category_name:N.value.category_name,tax_label:N.value.tax_label,rate:N.value.tax_rate,override_state_tax:N.value.override_state_tax===!0?"yes":"no",city:N.value.city||"",postcode:N.value.postcode||"",class_id:N.value.class_id||0})}else fe=await re.post("tax/rates/country/override",{id:N.value.id,country:t.country,state:z,previous_id:Y.value&&N.value.original_type==="shipping"?N.value.previous_id:"",source_type:N.value.original_type,source_id:N.value.original_id,class_id:N.value.class_id||A.value||"",override_tax_rate:N.value.tax_rate,city:N.value.city||"",postcode:N.value.postcode||""});q.success(fe.message),T.value=!1,await ue()}catch(fe){const Ue=((J=fe==null?void 0:fe.data)==null?void 0:J.message)||(fe==null?void 0:fe.message)||"Failed to save override";q.error(Ue)}finally{ne.value=!1}};return ge(()=>N.value.type,z=>{z==="shipping"&&(N.value.class_id||(N.value.class_id=A.value||0),Ht(N.value.class_id))}),ge(()=>N.value.class_id,z=>{N.value.type!=="shipping"||!T.value||Ht(z).then(()=>{const J=N.value.state==="__country__"?"":N.value.state,fe=U.value.map(Ue=>Ue.state||"");J!==""&&!fe.includes(J)&&(N.value.state="__country__")})}),ge(()=>N.value.state,z=>{if(!T.value||N.value.type!=="products"||Y.value)return;const J=xe(z==="__country__"?"":z);(!N.value.tax_label||N.value.tax_label===se.value)&&(N.value.tax_label=J),se.value=J}),Be(()=>{We()}),(z,J)=>{const fe=C("el-breadcrumb-item"),Ue=C("el-breadcrumb"),je=C("el-switch"),et=C("el-skeleton"),Le=C("el-input"),qe=C("el-form-item"),Et=C("el-form"),tt=C("el-button"),bt=C("el-table-column"),ua=C("el-option"),Fn=C("el-select"),Es=C("el-table"),ae=C("el-tag"),it=C("el-radio"),Ba=C("el-radio-group"),nn=C("el-checkbox"),Ut=C("el-dialog");return d(),_("div",mde,[r("div",hde,[r("div",_de,[r("div",gde,[r("div",vde,[l(Ue,{class:"mb-0","separator-icon":p(tn)},{default:i(()=>[e.group==="EU"?(d(),E(fe,{key:0,to:{name:"eu"}},{default:i(()=>[R(h(p(c)("Tax Regions")),1)]),_:1})):(d(),E(fe,{key:1,to:{name:"tax_rates"}},{default:i(()=>[R(h(p(c)("Tax Regions")),1)]),_:1})),l(fe,null,{default:i(()=>[R(h(s.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),Ye.value&&ft.value?(d(),_("div",yde,[o.value?(d(),_("span",{key:0,class:de(["text-sm",Je.value?"text-success-500":"text-system-mid dark:text-gray-300"])},h(Je.value?p(c)("Collecting tax"):p(c)("Disabled")),3)):x("",!0),l(je,{"model-value":o.value?Je.value:!1,loading:we.value,disabled:!o.value,"aria-label":Ge.value,onChange:rt},null,8,["model-value","loading","disabled","aria-label"])])):x("",!0)]),!a.value&&!o.value?(d(),_("div",bde,[l(Na,{type:"warning",icon:"AlertTriangle",content:p(c)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):x("",!0),F.value?x("",!0):(d(),E(he,{key:1},{default:i(()=>[l(me,null,{default:i(()=>[De.value?(d(),E(et,{key:0,animated:"",rows:2})):(d(),E(Et,{key:1,"label-position":"top"},{default:i(()=>[l(qe,{label:p(c)("VAT/GST/Tax Number"),class:"mb-0"},{default:i(()=>[l(Le,{modelValue:ce.value,"onUpdate:modelValue":J[0]||(J[0]=Se=>ce.value=Se),placeholder:p(c)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),r("div",wde,[l(tt,{type:"primary",size:"small",loading:$e.value,disabled:De.value||$e.value||ce.value===pe.value,onClick:_t},{default:i(()=>[R(h(p(c)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Base taxes")},null,8,["title"]),l(me,null,{default:i(()=>[l(Na,{type:"info"},{content:i(()=>[r("span",null,h(p(c)("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"))+" + "+h(p(c)("button to add tax classes.")),1)]),_:1}),a.value?(d(),E(ode,{key:0})):(d(),_("div",Cde,[l(ym,{classes:u.value,"active-id":A.value,"max-classes":y.value,creating:m.value,search:M.value,onSwitch:st,onDelete:yt,onAdd:Ot,"onUpdate:search":J[1]||(J[1]=Se=>M.value=Se)},null,8,["classes","active-id","max-classes","creating","search"]),l(Es,{data:L.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:i(()=>[l(bt,{label:p(c)("Region")},{default:i(({row:Se})=>[r("span",{class:de(["fct-base-taxes__region-name",Se.state?"":"fct-base-taxes__region-name--federal"])},h(Se.state?Se.stateName:s.value||e.country),3)]),_:1},8,["label"]),l(bt,{label:p(c)("Rate"),width:"130"},{default:i(({row:Se})=>[l(Le,{modelValue:Se.rate,"onUpdate:modelValue":Vn=>Se.rate=Vn,size:"small",type:"number",step:"0.01",min:"0"},{suffix:i(()=>J[21]||(J[21]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),l(bt,{label:p(c)("Tax Label"),width:"200"},{default:i(({row:Se})=>[l(Le,{modelValue:Se.name,"onUpdate:modelValue":Vn=>Se.name=Vn,size:"small",placeholder:p(c)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),k.value.length>0?(d(),E(bt,{key:0,label:p(c)("Compound"),width:"310"},{default:i(({row:Se})=>[Se.state?(d(),E(Fn,{key:0,"model-value":Z(Se),size:"small",style:{width:"100%"},onChange:Vn=>le(Se,Vn)},{default:i(()=>[l(ua,{value:"0_0",label:oe.value[0].label},null,8,["label"]),l(ua,{value:"0_1",label:oe.value[1].label},null,8,["label"]),l(ua,{value:"1_0",label:oe.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]),r("div",Bde,[f.value==="standard"?(d(),E(tt,{key:0,loading:be.value,size:"small",onClick:Wt,type:"danger",soft:""},{default:i(()=>[R(h(p(c)("Reset to default")),1)]),_:1},8,["loading"])):x("",!0),l(tt,{type:"primary",size:"small",loading:X.value,onClick:va},{default:i(()=>[R(h(p(c)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Tax overrides"),text:p(c)("Override tax rates for specific product categories or shipping.")},{action:i(()=>[l(tt,{size:"small",onClick:Sn},{default:i(()=>[R(h(p(c)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),l(me,null,{default:i(()=>[r("div",kde,[l(Es,{data:Q.value,"empty-text":p(c)("No overrides configured")},{default:i(()=>[l(bt,{label:p(c)("Type"),width:"110"},{default:i(({row:Se})=>[l(ae,{type:Se.type==="products"?"primary":"info",size:"small"},{default:i(()=>[R(h(Se.type==="products"?p(c)("Product"):p(c)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),l(bt,{label:p(c)("Category")},{default:i(({row:Se})=>[R(h(Se.category_name||"—"),1)]),_:1},8,["label"]),l(bt,{label:p(c)("Tax Label")},{default:i(({row:Se})=>[R(h(Se.tax_label||"—"),1)]),_:1},8,["label"]),l(bt,{label:p(c)("Location")},{default:i(({row:Se})=>[R(h(Se.location),1)]),_:1},8,["label"]),l(bt,{label:p(c)("Tax Class"),width:"130"},{default:i(({row:Se})=>[Se.type==="products"?(d(),_("span",xde,h(Se.class_label||p(c)("All")),1)):(d(),_("span",Sde,h(Se.class_label||"—"),1))]),_:1},8,["label"]),l(bt,{label:p(c)("City / Postcode")},{default:i(({row:Se})=>[Se.city||Se.postcode?(d(),_("span",Fde,h([Se.city,Se.postcode].filter(Boolean).join(" / ")),1)):(d(),_("span",Ede,"—"))]),_:1},8,["label"]),l(bt,{label:p(c)("Rate"),width:"100"},{default:i(({row:Se})=>[R(h(Se.rate)+"% ",1)]),_:1},8,["label"]),l(bt,{label:p(c)("Actions"),width:"110",align:"right"},{default:i(({row:Se})=>[r("div",Ude,[l(Oe,{tag:"button",size:"small",onClick:Vn=>Tn(Se)},{default:i(()=>[l(W,{name:"Edit"})]),_:2},1032,["onClick"]),l(Oe,{tag:"button",size:"small",onClick:Vn=>Ae(Se),bg:"danger",outline:""},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),l(Ut,{modelValue:T.value,"onUpdate:modelValue":J[17]||(J[17]=Se=>T.value=Se),title:(Y.value?p(c)("Edit tax override for"):p(c)("Add tax override for"))+" "+(s.value||e.country),width:"520px","append-to-body":!0,onClose:Da},{footer:i(()=>[l(tt,{onClick:J[16]||(J[16]=Se=>T.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(tt,{type:"primary",loading:ne.value,onClick:Ws},{default:i(()=>[R(h(Y.value?p(c)("Save changes"):p(c)("Add override")),1)]),_:1},8,["loading"])]),default:i(()=>[l(Et,{"label-position":"top",model:N.value},{default:i(()=>[l(qe,{label:p(c)("Override type")},{default:i(()=>[l(Ba,{modelValue:N.value.type,"onUpdate:modelValue":J[2]||(J[2]=Se=>N.value.type=Se)},{default:i(()=>[l(it,{value:"products"},{default:i(()=>[R(h(p(c)("Products")),1)]),_:1}),l(it,{value:"shipping"},{default:i(()=>[R(h(p(c)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),N.value.type==="products"?(d(),_(H,{key:0},[l(qe,{label:p(c)("Category")},{default:i(()=>[l(Fn,{modelValue:N.value.category_id,"onUpdate:modelValue":J[3]||(J[3]=Se=>N.value.category_id=Se),filterable:"",placeholder:p(c)("Select a category"),loading:G.value,style:{width:"100%"},onChange:mn},{default:i(()=>[(d(!0),_(H,null,ee(K.value,Se=>(d(),E(ua,{key:Se.value,label:Se.label,value:Se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),l(qe,{label:p(c)("Tax Class")},{default:i(()=>[l(Fn,{modelValue:N.value.class_id,"onUpdate:modelValue":J[4]||(J[4]=Se=>N.value.class_id=Se),style:{width:"100%"}},{default:i(()=>[l(ua,{value:0,label:p(c)("All Tax Classes")},null,8,["label"]),(d(!0),_(H,null,ee(u.value,Se=>(d(),E(ua,{key:Se.id,value:Number(Se.id),label:Se.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),l(qe,{label:p(c)("Tax label")},{default:i(()=>[l(Le,{modelValue:N.value.tax_label,"onUpdate:modelValue":J[5]||(J[5]=Se=>N.value.tax_label=Se),placeholder:p(c)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(qe,{label:p(c)("Location")},{default:i(()=>[l(Fn,{modelValue:N.value.state,"onUpdate:modelValue":J[6]||(J[6]=Se=>N.value.state=Se),placeholder:p(c)("Select location"),filterable:"",style:{width:"100%"}},{default:i(()=>[(d(!0),_(H,null,ee(Fs.value,Se=>(d(),E(ua,{key:Se.value,label:Se.label,value:Se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(qe,{label:p(c)("City (optional)")},{default:i(()=>[l(Le,{modelValue:N.value.city,"onUpdate:modelValue":J[7]||(J[7]=Se=>N.value.city=Se),placeholder:p(c)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(qe,{label:p(c)("Postcode (optional)")},{default:i(()=>[l(Le,{modelValue:N.value.postcode,"onUpdate:modelValue":J[8]||(J[8]=Se=>N.value.postcode=Se),placeholder:p(c)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(qe,{label:p(c)("Tax rate (%)")},{default:i(()=>[l(Le,{modelValue:N.value.tax_rate,"onUpdate:modelValue":J[9]||(J[9]=Se=>N.value.tax_rate=Se),type:"number",step:"0.01",min:"0",placeholder:p(c)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),k.value.length>0?(d(),E(qe,{key:0},{default:i(()=>[l(nn,{modelValue:N.value.override_state_tax,"onUpdate:modelValue":J[10]||(J[10]=Se=>N.value.override_state_tax=Se)},{default:i(()=>[R(h(p(c)("Also override state/provincial taxes")),1)]),_:1},8,["modelValue"])]),_:1})):x("",!0)],64)):(d(),_(H,{key:1},[l(qe,{label:p(c)("Tax Class")},{default:i(()=>[l(Fn,{modelValue:N.value.class_id,"onUpdate:modelValue":J[11]||(J[11]=Se=>N.value.class_id=Se),style:{width:"100%"},loading:I.value},{default:i(()=>[(d(!0),_(H,null,ee(u.value,Se=>(d(),E(ua,{key:Se.id,value:Number(Se.id),label:Se.title,disabled:Y.value&&Number(Se.id)!==Number(P.value)&&O.value.has(Number(Se.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),l(qe,{label:p(c)("Location")},{default:i(()=>[l(Fn,{modelValue:N.value.state,"onUpdate:modelValue":J[12]||(J[12]=Se=>N.value.state=Se),placeholder:p(c)("Select location"),filterable:"",style:{width:"100%"}},{default:i(()=>[(d(!0),_(H,null,ee(El.value,Se=>(d(),E(ua,{key:Se.value,label:Se.label,value:Se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(qe,{label:p(c)("City (optional)")},{default:i(()=>[l(Le,{modelValue:N.value.city,"onUpdate:modelValue":J[13]||(J[13]=Se=>N.value.city=Se),placeholder:p(c)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(qe,{label:p(c)("Postcode (optional)")},{default:i(()=>[l(Le,{modelValue:N.value.postcode,"onUpdate:modelValue":J[14]||(J[14]=Se=>N.value.postcode=Se),placeholder:p(c)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(qe,{label:p(c)("Tax rate (%)")},{default:i(()=>[l(Le,{modelValue:N.value.tax_rate,"onUpdate:modelValue":J[15]||(J[15]=Se=>N.value.tax_rate=Se),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])]),l(Ut,{modelValue:v.value,"onUpdate:modelValue":J[20]||(J[20]=Se=>v.value=Se),title:p(c)("Create Custom Tax Class"),"append-to-body":!0},{footer:i(()=>[l(tt,{onClick:J[19]||(J[19]=Se=>v.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(tt,{type:"primary",loading:m.value,onClick:Ct},{default:i(()=>[R(h(p(c)("Create")),1)]),_:1},8,["loading"])]),default:i(()=>[l(Et,{onSubmit:Xe(Ct,["prevent"]),"label-position":"top"},{default:i(()=>[l(qe,{label:p(c)("Class Name")},{default:i(()=>[l(Le,{modelValue:B.value,"onUpdate:modelValue":J[18]||(J[18]=Se=>B.value=Se),placeholder:p(c)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])])])}}};class $de extends Gs{getTabs(){return{all:c("All"),filed:c("Filed"),not_filed:c("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:c("ID"),value:"id"},{label:c("Tax Country"),value:"country"}]}getSearchHint(){return c("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 Dde(e){return $de.init(e)}const Qde=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),Ide=e=>{const t=Object.keys(e[0]),n=[t.map(Qde).join(",")];return e.forEach(s=>{const o=t.map(u=>{let A=s[u];return typeof A=="object"&&(A=JSON.stringify(A)),typeof A=="string"&&(A=`"${A.replace(/"/g,'""')}"`),A});n.push(o.join(","))}),n.join(` |
| 289 |
`)},Tde=(e,t="export.csv")=>new Promise((a,n)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=Ide(e),o=new Blob([s],{type:"text/csv"}),u=document.createElement("a"),A=()=>{window.removeEventListener("focus",A),a()};window.addEventListener("focus",A),u.href=URL.createObjectURL(o),u.download=t,u.click(),URL.revokeObjectURL(u.href),setTimeout(()=>{a()},200)}catch(s){n(s)}}),Vde={class:"table-cell"},Mde={class:"table-cell"},Lde={class:"table-cell"},Rde={class:"table-cell"},Ode={class:"table-cell"},Hde={class:"table-cell"},Pde={class:"table-cell"},Nde={class:"table-cell"},Kde={class:"table-cell"},Gde={__name:"TaxesLoader",props:{nextPageCount:{type:Number,default:0},taxTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(n,s)=>s+1);return(n,s)=>{const o=C("el-table-column"),u=C("el-skeleton-item"),A=C("el-skeleton"),f=C("el-table");return d(),E(f,{data:p(a),class:"w-full compact-table full-compact"},{default:i(()=>[l(o,{type:"selection",width:45}),e.taxTable.isColumnVisible("id")?(d(),E(o,{key:0,width:100,label:p(c)("ID")},{default:i(()=>[r("div",Vde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.taxTable.isColumnVisible("order_id")?(d(),E(o,{key:1,label:p(c)("Order ID"),width:100},{default:i(()=>[r("div",Mde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),l(o,{label:p(c)("Tax Country"),width:120},{default:i(()=>[r("div",Lde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"]),l(o,{label:p(c)("Tax Region"),width:120},{default:i(()=>[r("div",Rde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("postcode")?(d(),E(o,{key:2,label:p(c)("Zip Code"),width:120},{default:i(()=>[r("div",Ode,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),l(o,{label:p(c)("Tax Name"),width:120},{default:i(()=>[r("div",Hde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("rate")?(d(),E(o,{key:3,label:p(c)("Tax Rate"),width:120},{default:i(()=>[r("div",Pde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),l(o,{label:p(c)("Sale Taxes"),width:120},{default:i(()=>[r("div",Nde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("filed_at")?(d(),E(o,{key:4,label:p(c)("Filed"),width:120},{default:i(()=>[r("div",Kde,[l(A,{animated:""},{template:i(()=>[l(u,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},jde={class:"table-cell"},zde={class:"table-cell"},Yde={class:"table-cell"},qde={class:"table-cell"},Wde={class:"table-cell"},Xde={class:"table-cell"},Jde={class:"table-cell"},Zde={class:"table-cell"},eue={class:"table-cell"},tue={__name:"AllCouponsLoader",props:{nextPageCount:{type:Number,default:0},couponTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(n,s)=>s+1);return(n,s)=>{const o=C("el-skeleton-item"),u=C("el-skeleton"),A=C("el-table-column"),f=C("el-table");return d(),E(f,{data:p(a),class:"w-full compact-table responsive full-compact"},{default:i(()=>[l(A,{width:100,label:p(c)("ID")},{default:i(()=>[r("div",jde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(d(),E(A,{key:0,label:p(c)("Title"),width:250},{default:i(()=>[r("div",zde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[180px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),l(A,{label:p(c)("Code"),width:200},{default:i(()=>[r("div",Yde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[130px]"})]),_:1})])]),_:1},8,["label"]),l(A,{label:p(c)("Amount"),width:120},{default:i(()=>[r("div",qde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),l(A,{label:p(c)("Usage"),width:150},{default:i(()=>[r("div",Wde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(d(),E(A,{key:1,label:p(c)("Stackable"),width:120},{default:i(()=>[r("div",Xde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[80px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),l(A,{label:p(c)("Status"),width:120},{default:i(()=>[r("div",Jde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),l(A,{label:p(c)("Expiry Date"),width:120},{default:i(()=>[r("div",Zde,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(d(),E(A,{key:2,label:p(c)("Actions"),width:100,align:"right"},{default:i(()=>[r("div",eue,[l(u,{animated:""},{template:i(()=>[l(o,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},aue={class:"fct-taxes-page fct-layout-width"},nue={key:1},sue={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},lue=["innerHTML"],oue={class:"fct-tax-filing-wrap"},rue={class:"fct-tax-filing-summary"},iue={class:"summary-item"},due={class:"summary-label"},uue={class:"summary-value"},cue={class:"summary-item"},Aue={class:"summary-label"},pue={class:"summary-value"},fue={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},mue={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},hue=["innerHTML"],_ue={class:"dialog-footer"},gue={class:"fct-tax-filing-success-wrap"},vue={class:"fct-tax-filling-success-icon"},yue={class:"dialog-footer"},bue={__name:"Taxes",setup(e){const t=Object.fromEntries(Ah.map(F=>[F.value,F.label])),a=F=>t[F]||F;Qt().ctx;const n=Dde(),s=V(!1),o=V(!1),u=V(!1),A=V([]),f=j(()=>n.getTableData().map(F=>{var L,Q,T,D,U,I,O,P,K,G,ne;return{id:F.id,order_id:F.order_id,country:a(((L=F.tax_rate)==null?void 0:L.country)??((Q=F.meta)==null?void 0:Q.tax_country)??""),state:((T=F.tax_rate)==null?void 0:T.formatted_state)??((D=F.tax_rate)==null?void 0:D.state)??"",postcode:((U=F.tax_rate)==null?void 0:U.postcode)??"",name:((I=F.tax_rate)==null?void 0:I.name)??((O=F.meta)==null?void 0:O.label)??"",reverse_charge:!!((P=F.meta)!=null&&P.reverse_charge_applied),rate:((K=F.tax_rate)==null?void 0:K.rate)??((G=F.meta)==null?void 0:G.rate_percent)??"",total_tax:String(parseFloat((F.total_tax/100).toFixed(2))),currency:((ne=F.order)==null?void 0:ne.currency)||"",total_tax:String(parseFloat((F.total_tax/100).toFixed(2))),filed_at:F.filed_at?"Yes":"No"}})),m=()=>{s.value=!0,o.value=!1},g=()=>{s.value=!1,o.value=!0},y=async()=>{try{await Tde(S.value),g()}catch{}},v=()=>{o.value=!1},B=()=>{const F=S.value.map(L=>L.id);re.post(n.getFetchUrl(),{ids:F}).then(L=>{q.success(L.message),n.fetch()}).catch(L=>{q.error(L)}).finally(()=>{v()})},b=F=>{A.value=F,u.value=F.length>0},w=F=>{S.value=F},k=V(null),S=V([]),M=j(()=>{const F=S.value.reduce((Q,T)=>Q+parseFloat(T.total_tax||0),0),L=[...new Set(S.value.map(Q=>Q.order_id))];return{totalTax:Te.formatNumber(Math.round(F*100),!1),totalOrders:L.length,items:S.value}}),$=()=>{ye(()=>{S.value=[...A.value],A.value.forEach(F=>{k.value.toggleRowSelection(F,!0)})})};return(F,L)=>{const Q=C("el-button"),T=C("el-tooltip"),D=C("el-table-column"),U=C("router-link"),I=C("el-tag"),O=C("el-table"),P=C("el-dialog");return d(),_("div",aue,[l(za,{title:p(c)("Taxes")},{action:i(()=>[u.value?(d(),E(Q,{key:1,type:"primary",onClick:m,disabled:!u.value},{default:i(()=>[R(h(p(c)("Tax Filing")),1)]),_:1},8,["disabled"])):(d(),E(T,{key:0,"popper-class":"fct-tooltip",effect:"dark",content:p(c)("Please select the taxes you want to file"),placement:"top-start"},{default:i(()=>[l(Q,{type:"primary",disabled:!u.value},{default:i(()=>[R(h(p(c)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),l(js,{table:p(n),"has-mobile-slot":!1},{default:i(()=>[p(n).isLoading()?(d(),E(Gde,{key:0,taxTable:p(n),"next-page-count":p(n).nextPageCount},null,8,["taxTable","next-page-count"])):(d(),_("div",nue,[l(O,{class:"w-full",data:f.value,onSelectionChange:b},{empty:i(()=>[l(at,{icon:"Empty/ListView","has-dark":!0,text:p(c)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:i(()=>[l(D,{type:"selection",width:45}),p(n).isColumnVisible("id")?(d(),E(D,{key:0,label:p(c)("ID"),width:100},{default:i(K=>[r("span",null,"#"+h(p(c)(K.row.id)),1)]),_:1},8,["label"])):x("",!0),p(n).isColumnVisible("order_id")?(d(),E(D,{key:1,label:p(c)("Order ID"),"min-width":100},{default:i(K=>[r("span",sue,[l(U,{class:"link",to:{name:"view_order",params:{order_id:K.row.order_id}}},{default:i(()=>[R(" #"+h(K.row.order_id),1)]),_:2},1032,["to"]),K.row.reverse_charge?(d(),E(I,{key:0,type:"warning",size:"small","disable-transitions":""},{default:i(()=>[R(h(p(c)("Reverse Charge")),1)]),_:1})):x("",!0)])]),_:1},8,["label"])):x("",!0),l(D,{label:p(c)("Tax Country"),width:120},{default:i(K=>[r("span",null,h(K.row.country),1)]),_:1},8,["label"]),l(D,{label:p(c)("Tax Region"),width:120},{default:i(K=>[r("span",null,h(K.row.state),1)]),_:1},8,["label"]),p(n).isColumnVisible("postcode")?(d(),E(D,{key:2,label:p(c)("Zip Code"),width:120},{default:i(K=>[r("span",null,h(K.row.postcode),1)]),_:1},8,["label"])):x("",!0),l(D,{label:p(c)("Tax Name"),width:120},{default:i(K=>[r("span",null,h(K.row.name),1)]),_:1},8,["label"]),p(n).isColumnVisible("rate")?(d(),E(D,{key:3,label:p(c)("Tax Rate"),width:120},{default:i(K=>[r("span",null,h(K.row.rate)+"%",1)]),_:1},8,["label"])):x("",!0),l(D,{label:p(c)("Sale Taxes"),width:120},{default:i(K=>[r("span",{innerHTML:p(Te).formatForOrder(K.row.total_tax_cents,K.row.currency)},null,8,lue)]),_:1},8,["label"]),p(n).isColumnVisible("filed_at")?(d(),E(D,{key:4,label:p(c)("Filed"),width:120},{default:i(K=>[r("span",null,h(K.row.filed_at),1)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),l(P,{modelValue:s.value,"onUpdate:modelValue":L[1]||(L[1]=K=>s.value=K),title:p(c)("Tax Filing"),onOpen:$,class:"fct-tax-filling-modal"},{footer:i(()=>[r("div",_ue,[l(Q,{onClick:L[0]||(L[0]=()=>{s.value=!1})},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(Q,{type:"primary",onClick:y},{default:i(()=>[l(W,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+h(p(c)("Download & Continue")),1)]),_:1})])]),default:i(()=>[r("div",oue,[r("div",rue,[r("div",iue,[r("span",due,h(p(c)("Taxable Amount")),1),r("span",uue,h(M.value.totalTax),1)]),r("div",cue,[r("span",Aue,h(p(c)("Total Orders")),1),r("span",pue,h(p(c)(M.value.totalOrders)),1)])]),r("div",fue,[l(O,{ref_key:"selectedTaxesTableRef",ref:k,data:A.value,onSelectionChange:w},{empty:i(()=>[l(at,{icon:"Empty/ListView",text:p(c)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:i(()=>[l(D,{type:"selection",width:45}),l(D,{label:p(c)("ID"),width:100},{default:i(K=>[r("span",null,h(K.row.id),1)]),_:1},8,["label"]),l(D,{label:p(c)("Order ID"),"min-width":100},{default:i(K=>[r("span",mue,[r("span",null,h(K.row.order_id),1),K.row.reverse_charge?(d(),E(I,{key:0,type:"warning",size:"small","disable-transitions":""},{default:i(()=>[R(h(p(c)("Reverse Charge")),1)]),_:1})):x("",!0)])]),_:1},8,["label"]),l(D,{width:120,label:p(c)("Tax Country")},{default:i(K=>[r("span",null,h(K.row.country),1)]),_:1},8,["label"]),l(D,{width:120,label:p(c)("Tax Region")},{default:i(K=>[r("span",null,h(K.row.state),1)]),_:1},8,["label"]),l(D,{label:p(c)("Zip Code"),width:120},{default:i(K=>[r("span",null,h(K.row.postcode),1)]),_:1},8,["label"]),l(D,{width:120,label:p(c)("Tax Name")},{default:i(K=>[r("span",null,h(K.row.name),1)]),_:1},8,["label"]),l(D,{label:p(c)("Tax Rate"),width:120},{default:i(K=>[r("span",null,h(K.row.rate)+"%",1)]),_:1},8,["label"]),l(D,{width:150,label:p(c)("Sale Taxes")},{default:i(K=>[r("span",{innerHTML:p(Te).formatForOrder(K.row.total_tax_cents,K.row.currency)},null,8,hue)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),l(P,{modelValue:o.value,"onUpdate:modelValue":L[2]||(L[2]=K=>o.value=K),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:i(()=>[r("div",yue,[l(Q,{onClick:v},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(Q,{type:"primary",onClick:B},{default:i(()=>[R(h(p(c)("Mark as Filed")),1)]),_:1})])]),default:i(()=>[r("div",gue,[r("div",vue,[l(W,{name:"CheckCircleFill"})]),r("div",null,[r("h4",null,h(p(c)("Don't Forget to Save Your Tax File")),1),r("p",null,h(p(c)("You're about to mark this tax report as filed.")),1),r("p",null,[R(h(p(c)("Make sure you've downloaded and saved the CSV file for your records before proceeding."))+" ",1),r("a",{onClick:Xe(y,["prevent"]),class:"cursor-pointer"},h(p(c)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},wue={class:"fct-card fct-card-border fct-vat-card"},Cue={class:"fct-card-body"},Bue={class:"fct-vat-card-header"},kue={class:"fct-vat-card-title"},xue={class:"fct-card fct-card-border fct-vat-card mt-5"},Sue={class:"fct-card-body"},Fue={class:"fct-vat-card-header"},Eue={class:"fct-vat-card-title"},Uue={class:"fct-tax-rates-country-view"},$ue={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Due={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},Que={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,n)=>(d(),_("div",null,[r("div",wue,[r("div",Cue,[r("div",Bue,[r("div",kue,[r("h3",null,h(p(c)("Collect VAT cross-border")),1)])]),n[0]||(n[0]=r("div",{class:"fct-vat-card-body"},[r("div",{class:"fct-sk w-[200px] h-3 rounded-xs"}),r("div",{class:"fct-sk w-full h-3 rounded-xs mt-3"})],-1))])]),r("div",xue,[r("div",Sue,[r("div",Fue,[r("div",Eue,[r("h3",null,h(p(c)("Tax overrides")),1)])]),r("div",Uue,[r("div",$ue,[r("div",Due,[(d(),_(H,null,ee(6,s=>r("div",{key:"header-"+s,class:"fct-sk h-3 rounded-xs"})),64))]),(d(),_(H,null,ee(t,s=>r("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"},n[1]||(n[1]=[ao('<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))])])])])]))}},Iue={class:"fct-modal-body"},Tue={class:"fct-radio-option-fields"},Vue={class:"form-note"},Mue={class:"fct-radio-option-fields"},Lue={class:"fct-radio-option-fields-desc"},Rue={class:"form-note"},Oue={key:0,class:"fct-info-box mt-3"},Hue={class:"text-xs text-system-mid"},Pue={class:"fct-radio-option-fields"},Nue={class:"fct-radio-option-fields-desc"},Kue={__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,n=t,s=V({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),o=V(!1);ge(()=>a.modelValue,m=>{if(m){const g=a.initialRegistrations.length?a.initialRegistrations[0]:null,y=g?g.country:"",v=g&&g.vat||"",B=a.currentForm||{};s.value={method:B.method||"oss",oss_country:B.oss_country||y,oss_vat:B.oss_vat||v,home_country:B.home_country||y,home_vat:B.home_vat||v}}else s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}});function u(m){const g=a.countries.find(y=>y.value===m);return g?parseFloat(g.default_rate||0):0}function A(){return a.initialRegistrations.some(m=>m.country===s.value.home_country)}function f(){if(!s.value.method){q.error(c("Select a cross-border registration type"));return}if(s.value.method==="oss"){if(!s.value.oss_country){q.error(c("Select your country of OSS registration"));return}}else if(s.value.method==="home"&&!s.value.home_country){q.error(c("Select your country of registration"));return}o.value=!0,(s.value.method==="home"&&!A()?re.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.home_country,vat:s.value.home_vat,rate:u(s.value.home_country)}):Promise.resolve()).then(()=>re.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:s.value})).then(g=>{q.success(g.message),n("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}),n("update:modelValue",!1)}).catch(g=>{var y;q.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{o.value=!1})}return(m,g)=>{const y=C("el-radio"),v=C("el-option"),B=C("el-select"),b=C("el-form-item"),w=C("el-input"),k=C("el-radio-group"),S=C("el-form"),M=C("el-button"),$=C("el-dialog");return d(),E($,{"model-value":e.modelValue,title:p(c)("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]=F=>n("update:modelValue",F))},{footer:i(()=>[l(M,{onClick:g[8]||(g[8]=F=>n("update:modelValue",!1))},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(M,{type:"primary",onClick:f,loading:o.value},{default:i(()=>[R(h(p(c)("Collect VAT")),1)]),_:1},8,["loading"])]),default:i(()=>[r("div",Iue,[l(S,{"label-position":"top"},{default:i(()=>[l(k,{modelValue:s.value.method,"onUpdate:modelValue":g[7]||(g[7]=F=>s.value.method=F),class:"fct-cross-border-radios"},{default:i(()=>[r("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="oss"}]),onClick:g[2]||(g[2]=F=>s.value.method="oss")},[l(y,{value:"oss"},{default:i(()=>[R(h(p(c)("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),l(ra,{accordion:"",visible:s.value.method==="oss"},{default:i(()=>[r("div",Tue,[l(b,{label:p(c)("Country of OSS registration")},{default:i(()=>[l(B,{modelValue:s.value.oss_country,"onUpdate:modelValue":g[0]||(g[0]=F=>s.value.oss_country=F),placeholder:p(c)("Select country"),filterable:"",class:"w-full"},{default:i(()=>[(d(!0),_(H,null,ee(e.countries,F=>(d(),E(v,{key:F.value,label:F.label,value:F.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(b,{label:p(c)("VAT number")},{default:i(()=>[l(w,{modelValue:s.value.oss_vat,"onUpdate:modelValue":g[1]||(g[1]=F=>s.value.oss_vat=F),placeholder:p(c)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),r("div",Vue,[r("p",null,h(p(c)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),r("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="home"}]),onClick:g[5]||(g[5]=F=>s.value.method="home")},[l(y,{value:"home"},{default:i(()=>[R(h(p(c)("Collect using your home country registration")),1)]),_:1}),l(ra,{accordion:"",visible:s.value.method==="home"},{default:i(()=>[r("div",Mue,[r("p",Lue,h(p(c)("Applies to micro-businesses located in one EU country and making less than €10,000 in sales to other EU countries each year")),1),l(b,{label:p(c)("Country of registration")},{default:i(()=>[l(B,{modelValue:s.value.home_country,"onUpdate:modelValue":g[3]||(g[3]=F=>s.value.home_country=F),placeholder:p(c)("Select country"),filterable:"",class:"w-full"},{default:i(()=>[(d(!0),_(H,null,ee(e.countries,F=>(d(),E(v,{key:F.value,label:F.label,value:F.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(b,{label:p(c)("VAT number")},{default:i(()=>[l(w,{modelValue:s.value.home_vat,"onUpdate:modelValue":g[4]||(g[4]=F=>s.value.home_vat=F),placeholder:p(c)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),r("div",Rue,[r("p",null,h(p(c)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?x("",!0):(d(),_("div",Oue,[l(W,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),r("span",Hue,h(p(c)("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),r("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="specific"}]),onClick:g[6]||(g[6]=F=>s.value.method="specific")},[l(y,{value:"specific"},{default:i(()=>[R(h(p(c)("Collect using specific country registrations")),1)]),_:1}),l(ra,{accordion:"",visible:s.value.method==="specific"},{default:i(()=>[r("div",Pue,[r("p",Nue,h(p(c)("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"])}}},Gue={key:0,class:"fct-country-registrations-list mt-4"},jue={class:"fct-home-country-header"},zue=["src","alt"],Yue={class:"fct-vat-country-name"},que={key:0,class:"fct-collecting-badge"},Wue={class:"fct-home-country-body"},Xue={class:"fct-vat-home-field"},Jue={class:"fct-vat-home-field__label"},Zue={class:"fct-reg-rates-section"},ece={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},tce={class:"fct-reg-rates-row fct-reg-rates-header"},ace={class:"fct-reg-rates-cell-label"},nce={class:"fct-reg-rates-cell-label"},sce={key:1,class:"fct-reg-class-name"},lce={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},oce={class:"fct-reg-rates-cell-input"},rce={class:"fct-reg-rates-cell-action"},ice=["title","onClick"],dce={key:0,class:"fct-reg-add-class px-5"},uce={type:"button",class:"fct-reg-add-class-btn"},cce={class:"fct-vat-home-actions"},Ace={__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,n=t,s=V({country:"",vat:"",rates:{}}),o=V([]),u=V(!1),A=V(""),f=j(()=>a.homeCountry&&a.countries.find(Q=>Q.value===a.homeCountry)||null),m=j(()=>a.homeCountry&&a.registrations.find(Q=>Q.country===a.homeCountry)||null),g=j(()=>{const Q=m.value;return!Q||!Q.vat?!1:Q.rates&&typeof Q.rates=="object"&&Object.keys(Q.rates).length?Object.values(Q.rates).some(function(T){return T&&parseFloat(T.rate)>0}):parseFloat(Q.rate)>0}),y=j(()=>[...a.taxClasses,...o.value]),v=j(()=>y.value.length?y.value:[{slug:"standard",title:c("Standard")}]),B=j(()=>{if(y.value.length>=6)return[];const Q=y.value.map(D=>D.slug).filter(Boolean),T=[];return Q.includes("reduced")||T.push({command:"reduced",label:c("Reduced")}),Q.includes("zero")||T.push({command:"zero",label:c("Zero")}),T.push({command:"custom",label:c("Custom Class...")}),T});ge([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const Q=m.value,T={};a.taxClasses.forEach(D=>{var P;const U=(P=Q==null?void 0:Q.rates)==null?void 0:P[D.slug],I=D.slug==="standard"?(Q==null?void 0:Q.rate)??"":"",O=D.slug==="standard"?(Q==null?void 0:Q.tax_label)??"":"";U&&typeof U=="object"?T[D.slug]={rate:U.rate??"",label:U.label??""}:T[D.slug]={rate:U??I,label:O}}),o.value.forEach(D=>{const U=b(D);T[U]=s.value.rates[U]||{rate:"",label:""}}),T.standard||(T.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(Q==null?void 0:Q.vat)||a.homeVat||"",rates:T}},{immediate:!0});function b(Q){return Q.tempKey||Q.slug}function w(Q){if(Q==="custom"){A.value="",u.value=!0;return}const T=Q==="reduced"?c("Reduced"):c("Zero");o.value.push({slug:Q,title:T,tempKey:Q}),s.value.rates[Q]={rate:"",label:""}}function k(){if(!A.value.trim())return;const Q=A.value.trim(),T="_new_"+o.value.length;o.value.push({slug:null,title:Q,tempKey:T,isNew:!1}),s.value.rates[T]={rate:"",label:""},u.value=!1,A.value=""}function S(){const Q="_new_"+o.value.length;o.value.push({slug:null,title:"",tempKey:Q,isNew:!0}),s.value.rates[Q]={rate:"",label:""}}function M(Q){return Q.slug?Q.title||Q.slug:Q.title&&Q.title.trim()?Q.title.trim():c("Custom")}function $(Q){const T=Q.slug?{slug:Q.slug}:{title:M(Q)};return re.post("tax/classes",T).then(D=>{const U=(D==null?void 0:D.class)||{},I=U.slug||Q.slug;if(!I)throw new Error(c("Tax class creation returned an invalid response"));return!Q.slug&&s.value.rates[Q.tempKey]!==void 0&&(s.value.rates[I]=s.value.rates[Q.tempKey],delete s.value.rates[Q.tempKey]),Q.slug=I,Q.title=U.title||Q.title,U}).catch(D=>{var I;const U=((I=D==null?void 0:D.data)==null?void 0:I.message)||c("Failed to create tax class");throw new Error(c("%1$s: %2$s",U,M(Q)))})}function F(Q){const T=b(Q);if(o.value.some(U=>b(U)===T)){o.value=o.value.filter(U=>b(U)!==T),delete s.value.rates[T];return}en(c('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),c("Delete Tax Class"),{confirmButtonText:c("Delete"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{re.delete("tax/classes/"+Q.id).then(()=>{n("class-changed")}).catch(U=>{var I;q.error(((I=U==null?void 0:U.data)==null?void 0:I.message)||c("Failed to delete tax class"))})}).catch(()=>{})}function L(){const Q=o.value.map($);Promise.all(Q).then(()=>{o.value=[],n("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(T=>{q.error((T==null?void 0:T.message)||c("Failed to create tax class"))})}return(Q,T)=>{const D=C("el-input"),U=C("el-dropdown-item"),I=C("el-dropdown-menu"),O=C("el-dropdown"),P=C("el-button"),K=C("el-form-item"),G=C("el-form"),ne=C("el-dialog");return f.value?(d(),_("div",Gue,[r("div",jue,[r("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:f.value.label,class:"fct-flag-icon"},null,8,zue),r("span",Yue,h(f.value.label),1),g.value?(d(),_("span",que,[T[4]||(T[4]=r("span",{class:"fct-green-dot"},null,-1)),R(" "+h(p(c)("Collecting")),1)])):x("",!0)]),r("div",Wue,[r("div",Xue,[r("label",Jue,h(p(c)("VAT number")),1),l(D,{modelValue:s.value.vat,"onUpdate:modelValue":T[0]||(T[0]=Y=>s.value.vat=Y),class:"fct-vat-number-input"},null,8,["modelValue"])]),r("div",Zue,[r("div",ece,[r("div",tce,[r("div",ace,h(p(c)("Tax Classes")),1),T[5]||(T[5]=r("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),T[6]||(T[6]=r("div",{class:"fct-reg-rates-cell-input"},null,-1)),T[7]||(T[7]=r("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(d(!0),_(H,null,ee(v.value,Y=>(d(),_("div",{key:b(Y),class:"fct-reg-rates-row"},[r("div",nce,[Y.isNew?(d(),E(D,{key:0,modelValue:Y.title,"onUpdate:modelValue":N=>Y.title=N,size:"small",placeholder:p(c)("Class name"),class:"fct-reg-class-name-input"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(d(),_("span",sce,h(Y.title),1))]),r("div",lce,[l(D,{modelValue:s.value.rates[b(Y)].rate,"onUpdate:modelValue":N=>s.value.rates[b(Y)].rate=N,type:"number",step:"0.01",min:"0",size:"small"},{suffix:i(()=>T[8]||(T[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),r("div",oce,[l(D,{modelValue:s.value.rates[b(Y)].label,"onUpdate:modelValue":N=>s.value.rates[b(Y)].label=N,size:"small",placeholder:p(c)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),r("div",rce,[Y.slug!=="standard"?(d(),_("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:p(c)("Delete class"),onClick:N=>F(Y)},[l(W,{name:"Delete"})],8,ice)):x("",!0)])]))),128))]),B.value.length?(d(),_("div",dce,[B.value.length===1&&B.value[0].command==="custom"?(d(),_("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:S},[l(W,{name:"Plus",class:"w-3 h-3"}),R(" "+h(p(c)("Add class")),1)])):(d(),E(O,{key:1,trigger:"click",onCommand:w,"popper-class":"fct-dropdown"},{dropdown:i(()=>[l(I,null,{default:i(()=>[(d(!0),_(H,null,ee(B.value,Y=>(d(),E(U,{key:Y.command,command:Y.command},{default:i(()=>[R(h(Y.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:i(()=>[r("button",uce,[l(W,{name:"Plus",class:"w-3 h-3"}),R(" "+h(p(c)("Add class")),1)])]),_:1}))])):x("",!0)]),r("div",cce,[l(P,{type:"primary",size:"small",onClick:L},{default:i(()=>[R(h(p(c)("Save VAT")),1)]),_:1})])]),l(ne,{modelValue:u.value,"onUpdate:modelValue":T[3]||(T[3]=Y=>u.value=Y),title:p(c)("Create Tax Class"),width:"400px","append-to-body":!0},{footer:i(()=>[l(P,{onClick:T[2]||(T[2]=Y=>u.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(P,{type:"primary",onClick:k},{default:i(()=>[R(h(p(c)("Create")),1)]),_:1})]),default:i(()=>[l(G,{onSubmit:Xe(k,["prevent"])},{default:i(()=>[l(K,{label:p(c)("Class Name")},{default:i(()=>[l(D,{modelValue:A.value,"onUpdate:modelValue":T[1]||(T[1]=Y=>A.value=Y),placeholder:p(c)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])):x("",!0)}}},pce={class:"fct-modal-body fct-country-reg-modal"},fce={class:"fct-country-reg-text"},mce={class:"form-note"},hce={class:"fct-reg-rates-table"},_ce={class:"fct-reg-rates-row fct-reg-rates-header"},gce={class:"fct-reg-rates-cell-label"},vce={class:"fct-reg-rates-cell-label"},yce={key:1,class:"fct-reg-class-name"},bce={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},wce={class:"fct-reg-rates-cell-input"},Cce={key:1,class:"fct-reg-rates-row"},Bce={class:"fct-reg-rates-cell-label"},kce={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},xce={class:"fct-reg-rates-cell-input"},Sce={key:0,class:"fct-reg-add-class"},Fce={type:"button",class:"fct-reg-add-class-btn"},Ece={__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,n=t,s=V({country:"",vat:"",rates:{},isEdit:!1}),o=V([]),u=V(!1),A=V(!1),f=V(""),m=j(()=>[...a.taxClasses,...o.value]),g=j(()=>{if(m.value.length>=6)return[];const F=m.value.map(Q=>Q.slug).filter(Boolean),L=[];return F.includes("reduced")||L.push({command:"reduced",label:c("Reduced")}),F.includes("zero")||L.push({command:"zero",label:c("Zero")}),L.push({command:"custom",label:c("Custom Class...")}),L}),y=j(()=>s.value.isEdit?a.countries:a.countries.filter(F=>!a.registeredCountries.includes(F.value)));ge(()=>a.modelValue,F=>{if(F){const L=a.initialForm||{},Q=L.rates?JSON.parse(JSON.stringify(L.rates)):{};a.taxClasses.forEach(T=>{Q[T.slug]||(Q[T.slug]={rate:"",label:""})}),Q.standard||(Q.standard={rate:"",label:""}),s.value={country:L.country||"",vat:L.vat||"",rates:Q,isEdit:L.isEdit||!1},o.value=[]}});function v(F){return F.tempKey||F.slug}function B(F){const L=a.countries.find(Q=>Q.value===F);if(L&&L.default_rate){const Q=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},Q,{rate:L.default_rate})})}}function b(F){if(F==="custom"){f.value="",A.value=!0;return}const L=F==="reduced"?c("Reduced"):c("Zero");o.value.push({slug:F,title:L,tempKey:F}),s.value.rates[F]={rate:"",label:""}}function w(){if(!f.value.trim())return;const F=f.value.trim(),L="_new_"+o.value.length;o.value.push({slug:null,title:F,tempKey:L,isNew:!1}),s.value.rates[L]={rate:"",label:""},A.value=!1,f.value=""}function k(){const F="_new_"+o.value.length;o.value.push({slug:null,title:"",tempKey:F,isNew:!0}),s.value.rates[F]={rate:"",label:""}}function S(F){return F.slug?F.title||F.slug:F.title&&F.title.trim()?F.title.trim():c("Custom")}function M(F){const L=F.slug?{slug:F.slug}:{title:S(F)};return re.post("tax/classes",L).then(Q=>{const T=(Q==null?void 0:Q.class)||{},D=T.slug||F.slug;if(!D)throw new Error(c("Tax class creation returned an invalid response"));return!F.slug&&s.value.rates[F.tempKey]!==void 0&&(s.value.rates[D]=s.value.rates[F.tempKey],delete s.value.rates[F.tempKey]),F.slug=D,F.title=T.title||F.title,T}).catch(Q=>{var D;const T=((D=Q==null?void 0:Q.data)==null?void 0:D.message)||c("Failed to create tax class");throw new Error(`${T}: ${S(F)}`)})}function $(){if(!s.value.country){q.error(c("Select a registration country"));return}const F=s.value.rates;if(!Object.values(F).some(T=>parseFloat(T.rate)>0)){q.error(c("At least one tax rate must be greater than 0%"));return}u.value=!0;const Q=o.value.map(M);Promise.all(Q).then(()=>re.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.country,vat:s.value.vat,rates:s.value.rates})).then(T=>{q.success(T.message),o.value=[],n("saved"),n("update:modelValue",!1)}).catch(T=>{var D;q.error((T==null?void 0:T.message)||((D=T==null?void 0:T.data)==null?void 0:D.message)||c("Failed to save VAT registration"))}).finally(()=>{u.value=!1})}return(F,L)=>{const Q=C("el-option"),T=C("el-select"),D=C("el-form-item"),U=C("el-input"),I=C("el-dropdown-item"),O=C("el-dropdown-menu"),P=C("el-dropdown"),K=C("el-form"),G=C("el-button"),ne=C("el-dialog");return d(),_(H,null,[l(ne,{"model-value":e.modelValue,title:s.value.isEdit?p(c)("Edit VAT registration"):p(c)("Collect VAT"),"close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":L[5]||(L[5]=Y=>n("update:modelValue",Y))},{footer:i(()=>[l(G,{onClick:L[4]||(L[4]=Y=>n("update:modelValue",!1))},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(G,{type:"primary",onClick:$,loading:u.value},{default:i(()=>[R(h(p(c)("Collect VAT")),1)]),_:1},8,["loading"])]),default:i(()=>[r("div",pce,[r("p",fce,h(p(c)("Make sure you're registered for VAT when collecting in the EU.")),1),l(K,{"label-position":"top"},{default:i(()=>[l(D,{label:p(c)("Registration country")},{default:i(()=>[l(T,{modelValue:s.value.country,"onUpdate:modelValue":L[0]||(L[0]=Y=>s.value.country=Y),placeholder:p(c)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:B},{default:i(()=>[(d(!0),_(H,null,ee(y.value,Y=>(d(),E(Q,{key:Y.value,label:Y.label,value:Y.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),l(D,{label:p(c)("VAT number")},{default:i(()=>[l(U,{modelValue:s.value.vat,"onUpdate:modelValue":L[1]||(L[1]=Y=>s.value.vat=Y),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),r("div",mce,[r("p",null,h(p(c)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),r("div",hce,[r("div",_ce,[r("div",gce,h(p(c)("Tax Classes")),1),L[9]||(L[9]=r("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),L[10]||(L[10]=r("div",{class:"fct-reg-rates-cell-input"},null,-1))]),m.value.length?(d(!0),_(H,{key:0},ee(m.value,Y=>(d(),_("div",{key:Y.tempKey||Y.slug,class:"fct-reg-rates-row"},[r("div",vce,[Y.isNew?(d(),E(U,{key:0,modelValue:Y.title,"onUpdate:modelValue":N=>Y.title=N,size:"small",placeholder:p(c)("Class name"),class:"fct-reg-class-name-input"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(d(),_("span",yce,h(Y.title),1))]),r("div",bce,[l(U,{modelValue:s.value.rates[v(Y)].rate,"onUpdate:modelValue":N=>s.value.rates[v(Y)].rate=N,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:Y.slug==="standard"?"19":"0"},{suffix:i(()=>L[11]||(L[11]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),r("div",wce,[l(U,{modelValue:s.value.rates[v(Y)].label,"onUpdate:modelValue":N=>s.value.rates[v(Y)].label=N,size:"small",placeholder:p(c)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(d(),_("div",Cce,[r("div",Bce,h(p(c)("Standard")),1),r("div",kce,[l(U,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":L[2]||(L[2]=Y=>s.value.rates.standard.rate=Y),modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:"19"},{suffix:i(()=>L[12]||(L[12]=[R("%",-1)])),_:1},8,["modelValue"])]),r("div",xce,[l(U,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":L[3]||(L[3]=Y=>s.value.rates.standard.label=Y),size:"small",placeholder:p(c)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),g.value.length?(d(),_("div",Sce,[g.value.length===1&&g.value[0].command==="custom"?(d(),_("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:k},[l(W,{name:"Plus"}),R(" "+h(p(c)("Add class")),1)])):(d(),E(P,{key:1,trigger:"click",onCommand:b},{dropdown:i(()=>[l(O,null,{default:i(()=>[(d(!0),_(H,null,ee(g.value,Y=>(d(),E(I,{key:Y.command,command:Y.command},{default:i(()=>[R(h(Y.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:i(()=>[r("button",Fce,[l(W,{name:"Plus"}),R(" "+h(p(c)("Add class")),1)])]),_:1}))])):x("",!0)]),_:1})])]),_:1},8,["model-value","title"]),l(ne,{modelValue:A.value,"onUpdate:modelValue":L[8]||(L[8]=Y=>A.value=Y),title:p(c)("Create Tax Class"),width:"400px","append-to-body":!0},{footer:i(()=>[l(G,{onClick:L[7]||(L[7]=Y=>A.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(G,{type:"primary",onClick:w},{default:i(()=>[R(h(p(c)("Create")),1)]),_:1})]),default:i(()=>[l(K,{onSubmit:Xe(w,["prevent"])},{default:i(()=>[l(D,{label:p(c)("Class Name")},{default:i(()=>[l(U,{modelValue:f.value,"onUpdate:modelValue":L[6]||(L[6]=Y=>f.value=Y),placeholder:p(c)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},Uce={class:"fct-oss-rates-section"},$ce=["aria-expanded"],Dce={class:"inline-flex items-center gap-2"},Qce={class:"fct-oss-rates-count"},Ice={class:"fct-oss-rates-table"},Tce={key:1,class:"text-system-mid"},Vce={class:"fct-btn-group mt-4 justify-end sm"},Mce={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=V([]),n=V([]),s=V(null),o=V("standard"),u=V(!1),A=V(!1),f=V(!1),m=V(!1),g=V(6),y=V(!1),v=V(!1),B=V(""),b=V(""),w=j(()=>a.value),k=j(()=>{const D=b.value.trim().toLowerCase();return D?w.value.filter(U=>U.label&&U.label.toLowerCase().includes(D)):w.value});function S(){return u.value=!0,re.get("tax/configuration/settings/eu-vat/oss-rates").then(D=>{a.value=D.rates||[],n.value=D.classes||[];const U=Du({classes:n.value,activeId:s.value});return U&&(s.value=U.id,o.value=U.slug),n.value}).catch(D=>{var U;q.error((U=D==null?void 0:D.data)==null?void 0:U.message)}).finally(()=>{u.value=!1})}function M(D){s.value=D.id,o.value=D.slug}function $(D){if(D==="custom"){B.value="",v.value=!0;return}y.value=!0,Ur({payload:{slug:D},createdSlug:D,currentClasses:n.value,reloadClasses:S}).then(({createdClass:U})=>{U&&M(U)}).catch(U=>{var I;q.error((I=U==null?void 0:U.data)==null?void 0:I.message)}).finally(()=>{y.value=!1})}function F(){if(!B.value.trim()){q.error(c("Please enter a class name"));return}y.value=!0,Ur({payload:{title:B.value.trim()},currentClasses:n.value,reloadClasses:S}).then(({createdClass:D})=>{v.value=!1,D&&M(D)}).catch(D=>{var U;q.error((U=D==null?void 0:D.data)==null?void 0:U.message)}).finally(()=>{y.value=!1})}function L(D){D.slug!=="standard"&&en(c('This will permanently delete the "%1$s" tax class and all its rates across every country (not just EU). Products using this class will fall back to Standard. Continue?',D.title),c("Delete Tax Class"),{confirmButtonText:c("Remove"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{u.value=!0,bm({classId:D.id,currentActiveId:s.value===D.id?null:s.value,reloadClasses:S}).then(({nextActiveClass:U})=>{U&&M(U)}).catch(U=>{var I;q.error((I=U==null?void 0:U.data)==null?void 0:I.message),u.value=!1})}).catch(()=>{})}function Q(){A.value=!0,re.post("tax/configuration/settings/eu-vat/oss-rates",{rates:w.value.map(D=>({country:D.country,rate:D.rate,tax_label:D.tax_label||"",class_rates:D.class_rates||{}}))}).then(D=>{q.success(D.message)}).catch(D=>{var U;q.error((U=D==null?void 0:D.data)==null?void 0:U.message)}).finally(()=>{A.value=!1})}function T(){en(c("This will overwrite all EU destination country standard rates with preset defaults. Continue?"),c("Reset to default tax rates"),{confirmButtonText:c("Reset"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{f.value=!0,re.post("tax/configuration/settings/eu-vat/reset-rates").then(()=>S()).then(()=>{q.success(c("EU tax rates have been reset to defaults"))}).catch(D=>{var U;q.error(((U=D==null?void 0:D.data)==null?void 0:U.message)||c("Failed to reset rates"))}).finally(()=>{f.value=!1})}).catch(()=>{})}return Be(S),t({loadRates:S}),(D,U)=>{const I=C("el-icon"),O=C("el-table-column"),P=C("el-input"),K=C("el-table"),G=C("el-button"),ne=C("el-form-item"),Y=C("el-form"),N=C("el-dialog"),oe=Ca("loading");return d(),_(H,null,[r("div",Uce,[r("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":m.value,onClick:U[0]||(U[0]=Z=>{m.value=!m.value,m.value||(b.value="")}),onKeydown:[U[1]||(U[1]=Pa(Xe(Z=>{m.value=!m.value,m.value||(b.value="")},["prevent"]),["enter"])),U[2]||(U[2]=Pa(Xe(Z=>{m.value=!m.value,m.value||(b.value="")},["prevent"]),["space"]))]},[r("span",Dce,[R(h(p(c)("Destination country rates"))+" ",1),r("span",Qce," ("+h(w.value.length)+") ",1)]),l(I,{class:de(["fct-oss-rates-arrow",{"is-expanded":m.value}])},{default:i(()=>[l(W,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,$ce),l(vs,{name:"fct-collapse"},{default:i(()=>[Dt(r("div",Ice,[l(Na,{type:"info"},{content:i(()=>[r("span",null,h(p(c)("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"))+" + "+h(p(c)("button to add tax classes.")),1)]),_:1}),l(ym,{classes:n.value,"active-id":s.value,"max-classes":g.value,creating:y.value,search:b.value,onSwitch:M,onDelete:L,onAdd:$,"onUpdate:search":U[3]||(U[3]=Z=>b.value=Z)},null,8,["classes","active-id","max-classes","creating","search"]),Dt((d(),E(K,{data:k.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":p(c)("No rates found")},{default:i(()=>[l(O,{label:p(c)("Country"),"min-width":"160"},{default:i(({row:Z})=>[R(h(Z.label),1)]),_:1},8,["label"]),l(O,{label:p(c)("Tax Label"),"min-width":"150"},{default:i(({row:Z})=>[Z.class_rates&&Z.class_rates[o.value]?(d(),E(P,{key:0,modelValue:Z.class_rates[o.value].label,"onUpdate:modelValue":le=>Z.class_rates[o.value].label=le,size:"small",placeholder:p(c)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),_:1},8,["label"]),l(O,{label:p(c)("Rate"),"min-width":"120"},{default:i(({row:Z})=>[Z.class_rates&&Z.class_rates[o.value]?(d(),E(P,{key:0,modelValue:Z.class_rates[o.value].rate,"onUpdate:modelValue":le=>Z.class_rates[o.value].rate=le,modelModifiers:{number:!0},size:"small",type:"number",min:0,max:100,step:"0.5"},{suffix:i(()=>U[7]||(U[7]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])):(d(),_("span",Tce,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[oe,u.value]]),r("div",Vce,[o.value==="standard"?(d(),E(G,{key:0,size:"small",loading:f.value,onClick:T,type:"danger",soft:""},{default:i(()=>[R(h(p(c)("Reset to default")),1)]),_:1},8,["loading"])):x("",!0),l(G,{type:"primary",size:"small",loading:A.value,onClick:Q},{default:i(()=>[R(h(p(c)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Rn,m.value]])]),_:1})]),l(N,{modelValue:v.value,"onUpdate:modelValue":U[6]||(U[6]=Z=>v.value=Z),title:p(c)("Create Custom Tax Class"),"append-to-body":!0},{footer:i(()=>[l(G,{onClick:U[5]||(U[5]=Z=>v.value=!1)},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(G,{type:"primary",loading:y.value,onClick:F},{default:i(()=>[R(h(p(c)("Create")),1)]),_:1},8,["loading"])]),default:i(()=>[l(Y,{onSubmit:Xe(F,["prevent"]),"label-position":"top"},{default:i(()=>[l(ne,{label:p(c)("Class Name")},{default:i(()=>[l(P,{modelValue:B.value,"onUpdate:modelValue":U[4]||(U[4]=Z=>B.value=Z),placeholder:p(c)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},Lce={class:"fct-vat-card-header"},Rce={class:"fct-vat-card-title"},Oce={class:"fct-vat-card-body"},Hce={class:"fct-vat-reg-info"},Pce={class:"fct-vat-country-name"},Nce={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},Kce={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},Gce={key:2,class:"fct-country-registrations-list mt-4"},jce={class:"fct-reg-rows"},zce={key:0,class:"fct-vat-registration-row"},Yce={class:"fct-vat-reg-info"},qce=["src","alt"],Wce={class:"fct-vat-country-name"},Xce={class:"fct-vat-reg-info"},Jce=["src","alt"],Zce={class:"fct-vat-country-name"},eAe={key:0,class:"fct-vat-number"},tAe={key:1,class:"fct-vat-missing-badge"},aAe={class:"fct-vat-reg-actions"},nAe={key:1,class:"fct-vat-empty-state"},sAe={class:"text-system-mid text-sm"},lAe={key:0,class:"px-5 py-3"},oAe={key:1,class:"fct-vat-cross-border-empty"},rAe={class:"fct-vat-cross-border-empty-text"},iAe={class:"fct-vat-cross-border-empty-title"},dAe={class:"fct-vat-cross-border-empty-desc"},uAe={__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,n=t,s=V({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),o=V(!1),u=V(null),A=V([]),f=V(!1),m=V({country:"",vat:"",rates:{},isEdit:!1}),g=j(()=>a.countries.length||28),y=j(()=>a.initialRegistrations.filter(M).length),v=j(()=>a.storeCountry&&a.countries.find(Y=>Y.value===a.storeCountry)||null),B=j(()=>a.storeCountry?a.initialRegistrations.some(Y=>Y.country===a.storeCountry):!1),b=j(()=>{if(s.value.method!=="home"||!s.value.home_country)return!1;const Y=a.initialRegistrations.find(N=>N.country===s.value.home_country);return!!Y&&M(Y)}),w=j(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function k(Y){if(!Y||!Array.isArray(a.countries))return Y;const N=a.countries.find(oe=>oe.value===Y);return N?N.label:Y}function S(Y){return Y?Y.rates&&typeof Y.rates=="object"&&Object.keys(Y.rates).length?Object.values(Y.rates).some(N=>N&&parseFloat(N.rate)>0):parseFloat(Y.rate)>0:!1}function M(Y){return!!Y&&!!Y.vat&&S(Y)}function $(Y){return S(Y)&&!Y.vat}function F(){return re.get("tax/classes").then(Y=>{A.value=Y.classes||[]}).catch(()=>{q.error(c("Failed to load tax classes"))})}function L(Y){const N={};return A.value.forEach(oe=>{N[oe.slug]={rate:oe.slug==="standard"&&Y||"",label:""}}),N}function Q(){const Y=v.value&&!B.value?a.storeCountry:"",N=Y&&v.value&&v.value.default_rate||"";m.value={country:Y,vat:"",rates:L(N),isEdit:!1},f.value=!0}function T(Y){const N=Y.rates||{},oe={};A.value.forEach(Z=>{const le=N[Z.slug];if(le&&typeof le=="object")oe[Z.slug]={rate:le.rate||"",label:le.label||""};else{const te=Z.slug==="standard"?Y.rate||"":le||"";oe[Z.slug]={rate:te,label:Z.slug==="standard"&&Y.tax_label||""}}}),m.value={country:Y.country,vat:Y.vat||"",rates:oe,isEdit:!0},f.value=!0}function D(){F(),n("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}function U(Y){re.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:Y.country,vat:Y.vat,rates:Y.rates}).then(N=>{q.success(N.message),n("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:Y.vat})}).catch(N=>{var oe;q.error(((oe=N==null?void 0:N.data)==null?void 0:oe.message)||c("Failed to save VAT registration"))})}function I(Y){en(c("Are you sure you want to remove this country registration?"),c("Confirm Remove"),{confirmButtonText:c("Yes, Remove"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{re.post("tax/configuration/settings/eu-vat",{action:"deleteCountryRegistration",country:Y}).then(N=>{q.success(N.message),n("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}).catch(N=>{var oe;q.error((oe=N==null?void 0:N.data)==null?void 0:oe.message)})}).catch(()=>{})}function O(){return y.value===1?c("Collecting in 1 country"):c("Collecting in %1$s countries",y.value)}const P=j(()=>g.value===1?c("Collecting in 1 region"):c("Collecting in %1$s regions",g.value));function K(Y){s.value={method:Y.method,oss_country:Y.oss_country,oss_vat:Y.oss_vat,home_country:Y.home_country,home_vat:Y.home_country_vat},Y.method==="oss"&&ye(()=>{var N;return(N=u.value)==null?void 0:N.loadRates()}),n("method-changed",{method:Y.method,home_country:Y.home_country,home_vat:Y.home_country_vat})}function G(Y){Y==="edit"?o.value=!0:Y==="stop"&&ne()}function ne(){en(c("Are you sure you want to stop collecting cross-border VAT? This will clear your OSS/home country registration."),c("Stop Collecting"),{confirmButtonText:c("Yes, Stop"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{re.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(Y=>{q.success(Y.message),s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},n("method-changed",{method:"",home_country:"",home_vat:""})}).catch(Y=>{var N;q.error((N=Y==null?void 0:Y.data)==null?void 0:N.message)})}).catch(()=>{})}return ge(()=>a.initialForm,Y=>{const N=Y||{};s.value={method:N.method||"",oss_country:N.oss_country||"",oss_vat:N.oss_vat||"",home_country:N.home_country||"",home_vat:N.home_vat||""}},{immediate:!0}),ge(()=>a.countries,Y=>{Y&&Y.length&&F()},{immediate:!0}),(Y,N)=>{const oe=C("el-tooltip"),Z=C("el-dropdown-item"),le=C("el-dropdown-menu"),te=C("el-dropdown"),X=C("el-button");return d(),_(H,null,[l(he,{class:"fct-vat-card"},{default:i(()=>[l(me,null,{default:i(()=>[r("div",Lce,[r("div",Rce,[r("h3",null,h(p(c)("Collect VAT cross-border")),1),l(oe,{content:p(c)("Choose how to collect VAT for sales to other EU countries."),placement:"top"},{default:i(()=>[l(W,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),w.value?(d(),E(te,{key:0,trigger:"click",onCommand:G,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:i(()=>[l(le,null,{default:i(()=>[l(Z,{command:"edit"},{default:i(()=>[R(h(p(c)("Edit registration")),1)]),_:1}),l(Z,{command:"stop"},{default:i(()=>[R(h(p(c)("Stop collecting")),1)]),_:1})]),_:1})]),default:i(()=>[l(Oe,{border:"none",size:"small",tag:"button"},{default:i(()=>[l(W,{name:"More"})]),_:1})]),_:1})):x("",!0)]),r("div",Oce,[w.value?(d(),_(H,{key:0},[r("div",Hce,[N[4]||(N[4]=r("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),r("span",Pce,h(s.value.method==="oss"?p(c)("EU (OSS)"):s.value.method==="home"?p(c)("EU (micro-business)"):p(c)("EU (specific countries)")),1),e.isTaxEnabled&&(s.value.method!=="specific"||y.value>0)?(d(),_("span",Nce,[N[3]||(N[3]=r("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(d(),_(H,{key:0},[R(h(O()),1)],64)):(d(),_(H,{key:1},[R(h(P.value),1)],64))])):x("",!0),e.isTaxEnabled?x("",!0):(d(),_("span",Kce,h(p(c)("Tax disabled")),1))]),s.value.method==="home"?(d(),E(Na,{key:0,type:b.value?"info":"warning",icon:"Info",class:"mb-4 mt-4",content:b.value?p(c)("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.",k(s.value.home_country)):p(c)("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.",k(s.value.home_country))},null,8,["type","content"])):x("",!0),s.value.method==="home"?(d(),E(Ace,{key:1,countries:e.countries,"home-country":s.value.home_country,"home-vat":s.value.home_vat,"tax-classes":A.value,registrations:e.initialRegistrations,onSaveHome:U,onClassChanged:F},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):x("",!0),s.value.method==="specific"?(d(),_("div",Gce,[r("div",jce,[v.value&&!B.value?(d(),_("div",zce,[r("div",Yce,[r("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,qce),r("span",Wce,h(v.value.label),1)]),l(X,{size:"small",onClick:Q},{default:i(()=>[R(h(p(c)("Configure")),1)]),_:1})])):x("",!0),(d(!0),_(H,null,ee(e.initialRegistrations,ie=>(d(),_("div",{key:ie.country,class:"fct-vat-registration-row"},[r("div",Xce,[r("img",{src:`https://flagcdn.com/w40/${ie.country.toLowerCase()}.png`,alt:k(ie.country),class:"fct-flag-icon"},null,8,Jce),r("span",Zce,h(k(ie.country)),1),ie.vat?(d(),_("span",eAe,h(ie.vat),1)):$(ie)?(d(),_("span",tAe,h(p(c)("VAT ID missing")),1)):x("",!0)]),r("div",aAe,[S(ie)?(d(),E(Oe,{key:0,border:"none",size:"small",tag:"button",title:p(c)("Edit"),onClick:be=>T(ie)},{default:i(()=>[l(W,{name:"Edit"})]),_:2},1032,["title","onClick"])):(d(),E(X,{key:1,size:"small",onClick:be=>T(ie)},{default:i(()=>[R(h(p(c)("Configure")),1)]),_:2},1032,["onClick"])),l(Oe,{border:"none",size:"small",tag:"button",title:p(c)("Delete"),onClick:be=>I(ie.country)},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(d(),_("div",nAe,[r("p",sAe,h(p(c)("No country VAT registrations configured.")),1),l(X,{type:"primary",size:"small",onClick:Q},{default:i(()=>[R(h(p(c)("Configure")),1)]),_:1})])):x("",!0)]),e.initialRegistrations.length||v.value?(d(),_("div",lAe,[l(X,{type:"primary",link:"",onClick:Q},{default:i(()=>[R(" + "+h(p(c)("Collect in another country")),1)]),_:1})])):x("",!0)])):x("",!0),s.value.method==="oss"?(d(),E(Mce,{key:3,ref_key:"ossRatesRef",ref:u},null,512)):x("",!0)],64)):(d(),_("div",oAe,[N[5]||(N[5]=r("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),r("div",rAe,[r("p",iAe,h(p(c)("Not collecting cross-border VAT")),1),r("p",dAe,h(p(c)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),l(X,{size:"small",onClick:N[0]||(N[0]=ie=>o.value=!0),type:"primary"},{default:i(()=>[R(h(p(c)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),l(Kue,{modelValue:o.value,"onUpdate:modelValue":N[1]||(N[1]=ie=>o.value=ie),countries:e.countries,"current-form":s.value,"initial-registrations":e.initialRegistrations,onSaved:K},null,8,["modelValue","countries","current-form","initial-registrations"]),l(Ece,{modelValue:f.value,"onUpdate:modelValue":N[2]||(N[2]=ie=>f.value=ie),countries:e.countries,"tax-classes":A.value,"initial-form":m.value,"registered-countries":e.initialRegistrations.map(ie=>ie.country),onSaved:D},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},cAe={__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,n=t,s=V({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}),o=V([]),u=V(!1),A=V(!1);function f(){return a.taxClasses&&a.taxClasses.length>0&&Number(a.taxClasses[0].id)||0}function m(){s.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}}function g(w){if(w.type==="shipping")s.value={type:"shipping",original_type:"shipping",original_id:w.id,category_id:"",category_name:"",country:w._raw.country||"",city:w._raw.city||"",postcode:w._raw.postcode||"",tax_label:w.tax_label,tax_rate:w.rate,class_id:Number(w._raw.class_id)||f(),id:w.id};else{const k=w._raw.meta_value||w._raw;s.value={type:"products",original_type:"products",original_id:w.id,category_id:yl(k.category_id),category_name:w.category_name,country:k.country||"",city:k.city||"",postcode:k.postcode||"",tax_label:w.tax_label,tax_rate:w.rate,class_id:Number(w.class_id)||0,id:w.id}}}ge(()=>a.modelValue,w=>{w&&(a.editRow?g(a.editRow):m(),y())}),ge(()=>s.value.type,w=>{w==="shipping"&&!s.value.class_id&&(s.value.class_id=f())}),ge(()=>a.taxClasses,w=>{s.value.type==="shipping"&&!s.value.class_id&&w&&w.length>0&&(s.value.class_id=Number(w[0].id)||0)});function y(){o.value.length>0||(u.value=!0,re.get("products/fetch-term").then(w=>{const k=w.taxonomies&&w.taxonomies["product-categories"]?w.taxonomies["product-categories"].terms||[]:[];o.value=k.map(S=>({...S,value:yl(S.value)}))}).catch(()=>{q.error(c("Failed to load product categories"))}).finally(()=>{u.value=!1}))}function v(w,k){return re.get("tax/rates/country/rates/"+w,{class_id:k}).then(S=>{const $=(S&&S.tax_rates?S.tax_rates:[]).find(function(L){return!L.state&&!L.city&&!L.postcode});if($)return $;const F=a.countries.find(function(L){return L.value===w});return re.post("tax/country/rate",{country:w,state:"",rate:F&&F.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:k}).then(function(L){return L&&L.tax_rate?L.tax_rate:null})})}function B(w){const k=yl(w),S=o.value.find(M=>M.value===k);S&&(s.value.category_name=S.label)}function b(){if(s.value.type==="products"&&!s.value.category_id){q.error(c("Please select a category"));return}if(!s.value.country){q.error(c("Please select a location"));return}if(s.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){q.error(c("Tax classes are not available. Please reload the page and try again."));return}if(!s.value.class_id){q.error(c("Please select a tax class"));return}}if(A.value=!0,s.value.type==="products")re.post("tax/product-overrides",{id:s.value.original_type==="products"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,country:s.value.country,state:"",city:s.value.city||"",postcode:s.value.postcode||"",category_id:s.value.category_id,category_name:s.value.category_name,tax_label:s.value.tax_label,rate:s.value.tax_rate,override_state_tax:"no",class_id:s.value.class_id||0}).then(w=>{q.success(w.message),n("saved"),n("update:modelValue",!1)}).catch(w=>{q.error(w&&w.data?w.data.message:w&&w.message?w.message:"")}).finally(()=>{A.value=!1});else{const w=s.value.class_id;v(s.value.country,w).then(k=>k?re.post("tax/rates/country/override",{id:k.id,previous_id:s.value.original_type==="shipping"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,class_id:w,override_tax_rate:s.value.tax_rate,city:s.value.city||"",postcode:s.value.postcode||""}).then(S=>{q.success(S.message),n("saved"),n("update:modelValue",!1)}).catch(S=>{q.error(S&&S.data?S.data.message:S&&S.message?S.message:"")}).finally(()=>{A.value=!1}):(q.error(c("No tax rate found for the selected country and tax class")),A.value=!1,null)).catch(k=>{q.error(k&&k.data?k.data.message:k&&k.message?k.message:""),A.value=!1})}}return(w,k)=>{const S=C("el-radio"),M=C("el-radio-group"),$=C("el-form-item"),F=C("el-option"),L=C("el-select"),Q=C("el-input"),T=C("el-form"),D=C("el-button"),U=C("el-dialog");return d(),E(U,{"model-value":e.modelValue,title:e.editRow?p(c)("Edit tax override"):p(c)("Add tax override"),width:"520px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":k[14]||(k[14]=I=>n("update:modelValue",I))},{footer:i(()=>[l(D,{onClick:k[13]||(k[13]=I=>n("update:modelValue",!1))},{default:i(()=>[R(h(p(c)("Cancel")),1)]),_:1}),l(D,{type:"primary",loading:A.value,onClick:b},{default:i(()=>[R(h(e.editRow?p(c)("Save changes"):p(c)("Add override")),1)]),_:1},8,["loading"])]),default:i(()=>[l(T,{"label-position":"top",model:s.value},{default:i(()=>[l($,{label:p(c)("Override type")},{default:i(()=>[l(M,{modelValue:s.value.type,"onUpdate:modelValue":k[0]||(k[0]=I=>s.value.type=I)},{default:i(()=>[l(S,{value:"products"},{default:i(()=>[R(h(p(c)("Products")),1)]),_:1}),l(S,{value:"shipping"},{default:i(()=>[R(h(p(c)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.value.type==="products"?(d(),_(H,{key:0},[l($,{label:p(c)("Category")},{default:i(()=>[l(L,{modelValue:s.value.category_id,"onUpdate:modelValue":k[1]||(k[1]=I=>s.value.category_id=I),filterable:"",placeholder:p(c)("Select a category"),loading:u.value,style:{width:"100%"},onChange:B},{default:i(()=>[(d(!0),_(H,null,ee(o.value,I=>(d(),E(F,{key:I.value,label:I.label,value:I.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),e.taxClasses.length>0?(d(),E($,{key:0,label:p(c)("Tax Class")},{default:i(()=>[l(L,{modelValue:s.value.class_id,"onUpdate:modelValue":k[2]||(k[2]=I=>s.value.class_id=I),style:{width:"100%"}},{default:i(()=>[l(F,{value:0,label:p(c)("All Tax Classes")},null,8,["label"]),(d(!0),_(H,null,ee(e.taxClasses,I=>(d(),E(F,{key:I.id,value:Number(I.id),label:I.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):x("",!0),l($,{label:p(c)("Tax label")},{default:i(()=>[l(Q,{modelValue:s.value.tax_label,"onUpdate:modelValue":k[3]||(k[3]=I=>s.value.tax_label=I),placeholder:p(c)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l($,{label:p(c)("Location")},{default:i(()=>[l(L,{modelValue:s.value.country,"onUpdate:modelValue":k[4]||(k[4]=I=>s.value.country=I),placeholder:p(c)("Select country"),filterable:"",style:{width:"100%"}},{default:i(()=>[(d(!0),_(H,null,ee(e.countries,I=>(d(),E(F,{key:I.value,label:I.label,value:I.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l($,{label:p(c)("City (optional)")},{default:i(()=>[l(Q,{modelValue:s.value.city,"onUpdate:modelValue":k[5]||(k[5]=I=>s.value.city=I),placeholder:p(c)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l($,{label:p(c)("Postcode (optional)")},{default:i(()=>[l(Q,{modelValue:s.value.postcode,"onUpdate:modelValue":k[6]||(k[6]=I=>s.value.postcode=I),placeholder:p(c)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l($,{label:p(c)("Tax rate (%)")},{default:i(()=>[l(Q,{modelValue:s.value.tax_rate,"onUpdate:modelValue":k[7]||(k[7]=I=>s.value.tax_rate=I),type:"number",step:"0.01",min:"0",placeholder:p(c)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):(d(),_(H,{key:1},[l($,{label:p(c)("Location")},{default:i(()=>[l(L,{modelValue:s.value.country,"onUpdate:modelValue":k[8]||(k[8]=I=>s.value.country=I),placeholder:p(c)("Select country"),filterable:"",style:{width:"100%"}},{default:i(()=>[(d(!0),_(H,null,ee(e.countries,I=>(d(),E(F,{key:I.value,label:I.label,value:I.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),e.taxClasses.length>0?(d(),E($,{key:0,label:p(c)("Tax Class")},{default:i(()=>[l(L,{modelValue:s.value.class_id,"onUpdate:modelValue":k[9]||(k[9]=I=>s.value.class_id=I),style:{width:"100%"}},{default:i(()=>[(d(!0),_(H,null,ee(e.taxClasses,I=>(d(),E(F,{key:I.id,value:Number(I.id),label:I.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):x("",!0),l($,{label:p(c)("City (optional)")},{default:i(()=>[l(Q,{modelValue:s.value.city,"onUpdate:modelValue":k[10]||(k[10]=I=>s.value.city=I),placeholder:p(c)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l($,{label:p(c)("Postcode (optional)")},{default:i(()=>[l(Q,{modelValue:s.value.postcode,"onUpdate:modelValue":k[11]||(k[11]=I=>s.value.postcode=I),placeholder:p(c)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l($,{label:p(c)("Tax rate (%)")},{default:i(()=>[l(Q,{modelValue:s.value.tax_rate,"onUpdate:modelValue":k[12]||(k[12]=I=>s.value.tax_rate=I),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},AAe={class:"fct-tax-rates-country-view"},pAe={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},fAe={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"},mAe={key:0},hAe={key:1},_Ae={class:"fct-btn-group sm justify-end"},gAe={__name:"EUVatTaxOverridesCard",props:{countries:{type:Array,default:()=>[]}},setup(e){const t=e,a=V([]),n=V(!1),s=V(!1),o=V(null),u=V([]);function A(B){if(!B||!Array.isArray(t.countries))return B;const b=t.countries.find(w=>w.value===B);return b?b.label:B}function f(){re.get("tax/classes").then(B=>{u.value=B.classes||[]}).catch(()=>{q.error(c("Failed to load tax classes"))})}function m(){n.value=!0,re.get("tax/configuration/settings/eu-vat/product-overrides").then(B=>{const b=[],w=B.overrides||[];for(const S of w){const M=S.meta_value||S;b.push({id:S.id,type:"products",tax_label:M.tax_label||"",category_name:M.category_name||"",location:A(M.country),city:M.city||"",postcode:M.postcode||"",rate:M.rate,class_id:Number(S.class_id)||0,class_label:S.class_label||"",_raw:S})}const k=B.shipping_overrides||[];for(const S of k)b.push({id:S.id,type:"shipping",tax_label:S.name||"",category_name:"",location:A(S.country),city:S.city||"",postcode:S.postcode||"",rate:S.for_shipping,class_id:Number(S.class_id)||0,class_label:S.class_label||"",_raw:S});a.value=b}).catch(()=>{a.value=[]}).finally(()=>{n.value=!1})}function g(){o.value=null,s.value=!0}function y(B){o.value=B,s.value=!0}function v(B){en(c("Are you sure you want to delete this override?"),c("Confirm Delete"),{confirmButtonText:c("Yes, Delete"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{const b=B.type==="shipping"?"tax/rates/country/override/"+B.id:"tax/product-overrides/"+B.id;re.delete(b).then(w=>{q.success(w.message),a.value=a.value.filter(k=>!(k.id===B.id&&k.type===B.type))}).catch(w=>{var k;q.error((k=w==null?void 0:w.data)==null?void 0:k.message)})}).catch(()=>{})}return Be(()=>{f(),m()}),(B,b)=>{const w=C("el-button"),k=C("el-tag"),S=C("el-table-column"),M=C("el-table");return d(),_(H,null,[l(he,{class:"fct-vat-card"},{default:i(()=>[l(Ce,{title:p(c)("Tax overrides"),text:p(c)("Override tax rates for specific product categories or shipping.")},{action:i(()=>[l(w,{size:"small",onClick:g},{default:i(()=>[R(h(p(c)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),l(me,null,{default:i(()=>[r("div",AAe,[n.value?(d(),_("div",pAe,[r("div",fAe,[(d(),_(H,null,ee(6,$=>r("div",{key:"loading-header-"+$,class:"fct-sk h-3 rounded-xs"})),64))]),(d(),_(H,null,ee(3,$=>r("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"},b[2]||(b[2]=[r("div",{class:"fct-sk w-16 h-6 rounded-full"},null,-1),r("div",{class:"fct-sk w-28 h-3.5 rounded-xs"},null,-1),r("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),r("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),r("div",{class:"fct-sk w-12 h-3.5 rounded-xs"},null,-1),r("div",{class:"fct-sk w-4 h-4 rounded-xs justify-self-end"},null,-1)]))),64))])):(d(),E(M,{key:1,data:a.value,"empty-text":p(c)("No overrides configured")},{default:i(()=>[l(S,{label:p(c)("Type"),width:"110"},{default:i(({row:$})=>[l(k,{type:$.type==="products"?"primary":"info",size:"small"},{default:i(()=>[R(h($.type==="products"?p(c)("Product"):p(c)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),l(S,{label:p(c)("Category")},{default:i(({row:$})=>[R(h($.category_name||"—"),1)]),_:1},8,["label"]),l(S,{label:p(c)("Tax Class"),width:"130"},{default:i(({row:$})=>[R(h($.class_label||p(c)("All")),1)]),_:1},8,["label"]),l(S,{label:p(c)("Tax Label")},{default:i(({row:$})=>[R(h($.tax_label||"—"),1)]),_:1},8,["label"]),l(S,{label:p(c)("Location")},{default:i(({row:$})=>[R(h($.location),1)]),_:1},8,["label"]),l(S,{label:p(c)("City / Postcode")},{default:i(({row:$})=>[$.city||$.postcode?(d(),_("span",mAe,h([$.city,$.postcode].filter(Boolean).join(" / ")),1)):(d(),_("span",hAe,"—"))]),_:1},8,["label"]),l(S,{label:p(c)("Rate"),width:"100"},{default:i(({row:$})=>[R(h($.rate)+"% ",1)]),_:1},8,["label"]),l(S,{label:p(c)("Actions"),width:"110",align:"right"},{default:i(({row:$})=>[r("div",_Ae,[l(Oe,{tag:"button",size:"small",onClick:F=>y($)},{default:i(()=>[l(W,{name:"Edit"})]),_:2},1032,["onClick"]),l(Oe,{tag:"button",size:"small",onClick:F=>v($),bg:"danger",outline:""},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),l(cAe,{modelValue:s.value,"onUpdate:modelValue":[b[0]||(b[0]=$=>s.value=$),b[1]||(b[1]=$=>!$&&(o.value=null))],countries:e.countries,"tax-classes":u.value,"edit-row":o.value,onSaved:m},null,8,["modelValue","countries","tax-classes","edit-row"])],64)}}},vAe={class:"setting-wrap"},yAe={class:"setting-wrap-inner"},bAe={class:"fct-tax-collection-page"},wAe={__name:"EUVatSettings",setup(e){const t=V(!0),a=Ie.get("eu_vat_county_options",[]),n=V(""),s=V(""),o=V([]),u=V({}),A=j(()=>!!Ie.get("is_tax_enabled"));function f(){return t.value=!0,re.get("tax/configuration/settings").then(g=>{var v;const y=((v=g.settings)==null?void 0:v.eu_vat_settings)||{};n.value=g.store_country||"",o.value=y.country_registrations||[],u.value=y,s.value=y.method||""}).catch(g=>{var y;q.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{t.value=!1})}function m({method:g}){s.value=g||"",f()}return Be(f),(g,y)=>(d(),_("div",vAe,[l(ha,{heading:p(c)("VAT collection"),"show-save-button":!1},null,8,["heading"]),r("div",yAe,[l(_a),r("div",bAe,[t.value?(d(),E(Que,{key:0})):(d(),_(H,{key:1},[l(uAe,{countries:p(a),"initial-form":u.value,"initial-registrations":o.value,"store-country":n.value,"is-tax-enabled":A.value,onMethodChanged:m},null,8,["countries","initial-form","initial-registrations","store-country","is-tax-enabled"]),l(gAe,{countries:p(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class CAe extends Gs{getTabs(){return{all:c("All"),active:c("Active"),expired:c("Inactive")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Stackable",value:"stackable"},{label:"Actions",value:"actions"}]}getSortableColumns(){return[{label:c("ID"),value:"id"},{label:c("Title"),value:"title"},{label:c("Code"),value:"code"},{label:c("Amount"),value:"amount"},{label:c("Max Uses"),value:"max_uses"},{label:c("Stackable"),value:"stackable"},{label:c("Status"),value:"status"},{label:c("Expiry Date"),value:"expiry_date"}]}getSearchHint(){return c("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 wm(e){return CAe.init(e)}const BAe={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},kAe={class:"fct-table-mobile-header"},xAe={class:"fct-table-mobile-header-left"},SAe={class:"fct-table-id-col"},FAe={class:"fct-table-status-col"},EAe=["onClick"],UAe={class:"title"},$Ae={class:"value"},DAe={key:0,class:"fct-table-action-col"},QAe={class:"more-btn pr-0"},IAe={class:"fct-table-mobile-body"},TAe=["onClick"],VAe={key:0,class:"fct-table-coupon-title-col"},MAe={class:"fct-table-coupon-code-col"},LAe=["onClick"],RAe={class:"fct-table-mobile-footer"},OAe=["onClick"],HAe={class:"fct-table-date-col grid"},PAe={class:"title"},NAe={class:"value"},KAe={key:0,class:"fct-table-stackable-col"},GAe={class:"title"},jAe={class:"value"},zAe={class:"fct-table-amount-col"},YAe={class:"title"},qAe={class:"value"},WAe={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:c("No customers found.")}},setup(e){Re.extend(Gr);const t=e,a=s=>{if(!s||s==="0000-00-00 00:00:00")return!1;const o=Re.utc(s).local();return o.isValid()?o.isBefore(Re()):!1},n=s=>{let o=c("Are you sure you want to delete this %s coupon. This action is not recoverable",s.coupon.title);s.action==="delete"&&en(o,c("Confirm Delete!"),{confirmButtonText:c("Yes, Delete!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{re.delete("coupons/"+s.coupon.id).then(u=>{q.success(u.message),t.table.fetch()}).catch(u=>{q.error(u)}).finally(()=>{})}).catch(()=>{})};return(s,o)=>{const u=C("router-link"),A=C("el-tooltip"),f=C("el-dropdown-item"),m=C("el-dropdown-menu"),g=C("el-dropdown");return d(),_("div",BAe,[(d(!0),_(H,null,ee(e.table.getTableData(),(y,v)=>(d(),_("div",{key:y.id,class:"fct-table-mobile-row"},[r("div",kAe,[r("div",xAe,[r("div",SAe,[l(u,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:i(()=>[R(" #"+h(y.id),1)]),_:2},1032,["to"])]),r("div",FAe,[l(qt,{status:y.status},{default:i(()=>[R(h(a(y.end_date)?p(c)("Expired"):y.status),1)]),_:2},1032,["status"]),y.status==="scheduled"?(d(),E(A,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:i(()=>[R(h(p(c)("Available On: %s",p(Hs)(y.start_date,!0))),1)]),default:i(()=>[l(W,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),r("div",{class:"fct-table-usage-col",onClick:B=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[r("div",UAe,h(p(c)("Usage:")),1),r("div",$Ae,[R(h(y.use_count??0)+" ",1),o[0]||(o[0]=r("span",null,"/",-1)),R(" "+h(y.conditions.max_uses>0?y.conditions.max_uses:p(c)("Unlimited")),1)])],8,EAe)]),e.table.isColumnVisible("actions")?(d(),_("div",DAe,[l(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:n,placement:"bottom-end"},{dropdown:i(()=>[l(m,null,{default:i(()=>[y.id?(d(),E(f,{key:0,class:"item-link"},{default:i(()=>[l(u,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id,action:"edit"}}},{default:i(()=>[l(W,{name:"Edit"}),R(" "+h(p(c)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),l(f,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:i(()=>[r("span",QAe,[l(W,{name:"More"})])]),_:2},1024)])):x("",!0)]),r("div",IAe,[r("div",{class:"fct-table-coupon-code-wrapper-col",onClick:B=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(d(),_("div",VAe,h(y.title),1)):x("",!0),r("div",MAe,[r("code",{class:"copyable-content",onClick:B=>{p(Os).copy(y.code)}},h(y.code),9,LAe)])],8,TAe)]),r("div",RAe,[r("div",{class:"fct-table-mobile-footer-row items-start",onClick:B=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[r("div",HAe,[r("div",PAe,h(p(c)("Expiry Date")),1),r("div",NAe,[isNaN(Date.parse(y.end_date))?(d(),_(H,{key:1},[R("n/a")],64)):(d(),E($a,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(d(),_("div",KAe,[r("div",GAe,h(p(c)("Stackable")),1),r("div",jAe,h(y.stackable),1)])):x("",!0),r("div",zAe,[r("div",YAe,h(p(c)("Amount")),1),r("div",qAe,h(y.type!=="percentage"?p(Jt)(y.amount,!0):y.amount+"%"),1)])],8,OAe)])]))),128))])}}},XAe={},JAe={class:"px-4 py-3"},ZAe={class:"grid grid-cols-3 gap-5 mt-5"};function epe(e,t){const a=C("el-skeleton-item"),n=C("el-skeleton");return d(),E(n,{animated:""},{template:i(()=>[r("div",JAe,[(d(),_(H,null,ee(2,s=>r("div",{key:s,class:"flex items-center justify-between mb-3"},[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})])),64)),r("div",ZAe,[(d(),_(H,null,ee(3,s=>r("div",{key:s},[l(a,{varient:"p",class:"w-1/2"}),l(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const tpe=He(XAe,[["render",epe]]),ape={class:"fct-all-coupons-page fct-layout-width"},npe={class:"fct-all-coupons-wrap"},spe={key:1},lpe=["onClick"],ope={class:"capitalize"},rpe={class:"more-btn mr-2"},QA={__name:"AllCoupons",setup(e){Re.extend(Gr);const t=wm(),a=V(!1),n=u=>{let A=c("Are you sure you want to delete this %s coupon. This action is not recoverable",u.coupon.title);u.action==="delete"&&en(A,c("Confirm Delete!"),{confirmButtonText:c("Yes, Delete!"),cancelButtonText:c("Cancel"),type:"warning"}).then(()=>{re.delete("coupons/"+u.coupon.id).then(f=>{q.success(f.message),t.fetch()}).catch(f=>{var m;f.status_code=="422"?q.validationErrors(f):q.error((m=f.data)==null?void 0:m.message)}).finally(()=>{})}).catch(()=>{})},s=()=>{re.get("coupons/getSettings").then(u=>{a.value=!!parseInt(u.show_on_checkout)}).catch(u=>{var A;u.status_code=="422"?q.validationErrors(u):q.error((A=u.data)==null?void 0:A.message)}).finally(()=>{})},o=u=>{if(!u||u==="0000-00-00 00:00:00")return!1;const A=Re.utc(u).local();return A.isValid()?A.isBefore(Re()):!1};return Be(()=>{s()}),(u,A)=>{const f=C("el-button"),m=C("el-table-column"),g=C("el-tooltip"),y=C("router-link"),v=C("el-dropdown-item"),B=C("el-dropdown-menu"),b=C("el-dropdown"),w=C("el-table");return d(),E(St,{permission:"coupons/view"},{default:i(()=>[r("div",ape,[l(za,{title:p(c)("Coupons")},{action:i(()=>[l(f,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:i(()=>[R(h(p(c)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),r("div",npe,[l(js,{table:p(t),"has-mobile-slot":!0},{mobile:i(()=>[p(t).isLoading()?(d(),E(tpe,{key:0})):x("",!0),p(t).isLoading()?x("",!0):(d(),E(WAe,{key:1,table:p(t)},null,8,["table"]))]),default:i(()=>[p(t).isLoading()?(d(),E(tue,{key:0,couponTable:p(t),"next-page-count":p(t).nextPageCount},null,8,["couponTable","next-page-count"])):(d(),_("div",spe,[l(w,{data:p(t).getTableData(),class:"w-full compact-table full-compact"},{empty:i(()=>[l(at,{icon:"Empty/Order","has-dark":"",text:p(c)("No coupons available at the moment.")},null,8,["text"])]),default:i(()=>[l(m,{width:100,label:p(c)("ID")},{default:i(k=>[l(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id}}},{default:i(()=>[R(" #"+h(p(Kt)(k.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),p(t).isColumnVisible("title")?(d(),E(m,{key:0,label:p(c)("Title"),width:220},{default:i(k=>[l(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:i(()=>[R(h(k.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),l(m,{label:p(c)("Code"),width:200},{default:i(k=>[r("code",{class:"copyable-content",onClick:S=>{p(Os).copy(k.row.code)}},h(k.row.code),9,lpe)]),_:1},8,["label"]),l(m,{label:p(c)("Amount"),width:120},{default:i(k=>[l(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:i(()=>[R(h(k.row.type!=="percentage"?p(Jt)(k.row.amount,!0):k.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),l(m,{label:p(c)("Usage"),width:150},{default:i(k=>[l(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:i(()=>[r("span",null,h(p(Kt)(k.row.use_count??0)),1),A[0]||(A[0]=r("span",{class:"px-1"},"/",-1)),r("span",null,h(k.row.conditions.max_uses>0?k.row.conditions.max_uses:p(c)("Unlimited")),1)]),_:2,__:[0]},1032,["to"])]),_:1},8,["label"]),p(t).isColumnVisible("stackable")?(d(),E(m,{key:1,label:p(c)("Stackable"),width:120},{default:i(k=>[l(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:i(()=>[r("span",ope,h(k.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),l(m,{label:p(c)("Status"),width:120},{default:i(k=>[l(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:i(()=>[l(qt,{status:k.row.status},{default:i(()=>[R(h(o(k.row.end_date)?p(c)("Expired"):k.row.status),1)]),_:2},1032,["status"]),k.row.status==="scheduled"?(d(),E(g,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:i(()=>[R(h(p(c)("Available On: %s",p(Hs)(k.row.start_date,!0))),1)]),default:i(()=>[l(W,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),_:2},1032,["to"])]),_:1},8,["label"]),l(m,{label:p(c)("Expiry Date"),width:120},{default:i(k=>[l(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:i(()=>[r("span",null,[isNaN(Date.parse(k.row.end_date))?(d(),_(H,{key:1},[R("n/a")],64)):(d(),E($a,{key:0,"date-time":k.row.end_date,"with-time":!0},null,8,["date-time"]))])]),_:2},1032,["to"])]),_:1},8,["label"]),p(t).isColumnVisible("actions")?(d(),E(m,{key:2,label:p(c)("Actions"),width:100,align:"right",fixed:"right"},{default:i(k=>[l(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:n,placement:"bottom-end"},{dropdown:i(()=>[l(B,null,{default:i(()=>[k.row.id?(d(),E(v,{key:0,class:"item-link"},{default:i(()=>[l(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:i(()=>[l(W,{name:"Edit"}),R(" "+h(p(c)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),l(v,{command:{action:"delete",coupon:k.row},class:"item-destructive"},{default:i(()=>[l(W,{name:"Delete"}),R(" "+h(p(c)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:i(()=>[r("span",rpe,[l(W,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},ipe={class:"fct-add-edit-coupon-wrapper fct-layout-width"},dpe={class:"single-page-header"},upe={class:"single-page-body"},cpe={class:"fct-add-edit-coupon"},Ape={class:"fct-add-edit-coupon-main"},ppe={class:"fct-add-edit-coupon-aside"},fpe={class:"fct-admin-sidebar"},mpe={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const n=C("el-skeleton-item"),s=C("el-skeleton"),o=C("el-breadcrumb-item"),u=C("el-breadcrumb");return d(),_("div",ipe,[r("div",dpe,[l(u,{"separator-icon":p(tn)},{default:i(()=>[l(o,null,{default:i(()=>[l(s,{animated:!0},{template:i(()=>[l(n,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),l(o,null,{default:i(()=>[l(s,{animated:!0},{template:i(()=>[l(n,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),l(o,null,{default:i(()=>[l(s,{animated:!0},{template:i(()=>[l(n,{variant:"p",class:"w-[60px] h-4"})]),_:1})]),_:1})]),_:1},8,["separator-icon"])]),r("div",upe,[r("div",cpe,[r("div",Ape,[l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:!0,class:"flex flex-col gap-3"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"}),l(n,{variant:"p",class:"max-w-[400px] h-4"}),l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:!0,class:"flex flex-col gap-3"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"}),l(n,{variant:"p",class:"max-w-[400px] h-4"}),l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:!0,class:"flex flex-col gap-3"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"}),l(n,{variant:"p",class:"max-w-[400px] h-4"}),l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:!0,class:"flex flex-col gap-3"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:!0,class:"flex flex-col gap-3"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"}),l(n,{variant:"p",class:"max-w-[400px] h-4"}),l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"}),l(n,{variant:"p",class:"max-w-[400px] h-4"}),l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})]),r("div",ppe,[r("div",fpe,[l(he,null,{default:i(()=>[l(Ce,{title:p(c)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),l(me,null,{default:i(()=>[l(s,{animated:!0,class:"flex flex-col gap-3"},{template:i(()=>[l(n,{variant:"p",class:"w-full h-4"}),l(n,{variant:"p",class:"w-2/3 h-4"}),l(n,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})])])])])])}}};Re.extend(Gr);Re.extend(cp);const hpe={name:"AddOrEditCoupon",components:{CardContainer:he,CardHeader:Ce,CardBody:me,LabelHint:sa,ValidationError:Pt,CopyToClipboard:Za,DynamicTemplates:Sl,SaveBar:Bl,ProductVariationSelector:Ap,SingleCouponLoader:mpe,Activity:op},beforeRouteLeave(e,t,a){var n;(n=this.keyboardShortcuts)!=null&&n.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:"",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 tn},maxDiscountAmount(){return this.coupon.type==="percentage"?100:999999}},watch:{coupon:{handler(){this.handleChangesMade()},deep:!0}},mounted(){this.keyboardShortcuts=ks(),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:c,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:Re(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=Jt(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=Jt(this.coupon.conditions.min_purchase_amount,!1):this.coupon.conditions.min_purchase_amount=""),this.coupon.conditions.max_discount_amount!==null&&(this.coupon.conditions.max_discount_amount?this.coupon.conditions.max_discount_amount=Jt(this.coupon.conditions.max_discount_amount,!1):this.coupon.conditions.max_discount_amount=""),this.coupon.conditions.max_purchase_amount||(this.coupon.conditions.max_purchase_amount=""),this.coupon.conditions.max_uses||(this.coupon.conditions.max_uses=""),this.coupon.conditions.max_per_customer||(this.coupon.conditions.max_per_customer=""),this.coupon.conditions.min_purchase_amount||(this.coupon.conditions.min_purchase_amount=""))},parseProductIds(e){return Array.isArray(e)?e.map(t=>parseInt(t,10)):[]},reloadPage(){return 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(){re.get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},fetchCoupon(){this.fetchingCoupon=!0,this.isInitialLoading=!0,re.get(`coupons/${this.coupon_id}`,{}).then(e=>{var n,s;const t=(n=e==null?void 0:e.coupon)==null?void 0:n.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=Re.utc(t).tz(Re.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=Re.utc(a).tz(Re.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.formatAmount(),this.setDefaultStatus(),this.showDynamicTemplates=!0}).catch(e=>{var t;errors.status_code=="422"?q.validationErrors(errors):q.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}}),re.put(`coupons/${this.coupon_id}`,{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var n;(n=this.$refs.dynamic_templates)==null||n.afterUpdatingData({coupon:this.coupon,response:a}),q.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var n;a.status_code=="422"?(q.validationErrors(a),this.validationErrors=a):q.error((n=a.data)==null?void 0:n.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}}),re.post("coupons",{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var n;(n=this.$refs.dynamic_templates)==null||n.afterUpdatingData({coupon:this.coupon,response:a}),q.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var n;a.status_code=="422"?(q.validationErrors(a),this.validationErrors=a):q.error((n=a.data)==null?void 0:n.message)}).finally(()=>{this.creating=!1})}}},_pe={class:"fct-add-edit-coupon-wrapper fct-layout-width"},gpe={class:"single-page-header"},vpe={class:"single-page-body"},ype={class:"fct-add-edit-coupon"},bpe={class:"fct-add-edit-coupon-main"},wpe={class:"flex gap-2 items-center justify-between w-full mb-2.5"},Cpe={class:"form-note"},Bpe=["innerHTML"],kpe={key:1},xpe=["innerHTML"],Spe=["innerHTML"],Fpe=["innerHTML"],Epe={class:"fct-add-edit-coupon-aside"},Upe={class:"fct-admin-sidebar"},$pe={class:"fct-admin-sidebar-item"},Dpe={key:0,class:"flex items-center gap-1"},Qpe={class:"text-sm font-medium text-system-dark dark:text-gray-300"},Ipe={key:1},Tpe={class:"fct-admin-sidebar-item mt-5 hidden"},Vpe={class:"sidebar-title mb-3"},Mpe={class:"fct-bullet-lists"},Lpe={class:"fct-admin-sidebar-item mt-5 hidden"},Rpe={class:"sidebar-title mb-3"},Ope={class:"fct-bullet-lists"},Hpe={key:0};function Ppe(e,t,a,n,s,o){const u=C("SaveBar"),A=C("SingleCouponLoader"),f=C("el-breadcrumb-item"),m=C("el-breadcrumb"),g=C("CardHeader"),y=C("el-input"),v=C("ValidationError"),B=C("el-form-item"),b=C("el-col"),w=C("LabelHint"),k=C("el-row"),S=C("CardBody"),M=C("CardContainer"),$=C("el-option"),F=C("el-select"),L=C("ProductVariationSelector"),Q=C("el-checkbox"),T=C("el-radio"),D=C("el-radio-group"),U=C("el-form"),I=C("CopyToClipboard"),O=C("el-date-picker"),P=C("DynamicTemplates"),K=C("Activity");return d(),_("div",_pe,[l(u,{isActive:s.changes_made>0?"is-active":"",loading:a.coupon_id?s.updating:s.creating,onSave:t[0]||(t[0]=G=>a.coupon_id?o.updateCoupon():o.addCoupon()),onDiscard:o.reloadPage,"show-cmnd-icon":!0,saveButtonText:a.coupon_id?o.translate("Update"):o.translate("Create")},null,8,["isActive","loading","onDiscard","saveButtonText"]),s.fetchingCoupon?(d(),E(A,{key:0})):x("",!0),s.fetchingCoupon?x("",!0):(d(),_(H,{key:1},[r("div",gpe,[l(m,{"separator-icon":o.ArrowRight},{default:i(()=>[l(f,{to:{name:"coupons"}},{default:i(()=>[R(h(o.translate("Coupons")),1)]),_:1}),l(f,null,{default:i(()=>[R(h(a.coupon_id?o.translate("Edit Coupon"):o.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(d(),E(f,{key:0},{default:i(()=>[R(h(s.coupon.title),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"])]),r("div",vpe,[r("div",ype,[r("div",bpe,[l(U,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:i(()=>[l(M,null,{default:i(()=>[l(g,{title:o.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,{class:"pb-1.5"},{default:i(()=>[l(k,{gutter:20},{default:i(()=>[l(b,{lg:24},{default:i(()=>[l(B,{label:o.translate("Title"),required:""},{default:i(()=>{var G,ne;return[l(y,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=Y=>s.coupon.title=Y),placeholder:o.translate("Enter title"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(ne=s.validationErrors)!=null&&ne.hasOwnProperty("title")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"title"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),l(b,{lg:12},{default:i(()=>[l(B,null,{default:i(()=>{var G,ne;return[r("div",wpe,[l(w,{title:o.translate("Code"),required:""},null,8,["title"]),r("span",{class:"text-system-dark text-xs cursor-pointer hover:underline dark:text-gray-50 underline",onClick:t[2]||(t[2]=(...Y)=>o.generateRandomCouponCode&&o.generateRandomCouponCode(...Y))},h(o.translate("Generate Random Code")),1)]),l(y,{modelValue:s.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=Y=>s.coupon.code=Y),placeholder:o.translate("Eg. COUPON10"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(ne=s.validationErrors)!=null&&ne.hasOwnProperty("code")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"code"},null,8,["validation-errors"])):x("",!0),r("div",Cpe,[r("p",null,h(o.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),l(b,{lg:12},{default:i(()=>[l(B,null,{label:i(()=>[l(w,{title:o.translate("Coupon Priority"),content:o.translate("Coupons will be calculated based on their priority. The lower the number the higher the priority is.")},null,8,["title","content"])]),default:i(()=>{var G,ne;return[l(y,{modelValue:s.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=Y=>s.coupon.priority=Y),type:"number",placeholder:o.translate("Enter priority"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=Y=>{o.onChangeCouponInput("priority",Y)}),onKeypress:o.preventInvalidChars},null,8,["modelValue","placeholder","class","onKeypress"]),(ne=s.validationErrors)!=null&&ne.hasOwnProperty("priority")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"priority"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),l(M,null,{default:i(()=>[l(g,{title:o.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,{class:"pb-1.5"},{default:i(()=>[l(k,{gutter:20},{default:i(()=>[l(b,{lg:8},{default:i(()=>[l(B,{label:o.translate("Type"),required:""},{default:i(()=>{var G;return[l(F,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=ne=>s.coupon.type=ne),placeholder:o.translate("Select coupon type"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:i(()=>[l($,{label:o.translate("Fixed"),value:"fixed"},null,8,["label"]),l($,{label:o.translate("Percentage"),value:"percentage"},null,8,["label"])]),_:1},8,["modelValue","placeholder","class"])]}),_:1},8,["label"])]),_:1}),s.coupon.type==="fixed"||s.coupon.type==="percentage"?(d(),_(H,{key:0},[l(b,{lg:8},{default:i(()=>[l(B,{label:s.coupon.type==="percentage"?o.translate("Discount Percentage (%)"):o.translate("Discount Amount"),required:""},{default:i(()=>{var G;return[l(y,{modelValue:s.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=ne=>s.coupon.amount=ne),type:"number",placeholder:"0.00",min:s.minDiscountAmount,max:o.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=ne=>{o.onChangeCouponInput("amount",ne)}),onKeypress:t[9]||(t[9]=ne=>o.preventInvalidChars(ne,!0))},{prefix:i(()=>[s.coupon.type==="fixed"?(d(),_("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,Bpe)):(d(),_("span",kpe,"%"))]),_:1},8,["modelValue","min","max"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("amount")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"amount"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),s.coupon.type==="percentage"?(d(),E(b,{key:0,lg:8},{default:i(()=>[l(B,{label:o.translate("Max Discount Amount")},{default:i(()=>{var G;return[l(y,{modelValue:s.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=ne=>s.coupon.conditions.max_discount_amount=ne),type:"number",placeholder:o.translate("leave empty or 0 for no max limit"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:i(()=>[r("span",{innerHTML:e.appVars.shop.currency_sign},null,8,xpe)]),_:1},8,["modelValue","placeholder","class"]),l(v,{"validation-errors":s.validationErrors,"field-key":"max_discount_amount"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})):x("",!0)],64)):x("",!0)]),_:1})]),_:1})]),_:1}),l(M,null,{default:i(()=>[l(g,{title:o.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,{class:"pb-1.5"},{default:i(()=>[l(k,{gutter:20},{default:i(()=>[l(b,{lg:12},{default:i(()=>[l(B,null,{label:i(()=>[l(w,{title:o.translate("Min Spend Amount"),content:o.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:i(()=>{var G,ne;return[l(y,{modelValue:s.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=Y=>s.coupon.conditions.min_purchase_amount=Y),type:"number",placeholder:"0.00",class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:i(()=>[r("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Spe)]),_:1},8,["modelValue","class"]),(ne=s.validationErrors)!=null&&ne.hasOwnProperty("min_purchase_amount")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"min_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),l(b,{lg:12},{default:i(()=>[l(B,null,{label:i(()=>[l(w,{title:o.translate("Max Spend Amount"),content:o.translate("Set the maximum spend (subtotal) allowed when using the coupon.")},null,8,["title","content"])]),default:i(()=>{var G,ne;return[l(y,{modelValue:s.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=Y=>s.coupon.conditions.max_purchase_amount=Y),type:"number",placeholder:o.translate("leave empty or 0 for no max limit"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:i(()=>[r("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Fpe)]),_:1},8,["modelValue","placeholder","class"]),(ne=s.validationErrors)!=null&&ne.hasOwnProperty("max_purchase_amount")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),l(b,{md:12},{default:i(()=>[l(B,{label:o.translate("Include Categories")},{default:i(()=>[l(F,{modelValue:s.coupon.conditions.included_categories,"onUpdate:modelValue":t[13]||(t[13]=G=>s.coupon.conditions.included_categories=G),multiple:"",placeholder:o.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:i(()=>[(d(!0),_(H,null,ee(s.categories,G=>(d(),E($,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),l(b,{md:12},{default:i(()=>[l(B,{label:o.translate("Exclude Categories")},{default:i(()=>[l(F,{modelValue:s.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[14]||(t[14]=G=>s.coupon.conditions.excluded_categories=G),multiple:"",placeholder:o.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:i(()=>[(d(!0),_(H,null,ee(s.categories,G=>(d(),E($,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),l(b,{md:24},{default:i(()=>[l(B,{label:o.translate("Include Products")},{default:i(()=>[l(L,{modelValue:s.coupon.conditions.included_products,"onUpdate:modelValue":t[15]||(t[15]=G=>s.coupon.conditions.included_products=G)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),l(b,{md:24},{default:i(()=>[l(B,{label:o.translate("Excluded Products")},{default:i(()=>[l(L,{modelValue:s.coupon.conditions.excluded_products,"onUpdate:modelValue":t[16]||(t[16]=G=>s.coupon.conditions.excluded_products=G)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),l(b,{md:24},{default:i(()=>[l(B,null,{label:i(()=>[l(w,{title:o.translate("By Email Address"),content:o.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:i(()=>{var G;return[l(y,{autocomplete:"off",modelValue:s.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[17]||(t[17]=ne=>s.coupon.conditions.email_restrictions=ne),type:"text",placeholder:o.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("email_restrictions")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"email_restrictions"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),l(b,{md:24},{default:i(()=>{var G;return[l(B,null,{label:i(()=>[l(w,{title:o.translate("Recurring Coupon"),content:o.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:i(()=>[l(Q,{modelValue:s.coupon.conditions.is_recurring,"onUpdate:modelValue":t[18]||(t[18]=ne=>s.coupon.conditions.is_recurring=ne),label:o.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(G=s.validationErrors)!=null&&G.hasOwnProperty("is_recurring")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"is_recurring"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),l(M,null,{default:i(()=>[l(g,{title:o.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,{class:"pb-1.5"},{default:i(()=>[l(k,{gutter:20},{default:i(()=>[l(b,{lg:12},{default:i(()=>[l(B,null,{label:i(()=>[l(w,{title:o.translate("Total Limit"),content:o.translate("Total number of times this coupon can be redeemed across the entire store.")},null,8,["title","content"])]),default:i(()=>{var G,ne;return[l(y,{modelValue:s.coupon.conditions.max_uses,"onUpdate:modelValue":t[19]||(t[19]=Y=>s.coupon.conditions.max_uses=Y),type:"number",placeholder:o.translate("Total limit"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("max_uses")?"is-error":s.usageError),min:s.minLimit,max:s.maxLimit,onInput:t[20]||(t[20]=Y=>{o.onChangeCouponInput("max_uses",Y)}),onKeypress:o.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),(ne=s.validationErrors)!=null&&ne.hasOwnProperty("max_uses")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_uses"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),l(b,{lg:12},{default:i(()=>[l(B,null,{label:i(()=>[l(w,{title:o.translate("Per User Limit"),content:o.translate("Maximum an user can use. 0 means unlimited")},null,8,["title","content"])]),default:i(()=>[l(y,{modelValue:s.coupon.conditions.max_per_customer,"onUpdate:modelValue":t[21]||(t[21]=G=>s.coupon.conditions.max_per_customer=G),type:"number",placeholder:o.translate("Max limit per user"),class:de(s.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:s.minLimit,max:s.maxLimit,onInput:t[22]||(t[22]=G=>{o.onChangeCouponInput("max_per_customer",G)}),onKeypress:o.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),l(v,{"validation-errors":s.validationErrors,"field-key":"max_per_customer"},null,8,["validation-errors"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),l(M,null,{default:i(()=>[l(g,{title:o.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,{class:"pb-1.5"},{default:i(()=>[l(k,{gutter:20},{default:i(()=>[l(b,{lg:24},{default:i(()=>[l(B,{label:o.translate("Status")},{default:i(()=>[l(D,{modelValue:s.coupon.status,"onUpdate:modelValue":t[23]||(t[23]=G=>s.coupon.status=G)},{default:i(()=>[l(T,{value:"active",label:o.translate("Active")},null,8,["label"]),l(T,{value:"disabled",label:o.translate("Disabled")},null,8,["label"]),l(T,{disabled:"",value:"expired",label:o.translate("Expired")},null,8,["label"])]),_:1},8,["modelValue"]),l(v,{"validation-errors":s.validationErrors,"field-key":"status"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),l(b,{lg:24},{default:i(()=>[l(B,{label:o.translate("Internal Notes")},{default:i(()=>{var G;return[l(y,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[24]||(t[24]=ne=>s.coupon.notes=ne),type:"textarea",placeholder:o.translate("Enter note"),class:de((G=s.validationErrors)!=null&&G.hasOwnProperty("notes")?"is-error":"")},null,8,["modelValue","placeholder","class"]),l(v,{"validation-errors":s.validationErrors,"field-key":"notes"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),l(b,{lg:24},{default:i(()=>{var G;return[l(B,null,{label:i(()=>[l(w,{title:o.translate("Stackable"),content:o.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:i(()=>[l(D,{modelValue:s.coupon.stackable,"onUpdate:modelValue":t[25]||(t[25]=ne=>s.coupon.stackable=ne)},{default:i(()=>[l(T,{value:"yes"},{default:i(()=>[R(h(o.translate("Yes")),1)]),_:1}),l(T,{value:"no"},{default:i(()=>[R(h(o.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(G=s.validationErrors)!=null&&G.hasOwnProperty("stackable")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"stackable"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),r("div",Epe,[r("div",Upe,[l(M,null,{default:i(()=>[l(g,{title:o.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,null,{default:i(()=>[r("div",$pe,[s.coupon.code?(d(),_("div",Dpe,[r("span",Qpe,h(o.translate("Coupon code"))+": "+h(s.coupon.code),1),l(I,{text:s.coupon.code,showMode:"basic_copy_btn",tooltipText:o.translate("Copy discount code")},null,8,["text","tooltipText"])])):(d(),_("div",Ipe,h(o.translate("No discount code yet")),1))]),r("div",Tpe,[r("h4",Vpe,h(o.translate("Type & Method")),1),r("ul",Mpe,[r("li",null,[r("span",null,h(o.translate("Amount off Products")),1)]),r("li",null,[r("span",null,h(o.translate("Code")),1)])])]),r("div",Lpe,[r("h4",Rpe,h(o.translate("Details")),1),r("ul",Ope,[r("li",null,[r("span",null,h(o.translate("For Online Store")),1)]),r("li",null,[r("span",null,h(o.translate("No Min Purchase Requirement")),1)]),r("li",null,[r("span",null,h(o.translate("All Customers")),1)])])])]),_:1})]),_:1}),l(M,null,{default:i(()=>[l(g,{title:o.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,{class:"pb-1.5"},{default:i(()=>[l(U,{"label-position":"top"},{default:i(()=>[l(k,{gutter:20},{default:i(()=>[l(b,{lg:24},{default:i(()=>[l(B,{label:o.translate("Start Date & Time")},{default:i(()=>[l(O,{modelValue:s.coupon.start_date,"onUpdate:modelValue":t[26]||(t[26]=G=>s.coupon.start_date=G),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:o.translate("Start date & time"),onChange:o.setDefaultStatus,"disabled-date":o.disabledStartDate},null,8,["modelValue","placeholder","onChange","disabled-date"])]),_:1},8,["label"])]),_:1}),l(b,{lg:24},{default:i(()=>[l(B,null,{default:i(()=>[l(Q,{modelValue:s.isEndDateEnabled,"onUpdate:modelValue":t[27]||(t[27]=G=>s.isEndDateEnabled=G),label:o.translate("Set end date & time"),onChange:t[28]||(t[28]=G=>{G||(s.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),s.isEndDateEnabled?(d(),E(b,{key:0,lg:24},{default:i(()=>[l(B,{label:o.translate("End Date & Time")},{default:i(()=>[l(O,{modelValue:s.coupon.end_date,"onUpdate:modelValue":t[29]||(t[29]=G=>s.coupon.end_date=G),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:o.translate("End date & time"),onChange:o.setDefaultStatus,"disabled-date":o.disabledEndDate},null,8,["modelValue","placeholder","onChange","disabled-date"]),s.validationErrors.hasOwnProperty("end_date")?(d(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"end_date"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})):x("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),s.showDynamicTemplates?(d(),_("div",Hpe,[l(P,{filter:"fluent_cart_single_coupon_page",ref:"dynamic_templates",data:{coupon:s.coupon},widgetsQuery:{coupon_id:s.coupon.id},onChange:o.handleChangesMade},null,8,["data","widgetsQuery","onChange"])])):x("",!0),l(M,null,{default:i(()=>[l(g,{title:o.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),l(S,null,{default:i(()=>[l(K,{onReload:o.fetchCoupon,activities:s.coupon.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const Npe=He(hpe,[["render",Ppe]]),Kpe={name:"CheckoutFields",components:{Animation:ra,CardHeader:Ce,Card:he,CardBody:me,SettingsHeader:ha,AdminNotice:_a},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")}},mounted(){this.getFields()},methods:{translate:c,isFirstNameDisabled(e,t){var a,n;return e==="basic_info"&&t==="first_name"&&((n=(a=this.settings.basic_info)==null?void 0:a.last_name)==null?void 0:n.enabled)==="yes"},shouldDimLabel(e,t){var a,n,s,o,u,A,f;return((s=(n=(a=this.settings)==null?void 0:a[e])==null?void 0:n[t])==null?void 0:s.enabled)==="no"?!0:e==="basic_info"&&t==="full_name"?((u=(o=this.settings.basic_info)==null?void 0:o.first_name)==null?void 0:u.enabled)==="yes"||((f=(A=this.settings.basic_info)==null?void 0:A.last_name)==null?void 0:f.enabled)==="yes":!1},isVisible(e,t){var a,n,s,o;return t==="full_name"?((n=(a=this.settings.basic_info)==null?void 0:a.first_name)==null?void 0:n.enabled)!=="yes"&&((o=(s=this.settings.basic_info)==null?void 0:s.last_name)==null?void 0:o.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())}}},Gpe={class:"setting-wrap"},jpe={class:"setting-wrap-inner"},zpe={class:"fct-checkout-fields-wrapp"},Ype={class:"field-heading"},qpe={class:"fct-checkout-fields"},Wpe={key:0,class:"fct-checkout-field"},Xpe={class:"fct-checkout-field-info"},Jpe={class:"fct-checkout-field-label-wrap"},Zpe={class:"fct-checkout-field-tags"},efe={key:0,class:"fct-checkout-field-info-desc"},tfe={key:0,class:"fct-checkout-field-action"},afe={key:1,class:"fct-checkout-field-input"},nfe={class:"fct-checkout-field-info"},sfe={class:"fct-checkout-field-label-wrap"},lfe={key:1,class:"fct-checkout-field-tags"},ofe={key:0,class:"fct-checkout-field-info-desc"},rfe={key:0,class:"fct-checkout-field-action"},ife={class:"form-section-save-action"};function dfe(e,t,a,n,s,o){const u=C("SettingsHeader"),A=C("AdminNotice"),f=C("el-skeleton"),m=C("el-switch"),g=C("el-tag"),y=C("el-checkbox"),v=C("el-input"),B=C("CardBody"),b=C("Card"),w=C("el-button");return d(),_("div",Gpe,[l(u,{heading:o.translate("Checkout Fields"),loading:s.saving,onOnSave:o.saveFields},null,8,["heading","loading","onOnSave"]),r("div",jpe,[l(A),r("div",zpe,[l(b,null,{default:i(()=>[l(B,null,{default:i(()=>[l(f,{loading:s.fetching,animated:"",rows:5},null,8,["loading"]),s.fetching?x("",!0):(d(!0),_(H,{key:0},ee(s.fields,(k,S)=>(d(),_("div",{key:S,class:"fct-checkout-field-section"},[r("h3",Ype,h(o.formatSectionTitle(S)),1),r("div",qpe,[k.label?(d(),_("div",Wpe,[r("div",Xpe,[r("div",Jpe,[k.can_alter==="yes"?(d(),E(m,{key:0,modelValue:s.settings[S].enabled,"onUpdate:modelValue":M=>s.settings[S].enabled=M,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):x("",!0),r("span",{class:de(`fct-checkout-field-label ${s.settings[S].enabled==="no"?"opacity-50":""}`)},h(k.label),3),r("div",Zpe,[k.can_alter!=="yes"&&s.settings[S].enabled==="yes"?(d(),E(g,{key:0,size:"small"},{default:i(()=>[R(h(o.translate("System")),1)]),_:1})):x("",!0),s.settings[S].required==="yes"&&s.settings[S].enabled==="yes"?(d(),E(g,{key:1,size:"small"},{default:i(()=>[R(h(o.translate("Required")),1)]),_:1})):x("",!0)])]),k.help_text?(d(),_("div",efe,h(k.help_text),1)):x("",!0)]),k.can_alter==="yes"?(d(),_("div",tfe,[l(y,{modelValue:s.settings[S].required,"onUpdate:modelValue":M=>s.settings[S].required=M,"true-label":"yes","false-label":"no",disabled:s.settings[S].enabled!=="yes"},{default:i(()=>[R(h(o.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),s.settings[S].hasOwnProperty("text")&&s.settings[S].enabled==="yes"?(d(),_("div",afe,[l(v,{type:"textarea",modelValue:s.settings[S].text,"onUpdate:modelValue":M=>s.settings[S].text=M,disabled:s.settings[S].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)])):(d(!0),_(H,{key:1},ee(k,(M,$)=>(d(),_("div",{key:$,class:"fct-checkout-field"},[r("div",nfe,[r("div",sfe,[M.can_alter==="yes"?(d(),E(m,{key:0,modelValue:s.settings[S][$].enabled,"onUpdate:modelValue":F=>s.settings[S][$].enabled=F,"active-value":"yes","inactive-value":"no",disabled:o.isFirstNameDisabled(S,$)},null,8,["modelValue","onUpdate:modelValue","disabled"])):x("",!0),r("span",{class:de(["fct-checkout-field-label",o.shouldDimLabel(S,$)?"opacity-50":""])},h(M.label),3),o.isVisible(M,$)?(d(),_("div",lfe,[M.can_alter!=="yes"&&s.settings[S][$].enabled==="yes"?(d(),E(g,{key:0,size:"small"},{default:i(()=>[R(h(o.translate("System")),1)]),_:1})):x("",!0),s.settings[S][$].required==="yes"&&s.settings[S][$].enabled==="yes"?(d(),E(g,{key:1,size:"small"},{default:i(()=>[R(h(o.translate("Required")),1)]),_:1})):x("",!0)])):x("",!0)]),M.help_text?(d(),_("div",ofe,h(M.help_text),1)):x("",!0)]),M.can_alter==="yes"&&$!=="first_name"?(d(),_("div",rfe,[l(y,{modelValue:s.settings[S][$].required,"onUpdate:modelValue":F=>s.settings[S][$].required=F,"true-label":"yes","false-label":"no",disabled:s.settings[S][$].enabled!=="yes"},{default:i(()=>[R(h(o.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)]))),128))])]))),128))]),_:1})]),_:1}),r("div",ife,[l(w,{type:"primary",onClick:o.saveFields,loading:s.saving},{default:i(()=>[R(h(o.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const ufe=He(Kpe,[["render",dfe]]);var or={exports:{}};/* @license |
| 290 |
Papa Parse |
| 291 |
v5.5.3 |
| 292 |
https://github.com/mholt/PapaParse |
| 293 |
License: MIT |
| 294 |
*/var cfe=or.exports,IA;function Afe(){return IA||(IA=1,function(e,t){((a,n)=>{e.exports=n()})(cfe,function a(){var n=typeof self<"u"?self:typeof window<"u"?window:n!==void 0?n:{},s,o=!n.document&&!!n.postMessage,u=n.IS_PAPA_WORKER||!1,A={},f=0,m={};function g(D){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 I=L(U);I.chunkSize=parseInt(I.chunkSize),U.step||U.chunk||(I.chunkSize=null),this._handle=new w(I),(this._handle.streamer=this)._config=I}).call(this,D),this.parseChunk=function(U,I){var O=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<O){let K=this._config.newline;K||(P=this._config.quoteChar||'"',K=this._handle.guessLineEndings(U,P)),U=[...U.split(K).slice(O)].join(K)}this.isFirstChunk&&T(this._config.beforeFirstChunk)&&(P=this._config.beforeFirstChunk(U))!==void 0&&(U=P),this.isFirstChunk=!1,this._halted=!1;var O=this._partialLine+U,P=(this._partialLine="",this._handle.parse(O,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(U=P.meta.cursor,O=(this._finished||(this._partialLine=O.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),u)n.postMessage({results:P,workerId:m.WORKER_ID,finished:O});else if(T(this._config.chunk)&&!I){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||!O||!T(this._config.complete)||P&&P.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),O||P&&P.meta.paused||this._nextChunk(),P}this._halted=!0},this._sendError=function(U){T(this._config.error)?this._config.error(U):u&&this._config.error&&n.postMessage({workerId:m.WORKER_ID,error:U,finished:!1})}}function y(D){var U;(D=D||{}).chunkSize||(D.chunkSize=m.RemoteChunkSize),g.call(this,D),this._nextChunk=o?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(I){this._input=I,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(U=new XMLHttpRequest,this._config.withCredentials&&(U.withCredentials=this._config.withCredentials),o||(U.onload=Q(this._chunkLoaded,this),U.onerror=Q(this._chunkError,this)),U.open(this._config.downloadRequestBody?"POST":"GET",this._input,!o),this._config.downloadRequestHeaders){var I,O=this._config.downloadRequestHeaders;for(I in O)U.setRequestHeader(I,O[I])}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(K){this._chunkError(K.message)}o&&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>=(I=>(I=I.getResponseHeader("Content-Range"))!==null?parseInt(I.substring(I.lastIndexOf("/")+1)):-1)(U),this.parseChunk(U.responseText)))},this._chunkError=function(I){I=U.statusText||I,this._sendError(new Error(I))}}function v(D){(D=D||{}).chunkSize||(D.chunkSize=m.LocalChunkSize),g.call(this,D);var U,I,O=typeof FileReader<"u";this.stream=function(P){this._input=P,I=P.slice||P.webkitSlice||P.mozSlice,O?((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,K=(this._config.chunkSize&&(K=Math.min(this._start+this._config.chunkSize,this._input.size),P=I.call(P,this._start,K)),U.readAsText(P,this._config.encoding));O||this._chunkLoaded({target:{result:K}})},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 B(D){var U;g.call(this,D=D||{}),this.stream=function(I){return U=I,this._nextChunk()},this._nextChunk=function(){var I,O;if(!this._finished)return I=this._config.chunkSize,U=I?(O=U.substring(0,I),U.substring(I)):(O=U,""),this._finished=!U,this.parseChunk(O)}}function b(D){g.call(this,D=D||{});var U=[],I=!0,O=!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(){O&&U.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),U.length?this.parseChunk(U.shift()):I=!0},this._streamData=Q(function(P){try{U.push(typeof P=="string"?P:P.toString(this._config.encoding)),I&&(I=!1,this._checkIsFinished(),this.parseChunk(U.shift()))}catch(K){this._streamError(K)}},this),this._streamError=Q(function(P){this._streamCleanUp(),this._sendError(P)},this),this._streamEnd=Q(function(){this._streamCleanUp(),O=!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 w(D){var U,I,O,P,K=Math.pow(2,53),G=-K,ne=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Y=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,N=this,oe=0,Z=0,le=!1,te=!1,X=[],ie={data:[],errors:[],meta:{}};function be(De){return D.skipEmptyLines==="greedy"?De.join("").trim()==="":De.length===1&&De[0].length===0}function se(){if(ie&&O&&(pe("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+m.DefaultDelimiter+"'"),O=!1),D.skipEmptyLines&&(ie.data=ie.data.filter(function(we){return!be(we)})),ce()){let we=function(Ye,ft){T(D.transformHeader)&&(Ye=D.transformHeader(Ye,ft)),X.push(Ye)};if(ie)if(Array.isArray(ie.data[0])){for(var De=0;ce()&&De<ie.data.length;De++)ie.data[De].forEach(we);ie.data.splice(0,1)}else ie.data.forEach(we)}function $e(we,Ye){for(var ft=D.header?{}:[],Ge=0;Ge<we.length;Ge++){var _e=Ge,xe=we[Ge],xe=((Me,Fe)=>(nt=>(D.dynamicTypingFunction&&D.dynamicTyping[nt]===void 0&&(D.dynamicTyping[nt]=D.dynamicTypingFunction(nt)),(D.dynamicTyping[nt]||D.dynamicTyping)===!0))(Me)?Fe==="true"||Fe==="TRUE"||Fe!=="false"&&Fe!=="FALSE"&&((nt=>{if(ne.test(nt)&&(nt=parseFloat(nt),G<nt&&nt<K))return 1})(Fe)?parseFloat(Fe):Y.test(Fe)?new Date(Fe):Fe===""?null:Fe):Fe)(_e=D.header?Ge>=X.length?"__parsed_extra":X[Ge]:_e,xe=D.transform?D.transform(xe,_e):xe);_e==="__parsed_extra"?(ft[_e]=ft[_e]||[],ft[_e].push(xe)):ft[_e]=xe}return D.header&&(Ge>X.length?pe("FieldMismatch","TooManyFields","Too many fields: expected "+X.length+" fields but parsed "+Ge,Z+Ye):Ge<X.length&&pe("FieldMismatch","TooFewFields","Too few fields: expected "+X.length+" fields but parsed "+Ge,Z+Ye)),ft}var Je;ie&&(D.header||D.dynamicTyping||D.transform)&&(Je=1,!ie.data.length||Array.isArray(ie.data[0])?(ie.data=ie.data.map($e),Je=ie.data.length):ie.data=$e(ie.data,0),D.header&&ie.meta&&(ie.meta.fields=X),Z+=Je)}function ce(){return D.header&&X.length===0}function pe(De,$e,Je,we){De={type:De,code:$e,message:Je},we!==void 0&&(De.row=we),ie.errors.push(De)}T(D.step)&&(P=D.step,D.step=function(De){ie=De,ce()?se():(se(),ie.data.length!==0&&(oe+=De.data.length,D.preview&&oe>D.preview?I.abort():(ie.data=ie.data[0],P(ie,N))))}),this.parse=function(De,$e,Je){var we=D.quoteChar||'"',we=(D.newline||(D.newline=this.guessLineEndings(De,we)),O=!1,D.delimiter?T(D.delimiter)&&(D.delimiter=D.delimiter(De),ie.meta.delimiter=D.delimiter):((we=((Ye,ft,Ge,_e,xe)=>{var Me,Fe,nt,st;xe=xe||[","," ","|",";",m.RECORD_SEP,m.UNIT_SEP];for(var Ot=0;Ot<xe.length;Ot++){for(var Ct,yt=xe[Ot],Ze=0,Bt=0,ht=0,Ft=(nt=void 0,new S({comments:_e,delimiter:yt,newline:ft,preview:10}).parse(Ye)),kt=0;kt<Ft.data.length;kt++)Ge&&be(Ft.data[kt])?ht++:(Ct=Ft.data[kt].length,Bt+=Ct,nt===void 0?nt=Ct:0<Ct&&(Ze+=Math.abs(Ct-nt),nt=Ct));0<Ft.data.length&&(Bt/=Ft.data.length-ht),(Fe===void 0||Ze<=Fe)&&(st===void 0||st<Bt)&&1.99<Bt&&(Fe=Ze,Me=yt,st=Bt)}return{successful:!!(D.delimiter=Me),bestDelimiter:Me}})(De,D.newline,D.skipEmptyLines,D.comments,D.delimitersToGuess)).successful?D.delimiter=we.bestDelimiter:(O=!0,D.delimiter=m.DefaultDelimiter),ie.meta.delimiter=D.delimiter),L(D));return D.preview&&D.header&&we.preview++,U=De,I=new S(we),ie=I.parse(U,$e,Je),se(),le?{meta:{paused:!0}}:ie||{meta:{paused:!1}}},this.paused=function(){return le},this.pause=function(){le=!0,I.abort(),U=T(D.chunk)?"":U.substring(I.getCharIndex())},this.resume=function(){N.streamer._halted?(le=!1,N.streamer.parseChunk(U,!0)):setTimeout(N.resume,3)},this.aborted=function(){return te},this.abort=function(){te=!0,I.abort(),ie.meta.aborted=!0,T(D.complete)&&D.complete(ie),U=""},this.guessLineEndings=function(Ye,we){Ye=Ye.substring(0,1048576);var we=new RegExp(k(we)+"([^]*?)"+k(we),"gm"),Je=(Ye=Ye.replace(we,"")).split("\r"),we=Ye.split(` |
| 295 |
`),Ye=1<we.length&&we[0].length<Je[0].length;if(Je.length===1||Ye)return` |
| 296 |
`;for(var ft=0,Ge=0;Ge<Je.length;Ge++)Je[Ge][0]===` |
| 297 |
`&&ft++;return ft>=Je.length/2?`\r |
| 298 |
`:"\r"}}function k(D){return D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S(D){var U=(D=D||{}).delimiter,I=D.newline,O=D.comments,P=D.step,K=D.preview,G=D.fastMode,ne=null,Y=!1,N=D.quoteChar==null?'"':D.quoteChar,oe=N;if(D.escapeChar!==void 0&&(oe=D.escapeChar),(typeof U!="string"||-1<m.BAD_DELIMITERS.indexOf(U))&&(U=","),O===U)throw new Error("Comment character same as delimiter");O===!0?O="#":(typeof O!="string"||-1<m.BAD_DELIMITERS.indexOf(O))&&(O=!1),I!==` |
| 299 |
`&&I!=="\r"&&I!==`\r |
| 300 |
`&&(I=` |
| 301 |
`);var Z=0,le=!1;this.parse=function(te,X,ie){if(typeof te!="string")throw new Error("Input must be a string");var be=te.length,se=U.length,ce=I.length,pe=O.length,De=T(P),$e=[],Je=[],we=[],Ye=Z=0;if(!te)return Ze();if(G||G!==!1&&te.indexOf(N)===-1){for(var ft=te.split(I),Ge=0;Ge<ft.length;Ge++){if(we=ft[Ge],Z+=we.length,Ge!==ft.length-1)Z+=I.length;else if(ie)return Ze();if(!O||we.substring(0,pe)!==O){if(De){if($e=[],st(we.split(U)),Bt(),le)return Ze()}else st(we.split(U));if(K&&K<=Ge)return $e=$e.slice(0,K),Ze(!0)}}return Ze()}for(var _e=te.indexOf(U,Z),xe=te.indexOf(I,Z),Me=new RegExp(k(oe)+k(N),"g"),Fe=te.indexOf(N,Z);;)if(te[Z]===N)for(Fe=Z,Z++;;){if((Fe=te.indexOf(N,Fe+1))===-1)return ie||Je.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:$e.length,index:Z}),Ct();if(Fe===be-1)return Ct(te.substring(Z,Fe).replace(Me,N));if(N===oe&&te[Fe+1]===oe)Fe++;else if(N===oe||Fe===0||te[Fe-1]!==oe){_e!==-1&&_e<Fe+1&&(_e=te.indexOf(U,Fe+1));var nt=Ot((xe=xe!==-1&&xe<Fe+1?te.indexOf(I,Fe+1):xe)===-1?_e:Math.min(_e,xe));if(te.substr(Fe+1+nt,se)===U){we.push(te.substring(Z,Fe).replace(Me,N)),te[Z=Fe+1+nt+se]!==N&&(Fe=te.indexOf(N,Z)),_e=te.indexOf(U,Z),xe=te.indexOf(I,Z);break}if(nt=Ot(xe),te.substring(Fe+1+nt,Fe+1+nt+ce)===I){if(we.push(te.substring(Z,Fe).replace(Me,N)),yt(Fe+1+nt+ce),_e=te.indexOf(U,Z),Fe=te.indexOf(N,Z),De&&(Bt(),le))return Ze();if(K&&$e.length>=K)return Ze(!0);break}Je.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:$e.length,index:Z}),Fe++}}else if(O&&we.length===0&&te.substring(Z,Z+pe)===O){if(xe===-1)return Ze();Z=xe+ce,xe=te.indexOf(I,Z),_e=te.indexOf(U,Z)}else if(_e!==-1&&(_e<xe||xe===-1))we.push(te.substring(Z,_e)),Z=_e+se,_e=te.indexOf(U,Z);else{if(xe===-1)break;if(we.push(te.substring(Z,xe)),yt(xe+ce),De&&(Bt(),le))return Ze();if(K&&$e.length>=K)return Ze(!0)}return Ct();function st(ht){$e.push(ht),Ye=Z}function Ot(ht){var Ft=0;return Ft=ht!==-1&&(ht=te.substring(Fe+1,ht))&&ht.trim()===""?ht.length:Ft}function Ct(ht){return ie||(ht===void 0&&(ht=te.substring(Z)),we.push(ht),Z=be,st(we),De&&Bt()),Ze()}function yt(ht){Z=ht,st(we),we=[],xe=te.indexOf(I,Z)}function Ze(ht){if(D.header&&!X&&$e.length&&!Y){var Ft=$e[0],kt=Object.create(null),xt=new Set(Ft);let Ht=!1;for(let pt=0;pt<Ft.length;pt++){let da=Ft[pt];if(kt[da=T(D.transformHeader)?D.transformHeader(da,pt):da]){let ue,ve=kt[da];for(;ue=da+"_"+ve,ve++,xt.has(ue););xt.add(ue),Ft[pt]=ue,kt[da]++,Ht=!0,(ne=ne===null?{}:ne)[ue]=da}else kt[da]=1,Ft[pt]=da;xt.add(da)}Ht&&console.warn("Duplicate headers found and renamed."),Y=!0}return{data:$e,errors:Je,meta:{delimiter:U,linebreak:I,aborted:le,truncated:!!ht,cursor:Ye+(X||0),renamedHeaders:ne}}}function Bt(){P(Ze()),$e=[],Je=[]}},this.abort=function(){le=!0},this.getCharIndex=function(){return Z}}function M(D){var U=D.data,I=A[U.workerId],O=!1;if(U.error)I.userError(U.error,U.file);else if(U.results&&U.results.data){var P={abort:function(){O=!0,$(U.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:F,resume:F};if(T(I.userStep)){for(var K=0;K<U.results.data.length&&(I.userStep({data:U.results.data[K],errors:U.results.errors,meta:U.results.meta},P),!O);K++);delete U.results}else T(I.userChunk)&&(I.userChunk(U.results,P,U.file),delete U.results)}U.finished&&!O&&$(U.workerId,U.results)}function $(D,U){var I=A[D];T(I.userComplete)&&I.userComplete(U),I.terminate(),delete A[D]}function F(){throw new Error("Not implemented.")}function L(D){if(typeof D!="object"||D===null)return D;var U,I=Array.isArray(D)?[]:{};for(U in D)I[U]=L(D[U]);return I}function Q(D,U){return function(){D.apply(U,arguments)}}function T(D){return typeof D=="function"}return m.parse=function(D,U){var I=(U=U||{}).dynamicTyping||!1;if(T(I)&&(U.dynamicTypingFunction=I,I={}),U.dynamicTyping=I,U.transform=!!T(U.transform)&&U.transform,!U.worker||!m.WORKERS_SUPPORTED)return I=null,m.NODE_STREAM_INPUT,typeof D=="string"?(D=(O=>O.charCodeAt(0)!==65279?O:O.slice(1))(D),I=new(U.download?y:B)(U)):D.readable===!0&&T(D.read)&&T(D.on)?I=new b(U):(n.File&&D instanceof File||D instanceof Object)&&(I=new v(U)),I.stream(D);(I=(()=>{var O;return!!m.WORKERS_SUPPORTED&&(O=(()=>{var P=n.URL||n.webkitURL||null,K=a.toString();return m.BLOB_URL||(m.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; ","(",K,")();"],{type:"text/javascript"})))})(),(O=new n.Worker(O)).onmessage=M,O.id=f++,A[O.id]=O)})()).userStep=U.step,I.userChunk=U.chunk,I.userComplete=U.complete,I.userError=U.error,U.step=T(U.step),U.chunk=T(U.chunk),U.complete=T(U.complete),U.error=T(U.error),delete U.worker,I.postMessage({input:D,config:U,workerId:I.id})},m.unparse=function(D,U){var I=!1,O=!0,P=",",K=`\r |
| 302 |
`,G='"',ne=G+G,Y=!1,N=null,oe=!1,Z=((()=>{if(typeof U=="object"){if(typeof U.delimiter!="string"||m.BAD_DELIMITERS.filter(function(X){return U.delimiter.indexOf(X)!==-1}).length||(P=U.delimiter),typeof U.quotes!="boolean"&&typeof U.quotes!="function"&&!Array.isArray(U.quotes)||(I=U.quotes),typeof U.skipEmptyLines!="boolean"&&typeof U.skipEmptyLines!="string"||(Y=U.skipEmptyLines),typeof U.newline=="string"&&(K=U.newline),typeof U.quoteChar=="string"&&(G=U.quoteChar),typeof U.header=="boolean"&&(O=U.header),Array.isArray(U.columns)){if(U.columns.length===0)throw new Error("Option columns is empty");N=U.columns}U.escapeChar!==void 0&&(ne=U.escapeChar+G),U.escapeFormulae instanceof RegExp?oe=U.escapeFormulae:typeof U.escapeFormulae=="boolean"&&U.escapeFormulae&&(oe=/^[=+\-@\t\r].*$/)}})(),new RegExp(k(G),"g"));if(typeof D=="string"&&(D=JSON.parse(D)),Array.isArray(D)){if(!D.length||Array.isArray(D[0]))return le(null,D,Y);if(typeof D[0]=="object")return le(N||Object.keys(D[0]),D,Y)}else if(typeof D=="object")return typeof D.data=="string"&&(D.data=JSON.parse(D.data)),Array.isArray(D.data)&&(D.fields||(D.fields=D.meta&&D.meta.fields||N),D.fields||(D.fields=Array.isArray(D.data[0])?D.fields:typeof D.data[0]=="object"?Object.keys(D.data[0]):[]),Array.isArray(D.data[0])||typeof D.data[0]=="object"||(D.data=[D.data])),le(D.fields||[],D.data||[],Y);throw new Error("Unable to serialize unrecognized input");function le(X,ie,be){var se="",ce=(typeof X=="string"&&(X=JSON.parse(X)),typeof ie=="string"&&(ie=JSON.parse(ie)),Array.isArray(X)&&0<X.length),pe=!Array.isArray(ie[0]);if(ce&&O){for(var De=0;De<X.length;De++)0<De&&(se+=P),se+=te(X[De],De);0<ie.length&&(se+=K)}for(var $e=0;$e<ie.length;$e++){var Je=(ce?X:ie[$e]).length,we=!1,Ye=ce?Object.keys(ie[$e]).length===0:ie[$e].length===0;if(be&&!ce&&(we=be==="greedy"?ie[$e].join("").trim()==="":ie[$e].length===1&&ie[$e][0].length===0),be==="greedy"&&ce){for(var ft=[],Ge=0;Ge<Je;Ge++){var _e=pe?X[Ge]:Ge;ft.push(ie[$e][_e])}we=ft.join("").trim()===""}if(!we){for(var xe=0;xe<Je;xe++){0<xe&&!Ye&&(se+=P);var Me=ce&&pe?X[xe]:xe;se+=te(ie[$e][Me],xe)}$e<ie.length-1&&(!be||0<Je&&!Ye)&&(se+=K)}}return se}function te(X,ie){var be,se;return X==null?"":X.constructor===Date?JSON.stringify(X).slice(1,25):(se=!1,oe&&typeof X=="string"&&oe.test(X)&&(X="'"+X,se=!0),be=X.toString().replace(Z,ne),(se=se||I===!0||typeof I=="function"&&I(X,ie)||Array.isArray(I)&&I[ie]||((ce,pe)=>{for(var De=0;De<pe.length;De++)if(-1<ce.indexOf(pe[De]))return!0;return!1})(be,m.BAD_DELIMITERS)||-1<be.indexOf(P)||be.charAt(0)===" "||be.charAt(be.length-1)===" ")?G+be+G:be)}},m.RECORD_SEP="",m.UNIT_SEP="",m.BYTE_ORDER_MARK="\uFEFF",m.BAD_DELIMITERS=["\r",` |
| 303 |
`,'"',m.BYTE_ORDER_MARK],m.WORKERS_SUPPORTED=!o&&!!n.Worker,m.NODE_STREAM_INPUT=1,m.LocalChunkSize=10485760,m.RemoteChunkSize=5242880,m.DefaultDelimiter=",",m.Parser=S,m.ParserHandle=w,m.NetworkStreamer=y,m.FileStreamer=v,m.StringStreamer=B,m.ReadableStreamStreamer=b,n.jQuery&&((s=n.jQuery).fn.parse=function(D){var U=D.config||{},I=[];return this.each(function(K){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var G=0;G<this.files.length;G++)I.push({file:this.files[G],inputElem:this,instanceConfig:s.extend({},U)})}),O(),this;function O(){if(I.length===0)T(D.complete)&&D.complete();else{var K,G,ne,Y,N=I[0];if(T(D.before)){var oe=D.before(N.file,N.inputElem);if(typeof oe=="object"){if(oe.action==="abort")return K="AbortError",G=N.file,ne=N.inputElem,Y=oe.reason,void(T(D.error)&&D.error({name:K},G,ne,Y));if(oe.action==="skip")return void P();typeof oe.config=="object"&&(N.instanceConfig=s.extend(N.instanceConfig,oe.config))}else if(oe==="skip")return void P()}var Z=N.instanceConfig.complete;N.instanceConfig.complete=function(le){T(Z)&&Z(le,N.file,N.inputElem),P()},m.parse(N.file,N.instanceConfig)}}function P(){I.splice(0,1),O()}}),u&&(n.onmessage=function(D){D=D.data,m.WORKER_ID===void 0&&D&&(m.WORKER_ID=D.workerId),typeof D.input=="string"?n.postMessage({workerId:m.WORKER_ID,results:m.parse(D.input,D.config),finished:!0}):(n.File&&D.input instanceof File||D.input instanceof Object)&&(D=m.parse(D.input,D.config))&&n.postMessage({workerId:m.WORKER_ID,results:D,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(B.prototype=Object.create(B.prototype)).constructor=B,(b.prototype=Object.create(g.prototype)).constructor=b,m})}(or)),or.exports}var pfe=Afe();const TA=ph(pfe),ffe={class:"el-upload__text"},mfe={class:"fct-import-map-table-wrap"},hfe={class:"fct-import-map-heading"},_fe={class:"fct-import-map-table"},gfe={width:"50%"},vfe={class:"dialog-footer"},yfe={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=Qt().ctx,n=V(!1),s=V(),o=V(),u=V([]),A=V([]),f=V({}),m=V({}),g=V(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const B=V(!1),b=K=>{K&&TA.parse(K,{header:!0,complete:function(G){A.value=G.data,u.value=G.meta.fields,g.value=u.value.includes("Type")&&u.value.includes("Parent"),k(),g.value&&$(),B.value=!0}})},w=()=>{m.value={},u.value=[],A.value=[],B.value=!1,g.value=!1},k=()=>{const K=[],G=[];let ne=0;u.value.forEach(Y=>{let N=null,oe=null;const Z=Y.toString();for(const[le,te]of y.entries())if(Z.toLocaleLowerCase().startsWith(te)){const X=Y.toString().match(/ \d+ /g);if(Array.isArray(X)&&X.length===1){let ie=X[0];ne=ie>ne?ie:ne,N=Y.toString().replace(X[0]," %d "),oe=Y.toString().replace(X[0]," ");break}}N!=null?K.includes(N)||(K.push(N),G.push({title:oe,value:N})):G.push({title:Y,value:Y})}),m.value=G,v=ne},S=()=>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[K,G]of Object.entries(M))if(f.value[K]){for(const ne of G)if(u.value.includes(ne)){f.value[K].value=ne;break}}},F=K=>K?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[K.trim().toLowerCase()]||K:"",L=K=>{if(!K)return"";const G=K.split(",").map(ne=>ne.trim().toLowerCase());return G.includes("variation")?"variation":G.includes("variable")?"variable":G.includes("subscription")?"subscription":G.includes("simple")?"simple":G[0]||""},Q=(K=!0)=>{const G=[],ne={},Y=f.value,N={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"},oe=le=>{const te=[];for(let X=1;X<=10;X++){const ie=`Attribute ${X} name`,be=`Attribute ${X} value(s)`;le[ie]&&le[be]&&te.push(le[be])}return te.join(" - ")},Z=le=>le==="1"||le===1?"published":le==="0"||le===0?"draft":le||"published";A.value.forEach(le=>{var De,$e,Je,we,Ye,ft,Ge,_e,xe,Me,Fe,nt,st,Ot,Ct,yt,Ze,Bt,ht,Ft;const te=L(le.Type);if(te!=="simple"&&te!=="variable"&&te!=="subscription")return;const X={};X._cid=rn(),X.post_title=le[(De=Y.post_title)==null?void 0:De.value]||"",X.post_name=le[($e=Y.post_name)==null?void 0:$e.value]||X.post_title,X.ID=le[(Je=Y.post_id)==null?void 0:Je.value]||"",X.post_content=le[(we=Y.post_content)==null?void 0:we.value]||"",X.post_excerpt=le[(Ye=Y.post_excerpt)==null?void 0:Ye.value]||"",X.post_status=Z(le[(ft=Y.post_status)==null?void 0:ft.value]);const ie={variation_type:te==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},be=le[(Ge=Y.images)==null?void 0:Ge.value]||"",se=[];be&&be.split(",").map(kt=>kt.trim()).filter(Boolean).forEach(kt=>{const xt=kt.split("/").pop().split("?")[0]||"image";se.push({id:0,url:kt,title:xt})}),X.detail=ie,X.gallery=se,X.variants=[];const ce=le[(_e=Y.categories)==null?void 0:_e.value]||"";if(ce?X.categories=ce.split(",").map(kt=>kt.trim()).filter(Boolean):X.categories=[],te==="simple"||te==="subscription"){const kt=le[(xe=Y.item_price)==null?void 0:xe.value]||"",xt=le[(Me=Y.compare_price)==null?void 0:Me.value]||"",Ht=le[(Fe=Y.sku)==null?void 0:Fe.value]||"",pt=te==="subscription"?"subscription":le[(nt=Y.payment_type)==null?void 0:nt.value]||"onetime",da=F(le[(st=Y.repeat_interval)==null?void 0:st.value]||""),ue=le[(Ot=Y.trial_days)==null?void 0:Ot.value]||"",ve=le[(Ct=Y.installment)==null?void 0:Ct.value]||"",We=le[(yt=Y.installment_count)==null?void 0:yt.value]||"",_t=le[(Ze=Y.manage_setup_fee)==null?void 0:Ze.value]||"",rt=le[(Bt=Y.signup_fee_name)==null?void 0:Bt.value]||"",Wt=le[(ht=Y.signup_fee)==null?void 0:ht.value]||"";(kt||X.post_title)&&X.variants.push({_cid:rn(),variation_title:X.post_title,sku:Ht,item_price:kt,compare_price:xt,other_info:{...N,payment_type:pt,repeat_interval:da,trial_days:ue,installment:ve==="yes"?"yes":"no",times:We,manage_setup_fee:_t==="yes"?"yes":"no",signup_fee_name:rt,signup_fee:Wt},media:[]})}const pe=le[(Ft=Y.sku)==null?void 0:Ft.value]||"";te==="variable"&&pe&&(ne[pe]=X),G.push(X)}),A.value.forEach(le=>{var Me,Fe,nt,st,Ot,Ct,yt,Ze,Bt,ht,Ft,kt;if(L(le.Type)!=="variation")return;const te=le.Parent;if(!te||!ne[te])return;const X=oe(le),ie=le[(Me=Y.item_price)==null?void 0:Me.value]||"",be=le[(Fe=Y.compare_price)==null?void 0:Fe.value]||"",se=le[(nt=Y.images)==null?void 0:nt.value]||"",ce=[];se&&se.split(",").map(xt=>xt.trim()).filter(Boolean).forEach(xt=>{const Ht=xt.split("/").pop().split("?")[0]||"image";ce.push({id:0,url:xt,title:Ht})});const pe=le[(st=Y.sku)==null?void 0:st.value]||"",De=le[(Ot=Y.payment_type)==null?void 0:Ot.value]||"onetime",$e=F(le[(Ct=Y.repeat_interval)==null?void 0:Ct.value]||""),Je=le[(yt=Y.trial_days)==null?void 0:yt.value]||"",we=le[(Ze=Y.installment)==null?void 0:Ze.value]||"",Ye=le[(Bt=Y.installment_count)==null?void 0:Bt.value]||"",ft=le[(ht=Y.manage_setup_fee)==null?void 0:ht.value]||"",Ge=le[(Ft=Y.signup_fee_name)==null?void 0:Ft.value]||"",_e=le[(kt=Y.signup_fee)==null?void 0:kt.value]||"",xe={_cid:rn(),variation_title:X||le.Name||"",sku:pe,item_price:ie,compare_price:be,other_info:{...N,payment_type:De,repeat_interval:$e,trial_days:Je,installment:we==="yes"?"yes":"no",times:Ye,manage_setup_fee:ft==="yes"?"yes":"no",signup_fee_name:Ge,signup_fee:_e},media:ce};ne[te].variants.push(xe)}),P("onDataPopulated",{products:G,concat:K})},T=(K=!0)=>{if(g.value)return Q(K);const G=[];A.value.forEach(ne=>{var Ye,ft,Ge,_e,xe,Me,Fe,nt,st,Ot,Ct,yt;const Y={};Y._cid=rn();const N=f.value;Y.post_title=ne[N.post_title.value]??"",Y.post_name=ne[N.post_name.value]??Y.post_title,Y.ID=ne[N.post_id.value]??"",Y.post_content=ne[N.post_content.value]??"",Y.post_excerpt=ne[N.post_excerpt.value]??"",Y.post_status=ne[(Ye=N.post_status)==null?void 0:Ye.value]||"published",Y.comment_status="close";const oe=ne[(ft=N.images)==null?void 0:ft.value]||"",Z=[];oe&&oe.split(",").map(Ze=>Ze.trim()).filter(Boolean).forEach(Ze=>{const Bt=Ze.split("/").pop().split("?")[0]||"image";Z.push({id:0,url:Ze,title:Bt})});const le=ne[(Ge=N.categories)==null?void 0:Ge.value]||"";le?Y.categories=le.split(",").map(Ze=>Ze.trim()).filter(Boolean):Y.categories=[];const te=ne[(_e=N.sku)==null?void 0:_e.value]||"",X=ne[(xe=N.payment_type)==null?void 0:xe.value]||"onetime",ie=ne[(Me=N.repeat_interval)==null?void 0:Me.value]||"",be=ne[(Fe=N.trial_days)==null?void 0:Fe.value]||"",se=ne[(nt=N.installment)==null?void 0:nt.value]||"",ce=ne[(st=N.installment_count)==null?void 0:st.value]||"",pe=ne[(Ot=N.manage_setup_fee)==null?void 0:Ot.value]||"",De=ne[(Ct=N.signup_fee_name)==null?void 0:Ct.value]||"",$e=ne[(yt=N.signup_fee)==null?void 0:yt.value]||"",Je={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},we={description:"",payment_type:X,times:ce,repeat_interval:ie,trial_days:be,billing_summary:"",manage_setup_fee:pe==="yes"?"yes":"no",signup_fee_name:De,signup_fee:$e,setup_fee_per_item:"no",installment:se==="yes"?"yes":"no"};Y.gallery=Z,Y.variants=[];for(let Ze=1;Ze<=v;Ze++){const Bt={};["variation_title","item_price","compare_price"].forEach(ht=>{var kt;const Ft=((kt=N[ht])==null?void 0:kt.value)??"";if(Ft.length>0){const xt=Ft.replace("%d",Ze.toString());Bt[ht]=ne[xt]}}),I(Bt)&&(Bt._cid=rn(),Bt.sku=te,Bt.other_info={...we},Bt.media=[],Y.variants.push(Bt))}Y.variants.length>0?(Je.variation_type="simple_variations",Y.detail=Je,G.push(Y)):I(Y)&&(Y.variants.push({_cid:rn(),variation_title:"",sku:te,item_price:0,compare_price:0,other_info:{...we},media:[]}),Y.detail=Je,G.push(Y))}),P("onDataPopulated",{products:G,concat:K})},D=()=>{n.value=!1,s.value=[],o.value=null,w()},U=(K=!0)=>{T(K),D()},I=K=>{let G=!1;for(const[ne,Y]of Object.entries(K))if(typeof Y!==null&&typeof Y<"u"&&(Array.isArray(Y)&&Y.length>0||Y.toString().length>0)){G=!0;break}return G};Be(()=>{f.value={post_id:{title:a.$t("Post ID"),value:""},post_title:{title:a.$t("Post Title"),value:""},post_name:{title:a.$t("Post Name"),value:""},post_content:{title:a.$t("Post Content"),value:""},post_excerpt:{title:a.$t("Post Excerpt"),value:""},post_status:{title:a.$t("Post Status"),value:""},post_date:{title:a.$t("Post Date"),value:""},comment_status:{title:a.$t("Comment Status"),value:""},images:{title:a.$t("Images"),value:""},variation_title:{title:a.$t("Variation Title"),value:""},item_price:{title:a.$t("Variation Price"),value:""},compare_price:{title:a.$t("Variation Compare Price"),value:""},sku:{title:a.$t("SKU"),value:""},categories:{title:a.$t("Categories"),value:""},payment_type:{title:a.$t("Payment Type"),value:""},repeat_interval:{title:a.$t("Subscription Interval"),value:""},trial_days:{title:a.$t("Trial Days"),value:""},installment:{title:a.$t("Installment"),value:""},installment_count:{title:a.$t("Installment Count"),value:""},manage_setup_fee:{title:a.$t("Setup Fee"),value:""},signup_fee_name:{title:a.$t("Setup Fee Name"),value:""},signup_fee:{title:a.$t("Setup Fee Amount"),value:""}}});const O=()=>{const K=[{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":""}],G=TA.unparse(K),ne=new Blob([G],{type:"text/csv;charset=utf-8;"}),Y=URL.createObjectURL(ne),N=document.createElement("a");N.href=Y,N.download="fluent-cart-sample-import.csv",document.body.appendChild(N),N.click(),document.body.removeChild(N),URL.revokeObjectURL(Y)},P=t;return(K,G)=>{const ne=C("el-button"),Y=C("el-upload"),N=C("el-option"),oe=C("el-select"),Z=C("el-dialog");return d(),_(H,null,[l(ne,{onClick:G[0]||(G[0]=le=>n.value=!0)},{default:i(()=>[R(h(K.$t("Import")),1)]),_:1}),l(Z,{modelValue:n.value,"onUpdate:modelValue":G[4]||(G[4]=le=>n.value=le),"append-to-body":!0,title:K.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:i(()=>[B.value?x("",!0):(d(),E(Y,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":G[1]||(G[1]=le=>s.value=le),drag:"",action:S(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":le=>{w(),o.value=le,b(le==null?void 0:le.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:i(()=>[l(Oe,{circle:"",bg:"primary",soft:""},{default:i(()=>[l(W,{name:"Upload"})]),_:1}),r("div",ffe,[R(h(K.$t("Drag & Drop or"))+" ",1),r("em",null,h(K.$t("Browse/Upload")),1),R(" "+h(K.$t("Files"))+" ",1),r("span",null,h(p(c)("Any Format upto %s",p(vt).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),B.value?x("",!0):(d(),E(ne,{key:1,onClick:O,link:""},{default:i(()=>[l(W,{name:"Download"}),R(" "+h(K.$t("Download a Sample CSV File")),1)]),_:1})),B.value?(d(),_(H,{key:2},[r("div",mfe,[r("h4",hfe,h(K.$t("Map Columns")),1),r("table",_fe,[r("thead",null,[r("tr",null,[r("th",null,h(K.$t("Products Fields")),1),r("th",null,h(K.$t("CSV Headers")),1)])]),r("tbody",null,[(d(!0),_(H,null,ee(f.value,(le,te)=>(d(),_("tr",null,[r("td",null,h(le.title),1),r("td",gfe,[l(oe,{modelValue:le.value,"onUpdate:modelValue":X=>le.value=X,filterable:"",clearable:""},{default:i(()=>[(d(!0),_(H,null,ee(m.value,X=>(d(),E(N,{key:X.value,label:X.title,value:X.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),r("div",vfe,[l(ne,{onClick:G[2]||(G[2]=le=>U())},{default:i(()=>[R(h(K.$t("Add Products")),1)]),_:1}),l(ne,{onClick:G[3]||(G[3]=le=>U(!1))},{default:i(()=>[R(h(K.$t("Clear and Add Products")),1)]),_:1})])],64)):x("",!0)]),_:1},8,["modelValue","title"])],64)}}};class bfe extends Uu{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=rn(),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(n=>!n.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 n=this.data.productErrors.get(t);if(!(n!=null&&n.fields))return!1;const s=`variants.${a}.`;return Object.keys(n.fields).some(o=>o.startsWith(s))}getVariantError(t,a){const n=this.data.productErrors.get(t);if(!(n!=null&&n.fields))return"";const s=`variants.${a}.`;return Object.entries(n.fields).filter(([u])=>u.startsWith(s)).map(([,u])=>u).join("; ")}hasFieldError(t,a){var s;const n=this.data.productErrors.get(t);return!!((s=n==null?void 0:n.fields)!=null&&s[a])}hasVariantFieldError(t,a,n){return this.hasFieldError(t,`variants.${a}.${n}`)}chunkArray(t,a){const n=[];for(let s=0;s<t.length;s+=a)n.push(t.slice(s,s+a));return n}async saveProducts(){var s,o;const t=this.data.products,a=t.filter(u=>!this.data.savedIds.has(u._cid));if(a.length===0){q.error("No products to save.");return}const n=this.chunkArray(a,10);this.data.saving=!0,this.data.productErrors=new Map,this.data.saveProgress={total:n.length,completed:0,errors:[],createdIds:[]};try{for(const f of n){const m=f.map(g=>g._cid);for(const g of m)this.data.savingIds.add(g);this.data.savingIds=new Set(this.data.savingIds);try{const g=await re.post("products/bulk-insert",{products:f});if(g.created&&g.created.length){this.data.saveProgress.createdIds.push(...g.created);for(const y of g.created){this.data.savedIds.add(y._cid);const v=t.find(B=>B._cid===y._cid);v&&(v.ID=y.id,v.view_url=y.view_url||"")}this.data.savedIds=new Set(this.data.savedIds)}if(g.errors&&g.errors.length){this.data.saveProgress.errors.push(...g.errors);for(const y of g.errors)y._cid&&this.data.productErrors.set(y._cid,{message:y.message,fields:y.fields||{}});this.data.productErrors=new Map(this.data.productErrors)}}catch(g){const y=(s=g==null?void 0:g.data)==null?void 0:s.errors;if(Array.isArray(y)&&y.length){this.data.saveProgress.errors.push(...y);for(const v of y)v._cid&&this.data.productErrors.set(v._cid,{message:v.message,fields:v.fields||{}})}else{const v=((o=g==null?void 0:g.data)==null?void 0:o.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:v});for(const B of m)this.data.productErrors.set(B,{message:v,fields:{}})}this.data.productErrors=new Map(this.data.productErrors)}for(const g of m)this.data.savingIds.delete(g);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{createdIds:u,errors:A}=this.data.saveProgress;A.length===0?q.success(`${u.length} product(s) created successfully`):u.length>0?q.info(`${u.length} product(s) created, ${A.length} error(s)`):q.error("All products failed to save")}finally{this.data.saving=!1}}async removeProduct(t){var n;if(t.ID&&this.data.savedIds.has(t._cid)){try{await re.delete(`products/${t.ID}`)}catch(s){const o=((n=s==null?void 0:s.data)==null?void 0:n.message)||"Failed to delete product from server";q.error(o);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 n=t.variants.indexOf(a);n!==-1&&t.variants.splice(n,1)}duplicateProduct(t){const a=JSON.parse(JSON.stringify(t));a._cid=rn(),a.post_title=a.post_title?a.post_title+" (Copy)":"",a.variants&&Array.isArray(a.variants)&&a.variants.forEach(s=>{s.sku="",s._cid=rn()});const n=this.data.products.indexOf(t);this.data.products.splice(n+1,0,a)}duplicateProductWithVariants(t,a){const n=JSON.parse(JSON.stringify(t));if(n._cid=rn(),n.post_title=n.post_title?n.post_title+" (Copy)":"",n.variants&&Array.isArray(n.variants)){const o=new Set(a);n.variants=n.variants.filter((u,A)=>o.has(A)),n.variants.forEach(u=>{u.sku="",u._cid=rn()})}const s=this.data.products.indexOf(t);this.data.products.splice(s+1,0,n)}duplicateVariant(t,a){const n=JSON.parse(JSON.stringify(a));n._cid=rn(),n.variation_title=n.variation_title?n.variation_title+" (Copy)":"",n.sku="";const s=t.variants.indexOf(a);t.variants.splice(s+1,0,n)}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 n=[];for(const o of t){const u=a?`${a} > ${o.label}`:o.label;n.push({label:u,value:u}),(s=o.children)!=null&&s.length&&n.push(...this.flattenCategoryTree(o.children,u))}return n}async fetchCategories(){try{const a=(await re.get("products/fetch-term")).taxonomies||{},n=Object.values(a).find(s=>s.name==="product-categories");n!=null&&n.terms&&(this.data.categoryOptions=this.flattenCategoryTree(n.terms))}catch{}}}const ot=bfe.init(),wfe={class:"max-w-full overflow-x-scroll"},Cfe={class:"relative"},Bfe={key:0,class:"bulk-checkbox-cell"},kfe=["onMousedown","onTouchstart"],Cm={__name:"ResizeableColumns",props:{columns:{type:Array,required:!0},stickyLast:{type:Boolean,default:!1}},emits:["scroll","resize-end"],setup(e,{emit:t}){const a=t,n=Xm(),s=zd("table"),o=V(null);let u=null;Be(()=>{ye(()=>{const g=s.value.querySelectorAll("th"),y=n["header-first"]?1:0;Array.from(g).forEach((v,B)=>{const b=B-y;b<0||b>=A.columns.length||(A.columns[b].width=v.offsetWidth,A.columns[b].minWidth||(A.columns[b].minWidth=v.offsetWidth))}),u=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")}),u.observe(s.value)})}),xn(()=>{u&&u.disconnect()});const A=e,f=j(()=>{const g=n["header-first"]?40:0;return A.columns.reduce((y,v)=>y+v.width,0)+g}),m=(g,y)=>{g.preventDefault();const v=g.clientX,B=A.columns[y].width,b=A.columns[y].minWidth||50;o.value=y;const w=S=>{const M=B+(S.clientX-v);M>=b&&(A.columns[y].width=M)},k=()=>{o.value=null,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",k),a("resize-end")};document.addEventListener("mousemove",w),document.addEventListener("mouseup",k)};return(g,y)=>(d(),_("div",wfe,[r("div",{class:de(["resizable-table",{"is-resizing":o.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[r("div",Cfe,[r("table",{id:"tb",ref_key:"table",ref:s,style:ia({tableLayout:"fixed",width:f.value+"px"})},[r("thead",null,[r("tr",null,[g.$slots["header-first"]?(d(),_("th",Bfe,[oa(g.$slots,"header-first")])):x("",!0),(d(!0),_(H,null,ee(e.columns,(v,B)=>(d(),_("th",{class:de({"sticky-col":B===0,"sticky-col sticky-col-right":B===e.columns.length-1&&e.stickyLast}),style:ia({width:v.width+"px",zIndex:B===0||B===e.columns.length-1&&e.stickyLast?70:e.columns.length-B+50,left:B===0&&g.$slots["header-first"]?"40px":B===0?"0px":void 0}),key:v.key||B},[B===e.columns.length-1?oa(g.$slots,"header-last",{key:0},()=>[R(h(v.title),1)]):(d(),_(H,{key:1},[R(h(v.title),1)],64)),B<e.columns.length-1?(d(),_("span",{key:2,class:de(["resizer",{"is-active":o.value===B}]),onMousedown:b=>m(b,B),onTouchstart:b=>m(b,B)},null,42,kfe)):x("",!0)],6))),128))])]),r("tbody",null,[oa(g.$slots,"default")])],4)])],34)]))}},xfe={class:"bulk-setup-fee-badge"},Sfe={key:1,class:"text-gray-300 text-sm flex justify-center"},$r={__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(n,s)=>{var A;const o=C("el-tooltip"),u=C("el-input");return e.variant?(d(),E(u,{key:0,size:"small",class:de({"is-error":e.hasError}),modelValue:e.variant.item_price,"onUpdate:modelValue":s[0]||(s[0]=f=>e.variant.item_price=f),placeholder:n.$t("Price"),type:"number",disabled:e.disabled,onInput:s[1]||(s[1]=f=>a("change"))},Rt({_:2},[((A=e.variant.other_info)==null?void 0:A.manage_setup_fee)==="yes"&&e.variant.other_info.signup_fee?{name:"suffix",fn:i(()=>[l(o,{content:(e.variant.other_info.signup_fee_name||n.$t("Setup fee"))+": "+n.currencySign()+e.variant.other_info.signup_fee,placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[r("span",xfe,"+ "+h(n.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["class","modelValue","placeholder","disabled"])):(d(),_("span",Sfe,"—"))}}},Ffe=["disabled"],Efe={key:0,class:"fct-bulk-sub-count"},Ufe={class:"fct-bulk-sub-popover-body"},$fe={class:"fct-bulk-sub-popover-title"},Dfe={class:"fct-bulk-sub-section"},Qfe={class:"fct-bulk-sub-row"},Ife={class:"fct-bulk-sub-row"},Tfe={class:"fct-bulk-sub-label"},Vfe={class:"fct-bulk-sub-row"},Mfe={class:"fct-bulk-sub-label"},Lfe=["innerHTML"],Rfe={class:"fct-bulk-sub-section"},Ofe={class:"fct-bulk-sub-row"},Hfe={class:"fct-bulk-sub-row"},Pfe={class:"fct-bulk-sub-label"},Nfe={class:"fct-bulk-sub-row"},Kfe={class:"fct-bulk-sub-label"},Gfe=["innerHTML"],jfe={class:"fct-bulk-sub-footer"},zfe={__name:"BulkSubscriptionPopover",props:{variant:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:["changed"],setup(e,{emit:t}){const a=e,n=t,s=Qt().ctx,o=Ie.get(),u=Ie.get("app_config.isProActive"),A=V(!1),f=j(()=>{var $;return(($=o==null?void 0:o.shop)==null?void 0:$.currency_sign)||"$"}),m=j(()=>{var $;return(($=a.variant)==null?void 0:$.other_info)||{}}),g=j(()=>m.value.payment_type==="subscription"),y=j(()=>m.value.installment==="yes"),v=j(()=>Number(m.value.times)||1),B=j(()=>{var F;const $=Number((F=a.variant)==null?void 0:F.item_price)||0;return y.value?$*v.value:$}),b=j(()=>{const $=[];if(y.value&&$.push(s.$t("Installment")+": "+v.value+"x"),m.value.manage_setup_fee==="yes"){const F=m.value.signup_fee_name||s.$t("Setup fee"),L=m.value.signup_fee||0;$.push(s.$t("Setup fee")+": "+F+" ("+f.value+L+")")}return $.length>0?$.join(` |
| 304 |
`):s.$t("Subscription settings")}),w=$=>{$==="no"?a.variant.other_info.times="":a.variant.other_info.times||(a.variant.other_info.times=1),n("changed")},k=$=>{$==="no"&&(a.variant.other_info.signup_fee=""),n("changed")},S=()=>{n("changed")},M=()=>{A.value=!1};return($,F)=>{const L=C("el-checkbox"),Q=C("el-tooltip"),T=C("el-input"),D=C("el-switch"),U=C("el-button"),I=C("el-popover");return d(),E(Q,{content:b.value,placement:"top",disabled:!g.value||A.value,"popper-class":"fct-tooltip","show-after":400},{default:i(()=>[l(I,{visible:A.value,"onUpdate:visible":F[6]||(F[6]=O=>A.value=O),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!g.value,"popper-class":"bulk-sub-popover"},{reference:i(()=>[r("button",{class:de(["fc-bulk-sub-icon-btn",{"is-active":g.value,"is-configured":g.value&&(y.value||m.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!g.value,onClick:F[0]||(F[0]=Xe(()=>{},["prevent"]))},[F[7]||(F[7]=r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[r("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?(d(),_("span",Efe,h(v.value),1)):x("",!0)],10,Ffe)]),default:i(()=>[r("div",Ufe,[r("h4",$fe,h($.$t("Subscription Settings")),1),r("div",Dfe,[r("div",Qfe,[l(L,{"true-value":"yes","false-value":"no",label:$.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":F[1]||(F[1]=O=>e.variant.other_info.installment=O),disabled:!p(u)||e.disabled,onChange:w},null,8,["label","modelValue","disabled"]),p(u)?x("",!0):(d(),E(Q,{key:0,"popper-class":"fct-tooltip"},{content:i(()=>[R(h($.$t("This feature is available in pro version only.")),1)]),default:i(()=>[l(W,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.installment==="yes"?(d(),_(H,{key:0},[r("div",Ife,[r("label",Tfe,h($.$t("Installment Count")),1),l(T,{type:"number",min:1,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":F[2]||(F[2]=O=>e.variant.other_info.times=O),modelModifiers:{number:!0},placeholder:$.$t("Count"),style:{width:"100px"},onInput:S},null,8,["modelValue","placeholder"])]),r("div",Vfe,[r("span",Mfe,h($.$t("Total Price")),1),r("span",{class:"fct-bulk-sub-value",innerHTML:f.value+B.value},null,8,Lfe)])],64)):x("",!0)]),r("div",Rfe,[r("div",Ofe,[l(D,{"active-text":$.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":F[3]||(F[3]=O=>e.variant.other_info.manage_setup_fee=O),"active-value":"yes","inactive-value":"no",disabled:!p(u)||e.disabled,size:"small",onChange:k},null,8,["active-text","modelValue","disabled"]),p(u)?x("",!0):(d(),E(Q,{key:0,"popper-class":"fct-tooltip"},{content:i(()=>[R(h($.$t("This feature is available in pro version only.")),1)]),default:i(()=>[l(W,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.manage_setup_fee==="yes"?(d(),_(H,{key:0},[r("div",Hfe,[r("label",Pfe,h($.$t("Label")),1),l(T,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":F[4]||(F[4]=O=>e.variant.other_info.signup_fee_name=O),placeholder:$.$t("e.g. Initial Setup"),onInput:S},null,8,["modelValue","placeholder"])]),r("div",Nfe,[r("label",Kfe,h($.$t("Amount")),1),l(T,{size:"small",type:"number",min:0,modelValue:e.variant.other_info.signup_fee,"onUpdate:modelValue":F[5]||(F[5]=O=>e.variant.other_info.signup_fee=O),modelModifiers:{number:!0},placeholder:$.$t("Amount"),onInput:S},{prefix:i(()=>[r("span",{innerHTML:f.value},null,8,Gfe)]),_:1},8,["modelValue","placeholder"])])],64)):x("",!0)]),r("div",jfe,[l(U,{size:"small",type:"primary",onClick:M},{default:i(()=>[R(h($.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},Yfe={key:0,class:"flex items-center"},qfe={key:1,class:"text-gray-300 text-sm flex justify-center"},Dr={__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,n=t,s=()=>{var o;return(o=a.variant)==null?void 0:o.other_info};return(o,u)=>{const A=C("el-option"),f=C("el-select");return e.variant&&s()?(d(),_("div",Yfe,[l(f,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":u[0]||(u[0]=m=>e.variant.other_info.payment_type=m),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:u[1]||(u[1]=m=>n("payment-type-change",e.variant))},{default:i(()=>[l(A,{label:o.$t("One Time"),value:"onetime"},null,8,["label"]),l(A,{label:o.$t("Subscription"),value:"subscription"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"]),l(zfe,{variant:e.variant,disabled:e.disabled,onChanged:u[2]||(u[2]=m=>n("change"))},null,8,["variant","disabled"])])):(d(),_("span",qfe,"—"))}}},Wfe={key:1,class:"text-gray-300 text-sm flex justify-center"},Qr={__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,n=t,s=()=>{var o,u;return((u=(o=a.variant)==null?void 0:o.other_info)==null?void 0:u.payment_type)==="subscription"};return(o,u)=>{const A=C("el-option"),f=C("el-select");return e.variant&&s()?(d(),E(f,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":u[0]||(u[0]=m=>e.variant.other_info.repeat_interval=m),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:u[1]||(u[1]=m=>n("change"))},{default:i(()=>[l(A,{label:o.$t("Yearly"),value:"yearly"},null,8,["label"]),l(A,{label:o.$t("Half Yearly"),value:"half_yearly"},null,8,["label"]),l(A,{label:o.$t("Quarterly"),value:"quarterly"},null,8,["label"]),l(A,{label:o.$t("Monthly"),value:"monthly"},null,8,["label"]),l(A,{label:o.$t("Weekly"),value:"weekly"},null,8,["label"]),l(A,{label:o.$t("Daily"),value:"daily"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"])):(d(),_("span",Wfe,"—"))}}},Xfe={key:1,class:"text-gray-300 text-sm flex justify-center"},Ir={__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,n=t,s=()=>{var o,u;return((u=(o=a.variant)==null?void 0:o.other_info)==null?void 0:u.payment_type)==="subscription"};return(o,u)=>{const A=C("el-input");return e.variant&&s()?(d(),E(A,{key:0,class:de(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":u[0]||(u[0]=f=>e.variant.other_info.trial_days=f),placeholder:"0",disabled:e.disabled,onChange:u[1]||(u[1]=f=>n("change")),size:"small"},null,8,["class","modelValue","disabled"])):(d(),_("span",Xfe,"—"))}}},Jfe={key:1,class:"text-gray-300 text-sm flex justify-center"},Tr={__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(n,s)=>{const o=C("el-input");return e.variant?(d(),E(o,{key:0,size:"small",class:de({"is-error":e.hasError}),modelValue:e.variant.compare_price,"onUpdate:modelValue":s[0]||(s[0]=u=>e.variant.compare_price=u),placeholder:n.$t("Compare price"),disabled:e.disabled,onInput:s[1]||(s[1]=u=>a("change"))},null,8,["class","modelValue","placeholder","disabled"])):(d(),_("span",Jfe,"—"))}}},Bm={__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,n=s=>{a("update:modelValue",s),a("change",s)};return(s,o)=>{const u=C("el-option"),A=C("el-select");return d(),E(A,{"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":n},{default:i(()=>[(d(!0),_(H,null,ee(e.options,f=>(d(),E(u,{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},Zfe=["textContent"],eme={key:1,class:"fct-bulk-editor-placeholder"},Vr={__name:"BulkEditorCell",props:{value:{type:String,default:""},placeholder:{type:String,default:""}},emits:["click"],setup(e){return(t,a)=>(d(),_("div",{class:"fct-bulk-editor",onClick:a[0]||(a[0]=n=>t.$emit("click"))},[e.value?(d(),_("span",{key:0,class:"bulk-editor-preview",textContent:h(e.value)},null,8,Zfe)):(d(),_("span",eme,h(e.placeholder),1))]))}};function km(){const e=V(new Set),t=V(null),a=V(!1),n=(y,v,B)=>{if(v.shiftKey&&t.value!==null){const w=B.indexOf(t.value),k=B.indexOf(y);if(w!==-1&&k!==-1){const S=Math.min(w,k),M=Math.max(w,k),$=new Set(e.value);for(let F=S;F<=M;F++)$.add(B[F]);e.value=$}}else{const w=new Set(e.value);w.has(y)?w.delete(y):w.add(y),e.value=w,t.value=y}},s=y=>{e.value.size===y.length&&y.length>0?e.value=new Set:e.value=new Set(y)},o=y=>{e.value=new Set(y)},u=()=>{e.value=new Set,t.value=null,a.value=!1},A=()=>{a.value?a.value=!1:e.value.size>=2&&(a.value=!0)};ge(e,y=>{a.value&&y.size<2&&(a.value=!1)});const f=y=>e.value.has(y),m=j(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:n,toggleSelectAll:s,selectAll:o,deselectAll:u,toggleLinkMode:A,isSelected:f,selectedCount:m,pruneStaleKeys:y=>{const v=new Set(y);let B=!1;const b=new Set;for(const w of e.value)v.has(w)?b.add(w):B=!0;B&&(e.value=b),t.value&&!v.has(t.value)&&(t.value=null)}}}const tme={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},xm={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,n;return(n=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:n.payment_type},set:(e,t)=>{var a,n;(n=(a=e.variants)==null?void 0:a[0])!=null&&n.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,n;return(n=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:n.repeat_interval},set:(e,t)=>{var a,n;(n=(a=e.variants)==null?void 0:a[0])!=null&&n.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,n;return(n=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:n.trial_days},set:(e,t)=>{var a,n;(n=(a=e.variants)==null?void 0:a[0])!=null&&n.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]}}},ame={...xm,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}}},nme={...xm,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 Sm(e,t,a,n,s,o,u){const A=u[e];if(A)for(const f of n){if(f===a)continue;const m=s(f);if(!m)continue;const g=A[m.type];g&&(g.set(m.data,t),o&&o(m.product))}}const sme={class:"fct-bulk-insert-page fct-layout-width"},lme={class:"fct-btn-group sm justify-end"},ome={class:"filter-popover-item"},rme={class:"filter-popover-title"},ime={key:0,"aria-hidden":"true"},dme=["colspan"],ume=["onClick"],cme=["onClick"],Ame={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},pme={class:"flex items-center"},fme=["onClick","title"],mme={key:0,class:"bulk-collapse-count"},hme=["title"],_me=["title"],gme={class:"bulk-status-icon is-error"},vme={key:0,class:"fct-bulk-sku-cell"},yme={key:1,class:"text-gray-300 text-sm flex justify-center"},bme={key:1,class:"fct-bulk-media-cell"},wme={key:2,class:"fct-bulk-categories-cell"},Cme={key:3,class:"fct-bulk-desc-cell"},Bme={key:4,class:"fct-bulk-short-desc-cell"},kme={key:5,class:"fct-bulk-status-cell"},xme={key:6,class:"fct-bulk-product-type-cell"},Sme={key:7,class:"fct-bulk-product-type-cell"},Fme={key:8,class:"fct-bulk-pricing-type-cell"},Eme={key:9,class:"fct-bulk-pricing-type-cell"},Ume={key:10,class:"fct-bulk-payment-type-cell"},$me={key:11,class:"fct-bulk-interval-cell"},Dme={key:12,class:"fct-bulk-trial-days-cell"},Qme={key:13,class:"fct-bulk-best-price-cell"},Ime={key:14,class:"fct-bulk-compare-price-cell"},Tme={key:15,class:"fct-bulk-qty-cell !pl-5"},Vme={key:16,class:"fct-bulk-stock-cell"},Mme={key:1,class:"text-gray-300 text-sm pl-5"},Lme={class:"fct-btn-group xs justify-end"},Rme=["href","title"],Ome={key:0,class:"bulk-variants-block-row"},Hme=["colspan"],Pme={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Nme=["onClick"],Kme={class:"bulk-checkbox-cell"},Gme={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},jme={class:"flex items-center gap-1 pl-4"},zme={class:"bulk-status-icon is-error"},Yme={key:0,class:"fct-bulk-sku-cell"},qme={key:1,class:"fct-bulk-media-cell"},Wme={key:2},Xme={key:3},Jme={key:4},Zme={key:5},ehe={key:6},the={key:7},ahe={key:8},nhe={key:9},she={key:10},lhe={key:11},ohe={key:12},rhe={key:13,class:"text-center"},ihe={key:14},dhe={key:1,class:"text-gray-300 text-sm flex justify-center"},uhe={class:"fct-btn-group sm justify-end"},che={class:"bulk-add-variant-row"},Ahe=["colspan"],phe={class:"sticky left-0 inline-block pl-6"},fhe={key:1,"aria-hidden":"true"},mhe=["colspan"],qi=43,hhe=10,_he=800,VA=100,ghe={__name:"BulkInsert",setup(e){const{options:t,products:a}=ot.data,n=ue=>{var ve;return((ve=ue==null?void 0:ue.detail)==null?void 0:ve.variation_type)==="simple"},s=j(()=>ot.data.saving),o=j(()=>ot.data.saveProgress),u=j(()=>{const ue=ot.data.saveProgress;return ue.total?Math.round(ue.completed/ue.total*100):0}),A=()=>{ot.saveProducts()},f=ue=>ot.isSaving(ue._cid),m=ue=>ot.isSaved(ue._cid),g=ue=>ot.isRowDisabled(ue._cid),y=ue=>ot.hasError(ue._cid),v=ue=>ot.getError(ue._cid),B=ue=>ot.hasProductLevelError(ue._cid),b=(ue,ve)=>ot.hasVariantError(ue._cid,ve),w=(ue,ve)=>ot.getVariantError(ue._cid,ve),k=(ue,ve)=>ot.hasFieldError(ue._cid,ve),S=(ue,ve,We)=>ot.hasVariantFieldError(ue._cid,ve,We),M=async ue=>{const ve=ue.post_title||P.$t("Untitled product"),We=Array.isArray(ue.variants)?ue.variants.length:0,_t=ot.isSaved(ue._cid);let rt=We>0?P.$t('This will remove "%s" and its %s variant(s).').replace("%s",ve).replace("%s",We):P.$t('This will remove "%s".').replace("%s",ve);_t&&(rt+=" "+P.$t("This product was already saved and will be permanently deleted."));try{await Ea.confirm(rt,P.$t("Remove Product"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}await ot.removeProduct(ue)},$=(ue,ve)=>{const We=ve.variation_title||P.$t("Untitled variant");Ea.confirm(P.$t('This will remove the variant "%s".').replace("%s",We),P.$t("Remove Variant"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),confirmButtonClass:"el-button--small",cancelButtonClass:"el-button--small",type:"warning"}).then(()=>{ot.removeVariant(ue,ve)}).catch(()=>{})},F=ue=>ot.duplicateProduct(ue),L=(ue,ve)=>ot.duplicateVariant(ue,ve),Q=()=>{const ue=[];for(const ve of a){const We=`p:${ve._cid}`,_t=le.value.has(We),rt=[];ve.variants&&ve.variants.forEach((Wt,lt)=>{le.value.has(`v:${ve._cid}:${lt}`)&&rt.push(lt)}),!(!_t&&rt.length===0)&&(_t&&rt.length===0?ue.push({product:ve,type:"full"}):!_t&&rt.length>0?ue.push({product:ve,type:"variants-only",variantIndexes:rt}):ue.push({product:ve,type:"partial",variantIndexes:rt}))}return ue},T=()=>{const ue=Q();if(!ue.length)return;const ve=ue.filter(lt=>lt.type==="full").length,We=ue.filter(lt=>lt.type==="partial").length,rt=ue.filter(lt=>lt.type==="variants-only").reduce((lt,ga)=>lt+ga.variantIndexes.length,0),Wt=[];ve>0&&Wt.push(`${ve} product(s) with all variants`),We>0&&Wt.push(`${We} product(s) with selected variants`),rt>0&&Wt.push(`${rt} variant(s)`),Ea.confirm(P.$t("Duplicate %s?").replace("%s",Wt.join(", ")),P.$t("Bulk Duplicate"),{confirmButtonText:P.$t("Duplicate"),cancelButtonText:P.$t("Cancel"),type:"info"}).then(()=>{for(const lt of ue)if(lt.type==="full")ot.duplicateProduct(lt.product);else if(lt.type==="variants-only")for(const ga of lt.variantIndexes){const va=lt.product.variants[ga];va&&ot.duplicateVariant(lt.product,va)}else lt.type==="partial"&&ot.duplicateProductWithVariants(lt.product,lt.variantIndexes);be()}).catch(()=>{})},D=async()=>{const ue=[],ve=[];for(const lt of a){const ga=`p:${lt._cid}`;if(le.value.has(ga)){ue.push(lt);continue}const Da=[];lt.variants&<.variants.forEach((Sn,Tn)=>{le.value.has(`v:${lt._cid}:${Tn}`)&&Da.push(Sn)}),Da.length>0&&ve.push({product:lt,variants:Da})}if(!ue.length&&!ve.length)return;const We=ue.filter(lt=>ot.isSaved(lt._cid)).length,_t=ve.reduce((lt,ga)=>lt+ga.variants.length,0),rt=[];ue.length>0&&rt.push(`${ue.length} product(s)`),_t>0&&rt.push(`${_t} variant(s)`);let Wt=P.$t("Remove %s?").replace("%s",rt.join(" and "));We>0&&(Wt+=" "+P.$t("%s already saved will be permanently deleted.").replace("%s",`${We}`));try{await Ea.confirm(Wt,P.$t("Bulk Remove"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}for(const lt of ue)await ot.removeProduct(lt);for(const{product:lt,variants:ga}of ve)for(const va of ga)ot.removeVariant(lt,va);be()},U=ue=>{ot.resetPaymentTypeDefaults(ue)},I=(ue,ve)=>{const We=ot.data.categoryOptions;for(const _t of ve)We.find(rt=>rt.value===_t)||We.push({label:_t,value:_t})},O=()=>{ot.populateDummyProduct()},P=Qt().ctx,K=ue=>{const ve=ot.data.products;ue.concat||(ve.splice(0,ve.length),ot.data.savedIds=new Set,ot.data.savingIds=new Set,ot.data.productErrors=new Map),ve.push(...ue.products)},G=V({visible:!1,field:"",product:null,value:""}),ne=(ue,ve)=>{G.value={visible:!0,field:ve,product:ue,value:ue[ve]||""}},Y=ue=>{G.value.value=ue},N=()=>{const{product:ue,field:ve,value:We}=G.value;ue&&(ue[ve]=We),G.value.visible=!1},oe=j(()=>G.value.field==="post_content"?P.$t("Edit Description"):P.$t("Edit Short Description")),Z=V(!0),{selectedKeys:le,handleRowClick:te,toggleSelectAll:X,selectAll:ie,deselectAll:be,isSelected:se,selectedCount:ce,isLinkMode:pe,toggleLinkMode:De}=km(),$e=j(()=>{const ue=[];for(const ve of Ze.value)if(ue.push(`p:${ve.productId}`),ve.hasVariants&&!ve.collapsed)for(let We=0;We<ve.product.variants.length;We++)ue.push(`v:${ve.productId}:${We}`);return ue}),Je=ue=>{var ve;if(ue.startsWith("p:")){const We=ue.slice(2),_t=a.find(rt=>rt._cid===We);return _t?{type:"product",data:_t,product:_t}:null}else if(ue.startsWith("v:")){const We=ue.split(":"),_t=We[1],rt=parseInt(We[2]),Wt=a.find(lt=>lt._cid===_t);if(Wt&&((ve=Wt.variants)!=null&&ve[rt]))return{type:"variant",data:Wt.variants[rt],product:Wt}}return null},we=(ue,ve,We)=>{!pe.value||!se(We)||Sm(ue,ve,We,le.value,Je,null,ame)},Ye=V(!1),ft=ue=>{ue.key==="Shift"&&(Ye.value=!0)},Ge=ue=>{ue.key==="Shift"&&(Ye.value=!1)},_e=(ue,ve)=>{if(!ve.shiftKey||ve.target.closest(".bulk-checkbox-cell"))return;ve.preventDefault();const We=new Set(le.value);We.has(ue)?We.delete(ue):We.add(ue),le.value=We},xe=V([]),Me=j(()=>xe.value.filter(ue=>ue.key==="title"||ue.key==="actions"?!0:ot.isColumnVisible(ue.key))),Fe=ue=>ot.isColumnVisible(ue),nt=()=>{ot.saveColumnWidths(xe.value)},st=V(new Set),Ot=ue=>{const ve=ue._cid;st.value.has(ve)?st.value.delete(ve):st.value.add(ve),st.value=new Set(st.value)},Ct=ue=>st.value.has(ue._cid),yt=V(0),Ze=j(()=>{let ue=0;return a.map(ve=>{var Da;const We=ve._cid,_t=((Da=ve.detail)==null?void 0:Da.variation_type)!=="simple"&&Array.isArray(ve.variants),rt=_t?ve.variants.length:0,Wt=st.value.has(We),lt=_t&&!Wt?(rt+1)*qi:0,ga=qi+lt,va={product:ve,productId:We,hasVariants:_t,variantCount:rt,collapsed:Wt,groupHeight:ga,offset:ue};return ue+=ga,va})}),Bt=j(()=>{const ue=Ze.value;if(ue.length===0)return 0;const ve=ue[ue.length-1];return ve.offset+ve.groupHeight}),ht=j(()=>{const ue=Ze.value,ve=yt.value,We=ve+_he,_t=hhe*qi;return ue.filter(rt=>rt.offset+rt.groupHeight>=ve-_t&&rt.offset<=We+_t)}),Ft=j(()=>ht.value.length===0?0:ht.value[0].offset),kt=j(()=>{if(ht.value.length===0)return 0;const ue=ht.value[ht.value.length-1];return Bt.value-ue.offset-ue.groupHeight});let xt=null,Ht=0;const pt=ue=>{const ve=ue.target,We=Date.now();xt&&clearTimeout(xt),We-Ht>=VA?(yt.value=ve.scrollTop,Ht=We):xt=setTimeout(()=>{yt.value=ve.scrollTop,Ht=Date.now(),xt=null},VA)};let da=null;return Be(async()=>{da=ks(),da.bind("mod+a",ue=>{var We,_t;const ve=(We=document.activeElement)==null?void 0:We.tagName;ve==="INPUT"||ve==="TEXTAREA"||(_t=document.activeElement)!=null&&_t.isContentEditable||(ue.preventDefault(),ie($e.value))}),da.bind("escape",()=>{var ve,We;const ue=(ve=document.activeElement)==null?void 0:ve.tagName;ue==="INPUT"||ue==="TEXTAREA"||(We=document.activeElement)!=null&&We.isContentEditable||(pe.value?De():be())}),xe.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}],ot.restoreColumnWidths(xe.value),ot.setupColumnVisibility(),ot.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",ft),window.addEventListener("keyup",Ge)}),xn(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",ft),window.removeEventListener("keyup",Ge),da&&da.reset()}),(ue,ve)=>{const We=C("el-button"),_t=C("el-progress"),rt=C("el-checkbox"),Wt=C("el-checkbox-group"),lt=C("el-tooltip"),ga=C("el-popover"),va=C("el-input"),Da=C("el-icon"),Sn=C("el-option"),Tn=C("el-select"),Fs=C("el-switch"),El=C("el-dialog");return d(),_("div",sme,[l(za,{title:ue.$t("Bulk Insert")},{action:i(()=>[l(yfe,{onOnDataPopulated:K}),l(We,{onClick:O},{default:i(()=>[R(h(ue.$t("Add Product")),1)]),_:1}),l(We,{type:"primary",onClick:A,loading:s.value,disabled:s.value||p(a).length===0},{default:i(()=>[R(h(s.value?ue.$t("Saving %s/%s...").replace("%s",o.value.completed).replace("%s",o.value.total):ue.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),s.value?(d(),E(_t,{key:0,percentage:u.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),l(he,null,{default:i(()=>{var mn;return[p(a).length>0?(d(),E(Ce,{key:0,title:((mn=p(a))==null?void 0:mn.length)===1?ue.$t("Product"):ue.$t("Products"),border_bottom:""},{action:i(()=>[r("div",lme,[l(We,{disabled:p(ce)===0,onClick:D,size:"small",type:"danger",soft:""},{default:i(()=>[ve[8]||(ve[8]=r("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("polyline",{points:"3 6 5 6 21 6"}),r("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+h(ue.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),l(We,{disabled:p(ce)===0,onClick:T,size:"small",type:"info",soft:""},{default:i(()=>[ve[9]||(ve[9]=r("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+h(ue.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),l(We,{class:de({"is-active":p(pe)}),disabled:p(ce)<2&&!p(pe),onClick:p(De),size:"small",type:"info",soft:""},{default:i(()=>[ve[10]||(ve[10]=r("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),r("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+h(p(pe)?ue.$t("Unlink"):ue.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),l(rt,{modelValue:Z.value,"onUpdate:modelValue":ve[0]||(ve[0]=Ae=>Z.value=Ae),label:ue.$t("Pin Actions")},null,8,["modelValue","label"]),l(ga,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:i(()=>[r("span",null,[l(lt,{effect:"light",content:ue.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{tag:"button",size:"small"},{default:i(()=>[l(W,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:i(()=>[r("div",ome,[r("h3",rme,h(ue.$t("Columns")),1),l(Wt,{modelValue:p(ot).data.visibleColumns,"onUpdate:modelValue":ve[1]||(ve[1]=Ae=>p(ot).data.visibleColumns=Ae),class:"fct-checkbox-blocks",onChange:ve[2]||(ve[2]=Ae=>p(ot).handleColumnVisibilityChange())},{default:i(()=>[(d(!0),_(H,null,ee(p(ot).getToggleableColumns(),Ae=>(d(),E(rt,{key:Ae.value,value:Ae.value,label:ue.$t(Ae.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):x("",!0),l(me,{class:"p-0"},{default:i(()=>[p(a).length>0?(d(),_("div",{key:0,class:de(["relative",{"is-link-mode":p(pe),"is-shift-held":Ye.value}])},[l(Cm,{columns:Me.value,"sticky-last":Z.value,onScroll:pt,onResizeEnd:nt},{"header-first":i(()=>[l(rt,{"model-value":p(ce)>0&&p(ce)===$e.value.length,indeterminate:p(ce)>0&&p(ce)<$e.value.length,onChange:ve[3]||(ve[3]=Ae=>p(X)($e.value))},null,8,["model-value","indeterminate"])]),"header-last":i(()=>[R(h(ue.$t("Actions")),1)]),default:i(()=>[Ft.value>0?(d(),_("tr",ime,[r("td",{colspan:Me.value.length+1,style:ia({height:Ft.value+"px",padding:0,border:"none"})},null,12,dme)])):x("",!0),(d(!0),_(H,null,ee(ht.value,Ae=>{var Ws,z,J,fe,Ue,je,et,Le,qe,Et,tt,bt,ua,Fn,Es;return d(),_(H,{key:Ae.productId},[r("tr",{class:de(["bulk-product-row",{"is-saving":f(Ae.product),"is-saved":m(Ae.product),"has-product-error":y(Ae.product),"is-selected":p(se)(`p:${Ae.productId}`)}]),onClick:ae=>_e(`p:${Ae.productId}`,ae)},[r("td",{class:"bulk-checkbox-cell",onClick:ae=>p(te)(`p:${Ae.productId}`,ae,$e.value)},[l(rt,{"model-value":p(se)(`p:${Ae.productId}`),tabindex:"-1"},null,8,["model-value"])],8,cme),r("td",Ame,[r("div",pme,[Ae.hasVariants?(d(),_("button",{key:0,class:"bulk-collapse-btn",onClick:Xe(ae=>Ot(Ae.product),["prevent"]),title:Ct(Ae.product)?ue.$t("Expand variants"):ue.$t("Collapse variants")},[(d(),_("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":Ct(Ae.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},ve[11]||(ve[11]=[r("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),Ct(Ae.product)?(d(),_("span",mme,h(Ae.variantCount),1)):x("",!0)],8,fme)):x("",!0),l(va,{class:de(["fct-bulk-input",{"is-error":k(Ae.product,"post_title")}]),modelValue:Ae.product.post_title,"onUpdate:modelValue":ae=>Ae.product.post_title=ae,placeholder:ue.$t("Product title"),size:"small",disabled:g(Ae.product),onInput:ae=>we("title",ae,`p:${Ae.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),f(Ae.product)?(d(),_("span",{key:1,class:"bulk-status-icon is-syncing",title:ue.$t("Saving...")},[l(Da,{class:"is-loading",size:14},{default:i(()=>[l(p(_l))]),_:1})],8,hme)):m(Ae.product)?(d(),_("span",{key:2,class:"bulk-status-icon is-saved",title:ue.$t("Saved")},ve[12]||(ve[12]=[r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[r("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,_me)):B(Ae.product)||n(Ae.product)&&y(Ae.product)?(d(),E(lt,{key:3,content:v(Ae.product),placement:"top"},{default:i(()=>[r("span",gme,[l(Da,{size:16},{default:i(()=>[l(p(ur))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),Fe("sku")?(d(),_("td",vme,[((z=(Ws=Ae.product)==null?void 0:Ws.detail)==null?void 0:z.variation_type)==="simple"&&((J=Ae.product.variants)!=null&&J[0])?(d(),E(va,{key:0,class:de(["fct-bulk-input",{"is-error":k(Ae.product,"variants.0.sku")}]),modelValue:Ae.product.variants[0].sku,"onUpdate:modelValue":[ae=>Ae.product.variants[0].sku=ae,ae=>we("sku",ae,`p:${Ae.productId}`)],placeholder:"SKU",size:"small",disabled:g(Ae.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(d(),_("span",yme,"—"))])):x("",!0),Fe("media")?(d(),_("td",bme,[l(Bs,{modelValue:Ae.product.gallery,"onUpdate:modelValue":ae=>Ae.product.gallery=ae,"show-url-tab":"",disabled:g(Ae.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),Fe("categories")?(d(),_("td",wme,[l(Bm,{modelValue:Ae.product.categories,"onUpdate:modelValue":ae=>Ae.product.categories=ae,options:p(ot).data.categoryOptions,disabled:g(Ae.product),onChange:ae=>{I(Ae.product,ae),we("categories",Ae.product.categories,`p:${Ae.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),Fe("description")?(d(),_("td",Cme,[l(Vr,{value:Ae.product.post_content,placeholder:ue.$t("Description"),onClick:ae=>ne(Ae.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),Fe("short_description")?(d(),_("td",Bme,[l(Vr,{value:Ae.product.post_excerpt,placeholder:ue.$t("Short description"),onClick:ae=>ne(Ae.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),Fe("status")?(d(),_("td",kme,[l(Tn,{modelValue:Ae.product.post_status,"onUpdate:modelValue":ae=>Ae.product.post_status=ae,size:"small",class:de({"is-field-error":k(Ae.product,"post_status")}),disabled:g(Ae.product),onChange:ae=>we("status",Ae.product.post_status,`p:${Ae.productId}`)},{default:i(()=>[(d(!0),_(H,null,ee(p(t).status,ae=>(d(),E(Sn,{key:ae.value,label:ue.$t(ae.title),value:ae.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),Fe("product_type")&&((fe=Ae.product)!=null&&fe.detail)?(d(),_("td",xme,[l(Tn,{modelValue:Ae.product.detail.fulfillment_type,"onUpdate:modelValue":ae=>Ae.product.detail.fulfillment_type=ae,size:"small",class:de({"is-field-error":k(Ae.product,"detail.fulfillment_type")}),disabled:g(Ae.product),onChange:ae=>we("product_type",Ae.product.detail.fulfillment_type,`p:${Ae.productId}`)},{default:i(()=>[(d(!0),_(H,null,ee(p(t).fulfilment,ae=>(d(),E(Sn,{key:ae.value,label:ue.$t(ae.title),value:ae.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Fe("product_type")?(d(),_("td",Sme)):x("",!0),Fe("pricing_type")&&((Ue=Ae.product)!=null&&Ue.detail)?(d(),_("td",Fme,[l(Tn,{modelValue:Ae.product.detail.variation_type,"onUpdate:modelValue":ae=>Ae.product.detail.variation_type=ae,size:"small",class:de({"is-field-error":k(Ae.product,"detail.variation_type")}),disabled:g(Ae.product),onChange:ae=>{p(ot).handleVariationChanged(Ae.product,ae),we("pricing_type",ae,`p:${Ae.productId}`)}},{default:i(()=>[(d(!0),_(H,null,ee(p(t).variation,ae=>(d(),E(Sn,{key:ae.value,label:ue.$t(ae.title),value:ae.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Fe("pricing_type")?(d(),_("td",Eme)):x("",!0),Fe("payment_type")?(d(),_("td",Ume,[l(Dr,{variant:n(Ae.product)?(je=Ae.product.variants)==null?void 0:je[0]:null,disabled:g(Ae.product),"has-error":k(Ae.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:ae=>{var it;U(ae),we("payment_type",(it=ae.other_info)==null?void 0:it.payment_type,`p:${Ae.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),Fe("interval")?(d(),_("td",$me,[l(Qr,{variant:n(Ae.product)?(et=Ae.product.variants)==null?void 0:et[0]:null,disabled:g(Ae.product),"has-error":k(Ae.product,"variants.0.other_info.repeat_interval"),onChange:ae=>{var it,Ba,nn;return we("interval",(nn=(Ba=(it=Ae.product.variants)==null?void 0:it[0])==null?void 0:Ba.other_info)==null?void 0:nn.repeat_interval,`p:${Ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("trial_days")?(d(),_("td",Dme,[l(Ir,{variant:n(Ae.product)?(Le=Ae.product.variants)==null?void 0:Le[0]:null,disabled:g(Ae.product),"has-error":k(Ae.product,"variants.0.other_info.trial_days"),onChange:ae=>{var it,Ba,nn;return we("trial_days",(nn=(Ba=(it=Ae.product.variants)==null?void 0:it[0])==null?void 0:Ba.other_info)==null?void 0:nn.trial_days,`p:${Ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("best_price")?(d(),_("td",Qme,[l($r,{variant:n(Ae.product)?(qe=Ae.product.variants)==null?void 0:qe[0]:null,disabled:g(Ae.product),"has-error":k(Ae.product,"variants.0.item_price"),onChange:ae=>{var it,Ba;return we("price",(Ba=(it=Ae.product.variants)==null?void 0:it[0])==null?void 0:Ba.item_price,`p:${Ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("compare_price")?(d(),_("td",Ime,[l(Tr,{variant:n(Ae.product)?(Et=Ae.product.variants)==null?void 0:Et[0]:null,disabled:g(Ae.product),"has-error":k(Ae.product,"variants.0.compare_price"),onChange:ae=>{var it,Ba;return we("compare_price",(Ba=(it=Ae.product.variants)==null?void 0:it[0])==null?void 0:Ba.compare_price,`p:${Ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("track_quantity")?(d(),_("td",Tme,[(tt=Ae.product)!=null&&tt.detail?(d(),E(Fs,{key:0,modelValue:Ae.product.detail.manage_stock,"onUpdate:modelValue":ae=>Ae.product.detail.manage_stock=ae,"active-value":"1","inactive-value":"0",disabled:g(Ae.product),onChange:ae=>{p(ot).syncStockStatus(Ae.product),we("manage_stock",Ae.product.detail.manage_stock,`p:${Ae.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),Fe("stock")?(d(),_("td",Vme,[((ua=(bt=Ae.product)==null?void 0:bt.detail)==null?void 0:ua.manage_stock)==="1"&&((Es=(Fn=Ae.product)==null?void 0:Fn.detail)==null?void 0:Es.variation_type)==="simple"?(d(),E(va,{key:0,modelValue:Ae.product.detail.total_stock,"onUpdate:modelValue":[ae=>Ae.product.detail.total_stock=ae,ae=>{var it;(it=Ae.product.variants)!=null&&it[0]&&(Ae.product.variants[0].total_stock=ae,Ae.product.variants[0].available=ae),p(ot).syncStockStatus(Ae.product),we("stock",ae,`p:${Ae.productId}`)}],disabled:g(Ae.product),size:"small",placeholder:ue.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(d(),_("span",Mme,"—"))])):x("",!0),r("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":Z.value}])},[r("div",Lme,[m(Ae.product)&&Ae.product.view_url?(d(),_("a",{key:0,href:Ae.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:ue.$t("View Product")},[l(W,{name:"External"})],8,Rme)):x("",!0),l(Oe,{tag:"button",size:"x-small",onClick:Xe(ae=>F(Ae.product),["prevent"]),disabled:s.value||g(Ae.product),title:ue.$t("Duplicate")},{default:i(()=>[l(W,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),l(Oe,{tag:"button",size:"x-small",hover:"danger",onClick:Xe(ae=>M(Ae.product),["prevent"]),disabled:s.value||g(Ae.product),title:ue.$t("Delete")},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,ume),Ae.hasVariants?(d(),_("tr",Ome,[r("td",{colspan:Me.value.length+1,class:"!p-0 !border-b-0"},[l(ra,{accordion:"",visible:!Ae.collapsed,duration:200},{default:i(()=>[r("table",Pme,[r("colgroup",null,[ve[13]||(ve[13]=r("col",{style:{width:"40px"}},null,-1)),(d(!0),_(H,null,ee(Me.value,(ae,it)=>(d(),_("col",{key:it,style:ia({width:ae.width+"px"})},null,4))),128))]),r("tbody",null,[(d(!0),_(H,null,ee(Ae.product.variants,(ae,it)=>{var Ba,nn;return d(),_("tr",{key:it,class:de(["bulk-variation-row",{"is-selected":p(se)(`v:${Ae.productId}:${it}`)}]),onClick:Ut=>_e(`v:${Ae.productId}:${it}`,Ut)},[r("td",Kme,[l(rt,{"model-value":p(se)(`v:${Ae.productId}:${it}`),tabindex:"-1",onChange:Ut=>p(te)(`v:${Ae.productId}:${it}`,Ut,$e.value)},null,8,["model-value","onChange"])]),r("td",Gme,[r("div",jme,[ve[14]||(ve[14]=r("span",{class:"text-gray-300 text-xs"},"└",-1)),l(va,{size:"small",modelValue:ae.variation_title,"onUpdate:modelValue":[Ut=>ae.variation_title=Ut,Ut=>we("title",Ut,`v:${Ae.productId}:${it}`)],placeholder:ue.$t("Variation title"),disabled:g(Ae.product),class:de({"is-error":S(Ae.product,it,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),b(Ae.product,it)?(d(),E(lt,{key:0,content:w(Ae.product,it),placement:"top"},{default:i(()=>[r("span",zme,[l(Da,{size:14},{default:i(()=>[l(p(ur))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),Fe("sku")?(d(),_("td",Yme,[l(va,{size:"small",modelValue:ae.sku,"onUpdate:modelValue":[Ut=>ae.sku=Ut,Ut=>we("sku",Ut,`v:${Ae.productId}:${it}`)],placeholder:"SKU",disabled:g(Ae.product),class:de({"is-error":S(Ae.product,it,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):x("",!0),Fe("media")?(d(),_("td",qme,[l(Bs,{modelValue:ae.media,"onUpdate:modelValue":Ut=>ae.media=Ut,"show-url-tab":"",disabled:g(Ae.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),Fe("categories")?(d(),_("td",Wme,ve[15]||(ve[15]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Fe("description")?(d(),_("td",Xme,ve[16]||(ve[16]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Fe("short_description")?(d(),_("td",Jme,ve[17]||(ve[17]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Fe("status")?(d(),_("td",Zme,ve[18]||(ve[18]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Fe("product_type")?(d(),_("td",ehe,ve[19]||(ve[19]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Fe("pricing_type")?(d(),_("td",the,ve[20]||(ve[20]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Fe("payment_type")?(d(),_("td",ahe,[l(Dr,{variant:ae,disabled:g(Ae.product),"has-error":S(Ae.product,it,"other_info.payment_type"),onPaymentTypeChange:Ut=>{var Se;U(Ut),we("payment_type",(Se=Ut.other_info)==null?void 0:Se.payment_type,`v:${Ae.productId}:${it}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),Fe("interval")?(d(),_("td",nhe,[l(Qr,{variant:ae,disabled:g(Ae.product),"has-error":S(Ae.product,it,"other_info.repeat_interval"),onChange:Ut=>{var Se;return we("interval",(Se=ae.other_info)==null?void 0:Se.repeat_interval,`v:${Ae.productId}:${it}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("trial_days")?(d(),_("td",she,[l(Ir,{variant:ae,disabled:g(Ae.product),"has-error":S(Ae.product,it,"other_info.trial_days"),onChange:Ut=>{var Se;return we("trial_days",(Se=ae.other_info)==null?void 0:Se.trial_days,`v:${Ae.productId}:${it}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("best_price")?(d(),_("td",lhe,[l($r,{variant:ae,disabled:g(Ae.product),"has-error":S(Ae.product,it,"item_price"),onChange:Ut=>we("price",ae.item_price,`v:${Ae.productId}:${it}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("compare_price")?(d(),_("td",ohe,[l(Tr,{variant:ae,disabled:g(Ae.product),"has-error":S(Ae.product,it,"compare_price"),onChange:Ut=>we("compare_price",ae.compare_price,`v:${Ae.productId}:${it}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Fe("track_quantity")?(d(),_("td",rhe,ve[21]||(ve[21]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Fe("stock")?(d(),_("td",ihe,[((nn=(Ba=Ae.product)==null?void 0:Ba.detail)==null?void 0:nn.manage_stock)==="1"?(d(),E(va,{key:0,class:"fc-bulk-input",size:"small",modelValue:ae.total_stock,"onUpdate:modelValue":[Ut=>ae.total_stock=Ut,Ut=>{ae.available=Ut,p(ot).syncStockStatus(Ae.product),we("stock",Ut,`v:${Ae.productId}:${it}`)}],disabled:g(Ae.product),placeholder:ue.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(d(),_("span",dhe,"—"))])):x("",!0),r("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":Z.value}])},[r("div",uhe,[l(Oe,{tag:"button",size:"x-small",onClick:Xe(Ut=>L(Ae.product,ae),["prevent"]),disabled:s.value||g(Ae.product),title:ue.$t("Duplicate")},{default:i(()=>[l(W,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),l(Oe,{tag:"button",size:"x-small",hover:"danger",onClick:Xe(Ut=>$(Ae.product,ae),["prevent"]),disabled:s.value||g(Ae.product),title:ue.$t("Delete")},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Nme)}),128)),r("tr",che,[r("td",{colspan:Me.value.length+1},[r("div",phe,[l(We,{size:"small",text:"",type:"primary",onClick:Xe(ae=>p(ot).addVariationToProduct(Ae.product),["prevent"])},{default:i(()=>[R(" + "+h(ue.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,Ahe)])])])]),_:2},1032,["visible"])],8,Hme)])):x("",!0)],64)}),128)),kt.value>0?(d(),_("tr",fhe,[r("td",{colspan:Me.value.length+1,style:ia({height:kt.value+"px",padding:0,border:"none"})},null,12,mhe)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):(d(),E(at,{key:1,icon:"Empty/ListView","has-dark":!0,text:p(c)("No products yet. Import a CSV or add products manually.")},null,8,["text"]))]),_:1})]}),_:1}),l(El,{modelValue:G.value.visible,"onUpdate:modelValue":ve[6]||(ve[6]=mn=>G.value.visible=mn),title:oe.value,width:"700px","close-on-click-modal":!1,onClosed:ve[7]||(ve[7]=mn=>G.value.product=null)},{footer:i(()=>[l(We,{onClick:ve[5]||(ve[5]=mn=>G.value.visible=!1)},{default:i(()=>[R(h(ue.$t("Cancel")),1)]),_:1}),l(We,{type:"primary",onClick:N},{default:i(()=>[R(h(ue.$t("Save")),1)]),_:1})]),default:i(()=>[G.value.visible&&G.value.field==="post_content"?(d(),E(ts,{key:0,"model-value":G.value.value,height:300,onUpdate:Y},null,8,["model-value"])):x("",!0),G.value.visible&&G.value.field==="post_excerpt"?(d(),E(va,{key:1,modelValue:G.value.value,"onUpdate:modelValue":ve[4]||(ve[4]=mn=>G.value.value=mn),type:"textarea",rows:6,placeholder:ue.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}};class vhe extends Uu{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:c("All"),publish:c("Published"),draft:c("Draft"),physical:c("Physical"),digital:c("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 c("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,n;return((n=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:n.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 n=[];for(let s=0;s<t.length;s+=a)n.push(t.slice(s,s+a));return n}async fetchProducts(t={},a=!1,n="",s=""){var o;this.data.loading=!0;try{n&&(this.data.constrainedProductIds=n,this.data.constrainedVariantIds=s);const u=n||this.data.constrainedProductIds,A=s||this.data.constrainedVariantIds,f={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};u&&(f.product_ids=u,f.variant_ids=A),this.data.filterType==="advanced"?(f.advanced_filters=JSON.stringify(this.data.advanceFilters),f.filter_type="advanced"):(this.data.search&&(f.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(f.active_view=this.data.selectedView)),Object.assign(f,t);const m=await re.get("products/bulk-edit-data",f),g=m.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),ye(()=>{this._suppressDirty=!1}),this.data.pagination={page:m.page||f.page,per_page:m.per_page||f.per_page,total:m.total||0,hasMore:m.page*m.per_page<m.total}}catch(u){const A=((o=u==null?void 0:u.data)==null?void 0:o.message)||"Failed to fetch products";q.error(A)}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(n=>!n.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 n=this.data.productErrors.get(t);if(!(n!=null&&n.fields))return!1;const s=`variants.${a}.`;return Object.keys(n.fields).some(o=>o.startsWith(s))}getVariantError(t,a){const n=this.data.productErrors.get(t);if(!(n!=null&&n.fields))return"";const s=`variants.${a}.`;return Object.entries(n.fields).filter(([u])=>u.startsWith(s)).map(([,u])=>u).join("; ")}hasFieldError(t,a){var s;const n=this.data.productErrors.get(t);return!!((s=n==null?void 0:n.fields)!=null&&s[a])}hasVariantFieldError(t,a,n){return this.hasFieldError(t,`variants.${a}.${n}`)}async saveProduct(t){var n,s,o,u;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 A=await re.post("products/bulk-update",{products:[t]});if((n=A.updated)!=null&&n.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),q.success("Product updated successfully");else if((s=A.errors)!=null&&s.length){const f=A.errors[0];f!=null&&f.fields&&(this.data.productErrors.set(a,f),this.data.productErrors=new Map(this.data.productErrors)),q.error((f==null?void 0:f.message)||"Failed to save product")}}catch(A){const f=((o=A==null?void 0:A.data)==null?void 0:o.message)||"Failed to save product",m=(u=A==null?void 0:A.data)==null?void 0:u.errors;if(m!=null&&m.length){const g=m[0];g!=null&&g.fields&&(this.data.productErrors.set(a,g),this.data.productErrors=new Map(this.data.productErrors))}q.error(f)}finally{this.data.savingIds.delete(a),this.data.savingIds=new Set(this.data.savingIds)}}}async saveProducts(){var n,s;const t=this.getDirtyProducts().filter(o=>!this.data.savedIds.has(o.ID));if(t.length===0){q.info("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 A of a){const f=A.map(m=>m.ID);for(const m of f)this.data.savingIds.add(m);this.data.savingIds=new Set(this.data.savingIds);try{const m=await re.post("products/bulk-update",{products:A});if(m.updated){this.data.saveProgress.updatedIds.push(...m.updated);for(const g of m.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(m.errors&&m.errors.length){this.data.saveProgress.errors.push(...m.errors);for(const g of m.errors)g.post_id&&g.fields&&this.data.productErrors.set(g.post_id,g);this.data.productErrors=new Map(this.data.productErrors)}}catch(m){const g=((n=m==null?void 0:m.data)==null?void 0:n.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:g});const y=(s=m==null?void 0:m.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 m of f)this.data.savingIds.delete(m);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{updatedIds:o,errors:u}=this.data.saveProgress;u.length===0?q.success(`${o.length} product(s) updated successfully`):o.length>0?q.info(`${o.length} product(s) updated, ${u.length} error(s)`):q.error("All products failed to save")}finally{this.data.saving=!1}}async duplicateProduct(t){var n;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 o=(await re.post(`products/${a}/duplicate`,{})).product_id;if(o){const A=(await re.get("products/bulk-edit-data",{search:o,per_page:1})).products||[];if(A.length>0){const f=this.data.products.indexOf(t);this.data.products.splice(f+1,0,A[0])}}}catch(s){const o=((n=s==null?void 0:s.data)==null?void 0:n.message)||"Failed to duplicate product";q.error(o)}finally{this.data.duplicatingIds.delete(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}async duplicateProductWithVariants(t,a){var s;const n=t.ID;if(!(!n||this.data.duplicatingIds.has(n))){this.data.duplicatingIds.add(n),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const u=(await re.post(`products/${n}/duplicate`,{})).product_id;if(!u)return;const f=(await re.get("products/bulk-edit-data",{search:u,per_page:1})).products||[];if(!f.length)return;const m=f[0],g=t.variants||[],y=new Set;for(const B of g)a.includes(B.id)&&B.serial_index!=null&&y.add(B.serial_index);m.variants&&y.size>0&&(m.variants=m.variants.filter(B=>y.has(B.serial_index)));const v=this.data.products.indexOf(t);this.data.products.splice(v+1,0,m),this.markDirty(m.ID)}catch(o){const u=((s=o==null?void 0:o.data)==null?void 0:s.message)||"Failed to duplicate product";q.error(u)}finally{this.data.duplicatingIds.delete(n),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}duplicateVariant(t,a){const n=JSON.parse(JSON.stringify(a));n.variation_title=n.variation_title?n.variation_title+" (Copy)":"",n.sku="",delete n.id,delete n.post_id;const s=t.variants.indexOf(a);t.variants.splice(s+1,0,n),this.markDirty(t.ID)}async deleteProduct(t){var n;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 re.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 o=((n=s==null?void 0:s.data)==null?void 0:n.message)||"Failed to delete product";q.error(o)}finally{this.data.deletingIds.delete(a),this.data.deletingIds=new Set(this.data.deletingIds)}}}removeVariant(t,a){if(t.variants.length<=1)return q.error(c("A product must have at least one variant.")),!1;const n=t.variants.indexOf(a);return n!==-1&&t.variants.splice(n,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 n=[];for(const o of t){const u=a?`${a} > ${o.label}`:o.label;n.push({label:u,value:u}),(s=o.children)!=null&&s.length&&n.push(...this.flattenCategoryTree(o.children,u))}return n}async fetchCategories(){try{const a=(await re.get("products/fetch-term")).taxonomies||{},n=Object.values(a).find(s=>s.name==="product-categories");n!=null&&n.terms&&(this.data.categoryOptions=this.flattenCategoryTree(n.terms))}catch{}}setupSavedViews(){var a,n;const t=(a=window.fluentCartAdminApp)==null?void 0:a.table_config;this.data.savedViews=((n=t==null?void 0:t.products)==null?void 0:n.saved_views)||[]}getSavedViews(){return this.data.savedViews}getActiveSavedViewId(){return this.data.activeSavedViewId}applySavedView(t){const a=this.data.savedViews.find(n=>n.slug===t);a&&(this.data.activeSavedViewId=t,this.data.savedViewQueryParams=a.query_params)}isViewOwner(t){var a,n;return!t||!t.owner_id?!1:t.owner_id===((n=(a=window.fluentCartAdminApp)==null?void 0:a.me)==null?void 0:n.id)}renameSavedView(t,a){}updateSavedView(t){}deleteSavedView(t){}}const Pe=vhe.init(),yhe={class:"fct-bulk-edit-page fct-layout-width"},bhe={class:"fct-table-wrapper"},whe={class:"fct-card-header-top"},Che={class:"fct-card-header-left flex-1"},Bhe={class:"fct-card-header-actions"},khe={key:0,class:"fct-advanced-filter-toggle-wrapper"},xhe={key:1,class:"fct-btn-group sm hidden md:flex"},She={key:0,class:"filter-search-wrap"},Fhe={class:"search-bar"},Ehe={class:"text-xs text-system-light pt-2 dark:text-gray-300"},Uhe={class:"fct-bulk-edit-table-wrap"},$he={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"},Dhe={class:"m-0 text-base"},Qhe={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},Ihe={class:"fct-btn-group sm justify-end"},The={class:"filter-popover-item"},Vhe={class:"filter-popover-title"},Mhe={class:"fct-bulk-edit-table"},Lhe={key:0,"aria-hidden":"true"},Rhe=["colspan"],Ohe=["onClick"],Hhe=["onClick"],Phe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Nhe={class:"flex items-center"},Khe=["onClick","title"],Ghe={key:0,class:"bulk-collapse-count"},jhe=["title"],zhe={class:"bulk-status-icon is-error"},Yhe=["disabled","onClick","title"],qhe={key:0,class:"fct-bulk-media-cell"},Whe={key:1,class:"fct-bulk-sku-cell"},Xhe={key:1,class:"text-gray-300 text-sm flex justify-center"},Jhe={key:2,class:"fct-bulk-categories-cell"},Zhe={key:3,class:"fct-bulk-desc-cell"},e_e={key:4,class:"fct-bulk-short-desc-cell"},t_e={key:5,class:"fct-bulk-status-cell"},a_e={key:6,class:"fct-bulk-product-type-cell"},n_e={class:"bulk-readonly-label"},s_e={key:7,class:"fct-bulk-pricing-type-cell"},l_e={class:"bulk-readonly-label"},o_e={key:8,class:"fct-bulk-payment-type-cell"},r_e={key:9,class:"fct-bulk-interval-cell"},i_e={key:10,class:"fct-bulk-trial-days-cell"},d_e={key:11,class:"fct-bulk-best-price-cell"},u_e={key:12,class:"fct-bulk-compare-price-cell"},c_e={key:13,class:"fct-bulk-qty-cell !pl-5"},A_e={key:14,class:"fct-bulk-stock-cell"},p_e={key:1,class:"text-gray-300 text-sm flex justify-center"},f_e={class:"fct-btn-group sm justify-end"},m_e={key:0,class:"bulk-variants-block-row"},h_e=["colspan"],__e={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},g_e=["onClick"],v_e={class:"bulk-checkbox-cell"},y_e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},b_e={class:"flex items-center gap-1 pl-4"},w_e={class:"bulk-status-icon is-error"},C_e={key:0},B_e={key:1},k_e={key:2},x_e={key:3},S_e={key:4},F_e={key:5},E_e={key:6},U_e={key:7},$_e={key:8},D_e={key:9},Q_e={key:10},I_e={key:11},T_e={key:12},V_e={key:13,class:"text-center"},M_e={key:14},L_e={key:1,class:"text-gray-300 text-sm flex justify-center"},R_e={class:"fct-btn-group sm justify-end"},O_e={key:1,"aria-hidden":"true"},H_e=["colspan"],P_e={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},N_e={class:"text-system-mid text-sm"},K_e={key:2,class:"flex items-center justify-center py-8"},G_e={class:"text-system-mid text-sm"},j_e={key:1,class:"flex items-center justify-center py-3 border-top"},z_e={class:"text-system-mid text-sm"},Wi=43,Y_e=10,MA=800,LA=100,q_e=200,W_e={__name:"BulkEdit",setup(e){const t=Qt().ctx,a=fn(),{options:n}=Pe.data,s=z=>{var J;return((J=z==null?void 0:z.detail)==null?void 0:J.variation_type)==="simple"},o=j(()=>Pe.data.products),u=j(()=>Pe.data.loading),A=j(()=>Pe.data.saving),f=j(()=>Pe.data.saveProgress),m=j(()=>Pe.data.pagination),g=j(()=>Pe.data.dirty),y=j(()=>g.value.size),v=j(()=>Math.max(0,m.value.total-o.value.length)),B=j(()=>Math.min(m.value.per_page,v.value)),b=j(()=>{const z=Pe.data.saveProgress;return z.total?Math.round(z.completed/z.total*100):0}),w=zd("search-input"),k=()=>{Pe.openSearch(),ye(()=>{var z;(z=w.value)==null||z.focus()})},S=(z=!1)=>{Pe.fetchProducts({},z)},M=()=>{Pe.saveProducts()},$=z=>{Pe.markDirty(z.ID)},F=(z,J)=>{Pe.resetPaymentTypeDefaults(J),$(z)},L=(z,J)=>{const fe=Pe.data.categoryOptions;for(const Ue of J)fe.find(je=>je.value===Ue)||fe.push({label:Ue,value:Ue});$(z)},Q=z=>Pe.isDirty(z.ID),T=z=>Pe.isSavingProduct(z.ID),D=z=>Pe.isSaved(z.ID),U=z=>Pe.isRowDisabled(z.ID),I=z=>Pe.isDuplicating(z.ID),O=z=>Pe.isDeleting(z.ID),P=z=>Pe.hasError(z.ID),K=z=>Pe.getError(z.ID),G=z=>Pe.hasProductLevelError(z.ID),ne=(z,J)=>Pe.hasVariantError(z.ID,J),Y=(z,J)=>Pe.getVariantError(z.ID,J),N=(z,J)=>Pe.hasFieldError(z.ID,J),oe=(z,J,fe)=>Pe.hasVariantFieldError(z.ID,J,fe),Z=z=>Pe.saveProduct(z),le=z=>Pe.duplicateProduct(z),te=(z,J)=>Pe.duplicateVariant(z,J),X=V(!0),{selectedKeys:ie,handleRowClick:be,toggleSelectAll:se,selectAll:ce,deselectAll:pe,isSelected:De,selectedCount:$e,isLinkMode:Je,toggleLinkMode:we}=km(),Ye=j(()=>{const z=[];for(const J of rt.value)if(z.push(`p:${J.productId}`),J.hasVariants&&!J.collapsed)for(const fe of J.product.variants)z.push(`v:${fe.id}`);return z}),ft=z=>{var J;if(z.startsWith("p:")){const fe=parseInt(z.slice(2)),Ue=rt.value.find(je=>je.productId===fe);return Ue?{type:"product",data:Ue.product,product:Ue.product}:null}else if(z.startsWith("v:")){const fe=parseInt(z.slice(2));for(const Ue of rt.value){const je=(J=Ue.product.variants)==null?void 0:J.find(et=>et.id===fe);if(je)return{type:"variant",data:je,product:Ue.product}}}return null},Ge=(z,J,fe)=>{!Je.value||!De(fe)||Sm(z,J,fe,ie.value,ft,$,nme)},_e=V(!1),xe=z=>{z.key==="Shift"&&(_e.value=!0)},Me=z=>{z.key==="Shift"&&(_e.value=!1)},Fe=(z,J)=>{if(!J.shiftKey||J.target.closest(".bulk-checkbox-cell"))return;J.preventDefault();const fe=new Set(ie.value);fe.has(z)?fe.delete(z):fe.add(z),ie.value=fe},nt=()=>{const z=[];for(const J of rt.value){const fe=`p:${J.productId}`,Ue=ie.value.has(fe),je=[];if(J.product.variants)for(const et of J.product.variants)ie.value.has(`v:${et.id}`)&&je.push(et.id);!Ue&&je.length===0||(Ue&&je.length===0?z.push({product:J.product,type:"full"}):!Ue&&je.length>0?z.push({product:J.product,type:"variants-only",variantIds:je}):z.push({product:J.product,type:"partial",variantIds:je}))}return z},st=async()=>{const z=nt();if(!z.length)return;const J=z.filter(Le=>Le.type==="full").length,fe=z.filter(Le=>Le.type==="partial").length,je=z.filter(Le=>Le.type==="variants-only").reduce((Le,qe)=>Le+qe.variantIds.length,0),et=[];J>0&&et.push(`${J} product(s) with all variants`),fe>0&&et.push(`${fe} product(s) with selected variants`),je>0&&et.push(`${je} variant(s)`);try{await Ea.confirm(t.$t("Duplicate %s?").replace("%s",et.join(", ")),t.$t("Bulk Duplicate"),{confirmButtonText:t.$t("Duplicate"),cancelButtonText:t.$t("Cancel"),type:"info"})}catch{return}for(const Le of z)if(Le.type==="full")await Pe.duplicateProduct(Le.product);else if(Le.type==="variants-only")for(const qe of Le.variantIds){const Et=Le.product.variants.find(tt=>tt.id===qe);Et&&Pe.duplicateVariant(Le.product,Et)}else Le.type==="partial"&&await Pe.duplicateProductWithVariants(Le.product,Le.variantIds);pe()},Ot=async()=>{const z=[],J=[];for(const je of rt.value){const et=`p:${je.productId}`;if(ie.value.has(et)){z.push(je.product);continue}const qe=[];if(je.product.variants)for(const Et of je.product.variants)ie.value.has(`v:${Et.id}`)&&qe.push(Et);qe.length>0&&J.push({product:je.product,variants:qe})}if(!z.length&&!J.length)return;const fe=J.reduce((je,et)=>je+et.variants.length,0),Ue=[];z.length>0&&Ue.push(`${z.length} product(s)`),fe>0&&Ue.push(`${fe} variant(s)`);try{await Ea.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",Ue.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const je of z)await Pe.deleteProduct(je);for(const{product:je,variants:et}of J)for(const Le of et)Pe.removeVariant(je,Le);pe()},Ct=async z=>{const J=z.ID;if(!J||Pe.isDeleting(J))return;const fe=z.post_title||t.$t("Untitled product"),Ue=Array.isArray(z.variants)?z.variants.length:0,je=Ue>0?t.$t('This will permanently delete "%s" and its %s variant(s).').replace("%s",fe).replace("%s",Ue):t.$t('This will permanently delete "%s".').replace("%s",fe);try{await Ea.confirm(je,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}Pe.deleteProduct(z)},yt=(z,J)=>{if(z.variants.length<=1){Pe.removeVariant(z,J);return}const fe=J.variation_title||t.$t("Untitled variant");Ea.confirm(t.$t('This will remove the variant "%s".').replace("%s",fe),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{Pe.removeVariant(z,J)}).catch(()=>{})},Ze=V({visible:!1,field:"",product:null,value:""}),Bt=(z,J)=>{Ze.value={visible:!0,field:J,product:z,value:z[J]||""}},ht=z=>{Ze.value.value=z},Ft=()=>{const{product:z,field:J,value:fe}=Ze.value;z&&(z[J]=fe,$(z)),Ze.value.visible=!1},kt=j(()=>Ze.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),xt=V([]),Ht=j(()=>xt.value.filter(z=>z.key==="title"||z.key==="actions"?!0:Pe.isColumnVisible(z.key))),pt=z=>Pe.isColumnVisible(z),da=()=>{Pe.saveColumnWidths(xt.value)},ue=V(new Set),ve=z=>{const J=z.ID;ue.value.has(J)?ue.value.delete(J):ue.value.add(J),ue.value=new Set(ue.value)},We=z=>ue.value.has(z.ID),_t=V(0),rt=j(()=>{let z=0;return o.value.map(J=>{var tt;const fe=J.ID,Ue=((tt=J.detail)==null?void 0:tt.variation_type)!=="simple"&&Array.isArray(J.variants)&&J.variants.length>0,je=Ue?J.variants.length:0,et=ue.value.has(fe),Le=Ue&&!et?je*Wi:0,qe=Wi+Le,Et={product:J,productId:fe,hasVariants:Ue,variantCount:je,collapsed:et,groupHeight:qe,offset:z};return z+=qe,Et})}),Wt=j(()=>{const z=rt.value;if(z.length===0)return 0;const J=z[z.length-1];return J.offset+J.groupHeight}),lt=j(()=>{const z=rt.value,J=_t.value,fe=J+MA,Ue=Y_e*Wi;return z.filter(je=>je.offset+je.groupHeight>=J-Ue&&je.offset<=fe+Ue)}),ga=j(()=>lt.value.length===0?0:lt.value[0].offset),va=j(()=>{if(lt.value.length===0)return 0;const z=lt.value[lt.value.length-1];return Wt.value-z.offset-z.groupHeight});let Da=null,Sn=0;const Tn=()=>{if(u.value||!m.value.hasMore||o.value.length===0)return;Wt.value-(_t.value+MA)<q_e&&S(!0)},Fs=z=>{const J=z.target,fe=Date.now();Da&&clearTimeout(Da),fe-Sn>=LA?(_t.value=J.scrollTop,Sn=fe,Tn()):Da=setTimeout(()=>{_t.value=J.scrollTop,Sn=Date.now(),Da=null,Tn()},LA)},El=z=>({physical:"Physical",digital:"Digital"})[z]||z||"—",mn=z=>({simple:"Simple",simple_variations:"Variable"})[z]||z||"—";let Ae=null;const Ws=()=>{const z=a.query.product_ids,J=a.query.variant_ids;z&&J?Pe.fetchProducts({},!1,z,J):S(!1)};return Be(async()=>{Ae=ks(),Ae.bind("mod+a",z=>{var fe,Ue;const J=(fe=document.activeElement)==null?void 0:fe.tagName;J==="INPUT"||J==="TEXTAREA"||(Ue=document.activeElement)!=null&&Ue.isContentEditable||(z.preventDefault(),ce(Ye.value))}),Ae.bind("escape",()=>{var J,fe;const z=(J=document.activeElement)==null?void 0:J.tagName;z==="INPUT"||z==="TEXTAREA"||(fe=document.activeElement)!=null&&fe.isContentEditable||(Je.value?we():pe())}),xt.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}],Pe.restoreColumnWidths(xt.value),Pe.setupColumnVisibility(),Pe.setupSavedViews(),Pe.fetchCategories(),Ws(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",xe),window.addEventListener("keyup",Me)}),xn(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",xe),window.removeEventListener("keyup",Me),Ae&&Ae.reset()}),(z,J)=>{const fe=C("el-button"),Ue=C("el-progress"),je=C("el-switch"),et=C("el-tooltip"),Le=C("el-input"),qe=C("el-checkbox"),Et=C("el-checkbox-group"),tt=C("el-popover"),bt=C("el-icon"),ua=C("el-option"),Fn=C("el-select"),Es=C("el-dialog");return d(),_("div",yhe,[l(za,{title:z.$t("Bulk Edit")},{action:i(()=>[l(fe,{type:"primary",onClick:M,loading:A.value,disabled:A.value||y.value===0},{default:i(()=>[R(h(A.value?z.$t("Saving %s/%s...").replace("%s",f.value.completed).replace("%s",f.value.total):y.value>0?z.$t("Save Changes")+` (${y.value})`:z.$t("Save Changes")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),A.value?(d(),E(Ue,{key:0,percentage:b.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),r("div",bhe,[l(he,null,{default:i(()=>[l(Ce,{border_bottom:""},{default:i(()=>[r("div",whe,[r("div",Che,[p(Pe).getTabsCount()&&!p(Pe).isUsingAdvanceFilter()?(d(),E(th,{key:0,class:de("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:p(Pe)},null,8,["table"])):x("",!0)]),r("div",Bhe,[p(Pe).isAdvanceFilterEnabled()?(d(),_("div",khe,[l(je,{class:"fct-advanced-filter-toggle",onChange:J[0]||(J[0]=ae=>{p(Pe).onFilterTypeChanged(ae)}),"active-value":"advanced","inactive-value":"simple",modelValue:p(Pe).data.filterType,"onUpdate:modelValue":J[1]||(J[1]=ae=>p(Pe).data.filterType=ae),"active-text":z.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):x("",!0),p(Pe).isUsingAdvanceFilter()?x("",!0):(d(),_("div",xhe,[p(Pe).isSearching()?x("",!0):(d(),E(et,{key:0,effect:"light",content:z.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{tag:"button",onClick:Xe(k,["prevent"])},{default:i(()=>[l(W,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),l(ah,{table:p(Pe)},null,8,["table"]),p(Pe).isSearching()&&!p(Pe).isUsingAdvanceFilter()?(d(),_("div",She,[r("div",Fhe,[l(Le,{ref:"search-input",onClear:J[2]||(J[2]=()=>{p(Pe).search()}),onKeyup:J[3]||(J[3]=Pa(()=>{p(Pe).search()},["enter"])),modelValue:p(Pe).data.search,"onUpdate:modelValue":J[4]||(J[4]=ae=>p(Pe).data.search=ae),type:"text",placeholder:z.$t("Search"),clearable:""},{prefix:i(()=>[l(W,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),r("div",Ehe,h(p(Pe).getSearchHint()),1)]),l(fe,{text:"",onClick:J[5]||(J[5]=()=>{p(Pe).closeSearch()})},{default:i(()=>[R(h(z.$t("Cancel")),1)]),_:1})])):x("",!0)]),_:1}),l(me,{class:"p-0"},{default:i(()=>[r("div",Uhe,[o.value.length>0?(d(),_("div",$he,[r("h5",Dhe,[R(h(o.value.length)+" "+h(o.value.length===1?z.$t("Product"):z.$t("Products"))+" ",1),m.value.total>o.value.length?(d(),_("span",Qhe,h(z.$t("of"))+" "+h(m.value.total)+" "+h(z.$t("total"))+" · "+h(B.value)+" "+h(z.$t("next")),1)):x("",!0)]),r("div",Ihe,[l(fe,{disabled:p($e)===0,onClick:st,size:"small"},{default:i(()=>[J[14]||(J[14]=r("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+h(z.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),l(fe,{disabled:p($e)===0,onClick:Ot,size:"small",type:"danger",plain:""},{default:i(()=>[J[15]||(J[15]=r("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("polyline",{points:"3 6 5 6 21 6"}),r("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+h(z.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),l(fe,{class:de({"is-active":p(Je)}),disabled:p($e)<2&&!p(Je),onClick:p(we),size:"small"},{default:i(()=>[J[16]||(J[16]=r("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),r("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+h(p(Je)?z.$t("Unlink"):z.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),l(qe,{modelValue:X.value,"onUpdate:modelValue":J[6]||(J[6]=ae=>X.value=ae),label:z.$t("Pin Actions")},null,8,["modelValue","label"]),l(tt,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:i(()=>[r("span",null,[l(et,{effect:"light",content:z.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:i(()=>[l(Oe,{tag:"button",size:"small"},{default:i(()=>[l(W,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:i(()=>[r("div",The,[r("h3",Vhe,h(z.$t("Columns")),1),l(Et,{modelValue:p(Pe).data.visibleColumns,"onUpdate:modelValue":J[7]||(J[7]=ae=>p(Pe).data.visibleColumns=ae),class:"fct-checkbox-blocks",onChange:J[8]||(J[8]=ae=>p(Pe).handleColumnVisibilityChange())},{default:i(()=>[(d(!0),_(H,null,ee(p(Pe).getToggleableColumns(),ae=>(d(),E(qe,{key:ae.value,value:ae.value,label:z.$t(ae.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):x("",!0),r("div",Mhe,[o.value.length>0?(d(),_("div",{key:0,class:de(["relative",{"is-link-mode":p(Je),"is-shift-held":_e.value}])},[l(Cm,{columns:Ht.value,"sticky-last":X.value,onScroll:Fs,onResizeEnd:da},{"header-first":i(()=>[Dt(l(qe,{checked:p($e)>0&&p($e)===Ye.value.length,onChange:J[9]||(J[9]=ae=>p(se)(Ye.value))},null,8,["checked"]),[[p(tme),p($e)>0&&p($e)<Ye.value.length]])]),"header-last":i(()=>[R(h(z.$t("Actions")),1)]),default:i(()=>[ga.value>0?(d(),_("tr",Lhe,[r("td",{colspan:Ht.value.length+1,style:ia({height:ga.value+"px",padding:0,border:"none"})},null,12,Rhe)])):x("",!0),(d(!0),_(H,null,ee(lt.value,ae=>{var it,Ba,nn,Ut,Se,Vn,Vu,Mu,Lu,Ru,Ou,Hu,Pu,Nu,Ku,Gu,ju,zu;return d(),_(H,{key:ae.productId},[r("tr",{class:de(["bulk-product-row",{"is-dirty":Q(ae.product),"is-saving":T(ae.product),"is-saved":D(ae.product),"has-product-error":P(ae.product),"is-selected":p(De)(`p:${ae.productId}`)}]),onClick:Ve=>Fe(`p:${ae.productId}`,Ve)},[r("td",{class:"bulk-checkbox-cell",onClick:Ve=>p(be)(`p:${ae.productId}`,Ve,Ye.value)},[l(qe,{"model-value":p(De)(`p:${ae.productId}`),tabindex:"-1"},null,8,["model-value"])],8,Hhe),r("td",Phe,[r("div",Nhe,[ae.hasVariants?(d(),_("button",{key:0,class:"bulk-collapse-btn",onClick:Xe(Ve=>ve(ae.product),["prevent"]),title:We(ae.product)?z.$t("Expand variants"):z.$t("Collapse variants")},[(d(),_("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":We(ae.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},J[17]||(J[17]=[r("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),We(ae.product)?(d(),_("span",Ghe,h(ae.variantCount),1)):x("",!0)],8,Khe)):x("",!0),l(Le,{class:de(["fct-bulk-input",{"is-error":N(ae.product,"post_title")}]),modelValue:ae.product.post_title,"onUpdate:modelValue":[Ve=>ae.product.post_title=Ve,Ve=>{$(ae.product),Ge("title",Ve,`p:${ae.productId}`)}],placeholder:z.$t("Product title"),disabled:U(ae.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),T(ae.product)?(d(),_("span",{key:1,class:"bulk-status-icon is-syncing",title:z.$t("Saving...")},[l(bt,{class:"is-loading",size:14},{default:i(()=>[l(p(_l))]),_:1})],8,jhe)):G(ae.product)||s(ae.product)&&P(ae.product)?(d(),E(et,{key:2,content:K(ae.product),placement:"top"},{default:i(()=>[r("span",zhe,[l(bt,{size:16},{default:i(()=>[l(p(ur))]),_:1})])]),_:2},1032,["content"])):Q(ae.product)?(d(),_("button",{key:3,class:"bulk-inline-save",disabled:U(ae.product),onClick:Xe(Ve=>Z(ae.product),["prevent"]),title:z.$t("Save")},J[18]||(J[18]=[r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",width:"16",height:"16"},[r("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,Yhe)):x("",!0)])]),pt("image")?(d(),_("td",qhe,[l(Bs,{modelValue:ae.product.gallery,"onUpdate:modelValue":Ve=>ae.product.gallery=Ve,onChange:Ve=>$(ae.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),pt("sku")?(d(),_("td",Whe,[((Ba=(it=ae.product)==null?void 0:it.detail)==null?void 0:Ba.variation_type)==="simple"&&((nn=ae.product.variants)!=null&&nn[0])?(d(),E(Le,{key:0,class:de(["fct-bulk-input",{"is-error":N(ae.product,"variants.0.sku")}]),modelValue:ae.product.variants[0].sku,"onUpdate:modelValue":[Ve=>ae.product.variants[0].sku=Ve,Ve=>{$(ae.product),Ge("sku",Ve,`p:${ae.productId}`)}],placeholder:"SKU",size:"small",disabled:U(ae.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(d(),_("span",Xhe,"—"))])):x("",!0),pt("categories")?(d(),_("td",Jhe,[l(Bm,{modelValue:ae.product.categories,"onUpdate:modelValue":Ve=>ae.product.categories=Ve,options:p(Pe).data.categoryOptions,disabled:U(ae.product),onChange:Ve=>{L(ae.product,Ve),Ge("categories",ae.product.categories,`p:${ae.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),pt("description")?(d(),_("td",Zhe,[l(Vr,{value:ae.product.post_content,placeholder:z.$t("Description"),onClick:Ve=>Bt(ae.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),pt("short_description")?(d(),_("td",e_e,[l(Vr,{value:ae.product.post_excerpt,placeholder:z.$t("Short description"),onClick:Ve=>Bt(ae.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),pt("status")?(d(),_("td",t_e,[l(Fn,{modelValue:ae.product.post_status,"onUpdate:modelValue":Ve=>ae.product.post_status=Ve,size:"small",class:de({"is-field-error":N(ae.product,"post_status")}),disabled:U(ae.product),onChange:Ve=>{$(ae.product),Ge("status",ae.product.post_status,`p:${ae.productId}`)}},{default:i(()=>[l(ua,{label:z.$t("Published"),value:"publish"},null,8,["label"]),l(ua,{label:z.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),pt("product_type")?(d(),_("td",a_e,[r("span",n_e,h(El((Se=(Ut=ae.product)==null?void 0:Ut.detail)==null?void 0:Se.fulfillment_type)),1)])):x("",!0),pt("pricing_type")?(d(),_("td",s_e,[r("span",l_e,h(mn((Vu=(Vn=ae.product)==null?void 0:Vn.detail)==null?void 0:Vu.variation_type)),1)])):x("",!0),pt("payment_type")?(d(),_("td",o_e,[l(Dr,{variant:s(ae.product)?(Mu=ae.product.variants)==null?void 0:Mu[0]:null,disabled:U(ae.product),"has-error":N(ae.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:Ve=>{var zt;F(ae.product,Ve),Ge("payment_type",(zt=Ve.other_info)==null?void 0:zt.payment_type,`p:${ae.productId}`)},onChange:Ve=>$(ae.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),pt("interval")?(d(),_("td",r_e,[l(Qr,{variant:s(ae.product)?(Lu=ae.product.variants)==null?void 0:Lu[0]:null,disabled:U(ae.product),"has-error":N(ae.product,"variants.0.other_info.repeat_interval"),onChange:Ve=>{var zt,qa,os;$(ae.product),Ge("interval",(os=(qa=(zt=ae.product.variants)==null?void 0:zt[0])==null?void 0:qa.other_info)==null?void 0:os.repeat_interval,`p:${ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("trial_days")?(d(),_("td",i_e,[l(Ir,{variant:s(ae.product)?(Ru=ae.product.variants)==null?void 0:Ru[0]:null,disabled:U(ae.product),"has-error":N(ae.product,"variants.0.other_info.trial_days"),onChange:Ve=>{var zt,qa,os;$(ae.product),Ge("trial_days",(os=(qa=(zt=ae.product.variants)==null?void 0:zt[0])==null?void 0:qa.other_info)==null?void 0:os.trial_days,`p:${ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("best_price")?(d(),_("td",d_e,[l($r,{variant:s(ae.product)?(Ou=ae.product.variants)==null?void 0:Ou[0]:null,disabled:U(ae.product),"has-error":N(ae.product,"variants.0.item_price"),onChange:Ve=>{var zt,qa;$(ae.product),Ge("price",(qa=(zt=ae.product.variants)==null?void 0:zt[0])==null?void 0:qa.item_price,`p:${ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("compare_price")?(d(),_("td",u_e,[l(Tr,{variant:s(ae.product)?(Hu=ae.product.variants)==null?void 0:Hu[0]:null,disabled:U(ae.product),"has-error":N(ae.product,"variants.0.compare_price"),onChange:Ve=>{var zt,qa;$(ae.product),Ge("compare_price",(qa=(zt=ae.product.variants)==null?void 0:zt[0])==null?void 0:qa.compare_price,`p:${ae.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("track_quantity")?(d(),_("td",c_e,[(Pu=ae.product)!=null&&Pu.detail?(d(),E(je,{key:0,modelValue:ae.product.detail.manage_stock,"onUpdate:modelValue":Ve=>ae.product.detail.manage_stock=Ve,"active-value":1,"inactive-value":0,disabled:U(ae.product),onChange:Ve=>{$(ae.product),p(Pe).syncStockStatus(ae.product),Ge("manage_stock",ae.product.detail.manage_stock,`p:${ae.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),pt("stock")?(d(),_("td",A_e,[(Ku=(Nu=ae.product)==null?void 0:Nu.detail)!=null&&Ku.manage_stock&&((ju=(Gu=ae.product)==null?void 0:Gu.detail)==null?void 0:ju.variation_type)==="simple"&&((zu=ae.product.variants)!=null&&zu[0])?(d(),E(Le,{key:0,class:"fct-bulk-input",placeholder:z.$t("e.g 10"),size:"small",modelValue:ae.product.variants[0].available,"onUpdate:modelValue":[Ve=>ae.product.variants[0].available=Ve,Ve=>{ae.product.variants[0].total_stock=Ve,$(ae.product),p(Pe).syncStockStatus(ae.product),Ge("stock",Ve,`p:${ae.productId}`)}],disabled:U(ae.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(d(),_("span",p_e,"—"))])):x("",!0),r("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":X.value}])},[r("div",f_e,[ae.product.view_url?(d(),E(Oe,{key:0,tag:"a",size:"x-small",href:ae.product.view_url,target:"_blank",title:z.$t("View Product")},{default:i(()=>[l(W,{name:"External"})]),_:2},1032,["href","title"])):x("",!0),l(Oe,{tag:"button",size:"x-small",onClick:Xe(Ve=>le(ae.product),["prevent"]),disabled:A.value||U(ae.product)||I(ae.product),title:z.$t("Duplicate")},{default:i(()=>[I(ae.product)?(d(),E(bt,{key:0,class:"is-loading",size:14},{default:i(()=>[l(p(_l))]),_:1})):(d(),E(W,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),l(Oe,{tag:"button",size:"x-small",hover:"danger",onClick:Xe(Ve=>Ct(ae.product),["prevent"]),disabled:A.value||U(ae.product)||O(ae.product),title:z.$t("Delete")},{default:i(()=>[O(ae.product)?(d(),E(bt,{key:0,class:"is-loading",size:14},{default:i(()=>[l(p(_l))]),_:1})):(d(),E(W,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,Ohe),ae.hasVariants?(d(),_("tr",m_e,[r("td",{colspan:Ht.value.length+1,class:"!p-0 !border-b-0"},[l(ra,{accordion:"",visible:!ae.collapsed,duration:200},{default:i(()=>[r("table",__e,[r("colgroup",null,[J[19]||(J[19]=r("col",{style:{width:"40px"}},null,-1)),(d(!0),_(H,null,ee(Ht.value,(Ve,zt)=>(d(),_("col",{key:zt,style:ia({width:Ve.width+"px"})},null,4))),128))]),r("tbody",null,[(d(!0),_(H,null,ee(ae.product.variants,(Ve,zt)=>{var qa,os;return d(),_("tr",{key:Ve.id||zt,class:de(["bulk-variation-row",{"is-selected":p(De)(`v:${Ve.id}`)}]),onClick:Lt=>Fe(`v:${Ve.id}`,Lt)},[r("td",v_e,[l(qe,{"model-value":p(De)(`v:${Ve.id}`),tabindex:"-1",onChange:Lt=>p(be)(`v:${Ve.id}`,Lt,Ye.value)},null,8,["model-value","onChange"])]),r("td",y_e,[r("div",b_e,[J[20]||(J[20]=r("span",{class:"text-gray-300 text-xs"},"└",-1)),l(Le,{size:"small",modelValue:Ve.variation_title,"onUpdate:modelValue":[Lt=>Ve.variation_title=Lt,Lt=>{$(ae.product),Ge("title",Lt,`v:${Ve.id}`)}],placeholder:z.$t("Variation title"),disabled:U(ae.product),class:de({"is-error":oe(ae.product,zt,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),ne(ae.product,zt)?(d(),E(et,{key:0,content:Y(ae.product,zt),placement:"top"},{default:i(()=>[r("span",w_e,[l(bt,{size:14},{default:i(()=>[l(p(ur))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),pt("image")?(d(),_("td",C_e,[l(Bs,{modelValue:Ve.media,"onUpdate:modelValue":Lt=>Ve.media=Lt,onChange:Lt=>$(ae.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),pt("sku")?(d(),_("td",B_e,[l(Le,{class:de(["fct-bulk-input",{"is-error":oe(ae.product,zt,"sku")}]),size:"small",modelValue:Ve.sku,"onUpdate:modelValue":[Lt=>Ve.sku=Lt,Lt=>{$(ae.product),Ge("sku",Lt,`v:${Ve.id}`)}],placeholder:z.$t("SKU"),disabled:U(ae.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):x("",!0),pt("categories")?(d(),_("td",k_e,J[21]||(J[21]=[r("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),pt("description")?(d(),_("td",x_e,J[22]||(J[22]=[r("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),pt("short_description")?(d(),_("td",S_e,J[23]||(J[23]=[r("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),pt("status")?(d(),_("td",F_e,J[24]||(J[24]=[r("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),pt("product_type")?(d(),_("td",E_e,J[25]||(J[25]=[r("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),pt("pricing_type")?(d(),_("td",U_e,J[26]||(J[26]=[r("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),pt("payment_type")?(d(),_("td",$_e,[l(Dr,{variant:Ve,disabled:U(ae.product),"has-error":oe(ae.product,zt,"other_info.payment_type"),onPaymentTypeChange:Lt=>{var rs;F(ae.product,Lt),Ge("payment_type",(rs=Lt.other_info)==null?void 0:rs.payment_type,`v:${Ve.id}`)},onChange:Lt=>$(ae.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),pt("interval")?(d(),_("td",D_e,[l(Qr,{variant:Ve,disabled:U(ae.product),"has-error":oe(ae.product,zt,"other_info.repeat_interval"),onChange:Lt=>{var rs;$(ae.product),Ge("interval",(rs=Ve.other_info)==null?void 0:rs.repeat_interval,`v:${Ve.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("trial_days")?(d(),_("td",Q_e,[l(Ir,{variant:Ve,disabled:U(ae.product),"has-error":oe(ae.product,zt,"other_info.trial_days"),onChange:Lt=>{var rs;$(ae.product),Ge("trial_days",(rs=Ve.other_info)==null?void 0:rs.trial_days,`v:${Ve.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("best_price")?(d(),_("td",I_e,[l($r,{variant:Ve,disabled:U(ae.product),"has-error":oe(ae.product,zt,"item_price"),onChange:Lt=>{$(ae.product),Ge("price",Ve.item_price,`v:${Ve.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("compare_price")?(d(),_("td",T_e,[l(Tr,{variant:Ve,disabled:U(ae.product),"has-error":oe(ae.product,zt,"compare_price"),onChange:Lt=>{$(ae.product),Ge("compare_price",Ve.compare_price,`v:${Ve.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),pt("track_quantity")?(d(),_("td",V_e,J[27]||(J[27]=[r("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),pt("stock")?(d(),_("td",M_e,[(os=(qa=ae.product)==null?void 0:qa.detail)!=null&&os.manage_stock?(d(),E(Le,{key:0,class:"fct-bulk-input",placeholder:z.$t("e.g 10"),size:"small",modelValue:Ve.available,"onUpdate:modelValue":[Lt=>Ve.available=Lt,Lt=>{Ve.total_stock=Lt,$(ae.product),p(Pe).syncStockStatus(ae.product),Ge("stock",Lt,`v:${Ve.id}`)}],disabled:U(ae.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(d(),_("span",L_e,"—"))])):x("",!0),r("td",{class:de(["text-center",{"sticky-col sticky-col-right":X.value}])},[r("div",R_e,[l(Oe,{tag:"button",size:"x-small",onClick:Xe(Lt=>te(ae.product,Ve),["prevent"]),disabled:A.value||U(ae.product),title:z.$t("Duplicate")},{default:i(()=>[l(W,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),l(Oe,{tag:"button",size:"x-small",hover:"danger",onClick:Xe(Lt=>yt(ae.product,Ve),["prevent"]),disabled:A.value||U(ae.product),title:z.$t("Delete")},{default:i(()=>[l(W,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,g_e)}),128))])])]),_:2},1032,["visible"])],8,h_e)])):x("",!0)],64)}),128)),va.value>0?(d(),_("tr",O_e,[r("td",{colspan:Ht.value.length+1,style:ia({height:va.value+"px",padding:0,border:"none"})},null,12,H_e)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):u.value?u.value?(d(),_("div",K_e,[l(bt,{class:"is-loading mr-2"},{default:i(()=>J[28]||(J[28]=[r("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),r("span",G_e,h(z.$t("Loading products...")),1)])):x("",!0):(d(),_("div",P_e,[r("p",N_e,h(z.$t("No products found.")),1)]))]),m.value.hasMore&&o.value.length>0&&u.value?(d(),_("div",j_e,[l(bt,{class:"is-loading mr-2"},{default:i(()=>J[29]||(J[29]=[r("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),r("span",z_e,h(z.$t("Loading"))+" "+h(B.value)+" "+h(z.$t("more...")),1)])):x("",!0)])]),_:1})]),_:1})]),l(Es,{modelValue:Ze.value.visible,"onUpdate:modelValue":J[12]||(J[12]=ae=>Ze.value.visible=ae),title:kt.value,width:"700px","close-on-click-modal":!1,onClosed:J[13]||(J[13]=ae=>Ze.value.product=null)},{footer:i(()=>[l(fe,{onClick:J[11]||(J[11]=ae=>Ze.value.visible=!1)},{default:i(()=>[R(h(z.$t("Cancel")),1)]),_:1}),l(fe,{type:"primary",onClick:Ft},{default:i(()=>[R(h(z.$t("Save")),1)]),_:1})]),default:i(()=>[Ze.value.visible&&Ze.value.field==="post_content"?(d(),E(ts,{key:0,"model-value":Ze.value.value,height:300,onUpdate:ht},null,8,["model-value"])):x("",!0),Ze.value.visible&&Ze.value.field==="post_excerpt"?(d(),E(Le,{key:1,modelValue:Ze.value.value,"onUpdate:modelValue":J[10]||(J[10]=ae=>Ze.value.value=ae),type:"textarea",rows:6,placeholder:z.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}},Fm=Ie.get("payment_routes");for(const e of Fm)e.props=!0;const X_e=Ie.get("storage_driver_routes"),Em=(X_e||[]).filter(e=>e.name!=="s3");for(const e of Em)e.props=!0;var J_e={dashboard:{name:"dashboard",path:"/",component:I8,meta:{active_menu:"dashboard",title:"Dashboard"}},orders:{path:"/orders",component:IE,meta:{active_menu:"orders",title:"Orders"},children:[{name:"orders",path:"",component:sv,meta:{active_menu:"orders",title:"Orders",permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:lT,props:!0,meta:{active_menu:"orders",title:"View Order",permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:VT,props:!0,meta:{active_menu:"orders",title:"Create Order",permission:"orders/create"}}]},products:{name:"products",path:"/products",component:$7,meta:{active_menu:"products",title:"Products",permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:xV,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:SN,meta:{active_menu:"products",title:"Product Edit",permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:kA,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:rA,meta:{active_menu:"products",title:"Edit Integration",permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:VK,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:mK,meta:{active_menu:"products",title:"Upgrade Paths",permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:kA,meta:{active_menu:"integrations",title:"Product Integrations",permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:ghe,meta:{active_menu:"products",title:"Product Bulk Insert",permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:W_e,meta:{active_menu:"products",title:"Product Bulk Edit",permission:"products/edit"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:fz,meta:{active_menu:"products",title:"Inventory",permission:"products/view"}},customers:{path:"/customers",component:x1,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:K_,meta:{active_menu:"customers",title:"Customers",permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:f5,props:!0,meta:{active_menu:"customers",title:"View Customer",permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:kW,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:yoe,meta:{title:"Overview",permission:"reports/view"}},{name:"reports_sales",path:"sales",component:tX,meta:{title:"Sales",permission:"reports/view"}},{name:"reports_orders",path:"orders",component:_ee,meta:{title:"Orders",permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:XX,meta:{title:"Revenue",permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:ete,meta:{title:"Refunds",permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:jte,meta:{title:"Subscriptions",permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:one,meta:{title:"Retention",permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>It(()=>import("./chunks/Cohort.js?ver=1.4.1"),[],import.meta.url),meta:{title:"Cohorts",permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:cae,meta:{title:"Future Renewals",permission:"reports/view"}},{name:"reports_products",path:"products",component:Sle,meta:{title:"Product",permission:"reports/view"}},{name:"reports_customer",path:"customer",component:$ne,meta:{title:"Customer",permission:"reports/view"}},{name:"reports_sources",path:"sources",component:sse,meta:{title:"Sources",permission:"reports/view"}}]},settings:{path:"/settings",component:o$,meta:{active_menu:"settings",title:"Settings",permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:zT,meta:{active_menu:"settings",title:"Settings",permission:"store/settings"},children:[{name:"store_setup",path:"",component:ol,meta:{title:"Store Setup"}},{name:"pages_setup",path:"pages_setup",component:ol,meta:{title:"Pages Setup"}},{name:"single_product_setup",path:"single_product_setup",component:ol,meta:{title:"Product Page"}},{name:"cart_and_checkout",path:"cart_and_checkout",component:ol,meta:{title:"Cart & Checkout"}},{name:"subscriptions_setup",path:"subscriptions",component:ol,meta:{title:"Subscriptions"}},{name:"checkout_fields",path:"checkout_fields",component:ufe,meta:{}}]},{name:"email_notifications",path:"email_notifications",component:Mz,meta:{active_menu:"settings",title:"Notifications",permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:mre,meta:{active_menu:"settings",title:"Mailing Settings",permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:ol,meta:{active_menu:"settings",title:"Reminders",permission:"store/sensitive"}},{name:"email_digest_settings",path:"email_digest_settings",component:Cre,meta:{active_menu:"settings",title:"Store Digest",permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:uY,meta:{active_menu:"settings",title:"Edit Notification",permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:QY,meta:{active_menu:"settings",title:"Add Notification",permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:hV,meta:{active_menu:"settings",title:"Licensing",permission:"store/sensitive"}},{name:"payments",path:"payments",component:$U,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"gateway",component:QS,path:"payments",children:Fm,props:!0,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:uv,meta:{active_menu:"settings",title:"Invoice & Packing",permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:yv,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:Mv,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:w1,meta:{active_menu:"settings",title:"PDF Template Settings",permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:a1,props:!0,meta:{active_menu:"settings",title:"Edit PDF Template",permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:JU,meta:{active_menu:"settings",title:"Role Settings",permission:"is_super_admin"}},{name:"addons",path:"addons",component:Roe,meta:{active_menu:"settings",title:"Features & addon",permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:QA,meta:{active_menu:"coupons",title:"Coupons Settings",permission:"is_super_admin"}},{name:"storage",path:"storage",component:kY,meta:{active_menu:"settings",title:"Storage Providers",permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:SA,props:!0,meta:{active_menu:"settings",title:"S3",permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:LS,meta:{active_menu:"settings",title:"Gateway",permission:"is_super_admin"},props:!0},{name:"drivers",component:SA,path:"storage",children:Em,props:!0,meta:{active_menu:"settings",title:"Storage Settings",permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:xre,meta:{active_menu:"settings",title:"Tax Settings",permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:Qie,meta:{}},{name:"tax_rates",path:"tax_rates",component:qie,meta:{}},{name:"eu",path:"eu",component:wAe,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:DA,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:DA,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:Yx,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:rA,meta:{active_menu:"integrations",title:"Global Integrations",permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:iF,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:QA,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/view"}},logs:{name:"logs",path:"/logs",component:yq,meta:{active_menu:"logs",title:"Logs",permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:bue,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:Npe,props:!0,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:DE,name:"onboarding",meta:{active_menu:"dashboard",title:"Onboarding",permission:"is_super_admin"}}};const Z_e={class:"fct-theme-button-container"},ege={class:"theme-selected-button"},tge={__name:"ThemeToggle",setup(e){const t=V(ke.MODE_LIGHT),a=u=>{t.value!==u&&(t.value=u,ke.apply(u))},n=[{value:"light",label:c("Light"),icon:"Sun"},{value:"dark",label:c("Dark"),icon:"Moon"},{value:"system",label:c("System"),icon:"Tools"}];Ks(()=>{const u=document.getElementById("theme-button-container");if(u){const A=u.querySelector(".fct-theme-button-container");A&&A.remove()}t.value=ke.getCurrentTheme(),t.value.toString().startsWith(ke.MODE_SYSTEM)&&(t.value=ke.MODE_SYSTEM)});const s=u=>{ye(()=>{t.value=ke.getCurrentTheme()})},o=u=>{a(u)};return Be(()=>{window.addEventListener(ke.THEME_CHANGE_EVENT,s,!1)}),xn(()=>{window.removeEventListener(ke.THEME_CHANGE_EVENT,s,!1)}),(u,A)=>{const f=C("el-dropdown-item"),m=C("el-dropdown-menu"),g=C("el-dropdown");return d(),_("div",Z_e,[l(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:o},{dropdown:i(()=>[l(m,null,{default:i(()=>[(d(),_(H,null,ee(n,y=>l(f,{key:y.value,command:y.value,class:de({active:t.value===y.value})},{default:i(()=>[l(W,{name:y.icon},null,8,["name"]),R(" "+h(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:i(()=>[r("div",ege,[t.value==="light"?(d(),E(W,{key:0,name:"Sun"})):t.value==="dark"?(d(),E(W,{key:1,name:"Moon"})):t.value==="system"?(d(),E(W,{key:2,name:"Tools"})):x("",!0)])]),_:1})])}}};function ss(e){return Array.isArray?Array.isArray(e):Dm(e)==="[object Array]"}function age(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function nge(e){return e==null?"":age(e)}function On(e){return typeof e=="string"}function Um(e){return typeof e=="number"}function sge(e){return e===!0||e===!1||lge(e)&&Dm(e)=="[object Boolean]"}function $m(e){return typeof e=="object"}function lge(e){return $m(e)&&e!==null}function dn(e){return e!=null}function Xi(e){return!e.trim().length}function Dm(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const oge="Incorrect 'index' type",rge=e=>`Invalid value for key ${e}`,ige=e=>`Pattern length exceeds max of ${e}.`,dge=e=>`Missing ${e} property in key`,uge=e=>`Property 'weight' in key '${e}' must be a positive integer`,RA=Object.prototype.hasOwnProperty;class cge{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(n=>{let s=Qm(n);this._keys.push(s),this._keyMap[s.id]=s,a+=s.weight}),this._keys.forEach(n=>{n.weight/=a})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Qm(e){let t=null,a=null,n=null,s=1,o=null;if(On(e)||ss(e))n=e,t=OA(e),a=Md(e);else{if(!RA.call(e,"name"))throw new Error(dge("name"));const u=e.name;if(n=u,RA.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(uge(u));t=OA(u),a=Md(u),o=e.getFn}return{path:t,id:a,weight:s,src:n,getFn:o}}function OA(e){return ss(e)?e:e.split(".")}function Md(e){return ss(e)?e.join("."):e}function Age(e,t){let a=[],n=!1;const s=(o,u,A)=>{if(dn(o))if(!u[A])a.push(o);else{let f=u[A];const m=o[f];if(!dn(m))return;if(A===u.length-1&&(On(m)||Um(m)||sge(m)))a.push(nge(m));else if(ss(m)){n=!0;for(let g=0,y=m.length;g<y;g+=1)s(m[g],u,A+1)}else u.length&&s(m,u,A+1)}};return s(e,On(t)?t.split("."):t,0),n?a:a[0]}const pge={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},fge={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},mge={location:0,threshold:.6,distance:100},hge={useExtendedSearch:!1,getFn:Age,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var ct={...fge,...pge,...mge,...hge};const _ge=/[^ ]+/g;function gge(e=1,t=3){const a=new Map,n=Math.pow(10,t);return{get(s){const o=s.match(_ge).length;if(a.has(o))return a.get(o);const u=1/Math.pow(o,.5*e),A=parseFloat(Math.round(u*n)/n);return a.set(o,A),A},clear(){a.clear()}}}class Qu{constructor({getFn:t=ct.getFn,fieldNormWeight:a=ct.fieldNormWeight}={}){this.norm=gge(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,n)=>{this._keysMap[a.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,On(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();On(t)?this._addString(t,a):this._addObject(t,a)}removeAt(t){this.records.splice(t,1);for(let a=t,n=this.size();a<n;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(t,a){return t[this._keysMap[a]]}size(){return this.records.length}_addString(t,a){if(!dn(t)||Xi(t))return;let n={v:t,i:a,n:this.norm.get(t)};this.records.push(n)}_addObject(t,a){let n={i:a,$:{}};this.keys.forEach((s,o)=>{let u=s.getFn?s.getFn(t):this.getFn(t,s.path);if(dn(u)){if(ss(u)){let A=[];const f=[{nestedArrIndex:-1,value:u}];for(;f.length;){const{nestedArrIndex:m,value:g}=f.pop();if(dn(g))if(On(g)&&!Xi(g)){let y={v:g,i:m,n:this.norm.get(g)};A.push(y)}else ss(g)&&g.forEach((y,v)=>{f.push({nestedArrIndex:v,value:y})})}n.$[o]=A}else if(On(u)&&!Xi(u)){let A={v:u,n:this.norm.get(u)};n.$[o]=A}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Im(e,t,{getFn:a=ct.getFn,fieldNormWeight:n=ct.fieldNormWeight}={}){const s=new Qu({getFn:a,fieldNormWeight:n});return s.setKeys(e.map(Qm)),s.setSources(t),s.create(),s}function vge(e,{getFn:t=ct.getFn,fieldNormWeight:a=ct.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new Qu({getFn:t,fieldNormWeight:a});return o.setKeys(n),o.setIndexRecords(s),o}function qo(e,{errors:t=0,currentLocation:a=0,expectedLocation:n=0,distance:s=ct.distance,ignoreLocation:o=ct.ignoreLocation}={}){const u=t/e.length;if(o)return u;const A=Math.abs(n-a);return s?u+A/s:A?1:u}function yge(e=[],t=ct.minMatchCharLength){let a=[],n=-1,s=-1,o=0;for(let u=e.length;o<u;o+=1){let A=e[o];A&&n===-1?n=o:!A&&n!==-1&&(s=o-1,s-n+1>=t&&a.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&a.push([n,o-1]),a}const Vs=32;function bge(e,t,a,{location:n=ct.location,distance:s=ct.distance,threshold:o=ct.threshold,findAllMatches:u=ct.findAllMatches,minMatchCharLength:A=ct.minMatchCharLength,includeMatches:f=ct.includeMatches,ignoreLocation:m=ct.ignoreLocation}={}){if(t.length>Vs)throw new Error(ige(Vs));const g=t.length,y=e.length,v=Math.max(0,Math.min(n,y));let B=o,b=v;const w=A>1||f,k=w?Array(y):[];let S;for(;(S=e.indexOf(t,b))>-1;){let T=qo(t,{currentLocation:S,expectedLocation:v,distance:s,ignoreLocation:m});if(B=Math.min(T,B),b=S+g,w){let D=0;for(;D<g;)k[S+D]=1,D+=1}}b=-1;let M=[],$=1,F=g+y;const L=1<<g-1;for(let T=0;T<g;T+=1){let D=0,U=F;for(;D<U;)qo(t,{errors:T,currentLocation:v+U,expectedLocation:v,distance:s,ignoreLocation:m})<=B?D=U:F=U,U=Math.floor((F-D)/2+D);F=U;let I=Math.max(1,v-U+1),O=u?y:Math.min(v+U,y)+g,P=Array(O+2);P[O+1]=(1<<T)-1;for(let G=O;G>=I;G-=1){let ne=G-1,Y=a[e.charAt(ne)];if(w&&(k[ne]=+!!Y),P[G]=(P[G+1]<<1|1)&Y,T&&(P[G]|=(M[G+1]|M[G])<<1|1|M[G+1]),P[G]&L&&($=qo(t,{errors:T,currentLocation:ne,expectedLocation:v,distance:s,ignoreLocation:m}),$<=B)){if(B=$,b=ne,b<=v)break;I=Math.max(1,2*v-b)}}if(qo(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:s,ignoreLocation:m})>B)break;M=P}const Q={isMatch:b>=0,score:Math.max(.001,$)};if(w){const T=yge(k,A);T.length?f&&(Q.indices=T):Q.isMatch=!1}return Q}function wge(e){let t={};for(let a=0,n=e.length;a<n;a+=1){const s=e.charAt(a);t[s]=(t[s]||0)|1<<n-a-1}return t}const Mr=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class Tm{constructor(t,{location:a=ct.location,threshold:n=ct.threshold,distance:s=ct.distance,includeMatches:o=ct.includeMatches,findAllMatches:u=ct.findAllMatches,minMatchCharLength:A=ct.minMatchCharLength,isCaseSensitive:f=ct.isCaseSensitive,ignoreDiacritics:m=ct.ignoreDiacritics,ignoreLocation:g=ct.ignoreLocation}={}){if(this.options={location:a,threshold:n,distance:s,includeMatches:o,findAllMatches:u,minMatchCharLength:A,isCaseSensitive:f,ignoreDiacritics:m,ignoreLocation:g},t=f?t:t.toLowerCase(),t=m?Mr(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(B,b)=>{this.chunks.push({pattern:B,alphabet:wge(B),startIndex:b})},v=this.pattern.length;if(v>Vs){let B=0;const b=v%Vs,w=v-b;for(;B<w;)y(this.pattern.substr(B,Vs),B),B+=Vs;if(b){const k=v-Vs;y(this.pattern.substr(k),k)}}else y(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:n,includeMatches:s}=this.options;if(t=a?t:t.toLowerCase(),t=n?Mr(t):t,this.pattern===t){let w={isMatch:!0,score:0};return s&&(w.indices=[[0,t.length-1]]),w}const{location:o,distance:u,threshold:A,findAllMatches:f,minMatchCharLength:m,ignoreLocation:g}=this.options;let y=[],v=0,B=!1;this.chunks.forEach(({pattern:w,alphabet:k,startIndex:S})=>{const{isMatch:M,score:$,indices:F}=bge(t,w,k,{location:o+S,distance:u,threshold:A,findAllMatches:f,minMatchCharLength:m,includeMatches:s,ignoreLocation:g});M&&(B=!0),v+=$,M&&F&&(y=[...y,...F])});let b={isMatch:B,score:B?v/this.chunks.length:1};return B&&s&&(b.indices=y),b}}class Ss{constructor(t){this.pattern=t}static isMultiMatch(t){return HA(t,this.multiRegex)}static isSingleMatch(t){return HA(t,this.singleRegex)}search(){}}function HA(e,t){const a=e.match(t);return a?a[1]:null}class Cge extends Ss{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 Bge extends Ss{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class kge extends Ss{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 xge extends Ss{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 Sge extends Ss{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 Fge extends Ss{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 Vm extends Ss{constructor(t,{location:a=ct.location,threshold:n=ct.threshold,distance:s=ct.distance,includeMatches:o=ct.includeMatches,findAllMatches:u=ct.findAllMatches,minMatchCharLength:A=ct.minMatchCharLength,isCaseSensitive:f=ct.isCaseSensitive,ignoreDiacritics:m=ct.ignoreDiacritics,ignoreLocation:g=ct.ignoreLocation}={}){super(t),this._bitapSearch=new Tm(t,{location:a,threshold:n,distance:s,includeMatches:o,findAllMatches:u,minMatchCharLength:A,isCaseSensitive:f,ignoreDiacritics:m,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Mm extends Ss{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let a=0,n;const s=[],o=this.pattern.length;for(;(n=t.indexOf(this.pattern,a))>-1;)a=n+o,s.push([n,a-1]);const u=!!s.length;return{isMatch:u,score:u?0:1,indices:s}}}const Ld=[Cge,Mm,kge,xge,Fge,Sge,Bge,Vm],PA=Ld.length,Ege=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Uge="|";function $ge(e,t={}){return e.split(Uge).map(a=>{let n=a.trim().split(Ege).filter(o=>o&&!!o.trim()),s=[];for(let o=0,u=n.length;o<u;o+=1){const A=n[o];let f=!1,m=-1;for(;!f&&++m<PA;){const g=Ld[m];let y=g.isMultiMatch(A);y&&(s.push(new g(y,t)),f=!0)}if(!f)for(m=-1;++m<PA;){const g=Ld[m];let y=g.isSingleMatch(A);if(y){s.push(new g(y,t));break}}}return s})}const Dge=new Set([Vm.type,Mm.type]);class Qge{constructor(t,{isCaseSensitive:a=ct.isCaseSensitive,ignoreDiacritics:n=ct.ignoreDiacritics,includeMatches:s=ct.includeMatches,minMatchCharLength:o=ct.minMatchCharLength,ignoreLocation:u=ct.ignoreLocation,findAllMatches:A=ct.findAllMatches,location:f=ct.location,threshold:m=ct.threshold,distance:g=ct.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:n,includeMatches:s,minMatchCharLength:o,findAllMatches:A,ignoreLocation:u,location:f,threshold:m,distance:g},t=a?t:t.toLowerCase(),t=n?Mr(t):t,this.pattern=t,this.query=$ge(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:n,isCaseSensitive:s,ignoreDiacritics:o}=this.options;t=s?t:t.toLowerCase(),t=o?Mr(t):t;let u=0,A=[],f=0;for(let m=0,g=a.length;m<g;m+=1){const y=a[m];A.length=0,u=0;for(let v=0,B=y.length;v<B;v+=1){const b=y[v],{isMatch:w,indices:k,score:S}=b.search(t);if(w){if(u+=1,f+=S,n){const M=b.constructor.type;Dge.has(M)?A=[...A,...k]:A.push(k)}}else{f=0,u=0,A.length=0;break}}if(u){let v={isMatch:!0,score:f/u};return n&&(v.indices=A),v}}return{isMatch:!1,score:1}}}const Rd=[];function Ige(...e){Rd.push(...e)}function Od(e,t){for(let a=0,n=Rd.length;a<n;a+=1){let s=Rd[a];if(s.condition(e,t))return new s(e,t)}return new Tm(e,t)}const Lr={AND:"$and",OR:"$or"},Hd={PATH:"$path",PATTERN:"$val"},Pd=e=>!!(e[Lr.AND]||e[Lr.OR]),Tge=e=>!!e[Hd.PATH],Vge=e=>!ss(e)&&$m(e)&&!Pd(e),NA=e=>({[Lr.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Lm(e,t,{auto:a=!0}={}){const n=s=>{let o=Object.keys(s);const u=Tge(s);if(!u&&o.length>1&&!Pd(s))return n(NA(s));if(Vge(s)){const f=u?s[Hd.PATH]:o[0],m=u?s[Hd.PATTERN]:s[f];if(!On(m))throw new Error(rge(f));const g={keyId:Md(f),pattern:m};return a&&(g.searcher=Od(m,t)),g}let A={children:[],operator:o[0]};return o.forEach(f=>{const m=s[f];ss(m)&&m.forEach(g=>{A.children.push(n(g))})}),A};return Pd(e)||(e=NA(e)),n(e)}function Mge(e,{ignoreFieldNorm:t=ct.ignoreFieldNorm}){e.forEach(a=>{let n=1;a.matches.forEach(({key:s,norm:o,score:u})=>{const A=s?s.weight:null;n*=Math.pow(u===0&&A?Number.EPSILON:u,(A||1)*(t?1:o))}),a.score=n})}function Lge(e,t){const a=e.matches;t.matches=[],dn(a)&&a.forEach(n=>{if(!dn(n.indices)||!n.indices.length)return;const{indices:s,value:o}=n;let u={indices:s,value:o};n.key&&(u.key=n.key.src),n.idx>-1&&(u.refIndex=n.idx),t.matches.push(u)})}function Rge(e,t){t.score=e.score}function Oge(e,t,{includeMatches:a=ct.includeMatches,includeScore:n=ct.includeScore}={}){const s=[];return a&&s.push(Lge),n&&s.push(Rge),e.map(o=>{const{idx:u}=o,A={item:t[u],refIndex:u};return s.length&&s.forEach(f=>{f(o,A)}),A})}class Fl{constructor(t,a={},n){this.options={...ct,...a},this.options.useExtendedSearch,this._keyStore=new cge(this.options.keys),this.setCollection(t,n)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof Qu))throw new Error(oge);this._myIndex=a||Im(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){dn(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const a=[];for(let n=0,s=this._docs.length;n<s;n+=1){const o=this._docs[n];t(o,n)&&(this.removeAt(n),n-=1,s-=1,a.push(o))}return a}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:a=-1}={}){const{includeMatches:n,includeScore:s,shouldSort:o,sortFn:u,ignoreFieldNorm:A}=this.options;let f=On(t)?On(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Mge(f,{ignoreFieldNorm:A}),o&&f.sort(u),Um(a)&&a>-1&&(f=f.slice(0,a)),Oge(f,this._docs,{includeMatches:n,includeScore:s})}_searchStringList(t){const a=Od(t,this.options),{records:n}=this._myIndex,s=[];return n.forEach(({v:o,i:u,n:A})=>{if(!dn(o))return;const{isMatch:f,score:m,indices:g}=a.searchIn(o);f&&s.push({item:o,idx:u,matches:[{score:m,value:o,norm:A,indices:g}]})}),s}_searchLogical(t){const a=Lm(t,this.options),n=(A,f,m)=>{if(!A.children){const{keyId:y,searcher:v}=A,B=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(f,y),searcher:v});return B&&B.length?[{idx:m,item:f,matches:B}]:[]}const g=[];for(let y=0,v=A.children.length;y<v;y+=1){const B=A.children[y],b=n(B,f,m);if(b.length)g.push(...b);else if(A.operator===Lr.AND)return[]}return g},s=this._myIndex.records,o={},u=[];return s.forEach(({$:A,i:f})=>{if(dn(A)){let m=n(a,A,f);m.length&&(o[f]||(o[f]={idx:f,item:A,matches:[]},u.push(o[f])),m.forEach(({matches:g})=>{o[f].matches.push(...g)}))}}),u}_searchObjectList(t){const a=Od(t,this.options),{keys:n,records:s}=this._myIndex,o=[];return s.forEach(({$:u,i:A})=>{if(!dn(u))return;let f=[];n.forEach((m,g)=>{f.push(...this._findMatches({key:m,value:u[g],searcher:a}))}),f.length&&o.push({idx:A,item:u,matches:f})}),o}_findMatches({key:t,value:a,searcher:n}){if(!dn(a))return[];let s=[];if(ss(a))a.forEach(({v:o,i:u,n:A})=>{if(!dn(o))return;const{isMatch:f,score:m,indices:g}=n.searchIn(o);f&&s.push({score:m,key:t,value:o,idx:u,norm:A,indices:g})});else{const{v:o,n:u}=a,{isMatch:A,score:f,indices:m}=n.searchIn(o);A&&s.push({score:f,key:t,value:o,norm:u,indices:m})}return s}}Fl.version="7.1.0";Fl.createIndex=Im;Fl.parseIndex=vge;Fl.config=ct;Fl.parseQuery=Lm;Ige(Qge);const Hge=(Ie.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:c("Manage %1$s",t),path:"/settings/payments/"+e.path}}),Pge=[{title:c("Dashboard"),path:"/"},{title:c("Orders"),path:"/orders"},{title:c("Create Order"),path:"/orders/add"},{title:c("Customers"),path:"/customers"},{title:c("Products"),path:"/products"},{title:c("Product Inventory"),path:"/products/inventory"},{title:c("Bulk Import Products"),path:"/products/bulk-insert"},{title:c("Integrations"),path:"/integrations"},{title:c("Coupons"),path:"/coupons"},{title:c("Logs"),path:"/logs"},{title:c("Taxes"),path:"/taxes"},{title:c("Reports"),path:"/reports/overview"},{title:c("Sales Report"),path:"/reports/sales"},{title:c("Orders Report"),path:"/reports/orders"},{title:c("Revenue Report"),path:"/reports/revenue"},{title:c("Refunds Report"),path:"/reports/refunds"},{title:c("Subscriptions Report"),path:"/reports/subscriptions"},{title:c("Future Renewals Report"),path:"/reports/subscriptions/future-renewals"},{title:c("Product Report"),path:"/reports/products"},{title:c("Customer Report"),path:"/reports/customer"},{title:c("Traffic Sources Report"),path:"/reports/sources"},...Hge],Nge=Pge.map(({title:e,subtitle:t,path:a})=>({title:e,...t?{subtitle:t}:{},data:{type:"action",action:({router:n})=>{n.push({path:a})},show_description:!1}})),Kge=[{title:"Theme",title_resolver:()=>{let t=(ke.isDark()?"dark":"light")==="light"?c("Dark"):c("Light");return c("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(ke.isDark()?"dark":"light")==="light"?"dark":"light";ke.apply(t,{fromShortcut:!0})}}}],KA={"/settings/store-settings":c("Store Setup"),"/settings/store-settings/pages_setup":c("Pages Setup"),"/settings/store-settings/single_product_setup":c("Single Product & Order Setup"),"/settings/store-settings/cart_and_checkout":c("Cart and Checkout"),"/settings/store-settings/subscriptions":c("Subscriptions Setup"),"/settings/store-settings/checkout_fields":c("Checkout Fields"),"/settings/email_notifications":c("Email Notifications"),"/settings/email_mailing_settings":c("Mailing Settings"),"/settings/email_mailing_settings/reminders":c("Reminders"),"/settings/licensing":c("Licensing"),"/settings/payments":c("Payment Settings"),"/settings/invoice-packing":c("Invoice & Packing Slips"),"/settings/pdf-template":c("PDF Templates"),"/settings/roles":c("Role Settings"),"/settings/addons":c("Features & Addons"),"/settings/tax_settings":c("Tax Settings"),"/settings/tax_settings/tax_rates":c("Tax Rates"),"/settings/tax_settings/eu":c("EU VAT Settings"),"/settings/storage":c("Storage Providers"),"/settings/coupons":c("Coupon Settings")};let Rm=[];Object.keys(KA).forEach(e=>{const t=KA[e];Rm.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:c("Go to %1$s",t),show_description:!1}})});const Gge=[],jge={Menu:Nge,Actions:Kge,Settings:Rm,Shortcuts:Gge},Nd=[];Object.entries(jge).forEach(([e,t])=>{t.forEach((a,n)=>{Nd.push({...a,id:`${e.toString().toLowerCase()}-${n}`,group:[e]})})});const zge=()=>({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}]}),Yge={class:"navigable-list-container fct-global-search-result-container"},qge={key:0,class:"no-results fct-global-search-result-not-found"},Wge={key:1},Xge=["tabindex","onClick","onKeydown"],Jge={__name:"NavigableList",props:{items:{type:Array,required:!0,default:()=>[]},noResultsText:{type:String,default:c("No results found")},onAction:{type:Function,required:!0}},setup(e,{expose:t}){const a=e,n=V(-1),s=zd("listContainer"),o=V({}),u=(b,w)=>{w&&(o.value[b]=w)},A=b=>{const w=a.items.length;if(w===0)return;const k=w-1;b==="up"?n.value=n.value<=0?k:n.value-1:b==="down"&&(n.value=n.value>=k?0:n.value+1),f()},f=()=>{const b=s.value,w=o.value[n.value];w&&b&&(w.scrollIntoView({behavior:"smooth",block:"nearest"}),ye(()=>{w.focus()}))},m=b=>{n.value=b,g(b)},g=b=>{b>=0&&b<a.items.length&&a.onAction(a.items[b],b)},y=()=>{n.value=-1};return t({focusList:b=>{b=b??a.items.length-1,b>=0&&(n.value=b,ye(()=>{o.value[b]&&o.value[b].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(n.value=0,setTimeout(()=>{g(0)},200)):n.value=-1}}),ge(()=>a.items,b=>{y(),b.length>0&&ye(()=>{})},{immediate:!0}),ge(n,()=>{}),(b,w)=>(d(),_("div",Yge,[e.items.length===0?(d(),_("div",qge,[l(W,{name:"Empty/GlobalSearch"}),R(" "+h(e.noResultsText),1)])):(d(),_("div",Wge,[r("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(d(!0),_(H,null,ee(e.items,(k,S)=>(d(),_("li",{key:S,ref_for:!0,ref:M=>u(S,M),class:de({selected:S===n.value}),tabindex:S,onClick:M=>m(S),onKeydown:[w[0]||(w[0]=Pa(Xe(M=>A("up"),["prevent"]),["arrow-up"])),w[1]||(w[1]=Pa(Xe(M=>A("down"),["prevent"]),["arrow-down"])),Pa(M=>g(S),["enter"])]},[oa(b.$slots,"default",{item:k,index:S,isSelected:S===n.value},void 0,!0)],42,Xge))),128))],512)]))]))}},Kd=He(Jge,[["__scopeId","data-v-2379fe26"]]),Zge={class:"fct-search-result-label"},eve={class:"fct-search-result-title"},tve={key:0,class:"fct-search-result-subtitle"},ave={key:1,class:"fct-search-result-subtitle"},nve={class:"action-icon"},sve={class:"recent-search-title"},lve={class:"fct-search-result-label"},ove={class:"fct-search-result-title"},rve={key:0,class:"fct-search-result-subtitle"},ive={key:1,class:"fct-search-result-subtitle"},dve={class:"action-icon"},Ji="recent_actions",uve={__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=ja();Qt().ctx;const n=e,s=V(0),o=V({}),u=V(),A=(k,S)=>{const $=k.item.data,F=m($.type);if(F==="link"){let L=m($.url);m($.new_tab)?window.open(L,"_blank"):window.location.href=L}else F==="action"&&m($.action);f(k),n.onActionPerformed()},f=k=>{const S=k.item.id;let M=vt.get(Ji)||[];M=M.filter($=>$!==S),M.unshift(S),M=M.slice(0,5),vt.set(Ji,M)},m=k=>typeof k=="function"?g(k):k,g=async k=>await k({query:n.query,router:a}),y=()=>{var k;(k=u.value)==null||k.resetSelection()},v=()=>{var k;(k=u.value)==null||k.focusList(0)},B=()=>{var k;(k=u.value)==null||k.performFirstAction()};ge(()=>n.searchResults,async()=>{o.value={},o.value=n.searchResults??{},s.value=Object.keys(o.value).length-1;let k=o.value;for(const S of Object.keys(k)){const M=k[S];M.item.title_resolver&&(k[S].item.title=await m(M.item.title_resolver))}o.value={...k}});const b=V([]),w=async()=>{const k=vt.get(Ji)||[];let S=Ke.whereIn(n.searchData,"id",k),M=[];for(const $ of S)typeof $.title_resolver=="function"&&($.title=await m($.title_resolver)),M.push({item:$});b.value=M};return Be(()=>{w()}),t({focusList:v,resetSelection:y,performFirstAction:B,fetchRecentActions:w}),(k,S)=>(d(),_(H,null,[e.query||b.value.length<1?(d(),E(Kd,{key:0,items:e.searchResults,"on-action":A,"no-results-text":p(c)("No matches found"),ref_key:"navigableList",ref:u},{default:i(({item:M,index:$,isSelected:F})=>{var L,Q,T;return[r("span",Zge,[r("span",eve,h(M.item.title),1),(L=M.item)!=null&&L.subtitle?(d(),_("span",tve,h(M.item.subtitle),1)):((T=(Q=M.item)==null?void 0:Q.data)==null?void 0:T.show_description)===!0?(d(),_("span",ave,h(M.item.data.description),1)):x("",!0)]),r("div",nve,[l(W,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):x("",!0),!e.query&&b.value.length>0?(d(),_(H,{key:1},[r("span",sve,h(p(c)("Recent Actions")),1),l(Kd,{items:b.value,"on-action":A,"no-results-text":p(c)("No matches found"),ref_key:"navigableList",ref:u},{default:i(({item:M,index:$,isSelected:F})=>{var L,Q,T;return[r("span",lve,[r("span",ove,h(M.item.title),1),(L=M.item)!=null&&L.subtitle?(d(),_("span",rve,h(M.item.subtitle),1)):((T=(Q=M.item)==null?void 0:Q.data)==null?void 0:T.show_description)===!0?(d(),_("span",ive,h(M.item.data.description),1)):x("",!0)]),r("div",dve,[l(W,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):x("",!0)],64))}},cve=He(uve,[["__scopeId","data-v-ccb0ebef"]]),Ave={class:"fct-global-search-product-wrap"},pve={class:"fct-global-search-product-left-info"},fve={key:0,class:"type"},mve={key:0,class:"price-and-status"},hve={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=n=>n.min_price===n.max_price?Jt(n.min_price,!0):`${Jt(n.min_price,!0)} - ${Jt(n.max_price,!0)}`,a=n=>n==="publish"?c("published"):n==="future"?c("scheduled"):n;return(n,s)=>(d(),_("div",Ave,[r("div",pve,[l(Xd,{product:e.product},null,8,["product"]),e.product.detail?(d(),_("span",fve,[R(h(p(Gt).headline(e.product.detail.variation_type))+" ",1),s[0]||(s[0]=r("br",null,null,-1)),R(" "+h(p(Gt).headline(e.product.detail.fulfillment_type)),1)])):x("",!0)]),e.product.detail?(d(),_("span",mve,[R(h(t(e.product.detail))+" ",1),(d(),E(qt,{key:e.product.ID,status:e.product.post_status},{default:i(()=>[R(h(a(e.product.post_status)),1)]),_:1},8,["status"]))])):x("",!0)]))}},_ve={class:"fct-global-search-order-wrap"},gve={class:"fct-global-search-order-header"},vve={class:"fct-global-search-order-id"},yve={class:"items"},bve={class:"fct-global-search-order-header-meta"},wve={class:"date"},Cve=["innerHTML"],Bve={class:"customer-name"},kve={class:"fct-global-search-order-status-wrapper"},xve=["src","alt"],Sve={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>Ke.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,n)=>{var o;const s=C("el-tag");return d(),_("div",_ve,[r("div",gve,[r("div",vve,[R(" #"+h(e.order.id)+" ",1),r("span",yve,h(p(c)("%s Items",e.order.order_items.length)),1)]),r("div",bve,[r("span",wve,[l($a,{"date-time":e.order.created_at},null,8,["date-time"])]),n[0]||(n[0]=r("span",{class:"circle"},null,-1)),r("span",{class:"total-price",innerHTML:p(Jt)(e.order.total_amount,!0,!1,e.order.currency)},null,8,Cve),n[1]||(n[1]=r("span",{class:"circle"},null,-1)),r("span",Bve,h(((o=e.order.customer)==null?void 0:o.full_name)||p(c)("No Name")),1)])]),r("div",kve,[l(qt,{status:e.order.payment_status,"hide-icon":!0},null,8,["status"]),t(e.order.payment_method)?(d(),_("img",{key:0,src:t(e.order.payment_method),alt:p(Gt).headline(e.order.payment_method)},null,8,xve)):(d(),E(s,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:i(()=>[R(h(p(Gt).headline(e.order.payment_method)),1)]),_:1}))])])}}},Fve={class:"fct-global-search-customer-wrap"},Eve={class:"fct-customer-card"},Uve={class:"fct-customer-avatar"},$ve=["src"],Dve={class:"fct-customer-details"},Qve={class:"fct-customer-name"},Ive={class:"fct-customer-id"},Tve={class:"fct-customer-email"},Vve={class:"purchase-count"},Mve={class:"date"},Lve={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(d(),_("div",Fve,[r("div",Eve,[r("div",Uve,[r("img",{src:e.customer.photo,alt:"avatar"},null,8,$ve)]),r("div",Dve,[r("div",Qve,[R(h(e.customer.full_name||t.$t("No Name"))+" ",1),r("span",Ive,"#"+h(e.customer.id),1)]),r("div",Tve,[R(h(e.customer.email)+" ",1),a[0]||(a[0]=r("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),r("span",Vve,"Purchase: "+h(e.customer.purchase_count),1)])])]),r("span",Mve,[l($a,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},Rve={class:"fct-global-search-coupon-wrap"},Ove={class:"amount"},Hve={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(d(),_("div",Rve,[r("span",null,h(e.coupon.title),1),r("span",null,h(e.coupon.code),1),r("span",Ove,h(p(Jt)(e.coupon.amount,!0)),1)]))}},Pve={class:"fct-global-remote-result-container"},Nve={class:"fct-global-remote-result-label"},Kve={class:"text"},Gve={class:"navigable-content"},jve={class:"action-icon"},zve={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const n=a,s=ja(),o=V({}),u=V(""),A=V(),f=V({}),m=V([]),g=T=>{y.value=!1,m.value=k.data.tableData,n("onRemoteSearchStateChange",!1)},y=V(!1),v={orders:mp({fetch:!1}),products:um({fetch:!1}),customers:fp({fetch:!1}),coupons:wm({fetch:!1})},B=()=>{},b=()=>{var T;(T=A.value)==null||T.focusList(0)},w=()=>{var T;(T=A.value)==null||T.performFirstAction()};Ks(()=>{for(const T of Object.keys(v))v[T].onDataLoaded(g)});let k=null;const S=()=>{k=v[o.value.key],k.data.search=u.value,y.value=!0,k.fetch(),n("onRemoteSearchStateChange",!0)},M=nu.debounce(S,800),$=(T,D)=>{if(m.value=[],k&&(k.data.search=""),o.value=D,f.value={title:D.title,key:D.key},!T){u.value="";return}u.value=T,M()},F=()=>{s.push({name:f.value.key,query:{search:u.value}}),n("close-modal")},L={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=T=>{o.value.key in L&&(s.push({name:L[o.value.key].name,params:{[L[o.value.key].key]:T.id||T.ID,action:"edit"}}),n("close-modal"))};return t({fetchData:$,focusList:b,resetSelection:B,performFirstAction:w}),(T,D)=>(d(),_("div",Pve,[r("div",Nve,[r("span",Kve,h(o.value.title),1),f.value.key?(d(),_("span",{key:0,class:"view-all",onClick:F},h(u.value?p(c)('Search "%1$s" in %2$s',u.value,f.value.title):p(c)("See All %s",f.value.title)),1)):x("",!0)]),l(Kd,{items:m.value,"on-action":U=>{Q(U)},"no-results-text":u.value?p(c)("No matches found for %s",o.value.title):p(c)("Type something to find %s",o.value.title),ref_key:"navigableList",ref:A},{default:i(({item:U,index:I,isSelected:O})=>[r("div",Gve,[o.value.key==="products"?(d(),E(hve,{key:0,product:U},null,8,["product"])):x("",!0),o.value.key==="orders"?(d(),E(Sve,{key:1,order:U},null,8,["order"])):x("",!0),o.value.key==="customers"?(d(),E(Lve,{key:2,customer:U},null,8,["customer"])):x("",!0),o.value.key==="coupons"?(d(),E(Hve,{key:3,coupon:U},null,8,["coupon"])):x("",!0)]),r("div",jve,[l(W,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},Yve={class:"fct-global-search-input-wrap"},qve={class:"fct-setting-search-icon"},Wve={class:"fct-global-search-input-container"},Xve={key:0,class:"searched-item"},Jve={class:"fct-global-searching-for"},Zve={class:"fct-global-searching-for-label"},e1e={class:"fct-global-searching-suggestion-list"},t1e=["onClick"],a1e={class:"dialog-footer is-border"},n1e={class:"fct-search-commands"},s1e={class:"command-key"},l1e={class:"command-key"},o1e={class:"label"},r1e={class:"command-key"},i1e={class:"label"},d1e={class:"label"},u1e={__name:"GlobalSearch",setup(e){Qt().ctx,ja();const t=V(!1),a=V(""),n=V({}),s=V(),o=V(""),u=V([c("orders"),c("products"),c("customers"),c("coupons"),c("settings"),c("menus"),c("shortcuts...")]),A=V(0),f=V(!0),m=V(0),g=V(null),y=V(null),v=V(70),B=V(40),b=V(1700),w=()=>{ye(()=>{S()})},k=()=>{var te,X;Q.value?(te=G.value)==null||te.resetSelection():(X=$.value)==null||X.resetSelection(),Q.value=!1,P.value=!1,M()},S=()=>{var te;(te=s.value)==null||te.focus()},M=()=>{Q.value=!1,n.value=[],t.value=!1,a.value="",T.value=null},$=V(),F=te=>{let X=te.includes(","),ie={},be=[];(X?te.split(","):[te]).forEach(pe=>{pe.includes(":")?L(pe,ie,be):be.push(pe)});let ce=[];return Object.keys(ie).forEach(pe=>{const De=ie[pe];De.length>0?De.forEach($e=>{$e.length>0?ce.push({group:"'"+pe,title:$e}):ce.push({group:"'"+pe})}):ce.push({group:"'"+pe})}),be.forEach(pe=>{pe.length>0&&ce.push({title:pe})}),ce},L=(te,X,ie)=>{if(te.length===1)return;let be=te.split(":"),se=be[0],ce=be[1];se.length>0?(X.hasOwnProperty(se)||(X[se]=[]),ce.length>0&&X[se].push(ce)):ie.push(ce)},Q=V(!1),T=V(null),D=V({o:{key:"orders",title:c("Orders")},p:{key:"products",title:c("Products")},c:{key:"customers",title:c("Customers")},d:{key:"coupons",title:c("Coupons")}}),U=te=>{T.value=te,Q.value=!0,n.value={},ye(()=>{var X,ie;(X=G.value)==null||X.fetchData(a.value,te),(ie=s.value)==null||ie.focus()})},I=()=>{var te;n.value=[],T.value=null,a.value="",Q.value=!1,(te=s.value)==null||te.focus(),P.value=!1},O=()=>{var te;(te=G.value)==null||te.fetchData(a.value,T.value)},P=V(!1),K=te=>{P.value=te,ye(()=>{var X;(X=s.value)==null||X.focus()})},G=V(),ne=ks(),Y=()=>{if(t.value){S();return}const te=["o","p","c","d"];ne.bind(te,X=>{X.preventDefault();const ie=D.value[X.key];ie&&U(ie)}),t.value=!0,ye(()=>{var X;(X=$.value)==null||X.fetchRecentActions()}),setTimeout(()=>{ne.unbind(te)},800)};ne.bind(["/"],te=>{!t.value&&N()||(te.preventDefault(),Y())});const N=()=>{const te=document.activeElement;if(!te)return!1;const X=te.tagName;return X==="INPUT"||X==="TEXTAREA"||X==="SELECT"||te.isContentEditable},oe=()=>{if(g.value)return;const te=()=>{if(s.value&&s.value.length>0)return;const ie=u.value[A.value];if(f.value)m.value<ie.length?(o.value=ie.slice(0,m.value+1),m.value++):(f.value=!1,clearTimeout(y.value),y.value=setTimeout(()=>{y.value=null},b.value));else{if(y.value)return;m.value>0?(m.value--,o.value=ie.slice(0,m.value)):(f.value=!0,A.value=(A.value+1)%u.value.length)}},X=()=>{te();const ie=f.value?v.value:y.value?120:B.value;g.value=setTimeout(X,ie)};X()},Z=V(!1);let le;return Be(()=>{oe(),le=new Fl(Nd,zge());const te=document.getElementById("fct_admin_menu_search");if(te){const X=te.querySelector(".fct-global-search-input-wrap");X&&X.remove()}Z.value=!!te,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=Y}),At(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(te,X)=>{const ie=C("el-input"),be=C("el-dialog");return d(),_(H,null,[Z.value?(d(),E(Rr,{key:0,to:"#fct_admin_menu_search"},[r("div",Yve,[r("button",{onClick:Y,type:"button",class:"fct-setting-search-button","aria-label":"Search"},[r("span",qve,[l(W,{name:"Search"})]),X[6]||(X[6]=r("span",{class:"fct-global-search-button-keys"},[r("kbd",{class:"fct-global-search-button-key"},"/")],-1))])])])):x("",!0),l(be,{modelValue:t.value,"onUpdate:modelValue":X[5]||(X[5]=se=>t.value=se),onOpened:w,onClosed:k,class:"fct-global-search-container","append-to-body":!0},{header:i(()=>[r("div",Wve,[l(W,{name:"Search",class:"search-icon"}),T.value!=null?(d(),_("div",Xve,[R(h(T.value.title)+" ",1),l(W,{name:"Cross",class:"searched-item-remove",onClick:I})])):x("",!0),l(ie,{class:"mousetrap",placeholder:p(c)("Search for %1$s",o.value),autofocus:"",ref_key:"searchRef",ref:s,id:"fct-global-search-input",disabled:P.value,onKeydown:[X[0]||(X[0]=Pa(Xe(()=>{var se,ce;if(Q.value){(se=G.value)==null||se.focusList();return}(ce=$.value)==null||ce.focusList()},["prevent"]),["arrow-down"])),X[1]||(X[1]=Pa(Xe(()=>{var se,ce;if(Q.value){(se=G.value)==null||se.performFirstAction();return}(ce=$.value)==null||ce.performFirstAction()},["prevent"]),["enter"])),X[2]||(X[2]=Pa(()=>{a.value.length===0&&(T.value=null,Q.value=!1)},["backspace"]))],onInput:X[3]||(X[3]=()=>{if(Q.value){O();return}let se=a.value.includes(","),ce=a.value.includes(":");if(!se&&!ce)n.value.value=p(le).search(a.value);else{const pe=F(a.value);n.value.value=p(le).search({$or:pe})}}),modelValue:a.value,"onUpdate:modelValue":X[4]||(X[4]=se=>a.value=se),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:i(()=>[l(ra,{visible:!T.value&&a.value.length===0,accordion:""},{default:i(()=>[r("div",Jve,[r("div",Zve,h(p(c)("Searching for")),1),r("div",e1e,[(d(!0),_(H,null,ee(D.value,se=>{var ce;return d(),_("div",{key:se.key,onClick:pe=>U(se),class:de(["fct-global-searching-suggestion",((ce=T.value)==null?void 0:ce.key)===se.key?"active":""])},h(se.title),11,t1e)}),128))])])]),_:1},8,["visible"]),Q.value?(d(),E(zve,{key:0,ref_key:"remoteResultRef",ref:G,query:a.value,tag:T.value,onCloseModal:M,onOnRemoteSearchStateChange:K},null,8,["query","tag"])):(d(),E(cve,{key:1,ref_key:"resultListRef",ref:$,query:a.value,"search-results":n.value.value,onActionPerformed:M,focusInput:S,searchData:p(Nd)},null,8,["query","search-results","searchData"])),r("div",a1e,[r("ul",n1e,[r("li",null,[r("span",s1e,[l(W,{name:"ArrowUp"})]),r("span",l1e,[l(W,{name:"ArrowDown"})]),r("span",o1e,h(p(c)("To navigate")),1)]),r("li",null,[r("span",r1e,[l(W,{name:"Enter"})]),r("span",i1e,h(p(c)("To select")),1)]),r("li",null,[X[7]||(X[7]=r("kbd",{class:"command-key"},"esc",-1)),r("span",d1e,h(p(c)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},c1e={class:"fl_app fluent-cart-admin-pages"},A1e=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=V("");Be(()=>{jQuery(".notice:not(.fluent-cart), .error:not(.fluent-cart), #ehp-admin-cb").remove(),t.value=a(),n.value=!!document.getElementById("theme-button-container");const u=document.querySelector(".fct_admin_menu_wrap"),A=()=>{window.scrollY>10?u==null||u.classList.add("scroll-header"):u==null||u.classList.remove("scroll-header")};window.addEventListener("scroll",A)});const a=()=>window.location.href,n=V(!1),s=fn();ge(()=>s.fullPath,()=>{t.value=a()});const o=j(()=>!(s.fullPath.includes("reports")||s.fullPath.includes("settings")));return(u,A)=>{const f=C("router-view");return d(),_("div",null,[l(u1e),o.value?(d(),E(_a,{key:0})):x("",!0),r("div",c1e,[l(f)]),n.value?(d(),E(Rr,{key:1,to:"#theme-button-container"},[l(tge)])):x("",!0)])}}});let GA=!1;function p1e(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:re.get,$post:re.post,$put:re.put,$del:re.delete,$t:c,$n:ir,formatMoney(t,a,n=!1){return!t&&n?"":(t||(t="0.00"),Ie.get("shop.currency_sign")+" "+t)},formatCents(t,a,n=!1){return!t&&n?"":(t?t=(t*100).toFixed(2):t="0.00",a?(t=new Intl.NumberFormat("en-US").format(t),Ie.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,n=!1,s){return Te.formatNumber(t,a,n,s)},formatNumberForOrder(t,a,n=!0,s=!1){return Te.formatForOrder(t,a,n,s)},getAddress(t,a="billing"){let n=[t[a+"_address_1"],t[a+"_address_2"],t[a+"_city"],t[a+"_city"],t[a+"_state"],t[a+"_zip"],t[a+"_country"]];return n=n.filter(s=>!!s).join(", "),n||"no "+a+" address"},getOrderAddress(t,a="billing",n=!1){return Th(t,a,n)},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 n in t)a.push(this.convertToText(t[n]));else if(typeof t=="object"&&t.join!==void 0)for(const n in t)a.push(this.convertToText(t[n]));else typeof t=="function"||typeof t=="string"&&a.push(t);return a.join("<br />")},handleSuccess:t=>{q.success(t)},handleMessage:(t,a="info",n=40,s=1e3)=>{nh.show(t,a,n,s)},Storage:()=>vt,buildFormRendererValue(t,a){let n={};return Object.keys(t).forEach(s=>{let o=t[s];["grid"].includes(o.type??"")?n[s]=this.buildFormRendererValue(o.schema??{},a[s]??{}):n[s]=a[s]??""}),n},registerCopyAction(){GA||(GA=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&Os.copy(t.target.textContent)}))},currencySign(){return Ie.get("shop.currency_sign")},getPlaceholderImage(){return Ps.getUrl("images/placeholder.svg")},saveLocal(t,a){vt.set(t,a)},getLocal(t){return vt.get(t)},hasPermission(t){return no.hasPermission(t)}}}}function f1e(e){e.beforeEach((t,a,n)=>{const s=Ke.get(t,"meta.permission");return s?no.resolve({permission:s,permissionType:Ke.get(t,"meta.permissionType")})?n():n({name:"unauthorized"}):(Ie.get("app_config.env"),n())})}function m1e(e){const t={fluent_cart_products:["fluent_cart_inventory"]},a=n=>{if(!n)return;const s="fluent_cart_"+n;Object.entries(t).forEach(([o,u])=>{const A=s===o;u.forEach(f=>{const m=jQuery(".toplevel_page_fluent-cart li."+f);A?m.show():m.hide()})})};e.afterEach((n,s)=>{const o=n.meta.active_menu;jQuery(".fct_menu li").removeClass("active_admin_menu"),jQuery(".fct_menu li.fct_menu_item_"+o).addClass("active_admin_menu"),jQuery(".toplevel_page_fluent-cart li").removeClass("current"),jQuery(".toplevel_page_fluent-cart li.fluent_cart_"+o).addClass("current"),a(o),n.meta.title&&jQuery("head title").text(n.meta.title+" - FluentCart")})}const h1e={mounted(e,t){const a=t.value,n=1e3,s=0,o=performance.now(),u=()=>{const A=performance.now()-o,f=Math.min(A/n,1),m=(s+f*(a-s)).toFixed(2);e.textContent=m,f<1&&requestAnimationFrame(u)};u()},updated(e,t){const a=t.value,n=2e3,s=0,o=performance.now(),u=()=>{const A=performance.now()-o,f=Math.min(A/n,1),m=(s+f*(a-s)).toFixed(2);e.textContent=m,f<1&&requestAnimationFrame(u)};u()}},_1e={__name:"Unauthorized",setup(e){return(t,a)=>(d(),_("span",null,h(p(c)("You are not allowed")),1))}},g1e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",J_e);let jA=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){jA||Ea.alert(c("Your session has expired due to inactivity. Please refresh the page to continue."),c("Session Expired"),{confirmButtonText:c("Reload"),callback:t=>{jA=!1,window.location.reload()}})});const v1e=[yh,bh,wh,Is,Ch,Jd,Bh,kh,Nr,xh,Sh,np],qn=Jm(A1e);qn.config.globalProperties.appVars=Ie.get();qn.provide("appVars",Ie.get());qn.mixin(p1e());qn.directive("loading",Vh);qn.directive("animate",h1e);Rh(qn);const Iu=Zm({routes:[...Object.values(g1e),{path:"/unauthorized",name:"unauthorized",component:_1e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:Kr,props:!0}],history:eh(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});qn.use(Iu);f1e(Iu);m1e(Iu);v1e.forEach(e=>{qn.component(e.name,e)});const Tu=Ie.get("el_strings"),Om=Ie.get("datei18");Tu.el.datepicker.weeks=Om.weekdaysShort;Tu.el.datepicker.months=Om.monthsShort;qn.use(Mh,{locale:Tu});qn.mount("#fluent_cart_plugin_app");export{go as E}; |
| 305 |
|