1const __vite__fileDeps=["assets/js/module-CeFpPFS8.js","assets/js/module-g4nfU4qS.js","assets/js/module-CkAgo4Og.js","assets/js/module-BndIsuim.js","assets/react-image-crop-tvFDcxOC.css","assets/js/module-BiZ_jzQw.js","assets/index-DWyIa0gL.js","assets/js/module-CLuAD4R5.js","assets/js/module-DYLXRpC5.js","assets/js/module-CP88euwI.js","assets/js/module-CbyKh5Um.js","assets/js/module-CpA3Gb_i.js","assets/js/module-BzM7VDfa.js","assets/js/module-DHVO85nS.js","assets/js/module-BSPv5tIW.js","assets/js/module-BHCKjyDG.js","assets/js/module-M2MMyV6m.js","assets/js/module-kEjItqhR.js","assets/js/module-AkyW2Ruw.js","assets/js/module-BRy6BJs6.js","assets/js/module-CLsn7ldt.js","assets/js/module-DtACTtM6.js","assets/js/module-BBruC8m-.js","assets/js/module-arTw0fVe.js","assets/js/module-CndrmyLu.js","assets/js/module-BaA5LyCG.js","assets/js/module-D0mFdbeO.js","assets/js/module-Dk6e9ee8.js","assets/js/module-CDjUV5Ju.js","assets/js/module-BkD7Hj8s.js","assets/js/module-Cp8br37W.js","assets/js/module-CzD4bSOQ.js","assets/js/module-9lF95FHy.js","assets/js/module-BtzVbTB5.js","assets/js/module-D28oVHB0.js","assets/js/module-CimkQT29.js","assets/js/module-BUHjN4Hc.js","assets/js/module-BZ4M8-NE.js","assets/js/module-DMW1B1t5.js","assets/@shopify-DYMTTRly.css","assets/js/module-CYrDBt6T.js","assets/js/module-DCoKLf-v.js","assets/js/module-BnWCsivz.js","assets/js/module-v8jY9nGA.js","assets/js/module-D2RLwbSq.js","assets/js/module-CNVTF9TH.js","assets/js/module-8JwjhRSi.js","assets/js/module-JSaEjBuK.js","assets/js/module-UTIhDGpo.js","assets/js/module-DFeDTf4p.js","assets/js/module-ClTBx2Nk.js","assets/react-phone-input-2-DAqf4SHo.css","assets/js/module-YfaRQf3K.js","assets/js/module-B0vxmspb.js","assets/js/module-YKhy6aow.js","assets/js/module-duNjR6wQ.js","assets/js/module-tV3IJ5Y1.js","assets/js/module-C4TimWWB.js","assets/js/module-CZPcUW2s.js","assets/js/module-BZ17SRdx.js","assets/js/module-BEIsiqOv.js","assets/js/module-fFtbNF-F.js","assets/js/module-DEtA-KhA.js","assets/js/module-CPh8vZck.js","assets/js/module-DKECUIcb.js","assets/js/module-Cxv9J64N.js","assets/js/module-BINVifEP.js","assets/js/module-B1TVd3K4.js","assets/js/module-DHRHeQUK.js","assets/js/module-DkegjUUZ.js","assets/js/module-v-CXq_RL.js","assets/js/module-BDscFCCP.js","assets/js/module-aXdEWYlg.js","assets/js/module-B4SPueXG.js","assets/js/module-ubDpl0_R.js","assets/js/module-B_AESZ67.js","assets/js/module-C2S2-HMR.js","assets/js/module-JW1JAliT.js","assets/js/module-Dz8i_Leu.js","assets/js/module-CVphjg2G.js","assets/js/module-BJwyIH4s.js","assets/index-B_EVCdTj.css","assets/js/module-B21oSRzw.js","assets/js/module-D9KDHFMM.js","assets/js/module-oH8_ZL24.js","assets/js/module-BBjH2Bj1.js","assets/js/module-BTdoF416.js","assets/js/module-BiI3u42N.js","assets/js/module-B-dksMZM.js","assets/js/module-B3BJzVxn.js","assets/js/module-BjfZYBMc.js","assets/js/module-BI5bqnt8.js","assets/js/module-DiCIOLtz.js","assets/js/module-BK4nBkK6.js","assets/js/module-xvpIGbSh.js","assets/swiper-BiEqWrUy.css","assets/js/module-vs-8EVL6.js","assets/js/module-DKNNaWzV.js","assets/js/module-B57D9Y1u.js","assets/js/module-DsmTx7if.js","assets/js/module-6E4L_h32.js","assets/js/module-B5iLQXnX.js","assets/js/module-eWZP5eA7.js","assets/js/module-C-FQGDW9.js","assets/js/module-4S-c4oHJ.js","assets/js/module-DfWnE5ms.js","assets/js/module-WX_comao.js","assets/js/module-BJMi48_2.js","assets/js/module-MyE73HNZ.js","assets/js/module-D6GhiVEH.js","assets/js/module-Cl3hj7Sz.js","assets/js/module-FxXdmyPN.js","assets/js/module-FqpXQuLt.js","assets/js/module-D7zKsYo2.js","assets/js/module-C1gvLhAf.js","assets/js/module-B_b8ryxu.js","assets/js/module-Cv-JDcMf.js","assets/js/module-DYCwc-sD.js","assets/js/module-C
1h_qCilz.js","assets/js/module-DWCyG3-x.js","assets/js/module-D4_bCcMT.js","assets/js/module-CNs1qBpV.js","assets/js/module-DI2Ne2_A.js","assets/js/module-C3-224fz.js","assets/js/module-C9ANKk3v.js","assets/js/module-CpL0MGZq.js","assets/js/module-DbIWH81b.js","assets/js/module-DrRIdSP-.js","assets/js/module-BSLCDnTV.js","assets/js/module-DjYUzTuj.js","assets/js/module-vcVAUzeC.js","assets/js/module-GAKWmy7o.js","assets/js/module-PQCKh0dx.js","assets/js/module-CEEhGtWX.js","assets/js/module-B7hx6Bgd.js","assets/js/module-BJwr7tuA.js","assets/js/module-BQobnMtX.js","assets/js/module-BMgpUYTo.js","assets/js/module-DbKNfynz.js","assets/js/module-C_aolqmU.js","assets/js/module-Cjxe2-Wq.js","assets/js/module-ZLXBeeQ1.js","assets/js/module--gfxRhYI.js","assets/js/module-Dsow35wU.js","assets/js/module-60F3QETU.js","assets/js/module-D8znQY54.js","assets/js/module-CPveMqlj.js","assets/js/module-D1zfnBJe.js","assets/js/module-D9KQvrmg.js","assets/js/module-FjFE2uWm.js","assets/js/module-xMQ5YY98.js","assets/js/module-Bx45xMUt.js","assets/js/module-DD3iYX1K.js","assets/js/module-D5ZndoG6.js","assets/js/module-DMkqpeS_.js","assets/js/module-CWBJcU5N.js","assets/js/module-D4Wp6AEg.js","assets/js/module-BgBfM8ME.js","assets/js/module-D46m5wfe.js","assets/js/module-DOgs_Y3Z.js","assets/js/module-CH9fmmFv.js","assets/js/module-7ux2xnsv.js","assets/js/module-CqnTjJDb.js","assets/js/module-DjKU-xAz.js","assets/js/module-C0ijFVsX.js","assets/js/module-B6B9y572.js","assets/js/module-DhTU8B_4.js","assets/js/module-5eLbDUjv.js","assets/js/module-c2V3InAJ.js","assets/js/module-SNETSEGx.js","assets/js/module-Qe-ESUUc.js","assets/js/module-Cj9qKt6Q.js","assets/js/module-B7EQxdU6.js","assets/js/module-DvhhVmnL.js","assets/js/module-CLQgGlmV.js","assets/js/module-CtXnX3Xp.js","assets/js/module-DZ4MRfGb.js","assets/js/module-BXLLueiB.js","assets/js/module-Bh5dGB7-.js","assets/js/module-C
1hDEcKkm.js","assets/js/module-viLe5jBK.js","assets/js/module-DYRc1myh.js","assets/js/module-D-CCuB3j.js","assets/js/module-C-Y3moQM.js","assets/js/module-BmLAdfv_.js","assets/js/module-CQoQLGZn.js","assets/js/module-CsOSqbjs.js","assets/js/module-DpV-RknM.js","assets/js/module-BtHhgq7k.js","assets/js/module-aFQBCvBX.js","assets/js/module-CCzXKaxK.js","assets/js/module-Cgx2k5hB.js","assets/js/module-CFxIfOSP.js","assets/js/module-DpkYiACI.js","assets/js/module-DgzxiBL5.js","assets/js/module-Dpbv88MK.js","assets/js/module-DuutY50N.js","assets/js/module-SEfERXZg.js","assets/js/module-BE60QSiN.js","assets/js/module-CJ1-Igog.js","assets/js/module-BRMhr04P.js","assets/js/module-DdhB1fcj.js","assets/js/module-C1JDE-Bi.js","assets/js/module-hy_LLdhE.js","assets/js/module-CaNSgZFV.js","assets/js/module-BCiDmPn2.js","assets/js/module-Bci7EUG_.js","assets/js/module-lm3Oa2lD.js","assets/js/module-I5gPKOU0.js","assets/js/module-DfSHpfQI.js","assets/js/module-Cqq5vYBx.js","assets/js/module-zJa79h-t.js","assets/js/module-Z4vfwmlD.js","assets/js/module-DAqCu-kz.js","assets/js/module-0vlx5aGM.js","assets/js/module-BhpvqT5w.js","assets/js/module-Dmo6ThUP.js","assets/js/module-Dkep-53A.js","assets/js/module-BP0lUZH1.js","assets/js/module-CcO82b97.js","assets/js/module-DB9SRSHI.js","assets/js/module-Bj3wUM-s.js","assets/js/module-DJE01Ykt.js","assets/js/module-Bf6FQPyG.js","assets/js/module-OtqmcW_D.js","assets/js/module-kxCwF96_.js","assets/js/module-B90As2w7.js","assets/js/module-B9215Zsx.js","assets/js/module-DjuyR91S.js","assets/js/module-DRPgKoYJ.js","assets/js/module-Crj9kp4u.js","assets/js/module-CQezQk0M.js","assets/js/module-C3AcB0m8.js","assets/js/module-Bpledz9h.js","assets/js/module-JqeWFU6Z.js","assets/js/module-DOc9JcjR.js","assets/js/module-D4VMLlos.js","assets/js/module-CDVc3Ws4.js","assets/js/module-CRlyLveg.js","assets/js/module-BtSIKe8E.js","assets/js/module-DY19Myfv.js","assets/js/module-HEYZVIwL.js","assets/js/module-HYLJe_Wd.js","assets/js/module-_WbU4vYA.js","assets/js/module-CzcXRatL.js","assets/js/module-rV4jXwpg.js","assets/js/module-Rzg2OUak.js","assets/js/module-DDCBqBay.js","assets/js/module-Ntqr057b.js","assets/js/module-DjF7ohF4.js","assets/js/module-DKc3ovCS.js","assets/js/module-C
1hyHLOhB.js","assets/js/module-DNxhtZ8m.js","assets/js/module-DQtMUZ8P.js","assets/js/module-C-tCwAlY.js","assets/js/module-Bb9pJC7l.js","assets/js/module-twWDrFg6.js","assets/js/module-CBHOAzBI.js","assets/js/module-Dur1QRaE.js","assets/js/module-C6CM8qIy.js","assets/js/module-AVFTcEpP.js","assets/js/module-Byc5WA6_.js","assets/js/module-D1tjJ3O-.js","assets/js/module-BdPwSnSr.js","assets/js/module-xepUDqEv.js","assets/js/module-BjbJDDPy.js","assets/js/module-BWyI0v48.js","assets/js/module-4r7jHv-b.js","assets/js/module-UhN2daaJ.js","assets/js/module-2AJ1QEwp.js","assets/js/module-CTV3FqiK.js","assets/js/module-D3DQoXdA.js","assets/js/module-DDZJ0mNM.js","assets/js/module-CKGLSNW9.js","assets/js/module-CCfvsy6c.js","assets/js/module-Dn7VpHZ3.js","assets/js/module-zOE_Yj7w.js","assets/js/module-BlIkCHiI.js","assets/js/module-uOxYIRmG.js","assets/js/module-DcUGm_xz.js","assets/js/module-D3ZeGmBC.js","assets/js/module--ZHWxmY_.js","assets/js/module-DegQqWgA.js","assets/js/module-Bg6y5vWc.js","assets/js/module-BN5reyMn.js","assets/js/module-Cb2fdGGx.js","assets/js/module-f19LySCx.js","assets/js/module-BeuzmP28.js","assets/js/module-BGoz_vSe.js","assets/js/module-SXTS4CE6.js","assets/js/module-DEXOUDle.js","assets/js/module-Dz4jg7Ew.js","assets/js/module-DSMtlNjB.js","assets/js/module-C
1hRuIjAo.js","assets/js/module-DaGdLKDX.js","assets/js/module-C-HavGNB.js","assets/js/module-4r3fL1G6.js","assets/js/module-DEgBKoO6.js","assets/js/module-B_Nr9GoX.js","assets/js/module-jcKEJy0O.js","assets/js/module-Ce6ZBFHU.js","assets/js/module-CTHF5JTC.js","assets/js/module-CC1c9uwB.js","assets/js/module-mpa-5_iR.js","assets/js/module-DGMnconx.js","assets/js/module-DkIAXugR.js","assets/js/module-BSPFcqyM.js","assets/js/module-DBbUcxjW.js","assets/js/module-B_Q3try7.js","assets/js/module-BdRt1-Xc.js","assets/js/module-DiDm0rCd.js","assets/js/module-7-fdWWzC.js","assets/js/module-D9I5nZOT.js","assets/js/module-ClHC0Iac.js","assets/js/module-ytRCV2nq.js","assets/js/module-K97uprG9.js","assets/js/module-CtUnBD8v.js","assets/js/module-DWmBTBqZ.js","assets/js/module-m4yGKBMx.js","assets/js/module-DZp2EBWX.js","assets/js/module-CkeDZJ9p.js","assets/js/module-BlRKIEtR.js","assets/js/module-CIo1jBBV.js","assets/js/module-CZ1_ctnm.js","assets/js/module-D-d78Djy.js","assets/js/module-BLIHU3M8.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); 2import{a as Oe,j as e,r as i}from"./module-g4nfU4qS.js";import{c as de,d as dt,e as xe,v as ka,f as dr,A as Ts,g as ec,h as ui,r as X,i as Ct,s as ge,j as oe,a as J,M as ee,k as Xn,m as ho,n as Us,p as m,q as er,t as Fe,w as tt,x as bs,y as m0,z as $o,B as f0,R as Y,C as Xe,D as Gn,E as x0,F as re,G as wt,I as Gt,b as gs,P as Te,J as nn,K as tp,L as Vt,N as va,u as bt,O as In,Q as Ke,T as $,U as xt,V as sp,W as kt,X as Et,Y as vi,Z as st,_ as _0,$ as Cs,a0 as Ut,a1 as Tn,a2 as np,a3 as el,a4 as tl,a5 as sl,a6 as Qe,a7 as pi,a8 as ts,a9 as xn,aa as Is,ab as b0,ac as y0,ad as ls,ae as fe,af as Jn,ag as Rn,ah as us,ai as Di,aj as nl,ak as ur,al as tr,am as ap,an as hi,ao as C0,S as tn,ap as Sn,aq as al,ar as v0,as as A0,at as S0,au as Gs,av as vt,H as Ea,aw as vs,ax as j0,ay as ta,az as Ta,l as Ai,aA as rl,aB as rp,aC as ni,aD as il,aE as ol,aF as Xt,o as ip,aG as ut,aH as E0,aI as op,aJ as tc,aK as T0,aL as sr,aM as P0,aN as Me,aO as I0,aP as lp,aQ as gi,aR as gt,aS as Si,aT as ll,aU as cp,aV as Za,aW as R0,aX as k0,aY as dp,aZ as sc,a_ as w0,a$ as up,b0 as Mt,b1 as _t,b2 as wa,b3 as pr,b4 as N0,b5 as nc,b6 as ac,b7 as mi,b8 as On,b9 as Xa,ba as O0,bb as rc,bc as pp,bd as ic,be as D0,bf as cl,bg as hp,bh as dl,bi as Li,bj as L0,bk as M0,bl as Fs,bm as An,bn as U0,bo as F0,bp as B0,bq as Nn,br as H0,bs as hs,bt as G0,bu as W0,bv as ul,bw as V0,bx as Ca,by as Y0,bz as na,bA as z0,bB as pl,bC as K0,bD as Q0,bE as q0,bF as Xs,bG as go,bH as oc,bI as fi,bJ as Z0,bK as X0,bL as J0,bM as es,bN as $0,bO as gp,bP as eg,bQ as tg,bR as mp,bS as sg,bT as Rr,bU as ng,bV as ag}from"../index-DWyIa0gL.js";import{a as Ce,aa as zn,ab as Rt,ac as hl,ad as rg,ae as $s,r as ig,af as og,ag as lg,ah as cg,ai as aa,aj as dg,ak as Ln,al as mo,am as gl,l as D,an as ug,ao as fp,ap as pg,aq as ms,a7 as is,n as U,s as Je,g as Pa,ar as sa,m as Q,as as ys,at as ml,S as Ja,q as Ys,au as ft,L as hg,B as Bs,e as sn,$ as xi,av as ra,F as hr,i as Lt,d as nr,I as ds,aw as gg,ax as fl,ay as mg,az as xp,k as Ws,aA as fg,aB as xg,aC as _g,aD as jn,aE as Pn,p as Rs,aF as kr,M as bg,u as gr,z as Na,aG as yg,aH as fo,aI as Cg,aJ as xo,a8 as xl,h as ar,X as vg,Y as _l,aK as Ag,aL as _p,aM as Sg,W as jg,aN as Eg,aO as Tg,a1 as bl,aP as bp,aQ as Pg,aR as mr,aS as Mi,J as Ig,aT as Rg,aU as kg,O as ji,aV as wg,aW as Ia,aX as yp,aY as Ng,o as Mn,aZ as Oa,a_ as Og,a$ as Cp,G as vp,b0 as _o,b1 as Dg,b2 as Lg,c as Mg,b3 as Ug,b4 as Fg,b5 as Ap,b6 as Sp,b7 as jp,b8 as Ep,b9 as rn,ba as Bg,bb as Hg,bc as Gg,bd as Wg,be as Vg,bf as Yg,_ as zg,bg as lc,x as Tp,bh as Pp,bi as Kg,bj as Qg,bk as qg,a6 as wr,bl as Zg,bm as Ui,a0 as Xg,Z as Ip,bn as Jg,bo as $g,bp as Rp,N as kp,bq as wp,br as em,bs as bo,bt as tm,j as sm,bu as nm,bv as am,f as Np,bw as rm,bx as im,by as om,v as Op,bz as yl,bA as lm,bB as cm,bC as dm,bD as cc,bE as dc,bF as uc,bG as um,bH as Nr,bI as Or,bJ as pm,bK as hm,bL as gm,bM as mm,bN as fm,bO as xm,bP as _m}from"./module-CndrmyLu.js";import{h as it,m as Da}from"./module-CLsn7ldt.js";import{_ as at,l as q}from"./module-kEjItqhR.js";import{b as he,c as be,d as ke,R as ae,f as la,a as ns,g as Fi}from"./module-BRy6BJs6.js";import"./module-D2RLwbSq.js";import"./module-ClTBx2Nk.js";import"./module-B0vxmspb.js";import"./module-BnWCsivz.js";import{L as fr,u as ca}from"./module-CP88euwI.js";import{c as bm}from"./module-BiI3u42N.js";
2import{a as pt,u as zs,d as ym,N as Dp,e as Cm,O as vm,f as Am,g as Dr}from"./module-BzM7VDfa.js";import{i as Sm}from"./module-B3BJzVxn.js";import{a as Lp,r as jm}from"./module-CLuAD4R5.js";import{H as se,U as da,C as Ps,W as Ei}from"./module-CNVTF9TH.js";import{c as Un}from"./module-BjfZYBMc.js";import{u as xr}from"./module-DHRHeQUK.js";import{u as ja,b as _r}from"./module-BtzVbTB5.js";import{S as Em,I as Tm,N as Pm,H as Im}from"./module-CeFpPFS8.js";import{u as ks,a as ws,b as br}from"./module-CVphjg2G.js";import{a as Rm}from"./module-DHVO85nS.js";import{u as Mp}from"./module-DCoKLf-v.js";import{p as La,a as km,b as wm}from"./module-BBjH2Bj1.js";import{C as Up,r as Fp}from"./module-YfaRQf3K.js";import"./module-DtACTtM6.js";import"./module-BI5bqnt8.js";import"./module-DiCIOLtz.js";import"./module-BK4nBkK6.js";import{u as Nm,L as Om,i as Dm}from"./module-vs-8EVL6.js";import{M as Ma}from"./module-D6GhiVEH.js";import{r as Ti}from"./module-DOgs_Y3Z.js";import{e as pc}from"./module-Bh5dGB7-.js";import{Y as Lm,X as Mm,W as Um,V as Fm,a as Bm,b as Hm,T as Gm,c as Wm,d as Vm,e as Ym,R as zm,P as Km,f as Qm,M as qm,g as Zm,h as Xm,i as Jm,j as $m,k as ef,l as tf,m as sf,n as nf,o as af,A as rf,p as of,Z as lf,q as cf,r as df,s as uf,t as pf,u as hf,v as gf,U as mf,w as ff,x as xf,G as hc,y as _f,z as bf,H as yf,J as Cf,K as vf,L as Af,O as Sf,Q as jf,_ as Ef,$ as Tf,a0 as Pf,a1 as If,a2 as Rf,a3 as kf,a4 as wf,a5 as Nf,a6 as Of,a7 as Df,a8 as Lf,a9 as Mf,aa as Uf,ab as Ff,ac as Bf,E as Hf,ad as Gf,ae as Wf,af as Vf,ag as Yf,ah as zf,ai as Kf,aj as Qf,ak as qf,al as Zf,am as Xf,an as Jf,ao as $f,S as ex,ap as tx,aq as sx,ar as nx,as as ax,at as rx,au as ix,av as ox,aw as lx,ax as cx,ay as dx,az as ux,aA as px,aB as hx,aC as gx,aD as mx,aE as fx,aF as xx,aG as _x,aH as bx,aI as yx,aJ as Cx,aK as vx,aL as Ax,aM as Sx,aN as jx,aO as Ex,aP as Tx,aQ as Px,aR as Ix,aS as Rx,N as kx,aT as wx,aU as Nx,aV as Ox,aW as Dx,aX as Lx,aY as Mx,aZ as Ux,a_ as Fx,a$ as Bx,b0 as Hx,b1 as Gx,b2 as Wx,b3 as Vx,b4 as Yx,b5 as zx,b6 as Kx,b7 as Qx,b8 as qx,b9 as Zx,ba as Xx,bb as Jx,bc as $x,bd as e2,be as t2,bf as s2,bg as n2,bh as a2,bi as r2,bj as i2,bk as o2,bl as l2,bm as c2,bn as d2,bo as u2,bp as p2,bq as h2,br as g2,bs as m2,bt as f2,bu as x2,bv as _2,bw as b2,bx as y2,by as C2,bz as v2,I as A2,bA as S2,bB as j2,bC as E2,bD as T2,bE as P2,bF as I2,bG as R2,bH as k2,bI as w2,bJ as N2,bK as O2,bL as D2,bM as L2,bN as M2,bO as U2,bP as F2,bQ as B2,bR as H2,bS as G2,bT as W2,bU as V2,bV as Y2,D as z2,bW as K2,bX as Q2,bY as q2,bZ as Z2,F as X2,b_ as J2,b$ as $2,c0 as e_,c1 as t_,c2 as s_,c3 as n_,c4 as a_,c5 as r_,c6 as i_,c7 as o_,c8 as l_,c9 as c_,ca as d_,cb as u_,cc as p_,cd as h_,ce as g_,cf as m_,cg as f_,ch as x_,ci as __,cj as b_,ck as y_,cl as C_,cm as v_,cn as A_,co as S_,C as j_,cp as E_,cq as T_,cr as P_,cs as I_,ct as R_,cu as k_,cv as w_,cw as N_,cx as O_,cy as D_,cz as L_,cA as M_,B as U_,cB as F_,cC as B_,cD as H_,cE as G_,cF as W_,cG as V_,cH as Y_,cI as z_,cJ as K_,cK as Q_,cL as q_,cM as Z_,cN as X_,cO as J_,cP as $_,cQ as e1,cR as t1,cS as s1,cT as n1,cU as a1,cV as r1,cW as i1,cX as o1,cY as l1,cZ as c1,c_ as d1,c$ as u1}from"./module-CYrDBt6T.js";import{g as p1,a as h1,p as gc,v as g1}from"./module-DYRc1myh.js";import{I as m1,S as Bi,b as yo,a as f1,c as x1,P as mc}from"./module-BDscFCCP.js";import Qa from"./module-D-CCuB3j.js";import{P as _1}from"./module-C-Y3moQM.js";import{c as b1,E as fc,S as Hi,A as y1}from"./module-BmLAdfv_.js";import{m as C1}from"./module-ubDpl0_R.js";const hw={facebook:"facebook",google:"google",tiktok:"tiktok",twitter:"twitter",instagram:"instagram",pinterest:"pinterest"},v1=[{value:"US",label:"United States",link:"https://seller-us.tiktok.com",setting_url:"https://seller-us.tiktok.com/order/shipping-delivery-settings"},{value:"GB",label:"United Kingdom",link:"https://seller-uk.tiktok.com",setting_url:"https://seller-uk.tiktok.com/logistics/delivery?tab=shippingTemplate"}],A1=["/api/v1/seller/get","/api/v1/seller/common/get","/api/v3/seller/common/get","/api/v2/seller/common/get","/api/v1/affiliate/account/info?account_type=1"],Pt=()=>{const{getUserInfo:t}=de(),s=t(),a=dt().getShop(),{isMobile:r}=xe(),o=he(ka),l=he(dr);function c(I,F){try{window.$crisp&&Object.keys(F).length>0&&Object.entries(F).map(z=>{const[me,Re]=z;return window.$crisp?.push([I,me,Re])})}catch(G){console.log("error method "+I,G)}}function u(I){return window.$crisp?window.$crisp?.is(I):!1}const d=()=>
2{if(!Ce.isShopifyEmbedded()&&!r){y(),c("do",{"chat:open":void 0});return}let I=`https://go.crisp.chat/chat/embed/?website_id=${Ts.chat.keyAO}`,F=s?.email;a?.owner_email&&A(s.email)&&(F=a?.owner_email),s&&(I=`${I}&user_email=${F}&user_nickname=${s?.name}&user_avatar=${s?.avatar}`),window.open(I)},g=I=>{c("do",{"trigger:run":I})},h=()=>{c("do",{"chat:close":void 0})},p=I=>{c("on",{"chat:opened":I})},x=I=>{c("on",{"message:received":I})},f=I=>{c("on",{"chat:closed":I})},_=()=>u("chat:opened"),b=I=>{c("do",{"message:show":["text",I]})},v=()=>{c("do",{"chat:hide":void 0})},y=()=>{if(!r){o(!0),l("chat");return}c("do",{"chat:show":void 0})},C=I=>{if(_()||d(),typeof I=="string")return c("do",{"message:send":[I]});if(!(I.length>10))for(let F=0;F<I.length;F++){const G=I[F];setTimeout(()=>{c("do",{"message:send":[G]})},F*400)}},S=(I=1e3)=>{c("config",{"container:index":[I]})},j=I=>{if(_()||d(),typeof I=="string")return c("set",{"message:text":[I]});if(!(I.length>10))for(let F=0;F<I.length;F++){const G=I[F];setTimeout(()=>{c("set",{"message:text":[G]})},F*400)}},A=I=>/^[^\s@]+@aho\.app$/i.test(I);return{getUnreadMessage:()=>window.$crisp&&window.$crisp?.get("chat:unread:count")||0,chatWasClosed:f,setZIndexChatBox:S,triggerCrispEvent:g,setFirstPurchase:()=>{c("set",{"session:event":[[["new_user_paid"]]]})},pushEventUserVisitHere:I=>{c("set",{"session:event":[I]})},openChat:d,showChat:y,closeChat:h,hideChat:v,isChatOpened:_,sendMessageChat:C,setUserInfo:I=>{const F={"user:email":I.email};I.avatar&&(F["user:avatar"]=I.avatar),I.last_name&&I.first_name&&(F["user:nickname"]=I.first_name+" "+I.last_name);const G=[[["first_seen",I?.created_at||"No data"],["free_trial",I?.is_trial||"false"],["name",I?.name||"No data"]]];c("set",F),c("set",{"session:data":G})},pushEventCrisp:c,setShopInfo:(I,F)=>{const G=[[["store_list",at.map(F,"platform_domain").join(" , ")],["domain",at.get(I,"platform_domain")],["store_email",at.get(I,"owner_email")],["store_created_at",it(at.get(I,"created_at")).format(ec+" HH:MM")],["name",at.get(I,"owner_name")],["account_id",at.get(I,"owner_id")],["app_status",!0],["store_name",I.store_name],["link-integration-partner",`${Ts.shopify.admin_app_new.replace("{{domain}}",I?.platform_domain?.replace(/.myshopify.com/,"")||"")}/app/integration/dropship-partner?tracking_event=dropship_partners_redirect`]]],z=F.find(me=>me.is_default===1);z&&z.platform==="shopify"&&G[0].push(["shopify_plan",z?.plan_name]),c("set",{"session:data":G})},setCurrentPlan:I=>{const F=+I.package.price==0?"free":I.package.price,G=I.package?.modules?.find(De=>De.type==="CREDIT"),Re=(I.package.features||{})?.DROPSHIP_PARTNER?.limit===-1?G?.price?"included":"yes":"no",Be=[[["plan",`$${F}`],["is_trial",I?.is_trial||!1],["plan_name",`${G?.name}${G?.is_legacy?" (Old)":""}`],["dropship_partner",Re],["expert_care",I.is_expert_care]]];G?.is_legacy&&!G.price&&c("set",{"session:event":["legacy_user_free"]}),c("set",{"session:data":Be})},onChatOpened:p,onMessageReceivedListener:x,setUserStartSelectFreePlan:(I="")=>{I.includes("trial")?c("set",{"session:event":["new_user_free"]}):c("set",{"session:event":["new_user_free_notrial"]})},resetSessionData:()=>{c("do",{"session:reset":void 0})},setOrderList:I=>{c("set",{"session:data":[[["order_list",I]]]})},setProductList:I=>{c("set",{"session:data":[[["product_list",I]]]})},setCashback:I=>{c("set",{"session:data":[[["Cashback",I]]]})},setUpdateCollection:I=>{const F=[[["collection_product",`${I?.aliexpress_products}`||"0"],["collection_store",`${I?.shopify_stores}`||"0"],["collection_supplier",`${I?.suppliers}`||"0"],["collection_ads",`${I?.ads}`||"0"],["collection_hashtag",`${I?.hashtags}`||"0"]]];c("set",{"session:data":F})},setUserChooseAIEnhancer:()=>{c("set",{"session:event":["ai_enhancer_result"]})},setVariantKeyAB:I=>{I&&c("set",{"session:data":[[["OB_variant",I]]]})},setAppEmail:(I,F)=>{const G={"user:email":I.email};A(I.email)&&(G["user:email"]=F?.owner_email),c("set",G)},setInstalledDate:I=>{const F=[[["installed_date",it(I?.created_at).format(ec)||"No data"]]];c("set",{"session:data":F})},removeVariable:()=>{c("set",{"session:data":[[["platform_domain_name",""],["OB_variant",""]]]})},prepareMessageChat:j,setUserFreePlanCollection:I=>{I==="trendy-product"&&c("set",{"session:event":["trendy_user_free"]}),I==="best-selling"&&c("set",{"session:event":["bestselling_user_free"]}),Ce.isShopifyEmbedded()&&d()}
2,setActionEvent:I=>{c("set",{"session:event":[I]}),Ce.isShopifyEmbedded()&&d()},sentToUserMessage:b,getChatLinkEmbedded:()=>{let I=`https://go.crisp.chat/chat/embed/?website_id=${Ts.chat.keyAO}`,F=s?.email;const G=typeof window<"u"?window.CRISP_TOKEN_ID:null;return a?.owner_email&&A(s.email)&&(F=a?.owner_email),s&&(I=`${I}&user_email=${F}&user_nickname=${s?.name}&user_avatar=${s?.avatar}`),G&&(I+=`&token_id=${G}`),I}}},Wn=()=>{const t=window.__APP_BRIDGE__;if(!t)return null;const s=Oe.useMemo(function(){return zn.create(t)},[t]),n=Oe.useCallback(function(a,r){const o=S1(a);if(o.startsWith("/")){const c=Bp(o);if(r?.type==="ADMIN"){s.dispatch(zn.Action.ADMIN_PATH,{path:c.replace(/^\/admin/,""),newContext:r?.target==="new"});return}if(r&&r.target==="self"&&r.replace)return;s.dispatch(zn.Action.APP,c);return}s.dispatch(zn.Action.REMOTE,{url:o,newContext:r?.target==="new"})},[s]);return Oe.useCallback(function(a,r){if(zn.isAdminSection(a)){const o=Object.assign({},a,{name:zn.ResourceType[a.name]});s.dispatch(zn.Action.ADMIN_SECTION,{section:o,newContext:r?.target==="new"});return}n(a,r)},[n,s])};function S1(t){return t instanceof URL?t.toString():typeof t=="string"?t:Bp(t)}function Bp(t){if(typeof t=="string")return t.startsWith("/")?t:xc(new URL(t));const s=t.search instanceof URLSearchParams?t.search.toString():t.search;return xc(Object.assign({},t,{search:s}))}function xc(t){const s=t.pathname,n=t.search,a=t.hash;return""+s+(n||"")+(a||"")}var Hp=(t=>(t.GET_DETAIL_PRODUCT="center/products/:productId",t.UPDATE_PRODUCT_FAVORITE="center/
2products/listings/favourite/:productCenterId/update",t.SPLIT_PRODUCT="center/products/:productId/split",t.DUPLICATE_PRODUCT="center/products/:productId/duplicate",t.UPDATE_MEDIA="center/products/:productCenterId/update-media",t.UPLOAD_IMAGE="center/products/:productCenterId/upload",t.OPTIMIZE_DELETE_IMAGE="center/products/:productCenterId/delete-image",t.SAVE_AND_UPDATE_STORE_MULTIPLE="center/products/:productCenterId/edit-and-push-multiple-store",t.POST_AI_GENERATE="center/products/:productId/ai_generate",t.SYNCHRONIZE_VARIANT="center/products/:productCenterId/confirm-update",t.REVERT_IMAGE="center/products/:productCenterId/revert-optimize",t.POST_AI_ENHANCE_TITLE="center/products/listings/ai-enhancer/optimize-title",t.POST_AI_ENHANCE_CONTENT="center/products/listings/ai-enhancer/optimize-content",t.POST_AI_ENHANCE_SEO_TITLE="center/products/listings/ai-enhancer/generate-seo-title",t.POST_AI_ENHANCE_SEO_CONTENT="center/products/listings/ai-enhancer/generate-seo-content",t.POST_AI_ENHANCE_SELLING_PRICE="center/products/listings/ai-enhancer/setup-selling-price",t.REFRESH_LISTING_STATUS="center/products/:productId/refresh-listings-settings",t.GET_COLLECTIONS="/products/collection/all",t.GET_COLLECTIONS_CHANNELS="products/collection/all-channel",t.POST_CHANGE_IMAGE_VARIANT="core/image-temp/upload",t.POST_FIND_RELATED_IMAGES_ALIEXPRESS="center/products/source/aliexpress/:id/find-related-images",t.POST_FIND_RELATED_MEDIA="center/products/source/aliexpress/:id/find-related-media",t.FILTER_RELATED_IMAGES="/center/products/source/aliexpress/:productId/filter-related-images",t.GET_PRODUCT_VARIANTS="/inventory/product-detail/:es_id",t.MAP_VARIANTS="/inventory/product/:center_product_package_id/map-variants",t.ADD_SOURCE="/inventory/product/:center_product_package_id/add-source/:product_id",t.REMOVE_SOURCE="inventory/product/:center_product_package_id/remove-source/:product_id",t.POST_IMPORT_SOURCE_PRODUCT="/center/products/import/:productSource",t.POST_PRODUCT_DROP_SHIP="/center/products/source/platform/:id",t.GET_PRODUCT_DROP_SHIP="center/products/source/platform/:id",t))(Hp||{});const j1=async(t,s={},n)=>{const{productCenterId:a}=t;s.method="POST";const r="center/products/:productCenterId/confirm-update".replace(":productCenterId",a+"");return X(r,{},s,n)},E1=async(t,s={},n)=>{const{productId:a,...r}=t,o="center/products/:productId".replace(":productId",a+"");return X(o,r,s,n)},T1=async(t,s={},n)=>{const{productId:a,requestParams:r}=t;s.method="PUT";const o="center/products/listings/favourite/:productCenterId/update".replace(":productCenterId",a+"");return X(o,r,s,n)},P1=async(t,s={},n)=>{const{productId:a,requestParams:r}=t,o="center/products/:productId/split".replace(":productId",a+"");return s.method="POST",X(o,r,s,n)},I1=async(t,s={},n)=>{const{productId:a,requestParams:r}=t,o="center/products/:productId/duplicate".replace(":productId",a+"");return s.method="POST",X(o,r,s,n)},R1=async(t,s={},n)=>{const{images:a,productCenterId:r}=t;s.method="POST";const o="center/products/:productCenterId/delete-image".replace(":productCenterId",r+"");return X(o,{images:a},s,n)},k1=async(t,s={},n)=>{const{productCenterId:a}=t;s.method="POST";const r="center/products/:productCenterId/update-media".replace(":productCenterId",a+"");return X(r,t,s,n)},w1=async(t,s={},n)=>{const{productCenterId:a,formData:r}=t;s.method="POST";const o="center/products/:productCenterId/upload".replace(":productCenterId",a+"");return X(o,r,s,n)},N1=async(t,s={},n)=>{const{productCenterId:a}=t;s.method="POST";const r="center/products/:productCenterId/revert-optimize".replace(":productCenterId",a+"");return X(r,{},s,n)},O1=async(t,s={},n)=>{const{productId:a,...r}=t,o="center/products/:productId/ai_generate".replace(":productId",a+"");return s.method="POST",X(o,r,s,n)},D1=async(t,s={},n)=>{const{productId:a,requestParams:r}=t;s.method="PUT";const o="center/products/:productCenterId/edit-and-push-multiple-store".replace(":productCenterId",a+"");return X(o,r,s,n)},L1=async t=>X("center/products/listings/ai-enhancer/optimize-title",t,{method:"POST"}),M1=async t=>
2X("center/products/listings/ai-enhancer/optimize-content",t,{method:"POST"}),U1=async t=>X("center/products/listings/ai-enhancer/generate-seo-content",t,{method:"POST"}),F1=async t=>X("center/products/listings/ai-enhancer/generate-seo-title",t,{method:"POST"}),B1=async t=>X("center/products/listings/ai-enhancer/setup-selling-price",t,{method:"POST"}),H1=async t=>X("center/products/:productId/refresh-listings-settings".replace(":productId",t.productId+""),{},{method:"GET"}),G1=async t=>X("/products/collection/all",t),W1=async(t,s)=>{if(t?.storeId)return X("products/collection/all-channel",t,{...s,method:"GET",headers:{"store-id":t.storeId,...s?.headers}})},V1=async t=>{const s="core/image-temp/upload",n=ge.shopStorage.getCurrentShopId();return X(s,t,{method:"POST",headers:{"store-id":n}})},Y1=async(t,s={})=>{const n="center/products/source/aliexpress/:id/find-related-images".replace(":id",t.id+"");return X(n,t.formData,{...s,method:"POST"})},z1=async(t,s={})=>{const n="center/products/source/aliexpress/:id/find-related-media".replace(":id",t.id+"");return X(n,t.formData,{...s,method:"POST"})},K1=async t=>{const s="/center/products/source/aliexpress/:productId/filter-related-images".replace(":productId",t.productId+"");return X(s,t,{method:"POST"})},Q1=async(t,s)=>{const n="/inventory/product-detail/:es_id".replace(":es_id",t);return X(n,{},{method:"GET"},{cancelToken:s})},q1=async(t,s)=>{if(!t)throw new Error("Product ID is required");const n="/inventory/product/:center_product_package_id/map-variants".replace(":center_product_package_id",String(t));return X(n,{variants:s},{method:"POST"})},Z1=async(t,s)=>{if(!t)throw new Error("Product ID is required");if(!s)throw new Error("Source product ID is required");const n="/inventory/product/:center_product_package_id/add-source/:product_id".replace(":center_product_package_id",String(t)).replace(":product_id",String(s));return X(n,{},{method:"POST"})},X1=async(t,s)=>{if(!t)throw new Error("Product ID is required");if(!s)throw new Error("Source product ID is required");const n="inventory/product/:center_product_package_id/remove-source/:product_id".replace(":center_product_package_id",String(t)).replace(":product_id",String(s));return X(n,{},{method:"POST"})},J1=(t,s)=>X("/center/products/import/:productSource".replace(`:${Ct.PRODUCT_SOURCE}`,t.source),t.product,{method:"POST"},{cancelToken:s}),$1=async(t={id:"",payload:{},source:ui.aliexpress,method:"POST"},s)=>{const n=`${t.method}_PRODUCT_DROP_SHIP`;return X(q.replace(Hp[n].replace(Ct.PLATFORM,ui[t.source])+`${t.source==="temu"&&t.payload.price_rule?"?price_rule=true":""}`,":id",t.id),t.source==="temu"&&t.method==="GET"?{}:t.payload,{method:t.method},{cancelToken:s})},eb={synchronizeVariants:j1,splitProduct:P1,duplicateProduct:I1,updateProduct:T1,getDetailProduct:E1,deleteImage:R1,uploadImage:w1,updateMedia:k1,postAiGenerate:O1,revertImage:N1,saveAndUpdateMultiple:D1,postAiEnhanceTitle:L1,postAiEnhanceContent:M1,postAiEnhanceSeoContent:U1,postAiEnhanceSeoTitle:F1,postAiEnhanceSellingPrice:B1,refreshListingStatus:H1,getCollections:G1,getCollectionsChannels:W1,postChangeImageVariant:V1,postFindRelatedImages:Y1,postFindRelatedMedia:z1,filterRelatedImages:K1,getProductVariants:Q1,mapVariants:q1,addSource:Z1,removeSource:X1,postImportSourceProduct:J1,postProductDropShip:$1},tb=({title:t,content:s,name:n="description",...a})=>e.jsxs(Rm,{...a,children:[e.jsx("title",{children:t}),e.jsx("meta",{name:n,content:s})]}),Nt=Rt,As=t=>{const{onChange:s}=t;return e.jsx(hl,{...t,onChange:(...n)=>requestAnimationFrame(()=>s?.(...n))})},Gp=t=>e.jsx(rg,{...t}),$e=$s,Co=t=>e.jsx(ig,{...t}),sb=t=>e.jsx(og,{...t}),Wp=({message:t,saveAction:s,discardAction:n})=>{const a=i.useRef(null),r=()=>{s?.onAction&&s.onAction()},o=()=>{l(),n?.onAction&&n.onAction()},l=()=>{window.shopify&&window.shopify.saveBar.hide("ms-my-save-bar")};return i.useLayoutEffect(()=>{if(window.shopify)return()=>{window.shopify.saveBar.hide("ms-my-save-bar")}},[]),Ce.isShopifyEmbedded()?e.jsx(e.Fragment,{children:e.jsxs(lg,{id:"ms-my-save-bar",onHide:l,open:!0,ref:a,children:[e.jsx("button",{loading:s.loading?"":!1,variant:"primary",onClick:r,children:s.content}),e.jsx("button",{disabled:n.disabled||s.loading,onClick:o,children:n.content})]})}):e.jsx(cg,{message:t,saveAction:s,discardAction:n})},Vp=aa,nb=t=>{const{...s}=t;return e.jsx(dg,{...s})},nt=({children:t,isMobile:s,mobileProps:n,...a})=>s?e.jsx("div",{className:oe("border bg-bg-surface border-border-secondary rounded-xl p-3",n?.className),children:t}):e.jsx(Ln,{...a,children:t}),Lr=mo,Yp=t=>e.jsx(gl,{...t}),_i=D,ab=ug,Cn=t=>e.jsx(fp,{...t}),rb=({title:t,children:s})=>{const{isMobile:n}=xe();return n?e.jsx(pg,{title:t,children:s}):s},Ua={1136:{maxWidth:"calc(1136px + 3rem)",margin:"0 auto"},1176:{maxWidth:"calc(1172px + 3rem)",margin:"auto"},998:{maxWidth:"998px",margin:"auto"},1428:{maxWidth:"1428px",margin:"auto"}},zt=()=>{const t=de(),s={AO:t.getCurrentPlan("AO"),PH:t.getCurrentPlan("PH")},n={AO:"CREDIT",PH:"PH"},a=t.getPricingPlan(),r=t.getUserInfo(),o=i.useCallback((y="AO")=>s[y]?.package?.cycle||30,[s]),l=i.useCallback((y="AO")=>s[y],[s]),c=i.useCallback((y="AO")=>s?.[y]?.package?.modules.find(C=>C.type===n[y]),[s]),u=i.useCallback((y="AO")=>s?.[y]?.next_package?.modules?.find(C=>C.type===n[y]),[s]),d=i.useCallback((y="AO")=>s?.[y]?.next_package?.cycle,[s]),g=i.useCallback((y,C="AO")=>{const S=s?.[C]?.next_package?.modules?.find(j=>j.type===n[C])?.key||"";return S?S===y:!1},[s]),h=i.useCallback((y="AO")=>s?.[y]?.package?.modules.find(C=>C.type!==n[y]),[s]),p=i.useCallback((y,C="AO")=>
2a&&(a[n[C]]||[]).find(j=>j.key===y)||null,[a]),x=i.useCallback((y,C="AO")=>{const S=s[C]?.package?.modules.find(j=>j.type===n[C])?.key||"";return S?S===y:!1},[s]),f=i.useCallback((y,C="AO")=>C==="AO"?["GROWTH_CREDIT_TIER"].includes(y):["LIGHT_CREDIT_TIER_PH"].includes(y),[]),_=i.useCallback((y,C="AO")=>{const S=s[C]?.package?.features[y];return S?S.limit===-1:!1},[s]),b=i.useMemo(()=>r?.is_new_pricing_mvp||r?.is_user_mkt||x("FREE_CREDIT","AO")&&!q.size(h("AO")),[r,s]);return{isCurrentFreePlan:i.useCallback((y="AO")=>x("FREE_CREDIT",y),[x,s]),hasNewPricing:b,hasPermissionFeature:_,hasRecommendPlan:f,getCurrentCyclePlan:o,getCurrentStoreCharge:l,getCurrentFulfillmentPlan:c,getNextFulfillmentPlan:u,getNextCyclePlan:d,hasScheduledPlan:g,hasCurrentPlanActive:x,findPlanByKey:p}},_c=t=>{const{t:s}=J(),{getCurrentCreditPlan:n,getCurrentPlan:a,getPricingPlan:r}=de(),o=a(),c=r()?.CREDIT||[],u=o?.package?.modules?.[0]?.key,d=u?.includes("STARTER_CREDIT_TIER")?"STARTER_CREDIT_TIER":u,g=(v,y,C=!1)=>{if(!y||!v)return;const S=c.find(A=>A.key===y),j=C?o?.package?.features?.[v]?.limit||0:S?.features?.[v]||0;return Fe(j)},h=[{icon:e.jsxs("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M9.49689 4.88867C9.55398 4.90943 9.56894 4.9311 9.57697 4.94629C9.59755 4.98528 9.60738 5.02853 9.6004 5.08887L9.00568 9.90039L8.94708 10.376H12.4598C12.5118 10.376 12.53 10.3871 12.534 10.3896C12.5378 10.3921 12.5557 10.4046 12.5779 10.4531H12.5789C12.6011 10.5015 12.5995 10.5255 12.5984 10.5332C12.5973 10.5412 12.5924 10.5651 12.5584 10.6064L7.25861 16.9541C7.22342 16.9958 7.19264 17.0118 7.16095 17.0195C7.12637 17.0274 7.09386 17.0257 7.04962 17.0059H7.04767C7.00047 16.9849 6.97476 16.9595 6.95587 16.9277C6.9488 16.9156 6.94276 16.9013 6.93927 16.8828L6.93829 16.8125L7.54962 12.5518L7.61896 12.0684H4.60431C4.55343 12.0683 4.53279 12.0576 4.52618 12.0537C4.52043 12.0502 4.50276 12.0388 4.48126 11.9971C4.45955 11.9549 4.46036 11.9347 4.46075 11.9297C4.46125 11.9239 4.46426 11.9028 4.49298 11.8633L4.49884 11.8545L9.26056 4.95605C9.29831 4.90401 9.33137 4.88587 9.36017 4.87695C9.38851 4.86821 9.42902 4.86409 9.49689 4.88867Z",stroke:"#4A4A4A",strokeWidth:"0.84618"}),e.jsx("path",{d:"M11.7388 8.56028C13.7157 8.56028 14.5773 7.72859 14.5773 5.72174C14.5773 7.72859 15.433 8.56028 17.4158 8.56028C15.433 8.56028 14.5773 9.41594 14.5773 11.3988C14.5773 9.41594 13.7157 8.56028 11.7388 8.56028Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.473089",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 13.222C2.88398 13.222 3.26927 12.8501 3.26927 11.9527C3.26927 12.8501 3.65189 13.222 4.53854 13.222C3.65189 13.222 3.26927 13.6046 3.26927 14.4913C3.26927 13.6046 2.88398 13.222 2 13.222Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.346165",strokeLinejoin:"round"})]}),content:s("AICreditsMonthly"),current_value:n(d,!0)},{icon:e.jsx(ee,{source:ms}),content:s("ProductToPush"),current_value:g("PRODUCT_LISTING",d,!0)},{icon:e.jsx(ee,{source:is}),content:s("OrdersToFulfill"),current_value:g("ORDER_FULFILLMENT",d,!0)}],p=er[d||""]||[],x=Xn[d||""]?d==="PRO_CREDIT_TIER"?[]:[...Xn[d||""]]:[],f=ho[d||""]||[],_=Us[d||""]||[],b=[...f,..._];return e.jsxs("div",{className:"mt-0",children:[e.jsx(m,{as:"span",variant:"headingXs",children:s("UsageQuota")}),e.jsx("div",{className:"space-y-2 mt-2",children:h.map((v,y)=>e.jsx(i.Fragment,{children:e.jsxs(U,{gap:"100",children:[e.jsx("span",{children:v.icon}),e.jsx(U,{gap:"150",children:e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"semibold",children:[v.current_value," ",e.jsx(m,{as:"span",variant:"bodySm",children:v.content})]})})]})},y))}),e.jsx("div",{className:"my-4",children:e.jsx($e,{})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[p.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"semibold",children:s("CoreTools")})}),e.jsx("div",{className:"flex flex-col gap-1",children:p?.map((v,y)=>e.jsx(m,{variant:"bodySm",as:"span",tone:void 0,children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{children:e.jsx(ee,{tone:void 0,source:Je})}),e.jsx("div",{dangerouslySetInnerHTML:{__html:s(v)}})]})},y))})]}),x.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:s("AdvancedTools")})}),e.jsxs("div",{className:"flex flex-col gap-1",children:[x?.map((v,y)=>e.jsx(m,{variant:"bodySm",as:"span",tone:void 0,children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{children:e.jsx(ee,{tone:void 0,source:Je})}),e.jsx("div",{dangerouslySetInnerHTML:{__html:s(v)}})]})},y))," ",b?.map((v,y)=>e.jsx(m,{variant:"bodySm",as:"span",tone:void 0,children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{children:e.jsx(ee,{tone:void 0,source:Je})}),e.jsx("div",{dangerouslySetInnerHTML:{__html:s(v)}})]})},y))]})]})]})]})},ib=bm("relative flex items-center gap-0.5 rounded-lg font-medium cursor-pointer",{variants:{variant:{primary:"bg-bg-fill-brand text-text-brand-on-bg-fill shadow-button-primary hover:bg-bg-fill-brand-hover active:shadow-button-primary-inset",secondary:"bg-bg-fill text-text shadow-button hover:bg-bg-fill-hover active:shadow-button-inset",tertiary:"text-text hover:bg-bg-fill-transparent-hover active:bg-bg-fill-transparent-active",plain:"bg-transparent hover:underline text-text-link",monochromePlain:""},size:{micro:"min-h-6 text-body-sm py-1 px-2",slim:"min-h-7 text-body-sm py-1.5 px-3",medium:"min-h-7 text-body-sm py-1.5 px-3",large:"min-h-8 text-body-md py-1.5 px-3"},tone:{success:"",critical:""},fullWidth:{true:"w-full",false:""},iconOnly:{true:"p-1 min-w-min",false:""},hasIcon:{true:"pl-1.5 pr-3",false:""},disabled:{true:"",false:""}},compoundVariants:[{variant:["monochromePlain","plain"],size:"medium",class:"md:text-body-md"},{variant:"primary",tone:"success",class:"bg-bg-fill-success text-text-success-on-bg-fill hover:bg-bg-fill-success-hover active:bg-bg-fill-success-active active:shadow-button-primary-success-inset"},{variant:["secondary","tertiary","plain"],tone:"success",class:"text-text-success hover:text-text-success-hover active:text-text-success-active"},{variant:"primary",tone:"critical",class:"shadow-button-primary-critical bg-bg-fill-critical hover:bg-bg-fill-critical-hover active:bg-bg-fill-critical-active active:shadow-button-primary-critical-inset"},{variant:["secondary","tertiary","plain"],tone:"critical",class:"text-text-critical hover:text-text-critical-hover active:text-text-critical-active"},{variant:["primary","secondary"],class:"[&:active>*]:translate-y-0.25"},{variant:["primary"],disabled:!0,class:"bg-bg-fill-brand-disabled text-text-disabled shadow-none pointer-events-none select-none [&:disabled_svg]:fill-text-brand-on-bg-fill-disabled"},{variant:["tertiary","plain","monochromePlain"],disabled:!0,class:"bg-transparent text-text-disabled shadow-none pointer-events-none select-none [&:disabled_svg]:fill-icon-disabled"},{variant:["secondary"],disabled:!0,class:"bg-bg-fill-disabled text-text-disabled shadow-none pointer-events-none select-none [&:disabled_svg]:fill-icon-disabled"}],defaultVariants:{variant:"secondary",size:"medium",fullWidth:!1,iconOnly:!1,hasIcon:!1,disabled:!1}}),vn=i.forwardRef((t,s)=>{const{children:n,icon:a,variant:r="secondary",size:o="medium",tone:l,iconOnly:c=!1,fullWidth:u=!1,loading:d=!1,disabled:g,className:h,href:p,forceExternal:x=!1,isTruncate:f=!0,..._}
2=t,b=!!n,v=d?"invisible":"",y=g||d,C=!!a&&!c,S=d?e.jsx("span",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:e.jsx(Pa,{size:"small"})}):null,j=e.jsxs(e.Fragment,{children:[S,a&&(typeof a=="function"?e.jsx("span",{className:`shrink-0 ${c?"":"-my-0.5"} ${v}`,children:a({className:"size-5"})}):e.jsx("span",{className:`shrink-0 ${v}`,children:a})),b&&e.jsx("span",{className:`w-full ${f?"truncate":""} ${v}`,children:(i.isValidElement(n),n)})]}),A={className:oe(ib({variant:r,size:o,tone:l,fullWidth:u,iconOnly:c,hasIcon:C,disabled:y||d,className:h}))};return p?x||/^https?:\/\//.test(p)||p.startsWith("//")||p.startsWith("tel:")||p.startsWith("mailto:")?e.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",...A,..._,children:j}):e.jsx(fr,{to:p,...A,..._,children:j}):e.jsx("button",{ref:s,disabled:y||d,...A,..._,children:j})});vn.displayName="Button";var bc,yc;function vo(){return vo=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},vo.apply(null,arguments)}const ai=t=>i.createElement("svg",vo({xmlns:"http://www.w3.org/2000/svg",width:20,height:21,fill:"none"},t),bc||(bc=i.createElement("path",{stroke:"#4A4A4A",d:"M9.497 4.889c.057.02.072.042.08.057.02.04.03.083.023.143L9.006 9.9l-.059.476h3.513c.052 0 .07.011.074.014.004.002.022.015.044.063.023.049.022.072.02.08 0 .008-.006.032-.04.073l-5.3 6.348a.18.18 0 0 1-.097.066.16.16 0 0 1-.111-.014h-.002a.2.2 0 0 1-.092-.078.1.1 0 0 1-.017-.045v-.07l.61-4.261.07-.484H4.604c-.05 0-.071-.01-.078-.014-.006-.004-.023-.015-.045-.057s-.02-.062-.02-.067.003-.027.032-.067l.006-.008L9.26 4.956a.2.2 0 0 1 .1-.08c.028-.008.068-.012.136.013Z"})),yc||(yc=i.createElement("path",{fill:"#4A4A4A",stroke:"#4A4A4A",d:"M11.739 8.56c1.977 0 2.838-.831 2.838-2.838 0 2.007.856 2.838 2.839 2.838-1.983 0-2.839.856-2.839 2.839 0-1.983-.861-2.839-2.838-2.839ZM2 13.222c.884 0 1.27-.372 1.27-1.27 0 .898.382 1.27 1.269 1.27-.887 0-1.27.383-1.27 1.27 0-.887-.385-1.27-1.269-1.27Z"}))),qt=(t,s,n=1)=>({yearlyPrice:Number((t*(12-s)).toFixed(n)),eachYearlyPrice:Number((t*(12-s)/12).toFixed(n)),saveYearlyPrice:Number((t*s).toFixed(n))}),Ks=()=>({packages:cb,freePackage:ob,features:lb,newLabel:db}),ob={is_legacy:0,key:"FREE_CREDIT",name:"Free",subName:"ForTestingPurposes",price:0,yearlyPrice:0,eachYearlyPrice:0,saveYearlyPrice:0,defaultPay:"monthly",saveMonth:0,support:{title:"EmailAndLiveChatSupport",content:[]},includes:[{keyPermission:"AI_PRODUCT_CONTENT",value:10,icon:ai,valuePrefix:"",label:"AICreditsMonthly",subtitle:{label:"ValuePerUsage",value:.2}},{keyPermission:"PRODUCT_LISTING",value:20,icon:ms,label:"ProductsToPush",subtitle:{label:"ValuePerProduct",value:.13}},{keyPermission:"ORDER_FULFILLMENT",value:15,icon:sa,valuePrefix:"TrackingMonth",label:"OrdersToFulfill",subtitle:{label:"ValuePerOrder",value:.66}}],extraIncludes:{key:"free",includes:[]}},lb=[{key:"product_Management",title:"ProductManagement",description:"CreateEditAndManageYourProductCatalogEfficientlyAsItGrows",content:[{title:"ProductsYouCanPublish",columns:[{value:20,subtitle:""},{value:400,subtitle:""},{value:1e3,subtitle:""},{value:5e3,subtitle:""}],tooltip:"MaximumProductsManagedByZopi"},{title:"BulkProductImportURLCSV",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"ImportManyProductsAtOnce"},{title:"EditProductContentSEO",columns:[{value:"Limited",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"TitlesDescriptionsImagesSEO"},{title:"SplitProductVariants",columns:[{value:"",subtitle:""},{value:"Limited",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"ManageHowVariantsAppearInShopify"},{title:"BulkPriceUpdates",columns:[{value:"",subtitle:""},{value:1,subtitle:"Time"},{value:10,subtitle:"Time"},{value:30,subtitle:"Time"}],tooltip:"UpdatePricesForAllStoreProductsAtOnce"}]},{key:"AI",title:"AITools",description:"SaveTimeCreatingHighqualityProductContentAndImprovingSearchVisibility",content:[{title:"MonthlyAIUsageCredits",columns:[{value:10,subtitle:""},{value:100,subtitle:""},{value:350,subtitle:""},{value:1e3,subtitle:""}],tooltip:"AIUsageForWritingSEOImages"},{title:"AIProductDescriptionWriting",columns:[{value:"Limited",subtitle:""},{value:"Limited",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"GenerateAndCustomizeProductCopy"},{title:"AISEOOptimization",columns:[{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"OptimizeTitlesMetaAutomatically"},{title:"AIThumbnailStyles",columns:[{value:"",subtitle:""},{value:"Limited",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"ImproveVisualsForBetterConversion"},{title:"AIFindImages",columns:[{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"EnrichProductMediaLibrary"}]},{key:"pricing_automation",title:"PricingAutomation",description:"AutomaticallyReactToSupplierPriceAndStockChangesToProtectProfit",content:[{title:"AutopushProducts",columns:[{value:"Limited",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"PushProductsToYourStoreBasedOnDefinedRules"},{title:"AutomaticPricingRules",columns:[{value:"Limited",subtitle:""},{value:"Limited",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"DefineRulesToControlSellingPrice"},{title:"AutooptimizeProductContent",columns:[{value:"",subtitle:""},{value:"tick",subtitle:"Time"},{value:"tick",subtitle:"Time"},{value:"tick",subtitle:"Time"}],tooltip:"ImproveContentQualityAutomatically"},{title:"AutohandleOutofstockProducts",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"PauseOrAdjustProductsWhenOutOfStock"},{title:"AutoRepublishProducts",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"SetProductsOnlineWhenSupplierBackInStock"},{title:"AutoupdatePriceWhenCostChanges",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"Limited",subtitle:""},{value:"tick",subtitle:""}
2],tooltip:"ChangeSellingPriceWhenSupplierPricesChange"}]},{key:"order_management",title:"OrdersFulfillment",description:"ProcessOrdersFasterAndReduceFulfillmentErrors",content:[{title:"MonthlyOrdersYouCanFulfill",columns:[{value:15,subtitle:"OrdersMonth"},{value:100,subtitle:"OrdersMonth"},{value:500,subtitle:"OrdersMonth"},{value:2e3,subtitle:"OrdersMonth"}],tooltip:"MaximumOrdersProcessedViaZopiEachMonth"},{title:"BulkOrderFulfillment",columns:[{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"ProcessMultipleOrdersAtOnce"},{title:"OrderTrackingManagement",columns:[{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"SyncAndManageTrackingInformation"},{title:"ReorderResendFailedOrders",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"QuicklyRetryFailedOrReturnedOrders"}]},{key:"ScaleAccount",title:"ScaleAccount",description:"BuiltForGrowingTeamsAndMultistoreOperations",content:[{title:"ManageMultipleStores",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"",subtitle:""},{value:"tick",subtitle:""}],tooltip:"OperateMoreThanOneStoreFromOneAccount"},{title:"PrioritySupportSLA",columns:[{value:"",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"GuaranteedResponseTimeAndDedicatedSupport"},{title:"CustomWorkflowsLimits",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"",subtitle:""},{value:"tick",subtitle:""}],tooltip:"CustomWorkflowsLimits"},{title:"CustomAPIIntegrationsERPCRM",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"",subtitle:""},{value:"",subtitle:""}],tooltip:"ImplementZopiWithYourCurrentSystem"},{title:"DedicatedAccountManager",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"",subtitle:""},{value:"",subtitle:""}],tooltip:"11SupportWithAllYourUsageNeeds"}]}],cb=[{is_legacy:0,key:"STARTER_CREDIT_TIER",name:"Launch",subName:"ForSoloEntrepreneurs",price:bs.STARTER_CREDIT_TIER,yearlyPrice:qt(bs.STARTER_CREDIT_TIER,tt).yearlyPrice,eachYearlyPrice:qt(bs.STARTER_CREDIT_TIER,tt).eachYearlyPrice,saveYearlyPrice:qt(bs.STARTER_CREDIT_TIER,tt).saveYearlyPrice,defaultPay:"monthly",saveMonth:tt,support:{title:"EmailAndLiveChatSupport",content:[]},includes:[{keyPermission:"AI_PRODUCT_CONTENT",value:100,icon:ai,valuePrefix:"",label:"AICreditsMonthly",subtitle:{label:"ValuePerUsage",value:.2}},{keyPermission:"PRODUCT_LISTING",value:400,icon:ms,label:"ProductsToPush",subtitle:{label:"ValuePerProduct",value:.13}},{keyPermission:"ORDER_FULFILLMENT",value:100,icon:sa,valuePrefix:"TrackingMonth",label:"OrdersToFulfill",subtitle:{label:"ValuePerOrder",value:.66}}],extraIncludes:{key:"free",includes:[]}},{is_legacy:0,key:"GROWTH_CREDIT_TIER",subName:"ForSmallTeams",name:"Scale",price:bs.GROWTH_CREDIT_TIER,yearlyPrice:qt(bs.GROWTH_CREDIT_TIER,tt).yearlyPrice,eachYearlyPrice:qt(bs.GROWTH_CREDIT_TIER,tt).eachYearlyPrice,saveYearlyPrice:qt(bs.GROWTH_CREDIT_TIER,tt).saveYearlyPrice,defaultPay:"monthly",saveMonth:tt,support:{title:"247LiveChatSupport",content:["DedicatedOnboardingSpecialist"]},includes:[{keyPermission:"AI_PRODUCT_CONTENT",value:350,icon:ai,valuePrefix:"",label:"AICreditsMonthly",subtitle:{label:"ValuePerUsage",value:.2}},{keyPermission:"PRODUCT_LISTING",value:1e3,icon:ms,label:"ProductsToPush",subtitle:{label:"ValuePerProduct",value:.13}},{keyPermission:"ORDER_FULFILLMENT",value:500,icon:sa,valuePrefix:"TrackingMonth",label:"OrdersToFulfill",subtitle:{label:"ValuePerOrder",value:.66}}],extraIncludes:{key:"free",includes:[]}},{is_legacy:0,key:"PRO_CREDIT_TIER",subName:"ForScalingBusinesses",name:"Expand",price:bs.PRO_CREDIT_TIER,yearlyPrice:qt(bs.PRO_CREDIT_TIER,tt).yearlyPrice,eachYearlyPrice:qt(bs.PRO_CREDIT_TIER,tt).eachYearlyPrice,saveYearlyPrice:qt(bs.PRO_CREDIT_TIER,tt).saveYearlyPrice,defaultPay:"monthly",saveMonth:tt,support:{title:"247LiveChatSupport",content:["DedicatedOnboardingSpecialist","OnDemandDirectSupportViaPhoneCall"]},includes:[{keyPermission:"AI_PRODUCT_CONTENT",value:1e3,icon:ai,valuePrefix:"",label:"AICreditsMonthly",subtitle:{label:"ValuePerUsage",value:.2}},{keyPermission:"PRODUCT_LISTING",value:5e3,icon:ms,label:"ProductsToPush",subtitle:{label:"ValuePerProduct",value:.13}},{keyPermission:"ORDER_FULFILLMENT",value:2e3,icon:sa,valuePrefix:"TrackingMonth",label:"OrdersToFulfill",subtitle:{label:"ValuePerOrder",value:.66}}],extraIncludes:{key:"free",includes:[]}}],db={AICreditsMonthly:"AICredits",ProductsToPush:"Products",OrdersToFulfill:"Orders"},cn=["STARTER_CREDIT_TIER","GROWTH_CREDIT_TIER","PRO_CREDIT_TIER"],Gi={PRODUCT_IMPORT:"UpgradeToContinueImportingMoreProducts",PRODUCT_LISTING:"UpgradeToContinueListingProducts",BULK_ORDER_FULFILLMENT:"BulkOrderPlacementIsDisabled",ORDER_CASHBACK:"CashbackIsUnavailable"},Cl=()=>{const t=he(m0),s=pt(),{t:n}=J(),r=de().getCurrentPlan(),{isHiddenBillingInMobileApp:o}=$o(),l=()=>f0(13),c=u=>{t(d=>{if(d.findIndex(x=>x.id===u.id||x.message===u.message)>-1)return d;const h=[{...u,id:u.id||l()}];return d.concat(h)})};return i.useEffect(()=>{t(u=>u.length>0?u.map(d=>{if(d.id&&Gi[d.id]){const g=Fe(r.package?.features[d.id]?.usage||0),h=Fe(r.package?.features[d.id]?.limit||0),p=o?"Limit quota exceeded":n(Gi[d.id],{count_quota:`${g}/${h}`});return{...d,message:p}}return d}):u)},[r,o]),{quota:async u=>{let d=Fe(r.package?.features[u.message]?.usage||0);const g=Fe(r.package?.features[u.message]?.limit||0);u.message==="PRODUCT_IMPORT"&&d<g&&(d=g);let h=u.primaryButton||{content:n("UpgradeNow"),onAction:()=>{s(Y.BILLING_PLAN.PATH)}};o&&(h={});const p=o?"Limit quota exceeded":n(Gi[u.message],{count_quota:`${d}/${g}`});c({...u,id:u.message,message:p,type:"warning",primaryButton:h})},success:u=>{c({...u,type:"success"})},error:u=>{c({...u,type:"error"})},info:u=>{c({...u,type:"info"})},warning:u=>{c({...u,type:"warning"})},clear:()=>{t([])}}},vl=({open:t,typeCharge:s="plan",onClose:n})=>{const r=de().getCurrentPlan(),{t:o}=J();Pt();const l=()=>s==="plan"?e.jsx(m,{as:"span",variant:"bodyLg",fontWeight:"semibold",children:o("PlanDowngradeScheduled")}):e.jsx(m,{as:"span",variant:"bodyLg",fontWeight:"semibold",children:o("IntegrationCharge")}
2);return e.jsx(Xe,{secondaryActions:[{content:o("OK"),onAction:()=>{n()}}],open:t,onClose:n,title:l(),children:e.jsx(Q,{padding:"400",children:e.jsx(m,{as:"span",variant:"bodyMd",children:r.next_billing_time?o(s==="plan"?"FIRST_CYCLE_DOWNGRADE_FAILED":"FIRST_CYCLE_CANNOT_CHARGE_INTEGRATE",{date:it(r.next_billing_time).format("MMM D,YYYY")}):""})})})},ub=i.forwardRef((t,s)=>{const{onPaymentSuccess:n}=t,r=de().getUserInfo(),o=he(Gn),[l,c]=i.useState(),[u,d]=be(x0),[g,h]=i.useState(!1),p=i.useRef(),{fetchCurrentPlan:x}=de(),f=pt();i.useImperativeHandle(s,()=>({openCheckout:v}));const _=y=>{console.log("Paddle event:",y),y.name==="checkout.completed"&&h(!0),y.name},b=i.useCallback(async()=>{try{if(u==="")return;n&&n(),o(!1),p.current?.Checkout?.close();const y=new URL(u);f(Y.HOME_PAGE.PATH+y.search,{replace:!0}),setTimeout(()=>{x()},5e3)}catch(y){console.log("error",y)}},[u]),v=async y=>{document.getElementById("btn-close-drawer-upgrade-plan")?.click(),d(y.payment_callback),l?.Checkout.open({transactionId:y.transactionId,settings:{displayMode:"overlay"}})};return i.useEffect(()=>{const y=r?.payment_mode==="sandbox";Sm({environment:y?"sandbox":"production",token:y?"test_d1b51d247e0ad82e9244449cd53":"live_beb9fc1edd42279091e7fdba046",eventCallback:_}).then(C=>{C&&(p.current=C,c(C))})},[r?.payment_mode]),i.useEffect(()=>{g&&u!==""&&(b(),h(!1))},[g,u]),e.jsx(e.Fragment,{})}),pb=i.forwardRef((t,s)=>{const{t:n}=J(),[a,r]=i.useState(!1),o=Pt();return i.useImperativeHandle(s,()=>({open:()=>r(!0)})),e.jsx(Xe,{open:a,onClose:()=>r(!1),title:n("PaymentIssue"),primaryAction:{content:n("Close"),onAction:()=>r(!1)},sectioned:!0,children:e.jsx("div",{children:n("ContentPaymentPaddleIssue",{var_contact:e.jsx(re,{variant:"plain",onClick:()=>{o.openChat()},children:n("Contact").toLowerCase()})})})})}),hb={singular:"history",plural:"histories"},gb={};i.memo(t=>{const{t:s}=J(),{isMobile:n}=xe(),{loading:a,histories:r,onChangePage:o}=t,[l,c]=i.useState(1),u=b=>{c(b),o(b)},d=b=>{const v=Da(b).format("ll");return!v||v==="Invalid Date"?e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:"N/A"}):e.jsx(m,{variant:"bodyMd",as:"span",children:v})},g=b=>b?e.jsx(m,{variant:"bodyMd",as:"span",children:b}):e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:"N/A"}),h=b=>{let v=at.upperFirst(at.lowerCase(b)),y;switch(b){case"PENDING":break;case"COMPLETED":y="success";break;case"CANCELLED":y="attention";break;case"FAILED":y="critical";break;default:v="N/A";break}return b?e.jsx(wt,{tone:y,children:s(v)}):e.jsx(wt,{children:"N/A"})},p=(b,v)=>{if(!b)return e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:"N/A"});const y=gb[v?.usage_charge?.feature_id];return b==="USAGE_CHARGE"&&v?.usage_charge&&y?e.jsx(m,{variant:"bodyMd",as:"p",children:y?.content.replace(y.field,v.usage_charge.quantity)}):e.jsx(m,{variant:"bodyMd",as:"p",children:b==="USAGE_CHARGE"?v.message?v.message:"Ready2Sale":s(b.split("_").map(C=>q.upperFirst(C.toLocaleLowerCase())).join(""))})},x=b=>typeof b!="number"&&!b?e.jsx(m,{variant:"bodyMd",as:"span",children:"N/A"}):e.jsxs(m,{variant:"bodyMd",as:"span",children:["$",Fe(b)]}),f=r.data.map(({id:b,updated_at:v,status:y,action:C,amount:S,details:j},A)=>e.jsxs(Nt.Row,{id:b,position:A,children:[e.jsx(Nt.Cell,{children:d(v)}),e.jsx(Nt.Cell,{children:g(b)}),e.jsx(Nt.Cell,{children:e.jsx("div",{className:"py-2",children:h(y)})}),e.jsx(Nt.Cell,{children:p(C,j)}),e.jsx(Nt.Cell,{children:x(j?.to_package?.discount?S-j?.to_package?.discount||0:S)})]},b)),_=at.map([...Array(10).keys()],(b,v)=>e.jsxs(Rt.Row,{id:b+"",position:v,children:[e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})})]},b));return e.jsx(nt,{isMobile:n,mobileProps:{className:"mx-2"},children:e.jsxs(D,{gap:"300",children:[e.jsx(U,{blockAlign:"center",align:"space-between",children:e.jsx(m,{variant:"headingSm",as:"h6",children:s("PastBills")})}),e.jsx(Q,{padding:"0",background:"bg-surface",borderRadius:"200",borderColor:"border",borderWidth:"025",overflowX:"hidden",overflowY:"hidden",children:e.jsxs(_i,{gap:"300",children:[e.jsx("div",{className:"w-full relative",children:e.jsx(Nt,{loading:a,resourceName:hb,itemCount:a?10:r?.total,selectable:!1,headings:[{title:s("UpdateAt")},{title:s("TransactionID")},{title:s("PaymentStatus")},{title:s("Description")},{title:s("Price")}],children:a?_:f})}),r.total>10?e.jsxs(e.Fragment,{children:[e.jsx(U,{align:"center",children:e.jsx(ab,{hasPrevious:l>1,onPrevious:()=>{u(l-1)},label:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"regular",children:`${l} / ${at.ceil(r.total/10)}`}),hasNext:l*10<r.total,onNext:()=>{u(l+1)}})}),e.jsx("div",{})]}):""]})})]})})});const yr=({open:t,data:s,loading:n,onConfirm:a,onClose:r})=>{const{t:o}=J(),{storeCharge:l}=s,c=dt(),u=de(),g=u.getCurrentPlan("AO").remaining_trial_days||0,h=c.getListShop(),p=c.getShop(),[x,f]=i.useState(""),_=pt
2(),b=ke(Gt),{getActionPermissionState:v}=gs(),y=i.useCallback(j=>{requestAnimationFrame(()=>at.head(j)&&f(at.head(j)))},[]);i.useEffect(()=>{if(l?.id&&l.status==="active"){f(l.id+"");return}p?.id&&f(p?.id+"")},[l,p?.id]);const C=()=>{if(window.keyChoosing="",!v([Te.VIEW_ACTION_CHANGE_PLAN])){r();return}x&&a(+x||0)},S=h.filter(j=>j.platform==="shopify"&&j.status==="active").map(j=>({label:e.jsx(m,{fontWeight:"regular",as:"p",variant:"bodyMd",children:j?.store_name??""}),value:j?.id+""||"0"}));return i.useEffect(()=>{t&&h.length===0&&(u.goToMyChannelPage(),r())},[t,h]),e.jsx(Xe,{open:t,onClose:()=>{requestAnimationFrame(()=>{r()})},title:o("ShopifyPayment"),primaryAction:{disabled:!at.size(S)||!x,content:o("Confirm"),loading:n,onAction:()=>{requestAnimationFrame(()=>C())}},secondaryActions:window.keyChoosing?[{disabled:!at.size(S),content:o("Back"),loading:n,onAction:()=>{requestAnimationFrame(()=>{window.keyChoosing="",_(-1),r()})}}]:void 0,children:e.jsx(Xe.Section,{children:e.jsxs(_i,{gap:"400",children:[e.jsx(m,{tone:"subdued",as:"p",variant:"bodyMd",fontWeight:"regular",children:o("SelectStoreAcceptsPaymentWithPlatformPayment")}),g>0&&b==="yearly"&&e.jsx(m,{tone:"subdued",as:"p",variant:"bodyMd",fontWeight:"regular",children:o("YourCurrentTrialWillEndIfYouSwitchToYearlyBilling")}),e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"regular",children:o("ChooseYourStore")}),at.size(S)?e.jsx("div",{className:"msui-scrollbar-y",style:{maxHeight:220},children:e.jsx(Gp,{title:"",choices:S,selected:[x],onChange:y})}):e.jsx(m,{tone:"critical",as:"p",variant:"bodyMd",fontWeight:"regular",children:o("NoStoreListingForCheckout")})]})]})})})},mb=da` 3 0%, 20% { 4 color: rgba(0,0,0,0); 5 text-shadow: 6 .25em 0 0 rgba(0,0,0,0), 7 .5em 0 0 rgba(0,0,0,0);} 8 40% { 9 color: white; 10 text-shadow: 11 .25em 0 0 rgba(0,0,0,0), 12 .5em 0 0 rgba(0,0,0,0);} 13 60% { 14 text-shadow: 15 .25em 0 0 white, 16 .5em 0 0 rgba(0,0,0,0);} 17 80%, 100% { 18 text-shadow: 19 .25em 0 0 white, 20 .5em 0 0 white 21 } 22`,fb=se.div` 23 position: absolute; 24 top: 50%; 25 left: 50%; 26 transform: translate(-50%, -50%); 27 margin: -25px 0 0 -25px; 28 z-index: var(--p-z-index-11); 29`,xb=se.div` 30 position: fixed; 31 z-index: var(--p-z-index-2); 32 top: 0; 33 right: 0; 34 bottom: 0; 35 left: 0; 36 display: block; 37 background-color: var(--p-color-backdrop-bg); 38 animation: var(--p-motion-keyframes-fade-in) var(--p-motion-duration-200) 1 forwards; 39 backface-visibility: hidden; 40`,_b=se.div` 41 color: var(--p-color-bg); 42 font-size: var(--p-font-size-600); 43 &:after { 44 content: ' .'; 45 animation: ${mb} 1s steps(6, end) infinite; 46 } 47`,Al=({open:t,isRedirecting:s})=>{const{t:n}=J();return i.useEffect(()=>{t?document.body.style.position="fixed":document.body.style.position=""},[t]),t?Lp.createPortal(e.jsxs(e.Fragment,{children:[e.jsx(xb,{}),e.jsxs(fb,{children:[e.jsx(ml,{}),e.jsx("div",{style:{width:"auto"},children:e.jsxs(U,{gap:{xs:"100"},align:"center",blockAlign:"center",children:[e.jsx(nn,{}),e.jsx(_b,{children:n(s?"Redirecting":"Processing")})]})})]})]}),document.body):e.jsx("div",{})};var Cc,vc,Ac,Sc,jc,Ec,Tc,Pc,Ic;function Ao(){return Ao=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Ao.apply(null,arguments)}const zp=t=>i.createElement("svg",Ao({xmlns:"http://www.w3.org/2000/svg",width:86,height:88,fill:"none"},t),Cc||(Cc=i.createElement("path",{fill:"#F0F1F2",d:"M78.669 47.808a39.1 39.1 0 0 1-3.565 16.366C68.9 7
477.714 55.227 87.117 39.36 87.117S9.82 77.714 3.615 64.174A39.1 39.1 0 0 1 .051 47.808c0-21.71 17.599-39.309 39.309-39.309s39.308 17.599 39.308 39.309"})),i.createElement("mask",{id:"payment-success-g_svg__a",width:79,height:80,x:0,y:8,maskUnits:"userSpaceOnUse",style:{maskType:"alpha"}},vc||(vc=i.createElement("path",{fill:"#F0F1F2",d:"M78.669 47.808a39.1 39.1 0 0 1-3.565 16.366C68.9 77.714 55.227 87.117 39.36 87.117S9.82 77.714 3.615 64.174A39.1 39.1 0 0 1 .051 47.808c0-21.71 17.599-39.309 39.309-39.309s39.308 17.599 39.308 39.309"}))),Ac||(Ac=i.createElement("g",{fill:"#007B5C",filter:"url(#payment-success-g_svg__b)",mask:"url(#payment-success-g_svg__a)"},i.createElement("rect",{width:70.991,height:45.999,x:3.769,y:26.464,rx:4}),i.createElement("rect",{width:11.59,height:2.898,x:14.089,y:61.63,rx:1.449}),i.createElement("rect",{width:19.015,height:6.701,x:32.018,y:60.25,rx:1}),i.createElement("rect",{width:9.779,height:6.701,x:57.365,y:60.25,rx:1}))),Sc||(Sc=i.createElement("rect",{width:70.991,height:45.999,x:14.188,y:21.441,fill:"#D2D5D9",rx:4})),jc||(jc=i.createElement("rect",{width:32.737,height:2.898,x:18.482,y:41.912,fill:"#fff",rx:1.449})),Ec||(Ec=i.createElement("rect",{width:32.737,height:2.898,x:18.419,y:51.468,fill:"#fff",rx:1.449})),Tc||(Tc=i.createElement("circle",{cx:64.857,cy:20.717,r:15.936,fill:"#fff"})),Pc||(Pc=i.createElement("path",{fill:"#007B5C",fillRule:"evenodd",d:"M48.709 20.451c0 4.34 1.701 8.5 4.73 11.57a16.04 16.04 0 0 0 11.418 4.791c4.283 0 8.39-1.724 11.42-4.792a16.47 16.47 0 0 0 4.729-11.569c0-4.339-1.701-8.5-4.73-11.569A16.04 16.04 0 0 0 64.857 4.09c-4.282 0-8.39 1.724-11.418 4.792a16.47 16.47 0 0 0-4.73 11.57m24.546-2.945a1.65 1.65 0 0 0-.15-2.138 1.6 1.6 0 0 0-2.11-.152l-7.752 7.853-3.715-3.763a1.6 1.6 0 0 0-2.11.152 1.65 1.65 0 0 0-.15 2.139l4.844 4.908c.646.654 1.615.654 2.261 0z",clipRule:"evenodd"})),Ic||(Ic=i.createElement("defs",null,i.createElement("filter",{id:"payment-success-g_svg__b",width:78.991,height:53.999,x:-.231,y:26.464,colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse"},i.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),i.createElement("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),i.createElement("feOffset",{dy:4}),i.createElement("feGaussianBlur",{stdDeviation:2}),i.createElement("feComposite",{in2:"hardAlpha",operator:"out"}),i.createElement("feColorMatrix",{values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),i.createElement("feBlend",{in2:"BackgroundImageFix",result:"effect1_dropShadow_642_17322"}),i.createElement("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_642_17322",result:"shape"}))))),Kp=se.div` 48 padding: ${({size:t=8})=>typeof t=="number"?t+"px":t} 0; 49`,bb=t=>{const{open:s,onClose:n}=t,[a,r]=i.useState({}),{t:o}=J(),l=a?.payment_provider||"SHOPIFY",c={PADDLE_BILLING:"Paddle"},u=a?.is_one_time_charge||!1;if(i.useEffect(()=>{if(s){const g=tp();r(g),window.history.replaceState({},document.title,window.location.pathname)}},[s]),!a.package&&!u)return null;const d=g=>`$ ${Fe(Vt(g||0))} USD`;return e.jsx(Xe,{title:"",size:"small",titleHidden:!0,open:s,onClose:n,children:u?e.jsxs("div",{className:"text-center w-full px-6 mt-10 mb-6",children:[e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:"mx-auto size-[56px] fill-[#29845A] bg-[#DCFCE7] rounded-full p-1",children:e.jsx(Je,{})})}),e.jsx(m,{as:"span",variant:"headingXl",children:o("ThankYou")}),e.jsx("div",{className:"mt-2 mb-6",children:e.jsx(m,{as:"span",tone:"subdued",children:o("ContentThanskYouChargeOneTime",{var_time:e.jsxs(m,{tone:"base",as:"span",fontWeight:"semibold",children:["24 ",o("Hours")]})})})}),e.jsx(re,{size:"large",onClick:()=>{n()},fullWidth:!0,variant:"primary",children:o("Done")})]}):e.jsx(Kp,{size:60,children:e.jsx(U,{align:"center",blockAlign:"center",children:e.jsxs(D,{inlineAlign:"center",gap:"200",children:[e.jsxs(D,{inlineAlign:"center",children:[e.jsx(ee.Custom,{icon:zp}),e.jsxs(D,{inlineAlign:"center",gap:"100",children:[e.jsx(m,{variant:"headingLg",as:"h6",children:o("PaymentSuccessful")}),e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:o("ThankYouYouHaveCompletedYourPayment")})]})]}),e.jsx("div",{style:{width:"100%",paddingTop:15},children:e.jsxs(D,{gap:"200",children:[e.jsxs(U,{align:"space-between",children:[e.jsx(m,{fontWeight:"regular",tone:"subdued",as:"p",variant:"bodyMd",children:o("AmountPaid")}
49),e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",children:a?.discount?.amount?d(Number(a?.package?.price||0)-Number(a?.discount?.amount||0)):d(Number(a?.package?.price||0))}),a?.discount?.amount&&e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",textDecorationLine:"line-through",children:d(Number(a?.package?.price||0))})]})]}),e.jsx($e,{}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{fontWeight:"regular",tone:"subdued",as:"p",variant:"bodyMd",children:o("PaymentMethod")}),e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",children:l==="SHOPIFY"?o("PlatformStore",{platform:"Shopify"}):c[l]})]}),e.jsx($e,{}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{fontWeight:"regular",tone:"subdued",as:"p",variant:"bodyMd",children:o("TransactionDate")}),e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",children:Da().format("ll")||"N/A"})]})]})}),e.jsx("div",{style:{width:260,paddingTop:15},children:e.jsx(re,{size:"large",onClick:n,fullWidth:!0,variant:"primary",children:o("Great")})})]})})})})},yb=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}),Cb=({open:t,data:s,onClose:n,onCharge:a})=>{const{currentPackage:r,customPackage:o}=s,{t:l}=J();let c="$0.00";at.isNumber(o?.price)&&at.isNumber(r?.price)&&(c=yb.format(Math.abs(o?.price-r?.price)));const u=o?.cycle===365?"year":"mo",d=r?.cycle===365?"year":"mo";return e.jsx(Xe,{open:t,onClose:n,title:l("ChangingYourPlan"),primaryAction:{disabled:!o?.id,content:l("Confirm"),onAction:()=>{a()}},children:e.jsx(Xe.Section,{children:e.jsxs(U,{blockAlign:"start",children:[e.jsx("div",{style:{flex:1},children:e.jsxs(_i,{inlineAlign:"baseline",gap:"200",children:[e.jsx(m,{variant:"headingMd",as:"h6",fontWeight:"semibold",children:l("OrderAndFulfillment")}),e.jsxs(U,{children:[e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",fontWeight:"regular",children:r?.name??"N/A"}),e.jsx(ee,{source:Ja,tone:"base"}),e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",fontWeight:"regular",children:o?.name??"N/A"})]})]})}),e.jsx("div",{style:{flex:1},children:e.jsxs(_i,{gap:"200",children:[e.jsxs(U,{align:"space-between",children:[e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"p",children:l("CurrentPrice")}),e.jsxs(m,{tone:"subdued",variant:"bodyMd",as:"p",children:["$ ",r?.price??"N/A"," /",l(q.upperFirst(d)).toLocaleLowerCase()]})]}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"p",children:l("NewPrice")}),e.jsxs(m,{tone:"subdued",variant:"bodyMd",as:"p",children:["$ ",o?.price??"N/A"," /",l(q.upperFirst(u)).toLocaleLowerCase()]})]}),e.jsx($e,{}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"p",children:l("Different")}),e.jsxs(m,{fontWeight:"semibold",variant:"bodyMd",as:"p",children:[c," /",l(q.upperFirst(u)).toLocaleLowerCase()]})]})]})})]})})})},Yt=t=>t.includes("STARTER_CREDIT_TIER")?"STARTER_CREDIT_TIER":t,vb=({checked:t})=>e.jsx("div",{className:oe("w-4 h-4 rounded-full border-[1.5px] flex items-center justify-center flex-shrink-0",t?"border-[#303030]":"border-[#8a8a8a] bg-white"),children:t&&e.jsx("div",{className:"w-[8px] h-[8px] rounded-full bg-[#303030]"})}),Mr=({children:t})=>e.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-bg-surface-secondary border-[0.5px] border-[#e3e3e3] rounded-full shrink-0",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M2 6.5L4.5 9L10 3.5",stroke:"#616161",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"text-xs whitespace-nowrap",children:t})]}),Ab=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M6 4L10 8L6 12",stroke:"#005bd3",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),Sb=()=>e.jsx("svg",{width:"20",height:"16",viewBox:"0 0 20 16",fill:"none",children:e.jsx("path",{d:"M18 8H2M2 8L8 2M2 8L8 14",stroke:"#303030",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Qp=()=>e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("mask",{id:"path-1-inside-1_15437_53935",fill:"white",children:e.jsx("path",{d:"M9.15629 1.36265C9.27762 1.18439 9.23204 0.940313 9.04627 0.830827C7.91197 0.162334 6.58549 -0.116352 5.27145 0.0443969C3.82784 0.220995 2.49751 0.915929 1.52792 1.99994C0.558324 3.08395 0.0154681 4.48324 0.000325238 5.93753C-0.0148177 7.39182 0.498783 8.80211 1.4456 9.90607C2.39241 11.01 3.70797 11.7325 5.14759 11.9391C6.58721 12.1458 8.05287 11.8224 9.27196 11.0293C10.491 10.2362 11.3806 9.02733 11.7751 7.62748C12.1341 6.35327 12.0608 4.99982 11.573 3.77691C11.4931 3.57663 11.2588 3.49439 11.0641 3.58714C10.8694 3.6799 10.7883 3.91249 10.8663 4.11354C11.2738 5.16482
4911.3312 6.3237 11.0234 7.41567C10.6803 8.63333 9.90654 9.6849 8.84612 10.3748C7.78569 11.0647 6.51078 11.3459 5.25853 11.1662C4.00628 10.9864 2.86193 10.358 2.03834 9.3977C1.21476 8.43742 0.768 7.21068 0.781172 5.94566C0.794344 4.68064 1.26655 3.46347 2.10995 2.52054C2.95336 1.57761 4.11054 0.973122 5.36627 0.819508C6.49238 0.68175 7.62899 0.915005 8.60589 1.47799C8.79272 1.58567 9.03496 1.54092 9.15629 1.36265Z"})}),e.jsx("path",{d:"M9.15629 1.36265C9.27762 1.18439 9.23204 0.940313 9.04627 0.830827C7.91197 0.162334 6.58549 -0.116352 5.27145 0.0443969C3.82784 0.220995 2.49751 0.915929 1.52792 1.99994C0.558324 3.08395 0.0154681 4.48324 0.000325238 5.93753C-0.0148177 7.39182 0.498783 8.80211 1.4456 9.90607C2.39241 11.01 3.70797 11.7325 5.14759 11.9391C6.58721 12.1458 8.05287 11.8224 9.27196 11.0293C10.491 10.2362 11.3806 9.02733 11.7751 7.62748C12.1341 6.35327 12.0608 4.99982 11.573 3.77691C11.4931 3.57663 11.2588 3.49439 11.0641 3.58714C10.8694 3.6799 10.7883 3.91249 10.8663 4.11354C11.2738 5.16482 11.3312 6.3237 11.0234 7.41567C10.6803 8.63333 9.90654 9.6849 8.84612 10.3748C7.78569 11.0647 6.51078 11.3459 5.25853 11.1662C4.00628 10.9864 2.86193 10.358 2.03834 9.3977C1.21476 8.43742 0.768 7.21068 0.781172 5.94566C0.794344 4.68064 1.26655 3.46347 2.10995 2.52054C2.95336 1.57761 4.11054 0.973122 5.36627 0.819508C6.49238 0.68175 7.62899 0.915005 8.60589 1.47799C8.79272 1.58567 9.03496 1.54092 9.15629 1.36265Z",stroke:"url(#paint0_linear_15437_53935)",strokeWidth:"2",mask:"url(#path-1-inside-1_15437_53935)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.88522 3H7.30178L8.40156 4.94369L7.30178 6.88737H6.88522L7.985 4.94369L6.88522 3ZM5.1179 9H4.70134L3.60156 7.05631L4.70134 5.11263H5.1179L4.01812 7.05631L5.1179 9ZM6.71093 9H6.29437L5.19459 7.05631L6.39023 4.94369L5.29045 3H5.70701L6.80679 4.94369L5.61115 7.05631L6.71093 9Z",fill:"url(#paint1_linear_15437_53935)"}),e.jsx("g",{clipPath:"url(#clip0_15437_53935)",children:e.jsx("path",{d:"M12.0004 2.254C10.9494 2.31867 10.1081 3.17717 10.045 4.25H10.0373C9.97393 3.17717 9.1328 2.31867 8.08203 2.254V2.24617C9.13296 2.18133 9.97393 1.32283 10.0373 0.25H10.045C10.1083 1.32283 10.9494 2.18133 12.0004 2.24617V2.254Z",fill:"url(#paint2_linear_15437_53935)"})}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_15437_53935",x1:"6",y1:"0",x2:"6",y2:"12",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#1B2B6B"}),e.jsx("stop",{offset:"0.335",stopColor:"#5F70E3"}),e.jsx("stop",{offset:"1",stopColor:"#4776EC"})]}),e.jsxs("linearGradient",{id:"paint1_linear_15437_53935",x1:"6.00156",y1:"3",x2:"6.00156",y2:"9",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#1B2B6B"}),e.jsx("stop",{offset:"0.335",stopColor:"#5F70E3"}),e.jsx("stop",{offset:"1",stopColor:"#4776EC"})]}),e.jsxs("linearGradient",{id:"paint2_linear_15437_53935",x1:"10.0412",y1:"0.25",x2:"10.0412",y2:"4.25",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#1B2B6B"}),e.jsx("stop",{offset:"0.335",stopColor:"#5F70E3"}),e.jsx("stop",{offset:"1",stopColor:"#4776EC"})]}),e.jsx("clipPath",{id:"clip0_15437_53935",children:e.jsx("rect",{width:"3.91833",height:"4",fill:"white",transform:"translate(8.08203 0.25)"})})]})]}),Rc=({isSelected:t,isCurrent:s,isScheduled:n,name:a,displayPrice:r,priceSuffix:o,pills:l,onClick:c,alignStart:u=!1,disabled:d=!1,discountPrice:g,inlineError:h})=>{const{t:p}=J();return e.jsxs("div",{onClick:d?void 0:c,className:oe("flex flex-col gap-3 p-3 rounded-xl transition-all border",d?"opacity-50 cursor-not-allowed":"cursor-pointer",t?"border-[#8a8a8a] bg-white":"border-transparent bg-bg-surface-secondary"),children:[e.jsxs("div",{className:oe("flex justify-between min-h-[32px]",u?"items-start":"items-center"),children:[e.jsxs("div",{className:oe("flex gap-3",u?"items-start":"items-center"),children:[e.jsx("div",{className:oe(u&&"mt-1"),children:e.jsx(vb,{checked:t})}),e.jsxs("div",{className:oe("flex items-center gap-2 flex-wrap",u&&"mt-0.5"),children:[e.jsx("span",{className:"text-heading-lg font-semibold leading-[24px] tracking-[-0.2px] text-[#303030]",children:r===0?"Free":a}),s&&e.jsx("span",{className:"px-2 py-0.5 bg-[#e0f0ff] text-[#00527c] text-[12px] font-[550] rounded-lg leading-[20px]",children:"Current"}),n&&e.jsx("span",{className:"px-2 py-0.5 bg-[#ffe9d0] text-[#8a5300] text-[12px] font-[550] rounded-lg leading-[20px]",children:p("Scheduled")})]})]}),e.jsxs("div",{className:oe("flex items-center shrink-0 ",u?"gap-0.5 ml-2":"gap-1"),children:[e.jsxs("span",{className:"text-[20px] font-semibold ",children:["$",va(g)?r:g]}),!va(g)&&e.jsxs("span",{className:"text-[12px] font-[550] text-[#616161] line-through",children:["$",r]}),e.jsx("span",{className:oe("text-[12px] font-[550]",u?"text-[#616161]":"text-[#202223]"),children:o})]})]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:l}),h&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M10 7v4M10 13h.01M3.5 17h13a1.5 1.5 0 0 0 1.3-2.25l-6.5-11.25a1.5 1.5 0 0 0-2.6 0L2.2 14.75A1.5 1.5 0 0 0 3.5 17z",stroke:"#8e1f0b",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"text-[13px] text-[#8e1f0b] leading-[20px]",children:h})]})]})},fa={WP_ADD_STORE:"PRO_CREDIT_TIER",WP_ADD_NEW:"PRO_CREDIT_TIER",BULK_LISTING_URL:"GROWTH_CREDIT_TIER",BULK_LISTING_FILE:"GROWTH_CREDIT_TIER",PRODUCT_EDIT_CONTENT:"STARTER_CREDIT_TIER",PRODUCT_SPLIT_ADVANCED:"GROWTH_CREDIT_TIER",PRODUCT_SPLIT_BASIC:"STARTER_CREDIT_TIER",AI_PRODUCT_CONTENT:"GROWTH_CREDIT_TIER",AI_PRODUCT_SEO:"STARTER_CREDIT_TIER",AI_FIND_IMAGE_VIDEO:"GROWTH_CREDIT_TIER",AI_IMAGE_THUMB_FORMAT:"GROWTH_CREDIT_TIER",MULTI_PRICING_RULE:"GROWTH_CREDIT_TIER",BULK_UPDATE_STOCK_PRICE:"STARTER_CREDIT_TIER",AUTO_LISTING_ADVANCED:"STARTER_CREDIT_TIER",SETTING_UPDATE_VARIANT_AVAILABLE:"GROWTH_CREDIT_TIER",SETTING_UPDATE_PRODUCT_AVAILABLE:"GROWTH_CREDIT_TIER",SETTING_UPDATE_STOCK:"GROWTH_CREDIT_TIER",SETTING_UPDATE_PRICE:"PRO_CREDIT_TIER",AI_AUTO_BOOST_PRODUCT_SEO:"STARTER_CREDIT_TIER",BULK_ORDER_FULFILLMENT:"STARTER_CREDIT_TIER",AI_ORDER_CORRECT:"STARTER_CREDIT_TIER",ORDER_TRACKING:"STARTER_CREDIT_TIER",ORDER_RECREATE:"GROWTH_CREDIT_TIER",ORDER_CASHBACK:"PRO_CREDIT_TIER",SETTING_UPDATE_PRICE_RANGE:"PRO_CREDIT_TIER",BULK_ORDER_FULFILLMENT_FILE:"BULK_ORDER_FULFILLMENT_FILE",PRODUCT_CATALOG_INSPIRED:"STARTER_CREDIT_TIER",AI_AUTO_BOOST_PRODUCT_THUMB:"STARTER_CREDIT_TIER",AI_IMAGE_THUMB_BASIC:"STARTER_CREDIT_TIER",AI_IMAGE_GENERATION:"STARTER_CREDIT_TIER",AI_PRODUCT_WRITING:"STARTER_CREDIT_TIER",AI_POD_IMAGE:"STARTER_CREDIT_TIER",BULK_PRODUCT_UPDATE_PRICE:"STARTER_CREDIT_TIER",PRODUCT_EDIT_IMAGE:"STARTER_CREDIT_TIER",AI_CHAT_ASSISTANT:"STARTER_CREDIT_TIER",PRODUCT_EDIT_SEO:"STARTER_CREDIT_TIER"},kc=["AI_PRODUCT_CONTENT","AI_FIND_IMAGE_BETTER","AI_FIND_IMAGE_RELATE","AI_FIND_IMAGE_VIDEO","AI_IMAGE_THUMB_BASIC","AI_IMAGE_GENERATION","AI_PRODUCT_WRITING","AI_PRODUCT_SEO","AI_POD_IMAGE"],wc=["PRODUCT_LISTING","WP_STORE_PRODUCT_COPY","AUTO_IMAGE_FORMATTING","AUTO_EDIT_PRODUCT","ORDER_FULFILLMENT"],jb={ORDER_CASHBACK:"order cashback",AI_IMAGE_GENERATION:"AI image generation",AI_PRODUCT_WRITING:"AI product writing",AI_PRODUCT_SEO:"AI product SEO",AI_POD_IMAGE:"AI pod image",BULK_EDIT_PRODUCT:"Bulk edit product",BULK_IMAGE_FORMATTING:"bulk image formatting",BULK_ORDER_FULFILLMENT:"bulk fulfillment",BULK_LISTING:"bulk listing",BULK_SET_PRICING:"bulk set pricing",CAT_NORNMAL:"Cat normal",CAT_SPECIAL1:"Cat special 1",CAT_SPECIAL2:"C
49at special 2",VIEW_INSIGHTS:"view insights",PRODUCT_IMPORT:"product import",PRODUCT_LISTING:"product listing",PRODUCT_FIND_SUPPLIER:"product find supplier",PRODUCT_MANAGED:"product managed",SETTING_AUTO_PRICING:"setting auto pricing",SETTING_UPDATE_STOCK:"setting update stock",SETTING_UPDATE_PRICE:"setting update price",WP_STORE_PRODUCT_COPY:"WP store product copy",WP_SETTING_MIGRATION:"wp setting migration",ORDER_FULFILLMENT:"order fulfillment",ORDER_TRACKING:"order tracking",AUTO_ORDER_FULFILLMENT:"auto order fulfillment",AUTO_EDIT_PRODUCT:"auto edit product",AUTO_IMAGE_FORMATTING:"auto image formatting",AUTO_TASK_SCHEDULE:"auto task schedule",LISTING_PRODUCTS:"listing products",EXTRA_BONUS_TOPUP:"extra bonus topup",ADD_PRICING_RULE:"pricing rule",BULK_APPLY_PRICING_RULE:"bulk apply pricing rule",AI_ORDER_CORRECT:"AI order correct",BULK_LISTING_FILE:"bulk listing file",PRODUCT_EDIT_CONTENT:"edit content",PRODUCT_EDIT_SEO:"edit SEO",PRODUCT_EDIT_IMAGE:"edit image",PRODUCT_SPLIT_BASIC:"split basic",PRODUCT_SPLIT_ADVANCED:"split product",AI_PRODUCT_CONTENT:"AI product content",AI_FIND_IMAGE_BETTER:"AI find image better",AI_FIND_IMAGE_RELATE:"AI find image relate",AI_FIND_IMAGE_VIDEO:"AI find image video",AI_IMAGE_THUMB_BASIC:"AI image thumb basic",AI_IMAGE_THUMB_FORMAT:"AI image thumb format",MULTI_PRICING_RULE:"multi pricing rule",SETTING_UPDATE_PRODUCT_AVAILABLE:"update product available",SETTING_UPDATE_VARIANT_AVAILABLE:"update variant available",SETTING_UPDATE_PRICE_RANGE:"update price range",AI_AUTO_BOOST_PRODUCT_CONTENT:"auto boost product content",AI_AUTO_BOOST_PRODUCT_THUMB:"AI auto boost product thumb",AI_AUTO_BOOST_PRODUCT_SEO:"AI auto boost product SEO",AUTO_LISTING_BASIC:"auto listing basic",AUTO_LISTING_ADVANCED:"auto listing advanced",AUTO_LISTING_COMPLEMENT:"auto listing complement",AUTO_LISTING_NEW_ARRIVAL:"auto listing new arrival",AUTO_LISTING_RELATE:"auto listing relate",BULK_UPDATE_STOCK_PRICE:"bulk price update to store",BULK_PRODUCT_UPDATE_PRICE:"bulk product update price",PRODUCT_CATALOG_INSPIRED:"product catalog inspired",BULK_ORDER_FULFILLMENT_FILE:"bulk order fulfillment file",ORDER_RECREATE:"re-order",PH_ADS:"ads spy",PH_BASIC_PRODUCT_INSIGHT:"basic product insight",PH_IDEA_DISCOVERY:"idea discovery",WP_ADD_STORE:"mutil-Store Management",WP_ADD_NEW:"add new store",BULK_LISTING_URL:"import by supplier URL/ CSV file",AI_CHAT_ASSISTANT:"AI chat assistant"},Ur=["FREE_CREDIT","STARTER_CREDIT_TIER","GROWTH_CREDIT_TIER","PRO_CREDIT_TIER","ENTERPRISE_CREDIT_TIER"],Eb={FREE_CREDIT:["EssentialDropshippingToolkit","BasicProductEditor","BasicOrderFulfillment"],STARTER_CREDIT_TIER:["FullProductEditorWithAI","OrderAndShipmentTracking","AIAssistant"],GROWTH_CREDIT_TIER:["FullProductEditorWithAI","OrderAndShipmentTracking","AIAssistant"],PRO_CREDIT_TIER:["FullProductEditorWithAI","OrderAndShipmentTracking","AIAssistant"]},Tb=["EssentialDropshippingToolkit","BasicProductEditor","BasicOrderFulfillment"],Wi=t=>t.includes("FullProductEditorWithAI")?[...new Set([...Tb,...t])]:t,ri={GROWTH_CREDIT_TIER:["AdvancedPricingRules","AutoupdateStockSellingPrice"],PRO_CREDIT_TIER:["AllFromSCALEPlus","FullSettingsUnlock","MultistoreConnection","247PrioritySupport"]},Pb=ri.GROWTH_CREDIT_TIER,Vi=t=>{const s=[],n=new Set;for(const a of t)for(const r of a==="AllFromSCALEPlus"?Pb:[a])n.has(r)||(n.add(r),s.push(r));return s},Ib={FREE_CREDIT:[],STARTER_CREDIT_TIER:[],GROWTH_CREDIT_TIER:Vi(ri.GROWTH_CREDIT_TIER),PRO_CREDIT_TIER:Vi(ri.PRO_CREDIT_TIER),ENTERPRISE_CREDIT_TIER:Vi(ri.PRO_CREDIT_TIER)},Fr=t=>Ib[Yt(t)]??[],Rb=()=>e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M5.5 10.5l3 3 6-6",stroke:"#303030",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),kb=()=>e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M8 8l4 4M12 8l-4 4",stroke:"#b5b5b5",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),wb=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M4 6l4 4 4-4",stroke:"#303030",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})}),Nc=()=>e.jsxs("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M9.49689 4.88867C9.55398 4.90943 9.56894 4.9311 9.57697 4.94629C9.59755 4.98528 9.60738 5.02853 9.6004 5.08887L9.00568 9.90039L8.94708 10.376H12.4598C12.5118 10.376 12.53 10.3871 12.534 10.3896C12.5378 10.3921 12.5557 10.4046 12.5779 10.4531H12.5789C12.6011 10.5015 12.5995 10.5255 12.5984 10.5332C12.5973 10.5412 12.5924 10.5651 12.5584 10.6064L7.25861 16.9541C7.22342 16.9958 7.19264 17.0118 7.16095 17.0195C7.12637 17.0274 7.09386 17.0257 7.04962 17.0059H7.04767C7.00047 16.9849 6.97476 16.9595 6.95587 16.9277C6.9488 16.9156 6.94276 16.9013 6.93927 16.8828L6.93829 16.8125L7.54962 12.5518L7.61896 12.0684H4.60431C4.55343 12.0683 4.53279 12.0576 4.52618 12.0537C4.52043 12.0502 4.50276 12.0388 4.48126 11.9971C4.45955 11.9549 4.46036 11.9347 4.46075 11.9297C4.46125 11.9239 4.46426 11.9028 4.49298 11.8633L4.49884 11.8545L9.26056 4.95605C9.29831 4.90401 9.33137 4.88587 9.36017 4.87695C9.38851 4.86821 9.42902 4.86409 9.49689 4.88867Z",stroke:"#4A4A4A",strokeWidth:"0.84618"}),e.jsx("path",{d:"M11.7388 8.56028C13.7157 8.56028 14.5773 7.72859
4914.5773 5.72174C14.5773 7.72859 15.433 8.56028 17.4158 8.56028C15.433 8.56028 14.5773 9.41594 14.5773 11.3988C14.5773 9.41594 13.7157 8.56028 11.7388 8.56028Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.473089",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 13.222C2.88398 13.222 3.26927 12.8501 3.26927 11.9527C3.26927 12.8501 3.65189 13.222 4.53854 13.222C3.65189 13.222 3.26927 13.6046 3.26927 14.4913C3.26927 13.6046 2.88398 13.222 2 13.222Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.346165",strokeLinejoin:"round"})]}),Nb=({used:t,limit:s})=>{const n=s===-1||s===0?0:Math.min(t/s*100,100);return e.jsx("div",{className:"flex-1 h-[8px] bg-[#e3e3e3] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-[#303030] rounded-full transition-all",style:{width:`${n}%`}})})},xa=({icon:t,label:s,used:n,limit:a})=>{const r=a===-1?"Unlimited":Fe(a),o=Fe(n),{isMobile:l}=xe();return e.jsxs("div",{className:Un("flex items-center ",{"gap-2":l,"gap-8":!l}),children:[e.jsxs("div",{className:"flex items-center gap-1.5 w-[115px] shrink-0",children:[e.jsx(Q,{children:t}),e.jsx("span",{className:"text-[13px] font-[450] text-[#303030] leading-[20px] whitespace-nowrap",children:s})]}),e.jsx(Nb,{used:n,limit:a}),e.jsxs("div",{className:"text-[13px] font-[450] text-[#616161] leading-[20px] text-right w-[70px] shrink-0 whitespace-nowrap",children:[o,"/ ",e.jsx("span",{className:"font-[550] text-[#303030]",children:r})]})]})},_a=({label:t,supported:s})=>e.jsxs("div",{className:"flex items-center gap-1",children:[s?e.jsx(Rb,{}):e.jsx(kb,{}),e.jsx("span",{className:oe("text-[12px] font-[450] leading-[16px]",s?"text-[#303030]":"text-[#b5b5b5]"),dangerouslySetInnerHTML:{__html:t}})]}),Ob=i.memo(()=>{const{getPricingPlan:t,getCurrentPlan:s}=de(),{t:n}=J(),a=bt(),{hasPermission:r}=gs(),[o,l]=be(In),{isMobile:c}=xe(),u=zs(),[d,g]=i.useState(!1),[h,p]=i.useState(!1),[x,f]=i.useState(!1),[_,b]=i.useState(void 0),[v,y]=i.useState(!1),[C,S]=i.useState(!1),j=i.useRef(null),A=o.app||"AO",E=A==="PH",T=o.keyFeature,k=i.useRef(null),O=s(A),R=t(),P=E?R.PH||[]:R.CREDIT||[],w=O?.package?.modules?.[0]?.key||(E?"FREE_CREDIT_TIER_PH":"FREE_CREDIT"),N=Yt(w),K=E?(O?.main_credit||0)-(O?.main_credit_used||0)<=0:(O?.total_credit||0)-(O?.total_credit_used||0)-o.total_used<=0,L=!!(T&&kc.includes(T)),W=!!(T&&wc.includes(T)),H=i.useMemo(()=>{if(!W)return!1;const Le=O?.package?.features?.[T],Ye=Le?.limit??-1,qe=Le?.usage??0;return Ye!==-1&&qe>=Ye},[T,O,W]),Z=(Le,Ye)=>E?Le==="FREE_CREDIT_TIER_PH"?"LIGHT_CREDIT_TIER_PH":Le==="LIGHT_CREDIT_TIER_PH"?"UNLIMITED_CREDIT_TIER_PH":"LIGHT_CREDIT_TIER_PH":Ye&&Object.keys(fa).includes(Ye)&&fa[Ye]!==N?fa[Ye]||"GROWTH_CREDIT_TIER":["STARTER_CREDIT_TIER","STARTER_CREDIT_TIER_1","STARTER_CREDIT_TIER_2","STARTER_CREDIT_TIER_3"].includes(Le)?"GROWTH_CREDIT_TIER":Le==="GROWTH_CREDIT_TIER"?"PRO_CREDIT_TIER":Le==="PRO_CREDIT_TIER"||Le==="ENTERPRISE_CREDIT_TIER"?"ENTERPRISE_CREDIT_TIER":"STARTER_CREDIT_TIER",te=()=>{g(!1),l({keyFeature:"",isFullPlan:!1,total_used:0,feature_used:""}),b(void 0),f(!1),y(!1),S(!1),p(!1)},ne=async(Le,Ye)=>{if(!r([Te.VIEW_ACTION_CHANGE_PLAN])){a.error("You dont have permission to change plan");return}if(!Le)return;const qe=P.find(At=>At.key===Le.key);qe&&(p(!0),await k.current?.onConfirmCharge({data:qe,isYearly:Ye,confirmDowngraded:!0}),setTimeout(()=>p(!1),1e3))};i.useEffect(()=>{if(!d||!P.length||!O.account_id)return;const Le=O?.package?.modules?.[0]?.key,Ye=Le?.includes("STARTER_CREDIT_TIER")?"STARTER_CREDIT_TIER":Le,At=P.find(Tt=>Tt.key===Ye)?.key||"";let yt=Z(At,T);kc.includes(T)&&K&&(yt=Z(At)),T&&wc.includes(T)&&H&&(yt=Z(At));const Bt=P.find(Tt=>Tt.key===yt);Bt&&b(Bt.key)},[O,P,T,H,d]),i.useEffect(()=>{T&&g(!0)},[T]),i.useEffect(()=>{T&&Ke.trackingEventUsersAction({event_name:$.SUBSCRIPTION_UPGRADE_PLAN_VIEWED,event_data:{feature_name:T,page:o.locationShowUpgrade||""}})},[T,o.locationShowUpgrade]),i.useEffect(()=>{te()},[u.pathname]),i.useEffect(()=>{if(!v)return;const Le=Ye=>{j.current&&!j.current.contains(Ye.target)&&y(!1)};return document.addEventListener("mousedown",Le),()=>document.removeEventListener("mousedown",Le)},[v]);const le=i.useMemo(()=>[...P].filter(Le=>E?Le.key:Le.key!=="ENTERPRISE_CREDIT_TIER").sort((Le,Ye)=>(Le.price||0)-(Ye.price||0)),[P,E]),B=i.useMemo(()=>le.find(Le=>Le.key===_)??null,[le,_]),ie=O?.package?.modules?.[0]?.key,V=ie?.includes("STARTER_CREDIT_TIER")?"STARTER_CREDIT_TIER":ie,M=i.useMemo(()=>P.find(Le=>Le.key===V)??null,[P,V]),I=!!(_&&Yt(_)===Yt(N)),F=O?.package?.cycle===365,G=jb[T]||T,z=!!(T&&(L&&K||W&&H||fa[T])),me=O?.total_credit_used||0,Re=O?.total_credit||0,Be=O?.package?.features?.PRODUCT_LISTING?.usage??0,De=O?.package?.features?.PRODUCT_LISTING?.limit??0,ot=O?.package?.features?.ORDER_FULFILLMENT?.usage??0,ve=O?.package?.features?.ORDER_FULFILLMENT?.limit??0,pe=E?sp:Eb,ze=Le=>{const Ye=Yt(Le);return pe[Ye]||[]},{advancedCompareKeys:Ge,hasAdvancedDiff:lt}=i.useMemo(()=>
49{if(!B)return{advancedCompareKeys:[],hasAdvancedDiff:!1};const Le=Fr(N),Ye=Fr(B.key),qe=[...new Set([...Le,...Ye])],At=Le.length!==Ye.length||Le.some((yt,Bt)=>yt!==Ye[Bt]);return{advancedCompareKeys:qe,hasAdvancedDiff:qe.length>0&&At}},[N,B]),{coreCompareKeysPH:ue,hasCoreToolsDiffPH:ce}=i.useMemo(()=>{if(!E||!B)return{coreCompareKeysPH:[],hasCoreToolsDiffPH:!1};const Le=ze(N),Ye=ze(B.key),qe=[...new Set([...Le,...Ye])],At=qe.some(yt=>Le.includes(yt)!==Ye.includes(yt));return{coreCompareKeysPH:qe,hasCoreToolsDiffPH:qe.length>0&&At}},[E,N,B]),{coreCompareKeysAO:Ae,hasCoreToolsDiffAO:_e}=i.useMemo(()=>{if(E||!B)return{coreCompareKeysAO:[],hasCoreToolsDiffAO:!1};const Le=Wi(ze(N)),Ye=Wi(ze(B.key)),qe=[...new Set([...Le,...Ye])],At=N==="FREE_CREDIT"?Ye.filter(Tt=>Tt!=="FullProductEditorWithAI"):Ye,yt=N==="FREE_CREDIT"?qe.filter(Tt=>Tt!=="FullProductEditorWithAI"):qe,Bt=yt.some(Tt=>Le.includes(Tt)!==At.includes(Tt));return{coreCompareKeysAO:yt,hasCoreToolsDiffAO:yt.length>0&&Bt}},[E,N,B]),Pe=E?ue:Ae,Ne=E?ce:_e,rt=i.useMemo(()=>{let Le=null;if(T)if(L&&K||W&&H){const Ye=Ur.indexOf(Yt(N));Le=Ur[Ye+1]??null}else fa[T]&&(Le=fa[T]);return le.filter(Ye=>{if(Yt(Ye.key)===Yt(N))return!1;if(Le){const qe=Ur.indexOf(Yt(Ye.key)),At=Ur.indexOf(Le);return qe>=At}return!0})},[le,N,T,L,K,W,H]),ye=`You need upgrade to keep using <span class='font-semibold'>${G}</span>`,Ie=()=>{if(!B)return null;const Le=qt(B.price||0,tt).eachYearlyPrice,Ye=B.price||0,qe=Ye===0,At=I&&F,yt=I&&!F,Bt=F&&!qe&&!yt,Tt=O?.next_billing_time?new Date(O.next_billing_time).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"",et=we=>e.jsx("div",{className:oe("flex-1 h-11 rounded-lg flex items-center justify-center cursor-no-drop",we?"bg-[#303030] opacity-60":"bg-white border border-[#e3e3e3]"),children:e.jsx("span",{className:oe("text-[13px]",we?"text-white":"text-[#616161]"),children:n("YouAreHere")})});if(qe)return I?e.jsx("div",{className:"flex gap-3",children:et(!1)}):e.jsx("div",{className:"flex gap-3",children:e.jsx("button",{onClick:()=>ne(B,!1),disabled:h,className:"flex-1 h-11 rounded-lg bg-[#303030] flex items-center justify-center px-3 hover:bg-[#1a1a1a] transition-colors disabled:opacity-60",children:e.jsx("span",{className:"text-[13px] font-[650] text-white leading-[20px]",children:n("ChoosePlan")})})});const rs=At?et(!0):e.jsxs("button",{onClick:()=>ne(B,!0),disabled:h,className:"relative flex-1 h-11 rounded-lg bg-[#303030] flex flex-col items-center justify-center gap-0.5 px-3 hover:bg-[#1a1a1a] transition-colors disabled:opacity-60 overflow-hidden",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 rounded-lg pointer-events-none",style:{background:"linear-gradient(to bottom, rgba(255,255,255,0.07) 82%, rgba(255,255,255,0.15) 94%)",boxShadow:"inset 0px 2px 0px 0px rgba(255,255,255,0.2), inset 2px 0px 0px 0px rgba(255,255,255,0.2), inset -2px 0px 0px 0px rgba(255,255,255,0.2), inset 0px -1px 0px 1px black, inset 0px 1px 0px 0px black"}}),e.jsx("span",{className:"text-[11px] leading-[12px] text-white/70",children:n("PayYearly")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-[10px] text-[#b5b5b5] line-through",children:["$",Ye]}),e.jsxs("span",{className:"text-[13px] font-[650] text-white leading-[20px]",children:[Le,"/",n("Month").toLowerCase()]}),c?e.jsx("div",{className:"absolute right-[5px] top-[5px] rounded-lg bg-bg-fill-info-secondary px-1 h-[14px] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-text-info font-medium",children:n("3monthOff")})}):e.jsx("span",{className:"text-[10px] text-[#b5b5b5]",children:n("3monthOff")})]})]}),Ns=e.jsx(Et,{content:`You're mid-cycle on a yearly plan. Monthly billing is available when your current cycle ends on ${Tt}.`,children:e.jsxs("div",{className:"relative flex-1",children:[e.jsxs("button",{type:"button",disabled:!0,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),className:"w-full h-11 rounded-lg bg-[rgba(0,0,0,0.05)] flex items-center justify-center gap-3 px-3 cursor-not-allowed",children:[e.jsx("span",{className:"px-2 py-0.5 bg-[rgba(0,0,0,0.06)] text-[#616161] text-[12px] font-[550] rounded-lg leading-[16
49px]",children:n("Locked")}),e.jsx("span",{className:"text-[11px] leading-[12px] text-[#b5b5b5]",children:n("PayMonthly")})]}),x&&e.jsx("div",{className:"absolute bottom-[calc(100%+8px)] right-0 z-50 w-[280px] bg-white rounded-lg px-2 py-1 text-[13px] text-[#303030] leading-[20px]",style:{boxShadow:"inset 1px 0 0 0 rgba(0,0,0,0.13), inset -1px 0 0 0 rgba(0,0,0,0.13), inset 0 -1px 0 0 rgba(0,0,0,0.17), inset 0 1px 0 0 rgba(204,204,204,0.5), 0 4px 6px -2px rgba(26,26,26,0.2)"},children:`You're mid-cycle on a yearly plan. Monthly billing is available when your current cycle ends${Tt?` on ${Tt}`:""}.`})]})}),Os=yt?et(!1):Bt?Ns:e.jsxs("button",{onClick:()=>ne(B,!1),disabled:h,className:"flex-1 h-11 rounded-lg bg-white flex flex-col items-center justify-center gap-0.5 px-3 hover:bg-[#f7f7f7] transition-colors disabled:opacity-60 relative",style:{boxShadow:"inset 0px -1px 0px 0px #b5b5b5, inset -1px 0px 0px 0px #e3e3e3, inset 1px 0px 0px 0px #e3e3e3, inset 0px 1px 0px 0px #e3e3e3"},children:[e.jsx("span",{className:"text-[11px] leading-[12px] text-[#616161]",children:n("PayMonthly")}),e.jsxs("span",{className:"text-[13px] font-[650] text-[#303030] leading-[20px]",children:["$",Ye,"/",n("Month").toLowerCase()]})]});return c?e.jsxs(ft,{columns:"auto 1fr",gap:"300",children:[Os,rs]}):e.jsxs("div",{className:"flex gap-3",children:[Os,rs]})},Ue=()=>{if(!M&&!O?.account_id)return null;const Le=Yt(N),Ye=M?.price===0?"Free":M?.name||"Free",qe=M?.price??0,At=ze(Le),yt=Fr(Le),Bt=Ge.filter(et=>yt.includes(et)),Tt=Ge.filter(et=>!yt.includes(et));return e.jsxs("div",{className:oe("flex flex-col gap-3 bg-[#f7f7f7] border-[0.5px] border-[#ebebeb] rounded-xl p-4 h-full min-h-[700px]",!c&&"min-h-0 overflow-y-auto"),children:[e.jsxs("div",{className:"flex items-center gap-4 pl-1",children:[e.jsxs("div",{className:"flex flex-1 min-w-0 items-center gap-3",children:[e.jsx("span",{className:"text-[20px] font-[650] leading-[24px] tracking-[-0.2px] text-[#303030]",children:Ye}),!c&&e.jsx("span",{className:"px-2 py-0.5 bg-[rgba(0,0,0,0.06)] text-[#616161] text-[12px] font-[550] rounded-lg leading-[16px] shrink-0",children:"Current plan"})]}),e.jsxs("div",{className:"flex items-baseline gap-1 shrink-0",children:[e.jsxs("span",{className:"text-[36px] font-bold leading-[48px] tracking-[-0.54px] text-[#303030]",children:["$",qe]}),e.jsx("span",{className:"text-[12px] font-[550] text-[#202223]",children:n("PerMonth")})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 py-1",children:[e.jsx(xa,{icon:e.jsx(Nc,{}),label:n("AICredits")||"AI credits",used:me,limit:Re}),A==="AO"&&e.jsxs(e.Fragment,{children:[e.jsx(xa,{icon:e.jsx(ee,{source:ms}),label:n("Products")||"Products",used:Be,limit:De}),e.jsx(xa,{icon:e.jsx(ee,{source:is}),label:n("Orders")||"Orders",used:ot,limit:ve})]})]}),e.jsx("div",{className:"h-px bg-[#e3e3e3]"}),At.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[11px] font-[650] leading-[12px] text-[#303030]",children:"Core tools"})}),e.jsx("div",{className:"flex flex-col gap-3",children:Ne?Pe.map(et=>e.jsx(_a,{label:n(et)||et,supported:(E?At:Wi(At)).includes(et)},et)):At.map(et=>e.jsx(_a,{label:n(et)||et,supported:!0},et))})]}),lt&&A==="AO"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[11px] font-[650] leading-[12px] text-[#303030]",children:"Advanced tools"})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[Bt.map(et=>e.jsx(_a,{label:n(et)||et,supported:!0},et)),Tt.map(et=>e.jsx(_a,{label:n(et)||et,supported:!1},et))]})]})]})},ht=()=>e.jsx(e.Fragment,{children:rt.map(Le=>e.jsxs("button",{onClick:()=>{b(Le.key),y(!1)},className:oe(" flex items-center justify-between w-full text-left px-3 py-2 text-[13px] hover:bg-[#f7f7f7] transition-colors",Le.key===_?"font-[650] text-[#303030] bg-[#f7f7f7]":"font-[450] text-[#616161]",c?"rounded-lg":""),children:[Le.price===0?"Free":Le.name,e.jsxs("span",{className:"ml-2 text-[12px] text-[#8a8a8a]",children:[e.jsxs("span",{className:"font-semibold text-[#303030]",children:["$",Le.price]})," per month"]})]},Le.key))}),Dt=()=>{if(!B)return null;const Le=Yt(B.key),Ye=B.price===0?"Free":B.name,qe=B.price??0,At=B.main_credit??0,yt=B.features?.PRODUCT_LISTING??0,Bt=B.features?.ORDER_FULFILLMENT??0,Tt=ze(Le),et=Fr(Le),rs=Ge.filter(we=>et.includes(we)),Ns=Ge.filter(we=>!et.includes(we)),Os=rt.length>1;return e.jsxs("div",{className:oe("flex flex-col bg-white rounded-xl relative min-h-[700px]",c?"gap-3 p-4":"h-full min-h-0 overflow-hidden"),style:{boxShadow:"inset 1px 0px 0px 0px rgba(0,0,0,0.13), inset -1px 0px 0px 0px rgba(0,0,0,0.13), inset 0px -1px 0px 0px rgba(0,0,0,0.17), inset 0px 1px 0px 0px rgba(204,204,204,0.5), 0px 1px 0px rgba(26,26,26,0.07)"},children:[e.jsxs("div",{className:oe("flex flex-col gap-3",!c&&"flex-1 min-h-0 overflow-y-auto p-4 pb-3"),children:[e.jsxs("div",{className:"flex items-center gap-2 pl-1",children:[e.jsxs("div",{className:"flex flex-1 min-w-0 items-center gap-2",children:[e.jsxs("div",{className:"relative",ref:j,children:[e.jsxs("button",{className:oe("flex items-center gap-1",Os?"cursor-pointer":"cursor-default"),onClick:()=>
49Os&&y(we=>!we),children:[e.jsx("span",{className:"text-[20px] font-[650] leading-[24px] tracking-[-0.2px] text-[#303030]",children:Ye}),Os&&e.jsx(wb,{})]}),v&&!c&&e.jsx("div",{className:"absolute top-full left-0 mt-1 z-50 bg-white rounded-lg py-1 min-w-[200px]",style:{boxShadow:"0 4px 16px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(0,0,0,0.08)"},children:ht()})]}),!I&&!c&&e.jsx("span",{className:"px-2 py-0.5 bg-[#e0f0ff] text-[#00527c] text-[12px] font-[550] rounded-lg leading-[16px] shrink-0",children:"New plan"})]}),e.jsxs("div",{className:"flex items-baseline gap-1 shrink-0",children:[e.jsxs("span",{className:"text-[36px] font-bold leading-[48px] tracking-[-0.54px] text-[#303030]",children:["$",qe]}),e.jsx("span",{className:"text-[12px] font-[550] text-[#202223]",children:n("PerMonth")})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 py-1",children:[e.jsx(xa,{icon:e.jsx(Nc,{}),label:n("AICredits")||"AI credits",used:me,limit:At}),A==="AO"&&e.jsxs(e.Fragment,{children:[e.jsx(xa,{icon:e.jsx(ee,{source:ms}),label:n("Products")||"Products",used:Be,limit:yt}),e.jsx(xa,{icon:e.jsx(ee,{source:is}),label:n("Orders")||"Orders",used:ot,limit:Bt})]})]}),e.jsx("div",{className:"h-px bg-[#e3e3e3]"}),Tt.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[11px] font-[650] leading-[12px] text-[#303030]",children:"Core tools"})}),e.jsx("div",{className:"flex flex-col gap-3",children:Tt.map(we=>e.jsx(_a,{label:n(we)||we,supported:!0},we))})]}),lt&&A==="AO"&&!!q.size(rs||Ns)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[11px] font-[650] leading-[12px] text-[#303030]",children:"Advanced tools"})}),e.jsx("div",{className:"flex flex-col gap-3",children:rs.map(we=>e.jsx(_a,{label:n(we)||we,supported:!0},we))})]})]}),!c&&e.jsx("div",{className:"shrink-0 bg-white border-t border-[#e3e3e3] px-4 pt-3 pb-4",children:Ie()})]})},Ft=()=>e.jsx("div",{id:"btn-close-drawer-upgrade-plan",className:"hidden!",onClick:te}),as=()=>e.jsx(kt,{tone:"warning",children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"regular",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:ye}})})}),fs=()=>e.jsxs("div",{className:"flex flex-col max-h-[760px] overflow-hidden",style:{height:"calc(100vh - 160px)"},children:[e.jsx("div",{className:"flex flex-col flex-1 min-h-0 bg-[#f1f1f1] overflow-hidden px-4 py-4 rounded-b-xl",children:e.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-4",children:[z&&as(),e.jsxs("div",{className:"grid grid-cols-2 gap-6 flex-1 min-h-0",children:[Ue(),Dt()]})]})}),e.jsx(un,{onChargeError:()=>{},ref:k,app:A}),Ft()]}),Jt=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 bg-[#f1f1f1] flex flex-col gap-4 pb-[180px]",children:[z&&as(),Dt()]}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 p-4 bg-white border-t border-[#e3e3e3] flex flex-col gap-2",style:{bottom:"var(--shopify-safe-area-inset-bottom, 0px)"},children:Ie()}),e.jsx(un,{onChargeError:()=>{},ref:k,app:A}),Ft()]});return c?e.jsxs(e.Fragment,{children:[e.jsx(xt,{title:e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsx(m,{as:"span",children:"Upgrade"}),e.jsx("span",{className:"[&_span]:text-text-link [&_svg]:fill-icon-emphasis",onClick:()=>S(!C),children:e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx(m,{as:"span",variant:"bodySm",children:"Current plan"}),e.jsx(Q,{children:e.jsx(ee,{source:Ys})})]})})]}),background:"bg",placement:"right",visible:d,onClose:te,children:Jt()}),e.jsx(xt,{title:"Current plan",background:"bg",placement:"bottom",showCloseIcon:!0,visible:C,onClose:()=>S(!1),children:e.jsxs(Q,{padding:"400",paddingBlockStart:"0",children:[" ",Ue()]})}),e.jsx(xt,{title:"Select a plan",background:"bg",placement:"bottom",visible:v,onClose:()=>y(!1),children:e.jsx(Q,{padding:"400",paddingBlockStart:"0",children:e.jsx(D,{gap:"300",children:ht()})})})]}):e.jsx(Xe,{title:n("ChangeYourPlan"),open:d,onClose:te,size:"large",footer:!1,children:fs()})}),Wa=(t,s,n)=>{Tn.postOnboardingTrade({topic:t,path:window.location.pathname,status:"success",message:`${n} | variant:${s}`})}
49,Db="WELCOME15",Lb={onboarding:{title:"ð A welcome gift for you",description:"Upgrade to any paid plan today and get 15% OFF your first subscription payment."},pricing:{title:"Need more time to decide?",description:"Upgrade to any paid plan today and get 15% OFF your first subscription payment."}},Pi=i.forwardRef(({onApplied:t,onChooseFreePlan:s,isOnboarding:n=!1},a)=>{const r=he(vi),{onUpdateUserInfo:o,getUserInfo:l}=de(),c=l(),[u,d]=i.useState(!1),[g,h]=i.useState("onboarding"),[p,x]=i.useState(""),f=`${st.SHOWED_OFFER_WELCOME}_${c?.id}`,{data:_,isLoading:b}=_0({coupon_code:p});i.useImperativeHandle(a,()=>({open:(T="onboarding")=>{h(T),x(""),d(!0),ge.localStorage.set(f,"true"),v(),Wa("offer",T,"OFFER_SHOW")},close:()=>d(!1)}),[]);const v=()=>{Cs.updateValueOnboarding({key:Ut.SHOWED_OFFER_WELCOME,value:!0}),o({...c,remaining_meta_keys:{...c.remaining_meta_keys,[Ut.SHOWED_OFFER_WELCOME]:!0}})},y=(()=>{if(!_?.start_at||!_?.end_at)return!1;const T=Date.now();return T>=new Date(_.start_at).getTime()&&T<=new Date(_.end_at).getTime()})(),C=!!_&&_.status==="active"&&_.usage_limit>0&&_.used_count<_.usage_limit,S=!!_?.discount_id&&C&&y;i.useEffect(()=>{p&&S&&(r(_),t?.(),d(!1))},[S,p]);const j=i.useCallback(()=>{Wa("offer",g,"OFFER_APPLY"),Wa("onboarding",g,"PLAN_SELECTED:PAID_VIA_OFFER"),x(Db),d(!1)},[g]),{title:A,description:E}=Lb[g];return e.jsx(Xe,{title:A,open:u,onClose:()=>d(!1),primaryAction:{content:"Claim 15% OFF",onAction:j,loading:b},secondaryActions:[{content:n?"Continue with Free plan":"Cancel",onAction:()=>{n&&(Wa("onboarding",g,"PLAN_SELECTED:FREE"),Wa("offer",g,n?"Continue with Free plan":"Cancel")),d(!1),n&&s?.()},disabled:b}],size:"small",children:e.jsx(Q,{padding:"400",children:e.jsxs(D,{gap:"300",children:[e.jsxs(U,{gap:"300",blockAlign:"center",wrap:!1,children:[e.jsx(Q,{children:e.jsx(ee,{source:hg,tone:"magic"})}),e.jsx(Bs,{tone:"success",children:"15% OFF"})]}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:E})]})})})});Pi.displayName="ModalOffer";const Ht={import_product:{key:"PRODUCT_IMPORT",create_at:"28-08-2024",description:""},single_edit_product:{key:"single_edit_product",create_at:"28-08-2024",description:""},bulk_edit_product:{key:"bulk_edit_product",create_at:"28-08-2024",description:""},bulk_push_product:{key:"bulk_push_product",create_at:"28-08-2024",description:""},single_push_product:{key:"single_push_product",create_at:"28-08-2024",description:""},bulk_place_order:{key:"bulk_place_order",create_at:"28-08-2024",description:""},single_place_order:{key:"single_place_order",create_at:"28-08-2024",description:""},auto_find_suppliers:{key:"auto_find_suppliers",create_at:"28-08-2024",description:""},subscription_changed:{key:"subscription_changed",create_at:"28-08-2024",description:""},new_charge_success:{key:"new_charge_success",create_at:"28-08-2024",description:""},checkout_open:{key:"checkout_open",create_at:"28-08-2024",description:""},checkout_success:{key:"checkout_success",create_at:"28-08-2024",description:""},downgrade_success:{key:"downgrade_success",create_at:"28-08-2024",description:""},upgrade_success:{key:"upgrade_success",create_at:"28-08-2024",description:""},map_products:{key:"map_products",create_at:"28-08-2024",description:""},replace_products:{key:"replace_products",create_at:"28-08-2024",description:""},notification_click:{key:"notification_click",create_at:"28-08-2024",description:""},apply_content_ai:{key:"apply_content_ai",create_at:"28-08-2024",description:""},order_listing_test:{key:"order_listing_test",create_at:"28-08-2024",description:""},apply_content_ai_editor:{key:"apply_content_ai_editor",create_at:"28-08-2024",description:""},click_place_list:{key:"click_place_list",create_at:"28-08-2024",description:""},click_bulk_place_list:{key:"click_bulk_place_list",create_at:"28-08-2024",description:""},import_home:{key:"import_home",create_at:"28-08-2024",description:""},view_details_home:{key:"view_details_home",create_at:"28-08-2024",description:""},supplier_finder:{key:"supplier_finder",create_at:"28-08-2024",description:""},upgrade_order_history:{key:"upgrade_order_history",create_at:"28-08-2024",description:""},upgrade_import_list:{key:"upgrade_import_list",create_at:"28-08-2024",description:""},upgrade_bulk_push:{key:"upgrade_bulk_push",create_at:"28-08-2024",description:""},upgrade_split_product:{key:"upgrade_split_product",create_at:"28-08-2024",description:""},upgrade_cash_back:{key:"upgrade_cash_back",create_at:"28-08-2024",description:""},upgrade_add_store:{key:"upgrade_add_store",create_at:"28-08-2024",description:""},upgrade_bulk_order:{key:"upgrade_bulk_order",create_at:"28-08-2024",description:""},upgrade_related_images:{key:"upgrade_related_images",create_at:"28-08-2024",description:""},upgrade_find_suppliers:{key:"upgrade_find_suppliers",create_at:"28-08-2024",description:""},upgrade_fulfill_orders:{key:"upgrade_fulfill_orders",create_at:"28-08-2024",description:""},upgrade_product_mapped:{key:"upgrade_product_mapped",create_at:"28-08-2024",description:""},upgrade_optimize_image:{key:"upgrade_optimize_image",create_at:"28-08-2024",description:""},upgrade_order_tracking:{key:"upgrade_order_tracking",create_at:"28-08-2024",description:""},upgrade_header:{key:"upgrade_header",create_at:"28-08-2024",description:"Click button upgrade header"},upgrade_your_usage:{key:"upgrade_your_usage",create_at:"28-08-2024",description:"Click ChangePlan button"},upgrade_no_quota:{key:"upgrade_no_quota",create_at:"28-08-2024",description:""},upgrade_live_order_summary:{key:"upgrade_live_order_summary",create_at:"28-08-2024",description:""},upgrade_live_order_fulldata:{key:"upgrade_live_order_fulldata",create_at:"28-08-2024",description:""},upgrade_track_daily_sales:{key:"upgrade_track_daily_sales",create_at:"28-08-2024",description:""},upgrade_export_product:{key:"upgrade_export_product",create_at:"28-08-2024",description:""},upgrade_store_product_fulldata:{key:"upgrade_store_product_fulldata",create_at:"28-08-2024",description:""},upgrade_related_video:{key:"upgrade_related_video",create_at:"28-08-2024",description:""},upgrade_similar_suppliers:{key:"upgrade_similar_suppliers",create_at:"28-08-2024",description:""},upgrade_store_selling:{key:"upgrade_store_selling",create_at:"28-08-2024",description:""},upgrade_product_results_fulldata:{key:"upgrade_product_results_fulldata",create_at:"28-08-2024",description:""},upgrade_tiktok_results_fulldata:{key:"upgrade_tiktok_results_fulldata",create_at:"28-08-2024",description:""},upgrade_store_results_fulldata:{key:"upgrade_store_results_fulldata",create_at:"28-08-2024",description:""},upgrade_trend_results_fulldata:{key:"upgrade_trend_results_fulldata",create_at:"28-08-2024",description:""},product_detail_viewmore_storeselling:{key:"product_detail_viewmore_storeselling",create_at:"28-08-2024",description:""},product_detail_viewmore_similarsuppliers:{key:"product_detail_viewmore_similarsuppliers",create_at:"28-08-2024",description:""},product_detail_viewmore_relatedvideo:{key:"product_detail_viewmore_relatedvideo",create_at:"28-08-2024",description:""},click_search:{key:"click_search",create_at:"28-08-2024",description:""},click_image_search:{key:"click_image_search",create_at:"28-08-2024",description:""},click_filter:{key:"click_filter",create_at:"28-08-2024",description:""},click_sort:{key:"click_sort",create_at:"28-08-2024",description:""},sign_in_shopify:{key:"sign_in_shopify",create_at:"28-08-2024",description:""},sign_up:{key:"sign_up",create_at:"28-08-2024",description:""},sign_in:{key:"sign_in",create_at:"28-08-2024",description:""},direct_sign_in:{key:"direct_sign_in",create_at:"28-08-2024",description:""},"fd-tracking-keyword":{key:"fd-tracking-keyword",create_at:"28-08-2024",description:""},"click-discover-winning-products":{key:"click-discover-winning-products",create_at:"28-08-2024",description:""},ec_add_to_collection:{key:"ec_add_to_collection",create_at:"28-08-2024",description:""},ec_find_supplier:{key:"ec_find_supplier",create_at:"28-08-2024",description:""},ec_download_media:{key:"ec_download_media",create_at:"28-08-2024",description:""},ec_download_ads:{key:"ec_download_ads",create_at:"28-08-2024",description:""},mkt_users_click_contact_support:{key:"mkt_users_click_contact_support",create_at:"24-01-2025",description:"click contact support in page OB MKT"},mkt_users_click_sign_up:{key:"mkt_users_click_login",create_at:"24-01-2025",description:"click login in page OB MKT"},mkt_users_connected_store:{key:"mkt_users_connected_store",create_at:"24-01-2025",description:"connect store in page OB MKT"}},Dn=(t,s,n)=>{const o=((s?.package?.modules||[]).find(d=>d.type==="CREDIT")?.name||"").replaceAll("Order & Fulfillment","").replaceAll("Fulfillment","").trim(),l={event:t,gtm:{}};let c={};[Ht.apply_content_ai_editor.key,Ht.apply_content_ai.key,Ht.import_product.key,Ht.single_edit_product.key,Ht.single_push_product.key,Ht.single_place_order.key,Ht.auto_find_suppliers.key].includes(t)&&(c={plan:o}),[Ht.map_products.key,Ht.replace_products.key].includes(t)&&(c={plan:o,...n}),[Ht.bulk_edit_product.key].includes(t)&&(c={plan:o,number_edited_product:0,...n}),[Ht.bulk_push_product.key].includes(t)&&(c={plan:o,number_pushed_product:0,...n}),[Ht.bulk_place_order.key].includes(t)&&(c={plan:o,number_orders_placed:0,...n}),[Ht.checkout_open.key].includes(t)&&(c={checkout_plan:"",checkout_value:"",...n}),[Ht.new_charge_success.key].includes(t)&&(c={plan_name:"",plan_value:"",...n}),[Ht.upgrade_success.key,Ht.downgrade_success.key].includes(t)&&(c={old_plan_name:"",old_plan_value:"",new_plan_name:"",new_plan_value:"",...n}),l.gtm=c;const u=window;u.dataLayer&&u.dataLayer.push(l)},gw=t=>{const s={event:t.event,gtm:t.dataGTM||{}};window.dataLayer&&window.dataLayer.push(s)},ss=(t,s={})=>{const n=window.is_free_user,a={...s};n?a.free_user=!0:a.paid_user=!0,window.gtag("event",t,a)},Mb=se.div` 50 width: auto; 51 // height: 42px; 52 position: relative; 53 cursor: ${({disabled:t})=>t?"not-allowed":"pointer"}; 54 opacity: ${({disabled:t})=>t?.8:1}; 55`,Ub=se(_r.div)` 56 position: absolute; 57 height: 32px; 58 background: ${({disabled:t})=>t?"var(--p-color-bg-surface-disabled)":"var(--p-color-bg-fill-transparent-selected)"}; 59 border-radius: var(--p-border-radius-200); 60 z-index: 1; 61 transition: background-color 0.2s ease; 62`,Oc=se(_r.div)` 63 user-select: none; 64 height: 32px; 65 display: flex; 66 align-items: center; 67 justify-content: center; 68 z-index: 2; 69 position: relative; 70 color: ${({disabled:t})=>t?"var(--p-text-disabled)":"inherit"}; 71 padding: 0 6px; 72 font-weight: 500; 73`,En=({disabled:t=!1})=>{const{t:s}=J();de();const[n,a]=be(Gt),r=i.useMemo(()=>n==="yearly",[n]),o=!1;xe();const l=i.useRef(null),c=i.useRef(null),[u,d]=i.useState(0),[g,h]=i.useState(0);i.useLayoutEffect(()=>{l.current&&c.current&&(d(l.current.getBoundingClientRect().width),h(c.current.getBoundingClientRect().width))},[s]);const p=i.useCallback(()=>{t||(ss(`pricing_${n}_click`,{}),requestAnimationFrame(()=>{a(v=>v==="yearly"?"monthly":"yearly")}))},[a,o,t]),{transform:x,width:f}=ja({transform:r?`translateX(${u}px)`:"translateX(0px)",width:r?g:u,config:{tension:200,friction:20}}),{opacity:_}=ja({opacity:1}),{opacity:b}=ja({opacity:1});return e.jsx(Mb,{disabled:t,onClick:p,children:e.jsx(Q,{background:void 0,children:e.jsxs(U,{gap:"100",children:[e.jsx(Ub,{disabled:o,style:{transform:x,width:f,left:"0px"}}),e.jsx(Oc,{ref:l,disabled:o,style:{opacity:_,color:r?"var(--p-text-color)":"var(--p-color-text)"},children:e.jsx(sn,{as:"span",fontWeight:"medium",variant:"bodySm",tone
73:void 0,children:s("PayMonthly")})}),e.jsx(Oc,{ref:c,disabled:o,style:{opacity:b,color:r?"var(--p-color-text)":"var(--p-text-color)"},children:e.jsxs(U,{blockAlign:"center",gap:"100",wrap:!1,children:[e.jsx("span",{className:"mr-1",children:s("PayYearly")}),!r&&e.jsx("div",{className:"[&_.Polaris-Badge]:bg-[#CDFEE1] [&_.Polaris-Badge]:text-text-success",children:e.jsx(wt,{tone:"success",children:s("ExclusiveOffer")})})]})})]})})})},cs=({value:t,duration:s=500,prefix:n="",suffix:a="",propsText:r})=>{const[o,l]=i.useState(0),[c,u]=i.useState(!1),d=i.useRef(0);i.useEffect(()=>{const h=typeof t=="string"?parseFloat(t)||0:t;if(d.current===h)return;u(!0);const p=d.current,x=h,f=Date.now(),_=()=>{const b=Date.now(),v=Math.min((b-f)/s,1),y=1-Math.pow(1-v,3),C=p+(x-p)*y;l(C),v<1?requestAnimationFrame(_):(l(x),d.current=x,u(!1))};requestAnimationFrame(_)},[t,s]);const g=h=>{if(typeof t=="string"&&t.toLowerCase()==="custom")return t;const p=typeof t=="number"&&!Number.isInteger(t)?1:0,x=h.toLocaleString("en-US",{minimumFractionDigits:p,maximumFractionDigits:p});return`${n}${x}${a}`};return e.jsx(Fb,{className:c?"animating":"",children:e.jsx(m,{as:"h1",variant:"heading3xl",...r,children:typeof t=="string"&&isNaN(parseFloat(t))?t:g(o)})})},Fb=se.div` 74 display: inline-block; 75 76 &.animating { 77 animation: pulse 0.5s ease-in-out; 78 } 79 80 @keyframes pulse { 81 0%, 82 100% { 83 transform: scale(1); 84 } 85 50% { 86 transform: scale(1.05); 87 } 88 } 89 90 .Polaris-Text--root { 91 transition: color 0.3s ease; 92 } 93`,So=["FREE_CREDIT","STARTER_CREDIT_TIER","GROWTH_CREDIT_TIER","PRO_CREDIT_TIER"],Bb=(()=>{const t=new Set,s=[],n=[er,{...Xn,PRO_CREDIT_TIER:[]},{...Us,PRO_CREDIT_TIER:Us.PRO_CREDIT_TIER.filter(a=>!["FullSettingsUnlock"].includes(a)),ENTERPRISE_CREDIT_TIER:Us.ENTERPRISE_CREDIT_TIER.filter(a=>!["FullSettingsUnlock"].includes(a))}];for(const a of So)for(const r of n){const o=r[a]??[];for(const l of o)t.has(l)||(t.add(l),s.push({key:l,label:l,minPlan:a}))}return s})();function Hb(t,s){const n=So.indexOf(t),a=So.indexOf(s);return n>=0&&a>=0&&n>=a}let Dc;const Gb=({plan:t,isYearly:s,isShowBlackFriday:n,isAtOnboarding:a})=>{const{t:r}=J(),o=de(),l=o.getUserInfo(),c=o.getCurrentPlan("AO"),u=ke(el),d=ke(tl),g=ke(sl);l?.plan_reinstalled||l?.first_cycle_charge_type;const h=c?.remaining_trial_days||0;if(t.key==="ENTERPRISE_CREDIT_TIER")return e.jsxs(D,{gap:"050",children:[e.jsx(m,{as:"h1",variant:"heading3xl",children:r("Custom")}),e.jsx("div",{className:"mt-1",children:e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:["from $",Fe(bs.ENTERPRISE_CREDIT_TIER)]})})]});if(t.key==="FREE_CREDIT")return e.jsxs(D,{gap:"050",children:[e.jsx(cs,{value:t.price,prefix:"$",propsText:{as:"span",variant:"headingLg",fontWeight:"semibold",children:""}}),e.jsx("div",{className:"mt-1",children:e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:r("Forever")})})]});if(t.key!=="FREE"&&s)return e.jsxs(D,{gap:"050",children:[e.jsxs(U,{gap:"100",wrap:!1,blockAlign:"center",children:[e.jsx(cs,{value:t.eachYearlyPrice,prefix:"$",propsText:{as:"span",variant:"headingLg",fontWeight:"semibold",children:""}}),e.jsxs(m,{as:"span",tone:"subdued",textDecorationLine:"line-through",children:["$",Fe(t.price)]})]}),e.jsx(Q,{children:e.jsx(wt,{children:r("3dayTrial",{var_days:h})})})]});if(d&&u?.condition_value?.plans?.includes(t.key)){const p=g.type==="fixed_amount"?g.value:t.price*g.value/100>g.max_discount_amount?g.max_discount_amount:t.price*g.value/100;let x=t.price-p;return x<0&&(x=0),e.jsx(Q,{width:"100%",children:e.jsxs(D,{gap:"100",inlineAlign:"start",children:[e.jsxs(U,{gap:"100",align:"center",blockAlign:"center",wrap:!1,children:[e.jsx(cs,{value:x,prefix:"$",propsText:{variant:"headingLg"}}),e.jsxs(m,{as:"span",textDecorationLine:"line-through",children:["$",Fe(t.price)]})]})," ",a&&e.jsx(Q,{background:"bg-fill-magic-secondary",borderRadius:"200",paddingBlock:"050",paddingInline:"100",children:e.jsxs(m,{as:"span",variant:"bodySm",tone:"magic",children:[t.price-x===0?100:Vt((t.price-x)/t.price*100),"% OFF"]})})]})})}return n?e.jsxs(D,{gap:"050",children:[e.jsx(cs,{value:t.price,prefix:"$",propsText:{as:"span",variant:"headingLg",fontWeight:"semibold",children:""}}),e.jsx(Q,{children:e.jsx(wt,{children:r("3dayTrial",{var_days:h})})})]}):e.jsxs(D,{gap:"050",children:[e.jsx(cs,{value:t.price,prefix:"$",propsText:{as:"span",variant:"headingLg",fontWeight:"semibold",children:""}}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:r("PerMonth").toLowerCase()})]})},Wb=({plan:t,isSelected:s,isYearly:n,isShowTrial:a,isAtOnboarding:r,onSelect:o,onViewFeatures:l})=>{const{t:c}=J(),{newLabel:u}=Ks(),{hasRecommendPlan:d}=zt(),g=d(t.key),h=p=>{p.stopPropagation(),l()};return e.jsx("div",{onClick:o,className:Un("bg-[#fff]",{"[&_.Polaris-Box]:border-text-magic":g&&!s}),children:e.jsx(Q,{padding:"400",position:"relative",borderRadius:"300",borderWidth:g&&!s?"025":"0165",borderColor:s?"input-border-active":"border",children:e.jsxs(D,{gap:"400",inlineAlign:"start",children:[g&&e.jsx("div",{className:oe("opacity-100 duration-300"),children:e.jsx("div",{className:"[&_.Polaris-Badge]:bg-bg-surface-inverse [&_.Polaris-Badge]:text-text-brand-on-bg-fill [&_.Polaris-Badge_span]:font-semibold",children:e.jsx(Bs,{children:c("Recommended").toUpperCase()})})}),e.jsx(Q,{width:"100%",children:e.jsxs(ft,{columns:"minmax(0, 1fr) 120px",alignItems:"center",gap:"600",children:[e.jsxs(ft,{columns:"auto minmax(0, 1fr)",alignItems:"center",gap:"100",children:[e.jsx(As,{checked:s,label:""}),e.jsx(m,{as:"h1",variant:"headingLg",children:t.name})]}),e.jsx(Gb,{plan:t,isYearly:n,isShowBlackFriday:a,isAtOnboarding:r})]})}),e.jsx(Q,{width:"100%",children:e.jsx($e,{borderColor:"border-secondary"})}),e.jsx(Q,{width:"100%",children:e.jsxs(ft,{columns:"minmax(0, 1fr) auto",alignItems:"center",gap:"100",children:[e.jsx(D,{gap:"200",children:t.includes.map((p,x)=>e.jsx("div",{children:e.jsx(Q,{borderRadius:"200",borderWidth:"0165",width:"fit-content",borderColor:"border-secondary",background:"bg-surface-secondary",paddingInline:"100",paddingBlock:"050",children:e.jsxs(ft,{columns:"20px 1fr",alignItems:"center",gap:"100",children:[e.jsx("div",{className:"[&_.Polaris-Icon]:w-[12px] [&_.Polaris-Icon]:h-[12px]",children:e.jsx(ee,{source:Je})}),e.jsxs(m,{as:"span",variant:"bodySm",children:[typeof p.value=="number"?Fe(p.value):p.value,"Â ",c(u[p.label]).toLowerCase(),"Â ",p.subfixValue]})]},x)})},x))}),e.jsx("div",{onClick:h,children:e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,children:[e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",truncate:!0,children:c("ViewDetail")}),e.jsx(Q,{children:e.jsx(ee,{source:Ys})})]})})]})})]})})})},qp=({planKey:t})=>{const{t:s}=J(),n=[...Bb].filter(a=>!["BasicProductEditor","BasicOrderFulfillment"].includes(a.key));return e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"h2",fontWeight:"semibold",children:"Included features"}),n.map(a=>{const r=Hb(t,a.minPlan);return e.jsx(Q,{as:"div",children:e.jsx(Q,{padding:"100",paddingInline:"200",width:"fit-content",children:e.jsxs(U,{gap:"300",blockAlign:"center",wrap:!1,children:[e.jsx("div",{className:Un("w-[5px] h-[5px] rounded-2xl ",{"bg-[#303030]":r,"bg-[#B5B5B5]":!r})}
93),e.jsx(m,{as:"span",variant:"bodySm",tone:r?"base":"disabled",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s(a.label)}})})]})})},a.key)})]})},Vb=({plan:t})=>{const{t:s}=J(),{newLabel:n}=Ks();return e.jsxs(D,{gap:"400",children:[e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,align:"space-between",children:[e.jsx(m,{as:"h1",variant:"headingLg",children:t.name}),e.jsx(m,{as:"span",tone:"subdued",children:s(t.subName)})]}),e.jsx(D,{gap:"200",children:t.includes.map((a,r)=>e.jsxs(ft,{columns:"auto minmax(0, 1fr)",alignItems:"center",gap:"100",children:[e.jsx(Q,{children:e.jsx(ee,{source:a.icon})}),e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,children:[e.jsxs(m,{as:"span",fontWeight:"semibold",variant:"bodySm",children:[typeof a.value=="number"?Fe(a.value):a.value,a.subfixValue]}),e.jsx(m,{as:"span",variant:"bodySm",children:s(n[a.label])})]})]},r))}),e.jsx($e,{}),e.jsx(qp,{planKey:t.key})]})},Yb=({total:t,current:s,onDotClick:n})=>e.jsx("div",{className:"flex items-center justify-center gap-1.5",children:Array.from({length:t}).map((a,r)=>e.jsx("button",{onClick:()=>n(r),style:{width:r===s?20:8,height:8,borderRadius:4,background:r===s?"var(--p-color-text)":"var(--p-color-border)",border:"none",padding:0,cursor:"pointer",transition:"all 0.3s ease"}},r))}),zb=({packages:t,initialIndex:s,isYearly:n,isTrial:a,onActiveIndexChange:r,onRegisterScroll:o})=>{const[l,c]=xr({loop:!1,align:"center",startIndex:s});return i.useEffect(()=>{if(!c)return;const u=()=>{const d=c.selectedScrollSnap();r?.(d)};return c.on("select",u),()=>{c.off("select",u)}},[c,r]),i.useEffect(()=>{c&&o&&o(u=>c.scrollTo(u))},[c,o]),e.jsx("div",{className:"overflow-y-auto",children:e.jsx(ts.Viewport,{ref:l,slideSize:"100%",slideSpacing:"400",children:e.jsx(ts.Container,{children:t.map(u=>{const d=a&&!n&&cn.includes(u.key);return e.jsx(ts.Slide,{className:"msui-cs-pointer",children:e.jsx(Q,{paddingInline:"500",paddingBlock:"600",children:e.jsx(D,{gap:"200",children:e.jsx(Vb,{plan:u,isYearly:n,isShowBlackFriday:d})})})},u.key)})})})})},Kb=({isAtOnboarding:t,onChoosePlan:s,combinedPackages:n})=>{const{t:a}=J(),{getCurrentPlan:r,isTrialChargeSubcription:o,getUserInfo:l,isPlanFree:c}=de(),u=r(),d=o(),g=l(),[h,p]=be(Gt),{packages:x,freePackage:f}=Ks();ke(vi);const _=ke(np),b=ke(el),v=ke(tl),y=ke(sl),C=h==="yearly",S=g?.plan_reinstalled||g?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE",j=u?.remaining_trial_days||0,{getCurrentCyclePlan:A,hasCurrentPlanActive:E,findPlanByKey:T,getCurrentFulfillmentPlan:k}=zt(),O=k("AO"),R=A("AO"),P=d&&j>0,w=i.useMemo(()=>[f,...Array.isArray(x)?x:[]],[f,t,x]),[N,K]=i.useState(""),[L,W]=i.useState(!1),[H,Z]=i.useState(0),[te,ne]=i.useState(""),[le,B]=i.useState(0),ie=i.useRef(null),V=i.useRef(null),M=i.useRef(!1),I=`${st.SHOWED_OFFER_WELCOME}_${g?.id}`,F=i.useMemo(()=>n.find(ce=>ce.key===N)||n[0],[n,N]),G=i.useMemo(()=>w.find(ce=>ce.key===te)||w[H],[w,te,H]),z=i.useCallback((ce,Ae)=>{const _e=E(ce);if(S){const Pe=T(ce);if(t&&!!S&&Number(O?.id)===Number(Pe?.id))return a("ContinueThisPlan")}else{let Pe=!1;if(_e&&ce==="FREE_CREDIT"?Pe=!t:h==="monthly"?Pe=R===30&&_e:Pe=R===365&&_e,Pe)return a("YouAreHere")}return`${a("Choose")} ${Ae?.toUpperCase()}`},[E,t,h,R,T,S,O,a]);i.useEffect(()=>{if(!N&&n.length>0){const ce=n.find(Ae=>E(Ae.key));K(ce?.key??n[0].key)}},[w,N]),i.useEffect(()=>(Dc=setTimeout(()=>{if(!M.current){const ce=`${st.SHOWED_OFFER_WELCOME}_${g?.id}`,Ae=ge.localStorage.get(ce)||g?.remaining_meta_keys?.[Ut.SHOWED_OFFER_WELCOME];!t&&c()===!0&&h==="monthly"&&!Ae&&(V.current?.open("pricing"),M.current=!0)}},15e3),()=>{clearTimeout(Dc)}),[h,c,t]);const me=i.useCallback((ce,Ae)=>{M.current=!0,F&&s({keyPlan:F.key,isYearly:C,isTrial:ce,isRechargePlan:!!S,discountCode:Ae})},[d,C,s,F]),Re=i.useCallback(()=>{if(M.current=!0,!(ge.localStorage.get(I)||g?.remaining_meta_keys?.[Ut.SHOWED_OFFER_WELCOME])&&G.key.includes("FREE_CREDIT")&&t){V.current?.open();return}G&&s({keyPlan:G.key,isYearly:C,isTrial:P&&cn.includes(G.key),isRechargePlan:!!S})},[G,P,C,s]),Be=i.useCallback(()=>{M.current=!0,G&&s({keyPlan:G.key,isYearly:!0,isTrial:!1,isRechargePlan:!!S})},[G,s,S]),De=i.useCallback((ce,Ae)=>{M.current=!0,G&&s({keyPlan:G.key,isYearly:!1,isTrial:ce,isRechargePlan:!!S,discountCode:Ae})},[G,P,S,s]),ot=i.useCallback(ce=>{const Ae=w[ce];Z(ce),ne(Ae?.key??""),B(ce),W(!0),window.scrollTo({top:0,behavior:"smooth"})},[w]),ve=i.useCallback(ce=>{const Ae=w[ce];Ae&&ne(Ae.key),B(ce)},[w]),pe=()=>{if(L){const ce=j>0&&o()&&h==="monthly"&&cn.includes(G?.key);return e.jsx(zb,{packages:w,initialIndex:H,isYearly:C,isTrial:ce,onActiveIndexChange:ve,onRegisterScroll:Ae=>{ie.current=Ae}})}return e.jsx(e.Fragment,{})},ze=()=>e.jsxs(D,{gap:"400",children:[e.jsx(Q,{paddingInline:"400",paddingBlockStart:"400",children:e.jsx(En,{disabled:u.provider_payment==="PADDLE_BILLING"&&u?.package?.cycle===365})}),e.jsx($e,{}),e.jsxs(D,{gap:"400",children:[e.jsx(Qe,{id:"promotion-code",open:h==="monthly"&&!(u?.is_used_discount||u?.has_charged),transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Q,{paddingInline:"400",children:e.jsx(pi,{})})}),e.jsx(Q,{paddingInline:"400",children:e.jsxs(D,{gap:"500",children:[n.map(ce=>{const Ae=ce.key===(F?.key||n[0]?.key),_e=P&&cn.includes(ce.key);return e.jsx(Wb,{plan:ce,isSelected:Ae,isYearly:C,isShowTrial:_e,isAtOnboarding:t,onSelect:()=>K(ce.key),onViewFeatures:()=>ot(w.findIndex(Pe=>Pe.key===ce.key))},ce.key)}),Ge()]})})]})]}),Ge=()=>L||t&&!Ce.isShopifyEmbedded()?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"flex items-center justify-center gap-1 py-2",children:[e.jsx(Q,{children:e.jsx(ee,{source:xi})}),e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:[a("NotReadyToCommit")," ",e.jsx("span",{onClick:()=>ot(0),className:"underline",children:a("StartWithFreePlan")})]})]}),lt=()=>{if(G?.key==="FREE_CREDIT")return e.jsxs(re,{onClick:Re,fullWidth:!0,disabled:z(G?.key,G?.name)===a("YouAreHere"),children:[a("Choose")," ",G?.name?.toUpperCase()]});const ce=R===365&&E(G?.key??"")&&!S,Ae=R===30&&E(G?.key??"")&&!S,_e=t&&d&&!S&&cn.includes(G?.key??""),Pe=v&&b?.condition_value?.plans?.includes(G?.key??"");let Ne=0,rt="";return Pe&&(Ne=y.type==="fixed_amount"?y.value:G.price*y.value/100>y.max_discount_amount?y.max_discount_amount:G.price*y.value/100,Ne=G.price-Ne,Ne<0&&(Ne=0),rt=_??""),e.jsxs(D,{gap:"400",children:[e.jsxs("button",{type:"button",onClick:Be,disabled:ce,className:"w-full rounded-lg bg-[#1a1a1a] text-white flex flex-col items-center justify-center gap-1 py-1 px-4 disabled:opacity-40 cursor-pointer disabled:cursor-not-allowed",children:[e.jsx("span",{className:"text-xs font-semibold",children:a("PayYearly")}),ce?e.jsx("span",{className:"text-xs opacity-70",children:a("YouAreHere")}):e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsxs("span",{className:"line-through opacity-60",children:["$",Fe(G?.price)]}),e.jsxs("span",{className:"font-semibold",children:["$",Fe(G?.eachYearlyPr
93ice),"/ month"]}),e.jsx("span",{className:"opacity-60",children:a("3monthOff")})]})]}),e.jsxs("button",{type:"button",onClick:()=>De(_e&&!Pe?_e:!1,rt),disabled:Ae,className:"w-full rounded-lg bg-white text-[#1a1a1a] border border-[#c9cccf] flex flex-col items-center justify-center gap-1 py-1 px-4 disabled:opacity-40 cursor-pointer disabled:cursor-not-allowed",children:[e.jsx("span",{className:"text-xs font-semibold",children:a("PayMonthly")}),Ae?e.jsx("span",{className:"text-xs opacity-70",children:a("YouAreHere")}):Pe?e.jsxs("div",{className:"flex items-center gap-1.5 ",children:[e.jsxs("span",{className:"line-through text-xs opacity-60",children:["$",Fe(G?.price)]}),e.jsxs("span",{className:"font-semibold text-md",children:["$",Fe(Ne),"/ month"]}),t&&e.jsx(Q,{background:"bg-fill-magic-secondary",borderRadius:"200",paddingBlock:"0",paddingInline:"100",children:e.jsxs(m,{as:"span",variant:"bodyXs",tone:"magic",children:[G.price-Ne===0?100:Vt((G.price-Ne)/G.price*100),"% OFF"]})})]}):_e?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"line-through text-xs opacity-60",children:["$",Fe(G?.price)]}),e.jsx("span",{className:"font-semibold text-md",children:"$0 / month"}),e.jsx(Q,{background:"bg-fill-secondary",borderRadius:"200",paddingBlock:"0",paddingInline:"100",children:e.jsx(wt,{children:a("3dayTrial",{var_days:j})})})]}):e.jsxs("span",{className:"text-xs opacity-70",children:["$",Fe(G?.price),"/ month"]})]})]})},ue=()=>{if(L)return null;let ce=_??"";return v&&b?.condition_value?.plans?.includes(F?.key??"")&&(ce=_??""),e.jsx("div",{id:"pricing-action-button",className:"fixed bottom-0 left-0 right-0 bg-white p-4 [&_.Polaris-Button]:h-[44px] w-full",style:{borderTop:"0.5px solid var(--p-color-border)",boxShadow:"0 -4px 20px 0 rgba(0,0,0,0.05)",bottom:"var(--shopify-safe-area-inset-bottom, 0px)"},children:e.jsxs(D,{gap:"400",children:[e.jsx(Qe,{id:"content-yearly-perks",open:C,children:e.jsx(Q,{padding:"200",borderRadius:"200",background:"bg-surface-success",children:e.jsxs(U,{align:"start",gap:"100",wrap:!1,blockAlign:"start",children:[e.jsx(Q,{children:e.jsx(ee,{tone:"success",source:Je})}),e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"regular",tone:"success",alignment:"center",children:a("3MonthsOffWithYearlyPlus5CreditRewardsAnd05ExtraOnTopups")})]})})}),e.jsx(re,{onClick:()=>me(P&&cn.includes(F?.key??""),ce),fullWidth:!0,variant:"primary",disabled:!S&&z(F?.key,F?.name)===a("YouAreHere"),children:z(F?.key,F?.name)})]})})};return e.jsx("div",{className:"flex flex-col min-h-full bg-[#fff] h-full",style:{paddingBottom:C?t?150:210:150},id:"pricing-ao-page",children:e.jsxs(D,{gap:"400",children:[ze(),ue(),e.jsx(xt,{showCloseIcon:!0,visible:L,onClose:()=>W(!1),children:e.jsxs(D,{gap:"400",children:[e.jsx(Q,{}),pe(),e.jsx("div",{className:"sticky bottom-0 bg-white",style:{padding:"0 16px 16px"},children:e.jsxs(D,{gap:"300",children:[e.jsx(Yb,{total:w.length,current:le,onDotClick:ce=>ie.current?.(ce)}),lt()]})})]})}),e.jsx(Pi,{onChooseFreePlan:()=>{s({keyPlan:"FREE_CREDIT",isYearly:!1,isTrial:!1,isRechargePlan:!1})},onApplied:()=>{p("monthly"),W(!1),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},500)},isOnboarding:t,ref:V})]})})},Yi=[{key:"UsageCredits",title:"UsageCredits",description:"",content:[{title:"MonthlyViewCredit",columns:[{value:30,subtitle:""},{value:350,subtitle:""},{value:-1,subtitle:""}],tooltip:"ProductsYouCanViewAnalyzeMonthly"}]},{key:"AIProductDiscovery",title:"AIProductDiscovery",description:"",content:[{title:"AccessToZopiAIAssistant",columns:[{value:"tick",subtitle:""},{value:"tick",subtitle:""},{value:"tick",subtitle:""}],tooltip:"UseAIToSupportYourProductDecisions"},{title:"SearchFindingWinning",columns:[{value:"Basic",subtitle:""},{value:"Basic",subtitle:""},{value:-1,subtitle:""}],tooltip:"FindWinningProductsWithSearchTools"},{title:"AdsIdeasDiscovery",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:-1,subtitle:""}],tooltip:"ExploreTrendingAdsProductIdeas"}]},{key:"InsightsAnalytics",title:"InsightsAnalytics",description:"",content:[{title:"ProductInsight",columns:[{value:"Basic",subtitle:""},{value:"Basic",subtitle:""},{value:-1,subtitle:""}],tooltip:"SeeProductPerformancePotential"}]},{key:"SupportService",title:"SupportService",description:"",content:[{title:"247PrioritySupport",columns:[{value:"",subtitle:""},{value:"",subtitle:""},{value:"tick",subtitle:""}],tooltip:"FasterHelpWhenYouNeedIt"}]}],Js=[{name:"Free",key:"FREE_CREDIT_TIER_PH",subName:"ForTestingPurposes",price:xn.FREE_CREDIT_TIER_PH,yearlyPrice:0,eachYearlyPr
93ice:0,saveYearlyPrice:0,credit:30,feature:{core_tools:["AccessToZopiAIAssistant","BasicSearchFindingWinning"]}},{name:"Light",key:"LIGHT_CREDIT_TIER_PH",subName:"ForOccasionalResearch",price:xn.LIGHT_CREDIT_TIER_PH,yearlyPrice:qt(xn.LIGHT_CREDIT_TIER_PH,tt).yearlyPrice,eachYearlyPrice:qt(xn.LIGHT_CREDIT_TIER_PH,tt).eachYearlyPrice,saveYearlyPrice:qt(xn.LIGHT_CREDIT_TIER_PH,tt).saveYearlyPrice,credit:350,feature:{core_tools:["AccessToZopiAIAssistant","BasicSearchFindingWinning","BasicProductInsights"]}},{name:"Unlimited",key:"UNLIMITED_CREDIT_TIER_PH",subName:"ForIntensiveResearchUse",price:xn.UNLIMITED_CREDIT_TIER_PH,yearlyPrice:qt(xn.UNLIMITED_CREDIT_TIER_PH,tt).yearlyPrice,eachYearlyPrice:qt(xn.UNLIMITED_CREDIT_TIER_PH,tt).eachYearlyPrice,saveYearlyPrice:qt(xn.UNLIMITED_CREDIT_TIER_PH,tt).saveYearlyPrice,credit:"Unlimited",feature:{core_tools:["AccessToZopiAIAssistant","BasicSearchFindingWinning","BasicProductInsights","FullAdsIdeasDiscovery"],highlight:["247PrioritySupport"]}}],jo=["FREE_CREDIT_TIER_PH","LIGHT_CREDIT_TIER_PH","UNLIMITED_CREDIT_TIER_PH"],Qb=(()=>{const t=new Set,s=[],n=[sp];for(const a of jo)for(const r of n){const o=r[a]??[];for(const l of o)t.has(l)||(t.add(l),s.push({key:l,label:l,minPlan:a}))}return s})();function qb(t,s){const n=jo.indexOf(t),a=jo.indexOf(s);return n>=0&&a>=0&&n>=a}const Zb=({plan:t,isYearly:s})=>{const{t:n}=J();return t.key==="FREE_CREDIT_TIER_PH"?e.jsxs(D,{gap:"050",children:[e.jsx(cs,{value:t.price,prefix:"$",propsText:{as:"span",variant:"headingLg",fontWeight:"semibold",children:""}}),e.jsx("div",{className:"mt-1",children:e.jsx(m,{as:"span",variant:"bodyXs",children:n("Forever")})})]}):s?e.jsxs(D,{gap:"050",children:[e.jsxs(U,{gap:"200",wrap:!1,blockAlign:"center",children:[e.jsx(cs,{value:t.eachYearlyPrice,prefix:"$",propsText:{as:"span",variant:"headingLg",fontWeight:"semibold",children:""}}),e.jsxs(m,{as:"span",tone:"subdued",textDecorationLine:"line-through",children:["$",Fe(t.price)]})]}),e.jsx("div",{className:"[&_.Polaris-Badge]:bg-bg-fill-success-secondary [&_.Polaris-Badge]:text-text-success",children:e.jsx(wt,{children:"3-month off"})})]}):e.jsxs(D,{gap:"050",children:[e.jsx(cs,{value:t.price,prefix:"$",propsText:{as:"span",variant:"headingLg",fontWeight:"semibold",children:""}}),e.jsx(m,{as:"span",variant:"bodyXs",children:n("PerMonth").toLowerCase()})]})},Xb=({plan:t,isSelected:s,isYearly:n,onSelect:a,onViewFeatures:r})=>{const{t:o}=J();return e.jsx("div",{onClick:a,className:"bg-[#fff]",children:e.jsx(Q,{padding:"400",position:"relative",borderRadius:"300",borderWidth:"0165",borderColor:s?"input-border-active":"border",children:e.jsxs(D,{gap:"400",inlineAlign:"start",children:[e.jsx(Q,{width:"100%",children:e.jsxs(ft,{columns:"minmax(0, 1fr) 120px",alignItems:"center",gap:"600",children:[e.jsxs(ft,{columns:"auto minmax(0, 1fr)",alignItems:"center",gap:"100",children:[e.jsx(As,{checked:s,label:""}),e.jsx(m,{as:"h1",variant:"headingLg",children:t.name})]}),e.jsx(Zb,{plan:t,isYearly:n})]})}),e.jsx(Q,{width:"100%",children:e.jsx($e,{borderColor:"border-secondary"})}),e.jsx(Q,{width:"100%",children:e.jsxs(ft,{columns:"minmax(0, 1fr) auto",alignItems:"center",gap:"100",children:[e.jsx(D,{gap:"200",children:e.jsx(Q,{borderRadius:"200",borderWidth:"0165",width:"fit-content",borderColor:"border-secondary",background:"bg-surface-secondary",paddingInline:"100",paddingBlock:"050",children:e.jsxs(ft,{columns:"20px 1fr",alignItems:"center",gap:"100",children:[e.jsx("div",{className:"[&_.Polaris-Icon]:w-[12px] [&_.Polaris-Icon]:h-[12px]",children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",variant:"bodySm",children:t.credit==="Unlimited"?o("Unlimited"):Fe(t.credit)+" view credits"})]})})}),e.jsx("div",{onClick:l=>{l.stopPropagation(),r()},children:e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,children:[e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",truncate:!0,children:"View detail"}),e.jsx(Q,{children:e.jsx(ee,{source:Ys})})]})})]})})]})})})},Zp=({planKey:t})=>{const{t:s}=J(),n=[...Qb].filter(a=>!["BasicProductEditor","BasicOrderFulfillment"].includes(a.key));return e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"h2",fontWeight:"semibold",children:"Included features"}),n.map(a=>{const r=qb(t,a.minPlan);return e.jsx(Q,{as:"div",children:e.jsx(Q,{padding:"100",paddingInline:"200",width:"fit-content",children:e.jsxs(U,{gap:"300",blockAlign:"center",wrap:!1,children:[e.jsx("div",{className:Un("w-[5px] h-[5px] rounded-2xl ",{"bg-[#303030]":r,"bg-[#B5B5B5]":!r})}
93),e.jsx(m,{as:"span",variant:"bodySm",tone:r?"base":"disabled",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s(a.label)}})})]})})},a.key)})]})},Jb=({plan:t})=>{const{t:s}=J();return e.jsxs(D,{gap:"400",children:[e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,align:"space-between",children:[e.jsx(m,{as:"h1",variant:"headingLg",children:t.name}),e.jsx(m,{as:"span",tone:"subdued",children:s(t.subName)})]}),e.jsx(D,{gap:"200",children:e.jsxs(ft,{columns:"auto minmax(0, 1fr)",alignItems:"center",gap:"100",children:[e.jsx(Q,{children:e.jsx(ee,{source:ra})}),e.jsx(m,{as:"span",fontWeight:"semibold",variant:"bodySm",children:t.credit==="Unlimited"?s("Unlimited"):Fe(t.credit)+" view credits"})]})}),e.jsx($e,{}),e.jsx(Zp,{planKey:t.key})]})},$b=({total:t,current:s,onDotClick:n})=>e.jsx("div",{className:"flex items-center justify-center gap-1.5",children:Array.from({length:t}).map((a,r)=>e.jsx("button",{onClick:()=>n(r),style:{width:r===s?20:8,height:8,borderRadius:4,background:r===s?"var(--p-color-text)":"var(--p-color-border)",border:"none",padding:0,cursor:"pointer",transition:"all 0.3s ease"}},r))}),ey=({packages:t,initialIndex:s,isYearly:n,onActiveIndexChange:a,onRegisterScroll:r})=>{const[o,l]=xr({loop:!1,align:"center",startIndex:s});return i.useEffect(()=>{if(!l)return;const c=()=>{const u=l.selectedScrollSnap();a?.(u)};return l.on("select",c),()=>{l.off("select",c)}},[l,a]),i.useEffect(()=>{l&&r&&r(c=>l.scrollTo(c))},[l,r]),e.jsx("div",{className:"overflow-y-auto",children:e.jsx(ts.Viewport,{ref:o,slideSize:"100%",slideSpacing:"400",children:e.jsx(ts.Container,{children:t.map(c=>e.jsx(ts.Slide,{className:"msui-cs-pointer",children:e.jsx(Q,{paddingInline:"500",paddingBlock:"600",children:e.jsx(D,{gap:"200",children:e.jsx(Jb,{plan:c,isYearly:n})})})},c.key))})})})},ty=({isAtOnboarding:t,onChoosePlan:s})=>{const{t:n}=J(),r=de().getCurrentPlan("PH"),[o]=be(Gt),{getCurrentCyclePlan:l,hasCurrentPlanActive:c,getCurrentFulfillmentPlan:u}=zt(),d=u("PH"),g=l("PH"),h=o==="yearly",p=i.useMemo(()=>t?[...Js.filter(B=>B.key!=="FREE_CREDIT_TIER_PH")]:Js,[t,Js]),x=i.useMemo(()=>[...Js],[Js]),[f,_]=i.useState(""),[b,v]=i.useState(!1),[y,C]=i.useState(0),[S,j]=i.useState(""),[A,E]=i.useState(0),T=i.useRef(null),k=i.useMemo(()=>p.find(B=>B.key===f)||p[0],[p,f]),O=i.useMemo(()=>x.find(B=>B.key===S)||x[y],[x,S,y]),R=i.useCallback((B,ie)=>{const V=c(B,"PH");let M=!1;return V&&B==="FREE_CREDIT_TIER_PH"?M=!t:o==="monthly"?M=g===30&&V:M=g===365&&V,M?n("YouAreHere"):`${n("Choose")} ${ie?.toUpperCase()}`},[c,t,o,g,d,n]);i.useEffect(()=>{if(!f&&x.length>0){const B=p.find(ie=>c(ie.key,"PH"));_(B?.key??p[0]?.key??"")}},[x,f]);const P=i.useCallback(B=>{k&&s({keyPlan:k.key,isYearly:h,isTrial:B,isRechargePlan:!1})},[h,s,k]),w=i.useCallback(()=>{O&&s({keyPlan:O.key,isYearly:h,isTrial:!1,isRechargePlan:!1})},[O,h,s]),N=i.useCallback(()=>{O&&s({keyPlan:O.key,isYearly:!0,isTrial:!1,isRechargePlan:!1})},[O,s]),K=i.useCallback(()=>{O&&s({keyPlan:O.key,isYearly:!1,isTrial:!1,isRechargePlan:!1})},[O,s]),L=i.useCallback(B=>{const ie=x[B];C(B),j(ie?.key??""),E(B),v(!0),window.scrollTo({top:0,behavior:"smooth"})},[x]),W=i.useCallback(B=>{const ie=x[B];ie&&j(ie.key),E(B)},[x]),H=()=>b?e.jsx(ey,{packages:x,initialIndex:y,isYearly:h,onActiveIndexChange:W,onRegisterScroll:B=>{T.current=B}}):e.jsx(e.Fragment,{}),Z=()=>e.jsxs(D,{gap:"400",children:[e.jsx(Q,{paddingInline:"400",paddingBlockStart:"400",children:e.jsx(En,{disabled:r.provider_payment==="PADDLE_BILLING"&&r?.package?.cycle===365})}),e.jsx($e,{}),e.jsx(Q,{paddingInline:"400",children:e.jsxs(D,{gap:"500",children:[p.map(B=>{const ie=B.key===(k?.key||p[0]?.key);return e.jsx(Xb,{plan:B,isSelected:ie,isYearly:h,onSelect:()=>_(B.key),onViewFeatures:()=>L(x.findIndex(V=>V.key===B.key))},B.key)}),te()]})})]}),te=()=>b?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"flex items-center justify-center gap-1 py-2",children:[e.jsx(Q,{children:e.jsx(ee,{source:xi})}),e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:["Not ready to commit?"," ",e.jsx("span",{onClick:()=>L(0),className:"underline",children:"Start with Free plan"})]})]}),ne=()=>O?.key==="FREE_CREDIT_TIER_PH"?e.jsxs(re,{onClick:w,fullWidth:!0,disabled:R(O?.key,O?.name)===n("YouAreHere"),children:[n("Choose")," ",O?.name?.toUpperCase()]}):e.jsx(D,{gap:"400",children:e.jsxs(e.Fragment,{children:[(()=>{const B=g===365&&c(O?.key??"","PH");return e.jsxs("button",{type:"button",onClick:N,disabled:B,className:"w-full rounded-lg bg-[#1a1a1a] text-white flex flex-col items-center justify-center gap-1 py-1 px-4 disabled:opacity-40 cursor-pointer disabled:cursor-not-allowed",children:[e.jsx("span",{className:"text-xs font-semibold",children:n("PayYearly")}),B?e.jsx("span",{className:"text-xs opacity-70",children:n("YouAreHere")}):e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsxs("span",{className:"line-through opacity-60",children:["$",Fe(O?.price)]}),e.jsxs("span",{className:"font-semibold",children:["$",Fe(O?.eachYearlyPr
93ice),"/ month"]}),e.jsx("span",{className:"opacity-60",children:"3-month off"})]})]})})(),(()=>{const B=g===30&&c(O?.key??"","PH");return e.jsxs("button",{type:"button",onClick:()=>K(),disabled:B,className:"w-full rounded-lg bg-white text-[#1a1a1a] border border-[#c9cccf] flex flex-col items-center justify-center gap-1 py-1 px-4 disabled:opacity-40 cursor-pointer disabled:cursor-not-allowed",children:[e.jsx("span",{className:"text-xs font-semibold",children:n("PayMonthly")}),B?e.jsx("span",{className:"text-xs opacity-70",children:n("YouAreHere")}):e.jsxs("span",{className:"text-xs opacity-70",children:["$",Fe(O?.price),"/ month"]})]})})()]})}),le=()=>e.jsx(e.Fragment,{children:e.jsx("div",{id:"pricing-action-button",className:"fixed bottom-0 left-0 right-0 bg-white p-4 [&_.Polaris-Button]:h-[44px] w-full",style:{borderTop:"0.5px solid var(--p-color-border)",boxShadow:"0 -4px 20px 0 rgba(0,0,0,0.05)",bottom:"var(--shopify-safe-area-inset-bottom, 0px)"},children:e.jsx(D,{gap:"400",children:e.jsxs(e.Fragment,{children:[e.jsx(Qe,{id:"content-yearly-perks-ah",open:h,children:e.jsx(Q,{padding:"200",borderRadius:"200",background:"bg-surface-success",children:e.jsxs(U,{align:"start",gap:"100",wrap:!1,blockAlign:"start",children:[e.jsx(Q,{children:e.jsx(ee,{tone:"success",source:Je})}),e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"regular",tone:"success",alignment:"center",children:n("3MonthsOffWithYearlyPlus5CreditRewardsAnd05ExtraOnTopups")})]})})}),!b&&e.jsx(re,{onClick:()=>P(!1),fullWidth:!0,variant:"primary",disabled:R(k?.key,k?.name)===n("YouAreHere"),children:R(k?.key,k?.name)})]})})})});return e.jsx("div",{className:"flex flex-col min-h-full bg-[#fff] h-full",style:{paddingBottom:h?t?150:210:150},id:"pricing-ah-page",children:e.jsxs(D,{gap:"400",children:[Z(),le(),e.jsx(xt,{styleContent:{minHeight:"100dvh"},showCloseIcon:!0,visible:b,onClose:()=>v(!1),children:e.jsxs(D,{gap:"400",children:[e.jsx(Q,{}),H(),e.jsx("div",{className:"sticky bottom-0 bg-white",style:{padding:"0 16px 16px"},children:e.jsx(Q,{paddingInline:"400",paddingBlockEnd:"400",children:e.jsxs(D,{gap:"300",children:[e.jsx($b,{total:x.length,current:A,onDotClick:B=>T.current?.(B)}),ne()]})})})]})})]})})},Sl=({open:t,planDowngraded:s,app:n="AO",onConfirm:a,onClose:r,isCancelPlan:o=!1})=>{const l=pt(),{t:c}=J(),{isMobile:u}=xe(),{getCurrentPlan:d}=de(),g=d(n),h=q.head(g?.package?.modules)?.key||"FREE_CREDIT",p=Yt(h),[x,f]=i.useState(s.key),{openChat:_}=Pt();i.useEffect(()=>{s.key&&f(s.key)},[s.key]);const b=()=>{r(),f(s.key)},v=(j,A)=>{x&&a(x,j,A)},y=()=>{b(),l(Y.BILLING_PLAN.PATH)},C={keyPlanDowngrade:s.key,currentKeyPlan:p,selectedPlanKey:x,isCancelPlan:o,isPH:n!=="AO",setSelectedPlanKey:f,onViewAllPlan:y,onConfirm:v},S=()=>e.jsx(sy,{...C});return u?e.jsx(xt,{zIndex:522,title:c("PlanChangeConfirmation"),placement:"right",background:"bg",onClose:b,visible:t,children:S()}):e.jsx(Is,{width:1072,visible:t,onClose:b,children:e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-white border-b border-[#e3e3e3] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:b,className:"p-1.5 hover:bg-[#f7f7f7] rounded-lg transition-colors","aria-label":"Go back",children:e.jsx(Sb,{})}),e.jsx("span",{className:"text-heading-lg font-semibold leading-[24px] tracking-[-0.2px] text-[#303030]",children:c("PlanChangeConfirmation")})]}),e.jsx("button",{className:"px-3 py-1.5 bg-[#e3e3e3] hover:bg-[#d0d0d0] rounded-lg text-[12px] font-[550] text-[#303030] transition-colors max-h-[28px] flex items-center cursor-pointer",onClick:()=>_(),children:c("ContactSupport")})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 bg-[#f1f1f1]",children:S()})]})})},sy=t=>{const{isCancelPlan:s,app:n="AO",currentKeyPlan:a,selectedPlanKey:r,setSelectedPlanKey:o,onViewAllPlan:l,onConfirm:c}=t,{t:u}=J(),{isMobile:d}=xe(),{getCurrentCreditPlan:g,getCurrentPlan:h,getPricingPlan:p}=de(),{getDiscountValue:x}=b0(),{findPlanByKey:f,getNextFulfillmentPlan:_,getNextCyclePlan:b}=zt(),v=h(n),y=p(),C=n==="PH"?y.PH||[]:y?.CREDIT||[],S=v?.package?.cycle===365?"yearly":"monthly",j=ke(Gt),E=v?.status==="CANCELLED"?"FREE_CREDIT":_(n)?.key,T=b(n),k=!!(E&&r&&Yt(r)===Yt(E)),O=k&&T===365,R=k&&T===30,P=i.useMemo(()=>n==="PH"?[...C].sort((z,me)=>(z.price||0)-(me.price||0)):[...C].filter(z=>z.key!=="ENTERPRISE_CREDIT_TIER").sort((z,me)=>(z.price||0)-(me.price||0)),[C,n]),w=r&&Yt(r)===Yt(a)&&j===S,K=P.find(z=>
93z.key===r)?.price||0,L=qt(K,tt).eachYearlyPrice,W=S==="yearly",H=!!w&&W,Z=!!w&&!W,te=n!=="PH"&&r?f(r,n):void 0,ne=te?x(te,j).couponCode:void 0,le=z=>z===-1?u("Unlimited"):Fe(z||0),B=(z,me=!1)=>{if(me){const De=v?.package?.features||{};return{products:le(De.PRODUCT_LISTING?.limit),orders:le(De.ORDER_FULFILLMENT?.limit)}}const Be=C.find(De=>De.key===z)?.features||{};return{products:le(Be.PRODUCT_LISTING),orders:le(Be.ORDER_FULFILLMENT)}},ie=()=>e.jsxs("div",{className:"bg-white rounded-[10px] p-5 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[14px] font-[650] leading-[20px] text-[#303030]",children:u("SelectAPlan")}),e.jsxs("button",{onClick:l,className:"flex items-center gap-1 text-[12px] font-[450] text-[#005bd3] hover:underline",children:[u("ViewAllPlan"),e.jsx(Ab,{})]})]}),e.jsx("div",{className:"flex flex-col gap-3",children:P.map((z,me)=>{const Re=z.key===r,Be=Yt(z.key)===Yt(a||""),De=!!(E&&Yt(z.key)===Yt(E)),ot=u(j==="yearly"?"Yearly":"Month"),ve=s&&!Be&&me!==0,pe=j==="yearly"?qt(z.price||0,tt).yearlyPrice:z.price||0;if(n==="PH")return e.jsx(Rc,{isSelected:Re,isCurrent:Be,isScheduled:De,name:q.upperFirst(z.name),displayPrice:pe,priceSuffix:`/${ot.toLowerCase()}`,onClick:()=>o(z.key),disabled:ve,alignStart:!0,pills:e.jsxs(Mr,{children:[Be?g(a,!0,n):g(z.key,!1,n)," ",u("AICredits")]})},z.key);const{discountPrice:ze,couponCode:Ge}=x(z,j),lt=B(z.key,Be);return e.jsx(Rc,{isSelected:Re,isCurrent:Be,isScheduled:De,name:q.upperFirst(z.name),displayPrice:pe,discountPrice:j==="monthly"&&Ge?ze:void 0,priceSuffix:`/${ot.toLowerCase()}`,onClick:()=>o(z.key),alignStart:!0,disabled:ve,pills:e.jsxs(e.Fragment,{children:[e.jsxs(Mr,{children:[Be?g(a,!0):g(Yt(z.key))," ",u("AICredits")]}),e.jsxs(Mr,{children:[lt.products," ",u("Products").toLowerCase()]}),e.jsxs(Mr,{children:[lt.orders," ",u("Orders").toLowerCase()]})]})},z.key)})})]}),V=(z,me)=>e.jsx("div",{className:oe("w-full h-11 rounded-lg flex items-center justify-center cursor-no-drop border border-[#e3e3e3]",me?"bg-[#303030] opacity-60":"bg-white"),children:e.jsx("span",{className:oe("text-[13px]",me?"text-white":"text-[#616161]"),children:z})}),M=z=>V(u("YouAreHere"),z),I=()=>e.jsx("div",{className:"w-full h-11 rounded-lg flex items-center justify-center cursor-no-drop bg-[#ffe9d0] border border-[#ffd8a8]",children:e.jsx("span",{className:"text-[13px] font-[650] text-[#8a5300]",children:u("Scheduled")})}),F=()=>K===0?w?M():k?I():e.jsx("button",{onClick:()=>n==="PH"?c():c(te?ne:void 0),className:"w-full h-11 rounded-lg bg-[#303030] flex items-center justify-center px-3",children:e.jsx("span",{className:"text-[13px] font-[650] text-white leading-[20px]",children:u("ChoosePlan")})}):e.jsxs(e.Fragment,{children:[H?M(!0):O?I():e.jsxs("button",{onClick:()=>{c(n==="PH"?void 0:te?ne:void 0,"yearly")},className:"w-full h-11 rounded-lg bg-[#303030] flex flex-col items-center justify-center gap-0.5 px-3 hover:shadow-300 cursor-pointer",children:[e.jsx("span",{className:"text-[11px] leading-[12px] text-white/70",children:"Pay yearly"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-[10px] text-[#b5b5b5] line-through",children:["$",K]}),e.jsxs("span",{className:"text-[13px] font-[650] text-white leading-[20px]",children:["$",L,"/month"]}),e.jsx("span",{className:"text-[10px] text-[#b5b5b5]",children:u("3monthOff")})]})]}),Z?M():R?I():e.jsxs("button",{onClick:()=>{c(n==="PH"?void 0:te?ne:void 0,"monthly")},className:"w-full h-11 rounded-lg bg-white border border-[#e3e3e3] flex flex-col items-center justify-center gap-0.5 px-3 hover:shadow-100 cursor-pointer",children:[e.jsx("span",{className:"text-[11px] leading-[12px] text-[#616161]",children:u("PayMonthly")}),e.jsxs("span",{className:"text-[13px] font-[650] text-[#303030] leading-[20px]",children:["$",K,"/month"]})]})]}),G=(z=!1)=>e.jsxs("div",{className:oe("bg-white rounded-xl flex flex-col",z?"":"overflow-hidden h-full"),children:[e.jsx("div",{className:oe("p-4",z?"":"flex-1 overflow-y-auto"),children:n==="PH"?e.jsx(Zp,{planKey:r||""}):e.jsx(qp,{planKey:r||""})}),!d&&e.jsxs("div",{className:"p-4 flex flex-col gap-3",children:[e.jsx("div",{className:"h-px bg-[#e3e3e3]"}),e.jsx(Mc,{app:n}
93),F()]})]});return d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 bg-[#f1f1f1] flex flex-col gap-4 pb-[180px]",children:[e.jsx(Lc,{}),ie(),G(!0)]}),e.jsxs("div",{className:"fixed bottom-0 left-0 right-0 p-4 bg-white border-t border-[#e3e3e3] flex flex-col gap-2",style:{bottom:"var(--shopify-safe-area-inset-bottom, 0px)"},children:[e.jsx(Mc,{app:n}),F()]})]}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(Lc,{}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{style:{flexBasis:"58%",flexShrink:0},children:ie()}),e.jsx("div",{className:"flex-1 min-w-0",children:G()})]})]})},Lc=()=>{const{t}=J();return e.jsx("div",{children:e.jsx(Q,{padding:"200",borderRadius:"200",background:"bg-surface-warning",children:e.jsxs(U,{blockAlign:"center",gap:"200",wrap:!1,children:[e.jsx(Q,{children:e.jsx(ee,{source:hr})})," ",e.jsx(m,{as:"p",variant:"bodyMd",tone:"caution",children:t("HeadsUpYoureAboutToLoseAccessToAdvancedFeaturesAndYourUsageQuotaWillBeReduced")})]})})})},Mc=({app:t="AO"})=>{const{t:s}=J(),{getCurrentPlan:n}=de(),a=n(t),r=a?.next_package,o=a?.status==="CANCELLED";if(!(o||!!(r&&q.size(r))))return null;const c=!o&&r?.cycle?` (${r.cycle===365?"yearly":"monthly"})`:"",u=`${(o?"Free":r?.name||"Free")?.toUpperCase()}${c}`,d=it(a?.next_billing_time).format("MMM DD, YYYY");return e.jsx("div",{children:e.jsx(Q,{padding:"200",borderRadius:"200",background:"bg-surface-warning",borderColor:"border-warning",borderWidth:"025",children:e.jsxs(U,{blockAlign:"center",gap:"200",wrap:!1,children:[e.jsx(Q,{children:e.jsx(ee,{source:hr})})," ",e.jsx(m,{as:"span",variant:"bodySm",tone:"caution",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s("ContentDowngradePlanTime",{time:d,plan_name:u})}})})]})})})},ny=({open:t,onClose:s,onConfirm:n,app:a})=>{const{getPricingPlan:r}=de(),c=(r()?.[y0[a]]||[])?.find(u=>u.price===0);return e.jsx(Sl,{onClose:s,open:t,planDowngraded:{key:c?.key||"FREE_CREDIT",name:c?.name||"Free"},isCancelPlan:!0,onConfirm:n,app:a})};let Va="",zi="";const un=i.memo(i.forwardRef((t,s)=>{const{onChargeError:n,onPaymentSuccess:a,onUpdateCompleteOnboarding:r,app:o="AO"}=t,l=pt(),{t:c}=J(),{isMobile:u}=xe(),d=Cl(),g=bt(),[h]=ca(),{getCurrentPlan:p,getUserInfo:x,goToMyChannelPage:f,getPricingPlan:_,getIdPlanModule:b,fetchCurrentPlan:v}=de(),{findPlanByKey:y}=zt(),C=dt().getListShop(),S=_(),j=he(Gn),[A,E]=i.useState({}),[T,k]=i.useState(!1),[O,R]=i.useState(!1),P=i.useRef(!1),[w,N]=i.useState(!1),[K,L]=i.useState(null),[W,H]=i.useState(!1),[Z,te]=i.useState(!1),[ne,le]=i.useState(!1),[B,ie]=i.useState(void 0),[V,M]=i.useState(!1),[I,F]=i.useState(!1),[G,z]=i.useState(!1),[me,Re]=i.useState(!1),[Be,De]=i.useState(!1),[ot,ve]=i.useState(!1),[pe,ze]=i.useState(!1),[Ge,lt]=i.useState({}),ue=ke(Gt),ce=i.useRef(null),Ae=i.useRef(null);let _e;Ce.isShopifyEmbedded()&&(_e=Wn());const Pe=p(o),Ne=Pe?.package,rt=x(),{store_id:ye}=Pe,Ie=i.useRef(null),Ue=i.useRef(!1),ht=i.useRef(null),Dt=Ne?.name||"",Ft=Ne?.price||0,as=Ne?.cycle||30;i.useImperativeHandle(s,()=>({onConfirmCharge:async we=>{const{data:We,isYearly:mt,isTrial:Kt=!1,isRechargePlan:Wt=!1,isChargeOneTime:ps=!1,couponCode:Ds,confirmDowngraded:Qs=!1}=we;if(!((!We||!We.id)&&!ps)){if(!rt.has_shop){f();return}if(H(ps),le(Kt),M(Wt),Ue.current=!1,A?.id){if(A.platform==="shopify"&&A.status==="uninstalled"&&o==="AO"){C.find(ma=>ma.platform==="shopify"&&ma.status==="active")?(We&&L(We),te(mt),ie(Ds),k(!0)):Ae.current?.open();return}if(ps){await yt(A);return}if(!We||!We.id)return;L(We),te(mt),await Bt({storeCharge:A,datapayment:We,is_yearly:mt,is_trial:Kt,is_recharge_plan:Wt,coupon_code:Ds,confirm_downgrade:Qs})}else We&&L(We),te(mt),ie(Ds),k(!0)}},onChangeStorePayment:async we=>{Ue.current=!0,we?(await At(we),Re(!1)):k(!0)}}));const fs=()=>{De(!1),Jt()},Jt=async()=>{ve(!0);const{status:we,message:We,data:mt}=await ls.cancelCurrentPlan({app:o});if(ve(!1),we===fe.FIRST_CYCLE_DOWNGRADE_FAILED&&We==="FIRST_CYCLE_DOWNGRADE_FAILED"&&F(!0),we===fe.OK){u?d.success({message:c("CancelSuccessfully")}):g.success(c("CancelSuccessfully")),v(),j(!1),l(Y.BILLING_PLAN.PATH);return}else{const Kt=mt?.error_code||"";Kt&&n(Kt)}},Le=async(we,We,mt)=>{const Kt=y(we,o);!Kt||!A?.id||(z(!1),R(!0),N(!0),await Bt({storeCharge:A,datapayment:Kt,is_yearly:mt?mt==="yearly":ue==="yearly",confirm_downgrade:!0,coupon_code:We}))},Ye=(we,We,mt)=>{if(we==="FREE_CREDIT"||we==="FREE_CREDIT_TIER_PH"||we.includes("FREE")){z(!1),fs();return}const Wt=K?.key||"";if(we&&we!==Wt||we&&we===Wt&&mt&&ue!==mt){Le(we,We,mt);return}if(Ie?.current){z(!1),R(!0),N(!0),qe(Ie.current);return}ht.current&&(z(!1),R(!0),N(!0),Bt({...ht.current,confirm_downgrade:!0,is_yearly:ue==="yearly"}))},qe=we=>{if(!we)return!1;_e?_e(we):window.location.href=we},At=async we=>{R(!0);try{const{status:We,data:mt}=await ls.changePaymentMethod({provider_payment:Pe?.provider_payment||"SHOPIFY",store_id:we}),Kt=mt?.error_code||"";if(Kt&&We!==fe.OK){n(Kt),R(!1);return}N(!0),We===fe.OK&&mt?.confirmation_url&&qe(mt?.confirmation_url)}finally{}},yt=async(we=A)=>{const We={app:o,store_id:we?.id,provider_payment:"SHOPIFY",feature_id:"EXPERT_CARE_SERVICE",is_one_time_charge:!0};(C.some(Qs=>Qs.id===we.id&&Qs.platform!=="shopify")&&!Ce.isShopifyEmbedded()||Pe?.provider_payment==="PADDLE_BILLING"||o==="PH")&&(We.provider_payment="PADDLE_BILLING");const{status:Kt,data:Wt}=await ls.chargeOneTime(We),ps=Wt?.pay_id||"",Ds=Wt?.error_code||"";if(Kt===fe.OK){if(Wt?.confirmation_url||We.provider_payment==="PADDLE_BILLING"){if(N(!0),Wt.confirmation_url)qe(Wt.confirmation_url);else{if(ps)ce.current?.openCheckout({transactionId:Wt?.pay_id||"",payment_callback:Wt?.payment_callback});else if(Wt?.payment_callback){v(),j(!1);const Qs=new URL(Wt.payment_callback);l(Y.HOME_PAGE.PATH+Qs.search,{replace:!0})}N(!1),R(!1)}Tt()}}else{if(N(!1),R(!1),Kt===fe.BAD_REQUEST&&Ds==="be_payment_cannot_change_your_subscription"&&q.size(Wt)){Va=Wt.message_params,n("be_payment_cannot_change_your_subscription");return}if(Kt===fe.BAD_REQUEST&&Ds==="be_payment_downgrade_failed"){n("PaymentFailedDowngradeFailed");return}if(Ds){n(Ds);return}n("PaymentFail")}},Bt=async we=>{r&&r();const{storeCharge:We,datapayment:mt,is_yearly:Kt,confirm_downgrade:Wt=!1,is_trial:ps=!1,is_recharge_plan:Ds,coupon_code:Qs}=we;try{if(!at.size(S)||!We?.id||!mt)return;
93if(mt.key==="FREE_CREDIT"||mt.key?.includes("FREE")){z(!0),zi="FREE_CREDIT";return}Va="",ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].remove(st.PAYMENT_INFO);const Pr=y(mt.key,o);P.current&&Dn("checkout_open",p(),{checkout_plan:Dt,checkout_value:Pr?.price});const Ir=C.some(jt=>jt.id===We.id&&jt.platform==="shopify"),ma=C.some(jt=>jt.id===We.id&&jt.platform!=="shopify"),Ni=C.some(jt=>jt.platform!=="shopify");if(!Ir&&!Ni){n("TheStoreNoLongerExists");return}R(!0);let Ga=[];for(const jt in S)Ga=Ga.concat(S[jt]);let kn=!1,Ee=[],ct=[];const St={name:"",price:0};mt.key&&(Ee=at.uniq([mt?.key]),kn=!!Kt);const Qt=b();if(Ge&&Ge.id&&Qt&&Qt.id){const jt=Ge?.modules?.CREDIT?.id;if(!jt)return;ct=[jt],kn=Ge?.cycle===365}const Ls=Ga.filter(jt=>Ee.some(fn=>q.startsWith(jt.key,fn)));if(Ls.length){let jt="";Ls.forEach((fn,h0)=>{const g0=12-(tt[fn.key]||0);St.price+=fn.price*(kn?g0:1);let Oi=fn.name;ct.push(fn.id),fn.key==="AO_ADD_ON_PRODUCT_DISCOVERY"&&(Oi=c("ProductInsights")),h0===0?jt+=`${Oi} (${kn?c("Yearly").toLocaleLowerCase():c("Monthly").toLocaleLowerCase()})`:jt+=` + ${Oi} (${kn?c("Yearly").toLocaleLowerCase():c("Monthly").toLocaleLowerCase()})`}),St.name=jt}if(!ct.length)return R(!1),n("CurrentPackageNotSupport"),!1;const $t={app:o,coupon_code:Qs,store_id:We?.id,provider_payment:"SHOPIFY",module_ids:ct,is_yearly:kn,confirm_downgrade:Wt,trial:ps};Ds&&(delete $t.module_ids,delete $t.trial,$t.package_id=Ne?.id+"",rt?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE"&&($t.is_back_to_recurring=!0)),Ge?.id&&(delete $t.module_ids,$t.package_id=Ge?.id+""),(ma&&!Ce.isShopifyEmbedded()||Pe?.provider_payment==="PADDLE_BILLING"||o==="PH")&&($t.provider_payment="PADDLE_BILLING");const{status:Ms,data:It}=await ls.chargeSubscription({params:$t}),xs=It?.pay_id||"",_s=It?.error_code||"";if(Ms===fe.FIRST_CYCLE_DOWNGRADE_FAILED&&(It?.message_params==="FIRST_CYCLE_DOWNGRADE_FAILED"||_s==="FIRST_CYCLE_DOWNGRADE_FAILED")){N(!1),R(!1),F(!0);return}if(Ms===fe.QUOTA_EXPIRED)return It?.feature_id==="COST_CHANGE_MANAGEMENT"&&(Va="CostChange"),N(!1),R(!1),Va&&n("CannotDowngradePlan"),!1;if(Ms===fe.OK){if(It?.is_refresh_page){et({direction_of_change:St.price>(Ne?.price||0)?"Upgrade":"Downgrade",old_plan_name:Ne?.name??"",old_plan_value:Ne?.price??0,new_plan_name:St.name,new_plan_value:St.price});const jt={name:St.name,price:St.price.toFixed(2),old_name:Ne?.name??"",old_price:Ne?.price??0,start_time:it()};ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify(jt)),window.location.reload();return}if(It?.confirmation_url||$t.provider_payment==="PADDLE_BILLING"){et({direction_of_change:St.price>(Ne?.price||0)?"Upgrade":"Downgrade",old_plan_name:Ne?.name??"",old_plan_value:Ne?.price??0,new_plan_name:St.name,new_plan_value:St.price}),N(!0),zi=St.name;const jt={name:St.name,price:St.price.toFixed(2),old_name:Ne?.name??"",old_price:Ne?.price??0,start_time:it()};if(ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify(jt)),It?.apply_on_next_billing_cycle)$t.provider_payment==="PADDLE_BILLING"?(ht.current=we,Ie.current=null):(Ie.current=It?.confirmation_url||null,ht.current=null),z(!0),R(!1);else{if(It?.confirmation_url)qe(It?.confirmation_url);else{if(xs)ce.current?.openCheckout({transactionId:It?.pay_id||"",payment_callback:It?.payment_callback||""});else if(It?.payment_callback){v(),j(!1);const fn=new URL(It.payment_callback);l(Y.HOME_PAGE.PATH+fn.search,{replace:!0})}N(!1),R(!1)}Tt()}}}else{if(N(!1),R(!1),Ms===fe.BAD_REQUEST&&_s==="be_payment_cannot_change_your_subscription"&&q.size(It)){Va=It?.message_params||"",n("be_payment_cannot_change_your_subscription");return}if(Ms===fe.BAD_REQUEST&&_s==="be_payment_downgrade_failed"){n("PaymentFailedDowngradeFailed");return}if(_s){n(_s);return}n("PaymentFail")}}finally{}},Tt=i.useCallback(()=>{Ie.current=null,ht.current=null},[]),et=we=>{Dn("subscription_changed",p(),we)},rs=async we=>{if(we){if(Re(!0),k(!1),A?.id&&we!==A?.id&&(A.status==="active"||Ue.current)){await At(we),Re(!1);return}const We=C.find(mt=>mt.id===we);We&&(E(We),P.current=!0,W?await yt(We):Ge?.id&&Ge?.modules?.CREDIT?await Bt({storeCharge:We,datapayment:Ge?.modules?.CREDIT,is_yearly:Z,is_trial:ne,is_recharge_plan:V}):await Bt({storeCharge:We,datapayment:K,is_yearly:Z,is_trial:ne,is_recharge_plan:V,coupon_code:B}),setTimeout(()=>{Re(!1)},1e3))}},Ns=async()=>
93{ze(!1),A?.id&&Ge.id&&Ge?.modules?.CREDIT?(te(Z),await Bt({storeCharge:A,datapayment:Ge?.modules?.CREDIT,is_yearly:Ge?.cycle===365,is_recharge_plan:V})):(te(Z),k(!0))},Os=async we=>{const{data:We}=await ls.getCustomPlanPackage(we);if(We?.package){ze(!0),lt({id:We.package?.id,name:We.package?.modules?.CREDIT?.name||"",price:We.package?.price||0,cycle:We.package?.cycle||30,modules:We.package?.modules||{}});return}u?d.error({message:c("PackageNotFound")}):g.error(c("PackageNotFound"))};return i.useEffect(()=>{if(C.length!==0){if(ye){const we=C.find(We=>We.id===ye);if(we)E(we);else{const We=C.find(mt=>mt.is_default);We&&E(We)}}else if(!Ce.isShopifyEmbedded()){const we=C.find(We=>We.is_default);if(we)E(we);else{const We=C.find(mt=>mt.platform!=="shopify");E(We||C[0])}}}},[ye,C,o]),i.useEffect(()=>{const we=h.get("package_id")||"";we&&!window.zopi_first_load_custom_plan&&(window.zopi_first_load_custom_plan=!0,Os(we))},[]),e.jsxs(e.Fragment,{children:[e.jsx(Al,{isRedirecting:w,open:O||ot}),e.jsx(vl,{open:I,onClose:()=>F(!1)}),e.jsx(yr,{data:{storeCharge:A},open:T,onConfirm:rs,onClose:()=>{k(!1),ie(void 0)},loading:me}),e.jsx(ny,{app:o,open:Be,onClose:()=>De(!1),onConfirm:Ye}),e.jsx(Sl,{open:G,planDowngraded:{name:zi,key:K?.key},onClose:()=>{Tt(),z(!1)},onConfirm:Ye,app:o}),e.jsx(Cb,{data:{currentPackage:{name:Dt,price:Ft,cycle:as},customPackage:Ge},open:pe,onCharge:Ns,onClose:()=>ze(!1)}),e.jsx(ub,{onPaymentSuccess:a,ref:ce}),e.jsx(pb,{ref:Ae})]})})),ay=se.div` 94 .Polaris-Page.Polaris-Page--fullWidth:first-child { 95 & .Polaris-Box { 96 position: sticky !important; 97 top: 0; 98 z-index: 199; 99 background-color: #f6f6f7; 100 } 101 } 102 &.bg-white { 103 .Polaris-Page.Polaris-Page--fullWidth:first-child { 104 & .Polaris-Box { 105 background-color: #fff; 106 } 107 } 108 } 109`;se.div` 110 .hover-bg-grey { 111 padding: var(--p-space-150); 112 border-radius: 8px; 113 cursor: pointer; 114 &:hover, 115 &.active { 116 background: var(--p-color-bg-surface-hover); 117 } 118 } 119`;const $n=({keyword:t,text:s})=>{if(!t)return e.jsx("span",{dangerouslySetInnerHTML:{__html:s}});const n=new RegExp(`(${t})`,"gi"),a=s.split(n);return e.jsx(e.Fragment,{children:a.map((r,o)=>r.toLowerCase()===t.toLowerCase()?e.jsx("mark",{style:{backgroundColor:"#EAF4FF",padding:"2px 0px"},children:r},o):e.jsx("span",{dangerouslySetInnerHTML:{__html:r}},o))})},ry=(t,s)=>t===s?!1:!!(t==="STARTER_CREDIT_TIER"&&["GROWTH_CREDIT_TIER","PRO_CREDIT_TIER"].includes(s)||t==="GROWTH_CREDIT_TIER"&&["PRO_CREDIT_TIER"].includes(s)),Uc=t=>{const{listKey:s,currentPlanKey:n,handleCharge:a}=t,{t:r}=J(),o=de();Pt();const{features:l,packages:c,freePackage:u}=Ks(),d=[u,...c].findIndex(B=>B.key===s[0]),g=[u,...c].findIndex(B=>B.key===s[1]),[h,p]=i.useState(!0),[x,f]=i.useState(!1),[_,b]=i.useState(0),[v,y]=i.useState(0),C=i.useRef(null),S=i.useRef(null),j=i.useRef(null),A=n?.includes("STARTER_CREDIT_TIER")?"STARTER_CREDIT_TIER":n;[u,...c].find(B=>B.key===A);const E=o.getCurrentPlan(),T=o.getUserInfo(),k=E?.package?.cycle===365,{isMobile:O}=xe(),R=s.filter((B,ie)=>O?x?ie===0:ie===1:!0),P=i.useMemo(()=>[u,...c].filter(B=>R.includes(B.key)).sort((B,ie)=>B.price-ie.price),[c,R]),N=ke(In).keyFeature;let K;N&&Object.keys($a).includes(N)&&(K=$a[N]),i.useLayoutEffect(()=>{b(S.current?.offsetHeight||0),y(j.current?.offsetWidth||0)},[]);const L=B=>{B.target.scrollLeft>0?B.target.querySelectorAll("tr td:first-child, tr th:first-child").forEach(V=>{V.classList.add("border-right")}):B.target.querySelectorAll("tr td:first-child, tr th:first-child").forEach(V=>{V.classList.remove("border-right")}),S.current&&(S.current.scrollLeft=B.target.scrollLeft)},W=B=>B.key==="FREE_CREDIT"?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",B.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):B.key==="ENTERPRISE_CREDIT_TIER"?e.jsx(e.Fragment,{children:e.jsx(m,{as:"h1",variant:"headingMd",children:r("Custom")})}):k?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"span",variant:"headingMd",children:["$",B.eachYearlyPrice]}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"disabled",textDecorationLine:"line-through",children:["$",B.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",B.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]});function H(B){if(!h||B.length===0)return!1;const ie=B[0]?.value||"";return B.every(V=>V.value===ie)}const Z=(B,ie)=>B.map(V=>{const M=V.content.filter(I=>{const F=I.title.toLowerCase().includes(ie.toLowerCase()),G=(I.tooltip||"").toLowerCase().includes(ie.toLowerCase());return F||G});return{...V,content:M.filter(I=>!H(I.columns))}}),te=()=>{const B=l.map(V=>{const M=V.content.map(I=>{const F=I.columns.filter((G,z)=>[d,g].includes(z));return{...I,columns:F}});return{...V,content:M}}),ie=Z(B,"").filter(V=>V.content.length>0);return e.jsxs(Fc,{style:{marginTop:-_},children:[e.jsx("thead",{children:e.jsxs("tr",{className:"opacity-0",children:[e.jsx(Br,{ref:j,className:"sticky! left-0 top-[0px]! z-11! min-w-[170px]",children:O?e.jsx("label",{htmlFor:"switch-change-current-plan",children:e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Jn,{id:"switch-change-current-plan",checked:x,onChange:()=>{f(!x)}}),e.jsx(m,{as:"span",tone:"subdued",variant:"bodyMd",children:"Show current plan"})]})}):e.jsx("label",{htmlFor:"switch-change-different-plan",children:e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Jn,{id:"switch-change-different-plan",checked:h,onChange:()=>{p(!h)}}),e.jsx(m,{as:"span",tone:"subdued",variant:"bodyMd",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:r("ShowLOCKEDFeaturesOnly")}})})]})})}),P.map((V,M)=>e.jsx(Br,{className:oe("fixed top-[0px]! bg-white z-10!",M===1?"border-2 border-blue-500 rounded-t-xl":""),children:e.jsx(U,{align:"center",children:e.jsx(Q,{paddingBlock:"400",children:e.jsxs(D,{gap:"200",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodySm",alignment:"center",children:V.name}),e.jsx(U,{gap:"050",wrap:!1,children:W(V)})]}),e.jsx(Q,{width:"150px",children:V.key===s[0]?e.jsx(Lt,{fullWidth:!0,onClick:()=>{},disabled:!0,children:r("YouAreHere")}):s[1]==="ENTERPRISE_CREDIT_TIER"?e.jsx(Lt,{fullWidth:!0,onClick:()=>{a(V,k)},children:r("ChooseThisPlan")}):e.jsx(Lt,{fullWidth:!0,onClick:()=>{a(V,k)},variant:"primary",children:r("ChooseThisPlan")})})]})})})},M))]})}),O?e.jsx("tbody",{children:ie.map((V,M)=>e.jsxs(e.Fragment,{children:[V.content.length>0&&e.jsxs(Bc,{children:[e.jsx("td",{className:"sticky left-0",children:e.jsx("div",{className:"inline-flex",children:e.jsx(m,{as:"h1",variant:"bodySm",fontWeight:"semibold",children:r(V.title)})})}),P.map((I,F)=>e.jsx("td",{className:F===1?"border-x-2 border-blue-500":""},I.key))]}),V.content.map((I,F)=>e.jsxs("tr",{className:"group",children:[e.jsx(Hr,{isFeatureTitle:!0,className:oe("group-hover:bg-[#F7F7F7]"),children:e.jsx("div",{className:"",children:I.tooltip?e.jsx(nr,{content:r(I.tooltip),preferredPosition:"above",hasUnderline:!0,children:e.jsx("span",{className:"cursor-pointer",children:e.jsx(m,{as:"span",variant:"bodySm",tone
119:"subdued",children:e.jsx($n,{keyword:"",text:r(I.title)})})})}):e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:e.jsx($n,{keyword:"",text:r(I.title)})})})}),I.columns.map((G,z)=>{const me=M===ie.length-1;return x&&z===1?e.jsx(e.Fragment,{}):!x&&z===0?e.jsx(e.Fragment,{}):e.jsx(Hr,{className:oe("group-hover:bg-[#F7F7F7]",me&&F===V.content.length-1&&"border-transparent!"),align:"center",children:le(G.value,G.subtitle,G.subtitleSmall,G.subfixValue)},`${I.title}-${z}`)})]},I.title))]},M))}):e.jsx("tbody",{children:ie.map((V,M)=>e.jsxs(e.Fragment,{children:[V.content.length>0&&e.jsxs(Bc,{children:[e.jsx("td",{className:"sticky left-0",children:e.jsx("div",{className:"inline-flex",children:e.jsx(m,{as:"h1",variant:"bodySm",fontWeight:"semibold",children:r(V.title)})})}),P.map((I,F)=>e.jsx("td",{className:F===1?"border-x-2 border-blue-500":""},I.key))]}),V.content.map((I,F)=>e.jsxs("tr",{className:"group",children:[e.jsx(Hr,{isFeatureTitle:!0,className:oe("group-hover:bg-[#F7F7F7]"),children:e.jsx("div",{className:"",children:I.tooltip?e.jsx(nr,{content:r(I.tooltip),preferredPosition:"above",hasUnderline:!0,children:e.jsx("span",{className:"cursor-pointer",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:e.jsx($n,{keyword:"",text:r(I.title)})})})}):e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:e.jsx($n,{keyword:"",text:r(I.title)})})})}),I.columns.map((G,z)=>{const me=M===ie.length-1;return e.jsx(Hr,{className:oe("group-hover:bg-[#F7F7F7]",me&&F===V.content.length-1&&"border-transparent!",z===1?"border-l-2 border-r-2 border-blue-500":"",z===1&&me&&F===V.content.length-1?"border-2 border-b-2! border-t-0 border-blue-500! rounded-b-xl":""),align:"center",children:le(G.value,G.subtitle,G.subtitleSmall,G.subfixValue)},`${I.title}-${z}`)})]},I.title))]},M))})]})},ne=()=>e.jsx(ds,{source:Je,tone:"success"}),le=(B,ie,V,M)=>B===""&&ie===""?e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 10.479C5 10.0648 5.33579 9.729 5.75 9.729H14.25C14.6642 9.729 15 10.0648 15 10.479C15 10.8932 14.6642 11.229 14.25 11.229H5.75C5.33579 11.229 5 10.8932 5 10.479Z",fill:"#CCCCCC"})})}):B==="tick"?ne():B===-1?e.jsxs(e.Fragment,{children:[e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:r("Unlimited")})," ",ie&&e.jsx(m,{variant:"bodySm",as:"span",children:r(ie)})]}):ie==="limit_viewable_import"?e.jsx(m,{variant:"bodySm",as:"span",children:r("LimitedImportedProducts",{var_limit:e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:B})})}):e.jsxs(e.Fragment,{children:[e.jsx(m,{variant:"bodySm",as:"span",fontWeight:typeof B=="number"?"semibold":"regular",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:typeof B=="number"?B.toLocaleString("en")+(M||""):r(B)}})})," ",ie&&e.jsx(m,{variant:"bodySm",as:"span",children:ie==="FromMonToFri923"?e.jsx("div",{dangerouslySetInnerHTML:{__html:r(ie)}}):e.jsx("div",{dangerouslySetInnerHTML:{__html:r(ie)}})}),V&&e.jsxs(m,{variant:"bodyXs",tone:"subdued",as:"span",children:["(",r(V),")"]})]});return e.jsxs(nt,{padding:"0",children:[e.jsx("div",{className:"sticky! bg-white left-0 top-[0px]! z-11!",children:e.jsx("div",{ref:S,className:"overflow-x-auto",children:e.jsx(Fc,{children:e.jsx("thead",{children:e.jsxs("tr",{className:"w-full",children:[e.jsx(Br,{className:"align-middle sticky left-0 top-[0px]! z-11!",style:{width:v||"100%"},children:O?e.jsx("label",{htmlFor:"switch-change-current-plan",children:e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Jn,{id:"switch-change-current-plan",checked:x,onChange:()=>{f(!x)}}),e.jsx(m,{as:"span",tone:"subdued",variant:"bodyMd",children:r("ShowCurrentPlan")})]})}):e.jsx("label",{htmlFor:"switch-change-different-plan",children:e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Jn,{id:"switch-change-different-plan",checked:h,onChange:()=>{p(!h)}}),e.jsx(m,{as:"span",tone:"subdued",variant:"bodyMd",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:r("ShowLOCKEDFeaturesOnly")}})})]})})}),P.map((B,ie)=>e.jsx(e.Fragment,{children:e.jsx(Br,{className:oe("fixed top-[0px]! bg-white z-10!",ie===1?"border-2 border-blue-500 rounded-t-xl":""),children:e.jsx(U,{align:"center",children:e.jsx(Q,{paddingBlock:"400",children:e.jsxs(D,{gap:"200",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodySm",alignment:"center",children:B.name}),e.jsx(U,{gap:"050",wrap:!1,children:W(B)})]}),e.jsx(Q,{width:"150px",children:B.key===s[0]&&(T?.pricing_version!=="29"||T?.pricing_version==="29"&&ry(s[0],K||""))?e.jsx(Lt,{fullWidth:!0,onClick:()=>{},disabled:!0,children:r("YouAreHere")}):B.key==="ENTERPRISE_CREDIT_TIER"?e.jsx(Lt,{fullWidth:!0,onClick:()=>{a(B,k)},children:r("ChooseThisPlan")}):e.jsx(Lt,{fullWidth:!0,onClick:()=>{a(B,k)},variant:"primary",children:r("ChooseThisPlan")})})]})})})},ie)},B.key))]})})})})}),e.jsx("div",{className:"mb-4 overflow-x-auto",ref:C,onScroll:L,style:{maxWidth:"100%",fontSize:"13px"},children:te()})]})},Fc=se.table` 120 width: 100%; 121 border-collapse: separate; 122 border-spacing: 0; 123 td, 124 th { 125 &.border-right { 126 border-right: 1px solid #dfe3e8; 127 } 128 } 129`,Br=se.th` 130 text-align: left; 131 border-bottom: 1px solid #dfe3e8; 132 // background: var(--p-color-bg-surface-secondary); 133 background: #fff; 134 position: sticky; 135 top: 0; 136 z-index: 2; 137 padding-left: var(--p-space-400); 138 padding-right: var(--p-space-400); 139`,Hr=se.td` 140 padding: 12px 12px; 141 border-bottom: 1px solid #dfe3e8; 142 // vertical-align: top; 143 text-align: ${({align:t="left"})=>t}; 144 ${t=>t.isFeatureTitle&&` 145 z-index: 1; 146 background: var(--p-color-bg-surface); 147 width: 250px; 148 font-weight: 500; 149 position: sticky; 150 left: 0; 151 `} 152`,Bc=se.tr` 153 background: var(--p-color-bg-surface-secondary); 154 155 td { 156 padding: 8px 12px; 157 border-bottom: 1px solid #dfe3e8; 158 } 159`,Hc={WP_ADD_STORE:["FREE_CREDIT","STARTER_CREDIT_TIER","GROWTH_CREDIT_TIER"],AUTO_TASK_SCHEDULE:["FREE_CREDIT","STARTER_CREDIT_TIER","GROWTH_CREDIT_TIER"],ORDER_TRACKING:["FREE_CREDIT","STARTER_CREDIT_TIER"],WP_ADD_NEW:["FREE_CREDIT","STARTER_CREDIT_TIER"],SETTING_UPDATE_STOCK:["FREE_CREDIT"],AUTO_ORDER_FULFILLMENT:["FREE_CREDIT"],VIEW_INSIGHTS:["FREE_CREDIT"]},$a={WP_ADD_STORE:"PRO_CREDIT_TIER",WP_ADD_NEW:"PRO_CREDIT_TIER",BULK_LISTING_URL:"GROWTH_CREDIT_TIER",BULK_LISTING_FILE:"GROWTH_CREDIT_TIER",PRODUCT_EDIT_CONTENT:"STARTER_CREDIT_TIER",PRODUCT_SPLIT_ADVANCED:"GROWTH_CREDIT_TIER",PRODUCT_SPLIT_BASIC:"STARTER_CREDIT_TIER",AI_PRODUCT_CONTENT:"GROWTH_CREDIT_TIER",AI_PRODUCT_SEO:"STARTER_CREDIT_TIER",AI_FIND_IMAGE_VIDEO:"GROWTH_CREDIT_TIER",AI_IMAGE_THUMB_FORMAT:"GROWTH_CREDIT_TIER",MULTI_PRICING_RULE:"GROWTH_CREDIT_TIER",BULK_UPDATE_STOCK_PRICE:"STARTER_CREDIT_TIER",AUTO_LISTING_ADVANCED:"STARTER_CREDIT_TIER",SETTING_UPDATE_VARIANT_AVAILABLE:"GROWTH_CREDIT_TIER",SETTING_UPDATE_PRODUCT_AVAILABLE:"GROWTH_CREDIT_TIER",SETTING_UPDATE_STOCK:"GROWTH_CREDIT_TIER",SETTING_UPDATE_PRICE:"PRO_CREDIT_TIER",AI_AUTO_BOOST_PRODUCT_SEO:"STARTER_CREDIT_TIER",BULK_ORDER_FULFILLMENT:"STARTER_CREDIT_TIER",AI_ORDER_CORRECT:"STARTER_CREDIT_TIER",ORDER_TRACKING:"STARTER_CREDIT_TIER",ORDER_RECREATE:"GROWTH_CREDIT_TIER",ORDER_CASHBACK:"PRO_CREDIT_TIER",SETTING_UPDATE_PRICE_RANGE:"PRO_CREDIT_TIER",BULK_ORDER_FULFILLMENT_FILE:"BULK_ORDER_FULFILLMENT_FILE",PRODUCT_CATALOG_INSPIRED:"STARTER_CREDIT_TIER"};i.memo(t=>{pt();const{getPricingPlan:s,getCurrentPlan:n}=de(),{t:a}=J(),r=bt();ke(Rn),Pt();const o=de(),{hasPermission:l}=gs(),[c,u]=be(In),[d,g]=i.useState(!1),h=i.useRef(null),[p,x]=i.useState(!1),[f,_]=i.useState(null),[b,v]=i.useState("upgrade"),y=i.useRef(null),C=n(),S=s(),{isMobile:j}=xe(),A=S.CREDIT||[],E=c.keyFeature,T=zs(),k=C?.package?.modules?.[0]?.key||"FREE_CREDIT",O=k?.includes("STARTER_CREDIT_TIER")?"STARTER_CREDIT_TIER":k,R=(C?.total_credit||0)-(C?.total_credit_used||0)-c.total_used<=0;o.getUserInfo();function P(Z,te){return te&&Object.keys($a).includes(te)&&$a[te]!==O?$a[te]||"GROWTH_CREDIT_TIER":["STARTER_CREDIT_TIER","STARTER_CREDIT_TIER_1","STARTER_CREDIT_TIER_2","STARTER_CREDIT_TIER_3"].includes(Z)?"GROWTH_CREDIT_TIER":["GROWTH_CREDIT_TIER"].includes(Z)?"PRO_CREDIT_TIER":["PRO_CREDIT_TIER"].includes(Z)||Z==="ENTERPRISE_CREDIT_TIER"?"ENTERPRISE_CREDIT_TIER":"STARTER_CREDIT_TIER"}const w=()=>{g(!1),setTimeout(()=>{u({keyFeature:"",isFullPlan:!1,total_used:0,feature_used:""})},300)},N=()=>"Higher plan is needed",K=async(Z,te)=>{if(!l([Te.VIEW_ACTION_CHANGE_PLAN])){r.error("You dont have permission to change plan");return}const ne=A.find(le=>le.key===Z?.key);ne&&(x(!0),await y.current?.onConfirmCharge({data:ne,isYearly:te}),setTimeout(()=>{x(!1)},1e3))};i.useEffect(()=>{if(!A.length||!C.account_id)return;const Z=C?.package?.modules?.[0]?.key,te=Z?.includes("STARTER_CREDIT_TIER")?"STARTER_CREDIT_TIER":Z,le=A.find(V=>V.key===te)?.key||"";let B=P(le,E);["AI_PRODUCT_CONTENT","AI_FIND_IMAGE_BETTER","AI_FIND_IMAGE_RELATE","AI_FIND_IMAGE_VIDEO","AI_IMAGE_THUMB_BASIC","AI_IMAGE_GENERATION","AI_PRODUCT_WRITING","AI_PRODUCT_SEO","AI_POD_IMAGE"].includes(E)&&R&&(B=P(le));const ie=A.find(V=>V.key===B);ie&&_(ie)},[C,A,E]),i.useEffect(()=>{E&&g(!0)},[E]),i.useEffect(()=>{E&&(()=>{Ke.trackingEventUsersAction({event_name:$.SUBSCRIPTION_UPGRADE_PLAN_VIEWED,event_data:{feature_name:E,page:c.locationShowUpgrade||""}})})()},[E,c.locationShowUpgrade]),i.useEffect(()=>{w()},[T.pathname]);const L=()=>e.jsx("div",{id:"btn-close-drawer-upgrade-plan",className:"hidden!",onClick:()=>{w()}}),W=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:h,children:[e.jsx(ay,{className:"bg-white",children:e.jsx(Q,{paddingInline:"300",shadow:"100",children:e.jsx(us,{fullWidth:!0,title:N(),backAction:{onAction:w}})})}),e.jsx($e,{}),e.jsx(Q,{padding:"400",paddingBlockStart:j?"100":"400",children:e.jsx(Uc,{currentPlanKey:O,handleCharge:K,listKey:[O,f?.key||"FREE_CREDIT"]})})]}),e.jsx(un,{onChargeError:()=>{},ref:y,app:"AO"}),L()]}),H=()=>e.jsxs(e.Fragment,{children:[e.jsx(Uc,{currentPlanKey:O,handleCharge:K,listKey:[O,f?.key||"FREE_CREDIT"]}),e.jsx(un,{onChargeError:()=>{},ref:y}),L()]});return j?e.jsxs(xt,{title:N(),background:"bg",placement:"right",visible:d,onClose:w,zIndex:176,children:[e.jsx("div",{className:"mb-[140px]",children:H()}),e.jsxs("div",{className:"fixed bottom-0 left-0 right-0 p-4 bg-white border-t border-border flex flex-col gap-2",style:{bottom:"var(--shopify-safe-area-inset-bottom, 0px)"},children:[e.jsx(vn,{variant:"primary",fullWidth:!0,onClick:()=>{K(f,!0)},size:"large",className:"justify-center h-[44px]",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{children:e.jsxs(m,{as:"span",variant:"bodyXs",children:[a("Yearly")," ",a("Plan").toLowerCase()," "]})}),e.jsxs("div",{className:"-mt-0.5",children:[e.jsxs("b",{children:["$",qt(f?.price||0,tt).eachYearlyPr
159ice]}),"/",a("Month").toLowerCase()]})]})}),e.jsx(vn,{fullWidth:!0,onClick:()=>{K(f,!1)},size:"large",className:"justify-center h-[44px]",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{children:e.jsxs(m,{as:"span",variant:"bodyXs",children:[a("Monthly")," ",a("Plan").toLowerCase()," "]})}),e.jsxs("div",{className:"-mt-0.5",children:[e.jsxs("b",{children:["$",f?.price||0]}),"/",a("Month").toLowerCase()]})]})})]})]}):e.jsx(Is,{width:828,zIndex:398,className:"msui-drawer__notification",visible:d,onClose:w,children:W()})});const mw=(t,s,n)=>{if((n?.total_credit||0)===-1)return!1;const r=t*iy(s),o=(n?.total_credit||0)-(n?.total_credit_used||0);return r>o},Ya=(t,s,n)=>{const a=n?.package?.features?.[s]?.limit||0,r=n?.package?.features?.[s]?.usage||0;if(a===-1)return!1;const o=a-r;return t>o},iy=t=>{if(!t)return 0;let s=Di[t]||0;return["PRODUCT_LISTING","PRODUCT_IMPORT"].includes(t)&&(s+=Di.PRODUCT_MANAGED),["WP_STORE_PRODUCT_COPY"].includes(t)&&(s+=Di.PRODUCT_LISTING),s},oy=({plan:t,isShowBanner:s=!1,onClickReChargePlan:n,onClickAllPlan:a,onDismissBanner:r})=>{const{currentModule:o}=t,{checkPermissionFeature:l,getPricingPlan:c,getCurrentPlan:u}=de(),d=u(),{isMobile:g}=xe(),h=o?.key,x=de().getUserInfo(),{t:f}=J(),_=Pt(),v=c()?.CREDIT||[],y=d.remaining_trial_days||0,C=()=>{_.openChat()},S=P=>{if(!P)return f("NotSupported");const w=v.find(N=>N.key===P);return!w||w.order_cashback===0?f("NotSupported"):`${Vt((w?.order_cashback||0)*100)}% order value`},j=P=>{if(!P)return f("NotSupported");const w=v.find(N=>N.key===P);return Hc.ORDER_TRACKING.includes(w?.key||"")?f("NotSupported"):f("FullTrackingInfo")},A=(P,w)=>{if(!(!w||!P))return Fe(d?.package?.features?.[P]?.limit||0)},E=(P,w,N=!1)=>{if(!w)return k(N);const K=v.find(L=>L.key===w);return Hc?.[P]?.includes(K?.key||"")?k(N):f("Unlimited")},T=P=>{if(!P)return"0 credits";const w=d?.main_credit||0;return`${w===-1?"Unlimted":Fe(w)} credits`},k=(P=!1)=>P?e.jsx(Et,{hasUnderline:!0,content:f("DataAndSettingsFromOthersRemainSavedButOnlyThePaymentStoreIsAccessible"),children:e.jsx("span",{children:f("NotSupported")})}):e.jsx("span",{children:f("NotSupported")}),O=[{icon:e.jsx(ee,{source:ms}),content:f("ProductToPush"),current_value:A("PRODUCT_LISTING",h)},{icon:e.jsx(ee,{source:gg}),content:f("AICreditsMonthly"),current_value:T(h)},{icon:e.jsx(ee,{source:is}),content:f("OrdersToFulfill"),current_value:A("ORDER_FULFILLMENT",h)}];S(h)&&O.push({icon:e.jsx(ee,{source:fl}),content:f("OrderCashback"),current_value:S(h)}),l("ORDER_TRACKING")&&j(h)&&O.push({icon:e.jsx(ee,{source:mg}),content:f("OrderTracking"),current_value:j(h)}),l("WP_ADD_STORE")&&O.push({icon:e.jsx(ee,{source:xp}),content:f("Multistore"),current_value:E("WP_ADD_STORE",h,!1)}),l("SETTING_UPDATE_STOCK")&&O.push({icon:e.jsx(ee,{source:ms}),content:f("ProductStock&PriceAutoUpdate"),current_value:E("SETTING_UPDATE_STOCK",h,!1)}),l("AUTO_ORDER_FULFILLMENT")&&O.push({icon:e.jsx(ee,{source:is}),content:f("OrderAutomation"),current_value:E("AUTO_ORDER_FULFILLMENT",h,!1)}),l("VIEW_INSIGHTS")&&O.push({icon:e.jsx(ee,{source:ms}),content:f("ProductMarketInsights"),current_value:E("VIEW_INSIGHTS",h,!1)});const R=()=>e.jsxs(D,{gap:"400",children:[e.jsxs("div",{className:"pb-2",children:[e.jsxs(D,{gap:"0",children:[e.jsxs("div",{className:"p-3",children:[e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsxs(U,{align:"start",gap:"100",blockAlign:"center",children:[e.jsxs(m,{as:"span",variant:"headingLg",fontWeight:"semibold",children:[o?.name??"N/A"," "]}),e.jsx(wt,{children:q.upperFirst(o?.cycle===365?f("Yearly"):f("Monthly"))})]}),e.jsx("div",{style:{width:g?void 0:260},children:e.jsxs(U,{wrap:!1,gap:"100",blockAlign:"center",align:"start",children:[e.jsxs(m,{as:"h1",variant:"heading3xl",fontWeight:"bold",children:["$",o?.price??"N/A"]}),e.jsxs(m,{as:"span",variant:"bodyMd",children:["USD/",o?.cycle===365?f("Year").toLocaleLowerCase():f("Month").toLocaleLowerCase()]})]})})]}),y>0&&e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:f("YourRemainingTrialVarDays",{var_days:y})})]}),e.jsx($e,{})]}),e.jsx("div",{className:"px-4",children:e.jsx(_c,{})})]}),e.jsx("div",{className:"fixed bottom-0 left-0 shadow border border-t border-border w-full z-50 p-4 bg-white",style:{bottom:"var(--shopify-safe-area-inset-bottom, 0px)"},children:e.jsxs(U,{align:"end",gap:"200",wrap:!1,children:[e.jsx(re,{size:"large",fullWidth:!0,onClick:a,children:f("AllPlanOptions")}),e.jsx(re,{size:"large",fullWidth:!0,variant:"primary",onClick:()=>n?.(),children:f("ContinueThisPlan")})]})})]});return e.jsx("div",{className:"mb-4",style:{maxWidth:800},children:e.jsxs(D,{align:"center",gap:g?"400":"500",children:[e.jsxs(D,{gap:"500",align:"center",children:[e.jsx("div",{className:g?"p-4 pb-0":"",children:e.jsx(m,{as:"span",variant:g?"headingXl":"heading3xl",children:f("ChooseYourPreviousPlanToGetStarted")})}),s&&!x?.first_cycle_charge_type&&e.jsx("div",{style:{marginTop:10},children:e.jsx(kt,{tone:"info",onDismiss:()=>r?.(),children:f("IfYouAreStillInTheSameCycleWithThePreviousBilling")})})]}),g?e.jsx("div",{className:"px-4",style:{marginBottom:70},children:e.jsx(nt,{roundedAbove:"xs",padding:"0",children:R()})}):e.jsx("div",{className:"",children:e.jsxs(nt,{padding:"0",children:[e.jsxs("div",{className:"p-4 py-3",children:[e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsxs(U,{align:"start",ga
159p:"100",blockAlign:"center",children:[e.jsxs(m,{as:"span",variant:"headingLg",fontWeight:"semibold",children:[o?.name??"N/A"," "]}),e.jsx(wt,{children:q.upperFirst(o?.cycle===365?f("Yearly"):f("Monthly"))})]}),e.jsx("div",{style:{width:g?void 0:200},children:e.jsxs(U,{wrap:!1,gap:"100",blockAlign:"center",align:"start",children:[e.jsxs(m,{as:"h1",variant:"heading3xl",fontWeight:"bold",children:["$",o?.price??"N/A"]}),e.jsxs(m,{as:"span",variant:"bodyMd",children:["USD/",o?.cycle===365?f("Year").toLocaleLowerCase():f("Month").toLocaleLowerCase()]})]})})]}),y>0&&e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:f("YourRemainingTrialVarDays",{var_days:y})})]}),e.jsx($e,{}),e.jsx("div",{className:"p-4",children:e.jsx(_c,{})}),e.jsx("div",{className:"",children:e.jsx($e,{})}),e.jsx("div",{className:"p-4",children:e.jsxs(U,{align:"end",gap:"200",children:[e.jsx(re,{variant:"tertiary",onClick:a,children:f("AllPlanOptions")}),e.jsx("div",{children:e.jsx(re,{fullWidth:!0,variant:"primary",onClick:()=>n?.(),children:f("ContinueThisPlan")})})]})})]})}),e.jsxs(m,{alignment:"center",as:"p",variant:"bodyMd",children:[f("NeedHelpDowngrading")," ",e.jsx(Vp,{removeUnderline:!0,onClick:C,children:f("ContactOurSupportTeam")})]})]})})},ly=se.div` 160 padding: 20px 20px; 161 width: 100%; 162 display: flex; 163 align-items: center; 164 justify-content: center; 165 background: ${({isAtOnboarding:t=!1})=>t?"#fff":""}; 166 @media screen and (max-width: 1280px) { 167 padding: ${({isMdDown:t=!1})=>t?"0px":"20px 20px 20px"}; 168 } 169 /* & .Polaris-BlockStack { 170 width: ${({isMdDown:t=!1})=>t?380:1136}px; 171 } */ 172`;se.div` 173 & .Polaris-Button { 174 & .Polaris-Button__Content { 175 flex-direction: row-reverse; 176 gap: 8px; 177 } 178 } 179`;se.div` 180 .app-main { 181 max-width: ${Ua[1136].maxWidth}; 182 margin: 0 auto; 183 justify-content: center; 184 margin: auto; 185 height: calc(100vh - 56px); 186 align-items: center; 187 padding-top: 0px; 188 display: flex; 189 @media screen and (max-width: 767px) { 190 display: block; 191 padding: 0 12px; 192 svg { 193 max-width: 100%; 194 } 195 } 196 } 197 198 .page-shopify { 199 .list-platform { 200 display: flex; 201 gap: 24px; 202 203 .platform-item { 204 cursor: pointer; 205 display: flex; 206 align-items: center; 207 justify-content: center; 208 width: 100%; 209 height: 56px; 210 background: #ffffff; 211 border: 1.5px solid #e9e9e9; 212 box-shadow: 0px 1px 8px rgba(0, 0, 0, 0.08); 213 border-radius: 6px; 214 215 &.active { 216 border-color: #262626; 217 } 218 } 219 } 220 } 221 222 .page-welcome { 223 .logo { 224 } 225 226 .title { 227 } 228 229 .description { 230 } 231 232 button { 233 width: 200px; 234 } 235 } 236 237 .page-install { 238 .logo { 239 margin-bottom: 88px; 240 } 241 242 .title { 243 margin-bottom: 16px; 244 } 245 246 .description { 247 margin-bottom: 41px; 248 } 249 250 button { 251 width: 180px; 252 } 253 } 254 255 .page-connect { 256 .logo { 257 margin-bottom: 88px; 258 } 259 260 .title { 261 margin-bottom: 16px; 262 } 263 264 .description { 265 margin-bottom: 41px; 266 } 267 } 268`;se.div` 269 width: 454px; 270 height: 678px; 271 border-radius: 20px; 272 padding: 100px 40px; 273 274 .title { 275 font-size: 20px; 276 font-weight: 400; 277 color: #fff; 278 } 279 .price { 280 background: linear-gradient(90.33deg, #ffffff -67.9%, #47b2ff 5.61%, #bb62f1 89.59%, #ffc107 173.23%, #ffffff 237.4%); 281 -webkit-background-clip: text; 282 background-clip: ''; 283 -webkit-text-fill-color: transparent; 284 font-size: 120px; 285 line-height: 120px; 286 font-weight: 700; 287 } 288 .day-trial { 289 background: linear-gradient(165.69deg, #ffffff 15.82%, #c5c0ff 70.6%, #8a8ef5 89.36%, rgba(255, 255, 255, 0.857744) 116.87%); 290 -webkit-background-clip: text; 291 background-clip: ''; 292 -webkit-text-fill-color: transparent; 293 font-size: 35px; 294 line-height: 38px; 295 font-weight: 700; 296 } 297 298 .deal, 299 .plan { 300 cursor: pointer; 301 font-size: 20px; 302 } 303 .deal { 304 background-clip: ''; 305 display: flex; 306 padding: 20px 70px; 307 background: var(--p-color-bg-surface); 308 border-radius: 10px; 309 } 310 .plan { 311 border-radius: 10px; 312 color: var(--p-color-bg-surface); 313 } 314`;const fw=se.div` 315 ${({$isHasNavigation:t})=>t&&Ps` 316 .Polaris-Frame__Main { 317 padding-left: 0; 318 } 319 `} 320`,cy="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='path-1-inside-1_23011_14350'%20fill='white'%3e%3cpath%20d='M15.2605%202.27109C15.4627%201.97398%2015.3867%201.56719%2015.0771%201.38471C13.1866%200.270556%2010.9758%20-0.19392%208.78574%200.0739948C6.37973%200.368325%204.16252%201.52655%202.54653%203.33323C0.930539%2
32005.13992%200.0257802%207.47206%200.000542063%209.89588C-0.0246961%2012.3197%200.831305%2014.6702%202.40933%2016.5101C3.98735%2018.3501%206.17995%2019.5542%208.57932%2019.8986C10.9787%2020.2429%2013.4215%2019.7041%2015.4533%2018.3822C17.4851%2017.0604%2018.9676%2015.0455%2019.6251%2012.7125C20.2236%2010.5888%2020.1014%208.33303%2019.2883%206.29485C19.1551%205.96104%2018.7646%205.82399%2018.4402%205.97857V5.97857C18.1157%206.13316%2017.9805%206.52081%2018.1104%206.8559C18.7897%208.60803%2018.8853%2010.5395%2018.3724%2012.3595C17.8005%2014.3889%2016.5109%2016.1415%2014.7435%2017.2913C12.9762%2018.4411%2010.8513%2018.9098%208.76422%2018.6103C6.67713%2018.3107%204.76988%2017.2633%203.39724%2015.6628C2.0246%2014.0624%201.28%2012.0178%201.30195%209.90943C1.32391%207.80107%202.11091%205.77245%203.51659%204.2009C4.92226%202.62935%206.8509%201.62187%208.94378%201.36585C10.8206%201.13625%2012.715%201.52501%2014.3431%202.46332C14.6545%202.64278%2015.0583%202.5682%2015.2605%202.27109V2.27109Z'/%3e%3c/mask%3e%3cpath%20d='M15.2605%202.27109C15.4627%201.97398%2015.3867%201.56719%2015.0771%201.38471C13.1866%200.270556%2010.9758%20-0.19392%208.78574%200.0739948C6.37973%200.368325%204.16252%201.52655%202.54653%203.33323C0.930539%205.13992%200.0257802%207.47206%200.000542063%209.89588C-0.0246961%2012.3197%200.831305%2014.6702%202.40933%2016.5101C3.98735%2018.3501%206.17995%2019.5542%208.57932%2019.8986C10.9787%2020.2429%2013.4215%2019.7041%2015.4533%2018.3822C17.4851%2017.0604%2018.9676%2015.0455%2019.6251%2012.7125C20.2236%2010.5888%2020.1014%208.33303%2019.2883%206.29485C19.1551%205.96104%2018.7646%205.82399%2018.4402%205.97857V5.97857C18.1157%206.13316%2017.9805%206.52081%2018.1104%206.8559C18.7897%208.60803%2018.8853%2010.5395%2018.3724%2012.3595C17.8005%2014.3889%2016.5109%2016.1415%2014.7435%2017.2913C12.9762%2018.4411%2010.8513%2018.9098%208.76422%2018.6103C6.67713%2018.3107%204.76988%2017.2633%203.39724%2015.6628C2.0246%2014.0624%201.28%2012.0178%201.30195%209.90943C1.32391%207.80107%202.11091%205.77245%203.51659%204.2009C4.92226%202.62935%206.8509%201.62187%208.94378%201.36585C10.8206%201.13625%2012.715%201.52501%2014.3431%202.46332C14.6545%202.64278%2015.0583%202.5682%2015.2605%202.27109V2.27109Z'%20stroke='%23303030'%20stroke-width='2'%20mask='url(%23path-1-inside-1_23011_14350)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.4728%205H12.167L14%208.23948L12.167%2011.479H11.4728L13.3057%208.23948L11.4728%205ZM8.52723%2015H7.83297L6%2011.7605L7.83297%208.52104H8.52723L6.69426%2011.7605L8.52723%2015ZM11.1823%2015H10.488L8.65505%2011.7605L10.6478%208.23948L8.81482%205H9.50908L11.342%208.23948L9.34931%2011.7605L11.1823%2015Z'%20fill='%23303030'/%3e%3cg%20clip-path='url(%23clip0_23011_14350)'%3e%3cpath%20d='M19.9993%203.75699C18.2478%203.86477%2016.8456%205.2956%2016.7403%207.08366H16.7275C16.6219%205.2956%2015.22%203.86477%2013.4688%203.75699V3.74394C15.2203%203.63588%2016.6219%202.20505%2016.7275%200.416992H16.7403C16.8459%202.20505%2018.2478%203.63588%2019.9993%203.74394V3.75699Z'%20fill='%23303030'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_23011_14350'%3e%3crect%20width='6.53055'%20height='6.66667'%20fill='white'%20transform='translate(13.4688%200.416992)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function Fa(){return{shake:i.useCallback(()=>{if(window.shopify){window.shopify.saveBar.leaveConfirmation();return}const s=document.querySelector(".Polaris-Frame-ContextualSaveBar__Contents");if(!s)return;s.classList.remove("shake-bg-green"),s.offsetWidth,s.classList.add("shake-bg-green");const n=()=>{s.classList.remove("shake-bg-green"),s.removeEventListener("animationend",n)};s.addEventListener("animationend",n)},[])}}const dy=()=>{const{t}=J(),s=he(ka),n=ke(nl),a=ke(ur),{shake:r}=Fa(),o=()=>{if(a.isChanged){r();return}s(!0)};return e.jsxs("div",{className:"relative flex items-center gap-2 border-border shadow-100 bg-bg-fill hover:bg-bg-surface-hover rounded-lg px-2 py-1 cursor-pointer",onClick:o,children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("img",{src:cy,alt:"Zopi AI",className:"w-4 h-4 shrink-0"}),e.jsx("span",{className:"text-sm font-semibold whitespace-nowrap",children:t("AISupport")})]}),n.unread?e.jsx("div",{className:"size-4 rounded-full bg-bg-fill-magic flex items-center justify-center text-white font-semibold",children:n.unread}):null]})};ae({key:"isRunningChatState",default:!1});ae({key:"isStreamingAIState",default:!1});ae({key:"isLoadingPageChatAIState",default:!0});const xw=ae({key:"threadIdState",default:""});ae({key:"showHistoryChatState",default:!1});ae({key:"toolSelectedState",default:"web_search"});const uy=ae({key:"prefillMessageState",default:{message:"",autoSubmit:!1}});ae({key:"dataSubmitMessageState",default:{message:"",urlsFile:[]}});const py=({position:t,className:s})=>{const{t:n}=J(),a=he(dr),r=he(ka),o=he(uy),l=ke(ur),{shake:c}=Fa(),u=()=>{if(l.isChanged){c();return}d&&o({message:d,autoSubmit:!1}),a("ask-ai"),r(!0)},d=i.useMemo(()=>
320{if(t==="manage-product")return n("LearnMoreAboutProducts");if(t==="orders")return n("LearnMoreAboutOrders");if(t==="pricing")return n("LearnMoreAboutPricing");if(t==="settings")return n("LearnMoreAboutSettings");if(t==="product-search")return n("LearnMoreAboutCompetitorTracking")},[t]);return e.jsx("div",{className:s,children:e.jsx(re,{variant:"tertiary",onClick:u,children:d})})},hy={GENERAL:{setting_my_profile:"setting_my_profile",setting_connected_store:"setting_connected_store"},BILLING_PLAN:{setting_past_bills:"setting_past_bills"},NOTIFICATION:{setting_notification_method:"setting_notification_method",setting_notification_types:"setting_notification_types"},ORDER_TRACKING:{sync_tracking_number_to_shopify:"sync_tracking_number_to_shopify",send_shipping_confirmation_email:"send_shipping_confirmation_email"}},gy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAivSURBVHgB7VxJaBRbFL0dk4g/ibZTHCIm/8evYNCFGwei+c6KGwUXwQHcKILgIoKoqEhQVNBlwIWCLoQfEBcxbhxwQBw2EnAAB4wGjZqoUTOoieb9d+7PLbrbDD2kXr2Ed6BS1d1Vr9L3vHvfnbpCaWlpihwCh1KKcnJyKL2zs5Mc7AC4SJMXf2T9qf8Oo7S0XErPCJODeUBLmJBQKJ3aWhvo38p/qeSfYs1UOjkEAyaEF5GQosK/8qmwsIBUZwc5BIMQMR8hys75m1qaa7W2hLXJIupobyQHs8jKyhJCBKGuvXO8ggAIiVksHBFBI40crIIjxDI4QiyDI8QyOEIsgyPEMjhCLIMjxDI4QiyDI8QyOEIsgyPEMjhCLIMjxDIMiFptKBTierMAdYOCggJd3SykvLw8fv3t2zdqaGig58+f08uXL6mpqanH622HsnXTgvT2ixcvVhcvXlRfv35V8eD79+/q9u3bqrS0VKWnp0eNZ+umJ5aykpCuXjGVk5Ojzpw5ozo6OjxBd3Z2xkVI7Hk3btxQWqOixneE9LFhBmODwCorKz3B/vr1S6UCjCEE3bt3T40aNcpKYqwiZMiQIbxfuXLlb0LsL0SSe+DAgaj7OkIiNrHxVVVVLKxIE+UHhJRnz55ZRQoIiek6MQ8tDNICorq6Opo0aRK/B6/IBHBfbbZo5MiR1NzcTEG31cJbDDQOETK+fPlCEydO5PdMkSH3BwmfP39mUvA6aARGiDZTTEZ9fT3PDAjDJBkCmRQfPnygjIyMwEkJhBAI/ufPn3T9+nUaP348m40gIaS8f/+e90GSEpgkNm7cSCUlJXzsl2aoBKJzkIDfZ1RXVzMpQWirwKgnAd9/2LBh7OVoLVF+QVzmW7duxe0+i/c1e/bsQGKUwNxeBGepBnvxCBdk4H5Io8QLTJKWlha+znSqxTgh+IJTp07lL97fQV+sUHWyke+5fft2lQw2b948+AnBdv/+fV+1A2QgsBST8/r164TJx//X2trqTaJBSQi+2OjRo/kL+6EdQvKrV6/4foi+w+GwSgXIMJsmxJiXpb8flZWV8XFvHgwCtTdv3njHqg9PCZ9jg+uM8fPz8z03dtasWZTK/3v48OFA6ijGZsDbt2/j0o6hQ4eqcePGqdOnT7Pp6A06oFM7d+7kfJhkiuV+u3btUslC/s/MzEyjGmKsYjh8+HAOAvsCAkbtFdH06dNp06ZNvCGtUlRURNOmTeOo/uPHj/Tw4UN69OgR56AA0TpolVQIoS3JQsaDlt29e5dMwgj7CxcujHt2Snwyd+7cuG24aMaWLVu8906cOKFSxbFjxwanhixfvjzuc7EGQFN0CZYmTJhAjY2NvCb0BKwf0IyKigrOkQnevXtHqQBapicSmYYR9i9duqQSBTRFZ2L5emiKNkFe7SRyy8vLUy9evOBrpkyZ4mnVqlWrVKrQ5tGohhgj5PHjxyoZYHHdtm2bJ+SzZ8+qa9euqYMHD6pTp04prQUeecCIESO8e6JUmyoQ5Q9KQhAfJEuIXrh5DKnsIbjsCWiMiLyvrrWkFPfg2u600i9CjMUhyWZPcV12djZ7WPxwFr1eLFmypMfztbvs3Qt7rCupAGOYLA8YDQxTQWlpKY8BUj59+sQLfXfYsGFD1Ovy8nIWarLlWdyzN4eivzFgWkmLi4ujXtfU1Px2DoS3Z88e3sNTw/7Hjx+k15ukNbS9vX1wEpJqwWfs2LFRr3WKnPcyg7FHbVxH9lRbW+sVmbDt27ePg8lkBIsxTcIYIamWRWNNnjRFQPhHjhwhXfQi7VVxs8L8+fNp7dq1/DlMFe6NjhbJcSVyT+1Ok2kY8SCQBk8FFy5ciBoPQM0Cx9LxKJ9F9gTLe/DQtHPAXlMilcr9+/cbkQ+R4Ug9VVy+fNk7xnqyevVqqqqq8vJWkSYR+S5dCONcFjwkdMM/ffqU8154jTwYcmXxmNHz58+TaQwIDZk8ebI3FrLBcowcFjQBGrB7926lPbAex9DEqPXr1/N1bW1tvd5P2k5NyYfIcGCYLCEQTH19fbdjSqC4Y8cO79zegkD5DNF3X1VLnHvlyhVHSHfYunVr1FiyZowZM0Y1NTXxOX6UhWfOnOkIiYQIWUiI1Ip169bxZ360EuG+KKaZJGNAEALs3bvXG0NySkgwAn72dS1atMh4b5bVhIiwcS0EI2QgsejHb0cE0A5plAiiDchatxdB3Jo1a9hNxYaCFYJAKcv60eopyUu41VL0CgLWaQhmaV1dXZSZgk2H1vjZYAccOnTIqFZQjIZYR4gIvKCgQGVkZHjX+k0Gxn/w4IFnIoMixDqTpWVDlZWVHF0DT5484bq6JAr9APJbyArPmDGDa/Iwj0HCGg2R3xbKNXfu3PF1ARfNkD7goH9raLRiGA8wOxcsWMDH586dozlz5vCxH5qhujoekZZHpjjRTLCfsEJDMFNv3rzJ5x4/fpzf80szRBOrq6ut0AyK0BArCIk1VdIy1N/pEIwnJnDp0qVWkWEVIcCyZcvYuxEBFRUV9VueKnIdqqio4PFjayiOkC7AVGHxFiHJ+eJ6Il0uvVci3ESIANBGVF5e7qXt3bNOeiAk0lR1ZzoiZ7F2fVVZWZmqqanp8ydq7e3t/JSGo0ePcidj5HhBCjweQow9yUETws+2isWKFSu4GphomgJVwdzcXAqHw5SZmcmxA56RhfYg6YgfaMB3AgLREJgqPM+KBsDMNbUFFodgNsPvnzdvntc/5fA/AiEEASDaQZFRtSUYswXGc1kgAL/7uHr1aqBPS7AVRjVEniOC9IgzVd3DGCHwhEACnm/iTFXPMGayTp48ye2cOl/lTFUvMBKHRJZDbcqq2gZjT5SLDPocGb3DPWrcMjhCLIMjxDI4QiyDI8QyOEIsgyPEMjhCLIMjxDI4QiyDI8QyOEIsgyPEMjhCLIMjxDI4QiyDI8QyOEIsgyPEMjhCLAK6cf4D5kW0vZPCOrMAAAAASUVORK5CYII=",my="/assets/feed-hub-logo-DYtZGsPk.png",fy="/assets/one-pixel-logo-PMOW3rxZ.png",xy="/assets/ali-review-logo-DgvHdZZQ.webp",_y="/assets/social-widget-logo-CCsBvfZz.png",za={promer:"https://apps.shopify.com/promer-creative-studio?utm_source=zopi&utm_medium=inapp-ref&utm_campaign=in-app-p
320artner-list&utm_content=co-mkt","ali-reviews":"https://apps.shopify.com/ali-reviews?utm_source=zopi&utm_medium=co-mkt&utm_campaign=in-app-partner-list",feedhub:"https://apps.shopify.com/feedhub-for-google-shopping?utm_source=zopi&utm_medium=inapp-ref&utm_campaign=in-app-partner-list&utm_content=co-mkt",onepixel:"https://apps.shopify.com/onepixel?utm_source=zopi&utm_medium=inapp-ref&utm_campaign=in-app-partner-list&utm_content=co-mkt",instafeed:"https://apps.shopify.com/instafeed-socialwidget?utm_source=zopi&utm_medium=inapp-ref&utm_campaign=in-app-partner-list&utm_content=co-mkt",trueprofit:"https://apps.shopify.com/trueprofit?utm_source=partnership&utm_medium=zopi&utm_campaign=in-app-partner-list",transcy:"https://apps.shopify.com/transcy-multiple-languages?utm_source=zopi&utm_medium=co-mkt&utm_campaign=in-app-partner-list",onemobile:"https://apps.shopify.com/onemobile?utm_source=zopi&utm_medium=co-mkt&utm_campaign=in-app-partner-list",oneloyalty:"https://apps.shopify.com/oneloyalty?utm_source=zopi&utm_medium=co-mkt&utm_campaign=in-app-partner-list",toastibar:"https://makeprosimp.com/partnership/zopi-zopi-aliexpress-dropship-pod-toastibar?utm_source=zopi&utm_medium=inapp-ref&utm_campaign=in-app-partner-list&utm_content=co-mkt",promerseo:"https://apps.shopify.com/promer-product-copy-studio?utm_source=zopi&utm_medium=inapp-ref&utm_campaign=in-app-partner-list&utm_content=co-mkt"},rr={promer:{id:"promer",name:"Promer AI Ads Creative/Meta Ad",category:"AIAdCreative",logo:gy,description:"CreateAdsScaleFaster",ctaLabel:"CreateAdsFree",url:za.promer,color:"#0B0B0D"},"ali-reviews":{id:"ali-reviews",name:"Ali Reviews: AI Product Review",category:"ProductReviews",logo:xy,description:"ImportReviewsBuildTrustSellMore",ctaLabel:"AliReviews",url:za["ali-reviews"],color:"#F05A0A"},feedhub:{id:"feedhub",name:"FeedHub: Google Shopping Feed",category:"GoogleShoppingFeed",logo:my,description:"ProductFeedsForGoogleMetaTikTok",ctaLabel:"FeedHub",url:za.feedhub,color:"#1A73E8"},onepixel:{id:"onepixel",name:"α OnePixel: Facebook Pixel API",category:"ConversionTracking",logo:fy,description:"TrackPixelsConversionsAPI",ctaLabel:"OnePixel",url:za.onepixel,color:"#2347D6"},instafeed:{id:"instafeed",name:"Socialwidget â Instagram Feed",category:"SocialProof",logo:_y,description:"InstagramFeedStories",ctaLabel:"Instafeed",url:za.instafeed,color:"#5470E0"}},ir={home:["ali-reviews","instafeed","feedhub","onepixel","promer"],toast:["promer","instafeed","ali-reviews"],"choosing-plan":["ali-reviews","instafeed","feedhub","onepixel","promer"],"place-order":["onepixel","promer","feedhub"],"manage-product":["promer","feedhub","ali-reviews"],"edit-product":["ali-reviews"]},by="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAQiSURBVHgB1Zo/TBRBFMa/2TMxigUWYotamogWmmijjX8iDRpQCxHsQAsxwVgCrVJQGNHKEyxUiFwDEWzOxsZCMLFUzlJsrhANUW6db2cXD5i9vZvZxdtfctm7nb27+ea9ee/t7AhUoK3Nbdz+C90loEV+bBbyxfOuq45JIQQK3v8ABfmf824JC5kM8s9fi0Lod3Qnr5xzm1ddPJG/dAr1hEA2IzCkE+RsPHH5rHtrtYQPdSeCuOhm32Qf+zY2rbPIpTPugDTnIFKA7PjgyzkxVPZZQUuUXIwgRTgCt1/MCq/PnhBvTtCdgEaki2LGwRHOGW+OyIk9gPSJII1eUJII3xqLSDG/d2K3s7pah9GpRpjr6FqHETMNDUDTXnU0aa8VJmxHZpIWxEzzAeDBGHBvVN++c5
320dq4zUxiWl2RALlxqeP6rVHjvr5C5vbv38Dpl9JEVJQVy/skRocJMTDYXXsuKof9ZkcsCQFnToNHDwEaxwXyRSAHPWJcTXq7dc2ty//ACbH1fv2TtiSnEUIR/3nMtDapubNRvJvlAvSIrSMDYkK4ahPjKn3XT36awKrdHTaTfxEhZDp3L9R180FtuXn/MBwEcYkLoQEo36jXz/qTx8rFzzfpvKLCVsiZF041ow6XTAIx9d6YMSWCCFBOOao6wgCw7ET+sAQRWxCGHWYM/bsDW8n79/p248elxm/QeWWwmfUTCxCOInp/yfPqPyxEfp9q+9SE8/0v9Hh55JgPtVKLEIoolInmPA42hShE8oyhpZk9GJuMcFaCF2GnaDL6DpBa/CaJT/T69pb/XoszFrVYCWEnQhcIvtIf83AfXWsZC0OxMyU3lrVYiWk3CV0nQisRWtEWWt6ClYYC2nyS3TPZTQuwcQXWGvojv43grKF1rKxBjEWElSsYS5RjbWOngi3Vq0YCWHSClxiRuMSwdxZXo4Ot6PDiIVtMKDcJXREWaupzFIsXeKgZiH79iuXYX0UlqVpMfJ2Tt8eNq9sqNm1Fr8oASzwwspuFoDEtAA0wWiOMGcEZXel+3FaJo778WowEhK1CkK3CyZxDPfjVWEcfqNWQYJ7ELbploTixlhINasga/fjV+NbVQzDqkSJWgVhG0NwpcAQF/JZiXrwaErUKgjDrO39eBUUrMv4qFWQ8vvx3n4khuMKO4uQqFUQWoWBIWxJyBqpYZtcxP7qwg6O+s1ONep8r+Nub+V2SxYc+XB+HjHAApGjzqNJuxVSg7OygixSTkZOUyeXF0WpKI+0IpBde6qbEbguD0WkjyK3dPCNJ4SKXP9EmnDL9qWs5ZHJWTEio1dqxLCvk/6uB7Jpd1D7WbdP1PcGgiItUS6ChG5z+lPCoGzsQj0hgxLns26bk6j0PW9XhKwHpR35LL7lf2w8g6qjFlZ2IJvLidCA9BeJ0Ze0rHdVmgAAAABJRU5ErkJggg==",yy="/assets/promer-artwork-CTMmV6bC.png",Cy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAABeCAYAAADsZADEAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACBBJREFUeAHtnFtPW1cWx9c+BkIuaFRpHib5AMx7rdHMw0jxVCkkHThxhkzBmdEoNcT5AETRdJKqHrWVqgo+AAl2egOTSm3BsZRCeiFq1YsU+gF47AM8tG8mxmCfvbrWCSUJGHOMzw2yftLhYo6Nfdbea6/1X2sfAB/Bvpd7wQcyZqZj8uzt3g/iuRg0yM/03HI8M7wWzybAB+z3Gr89As1yFU9AWMC+ga/oGANhG+vxd6MPzYxnxjLAXxYBVAe4zTVM0bGrt5g690knBAjP3FqzlzxIqqp1utWIHAeP8NfQGkehglfAbRB48Lz+pPt6cnawe5yIT41ZuD5JF9oXl7yVifhHUQSMIeiVrX+zNBTob5fbpi8ugEf4amj16e1FlZ9a2vr4pa9f6kzOvbh3t6WAX3OZjiL/WjYzqYiCfPnsLXuWD+YHi4bG/9OI4AsagwD41/TLCwrUvKHhxta/Hc0PLvEBB5mLs129ybnuB4OzZ5oL1K7i5pJQNrNjJTN7p9Zpv7/6MAXX925sHBg4gX2JXv4ODcKeBQKiBQLGAFqXUC9nuu/egWZ4RxU3f1aqgKhrusFfWo/EwI4V6vPKbPedSCumdVv7on5YiRmqupDturcEVUiRuXugBCY0CHsWCIjADQ2qWjBQPWUUDprQWlspQam4l4vTPvPKzoNGketch7pr4dDd0zFLQXH8hdmF5Gfdw4YBCVRGMTljmvAenWConMrnDrar9QMOXCh4ejARz6UhIJLfmLabHZo7nXi0vDyKIfCfF6IguAcbmY7m3HkteH2+hoFE3gwPFDQHfBc3gnfdO1DWpdEjcMT94IVcMqVjnIrdp3XdN/drewJtpUHrY5R5/A18hFPN0Bp6Y212P3h5g+KB1yiX99jI7OoRIiN/ynfNP/fT8QLgDA1aDhjVJDTDNRyjwbpMccboUwHoLigQPOHS5y91WtqafG7pD/D89BmIqLYLA5/+Y9dof1dYFGqhyL+6zw2N38MwfYic+iu4MuPsIMpo6cmeuntjt3MvbuTym6lUkwxSEGfR9z/++PzSq6++7Znq5YSGXPeqmUmDoecPT1+aBw/Ab0jKZDnTAC58NF3pst0nGmMK0ZHRWjQWdQsklLYvS9OGznTPbQSTcxA0DRmaJLzj6GH8RrOYXVGaDL5jVIr9/+lUt9935AJJjDmpKfginTfn5PzxM5/N07d5OIg0ojFzKQ0DlPGwv78T+/rzINTETt3OD6Qxmdxmo5aIoY85fSEvqyuOWFUr0AquDjS6MDFaLjrVx1O7ruFhBk0SeLQeoc9yX2Wz24I04+apL+q6wd8UojDAlS8yiLs5KOIwvfIy7Hda22P0dYUC2ZoDtm6ZMjl7JoWl9THSeENjbNfRFOX/7vA87HcqxgLV+4drlYGZHdMr27jt68ORSGVyt1kvHGDwB+jEb8FXzRi/g146RijXbqqwwGliueeWu42K14NpaHDKnjpM2Mjk8sbo2f66dIvKiyz/YbP/V3VCRL/umrG5Zw25Tu0e2DeQ2ktzw07sKSlWf7YL954I87b4jzQ7EKMUYV9RU4/XnA21bBSaRANeiSjowZZq81r6o0oYG9n9jKQCE5QqmbWi6FDCihe7XUfn9iUSNJof4PlE3V5nzudL8WwCz73namdnzsw1NovSpD3/D9NUKHG9To1m0jWP6YvWbevXCD3kes0N9av++fQBVb72KGbRRmsrikol6M0X22eS21p6uHmfPtmxVb1SaLRDhZ+LStMMjaS5oe+3x5P3TlPVCIvZU7NPd7FykaEVuKK0AG+qNIQUf7pA0Xb1HXRBHPUt72RkXlM1WhwbgOILC+pm7RcAFoGi7UZHw7Nd2b1mLPVWY08+blRZRjUWt6WaXO58S/WG2ci+wvq1HcQ1ARfQK/FbMfCYD+OTww27cGGfwulSOkT7mZrEkesuU8DjdtATajiwQoorSnBgcGRoqudGV63q6FObwNJ4cA1fsb9O+tlTFhp4I9jmL5w7cu9SyJmIT6V4vYUACUtRyHHU3T49+LgqUoECcBT9xDaYMKJAFZWD3ZssqTYrq9YiOXs6DaW1r4a+7Aq8F3xv7SKPmtIuQMhRWt9fhVKh3jl2NwvarUts8MvqL+4oXJyGKWPtJCLkxl+Y2/E1ebOCAkxosJb/PX2hIdXv4dnx3qMzQ45635/5LlB7JqPdulRkLd2JoOOUobkXE+Nd9+q2MfH2I42VKIJaZIHGHngRek8KluoNOr4zw9GN1uEj+aQvd5IQXISk4hgNvjE6HBVJys9SNhRKnObgnK9fJ63c4zKn37e2eDbgPJwqT44KHeskDyN4nsbtqzV6aPbvUW1YKRK6F5w05AcG16cVGfBNNQ8hwY66eSf+IeNwak2v3ghys/Zu6HJk0WizclYbenZTF1d4S4VzELKw4MkWVSE0bOTRxoKhrQIIQiMEuZtDqI2rwRh3f1hapxDwRIsRSQe+s0PYxNX0ig2rlCooQxVJ0ovZD3KV6wDVdcOOfXus84mRrbfPcH1r5MYdgR4HdhWIAXdJvoaX7bsNCN5SUSeBb5p3yGDpdTM/914wqdhbVoug4cBLdWu97yZWzczkavxmDILCUNyftwwd7QHsrvkvBl6m84NSPHOH71gYtP6M5/q3/X+5h4lLcDWpw4DEIQ05FWLRSRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQRAEQXCBXwGevzpnNAs+XAAAAABJRU5ErkJggg==",Xp=({watchDrag:t=!0,autoPlay:s=!0,autoPlayDelay:n=6e3,speed:a=35,loop:r=!1}={})=>{const[o,l]=i.useState(0),[c,u]=i.useState([]),[d,g]=xr({align:"start",containScroll:"trimSnaps",loop:r,watchDrag:t,duration:a}),h=i.useCallback(x=>{l(x.selectedScrollSnap())},[]),p=i.useCallback(x=>{u(x.scrollSnapList()),l(x.selectedScrollSnap())},[]);return i.useEffect(()=>{if(g)return p(g),g.on("reInit",p),g.on("select",h),()=>{g.off("reInit",p),g.off("select",h)}},[g,p,h]),i.useEffect(()=>{if(!g||!s||c.length<=1)return;const x=setInterval(()=>{g.canScrollNext()?g.scrollNext():g.scrollTo(0)},n);return()=>clearInterval(x)},[g,s,n,c.length]),{emblaRef:d,emblaApi:g,selectedIndex:o,scrollSnaps:c}},jl=({count:t,selectedIndex:s,onSelect:n,className:a})=>t<=1?null:e.jsx("div",{className:oe("flex justify-center gap-2",a),children:Array.from({length:t}).map((r,o)=>e.jsx("button",{type:"button","aria-label":`Go to integration app page ${o+1}`,className:oe("h-2 rounded-full border-0 p-0 transition-all cursor-pointer",o===s?"w-5 bg-[#303030]":"w-2 bg-[#d0d0d0]"),onClick:()=>n(o)},o))}),Gc={promer:"#F5F5F5",feedhub:"#EEF5FF","ali-reviews":"#FFF3E8",onepixel:"#EEF0FF"},vy=({})=>{const{t}=J();return e.jsx("div",{className:"absolute right-0 top-0 h-[136px] w-[584px]",children:e.jsxs(ft,{columns:"minmax(0, 1fr) 430px",gap:"300",children:[e.jsx(U,{align:"end",blockAlign:"center",children:e.jsxs("div",{className:"relative flex size-[120px] shrink-0 flex-col items-center justify-center gap-1.5 overflow-hidden rounded-[12px] border border-[#
320E1E1E5] bg-white px-2 pb-4 pt-3",children:[e.jsx("img",{src:Cy,alt:"","aria-hidden":!0,className:"pointer-events-none absolute left-1/2 top-[-4px] h-[91px] w-[120px] -translate-x-1/2 opacity-80"}),e.jsx("span",{className:"relative flex size-6 items-center justify-center rounded-full bg-[#1BD139] text-white",children:e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3.5 8.5l3 3 6-7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("div",{className:"relative text-center gap-1",children:[e.jsxs("div",{className:"text-body-sm font-semibold leading-[18px] text-[#1A1A1A]",children:[" ",t("OrderCompleted")]}),e.jsx("div",{className:"text-body-xs leading-4 text-[#595969]",children:t("DriveMoreSales")})]})]})}),e.jsx("div",{className:"relative h-[136px] w-[430px]",children:e.jsx("img",{src:yy,alt:"","aria-hidden":!0,className:"absolute inset-0 h-[136px] w-[430px] max-w-none object-cover"})})]})})},Ay=({promerLogo:t,url:s})=>{const{t:n}=J();return e.jsx("div",{className:"h-[136px] max-md:h-auto max-md:min-h-[136px]",children:e.jsxs(ft,{columns:{xs:1,md:2},gap:"300",alignItems:"center",children:[e.jsxs("div",{className:"flex min-w-0 flex-col justify-center gap-3 pl-[15px] max-md:px-5 max-md:py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("img",{src:by,alt:"Zopi",className:"size-4 rounded object-cover"}),e.jsx("span",{className:"text-[13px] font-medium leading-5 text-[#2C2C34]",children:"Zopi"})]}),e.jsx("span",{className:"text-[13px] font-medium leading-5 text-[#42424D]",children:"X"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("img",{src:t,alt:"Promer",className:"size-4 rounded object-cover"}),e.jsx("span",{className:"text-[13px] font-medium leading-5 text-[#2C2C34]",children:"Promer"})]})]}),e.jsxs("div",{className:"flex flex-col items-start gap-2",children:[e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsx("h3",{className:"m-0 text-[16px] font-semibold leading-6 text-[#1C1917]",children:n("FoundAWinningProduct")}),e.jsx("p",{className:"m-0 text-[13px] leading-5 text-[#595969] truncate",children:n("CreateHighconvertingAdsInMinutesWithPromer")})]}),e.jsx("a",{href:s,target:"_blank",rel:"noreferrer",className:"inline-flex h-[28px] w-fit items-center justify-center rounded-lg bg-[#303030] px-3 text-[12px] font-medium leading-4 text-white no-underline shadow-[inset_0_0_0_1px_rgba(255,255,255,0.2),0_1px_1px_rgba(0,0,0,0.18)]",children:n("CreateAdsFree",{app:"Promer"})})]})]}),e.jsx("div",{className:"relative h-[136px] max-md:hidden",children:e.jsx(vy,{promerLogo:t})})]})})},Jp=({appId:t})=>{if(t==="feedhub")return e.jsxs("div",{className:"w-[200px] rounded-xl bg-white p-3 shadow-[0_6px_16px_-8px_rgba(20,23,28,0.18)]",children:[e.jsxs("div",{className:"mb-[11px] flex items-center gap-2 rounded-full border border-[#E6E6E6] px-[11px] py-1.5",children:[e.jsxs("span",{className:"flex items-center gap-[3px]",children:[e.jsx("span",{className:"size-[7px] rounded-full bg-[#4285F4]"}),e.jsx("span",{className:"size-[7px] rounded-full bg-[#EA4335]"}),e.jsx("span",{className:"size-[7px] rounded-full bg-[#FBBC05]"}),e.jsx("span",{className:"size-[7px] rounded-full bg-[#34A853]"})]}),e.jsx("span",{className:"text-[11px] leading-[15px] text-[#5c5f62]",children:"screen protector"})]}),e.jsxs("div",{className:"flex gap-[9px]",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"mb-1.5 h-7 rounded-lg bg-[linear-gradient(135deg,#EAF0F8,#D5DEEC)]"}),e.jsx("div",{className:"text-[11px] font-semibold leading-[14px] text-[#1a1a1a]",children:"$24.99"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"mb-1.5 h-7 rounded-lg bg-[linear-gradient(135deg,#F3EAE3,#E6CDBF)]"}),e.jsx("div",{className:"text-[11px] font-semibold leading-[14px] text-[#1a1a1a]",children:"$19.99"})]})]})]});if(t==="onepixel"){const s=[{h:38,c:"#DDE3F5"},{h:54,c:"#DDE3F5"},{h:46,c:"#C2CCF0"},{h:66,c:"#C2CCF0"},{h:58,c:"#8FA2E8"},{h:80,c:"#5470E0"},{h:100,c:"#2347D6"}];return e.jsxs("div",{className:"w-[198px] rounded-xl bg-white p-3.5 shadow-[0_6px_16px_-8px_rgba(20,23,28,0.18)]",children:[e.jsxs("div",{className:"mb-3 flex items-end gap-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold leading-[13px] tracking-[0.04em] text-[#8a8a8a]",children:"ROAS"}),e.jsx("div",{className:"text-[24px] font-bold leading-[26px] tracking-[-0.5px] text-[#1a1a1a]",children:"4.2x"})]}),e.jsx("div",{className:"pb-1 text-[11px] font-semibold leading-[15px] text-[#1E8E5A]",children:"â² 38%"})]}),e.jsx("div",{className:"flex h-8 items-end gap-[5px]",children:s.map((n,a)=>e.jsx("div",{className:"flex-1 rounded-[3px]",style:{height:`${n.h}%`,backgroundColor:n.c}},a))})]})}
320return t==="ali-reviews"?e.jsxs("div",{className:"w-[198px] my-1.5 overflow-hidden rounded-xl bg-white shadow-[0_6px_16px_-8px_rgba(20,23,28,0.18)]",children:[e.jsx("div",{className:"h-[46px] bg-[linear-gradient(135deg,#D7DCE3,#9AA3B2)]"}),e.jsxs("div",{className:"p-2",children:[e.jsxs("div",{className:"mb-[7px] flex items-center gap-[9px]",children:[e.jsx("div",{className:"min-w-0 flex-1 text-[11px] font-semibold leading-[15px] text-[#1a1a1a]",children:"Sarah M."}),e.jsx("div",{className:"text-[11px] font-bold leading-[14px] tracking-[1px] text-[#FFB400]",children:"â
â
â
â
â
"})]}),e.jsx("div",{className:"text-[9px] leading-[13px] text-[#5c5f62]",children:"âExactly as pictured, and shipped fast.â"})]})]}):e.jsxs("div",{className:"w-[190px] overflow-hidden rounded-xl bg-white shadow-[0_6px_16px_-8px_rgba(20,23,28,0.22)]",children:[e.jsxs("div",{className:"relative h-[74px] bg-[linear-gradient(140deg,#566273_0%,#2B313A_55%,#12151A_100%)]",children:[e.jsx("span",{className:"absolute left-2 top-2 inline-flex items-center gap-1 rounded-full bg-white px-2 py-0.5 text-[8px] font-bold leading-3 text-[#111]",children:"⦠AI AD"}),e.jsxs("div",{className:"absolute right-[7px] top-[6px] flex size-[34px] -rotate-[8deg] flex-col items-center justify-center rounded-full bg-[linear-gradient(135deg,#FF6B6B,#E11D48)] text-white shadow-[0_3px_8px_rgba(225,29,72,0.5)]",children:[e.jsx("span",{className:"text-[11px] font-extrabold leading-[11px]",children:"50%"}),e.jsx("span",{className:"text-[6px] font-bold leading-[7px] tracking-wider",children:"OFF"})]}),e.jsx("div",{className:"absolute left-1/2 top-[42%] flex size-[26px] -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-white/95 shadow-[0_2px_8px_rgba(0,0,0,0.35)]",children:e.jsx("span",{style:{width:0,height:0,borderLeft:"8px solid #111",borderTop:"5px solid transparent",borderBottom:"5px solid transparent",marginLeft:2}})}),e.jsx("div",{className:"absolute inset-x-[9px] bottom-2 text-[12px] font-bold leading-[15px] text-white [text-shadow:0_1px_4px_rgba(0,0,0,0.5)]",children:"Protect every iPhone â 50% off"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-[9px]",children:[e.jsx("span",{className:"size-3.5 rounded bg-[#1877F2]"}),e.jsx("span",{className:"size-3.5 rounded bg-[#111]"}),e.jsx("span",{className:"text-[9px] font-medium leading-3 text-[#9a9a9a]",children:"Sponsored"}),e.jsx("span",{className:"ml-auto rounded-md bg-[#111] px-[9px] py-[3px] text-[9px] font-bold leading-3 text-white",children:"Shop now"})]})]})},Sy=({className:t,variant:s,appIds:n,urlParams:a})=>{const{t:r}=J(),[o,l]=i.useState(null),c=o??s,u=ir[c].map(k=>rr[k]),d=n?u.filter(k=>n.includes(k.id)):u,[g,h]=i.useState(!0),{emblaRef:p,emblaApi:x,selectedIndex:f,scrollSnaps:_}=Xp({watchDrag:q.size(d)===1?!1:void 0,autoPlay:q.size(d)>1,autoPlayDelay:3e3,speed:35,loop:q.size(d)>1}),b=i.useRef(!1),{getUserInfo:v,onUpdateUserInfo:y}=de(),C=v(),S=C?.remaining_meta_keys||{},j=i.useMemo(()=>S[Ut.SHOWED_SLIDE_ALL_APPS],[S]),A=!!o;i.useEffect(()=>{!j&&C.id&&!b.current&&h(!1)},[j,C.id]);const E=i.useCallback(()=>{l(c),S[Ut.SHOWED_SLIDE_ALL_APPS]=!0,y({...C,remaining_meta_keys:S}),Cs.updateValueOnboarding({key:Ut.SHOWED_SLIDE_ALL_APPS,value:!0})},[C,y,S,c]),T=i.useCallback(()=>{l(null),S[Ut.SHOWED_SLIDE_ALL_APPS]=!1,y({...C,remaining_meta_keys:S}),Cs.updateValueOnboarding({key:Ut.SHOWED_SLIDE_ALL_APPS,value:!1})},[C,y,S]);if(g)return null;if(A){const k=d[f]??d[0];return e.jsxs("div",{className:oe("flex items-center gap-2 text-[12px] leading-[17px] text-[#5c5f62]",t),children:[e.jsxs("span",{children:[" ",r("BannerDismissedTheMerchantWontSeeItAgainOnThisScreen",{app:k.name})]}),e.jsx("button",{type:"button",className:"cursor-pointer font-semibold text-[#2C6ECB]",onClick:T,children:r("Reset")})]})}return e.jsxs("div",{className:oe("relative",t),children:[e.jsx(ts.Viewport,{ref:p,slideSize:"100%",slideSpacing:"var(--p-space-300)",children:e.jsx(ts.Container,{children:d.map(k=>e.jsx(ts.Slide,{className:"h-full",children:e.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden rounded-2xl bg-bg-surface border-border",children:[e.jsx("button",{type:"button",style:{background:"rgba(255, 255, 255, 0.26)"},"aria-label":"Dismiss integration apps",className:"absolute right-3 top-3 z-[2] text-icon-secondary flex size-6 items-center justify-center rounded-lg bg-[#F1F1F1] cursor-pointer",onClick:E,children:e.jsx("svg",{"data-dc-tpl":"110",width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{"data-dc-tpl":"111",d:"M5.7 5.7a1 1 0 0 1 1.4 0L10 8.6l2.9-2.9a1 1 0 1 1 1.4 1.4L11.4 10l2.9 2.9a1 1 0 0 1-1.4 1.4L10 11.4l-2.9 2.9a1 1 0 0 1-1.4-1.4L8.6 10 5.7 7.1a1 1 0 0 1 0-1.4z"})})}),k.id==="promer"?e.jsx(Ay,{promerLogo:k.logo,url:tr(k.url,a)}):e.jsxs("div",{className:"grid min-h-[130px] flex-1 grid-cols-[1fr_300px] max-md:grid-cols-1",children:[e.jsxs("div",{className:"flex min-w-0 flex-col justify-center gap-1.5 px-5 py-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("img",{src:k.logo,alt:k.name,className:"size-[30px] shrink-0 rounded-lg object-cover shadow-[0_0_0_1px_rgba(20,23,28,0.08)]"}),e.jsx("span",{className:"text-[19px] font-bold leading-6 tracking-[-0.4px] text-[#1a1a1a]",children:k.name}),e.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold leading-[14px]",style:{color:k.color,backgroundColor:Gc[k.id]},children:r("New")})]}),e.jsx("p",{className:"max-w-[418px] text-[12px] leading-[17px] text-[#5c5f62]",children:r(k.description)}),e.jsx("div",{className:"mt-[5px]",children:e.jsx("a",{href:tr(k.url,a),target:"_blank",rel:"noreferrer",className:"inline-flex h-[30px] w-fit items-center justify-center rounded-lg px-3.5 text-[12px] font-semibold leading-4 text-white no-underline shadow-[0_1px_1px_rgba(0,0,0,0.18)]",style:{backgroundColor:k.color},children:r("Explore")+" "+k.ctaLabel})})]}),e.jsx("div",{className:"flex items-center justify-center border-l border-[rgba(20,23,28,0.05)] px-6 py-3 max-md:border-l-0 max-md:border-t",style:{backgroundColor:Gc[k.id]},children:e.jsx(Jp,{appId:k.id})})]})]})},k.id))})}
320),e.jsx(jl,{count:_.length,selectedIndex:f,onSelect:k=>x?.scrollTo(k),className:"mt-3"})]})},Wc={promer:"#F5F5F5",feedhub:"#EEF5FF","ali-reviews":"#FFF3E8",onepixel:"#EEF0FF"},jy=({className:t,appIds:s,urlParams:n})=>{const{t:a}=J(),{getUserInfo:r,onUpdateUserInfo:o}=de(),l=r(),c=l?.remaining_meta_keys||{},u=i.useMemo(()=>c[Ut.SHOWED_SLIDE_SINGLE_APP_EDITOR],[c]),d=s?ir["edit-product"].map(x=>rr[x]).filter(x=>s.includes(x.id)):ir["edit-product"].map(x=>rr[x]),[g,h]=i.useState(!1),p=i.useCallback(()=>{h(!0),c[Ut.SHOWED_SLIDE_SINGLE_APP_EDITOR]=!0,o({...l,remaining_meta_keys:c}),Cs.updateValueOnboarding({key:Ut.SHOWED_SLIDE_SINGLE_APP_EDITOR,value:!0})},[l,o,c]);return i.useEffect(()=>{u&&l.id&&h(!0)},[u,l.id]),g?null:e.jsx("div",{className:oe("relative",t),children:d.map(x=>e.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden rounded-2xl bg-bg-surface border-border",children:[e.jsx("button",{type:"button",style:{background:"rgba(255, 255, 255, 0.26)"},"aria-label":"Dismiss integration apps",className:"absolute right-3 top-3 z-[2] text-[#fff] flex size-6 items-center justify-center rounded-lg bg-[#F1F1F1] cursor-pointer",onClick:p,children:e.jsx("svg",{"data-dc-tpl":"110",width:"13",height:"13",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{"data-dc-tpl":"111",d:"M5.7 5.7a1 1 0 0 1 1.4 0L10 8.6l2.9-2.9a1 1 0 1 1 1.4 1.4L11.4 10l2.9 2.9a1 1 0 0 1-1.4 1.4L10 11.4l-2.9 2.9a1 1 0 0 1-1.4-1.4L8.6 10 5.7 7.1a1 1 0 0 1 0-1.4z"})})}),e.jsxs("div",{className:"grid min-h-[130px] flex-1 grid-cols-[1fr_236px] max-md:grid-cols-1",children:[e.jsxs("div",{className:"flex min-w-0 flex-col justify-center gap-1.5 px-5 py-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("img",{src:x.logo,alt:x.name,className:"size-[30px] shrink-0 rounded-lg object-cover shadow-[0_0_0_1px_rgba(20,23,28,0.08)]"}),e.jsx("span",{className:"text-[19px] font-bold leading-6 tracking-[-0.4px] text-[#1a1a1a]",children:x.name}),e.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold leading-[14px]",style:{color:x.color,backgroundColor:Wc[x.id]},children:a("New")})]}),e.jsx("p",{className:"max-w-[418px] text-[12px] leading-[17px] text-[#5c5f62]",children:a(x.description)}),e.jsx("div",{className:"mt-[5px]",children:e.jsx("a",{href:tr(x.url,n),target:"_blank",rel:"noreferrer",className:"inline-flex h-[30px] w-fit items-center justify-center rounded-lg px-3.5 text-[12px] font-semibold leading-4 text-white no-underline shadow-[0_1px_1px_rgba(0,0,0,0.18)]",style:{backgroundColor:x.color},children:x.id==="promer"?a("CreateAdsFree"):a("Explore")+" "+x.ctaLabel})})]}),e.jsx("div",{className:"flex items-center justify-center border-l border-[rgba(20,23,28,0.05)] px-6 py-3 max-md:border-l-0 max-md:border-t",style:{backgroundColor:Wc[x.id]},children:e.jsx(Jp,{appId:x.id})})]})]},x.id))})},Ey={promer:"#F4F4F5","ali-reviews":"#FFF3E8",feedhub:"#EAF2FF",onepixel:"#EEF0FF",instafeed:"#EEF0FF"},Ty=({className:t,variant:s,urlParams:n})=>{const{t:a}=J(),r=ir[s].map(h=>rr[h]),{emblaRef:o,selectedIndex:l,scrollSnaps:c,emblaApi:u}=Xp(),d="25%",g=s==="home"?"MoreFromTheZopiEcosystem":"CompleteYourStoreStack";return e.jsx("div",{className:oe("relative",t),children:e.jsxs(Q,{background:"bg-surface",borderColor:"border",borderRadius:"300",borderWidth:"025",padding:"400",shadow:"100",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(m,{as:"p",variant:"headingSm",fontWeight:"bold",children:a(g)}),s==="home"&&e.jsx("span",{className:"rounded-full bg-[#FFF1E6] px-2 py-0.5 text-xs font-bold leading-4 text-[#F05A0A]",children:"New"})]}),c.length>1&&e.jsxs(m,{as:"span",variant:"bodySm",tone:"subdued",fontWeight:"semibold",children:[l+1," / ",c.length]})]}),e.jsx("div",{className:"relative",children:e.jsx(ts.Viewport,{ref:o,slideSize:d,slideSpacing:"var(--p-space-400)",children:e.jsx(ts.Container,{children:r.map(h=>e.jsx(ts.Slide,{children:e.jsx("a",{href:tr(h.url,n),target:"_blank",rel:"noreferrer",className:"block h-[152px] rounded-xl border-0 px-4 py-4 no-underline transition-shadow hover:shadow-md",style:{backgroundColor:Ey[h.id]},children:e.jsxs("div",{className:"flex h-full flex-col gap-2",children:[e.jsx(U,{gap:"300",blockAlign:"center",wrap:!1,children:e.jsx("img",{src:h.logo,alt:h.name,className:"size-10 shrink-0 rounded-lg object-cover"})}),e.jsx("div",{className:"min-w-0",children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"bold",truncate:!0,children:h.name})}
320),e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:a(h.description)}),e.jsxs("span",{className:"mt-auto text-sm font-bold leading-5",style:{color:h.color},children:[h.id==="promer"?a("CreateAdsFree"):a("Explore")+" "+h.ctaLabel," â"]})]})})},h.id))})})})," ",e.jsx(jl,{count:c.length,selectedIndex:l,onSelect:h=>u?.scrollTo(h),className:"mt-3"})]})})},Py=({className:t,onDismiss:s,urlParams:n})=>{const{t:a}=J(),r=ir.toast.map(g=>rr[g]),[o,l]=i.useState(!1),[c,u]=i.useState(0);if(i.useEffect(()=>{if(o||r.length<=1)return;const g=setInterval(()=>{u(h=>(h+1)%r.length)},3e3);return()=>clearInterval(g)},[o,r.length,c]),o)return null;const d=r[c]??r[0];return e.jsx("div",{className:oe("relative",t),children:e.jsxs("div",{className:"relative rounded-2xl bg-bg-surface px-5 py-5 shadow-md",children:[e.jsx("button",{type:"button","aria-label":"Dismiss integration apps",className:"absolute right-3 top-3 z-[2] flex size-7 items-center justify-center rounded-lg bg-[#F1F1F1] text-text-secondary cursor-pointer",onClick:()=>{s?.(),l(!0)},children:e.jsx(Ws,{width:14})}),e.jsxs(U,{gap:"300",blockAlign:"start",wrap:!1,children:[e.jsx("img",{src:d.logo,alt:d.name,className:"size-12 shrink-0 rounded-xl object-cover"}),e.jsxs("div",{className:"min-w-0 pr-6",children:[e.jsx(m,{as:"h3",variant:"headingMd",fontWeight:"bold",children:d.name}),e.jsx("div",{className:"mt-1",children:e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:a(d.description)})})]})]}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3",children:[e.jsx("a",{href:tr(d.url,n),target:"_blank",rel:"noreferrer",className:"inline-flex h-9 w-fit items-center justify-center rounded-lg px-5 text-sm font-bold text-white no-underline shadow-sm",style:{backgroundColor:d.color},onClick:()=>{Ke.trackingEventUsersAction({event_name:$.MARKETING_APP_MODAL_VIEWED,event_data:{action:"modal_ar_click",app:d.name}})},children:d.id==="promer"?a("CreateAdsFree"):a("Explore")+" "+d.ctaLabel}),e.jsx(jl,{count:r.length,selectedIndex:c,onSelect:u})]})]})})},$p=({className:t,variant:s,onDismiss:n,objUrl:a})=>{const{isMobile:r}=xe();return r?e.jsx(e.Fragment,{}):s==="toast"?e.jsx(Py,{className:t,onDismiss:n,urlParams:a}):s==="place-order"||s==="manage-product"?e.jsx(Sy,{className:t,variant:s,urlParams:a}):s==="edit-product"?e.jsx(jy,{className:t,appIds:["ali-reviews"],urlParams:a}):s==="choosing-plan"||s==="home"?e.jsx(Ty,{className:t,variant:s,urlParams:a}):null};se.div` 321 position: relative; 322 323 & .badge-header > .Polaris-Badge { 324 position: absolute; 325 top: -10px; 326 left: 14px; 327 z-index: 9; 328 background: var(--p-color-bg-fill-info); 329 .Polaris-Text--bodySm { 330 font-weight: 550; 331 color: var(--p-color-text-info-on-bg-fill); 332 } 333 } 334 335 .Polaris-ShadowBevel::before { 336 box-shadow: ${({isMostChoice:t})=>t?"none":"var(--p-shadow-bevel-100)"}; 337 } 338 .Polaris-ShadowBevel { 339 border: transparent; 340 outline: 1.5px solid ${({isMostChoice:t})=>t?"var(--p-color-border-focus)":"transparent"}; 341 } 342 &:hover { 343 .Polaris-ShadowBevel { 344 box-shadow: var(--p-shadow-300); 345 } 346 } 347 /* .Polaris-ShadowBevel { 348 box-shadow: ${({isMostChoice:t})=>t?"var(--p-shadow-300)":"var(--p-shadow-100)"}; 349 } */ 350`;const Iy=se.div` 351 border-radius: ${({mdUp:t})=>t?"var(--p-border-radius-2)":"initial"}; 352 .Polaris-IndexTable__ScrollBarContainer { 353 border-radius: ${({mdDown:t})=>t?"":"initial"}; 354 } 355 .Polaris-IndexTable__TableCell { 356 padding: ${({cellHorizontalPadding:t=16})=>t}px 357 ${({cellVerticalPadding:t=16})=>t}px !important; 358 } 359 .Polaris-IndexTable__TableHeading { 360 padding: 8px 16px !important; 361 } 362 .Polaris-IndexTable__ScrollBarContainer { 363 .Polaris-IndexTable__ScrollBar { 364 overflow-x: hidden; 365 } 366 } 367`,Ry=se.div` 368 padding-top: ${t=>t.size/2}px; 369 padding-bottom: ${t=>t.size/2}px; 370`,ky=se.div` 371 & .Polaris-Text--root { 372 text-decoration: line-through; 373 } 374`,wy=({open:t,onClose:s})=>{const{t:n}=J(),a=ap();return a?.feature_id?e.jsx(Xe,{title:"",size:"small",titleHidden:!0,open:t,onClose:s,children:e.jsx(Kp,{size:60,children:e.jsx(U,{align:"center",blockAlign:"center",children:e.jsxs(D,{inlineAlign:"center",gap:"200",children:[e.jsxs(D,{inlineAlign:"center",children:[e.jsx(ee.Custom,{icon:zp}),e.jsxs(D,{inlineAlign:"center",gap:"100",children:[e.jsx(m,{variant:"headingLg",as:"h6",children:n("PaymentSuccessful")}),e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:n("ThankYouYouHaveCompletedYourPayment")})]})]}),e.jsx("div",{style:{width:"100%",paddingTop:15},children:e.jsxs(D,{gap:"200",children:[e.jsxs(U,{align:"space-between",children:[e.jsx(m,{fontWeight:"regular",tone:"subdued",as:"p",variant:"bodyMd",children:n("AmountPaid")}
374),e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",children:a?.total_price?`$ ${a?.total_price||0} USD`:"N/A"})]}),e.jsx($e,{}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{fontWeight:"regular",tone:"subdued",as:"p",variant:"bodyMd",children:n("PaymentMethod")}),e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",children:n("PlatformStore",{platform:"Shopify"})})]}),e.jsx($e,{}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{fontWeight:"regular",tone:"subdued",as:"p",variant:"bodyMd",children:n("TransactionDate")}),e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",children:Da().format("ll")||"N/A"})]})]})}),e.jsx("div",{style:{width:260,paddingTop:15},children:e.jsx(re,{size:"large",onClick:s,fullWidth:!0,variant:"primary",children:n("Great")})})]})})})}):e.jsx(e.Fragment,{})},Ny={IMPORT_PRODUCT:{label:"ImportedMappedProduct",icon:_g,subUnit:"Products"},ORDER_FULFILLMENT:{label:"OrderProcessed",icon:xg,subUnit:"Orders"},ORDER_TRACKING_NUMBERS:{label:"OrderTracking",icon:fg,subUnit:"Shipments"}},Cr=({isAtOnboarding:t,hasReinstall:s,planDetails:n,app:a="AO"})=>{let r=n.price+"";n.cycle==="yearly"&&(r=Number((n?.price||0)*12-(n?.price||0)*5).toFixed(1));const o={event_name:t?s?$.ONBOARDING_REINSTALL_PLAN_SELECTED:$.ONBOARDING_PLAN_SELECTED:$.SUBSCRIPTION_PLAN_SELECTED,event_data:{[t?"app_plan":"setting_billing_plan"]:n.name,package_name:t&&s?n.price:n.cycle,price:+r,billing_cycle:n.cycle}};a&&!Ce.isShopifyEmbedded()&&(o.event_data.app=a),Ke.trackingEventUsersAction(o)},Oy=da` 375 0% { 376 box-shadow: 377 0 4px 16px rgba(128, 81, 255, 0.12), 378 0 8px 24px rgba(128, 81, 255, 0.08), 379 0 12px 32px rgba(128, 81, 255, 0.04); 380 } 381 50% { 382 box-shadow: 383 0 4px 20px rgba(128, 81, 255, 0.2), 384 0 8px 32px rgba(128, 81, 255, 0.16), 385 0 12px 48px rgba(128, 81, 255, 0.08); 386 } 387 100% { 388 box-shadow: 389 0 4px 16px rgba(128, 81, 255, 0.12), 390 0 8px 24px rgba(128, 81, 255, 0.08), 391 0 12px 32px rgba(128, 81, 255, 0.04); 392 } 393`,Vc=da` 394 0% { 395 transform: translate(33px, 1px) scale(1); 396 opacity: 0.85; 397 } 398 50% { 399 transform: translate(33px, 1px) scale(1.1); 400 opacity: 1; 401 } 402 100% { 403 transform: translate(33px, 1px) scale(1); 404 opacity: 0.85; 405 } 406`,ba=da` 407 0% { 408 opacity: 0.85; 409 transform: translateY(0); 410 } 411 50% { 412 opacity: 1; 413 transform: translateY(1px); 414 } 415 100% { 416 opacity: 0.85; 417 transform: translateY(0); 418 } 419`,Yc=Ps` 420 animation: ${Oy} 3s infinite cubic-bezier(0.4, 0, 0.2, 1); 421`,Dy=Ps` 422 box-shadow: 423 0 4px 12px rgba(0, 0, 0, 0.08), 424 0 8px 24px rgba(0, 0, 0, 0.06); 425`,Ly=Ps` 426 // box-shadow: 427 // 0 8px 24px rgba(0, 0, 0, 0.12), 428 // 0 16px 32px rgba(0, 0, 0, 0.08); 429`,My=Ps` 430 box-shadow: 431 0 4px 10px rgba(0, 0, 0, 0.06), 432 0 8px 20px rgba(0, 0, 0, 0.04); 433`,Uy=se.div` 434 isolation: isolate; 435 transform: translate3d(0, 0, 0); 436 perspective: 1000px; 437 height: 100%; 438`,Fy=se(_r.div)` 439 cursor: pointer; 440 height: 100%; 441 position: relative; 442 transform-style: preserve-3d; 443 will-change: transform, box-shadow; 444 backface-visibility: hidden; 445 transition: box-shadow 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); 446 border-radius: var(--p-border-radius-400); 447 &:not(.with-mobile) { 448 &:hover { 449 ${My} 450 } 451 &.special { 452 &:hover { 453 ${Yc} 454 } 455 } 456 &.recommended { 457 &:hover { 458 ${Dy} 459 } 460 } 461 462 &.enterprise-icon { 463 will-change: transform, opacity; 464 } 465 } 466 &.active { 467 ${Ly} 468 &.special { 469 ${Yc} 470 } 471 & .enterprise-icon { 472 & .star { 473 animation: ${Vc} 2s ease-in-out infinite; 474 } 475 476 // & .arrow-right { 477 // animation: ${ba} 1.2s infinite ease-in-out; 478 // } 479 // & .arrow-middle { 480 // animation: ${ba} 1.2s infinite ease-in-out; 481 // animation-delay: 0.2s; 482 // } 483 // & .arrow-left { 484 // animation: ${ba} 1.2s infinite ease-in-out; 485 // animation-delay: 0.4s; 486 // } 487 } 488 } 489 &:not(.with-mobile):hover { 490 & .enterprise-icon { 491 & .star { 492 animation: ${Vc} 2s ease-in-out infinite; 493 } 494 495 // & .arrow-right { 496 // animation: ${ba} 1.2s infinite ease-in-out; 497 // } 498 // & .arrow-middle { 499 // animation: ${ba} 1.2s infinite ease-in-out; 500 // animation-delay: 0.2s; 501 // } 502 // & .arrow-left { 503 // animation: ${ba} 1.2s infinite ease-in-out; 504 // animation-delay: 0.4s; 505 // } 506 } 507 } 508`;se.div` 509 position: absolute; 510 top: -10px; 511 left: 12px; 512 z-index: 1; 513 & .Polaris-Badge { 514 background-color: var(--p-color-text); 515 color: var(--p-color-bg); 516 } 517`;const By=se.div` 518 position: relative; 519 height: 100%; 520 transform: translate3d(0, 0, 0); 521 backface-visibility: hidden; 522 -webkit-font-smoothing: antialiased; 523 -moz-osx-font-smoothing: grayscale; 524 background: var(--p-color-bg); 525 // overflow: hidden; 526 border-radius: var(--p-border-radius-400);
527 & .Polaris-ShadowBevel { 528 height: 100%; 529 border-radius: var(--p-border-radius-400); 530 overflow: hidden; 531 532 & > .Polaris-Box { 533 height: 100%; 534 border: none !important; 535 border-radius: var(--p-border-radius-400); 536 overflow: hidden; 537 } 538 } 539`,Hy=se.div` 540 position: absolute; 541 inset: 0; 542 border-radius: var(--p-border-radius-400); 543 pointer-events: none; 544 border-style: solid; 545 border-width: 1px; 546 border-color: var(--p-color-border); 547 &:not(.with-mobile).recommended { 548 border-width: 2px; 549 border-color: #7349e5; 550 } 551 &:not(.with-mobile).special { 552 border-width: 2px; 553 border-color: var(--p-color-bg-fill-magic-secondary); 554 } 555 &.active { 556 border-width: 2px; 557 border-color: #7349e5; 558 &.special { 559 border-color: var(--p-color-bg-fill-magic-secondary); 560 } 561 } 562`,eh=({isRecommended:t,isSpecial:s,isActive:n=!1,children:a})=>{J();const{isMobile:r}=xe(),[{transform:o},l]=ja(()=>({transform:"translateY(0px)",config:{tension:300,friction:20,mass:1}})),c=u=>{l.start({transform:u?"translateY(-4px)":"translateY(0px)",config:{tension:u?300:400,friction:20,mass:1}})};return e.jsx(Uy,{className:"relative pt-0",children:e.jsx(Fy,{className:hi(t&&"recommended",s&&"special",n&&"active",r&&"with-mobile"),onMouseEnter:()=>!r&&c(!0),onMouseLeave:()=>!r&&c(!1),style:{transform:o},children:e.jsxs(By,{children:[a,e.jsx(Hy,{className:hi(t&&"recommended",s&&"special",n&&"active",r&&"with-mobile")})]})})})},Gy=({planKey:t,className:s="0",isViewOnboarding:n=!1})=>{const{t:a}=J(),{isMobile:r}=xe(),o=()=>e.jsx("div",{className:"py-3",children:e.jsxs(m,{as:"span",variant:n?"bodyMd":"bodySm",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:n?"mb-4":"mb-3",children:e.jsx(m,{as:"span",variant:n?"bodyXs":"headingSm",children:a("CoreTools")})}),e.jsx(D,{gap:"300",children:(er[t]||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a(c)}})})]},u))})]}),(Xn[t]||[]).length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:n?"mb-4":"mb-3",children:e.jsx(m,{as:"span",variant:n?"bodyXs":"headingSm",children:a("AdvancedTools")})}),e.jsx(D,{gap:"300",children:(Xn[t]||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a(c)}})})]},u))})]}),e.jsx("div",{className:"text-text-link",children:(Us[t]||[]).length>0&&e.jsx(D,{gap:"300",children:(Us[t]||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:jn})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a(c)}})})]},u))})})]})}),l=()=>e.jsxs(m,{as:"span",variant:"bodySm",children:[e.jsxs("div",{className:n?"mb-4":"mb-3",children:[e.jsx("div",{className:"mb-2",children:e.jsx(m,{as:"span",variant:n?"bodyXs":"headingSm",children:a("CoreTools")})}),e.jsx(D,{gap:"200",children:(er[t]||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a(c)}})})]},u))})]}),(Xn[t]||[]).length>0&&e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"mb-2",children:e.jsx(m,{as:"span",variant:n?"bodyXs":"headingSm",children:a("AdvancedTools")})}),e.jsx(D,{gap:"200",children:(Xn[t]||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a(c)}})})]},u))})]}),e.jsx("div",{className:"text-text-link",children:n?e.jsx(Qe,{open:(Us[t]||[]).length>0,id:`show-more-highlight-${t}`,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(D,{gap:"200",children:(Us.PRO_CREDIT_TIER||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:jn})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a(c)}})})]},u))})}):e.jsx(e.Fragment,{children:(Us[t]||[]).length>0&&e.jsx(D,{gap:"200",children:(Us[t]||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:jn})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a(c)}})})]},u))})})})]});return e.jsx("div",{className:s,children:r?o():l()})},Wy=i.memo(Gy),Eo=({children:t,permissions:s,className:n="",hasOverplay:a=!1,onPermissionError:r,hideCompletely:o=!1})=>{const{getUserInfo:l}=de(),u=l()?.mkt_type==="special_guest",{hasPermission:d,isHiddenPermission:g,getActionPermissionState:h}=gs(),p=d(s);if(g&&!p||o&&!p||o&&u)return null;const x=_=>{_.stopPropagation(),_.preventDefault()},f=_=>{x(_),h(s)||r?.()};return!p||u?e.jsx("div",{className:oe("select-none ",n,a&&"opacity-80"),onClickCapture:f,onDoubleClickCapture:x,onContextMenuCapture:x,onMouseDownCapture:x,children:t}):t},Vy=({data:t,isAtOnboarding:s,isHiddenTitle:n,hasReinstall:a=!1,onChoosePlan:r,isSpecial:o,loadingCharge:l,isShowBlackFriday:c=!1,isViewOnboarding:u=!1})=>{const{t:d}=J(),{isMobile:g}=xe(),h=de(),p=h.getUserInfo(),x=h.getPricingPlan(),f=Pt(),_=ke(el),b=ke(np),v=ke(tl),y=ke(sl),C=ke(Gt),S=i.useMemo(()=>C!=="yearly"&&v&&_?.condition_value?.plans?.includes(t.key)?b:void 0,[v,_,t.key,b,C]),{getCurrentCyclePlan:j,hasRecommendPlan:A,findPlanByKey:E,getCurrentFulfillmentPlan:T,hasCurrentPlanActive:k,hasScheduledPlan:O,getNextCyclePlan:R}=zt(),P=T("AO"),w=j("AO"),{mutateAsync:N}=C0(),[K,L]=i.useState(1),W=bt(),{newLabel:H}=Ks(),Z=A(t.key),te=["STARTER_CREDIT_TIER_1","STARTER_CREDIT_TIER_2","STARTER_CREDIT_TIER_3"],ne=te.includes(t.key),B=[...x?.CREDIT||[]].sort((ve,pe)=>ve.price-pe.price)?.filter(ve=>te.includes(ve.key))||[],ie=p?.pricing_version==="29";if(ne&&B.length>0){const ve=qt(B[K].price,tt);
562t={...t,yearlyPrice:ve?.yearlyPrice,eachYearlyPrice:ve?.eachYearlyPrice,saveYearlyPrice:ve?.saveYearlyPrice,price:B[K]?.price||t.price,key:B[K]?.key||t.key,includes:t.includes.map(pe=>pe.label==="ProductsToPush"?{...pe,value:B[K]?.features?.PRODUCT_LISTING||0}:pe.label==="AICreditsMonthly"?{...pe,value:B[K]?.main_credit||0}:pe.label==="OrdersToFulfill"?{...pe,value:B[K]?.features?.ORDER_FULFILLMENT||0}:pe)}}const V=k(t.key),M=i.useMemo(()=>{if(V&&t.key==="FREE_CREDIT")return!s;if(ie)return!1;if(C==="monthly")return w===30&&V;if(C==="yearly")return w===365&&V},[V,w,C,t.key,s]),I=h.getCurrentPlan("AO")?.status,F=i.useMemo(()=>{if(s)return!1;if(I==="CANCELLED")return t.key==="FREE_CREDIT";if(!O(t.key))return!1;const ve=R("AO");return C==="monthly"?ve===30:C==="yearly"?ve===365:!1},[I,O,R,t.key,C,s]),G=E(T("AO")?.key||"")?.price??0,z=i.useMemo(()=>s||t.price===G?null:t.price>G?d("Upgrade"):d("Downgrade"),[s,t.price,G,d]),me=i.useCallback(ve=>{ve.discountCode?N({coupon_code:ve.discountCode,target_type:"app_plan",app_plan:ve.keyPlan},{onSuccess:pe=>{const{data:ze}=pe;if(ze?.error_code){const Ge=zy[ze.error_code](ve.discountCode||"");W.error(Ge)}else r(ve)}}):r(ve)},[r]),Re=i.useCallback(()=>t.key==="ENTERPRISE_CREDIT_TIER"?e.jsxs(e.Fragment,{children:[e.jsx(th,{children:e.jsx(m,{as:"h1",variant:"headingLg",children:t.name})}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:d(t.subName)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(U,{gap:"100",wrap:!1,blockAlign:"center",children:[e.jsx(m,{as:"h1",variant:"headingLg",children:t.name}),e.jsx("div",{className:oe("opacity-0 duration-300",Z&&"opacity-100"),children:e.jsx("div",{className:"[&_.Polaris-Badge]:bg-bg-surface-inverse [&_.Polaris-Badge]:text-text-brand-on-bg-fill [&_.Polaris-Badge_span]:font-semibold",children:e.jsx(Bs,{children:d("Recommended").toUpperCase()})})})]}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:d(t.subName)})]}),[t,o]),Be=()=>{if(t.key==="ENTERPRISE_CREDIT_TIER")return e.jsxs(U,{gap:"150",align:"center",blockAlign:"center",wrap:!1,children:[e.jsx(m,{as:"h1",variant:"heading3xl",children:d("Custom")}),e.jsx("div",{className:"mt-1",children:e.jsxs(m,{as:"span",variant:"bodyXs",children:["from $",Fe(bs.ENTERPRISE_CREDIT_TIER)]})})]});if(t.key==="FREE_CREDIT")return e.jsxs(U,{gap:"150",align:"center",blockAlign:"center",wrap:!1,children:[e.jsx(cs,{value:t.price,prefix:"$"}),e.jsx("div",{className:"mt-1",children:e.jsx(m,{as:"span",variant:"bodyXs",children:d("Forever")})})]});if(t.key!=="FREE"&&C==="yearly")return e.jsx(Q,{width:"100%",children:e.jsxs(U,{gap:"100",align:"space-between",blockAlign:"center",wrap:!1,children:[e.jsxs(U,{gap:"200",align:"center",blockAlign:"center",wrap:!1,children:[e.jsx(cs,{value:t.eachYearlyPrice,prefix:"$"}),e.jsxs(D,{align:"center",gap:"0",children:[e.jsxs(m,{as:"span",textDecorationLine:"line-through",children:["$",Fe(t.price)]}),e.jsx(m,{as:"span",variant:"bodySm",children:d("PerMonth").toLowerCase()})]})]})," ",s&&e.jsx("div",{className:"[&_.Polaris-Badge]:bg-bg-fill-success-secondary [&_.Polaris-Badge]:text-text-success",children:e.jsx(wt,{children:"3-month off"})})]})});if(v&&_?.condition_value?.plans?.includes(t.key)){const ve=y.type==="fixed_amount"?y.value:t.price*y.value/100>y.max_discount_amount?y.max_discount_amount:t.price*y.value/100;let pe=t.price-ve;return pe<0&&(pe=0),e.jsx(Q,{width:"100%",children:e.jsxs(ft,{columns:s?"minmax(0, 1fr) auto":"6fr",gap:"050",children:[e.jsxs(U,{gap:"200",align:"start",blockAlign:"center",wrap:!1,children:[e.jsx(cs,{value:pe,prefix:"$",propsText:{tone:"magic"}}),e.jsxs(D,{align:"center",gap:"0",children:[e.jsxs(m,{as:"span",textDecorationLine:"line-through",children:["$",Fe(t.price)]}),e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"medium",truncate:!0,children:["per month for ",y.target_cycle," months"]})]})]})," ",s&&e.jsx(Q,{children:e.jsx(Q,{background:"bg-fill-magic-secondary",borderRadius:"200",paddingBlock:"050",paddingInline:"100",children:e.jsxs(m,{as:"span",variant:"bodySm",tone:"magic",children:[t.price-pe===0?100:Vt((t.price-pe)/t.price*100),"% OFF"]})})})]})})}return e.jsxs(e.Fragment,{children:[e.jsx(cs,{value:t.price,prefix:"$"}),e.jsxs(D,{align:"center",children:[e.jsx(m,{as:"span",variant:"bodyXs",children:"Â "}),e.jsx(m,{as:"span",variant:"bodyXs",children:d("PerMonth").toLowerCase()})]})]})},De=i.useMemo(()=>{const ve=E(t.key);return s&&(a||Number(P?.id)===Number(ve?.id))},[s,E,a]),ot=()=>!s&&F?e.jsx(Eo,{permissions:[Te.VIEW_ACTION_CHANGE_PLAN],children:e.jsx("div",{className:"w-full [&_.Polaris-Button]:!bg-[#ffe9d0] [&_.Polaris-Button]:!text-[#8a5300] [&_.Polaris-Button]:!shadow-none",children:e.jsx(re,{variant:"primary",disabled:!0,fullWidth:!0,size:"large",children:d("Scheduled")})})}):e.jsx(Eo,{permissions:[Te.VIEW_ACTION_CHANGE_PLAN],children:e.jsx(re,{variant:t.key==="FREE_CREDIT"?u?"primary":void 0:"primary",disabled:s?!1:M&&!De,fullWidth:!0,onClick:()=>{me({keyPlan:t.key,isYearly:C==="yearly",isTrial:c,isRechargePlan:M&&De,discountCode:S})},loading:l,size:"large",children:M?d(De?"ContinueThisPlan":"YouAreHere"):t.key==="FREE_CREDIT"?d("StartForFree"):z||d("ChooseThisPlan")})});return e.jsxs("div",{style:{zIndex:1},children:[!n&&e.jsx("div",{className:"",children:e.jsx(D,{gap:"025",children:Re()})}),e.jsx("div",{className:g?"my-2":"my-4",children:e.jsx(U,{blockAlign:"center",gap:"100",align:n?"center":"start",wrap:!1,children:e.jsx("div",{className:"w-full flex gap-1",children:Be()})})}),e.jsx("div",{className:"mt-4",children:e.jsx(m,{as:"span",variant:"bodySm",children:e.jsx(D,{gap:"300",children:t.includes.map((ve,pe)=>e.jsxs(U,{gap:"100",wrap:!1,align:"space-between",children:[e.jsx(m,{as:"span",fontWeight:"medium",children:d(H[ve.label])}),e.jsxs(m,{as:"span",fontWeight:"semibold",variant:"bodyLg",children:[typeof ve.value=="number"?Fe(ve.value):ve.value,ve.subfixValue]})," "]},pe))})})}),e.jsx("div",{className:"mt-4",style:{width:"100%"},children:t.key==="ENTERPRISE_CREDIT_TIER"?e.jsx(e.Fragment,{children:M?e.jsx(re,{variant:"primary",disabled:s?!1:M&&!De,fullWidth:!0,onClick:()=>{},loading:l,size:"large",children:d(M?De?"ContinueThisPlan":"YouAreHere":"ContactUs")}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-2",children:e.jsxs(re,{variant:"primary",disabled:s?!1:M&&!De,fullWidth:!0,onClick:()=>{me({keyPlan:"ENTERPRISE_CREDIT_TIER",isYearly:C==="yearly",isTrial:!1,isRechargePlan:!1})},loading:l,size:"large",children:[d("Choose")," ",t.name?.toUpperCase()]})}),e.jsx(re,{disabled:s?!1:M&&!De,fullWidth:!0,onClick:()=>{f.openChat()},loading:l,size:"large",children:d(M?De?"ContinueThisPlan":"YouAreHere":"ContactUs")})]})}):ot()})]})},Yy=i.memo(Vy);se.div` 563 & .Polaris-Badge { 564 background-color: var(--p-color-text); 565 color: var(--p-color-bg); 566 } 567`;const th=se.div` 568 & .Polaris-Text--root { 569 background: linear-gradient(88deg, #10245a 1.73%, #695edf 25.2%, #4477ed 46.89%, #5737e6 60.27%); 570 background-clip: text; 571 -webkit-background-clip: text; 572 -webkit-text-fill-color: transparent; 573 } 574`,zy={COUPON_CODE_NOT_FOUND:t=>`Coupon code '${t}' not found.`,COUPON_CODE_EXPIRED:t=>`Coupon code '${t}
574' is not valid or has expired.`,COUPON_CODE_LIMIT_REACHED_FOR_USER:t=>"You have reached the usage limit for this coupon.",COUPON_CODE_NOT_ACTIVE:t=>"The discount associated with this coupon is no longer active.",COUPON_CODE_LIMIT_REACHED:t=>"This coupon has reached its total usage limit.",COUPON_CODE_NOT_MEET_REQUIREMENTS:t=>"This order does not meet the requirements for this coupon."},ii=t=>{const{onChoosePlan:s,isAtOnboarding:n=!1,hasReinstall:a=!1,loadingCharge:r}=t,{packages:o,freePackage:l}=Ks(),c=ke(Gt),{isMobile:u}=xe(),{t:d}=J(),{hasRecommendPlan:g,findPlanByKey:h}=zt(),{getUserInfo:p,isDemoMode:x,isTrialChargeSubcription:f,fetchCurrentPlan:_,onUpdateUserInfo:b}=de(),v=p(),[y,C]=i.useState(!1),S=Cl(),j=he(Gn),A=i.useRef(null),E=f(),T=i.useMemo(()=>{const O=o.filter(R=>R.key!=="ENTERPRISE_CREDIT_TIER");return n?Ce.isShopifyEmbedded()?O:[l,...O]:[l,...Array.isArray(O)?O:[]]},[l,o,E,v?.id]),k=async O=>{const{keyPlan:R,isYearly:P}=O;if(x()){if(R==="FREE"||R==="FREE_CREDIT"){if(y)return;C(!0),await Cs.postMetaOneTimeCharge({meta_key:""}),_(),Cs.updateValueOnboarding({key:Ut.DEMO_MODE,value:!1});const L=v.remaining_meta_keys||{};L[Ut.DEMO_MODE]=!1,b({...v,remaining_meta_keys:L}),S.success({message:d("FreePlanSelectedSuccessfully")}),C(!1),j(!1)}else A.current?.open();return}const w=h(R),N=q.upperCase(w?.name||"");w&&Cr({isAtOnboarding:n,hasReinstall:a,planDetails:{price:w?.price||0,cycle:u?P?"yearly":"monthly":c,name:N}}),s(O),ss(`pricing_${{STARTER:"starter",GROWTH:"basic",PRO:"advanced",ENTERPRISE:"premium"}[R]}_click`,{})};return u?e.jsx(Kb,{isAtOnboarding:n,onChoosePlan:k,combinedPackages:T}):e.jsx(ft,{gap:"400",columns:{xs:1,sm:2,md:2,xl:T.length,lg:T.length},children:T.map(O=>{const R=r.includes(O.key);return e.jsx("div",{children:e.jsx(To,{p:O,isAtOnboarding:n,hasReinstall:a,onChoosePlan:k,loadingCharge:R,isRecommended:g(O.key)})},O.key)})})},Ky=se.div` 575 height: 100%; 576 & > .Polaris-BlockStack { 577 height: 100%; 578 } 579 transform: translate3d(0, 0, 0); 580 backface-visibility: hidden; 581 -webkit-backface-visibility: hidden; 582`,To=t=>{const{p:s,isAtOnboarding:n,hasReinstall:a,loadingCharge:r,isRecommended:o,onChoosePlan:l}=t,{t:c}=J();ke(Gt);const u=de(),d=u.getCurrentPlan("AO"),g=u.getUserInfo(),h=g?.plan_reinstalled||g?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE",p=d?.remaining_trial_days||0,x=u.isTrialChargeSubcription()&&p>0&&cn.includes(s.key);return e.jsx(eh,{isSpecial:!1,isRecommended:o,children:e.jsx(Ln,{children:e.jsx(Ky,{children:e.jsxs(D,{gap:"300",children:[e.jsx(Yy,{isAtOnboarding:n,hasReinstall:a,isSpecial:!1,data:s,onChoosePlan:l,loadingCharge:r,isShowBlackFriday:x}),e.jsx(Wy,{planKey:s.key,data:s}),x&&(d?.remaining_trial_days||0)>0&&e.jsx("div",{className:"mt-auto p-4 py-2 pb-3 -m-4 bg-bg",children:h?e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:c("YourRemainingTrialVarDays",{var_days:p})}):e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:c("3DayFreeTrial",{var_days:p})})})]})})})})},Po=t=>{const{onChoosePlan:s}=t,{t:n}=J(),a=Pt(),{getCurrentPlan:r}=de(),o=r(),l=ke(Gt),c=["EssentialDropshippingTool","AIProductEditor","SupplierPriceStockTracking","OrderShipmentTracking","AutocorrectShippingAddress","AutoupdateStockSellingPrice","FullPricingRulesSetup"],u=["FullBulkUploadSplitProduct","FullAIImageFormatFinder"],d=["FullyUnlockAllAppSettings","MultistoreConnection","247PrioritySupport","CustomAPIERPIntegration","CustomizedFeaturesBasedOnUseCases","EnterpriselevelSLAsWithDedicatedAgent"],g=()=>{s({keyPlan:"ENTERPRISE_CREDIT_TIER",isYearly:l==="yearly",isTrial:!1,isRechargePlan:!1})};return e.jsxs("div",{className:"w-full",children:[e.jsx(m,{as:"h4",variant:"headingLg",children:n("MoreToScaleYourBusiness")}),e.jsx("div",{className:"pt-5",children:e.jsx(nt,{children:e.jsxs("div",{className:"flex gap-10",children:[e.jsxs("div",{className:"w-full",children:[e.jsxs(D,{gap:"100",children:[e.jsx(th,{children:e.jsx(m,{as:"h1",variant:"headingLg",fontWeight:"semibold",children:"Enterprise"})}),e.jsx(m,{as:"span",tone:"subdued",children:n("ForAdvancedOperations")})]}),e.jsxs("div",{className:"flex gap-2 my-4",style:{alignItems:"anchor-center"},children:[e.jsx(m,{as:"span",variant:"heading3xl",fontWeight:"bold",children:n("Custom")}),e.jsxs(m,{as:"span",variant:"bodyXs",children:[n("From").toLowerCase()," $999.9"]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("div",{children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M9.43457 3.59277C9.46218 3.60281 9.47354 3.611
58259 9.47559 3.61328L9.47754 3.61523L9.47852 3.61719C9.49341 3.64537 9.50207 3.677 9.49609 3.72949L8.80957 9.28125L8.72949 9.92969H12.8838C12.9029 9.92971 12.9147 9.93137 12.9209 9.93262C12.9247 9.93791 12.9314 9.94823 12.9395 9.96582L12.9404 9.96777C12.9506 9.99007 12.9541 10.0034 12.9551 10.0088V10.0098C12.9548 10.0104 12.9546 10.0116 12.9541 10.0127C12.9515 10.0183 12.9443 10.0307 12.9287 10.0498L6.81445 17.374C6.78562 17.4082 6.76594 17.4157 6.74902 17.4199C6.72906 17.4244 6.71129 17.4251 6.67773 17.4102L6.67578 17.4092L6.63184 17.3828C6.62241 17.3745 6.61603 17.3658 6.61035 17.3564C6.60487 17.347 6.5953 17.3301 6.60059 17.2822L7.30566 12.3633L7.39941 11.7051H3.82031C3.79597 11.7051 3.78097 11.7016 3.77539 11.7002C3.77237 11.6966 3.76562 11.6879 3.75684 11.6709C3.74923 11.6561 3.74568 11.6459 3.74414 11.6406C3.74661 11.6352 3.75248 11.6248 3.76367 11.6094L3.77148 11.5977L9.2627 3.64258C9.29739 3.59382 9.32078 3.58513 9.33398 3.58105C9.346 3.57738 9.3725 3.5703 9.43457 3.59277Z",stroke:"#4A4A4A",strokeWidth:"1.15385"}),e.jsx("path",{d:"M12.0508 7.74594C14.3318 7.74594 15.326 6.78629 15.326 4.4707C15.326 6.78629 16.3133 7.74594 18.6013 7.74594C16.3133 7.74594 15.326 8.73324 15.326 11.0212C15.326 8.73324 14.3318 7.74594 12.0508 7.74594Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.545872",strokeLinejoin:"round"}),e.jsx("path",{d:"M0.814453 13.1247C1.83443 13.1247 2.279 12.6956 2.279 11.6602C2.279 12.6956 2.72047 13.1247 3.74354 13.1247C2.72047 13.1247 2.279 13.5662 2.279 14.5892C2.279 13.5662 1.83443 13.1247 0.814453 13.1247Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.399421",strokeLinejoin:"round"})]})}),e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"bold",children:["3,000+"," ",e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:n("AICreditsMonthly")})]})]}),e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("div",{children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M13.0007 8C13.553 8 14.0007 7.55228 14.0007 7C14.0007 6.44772 13.553 6 13.0007 6C12.4484 6 12.0007 6.44772 12.0007 7C12.0007 7.55228 12.4484 8 13.0007 8Z",fill:"#4A4A4A"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.2767 3.5C10.2576 3.5 9.28235 3.91477 8.57546 4.64885L4.32185 9.06605C3.28239 10.1455 3.29855 11.8585 4.35819 12.9181L7.2561 15.816C8.21941 16.7793 9.77666 16.794 10.758 15.8491L15.5051 11.2778C16.1413 10.6651 16.5007 9.81995 16.5007 8.93673V6.75C16.5007 4.95507 15.0457 3.5 13.2507 3.5H11.2767ZM9.65594 5.68931C10.0801 5.24886 10.6652 5 11.2767 5H13.2507C14.2172 5 15.0007 5.7835 15.0007 6.75V8.93673C15.0007 9.41231 14.8072 9.86741 14.4646 10.1973L9.71751 14.7686C9.32498 15.1466 8.70208 15.1407 8.31676 14.7554L5.41885 11.8575C4.9372 11.3758 4.92985 10.5972 5.40233 10.1065L9.65594 5.68931Z",fill:"#4A4A4A"})]})}),e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"bold",children:["20,000+"," ",e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:n("ProductsToPush")})]})]}),e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("div",{children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.97553 3.5C5.6124 3.5 4.45499 4.49858 4.25522 5.84699L3.59447 10.3071C3.53158 10.7316 3.5 11.1602 3.5 11.5894V13.25C3.5 15.0449 4.95507 16.5 6.75 16.5H13.25C15.0449 16.5 16.5 15.0449 16.5 13.25V11.5894C16.5 11.1602 16.4684 10.7316 16.4055 10.3071L15.7448 5.84699C15.545 4.49858 14.3876 3.5 13.0245 3.5H6.97553ZM5.73903 6.06681C5.82983 5.4539 6.35593 5 6.97553 5H13.0245C13.6441 5 14.1702 5.4539 14.261 6.06681L14.8437 10H12.3604C11.8223 10 11.3447 10.3443 11.1745 10.8547L11.0164 11.3291C10.9824 11.4311 10.8868 11.5 10.7792 11.5H9.22076C9.11315 11.5 9.01762 11.4311 8.98359 11.3291L8.82547 10.8547C8.65533 10.3443 8.17766 10 7.63962 10H5.15633L5.73903 6.06681ZM5.00055 11.5C5.00018 11.5298 5 11.5596 5 11.5894V13.25C5 14.2165 5.7835 15 6.75 15H13.25C14.2165 15 15 14.2165 15 13.25V11.5894C15 11.5596 14.9998 11.5298 14.9994 11.5H12.5406L12.4394 11.8034C12.2012 12.518 11.5325 13 10.7792 13H9.22076C8.46751 13 7.79876 12.518 7.56056 11.8034L7.45943 11.5H5.00055Z",fill:"#4A4A4A"})})}),e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"bold",children:["100,000+"," ",e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:n("OrdersToFulfill")})]})]})]}),e.jsxs("div",{className:"mt-3 flex gap-3",children:[e.jsx("div",{className:"shrink-0",children:e.jsx(re,{onClick:()=>{a.openChat()},size:"large",children:n("ContactUs")})}),e.jsxs(re,{disabled:o?.package?.modules?.[0]?.key==="ENTERPRISE_CREDIT_TIER",variant:"primary",onClick:g,size:"large",fullWidth:!0,children:["â ",n("GetEnterprisePlan")]})]})]}),e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"p-3 px-2 bg-bg-fill-active rounded-[12px] space-y-2.5",children:c.map((h,p)=>e.jsxs(U,{gap:"100",wrap:!1,children:[e.jsx("div",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",variant:"bodySm",children:n(h)})]},p))})}),e.jsx("div",{className:"w-full",children:e.jsxs("div",{className:"p-3 px-2 bg-bg-fill-active rounded-[12px] space-y-2.5",children:[u.map((h,p)=>e.jsxs(U,{gap:"100",wrap:!1,children:[e.jsx("div",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",variant:"bodySm",children:n(h)})]},p)),e.jsx("div",{className:"text-text-link space-y-2.5",children:d.map((h,p)=>e.jsxs(U,{gap:"100",wrap:!1,children:[e.jsx("div",{children:e.jsx(ee,{source:jn})}),e.jsx(m,{as:"span",variant:"bodySm",children:n(h)})]},p))})]})})]})})})]})},zc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAsCAYAAADYQc64AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAxgSURBVHgB5VpprE1ZGt37eubp0YY2pRAxRrrMhKgnjUqIOYYfNIKYvQqiRDfPVKXFUDyFxPge/iB0JyRipn+YiuofaN2JpIVHzPNw7z3nnt1rbXtf+x3PVN6A3snOuWe6Z+9117e+tb9zpSji1qxZs+8ikUhGIpGoqJSS6II9CAJuFS6RZj/5Wb1syWvdzsZ77dZca89L91607Xj29+XKlbvdoUOHOMai5s6dq29OEUXUvkbD4DYDkK9939eTtpO3W/EKCCHyBigJBlsYHAcMFzx+fw62058+ffqPChUqxDzPi+zcuTMCYBL2u6QoxMaBtWjRIhUfvwMgGQ4zXJbYiblseRt7xNtYFAKJPevFixcrAcYDnPLQY1WrVo1Vq1YtfvHiRQKjwYmIQmoGlDRs/2lBwVaFJ1G+fHlRs2ZNIXKzJfkdeYBiv0Paa9xuwwotB8wcGovFfihWrNgj7Adly5ZNgDHqzp07+iEII2W/p8CB4eA6depUCaCswCCPotd1BvzaL9ykSROxbds2gbgPT1KGQyqkG2FmJDt+gMxnz571BjCnpJQ+e5kyZXzoi//48WOvbt26CbAmyMjISP4KxUQBNg66TZs2adFodB8G/a2Jb4Uuw0JpJ5uTkyNr1aol2rVrJ44fPy7eoisyDFoebDmDkJmAvjcej78AQH7x4sUJiJeSkhJ/8uQJQ8l7+PBhYsSIEUFaWpoAaC+/XBRQw0NS8WtsxuD6cvLmF86lEc6vnmuiCCe1d+9eOX36dHHy5El3ovY+C6pyQ8gB8DFZgrDJRg9KlSoVYMIJAkKWABTvwYMHPq71Mc4EemCzkW35HkocaKtWrdIfPXr0XweU135VEyo687APHz5cHDt2TOzZs4fXy2nTpomlS5dqzQmDZ4Ew9woLvDl/GgzpC0CyCAYnDzDiENwYAImBJTFoC1OzN3DgQN+AosLzyE/GyPbt23+FQZElafbXtKzgZM0kVOPG
582jcWiRYtk79699bkBAwZIHps/f75YsmSJAKhi3rx5as6cORKsE8uXL7fhl2RIOLWTJficibDIJkMQvmSADxBs6PglSpTwAbRfsWLF4Ny5cxxYYEOnQIAxWpKOgWVgN9Vkm1ygOJqiTLhoME6dOqVGjhwp9+/fr6ArEiCJOnXqiKlTp4rz58+L06dPi27duqlr165pYPL6LnRqyffwJTk2bCiwz58/9wACAfFKliyZqF69ug9AeDMHKN4ECttHh1Lbtm3rAZQjGORPeFhFgGJNlLsVZlL6M+6RDKXFixcLgCM3btzIbCQBgBg9erTYsWOHWLZsmb4H14qrV69K1+MYULj/BM+bCACGApgcHGbGoY7EkJJjlSpVioN9MaRjr0GDBl79+vWJ5DtB+WhgMOi5GNg5PCjNnbjrIVwHSr0gKLNmzdKTXrBggZg9e7Y+zywEVmhNQUgKhJFCGEmEhnK+zzV8WQiXLugHoCc+uocU7BEQZJ4YmBODwMagJT615OjRowkATia9ExS2Dw4lDgzrCmrIT+h/sKywAIS3w4YNE7t37xYwUlpw6VHGjx8vTpw4oc+vW7dOf2YorV+/XmsK/IS4cOFC0ryJ3Guk62DHTFx32miJX7p0aWYcH16F6deHQfRv3LiRcDLOS3GS7z/dDwKmZ8+ele7evZuBZ6RbcXXcqwwxRB+fNGmS7Nevn9aKGTNmiMmTJ2tWUGh5AcCivlCAqSM2UynHACr7g6BvQXbJxLmHRlwTNGrUEgICk+YjbJiGk9beAPJOhoTbe4USvxv0TgMovxpQNK0dHdEAOatZPR4bPmTBrl279OQ2bdokunfvrkOH53mOemJAkG4G46PN8/8D1zoc4roA5x4Yluh1DkCJVa5cOY7PcQitB4b4YEjCYBL8FlD0YN51AVly//79DAxoihMmMg8NyWu5r6+DwKq1a9fKHj16KIghQdZgECACE77fZRz6WgCSyawC95qwlh5a4sGT+Mg0HkPpypUrCWhJAB1JGrXfCgrbGxljtKTvvXv3fsWA08NghLpyt+HQwqpVHjhwQKSnp2u7j316kySI7tYR77PQkm8BxipoifYiNGbWqAGoGC6P0pcAFM0SlA40Q2wXH9HyZAxZAkXfROfqgKEcqgvHwOmJ1KhRg6aN7BCHDh0SCxcu1EbNsoe+Zfv27aJ27drao+zbt8/VDtfR0s6vBRu2kBkEBeDErbgiBWujduvWLR8O2zVq+naRTy0XMBwgVsLp2DJ0UkPuVeYFiO0EY8KECeLSpUtizZo1mhUrV67MBagbIpiIdM+Z559B2v0Ljl+1YQNxjlNTGDoA2gewPhaa1BDtSfQkPpIdeTVbwZOdO3euC1DIkm+cSVgw3KW+W35UJovoBr1QAEUyu1BsKbzUFDPppCBzP5R1nmL/Z9yfzVMEhFae3oQeBQyJkznIOonLly9bUFRBAGJbhOPq2LEjNYQZJ80O3mHHa4aNfoTsyM7OlkjH+hh+RbF69WrJrEPjNmXKFJt5XCF1F4T282GEzR/BCi764hBShk0Mgh+FUYsCkCg8UBy+hGyhN0gYMAsMFDaGDotH34hXZQDrTcKZx05OUj8IBI0bV8U8fvDgQW3xGT4UWGacwYMHa51hC14vIl0HG2bh+EmGDS5JMGTMoo+lAZ2S4VMSBARsURRX9R52Pj9axIROMmTyAsWyZNy4cTyvBXbVqlWqa9euGgSGDd3rkCFDdAWOYAwaNEhvQ2Ao871b4Uv6Y3vCagmzDsYTh8BqOw9PEgNLPIRO0s4XFigaGDdMXF0ZM2aMGDt2rD7WqFEj2vikVtB7bNmyResDr+FCD6lYr3WQNsWGDRtsRnIzD/dvIAX/CSn3B3iTewDFY/iwXgKjFoVRYwqOszBtU7B4qTnqfdc4+QmMdD0IUqBA9Uyf3Lp1q7Js4ZonKytLsyozM1ORKaiuSYCiWCoAzZWrHwbDZBiCadkIlb4A5ATAidsFHztYEoVRi1FL8HyvadOmWktMAanQwHAbJxbYlNyyZUtJRzpq1Cim3VwhNXPmTO1SAYreZ4kAdVJ9bMWKFVz0vVa9N/v/Big/ApRTYAjXMYEJHZ2CWSthxkHo6IK00ZKEKOImW7durdzUixWuOHz4MNkiunTpIiZOnCj69OmjDdqRI0dEr169bNEoTxsvXpUbWSvhou9nWndOnuJKMeWiD0ZN111ZoXftfGGGy9uaBEtyAQNKi82bN4vr16/rC8AUXbm3LGEWosjakAlevTVMAoNjvyDj/BkhchX7zC70JGRIHN23Ro0sgRHUhWi+uvhUQGGTeN8TmBSdzEBDhw4V/fv3F6jJusZMb5F1FF2tUnm+xqCdXwMmZLO8CJZw4eeFq/Oopr1X3bUoW0SFqvcEBsZNn2QdxTmvwTGgJKv7hiW87xcwoT8qblnMMiwxokXBkKhJwVGAoqvz+DH8s2fP+p8qKGyyefPmQSgz6c/2jSCWCsqWBoQBwgLFA9QSeJJFmPTfzILPt+JqWUKjZitqFFdbGvhUQWFLCTEmuaADMxQqbpYZVj9yAQRQ/g5A/sqKGkEAQywgHtIy1za6Og+N4vsbhfdGBb7Gya8m4RlU2OQFb/jXgZOCtZ2/ffv2KQoo3/YxdJC5PGQhvgb1sNbxWYhmCiYgwqwjP6TuWpQtxZlsUmiFKZW64moaRXoL2LAKqfchxZUZxtRdfbBDexKud1CfCczfKpR5xmcDCluuUBKvAJIuYGzY5iBUZoEJ9h8DAT0JTRo7LtEAsZBElrA6b0zfJ60lb2qyYcOGQTjtOnUX63FWw6QxVT1A2HDRF7CAhLBJUFz5DwIWorHgY8jYzvbZAWJbipthVKj4hM9nECKLUPf9F30HPQndK04lqCMIGx06rKjhtYUOG/EKlM+6SZgt60NcraFRWwVPwrprwEyDz26txLMvyG2t5HNIwR/SIq4vMT7mNMS1DzLOZjo0soTFaIaOa9SqVKmiayXUErvG+VJAYYs44UOW/Hjz5s1hAOYq1zYIG10rYWkADIniehaQ9L+QTGlAr3O+JEBsYzFc/9kGoTITYnqNocOsg+MJsCRZGqBRq1evns9/DIApuswoCvlfn4XaUHAaj00D9ProX8G+18L299CP36GiVgEvyMtgvwRChiDyBV3SDX/JLYL30QeYWcy7YKbgeGpqapR/yTLVeR7XvkS8zDpFVlUr1AZQNEuQcapjtzK6ZgmyVUl8ToGGRFTukuX/RfsfFkA38hoW3JIAAAAASUVORK5CYII=",El=t=>ge.sessionStorage.get(t)?!1:(ge.sessionStorage.set(t,"1"),!0),Qy=()=>El(tn.OB_SETUP_STARTED),qy=()=>El(tn.OB_PLAN_VIEWED),Zy=()=>El(tn.OB_SETUP_COMPLETED),Xy=()=>{Qy()&&Ke.trackingEventUsersAction({event_name:$.ONBOARDING_SETUP_STARTED})},Jy=t=>{Zy()&&Ke.trackingEventUsersAction({event_name:$.ONBOARDING_SETUP_COMPLETED,event_data:t})},Io=t=>{Ke.trackingEventUsersAction({event_name:$.ONBOARDING_SETUP_FAILED,event_data:t})},sh=()=>{qy()&&Ke.trackingEventUsersAction({event_name:$.ONBOARDING_PLAN_VIEWED})},$y=t=>{Ke.trackingEventUsersAction({event_name:$.ONBOARDING_PLAN_SELECTED,event_data:t})},eC=t=>{const{isNewUI:s=!1,isShowNewUI:n=!1}=t,{t:a}=J(),r=ke(Rn),[o,l]=i.useState(!1);return s?e.jsxs(e.Fragment,{children:[e.jsxs(U,{align:"space-between",wrap:!1,children:[e.jsx("div",{className:"flex items-center gap-2 pr-1 shrink-0",onClick:()=>{l(!o)},children:e.jsx(m,{as:"span",variant:"bodyXs",children:n?e.jsx(_n,{children:a("Get3monthOffWithYearlyAndMore")}):e.jsx(_n,{children:a("Enjoy3monthOffWithYearlyPlus")})})}),e.jsx(_n,{onClick:()=>{l(!o)},children:e.jsxs("div",{className:"flex items-center p-1.5 -mr-1.5",children:[e.jsx(m,{as:"span",variant:"bodyXs",fontWeight:"semibold",children:"3+"}),e.jsx(ee,{tone:"magic",source:Pn})]})})]}),e.jsx(xt,{styleContent:{maxHeight:"90%"},onClose:()=>l(!1),visible:o,placement:"bottom",title:"",zIndex:521,children:e.jsxs("div",{className:"p-4 pt-2 space-y-2",children:[e.jsx("div",{className:"mb-2.5",children:e.jsxs(U,{align:"space-between",children:[e.jsx("div",{className:"flex items-center gap-2 pr-2 shrink-0",children:e.jsx(m,{as:"span",variant:"bodyXs",children:e.jsx(_n,{children:a("Enjoy3monthOffWithYearlyPlus")})})}),e.jsx(_n,{onClick:()=>{l(!o)},children:e.jsx("div",{className:"flex items-center p-1.5 -mr-1.5",children:e.jsx(ee,{tone:"magic",source:Rs})})})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:e.jsx(ee,{source:kr})}),e.jsx(m,{as:"span",variant:"bodySm",children:a("1time5CreditsBonus")})]}),r==="AO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:e.jsx(ee,{source:kr})}),e.jsx(m,{as:"span",variant:"bodySm",children:a("1timeRedeemUnusedCreditsOption")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:e.jsx(ee,{source:kr})}),e.jsx(m,{as:"span",variant:"bodySm",children:a("Extra05BonusOnTopupCashback")})]})]})]})})]}):e.jsxs("div",{className:"flex items-center gap-4",style:{flexWrap:"wrap"},children:[e.jsxs("div",{className:"flex items-center gap-2 pr-7 shrink-0",children:[e.jsx(Qp,{}),e.jsx(m,{as:"span",variant:"headingSm",children:e.jsx(_n,{children:a("Enjoy3monthOffWithYearlyPlus")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:e.jsx(ee,{source:kr})}),e.jsx(m,{as:"span",variant:"bodySm",children:a("1time5CreditsBonus")})]}),e.jsxs("ul",{className:"list-disc pl-4 space-y-3",children:[e.jsx("li",{children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{as:"span",variant:"bodyMd",children:e.jsx(_n,{children:a("1time5CreditsBonus")})})})}),e.jsx("li",{children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{as:"span",variant:"bodyMd",children:e.jsx(_n,{children:a("1timeRedeemUnusedCreditsOption")})})})}),e.jsx("li",{children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{as:"span",variant:"bodyMd",children:e.jsx(_n,{children:a("Extra05BonusOnTopupCashback")})})})})]})]})},_n=se.div` 583 background: linear-gradient(88deg, #10245a 1.73%, #695edf 25.2%, #4458ed 46.89%, #5737e6 60.27%); 584 background-clip: text; 585 -webkit-background-clip: text; 586 -webkit-text-fill-color: transparent; 587`,tC=({data:t,planKey:s,className:n="0",showOnlyHightlight:a=!1,isViewOnboarding:r=!1,dataSelected:o})=>{const{t:l}=J(),{isMobile:c}=xe();return e.jsx("div",{className:n,children:c?e.jsx("div",{className:"py-3",children:e.jsxs(m,{as:"span",variant:r?"bodyMd":"bodySm",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:r?"mb-4":"mb-3",children:e.jsx(m,{as:"span",variant:r?"headingXs":"headingSm",children:l("CoreTools")})}),e.jsx(D,{gap:"300",children:(er[s]||[]).map((u,d)=>e.jsx("div",{id:`data-index-${s}-${d}`,children:e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:l(u)}})})]},d)},d))})]}),(ho[s]||[]).length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:r?"mb-4":"mb-3",children:e.jsx(m,{as:"span",variant:r?"headingXs":"headingSm",children:l("Scale")})}),e.jsx(D,{gap:"300",children:(ho[s]||[]).map((u,d)=>e.jsx("div",{id:`data-index-${s}-${d}`,children:e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:l(u)}})})]},d)},d))})]}),e.jsx("div",{className:"text-text-link",children:(Us[s]||[]).length>0&&e.jsx(D,{gap:"300",children:(Us[s]||[]).map((u,d)=>e.jsx("div",{id:`data-index-${s}-${d}`,children:e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:jn})}),e.jsx(m,{as:"span",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:l(u)}})})]},d)},d))})})]})}):e.jsx(m,{as:"span",variant:"bodyMd",children:Object.entries(o).map(([u,d],g)=>{const h=(d.features||[]).filter(p=>p.planSupported.includes(s));return h.length<=0?null:e.jsxs("div",{className:g>0?"mt-4":"",children:[e.jsx("div",{className:"mb-2 animate-left-to-right",children:e.jsx(m,{as:"span",variant:r?"headingXs":"headingSm",children:l(d.title)})}),e.jsx(D,{gap:"200",children:h.map((p,x)=>{const f=!p.selected&&p.planSupported.includes(s);return e.jsx("div",{className:oe(f?"text-text-disabled":"text-text","animate-left-to-right"),style:{animationDelay:`${x*80}ms`},id:`data-index-${u}-${s}-${x}`,children:e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:l(p.label)})]})},x)})})]},g)})})})};i.memo(tC);const sC=t=>{const{data:s,isAtOnboarding:n,hasReinstall:a,loadingCharge:r,onChoosePlan:o,isFixed:l=!0,isMigratedPlan:c=!1}=t;Pt();const{t:u}=J(),{hasCurrentPlanActive:d,findPlanByKey:g,getCurrentFulfillmentPlan:h,getCurrentCyclePlan:p}=zt(),x=h("AO"),f=p("AO"),_=ke(Gt),b=de(),v=b.getCurrentPlan(),y=v?.provider_payment==="PADDLE_BILLING"&&f===365,C=b.getUserInfo();C?.plan_reinstalled||C?.first_cycle_charge_type;const S=v?.remaining_trial_days||0,j=b.isTrialChargeSubcription()&&S>0&&_==="monthly"&&cn.includes(s.key);he(In);const A=i.useMemo(()=>{const O=g(s.key);return n&&(a||Number(x?.id)===Number(O?.id))},[n,g,a,s]),E=d(s.key),T=i.useMemo(()=>
587{if(E&&s.key==="FREE_CREDIT")return!n;if(c)return!1;if(_==="monthly")return f===30&&E;if(_==="yearly")return f===365&&E},[E,f,_,s.key,n]),k=i.useCallback((O=!1)=>s.key==="FREE_CREDIT"?u("Free").toLowerCase():`$${O?s.eachYearlyPrice:j?0:s.price}`,[s.key,s.price,s.eachYearlyPrice,j,u]);return e.jsx(Q,{zIndex:"50",background:"bg-surface",position:l?"fixed":void 0,insetInlineEnd:"0",insetInlineStart:"0",insetBlockEnd:"0",children:e.jsxs(D,{children:[["FREE_CREDIT"].includes(s.key)===!1&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"p-4 py-2 pb-0 -mb-2 border-t border-border-secondary",children:e.jsx(eC,{isNewUI:!0})})}),e.jsxs("div",{className:oe("p-4",["FREE_CREDIT"].includes(s.key)&&"border-t border-border-secondary"),children:[s.key==="ENTERPRISE_CREDIT_TIER"&&e.jsxs("div",{className:"gap-2 flex",children:[e.jsx(vn,{className:"justify-center relative py-[3px] h-[48px]",disabled:n?!1:T&&f===30&&!A,fullWidth:!0,onClick:()=>{o({keyPlan:"ENTERPRISE_CREDIT_TIER",isYearly:!1,isTrial:!1,isRechargePlan:!1})},loading:r.includes(s.key),size:"large",isTruncate:!1,children:A&&f===30?u("ContinueThisPlan"):T&&f===30?u("YouAreHere"):e.jsxs("div",{className:"relative",children:[j&&!r.includes(s.key)&&e.jsx("img",{className:"absolute -left-3 z-10 -top-[6px] ",src:zc}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{children:e.jsxs(m,{as:"span",variant:"bodyXs",children:[u("Monthly")," ",u("Plan").toLowerCase()," "]})}),e.jsxs("div",{className:"flex gap-0.5 items-baseline justify-center",children:[j&&e.jsxs(m,{variant:"bodyXs",tone:"disabled",as:"span",textDecorationLine:"line-through",children:["$",s.price]}),e.jsx("b",{className:"mx-1",children:k(!1)})," "]}),e.jsx("span",{children:j&&e.jsx(m,{as:"span",variant:"bodyXs",tone:"disabled",children:e.jsx("span",{className:"msui-text-1-line",children:u("3DaysFullAccess")})})})]})]})}),e.jsx(vn,{variant:"primary",disabled:n?!1:T&&f!==30&&!A,fullWidth:!0,onClick:()=>{o({keyPlan:"ENTERPRISE_CREDIT_TIER",isYearly:!0,isTrial:!1,isRechargePlan:!1})},loading:r.includes(s.key),size:"large",className:"justify-center py-[3px] h-[48px]",children:A&&f!==30?u("ContinueThisPlan"):T&&f!==30?u("YouAreHere"):e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{children:e.jsxs(m,{as:"span",variant:"bodyXs",children:[u("Yearly")," ",u("Plan").toLowerCase()," "]})}),e.jsxs("div",{className:"-mt-0.5",children:[e.jsx("b",{children:k(!0)}),"/",u("Month").toLowerCase()]})]})})]}),s.key==="FREE_CREDIT"&&e.jsx(vn,{disabled:n?!1:T&&!A,fullWidth:!0,onClick:()=>{o({keyPlan:s.key,isYearly:!1,isTrial:!1})},loading:r.includes(s.key),size:"large",className:"justify-center h-[44px]",children:u(T?A?"ContinueThisPlan":"YouAreHere":"StartForFree")}),["FREE_CREDIT","ENTERPRISE_CREDIT_TIER"].includes(s.key)===!1&&e.jsxs("div",{className:"gap-2 flex",children:[e.jsx(vn,{className:oe("justify-center relative py-[3px] h-[48px]",n&&j&&"h-[60px]"),disabled:(n?!1:T&&f===30&&!A)||y,fullWidth:!0,onClick:()=>{o({keyPlan:s.key,isYearly:!1,isTrial:j,isRechargePlan:A&&f===30})},loading:r.includes(s.key),size:"large",isTruncate:!1,children:A&&f===30?u("ContinueThisPlan"):T&&f===30?u("YouAreHere"):e.jsxs("div",{className:"relative",children:[j&&!r.includes(s.key)&&e.jsx("img",{className:"absolute -left-3 z-10 -top-[6px] ",src:zc}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{children:e.jsxs(m,{as:"span",variant:"bodyXs",children:[u("Monthly")," ",u("Plan").toLowerCase()," "]})}),e.jsxs("div",{className:"flex gap-0.5 items-baseline justify-center",children:[j&&e.jsxs(m,{variant:"bodyXs",tone:"disabled",as:"span",textDecorationLine:"line-through",children:["$",s.price]}),e.jsx("b",{className:"mx-1",children:k(!1)})," "]}),e.jsx("span",{children:j&&e.jsx(m,{as:"span",variant:"bodyXs",tone:"disabled",children:e.jsx("span",{className:"msui-text-1-line",children:u("3DaysFullAccess")})})})]})]})}),e.jsx(vn,{variant:"primary",disabled:n?!1:T&&f!==30&&!A,fullWidth:!0,onClick:()=>{o({keyPlan:s.key,isYearly:!0,isTrial:!1,isRechargePlan:A&&f!==30})},loading:r.includes(s.key),size:"large",className:oe("justify-center py-[3px] h-[48px]",n&&j&&"h-[60px]"),children:A&&f!==30?u("ContinueThisPlan"):T&&f!==30?u("YouAreHere"):e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{children:e.jsxs(m,{as:"span",variant:"bodyXs",children:[u("Yearly")," ",u("Plan").toLowerCase()," "]})}),e.jsxs("div",{className:"-mt-0.5",children:[e.jsx("b",{children:k(!0)}),"/",u("Month").toLowerCase()]})]})})]})]})]})})};function nC(t){const{dataPackages:s,filterFeatures:n,isTryForFreeOb:a=!1,isAtOnboarding:r=!1,loadingCharge:o="",onSelectPlan:l}=t,[c,u]=i.useState(s.map((x,f)=>f<3)),d=s.filter((x,f)=>c[f]===!0),[g,h]=i.useState(d[0]),p=x=>{h(x)};return i.useEffect(()=>{if(a){const x=s.find(f=>f.key.includes("FREE_CREDIT"));x&&h(x)}else{const x=s.find(f=>f.key.includes("GROWTH"));x&&h(x)}},[a]),e.jsxs(e.Fragment,{children:[e.jsx(D,{gap:"200",children:e.jsx("div",{className:"overflow-x-auto my-1.5 mr-2",children:e.jsxs("table",{className:"min-w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"font-semibold text-gray-700 p-2 bg-white z-10",style:{position:"sticky",left:0,background:"white",boxShadow:"2px 0 4px -2px #eee"},children:e.jsx(m,{as:"span",variant:"bodySm",children:e.jsx("div",{style:{width:"150px"},children:"Features"})})}),d.map(x=>e.jsx("th",{className:oe("font-semibold p-2",g!==null&&g?.key===x.key?"text-[#5546FF]":"text-gray-400",g!==null&&g?.key===x.key&&"bg-bg-surface-info rounded-t-md"),onClick:()=>{p(x)},children:e.jsx(m,{as:"span",variant:"bodySm",children:e.jsx("span",{className:"whitespace-nowrap",children:x.name})})},x.key))]})}),e.jsx("tbody",{children:n.map((x,f)=>e.jsx(i.Fragment,{children:x.content?.map((_,b)=>e.jsxs("tr",{children:[e.jsx("td",{className:oe("p-2 py-1.5 bg-white z-10",(f<4,"text-gray-700")),style:{position:"sticky",left:0,boxShadow:"2px 0 4px -2px #eee"},children:e.jsx(m,{as:"span",variant:"bodySm",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:_.title}}
587)})}),_.columns?.map((v,y)=>{const C=v.value_mobile||v.value;return c[y]?e.jsx("td",{className:oe(`py-1.5 text-center ${g!==null&&g?.key===s[y]?.key?"text-[#5546FF] font-semibold":"text-gray-400"} `,g?.key===s[y]?.key&&"bg-bg-surface-info",g?.key===s[y]?.key&&f===n.length-1&&b===x.content.length-1&&"rounded-b-md"),onClick:()=>{p(s[y])},children:e.jsx(m,{as:"span",variant:"bodySm",children:e.jsx("span",{className:"whitespace-nowrap",children:v.value==="tick"?e.jsx("span",{className:"font-bold",children:"â"}):typeof C=="number"?Fe(C):C})})},y):null})]},b))},f))})]})})}),e.jsxs("div",{className:"z-50 fixed bottom-0 left-0 right-0 w-full bg-white shadow border-t border-border",style:{bottom:"var(--shopify-safe-area-inset-bottom, 0px)"},children:[e.jsx("div",{className:"overflow-auto py-3 pb-2.5",children:e.jsx("div",{className:"flex px-4 mb-0",children:s.map((x,f)=>e.jsx("div",{className:"mr-4",children:e.jsx(Sn,{checked:c[f],label:x.name,onChange:_=>{const b=[...c];b.filter(y=>y===!0).length===1&&_===!1||(b[f]=!b[f],u(b))}})},x.key))})}),e.jsx($e,{}),e.jsx(sC,{data:g,isAtOnboarding:r,hasReinstall:!1,loadingCharge:o?[o]:[],onChoosePlan:l,isFixed:!1})]})]})}const aC=Ei` 588 @media (min-width: 65em) { 589 .Polaris-Modal-Dialog__Modal.Polaris-Modal-Dialog--sizeFullScreen { 590 max-width: 95rem; 591 } 592 } 593 .Polaris-Modal-Dialog > .Polaris-Modal-Dialog__Modal.Polaris-Modal-Dialog--sizeFullScreen{ 594 & .Polaris-Modal__Body { 595 border-bottom-left-radius: var(--p-border-radius-400) !important; 596 border-bottom-right-radius: var(--p-border-radius-400) !important; 597 } 598 } 599`,Kc=se.table` 600 width: 100%; 601 border-collapse: separate; 602 border-spacing: 0; 603 td, 604 th { 605 &.border-right { 606 border-right: 1px solid #dfe3e8; 607 } 608 } 609`,Ki=se.th` 610 text-align: left; 611 border-bottom: 1px solid #dfe3e8; 612 // background: var(--p-color-bg-surface-secondary); 613 background: #fff; 614 position: sticky; 615 top: 0; 616 z-index: 2; 617 padding-left: var(--p-space-400); 618 padding-right: var(--p-space-400); 619`,Qc=se.td` 620 padding: 16px; 621 border-bottom: 1px solid #dfe3e8; 622 // vertical-align: top; 623 text-align: ${({align:t="left"})=>t}; 624 ${t=>t.isFeatureTitle&&` 625 z-index: 1; 626 background: var(--p-color-bg-surface); 627 width: 250px; 628 font-weight: 500; 629 position: sticky; 630 left: 0; 631 `} 632`,rC=se.tr` 633 background: var(--p-color-bg-surface-secondary); 634 635 td { 636 padding: 12px 16px; 637 border-bottom: 1px solid #dfe3e8; 638 } 639`,qc=i.forwardRef(({onChoosePlan:t,hasReinstall:s=!1,isTryForFreeOb:n=!1,isAtOnboarding:a=!1,loadingCharge:r},o)=>{const{features:l,packages:c,freePackage:u}=Ks(),{t:d}=J(),g=Pt(),h=de(),{isMobile:p}=xe(),[x,f]=i.useState(!0),{getCurrentCyclePlan:_,hasRecommendPlan:b,hasCurrentPlanActive:v,findPlanByKey:y}=zt(),C=_("AO"),S=ke(Gt),j=Oe.useRef(null),A=Oe.useRef(null),E=Oe.useRef(null),[T,k]=i.useState(0),[O,R]=i.useState(0),P=h.getUserInfo(),w=h.getCurrentPlan("AO");P?.plan_reinstalled||P?.first_cycle_charge_type;const N=P?.pricing_version==="29",K=w?.remaining_trial_days||0;i.useLayoutEffect(()=>{let M=0;const I=()=>{const z=A.current?.offsetHeight||0,me=E.current?.offsetWidth||0;k(Re=>Re===z?Re:z),me>0&&R(Re=>Re===me?Re:me)},F=()=>{cancelAnimationFrame(M),M=requestAnimationFrame(I)};I();const G=new ResizeObserver(F);if(E.current&&G.observe(E.current),A.current&&G.observe(A.current),j.current){G.observe(j.current);const z=j.current.closest(".Polaris-Collapsible");z&&G.observe(z)}return()=>{cancelAnimationFrame(M),G.disconnect()}},[]);const L=i.useMemo(()=>M=>{const I=v(M);return a&&M==="FREE_CREDIT"?!1:M==="FREE_CREDIT"&&I?!0:S==="monthly"?C===30&&I:S==="yearly"?C===365&&I:!1},[C,a,S]),W=i.useMemo(()=>[u,...c],[c]);i.useImperativeHandle(o,()=>({open:()=>{f(!x)},close:()=>f(!1),showAllFeature:()=>{f(!0)}}));const H=async(M,I=!1)=>{const F=y(M),G=q.upperCase(F?.name||"");F&&Cr({isAtOnboarding:a,hasReinstall:s,planDetails:{price:F?.price||0,cycle:S,name:G}}),t({keyPlan:M,isTrial:I,isYearly:S==="yearly"})},Z=M=>{M.target.scrollLeft>0?M.target.querySelectorAll("tr td:first-child, tr th:first-child").forEach(F=>{F.classList.add("border-right")}):M.target.querySelectorAll("tr td:first-child, tr th:first-child").forEach(F=>{F.classList.remove("border-right")}),A.current&&(A.current.scrollLeft=M.target.scrollLeft)},te=()=>e.jsx(ds,{source:Je,tone:"success"}),ne=(M,I,F,G)=>M===""&&I===""?e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 10.479C5 10.0648 5.33579 9.729 5.75 9.729H14.25C14.6642 9.729 15 10.0648 15 10.479C15 10.8932 14.6642 11.229 14.25 11.229H5.75C5.33579 11.229 5 10.8932 5 10.479Z",fill:"#CCCCCC"})})}):M==="tick"?te():M===-1?e.jsxs(e.Fragment,{children:[e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:d("Unlimited")})," ",I&&e.jsx(m,{variant:"bodySm",as:"span",children:d(I)})]}):I==="limit_viewable_import"?e.jsx(m,{variant:"bodySm",as:"span",children:d("LimitedImportedProducts",{var_limit:e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:M})})}):e.jsxs(e.Fragment,{children:[e.jsx(m,{variant:"bodySm",as:"span",fontWeight:typeof M=="number"?"semibold":"regular",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:typeof M=="number"?M.toLocaleStr
639ing("en")+(G||""):d(M)}})})," ",I&&e.jsx(m,{variant:"bodySm",as:"span",children:I==="FromMonToFri923"?e.jsx("div",{dangerouslySetInnerHTML:{__html:d(I)}}):e.jsx("div",{dangerouslySetInnerHTML:{__html:d(I)}})}),F&&e.jsxs(m,{variant:"bodyXs",tone:"subdued",as:"span",children:["(",d(F),")"]})]}),le=(M,I=!1)=>{const F=L(M),G=b(M);return F&&!N?e.jsx(Lt,{fullWidth:!0,disabled:!0,children:d("YouAreHere")}):M==="ENTERPRISE_CREDIT_TIER"?e.jsx(Lt,{fullWidth:!0,onClick:()=>{g.openChat()},children:d("ContactUs")}):M==="FREE_CREDIT"?e.jsx(Lt,{fullWidth:!0,onClick:()=>{H(M)},children:d("StartForFree")}):G?e.jsx(Lt,{disabled:r!=="",loading:r.includes(M),fullWidth:!0,onClick:()=>H(M,I),children:d("ChooseThisPlan")}):e.jsx(Lt,{disabled:r!=="",loading:r.includes(M),fullWidth:!0,onClick:()=>H(M,I),children:d("ChooseThisPlan")})},B=(M,I=!1)=>M.key==="FREE_CREDIT"?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",M.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):M.key==="ENTERPRISE_CREDIT_TIER"?e.jsx(e.Fragment,{children:e.jsx(m,{as:"h1",variant:"headingMd",children:d("Custom")})}):S==="yearly"?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"span",variant:"headingMd",children:["$",M.eachYearlyPrice]}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"disabled",textDecorationLine:"line-through",children:["$",M.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):I?e.jsx(Et,{content:e.jsx("span",{dangerouslySetInnerHTML:{__html:d("TooltipBlackFriday",{var_plan_name:M.name,var_price:M.price})}}),hasUnderline:!0,children:e.jsxs(U,{gap:"050",align:"center",wrap:!1,children:[e.jsx(m,{as:"span",variant:"headingMd",children:"$0"}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"disabled",textDecorationLine:"line-through",children:["$",M.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]})}):e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",M.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}),ie=M=>{const I=h.isTrialChargeSubcription()&&K>0&&S==="monthly"&&cn.includes(M.key);return e.jsx(Ki,{className:oe("fixed top-[0px]! bg-white z-10!",M.key==="FREE_CREDIT"&&n?"border-2 border-blue-500 rounded-t-xl":""),children:e.jsx(U,{align:"center",children:e.jsx(Q,{paddingBlock:"400",children:e.jsxs(D,{gap:"200",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodySm",alignment:"center",children:M.name}),e.jsx(U,{gap:"050",wrap:!1,children:B(M,I)})]}),e.jsx(Q,{width:"150px",children:le(M.key,I)})]})})})})},V=()=>(console.log("height",T),e.jsxs(Kc,{style:{marginTop:-T},children:[e.jsx("thead",{children:e.jsxs("tr",{className:"opacity-0",children:[e.jsx(Ki,{ref:E,className:"sticky! left-0 top-[0px]! z-11!"}),W.map(M=>e.jsx(Oe.Fragment,{children:ie(M)},M.key))]})}),e.jsx("tbody",{children:e.jsx(Oe.Fragment,{children:l.map((M,I)=>e.jsxs(Oe.Fragment,{children:[M.content.length>0&&e.jsx(rC,{children:e.jsx("td",{className:"sticky left-0 bg-[#333333]! text-white",colSpan:6,children:e.jsx("div",{className:"inline-flex",children:e.jsxs(m,{as:"h1",variant:"bodySm",fontWeight:"semibold",children:[d(M.title),":"," ",e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:d(M.description)})]})})})}),M.content.map((F,G)=>e.jsxs("tr",{className:"group",children:[e.jsx(Qc,{isFeatureTitle:!0,className:oe("group-hover:bg-[#F7F7F7]"),children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{children:e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"medium",children:e.jsx("span",{className:"inline-block text-nowrap",children:d(F.title)})})}),e.jsx(m,{as:"span",variant:"bodyXs",tone:"subdued",children:e.jsx("span",{className:"inline-block",style:{lineHeight:1.4},children:d(F.tooltip)})})]})}),F.columns.map((z,me)=>e.jsx(Qc,{className:oe("group-hover:bg-[#F7F7F7]",I===l.length-1&&G===M.content.length-1&&"border-transparent!",me===0&&n?"border-l-2 border-r-2 border-blue-500":"",me===0&&I===l.length-1&&G===M.content.length-1&&n?"border-2 border-b-2! border-t-0 border-blue-500! rounded-b-xl":""),align:"center",children:ne(z.value,z.subtitle,z.subtitleSmall,z.subfixValue)},`${F.title}-${me}`))]},F.title))]},M.key))})})]}));return p?e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"px-2",children:e.jsxs("div",{className:"rounded-xl overflow-hidden border border-border bg-white",style:{marginBottom:150},children:[e.jsx($e,{}),e.jsx(nC,{dataPackages:W,filterFeatures:l,isTryForFreeOb:n,onSelectPlan:M=>H(M.keyPlan,M.isTrial),loadingCharge:r,isAtOnboarding:a})]})})}):e.jsxs(e.Fragment,{children:[e.jsx(aC,{}),e.jsxs(Ln,{padding:"0",children:[e.jsx("div",{className:"sticky! bg-white left-0 top-[0px]! z-11!",id:"pricing-comparison-feature-header",children:e.jsx("div",{ref:A,className:"overflow-x-auto",children:e.jsx(Kc,{children:e.jsx("thead",{children:e.jsxs("tr",{className:"w-full",children:[e.jsx(Ki,{className:"align-middle sticky left-0 top-[0px]! z-11!",style:{width:O||"100%"}}),W.map(M=>e.jsx(Oe.Fragment,{children:ie(M)},M.key))]})})})})}),e.jsx("div",{className:"mb-4 overflow-x-auto",style:{maxWidth:"100%",fontSize:"13px"},ref:j,onScroll:Z,children:V()})]})]})}),Ro=t=>{const{isAtOnboarding:s=!1,isTryForFreeOb:n=!1,loadingCharge:a="",onChoosePlan:r}=t,{t:o}=J(),{isMobile:l}=xe(),[c,u]=i.useState(!l),d=i.useRef(null),g=i.useRef(null),{getCurrentPlan:h}=de(),p=h();return i.useLayoutEffect(()=>{n&&(u(!0),setTimeout(()=>{g.current?.scrollIntoView({behavior:"smooth"})},0))},[n]),i.useEffect(()=>()=>{u(!1)},[]),l?e.jsxs("div",{className:"mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 cursor-pointer",onClick:()=>u(!c),children:[e.jsx("div",{children:o("CompareAllPlans")}),e.jsx("div",{children:e.jsx(ee,{tone:"subdued",source:Ys})})]}),e.jsxs(xt,{showCloseIcon:!0,styleContent:{maxHeight:"90%"},onClose:()=>u(!1),visible:c,placement:"bottom",title:o("FullFunctions"),zIndex:176,background:"bg",children:[e.jsx($e,{}),e.jsxs("div",{className:"pb-4",children:[e.jsx("div",{className:"flex justify-center mt-3 mb-1",children:e.jsx(En,{disabled:p.provider_payment==="PADDLE_BILLING"&&p?.package?.cycle===365})}),e.jsx(qc,{isAtOnboarding:s,ref:d,loadingCharge:a,onChoosePlan:r,isTryForFreeOb:n})]})]})]}):e.jsxs(D,{children:[e.jsx("div",{ref:g,className:"pt-4",children:e.jsx("div",{className:"flex items-center cursor-pointer gap-3",children:e.jsx(m,{as:"h4",variant:"headingLg",children:o("CompareAllPlans")})})}),e.jsx("div",{id:"collapsible-how-credit-work",children:e.jsx("div",{className:"pt-5",children:e.jsx(qc,{isAtOnboarding:s,ref:d,loadingCharge:a,onChoosePlan:r,isTryForFreeOb:n})})})]})},iC=Ei` 640 @media (min-width: 65em) { 641 .Polaris-Modal-Dialog__Modal.Polaris-Modal-Dialog--sizeFullScreen { 642 max-width: 95rem; 643 } 644 } 645 .Polaris-Modal-Dialog > .Polaris-Modal-Dialog__Modal.Polaris-Modal-Dialog--sizeFullScreen{ 646 & .Polaris-Modal__Body { 647 border-bottom-left-radius: var(--p-border-radius-400) !important; 648 border-bottom-right-radius: var(--p-border-radius-400) !important; 649 } 650 } 651`,oC=se.table` 652 width: 100%; 653 border-collapse: separate; 654 border-spacing: 0; 655`,Zc=se.th` 656 text-align: left; 657 border-bottom: 1px solid #dfe3e8; 658 // background: var(--p-color-bg-surface-secondary); 659 background: #fff; 660 position: sticky; 661 top: 0; 662 z-index: 2; 663 padding-left: var(--p-space-400); 664 padding-right: var(--p-space-400); 665`,Xc=se.td` 666 padding: 16px; 667 border-bottom: 1px solid #dfe3e8; 668 vertical-align: top; 669 text-align: ${({align:t="left"})=>t}; 670 ${t=>t.isFeatureTitle&&` 671 z-index: 1; 672 background: var(--p-color-bg-surface); 673 width: 250px; 674 font-weight: 500; 675 position: sticky; 676 left: 0; 677 `} 678`,lC=se.tr` 679 background: var(--p-color-bg-surface-secondary); 680 681 td { 682 padding: 12px 16px; 683 } 684`,nh=i.forwardRef(({onChoosePlan:t,hasReinstall:s=!1,isAtOnboarding:n=!1,loadingCharge:a=""},r)=>{const{features:o,packages:l}=Ks(),{t:c}=J(),[u,d]=i.useState(!1),[g,h]=i.useState(""),{getCurrentPlan:p}=de(),x=p(),{getCurrentCyclePlan:f,hasRecommendPlan:_,hasCurrentPlanActive:b,findPlanByKey:v}=zt(),y=f("AO"),C=ke(Gt),S=i.useMemo(()=>w=>{const N=b(w);return n&&w==="FREE"?!1:w==="FREE"&&N?!0:C==="monthly"?y===30&&N:C==="yearly"?y===365&&N:!1},[y,n,C]),j=i.useMemo(()=>
684[{key:"FREE",price:0,yearlyPrice:0,eachYearlyPrice:0,name:"Free"},...l],[l]);i.useImperativeHandle(r,()=>({open:()=>d(!0),close:()=>d(!1)})),i.useCallback(w=>w.map(N=>({...N,title:c(N.title),content:N.content.map(K=>({...K,title:c(K.title),columns:K.columns.map(L=>({value:typeof L.value=="string"?c(L.value):L.value===-1?c("Unlimited"):L.value,subtitle:L.subtitle==="limit_viewable_import"?c("LimitedImportedProducts",{var_limit:L.value}):c(L.subtitle)||""}))}))})),[c]);const A=w=>{const N=v(w),K=q.upperCase(N?.name||"");N&&Cr({isAtOnboarding:n,hasReinstall:s,planDetails:{price:N?.price||0,cycle:C,name:K}}),t(w)},E=()=>e.jsx(ds,{source:Je,tone:"success"}),T=(w,N)=>w===""&&N===""?e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 10.479C5 10.0648 5.33579 9.729 5.75 9.729H14.25C14.6642 9.729 15 10.0648 15 10.479C15 10.8932 14.6642 11.229 14.25 11.229H5.75C5.33579 11.229 5 10.8932 5 10.479Z",fill:"#CCCCCC"})})}):w==="tick"?E():N==="limit_viewable_import"?e.jsx(m,{variant:"bodySm",as:"span",children:c("LimitedImportedProducts",{var_limit:e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:w})})}):w===-1?e.jsxs(e.Fragment,{children:[e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:c("Unlimited")})," ",N&&e.jsx(m,{variant:"bodySm",as:"span",children:c(N)})]}):e.jsxs(e.Fragment,{children:[e.jsx(m,{variant:"bodySm",as:"span",fontWeight:typeof w=="number"?"semibold":"regular",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:typeof w=="number"?w.toLocaleString("en"):c(w)}})})," ",N&&e.jsx(m,{variant:"bodySm",as:"span",children:N==="FromMonToFri923"?e.jsx("div",{dangerouslySetInnerHTML:{__html:c(N)}}):e.jsx("div",{dangerouslySetInnerHTML:{__html:c(N)}})})]}),k=w=>{const N=S(w),K=_(w);return N?e.jsx(Lt,{fullWidth:!0,disabled:!0,children:c("YouAreHere")}):K?e.jsx(Lt,{disabled:a!=="",loading:a.includes(w),fullWidth:!0,variant:"primary",onClick:()=>A(w),children:c("ChooseThisPlan")}):e.jsx(Lt,{disabled:a!=="",loading:a.includes(w),fullWidth:!0,onClick:()=>A(w),children:c("ChooseThisPlan")})},O=w=>w.key==="FREE"?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",w.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):C==="yearly"?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"span",variant:"headingMd",children:["$",w.eachYearlyPrice]}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"disabled",textDecorationLine:"line-through",children:["$",w.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",w.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}),R=w=>e.jsx(Zc,{children:e.jsx(U,{align:"center",children:e.jsx(Q,{padding:"400",children:e.jsxs(D,{gap:"200",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodySm",alignment:"center",children:w.name}),e.jsx(U,{gap:"050",wrap:!1,children:O(w)})]}),e.jsx(Q,{width:"150px",children:k(w.key)})]})})})}),P=()=>{d(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(iC,{}),e.jsx(bg,{open:u,onClose:P,title:c("CompareAllFeatures"),size:"fullScreen",children:e.jsxs(oC,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(Zc,{children:e.jsx(En,{disabled:x.provider_payment==="PADDLE_BILLING"&&x?.package?.cycle===365})}),j.map(w=>e.jsx(Oe.Fragment,{children:R(w)},w.key))]})}),e.jsx("tbody",{children:o.map(w=>e.jsxs(Oe.Fragment,{children:[w.content.length>0&&e.jsx(lC,{children:e.jsx("td",{colSpan:j.length+1,children:e.jsx("div",{className:"inline-flex sticky left-4",children:e.jsx(m,{as:"h1",variant:"bodySm",fontWeight:"semibold",children:w.title})})})}),w.content.map(N=>e.jsxs("tr",{className:"group",children:[e.jsx(Xc,{isFeatureTitle:!0,className:"group-hover:bg-[#F7F7F7]",children:e.jsx("div",{children:N.tooltip?e.jsx(nr,{content:N.tooltip?e.jsx($n,{keyword:g,text:N.tooltip}):"",preferredPosition:"above",hasUnderline:!0,children:e.jsx(m,{as:"span",variant:"bodySm",tone
684:"subdued",children:e.jsx($n,{keyword:g,text:N.title})})}):e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:e.jsx($n,{keyword:g,text:N.title})})})}),N.columns.map((K,L)=>e.jsx(Xc,{className:"group-hover:bg-[#F7F7F7]",align:"center",children:T(K.value,K.subtitle)},`${N.title}-${L}`))]},N.title))]},w.key))})]})})]})});nh.displayName="PricingComparisonModal";se.div` 685 background: #ffffff; 686 border-radius: var(--p-border-radius-1); 687 width: 100%; 688 max-width: 284px; 689 margin-left: auto; 690 margin-right: auto; 691`;se.div` 692 position: relative; 693 height: 37px; 694 695 &::after { 696 content: ''; 697 position: absolute; 698 width: 50%; 699 top: 0; 700 height: 100%; 701 transition: left cubic-bezier(0.88, -0.35, 0.565, 1.35) 0.4s; 702 border-radius: var(--p-border-radius-1); 703 box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1); 704 background-color: #008060; 705 z-index: 0; 706 } 707 708 &.monthly { 709 & > div:first-child { 710 color: #ffffff !important; 711 } 712 713 &::after { 714 left: 0; 715 } 716 } 717 718 &.yearly { 719 & > div:last-child { 720 color: #ffffff !important; 721 } 722 723 &::after { 724 left: 50%; 725 } 726 } 727`;se.div` 728 font-weight: 500; 729 font-size: 12px; 730 text-align: center; 731 display: inline-block; 732 width: 50%; 733 padding: 12px 0; 734 z-index: 1; 735 color: #262626; 736 position: relative; 737 cursor: pointer; 738 transition: color 200ms; 739 line-height: normal; 740 user-select: none; 741`;const cC=({disabled:t=!1})=>{const{t:s}=J(),[n,a]=be(Gt),r=i.useCallback(o=>{a(o)},[]);return e.jsx("div",{className:"msui-flex-center msui-d-none",children:e.jsx(nt,{padding:"100",children:e.jsxs(sb,{children:[e.jsx("div",{style:{minWidth:76},children:e.jsx(re,{disabled:t&&n!=="monthly",onClick:()=>r("monthly"),size:"large",fullWidth:!0,variant:n==="monthly"?"primary":"tertiary",children:s("Monthly")})}),e.jsx("div",{style:{minWidth:144},children:e.jsx(re,{disabled:t&&n!=="yearly",onClick:()=>r("yearly"),size:"large",fullWidth:!0,variant:n==="yearly"?"primary":"tertiary",children:s("YearlyFiveMonthsOff")})})]})})})};var Jc;function ko(){return ko=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ko.apply(null,arguments)}const dC=t=>i.createElement("svg",ko({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none"},t),Jc||(Jc=i.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M7 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M7 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M7 16a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M12 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M12 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M12 16a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M12 21a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M17 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M17 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M17 16a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3",clipRule:"evenodd"}))),uC=se.div` 742 position: fixed; 743 bottom: 0; 744 left: 0; 745 z-index: var(--p-z-index-10); 746 transition: transform 0.3s ease-in-out; 747 will-change: transform; 748 transform: translateY(${({open:t})=>t?"0":"100%"}); 749 border-radius: var(--p-border-radius-200); 750 background-color: var(--p-color-bg-surface); 751 box-shadow: var(--p-shadow-600); 752 753 overflow-y: ${({open:t})=>t?"hidden":"auto"}; 754 755 @media screen and (min-width: 1025px) { 756 height: calc(100vh - 60px); 757 bottom: ${({open:t})=>t?"30px":"0px"}; 758 width: ${Ua[1136].maxWidth}; 759 left: calc((100vw - (1136px + 3rem)) / 2); 760 right: calc((100vw - (1136px + 3rem)) / 2); 761 .features-plan-wrapper { 762 max-height: calc(100vh - ${({isYearly:t})=>t?365:354}px); 763 } 764 } 765 766 @media screen and (max-width: 1024px) { 767 border-bottom-left-radius: 0; 768 border-bottom-right-radius: 0; 769 width: 100vw; 770 height: calc(100vh - 30px); 771 .features-plan-wrapper { 772 max-height: calc(100vh - 263px); 773 } 774 } 775`,pC=se.div` 776 position: fixed; 777 z-index: var(--p-z-index-10); 778 top: 0; 779 right: 0; 780 bottom: 0; 781 left: 0; 782 display: block; 783 background-color: var(--p-color-backdrop-bg); 784 animation: var(--p-motion-keyframes-fade-in) var(--p-motion-duration-200) 1 forwards; 785 opacity: 0; 786 backface-visibility: hidden; 787 will-change: opacity; 788`,hC=({open:t,isLandingPage:s,title:n,onClose:a,children:r,isYearly:o=!1})=>{const l=gr();return i.useEffect(()=>{t?document.body.style.position="fixed":document.body.style.position=""},[t]),Lp.createPortal(e.jsxs(e.Fragment,{children:[t&&e.jsx(pC,{onClick:a}),e.jsxs(uC,{isYearly:o,open:t,children:[e.jsx("div",{style:{padding:16,borderBottom:l.mdUp?"1p
788x solid rgba(225, 227, 229, 1)":""},children:e.jsxs(U,{align:"space-between",children:[e.jsx("div",{style:{color:s?"#7009FF":"inherit"},children:e.jsx(m,{as:"h6",variant:"headingMd",children:n})}),e.jsx(re,{onClick:a,variant:"plain",icon:Ws})]})}),r]})]}),document.body)},gC=se.div` 789 /* width: 100%; */ 790 791 & p.Polaris-Text--root { 792 white-space: initial; 793 } 794`,Ka=se.div` 795 color: ${({isLanding:t})=>t?"#7009FF":"inherit"}; 796 min-width: ${({minWidth:t=150})=>t}px; 797 798 & .Polaris-Button { 799 /* background: ${({isLanding:t})=>t?"#262626 !important":"rgba(0, 128, 96, 1)"}; */ 800 801 &.Polaris-Button--primary.Polaris-Button--disabled { 802 background: ${({isLanding:t})=>t?"#262626 !important":"var(--p-action-primary-disabled)"}; 803 } 804 805 &:hover { 806 opacity: 0.8; 807 } 808 } 809 810 & .Polaris-Icon > svg { 811 fill: ${({isLanding:t})=>t?"#7009FF":"#262626"}; 812 } 813`,_w=i.memo(({currentKeyPackage:t,isCycleYearly:s=!1,isLandingPage:n=!1,isAtOnboarding:a=!1,statusPlan:r="",open:o,onChoosingPlan:l,onClose:c})=>{const{t:u}=J(),g=de().getUserInfo(),[h]=be(Gt),{packages:p,features:x}=Ks(),f=i.useMemo(()=>[{key:"FREE_ORDER_FULFILLMENT_2",price:0,yearlyPrice:0,eachYearlyPrice:0,name:"free"},...p],[p]),{hasCurrentPlanActive:_}=zt(),b=gr(),v=(O,R,P=!1)=>{l({key:O},R,P),c()},y=O=>{if(O)return e.jsx(Et,{zIndexOverride:999,content:u(O),children:e.jsx(ee,{source:Na,tone:"base"})})},C=({price:O,eachYearlyPrice:R,yearlyPrice:P,name:w,key:N})=>{const K=h==="yearly",L=K?R||0:O;let W="GetStarted";const H=_(N),Z=t==="FREE_ORDER_FULFILLMENT_2";return a&&h==="monthly"&&(N==="FREE_ORDER_FULFILLMENT_2"?W="GetStarted":W="Start7DayTrial"),H&&N!=="FREE_ORDER_FULFILLMENT_2"&&(W=h===(s?"yearly":"monthly")?"YouAreHere":"GetStarted"),Z&&N==="FREE_ORDER_FULFILLMENT_2"&&(W="YouAreHere"),e.jsxs(D,{align:"center",inlineAlign:"center",gap:"400",children:[e.jsxs(D,{align:"center",inlineAlign:"center",gap:"300",children:[e.jsx(m,{fontWeight:"regular",as:"h6",variant:"bodySm",children:u(at.upperCase(w))}),e.jsxs(D,{align:"center",inlineAlign:"center",children:[e.jsx("div",{style:{maxHeight:K?"20px":"0px",transition:"0.3s",overflow:"hidden",marginBottom:-4},children:O?e.jsx(ky,{children:e.jsxs(m,{tone:"subdued",fontWeight:"regular",as:"span",variant:"bodySm",children:["$",O," USD/",u("Mo").toLocaleLowerCase()]})}):e.jsx("div",{style:{height:20}})}),e.jsx(Ka,{minWidth:150,isLanding:n,style:{textAlign:"center"},children:e.jsxs(m,{fontWeight:"semibold",as:"h6",variant:"headingXl",children:["$",L," ",e.jsxs(m,{fontWeight:"regular",as:"span",tone:"subdued",variant:"bodySm",children:["USD/",u("Mo").toLocaleLowerCase()]})]})})]})]}),e.jsx(Ka,{minWidth:150,isLanding:n,children:e.jsx(re,{disabled:n?!1:N==="FREE_ORDER_FULFILLMENT_2"&&r==="CANCELLED"?!0:W==="YouAreHere",fullWidth:!0,onClick:()=>v(N,K?P:O,N==="FREE_ORDER_FULFILLMENT_2"),children:u(W)})})]})},S=({value:O="",subtitle:R,breakLine:P=!1})=>O==="tick"?e.jsx(ee,{source:Je,tone:"success"}):typeof O=="number"?e.jsxs(U,{align:"center",gap:{xs:"100"},children:[e.jsx(m,{as:"span",fontWeight:"semibold",variant:"bodyMd",children:O===-1?u("Unlimited"):O.toLocaleString()}),R?e.jsx(m,{as:"span",fontWeight:"regular",variant:"bodyMd",breakWord:!0,children:u(R).toLowerCase()}):""]}):P?e.jsxs(U,{align:"center",gap:{xs:"100"},children:[e.jsx(m,{as:"span",fontWeight:"regular",variant:"bodyMd",children:u(O)}),e.jsxs(m,{tone:"subdued",as:"span",fontWeight:"regular",variant:"bodySm",children:["(",u(R).toLowerCase(),")"]})]}):e.jsx(U,{align:"center",children:e.jsx("div",{style:{whiteSpace:"break-spaces",textAlign:"center"},children:e.jsxs(D,{gap:"050",children:[e.jsx(m,{as:"span",fontWeight:O==="Unlimited"?"semibold":"regular",variant:"bodyMd",children:u(O)}),R?e.jsxs(m,{tone:"subdued",as:"span",fontWeight:"regular",variant:"bodySm",children:["(",u(R).toLocaleLowerCase(),")"]}):""]})})}),j=[...Array(1)].map((O,R)=>e.jsxs(Rt.Row,{id:O,position:R,children:[e.jsxs(Rt.Cell,{children:[e.jsx("div",{style:{width:b?.mdDown?"30vw":"calc(268px - var(--p-space-400)*2)"}}),e.jsx(m,{fontWeight:"semibold",as:"h6",variant:"headingXl",children:u("AllFeatures")})]}),f.map((P,w)=>e.jsx(Rt.Cell,{children:e.jsx("div",{style:{width:b?.mdDown?"30vw":"calc(182px - 1rem*2"},children:C(P)})},`first-cell-${P?.key||""}-${w}`))]},O+R)),A=O=>O.map((R,P)=>e.jsxs(Rt.Row,{id:R.title,position:P,children:[e.jsx(Rt.Cell,{children:e.jsx("div",{style:{width:b?.mdDown?"30vw":"calc(268px - var(--p-space-400)*3)"},children:e.jsxs(U,{wrap:!1,gap:{xs:"100"},children:[e.jsx(gC,{children:e.jsx(m,{fontWeight:"regular",breakWord:!0,as:"p",variant:"bodyMd",tone:"subdued",children:e.jsx(Et,{zIndexOverride:999,content:u(R.title),children:e.jsxs("span",{children:[" ",u(R.title)]})})})}),R?.tooltip&&e.jsxs("div",{style:{width:20,height:20},children:[" ",y(R?.tooltip)]})]})})}),R.columns.map((w,N)=>e.jsx(Rt.Cell,{children:e.jsx("div",{style:{width:b?.mdDown?"30vw":"calc(182px - 1rem*4)"},children:S(w)})},w.value+N))]},R.title+P));let E={},T="",k={};return b.mdUp&&(T="msui-scrollbar-y",k={borderRadius:2},E={...Ua[1136],filter:"drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.05)) drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.15))",borderRadius:"8px"}),b.xlUp&&(E={},T=""),e.jsx(hC,{isYearly:h==="yearly",open:o,isLandingPage:n,onClose:()=>c(),title:u("CompareAllFeatures"),children:e.jsx("div",{style:{background:"#F6F6F7"},className:T,children:e.jsxs("div",{style:E,children:[e.jsx("div",{style:{marginBottom:b.mdDown?0:-16,position:"relative",zIndex:99},children:n?"":e.jsx(e.Fragment,{children:e.jsx(Q,{width:"100%",background:"bg-surface",padding:"400",...k,children:e.jsx(U,{align:"center",children:e.jsx(cC,{disabled:g?.first_cycle_charge_type==="CHARGE_ONE_TIME_FIRST_MONTH"})})})})}),e.jsx(Iy,{cellVerticalPadding:16,mdDown:b.mdDown,mdUp:b.mdUp,className:"msui-scrollbar-x",children:e.jsxs("div",{style:{minWidth:b.mdDown?"calc(30vw * 8 + 30px)":"none"},children:[e.jsx("div",{children:e.jsx(Rt,{condensed:b.mdDown,resourceName:{singular:"package",plural:"packages"},selectable:!1,headings:[{id:"package_1",title:""},{id:"package_2",title:""},{id:"package_3",title:""},{id:"package_4",title:""},{id:"package_5",title:""},{id:"package_6",title:""}],itemCount:1,children:j})}),e.jsxs("div",{className:"features-plan-wrapper msui-scrollbar-y hidden-scroll-bar-table",children:[n?e.jsx(Q,{width:"100%",background:"bg-surface",padding:"400",...k,children:e.jsxs(U,{align:"start",blockAlign:"center",children:[e.jsx(Ka,{isLanding:n,children:e.jsx(dC,{color:""})}),e.jsx(Ka,{style:{paddingBottom:8},isLanding:n,children:e.jsx(m,{fontWeight:"medium",as:"h6",variant:"headingSm",children:u("Feature").toLocaleUpperCase()})})]})}):"",x.map((O,R)=>e.jsx(Rt,{resourceName:{singular:"feature",plural:"features"},condensed:b.mdDown,selectable:!1,headings:[{id:`heading-${O?.key}-${R}`,title:e.jsx(U,{gap:"100",blockAlign:"center",children:e.jsx(Ka,{isLanding:O?.key==="services"?n:!1,children:e.jsx(m,{fontWeight:"semibold",as:"p",variant:"bodyMd",children:e.jsx("span",{style:{color:"rgba(48, 48, 48, 1)"},children:(O.key==="services"?e.jsx(e.Fragment,{children:u(O.title).toLocaleUpperCase()}):u(O.title))??""})})})})},{id:`subheading-${O?.key}-1`,title:""},{id:`subheading-${O?.key}-2`,title:""},{id:`subheading-${O?.key}-3`,title:""},{id:`subheading-${O?.key}-4`,title:""},{id:`subheading-${O?.key}-5`,title:""}],itemCount:at.size(O?.content),children:A(O?.content)},O?.key))]})]})})]})})})}),mC=({data:t,onChoosePlan:s,isSpecial:n,loadingCharge:a,isAtOnboarding:r})=>{const{t:o}=J(),{isMobile:l}=xe(),u=de().getCurrentPlan("PH"),d=u?.package?.cycle||30,g=ke(Gt),h=u?.package?.modules.some(b=>b.key===t.key),p=t.key==="LIGHT_CREDIT_TIER_PH",x=i.useMemo(()=>
813{if(h&&t.key==="FREE_CREDIT_TIER_PH")return!r;if(g==="monthly")return d===30&&h;if(g==="yearly")return d===365&&h},[h,d,g,t.key,r]),f=i.useCallback(()=>e.jsxs(e.Fragment,{children:[e.jsxs(U,{align:"start",gap:"100",wrap:!1,children:[e.jsx(m,{as:"h1",variant:"headingLg",children:t.name}),p&&e.jsx("div",{className:"[&_.Polaris-Badge]:bg-bg-surface-inverse [&_.Polaris-Badge]:text-text-brand-on-bg-fill [&_.Polaris-Badge_span]:font-semibold",children:e.jsx(Bs,{children:o("Recommended").toUpperCase()})})]}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:o(t.subName)})]}),[t,n]),_=()=>t.key==="FREE_CREDIT_TIER_PH"?e.jsxs(U,{gap:"150",align:"center",blockAlign:"center",wrap:!1,children:[e.jsx(cs,{value:t.price,prefix:"$"}),e.jsx("div",{className:"mt-1",children:e.jsx(m,{as:"span",variant:"bodyXs",children:o("Forever")})})]}):g==="yearly"?e.jsxs(e.Fragment,{children:[e.jsx(cs,{value:t.eachYearlyPrice,prefix:"$"}),e.jsxs(D,{align:"center",children:[e.jsxs(m,{as:"span",variant:"bodyXs",textDecorationLine:"line-through",children:["$",Fe(t.price)]}),e.jsx(m,{as:"span",variant:"bodyXs",children:o("PerMonth").toLowerCase()})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(cs,{value:t.price,prefix:"$"}),e.jsxs(D,{align:"center",children:[e.jsx(m,{as:"span",variant:"bodyXs",children:"Â "}),e.jsx(m,{as:"span",variant:"bodyXs",children:o("PerMonth").toLowerCase()})]})]});return e.jsxs("div",{style:{zIndex:1},children:[e.jsx("div",{className:"",children:e.jsx(D,{gap:"025",children:f()})}),e.jsx("div",{className:l?"my-2":"my-4",children:e.jsx(U,{blockAlign:"center",gap:"100",wrap:!1,children:e.jsx("div",{className:"w-full flex gap-1",children:_()})})}),e.jsx("div",{className:"mt-4",children:e.jsx(m,{as:"span",variant:"bodySm",children:e.jsx(D,{gap:"300",children:e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:ra})}),e.jsxs(m,{as:"span",children:[e.jsx(m,{as:"span",fontWeight:"semibold",children:t.credit})," ","view credits monthly"]})]})})})}),!l&&e.jsx("div",{className:"mt-4",style:{width:"100%"},children:e.jsx(Eo,{permissions:[Te.VIEW_ACTION_CHANGE_PLAN],children:e.jsx(re,{variant:"primary",disabled:x,fullWidth:!0,onClick:()=>{s({keyPlan:t.key,isYearly:g==="yearly",isTrial:!1,isRechargePlan:!1})},loading:a,size:"large",children:o(x?"YouAreHere":"ChooseThisPlan")})})})]})};se.div` 814 & .Polaris-Text--root { 815 background: linear-gradient(88deg, #10245a 1.73%, #695edf 25.2%, #4477ed 46.89%, #5737e6 60.27%); 816 background-clip: text; 817 -webkit-background-clip: text; 818 -webkit-text-fill-color: transparent; 819 } 820`;const fC=i.memo(mC);se.div` 821 & .Polaris-Badge { 822 background-color: var(--p-color-text); 823 color: var(--p-color-bg); 824 } 825`;const wo=t=>{const{data:s,onChoosePlan:n,isAtOnboarding:a}=t,{t:r}=J(),{hasRecommendPlan:o}=zt(),l=o(s.key,"PH");return e.jsx(eh,{isSpecial:!1,isRecommended:l,children:e.jsx(Ln,{children:e.jsx(xC,{children:e.jsxs(D,{gap:"300",children:[" ",e.jsx(fC,{data:s,isSpecial:!1,loadingCharge:!1,onChoosePlan:n,isAtOnboarding:a}),e.jsx("div",{className:"mt-4",children:e.jsx(m,{as:"span",variant:"bodySm",children:e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"mb-2",children:e.jsx(m,{as:"span",variant:"bodyXs",fontWeight:"semibold",children:r("CoreTools")})}),e.jsxs(D,{gap:"200",children:[s.feature.core_tools.map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{children:r(c)})})]},u)),s.feature.highlight&&e.jsx("div",{className:"text-text-link",children:(s.feature.highlight||[]).map((c,u)=>e.jsxs(U,{gap:"100",wrap:!1,align:"start",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:Je})}),e.jsx(m,{as:"span",children:e.jsx("span",{children:r(c)})})]},u))})]})]})})})]})})})})},xC=se.div` 826 height: 100%; 827 & > .Polaris-BlockStack { 828 height: 100%; 829 } 830 transform: translate3d(0, 0, 0); 831 backface-visibility: hidden; 832 -webkit-backface-visibility: hidden; 833`,oi=t=>{const{onChoosePlan:s,isAtOnboarding:n=!1}=t,a=ke(Gt),{isMobile:r}=xe(),o=i.useMemo(()=>n?Js.filter(c=>c.key!=="FREE_CREDIT_TIER_PH"):Js,[n]),l=c=>{const{keyPlan:u}=c,d=o.find(g=>g.key===u);d&&Cr({isAtOnboarding:n,hasReinstall:!1,planDetails:{price:d?.price||0,cycle:a,name:d.name},app:"PH"}),s(c)};return r?e.jsx(ty,{isAtOnboarding:n,onChoosePlan:l}):e.jsx(ft,{gap:"400",columns:{xs:1,sm:2,md:2,xl:o.length,lg:o.length},children:o.map(c=>e.jsx(wo,{isAtOnboarding:n,data:c,onChoosePlan:l},c.key))})},_C=Ei` 834 @media (min-width: 65em) { 835 .Polaris-Modal-Dialog__Modal.Polaris-Modal-Dialog--sizeFullScreen { 836 max-width: 95rem; 837 } 838 } 839 .Polaris-Modal-Dialog > .Polaris-Modal-Dialog__Modal.Polaris-Modal-Dialog--sizeFullScreen{ 840 & .Polaris-Modal__Body { 841 border-bottom-left-radius: var(--p-border-radius-400) !important; 842 border-bottom-right-radius: var(--p-border-radius-400) !important; 843 } 844 } 845`,$c=se.table` 846 width: 100%; 847 border-collapse: separate; 848 border-spacing: 0; 849 td, 850 th { 851 &.border-right { 852 border-right: 1px solid #dfe3e8; 853 } 854 } 855`,Qi=se.th` 856 text-align: left; 857 border-bottom: 1px solid #dfe3e8; 858 // background: var(--p-color-bg-surface-secondary); 859 background: #fff; 860 position: sticky; 861 top: 0; 862 z-index: 2; 863 padding-left: var(--p-space-400); 864 padding-right: var(--p-space-400); 865`,ed=se.td` 866 padding: 16px; 867 border-bottom: 1px solid #dfe3e8; 868 // vertical-align: top; 869 text-align: ${({align:t="left"})=>t}; 870 ${t=>t.isFeatureTitle&&` 871 z-index: 1; 872 background: var(--p-color-bg-surface); 873 width: 250px; 874 font-weight: 500; 875 position: sticky; 876 left: 0; 877 `} 878`,bC=se.tr` 879 background: var(--p-color-bg-surface-secondary); 880 td { 881 padding: 12px 16px; 882 border-bottom: 1px solid #dfe3e8; 883 } 884`,td=i.forwardRef(({onChoosePlan:t,hasReinstall:s=!1,isTryForFreeOb:n=!1,isAtOnboarding:a=!1,loadingCharge:r})=>{const{t:o}=J(),l=de(),u=l.getCurrentPlan("PH")?.package?.cycle,{hasRecommendPlan:d,findPlanByKey:g,hasCurrentPlanActive:h}=zt(),p=ke(Gt),x=Oe.useRef(null),f=Oe.useRef(null),_=Oe.useRef(null),[b,v]=i.useState(0),[y,C]=i.useState(0),S=l.getUserInfo(),j=S?.plan_reinstalled||S?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE";i.useLayoutEffect(()=>{const L=()=>{v(f.current?.offsetHeight||0);const H=_.current?.offsetWidth||0;H>0&&C(H)};L();const W=new ResizeObserver(L);return _.current&&W.observe(_.current),f.current&&W.observe(f.current),()=>W.disconnect()},[]);const A=i.useMemo(()=>Js,[Js]),E=async(L,W=!1)=>{const H=g(L,"PH"),Z=q.upperCase(H?.name||"");H&&Cr({isAtOnboarding:a,hasReinstall:s,planDetails:{price:H?.price||0,cycle:p,name:Z},app:"PH"}),t({keyPlan:L,isTrial:W,isYearly:p==="yearly"})},T=L=>{L.target.scrollLeft>0?L.target.querySelectorAll("tr td:first-child, tr th:first-child").forEach(H=>{H.classList.add("border-right")}):L.target.querySelectorAll("tr td:first-child, tr th:first-child").forEach(H=>{H.classList.remove("border-right")}),f.current&&(f.current.scrollLeft=L.target.scrollLeft)},k=()=>e.jsx(ds,{source:Je,tone:"success"}),O=L=>{const{value:W,subtitle:H,subtitleSmall:Z}=L;return W===""&&H===""?e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 10.479C5 10.0648 5.33579 9.729 5.75 9.729H14.25C14.6642 9.729 15 10.0648 15 10.479C15 10.8932 14.6642 11.229 14.25 11.229H5.75C5.33579 11.229 5 10.8932 5 10.479Z",fill:"#CCCCCC"})})}
884):W==="tick"?k():W===-1?e.jsxs(e.Fragment,{children:[e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:o("Unlimited")})," ",H&&e.jsx(m,{variant:"bodySm",as:"span",children:o(H)})]}):H==="limit_viewable_import"?e.jsx(m,{variant:"bodySm",as:"span",children:o("LimitedImportedProducts",{var_limit:e.jsx(m,{fontWeight:"semibold",variant:"bodySm",as:"span",children:W})})}):e.jsxs(e.Fragment,{children:[e.jsx(m,{variant:"bodySm",as:"span",fontWeight:typeof W=="number"||W==="Unlimited"?"semibold":"regular",children:o(W)})," ",H&&e.jsx(m,{variant:"bodySm",as:"span",children:H==="FromMonToFri923"?e.jsx("div",{dangerouslySetInnerHTML:{__html:o(H)}}):e.jsx("div",{dangerouslySetInnerHTML:{__html:o(H)}})}),Z&&e.jsxs(m,{variant:"bodyXs",tone:"subdued",as:"span",children:["(",o(Z),")"]})]})},R=i.useMemo(()=>L=>{const W=h(L,"PH");return a&&L==="FREE_CREDIT_TIER_PH"?!1:L==="FREE_CREDIT_TIER_PH"&&W?!0:p==="monthly"?u===30&&W:p==="yearly"?u===365&&W:!1},[u,a,p]),P=(L,W=!1)=>{const H=R(L),Z=d(L,"PH");return H?e.jsx(re,{fullWidth:!0,disabled:!0,children:o("YouAreHere")}):L==="FREE_CREDIT_TIER_PH"?e.jsx(re,{fullWidth:!0,onClick:()=>{E(L)},children:o("StartForFree")}):Z?e.jsx(re,{disabled:r!=="",loading:r.includes(L),fullWidth:!0,onClick:()=>E(L,W),children:o("ChooseThisPlan")}):e.jsx(re,{disabled:r!=="",loading:r.includes(L),fullWidth:!0,onClick:()=>E(L,W),children:o("ChooseThisPlan")})},w=(L,W=!1)=>L.key==="FREE_CREDIT"?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",L.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):p==="yearly"?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"span",variant:"headingMd",children:["$",L.eachYearlyPrice]}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"disabled",textDecorationLine:"line-through",children:["$",L.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"h1",variant:"headingMd",children:["$",L.price]}),e.jsx(D,{align:"center",children:e.jsx(m,{as:"span",variant:"bodyXs",children:"USD/month"})})]}),N=L=>{const W=a&&l.isTrialChargeSubcription()&&!j&&p==="monthly"&&cn.includes(L.key);return console.log("plan",L.key),e.jsx(Qi,{className:oe("fixed top-[0px]! bg-white z-10!",L.key==="FREE_CREDIT_TIER_PH"&&n?"border-2 border-blue-500 rounded-t-xl":""),children:e.jsx(U,{align:"center",children:e.jsx(Q,{paddingBlock:"400",children:e.jsxs(D,{gap:"200",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodySm",alignment:"center",children:L.name}),e.jsx(U,{gap:"050",wrap:!1,children:w(L,W)})]}),e.jsx(Q,{width:"150px",children:P(L.key,W)})]})})})})},K=()=>e.jsxs($c,{style:{marginTop:-b},children:[e.jsx("thead",{children:e.jsxs("tr",{className:"opacity-0",children:[e.jsx(Qi,{ref:_,className:"sticky! left-0 top-[0px]! z-11!"}),A.map(L=>e.jsx(Oe.Fragment,{children:N(L)},L.key))]})}),e.jsx("tbody",{children:e.jsx(Oe.Fragment,{children:Yi.map((L,W)=>e.jsxs(Oe.Fragment,{children:[L.content.length>0&&e.jsx(bC,{children:e.jsx("td",{className:"sticky left-0 bg-[#333333]! text-white",colSpan:6,children:e.jsx("div",{className:"inline-flex",children:e.jsxs(m,{as:"h1",variant:"bodySm",fontWeight:"semibold",children:[o(L.title),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:o(L.description)})]})})})}),L.content.map((H,Z)=>e.jsxs("tr",{className:"group",children:[e.jsx(ed,{isFeatureTitle:!0,className:oe("group-hover:bg-[#F7F7F7]"),children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{children:e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"medium",children:e.jsx("span",{className:"inline-block text-nowrap",children:o(H.title)})})}),H.tooltip&&e.jsx(m,{as:"span",variant:"bodyXs",tone:"subdued",children:e.jsx("span",{className:"inline-block",style:{lineHeight:1.4},children:o(H.tooltip??"")})})]})}),H.columns.map((te,ne)=>e.jsx(ed,{className:oe("group-hover:bg-[#F7F7F7]",W===Yi.length-1&&Z===L.content.length-1&&"border-transparent!",ne===0&&n?"border-l-2 border-r-2 border-blue-500":"",ne===0&&W===Yi.length-1&&Z===L.content.length-1&&n?"border-2 border-b-2! border-t-0 border-blue-500! rounded-b-xl":""),align:"center",children:O(te)},`${H.title}-${ne}`))]},H.title))]},L.key))})})]});return e.jsxs(e.Fragment,{children:[e.jsx(_C,{}),e.jsxs(Ln,{padding:"0",children:[e.jsx("div",{className:"sticky! bg-white left-0 top-[0px]! z-11!",children:e.jsx("div",{ref:f,className:"overflow-x-auto",children:e.jsx($c,{
884children:e.jsx("thead",{children:e.jsxs("tr",{className:"w-full",children:[e.jsx(Qi,{className:"align-middle sticky left-0 top-[0px]! z-11!",style:{width:y||"100%"}}),A.map(L=>e.jsx(Oe.Fragment,{children:N(L)},L.key))]})})})})}),e.jsx("div",{className:"mb-4 overflow-x-auto",style:{maxWidth:"100%",fontSize:"13px"},ref:x,onScroll:T,children:K()})]})]})}),No=t=>{const{isAtOnboarding:s=!1,isTryForFreeOb:n=!1,loadingCharge:a="",onChoosePlan:r}=t,{t:o}=J(),{isMobile:l}=xe(),[c,u]=i.useState(!l),{getCurrentPlan:d}=de(),g=d("PH"),h=i.useRef(null);return i.useLayoutEffect(()=>{n&&(u(!0),setTimeout(()=>{h.current?.scrollIntoView({behavior:"smooth"})},0))},[n]),i.useEffect(()=>()=>{u(!1)},[]),l?e.jsxs("div",{className:"mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 cursor-pointer",onClick:()=>u(!c),children:[e.jsx("div",{children:o("CompareAllPlans")}),e.jsx("div",{children:e.jsx(ee,{tone:"subdued",source:Ys})})]}),e.jsxs(xt,{showCloseIcon:!0,styleContent:{maxHeight:"90%"},onClose:()=>u(!1),visible:c,placement:"bottom",title:o("FullFunctions"),zIndex:176,background:"bg",children:[e.jsx($e,{}),e.jsxs("div",{className:"pb-4",children:[e.jsx("div",{className:"flex justify-center mt-3 mb-1",children:e.jsx(En,{disabled:g.provider_payment==="PADDLE_BILLING"&&g?.package?.cycle===365})}),e.jsx(td,{isAtOnboarding:s,loadingCharge:a,onChoosePlan:r,isTryForFreeOb:n})]})]})]}):e.jsxs(D,{children:[e.jsx("div",{ref:h,className:"pt-4",children:e.jsx("div",{className:"flex items-center cursor-pointer gap-3",children:e.jsx(m,{as:"h4",variant:"headingLg",children:o("CompareAllPlans")})})}),e.jsx("div",{id:"collapsible-how-credit-work",children:e.jsx("div",{className:"pt-5",children:e.jsx(td,{isAtOnboarding:s,loadingCharge:a,onChoosePlan:r,isTryForFreeOb:n})})})]})};let sd;const yC=t=>{const{activeYearly:s,app:n}=t,{t:a}=J(),{getCurrentPlan:r,getUserInfo:o,checkPermissionFeature:l,isDemoMode:c,isPlanFree:u}=de(),{findPlanByKey:d}=zt(),g=r(n),h=o(),p=zs(),[x,f]=be(Gt),[_,b]=i.useState(""),[v,y]=i.useState(""),[C,S]=i.useState(!1),[j,A]=i.useState({isFullListOfFeatures:!1}),E=i.useRef(null),T=i.useRef(!0),k=i.useRef(null),O=i.useRef(null),R=i.useRef(null),P=i.useRef(!1),w=pt(),N=l("WP_ADD_STORE"),K=i.useCallback(W=>{const{keyPlan:H,isYearly:Z=!1,isTrial:te=!1,isRechargePlan:ne=!1,discountCode:le}=W;if(P.current=!0,R.current?.close(),c()){O.current?.open();return}requestAnimationFrame(async()=>{const B=d(H,n);B&&(b(B.key),await E.current?.onConfirmCharge({data:B,isYearly:Z,isTrial:te,isRechargePlan:ne,couponCode:le}),setTimeout(()=>{b("")},1e3))})},[x,d,p,N,n]);i.useEffect(()=>{if(!s){const W=["FREE_ORDER_FULFILLMENT_2","DEMO_MODE_ZOPI"].includes(at.head(g?.package?.modules)?.key||"");g?.package?.cycle===365||W?f("yearly"):f("monthly")}},[g,n,s]),i.useEffect(()=>{s||g&&h?.first_cycle_charge_type==="CHARGE_ONE_TIME_FIRST_MONTH"&&x==="monthly"&&T.current&&(f(g?.package?.cycle===365?"yearly":"monthly"),T.current=!1)},[g,h?.first_cycle_charge_type,x,s]),i.useEffect(()=>{s&&f("yearly")},[s]),i.useEffect(()=>{window.location.pathname===Y.OB_WELCOME.PATH?sh():Ke.trackingEventUsersAction({event_name:$.SUBSCRIPTION_CHANGE_PLAN_VIEWED})},[]),i.useEffect(()=>(sd=setTimeout(()=>{if(!P.current){const W=`${st.SHOWED_OFFER_WELCOME}_${h?.id}`,H=ge.localStorage.get(W)||h?.remaining_meta_keys?.[Ut.SHOWED_OFFER_WELCOME];u()===!0&&x==="monthly"&&!H&&(R.current?.open("pricing"),P.current=!0)}},15e3),()=>{clearTimeout(sd)}),[x,u]),i.useEffect(()=>{!h?.is_user_mkt&&g?.package?.key===al&&w(Y.BILLING_PLAN.PATH)},[h,g]);const L=()=>e.jsxs("div",{className:"relative",children:[e.jsx(Qe,{id:"error-change-plan",open:C,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx("div",{className:oe("pt-3 pb-3"),children:e.jsx(kt,{title:a("ChangePlanFailed"),tone:"warning",onDismiss:()=>{S(!1),setTimeout(()=>{y("")},500)},children:a(v)})})}),e.jsxs(D,{gap:"400",children:[e.jsx(U,{align:"center",children:e.jsx(En,{disabled:g.provider_payment==="PADDLE_BILLING"&&g?.package?.cycle===365})}),e.jsx(Qe,{id:"content-data-yearly",open:x==="yearly",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsxs(Q,{paddingBlockEnd:"0",children:[e.jsx(Q,{paddingBlock:"500",paddingInline:"400",borderRadius:"200",background:"bg-surface-success",children:e.jsxs(U,{align:"start",ga
884p:"100",wrap:!1,blockAlign:"center",children:[e.jsx(Q,{children:e.jsx(ee,{tone:"success",source:Je})}),e.jsxs(m,{as:"p",variant:"bodySm",fontWeight:"regular",tone:"success",alignment:"center",children:["Get"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"3 months off"}),", plus"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"5% credit rewards"})," ","and"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"+0.5% extra"})," ","on top-ups ."]})]})})," "]})}),e.jsx(Qe,{id:"promotion-code",open:x==="monthly"&&n==="AO",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(pi,{})}),n==="AO"?e.jsxs(e.Fragment,{children:[e.jsx(ii,{isAtOnboarding:!1,loadingCharge:_,onChoosePlan:K}),e.jsx(Pi,{onApplied:()=>{setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},500)},isOnboarding:!1,ref:R})]}):e.jsx(e.Fragment,{children:e.jsx(oi,{onChoosePlan:K})}),e.jsx(U,{align:"center",children:e.jsx(re,{variant:"tertiary",onClick:()=>A(W=>({...W,isFullListOfFeatures:!W.isFullListOfFeatures})),disclosure:j.isFullListOfFeatures?"up":"down",children:j.isFullListOfFeatures?"Hide feature list":"View full list of features"})}),e.jsx(Qe,{id:"compare-all-plans",open:j.isFullListOfFeatures,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:n==="AO"?e.jsx(Ro,{onChoosePlan:K,loadingCharge:_}):e.jsx(No,{onChoosePlan:K,loadingCharge:_})}),e.jsx(Qe,{id:"enterprise-plan",open:n==="AO",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Po,{onChoosePlan:K})}),e.jsx($p,{variant:"choosing-plan",objUrl:{utm_medium:"billing-plan"}})]})]});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"[&_.Polaris-Page]:px-0!",ref:k,children:L()}),e.jsx(Ry,{size:40}),e.jsx(un,{ref:E,onChargeError:W=>{y(W),S(!0),k.current?.closest(".drawer-body")?.scrollTo({top:0,behavior:"smooth"})},app:n})]})},CC=se.div` 885 .skeleton { 886 /* background: rgba(0, 0, 0, 0.12); */ 887 border-radius: 2px; 888 box-sizing: border-box; 889 position: relative; 890 overflow: hidden; 891 z-index: 1; 892 height: 100%; 893 width: 100%; 894 display: flex; 895 align-items: center; 896 justify-content: center; 897 &:before { 898 content: '\\00a0'; 899 } 900 901 /* &:after { 902 background: linear-gradient(90deg, transparent, hsla(0, 0%, 100%, 0.5), transparent); 903 animation: ah_skeleton_wave 1.5s linear 0.5s infinite; 904 content: ''; 905 position: absolute; 906 top: 0; 907 right: 0; 908 bottom: 0; 909 left: 0; 910 z-index: 0; 911 } */ 912 &.block-icon { 913 &:after { 914 background: none; 915 } 916 } 917 } 918 919 .skeletonCircle { 920 border-radius: 50%; 921 } 922 923 @keyframes ah_skeleton_wave { 924 0% { 925 transform: translateX(-100%); 926 } 927 928 100% { 929 transform: translateX(100%); 930 } 931 } 932`,Se=t=>{const{height:s="",styleSkeleton:n={},width:a="",isTransparent:r=!1,className:o,variant:l="line",blockIcon:c=!1,...u}=t;return e.jsx(CC,{className:o,style:{...n},...u,children:e.jsx("div",{className:`skeleton ${l==="circle"?"skeletonCircle":""} ${c?"block-icon":""}`,style:{...n,background:r?"transparent":"rgba(0, 0, 0, 0.12)",height:s,width:a}})})},nd=t=>{const{title:s,description:n,renderButton:a,className:r=""}=t,{t:o}=Mp();return e.jsx(vC,{className:r,children:e.jsxs(D,{gap:"150",inlineAlign:"center",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"61",height:"61",viewBox:"0 0 61 61",fill:"none",children:[e.jsx("path",{d:"M30.4921 19.168C31.3205 19.168 31.9921 19.8396 31.9921 20.668L31.992 31.168C31.992 31.9965 31.3204 32.668 30.492 32.668C29.6636 32.6679 28.992 31.9963 28.992 31.1679L28.9921 20.6679C28.9921 19.8395 29.6637 19.1679 30.4921 19.168Z",fill:"#8A8A8A"}),e.jsx("path",{d:"M32.4922 38.418C32.4922 39.5225 31.5968 40.418 30.4922 40.418C29.3876 40.418 28.4922 39.5225 28.4922 38.418C28.4922 37.3134 29.3876 36.418 30.4922 36.418C31.5968 36.418 32.4922 37.3134 32.4922 38.418Z",fill:"#8A8A8A"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.4922 30.418C51.4922 42.0159 42.0902 51.418 30.4922 51.418C18.8942 51.418 9.49219 42.0159 9.49219 30.418C9.49219 18.82 18.8942 9.41797 30.4922 9.41797C42.0902 9.41797 51.4922 18.82 51.4922 30.418ZM48.4922 30.418C48.4922 40.3591 40.4333 48.418 30.4922 48.418C20.5511 48.418 12.4922 40.3591 12.4922 30.418C12.4922 20.4768 20.5511 12.418 30.4922 12.418C40.4333 12.418 48.4922 20.4768 48.4922 30.418Z",fill:"#8A8A8A"})]}),e.jsx(m,{variant:"headingMd",as:"h4",children:s||o("no_data_found")}),e.jsx(m,{variant:"bodySm",as:"p",alignment:"center",children:n||o("we_still_collecting_data")}),a]})})},vC=se.div` 933 padding-top: 40px; 934 padding-bottom: 40px; 935 padding-left: 16px; 936 padding-right: 16px; 937`,qi={PRODUCT_IMPORT:"Add a product to Favorite list",PRODUCT_MANAGED:"Managed product activated",WP_STORE_PRODUCT_COPY:"Copy product data to another store",PRODUCT_ADDED:"Add a product to Zopi",PRODUCT_LISTING:"Product pushed successfully",AI_PRODUCT_WRITING:"Edit product content using A.I",AI_IMAGE_GENERATION:"Edit product image using A.I",AI_POD_IMAGE:"Generated POD design with AI",AI_PRODUCT_CONTENT:"Edit product content using A.I",AI_PRODUCT_SEO:"Edit product SEO content using A.I",PRODUCT_FIND_SUPPLIER:"Find supplier for product",REDEEM_CREDIT:"Redeemed credit",RENEW_CREDIT:"Renew credit",UPDATE_CREDIT:"Update credit",ORDER_FULFILLMENT:"Order fulfillment successfully",USED_QUOTA:"Used quota",REFUND_QUOTA:"Refund quota",RENEW_ORDER_FULFILLMENT:"Renew order fulfillment",RENEW_BULK_PRODUCT_UPDATE_PRICE:"Renew bulk product price update",UPDATE_ORDER_FULFILLMENT:"Update order fulfillment",UPDATE_BULK_PRODUCT_UPDATE_PRICE:"Update bulk product price update",UPDATE_PRODUCT_LISTING:"Update product listing",AI_FIND_IMAGE_BETTER:"Find better image using A.I",AI_FIND_IMAGE_RELATE:"Find related image using A.I",AI_FIND_IMAGE_VIDEO:"Find related video using A.I",BULK_PRODUCT_UPDATE_PRICE:"Bulk product price update",AI_IMAGE_THUMB_BASIC:"Generate thumbnail image using A.I",PH_ADS:"View detail Ads library",PH_BASIC_PRODUCT_INSIGHT:"View detail Product insights",PH_IDEA_DISCOVERY:"View detail Trend discovery"},ad={PRODUCT_IMPORT:"Product",PRODUCT_LISTING:"Product",PRODUCT_MANAGED:"Product",AI_PRODUCT_WRITING:"Credits",AI_IMAGE_GENERATION:"Credits",AI_POD_IMAGE:"Credits",WP_STORE_PRODUCT_COPY:"Product",PRODUCT_ADDED:"Product",AI_PRODUCT_CONTENT:"Credits",AI_PRODUCT_SEO:"Credits",PRODUCT_FIND_SUPPLIER:"Product",REDEEM_CREDIT:"Credits",RENEW_CREDIT:"Credits",UPDATE_CREDIT:"Credits",ORDER_FULFILLMENT:"Order",RENEW_ORDER_FULFILLMENT:"Quota",RENEW_BULK_PRODUCT_UPDATE_PRICE:"Quota",UPDATE_ORDER_FULFILLMENT:"Quota",UPDATE_BULK_PRODUCT_UPDATE_PRICE:"Quota",UPDATE_PRODUCT_LISTING:"Quota",PH_ADS:"Quota",PH_BASIC_PRODUCT_INSIGHT:"Quota",PH_IDEA_DISCOVERY:"Quota"},ah=i.forwardRef((t,s)=>{const{app:n}=t,{t:a}=J(),{isMobile:r}=xe(),[o,l]=i.useState(!1),[c,u]=i.useState(1),[d,g]=i.useState(!1),[h,p]=i.useState(!1),[x,f]=i.useState({});i.useImperativeHandle(s,()=>({open:y=>{l(!0),v({pageParams:1,isLoadMore:!1,type:y})}}));const _=()=>{l(!1),u(1),f({}),p(!1),g(!1)},b=()=>{const y=c+1;u(y),v({pageParams:y,isLoadMore:!0})},v=async y=>{const{pageParams:C=1,isLoadMore:S=!1,type:j=null}=y;g(!0);const A=await ls.getActivityLog({page:C,type:j,page_size:30},n),E=A?.data?.payment_logs||{},k=(A?.data?.total_page||0)>C;f(S?O=>({...O,...E}):E),p(k),g(!1)};return r?e.jsx(xt,{title:a("ActivityLog"),visible:o,onClose:_,placement:"right",children:e.jsx("div",{className:"p-4",children:e.jsxs(nt,{roundedAbove:"xs",padding:"0",children:[Object.entries(x).length===0&&!d&&e.jsx(nd,{title:"No activity yet",description:"You havenât used any credits yet. Once you start using features, your usage activity will appear here."}),Object.entries(x).map(([y,C],S)=>e.jsx(id,{index:S,date:y,data:C},S)),h&&!d&&e.jsxs(e.Fragment,{children:[e.jsx($e,{}),e.jsx("div",{className:"p-2 px-2",children:e.jsx(re,{onClick:b,variant:"tertiary",disclosure:"down",children:a("LoadMore")})})]}),d&&e.jsx(rd,{})]})})}):e.jsx(Is,{visible:o,onClose:_,width:796,zIndex:176,children:e.jsx("div",{id:"activity-log-credit",children:e.jsxs(AC,{children:[e.jsx(Q,{paddingInline:"400",children:e.jsx(us,{fullWidth:!0,title:a("ActivityLog"),backAction:{onAction:_}})}),e.jsx($e,{}),e.jsx("div",{className:"p-4",children:e.jsxs(nt,{roundedAbove:"xs",padding:"0",children:[Object.entries(x).length===0&&!d&&e.jsx(nd,{title:"No activity yet",description:"You havenât used any credits yet. Once you start using features, your usage activity will appear here."}),Object.entries(x).map(([y,C],S)=>e.jsx(id,{index:S,date:y,data:C},S)),h&&!d&&e.jsxs(e.Fragment,{children:[e.jsx($e,{}),e.jsx("div",{className:"p-2 px-2",children:e.jsx(re,{onClick:b,variant:"tertiary",disclosure:"down",children:a("LoadMore")})})]}),d&&e.jsx(rd,{})]})})]})})})}),rd=()=>{const{isMobile:t}=xe();return Array.from({length:1}).map((s,n)=>e.jsx(Oe.Fragment,{children:e.jsxs(e.Fragment,{children:[e.jsx($e,{borderColor:"border-disabled"}),e.jsx(Q,{padding:"200",paddingInline:"300",background:"bg-surface-secondary",children:e.jsxs("div",{className:"flex justify-between gap-4 items-center",children:[e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:e.jsx(Se,{width:200,styleSkeleton:{maxWidth:"100%"}})}),e.jsx(re,{variant:"tertiary",icon:Rs,disabled:!0})]})}),n===0&&e.jsxs(e.Fragment,{children:[e.jsx($e,{borderColor:"border-disabled"}),e.jsx(Q,{padding:"400",paddingInline:"300",paddingInlineEnd:"400",children:e.jsx(D,{gap:"300",children:Array.from({length:15}).map((a,r)=>
937e.jsxs(Oe.Fragment,{children:[r>0&&e.jsx($e,{borderColor:"border-disabled"}),t?e.jsx(Q,{children:e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"mb-2",children:[e.jsx(m,{as:"span",variant:"bodyMd",children:e.jsx(Se,{height:14})}),e.jsx("div",{className:"mt-2.5",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:e.jsx(Se,{width:150,height:10})})})]}),e.jsx(m,{as:"span",children:e.jsx(Se,{width:100,height:12})})]})}):e.jsx(Q,{children:e.jsxs("div",{className:"flex justify-between gap-4 items-center",children:[e.jsxs("div",{children:[e.jsx(m,{as:"span",variant:"bodyMd",children:e.jsx(Se,{width:300,height:14})}),e.jsx("div",{className:"mt-2.5",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:e.jsx(Se,{width:120,height:10})})})]}),e.jsx(m,{as:"span",children:e.jsx(Se,{width:100,height:12})})]})})]},r))})})]})]})},n))},id=t=>{const{index:s,data:n,date:a}=t,[r,o]=i.useState(s===0),{isMobile:l}=xe(),{t:c}=J(),u=x=>x.can_count_credit,d=n.reduce((x,f)=>x+(u(f)?0:f.credit_cost),0),g=i.useCallback(()=>{o(x=>!x)},[]),h=x=>x.feature_id==="PRODUCT_LISTING"?x.credit_type==="REFUND_QUOTA"?qi.REFUND_QUOTA:qi.PRODUCT_LISTING:qi[x.feature_id]||"",p=x=>x.credit_type==="BONUS_CREDIT"||x.credit_type==="MAIN_CREDIT"?ad.AI_PRODUCT_CONTENT:ad[x.feature_id]||"";return e.jsxs(e.Fragment,{children:[e.jsx($e,{borderColor:"border-disabled"}),e.jsx(Q,{padding:"200",paddingInline:"300",background:"bg-surface-secondary",children:e.jsxs("div",{className:"flex justify-between gap-4 items-center",onClick:g,children:[e.jsxs(m,{as:"span",variant:"bodyMd",tone:"subdued",children:[it(a).format("MMMM DD, YYYY")," (UTC) ",d>0?`- ${Fe(d)} used`:""]}),e.jsx(re,{variant:"tertiary",icon:r?Pn:Rs})]})}),e.jsxs(Qe,{open:r,id:`log-activity-credit-item-${s}`,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:[e.jsx($e,{borderColor:"border-disabled"}),e.jsx(Q,{padding:"400",paddingInline:"300",paddingInlineEnd:"400",children:e.jsx(D,{gap:"300",children:n.map((x,f)=>e.jsxs(Oe.Fragment,{children:[f>0&&e.jsx($e,{borderColor:"border-disabled"}),l?e.jsxs(Q,{children:[e.jsxs("div",{className:"mb-1.5",children:[e.jsx(m,{as:"span",variant:"bodyMd",children:h(x)}),e.jsx("div",{className:"mt-0.5",children:e.jsxs(m,{as:"span",variant:"bodySm",tone:"subdued",children:[it.utc(x.created_at).format("MMM DD, YYYY [at] HH:mm A")," (UTC)"]})})]}),["RENEW_CREDIT","UPDATE_CREDIT","REDEEM_CREDIT"].includes(x.feature_id)?e.jsxs(m,{as:"span",children:[x.credit_cost===-1?c("Unlimited"):`${Fe(x.credit_cost)}`," credits"]}):e.jsxs(m,{as:"span",children:[x.credit_cost," ",c(p(x)).toLowerCase()]})]}):e.jsx(Q,{children:e.jsxs("div",{className:"flex justify-between gap-4 items-center",children:[e.jsxs("div",{children:[e.jsx(m,{as:"span",variant:"bodyMd",children:h(x)}),e.jsx("div",{className:"mt-0.5",children:e.jsxs(m,{as:"span",variant:"bodySm",tone:"subdued",children:[it.utc(x.created_at).format("MMM DD, YYYY [at] HH:mm A")," (UTC)"]})})]}),["RENEW_CREDIT","UPDATE_CREDIT","REDEEM_CREDIT"].includes(x.feature_id)?e.jsxs(m,{as:"span",children:[x.credit_cost===-1?c("Unlimited"):`${Fe(x.credit_cost)}`," credits"]}):e.jsxs(m,{as:"span",children:[x.credit_cost," ",c(p(x)).toLowerCase()]})]})})]},f))})})]})]})},AC=se.div` 938 & > .Polaris-Box:first-child { 939 position: sticky !important; 940 top: 0; 941 z-index: 199; 942 background-color: rgb(246, 246, 247); 943 } 944`,SC=i.forwardRef((t,s)=>{const{onConfirmChange:n}=t,{t:a}=J(),{isMobile:r}=xe(),{openChat:o}=Pt(),[l,c]=i.useState(!1),[u,d]=i.useState(),g=()=>{c(!1)};i.useImperativeHandle(s,()=>({open:p=>{c(!0),d(p)}}));const h=e.jsxs("div",{className:"p-4 grid gap-4",children:[e.jsxs(m,{as:"p",children:[a("YoureAboutToChangeYourPaymentManagementTo")," ",e.jsx("strong",{children:u?.platform_domain||""}),e.jsx("br",{}),e.jsx("span",{children:a("ToCompleteThisChange")})]}),e.jsxs("ul",{className:"pl-5",children:[e.jsx("li",{className:"list-disc",children:e.jsx(m,{as:"p",children:a("YoullNeedToReviewAndApproveTheChargeOnYourNewStore")})}),e.jsx("li",{className:"list-disc",children:e.jsx(m,{as:"p",children:a("O
944nceConfirmedTheChargeOnYourOldStoreWillBeAutomaticallyCanceled")})}),e.jsx("li",{className:"list-disc",children:e.jsx(m,{as:"p",children:a("NoDuplicateChargesBillingStaysUninterrupted")})})]}),e.jsxs(m,{as:"p",children:[a("NeedAssistance")," ",a("Please")," ",e.jsx(re,{variant:"plain",onClick:()=>{g(),o()},children:a("ContactOurSupportTeam")})]})]});return r?e.jsx(e.Fragment,{children:e.jsx(xt,{visible:l,onClose:g,zIndex:172,showCloseIcon:!0,isButtonFullWidth:!0,title:a("SwitchPaymentStore"),secondaryAction:{content:a("Cancel"),size:"large",onAction:g},primaryAction:{content:a("ConfirmChange"),size:"large",onAction:()=>{u?.id&&(n(u.id),g())}},children:h})}):e.jsx(Xe,{title:a("SwitchPaymentStore"),open:l,onClose:g,secondaryActions:[{content:a("Cancel"),onAction:g}],primaryAction:{content:a("ConfirmChange"),onAction:()=>{u?.id&&(n(u.id),g())}},children:h})}),rh=({onClick:t,variant:s="primary",dataPrimaryLink:n,id:a,children:r})=>{const{t:o}=J(),{hasPermission:l}=gs();if(!l([Te.VIEW_ACTION_CHANGE_PLAN]))return null;const u=()=>{t()};return e.jsx(re,{variant:s,onClick:u,dataPrimaryLink:n,id:a,children:r||o("ChangePlan")})},jC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAlYSURBVHgB5VoLVFTHGf7vvbu8DLBCbNMYdRXxXVhUFKmPhdgYa2JMa2M80Yi2ORprNcdqmkMPKCmQCiERwVej0ZS01VgjJhatRlx5Cb5YFBSj6FUBebOgCYVl93Zmdne4+4JdoQIn3znKP/+dmZ3v/v/888/MZaAHsXFzgiIrJ08JghDo4yNT1NQ3ytxcpXKtVodUenB1cQFtu5aXSiR8dV29esSwIXf9Rg1R7YiPV0MPgYFuYsmqNcor18pe8RzgEVFeWSVjGOe6FAQBBnh48JyEVXEcl6xWZXSL3GMTem5CiFIikWxiWVap1+uhJ4D6Ag93N/VAb+/k7IxD++Ex4DShybMXKGtrazchSyjh/wiO5Xidngnj1SremXYOE5IrlDKW1W9C1ngHnhCwOzICuxVYLgYR0zjSxiFCckWIXBDYMwzDyqEXgAIKzzAuDlmrS0JyRagCefcZJMqgd6HRavVhFSV5nQYNtrOHcsXMZQzDFULvk8GQSSRMod8k5bLOKtm1kNEyhdAnoQ/i1bYtZdNCKADIjW7WJ4Hns2GM1rCyEI5mADpkGUEOfRoMj4J7kGX0s2Eh3aa+TwYDjxGP1RxmFjKYsf0O9Ce0t4fxxfkqU9HCQro+O2/sAqVf4iIlJFfMiOgfrmYFpVwxXWkqiCwkrIP+C2olQsiw5oAC+i+olYwW4oh19qcmwhd7U2Hhy3M7bY2TRlcXKXJfrtN6eDuwcP5cOLRvOyTHRROdt7cX/Gn9Gjh1OA2GPfcsSDgODu5Jgcz0f8DHcVEw5NlnoCuEzwiFtJ0fgeqrf8IHUe+a1AtEhECJ/7t5+y4ETwyExPcjYd3K5TY78xkoI6RLCzLh+rnTsCspFrw8n7JZ97dLF0FiTCRMVgRAZXUN0b23bhXRjxwhh0ZNE7TrdLBj3+cwbMhgWPCLF+A//0qDcaP9wR5ef/Vl2LttC0wPCYYf/2gQJGzbbXpEUiLW4G6GYHA6K5c2fGPhK+AilZp1hi3z911bYcokg3diC80JnwWxkRvIMzG8PT1h9YqltHyh8Ar5O9pvBOgQicTUv0Lzo++I7mxuARw9forI7u5usPPDWLSLdbciM26UP0Su/x0tb96yFRqbmkxFGeaCLNSxUSsp
944/ZYObNDTvhA4fqxZh1MmBsCYUX5WPzTn+ZkQMG6MmW6EfCh4e3kSuaW1FXILLpK+LxcVw9zXlkPR1WuAzhRo/fcTtkF5RSWRhyJXjI38g1l/Lug8Ij56I3g+NYCUM7Py4MCXX1uMhFFiQnJT8SF6Y8XXv6WPw2eGmlV/dd6LVK6ta4DqmjrDjyFLYlcVY3JQAJXzL1yG/yJS+Lzh8LHjELVhDXy+eyuysITW0TQ3Q8qeNLROtpPygnlzYPas6fT52xFv0BfcoNFAZGwiWJ9fsIF4DpmN5JQqm8oB40ZTGb/dMf4d1kn5ZD/EJqXQ8tRJ5kHy57M6XsY5RAj/OO4jdcufYca0KWALh47+G7452+H2H0RtJK7nh6y9dmUE1cd+mArVtXU2ehAUZhbCyMoroDKeK26urkQeiKKTmFBO/kW4UlIKpgMS5c+mgtQ457DFggIm0LqFV0rIX71eAF8fb7AHTDgyNoEGkKd9feDTbQnwaUoiiZgYXxw5Bl8eO2GnB0bGWmYHd8srQdPUTGTsEuEzphEZuxSesKTOvQrg75eTt3S/4oGBBPLxaZODiDwRkTG5U21dPRQh4o6iUdMMybv20TJ+qXhOYVQ8qIKknXvA/lGZIGetO2wiE9eEyUEGjwybPo3qbpTdJm+zta0Nzl8uovqxxoARNrOjbt75S6DVasEZHDzyNahy8q30Sds/gZra+k7bWhHC7I+fVtHyhDH+ZPAjhw+jOlXOOSrnX+zY1IahBQ/XVYZOpbrCqyXgLPAYHhjdzgQtChZl/L0u29rcseahSWzC+LGjyEI3MfCnVJeL3roJRSXXqTwB1R0+dAj4+w2nupyCS+AsQpDrLv7VfDMdOj6Gv0T9Ec1TSadtWcPOzxwVlVXE9TA83N1h5bLFwHEG7nh+3b1fQeveus1DXUMjkdGRLlrJX6I+frPsDnnuDHDWESdag3B7PA8xxo4eCevf/o3VIt4BhsdBweoADw/o2MlMWp73QjiVL6mvmk1KLJ8QueiKJa9RGc81Z8+6cWo0wujemMjrb62FuKRU+jxi8a8hNHiSndYCJsQU2XqUK3IV8QJ4OjvPqu61G7eoLBWlS1k5BeAMXprzPCxCuZoJ8R/vgHpk/XSUFp3IPEt0bm6uEP3uWnwGbquLIkRIb/M4SF1cQldtMbLyzlvp8i8UguWBPY6A2SjdcRSDfH3hvbWr6HqT8c0ZSM84SWRsZZy33S83pEZ4PVwlyhM7QCwkqGz9AA6Ppbdum+mqamqhvPKBVV28JomDAwaeP5aRyhJtiLQJv3/rTRhs3Do0NGhINiAGTrNiP9pOy6tXLIFgUXplJKRijQd2VvMITzzLtWDH3jSbcwLXPfxVhpnuxs2yTucPzu0qqgyE5784G5Yu+iWRmx8+gjdXr7f5Mk6eyaLziUOWTNkSQ1zQAIbHXMgOTfbM0J+gPyGWHWA3wjlaNbJW8u698LeDR+wO8uq1G8Sqvj4yaNO2w560A3DnXrlFLYEknDjD2BAdh7KMSmAZluRs37e0ohB/ATZGx0Mpehn2cBmlUdhTZJ5eZG5zLEN0iFC6pureUTI64/bV5omPKUQ6Gq3EIdWeNcXPuqrv+O8YjodpD4gUJqSE/gk1r84hiaQ4U4iBfgsmmUpidf+0Eg4G2TTXsszl+qGVuDCzkriAogSPIt5AsBHx+iiSeXXWAbHCRrYt2WwrYe17wGOUbLbUWhEy3LcQMzp069xLIGO0dTP+w7iSxDA0YJZDX4NOv9weGQzHrvXRnSaq2as34Sgz0DCMENYZGYxOr/UxSAeMJAj1yEOvgeEZRhrUFRkMDhyAporXgLvvZ25uLvjA+UmH9GTQPFrMl+ZXOVLZ6Y+X8D2sILQ9ic9kVOhfDMrRVM40euzPywaPD46QSl3QvRLT0xdlKrRTjikXXQQ7g25/AOgfrFS0tra+g/Yms3Q6vfxxPgBEmzRNS0vLZ15e3unFOSdU0A10m5AYyGoKTuqiZPWCXGCYQHSdIkc3GvL2dh15jo/C0M0fz3ESzcPvv1N7uLkU+XrJVHmn0nvsE83/Ac6fmdFf7jOfAAAAAElFTkSuQmCC",EC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADUAAAA0CAYAAAAqunDVAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAOTSURBVHgB3ZrfeZswFMWPsPucdIKSP+9JJqgzQdwJ6k6QZILEEySdIM4GbBCyQfre1nSCMkAsei4gB9vYQRgM9Pd9tgFZtg66urpXQqEA02F/oKFPHeAkQuTykpsWuaiPMPtSUC8zqOceZi8HHoJNFdWmQhETYXbDwwFaRAQ1caDH68TlipoOsa+hHlg4RHsJKW585On75YIVURTk8stPqNe0KoNmeXvg6fHitQxdE2RYFuZkCzUcGT8uOgad1y07ZGDO5z31c9gbcfA9oLsECtEZnUc47ykKukG3cWlpV3IQixLXjQ6a3TLsqc/y2Zc3TqwDVbwuJ0K8YAdEyY12LaoMZDrqp9VPitbi3fhCu/WxA6SB9MZ/YccgNj/VXtPbhyUz9ExPFa/MwXgxHRr/8ipxWLjuu3KngQ8uLaHA778Gq2FP35Vm2kBLcuOh9HuoIpQjSM1xZYyVmcjZCM9B9M3cqDT2fIIF/M/vDrZDGn6XV1BmIpdYk/VuzfksyQisoKC9bUUJbv6P2zdIYM9/Nce9Qmab99/tYy5El3AUQhtFzSnrlftoIeJkEOdLxefPLE2LiqOT5ciBzmeKLWjU/Nj4xwMvOqdzOEeFND2mQtRAo6KY7viogcZE0QmM6wqMa3QU0ZjzzGNeSQ/wD99Zu9uG2kTtKj3Jo9WTb1lq6ymmJ2sDWlk+PvZmE9REnWOKaUP+cjWD3RHTnctDLzpDDTRpfqe/hsnqT9U0Pabc9LNUNL6ORmM/hkeXNENuD+EUFdIG7zdATk9xcr7mmFPyovxHWNBal86G+eaYAvdgQVtFhdnFHMdyzLVV1MLqlO2Ya6Uo5lnP5jhZO9xxT3HDy8+7rjMNs4RbMXrydtq39ozGpUuyZnM3grfPxa1JAxt2H8Fxke5EFP1duvnrxZVabSWKmcEfa1GSeheJwJNVVj3ClrCRrsWOTIwxv1rS6ipwLFeUOB6DVJT6YVGv0pBmE8laut0zHD3MApVUdq44wd3hP4DD42PaU1lv02n8+Ua2HCg0l35XBXspjhEz81R0jW4jG4ATOZiLklhLdVdYKJt/5mQhoqCwe20Z5rcBlew+BuZ8JUw69vRIthjRDcI0GPCyF3NjvyNPX4l6oL4Fxwrw08d2/OWCdx5ilEdjQIHqAu15LEHEbFyyLhxWUaAElvL8Txxgsos/vZVG1unBGhiuqYWQTQJUBsdyTXKsjY84GP4Br18lA3lg8gAAAAAASUVORK5CYII=",TC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAWqSURBVHgB7Vq7UttaFN2Yl7uYPxADZm53TXe7KzrzmMF8QcwXYMpUxt3twF+A3d1UMTO8OqBLF6e2Z6L8gVMGBshazjmMQ6Sjh2WPlNGaET7WOUJaZ7+3JZIhQ4YMGZKLGYmASqVSuL+/P5iZmbGfn58tnLJkCsD9Bvjo4jibn5/vAI6ERCjCIGo9PDycgqQtCQA2oAXijTDEZ4Mu3NnZOXh8fPwfZP+S5KCEZ6qurq5+7/f7H4NcEIjw1tZWHUT/wzAvyUMeki4Xi0Xp9Xp3fot9CVOyimzSYUPS3/wkbbRhZbOfQLgg6cBgYWFh3WTTOdPVIFtPEVmiQKdqWuApYUoXoeeLpBCQ8hKkPHCb85QwdqoiKQUEVfOaM6n0rqQU8Nr/es2ZCJckpVDZnytyhosm4qxUetjEsY9jHfa2zE+c70
944p8sLwmjF46ToDQbS6X27i4uFi6vLysYezg3FtGAs5jg/dlCpiTCYNEcTTOz89v+R2JDAuO+tPTk63X4PvZ1dVVp1wuL2MjJhoZJkaYqgsih5Boi9/diHIzuAZkh+o8OzvLwkQmiUkRbqKKOWIs1BXWKFGFBta0EEJ4vot8vTqNKixuwg5Ucl+r7+bmZkWVky8OkJLHsYcNGHAOTmtPTdVlCojNaVE9QWJDk93e3j7GuQ+vvL2Dcm6dZDE+xXifWsACRabURIhFwiDVhuetcmxoEjjckHw+z0zoA8fX19eOSmFPJBjo2Zv43zptZHIUKiOMg3ATTmeYysEOSyQj7tJqkCw2g/N7I2RvJACoQbB5hq6BzpNxfRfXhyI8rkp3GFM5oBfGQ/HhLZd1DtbRQR0z3mLcHSFrBbkR1Z/rWdDwWnUu0LWjGIewA4czTBZgr2+hojeG7KzNxh/Xkyw3JwxZShfaUVDrC7o4AGFbQiISYXpa2iBVi2RBtOVzCW2ND1ygM+PmSHgn5aiD9/979DMMItkwHrihbRA2GcThlMaprbGhJXXfDYQ9atKdahXbEhJRJOzASQ1JUi2n1BFhJ6POTcaYMbwV1llpRJHwGf8wM5IxY6durDPMYFwwNfUxV0Mi8xU+YLjZ8AO7IC5hEZowVKqjhpEzI11QzM3NOerUS6hBAWHhHrb6/5aa5yZ3VWF/ojz8dCSMh2RIoU1afmuZkCwuLtagjjfaDoEGJMOHPx39H9AYnuPRRrbWwqmW0iISJ9EjbMQt1+qSMgpC2zAlgQc1dkN0pQRbr+JrYYRshw/NlFN+V90S1lXpwUH0C8kyduNgg6DJGM9qi9LlOokIz64lbuhap7GI56cKLb/+s59Em4i3JypHtrHuVJPD3B6uPwhRFXV1cUEHSS+NErIehDA2ypVbaAlzl1kggNwhbVF+xsYOvyP1W8aNjrjOLd5ijWPqN7lgGM5USGNqWRpHusNn8JrwkrBCBzt/+LrDr4p8JhlVj3DF3tVxhLrXwUFJe+Xpv8FLwlGLhwq9JDalo0ILJU/1tUwXKaJtHLYEhDITkh312pExbvFQoYopNbP8FsN+d+mIlCkEAU2APiN0Gej5DDJFUMJIHmroc5FE02d5iz+M4ZPNgSOJCRPvWr4GbRim8IZlJZKMEzoiVj04/0Yt+ax6Xbp8jPUHgahOKw44ONqMy2z5QJpDX8CCgP3qcRt6UZyWI5PtM1k42LYdZk0g+jIRQ6t24DXhacOMmZJSmH62Mf225Pu+RFIBrTnzmvMkzPRQUgoIq+M150mYuXCIeJkktFSjwBXGOMxOoc6k0gDVa2uY1hhfW+r3+4O1tbXvGJYlBYAqv4N0r01rfN/T6vV6H4vFImOaLclGA/W37/tkgd7EA+lbSPobVOYfSdjbeKq4eBeELBH4XUtKemVl5T2GS7hJIt7/oFOFn9n0U+NfrpEIYKMNnQdWL6xiSs/Te3nNUU2EO91VkQwZMmTI8AfhBxEdS+kcFW76AAAAAElFTkSuQmCC",PC="/assets/instagram-icon-B7_JQe_A.png",IC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAw6SURBVHgBxVoLVFTVGv7OmTMwjAjIPECEAEUQfJbmMnwtHyldk1Zew7JUKC3r1rXHylXr2r1aq7KrV/PaNR8V+CADMdNbeld3mSj5fkA+AAXkITLADA7MDDMwM+ecu88xHgNzhsHw9q0F5/Dvf++z//3/+////W8o9BF23TDEcxSXKAMeAkXH8TwiePBaGpQ/edLgeQsolFOgjOCpcp7hTjIUfXJhtLoYfQAKvwGZN42RHOtM5Sk8Bx4xuCdQ14iU+2UMk/5M9IAK3CPuSZA9hbUTWEa2iqIwB30Ioq1dTp7bmBarLUAv0StBssstoTanbRPplIL7CJqnMmRy2ZreaMhrQXaW1i+geHorwAfh/wGKqqQ49qNFsSHbvWLviWHbhQtyZWDkJzzwBn4XUGsV+apVKSkU65HLU2N2iU7Twsm+A00l4ncE2TuneMr55OKY0HppHgnsuFkX4svSueR1GHoBnvhdW+MdWPR1aG7Qw25rFoiQK/vBX62FvyYEyiAVeg+qiOF8piyMCzC4bXVHzM7OlrU+NO04+f5EeAnDzRu4lX8WtUVX0GoxeeRVBqugjh6KyHEToSJPb0HM+2RLU+W0l8aNc3RtcyvIrpL6j0nTO/ACdcVXUfjfQ2i6XYV7QUBIGOJnP4GBCaO968Dzny6O1Xbbr90E2XVdvww0evQUNlMjCvbvQd31q+gLDBo1FsP/MJ+Y3YAeeXmKf3pJjDarM81FkL3lxigny+YSO4/0NFBt8RVcPrgXVuMd9CWUA1SYsPgVBAwc1BNrI+VAwqIEja6NQHdudTgcf+tJiOqCcziT8a8+F0KA1diAvG3roSv8pSfWIMj5TzsT2jWSWV4/hnVS+Z56Cxv61FebwTkduJ+gaBqTXnwTqijP6RsL+pG
9440oaozwjvTTnR6DnjCap3L3O5RCOOdO9DpdLBYLLDZbJDJZAgMDMSA4GCEh4fDW/Ach4tZ6Zjy8ttQBEgnEjTP/oU85grvokaEveFwOss9Df7ThjUw1evctpnNZuTn58Og10v2VyqViE9IQGSktOVarVZcOH8eBoMB/v37Y17aMsx87V14Aut0RqfFD6ygf/0jzRNzxfmfJYWorKxE7rFjHoVom+TFCxdQWFjotr2lpeXuOIa78c5CFifni62oyj/vcVyaoVOFp2haPEXNE6KvO3Asixs/HXHbdvv2bVy6eFGM5gLCBg3CyJGjMHToUGg0Gvj7+4MjZlJVVYnK8nJcILzFRUWiycXFxbmMVVxcLArzSGIikpIeg0atQt7x4zi4+RO8+uU+kkO6T0Io0M+Sx2oq/bphmIzmiyCBqktncCk7oxtdWOGfjh4VhZidlIRZs2YjYfhwqWEQNSgUDBHg2wPfYcvWbaLQaiJsGw7/8ANeWLoUT877o/h3oL8SIUSYvVnZoEdNQkhsvOTYRBMJFIniLxC5vpDi+Xn7BtFbdYVgJpFRUVi+/BVoQ7TwBGGl/XwZDI2Obqf9eOQQTp/Jg9FKi+YkOIPnX1ja3t4miIDr9Y3QqaT3Fgd+KTEtOlHMYtzA0WKDobykG93X1xcpC54WNeENmpubYTI5XARJmjEBSUH7seVkMC5ZlXj2uefc9hU0PkQTBD3Hwwkp86LGMhT4wbzEBBqrK9F17wh2P2fO41Cp1fAWJosZNmKKJOBCLpeLNJprhcqfxXuz9Pjx6EiyOAq3fesNDQjRqOHHszBTDNwLgjiaTFMyuWmoLO1Gmzs3uVdCOBx2WIlGhJW9XVvX8XGnRXzSZBbTQyqgTr/Wra/Qp7i0THwPpD2eq8KJ++WjpVq7piETJ00Wg5v3Qjjw/b+/x6kTx1F2vRifffZZe5ugkTb4jDBDdfAaQj53TSxqdLWiuxYE6gePgpCyE6k7STZ3MqsosrFHj/acaguuVgiOulodym7eREFBPrZv24oIspEXLliA7H05otcSQLEdZxarnUOerQYB+8qh2dGRZx0+cgSTiDsuIq5Zyv3+iv6C0fHwAi+9+BICgwIl2wUBysrKYDKb0NjYeJdGUhVBK+s3bMSmzXe1UU1SmGC1BpS147MnrjahyOFLTnEPIGhvGfxD1Qha9RiMTU2YP38+cvZlk0gfADRJpkcUQ4YzU0I26QFjx45FbKznk1yIVouYIUPEdxtxt/V1dSgpLcXXu3ejoqJCFEjA7NlJ6Ecm5bRcI27zLtbuq0Fip63KbDwLn5FD8PDD45GenkHi0wi0ik7CvSBk/maaqEzyQC9X+InP6dOmoTfwUyjEnGrmjBk4SoJmamoqkpOThSM0Zs6cSWzQDq7hssi786gep4vMCEN/lzGMy/fimQeni9oVzNpid0p+j+P5CobnudvED8e6YwgKjxTTiZ72hicMHjyYrGq664frSOZNvFZlfSs+2Fst0mLh6kR4Ow998g5oT6wAIoLRYOckv0G0YaTJrxIpBuE8MGzYMPj5+aEvwVXkwEYmNv+j67ilbxW1MQKabnzOCiOMr34jvhvtHrwWjTKa5flzUu3C0TMiJg59Cb65Cpz+PFZsLcflcqtIm4EoMhf3Xsl2qBilH/8Hdk7aJ3Ecf4qm5fQpeEDClJnoS7Alu/D+19Xi3hAQQiLEcoz12Mfnr4cRUFgt2U7LqJP04ii1kPmWSjFVszKyGtL26Q45OTkkhrgpqLfo8f6GTHyY1TGpRRiJ8C4bvRvIPo9/bT8YU0u3JpJiXV00WHNdPFjx4DKlxhBUWtbUgt5A8P2ZmZlYsmSJ6HrbkPnNt/hgd8e9TjgC8CeM82pMRVUTojYf70bnQO0XnqIgjMwn3dMgV41WtLK908q6detEFxxNMl7B/V4kh6pVa9a68LyO8ZJ7oytILQv0pRugulgH53RmCM/2UXaX1n/P85Tkxc0DSjmmhklHdils2bIFK1euFFP5rigl+pC7VqRc4CAprcXHAb2iBfrJ4eDeWQJO2xE4SQzcuShGneoiSHpJ7QQZZKfhAaMGKDFapURvIZjXkiWLceJEXjstzkeNj4JmQcHS3bRCDkow+ThhZe4GQebxSaDefLbbuMTjPth2u9W+HGlDQ8/wHLI8TeiysRklxmb0FkJkTkt73oVm5Z1o9LWjVtmCGqXN5UegCUJQSl/IX3/arRAkoc3ofEXnolfOyb9OvHWj5IzIyp1psOFqgwW9RfLcx0HTHSt/y9EIC2uX/tKYWMi/fI90nOpmFqhkWXZNZ5qLIGnDtbUyil+OHnC25g4ysnLEs7i3CFapsWnTRhdahvFCNz4mKhS+Hy4Hs+EN8CHu71GI5Xwo1LI602Rdmb7957prT/x5ZRCReoK7QSrO5eHcnu0oLLiIG0W/ID4mEv6B3l3cjB8/ASlPzSNVyBahloYmHxZ2BYXhwSHQDWJwReNAUZQM8tjBCAyLkBiFWrs4VvP3blR3rMeO8UxVhCGX6nTR42xtwS+kAn/r0tl2vpmJwxE/JAwKZQB4/whSzxoGtZfHYMGL/Zx3HP34BjjtVhSW3sbR0x3Fu6jxkzBiznwwnc7yJPid8s3PnZKSksJ6JYiAndUmFW1rzSN7Jt5KrtJOk+K1uUu1MXXeZPTvp4C5uQXrtx8Qq41CrTeJVFeGkLPJwIEDERAQIGbQdeR8Ultbi5KSErJQx6AnvIITeGvZE1D4ytFK0vTtWcdcxvdXaZG4bIV4VScc3ymanSp1j9jjZWiD3nDg5FebJwpF7DbIyKbVBvdH8vQHxb/zzhZg8w6PDk8Sry1dgMkTxojvPxwvgE5vAtspQRQS16mvrDzdr582Wer+sEdBBLy4bZu8MTf3Y6fd/lYbbbBaAW1/Oe4H6swOlBs6nAgtYzaPSIhfuXr1ao+exet/GHhqwcKXOWfru2StIuJD/TBQHYiEMSO86quvKfeKr6a6Abo7VpQaRLfcKPfzW5G1Z88ub/rS8BL7sr7+nPjuKbqamp1mUxNkckasbHj3A69+GEYG3tmKOn3DQb8BYSO9FUKADL0AqZg3VldXfzfn0cTDGpXKL3BA4Chv+lnNRm/YYLezuU47n7pr36FPrlw6Z0Iv8Jv+zenYgc+j7phsbwf4+z3KyCjJMou+5qbkGORKgxwZ+XSzlctZ+vb6e74i/k2CdMY3X/5jtK8vPUUhZxKJOw1ttbNhPNgYH7mcbtBVwMnyHPHCwmV8NSnklRGDO2uz42ram+vy0Af4H+FjBONW5q0BAAAAAElFTkSuQmCC",RC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHESURBVHgB1ZjhVcIwFEavHgdgAz8n0BEYASfQEXAC2UCcQJzA4wTABLiBjMAGNbF4QGibtE3b5J7z/rQN3K+8pKGQLjL1TaKIXD4jQcRBPrkA4r98UgHEuXwyAUSxfBIBRLl89AFEtXzUAYRbPtoAwk8+ygDCXz66AKKefFQBRH35aAKIZvJRBBDN5QcPINrJDxpAtJcfLIAIIz94Cx1zZ2pKwsvoMTMSD2CZk3gAi7OdruiekamXivNrU4uSc++mnhkY4W6DZcnYiWvsJXEwJg96yg4HsQSwFMlOiADhbqFZwTg7d6KYxFtT93uhIlb7a06xk1f0iEy90R4b9IOeH2Qi/7mXtGdBz1sJcejVEAEsUzwDtJ0DIpeW47pxxTm7+nydHJvvj4doyVLE+SqxLLnOdSdtzxdN8qVrbNPngPC7877Y9f6x4PgnDpoEEGHl/7gtOLbCQd0Aoht5y5oG1AkgupN/pXhHOnKMw3cVEs3lt6ZuKs7vKN+0PRAA4f8/NdRzoM73BvmQLgL4bieCyYcKMDa18f3OC8rlm/S87eUn6mMn6zX5q5UxLRHhXjr1UUnLZ6nLZ6nLZ6nL/wbYAFmq9QO5oqEBhijOXQAAAABJRU5ErkJggg==",kC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAUoSURBVHgB7VpbUtswFBXmMfw17MAdFkC6giZ/PAeygsIKCCsIWUHDCnBXgDs8/0hXQPrXGT7q/vUz/eXZc4xEFdeSrXRMY8ZnxiNbupLu0ZWurpQIUaFChQoVJhdTwhGrq6t1JJtTU1MNpPXHx8eaeEGg3yGSAZ/Z2dmDMAwjp/p5Bbe2tvybm5uPfBUTBAxAAOLdvMRzEaZV0fDlS1vTARGe1tnZ2SBLMJNwCcgqcKo3s0h7tkJOYyRHJSBLUMdLqbMRVsK3t7cdJL4oD2rSzxhhnNLSSX0X5cQ709Q2Whhk26K8MO4kRsJwVEuipIDu701ltjVcFyUFnKxRd89SqQye2QSj7lYv/RpREX7tmBFjwPO85sPDgw9v+AHvB/f39w1k72oiA5R9gh9gni/cEKLeL7att4fns3iKmemFa+i/npDJhbEIz8zMDHA66eM14Pfa2poPJVVxBGVaFxcX0fr6+gDvl8IBHMCTk5M+Yvg+Pg/xhAgiWmmyaD9wbl+MAQQlh/q3tORTg563Q7J8p+JIurIo4syAVfq2tjmYTOfm5lSkFNfHAPQQ/cXeF0R3l5eXfbaf1V4S467hoXqhEpxi4o/CkS4I6+xD+QWkb0kGg+Pb2sXMidvGMvFl/Zg4+niD2P7jysrKFqz6HAWivS/CAc6EeeOADpXVBBWkVdU3rH+JKX4ob0aeZZhC4W1hX9MhB5CkQJj1nwcWh/w9rm30tanPIlc4r2GSTXZ2fHwcgmQfCjVobaawzE6yLpQOMCAjjkxe2dBS8UDSivL66JPQCMtBS4vvI+EAVwtH5+fnvbQCWEQRbEPxJl9oZTxHGIz4yEalMb1ZFnHtcU2fnp4u8EH+O3xzsLa1ZjOjPX055YHzlDYdsNFxPIWhcDA9Pd2hHIhTma94fvAbxNuw4JWU25NOLcbd3R3rH8m2Ipldw4B1TH3CeTV0h5kHxvMwOnq01KMjoZWGjLk5BdNib3XDKB2Vb2grkqmfrPsv8TyWVCq3sfZh8XSSqqu9V9uDRyAVbtibSh+Iog4v4xCO0jKls6rJd1pnmCXD1DQz8hAeZxa4Eu5yXzUVYo3Gt5v
944wxk21FSWBpcJroyFl+A2vzTXtayI7cGIB5Pbx3kF7LTwD+IUrnRx9AHTpoc8r2/k3CSenxc3fVCajID4DE1kVKSmZ5B4OBCARxIp5Xp8pycptcOSOCgOgvlP7MsHJwui8jZFXe+EOlUOQEDCIh6WUWKwIPWgyztVkniHj5gO8buoBTVEo7HgoQ8xu4ol0GbXdYA/e5xSlJbPulf9ZL1EQ5G89+3rexsbGAAHKkfrG3su9eReye+IprPTlbWlhN6aFEZbKb+t5IPvX+ZXLBNP/M6c243Bk9UWBKIwwrYekk0eWax3rOBIpe7KM4FjGC4CGzI5UlJZx+voLhRGWCo1EOzzDwvuaDux+WibkGTqG2Kp6vFBgnjozY5C2heONytiEeVHPbQax8ZIeaSHfN9WZn58f0lNrMksp7Y6U8eTFAwheu8qq7JcxNmTbpijPqLepICOWnniYYunqmva1oyKsoE4zJYVRd5uFrf+VmGTAWEbdbb8eOl1/ThKg+1dTmc3CoSgpELn1TGVGwvICvIykA9udtdVLY6T2Sua8oqwztZUwRwrroVkG0lLHVtYvEpn7MKc2SQvHG/6XhLzMy/wXHjEtcuD6+vrn4uIij2cL6sJ9ghDy51n8IvItj7Dz34flEa8t/9b03/4+LLfNMI9VK1SoUKFCWfAbeZ2xuuDwOq0AAAAASUVORK5CYII=",wC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAPiSURBVHgB7Zq/UttAEMbXdgCX4g2UATPpQrp0UTobmInzBIEnAMpUxl06yBPgdElnhn/u4nR0obdnUJ4gpgQGyLcamVHM3UmWTj5pRr8ZRjd8FtbnvdtdH0dUUFBQUJBdShSDZrNp3d7ebpdKJefx8dHGr2yaAXi/ES6X+Dmam5vrApemZCrDMGrf3d0dwqRDGQAfQAfG29MYr0R94cbGxvb9/f13mH1F2WEVz7S5vLx8MxwOL6LcEMnw2tpaC0a/YFil7FFFpOu1Wo0Gg8GvsBeHGubI+mazjoNIX4dFWrmG/TX7G4Ytygej+fn5N6o1XVbdDbOtHJllLE6qqhdII8zRRem5ohyCKC8iyiORJo0wPqkm5RQEakemqab0B9IIlsbu2dlZ6eHh4aXfQEzqH1X6NOD+dzJNZXiVNIKHaHGH1uv1XJj7KtD3Vfo0+N2fkLLiJt3JyhpPNayxA1zcCd0O6gmjbMsEZZZOgW1OhpxQKpXKrkS3/ITTphSYteGnsnF8fNxFFPsCfZ8Hp6enBwI9MbM2zEvFQffm8BiG2gJ9U6UnZeaGGZhq8fXk5KSP8TeVrjvKpgw7jUbDS1ALCws7kwnK170+AN+GtpKWqSBGDDPjMsUJKu0yFcSYYZooU4Io6ixTT7ygdOHI8JaMjZ+WQHf9qyWq++Vyua/S45CmYRetoheh9fV13haa1LvQOzxAJPcF93c4afn6T9JEalMaPfF7vnKJ4VIj0L3GA7sprDUFejug26SJtAx3ONnwAA9+qNJJPNXbIXpsUjEcEh13rPP2kUTv+Pe3SPMWcBqGvehwz0yK6LEOYzsh9++RZnQb5kS1xwMkmk8kiN44UfH2UQRdO7oNe1NVEZ0nXZTIUIa2VLoOdBoOi07HRBmaRFsdDpYhjDcFejCRifbL/rCGjuq1asciKboMj6rVqtf6wZij0kmedb1ZIWhQtKJrSodt31hp9MVx0LmGjW/fREGnYePbN1HQWpZMb99EQXunZXL7JgppGDa2fROFVL48mNq+iYLKsEvxmeV/GURI/57UMB7CpWQY
944K1N49kuZJu20MNX4vIRD8eEoX6Fd5LUq0/+yrru7Qrd3JNOkEfanYi7BB9iVaVLDPNVMNQcJCW4fPUOZpU2UjSTws46/lclQHlsaDoejlZWVGwzrlAMwlT8juj3Va0LPaQ0Gg4tarcaHXxzKNu3z8/PQ82SRTuLBdB+RvsaUeUsZO43H05gjG8UsE/msJUd6aWnpB4aLeBOt5z/iwkkVeaYRNo3/u4diUK/XbTQT3A/zSZ/VGR5ec7kh4h6By6bsLFZBQUFBQV75B6BEgRwTqbBrAAAAAElFTkSuQmCC",od="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAe2SURBVHgB7VlpbJRFGH53u2f37m67vXd7AMFCpVbbtFRSIhYaBSUGAwiihTQxajh+qIBgjXIEEf4YDgWN/vCIiQbUACKGKMZGYhSPcrdbDiVBMEXQcCz6vMs3ZfvtTF2QrT/YN5l8u/s9M/M+M+81s0RpSUtabgrJoP8oNTU1/nPnzgWrqqrOHzt2LKrCtbW1GTs6OoZfiEbHm4zGew0Gw2iXyzUUT1dDQ8OJSCRyif4PCQQCt9vtjh34yMr/nZGRcR7tNXwOxeOYgNfrfdhkMh1gnKzh3W8Oh31e3di6LBpAMYRKSx8ym809MqVsNttzApgdDuc6nc6vSEFA0rp8Ob5KGgAxFBYWPmCxWM7KFAG51QLo8XhKjEbjIUqehGin0LeaUiiGQCA4Bcr+pSCxSgDdbnc5Hofp2knEmt1uX0kpEpAITFWQuGy1WnsnhgMPxqOT5L5wHKa3ODMz834870K/2djdH/S4rKysRZQCMbCzIrqckZGAcssZw0D4w1AVCQSCL2CWBfrBGxsbnSaLZQVpQQPE9uAZphssTGJGPySWChI+n28YHl0kDQDWHcXFxT5tTB92tgU714I+xWIi7EJ9Tk7OGHz00A0WAyZs7YfECwIYDAaHq0g4HI4tgkQoFMozmczfxr3vLCoqyqdUChSYzgqT3CF7bRg7NgKPiAyH6LO9trbWzbimpqYcmFe7HoPA8ASlShwu16PJkIDTVuHRLcP5fJ5tbP+CBBz7ZxkOfvW4fn6uFngh0eYjhLchis1D/yaMZ6NkBZ2eVJGAOS0UOJjdHTC7IzIc7P/DyspKB+Oqq6vz4MB7ZTgouWfSpEkWbUg25RoovAW/n1Xgf8GurkcEzbtuElBmgcBhFYepSGAV321ubrYyrqCgoBDK7Vcsyn4Q9gsSCMdLoag0R8kIgcz4ayYB5Z4WOAxwG0gcVZDdKEhAilX1FZuZCAAVFRUWkHg9GQKUuPMtfUhAUY460X8jEQ6Ha3k1ZDis/KuwYZMGDaEdUoz3vSBRXl5uxQJ+cD0ktJ25CDIjhX4GVU2E2D5XgEpKSkYB96tiJ94UJBCKc0hRnjAJEcVaW1vNsPePVQra7ba3QXIydmsM+j1is1m+USwg+5+RI889MkB2dvZsQaKsrGw0Hr/LcJhoPZfqjNOcUJrZEWbbBQk2P5jdVgWJ42y+JBHNTxPMH6Y6jhQDbhSdUVaMg09IS3YswlpBgh2bFEmRSTQ2VsRCcV1dnR07sUuGY9+DUoO0qQ1+v782Ly9vGiyjSOiD9+so0SI28wv9CkaxckHuhF1pxuBn5STsr8S2FJKfn1+kIgFcu8gnHJIx304FiW7MJ0jwAr8s3oH4SSwUJ95YdcCmF98X748Sfrzcd5tsB+lK/WRAOJHaZXyhmJubG+6HxNe8A4xjMiDxpYLEEdRZZWInMP4SSjBh6wbxHjp36ohcYuZR3Y+dQknY/24JiSXiPUqQMigRkSlnNZs/EyQQndwww+9kOLRubTEEieUyHPRaIzAwpQM6naK8I0d0HS5iYrZ3NrsmvL+gvYvic2+hyOcOVVLEGJ+IfFJaWurBgvyoIBHRzBKHezKC7BoF7jTmG8Kw+vp6jopR3W5FyGQxbU7cRts6ulqeF3v93okIv0MECTjvIFVSBInPBQnOF1iMDoVyXXDm2PmEAwbmXKvAnYLDi6Mv67RBYiVbyWQ1jZUNEF+SxAsPyiFS3se0SeQTrGAAE+xVKHdY1EtMAmTXq0ggAIwQJNBnLkl9MZZCyAil9ynI7AZoJhS6G8lpCtp7+oghGmdoXVI8qFDuEHwim3GMxxxvkCIAwBp6b1S05JyA05J5zHp49RpUCibTsKLvo8o181iIPhy6VRcPTC52KmS85sBSEihMbxEkkNmfUYwXjScbE0SgWddDggs+QUIzly4ZjqtdPGOOzaU7SosNchLU7XRaeklg/PkqEpnOzISzTEz8Qf992JkTyRDgkhtm8SJpSbG/zA6l94mLBz4cwQzfUYzbjd0dLPTB+AuVJDIVJITAuXL58IJ2XL5ihjNQ5COz3Vwj+uB7EYhJfYIPVXy4YhxndpjxJoVyEe3YHBPs4LMqEtZM62OUrPDKwTab0ObwcRPPp9Cm4MLZp8eCyEsk952f+JirjeeE+W5VKBcJ+nzD44ZcpCKBhZhBqRIovFo/aYYpox35JBadylH1erzeTxXKdWm3MEIWq0hgIadRiiXMRR9dNb+dbKL8gjM7FFDtRJd2qcdi0O7JEsp0Nmf42SxKgQSysrMfRHkRf24IYdtnIutPxvE1Vu1yZkfU2a4g0akjsUxBosfrdU+nGy1ajRXRJuKLumUjJ0xw6XFcfqjOHWiHtTtiQWIFyQNLD990UipEFv/5Ihp+MkerACYiND6P36RRj0lwrRY33kqSh+w/4TuTKVWCVX6LksgzKhIgXC7GAvFVMhx+Ty0JFpfPdScep+kaSXBN1IfElT+FZHnnDxSmE2kgBFn8VthvFyVJAqa2K1AU6L2stlz5e05mTj04yk6lgRSc/rLgD3NhBidJQYDLeLfPPU1cUMRJmH2N/0DVsFFEt22q25MBET5EQYlRnixPKxTHv1GuBfjeglK9QkKgj3D1gKgUwtNLaUlLWtKSjPwDZe5GZXmQ1IIAAAAASUVORK5CYII=",NC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADJSURBVHgBjVIBDcIwEOyWCaiESUDCcICDSWAOYArAAXNAkICC4aA4YCg4rqQN3/FNesll67ffv/uvMQIALHkgHX6YyQvZGg3c6MkX8vB7wzppj3L0ManNVHJkJyxcRWXbMO7LW0X9tqqqp//hd+Hhd4jbb04w/+dH2Dhpagx0OJGoXYxGkTiRi1jfyQe5SywhnRlMBkgbONeM3VYHutjNsN6QaTWvAPo4XE5RQFuHlo+mHGMcU7z5WFBxUK8KsidvXsT8OM5YPfIPVIGdCmIf9JEAAAAASUVORK5CYII=",or=t=>{const{source:s,gap:n="200",shortName:a,wrap:r,nameProps:o,fontSize:l=16,showName:c,transparent:u=!1}=t;let d=e.jsx(e.Fragment,{}),g="";switch(s){case"aliexpress":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.aliexpressDark}),g="AliExpress";break;case"temu":d=e.jsx("img",{width:l,style:{minWidth:l},src:kC}),g="Temu";break;case"cj":d=e.jsx("img",{width:l,style:{minWidth:l},src:TC}),g="CJdropshipping";break;case"shopify":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.shopifyDark}),g="Shopify";break;case"woocommerce":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.woocommerceDark}),g="Woocommerce";break;case"zopi":d=e.jsx("img",{width:l,style:{minWidth:l},src:wC}),g="Zopi";break;case"tiktok":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.tiktokDark}),g=a?"TikTok Shop":"TikTok Shop US";break;case"amazon":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.amazonDark}),g=a?"Amazon":"Amazon US";break;case"etsy":d=e.jsx("img",{width:l,style:{minWidth:l},src:EC}),g="Etsy";break;case"ebay":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.ebayDark}),g="Ebay";break;case"prestashop":d=e.jsx("img",{width:l,style:{minWidth:l},src:IC}),g="Prestashop";break;case"wix":d=e.jsx("img",{width:l,style:{minWidth:l},src:jC}
944),g="Wix";break;case"bigcommerce":d=e.jsx("img",{width:l,style:{minWidth:l},src:RC}),g="Bigcommerce";break;case"facebook":d=e.jsx("img",{width:l,style:{minWidth:l},src:u?NC:on.facebookDark}),g="Facebook";break;case"instagram":d=e.jsx("img",{width:l,style:{minWidth:l},src:PC}),g="Instagram";break;case"square-space":d=e.jsx("img",{width:l,style:{minWidth:l},src:od}),g="Squarespace";break;case"meta":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.metaDark}),g="Meta";break;case"walmart":d=e.jsx("img",{width:l,style:{minWidth:l},src:od}),g="Walmart";break;case"google":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.googleDark}),g="Google Merchant Center";break;case"twitter":d=e.jsx("img",{width:l,style:{minWidth:l},src:S0}),g="X (Twitter)";break;case"pinterest":d=e.jsx("img",{width:l,style:{minWidth:l},src:on.pinterestDark}),g="Pinterest";break;case"shop":d=e.jsx("img",{width:l,style:{minWidth:l},src:A0}),g="Shop";break;case"snapchat":d=e.jsx("img",{width:l,style:{minWidth:l},src:v0}),g="Snapchat";break;default:d=e.jsx(e.Fragment,{});break}return e.jsxs(U,{blockAlign:"center",gap:n,wrap:r,children:[d,c?e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",...o,children:g}):""]})},on={aliexpressDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2050%2050%22%20width%3D%2250px%22%20height%3D%2250px%22%3E%3Cpath%20d%3D%22M%209%204%20C%206.2504839%204%204%206.2504839%204%209%20L%204%2041%20C%204%2043.749516%206.2504839%2046%209%2046%20L%2041%2046%20C%2043.749516%2046%2046%2043.749516%2046%2041%20L%2046%209%20C%2046%206.2504839%2043.749516%204%2041%204%20L%209%204%20z%20M%209%206%20L%2041%206%20C%2042.668484%206%2044%207.3315161%2044%209%20L%2044%2012.380859%20C%2043.266738%2011.541629%2042.201883%2011%2041%2011%20L%209%2011%20C%207.7981175%2011%206.7332621%2011.541629%206%2012.380859%20L%206%209%20C%206%207.3315161%207.3315161%206%209%206%20z%20M%2015%2017%20C%2015.553%2017%2016%2017.448%2016%2018%20C%2016%2022.962%2020.037%2027%2025%2027%20C%2029.963%2027%2034%2022.962%2034%2018%20C%2034%2017.448%2034.447%2017%2035%2017%20C%2035.553%2017%2036%2017.448%2036%2018%20C%2036%2024.065%2031.065%2029%2025%2029%20C%2018.935%2029%2014%2024.065%2014%2018%20C%2014%2017.448%2014.447%2017%2015%2017%20z%22%2F%3E%3C%2Fsvg%3E",tiktokDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2.436%204.184C2%205.04%202%206.16%202%208.4v3.2c0%202.24%200%203.36.436%204.216a4%204%200%200%200%201.748%201.748C5.04%2018%206.16%2018%208.4%2018h3.2c2.24%200%203.36%200%204.216-.436a4%204%200%200%200%201.748-1.748C18%2014.96%2018%2013.84%2018%2011.6V8.4c0-2.24%200-3.36-.436-4.216a4%204%200%200%200-1.748-1.748C14.96%202%2013.84%202%2011.6%202H8.4c-2.24%200-3.36%200-4.216.436a4%204%200%200%200-1.748%201.748M11.526%206c.149%201.257.85%202.006%202.064%202.083v1.41c-.705.068-1.325-.162-2.044-.594v2.64c0%203.358-3.662%204.405-5.131%202-.945-1.545-.364-4.266%202.669-4.372v1.493a5%205%200%200%200-.701.173c-.677.225-1.056.657-.95%201.41.206%201.445%202.855%201.872%202.634-.95V6.005z%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E",shopifyDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M10.899%207.402c.112.036.16.157.123.27l-.348%201.036c-.048.144-.211.211-.354.162a2.3%202.3%200%200%200-.72-.127c-.798%200-.833.499-.833.625%200%20.27.278.475.614.723.517.38%201.17.862%201.17%201.837%200%201.264-.798%202.08-1.878%202.08a2.6%202.6%200%200%201-1.852-.698.24.24%200%200%201-.062-.242l.193-.64c.053-.173.27-.239.42-.14.251.165.616.358.946.358a.505.505%200%200%200%20.527-.512c0-.392-.281-.62-.598-.876-.404-.327-.866-.7-.866-1.524%200-1.236.888-2.433%202.676-2.433.394-.012.674.048.841.101M9.165%205.237c.38-.075.57.291.497.62-.074.327-.329.615-.655.64-.325.023-.479-.257-.453-.54a.84.84%200%200%201%20.611-.72%22%20fill%3D%22%234A4A4A%22%2F%3
944E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2.436%204.184C2%205.04%202%206.16%202%208.4v3.2c0%202.24%200%203.36.436%204.216a4%204%200%200%200%201.748%201.748C5.04%2018%206.16%2018%208.4%2018h3.2c2.24%200%203.36%200%204.216-.436a4%204%200%200%200%201.748-1.748C18%2014.96%2018%2013.84%2018%2011.6V8.4c0-2.24%200-3.36-.436-4.216a4%204%200%200%200-1.748-1.748C14.96%202%2013.84%202%2011.6%202H8.4c-2.24%200-3.36%200-4.216.436a4%204%200%200%200-1.748%201.748m10.455%201.66L11.833%204.42a.96.96%200%200%200-.827-.42%202%202%200%200%200-.452.081l-2.032.503-.798.195a.85.85%200%200%200-.52.37L6.11%206.75a1.2%201.2%200%200%200-.213.511q-.029.202-.053.405l-.002.024q-.264%202.07-.534%204.15l-.24%201.852q-.007.064-.02.141c-.054.32-.131.79.208.886.221.064.456.1.689.138q.171.026.339.057l5.641%201.072c.297.058.573-.064.639-.392a2%202%200%200%200%20.018-.252l.063-1.304.218-4.448q.076-1.61.16-3.22a.72.72%200%200%200-.132-.526m.665%209.035.039-.795.217-4.449q.075-1.59.158-3.181a1.7%201.7%200%200%200-.037-.58c.08.094.131.21.148.333l1.13%208.319a.392.392%200%200%201-.424.48z%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E",amazonDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M7.434%209.269c1.381%200%201.41-1.382%201.41-1.946v-.31c-1.072%200-2.256.14-2.256%201.41%200%200%200%20.846.846.846%22%20fill%3D%22%234A4A4A%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M0%206.4c0-2.24%200-3.36.436-4.216A4%204%200%200%201%202.184.436C3.04%200%204.16%200%206.4%200h3.2c2.24%200%203.36%200%204.216.436a4%204%200%200%201%201.748%201.748C16%203.04%2016%204.16%2016%206.4v3.2c0%202.24%200%203.36-.436%204.216a4%204%200%200%201-1.748%201.748C12.96%2016%2011.84%2016%209.6%2016H6.4c-2.24%200-3.36%200-4.216-.436a4%204%200%200%201-1.748-1.748C0%2012.96%200%2011.84%200%209.6zm12.397%205.69c-1.184.874-2.96%201.41-4.399%201.41-2.059%200-3.892-.818-5.302-2.087-.113-.113%200-.226.113-.17a10.2%2010.2%200%200%200%205.16%201.383c1.298%200%202.934-.282%204.26-.846.197-.057.366.169.168.31m.423-.592c-.12-.17-.762-.11-1.173-.073q-.101.01-.18.016c-.113%200-.141-.084-.028-.169.648-.48%201.748-.338%201.86-.17.114.17-.027%201.27-.648%201.778-.084.084-.197.028-.14-.057.14-.338.45-1.128.31-1.325m-1.243-2.08.059.076c.112.141.14.31%200%20.423-.31.254-.846.733-1.128.987-.085.085-.226.085-.339.028-.42-.37-.559-.59-.758-.904l-.088-.139c-.818.818-1.438%201.072-2.482%201.072-1.24%200-2.2-.762-2.2-2.313%200-1.213.65-2.03%201.58-2.425.79-.339%201.748-.339%202.65-.339v-.846c0-.677-.591-.846-.902-.846-.564%200-1.043.282-1.156.874-.028.141-.113.282-.254.282L5.121%205.18c-.113-.028-.254-.113-.226-.31C5.234%203.12%206.588%202.5%208.14%202.5c.733%200%201.663.197%202.228.733.704.677.704%201.551.704%202.538v2.341c0%20.656.245.97.506%201.307%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E",woocommerceDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.90909%202C4.13755%202%203.39761%202.30649%202.85205%202.85205C2.30649%203.39761%202%204.13755%202%204.90909V15.0909C2%2015.8624%202.30649%2016.6024%202.85205%2017.1479C3.39761%2017.6935%204.13755%2018%204.90909%2018H15.0909C15.8624%2018%2016.6024%2017.6935%2017.1479%2017.1479C17.6935%2016.6024%2018%2015.8624%2018%2015.0909V4.90909C18%204.13755%2017.6935%203.39761%2017.1479%202.85205C16.6024%202.30649%2015.8624%202%2015.0909%202H4.90909ZM4.18182%208.05091C4.18182%207.46618%204.65527%206.99273%205.24%206.99273H14.76C15.3447%206.99273%2015.8182%207.46618%2015.8182%208.05091V11.7527C15.8182%2012.3375%2015.3447%2012.8109%2014.7607%2012.8109H11.7135L12.3731%2014.4618L9.40218%2012.8109H5.24C4.95948%2012.8109%204.69044%2012.6995%204.49201%2012.5012C4.29358%2012.3029%204.18201%2012.034%204.18182%2011.7535V8.05091ZM9.47273%207.56145C9.69818%207.672%209.79127%207.94473%209.68%208.17018C9.13091%209.28873%208.96509%2010.4865%209.08073%2011.7578C9.08945%2011.853%209.06796%2011.9485%209.01929%2012.0308C8.97062
944%2012.113%208.89725%2012.1779%208.80963%2012.216C8.722%2012.2542%208.62457%2012.2638%208.53119%2012.2434C8.4378%2012.223%208.35322%2012.1738%208.28945%2012.1025C7.81159%2011.5745%207.45162%2010.9507%207.23345%2010.2727L6.29964%2012.0145C6.25738%2012.0922%206.19356%2012.156%206.11588%2012.1982C6.03819%2012.2404%205.94996%2012.2592%205.86182%2012.2524C5.64%2012.2342%205.50764%2012.0713%205.44582%2011.8742C5.35375%2011.5686%205.27177%2011.2601%205.2%2010.9491C4.99134%2010.0295%204.83545%209.09881%204.73309%208.16145C4.72146%208.04262%204.75705%207.92399%204.83217%207.83118C4.90729%207.73838%205.01591%207.67886%205.13456%207.66548C5.25321%207.65211%205.37235%207.68596%205.46625%207.75971C5.56014%207.83346%205.62125%207.9412%205.63636%208.05964C5.72962%208.90124%205.86604%209.73749%206.04509%2010.5651L7.02836%208.73236C7.07461%208.64628%207.14736%208.5774%207.23583%208.53591C7.3243%208.49443%207.42379%208.48257%207.51954%208.50208C7.61529%208.52159%207.7022%208.57143%207.76739%208.64422C7.83258%208.71701%207.87258%208.80887%207.88145%208.90618C7.92364%209.37164%208.01964%209.80582%208.176%2010.2102C8.25603%209.36173%208.48912%208.53479%208.864%207.76945C8.89028%207.7158%208.92688%207.66785%208.9717%207.62835C9.01653%207.58885%209.0687%207.55857%209.12524%207.53926C9.18178%207.51994%209.24157%207.51195%209.30119%207.51576C9.36082%207.51957%209.41911%207.5351%209.47273%207.56145ZM11.2567%208.04582C10.8102%207.95564%2010.3985%208.14036%2010.1025%208.42109C9.80655%208.70182%209.59055%209.10545%209.49891%209.55855C9.40655%2010.0124%209.448%2010.4676%209.61236%2010.8422C9.776%2011.2153%2010.0829%2011.5462%2010.5287%2011.6364C10.976%2011.7265%2011.3869%2011.5418%2011.6829%2011.2611C11.9789%2010.9804%2012.1949%2010.5775%2012.2865%2010.1236C12.3789%209.67055%2012.3375%209.21455%2012.1731%208.84073C12.0102%208.46764%2011.7025%208.13673%2011.2567%208.04582ZM13.128%208.45745C13.4145%208.17382%2013.8218%207.97309%2014.2705%208.06327C14.72%208.15345%2015.0175%208.49673%2015.1702%208.87054C15.3251%209.24654%2015.3593%209.70473%2015.2669%2010.16C15.1738%2010.616%2014.9629%2011.024%2014.6735%2011.3105C14.3869%2011.5942%2013.9796%2011.7956%2013.5309%2011.7055C13.0815%2011.6145%2012.784%2011.272%2012.6305%2010.8982C12.4764%2010.5215%2012.4415%2010.064%2012.5345%209.608C12.6276%209.152%2012.8385%208.74473%2013.128%208.45745ZM10.3898%209.73891C10.4487%209.44727%2010.5825%209.21891%2010.728%209.08073C10.8749%208.94255%2010.9985%208.92073%2011.0764%208.93673C11.1542%208.95273%2011.2596%209.02036%2011.3404%209.20509C11.4204%209.38836%2011.4553%209.65091%2011.3964%209.94327C11.3367%2010.2349%2011.2036%2010.4633%2011.0582%2010.6015C10.9113%2010.7396%2010.7876%2010.7615%2010.7098%2010.7455C10.632%2010.7295%2010.5258%2010.6618%2010.4451%2010.4771C10.3651%2010.2938%2010.3302%2010.0313%2010.3898%209.73891ZM13.4255%209.78982C13.4873%209.48582%2013.6225%209.24727%2013.7673%209.10327C13.9156%208.95709%2014.032%208.94255%2014.0916%208.95418C14.1505%208.96655%2014.2509%209.024%2014.3295%209.21527C14.4065%209.40291%2014.4385%209.67491%2014.376%209.97891C14.3142%2010.2822%2014.1789%2010.5207%2014.0335%2010.6647C13.8858%2010.8116%2013.7695%2010.8262%2013.7098%2010.8138C13.6509%2010.8022%2013.5498%2010.7447%2013.472%2010.5535C13.3949%2010.3644%2013.3629%2010.0938%2013.4255%209.78982Z%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E",ebayDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M8.566%2011.09c-.965.011-.95-.972-.95-.972s-.035-.969.949-.993c.983-.024.969%201.013.969%201.013s-.002.94-.968.952M4.631%209.86s.043-.74.906-.74c.86-.001.86.74.86.74zm6.756%201.25s-.614%200-.65-.467c-.039-.5.944-.52.944-.52h.695c.003.03.095%201-.99.987%22%20fill%3D%22%234A4A4A%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2.436%204.184C2%205.04%202%206.16%202%208.4v3.2c0%202.24%200%203.36.436%204.216a4%204%200%200%200%201.748%201.748C5.04%2018%206.16%2018%208.4%2018h3.2c2.24%200%203.36%200%204.216-.436a4%204%200%200%200%201.748-1.748C18%2014.96%2018%2013.84%2018%2011.6V8.4c0-2.24%200-3.36-.436-4.216a4%204%200%200%200-1.748-1.748C14.96%202%2013.84%202%2011.6%202H8.4c-2.24%200-3.36%200-4.216.436a4%204%200%200%200-1.748%201.748m6.27%204.548c-.764-.004-1.093.43-1.093.43v-1.43H7v2.277c-.03-.418-.243-1.277-1.5-1.277-1.5%200-1.507%201.132-1.5%201.426%200%200-.073%201.324%201.515%201.324%201.365%200%201.432-.83%201.432-.83h-.628s-.122.458-.8.446c-.874-.016-.908-.866-.908-.866h2.39v1.25h.578l.026-.434s.278.434%201.089.434c.679%200%201.238-.332%201.413-.956-.082.73.621.959%201.174.956.566-.003.89-.165%201.13-.455l.026.458.563-.003V9.78l-.002-.034c-.014-.308-.046-.961-1.317-1.01%200%200-1.22-.105-1.386.745h.647c.033-.104.169-.367.696-.358.621.011.735.25.731.608l-.71.002c-.301.
944002-1.313.077-1.516.629a2%202%200%200%200%20.02-.235c.017-.88-.692-1.392-1.456-1.396m4.605%200h-.702l1.393%202.634-.537%201.116h.678L16%208.732h-.634l-1.029%202.046z%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E",facebookDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M2.436%204.184C2%205.04%202%206.16%202%208.4v3.2c0%202.24%200%203.36.436%204.216a4%204%200%200%200%201.748%201.748C5.04%2018%206.16%2018%208.4%2018h.381v-5.687H6.75V9.96h2.031V8.167C8.781%206.127%209.976%205%2011.803%205c.875%200%201.79.159%201.79.159v2.003h-1.008c-.994%200-1.304.627-1.304%201.271V9.96H13.5l-.355%202.352h-1.864V18h.319c2.24%200%203.36%200%204.216-.436a4%204%200%200%200%201.748-1.748C18%2014.96%2018%2013.84%2018%2011.6V8.4c0-2.24%200-3.36-.436-4.216a4%204%200%200%200-1.748-1.748C14.96%202%2013.84%202%2011.6%202H8.4c-2.24%200-3.36%200-4.216.436a4%204%200%200%200-1.748%201.748%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E",metaDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22m8.514%209.828.273-.43.559-.852q-.3-.444-.65-.85a1.95%201.95%200%200%200-1.474-.786%201.82%201.82%200%200%200-1.422.954%206.33%206.33%200%200%200-.897%203.326c-.016.384.072.766.254%201.104a.84.84%200%200%200%20.746.429c.364%200%20.695-.091%201.345-.98.414-.57.882-1.31%201.266-1.915m4.846%202.356c.344.416.585.539.897.539.799%200%20.993-.728%201.02-1.578a6.6%206.6%200%200%200-.89-3.469%202.03%202.03%200%200%200-1.618-1.078c-.669%200-1.208.506-1.819%201.41a2%202%200%200%200-.11.175q.131.22.284.467.177.285.365.604l.338.559q.692%201.233%201.533%202.37%22%20fill%3D%22%234A4A4A%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2.436%204.184C2%205.04%202%206.16%202%208.4v3.2c0%202.24%200%203.36.436%204.216a4%204%200%200%200%201.748%201.748C5.04%2018%206.16%2018%208.4%2018h3.2c2.24%200%203.36%200%204.216-.436a4%204%200%200%200%201.748-1.748C18%2014.96%2018%2013.84%2018%2011.6V8.4c0-2.24%200-3.36-.436-4.216a4%204%200%200%200-1.748-1.748C14.96%202%2013.84%202%2011.6%202H8.4c-2.24%200-3.36%200-4.216.436a4%204%200%200%200-1.748%201.748m11.851%201.782a3.1%203.1%200%200%201%201.074%201.119%207.24%207.24%200%200%201%201.13%204.027q.018.324%200%20.65-.064.379-.195.74l-.078.227a3%203%200%200%201-.201.41%201.95%201.95%200%200%201-1.767.98%202.2%202.2%200%200%201-1.656-.65%209.6%209.6%200%200%201-1.332-1.798L10.1%209.722l-.098-.162q-.047.088-.104.175l-.41.728A17%2017%200%200%201%208.054%2012.8c-.72.935-1.331%201.299-2.143%201.299a2.1%202.1%200%200%201-1.949-1.04%202.9%202.9%200%200%201-.344-.883%204.6%204.6%200%200%201-.117-1.065%207.46%207.46%200%200%201%201.104-3.897A3.25%203.25%200%200%201%207.242%205.5c.687%200%201.352.25%201.87.702q.59.5%201.059%201.117.433-.61.987-1.111a2.54%202.54%200%200%201%201.65-.708c.524.029%201.033.19%201.479.466%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E",googleDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2.436%204.184C2%205.04%202%206.16%202%208.4v3.2c0%202.24%200%203.36.436%204.216a4%204%200%200%200%201.748%201.748C5.04%2018%206.16%2018%208.4%2018h3.2c2.24%200%203.36%200%204.216-.436a4%204%200%200%200%201.748-1.748C18%2014.96%2018%2013.84%2018%2011.6V8.4c0-2.24%200-3.36-.436-4.216a4%204%200%200%200-1.748-1.748C14.96%202%2013.84%202%2011.6%202H8.4c-2.24%200-3.36%200-4.216.436a4%204%200%200%200-1.748%201.748m7.676%202.506c.827%200%201.562.28%202.148.82l1.607-1.575c-.974-.89-2.24-1.435-3.755-1.435a5.62%205.62%200%200%200-5.01%203.035%205.34%205.34%200%200%200%200%204.93v.005a5.62%205.62%200%200%200%205.01%203.03c1.515%200%202.786-.49%203.714-1.33%201.062-.96%201.674-2.37%201.674-4.045A6%206%200%200%200%2015.398%209h-5.286v2.13h3.02a2.54%202.54%200%200%201-1.127%201.655c-.5.33-1.138.53-1.893.53-1.459%200-2.699-.965-3.143-2.265h-.006l.006-.005A3.2%203.2%200%200%201%206.791%2010c0-.365.066-.715.178-1.045.444-1.3%201.684-2.265%203.143-2.265%22%20fill%3D%22%234A4A4A%22%2F%3
944E%3C%2Fsvg%3E",pinterestDark:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2.436%204.184C2%205.04%202%206.16%202%208.4v3.2c0%202.24%200%203.36.436%204.216a4%204%200%200%200%201.748%201.748C5.04%2018%206.16%2018%208.4%2018h3.2c2.24%200%203.36%200%204.216-.436a4%204%200%200%200%201.748-1.748C18%2014.96%2018%2013.84%2018%2011.6V8.4c0-2.24%200-3.36-.436-4.216a4%204%200%200%200-1.748-1.748C14.96%202%2013.84%202%2011.6%202H8.4c-2.24%200-3.36%200-4.216.436a4%204%200%200%200-1.748%201.748m7.692.316C6.942%204.5%205.25%206.511%205.25%208.7c0%201.02.576%202.287%201.499%202.69.14.061.214.035.246-.092l.065-.25.14-.538c.018-.07.01-.13-.05-.198-.306-.349-.55-.988-.55-1.585%200-1.531%201.232-3.013%203.333-3.013%201.813%200%203.083%201.163%203.083%202.825%200%201.877-1.009%203.178-2.32%203.178-.725%200-1.268-.563-1.094-1.254.075-.298.176-.604.274-.902.173-.527.338-1.029.338-1.41%200-.532-.304-.977-.934-.977-.74%200-1.336.72-1.336%201.686%200%20.614.221%201.03.221%201.03s-.731%202.91-.865%203.45c-.149.598-.091%201.438-.027%201.987.167.062.333.123.505.173.302-.46.752-1.217.918-1.82l.46-1.65c.24.432.944.797%201.692.797%202.226%200%203.83-1.925%203.83-4.318%200-2.293-1.99-4.009-4.55-4.009%22%20fill%3D%22%234A4A4A%22%2F%3E%3C%2Fsvg%3E"},OC=({onCancelPlan:t,onResumePlan:s,onChangePlan:n,renderCycleUsage:a,app:r})=>{const{isPlanFree:o,getCurrentPlan:l,getUserInfo:c}=de(),u=c(),g=dt().getListShop(),h=l(r),[p,x]=i.useState(!1),f=i.useRef(null),{isMobile:_}=xe(),{t:b}=J(),v=i.useRef(null),y=i.useRef(null),C=!o(r)&&h.status==="ACTIVE",S=!o(r)&&h.status==="CANCELLED",j=g.find(le=>le.id===h.store_id),A=h.package?.key!==al&&!u.is_user_mkt&&C,E=i.useRef(null),T=h.package?.cycle===365,k=h.package?.price||0,O=k?k*12/(12-tt):0,R=h.bonus_credit||0,P=h.bonus_credit_used||0,w=h?.main_credit||0,N=le=>le.map(ie=>ie.key),K=i.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),L=i.useCallback(()=>{K(),x(!0)},[K]),W=i.useCallback(()=>{K(),f.current=setTimeout(()=>{x(!1),f.current=null},150)},[K]);i.useEffect(()=>()=>K(),[K]);const H=()=>{const le=[{icon:yg,label:`${tt}-month off`,value:e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,children:[e.jsxs(m,{as:"span",variant:"bodyMd",fontWeight:"medium",children:["$",Fe(k)]}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"subdued",textDecorationLine:"line-through",children:["$",Fe(Vt(O))]}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"subdued",children:["/",b("Month").toLowerCase()]})]})},{icon:fo,label:"RedeemUnusedMonths",value:e.jsx(e.Fragment,{children:T?e.jsx(e.Fragment,{children:h.redeemable_months||h.is_redeemed?e.jsxs(m,{as:"span",variant:"bodyMd",tone:"subdued",children:[h.is_redeemed&&h.redeemed_at?b("ReedemedMonthOneTime",{month:it(h.redeemed_at).format("MMM DD")}):b("UnusedMonthAvailable",{count:h.redeemable_months})," "]}):e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:b("NoMonthsToRedeemYet")})}):e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:b("1timeRedeemUnusedCreditsOption")})})},{icon:Cg,label:b("ExtraAICredits"),value:e.jsx(e.Fragment,{children:T?e.jsxs(m,{as:"span",variant:"bodyMd",children:[Fe(P>R?0:R-P)," ",e.jsxs(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:["/ ",R===-1?b("Unlimited"):Fe(R)]})]}):e.jsxs(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:[Fe(Math.round(w*5/100))," "]})})}];return e.jsx(Q,{padding:"400",minWidth:"425px",children:e.jsxs(D,{gap:"100",children:[e.jsx(ih,{app:r}),e.jsx(Q,{paddingBlock:"200",paddingInline:"100",children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"semibold",children:b("ExclusiveOffer")})}),le.map(B=>e.jsx(Q,{paddingBlock:"200",children:e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,children:[e.jsx(ee,{source:B.icon,tone:"subdued"}),e.jsx(Q,{width:"100%",children:e.jsxs(U,{align:"space-between",blockAlign:"center",gap:"200",wrap:!1,children:[e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:B.label}),B.value]})})]})},B.label))]})})},Z=()=>{const le=e.jsxs(e.Fragment,{children:[S&&h.package?.modules?e.jsx(re,{onClick:()=>s({keys:N(h?.package?.modules||[]),price:h.package?.price||0,isYearly:h?.package?.cycle===365}),size:_?"large":void 0,variant:"plain",children:b("ResumePlan")}):"",A&&e.jsx(re,{variant:"tertiary",onClick:t,size:_?"large":void 0,children:b("CancelPlan")})]});return _?e.jsx(D,{gap:"200",children:le}):e.jsx(Q,{children:e.jsx(U,{align:"end",blockAlign:"center",children:e.jsx(U,{gap:"200",blockAlign:"center",children:le})})})},te=()=>e.jsxs(D,{gap:"050",children:[e.jsx(m,{variant:"bodySm",as:"p",tone:"subdued",children:b("BillingTo")}),e.jsx(m,{variant:"headingSm",as:"p",fontWeight:"semibold",children:h?.provider_payment?.includes("SHOPIFY")&&j?e.jsxs(U,{gap:"050",blockAlign:"center",children:[e.jsx(Q,{children:e.jsx(or,{source:"shopify"})}),e.jsx("span",{children:j?.domain||""})]}):h?.payment_information?.last_four_digits&&h?.payment_information?.card_type?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["··· ",h?.payment_information?.last_four_digits||""]})," ",e.jsx("span",{children:b("VisaMasterCard")})]}):"-"})]}),ne=()=>_?e.jsxs(D,{gap:"600",children:[e.jsx(Q,{background:"bg-surface",borderRadius:"200",borderColor:"border",borderWidth:"025",padding:"600",children:te()}),Z()]}):e.jsxs(ft,{columns:"4fr 2fr",gap:"1200",children:[e.jsxs(D,{gap:"400",children:[e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsxs(D,{gap:"200",children:[e.jsxs(U,{align:"start",blockAlign:"center",gap:"200",wrap:!1,children:[e.jsx(m,{variant:"headingSm",as:"p",fontWeight:"semibold",tone:"subdued",children:h.package?.modules?.[0]?.name?.toUpperCase()}),T&&e.jsx(Gs,{active:p,activator:e.jsx("div",{onMouseEnter:L,onMouseLeave:W,onClick:le=>{le.stopPropagation(),L()},children:e.jsxs(U,{gap:"150",blockAlign:"center",wrap:!1,children:[e.jsx(Qp,{}),e.jsx("span",{className:"text-[13px] underline decoration-dotted font-medium leading-4 whitespace-nowrap bg-clip-text text-transparent",style:{backgroundImage:"linear-gradient(69.65deg, #10245a 1.73%, #695edf 25.2%, #4458ed 46.89%, #5737e6 60.27%)"},children:b("YearlyActivated")})]})}),onClose:()=>{K(),x(!1)},children:e.jsx("div",{onMouseEnter:L,onMouseLeave:W,onClick:le=>{le.stopPropagation(),L()},children:H()})})]}),e.jsxs(U,{blockAlign:"center",gap:"200",align:"start",wrap:!1,children:[e.jsx(cs,{value:h.package?.price||0,prefix:"$"})," ",e.jsx(m,{variant:"heading3xl",as:"p",fontWeight:"bold",children:"USD"})]})]}),e.jsx(rh,{variant:"primary",onClick:n})]}),a()]}),e.jsx(Q,{paddingBlock:"500",paddingInline:"400",background:"bg-surface-selected",borderRadius:"200",children:e.jsxs("div",{className:"flex flex-col gap-4 h-[100%] justify-between",children:[e.jsxs(D,{gap:"400",children:[e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsx(m,{variant:"headingSm",as:"h3",children:b("Payment")}),o()&&e.jsx("div",{className:"mt-1",children:e.jsx(m,{as:"span",tone:"subdued",variant:"bodyMd",children:b("DescreiptionFreeSubcription")})})]}),te(),e.jsxs(D,{gap:"050",children:[e.jsx(m,{variant:"bodySm",as:"p",tone:"subdued",children:b("Billing
944Cycle")}),e.jsxs(U,{gap:"150",blockAlign:"center",children:[e.jsx(m,{variant:"headingSm",as:"p",fontWeight:"semibold",children:o()?"-":h?.package?.cycle!==365?b("Monthly"):b("Yearly")}),h?.discount&&e.jsx(Q,{background:"bg-fill-magic-secondary",borderRadius:"200",paddingBlock:"050",paddingInline:"200",children:e.jsx(m,{variant:"bodySm",as:"p",tone:"subdued",children:e.jsxs(m,{variant:"bodySm",as:"p",tone:"magic",children:[h?.discount?.code," ⢠",h?.discount?.discount?.value," ",h?.discount?.discount?.type==="percentage"?"%":"$"," discount for"," ",h?.discount?.discount?.targets?.find(le=>le.target_type==="app_plan")?.target_cycle," ",b("Months").toLowerCase()]})})})]})]}),e.jsxs(D,{gap:"050",children:[e.jsx(m,{variant:"bodySm",as:"p",tone:"subdued",children:b("EmailStore")}),e.jsx(U,{gap:"150",blockAlign:"center",children:e.jsx(m,{variant:"headingSm",as:"p",fontWeight:"semibold",children:j?.owner_email||"-"})})]}),e.jsxs(D,{gap:"050",children:[e.jsx(m,{variant:"bodySm",as:"p",tone:"subdued",children:b("StoreName")}),e.jsx(U,{gap:"150",blockAlign:"center",children:j?.store_name||"-"})]})]}),Z()]})})]});return e.jsxs(e.Fragment,{children:[ne(),e.jsx(SC,{ref:y,onConfirmChange:le=>{v.current?.onChangeStorePayment(le)}}),e.jsx(un,{ref:v,onChargeError:()=>{},app:r}),e.jsx(ah,{ref:E,app:r})]})},ih=({app:t})=>{const{getCurrentPlan:s,fetchCurrentPlan:n}=de(),a=s(t),r=a.package?.cycle===365,o=a.redeemed_credit||0,l=a.is_redeemed||!1,c=o>0&&!l,[u,d]=i.useState(!1),{t:g}=J(),h=bt(),p=async()=>{d(!0),(await ls.postRedeemCredit())?.status===fe.OK&&(n(),h.success(g("RedeemCreditsSuccessfully"))),d(!1)};return e.jsx(Qe,{id:"unused-months",open:c&&r,transition:{duration:"500ms",timingFunction:"ease-in-out"},children:e.jsx(Q,{padding:"200",borderRadius:"200",background:"bg-surface-info",children:e.jsxs(ft,{columns:"1fr 100px",gap:"100",alignItems:"center",children:[e.jsxs(U,{gap:"200",blockAlign:"center",wrap:!1,children:[e.jsx(Q,{children:e.jsx("div",{className:"[&_svg]:fill-text-info!",children:e.jsx(ee,{source:Na})})}),e.jsx("div",{className:"text-text-info",children:e.jsxs(D,{gap:"050",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"medium",children:g("UnusedMonthAvailable",{count:a.redeemable_months})})," ",e.jsx(m,{as:"span",variant:"bodySm",children:g("TurnCreditsIntoAIUsage")})]})})]}),e.jsx(Q,{children:e.jsx(re,{onClick:p,loading:u,children:g("ReedemNow")})})]})})})},DC=({app:t})=>{const{t:s}=J(),{isMobile:n}=xe(),{getCurrentPlan:a}=de(),r=a(t),o=i.useRef(null),{next_billing_time:l,start_time:c}=r,u=r.package?.cycle===365,d=r?.main_credit_used||0,g=r?.main_credit||0,h=Math.round(d*100/g),p=r.bonus_credit||0,x=r.bonus_credit_used||0,f=Math.round(x*100/p),_=l?at.join([it(c).format("ll"),it(l).format("ll")]," - "):"N/A",b=i.useMemo(()=>r.package?.features?.PRODUCT_LISTING||{usage:0,limit:1},[r.package]),v=i.useMemo(()=>r.package?.features?.ORDER_FULFILLMENT||{usage:0,limit:1},[r.package]),y=[{key:"extra-credit",icon:e.jsx(ee,{source:ra}),title:"ExtraCredit",used:x,total:p,percent:f},{key:"ai",icon:e.jsxs("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M9.49689 4.88867C9.55398 4.90943 9.56894 4.9311 9.57697 4.94629C9.59755 4.98528 9.60738 5.02853 9.6004 5.08887L9.00568 9.90039L8.94708 10.376H12.4598C12.5118 10.376 12.53 10.3871 12.534 10.3896C12.5378 10.3921 12.5557 10.4046 12.5779 10.4531H12.5789C12.6011 10.5015 12.5995 10.5255 12.5984 10.5332C12.5973 10.5412 12.5924 10.5651 12.5584 10.6064L7.25861 16.9541C7.22342 16.9958 7.19264 17.0118 7.16095 17.0195C7.12637 17.0274 7.09386 17.0257 7.04962 17.0059H7.04767C7.00047 16.9849 6.97476 16.9595 6.95587 16.9277C6.9488 16.9156 6.94276 16.9013 6.93927 16.8828L6.93829 16.8125L7.54962 12.5518L7.61896 12.0684H4.60431C4.55343 12.0683 4.53279 12.0576 4.52618 12.0537C4.52043 12.0502 4.50276 12.0388 4.48126 11.9971C4.45955 11.9549 4.46036 11.9347 4.46075 11.9297C4.46125 11.9239 4.46426 11.9028 4.49298 11.8633L4.49884 11.8545L9.26056 4.95605C9.29831 4.90401 9.33137 4.88587 9.36017 4.87695C9.38851 4.86821 9.42902 4.86409 9.49689 4.88867Z",stroke:"#4A4A4A",strokeWidth:"0.84618"}),e.jsx("path",{d:"M11.7388 8.56028C13.7157 8.56028 14.5773 7.72859
94414.5773 5.72174C14.5773 7.72859 15.433 8.56028 17.4158 8.56028C15.433 8.56028 14.5773 9.41594 14.5773 11.3988C14.5773 9.41594 13.7157 8.56028 11.7388 8.56028Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.473089",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 13.222C2.88398 13.222 3.26927 12.8501 3.26927 11.9527C3.26927 12.8501 3.65189 13.222 4.53854 13.222C3.65189 13.222 3.26927 13.6046 3.26927 14.4913C3.26927 13.6046 2.88398 13.222 2 13.222Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.346165",strokeLinejoin:"round"})]}),title:"AICredits",used:d,total:g,percent:h},{key:"product",icon:e.jsx(ee,{source:ms}),title:"Products",used:b.usage,total:b.limit,percent:b.limit===-1?3:Math.round(b.usage*100/b.limit)},{key:"orders",icon:e.jsx(ee,{source:sa}),title:"Orders",used:v.usage,total:v.limit,percent:v.limit===-1?3:Math.round(v.usage*100/v.limit)}],S=t==="AO"?[...y].filter(A=>!u&&x<p&&p?!0:A.key!=="extra-credit"):[{key:"credits",icon:e.jsx(ee,{source:ra}),title:"ViewCredits",used:d,total:g,percent:h}],j=()=>n?e.jsxs(D,{gap:"200",children:[e.jsxs(sn,{as:"span",tone:"disabled",fontWeight:"regular",variant:"bodyXs",children:["(",_,")"]}),e.jsxs(D,{gap:"400",children:[e.jsx(Q,{background:"bg-surface",borderRadius:"200",paddingBlock:"400",paddingInline:"400",borderColor:"border",borderWidth:"025",children:e.jsx(D,{gap:"800",children:S.map(A=>e.jsx(i.Fragment,{children:e.jsxs(D,{gap:"200",children:[e.jsxs(U,{align:"space-between",wrap:!1,children:[e.jsxs(U,{gap:"200",blockAlign:"center",children:[e.jsx("div",{className:"w-[20px] h-[20px]",children:A.icon}),e.jsx(m,{as:"span",variant:"bodyXs",children:s(A.title)})]}),e.jsxs(m,{as:"span",variant:"bodyXs",tone:"subdued",children:[Fe(A.used)," / ",A.total===-1?s("Unlimited"):Fe(A.total)," "]})]}),e.jsx("div",{className:"w-full",children:e.jsx(xo,{size:"small",progress:A.percent||3,tone:"primary"})})]})},A.key))})}),e.jsxs("button",{className:"bg-white border-[0.5px] border-[#e3e3e3] rounded-xl p-4 flex items-center justify-between gap-2 w-full cursor-pointer",onClick:()=>o.current?.open(),children:[s("ActivityLog"),e.jsxs(Q,{children:[" ",e.jsx(ee,{source:Rs})]})]})]})]}):e.jsx(nt,{padding:"0",children:e.jsx(Q,{minHeight:"233px",padding:"400",children:e.jsxs(D,{gap:"300",children:[e.jsx(ih,{app:t}),e.jsxs("div",{className:"flex justify-between items-center flex-wrap gap-1",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-2",children:[e.jsx(sn,{as:"span",variant:"headingSm",fontWeight:"semibold",children:s("UsageBalance")}),e.jsxs(sn,{as:"span",tone:"disabled",children:["(",_,")"]})]}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:e.jsxs("div",{onClick:()=>o.current?.open(),className:"group inline-flex items-center cursor-pointer hover:bg-bg-fill-tertiary p-1 px-2 pr-0.5 rounded-md text-icon-emphasis [&_svg]:fill-icon-emphasis!",children:[s("ActivityLog"),e.jsx(ee,{source:Ys})]})})]}),e.jsx(Q,{paddingBlock:"300",children:e.jsx(D,{gap:"500",children:S.map(A=>e.jsx(Q,{paddingBlock:"150",children:e.jsxs(ft,{columns:"130px 1fr",gap:"200",alignItems:"center",children:[e.jsxs(U,{gap:"200",children:[e.jsx("div",{children:A.icon}),e.jsx(m,{as:"span",fontWeight:"medium",children:s(A.title)})]}),e.jsxs(ft,{columns:"minmax(0,1fr) 80px",gap:"400",alignItems:"center",children:[e.jsx(xo,{size:"small",progress:A.percent?A.percent<1?1:A.percent:0,tone:"primary",animated:!0}),e.jsxs(m,{as:"span",tone:"subdued",alignment:"end",children:[Fe(A.used),"/"," ",e.jsx(m,{as:"span",fontWeight:"medium",tone:"base",children:A.total===-1?s("Unlimited"):Fe(A.total)})," "]})]})]})},A.key))})})]})})});return e.jsxs(e.Fragment,{children:[j(),e.jsx(ah,{ref:o,app:t})]})},ua={GET_NOTIFICATION_SETTINGS:"/core/v2/notifications/setting",POST_NOTIFICATION_SETTINGS:"/core/v2/notifications/setting",GET_NOTIFICATION_UNREAD_COUNT:"/core/v2/notifications/count-group-unread",GET_NOTIFICATION_BY_TYPE:`/core/v2/notifications/list/:${Ct.NOTIFICATION_TYPE}`,POST_MARK_AS_READ_V2:`/core/v2/notifications/mark-as-read/:${Ct.NOTIFICATION_ID}`,POST_MARK_AS_READ_ALL:"/core/v2/notifications/mark-all-as-read",POST_MARK_AS_READ_BY_TYPE:`/core/v2/notifications/mark-all-as-read/:${Ct.NOTIFICATION_TYPE}`},LC=async()=>X(ua.GET_NOTIFICATION_SETTINGS,{},{method:"GET"}),MC=async t=>X(ua.POST_NOTIFICATION_SETTINGS,t,{method:"POST"}),UC=async()=>X(ua.GET_NOTIFICATION_UNREAD_COUNT,{},{method:"GET"}),FC=async t=>{const s=ua.GET_NOTIFICATION_BY_TYPE.replace(`:${Ct.NOTIFICATION_TYPE}`,t.type);return X(s,t,{method:"GET"})},BC=async t=>{const s=ua.POST_MARK_AS_READ_V2.replace(`:${Ct.NOTIFICATION_ID}`,t.id.toString());return X(s,{},{method:"POST"})},HC=async t=>X(ua.POST_MARK_AS_READ_ALL,t,{method:"POST"}),GC=async t=>{const s=ua.POST_MARK_AS_READ_BY_TYPE.replace(`:${Ct.NOTIFICATION_TYPE}`,t.type);return X(s,{},{method:"POST"})},Fn={getNotificationSettings:LC,postNotificationSettings:MC,getNotificationUnreadCount:UC,getNotificationByType:FC,postMarkAsRead:BC,postMarkAsReadAll:HC,postMarkAsReadByType:GC};function vr(){return ks({queryKey:vt.notification.getUnreadCount(),queryFn:async()=>{const t=await Fn.getNotificationUnreadCount();if(t.status===fe.OK&&t.data){const s=t.data.unread_count.reduce((r,o)=>r+ +o.total_unread,0),n={};t.data.unread_count.forEach(r=>{n[r.event_type]={count:r.total_notification,isSeen:+r.total_unread==0,last_created_at:r.last_created_at}});const a=t.data.first_notification;return{count:s,data:t.data.unread_count,nomalizeData:n,first_notification:a}}return{count:0,data:null,nomalizeData:{},first_notification:null}}})}const pa=ae({key:"visibleNotificationDrawerState",default:!1}),WC=ae({key:"showQuickStartOnboardingState",default:{openPopover:!1,hiddenWidget:!1}}),oh=ae({key:"defaultNotiOpenState",default:""}),lh=ae({key:"visibleNotificationSettingDrawerState",default:!1}),VC=()=>{const t=he(pa),{data:s}=vr(),n=ke(ur),{shake:a}=Fa(),r=s?.count||0,o=async()=>
944{if(n.isChanged){a();return}t(!0),s&&s?.count>0&&await Fn.postMarkAsReadAll({disable_count:!0})};return e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(re,{icon:xl,variant:"tertiary",onClick:o}),r>0?e.jsx("span",{className:"size-2 rounded-full bg-zopi-primary absolute top-0 right-0"}):null]})})},YC={singular:"history",plural:"histories"},zC={},KC=i.memo(t=>{const{t:s}=J(),{loading:n,histories:a,onChangePage:r}=t,[o,l]=i.useState(1),{isMobile:c}=xe(),u=v=>{l(v),r(v)},d=v=>{const y=Da(v).format("ll");return!y||y==="Invalid Date"?e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:"N/A"}):e.jsx(m,{variant:"bodyMd",as:"span",children:y})},g=v=>v?e.jsx(m,{variant:"bodyMd",as:"span",children:v}):e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:"N/A"}),h=v=>{let y=at.upperFirst(at.lowerCase(v)),C;switch(v){case"PENDING":break;case"COMPLETED":C="success";break;case"CANCELLED":C="attention";break;case"FAILED":C="critical";break;default:y="N/A";break}return v?e.jsx(wt,{tone:C,children:s(y)}):e.jsx(wt,{children:"N/A"})},p=(v,y)=>{if(!v)return e.jsx(m,{tone:"subdued",variant:"bodyMd",as:"span",children:"N/A"});const C=zC[y?.usage_charge?.feature_id];return v==="USAGE_CHARGE"&&y?.usage_charge&&C?e.jsx(m,{variant:"bodyMd",as:"p",children:C?.content.replace(C.field,y.usage_charge.quantity)}):e.jsx(m,{variant:"bodyMd",as:"p",children:v==="USAGE_CHARGE"?y.message?y.message:"Ready2Sale":s(v.split("_").map(S=>q.upperFirst(S.toLocaleLowerCase())).join(""))})},x=v=>typeof v!="number"&&!v?e.jsx(m,{variant:"bodyMd",as:"span",children:"N/A"}):e.jsxs(m,{variant:"bodyMd",as:"span",children:["$",Fe(Vt(v))]}),f=a.data.map(({id:v,updated_at:y,status:C,action:S,amount:j,details:A},E)=>e.jsx(Nt.Row,{id:v+"",position:E,children:c?e.jsx(Q,{paddingBlock:"400",children:e.jsxs(D,{gap:"200",children:[e.jsxs(U,{align:"space-between",children:[e.jsx(m,{variant:"bodySm",as:"span",tone:"subdued",children:d(y)}),e.jsx(m,{variant:"headingSm",fontWeight:"semibold",as:"span",children:x(A?.to_package?.discount?j-(A?.to_package?.discount?.amount||0):j)})]}),e.jsxs(m,{as:"span",children:[" ",g(v)]}),e.jsxs(m,{as:"span",children:[" ",p(S,A)]}),e.jsxs(Q,{as:"span",children:[" ",h(C)]})]})}):e.jsxs(e.Fragment,{children:[e.jsx(Nt.Cell,{children:d(y)}),e.jsx(Nt.Cell,{children:g(v)}),e.jsx(Nt.Cell,{children:e.jsx("div",{className:"py-2",children:h(C)})}),e.jsx(Nt.Cell,{children:p(S,A)}),e.jsx(Nt.Cell,{children:x(A?.to_package?.discount?j-(A?.to_package?.discount?.amount||0):j)})]})},v)),_=at.map([...Array(10).keys()],(v,y)=>e.jsx(Rt.Row,{id:v+"",position:y,children:c?e.jsxs(Q,{paddingBlock:"400",children:[e.jsx(D,{gap:"400",children:e.jsx(ys,{lines:4})})," "]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})}),e.jsx(Rt.Cell,{children:e.jsx(ys,{lines:1})})]})},v)),b=()=>e.jsx(Nt,{condensed:c,loading:n,resourceName:YC,itemCount:n?10:a?.total,selectable:!1,headings:[{title:s("UpdateAt")},{title:s("TransactionID")},{title:s("PaymentStatus")},{title:s("Description")},{title:s("Price")}],pagination:{hasPrevious:o>1,onPrevious:()=>{u(o-1)},hasNext:o*10<a.total,onNext:()=>{u(o+1)}},children:n?_:f});return e.jsx(D,{gap:"300",children:c?b():e.jsxs(e.Fragment,{children:[e.jsx(U,{blockAlign:"center",align:"space-between",children:e.jsx(m,{variant:"headingSm",as:"h6",children:s("PastBills")})}),e.jsx(Q,{padding:"0",background:"bg-surface",borderRadius:"200",borderColor:"border",borderWidth:"025",overflowX:"hidden",overflowY:"hidden",children:b()})]})})}),ld="CONFIRM",QC=({open:t,loading:s,onClose:n,onConfirm:a})=>{const{t:r}=J(),[o,l]=i.useState(""),c=o===ld,u=()=>{l(""),n()},d=()=>{c&&(l(""),a())};return e.jsx(Xe,{title:r("YoureAboutToCancelYourSubscription"),open:t,onClose:u,primaryAction:{content:r("ConfirmCancellation"),onAction:d,disabled:!c||s,loading:s},secondaryActions:[{content:r("Cancel"),onAction:u,disabled:s}],children:e.jsx(Q,{padding:"400",children:e.jsxs(D,{gap:"400",children:[e.jsxs(m,{as:"p",children:[r("YourPlan")," ",e.jsx(m,{as:"span",fontWeight:"semibold",children:r("WillDowngradeToFree")})," ",r("AtTheEndOfTheBillingCycleAndYourFeaturesAndUsageWillBeLimited")]}),e.jsx(ar,{label:e.jsxs("span",{children:[r("ToContinueEnterCONFIRMToAcceptThe")," ",e.jsx(aa,{url:Ea.PAYMENT_PLAN_POLICY,target:"_blank",children:r("PaymentPolicy")})]}),value:o,onChange:l,placeholder:ld,autoComplete:"off"})]})})})},ch=[{key:"current-subscription",label:"CurrentSubscription",icon:_p,icon_active:Ag},{key:"pricing-plans",label:"PricingPlans",icon:jg,icon_active:Sg}],dn=[{key:"AO",label:"DropshipOperation",labelShort:"Dropshipping",icon:vg,urls:[Y.HOME_PAGE.PATH]},{key:"PH",label:"ProductResearch",labelShort:"Research",icon:_l,urls:[Y.PRODUCT_RESEARCH.PATH,Y.PRODUCT_RESEARCH.SUBROUTES.AD_LIBRARY.PATH,Y.PRODUCT_RESEARCH.SUBROUTES.TREND_DISCOVERY.PATH,Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.PATH,Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.SUBROUTES.TRACKED_SELLER.PATH]}];let Gr="";const qC=()=>{const t=ws(),{getCurrentPlan:s,fetchCurrentPlan:n,getPricingPlan:a,getToken:r}=de(),{t:o}=J(),l=dt().getListShop(),{findPlanByKey:c}=zt(),u=pt(),{token:d}=vs(),[g,h]=ca(),p=g.get("tab"),x=g.get("is_choose_plan")==="true",[f,_]=i.useState(p&&["current-subscription","pricing-plans"].includes(p)?p:"current-subscription"),b=bt(),v=la(vi),y=i.useRef(!1);let C;Ce.isShopifyEmbedded()&&(C=Wn());const[S,j]=i.useState(1),[A,E]=be(Rn),[T,k]=i.useState(!1),[O,R]=i.useState(!1),[P,w]=i.useState(!1),[N,K]=i.useState(!1),[L,W]=i.useState(),[H,Z]=i.useState(!1),[te,ne]=i.useState(""),[le,B]=i.useState(""),[ie,V]=i.useState(""),[M,I]=i.useState(!1),[F,G]=i.useState(!1),[z,me]=i.useState(!1),[Re,Be]=i.useState({}),[De,ot]=i.useState(!1),[ve,pe]=i.useState(!1),[ze,Ge]=i.useState(!1),[lt,ue]=i.useState(!1),ce=s(A),Ae=a(),{data:_e,
944isLoading:Pe,refetch:Ne}=j0({app:A,page:S,page_size:10}),rt=i.useRef(null),ye=i.useRef(null),Ie=o(Y.BILLING_PLAN.TITLE),{package:Ue,status:ht,next_package:Dt,provider_payment:Ft,store_id:as,is_trial:fs}=s(A),Jt=ce?.trial_end_on||void 0,Le=it(Jt).add(1,"day").diff(it(),"days"),Ye=Pt(),qe={...Ue},At=Ee=>{Ke.trackingEventUsersAction({event_name:Ee,event_data:{}}),setTimeout(()=>{Ye.showChat()},800)},yt=i.useCallback(Ee=>{_(Ee);const ct=new URLSearchParams(g);ct.set("tab",Ee),h(ct,{replace:!0})},[g,h]),{name:Bt,price:Tt}=qe||{},et=async()=>{await Ta.putResetOutOfCredit({},d)};i.useEffect(()=>(x&&(yt("pricing-plans"),g.delete("is_choose_plan"),h(g,{replace:!0})),Ye.pushEventUserVisitHere("visit_billing_plan"),()=>{t.removeQueries({queryKey:["pricing-history-charge",S,10,A],exact:!0})}),[]),i.useEffect(()=>{Ft==="SHOPIFY"&&it(Jt).isAfter(it())?k(!!fs):k(!1)},[fs,Jt,Ft]),i.useEffect(()=>{const Ee=tp(),ct=r();if(Ee.status==="success"&&Ee.charge_success&&Ee.package){ot(!0),et(),ta({token:ct,env:"production",isReload:!0});const Qt=Ee.old_package?.modules?.find(_s=>_s.type==="ORDER_FULFILLMENT"),Ls=Ee.package?.modules?.find(_s=>_s.type==="ORDER_FULFILLMENT");Ke.trackingEventUsersAction({event_name:$.SUBSCRIPTION_TRANSACTION_COMPLETED,event_data:{value:Ee.package.price,modules:Ee.package.modules,cycle:Ee.package.cycle}});const $t=Qt?.name==="Free",Ms=Qt?.name==="Premium",It=Ls?.price||0,xs=Qt?.price||0;$t||It<=0?Dn("new_charge_success",s(A),{plan_name:Ls?.name??"",plan_value:Ee.package?.price??0}):(It<xs&&Dn("downgrade_success",s(A),{old_plan_name:Qt?.name??"",old_plan_value:xs,new_plan_name:Ls?.name??"",new_plan_value:It}),!Ms&&It>xs&&Dn("upgrade_success",s(A),{old_plan_name:Qt?.name??"",old_plan_value:xs??0,new_plan_name:Ls?.name??"",new_plan_value:It??0}))}const St=ap();St.status==="success"&&St.feature_id&&(ot(!0),et(),ta({token:ct,env:"production",isReload:!0}))},[]),i.useEffect(()=>{const Ee=!at.size(l.find(St=>St.id===as));if(as&&Ee&&A==="AO"){B("ThePreviousPaidStoreHasBeenDisconnectedFromThisAccountReconnectItToContinueYourPlan");return}const ct=l.find(St=>St.id===as);Be(ct??{})},[as,l,A]),i.useEffect(()=>{qe?.type&&["MIGRATE_PRICING_V29","MIGRATE_V29"].includes(qe?.type)&&Z(!0)},[qe?.type]),i.useEffect(()=>{if(ht==="CANCELLED"){W("SubscriptionDowngradedToFREEYouLlBeAbleToUseTheCurrentPlanUntilTheEndOfTheCycle");return}else W(void 0);at.size(Dt)&&W("SubscriptionDowngradedYouLlBeAbleToUseTheCurrentPlanUntilTheEndOfTheCycle")},[Dt,ht]);const rs=g.get("is_reset_plan")==="true";i.useEffect(()=>{rs&&Cs.postMetaOneTimeCharge({meta_key:"AO_ACCOUNT_ONE_TIME_CHARGE_ANTI_CLOSE_STORE"})},[rs]),i.useEffect(()=>{v()},[]);const Ns=async(Ee=1)=>{j(Ee)},Os=Ee=>{if(!Ee)return!1;C?C(Ee):window.location.href=Ee},we=async(Ee,ct)=>{try{Gr="",ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].remove(st.PAYMENT_INFO),y.current&&Dn("checkout_open",s(A),{checkout_plan:Bt,checkout_value:Tt});const St=l.find(jt=>jt.id===ct);if(St?.uninstalled_plan){ue(!0);return}if(!St){ps("TheStoreNoLongerExists");return}R(!0);let Qt=[];for(const jt in Ae)Qt=Qt.concat(Ae[jt]);let Ls=!1;const $t={name:"",price:0};Ee?.keys?.length&&(Ls=!!Ee.isYearly);const Ms={store_id:ct,provider_payment:ce?.provider_payment||"SHOPIFY",is_yearly:Ls};q.size(Ee?.keys)&&(delete Ms.module_ids,Ms.package_id=Ue?.id+""),Ms.app=A;const{status:It,data:xs,message:_s}=await ls.chargeSubscription({params:Ms});if(It===fe.OK)if(Kt({direction_of_change:$t.price>(Ue?.price??0)?"Upgrade":"Downgrade",old_plan_name:Ue?.name??"",old_plan_value:Ue?.price??0,new_plan_name:$t.name,new_plan_value:$t.price}),xs?.confirmation_url){K(!0);const jt={name:$t.name,price:$t.price.toFixed(2),old_name:Ue?.name??"",old_price:at.size(Ee)?Ee?.price:Ue?.price??0,start_time:it()};ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify(jt)),xs?.apply_on_next_billing_cycle?(rt.current=xs?.confirmation_url?xs?.confirmation_url:null,R(!1)):(Os(xs.confirmation_url),Wt())}else R(!1),ne(""),rt.current=null,n();else{if(K(!1),R(!1),It===fe.BAD_REQUEST&&_s==="be_payment_cannot_change_your_subscription"&&q.size(xs)){Gr=xs?.message_params||"",ps("be_payment_cannot_change_your_subscription");return}if(It===fe.BAD_REQUEST&&_s==="be_payment_downgrade_failed"){ps("PaymentFailedDowngradeFailed");return}if(_s){ps(_s);return}if(g.get("package_id")){ps("InvalidCustomPackage");return}ps("PaymentFail")}}finally{}},We=async()=>{w(!0);const{status:Ee,message:ct,data:St}=await ls.cancelCurrentPlan({app:A});if(w(!1),Ee===fe.FIRST_CYCLE_DOWNGRADE_FAILED&&ct==="FIRST_CYCLE_DOWNGRADE_FAILED"&&Ge(!0),Ee===fe.OK){if(fs){const Qt=r();ta({token:Qt,env:"production",isReload:!0})}ne(""),B(""),b.success(o("CancelSuccessfully")),n(),Ne(),u(Y.BILLING_PLAN.PATH);return}else{const Qt=St?.error_code||"";Qt&&(V(Qt),I(!0))}},mt=()=>{ot(!1),ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].get(st.PAYMENT_INFO)&&ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].remove(st.PAYMENT_INFO),ge.localStorage.get(st.NEW_USER_ONBOARDING)&&(ge.localStorage.remove(st.NEW_USER_ONBOARDING),u(Y.HOME_PAGE.PATH))},Kt=Ee=>{Dn("subscription_changed",s(A),Ee)},Wt=i.useCallback(()=>{u(Y.BILLING_PLAN.PATH,{state:null}),ne(""),rt.current=null},[]),ps=Ee=>{Ee&&ne(Ee)},Ds=()=>{pe(!1),We()},Qs=Ee=>{let ct=Ee;at.size(Dt)&&(ct={keys:Dt?.modules?.map(Qt=>Qt.key)??[],isYearly:Dt?.cycle===365,price:Dt?.price??0}),we(ct,Re.id)},Pr=async()=>
944{if(!ce.package?.modules?.[0]?.key)return;const Ee=c(ce.package?.modules?.[0]?.key,A);Ee&&ye.current?.onConfirmCharge({data:Ee,isYearly:ce.package?.cycle===365,isTrial:!1,isRechargePlan:!0})},Ir=()=>{if(te){const Ee=o(te,{feature:Gr?o(Gr):""});return e.jsx("div",{className:"pb-4",children:e.jsx(kt,{title:o("PaymentError"),tone:"critical",children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"regular",children:[o("CannotChangeYearlyPlanToMonthly"),o("TheCurrentPackageIsNotSupportedPleaseChooseAnotherPackage")].includes(Ee)?e.jsxs(e.Fragment,{children:[Ee,". ",e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"regular",children:e.jsx("span",{onClick:ct=>{ct.stopPropagation(),Ye.openChat()},className:"msui-cs-pointer",style:{textDecoration:"underline"},children:o("ContactUs")})})]}):Ee})})})}if(le){const Ee=l.some(ct=>ct.platform==="shopify");return e.jsx("div",{className:"pb-4",children:e.jsx(kt,{tone:"warning",title:"",...as&&!at.size(l.find(ct=>ct.id===as))?{action:{content:o(Ee?"ChangeStore":"ConnectStore"),onAction:()=>{ye.current?.onChangeStorePayment()}}}:{},children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"regular",children:o(le)})})})}return qe?.type&&["MIGRATE_PRICING_V29","MIGRATE_V29"].includes(qe?.type)?e.jsx(Qe,{id:"SubscriptionDowngraded",open:H,transition:{duration:"500ms",timingFunction:"ease-in-out"},children:e.jsx("div",{className:"pb-4",children:e.jsx(kt,{tone:"info",title:o("YourAccountHasBeenMovedToOurNewSimplifiedPricingPlan"),onDismiss:()=>Z(!1),children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"regular",children:o("ContentMigratePricingV29",{var_learn_more:e.jsx(aa,{url:Ea.MIGRATE_PRICING_V29,target:"_blank",children:e.jsx("span",{className:"whitespace-nowrap",children:o("LearnMore")})}),var_contact_our_support_team:e.jsx(aa,{onClick:()=>Ye.openChat(),children:o("ContactOurSupportTeam")})})})})})}):""},ma=()=>e.jsxs("div",{className:"relative p-3 bg-bg-surface-secondary rounded-lg flex flex-wrap gap-1 items-center justify-between border border-border border-b-0 rounded-b-none rounded-t-2xl",children:[e.jsxs("div",{className:"flex gap-1 align-center",children:[Ce.isShopifyEmbedded()&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fr,{to:Y.HOME_PAGE.PATH,className:oe("size-7 rounded-lg duration-300 transition-colors flex items-center justify-center cursor-pointer","bg-transparent text-text-secondary"),children:e.jsx(ee,{source:Eg})}),e.jsx("hr",{className:"border-none h-3.5 w-px bg-border"})]}),!Ce.isShopifyEmbedded()&&e.jsx("div",{className:"[&>_div:not([class])]:flex flex align-middle",children:e.jsx(Gs,{active:z,activator:e.jsx(re,{variant:"tertiary",icon:dn.find(Ee=>Ee.key===A)?.icon,disclosure:"down",onClick:()=>me(Ee=>!Ee)}),onClose:()=>me(!1),sectioned:!0,preferredAlignment:"left",children:e.jsx(D,{gap:"200",children:dn.map(Ee=>e.jsx(As,{label:e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx(ee,{source:Ee.icon}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"regular",children:o(Ee.label)})]}),checked:Ee.key===A,id:Ee.key,name:"accounts",onChange:()=>{E(Ee.key)}},Ee.key))})})}),ch.map(Ee=>{const ct=f===Ee.key;return e.jsx("button",{className:oe("px-2 py-1.5 rounded-lg duration-300 transition-colors flex items-center gap-0.5 cursor-pointer",ct?"":"bg-transparent text-text-secondary"),onClick:()=>{yt(Ee.key),G(!1)},children:e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx(Q,{children:e.jsx(ee,{source:ct?Ee.icon_active:Ee.icon})}),e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:ct?"bold":"medium",children:o(Ee.label)})]})},Ee.key)})]}),e.jsx(VC,{}),e.jsx("div",{className:"absolute h-10 bottom-0 translate-y-full bg-bg-surface-secondary -left-0.25 border-l border-r border-border -right-0.25 w-[calc(100%+0.125rem)]"})]}),Ni=()=>e.jsxs("div",{className:"pb-20",children:[f==="current-subscription"&&e.jsx(nt,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(D,{gap:"400",children:[e.jsx(Qe,{id:"banner-trial-plan",open:T,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(kt,{tone:"info",onDismiss:()=>k(!1),children:e.jsx(Q,{paddingInlineEnd:"400",children:e.jsx(U,{blockAlign:"center",children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"regular",children:o("YourFreeTrailEnds",{day_remaining:Le,switch_plan_form:qe?.name||""})})})})})}),e.jsx(Qe,{id:"error-change-plan",open:M,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(kt,{title:o("CancelPlanFailed"),tone:"warning",onDismiss:()=>{I(!1),setTimeout(()=>{V("")},500)},children:o(ie)})}),Ir(),e.jsx(OC,{app:A,onChangePlan:()=>yt("pricing-plans"),renderCycleUsage:()=>e.jsx(DC,{app:A}),onCancelPlan:()=>pe(!0),onResumePlan:Qs}),e.jsx(Qe,{id:"content-data-yearly",open:ce?.package?.cycle!==365,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Q,{paddingBlock:"500",paddingInline:"400",borderRadius:"200",background:"bg-surface-success",children:e.jsxs(U,{align:"space-between",gap:"100",wrap:!1,blockAlign:"center",children:[e.jsxs(U,{align:"start",ga
944p:"100",wrap:!1,blockAlign:"center",children:[e.jsx(Q,{children:e.jsx(ee,{tone:"success",source:Je})}),e.jsxs(m,{as:"p",variant:"bodySm",fontWeight:"regular",tone:"success",alignment:"center",children:["Get"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"3 months off"}),", plus"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"5% credit rewards"})," ","and"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"+0.5% extra"})," ","on top-ups ."]})]}),e.jsx(re,{variant:"tertiary",onClick:()=>{yt("pricing-plans"),G(!0)},children:o("ChangeToYearly")})]})})}),!Pe&&!!q.size(_e?.data)&&e.jsx("div",{id:hy.BILLING_PLAN.setting_past_bills,children:e.jsx(KC,{onChangePage:Ns,loading:Pe,histories:_e||{total:0,data:[]}})})]})})}),f==="pricing-plans"&&e.jsx(nt,{children:e.jsx(yC,{activeYearly:F,app:A})}),e.jsx(py,{position:"pricing",className:"mt-4 flex justify-center"})]}),Ga=()=>{const Ee=ce.status==="CANCELLED",ct=ce.next_package,St=!Ee&&ct?.cycle?` (${ct.cycle===365?"yearly":"monthly"})`:"",Qt=`${(Ee?"Free":ct?.name||"Free")?.toUpperCase()}${St}`;return e.jsx(Qe,{id:"SubscriptionDowngraded",open:!!L,transition:{duration:"500ms",timingFunction:"ease-in-out"},children:e.jsx("div",{className:"pb-4",children:e.jsx(Q,{paddingBlock:"300",paddingInline:"400",borderRadius:"200",background:"bg-surface-warning",borderColor:"border-warning",borderWidth:"025",children:e.jsxs(U,{align:"space-between",gap:"100",wrap:!1,blockAlign:"center",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"regular",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:`${o("ContentDowngradePlanTime",{time:it(ce.next_billing_time).format("MMM, DD, YYYY"),plan_name:Qt})}`}})}),Ee?e.jsx(re,{onClick:()=>Qs({keys:ce?.package?.modules?.map(Ls=>Ls.key)||[],price:ce.package?.price||0,isYearly:Ue?.cycle===365}),variant:"tertiary",children:o("ResumePlan")}):e.jsx(re,{onClick:Pr,variant:"tertiary",children:o("CancelDowngrade")})]})})})})},kn=()=>e.jsxs(m,{as:"p",variant:"bodyMd",tone:"subdued",children:[o("ManageYourSubscriptionAndBilling")," ",e.jsx("span",{onClick:()=>At($.SUBSCRIPTION_CUSTOM_PLAN_CLICKED),className:"underline cursor-pointer",children:o("RequestCustomPlan")})]});return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:Ua[1176],children:e.jsxs(us,{className:"general-setting",title:Ie,additionalMetadata:kn(),secondaryActions:e.jsx(dy,{}),children:[Ga(),ma(),Ni()]})}),e.jsx(un,{ref:ye,onChargeError:()=>{},app:A}),e.jsx(Al,{isRedirecting:N,open:O||P}),e.jsx(tb,{title:Ie,content:Ie}),e.jsx(vl,{open:ze,onClose:()=>Ge(!1)}),e.jsx(QC,{open:ve,loading:P,onClose:()=>pe(!1),onConfirm:Ds}),e.jsx(bb,{open:De,onClose:mt}),e.jsx(wy,{open:De,onClose:mt}),e.jsx(yr,{data:{storeCharge:Re},open:lt,onConfirm:Ee=>{Ee&&we({keys:(ce?.package?.modules||[]).map(ct=>ct.key),price:ce.package?.price||0,isYearly:ce?.package?.cycle===365},Ee)},onClose:()=>ue(!1)})]})},ZC=Object.freeze(Object.defineProperty({__proto__:null,APP_BILLING_PLAN:dn,MENU_BILLING_PLAN:ch,default:qC},Symbol.toStringTag,{value:"Module"})),Tl=t=>{const{id:s,stepData:n,isOnboarding:a=!1,hiddenTitle:r=!1,isTryForFreeOb:o=!1,isShowNewUI:l=!1,isReinstall:c=!1,onTryZopiForFree:u,onPaymentSuccess:d,onUpdateCompleteOnboarding:g}=t,h=!a&&!r,{t:p}=J(),{getCurrentPlan:x,getUserInfo:f,checkPermissionFeature:_,isDemoMode:b}=de(),{freePackage:v}=Ks(),{findPlanByKey:y}=zt(),{isMobile:C}=xe(),[S,j]=be(Rn),A=la(vi),E=x(S),T=f(),k=zs(),[O,R]=be(Gt),[P,w]=i.useState(""),[N,K]=i.useState(""),[L,W]=i.useState(!1),[H,Z]=i.useState({isFullListOfFeatures:!1,isFreePlan:!1}),te=i.useRef(null),ne=i.useRef(!0),le=i.useRef(null),B=i.useRef(null),ie=i.useRef(null),V=`${st.SHOWED_OFFER_WELCOME}_${T?.id}`,M=i.useMemo(()=>`${s}-${S}-${Math.random().toString(36).substring(2,15)}`,[s,S]),I=pt(),F=_("WP_ADD_STORE"),G=i.useCallback(ve=>{const{keyPlan:pe,isYearly:ze=!1,isTrial:Ge=!1,isRechargePlan:lt=!1,discountCode:ue}=ve;if(b()){B.current?.open();return}requestAnimationFrame(async()=>{const ce=ge.localStorage.get(V)||T?.remaining_meta_keys?.[Ut.SHOWED_OFFER_WELCOME];if(a&&(pe==="FREE_CREDIT"||pe.includes("FREE"))&&!ce){ie.current?.open();return}if(a&&(pe==="FREE_CREDIT"||pe==="FREE_CREDIT_TIER_PH"||pe.includes("FREE"))){$y({app_plan:pe==="FREE_CREDIT_TIER_PH"?"FREE_PLAN_PH":"FREE",package_name:"none",price:null}),u&&u();return}const Ae=y(pe,S);Ae&&(w(Ae.key),await te.current?.onConfirmCharge({data:Ae,isYearly:ze,isTrial:Ge,isRechargePlan:lt,couponCode:ue}),setTimeout(()=>{w("")},1e3))})},[O,y,k,a,F,S]),z=ve=>{Z(pe=>({...pe,[ve]:!pe[ve]}))};i.useEffect(()=>{const ve=["FREE_ORDER_FULFILLMENT_2","DEMO_MODE_ZOPI"].includes(at.head(E?.package?.modules)?.key||"");E?.package?.cycle===365||ve?R("yearly"):R("monthly")},[E,S]),i.useEffect(()=>{E&&T?.first_cycle_charge_type==="CHARGE_ONE_TIME_FIRST_MONTH"&&O==="monthly"&&ne.current&&(R(E?.package?.cycle===365?"yearly":"monthly"),ne.current=!1)},[E,T,O]),i.useEffect(()=>(a?sh():Ke.trackingEventUsersAction({event_name:$.SUBSCRIPTION_CHANGE_PLAN_VIEWED}),()=>{A()}),[]);const me=p(Y.BILLING_PLAN.TITLE),Re=a&&S==="AO"?Ce.isShopifyEmbedded():!0,Be=()=>e.jsxs("div",{className:"relative",children:[e.jsx(Qe,{id:"error-change-plan",open:L,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx("div",{className:oe("pt-3 pb-3",l&&"mt-[62px]"),children:e.jsx(kt,{title:p("ChangePlanFailed"),tone:"warning",onDismiss:()=>{W(!1),setTimeout(()=>{K("")},500)},children:p(N)})})}),e.jsx("div",{className:C?"-mt-4":"pt-0",children:e.jsx(nt,{padding:"600",children:e.jsxs(D,{gap:"400",children:[n?e.jsx(e.Fragment,{children:l?e.jsx("div",{className:"mb-5",children:n}):e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsx(m,{as:"h2",variant:"headingLg",fontWeight:"bold",children:p("PickAPlanThatSuitsYou")}),e.jsx("div",{className:"[&_.Polaris-Button]:flex-row-reverse [&_.Polaris-Button]:pr-2! [&_.Polaris-Button]:pl-2.5!",children:e.jsx(re,{variant:"tertiary",onClick:u,icon:Ja,children:p("StartForFree")})})]})}):e.jsx(U,{align:"center",children:e.jsx(m,{as:"span",variant:"headingLg",children:p("PickAPlanThatSuitsYou")})}),!Ce.isShopifyEmbedded()&&!(T?.plan_reinstalled||T?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE")&&e.jsx(Q,{background:"bg",paddingInline:"400",padding:"300",borderRadius:"300",children:e.jsxs("div",{className:"flex items-center gap-[56px]",children:[e.jsx(m,{as:"span",variant:"headingMd",children:p("PricingFor")}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("label",{htmlFor:"",children:e.jsx(As,{onChange:()=>{j("PH")}
944,checked:S==="PH",name:"app-charge"+M,label:p("ProductResearch")})}),e.jsx("label",{htmlFor:"",children:e.jsx(As,{onChange:()=>{j("AO")},checked:S==="AO",name:"app-charge"+M,label:p("DropshipOperation")})})]})]})}),e.jsx(U,{align:"center",children:e.jsx(En,{disabled:E.provider_payment==="PADDLE_BILLING"&&E?.package?.cycle===365})}),e.jsx(Qe,{id:"promotion-code",open:O==="monthly"&&S==="AO",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(pi,{})}),S==="AO"?e.jsx(ii,{isAtOnboarding:a,loadingCharge:P,onChoosePlan:G}):e.jsx(oi,{onChoosePlan:G})," ",Re&&e.jsx(U,{align:"center",children:e.jsx(re,{icon:H.isFreePlan?Pn:xi,onClick:()=>z("isFreePlan"),children:H.isFreePlan?"Hide free plan":"Not ready to commit? Start with our Free plan"})}),e.jsx(Qe,{id:"content-compare-all-plans",open:H.isFreePlan,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsxs(ft,{columns:3,children:[e.jsx(Q,{}),S==="AO"?e.jsx(To,{p:v,isAtOnboarding:a,hasReinstall:!1,onChoosePlan:G,loadingCharge:P.includes(v.key),isRecommended:!1}):e.jsx(wo,{data:Js[0],onChoosePlan:G,isAtOnboarding:a}),e.jsx(Q,{})]})}),e.jsx(U,{align:"center",children:e.jsx(re,{variant:"tertiary",onClick:()=>z("isFullListOfFeatures"),disclosure:H.isFullListOfFeatures?"up":"down",children:H.isFullListOfFeatures?"Hide feature list":"View full list of features"})}),e.jsx(Qe,{id:"content-compare-all-plans",open:H.isFullListOfFeatures,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:S==="AO"?e.jsx(Ro,{isAtOnboarding:a,onChoosePlan:G,isTryForFreeOb:o,loadingCharge:P}):e.jsx(No,{onChoosePlan:G,isAtOnboarding:a})}),e.jsx(Qe,{id:"enterprise-plan",open:S==="AO",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Po,{onChoosePlan:G})})]})})})]}),De=()=>h?e.jsx(us,{fullWidth:!0,backAction:{content:p("Back"),onAction:()=>{requestAnimationFrame(()=>{I(Y.BILLING_PLAN.PATH)})}},title:me,children:Be()}):Be(),ot=()=>a?C?e.jsxs(Q,{position:"relative",padding:"0",children:[e.jsx(Qe,{id:"error-change-plan",open:L,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx("div",{className:oe("pt-3 pb-3"),children:e.jsx(kt,{title:p("ChangePlanFailed"),tone:"warning",onDismiss:()=>{W(!1),setTimeout(()=>{K("")},500)},children:p(N)})})}),e.jsx(Q,{padding:"400",paddingBlockEnd:"0",children:e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"h2",variant:"headingLg",fontWeight:"bold",alignment:"center",children:"Welcome to Zopi! Letâs pick a plan to start"}),e.jsx(m,{as:"p",fontWeight:"regular",tone:"subdued",alignment:"center",children:"Letâs pick a plan based on your need to start"})]})}),!Ce.isShopifyEmbedded()&&!c&&e.jsx(Q,{padding:"400",paddingBlockEnd:"0",children:e.jsx("div",{className:"flex items-center justify-between border-b border-[color:var(--p-color-border,#e3e3e3)]",children:e.jsx("div",{className:"flex gap-4",children:[...dn].map(ve=>e.jsxs("button",{onClick:()=>j(ve.key),className:"flex gap-2 items-center px-2 py-2 cursor-pointer bg-transparent outline-none border-0 -mb-px",style:{borderBottom:`2px solid ${S===ve.key?"#1a1a1a":"transparent"}`},children:[e.jsx(ee,{source:ve.icon}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:S===ve.key?"semibold":"medium",children:p(ve.label)})]},ve.key))})})}),e.jsx(Q,{padding:"400",children:S==="AO"?e.jsx(ii,{isAtOnboarding:a,loadingCharge:P,onChoosePlan:G}):e.jsx(oi,{isAtOnboarding:a,onChoosePlan:G})})]}):e.jsxs(Q,{position:"relative",padding:"400",children:[e.jsx(Qe,{id:"error-change-plan",open:L,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx("div",{className:oe("pt-3 pb-3"),children:e.jsx(kt,{title:p("ChangePlanFailed"),tone:"warning",onDismiss:()=>{W(!1),setTimeout(()=>{K("")},500)},children:p(N)})})}),e.jsx(Q,{padding:"400",paddingBlockEnd:"0",children:e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"h2",variant:"headingLg",fontWeight:"bold",alignment:"center",children:"Welcome to Zopi! Letâs pick a plan to start"}),e.jsx(m,{as:"p",fontWeight:"regular",tone:"subdued",alignment:"center",children:"Letâs pick a plan based on your need to start"})]})}),e.jsx(Q,{padding:"400",paddingBlockEnd:"0",children:Ce.isShopifyEmbedded()||c?e.jsx(U,{align:"center",children:e.jsx(En,{disabled:E.provider_payment==="PADDLE_BILLING"&&E?.package?.cycle===365})}):e.jsxs("div",{className:"flex items-center justify-between border-b border-[color:var(--p-color-border,#e3e3e3)]",children:[e.jsx("div",{className:"flex gap-4",children:[...dn].map(ve=>e.jsxs("button",{onClick:()=>j(ve.key),className:"flex gap-2 items-center px-2 py-2 cursor-pointer bg-transparent outline-none border-0 -mb-px",style:{borderBottom:`2px solid ${S===ve.key?"#1a1a1a":"transparent"}`},children:[e.jsx(ee,{source:ve.icon}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:S===ve.key?"semibold":"medium",children:p(ve.label)})]},ve.key))}),e.jsx(En,{disabled:E.provider_payment==="PADDLE_BILLING"&&E?.package?.cycle===365})]})}),e.jsx(Qe,{id:"content-data-yearly",open:O==="yearly",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Q,{padding:"400",paddingBlockEnd:"0",children:e.jsx(Q,{paddingBlock:"500",paddingInline:"400",borderRadius:"200",background:"bg-surface-success",children:e.jsxs(U,{align:"start",ga
944p:"100",wrap:!1,blockAlign:"center",children:[e.jsx(Q,{children:e.jsx(ee,{tone:"success",source:Je})}),e.jsxs(m,{as:"p",variant:"bodySm",fontWeight:"regular",tone:"success",alignment:"center",children:["Get"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"3 months off"}),", plus"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"5% credit rewards"})," ","and"," ",e.jsx(m,{fontWeight:"semibold",as:"span",children:"+0.5% extra"})," ","on top-ups ."]})]})})})}),e.jsx(Qe,{id:"promotion-code",open:O==="monthly"&&S==="AO",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Q,{padding:"400",paddingBlockEnd:"0",children:e.jsx(pi,{})})}),e.jsx(Q,{padding:"400",children:S==="AO"?e.jsxs(e.Fragment,{children:[e.jsx(ii,{isAtOnboarding:a,loadingCharge:P,onChoosePlan:G}),e.jsx(Pi,{onChooseFreePlan:()=>{u&&u()},onApplied:()=>{setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},500)},isOnboarding:a,ref:ie})]}):e.jsx(oi,{isAtOnboarding:a,onChoosePlan:G})}),Re&&e.jsx(Q,{padding:"400",paddingBlockStart:"200",children:e.jsx(U,{align:"center",children:e.jsx(re,{icon:H.isFreePlan?Pn:xi,onClick:()=>z("isFreePlan"),children:H.isFreePlan?"Hide free plan":"Not ready to commit? Start with our Free plan"})})}),e.jsx(Qe,{id:"content-compare-all-plans",open:H.isFreePlan,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Q,{paddingBlockEnd:"400",paddingBlockStart:"200",children:e.jsxs(ft,{columns:3,children:[e.jsx(Q,{}),S==="AO"?e.jsx(To,{p:v,isAtOnboarding:a,hasReinstall:!1,onChoosePlan:G,loadingCharge:P.includes(v.key),isRecommended:!1}):e.jsx(wo,{data:Js[0],onChoosePlan:G,isAtOnboarding:a}),e.jsx(Q,{})]})})}),e.jsx(U,{align:"center",children:e.jsx(re,{variant:"tertiary",onClick:()=>z("isFullListOfFeatures"),disclosure:H.isFullListOfFeatures?"up":"down",children:H.isFullListOfFeatures?"Hide feature list":"View full list of features"})}),e.jsx(Qe,{id:"content-compare-all-plans",open:H.isFullListOfFeatures,transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:S==="AO"?e.jsx(Ro,{isAtOnboarding:a,onChoosePlan:G,isTryForFreeOb:o,loadingCharge:P}):e.jsx(No,{onChoosePlan:G,isAtOnboarding:a})}),e.jsx(Qe,{id:"enterprise-plan",open:S==="AO",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Q,{padding:"400",children:e.jsx(Po,{onChoosePlan:G})})})]}):e.jsx("div",{className:"[&_.Polaris-Page]:px-0!",ref:le,style:Ua[1176],children:e.jsx(XC,{className:Em(C&&"with-mobile"),style:{marginBottom:0,marginTop:C&&a?20:0},children:De()})});return e.jsxs(e.Fragment,{children:[ot(),e.jsx(un,{onPaymentSuccess:()=>{d&&d()},onUpdateCompleteOnboarding:g,ref:te,onChargeError:ve=>{K(ve),W(!0),le.current?.closest(".drawer-body")?.scrollTo({top:0,behavior:"smooth"})},app:S})]})},XC=se.div` 945 &.with-mobile { 946 .Polaris-Page-Header__Row { 947 gap: var(--p-space-200) var(--p-space-0); 948 grid-template-areas: 949 'breadcrumbs title' 950 'actions actions'; 951 } 952 } 953`;se.div` 954 // border: 2px solid #5737e6; 955 // background: linear-gradient(125deg, #f2f1ff 8.84%, #fff 94.32%, #f6e6ff 109.61%); 956 border-radius: 8px; 957 color: #fff; 958`;var cd;function Oo(){return Oo=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Oo.apply(null,arguments)}const bw=t=>i.createElement("svg",Oo({xmlns:"http://www.w3.org/2000/svg",width:107,height:36,fill:"none"},t),cd||(cd=i.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M104.093 26.214V9.006h2.463c.243 0 .444.2.444.444v17.208h-2.463a.447.447 0 0 1-.444-.444M61.105 11.279c1.903-1.734 4.408-2.654 6.977-2.654s5.073.91 6.976 2.653c1.86 1.692 2.96 4.017 2.96 6.554s-1.11 4.851-2.96 6.553c-1.903 1.734-4.408 2.653-6.976 2.653-2.569 0-5.074-.909-6.976-2.653-1.86-1.691-2.96-4.016-2.96-6.553s1.11-4.852 2.96-6.554M43.686 23.75h12.62v2.463c0 .243-.2.444-.443.444H40.188c-.38 0-.75-.148-1.026-.423-.57-.57-.57-1.48 0-2.05l12.272-12.272h-12.62V9.45c0-.243.2-.444.444-.444h15.675c.803 0 1.448.645 1.448 1.448 0 .391-.159.761-.434 1.036zm41.318-4.471v7.378h-2.463a.447.447 0 0 1-.444-.444v-15.76c0-.803.645-1.448 1.448-1.448h11.448c1.363 0 2.663.54 3.625 1.511a5.13 5.13 0 0 1 1.512 3.626c0 1.364-.54 2.664-1.512 3.625a5.15 5.15 0 0 1-3.625 1.512h-10zm-16.922-7.748c-1.84 0-3.657.645-5.032 1.892-1.247 1.142-2.008 2.706-2.008 4.408s.761 3.266 2.008 4.407c1.374 1.248 3.182 1.892 5.032 1.892s3.657-.644 5.03-1.892c1.248-1.141 2.01-2.705 2.01-4.407s-.762-3.266-2.01-4.408c-1.373-1.247-3.18-1.892-5.03-1.892m16.922.38v4.472h10a2.24 2.24 0 0 0 2.23-2.23c0-.592-.244-1.163-.656-1.575a2.22 2.22 0 0 0-1.575-.656h-9.999zM19.914 0h2.526l6.67 11.553
958-6.67 11.553h-2.526l6.67-11.553zM9.196 35.663H6.67L0 24.11l6.67-11.553h2.526L2.526 24.11zm9.66 0H16.33L9.66 24.11l7.252-12.557L10.242 0h2.526l6.67 11.553-7.25 12.557z",clipRule:"evenodd"}))),dd="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='107'%20height='36'%20viewBox='0%200%20107%2036'%20fill='none'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M104.093%2026.2138V9.006H106.556C106.799%209.006%20107%209.20683%20107%209.44994V26.6577H104.537C104.294%2026.6577%20104.093%2026.4569%20104.093%2026.2138ZM61.1055%2011.2785C63.0081%209.54507%2065.5132%208.62549%2068.0816%208.62549C70.6501%208.62549%2073.1552%209.5345%2075.0578%2011.2785C76.9181%2012.9697%2078.0173%2015.2951%2078.0173%2017.8319C78.0173%2020.3686%2076.9075%2022.6834%2075.0578%2024.3852C73.1552%2026.1187%2070.6501%2027.0382%2068.0816%2027.0382C65.5132%2027.0382%2063.0081%2026.1292%2061.1055%2024.3852C59.2452%2022.694%2058.146%2020.3686%2058.146%2017.8319C58.146%2015.2951%2059.2558%2012.9803%2061.1055%2011.2785ZM43.6864%2023.751H56.3068V26.2138C56.3068%2026.4569%2056.106%2026.6577%2055.8629%2026.6577H40.1877C39.8072%2026.6577%2039.4373%2026.5097%2039.1625%2026.2349C38.5917%2025.6641%2038.5917%2024.7551%2039.1625%2024.1844L51.4341%2011.9127H38.8136V9.44994C38.8136%209.20683%2039.0145%209.006%2039.2576%209.006H54.9327C55.736%209.006%2056.3808%209.65077%2056.3808%2010.4541C56.3808%2010.8452%2056.2222%2011.2151%2055.9474%2011.4899L43.6864%2023.751ZM85.004%2019.2799V26.6577H82.5413C82.2982%2026.6577%2082.0973%2026.4569%2082.0973%2026.2138V10.4541C82.0973%209.65077%2082.7421%209.006%2083.5454%209.006H94.9926C96.3561%209.006%2097.6562%209.54507%2098.6181%2010.5175C99.5799%2011.4794%20100.13%2012.7795%20100.13%2014.143C100.13%2015.5065%2099.5905%2016.8066%2098.6181%2017.7684C97.6456%2018.7303%2096.3561%2019.2799%2094.9926%2019.2799H84.9935H85.004ZM68.0816%2011.5322C66.2425%2011.5322%2064.4245%2012.177%2063.0504%2013.4242C61.8032%2014.5658%2061.0421%2016.1301%2061.0421%2017.8319C61.0421%2019.5336%2061.8032%2021.098%2063.0504%2022.2395C64.4245%2023.4867%2066.2319%2024.1315%2068.0816%2024.1315C69.9314%2024.1315%2071.7388%2023.4867%2073.1129%2022.2395C74.3602%2021.098%2075.1212%2019.5336%2075.1212%2017.8319C75.1212%2016.1301%2074.3602%2014.5658%2073.1129%2013.4242C71.7388%2012.177%2069.9314%2011.5322%2068.0816%2011.5322ZM85.004%2011.9127V16.3838H95.0031C95.5951%2016.3838%2096.1659%2016.1407%2096.5781%2015.7285C97.0009%2015.3057%2097.2334%2014.7455%2097.2334%2014.1535C97.2334%2013.5616%2096.9903%2012.9909%2096.5781%2012.5786C96.1553%2012.1558%2095.5951%2011.9233%2095.0031%2011.9233H85.004V11.9127Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M19.9137%200H22.4399L29.1095%2011.5529L22.4399%2023.1058H19.9137L26.5833%2011.5529L19.9137%200ZM9.1958%2035.6628H6.66959L0%2024.1099L6.66959%2012.557H9.1958L2.5262%2024.1099L9.1958%2035.6628ZM18.8567%2035.6628H16.3305L9.66087%2024.1099L16.9118%2011.5529L10.2422%200H12.7684L19.438%2011.5529L12.1871%2024.1099L18.8567%2035.6628Z'%20fill='white'/%3e%3c/svg%3e",JC=()=>({topBarSource:dd,contextualSaveBarSource:dd,url:Y.HOME_PAGE.PATH,accessibilityLabel:Ts.app_name}),$C=t=>{const{isViewAccount:s=!1}=t;bt();const{t:n}=J(),[a,r]=be(Ai),o=he(rl),[l,c]=i.useState(!1),u=i.useCallback(()=>c(x=>!x),[]),{isMobile:d}=xe(),g=async x=>{const{status:f}=await Tn.setLanguageAccount(x);Xt.OK},h=()=>e.jsx(Gs,{active:l,activator:e.jsx("div",{style:{minWidth:100,maxWidth:300,width:"100%"},className:`msui-cs-pointer button-class ${s?"":"language-top-bar"}`,children:e.jsx(re,{size:s?"large":void 0,textAlign:"left",fullWidth:!0,disclosure:s?"select":"down",onClick:u,icon:e.jsx("div",{style:{height:13},children:!d&&e.jsx(ee,{source:ni.find(x=>x.language===a)?.icon})}),children:ni.find(x=>x.language===a)?.name})}),onClose:u,children:e.jsx("div",{style:{width:"200px"},children:e.jsx(rp,{actionRole:"menuitem",items:ni.map(x=>({content:x.name,prefix:d?e.jsx("div",{style:{height:13,width:20},children:e.jsx(x.icon,{})}):e.jsx("div",{style:{height:13},children:e.jsx(ee,{source:x.icon})}),active:x.language===a,onAction:()=>
958{p(x),u()}}))})})}),p=async x=>{ge.localStorage.set(st.LANGUAGE,x.language),r(x.language),await il(x.language),g(x.language);const f=ol();o(f)};return s?e.jsx(nt,{children:e.jsxs("div",{className:"infinity-scrolling",children:[e.jsxs(D,{children:[e.jsx(m,{fontWeight:"semibold",as:"span",variant:"headingMd",tone:void 0,children:n("PreferredLanguage")}),e.jsx(m,{as:"span",tone:"subdued",children:n("WhenYouAreLoggedInToZopiThisIsTheLanguageYouWillSee")})]}),e.jsx(D,{gap:"300",children:e.jsx(Q,{maxWidth:"250px",children:h()})})]})}):h()};se.div``;const ev=t=>{const{percent:s}=t;return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"w-full",style:{maxWidth:330},children:[e.jsx(m,{as:"span",variant:"bodyXs",children:e.jsxs("div",{className:"flex justify-between mb-2 mt-2 relative",children:[e.jsx("div",{className:"w-full",children:"0%"}),e.jsx("div",{className:"w-full text-center border-l-1 border-gray-200"}),e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:"50%"}),e.jsx("div",{className:"w-full text-center border-l-1 border-gray-200"}),e.jsx("div",{className:"w-full text-right border-l-1 border-gray-200",children:"100%"})]})}),e.jsx(xo,{size:"small",progress:s<1?1:s,tone:"primary"})]})})},tv=[Y.PRODUCT_RESEARCH.SUBROUTES.AD_LIBRARY.PATH,Y.PRODUCT_RESEARCH.SUBROUTES.TREND_DISCOVERY.PATH,Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.PATH,Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.SUBROUTES.TRACKED_SELLER.PATH],sv=[Y.HOME_PAGE.PATH,Y.PRODUCT_CENTER.PATH,Y.ORDER_LIST.PATH,Y.GENERAL_SETTING.SUBROUTES.PRODUCT_LISTING.PATH],nv=()=>{const{t}=J(),s=de(),n=zs(),{isMobile:a}=xe(),{hasNewPricing:r}=zt(),[o,l]=be(Rn),c=s.getCurrentPlan(o),u=c?.package?.modules.find(w=>w.type===(o==="AO"?"CREDIT":"PH")),d=c.package?.cycle,[g,h]=i.useState(!1),p=i.useCallback(()=>h(w=>!w),[]),x=c?.total_credit_used||0,f=c?.total_credit||0,_=Math.round(x*100/f),b=c?.main_credit_used||0,v=c?.main_credit||0,y=Math.round(b*100/v),C=pt();i.useEffect(()=>{Ce.isShopifyEmbedded()||(tv.some(w=>n.pathname.includes(w))?l("PH"):sv.some(w=>n.pathname.includes(w))&&l("AO"))},[n.pathname]);const S=i.useMemo(()=>c.package?.features?.PRODUCT_LISTING||{usage:0,limit:1},[c.package]),j=i.useMemo(()=>c.package?.features?.ORDER_FULFILLMENT||{usage:0,limit:1},[c.package]),A=[{key:"ai",icon:e.jsxs("svg",{width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M9.49689 4.88867C9.55398 4.90943 9.56894 4.9311 9.57697 4.94629C9.59755 4.98528 9.60738 5.02853 9.6004 5.08887L9.00568 9.90039L8.94708 10.376H12.4598C12.5118 10.376 12.53 10.3871 12.534 10.3896C12.5378 10.3921 12.5557 10.4046 12.5779 10.4531H12.5789C12.6011 10.5015 12.5995 10.5255 12.5984 10.5332C12.5973 10.5412 12.5924 10.5651 12.5584 10.6064L7.25861 16.9541C7.22342 16.9958 7.19264 17.0118 7.16095 17.0195C7.12637 17.0274 7.09386 17.0257 7.04962 17.0059H7.04767C7.00047 16.9849 6.97476 16.9595 6.95587 16.9277C6.9488 16.9156 6.94276 16.9013 6.93927 16.8828L6.93829 16.8125L7.54962 12.5518L7.61896 12.0684H4.60431C4.55343 12.0683 4.53279 12.0576 4.52618 12.0537C4.52043 12.0502 4.50276 12.0388 4.48126 11.9971C4.45955 11.9549 4.46036 11.9347 4.46075 11.9297C4.46125 11.9239 4.46426 11.9028 4.49298 11.8633L4.49884 11.8545L9.26056 4.95605C9.29831 4.90401 9.33137 4.88587 9.36017 4.87695C9.38851 4.86821 9.42902 4.86409 9.49689 4.88867Z",stroke:"#4A4A4A",strokeWidth:"0.84618"}),e.jsx("path",{d:"M11.7388 8.56028C13.7157 8.56028 14.5773 7.72859 14.5773 5.72174C14.5773 7.72859 15.433 8.56028 17.4158 8.56028C15.433 8.56028 14.5773 9.41594 14.5773 11.3988C14.5773 9.41594 13.7157 8.56028 11.7388 8.56028Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.473089",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 13.222C2.88398 13.222 3.26927 12.8501 3.26927 11.9527C3.26927 12.8501 3.65189 13.222 4.53854 13.222C3.65189 13.222 3.26927 13.6046 3.26927 14.4913C3.26927 13.6046 2.88398 13.222 2 13.222Z",fill:"#4A4A4A",stroke:"#4A4A4A",strokeWidth:"0.346165",strokeLinejoin:"round"})]}),title:"AICredits",used:x,total:f,percent:_},{key:"product",icon:e.jsx(ee,{source:ms}),title:"Products",used:S.usage,total:S.limit,percent:S.limit===-1?3:Math.round(S.usage*100/S.limit)},{key:"orders",icon:e.jsx(ee,{source:sa}),title:"Orders",used:j.usage,total:j.limit,percent:j.limit===-1?3:Math.round(j.usage*100/j.limit)}],T=o==="AO"?A:[{key:"credits",icon:e.jsx(ee,{source:ra}),title:"ViewCredits",used:b,total:v,percent:y}];if(!gs().hasPermission([Te.VIEW_YOUR_USAGE]))return null;const O=()=>{const w=u?.key==="PRO_CREDIT_TIER";return e.jsx(Q,{padding:"200",background:"bg-fill-secondary",borderRadius:"200",shadow:"200",children:e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsxs(D,{gap:"050",children:[e.jsxs(U,{blockAlign:"center",gap:"200",children:[e.jsx(m,{variant:"bodyMd",as:"span",fontWeight:"regular",tone:"base",children:u?.name}),(u?.price||0)>0&&e.jsx(Bs,{size:"small",tone:"success-strong",children:t(d===30?"Monthly":"Yearly")})]}),e.jsxs(m,{variant:"headingMd",as:"h1",tone:"base",fontWeight:"semibold",children:["$",Fe((u?.price||0).toFixed(1)),"/",q.lowerCase(t("Month"))]})]}),c.package?.key!==al&&e.jsx("div",{children:e.jsx(rh,{onClick:()=>{p(),C(`${Y.BILLING_PLAN.PATH}?tab=pricing-plans`)},id:Ht.upgrade_your_usage.key,dataPrimaryLink:!0,variant:w?"secondary":"primary"})})]})})},R=i.useMemo(()=>e.jsxs(Q,{padding:"400",paddingInline:"400",children:[!Ce.isShopifyEmbedded()&&e.jsx("div",{className:"flex items-center mb-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(m,{as:"span",variant:"headingMd",children:t("BillingFor")}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("label",{htmlFor:"",children:e.jsx(As,{onChange:()=>{l("PH")}
958,checked:o==="PH",name:"app-charge-billing-header",label:"Product research"})}),e.jsx("label",{htmlFor:"",children:e.jsx(As,{onChange:()=>{l("AO")},checked:o==="AO",name:"app-charge-billing-header",label:"Dropship operation"})})]})]})}),e.jsx("div",{className:"mb-2",children:O()}),e.jsx("div",{className:"grid gap-6 py-3",style:{maxWidth:600,gridTemplateColumns:"auto 1fr"},children:T.map(w=>e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:oe("flex gap-2",a&&"pr-0"),style:{width:"auto"},children:[e.jsx("div",{children:w.icon}),e.jsxs("div",{className:"shrink-0",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"bold",tone:"subdued",children:t(w.title)}),e.jsx("div",{className:"mt-0.5",children:e.jsxs(m,{as:"span",tone:"subdued",children:[Fe(w.used)," / ",w.total===-1?t("Unlimited"):Fe(w.total)," ",t("Used").toLowerCase()]})})]})]}),e.jsx("div",{style:{width:"100%",minWidth:240},children:e.jsx(ev,{percent:w.percent||3})})]},w.key))})]}),[c,r]),P=e.jsx("div",{className:"button-wrapper",children:e.jsx(re,{variant:"monochromePlain",onClick:p,disclosure:!0,children:t("YourUsage")})});return e.jsx(Gs,{activator:P,active:g,onClose:p,children:e.jsx(Gs.Pane,{fixed:!0,children:R})})};var ud,pd;function Do(){return Do=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Do.apply(null,arguments)}const av=t=>i.createElement("svg",Do({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",strokeMiterlimit:2,"aria-hidden":"true",clipRule:"evenodd",viewBox:"0 0 20 20"},t),ud||(ud=i.createElement("path",{fillRule:"nonzero",d:"M2.5 3.5a1 1 0 0 1 1-1H5a1 1 0 0 1 1 1V5a1 1 0 0 1-1 1H3.5a1 1 0 0 1-1-1zm5.75 0a1 1 0 0 1 1-1h1.5a1 1 0 0 1 1 1V5a1 1 0 0 1-1 1h-1.5a1 1 0 0 1-1-1zm5.75 0a1 1 0 0 1 1-1h1.5a1 1 0 0 1 1 1V5a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1z"})),pd||(pd=i.createElement("path",{fill:"currentColor",d:"M6 9.25a1 1 0 0 0-1-1H3.5a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1H5a1 1 0 0 0 1-1zm5.75 0a1 1 0 0 0-1-1h-1.5a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1h1.5a1 1 0 0 0 1-1zm5.75 0a1 1 0 0 0-1-1H15a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1h1.5a1 1 0 0 0 1-1zM6 15a1 1 0 0 0-1-1H3.5a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1H5a1 1 0 0 0 1-1zm5.75 0a1 1 0 0 0-1-1h-1.5a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1h1.5a1 1 0 0 0 1-1zm5.75 0a1 1 0 0 0-1-1H15a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1h1.5a1 1 0 0 0 1-1z"}))),rv="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%204C0%201.79086%201.79086%200%204%200H16C18.2091%200%2020%201.79086%2020%204V16C20%2018.2091%2018.2091%2020%2016%2020H4C1.79086%2020%200%2018.2091%200%2016V4Z'%20fill='%235546FF'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.9534%203.5H12.8742L15.3055%207.71133L12.8742%2011.9227H11.9534L14.3846%207.71133L11.9534%203.5ZM8.04641%2016.5H7.12554L4.69431%2012.2887L7.12554%208.07735H8.04641L5.61517%2012.2887L8.04641%2016.5ZM11.5681%2016.5H10.6472L8.21594%2012.2887L10.8591%207.71133L8.42785%203.5H9.34871L11.78%207.71133L9.13681%2012.2887L11.5681%2016.5Z'%20fill='white'%20stroke='white'%20stroke-width='0.25'/%3e%3c/svg%3e",iv="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%204C0%201.79086%201.79086%200%204%200H16C18.2091%200%2020%201.79086%2020%204V16C20%2018.2091%2018.2091%2020%2016%2020H4C1.79086%2020%200%2018.2091%200%2016V4Z'%20fill='%235546FF'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.003%203C9.72787%203%209.50485%203.22526%209.50485%203.50313V4.02051C6.67399%204.25642%204.40596%206.49692%204.09551%209.33329H3.56722C3.29209%209.33329%203.06906%209.55853%203.06906%209.83639C3.06906%2010.1143%203.29209%2010.3395%203.56722%2010.3395H4.06861C4.23376%2013.3292%206.56603%2015.7345%209.50485%2015.9794V16.4969C9.50485%2016.7747%209.72787%2017%2010.003%2017C10.2781%2017%2010.5011%2016.7747%2010.5011%2016.4969V15.9789C13.4372%2015.7312%2015.7663%2013.3271%2015.9314%2010.3395H16.4326C16.7078%2010.3395%2016.9308%2010.1143%2016.9308%209.83639C16.9308%209.55853%2016.7078%209.33329%2016.4326%209.33329H15.9045C15.5942%206.49893%2013.3292%204.25959%2010.5011%204.02101V3.50313C10.5011%203.22526%2010.2781%203%2010.003%203ZM15.0744%209.99994C15.0744%2012.8304%2012.8025%2015.125%2010%2015.125C7.1975%2015.125%204.92561%2012.8304%204.92561%209.99994C4.92561%207.16949%207.1975%204.87496%2010%204.87496C12.8025%204.87496%2015.0744%207.16949%2015.0744%209.99994ZM10.7352%206.21729C8.58532%205.79237%206.44177%207.43293%206.27084%209.63246C6.26454%209.71703%206.25643%209.80243%206.25108%209.8583C6.15753%2011.8057%207.65261%2013.5832%209.53891%2013.8158C10.4266%2013.9351%2011.3278%2013.7399%2012.0891%2013.2634C12.7492%2012.8641%2013.2638%2012.2598%2013.5562%2011.5408C13.7849%2011.0079%2013.8913%2010.4297%2013.8676%209.84943C13.8439%209.26913%2013.6907%208.70178%2013.4194%208.18976C13.1481%207.67777%2012.7657%207.23442%2012.3009%206.89282C11.8361%206.55125%2011.3008%206.32032%2010.7352%206.21729ZM10.7135%208.39047C10.7879%208.4584%2010.8841%208.4968%2010.9843%208.49862C11.2332%208.4908%2011.4822%208.47104%2011.7545%208.44943C11.859%208.44114%2011.967%208.43256%2012.0798%208.42429C12.3686%208.4107%2012.4791%208.56515%2012.3542%208.90312C12.3016%209.04556%2012.2478%209.18762
958%2012.1939%209.32968C12.0967%209.5862%2011.9995%209.84272%2011.9098%2010.1015C11.8779%2010.1996%2011.8751%2010.3051%2011.9017%2010.4049C11.9715%2010.6578%2012.0511%2010.9078%2012.1306%2011.1576C12.1588%2011.2462%2012.187%2011.3348%2012.2148%2011.4235C12.3381%2011.8195%2012.2167%2011.9614%2011.8182%2011.9059C11.4197%2011.8504%2011.0211%2011.7987%2010.6217%2011.7614C10.5121%2011.7554%2010.4031%2011.7806%2010.3069%2011.8341C10.0884%2011.9573%209.87346%2012.0868%209.65841%2012.2164C9.51666%2012.3018%209.37485%2012.3872%209.2319%2012.471C8.9386%2012.6418%208.76586%2012.5455%208.73172%2012.203C8.72538%2012.1402%208.71913%2012.0774%208.71287%2012.0146C8.68174%2011.702%208.65057%2011.3891%208.60935%2011.0783C8.5942%2010.9833%208.55201%2010.8949%208.48793%2010.8239C8.30515%2010.6268%208.11786%2010.4343%207.93059%2010.2418C7.8165%2010.1245%207.70241%2010.0072%207.58935%209.88894C7.35997%209.64786%207.4014%209.45822%207.70994%209.34288C7.84156%209.29371%207.97397%209.24709%208.10631%209.20051C8.31949%209.12546%208.53249%209.05048%208.74174%208.96494C8.8392%208.921%208.91798%208.8434%208.96396%208.74607C9.05646%208.52645%209.13957%208.30238%209.22268%208.07827C9.27047%207.9494%209.31827%207.82052%209.36786%207.69247C9.4875%207.38082%209.67545%207.3391%209.90756%207.57255C10.0075%207.67328%2010.1062%207.77535%2010.2048%207.8774C10.3723%208.05077%2010.5397%208.22405%2010.7135%208.39047Z'%20fill='white'/%3e%3c/svg%3e",Zi=[{name:"Omni Dropshipping",value:"omni-dropshipping",description:"Import products & fulfill orders",selected:!0,app_key:"AO",logo_url:rv},{name:"Product Researcher",value:"product-researcher",description:"Find potential winning products",url:"https://hunter.zopi.io",app_key:"AH",logo_url:iv},{name:"Zopi Extension",value:"zopi-extension",description:"Save ideas with smart search",url:"https://ext.zopi.io",app_key:"EXT_ZOPI",hidden:!0,logo_url:""}],ov=()=>{const[t,s]=i.useState(!1),{t:n}=J(),[a,r]=i.useState(-1),{hasPermission:o}=gs(),l=()=>s(g=>!g),c=async(g,h)=>{g.preventDefault(),g.stopPropagation(),window.open(h.url),r(-1)},u=e.jsx("button",{onClick:l,"aria-label":"change app",className:"button-origin",children:e.jsx(ee,{source:av})});return o([Te.VIEW_SWITCH_APP])?e.jsx(Gs,{sectioned:!0,activator:u,active:t,onClose:l,children:e.jsx(lv,{children:e.jsx(Q,{paddingBlockStart:"100",children:e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"h4",variant:"headingSm",children:n("ZopiApps")}),e.jsx(gl,{title:"",onChange:g=>{const h=Zi.find(p=>p.app_key===g[0]);h&&h.url&&window.open(h.url,"_blank")},options:Zi.filter(g=>!g.hidden).map((g,h)=>({value:g.app_key,label:e.jsx("a",{className:"app-item",href:g.url,onClick:p=>c(p,g),target:"_blank",rel:"noreferrer",children:e.jsxs(U,{gap:"150",wrap:!1,blockAlign:"center",children:[e.jsx(nb,{customer:!0,size:"xs",source:g.logo_url}),e.jsx(m,{as:"span",variant:"bodyMd",children:g.name}),a===h&&e.jsx(nn,{size:"small"})]})})})),selected:[Zi[0].app_key]})]})})})}):null},lv=se.div` 959 min-width: 190px; 960 ul { 961 padding: 0; 962 } 963 .app-item { 964 text-decoration: none; 965 color: var(--p-color-text); 966 } 967`,cv=()=>{const{t}=J(),{refererUrlAutoLogin:s,isPlanFree:n}=de(),a=n(),r=n("PH"),o=a||r,{hasPermission:l}=gs(),c=he(Gn),u=l([Te.VIEW_ACTION_CHANGE_PLAN]),d=pt(),g=s(`${Y.BILLING_PLAN.PATH}?tab=pricing-plans`);return!u||!o?e.jsx(e.Fragment,{}):e.jsx("span",{onClick:h=>{h.preventDefault(),c(!0)},children:e.jsx(re,{variant:"monochromePlain",id:Ht.upgrade_header.key,onClick:()=>d(g),children:t("Upgrade")})})},dv=se.div` 968 gap: 10px; 969 margin-right: 10px; 970 color: #fff; 971 svg { 972 color: #fff; 973 } 974 975 button { 976 -webkit-appearance: none; 977 appearance: none; 978 background: none; 979 border: none; 980 border: 0; 981 border-radius: var(--p-border-radius-100); 982 color: inherit; 983 color: var(--p-color-text); 984 cursor: pointer; 985 font-size: inherit; 986 justify-content: center; 987 line-height: inherit; 988 margin: 0; 989 margin-right: 0px; 990 min-width: 2.25rem; 991 padding: 0; 992 padding: 0.625rem; 993 position: relative; 994 height: 32px; 995 transition: background-color var(--p-motion-duration-100); 996 } 997 button, 998 .button-class { 999 background-color: var(--p-color-bg-fill-inverse) !important; 1000 border-radius: var(--p-border-radius-200) !important; 1001 color: var(--p-color-text-inverse) !important; 1002 min-width: max-content !important; 1003 padding: var(--p-space-150); 1004 } 1005 .button-class { 1006 &.language-top-bar { 1007 padding: 0px var(--p-space-150); 1008 border: 0px !important; 1009 svg { 1010 fill: var(--p-color-text-inverse); 1011 } 1012 button { 1013 box-shadow: none; 1014 } 1015 } 1016 } 1017 .button-origin, 1018 .button-wrapper button { 1019 margin-right: 0; 1020 } 1021 .Polaris-TopBar-UserMenu__Message > p { 1022 color: var(--p-color-text-inverse); 1023 font-size: 12px; 1024 } 1025`,uv=se.div` 1026 position: absolute; 1027 user-select: none; 1028 z-index: 0; 1029 top: -8px; 1030 right: -6px; 1031 box-sizing: border-box; 1032 border-radius: 50rem; 1033 background-color: #de3618; 1034 color: #fff; 1035 font-size: 12px; 1036 font-weight: 700; 1037 line-height: 18px; 1038 padding-inline: 4px; 1039 text-align: center; 1040`,pv=({isOnboarding:t})=>{const{t:s}=J(),{getUserInfo:n,signout:a,getCurrentPlan:r}=de(),{hasPermission:o}=gs(),l=dt(),[c,u]=i.useState(!1),{getInfoZopiMobileApp:d}=$o(),g=d(),h=he(pa),{data:p}=vr(),x=p?.count||0,f=n(),_=l.getChannelConnected(),b=i.useMemo(()=>{let S="";return f.first_name&&(S=f.first_name+" "+(f.last_name??"")),S},[n().id]),v=i.useCallback(()=>u(S=>!S),[]),y=i.useCallback(()=>{a()},[]),C=i.useMemo(()=>[{content:"BillingPlan",url:Y.BILLING_PLAN.PATH,permissions:[Te.VIEW_ACTION_CHANGE_PLAN],icon:Tg,external:Ce.isShopifyEmbedded(),hidden:f.is_user_mkt||Ce.isShopifyEmbedded()&&r().provider_payment==="PADDLE_BILLING"||t||g.is_hide_billing},{content:"AccountLinkedStores",icon:bl,url:Y.GENERAL_SETTING.PATH,permissions:[Te.VIEW_SETTING_CONNECTED_STORE],hidden:t},{icon:Na,content:"HelpCenter",url:Ea.HOME,external:!0,permissions:[Te.VIEW_HELP_CENTER]}].filter(j=>!j.hidden&&o(j.permissions)),[Ce.isShopifyEmbedded(),l.getShop().id,r().provider_payment,f.id,_,y]);return e.jsxs(dv,{className:"msui-flex msui-flex-center",children:[g.is_hide_billing?"":e.jsx(e.Fragment,{children:!t&&e.jsxs(e.Fragment,{children:[f.has_shop&&!g.is_hide_billing&&e.jsx(cv,{}),g.is_hide_billing?"":e.jsx(nv,{})]})}),e.jsx($C,{}),!t&&e.jsxs("div",{style:{position:"relative"},className:"msui-cs-pointer",onClick:()=>{h(!0)},children:[e.jsx("button",{className:"button-origin",children:e.jsx(ee,{source:xl})}),x>0?e.jsx(uv,{children:x>99?"99+":x}):""]}),e.jsx(bp.UserMenu,{avatar:n().avatar,actions:[{items:C.map(S=>({...S,content:s(S.content)}))},{items:[{content:s("LogOut"),icon:Pg,onAction:y}]}
1040],name:b,detail:n().email,initials:b?b.charAt(0).toUpperCase():n().email?.charAt(0).toUpperCase(),open:c,onToggle:v}),g.is_hide_billing?"":e.jsx(ov,{})]})},hv=t=>e.jsx(bp,{showNavigationToggle:!Ce.isShopifyEmbedded(),userMenu:e.jsx(pv,{isOnboarding:t.isOnboarding}),...t}),gv=t=>e.jsx(mv,{children:t.children}),mv=se.div` 1041 flex: 1 0 auto; 1042 .Polaris-Navigation__Item { 1043 align-items: center; 1044 } 1045`,fv=t=>e.jsx(xv,{children:t.children}),xv=se.div` 1046 background: var(--p-color-nav-bg); 1047 bottom: 0; 1048 padding-top: 1rem; 1049 position: sticky; 1050 z-index: 2; 1051`,_v=()=>{const t=de(),{setCurrentShop:s,getListShop:n,getShop:a}=dt(),{setCurrentWorkplace:r}=de(),o=n(),[l,c]=i.useState(!1),u=pt(),d=a(),g=t.checkPermissionFeature("WP_ADD_STORE"),h=i.useCallback(f=>{f!==d?.id?.toString()&&(u(Y.HOME_PAGE.PATH),c(!1),s(+f,{reload:!1}),r(o.find(_=>_.id===+f)?.workplace_id||0))},[]),p=o.every(f=>f.status!=="active");if(o.length===0||p)return e.jsx(e.Fragment,{});const x=e.jsx("div",{className:"w-full rounded-lg bg-bg-surface-secondary px-2 py-2 cursor-pointer shadow-button hover:shadow-button-hover select-none",onClick:()=>c(f=>!f),children:e.jsxs("div",{className:"flex items-center gap-1 justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx("span",{children:e.jsx(or,{source:d?.platform||"shopify",fontSize:16})}),e.jsx("span",{className:"truncate",children:d?.store_name})]}),e.jsx("div",{children:e.jsx(ee,{source:mr})})]})});return e.jsx("div",{style:{margin:"0 1rem 1rem"},children:e.jsx(Gs,{active:l,activator:x,onClose:()=>c(!1),children:e.jsx(gl,{selected:[d?.id?.toString()||""],onChange:f=>{const _=f[0];h(_)},options:o.map(f=>({label:f.store_name||f.platform_domain,media:e.jsx(or,{source:f.platform,fontSize:18}),value:f.id+"",disabled:f.status!=="active"||!g&&f.id!==d.id}))})})})},bv=Oe.memo(_v),yv=({})=>{const{isPlanFree:t}=de(),{t:s}=J(),n=Pt(),a=pt(),r=l=>{Ke.trackingEventUsersAction({event_name:l,event_data:{}}),setTimeout(()=>{n.showChat()},800)};return t("AO")&&t("PH")?e.jsxs("div",{className:"mx-3 mb-3 flex flex-col items-center gap-4 roun
1051ded-xl bg-white p-4",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center",children:e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"18",cy:"18",r:"18",fill:"#00A47C",fillOpacity:"0.12"}),e.jsx("circle",{cx:"18",cy:"18",r:"13",fill:"#00A47C"}),e.jsx("path",{d:"M18 24V13M18 13L13.5 17.5M18 13L22.5 17.5",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}),e.jsx("p",{className:"text-center text-xs leading-4 text-text-secondary",children:s("UpgradeToAPaidPlanToAccessFullZopiCapabilitiesForDropshipping")}),e.jsxs("div",{className:"flex w-full flex-col gap-2",children:[e.jsx(re,{onClick:()=>a(`${Y.BILLING_PLAN.PATH}?tab=pricing-plans`),variant:"primary",children:s("ViewPlans")}),e.jsx(re,{onClick:()=>r($.SUBSCRIPTION_CUSTOM_PLAN_CLICKED),variant:"tertiary",children:s("RequestCustomPlan")})]})]}):e.jsx(e.Fragment,{})},Cv=(t,s)=>{if(s===Y.HOME_PAGE.PATH)return Y.HOME_PAGE.ID;for(const n of t)for(const a of n.items)if(a.url!==Y.HOME_PAGE.PATH&&(a.url&&!a.url.includes(Y.HOME_PAGE.ID)&&s.includes(a.url)||a.subNavigationItems?.some(r=>r.url&&s.includes(r.url))))return a.id},vv=(t,s,n)=>!(t.isHidden||!s.has_shop&&[Y.INTEGRATION.TITLE].includes(t.keyTranslation)||t.permissions&&!n(t.permissions)),Av=(t,s)=>!t.permissions?.length||s(t.permissions),Sv=(t,s,n)=>t.url?{url:t.url,label:t.keyTranslation?n(t.keyTranslation):t.label||"",disabled:t.disabled,new:t.new,onClick:t.onClick,keyTranslation:t.keyTranslation,permissions:t.permissions,matches:s.includes(t.url)?!0:void 0}:null,jv=(t,s,n,a)=>{if(t.badge_type==="import_list")return` ${s.unpushed||0}`;if(t.badge_type==="product_list")return` ${s.pushed||0}`;if(t.badge_type==="order_list")return n+"";if(t.isNewFeature)return e.jsx(Iv,{children:a("New")})},Ev=(t,s,n,a,r,o,l)=>{const c=s===t.id,u={...t,badge:jv(t,n,a,o)??t.badge,label:t.keyTranslation?o(t.keyTranslation):t.label,selected:c};if(t.subNavigationItems){const d=t.subNavigationItems.filter(g=>Av(g,r)).map(g=>Sv(g,l,o)).filter(g=>g!==null);d.length>0&&(u.subNavigationItems=d)}return u},Tv=(t,s,n,a,r,o,l,c,u=!1,d="")=>{if(!t.items)return{...t,items:[]};let g=q.cloneDeep(t.items);return u&&(g=g.filter(h=>r.has_shop||![Y.INTEGRATION.TITLE].includes(h.keyTranslation))),{...t,title:t.keyTranslation?l(t.keyTranslation):t.title,isFreePlan:t.keyApp?!!c(t.keyApp):t.isFreePlan,items:g.filter(h=>vv(h,r,o)).map(h=>Ev(h,s,n,a,o,l,d))}},Xi=km,Pv=()=>{const{pathname:t}=zs(),{t:s}=J(),{getUserInfo:n,isPlanFree:a}=de(),{hasPermission:r}=gs(),o=ke(ip),l=ke(La),c=he(Gn),u=he(Rn),d=n(),g=i.useMemo(()=>Cv(Xi,t),[t]),{menuSessionTop:h,menuSessionBottom:p}=i.useMemo(()=>{const f=[],_=[];return Xi.forEach(b=>{const v=Tv(b,g,l,o,d,r,s,a,!0,t);b.placement==="top"?f.push(v):_.push(v)}),{menuSessionTop:f,menuSessionBottom:_}},[t,g,l,o,d,r,s,a,Xi]),x=({session:f})=>f.isFreePlan&&f.keyApp?e.jsxs("div",{className:"bg-bg-fill-success-secondary text-text-success px-1.5 py-0.25 rounded-full flex items-center gap-0.5 absolute top-1 right-4 cursor-pointer",onClick:()=>{c(!0),u(f.keyApp)},children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 20 20",children:[e.jsx("path",{fill:"#fff",fillOpacity:"0.01",d:"M0 0h20v20H0z"}),e.jsx("path",{fill:"#008F3D",fillRule:"evenodd",d:"M18.333 10a8.333 8.333 0 1 1-16.667 0 8.333 8.333 0 0 1 16.667 0M6.912 8.558l2.494-2.48a.84.84 0 0 1 1.186 0l2.495 2.48a.83.83 0 0 1 0 1.18.84.84 0 0 1-1.184 0l-1.066-1.06v4.655c0 .46-.375.834-.837.834a.836.836 0 0 1-.838-.834V8.678l-1.066 1.06a.84.84 0 0 1-1.184 0 .835.835 0 0 1 0-1.18",clipRule:"evenodd"})]}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"semibold",tone:"success",children:"FREE"})]}):null;return e.jsxs(Mi,{location:t,children:[e.jsx(bv,{}),e.jsx(gv,{children:h.map((f,_)=>e.jsxs("div",{className:"relative",children:[e.jsx(Mi.Section,{title:f.title,items:f.items}),e.jsx(x,{session:f})]},`session-top-${_}`))}),!Ce.isShopifyEmbedded()&&e.jsxs(fv,{children:[p.map((f,_)=>e.jsx("div",{className:"relative",children:e.jsx(Mi.Section,{title:f.title,items:f.items,rollup:{after:1,view:"view",hide:"hide",activePath:""}})},`session-bottom-${_}`)),e.jsx(yv,{})]})]})},Iv=se.div` 1052 /* display: inline-block; */ 1053 background-color: #5546ff;
1054 border-radius: 25px; 1055 font-size: 10px; 1056 display: flex; 1057 justify-content: center; 1058 align-items: center; 1059 color: #fff; 1060 padding: 0.5em 0.75em; 1061 position: relative; 1062 1063 &::before { 1064 content: ''; 1065 display: block; 1066 position: absolute; 1067 top: 0; 1068 left: 0; 1069 right: 0; 1070 bottom: 0; 1071 animation: pulse 1s ease infinite; 1072 border-radius: 25px; 1073 border: 4px double #5546ff; 1074 } 1075 1076 @keyframes pulse { 1077 0% { 1078 transform: scale(1); 1079 opacity: 1; 1080 } 1081 60% { 1082 transform: scale(1.3); 1083 opacity: 0.4; 1084 } 1085 100% { 1086 transform: scale(1.4); 1087 opacity: 0; 1088 } 1089 } 1090`,bi=t=>{const{isOnboarding:s,isMigrateCenter:n}=t,[a,r]=i.useState(!1),{isMobile:o}=xe(),l=i.useCallback(()=>r(u=>!u),[]);let c={};return s||(c={navigation:Ce.isShopifyEmbedded()?void 0:e.jsx(Pv,{isMigrateCenter:n}),showMobileNavigation:a,onNavigationDismiss:l}),o?e.jsx(e.Fragment,{children:t.children}):e.jsx(Ig,{logo:Ce.isShopifyEmbedded()?void 0:JC(),topBar:Ce.isShopifyEmbedded()?"":e.jsx(hv,{isOnboarding:s,onNavigationToggle:l}),...c,children:t.children})},Rv=({setOnboarding:t})=>{const{t:s}=J(),{fetchCurrentPlan:n,getPricingPlan:a}=de(),{getCurrentCyclePlan:r,getCurrentFulfillmentPlan:o,findPlanByKey:l}=zt(),c=o("AO"),u=r("AO"),{mdDown:d}=gr(),[g,h]=i.useState({}),[p,x]=be(Gt),f=bt(),{isMobile:_}=xe(),[b,v]=i.useState(!1),[y,C]=i.useState(!0),[S,j]=i.useState(!0),[A,E]=i.useState(!1),[T,k]=i.useState({name:"",dateEnd:"",directUrl:""}),[O,R]=i.useState(!1),[P,w]=i.useState(!1),[N,K]=i.useState(!1),[L,W]=i.useState(!1),H=he(Rn),Z=a(),[te,ne]=i.useState(!1),le=i.useRef(null),B=dt(),ie=de(),V=B.getShop(),M=ie.getUserInfo(),I=pt();let F;const G=i.useRef(null),z=i.useRef(null);Ce.isShopifyEmbedded()&&(F=Wn());const me=Pt(),Re=ie.getCurrentPlan(),Be=ue=>{if(!ue)return!1;F?F(ue):window.location.href=ue},De=async(ue,ce)=>{try{let Ae=q.head(ce)?.id;const _e=ue?.plan_reinstalled;_e&&(Ae=_e?.store_id),me.pushEventUserVisitHere("visit_onboarding_pricing");const Pe=ce,Ne=q.get(Z,"CREDIT",[]),rt=q.head(Pe);!Ae&&rt?.status==="active"&&(Ae=rt?.id??0),ue?.pricing_onboarding_ao&&x("yearly");let ye={};const Ie=Re,Ue=Ie?.package?.modules?.[0]||{};if(C(!1),q.size(_e)){const ht=q.head(Ie?.package_reinstalled?.modules.filter(Dt=>Dt.type==="CREDIT"));ye={...q.pick(ht,["price","features","cycle"]),key:ht?.key,name:ht?.name,type:ht?.type,id:ht?.id,cycle:Ie?.package_reinstalled?.cycle,price:Ie?.package_reinstalled?.price||0}}ue.pricing_onboarding_ao&&(ye=Ue),M?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE"&&(ye={cycle:Ie?.package?.cycle||30,...Ue,price:Ie?.package?.price||0},x(Ie?.package?.cycle===365?"yearly":"monthly")),h({storeID:Ae,isReinstall:!!q.size(_e)||!1,currentModule:ye||{},pricingModules:Ne})}catch(Ae){C(!1),console.log(Ae)}},ot=async(ue,ce)=>{try{w(!1),E(!0);const{status:Ae,data:_e,message:Pe}=await ls.chargeSubscription({params:ue});if(Ae===fe.FIRST_CYCLE_DOWNGRADE_FAILED&&Pe==="FIRST_CYCLE_DOWNGRADE_FAILED"&&v(!0),Ae===fe.QUOTA_EXPIRED){const Ne=Ny[_e?.feature_id||""]?.label??"";if(ne(!1),E(!1),Ne)return f.error(s("CannotDowngradePlan",{feature:Ne})),!1;if(Pe)return f.error(s(Pe)),!1}if(Ae===fe.OK&&_e?.confirmation_url){const Ne={is_new_user:!g?.isReinstall,name:ce.name??"",price:ce.price??0,old_name:c?.name??"",old_price:c?.price??0,start_time:it()};ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify(Ne));const rt=` (${ue.is_yearly?"yearly":"monthly"})`,ye=ce.name+rt;if(_e?.apply_on_next_billing_cycle)return ne(!1),E(!1),R(!0),k({name:ye,directUrl:_e.confirmation_url,dateEnd:it(Re?.next_billing_time??"").format("ll")}),!1;Be(_e?.confirmation_url??"")}else{if(Pe)return ne(!1),E(!1),!1;Ae===fe.BAD_REQUEST&&q.size(_e)&&Pe==="be_payment_cannot_change_your_subscription"&&f.error(s("be_payment_cannot_change_your_subscription",{feature:_e?.message_params})),ne(!1),E(!1)}}catch(Ae){console.error(Ae)}},ve=async()=>{try{E(!0);const{status:ue}=await ls.cancelCurrentPlan({});if(ue===200){await ls.skipCurrentPlan();const ce=B.getShopListAtWorkplace();t(ce.length<=1?M.order_onboarding_ao?"onboarding-order":"onboarding-import":"done"),n(),I(Y.HOME_PAGE.PATH);return}}catch(ue){console.error(ue)}finally{E(!1)}}
1090,pe=()=>{if(K(!0),M?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE"){Cs.postMetaOneTimeCharge({meta_key:"AO_ACCOUNT_ONE_TIME_CHARGE_ANTI_CLOSE_STORE"}),t("done"),I(Y.HOME_PAGE.PATH);return}if(M?.plan_reinstalled)ve();else{Cs.updateOnboardingPricing();let ce=B.getShopListAtWorkplace().length<=1?M.order_onboarding_ao?"onboarding-order":"onboarding-import":"done";ce==="onboarding-import"&&!M.import_onboarding_ao&&(ce="done"),t(ce),n(),me.setUserStartSelectFreePlan(B.getShop().plan_name),I(Y.HOME_PAGE.PATH)}ss("pricing_continue_click",{})},ze=(ue,ce={})=>{requestAnimationFrame(async()=>{let Ae=l(ue);if(ce.isRechargePlan&&(Ae=Re?.package?.modules?.[0]),!Ae?.id){f.error(s("NoPlanSelectedYet"));return}if(ue.includes("FREE")){const Pe=Re.package_reinstalled?.modules?.[0];if(!Pe){f.error(s("NoPlanSelectedYet"));return}const Ne=l(Pe?.key);if(!Ne){f.error(s("NoPlanSelectedYet"));return}Re?.remaining_trial_days,ot({provider_payment:"SHOPIFY",module_ids:[Ne.id],is_yearly:Re.package_reinstalled?.cycle!==30,confirm_downgrade:!1},Ae);return}if(!g?.storeID){f.error(s("StoreNoLongerExist"));return}const _e={store_id:g.storeID,provider_payment:"SHOPIFY",module_ids:[Ae.id],is_yearly:p==="yearly"};if(Ae?.key===c?.key&&((u===30?p==="monthly":p==="yearly")||ce?.isRechargePlan)&&(delete _e.module_ids,delete ce.isRechargePlan,_e.package_id=Re.package?.id+""),M?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE"&&(_e.is_back_to_recurring=!0),ue==="FREE"){const Pe=l("GROWTH");_e.trial=!0,w(!0),Pe?.id&&(_e.module_ids=[Pe.id],_e.is_yearly=!1,z.current={params:_e,planSelected:Pe});return}ot({..._e,...ce},Ae)})},Ge=()=>{E(!0),ne(!0),R(!1),Be(T.directUrl)},lt=()=>y?e.jsx(ut,{children:e.jsx(nn,{})},1):e.jsxs(e.Fragment,{children:[e.jsx(oy,{plan:g,isShowBanner:S,onDismissBanner:()=>j(!1),onClickAllPlan:()=>{W(!0),x(g?.currentModule?.cycle===365?"yearly":"monthly")},onClickViewAllFeatures:()=>{requestAnimationFrame(()=>{G?.current?.open()})},onClickReChargePlan:()=>{requestAnimationFrame(()=>{ze(c?.key||"",{is_yearly:Re?.package_reinstalled?.cycle!==30,isRechargePlan:!0})})}}),e.jsx(xt,{background:"bg-fill-secondary",onClose:()=>W(!1),visible:L,showCloseIcon:!_,styleContent:{height:"100%"},children:e.jsx("div",{className:"flex min-h-screen mx-auto",style:{maxWidth:1144},children:e.jsx("div",{className:"w-full",children:e.jsx(Tl,{id:"ob-pricing-new",isOnboarding:!0,isReinstall:!0,onTryZopiForFree:()=>{pe()},hiddenTitle:!0,onPaymentSuccess:()=>{t("done"),W(!1),Cs.updateOnboardingPricing()}})})})})]});return i.useEffect(()=>(B.getListShop().length&&M.id&&(!M.plan_reinstalled&&M.pricing_onboarding_ao&&B.getShopListAtWorkplace().length<=1&&(ge.localStorage.set(st.QUICK_START_NEW_USER+(M.id||"").toString(),new Date().getTime()),ge.localStorage.set(st.NEW_USER_ONBOARDING,new Date().getTime())),De(M,B.getListShop())),()=>{le.current&&clearTimeout(le.current)}),[B.getListShop(),ie.getUserInfo()]),i.useEffect(()=>{x("yearly"),H("AO")},[]),i.useEffect(()=>{let ue;return M?.id&&V.id&&!q.size(M.plan_reinstalled)&&(ue=setInterval(()=>{Ke.trackingUserOnPage(V.plan_name||"no plan")},3e3)),()=>{clearInterval(ue)}},[M,V?.id]),i.useEffect(()=>{setTimeout(()=>{P&&!N&&Ke.trackingEventUsersAction({event_name:$.SUBSCRIPTION_NO_PLAN_FROM_TRIAL_ABANDONED,event_data:{app_plan:"FREE",package_name:"none",price:null}},!0)},2e4)},[P]),e.jsxs(e.Fragment,{children:[e.jsx(nh,{isAtOnboarding:!0,ref:G,onChoosePlan:ue=>{G?.current?.close(),ze(ue)},loadingCharge:""}),e.jsx(vl,{open:b,onClose:()=>v(!1)}),e.jsx(Al,{isRedirecting:te,open:A}),e.jsx(Sl,{open:O,planDowngraded:{name:T.name},onClose:()=>R(!1),onConfirm:Ge}),e.jsx(bi,{isOnboarding:!0,children:e.jsx(ly,{isMdDown:d,children:lt()})})]})},kv=({setOnboarding:t})=>(i.useEffect(()=>{ss("pricing_view",{})},[]),e.jsx(Rv,{setOnboarding:t},"ob-new-pricing")),wv=({stepData:t,isTryForFreeOb:s,onUpdateOnboarding:n,onUpdateCompleteOnboarding:a,handleTryForFreePlan:r})=>e.jsx(Tl,{id:"onboarding-new",stepData:t,isOnboarding:!0,onTryZopiForFree:r,onPaymentSuccess:()=>{n()},onUpdateCompleteOnboarding:a,isTryForFreeOb:s,isShowNewUI:!0}),Pl={POST_COMPLETE_OB:"/core/complete-onboarding",POST_RESELECT_OB:"center/
1090products/reselect-category-onboarding"},Nv=(t,s)=>X(Pl.POST_COMPLETE_OB,{onboarding:t},{method:"POST"},{cancelToken:s}),Ov=t=>X(Pl.POST_RESELECT_OB,t,{method:"POST"}),Dv=t=>X(Pl.POST_COMPLETE_OB,{method:"GET"},{cancelToken:t}),dh={getCompleteOb:Dv,postCompleteOb:Nv,postReselectOb:Ov},Zt={AF:{icon:u1,label:"Afghanistan"},AL:{icon:d1,label:"Albania"},DZ:{icon:c1,label:"Algeria"},AS:{icon:l1,label:"American Samoa"},AD:{icon:o1,label:"Andorra"},AO:{icon:i1,label:"Angola"},AI:{icon:r1,label:"Anguilla"},AG:{icon:a1,label:"Antigua and Barbuda"},AR:{icon:n1,label:"Argentina"},AM:{icon:s1,label:"Armenia"},AW:{icon:t1,label:"Aruba"},AU:{icon:e1,label:"Australia"},AT:{icon:$_,label:"Austria"},AZ:{icon:J_,label:"Azerbaijan"},BS:{icon:X_,label:"Bahamas"},BH:{icon:Z_,label:"Bahrain"},BD:{icon:q_,label:"Bangladesh"},BB:{icon:Q_,label:"Barbados"},BY:{icon:K_,label:"Belarus"},BE:{icon:z_,label:"Belgium"},BZ:{icon:Y_,label:"Belize"},BJ:{icon:V_,label:"Benin"},BM:{icon:W_,label:"Bermuda"},BT:{icon:G_,label:"Bhutan"},BO:{icon:H_,label:"Bolivia, Plurinational State of"},BA:{icon:B_,label:"Bosnia and Herzegovina"},BW:{icon:F_,label:"Botswana"},BR:{icon:U_,label:"Brazil"},IO:{icon:M_,label:"British Indian Ocean Territory"},BG:{icon:L_,label:"Bulgaria"},BF:{icon:D_,label:"Burkina Faso"},BI:{icon:O_,label:"Burundi"},KH:{icon:N_,label:"Cambodia"},CM:{icon:w_,label:"Cameroon"},CA:{icon:k_,label:"Canada"},CV:{icon:R_,label:"Cape Verde"},KY:{icon:I_,label:"Cayman Islands"},CF:{icon:P_,label:"Central African Republic"},TD:{icon:T_,label:"Chad"},CL:{icon:E_,label:"Chile"},CN:{icon:j_,label:"China"},CO:{icon:S_,label:"Colombia"},KM:{icon:A_,label:"Comoros"},CG:{icon:v_,label:"Congo"},CD:{icon:C_,label:"Democratic Republic of the Congo"},CK:{icon:y_,label:"Cook Islands"},CR:{icon:b_,label:"Costa Rica"},CI:{icon:__,label:"Côte d'Ivoire"},HR:{icon:x_,label:"Croatia"},CU:{icon:f_,label:"Cuba"},CW:{icon:m_,label:"Curaçao"},CY:{icon:g_,label:"Cyprus"},CZ:{icon:h_,label:"Czech Republic"},DK:{icon:p_,label:"Denmark"},DJ:{icon:u_,label:"Djibouti"},DM:{icon:d_,label:"Dominica"},DO:{icon:c_,label:"Dominican Republic"},EC:{icon:l_,label:"Ecuador"},EG:{icon:o_,label:"Egypt"},SV:{icon:i_,label:"El Salvador"},GQ:{icon:r_,label:"Equatorial Guinea"},ER:{icon:a_,label:"Eritrea"},EE:{icon:n_,label:"Estonia"},ET:{icon:s_,label:"Ethiopia"},FK:{icon:t_,label:"Falkland Islands (Malvinas)"},FO:{icon:e_,label:"Faroe Islands"},FJ:{icon:$2,label:"Fiji"},FI:{icon:J2,label:"Finland"},FR:{icon:X2,label:"France"},PF:{icon:Z2,label:"French Polynesia"},GA:{icon:q2,label:"Gabon"},GM:{icon:Q2,label:"Gambia"},GE:{icon:K2,label:"Georgia"},DE:{icon:z2,label:"Germany"},GH:{icon:Y2,label:"Ghana"},GI:{icon:V2,label:"Gibraltar"},GR:{icon:W2,label:"Greece"},GL:{icon:G2,label:"Greenland"},GD:{icon:H2,label:"Grenada"},GU:{icon:B2,label:"Guam"},GT:{icon:F2,label:"Guatemala"},GG:{icon:U2,label:"Guernsey"},GN:{icon:M2,label:"Guinea"},GW:{icon:L2,label:"Guinea-Bissau"},HT:{icon:D2,label:"Haiti"},HN:{icon:O2,label:"Honduras"},HK:{icon:N2,label:"Hong Kong"},HU:{icon:w2,label:"Hungary"},IS:{icon:k2,label:"Iceland"},IN:{icon:R2,label:"India"},ID:{icon:I2,label:"Indonesia"},IR:{icon:P2,label:"Iran, Islamic Republic of"},IQ:{icon:T2,label:"Iraq"},IE:{icon:E2,label:"Ireland"},IM:{icon:j2,label:"Isle of Man"},IL:{icon:S2,label:"Israel"},IT:{icon:A2,label:"Italy"},JM:{icon:v2,label:"Jamaica"},JP:{icon:C2,label:"Japan"},JE:{icon:y2,label:"Jersey"},JO:{icon:b2,label:"Jordan"},KZ:{icon:_2,label:"Kazakhstan"},KE:{icon:x2,label:"Kenya"},KI:{icon:f2,label:"Kiribati"},KP:{icon:m2,label:"North Korea"},KR:{icon:g2,label:"South Korea"},KW:{icon:h2,label:"Kuwait"},KG:{icon:p2,label:"Kyrgyzstan"},LA:{icon:u2,label:"Lao People's Democratic Republic"},LV:{icon:d2,label:"Latvia"},LB:{icon:c2,label:"Lebanon"},LS:{icon:l2,label:"Lesotho"},LR:{icon:o2,label:"Liberia"},LY:{icon:i2,label:"Libya"},LI:{icon:r2,label:"Liechtenstein"},LT:{icon:a2,label:"Lithuania"},LU:{icon:n2,label:"Luxembourg"},MO:{icon:s2,label:"Macao"},MK:{icon:t2,label:"Republic of Macedonia"},MG:{icon:e2,label:"Madagascar"},MW:{icon:$x,label:"Malawi"},MY:{icon:Jx,label:"Malaysia"},MV:{icon:Xx,label:"Maldives"},ML:{icon:Zx,label:"Mali"},MT:{icon:qx,label:"Malta"},MH:{icon:Qx,label:"Marshall Islands"},MQ:{icon:Kx,label:"Martinique"},MR:{icon:zx,label:"Mauritania"},MU:{icon:Yx,label:"Mauritius"},MX:{icon:Vx,label:"Mexico"},FM:{icon:Wx,label:"Micronesia, Federated States of"},MD:{icon:Gx,label:"Republic of Moldova"},MC:{icon:Hx,label:"Monaco"},MN:{icon:Bx,label:"Mongolia"},ME:{icon:Fx,label:"Montenegro"},MS:{icon:Ux,label:"Montserrat"},MA:{icon:Mx,label:"Morocco"},MZ:{icon:Lx,label:"Mozambique"},MM:{icon:Dx,label:"Myanmar"},NA:{icon:Ox,label:"Namibia"},NR:{icon:Nx,label:"Nauru"},NP:{icon:wx,label:"Nepal"},NL:{icon:kx,label:"Netherlands"},NZ:{icon:Rx,label:"New Zealand"},NI:{icon:Ix,label:"Nicaragua"},NE:{icon:Px,label:"Niger"},NG:{icon:Tx,label:"Nigeria"},NU:{icon:Ex,label:"Niue"},NF:{icon:jx,label:"Norfolk Island"},MP:{icon:Sx,label:"Northern Mariana Islands"},NO:{icon:Ax,label:"Norway"},OM:{icon:vx,label:"Oman"},PK:{icon:Cx,label:"Pakistan"},PW:{icon:yx,label:"Palau"},PS:{icon:bx,label:"Palestinian Territory"},PA:{icon:_x,label:"Panama"},PG:{icon:xx,label:"Papua New Guinea"},PY:{icon:fx,label:"Paraguay"},PE:{icon:mx,label:"Peru"},PH:{icon:gx,label:"Philippines"},PN:{icon:hx,label:"Pitcairn"},PL:{icon:px,label:"Poland"},PT:{icon:ux,label:"Portugal"},PR:{icon:dx,label:"Puerto Rico"},QA:{icon:cx,label:"Qatar"},RO:{icon:lx,label:"Romania"},RU:{icon:ox,label:"Russia"},RW:{icon:ix,label:"Rwanda"},KN:{icon:rx,label:"Saint Kitts and Nevis"},LC:{icon:ax,label:"Saint Lucia"},WS:{icon:nx,label:"Samoa"},SM:{icon:sx,label:"San Marino"},ST:{icon:tx,label:"Sao Tome and Principe"},SA:{icon:ex,label:"Saudi Arabia"},SN:{icon:$f,label:"Senegal"},RS:{icon:Jf,label:"Serbia"},SC:{icon:Xf,label:"Seychelles"},SL:{icon:Zf,label:"Sierra Leone"},SG:{icon:qf,label:"Singapore"},SX:{icon:Qf,label:"Sint Maarten"},SK:{icon:Kf,label:"Slovakia"},SI:{icon:zf,label:"Slovenia"}
1090,SB:{icon:Yf,label:"Solomon Islands"},SO:{icon:Vf,label:"Somalia"},ZA:{icon:Wf,label:"South Africa"},SS:{icon:Gf,label:"South Sudan"},ES:{icon:Hf,label:"Spain"},LK:{icon:Bf,label:"Sri Lanka"},SD:{icon:Ff,label:"Sudan"},SR:{icon:Uf,label:"Suriname"},SZ:{icon:Mf,label:"Swaziland"},SE:{icon:Lf,label:"Sweden"},CH:{icon:Df,label:"Switzerland"},SY:{icon:Of,label:"Syria"},TW:{icon:Nf,label:"Taiwan"},TJ:{icon:wf,label:"Tajikistan"},TZ:{icon:kf,label:"Tanzania"},TH:{icon:Rf,label:"Thailand"},TG:{icon:If,label:"Togo"},TK:{icon:Pf,label:"Tokelau"},TO:{icon:Tf,label:"Tonga"},TT:{icon:Ef,label:"Trinidad and Tobago"},TN:{icon:jf,label:"Tunisia"},TR:{icon:Sf,label:"Turkey"},TM:{icon:Af,label:"Turkmenistan"},TC:{icon:vf,label:"Turks and Caicos Islands"},TV:{icon:Cf,label:"Tuvalu"},UG:{icon:yf,label:"Uganda"},UA:{icon:bf,label:"Ukraine"},AE:{icon:_f,label:"United Arab Emirates"},UK:{icon:hc,label:"United Kingdom"},GB:{icon:hc,label:"United Kingdom"},US:{icon:xf,label:"United States"},UY:{icon:ff,label:"Uruguay"},UZ:{icon:mf,label:"Uzbekistan"},VU:{icon:gf,label:"Vanuatu"},VE:{icon:hf,label:"Venezuela, Bolivarian Republic of"},VN:{icon:pf,label:"Viet Nam"},VI:{icon:uf,label:"Virgin Islands"},YE:{icon:df,label:"Yemen"},ZM:{icon:cf,label:"Zambia"},ZW:{icon:lf,label:"Zimbabwe"},AC:{icon:of,label:"Ascension Island"},AX:{icon:rf,label:"Ã
land Islands"},BL:{icon:af,label:"Saint Barthélemy"},BN:{icon:nf,label:"Brunei Darussalam"},BQ:{icon:sf,label:"Bonaire, Sint Eustatius and Saba"},CC:{icon:tf,label:"Cocos (Keeling) Islands"},CX:{icon:ef,label:"Christmas Island"},EH:{icon:$m,label:"Western Sahara"},GF:{icon:Jm,label:"French Guiana"},GP:{icon:Xm,label:"Guadeloupe"},GY:{icon:Zm,label:"Guyana"},MF:{icon:qm,label:"Saint Martin (French Part)"},NC:{icon:Qm,label:"New Caledonia"},PM:{icon:Km,label:"Saint Pierre and Miquelon"},RE:{icon:zm,label:"Reunion"},SH:{icon:Ym,label:"Saint Helena"},SJ:{icon:Vm,label:"Svalbard and Jan Mayen"},TA:{icon:Wm,label:"Tristan da Cunha"},TL:{icon:Gm,label:"Timor-Leste"},VA:{icon:Hm,label:"Holy See (Vatican City State)"},VC:{icon:Bm,label:"Saint Vincent and the Grenadines"},VG:{icon:Fm,label:"Virgin Islands, British"},WF:{icon:Um,label:"Wallis and Futuna"},XK:{icon:Mm,label:"Kosovo"},YT:{icon:Lm,label:"Mayotte"}},yw=t=>{const s=[];return t.length&&Object.keys(Zt).forEach(n=>{t.find(r=>r.toUpperCase()===n)&&s.push({value:Zt[n].label,icon:Zt[n].icon,id:n})}),s},Lv=t=>{let s="";if(t&&t!==""){const n=t.split(" ");n&&n.length>0&&(n.length<=1?s=n[0].substring(0,1):s=n[n.length-2].substring(0,1)+n[n.length-1].substring(0,1))}return s!==""&&(s=s.toUpperCase()),s},lr=t=>{const{country:s,shortName:n=!1,showName:a=!0,fontSize:r=14,hiddenName:o=!1,className:l="",showCountryCode:c=!1,renderCountry:u,removeMarginRight:d=!1,...g}=t;let h=s;if(s==="GB"&&(h="UK"),!h||!Zt[h])return e.jsx(e.Fragment,{});let p=Zt[h].label;const x=Zt[h].icon;return n&&(p=Lv(p)),a||(p=`${p[0]}${Array.from({length:p.length-2},(f,_)=>_).map(()=>"*").join("")}${p[p.length-1]}`),s==="GB"?p+=" (GB)":s==="UK"&&(p+=" (UK)"),e.jsxs("span",{className:"flag-icon msui-flex msui-flex-align-items-center "+l,...g,children:[e.jsx(ee.Custom,{icon:x,style:{marginRight:!o&&!d?"8px":"0px"},iconProps:{width:r}})," ",!o&&(u?u(p):e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:p})),c&&e.jsxs(e.Fragment,{children:[" ",h]})]})},Mv={padding:{left:0,right:0,top:0,bottom:0}};Up.register(...Fp);let Wr;Oe.memo(t=>{const{chartData:s={labels:[],datasets:[]},width:n="300px",height:a="300px",optionsLayout:r=Mv,optionTooltip:o={},optionLegend:l={}}=t,c=Oe.useRef(null),u=x=>{const f=x.labels,_=x.datasets;return Wr&&_.forEach(b=>{b.backgroundColor=Wr}),{labels:f,datasets:_}},d=(x,f)=>{if(!f.hidden){for(let _=0;_<c.current.data.datasets.length;_++){const b=c.current.data.datasets[_];_===f.datasetIndex?b.borderColor=b.borderDefault:b.borderColor=b.borderColorHoverLegend}c.current.update()}},g=()=>{for(let x=0;x<c.current.data.datasets.length;x++){const f=c.current.data.datasets[x];f.borderColor=f.borderDefault}c.current.update()},h=(x,f)=>{for(let _=0;_<c.current.data.datasets.length;_++){const b=c.current.data.datasets[_];_===f.datasetIndex?b.hidden=!f.hidden:b.borderColor=b.borderDefault}
1090c.current.update()},p=x=>{if(!x)return;const f=x.getContext("2d");if(f&&!c.current){const _=at.cloneDeep(s).labels,b=at.cloneDeep(s).datasets??[],v=f.createLinearGradient(0,0,0,300);v.addColorStop(0,E0[600]),v.addColorStop(.8961,"rgba(255, 255, 255, 0)"),Wr=v,b.forEach(C=>{C.backgroundColor=Wr});const y={type:"line",data:{labels:_,datasets:b},options:{maintainAspectRatio:!0,layout:r,animations:{radius:{duration:400,easing:"linear",loop:C=>C.active}},interaction:{mode:"nearest",intersect:!1,axis:"x"},plugins:{tooltip:{usePointStyle:!0,caretPadding:20,boxHeight:5,position:"nearest",callbacks:{title:()=>""},enabled:!0,displayColors:!1,...o},legend:{display:!1,position:"bottom",labels:{color:"#262626",boxWidth:12,padding:40},onHover:d,onLeave:g,onClick:h,...l}},showLine:!0,responsive:!0,scales:{x:{display:!0,grid:{display:!1},ticks:{source:"data",maxRotation:0,minRotation:0,autoSkip:!0,stepSize:1,callback:(C,S)=>{const j=c.current?.data?.labels||[],A=c.current?.data?.datasets||[];let E=["0"];if(j?.length>0){const k=it(j[S],tc).format("HH:mm");E=[it(j[S],tc).format("MMM DD"),k]}const T=A&&A[0]&&A[0].data?.length>0?A[0].data?.length:0;return T0(T-1,E,S)}}},y:{min:0,grid:{drawBorder:!1,lineWidth:1,tickColor:"transparent"},ticks:{beginAtZero:!0,callback:C=>{let S=C;
1090if(q.isNumber(S)){if(C>1e8){const j=S/1e9;S=`${Math.abs(j)} B`}else if(C>1e5){const j=S/1e6;S=`${Math.abs(j)} M`}}return S}}}}}};c.current=new op(f,y)}};return Oe.useEffect(()=>(c.current&&(c.current.data=u(at.cloneDeep(s)),c.current.update()),()=>c.current.destroy()),[s,s?.datasets,s?.labels]),e.jsx("canvas",{style:{width:n,height:a},ref:p})},(t,s)=>JSON.stringify(t?.chartData)===JSON.stringify(s?.chartData));Up.register(...Fp);Oe.memo(t=>{const{hiddenLegend:s=!0,renderTooltip:n,chartData:a={labels:["Red","Blue","Yellow"],datasets:[{label:"My First Dataset",data:[300,50,100],backgroundColor:["rgb(255, 99, 132)","rgb(54, 162, 235)","rgb(255, 205, 86)"],hoverOffset:4}]},width:r="300px",height:o="300px"}=t,l=d=>{const g=d.labels,h=d.datasets;return{labels:g,datasets:h}},c=Oe.useRef(null),u=d=>{if(!d)return;const g=d.getContext("2d");if(g&&!c.current){const h=q.cloneDeep(a).labels,p=q.cloneDeep(a).datasets,x={type:"doughnut",data:{labels:h,datasets:p},options:{plugins:{legend:{display:s,position:"bottom",reverse:!0,borderRadius:"50%"},tooltip:{enabled:!0,displayColors:!1,callbacks:{title:()=>"",label:f=>{const _=f.dataset.data[f.dataIndex]||"";return n?n(f.dataIndex,_):_+""},afterBody:f=>""}}
1090},responsive:!0,maintainAspectRatio:!1,scales:{y:{display:!1,ticks:{display:!1}},x:{display:!1,ticks:{display:!1}}}}};c.current=new op(g,x)}};return Oe.useEffect(()=>{c.current&&(c.current.data=l(q.cloneDeep(a)),c.current.update())},[a]),e.jsx("canvas",{style:{width:r,height:o},ref:u})},(t,s)=>!!(t?.chartData&&s?.chartData&&JSON.stringify(t?.chartData)===JSON.stringify(s?.chartData)));const Uv=i.forwardRef(({src:t,height:s="100%",width:n="100%",style:a,className:r="",...o},l)=>{const c=i.useRef(null),[u,d]=i.useState(!1),[g,h]=i.useState(!1);i.useEffect(()=>{const x=new IntersectionObserver(([f])=>{f.isIntersecting&&(d(!0),x.disconnect())},{rootMargin:"0px 0px 200px 0px"});return c.current&&(x.observe(c.current),c.current&&x.takeRecords().some(f=>f.isIntersecting)&&(d(!0),x.disconnect())),()=>{c.current&&(x.unobserve(c.current),d(!1))}},[c,d]);const p=()=>{h(!0)};return i.useEffect(()=>{const x=c.current;if(x)return x.complete?p():x.addEventListener("load",p),()=>{x.removeEventListener("load",p)}},[]),e.jsx("img",{referrerPolicy:"no-referrer",style:{height:s,width:"100%",objectFit:"contain",...a},ref:c,src:u&&g?t:void 0,"data-src":t,onError:sr,alt:"",...o})}),Cw=se.div` 1091 display: grid; 1092 grid-template-columns: ${({imageSize:t})=>`repeat(auto-fill, minmax(${t}px, 0fr))`}; 1093 gap: ${({imageGap:t})=>`${t}px`}; 1094 1095 img { 1096 cursor: pointer; 1097 border-radius: 6px; 1098 object-fit: cover; 1099 border: 1px solid var(--p-border-subdued); 1100 } 1101 .image-see-more { 1102 cursor: pointer; 1103 1104 &.ant-image { 1105 position: relative; 1106 display: inline-block; 1107 } 1108 .ant-image-mask { 1109 background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(image.png); 1110 opacity: 1; 1111 border-radius: 6px; 1112 position: absolute; 1113 top: 0; 1114 right: 0; 1115 bottom: 0; 1116 left: 0; 1117 display: flex; 1118 align-items: center; 1119 justify-content: center; 1120 color: #fff; 1121 background: rgba(0, 0, 0, 0.5); 1122 background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(image.png); 1123 opacity: 1; 1124 border-radius: 6px; 1125 .ant-image-mask-info { 1126 padding: 0 4px; 1127 overflow: hidden; 1128 white-space: nowrap; 1129 text-overflow: ellipsis; 1130 } 1131 1132 .ant-image-mask-info span { 1133 color: ${({theme:t})=>` ${t.palette.common.white}} `}; 1134 } 1135 } 1136 } 1137 1138 &.listing-images { 1139 img.active { 1140 border: 1px solid var(--p-color-bg-fill-brand-active); 1141 } 1142 } 1143`,Fv=ae({key:"trendingKeywordState",default:[]}),Bv=ae({key:"categoryState",default:[]});ae({key:"cashbackState",default:{}});ae({key:"imageVariantState",default:{url:""}});const Hv=ae({key:"loadingImportAllNichesState",default:!1}),Il=ae({key:"productCatalogShipToState",default:"US"});se.div` 1144 &.product-gallery-detail { 1145 width: 100%; 1146 1147 .product-thumbnail { 1148 width: 100%; 1149 overflow: hidden; 1150 position: relative; 1151 .image-variant { 1152 width: 100%; 1153 height: auto; 1154 display: flex; 1155 -webkit-box-align: center; 1156 align-items: center; 1157 -webkit-box-pack: center; 1158 justify-content: center; 1159 background-size: cover; 1160 background-position: center center; 1161 background-repeat: no-repeat; 1162 border: 1px solid rgb(226, 228, 229); 1163 border-radius: 6px; 1164 } 1165 1166 .button-play { 1167 position: absolute; 1168 width: 40px !important; 1169 height: 40px !important; 1170 cursor: pointer; 1171 border-radius: 50% !important; 1172 background: #eaeaea; 1173 top: 50%; 1174 left: 50%; 1175 transform: translate(-50%, -50%); 1176 display: flex; 1177 justify-content: center; 1178 align-items: center; 1179 } 1180 1181 .swiper-wrapper { 1182 /* max-height: 432px; 1183 min-height: 319px; 1184 height: fit-content; */ 1185 } 1186 /* .swiper { 1187 width: 100%; 1188 } */ 1189 } 1190 .gallery-thumbnail { 1191 margin-top: 12px; 1192 position: relative; 1193 1194 .button-play { 1195 position: absolute; 1196 width: 20px !important; 1197 height: 20px !important; 1198 cursor: pointer; 1199 border-radius: 50% !important; 1200 background: #eaeaea; 1201 top: 50%; 1202 left: 50%; 1203 transform: translate(-50%, -50%); 1204 } 1205 1206 .swiper { 1207 height: 64px; 1208 width: 100%; 1209 .swiper-slide { 1210 border-radius: var(--p-border-radius-100); 1211 img { 1212 border-radius: var(--p-border-radius-100); 1213 } 1214 &.swiper-slide-thumb-active { 1215 border: 1px solid var(--p-color-bg-fill-brand-active); 1216 } 1217 } 1218 } 1219 } 1220 } 1221 1222 /* .product-thumbnail .swiper-slide div,
1223 .gallery-thumbnail .swiper-slide div { 1224 width: 100%; 1225 height: 100%; 1226 display: flex; 1227 align-items: center; 1228 justify-content: center; 1229 background-size: cover; 1230 background-position: center; 1231 background-repeat: no-repeat; 1232 border: solid 1px #e2e4e5; 1233 border-radius: 6px; 1234 } */ 1235`;ae({key:"openModalTrial",default:!1});se.div` 1236 .Polaris-Icon { 1237 height: 60px !important; 1238 width: 60px !important; 1239 } 1240`;se.div` 1241 &.hidden-box-shadown { 1242 .Polaris-LegacyCard { 1243 box-shadow: none; 1244 outline: none; 1245 } 1246 } 1247 1248 .Polaris-LegacyCard { 1249 height: ${({height:t})=>`${t}px !important`}; 1250 } 1251 &.placement-center { 1252 .Polaris-LegacyCard { 1253 display: flex; 1254 justify-content: center; 1255 align-items: center; 1256 } 1257 } 1258 1259 .logo-default { 1260 .Polaris-Icon { 1261 width: 60px; 1262 height: 60px; 1263 svg { 1264 fill: var(--p-icon-disabled); 1265 } 1266 } 1267 } 1268`;se.div` 1269 position: relative; 1270 min-height: 100px; 1271 overflow: hidden; 1272 1273 .content-blur { 1274 position: absolute; 1275 top: 50%; 1276 left: 50%; 1277 transform: translate(-50%, -50%); 1278 z-index: 2; 1279 background: transparent; 1280 width: 100%; 1281 text-align: center; 1282 padding: 0px 10px; 1283 .logo { 1284 height: 60px; 1285 .Polaris-Icon { 1286 height: 60px; 1287 width: 60px; 1288 } 1289 } 1290 } 1291 .children { 1292 /* filter: blur(10px); */ 1293 /* -webkit-filter: blur(10px); */ 1294 height: 100%; 1295 pointer-events: none; 1296 &:after { 1297 content: ''; 1298 position: absolute; 1299 top: 0; 1300 left: 0; 1301 right: 0; 1302 bottom: 0; 1303 background: rgba(255, 255, 255, 0.5); 1304 } 1305 } 1306`;ae({key:"visibleBannerWarning",default:[]});ae({key:"keyFeatureState",default:[]});const Gv=(t,s={outputType:"dataURL",mimeType:"image/webp",quality:1})=>new Promise(n=>{switch(s.outputType){case"file":t.toBlob(a=>{n(a)});break;default:n(t.toDataURL("image/jpeg",.8));break}}),Wv=(t,s)=>new Promise(async n=>{const{outputType:a="dataURL",mimeType:r="image/webp",quality:o=1,maxWidth:l=300,maxHeight:c=300}=s||{};let u=t;const d=new Image;if(d.referrerPolicy="no-referrer",typeof t=="string"){const h=await(await fetch(t)).blob();u=new File([h],"image-product-"+new Date,{type:r})}const g=window.URL.createObjectURL(u);d.onload=()=>{const h=document.getElementById("canvas-image");h&&h.remove();let p=d.width,x=d.height;p>x?p>l&&(x=Math.round(x*=l/p),p=l):x>c&&(p=Math.round(p*=c/x),x=c),s?.width&&(p=s.width),s?.height&&(x=s.height);const f=document.createElement("canvas");f.id="canvas-image",f.width=s?.width||p,f.height=s?.height||x,f.getContext("2d")?.drawImage(d,0,0,p,x),Gv(f,{outputType:a}).then(_=>{s?.outputType==="file"?n(new File([_],"image-product-"+new Date().getTime(),{type:r})):n(_)})},d.onerror=h=>{console.log("Error loading image. Retrying with fallback:",h),n(null)},d.src=g}),Vv=Math.PI/180;function Yv(t,s,n,a=1,r=0){const o=s.getContext("2d");if(!o)throw new Error("No 2d context");const l=t.naturalWidth/t.width,c=t.naturalHeight/t.height,u=window.devicePixelRatio;s.width=Math.floor(n.width*l*u),s.height=Math.floor(n.height*c*u),o.scale(u,u),o.imageSmoothingQuality="high";const d=n.x*l,g=n.y*c,h=r*Vv,p=t.naturalWidth/2,x=t.naturalHeight/2;o.save(),o.translate(-d,-g),o.translate(p,x),o.rotate(h),o.scale(a,a),o.translate(-p,-x),o.drawImage(t,0,0,t.naturalWidth,t.naturalHeight,0,0,t.naturalWidth,t.naturalHeight),o.restore()}function zv(t,s,n){i.useEffect(()=>{const a=setTimeout(()=>{t(n)},s);return()=>{clearTimeout(a)}},n)}function Kv(t,s,n){return Pm(Im({unit:"%",width:90},n,t,s),t,s)}const vw=({dataFile:t,heightCropper:s="100%",onChange:n})=>{i.useEffect(()=>{P0(()=>Me(()=>import("./module-CeFpPFS8.js").then(T=>T.R),__vite__mapDeps([0,1,2,3,4])),"react-image-crop")},[]);const[a,r]=i.useState(""),o=i.useRef(null),l=i.useRef(null),c=i.useRef(null),[u,d]=i.useState(),[g,h]=i.useState(),[p,x]=i.useState(1),[f,_]=i.useState(0),[b,v]=i.useState(null),[y,C]=i.useState(16/9),S=(T,k)=>{if(T){d(k||void 0);const O=new FileReader;O.addEventListener("load",()=>r(O.result?.toString()||"")),O.readAsDataURL(T)}};function j(T){if(y&&!t?.cropper){const{width:k,height:O}=T.currentTarget;d(Kv(k,O,y))}}function A(){if(!o.current)throw new Error("Crop canvas does not exist");o.current.toBlob(async T=>
1306{if(!T)throw new Error("Failed to create blob");const k=await Wv(T,{width:g?.width??100,height:g?.height??100,mimeType:"image/webp",quality:.8,outputType:"dataURL"});n&&n(k,g)})}zv(()=>{g?.width&&g?.height&&l.current&&o.current&&(o.current.width=g?.width,o.current.height=g?.height,Yv(l.current,o.current,g,p,f),A())},1e3,[g,p,f]),i.useEffect(()=>{a&&l.current&&q.size(t)&&setTimeout(()=>{const T=q.cloneDeep(l.current?.width??100),k=q.cloneDeep(l.current?.height??100),O=q.cloneDeep(T)*96/100,R=q.cloneDeep(k)*96/100,P=q.cloneDeep(T)*2/100,w=q.cloneDeep(k)*2/100;C(void 0);const N={unit:"px",x:P,y:w,width:O,height:R};d(t?.cropper??N),h(t?.cropper??N)},200)},[a,t?.file]);const E=()=>{q.size(t)&&t?.file&&S(t?.file,t.cropper)};return i.useEffect(()=>{E()},[t?.file]),e.jsxs(Qv,{style:{height:"100%"},children:[!!a&&e.jsxs("div",{style:{width:"100%",height:"100%"},className:"msui-flex-center",children:[e.jsx(Tm,{crop:u,onChange:(T,k)=>{d(k)},onComplete:T=>{const k={...T};T.width<1&&T.height<1&&(k.width=100,k.height=100),d(k),h(k)},aspect:y,children:e.jsx("img",{ref:l,alt:"Crop me",src:a,style:{objectFit:"contain",transform:`scale(${p}) rotate(${f}deg)`,maxHeight:s},onLoad:j})})," "]}),!!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsx("canvas",{ref:o,style:{border:"1px solid black",objectFit:"contain",width:g?.width,height:g?.height,display:"none"}})}),e.jsxs("div",{children:[e.jsx("button",{style:{display:"none"},onClick:A,children:"Download Crop"}),e.jsx("a",{ref:c,download:!0,style:{position:"absolute",top:"-200vh",visibility:"hidden",display:"none"},children:"Hidden download"})]})]})]})},Qv=se.div` 1307 .ReactCrop__crop-selection { 1308 background-image: none !important; 1309 border-radius: 8px; /* Custom border radius */ 1310 box-shadow: 0 0 0 9999em rgba(0, 0, 0, 0.5); 1311 } 1312 1313 .ReactCrop .ord-nw:after { 1314 top: 4px; 1315 left: 4px; 1316 } 1317 .ReactCrop .ord-ne:after { 1318 top: 4px; 1319 right: 4px; 1320 } 1321 .ReactCrop .ord-sw:after { 1322 bottom: 4px; 1323 left: 4px; 1324 } 1325 1326 .ReactCrop .ord-se:after { 1327 bottom: 4px; 1328 right: 4px; 1329 } 1330 1331 .ReactCrop__drag-handle[data-ord='nw'], 1332 .ReactCrop__drag-handle[data-ord='ne'], 1333 .ReactCrop__drag-handle[data-ord='se'], 1334 .ReactCrop__drag-handle[data-ord='sw'] { 1335 &::after { 1336 position: absolute; 1337 content: ''; 1338 display: block; 1339 width: 20px; 1340 height: 20px; 1341 background-color: transparent; 1342 outline: transparent solid 1px; 1343 border-width: 3px; 1344 border-color: rgb(255, 255, 255); 1345 } 1346 } 1347 1348 .ReactCrop__drag-handle[data-ord='nw']::after { 1349 border-top-left-radius: 8px; 1350 border-bottom-right-radius: 8px; 1351 border-right: none; 1352 border-bottom: none; 1353 } 1354 1355 .ReactCrop__drag-handle[data-ord='ne']::after { 1356 border-top-right-radius: 8px; 1357 border-left: none; 1358 border-bottom: none; 1359 } 1360 .ReactCrop__drag-handle[data-ord='se']::after { 1361 border-top-left-radius: 8px; 1362 border-bottom-right-radius: 8px; 1363 border-top: none; 1364 border-left: none; 1365 } 1366 .ReactCrop__drag-handle[data-ord='sw']::after { 1367 border-bottom-left-radius: 8px; 1368 border-top: none; 1369 border-right: none; 1370 } 1371 1372 .ReactCrop__drag-handle[data-ord='n'], 1373 .ReactCrop__drag-handle[data-ord='e'], 1374 .ReactCrop__drag-handle[data-ord='s'], 1375 .ReactCrop__drag-handle[data-ord='w'] { 1376 display: none; 1377 } 1378`,qv=se.div` 1379 position: relative; 1380 overflow: hidden; 1381 background-color: rgba(22, 24, 35, 0.06); 1382 background-size: cover; 1383 background-repeat: no-repeat; 1384 background-position: center center; 1385 display: flex; 1386 align-items: center; 1387 justify-content: center; 1388 padding-bottom: 100%; 1389 1390 & .img-poster { 1391 border-top-left-radius: 8px; 1392 border-top-right-radius: 8px; 1393 position: absolute; 1394 inset: 0px; 1395 width: 100%; 1396 object-fit: cover; 1397 } 1398 & .video-background { 1399 transform: scale(1.06); 1400 } 1401 & .video-wrapper { 1402 position: absolute; 1403 inset: 0px; 1404 width: 100%; 1405 & > video { 1406 display: block; 1407 width: 100%; 1408 height: 100%; 1409 object-fit: contain; 1410 } 1411 } 1412 & .--play-icon { 1413 position: absolute; 1414 top: 50%; 1415 left: 50%; 1416 transform: translate(-50%, -50%); 1417 display: flex; 1418 align-items: center; 1419 justify-content: center; 1420 width: 40px; 1421 height: 40px; 1422 opacity: 0.8; 1423 border-radius: 50%; 1424 background: rgba(0, 0, 0, 0.7); 1425 color: #fff; 1426 font-size: 24px; 1427 .Polaris-Icon svg { 1428 fill: #fff; 1429 } 1430 } 1431 & .loading { 1432 position: absolute; 1433 top: 50%; 1434 left: 50%; 1435 transform: translate(-50%, -50%); 1436 display: flex; 1437 align-items: center; 1438 justify-content: center; 1439 } 1440 .Polaris-Spinner, 1441 svg { 1442 width: 40px; 1443 height: 40px; 1444 } 1445`,Aw=t=>{const{hovered:s=!0,src:n,isPlay:a,thumbnail:r,height:o=388,width:l=388,delayPlayVideo:c=3e3,isExpertsChoiceProduct:u=!1,styled:d={}
1445,muted:g=!0,isShowMuted:h=!1,onThumbnailLoad:p,onThumbnailError:x}=t,[f,_]=i.useState(""),[b,v]=i.useState(!1),[y,C]=i.useState(!1),S=i.useRef(null),j=i.useRef(null),A=i.useRef(null),[E,T]=i.useState(g);i.useEffect(()=>(k(),a&&u?S.current=setTimeout(()=>{v(!0)},c):(k(),v(!1)),()=>{k()}),[a,u]),i.useEffect(()=>{s||(a?v(!0):(v(!1),C(!1)))},[a,s]);const k=()=>{S?.current&&clearTimeout(S.current)},O=P=>{const{code:w=0}=P?.currentTarget?.error??{};switch(C(!0),w){case 1:_("error_video_code_1");break;case 2:_("error_video_code_2");break;case 3:_("error_video_code_3");break;case 4:_("error_video_code_4");break;default:_("error_video_unknown");break}},R=()=>{A?.current&&j.current&&(A.current.currentTime=j.current?.currentTime)};return e.jsxs(qv,{height:o,width:l,onMouseEnter:()=>{s&&v(!0)},onMouseLeave:()=>{s&&(v(!1),C(!1))},style:d,className:"video-wrapper-parent",children:[e.jsx("img",{className:"img-poster image-main",src:r,alt:"handpick-thumbnail",referrerPolicy:"no-referrer",onError:P=>{x?.(),sr(P)},onLoad:()=>{p?.()}}),h?e.jsx(Zv,{onClick:P=>{P.stopPropagation(),T(!E)},children:E?e.jsx("span",{className:"Polaris-Icon",children:e.jsx("svg",{viewBox:"0 0 20 20",className:"Polaris-Icon__Svg",focusable:"false","aria-hidden":"true",children:e.jsx("path",{d:"M8.866 4.324c.788-.788 2.134-.23 2.134.884v9.585c0 1.114-1.346 1.672-2.134.884l-2.603-2.603a.25.25 0 0 0-.177-.073h-1.336a1.75 1.75 0 0 1-1.75-1.75v-2.5c0-.967.784-1.75 1.75-1.75h1.336a.25.25 0 0 0 .177-.074l2.603-2.603Zm.634 1.487-2.177 2.177a1.75 1.75 0 0 1-1.237.512h-1.336a.25.25 0 0 0-.25.25v2.5c0 .139.112.25.25.25h1.336c.464 0 .909.185 1.237.513l2.177 2.177v-8.379Z"})})}):e.jsx(ee,{source:Rg})}):e.jsx(e.Fragment,{}),b?e.jsxs(e.Fragment,{children:[e.jsx("video",{muted:!0,ref:A,className:"video-background img-poster",style:{filter:`blur(${b?"6px":"0px"})`,height:"100%"},preload:"auto",autoPlay:!0,playsInline:!0,src:n}),e.jsx("div",{className:"video-wrapper",children:e.jsx("video",{muted:E,controlsList:"nodownload",preload:"auto",autoPlay:!0,onEnded:()=>v(!1),playsInline:!0,onTimeUpdate:R,onError:O,onLoadedMetadata:()=>C(!0),ref:j,src:n})})]}):"",e.jsxs("div",{className:"--play-icon",style:{display:b?"none":"flex"},children:[e.jsx("span",{children:e.jsx(ee,{source:kg})}),f?e.jsx(m,{variant:"headingSm",fontWeight:"regular",as:"span",children:f}):""]}),b&&!y&&e.jsx("div",{className:"loading",children:e.jsx(nn,{})})]})},Zv=se.div` 1446 position: absolute; 1447 bottom: 5%; 1448 right: 5%; 1449 z-index: 1; 1450 background: rgba(255, 255, 255, 0.5); 1451 border-radius: var(--p-border-radius-300); 1452 height: 24px; 1453 width: 24px; 1454 display: flex; 1455 justify-content: center; 1456 align-items: center; 1457`;se.div` 1458 display: inline-flex; 1459 /* color: ${I0[500]}; */ 1460`;se.div``;const Xv="_ahCountDownWrap_9kgm6_1",Jv="_ahCountDown_9kgm6_1",hd={ahCountDownWrap:Xv,ahCountDown:Jv},$v=t=>{const{onEndCountDown:s,endTime:n,style:a={},className:r="",showDay:o=!1}=t,[l,c]=Oe.useState(0),[u,d]=Oe.useState(0),[g,h]=Oe.useState(0),[p,x]=Oe.useState(0),f="YYYY-MM-DD HH:mm:ss";return Oe.useEffect(()=>{if(n){const _=it(n,f).format(f),b=new Date(_).valueOf(),v=setInterval(()=>{const y=it().valueOf(),C=b-y;if(C>=0){const S=Math.floor(C/864e5),j=Math.floor(C%(1e3*60*60*24)/(1e3*60*60)),A=Math.floor(C%(1e3*60*60)/(1e3*60)),E=Math.floor(C%(1e3*60)/1e3);j===0&&A===0&&E===0&&s&&s(),d(j),h(A),x(E),c(S)}else d(0),h(0),x(0),c(0)},1e3);return()=>{clearInterval(v)}}},[n]),e.jsx("span",{className:`${hd.ahCountDownWrap} ${r}`,style:a,children:e.jsxs("span",{className:hd.ahCountDown,children:[o&&e.jsxs("span",{className:"days",style:{marginRight:2},children:[l<10?"0"+l:l,"d",e.jsx("span",{style:{margin:"0 4px"},children:":"})]}),e.jsxs("span",{className:"hour",children:[u<10?"0"+u:u,"h"]}),e.jsx("span",{style:{margin:"0 4px"},children:":"}),e.jsxs("span",{className:"minute",children:[g<10?"0"+g:g,"m"]}),e.jsx("span",{style:{margin:"0 4px"},children:":"}),e.jsxs("span",{className:"second",children:[p<10?"0"+p:p,"s"]})]})})},Sw=se.div` 1461 .popup { 1462 margin-top: var(--p-space-200); 1463 position: absolute; 1464 width: 100%; 1465 top: 100%; 1466 left: 0; 1467 z-index: 172; 1468 -webkit-transition: all 0.2s cubic-bezier(0.075, 0.82, 0.165, 1); 1469 transition: all 0.2s cubic-bezier(0.075, 0.82, 0.165, 1); 1470 -webkit-box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.2); 1471 box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.2); 1472 background-color: #fff; 1473 border-radius: var(--p-border-radius-300); 1474 overflow: hidden; 1475 background-color: #fff; 1476 overflow: hidden; 1477 } 1478`,jw=se.div` 1479 ${({isMobile:t})=>t?Ps` 1480 .Polaris-TextField__Backdrop { 1481 border-color: var(--p-color-bg-fill-active); 1482 background: var(--p-color-bg-fill-active); 1483 } 1484 input { 1485 touch-action: manipulation; 1486 -webkit-text-size-adjust: 100%; 1487 text-size-adjust: 100%; 1488 } 1489 `:Ps``} 1490`,Ew=se.div` 1491 li { 1492 color: red; 1493 .remove { 1494 visibility: hidden; 1495 opacity: 0; 1496 transition: all 0.2s cubic-bezier(0.075, 0.82, 0.165, 1); 1497 svg { 1498 fill: ${t=>`var(${t.color})`}; 1499 } 1500 } 1501 &:hover .remove { 1502 visibility: visible; 1503 opacity: 1; 1504 } 1505 } 1506 1507 .Polaris-ActionList__Item { 1508 color: ${t=>`var(${t.tone})`}; 1509 svg { 1510 fill: ${t=>`var(${t.tone})`}; 1511 } 1512 } 1513 1514 .Polaris-Text--root.Polaris-Text--bodyMd span span { 1515 font-weight: 400; 1516 } 1517`;se.div` 1518 .timer-char { 1519 height: 24px; 1520 position: relative; 1521 text-align: center; 1522 width: 15px; 1523 overflow: hidden; 1524 1525 &.colon { 1526 color: white; 1527 font-size: 24px; 1528 line-height: 24px; 1529 } 1530 1531 .timer-char-slider { 1532 display: flex; 1533 flex-direction: column; 1534 left: 0px; 1535 position: absolute; 1536 top: 0px; 1537 transition: top 700ms; 1538 width: 15px; 1539
1540 .timer-char-slider-option { 1541 color: white; 1542 font-size: 24px; 1543 height: 24px; 1544 line-height: 24px; 1545 opacity: 0.05; 1546 transition: 1547 opacity 700ms, 1548 font-size 700ms; 1549 width: 15px; 1550 opacity: 0; 1551 visibility: hidden; 1552 font-weight: 700; 1553 1554 &.active { 1555 font-size: 24px; 1556 opacity: 1; 1557 visibility: visible; 1558 } 1559 } 1560 } 1561 } 1562`;const Tw=se.div` 1563 overflow: hidden; 1564 background-color: #fff; 1565 border-radius: var(--p-border-radius-200); 1566 position: relative; 1567`,Pw=se.div` 1568 width: 100%; 1569 height: 0; 1570 padding-bottom: 100%; 1571 position: relative; 1572`,Iw=se.img` 1573 position: absolute; 1574 top: 0; 1575 left: 0; 1576 width: 100%; 1577 height: 100%; 1578 object-fit: cover; 1579 opacity: ${t=>t.loaded==="true"?0:1}; 1580 transition: opacity 0.3s ease-in-out; 1581 border-radius: 6px; 1582`,eA=se(Uv)` 1583 position: absolute; 1584 top: 0; 1585 left: 0; 1586 width: 100%; 1587 height: 100%; 1588 object-fit: cover; 1589 border-radius: 6px; 1590 transition: 1591 opacity 0.3s ease-in-out, 1592 transform 0.3s ease-in-out; 1593 opacity: ${t=>t.loaded==="true"?1:0}; 1594 transform: scale(${t=>t.loaded==="true"?1:.95}); 1595`;se.img` 1596 position: absolute; 1597 top: 0; 1598 left: 0; 1599 width: 100%; 1600 height: 100%; 1601 object-fit: cover; 1602 border-radius: 6px; 1603 transition: 1604 opacity 0.3s ease-in-out, 1605 transform 0.3s ease-in-out; 1606 &.loading { 1607 opacity: 0.7; 1608 } 1609`;se.div` 1610 position: absolute; 1611 top: 0; 1612 bottom: 0; 1613 cursor: pointer; 1614 opacity: 0; 1615 z-index: 1; 1616 &:hover + ${eA} { 1617 transform: scale(1.05); 1618 } 1619`;const Rw=se.div` 1620 position: absolute; 1621 bottom: 10px; 1622 display: flex; 1623 gap: 5px; 1624 position: absolute; 1625 left: 50%; 1626 transform: translateX(-50%); 1627`,kw=se.div` 1628 width: 5px; 1629 height: 5px; 1630 background-color: ${t=>t.active?"rgba(53, 35, 20, 1)":"#fff"}; 1631 border-radius: 50%; 1632 transition: background-color 0.2s ease-in-out; 1633`,ww=se.div` 1634 .img-poster, 1635 video, 1636 .video-wrapper video { 1637 border-radius: var(--p-border-radius-200); 1638 height: 100%; 1639 } 1640`,pn=({isBoxShadow:t=!0,isSize:s=!0,freeSize:n=!1,size:a="medium",source:r="",alt:o,transparent:l=!1,classnames:c="",isOpacity:u=!1,imageStyle:d,imgDraggable:g})=>{const h=i.useRef(null),p=x=>{sr(x)};return e.jsx(tA,{className:Un(n?"":"Polaris-Thumbnail",n?"":{"Polaris-Thumbnail--sizeMedium":s&&a==="medium","Polaris-Thumbnail--sizeLarge":s&&a==="large","Polaris-Thumbnail--sizeExtraSmall":s&&a==="extraSmall","Polaris-Thumbnail--sizeSmall":s&&a==="small","is-hide-box-shadow":!t,"is-opacity-image":u,transparent:l}),children:typeof r=="string"?e.jsx("img",{className:c,loading:"lazy",alt:o,ref:h,src:r,"data-src":r,referrerPolicy:"no-referrer",style:d,onError:p,...g===!1?{draggable:!1}:{}}):e.jsx(ee,{accessibilityLabel:o,source:r})})},tA=se.div` 1641 &.is-hide-box-shadow.Polaris-Thumbnail::after { 1642 box-shadow: none; 1643 } 1644 &.is-opacity-image.Polaris-Thumbnail::after { 1645 background: rgba(0, 0, 0, 0.5); 1646 } 1647`,Nw=["US","FR","DE","IN","UK","GB"],gd=t=>{const s=Object.keys(Zt);return q.size(t)?[...new Set(t?.map(r=>r.toUpperCase()))].filter(r=>Zt[r]):s},Ow=(t,s)=>{if(!s?.length)return t;const n=new Set(t.map(l=>l.toUpperCase())),a=new Set,r=[];for(const l of s){const c=l.toUpperCase();n.has(c)&&Zt[c]&&!a.has(c)&&(a.add(c),r.push(c))}const o=t.filter(l=>!a.has(l.toUpperCase()));return[...r,...o]},Dw=t=>{let s="";return t==="GB"&&(t="UK"),Object.entries(Zt).forEach(([n,a])=>{n===t&&(s=a.label)}),t==="UK"?s+=" (UK)":t==="GB"&&(s+=" (GB)"),s},Lw=t=>Zt[t]?.label||"",sA=t=>{const s=Object.keys(Zt);if(!t?.length)return s.map(l=>({label:Zt[l].label,value:l}));const n=new Set(s.map(l=>l.toUpperCase())),a=new Set,r=[];for(const l of t){const c=l.toUpperCase();n.has(c)&&Zt[c]&&!a.has(c)&&(a.add(c),r.push(c))}const o=s.filter(l=>!a.has(l.toUpperCase()));return[...r,...o].map(l=>({label:Zt[l].label,value:l}))};se.div` 1648 .Polaris-Box > .Polaris-Box { 1649 padding: 1px; 1650 } 1651`;se.div` 1652 display: inline-flex; 1653 align-items: center; 1654 background-color: var(--p-color-bg-surface-tertiary-active); 1655 border-radius: var(--p-border-radius-300); 1656 padding: var(--p-space-100); 1657 gap: 2px; 1658 position: relative; 1659 cursor: ${({disabled:t})=>t?"not-allowed":"default"}; 1660`;se.div` 1661 position: relative; 1662 display: flex; 1663 gap: 2px; 1664 1665 &:before { 1666 content: ''; 1667 position: absolute; 1668 left: 0; 1669 top: 0; 1670 width: ${({totalOptions:t})=>`calc(100% / ${t})`}; 1671 height: 100%; 1672 background: ${({disabled:t})=>t?"#e9e9e9":"white"}; 1673 border-radius: var(--p-border-radius-200); 1674 transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 1675 transform: translateX(${({activeIndex:t})=>`calc(${t} * (100%))`}); 1676 /* border: ${({disabled:t})=>`1px solid ${t?"va(--p-color-bg-surface-disabled)":"var(--p-color-border-tertiary)"}`}; */ 1677 box-shadow: ${({disabled:t})=>t?"none":"var(--p-shadow-200)"}; 1678 pointer-events: none; 1679 } 1680`;se.button` 1681 position: relative; 1682 display: flex; 1683 align-items: center; 1684 justify-content: center; 1685 padding: var(--p-space-100) var(--p-space-200); 1686 color: ${({isActive:t,disabled:s})=>s?"#999":t?"#000":"#666"}; 1687 height: 24px; 1688 background: none; 1689 border: none; 1690 cursor: ${({disabled:t})=>t?"not-allowed":"pointer"}; 1691 transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 1692 z-index: 1; 1693 flex: 1; 1694 min-width: 0; 1695 opacity: ${({disabled:t})=>t?.7:1}; 1696 1697 &:hover { 1698 color: ${({isActive:t,disabled:s})=>s?"#999":t?"#000":"#333"}; 1699 } 1700 1701 &:disabled {
1702 cursor: not-allowed; 1703 } 1704`;const Mw=ae({key:"stepOnboardingState",default:{step:void 0}}),nA=ae({key:"extensionDetailState",default:{require:!1,version:!1}}),aA=()=>{const[t,s]=i.useState(!0),[n,a]=be(nA),r=async()=>{const l=await lp();return s(!l),!l},o=l=>{a({...n,...l})};return i.useEffect(()=>{r()},[]),{isExtension:t,fetchExtension:r,setUpdateExtension:o}},rA=({chartContainer:t={},loading:s=!1,...n})=>e.jsx(ji,{themes:{Light:{chartContainer:{...t},legend:{}}},children:e.jsx(wg,{state:s?Ia.Loading:Ia.Success,type:"stacked",theme:"Light",...n})}),iA=({chartContainer:t={},loading:s=!1,...n})=>e.jsx(ji,{themes:{Light:{chartContainer:{...t},legend:{}}},children:e.jsx(yp,{state:s?Ia.Loading:Ia.Success,theme:"Light",...n})}),oA=({chartContainer:t={},loading:s=!1,renderLegendContent:n,...a})=>e.jsx(ji,{themes:{Light:{chartContainer:{...t},legend:{}}},children:e.jsx(Ng,{state:s?Ia.Loading:Ia.Success,theme:"Light",renderLegendContent:n,isAnimated:!0,...a})}),lA={BarChart:rA,ComboChart:oA,LineChart:iA},Ot={ORDER_CONVERSATION:"orders.message",ORDER_FULFILLMENT:"orders.fulfillment",ORDER_SYNC:"orders.synced",PRODUCT_IMPORT:"products.import",PRODUCT_PUSHED:"products.pushed",PRODUCT_PUSH:"product.push",PRODUCT_IMPORTING:"products.importing",ORDER_PAYMENT:"orders.payment",ORDER_PAY:"orders.pay",STORES_UNINSTALLED:"stores.uninstalled",ORDER_TRACKING:"order.tracking.center",PRODUCT_AI_ACTION:"product.ai-action",IMPORT_CSV:"import.csv",ORDER_CREATE:"orders.created",PRODUCT_INSIGHTS_UPDATED:"product_insight.updated",PRODUCT_INSIGHTS_COMPLETED:"product_insight.completed",ORDER_SUPPLIER:"orders.supplier",PRODUCT_ANALYZE:"product_hunter.analyze",PRODUCT_ANALYZE_TIMEOUT:"product_hunter.analyze.timeout",PRODUCT_TRACKING_CRAWLING:"product_hunter.tracking.crawling",PRODUCT_COMPETITOR_CRAWLING_DONE:"account.zopi_iq.tracking.competitor.done"},cA=i.forwardRef((t,s)=>{const{onChangeLoading:n}=t,{t:a}=J(),r=dt().removeShop,o=de().fetchUserInfo,[l,c]=i.useState(),u=()=>{c(null)},d=async()=>{if(!l)return;u(),n?.(!0),(await r(l.domain,"woocommerce")).status!==fe.OK&&n?.(!1)};return i.useImperativeHandle(s,()=>({onOpen:g=>{c(g)}})),i.useEffect(()=>{const g=window.channelPusher;g&&g.bind(Ot.STORES_UNINSTALLED,function(h){const{success:p}=h?.data||{};p&&(n?.(!1),o())})},[]),e.jsxs(Xe,{size:"small",open:!!l,onClose:u,title:a("DisconnectChannel"),children:[e.jsx(Xe.Section,{children:e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"regular",children:a("DisconnectChannelDescription")})}),e.jsx(Xe.Section,{children:e.jsxs("div",{className:"msui-flex msui-flex-justify-content-end",children:[e.jsx("div",{className:"msui-mr-3",children:e.jsx(re,{onClick:u,children:a("Cancel")})}),e.jsx(re,{variant:"primary",tone:"critical",onClick:d,children:a("Disconnect")})]})})]})}),Vr={shopify:{id:gi.shopify,sub_domain:".myshopify.com",content:'Donât have a Shopify account? <a class="text-link" target="_blank" href="https://shopify.pxf.io/MXL3JK">Sign up</>'},woocommerce:{id:gi.woocommerce,sub_domain:"",content:'Donât have a WooCommerce account? <a class="text-link" href="https://woocommerce.com" target="_blank">Sign up</>'}},dA=i.forwardRef((t,s)=>{const{isFirst:n}=t,{t:a}=J(),r=dt(),o=de(),{isMobile:l}=xe(),[c,u]=i.useState(null),[d,g]=i.useState(""),[h,p]=i.useState(""),[x,f]=i.useState(!1),_=ge.getToken(),b=async()=>{if(h||!d||d.length===0||c===null)return;let C="";Vr[c].sub_domain?C=Si(d):C=ll(d),f(!0),v(c);const{status:S,data:j}=await o.authInstall({shop:C+Vr[c].sub_domain},Vr[c].id);if(S===fe.OK&&j&&j.url){const A=j.url,E=o.getCurrentWorkPlace(),T=`https://id.zopi.io/auth/auto-login/connect?token=${_}&workplaceId=${E?.id||""}&linkAccount=1&connectUrl=${A}`;u(null),window.open(T)||window.location.replace(T)}f(!1)},v=C=>{Ke.trackingEventUsersAction({event_name:$.STORE_CHANNEL_CLICKED,event_data:{channel_name:C,type:n?"ob":"in-app"}})};i.useImperativeHandle(s,()=>({onOpen:C=>u(C)})),i.useEffect(()=>{if(!c)return;let C="";d&&(C=r.getListShop().some(j=>j.platform_domain===d+Vr[c].sub_domain)?"StoreAlreadyExistsInThisAccount":""),p(C)},[d,c]);const y=i.useMemo(()=>e.jsxs(Q,{paddingInline:"600",paddingBlockStart:"800",paddingBlockEnd:"600",children:[e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"h4",variant:"heading2xl",alignment:"center",fontWeight:"semibold",children:a(c==="shopify"?"ConnectToShopify":"ConnectToWoocomerce")}
1704),e.jsx(m,{as:"p",variant:"bodyLg",alignment:"center",tone:"subdued",children:a("AddYourStoreURLToConnectWithZopi")})]}),e.jsx(Q,{paddingBlockStart:"1600",paddingBlockEnd:"2800",children:e.jsx(gt,{label:"",autoComplete:"",placeholder:c==="shopify"?"e.g. store.myshopify.com":a("YourStoreURLdomain"),value:d,onChange:g,error:h?a(h):""})})]}),[c,h,d,a]);return l?e.jsx(xt,{visible:!!c,onClose:()=>u(null),zIndex:172,showCloseIcon:!0,isButtonFullWidth:!0,children:e.jsxs("div",{className:"p-4",children:[y,e.jsxs("div",{className:"p-4 flex justify-between items-center gap-8",children:[e.jsx("div",{children:e.jsxs(m,{as:"p",variant:"bodyMd",tone:"subdued",children:[a("NoShopifyAccountYet")," ",e.jsx("a",{href:Ts.shopify.sign_up,className:"underline",target:"_blank",rel:"noreferrer",children:a("SignUpHere")})]})}),e.jsxs("div",{className:"flex items-center justify-end gap-4",children:[e.jsx(re,{variant:"secondary",onClick:()=>u(null),children:a("Cancel")}),e.jsx(re,{variant:"primary",onClick:()=>b(),disabled:!d.trim(),loading:x,children:a("Connect")})]})]})]})}):e.jsx(e.Fragment,{children:e.jsxs(Xe,{open:!!c,onClose:()=>u(null),title:"",titleHidden:!0,children:[y,e.jsx($s,{}),e.jsxs("div",{className:"p-4 flex justify-between items-center",children:[e.jsx("div",{children:e.jsxs(m,{as:"p",variant:"bodyMd",tone:"subdued",children:[a("NoShopifyAccountYet")," ",e.jsx("a",{href:Ts.shopify.sign_up,className:"underline",target:"_blank",rel:"noreferrer",children:a("SignUpHere")})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{variant:"secondary",onClick:()=>u(null),children:a("Cancel")}),e.jsx(re,{variant:"primary",loading:x,onClick:()=>b(),disabled:!d.trim(),children:a("Connect")})]})]})]})})}),uA={...Za,...cp},bn=({status:t,source:s,onConnect:n,onDisconnect:a,loadingConnect:r,loadingDisconnect:o})=>{const{t:l}=J(),c=xe().isMobile,u=uA[s];return e.jsx(Q,{padding:"300",borderColor:"border",borderWidth:"025",borderRadius:"300",background:"bg-surface",children:e.jsxs("div",{className:"flex gap-3 items-center group",children:[e.jsx("div",{className:"size-10 shrink-0",children:e.jsx(or,{source:s,fontSize:40})}),e.jsx("div",{className:"grow",children:e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"medium",children:u.label})}),e.jsx("div",{className:"shrink-0",children:t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:s!=="shopify"&&a?c?"hidden":"group-hover:hidden":"",children:e.jsx(wt,{tone:"success",children:l("Active")})}),e.jsx("div",{className:oe("hidden",s!=="shopify"&&a?c?"block":"group-hover:block":""),children:e.jsx(re,{onClick:a,tone:"critical",variant:"plain",loading:o,children:l("Disconnect")})})]}):e.jsx(re,{onClick:n,loading:r,children:l("Connect")})})]})})},pA=1e3*60*5,hA=()=>{const{t}=J(),s=gr().lgUp,n=bt(),a=dt().getChannelConnected(),r=dt().getShopifyChannel(),o=dt().fetchSyncShopifyStore,[l,c]=be(R0),[u,d]=be(k0),[g,h]=i.useState({}),[p,x]=i.useState(!1),f=i.useRef(null),_=i.useRef(null),b=r.reduce((j,A)=>(j[A.key]=A.isActive,j),{}),v=()=>{requestAnimationFrame(()=>{c(!1),d("all")})},y=j=>{requestAnimationFrame(()=>{S(j);const A=cp[j].connectLink;A&&window.open(A,"_blank")})},C=()=>{requestAnimationFrame(async()=>{if(!a.shopify)return;x(!0),await o()===!0&&n.success("Sync store successfully"),x(!1)})},S=j=>{Ke.trackingEventUsersAction({event_name:$.STORE_CHANNEL_CLICKED,event_data:{channel_name:j,type:"in-app"}})};return i.useEffect(()=>{if(l){const j=()=>{o(),ge.localStorage.set("TIME_SYNC_SHOPIFY_STORE",new Date().getTime())},A=ge.localStorage.get("TIME_SYNC_SHOPIFY_STORE"),E=A&&new Date().getTime()-Number(A)>pA;(!A||E)&&j()}},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(Is,{width:1072,zIndex:176,visible:l,onClose:v,children:[e.jsxs("div",{className:"bg-bg-surface px-4 border-b border-border h-13 lg:h-19 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex gap-1 justify-between",children:[e.jsx(re,{icon:Mn,onClick:v,variant:"monochromePlain"}),e.jsx(m,{as:"p",variant:s?"headingLg":"headingMd",fontWeight:"bold",children:t("MySalesChannel")})]}),a.shopify&&u!=="platform"&&e.jsx("div",{className:"mr-1",children:e.jsx(re,{variant:"plain",onClick:C,loading:p,children:t("SyncStore")})})]}),e.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[a.shopify&&u!=="platform"&&e.jsx(Q,{padding:"500",borderColor:"border",borderWidth:"025",background:"bg-surface",shadow:"100",borderRadius:"300",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(m,{as:"p",variant:"headingMd",children:t("ConnectViaShopify")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(bn,{source:"google",status:b.google,onConnect:()=>y("google")}),e.jsx(bn,{source:"meta",status:b.meta,onConnect:()=>y("meta")}),e.jsx(bn,{source:"pinterest",status:b.pinterest,onConnect:()=>y("pinterest")}),e.jsx(bn,{source:"shop",status:b.shop,onConnect:()=>y("shop")}),e.jsx(bn,{source:"snapchat",status:b.snapchat,onConnect:()=>y("snapchat")}),e.jsx(bn,{source:"tiktok",status:b.tiktok,onConnect:()=>y("tiktok")}),e.jsx(bn,{source:"twitter",status:b.twitter,onConnect:()=>y("twitter")})]})]})}),u!=="shopify-external"&&e.jsx(Q,{padding:"500",borderColor:"border",borderWidth:"025",background:"bg-surface",shadow:"100",borderRadius:"300",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(m,{as:"p",variant:"headingMd",children:t("ConnectViaZopi")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(bn,{source:"shopify",status:a.shopify,onConnect:()=>
1704{ss("my_channel_connect_woo_click",{}),f.current?.onOpen("shopify")},loadingDisconnect:g.shopify,onDisconnect:()=>_.current?.onOpen(a.shopifyShop[0])}),!Ce.isShopifyEmbedded()&&e.jsx(bn,{source:"woocommerce",status:a.woocommerce,onConnect:()=>{ss("my_channel_connect_woo_click",{}),f.current?.onOpen("woocommerce")},loadingDisconnect:g.woocommerce,onDisconnect:()=>_.current?.onOpen(a.woocommerceShop[0])})]})]})})]})]}),e.jsx(dA,{ref:f}),e.jsx(cA,{ref:_,onChangeLoading:j=>h(A=>({...A,woocommerce:j}))})]})},Yr=t=>{const{label:s,options:n,titleMobile:a,classes:r,disabled:o,triggerButton:l}=t,{isMobile:c}=xe(),[u,d]=i.useState(!1),g=i.useRef(null),h=i.useRef(null),p=()=>{o||d(!u)},x=n?e.jsx(m,{as:"p",variant:"bodyMd",truncate:!0,children:t.showValue||n.find(b=>b.value===t.value)?.label||""}):t.showValue,f=e.jsxs("div",{className:"flex flex-col gap-1",children:[s&&e.jsx(m,{as:"span",variant:"bodyMd",children:s}),l?e.jsx(re,{...l,onClick:p,children:x}):e.jsxs("button",{ref:g,disabled:o,className:oe("flex justify-between items-center gap-1 h-8 cursor-pointer","pl-3 pr-1 py-1.5 border-[0.5px] border-input-border rounded-lg bg-bg-surface",o?"disabled:border-border-disabled disabled:bg-bg-surface-disabled disabled:text-text-disabled disabled:cursor-not-allowed":"hover:border-input-border-hover hover:bg-input-bg-surface-hover",r?.active),onClick:p,type:"button",children:[e.jsx("span",{className:"truncate",children:x}),e.jsx("span",{children:e.jsx(ee,{source:mr})})]})]}),_=e.jsx("div",{ref:h,className:oe(r?.content),children:n?e.jsx(Yp,{onChange:b=>{t.onChange(b[0]),p()},options:n,selected:[t.value]}):t.content({toggleActive:p})});return i.useEffect(()=>{if(g.current&&h.current&&u){const{width:b}=g.current.getBoundingClientRect();h.current.style.setProperty("--ms-active-with",`${b}px`)}},[u]),c?e.jsxs(e.Fragment,{children:[f,e.jsx(xt,{visible:u,onClose:p,zIndex:172,showCloseIcon:!0,title:a,children:e.jsx("div",{className:"p-1",children:_})})]}):e.jsx(Gs,{active:u,activator:f,onClose:p,children:_})},gA=()=>{const{getChatLinkEmbedded:t}=Pt();return e.jsx("div",{className:"w-full flex flex-1 flex-col rounded-t-2xl overflow-hidden",children:e.jsx("iframe",{src:t(),className:"w-full flex flex-1"})})},mA="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='path-1-inside-1_22420_20299'%20fill='white'%3e%3cpath%20d='M12.2084%201.81687C12.3702%201.57919%2012.3094%201.25375%2012.0617%201.10777C10.5493%200.216445%208.78066%20-0.155136%207.02859%200.0591959C5.10378%200.29466%203.33002%201.22124%202.03722%202.66659C0.744431%204.11193%200.0206242%205.97765%200.00043365%207.9167C-0.0197569%209.85576%200.665044%2011.7361%201.92746%2013.2081C3.18988%2014.68%204.94396%2015.6434%206.86345%2015.9189C8.78294%2016.1943%2010.7372%2015.7633%2012.3626%2014.7058C13.9881%2013.6483%2015.1741%2012.0364%2015.7001%2010.17C16.1789%208.47103%2016.0811%206.66642%2015.4306%205.03588C15.3241%204.76883%2015.0117%204.65919%2014.7522%204.78286C14.4926%204.90653%2014.3844%205.21665%2014.4883%205.48472C15.0318%206.88642%2015.1082%208.43159%2014.6979%209.88756C14.2404%2011.5111%2013.2087%2012.9132%2011.7948%2013.833C10.3809%2014.7529%208.68105%2015.1279%207.01137%2014.8882C5.3417%2014.6486%203.81591%2013.8107%202.71779%2012.5303C1.61968%2011.2499%201.024%209.61423%201.04156%207.92755C1.05913%206.24085%201.68873%204.61796%202.81327%203.36072C3.93781%202.10348%205.48072%201.2975%207.15502%201.09268C8.6565%200.909%2010.172%201.22001%2011.4745%201.97066C11.7236%202.11422%2012.0466%202.05456%2012.2084%201.81687Z'/%3e%3c/mask%3e%3cpath%20d='M12.2084%201.81687C12.3702%201.57919%2012.3094%201.25375%2012.0617%201.10777C10.5493%200.216445%208.78066%20-0.155136%207.02859%200.0591959C5.10378%200.29466%203.33002%201.22124%202.03722%202.66659C0.744431%204.11193%200.0206242%205.97765%200.00043365%207.9167C-0.0197569%209.85576%200.665044%2011.7361%201.92746%2013.2081C3.18988%2014.68%204.94396%2015.6434%206.86345%2015.9189C8.78294%2016.1943%2010.7372%2015.7633%2012.3626%2014.7058C13.9881%2013.6483%2015.1741%2012.0364%2015.7001%2010.17C16.1789%208.47103%2016.0811%206.66642%2015.4306%205.03588C15.3241%204.76883%2015.0117%204.65919%2014.7522%204.78286C14.4926%204.90653%2014.3844%205.21665%2014.4883
1704%205.48472C15.0318%206.88642%2015.1082%208.43159%2014.6979%209.88756C14.2404%2011.5111%2013.2087%2012.9132%2011.7948%2013.833C10.3809%2014.7529%208.68105%2015.1279%207.01137%2014.8882C5.3417%2014.6486%203.81591%2013.8107%202.71779%2012.5303C1.61968%2011.2499%201.024%209.61423%201.04156%207.92755C1.05913%206.24085%201.68873%204.61796%202.81327%203.36072C3.93781%202.10348%205.48072%201.2975%207.15502%201.09268C8.6565%200.909%2010.172%201.22001%2011.4745%201.97066C11.7236%202.11422%2012.0466%202.05456%2012.2084%201.81687Z'%20stroke='url(%23paint0_linear_22420_20299)'%20stroke-width='2'%20mask='url(%23path-1-inside-1_22420_20299)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M9.17826%204H9.73367L11.2%206.59158L9.73367%209.18317H9.17826L10.6446%206.59158L9.17826%204ZM6.82184%2012H6.26642L4.80005%209.40842L6.26642%206.81683H6.82184L5.35546%209.40842L6.82184%2012ZM8.94587%2012H8.39046L6.92409%209.40842L8.51828%206.59158L7.0519%204H7.60731L9.07369%206.59158L7.4795%209.40842L8.94587%2012Z'%20fill='url(%23paint1_linear_22420_20299)'/%3e%3cg%20clip-path='url(%23clip0_22420_20299)'%3e%3cpath%20d='M15.9995%203.00598C14.5982%203.09221%2013.4765%204.23687%2013.3923%205.66732H13.382C13.2976%204.23687%2012.176%203.09221%2010.775%203.00598V2.99554C12.1763%202.9091%2013.2976%201.76443%2013.382%200.333984H13.3923C13.4767%201.76443%2014.5982%202.9091%2015.9995%202.99554V3.00598Z'%20fill='url(%23paint2_linear_22420_20299)'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_22420_20299'%20x1='9.81831e-09'%20y1='8'%20x2='9.8365'%20y2='7.64843'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2310245A'/%3e%3cstop%20offset='0.395'%20stop-color='%23695EDF'/%3e%3cstop%20offset='0.76'%20stop-color='%234477ED'/%3e%3cstop%20offset='0.985'%20stop-color='%235737E6'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_22420_20299'%20x1='4.80005'%20y1='8'%20x2='8.73646'%20y2='7.88745'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2310245A'/%3e%3cstop%20offset='0.395'%20stop-color='%23695EDF'/%3e%3cstop%20offset='0.76'%20stop-color='%234477ED'/%3e%3cstop%20offset='0.985'%20stop-color='%235737E6'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_22420_20299'%20x1='10.775'%20y1='3.00065'%20x2='13.9871'%20y2='2.88819'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2310245A'/%3e%3cstop%20offset='0.395'%20stop-color='%23695EDF'/%3e%3cstop%20offset='0.76'%20stop-color='%234477ED'/%3e%3cstop%20offset='0.985'%20stop-color='%235737E6'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_22420_20299'%3e%3crect%20width='5.22444'%20height='5.33333'%20fill='white'%20transform='translate(10.775%200.333984)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Ve={STORE_SELLING:`ah/research/products/:${Ct.PRODUCT_ANALYTICS_ID}/fetch-stores-selling`,GET_SIMILAR_PRODUCT:`ah/research/products/:${Ct.PRODUCT_ANALYTICS_ID}/similar-products`,GET_PRICE_HISTORY:`ah/research/products/:${Ct.PRODUCT_ANALYTICS_ID}/price-history`,GET_ORDER_STATISTIC:`ah/research/products/:${Ct.PRODUCT_ANALYTICS_ID}/order-statistics`,GET_TOP_COUNTRY:`ah/research/products/:${Ct.PRODUCT_ANALYTICS_ID}/top-countries`,GET_LOGISTICS_PRODUCT_IDS:"center/products/source/aliexpress/logistics",GET_KEYWORD_GOOGLE_VISION:`ah/research/products/:${Ct.PRODUCT_ANALYTICS_ID}/keywords`,GET_PRODUCT_LIST:"ah/products/search",GET_PRODUCT_DETAIL:"ah/products/:productId",GET_SELLER_RATINGS:"ah/research/products/:productId/seller-ratings",POST_IMPORT_PRODUCT:`products/import/${Ct.PLATFORM}`,POST_DISABLED_PRODUCT:"ah/products/:productId/disable",GET_PRODUCT_VARIANTS:"center/products/source/aliexpress/:productId",GET_PRODUCT_LOGISTICS:"center/products/source/:source/:productId/logistics",GET_LOGISTICS_BULK_PRODUCTS:"center/
1704products/source/aliexpress/logistics/get-by-products",SEARCH_PRODUCT:"https://api.alihunter.io/app/products/search",GET_PRODUCT_LIST_DROPSHIPPING:"ah/products/dropshipping",GET_LIST_PRODUCT_IMPORTED:"products/imported_list",GET_CATEGORY_PRODUCT:"/product-sources/categories/tree",GET_PRODUCT_LIST_V2:"/center/products/find",GET_PRODUCT_COLLECTION_LIST:"/product-sources/products/find-by-collection/:collection_slug",GET_PRODUCT_ID_BY_IMAGE:"/get-product-id-by-image",GET_PRODUCT_DETAIL_V2:"center/products/source/:source/:product_id",GET_PRODUCT_LOGISTICS_V2:"/product-sources/logistics/:source/:product_id",GET_PRODUCT_REVIEWS:"/product-sources/reviews/:source/:id",GET_PRODUCTS_ALIEXPRESS_REVIEWS:"ah/research/products/:productId/reviews",GET_PRODUCTS_TRENDING_KEYWORD:"center/products/trending-keywords",GET_PRICE_PRODUCT_DETAIL:`product-sources/products/price-detail/:${Ct.PRODUCT_SOURCE}/:${Ct.PRODUCT_ID}/:${Ct.SHIP_TO}`,GET_PRODUCT_RECOMMEND_UNMAP:"/center/products/recommend-unmap",GET_PRODUCT_RECOMMEND_IMPORT:"/center/products/suggest-keywords",UPDATE_STATUS_VIEW_ADS_SPY:"/social/ads/mark-view",IMPORT_MULTI_PRODUCT:"/center/products/import-all",PUSH_MULTI_PRODUCT:"/center/products/push-all-multiple-channel",RELATED_KEYWORDS:"/center/products/related-keywords",POST_PRODUCT_INSIGHTS_POPULARITY:"center/products/quick-scan-popularity",POST_PRODUCT_INSIGHTS:"center/
1704products/quick-scan",POST_PRODUCT_INSIGHTS_METRICS:"center/products/quick-scan-metrics",GET_SELLER_PRODUCT:"center/products/crawl-by-seller/:source/:seller_id",GET_CAMPAIGN_PRODUCT:"center/products/campaign",POST_IMPORT_ES_PRODUCTS:"/center/products/source/favourite",GET_PRODUCT_INSPIRED:"center/products/inspired-v2",FIND_MAIN_PRODUCT:"/center/products/find-main-products",TRACKING_IMPORT_ERRORS:"/center/products/tracking-errors/import",GET_PRODUCTS_BY_CATEGORY:"/center/products/products-by-category/:cateId",GET_FIND_PRODUCT:"/center/products/find-simple-mode",GET_FIND_PRODUCT_V2:"/center/products/find-simple-mode-v2",GET_FIND_SUPPLIER_BY_IMAGE:"center/products/find-suppliers",GET_FIND_SUPPLIER_BY_IMAGE_V2:"center/products/find-suppliers-v2"},fA=async t=>await X(Ve.FIND_MAIN_PRODUCT,{},{method:"POST"},{cancelToken:t}),xA=async(t,s)=>await X(Ve.GET_CAMPAIGN_PRODUCT,t,{method:"GET"},{cancelToken:s}),_A=(t,s={},n={})=>{const{product_id:a,...r}=t,o=Ve.STORE_SELLING.replace(":"+Ct.PRODUCT_ANALYTICS_ID,a);return s.method="POST",X(o,r,s,n)},bA=(t,s={},n={})=>{const{product_id:a}=t,r=Ve.STORE_SELLING.replace(":"+Ct.PRODUCT_ANALYTICS_ID,a);return X(r,{current_total:t.current_total},s,n)},yA=t=>{const{params:s,token:n}=t;return X(Ve.GET_SIMILAR_PRODUCT.replace(":"+Ct.PRODUCT_ANALYTICS_ID,s.productId),{...q.omit(s,["productId"])},{method:"POST",msFormData:!0},{cancelToken:n})},CA=t=>{const{params:s,token:n}=t;return X(Ve.GET_PRICE_HISTORY.replace(":"+Ct.PRODUCT_ANALYTICS_ID,s.productId),{...q.omit(s,["productId"])},{method:"GET"},{cancelToken:n})},vA=async t=>{const{params:s,token:n}=t;return await X(Ve.GET_ORDER_STATISTIC.replace(":"+Ct.PRODUCT_ANALYTICS_ID,s.productId),{...q.omit(s,["productId"])},{method:"GET"},{cancelToken:n})},AA=async(t,s={},n={})=>await X(Ve.GET_TOP_COUNTRY.replace(":"+Ct.PRODUCT_ANALYTICS_ID,t),{},s,n),SA=t=>{const{params:s,token:n}=t;return X(Ve.GET_LOGISTICS_PRODUCT_IDS,s,{method:"GET"},{cancelToken:n})},jA=t=>{const{params:s,token:n}=t;return X(Ve.GET_PRODUCTS_TRENDING_KEYWORD,s,{method:"GET"},{cancelToken:n})},EA=t=>{const{params:s,token:n}=t;return X(Ve.GET_KEYWORD_GOOGLE_VISION.replace(":"+Ct.PRODUCT_ANALYTICS_ID,s.productId),q.omit(s,["productId"]),{method:"POST"},{cancelToken:n})},TA=async t=>X(Ve.GET_CATEGORY_PRODUCT,t),PA=async t=>{const{params:s,token:n}=t;return await X(Ve.GET_PRODUCT_LIST,s,{method:"GET"},{cancelToken:n||null})},IA=async t=>{const{params:s,token:n}=t;return await X(Ve.GET_PRODUCT_LIST_DROPSHIPPING,s,{method:"GET"},{cancelToken:n||null})},RA=async(t={})=>{const{params:s,token:n}=t;return await X(Ve.GET_PRODUCT_DETAIL.replace(":productId",s.productId),{},{method:"GET"},{cancelToken:n})},kA=async(t,s,n)=>await X(Ve.GET_PRODUCT_DETAIL_V2.replace(":source",t.source).replace(":product_id",t.productId),t.isBySeller?{by_seller:!0}:t.ship_to?{ship_to:t.ship_to}:{},s,n),wA=async(t={})=>{const{params:s,token:n}=t;return await X(Ve.GET_SELLER_RATINGS.replace(":productId",s.productId),{seller_id:s.seller_id},{method:"GET"},{cancelToken:n})},NA=async t=>{const{params:s,token:n,signal:a}=t,{data:r,...o}=await X(Ve.GET_PRODUCT_LOGISTICS.replace(":productId",s.product_id).replace(":source",s.source),q.pick(s,["country_code","quantity","ship_from","sku_id","cost_price","product_package_id"]),{method:"GET",...a?{signal:a}:{}},{cancelToken:n});return{data:{logistics:(r?.logistics||[]).map(l=>({...l,amount:l.amount||0})),variants:r?.variants,total_variants:r?.total_variants},...o}},OA=async(t,s={},n={})=>X(Ve.GET_LOGISTICS_BULK_PRODUCTS,t,{method:"POST",...s},n),DA=async(t={})=>{const{params:s,token:n}=t;return await X(Ve.GET_PRODUCT_VARIANTS.replace(":productId",s.productId),{},{method:"GET"},{cancelToken:n})},LA=async(t={})=>{const{params:s,token:n}=t;return await X(Ve.POST_PRODUCT_INSIGHTS,{...s},{method:"POST"},{cancelToken:n})},MA=async(t={})=>{const{formData:s,token:n}=t;return await X(Ve.POST_PRODUCT_INSIGHTS_POPULARITY,{formData:s},{method:"POST",msFormData:!0},{cancelToken:n})},UA=async(t={})=>{const{formData:s,token:n}=t;return await X(Ve.POST_PRODUCT_INSIGHTS,{formData:s},{method:"POST",msFormData:!0},{cancelToken:n})},FA=async(t={})=>{const{formData:s,token:n}=t;return await X(Ve.POST_PRODUCT_INSIGHTS_METRICS,{formData:s},{method:"POST",msFormData:!0},{cancelToken:n})},BA=async t=>await X(Ve.POST_DISABLED_PRODUCT.replace(":productId",t+""),{},{method:"POST"}),HA=async(t={},s="aliexpress")=>ge.workspaceStorage.getCurrentVersion()==="v2"?await eb.postImportSourceProduct({source:s,product:t}):await X(Ve.POST_IMPORT_PRODUCT.replace(Ct.PLATFORM,s),t,{method:"POST"}),GA=async t=>await X(Ve.POST_IMPORT_ES_PRODUCTS,t,{method:"POST"}),WA=async t=>await X(Ve.GET_PRODUCT_DETAIL,t),VA=async t=>X(Ve.GET_PRODUCT_DETAIL,t),YA=async t=>X(Ve.SEARCH_PRODUCT,t),zA=async()=>ge.workspaceStorage.getCurrentWorkspaceId()?X("center/"+Ve.GET_LIST_PRODUCT_IMPORTED,{}):X(Ve.GET_LIST_PRODUCT_IMPORTED,{}),KA=(t,s={},n={})=>{const{collection:a,...r}=t,o=Ve.GET_PRODUCT_COLLECTION_LIST.replace(":collection_slug",a);return X(o,r,s,n)},QA=(t,s={},n={})=>{const a=Ve.GET_PRODUCT_LIST_V2;return X(a,t,s,n)},qA=(t,s={},n={})=>
1704X(Ve.GET_PRODUCT_ID_BY_IMAGE,t,s,n),ZA=(t,s={},n={})=>X(Ve.GET_PRODUCT_LOGISTICS_V2.replace(":source",t.source).replace(":product_id",t.product_id),q.pick(t,["country_code","ship_from"]),s,n),XA=(t,s={},n={})=>{const{source:a,product_id:r,...o}=t,l=Ve.GET_PRODUCT_REVIEWS.replace(":source",a).replace(":id",r);return X(l,o,s,n)},JA=async t=>{const{params:s,token:n}=t;return await X(Ve.GET_PRODUCTS_ALIEXPRESS_REVIEWS.replace(":"+Ct.PRODUCT_ANALYTICS_ID,s.productId),s,{method:"GET"},{cancelToken:n||null})},$A=(t,s={},n={})=>{const{source:a,product_id:r,ship_to:o,...l}=t,c=Ve.GET_PRICE_PRODUCT_DETAIL.replace(`:${Ct.PRODUCT_SOURCE}`,a).replace(`:${Ct.PRODUCT_ID}`,r).replace(`:${Ct.SHIP_TO}`,o);return X(c,l,s,n)},eS=(t,s={},n={})=>{const a=Ve.GET_PRODUCT_RECOMMEND_UNMAP;return X(a,t,s,n)},tS=(t,s={},n={})=>{const a=Ve.GET_PRODUCT_RECOMMEND_IMPORT;return X(a,t,s,n)},sS=(t,s)=>{const n=Ve.UPDATE_STATUS_VIEW_ADS_SPY;return X(n,{...t,mode:"AO_Ads"},{method:"POST"},{cancelToken:s})},nS=(t,s)=>{const n=Ve.IMPORT_MULTI_PRODUCT;return X(n,t,{method:"POST"},{cancelToken:s})},aS=(t,s)=>{const n=Ve.PUSH_MULTI_PRODUCT;return X(n,t,{method:"POST"},{cancelToken:s})},rS=(t,s)=>X(Ve.RELATED_KEYWORDS,{keyword:t},{method:"GET"},{cancelToken:s}),iS=(t,s)=>{const{page:n=1,source:a,productId:r}=t,o=Ve.GET_SELLER_PRODUCT.replace(":source",a).replace(":seller_id",r);return X(o,{page:n},{method:"GET"},{cancelToken:s})},oS=(t,s)=>X(Ve.GET_PRODUCT_INSPIRED,t,{method:"GET"},{cancelToken:s}),lS=(t,s)=>X(Ve.TRACKING_IMPORT_ERRORS,t,{method:"POST"},{cancelToken:s}),cS=(t,s)=>{const n=Ve.GET_PRODUCTS_BY_CATEGORY.replace(":cateId",t.cateId.toString());return X(n,{page_size:t.page_size||20,page:t.page||1,ship_to:t.ship_to||"US"},{cancelToken:s})},dS=(t,s={},n={})=>X(Ve.GET_FIND_PRODUCT,t,s,n),uS=(t,s={},n={})=>X(Ve.GET_FIND_PRODUCT_V2,t,s,n),pS=async(t,s={method:"POST"},n={})=>{const{...a}=t;return X(Ve.GET_FIND_SUPPLIER_BY_IMAGE,a,s,n)},hS=async(t,s={method:"POST"},n={})=>{const{...a}=t;return X(Ve.GET_FIND_SUPPLIER_BY_IMAGE_V2,a,s,n)},os={getProductReviews:XA,findMainProduct:fA,getProductInspired:oS,getCampaignProduct:xA,postStoreSelling:_A,getStoreSelling:bA,getSimilarProduct:yA,getPriceHistory:CA,getOrderStatistic:vA,getTopCountry:AA,getLogisticsProductIds:SA,getKeywordGoogleVisionImage:EA,getCategory:TA,getProductList:PA,getProductListDropShipping:IA,getProductDetail:RA,getProductLogisticsV2:ZA,getProductDetail2:kA,getSellerRatings:wA,postProductInsightTarget:UA,postProductInsightMetrics:FA,getProductLogistics:NA,getProductVariants:DA,postImportProduct:HA,getBestSelling:VA,getMostNewOrdered:WA,searchProducts:YA,postDisabledProduct:BA,getListProductImported:zA,getProductListV2:QA,getCollectionProductList:KA,getProductIdByImages:qA,getProductAliexpressReviewList:JA,getProductTrendingKeyword:jA,getPriceProductDetail:$A,getProductRecommendUnmap:eS,getProductRecommendImport:tS,updateStatusViewAdsSpyItem:sS,postImportMultiProduct:nS,postPushMultiProduct:aS,getRelatedKeywords:rS,getSellersProducts:iS,postProductInsights:LA,postProductInsightPopularity:MA,postImportElasticProducts:GA,postTrackingImportErrors:lS,geProductsByCategory:cS,getProductLogisticsBulk:OA,getFindProductList:dS,getFindProductListV2:uS,getFindSupplierByImage:pS,getFindSupplierByImageV2:hS},uh=ae({key:"file-image-state",default:{}}),Uw=ae({key:"open-change-image-state",default:!1}),gS={listCategory:[]},mS={...gS};window.productVariable=mS;function fS(t){return window.productVariable[t]}const xS=(t,s)=>{window.productVariable[t]=s},Ii=["keyword","price","category","sub_category","source","sort_by","collection","niche_name","ship_to","budget_picks"],Ri={keyword:"",price:"",category:"",sub_category:"",source:void 0,sort_by:"",page:"1",page_size:20,type_search:"",collection:"all",section_id:"",niche_name:"",_category_name:"",ship_to:"US"};function _S(t){const s={};return t.has("keyword")&&(s.keyword=t.get("keyword")||""),t.has("price")&&(s.price=t.get("price")||""),t.has("category")&&(s.category=t.get("category")||""),t.has("sub_category")&&(s.sub_category=t.get("sub_category")||""),t.has("source")&&(s.source=t.get("source")||void 0),t.has("sort_by")&&(s.sort_by=t.get("sort_by")),t.has("collection")&&(s.collection=t.get("collection")),t.has("niche_name")&&(s.niche_name=t.get("niche_name")||""),t.has("ship_to")&&(s.ship_to=t.get("ship_to")),t.has("budget_picks")&&(s._is_budget_picks=t.get("budget_picks")==="1"),s}function ph(t){const s=new URLSearchParams;return t.keyword&&s.set("keyword",t.keyword),t.price&&s.set("price",t.price),t.category&&s.set("category",t.category),t.sub_category&&s.set("sub_category",t.sub_category),t.source&&s.set("source",String(t.source)),t.sort_by&&t.sort_by!==Ri.sort_by&&s.set("sort_by",t.sort_by),t.collection&&t.collection!=="all"&&s.set("collection",t.collection),t.niche_name&&s.set("niche_name",t.niche_name),t.ship_to&&t.ship_to!=="US"&&s.set("ship_to",t.ship_to),t._is_budget_picks&&s.set("budget_picks","1"),s}function Lo(t){return Ii.some(s=>t.has(s))}function md(t){return Ii.map(s=>t.has(s)?`${s}=${t.get(s)}`:"").join("|")}function fd(t){const s=ph(t);return Ii.map(n=>s.has(n)?`${n}=${s.get(n)}`:"").join("|")}function xd(t,s){if(!Lo(t))return null;const n=_S(t),a={...Ri,...n};return s.forcePageOne&&(a.page="1"),a}function bS(t,s){const n=new URLSearchParams(s?s.toString():window.location.search);return Ii.forEach(a=>n.delete(a)),ph(t).forEach((a,r)=>
1704n.set(r,a)),n.toString()}const yS=ae({key:"addProductFiltersState",default:Ri});let Mo=!1;function Fw(){Mo=!1}function CS({filters:t,setFilters:s}){const[n,a]=ca(),r=i.useRef(!1),o=i.useRef(null),l=i.useRef(!0),c=n.toString(),u=i.useCallback(g=>{if(!Lo(g))return;const h=xd(g,{forcePageOne:!0});h&&s(p=>fd(p)===fd(h)&&p.page===h.page?p:h)},[s]),d=i.useCallback((g,h)=>{const p=bS(g,h);p!==h.toString()&&a(new URLSearchParams(p),{replace:!0})},[a]);i.useEffect(()=>{const g=new URLSearchParams(c);if(Mo)l.current&&d(t,g);else if(Mo=!0,Lo(g)){const h=xd(g,{forcePageOne:!1});h&&s(h)}l.current=!1,r.current=!0},[t,c,s,d]),i.useEffect(()=>{if(!r.current||o.current===c)return;const g=o.current;if(o.current=c,g!==null){const h=md(new URLSearchParams(g)),p=md(new URLSearchParams(c));if(h===p)return}u(new URLSearchParams(c))},[c,u]),i.useEffect(()=>{r.current&&d(t,new URLSearchParams(c))},[t,c,d])}const vS=t=>{if(!t)return{sort:"",by:""};const s=t.split(/_(?=[^_]*$)/);return{sort:s[0],by:s[1]}},AS=(t,s)=>{const n=["source"],a=[t.source||"all"];if(t.category_id&&s){const r=s.find(o=>o.id===t.category_id);if(r)n.push("category"),a.push(r?.name);else{const o=s.find(l=>l.children&&q.size(l.children)&&l.children.some(c=>c.id===t.category_id));if(o){n.push("category"),a.push(o?.name);const l=o.children.find(c=>c.id===t.category_id);l&&(n.push("sub_category"),a.push(l?.name))}}}return t.price?(n.push("price"),a.push(String(t.price).replace("_"," - "))):(n.push("price"),a.push("all")),t.latest_orders?(n.push("lastest_volume"),a.push(String(t.latest_orders).replace("_"," - "))):(n.push("lastest_volume"),a.push("all")),t.ship_to&&(n.push("ship_to"),a.push(String(t.ship_to))),t.collection&&(n.push("collection"),a.push(String(t.collection))),{fieldsFP:n,valuesFP:a}},_d=[6,7,13,15,18,26,36,39,44,66,322,1501,1503,1511,1524,200000345,200000343,200000297,200165144,201768104],hh=i.createContext(void 0),Bw=({children:t})=>{const[s,n]=be(Il),a=ke(uh),[r,o]=i.useState({loading:!0,data:[],total:0,more:!1,hasNextPage:!1}),l=i.useRef(null),c=i.useRef(0),u=i.useRef(0),d=i.useRef(0),[g,h]=be(yS);CS({filters:g,setFilters:h});const[p,x]=i.useState([]),[f,_]=i.useState({loading:!1,data:[]}),[b,v]=i.useState({loading:!1,keywords:[],similarProducts:[],refresh:0,extendedLoading:!1,extendedProducts:[],extendedTotal:0}),y=i.useRef(!0),[C,S]=i.useState([]),j=i.useCallback(V=>{S(M=>M.some(I=>I.source_product_id===V.source_product_id)?M:[ES(V),...M])},[]),A=i.useCallback(V=>{S(M=>M.filter(I=>I.source_product_id!==V))},[]),E=i.useCallback(()=>{S([])},[]),T=!!a.file,k=i.useMemo(()=>[b.keywords?.[0],b.keywords?.[1]].filter(Boolean).join(" "),[b.keywords]),O=T?k:g.keyword||"",R=i.useCallback((V,M)=>{o(I=>({...I,loading:!0})),h(I=>({...I,page:V.toString(),page_size:M||I.page_size}))},[]),P=i.useCallback(V=>{h(M=>({...M,...V,page:"1"}))},[]),w=i.useCallback(()=>{n("US"),h(V=>({...V,...q.omit(Ri,["keyword","sort_by"])}))},[g]),N=V=>{const M={...V},I=fS("listCategory"),F=g.is_top_search||!1,{fieldsFP:G,valuesFP:z}=AS({...q.pick(M,["source","price","latest_orders","ship_to","collection"]),category_id:M.sub_category||M.category||""},I);Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_IMPRESSION_LOADED,event_data:{find_product_keyword:M.keyword,find_product_keyword_type:M.type_search||"",find_product_total_results:V?.total,find_product_page_number:+V.page,find_product_filter_detail:{fields:G,values:z},find_product_sort:V.sort_by,is_top_search:F,is_budget_picks:V._is_budget_picks||!1}})},K=async(V,M,I=!1)=>{try{const{sort:F,by:G}=vS(V.sort_by||"most_relevant_desc"),z={page_no:V.page,page_size:V.page_size,keyword:V.keyword,category_id:"",min_price:"",max_price:"",ship_to:V.ship_to?V.ship_to:"US",is_budget_picks:void 0,...F!=="most_relevant"?{sort:G,order_by:F}:{}};if(V.category&&(V.sub_category?z.category_id=V.sub_category||"":z.category_id=V.category||""),V._is_budget_picks){const pe=Math.floor(Math.random()*_d.length);z.is_budget_picks=1,z.category_id=_d[pe].toString(),z.keyword="",z.sort="desc",z.order_by="orders"}V.price&&(z.min_price=V.price.split("_")[0],z.max_price=V.price.split("_")[1]);const me=parseInt(V.page)||1,Re=!!V._is_budget_picks||!!V.keyword?.trim()||!!V.category||!!V.sub_category||!!V.sort_by;if(I||(l.current=null,c.current=0,u.current=0,d.current=0),!Re){z.sort="",z.order_by="",o(ze=>({...ze,more:I,loading:!0}));const pe=await os.getFindProductList(q.pickBy({...z,page_no:"1"},ze=>!va(ze)),{cancelToken:M});if(pe.status===200){const ze=pe.data?.total||0,Ge=pe.data?.products||[];N({...V,page:"1",total:ze,is_top_search:V.is_top_search}),o(lt=>({...lt,loading:!1,more:!1,data:I?lt.data.concat(Ge):Ge,total:ze,hasNextPage:Ge.length>=V.page_size}))}return}if(V.sort_by||(z.sort="desc",z.order_by="orders"),I&&c.current>0&&me>c.current&&!V._is_budget_picks){const pe=d.current+1;o(Ge=>({...Ge,more:!0,loading:!0}));const ze=await os.getFindProductList(q.pickBy({...z,page_no:String(pe)},Ge=>!va(Ge)),{cancelToken:M});if(ze.status===200){d.current=pe;const Ge=Math.ceil(u.current/V.page_size);o(lt=>({...lt,loading:!1,more:!1,data:lt.data.concat(ze.data?.products||[]),hasNextPage:d.current<Ge}))}return}o(pe=>
1704({...pe,more:I,loading:!0}));const De=await os.getFindProductListV2(q.pickBy(z,pe=>!va(pe)),{cancelToken:M}),{data:ot,status:ve}=De;if(ve===200){N({...V,total:ot?.total||0,is_top_search:V.is_top_search});const pe=ot?.products||[],ze=ot?.total||0;l.current=ze;const Ge=Math.ceil(ze/V.page_size);if(c.current=Ge,me>=Ge&&!V._is_budget_picks){const ue=await os.getFindProductList(q.pickBy({...z,page_no:"1"},Pe=>!va(Pe)),{cancelToken:M}),ce=ue.data?.total||0,Ae=ue.data?.products||[];u.current=ce,d.current=1;const _e=Math.ceil(ce/V.page_size);o(Pe=>({...Pe,loading:!1,more:!1,data:I?Pe.data.concat(pe).concat(Ae):pe.concat(Ae),total:ze+ce,hasNextPage:d.current<_e}))}else o(ue=>({...ue,loading:!1,data:I?ue.data.concat(pe):pe,total:ze,more:!1,hasNextPage:me<Ge}))}}catch(F){console.log("error product list",F)}},L=async(V,M)=>{_(G=>({...G,loading:!0}));const{data:I,status:F}=await os.getRelatedKeywords(V,M);F===fe.OK&&_({loading:!1,data:I||[]})},W=i.useCallback(V=>{o(M=>({...M,loading:V}))},[]),H=i.useCallback(()=>f,[f]);i.useEffect(()=>{P({ship_to:s||"US"})},[s,P]);const Z=i.useCallback(async V=>{if(a.base64){v(M=>({...M,loading:!0,refresh:Date.now(),keywords:[]})),h(M=>({...M,page:"1"}));try{const M=a.base64||"",I=new FormData;M.includes("base64")?I.append("image_base64",M):I.append("image_url",M),I.append("extract_keywords","1"),I.append("ship_to",s);const{data:F,status:G}=await os.getFindSupplierByImageV2({formData:I},{method:"POST",msFormData:!0},{cancelToken:V});if(G===fe.OK){const z=(F?.products??[]).map(me=>({...me}));v(me=>({...me,loading:!1,similarProducts:z,keywords:F?.keywords??[],refresh:Date.now()})),Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_SIMILAR_SUPPLIERS_COMPLETED,event_data:{find_product_image_results:z.length,find_product_image_sort:"lastest_volume",find_product_image_sort_type:"asc"}});return}v(z=>({...z,loading:!1,refresh:Date.now()}))}catch{v(M=>({...M,loading:!1,refresh:Date.now()}))}}},[a.base64,s]);i.useEffect(()=>{(a.file||a.cropper)&&v(V=>({...V,loading:!0}))},[a.file,a.cropper]),i.useEffect(()=>{T||(v({loading:!1,keywords:[],similarProducts:[],refresh:0,extendedLoading:!1,extendedProducts:[],extendedTotal:0}),y.current=!0)},[T]),i.useEffect(()=>{if(!T)return;const{token:V,cancel:M}=vs();return Z(V),()=>{M()}},[T,Z]),i.useEffect(()=>{if(!T)return;if(!k){v(F=>({...F,extendedLoading:!1}));return}const{token:V,cancel:M}=vs();return(async()=>{v(F=>({...F,extendedLoading:!0}));try{const F=parseInt(g.page)||1,G=await os.getFindProductListV2({page_no:F,page_size:g.page_size,keyword:k,ship_to:s,order_by:"most_relevant",sort:"desc"},{},{cancelToken:V});v(z=>({...z,extendedLoading:!1,extendedProducts:F>1?z.extendedProducts.concat(G.data?.products||[]):G.data?.products||[],extendedTotal:G.data?.total||0})),y.current=!1}catch{v(F=>({...F,extendedLoading:!1,extendedProducts:[],extendedTotal:0})),y.current=!1}})(),()=>{M()}},[g.page,g.page_size,k,T,s,b.refresh]);const te=i.useMemo(()=>{const V=b.similarProducts,M=b.extendedProducts;return jS([...V,...M])},[g.page,b.similarProducts,b.extendedProducts]),ne=i.useMemo(()=>b.similarProducts.length+b.extendedTotal,[b.similarProducts.length,b.extendedTotal]),le=i.useMemo(()=>b.loading||!!k&&b.extendedLoading,[k,b.loading,b.extendedLoading]),B=i.useMemo(()=>{const V=F=>{const G=new Set(F.map(me=>me.source_product_id)),z=C.filter(me=>!G.has(me.source_product_id));return z.length>0?[...z,...F]:F};if(!T)return{...r,data:V(r.data)};let M=te,I=ne;return le&&y.current&&(M=r.data,I=r.total),{loading:y.current?!0:le,data:V(M),total:I,more:!1,hasNextPage:!1}},[r,le,te,ne,C]),ie=i.useCallback(()=>{o({loading:!1,data:[],total:0,more:!1,hasNextPage:!1})},[]);return i.useEffect(()=>{Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_PAGE_VIEWED})},[]),e.jsx(hh.Provider,{value:{products:B,filters:g,pageSize:g.page_size,getRelatedList:H,onChangePagination:R,onChangeFilter:P,onClearFilter:w,fetchProductDiscovery:K,setLoadingProductList:W,featureLimit:p,setFeatureLimit:x,fetchRelatedKeywords:L,isImageSearchMode:T,imageSearch:{loading:b.loading,keywords:b.keywords,similarProducts:b.similarProducts,refresh:b.refresh},currentListingKeyword:O,setProductStateToEmpty:ie,addUrlProduct:j,removeUrlProduct:A,clearUrlProducts:E},children:t})},SS=()=>{const t=i.useContext(hh);if(!t)throw new Error("useAddProductContext must be used within a AddProductProvider");return t},jS=t=>t.filter((s,n,a)=>n===a.findIndex(r=>r.source_product_id===s.source_product_id));function ES(t){const s={source_product_id:t.source_product_id,source:t.source,name:t.name,currency:t.currency,price:t.price_range?.[0]??0,image:t.images?.[0]||"",latest_volume:String(t.lastest_volume??0),product_link:t.product_link||"",rating:t.avg_evaluation_rating??null,evaluateRate:t.evaluation_count??null,source_category_ids:[],tags:t.tags||[]};return s.lastest_volume=t.lastest_volume??0,s}
1704const Ji=500,TS=[{id:1,activeLabel:"Scanning sources",doneLabel:"Scanned sources"},{id:2,activeLabel:"Analyzing top 20 products",doneLabel:"Analyzed top 20 products"},{id:3,activeLabel:"Checking supplier stock and shipping reliability",doneLabel:"Checked supplier stock and shipping reliability"}],PS=(t,s)=>s===ui.aliexpress?t.split("?")[0]:t,Hw=()=>{const{filters:t,products:s}=SS(),{getUserInfo:n}=de(),a=n(),{getShop:r}=dt(),o=ke(Ai),l=r(),{isMobile:c}=xe(),u=he(dr),d=he(ka),g=he(dp),h=Number(t.page),[p,x]=i.useState(0),[f,_]=i.useState(0),[b,v]=i.useState(!1),[y,C]=i.useState(!0),S=i.useMemo(()=>s.data?.slice(0,20).map(P=>({...P,product_link:PS(P.product_link,P.source)}))??[],[s.data]),j=i.useMemo(()=>S.map(P=>P.source_product_id).join("-"),[S]),A=!!t?.keyword&&(h===1?!s.loading:!0)&&!!q.size(S)&&t?._is_budget_picks!==!0&&y,E=i.useMemo(()=>{if(!A)return"";const P={user:{email:a.email,store_id:l.id,store_domain:l.domain},keyword:t.keyword,products:S.map(W=>q.omit(W,["currency","source"])),language:o},w=JSON.stringify(P),N=new TextEncoder().encode(w),K=Array.from(N,W=>String.fromCharCode(W)).join("");return`https://ai-product-research.zopi.io/analysis#data=${btoa(K).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}`},[A,a.email,l.id,l.domain,t.keyword,S]),T=()=>{ge.sessionStorage.set(tn.AI_RESEARCH_COLLAPSED,!0),C(!1)};i.useEffect(()=>{const P=ge.sessionStorage.get(tn.AI_RESEARCH_COLLAPSED);if(Ce.isShopifyEmbedded()&&P){ge.sessionStorage.remove(tn.AI_RESEARCH_COLLAPSED);return}P&&C(!1)},[]),i.useEffect(()=>{if(x(0),_(0),v(!1),!A)return;const P=[];return P.push(setTimeout(()=>x(1),100)),P.push(setTimeout(()=>{_(1),x(2)},Ji)),P.push(setTimeout(()=>{_(2),x(3),v(!0)},Ji*2)),P.push(setTimeout(()=>_(3),Ji*3)),()=>P.forEach(clearTimeout)},[j]);const k=()=>{Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_RESEARCH_CLICKED,event_data:{keyword:t.keyword}}),g(E),u("ai-research"),d(!0)},O=S.slice(0,7),R=Math.max(0,S.length-7);return e.jsx(e.Fragment,{children:e.jsx(Qe,{open:A,id:"basic-collapsible",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(Q,{...c?{paddingInline:"200"}:{padding:"0"},children:e.jsx(Q,{padding:"400",borderColor:"border",background:"bg-surface",borderRadius:"300",borderWidth:"0165",children:e.jsxs("div",{style:{position:"relative"},children:[e.jsxs(D,{gap:"400",children:[e.jsxs("div",{className:"flex items-center justify-between ",children:[e.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg py-1 px-2",children:[e.jsx("img",{src:mA,alt:"Zopi AI",className:"w-4 h-4 shrink-0"}),e.jsx("span",{className:"text-sm font-semibold whitespace-nowrap",style:{backgroundImage:"linear-gradient(81.76deg, #10245a 1.73%, #695ee3 25.2%, #4477ed 46.89%, #5737e6 60.27%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:"AI Research"})]}),e.jsxs(U,{gap:"200",blockAlign:"center",wrap:!1,children:[t?.keyword&&!c&&e.jsxs(e.Fragment,{children:[" ",e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:"Result for "}),e.jsx(m,{as:"strong",variant:"bodySm",truncate:!0,fontWeight:"semibold",children:t?.keyword?.slice(0,25)+(t?.keyword?.length>25?"...":"")})]}),e.jsx(re,{icon:Ws,variant:"tertiary",size:"slim",onClick:()=>T()})]})]}),e.jsx("div",{style:{minHeight:135},className:"flex flex-col gap-3",children:TS.map(P=>{const w=p>=P.id,N=f>=P.id,K=w&&!N;return e.jsxs("div",{className:"flex items-center gap-2 px-2",style:{minHeight:32,opacity:w?1:0,transform:w?"translateY(0)":"translateY(8px)",transition:"opacity 0.4s ease-out, transform 0.4s ease-out"},children:[e.jsx("div",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:N?e.jsx("span",{className:"[&_svg]:fill-icon-success!",children:e.jsx(ee,{source:Je})}):K?e.jsx(nn,{size:"small"}):null}),e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"medium",children:N?P.doneLabel:P.activeLabel}),P.id===2&&w&&e.jsxs("div",{className:"flex items-center",style:{opacity:N?1:0,transition:"opacity 0.35s ease-out"},children:[O.map((L,W)=>e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",overflow:"hidden",border:"2px s
1704olid white",marginLeft:W>0?-7:6,zIndex:O.length-W,position:"relative",flexShrink:0,backgroundColor:"#e5e7eb"},children:e.jsx("img",{src:L.image,alt:L.name||"",style:{width:"100%",height:"100%",objectFit:"cover"},referrerPolicy:"no-referrer",loading:"lazy"})},L.source_product_id)),R>0&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",border:"2px solid white",marginLeft:-7,zIndex:0,position:"relative",flexShrink:0,backgroundColor:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("span",{style:{color:"white",fontSize:7,fontWeight:500,lineHeight:1},children:["+",R]})})]})]},P.id)})})]}),e.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:80,background:"linear-gradient(to top, white 30%, transparent)",opacity:b?1:0,transition:"opacity 0.55s ease-out",pointerEvents:b?"auto":"none",display:"flex",alignItems:"flex-end",justifyContent:"center"},children:e.jsxs("button",{onClick:k,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg cursor-pointer [&_span]:text-text-link",children:[e.jsx(Q,{children:e.jsx(ee,{source:Oa})}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:"View full research & ask questions"})]})})]})})})})})},IS=({url:t})=>t?e.jsx("iframe",{src:t,referrerPolicy:"no-referrer",className:"w-full",style:{height:"100%",display:"block"},allowFullScreen:!0}):e.jsx("iframe",{src:"https://ai-product-research.zopi.io/message",referrerPolicy:"no-referrer",className:"w-full",style:{height:"100%",display:"block"},allowFullScreen:!0}),an="https://gateway.zopi.io/api",RS=an,Vs={CREATE_THREADS:"/threads",SEARCH_THREADS:"/threads/search",CREATE_CHAT_MESSAGE_STREAM:"/threads/:threadId/runs/stream",STORE_UPDATE_THREAD:"/store/items",SEARCH_STORE_THREAD:"/store/items/search",CANCEL_RUN_STREAM:"/threads/:threadId/runs/:threadIdRun/cancel",CONNECTION:"/core/chat/connections",RUN_TEST_STREAM:"/runs/stream",AGENT_CHAT_HISTORY:"/core/chat/ai-agent/messages",AGENT_THREADS:"/core/chat/ai-agent/threads"},kS=async t=>{const s={thread_id:"",metadata:{},if_exists:"raise"};return X(`${an}${Vs.CREATE_THREADS}`,s,{method:"POST",headers:{app:"PH","store-id":String(t)}})},wS=async()=>{const t={metadata:{},values:{},status:"idle",limit:100,offset:0};return X(`${an}${Vs.SEARCH_THREADS}`,t,{method:"POST"})},NS=async(t,s,n)=>{const a=Vs.CREATE_CHAT_MESSAGE_STREAM.replace(":threadId",t.threadId),r=`${an}${a}`,o={assistant_id:"supervisor"},l=[];if(t.message||t.urlsFile.length>0){const c=`}) ${t.message||""}`;l.push({type:"text",text:t.urlsFile.length>0?c.trim():t.message})}if(t.urlsFile&&t.urlsFile.length>0)for(const c of t.urlsFile)l.push({type:"image_url",image_url:{url:c}});return l.length>0&&(o.input={messages:[{type:"human",content:l}]},o.config={recursion_limit:50},o.stream_mode=["messages-tuple","values"],o.on_disconnect="cancel",o.stream_subgraphs=!1,o.web_search=t.web_search||void 0),WS(r,o,s,n)},OS=async t=>X(`${an}${Vs.STORE_UPDATE_THREAD}`,t,{method:"PUT"}),DS=async(t,s)=>{const{filter:n,...a}=t,r={filter:{graph_id:"zopi_assistant"},namespace_prefix:["thread_history",s],offset:0,limit:50,...a,...n!=null?{filter:n}:{}};return X(`${an}${Vs.SEARCH_STORE_THREAD}`,r,{method:"POST",headers:{app:"PH"}})},LS=async t=>{const s={},n=Vs.CANCEL_RUN_STREAM.replace(":threadId",t.threadId||"").replace(":threadIdRun",t.threadIdRun||"");return X(`${an}${n}`,s,{method:"POST"})},MS=async(t,s)=>{const n={namespace_prefix:["thread_history",s],offset:0,limit:50,...t};return X(`${an}${Vs.CONNECTION}`,n,{method:"POST",headers:{app:"PH"}})},US=async t=>X(`${an}${Vs.CONNECTION}`,t,{method:"GET",headers:{app:"PH"}}),FS=async(t,s,n)=>{const a=t.threadId?`${an}${Vs.CREATE_CHAT_MESSAGE_STREAM.replace(":threadId",t.threadId)}`:`${an}${Vs.RUN_TEST_STREAM}`,r={assistant_id:"zopi_assistant",input:{messages:[{type:"human",content:t.message}]},config:{configurable:{test_skill_id:t.testSkillId,test_skill_type:t.skillType},recursion_limit:50},stream_mode:["messages-tuple","values"],on_disconnect:"cancel",stream_subgraphs:!1};return BS(a,r,s,n)},BS=async(t,s,n,a)=>{try{const r={"Content-Type":"application/json",Accept:"text/event-stream",app:"EXT"};n.token&&(r.Authorization=`Bearer ${n.token}`),n.workspace_id&&(r["workplace-id"]=String(n.workspace_id)),n.store_id&&(r["store-id"]=String(n.store_id));const o=await fetch(t,{method:"POST",headers:r,body:JSON.stringify(s)});if(!o.ok){const _=await o.text();a.onError?.({status:o.status,statusText:o.statusText,body:_});return}const l=o.body?.getReader();if(!l)return;const c=new TextDecoder("utf-8");let u="",d="",g=null;const h=(_,b)=>{if(b)return`Running tool: ${b}`;if(!_)return;const v=_.toLowerCase();return _==="model"?"Generating response":v.includes("intent")||v.includes("route")?"Understanding your request":v.includes("tool")?"Running tool":v.includes("memory")?"Recalling context":v.includes("plan")?"Planning next steps":v.includes("agent")?"Thinking":_.replace(/[._]/g," ").replace(/([a-z])([A-Z])/g,"$1 $2")},p=(_,b)=>{const v=h(_,b);a.onStatus?.(v??null)},x=_=>{let b;try{b=JSON.parse(_)}catch{return}if(d.startsWith("messages")&&Array.isArray(b)&&b.length>0){const v=b[0];if(!v)return;const C=b[1]?.langgraph_node??null,S=v.type==="AIMessageChunk"||v.type==="ai"||v.type==="AIMessage";if(S&&Array.isArray(v.tool_calls)&&v.tool_calls.length>
17040){const A=v.tool_calls[0]?.name;p(C,A);return}if(v.type==="tool"||v.tool_call_id){const A=v.name;p(C,A?`${A} result`:void 0);return}if(!S||(C&&C!==g&&(g=C,p(C)),C&&C!=="model")||v.type!=="AIMessageChunk")return;const j=v.content;if(typeof j=="string"&&j)a.onText?.(j);else if(Array.isArray(j))for(const A of j)A&&A.type==="text"&&typeof A.text=="string"&&A.text&&a.onText?.(A.text)}};for(;;){const{value:_,done:b}=await l.read();if(b)break;u+=c.decode(_,{stream:!0});const v=u.split(` 1705`);u=v.pop()||"";for(const y of v){const C=y.trim();if(C!==""){if(C.startsWith("event:")){d=C.replace(/^event:\s*/,"");continue}C.startsWith("data:")&&x(C.replace(/^data:\s*/,""))}}}const f=u.trim();f.startsWith("data:")&&x(f.replace(/^data:\s*/,"")),a.onStatus?.(null),a.onDone?.()}catch(r){a.onError?.(r)}},HS=async t=>X(Vs.AGENT_CHAT_HISTORY,{thread_id:t.threadId,page:t.page??1},{}),GS=async()=>X(Vs.AGENT_THREADS,{},{}),hn={postCreateThreads:kS,getSearchThreads:wS,getAgentChatHistory:HS,getAgentThreads:GS,createChatMessageStream:NS,putStoreUpdateThread:OS,searchStoreThread:DS,stopStream:LS,postCreateConnection:MS,getListConnection:US,runTestStream:FS},WS=async(t,s,n,a)=>{try{const r=n.token,o=n.workspace_id,l=new Headers;l.app="EXT";try{r&&!l.Authorization&&(l.Authorization=`Bearer ${r}`),o&&!l["workplace-id"]&&(l["workplace-id"]=o)}catch{}const c=await fetch(t,{method:"POST",headers:{...l,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(s)});if(!c.ok){const h=await c.text();a.onError?.({status:c.status,statusText:c.statusText,body:h});return}const u=c.body?.getReader();if(!u)return;const d=new TextDecoder("utf-8");let g="";for(;;){const{value:h,done:p}=await u.read();if(p)break;g+=d.decode(h,{stream:!0});const x=g.split(` 1706`);g=x.pop()||"";for(const f of x){const _=f.trim();if(_!==""){if(_.startsWith("data:")){const b=_.replace("data: ","");try{const v=JSON.parse(b);a.onMessage?.(v)}catch(v){console.warn("err",v)}}if(_.startsWith("event:")){const b=_.replace(/^event:\s*/,"");g=""}}}}if(g.trim()!==""){const h=g.trim();if(h.startsWith("data:")){const p=h.replace("data: ","");try{const x=JSON.parse(p);a.onMessage?.(x)}catch(x){console.warn("err at final buffer",x)}}else h.startsWith("event:")}a.onDone?.()}catch(r){a.onError?.(r)}},VS=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 16 16",...t,children:[e.jsx("mask",{id:"path-1-inside-1_21287_15268",fill:"#fff",children:e.jsx("path",{d:"M12.208 1.817a.495.495 0 0 0-.146-.71 8 8 0 1 0 3.369 3.929.495.495 0 0 0-.679-.253.553.553 0 0 0-.264.702 6.958 6.958 0 1 1-3.013-3.514c.249.143.572.084.733-.154"})}),e.jsx("path",{stroke:"currentColor",strokeWidth:"1.6",d:"M12.208 1.817a.495.495 0 0 0-.146-.71 8 8 0 1 0 3.369 3.929.495.495 0 0 0-.679-.253.553.553 0 0 0-.264.702 6.958 6.958 0 1 1-3.013-3.514c.249.143.572.084.733-.154Z",mask:"url(#path-1-inside-1_21287_15268)"}),e.jsx("mask",{id:"path-2-inside-2_21287_15268",fill:"#fff",children:e.jsx("path",{fillRule:"evenodd",d:"M9.178 4h.556L11.2 6.592 9.734 9.183h-.556l1.467-2.591zm-2.356 8h-.556L4.8 9.408l1.466-2.591h.556L5.355 9.408zm2.124 0H8.39L6.924 9.408l1.594-2.816L7.052 4h.555l1.467 2.592L7.48 9.408z",clipRule:"evenodd"})}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.178 4h.556L11.2 6.592 9.734 9.183h-.556l1.467-2.591zm-2.356 8h-.556L4.8 9.408l1.466-2.591h.556L5.355 9.408zm2.124 0H8.39L6.924 9.408l1.594-2.816L7.052 4h.555l1.467 2.592L7.48 9.408z",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",d:"M9.178 4v-.96H7.532l.81 1.433zm.556 0 .835-.473-.276-.487h-.56zM11.2 6.592l.836.472.267-.472-.267-.473zM9.734 9.183v.96h.56l.275-.487zm-.556 0-.835-.473-.811 1.433h1.646zm1.467-2.591.835.472.268-.472-.268-.473zM6.822 12v.96h1.646l-.81-1.433zm-.556 0-.835.473.276.487h.56zM4.8 9.408l-.835-.472-.268.472.268.473zm1.466-2.591v-.96h-.56l-.275.487zm.556 0 .835.473.811-1.433H6.822zM5.355 9.408l-.835-.472-.268.472.268.473zM8.945 12v.96h1.647l-.81-1.433zm-.555 0-.835.473.276.487h.56zM6.924 9.408l-.835-.472-.268.472.268.473zm1.594-2.816.836.472.267-.472-.267-.473zM7.052 4v-.96H5.406l.81 1.433zm.555 0 .836-.473-.276-.487h-.56zm1.467 2.592.835.472.268-.472-.268-.473zM7.48 9.408l-.836-.472-.268.472.268.473zM9.178 4v.96h.556V3.04h-.556zm.556 0-.836.473 1.467 2.591.835-.472.836-.473-1.467-2.592zM11.2 6.592l-.835-.473L8.897 8.71l.836.473.835.473 1.467-2.592zM9.734 9.183v-.96h-.556v1.92h.556zm-.556 0 .836.473 1.466-2.592-.835-.472-.836-.473L8.343 8.71zm1.467-2.591.835-.473-1.466-2.592L9.178 4l-.835.473 1.466 2.591zM6.822 12v-.96h-.556v1.92h.556zm-.556 0 .836-.473-1.466-2.591-.836.472-.835.473 1.466 2.592zM4.8 9.408l.836.473L7.102 7.29l-.836-.473-.835-.473-1.466 2.592zm1.466-2.591v.96h.556v-1.92h-.556zm.556 0-.836-.473L4.52 8.936l.835.472.836.473L7.657 7.29zM5.355 9.408l-.835.473 1.466 2.592.836-.473.835-.473-1.466-2.591zM8.945 12v-.96H8.39v1.92h.556zm-.555 0 .836-.473L7.76 8.936l
1706-.836.472-.835.473 1.466 2.592zM6.924 9.408l.836.473 1.594-2.817-.836-.472-.835-.473-1.594 2.817zm1.594-2.816.836-.473-1.467-2.592L7.052 4l-.836.473 1.467 2.591zM7.052 4v.96h.555V3.04h-.555zm.555 0-.835.473 1.466 2.591.836-.472.835-.473-1.466-2.592zm1.467 2.592-.836-.473-1.594 2.817.835.472.836.473 1.594-2.817zM7.48 9.408l-.836.473 1.466 2.592.836-.473.835-.473-1.466-2.591z",mask:"url(#path-2-inside-2_21287_15268)"}),e.jsx("g",{clipPath:"url(#clip0_21287_15268)",children:e.jsx("path",{fill:"currentColor",stroke:"currentColor",strokeWidth:"0.8",d:"M13.387 1.731c.291.534.726.974 1.253 1.269a3.2 3.2 0 0 0-1.253 1.269 3.2 3.2 0 0 0-1.254-1.27 3.2 3.2 0 0 0 1.254-1.268Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_21287_15268",children:e.jsx("path",{fill:"#fff",d:"M10.775.333h5.224v5.333h-5.224z"})})})]});var bd,yd,Cd;function Uo(){return Uo=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Uo.apply(null,arguments)}const Gw=t=>i.createElement("svg",Uo({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},t),bd||(bd=i.createElement("path",{fill:"#5546FF",d:"M7.13 12.044H4.606q-.345 0-.5-.3a.51.51 0 0 1 .046-.577l4.763-6.9a.6.6 0 0 1 .322-.241.62.62 0 0 1 .406.018.54.54 0 0 1 .309.257q.094.18.07.392l-.596 4.812h3.035q.356 0 .503.325a.53.53 0 0 1-.08.6l-5.3 6.35a.585.585 0 0 1-.706.166.592.592 0 0 1-.358-.632z"})),yd||(yd=i.createElement("path",{fill:"#5546FF",stroke:"#5546FF",strokeLinejoin:"round",strokeWidth:.473,d:"M11.738 8.114c1.977 0 2.839-.832 2.839-2.839 0 2.007.855 2.839 2.838 2.839-1.982 0-2.838.856-2.838 2.839 0-1.983-.862-2.84-2.839-2.84Z"})),Cd||(Cd=i.createElement("path",{fill:"#5546FF",stroke:"#5546FF",strokeLinejoin:"round",strokeWidth:.346,d:"M2 12.775c.884 0 1.27-.372 1.27-1.27 0 .898.382 1.27 1.269 1.27-.887 0-1.27.383-1.27 1.27 0-.887-.385-1.27-1.269-1.27Z"}))),gh="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.13065%2012.044H4.6048C4.37521%2012.044%204.20879%2011.9439%204.10556%2011.7436C4.00232%2011.5433%204.01755%2011.3513%204.15125%2011.1674L8.9144%204.26676C9.00071%204.14547%209.10789%204.06508%209.23595%204.02559C9.364%203.98611%209.49939%203.99231%209.64211%204.04421C9.78484%204.09611%209.88779%204.18186%209.95097%204.30145C10.0142%204.42104%2010.0373%204.55164%2010.0204%204.69323L9.42549%209.50546H12.4599C12.6968%209.50546%2012.8647%209.61349%2012.9634%209.82955C13.0627%2010.0456%2013.0359%2010.2459%2012.883%2010.4303L7.58251%2016.7792C7.49225%2016.8864%207.38338%2016.9549%207.25589%2016.9848C7.12783%2017.0142%207.00147%2017.0009%206.8768%2016.9451C6.75213%2016.8898%206.65679%2016.806%206.59079%2016.6938C6.52535%2016.5815%206.50137%2016.4546%206.51886%2016.313L7.13065%2012.044Z'%20fill='%235546FF'/%3e%3cpath%20d='M11.7383%208.11393C13.7152%208.11393%2014.5768%207.28224%2014.5768%205.27539C14.5768%207.28224%2015.4325%208.11393%2017.4154%208.11393C15.4325%208.11393%2014.5768%208.96959%2014.5768%2010.9525C14.5768%208.96959%2013.7152%208.11393%2011.7383%208.11393Z'%20fill='%235546FF'%20stroke='%235546FF'%20stroke-width='0.473089'%20stroke-linejoin='round'/%3e%3cpath%20d='M2%2012.7751C2.88398%2012.7751%203.26927%2012.4032%203.26927%2011.5059C3.26927%2012.4032%203.65189%2012.7751%204.53854%2012.7751C3.65189%2012.7751%203.26927%2013.1577%203.26927%2014.0444C3.26927%2013.1577%202.88398%2012.7751%202%2012.7751Z'%20fill='%235546FF'%20stroke='%235546FF'%20stroke-width='0.346165'%20stroke-linejoin='round'/%3e%3c/svg%3e",YS=async()=>X("/core/user/ai-skills",{},{}),zS=async t=>{const{skill_id:s}=t,n="/core/user/ai-skills/:skillId".replace(":skillId",s.toString());return X(n,{},{})},KS=async t=>X("/core/user/ai-skills",t,{method:"POST"}),QS=async(t,s)=>{const n="/core/user/ai-skills/:skillId".replace(":skillId",s.toString());return X(n,t,{method:"PUT"})},qS=async t=>X("/core/user/ai-skills/tools/suggest",t,{method:"POST"}),ZS=async()=>X("/core/user/ai-skills/mcp-tools",{},{}),XS=async t=>X("/core/user/ai-skills/generate",t,{method:"POST"}),JS=async t=>X("/core/user/ai-skills/refine",t,{method:"POST"}),$S=async t=>{const s="/core/user/ai-skills/system/:skillId".replace(":skillId",t.skill_id.toString());return X(s,{},{})},ej=async t=>{const s="/core/user/ai-skills/:skillId/reset-to-default".replace(":skillId",t.toString());return X(s,{},{method:"POST"})},tj=async t=>{const s="/core/user/ai-skills/:skillId".replace(":skillId",t.toString());return X(s,{},{method:"DELETE"})},Hs={getListSkill:YS,getDetailSkill:zS,getSystemSkillDetail:$S,createSkill:KS,updateSkill:QS,deleteSkill:tj,resetToDefault:ej,getToolSelected:qS,getMcpTools:ZS,generateSkill:XS,refineSkill:JS},Fo=()=>{const t=ws();return br({mutationFn:({params:s,skillId:n})=>Hs.updateSkill(s,n),onSuccess:(s,n)=>{t.invalidateQueries({queryKey:vt.ai_assistant.detailSkill(n.skillId)}),t.invalidateQueries({queryKey:vt.ai_assistant.listSkill()})}})},mh=()=>{const t=ws();return br({mutationFn:s=>Hs.createSkill(s),onSuccess:()=>{t.invalidateQueries({queryKey:vt.ai_assistant.listSkill()})}})},fh=()=>{const t=ws();return br({mutationFn:s=>Hs.deleteSkill(s),onSuccess:(s,n)=>{t.invalidateQueries({queryKey:vt.ai_assistant.detailSkill(n)}),t.invalidateQueries({queryKey:vt.ai_assistant.listSkill()})}})},xh=()=>ks({queryKey:vt.ai_assistant.mcpTools(),queryFn:async()=>(await Hs.getMcpTools())?.data?.tools??[],staleTime:5*60*1e3}),sj=new Set(["check_permissions_quota","update_settings","search_zopi_docs","zopi_support"]),nj=["sc
1706hedule","scheduler","calendar","reminder","cron"],aj=["product","products","supplier","suppliers"],rj=["order","orders"],ij=[{labelKey:"Scheduler",icon:Og,keywords:nj},{labelKey:"Product",icon:ms,keywords:aj},{labelKey:"Order",icon:is,keywords:rj}];function oj(t,s){const n=t.toLowerCase();return s.some(a=>n.includes(a))}function lj({name:t,description:s}){return e.jsxs("div",{className:"flex flex-col gap-1.5 p-3 rounded-lg border-[0.6px] border-[#e3e3e3] bg-white overflow-hidden min-w-0",children:[e.jsx("span",{className:"bg-black/[0.06] px-2 py-0.5 rounded-lg h-5 inline-flex items-center w-fit",children:e.jsx("span",{className:"font-mono text-[12px] text-[#303030] leading-4 whitespace-nowrap",children:t})}),e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:s})]})}function cj({label:t,icon:s,tools:n}){return n.length?e.jsx("div",{className:"flex flex-col overflow-hidden rounded-xl bg-bg-surface w-full",children:e.jsxs("div",{className:"flex flex-col gap-3 p-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-1.5 w-fit",children:[e.jsx(ee,{source:s}),e.jsx(m,{as:"span",variant:"headingSm",children:t})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(a=>e.jsx(lj,{name:a.name,description:a.description||""},a.name))})]})}):null}function dj({open:t,onClose:s}){const{t:n}=J(),{data:a=[],isLoading:r}=xh(),o=i.useMemo(()=>{const l=a.filter(g=>!sj.has(g.name));if(!l.length)return[];const c=new Set,u=[];for(const g of ij){const h=l.filter(p=>!c.has(p.name)&&oj(p.name,g.keywords));h.length&&(h.forEach(p=>c.add(p.name)),u.push({label:n(g.labelKey),icon:g.icon,tools:h}))}const d=l.filter(g=>!c.has(g.name));return d.length&&u.push({label:n("Other"),icon:Oa,tools:d}),u},[a,n]);return e.jsx(Is,{visible:t,onClose:s,width:737,children:e.jsxs("div",{className:"h-full flex flex-col bg-bg-surface-secondary",children:[e.jsxs("div",{className:"p-4 flex items-start gap-2",children:[e.jsx(re,{icon:Mn,variant:"tertiary",onClick:s}),e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"h2",variant:"headingLg",fontWeight:"semibold",children:n("BuiltInTools")}),e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:n("BuiltInToolsDrawerSubtitle")})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(Q,{padding:"400",children:r?e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(Pa,{size:"small"})}):o.length?e.jsx(D,{gap:"400",children:o.map(l=>e.jsx(cj,{...l},l.label))}):e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:n("NoData")})})})]})})}const $i={skillName:"",description:"",autoGeneratedFromInstruction:!1};function uj({open:t,onClose:s,initialValues:n,onSave:a,saving:r}){const{t:o}=J(),[l,c]=i.useState(""),[u,d]=i.useState(""),[g,h]=i.useState(!1);i.useEffect(()=>{t&&(c(n?.skillName??$i.skillName),d(n?.description??$i.description),h(n?.autoGeneratedFromInstruction??$i.autoGeneratedFromInstruction))},[t,n?.skillName,n?.description,n?.autoGeneratedFromInstruction]);const p=()=>{s()},x=()=>{a?.({skillName:l,description:u,autoGeneratedFromInstruction:g})};return e.jsx(Xe,{title:e.jsx(m,{as:"span",variant:"headingLg",fontWeight:"semibold",children:o("EditDescription")}),open:t,onClose:p,primaryAction:{content:o("Save"),onAction:x,loading:r,disabled:!l.trim()},secondaryActions:[{content:o("Cancel"),onAction:p,disabled:r}],children:e.jsx(Q,{padding:"400",children:e.jsxs(D,{gap:"400",children:[e.jsx(ar,{label:o("SkillName"),value:l,onChange:c,autoComplete:"off",disabled:g}),e.jsx(ar,{label:o("Description"),value:u,onChange:d,multiline:5,autoComplete:"off",disabled:g})]})})})}function pj({skill:t,onClose:s,onSkillUpdated:n}){const{t:a}=J(),r=bt();pt();const{mutateAsync:o,isPending:l}=Fo(),[c,u]=i.useState(!1),[d,g]=i.useState(!1),[h,p]=i.useState(""),[x,f]=i.useState(!1),[_,b]=i.useState(null),[v,y]=i.useState(new Set),[C,S]=i.useState(!1),{mutate:j,mutateAsync:A,isPending:E}=mh(),{mutate:T,isPending:k}=Fo(),{mutate:O,isPending:R}=fh(),P=async()=>{const ie=h.trim();if(!(!ie||x)){f(!0);try{const M=(await Hs.generateSkill({text:ie}))?.data?.skill;M&&(b(M),y(new Set(M.actions.map(I=>I.name))))}finally{f(!1)}}},w=i.useCallback(ie=>{if(!t)return null;
1706const V=ie.autoGeneratedFromInstruction,M=V?t.display_name:ie.skillName.trim(),I=V?t.description:ie.description.trim(),F=V?t.display_description:ie.description.trim();return{system_skill_id:t.system_skill_id??null,name:t.name,display_name:M,description:I,display_description:F,system_prompt:t.system_prompt,status:t.status,display:!0,tools:(t.tools??[]).map(G=>({name:G.name,config:G.config})),instruction_raw:t.user_instruction_raw??t.instruction_raw??h}},[t,h]),N=_?_.is_safe:!0;_?.warnings;const K=t?.id,L=t?.skill_type,W=L==="system",Z=!W&&!!t?.system_skill_id||W&&t?.is_customized,te=W&&t?.is_customized?t.id:W?void 0:K,ne=()=>{if(!N)return;const ie=Array.from(v).map(z=>{const me=_?.actions.find(Be=>Be.name===z),Re=t?.tools.find(Be=>Be.name===z);return{name:z,config:me?.config||Re?.config||{}}}),V=_?.title||t?.name||"",M=_?.title||t?.display_name||"",I=_?.description||t?.description||"",F=_?.system_prompt||t?.system_prompt||"",G={system_skill_id:W?K??0:t?.system_skill_id??null,name:V,display_name:M,description:I,display_description:I,system_prompt:F,status:t?.status??"enabled",display:!0,tools:ie,instruction_raw:h};if(W)t?.is_customized&&te?T({params:G,skillId:te}):j(G,{onSuccess:z=>{z?.data?.skill?.id&&z?.data?.skill&&n?.(z?.data?.skill)}});else if(K){if(!t)return;T({params:G,skillId:K})}else j(G,{onSuccess:z=>{z?.data?.skill?.id&&z?.data?.skill&&n?.(z?.data?.skill)}})},le=async()=>{if(!(!te||C)){S(!0);try{await Hs.resetToDefault(te),sc.invalidateQueries({queryKey:[vt.ai_assistant.detailSkill(K)]}),sc.invalidateQueries({queryKey:vt.ai_assistant.listSkill()}),r.success(a("ResetToDefaultSuccessfully")),b(null)}finally{S(!1)}}},B=async ie=>{if(!t?.id)return;const V=w(ie);if(V)try{if(L==="user"){const z=(await o({params:V,skillId:t.id}))?.data?.skill;if(!z)return;r.success(a("UpdateSuccessfully")),n?.(z),u(!1);return}const M={...V,system_skill_id:t.id},F=(await A(M))?.data?.skill;if(!F)return;r.success(a("UpdateSuccessfully")),n?.({...F,skill_type:"user"}),u(!1)}catch{}};return i.useEffect(()=>{p(t?.user_instruction_raw??t?.instruction_raw??"")},[t?.id,t?.user_instruction_raw,t?.instruction_raw]),e.jsxs("div",{className:"bg-bg-surface grid gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 w-fit",children:[e.jsx(re,{icon:Mn,variant:"tertiary",onClick:s}),e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:a("SkillDetail")}),e.jsx(Bs,{children:t?.skill_type==="system"?"System pre-built":"Custom"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[K&&!W&&e.jsx(re,{variant:"secondary",children:a("DisableSkill")}),e.jsx(re,{variant:"secondary",onClick:le,loading:C,disabled:!Z,children:a("ResetToDefault")}),e.jsx(re,{variant:"primary",onClick:ne,children:a("SaveSkill")})]})]}),e.jsxs("div",{className:"p-3 bg-bg-surface-secondary rounded-xl grid gap-1",children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:t?.display_name??t?.name??""}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:t?.display_description||t?.description||""})}),e.jsx(re,{icon:Cp,variant:"tertiary",disabled:!t?.id,onClick:()=>t?.id&&u(!0)})]})]}),e.jsxs("div",{className:"rounded-xl border border-[#e3e3e3] overflow-hidden flex flex-col bg-bg-surface-secondary",children:[e.jsxs("div",{className:"p-3 grid gap-1",children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:a("Instruction")}),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:a("InstructionNaturalLanguageSubtitle")})]}),e.jsx("div",{className:"bg-[#fdfdfd] border-t border-[#e3e3e3] flex flex-col gap-4 roun
1706ded-lg [&_.Polaris-TextField\\_\\_Backdrop]:border-none! [&_.Polaris-TextField\\_\\_Backdrop]:outline-none! [&_textarea]:py-2!",children:e.jsxs("div",{className:"relative",children:[e.jsx(gt,{label:"",labelHidden:!0,multiline:5,autoComplete:"off",placeholder:"Describe what you want your assistant to do in natural language.",value:h,onChange:p}),e.jsx("div",{className:"flex items-center justify-end absolute z-50 bottom-2 left-0 w-full px-3",children:e.jsx(U,{gap:"300",blockAlign:"center",children:e.jsx("button",{className:oe("w-8 h-8 flex items-center justify-center rounded-full bg-[#303030] text-white shrink-0",x?"cursor-not-allowed":"cursor-pointer"),onClick:P,disabled:x,children:x?e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):e.jsx(ee,{source:vp})})})})]})})]}),_&&e.jsxs("div",{className:"bg-bg-surface-secondary rounded-xl overflow-hidden grid gap-1 border border-border",children:[e.jsxs("div",{className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{className:"grid gap-1",children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:a("Capabilities")}),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:a("SystemWillAutoselectBasedOnYourInstruction")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-0.5 cursor-pointer bg-transparent border-0 p-0 text-inherit",onClick:()=>g(!0),children:[e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:a("ViewAllTools")}),e.jsx(ds,{source:Ys})]})]}),e.jsx("div",{className:"p-3 bg-bg-surface grid gap-3",children:_.actions.map(ie=>e.jsxs("div",{className:"flex flex-col gap-1.5 overflow-hidden min-w-0 not-last:border-b border-border not-last:pb-3",children:[e.jsx("span",{className:"bg-black/[0.06] px-2 py-0.5 rounded-lg h-5 inline-flex items-center w-fit",children:e.jsx("span",{className:"font-mono text-[12px] text-[#303030] leading-4 whitespace-nowrap",children:ie.name})}),e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:ie.description})]},ie.name))})]}),e.jsx(dj,{open:d,onClose:()=>g(!1)}),e.jsx(uj,{open:c,onClose:()=>u(!1),saving:l||E,initialValues:{skillName:t?.display_name??t?.name??"",description:t?.display_description??t?.description??"",autoGeneratedFromInstruction:!1},onSave:B})]})}const hj=()=>ks({queryKey:vt.ai_assistant.listSkill(),queryFn:async()=>(await Hs.getListSkill())?.data?.skills||[],staleTime:5*60*1e3}),gj=()=>({useParams:ym()}),mj=t=>t<100?1:t<500?2:t<2e3?5:10,fj=({text:t,urlEmbeded:s,onFinish:n})=>{const[a,r]=i.useState(""),[o,l]=i.useState(0),c=i.useRef(!1);return i.useEffect(()=>{if(o<t.length){c.current=!1;const u=mj(t.length),g=setTimeout(()=>{r(h=>h+t.slice(o,o+u)),l(h=>h+u)},20);return()=>clearTimeout(g)}else o>=t.length&&t.length>0&&(c.current||(c.current=!0,n?.()))},[o,t,n]),i.useEffect(()=>{t.length<a.length&&(r(""),l(0),c.current=!1)},[t,a.length]),e.jsx("div",{className:"message-text overflow-hidden",children:e.jsx(Ma,{components:{a:({node:u,href:d="",children:g,...h})=>{let p=d;const f=["https://ds.zopi.io","https://ds.qc2.zopi.io","https://ds.staging.zopi.io","https://ds.qc.zopi.io"].find(_=>d.startsWith(_));return f?(p=d.replace(f,""),e.jsx(fr,{...h,to:p,rel:"noopener noreferrer",children:g})):e.jsx("a",{target:"_blank",href:d,rel:"noopener noreferrer",children:g})}},children:a.replace(/\n/g,` 1707 `)})})},_h=({text:t,isStreaming:s,urlEmbeded:n,onFinish:a})=>{const[r,o]=i.useState(""),l=i.useRef("");return i.useEffect(()=>{if(t){if(t.startsWith(l.current)||(o(""),l.current=""),t.length>l.current.length){const c=t.slice(l.current.length);o(u=>u+c),l.current=t}!s&&t.length>0&&a?.()}},[t,s,a]),e.jsx(fj,{urlEmbeded:n,text:r})};se.div` 1708 height: 100%; 1709 width: 100%; 1710 padding: var(--p-space-400); 1711`;se.img` 1712 height: 90px; 1713 object-fit: cover; 1714 margin: 0 auto; 1715 display: block; 1716`;se.div` 1717 height: 100%; 1718 display: grid; 1719 grid-template-rows: ${({isUseForMobile:t=!1})=>t?"auto auto minmax(0, 1fr)":"auto minmax(0, 1fr)"}; 1720 gap: var(--p-space-400); 1721`;se.div` 1722 height: 200px; 1723 [data-style='box-content'] { 1724 height: 100%; 1725 display: grid; 1726 grid-template-rows: auto minmax(0, 1fr); 1727 } 1728`;se.div` 1729 background-color: var(--p-color-bg-surface-magic); 1730 border-radius: var(--p-border-radius-200); 1731 padding: 0 60px; 1732 display: flex; 1733 flex-direction: column; 1734 gap: var(--p-space-400); 1735 justify-content: center; 1736 height: 100%; 1737 1738 .Polaris-Button { 1739 color: var(--p-color-text-magic); 1740 width: max-content; 1741 margin: 0 auto; 1742 } 1743`;se.div` 1744 padding: var(--p-space-100); 1745 background: var(--p-color-bg-surface); 1746 border-radius: var(--p-border-radius-200); 1747 display: grid; 1748 grid-template-columns: repeat(4, 1fr); 1749 border: 1px solid var(--p-color-border); 1750 gap: 4px; 1751`;se.div` 1752 height: 28px; 1753 border-radius: var(--p-border-radius-100); 1754 background: transparent; 1755 display: flex; 1756 align-items: center; 1757 justify-content: center; 1758 cursor: pointer; 1759 min-width: 95px; 1760 &:hover { 1761 background: var(--p-color-bg-surface-magic-hover); 1762 } 1763 &[data-active='true'] { 1764 background: var(--p-color-bg-surface-magic-active); 1765 } 1766`;se.div` 1767 ${({isHasIcon:t=!0})=>t?Ps` 1768 .Polaris-Button { 1769 flex-direction: row-reverse; 1770 padding-left: var(--pc-button-padding-inline); 1771 padding-right: calc(var(--pc-button-padding-inline) * 0.5); 1772 display: flex; 1773 justify-content: space-between; 1774 } 1775 `:""} 1776`;se.div` 1777 .Polaris-ActionList__Item { 1778 &:hover { 1779 background-color: var(--p-color-bg-surface-magic-hover); 1780 } 1781 } 1782 .Polaris-ActionList--active { 1783 background-color: var(--p-color-bg-surface-magic-active); 1784 } 1785`;const xj=da` 1786 0% { 1787 background-position: 200% 200%; 1788 1789 } 1790 100% { 1791 background-position: -200% -200%; 1792 } 1793`,_j=se.div` 1794 position: absolute; 1795 top: 0; 1796 left: 0; 1797 width: 100%; 1798 height: 100%; 1799 pointer-events: none; 1800 transition: all 0.5s ease; 1801 background: linear-gradient( 1802 103.94deg, 1803 rgba(255, 255, 255, 0) 21.7%, 1804 rgba(255, 255, 255, 0.7) 50.62%, 1805 rgba(255, 255, 255, 0) 81.51% 1806 ); 1807 /* background: linear-gradient(103.94deg, rgba(255, 255, 255, 0) 21.7%, #ffffff 50.62%, rgba(255, 255, 255, 0) 81.51%); */ 1808 background-size: 200% 100%; 1809 animation: ${({$customTime:t})=>Ps` 1810 ${xj} ${t||5}s linear infinite 1811 `}; 1812 box-shadow: none; 1813 z-index: 100; 1814`,bj=da` 1815 0% { 1816 background-position: 200% 0; 1817 } 1818 100% { 1819 background-position: -200% 0; 1820 } 1821`;se.div` 1822 height: 12px; 1823 width: ${({width:t})=>t||"100%"}; 1824 border-radius: 4px; 1825 background: linear-gradient(90deg, #cbd9ff 0%, #e9e1ff 25%, #fcf3ff 50%, #e9e1ff 75%, #cbd9ff 100%); 1826 background-size: 200% 100%; 1827 animation: ${bj} 3s infinite linear; 1828 margin-bottom: 8px; 1829`;se.div` 1830 position: absolute; 1831 top: 0; 1832 left: 0; 1833 width: 100%; 1834 height: 100%; 1835 background: white; 1836 padding: 8px 0; 1837 z-index: 100; 1838 display: flex; 1839 flex-direction: column; 1840 justify-content: center; 1841`;const yj=["Please wait a moment","AI is processing data","AI is sending the answer"],Cj=(t,s)=>{const[n,a]=i.useState(0);return i.useEffect(()=>{a(0)},[t]),i.useEffect(()=>{if(n>=t.length-1)return;const r=setInterval(()=>{a(o=>o>=t.length-1?o:o+1)},s);return()=>clearInterval(r)},[n,t,s]),t[n]},bh=({status:t,size:s="md",rotation:n=yj,rotationInterval:a=5e3})=>{const r=Cj(n,a),o=t||r,l=s==="sm"?"bodySm":"bodyLg",c=s==="sm"?14:18,u=s==="sm"?"-mt-3":"-mt-4";return e.jsxs("div",{className:"flex items-center gap-2 italic relative",children:[e.jsx(m,{as:"span",variant:l,fontWeight:"regular",children:e.jsx("span",{className:"msi-gradient-text",children:o})}),e.jsxs("span",{className:`flex ml-1 ${u}`,children:[e.jsx("span",{className:"msi-dot msi-dot-pulse msi-dot-d0",style:{fontSize:c},children:"."}),e.jsx("span",{className:"msi-dot msi-dot-pulse msi-dot-d1",style:{fontSize:c},children:"."}),e.jsx("span",{className:"msi-dot msi-dot-pulse msi-dot-d2",style:{fontSize:c},children:"."})]}),e.jsx(_j,{$customTime:3,className:"h-[74px]"}),e.jsx("style",{children:` 1842 .msi-gradient-text { 1843 background: linear-gradient( 1844 90deg, 1845 rgb(131, 34, 255), 1846 rgb(117, 87, 255), 1847 rgb(115, 91, 255), 1848 rgb(76, 233, 255) 1849 ); 1850 background-size: 200% 100%; 1851 background-position: 0% 50%; 1852 -webkit-background-clip: text; 1853 -webkit-text-fill-color: transparent; 1854 background-clip: text; 1855 color: transparent; 1856 animation: msiMoveGradient 4s linear infinite; 1857 } 1858 .msi-dot { 1859 display: inline-block; 1860 font-weight: bold; 1861 } 1862 .msi-dot-pulse { 1863 animation: msiPulseScale 1.2s infinite ease-in-out; 1864 } 1865 .msi-dot-d0 { animation-delay: 0s; } 1866 .msi-dot-d1 { animation-delay: 0.2s; } 1867 .msi-dot-d2 { animation-delay: 0.4s; } 1868 @keyframes msiPulseScale { 1869 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; } 1870 40% { transform: scale(1.6); opacity: 1; } 1871 } 1872 `})]})},vj=["https://ds.zopi.io","https://ds.qc2.zopi.io","https://ds.staging.zopi.io","https://ds.qc.zopi.io"],Aj=({skillId:t,initialMessage:s,onClose:n,skillType:a})=>{const r=de(),{getShop:o}=dt(),l=r.getToken()||"",c=Number(r.getCurrentWorkPlace()?.id)||void 0,u=Number(ge.shopStorage.getCurrentShopId())||void 0,d=o(),g=Ce.isShopifyEmbedded()?`${Ts.shopify.admin_app_new.replace("{{domain}}",d?.platform_domain?.replace(/.myshopify.com/,"")||"")}`:"",[h,p]=i.useState([]),[x,f]=i.useState(""),[_,b]=i.useState(!1),v=i.useRef(null),y=i.useRef(!1),C=i.useRef(!1),S=i.useRef(null),j=i.useRef(""),A=i.useRef(null),E=()=>j.current?Promise.resolve(j.current):(A.current||(A.current=hn.postCreateThreads().then(P=>{const w=P?.thread_id||"";return j.current=w,w}).catch(()=>(A.current=null,""))),A.current);i.useEffect(()=>{const P=v.current;P&&(P.scrollTop=P.scrollHeight)},[h]);const T=async P=>{if(!P||y.current)return;const w=`u-${Date.now()}`,N=`a-${Date.now()}`;p(L=>[...L,{id:w,role:"user",text:P},{id:N,role:"ai",text:""}]),y.current=!0,S.current=N,b(!0);const K=await E();await hn.runTestStream({testSkillId:t,message:P,skillType:a,threadId:K||void 0},{token:l,workspace_id:c,store_id:u},{onText:L=>{p(W=>W.map(H=>H.id===N?{...H,text:H.text+L}:H))},onStatus:L=>{p(W=>W.map(H=>H.id===N?{...H,status:L}:H))},onDone:()=>{y.current=!1,S.current=null,b(!1),p(L=>L.map(W=>W.id===N?{...W,status:null}:W))},onError:L=>{y.current=!1,S.current=null,b(!1),p(W=>W.map(H=>H.id===N?{...H,status:null,text:H.text||`Failed to run test${L?.status?` (${L.status})`:""}. Please try again.`}:H))}})};i.useEffect(()=>{if(C.current)return;const P=s?.trim();P&&(C.current=!0,T(P))},[s]);const k=()=>{const P=x.trim();P&&(f(""),T(P))},O=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),k())},R=x.trim().length>0&&!_;return e.jsxs("div",{className:"w-[420px] shrink-0 bg-white rounded-[10px] shadow-[0px_1px_0px_0px_rgba(26,26,26,0.07)] border border-[#e3e3e3] flex flex-col h-[640px]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 border-b border-[#e3e3e3] shrink-0",children:[e.jsx(m,{as:"h2",variant:"headingMd",children:"Run test"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"min-w-[140px]",children:e.jsx(fp,{label:"",labelHidden:!0,options:[{label:"This skill only",value:"this_skill"}],value:"this_skill",onChange:()=>{}})}),e.jsx("button",{type:"button","aria-label":"Close run test",onClick:n,className:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-black/[0.06] shrink-0",children:e.jsx(ee,{source:Ws,tone:"subdued"})})]})]}),e.jsxs("div",{ref:v,className:"flex-1 overflow-y-auto p-4 flex flex-col gap-3",children:[h.length===0&&e.jsx(m,{as:"p",variant:"bodySm",tone
1872:"subdued",children:"Send a message below to test this skill."}),h.map(P=>P.role==="user"?e.jsx("div",{className:"flex justify-end",children:e.jsx("div",{className:"bg-[#f1f1f1] rounded-full px-3 py-1.5 text-[13px] text-[#303030] max-w-[85%] break-words",children:P.text})},P.id):e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"max-w-full break-words",children:P.text?e.jsx(sn,{as:"span",variant:"bodyMd",fontWeight:"regular",children:_&&S.current===P.id?e.jsx("div",{className:"message-text",children:e.jsx(_h,{text:P.text,isStreaming:_,urlEmbeded:g})}):e.jsx("div",{className:"message-text",children:e.jsx(Ma,{remarkPlugins:[Ti],components:{a:({node:w,href:N="",children:K,...L})=>{const W=vj.find(H=>N.startsWith(H));if(W){const H=N.replace(W,"");return e.jsx(fr,{...L,to:H,rel:"noopener noreferrer",children:K})}return e.jsx("a",{target:"_blank",href:N,rel:"noopener noreferrer",children:K})}},children:P.text})})}):e.jsx(bh,{status:P.status||void 0,size:"sm"})})},P.id))]}),e.jsx("div",{className:"p-3 border-t border-[#e3e3e3] shrink-0",children:e.jsxs("div",{className:"border border-[#5546ff] rounded-lg px-3 py-2 flex items-center gap-2 bg-white",children:[e.jsx("textarea",{className:"flex-1 resize-none outline-none text-[13px] text-[#303030] leading-5 bg-transparent placeholder:text-[#8a8a8a] max-h-24 block self-center",rows:1,placeholder:"Request your task here to test",value:x,onChange:P=>f(P.target.value),onKeyDown:O,disabled:_}),e.jsx("button",{type:"button","aria-label":"Send test message",onClick:k,disabled:!R,className:oe("w-8 h-8 flex items-center justify-center rounded-full shrink-0",R?"bg-[#5546ff] cursor-pointer":"bg-[#c9c9c9] cursor-not-allowed"),children:_?e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):e.jsx(_o,{className:"fill-white",width:16})})]})})]})},Sj=(t,s)=>{const n=s==="system";return ks({queryKey:[vt.ai_assistant.detailSkill(t),s],queryFn:async()=>(n?await Hs.getSystemSkillDetail({skill_id:t}):await Hs.getDetailSkill({skill_id:t}))?.data?.skill??null,enabled:!!t,staleTime:5*60*1e3})},jj=new Set(["check_permissions_quota","update_settings","search_zopi_docs","zopi_support"]),Ej=["product","products","supplier","suppliers"],Tj=["order","orders"],Pj=[{label:"Product",icon:ms,keywords:Ej},{label:"Order",icon:is,keywords:Tj}];function Ij(t,s){const n=t.toLowerCase();return s.some(a=>n.includes(a))}const Rj=({name:t,description:s,selected:n})=>e.jsx("div",{className:oe("flex-1 flex flex-col gap-1.5 p-3 rounded-lg border-[0.6px] overflow-hidden min-w-0",n&&"bg-[#f8f7ff]! border-[#5546ff]",!n&&"bg-white border-[#e3e3e3]"),children:e.jsx("div",{className:"flex items-start justify-between gap-2",children:e.jsxs("div",{className:"flex flex-col gap-1.5 flex-1 min-w-0",children:[e.jsx("span",{className:"bg-black/[0.06] px-2 py-0.5 rounded-lg h-5 inline-flex items-center w-fit",children:e.jsx("span",{className:"font-mono text-[12px] text-[#303030] leading-4 whitespace-nowrap",children:t})}),e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:s})]})})}),kj=({label:t,icon:s,tools:n})=>e.jsx("div",{className:"flex flex-col overflow-hidden rounded-[12px] w-full border border-[#e3e3e3]",children:e.jsxs("div",{className:"bg-white border-b border-[#e3e3e3] flex flex-col gap-3 p-4 w-full",children:[e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("div",{children:e.jsx(ee,{source:s})}),e.jsx(m,{as:"span",variant:"headingSm",children:t})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map(a=>e.jsx(Rj,{...a},a.name))})]})}),Rl=({action:t,isOpen:s,onToggle:n})=>e.jsxs("div",{className:"bg-[#f8f7ff] rounded-[12px] overflow-hidden",children:[e.jsxs("button",{className:"flex items-center justify-between w-full p-3",onClick:n,children:[e.jsx("span",{className:"font-mono text-[12px] text-[#303030] leading-4 text-left",children:t.name}),e.jsx("div",{children:e.jsx(ee,{source:s?Pn:Rs,tone:"subdued"})})]}),e.jsx(Qe,{open:s,id:`preview-action-${t.name}`,transition:{duration:"400ms",timingFunction:"ease-in-out"},children:t.params&&e.jsx("div",{className:"px-3 pb-3",children:e.jsx("pre",{className:"text-[12px] text-[#616161] leading-4 whitespace-pre-wrap font-sans font-normal m-0",children:t.description})})})]}),wj=()=>{const t=pt(),[s]=ca(),n=ws(),{useParams:a}=gj(),r=a.skillId?+a.skillId:void 0,o=s.get("type")||void 0,l=o==="system",{data:c,isLoading:u}=Sj(r,o),{data:d=[],isLoading:g}=xh(),{mutate:h,isPending:p}=mh(),{mutate:x,isPending:f}=Fo(),{mutate:_,isPending:b}=fh(),[v,y]=i.useState(""),[C,S]=i.useState(new Set),[j,A]=i.useState(""),[E,T]=i.useState(!1);i.useEffect(()=>{E&&window.scrollTo({top:0,behavior:"smooth"})},[E]);const[k,O]=i.useState(!1),[R,P]=i.useState(!1),[w,N]=i.useState(!1),[K,L]=i.useState(!1),[W,H]=i.useState(null),Z=!l&&!!c?.system_skill_id,te=Z||l&&c?.is_customized,ne=l&&c?.is_customized?c.id:l?void 0:r;i.useEffect(()=>{c&&(c.tools&&S(new Set(c.tools.map(ue=>ue.name))),c.instruction_raw&&A(c.instruction_raw),H(null))},[c]);const le=async()=>{const ue=j.trim();if(!(!ue||R)){P(!0);try{const Ae=(await Hs.generateSkill({text:ue}))?.data?.skill;Ae&&(H(Ae),S(new Set(Ae.actions.map(_e=>_e.name))))}finally{P(!1)}}},B=async()=>
1872{if(!(!W||w)){N(!0);try{const ce=(await Hs.refineSkill({title:W.title,description:W.description,system_prompt:W.system_prompt,actions:W.actions,is_safe:W.is_safe,warnings:W.warnings}))?.data?.skill;ce&&(H(ce),S(new Set(ce.actions.map(Ae=>Ae.name))))}finally{N(!1)}}},ie=()=>{!r||b||O(!0)},V=()=>{!r||b||_(r,{onSuccess:()=>{O(!1),t(Y.AI_ASSISTANT.PATH)}})},M=async()=>{if(!(!ne||K)){L(!0);try{await Hs.resetToDefault(ne),n.invalidateQueries({queryKey:[vt.ai_assistant.detailSkill(r)]}),n.invalidateQueries({queryKey:vt.ai_assistant.listSkill()}),H(null)}finally{L(!1)}}},I=ue=>{y(ce=>ce===ue?"":ue)},F=i.useMemo(()=>{const ue=d.filter(Pe=>!jj.has(Pe.name));if(!ue.length)return[];const ce=[],Ae=new Set;for(const Pe of Pj){const Ne=ue.filter(rt=>Ij(rt.name,Pe.keywords));Ne.length>0&&(Ne.forEach(rt=>Ae.add(rt.name)),ce.push({label:Pe.label,icon:Pe.icon,tools:Ne.map(rt=>({name:rt.name,description:rt.description||"",selected:C.has(rt.name)}))}))}const _e=ue.filter(Pe=>!Ae.has(Pe.name));return _e.length>0&&ce.push({label:"Other",icon:Oa,tools:_e.map(Pe=>({name:Pe.name,description:Pe.description||"",selected:C.has(Pe.name)}))}),ce},[d,C]),G=i.useMemo(()=>W?W.actions.map(ue=>({name:ue.name,params:ue.config&&Object.keys(ue.config).length>0?JSON.stringify(ue.config,null,2):void 0})):c?.tools?Array.from(C).map(ue=>{const ce=c.tools.find(Ae=>Ae.name===ue);return{name:ue,params:ce?.config&&Object.keys(ce.config).length>0?JSON.stringify(ce.config,null,2):void 0}}):[],[W,C,c?.tools]),z=W?W.is_safe:!0,me=W?.warnings??[],Re=()=>{if(!z)return;const ue=Array.from(C).map(rt=>{const ye=W?.actions.find(Ue=>Ue.name===rt),Ie=c?.tools.find(Ue=>Ue.name===rt);return{name:rt,config:ye?.config||Ie?.config||{}}}),ce=W?.title||c?.name||"",Ae=W?.title||c?.display_name||"",_e=W?.description||c?.description||"",Pe=W?.system_prompt||c?.system_prompt||"",Ne={system_skill_id:l?r??0:c?.system_skill_id??null,name:ce,display_name:Ae,description:_e,display_description:_e,system_prompt:Pe,status:c?.status??"enabled",display:!0,tools:ue,instruction_raw:j};if(l)c?.is_customized&&ne?x({params:Ne,skillId:ne}):h(Ne,{onSuccess:rt=>{const ye=rt?.data?.skill?.id;ye&&t(Y.AI_ASSISTANT.SUBROUTES.DETAIL_SKILL.PATH.replace(":skillId",ye.toString()))}});else if(r){if(!c)return;x({params:Ne,skillId:r})}else h(Ne,{onSuccess:rt=>{const ye=rt?.data?.skill?.id;ye&&t(Y.AI_ASSISTANT.SUBROUTES.DETAIL_SKILL.PATH.replace(":skillId",ye.toString()))}})},Be=W?.description||c?.description||"",De=W?.system_prompt||c?.system_prompt||"",ot=W?.title||c?.display_name||c?.name||"",ve=c?.updated_at?`Last edited: ${it(c.updated_at).format("D MMM [at] h:mm a")}`:"",pe=W?.title||c?.display_name||c?.name||"Skill detail",ze=c?.status==="disabled"||c?.user_status==="disabled",Ge=l||Z?"System pre-built":r?"Custom":void 0,lt=!!r&&!l&&!Z;return e.jsxs("div",{className:"mx-auto px-4 md:px-0",style:{maxWidth:1144},children:[e.jsx(us,{title:r?u?"Loading...":pe:"Create new skill",titleMetadata:Ge?e.jsx(wt,{children:Ge}):void 0,subtitle:ve,primaryAction:{content:"Save skill",loading:p||f,disabled:!z||R||w,onAction:Re},secondaryActions:[...te?[{content:"Reset to default",loading:K,onAction:M}]:[],...r&&!l?[{content:ze?"Enable skill":"Disable skill",onAction:()=>{}}]:[],...lt?[{content:"Remove skill",destructive:!0,loading:b,onAction:ie}]:[]],backAction:{content:"Back",onAction:()=>t(Y.AI_ASSISTANT.PATH)},children:e.jsx("div",{className:"flex flex-col w-full",children:e.jsxs("div",{className:"flex gap-6 items-start w-full",children:[e.jsxs("div",{className:"flex flex-col gap-6 flex-1 min-w-0",children:[e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"h2",variant:"headingMd",children:"Skill instruction"}),e.jsx("div",{className:"bg-[#fdfdfd] border border-[#e3e3e3] flex flex-col gap-4 roun
1872ded-lg [&_.Polaris-TextField\\_\\_Backdrop]:border-none! [&_.Polaris-TextField\\_\\_Backdrop]:outline-none! [&_textarea]:py-2!",children:e.jsxs("div",{className:"relative",children:[e.jsx(gt,{label:"",labelHidden:!0,multiline:5,autoComplete:"off",placeholder:"Describe what you want your assistant to do in natural language.",value:j,onChange:A}),e.jsxs("div",{className:"flex items-center justify-between absolute z-50 bottom-2 left-0 w-full px-3",children:[e.jsxs(U,{gap:"200",blockAlign:"center",children:[e.jsx(re,{variant:"tertiary",icon:Dg}),e.jsx(re,{variant:"tertiary",icon:jn})]}),e.jsxs(U,{gap:"300",blockAlign:"center",children:[e.jsx(re,{size:"large",variant:"tertiary",icon:Lg}),e.jsx("button",{className:oe("w-8 h-8 flex items-center justify-center rounded-full bg-[#303030] text-white shrink-0",R?"cursor-not-allowed":"cursor-pointer"),onClick:le,disabled:R,children:R?e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):e.jsx(ee,{source:vp})})]})]})]})})]}),e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"h2",variant:"headingMd",children:"Tool selection"}),e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:"Auto-select based on current instruction"}),e.jsx(D,{gap:"300",children:g?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Pa,{size:"small"})}):F.map(ue=>e.jsx(kj,{...ue},ue.label))})]})]}),E&&r?e.jsx(Aj,{skillId:r,onClose:()=>T(!1),skillType:o==="system"?"system":"user"}):e.jsx("div",{className:"w-[420px] shrink-0 bg-white rounded-[10px] shadow-[0px_1px_0px_0px_rgba(26,26,26,0.07)] border border-[#e3e3e3]",children:e.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[e.jsx(m,{as:"h2",variant:"headingMd",children:`Skill preview: ${ot}`}),!z&&e.jsx(Mg,{tone:"critical",children:e.jsx("p",{children:"This skill has been flagged as unsafe and cannot be saved."})}),me.length>0&&e.jsx("div",{className:"flex flex-col gap-2",children:me.map((ue,ce)=>e.jsxs("div",{className:"flex items-start gap-2 bg-[#fff8e6] border border-[#ffd54f] rounded-lg p-3",children:[e.jsx("div",{className:"shrink-0 mt-0.5",children:e.jsx(ee,{source:hr,tone:"caution"})}),e.jsx(m,{as:"p",variant:"bodySm",children:ue})]},ce))}),Be&&e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:"Description:"}),e.jsx("div",{className:"text-[13px] text-[#303030] leading-5 font-normal whitespace-pre-wrap",children:Be})]}),De&&e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:"Instruction:"}),e.jsx("div",{className:"text-[13px] text-[#303030] leading-5 font-normal max-w-none overflow-hidden break-words",children:e.jsx(Ma,{remarkPlugins:[Ti],components:{table:({children:ue})=>e.jsx("div",{className:"overflow-x-auto my-2",children:e.jsx("table",{className:"w-full border-collapse text-[12px] leading-4",children:ue})}),thead:({children:ue})=>e.jsx("thead",{className:"bg-[#f6f6f7]",children:ue}),th:({children:ue})=>e.jsx("th",{className:"border border-[#e3e3e3] px-2 py-1.5 text-left font-medium text-[#303030]",children:ue}),td:({children:ue})=>e.jsx("td",{className:"border border-[#e3e3e3] px-2 py-1.5 text-[#616161]",children:ue}),p:({children:ue})=>e.jsx("p",{className:"my-1.5 break-words",children:ue}),ul:({children:ue})=>e.jsx("ul",{className:"list-disc pl-4 my-1.5",children:ue}),ol:({children:ue})=>e.jsx("ol",{className:"list-decimal pl-4 my-1.5",children:ue}),li:({children:ue})=>e.jsx("li",{className:"my-0.5",children:ue}),h1:({children:ue})=>e.jsx("h1",{className:"text-base font-semibold my-2",children:ue}),h2:({children:ue})=>e.jsx("h2",{className:"text-sm font-semibold my-2",children:ue}),h3:({children:ue})=>e.jsx("h3",{className:"text-[13px] font-semibold my-1.5",children:ue}),code:({children:ue,className:ce})=>ce?e.jsx("pre",{className:"bg-[#f6f6f7] rounded p-2 overflow-x-auto my-1.5",children:e.jsx("code",{className:"text-[12px]",children:ue})}):e.jsx("code",{className:"bg-[#f6f6f7] px-1 py-0.5 rounded text-[12px] break-all",children:ue}),blockquote:({children:ue})=>e.jsx("blockquote",{className:"border-l-2 border-[#e3e3e3] pl-3 my-1.5 text-[#616161]",children:ue})},children:(()=>{const ue=De.split(` 1873`);let ce=!1;return ue.map((Ae,_e)=>{if(Ae.trimStart().startsWith("```")&&(ce=!ce),ce)return Ae;const Pe=ue[_e+1],Ne=Ae.trimStart().startsWith("|"),rt=Pe?.trimStart().startsWith("|");return Ne||rt?Ae:_e<ue.length-1&&Pe!==""?Ae+" ":Ae}).join(` 1874`)})()})})]}),G.length>0&&e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:"Actions:"}),e.jsx(D,{gap:"300",children:G.map(ue=>e.jsx(Rl,{action:ue,isOpen:v===ue.name,onToggle:()=>I(ue.name)},ue.name))})]}),e.jsxs(U,{gap:"200",blockAlign:"center",children:[e.jsx(vn,{variant:"secondary",size:"medium",onClick:B,disabled:!W||w,loading:w,children:e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("img",{className:"shrink-0 h-4",src:gh,alt:"zopi-magic",loading:"lazy"}),e.jsx(m,{as:"span",tone:"magic",fontWeight:"medium",children:"Refine"})]})}),e.jsx(re,{disabled:!r,onClick:()=>T(!0),children:"Run test"})]})]})})]})})}),e.jsx(Xe,{open:k,onClose:()=>O(!1),title:"Remove skill",primaryAction:{content:"Remove",destructive:!0,loading:b,onAction:V},secondaryActions:[{content:"Cancel",onAction:()=>O(!1),disabled:b}],children:e.jsx(Xe.Section,{children:e.jsx(m,{as:"p",variant:"bodyMd",children:"Are you sure you want to remove this skill? This action cannot be undone."})})})]})},Nj=Object.freeze(Object.defineProperty({__proto__:null,DetailSkillPage:wj,PreviewActionItem:Rl},Symbol.toStringTag,{value:"Module"})),eo=6,Oj={dropship_order_fulfillment:"Dropship order fulfillment",dropship_product_search:"Dropship product search"};function Dj({onClose:t}){const{t:s}=J(),{data:n,isLoading:a}=hj(),[r,o]=i.useState(!1),[l,c]=i.useState(),[u,d]=i.useState(""),[g,h]=i.useState(!1),p=r?n||[]:(n||[]).slice(0,eo),x=(n?.length||0)>eo,f=i.useMemo(()=>l?.system_prompt||"",[l]),_=i.useMemo(()=>l?.tools?.length?l.tools.map(v=>({name:v.name,params:v.config&&Object.keys(v.config).length>0?JSON.stringify(v.config,null,2):void 0,description:v.description})):[],[l?.id,l?.tools]),b=i.useCallback(v=>{d(y=>y===v?"":v)},[]);return i.useEffect(()=>{p.length>0&&!l&&c(p[0])},[p,l]),i.useEffect(()=>{d("")},[l?.id]),e.jsxs("div",{className:"grid grid-cols-3 relative",children:[e.jsxs("div",{className:"col-span-1 bg-bg-surface p-4 flex flex-col border-r border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(re,{icon:Mn,variant:"tertiary",onClick:t}),e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:s("SkillLibrary")})]}),e.jsx(D,{gap:"400",children:a?Array.from({length:eo}).map((v,y)=>e.jsxs(U,{gap:"100",blockAlign:"start",wrap:!1,children:[e.jsx("div",{className:"w-5 h-5 shrink-0",children:e.jsx(Se,{})}),e.jsx("div",{className:"flex-1",children:e.jsx(Se,{})})]},y)):p.map(v=>e.jsx("div",{className:oe("cursor-pointer min-w-0 hover:bg-bg-surface rounded-xl p-2!",l?.id===v.id&&"bg-bg-surface-selected"),onClick:()=>{c(v)},children:e.jsxs(U,{gap:"200",blockAlign:"start",wrap:!1,children:[e.jsx("img",{src:gh,alt:"",className:"w-5 h-5 shrink-0 mt-px"}),e.jsx("div",{className:"min-w-0",children:e.jsxs(D,{gap:"100",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"medium",children:Oj[v.name]||v.display_name}
1874),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",truncate:!0,children:e.jsx("span",{title:v.display_description,children:v.display_description})})]})})]})},v.id))}),x&&e.jsx("div",{children:e.jsx(re,{disclosure:r?"up":"down",onClick:()=>o(v=>!v),variant:"tertiary",children:s(r?"ViewLess":"ViewMore")})})]}),e.jsxs("div",{className:"col-span-2 p-4",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:s("SkillPreview")})}),f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{as:"span",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:[s("Instruction"),":"]}),e.jsx("div",{className:"text-[13px] text-[#303030] leading-5 font-normal max-w-none overflow-hidden break-words",children:e.jsx(Ma,{remarkPlugins:[Ti],components:{table:({children:v})=>e.jsx("div",{className:"overflow-x-auto my-2",children:e.jsx("table",{className:"w-full border-collapse text-[12px] leading-4",children:v})}),thead:({children:v})=>e.jsx("thead",{className:"bg-[#f6f6f7]",children:v}),th:({children:v})=>e.jsx("th",{className:"border border-[#e3e3e3] px-2 py-1.5 text-left font-medium text-[#303030]",children:v}),td:({children:v})=>e.jsx("td",{className:"border border-[#e3e3e3] px-2 py-1.5 text-[#616161]",children:v}),p:({children:v})=>e.jsx("p",{className:"my-1.5 break-words",children:v}),ul:({children:v})=>e.jsx("ul",{className:"list-disc pl-4 my-1.5",children:v}),ol:({children:v})=>e.jsx("ol",{className:"list-decimal pl-4 my-1.5",children:v}),li:({children:v})=>e.jsx("li",{className:"my-0.5",children:v}),h1:({children:v})=>e.jsx("h1",{className:"text-base font-semibold my-2",children:v}),h2:({children:v})=>e.jsx("h2",{className:"text-sm font-semibold my-2",children:v}),h3:({children:v})=>e.jsx("h3",{className:"text-[13px] font-semibold my-1.5",children:v}),code:({children:v,className:y})=>y?e.jsx("pre",{className:"bg-[#f6f6f7] rounded p-2 overflow-x-auto my-1.5",children:e.jsx("code",{className:"text-[12px]",children:v})}):e.jsx("code",{className:"bg-[#f6f6f7] px-1 py-0.5 rounded text-[12px] break-all",children:v}),blockquote:({children:v})=>e.jsx("blockquote",{className:"border-l-2 border-[#e3e3e3] pl-3 my-1.5 text-[#616161]",children:v})},children:(()=>{const v=f.split(` 1875`);let y=!1;return v.map((C,S)=>{if(C.trimStart().startsWith("```")&&(y=!y),y)return C;const j=v[S+1],A=C.trimStart().startsWith("|"),E=j?.trimStart().startsWith("|");return A||E?C:S<v.length-1&&j!==""?C+" ":C}).join(` 1876`)})()})})]}),_.length>0&&e.jsx("div",{className:f?"mt-4":void 0,children:e.jsxs(D,{gap:"300",children:[e.jsxs(m,{as:"p",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:[s("Actions"),":"]}),e.jsx(D,{gap:"300",children:_.map(v=>e.jsx(Rl,{action:v,isOpen:u===v.name,onToggle:()=>b(v.name)},v.name))})]})})]}),e.jsx("div",{className:oe("animate-slide-left w-full h-full bg-bg-surface absolute top-0 left-0",g?"block":"hidden"),children:e.jsx(pj,{skill:l,onClose:()=>h(!1),onSkillUpdated:c})})]})}const kl="https://be.aliorders.io/api",wl={UPLOAD_MEDIA:"/core/image-temp/sidekick-upload",UPLOAD_MEDIA_BASE_64:"/core/image-temp/sidekick-upload",DELETE_IMAGE:"/core/image-temp/sidekick-upload"},Lj=async t=>{const{formData:s}=t;return X(`${kl}${wl.UPLOAD_MEDIA}`,s,{method:"POST"})},Mj=async t=>X(`${kl}${wl.UPLOAD_MEDIA_BASE_64}`,{base64:t.image},{method:"POST"}),Uj=async t=>X(`${kl}${wl.DELETE_IMAGE}`,t,{method:"DELETE"}),Fj={postUploadImage:Lj,postUploadImageBase64:Mj,deleteImageS3:Uj},Bn=ae({key:"isRunningChatV2State",default:!1}),Nl=ae({key:"isStreamingAIV2State",default:!1}),Ol=ae({key:"isLoadingPageChatAIV2State",default:!0}),yh=ae({key:"skipNextThreadHistoryLoadingV2State",default:!1}),ia=ae({key:"threadIdV2State",default:""}),Bj=ae({key:"showHistoryChatV2State",default:!1}),vd=ae({key:"toolSelectedV2State",default:"web_search"}),Ch=ae({key:"assistantModeAIV2State",default:"auto"}),vh=ae({key:"dataSubmitMessageV2State",default:{message:"",urlsFile:[]}}),Hj=e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"",children:e.jsx("path",{id:"vector",d:"M4.86177 4.86195C5.12212 4.6016 5.54423 4.6016 5.80458 4.86195L7.99984 7.05721L10.1951 4.86195C10.4554 4.6016 10.8776 4.6016 11.1379 4.86195C11.3983 5.1223 11.3983 5.54441 11.
18761379 5.80476L8.94265 8.00002L11.1379 10.1953C11.3983 10.4556 11.3983 10.8777 11.1379 11.1381C10.8776 11.3984 10.4554 11.3984 10.1951 11.1381L7.99984 8.94283L5.80458 11.1381C5.54423 11.3984 5.12212 11.3984 4.86177 11.1381C4.60142 10.8777 4.60142 10.4556 4.86177 10.1953L7.05703 8.00002L4.86177 5.80476C4.60142 5.54441 4.60142 5.1223 4.86177 4.86195Z",fill:"currentColor"})}),Ad={remove:Hj},Sd=()=>{const[t,s]=i.useState(0),n=12,a=3,r=n-a/2,o=r*2*Math.PI;i.useEffect(()=>{let c;return t<90&&(c=setInterval(()=>{s(u=>u>=90?(clearInterval(c),90):u+2)},100)),()=>clearInterval(c)},[t]);const l=o-t/100*o;return e.jsx("div",{className:"relative w-[30px] h-[30px]",children:e.jsxs("svg",{className:"w-full h-full transform -rotate-90",viewBox:"0 0 30 30",children:[e.jsx("circle",{className:"text-gray-300",stroke:"currentColor",strokeWidth:a,fill:"transparent",r,cx:"15",cy:"15"}),e.jsx("circle",{className:"text-blue-500 transition-all duration-100",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",fill:"transparent",r,cx:"15",cy:"15",strokeDasharray:o,strokeDashoffset:l})]})})},Gj=t=>{const{selectedFile:s,handleRemoveFile:n}=t;return e.jsx("div",{className:"flex gap-2 mb-2 file-preview flex-wrap",children:s.map((a,r)=>e.jsx(e.Fragment,{children:a?.file?.type?.startsWith("image/")||a.type==="base64"?e.jsxs("div",{style:{width:40,height:40},className:"group max-w-full relative h-auto rounded-md border border-border overflow-hidden flex",children:[a.type==="base64"?e.jsx("img",{className:"object-contain",src:a.url?a.url:a.base64,alt:"Selected file"}):e.jsx("img",{className:"object-contain",src:a.url?a.url:URL.createObjectURL(a?.file),alt:"Selected file"}),a.is_uploading?e.jsx("div",{className:"absolute text-white top-0 left-0 w-full h-full bg-red flex items-center justify-center",children:e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Sd,{})})}):e.jsx("button",{type:"button",onClick:()=>n(r),style:{borderRadius:"50%"},className:"opacity-0 group-hover:opacity-100 cursor-pointer remove-file overflow-hidden hover:bg-red-500 text-white bg-black hover:underline absolute top-1 right-1",children:Ad.remove})]}):e.jsxs("div",{className:"group file-info flex items-center gap-1",children:[e.jsxs("div",{className:Un("text-white p-2 relative rounded-lg flex items-center justify-center",{"bg-blue-500":!a.is_uploading,"bg-gray-200":a.is_uploading}),style:{width:48,height:48},children:[e.jsx(Ug,{fill:"#fff",width:30}),a.is_uploading?e.jsx(nr,{content:"Stop",children:e.jsx("div",{className:"absolute text-white top-0 left-0 w-full h-full bg-red flex items-center justify-center",children:e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Sd,{})})})}):e.jsx(nr,{content:"Send",children:e.jsx("button",{type:"button",onClick:()=>n(r),style:{borderRadius:"50%"},className:"opacity-0 group-hover:opacity-100 cursor-pointer remove-file overflow-hidden hover:bg-red-500 text-white bg-black hover:underline absolute top-1 right-1",children:Ad.remove})})]}),e.jsx("span",{className:"file-name mr-2 truncate overflow-hidden",style:{maxWidth:100},children:a?.file?.name})]})},r))})},ln=24,Wj=32,Vj=i.memo(t=>{const{onSubmitMessage:s,onStopStream:n,loading:a,size:r="default"}=t,{t:o}=J(),{isMobile:l}=xe(),c=pt(),u=ke(Bn),d=ke(ia),[g,h]=i.useState(""),[p,x]=i.useState(!1),[f,_]=i.useState(!1),[b,v]=i.useState([]),y=b.some(H=>H.is_uploading),C=g.trim()!==""||b.length>0&&!y,S=i.useRef(null),j=ke(vd),A=he(vd),[E,T]=i.useState(!1),[k,O]=be(Ch),R=i.useCallback(()=>{T(H=>!H)},[]),P=i.useMemo(()=>[{label:"Auto",value:"auto",helpText:"Decide how long to think"},{label:"Instant",value:"instant",helpText:"Answer and take action right away"},{label:"Pro-thinking",value:"thinking",helpText:"Think it over before acting for better result"}],[]),w=H=>{H&&(h(H.innerText.trim()),x(H.scrollHeight>Wj))},N=(H=g)=>{if(!C||a||f||u)return;if(j==="find_product"){A("web_search"),c(`${Y.HOME_PAGE.PATH}?view=add-product&keyword=${encodeURIComponent(H.trim())}`);return}const Z=b.map(te=>te.url);Promise.resolve(s(H.trim(),Z)).then(te=>{te!==!1&&(v([]),setTimeout(()=>{S.current&&(S.current.innerText=""),h(()=>""),x(!1)},0))})},K=H=>{const Z=b.filter((te,ne)=>ne!==H);v(Z),Fj.deleteImageS3({url:b[H].url})},L=H=>{const Z=window.getSelection();if(!Z?.rangeCount)return;Z.deleteFromDocument();const te=document.createTextNode(H),ne=Z.getRangeAt(0);
1876ne.insertNode(te),ne.setStartAfter(te),ne.collapse(!0),Z.removeAllRanges(),Z.addRange(ne),w(S.current)},W=H=>{H.preventDefault();const Z=H.clipboardData.items;if(Array.from(Z).some(le=>le.type.startsWith("image/"))){const le=H.clipboardData.getData("text/plain");le&&(L(le),requestAnimationFrame(()=>w(S.current)));return}const ne=H.clipboardData.getData("text/plain");ne&&(L(ne),requestAnimationFrame(()=>w(S.current)))};if(i.useEffect(()=>{l||S.current?.focus()},[l]),l&&r==="small"){const H=!C||a||f||d.includes("idf-");return e.jsxs("div",{className:oe("message relative w-full border border-border bg-bg-surface focus-within:border-zopi-primary shadow-[0px_4px_20px_0px_#0000000D]",p?"px-3 py-3":"px-3 py-1","bg-bg-surface-secondary border-bg-surface-secondary"),style:{borderRadius:p?"18px":"100px"},children:[e.jsx("style",{style:{display:"none"},children:Yj}),e.jsxs("div",{className:oe("flex",p?"flex-col gap-3":"flex-row items-center gap-2"),children:[e.jsxs("div",{className:oe("relative message-input flex-1 min-w-0",!p&&"flex items-center"),children:[e.jsx("div",{className:oe("relative z-10 w-full text-sm outline-none resize-none bg-transparent leading-6",p?"overflow-y-auto max-sm:text-base":"overflow-hidden"),ref:S,contentEditable:!0,suppressContentEditableWarning:!0,onPaste:W,onKeyUp:Z=>{Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),N())},onInput:Z=>{w(Z.currentTarget)},style:{fontFamily:"Inter, sans-serif",scrollbarWidth:"thin",lineHeight:`${ln}px`,...p?{minHeight:ln,maxHeight:160,overflowY:"auto"}:{height:ln,minHeight:ln,maxHeight:ln,overflowY:"hidden"}},onDragEnter:Z=>{Z.preventDefault(),Z.stopPropagation()},onDragOver:Z=>{Z.preventDefault(),Z.stopPropagation()},onDrop:Z=>{Z.preventDefault(),Z.stopPropagation()}}),g===""&&e.jsx("div",{className:"absolute text-body-md top-0 text-text-disabled pointer-events-none select-none",children:o("RequestToFindProduct")})]}),e.jsxs("div",{className:oe("flex items-center gap-2 shrink-0",p&&"justify-end"),children:[b&&b.length>0&&e.jsx(Gj,{selectedFile:b,handleRemoveFile:K}),u?e.jsx("div",{className:oe("inline-flex items-center justify-center bg-[#000000] cursor-pointer",p?"size-8 rounded-[16px] p-[6px]":"size-7 shrink-0 rounded-full p-1"),onClick:()=>{n()},children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-white",children:e.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"1.25",fill:"currentColor"})})}):e.jsx("div",{className:oe("inline-flex items-center justify-center",p?"size-8 rounded-[16px] p-[6px]":"size-7 shrink-0 rounded-full p-1",H?"cursor-no-drop bg-[#ccc]":"bg-[#000000] cursor-pointer"),onClick:()=>{N()},children:e.jsx(_o,{className:"fill-white",width:p?20:18})})]})]})]})}return e.jsx("div",{className:"message relative w-full",children:e.jsxs("div",{className:oe("relative w-full px-4 bg-white border border-border focus-within:border-[#000000] rounded-full flex items-center justify-between",p?"py-3 max-h-36 items-end":"py-4",l&&"bg-bg-surface-secondary border-bg-surface-secondary"),style:{borderRadius:p?"18px":"100px",minHeight:64},children:[e.jsxs("div",{className:oe("relative message-input w-full",p&&"max-h-[calc(100%-48px)] overflow-auto"),children:[e.jsx("div",{className:oe("relative z-10 w-full text-sm outline-none resize-none bg-transparent leading-6",p?"overflow-y-auto max-sm:text-base":"overflow-hidden"),ref:S,contentEditable:!0,suppressContentEditableWarning:!0,onPaste:W,onKeyDown:H=>{H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),N())},onInput:H=>{w(H.currentTarget)},style:{fontFamily:"Inter, sans-serif",scrollbarWidth:"thin",lineHeight:`${ln}px`,...p?{minHeight:ln,maxHeight:b.length>0?64:112,overflowY:"auto"}:{height:ln,minHeight:ln,maxHeight:ln,overflowY:"hidden"}},onDragEnter:H=>{H.preventDefault(),H.stopPropagation()},onDragOver:H=>{H.preventDefault(),H.stopPropagation()},onDrop:H=>{H.preventDefault(),H.stopPropagation()}}),g===""&&e.jsx("div",{className:"absolute text-sm top-1/2 -translate-y-1/2 text-text-disabled pointer-events-none select-none",children:o("WhatDoYouWantToAchieveToday")})]}),e.jsxs("div",{className:"flex gap-2 items-center shrink-0",children:[e.jsx(Gs,{active:E,activator:e.jsxs("div",{className:"flex items-center gap-1 cursor-pointer ml-2",onClick:R,children:[e.jsx(m,{as:"p",fontWeight:"medium",variant:"bodySm",tone
1876:"subdued",children:P.find(H=>H.value===k)?.label}),e.jsx(ee,{source:Rs})]}),autofocusTarget:"first-node",onClose:()=>T(!1),preferredPosition:"above",children:e.jsxs("div",{className:"p-3 grid gap-2",style:{minWidth:260},children:[e.jsx(m,{as:"span",fontWeight:"medium",variant:"bodyMd",children:"Agent mode"}),e.jsx(Gp,{title:"",choices:P,selected:[k],onChange:H=>{O(H?.[0]||"auto"),T(!1)}})]})}),u?e.jsx("div",{className:"inline-flex rounded-full p-[5px] bg-[#000000] cursor-pointer shrink-0",onClick:()=>{n()},children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-white",children:e.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"1.25",fill:"currentColor"})})}):e.jsx("div",{className:`inline-flex rounded-full p-[5px] shrink-0 ${!C||a||f||d.includes("idf-")?"cursor-no-drop bg-[#ccc]":"bg-[#000000] cursor-pointer"}`,onClick:()=>{N()},children:e.jsx(_o,{className:"fill-white",width:22})})]})]})})}),Yj=` 1877.Polaris-PositionedOverlay { 1878 font-weight: 400; 1879 font-size: 12px; 1880 line-height: 20px; 1881} 1882 1883.Polaris-PositionedOverlay .Polaris-Tooltip-TooltipOverlay { 1884 pointer-events: unset; 1885} 1886 1887.Polaris-PositionedOverlay .Polaris-Tooltip-TooltipOverlay--default { 1888 max-width: 245px; 1889} 1890`,zj=(t,s)=>JSON.stringify(t)===JSON.stringify(s);function Kj(t,s){const[n,a]=i.useState(t),r=i.useRef(t);return i.useEffect(()=>{if(!zj(r.current,t)){const o=setTimeout(()=>{a(t),r.current=t},s);return()=>{clearTimeout(o)}}},[t,s]),n}const Ah=i.createContext(null),Qj=50,qj=.2,Zj=({children:t,searchStoreFilter:s})=>{const n=de().getUserInfo().id,a=s?.graph_id,[r,o]=i.useState([]),[l,c]=i.useState(!1),[u,d]=i.useState(""),g=i.useRef(!1),h=Kj(u,300),p=_=>{const b=r.find(v=>v.key===_&&v.value?.thread_result);return!(!b||!b.value?.thread_result)},x=i.useCallback(async(_="",b,v)=>{if(!n){o([]);return}const C=!(v?.silent===!0)&&!g.current;C&&c(!0);try{const S=b??(a?{graph_id:a}:void 0),E=((await hn.searchStoreThread({query:_,...S?{filter:S}:{}},n.toString()))?.items||[]).filter(T=>T.key.trim()&&T.value?.thread_name?.trim()&&(T.score===null||T.score>qj)).slice(0,Qj).sort((T,k)=>{const O=new Date(T.created_at||"").getTime();return new Date(k.created_at||"").getTime()-O});o(E)}catch(S){console.error("Failed to fetch history threads:",S),o([])}finally{C&&(c(!1),g.current=!0)}},[n,a]);i.useEffect(()=>{n&&x(h)},[n,h,x]);const f=i.useMemo(()=>({history:r,loading:l,searchHistory:u,setSearchHistory:d,onFetchHistoryThread:x,isHasResultHistory:p}),[r,l,u,x,p]);return e.jsx(Ah.Provider,{value:f,children:t})},ki=()=>{const t=i.useContext(Ah);if(!t)throw new Error("useChatHistoryProvider must be used within ChatHistoryProvider");return t};function Xj(t,s){return t==null?"":typeof t=="string"?t:Array.isArray(t)?s==="human"?t:t.filter(a=>a&&a.type==="text"&&typeof a.text=="string").map(a=>a.text).join(""):typeof t=="object"&&t.type==="text"&&typeof t.text=="string"?t.text:t}function to(t){return{id:t.message_id,type:t.type,content:Xj(t.content,t.type),name:t.name??t.tool_name??void 0,tool_calls:t.tool_calls??void 0,tool_call_id:t.tool_call_id??void 0,artifact:t.artifact,additional_kwargs:{_agent_created_at:t.created_at},response_metadata:{}}}function jd(t){return t?.data}function Bo(t){return t==="human"?0:t==="ai"?1:t==="tool"?2:3}function Jj(t){return[...t].sort((s,n)=>{const a=Date.parse(s.created_at),r=Date.parse(n.created_at);if(!Number.isNaN(a)&&!Number.isNaN(r)&&a!==r)return a-r;const o=Bo(s.type)-Bo(n.type);return o!==0?o:s.message_id.localeCompare(n.message_id)})}async function so(t){const s=await hn.getAgentChatHistory({threadId:t,page:1}),n=jd(s),a=[...n?.messages??[]],r=n?.last_page??1;for(let o=2;o<=r;o++){const l=await hn.getAgentChatHistory({threadId:t,page:o}),c=jd(l);a.push(...c?.messages??[])}return Jj(a)}function en(t){const s=t.id;return typeof s=="string"&&s.length>0?s:void 0}function cr(t){const s=t.tool_call_id;return typeof s=="string"&&s.length>0?s:void 0}function Ed(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Td(t,s){if(t===s)return!0;
1890if(t.length!==s.length)return!1;for(let n=0;n<t.length;n++){const a=t[n],r=s[n];if(a.type!==r.type||a.name!==r.name||en(a)!==en(r)||cr(a)!==cr(r)||Ed(a.content)!==Ed(r.content))return!1}return!0}function $j(t){const s=new Map,n=[];for(const a of t){if(a.type!=="tool"){n.push(a);continue}const r=cr(a);if(!r){n.push(a);continue}const o=s.get(r);if(o===void 0){s.set(r,n.length),n.push(a);continue}const l=n[o];Ho(l)!=null||en(l)?.startsWith("sync:tool:")&&!en(a)?.startsWith("sync:tool:")||(n[o]=a)}return n}function eE(t){for(let s=t.length-1;s>=0;s--)if(t[s].type==="human")return s;return 0}function Ho(t){const s=t?.additional_kwargs?._agent_created_at;if(typeof s!="string")return null;const n=Date.parse(s);return Number.isNaN(n)?null:n}function tE(t,s){const n=new Map,a=new Map;s.forEach((l,c)=>{a.set(l,c);const u=en(l);u&&!n.has(u)&&n.set(u,c)});let r=0;for(const l of t){const c=Ho(l);c!=null&&(r=Math.max(r,c))}const o=l=>{const c=Bo(l.type),u=en(l)||`__ref_${a.get(l)??0}`,d=Ho(l);if(d!=null)return[d,c,u];const g=en(l)||"",h=n.get(g);if(typeof h=="number")return[r+1+h,c,g];const p=a.get(l);return typeof p=="number"?[r+1+p,c,`__ref_${p}`]:[r+2e9,c,en(l)||"__unknown__"]};return[...t].sort((l,c)=>{const u=o(l),d=o(c);return u[0]!==d[0]?u[0]-d[0]:u[1]!==d[1]?u[1]-d[1]:u[2].localeCompare(d[2])})}function sE(t,s,n){const a=eE(s),r=d=>n||t.length===0||d>=a,o=new Set(t.map(en).filter(d=>!!d)),l=new Set(t.filter(d=>d.type==="tool").map(cr).filter(d=>!!d)),c=[...t],u=new Map;c.forEach((d,g)=>{const h=en(d);h&&u.set(h,g)});for(let d=0;d<s.length;d++){const g=s[d],h=en(g),p=cr(g);if(!(g.type==="tool"&&p&&l.has(p)))if(h){const x=u.get(h);if(x!==void 0){if(n&&g.type==="ai"){const _=c[x]?.additional_kwargs?._agent_created_at;c[x]={...g,additional_kwargs:{...typeof g.additional_kwargs=="object"?g.additional_kwargs:{},..._?{_agent_created_at:_}:{}}}}continue}!o.has(h)&&r(d)&&(c.push(g),u.set(h,c.length-1),o.add(h),g.type==="tool"&&p&&l.add(p))}else d>=a&&r(d)&&(c.push(g),g.type==="tool"&&p&&l.add(p))}return tE($j(c),s)}const nE=t=>{const s={Authorization:`Bearer ${t.token}`,app:t.app};return t.workspaceId&&(s["workplace-id"]=t.workspaceId.toString()),t.storeId&&(s["store-id"]=t.storeId.toString()),s},aE=i.forwardRef((t,s)=>{const{assistantId:n="supervisor",threadId:a,token:r,app:o,workspaceId:l,postThreadParamsRef:c,modeAI:u,nameAI:d,setMessageData:g,setIsThreadLoading:h,onChangeLoadingPage:p,onThreadNotFound:x}=t,{onFetchHistoryThread:f}=ki(),_=de().getUserInfo().id,b=de().getUserInfo(),v=he(Bn),y=ke(Bn),C=he(Nl),[S,j]=be(yh),A=+ge.shopStorage.getCurrentShopId(),[E,T]=i.useState(null),k=i.useRef(a);k.current=a;const O=i.useRef(0),R=i.useRef(!1),P=i.useRef(p);P.current=p;const w=i.useMemo(()=>({recursion_limit:50,configurable:{assistant_nickname:d||"Assistant",llm_mode:u}}),[d,u]),N=i.useMemo(()=>nE({token:r,app:o,workspaceId:l,storeId:n==="zopi_assistant"?A:void 0}),[r,o,l,A,n]),K=Nm({apiUrl:RS,assistantId:n,threadId:a,defaultHeaders:N,onError:H=>{v(!1),C(!1);const Z=H?.status??H?.response?.status??H?.cause?.status,te=String(H?.message||H?.body||"").toLowerCase();(Z===404||te.includes("404")||te.includes("not found"))&&x?.()},onFinish:(H,Z)=>{setTimeout(()=>{v(!1),C(!1)},0);const te=k.current;n==="zopi_assistant"&&te&&so(te).then(ne=>{k.current===te&&T(ne.map(to))}).catch(()=>{})}});i.useImperativeHandle(s,()=>({onStopStream:()=>{K.stop(),v(!1),C(!1)},onSubmitMessage:L,getMessagesMetadata:H=>K.getMessagesMetadata(H),getStream:()=>K,onRetryMessage:(H,Z=!1)=>{if(v(!0),C(!0),Z){const B=K.getMessagesMetadata(H)?.firstSeenState?.parent_checkpoint;if(B){K.submit(void 0,{checkpoint:B,config:w});const ie=K.messages.findLastIndex(V=>V.type==="human");ie>=0&&g(V=>V.slice(0,ie+1));return}}const ne={messages:[{type:"human",content:H?.content}]};K.submit(ne,{config:w,streamSubgraphs:!0,streamResumable:!0,metadata:{email:b.email,display_name:b.name,locale:navigator.language}})}}));const L=async H=>{v(!0),C(!0);const Z=H.isFirstSubmitMessage||!1,te=[{type:"text",text:H.message}];H.urlsFile.length>0&&te.push({type:"image_url",image_url:H.urlsFile[0]});const ne={type:"human",content:te};if(a&&_&&Z){const B={namespace:["thread_history",_.toString()],key:a,value:{thread_name:H.message||"Analyzing content from the uploaded image",thread_result:"",metadata:{created_at:new Date().toISOString()},graph_id:"zopi_assistant"}};c.current=B,hn.putStoreUpdateThread(B).then(()=>{f()})}const le={messages:[{type:"human",content:te}]};await K.submit(le,{config:w,streamSubgraphs:!0,streamResumable:!0,metadata:{email:b.email,display_name:b.name,locale:navigator.language},optimisticValues(B){const V=[...B.messages??[],ne];return{...B,messages:V}}})},W=H=>
1890{if(H.additional_kwargs?.lc_source==="summarization")return!0;const ne=K.getMessagesMetadata(H)?.firstSeenState?.metadata;if(ne?.lc_source==="summarization")return!0;const le=ne?.langgraph_node;return!!(typeof le=="string"&&le.toLowerCase().includes("summarization"))};return i.useEffect(()=>{O.current=0,R.current=!1},[a]),i.useEffect(()=>{if(n!=="zopi_assistant"||!a){T(null),P.current(!1);return}let H=!1;return T(null),S?(j(!1),P.current(!1)):P.current(!0),(async()=>{try{const te=await so(a);if(H)return;T(te.map(to))}catch{H||T([])}finally{H||P.current(!1)}})(),()=>{H=!0}},[a,n]),i.useEffect(()=>{const H=Z=>{g(te=>Z.length===0&&te.length>0&&R.current||Td(te,Z)?te:Z)};if(n==="zopi_assistant"){if(E===null)return;const Z=K.messages.filter(ie=>!W(ie)),te=sE(E,Z,y);H(te);const le=O.current>0&&te.length===0;if(O.current=te.length,le&&!R.current){R.current=!0;const ie=a;let V=!1;return(async()=>{try{for(let M=1;M<=8&&!V&&(M>1&&await new Promise(G=>setTimeout(G,450)),k.current===ie);M++){const I=await so(ie);if(V||k.current!==ie)break;const F=I.map(to);if(T(G=>Td(G??[],F)?G:F),F.length>0)break}}finally{R.current=!1}})(),()=>{V=!0}}const B=te[te.length-1];B?.response_metadata&&B.type==="ai"&&B.name==="dropshipping_agent"&&B.content&&B.content.length>0&&y&&v(!1);return}if(K.messages.length>0){const Z=K.messages.filter(ne=>!W(ne));H(Z);const te=Z[Z.length-1];te?.response_metadata&&te.type==="ai"&&te.name==="dropshipping_agent"&&te.content&&te.content.length>0&&y&&v(!1)}},[K.messages,n,E,y,a,v,g]),i.useEffect(()=>{h(K.isThreadLoading)},[K.isThreadLoading]),e.jsx(e.Fragment,{})}),Sh=i.createContext(null),rE=t=>{const{assistantId:s="supervisor",threadId:n,children:a,onThreadNotFound:r,initialMessages:o}=t,l=he(Bn),c=he(Nl),{onFetchHistoryThread:u,isHasResultHistory:d}=ki(),g=de().getToken()||"",p=de().getUserInfo()?.id,x="AI",f=de().getCurrentWorkPlace()?.id||"",_=i.useRef(null),b=i.useRef(!1),v=i.useRef(null),[y,C]=i.useState([]),[S,j]=i.useState(!1),[A,E]=be(Ol),[T,k]=i.useState([]),[O,R]=i.useState(""),[P,w]=be(Ch),N=()=>{v.current?.onStopStream()},K=async ne=>{v.current?.onSubmitMessage(ne)},L=async ne=>{if(n){const le=ne?.id?T[T.length-1]?.human?.id===ne.id:!1;v.current?.onRetryMessage(ne,le)}},W=async ne=>{},H=async ne=>{},Z=ne=>ne.find(B=>B.name==="dropshipping_agent")||ne.find(B=>B.name==="sidekick"),te=async()=>{try{if(T.length>0&&!b.current){const ne=Z(T[0]?.ai||[]),le=T[0].human?.content?.[0]?.text||"",B=d(n);if(ne&&le&&p&&!B){const ie=ne.content?.slice(0,256),V={namespace:["thread_history",p.toString()],key:n,value:{thread_name:le||"Analyzing content from the uploaded image",thread_result:ie,metadata:{created_at:new Date().toISOString()},graph_id:"supervisor"}};b.current=!0,await hn.putStoreUpdateThread(V),u(void 0,void 0,{silent:!0})}}}catch(ne){console.log("update thread name error",ne)}};return i.useEffect(()=>()=>{l(!1),c(!1),N()},[]),i.useEffect(()=>{n&&s==="supervisor"&&(E(!0),c(!0),n.includes("idf-")||(l(!1),c(!1)),_.current=null,b.current=!1)},[n,s]),i.useEffect(()=>{y.length>0?k(Pd(y)):k([])},[y]),i.useEffect(()=>{o!==void 0&&(o.length>0?C(o):C([]),E(!1))},[o]),i.useEffect(()=>{T.length>0&&p&&te()},[T,p]),e.jsxs(Sh.Provider,{value:{nameAI:O,modeAI:P,setNameAI:R,setModeAI:w,messages:y||[],stream:v.current?.getStream()||null,isLoading:!1,groupHistory:T,isThreadLoading:S,isLoadingPage:A,assistantId:s,onStopStream:N,onSubmitMessage:K,onGroupMessages:Pd,getMessagesMetadata:ne=>
1890v.current?.getMessagesMetadata(ne),onRetryMessage:L,onLikeMessage:W,onDislikeMessage:H},children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:iE}}),n&&!n.includes("idf-")&&e.jsx(aE,{assistantId:s,app:x,threadId:n,token:g,workspaceId:f,setMessageData:C,onChangeLoadingPage:ne=>E(ne),postThreadParamsRef:_,ref:v,modeAI:P,nameAI:O,setIsThreadLoading:ne=>{j(ne)},onThreadNotFound:r}),e.jsx("div",{id:"chat-wrapper",className:"h-full",children:a})]})},Ba=()=>{const t=i.useContext(Sh);if(!t)throw new Error("useChat must be used within ChatProvider");return t};function Pd(t){return t.reduce((s,n)=>(n.type==="human"?s.push({human:n,ai:[]}):s.length?s[s.length-1].ai.push(n):s.push({human:null,ai:[n]}),s),[])}const iE=` 1891#chat-wrapper * { 1892 line-height: 1.25 !important; 1893} 1894#chat-wrapper .message-text * { 1895 margin-block: 6px; 1896 line-height: 1.75 !important; 1897} 1898.message-text-human *, 1899.message-text-human { 1900 line-height: 1.5 !important; 1901} 1902.content-item a, 1903.message-text a { 1904 color: #2b7fff; 1905} 1906.message-text a:hover { 1907 text-decoration: underline; 1908} 1909.message-text ol { 1910 list-style-type: decimal; 1911 padding-left: 2em; 1912} 1913.message-text ul { 1914 list-style-type: circle; 1915 padding-left: 2em; 1916} 1917.message-text pre { 1918 background-color: #f6f8fa; 1919 padding: 8px; 1920 overflow: auto; 1921 border-radius: 8px; 1922} 1923.message-text blockquote { 1924 margin: 0; 1925 padding: 0 1em; 1926 color: #59636e; 1927 border-left: 0.25em solid #d1d9e0; 1928} 1929.message-text table { 1930 border-spacing: 0; 1931 border-collapse: collapse; 1932 // display: block; 1933 width: max-content; 1934 max-width: 100%; 1935 width: 100%; 1936 overflow: auto; 1937 font-variant: tabular-nums; 1938} 1939.message-text table tr { 1940 background-color: #fff; 1941 border-top: 1px solid #d1d9e0b3; 1942} 1943.message-text table tr td, 1944.message-text table tr th { 1945 padding: 6px 13px; 1946 border: 1px solid #d1d9e0; 1947} 1948.content-item img { 1949 border-radius: 8px; 1950} 1951`,oE=se.div` 1952 position: absolute; 1953 top: 0; 1954 left: 0; 1955 width: 100%; 1956 height: 100%; 1957 pointer-events: none; 1958 transition: all 0.5s ease; 1959 background: linear-gradient( 1960 103.94deg, 1961 rgba(255, 255, 255, 0) 21.7%, 1962 rgba(255, 255, 255, 0.7) 50.62%, 1963 rgba(255, 255, 255, 0) 81.51% 1964 ); 1965 /* background: linear-gradient(103.94deg, rgba(255, 255, 255, 0) 21.7%, #ffffff 50.62%, rgba(255, 255, 255, 0) 81.51%); */ 1966 background-size: 200% 100%; 1967 animation: ${({$customTime:t})=>Ps` 1968 ${lE} ${t||5}s linear infinite 1969 `}; 1970 box-shadow: none; 1971 z-index: 100; 1972`,lE=da` 1973 0% { 1974 background-position: 200% 200%; 1975 1976 } 1977 100% { 1978 background-position: -200% -200%; 1979 } 1980`,cE=()=>e.jsxs("div",{className:"relative",children:[e.jsx(D,{gap:"200",children:Array.from({length:4}).map((t,s)=>e.jsxs(Oe.Fragment,{children:[e.jsx("div",{className:"content-item user",style:{textAlign:"right"},children:e.jsx("div",{style:{marginLeft:"auto",width:"50%"},children:e.jsx(Fg,{size:"small",maxWidth:"100%"})})}),e.jsx("div",{className:"content-item sidekick mb-4",children:e.jsxs(D,{gap:"300",children:[e.jsx("div",{children:e.jsx("div",{className:"flex items-center justify-center rounded-full",style:{height:26,width:26,minWidth:26,background:"linear-gradient(135deg, #8322FF 25.83%, #7557FF 35.73%, #735BFF 55.03%, #4CE9FF 83.08%)"},children:TE})}),e.jsx("div",{children:e.jsx(ys,{lines:5})})]})})]},s))}),e.jsx(oE,{className:"h-[736px]! top-0"})]}),Id={model:"Generating response",tools:"Running tool",router:"Routing your request",planner:"Planning next steps",plan:"Planning next steps"},dE=t=>{const s=t.replace(/[._]/g," ").replace(/([a-z])([A-Z])/g,"$1 $2");return s.charAt(0).toUpperCase()+s.slice(1)},uE=t=>{if(!t)return;if(Id[t])return Id[t];const s=t.toLowerCase();return s.includes("intent")||s.includes("route")?"Understanding your request":s.includes("tool")?"Running tool":s.includes("memory")?"Recalling context":s.includes("plan")?"Planning next steps":s.includes("model")||s.includes("agent")?"Generating response":dE(t)},Rd=t=>{const s=t.trimStart();return s.startsWith("{")||s.startsWith("[")},pE=(t,s)=>{if(!t||t.length===0)return;let n=-1;for(let d=t.length-1;d>=0;d--)if(t[d]?.type==="human"){n=d;break}const a=n>=0?t.slice(n+1):t;let r;for(let d=a.length-1;d>=0;d--){const g=a[d];if(g?.type==="ai"||g?.type==="tool"){r=g;break}}if(!r)return;const o=r.tool_calls;if(Array.isArray(o)&&o.length>
19800){const d=o[0]?.name;return d?`Running tool: ${d}`:"Running tool"}if(r.type==="tool"){const d=r.name;return d?`Processing ${d} result`:"Processing tool result"}const c=s?.(r)?.firstSeenState?.metadata?.writes;if(c&&typeof c=="object"){const d=Object.keys(c)[0],g=uE(d);if(g)return g}const u=r.content;if(typeof u=="string"&&Rd(u))return"Understanding your request";if(Array.isArray(u)){const g=u.find(h=>h?.type==="text")?.text||"";if(Rd(g))return"Understanding your request"}},hE=t=>{const[s,n]=i.useState(!0),[a,r]=i.useState(!0),o=i.useCallback(()=>{t&&t.scrollPrev()},[t]),l=i.useCallback(()=>{t&&t.scrollNext()},[t]),c=i.useCallback(d=>{n(!d.canScrollPrev()),r(!d.canScrollNext())},[]),u=i.useCallback(d=>{t&&t.scrollTo(d,!0)},[t]);return i.useEffect(()=>{t&&(c(t),t.on("reInit",c).on("select",c))},[t,c]),{prevBtnDisabled:s,nextBtnDisabled:a,onPrevButtonClick:o,onNextButtonClick:l,onChoose:u}},gE=t=>{const{total:s=0,products:n=[]}=t,[a,r]=xr({align:"start",containScroll:"trimSnaps",slidesToScroll:1,dragFree:!1,loop:!1}),{prevBtnDisabled:o,nextBtnDisabled:l,onPrevButtonClick:c,onNextButtonClick:u}=hE(r);return n.length?e.jsx("div",{className:"mt-4 rounded-xl border border-[#E5E7EB] bg-[#F9FAFB] p-4",children:e.jsxs(D,{gap:"300",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(sn,{as:"h4",variant:"headingMd",fontWeight:"medium",children:"Product Results"}),e.jsxs(sn,{as:"span",variant:"bodySm",tone:"subdued",children:[Fe(s)," results"]})]}),e.jsxs("div",{className:"relative -m-2",children:[e.jsx(ts.Viewport,{ref:a,slideSize:"calc((100% - 24px) / 3)",className:"p-2",slideSpacing:"12px",children:e.jsx(ts.Container,{children:n.map(d=>e.jsx(ts.Slide,{children:e.jsx("a",{href:d.product_link,target:"_blank",rel:"noopener noreferrer",className:"block h-full no-underline",children:e.jsx("div",{className:"bg-white shadow rounded-lg h-full",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"overflow-hidden",style:{paddingBottom:"100%",display:"block",position:"relative"},children:e.jsx("img",{src:d.thumbnail_url,alt:d.name,className:"object-cover w-full h-full rounded absolute top-0 left-0 group-hover/card-product:scale-120 transition duration-500"})}),e.jsxs("div",{className:"p-3 flex flex-col",children:[e.jsx("span",{className:"group-hover:underline truncate",children:d.name}),e.jsxs("p",{className:"text-sm text-gray-600 mt-2 inline-flex gap-1 items-center",children:[e.jsxs("b",{className:"fw-500",children:[Vt(d.rating)," "]}),e.jsx("span",{className:"inline-flex text-yellow-400",children:e.jsx(ee,{source:Ap})})]}),e.jsx("p",{className:"text-sm text-gray-600 mt-2",children:e.jsxs("b",{className:"fw-500",children:[d.price," ",d.currency]})})]})]})})})},d.source_product_id))})}),e.jsx(ts.PrevButton,{onClick:c,disabled:o,style:{position:"absolute",top:"50%",left:"-8px",transform:"translateY(-50%)",zIndex:1}}),e.jsx(ts.NextButton,{onClick:u,disabled:l,style:{position:"absolute",top:"50%",right:"-8px",transform:"translateY(-50%)",zIndex:1}})]})]})}):null},Dl=t=>t?.length?[...t].map(s=>`${s.source}:${s.source_product_id||""}:${s.product_link||""}`).sort().join("|"):null,Go=t=>{const s=t.message;if(s.name!=="product_list"||typeof s.props!="object"||s.props==null)return null;const n=s.props.products;return Dl(n)},kd=(t,s)=>{const n=Dl(s);return n?t.some(a=>Go(a)===n):!1},mE={product_list:gE};function fE(t,s){const n=t.id;if(typeof n=="string"&&n.length>0)return n;const a=t.tool_call_id;return typeof a=="string"&&a.length>0?`tc:${a}`:`idx:${s}`}const xE=t=>{const s=t.artifact;if(!s||typeof s!="object")return null;const n=s,a=n.data?.products;if(n.type!=="product_list"||!Array.isArray(a)||a.length===0)return null;const r=Dl(a);return{namespace:"local",message:{type:"ui",id:`artifact-${t.id??"noid"}-${r?.slice(0,64)??"empty"}`,name:"product_list",props:{total:n.data?.total,products:a,sourceTool:n.source_tool}}}},_E=(t,s)=>{const n=[],a=new Set;for(let r=0;r<t.length;r++){const o=t[r];if(o.name==="sidekick")continue;const l=fE(o,r),u=s(o)?.firstSeenState?.metadata?.writes;if(u&&typeof u=="object"){let h=!1;Object.entries(u).forEach(([p,x])=>{const f=x.ui;Array.isArray(f)&&f.forEach(_=>{if(Dm(_)&&!n.some(b=>b.message.id===_.id)){if(_.name==="product_list"){const b=_.props;if(kd(n,b?.products))return;h=!0}n.push({namespace:p,message:_})}})}),h&&a.add(l)}if(a.has(l))continue;const d=xE(o);if(!d)continue;const g=d.message.props?.products;kd(n,g)||n.some(h=>h.message.id===d.message.id)||n.push(d)}return n};function bE(t){const s=new Map;for(const r of t){const o=Go(r);o&&s.set(o,r)}const n=new Set,a=[];for(let r=t.length-1;r>=0;r--){const o=t[r],l=Go(o);if(!l){a.unshift(o);continue}if(n.has(l))continue;n.add(l);const c=s.get(l);c&&a.unshift(c)}return a}const yE=i.memo(t=>{const{t:s}=J(),{getMessagesMetadata:n,stream:a}=Ba(),r=ke(Nl),{dataAI:o,dataHuman:l,isLastMessage:c}=t,u=ke(Bn),[d,g]=i.useState(!0),{getShop:h}=dt(),p=h(),x=Ce.isShopifyEmbedded()?`${Ts.shopify.admin_app_new.replace("{{domain}}",p?.platform_domain?.replace(/.myshopify.com/,"")||"")}`:"",f=O=>{const R=O.trim();return!(R.length===0||R.startsWith("{")||R.startsWith("["))},_=O=>{if(O.type!=="ai")return!1;const R=O.content;if(!R)return!1;
1980if(typeof R=="string")return f(R);if(Array.isArray(R)){const P=new Set(["text","reasoning","product_list","image_url"]);if(R.some(K=>K.type&&!P.has(K.type)))return!1;const N=R.find(K=>K.type==="text");return N?f(N.text||""):!1}return!1},b=o.filter(_),v=b.length>0?b[b.length-1]:void 0,y=Array.isArray(v?.content)?v?.content?.find(O=>O?.type==="text")?.text||"":v?.content,C=bE(_E(o,n)),j=C.length>0&&(!r||d||!c),A=!!v,E=c&&u&&!j&&!A,T=E?pE(o,n):void 0,k=()=>{navigator.clipboard&&w0.text(y||"")};return i.useEffect(()=>{r&&g(!1)},[r]),e.jsx("div",{className:oe("content-item sidekick pb-4"),children:e.jsx(D,{gap:"300",children:e.jsx("div",{children:E?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"inline-flex relative",children:e.jsx(CE,{})}),e.jsx(bh,{status:T})]}):e.jsxs(e.Fragment,{children:[o.length===0&&!r&&!u&&!!l&&e.jsx(sn,{as:"span",variant:"bodyMd",tone:"critical",children:s("SomethingWentWrongWhileSendingYourMessagePleaseTryAgain")}),A&&e.jsx(sn,{as:"span",variant:"bodyMd",fontWeight:"regular",children:c&&!d&&r?e.jsx("div",{className:"message-text",children:e.jsx(_h,{text:y||"",isStreaming:r,onFinish:()=>{g(!0)},urlEmbeded:x})}):e.jsx("div",{className:"message-text",children:e.jsx(Ma,{remarkPlugins:[Ti],components:{a:({node:O,href:R="",children:P,...w})=>{let N=R;const L=["https://ds.zopi.io","https://ds.qc2.zopi.io","https://ds.staging.zopi.io","https://ds.qc.zopi.io"].find(W=>R.startsWith(W));return L?(N=R.replace(L,""),e.jsx(fr,{...w,to:N,rel:"noopener noreferrer",children:P})):e.jsx("a",{target:"_blank",href:R,rel:"noopener noreferrer",children:P})}},children:y||""})})}),a&&j&&e.jsx("div",{className:"mt-4 space-y-4",children:C.map(O=>e.jsx(Om,{stream:a,namespace:O.namespace,message:O.message,components:mE},`${O.namespace}:${O.message.id}`))}),e.jsx("div",{className:oe(c&&r?"invisible":"visible"),children:e.jsx(vE,{message:l,onCopy:()=>k()})})]})})})})}),CE=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("mask",{id:"path-1-inside-1_21398_8646",fill:"white",children:e.jsx("path",{d:"M15.2605 2.27109C15.4627 1.97398 15.3867 1.56719 15.0771 1.38471C13.1866 0.270556 10.9758 -0.19392 8.78574 0.0739948C6.37973 0.368325 4.16252 1.52655 2.54653 3.33323C0.930539 5.13992 0.0257802 7.47206 0.000542063 9.89588C-0.0246961 12.3197 0.831305 14.6702 2.40933 16.5101C3.98735 18.3501 6.17995 19.5542 8.57932 19.8986C10.9787 20.2429 13.4215 19.7041 15.4533 18.3822C17.4851 17.0604 18.9676 15.0455 19.6251 12.7125C20.2236 10.5888 20.1014 8.33303 19.2883 6.29485C19.1551 5.96104 18.7646 5.82399 18.4402 5.97857V5.97857C18.1157 6.13316 17.9805 6.52081 18.1104 6.8559C18.7897 8.60803 18.8853 10.5395 18.3724 12.3595C17.8005 14.3889 16.5109 16.1415 14.7435 17.2913C12.9762 18.4411 10.8513 18.9098 8.76422 18.6103C6.67713 18.3107 4.76988 17.2633 3.39724 15.6628C2.0246 14.0624 1.28 12.0178 1.30195 9.90943C1.32391 7.80107 2.11091 5.77245 3.51659 4.2009C4.92226 2.62935 6.8509 1.62187 8.94378 1.36585C10.8206 1.13625 12.715 1.52501 14.3431 2.46332C14.6545 2.64278 15.0583 2.5682 15.2605 2.27109V2.27109Z"})}),e.jsx("path",{d:"M15.2605 2.27109C15.4627 1.97398 15.3867 1.56719 15.0771 1.38471C13.1866 0.270556 10.9758 -0.19392 8.78574 0.0739948C6.37973 0.368325 4.16252 1.52655 2.54653 3.33323C0.930539 5.13992 0.0257802 7.47206 0.000542063 9.89588C-0.0246961 12.3197 0.831305 14.6702 2.40933 16.5101C3.98735 18.3501 6.17995 19.5542 8.57932 19.8986C10.9787 20.2429 13.4215 19.7041 15.4533 18.3822C17.4851 17.0604 18.9676 15.0455 19.6251 12.7125C20.2236 10.5888 20.1014 8.33303 19.2883 6.29485C19.1551 5.96104 18.7646 5.82399 18.4402 5.97857V5.97857C18.1157 6.13316 17.9805 6.52081 18.1104 6.8559C18.7897 8.60803 18.8853 10.5395 18.3724 12.3595C17.8005 14.3889 16.5109 16.1415 14.7435 17.2913C12.9762 18.4411 10.8513 18.9098 8.76422 18.6103C6.67713 18.3107 4.76988 17.2633 3.39724 15.6628C2.0246 14.0624 1.28 12.0178 1.30195 9.90943C1.32391 7.80107 2.11091 5.77245 3.51659 4.2009C4.92226 2.62935 6.8509 1.62187 8.94378 1.36585C10.8206 1.13625 12.715 1.52501 14.3431 2.46332C14.6545 2.64278 15.0583 2.5682 15.2605 2.27109V2.27109Z",stroke:"url
1980(#paint0_linear_21398_8646)",strokeWidth:"2",mask:"url(#path-1-inside-1_21398_8646)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.4728 5H12.167L14 8.23948L12.167 11.479H11.4728L13.3057 8.23948L11.4728 5ZM8.52723 15H7.83297L6 11.7605L7.83297 8.52104H8.52723L6.69426 11.7605L8.52723 15ZM11.1823 15H10.488L8.65505 11.7605L10.6478 8.23948L8.81482 5H9.50908L11.342 8.23948L9.34931 11.7605L11.1823 15Z",fill:"url(#paint1_linear_21398_8646)"}),e.jsx("g",{clipPath:"url(#clip0_21398_8646)",children:e.jsx("path",{d:"M19.9993 3.75699C18.2478 3.86477 16.8456 5.2956 16.7403 7.08366H16.7275C16.6219 5.2956 15.22 3.86477 13.4688 3.75699V3.74394C15.2203 3.63588 16.6219 2.20505 16.7275 0.416992H16.7403C16.8459 2.20505 18.2478 3.63588 19.9993 3.74394V3.75699Z",fill:"url(#paint2_linear_21398_8646)"})}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_21398_8646",x1:"10",y1:"0",x2:"10",y2:"20",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#DF51FF"}),e.jsx("stop",{offset:"0.7",stopColor:"#4438CC"}),e.jsx("stop",{offset:"1",stopColor:"#332A99"})]}),e.jsxs("linearGradient",{id:"paint1_linear_21398_8646",x1:"10",y1:"5",x2:"10",y2:"15",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#DF51FF"}),e.jsx("stop",{offset:"0.7",stopColor:"#4438CC"}),e.jsx("stop",{offset:"1",stopColor:"#332A99"})]}),e.jsxs("linearGradient",{id:"paint2_linear_21398_8646",x1:"16.734",y1:"0.416992",x2:"16.734",y2:"7.08366",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#DF51FF"}),e.jsx("stop",{offset:"0.7",stopColor:"#4438CC"}),e.jsx("stop",{offset:"1",stopColor:"#332A99"})]}),e.jsx("clipPath",{id:"clip0_21398_8646",children:e.jsx("rect",{width:"6.53055",height:"6.66667",fill:"white",transform:"translate(13.4688 0.416992)"})})]})]}),vE=t=>{const{message:s,onCopy:n}=t,{onRetryMessage:a}=Ba(),r=bt(),l=[...s?[{icon:Sp,label:"Try again...",onClick:async()=>{if(!s){r.error("Not found message to retry");return}a(s)}}]:[],{icon:jp,label:"Copy",onClick:n}];return e.jsx("div",{className:"mt-4 flex items-center gap-4",children:l.map(c=>e.jsx(Et,{content:c.label,children:e.jsx(re,{onClick:c.onClick,variant:"tertiary",icon:c.icon})},c.label))})},wd=t=>{const{item:s,refElRender:n}=t,a=typeof s.content=="object"?s.content[0]?.text||"":s.content||"",r=typeof s.content=="object"?(s.content||[])?.filter(l=>l.type==="image_url"):[],o=l=>AE(l);return e.jsxs("div",{className:"content-item mb-6 user flex justify-end gap-2 flex-wrap [.content-item>img]:max-w-[150px]",ref:n,children:[r.length>0&&e.jsx("div",{className:"flex items-center gap-2 ml-2 justify-end w-full",children:r.map((l,c)=>e.jsx("img",{style:{maxWidth:150},src:l.image_url?.url},`file-${c}`))}),a&&e.jsx("div",{style:{maxWidth:"90%",wordBreak:"break-word"},className:"inline-flex items-center bg-bg-surface-secondary p-3 px-4 rounded-2xl",children:e.jsx(sn,{variant:"bodyMd",as:"span",children:e.jsx("div",{className:"message-text-human",children:e.jsx(Ma,{disallowedElements:["img"],components:{a:({node:l,...c})=>e.jsx("a",{...c,target:"_blank",rel:"noopener noreferrer"})},children:o(a)})})})})]})};function AE(t){return t.replace(/(?<!\]\()(?<!["'])\b(https?:\/\/[^\s]+)(?!["'])/g,s=>`[${s}](${s})`)}const SE=(t,s=5e3)=>{const[n,a]=i.useState(0);return i.useEffect(()=>{if(n>=t.length-1)return;const r=setInterval(()=>{a(o=>o>=t.length-1?(clearInterval(r),o):o+1)},s);return()=>clearInterval(r)},[n,t,s]),t[n]},jE=()=>{const t=SE(["Please wait a moment","AI is processing data","AI is sending the answer"],5e3);return e.jsxs("div",{className:"mr-auto flex items-center gap-2",children:[e.jsx(m,{as:"span",variant:"bodyLg",fontWeight:"regular",children:e.jsx("span",{className:"gradient-text",children:t})}),e.jsxs("span",{className:"flex ml-1 -mt-4",children:[e.jsx("span",{className:"dot animate-pulse-scale delay-0",children:"."}),e.jsx("span",{className:"dot animate-pulse-scale delay-200",children:"."}),e.jsx("span",{className:"dot animate-pulse-scale delay-400",children:"."})]}),e.jsx("style",{children:` 1981 .gradient-text { 1982 background: linear-gradient( 1983 90deg, /* chạy ngang trái â phải */ 1984 rgb(131, 34, 255), 1985 rgb(117, 87, 255), 1986 rgb(115, 91, 255), 1987 rgb(76, 233, 255) 1988 ); 1989 background-size: 200% 100%; /* phóng to Äá» còn chá» di chuyá»n */ 1990 background-position: 0% 50%; 1991 -webkit-background-clip: text; 1992 -webkit-text-fill-color: transparent; 1993 background-clip: text; 1994 color: transparent; 1995 1996 animation: moveGradient 4s linear infinite; 1997 } 1998 1999 @keyframes moveGradient { 2000 0% { 2001 background-position: 200% 50%; /* bắt Äầu bên phải */ 2002 } 2003 100% { 2004 background-position: 0% 50%; /* chạy vá» bên trái */ 2005 } 2006 } 2007 @keyframes fadeIn { 2008 from { 2009 opacity: 0; 2010 transform: translateY(2px); 2011 } 2012 to { 2013 opacity: 1; 2014 transform: translateY(0); 2015 } 2016 } 2017 2018 .dot { 2019 display: inline-block; 2020 font-weight: bold; 2021 font-size: 18px; /* to hÆ¡n má»t chút */ 2022 } 2023 .animate-pulse-scale { 2024 animation: pulseScale 1.2s infinite ease-in-out; 2025 } 2026 .delay-0 { 2027 animation-delay: 0s; 2028 } 2029 .delay-200 { 2030 animation-delay: 0.2s; 2031 } 2032 .delay-400 { 2033 animation-delay: 0.4s; 2034 } 2035 @keyframes pulseScale { 2036 0%, 80%, 100% { 2037 transform: scale(0.8); 2038 opacity: 0.5; 2039 } 2040 40% { 2041 transform: scale(1.6); /* to hẳn lên */ 2042 opacity: 1; 2043 } 2044 } 2045 `})]})},EE=i.memo(i.forwardRef((t,s)=>{const{onAction:n,isFullHeight:a,className:r}=t,{isMobile:o}=xe(),{messages:l,isThreadLoading:c,isLoadingPage:u,assistantId:d,onStopStream:g,onSubmitMessage:h}=Ba(),p=ke(ia),x=he(ia),f=ke(Bn),_=i.useRef(null),b=i.useRef(null),v=i.useRef(null),y=i.useCallback(A=>{const E=_.current;if(!E)return;const T=A?.smooth??!(o||f),k=()=>{const O=Math.max(0,E.scrollHeight-E.clientHeight);T?E.scrollTo({top:O,behavior:"smooth"}):E.scrollTop=O};requestAnimationFrame(()=>{requestAnimationFrame(k)})},[o,f]),C=async A=>{f||(y({smooth:!0}),await h(A),y({smooth:!0}))};i.useImperativeHandle(s,()=>({onSubmitMessage:C,onStopStream:g})),i.useLayoutEffect(()=>{u||c||l.length===0&&!f||y({smooth:!f})},[l,f,u,c,y]),i.useEffect(()=>{const A=b.current,E=_.current;if(!A||!E||u)return;let T=0,k;const O=()=>{cancelAnimationFrame(T),T=requestAnimationFrame(()=>{E.scrollTop=Math.max(0,E.scrollHeight-E.clientHeight)})},R=new ResizeObserver(()=>{if(!c){if(f){k&&clearTimeout(k),O();return}k&&clearTimeout(k),k=setTimeout(()=>{k=void 0,E.scrollTo({top:Math.max(0,E.scrollHeight-E.clientHeight),behavior:"smooth"})},120)}});return R.observe(A),()=>{cancelAnimationFrame(T),k&&clearTimeout(k),R.disconnect()}},[u,c,f]);const S=l.length===0&&!u&&!c&&!f&&!p.includes("idf-"),j=d==="zopi_assistant";return e.jsx("div",{className:oe("content group mx-auto mb-2 rounded-[8px] bg-white",o&&"mb-0 rounded-b-0 shadow-none",j&&"mb-0 flex h-full min-h-0 min-w-0 flex-1 flex-col py-2 w-full"),children:e.jsx("div",{ref:_,id:"zp-copilot-scroll-detail-chat",className:oe("relative overflow-y-auto px-4 py-2 scrollbar-hide [overflow-anchor:none]",j&&"min-h-0 flex-1"),style:j?void 0:{height:`calc(100vh - ${o?90:150}px - 8px - 30px - ${Ce.isShopifyEmbedded()?0:60}px)`},children:e.jsxs("div",{ref:b,className:"min-h-0 min-w-0",children:[!
2045o&&d!=="zopi_assistant"&&e.jsx(IE,{onClose:()=>{x("")}}),u?e.jsx("div",{className:oe("p4",r),children:e.jsx(cE,{})}):e.jsx(e.Fragment,{children:S?e.jsx("div",{className:"px-4"}):e.jsx(e.Fragment,{children:e.jsx("div",{className:oe("p4",r),children:e.jsx(PE,{isFullHeight:a,localMessages:l,onAction:n,onSubmitMessage:C})})})}),e.jsx("div",{style:{height:20},ref:v})]})})})})),TE=e.jsx("svg",{width:"9",height:"11",viewBox:"0 0 9 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.14227 0H6.92147L8.97867 3.56343L6.92147 7.12686H6.14227L8.19948 3.56343L6.14227 0ZM2.8364 11H2.0572L0 7.43657L2.0572 3.87314H2.8364L0.779193 7.43657L2.8364 11ZM5.81625 11H5.03706L2.97984 7.43657L5.21635 3.56343L3.15915 0H3.93834L5.99555 3.56343L3.75905 7.43657L5.81625 11Z",fill:"white"})}),PE=i.memo(t=>{const{localMessages:s,onAction:n,isFullHeight:a,onSubmitMessage:r}=t,{onGroupMessages:o,assistantId:l}=Ba(),c=ke(vh),u=ke(ia),d=ke(Bn),g=o(s||[]),h=i.useRef(null),p=i.useRef(null),x=i.useRef(!0),[f,_]=i.useState(0);if(i.useEffect(()=>{if(g.length>0){x.current=!1;const b=g[g.length-1].human;b?.id!==h.current?h.current=b?.id||null:h.current=null}},[g.length]),i.useLayoutEffect(()=>{p.current&&_(p.current.clientHeight)},[p.current]),g.length===0&&u.includes("idf-")){const b=a?`calc(100vh - 236px - ${f}px)`:`calc(100vh - 324px - ${f}px)`;return e.jsxs("div",{style:{minHeight:b},children:[e.jsx(wd,{refElRender:p,item:{content:[{text:c?.message||"",type:"text"}],additional_kwargs:{},response_metadata:{},type:"human",name:void 0,id:void 0,example:!1}}),e.jsx(jE,{})]})}return e.jsx(D,{gap:"200",children:g.map((b,v)=>{const y=l==="zopi_assistant"?120:0,C=a?`calc(100vh - 236px - ${f+y+50}px)`:`calc(100vh - 316px - ${f+y+50}px + ${Ce.isShopifyEmbedded()?60:0}px)`,S=d&&l!=="zopi_assistant"&&v===g.length-1&&!x.current;return e.jsxs("div",{style:{minHeight:S?C:"auto"},children:[b.human&&e.jsx(wd,{refElRender:p,item:b.human},v),e.jsx(yE,{isLastMessage:v===g.length-1,dataHuman:b.human,dataAI:b.ai,onAction:n})]},`item-${v}-${b.human?.id??"no-human"}`)})})}),IE=({onClose:t,hiddenNewChat:s=!1})=>{const[n,a]=be(ia),[r,o]=be(Bj),{t:l}=J(),{isMobile:c}=xe(),{history:u}=ki(),d=u.find(p=>p.key===n),g=d?.value?.thread_name||"",h=g.length>30?`${g.slice(0,30)}...`:g;return e.jsxs("div",{className:"sticky bg-white rounded-[8px] z-1 top-0 p-3 pl-1 flex items-center justify-between",children:[e.jsx("div",{children:e.jsx(re,{onClick:()=>{o(!r)},disclosure:"down",variant:"tertiary",children:d?h:l(!n&&c?"History":"NewConversation")})}),e.jsxs("div",{className:"flex gap-3",children:[!s&&e.jsx(Et,{content:"New chat",children:e.jsx(re,{onClick:()=>{a("")},variant:"tertiary",icon:Ep})}),e.jsx(Et,{content:"Close chat",children:e.jsx(re,{onClick:()=>{t()},variant:"tertiary",icon:Ws})})]})]})},RE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAB0pJREFUeAG9WHlvG0UUfzO7vuIjjpPYPWI3aUSTkNCU0hbEpXIVWlooiADhFEKAQCBAHBJ/VJwfACQE4hJHCxQqcbYFAkVcrYBS2iQ0tLSkaZMmxrkcx/Zm7d0Z3qzjxEnsxITAG43s3Zl97/eOeTNvCORHFDsX3b3xAbfNV77etuLctQW+mmVMUcqAEKcxi/NharF1RXsPH1B//nonP3SwKfj96704QkY7m0kQyQOIIBa479UNnsabnwNirtAGE8BiMeBMRw504hecIz4K1GkD2W0FUJX2/v0/PdT54AUfZfKbDSAT9uTipz5Z6br08iYWY+5kaIABlQjMrMgYOGzM7LBTWlLQF/n683Xtj63diyMydi1fQOKdJD5Yuqt/G6HOa9TggE4kiSL3/IBkw6ZrzDK/mBIS/ejAas9VuUBlE2BMXHaIdyZbBsoY14VfJJgL4qATmUqWKk/n/tNIAFKK69MBMsCccYAPxdqCDiKJR05hLokQxrUk2OvmR/ctJYUwyVJkMpjTW/mJeEt3GZFMk8fnjjC2QGfMsnJed3MV8cNovGYKFFZgp+3q/VAbgI0cJ8P4iviviONqJNZiaev+iz2NaQxjQiue+XQVIa6NXBMx85+DEUQ4xqcm2a+v2PR5PaTynGEhA1n9bhZSj/UUg1hNc0yMcZAoSUmcOqhbAkWR5vNsHoHFyMD+e1++Qo+rpVyi1Mgc/7IJZRMI4thQEgZUHQrMBIYSOsZzltmUSLpCi8oeeWud+NCIoaXfjBxVT/ZXIL5ZWyedLXsVHYZVBmsrCuCReges8ppBRutc19QPP4dUsMhTRYiYtQaKO1rOt1bKvjU3e4GaK1Pw+T8Hgig0tEZnRIcSG4WHlznhnjoHOE10goucaCXdMB7PxoMCMS0uarizUKaB2jVaOA5pa+VLmHIhmmBwcliDsxda4bULPHD+fGtK47SgjPltuP9ZpczRTESo1GAcrM6K9bL5lPMuZ9EIQJ7GEUJCcR2UJIcba+ywaUUhBByyobiGyUJ4JIwuc5upYb00BWMMTOkzQxZiw8Mgr1i9jtoqq5dioM8YpAxbBwZpeESHx1cVQt8dfnhldTH4EYzOUq7TEVXV613waYcyAUxM4xCKJQ0+uRpuUeDwLqmXmaosnPB1BgmFoqh2d0SDFfOs8OKGErioLOUWNqoshg+IRPFJRxyufLMLNjcugJuW2I33dJRtT1wDdab4RAy6qpQJW7uyjYvvj4aTcEO1Ax7fWASLXXIKwChQ8SD0SGCkXrXzL/ji1yF
2045ouj0Al/hthsUys9nhgSRY0kynJ5RiiCFTwAjzD961CBxitfDxWaKL1SJORduPxaFhZxDUEQY/3V0Oq3yWMYtlUstAAmzmvNYMF4lw2PAiz+gkldi2oxuGk8ywBIHxeFQR0UUf98DVnwWNea23BcbA0Cxy92H+cZjIRBnpnm7GfxaRicnaxVXl1Mw4QjzIAOCuXSEUCEb8XFNZACu9VtgTHIFNe/rBJyYggiO3LjLcmQuMoNY+1ThKZF1ifNwt1OLokpXQH80296JT+aTJIg58uIKEjJ6YBk/uDUMcrSVcuKjQBMcx/+y5dmEKDOQGo+AKC+L3PrsM0xHBTSLWe6iZqvt/2EHsjlGoU7toFE1WYiUQcErgwV+G79xmgFfbImNa5grXblxh0YSek3+6U7sLknt/2EkT7Yd3yG7nqGwO+fZCiwRbD0ehdstx6FM0w5JallqiBd1lE9lyWn7AJZcdyJ/7vqThb94IE0i2Y3LkfEY9xruY7bVTiGOA+15qhxdaw0aWZpOs9SsGtM1EpueHsoGNHA1+v61XLFDS+/GWB83F3lRiz67BpN9U5yhdRtNUl5jh0W9DUP92BwzhtpFprd3dCjjFpJz8cEspKaXhDzY/AKnUljqg1X4VGxzp7HFicM2qwhCMRJI8gcn0jcvmwy01LjiC/2u2HMPAN+WMMTw0Mkt5eV/bhSYfZKwN6n/i3eXOMzfsTYRCGIF81mWPcNtJ3GosmDkVBOh3yqDlQIMnHk0u9cnxPduXH3+6sRlfsQmH/Jrtfe8nByIN6Ir/55BPKTF7be+1XTbv+jSGzOxhlCK1P7JO5eCRBVip5l8yzwIMVrLcWlvV2XYWKYcsZVCajNqs7kcejv92yEVkkwjyOS4UMZx0nVurq6IHz5laKE4WJgbk384ibmtd9Qksm3Cc6DB3pBMkS21VdzYw2QCNgRKmtBU53qE+ryQuCvI+UmYjrMAw1+hy6TzJVOzairz9o2CmKJvLHQKUqXWD78bYdx8uN/sX9kqeUmC6OM5P2KNnaghEY1JRKTGX+SPqL5+d/vt6b2OGZaZomfeF1YL7X7nEfWnD87pkWcLCEWDKsLhigSmnTXFhhfcC1GYHye0Bqqvt4abND3U/e8+/vrCaDMzIq461DaVWb/0a84LKdQV159Szkbi40kudOgkdIhZLl9K6u0Xvad+RiB3fMbjt5S
2045H4B1d6fwOPqgRM2dnL4AAAAABJRU5ErkJggg==",kE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACXFJREFUeAG1WH1wVUcVP/vyRfJeaIAkL5SSJg1tphUhKlZb2uYFpkqnYgqd0UZgGqmFqtNm6mjHOs400RnH8aul9o/K2IJjZZzpV4YOTmvFJFrRaaskKZIGgbwgkOQlQsh3SO5dz549u3ffe8kYOnbJsvft3Y/f/s7vnN29Aj5gklLGsKjCXM1lgQRZIEAAlsNYxrFuGHMb5lYhRCt82AlBFWB+wvf9i74M/i0w9WDeh7kM/t9pPmCpAPG9Lt26lGdus2CgYgHgYli8guUSNJOpA/U87o1D79RZODP5bzgzfdZ5B1CYVQilOdfAtbkr8XmZnszpz78bMTd9YICKNcyNqQN3jZ+AlxMHEdhZmJATKDkQ+EZiOyylFPq3neDGcCXcseQWzOvt4sx4mPeHQqFHsW74igCyGerduq7xbnhp4DUqtS+k9Fd11FnXI1L8YzT4XJRVJO6NboY7Cm5N7iZEOxZbsIwvCCCBAwTHNEz4E/BS/0H43dCbEr1TsyOkBSgsMjOqfSeBDC41bPoh4KZIpXxo5U5RxKbn1I4Aa1KZFHOAI7Oa34OXh+An8WegZ+pMwJjDlDAz8ytpoAqwpnbbaFZBFGYXysaKx7Bkfer+zWjuLfMCnJ2dvQcbvMpAYXBmCJpO/ggSCPJKEulR8WhAMo+pKZyRB09UPAZleaXBAqV8NCMj46k0gBxKjuJjGbGAf1/r+pZMTA+CMatw1kVtrA6NCYVjcp97MDzTNkW7xdmF0LTq21CkmBTUdxjN/DGjx5CzoAYVm8hT8e/5cwdgYHpQYNgSPlA0A0/6cGOkEqqXrocyDB9SvaM4RzAEeyW288DnZ1OvxtGlb8dTv/unEvDz3r3as7U6FFH7khhkYC2qVA0RGOw+9g1rKtP4vqu3Qh1mk750dDfFwmRWRGDotCS0A/Fb4Wj6gWu2w+eKPqMiFQFHqSmHaSUGPc+LmciuXj4d32sY0KvGXLPs9iRwKm2OflYzQUxKqTPxQ324TrHHv31iktgM+tA8B869LMa9CY0XQSLT91gTI9oGM+mx0S7oGDkOBpjHA29EgKnp89FNIheFbibxdQbe3ixQ+icdkKrUrUgiHiIenR2Dw0N/MsFbDX+/8osQm7fKTPrmUBvwFHYi1f6ji29KA6i8cDXuEmpSnITb+8lAdL3Srwz06hPrBIWijn46cvFdVxwFGFWqQmjeKlOpGnYie74WP7Pi02phnnRncQx4Gbo9T6p6aPYgkAtI1/wavIKrJSA6R/4JY7PjVsVo2doQ2rvauGHPeC/0oVcZc0gzCA4wNjsxJ8AjF96WgWlZj6C1KI0ewZxqQLhj00J8VxpI0Ohxa2bM5QrgWiPMfvReqxX834OAGQSSBu6VvkPw+kAL6cgalkMKs6NH0CBQBp5t5ZklkOP4el78v39q0B4msFwTUnGJTIwN+qYTEDCBq/WVdvQgryda0gC+MdACehogr/R805eheY7TUBwEWrhhz/NZEGx61ebUeI8d3zBYZirGZsYgCBMemY69E44Ovwdv/SeZxa+W1wcOATSrDsJCarMHmgvM7gdjmlK/Y5CBF2sdSieghjPDtoGfEhZU3Q9PPE2R36Sqq1bD1qvvBmtWq1nt0Sx+479C2rAVgKF63pH47O1yIEOIL05P+C9MMc0PzMark8znCDL8gxN7kkZ4+LoHYFO0BqSdFETgtT4He7VpGKWybcjLrQo5YPsiLyPsDn9JBWoCqHbxVeEy8lijFRIvalHX6fyPi++J53t/mwTy8RsegfrSLyZ7JzN127Kb4bmPPwmbijfQOGA92cRau0/T++iiIqM/5SRx5SQdZvJodhG4grVxS4cOdQigNT/X8xtxqP8PSXrcWVYH36lsgOKcIjMplODz41h3faSc3r346V8i2xtMvDRx0MpAzbcqr8xqEN/3ipmZmRg+Wxd9pPO7cPTSMXtK0ssBfQagfZzOTOroIRtW7RL3rayF1HSo/zD8efCv0HD9Lli+qDjtvYq197/zMIxiUHbHL8G2L35yr22HDNZnYmrH3eQiTrxEVd6+7FPy78OdIjil8znFJxUIo1fV/cl//QLUHvpg+bYkAHeXbKQ8X1KgUe/y0syY0EzQ6VZUXfURt5nEg2ubCjPDSOVBU3tXdIMIo1Bpi/JZT54xt9UM7xJS7j39gmw6/jM4PzUAC0192PbcZL9wIgQ97yytoyDNAu8gDTKV+03nCIaaL6zY7MRDrVAvcAC6V/gmRGB+7fzvYdvfvg4IdkFAD5x5lTYA4/nq+a7oRmJWS4icZA9hM51Qi0qHMfWstLEDNXJ+qt9pwqZQx3/JV8qkaYNbR03RrVBdfAvUFK+H/MwgbHSPnoKfdj8L717oTBo2PzsiX1j3jChBDyYdIXMovXL1OjMYXuxBU8eIRYyHKuScnewD52TMh2ufBw4u57aCZz2ceIuygB/DDfkVMj8zItRiz08O8M2FvY0X/JXSOmHYo1sWiEYzqgWI4AoYKDV8f/QkHZsC7oC4k8l4+EqgL5b6YOE4Pz6/P3JSgHPj0uSbi5YQD5bXQV3plmB7w40jMyvzV2kAEVit0Vj32GkU8cAcd2bnYsefV6TzwyLQ1HBUDgn7bQRMHzreic3L74Rd5dstOOWwaNoad87MYHL6SETpnQvt5F3g7ovCmcKwJ/W3GI1HCGnRKSrNNc2jxj6vkIHA7uu2w0MVO5LWhvVfTv38QQBVsFbnf3NxbU0coTBirmuLMyOwbula0T1yih0HWIP8NYMjo96ewG5ntAiKdFKY1ytyS+D7q78J65asdcEpOX0P2WuGlGQYrGUWKPB2jZ6ETxSsgQ3ohZX5FQhujXWA5nNvwLOnf60cSH8YYl2SHKX7FUYDxd2MHhdnR8S20q2w49p7ybOl41SYdubk5OyHORK1uHz5cosxsaJfnVrUIKmf3fjmT49vowz+mPgLyqGDwod0vMN8T1iRF4WN0dso7Ny8tMocANz545i3ZGdnt8M8SUxOTpbh5aTHgDODOMJNBul2dtqp/XVkZhQXFiGcyxdF52zn1O3JyspqnO+7oG2HV7ta3Iub55lcfSdpViceXEQr/lb353rz3gBPYSVtkSnjtuJ8Tbm5ua2wgCSmp6f3mUlBf5VXQNoQeGskEkmjXjGOm3gM9MW6msGJucAwIPWiTY2JpnzqfzE2J0Ds3I65Y6GrSgEcQ3ZVkF+LJZ3x1LhYxpGp9nA4HL9SUG76L4UFiMm6nf95AAAAAElFTkSuQmCC",wE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAwVJREFUeAG9lz9MFEEUxr9ZCDZiKP3TnDVnWExI5DRy2BBt0EiwkQh0GhVpsNAELtEYOs4YrQBNaBQToFEqPYxiYSKnQmIHjWJJxEaCjN/bAY67272bQ/d+yd5NZibvzX7z9s0bBUvirq75vYFO5w/qtIM4u2qg+QgKK0pjSQNLbE9VVSCVSqslG7uq2IQTUR2n4X4+cZQADae0wpPZL+pxkXn+HHN1pGIdo6U69iFdVYlzQYo4fp2NUd1Dqef+g3PBXVvHXGOtvuE3mKdALKr7+TeAcBiYnVcJBC1A3pwdQwgRrdH7fkEN5S1A9txZxyLKgUb97IJKS3M7Brjnr1EmlMLotl/5iR3RnVxVBGWCwe16PpFRoB9lhonrkvcfc7ULfiYIiep9wN5qYPlb/hjfvtmh87OwRIy1XwS6LwMHDhWff/IUMD4N9PT5j28wz1TyM2jSsGN0nI4PmvaFDiA5CLyY8p8rTts7TPvpWIBBDddhvo7Agu4rGeeCyHrrDh3dzJ4nyjwYyTiXBc59CDDqoE4x8xUVQIw+nw4eX/4OXOsG9nOB95LcqmrT/4P9V7vMeBCVsOB6X+FxUcZvgcMPCzsXHBThTKsJplJ58yo4PrIXoFhEBCDSy95v8WuVklLqthYjbyHuD6I49C0KpIPGvc9tM/A+MpA620xAiaznW4Kje8RCes+/lgVofPIbrG8w8gvPxkyQ5RqVt7x7m8r8zPSJMsOPYAWjf0ZJycWEkHcQSTQfbTAOZD8LISqdbjVb9JL7vroKKyQTesfx8aiW6sfNNSoGbY2VDPef9eJh7ytgMkrmjovcoTk3JMw6NuHxuFi2I3nz7aWZKUg0ulAmeG9o3va71Xg7r1LKQS/CJ7GzRM/KhO8+e8ViAuGRYFU8sLPD92LCeJhgPFjXCTbkVsNb+J8FAclpN8gVjUdevZ9zweo03K1jPgmJrULz7BbA2y9VSfJWvKI20ETDkdzE5R1qGmnOmdmzhsnU13+4HcdqWag6mPCu3Lzh8rOZZOSuIAT+AukK/hUodRc8AAAAAElFTkSuQmCC",Ll="https://be.aliorders.io/api",Ml={CONNECTION:"/core/chat/connections"},NE=async t=>X(`${Ll}${Ml.CONNECTION}`,t,{method:"POST"}),OE=async(t={})=>X(`${Ll}${Ml.CONNECTION}`,t,{method:"GET"}),DE=async t=>X(`${Ll}${Ml.CONNECTION}/${t}`,{},{method:"DELETE"}),Ul={postConnection:NE,getListConnection:OE,deleteConnection:DE},LE=()=>{const t=ws(),{mutateAsync:s,isPending:n,error:a}=br({mutationFn:r=>Ul.postConnection(r),onSuccess:()=>{t.invalidateQueries({queryKey:vt.ai_assistant.chatConnections()})}});return{connectPhone:s,isConnectPhonePending:n,error:a}},ME=(t={})=>ks({queryKey:vt.ai_assistant.chatConnections(t.platform||"all"),queryFn:async()=>(await Ul.getListConnection(t))?.data?.connections||[],staleTime:60*1e3}),UE=()=>{const t=ws(),{mutateAsync:s,isPending:n}=br({mutationFn:a=>Ul.deleteConnection(a),onSuccess:()=>{t.invalidateQueries({queryKey:vt.ai_assistant.chatConnections()})}});return{deleteConnection:s,isDeleteConnectionPending:n}},Wo={usePostConnectPhone:LE,useGetListConnection:ME,useDeleteConnection:UE},FE=["INVALID_COUNTRY","NOT_A_NUMBER","TOO_SHORT","TOO_LONG","INVALID_LENGTH"],BE=({error:t="",disabled:s=!1,defaultValue:n,onChange:a,c
2045ountry:r})=>{const{t:o}=J(),[l,c]=i.useState(r||"US"),[u,d]=i.useState(""),[g,h]=i.useState(""),[p,x]=i.useState(""),[f,_]=i.useState(!1),b=p1().map(j=>({country:j,phoneCode:h1(j),icon:e.jsx(lr,{fontSize:22,country:j,renderCountry:A=>A,hiddenName:!0})})),v=(j,A)=>{d(j),a&&a(j,A)},y=i.useCallback(()=>_(j=>!j),[]),C=()=>{const{phoneCode:j,phoneNumber:A}=n;d(A),h(j);try{if(n){const E=`+${j}${A}`;if(E.replace(/\s+/g,"").length>4&&E.replace(/\s+/g,"").length<=20){const T=gc(E);T?.country&&c(T.country)}else{const T=g1(E),k=T&&FE.includes(T)&&T!=="TOO_LONG"?null:gc(E);c(k?k?.country:r||b.find(O=>O.phoneCode===j)?.country)}}}catch(E){console.log("error onGetPhoneNumberDefault",E),c(r||b.find(T=>T.phoneCode===j)?.country)}};i.useEffect(()=>(C(),()=>{d(""),h(""),c("US")}),[]),i.useEffect(()=>{f||x("")},[f]);const S=e.jsx(re,{size:"large",disclosure:"select",icon:e.jsx("div",{className:"msui-w-100 msui-flex-center",children:b.find(j=>j.country===l)?.icon}),disabled:s,onClick:()=>{requestAnimationFrame(()=>{!s&&y()})},fullWidth:!0});return e.jsxs(D,{gap:"100",children:[e.jsx(m,{as:"span",children:o("Phone")}),e.jsxs("div",{className:"msui-flex msui-f lex-align-items-center",style:{gap:"8px"},children:[e.jsx("div",{style:{width:"60px"},children:e.jsxs(Gs,{preferredAlignment:"left",active:f,activator:S,autofocusTarget:"first-node",onClose:()=>{requestAnimationFrame(()=>{y()})},children:[e.jsx(nt,{children:e.jsx(gt,{type:"search",label:"SearchField",autoComplete:"off",placeholder:o("Search"),labelHidden:!0,value:p,onChange:j=>{requestAnimationFrame(()=>{x(j)})}})}),e.jsx(rn,{style:{maxHeight:"400px",minWidth:250,maxWidth:350},children:e.jsx(rp,{sections:[{items:b.filter(j=>q.lowerCase(`${pc[j.country]} +${j.phoneCode} ${j.country}`).includes(q.lowerCase(p))).map(j=>({prefix:e.jsx(lr,{fontSize:22,country:j.country,renderCountry:A=>A,hiddenName:!0}),active:l===j.country,content:`${pc[j.country]} +${j.phoneCode}`,onAction:()=>{requestAnimationFrame(()=>{c(j.country),h(`${j.phoneCode}`),y(),a&&a(u,`${j.phoneCode}`)})}}))}]})})]})}),e.jsxs("div",{style:{width:"calc(100% - 60px)"},children:[e.jsx(gt,{disabled:s,label:"",labelHidden:!0,autoComplete:"off",placeholder:o("EnterYourPhone"),type:"text",value:u,onChange:j=>{const A=j.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"");v(A,g)},error:t})," "]})]})]})},jh=i.forwardRef(({onSuccess:t},s)=>{const[n,a]=i.useState(!1),[r,o]=i.useState("1"),[l,c]=i.useState(""),[u,d]=i.useState(""),g=bt(),[h,p]=i.useState("whatsapp"),x=li.find(E=>E.id===h),{connectPhone:f,isConnectPhonePending:_}=Wo.usePostConnectPhone();i.useImperativeHandle(s,()=>({open:E=>{a(!0),p(E)},close:()=>b(),isOpen:()=>n}));const b=i.useCallback(()=>{a(!1),o("1"),c(""),d("")},[]),v=()=>l.trim()?/^\d{5,15}$/.test(l.replace(/\s+/g,""))?(d(""),!0):(d("Please enter a valid phone number"),!1):(d("Phone number is required"),!1),y=E=>{const T=E?.data?.links?.href,k=E?.data?.links?.target||"_blank";T&&window.open(T,k,"noopener,noreferrer")},C=async()=>{if(v())try{const E=await f({platform:"whatsapp",platform_identifier:`${r}${l.trim()}`});y(E),g.success("Connection created. Please open WhatsApp and send the welcome message to complete the connection."),t?.(),b()}catch{d("Failed to connect. Please try again.")}},S=async()=>{try{const E=await f({platform:"telegram"});if(!E?.data?.links?.href)return;y(E),g.success("Telegram has been opened â press START in the bot to complete the connection."),t?.(),b()}catch{g.error("Failed to connect Telegram. Please try again.")}},j=async()=>{try{const E=await f({platform:h});y(E),g.success(`Connected to ${x?.label||h}.`),t?.(),b()}catch{g.error("Failed to connect. Please try again.")}},A=async()=>{switch(h){case"whatsapp":C();break;case"telegram":S();break;default:j();break}};return e.jsx(Xe,{open:n,onClose:b,title:`Connect ${x?.label||""}`,primaryAction:{content:h==="telegram"?"Open Telegram":h==="facebook"?"Open Messenger":"Connect",onAction:A,loading:_,disabled:h==="whatsapp"?!l.trim():!1},secondaryActions:[{content:"Cancel",onAction:b,disabled:_}],size:"small",children:e.jsx(Xe.Section,{children:e.jsxs(D,{gap:"400",children:[h==="whatsapp"&&e.jsxs(D,{gap:"200",children:[e.jsx(BE,{defaultValue:{phoneCode:r,phoneNumber:l},country:"US",onChange:(E,T)=>{requestAnimationFrame(()=>{o(T),c(E)})}}),u&&e.jsx(m,{as:"span",tone:"critical",variant:"bodySm",children:u})]}),h==="telegram"&&e.jsx(D,{gap:"200",children:e.jsxs(m,{as:"span",children:["Click ",e.jsx("strong",{children:"Open Telegram"})," to launch the Zopi bot. In Telegram, press",e.jsx("strong",{children:" START"})," to finish linking your account."]})}),h==="facebook"&&e.jsx(D,{gap:"200",children:e.jsxs(m,{as:"span",children:["Click ",e.jsx("strong",{children:"Open Messenger"})," to launch the Zopi bot. In Messenger, press",e.jsx("strong",{children:" GET STARTED"})," to finish linking your account."]})}),h!=="whatsapp"&&h!=="telegram"&&h!=="facebook"&&e.jsxs(m,{as:"span",children:["Do you want to connect ",x?.label,"?"]})]})})})});jh.displayName="CreateConnection";const li=[{id:"telegram",label:"Telegram",icon:RE},{id:"whatsapp",label:"WhatsApp",icon:kE},{id:"facebook",label:"Messenger",icon:wE,isHidden:!0}];function Eh({listClassName:t="py-3 px-2 w-[315px]",onAfterAction:s}){const{data:n=[]}=Wo.useGetListConnection(),{getUserInfo:a}
2045=de(),r=a(),{deleteConnection:o,isDeleteConnectionPending:l}=Wo.useDeleteConnection(),c=i.useRef(null),[u,d]=i.useState(null),g=i.useMemo(()=>{const x=new Map;return n.forEach(f=>{f.status==="active"&&x.set(f.platform,f)}),x},[n]),h=i.useMemo(()=>{const x=new Set(["zopi"]);return g.forEach((f,_)=>x.add(_)),x},[g]),p=async()=>{u&&(await o(u.id),d(null))};return i.useEffect(()=>{if(new URL(window.location.href).searchParams.get("is_show_connect_facebook")==="true"||r?.id===101666226){const _=li.find(b=>b.id==="facebook");_&&(_.isHidden=!1)}},[li.length,r?.id]),e.jsxs("div",{className:"chat-connector-panel",children:[e.jsx("div",{className:t,children:li.map(x=>{const f=h.has(x.id),_=g.get(x.id),b=f&&x.id!=="zopi"&&!!_,v=n.find(y=>y.platform===x.id);return!x.isHidden&&e.jsxs("div",{className:oe("flex items-center justify-between px-2 py-1.5 rounded-lg",!f&&"hover:bg-[rgba(0,0,0,0.04)] cursor-pointer"),onClick:()=>{f||c.current?.open(x.id)},children:[e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("img",{src:x.icon,alt:"",className:"w-6 h-6 shrink-0 rounded-sm"}),e.jsxs(D,{children:[e.jsx(m,{as:"span",variant:"bodyMd",children:x.label}),f&&e.jsxs(U,{gap:"200",blockAlign:"center",children:[e.jsx(m,{as:"span",variant:"bodySm",tone:"success",children:"Connected"}),x?.id==="facebook"&&e.jsx(Vp,{target:"_blank",url:v?.short_link||"",children:"Open app"})]})]})]}),e.jsx("div",{className:"flex items-center justify-center w-7 h-7",children:b?e.jsx("div",{onClick:y=>{y.stopPropagation(),d({id:_.id,platform:x.id,label:x.label})},children:e.jsx(Et,{content:"Disconnect",children:e.jsx(re,{icon:Bg,variant:"tertiary",tone:"critical"})})}):f?e.jsx(ee,{source:Je,tone:"success"}):e.jsx(ee,{source:jn})})]},x.id)})}),e.jsx(jh,{ref:c}),e.jsx(Xe,{open:!!u,onClose:()=>d(null),title:`Disconnect ${u?.label||""}?`,primaryAction:{content:"Disconnect",destructive:!0,loading:l,onAction:p},secondaryActions:[{content:"Cancel",onAction:()=>d(null),disabled:l}],size:"small",children:e.jsx(Xe.Section,{children:e.jsxs(m,{as:"span",children:["This will stop syncing messages from ",u?.label,". You can reconnect anytime."]})})})]})}const HE="/assets/expert-help-DVhVKD6O.png",Th=t=>`${st.CLOSED_HUMAN_SUPPORT_EXPERT_PANEL}_${t}`,GE=t=>ge.localStorage.get(Th(t))==="true",WE=t=>{ge.localStorage.set(Th(t),"true")};function VE({isPanel:t}){const{t:s}=J(),a=dt().getShop().id??"",[r,o]=i.useState(()=>!GE(a)),[l,c]=i.useState(!1),u=i.useRef(null),[d,g]=i.useState(!1),h=i.useRef(null),f=de().getCurrentPlan("AO").is_expert_care??!1,_=async()=>{Ke.trackingEventUsersAction({event_name:$.SUBSCRIPTION_EXPERT_SERVICE_PAYMENT_CLICKED}),g(!0),await h.current?.onConfirmCharge({isYearly:!1,isChargeOneTime:!0}),setTimeout(()=>{g(!1)},1e3)};i.useEffect(()=>{if(!l)return;const S=j=>{u.current&&!u.current.contains(j.target)&&c(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]);const b=[{label:s("LaunchFaster"),icon:Hg},{label:s("AvoidCostlyMistakes"),icon:Gg},{label:s("ExpertStoreAudit"),icon:Wg},{label:s("247PriorityHelp"),icon:Vg},{label:s("LifetimeExpertPartner"),icon:Yg}],v=[s("ReviewedByRealExperts"),s("NoSubscription"),s("OnetimePayment")],y=()=>{WE(a),o(!1)};if(!r&&Ce.isShopifyEmbedded()||f)return null;if(t)return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-bg-surface border-border flex flex-col rounded-xl h-full",children:[e.jsxs("div",{className:"overflow-auto flex-1",children:[e.jsx("img",{src:HE,alt:"expert-help",className:"w-full object-cover mt-4"}),e.jsxs("div",{className:"p-4 grid gap-8",children:[e.jsx(m,{as:"p",variant:"headingLg",fontWeight:"semibold",children:s("LaunchScaleYourBusinessWithExpertGuidance")}),e.jsxs("p",{className:"text-4xl font-bold text-text-link",children:["$9.90 ",e.jsx("span",{className:"text-[13px] font-normal",children:s("OneTime")})]}),e.jsxs("div",{className:"grid gap-5",children:[e.jsx("div",{className:"flex gap-3 flex-wrap",children:b.map(S=>e.jsxs("div",{className:"w-fit flex items-center gap-1 py-1 px-3 bg-bg-surface-secondary rounded-lg",children:[e.jsx(ee,{source:S.icon,tone:"subdued"}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:S.label})]},S.label))}),e.jsx("div",{className:"grid gap-2.5",children:v.map(S=>e.jsxs("div",{className:"w-fit flex items-center gap-1 ",children:[e.jsx(ee,{source:Je}),e.jsx(m,{as:"p",variant:"bodyMd",children:S})]},S))})]})]})]}),e.jsx("div",{className:"p-4 bg-bg-surface",children:e.jsx(re,{variant:"primary",size:"large",disabled:d,loading:d,fullWidth:!0,onClick:_,children:s("GetExpertHelp")})})]}),e.jsx(un,{onChargeError:()=>{},ref:h,app:"AO"})]});const C=e.jsxs("div",{className:"pt-8 pb-6 px-5 grid gap-5",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(m,{as:"p",variant:"headingLg",fontWeight:"semibold",children:["ð ",s("LaunchScaleYourBusinessWithExpertGuidance")]}),e.jsxs("p",{className:"text-4xl font-bold text-[#5546FF]",children:["$9.90 ",e.jsx("span",{className:"text-[13px] font-normal",children:s("OneTime")})]})]}),e.jsx("div",{className:"flex gap-3 flex-wrap",children:b.map(S=>e.jsxs("div",{className:"w-fit flex items-center gap-1 py-1 px-3 bg-bg-surface-secondary rounded-lg",children:[e.jsx(ee,{source:S.icon,tone:"subdued"}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:S.label})]},S.label))}),e.jsx("div",{className:"grid gap-2.5",children:v.map(S=>e.jsxs("div",{className:"w-fit flex items-center gap-1 ",children:[e.jsx(ee,{source:Je}),e.jsx(m,{as:"p",variant:"bodyMd",children:S})]},S))}),e.jsx(re,{variant:"primary",size:"large",disabled:d,loading:d,fullWidth:!0,onClick:_,children:s("GetExpertHelp")})]});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:u,className:"relative w-full overflow-visible",children:[e.jsxs("div",{role:"button",tabIndex:0,className:"w-full p-3 rounded-xl bg-bg-surface border border-border
2045cursor-pointer shadow-[0px_4px_20px_0px_#0000000D] flex justify-between items-center",onClick:()=>c(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),c(j=>!j))},children:[e.jsxs(m,{as:"span",variant:"bodyMd",children:["ð ",e.jsx("span",{className:"ml-1",children:s("ExpertHelp")})]}),e.jsxs("div",{className:"[&>p]:text-text-link flex items-center gap-2",children:[e.jsxs(m,{as:"p",variant:"bodyLg",fontWeight:"bold",children:["$9.90 ",e.jsx("span",{className:"text-text-secondary text-[13px] font-normal",children:s("OneTime")})]}),Ce.isShopifyEmbedded()&&e.jsx("span",{className:"inline-flex",onClick:S=>S.stopPropagation(),onKeyDown:S=>S.stopPropagation(),children:e.jsx(re,{variant:"tertiary",size:"micro",icon:Ws,onClick:y})})]})]}),l&&e.jsx("div",{className:"absolute bottom-full left-0 right-0 z-50 mb-2 overflow-visible rounded-xl border border-border bg-bg-surface shadow-[0px_4px_20px_0px_#0000000D]",children:C})]}),e.jsx(un,{onChargeError:()=>{},ref:h,app:"AO"})]})}function YE(t){const{refThread:s,isFullHeight:n}=t,{t:a}=J(),r=dt(),{isPlanFree:o}=de(),l=!1,c=he(In),{isMobile:u}=xe(),{history:d,onFetchHistoryThread:g,searchHistory:h,setSearchHistory:p,loading:x}=ki(),[f,_]=be(ia),b=he(vh),v=he(Ol),y=he(yh),[C,S]=i.useState(!1),[j,A]=i.useState(!1),[E,T]=i.useState(!0),[k,O]=i.useState(""),[R,P]=i.useState(!1),w=i.useRef(!1),N=i.useRef(!1),{messages:K,isLoadingPage:L}=Ba(),W=ke(Bn),H=r.getShop().id,Z=K.length===0&&!W&&!L,te=K.length>0||W||L,ne=i.useCallback(()=>{requestAnimationFrame(()=>{c({keyFeature:"AI_CHAT_ASSISTANT",isFullPlan:!1,total_used:0,feature_used:"",app:"AO"})})},[c]),le=i.useCallback(async()=>{s.current?.onStopStream(),b({message:"",urlsFile:[]}),S(!0);try{const F=(await hn.postCreateThreads(H))?.thread_id||"";return F?(y(!0),v(!1),_(F),await g(void 0,void 0,{silent:!0}),O(""),F):(console.log("Create thread error"),"")}finally{S(!1)}},[l,g,ne,b,_,H]),B=i.useCallback(I=>{!I||I===f||(s.current?.onStopStream(),b({message:"",urlsFile:[]}),w.current=!1,y(!0),v(!1),_(I),O(""))},[l,ne,b,v,y,_,f]);i.useEffect(()=>{x||d.length===0||f||k!==""||w.current||N.current||(N.current=!0,_(d[0].key))},[x,d,f,k,_]);const ie=[{label:a("ChatConnector"),value:"chat-connector",icon:zg}],V=[{id:1,title:a("ConnectYourPreferredChatAppBelow")},{id:2,title:a("OpenTheZopiBotInYourChatApp")},{id:3,title:a("YourAgentHandlesTheRestAutomatically")}],M=()=>{switch(k){case"chat-connector":return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain",children:e.jsxs("div",{className:"py-7 px-4 max-w-[600px] mx-auto h-fit my-auto flex w-full flex-col gap-6",children:[e.jsxs("div",{className:"mx-auto grid max-w-[420px] gap-3 text-center",children:[e.jsx(m,{as:"p",variant:"heading2xl",fontWeight:"bold",children:a("ChatConnector")}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:a("ConnectAChatAppAndYourAIAgentWillSendYouAlertsUpdatesAndActionsNoNeedToOpenZopi")})]}),e.jsxs("div",{className:"grid gap-7 rounded-xl border border-border bg-bg-fill-secondary px-6 py-5",children:[e.jsx(m,{as:"p",variant:"headingSm",tone:"subdued",fontWeight:"semibold",children:a("HowItWorks")}),V.map(I=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-black font-medium text-white",children:I.id}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",fontWeight:"medium",children:I.title})]},I.id))]}),e.jsxs("div",{children:[e.jsx("div",{className:"pl-1",children:e.jsx(m,{as:"p",variant:"headingMd",tone:"subdued",children:a("ChooseYourChatApp")})}),e.jsx(Eh,{listClassName:"mt-4 grid gap-4"})]})]})});default:return e.jsxs("div",{className:"flex min-h-0 h-full w-full flex-1 flex-col",children:[e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden px-1 sm:px-2",children:[Z&&e.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-6 sm:py-8",children:e.jsxs("div",{className:"flex min-h-[min(280px,45dvh)] flex-1 flex-col items-center justify-center gap-6 sm:gap-10",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 sm:flex-row sm:items-center sm:gap-4",children:[e.jsx(VS,{className:"size-7 shrink-0 sm:size-7.5"}),e.jsx(m,{as:"p",variant:"heading2xl",fontWeight:"bold",alignment:"center",children:a("AIAgent")})]}),e.jsxs("div",{className:"w-full max-w-fit border border-border bg-bg-surface px-4 py-5 shadow-[0px_4px_20px_0px_#00000003] sm:px-6 rounded-2xl grid gap-5 sm:gap-7",children:[e.jsx(m,{as:"p",variant:"headingSm",fontWeight:"semibold",tone:"subdued",children:a("WhatYourAgentDoes")}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"w-fit",children:e.jsx(ds,{source:sa})}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:a("HandlesYourOrdersListsFulfillsAndRetrievesDetailsIndividuallyOrInBulk")})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"w-fit",children:e.jsx(ds,{source:ms})}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:a("ManagesProductListingsPushesToStoreAuditsStockUpdatesPricing")})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"w-fit",children:e.jsx(ds,{source:lc})}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:a("FindsProductsForYourStoreByKeywordPriceAndImage")})]})]})]})}),e.jsx("div",{className:oe("min-h-0 flex-1 overflow-hidden",te?"flex flex-col":"hidden"),children:e.jsx(EE,{className:"px-0",ref:s,onAction:{}})})]}),e.jsx("div",{className:oe("shrink-0 bg-bg-surface px-2 pb-5 pt-1 sm:px-6",u&&"pb-[max(0.5rem,env(safe-area-inset-bottom))]"),children:e.jsx("div",{className:"mx-auto max-w-full",children:e.jsx("div",{className:"shadow-[0px_4px_20px_0px_#0000000D] rounded-full",children:e.jsx(Vj,{onSubmitMessage:(I,F)=>{const G=K.length===0;s.current?.onSubmitMessage({message:I,isNewThread:!1,isFirstSubmitMessage:G,urlsFile:F,graphId:"zopi_assistant"})},onStopStream:()=>{s.current?.onStopStream()},loading:!1,size:"small"})})})})]})}};return e.jsxs("div",{className:oe("flex rounded-xl h-full min-h-0 relative"),children:[e.jsx("div",{className:oe("shrink-0 h-full min-h-0 border-r border-border flex flex-col bg-[#fafafa] rounded-l-[16px] overflow-hidden transition-[width] duration-300 ease-in-out",E?"w-[280px]":"w-0 border-r-0",R&&"hidden"),children:e.jsxs("div",{className:"flex flex-col p-4 h-full min-h-0 w-[280px]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-4 min-w-0",children:[!j&&e.jsx("span",{className:"shrink-0 truncate",children:e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:a("Recents")})}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 justify-end",children:[(d.length>0||j)&&e.jsx("div",{className:oe("flex items-center justify-between gap-2",j&&"flex-1"),children:j?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"min-w-0 flex-1 max-w-[min(100%,220px)]",children:e.jsx(gt,{label:a("Search"),labelHidden:!0,placeholder:a("Search"),value:h,onChange:p,autoComplete:"off",clearButton:!0,onClearButtonClick:()=>p(""),autoFocus:!0,size:"slim"})}),e.jsx(re,{variant:"tertiary",onClick:()=>{p(""),A(!1)},children:a("Cancel")})]}):e.jsx(re,{icon:lc,variant:"tertiary",onClick:()=>A(!0),accessibilityLabel:a("Search")})}),e.jsx(re,{loading:C,onClick:le,icon:Ep,variant:"tertiary"}),e.jsx(re,{icon:Tp,variant:"tertiary",onClick:()=>T(!1),accessibilityLabel:"Collapse sidebar"})]})]}),e.jsx("div",{className:oe(x?"flex-1 h-full":d.length>0?"mb-4 flex-1 overflow-y-auto":"my-auto h-full flex-1"),children:x?e.jsxs("div",{className:"grid gap-4 text-center h-fit w-full",children:[e.jsx(Se,{width:"100%",height:30}),e.jsx(Se,{width:"100%",height:30}),e.jsx(Se,{width:"100%",height:30}),e.jsx(Se,{width:"100%",height:30})]}):d.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center h-full justify-center flex-1",children:[e.jsx(m1,{className:"size-9 stroke-1 text-text-secondary"}
2045),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:j?"No conversation found":"No conversation yet"})]}):e.jsx("div",{className:"grid gap-2 flex-1",children:d.map(I=>e.jsx("div",{role:"button",tabIndex:0,onClick:()=>B(I.key),onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),B(I.key),O(""))},className:oe("h-8 flex flex-col justify-center p-2 rounded-lg shrink-0 cursor-pointer hover:bg-bg-surface-secondary transition-colors",I.key===f&&"bg-bg-surface"),children:e.jsx("span",{className:"text-[13px] leading-[20px] font-medium text-[#616161] line-clamp-1",children:I.value?.thread_name||""})},I.key))})}),e.jsxs("div",{className:"grid gap-2 mt-auto",children:[e.jsx($s,{}),e.jsxs("div",{className:"grid gap-2",children:[ie.map(I=>e.jsxs("div",{className:oe("flex items-center gap-2 py-3 px-2 rounded-xl cursor-pointer hover:bg-bg-surface-secondary transition-colors",I.value===k&&"bg-bg-surface"),onClick:()=>{w.current=!0,O(I.value),_("")},children:[e.jsx("div",{className:"w-fit",children:e.jsx(ee,{source:I.icon})}),e.jsx(m,{as:"span",variant:"bodyMd",children:I.label})]},I.label)),e.jsxs("div",{className:oe("flex items-center gap-2 py-3 px-2 rounded-xl cursor-pointer hover:bg-bg-surface-secondary transition-colors"),onClick:()=>{P(!0)},children:[e.jsx("div",{className:"w-fit",children:e.jsx(ee,{source:Pp})}),e.jsx(m,{as:"span",variant:"bodyMd",children:a("SkillLibrary")})]},"skill-library"),e.jsx(VE,{})]})]})]})}),!E&&e.jsx("div",{className:oe("shrink-0 flex flex-col items-center pt-4 px-1 border-r border-border bg-[#fafafa] rounded-l-[16px]",R&&"hidden"),children:e.jsx(re,{icon:Ys,variant:"tertiary",onClick:()=>T(!0),accessibilityLabel:"Expand sidebar"})}),e.jsx("div",{className:"flex min-w-0 flex-1 h-full min-h-0 flex-col overflow-hidden rounded-r-[15px] border-border bg-bg-surface",children:e.jsx("div",{className:"flex min-h-0 flex-1 flex-col w-full",children:M()})}),R&&e.jsx("div",{className:"absolute top-0 left-0 w-full max-h-full overflow-auto bg-bg-surface rounded-2xl z-1",children:e.jsx(Dj,{onClose:()=>P(!1)})})]})}const zE=t=>{J();const{refThread:s,isFullHeight:n,className:a}=t,{groupHistory:r,getMessagesMetadata:o,nameAI:l,setNameAI:c}=Ba(),[u,d]=i.useState(l||"Daisy"),[g,h]=i.useState("conversation");i.useEffect(()=>{if(r.length>0){const x=[];r.forEach(f=>{f.ai.filter(b=>b.name!=="sidekick").forEach(b=>{const y=o(b)?.firstSeenState?.metadata?.writes?.analysis_agent?.ui||[];Array.isArray(y)&&y.length>0&&y.forEach(C=>{x.some(S=>S.id===C.id)||x.push(C)})})})}},[r]),i.useEffect(()=>{d(l||"Daisy")},[l]);const p=i.useMemo(()=>q.debounce(c,1e3),[c]);return i.useEffect(()=>(u!==l&&p(u),()=>p.cancel()),[u,l,p]),e.jsx("div",{className:oe("relative h-full",a),style:{margin:"0 auto",gap:0},children:e.jsx(YE,{refThread:s,isFullHeight:n})})},KE={graph_id:"zopi_assistant"},QE=()=>{const[t,s]=be(ia),n=i.useRef(null),a=la(Ol),o=dt().getShop().id,l=async()=>{const u=(await hn.postCreateThreads(o))?.thread_id||"";return u?(s(u),u):""};return i.useEffect(()=>((async()=>{const u=(await hn.getAgentThreads())?.data?.threads?.web?.[0];u?s(u):l()})(),()=>{s(""),a()}),[]),e.jsx("div",{className:"flex-1 w-full flex min-h-0 pt-2",children:e.jsx(Zj,{searchStoreFilter:KE,children:e.jsx("div",{className:oe("duration-800 flex h-full min-h-0 flex-1 flex-col"),children:e.jsx(rE,{assistantId:"zopi_assistant",threadId:t,isNewThread:!1,onThreadNotFound:()=>{s(""),l()},children:e.jsx(zE,{className:"p-0",isFullHeight:!0,refThread:n,threadId:t})})})})})},Ph=({isAtOnboarding:t=!1})=>{const{t:s}=J(),{isMobile:n}=xe(),[a,r]=be(dr),[o,l]=be(ka),[c,u]=be(dp),d=Pt(),g=[{id:"ai-research",name:"AI Help"},{id:"ask-ai",name:"AI Assistant"},{id:"chat",name:"Human Support"}],h=()=>{l(!1),u("")},p=e.jsxs("div",{className:"flex flex-col flex-1 w-full max-w-[1072px] mx-auto min-h-0",children:[e.jsx("div",{className:"px-4",children:e.jsx("div",{className:"flex gap-3 sticky top-13 left-0 right-0",children:g.map(x=>e.jsx("button",{onClick:()=>{if(n&&x.id==="chat"){d.openChat();return}r(x.id)},className:oe("flex-1 flex gap-1 items-center justify-center min-h-8","px-2 py-1.5 rounded-lg cursor-pointer border border-border",a===x.id&&"bg-bg-inverse border-bg-inverse text-white"),children:e.jsx(m,{as:"span",variant:"bodyMd",tone:"inherit",truncate:!0,children:x.name})},x.id))})}),a!=="ask-ai"&&e.jsx(Q,{paddingBlockStart:"400",children:e.jsx($e,{})}),e.jsxs("div",{className:"flex w-full flex-1 min-h-0",children:[a==="ai-research"&&e.jsx("div",{className:"flex-1 w-full flex min-h-0 mt-4",children:e.jsx("div",{className:"overflow-hidden flex-1 flex",children:e.jsx(IS,{url:c})})}),a==="ask-ai"&&e.jsx(QE,{}),a==="chat"&&!n&&e.jsx("div",{className:"p-4 w-full flex-1 flex",children:e.jsx(gA,{})})]})]});return n?e.jsx(xt,{title:s("GetSupport"),styleDrawerBody:{flex:1},placement:"right",visible:o,onClose:h,children:e.jsx("div",{className:"h-full flex flex-col",children:p})}):e.jsx(Is,{width:800,contentStyle:{background:"#fff"},visible:o,onClose:h,children:e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"bg-white px-4",children:e.jsx(us,{title:s("GetSupport"),backAction:{onAction:h},secondaryActions:e.jsx("div",{className:"flex items-center min-h-7",children:e.jsx(re,{external:!0,url:Ea.HOME,target:"_blank",variant:"tertiary",icon:Pp})})})}),p]})})},qE=({onUpdateOnboarding:t})=>{const{getUserInfo:s,fetchCurrentPlan:n}=de(),a=dt(),r=s(),o=up(),l=Pt(),{isMobile:c}=xe(),u=async()=>{try{await dh.postCompleteOb({goal:[],categories:[],ob_goal:"discovery",ob_niche_list:""})}catch(g){Io({message:g?.message||"unknown error"})}},d=()=>
2045{if(r?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE"){Cs.postMetaOneTimeCharge({meta_key:"AO_ACCOUNT_ONE_TIME_CHARGE_ANTI_CLOSE_STORE"}),t(),u();return}Cs.updateOnboardingPricing(),t(),u(),n(),o(`${Y.HOME_PAGE.PATH}?from=onboarding`),l.setUserStartSelectFreePlan(a.getShop().plan_name),ss("pricing_continue_click",{})};return e.jsxs("div",{style:{paddingRight:c?0:"var(--ms-app-sidebar-width)",transition:"padding-right 0.3s ease"},children:[e.jsx("div",{className:"flex min-h-screen mx-auto",style:{...c?{maxWidth:1144}:Ua[1428],...!c&&Ce.isShopifyEmbedded()?{minWidth:1144,maxWidth:1144}:{}},children:e.jsx("div",{className:"w-full",children:e.jsx(wv,{isTryForFreeOb:!1,onUpdateOnboarding:()=>{t(),u()},onUpdateCompleteOnboarding:u,handleTryForFreePlan:d})})}),!c&&e.jsx(Ph,{isAtOnboarding:!0})]})},Vo=({onboardingType:t,onNext:s})=>{const a=de().getUserInfo(),r=pt();return i.useEffect(()=>{ss("pricing_view",{}),Xy()},[]),i.useEffect(()=>{a.onboarding.AO.length===0&&r(Y.HOME_PAGE.PATH)},[]),t===Mt.PRICING?a?.plan_reinstalled||a?.first_cycle_charge_type==="WAITING_RECURRING_CHARGE"?e.jsx(kv,{setOnboarding:()=>s(Mt.PRICING)}):e.jsx(qE,{onUpdateOnboarding:()=>s(Mt.IMPORT)}):null},Ze=(t,s,n={fallback:null})=>{let a=t;s&&(a=()=>ZE(()=>t().then(o=>({default:s(o)}))));const r=i.lazy(a);return n.fallback||(n.fallback=e.jsx(ut,{children:e.jsx(_t,{})})),o=>e.jsx(i.Suspense,{fallback:n.fallback,children:e.jsx(r,{...o})})},ZE=function(t){return new Promise((s,n)=>{const a=JSON.parse(ge.sessionStorage.get(tn.RETRY_REFRESH_PAGE)||"false");t().then(r=>{ge.sessionStorage.set(tn.RETRY_REFRESH_PAGE,"false"),s(r)}).catch(r=>{a||ge.sessionStorage.set(tn.RETRY_REFRESH_PAGE,"true"),n(r)})})},Kn=Ze(()=>Me(()=>import("./module-BiZ_jzQw.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83])),t=>t.AuthPage),XE=Ze(()=>Me(()=>import("./module-oH8_ZL24.js"),__vite__mapDeps([84,6,1,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,85,86,87,88,89,90,0,4,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(wa,{})}),yi=Ze(()=>Me(()=>import("./module-DpkYiACI.js"),__vite__mapDeps([193,1,2,3,45,46,47,48,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.NotFoundPage,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Nd=Ze(()=>Me(()=>import("./module-DgzxiBL5.js"),__vite__mapDeps([194,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(wa,{})}),Od=Ze(()=>Me(()=>import("./module-Dpbv88MK.js"),__vite__mapDeps([195,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81])),t=>t.CampaignPage,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Dd=Ze(()=>Me(()=>import("./module-DuutY50N.js"),__vite__mapDeps([196,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,90,91,92,93,94,95,197,198,199,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(wa,{})}),Yo=Ze(()=>Me(()=>import("./module-BRMhr04P.js"),__vite__mapDeps([200,1,2,3,45,46,47,48,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,199,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.OnboardingPage,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})});function JE({to:t}){const s=pt();return i.useEffect(()=>{s(t)},[t]),e.jsx(e.Fragment,{})}const zr=()=>e.jsx(JE,{to:Y.HOME_PAGE.PATH+"?view=place-order"}),$E={survey_user_mkt:{key:"survey_user_mkt",create_at:"26-12-2024",description:"tracking user survey mkt and user's android app"},view_homepage:{key:"view_homepage",create_at:"28-08-2024",description:""},find_product:{key:"find_product",create_at:"28-08-2024",description:""},product_center:{key:"product_center",create_at:"28-08-2024",description:""},order_center:{key:"order_center",create_at:"28-08-2024",description:""},tracking_center:{key:"tracking_center",create_at:"28-08-2024",description:""},integration:{key:"integration",create_at:"28-08-2024",description:""},search_success:{key:"search_success",create_at:"28-08-2024",description:""},push_success:{key:"push_success",create_at:"28-08-2024",description:""},click_sync:{key:"click_sync",create_at:"28-08-2024",description:""},click_fulfillment:{key:"click_fulfillment",create_at:"28-08-2024",description:""},click_cashback:{key:"click_cashback",create_at:"28-08-2024",description:""},fulfillment_setting_success:{key:"fulfillment_setting_success",create_at:"28-08-2024",description:""},click_replace:{key:"click_replace",create_at:"28-08-2024",description:""},replace_success:{key:"replace_success",create_at:"28-08-2024",description:""},click_map:{key:"click_map",create_at:"28-08-2024",description:""},map_success:{key:"map_success",create_at:"28-08-2024",description:""},pod_find_product:{key:"pod_find_product",create_at:"24-04-2025",description:""}},eT={[$.PRODUCT_CATALOG_RESEARCH_CLICKED]:{key:$.PRODUCT_CATALOG_RESEARCH_CLICKED,create_at:"25-05-2026",description:"when user click view full research & ask questions in add product view research"},[$.PRODUCT_CENTER_OUT_OF_QUOTA_VIEWED]:{key:$.PRODUCT_CENTER_OUT_OF_QUOTA_VIEWED,create_at:"06-11-2025",description:"when user push product out of quota"},[$.PRODUCT_CATALOG_IMPORT_ALL_COMPLETED]:{key:$.PRODUCT_CATALOG_IMPORT_ALL_COMPLETED,create_at:"07-10-2024",description:"when user click import all product"},[$.ONBOARDING_SETUP_STARTED]:{key:$.ONBOARDING_SETUP_STARTED,create_at:"28-08-2024",description:""},[$.ONBOARDING_PLAN_VIEWED]:{key:$.ONBOARDING_PLAN_VIEWED,create_at:"28-08-2024",description:""},[$.HOME_PAGE_PAGE_VIEWED]:{key:$.HOME_PAGE_PAGE_VIEWED,create_at:"28-08-2024",description:""},[$.HOME_PAGE_PLAN_VIEWED]:{key:$.HOME_PAGE_PLAN_VIEWED,create_at:"28-08-2024",description:""},[$.HOME_PAGE_PUSH_PRODUCT_CLICKED]:{key:$.HOME_PAGE_PUSH_PRODUCT_CLICKED,create_at:"28-08-2024",description:""},[$.HOME_PAGE_FULFILL_ORDERS_CLICKED]:{key:$.HOME_PAGE_FULFILL_ORDERS_CLICKED,create_at:"28-08-2024",description:""},[$.PRODUCT_CATALOG_PAGE_VIEWED]:{key:$.PRODUCT_CATALOG_PAGE_VIEWED,create_at:"28-08-2024",description:""},[$.PRODUCT_CATALOG_IMPORT_LIST_COMPLETED]:{key:$.PRODUCT_CATALOG_IMPORT_LIST_COMPLETED,create_at:"28-08-2024",description:""},[$.PRODUCT_CATALOG_PRODUCT_VIEWED]:{key:$.PRODUCT_CATALOG_PRODUCT_VIEWED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_PAGE_VIEWED]:{key:$.PRODUCT_CENTER_PAGE_VIEWED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_PUSH_TO_STORE_COMPLETED]:{key:$.PRODUCT_CENTER_PUSH_TO_STORE_COMPLETED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_BULK_EDIT_COMPLETED]:{key:$.PRODUCT_CENTER_BULK_EDIT_COMPLETED,create_at:"10-07-2026",description:"when user bulk edits products (price/status/AI enhance) and pushes to store from Manage Product page"},[$.PRODUCT_CENTER_PRODUCT_EDITOR_SAVED]:{key:$.PRODUCT_CENTER_PRODUCT_EDITOR_SAVED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_AI_WRITING_CLICKED]:{key:$.PRODUCT_CENTER_AI_WRITING_CLICKED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_AI_IMAGE_FINDER_CLICKED]:{key:$.PRODUCT_CENTER_AI_IMAGE_FINDER_CLICKED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_LIBRARY_CLICKED]:{key:$.PRODUCT_CENTER_LIBRARY_CLICKED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_UPDATE_ON_STORE_CLICKED]:{key:$.PRODUCT_CENTER_UPDATE_ON_STORE_CLICKED,create_at:"28-08-2024",description:""},[$.ORDER_CENTER_PAGE_VIEWED]:{key:$.ORDER_CENTER_PAGE_VIEWED,create_at:"28-08-2024",description:""},[$.ORDER_CENTER_PLACE_ORDER_CLICKED]:{key:$.ORDER_CENTER_PLACE_ORDER_CLICKED,create_at:"28-08-2024",description:""},[$.ORDER_CENTER_MAP_PRODUCT_COMPLETED]:{key:$.ORDER_CENTER_MAP_PRODUCT_COMPLETED,create_at:"13-07-2026",description:""},[$.ORDER_CENTER_MAP_PRODUCT_FAILED]:{key:$.ORDER_CENTER_MAP_PRODUCT_FAILED,create_at:"13-07-2026",description:""},[$.SUBSCRIPTION_CHANGE_PLAN_VIEWED]:{key:$.SUBSCRIPTION_CHANGE_PLAN_VIEWED,create_at:"28-08-2024",description:""},[$.SUBSCRIPTION_PLAN_SELECTED]:{key:$.SUBSCRIPTION_PLAN_SELECTED,create_at:"28-08-2024",description:""},[$.SUBSCRIPTION_TRANSACTION_COMPLETED]:{key:$.SUBSCRIPTION_TRANSACTION_COMPLETED,create_at:"28-08-2024",description:""},[$.PRODUCT_CATALOG_IMPRESSION_LOADED]:{key:$.PRODUCT_CATALOG_IMPRESSION_LOADED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_IMPRESSION_VIEWED]:{key:$.PRODUCT_CENTER_IMPRESSION_VIEWED,create_at:"28-08-2024",description:""},[$.HOME_PAGE_IMPORT_PRODUCT_CLICKED]:{key:$.HOME_PAGE_IMPORT_PRODUCT_CLICKED,create_at:"28-08-2024",description:""},[$.ONBOARDING_REINSTALL_PLAN_SELECTED]:{key:$.ONBOARDING_REINSTALL_PLAN_SELECTED,create_at:"28-08-2024",description:""},[$.NOTIFICATION_LIST_VIEWED]:{key:$.NOTIFICATION_LIST_VIEWED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_IMAGE_SEARCH_CLICKED]:{key:$.PRODUCT_CENTER_IMAGE_SEARCH_CLICKED,create_at:"28-08-2024",description:""},[$.PRODUCT_CATALOG_DROPSHIP_PARTNER_REDIRECTED]:{key:$.PRODUCT_CATALOG_DROPSHIP_PARTNER_REDIRECTED,create_at:"28-08-2024",description:""},[$.PRODUCT_CENTER_ORGANIZATION_CLICKED]:{key:$.PRODUCT_CENTER_ORGANIZATION_CLICKED,create_at:"28-08-2024",description:""},[$.STORE_CHANNEL_VIEWED]:{key:$.STORE_CHANNEL_VIEWED,create_at:"11-12-2024",description:"when user go to my channel page"},[$.STORE_CHANNEL_CLICKED]:{key:$.STORE_CHANNEL_CLICKED,create_at:"11-12-2024",description:"when user click connect channel"},[$.SUBSCRIPTION_FREE_PLAN_SELECTED]:{key:$.SUBSCRIPTION_FREE_PLAN_SELECTED,create_at:"28-08-2024",description:"when user click free plan"},[$.SUBSCRIPTION_NO_PLAN_FROM_TRIAL_ABANDONED]:{key:$.SUBSCRIPTION_NO_PLAN_FROM_TRIAL_ABANDONED,create_at:"28-08-2024",description:"when user do nothing after 20s popup trial opens"},[$.DASHBOARD_PAGE_VIEWED]:{key:$.DASHBOARD_PAGE_VIEWED,create_at:"17-9-2025",description:"when user view dashboard"},[$.PRODUCT_CATALOG_SIMILAR_SUPPLIERS_COMPLETED]:{key:$.PRODUCT_CATALOG_SIMILAR_SUPPLIERS_COMPLETED,create_at:"01-11-2025",description:"when user click find similar product"},[$.HOME_PAGE_MAKE_REQUEST_SUBMITTED]:{key:$.HOME_PAGE_MAKE_REQUEST_SUBMITTED,create_at:"23-12-2025",description:"action complete make request from home page"},[$.HOME_PAGE_MAKE_REQUEST_CLICKED]:{key:$.HOME_PAGE_MAKE_REQUEST_CLICKED,create_at:"23-12-2025",description:"action click button make request from home page"},[$.HOME_PAGE_MAKE_REQUEST_STEP1_SUBMITTED]:{key:$.HOME_PAGE_MAKE_REQUEST_STEP1_SUBMITTED,create_at:"23-12-2025",description:"action complete make request step1 from home page"},[$.HOME_PAGE_MAKE_REQUEST_STEP2_SUBMITTED]:{key:$.HOME_PAGE_MAKE_REQUEST_STEP2_SUBMITTED,create_at:"23-12-2025",description:"action complete make request step2 from home page"},[$.ORDER_CENTER_OB_SURVEY_VIEWED]:{key:$.ORDER_CENTER_OB_SURVEY_VIEWED,create_at:"25-12-2025",description:"load step onboarding order"},[$.PRODUCT_CATALOG_INSIGHTS_CLICKED]:{key:$.PRODUCT_CATALOG_INSIGHTS_CLICKED,create_at:"26-12-2025",description:"when user click view insights in catalog"},[$.PERMISSION_BLOCK_VIEWED]:{key:$.PERMISSION_BLOCK_VIEWED,create_at:"31-12-2025",description:"When the permission block popup appears"},[$.PERMISSION_BLOCK_CLICKED]:{key:$.PERMISSION_BLOCK_CLICKED,create_at:"31-12-2025",description:"When user clicks upgrade in the permission block"},[$.SUBSCRIPTION_UPGRADE_PLAN_VIEWED]:{key:$.SUBSCRIPTION_UPGRADE_PLAN_VIEWED,create_at:"07-01-2026",description:"When the upgrade plan drawer loads"},[$.SUBSCRIPTION_CUSTOM_PLAN_CLICKED]:{key:$.SUBSCRIPTION_CUSTOM_PLAN_CLICKED,create_at:"07-01-2026",description:"When user clicks request custom in banner request custom plan"},[$.STORE_CREATION_CLICKED]:{key:$.STORE_CREATION_CLICKED,create_at:"16-01-2026",description:"when user click create_store_now"},[$.STORE_DEMO_CLICKED]:{key:$.STORE_DEMO_CLICKED,create_at:"16-01-2026",description:"when user click view_demo_store"},[$.STORE_CONNECTION_SUBMITTED]:{key:$.STORE_CONNECTION_SUBMITTED,create_at:"16-01-2026",description:"when user click connect_store_submit"},[$.STORE_CONNECTION_CLICKED]:{key:$.STORE_CONNECTION_CLICKED,create_at:"16-01-2026",description:"when user click connect_store_click"},[$.PRODUCT_CATALOG_PRODUCT_ADDED]:{key:$.PRODUCT_CATALOG_PRODUCT_ADDED,create_at:"16-01-2026",description:"when user click add to product center"},[$.ONBOARDING_SPECIAL_OFFER_CLICKED]:{key:$.ONBOARDING_SPECIAL_OFFER_CLICKED,create_at:"16-01-2026",description:"load view OB webSA special offer"},[$.SUBSCRIPTION_EXPERT_SERVICE_CLICKED]:{key:$.SUBSCRIPTION_EXPERT_SERVICE_CLICKED,create_at:"03-02-2026",description:"click Get Expert Help expert service"},[$.SUBSCRIPTION_EXPERT_SERVICE_PAYMENT_CLICKED]:{key:$.SUBSCRIPTION_EXPERT_SERVICE_PAYMENT_CLICKED,create_at:"03-02-2026",description:"click continue to payment expert service"},[$.PRODUCT_CENTER_AI_ASSISTANT_SELECTED]:{key:$.PRODUCT_CENTER_AI_ASSISTANT_SELECTED,create_at:"14-05-2026",description:"when user view ai assistant"},[$.PRODUCT_CENTER_AI_ASSISTANT_CLICKED]:{key:$.PRODUCT_CENTER_AI_ASSISTANT_CLICKED,create_at:"14-05-2026",description:"when user click try it free in ai assistant"},[$.MARKETING_APP_MODAL_VIEWED]:{key:$.MARKETING_APP_MODAL_VIEWED,create_at:"17-06-2026",description:"when user view modal AR"},[$.ONBOARDING_SETUP_COMPLETED]:{key:$.ONBOARDING_SETUP_COMPLETED,create_at:"07-07-2026",description:"when user complete onboarding"},[$.ONBOARDING_SETUP_FAILED]:{key:$.ONBOARDING_SETUP_FAILED,create_at:"20-07-2026",description:"when onboarding setup API fails"},[$.ONBO
2045ARDING_PLAN_SELECTED]:{key:$.ONBOARDING_PLAN_SELECTED,create_at:"07-07-2026",description:"when user click choose plan in onboarding"}},Ld=()=>{const[t,s]=i.useState([{title:"Log event",content:"Log event",data:$E},{title:"Log event DA",content:"Log event DA",data:eT},{title:"GTM",content:"GTM",data:Ht}]),n=t.map((x,f)=>({content:x.content+" ("+Object.keys(x.data).length+")",index:f,onAction:()=>{},id:`${x}-${f}`})),[a,r]=i.useState(0),{mode:o,setMode:l}=Kg(),c=Object.values(t[a].data).map((x,f)=>({id:x.key,key:x.key,description:x.description,create_at:x.create_at})),u={singular:"order",plural:"orders"},{selectedResources:d,allResourcesSelected:g,handleSelectionChange:h}=Qg(c),p=c.map(({id:x,description:f,key:_,create_at:b},v)=>e.jsxs(Rt.Row,{id:x,position:v,children:[e.jsx(Rt.Cell,{children:e.jsx(Q,{maxWidth:"100px",children:e.jsx(sn,{variant:"bodyMd",fontWeight:"bold",as:"span",children:_})})}),e.jsx(Rt.Cell,{children:e.jsx("div",{style:{maxWidth:200},children:f})}),e.jsx(Rt.Cell,{children:b})]},x));return e.jsx(us,{title:Y.MANAGE_PAGE.TITLE,children:e.jsxs(D,{gap:"300",children:[e.jsx(D,{children:e.jsxs("div",{children:[e.jsx(m,{as:"span",variant:"headingMd",children:"Some other tracking events"}),": ",e.jsx(wt,{children:" AO built-in shopify | AO Web"})]})}),e.jsx(nt,{padding:"0",children:e.jsxs(rn,{style:{height:"calc(100vh - 250px)"},children:[e.jsx(qg,{onQueryChange:()=>{},onQueryClear:()=>{},tabs:n,selected:a,canCreateNewView:!1,onSelect:r,filters:[],onClearAll:()=>{},mode:o,setMode:l,hideFilters:!0,hideQueryField:!0}),e.jsx(Rt,{resourceName:u,selectable:!1,itemCount:c.length,selectedItemsCount:g?"All":d.length,onSelectionChange:h,headings:[{title:"Event name"},{title:"Purpose"},{title:"Create at"}],children:p})]})})]})})},tT="/assets/card-fail-DotStzKx.png",sT="/assets/card-success-D_F7MBPS.png";i.forwardRef((t,s)=>{const{t:n}=J(),{getPaymentReference:a,fetchUpdatePaymentReference:r}=pr(),o=a(),[l,c]=i.useState(!1),[u,d]=i.useState({}),[g,h]=i.useState(!1),p=async()=>{h(!0),await r(u),h(!1),x()},x=()=>{c(!1),d({})};return i.useEffect(()=>{o&&q.size(o)&&d(o)},[o,l]),i.useImperativeHandle(s,()=>({onOpen:()=>{c(f=>f||!0)}})),e.jsx(Xe,{open:l,title:"Payment preference",onClose:x,sectioned:!0,primaryAction:{content:n("Confirm"),loading:g,onAction:()=>{p()}},secondaryActions:[{content:n("Cancel"),onAction:()=>{x()}}],children:e.jsxs(D,{gap:"400",children:[e.jsxs(D,{gap:"025",children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:"Payment behavior"}),e.jsx(m,{as:"span",tone:"subdued",fontWeight:"regular",children:"Set your preference on what the system should do after the payment action."})]}),N0.map(f=>e.jsx(Q,{children:e.jsx(As,{label:e.jsxs(U,{wrap:!1,gap:"200",blockAlign:"center",children:[e.jsx(m,{as:"span",children:f.name}),f.is_recommended&&e.jsx(wt,{children:"Recommended"})]}),checked:u.payment_behavior===f.value,onChange:()=>d(_=>({..._,payment_behavior:f.value}))})},f.value)),e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:"Default payment method"}),e.jsx(Ih,{method:u.payment_method||"credit_card",onChange:f=>d(_=>({..._,payment_method:f}))})]})})});const Ih=({method:t,disabled:s,onChange:n,isZopiWallet:a=!0,isShowBalance:r=!1,balance:o})=>nc.slice(a?0:1,q.size(nc)).map(l=>{const c=l.value===t;return e.jsx("div",{onClick:u=>{u.stopPropagation(),n(l.value)},children:e.jsx(Q,{padding:"300",borderColor:c?"input-border-active":"border",borderWidth:"025",borderRadius:"200",children:e.jsxs(U,{align:"space-between",blockAlign:"center",wrap:!1,children:[e.jsx("div",{onClick:u=>u.stopPropagation(),children:e.jsx(As,{disabled:s,label:e.jsxs(m,{as:"span",children:[l.name," ",`${l.value==="wallet"&&r?`($${Fe(Vt(o||0))})`:""}`]}),checked:c,onChange:()=>{n(l.value)}})}),e.jsx("img",{src:l.icon,alt:l.name,style:{height:`${l.height}px`}})]})})},l.value)}),Md=()=>{const{t}=J(),[s]=ca(),[n,a]=i.useState(""),[r,o]=i.useState(null),[l,c]=i.useState(!0),[u,d]=i.useState(!1),[g,h]=i.useState(!1),[p,x]=i.useState("pending"),f=async A=>{try{c(!0);const{data:E}=await ac.getPaymentInfoConformation(A);o(E),E?.error_code&&x("error")}catch(E){console.error("Error fetching payment information:",E),x("error")}finally{c(!1)}},_=async()=>{try{d(!0);const{status:A}=await ac.postPaymentInfoConformation({code:n,workplace_id:r?.workplace_id||0});A===fe.OK&&x("success")}catch(A){console.error("Error confirming payment:",A)}finally{d(!1)}};i.useEffect(()=>{const A=s.get("code");A&&(a(A),f(A))},[s]);const b=()=>{switch(r?.error_code){case"PAYMENT_CONFIRMATION_NOT_FOUND":return["The payment link y
2045ou requested is unavailable or has been removed.","Please check the URL or contact our support team if you need assistance."];case"PAYMENT_CONFIRMATION_EXPIRED":return["This payment does not require confirmation","You can proceed without any further action."];default:return["This payment confirmation link has expired.","Please initiate a new payment if necessary."]}},v=()=>e.jsxs(D,{gap:"400",align:"center",children:[e.jsx(m,{alignment:"center",as:"span",variant:"heading2xl",children:"Confirm order"}),e.jsx(Qe,{transition:{duration:"400ms",timingFunction:"ease-in-out"},open:!l&&!g,id:"payment-countdown",expandOnPrint:!0,children:e.jsxs(kt,{tone:"warning",onDismiss:()=>h(!0),children:[e.jsxs(m,{as:"span",children:["You have ",e.jsx($v,{endTime:it(r?.created_at).add(24,"hours").format("YYYY-MM-DD")})," left to complete your payment."]}),"Please proceed to avoid any interruptions."]})}),e.jsx(y,{}),e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:"Payment method"}),e.jsx(D,{gap:"400",children:e.jsx(Ih,{method:r?.method||"credit_card",onChange:()=>{},disabled:!0})}),e.jsx(re,{variant:"primary",size:"medium",loading:u,onClick:_,children:"Confirm"})]}),y=()=>{const A=r?.orders,E=A?mi(A.currency||"USD"):mi("USD");return e.jsxs(Q,{borderRadius:"400",borderColor:"border",borderWidth:"025",children:[e.jsx(Q,{padding:"300",children:e.jsxs(U,{align:"space-between",children:[e.jsx(m,{as:"span",children:"Order no."}),e.jsx(m,{as:"span",children:"Price"})]})}),e.jsx($e,{}),A?e.jsx(Q,{paddingBlock:"200",paddingInline:"300",children:e.jsx(U,{align:"space-between",children:l?e.jsxs(e.Fragment,{children:[e.jsx(Se,{width:100,height:16}),e.jsx(Se,{width:100,height:16})]}):e.jsxs(e.Fragment,{children:[e.jsx(m,{as:"span",children:A.order_no}),e.jsxs(m,{as:"span",children:[E?.currencySymbol,On(Number(A.amount))]})]})})}):e.jsx(Q,{paddingBlock:"200",paddingInline:"300",children:e.jsx(m,{as:"span",children:"No order found"})})]})},C=()=>e.jsxs(D,{align:"center",inlineAlign:"center",gap:"1000",children:[e.jsx("img",{src:tT,style:{height:80},alt:"Payment failed"}),e.jsxs(D,{gap:"100",children:[e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",alignment:"center",children:"Payment link not found!"}),e.jsx("div",{children:b().map((A,E)=>e.jsx(m,{as:"span",alignment:"center",children:A},`error_message_${E}`))})]})]}),S=()=>e.jsxs(D,{align:"center",inlineAlign:"center",gap:"1000",children:[e.jsx("img",{src:sT,style:{height:80},alt:"Payment successful"}),e.jsxs(D,{gap:"200",inlineAlign:"center",children:[e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:t("PaymentSuccessful")}),e.jsx(m,{as:"span",children:t("ThankYouForYourPurchase")})]})]}),j=()=>p==="pending"?e.jsx(U,{align:"center",children:e.jsx(Q,{width:"448px",paddingBlockStart:"400",children:e.jsx(nt,{children:e.jsx(v,{})})})}):p==="error"||p==="success"?e.jsx("div",{className:"msui-flex-center",style:{minHeight:"100vh"},children:e.jsx(nt,{children:e.jsx(Q,{minWidth:"500px",children:e.jsx("div",{className:"msui-flex-center",style:{minHeight:"400px"},children:e.jsx(D,{gap:"400",align:"center",children:p==="error"?e.jsx(C,{}):e.jsx(S,{})})})})})}):e.jsx(e.Fragment,{});return e.jsx(us,{children:l?e.jsx(nT,{}):e.jsx(j,{})})},nT=()=>e.jsx(Q,{width:"100%",minHeight:"100vh",position:"relative",children:e.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},children:e.jsx(nn,{})})}),Kr=Ze(()=>Me(()=>import("./module-DdhB1fcj.js"),__vite__mapDeps([201,1,2,3,9,10,11,12,18,6,7,8,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,202,90,91,92,93,94,95,178,179,180,181,203,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),aT=Ze(()=>Me(()=>import("./module-CaNSgZFV.js"),__vite__mapDeps([204,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),rT=Ze(()=>Me(()=>import("./module-BCiDmPn2.js"),__vite__mapDeps([205,1,2,3,13,14,15,16,6,7,8,9,10,11,12,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(wa,{})}),iT=Ze(()=>Me(()=>import("./module-Bci7EUG_.js"),__vite__mapDeps([206,6,1,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,207,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(wa,{})}),Ud=Ze(()=>Me(()=>import("./module-I5gPKOU0.js"),__vite__mapDeps([208,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default),Fd=()=>e.jsx(Dp,{to:Y.HOME_PAGE.PATH+location.search}),Bd=Ze(()=>Me(()=>import("./module-DfSHpfQI.js"),__vite__mapDeps([209,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,210,211,212,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Hd=Ze(()=>Me(()=>import("./module-DAqCu-kz.js"),__vite__mapDeps([213,1,2,3,12,10,11])),t=>t.ChatAIAssistantPageLazy),Gd=Ze(()=>Me(()=>import("./module-0vlx5aGM.js"),__vite__mapDeps([214,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,215,90,197,87,88,89,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Wd=Ze(()=>Me(()=>import("./module-Dmo6ThUP.js"),__vite__mapDeps([216,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81])),t=>t.OrderCenterLegacyPage,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Vd=Ze(()=>Me(()=>import("./module-Dkep-53A.js"),__vite__mapDeps([217,1,2,3,79,7,8,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,80,81,218,219,220,90,91,92,93,94,95,221,179,222,223,224,225,226,227,228,229,230,231,232,233,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.CompetitorsPage),Yd=Ze(()=>Me(()=>import("./module-JqeWFU6Z.js"),__vite__mapDeps([234,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),zd=Ze(()=>Me(()=>import("./module-DOc9JcjR.js"),__vite__mapDeps([235,1,2,3,17,90,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,91,92,93,94,95,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Kd=Ze(()=>Me(()=>import("./module-D4VMLlos.js"),__vite__mapDeps([236,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,237,179,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,90,91,92,93,94,95,255,220,256,257,258,259,260,261,262,263,264,265,266,267,268,203,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.HunterProductDiscoveryPage),ya=Ze(()=>Me(()=>import("./module-2AJ1QEwp.js"),__vite__mapDeps([269,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,270,271,90,91,92,93,94,95,252,272,273,179,215,197,274,275,276,277,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Qd=Ze(()=>Me(()=>import("./module-DcUGm_xz.js"),__vite__mapDeps([279,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,90,91,92,93,94,95,280,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,86])),t=>t.ChatAIAssistantPage),Qr=Ze(()=>Me(()=>import("./module--ZHWxmY_.js"),__vite__mapDeps([281,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,90,91,92,93,94,95,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),oT=Ze(()=>Me(()=>import("./module-DegQqWgA.js"),__vite__mapDeps([282,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,205,86,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,283,207])),t=>t.default,{fallback:e.jsx(wa,{})}),lT=Ze(()=>Me(()=>import("./module-BN5reyMn.js"),__vite__mapDeps([284,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,85,87,88,89,90,0,4,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,1
204562,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.GeneralSettingsPage,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),qr=Ze(()=>Me(()=>import("./module-Cb2fdGGx.js"),__vite__mapDeps([285,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),cT=Ze(()=>Me(()=>import("./module-f19LySCx.js"),__vite__mapDeps([286,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,287,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Zr=Ze(()=>Me(()=>import("./module-BGoz_vSe.js"),__vite__mapDeps([288,1,2,3,289,9,10,11,12,20,21,17,6,7,8,13,14,15,16,18,19,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,290,291,271,90,91,92,93,94,95,252,197,275,233,292,202,178,179,180,181,293,215,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,182,183,184,185,186,187,188,189,190,191,192])),t=>t.OrderPlacementVersionCPage,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),dT=Ze(()=>Me(()=>import("./module-DaGdLKDX.js"),__vite__mapDeps([294,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,287,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),uT=Ze(()=>Me(()=>import("./module-C-HavGNB.js"),__vite__mapDeps([295,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Xr=Ze(()=>Me(()=>Promise.resolve().then(()=>Nj),void 0),t=>t.DetailSkillPage),qd=Ze(()=>Me(()=>import("./module-4r3fL1G6.js"),__vite__mapDeps([296,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,90,91,92,93,94,95,212,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),pT=Ze(()=>Me(()=>Promise.resolve().then(()=>ZC),void 0),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),hT=Ze(()=>Me(()=>import("./module-DEgBKoO6.js"),__vite__mapDeps([297,1,2,3,79,7,8,17,6,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.Notifications,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),Zd=Ze(()=>Me(()=>import("./module-B_Nr9GoX.js"),__vite__mapDeps([298,1,2,3,9,10,11,12,79,7,8,6,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,80,81,252,253,254,90,91,92,93,94,95,255,220,198,277,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.HunterTrendDiscoveryPage),Xd=Ze(()=>Me(()=>import("./module-jcKEJy0O.js"),__vite__mapDeps([299,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,218,233,300,301,90,91,92,93,94,95,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.TrackingSellersPage),Jd=Ze(()=>Me(()=>import("./module-CC1c9uwB.js"),__vite__mapDeps([302,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,90,91,92,93,94,95,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),$d=Ze(()=>Me(()=>import("./module-mpa-5_iR.js"),__vite__mapDeps([303,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,90,91,92,93,94,95,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),eu=Ze(()=>Me(()=>import("./module-DGMnconx.js"),__vite__mapDeps([304,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,219,233,218,300,268,90,91,92,93,94,95,292,301,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.TrackingProductsPage),tu=Ze(()=>Me(()=>import("./module-DkIAXugR.js"),__vite__mapDeps([305,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,274,271,90,91,92,93,94,95,252,215,197,272,273,179,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),su=Ze(()=>Me(()=>import("./module-BSPFcqyM.js"),__vite__mapDeps([306,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,90,91,92,93,94,95,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),nu=Ze(()=>Me(()=>import("./module-DBbUcxjW.js"),__vite__mapDeps([307,1,2,3,210,17,24,14,25,11,26,7,8,27,28,29,30,31,32,33,34,35,36,37,38,39,6,9,10,12,13,15,16,18,19,20,21,22,23,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),au=Ze(()=>Me(()=>import("./module-zJa79h-t.js"),__vite__mapDeps([211,1,2,3,17,45,46,47,48,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,212,210,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}
2045),Jr=Ze(()=>Me(()=>import("./module-B_Q3try7.js"),__vite__mapDeps([308,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,276,90,91,92,93,94,95,215,197,274,271,252,275,277,290,291,233,292,202,178,179,180,181,293,309,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),gT=Ze(()=>Me(()=>import("./module-DiDm0rCd.js"),__vite__mapDeps([310,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,85,87,88,89,90,0,4,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.GeneralSettingsMobilePage,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),mT=Ze(()=>Me(()=>import("./module-7-fdWWzC.js"),__vite__mapDeps([311,1,2,3,79,7,8,9,10,11,12,20,21,17,6,13,14,15,16,18,19,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,80,81,90,91,92,93,94,95,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.BillingPlanMobile,{fallback:e.jsx(ut,{children:e.jsx(_t,{})})}),fT=Ze(()=>Me(()=>import("./module-D9I5nZOT.js"),__vite__mapDeps([312,1,2,3,79,7,8,17,6,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,80,81,90,91,92,93,94,95,278,207,87,88,89,0,4,85,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192])),t=>t.default),ru=Oe.lazy(()=>Me(()=>import("./module-ClHC0Iac.js"),__vite__mapDeps([313,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),iu=Oe.lazy(()=>Me(()=>import("./module-ytRCV2nq.js"),__vite__mapDeps([314,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),ou=Oe.lazy(()=>Me(()=>import("./module-K97uprG9.js"),__vite__mapDeps([315,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),lu=Oe.lazy(()=>Me(()=>import("./module-CtUnBD8v.js"),__vite__mapDeps([316,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),cu=Oe.lazy(()=>Me(()=>import("./module-DWmBTBqZ.js"),__vite__mapDeps([317,1,2,3,9,10,11,12,17,6,7,8,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),du=Oe.lazy(()=>Me(()=>import("./module-m4yGKBMx.js"),__vite__mapDeps([318,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),uu=Oe.lazy(()=>Me(()=>import("./module-DZp2EBWX.js"),__vite__mapDeps([319,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]))),$r=Oe.lazy(()=>Me(()=>import("./module-CkeDZJ9p.js"),__vite__mapDeps([320,1,2,3,9,10,11,12,17,6,7,8,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),pu=Oe.lazy(()=>Me(()=>import("./module-BlRKIEtR.js"),__vite__mapDeps([321,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),hu=Oe.lazy(()=>Me(()=>import("./module-CIo1jBBV.js"),__vite__mapDeps([322,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]))),gu=Oe.lazy(()=>Me(()=>import("./module-CZ1_ctnm.js"),__vite__mapDeps([323,1,2,3,9,10,11,12,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]))),mu=Oe.lazy(()=>Me(()=>import("./module-D-d78Djy.js"),__vite__mapDeps([324,1,2,3,17,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,291,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),fu=Oe.lazy(()=>Me(()=>import("./module-BLIHU3M8.js"),__vite__mapDeps([325,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,87,88,89,90,0,4,85,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192]))),xT=[{id:Y.PRODUCT_RESEARCH.ID,path:Y.PRODUCT_RESEARCH.PATH,component:{a:{desktop:rT,mobile:oT}},permissions:[Te.VIEW_ALL],subRoutes:[{index:!0,id:Y.PRODUCT_RESEARCH.SUBROUTES.AD_LIBRARY.ID,path:Y.PRODUCT_RESEARCH.SUBROUTES.AD_LIBRARY.PATH,component:{a:{desktop:Kd,mobile:Kd}},permissions:[Te.VIEW_ALL]},{id:Y.PRODUCT_RESEARCH.SUBROUTES.TREND_DISCOVERY.ID,path:Y.PRODUCT_RESEARCH.SUBROUTES.TREND_DISCOVERY.PATH,component:{a:{desktop:Zd,mobile:Zd}},permissions:[Te.VIEW_ALL]},{id:Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.ID,path:Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.PATH,component:{a:{desktop:Vd,mobile:Vd}},permissions:[Te.VIEW_ALL],subRoutes:[{index:!0,id:Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.ID,path:Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.PATH,component:{a:{desktop:eu,mobile:eu}},permissions:[Te.VIEW_ALL]},{id:Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.SUBROUTES.TRACKED_SELLER.ID,path:Y.PRODUCT_RESEARCH.SUBROUTES.COMPETITOR_TRACKING.SUBROUTES.TRACKED_SELLER.PATH,component:{a:{desktop:Xd,mobile:Xd}},permissions:[Te.VIEW_ALL]}]}]},{id:Y.CATALOG.ID,path:Y.CATALOG.PATH,component:{a:{desktop:Ud,mobile:Ud}},allow_search:!0,permissions:[Te.VIEW_CATALOG]},{id:Y.HOME_PAGE.ID,path:Y.HOME_PAGE.PATH,component:{a:{desktop:XE,mobile:iT}},hidden:!1,allow_search:!0,permissions:Y.HOME_PAGE.permissions},{id:Y.DASHBOARD.ID,path:Y.DASHBOARD.PATH,component:{a:{desktop:Dd,mobile:Dd}},hidden:!1,allow_search:!0,permissions:Y.DASHBOARD.permissions},{id:Y.MANAGE_PAGE.ID,path:Y.MANAGE_PAGE.PATH,component:{a:{desktop:Nd,mobile:Nd}},allow_search:!0,permissions:Y.MANAGE_PAGE.permissions,subRoutes:[{id:Y.MANAGE_PAGE.SUBROUTES.TRACKING.ID,path:Y.MANAGE_PAGE.SUBROUTES.TRACKING.PATH,component:{a:{desktop:Ld,mobile:Ld}},allow_search:!0,permissions:Y.MANAGE_PAGE.permissions}]},{id:Y.ORDER_LIST.ID,path:Y.ORDER_LIST.PATH,allow_search:!0,component:{a:{desktop:zr,mobile:qr},b:{desktop:zr,mobile:qr},simple_mode:{desktop:zr,mobile:qr},c:{desktop:zr,mobile:qr}},permissions:Y.ORDER_LIST.permissions,abTesting:"order_center",subRoutes:[{id:Y.ORDER_LIST.SUBROUTES.LIST.ID,path:Y.ORDER_LIST.SUBROUTES.LIST.PATH,component:{a:{desktop:Zr,mobile:Jr},b:{desktop:Zr,mobile:Jr},c:{desktop:Zr,mobile:Jr},simple_mode:{desktop:Zr,mobile:Jr}},index:!0,permissions:Y.ORDER_LIST.permissions,abTesting:"order_center"}]},{id:Y.ORDER_LIST.SUBROUTES.CREATE_ORDER.ID,path:Y.ORDER_LIST.SUBROUTES.CREATE_ORDER.PATH,component:{a:{desktop:Kr,mobile:Kr}},allow_search:!0,permissions:[Te.VIEW_ORDER],subRoutes:[{id:Y.ORDER_LIST.SUBROUTES.CREATE_ORDER.ID,path:Y.ORDER_LIST.SUBROUTES.CREATE_ORDER.PATH,component:{a:{desktop:Kr,mobile:Kr}},permissions:[Te.VIEW_ORDER]}]},{id:Y.V2_ORDER_LIST.ID,path:Y.V2_ORDER_LIST.PATH,allow_search:!0,component:{a:{desktop:Wd,mobile:Wd}},permissions:[Te.VIEW_ORDER]},{id:Y.INTEGRATIONS.ID,path:Y.INTEGRATIONS.PATH,allow_search:!0,component:{a:{desktop:Qr,mobile:Qr}},permissions:[Te.VIEW_SETTING_PARTNERS_CONNECTION]},{id:Y.BILLING_PLAN.ID,path:Y.BILLING_PLAN.PATH,allow_search:!0,component:{a:{desktop:pT,mobile:mT}},permissions:[Te.VIEW_SETTING_BILLING_PLAN]},{id:Y.GENERAL_SETTING.ID,path:Y.GENERAL_SETTING.PATH,component:{a:{desktop:lT,mobile:gT}},allow_search:!0,permissions:[Te.VIEW_SETTINGS],subRoutes:[{id:Y.GENERAL_SETTING.SUBROUTES.ORDER_TRACKING.ID,path:Y.GENERAL_SETTING.SUBROUTES.ORDER_TRACKING.PATH,allow_search:!0,component:{a:{desktop:Yd,mobile:Yd}},permissions:[Te.VIEW_SETTING_ORDER_TRACKING]},{id:Y.GENERAL_SETTING.SUBROUTES.SETTING_ACCOUNT.ID,path:Y.GENERAL_SETTING.SUBROUTES.SETTING_ACCOUNT.PATH,allow_search:!0,component:{a:{desktop:qd,mobile:qd}},permissions:[Te.VIEW_SETTING_ACCOUNT]},{id:Y.GENERAL_SETTING.SUBROUTES.NOTIFICATIONS.ID,path:Y.GENERAL_SETTING.SUBROUTES.NOTIFICATIONS.PATH,allow_search:!0,component:{a:{desktop:hT,mobile:fT}},permissions:[Te.VIEW_SETTING_NOTIFICATIONS]},{id:Y.GENERAL_SETTING.SUBROUTES.PARTNERS_CONNECTION.ID,path:Y.GENERAL_SETTING.SUBROUTES.PARTNERS_CONNECTION.PATH,allow_search:!0,component:{a:{desktop:Qr,mobile:Qr}},permissions:[Te.VIEW_SETTING_PARTNERS_CONNECTION]},{id:Y.GENERAL_SETTING.SUBROUTES.ORDER_FULFILLMENT.ID,path:Y.GENERAL_SETTING.SUBROUTES.ORDER_FULFILLMENT.PATH,allow_search:!0,component:{a:{desktop:cT,mobile:dT}},permissions:[Te.VIEW_SETTING_ORDER_FULFILLMENT]},{id:Y.GENERAL_SETTING.SUBROUTES.WALLET.ID,path:Y.GENERAL_SETTING.SUBROUTES.WALLET.PATH,component:{a:{desktop:tu,mobile:tu}},permissions:[Te.VIEW_SETTING_WALLET]},{id:Y.GENERAL_SETTING.SUBROUTES.ZOPI_FULFILLMENT.ID,path:Y.GENERAL_SETTING.SUBROUTES.ZOPI_FULFILLMENT.PATH,allow_search:!0,component:{a:{desktop:ya,mobile:ya}
2045,b:{desktop:ya,mobile:ya},c:{desktop:ya,mobile:ya}},permissions:[Te.VIEW_SETTING_ZOPI_FULFILLMENT]},{id:Y.GENERAL_SETTING.SUBROUTES.AUTOMATION.ID,path:Y.GENERAL_SETTING.SUBROUTES.AUTOMATION.PATH,component:{a:{desktop:Gd,mobile:Gd}},permissions:[Te.VIEW_SETTING_AUTOMATION]},{id:Y.GENERAL_SETTING.SUBROUTES.PRODUCT_LISTING.ID,path:Y.GENERAL_SETTING.SUBROUTES.PRODUCT_LISTING.PATH,component:{a:{desktop:su,mobile:su}},permissions:[Te.VIEW_PRODUCT_LISTING]},{id:Y.GENERAL_SETTING.SUBROUTES.PRICING_RULES.ID,path:Y.GENERAL_SETTING.SUBROUTES.PRICING_RULES.PATH,component:{a:{desktop:$d,mobile:$d}},permissions:[Te.VIEW_PRODUCT_LISTING]},{id:Y.GENERAL_SETTING.SUBROUTES.PRODUCT.ID,path:Y.GENERAL_SETTING.SUBROUTES.PRODUCT.PATH,component:{a:{desktop:Jd,mobile:Jd}},permissions:[Te.VIEW_SETTING_PRODUCT]},{id:Y.GENERAL_SETTING.SUBROUTES.ORDER_CASHBACK.ID,path:Y.GENERAL_SETTING.SUBROUTES.ORDER_CASHBACK.PATH,component:{a:{desktop:zd,mobile:zd}},permissions:[Te.VIEW_SETTING_ORDER_CASHBACK]}]},{id:Y.NOT_FOUND_IN_APP.ID,path:Y.NOT_FOUND_IN_APP.PATH,component:{a:{desktop:yi,mobile:yi}},permissions:[Te.VIEW_ALL]},{id:Y.AUTH_BIND_PLATFORM.ID,path:Y.AUTH_BIND_PLATFORM.PATH,component:{a:{desktop:Yo,mobile:Yo}},permissions:[Te.VIEW_ALL]},{id:Y.PRODUCT_CENTER.ID,path:Y.PRODUCT_CENTER.PATH,component:{a:{desktop:aT,mobile:uT}},hidden:!1,allow_search:!0,permissions:[Te.VIEW_PRODUCT]},{id:Y.OB_WELCOME.ID,path:Y.OB_WELCOME.PATH,component:{a:{desktop:Vo,mobile:Vo}},permissions:[Te.VIEW_ALL]},{id:Y.AI_ASSISTANT.ID,path:Y.AI_ASSISTANT.PATH,component:{a:{desktop:Hd,mobile:Hd}},permissions:[Te.VIEW_ALL],subRoutes:[{index:!0,id:Y.AI_ASSISTANT.ID,path:Y.AI_ASSISTANT.PATH,component:{a:{desktop:Qd,mobile:Qd}},permissions:[Te.VIEW_ALL]},{id:Y.AI_ASSISTANT.SUBROUTES.DETAIL_SKILL.ID,path:Y.AI_ASSISTANT.SUBROUTES.DETAIL_SKILL.PATH,component:{a:{desktop:Xr,mobile:Xr}},permissions:[Te.VIEW_ALL]},{id:Y.AI_ASSISTANT.SUBROUTES.CREATE_SKILL.ID,path:Y.AI_ASSISTANT.SUBROUTES.CREATE_SKILL.PATH,component:{a:{desktop:Xr,mobile:Xr}},permissions:[Te.VIEW_ALL]}]}],_T=[{id:Y.SIGNIN.ID,path:Y.SIGNIN.PATH,parentComponent:Kn,component:{a:{desktop:ru,mobile:ru}},permissions:[Te.VIEW_ALL]},{id:Y.SIGNUP.ID,path:Y.SIGNUP.PATH,parentComponent:Kn,component:{a:{desktop:iu,mobile:iu}},permissions:[Te.VIEW_ALL]},{id:Y.SIGNOUT.ID,path:Y.SIGNOUT.PATH,component:{a:{desktop:hu,mobile:hu}},permissions:[Te.VIEW_ALL]},{id:Y.EMAIL_VERIFICATION.ID,path:Y.EMAIL_VERIFICATION.PATH,parentComponent:Kn,component:{a:{desktop:uu,mobile:uu}},permissions:[Te.VIEW_ALL]},{id:Y.SIGNUP_EMAIL_RESEND.ID,path:Y.SIGNUP_EMAIL_RESEND.PATH,parentComponent:Kn,component:{a:{desktop:$r,mobile:$r}},permissions:[Te.VIEW_ALL]},{id:Y.FORGET_PASSWORD.ID,path:Y.FORGET_PASSWORD.PATH,parentComponent:Kn,component:{a:{desktop:ou,mobile:ou}},permissions:[Te.VIEW_ALL]},{id:Y.FORGET_PASSWORD_RESEND_EMAIL.ID,path:Y.FORGET_PASSWORD_RESEND_EMAIL.PATH,parentComponent:Kn,component:{a:{desktop:$r,mobile:$r}},permissions:[Te.VIEW_ALL]},{id:Y.RESET_PASSWORD.ID,path:Y.RESET_PASSWORD.PATH,parentComponent:Kn,component:{a:{desktop:lu,mobile:lu}},permissions:[Te.VIEW_ALL]},{id:Y.AUTH_AUTO_LOGIN.ID,path:Y.AUTH_AUTO_LOGIN.PATH,component:{a:{desktop:gu,mobile:gu}},permissions:[Te.VIEW_ALL]},{id:Y.AUTH_CALLBACK.ID,path:Y.AUTH_CALLBACK.PATH,component:{a:{desktop:cu,mobile:cu}},permissions:[Te.VIEW_ALL]},{id:Y.AUTH_INSTALL.ID,path:Y.AUTH_INSTALL.PATH,component:{a:{desktop:du,mobile:du}},permissions:[Te.VIEW_ALL]},{id:Y.AUTH_SOCIAL_CALLBACK.ID,path:Y.AUTH_SOCIAL_CALLBACK.PATH,component:{a:{desktop:pu,mobile:pu}},hidden:!1,permissions:[Te.VIEW_ALL]},{id:Y.NOT_FOUND.ID,path:Y.NOT_FOUND.PATH,component:{a:{desktop:yi,mobile:yi}},permissions:[Te.VIEW_ALL]},{id:Y.CAMPAIGN.ID,path:Y.CAMPAIGN.PATH,component:{a:{desktop:Od,mobile:Od}},permissions:[Te.VIEW_ALL]},{id:Y.HOME_PAGE_LANDING_PAGE.ID,path:Y.HOME_PAGE_LANDING_PAGE.PATH,component:{a:{desktop:Ce.isShopifyEmbedded()?Fd:Bd,mobile:Ce.isShopifyEmbedded()?Fd:Bd}},hidden:!1,permissions:[Te.VIEW_ALL],subRoutes:[{index:!0,id:Y.HOME_PAGE_LANDING_PAGE.ID,path:Y.HOME_PAGE_LANDING_PAGE.PATH,component:{a:{desktop:nu,mobile:nu}},permissions:[Te.VIEW_ALL]},{id:Y.HOME_PAGE_LANDING_PAGE.SUBROUTES.LANDING_PRICING_PAGE.ID,path:Y.HOME_PAGE_LANDING_PAGE.SUBROUTES.LANDING_PRICING_PAGE.PATH,component:{a:{desktop:au,mobile:au}},hidden:!1,permissions:[Te.VIEW_ALL]}]},{id:Y.TRACKING_LOG_ID.ID,path:Y.TRACKING_LOG_ID.PATH,component:{a:{desktop:mu,mobile:mu}},permissions:[Te.VIEW_ALL]},{id:Y.PAYMENT_SUCCESS.ID,path:Y.PAYMENT_SUCCESS.PATH,component:{a:{desktop:fu,mobile:fu}},permissions:[Te.VIEW_ALL]},{id:Y.PAYMENT_CONFIRMATION.ID,path:Y.PAYMENT_CONFIRMATION.PATH,component:{a:{desktop:Md,mobile:Md}},permissions:[Te.VIEW_ALL]}],bT=async t=>await X("/center/products/discover-tools",{},{}),yT=async t=>await X("/center/products/discover-tools",{discover:t},{method:"POST"}),CT={getDiscoverPicked:bT,postDiscoverPicked:yT},vT=t=>{const{onInstall:s,platform:n,paramsInstall:a}=t,r=de(),o=pt(),l=Wn(),c=vs(),{t:u}=J(),[d,g]=i.useState("waiting"),h=f=>{CT.postDiscoverPicked([]),f&&(ge.localStorage.remove(`${st.DISCOVER_GOAL_WAS_DISMISSED}_${f}`),ge.localStorage.remove(`${st.DISCOVER_GOAL_PERMANENTLY_CLOSED}_${f}`))},p=async()=>{const f={...a};let _="";window.shopify&&(_=await window.shopify.idToken());let b;if(f.is_update)b=await r.authInstall(f,n,{cancelToken:c.token,headers:_?{"Session-Token":_}:void 0});else if(b=await r.authCallback(f,n,{cancelToken:c.token,headers:{..._?{"Session-Token":_}:{}}}),b.status===fe.OK&&b.data?.update_scopes){const v=await r.authInstall(f,n,{cancelToken:c.token,headers:_?{"Session-Token":_}:void 0});v.status===fe.OK&&(b=v)}switch(b.status){case fe.OK:const{url:v,token:y,store_id:C,workplace_id:S}=b.data||{};if(("reinstall"in(b.data||{})?b.data.reinstall:!1)&&h(S),v&&(Ce.isShopifyEmbedded()?l&&l(v):location.href=v),y){r.signout(!1),ge.setToken(y),S&&ge.workspaceStorage.setCurrentWorkspaceId(S),C&&ge.shopStorage.setCurrentShopId(C);const A=new URLSearchParams(location.search);A.delete("embedded"),A.delete("id_token"),A.delete("code"),A.delete("hmac"),A.delete("shop"),A.delete("host"),A.delete("timestamp"),A.delete("session"),A.delete("confirmed");let E=A.toString();E&&(E="?"+E),s&&s(f.shop),o(location.pathname+E,{replace:!0})}break;default:g("error");break}};i.useEffect(()=>(p(),()=>c.cancel()),[]);const x=i.useMemo(()=>
2045{if(d==="error"){if(Ce.isShopifyEmbedded())return"Your session has expired or is invalid<br/> Please refresh the page to try again.";{const f=a.shop?.replace(".myshopify.com","")||"";return`Your session has expired or is invalid<br/> <a href="${Ts.shopify.admin_setting_app_new.replace("{{domain}}",f)}">Please re-install app.</>`}}return u("YourStoreIsConnectingPleaseWaitAMoment")+"..."},[d]);return e.jsx(e.Fragment,{children:e.jsxs(ut,{children:[e.jsx(m,{as:"p",variant:"headingSm",fontWeight:"regular",tone:"base",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:x}})}),e.jsx(nn,{size:"small"})]})})},AT=t=>{let s=!1;return[Y.HOME_PAGE.PATH,Y.PRODUCT_CENTER.PATH,Y.ORDER_LIST.PATH].includes(t)&&(s=!0),s},ST=()=>{const t=de(),s=t.getCurrentPlan(),n=t.getUserInfo(),a=i.useRef({firstLoad:!0}),r=window,o=(l,c)=>{const u=c?.package?.modules||[],d=l?.is_first_login||!1,g=u.find(b=>b.type==="CREDIT"),h=ge.localStorage.get(Xa.METHOD),p=ge.localStorage.get(Xa.RE_LOGIN);ge.localStorage.remove(Xa.RE_LOGIN);let x={};const f=g?.name?.replaceAll("Order & Fulfillment","").trim(),_=g?.price;if(Ce.isShopifyEmbedded()){const b=it(),v=it(l.created_at);x={user_id:l?.id,plan:f,plan_value:_,email:l?.email,country:l?.country,login_method:h&&at.upperFirst(h),account_age:b.diff(v,"days")}}else if(d)x={user_id:l?.id,plan:f,plan_value:_,email:l?.email,country:l?.country,login_method:h&&at.upperFirst(h)};else{const b=it(),v=it(l.created_at);x={user_id:l?.id,plan:f,plan_value:_,email:l?.email,country:l?.country,login_method:h&&at.upperFirst(h),account_age:b.diff(v,"days")}}if(a.current.firstLoad=!1,r.dataLayer){const b=Ce.isShopifyEmbedded()?"sign_in_shopify":d?"sign_up":p==="true"?"sign_in":"direct_sign_in";ss(b,x)}ss(Ce.isShopifyEmbedded()?"sign_in_shopify":d?"sign_up":p==="true"?"sign_in":"direct_sign_in",x)};return i.useEffect(()=>{n&&n?.id&&s&&Object.keys(s).length>0&&a?.current?.firstLoad&&o(n,s)},[n,s]),e.jsx(e.Fragment,{})},jT=()=>{const t=new URL(window.location.href).searchParams;return i.useEffect(()=>{const s=t.get("zopi_noti_ref");s&&Ke.trackingEventUsersAction({event_name:$.NOTIFICATION_LIST_VIEWED,event_data:{notification_type:["webpush","email"].includes(s)?s:null}})},[]),e.jsx(e.Fragment,{})},ET=()=>{const t=dt(),s=de(),n=Pt(),a=i.useRef({firstLoad:!0}),r=ke(O0),o=he(nl),l=s.getUserInfo(),c=t.getShop(),u=t.getListShop(),d=s.getCurrentPlan(),g=async h=>{if(a.current.firstLoad){a.current.firstLoad=!1;const{data:p,status:x,success:f}=await pp.getSetting();if(x===200&&f){const _=p?.settings?.ADMITAD_CASHBACK_SETTING||{},v=h?.package?.features?.ADMIAD_CASHBACK?.limit===-1&&_?.admitad_cashback_status&&_?.admitad_username;n.setCashback(v)}}};return i.useEffect(()=>{r&&l.id&&c.id&&(n.setAppEmail(l,c),n.setInstalledDate(l))},[l.id,c,r]),i.useEffect(()=>{r&&Object.keys(d).length&&(n.setCurrentPlan(d),g(d))},[d,r]),i.useEffect(()=>{try{if(r&&Object.keys(d).length&&l.id){let h=ge.localStorage.get(st.FIRST_PURCHASE_CHAT_ACCOUNT)?JSON.parse(ge.localStorage.get(st.FIRST_PURCHASE_CHAT_ACCOUNT)):[];!h.includes(l.id)&&d?.is_first_purchase&&(h.push(l.id),h=q.uniq(h),ge.localStorage.set(st.FIRST_PURCHASE_CHAT_ACCOUNT,JSON.stringify(h)),n.setFirstPurchase())}}catch(h){console.log("msg",h),ge.localStorage.remove(st.FIRST_PURCHASE_CHAT_ACCOUNT)}},[d,r,l.id]),i.useEffect(()=>{r&&u.length>0&&c.id&&n.setShopInfo(c,u)},[c,u,r]),i.useEffect(()=>{const h=n.getUnreadMessage();o(()=>({message:"",unread:h})),n.onChatOpened(()=>{o(()=>({message:"",unread:0}))}),n.onMessageReceivedListener(p=>{if(n.isChatOpened())return;const x=n.getUnreadMessage();o(()=>({message:p.type==="text"?p.content:"",unread:x}))})},[]),i.useEffect(()=>{const h=JSON.parse(ge.localStorage.get(rc.FIRST_TIME_FREE_PLAN)||"{}");if(q.size(d)&&l.id&&!h[l.id]){const p=!s.getIdPlanModule()?.price,x=s.getIdPlanModule()?.is_legacy,f=d.is_trial;p&&x&&!f&&(n.setActionEvent("legacy_user_free"),ge.localStorage.set(rc.FIRST_TIME_FREE_PLAN,JSON.stringify({...h,[l.id]:l.id})))}},[d,l.id]),i.useEffect(()=>{if(!r)return;const h=setInterval(()=>{window.$crisp&&(clearInterval(h),window.$crisp.push(["on","chat:opened",()=>{n.pushEventCrisp("set",{"session:event":["click_chat_bubble"]})}]))},500)},[r]),e.jsx(e.Fragment,{})},TT=()=>{const t=de(),s=t.getCurrentPlan(),n=t.getUserInfo(),a=dt().getShop(),r=i.useRef({firstLoad:!0}),o=window,l=()=>{if(o.shData){const u=((s?.package?.modules||[]).find(g=>g.type==="CREDIT")?.name||"").replace("Order & Fulfillment",""),d={event:"init",data:{email:a?.owner_email||"",name:a?.owner_name||"",myshopify_domain:a?.platform_domain||"",plan_name:u}};o.shData.push(d),r.current.firstLoad=!1}};return i.useEffect(()=>{s&&Object.keys(s).length>0&&a?.id&&r?.current?.firstLoad&&l()},[n,s,a]),e.jsx(e.Fragment,{})},Rh=()=>({fetchLogAttributeUser:async r=>{await D0({attributes:r})},fetchLogTrackingEventUserCrossSite:r=>{const o={event:r.event};r.screen&&(o.screen=r.screen),ic(o)},fetchLogTrackingEventUser:async r=>{if(Ce.isShopifyEmbedded()){const l={event:r.event,platform:"AO built-in shopify"};r.screen&&(l.screen=r.screen),await ic(l)}},browserDetect:()=>{try{const r=navigator.userAgent;let o,l;return r.match(/edg/i)?(o="Microsoft Edge",l=r.split("Edg/")?.[1]?.split(" ")?.[0]):r.match(/chrome|chromium|crios/i)?(o="Chrome",l=r.split("Chrome/")?.[1]?.split(" ")?.[0]):r.match(/firefox|fxios/i)?(o="Firefox",l=r.split("Firefox/")?.[1]?.split(" ")?.[0]):r.match(/safari/i)?(o="Safari",l=r.split("Version/")?.[1]?.split(" ")?.[0]):r.match(/opr\//i)?(o="Opera",l=r.split("Opera/")?.[1]?.split(" ")?.[0]):r.match(/MSIE|Trident\//i)?(o="Internet Explorer",l=r.split("Trident/")?.[1]?.split(" ")?.[0]||r.split("MSIE/")?.[1]?.split(" ")?.[0]):(o="Unknown",l="Unknown"),{browserName:o,browserVersion:l}}catch{return{browserName:"Unknown",browserVersion:"Unknown"}}}}),PT="/assets/ads_spy_img-Bo32IfG4.jpg",IT="/assets/store_analysis_img-B5SPS0bZ.jpg",RT="/assets/shopify_product_img-C98nEUbV.jpg",kT="/assets/handpick_product_img-C9nbOrAO.jpg",wT=async()=>await X("/center/products/survey",{},{}),NT=async t=>{const{params:s,token:n}=t;return await X("/center/products/survey",s,{method:"POST"},{cancelToken:n})},zo={postQuestionSurvey:NT,getQuestionSurvey:wT},kh=ae({key:"questionSurveyState",default:{}});ae({key:"openSurveyState",default:!1});const OT=[{name:"AdsSpy",description:"FindIdeasFromTopSocialAds",img:PT,question:"ads_spy"},{name:"ShopifyProduct",description:"DiscoverProductSellingByShopifyStores",img:RT,question:"shopify_product"},{name:"StoreAnalysis",description:"AnalyzeCompetitorStores",img:IT,question:"store_analysis"},{name:"HandpickProduct",description:"PotentialIdeasHandpickedByExperts",img:kT,question:"handpick_product"}],DT=()=>{const{t}=J(),s=bt(),{getUserInfo:n}=de(),a=n().id,[r,o]=be(kh),l=ge.localStorage.get(st.SHOW_SURVEY_TRENDING_PRODUCT_BY_ZOPI),c=l?JSON.parse(l):[],[u,d]=i.useState(!1),[g,h]=i.useState({ads_spy:!1,shopify_product:!1,store_analysis:!1,handpick_product:!1}),[p,x]=i.useState(!1),f=gr(),_=async()=>{const{status:C,data:S}=await zo.postQuestionSurvey({})},b=async()=>{x(!0);const{status:C,data:S}=await zo.postQuestionSurvey({params:{choices:g}});C===Xt.OK&&(s.success(t("SURVEY_SUBMITTED_SUCCESSFULLY")),o(g)),x(!1),d(!1)},v=()=>{d(!1),h(r)},y=(C,S)=>{h(j=>({...j,[S]:C}))};return i.useEffect(()=>{q.size(r)&&!Object.keys(r).some(C=>
2045r[C])&&a&&!c.includes(a)&&it().isBefore("2024-07-26")&&(ge.localStorage.set(st.SHOW_SURVEY_TRENDING_PRODUCT_BY_ZOPI,JSON.stringify(q.uniq([...c,a]))),_(),d(!0))},[r,a]),e.jsx(e.Fragment,{children:e.jsx(Xe,{open:u,title:"Confirm",titleHidden:!0,onClose:()=>{v()},primaryAction:{content:t("JoinWaitlist"),onAction:()=>{b()},disabled:Object.values(g).every(C=>!C)||q.isEqual(g,r),loading:p},size:"large",secondaryActions:[{content:t("Cancel"),onAction:()=>{v()}}],children:e.jsx(Xe.Section,{children:e.jsxs(D,{gap:"400",children:[e.jsxs(D,{gap:"200",children:[e.jsx(U,{align:"center",children:e.jsx(m,{as:"span",fontWeight:"bold",variant:"headingXl",alignment:"center",children:t("JoinOurWaitlistToAccessUpcomingRelease")})}),e.jsx(U,{align:"center",children:e.jsx(m,{as:"span",alignment:"center",children:t("SelectTheNewFeaturesYouNeed")})})]}),e.jsx(MT,{children:OT.map((C,S)=>e.jsx(LT,{style:{backgroundImage:g[C.question]?`linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.3) 100%), 2046 url(${C.img})`:`url(${C.img})`},onClick:j=>{j.stopPropagation(),y(!g[C.question],C.question)},children:e.jsx("div",{className:"image-container",children:e.jsx(Q,{padding:"400",children:e.jsxs(D,{gap:"200",children:[e.jsxs(U,{blockAlign:"center",gap:"150",children:[e.jsx(Sn,{label:"",labelHidden:!0,checked:g[C.question],onChange:j=>y(j,C.question)}),e.jsx(m,{as:"span",fontWeight:"regular",children:t(C.name)})]}),e.jsx(Q,{maxWidth:f.xsOnly?"130px":"165px",children:e.jsx(m,{as:"span",fontWeight:"semibold",variant:"headingLg",breakWord:!0,alignment:"start",children:t(C.description)})})]})})})},S))})]})})})})},LT=se.div` 2047 cursor: pointer; 2048 position: relative; 2049 background-size: cover; 2050 background-position: center; 2051 display: flex; 2052 justify-content: center; 2053 align-items: center; 2054 text-align: center; 2055 height: 240px; 2056 border-radius: 12px; 2057 &:hover { 2058 box-shadow: var(--p-shadow-400); 2059 } 2060 2061 .disabled { 2062 background-size: cover; 2063 background-position: center; 2064 filter: grayscale(100%); 2065 } 2066 2067 .image-container { 2068 position: absolute; 2069 top: 0; 2070 left: 0; 2071 } 2072`,MT=se.div` 2073 margin: 0; 2074 display: grid; 2075 grid-template-columns: repeat(2, 1fr); 2076 grid-template-rows: repeat(2, 1fr); 2077 /* height: 100vh; */ 2078 gap: var(--p-space-400); 2079 2080 @media (max-width: 768px) { 2081 grid-template-columns: 1fr; 2082 grid-template-rows: repeat(4, 1fr); 2083 height: auto; 2084 .image-container { 2085 height: 30vh; 2086 } 2087 } 2088`,UT=20,FT=({issueType:t,icon:s,title:n,affectedCount:a,lastTime:r,isOpen:o,isSeen:l,onToggle:c})=>{const{t:u}=J(),d=i.useId(),g=ws(),h=pt(),{isMobile:p}=xe(),x=he(pa),f=he(cl),[_,b]=i.useState({data:[],total:0}),[v,y]=i.useState(!1),[C,S]=i.useState(!1),[j,A]=i.useState(1),[E,T]=i.useState(!1),k=i.useRef({firstLoad:!1}),O=Math.ceil(_.total/UT),R=async L=>{(await Fn.postMarkAsRead({id:L})).status===fe.OK&&(g.invalidateQueries({queryKey:vt.notification.getUnreadCount()}),b(H=>({...H,data:H.data.filter(Z=>Z.id!==L)})))},P=(L,W)=>{switch(L){case"issue_product_has_price_issue":return W>1?u("ProductsHasPriceIssue"):u("ProductHasPriceIssue");case"issue_product_has_stock_issue":return W>1?u("ProductsHasStockIssue"):u("ProductHasStockIssue");case"issue_product_unavailable":return W>1?u("ProductsUnavailable"):u("ProductUnavailable");case"order_fulfillment_rejected":return W>1?u("OrdersFulfillmentRejected"):u("OrderFulfillmentRejected");case"order_new_order_conversation":return W>1?u("NewOrdersConversation"):u("NewOrderConversation");case"order_payment_timeout":return W>1?u("OrdersPaymentTimeOut"):u("OrderPaymentTimeOut");case"order_shipment_failed":return W>1?u("OrdersShipmentFailed"):u("OrderShipmentFailed");case"auto_boost_product_listing":return W>1?u("AutoBoostProducts"):u("AutoBoostProduct");case"account_running_out_of_credits":return u("OutOfUsage");default:return""}},w=L=>{const W=it(),H=it(L),Z=W.diff(H,"minutes"),te=W.diff(H,"hours"),ne=W.diff(H,"days");return Z<60?`${Z}m`:te<24?`${te}h`:ne<3?`${ne}d`:H.format("MM/DD")},N=i.useCallback(async L=>{L?S(!0):y(!0);const W=await Fn.getNotificationByType({type:t,page:j});if(W.status===fe.OK&&W.data){const H=W.data.notifications,Z=W.data.total;b(te=>({data:j===1?H:[...te.data,...H],total:Z}))}L?S(!1):y(!1)},[t,j]);i.useEffect(()=>
2088{o&&!k.current.firstLoad&&(k.current.firstLoad=!0,N(!1))},[o,N]),i.useEffect(()=>{j>1&&N(!0)},[j,N]);const K=L=>{if(L.payload.product_name){let H=L.payload.product_name;return t==="issue_product_unavailable"?H=u("AProductIsUnavailableFromSupplierReviewNow",{product_title:e.jsx("strong",{children:L.payload.product_name})}):t==="issue_product_has_price_issue"&&(H=u("ProductPriceIssueDetectedReviewPricingNow",{product_title:e.jsx("strong",{children:L.payload.product_name})})),e.jsxs(ft,{columns:"auto minmax(0,1fr) auto",gap:"200",alignItems:"center",children:[e.jsx(pn,{source:L.payload?.product_image||"",alt:"product",size:"small"}),e.jsx("div",{className:"flex flex-col gap-1",children:e.jsx(Et,{content:H,zIndexOverride:600,children:e.jsx(m,{as:"p",variant:"bodySm",truncate:!0,alignment:"start",fontWeight:"medium",children:H})})}),L.payload.product_id&&t==="auto_boost_product_listing"&&e.jsx("div",{children:e.jsx(ds,{source:Je,tone:"success"})})]})}if(L.payload.order_name){let H=L.payload.order_name;return t==="order_payment_timeout"?H=u("OrderPaymentTimedOutRetryNowToAvoidCancellation",{order_id:e.jsx("strong",{children:L.payload.order_name})}):t==="order_fulfillment_rejected"?H=u("OrderFulfillmentRejectedReviewNow",{order_id:e.jsx("strong",{children:L.payload.order_name})}):t==="order_shipment_failed"?H=u("OrderShipmentFailedCheckDetails",{order_id:e.jsx("strong",{children:L.payload.order_name})}):t==="order_new_order_conversation"&&(H=u("NewMessageReceivedForOrder",{order_id:e.jsx("strong",{children:L.payload.order_name})})),e.jsxs(ft,{columns:"auto minmax(0,1fr) auto",gap:"200",alignItems:"center",children:[e.jsx(or,{source:L.payload?.platform||"shopify",fontSize:40}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Et,{content:H,zIndexOverride:600,children:e.jsx(m,{as:"p",variant:"bodySm",truncate:!0,alignment:"start",fontWeight:"medium",children:H})}),e.jsx(m,{as:"p",variant:"bodyXs",alignment:"start",tone:"subdued",children:w(L.created_at)})]})]})}let W=u("Quota").toLowerCase();return L.payload.feature_id==="PRODUCT_LISTING"?W=u("Products").toLowerCase():L.payload.feature_id==="ORDER_FULFILLMENT"&&(W=u("Orders").toLowerCase()),e.jsxs(ft,{columns:"auto minmax(0,1fr) auto",gap:"200",alignItems:"center",children:[e.jsx("div",{children:e.jsx(ee,{source:_p})}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(m,{as:"p",variant:"bodySm",alignment:"start",fontWeight:"medium",children:u("YourUsageIsBelow10UpgradeNowToStayActive",{feature:W})}),e.jsx(m,{as:"p",variant:"bodyXs",alignment:"start",tone:"subdued",children:w(L.created_at)})]})]})};return e.jsxs("div",{className:oe("p-3 border border-border-disabled rounded-xl",!l&&"border-border shadow-[0px_4px_16px_0px_rgba(0,0,0,0.1)]"),children:[e.jsx("div",{children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-1 justify-between items-center",children:[e.jsxs("div",{className:"flex items-start",children:[e.jsx(ee,{source:s}),e.jsx(m,{as:"p",variant:"bodyLg",fontWeight:"medium",children:n})]}),e.jsxs("div",{className:"flex justify-between items-center gap-1",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:r?w(r):"-"}),!l&&e.jsx("div",{className:"size-2 rounded-full bg-[#5546FF]"})]})]}),!o&&e.jsx("div",{className:"py-2.5 px-2 bg-bg-surface-secondary rounded-lg",children:e.jsxs("div",{className:"flex items-center justify-between cursor-pointer lowercase",onClick:()=>c(!o),children:[e.jsxs(m,{as:"p",variant:"bodySm",tone:"subdued",children:[a," ",P(t,a||0)]}),e.jsx(re,{variant:"plain",icon:o?Pn:Rs})]})})]})}),e.jsx(Qe,{open:o,id:`notification-${d}`,transition:{duration:"500ms",timingFunction:"ease-in-out"},children:e.jsx("div",{className:"mt-2",children:e.jsx("div",{className:"p-3 rounded-lg bg-bg-surface-secondary",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[_.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-2 max-h-[min(400px,40vh)] overflow-y-auto overscroll-contain",children:[_.data.map((L,W)=>L.payload.product_id||L.payload.order_id||L.payload.account_id||L.payload.total_credit_used?e.jsx("div",{className:"cursor-pointer min-h-10 rounded-lg hover:bg-bg-fill-active p-1",onClick:()=>{L.payload.product_id&&(t==="issue_product_has_price_issue"&&R(L.id),h(Y.HOME_PAGE.PATH+`?view=manage-product&view_product_detail=${L.payload.product_id}&view_product_detail_tab=variants`),x(!1)),L.payload.order_id&&(R(L.id
2088),h(Y.HOME_PAGE.PATH+`?view=place-order&view_order_detail=${L.payload.order_id}`),x(!1)),(L.payload.total_credit_used||L.payload.feature_id)&&(R(L.id),h(Y.BILLING_PLAN.PATH),x(!1)),p&&f(!1)},children:K(L)},`${t}-${W}`):null),!v&&O>j&&e.jsx("div",{className:"flex",children:e.jsx(re,{onClick:()=>{A(L=>L+1)},loading:C,variant:"plain",children:u("ViewMore")})})]}),v&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Se,{height:48,width:"100%"}),e.jsx(Se,{height:48,width:"100%"}),e.jsx(Se,{height:48,width:"100%"})]})]})})})})]})},BT=({onNotificationSetting:t})=>{const{t:s}=J();return e.jsxs(D,{gap:"200",align:"center",children:[e.jsx("span",{className:"msui-flex-center",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"200",height:"200",viewBox:"0 0 123 124",fill:"none",children:[e.jsx("rect",{width:"123",height:"123",transform:"translate(0 0.843262)",fill:"white"}),e.jsx("circle",{cx:"55.292",cy:"67.3696",r:"30.1475",fill:"#F8F8F8"}),e.jsx("path",{d:"M33.0803 35.7733C32.4677 35.7733 31.9031 35.9655 31.4587 36.3019C31.4947 36.1217 31.5187 35.9415 31.5187 35.7613C31.5308 34.2599 30.3296 33.0347 28.8161 33.0227C27.3026 33.0106 26.0894 34.2118 26.0774 35.7253C26.0774 35.7854 26.0774 35.8334 26.0774 35.8814C25.7892 35.7733 25.4648 35.7013 25.1405 35.7013C23.6391 35.6893 22.4139 36.8904 22.4019 38.4039C22.3778 39.8814 23.555 41.0945 25.0204 41.1426L33.0562 41.1906C34.5577 41.2026 35.7829 40.0015 35.7949 38.488C35.7949 36.9865 34.5697 35.7974 33.0803 35.7733Z",fill:"#B3B3B3",fillOpacity:"0.3"}),e.jsx("path",{d:"M95.2519 39.8447C94.6393 39.8447 94.0748 40.0489 93.6303 40.3732C93.6664 40.1931 93.6784 40.0129 93.6784 39.8327C93.6904 38.3312 92.4892 37.106 90.9758 37.094C89.4623 37.082 88.2491 38.2832 88.2371 39.7967C88.2371 39.8567 88.2371 39.9048 88.2371 39.9648C87.9488 39.8567 87.6245 39.7847 87.3002 39.7847C85.7987 39.7606 84.5735 40.9738 84.5615 42.4873C84.5495 43.9647 85.7146 45.1779 87.1801 45.226L95.2159 45.286C96.7174 45.298 97.9425 44.0969 97.9546 42.5834C97.9786 41.0579 96.7534 39.8687 95.2519 39.8447Z",fill:"#B3B3B3",fillOpacity:"0.3"}),e.jsx("path",{d:"M83.5295 84.4448C83.1451 84.4448 82.8568 84.7331 82.8568 85.1055C82.8568 85.3817 83.001 85.5979 83.2172 85.7061L83.1211 97.4415H83.7577L83.8538 85.67C84.058 85.5619 84.1781 85.3457 84.1781 85.1055C84.1901 84.7331 83.9018 84.4688 83.5295 84.4448Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M97.1147 85.2016C97.1147 84.8652 96.8264 84.5529 96.442 84.5409C96.0697 84.5409 95.7814 84.8292 95.7814 85.2016C95.7814 85.4538 95.9255 85.67 96.1297 85.7781L96.0336 97.5256H96.6702L96.7663 85.7781C96.9705 85.67 97.0906 85.4538 97.1147 85.2016Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M81.3446 89.6339L81.3662 86.655L98.0025 86.7787L97.9808 89.7576L81.3446 89.6339Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M83.2532 86.667L83.2172 86.715L81.4755 89.6339H81.3434L81.3674 86.667H83.2532Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M87.4573 86.703L85.6676 89.6699L83.4214 89.6579L84.1181 88.4688L85.1631 86.679L87.4573 86.703Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M91.6495 86.739L89.8717 89.6939L87.6135 89.6699L89.3672 86.715L91.6495 86.739Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M95.8536 86.7751L94.0878 89.73L91.8176 89.7059L93.5833 86.7511L95.8536 86.7751Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M97.9916 86.7751L97.9796 89.766L96.0096 89.742L97.7754 86.7751H97.9916Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M81.3109 94.232L81.3325 91.2531L97.9688 91.3768L97.9471 94.3557L81.3109 94.232Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M83.2172 91.2555L83.1812 91.3155L81.4395 94.2344H81.3074L81.3314 91.2555H83.2172Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M87.4213 91.2915L85.6316 94.2704L83.3854 94.2464L84.0821 93.0572L85.1271 91.2795L87.4213 91.2915Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M91.6135 91.3275L89.8357 94.2824L87.5775 94.2704L89.3312 91.3155L91.6135 91.3275Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M95.8176 91.3636L94.0638 94.3185L91.7816 94.3064L93.5473 91.3516L95.8176 91.3636Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M97.9556 91.3876L97.9436 94.3545L95.9736 94.3425L97.7394 91.3876H97.9556Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M97.9796 89.766C97.9796 89.766 97.9796 89.754 97.9796 89.706V89.5378C97.9796 89.4057 97.9796 89.2135 97.9796 88.9612C97.9796 88.4567 97.9916 87.712 97.9916 86.7631L98.0037 86.7871L81.3674 86.691L81.3914 86.667C81.3914 87.676 81.3674 88.685 81.3674 89.6459L81.3554 89.6339L93.211 89.742L81.3554 89.6939H81.3074L81.3314 86.667H81.3434L97.9796 86.8111H97.9916V86.8231C97.9916 87.7841 97.9796 88.5168 97.9796 89.0213C97.9796 89.2976 97.9796 89.4777 97.9796 89.5979V89.718V89.766Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M97.9436 94.3545C97.9436 94.3545 97.9436 94.3425 97.9436 94.3064V94.1383C97.9436 94.0061 97.9436 93.814 97.9436 93.5617C97.9436 93.0572 97.9556 92.3125 97.9556 91.3636L97.9676 91.3756L81.3434 91.2915L81.3674 91.2795C81.3674 92.2885 81.3434 93.2974 81.3434 94.2584L81.3314 94.2464L93.1869 94.3545L81.3314 94.2944H81.2833L81.3074 91.2795H81.3194L97.9556 91.4236H97.9676V91.4356C97.9676 92.3966 97.9556 93.1293 97.9556 93.6338C97.9556 93.91 97.9556 94.0902 97.9556 94.2103V94.3425C97.9436 94.3184 97.9436 94.3545 97.9436 94.3545
2088Z",fill:"#B3B3B3",fillOpacity:"0.1"}),e.jsx("path",{d:"M50.8202 85.2734H60.4682V88.8049H50.8202V85.2734ZM75.4935 80.0844V83.6158H35.7949V80.0844H38.8469V67.2078C38.8469 57.8507 45.5099 50.1392 54.0064 49.2383V45.9351H57.2932V49.2383C65.7784 50.1271 72.4526 57.8387 72.4526 67.2078V80.0964H75.4935V80.0844Z",fill:"#B3B3B3",fillOpacity:"0.35"})]})}),e.jsx(m,{as:"span",variant:"headingSm",alignment:"center",children:s("NoNotificationsYet")}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",alignment:"center",children:s("StayTunedOrCheckSettingToMakeSureThatNotificationsAreEnabled")}),e.jsx("div",{className:"msui-flex-center",children:e.jsx(re,{variant:"primary",url:t?void 0:Y.GENERAL_SETTING.SUBROUTES.NOTIFICATIONS.PATH,onClick:t,children:s("NotificationSetting")})})]})},HT=[{key:"order_payment_timeout",title:"OrderTimeout",icon:wr},{key:"order_shipment_failed",title:"OrderShipmentFailed",icon:wr},{key:"order_fulfillment_rejected",title:"OrderFulfillmentRejected",icon:wr},{key:"order_new_order_conversation",title:"NewOrderConversation",icon:wr},{key:"auto_boost_product_listing",title:"AutoBoostProduct",icon:Zg},{key:"issue_product_has_stock_issue",title:"ProductOutOfStock",icon:Ui},{key:"issue_product_has_price_issue",title:"ProductCostIssue",icon:Ui},{key:"issue_product_unavailable",title:"ProductUnavailable",icon:Ui},{key:"account_running_out_of_credits",title:"RunOutOfUsage",icon:Xg}],GT=({onCloseSidebar:t})=>{const s=ws(),{t:n}=J(),a=de(),r=pt(),{isMobile:o}=xe(),l=he(cl),[c,u]=i.useState(""),[d,g]=i.useState(!1),h=ke(pa),p=ke(oh),x=he(lh),{data:f}=vr(),_=async()=>{g(!0),(await Fn.postMarkAsReadAll({disable_count:!1})).status===fe.OK&&(s.invalidateQueries({queryKey:vt.notification.getUnreadCount()}),u("")),g(!1)},b=()=>{o?(r(Y.GENERAL_SETTING.SUBROUTES.NOTIFICATIONS.PATH),t?.(),l(!1)):x(!0)};return i.useEffect(()=>{h?(Dn("notification_click",a.getCurrentPlan()),document.body.classList.add("hide-chat")):document.body.classList.remove("hide-chat")},[h]),e.jsxs("div",{className:"p-4 flex-1 bg-white flex flex-col justify-between min-h-0",children:[f?.data?.length===0&&e.jsx(BT,{onNotificationSetting:b}),(f?.data?.length||0)>0&&e.jsx("div",{className:"flex flex-col gap-4 flex-1 overflow-y-auto min-h-0",children:HT.filter(v=>f?.nomalizeData?.[v.key]?.count>0).map(v=>e.jsx(FT,{issueType:v.key,isOpen:c===v.key||p===v.key,onToggle:y=>u(y?v.key:""),icon:v.icon,title:n(v.title),affectedCount:f?.nomalizeData?.[v.key]?.count||0,lastTime:f?.nomalizeData?.[v.key]?.last_created_at||"",isSeen:f?.nomalizeData?.[v.key]?.isSeen||!1},v.key))}),e.jsx("div",{className:"mt-auto py-4 bg-white sticky bottom-0",children:e.jsxs(U,{align:"space-between",gap:"100",blockAlign:"center",children:[e.jsx(re,{variant:"tertiary",icon:Ip,onClick:b,children:n("GoToSettings")}),!!f?.data?.length&&e.jsx(re,{onClick:_,variant:"plain",icon:Jg,loading:d,children:n("MarkAllAsRead")})]})})]})},WT=i.memo(GT),VT=({isAtOnboarding:t=!1})=>{const{t:s}=J(),{isMobile:n}=xe(),a=ws(),[r,o]=be(pa),l=he(oh),{data:c}=vr(),u=()=>{c&&c?.count>0&&a.invalidateQueries({queryKey:vt.notification.getUnreadCount()}),l(""),o(!1)},d=e.jsx("div",{className:"flex flex-col flex-1 w-full max-w-[1072px] mx-auto min-h-0",children:e.jsx("div",{className:"flex-1 w-full flex min-h-0",children:e.jsx(WT,{onCloseSidebar:u})})});return n?e.jsx(xt,{title:s("Notification"),styleDrawerBody:{flex:1},placement:"right",visible:r,onClose:u,children:e.jsx("div",{className:"h-full flex flex-col",children:d})}):e.jsx(Is,{width:390,contentStyle:{background:"#fff"},visible:r,onClose:u,children:e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"bg-white px-4",children:e.jsx(us,{title:s("Notification"),backAction:{onAction:u}})}),d]})})},YT=({steps:t,hidePricing:s=!1,onViewPricing:n,onTryZopiForFree:a,onOpenDemoMode:r,isLoading:o=!1,title:l,description:c})=>{const{t:u}=J(),{isMobile:d}=xe();return d?e.jsxs(D,{gap:"600",align:"center",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"h1",variant:"headingLg",children:u("GettingThingsReady")}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:u("WeArePreparingYour")})]}),e.jsx(Q,{padding:"400",width:"100%",children:e.jsx(xu,{children:t.map((g,h)=>e.jsxs(_u,{className:hi(g.id==="config"&&"last-step"),children:[e.jsx(bu,{className:"shrink-0",status:g.status,children:g.status==="completed"?e.jsx(ee,{source:Je}):g.status==="active"?e.jsx(Pa,{size:"small"}):g.status==="error"?e.jsx(ee,{source:Ws,tone:"critical"}):e.jsx(yu,{})}),h<t.length-1&&(t[h+1]?.status==="completed"?e.jsx(Au,{show:!0,status:g.status}):e.jsx(Cu,{children:Array.from({length:11}
2088).map((p,x)=>e.jsx(vu,{},x))})),e.jsx(Su,{children:e.jsxs(m,{as:"span",variant:"bodyMd",fontWeight:g.status==="active"?"semibold":"regular",tone:g.status==="active"?void 0:"subdued",children:[g.label,g.status==="active"&&e.jsxs(ju,{children:[e.jsx("span",{children:"."}),e.jsx("span",{children:"."}),e.jsx("span",{children:"."})]})]})})]},g.id))})}),t.every(g=>g.status==="completed")&&e.jsx(U,{align:"center",children:e.jsx(Q,{width:"100%",background:"bg-fill-success-secondary",padding:"200",borderRadius:"200",children:e.jsxs(U,{blockAlign:"center",gap:"200",align:"start",children:[e.jsx("div",{children:e.jsx(ee,{source:Je,tone:"success"})}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"success",children:u("InstallationSuccessful")})]})})})]}):e.jsxs(D,{gap:"400",align:"center",children:[e.jsx(m,{as:"h1",variant:"headingLg",alignment:"center",children:l||u("SettingUpYourStore")}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",alignment:"center",children:c||u("WeArePreparingYour")}),e.jsx(Q,{padding:d?"400":"600",width:"100%",children:e.jsx(xu,{children:t.map((g,h)=>e.jsxs(_u,{className:hi(g.id==="config"&&"last-step"),children:[e.jsx(bu,{status:g.status,children:g.status==="completed"?e.jsx(ee,{source:Je}):g.status==="active"?e.jsx(Pa,{size:"small"}):g.status==="error"?e.jsx(ee,{source:Ws,tone:"critical"}):e.jsx(yu,{})}),h<t.length-1&&(t[h+1]?.status==="completed"?e.jsx(Au,{show:!0,status:g.status}):e.jsx(Cu,{children:Array.from({length:11}).map((p,x)=>e.jsx(vu,{},x))})),e.jsx(Su,{children:e.jsxs(m,{as:"span",variant:"bodyMd",fontWeight:g.status==="active"?"semibold":"regular",tone:g.status==="active"?void 0:"subdued",children:[g.label,g.status==="active"&&e.jsxs(ju,{children:[e.jsx("span",{children:"."}),e.jsx("span",{children:"."}),e.jsx("span",{children:"."})]})]})})]},g.id))})}),t.every(g=>g.status==="completed")&&e.jsx(U,{align:"center",children:e.jsx(Q,{width:d?"100%":"500px",children:e.jsx(kt,{tone:"success",children:u("InstallationSuccessful")})})}),!s&&e.jsx(U,{align:"center",children:e.jsx(Q,{width:d?"100%":"500px",children:e.jsx(D,{gap:"200",align:"center",children:e.jsx(re,{onClick:n,disabled:o,size:"large",fullWidth:!0,variant:"primary",children:u("ViewPricingPlans")})})})})]})},xu=se.div` 2089 display: flex; 2090 flex-direction: column; 2091 width: 100%; 2092 max-width: 500px; 2093 margin: 0 auto; 2094`,_u=se.div` 2095 display: flex; 2096 position: relative; 2097 min-height: 110px; 2098 align-items: flex-start; 2099 2100 &.last-step { 2101 min-height: 32px; 2102 } 2103`,bu=se.div` 2104 width: 32px; 2105 height: 32px; 2106 border-radius: 50%; 2107 display: flex; 2108 align-items: center; 2109 justify-content: center; 2110 background: ${t=>t.status==="completed"?"var(--p-color-bg-inverse)":t.status==="active"||t.status==="error"?"var(--p-color-bg-fill)":"white"}; 2111 color: ${t=>t.status==="error"?"var(--p-color-bg-fill-critical)":t.status==="active"?"var(--p-color-bg-inverse)":"white"}; 2112 z-index: 2; 2113 opacity: ${t=>t.status==="inactive"?"0.7":"1"}; 2114 border: 2px solid 2115 ${t=>t.status==="completed"||t.status==="active"?"var(--p-color-bg-inverse)":t.status==="error"?"var(--p-color-bg-fill-critical)":"var(--p-color-bg-inverse)"}; 2116`,yu=se.div` 2117 width: 10px; 2118 height: 10px; 2119 border-radius: 50%; 2120 background: var(--p-color-bg-inverse); 2121`,Cu=se.div` 2122 width: 3px; 2123 height: 65px; 2124 position: absolute; 2125 top: 40px; 2126 left: 15px; 2127 display: inline-flex; 2128 flex-direction: column; 2129 justify-content: flex-start; 2130 align-items: center; 2131 gap: 3px; 2132 overflow: hidden; 2133 z-index: 1; 2134`,vu=se.div` 2135 width: 3px; 2136 height: 3px; 2137 background: var(--p-color-bg-inverse); 2138 border-radius: 50%; 2139`,Au=se.div` 2140 display: ${t=>t.show?"block":"none"}; 2141 position: absolute; 2142 top: 40px; 2143 left: 16px; 2144 width: 2px; 2145 height: 60px; 2146 background: ${t=>t.status==="inactive"?"transparent":t.status==="completed"?"var(--p-color-bg-inverse)":t.status==="error"?"var(--p-color-bg-fill-critical)":"#4A4A4A"}; 2147 z-index: 1; 2148`,Su=se.div` 2149 margin-left: 16px; 2150 padding: 5px 0; 2151 display: flex; 2152 align-items: center; 2153 height: 36px; 2154`,ju=se.span` 2155 display: inline-flex; 2156 margin-left: 2px; 2157 2158 span { 2159 opacity: 0; 2160 animation: dotBlink 1.4s infinite; 2161 2162 &:nth-child(1) { 2163 animation-delay: 0s; 2164 } 2165 2166 &:nth-child(2) { 2167 animation-delay: 0.4s; 2168 } 2169 2170 &:nth-child(3) { 2171 animation-delay: 0.8s; 2172 } 2173 } 2174 2175 @keyframes dotBlink { 2176 0%, 2177 100% { 2178 opacity: 0; 2179 } 2180 50% { 2181 opacity: 1; 2182 } 2183 } 2184`,zT="/assets/img1-C0NqjWlr.png",KT="/assets/img2-DrHgpaXi.png",QT="/assets/img3-zHp_pyjs.png",qT=t=>{const[s,n]=i.useState(!1),{t:a}=J(),[r,o]=i.useState(t||[{id:"sync",label:a("SyncingYourStoreInfo"),status:"inactive",img:zT,icon:Sp},{id:"workspace",label:a("LoadingDefaultSettings"),status:"inactive",img:KT,icon:$g},{id:"config",label:a("GettingYourWorkspaceReady"),status:"inactive",img:QT,icon:Rp}]),l=i.useCallback((c,u)=>{o(d=>d.map((g,h)=>h===c?{...g,status:u}:g))},[]);return{steps:r,isLoading:s,setIsLoading:n,updateStepStatus:l}},ZT=({selectedCategories:t,selectedGoals:s,updateStepStatus:n,setIsLoading:a,minStepTime:r=1e3})=>{const{token:o}=vs(),l=de(),{fetchUserInfo:c}=l;return{handleFinish:i.useCallback(async d=>{a(!0),n(0,"active");const g=Date.now();try{const h=await dh.postCompleteOb({categories:t,goal:s.length>0?s:["exploring"]}),p=Date.now()-g,x=3,_=Math.max(5500-p,0),b=Math.max(_/x,r);n(0,"completed"),n(1,"active");const v=y=>new Promise(C=>setTimeout(C,y));await v(b),n(1,"completed"),n(2,"active"),await v(b),h.status===fe.OK?(n(2,"completed"),c()):(n(2,"error"),console.error("API responded with
2184non-OK status:",h.status),Io({message:`status_${h.status}`})),a(!1)}catch(h){console.error("Error completing onboarding:",h),n(2,"error"),a(!1),Io({message:h?.message||"unknown error"})}finally{d&&d()}},[t,s,n,a])}},XT=()=>{const{t}=J(),{steps:s,isLoading:n,setIsLoading:a,updateStepStatus:r}=qT([{id:"sync",label:t("SyncingYourStoreInfo"),status:"inactive"},{id:"workspace",label:t("CreatingYourWorkspace"),status:"inactive"},{id:"config",label:t("SyncingYourStoreOrder"),status:"inactive"}]),{handleFinish:o}=ZT({selectedCategories:[],selectedGoals:[],updateStepStatus:r,setIsLoading:a,minStepTime:5500}),l=s.every(u=>u.status==="completed"),c=()=>{window.location.href=Y.HOME_PAGE.PATH};return i.useEffect(()=>{o(()=>{})},[]),i.useEffect(()=>{l&&c()},[s]),e.jsxs(nt,{padding:"400",children:[e.jsx(YT,{hidePricing:!0,isLoading:n,steps:s,title:t("GettingThingsReady"),description:t("GettingThingsReadyDes")}),e.jsx("div",{className:oe("flex justify-center mt-4",!l&&"hidden"),children:e.jsx(re,{variant:"primary",onClick:c,children:t("StartFulfillingTikTokOrders")})})]})},Ar={CONNECT_ACCOUNT_SUCCESS:"CONNECT_ACCOUNT_SUCCESS",REMOVE_COOKIES_CONNECT_ACCOUNT_SUCCESS:"REMOVE_COOKIES_CONNECT_ACCOUNT_SUCCESS",UPDATE_WORKPLACE:"UPDATE_WORKPLACE",PUSH_PRODUCT_DONE:"PUSH_PRODUCT_DONE",CONNECT_STORE:"CONNECT_STORE"},Sr=async t=>new Promise((s,n)=>{try{const a="egbncdggdomnmpkngingeacgmlbcneif";a&&chrome&&chrome.runtime?chrome.runtime.sendMessage(a,t,r=>{chrome.runtime.lastError&&s(void 0),s(r)}):s(void 0)}catch(a){console.log("sendMessage error",a),s(void 0)}}),JT=async()=>{try{return await Sr({type:Ar.CONNECT_ACCOUNT_SUCCESS,payload:{env:"production",app:"AO"}})}catch(t){console.log("error",t)}},$T=async()=>{try{return await Sr({type:Ar.REMOVE_COOKIES_CONNECT_ACCOUNT_SUCCESS,payload:{}})}catch(t){console.log("error",t)}},eP=async t=>{try{return await Sr({type:Ar.UPDATE_WORKPLACE,payload:{...t,env:"production"}})}catch(s){console.log("error",s)}},tP=async()=>{try{return await Sr({type:Ar.PUSH_PRODUCT_DONE,payload:{}})}catch(t){console.log("error",t)}},sP=async t=>{try{return await Sr({type:Ar.CONNECT_STORE,payload:{...t,type:t.type,url:t.url,shop_name:t.shop_name,shop_id:t.shop_id,shop_code:t.shop_code,endpoints:A1}})}catch(s){console.log("error",s)}},Fl={onConnectAccountSuccess:JT,removeCookiesConnectOD:$T,updateWorkPlace:eP,onPushDoneProduct:tP,connectStore:sP},nP=()=>{const{t}=J(),s=Pt(),{isMobile:n}=xe(),{isExtension:a,fetchExtension:r}=aA(),o=de(),[l,c]=i.useState({isShow:!1,isShake:!1}),u=()=>e.jsxs(U,{wrap:!1,gap:"400",children:[!a&&e.jsx(re,{onClick:async()=>{const g=await r();c(g?{isShow:!1,isShake:!1}:{isShow:!0,isShake:!0})},children:t("VerifyInstall")}),a?e.jsx("div",{children:e.jsx(Q,{borderRadius:"200",background:"bg-fill-secondary",paddingBlock:"150",paddingInline:"300",children:e.jsxs(U,{wrap:!1,gap:"100",children:[e.jsx(ee,{source:kp,tone:"success"}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"success",fontWeight:"medium",children:t("Installed")})]})})}):e.jsx(re,{variant:"primary",onClick:()=>{window.open(Ts.extension.ao.link_install,"_blank")},children:t("InstallZopiExtension")})]}),d=e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex gap-5 py-4",children:[e.jsx("div",{className:"my-auto",children:e.jsx("span",{className:"size-10 rounded-full bg-bg-fill-brand text-text-brand-on-bg-fill flex items-center justify-center",children:"1"})}),e.jsx("div",{children:e.jsxs(D,{gap:"100",children:[e.jsx(m,{as:"p",variant:"headingSm",children:t("InstallZopiExtension")}),e.jsx(m,{as:"p",tone:"subdued",children:t("InstallTheZopiExtensionToEnableSemiAutomatedOrderFulfillment")}),e.jsx("div",{children:u()}),l.isShow&&e.jsx("div",{className:l.isShake?"shake":"",children:e.jsx(Co,{message:t("YouHaveNotInstalledZopiExtension"),fieldID:"install-zopi-extension"})})]})})]}),e.jsx($e,{}),e.jsxs("div",{className:"flex gap-5 py-4",children:[e.jsx("div",{className:"my-auto",children:e.jsx("span",{className:"size-10 rounded-full bg-bg-fill-brand text-text-brand-on-bg-fill flex items-center justify-center",children:"2"})}),e.jsx("div",{children:e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"p",variant:"headingSm",children:t("LogInToYourTiktokShopAccount")}
2184),e.jsx(m,{as:"p",tone:"subdued",children:t("LogInToYourTiktokContentDescription")}),e.jsx("div",{children:e.jsx(re,{size:"large",variant:"primary",onClick:()=>{if(!a){c({isShow:!0,isShake:!0});return}Fl.connectStore({type:"tiktok",url:v1[0].link,token:ge.getToken(),workplace_id:o.getCurrentWorkPlace()?.id||0})},children:t("Connect")})})]})})]})]})});return e.jsxs("div",{className:"flex flex-col gap-4 mx-4",children:[e.jsx(nt,{roundedAbove:"xs",children:e.jsxs(D,{gap:"400",children:[n&&e.jsx(kt,{children:e.jsx(m,{as:"span",variant:"bodySm",children:t("YouNeddInstallZopiExtension")})}),e.jsx(m,{as:"h2",variant:"headingLg",alignment:"center",children:t("ConnectYourTikTokShop")}),d]})}),e.jsx(U,{children:e.jsx(re,{variant:"monochromePlain",onClick:()=>{s.openChat()},icon:e.jsxs(U,{gap:"100",children:[t("ContactSupport"),e.jsx(ee,{source:Oa})]})})})]})},aP=t=>{const{t:s}=J(),n=ke(hp),[a,r]=i.useState(1);return window.forceReload=!1,i.useEffect(()=>{n?.type==="CONNECT_STORE"&&n.data?.status==="connected"&&r(2)},[n?.type]),e.jsx(bi,{isOnboarding:!0,children:e.jsx(us,{title:s("QuickStartWithTiktokShop"),children:e.jsxs("div",{className:"max-w-[934px] mx-auto",children:[a===1&&e.jsx(nP,{}),a===2&&e.jsx(XT,{})]})})})},Bl=ae({key:"signinModalState",default:{open:!1}}),Hl=t=>e.jsx(wp,{...t}),rP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAKKADAAQAAAABAAAAKAAAAAB65masAAAC2UlEQVRYCe1X3Y0aMRC+hcAzJSwVhOsA3viTQioIVBClAo4KcqngSAW3iN+3kApCCe4gPIOAfJ+0u/KaHa/ZIw9R1pLl8fibmc+esVkeHopWnEBxAv/2CXhvod/v95uXy+UDetPzPB9jjf4g7zHs2CHPFovFFnKulotgt9sdItoY3Ud3aQqgyWq1mrqAdcxNBAeDgX88Hl94YrqTG2RVrVZbQRAoVxtngmE6X6M0ugZIwe3hY7Rer4OUtSuVE8FOpzNALb1eWb9BUSqVWi61mUkwTOuvO5ycuZ090v2Yle6SaWXOD4fDj1vI4aS3PB0Er+NSeBzh8xH9m+G7xno2dFdT6wmGtzXTieZ1JN1Uiy/Rhn6zTpBPiWubSuQyHHy2rYsEeWth6NuM9bXz+TzR5zfIjTBWqsm7VC2UCDiQ1lL0u81mo3Q9LhdrjDe/kVXDYaytbh/JIkEU+3s4jnDWEVj+tCUaLhc32EwohQljCUvWGmxIRi56bK7pgiMGWF/CijWYlRbJYU797QRzBrq7ma0G+ZtZkyLyMY7WUORXNYi6egZmqmH4nLAu09qVfQQSCQKg0BsR0ByzfkfxJu50m16vN8aGdVUsYzMJbLwAwVaDP3XgHeSa5APElbQmEkR6Askojx4kGpId1mbSmictUI+0/IaxtPNRZIvNKDPl/HVAbfrEIIU1+Pka4Y1RoRzqhi6e2mqQ7xO/QMYxOim8RFPgtpDZ43Y6nYYg9okKrMd6UwhjmOp4LqaYCHwqPWNQlP9SU/iyZgyxWQniY3KP9MWpFL3kXHDxbSXIuKwtpOpLTg42s4lZt2ngTII0Wi6XTMMkzUFOHf+CPrnYOhGkIzosl8sfISrO8zRkgiXTciXHGM4ECZ7P5wGejhZu3nfOXRuJATupVCp1l7Tqfq3PjA6M5PDDdNhut59wGk0+JSBMAolGUuhbKGcgNuWFSwCKSXECxQn8JyfwB2KhFuR5AZfaAAAAAElFTkSuQmCC",iP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAKKADAAQAAAABAAAAKAAAAAB65masAAAC+klEQVRYCe1YTW7aQBSOobDmCN6wLjlBnB0CFu4Jyg3CDRpuQE4QcoK4EgJ2uCcIXbOoewPWIKDfF42RGd54xtBWiuSRRn7zzZs3n99782Pf3JSl9EDpgY/tAe8a+r1eL9jv93ew0VLVpz3P89aHwyGByPq9Xq/HURRRLlwuIkhiIPANNXCdEaTHtVptWJRoIYJhGPrb7fa5CDHhBR6n0+lQwEWoKqIC2Ol0WrvdboYuhvOaEjSbTW+1WsUuRj65KJEcQrSA5xou+hadBHk7tugcu60hZlg3m80CI/zjKEHAC8SAE3apF6GnfbYzheTu5/N5ksFyRasHmXOw4EtW1Gp9wiodIfnXug49D7ID6H1FX2FytJfrQUzQhw4JSsV5wm63O0D+RkU8l05oI/gLin6qnHk6k8uMuUismEZxr0OfL/UXzSPJhitmJAgSocHI+JJQGWxZYeMiQWJ/RoKfGahUKi9nYAZQeetnIKuIedaz2WwkKRoJQpnbxFmZTCbxGZgBuGIxYZCBrCLGJFASCRpDjEkagmUa+hfFNxk1EjQN+N94HsFEICN5VVD7e5CRoMoLfaaG2n50/NjG6v+NRpJTj7oZYZmRT0TjIkEO/oRmcKKNBnAeW7GOp22sxn4q60+c6y2c6286jjZfSixGD2I7iaQRINjnGSv12TCc6w+SDmzGEk7MSJDbCcJsGvjKWw4NuBZ1cehL+iAoOoO6RoLsxEDTpvx+BXMlqTz+Spt6oRPyTiZPH6C3cRNZgGig46q9xnOE69aL9K2BF2gg5xjWR6UvPW7xCbCUOohZCbbbbb9arb6BZMNk5N1Q5sLKNvRbeLDmlSeQG+QpWAlyMEOEUNCTuSTzJhL6liB3K+AnUG4OppoMAcjdo52k2JXPJfbLLy42nAjSEEnyHggxcjGco8NPBOfvEqcQ65Mh5H2E/EHlmd4ttrlaUYe225A++CKCqRG1fYSY+A5kfeCs6a+PNcQl+n7gjwIW+WW/PmivLKUHSg98ZA/8AVkhPMPtAbDtAAAAAElFTkSuQmCC",wh=t=>{const s=de(),{t:n}=J(),{size:a="large",googleProps:r,facebookProps:o,isConnectAccount:l}=t,{title:c="SignUpWithGoogle"}=r||{},{title:u="SignUpWithFacebook"}=o||{},d=async g=>{try{t.setLoading&&t.setLoading(!0),ge.localStorage.set(Xa.METHOD,g),ge.localStorage.set(Xa.RE_LOGIN,"true");const h=await s.authSocialLogin(g,{connect:l});if(h&&h.success&&h.data)if(l){const p=(window.screen.width-400)/2,x=(window.screen.height-700)/2;window.connect_popup=window.open(h.data.url,"CONNECT_ACCOUNT_POPUP_"+ge.getToken(),`toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=700,left=${p},top=${x}`)}else window.location.assign(h.data.url)}finally{t.setLoading&&t.setLoading(!1)}};return e.jsx(e.Fragment,{children:e.jsxs(ft,{gap:"200",columns:{xs:"6fr",sm:"6fr",md:"3fr 3fr",lg:"3fr 3fr"},children:[e.jsx("div",{className:"social-btn "+t.className,children:e.jsx(re,{fullWidth:!0,size:a,id:"sign-in-social-google",onClick:()=>d("google"),disabled:t.isLoading,icon:e.jsx("img",{src:iP,alt:"google",className:"size-5"}),children:n(c)})}),e.jsx("div",{className:"social-btn "+t.className,children:e.jsx(re,{fullWidth:!0,size:a,id:"sign-in-social-facebook",onClick:()=>d("facebook"),disabled:t.isLoading,icon:e.jsx("img",{src:rP,alt:"google",className:"size-5"}),children:n(u)})})]})})},Nh=t=>{const[s,n]=i.useState(!1);return e.jsx(ar,{type:s?"text":"password",autoComplete:"off",suffix:e.jsx("span",{className:"msui-cs-pointer",onClick:a=>{a.stopPropagation,n(!s)},children:s?e.jsx(ee,{source:ra,tone:"base"}):e.jsx(ee,{source:em,tone:"base"})}),...t})},Ww=t=>{const s=new URLSearchParams(location.search);let n=t;const a=s.get("redirect_uri");return a&&(n=n+"?redirect_uri"+encodeURIComponent(a)),n},oP={setMessage:t=>{ge.localStorage.set(Li.NOTIFY_STATUS_TO_LOGIN,JSON.stringify(t))},getMessage:()=>{let t=ge.localStorage.get(Li.NOTIFY_STATUS_TO_LOGIN);return setTimeout(()=>{ge.localStorage.remove(Li.NOTIFY_STATUS_TO_LOGIN)},100),t&&(t=JSON.parse(t)),t}},Vw=()=>{const t=oP.getMessage();return t?{content:t.message,status:t.status}:{content:"",status:"success"}},lP=[{required:!0,message:"ThisFieldIsRequired"},{pattern:/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/,message:"EmailIsInvalid"}],cP=[{required:!0,message:"ThisFieldIsRequired"},{min:8,max:16,message:"Between816CharactersLong"},{pattern:/^(?!.* )/,message:"DoNotContainSpaces"}],Gl=t=>{const s=lP.find(n=>{if(n.required&&!t.length||n.pattern&&!n.pattern.test(t))return n});return s?s.message:""},Oh=t=>{const s=cP.find(n=>{if(n.required&&!t.length||n.min&&n.max&&(n.min&&t.length>n.max||t.length<n.min)||n.pattern&&!n.pattern.test(t))return n});return s?s.message:""},Dh=t=>Object.keys(t).every(s=>t[s]===""),Eu=t=>{try{const s=ge.cookieStorage.get(dl.CONNECT_OD_FROM_EXTENSION)||"{}",n=JSON.parse(s);return n.token&&n.email&&n.store_url&&n.modeEnv==="production"?!(t?.id&&t?.domain!==n.store_url):!1}catch(s){return console.log("error get cookies connect OD",s),!1}},Tu=()=>{Fl.removeCookiesConnectOD()},dP=i.forwardRef((t,s)=>{const{setLoading:n,onConnectEmail:a,hideSocial:r,isLoading:o,isConnectEmail:l}=t,{isMobile:c}=xe(),{t:u}=J(),d=de(),g=bt(),h=pt(),p=he(L0),x=he(Bl),[f,_]=i.useState({email:"",password:""}),[b,v]=i.useState({email:"",password:""}),y=(k,O)=>{let R=O;(k==="email"||k==="password")&&(R=O.replace(/\s+/,"")),_(P=>({...P,[k]:R}))},C=()=>
2184{t.onChangeModalType("forgot-password")},S=async k=>{try{n&&n(!0),await k()}finally{n&&n(!1)}},j=k=>{l||S(async()=>{const{success:O,status:R}=await d.signin(k);O&&h(Y.HOME_PAGE_LANDING_PAGE.PATH),R===fe.EMAIL_NOT_VERIFIED&&d.resendEmail({email:k.email||""})})},A=k=>{S(async()=>{const O=await Tn.signin(k);if(O.success&&O.data?.token){const R=await Tn.connectAccount({token:O.data?.token});if(R.status===fe.QUOTA_EXPIRED){x({open:!1}),p({open:!0,tokenAccount:O.data?.token});return}if(R.status===fe.CONNECT_ACCOUNT_WITH_DUE_PACKAGE||R.status===fe.CONNECT_MORE_STORE_WITH_SAME_ACCOUNT){a({isDuplicatePlan:!0});return}R.data?.token&&(ge.setToken(R.data.token),g.success(u("ConnectEmailSuccess")),ta({token:R.data.token,env:"production",isReload:!0}),Ce.isShopifyEmbedded()&&!c&&E(),setTimeout(()=>{window.location.reload()},2e3))}O.status===fe.EMAIL_NOT_VERIFIED&&d.resendEmail({email:k.email||""})})},E=()=>{const k="https://id.zopi.io".replace("id.","ds."),O=Y.AUTH_AUTO_LOGIN.PATH.replace(":platform","shopify"),R=d.getToken();R&&window.open(`${k}${O}?token=${R}`)},T=()=>{const k=Gl(f.email),O={email:"",password:""};k&&(O.email=k);const R=Oh(f.password);if(R&&(O.password=R),v(O),!Dh(O))return;const P={email:f?.email,password:f?.password};l?A(P):j(P),j(P)};return i.useImperativeHandle(s,()=>({onFinish:T})),i.useEffect(()=>{location.pathname===Y.INTEGRATION.PATH&&h(Y.INTEGRATION.SUBROUTES.ADDON_LIST.PATH)},[location.pathname]),e.jsxs(uP,{children:[e.jsx(Hl,{onSubmit:T,children:e.jsxs(bo,{children:[e.jsx(gt,{label:u("Email"),placeholder:u("EnterYourEmailAddress"),requiredIndicator:!0,name:"email",disabled:o,type:"email",error:b.email?u(b.email):"",value:f.email,onChange:k=>{y("email",k)},autoComplete:"email"}),e.jsx(Nh,{placeholder:u("PleaseInputYourPassword"),value:f.password,disabled:o,onChange:k=>y("password",k),error:b.password?u(b.password):"",label:e.jsx(e.Fragment,{children:e.jsx(Et,{content:e.jsx(e.Fragment,{children:e.jsxs(D,{gap:"400",children:[e.jsxs("div",{children:[u("YourPasswordMustContain"),":"]}),e.jsx("ul",{children:["AtLeast8CharactersLong","BothLowerAndUpperCaseCharacters","AtLeastOneNumberOrSymbol"].map((k,O)=>e.jsx("li",{children:u(k)},O))})]})}),children:e.jsxs("span",{children:[u("Password")," ",e.jsx("span",{style:{color:"var(--p-color-text-critical)"},children:"*"})]})})})})]})}),e.jsx(U,{align:"end",children:e.jsx(re,{disabled:o,variant:"monochromePlain",onClick:C,children:u("ForgotPassword")})}),e.jsxs("div",{className:"divider",children:[e.jsx($e,{}),e.jsx("span",{className:"divider-text",children:e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:u("Or")})})]}),!r&&e.jsx(wh,{isConnectAccount:l,size:"medium",isLoading:o,setLoading:n&&n}),e.jsxs(U,{align:"center",gap:"100",children:[e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:u("DoNotHaveAnAccount")}),e.jsxs(re,{variant:"monochromePlain",disabled:o,onClick:()=>{t.onChangeModalType("sign-up")},children:[u("SignUp"),"?"]})]})]})}),uP=se.div` 2185 display: flex; 2186 flex-direction: column; 2187 gap: 20px; 2188 .divider { 2189 position: relative; 2190 margin: 15px 0px; 2191 .divider-text { 2192 position: absolute; 2193 top: 40%; 2194 left: 50%; 2195 padding: 0 10px; 2196 background-color: #fff; 2197 transform: translate(-50%, -50%); 2198 } 2199 } 2200`,pP=i.forwardRef((t,s)=>{const{t:n}=J(),{isLoading:a,isConnectEmail:r,hideSocial:o,setLoading:l,onChangeModalType:c}=t,[u,d]=be(Bl),[g,h]=i.useState({email:"",first_name:"",last_name:"",password:""}),p=bt(),x=de(),[f,_]=i.useState({email:"",password:""}),b=(S,j)=>{let A=j;(S==="email"||S==="password")&&(A=j.replace(/\s+/,"")),h(E=>({...E,[S]:A}))},v=()=>{const S=Gl(g.email),j={email:"",password:""};S&&(j.email=S);const A=Oh(g.password);if(A&&(j.password=A),_(j),!Dh(j))return;const E={email:g.email,password:g.password,first_name:g.first_name||"",last_name:g.last_name||""};C(E)},y=async S=>{try{l(!0),await S()}finally{l(!1)}},C=S=>
2200{y(async()=>{const j=await x.signup(S);if(j&&j.success){d({...u,email:S.email});const{success:A,data:E}=await Tn.signin(S);if(A&&E?.token){const T=await Tn.connectAccount({token:E?.token});T.data?.token&&(ge.setToken(T?.data?.token),p.success(n("ConnectEmailSuccess")),ta({token:E?.token,env:"production",isReload:!0}),setTimeout(()=>{window.location.reload()},2e3))}}})};return i.useImperativeHandle(s,()=>({onFinish:v})),i.useEffect(()=>{open||(h({email:"",first_name:"",last_name:"",password:""}),_({email:"",password:""}))},[open]),e.jsxs(hP,{children:[e.jsx(Hl,{onSubmit:v,children:e.jsxs(bo,{children:[e.jsx(gt,{label:n("Email"),disabled:a,placeholder:n("EnterYourEmailAddress"),requiredIndicator:!0,name:"email",type:"email",error:f.email?n(f.email):"",value:g.email,onChange:S=>{b("email",S)},autoComplete:"email"}),e.jsxs(bo.Group,{children:[e.jsx(gt,{label:n("FirstName"),disabled:a,placeholder:n("YourFirstName"),name:"fist_name",value:g.first_name,onChange:S=>{b("first_name",S)},autoComplete:"off"}),e.jsx(gt,{label:n("LastName"),name:n("LastName"),disabled:a,placeholder:n("YourLastName"),value:g.last_name,onChange:S=>{b("last_name",S)},autoComplete:"off"})]}),e.jsx(Nh,{placeholder:n("PleaseInputYourPassword"),value:g.password,disabled:a,onChange:S=>b("password",S),error:f.password?n(f.password):"",label:e.jsx(e.Fragment,{children:e.jsx(Et,{content:e.jsx(e.Fragment,{children:e.jsxs(D,{gap:"400",children:[e.jsxs("div",{children:[n("YourPasswordMustContain"),":"]}),e.jsx("ul",{children:["AtLeast8CharactersLong","BothLowerAndUpperCaseCharacters","AtLeastOneNumberOrSymbol"].map((S,j)=>e.jsx("li",{children:n(S)},j))})]})}),children:e.jsxs("span",{children:[n("Password")," ",e.jsx("span",{style:{color:"var(--p-color-text-critical)"},children:"*"})]})})})})]})}),e.jsxs("div",{className:"divider",children:[e.jsx($e,{}),e.jsx("span",{className:"divider-text",children:e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:n("Or")})})]}),!o&&e.jsx(wh,{isConnectAccount:r,size:"medium",isLoading:a,setLoa
2200ding:l}),e.jsxs(U,{align:"center",gap:"100",children:[e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:n("DoNotHaveAnAccount")}),e.jsxs(re,{variant:"monochromePlain",disabled:a,onClick:()=>{t.onChangeModalType("sign-in")},children:[n("SignIn"),"?"]})]})]})}),hP=se.div` 2201 display: flex; 2202 flex-direction: column; 2203 gap: 20px; 2204 .social-wrapper { 2205 gap: 20px; 2206 } 2207 .Polaris-Button.Polaris-Button--fullWidth { 2208 .Polaris-Button__Icon { 2209 display: inline-flex; 2210 } 2211 } 2212 .divider { 2213 position: relative; 2214 margin-top: 15px; 2215 .divider-text { 2216 position: absolute; 2217 top: 40%; 2218 left: 50%; 2219 padding: 0 10px; 2220 background-color: #fff; 2221 transform: translate(-50%, -50%); 2222 } 2223 } 2224`,gP="PleaseEnterTheEmailAssociatedWithYourAliOrderAccount",mP=i.forwardRef((t,s)=>{const{t:n}=J(),{isLoading:a,setLoading:r,onChangeModalType:o,description:l=gP}=t,c=de(),[u,d]=i.useState(""),[g,h]=i.useState(""),p=async()=>{try{if(a)return;r&&r(!0);const x=Gl(u);let f="";if(x&&(f=x),h(f),f)return;(await c.forgetPassword({email:u})).message&&o("sign-in")}finally{r&&r(!1)}};return i.useImperativeHandle(s,()=>({onFinish:p})),e.jsxs(D,{gap:"500",children:[e.jsx(m,{as:"p",variant:"headingSm",fontWeight:"regular",tone:"subdued",alignment:"start",children:n(l)}),e.jsx(wp,{onSubmit:p,children:e.jsx(D,{gap:"400",children:e.jsx(ar,{disabled:a,value:u,label:e.jsx(e.Fragment,{children:n("Email")}),requiredIndicator:!0,placeholder:n("EnterYourEmailAddress"),onChange:x=>d(x),type:"email",autoComplete:"email",error:g?n(g):""})})})]})}),fP=i.forwardRef((t,s)=>{const n=de(),{t:a}=J(),{email:r}=t,o=async()=>{try{const l=await n.resendEmail({email:r})}finally{}};return i.useImperativeHandle(s,()=>({onResendEmail:o})),e.jsx("div",{children:e.jsx(m,{as:"span",variant:"bodyMd",alignment:"start",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a("WeveSentAConfirmationLinkToEmailToActivateYourAccount",{email:t.email})}})})})}),Ko=t=>{const{title:s,className:n}=t,{openChat:a}=Pt(),{t:r}=J();return e.jsxs("div",{className:n,children:[s," ",e.jsx("span",{className:"underline cursor-pointer whitespace-nowrap",onClick:()=>{a()},children:r("ContactSupport")})]})},xP={"email-verification":"EmailVerification","forgot-password":"ForgotYourPassword","sign-in":"SignIn","sign-up":"SignUp"};let no;const ao=120,_P=()=>{const{t}=J(),[s,n]=be(Bl),[a,r]=i.useState("sign-in"),[o,l]=i.useState(!1),[c,u]=i.useState(ao),d=i.useRef(null),g=i.useRef(null),h=i.useRef(null),p=i.useRef(null),x=de();Pt();const f=bt(),[_,b]=i.useState(!1),[v,y]=i.useState(!1),C=()=>{o||n({open:!1})},S=()=>{o||(a==="sign-up"&&g.current?.onFinish(),a==="sign-in"&&d.current?.onFinish(),a==="forgot-password"&&p.current?.onFinish())},j=()=>{u(ao),h.current?.onResendEmail(),R()},A=w=>{r(w)},E=w=>{w?.isDuplicatePlan&&b(!0)},T=()=>a==="email-verification"?e.jsx(fP,{email:s.email||"",ref:h}):a==="forgot-password"?e.jsx(mP,{ref:p,setLoading:l,onChangeModalType:A}):a==="sign-up"?e.jsx(pP,{ref:g,onFinish:S,isLoading:o,isConnectEmail:s.isConnectAccount,hideSocial:s.hideSocial,setLoading:l,onChangeModalType:A}):e.jsx(dP,{ref:d,onFinish:S,isLoading:o,onConnectEmail:E,isConnectEmail:s.isConnectAccount,hideSocial:s.hideSocial,setLoading:l,onChangeModalType:A}),k=()=>a==="email-verification"?{content:t("ResendEmail")+(c>0?`(${c})`:""),disabled:c>0,onAction:j}:a==="forgot-password"?{content:t("Send"),disabled:o,onAction:S}:{content:t("Confirm"),disabled:o,onAction:S},O=()=>a==="forgot-password"||a==="email-verification"?[{content:t("Back"),disabled:o,onAction:()=>{r("sign-in")}}]:[{content:t("Cancel"),disabled:o,onAction:C}],R=()=>{no=setInterval(()=>{u(w=>(w=w-1,w<=0&&(clearInterval(no),w=0),w))},1e3)},P=w=>{try{if(w.data.type==="CONNECT_ACCOUNT"){window.connect_popup&&window.connect_popup.close();const N=w.data.response;if(N){const{status:K,data:L,message:W}=N;W&&K===fe.OK&&f.success(t(W)),(K===fe.CONNECT_ACCOUNT_WITH_DUE_PACKAGE||K===fe.CONNECT_MORE_STORE_WITH_SAME_ACCOUNT)&&b(!0),K===fe.CONNECT_ACCOUNT_AH_WITH_DUE_PACKAGE&&y(!0),L?.token&&K!==fe.QUOTA_EXPIRED&&(l&&l(!0),ge.setToken(L.token),f.success(t("C
2224onnectEmailSuccess")),setTimeout(()=>{window.location.reload()},2e3))}}}catch{}};return i.useEffect(()=>{x.getUserInfo().is_anonymous&&window.addEventListener("message",P)},[x.getUserInfo()]),i.useEffect(()=>()=>{window.removeEventListener("message",P)},[]),i.useEffect(()=>{clearInterval(no),a==="email-verification"&&s.open&&(u(ao),R())},[s.open,a]),i.useEffect(()=>{s.open===!1&&r("sign-in")},[s.open]),e.jsxs(Xe,{open:s.open,title:t(xP[a]),onClose:C,sectioned:!0,primaryAction:k(),secondaryActions:O(),children:[_&&e.jsx(kt,{tone:"critical",onDismiss:()=>b(!1),children:e.jsx(Ko,{title:t("ThisAccountHasSubscripted")})}),v&&e.jsx(kt,{tone:"critical",onDismiss:()=>y(!1),children:e.jsx(Ko,{title:t("ThisAccountIsRegisteredInZopi")})}),T()]})},bP=()=>{const t=bt(),{t:s}=J(),[n,a]=i.useState(!1),[r,o]=i.useState(!1),[l,c]=i.useState(!1),u=dt().getShop(),[d,g]=i.useState({token:"",email:"",store_url:"",modeEnv:""}),h=()=>{a(!1)},p=async()=>{try{o(!0);const _=d?.token||"",b=d?.email||"",v=d?.store_url||"";if(!_||!b||!v){t.error("Can not connect account with Zopi Extensions");return}const y=await Tn.connectAccount({token:_});if(y.status===fe.CONNECT_ACCOUNT_WITH_DUE_PACKAGE||y.status===fe.CONNECT_MORE_STORE_WITH_SAME_ACCOUNT){c(!0),o(!1);return}y.data?.token&&(Fl.onConnectAccountSuccess(),Tu(),ge.setToken(y.data.token),t.success(s("ConnectEmailSuccess")),await M0(2e3),window.location.reload()),o(!1)}catch(_){console.log("error",_),o(!1)}},x=()=>{Tu(),h()},f=()=>{try{const _=ge.cookieStorage.get(dl.CONNECT_OD_FROM_EXTENSION)||"{}",b=JSON.parse(_);Eu(u)&&(g(b),a(!0))}catch(_){console.log("error",_)}};return i.useEffect(()=>{f()},[u.id]),Eu(u)?e.jsx(Xe,{title:"Connect Zopi Extension",size:"small",open:n,onClose:h,sectioned:!0,primaryAction:{content:"Connect",loading:r,onAction:()=>p()},secondaryActions:[{content:"Cancel",disabled:r,onAction:x}],children:e.jsxs(D,{gap:"300",children:[e.jsx(Qe,{open:l,id:"banner-connect-account-fail",transition:{duration:"500ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(kt,{tone:"critical",onDismiss:()=>c(!1),children:e.jsx(Ko,{title:s("ThisAccountHasSubscripted")})})}),e.jsx(D,{children:e.jsx(m,{as:"span",children:s("QuestionConnectODWithZopiExtension",{var_email:e.jsx("b",{children:d?.email||""})})})})]})}):e.jsx(e.Fragment,{})},yP=()=>e.jsxs(e.Fragment,{children:[e.jsx(bP,{}),e.jsx(_P,{})]}),CP=ae({key:"productSettingState",default:{auto_split_variant_options:{threshold:100,split_logic:"split_all_variants",split_handle:"max_variants_per_product",max_variants_per_product:100,max_create_products:100},product_listings:{is_publish:!0,auto_optimize_content:!0,auto_optimize_image:!0,allow_sell_out_of_stock:!1},skip_review:null}});ae({key:"productSettingTabPanelState",default:{isOpen:!1,currentTab:"listing"}});function vP(){const[t,s]=be(CP),[n,a]=i.useState(),r=async()=>{},o=(g,h)=>{s(p=>({...p,auto_split_variant_options:{...p.auto_split_variant_options,[g]:h}}))},l=(g,h)=>{s(p=>({...p,product_listings:{...p.product_listings,[g]:h}}))},c=g=>t[g]||{};function u(){n&&s(n)}return{isChangeData:i.useMemo(()=>!q.isEqual(n,t),[n,t]),productSettings:t,discardChanges:u,setProductSettings:s,fetchProductSettings:r,getProductListingSectionData:c,handleUpdateProductListingValue:l,handleUpdateProductAutoSplitVariantOptionValue:o}}const Es={selling_price:{type:"advanced",taxable:!0,include_shipping_cost:!0,assign:{assign_cents:"99",assign_compare_cents:"99"},price_rules:[{type:"rest",selling_price:{operator:"x",value:2},compare_at_price:{operator:"x",value:3}}]},price_rule_bulk_update_product:{is_enable:!1},product_listings:{is_publish:!1,allow_sell_out_of_stock:!0},auto_split_variant_options:{is_enable:!1,threshold:101,split_logic:"split_all_variants",split_handle:"max_variants_per_product",max_variants_per_product:100},tracking_settings:{is_enable:!1,product_no_longer_available:"notify_only",variant_no_longer_available:"notify_only",price_increased_threshold_percent:10,price_increased_action:"notify_only",variant_back_in_stock:"notify_only"},auto_boost:{content:{is_enable:!1,language:"en",emotional_hook:[],tone:"persuasive",style:""},seo:{is_enable:!1,language:"en",user_prompt:""},image:{is_enable:!1,mode:An[0]?.id,filter:null,user_prompt:An[0]?.prompt??""},title:{is_enable:!1,user_prompt:Fs[0]?.mockText??""},prefix:{is_enable:!1,value:""},suffix:{is_enable:!1,value:""},description:{is_enable:!1,user_prompt:Fs[0]?.mockText??""},optimization_mode:"user_prompt"},recommend_products:{is_enable:!1,limit:30,frequency_days:7,categories:["related_to_listed_products","complements_of_listed_products","new_arrival_from_listed_suppliers"],target_ship_to:"US"}},AP=ae({key:"productListingState",default:Es});function jr(){const[t,s]=be(AP),[n,a]=i.useState(),r=A=>({...A,tracking_settings:{...A.tracking_settings,price_increased_threshold_percent:A.tracking_settings.price_increased_any?void 0:A.tracking_settings.price_increased_threshold_percent}}),o=A=>{if(A.auto_boost?.optimization_mode!=="configured")return{next:A,shouldSync:!1};const T=Fs[0]?.mockText??"",k=An[0]?.prompt??"",O={...A.auto_boost,optimization_mode:"user_prompt",title:A.auto_boost.title?{...A.auto_boost.title,user_prompt:A.auto_boost.title.is_enable&&!A.auto_boost.title.user_prompt?T:A.auto_boost.title.user_prompt}
2224:A.auto_boost.title,description:A.auto_boost.description?{...A.auto_boost.description,user_prompt:A.auto_boost.description.is_enable&&!A.auto_boost.description.user_prompt?T:A.auto_boost.description.user_prompt}:A.auto_boost.description,image:{...A.auto_boost.image,user_prompt:A.auto_boost.image.is_enable&&!A.auto_boost.image.user_prompt?k:A.auto_boost.image.user_prompt}};return{next:{...A,auto_boost:O},shouldSync:!0}},l=async()=>{const{status:A,data:E}=await Ta.getProductListingV2();if(A===Xt.OK&&E){const T={...E,auto_boost:{...E.auto_boost,title:{is_enable:E.auto_boost.title?.is_enable??!1,user_prompt:E.auto_boost.title?.user_prompt??""},prefix:{...Es.auto_boost.prefix,...E.auto_boost.prefix,value:E.auto_boost.prefix?.value??""},suffix:{...Es.auto_boost.suffix,...E.auto_boost.suffix,value:E.auto_boost.suffix?.value??""}},auto_split_variant_options:{...E.auto_split_variant_options,is_enable:E.auto_split_variant_options.is_enable??!0},selling_price:{...E.selling_price,include_shipping_cost:E.selling_price.include_shipping_cost??!1,assign:E.selling_price.assign??{assign_cents:"99",assign_compare_cents:"99"}}},{next:k,shouldSync:O}=o(T);s(k),a(k),O&&await Ta.putProductListingV2(r(k),void 0)}},c=(A,E)=>{s(T=>({...T,product_listings:{...T.product_listings,[A]:E}}))},u=(A,E)=>{s(T=>({...T,auto_split_variant_options:{...T.auto_split_variant_options,[A]:E}}))},d=(A,E)=>{s(T=>({...T,tracking_settings:{...T.tracking_settings,[A]:E}}))},g=(A,E)=>{s(T=>({...T,auto_boost:{...T.auto_boost,[A]:E}}))},h=(A,E)=>{s(T=>({...T,recommend_products:{...T.recommend_products,[A]:E}}))},p=(A,E)=>{s(T=>({...T,selling_price:{...T.selling_price,[A]:E}}))},x=A=>{s(E=>({...E,selling_price:{...E.selling_price,price_rules:A}}))};function f(){n&&s(n)}const _=()=>{n&&s(A=>({...A,auto_boost:Es.auto_boost}))},b=()=>{n&&s(A=>({...A,selling_price:n.selling_price}))};return{isChangeData:i.useMemo(()=>n?!q.isEqual(t,n):!1,[t,n]),productListing:t,productListingPrimitive:n,productTypeDefault:["related_to_listed_products","complements_of_listed_products","new_arrival_from_listed_suppliers"],contentBoostDefault:["title_and_description","seo_content","thumbnail_image"],formatSettingDefault:{language:"en",style:"highlight",tone:"persuasive",image_apply:["convert_to_webp","boost_resolution","cleanup_background","resize_ratio_1_1"]},roundingRuleDefault:{assign_cents:"99",assign_compare_cents:"99"},discardChanges:f,fetchProductListing:l,handleUpdatePricingValue:p,setProductListingPrimitive:a,handleUpdateAutoBoostValue:g,handleUpdateProductListingValue:c,handleUpdateTrackingSettingsValue:d,handleUpdateAutoSplitVariantValue:u,handleUpdateRecommendProductsValue:h,handleUpdatePricingRulesValue:x,resetAutoBoostToDefault:_,resetPricingToPrimitive:b}}const ro=null,SP=t=>{const s=i.useCallback(()=>{ge.localStorage.remove(t)},[t]),n=i.useCallback(r=>{ge.localStorage.set(t,JSON.stringify(r))},[t]);return{getData:i.useCallback(()=>{const r=ge.localStorage.get(t);if(!r)return ro;try{const o=JSON.parse(r),l=Date.now();let c=!1;const u=Object.keys(o).reduce((d,g)=>{const h=o[g];return h&&typeof h.expiredAt=="number"&&h.expiredAt>l&&(d[g]=h,c=!0),d},{});return c?(Object.keys(u).length!==Object.keys(o).length&&ge.localStorage.set(t,JSON.stringify(u)),u):(s(),ro)}catch{return s(),ro}},[s,t]),setData:n,removeData:s}};ae({key:"productEditorDrawerState",default:{isOpen:!1,productId:null}});const Yw=ae({key:"editorChangeImageVariantState",default:{visible:!1,imageSelected:"",variant_id:0,variant:null}}),zw=ae({key:"productEditorImageListState",default:[]});ae({key:"optimizingImageState",default:!1});const Kw=ae({key:"productEditorUploadingState",default:!1}),Qw=ae({key:"onSaveOrPushToStoreState",default:!1});ae({key:"duplicateProductState",default:{variants:[],type:"supplier",open:!1}});const jP=ae({key:"variantProductEditorState",default:[]}),qw=ae({key:"loadingLogisticsState",default:!1});ns({key:"isAllVariantStockZeroState",get:({get:t})=>t(jP).every(n=>n.quantity===0)});const Zw=ae({key:"refreshNewProductState",default:0}),Xw=ae({key:"productEditorPushSalesChannelState",default:{data:{},visible:!1}}),Jw=ae({key:"productEditorTitleEnhancePendingPackageIdState",default:null}),$w=ae({key:"productEditorDescriptionEnhancePendingPackageIdState",default:null}
2224),eN=ae({key:"productEditorSeoTitleEnhancePendingPackageIdState",default:null}),tN=ae({key:"AIWritingEditorState",default:{titlePos:0,titleReason:"",titleExplain:"",desPos:0,desReason:"",desExplain:"",seoPos:0,titleDescriptionList:{current:[],origin:[],generated:[]},titleList:{current:[],origin:[],generated:[]},seoTitlePos:0,seoTitleReason:"",seoTitleExplain:"",seoTitleList:{current:[],origin:[]},seoDescriptionPos:0,seoDescriptionReason:"",seoDescriptionExplain:"",seoDescriptionList:{current:[],origin:[]},thumbnailList:{current:[],origin:[],generated:[]},thumbnailPos:0,isApplySellingPrice:!1}}),sN=ae({key:"selectedProductEditorCompareAtPriceVariantState",default:!1}),nN=ae({key:"selectedVariantEditState",default:0}),aN=ae({key:"bannerErrorEditorState",default:{top:[],suppliers:[]}}),rN=ae({key:"mediaLocalOrFromUrlState",default:[]}),EP=ae({key:"aiWritingSettingsState",default:{isUpdateSetting:!1,ai_writing:{title_and_desc:!0,seo_meta:!0,language:"en",tone:F0[0].value,style:"all",emotional_hooks:[U0[0].value]}}}),TP=ae({key:"aiImageSettingsState",default:["cleanup_background","resize_ratio_1_1","boost_resolution","convert_to_webp"]}),iN=ae({key:"aiImageEnhanceSettingsState",default:"marketplace_optimized"}),oN=ae({key:"aiImageEnhanceFilterState",default:"clear"}),lN=ae({key:"variantOptionsListState",default:[]}),cN=ae({key:"currentOptionsState",default:[]}),dN=ae({key:"channelSettingSelectedState",default:{shopify:!1,woocommerce:!1,tiktok:!1,facebook:!1,google:!1}}),uN=ae({key:"shopifyChannelSelectedState",default:{}}),pN=ae({key:"shopifyStorePublicationsListState",default:[]}),hN=ae({key:"channelSettingEditorState",default:{shopify:{is_publish:!0,continueSelling:!0,syncStock:!0,collections:[],types:[],tags:[]},facebook:{is_publish:!0,continueSelling:!0},google:{is_publish:!0,continueSelling:!1},woocommerce:{is_publish:!0},tiktok:{is_publish:!0,warehouse_id:"",dimension:{weighType:"kilogram",dimensionUnit:"centimeter",weight:"1",height:"1",width:"1",length:"1"}}}}),Lh=ae({key:"collectionsChannelsState",default:[]}),gN=ae({key:"collectionsChannelsLoadingState",default:!1}),mN=ns({key:"collectionShopifyOptionsState",get:({get:t})=>{const s=t(Lh),n=[];return s.forEach(a=>{a.channel==="shopify"&&n.push({label:a.name,value:a.collection_id.toString()})}),n}});ns({key:"collectionWooOptionsState",get:({get:t})=>{const s=t(Lh),n=[];return s.forEach(a=>{a.channel==="woocommerce"&&n.push({label:a.name,value:a.collection_id.toString()})}),n}});const Ha=ae({key:"AILoadingState",default:{thumbnail:!1,content:!1,title:!1,seoContentTitle:!1,seoContentDescription:!1}}),fN=ns({key:"hasAILoadingState",get:({get:t})=>{const s=t(Ha);return s.thumbnail||s.content||s.seoContentTitle||s.seoContentDescription}}),xN=ns({key:"thumbnailAILoadingState",get:({get:t})=>t(Ha).thumbnail}),_N=ns({key:"contentAILoadingState",get:({get:t})=>t(Ha).content}),bN=ns({key:"titleAILoadingState",get:({get:t})=>t(Ha).title}),yN=ns({key:"seoContentTitleAILoadingState",get:({get:t})=>t(Ha).seoContentTitle}),CN=ns({key:"seoContentDescriptionAILoadingState",get:({get:t})=>t(Ha).seoContentDescription}),vN=ae({key:"productEditorTabPanelState",default:{isOpen:!1,currentTab:"media"}}),AN=ae({key:"productListingSectionState",default:""}),SN=ae({key:"productOrganizationState",default:{collections:[],loading:!1}}),jN=ae({key:"productSourceSupplierState",default:{data:null,loading:!1}}),EN=ae({key:"isReFetchAfterCloseDrawerState",default:!1});ae({key:"continueSellingWhenOutOfStock",default:!1});const TN=ae({key:"searchFilterStateV2",default:{queryValue:"",filters:{}}}),PN=ae({key:"variantEditDrawerState",default:{variantId:null,type:null}}),IN=ae({key:"currentOptionsStateV2",default:[]}),RN=ae({key:"openDrawerCostState",default:!1}),kN=ae({key:"featureKeyCenterState",default:[]}),je={ORDER_TYPE:":{type}",ORDER_ID:":{orderId}",CUSTOMER_ID:":{customer_id}",SOURCE_ID:":{source_id}",STAR_ID:":{star_id}",TRACKING_CODE:":{tracking_code}",ITEM_ID:":{itemId}"},He={GET_CHART_STATISTIC_TYPE:`orders/v10/${je.ORDER_TYPE}/statistics`,GET_COUNT_ORDER_BY_TYPE:`orders/v10/${je.ORDER_TYPE}
2224/count`,GET_ORDER_PARTIAL_ITEMS:"orders/v10/placement/need-fulfill",GET_ORDER_ITEMS_BY_ORDER_ID:`orders/v10/placement/${je.ORDER_TYPE}/${je.ORDER_ID}/items`,GET_CUSTOMER_BY_ORDER_ID:`orders/v10/placement/${je.ORDER_ID}/customers/${je.CUSTOMER_ID}/info`,GET_SHIPPING_BY_ORDER_ID:`orders/v10/placement/${je.ORDER_ID}/shipping`,GET_ORDER_ESTIMATE_BY_ORDER_ID:`orders/v10/placement/${je.ORDER_ID}/estimate`,GET_TRACKING_BY_ORDER_ID:`orders/v10/placement/${je.ORDER_ID}/trackings`,GET_RETURN_STATUS_BY_ORDER_ID:`orders/v10/placement/${je.ORDER_ID}/refunds`,POST_ZOPI_FULFILLMENT:"orders/v10/placement/request-order",POST_CONFIRM_CREATE:"orders/v11/placement/confirm-bulk-fulfillment",POST_UPDATE_MULTIPLE_SHIPPING:"orders/v10/placement/update-multiple-shipping-method",POST_REVIEW_ORDER:"orders/v11/placement/fetch-bulk-fulfillment",GET_PLACEMENT_ITEM:`orders/v10/placement/${je.ORDER_ID}`,POST_CANCEL_REFUNDED:`orders/v10/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/cancel-paid`,POST_REFUND_REFUNDED:`orders/v10/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/request-refund`,POST_FETCH_FULFILL_MANUALLY:"orders/v10/placement/fetch-manual-fulfillment",POST_CONFIRM_FULFILL_MANUALLY:"orders/v10/placement/manual-fulfillment",PUT_SYNC_ORDER_STATUS:`orders/v10/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/sync-status`,PUT_REVERT_ORDER:`orders/v10/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/revert-order`,GET_SUPPLIER_BY_ORDER_ID:`orders/v10/placement/${je.ORDER_ID}/suppliers`,PUT_STAR_ORDER:`orders/v10/placement/${je.ORDER_ID}/star/${je.STAR_ID}`,POST_SYNC_ORDER:"orders/v10/placement/sync-platform-order",POST_SEND_MESSAGE:`orders/v11/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/conversation/message`,GET_ORDER_FEEDBACK_HISTORY:`orders/v10/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/order-feedback`,GET_ORDER_ISSUE_MESSAGES_LIST:`orders/v11/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/conversation/messages`,GET_CARRIER_BY_TIKTOK:"/orders/v10/fulfillment/shipping/carriers",GET_ORDER_PARTIAL_ITEMS_PAYMENT:"orders/v10/placement/need-payment",PUT_SEEN_MESSAGE_ORDER_ID:`orders/v11/placement/${je.ORDER_ID}/sources/${je.SOURCE_ID}/conversation/seen`,GET_INSTANT_FULFILLMENT:"orders/v11/placement/instant-fulfillment",GET_COUNT_ORDER_PLACEMENT_V12:"orders/v12/placement/count",GET_SHIPPING_SUGGESTION_V12:`orders/v12/placement/${je.ORDER_ID}/shipping/suggestion`,POST_CONFIRM_CREATE_V12:"orders/v12/placement/confirm-bulk-fulfillment",POST_FETCH_MANUAL_FULFILLMENT_V12:"orders/v12/placement/manual-fulfillment/fetch",GET_ORDER_NO_VALIDATED:`/orders/v12/placement/manual-fulfillment/${je.ORDER_ID}/verify/${je.SOURCE_ID}`,POST_UPDATE_ORDER_NO_VALIDATED:"orders/v12/placement/manual-fulfillment/confirm",GET_TRACKING_FILE_TEMPLATE:"orders/v12/placement/manual-fulfillment/download-tracking-file-template",POST_UPLOAD_CSV_TEMPLATE:"orders/v12/placement/manual-fulfillment/upload-tracking-file",POST_EXPORT_FULFILLMENT_FILE:"orders/v12/placement/manual-fulfillment/export-tracking-file-template",POST_REVIEW_ORDER_V12:"orders/v12/placement/fetch-bulk-fulfillment",POST_REQUEST_FULFILLMENT:"orders/v12/placement/manual-fulfillment/track-request",POST_UPDATE_MANUAL_FILE_V13:"orders/v13/placement/manual-fulfillment/confirm-tracking-file",GET_ORDER_DETAIL_V13:`orders/v13/placement/${je.ORDER_ID}/detail`,POST_REVIEW_ORDER_V13:"orders/v13/placement/fetch-bulk-fulfillment",POST_UPLOAD_CSV_TEMPLATE_V13:"orders/v13/placement/manual-fulfillment/upload-tracking-file",GET_PLACEMENT_TABLE_V13:"orders/v13/placement/table",TABLE_FILTER_MANAGES:"orders/v13/placement/table-filter-manages",GET_PLACEMENT_ITEM_V13:`orders/v13/placement/${je.ORDER_ID}`,POST_CONFIRM_CREATE_V13:`/orders/v13/placement/${je.ORDER_ID}/place`,POST_CONFIRM_BULK_PLACE_V13:"/orders/v13/placement/confirm-bulk-fulfillment",POST_UPDATE_MANUAL_FULFILL:`/orders/v13/placement/${je.ORDER_ID}/manual-fulfill`,POST_MARK_ACTION_V13:"orders/v13/placement/mark-action"},PP=async({params:t,token:s,version:n})=>{const a=He.GET_PLACEMENT_TABLE_V13;return X(a,t,{method:"GET"},{cancelToken:s})},IP=async({params:t,token:s})=>X(q.replace(He.GET_CHART_STATISTIC_TYPE,je.ORDER_TYPE,t.type),q.pick(t,["from_date","to_date"]),{method:"GET"},{cancelToken:s}),RP=async({params:t,token:s})=>X(q.replace(He.GET_COUNT_ORDER_BY_TYPE,je.ORDER_TYPE,t.type),q.pick(t,["from_date","to_date"]),{method:"GET"},{cancelToken:s}),kP=async({params:t,token:s})=>X(He.GET_ORDER_PARTIAL_ITEMS,t,{method:"GET"},{cancelToken:s}),wP=async({params:t,token:s})=>X(He.GET_ORDER_PARTIAL_ITEMS_PAYMENT,t,{method:"GET"},{cancelToken:s}),NP=async({params:t,token:s})=>X(q.replace(q.replace(He.GET_ORDER_ITEMS_BY_ORDER_ID,je.ORDER_TYPE,t.tab),je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),OP=async({params:t,token:s})=>X(q.replace(q.replace(He.GET_CUSTOMER_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),je.CUSTOMER_ID,t.customerId.toString()),{},{method:"GET"},{cancelToken:s}),DP=async({params:t,token:s})=>X(q.replace(q.replace(He.GET_CUSTOMER_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),je.CUSTOMER_ID,t.customerId.toString()),{customer:t.customer},{method:"PUT"},{cancelToken:s}),LP=async({params:t,token:s})=>X(q.replace(He.GET_SHIPPING_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),MP=async({params:t,token:s})=>X(q.replace(He.GET_SHIPPING_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),{shipping_address:t.shipping,type:t.type??"normal"},{method:"PUT"},{cancelToken:s}),UP=async({params:t,token:s})=>X(q.replace(He.GET_ORDER_ESTIMATE_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),FP=async({params:t,token:s})=>X(q.replace(He.GET_TRACKING_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),BP=async({params:t,token:s})=>X(q.replace(He.GET_RETURN_STATUS_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),HP=(t,s)=>X(He.POST_ZOPI_FULFILLMENT,t,{method:"POST"},{cancelToken:s}
2224),GP=async(t,s)=>X(He.POST_CONFIRM_CREATE,t,{method:"POST"},{cancelToken:s}),WP=async({params:t,token:s})=>X(He.POST_UPDATE_MULTIPLE_SHIPPING,t,{method:"POST"},{cancelToken:s}),VP=async({ids:t,token:s})=>X(He.POST_REVIEW_ORDER,{ids:t},{method:"POST"},{cancelToken:s}),YP=async({params:t,token:s})=>X(q.replace(He.GET_PLACEMENT_ITEM,je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),zP=async({params:t,token:s})=>X(q.replace(q.replace(He.POST_CANCEL_REFUNDED,je.ORDER_ID,t.id.toString()),je.SOURCE_ID,t.order_no),{},{method:"POST"},{cancelToken:s}),KP=async({params:t,token:s})=>X(q.replace(q.replace(He.POST_REFUND_REFUNDED,je.ORDER_ID,t.order_id.toString()),je.SOURCE_ID,t.order_no),{request:{...q.omit(t,["order_id","order_no"])}},{method:"POST"},{cancelToken:s}),QP=async({params:t,token:s})=>X(He.POST_FETCH_FULFILL_MANUALLY,t,{method:"POST"},{cancelToken:s}),qP=async({params:t,token:s})=>X(He.POST_CONFIRM_FULFILL_MANUALLY,t,{method:"POST"},{cancelToken:s}),ZP=async({params:t,token:s})=>X(q.replace(q.replace(He.PUT_SYNC_ORDER_STATUS,je.ORDER_ID,t.orderId.toString()),je.SOURCE_ID,t.sourceId),{},{method:"PUT"},{cancelToken:s}),XP=async({params:t,token:s})=>X(q.replace(q.replace(He.PUT_REVERT_ORDER,je.ORDER_ID,t.orderId.toString()),je.SOURCE_ID,t.sourceId),{},{method:"PUT"},{cancelToken:s}),JP=async({params:t,token:s})=>X(q.replace(He.GET_SUPPLIER_BY_ORDER_ID,je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),$P=async({params:t,token:s})=>X(q.replace(q.replace(He.PUT_STAR_ORDER,je.ORDER_ID,t.orderId.toString()),je.STAR_ID,t.starId),{star:t.starId},{method:"PUT"},{cancelToken:s}),e3=async()=>X(He.POST_SYNC_ORDER,{},{method:"POST"}),t3=async({params:t,token:s})=>X(q.replace(q.replace(He.POST_SEND_MESSAGE,je.ORDER_ID,t.order_id.toString()),je.SOURCE_ID,t.source_id),{request:q.pick(t,["medias","message"])},{method:"POST"},{cancelToken:s}),s3=async({params:t,token:s})=>X(q.replace(q.replace(He.GET_ORDER_FEEDBACK_HISTORY,je.ORDER_ID,t.order_id.toString()),je.SOURCE_ID,t.source_id),{},{method:"GET"},{cancelToken:s}),n3=async({params:t,token:s})=>X(q.replace(q.replace(He.GET_ORDER_ISSUE_MESSAGES_LIST,je.ORDER_ID,t.order_id.toString()),je.SOURCE_ID,t.source_id),{},{method:"GET"},{cancelToken:s}),a3=async({token:t})=>X(He.GET_CARRIER_BY_TIKTOK,{},{method:"GET"},{cancelToken:t}),r3=async({params:t,token:s})=>X(q.replace(q.replace(He.PUT_SEEN_MESSAGE_ORDER_ID,je.ORDER_ID,t.orderId.toString()),je.SOURCE_ID,t.sourceId),{},{method:"POST"},{cancelToken:s}),i3=async({params:t,token:s})=>X(He.GET_INSTANT_FULFILLMENT,t,{method:"GET"},{cancelToken:s}),o3=async({params:t,token:s})=>X(He.GET_COUNT_ORDER_PLACEMENT_V12,q.pick(t,["from_date","to_date"]),{method:"GET"},{cancelToken:s}),l3=async({params:t,token:s})=>X(He.GET_SHIPPING_SUGGESTION_V12.replace(je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),c3=async(t,s)=>X(He.POST_CONFIRM_CREATE_V12,t,{method:"POST"},{cancelToken:s}),d3=async({params:t,token:s})=>X(He.POST_FETCH_MANUAL_FULFILLMENT_V12,t,{method:"POST"},{cancelToken:s}),u3=async({params:t,token:s})=>X(q.replace(q.replace(He.GET_ORDER_NO_VALIDATED,je.ORDER_ID,t.orderId.toString()),je.SOURCE_ID,t.sourceId),{},{method:"GET"},{cancelToken:s}),p3=async({params:t,token:s})=>X(He.POST_UPDATE_ORDER_NO_VALIDATED,{orders:t},{method:"POST"},{cancelToken:s}),h3=async({params:t,token:s})=>X(He.POST_MARK_ACTION_V13,t,{method:"POST"},{cancelToken:s}),g3=async({token:t})=>X(He.GET_TRACKING_FILE_TEMPLATE,{},{method:"GET"},{cancelToken:t}),m3=async({params:t,token:s})=>X(He.POST_UPLOAD_CSV_TEMPLATE,t.formData,{method:"POST"},{cancelToken:s}),f3=async({params:t,token:s})=>X(He.POST_UPLOAD_CSV_TEMPLATE_V13,t.formData,{method:"POST"},{cancelToken:s}),x3=async({params:t,token:s})=>X(He.POST_EXPORT_FULFILLMENT_FILE,{ids:t.ids},{method:"POST"},{cancelToken:s}),_3=async({params:t,token:s})=>X(He.POST_REVIEW_ORDER_V12,t,{method:"POST"},{cancelToken:s}),b3=async()=>X(He.POST_REQUEST_FULFILLMENT,{},{method:"POST"}),y3=async({params:t,token:s})=>X(He.POST_UPDATE_MANUAL_FILE_V13,{orders:t},{method:"POST"},{cancelToken:s}),C3=async({params:t,token:s})=>X(q.replace(He.GET_PLACEMENT_ITEM_V13,je.ORDER_ID,t.orderId.toString()),{},{method:"GET"},{cancelToken:s}),v3=async t=>{const s=He.GET_ORDER_DETAIL_V13.replace(`${je.ORDER_ID}`,t.toString());return X(s,{},{method:"GET"})},A3=async({params:t,token:s})=>X(He.POST_REVIEW_ORDER_V13,t,{method:"POST"},{cancelToken:s}),S3=async()=>X(He.TABLE_FILTER_MANAGES,{},{method:"GET"}),j3=async({params:t,method:s="POST",token:n})=>{const a=s==="POST"?He.TABLE_FILTER_MANAGES:`${He.TABLE_FILTER_MANAGES}/${t.filterId}`;return X(a,t,{method:s},{cancelToken:n})},E3=async({params:t,token:s})=>{const n=`${He.TABLE_FILTER_MANAGES}/${t.filterId}`;return X(n,{},{method:"DELETE"},{cancelToken:s})},T3=async(t,s)=>{const{orderId:n,...a}=t,r=He.POST_CONFIRM_CREATE_V13.replace(je.ORDER_ID,n.toString());return X(r,a,{method:"POST"},{cancelToken:s})},P3=async(t,s)=>{const n=He.POST_CONFIRM_BULK_PLACE_V13;return X(n,t,{method:"POST"},{cancelToken:s})},I3=async t=>{const{token:s,orderId:n,params:a}=t,r=He.POST_UPDATE_MANUAL_FULFILL.replace(je.ORDER_ID,n.toString());return X(r,a,{method:"POST"},{cancelToken:s})},Pu={getPlacementList:PP,getStatisticOrderByType:IP,getCountOrderByType:RP,getOrderPartialItems:kP,getOrderItems
2224ByOrderId:NP,getCustomerByOrderId:OP,getShippingByOrderId:LP,getOrderEstimateByOrderId:UP,getTrackingByOrderId:FP,putCustomerByOrderId:DP,putShippingByOrderId:MP,getReturnStatusByOrderId:BP,postZopiFulfillment:HP,postOrderConfirm:GP,postUpdateMultipleShipping:WP,postOrderPreview:VP,getPlacementItem:YP,postRefundRefunded:KP,postCancelRefunded:zP,postFetchFulfillManually:QP,putSyncOrderStatus:ZP,postConfirmFulfillManually:qP,putRevertOrder:XP,getSupplierByOrderId:JP,putStarOrder:$P,postSyncOrder:e3,postSendMessage:t3,getOrderFeedback:s3,getOrderIssueMessagesList:n3,getCarrierByTiktok:a3,getOrderPartialItemsPayment:wP,postSeenMessageOrderId:r3,getInstantFulfillment:i3,getCountOrderPlacementV12:o3,getShippingSuggestionV12:l3,postOrderConfirmV12:c3,postFetchManualFulfillmentV12:d3,getOrderNoValidated:u3,postUpdateOrderNoValidated:p3,postMarkAction:h3,getTrackingFileTemplate:g3,postUploadCsvTemplate:m3,postExportFulfillmentFile:x3,postOrderPreviewV12:_3,postRequestFulfillment:b3,postOrderPreviewV13:A3,getOrderDetailV13:v3,postUploadCsvTemplateV13:f3,getListFilterTableOrder:S3,createOrUpdateFilterTableOrder:j3,deleteFilterTableOrder:E3,getPlacementItemV13:C3,postOrderConfirmV13:T3,postBulkPlaceOrderConfirmV13:P3,postUpdateManualFulfill:I3,postUpdateManualFulfillFileV13:y3};Te.VIEW_SETTING_NOTIFICATIONS_RESTOCKED_BY_SUPPLIER,Te.VIEW_SETTING_NOTIFICATIONS_VARIANT_CHANGED_BY_SUPPLIER,Te.VIEW_SETTING_NOTIFICATIONS_SUPPLIER_INCREASES_PRICE,Te.VIEW_SETTING_NOTIFICATIONS_NEW_PRODUCTS_FROM_FOLLOWED_SUPPLIERS,Te.VIEW_SETTING_NOTIFICATIONS_YOU_HAVE_NEW_ORDER;Y.PRODUCT_EDITOR_PAGE.PATH,Y.PRODUCT_EDITOR_PAGE.PATH,Y.PRODUCT_EDITOR_PAGE.PATH,Y.PRODUCT_EDITOR_PAGE.PATH,Y.PRODUCT_EDITOR_PAGE.PATH,Y.PRODUCT_EDITOR_PAGE.PATH,Y.PRODUCT_CENTER.PATH+"",Y.FIND_PRODUCT.SUBROUTES.FAVORITE_SUPPLIER.PATH+"",Y.ORDER_LIST.PATH+"",Y.ORDER_LIST.PATH,Y.ORDER_LIST.PATH+"",Y.ORDER_LIST.PATH+"",Y.ORDER_LIST.PATH+"",Y.ORDER_LIST.PATH+"",Y.ORDER_LIST.PATH+"",Y.ORDER_LIST.PATH+"",Y.PRODUCT_EDITOR_PAGE.PATH;const wn={methods:{in_app:{enable:!0},webpush:{enable:!0},email:{enable:!0,email_address:"",send_email_behavior:{when:"immediate"},group_mail:{enable:!0,cycle:24},extra_content:["product_update","mkt_news","discount_promotion"]}},items:{accounts:{account_running_out_of_credits:{in_app:!0,webpush:!0,email:!0}},supplier:{issue_product_unavailable:{in_app:!0,webpush:!0,email:!0},issue_product_has_stock_issue:{in_app:!0,webpush:!0,email:!0},issue_product_has_price_issue:{in_app:!0,webpush:!0,email:!0},auto_boost_product_listing:{in_app:!0,webpush:!0,email:!0}},orders:{order_payment_timeout:{in_app:!0,webpush:!0,email:!0},order_fulfillment_rejected:{in_app:!0,webpush:!0,email:!0},order_shipment_failed:{in_app:!0,webpush:!0,email:!0},order_new_order_conversation:{in_app:!0,webpush:!0,email:!0}}}},R3=[{label:"AlwaysSendNotificationsAtAllTimes",value:"immediate"},{label:"OnlyWhenInactiveSendOnlyWhenYoureNotActiveInTheApp",value:"only_inactive"}],k3=[{label:"DontGroupMailSendEachEventAsAnIndividualEmail",value:"false"},{label:"GroupAllEventsOfTheSameItemTypeAndSendOneEmail",value:"true"}],w3=[{label:"EveryNHour",value:"4"},{label:"EveryNHour",value:"8"},{label:"EveryNHour",value:"24"}],Iu=[{value:"product_update",label:"ProductUpdates",description:"StayInformedAboutNewFeaturesImprovementsAndImportantChangesToThePlatform"},{value:"mkt_news",label:"MarketingNews",description:"GetTheLatestNewsTrendsAndInsightsAboutEcommerceGrowthStrategiesAndOurBrand"},{value:"discount_promotion",label:"DiscountPromotion",description:"ReceiveExclusiveOffersSeasonalDealsAndLimitedtimePromotionsDesignedToBoostYourSavings"}],N3=[{icon:bl,key:"accounts",label:"Account"},{key:"account_running_out_of_credits",label:"OutOfUsageLessThan10",section:"accounts"},{icon:Ip,key:"supplier",label:"Supplier"},{key:"issue_product_unavailable",label:"ProductIsUnavailable",section:"supplier"},{key:"issue_product_has_stock_issue",label:"ProductHasStockIssue",section:"supplier"},{key:"issue_product_has_price_issue",label:"ProductHasPriceIssue",section:"supplier"},{icon:is,key:"orders",label:"Orders"},{key:"order_payment_timeout",label:"PaymentIsTimeout",section:"orders"},{key:"order_fulfillment_rejected",label:"FulfillmentIsRejected",section:"orders"},{key:"order_shipment_failed",label:"ShipmentIsFailed",section:"orders"},{key:"order_new_order_conversation",label:"NewOrderConversation",section:"orders"}],O3=t=>{const{isMobile:s}=xe(),{notificationItems:n,onChangeItem:a}=t,{t:r}=J(),o=(l,c,u,d)=>{a(q.set(q.cloneDeep(n),[l,c,u],d))};return e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"h3",variant:"headingSm",children:r("NotificationItems")}),e.jsx(nt,{roundedAbove:"xs",padding:"0",children:e.jsx(Nt,{itemCount:1,selectable:!1,headings:s?[{title:r("Item")},{title:r("InApp"),alignment:"center"},{title:r("Email"),alignment:"center"}]:[{title:r("Item")},{title:r("InApp"),alignment:"center"},{title:r("Email"),alignment:"center"},{title:r("WebPush"),alignment:"center"}],children:N3.map((l,c)=>e.jsx(Oe.Fragment,{children:l.section?e.jsxs(Nt.Row,{id:l.key,position:c,children:[e.jsx(Nt.Cell,{children:e.jsx("div",{className:"max-md:w-40 max-md:whitespace-break-spaces",children:r(l.label)})}),e.jsx(Nt.Cell,{children:e.jsx("div",{className:"text-center min-w-[100px]",children:e.jsx(Sn,{label:"Checkbox",labelHidden:!0,checked:n?.[l.section]?.[l.key]?.in_app||!1,onChange:u=>o(l.section,l.key,"in_app",u)}
2224)})}),e.jsx(Nt.Cell,{children:e.jsx("div",{className:"text-center min-w-[100px]",children:e.jsx(Sn,{label:"Checkbox",labelHidden:!0,checked:n?.[l.section]?.[l.key]?.email||!1,onChange:u=>o(l.section,l.key,"email",u)})})}),!s&&e.jsx(Nt.Cell,{children:e.jsx("div",{className:"text-center min-w-[100px]",children:e.jsx(Sn,{label:"Checkbox",labelHidden:!0,checked:n?.[l.section]?.[l.key]?.webpush||!1,onChange:u=>o(l.section,l.key,"webpush",u)})})})]},l.key):e.jsxs(Nt.Row,{id:l.key,position:c,children:[e.jsx(Nt.Cell,{className:"bg-bg-surface-hover!",children:e.jsxs("div",{className:"flex items-center gap-1 justify-start",children:[e.jsx("div",{children:e.jsx(ee,{source:l.icon})}),e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"medium",children:r(l.label)})]})}),e.jsx(Nt.Cell,{className:"bg-bg-surface-hover!"}),e.jsx(Nt.Cell,{className:"bg-bg-surface-hover!"}),!s&&e.jsx(Nt.Cell,{className:"bg-bg-surface-hover!"})]},l.key)},l.key))})})]})},D3=t=>{const{loading:s,notificationMethod:n,onChange:a,errorEmail:r,onChangeErrorEmail:o}=t,{t:l}=J(),c=de(),[u,d]=i.useState(""),[g,h]=i.useState(!1),[p,x]=i.useState(!1),f=i.useRef(null),_=c.getUserInfo(),{isMobile:b}=xe(),v=i.useMemo(()=>{if(n.email.extra_content.length===0)return l("NoContentSelected");const A=new Set(n.email.extra_content);return Iu.filter(T=>A.has(T.value)).map(T=>l(T.label)).join(", ")},[n.email.extra_content]),y=()=>{const A=Qa.Notifications.permissionNative;A!=="granted"&&(A==="default"&&Qa.Notifications.requestPermission().then(E=>{E&&_.id&&(Qa.login(_.id.toString()),h(!0)),E||x(!0)}),A==="denied"&&x(!0))},C=(A,E)=>{a({...n,[E]:{...n[E],enable:A}})},S=A=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{a({...n,email:{...n.email,email_address:A}})},400)},j=A=>{let E="";A?B0(A)||(E="PleaseEnterEmailInCorrectFormat"):E="ThisFieldIsRequired",o(E)};return i.useEffect(()=>{const A=btoa(_.id+"_"+_.email);let E=ge.localStorage.get(st.FIST_TIME_SETTING_NOTIFICATION);(!E||typeof E!="string")&&(E=""),E.includes(A)||ge.localStorage.set(st.FIST_TIME_SETTING_NOTIFICATION,E+A+",")},[_.id]),i.useEffect(()=>{d(n.email.email_address)},[n.email.email_address]),i.useEffect(()=>{h(Qa.User.PushSubscription.optedIn||!1)},[]),e.jsxs(e.Fragment,{children:[p&&e.jsx("div",{className:"mb-4",children:e.jsx(kt,{tone:"info",title:l("YourDeviceIsDisableWebPushNotification"),onDismiss:()=>{x(!1)},children:l("YouveBlockedNotificationsForThisSitePleaseEnableThemInYourBrowserSettingsToContinue")})}),e.jsxs(D,{gap:"400",children:[e.jsx(nt,{roundedAbove:"xs",padding:"300",children:e.jsxs(U,{align:"space-between",children:[e.jsx(U,{gap:"100",blockAlign:"center",children:e.jsxs("div",{className:"flex gap-3 items-center",children:[s?e.jsx(Se,{width:32,height:20}):e.jsx(Jn,{checked:n.in_app.enable,onChange:A=>C(A,"in_app")}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:l("InappNotification")})]})}),e.jsx("div",{className:"min-h-7 flex items-center",children:n.in_app.enable?e.jsx(wt,{tone:"success",children:l("Active")}):e.jsx(wt,{children:l("Inactive")})})]})}),!b&&e.jsx(nt,{roundedAbove:"xs",padding:"300",children:e.jsxs(U,{align:"space-between",children:[e.jsx(U,{gap:"100",blockAlign:"center",children:e.jsxs("div",{className:"flex gap-3 items-center",children:[s?e.jsx(Se,{width:32,height:20}):e.jsx(Et,{active:g?!1:void 0,content:g?"":l("PleaseOptInToContinue"),children:e.jsx(Jn,{disabled:!g,checked:g?n.webpush.enable:!1,onChange:A=>C(A,"webpush")})}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:l("WebPushMessage")})]})}),e.jsx("div",{className:"flex gap-3 items-center flex-wrap min-h-7",children:g?e.jsx(wt,{tone:"success",children:"Opted-in"}):e.jsxs(e.Fragment,{children:[e.jsx(wt,{icon:Na,children:l("PermissionRequired")}),e.jsx(re,{size:"micro",onClick:y,children:"Opt-in"})]})})]})}),e.jsx(nt,{roundedAbove:"xs",padding:"300",children:e.jsxs(U,{align:"space-between",children:[e.jsx(U,{gap:"100",blockAlign:"center",children:e.jsxs("div",{className:"flex gap-3 items-center",children:[s?e.jsx(Se,{width:32,height:20}):e.jsx(Jn,{className:"ml-auto",checked:n.email.enable,onChange:A=>C(A,"email")}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:l("EmailTo")})]})}),e.jsx(gt,{size:"slim",prefix:e.jsx(ee,{source:tm}),autoComplete:"email",placeholder:"Input email",label:"Email",labelHidden:!0,type:"email",disabled:!n.email.enable,value:u,error:n.email.enable&&l(r),onChange:A=>{d(A),S(A),j(A)}})]})}),e.jsx(m,{as:"span",variant:"headingSm",children:l("NotificationBehavior")}),e.jsx(nt,{roundedAbove:"xs",children:e.jsxs(D,{gap:"300",children:[e.jsx(Yr,{titleMobile:l("SendingBehavior"),label:l("SendingBehavior"),options:R3.map(A=>({...A,label:l(A.label)})),value:n.email.send_email_behavior.when,classes:{content:"w-[var(--ms-active-with)]"},disabled:!n.email.enable,onChange:A=>a(q.set(q.cloneDeep(n),["email","send_email_behavior","when"],A))}),e.jsxs("div",{className:"flex gap-3 max-md:flex-wrap",children:[e.jsx("div",{className:"grow grid grid-cols-1",children:e.jsx(Yr,{titleMobile:l("GroupMailsTogether"),label:l("GroupMailsTogether"),options:k3.map(A=>({...A,label:l(A.label)})),value:n.email.group_mail.enable===!0?"true":"false",classes:{content:"w-[var(--ms-active-with)]"},disabled:!n.email.enable,onChange:A=>a(q.set(q.cloneDeep(n),["email","group_mail","enable"],A==="true"))})}),n.email.group_mail.enable===!0&&e.jsx("div",{className:"shrink-0 max-md:w-full",children:e.jsx(Yr,{label:"Cycle",options:w3.map(A=>({...A,label:l(A.label,A.label==="EveryNHour"?{hour:A.value}:void 0)})),value:n.email.group_mail.cycle.toString(),classes:{content:"w-[var(--ms-active-with)]",active:"min-w-[160px]"},disabled:!n.email.enable,onChange:A=>a(q.set(q.cloneDeep(n),["email","group_mail","cycle"],Number(A)))})})]}),e.jsx(Yr,{titleMobile:l("ExtraContent"),label:l("ExtraContent"),showValue:e.jsx(m,{as:"p",truncate:!0,children:v}),disabled:!n.email.enable,content:({toggleActive:A})=>e.jsx("div",{className:"w-[var(--ms-active-with)]",children:e.jsx(Yp,{onChange:E=>a(q.set(q.cloneDeep(n),["email","extra_content"],E)),options:Iu.map(E=>
2224({value:E.value,label:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(m,{as:"p",variant:"bodyMd",children:l(E.label)}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:l(E.description)})]})})),selected:n.email.extra_content,allowMultiple:!0})})})]})})]})]})};let Qn=null;const L3=()=>{const{data:t,isPending:s,refetch:n}=ks({queryKey:vt.settings.notificationSetting(),queryFn:async()=>{const a=await Fn.getNotificationSettings();return a.status===fe.OK&&a.data?a.data:null}});return{data:t,isPending:s,refetch:n}},M3=()=>{const{isMobile:t}=xe(),[s,n]=be(lh),{t:a}=J(),r=bt(),o=he(ur),{shake:l}=Fa(),[c,u]=i.useState(""),[d,g]=i.useState(!1),[h,p]=i.useState(wn.items),[x,f]=i.useState(wn.methods),{data:_,isPending:b,refetch:v}=L3(),y=!q.isEqual(x,Qn?.notificationMethod),C=x?.email?.enable&&!x?.email?.email_address,S=x?.email?.enable&&!!x?.email?.email_address&&!!c,j=!b&&Qn&&(!q.isEqual(h,Qn?.notificationItems)||y),A=()=>{if(j){l();return}n(!1)},E=()=>{p(Qn?.notificationItems||wn.items),f(Qn?.notificationMethod||wn.methods),u("")},T=async()=>{if(C||S){r.error(a("PleaseEnterEmailInCorrectFormat"));return}g(!0),(await Fn.postNotificationSettings({setting:{items:h,method:x}})).status===fe.OK?(r.success(a("ZopiNotificationSettingsSavedSuccessfully")),v()):r.error(a("ZopiNotificationSettingsSavedFailed")),g(!1)};i.useEffect(()=>{b||(_?(Qn={notificationMethod:_.setting.method,notificationItems:_.setting.items},p(_.setting.items),f(_.setting.method)):(Qn={notificationMethod:wn.methods,notificationItems:wn.items},p(wn.items),f(wn.methods)))},[_,b]),i.useEffect(()=>{o({showSaveBar:!0,isChanged:!!j})},[j,o]);const k=e.jsxs(D,{gap:"400",children:[!b&&j&&e.jsx(Wp,{message:a("UnsavedChanges"),saveAction:{onAction:T,loading:d,disabled:C||S,content:a("Save")},discardAction:{disabled:d,onAction:E,content:a("Discard")}}),e.jsx(D3,{loading:b,notificationMethod:x,errorEmail:c,onChangeErrorEmail:u,onChange:O=>f(O)}),e.jsx(O3,{notificationItems:h,onChangeItem:p})]});return t?e.jsx(xt,{visible:s,onClose:A,zIndex:176,showCloseIcon:!0,isButtonFullWidth:!0,title:a("NotificationSetting"),primaryAction:{content:a("Save"),size:"large",loading:d,disabled:!j||C||S,onAction:T},secondaryAction:{content:a("Close"),size:"large",onAction:A},children:e.jsx("div",{className:"p-4",children:k})}):e.jsxs(Is,{width:630,onClose:A,visible:s,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-4 box-shadow-[var(--p-shadow-200)]",children:e.jsx(us,{title:a("NotificationSetting"),backAction:{onAction:A}})}),e.jsx("div",{className:"p-4",children:k})]})};function U3(){const[t,s]=be(hp),{fetchListShopByAccount:n}=dt(),a=r=>{const o=r.data;o?.type==="CONNECT_STORE"&&(s({type:"CONNECT_STORE",data:o.payload}),setTimeout(()=>{s(void 0)},2e3))};return i.useEffect(()=>{t?.type==="CONNECT_STORE"&&(t.data?.shop_id?n():window.forceReload!==!1&&window.location.reload())},[t]),i.useEffect(()=>(window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}),[]),null}const F3=ae({key:"configGuidelinesState",default:{loading:!0,dismiss:!1,isDone:!1,stepActiveKey:Nn.FIND_AND_IMPORT,step:{[Nn.CHOOSE_A_PLAN]:!0,[Nn.FIND_AND_IMPORT]:!1,[Nn.PUSH_PRODUCT]:!1,[Nn.PLACE_ORDER]:!1,[Nn.FIND_READY_ORDER]:!1,[Nn.NAVIGATE_TO_ORDER_CENTER]:!1}}}),B3=ae({key:"openDrawerConfigProductListingState",default:!1}),H3=["PRODUCT_LISTING","PRODUCT_IMPORT","AI_IMAGE_GENERATION","ORDER_FULFILLMENT","SETTING_UPDATE_PRODUCT_AVAILABLE","AUTO_LISTING_ADVANCED","SETTING_UPDATE_VARIANT_AVAILABLE","SETTING_UPDATE_STOCK","SETTING_UPDATE_PRICE","SETTING_UPDATE_PRICE_RANGE","PH_ADS","PH_BASIC_PRODUCT_INSIGHT","PH_IDEA_DISCOVERY"],Aa=t=>{const{featureKey:s,classNames:n="",typeView:a="banner",isDefaultShowBanner:r=!1,hideDismiss:o,tracking:l,onClose:c,onClickUpgradeClose:u,goToUpgradePlan:d}=t,g=t.hiddenTitle||a==="card",{t:h}=J();pt();const{isMobile:p}=xe(),x=Pt(),{getCurrentPlan:f,getPricingPlan:_,getCurrentPlanOfFeature:b}
2224=de(),v=he(In),y=he(Gn),[C,S]=i.useState(null),j=f(),A=_()?.CREDIT||[],E=b(s),T=Fe(E?.limit||0),[k,O]=i.useState(!1),R=j?.package?.modules?.[0]?.key==="ENTERPRISE_CREDIT_TIER",P={SETTING_UPDATE_STOCK:"Auto-handle stock & price change",BULK_UPDATE_STOCK_PRICE:"Bulk selling price update",ADD_PRICING_RULE:"Multiple pricing rules",AI_AUTO_BOOST_PRODUCT_CONTENT:"Auto-boost content",AI_AUTO_BOOST_PRODUCT_THUMB:"Auto-boost thumbnail image",AI_AUTO_BOOST_PRODUCT_SEO:"Auto-boost SEO content",MULTI_PRICING_RULE:"Multiple pricing rules",SETTING_UPDATE_VARIANT_AVAILABLE:"Auto handle unavailable product/ variant",AI_PRODUCT_CONTENT:"AI product content",PRODUCT_EDIT_SEO:"Edit SEO content",AI_PRODUCT_SEO:"AI product SEO",PRODUCT_EDIT_IMAGE:"Edit product image",AI_IMAGE_THUMB_BASIC:"AI thumbnail image",AI_IMAGE_THUMB_FORMAT:"Extra style options",PRODUCT_SPLIT_BASIC:"Split product by variant",PRODUCT_SPLIT_ADVANCED:"Split product by option",BULK_ORDER_FULFILLMENT:"Bulk fulfillment",ORDER_TRACKING:"Tracking shipment status",BULK_ORDER_FULFILLMENT_FILE:"Bulk input order number ",AUTO_ORDER_FULFILLMENT:"Fulfill pending orders",ORDER_RECREATE:"Re-order items",AI_ORDER_CORRECT:"Quick apply the AutoCorrect",BULK_LISTING_FILE:"Add products from CSV",BULK_PRODUCT_UPDATE_PRICE:"Extra usage",PRODUCT_CATALOG_INSPIRED:"Viewing more Inspired ideas requires"},w=H3.includes(s),N=w?`Unable to ${P[s]}`:`Unable to access ${P[s]}`,K=()=>{requestAnimationFrame(()=>{if(u&&u(),d){y(!0);return}v({keyFeature:s,isFullPlan:!1,total_used:0,feature_used:"",locationShowUpgrade:l?.positionKey||""}),Ke.trackingEventUsersAction({event_name:$.PERMISSION_BLOCK_CLICKED,event_data:{feature_name:s,page:l?.positionKey||""}})})},L=()=>{requestAnimationFrame(()=>{x.openChat()})};i.useEffect(()=>{if(A.length>0&&j.account_id){const Z=A.find(B=>B.id==j?.package?.modules?.[0]?.id),te=Z?.key||"";let ne="";te==="GROWTH_CREDIT_TIER"?ne="PRO_CREDIT_TIER":te==="PRO_CREDIT_TIER"||te==="ENTERPRISE_CREDIT_TIER"?ne="ENTERPRISE_CREDIT_TIER":ne="GROWTH_CREDIT_TIER";const le=A.find(B=>B.key==ne);Z&&le&&S(le)}},[j,A]),i.useEffect(()=>{O(!!s)},[s]),i.useEffect(()=>{s&&Ke.trackingEventUsersAction({event_name:$.PERMISSION_BLOCK_VIEWED,event_data:{feature_name:s,page:l?.positionKey||""}})},[s,l?.positionKey]);const W=()=>e.jsxs(e.Fragment,{children:[R?e.jsxs(m,{as:"span",children:["Youâve exceeded your current planâs quota limit of ",T,"."," ",e.jsx("span",{className:"underline cursor-pointer",onClick:L,children:h("ContactSupport")})," ","to continue using ",P[s],"."]}):e.jsx(e.Fragment,{children:w?e.jsxs(m,{as:"span",children:["Higher plan needed."," ",e.jsx("span",{className:"underline cursor-pointer",onClick:K,children:h("Upgrade")})]}):e.jsxs(m,{as:"span",children:[P[s]," requires a higher plan."," ",e.jsx("span",{className:"cursor-pointer underline whitespace-nowrap",onClick:K,children:"Upgrade to unlock"})]})})," "]}),H=()=>e.jsx(e.Fragment,{children:R?e.jsxs(e.Fragment,{children:[e.jsxs(m,{as:"span",children:["Youâve exceeded your current planâs quota limit of ",T,". Contact support to continue using"," ",P[s],"."]}),e.jsx("div",{className:"mt-2",children:e.jsx(re,{fullWidth:p,size:p?"large":"medium",onClick:L,children:h("ContactSupport")})})]}):e.jsxs(e.Fragment,{children:[w?e.jsxs(m,{as:"span",children:["Youâve exceeded your current planâs quota limit of ",T,"."," ",e.jsx("span",{className:"underline cursor-pointer",onClick:K,children:h("Upgrade")})," ","to ",e.jsx("b",{children:C?.name||""})," or higher to continue using ",P[s],"."]}):e.jsxs(m,{as:"span",children:[P[s]," is not available on your current plan."," ",e.jsx("span",{children:h("Upgrade")})," to ",e.jsx("b",{children:C?.name||""})," or higher to unlock."]}),e.jsx("div",{className:"mt-2",children:e.jsx(re,{fullWidth:p,size:p?"large":"medium",onClick:K,children:h("Upgrade")})})]})});return e.jsx(sm,{open:k||r,id:"id-banner-upgrade",transition:{duration:"300ms",timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx("div",{className:n,children:p?e.jsx(kt,{tone:"warning",onDismiss:o?void 0:()=>{requestAnimationFrame(()=>{O(!1),c&&c()})},children:a==="card"?e.jsx(e.Fragment,{children:W()}):e.jsxs("div",{children:[!g&&e.jsx("div",{className:"mb-2",children:e.jsx(m,{variant:"headingMd",as:"span",children:N})}),H()]})}):e.jsx(kt,{title:g?"":N,tone:"warning",onDismiss:o?void 0:()=>{requestAnimationFrame(()=>{O(!1),c&&c()})},children:a==="card"?e.jsx(e.Fragment,{children:e.jsx(e.Fragment,{children:W()})}):e.jsx(e.Fragment,{children:H()})})})})},io=[{label:"TotalCost",description:"IncludeShippingCost",value:"total_cost",info:"CombineProductCostAndShippingFeeToFormATotalCostThenApplyYourPricingRule"},{label:"ProductCostOnly",description:"ExcludeShippingCost",value:"product_cost",info:"ApplyYourPricingRuleOnTheProductCostOnly"}],G3=i.forwardRef(({onApplyPricingRuleForProducts:t,loading:s,layoutForDrawer:n=!1,onHasInputErrorsChange:a},r)=>{const{t:o}=J(),l=dt(),c=de(),{isMobile:u}=xe();c.isPlanFree();const d=mi(l.getCurrency()),{productListing:g,handleUpdatePricingValue:h}=jr(),p=g.selling_price.price_rules||[],{isDefaultShowBannerUpgrade:x,onUp
2224dateDefaultShowBannerUpgrade:f}=c,[_,b]=i.useState(""),[v,y]=i.useState(""),{limit:C,usage:S}=c.getCurrentPlanOfFeature("BULK_PRODUCT_UPDATE_PRICE"),[j,A]=i.useState(!1),[E,T]=i.useState(null),[k,O]=i.useState({});he(In);const R=I=>{const F=I.trim();if(F==="")return o("PleaseEnterAValidNumber");if(F==="."||/^\d+\.$/.test(F))return"";const G=Number(F);return Number.isNaN(G)||!/^-?\d+(\.\d+)?$/.test(F)?o("PleaseEnterAValidNumber"):""},P=(I,F)=>{const G=R(F);O(z=>{if(!G){const{[I]:me,...Re}=z;return Re}return{...z,[I]:G}})},w=()=>{const I={},{assign:F}=g.selling_price,G=R(String(F.assign_cents??""));G&&(I.assign_cents=G);const z=R(String(F.assign_compare_cents??""));return z&&(I.assign_compare_cents=z),p.forEach((me,Re)=>{const Be=R(String(me.selling_price.value??""));Be&&(I[`rule-${Re}-selling`]=Be);const De=R(String(me.compare_at_price?.value??""));De&&(I[`rule-${Re}-compare`]=De)}),O(I),Object.keys(I).length===0},N=()=>O({}),K=Object.keys(k).length>0;i.useEffect(()=>{a?.(K)},[K,a]);const L=(I,F,G)=>{const z=[...p],me=z[F];z[F]={...me,selling_price:{...me.selling_price,[I]:G}},h("price_rules",z),I==="value"&&P(`rule-${F}-selling`,String(G))},W=(I,F,G)=>{const z=[...p],me=z[F];z[F]={...me,[I]:G},h("price_rules",z)},H=(I,F,G)=>{const z=[...p],me=z[F];me.compare_at_price&&(z[F]={...me,compare_at_price:{...me.compare_at_price,[I]:G}},h("price_rules",z),I==="value"&&P(`rule-${F}-compare`,String(G)))},Z=(I,F)=>{h("assign",{...g.selling_price.assign,[I]:F}),P(I,F)},te=()=>{if(!c.checkPermissionFeature("MULTI_PRICING_RULE")){f("MULTI_PRICING_RULE"),b("MULTI_PRICING_RULE");return}requestAnimationFrame(()=>{let I,F;const G=[...p];G.length===1?(I=0,F=10):G[G.length-2].to?(I=Math.round((+(G[G.length-2].to||0)+.01)*100)/100,F=Math.round(+(G[G.length-2].to||0)*100)/100*2):(I=0,F=0);const z={type:"rank",from:I,to:F,selling_price:{operator:"x",value:2},compare_at_price:{operator:"x",value:3}};G.splice(G.length-1,0,z),h("price_rules",G)})},ne=()=>{if(w()){if(!c.checkCurrentPlanOfQuota("BULK_PRODUCT_UPDATE_PRICE")){f("BULK_PRODUCT_UPDATE_PRICE"),y("BULK_PRODUCT_UPDATE_PRICE");return}t()}},le=I=>{requestAnimationFrame(()=>{const F=[...p];F.splice(I,1),h("price_rules",F)})},B=I=>{I==="MULTI_PRICING_RULE"?b("MULTI_PRICING_RULE"):I==="BULK_PRODUCT_UPDATE_PRICE"&&y("BULK_PRODUCT_UPDATE_PRICE")};i.useEffect(()=>{x("MULTI_PRICING_RULE")&&b("MULTI_PRICING_RULE"),x("BULK_PRODUCT_UPDATE_PRICE")&&y("BULK_PRODUCT_UPDATE_PRICE")},[]),i.useEffect(()=>{H0.product_setting.forEach(I=>{c.checkPermissionFeature(I)&&c.onRemoveDefaultShowBannerUpgrade(I)})},[]),i.useImperativeHandle(r,()=>({onFeatureName(I){B(I)},onResetFeatureName(I){I.forEach(F=>{F==="MULTI_PRICING_RULE"?b(""):F==="BULK_PRODUCT_UPDATE_PRICE"&&y("")})},validateAllNumericFields:w,clearInputErrors:N}));const ie=()=>{const I=io.find(F=>(g.selling_price.include_shipping_cost?"total_cost":"product_cost")===F.value);return e.jsx(kt,{children:o(I?.info||"")})},V=()=>{const I=io.find(F=>(g.selling_price.include_shipping_cost?"total_cost":"product_cost")===F.value);return e.jsx(Np,{active:j,activator:e.jsxs("div",{onClick:()=>A(F=>!F),className:"px-3 py-1.5 w-[312px] flex items-center border bg-bg-surface border-input-border rounded-lg gap-1 cursor-pointer",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(m,{as:"p",variant:"bodyMd",fontWeight:"bold",children:[o(I?.label||"")," ",e.jsxs("span",{className:"font-medium",children:["(",o(I?.description||""),")"]})]})}),e.jsx(ds,{source:mr})]}),onClose:()=>A(!1),children:e.jsx("div",{className:"p-3 grid gap-2",children:io.map(F=>{const G=(g.selling_price.include_shipping_cost?"total_cost":"product_cost")===F.value;return e.jsx("div",{onClick:()=>h("include_shipping_cost",F.value==="total_cost"),className:oe("flex items-center cursor-pointer p-2 rounded-xl hover:bg-bg-surface-selected",G&&"bg-bg-surface-selected"),children:e.jsxs("div",{children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"bold",children:o(F?.label||"")}),e.jsx(m,{as:"p",variant:"bodyMd",children:o(F?.description||"")})]})},F.value)})})})},M=()=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ds,{source:fl}),e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"medium",tone:"subdued",children:o("AssignCentsToSellingPrice")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3.5",children:[e.jsx(gt,{label:o("SellingPriceRounding"),labelHidden:!0,autoComplete:"off",prefix:"Selling price: xxx.",value:g.selling_price.assign.assign_cents,onChange:I=>Z("assign_cents",I),error:k.assign_cents||""}),e.jsx(gt,{label:o("CompareAtPriceRounding"),labelHidden:!0,autoComplete:"off",prefix:"Compare at price: xxx.",value:g.selling_price.assign.assign_compare_cents,onChange:I=>Z("assign_compare_cents",I),error:k.assign_compare_cents||""})]})]});return u?e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"px-3 py-3 rounded-xl border border-border bg-bg-surface",children:e.jsx(Sn,{label:o("IncludeShippingCost"),checked:g.selling_price.include_shipping_cost,onChange:I=>h("include_shipping_cost",I)})}),e.jsx("div",{className:"grid gap-2",children:p.map((I,F)=>e.jsxs("div",{className:"px-3 py-4 rounded-xl border border-border grid gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[F<p.length-1?e.jsxs(m,{as:"p",variant:"bodyMd",fontWeight:"medium",children:[I.from," - ",I.to," ",d?.currencyType]}):e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"medium",children:o("RestOfTheRanges")}),e.jsx("div",{children:e.jsx(Lt,{icon:Cp,variant:"tertiary",onClick:()=>{requestAnimationFrame(()=>T(F))}})})]}),e.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"medium",tone:"subdued",children:o("SellingPrice")}),e.jsxs("div",{className:"text-text-secondary",children:[g.selling_price.include_shipping_cost?`(${o("Cost")} + ${o("ShippingCost")}) `:`${o("Cost")} `,e.jsxs("span",{className:"font-bold",children:[I.selling_price.operator,I.selling_price.value," "]})]})]}),e.jsx($s,{}),e.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"medium",tone:"subdued",children:o("CompareAtPrice")}),e.jsxs("div",{className:"text-text-secondary",children:[g.selling_price.include_shipping_cost?`(${o("Cost")} + ${o("ShippingCost")}) `:`${o("Cost")} `,e.jsxs("span",{className:"font-bold",children:[I.compare_at_price.operator,I.compare_at_price.value]})]})]})]},F))}),e.jsx(Aa,{hideDismiss:!0,typeView:"card",featureKey:_,tracking:{positionKey:hs.setting_product_listing}}),e.jsx("div",{className:"w-fit",children:e.jsx(Lt,{icon:jn,variant:"plain",onClick:te,children:o("AddCostRange")})}),e.jsx(xt,{title:o("Edit"),visible:E!==null,onClose:()=>{requestAnimationFrame(()=>T(null))},showCloseIcon:!0,children:E!==null&&p[E]&&e.jsxs("div",{className:"grid gap-4 px-4",children:[E<p.length-1&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(gt,{label:o("From"),value:p[E].from+"",autoComplete:"off",onChange:I=>{isNaN(+I)&&I!=="."||W("from",E,I)},suffix:d?.currencyType}),e.jsx(gt,{label:o("To"),value:p[E].to+"",autoComplete:"off",onChange:I=>{isNaN(+I)&&I!=="."||W("to",E,I)},suffix:d?.currencyType})]}),e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"semibold",children:o("SellingPrice")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Cn,{onChange:I=>{L("operator",E,I)},value:p[E].selling_price.operator,label:"",labelHidden:!0,options:[{label:o("Plus"),value:"+"},{label:o("Multiply"),value:"x"}]}),e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",onChange:I=>{L("value",E,I)},min:0,value:p[E].selling_price.value?.toString()||"",error:k[`rule-${E}-selling`]||""})]}),e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"semibold",children:o("CompareAtPrice")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Cn,{onChange:I=>{H("operator",E,I)},value:p[E].compare_at_price?.operator,label:"",labelHidden:!0,options:[{label:o("Plus"),value:"+"},{label:o("Multiply"),value:"x"}]}),e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",onChange:I=>{H("value",E,I)},min:0,value:p[E].compare_at_price?.value?.toString()||"",error:k[`rule-${E}-compare`]||""})]}),E<p.length-1&&e.jsx(Lt,{tone:"critical",variant:"secondary",onClick:()=>{requestAnimationFrame(()=>{le(E),T(null)})},children:o("Remove")})]})}),e.jsxs("div",{className:"px-3 py-4 rounded-xl border border-border grid gap-4",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"grid gap-1 shrink-0 flex-1",children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"medium",children:o("SetSellingPriceInSpecificCent")}),e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:o("EndPricesWithCustomCentsEg99")})]}),e.jsx("div",{className:"w-21",children:e.jsx(gt,{label:"",labelHidden:!0,size:"slim",value:g.selling_price.assign.assign_cents+"",autoComplete:"off",onChange:I=>Z("assign_cents",I),error:k.assign_cents||"",suffix:d?.currencyType})})]}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx("div",{className:"grid gap-1 shrink-0 flex-1",children:e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"medium",children:o("AssignCompareatCents")})}),e.jsx("div",{className:"w-21",children:e.jsx(gt,{label:"",labelHidden:!0,size:"slim",value:g.selling_price.assign.assign_compare_cents+"",autoComplete:"off",onChange:I=>Z("assign_compare_cents",I),error:k.assign_compare_cents||"",suffix:d?.currencyType})})]})]}),e.jsxs("div",{className:"px-3 py-4 rounded-xl border border-border grid gap-3 bg-bg-surface",children:[e.jsx(Aa,{hideDismiss:!0,typeView:"card",featureKey:v,tracking:{positionKey:hs.setting_product_listing}}),e.jsx("div",{className:"flex items-start gap-2",children:e.jsxs(m,{as:"p",variant:"bodyMd",fontWeight:"medium",children:[o("UpdateSellingPriceOf")," ",e.jsx("span",{children:o("AllProducts")})," ",o("BasedOnCurrentPricingRule")]})}),e.jsxs(U,{blockAlign:"center",gap:"400",wrap:!0,children:[e.jsx(Lt,{disabled:v!==""||K,loading:s,variant:"secondary",onClick:ne,children:o("ApplyUpdate")}
2224),e.jsxs(m,{as:"p",variant:"bodySm",tone:"subdued",children:[S,"/",C," ",o("Used").toLocaleLowerCase()]})]})]})]}):e.jsxs("div",{className:"grid gap-4",children:[e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"semibold",children:o("PricingFormula")}),e.jsx(Qe,{id:"pricing-rule",open:!0,transition:{duration:"300ms",timingFunction:"ease-in-out"},children:e.jsx("div",{className:"grid gap-3 border border-border rounded-xl overflow-hidden bg-bg-surface",children:e.jsxs("div",{className:`grid gap-3 [&_select]:py-0! [&_.Polaris-Select]:h-[28px] 2225 [&_.Polaris-Select\\_\\_SelectedOption]:min-h-[28px]! 2226 [&_.Polaris-Select\\_\\_Content]:text-sm! 2227 [&_.Polaris-Select\\_\\_Content]:h-[28px]! 2228 [&_.Polaris-Select\\_\\_Content]:min-h-[28px]! 2229 [&_.Polaris-Select\\_\\_Content]:max-h-[28px]! 2230 [&_.Polaris-Select\\_\\_SelectedOption]:flex 2231 [&_.Polaris-Select\\_\\_SelectedOption]:items-center 2232 [&_.Polaris-Select\\_\\_SelectedOption]:py-0! 2233 [&_.Polaris-Select\\_\\_SelectedOption]:text-xs 2234 `,children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-bg-fill-secondary",children:[V(),e.jsx(wt,{children:`${d?.currencyName} (${d?.currencyType} ${d?.currencySymbol})`})]}),e.jsxs("div",{className:"px-3 pb-3 grid gap-3",children:[ie(),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex gap-14 items-center group relative pr-10",children:[e.jsx("div",{className:"flex items-center gap-4 shrink-0 w-[243px]",children:e.jsxs("div",{className:"flex gap-2 flex-1 w-[208px]",children:[e.jsx("div",{className:"grid gap-1 flex-1",children:e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",fontWeight:"bold",children:o("From")})}),e.jsx("div",{className:"grid gap-1 flex-1",children:e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",fontWeight:"bold",children:o("To")})})]})}),e.jsxs("div",{className:"flex gap-4 flex-1",children:[e.jsx("div",{className:"grid gap-1 flex-1",children:e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",fontWeight:"bold",children:o("SetSellingPrice")})}),e.jsx("div",{className:"grid gap-1 flex-1",children:e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",fontWeight:"bold",children:o("SetCompareAtPrice")})})]})]}),p.slice(0,-1).length>0&&p.slice(0,-1).map((I,F)=>e.jsxs("div",{className:"flex gap-14 items-center group relative pr-10",children:[e.jsx("div",{className:"flex items-center gap-4 shrink-0 w-[243px]",children:e.jsxs("div",{className:"flex gap-2 w-[208px]",children:[e.jsx(gt,{label:"",labelHidden:!0,value:I.from+"",autoComplete:"off",onChange:G=>{isNaN(+G)&&G!=="."||W("from",F,G)},size:"slim",suffix:d?.currencyType}),e.jsx(gt,{label:"",labelHidden:!0,value:I.to+"",autoComplete:"off",onChange:G=>{isNaN(+G)&&G!=="."||W("to",F,G)},size:"slim",suffix:d?.currencyType})]})}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Cn,{onChange:G=>{L("operator",F,G)},value:I.selling_price.operator,label:"",labelHidden:!0,options:[{label:o("Plus"),value:"+"},{label:o("Multiply"),value:"x"}]}),e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",onChange:G=>{L("value",F,G)},min:0,value:I.selling_price.value?.toString()||"",size:"slim",error:k[`rule-${F}-selling`]||""})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Cn,{onChange:G=>{H("operator",F,G)},value:I.compare_at_price?.operator,label:"",labelHidden:!0,options:[{label:o("Plus"),value:"+"},{label:o("Multiply"),value:"x"}]}),e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",onChange:G=>{H("value",F,G)},min:0,value:I.compare_at_price?.value?.toString()||"",size:"slim",error:k[`rule-${F}-compare`]||""})]})]}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 flex items-center justify-center w-[28px] [&_svg]:fill-text! ",children:e.jsx(Lt,{icon:Ws,variant:"tertiary",onClick:()=>le(F)})})]},F)),e.jsxs("div",{className:"flex gap-14 items-center group relative pr-10 ",children:[e.jsx("div",{className:"flex items-center gap-4 shrink-0 w-[243px]",children:p.length>1?e.jsx("div",{className:"border border-input-border bg-bg-surface-disabled rounded-lg px-3 py-[5px] w-[208px]",children:e.jsx(m,{as:"p",variant:"bodySm",children:o("RestOfTheRanges")})}):e.jsxs("div",{className:"flex gap-2 w-[208px]",children:[e.jsx(gt,{label:o("From"),labelHidden:!0,autoComplete:"off",value:"
22340",disabled:!0,size:"slim"}),e.jsx(gt,{label:o("To"),labelHidden:!0,autoComplete:"off",value:"â",disabled:!0,size:"slim"})]})}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"grid gap-1 flex-1",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Cn,{onChange:I=>{L("operator",p.length-1,I)},value:p[p.length-1].selling_price.operator,label:"",labelHidden:!0,options:[{label:o("Plus"),value:"+"},{label:o("Multiply"),value:"x"}]}),e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",onChange:I=>{L("value",p.length-1,I)},min:0,value:p[p.length-1].selling_price.value?.toString()||"",size:"slim",error:k[`rule-${p.length-1}-selling`]||""})]})}),e.jsx("div",{className:"grid gap-1 flex-1",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Cn,{onChange:I=>{H("operator",p.length-1,I)},value:p[p.length-1].compare_at_price?.operator,label:"",labelHidden:!0,options:[{label:o("Plus"),value:"+"},{label:o("Multiply"),value:"x"}]}),e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",onChange:I=>{H("value",p.length-1,I)},min:0,value:p[p.length-1].compare_at_price?.value?.toString()||"",size:"slim",error:k[`rule-${p.length-1}-compare`]||""})]})})]})]}),e.jsx(Aa,{hideDismiss:!0,typeView:"card",featureKey:_,tracking:{positionKey:hs.setting_product_listing}})]}),e.jsx($s,{}),e.jsx("div",{className:"flex justify-start",children:e.jsx(Lt,{icon:nm,variant:"monochromePlain",onClick:te,children:o("AddMore")})})]})]})})}),e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"semibold",children:o("UpdateStoreSellingPrice")}),e.jsxs("div",{className:"grid gap-3 border border-border rounded-xl overflow-hidden p-3 bg-bg-surface",children:[M(),e.jsx($s,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Aa,{hideDismiss:!0,typeView:"card",featureKey:v,tracking:{positionKey:hs.setting_product_listing}}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ds,{source:am}),e.jsxs(m,{as:"p",variant:"bodyMd",tone:"subdued",fontWeight:"medium",children:[o("UpdateSellingPriceOf")," ",e.jsx("span",{className:"font-bold",children:o("AllProducts")})," ",o("BasedOnCurrentPricingRule")]})]}),e.jsxs(U,{blockAlign:"center",gap:"400",children:[e.jsx(Lt,{disabled:v!==""||K,loading:s,variant:"secondary",onClick:ne,children:o("ApplyUpdate")}),e.jsxs(m,{as:"p",variant:"bodySm",tone:"subdued",children:[S,"/",C," ",o("Used").toLocaleLowerCase()]})]})]})]})]})]})}),W3=()=>{const{t}=J(),{isMobile:s}=xe(),n=Pt(),a=bt(),{token:r}=vs(),o=de(),{shake:l}=Fa(),c=i.useRef(!1),{isChangeData:u,productListing:d,fetchProductListing:g,discardChanges:h,setProductListingPrimitive:p}=jr(),[x,f]=be(B3),[_,b]=i.useState(!1),[v,y]=i.useState(!1),[C,S]=i.useState(!1),j=i.useRef(null),A=()=>{if(u){l();return}f(!1)},E=()=>{n.openChat()},T=async(R=!0)=>{if(!j.current?.validateAllNumericFields())return!1;b(!0);const{status:P,data:w}=await Ta.putProductListingV2({...d,tracking_settings:{...d.tracking_settings,price_increased_threshold_percent:d.tracking_settings.price_increased_any?void 0:d.tracking_settings.price_increased_threshold_percent}},r);if(b(!1),P===fe.OK)return R&&a.success(t("SettingSaved")),p(d),j.current?.clearInputErrors(),!0;if(P===fe.QUOTA_EXPIRED)return j.current?.onFeatureName(w?.feature?w.feature:"MULTI_PRICING_RULE"),!1},k=async()=>{if(y(!0),!await T(!1)){y(!1);return}const{status:P}=await Ta.getProductPricingRuleForProducts();P===fe.OK&&(a.success("Apply pricing rule for products successfully"),o.fetchCurrentPlan(),j.current?.onResetFeatureName(["BULK_PRODUCT_UPDATE_PRICE","BULK_APPLY_PRICING_RULE"])),P===fe.QUOTA_EXPIRED&&j.current?.onFeatureName("BULK_PRODUCT_UPDATE_PRICE"),y(!1)};i.useEffect(()=>{if(!x){j.current?.clearInputErrors(),S(!1);return}c.current?p(d):(g(),c.current=!0)},[x]);const O=e.jsx("div",{className:"flex flex-col gap-4",children:e.jsx(G3,{ref:j,layoutForDrawer:!0,onApplyPricingRuleForProducts:k,loading:v,onHasInputErrorsChange:S})});return s?e.jsx(e.Fragment,{children:e.jsx(xt,{visible:x,onClose:A,showCloseIcon:!0,isButtonFullWidth:!0,title:t("ListingSettings"),children:e.jsx("div",{className:"p-4",children:O})})}):e.jsxs(Is,{width:"828px",onClose:A,visible:x,children:[u&&e.jsx(Wp,{message:t("UnsavedChanges"),saveAction:{onAction:T,loading:_,disabled:C,content:t("Save")},discardAction:{disabled:_,onAction:()=>{j.current?.clearInputErrors(),h()},content:t("Discard")}}),e.jsx("div",{className:"sticky top-0 z-10 bg-white px-4 box-shadow-[var(--p-shadow-200)]",children:e.jsx(us,{title:t("ListingSettings"),backAction:{onAction:A},secondaryActions:[{content:t("ContactSupport"),onAction:E}]})}),e.jsx(Q,{padding:"400",children:O})]})},V3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAPHSURBVHgBpVVtTFtlFD739t7eFkpboB+2jNLb0gLVUcLYZrqykGhEo8nYTMx0xrQswyWyULPEsT+umGj8+AFq4hY1Q5eIHwupYKYshMRMjQTdaDfUOZRbnFQ+CrQrg7q2HO+9SYmbJWnc8+PmfDzvOe977jnvC5ADiKj+pH/Q52p+PKAqc3ByvQ0ZnRWVBtv4jgf3BAbPjXhgExB3Gno/DbQcbmvvLTEa1TKZTAh++wKCgNXVVVienQ+ffOf1roMHnvxg04D3NuzujsYTvgKF4j+BcmElsQIaldJ/9dKFrqxNkhVMlXUn0hTdSUulkC+kjBTSgE2GLeXqaOT6ecFGCp9O/8ueNMP44f+AP0j8Zsrnf627RVDFI9OqMq6MZc1wF5iZ4mLXQt+ykqcOHfG4d7k834yOQRFfOwGLkb/4wq+BQlkEQilLlQqgaBq21d4Hs/ML4Nq+DS5f+QlkcjmQJAlJntva+rRs7MfQHGiMlkDg3HkMTfyCens9uh7aiwL+mIlgkbEKteU1oq4xOfCrka+RVupxdm4e+/oH0FizHUuNdtHvbGhEZbnjc2B0leNNjz6BmUwGCVkpXgxeQSGBAJ3FiW3PH8dEYgXlJQaRQ5eYUa23iv6aehcux+LY23cWDY4dKC2u4KDQYEd5cYVI0JusmE5ncHfzHowuLWPrc0fxYkhIMIRV9W6RI9WwWOHchS+ceEXUo4uLKCveguY6NxbeY0MS1hGkigKYjy7CgWe8IJGQEAxOwBdDw9Dy2CNQXWmFt9/7kO8HauMHECQBsRsJUV7h60cSVNbB91KJmRMy9pw6LWaM30hgET9mjQ/vwyxkGgtWNT
2234SJMqOxokrPinL9/W5cW0viqz0nsbzWhVKdZZwskDFBYZzeP/2RmGTkwneg0mlhbPQHUZ9diAIjpTd2dyuxAD8HR2Hgy2H4cykJ9q074VjHYVi/mYBCip4mfMdf8g0MDXcn+CO0t3ngjbdOgVarAQnfDgxNQXW1HS6FJvhSSMDGmiC6FIO6rQ74rH8QSnmeACqzDvv374PJ3373EhzHqaucjZzRYlYL8yvs9rZByGHLhUiYC9+KzbAky7Kxg4c83kw6k3NhPsFSqTR0HGkXL4gNtslW20MpVB3redwydyb8e3mhKxK+6hf0jdsmvjQ3pCpQEmsITTRF5RUomUyCnCTenP412Jm1k/8mhacm/Eef9XrDU9PhVCq1aQkE3/XJa7EXj3Xsnbz8vQ/ywbtnPvY4dj4QKNBWjtN8HzJaK8p1Vs7pbg6c6TvrE56JXOv+AUx2xUqnU0K7AAAAAElFTkSuQmCC",Y3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIKSURBVHgB7ZNbSJNhGMef9/02d+igK2iL2udy4dQaUrMiFBwURUYHi4FRVAsiMAiCIiyivIgiR0HHi+WUMpCou8TWUesiVDyxG9Hp5sSBuo/5zbnt+9z2ulfmjZcyLwR/8PLy3Pyf/3MCWGNVIFnyZ4A6QmCZUBeMWaeTFoti7qBS6W11uwXEx4EqKnZbtdHQZBh8LaFUiMxmgL1qWV4gIHDvfwGX1sCpl6RaJhMg/L/IWPWV3ekrkStLGjTb+6by9VchEiRwJxgRCk+fgrNv2uH6SHNrLRz648CxA2zc9Oie9Iu3TS7Yh7SBlBDNzZyvXVd+5a2mByIHy4klW73j2pZtxWdytuaS/YUEboYT6cx4wcLdWRF0l+UNNVkFvQ7ZrX6H9IbwAwUet2vHrLZNRdR9k4cVWWO2SpIgSbBoNhukgDcCIkz9qN8IRySudBkUlOSFubHG7xMzI/EXn9qS9n8DMOusx8+Gv4X2lR1f3zUzrqrkObHb5+J57I3GPpYqci48mJ5qMTByfZWWbYZwUIBqdxcYTm6ASz0PQUR+tczPeTjkGu4D7sMTyWcSIol3t3mPKJDo4YuK38/vi0fT5QN+zeaVdRbssTXp8ytpzJTaK6gzOPfzKVQ0Whcn2PsK13Q7MN0B5LTJjtFBVNepTrzs0PylfYRM4IzpyS4LZC0YyAArcARrZJx5AYTCg+P+pfgAAAAASUVORK5CYII=",z3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFiSURBVHgBrVTRcYMwDJWAARgB2v43I5AN6AQkE7QbECbodYIkG7BBGIEBeoUNSgcA95mYHFATfIV358NI8rMt+YlJoQidQFAdY+qpYYIKI2/IOj+l9Uka+EpmxYLEgRaAiQ9+2iT8Gdo7i5ojrQAmsXVsaiIxtJc4dmlCgHXB8J9jB8ZN34h8JF0+5vAV8jc+bs/kMYxCE1vh+L6fUoX8viO/byN/9pCKrW6tRXq4dNtZbDR+rwj1L2GK8B4ySYh8HdcgzJnsRM0DXYBDsxBJQ3SWM1ud7l60AaHdq2I9G21A2Lxa6nrIW4Y3miwkHEDqva06iFNs8INton7Af6rcPacPkOZj5xRhpQaUc/2OUFLbZf4WyFHOmwPS2/el95iKF5pAEYrnkVQqLkK+jERekllzkFcfqygDoUw0X2gFQP97Cw0gg/gTWgjJAa4TdwacdIc9ItXOXEOektr+2ZJl0vALlJx4JvqigWUAAAAASUVORK5CYII=",K3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFzSURBVHgBrVXBccIwEDwHHvzC009TQdxBTAUxFSSuwKQCkgpIKghUkKQCTAVRCcrPv7iDZA8vMxoNMiZwM2tJJ93e6TgdkVDSNM0wLICE6CMNYIC1MWaligHJlGhForH0lxFt8jiOpa7rbQSyByje5DIyvcLnvuOAXqcAJsQUWHecXwzxSQObVgmQm8bTVbjVNcb8gE2iEYZyVigZjBPgHVg6e6Eod4QhyZnfJaOZKzn3TMho2EFYSlsWGk1BXSNHpCvCD2CCa885N14+TyZ8ZA6V8Af4kh4SItRoLOe3HK2cQej+8q/EzPFmMVSnECZ822pcaR41ZOjc2rOHDPXp/QZILSPTEkmkfVEZ8MR1zihTcZqJT6gHvoE7Od4kKjrditMLhlQmXGdcz0io6xuHpKHDiuvSc9L4hML5hkaf0tag5V5KByWdNRz3YiImfyOXkWKApmjRHCPP03/kGYXwsuvYIK1AqrkZE6OeJFbYM/d/AX9Wb34E5k/cGgAAAABJRU5ErkJggg==",Q3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHZSURBVHgBrVXLSgJRGP7OqA2UOI1WWpYOuihy0wsELmrfyo0Le4AgIqIbUYsikqJ10cY2QwtdGUMQ1hvYwlWvIDgRUnYZp5ljGjVnxMQPvjnX//svzDkH+EHc4J1B1aDeIdVvmxn8we4/ROy42xSb6YFYk3GH8ZENSrADIfCHQ/A6+lB9faFWbSCR7zoMslY5nsfKrQLX7T2GBzyYfeEwt7+B5893O8En2IVPCNGFhQV96+K8NXeyvq0v+iJ0zc6OY7nhw2HsXMm4PjlGCASFQoFSc/djNXeJ/MEpJN5tF6XVy+jGmv5R1ylqtRptNU3TVVWl/fr7h74ZmO48Qp8/AAdplJ836mgiGo2iWCw2NricCAbGmNExBUNGygTEMp9MJpHJZOiK6BVZpnCyJj0eD23L5TISiQRisRgdy7KMsOGMRhyJAIUOI5wIjtI2l8tRgXQ6TcdmX5Ik2vcODbNM2YIBofFbmvUrlUpQFAWVSgWi+JOm2+9jClpS5lwujHgbgqlUCtVqFdlsFvl8HoIgtPaJwXHwnANvde2XvVlfy2lavlGwNDkFp805M9N6PDrH/Nmhxbrt0esCT6azB/QOVCuO3l1frYt2rwdie3/DNdXv0N0TEG+KfAFYtfsHOd5BMAAAAABJRU5ErkJggg==",q3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJySURBVHgBjVW/TxNRHP++84htE9sLJVwHr0aHY6I5EmHAkFTDpjj5B6jgxMRi4qBtY4jGhYlJA6sDE4Wtg4mGAUy8OJhQEk0aB0gkXpe2WLj6/T7vrq93z4NP0r679+Pzvt/P98cx8PCqulDsQa/UA7DwVfPnE0MpPna6LZDAYQC2qihLT+++tWmC/SN7XHKBlcO7p27MQjoxArmMwQm//tyB+uEXGTEo0Cs/m1ursDfbT6yu60Z26WkDzNwENFu/IJMa4b8TJN39UeNzMqBRt5VT112RLc6Y9+FjfRPGjVt8JFxG9xfvvIbJ67OQUFORM5dQMrZcnf8NgmbcOnQxPzzGnwtImElmAy0J5Pq1YROa7WPY2FuFzmmgr6NCKACFq9Pc1Xx2DOLgyzCKlzeO9/1pTRU33bMegalPBO8UiIMjG9o4mroFGhKEoaH1DeFdHVzsH9j9XoNPB5tBuuQwSDLC0XQe/3fkhOlUlo8ORrH27T2XYBwlIK3INRk070yEkA77kasf8hzl0aRox4HSS4TSNz1qwR7mHEU0DpmQDIpooY+CMc03kn5b9lqQhxchVWSmE/n8zAuePgQiFHItAv2KESUUb6F6JdIp1NDHyZ9WjIX9wARBoXzysWWvY9tYB/GyjCRlgvXkoMsOPYgaTmKXobolDaliHtxchDgIqeOo1M+wBxbFKFOqnJcuInz9GTBbPQNWSQ0lixufV/mC7lWELI3+B5KDcrjjdpZ4g31ZXShjgyzJbqbN5DaVXhp1psv8brOPdX7UbPB6b3Xbledz78rMP7y8/dBirrqCn4GBT0AYCU9bDw65eQZAZB9o4i/Hdcl10iS3pgAAAABJRU5ErkJggg==",Z3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADVSURBVHgBrZPLDcIwEEQHQQFcuaWEHLnhElJCOoBS6CApgQ7sK1UAN27QgVkrG+FYdj7OjjRSPEqeRps1IKsGgnIwCyH1MBGgD1sNDGGrgDFYNjAFs1ssV0k+kF/kPVtMBfmDzIY1+UyuyIp8J7/RtT0iQy2G81KcX/18MwPkZvRlQMHZk2z4rL18Ug3+TWIatMPE2vSrofh84TY6aKXnAP09U5y1wYcV57Wf7xKwOpLf0M3Oyc3U8PMJI4rdADXyvlvyBxJ/OdXMeM1CWIkFzXItCrM/iM57595zRFwAAAAASUVORK5CYII=",X3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHdSURBVHgB1ZRLTsMwEIbz8NhOGkDtVXoiuAjcAVZsuQLiseElNrABKnawgk15qGoLlSqFJMzvTEqKoJRlLVnxTDyfZ/5x4nmLOgJr7W4URTu8DmEnSbJORH1FNIrjaFP8c9KCIPd9PzfGXMFmSAqbl0U1wzAs/gPLyNKFgymFwJyfg3a7TfCRpo42us9LfyYMWTgY0ZkLJCrg4/JfxR7wHAloLtgHBxxJpg5mLHUFBlDOzzfYcRyv8fqJ5RjygdsIqcMywFizgzpMa/0gsHEdxv5HfmReTVPR2PdYXJSHsvamYEbfi4Yp3mtNfYE/4T2a0mq1luHjRE6xxxjdcU2QUyYwa81tpaFk1hO7Vzao7DCDrolc01BlwfEZ
2234IFxuCQTAWv29u89VQwReSNm3kEp9XZ/CJccvOrLxBN5ms7lSZgqf6gr8HXtCFaYCuwMM+yTTfTn8TLKdvrQQnDV8rDeEN4/FfgCsutgMO3TwkjEZQZzE23xhh8aabmOpsSrBmYg9ErtbL5sPOZYbMgX7bfgI5PniYJpeEagorGDnUvafMIBSnq45+Nzw2TkNpUzW8HJemBsSOHVpcYjAbmbBgp+cWZapOEm28LkxoB81oo00TY07i8IOfm15nitvIccnjKa2BIx9vxUAAAAASUVORK5CYII=",J3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIUSURBVHgBrZXNTxNBGMaf2RAaPyANtQcStCQkRImHFT30oIIHjRcPejLKwZjIff0HSv8BN15rwgmNXvTgxY+LRQ+9QHswVSEmaoiYoKTxMyWm4/u8ZaSkBQrsk0xnZrvze9/nnd1Zg1XdGQtHpcvAwIdFHO3IoCL3lmwNwfi9oFS/VIdlpJvA7jRxYyrImtyV0DceiohGZzyBhYhOGU9+fEQnn8D2NqA9xTvcqPdwH3qP9GEnWnyzgMW3CzpWYOfeGM4GF/Dt41IT9PXTIhKHkpsGW/ldxf2bk1j5VYXngIySzz1bAz0prusLd/N4EExi9lFB57MPCzovTOV1fWxPTK97DpBIJfHz63eNNveyrIAvEoTXfkj7MPMep8fPKWh+uoy5V2Wkx0a0pzOn/8D9B7rRua+eKRdR7wTcI4GWZcHgySG1zXs+S71YhtTxASQOJjWJJqBmKX/OECbvz/DFNOYF2CWBKGbKetIe3RDiNqMr2d0amDoxgOVPSwo7ev6YZkMAx8yK9UtfHcHgqSEtw/PbjzF8Ka3unDrcLrH1iwV52XUBxcWuHJdvXW+M3TSv/qnbNnIwWA56pCYKbCFm2S/ZE+zq2yjapn2XYUVanFbZNhLrR3uND3ELVQjkOTaKLcRNmW54TlvJwJS4KVlEpFrNBp4cii8igmZ5ahs3y10Lfe+vCa2x2/oEGGtKFja7mhj+Ac5i4gPhvXODAAAAAElFTkSuQmCC",$3="/assets/img-request-connect-store-CC0xRyHN.png",eI=({items:t=[],options:s,className:n})=>{const[a,r]=xr({align:"start",loop:!1,containScroll:"trimSnaps",...s}),[o,l]=i.useState(!1),[c,u]=i.useState(!1),d=i.useCallback(()=>{r&&(l(r.canScrollPrev()),u(r.canScrollNext()))},[r]);i.useEffect(()=>{r&&(d(),r.on("select",d),r.on("reInit",d))},[r,d]);const g=i.useCallback(()=>{r&&r.scrollPrev()},[r]),h=i.useCallback(()=>{r&&r.scrollNext()},[r]);return e.jsxs("div",{className:["embla relative",n].filter(Boolean).join(" "),children:[e.jsx("div",{ref:a,className:"embla__viewport overflow-hidden",children:e.jsx("div",{className:"embla__container flex",children:t.map((p,x)=>e.jsx("div",{className:"embla__slide flex-[0_0_100%] min-w-0",children:e.jsx("div",{className:"pr-3",children:e.jsxs("div",{className:"",children:[e.jsx(m,{as:"p",variant:"headingLg",children:e.jsx("span",{className:"",children:p.label})}),e.jsxs("div",{className:"mt-2 mb-3 flex gap-1 flex-wrap",children:[e.jsx("div",{className:"px-2 bg-bg rounded-lg h-[24px] flex items-center",children:e.jsx(m,{as:"span",variant:"bodySm",children:p.from()})}),e.jsx("div",{className:"px-2 bg-bg rounded-lg h-[24px] flex items-center",children:e.jsx(m,{as:"span",variant:"bodySm",children:p.from_mantaince()})})]}),e.jsx("div",{className:"mt-2",children:e.jsx(m,{as:"span",tone:"subdued",variant:"bodySm",children:p.description()})})]})})},x))})}),e.jsxs("div",{className:oe("flex items-center justify-end gap-2 mt-0 opacity-0",t.length>1&&"opacity-100"),children:[e.jsx("button",{type:"button",onClick:g,disabled:!o,className:"h-7 w-7 rounded-full border border-border grid place-items-center hover:bg-bg-fill-hover disabled:opacity-40 disabled:cursor-not-allowed","aria-label":"Previous",children:e.jsx(ee,{source:Tp})}),e.jsx("button",{type:"button",onClick:h,disabled:!c,className:"h-7 w-7 rounded-full border border-border grid place-items-center hover:bg-bg-fill-hover disabled:opacity-40 disabled:cursor-not-allowed","aria-label":"Next",children:e.jsx(ee,{source:Ys})})]})]})},tI=i.forwardRef((t,s)=>{const{t:n}=J(),a=Pt(),r=de(),{isMobile:o}=xe(),l=r.getUserInfo(),[c,u]=i.useState(!1),[d,g]=i.useState(1),[h,p]=i.useState(""),[x,f]=i.useState("book_a_call"),_=[{label:n("StoreBuildingMigration"),value:"store_building_migration",from:()=>e.jsxs("div",{children:[n("StoreBuildsFrom")," ",e.jsx("b",{children:"$399"})]}),from_mantaince:()=>e.jsxs("div",{children:[n("MaintenanceFrom")," ",e.jsx("b",{children:"$19"})]}),description:()=>e.jsx("div",{children:e.jsxs("ul",{className:"list-disc space-y-2 pl-5",children:[e.jsx("li",{children:n("BuildYourCustomStore")}),e.jsx("li",{children:n("TailoredPlanForYou")}),e.jsx("li",{children:n("ThemesDesignedToConvert")}),e.jsx("li",{children:n("FastSetupProWorkflow")})]})})},{label:n("ProductSourcingWholesale"),value:"product_sourcing_wholesale",from:()=>e.jsxs("div",{children:[e.jsx("b",{children:n("Free")})," ",n("SourcingService")]}),from_mantaince:()=>e.jsxs("div",{children:[n("MinOrderFrom")," ",e.jsx("b",{children:"$499"})]}),description:()=>e.jsx("div",{children:e.jsxs("ul",{className:"list-disc space-y-2 pl-5",children:[e.jsx("li",{children:n("ThousandsTrustedFactories")}
2234),e.jsx("li",{children:n("GetBestPricesInstantly")}),e.jsx("li",{children:n("VerifiedQualityMinimizedRisk")}),e.jsx("li",{children:n("ScaleWithoutSupplyLimits")})]})})},{label:n("WarehouseSolution"),value:"warehouse_solution",from:()=>e.jsxs("div",{children:[e.jsx("b",{children:n("Free")})," ",n("Consultation")]}),from_mantaince:()=>e.jsxs("div",{children:[n("ServiceContractsFrom")," ",e.jsx("b",{children:"$499"})]}),description:()=>e.jsx("div",{children:e.jsxs("ul",{className:"list-disc space-y-2 pl-5",children:[e.jsx("li",{children:n("StorePickShipDone")}),e.jsx("li",{children:n("SamedayOrderDispatch")}),e.jsx("li",{children:n("RealtimeInventoryControl")}),e.jsx("li",{children:n("FasterUSAndEuropeDeliveries")})]})})},{label:n("CustomPackaging"),value:"custom_packaging",from:()=>e.jsxs("div",{children:[e.jsx("b",{children:n("Free")})," ",n("QuotationDesign")]}),from_mantaince:()=>e.jsxs("div",{children:[n("PackagingFrom")," ",e.jsx("b",{children:"$499"})]}),description:()=>e.jsx("div",{children:e.jsxs("ul",{className:"list-disc space-y-2 pl-5",children:[e.jsx("li",{children:n("EnhanceBrandUnboxingExperience")}),e.jsx("li",{children:n("CustomPackagingToWowBuyers")}),e.jsx("li",{children:n("LowMOQHighImpact")}),e.jsx("li",{children:n("DesignPrintDeliverFast")})]})})},{label:n("CustomPricingPlan"),value:"custom_pricing_plan",from:()=>e.jsxs("div",{children:[e.jsx("b",{children:n("Free")})," ",n("Customization")]}),from_mantaince:()=>e.jsxs("div",{children:[n("SubscriptionsFrom")," ",e.jsx("b",{children:"$19.9"})]}),description:()=>e.jsx("div",{children:e.jsxs("ul",{className:"list-disc space-y-2 pl-5",children:[e.jsx("li",{children:n("CustomPlanForYourNeeds")}),e.jsx("li",{children:n("FlexibleFeaturesUnlimitedScale")}),e.jsx("li",{children:n("SuitableForAllBusinessSizes")}),e.jsx("li",{children:n("PremiumSupportIntegrations")})]})})}],[b,v]=i.useState(_);i.useImperativeHandle(s,()=>({openModal:()=>u(!0)}));const y=b.filter(k=>k.selected),C=y.length===0,S=()=>e.jsx("div",{className:"mt-auto [&_.Polaris-Text--root]:underline",children:e.jsx(re,{onClick:()=>{a.openChat()},variant:"tertiary",icon:Oa,children:n("ChatNowWithOurExpert")})}),j=()=>e.jsxs("div",{className:oe("p-6 flex flex-col h-full",o&&"p-4"),children:[e.jsx(m,{as:"span",variant:"heading3xl",children:n("HiThere")}),e.jsx("div",{className:"my-6",children:e.jsx(m,{as:"span",tone:"subdued",variant:"bodyLg",fontWeight:"medium",children:e.jsx("span",{className:"text-[16px]",children:n("TellUsWhatYoureLookingForAndWellHelpYouFindTheBestSolution")})})}),e.jsx("div",{className:"mb-3",children:e.jsxs(m,{as:"span",tone:"subdued",variant:"bodyLg",fontWeight:"semibold",children:[n("PickOneOrMore").toUpperCase(),":"]})}),e.jsx("div",{className:"space-y-3",children:b.map((k,O)=>e.jsx("div",{onClick:()=>{const R=b.map((P,w)=>w===O?{...P,selected:!P.selected}:P);v(R)},className:oe("rounded-[10px] border border-border p-3 py-2 cursor-pointer hover:bg-bg-fill-hover",k.selected&&"bg-black! text-white!"),children:k.label},O))}),e.jsx("div",{className:"my-4 text-white flex justify-end",children:e.jsx("div",{className:oe("cursor-pointer bg-[#5546FF] w-8 h-8 rounded-full flex items-center justify-center",C&&"bg-[#DADADA] cursor-not-allowed"),onClick:()=>{g(2),Ke.trackingEventUsersAction({event_name:$.HOME_PAGE_MAKE_REQUEST_STEP1_SUBMITTED,event_data:{requests:y.map(k=>k.value)}})},children:e.jsx(ee,{source:Ja})})}),S()]}),A=()=>e.jsxs("div",{className:oe("p-6 flex flex-col h-full",o&&"p-4"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{icon:Mn,variant:"tertiary",onClick:()=>{g(1)}}),e.jsx(m,{as:"span",variant:"heading3xl",children:n("OurServices")})]}),e.jsx("div",{className:"my-6",children:e.jsx(m,{as:"span",tone:"subdued",variant:"bodyLg",fontWeight:"medium",children:e.jsx("span",{className:"text-[16px]",children:n("ExploreWhatZopiCanDoForYourBusiness")})})}),e.jsx("div",{className:"space-y-3 rounded-[8px] border border-border p-2",children:e.jsx(eI,{items:y})}),e.jsx("div",{className:"mt-4 h-[60px]",children:e.jsx(gt,{label:"",placeholder:n("ExtraNoteOptional"),multiline:2,autoComplete:"off",value:h,onChange:k=>p(k),maxHeight:200})}),e.jsx("div",{className:"my-4 text-white flex justify-end",children:e.jsx("div",{className:oe("cursor-pointer bg-[#5546FF] w-8 h-8 rounded-full flex items-center justify-center",C&&"bg-[#DADADA] cursor-not-allowed"),onClick:()=>{g(3),Ke.trackingEventUsersAction({event_name:$.HOME_PAGE_MAKE_REQUEST_STEP2_SUBMITTED,event_data:{requests:y.map(k=>k.value),extra_notes:h||"N/A"}})},children:e.jsx(ee,{source:Ja})})}),S()]}),E=()=>e.jsxs("div",{className:oe("p-6 flex flex-col h-full",o&&"p-4"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{icon:Mn,variant:"tertiary",onClick:()=>{g(1)}}),e.jsx(m,{as:"span",variant:"heading3xl",children:n("LetsContact")})]}),e.jsx("div",{className:"my-6",children:e.jsx(m,{as:"span",tone:"subdued",variant:"bodyLg",fontWeight:"medium",children:e.jsx("span",{className:"text-[16px]",children:n("ChooseAWayThatWeCanContactYouToGetStarted")})})}),e.jsxs("div",{className:"my-4",children:[e.jsxs("div",{className:"",children:[e.jsx("label",{htmlFor:"book-a-call",onChange:()=>{f("book_a_call")},children:e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(As,{id:"book-a-call",name:"select-option-connect",label:"Book a call",labelHidden:!0,checked:x==="book_a_call"}),e.jsx(m,{as:"span",variant:"headingLg",children:n("BookACall")})]})}),e.jsx(m,{as:"span",tone:"subdued",children:n("PreferToTalkItThroughScheduleANoobligationCallWithOurTeamToDiscussYourRequestBudgetOrAnythingYouNeed")})]}),e.jsxs("div",{className:"flex items-center justify-between my-6",children:[e.jsx("div",{className:"h-[5px] rounded-full bg-[#383A48] w-[50%]"}),e.jsx("div",{className:"h-[5px] rounded-full bg-[#383A48] w-[20%]"}),e.jsx("div",{className:"h-[5px] rounded-full bg-[#383A48] w-[10%]"})]}),e.jsxs("div",{className:"mb-0",children:[e.jsx("label",{htmlFor:"send-message",onCh
2234ange:()=>{f("send_message")},children:e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(As,{id:"send-message",name:"select-option-connect",labelHidden:!0,label:n("SendAMessage"),checked:x==="send_message"}),e.jsx(m,{as:"span",variant:"headingLg",children:n("SendAMessage")})]})}),e.jsx(m,{as:"span",tone:"subdued",children:n("NotReadyForACallSendUsAQuickMessageAndAZopiAgentWillReachOutViaChatOrEmailToAssistYou")})]})]}),e.jsx("div",{className:"my-4 text-white flex justify-end",children:e.jsx("div",{className:oe("cursor-pointer bg-[#5546FF] w-8 h-8 rounded-full flex items-center justify-center",C&&"bg-[#DADADA] cursor-not-allowed"),onClick:()=>{const k=y.map(R=>R.value).join(", "),O=h||"N/A";if(x==="book_a_call"){let R=`https://calendly.com/zopi-support/30min?month=${it().format("YYYY-MM")}&service_type=${k}¬e=${O}`;l.email?.includes("@aho.app")||(R+=`&email=${l.email}&name=${l.name}`),window.open(R,"_blank")}else{a.openChat();const R=[[["service_type",k],["note",O]]];a.pushEventCrisp("set",{"session:data":R})}Ke.trackingEventUsersAction({event_name:$.HOME_PAGE_MAKE_REQUEST_SUBMITTED,event_data:{requests:y.map(R=>R.value),extra_notes:O,type:x}}),g(4)},children:e.jsx(ee,{source:Ja})})}),S()]}),T=()=>e.jsxs("div",{className:oe("p-6 flex flex-col h-full",o&&"p-4"),children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{as:"span",variant:"heading3xl",children:n("ThankYou")})}),e.jsx("div",{className:"my-6",children:e.jsx(m,{as:"span",tone:"subdued",variant:"bodyLg",fontWeight:"medium",children:e.jsx("span",{className:"text-[16px]",children:n("WeveReceivedYourRequestOurExpertsTeamWillReachOutToYouAsSoonAsPossible")})})}),S()]});return e.jsx(Xe,{title:n("MakeARequest"),titleHidden:!0,open:c,onClose:()=>{u(!1),g(1)},size:"small",children:e.jsx("div",{className:"overflow-hidden",children:d<4?e.jsxs("div",{className:"flex",style:{width:"300%",overflow:"hidden",transform:`translateX(-${(d-1)*33.333}%)`,transition:"transform 0.3s ease-in-out"},children:[e.jsx("div",{className:"w-full max-w-[380px]",children:j()}),e.jsx("div",{className:"w-full max-w-[380px]",children:A()}),e.jsx("div",{className:"w-full max-w-[380px]",children:E()})]}):e.jsx("div",{className:"w-full max-w-[380px]",children:T()})})})}),Ru=[{name:"Shopify",platform:"shopify",icon:e.jsx("img",{src:q3}),description:""},{name:"Amazon",platform:"amazon",icon:e.jsx("img",{src:K3}),description:"",isCommingSoon:!0},{name:"Ebay",platform:"ebay",icon:e.jsx("img",{src:Y3}),description:"",isCommingSoon:!0},{name:"Etsy",platform:"etsy",icon:e.jsx("img",{src:z3}),description:"",isCommingSoon:!0},{name:"Wix",platform:"wix",icon:e.jsx("img",{src:V3}),description:"",isCommingSoon:!0},{name:"Tiktok Shop",platform:"tiktok",icon:e.jsx("img",{src:Q3}),description:"",isCommingSoon:!0},{name:"WooCommerce",platform:"woocommerce",icon:e.jsx("img",{src:J3}),description:""},{name:"BigCommerce",platform:"bigcommerce",icon:e.jsx("img",{src:Z3}),description:"",isCommingSoon:!0},{name:"Squarespace",platform:"squarespace",icon:e.jsx("img",{src:X3}),description:"",isCommingSoon:!0}],sI=()=>{const{t}=J(),{isMobile:s}=xe(),n=bt(),a=de(),r=Pt(),[o,l]=be(G0),[c,u]=i.useState(""),[d,g]=i.useState(!1),[h,p]=i.useState("shopify"),x=i.useRef(null),f=Ru.find(T=>T.platform===h),_=a.getUserInfo(),b=o.open,v=_?.request_platform||[],y=()=>{l({...o,open:!1})},C=async()=>{if(!c||c.length===0)return;let T;if(h==="shopify")if(c.includes("admin.shopify.com")){const R=W0(c);R&&(T=`${R}.myshopify.com`)}else T=Si(c)+".myshopify.com";else T=ll(c);Ke.trackingEventUsersAction({event_name:$.STORE_CONNECTION_SUBMITTED,event_data:{platform:f?.platform||"",store_url:T||""}}),g(!0);const{status:k,data:O}=await a.authInstall({shop:T},h);
2234if(k===fe.OK&&O&&O.url){const R=O.url,P=a.getCurrentWorkPlace(),N=`https://id.zopi.io/auth/auto-login/connect?token=${ge.getToken()}&workplaceId=${P?.id||""}&linkAccount=1&connectUrl=${R}`;window.open(N)||window.location.replace(N)}g(!1)},S=async()=>{if(!f){n.success("Thank you for your request!");return}const T=[f.platform,..._?.request_platform||[]];Tn.requestIntegrationPlatform({platform:f.platform}),a.onUpdateDataAccount({..._,request_platform:T}),n.success("Thank you for your request!")},j=()=>{Ke.trackingEventUsersAction({event_name:$.STORE_CREATION_CLICKED}),window.open(Ts.create_new_store_aff,"_blank")},A=()=>{r.openChat()},E=e.jsxs("div",{className:"grid grid-cols-[1fr_424px] gap-4 max-md:grid-cols-1",children:[e.jsx("div",{className:"max-md:row-start-2",children:e.jsx(nt,{roundedAbove:"xs",padding:"400",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(m,{as:"p",variant:"headingMd",children:t("ChooseYourStorePlatform")}),e.jsx("div",{className:"flex flex-col gap-2",children:Ru.filter(T=>Ce.isShopifyEmbedded()?T.platform==="shopify":!0).map(T=>e.jsxs("div",{className:oe("p-3 border rounded-xl cursor-pointer flex justify-between items-center gap-2",h===T.platform?"border-input-border-active":"border-transparent"),onClick:()=>{p(T.platform)},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-6 shrink-0",children:T.icon}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:T.name})]}),e.jsx("span",{children:e.jsx(As,{label:"",labelHidden:!0,checked:h===T.platform})})]},T.name))}),e.jsx($e,{}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"shrink-0",children:e.jsx("img",{className:"size-20",src:$3,alt:""})}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"semibold",children:t("LaunchYourOwnStoreInSecondsWithZopiExpert")}),e.jsx(m,{as:"p",tone:"subdued",variant:"bodySm",children:t("SaveTimeWithAReadytolaunchStoreBuiltByEcommerceExpertsFromDayOne")}),e.jsx("div",{children:e.jsx(re,{onClick:()=>{x?.current?.openModal(),Ke.trackingEventUsersAction({event_name:$.HOME_PAGE_MAKE_REQUEST_CLICKED,event_data:{position:"drawer_connect_store_web_sa"}})},variant:"secondary",children:t("MakeARequest")})})]})]}),e.jsx(tI,{ref:x})]})})}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(nt,{roundedAbove:"xs",padding:"400",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(m,{as:"p",variant:"headingMd",children:t("ConnectZopiToYourStore")}),f?.isCommingSoon?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(kt,{title:"Coming soon!",children:e.jsx(m,{as:"p",children:t("ThisPlatformIsntSupportedAtTheMomentLetUsKnowIfYoudLikeUsToAddIt")})}),e.jsx(re,{disabled:v.includes(f.platform),loading:d,fullWidth:!0,variant:"primary",onClick:S,size:"large",children:v.includes(f.platform)?t("RequestSubmitted"):t("RequestIntegration")})]}):e.jsx(Hl,{onSubmit:C,children:e.jsxs(D,{gap:"300",children:[e.jsx(gt,{value:c,onChange:T=>{u(T.trim())},label:"Enter your store domain",autoComplete:"off",placeholder:h==="shopify"?"your-store.myshopify.com":"Enter store URL"}),e.jsx(re,{disabled:!c,loading:d,fullWidth:!0,variant:"primary",onClick:C,size:"large",children:t("Connect")})]})}),e.jsx("div",{className:"-mx-4 -mb-4 bg-[#F7F7F7] px-4 py-3.5 border-t border-border",children:f?.isCommingSoon?e.jsx(m,{as:"span",tone:"subdued",variant:"bodyMd",children:t("ViewWorkaroundMethodForUnsupportedPlatform",{linkComponent:e.jsx("a",{className:"underline",href:Ea.WORKAROUND_METHOD,target:"_blank",rel:"noreferrer",children:t("WorkaroundMethod")})})}):e.jsxs(m,{as:"span",tone:"subdued",variant:"bodyMd",children:[t("LearnMoreAbout")," ",e.jsx("a",{className:"underline",href:Ea.CONNECT_STORE,target:"_blank",rel:"noreferrer",children:t("ConnectingYourStore")})]})})]})}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(m,{as:"span",tone:"subdued",variant:"bodyMd",children:[t("DontHaveAStoreYet")," ",e.jsx("span",{className:"text-text-link cursor-pointer",onClick:()=>{Ke.trackingEventUsersAction({event_name:$.STORE_CREATION_CLICKED}),window.open(Ts.create_new_store_aff,"_blank")},id:"create-new-store-shopify-aff",children:t("CreateNowFor1Month")})]})})]})]});return s?e.jsx(e.Fragment,{children:e.jsx(xt,{visible:b,onClose:y,zIndex:176,showCloseIcon:!0,isButtonFullWidth:!0,title:t("ConnectStore"),children:e.jsx("div",{className:"p-4",children:E})})}):e.jsxs(Is,{width:"1072px",onClose:y,visible:b,zIndex:176,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-4 box-shadow-[var(--p-shadow-200)]",children:e.jsx(us,{title:t("ConnectStore"),backAction:{onAction:y},secondaryActions:[{content:t("ContactSupport"),onAction:A}],primaryAction:{content:t("GetAStoreFor1"),loading:d,onAction:j}})}),e.jsx(Q,{padding:"400",children:E})]})},Mh=ae({key:"productInsightDetailDrawerState",default:{visible:!1,productId:null}});ae({key:"productInsightDetailErrorState",default:""});const Wl=ae({key:"productInsightDataState",default:[]});ae({key:"piProductByLinkState",default:null});ae({key:"piReportByLinkState",default:null});
2234class nI{data;constructor(s){this.data=new Map,s.forEach(n=>{this.data.set(n.id,n)})}getProductById(s){return this.data.get(s)}getAllProducts(){return Array.from(this.data.values())}}const aI=ns({key:"productInsightDataSelector",get:({get:t})=>{const s=t(Wl);return new nI(s)}});function rI(){return ke(aI)}const iI=({image:t})=>{const{t:s}=J(),[n,a]=i.useState(0);i.useEffect(()=>{const o=setTimeout(()=>{a(1)},1500),l=setTimeout(()=>{a(2)},3e3),c=setTimeout(()=>{a(3)},1e4);return()=>{clearTimeout(o),clearTimeout(l),clearTimeout(c)}},[]);const r=o=>n>o?e.jsx("div",{className:"size-6 rounded-full flex items-center justify-center bg-icon text-white",children:e.jsx(ee,{source:Je,tone:"inherit"})}):n===o?e.jsx("div",{className:"size-6 flex items-center justify-center",children:e.jsx(nn,{size:"small"})}):e.jsx("div",{className:"rounded-full size-6 border-border border"});return e.jsx(nt,{roundedAbove:"xs",children:e.jsxs("div",{className:"grid lg:grid-cols-[auto_1fr] gap-5",children:[e.jsxs("div",{className:"w-full md:w-[300px] overflow-hidden relative",children:[e.jsx(pn,{source:t,alt:"",isSize:!1}),e.jsx("div",{className:"absolute bottom-2 left-2 right-2 bg-white rounded-lg border border-border p-2 shadow-400",children:e.jsxs("div",{className:"flex gap-4 items-center py-2",children:[e.jsx("div",{className:"grow flex items-center gap-2",children:e.jsx(Et,{hasUnderline:!0,content:s("ShowsOverallProductStrengthBasedOnProfitabilityAndBuyerDemand"),children:e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"bold",children:s("BestSellerScore")})})}),e.jsx(nn,{size:"small"})]})})]}),e.jsx("div",{className:"border border-border rounded-xl bg-white p-6",children:e.jsxs(D,{gap:"1000",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"bold",children:s("GeneratingProductInsightsReport")}),e.jsx(m,{as:"p",variant:"bodySm",children:s("ThisUsuallyTakes12Minutes")})]}),e.jsxs(D,{gap:"600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r(0),e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:s("AnalyzingYourProduct")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r(1),e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:s("AssessingMargins")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r(2),e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:s("CheckingBuyerInterest")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r(3),e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:s("GeneratingProductReport")})]})]})]})})]})})},Vn=()=>{const t=ke(ul),s=ke(V0),a=dt().getCurrency(),r=i.useCallback(C=>Ca(t,C,a),[a,t]),o=i.useCallback(({price:C,currencyStore:S})=>{if(S===a)return C;const j=Ca(t,S,a);return Vt(C*j)},[a,t]),l=i.useCallback((C,S,j="USD")=>{if(S===j)return C;const A=Ca(t,S,j);return Vt(C*A)},[t]),c=i.useCallback((C,S="USD")=>{const j=1/(t[`USD${S}`]||1),A=t[`USD${s.currency.currencyType}`]||1;return Vt(+C*j*A)},[t,s.currency.currencyType]),u=(C,S)=>{const j=`USD${S}`,A=t[j]||1;return Vt(C/A)},d=i.useCallback((C,S="USD")=>{const j=`USD${s.currency.currencyType}`,A=`USD${S}`;return s.currency.currencyType==="USD"?C*t[A]:S==="USD"?C/t[j]:C/t[j]*t[A]},[t,s.currency.currencyType]),g=i.useCallback(()=>t,[t]),h=i.useCallback(()=>{const C=(S="USD")=>Ca(t,S,s.currency.currencyType);return{currency:s.currency,getRateConfig:C,convertCurrencyFindProduct:c,convertCurrencyShopToUSD:d,convertToUSD:u}},[t,s]),p=i.useCallback(C=>Fe(Vt(+C)).toString(),[]),x=i.useCallback(()=>a,[a]),f=(C,S=!1)=>`${v().trim()}${On(Vt(h().convertCurrencyFindProduct(C)))}${S?` ${a}`:""}`,_=C=>On(Vt(h().convertCurrencyFindProduct(C))),b=(C,S=!1)=>`${v().trim()}${On(Vt(C))}${S?` ${a}`:""}`,v=i.useCallback(()=>s.currency.currencySymbol,[s.currency.currencySymbol]),y=i.useCallback((C,S,j="USD")=>{const A=Y0.find(k=>k.currencyType===j)?.currencySymbol||"";if(S===j)return`${A.trim()}${On(Vt(C))}`;const E=Ca(t,S,j),T=Vt(C*E);return`${A.trim()}${On(T)}`},[l,t]);return{formatConvertedNumber:_,exchangeRate:t,getRateShop:r,currencyFindProductConfig:h,convertPriceStoreToWorkplace:o,exchangeRateList:g,getPriceFixed:p,getCurrentShop:x,getCurrentSymbol:v,formatConvertedAmount:f,formatConvertedAmountWithCurrency:b,convertCurrency:l,convertCurrencyWithSymbol:y}}
2234,oI=({image:t,detail:s})=>{const{t:n}=J(),{formatConvertedAmount:a}=Vn(),{product_price:r,best_seller_score:o,profitability_score:l,buyer_interest_score:c,monthly_sales:u,top_countries:d,profit:g,status:h,profit_fallback:p}=s,x=d!==void 0&&h==="completed",f=i.useMemo(()=>{if(r===void 0)return;const C=g?g<0?0:g:0;return+r+C},[r,g]),_=i.useMemo(()=>{if(f!==void 0){if(u===0||u===null||+f==0)return 0;if(u!==void 0&&f!==void 0)return u*+f}},[u,f]),b=Object.keys(Zt).map(C=>({code:C,label:Zt[C].label,icon:Zt[C].icon})),v=i.useCallback(C=>C>=70?e.jsx(Bs,{tone:"success",children:n("High")}):C>=40?e.jsx(Bs,{tone:"warning",children:n("Medium")}):e.jsx(Bs,{tone:"critical",children:n("Low")}),[]),y=C=>C!=null||h==="completed";return e.jsx(nt,{roundedAbove:"xs",children:e.jsxs("div",{className:"grid lg:grid-cols-[auto_1fr_1fr] gap-5",children:[e.jsxs("div",{className:"w-full md:w-[300px] overflow-hidden relative",children:[e.jsx(pn,{source:t,alt:"",isSize:!1}),e.jsx("div",{className:"absolute bottom-2 left-2 right-2 bg-white rounded-lg border border-border p-2 shadow-400",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"grow flex items-center gap-2",children:[e.jsx(Et,{hasUnderline:!0,content:n("ShowsOverallProductStrengthBasedOnProfitabilityAndBuyerDemand"),children:e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"bold",children:n("BestSellerScore")})}),o!==void 0?v(o):null]}),o!==void 0?e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{as:"p",variant:"heading3xl",children:o})})}):e.jsx(Se,{height:48,width:60})]})})]}),e.jsx("div",{className:"border border-border rounded-xl bg-white p-6",children:e.jsx(D,{gap:"600",children:e.jsxs(D,{gap:"300",children:[e.jsxs(D,{gap:"100",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Et,{hasUnderline:!0,content:n("ShowsHowProfitableAProductIsBasedOnProfitPerUnitAndSalesVolume"),children:e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"bold",children:n("Profitability")})}),l?v(l):null]}),y(l)?e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{as:"p",variant:"heading3xl",children:l??"n/a"})}):e.jsx(Se,{height:48,width:60})]}),p&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex shrink-0",children:e.jsx(ee,{source:Na,tone:"caution"})}),e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",fontWeight:"medium",children:n("ProfitEstimatedFromUSMarketData")})]}),e.jsx($e,{}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(U,{align:"space-between",children:[e.jsx(m,{as:"p",variant:"bodySm",fontWeight:"bold",children:n("Profit")}),y(g)?e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"bold",children:g?a(g):"n/a"}):e.jsx(Se,{height:20,width:60})]}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:n("ProductSellingPrice")}),f!==void 0?e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:a(+f)}):e.jsx(Se,{height:12,width:40})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(U,{align:"space-between",children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"bold",children:n("MonthlyUnitsSold")}),y(u)?e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"bold",children:u?On(u):"n/a"}):e.jsx(Se,{height:20,width:60})]}),e.jsxs(U,{align:"space-between",children:[e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:n("EstmonthlyRevenue")}),y(_)?e.jsx(m,{as:"p",variant:"bodyXs",tone:"subdued",children:_?a(_):"n/a"}):e.jsx(Se,{height:12,width:40})]})]})]})]})})}),e.jsxs("div",{className:"h-full grid grid-rows-2 gap-5",children:[e.jsx("div",{className:"border border-border rounded-xl bg-white p-6",children:e.jsxs(D,{gap:"300",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Et,{hasUnderline:!0,content:n("ShowsCurrentBuyerDemandBasedOnKeywordPopularity"),children:e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"bold",children:n("BuyerInterest")})}),c?v(c):null]}),c!=null?e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{as:"p",variant:"heading3xl",children:c})}):e.jsx(Se,{height:48,width:60})]})}),e.jsx("div",{className:"border border-border rounded-xl bg-white p-6",children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx(m,{as:"p",variant:"headingMd",fontWeight:"bold",children:n("BestSellingCountries")}),x?d.length>0?e.jsx("div",{className:"flex gap-2",children:d&&d.length>0?d.slice(0,5).map(C=>{const j=b.find(A=>A.code===C.code)?.icon;return j?e.jsx("div",{className:"h-6 rounded overflow-hidden border border-gray-200",children:e.jsx(j,{className:"w-full h-full"})},C.code):null}):e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:"N/A"})}):e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:"N/A"}):e.jsx("div",{className:"flex gap-2 flex-wrap",children:Array.from({length:5}).map((C,S)=>e.jsx(Se,{height:24,width:40},S))})]})})]})]})})};se.div` 2235 height: 100%;
2236 & .Polaris-ShadowBevel { 2237 height: 100%; 2238 } 2239 & .Polaris-Box { 2240 padding: 0; 2241 } 2242 .Polaris-BlockStack { 2243 height: 100%; 2244 } 2245`;const Yn={POST_QUICK_CHECK:"product-research/product-insight/reports/refresh",GET_PRODUCT_REPORT_DETAIL:"product-research/product-insight/reports/:id",POST_CREATE_REPORT:"product-research/product-insight/reports",GET_SEARCH:"product-research/product-insight/reports",POST_MONTHLY_SALES:"product-research/product-insight/products/monthly-sales",GET_CHECK_HAS_REPORT:"product-research/product-insight/check-report",GET_PRODUCT_INSIGHT_LIST:"product-research/product-insight/public-reports",GET_PRODUCT_DETAIL:"product-research/product-insight/product-detail/:id"},lI=t=>X(Yn.POST_QUICK_CHECK,t,{method:"POST"}),cI=t=>{const s=Yn.GET_PRODUCT_REPORT_DETAIL.replace(":id",t.toString());return X(s,{},{method:"GET"})},dI=t=>{const s={per_page:t.per_page,page:t.page};return t.search&&t.search.trim()&&(s.search=t.search.trim()),X(Yn.GET_SEARCH,s,{method:"GET"})},uI=t=>X(Yn.POST_CREATE_REPORT,t,{method:"POST"}),pI=t=>X(Yn.POST_MONTHLY_SALES,t,{method:"POST"}),hI=t=>X(Yn.GET_CHECK_HAS_REPORT,t,{method:"GET"}),gI=t=>X(Yn.GET_PRODUCT_INSIGHT_LIST,t,{method:"GET"}),mI=async t=>{const s=Yn.GET_PRODUCT_DETAIL.replace(":source",t.source).replace(":id",t.productId);return X(s,t.isBySeller?{by_seller:!0}:{})},qa={quickCheckProducts:lI,getProductInsightReportDetail:cI,createReportProductInsight:uI,searchProduct:dI,getMonthlySales:pI,getCheckHasReport:hI,getProductInsightList:gI,getProductDetail:mI},fI=({productId:t,enabled:s=!0,analyzeSucess:n})=>ks({queryKey:vt.productInsights.detail(t,n),queryFn:async()=>{if(!t)return null;const{status:a,data:r}=await qa.getProductInsightReportDetail(t);return a===fe.OK&&r?r:null},enabled:s&&!!t,staleTime(a){return(a?.state.data?a.state.data.status:null)==="completed"?5*60*1e3:0}}),xI=({detail:t,isLoading:s})=>{const{t:n}=J(),{isMobile:a}=xe(),[r,o]=i.useState({}),l=t?.ad_creative?.target_demographics?.interests,c=t?.ad_creative?.target_demographics?.age_range,u=t?.ad_creative?.target_demographics?.habits,d=t?.ad_creative?.target_demographics?.buyer_biases,g=t?.ad_creative?.best_advertising_angles,h=t?.ad_creative?.creative_themes,p=async(f,_)=>{try{await navigator.clipboard.writeText(f),o(b=>({...b,[_]:!0})),setTimeout(()=>{o(b=>({...b,[_]:!1}))},1500)}catch{o(v=>({...v,[_]:!1}))}},x=(f,_)=>e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:_}),e.jsx(U,{gap:"200",wrap:!0,children:f!==void 0?f.length>0?f.map((b,v)=>e.jsx(wt,{children:b},`${b}-${v}`)):e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:"n/a"}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{height:20,width:60}),e.jsx(Se,{height:20,width:60})]})})]});return e.jsx(D,{gap:"400",children:e.jsxs(ft,{columns:a?"1":"2",gap:a?"300":"400",children:[e.jsx(nt,{roundedAbove:"xs",children:e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"h3",variant:"headingMd",fontWeight:"semibold",children:n("TargetDemographics")}),e.jsxs(D,{gap:"400",children:[x(l,n("InterestTags")),x(c,n("AgeRanges")),x(u,n("Habits")),x(d,n("Biases"))]})]})}),e.jsx(nt,{roundedAbove:"xs",children:e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"h3",variant:"headingMd",fontWeight:"semibold",children:n("BestAdvertisingAngles")}),e.jsx(D,{gap:"400",children:g!==void 0?g.length>0?g.map((f,_)=>e.jsx(nt,{roundedAbove:"xs",children:e.jsxs(U,{align:"space-between",gap:"400",blockAlign:"center",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(m,{as:"p",variant:"bodyMd",children:f})}),e.jsx("div",{children:r[_]?e.jsx(re,{disabled:r[_],onClick:()=>p(f,_),icon:e.jsx(rm,{className:"size-5"})}):e.jsx(re,{disabled:r[_],onClick:()=>p(f,_),icon:e.jsx(jp,{className:"size-5"})})})]})},`hook-${_}`)):e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:n("NoHooksAvailable")}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{height:60}),e.jsx(Se,{height:60}),e.jsx(Se,{height:60})]})}),e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:n("CreativeThemes")}),e.jsx(U,{gap:"200",wrap:!0,children:h!==void 0?h.length>0?h.map((f,_)=>e.jsx(wt,{children:f},`theme-${_}`)):e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:n("NoThemesAvailable")}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{height:20,width:80}),e.jsx(Se,{height:20,width:80}),e.jsx(Se,{height:20,width:80})]})})]})]})})]})})},_I=({detail:t,isLoading:s})=>{const{t:n}=J();xe();const[a,r]=i.useState("90d");n("LastCountDays",{count:7}),n("LastCountDays",{count:30}),n("LastCountDays",{count:90}),n("LastNumberMonths",{count:12});const o=i.useMemo(()=>
2245{if(!t?.trend_chart||typeof t.trend_chart!="object")return null;const c=t.trend_chart[a];return Array.isArray(c)?c:t.status==="completed"?[]:null},[t?.trend_chart,a]),l=i.useMemo(()=>[{name:n("SearchPopularity"),color:"#3B82F6",data:(o||[]).map(c=>({key:c.date,value:c.value}))}],[o,n]);return e.jsx(D,{gap:"400",children:e.jsx(nt,{roundedAbove:"xs",children:e.jsxs(D,{gap:"400",children:[e.jsx(U,{align:"space-between",blockAlign:"center",children:e.jsx(m,{as:"h3",variant:"headingMd",fontWeight:"bold",children:n("GoogleTrends")})}),e.jsx(Q,{children:o!==null?o.length>0?e.jsx("div",{style:{height:"400px"},children:e.jsx(lA.LineChart,{data:l,chartContainer:{minHeight:400},xAxisOptions:{labelFormatter:c=>`${c}`},yAxisOptions:{labelFormatter:c=>`${c}`}})}):e.jsx("div",{style:{height:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:n("NoTrendsDataAvailable")})}):e.jsx(Se,{height:400,width:"100%"})})]})})})},bI=()=>{const{isMobile:t}=xe(),[s,n]=be(Mh),a=rI(),r=i.useRef(null),o=s.productId,l=o?a.getProductById(o):void 0,c=l?.status==="processing",{data:u,isPending:d}
2245=fI({productId:o?+o:null,enabled:!!o&&!!l?.trendReady,analyzeSucess:l?.status==="success"?"success":void 0}),g=i.useMemo(()=>l?{...l.dataDetail,...r.current,...u,product_image:l.image}:{},[l,u]);i.useEffect(()=>{u&&(r.current=u)},[u]);const h=()=>{n({visible:!1,productId:null}),r.current=null},p=l?.trendReady?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(oI,{detail:g,image:l?.image||""}),e.jsx(_I,{detail:g,isLoading:d||c}),e.jsx(xI,{detail:g,isLoading:d||c})]}):e.jsx(iI,{image:l?.image||""});return t?e.jsxs(xt,{visible:s.visible,onClose:h,placement:"right",children:[e.jsx("div",{className:"sticky top-0 left-0 z-[1000] bg-bg-surface border-b border-border px-4 pt-4 pb-3",children:e.jsxs(U,{gap:"200",blockAlign:"center",wrap:!1,align:"start",children:[e.jsx("div",{className:"shrink inline-flex",children:e.jsx(re,{onClick:h,variant:"monochromePlain",icon:Mn})}),e.jsx("div",{className:"grid",children:e.jsx(m,{as:"h4",variant:"headingMd",truncate:!0,children:l?.title||"Product insight detail"})})]})}),e.jsx("p",{className:"bg-bg-surface-active p-4",children:p})]}):e.jsxs(Is,{visible:s.visible,onClose:h,width:1050,children:[e.jsx("div",{className:"px-4 bg-bg-surface border-b border-border sticky top-0 left-0 z-[171]",children:e.jsx(us,{className:"[&_.Polaris-Header-Title\\_\\_TitleWrapper_.Polaris-Header-Title]:line-clamp-1 [&_.Polaris-Header-Title\\_\\_TitleWrapper]:flex-nowrap",title:l?.title||"Product insight detail",backAction:{onAction:h}})}),e.jsx("div",{className:"p-4",children:p})]})},yI=()=>{const{getCurrentPlan:t}=de(),s=t(),[n,a]=be(Gn),{isMobile:r}=xe(),o=i.useRef(null),l=he(Gt),c=he(Rn),u=()=>{a(!1);const d=new URLSearchParams(location.search);d.get("show-change-plan")==="true"&&(d.delete("show-change-plan"),history.replaceState(null,"",`${location.pathname}?${d}`))};return i.useEffect(()=>{o.current&&clearTimeout(o.current);const d=new URLSearchParams(location.search);return d.get("show-change-plan")==="true"&&(o.current=setTimeout(()=>{a(!0)},1e3)),(d.get("app")||"AO")==="AO"&&c("AO"),()=>{o.current&&clearTimeout(o.current)}},[]),i.useEffect(()=>{r&&(s?.package?.price||0)>0&&l(s?.package?.cycle===365?"yearly":"monthly")},[s?.package,r]),i.useEffect(()=>{a(!1)},[location.pathname]),e.jsx(xt,{visible:n,onClose:u,background:"bg",showCloseIcon:!r,styleContent:{height:"100%"},placement:r?"right":"bottom",children:e.jsx("div",{className:"mt-4",children:e.jsx(Tl,{id:"drawer-page-change-plan",hiddenTitle:!0})})})},CI=ae({key:"paymentInfoState",default:[]}),Uh=ae({key:"paymentOrderNoState",default:new Set}),Fh=ae({key:"paymentLinkState",default:""}),vI=ae({key:"paymentOrderNoAutoState",default:[]}),AI=ae({key:"similarProductShippingState",default:{}}),Bh=ae({key:"dataFetchSupplierOrderState",default:{}}),Er={is_publish:!0,allow_sell_out_of_stock:!0,sync_order:!0},SI={...Er,warehouse_id:"",weight:{value:1,unit:"kilogram"},dimension:{height:1,width:1,length:1,unit:"centimeter"}}
2245,Hh=ae({key:"channelShopifySettingState",default:Er}),Gh=ae({key:"channelWooSettingState",default:Er}),Wh=ae({key:"channelTiktokSettingState",default:SI}),jI=ae({key:"channelFacebookSettingState",default:Er}),EI=ae({key:"channelGoogleSettingState",default:Er}),TI=ns({key:"channelSettingState",get:({get:t})=>({shopify:t(Hh),woocommerce:t(Gh),tiktok:t(Wh),facebook:t(jI),google:t(EI)})});ae({key:"isFetchedWarehouseState",default:!1});const PI=ae({key:"tiktokWarehouseState",default:[]});ns({key:"tiktokWarehouseOptionsState",get:({get:t})=>t(PI).map(n=>({value:n.id,label:n.name}))});const II=ae({key:"visibleModalUpgradeState",default:{open:!1,plan:"starter"}}),RI=()=>{const[t,s]=be(II),n=pt(),a=()=>{n(Y.BILLING_PLAN.PATH),s({open:!1})};return window.is_hide_billing?null:e.jsx(e.Fragment,{children:e.jsx(Xe,{onClose:()=>s({open:!1}),open:t.open,title:"Upgrade plan",sectioned:!0,size:"small",primaryAction:{content:"Upgrade now",onAction:a},children:t.plan==="advancer"?"Only available on Advanced plan and higher. Upgrade to unlock this feature.":"Only available on Starter plan and higher. Upgrade to unlock this feature."})})},kI="/assets/introduce-mapped-by-zopi-BiXTBvHw.png",wI=()=>{const{t}=J(),s=de(),n=s.getUserInfo(),a=la(na),r=()=>{o()},o=()=>{a(),Cs.updateValueOnboarding({key:Ut.OB_MAPPED_BY_ZOPI}),s.onUpdateUserInfo({...n,remaining_meta_keys:{...n.remaining_meta_keys,[Ut.OB_MAPPED_BY_ZOPI]:!0}})};return e.jsx(Q,{paddingBlock:"300",children:e.jsxs(D,{children:[e.jsxs(D,{gap:"300",children:[e.jsx("img",{src:kI,alt:""}),e.jsxs(D,{children:[e.jsx(m,{as:"span",fontWeight:"semibold",variant:"headingMd",children:"Check supplier mapped to product"}),e.jsx(m,{as:"span",children:"Check or update the supplier mapped to your order to make sure everything matches correctly."})]})]}),e.jsx(Q,{children:e.jsx(U,{gap:"200",align:"end",children:e.jsx(re,{variant:"primary",onClick:()=>{r()},children:t("IUnderStand")})})})]})})},NI={zopi_mapped:[{target:"[id*=tour-image-mapped-by-zopi]",content:e.jsx(wI,{}),disableBeacon:!0,placement:"bottom-end",hideCloseButton:!0,disableCloseOnEsc:!0,disableOverlayClose:!0}]},ei=({content:t})=>{const{t:s}=J(),n=la(na),a=i.useMemo(()=>e.jsx(m,{as:"span",tone:"magic",children:s("GotIt")}),[]),r=i.useCallback(()=>{let o;switch(t){case"StepTourContentFindSupplier":o="imported_ai_dim_supplier_gotit_click";break;case"StepTourContentImage":o="imported_ai_dim_image_gotit_click";break;case"StepTourContentRewrite":o="imported_ai_dim_content_gotit_click";break;default:o="imported_ai_dim_price_gotit_click";break}ss(o,{}),n()},[n,t]);return e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"p",children:s(t)}),e.jsx(U,{align:"end",children:e.jsx(re,{onClick:r,variant:"tertiary",children:a})})]})},ti={ai_enhance_supplier:[{target:"#enhance-tour-supplier",content:e.jsx(ei,{content:"StepTourContentFindSupplier"}),placement:"bottom",disableBeacon:!0,hideCloseButton:!0,spotlightClicks:!0,disableOverlayClose:!0}],ai_enhance_thumnail:[{target:"#enhance-tour-thumnail",content:e.jsx(ei,{content:"StepTourContentImage"}),placement:"bottom",disableBeacon:!0,hideCloseButton:!0,spotlightClicks:!0,disableOverlayClose:!0}],ai_enhance_content:[{target:"#enhance-tour-content",content:e.jsx(ei,{content:"StepTourContentRewrite"}),placement:"bottom",disableBeacon:!0,hideCloseButton:!0,spotlightClicks:!0,disableOverlayClose:!0}],ai_enhance_pricing:[{target:"#enhance-tour-pricing",content:e.jsx(ei,{content:"StepTourContentSelling"}),placement:"bottom",disableBeacon:!0,hideCloseButton:!0,spotlightClicks:!0,disableOverlayClose:!0}]},OI="/assets/introduce-zopi-source-CRenCPMM.gif",DI=()=>{const{t}=J(),{onUpdateUserInfo:s,getUserInfo:n}=de(),a=n(),r=la(na),o=()=>{l()},l=()=>{r(),s({...a,remaining_meta_keys:{...a.remaining_meta_keys,[Ut.NEW_FEATURE_ORDER]:!0}})};return e.jsx("div",{style:{width:350,maxWidth:"100vw"},children:e.jsxs(D,{children:[e.jsx(D,{gap:"100",children:e.jsx("div",{className:"msui-text-center",children:e.jsx("img",{src:OI,alt:""})})}),e.jsx(Q,{padding:"300",children:e.jsx(U,{gap:"200",align:"end",children:e.jsx(re,{variant:"primary",onClick:()=>{o()},children:t("IUnderStand")})})})]})})},LI={zopi_fulfillment:[{target:"[id*=btn-switch-source-zopi]",content:e.jsx(DI,{}),disableBeacon:!0,hideCloseButton:!0,disableOverlayClose:!0,disableCloseOnEsc:!0,disableScrollParentFix:!1,disableOverlay:!1,disableScrolling:!1,isFixed:!0}]},MI=()=>{const{t}=J(),s=ke(na),n=()=>{s.data.product_center_push_to_store&&s.data.product_center_push_to_store.data.onSkip?.()},a=()=>{s.data.product_center_push_to_store&&s.data.product_center_push_to_store.data.onTryNow?.()};return e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"p",children:t("ClickHereToPushTheProductOnYourStore")}),e.jsxs(U,{align:"space-between",children:[e.jsx(re,{onClick:n,children:t("Skip")}),e.jsx(re,{onClick:a,variant:"primary",children:t("TryNow")})]})]})},UI={product_center_push_to_store:[{target:'[role="btnPushToStore"]',content:e.jsx(MI,{}),disableBeacon:!0,placement:"bottom-end",hideCloseButton:!0,disableCloseOnEsc:!0,disableOverlayClose:!0}]},ku={ai_enhance_supplier:ti.ai_enhance_supplier,ai_enhance_content:ti.ai_enhance_content,ai_enhance_thumnail:ti.ai_enhance_thumnail,ai_enhance_pricing:ti.ai_enhance_pricing,product_center_push_to_store:UI.product_center_push_to_store,zopi_fulfillment:LI.zopi_fulfillment,zopi_mapped:NI.zopi_mapped},FI=({continuous:t,index:s,step:n,backProps:a,closeProps:r,primaryProps:o,tooltipProps:l,size:c,skipProps:u,isLastStep:d})=>{const g=ke(na),h=g?.isHideFooterAction||!1;return e.jsx("div",{className:"react-joyride__tooltip",style:{width:g.tour==="zopi_fulfillment"?350:320,display:"flex",flexDirection:"column",gap:"var(--p-space-400)",borderRadius:"var(--p-border-radius-200)",padding:g.tour==="zopi_fulfillment"?0:"var(--p-space-300) var(--p-space-500)",backgroundColor:"var(--p-color-bg-surface)"},children:e.jsxs(D,{gap:"400",children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{children:n.content}),!n.hideCloseButton&&e.jsx("div",{style:{position:"absolute",right:0,top:0},children:e.jsx(re,{icon:Ws,variant:"monochromePlain",onClick:u.onClick})})]}),!h&&e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsx("div",{}),c>1&&e.jsx("div",{style:{flex:"1 1 0%"},children:e.jsxs("span",{children:[s+1," of ",c]})}),e.jsxs(U,{gap:"300",children:[s>0&&e.jsx(re,{id:"button-back",variant:"monochromePlain",onClick:a.onClick,children:"Back"}),d&&e.jsx(re,{variant:"primary",id:"button-Close",onClick:u.onClick,children:c>1?"Done":"Got it"}),t&&!d&&e.jsx(re,{variant:"primary",id:"button-primary",onClick:o.onClick,children:"Next"})]})]})]})})},BI=()=>{de()?.getUserInfo();const[s,n]=i.useState({run:!1,stepIndex:0,steps:[]}),[a,r]=be(na),o=la(na),l=zs(),c=u=>{const{action:d,index:g,status:h,type:p}=u;(p===fc.TOUR_END||[Hi.FINISHED,Hi.SKIPPED,Hi].includes(h)||[y1.CLOSE].includes(d))&&(n({run:!1,stepIndex:0,steps:[]}),a.tour,r(x=>({...a,tour:"",data:{...a.data,[x.tour]:{...a.data[x.tour],finished:!0}}}))),console.log(p===fc.TOUR_STATUS?`${p}:${h}`:p,u)};return i.useEffect(()=>{a&&ku[a.tour]?n({run:!0,stepIndex:0,steps:ku[a.tour]}):n({run:!1,stepIndex:0,steps:[]})},[a]),i.useEffect(()=>{s.run?(document.body.style.overflow="hidden",document.body.style.height="fit-content"):(document.body.style.overflow="",document.body.style.height="100%")},[s.run]),i.useEffect(()=>{o()},[l.pathname]),e.jsx(b1,{tooltipComponent:FI,continuous:!0,showProgress:!0,disableScrollParentFix:!0,disableScrolling:!0,scrollDuration:1500,scrollToFirstStep:!0,showSkipButton:!0,...s,callback:c,styles:{options:{zIndex:400},overlay:{maxHeight:"100%"}}})};class Sa{static instance;listeners=new Map;constructor(){}static getInstance(){return Sa.instance||(Sa.instance=new Sa),Sa.instance}subscribe(s,n){return this.listeners.has(s)||this.listeners.set(s,new Set),this.listeners.get(s).add(n),()=>{this.listeners.get(s)?.delete(n)}}emit(s){this.listeners.get(s.type)?.forEach(n=>n(s))}}const Zs=Sa.getInstance(),Vl=(t,s,n=[])=>{const a=i.useCallback(s,n);i.useEffect(()=>Zs.subscribe(t,a),[t,a])},oa=t=>t.pushScope==="pushed"||t.pushScope===void 0,Ra=t=>t.pushScope==="updated",Ci=t=>t.pushScope==="unmap",HI=(t,s)=>{switch(s){case"all":return!0;case"unmap":return Ci(t);case"pushed":return oa(t);case"updated":return Ra(t);default:return!1}},GI=()=>{const{getUserInfo:t,onUpdateUserInfo:s}=de(),n=t(),[a,r]=i.useState(!1),o=i.useRef(!1),l=n?.remaining_meta_keys||{},c=i.useMemo(()=>l[Ut.SHOWED_MODAL_AR],[l]),u=i.useCallback(()=>
2245{c||(l[Ut.SHOWED_MODAL_AR]=!0,Cs.updateValueOnboarding({key:Ut.SHOWED_MODAL_AR,value:!0}),s({...n,remaining_meta_keys:l}))},[c,n]),d=i.useCallback(()=>{Ke.trackingEventUsersAction({event_name:$.MARKETING_APP_MODAL_VIEWED,event_data:{action:"modal_ar_close"}}),r(!1),u()},[]);return Vl("TOAST_ITEM_SUCCESS",g=>{g.payload.product&&!oa(g.payload.product)||o.current||c||(o.current=!0,Ke.trackingEventUsersAction({event_name:$.MARKETING_APP_MODAL_VIEWED,event_data:{action:"modal_ar_load"}}),r(!0))},[c]),a?jm.createPortal(e.jsx("div",{className:"fixed bottom-6 left-6 z-[var(--p-z-index-1)] w-[350px] max-w-[calc(100vw-32px)]",children:e.jsx($p,{variant:"toast",onDismiss:d,objUrl:{utm_medium:"push-product"}})}),document.body):null},wN=ae({key:"productEditorDrawerSessionState",default:{isOpen:!1,productId:null}}),NN=ae({key:"productEditorServerPushingState",default:{editorEsId:null,serverPushing:!1}}),ON=ae({key:"productImportFromStoreState",default:!1}),Vh=ae({key:"processImportState",default:{data:[],withSettingChannel:void 0}}),Yh=ae({key:"favouriteState",default:[]}),Yl=ae({key:"toastProcessPushState",default:[]}),zh=ae({key:"isVisibleToastPushMultipleState",default:!1});class WI{productMap;channelMap;channelStatusMap;splitList;duplicateList;importList;constructor(s){this.productMap=new Map,this.channelMap=new Map,this.channelStatusMap=new Map,this.splitList=new Map,this.duplicateList=new Map,this.importList=new Map,s.forEac
2245h(n=>{if(this.productMap.has(n.id+"")||this.productMap.set(n.id+"",[]),this.productMap.get(n.id+"").push(n),n.channel){this.channelMap.has(n.channel)||this.channelMap.set(n.channel,[]),this.channelMap.get(n.channel).push(n);const a=`${n.channel}-${n.status}`;this.channelStatusMap.has(a)||this.channelStatusMap.set(a,[]),this.channelStatusMap.get(a).push(n)}n.split&&this.splitList.set(n.id,n),n.duplicate&&this.duplicateList.set(n.id,n),n.import&&this.importList.set(n.id,n)})}get size(){let s=0;const n=this.splitList.size,a=this.duplicateList.size,r=this.importList.size;return this.channelMap.forEach(o=>{s+=o.length}),s+n+a+r}get uniqueProductsCount(){return this.productMap.size}has(s,n,a){const r=this.productMap.get(s+"")?.filter(o=>o.channel);return r?a&&n?r.some(o=>n==="done"?o.channel===a&&(o.status==="success"||o.status==="error"):o.channel===a&&o.status===n):a?r.some(o=>o.channel===a):n?r.some(o=>n==="done"?o.status==="success"||o.status==="error":o.status===n):!0:!1}hasProcess(s){const n=this.productMap.get(s+"");return n?n.some(a=>a.status==="processing"):!1}hasImport(s,n){const a=this.importList.get(s);return a?n?n==="done"?a.status==="success"||a.status==="error":a.status===n:!0:!1}get(s){return this.productMap.get(s)?.[0]}getAllPush(){return Array.from(this.channelMap.values()).flat()}getChannelStatusCount(s,n){if(!n){const r=this.getByChannel(s);return{uniqueProducts:new Set(r.map(o=>o.id)).size,totalEntries:r.length}}const a=this.getByChannelAndStatus(s,n);return{uniqueProducts:new Set(a.map(r=>r.id)).size,totalEntries:a.length}}getByChannel(s){return this.channelMap.get(s)||[]}getByChannelAndStatus(s,n){const a=`${s}-${n}`;return this.channelStatusMap.get(a)||[]}getActiveChannels(){return Array.from(this.channelMap.keys())}getChannelSummary(s){const n=this.channelMap.get(s)||[],a={total:n.length,processing:0,success:0,error:0,done:0};return n.forEach(r=>{r.status==="processing"?a.processing++:(a[r.status]++,a.done++)}),a}getStatusPushCount(s){const n=new Set;let a=0;return this.channelMap.forEach(r=>{r.forEach(o=>{s==="done"?(o.status==="success"||o.status==="error")&&(n.add(o.id+""),a++):o.status===s&&(n.add(o.id+""),a++)})}),{uniqueProductsIds:n,uniqueProducts:n.size,totalEntries:a}}getPushProductSummary(s="all"){const n={total:0,processing:0,success:0,error:0,done:0};let a=0;return this.channelMap.forEach(r=>{r.forEach(o=>{HI(o,s)&&(a++,o.status==="processing"?n.processing++:(n[o.status]++,n.done++))})}),n.total=a,n}getSizeSummary(){return{totalEntries:this.size,uniqueProducts:this.uniqueProductsCount,byChannel:Object.fromEntries(this.getActiveChannels().map(s=>[s,this.getByChannel(s).length]))}}getSplitItems(){return Array.from(this.splitList.values())}getSplitSummary(){const s={total:this.splitList.size,processing:0,success:0,error:0,done:0};return this.splitList.forEach(n=>{n.status==="processing"?s.processing++:(s[n.status]++,s.done++)}),s}getStatusSplitCount(s){const n=new Set;let a=0;return this.splitList.forEach(r=>{s==="done"?(r.status==="success"||r.status==="error")&&(n.add(r.id+""),a++):r.status===s&&(n.add(r.id+""),a++)}),{uniqueProductsIds:n,uniqueProducts:n.size,totalEntries:a}}getDuplicateItems(){return Array.from(this.duplicateList.values())}getDuplicateSummary(){const s={total:this.duplicateList.size,processing:0,success:0,error:0,done:0};return this.duplicateList.forEach(n=>{n.status==="processing"?s.processing++:(s[n.status]++,s.done++)}),s}getStatusDuplicateCount=s=>{const n=new Set;let a=0;return this.duplicateList.forEach(r=>{s==="done"?(r.status==="success"||r.status==="error")&&(n.add(r.id+""),a++):r.status===s&&(n.add(r.id+""),a++)}),{uniqueProductsIds:n,uniqueProducts:n.size,totalEntries:a}};getImportItems(){return Array.from(this.importList.values())}getImportById(s){return this.importList.get(s)}getImportSummary(){const s={total:this.importList.size,processing:0,success:0,error:0,done:0};return this.importList.forEach(n=>{n.status==="processing"?s.processing++:(s[n.status]++,s.done++)}),s}getStatusImportCount(s){const n=new Set;let a=0;return this.importList.forEach(r=>{s==="done"?(r.status==="success"||r.status==="error")&&(n.add(r.id+""),a++):r.status===s&&(n.add(r.id+""),a++)}),{uniqueProductsIds:n,uniqueProducts:n.size,totalEntries:a}}getTotalAllStatus(){return[this.getPushProductSummary(),this.get
2245SplitSummary(),this.getDuplicateSummary(),this.getImportSummary()].reduce((n,a)=>({processing:n.processing+a.processing,success:n.success+a.success,error:n.error+a.error,done:n.done+a.done}),{processing:0,success:0,error:0,done:0})}getStatusCount(s){const n=[this.getStatusPushCount(s),this.getStatusSplitCount(s),this.getStatusDuplicateCount(s),this.getStatusImportCount(s)],a=new Set;let r=0;return n.forEach(({totalEntries:o,uniqueProductsIds:l})=>{r+=o,l.forEach(c=>a.add(c))}),{uniqueProductsIds:a,uniqueProducts:a.size,totalEntries:r}}}const gn=()=>{const t=ke(Yl);return i.useMemo(()=>new WI(t),[t])};class VI{tagById=new Map;listeners=new Set;set(s){this.tagById=new Map(s.map(n=>[n.id,n.tag])),this.notify()}add(s){s.forEach(n=>this.tagById.set(n.id,n.tag)),this.notify()}has(s){return this.tagById.has(s+"")}getTag(s){return this.tagById.get(s+"")}get size(){return this.tagById.size}getSnapshot(){return this.tagById}subscribe(s){return this.listeners.add(s),()=>this.listeners.delete(s)}notify(){this.listeners.forEach(s=>s())}}const ea=new VI,DN=()=>i.useSyncExternalStore(t=>ea.subscribe(t),()=>ea.getSnapshot()),YI=({onOpenDrawer:t})=>{const{t:s}=J();pt();const n=gn(),a=i.useMemo(()=>n.size,[n]);return e.jsxs("div",{className:"flex items-center justify-left gap-2",children:[e.jsx("div",{children:e.jsx(m,{as:"p",variant:"headingMd",tone:"text-inverse",children:s("QueuedSuccessfully",{count:a})})}),e.jsx("div",{children:e.jsx(ds,{source:Je,tone:"success"})})]})},wi=()=>{const t=he(Yl),s=he(Vh),[,n]=be(zh),a=gn(),r=d=>{const g={channel:d.channel,split:d.split?"split":void 0,duplicate:d.duplicate?"duplicate":void 0,id:d.id,pushScope:d.pushScope};return Object.values(g).join("-")},o=i.useCallback(d=>{t(g=>{const h=new Map,p=[],x=[];let f=!1;const _=[],b=[];let v=!1;g.forEach(C=>{const S=r(C);h.set(S,C)}),d.forEach(C=>{const S=r(C);h.set(S,C),C.duplicate&&(f=!0),C.split&&(v=!0)});const y=Array.from(h.values());return setTimeout(()=>{y.some(C=>oa(C)||Ra(C))&&n(!0)},0),f&&(y.forEach(C=>{C.duplicate&&C.status==="processing"?p.push(C):C.duplicate&&C.status!=="processing"&&x.push(C)}),p.length===0&&x.length>0&&Zs.emit({type:"TOAST_DUPLICATE_COMPLETED",payload:{timestamp:Date.now(),products:x}})),v&&(y.forEach(C=>{C.split&&C.status==="processing"?_.push(C):C.split&&C.status!=="processing"&&b.push(C)}),_.length===0&&b.length>0&&Zs.emit({type:"TOAST_SPLIT_COMPLETED",payload:{timestamp:Date.now(),products:b}})),y})},[t,n]),l=i.useCallback((d,g,h)=>{s(p=>{if(g==="new")return{data:d,withSettingChannel:h??void 0};const x=[...d,...p.data].reduce((_,b)=>(_.get(b.id)||_.set(b.id,b),_),new Map);return{data:Array.from(x.values()),withSettingChannel:h??void 0}})},[s]),c=i.useCallback(()=>{n(!1)},[a,n]),u=i.useCallback(d=>{t(g=>{const h=new Set(d.map(p=>r({...p,split:void 0,duplicate:void 0})));return g.filter(p=>!h.has(r(p)))})},[t]);return{setDataPushProcess:o,setDataImportProcess:l,closeToast:c,removeDataPushProcess:u}},zI=({isCollapse:t,onToggleCollapse:s})=>{const{closeToast:n}=wi(),a=i.useCallback(()=>{n()},[n]);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wu,{children:e.jsx(re,{onClick:s,variant:"monochromePlain",icon:t?Rs:Pn})}),e.jsx(wu,{children:e.jsx(re,{variant:"monochromePlain",icon:Ws,onClick:a})})]})},wu=se.div` 2246 max-height: 20px; 2247 color: var(--p-color-icon-inverse); 2248`,KI=({isCollapse:t,onToggleCollapse:s})=>e.jsx("div",{className:"cursor-pointer",onClick:s,children:e.jsx(Q,{padding:"300",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(YI,{}),e.jsx(zI,{isCollapse:t})]})})}),Ss={processing:1,error:2,success:3};se.div` 2249 .Polaris-Button { 2250 color: rgba(119, 41, 238, 1); 2251 :hover, 2252 :active, 2253 :focus { 2254 text-decoration: none !important; 2255 color: rgba(119, 41, 238, 1) !important; 2256 } 2257 svg { 2258 fill: rgba(119, 41, 238, 1) !important; 2259 } 2260 &.Polaris-Button--disabled { 2261 color: rgb(132 116 155 / 98%) !important; 2262 svg { 2263 fill: rgb(132 116 155 / 98%) !important; 2264 } 2265 } 2266 } 2267`;const LN=se.div` 2268 display: grid; 2269 gap: 4px; 2270`,MN=se.div` 2271 position: relative; 2272 &.disabled::before { 2273 content: ' '; 2274 position: absolute; 2275 inset: 0; 2276 z-index: 30; 2277 border-radius: 6px; 2278 background-color: #00000011; 2279 } 2280 &.disabled.z-index-105::before { 2281 z-index: 105; 2282 } 2283`;se.div` 2284 * { 2285 margin: 0 !important; 2286 } 2287 display: flex; 2288 button { 2289 padding: 0 !important; 2290 min-height: auto !important; 2291 min-width: auto !important; 2292 } 2293`;se.div` 2294 .Polaris-LegacyCard { 2295 box-shadow: none; 2296 } 2297`;se.div` 2298 .box-line { 2299 width: 148px; 2300 height: 118px; 2301 display: flex; 2302 padding: 8px; 2303 flex-direction: column; 2304 align-items: flex-start; 2305 gap: 6px; 2306 background: var(--background-default, #f6f6f7); 2307 .line { 2308 display: flex; 2309 align-items: flex-start; 2310 gap: 6px; 2311 } 2312 .line-item { 2313 width: 40px; 2314 height: 30px; 2315 background: var(--p-color-bg-surface-disabled); 2316 cursor: pointer; 2317 &.disabled { 2318 } 2319 &.active, 2320 &:hover:not(.disabled) { 2321 background: var(--icon-interactive, #2c6ecb); 2322 } 2323 &.disabled { 2324 background: var(--p-color-bg-surface-disabled); 2325 } 2326 &.active.disabled { 2327 background: var(--icon-disabled, #babec3); 2328 } 2329 } 2330 } 2331`;se.div` 2332 .dot {
2333 width: 8px; 2334 height: 8px; 2335 border-radius: 2px; 2336 margin-top: 1px; 2337 display: block; 2338 border: 1px solid var(--border-default, #8c9196); 2339 &.pushed { 2340 background: var(--text-success, #008060); 2341 } 2342 } 2343`;se.div` 2344 padding: 5px; 2345 justify-content: center; 2346 align-items: center; 2347 border-radius: 6px; 2348 gap: 4px; 2349 background: var(--background-default, #f6f6f7); 2350 button { 2351 display: flex; 2352 cursor: pointer; 2353 outline: 0; 2354 border: none; 2355 width: 69px; 2356 padding: var(--p-space-150) var(--p-space-300); 2357 border-radius: var(--p-border-radius-200); 2358 background: transparent; 2359 justify-content: center; 2360 align-items: center; 2361 gap: 10px; 2362 font-size: 12px; 2363 font-style: normal; 2364 font-weight: 400; 2365 line-height: 20px; 2366 color: var(--text-disabled, #8c9196); 2367 /* border-radius: var(--p-border-radius-button); */ 2368 &.active, 2369 &:hover:not([disabled]), 2370 &:focus:not([disabled]) { 2371 background: var(--p-color-bg-fill); 2372 /* shadow-button/default */ 2373 color: var(--p-color-text); 2374 box-shadow: 2375 0px 1px 0px 0px #e3e3e3 inset, 2376 1px 0px 0px 0px #e3e3e3 inset, 2377 -1px 0px 0px 0px #e3e3e3 inset, 2378 0px -1px 0px 0px #b5b5b5 inset; 2379 } 2380 &[disabled] { 2381 cursor: not-allowed; 2382 &.active { 2383 color: var(--text-disabled, #8c9196); 2384 background: var(--p-color-bg-fill-disabled); 2385 box-shadow: none; 2386 } 2387 } 2388 } 2389`;se.div` 2390 display: flex; 2391 width: 385px; 2392 min-height: 385px; 2393 flex-direction: column; 2394 justify-content: center; 2395 margin: auto; 2396 align-items: center; 2397 flex-shrink: 0; 2398 border-radius: 6px; 2399 border: 1px solid var(--border-disabled, #d2d5d8); 2400 background: var(--surface-subdued, #fafbfb); 2401 img.thumbnail { 2402 width: auto; 2403 height: auto; 2404 } 2405`;se.div` 2406 .Polaris-Button:hover, 2407 .Polaris-Button__Text, 2408 .Polaris-Button__Text:hover, 2409 .Polaris-Button--plain:hover:not(.Polaris-Button--removeUnderline) { 2410 text-decoration: none !important; 2411 } 2412 .Polaris-Button { 2413 padding-top: 0; 2414 padding-bottom: 0; 2415 /* margin-left: 0; */ 2416 margin: 0; 2417 background-color: rgb(228 227 227); 2418 } 2419 .Polaris-Button__Text { 2420 max-width: 100px; 2421 font-size: 12px; 2422 white-space: nowrap; 2423 text-overflow: ellipsis; 2424 overflow: hidden; 2425 } 2426`;se.div` 2427 /* JUST COMMON TABLE STYLES... */ 2428 .Polaris-TextField__Spinner { 2429 display: none; 2430 } 2431 .tableFixHead { 2432 overflow: auto; 2433 max-height: 600px; 2434 } 2435 2436 /* .tableFixHead thead th { 2437 position: sticky; 2438 top: 0; 2439 } */ 2440 2441 // 2442 2443 table thead th { 2444 position: sticky; 2445 top: 0; 2446 z-index: 32; 2447 } 2448 table tbody th { 2449 position: relative; 2450 } 2451 table thead th:first-child, 2452 table tbody td:first-child { 2453 position: sticky; 2454 left: 0; 2455 z-index: 31; 2456 /* background-color: #fff; */ 2457 background-color: var(--p-surface); 2458 } 2459 table tr { 2460 th:first-child { 2461 background: var(--p-surface-subdued); 2462 } 2463 &.Polaris-IndexTable__TableRow--selected td:first-child { 2464 background-color: var(--p-surface-selected); 2465 } 2466 } 2467 table thead th:first-child { 2468 z-index: 33; 2469 } 2470 tr.variant-added:not(.Polaris-IndexTable__TableRow--selected) { 2471 background-color: rgba(246, 246, 247, 1); 2472 & td:first-child { 2473 background-color: rgba(246, 246, 247, 1); 2474 } 2475 } 2476`;const UN=se.div` 2477 ${({isPopup:t})=>t&&Ps` 2478 &:not(.last-column):focus-within { 2479 position: absolute; 2480 top: -18px; 2481 left: 0; 2482 height: 40px; 2483 width: 208px; 2484 z-index: 30; 2485 } 2486 &.last-column:focus-within { 2487 position: absolute; 2488 top: -18px; 2489 right: 0px; 2490 height: 40px; 2491 width: 208px; 2492 z-index: 30; 2493 } 2494 `} 2495 .Polaris-InlineError .Polaris-Text--root { 2496 white-space: pre-wrap; 2497 } 2498`;se.div` 2499 position: relative; 2500 /* max-height: 400px; */ 2501 /* overflow: auto; */ 2502 .Polaris-TextField__Spinner { 2503 display: none; 2504 } 2505 /* table tbody tr[data-state='warning'] td { 2506 background-color: #fff1e3 !important; 2507 &.Polaris-IndexTable__TableCell--first::before { 2508 background-color: #fff1e3 !important; 2509 } 2510 } */ 2511 /* table tbody tr[data-state='error'] td { 2512 background-color: #fee9e8 !important; 2513 &.Polaris-IndexTable__TableCell--first::before { 2514 background-color: #fee9e8 !important; 2515 } 2516 } */ 2517 .Polaris-IndexTable__ScrollBarContainer { 2518 display: none; 2519 } 2520 .Polaris-IndexTable__SelectAllActionsWrapper { 2521 display: none; 2522 } 2523 .Polaris-IndexTable--selectMode { 2524 transform: none; 2525 margin-bottom: 0px; 2526 } 2527 .variant-image { 2528 max-width: 40px; 2529 min-width: 40px; 2530 height: 40px; 2531 border: none; 2532 cursor: pointer; 2533 &:hover { 2534 border: solid 1px var(--p-border-highlight); 2535 } 2536 } 2537 .Polaris-TextField__Spinner { 2538 display: none; 2539 } 2540 2541 .Polaris-IndexTable__IndexTableWrapper { 2542 ${({isHasHeaderCompareAtPrice:t})=>!t&&Ps` 2543 .Polaris-IndexTable__TableHeading { 2544 position: sticky; 2545 top: 0; 2546 z-index: 99; 2547 } 2548 .Polaris-IndexTable__Table--sticky { 2549 .Polaris-IndexTable__TableHeading--second, 2550 .Polaris-IndexTable__TableHeading--first { 2551 z-index: 100; 2552 } 2553 } 2554 `} 2555 2556 /* .Polaris-IndexTable__BulkActionsWrapperSticky { 2557 left: calc(var(--p-space-6) + var(--p-space-400)) !important; 2558 right: 0; 2559 position: unset; 2560 } */ 2561 2562 .Polaris-IndexTable-ScrollContainer { 2563 max-height: ${({maxHeight:t})=>`${t||"494px"}`}; 2564 min-height: ${({minHeight:t})=>`${t||"auto"}`}; 2565 // css scroll bar 2566 overflow-y: auto; 2567 padding-bottom: 0px; 2568 -ms-overflow-style: unset !important; 2569 scrollbar-width: unset !important; 2570 2571 &::-webkit-scrollbar-track { 2572 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.05) !important; 2573 border-radius: 5px !important; 2574 background-color: #f5f5f5 !important; 2575 } 2576 2577 &::-webkit-scrollbar {
2578 display: block !important; 2579 width: 6px !important; 2580 height: 6px !important; 2581 background-color: #f5f5f5 !important; 2582 } 2583 2584 &::-webkit-scrollbar-thumb { 2585 border-radius: 5px !important; 2586 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.05) !important; 2587 background-color: #ccc !important; 2588 } 2589 } 2590 } 2591 2592 .Polaris-IndexTable__TableRow--child { 2593 .Polaris-IndexTable__TableCell--first { 2594 left: calc(var(--pc-index-table-checkbox-child-offset) - 18px); 2595 & + .Polaris-IndexTable__TableCell { 2596 padding-left: calc(var(--pc-index-table-checkbox-child-offset) + var(--pc-index-table-cell-padding) - 18px); 2597 } 2598 } 2599 } 2600 2601 ${({isHasHeaderCompareAtPrice:t})=>t&&Ps` 2602 .Polaris-BulkActions__BulkActionsSelectAllWrapper { 2603 height: 32px; 2604 } 2605 `} 2606 2607 .Polaris-IndexTable__StickyTable[role="presentation"] { 2608 z-index: 32; 2609 } 2610 .Polaris-IndexTable__Table--sticky thead { 2611 z-index: 1; 2612 position: relative; 2613 } 2614`;se.span` 2615 svg { 2616 fill: rgb(32, 34, 35) !important; 2617 } 2618`;se.div` 2619 display: flex; 2620 .--shipping-method .button-shipping-method { 2621 padding-left: 0; 2622 } 2623 .--shipping-method .--shipping-data__label { 2624 /* color: var(--text-subdued, #6d7175); */ 2625 padding-left: 0 !important; 2626 } 2627 .--shipping-method { 2628 height: auto; 2629 } 2630 /* .--shipping-method .--shipping-data__label::after { 2631 content: ':'; 2632 } */ 2633`;se.div` 2634 .Polaris-Layout__Section--oneThird { 2635 @media only screen and (min-width: 65em) { 2636 max-width: 216px; 2637 } 2638 } 2639 @media only screen and (max-width: 64.9975em) { 2640 .Polaris-Layout__Section:not(.Polaris-Layout__Section--oneThird) { 2641 order: 1; 2642 } 2643 .Polaris-Layout__Section--oneThird { 2644 order: 0; 2645 } 2646 } 2647`;se.div` 2648 position: relative; 2649 display: flex; 2650 gap: 0.5rem; 2651 @media only screen and (min-width: 65em) { 2652 width: 100%; 2653 } 2654`;se.div` 2655 width: 8px; 2656 flex-shrink: 0; 2657 position: relative; 2658 &::before { 2659 content: ''; 2660 position: absolute; 2661 top: 0; 2662 left: 50%; 2663 transform: translateX(-50%); 2664 width: 1px; 2665 height: calc(100% + 0.25rem); 2666 background-color: var(--p-color-border-tertiary); 2667 } 2668 &::after { 2669 content: ''; 2670 position: absolute; 2671 top: 50%; 2672 left: 50%; 2673 width: 8px; 2674 height: 8px; 2675 background-color: var(--p-color-icon); 2676 transform: translate(-50%, -50%); 2677 border-radius: 50%; 2678 transition: all 0.3s ease; 2679 opacity: 0; 2680 } 2681 &[data-active='true'] { 2682 &::after { 2683 opacity: 1; 2684 } 2685 } 2686 @media only screen and (max-width: 64.9975em) { 2687 display: none; 2688 } 2689`;se.a` 2690 padding: 6px; 2691 border-radius: 8px; 2692 cursor: pointer; 2693 display: flex; 2694 align-items: center; 2695 gap: 8px; 2696 color: var(--p-color-text-secondary); 2697 text-decoration: none; 2698 width: 100%; 2699 2700 .Polaris-Icon { 2701 margin: 0; 2702 } 2703 2704 &:hover { 2705 background: var(--p-color-bg-surface-tertiary-hover); 2706 } 2707 &[data-active='true'] { 2708 background: var(--p-color-bg-surface-tertiary-active); 2709 color: var(--p-color-text); 2710 } 2711 .Polaris-Icon--toneCritical { 2712 margin-left: auto; 2713 flex-shrink: 0; 2714 } 2715`;se.div` 2716 cursor: ${({isDisabled:t})=>t?"not-allowed":"pointer"}; 2717 @media (hover: hover) { 2718 &:hover { 2719 background: var(--p-color-bg-surface-hover); 2720 } 2721 } 2722`;se.div` 2723 display: flex; 2724 align-items: flex-start; 2725 gap: var(--p-space-200); 2726 flex-wrap: wrap; 2727`;se.div` 2728 width: 100%; 2729 .Polaris-Button { 2730 justify-content: space-between; 2731 width: 168px; 2732 height: 32px; 2733 .Polaris-Text--root { 2734 word-break: break-all; 2735 display: -webkit-box !important; 2736 display: block; 2737 -webkit-box-orient: vertical; 2738 -webkit-line-clamp: 1; 2739 overflow: hidden; 2740 text-overflow: ellipsis; 2741 white-space: normal; 2742 } 2743 } 2744 &.missing-variant button { 2745 border-color: rgba(216, 44, 13, 1); 2746 background: #fff4f4; 2747 } 2748`;const QI=se.div` 2749 .Polaris-InlineError { 2750 color: var(--p-color-icon-warning); 2751 } 2752`;se.div` 2753 [class*='Polaris-IndexTable-ScrollContainer'] { 2754 height: var(--variant-table-height); 2755 overflow-y: auto; 2756 position: relative; 2757 width: 100%; 2758 tbody { 2759 &::before { 2760 content: ''; 2761 display: block; 2762 padding-top: var(--table-padding-top); 2763 } 2764 &::after { 2765 content: ''; 2766 display: block; 2767 padding-top: var(--table-padding-bottom); 2768 } 2769 } 2770 } 2771`;const ha=i.memo(({item:t,error:s,errors:n,isProcessing:a,disableNavigation:r})=>{const{t:o}=J(),{isMobile:l}=xe(),{hasNewPricing:c}=zt(),u=()=>a?e.jsx(Pa,{size:"small"}
2771):s?e.jsx(ee,{source:im,tone:s==="EXCEED_QUOTA_LIMIT"?"warning":"critical"}):e.jsx(ee,{source:Je,tone:"success"}),d=h=>{},g=()=>{let h=s;if(n&&n.length)return e.jsx(ZI,{children:e.jsx(mo,{gap:"extraTight",children:n.map((p,x)=>e.jsx(mo.Item,{children:`${p.field}: ${p.message}`},`${p.field}-${x}`))})});if(s==="EXCEED_QUOTA_LIMIT")return e.jsx(QI,{children:e.jsx(Co,{message:e.jsx(Nu,{children:e.jsx(m,{as:"span",variant:"bodySm",breakWord:!0,children:c?o("OutOfQuotaProductListing"):o("EXCEED_QUOTA_LIMIT")||""})}),fieldID:"error-quota-push-product"})});if(s&&q.includes(s,"PRODUCT_HAD_MORE_THAN")){const p=/PRODUCT_HAD_MORE_THAN_(\d+)_IMAGES/,x=s.match(p)?.[1]||0;h=o("PRODUCT_HAD_MORE_THAN_250_IMAGES",{image_count:x})}return s&&e.jsx(Co,{message:e.jsx(Nu,{children:e.jsx(m,{as:"span",variant:"bodySm",breakWord:!0,children:o(h)||""})}),fieldID:"error-push-product"})};return e.jsx(e.Fragment,{children:e.jsx(Q,{paddingBlock:"200",children:e.jsx(U,{align:"space-between",children:e.jsxs(U,{gap:"300",blockAlign:"center",wrap:!1,children:[e.jsx("div",{style:{opacity:a?.45:1},children:e.jsx(pn,{size:"small",source:t.image,alt:t.title})}),e.jsx(qI,{isMobile:l,onClick:()=>d(t.id||""),style:{opacity:a?.45:1},children:e.jsxs(m,{tone:"base",truncate:!0,as:"span",variant:"bodyMd",children:[e.jsx("span",{className:"",children:t.title}),g()]})}),u()]})})})})}),qI=se.div` 2772 max-width: ${({isMobile:t=!1})=>t?133:195}px; 2773 /* cursor: pointer; */ 2774`,Nu=se.div` 2775 white-space: break-spaces; 2776 width: 100%; 2777`,ZI=se.div` 2778 color: var(--p-color-bg-fill-critical-active); 2779 .Polaris-List__Item { 2780 white-space: break-spaces; 2781 width: 100%; 2782 } 2783`,ga=({label:t,countErrors:s,isProcessing:n,isCollapse:a})=>{const{t:r}=J();return e.jsx("div",{className:"cursor-pointer",children:e.jsx(Q,{borderColor:"border",borderBlockStartWidth:"025",paddingBlock:"300",paddingInline:"400",background:"bg-surface-secondary-active",children:e.jsxs(U,{align:"space-between",blockAlign:"center",children:[e.jsxs(U,{gap:"200",children:[e.jsx(m,{tone:"base",fontWeight:"semibold",as:"span",variant:"bodyMd",children:t}),n?e.jsx(U,{gap:"200",children:e.jsx(wt,{children:r("Inprogress")})}):s?e.jsx(U,{gap:"200",children:e.jsx(wt,{tone:"critical",children:r("CountError",{count:s})})}):""]}),e.jsx("div",{className:"cursor-pointer hover:[&_.Polaris-Icon_svg]:text-p-color-icon-active [&_.Polaris-Icon_svg]:text-p-color-icon",children:e.jsx(ee,{source:[jn,om][+a]})})]})})})},XI=60,JI=3,$I="500ms",e4=({isCollapsed:t,toggleCollapse:s})=>{const{t:n}=J(),a=xe().isMobile,r=gn(),o=r.getActiveChannels(),[l,c]=i.useState(o[0]||"shopify"),{success:u}=i.useMemo(()=>r.getPushProductSummary("pushed"),[r]),d=i.useMemo(()=>[...r.getByChannel(l)].filter(p=>p.status==="success"&&oa(p)).sort((p,x)=>{const f=Ss[p.status]-Ss[x.status];return f!==0?f:0}),[l,r]),g=(h,p)=>{const x=h.status==="processing",f=h.status==="error"?h.error:void 0,_=h?.errors?.length?h?.errors:void 0;return e.jsx(ha,{isProcessing:x,errors:_,error:f||"",item:h},`${l}-${h.id}-${p}`)};return i.useEffect(()=>{c(o[0]||"shopify")},[o[0]]),d.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[e.jsx("div",{onClick:s,children:e.jsx(ga,{label:`${n("PushedLabel")} (${u})`,isCollapse:t})}),e.jsx(Qe,{open:t,id:"toast-process-push-product",transition:{duration:$I,timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(rn,{style:{maxHeight:`calc(${XI}px * ${JI})`},focusable:!0,children:e.jsx(Q,{paddingInline:a?"300":"400",paddingBlock:a?"100":"300",children:d.map(g)})})})]})},t4=60,s4=3,n4="500ms",a4=({isCollapsed:t,toggleCollapse:s})=>{const{t:n}=J(),a=xe().isMobile,r=gn(),o=r.getActiveChannels(),[l,c]=i.useState(o[0]||"shopify"),{success:u}=i.useMemo(()=>r.getPushProductSummary("updated"),[r]),d=i.useMemo(()=>[...r.getByChannel(l)].filter(p=>p.status==="success"&&Ra(p)).sort((p,x)=>{const f=Ss[p.status]-Ss[x.status];return f!==0?f:0}),[l,r]),g=(h,p)=>{const x=h.status==="processing",f=h.status==="error"?h.error:void 0,_=h?.errors?.length?h?.errors:void 0;return e.jsx(ha,{isProcessing:x,errors:_,error:f||"",item:h},`${l}-${h.id}-${p}`)};return i.useEffect(()=>{c(o[0]||"shopify")},[o[0]]),d.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[e.jsx("div",{onClick:s,children:e.jsx(ga,{label:`${n("Updated")} (${u})`,isCollapse:t})}),e.jsx(Qe,{open:t,id:"toast-process-edit-product",transition:{duration:n4,timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(rn,{style:{maxHeight:`calc(${t4}px * ${s4})`},focusable:!0,children:e.jsx(Q,{paddingInline:a?"300":"400",paddingBlock:a?"100":"300",children:d.map(g)})})})]})},r4=60,i4=3,o4="500ms",l4=({isCollapsed:t,toggleCollapse:s})=>{const{t:n}=J(),a=xe().isMobile,r=gn(),{processing:o,error:l}=i.useMemo(()=>r.getSplitSummary(),[r]),c=i.useMemo(()=>[...r.getSplitItems()].sort((g,h)=>{const p=Ss[g.status]-Ss[h.status];return p!==0?p:0}),[r]),u=(d,g)=>{const h=d.status==="processing",p=d.status==="error"?d.error:void 0,x=d?.errors?.length?d?.errors:void 0;return e.jsx(ha,{isProcessing:h,errors:x,error:p||"",item:d,disableNavigation:!0},`split-${d.id}-${g}`)};return c.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[e.jsx("div",{onClick:s,children:e.jsx(ga,{label:n("SplitProduct"),isProcessing:o>0,countErrors:l,isCollapse:t})}),e.jsx(Qe,{open:t,id:"toast-process-split-product",transition:{duration:o4,timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(rn,{style:{maxHeight:`calc(${r4}px * ${i4})`},focusable:!0,children:e.jsx(Q,{paddingInline:a?"300":"400",paddingBlock:a?"100":"300",children:c.map(u)})})})]})},c4=60,d4=3,u4="500ms",p4=({isCollapsed:t,toggleCollapse:s})=>{const{t:n}=J(),a=xe().isMobile,r=gn(),{processing:o,error:l}=i.useMemo(()=>r.getImportSummary(),[r]),c=i.useMemo(()=>[...r.getImportItems()].sort((g,h)=>{const p=Ss[g.status]-Ss[h.status];return p!==0?p:0}),[r]),u=(d,g)=>{const h=d.status==="processing",p=d.status==="error"?d.error:void 0,x=d?.errors?.length?d?.errors:void 0;return e.jsx(ha,{isProcessing:h,errors:x,error:p||"",item:d},`import-${d.id}-${g}`)};return c.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[e.jsx("div",{onClick:s,children:e.jsx(ga,{label:n("AddToProductCenter"),isProcessing:o>0,countErrors:l,isCollapse:t})}),e.jsx(Qe,{open:t,id:"toast-process-import-product",transition:{duration:u4,timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(rn,{style:{maxHeight:`calc(${c4}px * ${d4})`},focusable:!0,children:e.jsx(Q,{paddingInline:a?"300":"400",paddingBlock:a?"100":"300",children:c.map(u)})})})]})},h4=60,g4=3,m4="500ms",f4=({isCollapsed:t,toggleCollapse:s})=>{const{t:n}=J(),a=xe().isMobile,r=gn(),o=r.getActiveChannels(),[l,c]=i.useState(o[0]||"shopify"),{error:u}=i.useMemo(()=>r.getPushProductSummary(),[r]),d=i.useMemo(()=>
2783[...r.getByChannel(l)].filter(p=>p.status==="error").sort((p,x)=>{const f=Ss[p.status]-Ss[x.status];return f!==0?f:0}),[l,r]),g=(h,p)=>{const x=h.status==="processing",f=h.status==="error"?h.error:void 0,_=h?.errors?.length?h?.errors:void 0;return e.jsx(ha,{isProcessing:x,errors:_,error:f||"",item:h},`${l}-${h.id}-${p}`)};return i.useEffect(()=>{c(o[0]||"shopify")},[o[0]]),d.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[e.jsx("div",{onClick:s,children:e.jsx(ga,{label:`${n("Failed")} (${u})`,isCollapse:t})}),e.jsx(Qe,{open:t,id:"toast-process-product",transition:{duration:m4,timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(rn,{style:{maxHeight:`calc(${h4}px * ${g4})`},focusable:!0,children:e.jsx(Q,{paddingInline:a?"300":"400",paddingBlock:a?"100":"300",children:d.map(g)})})})]})},x4=60,_4=3,b4="500ms",y4=({isCollapsed:t,toggleCollapse:s})=>{const{t:n}=J(),a=xe().isMobile,r=gn(),{processing:o,error:l}=i.useMemo(()=>r.getDuplicateSummary(),[r]),c=i.useMemo(()=>[...r.getDuplicateItems()].sort((g,h)=>{const p=Ss[g.status]-Ss[h.status];return p!==0?p:0}),[r]),u=(d,g)=>{const h=d.status==="processing",p=d.status==="error"?d.error:void 0,x=d?.errors?.length?d?.errors:void 0;return e.jsx(ha,{isProcessing:h,errors:x,error:p||"",item:d,disableNavigation:!0},`duplicate-${d.id}-${g}`)};return c.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[e.jsx("div",{onClick:s,children:e.jsx(ga,{label:n("DuplicateProduct"),isProcessing:o>0,countErrors:l,isCollapse:t})}),e.jsx(Qe,{open:t,id:"toast-process-duplicate-product",transition:{duration:b4,timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(rn,{style:{maxHeight:`calc(${x4}px * ${_4})`},focusable:!0,children:e.jsx(Q,{paddingInline:a?"300":"400",paddingBlock:a?"100":"300",children:c.map(u)})})})]})},C4=60,v4=3,A4="500ms",S4=({isCollapsed:t,toggleCollapse:s})=>{const{t:n}=J(),a=xe().isMobile,r=gn(),o=r.getActiveChannels(),[l,c]=i.useState(o[0]||"shopify"),{processing:u}=i.useMemo(()=>r.getPushProductSummary(),[r]),d=i.useMemo(()=>[...r.getByChannel(l)].filter(p=>p.status==="processing").sort((p,x)=>{const f=Ss[p.status]-Ss[x.status];return f!==0?f:0}),[l,r]),g=(h,p)=>{const x=h.status==="processing",f=h.status==="error"?h.error:void 0,_=h?.errors?.length?h?.errors:void 0;return e.jsx(ha,{isProcessing:x,errors:_,error:f||"",item:h},`${l}-${h.id}-${p}`)};return i.useEffect(()=>{c(o[0]||"shopify")},[o[0]]),d.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[e.jsx("div",{onClick:s,children:e.jsx(ga,{label:`${n("Processing")} (${u})`,isCollapse:t})}),e.jsx(Qe,{open:t,id:"toast-process-product",transition:{duration:A4,timingFunction:"ease-in-out"},expandOnPrint:!0,children:e.jsx(rn,{style:{maxHeight:`calc(${C4}px * ${v4})`},focusable:!0,children:e.jsx(Q,{paddingInline:a?"300":"400",paddingBlock:a?"100":"300",children:d.map(g)})})})]})},j4=i.forwardRef((t,s)=>{const[n,a]=i.useState(""),r=i.useCallback(o=>{a(l=>l===o?"":o)},[]);return i.useImperativeHandle(s,()=>({onOpen:()=>{a("failed_product")}})),e.jsx("div",{children:e.jsx(Q,{background:"bg-fill",children:e.jsxs(D,{children:[e.jsx(p4,{isCollapsed:n==="PRODUCT_IMPORT",toggleCollapse:()=>r("PRODUCT_IMPORT")}),e.jsx(e4,{isCollapsed:n==="push_product",toggleCollapse:()=>r("push_product")}),e.jsx(a4,{isCollapsed:n==="edit_product",toggleCollapse:()=>r("edit_product")}),e.jsx(f4,{isCollapsed:n==="failed_product",toggleCollapse:()=>r("failed_product")}),e.jsx(S4,{isCollapsed:n==="processing_product",toggleCollapse:()=>r("processing_product")}),e.jsx(l4,{isCollapsed:n==="split_product",toggleCollapse:()=>r("split_product")}),e.jsx(y4,{isCollapsed:n==="duplicate_product",toggleCollapse:()=>r("duplicate_product")})]})})})}),E4=()=>{const t=ke(zh),[s,n]=i.useState(!1),{isMobile:a}=xe(),r=i.useRef(null),o=ja({transform:t?"translateY(0%)":"translateY(100%)",opacity:t?1:0,zIndex:t?515:1,display:"flex",config:{mass:1,tension:280,friction:20},onRest:()=>{t||n(!1)}}),l=i.useCallback(()=>{requestAnimationFrame(()=>{n(c=>!c)})},[]);return Vl("TOAST_ALL_COMPLETED",c=>{c.payload.products?.some(d=>d.status==="error")&&(n(!0),setTimeout(()=>{r.current?.onOpen()},500))},[s]),e.jsxs(e.Fragment,{children:[e.jsx(GI,{}),e.jsx(T4,{className:oe("toast-process-bottom",!t&&"hidden!"),style:{...o,bottom:a?Ce.isShopifyEmbedded()?65:105:32,right:a?18:24},children:e.jsxs(Q,{background:"bg-fill-brand",width:a?"300px":"320px",children:[e.jsx(KI,{isCollapse:s,onToggleCollapse:l}),e.jsx(Qe,{transition:{duration:"400ms",timingFunction:"ease-in-out"},id:"collaspe-toast",open:s,children:e.jsx(j4,{ref:r})})]})})]})},T4=se(_r.div)` 2784 position: fixed; 2785 border-radius: var(--p-border-radius-300); 2786 overflow: hidden; 2787 box-shadow: var(--p-shadow-400); 2788 will-change: transform, opacity; 2789 transform: translateZ(0); 2790 backface-visibility: hidden; 2791`,P4=i.memo(E4),I4=()=>{const[t,s]=be(z0),n=Pt(),a=de(),{t:r}=Mp(),{isNormalUser:o}=gs(),l=i.useRef(null),{getShop:c}=dt(),u=c(),d=()=>s([]),g=()=>{ss(Ht.mkt_users_click_sign_up.key),ge.localStorage.set("mkt_users_click_sign_up","1"),a.signout(!0,{withRedirectApp:!0}),d()},h=()=>{ss(Ht.mkt_users_click_contact_support.key),d(),n.openChat()},p=t.length>0;return i.useEffect(()=>{ge.localStorage.get("mkt_users_click_sign_up")&&o&&u.id&&(ge.localStorage.remove("mkt_users_click_sign_up"),ss(Ht.mkt_users_connected_store.key))},[u.id,o]),i.useEffect(()=>{if(p){const x=l.current?.closest(".Polaris-ThemeProvider--themeContainer");if(x){const f=x.querySelector(".Polaris-Button--iconOnly")?.parentElement,_=x.querySelector(".Polaris-Backdrop"),b=x.querySelector(".Polaris-Modal-Dialog__Container");b&&b.setAttribute("style","z-index: 1001"),_&&_.setAttribute("style","z-index: 1000"),f&&(f.style.paddingTop="3px",f.style.paddingRight="3px")}}},[p]),e.jsx(Xe,{title:"",open:p,onClose:d,primaryAction:{content:e.jsx(e.Fragment,{children:"           Login now           "}),onAction:g},secondaryActions:[{content:"Contact support",onAction:h}],children:e.jsx(Xe.Section,{children:e.jsx("div",{ref:l,className:"flex flex-col text-sm text-gray-700 space-y-3 ",children:e.jsxs(D,{gap:"400",children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"h2",variant:"headingLg",fontWeight:"bold",children:r("LoginToUnlockAllFeatures")}),e.jsx(m,{as:"p",variant:"bodyLg",tone:"subdued",children:r("AccessPowerfulToolsToScaleYourDropshippingBusiness")})]}),e.jsxs(m,{as:"h3",variant:"headingMd",fontWeight:"bold",children:[r("LoginToGet"),":"]}),e.jsx(Ln,{children:e.jsxs(U,{gap:"400",align:"start",blockAlign:"center",children:[e.jsx("div",{className:"p-1 rounded-lg bg-violet-600 text-white",children:e.jsx(Bi,{className:"size-6 bg-vi
2791olet-600 text-white"})}),e.jsx(m,{as:"h3",variant:"bodyMd",tone:"subdued",children:r("10AIcreditsMonthlyForEnhancementsEdits")})]})}),e.jsx(Ln,{children:e.jsxs(U,{gap:"400",align:"start",blockAlign:"center",children:[e.jsx("div",{className:"p-1 rounded-lg bg-violet-600 text-white",children:e.jsx(Bi,{className:"size-6 bg-violet-600 text-white"})}),e.jsx(m,{as:"h3",variant:"bodyMd",tone:"subdued",children:r("20ProductsYouCanPushToYourStore")})]})}),e.jsx(Ln,{children:e.jsxs(U,{gap:"400",align:"start",blockAlign:"center",children:[e.jsx("div",{className:"p-1 rounded-lg bg-violet-600 text-white",children:e.jsx(Bi,{className:"size-6 bg-violet-600 text-white"})}),e.jsx(m,{as:"h3",variant:"bodyMd",tone:"subdued",children:r("15OrdersYouCanFulfillWithZopi")})]})})]})})})})},R4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAUKADAAQAAAABAAAAUAAAAAAx4ExPAAAJvElEQVR4Ae1cO1MbSRAWDz8uk//BUrarrsoBcubMIjN+FCK8yPALgF8gKbsM8QuA7C4yuPzKvGTOkDPKdhX7D07OjJ/3fWIWhlX37OxD4q5qt2rYme6e7plvemZ6Z1fUatVVIVAhUCFQIVAhUCFQIVAhUCFQIVAhMGkEpiZtMGmv1WrVT05OmtPT0wF4879+/WrgXkdi2b6iqampCPwBiO8hH87Ozvb39vZYvrTrUgAkaF+/fl0DIE0A0izSe+gIUX//ypUrwHIvKqIrT92JAvj48WMC1i4KmtZRgonUffHiRajJlE2fCIDjBk4AhVN94/Xr13sCr1TSWAHEVA2+ffu2PS6PS0MC3riDqd0d59SeSWtEXj68bu3Hjx9/Abzf8+oooV4DbWjdvn3788ePH/sl6BtRUboHcoOA17UB3PqINYUAT+FOyunG3TWamZlhZwfwHNKHF735+/fvAfQ2fv782UCd+2AEp9z0v5DvvXz5ciNdMptEqQASPOyub9GERlozCBrA2GI4knfRf/jwYYMDlQHM/tWrV5fLnNKlAUgPMeAFLvBi4NCRnu1hrjo+PIC5Ark2UoDkuiLYXigLxFIA9AUPveqWDVwSKQDZAY1Aui6CeLeMASwFQDT6EK11TdsI/OVXr15xbRv79eDBgwBLA5eSwGGM05meeLbOOmRVVmEAHz16tOnaMMDbvXbt2rpPQ80aGj+hsPNMNU573Ai+9xOH0bWNOi0k8YLewhtLIQDNusNGalcXXtfRmDGdS0CWeBEd947v0qY0BpgBdy9uS9Z77jiQnUaMRfDqilEv8HLGi4zvVm7dunXy6dOnd4r9IRnxX4g4kI7SlOQwGPfu3Lnz99HR0UDip9Gm0wQ0PmM98AKFv+fjefCONmK6HrxAGwRF/ZBcR+c3qcMlRB7bAtldRY5xq2sWKdVOybkAfPLkSQudXlE0c4dbVXhnZHoeCp0zQv5MZ3FxcT2tOh7pKBNJcuhLk8/rEi+NlgtATJ9NTTE8KnVn4/RHozuajqx0eFebOl31zCa2rMmgPameLNXNDKAZKa2x3Tdv3kSSIZtmHvXEaQswBpDtIgxZwNSbYkL5LjqoTUGq9pqG0NWnblZIXnm9kI3LdCFseUtjQqUIDZwT6BdI9BQ8sRxfIJ4XInqwNghp8R2Wjhtp4RLsE+xj9GFkADF4IZ6XF86bk57L5IFm6jUVteLIJmXR+FaSFpdd4FGGwFLGeGlc7eyOgVk/KygZAgzwtiQ2HYMASzyNlglAR+fpfTuakQR9KVGOizua58UCvFNGAwDA3rdltTw8tVdkEGy9mQBERa3zoa00Jd9Q+KJXSLI8wZHoADaQ6Emaywt9ByHW6Q0gXZsuHldM3L07Dx3iFDELfEKtXHQcfwVyjVGqYxAyTWNvAHGYqXkOp29/tIn/bQoHQZvGfM3q23pvALF4a0pDX2NGLpLkswSymA3aYA4k3RoNfdpXeIFCHyF7AwiXnx+pDQKm5HuJrtEw6pHEcwzQiDg2s7URIgjQnWkmoE+iPPSIfZVsegOorV3m/YWkW6RBz4HIqNXWGCYpvDMyZaBj5YxgZRweZUmdZwFgdF66kNM8/IIQC1kADEZqg4C1MZLoGo0hhMIbvk9xgUieeW0gqgCweyJDIcKTRQ+EeF2pMkL2BhA1g5HaIPjEbnY9hhCYIqFNs/LDpxQ87WzjlKUR07k+8tQFHT4ELYjpibtXHGnXuX79+sAuW/nAyjuzs07umJg4jFjF1D/UlgUzRVcA2rAFmJrDO+hiizAgA+j0ehKyFXAwYxs2PUs+iwdm0euUNV6bucOaUgDsdYih1S9CLwwg1iXv9cJuKB7aeyiXAWK3yJG83aY8+SwARpKBL1++5AKQuhCA86R4g1NQ0u2isQ6m9AZ1uORcPJ7uKPxIoY+QvQHUOgl6Y0RrBgI9EetX2nnfBY2wGbJOUc/DB5rBBcWmAP2RRJdo3psI1pn3CliBpDgLzayJK/CIDjaXFuouITWsTSZip1A+YBjExT+Lfk0W+sTBB/2zVidJ9waQUTsUP00qQMe8o/Zk3WTZANkDnWkSl9b2vq9x7ynsiNpbvsb+a3JwiKbUJvQ1lOgSzRtATC1NaT3LQYDUiMugIXpowG4g2ebH6xJdonlPYa47eEIIpVHD+tiE8lAy4EPjAEAvO+T1lT6WjQOkvuNcMNWs40AizLLGegPIFqGTB7g1mU9cPAjwXtwZO/J8EcAPv4PBvZ7QJxUD2A/IwL2FVMOAMpQJQdpHOLODu/eFek1JGG3Rjrgk8dqUSFWI7Dge5v9R2Kmfcpj6BG0dHfABTTElkrlThz7fROPxbQUatiUtAHAuy/N9JgBp0PFac4AQY05y/zEDJ+HQQVt20ZZIYgLAY9CDJI8DMNbXmjQII92kYVOmd64nefjsogX6IeidMXhd0lxc7vDYy3haTBveQWsjE1wgmoKjb5L4kJbZA1nL4YVk3+U7EnodFuo2QBsBlUKTugBKz0zrAdrkfKmPds9lbVcuALlrYq14qxiLQF9GeoYUIKVe6OQAQn2kfcab5pR7EC8HHAx4FL86rWNAGkj3UaeJez1V+alAhJuzTdC1nOeHObkAZJtSvJAiqRdACJG6eX80aKboEgy1Uo25BXbgfatuEZmbG0CeZLgORWVzp9QYuCJxnK2fbYHODtJTm+6Zd36Pk6YjN4BUDC9kOLKZZsTiR5iGq2UBZ+kdZs3Sso1CkOQ5yqtZY0hbV+5PfKkEn8++w+ezN5C9ZytV8lsILf54/vz5kcIvTP7w4UOEz3V3cdT1G5R5tQng/VnEsPezsGYEoHDqcANwXYwRe/Gm4BIsyjM2dtCmQYquPsBbT5FJZRcGkA1GmLAAS5HDGnfRYxODOcSKsbhbGxvqCytjgesed+XCV6E10LbOhRzrG0ObwKYL+Qg0PvbtCLxcJBPm+D4iFto0kg0sDUAqNjvzM2wsjaQhoRxhmoWQ3QKYaUuAUL1WM5sGY0LfZ+tSfp1kN6ZUAGPFmEY95Nfissd9CCbk+Nqgj7gwwtIQxfXoYcjzn1M04OUB8vNILYBPuu/FgVr3FfaVGwuANG6C3DayAcuXdXEzwXo3tlefhcIYFyj8hfjNmzf3IXMDnWi4ZMfFg12+vVvE8dSbsdkYl2JbL3+Yg44w4A5s+rjyBA5pIv+9Y2xTWALHHN23sXY1JX5R2iSBi9s6UQBjo2a3bqG8VBRMggYdpb4vjtvpc78UAO2GcYc170eaoM8DkDoACZBnsi/u1AMQ+kjxP6fI9ALIVlblKwQqBCoEKgQqBCoEKgQqBCoEKgQqBP6/CPwLBymrYFnGcQEAAAAASUVORK5CYII=",k4=()=>{const{t}=J(),s=pt(),[n,a]=be(cl),r=he(pa),o=ke(nl),l=he(dr),c=he(ka),{data:u}=vr(),d=u?.count||0,g=()=>{l("ask-ai"),c(!0),a(!1)},h=async()=>{r(!0),a(!1),u&&u?.count>0&&await Fn.postMarkAsReadAll({disable_count:!0})},p=()=>
2791{if(d===0)return"";const f=d>99?"99+":d+"",_=f.length>1?"w-7 h-5 -right-3 top-[-10px]":"w-5 h-5 -right-2.5 top-[-10px]";return e.jsx("span",{className:oe("absolute rounded-full text-heading-xs flex items-center justify-center bg-blue-500 text-white text-xs px-1",_),children:f})},x=()=>{const f=o.unread;if(f===0)return"";const _=f>99?"99+":f+"",b=_.length>1?"w-7 h-5 -right-3 top-[-10px]":"w-5 h-5 -right-2.5 top-[-10px]";return e.jsx("span",{className:oe("absolute rounded-full text-heading-xs flex items-center justify-center bg-blue-500 text-white text-xs px-1",b),children:_})};return e.jsx(xt,{placement:"bottom",visible:n,onClose:()=>{a(!1)},showCloseIcon:!0,children:e.jsxs("div",{className:"bg-[#FAFAFA]",children:[e.jsx("div",{className:"px-5 py-5",children:e.jsxs(U,{gap:"400",blockAlign:"center",children:[e.jsxs("div",{className:"relative flex [&_.Polaris-Icon]:size-6",onClick:h,children:[e.jsx(re,{variant:"monochromePlain",icon:xl}),p()]}),e.jsxs("div",{className:"relative flex [&_.Polaris-Icon]:size-6",onClick:g,children:[e.jsx(re,{variant:"monochromePlain",icon:Oa}),x()]})]})}),e.jsx("div",{className:"px-5 pb-5",children:e.jsxs(D,{gap:"500",children:[e.jsx("div",{className:"border bg-bg-surface border-border-secondary rounded-xl p-4",children:e.jsx(w4,{onClose:()=>{a(!1)}})}),wm.map(f=>e.jsx("div",{className:"border bg-bg-surface border-border-secondary rounded-xl p-4",children:e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"p",variant:"headingMd",children:f.title}),f.items.map(_=>e.jsx("div",{onClick:()=>{requestAnimationFrame(()=>{_.path&&(s(_.path),a(!1))})},children:e.jsxs("div",{className:"py-2 flex items-center gap-2",children:[e.jsx("span",{children:e.jsx(ee,{source:_.icon})}),e.jsx("div",{className:"flex-1",children:e.jsx(m,{as:"span",variant:"bodyMd",children:t(_.content??"")})}),e.jsx("span",{children:e.jsx(ee,{source:Ys})})]})},_.id))]})},f.title))]})})]})})},w4=({onClose:t})=>{const{t:s}=J(),n=pt(),{getUserInfo:a,getCurrentPlan:r}=de(),o=he(Rn),{is_anonymous:l,avatar:c=null,name:u="",email:d=""}=a(),g=Ce.isShopifyEmbedded()?dn.filter(h=>h.key==="AO"):dn;return e.jsxs(D,{gap:"300",children:[e.jsxs("div",{className:"flex gap-3 cursor-pointer",children:[e.jsx("div",{className:"shrink-0",children:c?e.jsx(pn,{source:c,alt:"avatar"}):u?e.jsx("div",{className:"w-[40px] h-[40px] rounded-lg flex items-center justify-center bg-[#fbcffb] shrink-0",children:e.jsx("span",{className:"text-[13px] font-semibold text-[#791a79]",children:u.charAt(0).toUpperCase()})}):e.jsx("img",{className:"w-[40px] h-[40px]",loading:"lazy",src:R4,alt:"avatar"})}),e.jsxs("div",{className:"w-full flex flex-col gap-0.5 truncate justify-center",children:[l?e.jsxs(U,{blockAlign:"center",gap:"100",children:[e.jsx(m,{as:"p",variant:"bodyMd",children:s("GuestAccount")}),e.jsx(Et,{content:s("ConnectYourPersonalAccountWithZopiToReceiveNewUpdatesAndNotifications"),children:e.jsx(ee,{source:Na})})]}):e.jsx(m,{as:"p",variant:"bodyMd",truncate:!0,children:u}),e.jsx(m,{as:"p",tone:"subdued",variant:"bodySm",truncate:!0,children:l?`${s("OAuthUsing")} Shopify`:d})]})]}),e.jsx("div",{className:"bg-bg-surface-secondary rounded-xl p-3 flex flex-col gap-0",children:g.map((h,p)=>{const x=r(h.key),f=x.package?.price===0?"FREE":x.package?.modules?.[0]?.name?.toUpperCase(),_=Fe((x.package?.price||0).toFixed(1)),b=x.package?.cycle===365?"yr":"mo";return e.jsxs("div",{children:[p>0&&e.jsx(Q,{paddingBlock:"400",children:e.jsx($e,{})}),e.jsx("div",{className:"py-2",onClick:()=>{n(`${Y.BILLING_PLAN.PATH}`),o(h.key),t?.()},children:e.jsxs(U,{gap:"100",blockAlign:"center",align:"space-between",wrap:!1,children:[e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,children:[e.jsx(Q,{children:e.jsx(ee,{source:h.icon,tone:"subdued"})}),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:s(h.labelShort)})]}),e.jsxs(U,{gap:"100",blockAlign:"center",wrap:!1,children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:f}),e.jsxs(m,{as:"span",variant:"bodySm",tone:"subdued",children:["$",_,"/ ",b]}),e.jsx(Q,{children:e.jsx(ee,{source:Ys,tone:"subdued"})})]})]})})]},h.key)})})]})},N4=()=>{const{isMobile:t}=xe();return e.jsxs(e.Fragment,{children:[e.jsx(I4,{}),t?e.jsx(k4,{}):null]})},zl=Ei` 2792 .Polaris-Backdrop:not(.Polaris-Backdrop--belowNavigation) { 2793 z-index: 522; 2794 } 2795 .Polaris-Modal-Dialog__Container { 2796 display: flex !important; 2797 align-items: center !important; 2798 justify-content: center !important; 2799 height: 100% !important; 2800 z-index: 523; 2801 } 2802 2803 .Polaris-Modal-Dialog__Modal { 2804 margin: 0 24px !important; 2805 width: calc(100vw - 48px) !important; 2806 max-width: none !important; 2807 height: auto !important; 2808 max-height: 90vh !important; 2809 position: relative !important; 2810 border-radius: var(--p-border-radius-300) !important; 2811 } 2812 2813 @media (max-width: 768px) { 2814 .Polaris-Modal-Dialog__Modal { 2815 max-width: 95vw !important; 2816 max-height: 95vh !important; 2817 } 2818 } 2819 2820 .Polaris-Modal__Body { 2821 max-height: calc(90vh - 120px) !important; 2822 overflow-y: auto !important; 2823 } 2824`,O4=ae({key:"visibleModalUpgradeAIWritingState",default:!1}),D4=()=>{const{t}=J(),{getCurrentPlan:s}=de(),n=bt(),{isMobile:a}=xe(),[r,o]=be(O4),{packages:l}=Ks(),{getCurrentCyclePlan:c,getCurrentStoreCharge:u,getCurrentFulfillmentPlan:d,findPlanByKey:g}=zt(),h=d("AO"),p=c("AO"),[x,f]=i.useState(""),[_,b]=i.useState(!1),[v,y]=i.useState({}),C=s();let S;Ce.isShopifyEmbedded()&&(S=Wn());const j=i.useMemo(()=>p!==30,[p]),A=i.useMemo(()=>{const R=h?.price;return(R?l.filter(w=>w.price>R):l).map(w=>{const N=g(w.key);return N?{...w,...N}:{...w}})},[l,g,h?.price]),E=i.useCallback(()=>o(!1),[]),T=async R=>{try{f("processing");const{status:P,data:w,message:N}=await ls.chargeSubscription({params:R});if(P===fe.OK&&w?.confirmation_url)f("directing"),ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify({name:v.key,price:(v?.price||0).toFixed(2),start_time:Da()})),E(),f(""),S?S(w?.confirmation_url):window.location.href=w?.confirmation_url;else{if(P===fe.BAD_REQUEST&&at.size(w)&&N==="be_payment_cannot_change_your_subscription"){n.error(t("be_payment_cannot_change_your_subscription",{feature:w?.message_params||""}));return}n.error(t("PaymentFail"))}}catch(P){console.error(P)}},k=R=>{requestAnimationFrame(()=>{let P=u()?.store_id;const w=v.id;if(R&&(P=R),!P){o(!1),b(!0);return}T({store_id:P,module_ids:w?[w]:[],provider_payment:C?.provider_payment||"SHOPIFY",is_yearly:j}
2824)})};i.useEffect(()=>{y(A?.[0]||{})},[A]);const O=R=>{const P=R?.features?.AI_PRODUCT_CONTENT||0;return P&&e.jsx(Bs,{children:`${P===-1?t("Unlimited"):P.toLocaleString("en")+" "+t("TimeMonth")}`})};return e.jsxs(e.Fragment,{children:[x?e.jsx(ml,{}):"",a&&e.jsx(zl,{}),e.jsx(yr,{data:{storeCharge:{}},open:_,onConfirm:R=>{b(!1),R&&k(R)},onClose:()=>b(!1),loading:!!x}),e.jsx(Xe,{onClose:E,open:r,title:t("UnlockAIGenerate"),sectioned:!0,primaryAction:{content:t("Confirm"),onAction:()=>k(),loading:!!x},secondaryActions:[{content:t("Cancel"),onAction:E,disabled:!!x}],children:e.jsxs(D,{gap:"400",children:[e.jsx(kt,{tone:"warning",title:t("OutOfQuotaAI")}),A.map(R=>{const P=R.id===v?.id,w=R.key==="ENTERPRISE_CREDIT_TIER";let N="border";return P&&(N="border-brand-active"),P&&w&&(N="border-magic-secondary-hover"),e.jsx(U4,{onClick:()=>requestAnimationFrame(()=>{y(R)}),children:e.jsxs(Q,{borderRadius:"300",padding:"400",borderWidth:"025",borderColor:N,children:[e.jsxs(U,{align:"space-between",children:[e.jsxs(U,{blockAlign:"center",gap:"200",children:[e.jsx(hl,{label:"",labelHidden:!0,checked:P,name:"accounts"}),e.jsx(m,{variant:"bodyMd",as:"span",children:R.name})]}),e.jsxs(D,{gap:"100",align:"center",inlineAlign:"center",children:[e.jsxs(U,{blockAlign:"center",gap:"100",children:[j&&e.jsxs(m,{as:"span",variant:"headingSm",fontWeight:"regular",tone:"subdued",textDecorationLine:"line-through",children:["$",R.price]}),e.jsxs(m,{as:"span",variant:"headingLg",fontWeight:"semibold",children:["$",j?R.eachYearlyPrice:R.price]}),e.jsxs(D,{gap:"0",children:[e.jsx(Q,{minHeight:"5px"}),e.jsxs(m,{as:"p",variant:"bodyXs",tone:"subdued",children:["USD/",q.lowerCase(t("Month"))]})]})]}),R.key==="ENTERPRISE_CREDIT_TIER"?e.jsx(M4,{children:O(R)}):O(R)]})]}),j&&e.jsx(L4,{children:e.jsx(Bs,{tone:"info",children:t("Yearly")})})]})},`plan-${R.key}=${R.id}`)})]})})]})},L4=se.div` 2825 position: absolute; 2826 top: -10px; 2827 right: 5px; 2828`,M4=se.div` 2829 & .Polaris-Badge { 2830 background: linear-gradient( 2831 88deg, 2832 rgb(46, 66, 120) 1.73%, 2833 rgb(155, 144, 233) 25.2%, 2834 rgb(128, 159, 237) 46.89%, 2835 rgb(147, 125, 240) 60.27% 2836 ); 2837 .Polaris-Text--root { 2838 color: var(--p-color-bg-surface-caution-active); 2839 } 2840 } 2841`,U4=se.div` 2842 cursor: pointer; 2843 & .Polaris-Box { 2844 position: relative; 2845 } 2846`,F4=i.memo(D4),B4=ae({key:"isVisibleToastCsvState",default:!1}),Kh=ae({key:"toastProcessCsvState",default:{filename:"",status:"processing",success:0,failed:0,error:""}});function H4(){const{t}=J(),[s,n]=be(B4),a=ke(Kh),{isMobile:r}=xe(),o=ja({transform:s?"translateY(0%)":"translateY(100%)",opacity:s?1:0,zIndex:s?515:1,display:"flex",config:{mass:1,tension:280,friction:20}});return e.jsx(G4,{className:oe("toast-process-bottom",!s&&"hidden!"),style:{...o,bottom:r?65:21,right:r?18:95},children:e.jsx(Q,{background:"bg-fill-brand",width:r?"300px":"320px",children:e.jsxs("div",{className:"flex items-center justify-between gap-3 p-4",children:[a.status==="processing"?e.jsxs("div",{className:"[&>p]:text-white grid gap-1",children:[e.jsx(m,{variant:"headingMd",as:"p",fontWeight:"semibold",children:t("PushingProductFromFile")}),e.jsx(m,{variant:"bodyMd",as:"p",children:a.filename})]}):a.status==="success"?e.jsxs("div",{className:"[&>p]:text-white grid gap-1",children:[e.jsx(m,{variant:"headingMd",as:"p",fontWeight:"semibold",children:t("PushCompleted")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"[&>p]:text-white flex items-center gap-1",children:[e.jsx(ds,{source:Je,tone:"success"}),e.jsxs(m,{variant:"bodyMd",as:"p",children:[a.success," ",t("Succeeded").toLowerCase()]})]}),e.jsxs("div",{className:"[&>p]:text-white flex items-center gap-1",children:[e.jsx(ds,{source:Op,tone:"critical"}),e.jsxs(m,{variant:"bodyMd",as:"p",children:[a.failed," ",t("Failed").toLowerCase()]})]})]})]}):e.jsx("div",{className:"[&>p]:text-white grid gap-1",children:e.jsx(m,{variant:"headingMd",as:"p",fontWeight:"semibold",children:t("PushFailed")})}),e.jsx(Lt,{icon:Ws,variant:"tertiary",onClick:()=>n(!1)})]})})})}const G4=se(_r.div)` 2847 position: fixed; 2848 border-radius: var(--p-border-radius-300); 2849 overflow: hidden; 2850 box-shadow: var(--p-shadow-400); 2851 will-change: transform, opacity; 2852 transform: translateZ(0); 2853 backface-visibility: hidden; 2854`;function Ou(t,s){return t.type==="push"&&t.success&&!!s}function W4(t){ea.add([{id:t,tag:"new"}])}function V4(t,s){const n=t.filter(oa),a=s.filter(oa),r=t.filter(Ra),o=s.filter(Ra),l=t.filter(Ci),c=s.filter(Ci),u=n.length>0&&n.every(f=>f.status!=="processing"),d=a.length>0&&a.every(f=>f.status!=="processing"),g=r.length>0&&r.every(f=>f.status!=="processing"),h=o.length>0&&o.every(f=>f.status!=="processing"),p=l.length>0&&l.every(f=>f.status!=="processing"),x=c.length>0&&c.every(f=>f.status!=="processing");return{transitionPush:d&&!u,transitionEditor:h&&!g,transitionImportFromStore:x&&!p}}class Y4{completedIds=new Set;orphanPushIds=new Set;pusherUnbindCallback;hasInitialData=!1;recordOrphanPush(s){this.orphanPushIds.add(s),W4(s)}emitItemCompleted(s){const n=`${s.id}_${s.channel}`;this.completedIds.has(n)||(Zs.emit({type:"TOAST_ITEM_COMPLETED",payload:{timestamp:Date.now(),product:s}}
2854),s.status==="success"&&Zs.emit({type:"TOAST_ITEM_SUCCESS",payload:{timestamp:Date.now(),product:s}}),this.completedIds.add(n))}emitAllCompleted(s){this.hasInitialData&&Zs.emit({type:"TOAST_ALL_COMPLETED",payload:{timestamp:Date.now(),products:s}})}emitPushScopeCompleted(s){this.hasInitialData&&(Zs.emit({type:"TOAST_ALL_COMPLETED_PUSH",payload:{timestamp:Date.now(),products:s}}),ea.set(s.filter(n=>n.status==="success").map(n=>({id:n.id+"",tag:"new"}))))}emitEditorScopeCompleted(s){this.hasInitialData&&(Zs.emit({type:"TOAST_ALL_COMPLETED_EDITOR",payload:{timestamp:Date.now(),products:s}}),ea.set(s.filter(n=>n.status==="success").map(n=>({id:n.id+"",tag:"updated"}))))}emitImportFromStoreScopeCompleted(s){this.hasInitialData&&(Zs.emit({type:"TOAST_ALL_COMPLETED_IMPORT_FROM_STORE",payload:{timestamp:Date.now(),products:s}}),ea.set(s.filter(n=>n.status==="success").map(n=>({id:n.id+"",tag:"new"}))))}emitCsvPushCompleted(){this.orphanPushIds.size!==0&&(ea.set(Array.from(this.orphanPushIds).map(s=>({id:s,tag:"new"}))),Zs.emit({type:"TOAST_CSV_PUSH_COMPLETED",payload:{timestamp:Date.now()}}),this.orphanPushIds.clear())}initPusherListener(s,n,a,r,o,l,c,u,d,g){const h=window.channelPusher;if(!h)return;const p=x=>{const f=x.data||{},_={completed:[],isAllComplete:!1,transitionPush:!1,transitionEditor:!1,transitionImportFromStore:!1},b=f.product_id?.toString(),v=f?.data?.product_package_id?.toString(),y=f?.data?.supplier_product_id?.toString(),C=f?.store?.channel==="shopify"&&!f.success,S=a.find(j=>String(j.id)===b);if(f.type==="import"){if(f.data?.is_pending===!0){g(f);return}if(n(j=>({...j,unpushed:j.unpushed+1})),r(j=>{const A=f.success?"success":"error";return j.map(E=>({...E,product_package_id:E.id===b?v:E.product_package_id,status:E.id===b?A:E.status}))}),S&&d(),f.success&&o.productId&&l(j=>({...j,productId:b||"",product_package_id:v||"",openEditor:!0,removeAfterClose:!0})),c&&S&&b!==o.productId)if(f.success)c.success(u("AddedToFavoritesSuccessfully"));else{const j=f.error||u("AddedToFavoritesFailed");c.error(j)}}if(s(j=>{if(j.length>0&&!this.hasInitialData&&(this.hasInitialData=!0),!this.hasInitialData&&j.length===0)return Ou(f,v)&&this.recordOrphanPush(v),j;let A=!1;const E=j.map(k=>{const O=y===k.id?.toString()||b===k.id?.toString()||v===k.id?.toString();if(O&&f.type==="import"&&k.status==="processing"){A=!0;const R=f.success?"success":"error",P={...k,status:R,error:f.success?k.error:f.error||"UnknownError",errors:f?.errors||[],id:String(f.data?.product_package_id??f.product_id??k.id),source_product_id:k.source_product_id||k.id};return _.completed.push(P),P}if(O&&f?.store?.channel===k.channel){const R=f.success?"success":"error";if(k.status!=="success"&&k.status!==R){A=!0;const P={...k,status:R,error:f.success?k.error:f.error||"UnknownError",errors:f?.errors||[],id:String(f.data?.product_package_id??f.product_id??k.id),source_product_id:k.source_product_id||k.id};return _.completed.push(P),P}}else if(C&&O&&k.status!=="success"&&k.status!=="error"){A=!0;const R={...k,status:"error",error:f.error||"UnknownError",errors:f?.errors||[]};return _.completed.push(R),R}return k});!A&&Ou(f,v)&&this.recordOrphanPush(v),_.isAllComplete=E.every(k=>k.status!=="processing");const T=V4(j,E);return _.transitionPush=T.transitionPush,_.transitionEditor=T.transitionEditor,_.transitionImportFromStore=T.transitionImportFromStore,E}),this.hasInitialData){const j=A=>A.status==="success"||A.status==="error";setTimeout(()=>{_.completed.forEach(A=>{this.emitItemCompleted(A)}),_.transitionPush&&s(A=>{const E=A.filter(T=>oa(T)&&j(T));return this.emitPushScopeCompleted(E),this.emitAllCompleted(E),A}),_.transitionEditor&&s(A=>{const E=A.filter(T=>Ra(T)&&j(T));return this.emitEditorScopeCompleted(E),this.emitAllCompleted(E),A}),_.transitionImportFromStore&&s(A=>{const E=A.filter(T=>Ci(T)&&j(T));return this.emitImportFromStoreScopeCompleted(E),this.emitAllCompleted(E),A})},0)}};h.bind(Ot.PRODUCT_PUSHED,p),h.bind(Ot.PRODUCT_PUSH,p),this.pusherUnbindCallback=()=>{h.unbind(Ot.PRODUCT_PUSHED),h.unbind(Ot.PRODUCT_PUSH),this.reset()}}emitCleared(){Zs.emit({type:"TOAST_CLEARED",payload:{timestamp:Date.now()}}),this.reset()}cleanup(){this.pusherUnbindCallback&&(this.pusherUnbindCallback(),this.pusherUnbindCallback=void 0),this.reset()}reset(){this.completedIds.clear(),this.orphanPushIds.clear(),this.hasInitialData=!1}}const Qo=new Y4,z4=()=>{const t=he(Kh),s=({data:n})=>{n.type==="import-from-csv"&&(n.success?(t(a=>({...a,status:"success",success:n.success_count,failed:n.error_count})),setTimeout(()=>{Qo.emitCsvPushCompleted()},0)):t(a=>({...a,status:"error",error:n.error})))};return i.useEffect(()=>(window.channelPusher.bind(Ot.IMPORT_CSV,s),()=>{window.channelPusher&&window.channelPusher.unbind(Ot.IMPORT_CSV,s)}),[]),null},K4=ae({key:"statusPaymentState",default:"form"});function Q4(){const[t,s]=i.useState(!1),[n,a]=i.useState(0),{isMobile:r}=xe();return{openPopup:i.useCallback((l,c="_blank",u="")=>{const d=window.open(l,c,u),g=r&&Ce.isShopifyEmbedded()?!1:!d||d.closed||typeof d.closed>
2854"u";if(g)s(!0),a(new Date().getTime());else{s(!1),d?.focus();const h=setInterval(()=>{(!d||d.closed)&&(clearInterval(h),window.dispatchEvent(new CustomEvent("zopi_popup_closed")))},500)}return{newWindow:d,blocked:g}},[]),popupBlocked:t,timePopupBlocked:n}}function q4(){const[t,s]=i.useState(""),[n,a]=i.useState(!1),{getIsAutoPayment:r}=pr(),o=he(pl),l=bt(),c=i.useCallback(async d=>{try{a(!0);try{const{data:g,status:h}=await K0.postMakePayment({...d,is_auto_payment:r(d.method||"credit_card")});if(h===fe.OK)if(!g?.payment_auto)g?.payment_url?s(g?.payment_url||""):l.error("Invalid payment method");else{const p=(g.payment_info||[]).map(x=>({title:x.order_name,source_no:x.order_no,key:g.payment_info.map(f=>f.id).sort().join("_"),status:g.error==="ORDER_PAYMENT_FAIL"?"error":"processing",error_message:g.error==="ORDER_PAYMENT_FAIL"?"ORDER_PAYMENT_FAIL":"",id:x.id,time_action:it().format("YYYY-MM-DD HH:mm:ss"),line_items:g.payment_info.map(f=>({id:f,source_order:{order_no:f}}))}));o(x=>({...x,payment:[...x.payment,...p]}))}return g?.payment_url||""}catch(g){return console.error(g),""}}catch(g){return console.error("useFetchPayment",g),""}finally{a(!1)}},[a,s,l]),u=i.useCallback(()=>{s("")},[s]);return{paymentLink:t,isLoading:n,fetchPaymentLink:c,handleResetPaymentLink:u}}const Z4="/assets/blocked-popup-chrome-D5LC6eFS.webp",X4="/assets/blocked-popup-safari-CN3T2Yxn.webp",J4=i.forwardRef((t,s)=>{const{t:n}=J(),[a,r]=i.useState(!1),[o,l]=i.useState(""),{browserDetect:c}=Rh(),u=()=>{r(!1)};i.useImperativeHandle(s,()=>({onOpen:(h="")=>{l(h),r(p=>p||!0)}}));const d=c(),g=[{content:n("Cancel"),onAction:()=>{u()}}];return e.jsx(Xe,{open:a,title:n("AllowPopupsForPayment"),onClose:u,sectioned:!0,primaryAction:o?{content:n("OpenLink"),url:o,target:"_blank",onAction:()=>{u()}}:{content:n("IUnderStand"),onAction:()=>{u()}},secondaryActions:g,children:e.jsxs(D,{gap:"400",children:[e.jsxs(D,{gap:"100",children:[e.jsxs(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:[n("PaymentVia")," ",o.includes("aliexpress")?"AliExpress":"Zopi"]}),e.jsxs(m,{as:"span",tone:"subdued",children:["Your browser blocked the payment popup. Please click"," ",e.jsx(aa,{url:o,target:"_blank",children:n("OpenLink")})," ","to complete your payment."]})]}),e.jsx(D,{gap:"400",children:e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"headingMd",fontWeight:"semibold",children:"Browser is blocking"}),e.jsx(m,{as:"span",tone:"subdued",children:"It seems your browser is blocking the Zopi payment pop-up. Please follow the steps below before continuing."}),e.jsxs(Lr,{type:"number",children:[e.jsx(Lr.Item,{children:e.jsxs(m,{as:"span",fontWeight:"regular",tone:"subdued",children:["In the address bar, click"," ",e.jsx(m,{as:"span",fontWeight:"semibold",tone:"subdued",children:"Pop-up"})," ","blocked ."]})}),e.jsx(Lr.Item,{children:e.jsxs(m,{as:"span",fontWeight:"regular",tone:"subdued",children:["Select"," ",e.jsx(m,{as:"span",tone:"subdued",fontWeight:"semibold",children:"Always allow pop-ups"})," ","and redirects from [",e.jsx("a",{href:$4[d.browserName]||"",target:"_blank",style:{color:"var(--p-color-text-link)"},rel:"noreferrer",children:"link"}),"]"]})}),e.jsx(Lr.Item,{children:e.jsx(m,{as:"span",fontWeight:"regular",tone:"subdued",children:"All done. If any issues arise afterward, please reach out to our support team."})})]}),e.jsx("img",{src:e5[d.browserName],alt:""})]})})]})})}),$4={Chrome:"https://support.google.com/chrome/answer/95472",Safari:"https://support.apple.com/en-vn/guide/safari/sfri40696/mac"},e5={Chrome:Z4,Safari:X4},Qh=(t,s)=>{const n=s.join(",");for(const a of t)if(a&&a.join(",")===n)return!0;return!1},Du=(t,s)=>{const n=new Set;for(const a of t)!(Array.isArray(a)&&a.length===s.length&&a.every((r,o)=>r===s[o]))&&q.size(a)&&n.add(a);return n};function FN(){const{getPaymentReference:t}=pr(),[s,n]=be(Uh),[a,r]=be(CI),o=ke(Q0),l=he(Fh),{payment_behavior:c}=t(),u=i.useCallback(async x=>{c==="default"?n(f=>new Set(f).add(x)):r(x)},[c,n,r]),d=i.useCallback(async x=>{l(x)},[l]),g=i.useCallback(x=>c==="default"?Qh(s,x):a.includes(x[0]),[c,s,a]),h=i.useCallback(x=>o.some(f=>f.source_no===x),[o]),p=i.useCallback(x=>o.find(f=>f.source_no===x),[o]);return{onPayment:u,isProcessing:g,onPaymentLink:d,isProcessingAutoPay:h,getProcessingAutoPay:p}}const t5=()=>{const{getPaymentReference:t}
2854=pr(),{payment_method:s="stripe"}=t(),{openPopup:n,popupBlocked:a,timePopupBlocked:r}=Q4(),[o,l]=be(Uh),[c,u]=be(Fh),{fetchPaymentLink:d}=q4(),g=i.useRef(null),h=i.useRef(new Set),p=i.useRef(""),x=he(K4),f=async _=>{try{h.current.add(_);const b=await d({order_nos:_,source:ui.zopi,method:s});b&&(console.log(`Payment URL for order ${_}: ${b}`),p.current=b,n(b)),l(v=>Du(v,_)),h.current.delete(_)}catch(b){console.error(`Failed to process payment for order ${_}:`,b),l(v=>Du(v,_)),h.current.delete(_)}};return i.useEffect(()=>{const _=[...o].filter(b=>!Qh(h.current,b)).filter(b=>q.size(b));q.size(_)&&_.forEach(b=>{f(b)})},[o,s]),i.useEffect(()=>{c&&(p.current=c,n(c),u(""))},[c]),i.useEffect(()=>{a&&(g.current?.onOpen(p.current||""),x("form"))},[a,r,p.current]),i.useEffect(()=>()=>{p.current=""},[]),e.jsx(J4,{paymentMethod:s,ref:g})},s5=()=>{const t=he(pl),s=he(vI);he(Bh);const n=he(AI);pt();const{fetchCurrentPlan:a}=de(),r=()=>{window.channelPusher?.bind(Ot.ORDER_FULFILLMENT,g=>{const h=g?.data??{};console.log("dataPusher placement",h),t(p=>{const x=q0(p.placement||[],h);return{...p,placement:x?.map(f=>{if(h?.source_order_key===f?.orderSourceKey&&f.status==="processing"&&q.isEqual(h.line_items.sort(),f.line_items.map(_=>_.id).sort())){const _=h?.source_order?.error_message||h?.message||"";return h?.success?{...f,status:"success",payment_url:h.payment_info?.payment_url,source_no:h.source_order?.order_no+""}:{...f,status:"error",error_message:_??"",source_order_id:h.source_order.id,error_sub_message:h?.source_order?.error_sub_message||""}}return f})}})})},o=()=>{try{window.channelPusher?.bind(Ot.ORDER_SYNC,function(g){const h=g?.data||{};t(p=>{const x=p.syncOrderStatus||[];if(!q.size(x))return p;const f=x.map(_=>{const b={..._};return h.order_id===b.id&&b.status==="processing"&&(h.success?b.status="success":h.success||(b.status="error",b.error_message=h?.source_order?.error_message||"")),b});return{...p,syncOrderStatus:f}})})}catch(d){console.log(d)}},l=()=>{window.channelPusher?.bind(Ot.ORDER_PAYMENT,function(g){const h=g?.data??{};console.log("dataPusher",h),t(p=>{const f=(p.payment||[]).map(_=>{const b={..._};return _.key===h.key&&_.status==="processing"&&(h.success?(b.status="success",a()):(b.status="error",b.error_message=h?.message||"")),{...b,is_onboarding_automation:h.is_onboarding_automation}});return{...p,payment:f}})})},c=()=>{window.channelPusher?.bind(Ot.ORDER_PAY,function(g){const h=g?.data??{};s(p=>p.map(x=>{const f={...x};return q.isEqual(x.order_no,h.order_nos)&&x.status==="processing"&&(h.success?(f.status="success",a()):f.status="error"),f}))})},u=()=>{window.channelPusher?.bind(Ot.ORDER_SUPPLIER,function(g){const h=g?.data;if(h?.key&&h?.data?.product_id){const p=String(h.data.product_id);n(x=>({...x,[p]:{shipping_time:h.data?.shipping_time||"",shipping_fee:h.data?.shipping_fee}}));return}})};return i.useEffect(()=>{const d=window.channelPusher;return c(),()=>{d&&d.unbind(Ot.ORDER_PAY)}},[]),i.useEffect(()=>{const d=window.channelPusher;return r(),()=>{d&&d.unbind(Ot.ORDER_FULFILLMENT)}},[]),i.useEffect(()=>{const d=window.channelPusher;return o(),()=>{d&&d.unbind(Ot.ORDER_SYNC)}},[]),i.useEffect(()=>{const d=window.channelPusher;return l(),()=>{d&&d.unbind(Ot.ORDER_PAYMENT)}},[]),i.useEffect(()=>{const d=window.channelPusher;return u(),()=>{d&&d.unbind(Ot.ORDER_SUPPLIER)}},[]),e.jsx(t5,{})},Hn=ae({key:"toastProductAdded",default:{active:!1,products:[]}}),Kl=ns({key:"allProductAddedSelector",get:({get:t})=>t(Hn).products});ns({key:"activeStatusSelector",get:({get:t})=>t(Hn).active,set:({set:t},s)=>{const n=s;t(Hn,a=>({...a,active:n}))}});ns({key:"addProductAddedSelector",get:({get:t})=>t(Kl),set:({set:t},s)=>{t(Hn,n=>({...n,products:[...s,...n.products]}))}});const n5=ns({key:"updateProductErrorSelector",get:({get:t})=>t(Kl).filter(s=>s.error),set:({set:t},s)=>{t(Hn,n=>({...n,products:n.products.map(a=>a.source_product_id===s[0].source_product_id?{...a,error:s[0].error}:a)}))}});ns({key:"updateProductPushedSelector",get:({get:t})=>t(Kl).filter(s=>s.is_pushed_to_store),set:({set:t},s)=>{t(Hn,n=>({...n,products:n.products.map(a=>a.source_product_id===s[0].source_product_id?{...a,is_pushed_to_store:!0}:a)}))}});const a5=()=>{const[t,s]=be(Hn),n=de(),{isMobile:a}=xe(),r=Cl(),o=he(La),l=he(Hv),{token:c}=vs(),u=i.useRef([]),d=async p=>{if(!q.size(p))return;const x={event_name:$.PRODUCT_CATALOG_IMPORT_ALL_COMPLETED,event_data:{find_product_add_to_import_list_position:"",collection_name:"",value:p.length,data:p}};Ke.trackingEventUsersAction(x),u.current=[]},g=async()=>{try{const{status:p,data:x}=await Xs.getProductElasticList({}
2854,c);p===Xt.OK&&o(b=>({...b,all:x?.total}));const{status:f,data:_}=await Xs.getProductPushUnpushCount(c);f===Xt.OK&&o(b=>({...b,pushed:_?.total_pushed||0,unpushed:_?.total_unpushed||0,totalPushedActive:_?.total_pushed_active||0,totalPushedDraft:_?.total_pushed_draft||0}))}catch(p){console.log("error",p)}},h=p=>{const x=p.success,f=p.product_id,_=p.product_package_id,b=p.error;s(v=>{let y=q.cloneDeep(v.products).map(j=>{if(j.source_product_id===f&&j.loading===!0){const A={product_id:f,status:x?1:0,error:b||"",niche:j.niche_name||"",position:j.position||"",collection_name:j.collection_name||""};!j.is_pushed_to_store&&u.current.push(A),x?j={...j,product_package_id:_,loading:!1}:j={...j,error:b,loading:!1}}return j});const C=y.filter(j=>j.loading===!0&&j.is_import_all===!0),S=q.cloneDeep(y).filter(j=>j.loading===!1&&j.is_import_all===!0&&j.error!==void 0&&["SYSTEM_QUOTA_EXCEEDED","EXCEED_QUOTA_LIMIT"].includes(j.error));return C.length===0&&q.size(u.current)&&(g(),d(u.current),y=q.cloneDeep(y).map(j=>({...j,is_import_all:!1})),n.fetchCurrentPlan().then(j=>{if(!n.checkCurrentPlanOfQuota("PRODUCT_IMPORT",j||void 0)&&S.length>0)if(a)r.quota({message:"PRODUCT_IMPORT"});else{const E=document.getElementById("btn-show-out-of-quota-when-import-all-modal-recent");if(E)E.click();else{const T=document.getElementById("btn-show-out-of-quota-when-import-all");T&&(T.click(),window.scrollTo({top:0,behavior:"smooth"}))}}})),{...v,products:y}})};return i.useEffect(()=>{t.products.length>0&&t.products.filter(x=>x.loading===!0).length===0&&l(!1)},[t.products]),i.useEffect(()=>{const p=window.channelPusher;p&&p.bind(Ot.PRODUCT_IMPORT,function(x){h(x.data)})},[window.channelPusher]),e.jsx(e.Fragment,{})},r5=ae({key:"orderTrackingFeatureLimitQuotaState",default:{content:"",featureKeys:[]}}),i5=ae({key:"orderTrackingRefreshTimeState",default:0});ae({key:"orderFulfilledState",default:null});ae({key:"syncOrderState",default:""});const o5=()=>{const t=de(),s=he(r5),[n,a]=be(i5),r=he(pl),o=i.useRef(null),l=u=>{u.out_of_quota&&s({content:"",featureKeys:["ORDER_TRACKING"]}),r(d=>({...d,order_tracking:d.order_tracking.map(g=>g.title===u.tracking_number?{...g,error_message:u.error||"",status:u.error?"error":"success",need_auto_tracking_number:u.need_auto_tracking_number||!1,url:u.need_auto_tracking_number?`${Y.GENERAL_SETTING.SUBROUTES.ORDER_FULFILLMENT.PATH}?tab=order_tracking`:g.url}:g)})),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(Date.now())},1e3)},c=()=>{window.channelPusher.bind(Ot.ORDER_TRACKING,d=>{d?.data?.tracking_number&&l(d.data)})};return i.useEffect(()=>{const u=window.channelPusher;return c(),()=>{u?.unbind(Ot.ORDER_TRACKING),o.current&&clearTimeout(o.current)}},[]),i.useEffect(()=>{n&&(t.fetchCurrentPlan(),setTimeout(()=>{a(0)},2e3))},[n,t,a]),null},l5=()=>{const[t,s]=be(F3),n=he(WC),a=u=>(u?Object.keys(u).find(g=>!u[g]):"")||Nn.PLACE_ORDER;return{openGuidelineWidget:u=>{s(d=>(!d.loading&&d.step[u]===!1&&n(g=>({...g,hiddenWidget:!1,openPopover:!0})),d))},postConfigGuideline:async u=>{const{dismiss:d,step:g}=u,h=g&&Object.keys(g)[0];h&&t.step[h]||s(p=>{if(h&&p.step[h])return p;const x={dismiss:d??p.dismiss,step:{...p.step,...g}},f={...p,...x,loading:!1,stepActiveKey:a(x.step)};return!f.isDone&&Object.values(f.step).every(_=>_)&&(f.isDone=!0),f})},fetchConfigGuideline:async()=>new Promise(u=>{setTimeout(()=>u({}),1500)}),getConfigGuideline:()=>t}};let yn;const qh=()=>{const{postConfigGuideline:t}=l5(),{isMobile:s}=xe(),n=bt(),{t:a}=J(),{token:r}=vs(),o=Fi(({snapshot:u,set:d})=>async(g,h,p={})=>{let x={status:0,data:null};try{const{onSuccessAction:f,isScrollable:_=!1}=p;x=await os.postImportElasticProducts({products:[g]});let b=x.data.error_message||x.message;x.status===fe.OK&&(ge.localStorage.remove(st.NICHES_RECOMMEND),yn&&clearTimeout(yn),yn=setTimeout(()=>{t({step:{FIND_AND_IMPORT:!0}})},200),f&&f(x)),x.status===fe.QUOTA_EXPIRED&&_&&!s&&window.scrollTo({top:0,behavior:"smooth"}),x.status&&[fe.BAD_REQUEST,fe.QUOTA_EXPIRED].includes(x.status)&&s&&x.status!==fe.QUOTA_EXPIRED&&n.error(a(b))}catch(f){console.error("Error importing product:",f)}finally{return x}}),l=Fi(({snapshot:u,set:d})=>async(g,h={})=>{let p={status:0,data:null};try{const{onSuccessAction:x,isScrollable:f=!1,type:_=void 0}=h;p=await os.postImportElasticProducts({products:g,type:_});let b=p.data.error_message||p.message;p.status===fe.OK&&(ge.localStorage.remove(st.NICHES_RECOMMEND),yn&&clearTimeout(yn),yn=setTimeout(()=>{t({step:{FIND_AND_IMPORT:!0}})}
2854,200),x&&x(p)),p.status===fe.QUOTA_EXPIRED&&f&&!s&&window.scrollTo({top:0,behavior:"smooth"}),p.status&&[fe.BAD_REQUEST,fe.QUOTA_EXPIRED].includes(p.status)&&s&&p.status!==fe.QUOTA_EXPIRED&&n.error(a(b))}catch(x){console.error("Error importing product:",x)}finally{return p}}),c=Fi(({snapshot:u,set:d})=>async(g,h={})=>{let p={status:0,data:null},x=!1;try{const{onSuccessAction:f,isScrollable:_=!1,eventName:b=$.PRODUCT_CATALOG_IMPORT_ALL_COMPLETED,collectionName:v,positionImport:y}=h,C={import_data:g};p=await os.postImportMultiProduct(C,r);const S=p.data?.success||{},j=p.data?.failed||{},A=Object.keys(S).length,E=Object.keys(j).length;let T=y,k=b,O=v;const R=[];if(A>0&&(yn&&clearTimeout(yn),yn=setTimeout(()=>{t({step:{FIND_AND_IMPORT:!0}})},200),f&&f(p)),E>0){g.forEach((N,K)=>{R.push({product_id:N.product_id+"",status:0,error:Object.values(j)?.[K],niche:N.niche||"",position:T||"",collection_name:O||""})});const P={event_name:k,event_data:{find_product_add_to_import_list_position:T,collection_name:O,value:R.length,source:q.join(q.uniq(g.map(N=>N.source).filter(Boolean)),","),data:R}};Ke.trackingEventUsersAction(P);const w=Object.values(j).filter(N=>["SYSTEM_QUOTA_EXCEEDED","EXCEED_QUOTA_LIMIT"].includes(`${N}`));w.length>0&&w.length===g.length&&(x=!0,_&&!s&&window.scrollTo({top:0,behavior:"smooth"}))}d(Hn,P=>{const w=q.cloneDeep(P.products).map((N,K)=>{let L="",W="";return Object.entries(S).forEach(([H,Z])=>{K<g.length&&N.source_product_id===H&&(W=Z+"")}),Object.entries(j).forEach(([H,Z])=>{K<g.length&&N.source_product_id===H&&(L=Z+"")}),(W!==""||L!=="")&&(O=N.collection_name||"",T=N.position||"",L!==""&&(N={...N,error:L,loading:!1}),W!==""&&(N={...N,product_package_id:Number(W)})),E===0&&K<g.length&&(N={...N,is_import_all:!0}),{...N,niche_name:N.niche_name||""}});return{...P,products:w}})}catch(f){console.error("Error importing product:",f)}return{...p,isQuotaExpired:x}});return{importProduct:o,importMultiProduct:c,importAllProduct:l}},Zh=()=>{const t=de(),{importAllProduct:s}=qh(),n=he(go),{token:a}=vs(),r=he(La),o=he(In),l=t.getCurrentPlanOfFeature("PRODUCT_LISTING"),c=(l?.limit||0)-(l?.usage||0),u=async()=>{try{const{status:h,data:p}=await Xs.getProductPushUnpushCount(a);h===fe.OK&&r(x=>({...x,pushed:(p?.total_pushed||0)+(p?.total_pending||0),unpushed:p?.total_unpushed||0,totalPushedActive:p?.total_pushed_active||0,totalPushedDraft:p?.total_pushed_draft||0,totalFrozen:p?.total_frozen||0,totalNormal:p?.total_normal||0,totalStockIssue:p?.total_stock_issue||0,totalPriceIssue:p?.total_price_issue||0,totalUnavailable:p?.total_supplier_missing||0,totalPending:p?.total_pending||0}))}catch{}};return{addToProductCenter:async h=>{const{products:p,onAddedSuccess:x,isNotSaveAddedState:f,position:_}=h;if(p.length===0)return;const b=c>0?p.slice(0,c):p,{status:v,data:y}=await s(b,{type:"pending"});Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_PRODUCT_ADDED,event_data:{product_id_lists:p.map(C=>C.supplier_product_id),position:_,value:p.length,source:q.join(q.uniq(p.map(C=>C.source).filter(Boolean)),",")}}),v===fe.OK&&(f||n(C=>{const S={...C};return b.forEach(j=>{j.supplier_product_id&&(S[j.supplier_product_id]={status:"pending"})}),S}),x&&x()),v===fe.QUOTA_EXPIRED&&o({feature_used:"PRODUCT_LISTING",keyFeature:"PRODUCT_LISTING",total_used:b.length||0,isFullPlan:!1})},onUpdateDataPusherAddToProductCenter:h=>{n(p=>{const x={...p},f=h?.product_id?.toString();return f&&x[f]&&(x[f]={...x[f],status:h?.success?"added":"error"}),Object.values(x).every(b=>b.status!=="pending")&&(u(),t.fetchCurrentPlan()),x})}}},Ql=ae({key:"productDetailOpenState",default:!1}),Xh=ae({key:"productDetailCurrentProductState",default:null}),Jh=ae({key:"productDetailProductsState",default:[]}),$h=ae({key:"productDetailCurrentIndexState",default:0}),e0=ae({key:"productDetailZIndexState",default:void 0}),t0=ae({key:"productDetailDisableButtonsState",default:!1}),c5=ae({key:"productDetailState",default:null}),d5=ae({key:"productDetailLoadingState",default:!0}),u5=ae({key:"productDetailFeatureOutQuotaState",default:[]});ae({key:"productDetailIsFromYouMayAlsoLikeState",default:!1});const s0=ae({key:"productDetailShipToState",default:"US"}),p5=ae({key:"productDetailSelectedCarrierIndexState",default:null}),h5=ae({key:"productDetailSelectedVariantsState",default:{}}),n0=ae({key:"productDetailCallbacksState",default:{}}),a0=ae({key:"eventState",default:null}),g5=ae({key:"productToOpenEditorState",default:{productId:"",product_package_id:"",openEditor:!1,removeAfterClose:!1}});
2854ae({key:"importingTypeState",default:"import"});const m5=t=>({setSelf:s,onSet:n})=>{const a=localStorage.getItem(t);a!=null&&s(JSON.parse(a)),n((r,o,l)=>{l?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(r))})},f5=ae({key:"isExcludedState",default:!1,effects:[m5("isExcludedState")]}),x5=()=>{const{fetchCurrentPlan:t}=de(),[,s]=be(Yl),n=he(La),[a,r]=be(g5),[o,l]=be(Yh),c=bt(),{t:u}=J(),{onUpdateDataPusherAddToProductCenter:d}=Zh();return i.useEffect(()=>(Qo.initPusherListener(s,n,o,l,a,r,c,u,t,d),()=>{Qo.cleanup()}),[s,o]),Vl("TOAST_ALL_COMPLETED",()=>{t()}),null},_5=()=>{const t=he(Wl);return i.useEffect(()=>{const s=window.accountPusher;if(!s)return;const n=r=>{const o=r.data,l=o.id?.toString();l&&t(c=>c.map(u=>{if(u.id===l){const d={...u,dataDetail:{...u.dataDetail,...o}};return o.status==="failed"&&(d.status="error"),o.trend_ready===!0&&(d.trendReady=!0),d}return u}))},a=r=>{const l=r.data.product_insight_id?.toString();l&&t(c=>c.map(u=>u.id===l?{...u,status:"success"}:u))};return s.bind(Ot.PRODUCT_INSIGHTS_UPDATED,n),s.bind(Ot.PRODUCT_INSIGHTS_COMPLETED,a),()=>{s.unbind(Ot.PRODUCT_INSIGHTS_UPDATED,n),s.unbind(Ot.PRODUCT_INSIGHTS_COMPLETED,a)}},[]),e.jsx(e.Fragment,{})},b5=()=>{const{fetchCurrentPlan:t}=de(),[s,n]=be(Vh),{setDataPushProcess:a,setDataImportProcess:r,removeDataPushProcess:o}=wi(),l=i.useRef(null),c=g=>Object.keys(g),u=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{t(),l.current=null},1e3)},d=()=>{const g=window.channelPusher,h=new Map(s.data.map(p=>[p.id,{...p}]));g.bind(Ot.PRODUCT_IMPORT,({data:p})=>{const{data:x,withSettingChannel:f}=s;switch(p.type){case"auto-split":x.forEach(y=>{if(p?.product_id?.toString()===y.id.toString()||p?.data?.supplier_product_id?.toString()===y.id.toString()){if(h.set(y.id,{...y,...h.get(y.id),product_package_id:p?.product_package_id||null,status:p.success?"success":"error",error:p?.error||""}),f&&p.success&&p?.product_package_ids){const C=p?.product_package_ids?.flatMap(A=>A.split_product_package_ids?A.split_product_package_ids.map(E=>({...y,id:E.toString(),source_product_id:p.data?.supplier_product_id,image:y?.image,title:y?.title,status:"processing",error:""})):[]),S=c(f),j=S.flatMap(A=>[{...y,id:p?.product_package_ids?.[0]?.product_package_id+"",source_product_id:p.data?.supplier_product_id,image:y?.image||"",title:y?.title||"",status:"processing",channel:A,error:"",pushScope:"pushed"},...C?.map(E=>({...E,channel:A,pushScope:"pushed"}))||[]]);a(j),o(S.map(A=>({id:p.data?.supplier_product_id?.toString()||p?.product_id.toString(),channel:A})))}if(f&&!p.success){const S=c(f).map(j=>({id:p.product_id,image:y.image,title:y.title,status:"error",channel:j,error:p.error||"UnknownError",pushScope:"pushed"}));a(S)}}});break;case"replicate-duplicate":p.duplicate_product_ids?.forEach(y=>{x.forEach(C=>{if(C.id.split("-")[0]===y.product_package_id+""){const S={id:y.duplicate_product_id+"",channel:C.channel||"",image:C.image,title:C.title,status:p.success?"processing":"error",error:p.error||""};a([S]),o([{id:C.id,channel:C.channel}])}})});break;case"duplicate":const b=p.duplicate_product_ids?.[0]?.product_package_id||p.product_package_id;x.forEach(y=>{if(b?.toString()===y.id.toString()||p.product_id?.toString()===y.id.toString()){const C={id:y.id,channel:"",image:y.image,title:y.title,status:p.success?"success":"error",error:p.error||""};if(a([C]),h.set(y.id,{...h.get(y.id),product_package_id:b||null,status:p.success?"success":"error",error:p?.error||""}),f&&p.success&&p?.duplicate_product_ids){u();const S=[];p?.duplicate_product_ids?.forEach(j=>{j.duplicate_product_id&&j.pushed_stores?.channels?.forEach(A=>{S.push({id:j.duplicate_product_id+"",image:y.image,title:y.title,status:"processing",error:"",channel:oc[A]||A})})}),a(S)}}});break;case"replicate-split":p.split_product_ids?.forEach(y=>{y.split_product_ids.forEach(C=>{x.forEach(S=>{if(S.id.split("-")[0]===y.product_package_id+""){const j={id:C+"",channel:S.channel||"",image:S.image,title:S.title,status:p.success?"processing":"error",error:p.error||""};a([j]),o([{id:S.id,channel:S.channel}])}})})});break;case"split":const v=p.split_product_ids?.[0]?.product_package_id||p.product_package_id;x.forEach(y=>{if(v?.toString()===y.id.toString()||p.product_id?.toString()===y.id.toString()){const C={id:y.id,channel:y.channel,image:y.image,title:y.title,status:p.success?"success":"error",error:p.error||""};if(a([C]),h.set(y.id,{...h.get(y.id),product_package_id:v||null,status:p.success?"success":"error",error:p?.error||""}),p.success&&p?.split_product_ids){u();const S=[];p?.split_product_ids?.forEach(j=>
2854{j.split_product_ids&&j.pushed_stores?.channels?.forEach(A=>{j.split_product_ids?.forEach(E=>{S.push({id:E+"",image:y.image,title:y.title,status:"processing",error:"",channel:oc[A]||A})})})}),a(S)}}});break;case"create-new-by-unmap":x.forEach(y=>{if(p.product_id?.toString()===y.id.toString()||p.data?.channel_product_id===y.id.toString()){const C={id:p?.data?.product_package_id+"",channel:y.channel||"",image:y.image,title:y.title,status:p.success?"processing":"error",error:p.error||""};a([C]),o([{id:y.id,channel:y.channel||""}])}});break;default:x.forEach(y=>{if(p?.product_id?.toString()===y.id.toString()&&(h.set(y.id,{...y,...h.get(y.id),product_package_id:p?.product_package_id||null,status:p.success?"success":"error",error:p?.error||""}),f&&p.success&&p?.product_package_id)){const S=Object.keys(f).map(j=>({id:p?.product_package_id+"",image:y?.image||"",title:y?.title||"",status:"processing",channel:j,error:""}));a(S)}});break}const _=Array.from(h.values());r(_,"update",f)})};return i.useEffect(()=>{d()},[s]),null},y5=()=>{const[t,s]=i.useState(!1),n=i.useRef({countInterval:0});return i.useEffect(()=>{const a=setInterval(()=>{window.channelPusher&&(s(!0),clearInterval(a)),n.current.countInterval>30&&clearInterval(a),n.current.countInterval+=1},500)},[]),t?e.jsxs(e.Fragment,{children:[e.jsx(a5,{}),e.jsx(o5,{}),e.jsx(s5,{}),e.jsx(x5,{}),e.jsx(b5,{}),e.jsx(z4,{}),e.jsx(_5,{})]}):null},C5=(t,s)=>{const{source_product_id:n,source:a,shipTo:r}=t,{enabled:o=!0}={},l=ws(),{data:c,isPending:u,refetch:d,isLoading:g}=ks({queryKey:vt.catalogDetail.productDetail(n,a,r),queryFn:async()=>{const h=l.getQueryData(vt.catalogDetail.productDetailPrefetch(n,a,r));return h||(await os.getProductDetail2({productId:n,source:a,ship_to:r})).data?.product},enabled:!!n&&o,staleTime:10*60*1e3});return{data:c,isPending:u,refetch:d,isLoading:g}};var Lu,Mu,Uu,Fu,Bu,Hu,Gu,Wu,Vu,Yu;function qo(){return qo=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},qo.apply(null,arguments)}const v5=t=>i.createElement("svg",qo({xmlns:"http://www.w3.org/2000/svg",width:166,height:157,fill:"none"},t),Lu||(Lu=i.createElement("path",{fill:"#F0F1F2",d:"M149.361 81.823c0 11.08-2.42 21.607-6.765 31.064-11.776 25.7-37.729 43.546-67.845 43.546-30.117 0-56.07-17.846-67.845-43.546C2.56 103.43.14 92.903.14 81.823c0-41.207 33.404-74.61 74.61-74.61 41.208 0 74.611 33.403 74.611 74.61"})),Mu||(Mu=i.createElement("path",{fill:"#E0B066",d:"M146.519 90.037c1.095 1.301.171 3.289-1.53 3.289H79.39a2 2 0 0 1-1.53-.712L59.239 70.502h69.899a2 2 0 0 1 1.53.711zM2.91 90.037c-1.096 1.301-.171 3.289 1.53 3.289h34.647a2 2 0 0 0 1.53-.712l18.621-22.112H20.292a2 2 0 0 0-1.53.711z"})),Uu||(Uu=i.createElement("path",{fill:"#CF9644",d:"M79.39 93.327a2 2 0 0 1-1.53-.712L59.239 70.502v77.891h66.83a4 4 0 0 0 4-4V93.327z"})),Fu||(Fu=i.createElement("path",{fill:"#D7A354",d:"M40.617 92.615a2 2 0 0 1-1.53.712H19.362v51.066a4 4 0 0 0 4 4h35.876V70.502z"})),Bu||(Bu=i.createElement("path",{fill:"#fff",d:"M89.49 133.276H68.64a1.992 1.992 0 1 1 0-3.984h20.85a1.992 1.992 0 1 1 0 3.984M89.49 141.01H68.64a2 2 0 0 1-1.845-1.23 1.98 1.98 0 0 1 0-1.524 1.99 1.99 0 0 1 1.844-1.23H89.49a1.992 1.992 0 1 1 0 3.984"})),Hu||(Hu=i.createElement("path",{fill:"#000",d:"M130.068 70.502H69.355a42.62 42.62 0 0 0 49.697 3.386l.387.385a13.44 13.44 0 0 0 3.965 9.409l9.663 9.644h16.222z",opacity:.08})),Gu||(Gu=i.createElement("path",{fill:"#4C3830",d:"m131.2 66.063-5.304-5.294a34.5 34.5 0 0 1-6.227 6.215l5.305 5.288a8.21 8.21 0 0 0 2.2 7.647l23.833 23.804a8.27 8.27 0 0 0 5.852 2.438 8.3 8.3 0 0 0 5.86-2.417 8.247 8.247 0 0 0 1.784-9.012 8.3 8.3 0 0 0-1.805-2.677L138.862 68.26a8.25 8.25 0 0 0-7.662-2.196"})),Wu||(Wu=i.createElement("path",{fill:"#3A7E62",d:"M96.582 74.999c20.624 0 37.343-16.686 37.343-37.27S117.206.459 96.581.459c-20.624 0-37.343 16.686-37.343 37.27s16.72 37.27 37.344 37.27"})),Vu||(Vu=i.createElement("path",{fill:"#F6F0F5",d:"M96.583 64.376a26.6 26.6 0 0 1-10.224-2.015 26.5 26.5 0 0 1-8.656-5.79c-10.41-10.39-10.41-27.295 0-37.684 10.427-10.407 27.332-10.407 37.759 0 10.41 10.39 10.41 27.295 0 37.684a26.569 26.569 0 0 1-18.88 7.805"})),Yu||(Yu=i.createElement("path",{fill:"#43474B",d:"m99.403 37.729 6.573-6.56a1.99 1.99 0 0 0 .027-2.842 2 2 0 0 0-1.43-.583 2 2 0 0 0-1.418.61l-6.572 6.56-6.573-6.56a1.997 1.997 0 0 0-3.406 1.408c0 .528.21 1.034.585 1.408l6.572 6.56-6.572 6.559a1.99 1.99 0 0 0 1.427 3.344c.516.01 1.016-.18 1.394-.53l6.573-6.56 6.572 6.56a2 2 0 0 0 1.411.584 2 2 0 0 0 1.844-1.23 1.993 1.993 0 0 0-.432-2.17z"}))),BN="/assets/not-found-product-DtMaBd2j.svg",zu=()=>{const{isMobile:t}=xe(),{t:s}=J();return e.jsx("div",{style:{marginTop:t?"var(--p-space-200)":"var(--p-space-400)"},children:e.jsxs("div",{className:"msui-flex-direction-columns msui-text-center ",style:{marginTop:"2rem",padding:t?"0px":"100px 0px"},children:[e.jsx("div",{className:"msui-mb-7",children:e.jsx(ee.Custom,{icon:v5})}
2854),e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx(m,{variant:"headingLg",fontWeight:"medium",as:"span",children:s("NoResultsFound")})}),e.jsx("div",{className:"msui-mb-1",children:e.jsx(m,{variant:"headingSm",fontWeight:"regular",as:"span",children:e.jsxs("span",{style:{color:"var(--p-text-subdued)"},children:[" ",s("SorryWeCouldFindAnythingThatMatch")]})})}),e.jsx("div",{className:"msui-mb-5",children:e.jsx(m,{variant:"headingSm",fontWeight:"regular",as:"span",children:e.jsx("span",{style:{color:"var(--p-text-subdued)"},children:s("PleaseFindAnotherOrTryAgain")})})})]})})},HN=()=>{const t=he(Ql),s=he(Xh),n=he(Jh),a=he($h),r=he(e0),o=he(t0),l=he(n0),c=he(a0);return{openProductDetail:g=>{const{event:h=null,product:p,products:x=[],currentIndex:f=0,zIndex:_,disableButtons:b,onClose:v,onProductChange:y}=g;c(h),s(p),n(x),a(f),r(_),o(!!b),l({onClose:v,onProductChange:y}),t(!0)},closeProductDetail:()=>{t(!1)}}},A5=()=>{const[t,s]=be(Ql),[n,a]=be(Xh),[r,o]=be(Jh),[l,c]=be($h),[u,d]=be(e0),[g,h]=be(t0),[p,x]=be(c5),[f,_]=be(d5),[b,v]=be(u5),[y,C]=be(s0),[S,j]=be(h5),[A,E]=be(n0),[T,k]=be(a0);return{open:t,setOpen:s,event:T,setEvent:k,currentProduct:n,setCurrentProduct:a,products:r,setProducts:o,currentIndex:l,setCurrentIndex:c,zIndex:u,setZIndex:d,disableButtons:g,setDisableButtons:h,productDetail:p,setProductDetail:x,loadingDetail:f,setLoadingDetail:_,featureOutQuota:b,setFeatureOutQuota:v,productDetailShipTo:y,setProductDetailShipTo:C,selectedVariants:S,setSelectedVariants:j,callbacks:A,setCallbacks:E}},S5=()=>{const t=dt().getCurrency(),{currencyFindProductConfig:s}=Vn(),n=ke(ul),a=s(),r=Ca(n,"USD",t||"USD"),o=i.useMemo(()=>(c,u=!0,d)=>{const g=u?r:1,h=c?`${a.currency.currencySymbol} ${On(Vt(Number(c*g)))}`:"-";return d?.noSpace?h.replaceAll(" ",""):h},[a,t]);return{convertPrice:i.useMemo(()=>(c,u=!0)=>c?Vt(Number(c*(u?r:1))):0,[a,t]),convertPriceWithFormatter:o}},j5=[],oo={current:null},mn=({productDetail:t,cost_price:s,enabled:n=!0})=>{const{t:a}=J(),{convertPriceWithFormatter:r}=S5(),{source_product_id:o,source:l,price_range:c,sku_id:u}=t||{},[d,g]=be(s0),[h,p]=be(p5),x=o,f=l,_=q.includes(f,"zopi");c?.[0];const{token:b}=vs(),v=i.useCallback(async(N,K="CN",L)=>{if(!x||!f)return null;try{const{data:W,status:H}=await os.getProductLogistics({params:{country_code:N,ship_from:K,product_id:x,source:q.includes(f,"zopi")?"zopi":f,sku_id:L},token:b});return H===fe.OK&&W?.logistics?{minShipping:q.minBy(W.logistics,Z=>Z.amount)||null,carriers:W.logistics}:null}catch(W){return console.log("error product logistics",W),null}},[x,f,b]),{data:y,isLoading:C}=ks({queryKey:vt.catalogDetail.productLogistics(x||"",f||"",d,"CN",u),queryFn:()=>v(d,"CN",u),enabled:!!(x&&f)&&n,staleTime:5*60*1e3}),S=y?.carriers||j5,j=y?.minShipping??null,A=i.useMemo(()=>!S.length||!j?-1:S.indexOf(j),[S,j]),E=i.useMemo(()=>!S.length||A<0?-1:h!=null&&h>=0&&h<S.length?h:A,[S,A,h]),T=E>=0&&S[E]?S[E]:null,k=`${x??""}|${d}`;i.useEffect(()=>{if(oo.current===k)return;const N=oo.current!==null;oo.current=k,N&&p(null)},[k,p]);const O=(N,K=!1)=>q.isNil(N)?"-":K&&N===0?a("Free"):r(N),R=N=>Zt[N],P=i.useMemo(()=>{const N=T?.ship_to_country||d;if(!N)return null;const K=N.toUpperCase(),L=R(K);if(!L)return null;let W=L.label;return K==="GB"&&(W+=" (GB)"),K==="UK"&&(W+=" (UK)"),{icon:L.icon,label:W}},[T?.ship_to_country,d]),w=i.useCallback(()=>!q.isNil(T?.amount),[T?.amount]);return{productDetailShipTo:d,shippingInfo:T,loading:C,carriers:S,selectedCarrierIndex:h,effectiveCarrierIndex:E,setSelectedCarrierIndex:p,setProductDetailShipTo:g,isZopi:_,productId:x,productSource:f,getSelectedCountryInfo:P,renderPrice
2854:O,isShippingAvailable:w}},Tr=({productDetail:t,selectedVariants:s,onVariantChange:n,shipToCountry:a})=>{const r=ws(),{t:o}=J(),{formatConvertedAmount:l}=Vn(),{isMobile:c}=xe(),[u,d]=i.useState({}),g=s||u,{options:h,variants:p,price_range:x,source:f,source_product_id:_}=t||{},{data:b}=ks({queryKey:vt.catalogDetail.productDetailPrice(_??"",f??"",a??""),queryFn:async()=>{if(!a||!_)return[];const R=r.getQueryData(vt.catalogDetail.productDetail(_,f??"aliexpress",a??""));if(R)return R.variants||[];const{status:P,data:w}=await os.getProductDetail2({source:f??"aliexpress",productId:_,ship_to:a});return P===fe.OK?w?.product?.variants||[]:[]},enabled:!!a&&!!_,staleTime:5*60*1e3,gcTime:10*60*1e3}),v=b||[],y=i.useCallback((R,P,w)=>{const N={...g,[R]:P};n?n(N):d(N)},[g,n]),C=i.useCallback(()=>{if(!h||h.length===0)return c?"...":o("SelectVariant");const R=h.map(P=>{const w=g[P.name];return w?c?`${w}`:`${w}`:""}).filter(Boolean);return R.length>0?R.join(" / "):o("SelectVariant")},[h,g,c,o]),S=i.useCallback(()=>{if(!h||h.length===0)return"_";const R=h.map(P=>{const w=g[P.name];return w?`${w}`:""}).filter(Boolean);return R.length>0?R.join(" / "):"_"},[h,g,c,o]),j=i.useCallback(()=>{if(f==="aliexpress"&&v.length>0){const R=v.map(P=>Number(P.price_usd)||0).filter(P=>P>0);if(R.length>0){const P=Math.min(...R),w=Math.max(...R);return P===w?`${l(P,!0)}`:`${l(P)} - ${l(w,!0)}`}}return x?`${l(x?.[0])} - ${l(x?.[1],!0)}`:""},[f,v,x,l]),A=i.useCallback(()=>{if(Object.keys(g).length===0||!p)return j();const P=p.find(w=>!w.sku_property||w.sku_property.length===0?!1:w.sku_property.every(N=>{const K=g[N.sku_property_name];return K===N.sku_property_value||K===N.property_value_definition_name}));if(f==="aliexpress"&&v.length>0&&P?.aliexpress_options){const w=v.find(N=>N.aliexpress_options===P.aliexpress_options);if(w?.price_usd)return`${l(Number(w.price_usd)||0,!0)}`}return P?`${l(Number(P?.price_usd)||0,!0)}`:j()},[g,p,f,v,l,j]),E=i.useCallback(()=>{if(Object.keys(g).length===0||!p){if(f==="aliexpress"&&v.length>0){const w=v.map(N=>Number(N.price_usd)||0).filter(N=>N>0);if(w.length>0){const N=Math.min(...w),K=Math.max(...w);return N===K?{isSingle:!0,value:N}:{isSingle:!1,min:N,max:K}}}return x&&Array.isArray(x)?{isSingle:!1,min:x[0],max:x[1]}:{isSingle:!1,min:0,max:0}}const P=p.find(w=>!w.sku_property||w.sku_property.length===0?!1:w.sku_property.every(N=>{const K=g[N.sku_property_name];return K===N.sku_property_value||K===N.property_value_definition_name}));if(f==="aliexpress"&&v.length>0&&P?.aliexpress_options){const w=v.find(N=>N.aliexpress_options===P.aliexpress_options);if(w?.price_usd)return{isSingle:!0,value:Number(w.price_usd)||0}}return P?.price_usd?{isSingle:!0,value:Number(P.price_usd)||0}:x&&Array.isArray(x)?{isSingle:!1,min:x[0],max:x[1]}:{isSingle:!1,min:0,max:0}},[g,p,f,v,x]),T=i.useCallback(()=>{if(Object.keys(g).length===0||!p)return null;const P=p.find(w=>!w.sku_property||w.sku_property.length===0?!1:w.sku_property.every(N=>{const K=g[N.sku_property_name];return K===N.sku_property_value||K===N.property_value_definition_name}));return P||null},[g,p]),k=i.useCallback(()=>{const R=T();return R?R.quantity!==void 0&&R.quantity!==null?R.quantity.toLocaleString("en"):"N/A":"-"},[T]),O=i.useCallback(()=>{if(!h||!p)return{};const R={};for(const P of h){R[P.name]={};for(const w of P.values){const N=p.filter(K=>K.sku_property?.some(L=>L.sku_property_name===P.name&&L.property_value_definition_name===w.value)&&K.sku_property?.every(L=>{if(L.sku_property_name===P.name)return!0;const W=g[L.sku_property_name];return W?W===L.property_value_definition_name:!0}));R[P.name][w.value]=N.reduce((K,L)=>K+(L.quantity??0),0)}}return R},[h,p,g]);return i.useEffect(()=>{d({}),n&&n({})},[t?.source_product_id,n]),i.useEffect(()=>{if(!h?.length||!p?.length||Object.keys(g).length>0)return;const R=p.find(w=>(w.quantity??0)>0)??p.find(w=>(w.sku_property?.length??0)>0)??p[0];if(!R?.sku_property?.length)return;const P=R.sku_property.reduce((w,N)=>(w[N.sku_property_name]=N.property_value_definition_name||N.sku_property_value,w),{});Object.keys(P).length!==0&&(n?n(P):d(P))},[h,p,g,n]),{isReady:!!b,selectedVariants:g,handleVariantChange:y,get
2854SelectedVariantLabel:C,getSelectedVariant:S,getCurrentPrice:A,getCurrentPriceUsdValue:E,getCurrentStock:k,getMatchingVariant:T,getOptionQuantityMap:O}},E5=({productDetail:t,selectedVariants:s})=>{const{product_link:n=""}=t||{},a=t?.name||"",{productDetailShipTo:r}=mn({productDetail:t}),{getCurrentPrice:o}=Tr({productDetail:t,selectedVariants:s,shipToCountry:r});return e.jsx("div",{"data-testid":"product-info",children:e.jsxs(D,{gap:"300",children:[e.jsx("a",{href:n,target:"_blank",className:"min-w-0 cursor-pointer hover:underline",rel:"noreferrer",children:e.jsx(Et,{content:a,children:e.jsx(m,{variant:"headingLg",as:"span",tone:"subdued",truncate:!0,children:a})})}),e.jsxs(U,{blockAlign:"center",gap:"200",children:[Number(t?.evaluation_count)?e.jsxs(U,{blockAlign:"center",gap:"100",children:[e.jsx(m,{as:"span",variant:"bodyXs",fontWeight:"semibold",children:t?.avg_evaluation_rating||0}),e.jsx("span",{className:"text-bg-fill-warning",children:e.jsx(yo,{className:"w-3.5 h-3.5",fill:"currentColor"})}),e.jsxs(m,{as:"span",variant:"bodyXs",tone:"subdued",children:["(",t?.evaluation_count||0,")"]})]}):e.jsxs(U,{blockAlign:"center",gap:"100",children:[e.jsx("span",{className:"text-bg-fill-selected",children:e.jsx(yo,{className:"w-3.5 h-3.5",fill:"currentColor"})}),e.jsx(m,{as:"span",variant:"bodyXs",tone:"subdued",children:"(0)"})]}),!!t?.evaluation_count&&e.jsx("hr",{className:"h-2 w-px bg-border"}),e.jsxs(m,{as:"span",variant:"bodyXs",children:[e.jsx("strong",{children:Fe(t?.lastest_volume||0)||"-"}),e.jsx("span",{className:"text-text-secondary",children:" sold"})]})]}),e.jsx(U,{gap:"300",blockAlign:"center",children:e.jsx(m,{as:"h2",variant:"headingLg",children:o()})})]})})},Zo={CAINIAO_STANDARD_SG_AIR:"Cainiao Standard - SG Air",CAINIAO_SUPER_ECONOMY:"Cainiao Super Economy",AE_CN_SUPER_ECONOMY_G:"Cainiao Super Economy Global",CAINIAO_SUPER_ECONOMY_SG:"Cainiao Super Economy for Special Goods",CAINIAO_EXPEDITED_ECONOMY:"Cainiao Expedited Economy",YANWEN_JYT:"China Post Ordinary Small Packet Plus",FLYT_ECONOMY_SG:"Flyt Special Economy",SUNYOU_ECONOMY_SG:"SunYou Special Economy",YANWEN_ECONOMY_SG:"YANWEN Special Economy",TOPYOU_ECONOMY_SG:"TOPYOU Special Economy",BSC_ECONOMY_SG:"BSC Special Economy",SUNYOU_ECONOMY:"SunYou Economic Air Mail",YANWEN_ECONOMY:"Yanwen Economic Air Mail",SGP_OMP:"4PX Singapore Post OM Pro",CAINIAO_ECONOMY:"AliExpress Saver Shipping",CAINIAO_ECONOMY_SG:"Cainiao Saver Shipping For Special Goods",CAINIAO_STANDARD:"AliExpress Standard Shipping",CAINIAO_CONSOLIDATION_BR:"AliExpress Direct (Brazil)",CAINIAO_CONSOLIDATION_
2854SA:"AliExpress Direct (Saudi Arabia)",CAINIAO_CONSOLIDATION_AE:"AliExpress Direct (UAE)",CAINIAO_FULFILLMENT_STD:"AliExpress Selection Standard",ARAMEX:"Aramex",CAINIAO_STANDARD_HEAVY:"Cainiao Heavy Parcel Line",CAINIAO_STANDARD_SG:"Cainiao Standard For Special Goods",CPAP:"China Post Air Parcel",CPAM:"China Post Registered Air Mail",CHOICE:"CHOICE",CKE:"CKE Express",CNE:"CNE Express",AE_360LION_STANDARD:"360Lion Standard Packet",CORREIOS_BR:"Post Brazil",DHLECOM:"DHL e-commerce",LAOPOST:"TOPYOU",EMS_ZX_ZX_US:"ePacket",eTotal:"eTotal",FLYT:"Flyt Express",GES:"GES Express",JCEX:"JCEX Express",CTR_LAND_PICKUP:"AliExpress Saver Shipping",MEEST:"Meest",POSTKR:"POSTKR",SF_EPARCEL:"SF eParcel",SGP:"Singapore Post",YANWEN_AM:"Special Line-YW",SUNYOU_RM:"SunYou",UBI:"UBI",ECONOMIC139:"139 ECONOMIC Package",YANWEN_STANDARD_SG:"YANWEN Special Standard",SHUNYOU_STANDARD_SG:"SHUNYOU_STANDARD_SG",FOURPX_RM:"4PX RM",CAINIAO_PREMIUM:"AliExpress Premium Shipping",DHL:"DHL",TOLL:"DPEX",EMS:"EMS",E_EMS:"e-EMS",FEDEX_IE:"FedEx IE",FEDEX:"FedEx IP",SF:"SF Express",UPSE:"UPS Expedited",UPS:"UPS Express Saver",OTHER:"Sellerâs Shipping Method",OTHER_US:"Sellerâs Shipping Method - US",OTHER_PL:"Sellerâs Shipping Method - PL",TNT:"TNT",Other:"Seller's Shipping Method"},GN=t=>t&&(Zo[t]??t),ci=["US","FR","DE","IN","UK","GB"],lo=sA(ci),T5=({productDetail:t})=>{const{t:s}=J(),{loading:n,shippingInfo:a,renderPrice:r,isShippingAvailable:o,productDetailShipTo:l,setProductDetailShipTo:c,carriers:u,effectiveCarrierIndex:d,setSelectedCarrierIndex:g}=mn({productDetail:t}),[h,p]=i.useState(!1),[x,f]=i.useState(""),[_,b]=i.useState(lo),[v,y]=i.useState(0),C=i.useRef(null),S=a?.service_name,j=()=>{requestAnimationFrame(()=>{p(R=>!R)})},A=e.jsx("div",{className:"bg-bg-surface-active p-3 rounded-xl cursor-pointer",onClick:j,ref:C,children:e.jsxs(U,{blockAlign:"center",wrap:!1,gap:"100",children:[e.jsx("table",{children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"pr-3",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",truncate:!0,children:s("ShipTo")})}),e.jsx("td",{children:e.jsx(lr,{fontSize:20,removeMarginRight:!0,className:"flex-row-reverse gap-2 justify-end",country:l,renderCountry:R=>e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",truncate:!0,children:e.jsx("span",{children:R})})})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"pr-3 pt-2",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",truncate:!0,children:s("Carrier")})}),e.jsx("td",{className:"pt-2",children:n?e.jsx(Se,{height:20,width:120}):e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",truncate:!0,children:S?Zo[S]??S:"-"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"pr-3 pt-2",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",truncate:!0,children:s("Delivery")})}),e.jsx("td",{className:"pt-2",children:n?e.jsx(Se,{height:20,width:120}):o()?e.jsxs(U,{gap:"200",blockAlign:"center",children:[a?.delivery_time&&e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:s("CountDays",{value:fi(a?.delivery_time||"","")})}),a?.delivery_time&&e.jsx("hr",{className:"h-4 w-px bg-border border-none"}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"subdued",children:[r(a?.amount,!0)," ",s("Shipping").toLowerCase()]})]}):e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:e.jsxs("span",{className:"inline-flex items-center",children:[e.jsx("span",{children:s("CannotBeShippedToThisCountry")}),e.jsx("span",{className:"flex",children:e.jsx(ee,{source:hr,tone:"warning"})})]})})})]})]})}),e.jsx("div",{className:"ml-auto shrink-0",children:e.jsx(ee,{source:mr,tone:"inherit"})})]})}),E=i.useMemo(()=>{const R=ci.length>0&&_.length>0&&x==="";return _.map((P,w)=>e.jsxs(Oe.Fragment,{children:[e.jsxs("div",{className:`country-option-item flex items-center justify-between ${l===P.value?"active":""}`,onClick:()=>{requestAnimationFrame(()=>{c(P.value)})},style:{borderRadius:8},children:[e.jsx(lr,{removeMarginRight:!0,country:P.value,renderCountry:N=>e.jsx("span",{title:N,className:"country-option-item-label msui-text-1-line ml-1",children:N})}),e.jsx("span",{children:e.jsx(f1,{className:"size-4 text-icon-secondary"})})]}),R&&w===ci.length-1?e.jsx($e,{}):null]},"country-option-item-"+w))},[l,c,_]),T=R=>{requestAnimationFrame(()=>{f(R);const P=[];lo.forEach(w=>{const N=R.toUpperCase();(w.label.toUpperCase().startsWith(N)||w.value.startsWith(N))&&P.push(w)}),b(P)})},k=Math.max(v||240,480),O=()=>e.jsxs("div",{className:"relative flex gap-1 py-3",style:{minWidth:k},onClick:R=>R.stopPropagation(),children:[e.jsx(rn,{style:{height:"300px",paddingInline:8},children:e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",style:{width:170},children:[e.jsx("div",{className:"mb-3",children:e.jsx(m,{as:"span",variant:"headingSm",children:s("ShipTo")})}),e.jsx("div",{className:"sticky top-0 z-[9] bg-white pb-3",children:e.jsxs("div",{className:"flex items-center p-1.5 bg-bg-fill-active rounded-lg h-8 gap-1",children:[e.jsx(x1,{size:16,className:"shrink-0 text-text-secondary"}),e.jsx("div",{className:"grow w-max h-full",children:e.jsx("input",{type:"text",placeholder:s("Search"),className:"h-full outline-none border-none w-full",value:x,onChange:R=>T(R.target.value)})})]})}),e.jsxs("div",{className:"ship-to-country-wrapper",children:[ci.length>0&&x===""&&e.jsx("div",{className:"mb-1",children:e.jsx(m,{as:"span",variant:"bodySm",tone
2854:"subdued",children:s("Recommended")})}),E]})]})}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-2 rounded-xl bg-bg-surface-secondary p-3 border border-border overflow-y-auto",style:{height:"300px"},children:n?e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:s("Carrier")}),e.jsx($e,{}),e.jsx(Se,{height:44,width:"100%"}),e.jsx(Se,{height:44,width:"100%"})]}):u.length?e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"semibold",children:s("Carrier")}),e.jsx($e,{}),u.map((R,P)=>{const w=Zo[R.service_name]??R.service_name,N=R.delivery_time?fi(R.delivery_time,""):"",L=[N&&s("CountDays",{value:N}),`${r(R.amount,!0)} ${s("Shipping").toLowerCase()}`].filter(Boolean).join(" | ");return e.jsxs(Oe.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 cursor-pointer",onClick:()=>{requestAnimationFrame(()=>{g(P)})},children:[e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"medium",children:w}),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:L})]}),e.jsx(As,{id:`drawer-shipping-carrier-${P}`,labelHidden:!0,label:null,checked:d===P})]}),P<u.length-1&&e.jsx($e,{})]},`carrier-${R.service_name}-${P}`)})]}):e.jsx("div",{className:"m-auto",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:s("CannotBeShippedToThisCountry")})})})]});return i.useEffect(()=>{b(lo)},[]),i.useEffect(()=>{C.current&&y(C.current.offsetWidth)},[C]),e.jsx("div",{"data-testid":"shipping-info",children:e.jsx(Gs,{zIndexOverride:99999,preferredPosition:"below",active:h,activator:A,autofocusTarget:"first-node",onClose:()=>{requestAnimationFrame(()=>{j()})},preferredAlignment:"center",children:e.jsx("div",{className:"pl-1 pr-3",style:{minWidth:k},children:O()})})})},P5=({productDetail:t,toneWhite:s=!1})=>{const{t:n}=J(),{isMobile:a}=xe(),{shipping_default:r}=t||{},[o,l]=i.useState(!1),[c,u]=i.useState([]),[d,g]=i.useState(""),h=i.useCallback(()=>l(A=>!A),[]),{productDetailShipTo:p,setProductDetailShipTo:x,getSelectedCountryInfo:f}=mn({productDetail:t}),_=i.useMemo(()=>r?.ship_countries||[],[r]),b=A=>Zt[A],v=A=>{A!==p&&(l(!1),x(A))},y=i.useMemo(()=>c.map((A,E)=>{const T=A.toUpperCase(),k=b(T);let O=k.label;return T==="GB"&&(O+=" (GB)"),T==="UK"&&(O+=" (UK)"),k?e.jsxs("div",{className:`country-option-item ${p===A?"active":""}`,onClick:()=>{requestAnimationFrame(()=>v(A))},children:[e.jsx(k.icon,{}),e.jsx("span",{title:O,className:"country-option-item-label msui-ml-2 msui-text-1-line",children:O})]},"country-option-item-"+E):e.jsx(Oe.Fragment,{},"countriesOptions"+E)}),[p,c]),C=A=>{requestAnimationFrame(()=>{g(A);const E=gd(_),T=[];E.forEach(k=>{const O=k.toUpperCase();let P=b(O).label.toUpperCase();O==="GB"&&(P+=" (GB)"),O==="UK"&&(P+=" (UK)");const w=A.toUpperCase();(P.startsWith(w)||k.startsWith(w))&&T.push(k)}),u(T)})};i.useEffect(()=>{u(gd(_))},[]);const S=e.jsx("div",{"data-testid":"shipping-info-selector",children:e.jsxs(U,{blockAlign:"center",gap:"100",children:[e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"medium",tone:s?"text-inverse":"subdued",children:n("ShipTo")}),e.jsx(R5,{className:"grow",onClick:h,children:e.jsx(Q,{children:e.jsx(D,{gap:"100",children:e.jsxs(U,{blockAlign:"center",wrap:!1,gap:"100",children:[e.jsx(m,{as:"span",variant:"bodySm",children:f&&e.jsxs(U,{blockAlign:"center",gap:"100",children:[Oe.createElement(f.icon,{width:16,height:16}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",truncate:!0,tone:s?"text-inverse":"subdued",children:f.label})]})}),e.jsx("div",{className:"ml-auto",style:a?{color:"white"}:{},children:e.jsx(ee,{source:mr,tone:"inherit"})})]})})})})]})}),j=()=>e.jsxs(I5,{isMobile:a,children:[e.jsx("div",{className:"search-country",onClick:A=>A.stopPropagation(),children:e.jsx(gt,{autoComplete:"off",name:"shipToCountry",label:"",labelHidden:!0,placeholder:n("SearchCountry"),value:d,onChange:A=>{requestAnimationFrame(()=>{C(A)})}})}),e.jsx("div",{className:"ship-to-country-wrapper",children:y})]});return a?e.jsxs(e.Fragment,{children:[S,e.jsx(xt,{visible:o,onClose:h,showCloseIcon:!0,title:n("ShipTo"),children:j()})]}):e.jsx("div",{"data-testid":"shipping-to-selector",children:e.jsx(D,{gap:"300",children:e.jsx(Gs,{zIndexOverride:99999,preferredPosition:"below",active:o,activator:S,autofocusTarget:"first-node",onClose:()=>{requestAnimationFrame(()=>{h()})},preferredAlignment:"center",children:e.jsx(rn,{style:{maxHeight:"400px"},children:j()})})})})},I5=se.div` 2855 position: relative; 2856 width: ${({isMobile:t})=>t?"100%":"200px"}; 2857 2858 .search-country { 2859 position: sticky; 2860 top: 0; 2861 background: #fff; 2862 z-index: 9; 2863 padding: 8px; 2864 } 2865`,R5=se.div` 2866 cursor: pointer; 2867 &:hover [data-activator-box] { 2868 background-color: var(--p-color-input-bg-surface-active) !important; 2869 border-color: var(--p-color-input-border-active) !important; 2870 } 2871`,r0=({onClose:t,productDetail:s})=>e.jsx("div",{className:"px-4 pt-2.5 pb-3 bg-black sticky top-0 left-0 z-10",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("button",{className:"text-white size-8 flex items-center justify-center",onClick:t,children:e.jsx(ee,{source:Mn})}),e.jsx(P5,{productDetail:s,toneWhite:!0})]})}),k5=()=>{const{getUserInfo:t,getCurrentPlan:s}=de();t();const n=s();return{pushProductOutOfQuotaTracking:i.useCallback((r,o)=>{Ke.trackingEventUsersAction({event_name:$.PRODUCT_CENTER_OUT_OF_QUOTA_VIEWED,event_data:{position:r,total_product_push:o,limit_quota:n.package?.features?.PRODUCT_LISTING?.limit||0,current_usage:n.package?.features?.PRODUCT_LISTING?.usage||0,plan:n.package?.modules?.[0]?.name||n.package?.name||"",version:1}})},[n])}},w5=ae({key:"sellingPriceState",default:{price_rules:[{from:-1,to:-1,selling_price:{operator:"x",value:2,plus_shipping_cost:!0},compare_at_price:{operator:"x",value:3,plus_shipping_cost:!0}
2871,shipping_cost:{operator:"<",value:10}}],assign:{assign_cents:99,assign_compare_cents:99},taxable:!1}}),N5=ae({key:"pushProductState",default:{is_publish:!0,allow_sell_out_of_stock:!1}}),O5=ae({key:"splitOptionState",default:{threshold:100,split_logic:"split_all_variants",split_handle:"max_variants_per_product",max_variants_per_product:100,max_create_products:100}});function D5(){const[t,s]=be(w5),[n,a]=i.useState(),[r,o]=be(N5),[l,c]=be(O5),[u,d]=i.useState(),[g,h]=i.useState(),p=async()=>{},x=(y,C)=>{s(S=>({...S,[y]:C}))},f=(y,C)=>{o(S=>({...S,[y]:C}))},_=(y,C)=>{c(S=>({...S,[y]:C}))};function b(){n&&s(n),u&&o(u),g&&c(g)}return{isChangeData:i.useMemo(()=>!n||!u||!g?!1:!q.isEqual(t,n)||!q.isEqual(r,u)||!q.isEqual(l,g),[t,n,r,u,l,g]),pushProduct:r,setPushProduct:o,splitOption:l,setSplitOption:c,sellingPrice:t,currentSellingPrice:n,setCurrentSellingPrice:a,currentPushProduct:u,setCurrentPushProduct:d,currentSplitOption:g,setCurrentSplitOption:h,discardChanges:b,fetchProductSellingPrice:p,handleUpdatePricingValue:x,handleUpdatePushProductValue:f,handleUpdateSplitOptionValue:_}}const i0=()=>{J(),bt();const t=pt(),{token:s}=vs(),{currencyFindProductConfig:n}=Vn(),a=n(),r=dt(),o=de(),l=r.getListChannels(),c=r.getShopListAtWorkplace(),u=he(In),{setDataPushProcess:d,setDataImportProcess:g}=wi(),{getActionPermissionState:h}=gs(),{pushProductOutOfQuotaTracking:p}=k5(),x=i.useMemo(()=>c.map(Z=>({label:Z.platform_domain,value:Z.id+""})),[c]),f=ke(f5),[_,b]=i.useState({}),v=ke(Il),{pushProduct:y}=D5(),{productListing:C}=jr(),S=C.auto_split_variant_options,j=(Z,te)=>{const ne=Object.entries(Z);return ne.length?ne.filter(([le,B])=>B.checked).reduce((le,[B,ie])=>({...le,[B]:{is_publish:te??y.is_publish,allow_sell_out_of_stock:y.allow_sell_out_of_stock}}),{}):{}},A=i.useCallback(()=>{l&&b(Object.keys(Za).reduce((Z,te)=>(l?.[te]?.[0]&&(Z[te]={channel:te,image:Za[te].image,label:Za[te].label,settings:{allow_sell_out_of_stock:y.allow_sell_out_of_stock,is_publish:y.is_publish},checked:!0}),Z),{}))},[l]);function E({totalVariant:Z,splitLogic:te,splitHandle:ne,splitThreshold:le,maxVariant:B,maxProduct:ie,isEnable:V}){if(Z<le||!V)return 1;if(te==="all")return ne==="max_variant"?Math.ceil(Z/B):Math.min(Z,ie);const M=Z-le;return M>0?(ne==="max_variant"?Math.ceil(M/B):Math.min(M,ie))+1:1}const T=Z=>Z?.length?Z.reduce((te,ne)=>te+E({totalVariant:ne.total_variants||0,splitLogic:S.split_logic==="split_all_variants"?"all":"excess",splitHandle:S.split_handle==="max_create_products"?"max_product":"max_variant",splitThreshold:Number(S.threshold)||100,maxVariant:Number(S.max_variants_per_product)||100,maxProduct:1,isEnable:S.is_enable}),0):0,k=Z=>Z?.length?Z.reduce((te,ne)=>te+E({totalVariant:ne.variant_count||0,splitLogic:S.split_logic==="split_all_variants"?"all":"excess",splitHandle:S.split_handle==="max_create_products"?"max_product":"max_variant",splitThreshold:Number(S.threshold)||100,maxVariant:Number(S.max_variants_per_product)||100,maxProduct:1,isEnable:S.is_enable}),0):0,O=(Z,te)=>te?.length?te.filter(le=>q.includes(Z,le.center_product_package_id+"")).reduce((le,B)=>le+E({totalVariant:B.total_variant||0,splitLogic:S.split_logic==="split_all_variants"?"all":"excess",splitHandle:S.split_handle==="max_create_products"?"max_product":"max_variant",splitThreshold:Number(S.threshold)||100,maxVariant:Number(S.max_variants_per_product)||100,maxProduct:1,isEnable:S.is_enable}),0):0,R=i.useCallback(Z=>Object.keys(Z),[]),P=Z=>{const te=[];let ne=0;for(const le of Z){const B=E({totalVariant:le.total_variants||0,splitLogic:S.split_logic==="split_all_variants"?"all":"excess",splitHandle:S.split_handle==="max_create_products"?"max_product":"max_variant",splitThreshold:Number(S.threshold)||100,maxVariant:Number(S.max_variants_per_product)||100,maxProduct:1,isEnable:S.is_enable});if(!Ya(B,"PRODUCT_LISTING",o.getCurrentPlan()))if(!Ya(ne+B,"PRODUCT_LISTING",o.getCurrentPlan()))te.push(le),ne+=B;else break}return te},w=async({position:Z,products:te,libraryEvent:ne,push_from:le,isUseProductShipTo:B=!1,isPublish:ie,pushAiEnhance:V,customSellingPrice:M})=>{if(!h([Te.VIEW_ACTION_PC_LISTING]))return;const F={position:Z,type:"card",libraryEvent:ne??{}},G=T(te),z=P(te);if(!z.length){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:G,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p(Z,G);return}const me=z.map(pe=>{const ze={product_id:pe.source_product_id||pe.id,id:pe.source_product_id||pe.id,source:pe?.source,ship_to:B&&pe.ship_to?pe.ship_to:v,image:pe?.images[0],cost_from:a.convertCurrencyFindProduct(pe?.price_range?.[0]||pe?.price||0)+"",cost_to:a.convertCurrencyFindProduct(pe?.price_range?.[1]||pe?.price||0)+"",price_from:a.convertCurrencyFindProduct(pe?.price_range?.[0]||pe?.price||0)+"",price_to:a.convertCurrencyFindProduct(pe?.price_range?.[1]||pe?.price||0)+"",productName:pe?.name||pe?.title,title:pe?.name||pe?.title||"",total_variant:pe.total_variants||pe?.total_variant||0,shipping_cost:pe.shipping_cost||null};return ze.total_variant===0&&(ze.total_variant=pe.variants?.length??0),ze}),Re=j(_),Be={exclude_unavailable:Z==="product_detail"?f:!1,store_id:+x?.[0]?.value,type:"dropship",products:me?.map(pe=>({supplier_product_id:pe.id+"",source:pe.source,ship_to:B&&pe.ship_to?pe.ship_to:v,total_variants:pe.total_variant||0,shipping_cost:pe.shipping_cost||null})),push_from:le||void 0,...ie!==void 0&&{is_publish:ie},...V?{push_ai_enhance:V}:{},...M?{selling_price:M}:{}},{status:De,data:ot}=await Xs.postPushSourceProductV2(Be,s);N({total:Be.products.length,channels:"shopify",source:q.join(q.uniq(me.map(pe=>
2871pe.source).filter(Boolean)),","),eventClick:F});const ve=me?.filter(pe=>!!pe.total_variant);if(De===fe.QUOTA_EXPIRED){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:G,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p(Z,G);return}if(De===Xt.OK){const pe=ve.filter(lt=>!ot?.failed?.[lt.id||""]).map(lt=>({id:lt.id+"",product_package_id:null,error:"",image:lt.image,title:lt.title,status:"processing",source:lt.source}));g(pe,"update",Re);const Ge=R(Re).flatMap(lt=>[...ve.map(ce=>({id:ce.id,image:ce.image,title:ce.title,status:"processing",channel:lt,error:""}))]);d(Ge),r.fetchSyncShopifyStore()}},N=i.useCallback(({channels:Z,total:te,source:ne,eventClick:le,...B})=>{le?.position&&te&&Ke.trackingEventUsersAction({event_name:$.PRODUCT_CENTER_PUSH_TO_STORE_COMPLETED,event_data:{product_center_push_to_store_position:le.position,channel_list:Z,value:te,source:ne,...le?.libraryEvent?le.libraryEvent:{},...B}})},[]),K=async(Z,te,ne)=>{if(!h([Te.VIEW_ACTION_PC_LISTING]))return;const B="product_detail_variant",ie=1,V={position:B,type:"card",libraryEvent:{}};if(Ya(1,"PRODUCT_LISTING",o.getCurrentPlan())){ne?.(),u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:ie,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p(B,ie);return}const I=j(_),F={store_id:+x?.[0]?.value,detect_id:te.aliexpress_options||te.sku_id||"",ship_to:Z.ship_to||"US",properties:te.sku_property.map(z=>({property_name:z.sku_property_name,property_value:z.property_value_definition_name||z.sku_property_value})),shipping_cost:Z.shipping_cost||null},{status:G}=await Xs.postPushProductVariant({product_id:Z.source_product_id,source:Z.source,data:F},s);if(N({total:1,channels:"shopify",source:Z.source,eventClick:V}),G===fe.QUOTA_EXPIRED){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:ie,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p(B,ie);return}if(G===Xt.OK){const z=[{id:`${Z.source_product_id}_${F.detect_id}`,product_package_id:null,error:"",image:Z.images?.[0]||"",title:Z.name,status:"processing",source:Z.source}];g(z,"update",I);const Re=R(I).flatMap(Be=>[{id:`${Z.source_product_id}_${F.detect_id}`,image:Z.images[0]||"",title:Z.name,status:"processing",channel:Be,error:""}]);d(Re)}},L=async(Z,te,ne)=>{if(!h([Te.VIEW_ACTION_PUSH_PRODUCT]))return;const B={position:ne||"favorite",type:"list"},ie=j(_,te),V=Z.map(G=>({id:G.center_product_package_id,image:G.image,price_from:G.price_from,cost_from:G.cost_from,cost_to:G.cost_to,price_to:G.price_to,title:G.title,total_variant:G.variant_count,center_product_package_id:+(G.center_product_package_id||0)})),M={store_id:+x?.[0]?.value,product_package_ids:Z.map(G=>G.center_product_package_id+"")},I=k(Z),{status:F}=await Xs.postPushFavoriteProducts(M,s);if(F===fe.QUOTA_EXPIRED){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:I,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p("push_favorite",I);return}if(N({total:M.product_package_ids.length,channels:"shopify",source:q.join(q.uniq(Z.map(G=>G.source).filter(Boolean)),","),eventClick:B}),F===Xt.OK){const z=R(ie).flatMap(me=>[...V?.map(Be=>({id:Be.center_product_package_id+"",image:Be.image,title:Be.title,status:"processing",channel:me,error:"",pushScope:"pushed"}))]);d(z)}},W=async(Z,te,ne)=>{if(!h([Te.VIEW_ACTION_PUSH_PRODUCT]))return;if(Object.keys(l).every(z=>!l[z].length)){t(Y.GENERAL_SETTING.SUBROUTES.SETTING_ACCOUNT.PATH);return}const B={position:"favorite",type:"list"},ie=j(_,ne?.publish),V=te.filter(z=>q.includes(Z,z.center_product_package_id+"")).map(z=>({id:z.center_product_package_id,source_products:z.source_products,image:z.image,price_from:z.price_from,cost_from:z.cost_from,cost_to:z.cost_to,price_to:z.price_to,title:z.title,total_variant:z.total_variant,center_product_package_id:+(z.center_product_package_id||0)})),M={store_id:+x?.[0]?.value,product_package_ids:Z},I=O(Z,te);if(Ya(I,"PRODUCT_LISTING",o.getCurrentPlan())&&!ne?.skipQuotaCheck){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:I,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p("push_favorite",I);return}const{status:G}=await Xs.postPushFavoriteProducts(M,s);if(G===fe.QUOTA_EXPIRED){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:I,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p("push_favorite",I);return}if(N({total:M.product_package_ids.length,channels:"shopify",source:q.join(q.uniq(V.flatMap(z=>(z.source_products||[]).map(me=>
2871me.source)).filter(Boolean)),","),eventClick:B}),G===Xt.OK){const me=R(ie).flatMap(Re=>[...V?.map(De=>({id:De.center_product_package_id+"",image:De.image,source_products:De?.source_products||[],title:De.title,status:"processing",channel:Re,error:""}))]);d(me),r.fetchSyncShopifyStore()}},H=async(Z,te="US")=>{if(!h([Te.VIEW_ACTION_PUSH_PRODUCT]))return;const le={position:"product_detail",type:"card"},B=Z.product_package_id,ie=j(_),V={store_id:+x?.[0]?.value,product_package_ids:[B],ship_to:te},M=T([Z]);if(Ya(M,"PRODUCT_LISTING",o.getCurrentPlan())){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:M,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p("push_favorite",M);return}const{status:F}=await Xs.postPushFavoriteProducts(V,s);if(F===fe.QUOTA_EXPIRED){u({keyFeature:"PRODUCT_LISTING",isFullPlan:!1,total_used:M,feature_used:"PRODUCT_LISTING",locationShowUpgrade:hs.catelog_push_product}),p("push_favorite",M);return}if(N({total:V.product_package_ids.length,channels:"shopify",source:Z.source,eventClick:le}),F===Xt.OK){const z=R(ie).flatMap(me=>[{id:B+"",image:Z.images[0]||"",title:Z.name,status:"processing",channel:me,error:""}]);d(z)}};return i.useEffect(()=>{A()},[]),{pushProduct:w,pushProductVariant:K,productPushFavorite:H,pushProductFavorite:L,pushCenterFavoriteProducts:W}},L5={DELETE_FAVOURITE:"/center/products/source/favourite"},M5=async t=>X(L5.DELETE_FAVOURITE,t,{method:"DELETE"}),U5={deleteFavourite:M5},o0=()=>{const[t,s]=be(Yh),n=bt(),{t:a}=J(),r=gn(),{token:o}=vs(),l=he(La),c=i.useMemo(()=>{const y={};return t.forEach(C=>{y[String(C.id)]=C}),y},[t]),u=(y,C)=>{const S=y?.source_product_id||C,j=String(y?.product_id||"")||"";return r?.has(String(S),"processing")||r?.has(String(j),"processing")||r?.has(String(y?.product_package_id),"processing")},d=(y,C)=>{const S=String(y?.source_product_id||C||""),j=String(y?.product_id||"");return["processing","success"].some(E=>r?.has(S,E)||r?.has(j,E))},g=y=>r.getAllPush().find(C=>String(C.source_product_id)===String(y?.source_product_id)||String(C.id)===String(y?.product_package_id))?.status==="success",h=(y,C)=>y?c[String(y)]?.status===C:!1,p=y=>y?c[String(y)]?.status==="success":!1,x=y=>{s(C=>{const S=C.findIndex(j=>String(j.id)===String(y));if(S!==-1){const j=[...C];return j[S]={...j[S],status:"proccessing"},j}else return[...C,{id:y,status:"proccessing"}]})},f=async()=>{try{const{status:y,data:C}=await Xs.getProductPushUnpushCount(o);y===Xt.OK&&l(S=>({...S,pushed:C?.total_pushed||0,unpushed:C?.total_unpushed||0,totalPushedActive:C?.total_pushed_active||0,totalPushedDraft:C?.total_pushed_draft||0}))}catch(y){console.log(y)}};return{isProductPushing:u,isProductPushed:g,isProductInPushing:d,isProductImportStatus:h,isProductImportedWithSuccess:p,onSetProductImporting:x,onDeleteProductImporting:async(y,C)=>{const S=c[String(y)];if(!(!S||S.status!=="success"))try{s(A=>{const E=A.findIndex(T=>String(T.id)===String(y));if(E!==-1){const T=[...A];return T[E]={...T[E],status:"proccessing"},T}return A});const{status:j}=await U5.deleteFavourite({supplier_product_id:y,source:C});j===fe.OK?setTimeout(()=>{f(),n.success(a("DeletedFavorite")),s(A=>A.filter(E=>String(E.id)!==String(y)))},1e3):s(A=>{const E=A.findIndex(T=>String(T.id)===String(y));if(E!==-1){const T=[...A];return T[E]={...T[E],status:"error"},T}return A})}catch{s(A=>{const E=A.findIndex(T=>String(T.id)===String(y));if(E!==-1){const T=[...A];return T[E]={...T[E],status:"error"},T}return A})}},onRomveProductImporting:y=>{!y||y.length===0||s(C=>C.filter(S=>!y.some(j=>String(S.id)===String(j))))},getPackageIdByProductId:y=>{const C=c[String(y)];return C?.product_package_id?String(C.product_package_id):void 0}}};var ql=(t=>(t.LISTED="listed",t.CASHBACK="cashback",t.STORE_SIMILAR="store_similar",t.SALE="sale",t))(ql||{});const F5=t=>{const{feature:s="PRODUCT_LISTING",onCallbackConnectStore:n,position:a}=t,{t:r}=J(),o=de().onOpenDrawerConnectStore,l=()=>{requestAnimationFrame(()=>{n&&n(),Ke.trackingEventUsersAction({event_name:$.STORE_CONNECTION_CLICKED,event_data:{position:a,type:"banner"}}),o()})}
2871,c={PRODUCT_LISTING:"NoStoreConnectedToPushTheProduct"};return e.jsx("div",{className:"remove-box-shadow-card [&_.Polaris-Box]:rounded-[8px]",children:e.jsx(nt,{padding:"0",children:e.jsxs(kt,{tone:"warning",children:[r(c[s])," ",e.jsx("span",{onClick:l,className:"cursor-pointer underline",children:r("ConnectStore")})]})})})},B5="/assets/connected-store-CuNxRPey.png",H5=()=>{const{t}=J(),{openChat:s}=Pt(),n=de().onOpenDrawerConnectStore,a=()=>{requestAnimationFrame(()=>{s()})},r=()=>{requestAnimationFrame(()=>{Ke.trackingEventUsersAction({event_name:$.STORE_CONNECTION_CLICKED,event_data:{position:"setting",type:"banner"}}),n()})};return e.jsx(nt,{roundedAbove:"xs",children:e.jsx("div",{className:"flex justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"mb-3 flex justify-center",children:e.jsx("img",{src:B5,alt:"connected store"})}),e.jsx("div",{className:"mb-0.5",children:e.jsx(m,{as:"h3",variant:"headingMd",children:t("NoStoresFound")})}),e.jsx("div",{children:e.jsx(m,{as:"span",variant:"bodySm",children:t("PleaseAddAStoreToPushProductsOrPlaceOrders")})}),e.jsxs("div",{className:"mt-3 flex justify-center gap-3",children:[e.jsx(re,{onClick:a,children:t("ContactSupport")}),e.jsx(re,{onClick:r,variant:"primary",children:t("AddStore")})]})]})})})},G5={EmptyConnectedStore:H5,BannerConnectStore:F5},W5=t=>{const{products:s,disableButtons:n,buttonVariant:a,isAddAll:r=!1,isViewProductCard:o=!1,onAddedSuccess:l,onAddedSuccessFromPusher:c,buttonSize:u="large",content:d,type:g,isNotSaveAddedState:h=!1,position:p,buttonProps:x}=t,{isMobile:f}=xe(),{t:_}=J(),[b,v]=i.useState(!1),y=bt(),{addToProductCenter:C}=Zh(),S=ke(go),j=he(go),A=S[s[0]?.supplier_product_id||""]?.status,E=s.every(P=>["added","error"].includes(S[P.supplier_product_id]?.status)),T=s.some(P=>S[P.supplier_product_id]?.status==="pending"),k=A==="added",O=b||T;i.useEffect(()=>{s.length>0&&E&&(c?.(),h&&(y.success("Added to Product Center successfully!"),j(P=>{const w={...P};return delete w[s[0]?.supplier_product_id||""],w})))},[s.length,E,h]);const R=i.useMemo(()=>f?d?E?_("AddedToProductCenter"):d:_(r?E?"AddedAllProducts":"AddAllProducts":k?"AddedProduct":"AddProduct"):d?E?_("AddedToProductCenter"):d:_(r?E?"AddedAllToProductCenter":"AddAllToProductCenter":k?"AddedToProductCenter":"AddToProductCenter"),[f,d,E,r,k,_]);return e.jsx("div",{className:oe(o&&"[&_.Polaris-Button--disabled]:bg-bg-surface-secondary"),children:g==="icon"?e.jsx(Et,{content:_(k?"AddedToProductCenter":"AddToProductCenter"),children:e.jsx(re,{icon:(r?E:k)?Je:yl,disabled:s.length===0||n||(r?E:k),loading:O,size:u,variant:a,fullWidth:!0,onClick:async()=>{v(!0),await C({products:s,onAddedSuccess:()=>{r&&!h&&y.success("Added to Product Center successfully!"),l?.()},position:p}),v(!1)},...x},"add-to-product-center")}):e.jsx(re,{icon:(r?E:k)?Je:void 0,disabled:s.length===0||n||(r?E:k),loading:O,size:u,variant:a,fullWidth:!0,onClick:async()=>{v(!0),await C({products:s,onAddedSuccess:()=>{r&&!h&&y.success("Added to Product Center successfully!"),l?.()},position:p}),v(!1)},...x,children:R},"add-to-product-center")})},Ku=({productDetail:t,hiddenPushButton:s,disableButtons:n=!1,loadingVariant:a=!1,shipTo:r,onOutQuota:o,isMobile:l=!1,onCallbackConnectStore:c,selectedVariants:u})=>{const{t:d}=J(),g=pt(),{pushProduct:h,pushProductVariant:p}=i0(),{getMatchingVariant:x}=Tr({productDetail:t,selectedVariants:u,shipToCountry:r}),{carriers:f,effectiveCarrierIndex:_}=mn({productDetail:t}),b=x(),{isProductPushed:v,isProductPushing:y}=o0(),C=dt(),S=he(Ql),j=i.useRef(0),A=i.useRef(!1),E=y(t||{},j.current)||y({source_product_id:t?.source_product_id_us}),T=y({source_product_id:`${t?.source_product_id}_${b?.aliexpress_options||b?.sku_id}`}),k=v({source_product_id:t?.source_product_id_us}),O=q.includes(t?.tags||[],ql.LISTED),R=v(t)||k||O,P=C.isStoreZopi(),w=_>=0&&f[_]?f[_]:null,N=()=>{requestAnimationFrame(()=>{const W={name:t?.name||"",source:t?.source||"aliexpress",source_product_id:t?.source_product_id||"",images:t?.images||[],ship_to:r,price_range:t?.price_range||[],total_variants:t?.variants.length||0,price:t?.price_range?.[0]||0,shipping_cost:w?.amount||null};h({position:"product_detail",products:W?[W]:[],isUseProductShipTo:!0,callback:H=>{try{if(H.status===fe.QUOTA_EXPIRED){o?.();return}}catch(Z){console.error("Error in push callback:",Z)}}})})},K=()=>{b&&requestAnimationFrame(()=>{p({name:t?.name||"",source:t?.source||"aliexpress",source_product_id:t?.source_product_id||"",images:t?.images||[],ship_to:r},b)})};i.useEffect(()=>{A.current=!1},[t?.source_product_id]);let L=[P?null:e.jsx(re,{disabled:!q.size(t)||n||!b||E,onClick:K,loading:T||a,size:"large",children:d("PushSelectedVariant")},"push-select-variant"),s?null:P?e.jsx(W5,{products:[{supplier_product_id:t?.source_product_id||"",productName:t?.name,image:t?.images[0]||"",ship_to:r,source:t?.source||"aliexpress"}],disableButtons:!q.size(t)||a,buttonVariant:"primary",position:"product_detail_top"}):e.jsx(re,{icon:v(t)?Je:void 0,disabled:!q.size(t)||a||n||v(t)||T,loading:E,size:"large",variant:"primary",fullWidth:!0,onClick:N,children:v(t)?d("PushedToStore"):d("PushToStore")},"push-to-store")];return R&&(L=[l?null:e.jsx(kt,{children:e.jsxs(m,{as:"p",variant:"bodyMd",breakWord:!1,children:[d("AlreadylistedRepush")," ",e.jsx(aa,{onClick:()=>{g(Y.HOME_PAGE.PATH+"?view=manage-product"),S(!1)},children:d("ManageInProductCenter")})]})},"banner-imported"),P?null:e.jsx(re,{disabled:!q.size(t)||n||!b||E,onClick:K,loading:T||a,size:"large",children:d("PushSelectedVariant")},"push-select-variant"),e.jsx(re,{disabled:!q.size(t)||a||n||T,loading:E,icon:yl,size:"large",fullWidth:!0,variant:"primary",onClick:()=>N(),children:d("Repush")},"re-push-to-store")]),e.jsx(e.Fragment,{children:e.jsxs("div",{"data-testid":"product-actions",children:[e.jsx(ft,{columns:l?"1fr 1fr":"1fr",gap:"300",children:L.map((W,H)=>e.jsx(Oe.Fragment,{children:W},H))}),P&&e.jsx("div",{className:"mt-3",children:e.jsx(G5.BannerConnectStore,{onCallbackConnectStore:()=>{c&&c()},position:"product_catalog_detail"})})]})})},V5=t=>{const s=ws(),[n,a]=i.useState(!1),[r,o]=i.useState({}
2871),l=he(Wl),c=he(Mh),u=i.useRef(null),d=async _=>{const b=await qa.getCheckHasReport({source_product_id:_});return b.status===fe.OK&&b.data?{id:b.data.id,status:b.data.status}:null},g=async({price:_,source:b,productId:v})=>{const{data:y,status:C}=await os.getProductLogistics({params:{country_code:"US",ship_from:"CN",cost_price:_,product_id:v,source:b},token:void 0});return C===fe.OK&&y?.logistics?y.logistics.reduce((j,A)=>j.amount<A.amount?j:A):null},h=async(_,b)=>{try{a(!0),Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_INSIGHTS_CLICKED,event_data:{product_id:_.id,position:b?"product_detail":"product_listings",source:_.source}});const v=await d(_.id);if(v?.id){c({visible:!0,productId:v.id.toString()}),l(S=>{const j=new Map(S.map(E=>[E.id,E])),A=j.get(v.id.toString());return j.set(v.id.toString(),{id:v.id.toString(),title:_.title,image:_.image,status:A?.status||"success",trendReady:["completed","failed"].includes(v.status)?!0:A?.trendReady||!1}),Array.from(j.values())}),t?.onSuccess?.();return}let y=_.profit;if(y===void 0||y<0){const S=await g({price:_.price,source:_.source,productId:_.id});S?.profit&&(y=S.profit)}const C=await qa.createReportProductInsight({source_product_id:_.id,source:_.source,product_name:_.title,product_image:_.image,product_cost:_.price,profit:y,profit_fallback:!_.profit||_.profit<0});if(C.status===fe.OK&&C.data&&C.data.id){const S={id:C.data.id.toString(),title:_.title,image:_.image,status:"processing"};l(j=>{const A=new Map(j.map(E=>[E.id,E]));return A.set(S.id,S),Array.from(A.values())}),c({visible:!0,productId:S.id}),t?.onSuccess?.()}}catch(v){console.error("Error adding products:",v)}finally{a(!1)}},p=({reportId:_,title:b,image:v})=>{c({visible:!0,productId:_}),l(y=>{const C=new Map(y.map(j=>[j.id,j])),S=C.get(_);return C.set(_,{id:_,title:b,image:v,status:S?.status||"success",trendReady:!0}),Array.from(C.values())})},x=async(_,b)=>{u.current=setInterval(async()=>{await qa.getProductInsightReportDetail(_).then(v=>{v.status===200&&v.data?.status==="completed"&&(clearInterval(u.current),o(y=>({...y,[b.id]:!1})),s.invalidateQueries({queryKey:vt.productInsights.detail(_)}),c({visible:!0,productId:_.toString()}),l(y=>{const C=new Map(y.map(S=>[S.id,S]));return C.set(_.toString(),{id:_.toString(),title:b.title,image:b.image,status:"success",trendReady:!0}),Array.from(C.values())}))}).then(()=>{o(v=>({...v,[b.id.toString()]:!1}))})},5e3)},f=async _=>{o(y=>({...y,[_.id]:!0}));let b=_.profit;if(b===void 0||b<0){const y=await g({price:_.price,source:_.source,productId:_.id});y?.profit&&(b=y.profit)}const v=await qa.createReportProductInsight({source_product_id:_.id,source:_.source,product_name:_.title,product_image:_.image,product_cost:_.price,profit:b,profit_fallback:!_.profit||_.profit<0});v.status===fe.OK&&v.data&&v.data.id&&x(v.data.id,{id:_.id,title:_.title,image:_.image}),v.status!==fe.OK&&o(y=>({...y,[_.id]:!1}))};return i.useEffect(()=>()=>{u.current&&clearInterval(u.current)},[]),{productInsightAdding:n,createReportAndShowDetail:h,showDetailProductInsight:p,refetchReport:f,isLoadingRefetch:r}},Y5=":productId",z5=":source",Zl={RELATED_PRODUCTS:"/center/products/source/:source/get-more-products/:productId",GET_PRODUCT_DETAIL_INSIGHT:"/center/products/get-product-insight",GET_PRODUCT_PRICE_HISTORY:"/center/products/price-history/:product_id"},K5=async(t,s)=>{const n=q.replace(Zl.RELATED_PRODUCTS,Y5,String(t.productId)),a=q.replace(n,z5,String(t.source));return X(a,{ship_to:t.shipTo},{method:"GET"},{cancelToken:s})},Q5=async t=>X(Zl.GET_PRODUCT_DETAIL_INSIGHT,t,{method:"POST"}),q5=async t=>{const{product_id:s}=t,n=Zl.GET_PRODUCT_PRICE_HISTORY.replace(":product_id",s);return X(n,{day:"180"},{method:"GET"})},Xl={getRelatedProducts:K5,getProductDetailInsight:Q5,getProductPriceHistory:q5};function Jl({name:t,item_specifics:s,enabled:n=!1}){return ks({queryKey:vt.simpleMode.productDetailInsight(t,s),queryFn:async()=>{const a=await Xl.getProductDetailInsight({name:t,item_specifics:s});return a.status===fe.OK&&a.data?a.data:null},enabled:n})}const Z5=({name:t,loadingDetail:s,productDetail:n})=>{const{t:a}=J(),r=n?.item_specifics,o=n?.price_range?.[0]||0,{data:l,isPending:c}
2871=Jl({name:t,item_specifics:r,enabled:!!t&&!s}),{shippingInfo:u}=mn({productDetail:n}),{createReportAndShowDetail:d,productInsightAdding:g}=V5(),h=async()=>{!n||g||requestAnimationFrame(async()=>{await d({id:n?.source_product_id,title:n?.name||"",image:n?.images?.[0]||"",source:n?.source||"aliexpress",price:+o,profit:+(u?.profit||0)},!0)})};return c?e.jsx(Q,{padding:"400",background:"bg-surface",borderRadius:"300",children:e.jsxs(D,{gap:"400",children:[e.jsx(m,{as:"p",variant:"headingSm",children:a("CompetitiveLevel")}),e.jsx($e,{}),e.jsxs(U,{gap:"300",align:"space-between",children:[e.jsx(Se,{height:20,width:100}),e.jsx(Se,{height:20,width:100}),e.jsx(Se,{height:20,width:100})]})]})}):e.jsx(Q,{padding:"400",background:"bg-surface",borderRadius:"300",children:e.jsxs(D,{gap:"400",children:[e.jsxs(U,{gap:"300",align:"space-between",blockAlign:"center",children:[e.jsx(m,{as:"p",variant:"headingSm",children:a("CompetitiveLevel")}),e.jsxs(U,{gap:"100",children:[e.jsxs(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:[l?.competition_level?`${Z0(l.competition_level)}`:"n/a"," "]}),e.jsx("button",{className:"cursor-pointer",onClick:h,disabled:g||!n,children:g?e.jsx(nn,{size:"small"}):e.jsx(ee,{source:ra,tone:"emphasis"})})]})]}),e.jsx($e,{}),e.jsxs(U,{gap:"300",align:"space-between",blockAlign:"center",children:[e.jsxs(U,{gap:"100",children:[e.jsx("span",{children:e.jsx(ee,{source:lm})}),e.jsxs(m,{as:"p",variant:"bodySm",children:[a("Margin"),": ",l?.margin_level?`${l.margin_level}%`:"n/a"]})]}),e.jsxs(U,{gap:"100",children:[e.jsx("span",{children:e.jsx(ee,{source:cm})}),e.jsxs(m,{as:"p",variant:"bodySm",children:[a("AdSpend"),": ",l?.avg_ad_spend?`${l.avg_ad_spend}`:"n/a"]})]}),e.jsxs(U,{gap:"100",children:[e.jsx("span",{children:e.jsx(ee,{source:dm})}),e.jsxs(m,{as:"p",variant:"bodySm",children:["CPA: ",l?.cpa_range?`${l.cpa_range.map(p=>`$${p}`).join("-")}`:"n/a"]})]})]})]})})},X5=({productDetail:t,selectedVariants:s,onVariantChange:n,onOptionImageClick:a})=>{const{productDetailShipTo:r}=mn({productDetail:t}),{selectedVariants:o,handleVariantChange:l,getOptionQuantityMap:c}=Tr({productDetail:t,selectedVariants:s,onVariantChange:n,shipToCountry:r}),u=i.useMemo(()=>c(),[c]),d=i.useMemo(()=>t?.options?[...t.options].sort((h,p)=>h.values?.[0]?.image&&!p.values?.[0]?.image?-1:!h.values?.[0]?.image&&p.values?.[0]?.image?1:0):[],[t?.options]),g=(h,p,x)=>{l(h,p,x)};return e.jsx("div",{"data-testid":"product-variant-selector",children:e.jsx(D,{gap:"500",children:d.map(h=>e.jsxs(D,{gap:"150",children:[e.jsxs(m,{as:"span",variant:"bodySm",tone:"subdued",children:[h.name,": ",e.jsx("strong",{children:o[h.name]})]}),e.jsx(J5,{optionValues:h.values,selectedVariants:o,handleVariantChange:g,optionName:h.name,optionQuantities:u[h.name]??{},totalOption:d.length,onOptionImageClick:a})]},h.id))})})},J5=({optionValues:t,selectedVariants:s,handleVariantChange:n,optionName:a,optionQuantities:r,totalOption:o,onOptionImageClick:l})=>{const[c,u]=i.useState(!1),[d,g]=i.useState(!1),[h,p]=i.useState(null),x=i.useRef(null);return i.useLayoutEffect(()=>{const f=x.current;if(!f)return;const _=f.firstElementChild;if(!_)return;const b=_.offsetHeight;p(b),g(f.scrollHeight>b+4)},[t]),e.jsxs("div",{className:"flex relative",children:[e.jsx("div",{ref:x,className:"flex gap-2 flex-wrap overflow-hidden",style:!c&&h?{maxHeight:h}:void 0,children:t.map(f=>{const _=r[f.value],b=Object.keys(s).some(y=>y!==a),v=o>1?b&&_===0:_===0;return f.image?e.jsx($5,{label:f.value,image:f.image,selected:s[a]===f.value,onClick:()=>{n(a,f.value,f.image),l?.(f.image)},isOutOfStock:v},f.id):e.jsx(eR,{label:f.value,selected:s[a]===f.value,onClick:()=>n(a,f.value,f.image),isOutOfStock:v},f.id)})}),d&&!c&&e.jsx("button",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-[45px] flex justify-end items-center h-8 cursor-pointer",style:{background:"linear-gradient(270deg, #FFFFFF 42.32%, rgba(255, 255, 255, 0) 100%)"},onClick:()=>u(f=>!f),children:e.jsx("span",{children:e.jsx(ee,{source:Rs})})})]})},$5=({label:t,image:s,selected:n,onClick:a,isOutOfStock:r})=>e.jsx(Et,{content:t,children:e.jsx("button",{className:oe("border cursor-pointer rounded-lg overflow-hidden size-8",n?"border-input-border-active":"border-border",r&&"opacity-40 "),onClick:a,children:e.jsx(pn,{source:s,alt:"option image",isSize:!1,isBoxShadow:!1})})}),eR=({label:t,selected:s,onClick:n,isOutOfStock:a})=>e.jsx("button",{className:oe("px-2 py-1 border cursor-pointer rounded-lg",s?"border-input-border-active":"border-border",a&&"opacity-40 line-through"),onClick:n,children:e.jsx("div",{children:e.jsx(m,{truncate:!0,as:"span",variant:"bodySm",fontWeight:"medium",tone:s?void 0:"subdued",children:t})})}),l0=({productDetail:t,variantSelected:s})=>{const{formatConvertedAmount:n}=Vn(),{name:a="",price_range:r=[],source:o="",product_link:l="",store_info:c}=t||{},u=q.includes(o,"zopi");let d=r;s&&s.price_usd&&(d=[+s.price_usd]),d.length>1&&d[0]===d[1]&&(d=[d[0]]);const g=d.length>0?q.join(q.compact(d.map(f=>n(+f)))," - "):"0",h=d.length>0?q.join(q.compact(d.map(f=>+f))," - "):"0";return{name:a,source:o,price:h,product_link:l,store_info:c,isZopi:u,formattedPrice:g,handleViewSource:()=>{J0(l),ss("product_detail_eye_icon_click",{})},handleStoreClick:()=>{c?.store_id&&o&&X0(o,{id:c?.store_id,store_name:c?.store_name||""})}}},tR=({productDetail:t,variantSelected:s,selectedVariants:n})=>{const{name:a,store_info:r,handleStoreClick:o}=l0({productDetail:t,variantSelected:s}),{productDetailShipTo:l}=mn({productDetail:t}),{getCurrentPrice:c}=Tr({productDetail:t,selectedVariants:n,shipToCountry:l});return e.jsxs(D,{gap:"300",children:[r?.store_name&&e.jsx("div",{onClick:o,className:"cursor-pointer decoration-text-emphasis mb-1",children:e.jsx("div",{className:"text-text-emphasis",children:e.jsx(m,{as:"span",variant:"bodySm",children:r?.store_name||""})})}),e.jsxs(U,{align:"space-between",blockAlign:"center",gap:"300",wrap:!1,children:[e.jsx("a",{href:t?.product_link,target:"_blank",className:"min-w-0 cursor-pointer hover:underline",rel:"noreferrer",children:e.jsx(m,{variant:"bodySm",as:"span",tone:"subdued",truncate:!0,children:a})}),e.jsx(U,{blockAlign:"center",gap:"200",wrap:!1,children:!!Number(t?.evaluation_count)&&e.jsxs(U,{blockAlign:"center",gap:"100",wrap:!1,children:[e.jsx("span",{className:"text-bg-fill-warning",children:e.jsx(yo,{className:"w-3.5 h-3.5",fill:"currentColor"})}),e.jsx(m,{as:"span",variant:"bodyXs",fontWeight:"semibold",children:t?.avg_evaluation_rating||0}),e.jsxs(m,{as:"span",variant:"bodyXs",tone:"subdued",children:["(",t?.evaluation_count||0,")"]})]})})]}),e.jsx(U,{gap:"300",blockAlign:"center",children:e.jsx(m,{as:"h2",variant:"bodyMd",fontWeight:"semibold",children:c()})})]})},sR=({productDetail:t})=>{const{t:s}
2871=J(),{loading:n,shippingInfo:a,renderPrice:r,isShippingAvailable:o}=mn({productDetail:t});return e.jsx("div",{"data-testid":"shipping-info",children:e.jsx("div",{className:"flex flex-col gap-3 bg-bg-surface-active p-3 rounded-xl",children:e.jsxs("ul",{children:[e.jsx("li",{className:"py-1",children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:n?e.jsx(Se,{height:20,width:"50%"}):o()?e.jsxs(e.Fragment,{children:[s("ShippingCost")," ",e.jsx("strong",{className:"text-text",children:r(a?.amount,!0)})]}):e.jsxs("span",{className:"inline-flex items-center",children:[e.jsx("span",{children:s("CannotBeShippedToTheSelectedCountry")}),e.jsx("span",{className:"flex",children:e.jsx(ee,{source:hr,tone:"warning"})})]})})}),e.jsx("li",{className:"py-1",children:n?e.jsx(Se,{height:20,width:"50%"}):o()?e.jsx(D,{gap:"200",children:e.jsx(U,{blockAlign:"center",gap:"100",wrap:!1,children:e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:e.jsx("span",{className:"[&>b]:font-[450]",dangerouslySetInnerHTML:{__html:s("EstimateDaysProcessingDaysShipping",{processing_days:fi(a?.processing_time||"","")||"-",shipping_days:fi(a?.delivery_time||"","")||"-"})}})})})}):e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:s("NoShippingMethodFound")})})]})})})},nR=({productDetail:t,selectedVariants:s,onVariantChange:n,onOptionImageClick:a})=>{const{productDetailShipTo:r}=mn({productDetail:t}),{selectedVariants:o,handleVariantChange:l,getOptionQuantityMap:c}=Tr({productDetail:t,selectedVariants:s,onVariantChange:n,shipToCountry:r}),u=i.useMemo(()=>c(),[c]),d=i.useMemo(()=>t?.options?[...t.options].sort((h,p)=>h.values?.[0]?.image&&!p.values?.[0]?.image?-1:!h.values?.[0]?.image&&p.values?.[0]?.image?1:0):[],[t?.options]),g=(h,p,x)=>{l(h,p,x)};return e.jsx("div",{"data-testid":"product-variant-selector",children:e.jsx(D,{gap:"500",children:d.map(h=>e.jsxs(D,{gap:"150",children:[e.jsxs(m,{as:"span",variant:"bodySm",tone:"subdued",children:[h.name,": ",e.jsx("strong",{children:o[h.name]})]}),e.jsx(aR,{optionValues:h.values,selectedVariants:o,handleVariantChange:g,optionName:h.name,optionQuantities:u[h.name]??{},totalOption:d.length,onOptionImageClick:a})]},h.id))})})},aR=({optionValues:t,selectedVariants:s,handleVariantChange:n,optionName:a,optionQuantities:r,totalOption:o,onOptionImageClick:l})=>{const[c,u]=i.useState(!1),[d,g]=i.useState(!1),[h,p]=i.useState(null),x=i.useRef(null);return i.useLayoutEffect(()=>{const f=x.current;if(!f)return;const _=f.firstElementChild;if(!_)return;const b=_.offsetHeight;p(b),g(f.scrollHeight>b+4)},[t]),e.jsxs("div",{className:"flex relative",children:[e.jsx("div",{ref:x,className:"flex gap-2 flex-wrap overflow-hidden",style:!c&&h?{maxHeight:h}:void 0,children:t.map(f=>{const _=r[f.value],b=Object.keys(s).some(y=>y!==a),v=o>1?b&&_===0:_===0;return f.image?e.jsx(rR,{image:f.image,selected:s[a]===f.value,onClick:()=>{n(a,f.value,f.image),l?.(f.image)},isOutOfStock:v},f.id):e.jsx(iR,{label:f.value,selected:s[a]===f.value,onClick:()=>n(a,f.value,f.image),isOutOfStock:v},f.id)})}),d&&!c&&e.jsx("button",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-[45px] flex justify-end items-center h-8 cursor-pointer",style:{background:"linear-gradient(270deg, #FFFFFF 42.32%, rgba(255, 255, 255, 0) 100%)"},onClick:()=>u(f=>!f),children:e.jsx("span",{children:e.jsx(ee,{source:Rs})})})]})},rR=({image:t,selected:s,onClick:n,isOutOfStock:a})=>e.jsx("button",{className:oe("border cursor-pointer rounded-lg overflow-hidden size-8",s?"border-input-border-active":"border-border",a&&"opacity-40 "),onClick:n,children:e.jsx(pn,{source:t,alt:"option image",isSize:!1,isBoxShadow:!1})}),iR=({label:t,selected:s,onClick:n,isOutOfStock:a})=>e.jsx("button",{className:oe("px-2 py-1 border cursor-pointer rounded-lg",s?"border-input-border-active":"border-border",a&&"opacity-40 line-through"),onClick:n,children:e.jsx("div",{children:e.jsx(m,{truncate:!0,as:"span",variant:"bodySm",fontWeight:"medium",tone:s?void 0:"subdued",children:t})})}),c0=Oe.forwardRef((t,s)=>{const{priceHistoryChart:n,currencyOfData:a,maxItem:r,minItem:o}=t,{t:l}=J(),{isMobile:c}
2871=xe(),{convertCurrencyWithSymbol:u,getCurrentShop:d}=Vn(),g=d(),[h,p]=i.useState(!1),x=()=>{p(!1)},f=[{name:"Price",data:n,yAxisOptions:{labelFormatter:v=>`${u(Number(v)||0,a,a)}`}}];let _=[];r?.value&&o?.value&&r.value!==o.value&&(_=[{startKey:r.key,label:`Highest price: ${u(Number(r.value)||0,a,g)}`,axis:"x"},{startKey:o.key,label:`Lowest price: ${u(Number(o.value)||0,a,g)}`,axis:"x"}]),i.useImperativeHandle(s,()=>({open:()=>p(!0)}));const b=e.jsx("div",{className:"p-4",children:e.jsx("div",{style:{height:300},children:e.jsx(ji,{themes:{Light:{chartContainer:{backgroundColor:"transparent",minHeight:300}}},children:e.jsx(yp,{theme:"Light",showLegend:!1,data:f,annotations:_,yAxisOptions:{labelFormatter:v=>u(Number(v)||0,a,g)},tooltipOptions:{valueFormatter:v=>u(Number(v)||0,a,g)}})})})});return c?e.jsx(xt,{visible:h,onClose:x,title:l("PriceHistory"),showCloseIcon:!0,children:b}):e.jsx(Xe,{open:h,onClose:x,title:l("PriceHistory"),children:b})}),qs=36,Xo=2.5,Jo=qs/2-Xo/2,Qu=2*Math.PI*Jo,co=({value:t,label:s})=>{const n=t!==void 0&&t!==""?Number(t):void 0,a=n?Math.min(n/5,1):0,r=a*Qu;return e.jsxs(U,{gap:"150",blockAlign:"center",children:[e.jsxs("svg",{width:qs,height:qs,style:{flexShrink:0},children:[e.jsx("circle",{cx:qs/2,cy:qs/2,r:Jo,fill:"none",stroke:"#e4e5e7",strokeWidth:Xo}),a>0&&e.jsx("circle",{cx:qs/2,cy:qs/2,r:Jo,fill:"none",stroke:"#29845A",strokeWidth:Xo,strokeDasharray:`${r} ${Qu}`,strokeLinecap:"round",transform:`rotate(-90 ${qs/2} ${qs/2})`}),e.jsx("text",{x:qs/2,y:qs/2,textAnchor:"middle",dominantBaseline:"central",fontSize:"12",fontWeight:"500",fill:"#000000",children:n??"-"})]}),e.jsx(m,{as:"span",variant:"bodySm",children:s})]})},oR=({productDetail:t})=>{const{t:s}=J(),n=t?.source_product_id||"",a=t?.source,r=i.useRef(null),{convertCurrencyWithSymbol:o,getCurrentShop:l,formatConvertedAmount:c}=Vn(),{handleStoreClick:u}=l0({productDetail:t}),{data:d,isPending:g}=ks({queryKey:vt.simpleMode.productPriceHistory(n),queryFn:async()=>(await Xl.getProductPriceHistory({product_id:n})).data,enabled:a==="aliexpress"&&!!n}),h=l(),p=t?.store_info?.store_name,x=t?.store_info?.communication_rating,f=t?.store_info?.item_as_described_rating,_=t?.store_info?.shipping_speed_rating,{priceHistoryChart:b}=i.useMemo(()=>d?{priceHistoryChart:d.price_history.map(k=>({key:k.date,value:Number(k.minPrice)}))||[]}:{priceHistoryChart:[]},[d]),v=d?.currency||"USD",y=b.length>0?b.reduce((k,O)=>k.value&&O.value?k.value>O.value?k:O:k):null,C=b.length>0?b.reduce((k,O)=>k.value&&O.value?k.value<O.value?k:O:k):null,S=C?.value?o(Number(C.value),v,h):null,j=y?.value?o(Number(y.value),v,h):null,A=t?.price_range[0]?c(Number(t?.price_range[0])):null,E=S?S===j?S:`${S} - ${j}`:A||"-",T=!!(S&&j&&S!==j);return e.jsxs(Q,{padding:"400",background:"bg-surface",borderRadius:"300",children:[e.jsxs(D,{gap:"400",children:[e.jsxs(U,{blockAlign:"center",align:"space-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:s("AveragePriceInTheLast180Days")}),e.jsxs(U,{gap:"100",blockAlign:"center",children:[g?e.jsx(Se,{height:20,width:80}):e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:E}),T&&e.jsx(Et,{content:"View chart",children:e.jsx("span",{className:"text-text-link cursor-pointer",onClick:()=>{requestAnimationFrame(()=>{r.current?.open()})},children:e.jsx(ee,{source:_l,tone:"inherit"})})})]})]}),e.jsx($s,{}),e.jsxs(D,{gap:"300",children:[p&&e.jsxs(U,{gap:"150",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:xp})}),e.jsx("div",{onClick:u,className:"hover:underline cursor-pointer",children:e.jsx(m,{as:"p",variant:"headingSm",children:p})})]}),e.jsxs(U,{gap:"300",blockAlign:"center",align:"space-between",children:[t?.trustworthy&&e.jsx(wt,{tone:"success",children:`${t?.trustworthy}% ${s("Trustworthy")}`}),e.jsx(co,{value:x,label:s("Communication")}),e.jsx(co,{value:f,label:s("ItemQuality")}),e.jsx(co,{value:_,label:s("Shipping")})]})]})]}),e.jsx(c0,{ref:r,priceHistoryChart:b,currencyOfData:v,maxItem:y,minItem:C})]})},lR=({name:t,item_specifics:s,loadingDetail:n})=>{const{t:a}=J(),{data:r,isPending:o}=Jl({name:t,item_specifics:s,enabled:!!t&&!n});return e.jsx(nt,{roundedAbove:"xs",children:e.jsxs(D,{gap:"100",children:[e.jsx(m,{as:"p",variant:"headingSm",children:a("MarketInsights")}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone
2871:"subdued",children:a("MarginLevel")}),o?e.jsx(Se,{height:20,width:100}):e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:r?.margin_level?`${r.margin_level}%`:"n/a"})]}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:a("CompLevel")}),o?e.jsx(Se,{height:20,width:100}):e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:r?.competition_level?`${r.competition_level}`:"n/a"})]}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:a("AvgAdSpend")}),o?e.jsx(Se,{height:20,width:100}):e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:r?.avg_ad_spend?`${r.avg_ad_spend}`:"n/a"})]}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:a("CPARange")}),o?e.jsx(Se,{height:20,width:100}):e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:r?.cpa_range?`${r.cpa_range.map(l=>`$${l}`).join("-")}`:"n/a"})]})]})})},cR=({itemSpecifics:t})=>{const{t:s}=J(),{isMobile:n}=xe(),a=n?"bodyXs":"bodyMd";if(!t?.blockContent||t.blockContent.length===0)return e.jsxs(D,{gap:"300",children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:"medium",children:s("Specifications")}),e.jsx(D,{gap:"200",children:e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:s("Nodata")})})]});const r=t.blockContent,l=(u=>{const d=[];for(let g=0;g<u.length;g+=1){const h=u.slice(g,g+1);d.push(h)}return d})(r),c=u=>u.map((d,g)=>e.jsx(ft,{columns:"1fr 1fr",gap:"0",children:d.map((h,p)=>e.jsxs(Oe.Fragment,{children:[e.jsx(Q,{background:"bg-surface",padding:"200",borderBlockEndWidth:g===u.length-1?"0":"025",borderInlineEndWidth:"025",borderColor:"border",borderStyle:"solid",children:e.jsx(m,{as:"span",variant:a,fontWeight:"medium",breakWord:!0,children:h.name})}),e.jsx(Q,{background:"bg-surface",padding:"200",borderBlockEndWidth:g===u.length-1?"0":"025",borderColor:"border",borderStyle:"solid",children:e.jsx(m,{as:"span",fontWeight:"medium",variant:a,breakWord:!0,children:h.value})})]},p))},g));return e.jsx(D,{gap:"0",children:c(l)})},d0=({description:t})=>{const{t:s}=J(),n=t?.trim().replace(/\s+/g," ");return n?e.jsx("div",{style:{height:"fit-content"},children:e.jsx(D,{gap:"400",children:e.jsx("div",{style:{width:"100%",overflowX:"auto",overflowY:"visible"},dangerouslySetInnerHTML:{__html:n}})})}):e.jsx(D,{gap:"400",children:e.jsx(D,{gap:"200",children:e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:s("Nodata")})})})},dR=({description:t,itemSpecifics:s})=>{const{t:n}=J(),[a,r]=i.useState("description"),[o,l]=i.useState(!0);return t?.trim(),e.jsx("div",{"data-testid":"product-content-section",children:e.jsxs(Q,{padding:"400",background:"bg-surface",borderRadius:"300",children:[e.jsxs("div",{className:"flex gap-4 border-b border-border mb-4",children:[e.jsxs("button",{className:"cursor-pointer pb-1 relative",onClick:()=>{requestAnimationFrame(()=>{r("description")})},children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:a==="description"?"semibold":"medium",tone:a==="description"?void 0:"subdued",children:n("Description")}),e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-px bg-input-border-active",style:{opacity:a==="description"?1:0}})]}),e.jsxs("button",{className:"cursor-pointer pb-1 relative",onClick:()=>{requestAnimationFrame(()=>{r("specifications")})},children:[e.jsx(m,{as:"span",variant:"headingSm",fontWeight:a==="specifications"?"semibold":"medium",tone:a==="specifications"?void 0:"subdued",children:n("Specifications")}),e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-px bg-input-border-active",style:{opacity:a==="specifications"?1:0}})]})]}),a==="description"&&e.jsx(D,{gap:"300",children:e.jsx("div",{style:{position:"relative",maxHeight:o?"100%":"160px",overflow:o?"auto":"hidden",transition:"max-height 0.4s ease-in-out, overflow 0.4s ease-in-out"},children:e.jsx(D,{gap:"300",children:e.jsx(d0,{description:t})})})}),a==="specifications"&&e.jsx(cR,{itemSpecifics:s})]})})},qu=({name:t,shipFrom:s,shipTo:n,item_specifics:a,loadingDetail:r})=>{const{t:o}=J(),l=s.length>0&&s.includes(n),{data:c,isPending:u}=Jl({name:t,item_specifics:a,enabled:!!t&&!r}),[d,g]=i.useState(!0),h=()=>g(p=>!p);return u?e.jsxs(D,{gap:"300",children:[e.jsx(Se,{height:20}),e.jsx(Se,{height:20}),e.jsx(Se,{height:20})]}):e.jsxs(D,{children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer",onClick:h,children:[e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"bold",tone:"subdued",children:o("RegulationInformation")}),e.jsx("div",{children:e.jsx(ee,{source:d?Rs:Pn})})]}),e.jsx(Qe,{id:"regulation-information",open:d,transition:{duration:"300ms",timingFunction:"ease-in-out"},children:e.jsx("div",{className:"mt-4",children:e.jsxs(D,{gap:"300",children:[e.jsx("div",{className:"flex",children:e.jsx(Et,{content:e.jsxs("div",{className:"flex flex-col gap-2 px-1 py-2",children:[e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:cc})}),e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:o("ShopSustainability")})]}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:o("ThisSellerHasCutCarbonEmissionsBy50ByCombiningShipmentsAndSwitchingToElectricVehiclesForDeliveries")})]}),children:e.jsxs("div",{className:"flex gap-1 items-center hover:underline",style:{textDecorationStyle:"dotted"},children:[e.jsx("span",{children:e.jsx(ee,{source:cc})}
2871),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:o("ShopSustainably")})]})})}),c?.has_certifications&&e.jsx("div",{className:"flex",children:e.jsx(Et,{content:e.jsxs("div",{className:"flex flex-col gap-2 px-1 py-2",children:[e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:dc})}),e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:o("EUregulationCompliance")})]}),e.jsxs(m,{as:"span",variant:"bodyMd",tone:"subdued",children:[o("ThisSellerDeclaredThatTheProductIsCompliedWithTheEUsCompliance"),":"]}),e.jsx("ul",{className:"list-disc pl-4 flex flex-col gap-2",children:e.jsx("li",{children:"CE, RoHS, WEEE, FCC, UL"})})]}),children:e.jsxs("div",{className:"flex gap-1 items-center hover:underline",style:{textDecorationStyle:"dotted"},children:[e.jsx("span",{children:e.jsx(ee,{source:dc})}),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:o("EUregulationCompliance")})]})})}),l&&e.jsx("div",{className:"flex",children:e.jsx(Et,{content:e.jsxs("div",{className:"flex flex-col gap-2 px-1 py-2",children:[e.jsxs(U,{gap:"100",blockAlign:"center",children:[e.jsx("span",{children:e.jsx(ee,{source:uc})}),e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:o("LocalShipping")})]}),e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:o("ThisProductIsLabeledAsLocalShippingAccordingToTheDeliveryCountryTheDeliveryTimeMayBeShorterThanEstimated")})]}),children:e.jsxs("div",{className:"flex gap-1 items-center hover:underline",style:{textDecorationStyle:"dotted"},children:[e.jsx("span",{children:e.jsx(ee,{source:uc})}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:o("ShipFrom")}),e.jsx(lr,{country:n,renderCountry:p=>e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",children:p})})]})]})})})]})})})]})},uR=({productDetail:t})=>{J();const s=t?.source_product_id||"",n=t?.source,{isMobile:a}=xe(),r=i.useRef(null),{convertCurrencyWithSymbol:o,getCurrentShop:l,formatConvertedAmount:c}=Vn(),{data:u,isPending:d}=ks({queryKey:vt.simpleMode.productPriceHistory(s),queryFn:async()=>(await Xl.getProductPriceHistory({product_id:s})).data,enabled:n==="aliexpress"&&!!s}),g=l(),h=t?.store_info?.communication_rating,p=t?.store_info?.item_as_described_rating,x=t?.store_info?.shipping_speed_rating,{priceHistoryChart:f}=i.useMemo(()=>u?{priceHistoryChart:u.price_history.map(j=>({key:j.date,value:Number(j.minPrice)}))||[]}:{priceHistoryChart:[]},[u]),_=u?.currency||"USD",b=f.length>0?f.reduce((j,A)=>j.value&&A.value?j.value>A.value?j:A:j):null,v=f.length>0?f.reduce((j,A)=>j.value&&A.value?j.value<A.value?j:A:j):null,y=v?.value?o(Number(v.value),_,g):null,C=b?.value?o(Number(b.value),_,g):null,S=t?.price_range[0]?c(Number(t?.price_range[0])):null;return e.jsxs(nt,{roundedAbove:"xs",children:[e.jsxs(D,{gap:"100",children:[e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:"Trustworthy"}),e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:t?.trustworthy?`${t?.trustworthy}%`:"-"})]}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:"Communication"}),e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:h?`${h}/5`:"-"})]}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:"Item as described"}),e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:p?`${p}/5`:"-"})]}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:"Shipping speed"}),e.jsx(m,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:x?`${x}/5`:"-"})]}),e.jsxs("div",{className:"py-2 flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodySm",tone:"subdued",children:"Last 180-days price"}),e.jsxs(U,{gap:"100",blockAlign:"center",children:[d?e.jsx(Se,{height:20,width:100}):e.jsx(m,{as:"span",variant:"bodyMd",children:y?y===C?y:`${y} - ${C}`:S||"-"}),y&&C&&y!==C?e.jsx(Et,{content:"View chart",active:a?!1:void 0,children:e.jsx("span",{className:"text-text-link cursor-pointer",onClick:()=>r.current?.open(),children:e.jsx(ee,{source:_l,tone:"inherit"})})}):null]})]})]}),e.jsx(c0,{ref:r,priceHistoryChart:f,currencyOfData:_,maxItem:b,minItem:v})]})},pR=({itemSpecifics:t})=>{const{t:s}=J(),{isMobile:n}=xe(),a=n?"bodyXs":"bodyMd";if(!t?.blockContent||t.blockContent.length===0)return e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:s("Nodata")});const r=t.blockContent,l=(u=>{const d=[];for(let g=0;g<u.length;g+=1){const h=u.slice(g,g+1);d.push(h)}return d})(r),c=u=>u.map((d,g)=>e.jsx(ft,{columns:"1fr 1fr",gap:"0",children:d.map((h,p)=>e.jsxs(Oe.Fragment,{children:[e.jsx(Q,{background:"bg-surface",padding:"200",borderBlockEndWidth:"025",borderInlineEndWidth:"025",borderColor:"border",borderStyle:"solid",children:e.jsx(m,{as:"span",variant:a,fontWeight:"medium",breakWord:!0,children:h.name})}),e.jsx(Q,{background:"bg-surface",padding:"200",borderBlockEndWidth:"025",borderColor:"border",borderStyle:"solid",children:e.jsx(m,{as:"span",fontWeight:"medium",variant:a,breakWord:!0,children:h.value})})]},p))},g));return e.jsx("div",{style:{height:"fit-content"},children:e.jsx(D,{gap:"0",children:c(l)})})},hR=({loading:t,productDetail:s})=>{const{t:n}=J(),[a,r]=i.useState({active:!1,title:"",key:""}),o=(u,d)=>{r({active:!0,title:u,key:d})},l=()=>{r({active:!1,title:"",key:""})},c=()=>
2871{switch(a.key){case"description":return e.jsx(e.Fragment,{children:t?e.jsx(ys,{lines:6}):s?.description?e.jsx(d0,{description:s.description}):e.jsx(m,{variant:"bodyXs",tone:"subdued",as:"span",children:n("NotDataFound")})});case"specifications":return e.jsx(e.Fragment,{children:t?e.jsx(ys,{lines:4}):s?.item_specifics&&Object.keys(s.item_specifics).length>0?e.jsx(pR,{itemSpecifics:s.item_specifics}):e.jsx(m,{variant:"bodyXs",tone:"subdued",as:"span",children:n("NotDataFound")})})}return e.jsx(e.Fragment,{})};return e.jsx(nt,{roundedAbove:"xs",padding:"0",children:e.jsx("div",{className:"px-4 py-2",children:e.jsxs(D,{gap:"100",children:[[{key:"description",label:n("Description")},{key:"drawer-2",label:"drawer"},{key:"specifications",label:n("Specifications")}].map(u=>u.label==="drawer"?e.jsx($e,{},u.key):e.jsxs("button",{className:"flex justify-between items-center py-3",onClick:()=>o(u.label,u.key),children:[e.jsx(m,{variant:"bodyMd",as:"span",fontWeight:"medium",children:u.label}),e.jsx("span",{children:e.jsx(ee,{source:Ys})})]},u.key)),e.jsx(xt,{visible:a.active,onClose:l,zIndex:172,showCloseIcon:!0,title:a.title,children:e.jsx(Q,{padding:"400",children:c()})})]})})})};function gR({open:t,onClose:s,images:n}){const[a,r]=i.useState(),[o,l]=i.useState(),[c,u]=i.useState(0),[d,g]=i.useState(!1),[h,p]=i.useState(!1),x=i.useCallback(y=>{!a||!o||a.scrollTo(y)},[a,o]),f=i.useCallback(()=>{if(!a||!o)return;const y=a.selectedScrollSnap();u(y),o.scrollTo(y)},[a,o]);i.useEffect(()=>{a&&(f(),a.on("select",f),a.on("reInit",f))},[a,f]);const _=i.useCallback(()=>{o&&(g(o.canScrollPrev()),p(o.canScrollNext()))},[o]);i.useEffect(()=>{if(o)return _(),o.on("select",_),o.on("reInit",_),()=>{o.off("select",_),o.off("reInit",_)}},[o,_]);const b=()=>{o&&o.scrollPrev()},v=()=>{o&&o.scrollNext()};return e.jsx(Xe,{sectioned:!0,title:"",size:"large",open:t,onClose:()=>{requestAnimationFrame(()=>{s()})},children:e.jsx("div",{"data-testid":"product-carousel-gallery",children:e.jsxs(ft,{columns:"60px minmax(0,1fr)",gap:"200",children:[e.jsxs("div",{className:"relative flex flex-col items-center h-0 min-h-full overflow-auto my-auto",children:[e.jsx("button",{className:Un("mb-1 z-10 bg-white shadow rounded-full p-1 flex items-center justify-center",{"opacity-100 cursor-pointer":d,"opacity-30 cursor-not-allowed":!d}),onClick:b,disabled:!d,"aria-label":"Scroll up",type:"button",children:e.jsx(ee,{source:Pn})}),e.jsx(es,{setApi:l,orientation:"vertical",opts:{axis:"y",containScroll:"trimSnaps",dragFree:!1,loop:!1},className:"h-full max-h-full",children:e.jsx(es.Content,{className:"gap-2 flex-col",children:n.map((y,C)=>e.jsx(es.Item,{className:oe("relative flex-shrink-0 cursor-pointer border border-border overflow-hidden rounded-2xl w-[60px] h-[60px]",c===C&&"border-input-border-active"),onClick:()=>x(C),children:e.jsx("img",{className:"h-full w-full object-cover",src:y,loading:"lazy",referrerPolicy:"no-referrer",onError:sr,style:{borderRadius:"var(--p-space-400)"}})},C))})}),e.jsx("button",{className:Un("mt-1 z-10 bg-white shadow rounded-full p-1 flex items-center justify-center",{"opacity-100 cursor-pointer":h,"opacity-30 cursor-not-allowed":!h}),onClick:v,disabled:!h,"aria-label":"Scroll down",type:"button",children:e.jsx(ee,{source:Rs})})]}),e.jsx("div",{className:"flex items-center gap-2 p-6 w-[800px] mx-auto",children:e.jsx(es,{setApi:r,opts:{loop:!0,dragFree:!1,skipSnaps:!1},className:"w-full",children:e.jsx(es.Content,{children:n.map((y,C)=>e.jsx(es.Item,{className:"p-2",children:e.jsx("img",{src:y,alt:"Image preview",className:"h-full w-full aspect-square object-cover rounded-2xl border border-border",onError:sr})},C))})})})]})})})}const mR=i.forwardRef((t,s)=>{const{slides:n}=t,[a,r]=i.useState(),[o,l]=i.useState(),[c,u]=i.useState(0),[d,g]=i.useState(!1),h=i.useCallback(x=>{!a||!o||a.scrollTo(x)},[a,o]),p=i.useCallback(()=>{if(!a||!o)return;const x=a.selectedScrollSnap();u(x),o.scrollTo(x)},[a,o]);return i.useEffect(()=>{a&&(p(),a.on("select",p),a.on("reInit",p))},[a,p]),i.useImperativeHandle(s,()=>({scrollToImage:x=>{if(!a||!x)return;const f=n.findIndex(_=>_===x);f<0||a.scrollTo(f)}}),[a,n]),n.length===0?null:e.jsxs("div",{"data-testid":"product-carou
2871sel-gallery",className:"w-full space-y-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"shrink-0 relative",style:{width:"65px"},children:e.jsx("div",{className:"absolute top-0 left-0 w-full h-full overflow-hidden min-h-0",children:e.jsx(es,{setApi:l,opts:{containScroll:"trimSnaps",dragFree:!0,loop:!1},className:"w-full min-h-0 h-full [&>div]:min-h-0 [&>div]:h-full",orientation:"vertical",children:e.jsx(es.Content,{className:"h-full gap-3 min-h-0",children:n.map((x,f)=>e.jsx(es.Item,{className:"min-w-0 size-[65px] basis-0",children:e.jsx("button",{onClick:()=>h(f),className:oe("relative aspect-square w-full overflow-hidden rounded-xl border transition-all",f===c?"border-input-border-active opacity-100":"border-border"),type:"button",children:e.jsx(pn,{source:x,freeSize:!0,alt:"",classnames:"rounded-xl overflow-hidden aspect-square object-contain"})})},f))})})})}),e.jsx("div",{className:"min-w-0 grow aspect-square",children:e.jsxs(es,{setApi:r,opts:{loop:!1},className:"w-full [&>div]:rounded-xl [&>div]:overflow-hidden",children:[e.jsx(es.Content,{onClick:()=>g(!0),children:n.map((x,f)=>e.jsx(es.Item,{children:e.jsx(pn,{source:x,freeSize:!0,alt:"",classnames:"rounded-xl overflow-hidden aspect-square object-contain"})},f))}),n.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(es.Previous,{className:"-left-3 cursor-pointer"}),e.jsx(es.Next,{className:"-right-3 cursor-pointer"})]})]})})]}),e.jsx(gR,{open:d,onClose:()=>g(!1),images:n})]})}),di=({selected:t,onChange:s,options:n})=>{const a=i.useId();return e.jsx("div",{className:"flex items-center p-0.5 bg-bg-surface-brand rounded-lg",children:n.map(r=>e.jsxs("button",{className:oe("relative min-h-7 flex items-center px-5 rounded-lg cursor-pointer"),onClick:()=>s(r.value),children:[r.value===t&&e.jsx(C1.span,{layoutId:a,className:"absolute inset-0 bg-white rounded-lg shadow",transition:{type:"spring",stiffness:400,damping:35}}),e.jsx("span",{className:"relative z-10",children:r.label})]},r.value))})},fR="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAArOSURBVHgB7VpNbBxJFX7VPdMzY+fHiWywrSAU1pZixILCLUgBCcQKcVzQwhEJjnDgzgmJK2ckOHFiJZDQCrQCISFx2MMuaBFZBApZJbvZtRP/zcTjeDwz3VW8V1Wv+nXPOJmZ9spayS8Z90x1/byv3qv31w1wTud0Tud0ToFimJ5mGTMx1eCjoQg/emNj4zMHBwd3tra2jubm5h7X6/UHxpgPa7VaN8uyIV7n8fppBbDeH/SvfXLpE3M7m5vrB/3+PRyPzWDglEnB6ZIFiuBWNjZu/CFJGl98586dtHt4WEOwcOHCBUCQgCDBaI1oHJ5IRRDFMcRRNEyztH716tX32+3Oy7u7u/+AUwZ+WoAt0KWlpdurq8uv6sysHPV6GqUZEcC7d++CUgoajQbgZiBAZX9nBNoY0HilTWg2m6Dx2mg2s3qtFuMufdDpdL6zv7//BpwS8KqALdCVlZWXVldXf9Pv968cHR1ZoASCPk0E+eSgA9vbu1a6JOkYpUmAEa1FgOPgU9euQbuzD0nShCiKWBOyGgGvxbsHB91XUOJ/rQp8VsAW6PXr17+8uLj42vHx8SUEilqqI5IY/kfppaiisZVckiQI6hgeP962vwk0gSLQdG9h4TLgWbcbgcfA3iOiuagPzpvhvbgWR+0PN7e+MhgM3vF8TA18FsB2h2/fvv167+joG0+6aH/S1FpWkiixQHKzqppp25vUlCRG7ajMgOcUwbmzTPdwPB1kSOqJvVoYBgJ3VhuwIcNdxHlquME/2dnZ+RnMQDNJ+NatW6/iot8+7HYjkqa2UnXnkchJ2X2nTTAamdWZb9d2WT67dJ5JonWULM/hAJYY9W1433QPDhSu+a3Dw8Pf0xIwBU3rliI0TC+gVF7pdru2gYBIaTBQ+qmZedTQWuSWIuus/YaQ1HP1LW4YjSuDp/64yUpro+fmW79DwAqmPNPTOnmzvr7+3739/Saqa0RLDYdDiD1zOjB68gTKS1Rex0lU9ieyWoBnv91uExsKXZmpJ8kiGrzXYQqKpugbr62t/SBN08U0HcaHTw8tE/YcerUmIuAkNOKTmbViEL8lkDLxcZBSllpD38mdEc21Wj/EywWYQnCTAqYJs4sXL/yyhpaUFj3u9cJNbXRg1v7WJkhZOaTA51Z+/CAoAxY/ckYj57edu8toXoXWOl1aWnyTeINTBpzdvHnzL53OE426pIbDFHrHx1bFHMDR82fBCsblGZXgDMCYTcgvebuyxs96ArL1qEbGHuv6DQxmvgkTSnkSwBEGFjeGg8HXcPYIXYNTqywLKseRktZFg6msQWJQAknoULC+YhO8CisVhti16F9YwzAf+vLlS38EJ+Xn4pkEsMYo6g2UaEo/LFB/g0GzhJ10C3icXw4SZGAm+Fp1gmfk82pMvols4dktuPlNhHYlw/j7zzCBi3oe4Bgznu9jFLSAE9eUB8kSkFKxO2N9LuTAx0jPXfPgxAUjEDQlgCtfvRfg8UxexWM8Xl/HqG0DnqPa0XPuZfPz879yExuroi7TGQWgvUozEHQ61opLhkfOqier+gYKc46z4kU74dv8Xwr3riws/B2caqtngTqJ9IsvfuFP6PcoGVDaR0op+t3QwbfR4hxRMVNRHI0YM3m16iw1QAkVHmPA3Hq5N1DOAASDhv9q+K116eLFn8Mz6CTA0fLy8me1Hr6EUqIz4o6cdmqVS01YUTrLHBoChIDC9QHgTTe+wQgkMvjw4XiYnyXpwJqQZelSGMu2BDXyxwuUjZyg2icBJkP1Vv+4n7L1dfmrC/alDw0Jg5SKcnvuwDsj4ySXu6IA3n4BYfEzodYQpMjWWbbx2Y+UWwV/KEopG43kf3CCbx4LGNO+zyODc4hWDb0Ks1HR/mp31FmfEHgE7kGFsywNl/H9883JN8iNNOOPQNikPIABL1XmwwKnqgnG242ksYgdVyYGfP/+/X+//fY/E0y8H1DAjiqtnQT0iJ+0yYMApHV+T4uKRgAkD6X4aqEYAC4c8JwKYKyh0yJo8QLQKFmKAP/2/sOHNGwbJgUMTh3MvXvvrmFG8t25uRYGHKmmCMueZwSVJPUAjJnzX1xFwxsW9sVFADleNkAFOAKgO/6qaL2FtSeBYLibNZuNaGvr0Zfanc5XPa7JVdqTDTQw0f4tAsdqQ+0/aL8MJg6GzjXVpvKgXmRoPjrS3vJmXv1pk/JMquyiTIi5+djIXZHqTTE1H6s4jjTWvmidtx4+/EChMN70vJ8YgEwSaVm/9uC99z7X7/V+1Gg0UXiGghsrydyliBGqoK1BlU3JOov9KUxQ2AxV7h8seorloOjw6ZOXt7d3bsEzpDotYAYNO3t7v3j06NFqq9mo9TF5QI4eW/mSZLLRTTUiiwruI68U+E+o4wRAuSXP72vvn7FO1sY+BrVtb3Nzs9nt9l7zy01U+ZgmH2bg23v77dpgOFzDCOlfUJIcVzAsu3q0ciGggJHWHPLwSFr0vBE4sf4pzvU9LN8ue34mTg1nAcygaTffxYWbBFBGVOx/AyipqiV1hrIbKhhAE9xN3kbaZF5AG/JrcPBTmJJmAew4BZdI2HhZ58U3AhUJlyRJST8KUFRv7hOqHGMWtS6ryMO0NCtgS8hcbFXYx9LWoLgbI4DZnyolQkKQQQWEkDQEG8LVCf2YCShTNcDGxIGf0FiMmZmKsCD0YQvNKs016HCGfXtp72amSoCRhzpnOLYa6yuRMqEIfY0qVDAkyURAiTo8uSS2BhxwQMXHqdUkHEV1Nia+XuPYE+EkJxfKh1jl4gFAWWQqGD6p0awNuJ+VeK422Psg9wTBMe6sdlbwu9IVgfhWTAz8nDLxLx8LO6eqQxWeoQJhWFcP6SI+41W+sM4JhBPt6LhRC1ws78jgw5QHRdVUutIbAOgmajLg4POb+U2QBfhyRTNPI8fE4jA+Q7KxNCaBUIEqSTgzOqayLfFqAdskQQtwqlD2kURGjAMMWbOW1Q/eNEnsGWalSoBzt+GeDFACroWlMSAstRk3eOSYWpIFPHZb4beqppWVAGNFJHa+kwC7p/qkzpYxcO15mMnShLGqOo6chS+aPKvVFajaGUb1oiyJwHKIKawM0H5yxpRLrWiZZWJh+4EsKtAD9Rrkri90mZmqBR5aJzZ29gaLUjiuXMpq4giHiqPq4h22zIVHqAbE4xU3GipQ1UjLssUvqVh3JA5lqEfJMXxfqQLrIZTMG7BLlFfBTlD7aami0XJPI1xI6RMGahfVxLHEYaKRTfkGKDFHqDnnUdrZSZheq7FP8sk6Z6NRkf9SDCOVqHAUWC8nGmNcmXNxZ+eWBoNhHQtp7k0ACidhFIeLf0vLlLCwUcozLGXVeVznVqt1doCxSK+azRbwUwWuSmqOoYOUi761+DoShCwqf1tA3s8rhDQfrnl2fhiNlQrG
2871Skl/micMPrstlGrKxfVCNbO0OTLN9C7r7JIHfHBFteCgsiwgq+bekEmJ2QX9I9TIByw8zl7DH2eonLtTYRwZSExWKkm40mCUcNO+EGoflToLbVNFcWbHPToJVppBGxUSf/umG7hgg9ydfUuPhkS+6mHMFahAVUw8bVaMjyZbWDKNUdp1DCsT4jkxpn5sTAsZnkfGE9QCTocMPhqh51Qa21KawMRxAvnGG7w3xFtPcdOeKtUfYPnb7iN+ep5feiMuhSnfwDunczqnc/pY0v8BIoEl+qxztucAAAAASUVORK5CYII=",xR="/assets/thumbnail-vibrant-XoOQtTy2.png",_R="/assets/thumbnail-simple-minimal-CLpiJZaS.png";function uo({section:t,label:s,checked:n,onCheckedChange:a,open:r,onToggleOpen:o,prompt:l,onPromptChange:c,styleValue:u,onStyleChange:d,styleOptions:g,styleLabel:h,titleAffixSlot:p,disabled:x}){const{t:f}=J(),b=`${i.useId()}-${t}`,[v,y]=i.useState(!1);return e.jsxs("div",{className:oe("group rounded-xl border-[0.5px]","focus-within:[outline:var(--p-border-width-050)_solid_var(--p-color-border-focus)]","focus-within:outline-offset-[var(--p-space-025)]",n?"border-border":"border-transparent"),children:[e.jsxs("div",{className:oe("flex items-center gap-2 min-w-0 px-3 py-2",n?"border-b-[0.5px] border-border":""),children:[e.jsx("div",{onClick:C=>C.stopPropagation(),onKeyDown:C=>C.stopPropagation(),className:"shrink-0 mt-1",children:e.jsx(Sn,{label:s,labelHidden:!0,checked:n,onChange:C=>{requestAnimationFrame(()=>{a(C)})},disabled:x})}),e.jsx("button",{type:"button",className:"flex flex-1 min-w-0 items-center justify-between gap-2 text-left cursor-pointer rounded-lg py-0.5 -my-0.5",onClick:()=>{requestAnimationFrame(()=>{a(!n)})},"aria-expanded":r,"aria-controls":b,children:e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:s})})]}),e.jsx(Qe,{id:b,open:n,transition:{duration:"300ms",timingFunction:"ease-in-out"},children:e.jsxs("div",{className:"grid gap-3 relative group",children:[e.jsx("div",{className:"peer [&_textarea]:pb-14",children:e.jsx("textarea",{disabled:x,rows:2,autoComplete:"off",placeholder:f("EnterPromptHere"),value:l,onChange:C=>c(C.currentTarget.value),className:oe("w-full bg-white border-none outline-none resize-none","max-md:text-base text-text","px-3 py-2",x&&"cursor-not-allowed text-text-disabled")})}),e.jsxs("div",{className:oe("flex flex-wrap items-end justify-between gap-3 absolute z-[100] w-[calc(100%-4px)] bottom-px px-3 py-2 left-0.5 rounded-b-lg",x?"":"bg-bg-surface"),children:[e.jsx("div",{className:"max-w-fit flex-1",children:e.jsx(Np,{active:v,activator:e.jsxs("button",{type:"button",onClick:()=>{requestAnimationFrame(()=>{y(C=>!C)})},className:"flex items-center justify-between py-1 px-3 rounded-full bg-bg-surface-secondary w-fit",disabled:x,children:[e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",fontWeight:"medium",children:h}),e.jsx(ds,{source:Rs,tone:"subdued"})]}),onClose:()=>{requestAnimationFrame(()=>{y(!1)})},children:e.jsx("div",{className:"p-3 grid gap-1",children:g.map(C=>e.jsx("button",{type:"button",onClick:()=>{requestAnimationFrame(()=>{d(C.value),y(!1)})},className:oe("text-left cursor-pointer hover:bg-bg-surface-active rounded-lg p-2",C.value===u?"bg-bg-surface-active":""),children:e.jsxs("div",{className:"flex items-center gap-2",children:[C.image&&e.jsx("img",{src:C.image,alt:C.label,className:"size-15 rounded-lg object-contain border-[0.5px] border-border"}),e.jsx(m,{as:"span",variant:"bodySm",tone:"subdued",fontWeight:"medium",children:C.label})]})},C.value))})})}),p]})]})})]})}function bR({label:t,checked:s,onCheckedChange:n,open:a,onToggleOpen:r,prefix:o,suffix:l,onPrefixChange:c,onSuffixChange:u}){const{t:d}=J(),h=`${i.useId()}-prefix-suffix`;return e.jsxs("div",{className:oe("group rounded-lg border-[0.5px]",s?"border-border":"border-transparent"),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 px-3 py-2",children:[e.jsx("div",{onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),className:"shrink-0 mt-1",children:e.jsx(Sn,{label:t,labelHidden:!0,checked:s,onChange:p=>{requestAnimationFrame(()=>{n(p)})}})}),e.jsx("button",{type:"button",className:"flex flex-1 min-w-0 items-center justify-between gap-2 text-left cursor-pointer rounded-lg py-0.5 -my-0.5",onClick:()=>{requestAnimationFrame(()=>{n(!s)})},"aria-expanded":a,"aria-controls":h,children:e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",children:t})})]}),e.jsx(Qe,{id:h,open:s,transition:{duration:"300ms",timingFunction:"ease-in-out"},children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-2 px-3 pb-3",children:[e.jsx(gt,{label:d("Prefix"),autoComplete:"off",value:o,onChange:c}
2871),e.jsx(gt,{label:d("Suffix"),autoComplete:"off",value:l,onChange:u})]})})]})}function Zu(t){return Fs.find(s=>s.mockText===t)?.id??""}function yR(t,s){return t||(An.find(n=>n.prompt===s)?.id??"")}const CR={marketplace_optimized:fR,simple_minimal:_R,vibrant_engaging:xR};function vR({aiTitle:t,aiDescription:s,aiImage:n,onChangeAiTitle:a,onChangeAiDescription:r,onChangeAiImage:o,hasPermissionThumbnail:l,prefix:c,suffix:u,onChangePrefix:d,onChangeSuffix:g}){const{t:h}=J(),[p,x]=i.useState({title:!1,description:!1,thumbnail:!1,"prefix-suffix":!1}),f=Fs.map(E=>({label:h(E.labelKey),value:E.id})),_=An.map(E=>({label:h(E.labelKey),value:E.id,image:CR[E.id]})),b=E=>()=>{x(T=>T[E]?{title:!1,description:!1,thumbnail:!1,"prefix-suffix":!1}:{title:E==="title",description:E==="description",thumbnail:E==="thumbnail","prefix-suffix":E==="prefix-suffix"})},v=E=>T=>{if(E==="title"){const k=!t.user_prompt&&T?Fs[0]?.mockText??"":t.user_prompt;a({...t,is_enable:T,user_prompt:k})}else if(E==="description"){const k=!s.user_prompt&&T?Fs[0]?.mockText??"":s.user_prompt;r({...s,is_enable:T,user_prompt:k})}
2871else if(E==="thumbnail"){const k=An[0],O=!n.user_prompt&&T?k?.prompt??"":n.user_prompt,R=!n.user_prompt&&T?k?.id??"":n.mode;o({...n,is_enable:T,user_prompt:O,mode:R})}else o({...n,is_enable:T})},y=E=>T=>{E==="title"?a({...t,user_prompt:T}):E==="description"?r({...s,user_prompt:T}):o({...n,user_prompt:T})},C=E=>T=>{if(E==="thumbnail"){const O=An.find(R=>R.id===T);o({...n,mode:T,user_prompt:O?.prompt??""});return}const k=Fs.find(O=>O.id===T);E==="title"?a({...t,user_prompt:k?.mockText??""}):r({...s,user_prompt:k?.mockText??""})},S=Zu(t.user_prompt??""),j=Zu(s.user_prompt??""),A=yR(n.mode,n.user_prompt??"");return e.jsxs("div",{className:"grid gap-3 mt-4",children:[e.jsx(uo,{section:"title",label:h("Title"),checked:t.is_enable,onCheckedChange:v("title"),open:p.title,onToggleOpen:b("title"),prompt:t.user_prompt??"",onPromptChange:y("title"),styleValue:S,onStyleChange:C("title"),styleOptions:f,styleLabel:h(S?Fs.find(E=>E.id===S)?.labelKey??"":"Style")}),e.jsx(uo,{section:"description",label:h("Description"),checked:s.is_enable,onCheckedChange:v("description"),open:p.description,onToggleOpen:b("description"),prompt:s.user_prompt??"",onPromptChange:y("description"),styleValue:j,onStyleChange:C("description"),styleOptions:f,styleLabel:h(j?Fs.find(E=>E.id===j)?.labelKey??"":"Style")}),e.jsx(uo,{disabled:!l,section:"thumbnail",label:h("Thumbnail"),checked:n.is_enable,onCheckedChange:v("thumbnail"),open:p.thumbnail,onToggleOpen:b("thumbnail"),prompt:n.user_prompt??"",onPromptChange:y("thumbnail"),styleValue:A,onStyleChange:C("thumbnail"),styleOptions:_,styleLabel:h(A?An.find(E=>E.id===A)?.labelKey??"":"Style")}),e.jsx(bR,{label:h("AddTextBeforeOrAfterProductTitle"),checked:c.is_enable&&u.is_enable,onCheckedChange:E=>{d({...c,is_enable:E}),g({...u,is_enable:E})},open:p["prefix-suffix"],onToggleOpen:b("prefix-suffix"),prefix:c.value??"",suffix:u.value??"",onPrefixChange:E=>d({...c,value:E}),onSuffixChange:E=>g({...u,value:E})})]})}function qn(t){if(t===void 0||t==="")return 0;const s=typeof t=="number"?t:parseFloat(String(t));return Number.isFinite(s)&&s>=0?s:0}function Xu(t){return t.map(s=>({...s,selling_price:{operator:s.selling_price.operator,value:s.selling_price.value?.toString()??""},compare_at_price:{operator:s.compare_at_price?.operator??"x",value:s.compare_at_price?.value?.toString()??""}}))}function AR({pricingRules:t,isSetProductActive:s,isAllowSellOutOfStock:n,isSetProductAsTaxable:a,isIncludeShippingCost:r,onChangeSetting:o,onChangePricingRules:l,pricingMode:c,onChangePricingMode:u}){pt();const{t:d}=J(),g=dt(),h=mi(g.getCurrency()),p=i.useMemo(()=>JSON.stringify(t),[t]),[x,f]=i.useState(null),[_,b]=i.useState(null),[v,y]=i.useState(()=>Xu(t)),C=d(r?"TotalCost":"ProductCost"),S=v.length,j=v[S-1],A=(R,P)=>`${C} ${R==="x"?"x":"+"} ${P}`,E=R=>{const P=t.length,w=t[R],N=R===P-1;if(P===1&&N)return`${d("From")} 0 - â`;if(N&&P>1)return d("RestOfTheRanges");const K=w?.from??0,L=w?.to??"",W=h?.currencyType?` ${h.currencyType}`:"";return`${K} - ${L}${W}`},T=(R,P,w)=>{y(N=>{const K=[...N],L={...K[R]};return P==="operator"?L.selling_price={...L.selling_price,operator:w}:L.selling_price={...L.selling_price,value:w},K[R]=L,K})},k=(R,P,w)=>{y(N=>{const K=[...N],L={...K[R]};return P==="operator"?L.compare_at_price={...L.compare_at_price,operator:w}:L.compare_at_price={...L.compare_at_price,value:w},K[R]=L,K})},O=()=>{l(v.map(R=>({...R,selling_price:{operator:R.selling_price.operator,value:qn(R.selling_price.value)},compare_at_price:{operator:R.compare_at_price.operator,value:qn(R.compare_at_price.value)}})))};return i.useEffect(()=>{y(Xu(t))},[p]),e.jsx("div",{className:"flex flex-col gap-4",children:e.jsxs(D,{gap:"400",children:[e.jsx(Q,{padding:"500",background:"bg-surface",borderRadius:"300",shadow:"100",children:e.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodyMd",children:d("ProductStatus")}),e.jsx(di,{selected:s?"true":"false",onChange:R=>{requestAnimationFrame(()=>{o("is_publish",R==="true")})},options:[{label:d("Active"),value:"true"},{label:d("Draft"),value:"false"}]})]})}),e.jsx(Q,{padding:"500",background:"bg-surface",borderRadius:"300",shadow:"100",children:e.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodyMd",children:d("WhenProductOutOfStock")}),e.jsx(di,{selected:n?"true":"false",onChange:R=>{requestAnimationFrame(()=>{o("allow_sell_out_of_stock",R==="true")})},options:[{label:d("KeepSelling"),value:"true"},{label:d("Stop"),value:"false"}]})]})}),e.jsxs(Q,{padding:"500",background:"bg-surface",borderRadius:"300",shadow:"100",children:[e.jsx("span",{dangerouslySetInnerHTML:{__html:"<style>.Polaris-Tooltip-TooltipOverlay--default{max-width: 400px!important;}</style>"}}
2871),e.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(m,{as:"p",variant:"bodyMd",children:d("SetPrice")}),e.jsx("div",{className:"flex items-center",children:e.jsx(Et,{content:e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[v.length>0?v.map((R,P)=>e.jsxs("div",{className:"flex flex-col gap-2",children:[v.length>1&&e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"semibold",children:E(P)}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:d("SellingPrice")}),e.jsx(m,{as:"p",variant:"bodyMd",children:A(R.selling_price.operator,qn(R.selling_price.value))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:d("CompareAtPrice")}),e.jsx(m,{as:"p",variant:"bodyMd",children:A(R.compare_at_price.operator,qn(R.compare_at_price.value))})]}),P<v.length-1&&e.jsx($s,{})]},P)):"-",e.jsx($s,{}),e.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[e.jsx(aa,{url:Y.GENERAL_SETTING.SUBROUTES.PRICING_RULES.PATH,children:d("EditFormulaInSettings")}),e.jsx("span",{className:"text-text-link",children:e.jsx(ee,{source:um,tone:"inherit"})})]})]}),children:e.jsx(m,{variant:"bodyMd",as:"p",tone:"subdued",children:e.jsx("span",{className:"underline",style:{textDecorationStyle:"dotted"},children:`${j?A(j.selling_price.operator,qn(j.selling_price.value)):"-"}`})})})})]}),e.jsx(di,{selected:c,onChange:R=>{requestAnimationFrame(()=>
2871{u(R)})},options:[{label:d("Auto"),value:"auto"},{label:d("Manual"),value:"manual"}]})]}),e.jsx(Qe,{id:"set-price",open:c==="manual",transition:{duration:"300ms",timingFunction:"ease-in-out"},children:e.jsx("div",{className:"mt-4",children:e.jsxs(D,{gap:"400",children:[v.map((R,P)=>e.jsxs("div",{className:"border-[0.5px] border-border rounded-xl p-3 pr-2 grid gap-3 bg-bg-surface-secondary",children:[v.length>1&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-lg flex items-center justify-between",children:[e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"semibold",children:d("CostRange")}),e.jsx(m,{as:"p",variant:"bodyMd",fontWeight:"semibold",children:E(P)})]}),e.jsx($s,{})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 group/selling-price min-h-8",children:[e.jsx("div",{className:"shrink-0",children:e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:d("SellingPrice")})}),x===P?e.jsxs("div",{className:"flex gap-1 items-center flex-1 justify-end min-w-0",children:[e.jsxs("form",{className:"flex gap-1 items-center flex-1 justify-end min-w-0",onSubmit:w=>{w.preventDefault(),f(null),O()},children:[e.jsx("div",{className:"w-20 md:w-24 shrink-0",children:e.jsx(Cn,{label:"",labelHidden:!0,value:R.selling_price.operator,onChange:w=>T(P,"operator",w),options:[{label:d("Plus"),value:"+"},{label:d("Multiply"),value:"x"}]})}),e.jsx("div",{className:"w-14 md:w-28 shrink-0",children:e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",min:0,value:R.selling_price.value?.toString()??"",onChange:w=>T(P,"value",w.replace(/,/g,"")),onBlur:()=>{f(null),O()}})})]}),e.jsx(Lt,{icon:Je,variant:"plain",accessibilityLabel:d("Done"),onClick:()=>{f(null),O()}})]}):e.jsxs("div",{className:"flex gap-1 items-center flex-1 justify-end min-w-0 cursor-pointer overflow-hidden",onClick:()=>{b(null),f(P)},children:[e.jsx(m,{as:"p",variant:"bodyMd",truncate:!0,children:A(R.selling_price.operator,qn(R.selling_price.value))}),e.jsx("div",{className:"md:-mr-4 group-hover/selling-price:mr-0 duration-300",children:e.jsx(mc,{className:"size-3.5"})})]})]}),v.length===1&&e.jsx($s,{}),e.jsxs("div",{className:"flex items-center justify-between gap-2 group/compare-price min-h-8",children:[e.jsx("div",{className:"shrink-0",children:e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:d("CompareAtPrice")})}),_===P?e.jsxs("div",{className:"flex gap-1 items-center flex-1 justify-end min-w-0",children:[e.jsxs("form",{className:"flex gap-1 items-center flex-1 justify-end min-w-0",onSubmit:w=>{w.preventDefault(),b(null),O()},children:[e.jsx("div",{className:"w-20 md:w-24 shrink-0",children:e.jsx(Cn,{label:"",labelHidden:!0,value:R.compare_at_price.operator,onChange:w=>k(P,"operator",w),options:[{label:d("Plus"),value:"+"},{label:d("Multiply"),value:"x"}]})}),e.jsx("div",{className:"w-14 md:w-28 shrink-0",children:e.jsx(gt,{label:"",labelHidden:!0,autoComplete:"off",min:0,value:R.compare_at_price.value?.toString()??"",onChange:w=>k(P,"value",w.replace(/,/g,"")),onBlur:()=>{b(null),O()}})})]}),e.jsx(Lt,{icon:Je,variant:"plain",accessibilityLabel:d("Done"),onClick:()=>{b(null),O()}})]}):e.jsxs("div",{className:"flex gap-1 items-center flex-1 justify-end min-w-0 cursor-pointer overflow-hidden",onClick:()=>{f(null),b(P)},children:[e.jsx(m,{as:"p",variant:"bodyMd",truncate:!0,children:A(R.compare_at_price.operator,qn(R.compare_at_price.value))}),e.jsx("div",{className:"md:-mr-4 group-hover/compare-price:mr-0 duration-300",children:e.jsx(mc,{className:"size-3.5"})})]})]})]},P)),e.jsx("div",{className:"flex justify-end",children:e.jsx(Sn,{checked:r,label:e.jsx("div",{className:"",children:d("IncludeShippingCost")}),onChange:()=>{requestAnimationFrame(()=>{o("include_shipping_cost",!r)})}})})]})})})]})]})})}const u0=i.forwardRef((t,s)=>{const{productDetail:n,shipTo:a,drawerZIndex:r,onOutQuota:o}=t,{t:l}=J(),{isMobile:c}=xe(),{token:u}=vs(),{checkPermissionFeature:d,onUpdateDefaultShowBannerUpgrade:g}=de(),{carriers:h,effectiveCarrierIndex:p}=mn({productDetail:n}),x=p>=0&&h[p]?h[p]:null,{isChangeData:f,productListing:_,fetchProductListing:b,discardChanges:v,setProductListingPrimitive:y,handleUpdateProductListingValue:C,handleUpdateAutoBoostValue:S,handleUpdatePricingValue:j,resetAutoBoostToDefault:A}=jr(),{pushProduct:E}=i0(),{isProductPushing:T,isProductPushed:k}=o0(),O=k({product_id:n?.source_product_id,source_product_id:n?.source_product_id})||q.includes(n?.tags||[],ql.LISTED),[R,P]=i.useState(!1),[w,N]=i.useState(!1),[K,L]=i.useState(""),[W,H]=i.useState(Es.selling_price.price_rules),[Z,te]=i.useState(_.selling_price.include_shipping_cost),[ne,le]=i.useState("auto"),[B,ie]=i.useState("original"),V=i.useRef("original"),M=()=>{let _e=!1;z.title?.is_enable&&z.title?.user_prompt&&(_e=!0),z.description?.is_enable&&z.description?.user_prompt&&(_e=!0),z.image?.is_enable&&z.image?.user_prompt&&(_e=!0),z.prefix?.is_enable&&z.prefix?.value&&(_e=!0),z.suffix?.is_enable&&z.suffix?.value&&(_e=!0),ie(_e?"custom"
2871:"original"),V.current=_e?"custom":"original"},I=_e=>{le(_e)},F=_e=>{H(_e)},G=_e=>{ie(_e)};i.useRef(!1);const z=_.auto_boost,me=z.title?.is_enable&&!z.title?.user_prompt,Re=z.description?.is_enable&&!z.description?.user_prompt,Be=z.image?.is_enable&&!z.image?.user_prompt;i.useImperativeHandle(s,()=>({toggle:async()=>{P(_e=>!_e),R===!1&&(await b(),M())},close:()=>P(!1)}));const De=i.useMemo(()=>n?{name:n.name,images:n.images,price:n.price_range?.[0]??0,source:n.source,source_product_id:n.source_product_id,price_range:n.price_range??[],total_variants:n.variants?.length??0,ship_to:a,shipping_cost:x?.amount||null}:null,[n,x?.amount,a]),ot=i.useMemo(()=>n?T({product_id:n.source_product_id}):!1,[n,T]),ve=()=>P(!1),pe=()=>{v(),ie(V.current),le("auto"),H(Es.selling_price.price_rules)},ze=async()=>{const _e=d("MULTI_PRICING_RULE"),Pe=_.selling_price.price_rules.length>1,Ne=q.cloneDeep(_);me&&(Ne.auto_boost.title={...Es.auto_boost.title,...Ne.auto_boost.title,user_prompt:Fs[0].mockText}),Re&&(Ne.auto_boost.description={...Es.auto_boost.description,...Ne.auto_boost.description,user_prompt:Fs[0].mockText}),Be&&(Ne.auto_boost.image.user_prompt=An[0].prompt);const{status:rt}=await Ta.putProductListingV2({...Ne,tracking_settings:{...Ne.tracking_settings,price_increased_threshold_percent:Ne.tracking_settings.price_increased_any?void 0:Ne.tracking_settings.price_increased_threshold_percent},selling_price:!_e&&Pe?void 0:Ne.selling_price},u);return rt===fe.OK?(y(Ne),me&&S("title",Ne.auto_boost.title),Re&&S("description",Ne.auto_boost.description),Be&&S("image",Ne.auto_boost.image),!0):!1},Ge=async()=>{if(De){if(N(!0),(f||me||Re||Be)&&!await ze()){N(!1);return}await E({position:"product_detail",isUseProductShipTo:!0,products:[De],pushAiEnhance:B==="custom"?void 0:Es.auto_boost,customSellingPrice:ne==="manual"?{..._.selling_price,price_rules:W,include_shipping_cost:Z}:void 0,callback:_e=>{try{if(_e.status===fe.QUOTA_EXPIRED){o?.();return}}catch(Pe){console.error("Error in push callback:",Pe)}}}),N(!1),ve()}},lt=(_e,Pe)=>{_e==="is_publish"?C("is_publish",Pe):_e==="allow_sell_out_of_stock"?C("allow_sell_out_of_stock",Pe):_e==="set_product_as_taxable"?j("taxable",Pe):_e==="include_shipping_cost"&&(ne==="auto"?j("include_shipping_cost",Pe):te(Pe))},ue=_e=>d("AI_AUTO_BOOST_PRODUCT_THUMB")?(L(""),!0):(L("AI_AUTO_BOOST_PRODUCT_THUMB"),g("AI_AUTO_BOOST_PRODUCT_THUMB"),!1),ce=e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(AR,{pricingRules:ne==="auto"?_.selling_price.price_rules:W,isSetProductActive:_.product_listings.is_publish,isAllowSellOutOfStock:_.product_listings.allow_sell_out_of_stock,isSetProductAsTaxable:_.selling_price.taxable,isIncludeShippingCost:ne==="auto"?_.selling_price.include_shipping_cost:Z,onChangeSetting:lt,onChangePricingRules:F,pricingMode:ne,onChangePricingMode:I}),K&&e.jsx(nt,{padding:"0",children:e.jsx(Aa,{featureKey:K,hideDismiss:!0,typeView:"card",tracking:{positionKey:hs.catelog_push_product}})}),e.jsxs(Q,{padding:"500",background:"bg-surface",borderRadius:"300",shadow:"100",children:[e.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[e.jsx(m,{as:"p",variant:"bodyMd",children:"Set content"}),e.jsx(di,{selected:B,onChange:_e=>{G(_e),_e==="original"&&setTimeout(()=>{A()},300)},options:[{label:l("KeepOriginal"),value:"original"},{label:l("AIEnhance"),value:"custom"}]})]}),e.jsx(Qe,{id:"set-content",open:B==="custom",transition:{duration:"300ms",timingFunction:"ease-in-out"},children:e.jsx(vR,{prefix:{...Es.auto_boost.prefix,...z.prefix},suffix:{...Es.auto_boost.suffix,...z.suffix},onChangePrefix:_e=>S("prefix",_e),onChangeSuffix:_e=>S("suffix",_e),hasPermissionThumbnail:K!=="AI_AUTO_BOOST_PRODUCT_THUMB",aiTitle:{...Es.auto_boost.title,...z.title},aiDescription:{...Es.auto_boost.description,...z.description},aiImage:z.image,onChangeAiTitle:_e=>S("title",_e),onChangeAiDescription:_e=>S("description",_e),onChangeAiImage:_e=>{_e.is_enable&&!ue()||S("image",_e)}})})]})]}),Ae=e.jsx("div",{className:"flex shrink-0 gap-3 items-center bg-white p-4 justify-end",children:e.jsx(re,{icon:O?yl:void 0,variant:"primary",size:"large",onClick:Ge,loading:w||ot,children:l(O?"Repush":"PushToStore")})});return c?e.jsx(e.Fragment,{children:e.jsx(xt,{visible:R,onClose:ve,showCloseIcon:!0,isButtonFullWidth:!0,title:l("PushSettings"),zIndex:r,primaryAction:{content:l(O?"Repush":"PushToStore"),onAction:Ge,loading:w||ot,size:"large"},secondaryAction:{content:l("ResetToDefault"),onAction:pe,size:"large"},children:e.jsx("div",{className:"p-4 bg-bg",children:ce})})}):e.jsx(Is,{width:"528px",onClose:ve,visible:R,contentStyle:{backgroundColor:"var(--color-bg)"},zIndex:r,children:e.jsxs("div",{className:"flex min-h-0 h-full flex-col",children:[e.jsx("div",{className:"sticky top-0 z-10 shrink-0 bg-bg px-4 [&_.Polaris-Page>.Polaris-Box]:pt-4 [&_.Polaris-Page>.Polaris-Box]:pb-0",children:e.jsx(us,{title:l("PushSettings"),backAction:{onAction:ve},secondaryActions:[{content:l("ResetToDefault"),onAction:pe}]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:ce}),Ae]})})});u0.displayName="PushSettingAction";const SR=i.forwardRef(({slides:t},s)=>{const[n,a]=i.useState();return i.useImperativeHandle(s,()=>({scrollToImage:r=>{if(!n||!r)return;const o=t.findIndex(l=>l===r);o<0||n.scrollTo(o)}}),[n,t]),t.length===0?null:e.jsx(es,{setApi:a,children:e.jsx(es.Content,{children:t.map((r,o)=>e.jsx(es.Item,{className:"basis-[86%] rounded-[18px] overflow-hidden",children:e.jsx(pn,{source:r,isSize:!1,alt:""})},o))})})}),jR=()=>{const{isMobile:t}=xe();return e.jsxs(ft,{columns:t?void 0:"minmax(0,1fr) 404px",gap:"600",children:[e.jsxs(D,{gap:"600",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"shrink-0 relative overflow-hidden",style:{width:"65px"},children:e.jsxs("div",{className:"flex flex-col gap-3 absolute top-0 left-0",children:[e.jsx(Se,{height:"65px",width:"65px"}),e.jsx(Se,{height:"65px",width:"65px"}),e.jsx(Se,{height:"65px",width:"65px"}),e.jsx(Se,{height:"65px",width:"65px"}),e.jsx(Se,{height:"65px",width:"65px"}),e.jsx(Se,{height:"65px",width:"65px"}),e.jsx(Se,{height:"65px",width:"65px"}),e.jsx(Se,{height:"65px",width:"65px"})]})}),e.jsx("div",{className:"min-w-0 grow",children:e.jsx("div",{className:"aspect-square",children:e.jsx(Se,{height:"100%",width:"100%",className:"size-full"})})})]}),e.jsx(Se,{height:124}),e.jsx(Se,{height:124}),e.jsx(Se,{height:289})]}),e.jsx("div",{children:e.jsx("div",{className:"sticky",style:{to
2871p:92,maxHeight:`calc(100vh - ${Ce.isShopifyEmbedded()?108:164}px)`},children:e.jsx(nt,{children:e.jsx("div",{className:"overflow-hidden h-full min-h-0",children:e.jsxs(D,{gap:"400",children:[e.jsx(Se,{height:24}),e.jsx(Se,{height:14}),e.jsx(Se,{height:126}),e.jsx(Se,{height:72}),e.jsx(Se,{height:92})]})})})})})]})},ER=({onClose:t})=>e.jsxs("div",{className:"bg-black h-full",children:[e.jsx(r0,{onClose:t,productDetail:null}),e.jsxs("div",{className:"bg-[#FAFAFA] rounded-t-3xl flex-1 overflow-hidden px-5 pt-4",children:[e.jsx("div",{className:"w-full overflow-hidden",children:e.jsx(Se,{className:"aspect-square w-full"})}),e.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[e.jsx(Se,{height:16,width:"30%"}),e.jsx(Se,{height:16}),e.jsx(Se,{height:20,width:"50%"}),e.jsx(Se,{height:54}),e.jsx(nt,{roundedAbove:"xs",children:e.jsx(Se,{height:212})})]})]})]});se.div` 2872 position: sticky; 2873 top: 0; 2874 z-index: 100; 2875`;const TR=()=>{const{t}=J(),{open:s,setOpen:n,currentProduct:a,setCurrentProduct:r,products:o,currentIndex:l,setCurrentIndex:c,zIndex:u=171,disableButtons:d,event:g,featureOutQuota:h,setFeatureOutQuota:p,selectedVariants:x,setSelectedVariants:f,callbacks:_,productDetailShipTo:b,setProductDetailShipTo:v}=A5(),y=ke(Il),{isMobile:C}=xe(),S=i.useRef(!0),j=i.useRef(null),A=i.useRef(null),[E,T]=i.useState(!1);he(uh);const{onClose:k,onProductChange:O}=_,R=a?.initShipTo??y,{data:P,isPending:w}=C5({source_product_id:a?.source_product_id||"",source:a?.source||"aliexpress",shipTo:R}),N=i.useMemo(()=>P?RR(P,a?.sku_id):null,[P,a?.sku_id]),K=i.useMemo(()=>{const B=N?.images??[],ie=N?.options?.flatMap(I=>I.values?.map(F=>F.image).filter(Boolean)??[])??[],V=[],M=new Set;return[...B,...ie].forEach(I=>{!I||M.has(I)||(M.add(I),V.push(I))}),V},[N?.images,N?.options]),L=i.useRef(null),W=i.useRef(null),H=()=>{L.current&&L.current.scrollTo({top:0,behavior:"smooth"})},Z=()=>{l<o.length-1&&requestAnimationFrame(()=>{const B=l+1,ie=o[B];r(ie),c(B),O?.(ie,B),H()})},te=()=>{l>0&&requestAnimationFrame(()=>{const B=l-1,ie=o[B];r(ie),c(B),O?.(ie,B),H()})},ne=()=>{H(),p(["LISTING_PRODUCTS"])};i.useEffect(()=>{if(N&&s&&a?.source_product_id){if(PR(a)){const B={source_product_id:a.source_product_id,source:a.source,sku_id:a.sku_id,tags:a.tags,name:N.name||"",images:N.images||[],price_range:N.price_range||0,rsp_price_usd:N?.rsp_price_usd||0,profit:0,total_variants:N.variants?.length||0,source_category_ids:[],source_product_link:"",reviews_count:0,rating:0,supplier_id:"",supplier_name:"",price:0,shipping_cost:0,shipping_time_min:0,shipping_time_max:0,created_at:"",updated_at:"",lastest_volume:0,most_relevant:0,source_category_name:"",collection_path:[],_score:0};r(B)}S.current&&g&&(Ke.trackingEventUsersAction({...g,event_data:{...g.event_data,find_product_total_results:1}}),S.current=!1)}},[N,s,a?.source_product_id,g]),i.useEffect(()=>{s?Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_PRODUCT_VIEWED,event_data:{product_id:a?.source_product_id||"",source:a?.source||"",ship_to:a?.initShipTo||""}}):(S.current=!0,W.current?.close())},[s]),i.useEffect(()=>{s&&(a?.initShipTo?v(a.initShipTo):v(y))},[s,y,a?.initShipTo]);const le=()=>w?e.jsx(jR,{}):!w&&!q.size(N)?e.jsx(nt,{padding:"400",children:e.jsx(zu,{})}):e.jsxs(D,{gap:"400",children:[e.jsx(Aa,{featureKey:h[0]||"",onClose:()=>p([]),tracking:{positionKey:hs.catelog_product_detail}}),e.jsxs(ft,{columns:C?void 0:"minmax(0,1fr) 404px",gap:"600",children:[e.jsxs(D,{gap:"600",children:[e.jsx(mR,{ref:j,slides:K}),e.jsx(oR,{productDetail:N}),e.jsx(Z5,{name:N?.name||"",productDetail:N,loadingDetail:w}),e.jsx(dR,{description:N?.description,itemSpecifics:N?.item_specifics}),e.jsx("div",{className:"h-5"})]}),e.jsx("div",{children:e.jsx("div",{className:"sticky [&>div]:h-full min-h-0 flex flex-col [&>div]:flex [&>div]:min-h-0 [&>div]:flex-col [&>div>div]:flex [&>div>div]:min-h-0 [&>div>div]:flex-col",style:{top:16,maxHeight:`calc(100vh - ${Ce.isShopifyEmbedded()?108:164}px)`},children:e.jsx(Q,{background:"bg-surface",borderRadius:"300",padding:"400",children:e.jsx("div",{className:"overflow-y-auto overflow-x-hidden h-full min-h-0",children:e.jsxs(D,{gap:"500",children:[e.jsx(E5,{productDetail:N,selectedVariants:x}
2875),e.jsx(X5,{zIndexPopover:u===550?551:void 0,productDetail:N,selectedVariants:x,onVariantChange:f,onOptionImageClick:B=>j.current?.scrollToImage(B)}),e.jsx(T5,{productDetail:N}),e.jsx(qu,{name:N?.name||"",shipTo:b,shipFrom:N?.ship_from||[],item_specifics:N?.item_specifics,loadingDetail:w}),e.jsx("div",{className:"sticky bottom-0 bg-white pt-4 -mt-4",children:e.jsx(Ku,{hiddenPushButton:u===510,disableButtons:d,loadingVariant:N?.status==="partial",shipTo:b,productDetail:N,onOutQuota:ne,selectedVariants:x,onCallbackConnectStore:k||(()=>n(!1))})})]})})})})})]}),e.jsx(u0,{ref:W,productDetail:N,shipTo:b,onOutQuota:ne,drawerZIndex:u+1})]});return C?w?e.jsx(xt,{zIndex:u,placement:"right",visible:s,onClose:k||(()=>n(!1)),children:e.jsx(ER,{onClose:k||(()=>n(!1))})}):!w&&!q.size(N)?e.jsx(xt,{zIndex:u,placement:"right",visible:s,title:t("ProductDetail"),onClose:k||(()=>n(!1)),children:e.jsx(zu,{})}):e.jsx(e.Fragment,{children:e.jsx(xt,{zIndex:u,placement:"right",visible:s,onClose:k||(()=>n(!1)),footer:e.jsx(Ku,{disableButtons:d,isMobile:C,loadingVariant:N?.status==="partial",shipTo:b,productDetail:N,onOutQuota:ne,selectedVariants:x,onCallbackConnectStore:k||(()=>n(!1))}),children:e.jsxs("div",{className:"bg-black min-h-screen",children:[e.jsx(r0,{onClose:k||(()=>n(!1)),productDetail:N}),e.jsxs("div",{className:"bg-[#FAFAFA] rounded-t-3xl flex-1 overflow-hidden px-5 pt-4",children:[e.jsx("div",{className:"w-full overflow-hidden",children:e.jsx(SR,{ref:A,slides:K})}),e.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[e.jsx(tR,{productDetail:N,selectedVariants:x}),e.jsx(nR,{productDetail:N,selectedVariants:x,onVariantChange:f,onOptionImageClick:B=>A.current?.scrollToImage(B)}),e.jsx(sR,{productDetail:N}),e.jsx(qu,{name:N?.name||"",shipTo:b,shipFrom:N?.ship_from||[],item_specifics:N?.item_specifics,loadingDetail:w}),e.jsx(uR,{productDetail:N}),e.jsx(lR,{name:N?.name||"",item_specifics:N?.item_specifics,loadingDetail:w}),e.jsx(hR,{loading:w,productDetail:N})]}),e.jsx("div",{className:"h-[65px]"})]})]})})}):e.jsx(Is,{width:1040,zIndex:u,visible:s,onClose:k||(()=>n(!1)),children:e.jsx("div",{ref:L,style:{position:"relative",height:"100%",overflowY:"auto",scrollbarGutter:"stable"},children:e.jsxs(D,{gap:"400",children:[e.jsx(Q,{paddingInline:"400",children:e.jsx(us,{backAction:{content:t("Products"),onAction:k||(()=>n(!1))},title:t("ProductDetail"),secondaryActions:[{content:t("PushSetting"),disabled:!N,onAction:()=>W.current?.toggle()}],pagination:{nextKeys:[75],nextTooltip:"Next [K]",previousKeys:[74],previousTooltip:"Previous [J]",hasPrevious:!w&&l>0,hasNext:!w&&l<o.length-1,onPrevious:te,onNext:Z}})}),e.jsx(Q,{paddingInline:"400",children:le()})]})})})},PR=t=>t&&t._needsFetchDetail===!0,IR=t=>{const s=q.cloneDeep(t);return s.options?.length>0&&(s.variants=s.variants.map(n=>{const a={...n},r=a.sku_property.map(o=>o.sku_property_name+(o.property_value_definition_name?o.property_value_definition_name:o.sku_property_value));return a.code=$0(r.join("").replaceAll(" ","")),a})),s},RR=(t,s)=>{let n=q.cloneDeep(t);n.currency="USD";const a=n.options.map(o=>{const l={...o},c=[];return q.isArray(l.values)||(Object.keys(l.values).forEach(u=>{c.push(l.values[u])}),l.values=c),l});n.options=a,n.description=t.description.replaceAll("<p><br/></p>",""),n.lastest_volume=t.lastest_volume||0;const r=n?.options.find(o=>o.name==="Ships From");return r?n={...n,shipFroms:r.values?.length&&r.values?.filter(o=>o.countryCode)?.length?r?.values?.map(o=>o.countryCode):["CN"]}:n.shipFroms=["CN"],q.size(n)>0&&(n=IR(n)),s&&(n.sku_id=s),n},Ju={id:100776029,date:"2024-04-07"},kR=()=>{const{t}=J(),[s,n]=i.useState(!1),{getUserInfo:a}=de(),r=a(),[o,l]=be(Ai),c=he(rl),[u,d]=i.useState(o),g=ge.localStorage.get(st.SHOW_MODAL_LANGUAGE)||"{}",h=async f=>{const{status:_}=await Tn.setLanguageAccount(f);Xt.OK},p=async f=>{ge.localStorage.set(st.LANGUAGE,f.language),l(f.language),x(),await il(f.language),h(f.language);const _=ol();c(_),n(!1)};i.useEffect(()=>{o&&d(o)},[o]);const x=()=>{n(!1);try{const f=JSON.parse(g);r&&r?.id&&(f[r.id]=r.id,ge.localStorage.set(st.SHOW_MODAL_LANGUAGE,JSON.stringify(f)))}catch{}};return i.useEffect(()=>{if(r&&r?.id&&r.id>Ju.id&&it().isAfter(Ju.date)&&!Ce.isShopifyEmbedded()){const f=JSON.parse(g);(!q.size(f)||q.size(f)&&!f[r.id])&&n(!1)}},[r]),e.jsx(Xe,{open:s,size:"small",title:t("ChooseYourLanguage"),onClose:x,primaryAction:{content:t("Save"),onAction:()=>p({language:u})},secondaryActions:[{content:t("Cancel"),onAction:x}],sectioned:!0,children:e.jsx(D,{children:e.jsx(Cn,{label:t("Language"),value:u,options:ni.map(f=>({label:f.name,value:f.language})),onChange:f=>d(f)})})})},wR=ae({key:"visibleModalUpgradeCashbackState",default:!1}),NR=()=>{const{t}=J(),[s,n]=i.useState(!0),{getCurrentPlan:a}
2875=de(),r=bt(),{isMobile:o}=xe(),[l,c]=be(wR),{packages:u}=Ks(),{getCurrentCyclePlan:d,getCurrentStoreCharge:g,getCurrentFulfillmentPlan:h,findPlanByKey:p}=zt(),x=h("AO"),f=d("AO"),[_,b]=i.useState(""),[v,y]=i.useState(!1),[C,S]=i.useState({}),j=a();let A;Ce.isShopifyEmbedded()&&(A=Wn());const E=i.useMemo(()=>f!==30,[f]),T=i.useMemo(()=>{const P=x?.price;return(P?u.filter(N=>N.price>P):u).map(N=>{const K=p(q.words(N.key,/[^,_]+/g)?.[0]);return K?{...N,...K}:{...N}})},[u,p,x?.price]),k=i.useCallback(()=>c(!1),[]),O=async P=>{try{b("processing");const{status:w,data:N,message:K}=await ls.chargeSubscription({params:P});if(w===fe.OK&&N?.confirmation_url)b("directing"),ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify({name:C.key,price:(C?.price||0).toFixed(2),start_time:Da()})),k(),b(""),A?A(N?.confirmation_url):window.location.href=N?.confirmation_url;else{if(w===fe.BAD_REQUEST&&at.size(N)&&K==="be_payment_cannot_change_your_subscription"){r.error(t("be_payment_cannot_change_your_subscription",{feature:N?.message_params||""}));return}r.error(t("PaymentFail"))}}catch(w){console.error(w)}},R=P=>{requestAnimationFrame(()=>{let w=g()?.store_id;const N=C.id;if(P&&(w=P),!w){c(!1),y(!0);return}O({store_id:w,module_ids:N?[N]:[],provider_payment:j?.provider_payment||"SHOPIFY",is_yearly:E})})};return i.useEffect(()=>{S(T?.[0]||{})},[T]),e.jsxs(e.Fragment,{children:[_?e.jsx(ml,{}):"",o&&e.jsx(zl,{}),e.jsx(yr,{data:{storeCharge:{}},open:v,onConfirm:P=>{y(!1),P&&R(P)},onClose:()=>y(!1),loading:!!_}),e.jsx(Xe,{onClose:k,open:l,title:"Unlock higher cashback tier",sectioned:!0,primaryAction:{content:t("Confirm"),onAction:()=>R(),loading:!!_},secondaryActions:[{content:t("Cancel"),onAction:k,disabled:!!_}],children:e.jsxs(D,{gap:"400",children:[e.jsx(Qe,{id:"cashback-banner",transition:{duration:"400ms",timingFunction:"ease-in-out"},open:s,children:e.jsx(kt,{onDismiss:()=>n(!1),tone:"warning",children:"Only applicable when fulfilling orders with Zopi Supplier."})}),T.map(P=>{const w=P.id===C?.id;let N="border";return w&&(N="input-border-active"),e.jsx(DR,{onClick:()=>requestAnimationFrame(()=>{S(P)}),children:e.jsxs(Q,{borderRadius:"300",padding:"400",borderWidth:"025",borderColor:N,children:[e.jsxs(U,{align:"space-between",children:[e.jsxs(U,{blockAlign:"center",gap:"200",children:[e.jsx(hl,{label:"",labelHidden:!0,checked:w,name:"accounts"}),e.jsx(m,{variant:"bodyMd",as:"span",children:P.name})]}),e.jsxs(D,{gap:"100",align:"center",inlineAlign:"center",children:[e.jsxs(U,{blockAlign:"center",gap:"100",children:[E&&e.jsxs(m,{as:"span",variant:"headingSm",fontWeight:"regular",tone:"subdued",textDecorationLine:"line-through",children:["$",P.price]}),e.jsxs(m,{as:"span",variant:"headingLg",fontWeight:"semibold",children:["$",E?P.eachYearlyPrice:P.price]}),e.jsxs(D,{gap:"0",children:[e.jsx(Q,{minHeight:"5px"}),e.jsxs(m,{as:"p",variant:"bodyXs",tone:"subdued",children:["USD/",q.lowerCase(t("Month"))]})]})]}),e.jsx(Q,{borderRadius:"200",background:"bg-fill-tertiary-active",paddingBlock:"0",paddingInline:"150",children:e.jsxs(m,{as:"span",variant:"bodySm",children:["cashback order"," ",e.jsxs(m,{as:"span",fontWeight:"semibold",variant:"bodySm",children:[(P.order_cashback||0)*100,"%"]})," ","value"]})})]})]}),E&&e.jsx(OR,{children:e.jsx(Bs,{tone:"info",children:t("Yearly")})})]})},`plan-${P.key}=${P.id}`)})]})})]})},OR=se.div` 2876 position: absolute; 2877 top: -10px; 2878 right: 5px; 2879`;se.div` 2880 & .Polaris-Badge { 2881 background: linear-gradient( 2882 88deg, 2883 rgb(46, 66, 120) 1.73%, 2884 rgb(155, 144, 233) 25.2%, 2885 rgb(128, 159, 237) 46.89%, 2886 rgb(147, 125, 240) 60.27% 2887 ); 2888 .Polaris-Text--root { 2889 color: var(--p-color-bg-surface-caution-active); 2890 } 2891 } 2892`;const DR=se.div` 2893 cursor: pointer; 2894 & .Polaris-Box { 2895 position: relative; 2896 } 2897`,LR=i.memo(NR),$u="user.logout",MR=()=>{const t=de();return i.useEffect(()=>{const s=window.accountPusher;return s.bind($u,n=>{n.data.success&&t.signout()}),()=>{s&&s.unbind($u)}},[]),null},UR=()=>{const[t,s]=i.useState(!1),n=i.useRef({countInterval:0});return i.useEffect(()=>{const a=setInterval(()=>{window.accountPusher&&(s(!0),clearInterval(a)),n.current.countInterval>30&&clearInterval(a),n.current.countInterval+=1},500)},[]),t?e.jsx(e.Fragment,{children:e.jsx(MR,{})}):e.jsx(e.Fragment,{})},FR=ae({key:"visibleModalModalAIEnhanceRateLimitState",default:!1}),BR=()=>{const{t}=J(),[s,n]=be(FR);return e.jsx(Xe,{size:"small",title:t("ModalRateLimitAIEnhanceTitle"),open:s,onClose:()=>n(!1),children:e.jsx(Xe.Section,{children:e.jsxs(U,{wrap:!1,gap:"200",children:[e.jsx("div",{children:e.jsx(ee,{source:Op})}),e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"p",variant:"bodyMd",children:t("ModalRateLimitAIEnhanceContent")}),e.jsx(m,{as:"p",variant:"bodyMd",children:t("ModalRateLimitAIEnhanceContent1")})]})]})})})},HR=t=>{const{t:s}=J(),n=dt(),{getCurrentPlan:a}
2897=de(),r=bt(),o=Wn(),[l,c]=be(gp),[u,d]=be(Gn),[g,h]=i.useState(!1),p=a(),x=i.useRef(null),f=async()=>{const v=n.getShop().id;if(v){if(h(!0),(await pp.deleteUnlinkStore({store_id:v})).status===fe.OK){r.success(s("Successfully")),ge.removeToken();const C=Si(ge.shopStorage.getShop().platform_domain||eg().replace("https://","")||ge.shopStorage.getShopNameInEmbedded());o&&C?setTimeout(()=>{o(Ts.shopify.admin_app.replace(/{{domain}}/,C))},1e3):window.location.reload()}h(!1)}},_=()=>{p.provider_payment==="PADDLE_BILLING"?window.open(`${location.origin}/app?show-change-plan=true`):d(!0)},b=()=>l.storeData?l.storeData.ownerEmail.replace(/(.{2})(.*)(?=@)/,"$1***"):"";return i.useEffect(()=>{if(x.current){const v=x.current.parentElement?.previousSibling;if(v){const y=v.querySelector(".Polaris-Button");y&&(y.style.display="none")}}},[u,l.open]),e.jsxs(Xe,{title:s("ThisStoreIsCurrentlyLinkedToAnAccount"),open:u?!1:l.open,onClose:()=>{},secondaryActions:[{content:s("CreateAsNewStore"),loading:g,onAction:f}],primaryAction:{content:s("ReviewUpdatePlan"),disabled:g,onAction:_},children:[e.jsx("div",{ref:x}),l.storeData&&e.jsxs("div",{className:"p-4 grid gap-4",children:[e.jsx(m,{as:"p",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s("YoureTryingToAccessAStoreLinkedToAccount",{store:l.storeData.storeDomain?`<strong>${l.storeData.storeDomain}</strong>`:"",email:b()})}})}),e.jsxs("div",{children:[e.jsx(m,{as:"p",children:s("ToContinueYouCan")}),e.jsxs("ul",{className:"pl-5",children:[e.jsx("li",{className:"list-decimal",children:e.jsx(m,{as:"p",children:s("ReviewUpdateThePaymentPlanOnTheLinkedAccount")})}),e.jsx("li",{className:"list-decimal",children:e.jsxs(m,{as:"p",children:[" ",s("SetThisStoreAsANewAccountThisWillRemoveAllDataSettingsAndSynchronizationsFromTheLinkedAccountForThisStore")]})})]})]})]})]})},GR="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.42267%204.60352C9.42274%204.60777%209.42528%204.61285%209.42462%204.61914L8.8299%209.43164L8.74689%2010.1055H12.3729L7.12384%2016.3926C7.12263%2016.394%207.12095%2016.3954%207.11993%2016.3965C7.11698%2016.3952%207.11488%2016.3935%207.1131%2016.3926L7.72443%2012.1289L7.82306%2011.4443H4.68927L9.40314%204.61426C9.40733%204.60839%209.41124%204.60452%209.41388%204.60156C9.41625%204.60207%209.4192%204.60253%209.42267%204.60352Z'%20stroke='%235546FF'%20stroke-width='1.2'/%3e%3cpath%20d='M11.7388%208.11301C13.7157%208.11301%2014.5773%207.28132%2014.5773%205.27448C14.5773%207.28132%2015.433%208.11301%2017.4158%208.11301C15.433%208.11301%2014.5773%208.96867%2014.5773%2010.9515C14.5773%208.96867%2013.7157%208.11301%2011.7388%208.11301Z'%20fill='%235546FF'%20stroke='%235546FF'%20stroke-width='0.473089'%20stroke-linejoin='round'/%3e%3cpath%20d='M2%2012.7747C2.88398%2012.7747%203.26927%2012.4028%203.26927%2011.5055C3.26927%2012.4028%203.65189%2012.7747%204.53854%2012.7747C3.65189%2012.7747%203.26927%2013.1573%203.26927%2014.044C3.26927%2013.1573%202.88398%2012.7747%202%2012.7747Z'%20fill='%235546FF'%20stroke='%235546FF'%20stroke-width='0.346165'%20stroke-linejoin='round'/%3e%3c/svg%3e",p0=i.createContext(null),WN=()=>{const t=i.useContext(p0);if(!t)throw new Error("useBulkActionContext must be used within BlockActionWrapper");return t};var Zn=(t=>(t.ADD_PRODUCT="add-product-block",t.TOAST_SWITCH_APP="toast-switch-app-block",t.MANAGE_PRODUCT="manage-product-block",t.PLACE_ORDER="place-order-block",t.TRACKED_PRODUCTS="tracked-products-block",t.TRACKED_SELLERS="tracked-sellers-block",t))(Zn||{});const WR=({bulkActionComponent:t,showBulkAction:s,children:n,padding:a="400",blockId:r,toastPushProductComponent:o})=>{const{isMobile:l}=xe(),c=i.useRef(null),u=i.useRef(null),d=i.useRef(!1),[g,h]=i.useState(null),[p,x]=i.useState(!1),f=!!(l&&s),_=!!(s&&!p);return i.useEffect(()=>{if(!f){d.current=!1,x(!1);return}const b=()=>{d.current||(d.current=!0,x(!0)),u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{d.current=!1,x(!1),u.current=null},150)};return window.addEventListener("scroll",b,{passive:!0}),()=>{window.removeEventListener("scroll",b),u.current&&(window.clearTimeout(u.current),u.current=null),d.current=!1}},[f]),e.jsxs("div",{children:[l?e.jsx("div",{id:s?r:void 0,children:n}):e.jsx("div",{id:s?r:void 0,className:"grow min-w-0",children:e.jsx(nt,{padding:a,roun
2897dedAbove:"xs",children:n})}),e.jsxs(p0.Provider,{value:{bulkActionRef:c,activePopoverId:g,setActivePopoverId:h,shouldRenderBulkAction:_},children:[e.jsx("div",{ref:c,className:oe("fixed top-[unset] h-fit z-11 ",_?"animate-slide-up":"invisible pointer-events-none",!l&&"-translate-x-1/2",l?"bottom-4":"bottom-8"),style:{...l?{left:16,right:16}:{left:Ce.isShopifyEmbedded()?"50%":"calc(50% + 120px)"}},children:e.jsx("div",{className:"bg-white p-2 rounded-[30px] border border-border-secondary shadow-[0_6px_25px_rgba(0,0,0,0.25)] flex items-center gap-4 md:w-max",children:e.jsx("div",{className:"flex-1",children:t})})}),o]})]})},VR=()=>{const{t}=J(),{isMobile:s}=xe(),n=dn.map(p=>p.urls).flat(),a=pt(),r=zs(),[o,l]=i.useState(!1),[c,u]=i.useState(!0),d=Ce.isShopifyEmbedded()||!s||!n.find(p=>r.pathname===p);i.useEffect(()=>{if(d){u(!1);return}const p=[Zn.ADD_PRODUCT,Zn.MANAGE_PRODUCT,Zn.PLACE_ORDER,Zn.TRACKED_PRODUCTS,Zn.TRACKED_SELLERS],x=new Set(p.filter(b=>!!document.getElementById(b)));u(x.size===0);const f=b=>{p.forEach(v=>{(b.id===v||b.querySelector?.(`#${v}`))&&x.add(v)})},_=new MutationObserver(b=>{b.forEach(v=>{if(v.type==="attributes"){f(v.target);return}v.addedNodes.forEach(y=>f(y)),v.removedNodes.length>0&&p.forEach(y=>{document.getElementById(y)||x.delete(y)})}),u(x.size===0)});return _.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id"]}),()=>_.disconnect()},[d]);const g=dn.find(p=>p.key==="PH")?.urls.some(p=>r.pathname.startsWith(p))??!1,h=[{id:1,title:t("ConnectYourPreferredChatAppBelow")},{id:2,title:t("OpenTheZopiBotInYourChatApp")},{id:3,title:t("YourAgentHandlesTheRestAutomatically")}];return d?e.jsx(e.Fragment,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-3",children:e.jsx(WR,{blockId:Zn.TOAST_SWITCH_APP,bulkActionComponent:e.jsxs("div",{className:"flex px-2 items-center gap-4 relative group/bulk before:absolute before:inset-[-12px] before:z-1 [&>*]:z-9",children:[dn.map(p=>{const x=g?p.key==="PH":p.key==="AO";return e.jsxs("div",{onClick:()=>a(p.urls[0]),className:oe("flex-1 flex items-center justify-center gap-1.5 px-1 py-2 rounded-xl cursor-pointer",x?"bg-[#f3f3f3]":""),children:[e.jsx(Q,{children:e.jsx(ee,{source:p.icon})}),e.jsx(m,{as:"span",variant:"bodySm",fontWeight:"medium",tone:x?void 0:"subdued",children:t(p.labelShort)})]},p.key)}),e.jsx("div",{className:"flex h-[45px] items-center justify-center w-7 rounded-lg cursor-pointer shrink-0",onClick:()=>l(!0),children:e.jsx("img",{src:GR,alt:"",className:"w-5 h-5"})})]}),showBulkAction:c})}),e.jsx(xt,{visible:o,onClose:()=>l(!1),children:e.jsx("div",{className:"px-4 py-8",children:e.jsx("div",{className:"bg-bg-surface",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsxs("div",{className:"text-center grid gap-3",children:[e.jsx(m,{as:"p",variant:"headingLg",fontWeight:"semibold",children:t("AIAssistant")}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:t("ConnectAChatAppAndYourAIAgentWillSendYouAlertsUpdatesAndActionsNoNeedToOpenZopi")})]}),e.jsxs("div",{className:"p-4 border border-border bg-bg-surface-secondary rounded-xl grid gap-4",children:[e.jsx(m,{as:"p",variant:"headingSm",tone:"subdued",children:t("HowItWorks")}),h.map(p=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-white bg-black rounded-full font-medium",children:p.id}),e.jsx(m,{as:"p",variant:"bodyMd",tone:"subdued",children:p.title})]},p.id))]}),e.jsxs("div",{children:[e.jsx("div",{className:"pl-1",children:e.jsx(m,{as:"p",variant:"headingMd",tone:"subdued",children:t("ChooseYourChatApp")})}),e.jsx(Eh,{listClassName:"grid gap-4 mt-4"})]})]})})})})]})},YR=i.memo(VR),$l={GET_PRODUCT_OB_ALL:"/center/products/ob-suggestion",GET_PRODUCT_OB_TRENDING:"/center/products/ob-suggestion/trending",GET_PRODUCT_OB_RECOMMEND:"/center/products/ob-suggestion/recommend"},zR=async t=>X($l.GET_PRODUCT_OB_ALL,{},{method:"GET"},{cancelToken:t}),KR=async t=>X($l.GET_PRODUCT_OB_TRENDING,{},{method:"GET"},{cancelToken:t}),QR=async t=>X($l.GET_PRODUCT_OB_RECOMMEND,{},{method:"GET"},{cancelToken:t}),qR={getProductObAll:zR,getProductObTrending:KR,getProductRecommend:QR}
2897,ZR=ae({key:"onboardingBackgroundState",default:{products:{all:{loading:!0,data:[]},trendy:{loading:!0,data:[]},recommend:{loading:!0,data:[]}},tab_name:"all",action:null,init_fetch:!1}});window.import_onboarding_data={all:null,trendy:null,recommend:null};const XR=()=>{const t=dt(),{importMultiProduct:s}=qh(),n=ke(TI),{setDataImportProcess:a}=wi(),[r,o]=be(ZR),l=he(n5),c=({channels:p,total:x,source:f})=>{Ke.trackingEventUsersAction({event_name:$.PRODUCT_CENTER_PUSH_TO_STORE_COMPLETED,event_data:{product_center_push_to_store_position:"onboarding",channel_list:q.join(p,","),value:x,source:f}})},u=p=>new Promise(x=>{let f=3e5;const _=setInterval(()=>{const b=window.import_onboarding_data[p];b&&(clearInterval(_),x(b)),f--,f<=0&&(clearInterval(_),x(null))},500)}),d=async()=>{const p=await u(r.tab_name);if(!p||!p.length)return;const x=p.map(_=>({product_id:_.source_product_id,ship_to:"US",source:_.source,productName:_.title,image:_.image})),{status:f}=await s(x,{positionImport:"onboarding"});f===fe.OK&&Ke.trackingEventUsersAction({event_name:$.PRODUCT_CATALOG_IMPORT_ALL_COMPLETED,event_data:{find_product_add_to_import_list_position:"",collection_name:"",value:x.length,source:q.join(q.uniq(x.map(_=>_.source).filter(Boolean)),","),data:x.map(_=>({product_id:_.product_id,position:"onboarding"}))}})},g=async()=>{try{const p=await u(r.tab_name);if(!p||!p.length)return;const x=t.getListChannels(),_={settings:Object.keys(Za).reduce((y,C)=>{if(x?.[C]?.[0]){let S=[];C==="shopify"&&(S=t.getShopifyChannel(!0).map(j=>({id:j.id,handle:j.handle}))),y[C]={...n[C],allow_sell_out_of_stock:!0,is_publish:!0,...C==="shopify"&&S.length>0&&{publications:S}}}return y},{}),products:p?.map(y=>({product_id:y.source_product_id,source:y.source,ship_to:"US"}))},{status:b,data:v}=await Xs.postPushMultiSourceProduct(_,null);if(c({total:_.products?.length||0,channels:Object.keys(_.settings),source:q.join(q.uniq(_.products?.map(y=>y.source).filter(Boolean)),",")}),b===Xt.OK){const y=p.filter(C=>!v?.failed?.[C.source_product_id]).map(C=>({id:C.source_product_id+"",product_package_id:null,error:"",image:C.image,title:C.title,status:"processing"}));a(y,"update",_.settings),setTimeout(()=>{q.size(v?.failed)&&Object.keys(v?.failed||{}).forEach(C=>{l([{source_product_id:C,error:v?.failed[C]}])})},300)}}catch(p){console.error(p)}finally{}},h=i.useCallback(async p=>{if(!q.size(r.products[p].data))try{const f={all:"getProductObAll",trendy:"getProductObTrending",recommend:"getProductRecommend"}[p],{status:_,data:b}=await qR[f](null);if(_===Xt.OK){let v=[];switch(p){case"all":v=[...b?.trending||[],...b?.recommend||[]];break;case"trendy":v=b?.trending||[];break;case"recommend":v=b?.recommend||[];break;default:v=[]}window.import_onboarding_data[p]=v,o(y=>({...y,products:{...y.products,[p]:{loading:!1,data:v}}}))}}catch(x){console.error("Error fetching products:",x),o(f=>({...f,products:{...f.products,[p]:{loading:!1,data:[]}}}))}},[r.products]);return i.useEffect(()=>{r.init_fetch&&(h("all"),h("trendy"),h("recommend"))},[r.init_fetch]),i.useEffect(()=>{r.action&&(r.action==="push"?g():r.action==="import"&&d())},[r.action]),null},JR="/assets/shopify-logo-Cb_gXPoD.svg",$R="/assets/woocommerce-logo-DgMVcyNW.svg",ek=se.div` 2898 .connect-platform { 2899 &__list { 2900 display: flex; 2901 gap: 20px; 2902 flex-wrap: wrap; 2903 justify-content: center; 2904 } 2905 &__item { 2906 width: 150px; 2907 height: 48px; 2908 position: relative; 2909 border-radius: 6px; 2910 display: flex; 2911 justify-content: center; 2912 align-items: center; 2913 cursor: pointer; 2914 border: 1.5px solid var(--p-color-bg-surface); 2915 2916 &.active, 2917 &:hover { 2918 border-color: var(--p-color-bg-fill-success-hover); 2919 } 2920 } 2921 &__item-img { 2922 max-width: 100px; 2923 max-height: 27px; 2924 } 2925 &__item-icon { 2926 position: absolute; 2927 top: 3px; 2928 left: 3px; 2929 } 2930 &__button-wrapper { 2931 display: flex; 2932 justify-content: center; 2933 button { 2934 display: none; 2935 } 2936 } 2937 } 2938 2939 &:not(.modal) { 2940 width: 720px; 2941 background-color: #fff; 2942 display: flex; 2943 flex-direction: column; 2944 justify-content: center; 2945 padding: 40px 80px; 2946 gap: 20px; 2947 box-shadow: 2948 0px 0px 5px rgba(0, 0, 0, 0.05), 2949 0px 1px 2px rgba(0, 0, 0, 0.15); 2950 border-radius: 6px; 2951 .connect-platform { 2952 &__item { 2953 width: inherit; 2954 flex: 1; 2955 } 2956 &__button-wrapper { 2957 button { 2958 display: block; 2959 } 2960 } 2961 } 2962 } 2963`,si=[{icon:JR,id:gi.shopify,hidden:!1,sub_domain:".myshopify.com",content:'Donât have a Shopify account? <a class="text-link" target="_blank" href="https://shopify.pxf.io/MXL3JK">Sign up</>'},{icon:$R,id:gi.woocommerce,hidden:Ce.isShopifyEmbedded()||window.is_hide_billing,sub_domain:"",content:'Donât have a WooCommerce account? <a class="text-link" href="https://woocommerce.com" target="_blank">Sign up</>'}],tk=Oe.forwardRef((t,s)=>{const{t:n}
2963=J(),{className:a="",onChange:r}=t,o=dt(),l=de(),[c,u]=i.useState(si[0]),[d,g]=i.useState(""),[h,p]=i.useState(),[x,f]=i.useState(!1),_=y=>{const C=y.currentTarget.getAttribute("data-platform"),S=si.find(j=>j.id===C)||si[0];u(S)},b=async()=>{if(h||!d||d.length===0)return;let y;c.sub_domain?y=Si(d):y=ll(d),f(!0);const{status:C,data:S}=await l.authInstall({shop:y+c.sub_domain},c.id);C===fe.OK&&S&&S.url&&location.assign(S.url),f(!1)},v=y=>{const C=y.trim();r&&r(C),g(C)};return Oe.useImperativeHandle(s,()=>({onConnect:b})),i.useEffect(()=>{let y;d&&(y=o.getListShop().some(S=>S.platform_domain===d+c.sub_domain)?"StoreAlreadyExistsInThisAccount":""),p(y)},[d]),e.jsx(ek,{className:"connect-platform "+a,children:e.jsxs(D,{gap:"400",children:[e.jsx(m,{variant:"bodyLg",as:"p",children:n("ConnectManageMultipleStoresJustInOneAccount")}),e.jsx("div",{className:"session connect-platform__list",children:si.filter(y=>!y.hidden).map(y=>{const C=y.id===c.id?"active":"";return e.jsxs("div",{className:`connect-platform__item ${C}`,"data-platform":y.id,onClick:_,children:[e.jsx("img",{className:"connect-platform__item-img",src:y.icon}),!!C&&e.jsx("span",{className:"connect-platform__item-icon",children:e.jsx(ee,{source:kp,tone:"success"})})]},y.id)})}),e.jsx("div",{className:"session connect-platform__input-wrapper",children:e.jsx(gt,{label:"",onChange:v,value:d,error:h?n(h):"",autoComplete:"",placeholder:n("YourStoreURLdomain"),suffix:e.jsx("span",{children:c.sub_domain})})}),e.jsx("div",{className:"session connect-platform__button-wrapper",children:e.jsx(re,{variant:"primary",size:"large",loading:x,disabled:!d,onClick:b,children:n("AddStore")})})]})})}),sk=()=>{const{t}=J(),[s,n]=be(tg),a=i.useRef(null),r=()=>{n(!1)},o=()=>{a.current?.onConnect()},l=()=>{};return i.useEffect(()=>{},[s]),e.jsx(e.Fragment,{children:s&&e.jsx(Xe,{title:t("AddNewStore"),open:s,onClose:r,primaryAction:{content:t("AddStore"),onAction:o},secondaryActions:[{content:t("Cancel"),onAction:r}],children:e.jsx(Xe.Section,{children:e.jsx(tk,{isModal:!0,className:"modal",onChange:l,ref:a})})})})},nk=Oe.memo(sk),js=(t,s)=>({yearlyPrice:Number((t*(12-s)).toFixed(1)),eachYearlyPrice:Number((t*(12-s)/12).toFixed(1)),saveYearlyPrice:Number((t*s).toFixed(1))}),VN=[{is_legacy:0,key:"STARTER_CREDIT_3",name:"Starter",price:9.9,yearlyPrice:js(9.9,tt).yearlyPrice,eachYearlyPrice:js(9.9,tt).eachYearlyPrice,saveYearlyPrice:js(9.9,tt).saveYearlyPrice,defaultPay:"monthly",saveMonth:tt,support:{title:"EmailAndLiveChatSupport",content:[]},includes:[{value:30,icon:Or,valuePrefix:"Products",label:"ProductImportedAndMappedToSupplier"},{value:50,icon:is,valuePrefix:"OrdersMonth",label:"OrdersProcessed"},{value:10,icon:is,valuePrefix:"ShipmentsMonth",label:"OrderTracking"}],extraIncludes:{key:"free",includes:[{value:0,icon:Ap,label:"ProductsOrderHistory"},{value:0,icon:Nr,label:"BulkProductEditingListing"},{value:0,icon:Nr,label:"AliExpressProductTracking"}]}},{is_legacy:0,key:"BASIC_CREDIT_2",name:"Basic",price:19.9,yearlyPrice:js(19.9,tt).yearlyPrice,eachYearlyPrice:js(19.9,tt).eachYearlyPrice,saveYearlyPrice:js(19.9,tt).saveYearlyPrice,defaultPay:"monthly",saveMonth:tt,support:{title:"247LiveChatSupport",content:["DedicatedOnboardingSpecialist"]},includes:[{value:150,icon:Or,label:"ProductImportedAndMappedToSupplier",valuePrefix:"Products"},{value:100,icon:is,label:"OrdersProcessed",valuePrefix:"OrdersMonth"},{value:15,icon:is,valuePrefix:"ShipmentsMonth",label:"OrderTracking"}],extraIncludes:{key:"starter",includes:[{value:0,icon:Rp,label:"AIProductDescriptionWriting"},{value:0,icon:pm,label:"AIProductImageFinder"}]}},{is_legacy:0,key:"ADVANCED_CREDIT_2",name:"Advanced",price:49.9,yearlyPrice:js(49.9,tt).yearlyPrice,eachYearlyPrice:js(49.9,tt).eachYearlyPrice,saveYearlyPrice:js(49.9,tt).saveYearlyPrice,defaultPay:"monthly",saveMonth:tt,support:{title:"247LiveChatSupport",content:["DedicatedOnboardingSpecialist","OnDemandDirectSupportViaPhoneCall"]},includes:[{value:500,valuePrefix:"Products",icon:Or,label:"ProductImportedAndMappedToSupplier"},{value:-1,icon:is,label:"OrdersProcessed"},{value:150,icon:is,valuePrefix:"ShipmentsMonth",label:"OrderTracking"}],extraIncludes:{key:"basic",includes:[{value:0,icon:hm,label:"AutoSetPricesB
2963asedOnConditions"},{value:0,icon:Nr,label:"BulkPlacingOrders"},{value:0,icon:Nr,label:"BulkImportingTrackingNumbers"},{value:0,icon:fl,label:"CashbackSupport"}]}},{is_legacy:0,key:"PREMIUM_CREDIT_2",name:"Premium",price:199.9,yearlyPrice:js(199.9,tt).yearlyPrice,eachYearlyPrice:js(199.9,tt).eachYearlyPrice,saveYearlyPrice:js(199.9,tt).saveYearlyPrice,defaultPay:"monthly",saveMonth:tt,support:{title:"247LiveChatSupport",content:["DedicatedOnboardingSpecialist","OnDemandDirectSupportViaPhoneCall"]},includes:[{value:5e4,icon:Or,label:"ProductImportedAndMappedToSupplier",valuePrefix:"Products"},{value:-1,icon:is,label:"OrdersProcessed"},{value:500,icon:is,valuePrefix:"ShipmentsMonth",label:"OrderTracking"}],extraIncludes:{key:"advanced",includes:[{value:0,icon:fo,label:"SmartCompetitivePricing"},{value:0,icon:fo,label:"AutoTrackFulfilledOrders"},{value:0,icon:gm,label:"247LiveChatSupport"},{value:0,icon:bl,label:"DedicatedOnboardingSpecialist"},{value:0,icon:mm,label:"OnDemandDirectSupportViaPhoneCall"}]}}],ak=ae({key:"visibleModalUpgradeFuncIntegrationState",default:!1}),rk=ae({key:"functionKeyUpgradeState",default:"ADD_ON_MARKET_TRACKING"}),ik=ae({key:"listKeyPlanUpgradeState",default:[]}),ok=()=>{const{isMobile:t}=xe(),[s,n]=be(ak),{t:a}=J(),r=bt(),{getPricingPlan:o,getCurrentPlan:l,getUserInfo:c,getKeyPlanModule:u}
2963=de(),d=o(),g=c(),h=l(),p=ke(rk),{isHiddenBillingInMobileApp:x}=$o();let f="";switch(p){case"ADD_ON_MARKET_TRACKING":f="COST_CHANGE_MANAGEMENT";break;case"ADD_ON_AI_WRITING":f="AI_PRODUCT_CONTENT";break;case"ADD_ON_CASHBACK_SETTING":f="ADMIAD_CASHBACK";break;default:f=p;break}if(!f)return e.jsx(e.Fragment,{});const _=ke(ik),[b,v]=i.useState(""),[y,C]=i.useState(!1),[S,j]=i.useState({}),[A,E]=i.useState(!1),T=d.ADD_ON?.find(V=>V.key===p),k=h.package?.modules?.find(V=>V.type==="CREDIT"),O=h.package?.cycle===365;let R;Ce.isShopifyEmbedded()&&(R=Wn());const P={AO_ADD_ON_PRODUCT_DISCOVERY:"UnlockProductInsights",ADD_ON_MARKET_TRACKING:"UnlockAdvanceTracking",ADD_ON_AI_WRITING:"UnlockGenerateProductInfo",ADD_ON_CASHBACK_SETTING:"UnlockCashback"},w={plan:{ADD_ON_MARKET_TRACKING:"NewTrackingQuotaVarQuotaProducts",ADD_ON_AI_WRITING:"UnlimitedAIWritingRequest"},integration:{AO_ADD_ON_PRODUCT_DISCOVERY:"UnlimitedProductInsightViews",ADD_ON_MARKET_TRACKING:"UnlockAdvancedTrackingWithCurrentQuota",ADD_ON_AI_WRITING:"UnlockAIWritingWithCurrentProductQuota"},description:{AO_ADD_ON_PRODUCT_DISCOVERY:"ProductInsightModalIntroContent"}},N=[];d?.CREDIT?.forEach(V=>{const M=V.features?.[f],I=V.key?.replaceAll(new RegExp("_[0-9]","g"),""),F=_.includes(I),G=M?a(w.plan[p],{var_quota:Fe(M).toString()}):"";F&&N.push({id:V.id?.toString(),name:a("Upgrade"),key:V.key,label:V.name+" plan",helpText:G,isYearlyPlan:O,price:O?js(V.price,V.months_discount||5).yearlyPrice:V.price})});const K=d?.ADD_ON?.filter(V=>V.key===p).map(V=>{const M=a(w.integration[p]);return{id:V.id?.toString(),name:a("Integration"),key:V.key,label:a(V.name.split(" ").map(I=>q.upperFirst(I)).join("")),helpText:M,price:V.price}})||[],L=V=>{if(V){if(p==="ADD_ON_AI_WRITING"&&g.is_ab&&mp.includes(u())&&T?.id?.toString()===b)return H(V,"AI_PRODUCT_CONTENT");W(V)}},W=async V=>{try{if(!b||!T)return;E(!0);const M=h.package?.modules||[];T?.id?.toString()!==b&&M.forEach(De=>{De.type==="CREDIT"&&(De.id=parseInt(b))});const I=h.package?.modules.map(De=>De.id)||[],F=h.next_package?.modules.map(De=>De.id),G=h.next_package?.cycle===365;if(!T||!T.id){r.error(a("CannotFindPricingOfThisIntegration"));return}if(I.includes(T.id)||F?.includes(T.id)){r.error(a("ThisIntegrationExistInPlan"));return}T?.id?.toString()===b&&I.push(parseInt(b));const z={store_id:V,is_yearly:O,module_ids:I,provider_payment:h?.provider_payment||"SHOPIFY"};F&&(F.includes(T.id)||F.push(T.id),z.is_yearly=G,z.module_ids=F);const{status:me,data:Re,message:Be}=await ls.chargeSubscription({params:z});if(me===fe.OK&&Re?.confirmation_url){E(!0);let De=0,ot=[];for(const ve in d)ot=ot.concat(d[ve]);ot.forEach(ve=>{z.module_ids?.includes(ve.id)&&(De+=ve.price*(z.is_yearly?7:1))}),ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify({name:T.key,price:De.toFixed(2),start_time:it()})),R?R(Re?.confirmation_url):window.location.href=Re?.confirmation_url}else{if(me===fe.BAD_REQUEST&&at.size(Re)&&Be==="be_payment_cannot_change_your_subscription"){r.error(a("be_payment_cannot_change_your_subscription",{feature:Re?.message_params||""}));return}r.error(a("PaymentFail"))}}catch(M){console.log(M)}finally{E(!1),C(!1)}},H=async(V,M)=>{try{E(!0);const I={store_id:V,feature_id:M,provider_payment:h?.provider_payment||"SHOPIFY"},{status:F,data:G,message:z}=await ls.chargeExtra(I);if(F===fe.OK&&G?.confirmation_url)E(!0),ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].set(st.PAYMENT_INFO,JSON.stringify({name:"Extra",start_time:it()})),R?R(G?.confirmation_url):window.location.href=G?.confirmation_url;else{if(F===fe.BAD_REQUEST&&q.size(G)&&z==="be_payment_cannot_change_your_subscription"){r.error(a("be_payment_cannot_change_your_subscription",{feature:G.message_params}));return}r.error(a("PaymentFail"))}}catch(I){console.log(I)}finally{E(!1),C(!1)}},Z=()=>{n(!1),h.store_id?L(h.store_id):C(!0)},te=()=>{n(!1)},ne=V=>{v(V)},le=()=>{let V=!0;return p==="ADD_ON_MARKET_TRACKING"&&k&&k?.price===0&&(V=!1),V};i.useEffect(()=>{if(s&&d.ADD_ON&&q.size(d.ADD_ON)&&p){const V=d.ADD_ON.find(M=>M.key===p);V&&v(V.id.toString())}},[s,d.ADD_ON,p]);const B=()=>w.description[p]?e.jsx(m,{as:"span",children:a(w.description[p])}):e.jsx(e.Fragment,{}),ie=()=>q.size(N)?e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"headingMd",children:a("UpgradePlan")}),e.jsx(D,{gap:"300",children:N.map((V,M)=>e.jsx(ep,{item:V,value:b,handleChange:ne},"upgrade-plan-"+M))})]}):e.jsx(e.Fragment,{});return x?e.jsx(e.Fragment,{}):e.jsxs(e.Fragment,{children:[t&&e.jsx(zl,{}),e.jsx(Xe,{onClose:te,open:s,title:a(P[p]),sectioned:!0,primaryAction:{content:a("Confirm"),onAction:Z,disabled:!b,loading:A},secondaryActions:[{content:a("Cancel"),onAction:te,disabled:A}],children:e.jsxs(D,{gap:"400",children:[B(),le()&&e.jsxs(D,{gap:"200",children:[e.jsx(m,{as:"span",variant:"headingMd",children:a("UseIntegration")}),e.jsx(D,{gap:"300",children:K.map((V,M)=>e.jsx(ep,{item:V,value:b,handleChange:ne}
2963,"integration-"+M))})]}),ie()]})}),e.jsx(yr,{data:{storeCharge:S},open:y,onConfirm:L,onClose:()=>C(!1),loading:A})]})},ep=({item:t,value:s,handleChange:n})=>{const{t:a}=J(),{getUserInfo:r,getKeyPlanModule:o}=de(),c=r().is_ab&&mp.includes(o()),u=!!(t.key==="ADD_ON_AI_WRITING"&&c);return e.jsx("label",{htmlFor:t.id,className:s!==t.id?"msui-cs-pointer":"",children:e.jsx(Q,{borderColor:"border",borderWidth:"025",borderRadius:"300",padding:"300",children:e.jsxs(U,{align:"space-between",wrap:!1,children:[e.jsx(As,{label:e.jsx(m,{as:"span",variant:"headingSm",children:t.label}),helpText:t.helpText,checked:s===t.id,id:t.id,onChange:()=>n(t.id)}),e.jsxs(m,{as:"span",variant:"headingLg",children:["$",t.price," ",e.jsx(m,{as:"span",variant:"bodyMd",children:u?`USD/50 ${a("Request").toLocaleLowerCase()}`:`USD/${t.isYearlyPlan?a("Year").toLocaleLowerCase():a("Month").toLocaleLowerCase()}`})]})]})})})};function lk(t){const s=de(),a=s.getVersionFeatureUser("order_center")!=="a",[r,o]=ca(),{t:l}=J(),c=dt(),{token:u}=vs(),d=c.getShop(),{isMobile:g}=xe(),{fetchProductSettings:h}=vP(),{fetchProductListing:p}=jr(),x=up(),f=he(Bv),_=he(ul),b=he(Bh),v=SP(st.CACHE_FETCH_SUPPLIER),y=he(ip),C=i.useRef([]),S=s.getCurrentPlan(),{fetchGetPaymentFee:j}=pr(),A=s.getUserInfo(),[E,T]=i.useState(new Date().getTime()),k=bt(),{fetchLogAttributeUser:O,browserDetect:R}=Rh(),[P,w]=i.useState("start"),N=he(La),[K,L]=be(Ai),W=he(rl),H=he(kh),Z=he(EP),te=he(TP),ne=he(Fv);he(Hh),he(Gh),he(Wh);const le=he(gp),B=he(pa),[ie,V]=i.useState(!1),M=i.useRef({importOnboarding:!1,isLoaded:!1}),I=pt(),F=async()=>{const{status:ye,data:Ie}=await zo.getQuestionSurvey();ye===Xt.OK&&H(Ie?.choices||{ads_spy:!1,shopify_product:!1,store_analysis:!1,handpick_product:!1})},G=async()=>{const{data:ye}=await os.getCategory({});if(ye){const Ie=ye?.categories.map(Ue=>(Ue.id&&Ue.children?.length&&q.size(Ue.children)&&Ue.children.unshift({active:!0,id:"",name:l("AllSubCategories"),icon:"",children:[]}),Ue));Ie.unshift({active:!0,id:"",name:l("AllCategories"),children:[],icon:""}),xS("listCategory",Ie),f(Ie)}},z=async()=>{const{data:ye,success:Ie}=await Ke.getExchangeRate({});Ie&&_(ye)},me=async()=>{try{const{status:ye,data:Ie}=await Xs.getProductPushUnpushCount(u);ye===Xt.OK&&N(Ue=>({...Ue,pushed:(Ie?.total_pushed||0)+(Ie?.total_pending||0),unpushed:Ie?.total_unpushed||0,totalPushedActive:Ie?.total_pushed_active||0,totalPushedDraft:Ie?.total_pushed_draft||0,totalFrozen:Ie?.total_frozen||0,totalNormal:Ie?.total_normal||0,totalStockIssue:Ie?.total_stock_issue||0,totalPriceIssue:Ie?.total_price_issue||0,totalUnavailable:Ie?.total_supplier_missing||0,totalPending:Ie?.total_pending||0}))}catch{}},Re=async()=>{const{status:ye,data:Ie}=await Ke.getAIWritingSettings();ye===Xt.OK&&Ie&&Z({ai_writing:{...Ie.ai_writing},isUpdateSetting:!1});const{status:Ue,data:ht}=await Ke.getAIImageSettings();Ue===Xt.OK&&te(ht?.ai_image||[])},Be=async()=>{const{status:ye,data:Ie}=await os.getProductTrendingKeyword({});ye===Xt.OK&&ne(Ie||[])},De=async()=>{const{data:ye}=a?await Pu.getCountOrderPlacementV12({params:{from_date:Rr[2].period.since,to_date:Rr[2].period.until},token:u}):await Pu.getCountOrderByType({params:{from_date:Rr[2].period.since,to_date:Rr[2].period.until,type:"placement"},token:u});ye&&y(ye?.counts?.unfulfilled||ye?.counts?.pending||0)},ot=async()=>{it().isBefore("2024-07-26")&&F(),M.current.importOnboarding||Be(),j(),me(),De(),G(),Re();try{const ye=v.getData();ye&&b(ye)}catch{}},ve=async(ye,Ie)=>new Promise(Ue=>{Ue(ye.subscribe("workplace."+Ie.toString()))}),pe=async(ye,Ie)=>new Promise(Ue=>{Ue(ye.subscribe("account."+Ie))}),ze=()=>{const ye=r.get("charge_success"),Ie=r.get("feature_id")==="DROPSHIP_PARTNER"&&r.get("status")==="success",Ue=ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].get(st.PAYMENT_INFO);try{if(Ue&&(ye||Ie)&&JSON.parse(Ue).has_survey_package==="DSP"){x(`${Y.HOME_PAGE.PATH+location.search}&has_survey=true`);return}if(Ue&&ye&&JSON.parse(Ue).is_new_user){if(x(Y.HOME_PAGE.PATH),k[ye==="0"?"error":"success"](`${l("Charge")} ${ye==="0"?l("Failed").toLocaleLowerCase():l("Successfully").toLocaleLowerCase()}`),ye!=="0"){const Ft=ge.getToken();ta({token:Ft,isReload:!0})}ge[Ce.isShopifyEmbedded()?"sessionStorage":"localStorage"].remove(st.PAYMENT_INFO)}}catch(ht){console.log(ht)}location.pathname===Y.AUTH_BIND_PLATFORM.PATH&&x(Y.HOME_PAGE.PATH)},Ge=async ye=>{const Ie={app_key:"ac6192504c603f140ac1",app_cluster:"us2"},Ue=new _1(Ie.app_key,{cluster:Ie.app_cluster}),ht=ge.workspaceStorage.getCurrentWorkspaceId(),Dt=ve(Ue,ht),Ft=pe(Ue,ye),as=await Promise.all([Dt,Ft]);window.channelPusher=as[0],window.accountPusher=as[1]},lt=()=>{window.addEventListener("message",function(ye){if(ye?.data?.type==="SEND_REQUEST_TRACKING"&&ye?.data){const Ie=ye?.data?.features||{};s.setFeatureCurrentPlan(Ie)}})},ue=ye=>{const Ie=ng();let Ue=ye||Ie;Ue=ag[Ue]?Ue:"en",Ue&&!Ce.isShopifyEmbedded()&&(ge.localStorage.set(st.LANGUAGE,Ue),L(Ue),setTimeout(async()=>{await il(Ue);const ht=ol();W(ht)},100))},ce=()=>{T(new Date().getTime())},Ae=()=>{w("start");let ye="error";s.fetchUserInfo().then(async Ie=>{try{const{success:Ue,status:ht,data:Dt}=Ie;if(Ue&&Dt){const{user:Ft}=Dt,as=await s.fetchCurrentPlan();await s.fetchPricingPlan(),setTimeout(()=>{ue(Ft?.language)},200);const fs=Object.values(Ft.linked_stores).concat().flat(),Jt=fs.filter(qe=>qe.status==="active");C.current=[...Ft?.onboarding?.AO];const Le=Ft?.remaining_meta_keys?.[Ut.DEMO_MODE]===!0;if(Jt.length===0){q.size(fs)?(w(Mt.PROCESSING),x(Y.AUTH_BIND_PLATFORM.PATH,"")):Ft.mkt_type==="tiktok"?w(Mt.MKT_USER_TIKTOK):w(Mt.PRICING);return}else{if(c.setListShop(fs),c.setCurrencyStoreByAccount(fs,Ft.id),window.is_hide_billing||Ft.is_user_mkt)ye=Mt.DONE;else{ye=Dt.user?.onboarding_enabled||Mt.DONE;const qe=+ge.shopStorage.getCurrentShopId(),At=Jt.length>1,yt=as?.AO?.package?.features?.WP_ADD_STORE?.limit===-1,Tt=(Jt.find(et=>et.is_default)||Jt[0]).id===qe;if(!Ce.isShopifyEmbedded()){const et=Jt.find(Ns=>Ns.id===qe)===void 0,rs=window.ms_fetch_account_no_store_id;if((et||rs)&&Jt.length>0){const Ns=Jt.find(Os=>Os.is_default)||Jt[0];ge.shopStorage.setCurrentShopId(Ns.id),ge.workspaceStorage.setCurrentWorkspaceId(Ns.workplace_id),location.reload();return}}if(At&&yt===!1&&Tt===!1)if(Ce.isShopifyEmbedded()){if(ye!==Mt.PRICING){const et=fs.find(rs=>rs.id===qe);le({open:!0,storeData:{ownerEmail:Ft.email,storeDomain:et?.domain||""}}),V(!0)}}else{const et=Jt.find(rs=>rs.is_default)||Jt[0];if(qe!==et.id){ge.shopStorage.setCurrentShopId(et.id),ge.workspaceStorage.setCurrentWorkspaceId(et.workplace_id),location.reload();return}}}_e()}h(),p();const Ye=fs.find(qe=>qe.is_default===1);Ye&&window.clarity&&window.clarity("set","store_domain",Ye.platform_domain)}ht===fe.UNAUTHORIZED&&(Ce.isShopifyEmbedded()?ye="error":s.signout())}catch(Ue){console.log(Ue)}ye!==Mt.PRICING&&(ye=Mt.DONE,ze()),w(ye)})},_e=async()=>{const ye=R();let Ie=Ce.isShopifyEmbedded()?"AO built-in shopify":"AO Web";await lp()||(Ie=`${Ie}, AO extension`);const ht={platform:Ie,browser:ye.browserName,browser_version:ye.browserVersion};O(ht)},Pe=i.useCallback(ye=>{I(Y.HOME_PAGE.PATH),w(Mt.DONE),Jy()},[I]);i.useEffect(()=>{Ae()},[E]),i.useEffect(()=>{P===Mt.DONE&&s.getCurrentWorkPlace().id&&q.size(A)&&ot(),P===Mt.IMPORT&&!M.current.importOnboarding&&(M.current.importOnboarding=!0),[Mt.IMPORT,Mt.ORDER,"done"].includes(P)&&s.getCurrentWorkPlace().id&&q.size(A)&&!M.current.isLoaded&&(M.current.isLoaded=!0)},[P,s.getCurrentWorkPlace().id,A.id]),i.useEffect(()=>{const ye=r.get("context"),Ie=r.get("status"),Ue=r.get("show-notification")==="true",ht=r.get("auth_aliexpress_success");ye==="auth_aliexpress"&&Ie==="success"&&(r.delete("context"),r.delete("status"),r.delete("message"),r.delete("auth_aliexpress_success"),o(r),setTimeout(()=>{k[ht==="0"?"error":"success"](`AE ${l("Authentication").toLocaleLowerCase()} ${ht==="0 "?l("Failed").toLocaleLowerCase():l("Successfully").toLocaleLowerCase()}`)},200)),Ue&&(B(!0),r.delete("show-notification"),o(r))},[location.search]),i.useEffect(()=>{A?.has_shop&&c.setCurrentShop()},[c.getListShop(),A.id]);const Ne=async ye=>{try{await Qa.login(ye.toString())}catch{}};i.useEffect(()=>{A.id&&(Ge(A.id),Ne(A.id),z())},[A.id]),i.useEffect(()=>(lt(),()=>{window.channelPusher=void 0}),[]),i.useEffect(()=>{if(S&&S?.package&&A?.id&&d?.id&&d?.domain&&d.need_update_scopes&&ge.cookieStorage.get(dl.HAS_LOGIN_WITH_HASH)!=="true"&&I(Y.AUTH_INSTALL.PATH.replace(":platform","shopify")+"?is_update=1&shop="+d.platform_domain),S&&S?.package&&A?.id){let ye="";Ce.isShopifyEmbedded()&&(ye=`https://${d?.domain}/admin/apps/b1fafe67369104644289836a54b36dbb`);const Ie=ge.getToken();A.mkt_type!=="special_guest"&&ta({token:Ie,currentPlan:S?.package?.features,userInfo:A,shop:d,workplace:s.getCurrentWorkPlace(),env:"production",shopifyOrigin:ye})}},[S,A,d]),i.useEffect(()=>{sg()},[]),i.useEffect(()=>{const ye=location.pathname,Ie=[/^\/app\/find-product\/image$/,/^\/app\/find-product\/[^/]+\/detail\/([a-zA-Z0-9]+)\/[^/]+$/];!(Dt=>Ie.some(Ft=>Ft.test(Dt)))(ye)&&q.size(JSON.parse(ge.sessionStorage.get(tn.FILE_SEARCH_IMAGE)||"{}"))&&ge.sessionStorage.remove(tn.FILE_SEARCH_IMAGE)},[location.pathname]),i.useEffect(()=>{q.includes([Mt.PRICING,Mt.ORDER,Mt.IMPORT],P)&&I(Y.OB_WELCOME.PATH)},[P]);const rt=()=>e.jsxs(Oe.Fragment,{children:[e.jsx(P4,{}),e.jsx(H4,{}),e.jsx(YR,{})]});return e.jsxs(Oe.Fragment,{children:[e.jsx(yP,{}),e.jsx(ST,{}),e.jsx(ET,{}),e.jsx(U3,{}),e.jsx(XR,{}),!g&&e.jsx(Oe.Fragment,{children:e.jsx(TT,{})}),P==="start"&&e.jsx(ut,{children:e.jsx(nn,{})}),P==="processing"&&e.jsx(Yo,{}),P===Mt.MKT_USER_TIKTOK&&e.jsx(aP,{}),q.includes([Mt.PRICING,Mt.ORDER,Mt.IMPORT],P)&&e.jsx(bi,{isOnboarding:!0,children:e.jsx(Vo,{onboardingType:P,onNext:Pe})}),P==="done"&&e.jsxs(Oe.Fragment,{children:[e.jsx(N4,{}),e.jsx(BI,{}),e.jsx(DT,{}),e.jsx(jT,{}),e.jsx(kR,{}),e.jsx(RI,{}),e.jsx(F4,{}),e.jsx(LR,{}),e.jsx(ok,{}),e.jsx(UR,{}),e.jsx(y5,{}),!ie&&e.jsx(bi,{children:t.children}),e.jsx(nk,{}),e.jsx(BR,{}),e.jsx(VT,{}),e.jsx(M3,{}),e.jsx(hA,{}),e.jsx(Ph,{}),e.jsx(Ob,{}),e.jsx(yI,{}),e.jsx(TR,{}),e.jsx(bI,{}),e.jsx(HR,{}),e.jsx(sI,{}),e.jsx(W3,{}),rt()]}),P==="error"&&e.jsx(ut,{children:e.jsxs(m,{as:"p",variant:"headingSm",fontWeight:"regular",children:[l("SomeThingWentWrong"),","," ",e.jsx(re,{variant:"plain",onClick:ce,children:l("PleaseTryAgain").toLocaleLowerCase()})]})})]})}function ck(t,s=!0){const n=i.useContext(Cm).navigator;i.useEffect(()=>{if(!s)return;const a=n.block(r=>{const o={...r,retry(){a(),r.retry()}};t(o)});return a},[n,t,s])}function dk(t){const s=pt(),n=zs(),[a,r]=i.useState(!1),[o,l]=i.useState(null),[c,u]=i.useState(!1),{shake:d}=Fa(),g=i.useCallback(()=>{r(!1),l(null)},[]),h=i.useCallback(x=>!c&&x.location.pathname!==n.pathname?(r(!0),d(),window.shopify&&window.shopify.saveBar.leaveC
2963onfirmation(),l(x),!1):!0,[c,n]),p=i.useCallback(()=>{r(!1),u(!0)},[]);return i.useEffect(()=>{c&&o&&(s(o.location?.pathname),u(!1))},[c,o]),ck(h,t),{showPrompt:a,confirmNavigation:p,cancelNavigation:g}}const uk=t=>{const{confirmModalData:s,onClose:n,onOk:a}=t,r=()=>{window.shopify&&window.shopify.saveBar.hide("ms-my-save-bar")},o=()=>{r(),a()};return e.jsxs(fm,{open:s.visible||!1,onHide:n,children:[e.jsx(Q,{padding:"300",children:e.jsx("p",{children:s.content})}),e.jsxs(rb,{title:s.title||"",children:[e.jsx("button",{variant:"primary",tone:"critical",onClick:o,children:s.okText}),e.jsx("button",{onClick:n,children:s.cancelText})]})]})},pk=t=>{const{confirmModalData:s,onClose:n,onOk:a}=t;return zs(),e.jsx(Xe,{open:s.visible||!1,title:s.title,onClose:()=>{n()},primaryAction:{content:s.okText,destructive:!0,onAction:a},secondaryActions:[{content:s.cancelText,onAction:()=>{n()}}],children:e.jsx(Xe.Section,{children:e.jsx(xm,{children:e.jsx("p",{children:s.content})})})})},hk=()=>{const[t,s]=be(ur),{isMobile:n}=xe(),{t:a}=J(),r=zs(),o=r.pathname.includes("products-center"),l=r.pathname.includes("products-import"),c={title:a("LeavePageWithUnsavedChanges"),cancelText:a("Stay"),okText:a("LeavePage"),content:a("LeavingThisPageWillDeleteAllUnsavedChanges")},{content:u=c.content,title:d=c.title,cancelText:g=c.cancelText,okText:h=c.okText,isChanged:p=!1,visible:x,showSaveBar:f}=t,{showPrompt:_,confirmNavigation:b,cancelNavigation:v}=dk(p),y={...t,content:u,title:d,cancelText:g,okText:h,visible:x||(f?!1:_)},C=()=>{t.action&&t.action.cancel&&t.action.cancel(),v(),s({...t,visible:!1})},S=()=>{l&&ss("imported_edit_modal_leave_click",{}),o&&ss("pc_edit_modal_leave_click",{}),t.action&&t.action.ok&&t.action.ok(),b(),s({...t,isChanged:!1,visible:!1})};return e.jsx(e.Fragment,{children:Ce.isShopifyEmbedded()&&!n?e.jsx(uk,{onOk:S,onClose:C,confirmModalData:y}):e.jsx(pk,{onOk:S,onClose:C,confirmModalData:y})})},gk=(t,s,n)=>{const a=n.get("shop");a&&ge.shopStorage.setShopNameInEmbedded(a);const r=t.getShop(),o=n.get("hmac")&&a&&n.get("host")&&n.get("timestamp"),l=r.platform_domain!==a;return Ce.isShopifyEmbedded()&&s.checkAuth()&&!l?!1:!!o},mk=()=>{const t=de(),s=dt(),{isMobile:n}=xe(),[a,r]=i.useState(null),o=i.useRef({firstLoad:!0}),[l]=ca(),c=window.location.pathname.includes(Y.OB_WELCOME.PATH),u=i.useRef(null),d=t.isDemoMode(),g=u.current?.clientHeight||0,h=n?76:0,p=zs(),x=AT(p.pathname);location.pathname,Y.BILLING_PLAN.PATH;const f=()=>{r(!1)},_=()=>{if(a===null)return e.jsx(ut,{children:e.jsx(_t,{})});if(a===!0){const b=Object.fromEntries([...l]);if(!Ce.isShopifyEmbedded()){location.href="https://id.zopi.io?app=AO"+location.search.replace("?","&");return}return e.jsx(vT,{platform:"shopify",paramsInstall:b,onInstall:f})}return e.jsx(e.Fragment,{children:t.checkAuth()?e.jsxs(lk,{children:[e.jsx("div",{className:"private-wrapper",style:{marginBottom:d?n&&x?g+h:48:void 0,paddingRight:"var(--ms-app-sidebar-width)",transition:"padding-right 0.3s ease"},children:e.jsx(vm,{})}),e.jsx(hk,{}),!n&&!c&&e.jsx(_m,{})]}):e.jsx(Dp,{to:Ce.isShopifyEmbedded()?Y.SIGNIN.PATH:Y.HOME_PAGE_LANDING_PAGE.PATH})})};return i.useEffect(()=>{if(o?.current.firstLoad){o.current.firstLoad=!1;const b=gk(s,t,l);r(b)}},[s]),e.jsx(e.Fragment,{children:_()})},fk=t=>n=>{const a=pt();return e.jsx(t,{navigate:a,...n})},xk="/assets/1-Cz79usC8.jpg",_k="/assets/2-C-C5MBjA.jpg",bk="/assets/3-D9xtYn1M.jpg",yk="/assets/6-NLHf6EPs.jpg",Ck="/assets/4-ohbMRJn4.avif",vk="/assets/5-BrOHArPj.avif",Ak=se.div` 2964 width: 100%; 2965 height: 100%; 2966 display: flex; 2967 flex-direction: column; 2968 align-items: center; 2969 justify-content: center; 2970 .error-boundary-message { 2971 display: flex; 2972 gap: 10px; 2973 } 2974`;class Sk extends Oe.Component{gifts;constructor(s){super(s),this.state={hasError:!1,info:"",error:""},this.gifts=[xk,_k,bk,Ck,vk,yk],this.handleRetry=this.handleRetry.bind(this),this.getMessageForDevelop=this.getMessageForDevelop.bind(this),this.getMessageDetectError=this.getMessageDetectError.bind(this)}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,n){this.setState({hasError:!0,info:n,error:s}),console.log(s,"info",n)}handleRetry(){this.props.navigate&&this.props.navigate(0)}getMessageDetectError(){const s=this.state.error.message||"";let n="Something went wrong.";return s&&s.includes("Failed to fetch dynamically imported")&&(n="We are developing new features, Sorry this problem occurred."),e.jsxs("div",{className:"error-boundary-message",children:[e.jsx(m,{as:"span",variant:"bodyMd",tone:"subdued",children:n}),e.jsx(re,{variant:"plain",onClick:this.handleRetry,children:"Retry Again"})]})}getMessageForDevelop(){return""}render(){return this.state.hasError?e.jsxs(Ak,{children:[this.getMessageDetectError(),this.getMessageForDevelop()]}):this.props.children}}const po=fk(Sk),jk=()=>null,Ek=()=>{const{isMobile:t}=xe(),{getVersionFeatureUser:s}=de(),n=(c,u="a")=>{const d=c.component[u]||c.component.a;return d?t&&d.mobile?d.mobile:d.desktop:jk},a=c=>{const u=c.abTesting?s(c.abTesting):"a";return n(c,u)},r=c=>{const{hasPermission:u}=gs();return c.filter(g=>!g.hidden).filter(g=>u(g.permissions)).map((g,h)=>{const p=a(g);return e.jsx(Dr,{path:g.index?void 0:g.path,index:g.index,element:e.jsx(po,{children:e.jsx(p,{})}),children:g.subRoutes&&r(g.subRoutes)},`private-sub-route-${h}-${g.path}`)})},o=c=>{const{hasPermission:u}=gs();return c.filter(d=>!d.hidden).filter(d=>u(d.permissions)).map((d,g)=>{const h=a(d);return e.jsx(Dr,{path:d.path,element:e.jsx(po,{children:e.jsx(h,{})}),children:d.subRoutes&&r(d.subRoutes)},`private-route-${g}-${d.path}`)})},l=c=>{const{hasPermission:u}=gs();return c.filter(g=>!g.hidden).filter(g=>u(g.permissions)).map(({parentComponent:g,...h},p)=>{const x=a(h);return e.jsx(Dr,{path:h.path,element:e.jsx(po,{children:g?e.jsx(g,{children:e.jsx(x,{})}):e.jsx(x,{})}),children:h.subRoutes&&r(h.subRoutes)},`public-route-${p}-${h.path}`)})};return e.jsxs(Am,{location,children:[e.jsx(Dr,{path:"/app",element:e.jsx(mk,{}),children:o(xT)}),l(_T)]})},YN=Object.freeze(Object.defineProperty({__proto__:null,default:Ek},Symbol.toStringTag,{value:"Module"}));
2974export{S5 as $,vT as A,Vn as B,dy as C,lA as D,pn as E,vr as F,rb as G,Pt as H,Nh as I,$3 as J,tI as K,Hl as L,$e as M,VC as N,q3 as O,J3 as P,z3 as Q,Y3 as R,wh as S,V3 as T,K3 as U,Z3 as V,Q3 as W,X3 as X,Mw as Y,fw as Z,bi as _,Oh as a,zE as a$,As as a0,os as a1,lr as a2,Lr as a3,Zo as a4,Cn as a5,Lv as a6,Zt as a7,gd as a8,JE as a9,FN as aA,Ko as aB,pa as aC,Fn as aD,lh as aE,uy as aF,Fa as aG,eb as aH,Cw as aI,Uv as aJ,BE as aK,Lw as aL,Pu as aM,je as aN,nb as aO,Kj as aP,GE as aQ,VE as aR,gA as aS,WE as aT,ia as aU,Ol as aV,hn as aW,VS as aX,IS as aY,Zj as aZ,rE as a_,py as aa,bw as ab,$C as ac,gk as ad,_w as ae,VN as af,dC as ag,Eo as ah,Nt as ai,yw as aj,zt as ak,Aa as al,hE as am,Ow as an,Wp as ao,hy as ap,Aw as aq,uh as ar,zu as as,Nw as at,Gp as au,Ew as av,jw as aw,Ht as ax,Sw as ay,vn as az,hw as b,vl as b$,Eh as b0,by as b1,sb as b2,za as b3,xy as b4,my as b5,_y as b6,fy as b7,gy as b8,WC as b9,rP as bA,iP as bB,v1 as bC,Fl as bD,Co as bE,Yp as bF,G5 as bG,un as bH,SC as bI,wn as bJ,D3 as bK,O3 as bL,W5 as bM,ab as bN,WN as bO,jr as bP,G3 as bQ,qa as bR,Es as bS,gh as bT,sh as bU,ii as bV,oi as bW,KC as bX,DC as bY,OC as bZ,Al as b_,Rh as ba,l5 as bb,ss as bc,nd as bd,WR as be,Zn as bf,Tw as bg,Pw as bh,Iw as bi,ww as bj,eA as bk,Rw as bl,kw as bm,aA as bn,Ry as bo,AI as bp,Gw as bq,Ot as br,GN as bs,Dw as bt,Bh as bu,K4 as bv,$v as bw,dh as bx,Bl as by,R4 as bz,Gl as c,TN as c$,QC as c0,wy as c1,dn as c2,Qp as c3,ih as c4,N3 as c5,k3 as c6,w3 as c7,Iu as c8,wi as c9,Kh as cA,B4 as cB,Cl as cC,hN as cD,dN as cE,Qw as cF,Xw as cG,jP as cH,zw as cI,tN as cJ,aN as cK,Zw as cL,sN as cM,TI as cN,uN as cO,pN as cP,gN as cQ,Lh as cR,lN as cS,cN as cT,IN as cU,SN as cV,jN as cW,nN as cX,EN as cY,g5 as cZ,PN as c_,vP as ca,k5 as cb,Ya as cc,ON as cd,B3 as ce,vS as cf,SS as cg,Uw as ch,Il as ci,Fv as cj,Bv as ck,Hw as cl,gw as cm,Ri as cn,Bw as co,HN as cp,A5 as cq,Wv as cr,vw as cs,Ql as ct,ql as cu,i0 as cv,o0 as cw,AR as cx,di as cy,vR as cz,gj as d,Ha as d0,EP as d1,mw as d2,iN as d3,oN as d4,xN as d5,rN as d6,_j as d7,ak as d8,rk as d9,CT as dA,xw as dB,cy as dC,YN as dD,ik as da,Kw as db,yN as dc,eN as dd,zv as de,CN as df,bN as dg,Jw as dh,_N as di,$w as dj,LN as dk,MN as dl,mN as dm,UN as dn,RN as dp,Yw as dq,kN as dr,qw as ds,NN as dt,fN as du,Yh as dv,wN as dw,U5 as dx,vN as dy,AN as dz,BN as e,nt as f,or as g,Vw as h,Dh as i,sT as j,bb as k,yS as l,$p as m,oP as n,Dn as o,gn as p,DN as q,Vl as r,Ww as s,Fw as t,Wn as u,tb as v,Ua as w,Vp as x,Yr as y,Se as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.