PageSourceSearch

https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DtPjspnE.js

js packman.ai collected 2026-10-05 12:22:01 UTC 657,173 bytes, 771 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["https://cdn.packman.ai/seller-dashboard-static-assets/assets/packman-ai-product-draft-overlay-BHcwnvJG.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/vendor-Bvo7Jo7p.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/vendor-charts-DPnfmtXF.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/vendor-three-CG3zAK4y.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/workspace-ui-CtGPyqjp.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/workspace-InNKZ5NE.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/vendor-monaco-CEqwRMpL.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/use-onboarding-images-CfaavRp_.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/workspace-sdk-BYCZjxpJ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-C3S05cQG.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CAdnOMhD.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-SUX2xzW4.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BgML80Ht.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BmemELyl.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Cfnv_9yb.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CHjkDtBC.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CiLd2ZpN.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DtZoZkgf.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BZPr6Z17.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CXu29fZL.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-B7Xwh1iU.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Des2DaAP.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Cdnd0HIV.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/search-sync-Bfq1Tbld.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-C1I5TqtF.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DzzAY_zv.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-IXYdm8ot.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-LZ13ifsa.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/crm-events-DUUUGcZy.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/theme.resource-DFcjniqv.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-B4ixJ3Sq.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-hWxGMRRz.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CSXhjPqI.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/shipping.resource--c07t7D6.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BTREBIS7.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-C-jMnjTs.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/edit-BBy1EmB3.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-BUj4mYGx.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/edit-MKyXaCT_.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-wEWBzFAR.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/edit-BrDz_JxI.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-Cz2o2ARx.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/edit-CXZaDWCo.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-CtOY51Gn.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DvSynNN4.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CZOHHbDy.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-E_L0Kkfp.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/service-terms-registry-DTyqotSx.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DRxoDb7Q.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/container-wrapper-BUG1mm7F.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CKnljf9s.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-asPTu8jF.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-
1D8l2jcmP.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/pulse-spinner-Baj_uBXM.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/subscriptions-D2PQFOw8.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/payment-method-Q1lz4JXT.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/services-BKBAvaxC.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/page-BaZ2871S.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/card-brand-icons-C9toV1NQ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/public-page-kTjAzeTA.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CC0K7H5i.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-BpaUmBsC.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DEfutZQF.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/details-BfwgFQtW.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Ik9UQsNQ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-page-Dd4x-NUU.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/import-page-BjnlxMOw.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-rCGuuCI8.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-page-BYueOZqN.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/import-page-C3g-cbp7.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CG9gnEMq.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Bu-6C0px.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CXtCrULK.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-page-DF_-frVJ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/website-import-wizard-DYjpGRxF.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/import-page-BZjLSZbb.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/website-import-page-BG0FYJuG.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/product-content-tasks-page-DK1kLR-B.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BOYW-VxZ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-CY4c8mep.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-KeE-FMgd.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Cxk8B-2E.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CnI3x_hz.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-B52T-8A5.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BxeD-s58.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/export-dialog-BO-fLWHq.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/history-BbtQv75-.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/all-history-BSY2RzNA.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/import-DkEY7muY.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-rNSGFyOZ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-C7GSXGfQ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/details-D_pQ6Aiz.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Dcmodb0F.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/store-url.utils-BVTshF8L.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-D5ApkaUk.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/orders.resource-CKAT55ve.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-lXUUP442.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/details-DZfXJKgB.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BjLVnxj1.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/details-my3uzY3o.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-VA29iw2c.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-CjiyFZiA.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DZcNa-z5.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/text-gradient-B_PW_V96.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/phone-input-CRlPbgTZ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/public-not-found-BGDOmZYM.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/sign-up-BrfLgB76.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BvgWru-G.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/verify-otp-T5njY5Px.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/change-phone-1pXUYDmj.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/system-country.resource-B-gzBNWj.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/select-store-Dq7x-7EB.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-By9NxGHv.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/workspace-builder
1-BcMiXJCf.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-canvas-TuMjXqBF.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/_locale_-BNcVWTbD.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/_id_-BHcmXDLv.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/verify-email-DHE4X8LB.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BeOoOb-L.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DWc6mtdz.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DWf1UPMg.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-page-0Bb7E37F.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Dn3_hWcc.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-B4l7F5r4.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/analytics-CKzU-so1.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/layout-BEgxUm0w.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/shared-DT1OWLpb.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/overview-7JW9g5jh.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/transactions-C3JiXu_y.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/expenses-CRViRnDa.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/reports-BvIQLahZ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/settings-CLjVEq7J.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/setup-CFDcXhWK.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/layout-CZCf9l1l.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/shared-CyhBpuSI.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-BXqAswFJ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/approvals-DM_dSgwg.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/strategy-Cs49dgVd.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/packages-CaIcvXaA.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/settings-zQfEfInA.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-D_BY9n9e.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/use-smart-studio-product-draft-DZPjioh4.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/flow-BhwLjj-l.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/result-CzewGf-V.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/publish-BRd_Tl8L.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/templates-erFArwoG.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/history-DvtHPqC0.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/brand-voice-RKn-JriA.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-DKAzEBBh.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/create-DzrcqQpp.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/ai-marketing-portal-cl-a_HSY.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-ZreKK8S_.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/add-credits-DxzP2Bno.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/index-Cf8Y5gD0.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/getting-started-F_8zs3g8.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/dashboard-overview-guide-BgYdNdyO.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/seo-guide-guFVi2uD.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/pricing-guide-CiITqSaL.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/subscriptions-guide-Db9lfEbp.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/design-guidelines-BNrPGas0.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/ai-generation-DkhvhV2w.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/product-upload-mwZ0VmqT.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/store-optimization-BiTRSj8V.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/shipping-guide-3MeQNmsp.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/inventory-guide-mH0CiDpQ.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/coupons-guide-Bp0D6WVS.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/orders-guide-B18vkehB.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/size-guides-page-HqYSzptN.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/domains-guide-BccyzF-E.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/seller-builder
1-guide-ByMJEZ0r.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/store-settings-guide-Ciogp_MH.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/wallet-guide-wz-CpEGO.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/cart-recovery-guide-CJor6Yhh.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/categories-guide-0_g1iloo.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/analytics-guide-Cm20jDrR.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/customers-guide-C2dz_U9z.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/returns-guide-lgOylOB0.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/guide-page-CiF5_gLj.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/product-labels-guide-Ba24xhz4.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/store-credit-guide-BHu_nHOz.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/users-guide-DopFd4MB.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/api-tokens-guide-BzaCQHNR.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/accounting-guide-kADf2imw.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/marketing-assistant-guide-BjEZs8oi.js","https://cdn.packman.ai/seller-dashboard-static-assets/assets/ai-assistant-guide-DMZsZwhT.js"])))=>i.map(i=>d[i]);
2import{od as Pa,oe as Oa,x as t,of as Sd,c as $e,i as Ad,j as Nd,z as yo,y as wt,l7 as xr,r as c,e2 as kd,og as Td,oh as Cd,oi as jd,oj as Id,kl as Rd,nu as Pd,j9 as Da,ln as On,A as kt,ok as bo,ol as _r,om as Jt,B as Od,e as Ie,f as Ue,on as Js,kc as Dd,jc as Ld,kj as La,lh as Zs,kb as as,oo as kc,i7 as Ud,l1 as Ua,lb as Md,op as Gd,le as $d,j1 as Vd,j3 as Fd,oq as zd,l4 as Wd,ib as Zr,or as Bd,m9 as Tc,os as qd,ot as es,ik as Ma,h1 as Kd,i4 as Cc,fr as Hd,lL as jc,hD as Yd,ou as Qd,iw as Ic,j4 as fr,md as Rc,f4 as Xd,hl as ea,ov as Jd,ow as Zd,ox as Pc,oy as Oc,iB as ts,oz as eu,oA as xo,gp as _o,hI as Dc,gh as wr,oB as Lc,oC as wo,hh as ta,lQ as Uc,oD as Mc,oE as tu,iN as nu,h9 as ru,ie as os,ia as vo,ir as su,il as Eo,oF as au,kN as na,gi as ou,fv as iu,fn as cu,oG as lu,hi as du,lP as uu,kC as Gc,kF as Xn,oH as $c,oI as Vc,oJ as pu,oK as mu,jg as is,jo as Dn,je as Fc,la as zc,mK as gu,jX as Wc,jO as Ga,oL as hu,kx as $a,mm as Jn,c0 as Ft,kq as cs,oM as Bc,oN as qc,o7 as Kc,oO as fu,lA as vr,jT as zt,kn as yu,kR as ns,oP as So,oQ as bu,kV as xu,oR as _u,oS as wu,kr as Hc,k_ as vu,oT as Eu,nP as Su,oU as Au,jY as Nu,m3 as ku,oV as Tu,kt as Ln,oW as Cu,oX as ju,oY as Iu,oZ as Ru,o_ as Pu,o$ as Ou,p0 as Du,p1 as Lu,p2 as Uu,p3 as Mu,p4 as Gu,p5 as $u,p6 as Vu,p7 as Fu,p8 as zu,p9 as Wu,kz as Bu,pa as qu,pb as Ku,pc as Hu,nJ as Yu,pd as Qu,pe as Xu,o8 as Ju,ld as Va,jK as Zn,lj as Yc,lM as Zu,jh as St,pf as Fa,pg as At,jr as ra,jU as Ao,jm as No,jV as ep,dc as Kr,_ as N,n9 as jn,lJ as Qc,kG as tp,jN as np,jZ as Xc,ph as rp,jD as sp,pi as Jc,l0 as ap,pj as op,mJ as ip,pk as cp,jE as lp,jv as dp,pl as Zc,j$ as el,mq as za,lF as tl,jF as up,pm as pp,ny as mp,pn as gp,lr as hp,lN as fp,p as yp,kk as nl,lB as bp,po as xp,kh as _p,jH as wp,lm as vp,jC as Ep,jq as Sp,jt as Ap,ju as Np,pp as kp,j8 as ko,pq as Tp,pr as Cp,ps as jp,pt as To,pu as Co,pv as jo,pw as rn,px as it,py as Ip,c3 as T,pz as Rp,pA as Pp,pB as b,pC as Wa,pD as Op,pE as Dp,pF as Lp,dg as Up,pG as Mp}from"./vendor-Bvo7Jo7p.js";import{g2 as Gp,g3 as rl,g4 as $p,g5 as Vp,g6 as Fp,g7 as zp,g8 as Wp,g as Le,fs as q,g9 as Er,ga as bt,gb as mn,u as yt,B as mt,en as Qt,d$ as Bp,eW as qp,gc as ls,gd as Kp,ge as ds,gf as Hp,gg as Yp,gh as yr,gi as dn,gj as un,b as xt,aW as us,aX as ps,aY as ms,aZ as In,A as Qp,l as Xp,m as Jp,n as Zp,gk as em,bo as Io,bp as Ro,bq as Po,ex as sl,bV as sa,T as al,i as ol,j as il,k as cl,gl as tm,gm as Oo,gn as nm,go as Ba,gp as qa,gq as rm,gr as sm,gs as am,gt as om,P as ll,o as dl,p as ul,D as pl,E as ml,H as im,J as aa,K as gl,ag as oa,a9 as Ka,aa as Ha,ac as Ya,ad as hl,G as cm,fz as lm,Q as fl,aN as Sr,gu as dm,fk as Do,gv as Lo,fy as um,bs as pm,eu as mm,eg as gm,f as hm,ef as fm,gw as ym,al as Fn,ab as yl,gx as bm,gy as xm,gz as _m,ae as wm,dF as vm,eS as Em,eP as Sm,gA as Am,eQ as Nm,gB as km,di as Tm,gC as Cm,gD as 
2jm,gE as Im,ax as Uo,a$ as Rm,b0 as Pm,b1 as Om,b2 as Dm,b3 as Lm,b4 as Um,b5 as Mm,b6 as Gm,a1 as bl,an as $m,aG as Vm,aH as Fm,aI as zm,gF as Mo,gG as Wm,gH as Bm,gI as qm,gJ as Km,gK as ia,gL as ca,gM as xl,gN as Hm,gO as Ym,gP as Qm,gQ as Xm}from"./workspace-InNKZ5NE.js";import{C as Jm,M as Zm,l as eg,H as tg,A as ng}from"./workspace-ui-CtGPyqjp.js";import{B as rg}from"./workspace-sdk-BYCZjxpJ.js";import"./vendor-charts-DPnfmtXF.js";import"./vendor-three-CG3zAK4y.js";import"./vendor-monaco-CEqwRMpL.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5dd80ac8-4846-4be8-84d3-310198e17fd3",e._sentryDebugIdIdentifier="sentry-dbid-5dd80ac8-4846-4be8-84d3-310198e17fd3")}catch{}})();(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function r(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=r(a);fetch(a.href,o)}})();const Qa=document.createElement("script");Qa.type="module";Qa.src="https://cdn.jsdelivr.net/npm/paymob-pixel@latest/main.js";document.head.appendChild(Qa);const Xa="production",Ja=`packman.${Xa}.acquisition`,_l=`${Ja}.context`,la=`${Ja}.orders`,sg=["utm_source","crm_contact_id","crm_contant_id","utm_medium","utm_campaign","utm_content","utm_term","gclid","gbraid","wbraid","fbclid","journey_id","entry_source","packman_ga_cid","packman_fbp","packman_fbc","sc"];function rr(){return typeof window<"u"?window:null}function wl(e="localStorage"){const n=rr();if(!n)return null;try{return n[e]}catch{return null}}function gs(e,n){const r=wl();if(!r)return n;try{const s=r.getItem(e);return s?JSON.parse(s):n}catch{return n}}function Za(e,n){const r=wl();if(r)try{r.setItem(e,JSON.stringify(n))}catch{}}function As(e){const n=rr();if(!n)return"";const r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=n.document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return s?decodeURIComponent(s[1]):""}function ag(e){if(!e)return"";const n=String(e).split(".");return n.length<4?"":`${n[2]}.${n[3]}`}function vl(){const e=rr();return e?.crypto?.randomUUID?e.crypto.randomUUID():`journey_${Date.now()}_${Math.random().toString(36).slice(2,10)}`}function og(e){return e?`fb.1.${Date.now()}.${e}`:""}function ig(e){return typeof e=="string"?e.trim():""}function El(e){return ig(e)||""}function cg(e){if(!e)return{};const n=e.searchParams,r={};sg.forEach(a=>{const o=n.get(a);o&&(r[a]=o)}),r.crm_contant_id&&!r.crm_contact_id&&(r.crm_contact_id=r.crm_contant_id);const s=n.get("src");return s&&!r.entry_source&&(r.entry_source=s),r}function lg(){const e=rr();return e?new URL(e.location.href):null}function dg(){const e=rr();if(!e||!e.document.referrer)return"";try{return new URL(e.document.referrer).hostname}catch{return""}}const Sl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gbraid","wbraid","fbclid","packman_fbc","metaClickId"],ug=Sl.filter(e=>e!=="packman_fbc"&&e!=="metaClickId");function pg(e){return ug.some(n=>!!e.get(n))}function mg(e={},n={}){const r={...e};return Object.keys(n).forEach(s=>{const a=El(n[s]);a&&(r[s]=a)}),r}function sr(){return gs(_l,null)}function gg(e){return Za(_l,e),e}function Al(){const e=rr(),n=lg();if(!e||!n)return null;const r=sr()||{},s=cg(n),a=pg(n.searchParams),o={...r};a&&Sl.forEach(y=>{delete o[y]});const d=!!(o.gclid||o.gbraid||o.wbraid||s.gclid||s.gbraid||s.wbraid),u=s.packman_ga_cid||ag(As("_ga")),l=s.packman_fbp||As("_fbp"),i=s.packman_fbc||og(s.fbclid||"")||(a||d?"":As("_fbc")),g=mg(o,{...s,gaClientId:u,metaBrowserId:l,metaClickId:i,entrySource:s.entry_source||o.entrySource||(s.utm_source?"campaign":"")||n.searchParams.get("src")||"",landingPath:o.landingPath||`${n.pathname}${n.search}`,landingUrl:o.landingUrl||n.toString(),pageLocation:n.toString(),referrer:o.referrer||e.document.referrer||"",referrerHost:o.referrerHost||dg(),userAgent:e.navigator?.userAgent||o.userAgent||"",trackingEnv:Xa});return g.entrySource=El(g.entrySource),g.journeyId=s.journey_id||o.journeyId||vl(),g.updatedAt=new Date().toISOString(),o.createdAt?g.createdAt=o.createdAt:g.createdAt=g.updatedAt,gg(g)}function gt(e={}){const n=Al()||sr()||{};return{...n,...e,trackingEnv:Xa,journeyId:e.journeyId||n.journeyId||vl()}}function YC(e,n){if(!e)return;const r=gs(la,{});r[String(e)]={...r[String(e)]||{},...n,storedAt:new Date().toISOString()},Za(la,r)}function QC(e){return e&&gs(la,{})[String(e)]||null}function XC(e){if(!e)return!1;const n=`${Ja}.markers`,r=gs(n,{});return r[e]?!1:(r[e]=new Date().toISOString(),Za(n,r),!0)}const eo="packman_onboarding_session";function hs(e,n){typeof window>"u"||!e||!n||sessionStorage.setItem(eo,JSON.stringify({uid:e,sessionToken:n}))}function hg(e){if(typeof window>"u"||!e)return null;try{const n=sessionStorage.getItem(eo);if(!n)return null;const r=JSON.parse(n);return r?.uid!==e||!r?.sessionToken?null:r.sessionToken}catch{return null}}function to(){typeof window>"u"||sessionStorage.removeItem(eo)}const fg="v2",Nl=()=>
2fg==="v2",De={FLOW_SELECT:"FLOW_SELECT",IMAGE_UPLOAD:"IMAGE_UPLOAD",QUESTIONNAIRE:"QUESTIONNAIRE",THANK_YOU_HAPPY:"THANK_YOU_HAPPY",LEAD_FORM:"LEAD_FORM",AI_ANALYZING:"AI_ANALYZING",AI_REVIEW:"AI_REVIEW",QUICK_INFO:"QUICK_INFO",CHAT:"CHAT",TEMPLATE_SELECT:"TEMPLATE_SELECT",GENERATING_THEME:"GENERATING_THEME",LITE_BUILDER:"LITE_BUILDER",VERIFY_OTP:"VERIFY_OTP",END:"END"},da={[De.FLOW_SELECT]:{name:De.FLOW_SELECT,nextStage:null},[De.IMAGE_UPLOAD]:{name:De.IMAGE_UPLOAD,nextStage:De.QUESTIONNAIRE},[De.QUESTIONNAIRE]:{name:De.QUESTIONNAIRE,nextStage:null},[De.THANK_YOU_HAPPY]:{name:De.THANK_YOU_HAPPY,nextStage:null},[De.LEAD_FORM]:{name:De.LEAD_FORM,nextStage:null},[De.AI_ANALYZING]:{name:De.AI_ANALYZING,nextStage:De.AI_REVIEW},[De.AI_REVIEW]:{name:De.AI_REVIEW,nextStage:De.TEMPLATE_SELECT},[De.QUICK_INFO]:{name:De.QUICK_INFO,nextStage:De.TEMPLATE_SELECT},[De.CHAT]:{name:De.CHAT,nextStage:De.TEMPLATE_SELECT},[De.TEMPLATE_SELECT]:{name:De.TEMPLATE_SELECT,nextStage:De.GENERATING_THEME},[De.GENERATING_THEME]:{name:De.GENERATING_THEME,nextStage:De.LITE_BUILDER},[De.LITE_BUILDER]:{name:De.LITE_BUILDER,nextStage:De.END},[De.VERIFY_OTP]:{name:De.VERIFY_OTP,nextStage:De.END},[De.END]:{name:De.END,nextStage:null}};let Xe=null;const kl=e=>{if(e){if(typeof e=="string")return e.toLowerCase();if(typeof e=="object"){const n=e.code||e.iso||e.iso2||e.iso3||e.isoCode||e.countryCode||e.slug;return n?String(n).toLowerCase():void 0}}},Tl=e=>kl(e?.systemCountry),yg=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("v2_pending_registration")}catch{}},bg=e=>e.chat.chatAnswers?.language||e.language||"en",Cl=e=>({...e.onboarding,onboardingStage:da.IMAGE_UPLOAD,onboardingId:null,uid:null,sessionToken:null,template:null,prevData:null,phoneNumber:null,imageAnalysisTaskId:null}),xg=e=>{Xe=e},Ar=e=>Xe(n=>({language:e,direction:e==="ar"?"rtl":"ltr",auth:{...n.auth,user:{...n.auth.user,preferences:{...n.auth.user.preferences,language:e}}}})),_g=()=>Xe(e=>{const r=e.language==="en"?"ar":"en";return{language:r,direction:r==="ar"?"rtl":"ltr",auth:{...e.auth,user:{...e.auth.user,preferences:{...e.auth.user.preferences,language:r}}}}}),wg=e=>Xe(()=>({currency:e})),Ns=e=>Xe(()=>({systemCountry:kl(e)??"ae"})),vg=e=>Xe(n=>({onboarding:{...n.onboarding,onboardingStage:e}})),Eg=()=>Xe(e=>{const n=e.onboarding.onboardingStage,r=e.onboarding.onboardingStageList[n?.nextStage];return r?{onboarding:{...e.onboarding,onboardingStage:r}}:{}}),Sg=e=>Xe(n=>({chat:{...n.chat,chatAnswers:{...n.chat.chatAnswers,...e}}})),jl=()=>Xe(e=>({chat:{...e.chat,chatAnswers:{language:e.chat.chatAnswers?.language||"en"}}})),Ag=e=>Xe(n=>({chat:{...n.chat,chatAnswers:{...n.chat.chatAnswers,email:e}}})),Ng=e=>Xe(n=>({onboarding:{...n.onboarding,phoneNumber:e}})),Il=e=>Xe(n=>({onboarding:{...n.onboarding,onboardingId:e}})),Rl=e=>Xe(n=>(e&&n.onboarding?.sessionToken&&hs(e,n.onboarding.sessionToken),{onboarding:{...n.onboarding,uid:e}})),no=e=>Xe(n=>(e?n.onboarding?.uid&&hs(n.onboarding.uid,e):to(),{onboarding:{...n.onboarding,sessionToken:e}})),Pl=()=>Xe(e=>({...e,onboarding:Cl(e),chat:{...e.chat,chatAnswers:{}}})),Ol=()=>{yg(),to(),Xe(e=>({...e,onboarding:Cl(e),chat:{...e.chat,chatAnswers:{language:bg(e)}}}))},JC=e=>Xe(n=>({onboarding:{...n.onboarding,imageAnalysisTaskId:e}})),kg=e=>Xe(n=>({onboarding:{...n.onboarding,prevData:e}})),Tg=()=>Xe(e=>({chat:{...e.chat,isChatImageLoading:!e.chat.isChatImageLoading}})),ua=e=>Xe(n=>({store:{...n.store,stores:e}})),Xt=e=>Xe(n=>{const r=Tl(e);return{store:{...n.store,selectedStore:e},systemCountry:r||"ae"}}),mr=e=>Xe(n=>({store:{...n.store,selectedStoreDetails:e}})),Dl=e=>Xe(n=>({store:{...n.store,isLoadingStoreDetails:e}})),Kn=e=>Xe(n=>({store:{...n.store,storeDetailsError:e}})),Cg=e=>{if(e&&e.length>0){const n=e[0],r=Tl(n)||"ae";Xe(s=>({store:{...s.store,stores:e,selectedStore:n},systemCountry:r}))}},cr=()=>Xe(e=>({store:{...e.store,selectedStore:null,selectedStoreDetails:null},systemCountry:void 0})),Nr=()=>Xe(e=>({store:{...e.store,stores:[],selectedStore:null,selectedStoreDetails:null},systemCountry:void 0})),jg=()=>({auth:{isAuthenticated:!1,user:{profile:{name:"",email:""},preferences:{language:"en"},isOnboardingUser:!0,isOnboardingCompleted:!0}}}),Ig=()=>({onboarding:{onboardingStage:da.IMAGE_UPLOAD,onboardingStageList:da,onboardingId:null,uid:null,
2sessionToken:null,prevData:null,phoneNumber:null,imageAnalysisTaskId:null},chat:{chatAnswers:{},isChatImageLoading:!1},language:"en",direction:"ltr",systemCountry:"ae",currency:"aed"}),Rg=()=>({store:{stores:[],selectedStore:null,selectedStoreDetails:null,isLoadingStoreDetails:!1,storeDetailsError:null}}),Ll=e=>{if(!e)return;const n=e?.systemCountry;if(!n)return;if(typeof n=="string")return n.toLowerCase();const r=n.code||n.iso||n.iso2||n.iso3||n.isoCode||n.countryCode||n.slug;return r?String(r).toLowerCase():void 0},Pg=e=>(n,r,s)=>{let a=!1;return e((...o)=>{const d=n(...o);if(a)return d;const u=r(),l=u.store?.selectedStore,i=u.systemCountry,g=l?Ll(l):void 0;return g!==i&&(a=!0,n({systemCountry:g},!1),a=!1),d},r,s)},ae=Pa(Oa(Pg((...e)=>{const[n]=e;return xg(n),{...Ig(...e),...jg(...e),...Rg(...e)}}),{name:"app-storage",partialize:e=>({onboarding:{onboardingStage:e.onboarding.onboardingStage,onboardingStageList:e.onboarding.onboardingStageList,onboardingId:e.onboarding.onboardingId,uid:e.onboarding.uid,sessionToken:e.onboarding.sessionToken,imageAnalysisTaskId:e.onboarding.imageAnalysisTaskId,phoneNumber:e.onboarding.phoneNumber},chat:{chatAnswers:e.chat.chatAnswers},store:{selectedStore:e.store.selectedStore},language:e.language,direction:e.direction,currency:e.currency}),onRehydrateStorage:()=>e=>{if(e)if(e.onboarding?.uid&&e.onboarding?.sessionToken&&hs(e.onboarding.uid,e.onboarding.sessionToken),e.onboarding.setOnboardingStage=vg,e.onboarding.moveToNextOnboardingStage=Eg,e.onboarding.setOnboardingId=Il,e.onboarding.setUid=Rl,e.onboarding.setSessionToken=no,e.onboarding.setPrevOnboardingData=kg,e.onboarding.resetOnboardingStage=Pl,e.onboarding.resetOnboardingSession=Ol,e.onboarding.setPhoneNumber=Ng,e.chat.setChatAnswers=Sg,e.chat.clearChatAnswersExceptLanguage=jl,e.chat.setChatEmail=Ag,e.chat.setChatImageLoading=Tg,e.setLanguage=Ar,e.toggleLanguage=_g,e.setCurrency=wg,e.store.setStores=ua,e.store.setSelectedStore=Xt,e.store.setSelectedStoreDetails=mr,e.store.setStoreDetailsLoading=Dl,e.store.setStoreDetailsError=Kn,e.store.setFirstStoreAsDefault=Cg,e.store)if(e.store.stores=[],e.store.selectedStoreDetails=null,e.store.selectedStore){const n=Ll(e.store.selectedStore);n&&(e.systemCountry=n)}else!!(e.onboarding?.uid||e.onboarding?.onboardingId)?e.systemCountry="ae":e.systemCountry=void 0;else!!(e.onboarding?.uid||e.onboarding?.onboardingId)?e.systemCountry="ae":e.systemCountry=void 0}})),m={HOME:"/home",HOME_V2:"/home-v2",HOME_LEGACY:"/home-legacy",DASHBOARD:"/dashboard",ONBOARDING:{START:"/",BUILDER:"/builder",VERIFY_OTP:"/verify-otp",VERIFY_EMAIL:"/onboarding/verify-email"},PREVIEW:"/preview",AUTH:{SIGNUP:"/auth/signup",LOGIN:"/auth/login",VERIFY_OTP:"/auth/verify-otp",CHANGE_PHONE:"/change-phone",SELECT_STORE:"/auth/select-store"},STORE:{INDEX:"/dashboard/store",CREATE:"/dashboard/store/create",EDIT:"/dashboard/store/edit/:id",EDIT_SETTINGS:"/dashboard/store/edit-settings/:id",GENERAL:"/dashboard/store/general",SETTINGS:"/dashboard/store/settings",SEARCH_SYNC:"/dashboard/store/search-sync",INTEGRATIONS:"/dashboard/store/integrations",CUSTOMERS:"/dashboard/store/customers",CUSTOMERS_ROUTES:{CREATE:"/dashboard/store/customers/create",EDIT:"/dashboard/store/customers/edit/:id",DETAILS:"/dashboard/store/customers/details/:id"},PAYMENTS:"/dashboard/store/payments",SHIPPING:"/dashboard/store/shipping",PICKUP_LOCATIONS:"/dashboard/store/pickup-locations",PICKUP_LOCATIONS_ROUTES:{CREATE:"/dashboard/store/pickup-locations/create",EDIT:"/dashboard/store/pickup-locations/:id/edit"},SHIPPING_METHODS:{CREATE:"/dashboard/store/shipping/methods/create",EDIT:"/dashboard/store/shipping/methods/:id/edit"},SHIPPING_ZONES:{CREATE:"/dashboard/store/shipping/zones/create",EDIT:"/dashboard/store/shipping/zones/:id/edit"},SHIPPING_ZONE_MAPS:{CREATE:"/dashboard/store/shipping/zone-maps/create",EDIT:"/dashboard/store/shipping/zone-maps/:id/edit"},SHIPPING_RATE_TIER_TEMPLATES:{CREATE:"/dashboard/store/shipping/rate-tier-templates/create",EDIT:"/dashboard/store/shipping/rate-tier-templates/:id/edit"},DOMAINS:"/dashboard/store/domains",DOCUMENTS:"/dashboard/store/documents",TERMS_AND_CON
2DITIONS:"/dashboard/store/terms-and-conditions",MEDIA_LIBRARY:"/dashboard/store/media-library",VAT_SETTINGS:"/dashboard/store/vat-settings",API_TOKENS:"/dashboard/store/api-tokens"},THEME_TEMPLATES:{INDEX:"/dashboard/theme-templates",STYLE:"/dashboard/theme-templates/style",TEMPLATES:"/dashboard/theme-templates/templates"},ACCOUNT_DETAILS:"/dashboard/account",ACCOUNT:"/dashboard/account",CATALOG:{INDEX:"/dashboard/catalog"},CATEGORIES:"/dashboard/categories",CATEGORIES_CREATE:"/dashboard/categories/create",CATEGORIES_EDIT:"/dashboard/categories/edit/:id",CATEGORIES_IMPORT:"/dashboard/categories/import",SIZE_GUIDES:{INDEX:"/dashboard/size-guides",CREATE:"/dashboard/size-guides/create",EDIT:"/dashboard/size-guides/edit/:id"},PRODUCTS_INDEX:"/dashboard/products",PRODUCTS_CREATE:"/dashboard/products/create",PRODUCTS_EDIT:"/dashboard/products/edit/:id",PRODUCTS_IMPORT:"/dashboard/products/import",PRODUCTS_WEBSITE_IMPORT:"/dashboard/products/website-import",PRODUCTS_CONTENT_TASKS:"/dashboard/products/content-tasks",APPOINTMENTS:"/dashboard/appointments",COLLECTIONS_INDEX:"/dashboard/collections",COLLECTIONS_CREATE:"/dashboard/collections/create",COLLECTIONS_EDIT:"/dashboard/collections/edit/:id",COLLECTIONS_IMPORT:"/dashboard/collections/import",WAREHOUSE:{HUB:"/dashboard/warehouse-hub"},INVENTORIES:{INDEX:"/dashboard/inventory",HISTORY:"/dashboard/inventory/history/:id",ALL_HISTORY:"/dashboard/inventory/all-history",IMPORT:"/dashboard/inventory/import"},TRANSFERS:{INDEX:"/dashboard/transfers",CREATE:"/dashboard/transfers/create",EDIT:"/dashboard/transfers/edit/:id",DETAILS:"/dashboard/transfers/details/:id"},PRODUCTS_ATTRIBUTES:{INDEX:"/dashboard/product-attributes",CREATE:"/dashboard/product-attributes/create",EDIT:"/dashboard/product-attributes/edit/:id"},PRODUCT_LABELS:{INDEX:"/dashboard/product-labels"},STORES_INDEX:"/dashboard/stores",STORES_CREATE:"/dashboard/stores/create",STORES_EDIT:"/dashboard/stores/edit/:id",STORES_EDIT_SETTINGS:"/dashboard/stores/edit-settings/:id",TEMPLATES:"/dashboard/templates",TEMPLATE:"/dashboard/templates/:id",TEMPLATE_EDIT:"/dashboard/templates/:id/edit",APP_SETTINGS:{INDEX:"/dashboard/app-settings/general",EMAILS:"/dashboard/app-settings/general/emails"},BUILDER:{INDEX:"/dashboard/builder",TEMPLATE:"/dashboard/builder/:templateId"},SUBSCRIPTIONS:{INDEX:"/dashboard/subscriptions",PLANS:"/dashboard/subscriptions/plans",BILLING:"/dashboard/subscriptions/billing",HISTORY:"/dashboard/subscriptions/history"},SUBSCRIPTION_ORDERS:{DETAILS:"/dashboard/subscription-orders/:id"},ADDONS:{INDEX:"/dashboard/addons"},SERVICES:{INDEX:"/dashboard/services",CATEGORY:"/dashboard/services/:category",ACCOUNT_MANAGEMENT:"/dashboard/services/account_management",WAREHOUSE:"/dashboard/services/warehouse",REQUESTS:"/dashboard/services/requests",HISTORY:"/dashboard/services/history"},CARTS:{INDEX:"/dashboard/carts"},ANALYTICS:{INDEX:"/dashboard/analytics",HUB:"/dashboard/analytics-hub",LIVE_VIEW:"/dashboard/analytics/live-view",SALES:"/dashboard/analytics/sales",ORDERS:"/dashboard/analytics/orders",PRODUCTS:"/dashboard/analytics/products",LOCATIONS:"/dashboard/analytics/locations"},COUPONS:{INDEX:"/dashboard/coupons",CREATE:"/dashboard/coupons/create",EDIT:"/dashboard/coupons/edit/:id",ANALYTICS:"/dashboard/coupons/analytics"},SUBSCRIPTIONS_AND_SERVICES:{INDEX:"/dashboard/subscriptions-services"},MARKETING:{INDEX:"/dashboard/marketing",MEDIA_AI_GENERATOR:"/dashboard/ai-social-media-generator",MEDIA_AI_GENERATOR_SELECT_SOURCE:"/dashboard/ai-social-media-generator/select-source",MEDIA_AI_GENERATOR_SELECT_PRODUCT:"/dashboard/ai-social-media-generator/select-product",MEDIA_AI_GENERATOR_SELECT_TEMPLATE:"/dashboard/ai-social-media-generator/select-template",MEDIA_AI_GENERATOR_UPLOAD:"/dashboard/ai-social-media-generator/upload",MEDIA_AI_GENERATOR_RESULT:"/dashboard/ai-social-media-generator/result/:taskId",MEDIA_AI_GENERATOR_HISTORY:"/dashboard/ai-social-media-generator/history",MEDIA_AI_GENERATOR_3D_SELECT_PRODUCT:"/dashboard/ai-social-media-generator/3d/select-product",MEDIA_AI_GENERATOR_3D_GENERATE:"/dashboard/ai-social-media-generator/3d/generate",MEDIA_AI_GENERATOR_3D_RESULT:"/dashboard/ai-social-media-generator/3d/result/:taskId",MEDIA_AI_GENERATOR_V2:"/dashboard/ai-social-media-generator/v2",MEDIA_AI_GENERATOR_V2_SELECT_TEMPLATE:"/dashboard/ai-social-media-generator/v2/select-template",SMART_STUDIO:"/dashboard/smart-studio",SMART_STUDIO_FLOW:"/dashboard/smart-studio/flow",SMART_STUDIO_TEMPLATES:"/dashboard/smart-studio/templates",SMART_STUDIO_RESULT:"/dashboard/smart-studio/result/:jobId",SMART_STUDIO_PUBLISH:"/dashboard/smart-studio/publish/:jobId",SMART_STUDIO_HISTORY:"/dashboard/smart-studio/history",SMART_STUDIO_BRAND_VOICE:"/dashboard/smart-studio/brand-voice",WHATSAPP_MESSAGING:"/dashboard/marketing/whatsapp-messaging",DRAFT_CARTS:"/dashboard/draft-carts",DRAFT_CARTS_CREATE:"/dashboard/draft-carts/create",AI_MARKETING_PORTAL:"/dashboard/marketing/ai-marketing",ASSISTANT:"/dashboard/marketing-assistant",ASSISTANT_APPROVALS:"/dashboard/marketing-assistant/approvals",ASSISTANT_STRATEGY:"/dashboard/marketing-assistant/strategy",ASSISTANT_PACKAGES:"/dashboard/marketing-assistant/packages",ASSISTANT_SETTINGS:"/dashboard/marketing-assistant/settings"},WALLET:{INDEX:"/dashboard/wallet",ADD_CREDITS:"/dashboard/wallet/add-credits",HISTORY:"/dashboard/wallet/history"},ACCOUNTING:{INDEX:"/dashboard/accounting",TRANSACTIONS:"/dashboard/accounting/transactions",EXPENSES:"/dashboard/accounting/expenses",REPORTS:"/dashboard/accounting/reports",SETTINGS:"/dashboard/accounting/settings",SETUP:"/dashboard/accounting/setup"},SELLERS:{INDEX:"/dashboard/sellers",CREATE:"/dashboard/sellers/create",EDIT:"/dashboard/sellers/edit/:id"},CUSTOMERS:{INDEX:"/dashboard/customers",CREATE:"/dashboard/customers/create",EDIT:"/dashboard/customers/edit/:id",DETAILS:"/dashboard/customers/details/:id"},ORDERS:{HUB:"/dashboard/orders-hub",INDEX:"/dashboard/orders",DETAILS:"/dashboard/orders/details/:id",EDIT:"/dashboard/orders/edit/:id"},RETURNS:{INDEX:"/dashboard/returns",DETAILS:"/dashboard/returns/details/:id",CREATE:"/dashboard/orders/:orderId/return/new"},STORE_CREDIT:{INDEX:"/dashboard/store-credit"},REVIEWS:{INDEX:"/dashboard/reviews"},WISHLISTS:{INDEX:"/dashboard/wishlists"}
2,AUDIT_LOG:{INDEX:"/dashboard/audit-log"},LEARNING_CENTER:{INDEX:"/dashboard/learning-center",DASHBOARD_GUIDE:"/dashboard/learning-center/dashboard-overview",GETTING_STARTED:"/dashboard/learning-center/getting-started",SEO_GUIDE:"/dashboard/learning-center/seo-guide",PRICING_GUIDE:"/dashboard/learning-center/pricing-guide",SUBSCRIPTIONS_GUIDE:"/dashboard/learning-center/subscriptions-guide",DESIGN_GUIDELINES:"/dashboard/learning-center/design-guidelines",AI_GENERATION:"/dashboard/learning-center/ai-generation",PRODUCT_UPLOAD:"/dashboard/learning-center/product-upload",STORE_OPTIMIZATION:"/dashboard/learning-center/store-optimization",SELLER_BUILDER_GUIDE:"/dashboard/learning-center/seller-builder-guide",STORE_SETTINGS_GUIDE:"/dashboard/learning-center/store-settings-guide",SHIPPING_GUIDE:"/dashboard/learning-center/shipping-guide",INVENTORY_GUIDE:"/dashboard/learning-center/inventory-guide",COUPONS_GUIDE:"/dashboard/learning-center/coupons-guide",ORDERS_GUIDE:"/dashboard/learning-center/orders-guide",SIZE_GUIDES:"/dashboard/learning-center/size-guides",DOMAINS_GUIDE:"/dashboard/learning-center/domains-guide",WHATSAPP_GUIDE:"/dashboard/learning-center/whatsapp-guide",ANALYTICS_GUIDE:"/dashboard/learning-center/analytics-guide",CART_RECOVERY_GUIDE:"/dashboard/learning-center/cart-recovery-guide",WALLET_GUIDE:"/dashboard/learning-center/wallet-guide",CUSTOMERS_GUIDE:"/dashboard/learning-center/customers-guide",CATEGORIES_GUIDE:"/dashboard/learning-center/categories-guide",RETURNS_GUIDE:"/dashboard/learning-center/returns-guide",PRODUCT_LABELS_GUIDE:"/dashboard/learning-center/product-labels-guide",STORE_CREDIT_GUIDE:"/dashboard/learning-center/store-credit-guide",USERS_GUIDE:"/dashboard/learning-center/users-guide",API_TOKENS_GUIDE:"/dashboard/learning-center/api-tokens-guide",ACCOUNTING_GUIDE:"/dashboard/learning-center/accounting-guide",MARKETING_ASSISTANT_GUIDE:"/dashboard/learning-center/marketing-assistant-guide",AI_ASSISTANT_GUIDE:"/dashboard/learning-center/ai-assistant-guide"}},Og="/api-docs",Hn="https://cdn.packman.ai",Go="https://shop.packman.ai",an=e=>{if(e)return String(e).toLowerCase()},Dg=e=>{if(!e)return;const n=e.systemCountry;if(n)return typeof n=="string"?an(n):an(n.code)||an(n.iso)||an(n.iso2)||an(n.iso3)||an(n.isoCode)||an(n.countryCode)||an(n.slug)},Un=(e=null)=>{if(typeof window>"u")return!1;const n=e||window.location.pathname;return[m.ONBOARDING.START,m.ONBOARDING.BUILDER,m.ONBOARDING.VERIFY_OTP].some(s=>n===s||n===`${s}/`||n.endsWith(s))},Lg=(e=null)=>{if(Un(e))return"ae";const n=typeof ae?.getState=="function"?ae.getState():null,r=n?.store?.selectedStore,s=Dg(r)||n?.systemCountry;return an(s)},We=(e,n={})=>{const[r,s=""]=e.split("?");if(Un(r)){const l=new URLSearchParams(s);Object.entries(n).forEach(([g,y])=>{y!=null&&l.set(g,y)});const i=l.toString();return i?`${r}?${i}`:r}const o=Lg(),d=new URLSearchParams(s);o&&d.set("sc",o),Object.entries(n).forEach(([l,i])=>{i!=null&&d.set(l,i)});const u=d.toString();return u?`${r}?${u}`:r},fs=(e,n,r={})=>{const s=We(n,r);e(s)},ZC=(e,n,r={})=>{const s=typeof window<"u"?window.history.state?.idx:void 0;if(typeof s!="number"||s>0){e(-1);return}fs(e,n,r)},Ug="G-4PKVQP3F56",$o="production",Mg="/ingest",Gg="production",Ul="AW-18117877331",$g="3uibCMbbpdJcEN08o79D",Ml="7YzuCJixpt0cENO8o79D",He="production",Vg=.25,Vo=NaN,Fg=Number.isFinite(Vo)?Math.min(1,Math.max(0,Vo)):Vg;function ys(...e){}let Fo=!1;function Gl(){return typeof window<"u"}function zg(){Fo||typeof window.gtag!="function"||(Fo=!0,window.gtag("config",Ul))}function Tt(e,n={},r={}){if(typeof window.fbq=="function"){if(r.eventId){window.fbq("track",e,n,{eventID:r.eventId});return}window.fbq("track",e,n)}}function ro(e,n={}){!e||typeof window.gtag!="function"||window.gtag("event","conversion",{send_to:`${Ul}/${e}`,...n})}function $l(e){return{AED:"ae",SAR:"sa",OMR:"om"}[String(e||"").toUpperCase()]||""}function Wt({systemCountry:e,currency:n,plan:r,order:s}={}){return(e||r?.systemCountry?.code||r?.systemCountryCode||s?.systemCountry?.code||s?.systemCountryCode||$l(n||s?.currency||r?.currency)||"").toLowerCase()}function kr(e,{systemCountry:n}={}){if(e)return{item_id:String(e.id||""),item_name:e.name||"Subscription",item_category:e.category||"subscription",item_category2:n||Wt({plan:e})||void 0,price:Number(e.price||0),quantity:1}}const so=()=>Gl()&&typeof window.gtag=="function"&&!0;function Wg(){Gl()&&(Al(),zg(),Gp({apiKey:"phc_rrtqMEugBJVeG5HJNFXjvLVw6w24zDSL9nfHzXzWwjT2",host:Mg,portal:Un()?"onboarding":"seller",environment:Gg,sessionRecordingSampleRate:Fg}))}function Bg(e,n={}){const r=gt();rl({portal:Un(e)?"onboarding":"seller"}),$p({path:e,journey_id:r.journeyId,entry_source:r.entrySource,...n}),so()&&window.gtag("event","page_view",{page_path:e,page_location:window.location.href,page_title:document.title,journey_id:r.journeyId,entry_source:r.entrySource,tracking_env:He,...n}),Tt("PageView")}function Je(e,n={}){e&&(Vp(e,n),so()&&window.gtag("event",e,n))}function qg({method:e="token",role:n="seller"}={}){Je("seller_logged_in",{method:e,role:n,tracking_env:He})}function ej({productId:e,storeId:n,creationMode:r="manual"}={}){Je("product_created",{...e?{product_id:String(e)}:{},...n?{store_id:String(n)}:{},creation_mode:r,tracking_env:He})}function tj({productId:e,storeId:n,creationMode:r="manual"}={}){Je("product_updated",{...e?{product_id:String(e)}:{},...n?{store_id:String(n)}:{},creation_mode:r,tracking_env:He})}function nj({orderId:e,action:n,fromStatus:r,toStatus:s,storeId:a}={}){Je("order_processed",{...e?{order_id:String(e)}:{},...n?{action:n}:{},...r?{from_status:String(r).toLowerCase()}:{},...s?{to_status:String(s).toLowerCase()}:{},...a?{store_id:String(a)}:{},tracking_env:He})}function rj({itemCount:e,action:n="bulk_edit",storeId:r}={}){Je("inventory_changed",{action:n,...e?{item_count:Number(e)}:{},...r?{store_id:String(r)}:{},tracking_env:He})}function sj({settingsGroup:e,storeId:n}={}){Je("settings_updated",{...e?{settings_group:e}:{},...n?{store_id:String(n)}:{},tracking_env:He})}function aj({area:e="theme",storeId:n,templateId:r}={}){Je("theme_customized",{area:e,...n?{store_id:String(n)}:{},...r?{template_id:String(r)}:{},tracking_env:He})}function oj({feature:e,surface:n,storeId:r}={}){!e&&!n||Je("ai_feature_used",{...e?{feature:e}:{},...n?{surface:n}
2:{},...r?{store_id:String(r)}:{},tracking_env:He})}function ij({action:e,domain:n,storeId:r}={}){e&&Je("domain_action",{action:e,...n?{domain:String(n)}:{},...r?{store_id:String(r)}:{},tracking_env:He})}function cj({method:e="email",userId:n,onboardingId:r,storeType:s}={}){const a=gt({userId:n?String(n):void 0,onboardingId:r?String(r):void 0,storeType:s}),o=`seller_signup_${a.journeyId||"unknown"}`,d={method:e,event_id:o,journey_id:a.journeyId,entry_source:a.entrySource,system_country:a.systemCountry||a.sc,store_type:s||a.storeType,onboarding_id:a.onboardingId,tracking_env:He};Je("sign_up",d),Tt("CompleteRegistration",{content_name:"seller_signup",status:"completed",journey_id:a.journeyId},{eventId:o}),ro($g,{value:1,currency:"AED"})}function lj({onboardingId:e,storeType:n,entrySource:r}={}){const s=gt({onboardingId:e?String(e):void 0,storeType:n}),a={onboarding_id:s.onboardingId,store_type:n||s.storeType,journey_id:s.journeyId,entry_source:r||s.entrySource,system_country:s.systemCountry||s.sc,tracking_env:He};Je("onboarding_started",a),Tt("Lead",{content_name:"onboarding_started",content_category:"onboarding"})}function dj({onboardingId:e,step:n,stepIndex:r,nextStep:s,storeType:a}={}){if(!n)return;const o=gt({onboardingId:e?String(e):void 0,storeType:a}),d={onboarding_id:o.onboardingId,step:n,...r?{step_index:r}:{},...s?{next_step:s}:{},store_type:a||o.storeType,journey_id:o.journeyId,entry_source:o.entrySource,system_country:o.systemCountry||o.sc,tracking_env:He};Je("onboarding_step_completed",d)}function uj({onboardingId:e,step:n,stepIndex:r,reason:s,storeType:a}={}){if(!n)return;const o=gt({onboardingId:e?String(e):void 0,storeType:a}),d={onboarding_id:o.onboardingId,step:n,...r?{step_index:r}:{},...s?{abandon_reason:s}:{},store_type:a||o.storeType,journey_id:o.journeyId,entry_source:o.entrySource,system_country:o.systemCountry||o.sc,tracking_env:He};Je("onboarding_step_abandoned",d)}function pj({onboardingId:e,hasInstagram:n}={}){const r=gt({onboardingId:e?String(e):void 0}),s={onboarding_id:r.onboardingId,has_instagram:!!n,journey_id:r.journeyId,entry_source:r.entrySource,system_country:r.systemCountry||r.sc,tracking_env:He};Je("onboarding_images_submitted",s)}function mj({onboardingId:e,hasTradeLicense:n,hasProductToSell:r,outcome:s}={}){const a=gt({onboardingId:e?String(e):void 0}),o={onboarding_id:a.onboardingId,has_trade_license:!!n,has_product_to_sell:!!r,outcome:s,journey_id:a.journeyId,entry_source:a.entrySource,system_country:a.systemCountry||a.sc,tracking_env:He};Je("onboarding_questionnaire_completed",o)}function gj({onboardingId:e}={}){const n=gt({onboardingId:e?String(e):void 0}),r={onboarding_id:n.onboardingId,lead_type:"trade_license_no_product",journey_id:n.journeyId,entry_source:n.entrySource,system_country:n.systemCountry||n.sc,tracking_env:He};Je("generate_lead",r),Tt("Lead",{content_name:"trade_license_lead",content_category:"onboarding"})}function hj({onboardingId:e,storeType:n}={}){const r=gt({onboardingId:e?String(e):void 0,storeType:n}),s={onboarding_id:r.onboardingId,store_type:n||r.storeType,journey_id:r.journeyId,entry_source:r.entrySource,tracking_env:He};Je("email_verified",s)}function fj({plan:e,category:n,systemCountry:r}={}){if(!e)return;const s=gt(),a=Wt({systemCountry:r,plan:e,currency:e.currency}),o=kr(e,{systemCountry:a}),d={currency:e.currency,value:Number(e.price||0),items:o?[o]:[],item_list_name:n?`subscription_${n}`:"subscription_plans",item_list_id:n||"subscription_plans",system_country:a||void 0,journey_id:s.journeyId,entry_source:s.entrySource,tracking_env:He};ys("trackSubscriptionPlanViewed()",{id:e.id,name:e.name,country:a}),Je("view_item",d),Tt("ViewContent",{content_type:"product",content_name:e.name,content_category:a?`subscription_${a}`:"subscription",content_ids:e.id!=null?[String(e.id)]:void 0,currency:e.currency,value:Number(e.price||0)})}function yj({packageData:e,currency:n,systemCountry:r}={}){const s=e;if(!s)return;const a=gt(),o=n||s.currency,d=Wt({systemCountry:r,currency:o}),u=Tr(s,{currency:o,systemCountry:d}),l=Number(s.price??s.customAmount??0),i={currency:o,value:l,items:u?[u]:[],item_list_name:d?`wallet_credit_packages_${d}`:"wallet_credit_packages",item_list_id:"wallet_credit_packages",system_country:d||void 0,journey_id:a.journeyId,entry_source:a.entrySource,tracking_env:He};ys("trackWalletPackageViewed()",{id:s.id,name:s.name,country:d}),Je("view_item",i),Tt("ViewContent",{content_type:"product",content_name:s.name||"credit_package",content_category:d?`wallet_${d}`:"wallet",content_ids:s.id!=null?[String(s.id)]:void 0,currency:o,value:l})}function bj({plans:e,category:n,systemCountry:r}={}){const s=Array.isArray(e)?e:[],a=gt(),o=Wt({systemCountry:r,plan:s[0],currency:s[0]?.currency}),d={item_list_name:n?`subscription_${n}`:"subscription_plans",item_list_id:n||"subscription_plans",items:s.map(u=>kr(u,{systemCountry:o}
2)).filter(Boolean),system_country:o||void 0,journey_id:a.journeyId,entry_source:a.entrySource,tracking_env:He};ys("trackSubscriptionPlansViewed()",{count:s.length,category:n,country:o}),Je("view_item_list",d),Tt("ViewContent",{content_type:"product_group",content_name:d.item_list_name,content_category:o?`subscription_${o}`:"subscription",content_ids:s.map(u=>u?.id!=null?String(u.id):"").filter(Boolean)})}function xj({order:e,plan:n,systemCountry:r}={}){if(!e)return;const s=gt(),a=Wt({systemCountry:r,order:e,plan:n,currency:e.currency}),o={currency:e.currency,value:Number(e.total||0),items:[kr(n,{systemCountry:a})].filter(Boolean),transaction_id:e.orderNumber,system_country:a||void 0,journey_id:s.journeyId,entry_source:s.entrySource,tracking_env:He};Je("begin_checkout",o),Tt("InitiateCheckout",{currency:e.currency,value:Number(e.total||0),content_name:n?.name||"Subscription",content_category:a?`subscription_${a}`:"subscription"})}function _j({order:e,plan:n,paymentType:r,systemCountry:s}={}){if(!e)return;const a=sr()||gt(),o=Wt({systemCountry:s,order:e,plan:n,currency:e.currency}),d={currency:e.currency,value:Number(e.total||0),items:[kr(n,{systemCountry:o})].filter(Boolean),transaction_id:e.orderNumber,payment_type:r||"card",system_country:o||void 0,journey_id:a.journeyId,entry_source:a.entrySource,tracking_env:He};Je("add_payment_info",d),Tt("AddPaymentInfo",{currency:e.currency,value:Number(e.total||0),content_name:n?.name||"Subscription",content_category:o?`subscription_${o}`:"subscription"})}function wj({order:e,plan:n,orderId:r,systemCountry:s}={}){if(!e)return;const a=sr()||gt(),o=Wt({systemCountry:s,order:e,plan:n,currency:e.currency}),d=`seller_subscription_paid_${r||e.id||e.orderNumber||"unknown"}`,u={transaction_id:e.orderNumber,currency:e.currency,value:Number(e.total||0),items:[kr(n,{systemCountry:o})].filter(Boolean),journey_id:a.journeyId,entry_source:a.entrySource,plan_name:n?.name,billing_cycle:n?.billingCycle,system_country:o||void 0,event_id:d,tracking_env:He};Je("purchase",u),Tt("Subscribe",{currency:e.currency,value:Number(e.total||0),content_name:n?.name||"Subscription",content_category:o?`subscription_${o}`:"subscription",content_ids:n?.id?[String(n.id)]:void 0},{eventId:d}),ro(Ml,{value:Number(e.total||0),currency:e.currency,transaction_id:e.orderNumber})}function Tr(e,{currency:n,systemCountry:r}={}){if(!e)return null;const s=Number(e.price??e.customAmount??0);return{item_id:e.id!=null?String(e.id):"custom",item_name:e.name||(e.customAmount?"custom_credits":"credit_package"),item_category:"wallet_credits",item_category2:r||void 0,item_variant:e.id!=null?"package":"custom",price:s,quantity:1,currency:n||e.currency}}function vj({packages:e,currency:n,systemCountry:r}={}){const s=Array.isArray(e)?e:[],a=gt(),o=Wt({systemCountry:r,currency:n}),d={item_list_name:o?`wallet_credit_packages_${o}`:"wallet_credit_packages",item_list_id:"wallet_credit_packages",items:s.map(u=>Tr(u,{currency:n,systemCountry:o})).filter(Boolean),currency:n,system_country:o||void 0,journey_id:a.journeyId,entry_source:a.entrySource,tracking_env:He};ys("trackWalletPackagesViewed()",{count:s.length,currency:n,country:o}),Je("view_item_list",d),Tt("ViewContent",{content_type:"product_group",content_name:d.item_list_name,content_category:o?`wallet_${o}`:"wallet",content_ids:s.map(u=>u?.id!=null?String(u.id):"").filter(Boolean),currency:n})}function Ej({packageData:e,currency:n,amount:r,systemCountry:s}={}){const a=e||{},o=n||a.currency,d=Wt({systemCountry:s,currency:o}),u=Number(r??a.price??a.customAmount??0),l=gt(),i={currency:o,value:u,items:[Tr(a,{currency:o,systemCountry:d})].filter(Boolean),system_country:d||void 0,journey_id:l.journeyId,entry_source:l.entrySource,tracking_env:He};Je("begin_checkout",i),Tt("InitiateCheckout",{currency:o,value:u,content_name:a.name||"wallet_credits",content_category:d?`wallet_${d}`:"wallet"})}function Sj({packageData:e,paymentData:n,currency:r,systemCountry:s}={}){const a=e||{},o=r||n?.currency||a.currency,d=Wt({systemCountry:s,currency:o}),u=Number(n?.amount??a.price??a.customAmount??0),l=sr()||gt(),i={currency:o,value:u,items:[Tr(a,{currency:o,systemCountry:d}
2)].filter(Boolean),payment_type:"card",system_country:d||void 0,journey_id:l.journeyId,entry_source:l.entrySource,tracking_env:He};Je("add_payment_info",i),Tt("AddPaymentInfo",{currency:o,value:u,content_name:a.name||"wallet_credits",content_category:d?`wallet_${d}`:"wallet"})}function Aj({packageData:e,paymentData:n,intentionId:r,systemCountry:s}={}){const a=e||{},o=n?.currency||a.currency,d=Wt({systemCountry:s,currency:o}),u=Number(n?.amount??a.price??a.customAmount??0);if(!u)return;const l=sr()||gt(),i=r||n?.intentionId||n?.orderId||`wallet_${Date.now()}`,g=`wallet_credits_purchased_${i}`,y={transaction_id:String(i),currency:o,value:u,items:[Tr(a,{currency:o,systemCountry:d})].filter(Boolean),credits_purchased:Number(n?.totalCredits??a.credits??0),system_country:d||void 0,journey_id:l.journeyId,entry_source:l.entrySource,event_id:g,tracking_env:He};Je("purchase",y),Tt("Purchase",{currency:o,value:u,content_name:a.name||"wallet_credits",content_category:d?`wallet_${d}`:"wallet",content_ids:a.id!=null?[String(a.id)]:void 0},{eventId:g}),ro(Ml,{value:u,currency:o,transaction_id:String(i)})}function Kg({userId:e,role:n,storeId:r,storeUid:s,storeName:a,plan:o,systemCountry:d,currency:u}={}){const l=(d||$l(u)||"").toLowerCase();if(e&&(Fp(e,{role:n||"seller",environment:$o,...r?{store_id:String(r)}:{},...o?{plan:o}:{},...l?{system_country:l}:{}}),r&&(zp("store",r,{...s?{uid:String(s)}:{},...a?{name:a}:{},...o?{plan:o}:{},...l?{system_country:l}:{}}),rl({store_id:String(r),...s?{store_uid:String(s)}:{},...a?{store_name:a}:{}}))),!so())return;e&&window.gtag("config",Ug,{user_id:String(e),send_page_view:!1});const i={environment:$o};n&&(i.role=n),r&&(i.store_id=String(r)),s&&(i.store_uid=String(s)),o&&(i.plan=o),l&&(i.system_country=l),u&&(i.currency=String(u).toUpperCase()),window.gtag("set","user_properties",i)}function Hg(){Wp()}function Yg(){return t.jsx("iframe",{src:"/api-docs.html",style:{width:"100%",height:"100vh",border:"none",display:"block"},title:"Packman Store API Reference"})}function Qg(e){return e?.data?.data||e?.data||e||null}function Xg({uid:e,sessionToken:n}){n&&no(n),e&&n&&hs(e,n)}function Jg(e){const n=ae.getState?.()?.onboarding?.sessionToken;return n||hg(e)||null}function Nj(e){const n=Qg(e);return!n?.id||!n?.uid?null:(Il(n.id),Rl(n.uid),n.sessionToken&&Xg({uid:n.uid,sessionToken:n.sessionToken}),n)}const Zg=[/\/on-boardings(\/|$|\?)/,/\/ai\/analyze-onboarding-images(\/|$|\?)/,/\/ai\/tasks\/[^/?]+\/status(\/|$|\?)/];function eh(e){const n=`${e?.baseURL||""}${e?.url||""}`.toLowerCase();return!n||/\/auth\//.test(n)?!1:Zg.some(r=>r.test(n))}function kj(e){if(e)return{headers:{"X-Onboarding-Session-Token":e}}}function bs(){no(null),to()}const Pt=(e,n={})=>{const r=typeof window<"u"?window.location.pathname+window.location.search:"";console.warn(`[auth-debug] ${e}`,{path:r,t:Date.now(),...n})},th=6e4,nh="store-preview:invalidated";function Tj(e){try{const n=e.split(".")[1];if(!n)return null;const r=n.replace(/-/g,"+").replace(/_/g,"/"),s=JSON.parse(decodeURIComponent(atob(r).split("").map(a=>"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)).join("")));return typeof s.exp=="number"?s.exp*1e3:null}catch{return null}}const rs=Pa(Oa(e=>({tokens:{},setToken:(n,r,s)=>e(a=>({tokens:{...a.tokens,[n]:{token:r,expiresAt:s}}})),clearToken:n=>e(r=>{if(!(n in r.tokens))return r;const s={...r.tokens};return delete s[n],{tokens:s}}),clearAll:()=>e({tokens:{}})}),{name:"store-preview-tokens",partialize:e=>({tokens:e.tokens})}));function Cj(e){const n=rs.getState().tokens[e];return n?n.expiresAt-th<=Date.now()?(rs.getState().clearToken(e),null):n.token:null}if(typeof window<"u"&&Go){let e=null;try{e=new URL(Go).origin}catch{e=null}e&&window.addEventListener("message",n=>{if(n.origin!==e)return;const r=n.data;!r||typeof r!="object"||r.source!=="store-preview"||r.type!=="unauthorized"||(rs.getState().clearAll(),window.dispatchEvent(new Event(nh)))})}const Nt=new Sd({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:5*60*1e3}}}),rh="packman.packmanAiProductDraft",sh=()=>{if(!(typeof window>"u"))try{const e=[];for(let n=0;n<window.localStorage.length;n+=1){const r=window.localStorage.key(n);r&&r.startsWith(rh)&&e.push(r)}e.forEach(n=>{try{window.localStorage.removeItem(n)}catch{}})}catch{}},Vl="auth-storage",zo=()=>
2{if(Hg(),Nr(),Nt.clear(),sh(),rs.getState().clearAll(),typeof window<"u")try{window.localStorage.removeItem("v2_pending_registration")}catch{}},qe=Pa(Oa(e=>({isAuthenticated:!1,user:null,onboardingUser:null,token:null,setUser:n=>e({user:n}),setToken:n=>e({token:n,isAuthenticated:!!n}),login:({token:n})=>e({isAuthenticated:!0,token:n}),logout:()=>{e({isAuthenticated:!1,user:null,token:null}),zo();try{Pl(),jl()}catch{}},signOutPreservingOnboarding:()=>{e({isAuthenticated:!1,user:null,token:null}),zo()},setOnboardingUser:n=>e({onboardingUser:n})}),{name:Vl,partialize:e=>({token:e.token,onboardingUser:e.onboardingUser,user:e.user,isAuthenticated:e.isAuthenticated}),onRehydrateStorage:()=>e=>{e&&(e.isAuthenticated!==!!e.token&&Pt("auth-store rehydrate normalized stale flag",{persistedIsAuthenticated:e.isAuthenticated,persistedHasToken:!!e.token}),e.isAuthenticated=!!e.token)}})),ks=e=>{try{const n=qe.getState();qe.persist.rehydrate();const r=qe.getState();(n.isAuthenticated!==r.isAuthenticated||!!n.token!=!!r.token)&&Pt("cross-tab rehydrate changed auth state",{trigger:e,beforeIsAuthenticated:n.isAuthenticated,beforeHasToken:!!n.token,afterIsAuthenticated:r.isAuthenticated,afterHasToken:!!r.token}),r.token&&n.token!==r.token&&(Nt.clear(),Nr())}catch{}};if(typeof window<"u"){{const{isAuthenticated:e,token:n}=qe.getState();Pt("boot: hydrated auth state",{isAuthenticated:e,hasToken:!!n,referrer:document.referrer||null})}window.addEventListener("storage",e=>{e.key===Vl&&ks("storage-event")}),window.addEventListener("focus",()=>ks("focus")),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&ks("visibilitychange")})}const jj=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:qe},Symbol.toStringTag,{value:"Module"})),ah="mcp_state";function br(){if(typeof window>"u")return null;try{const n=new URLSearchParams(window.location.search).get(ah);return n&&n.length>0?n:null}catch(e){return console.warn("Failed to read mcp_state from URL",e),null}}const pa="packman:mcp_state";function oh(e){if(!(typeof window>"u"||!e))try{window.sessionStorage.setItem(pa,e)}catch(n){console.warn("Failed to stash mcp_state",n)}}function ih(){const e=br();if(e)return e;if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(pa);if(n)return window.sessionStorage.removeItem(pa),n}catch(n){console.warn("Failed to read pending mcp_state",n)}return null}let Rn=!1;function ma(){return Rn}async function Cr(e){const n=ih();if(!n||!e)return!1;Rn=!0;const r=Le?.()||"ae",s=q("POST",`${r}/auth/mcp/handoff`);try{const a=await s(null,{mcp_state:n}),o=a?.data?.redirect_url||a?.data?.data?.redirect_url||a?.redirect_url;return!o||typeof o!="string"?(console.warn("MCP handoff response missing redirect_url",a),Rn=!1,!1):(window.location.replace(o),!0)}catch(a){return console.warn("MCP handoff failed",a),Rn=!1,!1}}async function ch(){const e=br();if(!e)return!1;Rn=!0;
2const n=Le?.()||"ae",r=q("POST",`${n}/auth/mcp/demo-handoff`);try{const s=await r(null,{mcp_state:e}),a=s?.data?.redirect_url||s?.data?.data?.redirect_url||s?.redirect_url;return!a||typeof a!="string"?(console.warn("MCP demo handoff response missing redirect_url",s),Rn=!1,!1):(window.location.replace(a),!0)}catch(s){throw console.warn("MCP demo handoff failed",s),Rn=!1,s}}const It=()=>{try{const n=ae.getState?.()?.systemCountry;if(n)return String(n).toLowerCase()}catch(e){console.warn("Failed to access store state for system country",e)}return"ae"},Mn={login:(e,n)=>{const r=It();return q("POST",`${r}/auth/sellers/login`)(e,n)},resendOtp:(e,n)=>{const r=It();return q("POST",`${r}/auth/sellers/login`)(e,n)},logout:(e,n)=>{const r=It();return q("POST",`${r}/auth/sellers/logout`)(e,n)},verifyOtp:(e,n)=>{const r=It();return q("POST",`${r}/auth/sellers/otp/verify`)(e,n)},getProfile:(e,n)=>{const r=It();return q("GET",`${r}/sellers/profile`)(e,n)},updateSellerProfile:(e,n)=>{const r=It();return q("PATCH",`${r}/sellers/update-profile`)(e,n)},updateProfile:(e,n)=>{const r=e?.userId||"",a=`${It()}/users/${r}`;return q("PATCH",a)(null,n)},requestContactChange:(e,n)=>{const r=It();return q("POST",`${r}/auth/sellers/profile/contact-change/request`)(e,n)},verifyContactChange:(e,n)=>{const r=It();return q("POST",`${r}/auth/sellers/profile/contact-change/verify`)(e,n)},checkResetPasswordToken:e=>{const r=`${It()}/auth/users/verify-reset-password-token?token=${e?.token}`;return q("POST",r)(null,{})},resetPassword:(e,n)=>{const s=`${It()}/auth/users/reset-password?token=${e?.token}`;return q("POST",s)(null,n)}},Lt=Er("auth"),_t={...Lt,login:()=>[...Lt.all,"login"],logout:()=>[...Lt.all,"logout"],verifyOtp:()=>[...Lt.all,"verifyOtp"],resendOtp:()=>[...Lt.all,"resendOtp"],profile:()=>[...Lt.all,"profile"],session:()=>[...Lt.all,"session"],checkResetPasswordToken:()=>[...Lt.all,"checkResetPasswordToken"],resetPassword:()=>[...Lt.all,"resetPassword"],requestContactChange:()=>[...Lt.all,"requestContactChange"],verifyContactChange:()=>[...Lt.all,"verifyContactChange"],updateSellerProfile:()=>[...Lt.all,"updateSellerProfile"]},lh=()=>mn(_t,e=>Mn.login(null,e),{onSuccess:()=>{}})(),Ij=()=>mn(_t,e=>Mn.resendOtp(null,e),{onSuccess:()=>{Nt.invalidateQueries({queryKey:_t.profile()})}})(),Rj=()=>{const{login:e,setUser:n}=qe();return mn(_t,r=>Mn.verifyOtp(null,r),{onSuccess:async({data:r})=>{const{token:s,seller:a}=r;Nt.clear(),Nr(),e({token:s}),n(a),bs();const o=typeof window<"u"?localStorage.getItem("language"):null;a?.preferredLanguage&&!o&&Ar(a.preferredLanguage),Nt.invalidateQueries({queryKey:_t.profile()}),await Cr(s)}})()},jr=(e={})=>{const{enabled:n=!0,...r}=e,{token:s,setUser:a,setToken:o,user:d}=qe();return $e({queryKey:_t.profile(),queryFn:async()=>{try{const{data:u}=await Mn.getProfile(),l=d&&u?.id!==d?.id;if(u){a(u),s&&o(s),l&&cr();const g=(Array.isArray(u?.sellerStores)?u.sellerStores:[]).map(f=>{const x=f?.store||{},v=x.subscriptions?.[0]||null;return{...x,activeSubscription:v,sellerStoreId:f?.id,sellerId:f?.sellerId,isOwner:f?.isOwner,sellerStoreMeta:f}});ua(g);const{store:y}=ae.getState(),p=y.selectedStore;if(l)g.length===1?Xt(g[0]):cr();else if(!p)g.length===1?Xt(g[0]):cr();else{const f=g.find(x=>x?.id===p?.id);f?Xt(f):g.length===1?Xt(g[0]):cr()}}else ua([]),cr(),Pt("profile query returned 2xx with empty data");return Pt("profile query succeeded",{storesCount:Array.isArray(u?.sellerStores)?u.sellerStores.length:0}),u??null}catch(u){throw Pt("profile query failed -> clearing token",{status:u?.response?.status??null,message:u?.message??String(u)}),o(null),u}},enabled:!!s&&!!n,staleTime:0,gcTime:0,retry:!1,...r})},dh=()=>{const{login:e,setUser:n}=qe();return mn(_t,r=>{const s=It();return q("POST",`${s}/auth/sellers/google/login`)(null,r)},{onSuccess:async({data:r})=>{const{token:s,seller:a}=r;Nt.clear(),Nr(),e({token:s}),n(a),bs();const o=typeof window<"u"?localStorage.getItem("language"):null;a?.preferredLanguage&&!o&&Ar(a.preferredLanguage),Nt.invalidateQueries({queryKey:_t.profile()}),await Cr(s)}})()},uh=()=>{const{login:e,setUser:n}=qe();return mn(_t,r=>
2{const s=It();return q("POST",`${s}/auth/sellers/apple/login`)(null,r)},{onSuccess:async({data:r})=>{const{token:s,seller:a}=r;Nt.clear(),Nr(),e({token:s}),n(a),bs();const o=typeof window<"u"?localStorage.getItem("language"):null;a?.preferredLanguage&&!o&&Ar(a.preferredLanguage),Nt.invalidateQueries({queryKey:_t.profile()}),await Cr(s)}})()},Pj=()=>mn(_t,e=>Mn.requestContactChange(null,e),{})(),Oj=()=>mn(_t,e=>Mn.verifyContactChange(null,e),{onSuccess:()=>{Nt.invalidateQueries({queryKey:_t.profile()})}})(),Dj=()=>mn(_t,e=>Mn.updateSellerProfile(null,e),{onSuccess:()=>{Nt.invalidateQueries({queryKey:_t.profile()})}})(),ph=bt("register","auth/sellers/register",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),mh=bt("forgot-password","auth/forgot-password",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),gh=bt("reset-password","auth/sellers/reset-password",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),hh=()=>_t.profile();ph.hooks.useCreate;mh.hooks.useCreate;gh.hooks.useCreate;function Et(...e){return Ad(Nd(e))}const fh=(e,n)=>e?{...e,...n}:null;function yh(){const[e,n]=c.useState(!1);return c.useEffect(()=>{if(window.AppleID){n(!0);return}const r=document.createElement("script");r.src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",r.async=!0,r.onload=()=>n(!0),document.head.appendChild(r)},[]),e}const bh=yo.object({email:yo.string().min(1,"Email is required").email("Invalid email format")});function xh(){const e=yt(),n=wt(),[r]=xr(),s=(r.get("email")||"").trim().toLowerCase(),{mutateAsync:a,data:o,isPending:d,isError:u,error:l}=lh(),{mutateAsync:i,isPending:g}=dh(),{mutateAsync:y,isPending:p}=uh(),f=yh(),[x,v]=c.useState(""),[S,_]=c.useState("whatsapp"),[w,C]=c.useState(!1),[k,L]=c.useState(""),A=c.useMemo(()=>{if(!u)return"";const de=l?.response?.data?.message||l?.message||"something_went_wrong";return de==="seller_not_found"?e.t_auth_account_not_found_or_unverified||"Account not found. If you completed onboarding, verify your email first.":e[de]||e[`t_${de}`]||e.t_something_went_wrong||de},[u,l,e]),{register:E,handleSubmit:j,formState:{errors:H},setError:D,setValue:$}=kd({resolver:Td(bh),defaultValues:{email:s||""}});c.useEffect(()=>{s&&$("email",s,{shouldValidate:!0})},[s,$]);const re=async de=>{try{oh(br()),await a({...de,channel:S})}catch(Ne){Ne.response?.data?.errors?Object.entries(Ne.response.data.errors).forEach(([ue,ve])=>{D(ue,{type:"server",message:ve})}):D("root",{type:"server",message:Ne.message||"Failed to login"})}},pe=c.useCallback(async de=>{v("");try{await i({accessToken:de.access_token}),ma()||n(m.AUTH.SELECT_STORE,{replace:!0})}catch(Ne){const ue=Ne?.response?.data?.message||Ne?.message||"Google login failed";v(e[ue]||e[`t_${ue}`]||ue)}},[i,n,e]),te=Cd({flow:"implicit",onSuccess:pe,onError:()=>v(e.t_google_login_failed||"Google login failed")}),R=c.useCallback(async()=>{v("");const de="com.packman.seller.web",Ne="https://seller.packman.ai";try{const ue=window.AppleID;if(!ue)return;ue.auth.init({clientId:de,scope:"name email",redirectURI:Ne,usePopup:!0});const ve=await ue.auth.signIn(),{authorization:Ve}=ve;await y({idToken:Ve.id_token}),ma()||n(m.AUTH.SELECT_STORE,{replace:!0})}catch(ue){if(ue?.error==="popup_closed_by_user")return;const ve=ue?.response?.data?.message||ue?.message||"Apple login failed";v(e[ve]||e[`t_${ve}`]||ve)}},[y,n,e]),B=c.useCallback(async()=>{L(""),C(!0);try{await ch()}catch(de){const Ne=de?.response?.data?.message||de?.message||"Demo login is not available right now.";L(e[Ne]||e[`t_${Ne}`]||Ne),C(!1)}},[e]);c.useEffect(()=>{if(o){const de=o?.data,Ne=de?.email,ue=de?.channel||S,ve=de?.maskedPhone||"";n(`/auth/verify-otp?email=${encodeURIComponent(Ne)}&channel=${ue}${ve?`&maskedPhone=${encodeURIComponent(ve)}`:""}`)}},[o]);const[U,K]=c.useState(!1),[ee,he]=c.useState(""),fe=c.useRef(null),ie=c.useRef(""),me=Id(),Re=c.useCallback(async de=>{if(!(!de||!me||ie.current===de)){ie.current=de;try{const ue=await q("POST","ae/auth/sellers/passkey/login-options")(null,{email:de}),ve=ue?.data?.data||ue?.data||ue;if(ve?.available===!1)return;K(!0);const Ve=await jd({optionsJSON:ve}
2),Ge=await q("POST","ae/auth/sellers/passkey/login-verify")(null,{email:de,response:Ve}),Be=Ge?.data?.data||Ge?.data||Ge;Be?.token&&(qe.getState().login({token:Be.token}),bs(),await Cr(Be.token)||n(m.AUTH.SELECT_STORE,{replace:!0}))}catch(Ne){if(Ne?.name==="NotAllowedError"||Ne?.response?.status===404||Ne?.response?.status===400)return;const ue=Ne?.response?.data?.message||Ne?.message||"";ue&&he(e[ue]||e[`t_${ue}`]||ue)}finally{K(!1)}}},[me,n,e]),ke=c.useCallback(de=>{const Ne=de?.target?.value||"";fe.current&&clearTimeout(fe.current),he(""),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Ne.trim())&&(fe.current=setTimeout(()=>{Re(Ne.trim())},800))},[Re]),oe=g||p,se=!!br();return t.jsxs("form",{onSubmit:j(re),className:Et("flex flex-col gap-6"),children:[t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h1",{className:"text-2xl font-bold",children:e.t_login_to_your_account}),t.jsx("p",{className:"text-balance text-sm text-muted-foreground",children:e.t_enter_email_instruction})]}),se&&t.jsx("div",{className:"rounded-lg border border-brand/30 bg-brand/10 p-3 text-center text-xs text-foreground",children:e.t_mcp_connect_hint||"You're connecting an AI client to your Packman account. After signing in we'll redirect you back automatically."}),se&&t.jsxs("div",{className:"grid gap-2 rounded-lg border border-dashed border-brand/40 bg-brand/5 p-3",children:[t.jsxs(mt,{type:"button",variant:"outline",disabled:w||d||oe,onClick:B,className:"w-full",children:[w&&t.jsx(Qt,{size:"sm",className:"mr-2"}),w?e.t_please_wait:e.t_continue_as_demo_seller||"Continue as OpenAI demo seller"]}),t.jsx("p",{className:"text-center text-xs text-muted-foreground",children:e.t_mcp_demo_login_hint||"For app review only. Opens a demo store without OTP or passkey setup."}),k&&t.jsx("p",{className:"text-center text-xs text-red-500",children:k})]}),t.jsxs("div",{className:"grid gap-6 px-2",children:[t.jsx(Bp,{label:e.t_email,placeholder:e.t_email,errors:H,id:"email",...E("email",{onChange:ke})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:e.t_send_otp_via||"Send OTP via"}),t.jsxs("div",{className:"relative flex rounded-xl bg-gray-100 p-1",children:[t.jsx("div",{className:Et("absolute top-1 bottom-1 w-[calc(50%-4px)] rounded-lg transition-all duration-200 ease-out",S==="whatsapp"?"start-1 bg-[#25D366] shadow-md":"start-[calc(50%+2px)] bg-white shadow-sm")}),t.jsxs("button",{type:"button",onClick:()=>_("whatsapp"),className:Et("relative z-10 flex flex-1 items-center justify-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors duration-200",S==="whatsapp"?"text-white":"text-gray-400 hover:text-gray-600"),children:[t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})}),e.t_whatsapp||"WhatsApp"]}),t.jsxs("button",{type:"button",onClick:()=>_("email"),className:Et("relative z-10 flex flex-1 items-center justify-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors duration-200",S==="email"?"text-gray-900":"text-gray-400 hover:text-gray-600"),children:[t.jsx(Rd,{className:"h-4 w-4"}),e.t_email_label||"Email"]})]})]}),t.jsxs(mt,{disabled:d||oe,type:"submit",className:"w-full",children:[d&&t.jsx(Qt,{size:"sm",className:"mr-2",variant:"black"}),d?e.t_please_wait:e.t_next]}),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-0 flex items-center",children:t.jsx("div",{className:"w-full border-t border-gray-200"})}),t.jsx("div",{className:"relative flex justify-center text-xs",children:t.jsx("span",{className:"bg-white px-3 text-gray-400",children:e.t_or||"or"})})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(mt,{type:"button",variant:"outline",disabled:oe||d,onClick:()=>te(),className:"flex-1 py-2.5 rounded-lg font-medium text-sm flex items-center justify-center gap-2 transition-all hover:bg-gray-50 border-gray-300",children:[g?t.jsx(Qt,{size:"sm",className:"mr-1"}):t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 48 48",children:[t.jsx("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),t.jsx("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),t.jsx("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),t.jsx("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"})]}),e.t_sign_in_with_google||"Google"]}),t.jsxs(mt,{type:"button",variant:"outline",disabled:oe||d||!f,onClick:R,className:"flex-1 py-2.5 rounded-lg font-medium text-sm flex items-center justify-center gap-2 transition-all hover:bg-gray-900 hover:text-white border-gray-300",children:[p?t.jsx(Qt,{size:"sm",className:"mr-1"}):t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"
2currentColor",children:t.jsx("path",{d:"M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})}),e.t_sign_in_with_apple||"Apple"]})]}),x&&t.jsx("p",{className:"text-red-500 text-xs text-center",children:x})]}),U&&t.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(Pd,{className:"h-4 w-4 animate-pulse"}),e.t_authenticating||"Authenticating..."]}),ee&&t.jsx("p",{className:"text-red-500 text-xs text-center",children:ee})]}),u&&t.jsx(qp,{variant:"error",title:e.t_error,msg:A,icon:{Icon:Da}}),t.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[e.t_dont_have_account||"Don't have an account?"," ",t.jsx(On,{to:m.ONBOARDING.START,className:"font-medium text-brand-600 hover:underline",children:e.t_sign_up||"Sign up"})]})]})}const _h=()=>{const[e,n]=xr(),r=kt(),s=ae(l=>l.systemCountry),a=c.useRef(!1),o=Un(r.pathname),d=o?"ae":s||e.get("sc")||"ae";return c.useEffect(()=>{if(o){s!=="ae"&&Ns("ae");return}const l=e.get("sc");if(!a.current){if(s){if(l!==s){const g=new URLSearchParams(e);g.set("sc",s),n(g,{replace:!0})}a.current=!0;return}if(l){Ns(l),a.current=!0;return}const i=new URLSearchParams(e);i.set("sc",d),n(i,{replace:!0}),a.current=!0;return}if(s&&l!==s){const i=new URLSearchParams(e);i.set("sc",s),n(i,{replace:!0}),a.current=!0}},[s,o]),{systemCountry:d,updateSystemCountry:l=>{if(Ns(l),!o){const i=new URLSearchParams(e);i.set("sc",l),n(i,{replace:!0})}}}},wh=({children:e})=>{const{systemCountry:n}=_h();return c.useEffect(()=>{},[n]),e},vh=(e,n)=>{try{const r=e.get(n);if(!r)return null;let s=r;try{const a=bo.toString(s);return JSON.parse(a)}catch{console.log("Direct decode failed, trying with URL decode..."),s=decodeURIComponent(r),console.log("after URL decode:",s);const a=bo.toString(s);return JSON.parse(a)}}catch(r){return console.error(`Failed to decode ${n}:`,r),null}},Hr=e=>{if(!e)return null;const n=new Date(e);return Number.isNaN(n.getTime())?null:(typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e.trim())&&n.setHours(23,59,59,999),n)},Lj=e=>{if(!e)return null;if(e.trialEndsAt){const n=Hr(e.trialEndsAt);return n?Math.ceil((n-new Date)/(1e3*60*60*24)):null}if(e.endDate){const n=Hr(e.endDate);return n?Math.ceil((n-new Date)/(1e3*60*60*24)):null}if(!e.isAutoRenew&&e.nextBillingDate){const n=Hr(e.nextBillingDate);return n?Math.ceil((n-new Date)/(1e3*60*60*24)):null}return null},Eh=e=>!e||!Array.isArray(e)?null:e.find(n=>n.status==="active"&&!ls(n))||null,ga=e=>{if(!e)return!1;if(e.status==="trial")return!0;if(!e.trialEndsAt)return!1;const n=Hr(e.trialEndsAt);return n?new Date<n:!1},Ts=e=>e?e.status==="trial"||ga(e)?"Free Trial":e.plan?"Paid":"":"",er=e=>!e||e.status==="inactive"?!0:e.activeSubscription?ls(e.activeSubscription):e.subscriptions&&Array.isArray(e.subscriptions)?!Eh(e.subscriptions):!0,Sh="https://cdn.packman.ai/seller-dashboard-static-assets/assets/login-image-01-B0b8M_i-.png";function ao(){const e=ae(a=>a.language)||"en",n=ae(a=>a.setLanguage),{i18n:r}=_r(),s=c.useCallback(async a=>{if(n(a),typeof window<"u")try{localStorage.setItem("language",a)}catch(o){console.warn("Failed to persist language to localStorage",o)}await r.changeLanguage(a)},[r,n]);return c.useEffect(()=>{r.language!==e&&s(e)},[s,r.language,e]),c.useMemo(()=>({language:r.language||e,setLanguage:s}),[s,r.language,e])}function Ah({className:e=""}){const[n,r]=c.useState(!1),{language:s,setLanguage:a}=ao(),o=()=>{n||(r(!0),setTimeout(()=>{a(s==="en"?"ar":"en")},150),setTimeout(()=>{r(!1)},300))};return t.jsxs(mt,{variant:"outline",size:"sm",onClick:o,className:`flex items-center  overflow-hidden relative   ${s==="ar"?"font-arabic":""} ${e}`,dir:s==="ar"?"rtl":"ltr",children:[s==="ar"&&"🇺🇸",t.jsx("span",{className:`
3          inline-block transition-all duration-300  text-xs
4          ${n?"opacity-0 transform translate-y-4":"opacity-100 transform translate-y-0"}
5        `,children:s==="ar"?"English":"العربية"}),s==="en"&&"🇦🇪"]})}const Wo="data:image/png;base64,UklGRtYGAABXRUJQVlA4TMkGAAAvs8FeEBfCKJIkRbl4/k3efS+CeWwwbttGEo3pv7ltY973zO4ybtvIkTS3efvv8/6bGLRtI8iH4DoGR+GYPcSH8s9gDBbn4ywtE60tC5jqFDDVaenF0rOlZ2svxjotLVt6sfTCj2vvooXIAyyfr02UEkmJsKWYF7IXgu8N1A/CSZDCQOEEQHj8QH6aWyluTHiE+AkksQUJb/ATfq7flT43LAJMRn95dyj1mf04Ctq2YRL+sLvLICImgFc39abkWd0ImAVjhxVTirY2x4mc2fdNnmnbsmlNDAQytJEpKkrgdJSFev+nmp0qyeVsRPR/AmS51h63zSpMBDQoENFT0pYCYT4ZE1nuf2ceTkZE9D8oO01V1dbOnHOHGOOy/3jjP7mDL0cB4Yt3/tOb/uMYYzw456y1dVUZUkdT2Zk7xL7feADAbAXwftMv48FZW5mxVtWzQ+w3O8BMB7/po7O1GUemmh36DQQcjWG3WR5sPVpM7ZYbwNG628RZPS5Mfeh3OIaDX87q
5UWBmSx9wVAcfbdYZu9zhSPeHOs/MwQcc9bCamcwyB48quHH5ZJxHPQwrm0V2GVAZwRW5Yz2q5KrIGQeolt7migNUTW9zZAaonr7IDetRRVdFTpglail0+TALqKhQ5IFZobL+ngMWUF19kbxb1FiYpc38gkr7e8oKQLXdmGS9Dai4UCTqfUDVhSJJ71F7oUjQLeov1Mm5RQ3e14n5A3UYiqS8Ry2GIiFvUY+hSEYBioQ7k4gCUJVXifCozL8n4RbV2SZghvoMhXgFKBR68Vao0p1wDnV6X4hWgFKhF22Fat0JVqNe741coFj4q1gOVbuQCnTLC+VQua1MoF1eJIfqbSUC/fICOVTwQh7QsChOgxq+N9KsVAw7YQrUcS+MUzK0sgxaFkW5Qi3fi7JQM7SSgJ4tBLlCPd8L8oOioZVj0LQoRoGaPojhVA2NFCtdc1KArvVCXKGu74VwyoaVDB+0zckA2taLUGAuv3oq/+P75/qQGYjQZtOLO/n4gBkaCRb6ZiXw+tZJ8LO+9QJcob6BAK3CoeEXNa7m90HjHL9B4xb8UOO27HYqB+yiyqHhlnWu4rbqXMut6FzHbdO5BbeDzm2ZDXRgFtH3zPboaHhl9YrXWb3l1dUdr6IeeW3qC15Nved1UPesAjuw2rHvWUV2ZLW4V5zyh+zsbjmt7i2n7u44FfdukomcNvcFp+rec2pP6d5jvo8y6fCUHiDfFynxE1uAh4ktwu8nGZzY9vKGzyJfTWv5Q3aWt/986vLtJOP++fT2ISvy8b+Dqvxikun/30X7kB3kt5OMv/jPL3yLGyYZuIjoRQKfnc8Lvs9G151RffHfxX8X/138Nw3cT+Dd87nP9+7oSuGLs3mAfN+8ONeXk0JaL/77m9cwyfhJbd7U87N9PSncOdtXF//9/WDLp8n3fOpv7JFP+RXkTd7x6T+VLJ/zt8YsX/NZ5Kt/zBg+UZ6mtR38nlGAh4lt3OOTp3wfjwvPaN5jCp9fc99yqu79JLPgVNwjpzf3jlN3d5xWd8vp/CHL7jWnxd1wiu7Eece+ZxXYB1aT3fNq6lteVX3Bq6hHXl3d8VrVLa+sXvNa1A2vHfqeeAf0gdls5p5bNV9wezPvuK3mLbdsXnPbmxP3QD6wm03c89vEF/y6eMcvi1t+e3HDL4APJGDz3kpQvDsJ1hu5f7ZPnvJ9cv9cH+aPlWB/I6pqJAjcA4lYtdcydO1rGbJ2LUPABhKyWa+l6NbXUizWpRSDeiAxi/RCjpO0lSNCAwlandeSnJytJJEZSNSivJYlK5eyDOSBhC3G19JEYjDSzCK8JnGzcCnPaL5rEvjkW0o0mu6aRD7pljKNZrsmoY+2pVRzk12T2BEWSrlmd70mwUdT9ST6ETWUss1i2pHwo4r+ROJHUCjlmyfPhlJYNCMlcVTLBSUyNMndKRXzpTlCSelMjFBSShMilJTWE2EoKbUnQHhH6T3yQUkpTs0OSkrzS5XblZTqUN1+PFG6xx+1SGk/kYWGUh+rly8p/aFjhY7yMFUpX1Iuhs4UOsrJsBmtT5SZqfr4hjI0VRvfUKam6uIbythUSMK6ocwNvWqE306Uw6lAhL6hbA6pEATvTpTXIf158qFvTpTl8XV70sEfG8r5/+3cj6zgj82JxmBzvBlGURjmrqJxWbdzP4yWAH10FY3Wuj3O/TAiwnAzP7YVjeNT0x5j7wfItADDTR9dW51opJ+qpnHHOO+9HyDkC8Dgb/p5PLq2rk6kjqeqapqmdc7Fj/uP/WfhywUI8OX+0zf9xzHGeHTOtU1TV9WJshMA",Bo="data:image/png;base64,UklGRgYOAABXRUJQVlA4TPoNAAAvs4EfEL/BKJKkML334okE/FuEZG0waBvJka8fnOePrP8waBvJkbd8gff8qdzdL4O2bQT5GXQMjj+Lh/AMjsGPQeMcXzZ4Q+bCQ8ofWopwPHAocUgDkszy80MU80OJhuDhhxJTKIoZEC0QgaEwQjMpiYCj0AxEcf3zkX/qLCmZ277eT62Ttd+Ft23btLaRtk2QAC13xkaT6BQYn4o8VuZAKvYjyEmh/f//NQooSi/dPl8j+j8B/D86JnnxlH2wbAyMGugm/jiJa1OmJG2pGn+UxKqWbitN8kFSq2XVtu0pJykafYjksKRC1WBH2mPxISI/SaqSFCRk2dxXm9bv+1+eM1ZDFTIyRXJXCfzqX57fyHpNnp+MRuQZ+QdIiq4HAPKZJD9ELJY97SqsSfKM5QcIj4WD52MTkcxhP0KqxsUS7yRF+BFiUbjOiow5Vh8i/IKvTBOSNrWfTMWPEZbY0P3LyOKjhF9Udw9ZfjKm5L39V452JQbmUC74kXLH/z9Toq7ruovpui76a9B1XXeruvypKIqnLAkmeTrtFYO1nPIkoC4/7dXAqXJ6ym5N9JAXRfH0kHnqHp6KoijyLAqgy097NXCr7J+yC4mSvCiKIs/iaZ3fgWjZGgybfR7NFj3tDTzqLg4hyloDj5LHYXUzRmTU+Y0Goo1gpOTxlOXeYGT9FM+SnRQezf7BR+d5INoIRuoumwC/WS/aGEzVXTxLJvAv2VzxycC75AHFCu/Gkin8iuOTYPIuHvPLYPJ77Cs7GXjXfJrCb9eLdpgscRi/DHzqxlu0Ucy7i+eIBfPqf8Sh7OB/xXmiE3xqPhALfGrmJRPMq1k4vwx8bgKIBb419pMrZtcHb9EJ82seRg7/r5wnVnjeOH4ZeN5MywTzbwKJBZ7reK5Y4V8fPMSCIDeeMkWQeRDqT+08nwy8b0g+w/9mQnRCkPsohFjhXeN5VopZv076ZRDo2sszwlQbwjP8f+YsnwxmzPiMOdejMkWg+wBSxYwyz+xfx0U7hJt52CHQFQOI4b/gLKqYU0+YtUlG/EK47/PVmLW4pCYZE9cIWKNJOwRaMQT1V3Oey5ahE0J+mG3u5IKg0YgvCHo/ZYdAdRFCDu9qrxjWrvgYVBNdllwS9iNYBoVs3DNCtQwgVn8rXrPGxeQYEorLQnZJyEawDEpG5Qi1YAg7eH/lVcMfLibHkJrosqqL0jEsQ0IyItZQlCEs4V0XV04GmBwDQnFZTXRJyMewDKkYsUOoNgj1Z3nlEA0wOQakl4XsomQUy4B0KEaoa4bwDO8Fr95yiMkxHCSXtb4oZKNYhoNuYBeKMIQY3oXXrxrB5BjO+rJ+XlY1juUI87LsFlykW1+5K0agaoMQb2pvgIxhchwykicLLpJH9fTzsvSymgksXZJy2KqfyrULZcUQcnhf8QY0o5gcHaZccNC++dHLQjSXUTUzIJvAEoBZcXTq5+DSWYzqwCtDiNVbxXBUZzJq/CEa
5xUQBlAuOPR+9IJpPdY5uFlMmJGlX6q2awhLfF5yoXhpHCv/y2JFcrN4AqA1iB9+6CKZOSfs2R7kgV+otGUer+pkTKz/ZTKZckHbrL5vjXwsOl75kElOO7rquEy+IeoW/NYet4k+GkMC7ZSiyYF/8rdlPvWUTaBcc23Vdd/KTz/SZzuoCvnN06amZ1u8entp9rZgz6Ym3lKP/ZAiNeisYjKUz9/ZKtwTSjx6eTm2tBjMW87zSfT76yv3pYhzFD7pJ3dPeIMBl7+ir4Jy+/AuDEbrP3rKBKpAobxUBtvPYAf4IbsWJqafluOhJEGhO8gzPyuuhNpxqgOorGsiDyMQgzHmUw0VoysniJx8TbQyC7f32tboiK4azHjp4Ug4uA8gVwcosMiIP7XVa5acYsTEIuJf6slckCygfkrnS2TJFwPP8vJz1tG/zxIKg52h4ReT2nBD0PO3l5NPyWT4proVeE6xvTCS4A4pp3+b4ZHA1mqvSRDclqnEPtNOqGWLF9UB0TfB+U/6Nu6CZdvCT995wEdZXflUQ35BfuA+QT/kNvxnJHJdx9iWXoKU/uR2x3gsaTXjz1JEUP+btcdktSObeePSEr5dwPnpDdjNy+JWXPOlI8oZAxj3Db0Myhk9TLjg4g/hqknF5GCz9aXQrxEu14PAtQR2POMGzkFx6+cyRM1S+0OQjYsE6jLN6Q3EjzvBZcOxNAXZZRLJ7UvguSBY+Xjm28Jd6AzRPSEYPOwM0cRBc+Wvi25D6UI79fWPmz0hufeSjxN/56G9iHQYP3rC/DUsfMiq/L5QkZaYY/rgNBO9hpP6Q3YTcx89Rel+89n742I+IdI40FGRBUPzJrWqiEc+4L7Le1gc2A1GNOSihaBRE6g/rG4VdNPCM+0LZr7xgl5HsNgbzpKFgHwTFXxPdgNQLNI/ILhfcGSvHNz9zD1BCwTqIxB/eb4D1M/fNUjrTS0qCaeIQuPWH5PrxeD+tXOfjBfFLKKiDsEd/cgN+3E2vHNxeEiUUvIfA0h8erl96L6kdSi/qrKEgC+F89KfR1aPeSX9y5Nsl0WooGgXA0h+K67e6jwqOtcdLotVAsA/hfPTXxFePcg8VHL+8KNpDIFgHwC/+INfP6n3QHudYc2o5QxEAWV4Pqj9kV49W/enhhuRWvelnTv/i7TuDoNUA5DODSGeorx+t+lIrt4R266la0KdVPxUDIVc6k6TsB0Dxh/X1o936UcvbQqbiQSx9r3RanTIccnWYQVK6Q0hnaKLrR1qZZsoFbw6ZbHWUlAvOmW51jHlJ2U+9LryQycvBizwuOPw79ZuMYjrjgjynnhdDv1O/ydA59bwYQdqXwxgjjwuS/J36TBypZzvCpp4Xc5G0y+KlbdviMV1w/mRZvLRtW+QdL9MuX0RH6NtLvuD9vUgfi7ZtX/JkwWs+2w3uujRNu45/b94ff4/+v//+j1FR8vESC/TjRbF/uJz2/W+63xBeMPR2ief0r1KK9j67sVmrKnnkIdqI1rvMFW1E613saN+5Ea1PMZnttd7Fvax9iE+qkpPRplbJB7JWVXLHpo0ykV6+13qfu6KNaL2LR2zeoG3by061yibuJW0ebfSPEdleVXJH1TIXrXcxyYcWTdu+k1UbZdL28r3W+9zRvjM+qUruqNook7aX77Xe5472nblovYtd2alWOcW9vLWOpM3Jc7uONvUTGW1qlVN8e56BgxhoPClWGDkAm94nA3MwwKYH3UEF0PgZRgyQkcyxM+ZwADax4iCARr0dcBADjUkKdoCSkcAcBKgjk
5p8URg7AZmhrYFRJPgMqBvpAMoUokA9EAnMQQGOSihNUDJqEfFRAVUjFDhAyrmEOAuwjktCvxhwOQB2RVOwAIeMa5iDAPiIJ3UHFQOPeM6Ci0ITkFpkjRUtaSA0UjBUqCo1vzTNqS7KERlMUBUmrWJOxwZpkqlj3oClp31DjnyRLNFEP1YJMjqjVkvaAguQzakuyRO1A1XXkDt8XpD3gnYwVa5JWsR5gipYkc2hK8guauIc67RYDJ/xrQdoK4jApyRJKklD2FSi7jnxDtSDtG957DaoFaRXiQNl15BuqBWnf8N6DpuT5O4RkDk1JfkETeYDm3YIVCpIVqlujsOxvsea5HbRkjlf2UzTkDgX7Fk3UW5Hk+YhX9gVZT9kvAUuSFg0ZQy37gqz3SpIplP3zERH/gXf2LZpJCst+CXFYDsdQOgVZb8W+IBv3TpIpavbPiogEXtk/H5H13kkyRc3+WRH1Vuwf0ZEKy36JwoclyR9YkrTS3pgUP+lcoqXFYEYKMofziMhBwbJH5wGZ4xvWvVeHRUOnIuISr3TmqHpZr8La4TwgcfCAbkKKn3Sej03EFD858hsK1zcUPeuokI9LehVWDlbIe9bBElUv6VVYOVgh79G5xZIxDnRaqIcD+yXqmDc4h4qzhnC8ohthcaC7wJqEumQgR9ErBsQl6FhAxVnjZ6/rbZGNOULcBtmEbyhcPKBjinZMhYM4FW2PzmJK1xMcxKkoSDR0L9H2ut4PHMSpKEjoUM4Ujbi9iOMsgBTJ7RI5zaIjigsReRy19CKSeJNpW6hL5HGuH0Mif45K/YisppkBab2R6VaBfXxjlmjpWZCN4LGJXD+wDCtHxbEDFdZjDog42bVEO3BENOUb1hw7T4WcY4HI9Q3ViAo5x46zOHDsFkvHcgrJZAu5MedjEzk2kk0o8e6IVUhB7ogBG9YZTeTYSDYihbgOGrFE4YhlN+V8bGLHLwinpBDXf0o2Vwpx7aXrvTsiRTYihbj20k3hAbHjQdZkhcKxG/etiEjy2NwYltjHJL9C7YTzEWuSUY2CTNH8QTJWFAyLFXYRyWcoR1Cw6e3wSp6PTU4yqlFMYYk6JvlgYCfxDZveM5TTjk08ioJN74Q9e9iQjP6NPUdQsOmdsOekFTQmmRlYMkWTkPyKcYINyRiHW8Pv0H0rMJ85NTmibluD7yT5Baj3NVAxtLNA920N83mUVei+NagtyeQIaVuD75zECpBWYf7JaecDdN8q1HoQGPkxxip03xqo7WkJ3YuB2lFWofvWQO00lsC+FWBNkiUgbQ0ZZxV1uzdY3RyuBNAXy+l2qzCyotNuDYyk7Ku4tupa6iO51EeX7l1b7UhyJYC+WJLcqou2PABaLti3W4WRFUf+1srBlQD6Yknyt1ajyNUB0HJBkqKuR12SPG9FhRR18fztAGi5oIMrAbRckKSoi+dvB0DLBUmquCpdkuRKDIykdK4ERv78rRVpde+g3SqMpPwbG8oP2P99Jk2uGw==";function ha({size:e,variant:n="full",className:r="",dir:s="ltr"}){const a=u=>typeof u=="number"?`${u}px`:u,o=e?a(e):"32px",d=e?a(e):"40px";return n==="icon"?t.jsx("img",{src:Wo,alt:"Packman icon",className:"w-auto",style:{height:o}}):n==="text"?t.jsx("img",{src:Bo,alt:"Packman",className:"w-auto",style:{height:d}}):t.jsxs("div",{className:`flex items-center gap-2 ${r}`,"aria-label":"Packman",dir:s,children:[t.jsx("img",{src:Wo,alt:"Packman icon",className:"w-auto",style:{height:o}}),t.jsx("img",{src:Bo,alt:"Packman",className:"w-auto",style:{height:d}})]})}function Cs(){const{direction:e,language:n}=ae();return c.useEffect(()=>{document.documentElement.dir=e,document.documentElement.lang=n},[e,n]),t.jsxs("div",{className:"grid min-h-svh lg:grid-cols-2",children:[t.jsxs("div",{className:"flex w-full flex-col gap-4 p-6 md:p-10",children:[t.jsxs("div",{dir:"ltr",className:"flex w-full items-center justify-between gap-2",children:[t.jsx("a",{href:"#",className:"flex items-center gap-2 text-sm font-medium",children:t.jsx(ha,{size:32,variant:"full"})}),t.jsx(Ah,{})]}),t.jsx("div",{className:"flex flex-1 items-center justify-center",children:t.jsx("div",{className:"w-full max-w-xs mx-auto",children:t.jsx(Jt,{})})})]}),t.jsx("div",{className:"relative hidden bg-muted lg:block z-0",children:t.jsx("img",{src:Sh,alt:"Image",className:"absolute top-1/2 -translate-y-1/2 h-screen w-full object-cover bg-no-repeat dark:brightness-[0.2] dark:grayscale z-0"})})]})}const ln=Od.create({baseURL:"https://api.packman.ai"});ln.interceptors.request.use(e=>{let n=null;const r=localStorage.getItem("auth-storage");r&&(n=JSON.parse(r).state.token),n&&(e.headers.Authorization=`Bearer ${n}`);const s=localStorage.getItem("language")||"en";e.headers["Accept-Language"]=s;const a=ae.getState?.()?.onboarding?.uid,o=Jg(a);return o&&eh(e)&&(e.headers["X-Onboarding-Session-Token"]=o),e},e=>Promise.reject(e));const Nh=Kp({app:"seller",getLocale:()=>typeof window<"u"&&localStorage.getItem("language")||"en"});ln.interceptors.response.use(e=>e,e=>{try{const{status:n}=e.response||{};if(n===401){const r=window.location.pathname,s=r.includes("/auth/login")||r.includes("/login");Nt.clear(),Nt.cancelQueries(),Pt("401 interceptor fired",{url:e.config?.url??null,isLoginPage:s,willClearAuthStorage:!s}),s||(localStorage.removeItem("token"),localStorage.removeItem("auth-storage"))}}catch(n){console.error("API Response interceptor error:",n)}return Nh(e)});const Ke={getStatus:(e,n)=>{const r=Le(n);return q("GET",`${r}/stores/${e}/accounting/status`)(null,null)},setup:(e,n,r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/setup`)(null,n)}
5,listJournalEntries:(e,n={},r)=>{const s=Le(r);return q("GET",`${s}/stores/${e}/accounting/journal-entries`)(n,null)},getProfitLoss:(e,n={},r)=>{const s=Le(r);return q("GET",`${s}/stores/${e}/accounting/profit-loss`)(n,null)},getAging:(e,n={},r)=>{const s=Le(r);return q("GET",`${s}/stores/${e}/accounting/aging`)(n,null)},getVatReturn:(e,n={},r)=>{const s=Le(r);return q("GET",`${s}/stores/${e}/accounting/vat-return`)(n,null)},getMissingCogs:(e,n={},r)=>{const s=Le(r);return q("GET",`${s}/stores/${e}/accounting/cogs-restatement`)(n,null)},restateCogs:(e,n={},r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/cogs-restatement`)(n,{})},getEntitlement:(e,n)=>{const r=Le(n);return q("GET",`${r}/stores/${e}/accounting/entitlement`)(null,null)},startTrial:(e,n)=>{const r=Le(n);return q("POST",`${r}/stores/${e}/accounting/trial`)(null,{})},createExpense:(e,n,r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/expenses`)(null,n)},createIncome:(e,n,r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/income`)(null,n)},listInvoices:(e,n={},r)=>{const s=Le(r);return q("GET",`${s}/stores/${e}/accounting/invoices`)(n,null)},createInvoice:(e,n,r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/invoices`)(null,n)},confirmInvoice:(e,n,r,s)=>{const a=Le(s);return q("POST",`${a}/stores/${e}/accounting/invoices/${n}/confirm`)(null,r)},submitInvoice:(e,n,r,s)=>{const a=Le(s);return q("POST",`${a}/stores/${e}/accounting/invoices/${n}/submit`)(null,r)},approveInvoice:(e,n,r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/invoices/${n}/approve`)(null,{})},rejectInvoice:(e,n,r,s)=>{const a=Le(s);return q("POST",`${a}/stores/${e}/accounting/invoices/${n}/reject`)(null,r)},settleInvoice:(e,n,r,s)=>{const a=Le(s);return q("POST",`${a}/stores/${e}/accounting/invoices/${n}/settle`)(null,r)},reverseInvoice:(e,n,r,s)=>{const a=Le(s);return q("POST",`${a}/stores/${e}/accounting/invoices/${n}/reverse`)(null,r??{})},getInvoiceEvents:(e,n,r)=>{const s=Le(r);return q("GET",`${s}/stores/${e}/accounting/invoices/${n}/events`)(null,null)},discardInvoice:(e,n,r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/invoices/${n}/discard`)(null,{})},updateSettings:(e,n,r)=>{const s=Le(r);return q("PATCH",`${s}/stores/${e}/accounting/settings`)(null,n)},listRecurringBills:(e,n)=>{const r=Le(n);return q("GET",`${r}/stores/${e}/accounting/recurring-bills`)(null,null)},createRecurringBill:(e,n,r)=>{const s=Le(r);return q("POST",`${s}/stores/${e}/accounting/recurring-bills`)(null,n)},updateRecurringBill:(e,n,r,s)=>{const a=Le(s);return q("PATCH",`${a}/stores/${e}/accounting/recurring-bills/${n}`)(null,r)},deleteRecurringBill:(e,n,r)=>{const s=Le(r);return q("DELETE",`${s}/stores/${e}/accounting/recurring-bills/${n}`)(null,null)},uploadInvoiceFile:async(e,n)=>{const r=Le(n),s=new FormData;s.append("folder",e),s.append("path","accounting-invoices");const a=await ln.post(`${r}/files/upload-file`,s,{headers:{"Content-Type":"multipart/form-data"}});return kh(a?.data)}},kh=e=>{let n=e;for(let s=0;s<5&&n&&typeof n=="object"&&!(n.cdnUrl||n?.data?.url||n.url);s++)n=n.data;const r=n&&typeof n=="object"?n:{};return{url:r.cdnUrl||r?.data?.url||r.url||null,fileName:r.fileName||r?.data?.filename||null,mimetype:r?.data?.mimetype||r.mimetype||null,fileId:r.id??null}},Ir=(e,n)=>["accounting","status",e,{systemCountry:n}],Fl=(e,n)=>["accounting","entitlement",e,{systemCountry:n}],Th=(e,n,r,s)=>["accounting","journal-entries",e,{systemCountry:n,page:r,limit:s}],Ch=(e,n,r,s)=>["accounting","profit-loss",e,{systemCountry:n,from:r,to:s}
5],jh=(e,n,r,s)=>["accounting","missing-cogs",e,{systemCountry:n,from:r,to:s}],Ih=(e,n,r,s,a)=>["accounting","invoices",e,{systemCountry:n,status:r,page:s,limit:a}],Zt=e=>e?.data??e,Rr=(e,n,r)=>{e.invalidateQueries({queryKey:["accounting","journal-entries",n]}),e.invalidateQueries({queryKey:["accounting","profit-loss",n]}),e.invalidateQueries({queryKey:["accounting","invoices",n]}),e.invalidateQueries({queryKey:Ir(n,r)})};function Uj(e,{systemCountry:n,enabled:r=!0}={}){return $e({queryKey:Ir(e,n),queryFn:()=>Ke.getStatus(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,select:Zt,refetchInterval:a=>{const o=a?.state?.data;return(o?.data??o)?.importing?8e3:!1}})}function Mj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.setup(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:Ir(e,n)})}})}function Rh(e,{systemCountry:n,enabled:r=!0}={}){return $e({queryKey:Fl(e,n),queryFn:()=>Ke.getEntitlement(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,select:Zt})}function Gj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:()=>Ke.startTrial(e,n),onSuccess:()=>{r.invalidateQueries({queryKey:Fl(e,n)}),r.invalidateQueries({queryKey:Ir(e,n)})}})}function $j(e,{systemCountry:n,page:r=1,limit:s=10,enabled:a=!0}={}){return $e({queryKey:Th(e,n,r,s),queryFn:()=>Ke.listJournalEntries(e,{page:r,limit:s},n),enabled:!!e&&a,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:Zt})}function Vj(e,{systemCountry:n,from:r,to:s,enabled:a=!0}={}){return $e({queryKey:Ch(e,n,r,s),queryFn:()=>Ke.getProfitLoss(e,{from:r,to:s},n),enabled:!!e&&a,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:Zt})}const Ph=(e,n,r)=>["accounting","aging",e,{systemCountry:n,type:r}];function Fj(e,{systemCountry:n,type:r="both",enabled:s=!0}={}){return $e({queryKey:Ph(e,n,r),queryFn:()=>Ke.getAging(e,{type:r},n),enabled:!!e&&s,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:Zt})}const Oh=(e,n,r,s)=>["accounting","vat-return",e,{systemCountry:n,from:r,to:s}];function zj(e,{systemCountry:n,from:r,to:s,enabled:a=!0}={}){return $e({queryKey:Oh(e,n,r,s),queryFn:()=>Ke.getVatReturn(e,{from:r,to:s},n),enabled:!!e&&a,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:Zt})}function Wj(e,{systemCountry:n,from:r,to:s,enabled:a=!0}={}){return $e({queryKey:jh(e,n,r,s),queryFn:()=>Ke.getMissingCogs(e,{from:r,to:s},n),enabled:!!e&&a,retry:!1,refetchOnWindowFocus:!1,select:Zt})}function Bj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({from:s,to:a}={})=>Ke.restateCogs(e,{from:s,to:a},n),onSuccess:()=>{r.invalidateQueries({queryKey:["accounting","missing-cogs",e]}),r.invalidateQueries({queryKey:["accounting","journal-entries",e]}),r.invalidateQueries({queryKey:["accounting","profit-loss",e]})}})}function qj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.createExpense(e,s,n),onSuccess:()=>Rr(r,e,n)})}function Kj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.createIncome(e,s,n),onSuccess:()=>Rr(r,e,n)})}function Hj(e,{systemCountry:n,status:r,page:s=1,limit:a=20,enabled:o=!0}={}){return $e({queryKey:Ih(e,n,r,s,a),queryFn:()=>Ke.listInvoices(e,{status:r,page:s,limit:a},n),enabled:!!e&&o,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:Zt,refetchInterval:d=>{const u=d?.state?.data,l=u?.data??u;return(Array.isArray(l?.data)?l.data:[]).some(g=>g?.status==="processing")?4e3:!1}})}function Yj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:async s=>{const a=(Array.isArray(s)?s:[s]).filter(Boolean),d=(await Promise.allSettled(a.map(async i=>{const g=await Ke.uploadInvoiceFile(i,n);if(!g.url)throw new Error("Upload did not return a file URL.");return Ke.createInvoice(e,{fileUrl:g.url,fileName:g.fileName||i?.name,mimeType:i?.type||g.mimetype||void 0,...g.fileId?{fileId:g.fileId}:{}},n)}))).filter(i=>i.status==="rejected"),u=d.some(i=>(i.reason?.response?.status??i.reason?.status)===429),l=d.length;if(a.length>0&&l===a.length){const i=new Error("All invoice uploads failed.");throw i.rateLimited=u,i}return{total:a.length,uploaded:a.length-l,failed:l,rateLimited:u}},onSuccess:()=>{r.invalidateQueries({queryKey:["accounting","invoices",e]})}})}function Qj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({invoiceId:s,body:a})=>Ke.confirmInvoice(e,s,a,n),onSuccess:()=>Rr(r,e,n)})}function Xj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.discardInvoice(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:["accounting","invoices",e]})}})}function Jj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({invoiceId:s,body:a})=>Ke.submitInvoice(e,s,a,n),onSuccess:()=>{r.invalidateQueries({queryKey:["accounting","invoices",e]})}})}function Zj(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.approveInvoice(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:["accounting","invoices",e]})}})}function eI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({invoiceId:s,reason:a})=>Ke.rejectInvoice(e,s,{reason:a},n),onSuccess:()=>{r.invalidateQueries({queryKey:["accounting","invoices",e]})}})}function tI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({invoiceId:s,body:a})=>Ke.settleInvoice(e,s,a,n),onSuccess:()=>{Rr(r,e,n),r.invalidateQueries({queryKey:["accounting","aging",e]})}})}function nI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({invoiceId:s,body:a})=>Ke.reverseInvoice(e,s,a,n),onSuccess:()=>{r.invalidateQueries({queryKey:["accounting","invoices",e]}),Rr(r,e,n),r.invalidateQueries({queryKey:["accounting","aging",e]})}})}const Dh=(e,n,r)=>["accounting","invoice-events",e,r,{systemCountry:n}];function rI(e,n,{systemCountry:r,enabled:s=!0}={}){return $e({queryKey:Dh(e,r,n),queryFn:()=>Ke.getInvoiceEvents(e,n,r),enabled:!!e&&!!n&&s,retry:!1,refetchOnWindowFocus:!1,select:Zt})}function sI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.updateSettings(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:Ir(e,n)}),r.invalidateQueries({queryKey:["accounting","invoices",e]})}})}const xs=(e,n)=>["accounting","recurring-bills",e,{systemCountry:n}];function aI(e,{systemCountry:n,enabled:r=!0}={}){return $e({queryKey:xs(e,n),queryFn:()=>Ke.listRecurringBills(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,select:Zt})}function oI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.createRecurringBill(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:xs(e,n)})}})}function iI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({recurringId:s,body:a})=>Ke.updateRecurringBill(e,s,a,n),onSuccess:()=>{r.invalidateQueries({queryKey:xs(e,n)})}})}function cI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>Ke.deleteRecurringBill(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:xs(e,n)})}})}const at=(e,n)=>`${Le(n)}/stores/${e}/marketing/ai-marketing`,ct={getEntitlement:(e,n)=>q("GET",`${at(e,n)}/entitlement`)(null,null),startTrial:(e,n)=>
5q("POST",`${at(e,n)}/trial`)(null,{}),getSettings:(e,n)=>q("GET",`${at(e,n)}/settings`)(null,null),updateSettings:(e,n,r)=>q("PATCH",`${at(e,r)}/settings`)(null,n),listInsights:(e,n={},r)=>q("GET",`${at(e,r)}/insights`)(n,null),refreshInsights:(e,n)=>q("POST",`${at(e,n)}/insights/refresh`)(null,{}),getInsightsRunStatus:(e,n)=>q("GET",`${at(e,n)}/insights/refresh/status`)(null,null),dismissInsight:(e,n,r)=>q("POST",`${at(e,r)}/insights/${n}/dismiss`)(null,{}),listActions:(e,n={},r)=>q("GET",`${at(e,r)}/actions`)(n,null),approveAction:(e,n,r)=>q("POST",`${at(e,r)}/actions/${n}/approve`)(null,{}),rejectAction:(e,n,r,s)=>q("POST",`${at(e,s)}/actions/${n}/reject`)(null,r??{}),cancelAction:(e,n,r)=>q("POST",`${at(e,r)}/actions/${n}/cancel`)(null,{}),listStrategies:(e,n={},r)=>q("GET",`${at(e,r)}/strategies`)(n,null),getStrategy:(e,n,r)=>q("GET",`${at(e,r)}/strategies/${n}`)(null,null),generateStrategy:(e,n,r)=>q("POST",`${at(e,r)}/strategies/generate`)(null,n),approveStrategy:(e,n,r)=>q("POST",`${at(e,r)}/strategies/${n}/approve`)(null,{}),rejectStrategy:(e,n,r,s)=>q("POST",`${at(e,s)}/strategies/${n}/reject`)(null,r??{}),listCampaigns:(e,n={},r)=>q("GET",`${at(e,r)}/strategies/campaigns`)(n,null),getCampaignPerformance:(e,n,r)=>q("GET",`${at(e,r)}/strategies/campaigns/${n}/performance`)(null,null),listPackages:(e,n)=>q("GET",`${at(e,n)}/packages`)(null,null),getPackageRecommendation:(e,n)=>q("GET",`${at(e,n)}/packages/recommendation`)(null,null),purchasePackage:(e,n,r,s)=>q("POST",`${at(e,s)}/packages/${n}/purchase`)(null,r)},en=(e,n,r,s={})=>["ai-marketing",e,n,{systemCountry:r,...s}],tn=e=>e?.data??e;function Lh(e,{systemCountry:n,enabled:r=!0}={}){return $e({queryKey:en("entitlement",e,n),queryFn:()=>ct.getEntitlement(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,select:tn})}function lI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:()=>ct.startTrial(e,n),onSuccess:()=>{r.invalidateQueries({queryKey:["ai-marketing","entitlement",e]})}})}function dI(e,{systemCountry:n,enabled:r=!0}={}){return $e({queryKey:en("settings",e,n),queryFn:()=>
5ct.getSettings(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,select:tn})}function uI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>ct.updateSettings(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:["ai-marketing","settings",e]})}})}function pI(e,{systemCountry:n,status:r="new",page:s=1,limit:a=20,enabled:o=!0}={}){return $e({queryKey:en("insights",e,n,{status:r,page:s,limit:a}),queryFn:()=>ct.listInsights(e,{status:r,page:s,limit:a},n),enabled:!!e&&o,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:tn})}function mI(e,{systemCountry:n,enabled:r=!0,refetchInterval:s=!1}={}){return $e({queryKey:en("insights-run-status",e,n),queryFn:()=>ct.getInsightsRunStatus(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,refetchInterval:s,select:tn})}function gI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:()=>ct.refreshInsights(e,n),onSuccess:()=>{r.invalidateQueries({queryKey:["ai-marketing","insights",e]})}})}function hI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>ct.dismissInsight(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:["ai-marketing","insights",e]})}})}function fI(e,{systemCountry:n,status:r,page:s=1,limit:a=20,enabled:o=!0}={}){return $e({queryKey:en("actions",e,n,{status:r,page:s,limit:a}),queryFn:()=>ct.listActions(e,{status:r,page:s,limit:a},n),enabled:!!e&&o,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:tn})}const oo=(e,n)=>{e.invalidateQueries({queryKey:["ai-marketing","actions",n]}),e.invalidateQueries({queryKey:["ai-marketing","insights",n]}),e.invalidateQueries({queryKey:["ai-marketing","campaigns",n]})};function yI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>ct.approveAction(e,s,n),onSuccess:()=>oo(r,e)})}function bI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({actionId:s,reason:a})=>ct.rejectAction(e,s,{reason:a},n),onSuccess:()=>oo(r,e)})}function xI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>ct.cancelAction(e,s,n),onSuccess:()=>oo(r,e)})}function _I(e,{systemCountry:n,page:r=1,limit:s=10,enabled:a=!0}={}){return $e({queryKey:en("strategies",e,n,{page:r,limit:s}),queryFn:()=>ct.listStrategies(e,{page:r,limit:s},n),enabled:!!e&&a,retry:!1,refetchOnWindowFocus:!1,keepPreviousData:!0,select:tn,refetchInterval:o=>{const d=o?.state?.data,u=d?.data??d;return(Array.isArray(u?.items)?u.items:[]).some(i=>i?.status==="generating")?6e3:!1}})}function wI(e,n,{systemCountry:r,enabled:s=!0}={}){return $e({queryKey:en("strategy",e,r,{strategyId:n}),queryFn:()=>ct.getStrategy(e,n,r),enabled:!!e&&!!n&&s,retry:!1,refetchOnWindowFocus:!1,select:tn})}function vI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>ct.generateStrategy(e,s,n),onSuccess:()=>{r.invalidateQueries({queryKey:["ai-marketing","strategies",e]})}})}const io=(e,n)=>{e.invalidateQueries({queryKey:["ai-marketing","strategies",n]}),e.invalidateQueries({queryKey:["ai-marketing","strategy",n]}),e.invalidateQueries({queryKey:["ai-marketing","campaigns",n]}),e.invalidateQueries({queryKey:["ai-marketing","actions",n]})};function EI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:s=>ct.approveStrategy(e,s,n),onSuccess:()=>io(r,e)})}function SI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({strategyId:s,reason:a})=>ct.rejectStrategy(e,s,{reason:a},n),onSuccess:()=>io(r,e)})}function AI(e,n,{systemCountry:r,enabled:s=!0}={}){return $e({queryKey:en("campaign-performance",e,r,{campaignId:n}),queryFn:()=>ct.getCampaignPerformance(e,n,r),enabled:!!e&&!!n&&s,retry:!1,refetchOnWindowFocus:!1,select:tn})}function NI(e,{systemCountry:n,enabled:r=!0}={}){return $e({queryKey:en("packages",e,n),queryFn:()=>ct.listPackages(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,select:tn})}function kI(e,{systemCountry:n,enabled:r=!0}={}){return $e({queryKey:en("package-recommendation",e,n),queryFn:()=>ct.getPackageRecommendation(e,n),enabled:!!e&&r,retry:!1,refetchOnWindowFocus:!1,select:tn})}function TI(e,{systemCountry:n}={}){const r=Ie();return Ue({mutationFn:({packageId:s,tierKey:a})=>ct.purchasePackage(e,s,{tierKey:a},n),onSuccess:()=>{io(r,e),r.invalidateQueries({queryKey:["ai-marketing","packages",e]})}})}const Yn=({to:e,children:n,onClick:r,state:s,...a})=>{const o=We(e),{isMobile:d,setOpenMobile:u}=ds?.()||{};return t.jsx(On,{to:o,state:s,onClick:l=>{r?.(l),d&&typeof u=="function"&&u(!1)},...a,children:n})},Uh=[{key:"views",titleEn:"Traffic & Views",titleAr:"الزيارات والمشاهدات",descriptionEn:"See how many visitors are browsing your store",descriptionAr:"اعرف عدد الزوار الذين يتصفحون متجرك",icon:Js,color:"bg-blue-50 text-blue-600",route:m.ANALYTICS.INDEX,storeTypes:["all"]},{key:"live_view",titleEn:"Live View",titleAr:"العرض المباشر",de
5scriptionEn:"Monitor who is on your store right now in real time",descriptionAr:"تابع من يتصفح متجرك الآن في الوقت الفعلي",icon:Dd,color:"bg-green-50 text-green-600",route:m.ANALYTICS.LIVE_VIEW,storeTypes:["all"]},{key:"sales",titleEn:"Sales",titleAr:"المبيعات",descriptionEn:"Revenue trends, top products, and conversion data",descriptionAr:"اتجاهات الإيرادات والمنتجات الأعلى مبيعًا وبيانات التحويل",icon:Ld,color:"bg-amber-50 text-amber-600",route:m.ANALYTICS.SALES,storeTypes:["ecommerce"]},{key:"orders",titleEn:"Orders",titleAr:"الطلبات",descriptionEn:"Order volume, status breakdown, and fulfilment trends",descriptionAr:"حجم الطلبات وتفاصيل الحالة واتجاهات الوفاء",icon:La,color:"bg-orange-50 text-orange-600",route:m.ANALYTICS.ORDERS,storeTypes:["ecommerce"]},{key:"products",titleEn:"Products",titleAr:"المنتجات",descriptionEn:"Best sellers, views per product, and inventory insights",descriptionAr:"الأكثر مبيعًا والمشاهدات لكل منتج ورؤى المخزون",icon:Zs,color:"bg-teal-50 text-teal-600",route:m.ANALYTICS.PRODUCTS,storeTypes:["ecommerce"]},{key:"locations",titleEn:"Locations",titleAr:"المواقع",descriptionEn:"Where your customers are coming from geographically",descriptionAr:"المناطق الجغرافية التي يأتي منها عملاؤك",icon:as,color:"bg-cyan-50 text-cyan-600",route:m.ANALYTICS.LOCATIONS,storeTypes:["ecommerce"]}],Mh={id:"analytics",icon:kc,hubUrl:m.ANALYTICS.HUB,sidebarUrl:m.ANALYTICS.HUB,titleEn:"Analytics",titleAr:"التحليلات",descriptionEn:"Deep insights into your store performance, sales, and customers",descriptionAr:"رؤى عميقة حول أداء متجرك ومبيعاتك وعملائك",groups:[{key:"analytics",cards:Uh}]},Gh=[{key:"products",labelEn:"Products & Catalog",labelAr:"المنتجات والكتالوج",icon:Zs,cards:[{key:"products",titleEn:"Products",titleAr:"المنتجات",descriptionEn:"Add, edit, and manage your full product catalogue",descriptionAr:"إضافة وتعديل وإدارة كامل كتالوج منتجاتك",icon:Zs,color:"bg-blue-50 text-blue-600",route:m.PRODUCTS_INDEX},{key:"website_import",titleEn:"Smart Import",titleAr:"الاستيراد الذكي",descriptionEn:"Scan any website and instantly import products into your store",descriptionAr:"امسح أي موقع واستورد المنتجات إلى متجرك على الفور",icon:as,color:"bg-sky-50 text-sky-600",route:m.PRODUCTS_WEBSITE_IMPORT},{key:"categories",titleEn:"Categories",titleAr:"الفئات",descriptionEn:"Organise products into categories for easier browsing",descriptionAr:"تنظيم المنتجات في فئات لتسهيل التصفح",icon:Ud,color:"bg-green-50 text-green-600",route:m.CATEGORIES},{key:"collections",titleEn:"Collections",titleAr:"المجموعات",descriptionEn:"Group products into curated collections and featured sets",descriptionAr:"تجميع المنتجات في مجموعات منتقاة وأطقم مميزة",icon:Ua,color:"bg-violet-50 text-violet-600",route:m.COLLECTIONS_INDEX},{key:"attributes",titleEn:"Product Attributes",titleAr:"خصائص المنتجات",descriptionEn:"Define sizes, colours, and other product variants",descriptionAr:"تحديد الأحجام والألوان وأنواع منتجاتك الأخرى",icon:Md,color:"bg-orange-50 text-orange-600",route:m.PRODUCTS_ATTRIBUTES?.INDEX||"/dashboard/product-attributes"},{key:"labels",titleEn:"Product Labels",titleAr:"شارات المنتجات",descriptionEn:"Create badges like New Arrival that show over product images",descriptionAr:"أنشئ شارات مثل وصل حديثاً تظهر فوق صور المنتجات",icon:Gd,color:"bg-fuchsia-50 text-fuchsia-600",route:m.PRODUCT_LABELS?.INDEX||"/dashboard/product-labels"},{key:"addons",titleEn:"Product Add-ons",titleAr:"إضافات المنتجات",descriptionEn:"Create optional extras and upsells for your products",descriptionAr:"إنشاء إضافات اختيارية وعروض رفع الطلب لمنتجاتك",icon:$d,color:"bg-pink-50 text-pink-600",route:m.ADDONS?.INDEX||"/dashboard/addons"},{key:"reviews",titleEn:"Product Reviews",titleAr:"تقييمات المنتجات",descriptionEn:"View and moderate customer reviews for your products",descriptionAr:"عرض وإدارة تقييمات العملاء لمنتجاتك",icon:Vd,color:"bg-
5amber-50 text-amber-600",route:m.REVIEWS?.INDEX||"/dashboard/reviews"},{key:"wishlists",titleEn:"Wishlists",titleAr:"قوائم الرغبات",descriptionEn:"See which products customers are saving to their wishlists",descriptionAr:"اعرف المنتجات التي يحفظها العملاء في قوائم رغباتهم",icon:Fd,color:"bg-rose-50 text-rose-600",route:m.WISHLISTS?.INDEX||"/dashboard/wishlists"},{key:"size_guides",titleEn:"Size Guides",titleAr:"أدلة المقاسات",descriptionEn:"Create size charts to help customers pick the right fit",descriptionAr:"إنشاء جداول مقاسات لمساعدة العملاء على اختيار المقاس المناسب",icon:zd,color:"bg-teal-50 text-teal-600",route:m.SIZE_GUIDES?.INDEX||"/dashboard/size-guides"},{key:"appointments",titleEn:"Appointments",titleAr:"المواعيد",descriptionEn:"Set up bookable services and manage customer appointments",descriptionAr:"إعداد الخدمات القابلة للحجز وإدارة مواعيد العملاء",icon:Wd,color:"bg-indigo-50 text-indigo-600",route:m.APPOINTMENTS}]},{key:"inventory",labelEn:"Inventory",labelAr:"المخزون",icon:Zr,cards:[{key:"inventory",titleEn:"Inventory",titleAr:"المخزون",descriptionEn:"Track stock levels, manage quantities, and monitor product availability",descriptionAr:"تتبع مستويات المخزون وإدارة الكميات ومراقبة توفر المنتجات",icon:Zr,color:"bg-teal-50 text-teal-600",route:m.INVENTORIES.INDEX},{key:"inventory_history",titleEn:"Inventory History",titleAr:"سجل المخزون",descriptionEn:"Review all stock movements, adjustments, and historical changes",descriptionAr:"مراجعة جميع حركات المخزون والتعديلات والتغييرات التاريخية",icon:Bd,color:"bg-slate-50 text-slate-600",route:m.INVENTORIES.ALL_HISTORY}]}],$h={id:"catalog",icon:Tc,hubUrl:m.CATALOG.INDEX,sidebarUrl:m.CATALOG.INDEX,titleEn:"Catalog",titleAr:"الكتالوج",descriptionEn:"Manage your products, categories, collections, and all store content",descriptionAr:"إدارة منتجاتك وفئاتك ومجموعاتك وكل محتوى المتجر",groups:Gh},Vh=[{key:"getting_started",labelEn:"Getting Started",labelAr:"البدء",icon:es,cards:[{key:"dashboard_overview",titleEn:"Dashboard",titleAr:"لوحة التحكم",descriptionEn:"Read your store performance metrics: sales, orders, fulfillment, and more",descriptionAr:"اقرأ مقاييس أداء متجرك: المبيعات والطلبات والتجهيز والمزيد",icon:qd,color:"bg-indigo-50 text-indigo-600",route:m.LEARNING_CENTER.DASHBOARD_GUIDE},{key:"getting_started",titleEn:"Getting Started",titleAr:"البدء",descriptionEn:"Learn how to set up your store and start selling",descriptionAr:"تعلم كيفية إعداد متجرك وبدء البيع",icon:es,color:"bg-blue-50 text-blue-600",route:m.LEARNING_CENTER.GETTING_STARTED},{key:"store_settings_guide",titleEn:"Store Settings Guide",titleAr:"دليل إعدادات المتجر",descriptionEn:"Configure store settings, integrations, payments, and business details",descriptionAr:"اضبط إعدادات المتجر والتكاملات والمدفوعات وتفاصيل العمل",icon:Ma,color:"bg-slate-50 text-slate-600",route:m.LEARNING_CENTER.STORE_SETTINGS_GUIDE},{key:"seller_builder_guide",titleEn:"Seller Builder Guide",titleAr:"دليل منشئ المتجر",descriptionEn:"Learn how to customize your store using the visual template builder",descriptionAr:"تعلم كيفية تخصيص متجرك باستخدام منشئ القوالب المرئي",icon:Kd,color:"bg-violet-50 text-violet-600",route:m.LEARNING_CENTER.SELLER_BUILDER_GUIDE},{key:"design_guidelines",titleEn:"Design Guidelines",titleAr:"إرشادات التصميم",descriptionEn:"Best practices for logos, banners, and product images",descriptionAr:"أفضل الممارسات للشعارات واللافتات وصور المنتجات",icon:Cc,color:"bg-pink-50 text-pink-600",route:m.LEARNING_CENTER.DESIGN_GUIDELINES},{key:"ai_assistant_guide",titleEn:"Packman AI Assistant",titleAr:"مساعد Packman AI",descriptionEn:"Ask questions about your store and get help finding any setting",descriptionAr:"اسأل عن متجرك واحصل على مساعدة في إيجاد أي إعداد",icon:Hd,color:"bg-fuchsia-50 text-fuchsia-600",route:m.LEARNING_CENTER.AI_ASSISTANT_GUIDE}]},{key:"products_catalog",labelEn:"Products & Catalog",labelAr:"المنتجات والكتالوج",icon:Zr,cards:[{key:"product_upload",titleEn:"Product Upload Guide",titleAr:"دليل رفع المنتجات",descriptionEn:"Manual entry, Excel import, Smart Import, and Create with AI",descriptionAr:"الإدخال اليدوي واستيراد Excel والاستيراد الذكي والإنشاء بالذكاء الاصطناعي",icon:Zr,color:"bg-green-50 text-green-600",route:m.LEARNING_CENTER.PRODUCT_UPLOAD},{key:"categories_guide",titleEn:"Categories & Collections",titleAr:"الفئات والمجموعات",descriptionEn:"Organize products with categories, collections, attributes, and add-ons",de
5scriptionAr:"نظّم المنتجات بالفئات والمجموعات والخصائص والإضافات",icon:jc,color:"bg-teal-50 text-teal-600",route:m.LEARNING_CENTER.CATEGORIES_GUIDE},{key:"size_guides",titleEn:"Size Guides",titleAr:"أدلة المقاسات",descriptionEn:"Create size charts for clothing and accessories",descriptionAr:"إنشاء جداول المقاسات للملابس والإكسسوارات",icon:Yd,color:"bg-lime-50 text-lime-600",route:m.LEARNING_CENTER.SIZE_GUIDES},{key:"product_labels_guide",titleEn:"Product Labels",titleAr:"ملصقات المنتجات",descriptionEn:"Highlight products with badges like New, Best Seller, or Limited",descriptionAr:"ميّز المنتجات بشارات مثل جديد أو الأكثر مبيعاً أو محدود",icon:Qd,color:"bg-rose-50 text-rose-600",route:m.LEARNING_CENTER.PRODUCT_LABELS_GUIDE},{key:"domains_guide",titleEn:"Custom Domains",titleAr:"النطاقات المخصصة",descriptionEn:"Connect your own domain to your store",descriptionAr:"ربط نطاقك الخاص بمتجرك",icon:Ic,color:"bg-sky-50 text-sky-600",route:m.LEARNING_CENTER.DOMAINS_GUIDE}]},{key:"sales_operations",labelEn:"Sales & Operations",labelAr:"المبيعات والعمليات",icon:fr,cards:[{key:"orders_guide",titleEn:"Order Processing",titleAr:"معالجة الطلبات",descriptionEn:"Manage orders from placement to delivery",descriptionAr:"إدارة الطلبات من الطلب إلى التوصيل",icon:fr,color:"bg-violet-50 text-violet-600",route:m.LEARNING_CENTER.ORDERS_GUIDE},{key:"shipping_guide",titleEn:"Shipping Setup",titleAr:"إعداد الشحن",descriptionEn:"Configure shipping zones, methods, and delivery options",descriptionAr:"تهيئة مناطق الشحن والطرق وخيارات التوصيل",icon:Rc,color:"bg-cyan-50 text-cyan-600",route:m.LEARNING_CENTER.SHIPPING_GUIDE},{key:"inventory_guide",titleEn:"Inventory Management",titleAr:"إدارة المخزون",descriptionEn:"Track stock, manage transfers, and avoid stockouts",descriptionAr:"تتبع المخزون وإدارة التحويلات وتجنب نفاد المخزون",icon:Xd,color:"bg-amber-50 text-amber-600",route:m.LEARNING_CENTER.INVENTORY_GUIDE},{key:"customers_guide",titleEn:"Customer Management",titleAr:"إدارة العملاء",descriptionEn:"Understand your customers and build lasting relationships",descriptionAr:"افهم عملاءك وابنِ علاقات دائمة معهم",icon:ea,color:"bg-emerald-50 text-emerald-600",route:m.LEARNING_CENTER.CUSTOMERS_GUIDE},{key:"returns_guide",titleEn:"Returns & Refunds",titleAr:"المرتجعات والاستردادات",descriptionEn:"Handle return requests, approvals, and refunds",descriptionAr:"تعامل مع طلبات الإرجاع والموافقات والاستردادات",icon:Jd,color:"bg-rose-50 text-rose-600",route:m.LEARNING_CENTER.RETURNS_GUIDE},{key:"store_credit_guide",titleEn:"Store Credit",titleAr:"رصيد المتجر",descriptionEn:"Customer credit balances, refunds to credit, and spending at checkout",descriptionAr:"أرصدة العملاء والاسترداد إلى الرصيد وإنفاقه عند الدفع",icon:Zd,color:"bg-yellow-50 text-yellow-600",route:m.LEARNING_CENTER.STORE_CREDIT_GUIDE}]},{key:"marketing_growth",labelEn:"Marketing & Growth",labelAr:"التسويق والنمو",icon:xo,cards:[{key:"coupons_guide",titleEn:"Coupons & Discounts",titleAr:"القسائم والخصومات",descriptionEn:"Create promotions and track coupon performance",descriptionAr:"إنشاء العروض الترويجية وتتبع أداء القسائم",icon:Pc,color:"bg-red-50 text-red-600",route:m.LEARNING_CENTER.COUPONS_GUIDE},{key:"cart_recovery_guide",titleEn:"Cart Recovery",titleAr:"استعادة السلة",descriptionEn:"Recover abandoned carts and use draft carts for phone orders",descriptionAr:"استعد السلات المتروكة واستخدم سلات المسودة لطلبات الهاتف",icon:Oc,color:"bg-orange-50 text-orange-600",route:m.LEARNING_CENTER.CART_RECOVERY_GUIDE},{key:"ai_generation",titleEn:"Smart Studio Guide",titleAr:"دليل الاستوديو الذكي",descriptionEn:"Create product media, social posts, and reels with a guided wizard",descriptionAr:"أنشئ وسائط المنتج والمنشورات والريلز بمعالج موجّه خطوة بخطوة",icon:ts,color:"bg-indigo-50 text-indigo-600",route:m.LEARNING_CENTER.AI_GENERATION},{key:"marketing_assistant_guide",titleEn:"Marketing Assistant",titleAr:"مساعد التسويق",descriptionEn:"Proactive insights, c
5ampaign approvals, and strategy (add-on)",descriptionAr:"رؤى استباقية وموافقات الحملات والاستراتيجية (إضافة)",icon:eu,color:"bg-violet-50 text-violet-600",route:m.LEARNING_CENTER.MARKETING_ASSISTANT_GUIDE}]},{key:"analytics_finance",labelEn:"Analytics & Finance",labelAr:"التحليلات والمالية",icon:Js,cards:[{key:"analytics_guide",titleEn:"Analytics Guide",titleAr:"دليل التحليلات",descriptionEn:"Understand traffic, sales, orders, products, and location insights",descriptionAr:"افهم الزيارات والمبيعات والطلبات والمنتجات ورؤى المواقع",icon:Js,color:"bg-cyan-50 text-cyan-600",route:m.LEARNING_CENTER.ANALYTICS_GUIDE},{key:"store_optimization",titleEn:"Store Optimization",titleAr:"تحسين المتجر",descriptionEn:"Tips to improve your store performance and sales",descriptionAr:"نصائح لتحسين أداء متجرك ومبيعاتك",icon:_o,color:"bg-teal-50 text-teal-600",route:m.LEARNING_CENTER.STORE_OPTIMIZATION},{key:"seo_guide",titleEn:"SEO Optimization",titleAr:"تحسين محركات البحث",descriptionEn:"Optimize your store for search engines and increase visibility",descriptionAr:"حسّن متجرك لمحركات البحث وزِد من الظهور",icon:xo,color:"bg-purple-50 text-purple-600",route:m.LEARNING_CENTER.SEO_GUIDE},{key:"pricing_guide",titleEn:"Pricing & Fees",titleAr:"التسعير والرسوم",descriptionEn:"Understand product price fields, payment fees, and VAT",descriptionAr:"افهم حقول أسعار المنتجات ورسوم الدفع وضريبة القيمة المضافة",icon:_o,color:"bg-orange-50 text-orange-600",route:m.LEARNING_CENTER.PRICING_GUIDE},{key:"subscriptions_guide",titleEn:"Subscriptions & Services",titleAr:"الاشتراكات والخدمات",descriptionEn:"Your plan, billing history, and add-on services",descriptionAr:"خطتك وسجل الفوترة وخدمات الإضافات",icon:Dc,color:"bg-violet-50 text-violet-600",route:m.LEARNING_CENTER.SUBSCRIPTIONS_GUIDE},{key:"wallet_guide",titleEn:"Wallet & AI Credits",titleAr:"المحفظة وأرصدة الذكاء الاصطناعي",descriptionEn:"Manage your credits and understand AI tool costs",descriptionAr:"إدارة أرصدتك وفهم تكاليف أدوات الذكاء الاصطناعي",icon:wr,color:"bg-amber-50 text-amber-600",route:m.LEARNING_CENTER.WALLET_GUIDE},{key:"accounting_guide",titleEn:"Accounting",titleAr:"المحاسبة",descriptionEn:"Track revenue, expenses, and profit with the Accounting add-on",descriptionAr:"تابع الإيرادات والمصروفات والأرباح مع إضافة المحاسبة",icon:Lc,color:"bg-emerald-50 text-emerald-600",route:m.LEARNING_CENTER.ACCOUNTING_GUIDE}]},{key:"team_access",labelEn:"Team & Access",labelAr:"الفريق والصلاحيات",icon:wo,cards:[{key:"users_guide",titleEn:"Users & Team",titleAr:"المستخدمون والفريق",descriptionEn:"Add team members, manage their access, and review the audit log",descriptionAr:"أضف أعضاء الفريق وأدر وصولهم وراجع سجل التدقيق",icon:wo,color:"bg-indigo-50 text-indigo-600",route:m.LEARNING_CENTER.USERS_GUIDE},{key:"api_tokens_guide",titleEn:"API Tokens",titleAr:"رموز API",descriptionEn:"Give developers and tools secure access to your store data",descriptionAr:"امنح المطورين والأدوات وصولاً آمناً إلى بيانات متجرك",icon:ta,color:"bg-slate-50 text-slate-600",route:m.LEARNING_CENTER.API_TOKENS_GUIDE}]}],Fh={id:"learning-center",icon:Uc,tabOverflowThreshold:7,hubUrl:m.LEARNING_CENTER.INDEX,sidebarUrl:m.LEARNING_CENTER.INDEX,titleEn:"Learning Center",titleAr:"مركز التعلم",descriptionEn:"Your comprehensive guide to setting up and managing your store successfully",descriptionAr:"دليلك الشامل لإعداد وإدارة متجرك بنجاح",groups:Vh},zh=[{key:"coupons",titleEn:"Coupons",titleAr:"القسائم",descriptionEn:"Create discount codes and track their performance",descriptionAr:"إنشاء رموز الخصم وتتبع أدائها",icon:Pc,color:"bg-blue-50 text-blue-600",route:m.COUPONS.INDEX},{key:"abandoned_cart",titleEn:"Abandoned Cart",titleAr:"السلات المتروكة",descriptionEn:"Recover lost sales from customers who left without buying",descriptionAr:"استعادة المبيعات المفقودة من العملاء الذين غادروا دون شراء",icon:Oc,color:"bg-orange-50 text-orange-600",route:m.CARTS?.INDEX||"/dashboard/carts"},{key:"draft_carts",titleEn:"Draft Carts",titleAr:"سلات المسودة",descriptionEn:"Create orders manually for phone and assisted sales",descriptionAr:"إنشاء الطلبات يدويًا لمبيعات الهاتف والبيع المساعَد",icon:fr,color:"bg-green-50 text-green-600",route:m.MARKETING?.DRAFT_CARTS||"/dashboard/draft-carts"}],Wh={id:"marketing",icon:Mc,hubUrl:m.MARKETING?.INDEX||"/dashboard/marketing",sidebarUrl:m.MARKETING?.INDEX||"/dashboard/marketing",titleEn:"Marketing",titleAr:"التسويق",descriptionEn:"Tools to grow your sales and re-engage your customers",descriptionAr:"أدوات لتنمية مبيعاتك وإعادة استهداف عملائك",groups:[{key:"marketing",cards:zh}]},Bh=[{key:"all_orders",titleEn:"All Orders",titleAr:"جميع الطلبات",descriptionEn:"View and manage all customer orders, track status and fulfillment",descriptionAr:"عرض وإدارة جميع طلبات العملاء وتتبع الحالة والتنفيذ",icon:fr,color:"bg-blue-50 text-blue-600",route:m.ORDERS.INDEX},{key:"returns",titleEn:"Returns",titleAr:"المرتجعات",descriptionEn:"Handle return requests, process refunds, and manage return workflows",descriptionAr:"معالجة طلبات الإرجاع وتحويل المبالغ المستردة وإدارة سير العمل",icon:tu,color:"bg-orange-50 text-orange-600",route:m.RETURNS.INDEX}],qh={id:"orders",icon:fr,hubUrl:m.ORDERS.HUB,sidebarUrl:m.ORDERS.HUB,titleEn:"Orders",titleAr:"الطلبات",descriptionEn:"View orders, manage fulfillment, and handle returns",descriptionAr:"عرض الطلبات وإدارة التنفيذ ومعالجة المرتجعات",groups:[{key:"orders",cards:Bh}]},zl=[{key:"store_setup",labelEn:"Store Setup",labelAr:"إعداد المتجر",icon:os,storeTypes:["all"],
5cards:[{key:"general",titleEn:"General",titleAr:"عام",descriptionEn:"Name, logo, contact details, and basic info",descriptionAr:"الاسم والشعار وبيانات التواصل والمعلومات الأساسية",icon:nu,color:"bg-blue-50 text-blue-600",route:m.STORE.GENERAL,storeTypes:["all"]},{key:"settings",titleEn:"Settings",titleAr:"الإعدادات",descriptionEn:"Language, currency, time zone, and preferences",descriptionAr:"اللغة والعملة والمنطقة الزمنية والتفضيلات",icon:Ma,color:"bg-slate-50 text-slate-600",route:m.STORE.SETTINGS,storeTypes:["all"]},{key:"themes",titleEn:"Themes",titleAr:"القوالب",descriptionEn:"Browse and apply templates",descriptionAr:"تصفح القوالب وطبّقها",icon:Cc,color:"bg-pink-50 text-pink-600",route:m.THEME_TEMPLATES.TEMPLATES,storeTypes:["all"]},{key:"custom_css",titleEn:"Custom CSS",titleAr:"تصميم مخصص",descriptionEn:"Fine-tune your storefront appearance",descriptionAr:"ضبط مظهر واجهة متجرك",icon:ru,color:"bg-indigo-50 text-indigo-600",route:m.THEME_TEMPLATES.STYLE,storeTypes:["all"]}]},{key:"sales",labelEn:"Sales",labelAr:"المبيعات",icon:vo,storeTypes:["ecommerce"],cards:[{key:"customers",titleEn:"Customers",titleAr:"العملاء",descriptionEn:"Customer list, addresses, and order history",descriptionAr:"قائمة العملاء وعناوينهم وسجل الطلبات",icon:ea,color:"bg-teal-50 text-teal-600",route:m.STORE.CUSTOMERS,storeTypes:["ecommerce"]},{key:"store_credit",titleEn:"Store Credit",titleAr:"رصيد المتجر",descriptionEn:"Issue and manage customer credit balances",descriptionAr:"إصدار وإدارة أرصدة العملاء",icon:wr,color:"bg-amber-50 text-amber-600",route:m.STORE_CREDIT?.INDEX||"/dashboard/store-credit",storeTypes:["ecommerce"]},{key:"payment_methods",titleEn:"Payment Methods",titleAr:"طرق الدفع",descriptionEn:"Enable and configure payment gateways",descriptionAr:"تفعيل وضبط بوابات الدفع",icon:vo,color:"bg-green-50 text-green-600",route:m.STORE.PAYMENTS,storeTypes:["ecommerce"]},{key:"shipping_methods",titleEn:"Shipping Methods",titleAr:"طرق الشحن",descriptionEn:"Shipping zones, rates, and delivery options",descriptionAr:"مناطق الشحن والأسعار وخيارات التوصيل",icon:Rc,color:"bg-orange-50 text-orange-600",route:m.STORE.SHIPPING,storeTypes:["ecommerce"]},{key:"pickup_locations",titleEn:"Pickup Locations",titleAr:"نقاط الاستلام",descriptionEn:"Physical pickup points for customers",descriptionAr:"نقاط الاستلام الفعلية لعملائك",icon:su,color:"bg-rose-50 text-rose-600",route:m.STORE.PICKUP_LOCATIONS,storeTypes:["ecommerce"]}]},{key:"operations",labelEn:"Operations",labelAr:"العمليات",icon:Eo,storeTypes:["all"],cards:[{key:"users",titleEn:"Users",titleAr:"المستخدمون",descriptionEn:"Invite team members and manage permissions",descriptionAr:"دعوة أعضاء الفريق وإدارة الصلاحيات",icon:ea,color:"bg-cyan-50 text-cyan-600",route:m.SELLERS.INDEX,storeTypes:["all"]},{key:"domains",titleEn:"Domains",titleAr:"النطاقات",descriptionEn:"Connect or manage your custom domains",descriptionAr:"ربط نطاقاتك المخصصة أو إدارتها",icon:Ic,color:"bg-sky-50 text-sky-600",route:m.STORE.DOMAINS,storeTypes:["all"]},{key:"integrations",titleEn:"Marketing Integrations",titleAr:"تكاملات التسويق",descriptionEn:"Google Analytics, Meta Pixel, and more",descriptionAr:"Google Analytics وMeta Pixel والمزيد",icon:Eo,color:"bg-violet-50 text-violet-600",route:m.STORE.INTEGRATIONS,storeTypes:["all"]},{key:"media_library",titleEn:"Media Library",titleAr:"مكتبة الوسائط",descriptionEn:"Upload and organise store images and files",descriptionAr:"رفع الصور والملفات وتنظيمها",icon:au,color:"bg-purple-50 text-purple-600",route:m.STORE.MEDIA_LIBRARY,storeTypes:["all"]}]},{key:"compliance",labelEn:"Compliance & Access",labelAr:"الامتثال والوصول",icon:ta,storeTypes:["all"],
5cards:[{key:"documents",titleEn:"Documents",titleAr:"المستندات",descriptionEn:"Terms of service, privacy policy, and legal docs",descriptionAr:"شروط الخدمة وسياسة الخصوصية والمستندات القانونية",icon:na,color:"bg-lime-50 text-lime-600",route:m.STORE.DOCUMENTS,storeTypes:["ecommerce"]},{key:"terms_and_conditions",titleEn:"Terms & Conditions",titleAr:"الشروط والأحكام",descriptionEn:"View accepted status and current terms documents",descriptionAr:"عرض حالة القبول ومستندات الشروط الحالية",icon:na,color:"bg-blue-50 text-blue-600",route:m.STORE.TERMS_AND_CONDITIONS,storeTypes:["all"]},{key:"vat_settings",titleEn:"VAT Settings",titleAr:"إعدادات ضريبة القيمة المضافة",descriptionEn:"VAT rates and tax rules for orders",descriptionAr:"معدلات ضريبة القيمة المضافة وقواعد الضريبة",icon:ou,color:"bg-emerald-50 text-emerald-600",route:m.STORE.VAT_SETTINGS,storeTypes:["ecommerce"]},{key:"api_tokens",titleEn:"API Tokens",titleAr:"رموز API",descriptionEn:"Tokens for third-party integrations",descriptionAr:"رموز للتكاملات مع أطراف خارجية",icon:ta,color:"bg-gray-50 text-gray-600",route:m.STORE.API_TOKENS,storeTypes:["all"]}]}],Nn={id:"store",icon:os,hubUrl:m.STORE.INDEX,sidebarUrl:m.STORE.INDEX,titleEn:"My Store",titleAr:"متجري",titleEnWebsite:"Website",titleArWebsite:"الموقع",descriptionEn:"Manage every aspect of your store from one place",descriptionAr:"إدارة كل جوانب متجرك من مكان واحد",groups:zl},Kh=[{key:"subscriptions",titleEn:"Subscription",titleAr:"الاشتراك",descriptionEn:"View plan details, billing history, and upgrade options",descriptionAr:"عرض تفاصيل خطتك وتاريخ الفواتير والترقية",icon:Dc,color:"bg-slate-50 text-slate-600",route:m.SUBSCRIPTIONS.INDEX,storeTypes:["all"]},{key:"account_management",titleEn:"Account Management",titleAr:"إدارة الحساب",descriptionEn:"Dedicated support to set up and grow your store",descriptionAr:"دعم مخصص لإعداد متجرك وتنميته",icon:iu,color:"bg-sky-50 text-sky-600",route:m.SERVICES?.ACCOUNT_MANAGEMENT||"/dashboard/services/account_management",storeTypes:["ecommerce"]},{key:"warehouse",titleEn:"Storage & Warehouse",titleAr:"التخزين والمستودع",descriptionEn:"Store inventory and fulfil orders on your behalf",descriptionAr:"خزّن مخزونك ونفّذ الطلبات نيابةً عنك",icon:cu,color:"bg-orange-50 text-orange-600",route:m.SERVICES?.WAREHOUSE||"/dashboard/services/warehouse",storeTypes:["ecommerce"]}],Hh={id:"subscriptions-services",icon:es,hubUrl:m.SUBSCRIPTIONS_AND_SERVICES?.INDEX||"/dashboard/subscriptions-services",sidebarUrl:m.SUBSCRIPTIONS_AND_SERVICES?.INDEX||"/dashboard/subscriptions-services",titleEn:"Subscriptions & Services",titleAr:"الاشتراكات والخدمات",descriptionEn:"Manage your plan and add-on services for your store",descriptionAr:"إدارة خطتك والخدمات الإضافية لمتجرك",groups:[{key:"services",cards:Kh}]};function Yr(e,n){if(!n||!e)return!1;if(n.includes(":")){const r=n.split("/").map(o=>o.startsWith(":")?"[^/]+":o).join("/");if(new RegExp(`^${r}$`).test(e))return!0;const a=n.split("/:")[0];return e.startsWith(`${a}/`)}return e===n||e.startsWith(`${n}/`)}function Yh(e){return(e.groups||[]).flatMap(n=>n.cards||[])}function Qh(e,n){return!!(!e.storeTypes||e.storeTypes.includes("all")||!n&&e.storeTypes.includes("ecommerce"))}function Wl(e,{isWebsite:n=!1}={}){const r=[];for(const s of e.groups||[])if(!(n&&s.storeTypes&&!s.storeTypes.includes("all")))for(const a of s.cards||[])Qh(a,n)&&r.push(a);return r}function Xh(e){return[...e].sort((n,r)=>r.route.length-n.route.length)}function Bl(e,n,{isWebsite:r=!1}={}){for(const s of n){if(e===s.hubUrl)return{section:s,isHub:!0,activeTab:null};const a=Xh(Yh(s));for(const o of a)if(Yr(e,o.route))return{section:s,isHub:!1,activeTab:o}}return null}function Jh(e,n,r,s){if(s(e,n))return!0;const a=Bl(n,r);return!!(a&&a.section.sidebarUrl===e)}const _s=[$h,Wh,qh,Mh,Nn,Hh,Fh];function Zh(e,{isWebsite:n=!1}={}){return Bl(e,_s,{isWebsite:n})}function ef(e,n,r){return Jh(e,n,_s,r)}const qo=(e,n)=>{if(!e||e==="#")return!1;if(e===n)return!0;
5if(e==="/dashboard"&&n!=="/dashboard")return!1;if(e.includes(":")){const r=e.split("/").map(a=>a.startsWith(":")?"[^/]+":a).join("/");return new RegExp(`^${r}$`).test(n)}return!!(e!=="/dashboard"&&n.startsWith(e+"/"))},ql=(e,n)=>{if(!e||e==="#")return!1;if(e===n)return!0;if(e==="/dashboard"&&n!=="/dashboard")return!1;if(e.includes(":")){const r=e.split("/").map(a=>a.startsWith(":")?"[^/]+":a).join("/");return new RegExp(`^${r}$`).test(n)}return!1};function tf({items:e}){return t.jsx(Hp,{children:t.jsxs(Yp,{className:"flex flex-col gap-2",children:[t.jsx(yr,{}),t.jsx(yr,{children:e.map((n,r)=>t.jsx(nf,{item:n},r))})]})})}function nf({item:e}){const n=kt(),{state:r}=ds(),s=r==="collapsed",a=ae(l=>l.language),o=m.MARKETING?.SMART_STUDIO||"/dashboard/smart-studio",d=e.url===o&&n.pathname.startsWith(`${o}/`);if(!e?.subMenu||e?.subMenu?.length===0){const l=ef(e.url,n.pathname,qo);return e.disabled?t.jsx(dn,{children:t.jsx(un,{"aria-disabled":"true",tooltip:e.disabledTooltip||e.title,className:"cursor-not-allowed opacity-80 hover:bg-transparent [&_svg]:stroke-[1.5]",onClick:i=>i.preventDefault(),children:t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1.5",children:[e.icon&&t.jsx(e.icon,{className:"h-4 w-4 shrink-0 text-muted-foreground/80"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground/90",children:e.title}),e.disabledLabel&&t.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border bg-muted px-1.5 py-0.5 text-[10px] font-medium leading-none text-muted-foreground whitespace-nowrap",children:e.disabledLabel})]})})},e.title):t.jsx(dn,{children:t.jsx(un,{asChild:!0,tooltip:e.title,className:`cursor-pointer transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-sm ${l?"bg-[var(--primary)] text-[var(--brand-secondary)] shadow-md hover:bg-[var(--primary)] hover:text-[var(--brand-secondary)] [&_svg]:text-[var(--brand-secondary)] [&_svg]:stroke-[1.5]":"hover:bg-[var(--primary)] hover:text-[var(--brand-secondary)] [&:hover_svg]:text-[var(--brand-secondary)] [&_svg]:stroke-[1.5]"}`,children:t.jsxs(Yn,{to:e.url,state:d?{clearDraft:!0}:void 0,className:"cursor-pointer",children:[e.icon&&t.jsx(e.icon,{}),t.jsx("span",{children:e.title}),e.badge&&t.jsxs("span",{className:xt("ms-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-bold leading-none shadow-md ring-2 animate-pulse",l?"!bg-[var(--brand-secondary)] text-[var(--brand)] ring-white/40 [&_svg]:text-[var(--brand)]":"!bg-brand text-brand-secondary shadow-[0_0_0_1px_rgba(44,42,89,0.12),0_2px_10px_rgba(210,248,1,0.7)] ring-brand/50"),children:[t.jsx("span",{"aria-hidden":!0,className:"text-[10px] leading-none opacity-90",children:"✦"}),e.badge]})]})})},e.title)}const u=e.subMenu.some(l=>qo(l.url,n.pathname)||n.pathname.startsWith(l.url+"/"));return s?t.jsx(dn,{children:t.jsxs(us,{dir:a==="ar"?"rtl":"ltr",children:[t.jsx(ps,{asChild:!0,children:t.jsxs(un,{tooltip:e.title,className:`cursor-pointer transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-sm ${u?"bg-[var(--brand-secondary)] text-[var(--primary)] hover:bg-[var(--brand-secondary)] hover:text-[var(--primary)] [&_svg]:text-[var(--primary)] [&_svg]:stroke-[1.5]":"hover:bg-[var(--primary)] hover:text-[var(--brand-secondary)] [&:hover_svg]:text-[var(--brand-secondary)] [&_svg]:stroke-[1.5]"}`,children:[e.icon&&t.jsx(e.icon,{}),t.jsx("span",{className:"sr-only",children:e.title})]})}),t.jsx(ms,{side:"right",align:"start",className:"w-48",children:e.subMenu.map((l,i)=>{const g=ql(l.url,n.pathname);return l.disabled?t.jsxs(In,{disabled:!0,className:"flex items-center gap-2",children:[l.icon&&t.jsx(l.icon,{className:"h-4 w-4"}),t.jsx("span",{className:"flex-1 truncate",children:l.title}),l.disabledLabel&&t.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border bg-muted px-1.5 py-0.5 text-[9px] font-semibold leading-none text-muted-foreground whitespace-nowrap",children:l.disabledLabel})]},i):t.jsx(In,{asChild:!0,children:t.jsxs(Yn,{to:l.url,className:`cursor-pointer flex items-center gap-2 ${g?"bg-[var(--primary)] text-[var(--brand-secondary)]":""}`,children:[l.icon&&t.jsx(l.icon,{className:"h-4 w-4"}),t.jsx("span",{children:l.title})]})},i)})})]})}
5):t.jsx(dn,{children:t.jsx(Qp,{type:"single",collapsible:!0,className:"w-full py-0",defaultValue:u?e.title:void 0,children:t.jsxs(Xp,{value:e.title,className:"border-0 py-0",children:[t.jsx(Jp,{className:`py-0 rounded-md pe-2 hover:no-underline transition-all duration-300 ease-in-out ${u?"bg-[var(--brand-secondary)] text-[var(--primary)] hover:bg-[var(--brand-secondary)] hover:text-[var(--primary)] [&_svg]:text-[var(--primary)] [&_svg]:stroke-[1.5]":"hover:bg-[var(--primary)] hover:text-[var(--brand-secondary)] [&:hover_svg]:text-[var(--brand-secondary)] [&_svg]:stroke-[1.5]"}`,children:t.jsx(un,{asChild:!0,className:"bg-transparent p-2",children:t.jsxs("div",{children:[e.icon&&t.jsx(e.icon,{}),t.jsx("span",{className:"font-normal",children:e.title})]})})}),t.jsx(Zp,{className:"p-0 w-full",children:t.jsx(em,{className:"border-none mx-1 p-0 m-0 mt-1",children:e?.subMenu?.length>0&&e?.subMenu?.map((l,i)=>t.jsx(rf,{item:l},i))})})]})})})}function rf({item:e}){const n=kt(),r=ql(e.url,n.pathname);return e.disabled?t.jsx(dn,{children:t.jsx(un,{"aria-disabled":"true",tooltip:e.disabledTooltip||e.title,className:"cursor-not-allowed opacity-80 hover:bg-transparent ps-6 [&_svg]:stroke-[1.5]",onClick:s=>s.preventDefault(),children:t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1.5",children:[e.icon&&t.jsx(e.icon,{className:"h-4 w-4 shrink-0 text-muted-foreground/80"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground/90",children:e.title}),e.disabledLabel&&t.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border bg-muted px-1.5 py-0.5 text-[10px] font-medium leading-none text-muted-foreground whitespace-nowrap",children:e.disabledLabel})]})})},e.title):t.jsx(dn,{children:t.jsx(un,{asChild:!0,tooltip:e.title,className:`cursor-pointer transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-sm ps-6 ${r?"bg-[var(--primary)] text-[var(--brand-secondary)] shadow-md hover:bg-[var(--primary)] hover:text-[var(--brand-secondary)] [&_svg]:text-[var(--brand-secondary)] [&_svg]:stroke-[1.5]":"hover:bg-[var(--primary)] hover:text-[var(--brand-secondary)] [&:hover_svg]:text-[var(--brand-secondary)] [&_svg]:stroke-[1.5]"}`,children:t.jsxs(Yn,{to:e.url,className:"cursor-pointer",children:[e.icon&&t.jsx(e.icon,{}),t.jsx("span",{children:e.title})]})})},e.title)}function sf(){const{isMobile:e}=ds(),{user:n,logout:r}=qe(),a=ae(p=>p.language)==="ar",{t_logout:o,t_account_settings:d,t_audit_log:u}=yt(),l=d||(a?"إعدادات الحساب":"Account Settings"),i=u||(a?"سجل التدقيق":"Audit Log"),g=o||(a?"تسجيل الخروج":"Log out");if(!n)return null;const y=p=>p?.split(" ").map(f=>f[0]).join("").toUpperCase().slice(0,2)||"U";return t.jsx(yr,{children:t.jsx(dn,{children:t.jsxs(us,{children:[t.jsx(ps,{asChild:!0,children:t.jsxs(un,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t.jsxs(Io,{className:"h-8 w-8 rounded-lg grayscale",children:[t.jsx(Ro,{src:n.avatar,alt:n.name}),t.jsx(Po,{className:"rounded-lg",children:y(n.name)})]}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-medium",children:n.name}),t.jsx(Ko,{email:n.email})]}),t.jsx(lu,{className:"ml-auto size-4"})]})}),t.jsxs(ms,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:e?"bottom":"right",align:"end",sideOffset:4,children:[t.jsx(sl,{className:"p-0 font-normal",children:t.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[t.jsxs(Io,{className:"h-8 w-8 rounded-lg",children:[t.jsx(Ro,{src:n.avatar,alt:n.name}),t.jsx(Po,{className:"rounded-lg",children:y(n.name)})]}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-medium",children:n.name}),t.jsx(Ko,{email:n.email})]})]})}),t.jsx(sa,{}),t.jsx(On,{to:m.ACCOUNT,children:t.jsxs(In,{children:[t.jsx(Ma,{}),l]})}),t.jsx(On,{to:m.AUDIT_LOG?.INDEX||"/dashboard/audit-log",children:t.jsxs(In,{children:[t.jsx(na,{}),i]})}),t.jsx(sa,{}),t.jsxs(In,{onClick:r,children:[t.jsx(du,{}),g]})]})]})})})}function Ko({email:e}){const n=e||"";return n?t.jsx(al,{children:t.jsxs(ol,{children:[t.jsx(il,{asChild:!0,children:t.jsx("span",{className:"text-muted-foreground truncate text-xs text-start",dir:"ltr",children:n})}),t.jsx(cl,{children:t.jsx("span",{dir:"ltr",children:n})})]})}):null}const af=bt("stores","stores",{listOptions:{staleTime:1*60*1e3,refetchOnWindowFocus:!0},detailOptions:{staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,enabled:!0}}),js=Er("stores"),co={...js,allIndustries:()=>[...js.all,"allIndustries"],getStoreDetails:()=>[...js.all,"getStoreDetails"]},bn=()=>
5{if(Un())return"ae";try{const n=ae.getState?.()?.systemCountry;if(n)return String(n).toLowerCase()}catch(e){console.warn("Failed to access store state for system country",e)}return"ae"},Pr={getStoreDetails:e=>{const n=typeof e=="object"&&e!==null?e.id:e,r=bn();return q("GET",`${r}/stores/${n}`)(null,null)},getIndustries:e=>{const n=bn(),{systemCountry:r,...s}=e||{};return q("GET",`${n}/stores/industries`)(s,null)},getStoreTemplates:e=>{const n=bn();return q("GET",`${n}/stores/${e}/templates`)(null,null)},deleteStoreTemplate:(e,n)=>{const r=bn();return q("DELETE",`${r}/stores/${e}/templates/${n}`)(null,null)},updateStoreSettings:({params:e,body:n})=>{const r=bn();return q("PATCH",`${r}/stores/${e.id}`)(null,n)}},of=(e={})=>{const{isAuthenticated:n}=qe(),r=bn();return $e({queryKey:[...co.allIndustries(),r],queryFn:async()=>{try{const{data:s}=await Pr.getIndustries({systemCountry:r});return s}catch(s){throw console.error("Error fetching industries:",s),s}},enabled:n,retry:!1,...e})},Kl=(e,n={})=>{const{isAuthenticated:r}=qe();let s,a=n||{};typeof e=="object"&&e!==null?(s=e.id??e.params?.id,typeof e.enabled<"u"&&(a={...a,enabled:e.enabled})):s=e;const o=(a.enabled!==void 0?a.enabled:!!s)&&r;return tm(co,d=>Pr.getStoreDetails(d),{staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,...a,enabled:o})(s,{...a,enabled:o})},Hl=(e={})=>{const n=Ie();return Ue({mutationFn:async({params:r,body:s})=>{try{const{data:a}=await Pr.updateStoreSettings({params:r,body:s});return a}catch(a){throw console.error("Error updating store settings:",a),a}},onSuccess:()=>{n.invalidateQueries({queryKey:co.all})},...e})},cf=(e,n={})=>{const{isAuthenticated:r}=qe(),s=bn();return $e({queryKey:["store-templates",e,s],queryFn:async()=>{try{const{data:a}=await Pr.getStoreTemplates(e);return a}catch(a){throw console.error("Error fetching store templates:",a),a}},enabled:!!e&&r&&n?.enabled!==!1,staleTime:0,gcTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,...n})},lf=(e,n={})=>{const r=Ie(),s=bn();return Ue({mutationFn:async a=>{try{const{data:o}=await Pr.deleteStoreTemplate(e,a);return o}catch(o){throw console.error("Error deleting store template:",o),o}},onSuccess:()=>{r.invalidateQueries({queryKey:["store-templates",e,s]})},...n})},{useList:df,useDetail:uf,useCreate:pf,useUpdate:mf,useDelete:gf}=af.hooks,Yl={hooks:{useAllStores:df,useStore:uf,useCreateStore:pf,useUpdateStore:mf,useDeleteStore:gf,useGetIndustries:of,useGetStoreDetails:Kl,useUpdateStoreSettings:Hl,useGetStoreTemplates:cf,useDeleteStoreTemplate:lf}},Ql=()=>{const{selectedStore:e,selectedStoreDetails:n,isLoadingStoreDetails:r,storeDetailsError:s}=ae(S=>S.store),{isAuthenticated:a}=qe(),o=kt(),d=wt(),u=c.useRef(null),{useGetStoreDetails:l}=Yl.hooks,{data:i,isLoading:g,error:y,refetch:p}=l(e?.id,{enabled:!!e?.id&&a&&e?.id!==void 0&&e?.id!==null&&String(e.id).trim()!=="",retry:!1,systemCountry:typeof e?.systemCountry=="string"?e.systemCountry:e?.systemCountry?.code});c.useEffect(()=>{Dl(g)},[g]),c.useEffect(()=>{i&&(mr(i),Kn(null))},[i]),c.useEffect(()=>{if(y){if(y?.response?.status===400){console.warn("Store details not available (400):",y);return}Kn(y),mr(null)}},[y]),c.useEffect(()=>{const S=u.current;if(!S)return;const _=o?.pathname||"";Oo(_)||(Xt(S),u.current=null)},[o?.pathname]);const f=c.useCallback(async S=>{try{const _=o?.pathname||"",w=Oo(_);if(w){u.current=S,d(We(w),{replace:!0});return}Xt(S),mr(null),Kn(null)}catch(_){console.error("Error switching store:",_),Kn(_)}},[o?.pathname,d]),x=c.useCallback(()=>{e?.id&&p()},[e?.id,p]),v=c.useCallback(async()=>{if(e?.id)try{const{data:S}=await p();Xt(S)}catch(S){throw console.error("Error refetching store details:",S),Kn(S),S}},[e?.id,p]);return{selectedStore:e,selectedStoreDetails:n,isLoadingStoreDetails:r,storeDetailsError:s,switchStore:f,refreshStoreDetails:x,refetchCurrentStoreDetails:v}};function Ho(e){let n=e,r=0;for(;n!=null&&r<10;){if(typeof n=="string")return n.trim()||void 0;if(typeof n=="object"&&n.url!=null){n=n.url,r++;continue}break}}function fa(e,n=!1){if(e==null)return;if(typeof e=="string")return e.trim()||void 0;if(typeof e!="object")return;const r=n?e.url_ar:e.url,s=n?e.url:e.url_ar;return Ho(r)??Ho(s)}const hf="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0.799805'%20y='25.2004'%20width='59.2003'%20height='10.0158'%20fill='%232C2A59'/%3e%3crect%20x='25.4805'%20y='25.2004'%20width='34.5186'%20height='10.0158'%20fill='%232C2A59'/%3e%3cpath%20d='M35.3184%2059.6294H0.799805V49.6136H35.3184V59.6294Z'%20fill='%232C2A59'/%3e%3cpath%20d='M0.799805%2059.7188L0.799806%2039.1508L10.8156%2039.1508V59.7188H0.799805Z'%20fill='%232C2A59'/%3e%3cpath%20d='M25.4805%200.876292H59.9991V10.8921H25.4805V0.876292Z'%20fill='%232C2A59'/%3e%3cpath%20d='M59.9991%200.786866L59.9991%2035.3055H49.9833L49.9833%200.786865L59.9991%200.786866Z'%20fill='%232C2A59'/%3e%3cpath%20d='M35.4962%200.876292L35.4962%2059.7189H25.4805L25.4805%200.876292H35.4962Z'%20fill='%232C2A59'/%3e%3c/svg%3e";function ff({width:e=8,height:n=8}){return t.jsx("img",{src:hf,className:`w-${e} h-${n}`})}function yf(){const e=yt(),n=e.language||"en",{t_my_stores:r,t_add_store:s}=yt(),{isMobile:a,setOpenMobile:o}=ds(),d=wt(),{isAuthenticated:u}=qe(),{selectedStore:l,selectedStoreDetails:i,switchStore:g,isLoadingStoreDetails:y}=Ql(),p=ae(B=>B.store.stores),f=B=>{const U=B?.systemCountry;if(!U)return"ae";if(typeof U=="string")return U.toLowerCase();const K=U.code||U.iso||U.iso2||U.iso3||U.isoCode||U.countryCode||U.slug;return K?String(K).toLowerCase():"ae"},x=c.useMemo(()=>{const B=new Map;return nm.forEach(U=>{B.set(U.code.toLowerCase(),U)}),B},[]),v=B=>{const U=B?.systemCountry;if(U&&typeof U=="object"){const fe=U.code||f(B);let ie=n==="ar"&&U.nameAr||U.name;const me=U.flag||"",Re=fe.toLowerCase(),ke=x.get(Re)||x.get(Re.toUpperCase()),oe=me||ke?.flag||"";return n!=="ar"&&String(fe).toUpperCase()==="AE"&&(ie="UAE"),{code:fe.toUpperCase(),name:ie||fe.toUpperCase(),flag:oe}}const K=f(B),ee=x.get(K)||x.get(K.toUpperCase());if(!ee)return{code:K.toUpperCase(),name:K.toUpperCase(),flag:""};let he=n==="ar"?ee.nameAr:ee.name;return n!=="ar"&&String(ee.code).toUpperCase()==="AE"&&(he="UAE"),{code:ee.code,name:he,flag:ee.flag}},S=B=>B?(B.plan?.category||B.category)==="platform"&&!!B.status:!1,_=B=>!B||!Array.isArray(B)?null:B.find(S)||null,C=(S(l?.activeSubscription)?l.activeSubscription:null)||_(i?.subscriptions)||_(i?.data?.subscriptions)||null,k=l?.id??i?.id??i?.data?.id,{data:L,isLoading:A}=Ba.useCurrent({storeId:k??0,category:qa.platform},{enabled:u&&!!k}),E=async B=>{await g(B)};if(!l)return t.jsx(yr,{children:t.jsx(dn,{children:t.jsxs(un,{size:"lg",disabled:!0,children:[t.jsx("div",{className:"bg-gray-200 animate-pulse aspect-square size-8 rounded-lg"}),t.jsxs("div",{className:"grid flex-1 text-sm leading-tight",children:[t.jsx("div",{className:"h-4 bg-gray-200 animate-pulse rounded"}),t.jsx("div",{className:"h-3 bg-gray-200 animate-pulse rounded mt-1"})]})]})})});const j=A?C:L||null;let H="";j&&(j.status==="trial"||ga(j)?H=e.t_free_trial||"Free Trial":H=e.t_paid||"Paid");const D=!A&&L?ls(L):er(l),$=v(l),re=l?.type==="website",pe=r||"My Stores & Websites",te=s||"Add Store Or Website",R=()=>{const B=i?.data||i,U=Array.isArray(p)?p.find(he=>
5he.id===l?.id):null,K=B?.template?.theme?.logo||U?.template?.theme?.logo||l?.template?.theme?.logo,ee=fa(K,n==="ar")??null;return ee?ee.startsWith("http")?ee:`${Hn}/${ee.replace(/^\//,"")}`:null};return t.jsx(yr,{children:t.jsx(dn,{children:t.jsxs(us,{dir:n==="ar"?"rtl":"ltr",children:[t.jsx(ps,{asChild:!0,children:t.jsxs(un,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",disabled:y,dir:n==="ar"?"rtl":"ltr",children:[t.jsx("div",{className:`flex aspect-square size-8 items-center justify-center rounded-lg ${R()?"bg-white border border-gray-200":"!bg-brand text-sidebar-primary-foreground"}`,children:R()?t.jsx("img",{src:R(),alt:l.name,className:"w-full h-full object-contain p-1"}):t.jsx(ff,{})}),t.jsxs("div",{className:"grid min-w-0 flex-1 text-start text-sm leading-tight",children:[t.jsxs("span",{className:"truncate font-medium",children:[l.name,y&&" (Loading...)"]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[D?t.jsx("span",{className:"truncate text-xs font-semibold text-red-600",children:e.t_expired||"Expired"}):H&&t.jsx("span",{className:"truncate text-xs",children:H}),(D||H)&&!re&&$.flag&&t.jsx("span",{className:"text-xs opacity-50",children:"•"}),!re&&$.flag&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs",children:$.flag}),$.name&&t.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:$.name})]})]})]}),t.jsx(uu,{className:n==="ar"?"mr-auto":"ml-auto"})]})}),t.jsxs(ms,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",align:"start",side:a?"bottom":"right",sideOffset:4,children:[t.jsx(sl,{className:"text-muted-foreground text-xs",children:pe}),p?.length>0&&p.map(B=>{const K=(S(B.activeSubscription)?B.activeSubscription:null)||_(B.subscriptions)||null;let ee="";K&&(ee=K.status==="trial"||ga(K)?e.t_free_trial||"Free Trial":e.t_paid||"Paid");const he=er(B),fe=l?.id===B.id,ie=v(B),me=B.type==="website";return t.jsxs(In,{onClick:()=>E(B),className:`gap-2 p-2 ${fe?"bg-accent":""}`,children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border",children:(()=>{const Re=B?.template?.theme?.logo,ke=fa(Re,n==="ar"),oe=ke?ke.startsWith("http")?ke:`${Hn}/${ke.replace(/^\//,"")}`:null;return oe?t.jsx("img",{src:oe,alt:B.name,className:"size-3.5 shrink-0 rounded object-contain"}):t.jsx(Gc,{className:"size-3.5 shrink-0"})})()}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsx("span",{className:"font-medium truncate",children:B.name}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[he?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate text-xs font-semibold text-red-600",children:e.t_expired||"Expired"}),!me&&ie.flag&&t.jsx("span",{className:"text-xs opacity-50",children:"•"})]}):ee&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:ee}),!me&&ie.flag&&t.jsx("span",{className:"text-xs opacity-50",children:"•"})]}),!me&&ie.flag&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs",children:ie.flag}),t.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:ie.name})]})]})]})]},B.id)}),t.jsx(sa,{}),t.jsxs(In,{className:"gap-2 p-2",onClick:()=>{a&&o(!1),d(m.STORE.CREATE)},children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-transparent",children:t.jsx(Xn,{className:"size-4 create-store-plus-icon"})}),t.jsx("div",{className:"text-muted-foreground font-medium",children:te})]})]})]})})})}function bf({...e}){const{t_home:n,t_dashboard:r,t_orders:s,t_catalog:a,t_allProducts:o,t_collections:d,t_categories:u,t_product_attributes:l,t_product_addons:i,t_warehouse:g,t_inventory:y,t_inventory_history:p,t_my_store:f,t_subscriptions_services:x,t_subscriptions:v,t_services:S,t_general:_,t_settings:w,t_style:C,t_customers:k,t_users:L,t_payment_methods:A,t_shipping_methods:E,t_pickup_locations:j,t_domains:H,t_documents:D,t_terms_and_conditions:$,t_marketing:re,t_abandoned_cart:pe,t_analytics:te,t_coupons:R,t_integrations:B,t_live_view:U,t_website:K,t_sales:ee,t_products:he,t_locations:fe,t_views:ie,...me}=yt(),{selectedStore:Re,selectedStoreDetails:ke}=ae(Ge=>Ge.store),se=(ke?.data||ke||Re)?.type==="website",{data:de}=Rh(Re?.id,{systemCountry:Re?.systemCountry?.code,enabled:!!Re?.id&&!se}),Ne=de?.available===!0,{data:ue}=Lh(Re?.id,{systemCountry:Re?.systemCountry?.code,enabled:!!Re?.id&&!se}),ve=ue?.available===!0,Ve={user:{name:"shadcn",email:"[email protected]",avatar:"/avatars/shadcn.jpg"},navMain:[{title:n||"Home",url:m.HOME,icon:$c},...se?[]:[{title:r,url:m.DASHBOARD,icon:Vc}],...se?[]:[{title:s,url:m.ORDERS.HUB||"/dashboard/orders-hub",icon:pu}],...se?[]:[{title:a||"Catalog",url:m.CATALOG?.INDEX||"/dashboard/catalog",icon:Tc}],...se?[]:[{title:re,url:m.MARKETING?.INDEX||"/dashboard/marketing",icon:Mc}],{title:te,url:m.ANALYTICS?.HUB||"/dashboard/analytics-hub",icon:kc},{title:se?K||"Website":f,url:m.STORE.INDEX,icon:os},{title:me.t_v3_smart_studio_beta||"Smart Studio",url:m.MARKETING?.SMART_STUDIO||"/dashboard/smart-studio",icon:ts,badge:me.t_new||"New"},{title:x,url:m.SUBSCRIPTIONS_AND_SERVICES?.INDEX||"/dashboard/subscriptions-services",icon:es},...se?[]:[{title:me.t_addon_services||"Add-on Services",icon:mu,subMenu:[{title:me.t_acct_nav||"Accounting",url:m.ACCOUNTING.INDEX,icon:Lc,...Ne?{}:{disabled:!0,disabledLabel:me.t_coming_soon||"Coming soon",disabledTooltip:me.t_acct_coming_soon_desc||"Accounting & Finance add-on is coming soon."}},{title:me.t_mkt_sidebar||"Marketing Assistant",url:m.MARKETING?.ASSISTANT||"/dashboard/marketing-assistant",icon:ts,...ve?{badge:me.t_new||"New"}:{disabled:!0,disabledLabel:me.t_coming_soon||"Coming soon",disabledTooltip:me.t_mkt_locked_desc||"Subscribe to the Marketing Assistant add-on to use this feature."}}]}],{title:me.t_wallet||"Wallet",url:m.WALLET?.INDEX||"/dashboard/wallet",icon:wr},{title:me.t_learning_center||"Learning Center",url:m.LEARNING_CENTER?.INDEX||"/dashboard/learning-center",icon:Uc}]},{direction:Te}=ae();return t.jsxs(rm,{collapsible:"icon",side:Te==="rtl"?"right":"left",className:`rtl-sidebar ${Te==="rtl"?"sidebar-rtl":""}`,...e,children:[t.jsx(sm,{className:"bg-white",children:t.jsx(yf,{})}),t.jsx(am,{className:"bg-white",children:t.jsx(tf,{items:Ve.navMain}
5)}),t.jsx(om,{className:"bg-white",children:t.jsx(sf,{user:Ve.user})})]})}const xf=()=>{const e=wt(),n=kt(),r=qe(se=>se.logout),{isAuthenticated:s}=qe(),a=yt(),o=a.language==="ar",{selectedStore:d,selectedStoreDetails:u}=ae(se=>se.store),[l,i]=c.useState(!1),[g,y]=c.useState(!1),[p,f]=c.useState(""),[x,v]=c.useState(!1),S=d?.id??u?.id??u?.data?.id,{data:_,isLoading:w}=Ba.useCurrent({storeId:S??0,category:qa.platform},{enabled:s&&!!S}),{switchStore:C}=Ql(),k=ae(se=>se.store.stores)||[],L=k.filter(se=>{const de=p.toLowerCase(),Ne=se?.name||"",ue=se?.uid||"",ve=Ts(se.activeSubscription)||"";return Ne.toLowerCase().includes(de)||ue.toLowerCase().includes(de)||ve.toLowerCase().includes(de)}),A=se=>se.status==="inactive"?{label:a.t_inactive||"Inactive",color:"bg-red-100 text-red-700 border-red-200"}:er(se)?{label:a.t_expired||"Expired",color:"bg-amber-100 text-amber-700 border-amber-200"}:{label:a.t_active||"Active",color:"bg-green-100 text-green-700 border-green-200"};c.useEffect(()=>{if(!s){i(!1);return}if(w){i(!1);return}if(!S){i(!1);return}const se=n.pathname,Ne=["/dashboard/subscriptions","/dashboard/subscription-orders","/dashboard/store/create",m.STORE.VAT_SETTINGS,m.STORE.DOCUMENTS,"/auth","/onboarding"].some(Te=>se.startsWith(Te)),ue=!_,Ve=(u?.data||u||d)?.status==="inactive";i((ue||Ve)&&!Ne)},[_,w,S,n.pathname,s,d,u]);const E=u?.data||u||d;if(c.useEffect(()=>{v(!1)},[E?.id,E?.template?.theme?.logo]),!l||!E)return null;const j=_,H=j?!!j.trialEndsAt:!1,D=j&&Ts(j)||"",$=E?.status==="inactive",re=()=>{e(We(m.SUBSCRIPTIONS.INDEX))},pe=()=>{e(We(m.STORE.VAT_SETTINGS))},te=()=>{window.open("mailto:[email protected]","_blank")},R=()=>{r(),e(m.AUTH.LOGIN)},B=async se=>{se&&(y(!1),f(""),await C(se))},U=[a.t_unlimited_users||"Unlimited Users",a.t_unlimited_orders||"Unlimited Orders",a.t_unlimited_products||"Unlimited Products",a.t_advanced_analytics||"Advanced Analytics",a.t_flexible_payment||"Flexible Payment Options",a.t_powerful_store_builder||"Powerful Store Builder",a.t_ai_assistance||"AI Assistance",a.t_multi_language_support||"Multi-Language Support",a.t_multi_currency_support||"Multi-Currency Support",a.t_priority_support||"Priority Support",a.t_automated_billing||"Automated Billing",a.t_custom_domain_connection||"Custom Domain Connection",a.t_seo_optimization_tools||"SEO Optimization Tools",a.t_inventory_management||"Inventory Management"],ee=$?{title:a.t_store_inactive||"Your store is currently inactive",subtitle:a.t_store_inactive_message||"Your store is inactive. Please complete VAT compliance (upload certificate + TRN) to reactivate it."}:j?H?{title:a.t_your_trial_has_ended||`Your ${a.t_days_free_trial||"14 Days Free Trial"} has ended`,subtitle:a.t_trial_ended_message||"Re-subscribe now and re-activate all these features"}:{title:a.t_your_subscription_has_ended&&a.t_your_subscription_has_ended.replace("{planName}",D)||`Your subscription in ${D} has ended`,subtitle:a.t_resubscribe_reactivate||"Re-subscribe now and re-activate all these features"}:{title:a.t_subscription_required||"Subscription Required",subtitle:a.t_subscription_required_message||"Subscribe to a plan to activate all features and continue using your store"},he=E?.template?.theme?.logo,fe=fa(he,o),ie=fe?fe.startsWith("http")?fe:`${Hn}/${fe.replace(/^\//,"")}`:null,me=ie&&!x,ke=(E?.name||"Store").trim().split(/\s+/).filter(Boolean),oe=ke.length<=1?(ke[0]||"S").substring(0,2).toUpperCase():ke.slice(0,2).map(se=>se.charAt(0)).join("").toUpperCase();return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[9998] pointer-events-none"}),t.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[9999] p-4 pointer-events-none",children:t.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl max-w-lg w-full relative overflow-hidden pointer-events-auto",dir:o?"rtl":"ltr",children:[t.jsx("div",{className:"absolute top-0 left-0 right-0 h-32 bg-gradient-to-br from-brand/10 to-brand-secondary/10"}),t.jsxs("div",{className:"relative p-6 pt-10",children:[t.jsx("div",{className:"flex justify-center mb-5",children:t.jsx("div",{className:"w-20 h-20 rounded-full bg-white shadow-xl flex items-center justify-center border-4 border-brand/10",children:me?t.jsx("img",{src:ie,alt:E.name||"Store Logo",className:"w-full h-full rounded-full object-cover",onError:()=>v(!0)}
5):t.jsx("div",{className:"w-14 h-14 rounded-full bg-brand/10 flex items-center justify-center",children:t.jsx("span",{className:"text-base font-bold text-brand-secondary",children:oe})})})}),t.jsx("h2",{className:"text-xl font-bold text-center mb-2 text-gray-900",children:ee.title}),t.jsx("p",{className:"text-center text-gray-600 mb-5 text-sm leading-relaxed max-w-sm mx-auto",children:ee.subtitle}),k.length>1&&t.jsx("div",{className:"mb-5",children:t.jsxs("div",{className:"bg-brand/5 border border-brand/20 rounded-xl p-3",children:[t.jsxs("div",{className:"text-center mb-2",children:[t.jsx("p",{className:"text-sm text-brand-secondary font-medium mb-1",children:a.t_switch_to_another_store||"Switch to another store"}),t.jsx("p",{className:"text-xs text-gray-600",children:k.length===1?a.t_you_have_one_store||"You have 1 store":(a.t_you_have_stores||"You have {count} stores").replace("{count}",k.length)})]}),t.jsxs(ll,{open:g,onOpenChange:y,children:[t.jsx(dl,{asChild:!0,children:t.jsxs(mt,{variant:"outline",className:"w-full justify-between bg-white border-brand/30 hover:border-brand transition-colors",children:[t.jsx("span",{className:"text-brand-secondary",children:a.t_select_store||"Select a store to switch"}),t.jsx(is,{className:"h-4 w-4 text-brand-secondary"})]})}),t.jsx(ul,{className:"w-full p-0 z-[10000]",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:t.jsxs(pl,{shouldFilter:!1,children:[t.jsx(ml,{placeholder:a.t_search_stores||"Search stores...",value:p,onValueChange:f,className:"h-9"}),t.jsx(im,{children:a.t_no_stores_found||"No stores found."}),t.jsx(aa,{className:"max-h-[300px] overflow-auto",children:L.map(se=>{const de=A(se),ue=String(se.id)===String(d?.id)&&er(se);return t.jsx(gl,{onSelect:()=>!ue&&B(se),disabled:ue,className:Et("cursor-pointer",ue&&"opacity-50 cursor-not-allowed"),children:t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Gc,{className:"h-4 w-4 text-gray-500"}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-medium text-sm",children:se.name}),se.uid&&t.jsxs("span",{className:"text-xs text-gray-500",children:["@",se.uid]}),t.jsx("span",{className:"text-xs text-gray-600 mt-0.5",children:Ts(se.activeSubscription)||a.t_no_plan||"No plan"}),(()=>{const ve=se.activeSubscription;if(!ve)return null;const Ve=ve.trialEndsAt||ve.endsAt||ve.expiresAt;if(!Ve)return null;const Te=et=>{const ge={day:"numeric",month:"short",year:"numeric"};return new Date(et).toLocaleDateString(a.language==="ar"?"ar-SA":"en-US",ge)},Ge=new Date(Ve)<new Date,Be=Ge?a.t_expired||"Expired":a.t_expires||"Expires";return t.jsxs("span",{className:`text-xs mt-0.5 ${Ge?"text-red-500":"text-blue-600"}`,children:[Be,": ",Te(Ve)]})})()]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(oa,{variant:"outline",className:`text-xs ${de.color}`,children:de.label}),String(se.id)===String(d?.id)&&t.jsx(oa,{variant:"outline",className:"text-xs bg-brand text-brand-secondary border-brand",children:a.t_current||"Current"})]})]})},se.id)})})]})})]})]})}),!$&&t.jsxs("div",{className:"bg-gray-50 rounded-2xl p-5 mb-6",children:[t.jsxs("h3",{className:"text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2",children:[t.jsx(Da,{className:"w-4 h-4 text-brand-secondary"}),a.t_features_included||"Features Included"]}),t.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-[200px] overflow-y-auto",children:U.map((se,de)=>t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-4 h-4 rounded-full bg-brand/10 flex items-center justify-center flex-shrink-0",children:t.jsx(Dn,{className:"w-2.5 h-2.5 text-brand"})}),t.jsx("span",{className:"text-xs text-gray-700",children:se})]},de))})]}),t.jsx("div",{className:"space-y-3",children:$?t.jsxs(t.Fragment,{children:[t.jsx(mt,{onClick:pe,className:"w-full bg-brand hover:bg-brand/90 text-brand-secondary py-2.5 rounded-xl font-semibold shadow-md hover:shadow-lg transition-all",size:"lg",children:t.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.t_fix_vat_compliance||"Fix VAT c
5ompliance",t.jsx("span",{className:"text-lg",children:"→"})]})}),t.jsx(mt,{onClick:te,variant:"outline",className:"w-full border-brand/30 text-brand-secondary hover:bg-brand/10 py-2.5 rounded-xl font-semibold",size:"lg",children:a.t_contact_support||"Contact Support"})]}):t.jsxs(t.Fragment,{children:[t.jsx(mt,{onClick:re,className:"w-full bg-brand hover:bg-brand/90 text-brand-secondary py-2.5 rounded-xl font-semibold shadow-md hover:shadow-lg transition-all",size:"lg",children:t.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.t_subscribe_now||"Subscribe now",t.jsx("span",{className:"text-lg",children:"→"})]})}),t.jsx("button",{onClick:R,className:"w-full text-sm text-brand-secondary hover:text-brand-secondary/80 transition-colors py-2",children:a.t_sign_out||"Sign Out"})]})})]})]})})]})},_f=`
6  <header class="doc-head">
7    <h1>اتفاقية باكمان الرئيسية للمنصة</h1>
8    <p class="sub">اتفاقية الوصول إلى المنصة متعددة الولايات القضائية</p>
9    <p class="sub">سارية عبر الإمارات العربية المتحدة والمملكة العربية السعودية وسلطنة عُمان وأسواق باكمان المستقبلية</p>
10  </header>
11
12  <section class="clause"><h2><span class="num">1.</span>معلومات الشركة</h2><p>الإمارات العربية المتحدة: Packman Portal LLC (رقم الرخصة <span class="ltr">873754</span>)، القوز الصناعية الأولى، دبي. المملكة العربية السعودية: Packman for Information Technology Services (رقم السجل التجاري <span class="ltr">2408302757</span>). سلطنة عُمان: Packman Portal SPC (رقم السجل التجاري <span class="ltr">1580113</span>).</p></section>
13  <section class="clause"><h2><span class="num">2.</span>الغرض</h2><p>تحكم هذه الاتفاقية الوصول إلى منصة باكمان واستخدامها، بما في ذلك البرمجيات والمواقع الإلكترونية وتطبيقات الهاتف المحمول وأدوات الذكاء الاصطناعي وواجهات برمجة التطبيقات وأنظمة الخدمات اللوجستية والخدمات المستقبلية.</p></section>
14  <section class="clause"><h2><span class="num">3.</span>التعريفات</h2><p>تعريفات لكل من المنصة والبائع والعميل والخدمات والمحتوى والإقليم والشركات التابعة.</p></section>
15  <section class="clause"><h2><span class="num">4.</span>الأهلية</h2><p>يؤكد البائع أهليته القانونية وصلاحيته والتزامه بالقوانين المعمول بها.</p></section>
16  <section class="clause"><h2><span class="num">5.</span>التحقق من الهوية ومبدأ "اعرف عميلك" (KYC)</h2><p>يجوز لباكمان طلب التراخيص والهويات والتسجيلات الضريبية ومعلومات الملكية ووثائق الامتثال في أي وقت.</p></section>
17  <section class="clause"><h2><span class="num">6.</span>الوصول إلى المنصة</h2><p>حق قابل للإلغاء وغير حصري وغير قابل للتحويل في استخدام المنصة.</p></section>
18  <section class="clause"><h2><span class="num">7.</span>مسؤوليات البائع</h2><p>يظل البائع مسؤولاً عن المنتجات والأوصاف والتسعير والضرائب والامتثال والتزامات العملاء.</p></section>
19  <section class="clause"><h2><span class="num">8.</span>علاقة السوق</h2><p>تعمل باكمان كمزوّد للخدمات التقنية والتشغيلية وليست البائع المسجل.</p></section>
20  <section class="clause"><h2><span class="num">9.</span>الامتثال التنظيمي</h2><p>يجب على البائع الامتثال لجميع القوانين واللوائح ومتطلبات الجمارك وقواعد العقوبات ومتطلبات حماية المستهلك.</p></section>
21  <section class="clause"><h2><span class="num">10.</span>مكافحة غسل الأموال والجرائم المالية</h2><p>يجوز لباكمان التحقيق في الحسابات المرتبطة بالأنشطة المشبوهة والإبلاغ عنها وتعليقها.</p></section>
22  <section class="clause"><h2><span class="num">11.</span>الأنشطة المحظورة</h2><p>يُحظر التقليد والمنتجات غير المشروعة والاحتيال وانتهاك الملكية الفكرية وانتهاكات العقوبات وإساءة اØ
22³ØªØ®Ø¯Ø§Ù… المنصة.</p></section>
23  <section class="clause"><h2><span class="num">12.</span>الملكية الفكرية</h2><p>تحتفظ باكمان بملكية جميع البرمجيات وأنظمة الذكاء الاصطناعي والشيفرة البرمجية والعلامات التجارية والتقنية.</p></section>
24  <section class="clause"><h2><span class="num">13.</span>ملكية محتوى البائع</h2><p>يحتفظ البائع بملكية المحتوى الذي يرفعه ويمنح باكمان الحقوق اللازمة لتقديم الخدمات.</p></section>
25  <section class="clause"><h2><span class="num">14.</span>ملكية الملاحظات</h2><p>يجوز لباكمان استخدام الاقتراحات والتحسينات والملاحظات دون قيد أو تعويض.</p></section>
26  <section class="clause"><h2><span class="num">15.</span>حماية البيانات والخصوصية</h2><p>يجوز لباكمان معالجة البيانات ونقلها حسب الضرورة لتقديم الخدمات والامتثال للمتطلبات القانونية.</p></section>
27  <section class="clause"><h2><span class="num">16.</span>خدمات الذكاء الاصطناعي</h2><p>تُقدَّم مخرجات الذكاء الاصطناعي على سبيل المساعدة فقط. ويظل البائع مسؤولاً عن القرارات النهائية وعمليات النشر.</p></section>
28  <section class="clause"><h2><span class="num">17.</span>خدمات الأطراف الثالثة</h2><p>لا تتحمل باكمان المسؤولية عن إخفاقات بوابات الدفع ومزوّدي الخدمات اللوجستية والشبكات الاجتماعية والجهات التنظيمية أو غيرها من الأطراف الثالثة.</p></section>
29  <section class="clause"><h2><span class="num">18.</span>الرسوم والمدفوعات</h2><p>قد تختلف الرسوم المعمول بها حسب السوق والخدمة والولاية القضائية، وقد يتم تحديثها من وقت لآخر.</p></section>
30  <section class="clause"><h2><span class="num">19.</span>عمليات رد المبالغ والاحتيال وحجز التسويات</h2><p>يجوز لباكمان حجز التسويات وعكس المعاملات واسترداد الخسائر الناشئة عن النزاعات أو الاحتيال.</p></section>
31  <section class="clause"><h2><span class="num">20.</span>الاتفاقيات الخاصة بالخدمات</h2><p>قد تتطلب خدمات التنفيذ والتخزين والتمويل والتسويق ومعالجة المدفوعات وغيرها اتفاقيات منفصلة.</p></section>
32  <section class="clause"><h2><span class="num">21.</span>الأمان</h2><p>يجب على البائع حماية بيانات الاعتماد والإبلاغ الفوري عن أي وصول غير مصرح به.</p></section>
33  <section class="clause"><h2><span class="num">22.</span>الاتصالات الإلكترونية</h2><p>يُعدّ البريد الإلكتروني وواتساب والرسائل النصية القصيرة والمكالمات وإشعارات لوحة التحكم اتصالات صحيحة ومعتبرة.</p></section>
34  <section class="clause"><h2><span class="num">23.</span>التعليق والإنهاء</h2><p>يجوز لباكمان تعليق الحسابات أو إنهاؤها بسبب عدم الامتثال أو الاحتيال أو المخالفات القانونية أو المخاطر الأمنية أو الأرصدة غير المسددة.</p></section>
35  <section class="clause"><h2><span class="num">24.</span>إخلاء المسؤولية عن الضمانات</h2><p>تُقدَّم الخدمات على أساس "كما هي" و"حسبما هو متاح".</p></section>
36  <section class="clause"><h2><span class="num">25.</span>تحديد المسؤولية</h2><p>إلى أقصى حد يسمح به القانون، لا تتجاوز المسؤولية الإجمالية لباكمان إجمالي المبلغ الذي دفعه البائع خلال الاثني عشر شهراً السابقة التي نشأت عنها المطالبة.</p></section>
37  <section class="clause"><h2><span class="num">26.</span>التعويض</h2><p>يعوّض البائع باكمان عن المطالبات الناشئة عن منتجات البائع أو محتواه أو سلوكه أو مخالفاته القانونية.</p></section>
38  <section class="clause"><h2><span class="num">27.</span>القوة القاهرة</h2><p>لا تتحمل باكمان المسؤولية عن الأحداث الخارجة عن السيطرة المعقولة.</p></section>
39  <section class="clause"><h2><span class="num">28.</span>التنازل</h2><p>يجوز لباكمان التنازل عن هذه الاتفاقية أو تحويلها كجزء من إعادة الهيكلة أو الاستحواذ أو المعاملات المؤسسية.</p></section>
40  <section class="clause"><h2><span class="num">29.</span>الاستمرارية</h2><p>تظل الالتزامات الرئيسية سارية بعد الإنهاء، بما في ذلك الملكية الفكرية والسرية والمسؤولية والتزامات الدفع.</p></section>
41  <section class="clause"><h2><span class="num">30.</span>الاتفاقية الكاملة</h2><p>تحل هذه الاتفاقية محل أي تفاهمات سابقة تتعلق بالوصول إلى المنصة.</p></section>
42  <section class="clause"><h2><span class="num">31.</span>التعديلات</h2><p>يجوز لباكمان تحديث الاتفاقية، ويُعدّ الاستمرار في الاستخدام قبولاً بها.</p></section>
43  <section class="clause"><h2><span class="num">32.</span>القانون الحاكم</h2><p>تسري القوانين المعمول بها على كيان باكمان الذي يقدّم الخدمات، مع مراعاة القوانين المحلية الإلزامية.</p></section>
44  <section class="clause"><h2><span class="num">33.</span>القبول الإلكتروني</h2><p>يُشكّل النقر على "أوافق" (I Accept) اتفاقية ملزمة قانوناً.</p></section>
45  <section class="clause"><h2><span class="num">34.</span>معلومات الاتصال</h2><p>تُدرَج تفاصيل الاتصال الرسمية المتعلقة بالشؤون القانونية والامتثال من قِبل فريق باكمان القانوني.</p></section>
46
47  <div class="tc-footer-note">اتفاقية باكمان الرئيسية للمنصة &mdash; اتفاقية الوصول إلى المنصة متعددة الولايات القضائية</div>
48`,wf=`
49.seller-terms-dialog {
50  --ink: #1a1a2e;
51  --paper: #faf9f7;
52  --accent: #2d5a8e;
53  --accent-light: #e8f0f8;
54  --border: #d4d0ca;
55  --muted: #6b6b7b;
56  --red: #c0392b;
57  --amber: #e67e22;
58  --section-bg: #ffffff;
59  --highlight: #fffde7;
60  font-family: inherit;
61  color: var(--ink);
62}
63
64.seller-terms-dialog .modal {
65  background: var(--paper);
66  width: 100%;
67  max-width: 820px;
68  max-height: min(92vh, 860px);
69  border-radius: 14px;
70  overflow: hidden;
71  display: flex;
72  flex-direction: column;
73  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
74}
75
76@supports (height: 100dvh) {
77  .seller-terms-dialog .modal {
78    max-height: min(
79      calc(100dvh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)),
80      860px
81    );
82  }
83}
84
85.seller-terms-dialog .modal-header {
86  background: var(--ink);
87  color: #fff;
88  padding: 1.5rem 2rem;
89  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
90  display: flex;
91  justify-content: space-between;
92  align-items: center;
93  flex-shrink: 0;
94}
95
96.seller-terms-dialog .modal-header-right {
97  display: flex;
98  align-items: center;
99  gap: 0.75rem;
100}
101
102.seller-terms-dialog .modal-header-left h2 {
103  font-size: 1.25rem;
104  font-weight: 600;
105}
106
107.seller-terms-dialog .modal-header-left span {
108  font-size: 0.75rem;
109  color: rgba(255, 255, 255, 0.5);
110}
111
112.seller-terms-dialog .modal-close {
113  width: 36px;
114  height: 36px;
115  background: rgba(255, 255, 255, 0.1);
116  border: 1px solid rgba(255, 255, 255, 0.15);
117  border-radius: 8px;
118  color: #fff;
119  font-size: 1.2rem;
120  cursor: pointer;
121  display: flex;
122  align-items: center;
123  justify-content: center;
124  transition: background 0.2s;
125}
126
127.seller-terms-dialog .modal-close:hover {
128  background: rgba(255, 255, 255, 0.2);
129}
130
131.seller-terms-dialog .lang-switcher {
132  display: inline-flex;
133  align-items: center;
134  gap: 0.35rem;
135  padding: 0.25rem;
136  border-radius: 10px;
137  background: rgba(255, 255, 255, 0.08);
138  border: 1px solid rgba(255, 255, 255, 0.14);
139}
140
141.seller-terms-dialog .lang-btn {
142  border: none;
143  background: transparent;
144  color: rgba(255, 255, 255, 0.72);
145  border-radius: 8px;
146  padding: 0.45rem 0.8rem;
147  font-size: 0.82rem;
148  font-weight: 600;
149  font-family: inherit;
150  cursor: pointer;
151  transition: background 0.2s, color 0.2s;
152}
153
154.seller-terms-dialog .lang-btn:hover {
155  color: #fff;
156}
157
158.seller-terms-dialog .lang-btn.active {
159  background: #fff;
160  color: var(--ink);
161}
162
163.seller-terms-dialog .modal-scroll {
164  position: relative;
165  flex: 1;
166  display: flex;
167  min-height: 0;
168}
169
170.seller-terms-dialog .modal-body {
171  overflow-y: auto;
172  padding: 2rem;
173  flex: 1;
174  line-height: 1.7;
175}
176
177/* Floating "keep scrolling" guide. Visible until the seller reaches the
178   bottom of the terms, so they understand the Accept button unlocks only
179   after they've read through. */
180.seller-terms-dialog .scroll-hint {
181  position: absolute;
182  bottom: 1rem;
183  left: 50%;
184  display: inline-flex;
185  align-items: center;
186  gap: 0.4rem;
187  padding: 0.55rem 1rem 0.55rem 1.1rem;
188  background: var(--ink);
189  color: #fff;
190  border: none;
191  border-radius: 999px;
192  font-family: inherit;
193  font-size: 0.78rem;
194  font-weight: 600;
195  cursor: pointer;
196  z-index: 5;
197  transform: translateX(-50%);
198  transform-origin: center bottom;
199  animation:
200    sellerTermsHintIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both,
201    sellerTermsHintFloat 2.4s ease-in-out 0.4s infinite;
202}
203
204/* Pulsing glow ring behind the pill to draw the eye. */
205.seller-terms-dialog .scroll-hint::before {
206  content: "";
207  position: absolute;
208  inset: 0;
209  border-radius: inherit;
210  background: var(--ink);
211  z-index: -1;
212  animation: sellerTermsHintPulse 2s ease-out infinite;
213}
214
215.seller-terms-dialog .scroll-hint:hover {
216  background: #2a2a45;
217}
218
219.seller-terms-dialog .scroll-hint .scroll-hint-chevron {
220  animation: sellerTermsScrollBounce 1.2s ease-in-out infinite;
221}
222
223@keyframes sellerTermsHintIn {
224  from {
225    opacity: 0;
226    transform: translateX(-50%) translateY(14px) scale(0.85);
227  }
228  to {
229    opacity: 1;
230    transform: translateX(-50%) translateY(0) scale(1);
231  }
232}
233
234@keyframes sellerTermsHintFloat {
235  0%,
236  100% {
237    transform: translateX(-50%) translateY(0);
238  }
239  50% {
240    transform: translateX(-50%) translateY(-5px);
241  }
242}
243
244@keyframes sellerTermsHintPulse {
245  0% {
246    opacity: 0.55;
247    transform: scale(1);
248  }
249  70%,
250  100% {
251    opacity: 0;
252    transform: scale(1.35);
253  }
254}
255
256@keyframes sellerTermsScrollBounce {
257  0%,
258  100% {
259    transform: translateY(0);
260  }
261  30% {
262    transform: translateY(4px);
263  }
264  60% {
265    transform: translateY(1px);
266  }
267}
268
269@media (prefers-reduced-motion: reduce) {
270  .seller-terms-dialog .scroll-hint,
271  .seller-terms-dialog .scroll-hint::before,
272  .seller-terms-dialog .scroll-hint .scroll-hint-chevron {
273    animation: none;
274  }
275}
276
277.seller-terms-dialog[dir="rtl"] .modal-header-left,
278.seller-terms-dialog[dir="rtl"] .modal-body,
279.seller-terms-dialog[dir="rtl"] .modal-footer {
280  text-align: right;
281}
282
283.seller-terms-dialog[dir="rtl"] .toc ol,
284.seller-terms-dialog[dir="rtl"] .subsection ul {
285  padding-left: 0;
286  padding-right: 1.25rem;
287}
288
289.seller-terms-dialog[dir="rtl"] .fee-table th,
290.seller-terms-dialog[dir="rtl"] .fee-table td {
291  text-align: right;
292}
293
294.seller-terms-dialog[dir="rtl"] .highlight-box {
295  border-left: none;
296  border-right: 3px solid var(--amber);
297  border-radius: 6px 0 0 6px;
298}
299
300.seller-terms-dialog[dir="rtl"] .alert-box {
301  border-left: none;
302  border-right: 3px solid var(--red);
303  border-radius: 6px 0 0 6px;
304}
305
306.seller-terms-dialog .modal-footer {
307  padding: 1rem 2rem;
308  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
309  border-top: 1px solid var(--border);
310  display: flex;
311  justify-content: flex-end;
312  gap: 0.75rem;
313  flex-shrink: 0;
314  background: #fff;
315}
316
317.seller-terms-dialog .btn-modal {
318  padding: 0.6rem 1.5rem;
319  border-radius: 8px;
320  font-family: inherit;
321  font-size: 0.88rem;
322  font-weight: 600;
323  cursor: pointer;
324  transition: background 0.2s, opacity 0.2s;
325  border: none;
326}
327
328.seller-terms-dialog .btn-modal-close {
329  background: #eee;
330  color: var(--ink);
331}
332
333.seller-terms-dialog .btn-modal-close:hover {
334  background: #ddd;
335}
336
337.seller-terms-dialog .btn-modal-accept {
338  background: var(--accent);
339  color: #fff;
340}
341
342.seller-terms-dialog .btn-modal-accept:hover:enabled {
343  background: #1e4570;
344}
345
346.seller-terms-dialog .btn-modal-accept:disabled {
347  opacity: 0.45;
348  cursor: not-allowed;
349}
350
351.seller-terms-dialog .tc-jurisdiction {
352  text-align: center;
353  padding: 1rem 0;
354  font-size: 0.82rem;
355  color: var(--muted);
356  border-bottom: 1px solid var(--border);
357  margin-bottom: 2rem;
358}
359
360.seller-terms-dialog .toc {
361  background: var(--section-bg);
362  border: 1px solid var(--border);
363  border-radius: 10px;
364  padding: 1.5rem;
365  margin-bottom: 2.5rem;
366}
367
368.seller-terms-dialog .toc h3 {
369  font-size: 1rem;
370  margin-bottom: 0.75rem;
371  color: var(--accent);
372  font-weight: 600;
373}
374
375.seller-terms-dialog .toc ol {
376  padding-left: 1.5rem;
377}
378
379.seller-terms-dialog .toc li {
380  padding: 0.3rem 0;
381  font-size: 0.85rem;
382  color: var(--muted);
383}
384
385.seller-terms-dialog .toc a {
386  color: inherit;
387  text-decoration: none;
388}
389
390.seller-terms-dialog .toc a:hover {
391  color: var(--accent);
392}
393
394.seller-terms-dialog .section {
395  margin-bottom: 2.5rem;
396  scroll-margin-top: 1rem;
397}
398
399.seller-terms-dialog .section-number {
400  font-size: 0.68rem;
401  text-transform: uppercase;
402  letter-spacing: 0.2em;
403  color: var(--accent);
404  font-weight: 600;
405  margin-bottom: 0.2rem;
406}
407
408.seller-terms-dialog .section h2 {
409  font-size: 1.2rem;
410  font-weight: 600;
411  margin-bottom: 0.85rem;
412  padding-bottom: 0.6rem;
413  border-bottom: 2px solid var(--accent-light);
414}
415
416.seller-terms-dialog .section p {
417  margin-bottom: 0.85rem;
418  font-size: 0.88rem;
419  color: #333;
420}
421
422.seller-terms-dialog .subsection {
423  background: var(--section-bg);
424  border: 1px solid var(--border);
425  border-radius: 8px;
426  padding: 1.25rem;
427  margin: 0.75rem 0;
428}
429
430.seller-terms-dialog .subsection h3 {
431  font-size: 0.9rem;
432  font-weight: 600;
433  margin-bottom: 0.6rem;
434}
435
436.seller-terms-dialog .subsection ul {
437  padding-left: 1.25rem;
438}
439
440.seller-terms-dialog .subsection li {
441  font-size: 0.85rem;
442  color: #444;
443  margin-bottom: 0.35rem;
444}
445
446.seller-terms-dialog .fee-table {
447  width: 100%;
448  border-collapse: separate;
449  border-spacing: 0;
450  border: 1px solid var(--border);
451  border-radius: 8px;
452  overflow: hidden;
453  margin: 0.75rem 0;
454  font-size: 0.84rem;
455}
456
457.seller-terms-dialog .fee-table th {
458  background: var(--ink);
459  color: #fff;
460  font-weight: 500;
461  text-align: left;
462  padding: 0.6rem 0.85rem;
463  font-size: 0.76rem;
464  text-transform: uppercase;
465  letter-spacing: 0.08em;
466}
467
468.seller-terms-dialog .fee-table td {
469  padding: 0.55rem 0.85rem;
470  border-bottom: 1px solid var(--border);
471  color: #444;
472}
473
474.seller-terms-dialog .fee-table tr:last-child td {
475  border-bottom: none;
476}
477
478.seller-terms-dialog .fee-table tr:nth-child(even) td {
479  background: #fafafa;
480}
481
482.seller-terms-dialog .highlight-box {
483  background: var(--highlight);
484  border-left: 3px solid var(--amber);
485  padding: 0.85rem 1rem;
486  border-radius: 0 6px 6px 0;
487  margin: 0.75rem 0;
488  font-size: 0.84rem;
489  color: #555;
490}
491
492.seller-terms-dialog .highlight-box strong,
493.seller-terms-dialog .alert-box strong {
494  color: var(--ink);
495}
496
497.seller-terms-dialog .alert-box {
498  background: #fef2f2;
499  border-left: 3px solid var(--red);
500  padding: 0.85rem 1rem;
501  border-radius: 0 6px 6px 0;
502  margin: 0.75rem 0;
503  font-size: 0.84rem;
504  color: #555;
505}
506
507.seller-terms-dialog .badge {
508  display: inline-block;
509  font-size: 0.68rem;
510  font-weight: 600;
511  text-transform: uppercase;
512  letter-spacing: 0.06em;
513  padding: 0.15rem 0.5rem;
514  border-radius: 4px;
515  background: #e8f0f8;
516  color: var(--accent);
517}
518
519.seller-terms-dialog .tc-footer-note {
520  text-align: center;
521  padding: 1.5rem 0 0;
522  font-size: 0.76rem;
523  color: var(--muted);
524  border-top: 1px solid var(--border);
525  margin-top: 1rem;
526}
527
528.seller-terms-dialog .doc-head {
529  text-align: center;
530  border-bottom: 2px solid var(--accent);
531  padding-bottom: 1rem;
532  margin-bottom: 1.25rem;
533}
534
535.seller-terms-dialog .doc-head h1 {
536  font-size: 1.35rem;
537  margin: 0 0 0.35rem;
538  color: var(--accent);
539}
540
541.seller-terms-dialog .doc-head .sub {
542  margin: 0.1rem 0;
543  color: var(--muted);
544  font-size: 0.86rem;
545}
546
547.seller-terms-dialog .clause {
548  margin: 0 0 1rem;
549}
550
551.seller-terms-dialog .clause h2 {
552  font-size: 0.98rem;
553  margin: 0 0 0.35rem;
554  color: var(--ink);
555  font-weight: 700;
556}
557
558.seller-terms-dialog .clause .num {
559  color: var(--accent);
560  margin-right: 0.4rem;
561}
562
563.seller-terms-dialog[dir="rtl"] .clause .num {
564  margin-right: 0;
565  margin-left: 0.4rem;
566}
567
568.seller-terms-dialog .clause p {
569  margin: 0;
570  font-size: 0.9rem;
571  color: #2a2a2a;
572}
573
574.seller-terms-dialog .ltr {
575  direction: ltr;
576  unicode-bidi: embed;
577}
578
579@media (max-width: 600px) {
580  .seller-terms-dialog .modal {
581    max-height: min(95vh, 860px);
582  }
583
584  @supports (height: 100dvh) {
585    .seller-terms-dialog .modal {
586      max-height: min(
587        calc(100dvh - 0.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)),
588        860px
589      );
590    }
591  }
592
593  .seller-terms-dialog .modal-body {
594    padding: 1rem;
595    font-size: 0.82rem;
596    line-height: 1.6;
597  }
598
599  .seller-terms-dialog .modal-header {
600    padding: 0.75rem 1rem;
601    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
602  }
603
604  .seller-terms-dialog .modal-header-left h2 {
605    font-size: 1rem;
606  }
607
608  .seller-terms-dialog .modal-header-left span {
609    font-size: 0.65rem;
610  }
611
612  .seller-terms-dialog .modal-footer {
613    padding: 0.6rem 1rem;
614    padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
615    flex-wrap: wrap;
616  }
617
618  .seller-terms-dialog .btn-modal {
619    padding: 0.5rem 1rem;
620    font-size: 0.8rem;
621    flex: 1;
622    min-width: 0;
623    text-align: center;
624  }
625
626  .seller-terms-dialog .lang-btn {
627    padding: 0.3rem 0.55rem;
628    font-size: 0.72rem;
629  }
630
631  .seller-terms-dialog .section h2 {
632    font-size: 1rem;
633  }
634
635  .seller-terms-dialog .section p {
636    font-size: 0.8rem;
637  }
638
639  .seller-terms-dialog .subsection {
640    padding: 0.85rem;
641  }
642
643  .seller-terms-dialog .subsection h3 {
644    font-size: 0.82rem;
645  }
646
647  .seller-terms-dialog .subsection li {
648    font-size: 0.78rem;
649  }
650
651  .seller-terms-dialog .toc {
652    padding: 1rem;
653    margin-bottom: 1.5rem;
654  }
655
656  .seller-terms-dialog .toc li {
657    font-size: 0.78rem;
658  }
659
660  .seller-terms-dialog .fee-table {
661    font-size: 0.75rem;
662  }
663
664  .seller-terms-dialog .fee-table th,
665  .seller-terms-dialog .fee-table td {
666    padding: 0.35rem 0.45rem;
667  }
668
669  .seller-terms-dialog .fee-table th {
670    font-size: 0.68rem;
671  }
672
673  .seller-terms-dialog .highlight-box,
674  .seller-terms-dialog .alert-box {
675    padding: 0.65rem 0.8rem;
676    font-size: 0.78rem;
677  }
678
679  .seller-terms-dialog .section {
680    margin-bottom: 1.5rem;
681  }
682}
683`,vf=`
684  <header class="doc-head">
685    <h1>Packman Master Platform Agreement</h1>
686    <p class="sub">Multi-Jurisdiction Platform Access Agreement</p>
687    <p class="sub">Applicable Across UAE, Saudi Arabia, Oman and Future Packman Markets</p>
688  </header>
689
690  <section class="clause"><h2><span class="num">1.</span>Company Information</h2><p>United Arab Emirates: Packman Portal LLC (License No. 873754), Al Quoz Industrial Area 1, Dubai. Kingdom of Saudi Arabia: Packman for Information Technology Services (CR No. 2408302757). Sultanate of Oman: Packman Portal SPC (CR No. 1580113).</p></section>
691  <section class="clause"><h2><span class="num">2.</span>Purpose</h2><p>This Agreement governs access to and use of the Packman platform, software, websites, mobile applications, AI tools, APIs, logistics systems and future services.</p></section>
692  <section class="clause"><h2><span class="num">3.</span>Definitions</h2><p>Definitions for Platform, Seller, Customer, Services, Content, Territory and Affiliates.</p></section>
693  <section class="clause"><h2><span class="num">4.</span>Eligibility</h2><p>Seller confirms legal capacity, authority and compliance with applicable laws.</p></section>
694  <section class="clause"><h2><span class="num">5.</span>Identity Verification &amp; KYC</h2><p>Packman may request licenses, IDs, tax registrations, ownership information and compliance documentation at any time.</p></section>
695  <section class="clause"><h2><span class="num">6.</span>Platform Access</h2><p>Revocable, non-exclusive and non-transferable right to use the Platform.</p></section>
696  <section class="clause"><h2><span class="num">7.</span>Seller Responsibilities</h2><p>Seller remains responsible for products, descriptions, pricing, taxes, compliance and customer obligations.</p></section>
697  <section class="clause"><h2><span class="num">8.</span>Marketplace Relationship</h2><p>Packman acts as a technology and operational services provider and is not the seller of record.</p></section>
698  <section class="clause"><h2><span class="num">9.</span>Regulatory Compliance</h2><p>Seller must comply with all laws, regulations, customs requirements, sanctions rules and consumer protection requirements.</p></section>
699  <section class="clause"><h2><span class="num">10.</span>AML &amp; Financial Crime</h2><p>Packman may investigate, report and suspend accounts related to suspicious activities.</p></section>
700  <section class="clause"><h2><span class="num">11.</span>Prohibited Activities</h2><p>Counterfeits, unlawful products, fraud, IP infringement, sanctions violations and misuse of the Platform are prohibited.</p></section>
701  <section class="clause"><h2><span class="num">12.</span>Intellectual Property</h2><p>Packman retains ownership of all software, AI systems, code, trademarks and technology.</p></section>
702  <section class="clause"><h2><span class="num">13.</span>Seller Content Ownership</h2><p>Seller retains ownership of uploaded content and grants Packman rights necessary to provide services.</p></section>
703  <section class="clause"><h2><span class="num">14.</span>Feedback Ownership</h2><p>Suggestions, improvements and feedback may be used by Packman without restriction or compensation.</p></section>
704  <section class="clause"><h2><span class="num">15.</span>Data Protection &amp; Privacy</h2><p>Packman may process and transfer data as necessary to provide services and comply with legal requirements.</p></section>
705  <section class="clause"><h2><span class="num">16.</span>Artificial Intelligence Services</h2><p>AI outputs are provided as assistance only. Seller remains responsible for final decisions and publications.</p></section>
706  <section class="clause"><h2><span class="num">17.</span>Third-Party Services</h2><p>Packman is not liable for failures of payment gateways, logistics providers, social networks, regulators or other third parties.</p></section>
707  <section class="clause"><h2><span class="num">18.</span>Fees &amp; Payments</h2><p>Applicable fees may vary by market, service and jurisdiction and may be updated from time to time.</p></section>
708  <section class="clause"><h2><span class="num">19.</span>Chargebacks, Fraud &amp; Settlement Holds</h2><p>Packman may withhold settlements, reverse transactions and recover losses arising from disputes or fraud.</p></section>
709  <section class="clause"><h2><span class="num">20.</span>Service-Specific Agreements</h2><p>Fulfillment, Warehousing, Funding, Marketing, Payment Processing and other services may require separate agreements.</p></section>
710  <section class="clause"><h2><span class="num">21.</span>Security</h2><p>Seller must protect credentials and promptly report unauthorized access.</p></section>
711  <section class="clause"><h2><span class="num">
71122.</span>Electronic Communications</h2><p>Email, WhatsApp, SMS, calls and dashboard notifications constitute valid communications.</p></section>
712  <section class="clause"><h2><span class="num">23.</span>Suspension &amp; Termination</h2><p>Packman may suspend or terminate accounts for non-compliance, fraud, legal violations, security risks or unpaid balances.</p></section>
713  <section class="clause"><h2><span class="num">24.</span>Disclaimer of Warranties</h2><p>Services are provided on an as-is and as-available basis.</p></section>
714  <section class="clause"><h2><span class="num">25.</span>Limitation of Liability</h2><p>To the maximum extent permitted by law, Packman's aggregate liability shall not exceed the total amount paid by Seller during the preceding twelve months giving rise to the claim.</p></section>
715  <section class="clause"><h2><span class="num">26.</span>Indemnification</h2><p>Seller indemnifies Packman against claims arising from Seller products, content, conduct or legal violations.</p></section>
716  <section class="clause"><h2><span class="num">27.</span>Force Majeure</h2><p>Packman is not liable for events beyond reasonable control.</p></section>
717  <section class="clause"><h2><span class="num">28.</span>Assignment</h2><p>Packman may assign or transfer this Agreement as part of restructuring, acquisition or corporate transactions.</p></section>
718  <section class="clause"><h2><span class="num">29.</span>Survival</h2><p>Key obligations survive termination including IP, confidentiality, liability and payment obligations.</p></section>
719  <section class="clause"><h2><span class="num">30.</span>Entire Agreement</h2><p>This Agreement supersedes prior understandings relating to platform access.</p></section>
720  <section class="clause"><h2><span class="num">31.</span>Amendments</h2><p>Packman may update the Agreement and continued use constitutes acceptance.</p></section>
721  <section class="clause"><h2><span class="num">32.</span>Governing Law</h2><p>The laws applicable to the Packman entity providing services shall apply, subject to mandatory local laws.</p></section>
722  <section class="clause"><h2><span class="num">33.</span>Electronic Acceptance</h2><p>Clicking 'I Accept' constitutes a legally binding agreement.</p></section>
723  <section class="clause"><h2><span class="num">34.</span>Contact Information</h2><p>Official legal and compliance contact details to be inserted by Packman Legal Team.</p></section>
724
725  <div class="tc-footer-note">Packman Master Platform Agreement &mdash; Multi-Jurisdiction Platform Access Agreement</div>
726`,Is={en:{dir:"ltr",title:"Seller Terms & Conditions",company:"Packman Electronic Trading LLC",closeLabel:"Close",acceptLabel:"I Accept",scrollHint:"Scroll to read all terms",html:vf},ar:{dir:"rtl",title:"الشروط والأحكام للتاجر",company:"شركة باكمان للتعامل الإلكتروني ذ.م.م",closeLabel:"إغلاق",acceptLabel:"أوافق",scrollHint:"انزل للأسفل لقراءة كامل الشروط",html:_f}};function Yo(e){return e?e.scrollTop+e.clientHeight>=e.scrollHeight-12:!1}function Ef({open:e,onOpenChange:n,onAccept:r,language:s="en",allowClose:a=!0,accepting:o=!1,showAcceptButton:d=!0,requireScrollToAccept:u=!0,termsContent:l}){const i=c.useRef(null),[g,y]=c.useState(!1),[p,f]=c.useState(s==="ar"?"ar":"en"),x=l&&typeof l=="object"?{en:{...Is.en,...l.en||{}},ar:{...Is.ar,...l.ar||{}}}:Is,v=x[p]||x.en,S=v?.isFullDocument===!0||/^(\s*<!doctype|\s*<html[\s>])/i.test(v?.html||""),_=d&&u&&!S;c.useEffect(()=>{e&&f(s==="ar"?"ar":"en")},[s,e]),c.useEffect(()=>{e&&(y(!_),requestAnimationFrame(()=>{i.current&&(i.current.scrollTo({top:0,behavior:"instant"}),y(_?Yo(i.current):!0))}))},[e,p,_]);const w=()=>{_&&y(Yo(i.current))},C=A=>{if(S)return;const E=A.target.closest('a[href^="#"]');if(!E||!i.current)return;A.preventDefault();const j=E.getAttribute("href")?.slice(1);if(!j)return;const H=i.current.querySelector(`#${j}`);H&&i.current.scrollTo({top:H.offsetTop-16,behavior:"smooth"})},k=()=>{_&&i.current&&i.current.scrollBy({top:i.current.clientHeight*.85,behavior:"smooth"})},L=()=>{r?.(),n(!1)};return t.jsx(Ka,{open:e,onOpenChange:A=>{!a&&!A||n(A)},children:t.jsxs(Ha,{className:"w-[calc(100vw-0.5rem)] max-w-[820px] border-0 bg-transparent p-0 shadow-none sm:w-[calc(100vw-2rem)] [&>button]:hidden",dir:v.dir,children:[t.jsx(Ya,{className:"sr-only",children:v.title}),t.jsx(hl,{className:"sr-only",children:v.company}),t.jsxs("div",{className:"seller-terms-dialog font-poppins",dir:v.dir,children:[t.jsx("style",{children:wf}),t.jsxs("div",{className:"modal",children:[t.jsxs("div",{className:"modal-header",children:[t.jsxs("div",{className:"modal-header-left",children:[t.jsx("h2",{children:v.title}),t.jsx("span",{children:v.company})]}),t.jsxs("div",{className:"modal-header-right",children:[t.jsxs("div",{className:"lang-switcher",children:[t.jsx("button",{className:`lang-btn ${p==="en"?"active":""}`,type:"button",onClick:()=>f("en"),children:"English"}),t.jsx("button",{className:`lang-btn ${p==="ar"?"active":""}`,type:"button",onClick:()=>f("ar"),children:"العربية"})]}),a?t.jsx("button",{className:"modal-close",type:"button",onClick:()=>n(!1),children:"×"}):null]})]}),t.jsxs("div",{className:"modal-scroll",children:[S?t.jsx("div",{ref:i,className:"modal-body !p-0",id:"seller-terms-modal-body",children:t.jsx("iframe",{title:v.title,srcDoc:v.html,className:"h-full min-h-[60vh] w-full border-0 bg-white"})}):t.jsx("div",{ref:i,className:"modal-body",id:"seller-terms-modal-body",onScroll:w,onClick:C,dangerouslySetInnerHTML:{__html:v.html}}),_&&!g?t.jsxs("button",{className:"scroll-hint",type:"button",onClick:k,children:[t.jsx("span",{children:v.scrollHint}),t.jsx(Fc,{className:"scroll-hint-chevron",size:16})]}):null]}),t.jsxs("div",{className:"modal-footer",children:[a?t.jsx("button",{className:"btn-modal btn-modal-close",type:"button",onClick:()=>n(!1),children:v.closeLabel}):null,d?t.jsx("button",{className:"btn-modal btn-modal-accept",type:"button",onClick:L,disabled:!g||o,children:v.acceptLabel}):null]})]})]})]})})}const Sf=e=>e?.data?.data||e?.data||e||null;function Af(){const e=Ie(),n=ae(g=>g.language),r=ae(g=>g.store?.selectedStore),s=ae(g=>g.store?.selectedStoreDetails),[a,o]=c.useState(!1),{data:d}=Kl(r?.id,{enabled:!!r?.id}),u=Sf(d),l=c.useMemo(()=>a?!1:u?.acceptTerms===!1||s?.acceptTerms===!1||r?.acceptTerms===!1,[a,r,s,u]),i=Hl({onSuccess:()=>{o(!0),r&&Xt({...r,acceptTerms:!0});const g=u||s;g&&mr({...g,acceptTerms:!0}
726),e.invalidateQueries({queryKey:["stores"]})}});return!r?.id||!l?null:t.jsx(Ef,{open:!0,language:n,allowClose:!1,accepting:i.isPending,onOpenChange:()=>{},onAccept:()=>i.mutate({params:{id:r.id},body:{acceptTerms:!0}})})}const rt=(e,n,r={})=>async(s,a)=>{const o={...r};s&&(o.params=s),a instanceof FormData&&o.headers&&delete o.headers["Content-Type"];let d;switch(e.toLowerCase()){case"get":d=await ln.get(n,o);break;case"post":d=await ln.post(n,a,o);break;case"put":d=await ln.put(n,a,o);break;case"patch":d=await ln.patch(n,a,o);break;case"delete":d=await ln.delete(n,o);break;default:throw new Error(`Unsupported HTTP method: ${e}`)}return d.data},Nf=()=>{try{const e=ae.getState?.()?.systemCountry;return e?String(e).toLowerCase():"ae"}catch{return"ae"}};function gn(e){return e&&typeof e=="object"&&"data"in e&&"success"in e?e.data:e}const hn=e=>`${Nf()}/stores/${e}/website-import`,kf={async getAvailability(e){const n=rt("GET",`${hn(e)}/availability`);return gn(await n())},async detect(e,{url:n,selectedPlatform:r}={}){const s=rt("POST",`${hn(e)}/detect`),a={url:n};return r&&(a.selectedPlatform=r),gn(await s(null,a))},async createJob(e,{url:n,mode:r,platform:s,primaryLanguage:a}={}){const o=rt("POST",`${hn(e)}/jobs`),d={url:n,mode:r};return s&&(d.platform=s),a&&(d.primaryLanguage=a),gn(await o(null,d))},async getJob(e,n){const r=rt("GET",`${hn(e)}/jobs/${n}`);return gn(await r())},async listJobs(e){const n=rt("GET",`${hn(e)}/jobs`);return gn(await n())},async cancelJob(e,n){const r=rt("POST",`${hn(e)}/jobs/${n}/cancel`);return gn(await r(null,{}))},async confirmImport(e,n,{selectedIndexes:r,applyStoreInfo:s,overrides:a}={}){const o=rt("POST",`${hn(e)}/jobs/${n}/confirm`);return gn(await o(null,{selectedIndexes:r,applyStoreInfo:s,overrides:a}))},async applyStoreSection(e,n,{section:r,categoryIndex:s,categoryIndexes:a}={}){const o=rt("POST",`${hn(e)}/jobs/${n}/apply`),d={section:r};return s!=null&&(d.categoryIndex=s),Array.isArray(a)&&(d.categoryIndexes=a),gn(await o(null,d))}};function Xl(e){const{data:n,isLoading:r}=$e({queryKey:["website-import","availability",e],queryFn:()=>kf.getAvailability(e),enabled:!!e,staleTime:3e5,retry:!1});return{enabled:!!n?.enabled,productCap:n?.productCap??null,isLoading:r}}const Tf=8;function Cf(e,{isArabic:n,isWebsite:r}){return e.id==="store"&&r?n?e.titleArWebsite:e.titleEnWebsite:n?e.titleAr:e.titleEn}function jf(){const{pathname:e}=kt(),n=ae($=>$.language),{selectedStore:r,selectedStoreDetails:s}=ae($=>$.store),a=n==="ar",d=(s?.data||s||r)?.type==="website",{enabled:u}=Xl(r?.id),l=c.useRef(null),[i,g]=c.useState({start:!1,end:!1}),[y,p]=c.useState(!1),f=c.useCallback(()=>{const $=l.current;if(!$)return;const re=$.scrollWidth-$.clientWidth,pe=Math.abs($.scrollLeft),te={start:pe>1,end:pe<re-1};g(R=>R.start===te.start&&R.end===te.end?R:te)},[]),x=Zh(e,{isWebsite:d}),v=x?.section?.id,S=x?.activeTab?.key;if(c.useLayoutEffect(()=>{const $=l.current;$&&($.querySelector('[data-tab-active="true"]')?.scrollIntoView({block:"nearest",inline:"center"}),f())},[v,S,f]),c.useEffect(()=>{if(l.current)return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[v,S,f]),!x||x.isHub)return null;const{section:_,activeTab:w}=x,C=_.icon,k=w?.icon,L=Cf(_,{isArabic:a,isWebsite:d}),A=w?a?w.titleAr:w.titleEn:L,E=Wl(_,{isWebsite:d}).filter($=>$.key!=="website_import"||u),j=_.tabOverflowThreshold??Tf,H=E.length>j;let D=E;if(H){D=E.slice(0,j);const $=E.findIndex(re=>Yr(e,re.route));$>=j&&(D=[...E.slice(0,j-1),E[$]])}return t.jsxs("div",{className:"sticky top-2 z-50 flex flex-col gap-2 rounded-lg border border-border/70 bg-white px-2.5 py-2 shadow-sm md:px-3",dir:a?"rtl":"ltr",children:[t.jsxs("nav",{"aria-label":a?"مسار التنقل":"Breadcrumb",className:"flex min-w-0 items-center gap-1.5 text-xs",children:[t.jsxs(Yn,{to:_.hubUrl,className:"group flex shrink-0 items-center gap-1.5 font-medium text-muted-foreground transition-colors hover:text-foreground",children:[C&&t.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded bg-brand-secondary/10 text-brand-secondary transition-colors group-hover:bg-brand-secondary/20",children:t.jsx(C,{className:"h-3 w-3"})}),t.jsx("span",{className:"hidden sm:inline",children:L})]}),t.jsx(zc,{className:xt("h-3 w-3 shrink-0 text-muted-foreground
726/60",a&&"rotate-180"),"aria-hidden":!0}),t.jsxs("span",{className:"flex min-w-0 items-center gap-1 font-semibold text-foreground",children:[k&&t.jsx(k,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:A})]})]}),E.length>1&&t.jsxs("div",{className:"flex items-stretch gap-1.5",children:[t.jsxs("div",{className:"relative min-w-0 flex-1",children:[t.jsx("div",{className:xt("pointer-events-none absolute inset-y-0 z-10 w-6 bg-gradient-to-r from-white to-transparent transition-opacity",a?"right-0 rotate-180":"left-0",i.start?"opacity-100":"opacity-0"),"aria-hidden":!0}),t.jsx("div",{className:xt("pointer-events-none absolute inset-y-0 z-10 w-6 bg-gradient-to-l from-white to-transparent transition-opacity",a?"left-0 rotate-180":"right-0",i.end?"opacity-100":"opacity-0"),"aria-hidden":!0}),t.jsx("div",{ref:l,onScroll:f,className:"overflow-x-auto scroll-smooth [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",role:"tablist","aria-label":a?`أدوات ${L}`:`${L} tools`,children:t.jsx("div",{className:"flex min-w-max items-stretch",children:D.map(($,re)=>{const pe=Yr(e,$.route),te=a?$.titleAr:$.titleEn,R=$.icon;return t.jsxs("div",{className:"flex items-stretch",children:[re>0&&t.jsx("span",{className:"my-1.5 w-px shrink-0 self-stretch bg-border","aria-hidden":!0}),t.jsxs(Yn,{to:$.route,"data-tab-active":pe?"true":void 0,role:"tab","aria-selected":pe,title:te,className:xt("mx-1 inline-flex shrink-0 items-center gap-1.5 border-b-2 px-2 py-1.5 text-[11px] font-medium leading-none transition-colors md:text-xs",pe?"border-primary font-semibold text-foreground":"border-transparent text-muted-foreground hover:border-border hover:text-foreground"),children:[R&&t.jsx(R,{className:xt("h-3.5 w-3.5 shrink-0",pe&&"text-brand-secondary")}),te]})]},$.key)})})})]}),H&&t.jsxs(ll,{open:y,onOpenChange:p,children:[t.jsx(dl,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":a?"المزيد من الأدوات":"More tools",className:"inline-flex shrink-0 items-center gap-1 self-center rounded-full border border-border bg-background px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:text-xs",children:[t.jsx(jc,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:a?"المزيد":"More"}),t.jsx(Fc,{className:"h-3 w-3"})]})}),t.jsx(ul,{align:"end",className:"max-h-[60vh] w-56 overflow-y-auto p-1",dir:a?"rtl":"ltr",children:E.map($=>{const re=Yr(e,$.route),pe=a?$.titleAr:$.titleEn,te=$.icon;return t.jsxs(Yn,{to:$.route,onClick:()=>p(!1),"aria-current":re?"page":void 0,className:xt("flex items-center gap-2 rounded-md border-s-2 px-2 py-1.5 text-xs font-medium transition-colors",re?"border-primary bg-muted font-semibold text-foreground":"border-transparent text-foreground hover:bg-muted"),children:[te&&t.jsx("span",{className:xt("flex h-5 w-5 shrink-0 items-center justify-center rounded",$.color||"bg-muted"),children:t.jsx(te,{className:"h-3 w-3"})}),t.jsx("span",{className:"truncate",children:pe})]},$.key)})})]})]})]})}const ya="general";function If(e,n,r){return e.id==="store"&&r?n==="ar"?e.titleArWebsite:e.titleEnWebsite:n==="ar"?e.titleAr:e.titleEn}function on(e){return e.filter(Boolean).join(" ").toLowerCase()}const vn={exactTitle:100,titleStartsWith:80,titleIncludes:60,titleSectionIncludes:40,descriptionIncludes:24,allTokensInTitleSection:30,allTokensInFullText:18};function Rf({isArabic:e,isWebsite:n}){const r=e?"عام":"General";return[{key:"home",titleEn:"Home",titleAr:"الرئيسية",descriptionEn:"Your dashboard home and quick actions",descriptionAr:"صفحتك الرئيسية والإجراءات السريعة",icon:$c,color:"bg-indigo-50 text-indigo-600",route:m.HOME},...n?[]:[{key:"dashboard",titleEn:"Dashboard",titleAr:"لوحة التحكم",descriptionEn:"Performance overview, sales, and key metrics",descriptionAr:"نظرة عامة على الأداء والمبيعات والمؤشرات الرئيسية",icon:Vc,color:"bg-cyan-50 text-cyan-600",route:m.DASHBOARD}],{key:"smart-studio",titleEn:"Smart Studio",titleAr:"الاستوديو الذكي",descriptionEn:"Create marketing content for your store",descriptionAr:"أنشئ محتوى تسويقي لمتجرك",icon:ts,color:"bg-fuchsia-50 text-fuchsia-600",route:m.MARKETING?.SMART_STUDIO||"/dashboard/smart-studio"},{key:"wallet",titleEn:"Wallet",titleAr:"المحفظة",descriptionEn:"Top up credits and view your balance",descriptionAr:"اشحن الرصيد واطّلع على رصيد محفظتك",icon:wr,color:"bg-green-50 text-green-600",route:m.WALLET?.INDEX||"/dashboard/wallet"}].filter(a=>a.route).map(a=>({id:`${ya}:${a.key}`,type:"app",title:e?a.titleAr:a.titleEn,sectionId:ya,sectionTitle:r,route:a.route,icon:a.icon,color:a.color,description:e?a.descriptionAr:a.descriptionEn,searchText:on([a.titleEn,a.titleAr]),descriptionText:on([a.descriptionEn,a.descriptionAr]),fullSearchText:on([a.titleEn,a.titleAr,a.descriptionEn,a.descriptionAr])}))}function Pf({isArabic:e=!1,isWebsite:n=!1}={}){const r=e?"ar":"en",s=[...Rf({isArabic:e,isWebsite:n})];for(const a of _s){const o=If(a,r,n),d=a.id==="store"&&n?a.titleEnWebsite:a.titleEn,u=a.id==="store"&&n?a.titleArWebsite:a.titleAr;s.push({id:`${a.id}:hub`,type:"hub",title:o,sectionId:a.id,sectionTitle:o,route:a.hubUrl,icon:a.icon,color:void 0,description:e?a.descriptionAr:a.descriptionEn,searchText:on([d,u]),descriptionText:on([a.descriptionEn,a.descriptionAr]),fullSearchText:on([d,u,a.descriptionEn,a.descriptionAr])});
726const l=Wl(a,{isWebsite:n});for(const i of l)i.route&&s.push({id:`${a.id}:${i.key}`,type:"page",title:e?i.titleAr:i.titleEn,sectionId:a.id,sectionTitle:o,route:i.route,icon:i.icon,color:i.color,description:e?i.descriptionAr:i.descriptionEn,searchText:on([i.titleEn,i.titleAr,d,u]),descriptionText:on([i.descriptionEn,i.descriptionAr]),fullSearchText:on([i.titleEn,i.titleAr,i.descriptionEn,i.descriptionAr,d,u])})}return s}function Of(e,n){if(!n)return 0;const r=e.title.toLowerCase();if(r===n)return vn.exactTitle;if(r.startsWith(n))return vn.titleStartsWith;if(r.includes(n))return vn.titleIncludes;if(e.searchText.includes(n))return vn.titleSectionIncludes;if(e.descriptionText?.includes(n))return vn.descriptionIncludes;const s=n.split(/\s+/).filter(Boolean);return s.length>1&&s.every(a=>e.searchText.includes(a))?vn.allTokensInTitleSection:s.length>1&&s.every(a=>(e.fullSearchText||"").includes(a))?vn.allTokensInFullText:0}function Df(e,n,{limit:r=12}={}){const s=(n||"").trim().toLowerCase();return s?e.map(a=>({entry:a,score:Of(a,s)})).filter(a=>a.score>0).sort((a,o)=>o.score-a.score||a.entry.title.localeCompare(o.entry.title)).slice(0,r).map(a=>a.entry):[]}[..._s.map(e=>e.id)];const Lf={catalog:"bg-blue-50 text-blue-600",marketing:"bg-violet-50 text-violet-600",orders:"bg-amber-50 text-amber-600",analytics:"bg-emerald-50 text-emerald-600",store:"bg-sky-50 text-sky-600","subscriptions-services":"bg-fuchsia-50 text-fuchsia-600","learning-center":"bg-rose-50 text-rose-600"},Qo="bg-brand-secondary/10 text-brand-secondary";function Uf(e){const n=[],r=new Map;for(const s of e)r.has(s.sectionId)||(r.set(s.sectionId,[]),n.push(s.sectionId)),r.get(s.sectionId).push(s);return n.map(s=>({sectionId:s,sectionTitle:r.get(s)[0].sectionTitle,entries:r.get(s)}))}function Xo({entry:e,isHub:n,onSelect:r}){const s=e.icon,a=n?Lf[e.sectionId]||Qo:e.color||Qo;return t.jsxs(gl,{value:e.id,onSelect:()=>r(e),className:"group gap-3 rounded-lg px-2.5 py-2 data-[selected=true]:bg-accent",children:[s&&t.jsx("span",{className:xt("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ring-1 ring-black/[0.03] transition-transform group-data-[selected=true]:scale-105",a),children:t.jsx(s,{className:"h-4 w-4"})}),t.jsxs("div",{className:"flex min-w-0 flex-col",children:[t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.title}),e.description&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:e.description})]}),t.jsx("kbd",{className:"ms-auto hidden items-center gap-1 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground opacity-0 transition-opacity group-data-[selected=true]:opacity-100 sm:inline-flex",children:t.jsx(gu,{className:"h-3 w-3"})})]})}function Mf({className:e}){const n=wt(),r=ae(E=>E.language),{selectedStore:s,selectedStoreDetails:a}=ae(E=>E.store),o=r==="ar",u=(a?.data||a||s)?.type==="website",[l,i]=c.useState(!1),[g,y]=c.useState(""),p=c.useRef(null),f=c.useRef(null),{enabled:x}=Xl(s?.id),v=c.useMemo(()=>{const E=Pf({isArabic:o,isWebsite:u});return x?E:E.filter(j=>j.route!==m.PRODUCTS_WEBSITE_IMPORT)},[o,u,x]),S=c.useMemo(()=>v.filter(E=>E.type==="app"||E.type==="hub"),[v]),_=c.useMemo(()=>Df(v,g,{limit:14}),[v,g]),w=g.trim().length>0,C=c.useMemo(()=>w?Uf(_):[],[w,_]);c.useEffect(()=>{const E=j=>{(j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"&&(j.preventDefault(),i(!0),f.current?.focus())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[]),c.useEffect(()=>{const E=j=>{p.current&&!p.current.contains(j.target)&&i(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const k=()=>{i(!1),y(""),f.current?.blur()},L=E=>{k(),n(We(E.route))},A=w&&_.length===0;return t.jsxs(pl,{ref:p,"data-guide-step":"global-search",shouldFilter:!1,className:xt("relative h-auto w-full max-w-2xl overflow-visible rounded-none bg-transparent","[&_[data-cmdk-input-wrapper]]:h-10 [&_[data-cmdk-input-wrapper]]:rounded-lg [&_[data-cmdk-input-wrapper]]:border [&_[data-cmdk-input-wrapper]]:border-border/80 [&_[data-cmdk-input-wrapper]]:bg-muted/50 [&_[data-cmdk-input-wrapper]]:px-3 [&_[data-cmdk-input-wrapper]]:sha
726dow-sm [&_[data-cmdk-input-wrapper]]:transition-colors","[&_[data-cmdk-input-wrapper]]:focus-within:border-brand-secondary/50 [&_[data-cmdk-input-wrapper]]:focus-within:bg-background [&_[data-cmdk-input-wrapper]_svg]:h-4 [&_[data-cmdk-input-wrapper]_svg]:opacity-60",e),dir:o?"rtl":"ltr",children:[t.jsx(ml,{ref:f,value:g,onValueChange:E=>{y(E),i(!0)},onFocus:()=>i(!0),onKeyDown:E=>{E.key==="Escape"&&k()},placeholder:o?"ابحث عن صفحة...":"Search pages...",className:"h-10 text-sm"}),l&&t.jsxs("div",{className:xt("z-[80] overflow-hidden rounded-lg border border-border bg-popover shadow-2xl","fixed inset-x-2 top-[3.5rem]","sm:absolute sm:inset-x-auto sm:start-0 sm:top-full sm:mt-2 sm:w-full"),children:[t.jsxs(cm,{className:"max-h-[60vh] p-1.5",children:[A&&t.jsxs("div",{className:"flex flex-col items-center gap-1.5 py-10 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:o?"لا توجد نتائج":"No results found"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o?`لا شيء يطابق "${g.trim()}"`:`Nothing matches "${g.trim()}"`})]}),!w&&t.jsx(aa,{heading:o?"الانتقال إلى":"Jump to",children:S.map(E=>t.jsx(Xo,{entry:E,isHub:E.type==="hub",onSelect:L},E.id))}),w&&C.map(E=>t.jsx(aa,{heading:E.sectionTitle,children:E.entries.map(j=>t.jsx(Xo,{entry:j,isHub:j.type==="hub",onSelect:L},j.id))},E.sectionId))]}),t.jsxs("div",{className:"hidden items-center justify-between gap-3 border-t border-border bg-muted/30 px-3 py-2 text-[11px] text-muted-foreground sm:flex",children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("kbd",{className:"rounded border border-border bg-background px-1 py-0.5 font-mono",children:"↑↓"}),o?"للتنقل":"to navigate"]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("kbd",{className:"rounded border border-border bg-background px-1 py-0.5 font-mono",children:"↵"}),o?"للفتح":"to open",t.jsx("span",{className:"mx-1 text-border",children:"·"}),t.jsx("kbd",{className:"rounded border border-border bg-background px-1 py-0.5 font-mono",children:"esc"}),o?"للإغلاق":"to close"]})]})]})]})}const ba=24*60*60*1e3,Gf=90,$f=14;function Vf(e,n){const r=[];return e?.trade_license||r.push(n.t_docs_alert_trade_license||"Trade license"),!!e?.id_copy_front&&!!e?.id_copy_back||!!e?.passport||r.push(n.t_docs_alert_identity||"Identity document (ID or passport)"),r}function Ff(e){return(Array.isArray(e?.subscriptions)?e.subscriptions:[]).some(r=>r&&r.status==="active")}function zf(e){if(!e)return null;if(e.verificationDeadline){const d=new Date(e.verificationDeadline);if(!Number.isNaN(d.getTime()))return d}const s=(Array.isArray(e.subscriptions)?e.subscriptions:[]).filter(d=>d&&d.status==="active")[0],a=s?.startDate||s?.createdAt;if(!a)return null;const o=new Date(a);return Number.isNaN(o.getTime())?null:new Date(o.getTime()+Gf*ba)}function Wf(){const e=yt(),n=e.language==="ar",r=wt(),s=kt(),a=ae(k=>k.store?.selectedStore),o=ae(k=>k.store?.selectedStoreDetails),d=a?.id,{data:u}=Yl.hooks.useGetStoreDetails(d,{enabled:!!d}),l=u?.data||u||o?.data||o||a||null,{data:i={}}=$e({queryKey:["store-documents-summary",d],enabled:!!d,queryFn:async()=>{const k=await lm.get(`stores/${d}/documents`,{summary:!0});return k?.data?.documentStatus||k?.documentStatus||{}},staleTime:60*1e3}),g=s.pathname.includes(m.STORE.DOCUMENTS),y=s.pathname.includes("/subscriptions")||s.pathname.includes("/subscription-orders");if(!l||g||y||!Ff(l))return null;const p=l.verificationStatus;if(p==="verified")return null;const f=Vf(i,e);if(f.length===0)return null;let x=null;p==="final_notice"&&l.verificationFinalNoticeAt?x=new Date(new Date(l.verificationFinalNoticeAt).getTime()+$f*ba):x=zf(l);const v=x&&!Number.isNaN(x.getTime())?Math.max(0,Math.ceil((x.getTime()-Date.now())/ba)):null,S={pending:{wrap:"border-amber-200 bg-amber-50 text-amber-900",chip:"bg-amber-100 text-amber-800",tile:"bg-amber-100",icon:hu,iconColor:"text-amber-600",title:e.t_docs_alert_pending_title||"Action required: verify your store",body:e.t_docs_alert_body||"Upload the required documents to keep your store live."},final_notice:{wrap:"border-orange-300 bg-orange-50 text-orange-900",chip:"bg-orange-100 text-orange-800",tile:"bg-orange-100",icon:Ga,iconColor:"text-orange-600",title:e.t_docs_alert_final_title||"Final notice: documents required",body:e.t_docs_alert_final_body||"Your store will be deactivated soon unless you upload the required documents."},overdue:{wrap:"border-red-300 bg-red-50 text-red-900",chip:"bg-red-100 text-red-800",tile:"bg-red-100",icon:Wc,iconColor:"text-red-600",title:e.t_docs_alert_overdue_title||"Your store has been deactivated",body:e.t_docs_alert_overdue_body||"Upload the required documents to reactivate your store."}},_=S[p]||S.pending,w=_.icon,C=p!=="overdue"&&v!==null?v<=0?e.t_docs_alert_due_today||"Due today":(e.t_docs_alert_days_left||"{count} days left").replace("{count}",String(v)):null;return t.jsx("div",{dir:n?"rtl":"ltr",className:"mx-auto mt-2 w-full max-w-6xl px-3 sm:mt-3 sm:px-5",children:t.jsxs("div",{className:xt("flex flex-col gap-2.5 rounded-xl border p-2.5 sm:flex-row sm:items-center sm:gap-4 sm:p-4",_.wrap),children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[t.jsx("span",{className:xt("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg sm:h-9 sm:w-9",_.tile),children:t.jsx(w,{className:xt("h-4 w-4 sm:h-5 sm:w-5",_.iconColor)})}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx("p",{className:"text-sm font-semibold leading-tight",children:_.title}),C&&t.jsx("span",{className:xt("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold",_.chip),children:C})]}),t.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs leading-snug",children:[t.jsx("span",{children:_.body}),t.jsxs("span",{className:"font-medium",children:[e.t_docs_alert_missing_label||"Missing",":"]}),f.map(k=>t.jsx("span",{className:xt("inline-flex items-center rounded-md px-1.5 py-0.5 text-[11px] font-medium",_.chip),children:k},k))]})]})]}),t.jsxs(mt,{size:"sm",onClick:()=>r(We(m.STORE.DOCUMENTS)),className:"h-9 w-full shrink-0 gap-1.5 sm:w-auto 
726sm:self-center",children:[t.jsx($a,{className:"h-4 w-4"}),e.t_docs_alert_upload_cta||"Upload documents"]})]})})}function Bf({children:e,className:n=""}){return t.jsx("div",{className:`h-full flex flex-col gap-4 max-w-[1600px] w-full mx-auto overflow-x-clip rounded-lg ${n}`,children:e})}const tr="https://cdn.packman.ai/seller-dashboard-static-assets/assets/bot-avatar-CMuefs53.png",Ct=()=>{try{const e=ae.getState?.()?.systemCountry;return e?String(e).toLowerCase():"ae"}catch{return"ae"}},qf=()=>ae.getState?.()?.language==="ar"?"ar":"en",Jo=e=>e==="ar"||e==="en"?e:qf(),Mt={async sendMessage({message:e,storeId:n,history:r,attachments:s,manager:a,locale:o,confirmToken:d,productImageFileIds:u,voiceReply:l,storeLogoUpload:i}){const g=Ct(),y=rt("POST",`${g}/ai-chat`),p={message:e,storeId:n,history:r,locale:Jo(o)};return l===!0&&(p.voiceReply=!0),typeof d=="string"&&d.length>0&&(p.confirmToken=d),Array.isArray(u)&&u.length>0&&(p.productImageFileIds=u.map(f=>Number(f)).filter(f=>Number.isFinite(f))),Array.isArray(s)&&s.length>0&&(p.attachments=s.map(f=>({url:f.url,fileId:f.fileId,name:f.name,mimeType:f.mimeType}))),typeof a=="string"&&a.length>0&&(p.manager=a),i===!0&&(p.storeLogoUpload=!0),y(null,p)},async prepareGuidedProduct(e){const n=Ct(),s=await rt("POST",`${n}/ai-chat/guided-create/prepare`)(null,e);return fn(s)},async suggestVariants(e){const n=Ct(),s=await rt("POST",`${n}/ai-chat/guided-create/suggest-variants`)(null,e);return fn(s)},async interpretDialogueTurn(e){const n=Ct(),s=await rt("POST",`${n}/ai-chat/dialogue/interpret`)(null,{...e,locale:Jo(e?.locale)});return fn(s)},async analyzeImageForChat({imageUrls:e,fileIds:n}){const r=Ct();return rt("POST",`${r}/ai-chat/analyze-image-for-chat`)(null,{imageUrls:e,fileIds:Array.isArray(n)?n:void 0})},async getAnalytics(e,n={}){const r=Ct();return rt("GET",`${r}/ai-chat/analytics`)({storeId:e,...n})},async getProactiveInsights(e){const n=Ct();return rt("GET",`${n}/ai-chat/insights`)({storeId:e})},async getVoiceConfig(){const e=Ct(),r=await rt("GET",`${e}/ai-chat/voice/config`)(),s=fn(r),a=!!s?.voiceEnabled,o=!!(s?.chatVoiceEnabled??a),d=!!(s?.guidedTourVoiceEnabled??a);return{chatVoiceEnabled:o,guidedTourVoiceEnabled:d,voiceEnabled:a||o||d}},async getVoices(){const e=Ct(),n=rt("GET",`${e}/ai-chat/voice/voices`);try{const r=await n(),s=fn(r)||{};return{voices:Array.isArray(s.voices)?s.voices:[],dialectByCountry:s.dialectByCountry||{},configured:!!s.configured}}catch{return{voices:[],dialectByCountry:{},configured:!1}}},async getVoicePreferences(){const e=Ct(),n=rt("GET",`${e}/ai-chat/voice/preferences`);try{const r=await n(),s=fn(r)||{};return{language:s.language||"",dialect:s.dialect||"",age:s.age||"",gender:s.gender||"",voiceId:s.voiceId||""}}catch{return null}},async saveVoicePreferences(e={}){const n=Ct(),r=rt("PUT",`${n}/ai-chat/voice/preferences`),s={language:e.language||"",dialect:e.dialect||"",age:e.age||"",gender:e.gender||"",voiceId:e.voiceId||""},a=await r(null,s);return fn(a)},async transcribeVoice({blob:e,locale:n}={}){const r=Ct(),s=rt("POST",`${r}/ai-chat/voice/transcribe`),a=new FormData,o=Kf(e?.type);a.append("audio",e,`recording.${o}`),n&&a.append("locale",n);const d=await s(null,a),u=fn(d);return{text:String(u?.text||"").trim()}},async synthesizeSpeech({text:e,locale:n,voiceId:r}={}){const s=Ct(),a=rt("POST",`${s}/ai-chat/voice/speak`,{responseType:"blob"}),o={text:e,locale:n};return typeof r=="string"&&r.length>0&&(o.voiceId=r),await a(null,o)}};function fn(e){return e&&typeof e=="object"&&"data"in e&&"success"in e?e.data:e}function Kf(e){const n=String(e||"").toLowerCase();return n.includes("webm")?"webm":n.includes("ogg")?"ogg":n.includes("mp4")||n.includes("m4a")?"mp4":n.includes("mpeg")||n.includes("mp3")?"mp3":n.includes("wav")?"wav":"webm"}const gr=Object.freeze(Object.defineProperty({__proto__:null,aiChatService:Mt},Symbol.toStringTag,{value:"Module"})),Or="packman-voice-opt-in",Dr="packman-voice-intro-seen",Rs="packman-voice-wake-word",Jl="packman-voice-prefs",xa="packman-voice:changed",Hf={echoCancellation:{ideal:!0},noiseSuppression:{ideal:!0},autoGainControl:{ideal:!0},channelCount:{ideal:1}};function zn(){typeof window>"u"||window.dispatchEvent(new CustomEvent(xa))}let En=null;
726const Kt=new Map;let Zo=Promise.resolve();function Ps(e){const n=Zo.then(e,e);return Zo=n.then(()=>{},()=>{}),n}let jt=0,Os=!1,Rt=null,cn=null,hr=null;const _a=new Set;function Yf(e){return typeof e!="function"?()=>{}:(_a.add(e),()=>_a.delete(e))}const wa=new Set;function Qf(e){return typeof e!="function"?()=>{}:(wa.add(e),()=>wa.delete(e))}function ei(e){wa.forEach(n=>{try{n(e)}catch{}})}function Zl(e){_a.forEach(n=>{try{n(e)}catch{}})}function Ds(){if(typeof document>"u"||document.getElementById("packman-voice-avatar-style"))return;const e=document.createElement("style");e.id="packman-voice-avatar-style",e.textContent=":root{--packman-voice-level:0}.packman-voice-speaking .packman-talking-target{filter:drop-shadow(0 0 calc(2px + var(--packman-voice-level,0)*9px) rgba(124,58,237,calc(0.2 + var(--packman-voice-level,0)*0.5)));will-change:filter}",document.head.appendChild(e)}function Ls(e){typeof document>"u"||(document.documentElement.classList.toggle("packman-voice-speaking",e),e||(document.documentElement.style.setProperty("--packman-voice-level","0"),Zl({speaking:!1,openness:0,roundness:0})))}function va(){hr&&cancelAnimationFrame(hr),hr=null}function Xf(){if(!cn||typeof requestAnimationFrame>"u")return;va();const e=new Uint8Array(cn.frequencyBinCount),n=()=>{cn.getByteFrequencyData(e);const r=Math.min(e.length,48);let s=0,a=0,o=0;for(let l=0;l<r;l+=1)s+=e[l],l<8?a+=e[l]:o+=e[l];const d=Math.min(1,s/r/255*1.7),u=a+o>0?a/(a+o):0;document.documentElement.style.setProperty("--packman-voice-level",d.toFixed(3)),Zl({speaking:!0,openness:d,roundness:u}),hr=requestAnimationFrame(n)};hr=requestAnimationFrame(n)}function Us(e){if(!Os)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;Rt=new n;const r=Rt.createMediaElementSource(e);cn=Rt.createAnalyser(),cn.fftSize=256,cn.smoothingTimeConstant=.8,r.connect(cn),cn.connect(Rt.destination),Os=!0}catch{Os=!1,cn=null}}function Lr(){return typeof window>"u"?null:(En||(En=new Audio,En.preload="auto",En.addEventListener("playing",()=>{Ls(!0),Xf()}),En.addEventListener("pause",()=>{Ls(!1),va()}),En.addEventListener("ended",()=>{Ls(!1),va()})),En)}function Wn(e){try{return window.localStorage.getItem(e)==="1"}catch{return!1}}function lr(e,n){try{n?window.localStorage.setItem(e,"1"):window.localStorage.removeItem(e)}catch{}}const ti={language:"",dialect:"",age:"",gender:"",voiceId:""};function ni(){try{const e=window.localStorage.getItem(Jl);if(!e)return{...ti};const n=JSON.parse(e);return{language:typeof n?.language=="string"?n.language:"",dialect:typeof n?.dialect=="string"?n.dialect:"",age:typeof n?.age=="string"?n.age:"",gender:typeof n?.gender=="string"?n.gender:"",voiceId:typeof n?.voiceId=="string"?n.voiceId:""}}catch{return{...ti}}}function ri(e){try{window.localStorage.setItem(Jl,JSON.stringify(e))}catch{}}function Jf(){if(typeof window>"u")return!1;const e=!!(navigator?.mediaDevices&&navigator.mediaDevices.getUserMedia),n=typeof window.MediaRecorder<"u";return e&&n}function Zf(){if(typeof window>"u"||!window.MediaRecorder)return"";const e=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];for(const n of e)try{if(window.MediaRecorder.isTypeSupported(n))return n}catch{}return""}const si=48;function ey(e){const n=String(e||"").replace(/\s+/g," ").trim();if(!n)return[];const r=n.match(/[^.!?؟…۔]+[.!?؟…۔]+|\S[^.!?؟…۔]*$/g)||[n],s=[];let a="";for(const o of r){const d=o.trim();if(!d)continue;const u=a?`${a} ${d}`:d;u.length<si?a=u:(s.push(u),a="")}return a&&(s.length>0&&a.length<si?s[s.length-1]=`${s[s.length-1]} ${a}`:s.push(a)),s.length?s:[n]}function lo(){const n=(ae(Z=>Z.language)||"en")==="ar"?"ar":"en",r=Jf(),{data:s}=$e({queryKey:["ai-chat-voice-config"],queryFn:()=>Mt.getVoiceConfig(),staleTime:5*60*1e3,retry:1}),a=!!s?.chatVoiceEnabled,o=!!s?.guidedTourVoiceEnabled,d=a||o,{data:u}=$e({queryKey:["ai-chat-voices"],queryFn:()=>Mt.getVoices(),enabled:d,staleTime:10*60*1e3,retry:1}),l=Array.isArray(u?.voices)?u.voices:[],i=u?.dialectByCountry||{},[g,y]=c.useState(()=>Wn(Or)),[p,f]=c.useState(()=>Wn(Dr)),[x,v]=c.useState(()=>Wn(Rs)),[S,_]=c.useState(()=>ni()),w=c.useRef(S);w.current=S;const C=S.language==="ar"||S.language==="en"?S.language:n,{data:k}=$e({queryKey:["ai-chat-voice-prefs"],queryFn:()=>Mt.getVoicePreferences(),enabled:d,staleTime:5*60*1e3,retry:1});c.useEffect(()=>{if(!k)return;const Z={language:k.language||"",dialect:k.dialect||"",age:k.age||"",gender:k.gender||"",voiceId:k.voiceId||""};(Z.voiceId||Z.language||Z.dialect||Z.age||Z.gender)&&_(Se=>JSON.stringify(Se)===JSON.stringify(Z)?Se:(ri(Z),zn(),Z))},[k]);const[L,A]=c.useState(!1),[E,j]=c.useState(!1),[H,D]=c.useState(!1),[$,re]=c.useState(!1),[pe,te]=c.useState(""),R=c.useRef(null),B=c.useRef([]),U=c.useRef(null),K=c.useRef(0),ee=c.useRef(null),he=c.useRef(!1),fe=c.useRef(null),ie=c.useRef(""),me=c.useRef(!1),Re=d&&g&&r,ke=c.useCallback(()=>{jt+=1;const Z=Lr();if(Z)try{Z.pause(),Z.currentTime=0}catch{}D(!1)},[]),oe=S.voiceId||"",se=c.useCallback(async(Z,{requireOptIn:M=!0}={})=>{const Se=typeof Z=="string"?Z.trim():"";if(!Se||!d||M&&!g)return;const G=Lr();if(!G)return;ke();const Ee=jt;Ds();const Q=`${C}:${oe}:${Se}`;try{let we=Kt.get(Q);if(!we){const Oe=await Ps(()=>
726{if(Ee!==jt)return null;const Ye=Kt.get(Q);return Ye?{url:Ye}:Mt.synthesizeSpeech({text:Se,locale:C,voiceId:oe}).then(tt=>({blob:tt}))});if(!Oe||Ee!==jt)return;if(Oe.url)we=Oe.url;else if(Oe.blob)we=URL.createObjectURL(Oe.blob),Kt.set(Q,we);else return}if(!we||Ee!==jt)return;if(G.src=we,Us(G),Rt&&Rt.state==="suspended")try{await Rt.resume()}catch{}G.onended=()=>D(!1),G.onpause=()=>D(!1),D(!0),await G.play()}catch{D(!1)}},[d,g,C,oe,ke]),de=c.useCallback(Z=>se(Z,{requireOptIn:!0}),[se]),Ne=c.useCallback(Z=>se(Z,{requireOptIn:!1}),[se]),ue=c.useCallback(async Z=>{const M=typeof Z=="string"?Z.trim():"";if(!M||!d||!g)return!1;const Se=ey(M);if(Se.length<=1)return await se(M,{requireOptIn:!0}),!0;const G=Lr();if(!G)return!1;ke();const Ee=jt;if(Ds(),Us(G),Rt&&Rt.state==="suspended")try{await Rt.resume()}catch{}const Q=async tt=>{const Ze=`${C}:${oe}:${tt}`,Ae=Kt.get(Ze);if(Ae)return Ae;const ut=await Ps(()=>{if(Ee!==jt)return null;const ze=Kt.get(Ze);return ze?{url:ze}:Mt.synthesizeSpeech({text:tt,locale:C,voiceId:oe}).then(Qe=>({blob:Qe}))});if(!ut||Ee!==jt)return null;if(ut.url)return ut.url;if(ut.blob){const ze=URL.createObjectURL(ut.blob);return Kt.set(Ze,ze),ze}return null};let we=!1,Oe;const Ye=new Promise(tt=>{Oe=tt});return(async()=>{let tt=Q(Se[0]);for(let Ze=0;Ze<Se.length&&Ee===jt;Ze+=1){const Ae=await tt;if(tt=Ze+1<Se.length?Q(Se[Ze+1]):Promise.resolve(null),Ee!==jt)break;Ae&&await new Promise(ut=>{let ze=!1;const Qe=()=>{ze||(ze=!0,G.onended=null,G.onpause=null,ut())};G.src=Ae,G.onended=Qe,G.onpause=Qe,D(!0),G.play().then(()=>{we||(we=!0,Oe(!0))}).catch(Qe)})}Ee===jt&&D(!1),we||Oe(!1)})(),Ye},[d,g,C,oe,ke,se]),ve=c.useCallback(async Z=>{if(!Z||!d||!g)return!1;const M=Lr();if(!M)return!1;ke();const Se=jt;Ds();try{if(M.src=Z,Us(M),Rt&&Rt.state==="suspended")try{await Rt.resume()}catch{}return Se!==jt?!1:(M.onended=()=>D(!1),M.onpause=()=>D(!1),D(!0),await M.play(),!0)}catch{return D(!1),!1}},[d,g,ke]),Ve=c.useCallback(async Z=>{const M=typeof Z=="string"?Z.trim():"";if(!M||!d||!g)return;const Se=`${C}:${oe}:${M}`;if(!Kt.has(Se))try{const G=await Ps(()=>Kt.has(Se)?null:Mt.synthesizeSpeech({text:M,locale:C,voiceId:oe}));G&&!Kt.has(Se)&&Kt.set(Se,URL.createObjectURL(G))}catch{}},[d,g,C,oe]),Te=c.useCallback(()=>{U.current&&(U.current.getTracks().forEach(Z=>Z.stop()),U.current=null)},[]),Ge=c.useCallback(async()=>{try{return await navigator.mediaDevices.getUserMedia({audio:Hf})}catch{return navigator.mediaDevices.getUserMedia({audio:!0})}},[]),Be=c.useCallback(()=>{const Z=ee.current;if(ee.current=null,ei(0),!!Z){Z.timer&&clearInterval(Z.timer),Z.hardCap&&clearTimeout(Z.hardCap);try{Z.source?.disconnect()}catch{}try{Z.analyser?.disconnect()}catch{}try{Z.ctx?.close()}catch{}}},[]),et=c.useCallback(async()=>{if(he.current)return"";he.current=!0,Be();const Z=R.current;if(!Z)return he.current=!1,"";const M=Date.now()-(K.current||Date.now()),Se=await new Promise(Q=>{Z.onstop=()=>{const we=Z.mimeType||"audio/webm";Q(new Blob(B.current,{type:we}))};try{if(Z.state==="recording")try{Z.requestData()}catch{}Z.stop()}catch{Q(null)}});R.current=null,Te(),A(!1);const G=400,Ee=1200;if(!Se||Se.size===0)return te("empty"),he.current=!1,"";if(M<G||Se.size<Ee)return te("too_short"),he.current=!1,"";j(!0);try{const{text:Q}=await Mt.transcribeVoice({blob:Se,locale:ie.current||C}),we=(Q||"").trim();if(te(we?"":"failed"),me.current&&we){const Oe=/[\u0600-\u06FF]/.test(we);try{const{text:Ye}=await Mt.transcribeVoice({blob:Se,locale:Oe?"en":"ar"}),tt=(Ye||"").trim();return{primary:we,en:Oe?tt:we,ar:Oe?we:tt}}catch{return we}}return we}catch{return te("failed"),""}finally{j(!1),he.current=!1}},[C,Te,Be]),ge=c.useCallback((Z,M)=>{try{const Se=window.AudioContext||window.webkitAudioContext;if(!Se)return;const G=new Se;G.state==="suspended"&&G.resume().catch(()=>{});const Ee=G.createMediaStreamSource(Z),Q=G.createAnalyser();Q.fftSize=1024,Q.smoothingTimeConstant=0,Ee.connect(Q);const we=new Uint8Array(Q.fftSize),Oe=typeof M?.silenceMs=="number"?M.silenceMs:1200,Ye=typeof M?.maxMs=="number"?M.maxMs:15e3,tt=typeof M?.noSpeechMs=="number"?M.noSpeechMs:6e3,Ze=typeof M?.onTranscript=="function"?M.onTranscript:null,Ae={ctx:G,source:Ee,analyser:Q,timer:null,hardCap:null,startedAt:Date.now(),noiseFloor:0,calibrated:0,speechStarted:!1,silenceStart:0,onTranscript:Ze};ee.current=Ae;const ut=async ze=>{if(ee.current!==Ae)return;if(Ae.timer&&clearInterval(Ae.timer),ze){Be(),fe.current?.(),te("empty"),Ae.onTranscript&&Ae.onTranscript("");return}const Qe=await et();Ae.onTranscript&&Ae.onTranscript(Qe)};Ae.hardCap=setTimeout(()=>
726ut(!Ae.speechStarted),Ye),Ae.timer=setInterval(()=>{if(ee.current!==Ae)return;Q.getByteTimeDomainData(we);let ze=0;for(let Bt=0;Bt<we.length;Bt+=1){const Ot=(we[Bt]-128)/128;ze+=Ot*Ot}const Qe=Math.sqrt(ze/we.length),nn=Date.now();if(ei(Math.min(1,Qe*6)),Ae.calibrated<10){Qe>=.025&&(Ae.speechStarted=!0,Ae.silenceStart=0),Ae.noiseFloor=Ae.calibrated===0?Qe:Math.min(Ae.noiseFloor,Qe),Ae.calibrated+=1;return}const xn=Math.max(.012,Ae.noiseFloor*2.2),_n=Math.max(.008,Ae.noiseFloor*1.4);Qe>=xn?(Ae.speechStarted=!0,Ae.silenceStart=0):Ae.speechStarted?Qe<=_n&&(Ae.silenceStart?nn-Ae.silenceStart>=Oe&&ut(!1):Ae.silenceStart=nn):nn-Ae.startedAt>=tt&&ut(!0)},50)}catch{}},[et,Be]),X=c.useCallback(async(Z={})=>{if(!r||L)return!1;ke(),re(!1),te("");try{const M=await Ge();U.current=M;const Se=Zf(),G=Se?new MediaRecorder(M,{mimeType:Se}):new MediaRecorder(M);return B.current=[],G.ondataavailable=Ee=>{Ee.data&&Ee.data.size>0&&B.current.push(Ee.data)},R.current=G,he.current=!1,ie.current=typeof Z?.sttLocale=="string"?Z.sttLocale:"",me.current=!!Z?.bilingual,G.start(100),K.current=Date.now(),A(!0),Z?.autoStop&&ge(M,Z),!0}catch{return re(!0),A(!1),Te(),!1}},[r,L,ke,Te,ge,Ge]),Ce=c.useCallback(()=>{he.current=!0,Be();const Z=R.current;if(Z)try{Z.onstop=null,Z.stop()}catch{}R.current=null,B.current=[],Te(),A(!1),he.current=!1},[Te,Be]);fe.current=Ce;const xe=c.useCallback(async()=>{if(r)try{(await Ge()).getTracks().forEach(M=>M.stop())}catch{return re(!0),!1}return lr(Or,!0),lr(Dr,!0),y(!0),f(!0),zn(),!0},[r,Ge]),dt=c.useCallback(()=>{ke(),lr(Or,!1),y(!1),zn()},[ke]),Gt=c.useCallback(()=>{lr(Dr,!0),f(!0),zn()},[]),st=c.useCallback(Z=>{const M=!!Z;lr(Rs,M),v(M),zn()},[]),ft=c.useCallback(Z=>{const M={...w.current,...Z||{}};w.current=M,_(M),ri(M),Mt.saveVoicePreferences(M).catch(()=>{}),ke(),zn()},[ke]);return c.useEffect(()=>{if(typeof window>"u")return;const Z=()=>{y(Wn(Or)),f(Wn(Dr)),v(Wn(Rs)),_(ni())};return window.addEventListener(xa,Z),()=>window.removeEventListener(xa,Z)},[]),c.useEffect(()=>()=>{Be(),Te()},[Te,Be]),{locale:C,isSupported:r,globalEnabled:d,optedIn:g,introSeen:p,enabled:Re,wakeWordEnabled:x,isRecording:L,isTranscribing:E,isSpeaking:H,permissionError:$,captureError:pe,clearCaptureError:()=>te(""),chatVoiceEnabled:a,guidedTourVoiceEnabled:o,shouldShowIntro:o&&r&&!g&&!p,voices:l,dialectByCountry:i,voicePrefs:S,voiceId:oe,speak:de,speakStream:ue,playText:Ne,playUrl:ve,prefetch:Ve,stop:ke,startRecording:X,stopRecording:et,cancelRecording:Ce,enableVoice:xe,disableVoice:dt,dismissIntro:Gt,setVoicePrefs:ft,setWakeWord:st}}const ty=["hey packman","hi packman","hey pac man","hi pac man","hey pakman","hi pakman","hey pakcman","hi pakcman","hey pacman","hi pacman","hey backman","hi backman","يا باكمان","هاي باكمان","هلا باكمان","باكمان","باك مان","بكمان","باكما"];function ed(e){return String(e||"").toLowerCase().replace(/[^a-z\u0600-\u06ff\s]/g," ").replace(/\s+/g," ").trim()}const ny=ty.map(ed);function td(){return typeof window>"u"?!1:!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function ry({enabled:e,paused:n=!1,lang:r="en-US",onWake:s,onListeningChange:a,onError:o}){const d=c.useRef(s);d.current=s;const u=c.useRef(a);u.current=a;const l=c.useRef(o);l.current=o;const i=c.useRef(0),g=c.useRef(!1);c.useEffect(()=>{if(!e||n)return;const y=window.SpeechRecognition||window.webkitSpeechRecognition;if(!y)return;let p;try{p=new y}catch{return}let f=!1,x=null,v=null,S=!1;p.continuous=!0,p.interimResults=!0,p.lang=r,p.maxAlternatives=1;const _=A=>{for(let E=A.resultIndex;E<A.results.length;E+=1){const j=ed(A.results[E][0]?.transcript);if(!j)continue;const H=/\b(?:hey|hi)\b/.test(j)&&/\b(?:packman|pack man|pacman|pac man|pakman|pakcman|backman)\b/.test(j);if(ny.some(D=>j.includes(D))||H){const D=Date.now();if(D-i.current<4e3)return;i.current=D,f=!0;try{p.stop()}catch{}try{d.current?.()}catch{}return}}},w=A=>{try{l.current?.(A?.error||"unknown")}catch{}(A?.error==="not-allowed"||A?.error==="service-not-allowed")&&(f=!0)},C=()=>{S=!0,v&&clearTimeout(v);try{u.current?.(!0)}catch{}},k=()=>{try{u.current?.(!1)}catch{}f||(x=setTimeout(()=>{S=!1;try{p.start()}catch{}},500))};p.onresult=_,p.onerror=w,p.onstart=C,p.onend=k;const L=()=>
726{if(!f){S=!1;try{p.start()}catch{}v&&clearTimeout(v),v=setTimeout(()=>{if(!(f||S)){try{l.current?.("startup-timeout")}catch{}try{p.stop()}catch{}x=setTimeout(()=>{if(!f)try{p.start()}catch{}},300)}},1800)}};return!g.current&&navigator?.mediaDevices?.getUserMedia?navigator.mediaDevices.getUserMedia({audio:!0}).then(A=>{A.getTracks().forEach(E=>E.stop()),g.current=!0,L()}).catch(()=>{try{l.current?.("not-allowed")}catch{}L()}):L(),()=>{f=!0,x&&clearTimeout(x),v&&clearTimeout(v);try{u.current?.(!1)}catch{}try{p.onresult=null,p.onerror=null,p.onstart=null,p.onend=null,p.stop()}catch{}}},[e,n,r])}const ws=[{id:"design",weight:10,goLive:!0,alwaysOpen:!0,group:"build",estMin:3},{id:"product",weight:30,goLive:!0,aiEligible:!0,alwaysOpen:!0,group:"build",estMin:2},{id:"payment",weight:12,goLive:!1,group:"operate",estMin:3},{id:"shipping",weight:10,goLive:!1,group:"operate",estMin:3},{id:"address",weight:3,goLive:!1,group:"operate",estMin:2},{id:"documents",weight:5,goLive:!1,group:"operate",estMin:4},{id:"domain",weight:10,goLive:!0,group:"publish",estMin:2,unlockAfter:"documents"},{id:"publish",weight:15,goLive:!0,celebrate:!0,group:"publish",estMin:1,unlockAfter:"documents"}];ws.filter(e=>e.goLive).map(e=>e.id);const nd=5,CI=ws.reduce((e,n)=>e+n.weight,0)+nd,jI=ws.filter(e=>e.goLive).reduce((e,n)=>e+n.weight,0)+nd,uo=ws.map(e=>({id:`readiness-${e.id}`,element:`[data-guide-step="readiness-${e.id}"]`,translationKey:`t_hv2_step_${e.id}_desc`,voiceKey:`t_hv2_voice_readiness_${e.id}`})),II=[{id:"welcome",element:void 0,translationKey:"t_hv2_tour_welcome",voiceKey:"t_hv2_voice_welcome"},{id:"search",element:'[data-guide-step="global-search"]',translationKey:"t_hv2_tour_search",voiceKey:"t_hv2_voice_search",mobileTranslationKey:"t_hv2_tour_search_mobile",mobileVoiceKey:"t_hv2_voice_search_mobile"},{id:"onboarding-images",element:'[data-guide-step="onboarding-images"]',translationKey:"t_hv2_tour_onboarding_images",voiceKey:"t_hv2_voice_onboarding_images"},{id:"preview",element:'[data-guide-step="preview"]',translationKey:"t_hv2_tour_preview",voiceKey:"t_hv2_voice_preview"},{id:"readiness",element:'[data-guide-step="readiness"]',translationKey:"t_hv2_tour_readiness",voiceKey:"t_hv2_voice_readiness"},...uo,{id:"social",element:'[data-guide-step="social"]',translationKey:"t_hv2_tour_social",voiceKey:"t_hv2_voice_social"},{id:"wallet",element:'[data-guide-step="wallet"]',translationKey:"t_hv2_tour_wallet",voiceKey:"t_hv2_voice_wallet"},{id:"ai-create",element:'[data-guide-step="ai-create"]',translationKey:"t_hv2_tour_ai_create",voiceKey:"t_hv2_voice_ai_create"},{id:"smart-studio",element:'[data-guide-step="smart-studio"]',translationKey:"t_hv2_tour_smart_studio",voiceKey:"t_hv2_voice_smart_studio"},{id:"services",element:'[data-guide-step="services"]',translationKey:"t_hv2_tour_services",voiceKey:"t_hv2_voice_services"}],RI="packman-home-v2-tour-seen",sy="packman-home-v2-tour:start",ai="packman-home-v2-tour:active",ay=Object.fromEntries(uo.map(e=>[e.id,"right"])),oy=Object.fromEntries(uo.map(e=>[e.id,"left"])),PI={"onboarding-images":"bottom",welcome:"over",search:"bottom",readiness:"right",...ay,"ai-create":"top",wallet:"left",preview:"left",social:"left","smart-studio":"left",services:"left"},OI={"onboarding-images":"bottom",welcome:"over",search:"bottom",readiness:"left",...oy,"ai-create":"top",wallet:"right",preview:"right",social:"right","smart-studio":"right",services:"right"},DI={search:"start","smart-studio":"start",services:"start"},LI={search:"end","smart-studio":"start",services:"start"},UI={"smart-studio":"left",services:"left"},MI={"smart-studio":"right",services:"right"};function rd(){const[e,n]=c.useState(!1);return c.useEffect(()=>{const r=s=>{n(!!s?.detail?.active)};return window.addEventListener(ai,r),()=>window.removeEventListener(ai,r)},[]),e}const iy={home:m.HOME,products:m.PRODUCTS_INDEX,products_create:m.PRODUCTS_CREATE,products_import:m.PRODUCTS_IMPORT,orders:m.ORDERS.INDEX,orders_hub:m.ORDERS.HUB,customers:m.CUSTOMERS.INDEX,wallet:m.WALLET.INDEX,smart_studio:m.MARKETING.SMART_STUDIO,analytics:m.ANALYTICS.INDEX,store_settings:m.STORE.SETTINGS,themes:m.THEME_TEMPLATES.TE
726MPLATES,marketing:m.MARKETING.INDEX,reviews:m.REVIEWS.INDEX,returns:m.RETURNS.INDEX};function cy(e){return iy[e]||null}function Ms(e,n){if(!e||typeof e!="object")return!1;if(e.type==="navigate"){const r=cy(e.destination);return r&&typeof n=="function"?(n(We(r)),!0):!1}return e.type==="focus_tour_step"&&e.stepId&&typeof window<"u"?(window.dispatchEvent(new CustomEvent(sy,{detail:{focusStepId:e.stepId}})),!0):!1}function ly(e){return(e?.actions||[]).find(r=>r?.type==="navigate"||r?.type==="focus_tour_step")||null}const dy=/(?:\p{Extended_Pictographic}|\u200D|\uFE0F)/gu;function uy(e){return!e||typeof e!="string"?"":e.replace(/\[([^\]]+)\]\(([^)]*)\)/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^\s*---+\s*$/gm,"").replace(/\s*[—–]\s*/g,". ").replace(/\s--\s/g,". ").replace(dy,"").replace(/[ \t]+(\n|$)/g,"$1").replace(/\n{3,}/g,`
727
728`).trim()}const py="https://cdn.packman.ai/seller-dashboard-static-assets/assets/rest-CIci_26D.png",my="https://cdn.packman.ai/seller-dashboard-static-assets/assets/small-HdYV3v1-.png",gy="https://cdn.packman.ai/seller-dashboard-static-assets/assets/mid-CxMlcDhl.png",hy="https://cdn.packman.ai/seller-dashboard-static-assets/assets/wide-Qdo67YRR.png",fy="https://cdn.packman.ai/seller-dashboard-static-assets/assets/round-CZpLEln2.png",yy="https://cdn.packman.ai/seller-dashboard-static-assets/assets/narrow-DI5-TE4E.png",by={rest:py,small:my,mid:gy,wide:hy,round:fy,narrow:yy},Gs=by;function xy({speaking:e,openness:n,roundness:r}={}){if(!e||n<.06)return"rest";const s=r>.6;return n<.22?s?"narrow":"small":n<.45?s?"round":"mid":s?"round":"wide"}function _y({size:e=52,fill:n=!1,className:r="",rounded:s=!0,alt:a="Packman AI"}){const o=c.useRef(null),d=c.useRef("rest");return c.useEffect(()=>{const u=i=>{i!==d.current&&(d.current=i,o.current&&(o.current.src=Gs[i]||Gs.rest))},l=Yf(i=>u(xy(i)));return()=>{l(),u("rest")}},[]),t.jsx("img",{ref:o,src:Gs.rest,alt:a,className:`packman-talking-target ${s?"rounded-full":""} object-cover ${n?"w-full h-full":""} ${r}`,style:n?void 0:{width:e,height:e},draggable:!1})}const wy=[{id:"understand",Icon:cs,tone:{card:"border-blue-200/70 bg-gradient-to-br from-white to-blue-50/60",icon:"bg-blue-100 text-blue-700",label:"text-blue-600",chip:"border-blue-200 bg-blue-50 text-blue-800 hover:border-blue-300 hover:bg-blue-100",link:"bg-blue-50 text-blue-700 hover:bg-blue-100"},title:{en:"Understand your store",ar:"افهم متجرك"},body:{en:"Get quick answers about sales, revenue, orders, best sellers, low stock, customers, abandoned carts, reviews, wallet balance, and your subscription.",ar:"احصل على إجابات سريعة عن المبيعات والإيرادات والطلبات والمنتجات الأكثر مبيعاً والمخزون المنخفض والعملاء والسلات المتروكة والمراجعات ورصيد المحفظة واشتراكك."},examples:[{en:"How are my sales this week?",ar:"كيف مبيعاتي هذا الأسبوع؟"},{en:"Which products are running low?",ar:"ما المنتجات التي أوشكت على النفاد؟"},{en:"Show me today’s orders.",ar:"أظهر لي طلبات اليوم."},{en:"Who are my top customers?",ar:"من هم أفضل عملائي؟"},{en:"What are customers saying in their reviews?",ar:"ماذا يقول العملاء في مراجعاتهم؟"}],links:[{label:{en:"Learn about store analytics",ar:"تعرّف على تحليلات المتجر"},route:m.LEARNING_CENTER.ANALYTICS_GUIDE}]},{id:"manage",Icon:Bc,tone:{card:"border-amber-200/80 bg-gradient-to-br from-white to-amber-50/60",icon:"bg-amber-100 text-amber-700",label:"text-amber-600",chip:"border-amber-200 bg-amber-50 text-amber-900 hover:border-amber-300 hover:bg-amber-100",link:"bg-amber-50 text-amber-800 hover:bg-amber-100"},title:{en:"Manage your store",ar:"أدر متجرك"},body:{en:"Update order progress, edit products, adjust stock, create coupons, and organize categories or collections. You’ll always review and approve a change before it’s applied.",ar:"حدّث تقدّم الطلبات، وعدّل المنتجات، واضبط المخزون، وأنشئ القسائم، ونظّم الفئات أو المجموعات. ستراجع التغيير وتوافق عليه دائماً قبل تطبيقه."},examples:[{en:"Mark this order as shipped.",ar:"علّم هذا الطلب كمشحون."},{en:"Change this product’s price.",ar:"غيّر سعر هذا المنتج."},{en:"Set the stock for this product to 20.",ar:"اضبط مخزون هذا المنتج إلى 20."},{en:"Create a 10% discount coupon.",ar:"أنشئ قسيمة خصم 10%."},{en:"Add these products to my summer collection.",ar:"أضف هذه المنتجات إلى مجموعة الصيف."}],links:[{label:{en:"Managing orders",ar:"إدارة الطلبات"},route:m.LEARNING_CENTER.ORDERS_GUIDE},{label:{en:"Inventory guide",ar:"دليل المخزون"},route:m.LEARNING_CENTER.INVENTORY_GUIDE}
728,{label:{en:"Coupons and discounts",ar:"القسائم والخصومات"},route:m.LEARNING_CENTER.COUPONS_GUIDE},{label:{en:"Categories and collections",ar:"الفئات والمجموعات"},route:m.LEARNING_CENTER.CATEGORIES_GUIDE}]},{id:"add-products",Icon:qc,tone:{card:"border-fuchsia-200/70 bg-gradient-to-br from-white to-fuchsia-50/60",icon:"bg-fuchsia-100 text-fuchsia-700",label:"text-fuchsia-600",chip:"border-fuchsia-200 bg-fuchsia-50 text-fuchsia-800 hover:border-fuchsia-300 hover:bg-fuchsia-100",link:"bg-fuchsia-50 text-fuchsia-700 hover:bg-fuchsia-100"},title:{en:"Add new products",ar:"أضف منتجات جديدة"},body:{en:"Choose the method that works best: draft from a photo, build it step by step in chat, or open the product form and fill it in yourself.",ar:"اختر الطريقة الأنسب لك: مسودة من صورة، أو بناؤه خطوة بخطوة في المحادثة، أو فتح نموذج المنتج وتعبئته بنفسك."},examples:[{en:"Help me add a new product.",ar:"ساعدني في إضافة منتج جديد."},{en:"Create a product from this photo.",ar:"أنشئ منتجاً من هذه الصورة."}],links:[{label:{en:"Ways to add products",ar:"طرق إضافة المنتجات"},route:m.LEARNING_CENTER.PRODUCT_UPLOAD},{label:{en:"Create a product from photos",ar:"إنشاء منتج من الصور"},route:m.LEARNING_CENTER.PRODUCT_UPLOAD}]},{id:"find",Icon:is,tone:{card:"border-cyan-200/70 bg-gradient-to-br from-white to-cyan-50/60",icon:"bg-cyan-100 text-cyan-700",label:"text-cyan-600",chip:"border-cyan-200 bg-cyan-50 text-cyan-800 hover:border-cyan-300 hover:bg-cyan-100",link:"bg-cyan-50 text-cyan-700 hover:bg-cyan-100"},title:{en:"Find products, orders, and customers",ar:"ابحث عن المنتجات والطلبات والعملاء"},body:{en:"Ask Packman AI to find specific information without searching the dashboard yourself.",ar:"اطلب من باكمان الذكي إيجاد معلومات محددة دون البحث في لوحة التحكم بنفسك."},examples:[{en:"Find the product called Classic T-Shirt.",ar:"ابحث عن المنتج باسم Classic T-Shirt."},{en:"Show me the details for this order.",ar:"أظهر لي تفاصيل هذا الطلب."},{en:"Find the customer with this email.",ar:"ابحث عن العميل بهذا البريد."},{en:"Show me my active coupons.",ar:"أظهر لي قسائمي النشطة."},{en:"Which products are most wishlisted?",ar:"ما المنتجات الأكثر إضافة للمفضلة؟"}],links:[{label:{en:"Customer management",ar:"إدارة العملاء"},route:m.LEARNING_CENTER.CUSTOMERS_GUIDE}]},{id:"howto",Icon:Kc,tone:{card:"border-emerald-200/70 bg-gradient-to-br from-white to-emerald-50/60",icon:"bg-emerald-100 text-emerald-700",label:"text-emerald-600",chip:"border-emerald-200 bg-emerald-50 text-emerald-800 hover:border-emerald-300 hover:bg-emerald-100",link:"bg-emerald-50 text-emerald-700 hover:bg-emerald-100"},title:{en:"Get help using the dashboard",ar:"احصل على مساعدة في استخدام لوحة التحكم"},body:{en:"Ask how to set up shipping, payments, branding, SEO, domains, size guides, Smart Studio, wallet credits, and more.",ar:"اسأل عن إعداد الشحن والمدفوعات والهوية البصرية وتحسين محركات البحث والنطاقات وأدلة المقاسات والاستوديو الذكي وأرصدة المحفظة والمزيد."},examples:[{en:"How do I configure shipping?",ar:"كيف أُعدّ الشحن؟"},{en:"Help me improve my product description.",ar:"ساعدني في تحسين وصف المنتج."},{en:"How do I connect my domain?",ar:"كيف أربط نطاقي؟"},{en:"How do AI credits work?",ar:"كيف تعمل أرصدة الذكاء الاصطناعي؟"}],links:[{label:{en:"Getting started",ar:"البدء"},route:m.LEARNING_CENTER.GETTING_STARTED},{label:{en:"Store settings",ar:"إعدادات المتجر"},route:m.LEARNING_CENTER.STORE_SETTINGS_GUIDE},{label:{en:"Shipping guide",ar:"دليل الشحن"},route:m.LEARNING_CENTER.SHIPPING_GUIDE},{label:{en:"SEO guide",ar:"دليل تحسين محركات البحث"},route:m.LEARNING_CENTER.SEO_GUIDE},{label:{en:"Smart Studio",ar:"الاستوديو الذكي"},route:m.LEARNING_CENTER.AI_GENERATION},{label:{en:"Wallet and credits",ar:"المحفظة والأرصدة"},route:m.LEARNING_CENTER.WALLET_GUIDE},{label:{en:"Plans and subscriptions",ar:"الخطط والاشتراكات"},route:m.LEARNING_CENTER.SUBSCRIPTIONS_GUIDE}]},{id:"navigate",Icon:fu,tone:{card:"border-indigo-200/70 bg-gradient-to-br from-white to-indigo-50/60",icon:"bg-indigo-100 text-indigo-700",label:"text-indigo-600",chip:"border-indigo-200 bg-indigo-50 text-indigo-800 hover:border-indigo-300 hover:bg-indigo-100",link:"bg-indigo-50 text-indigo-700 hover:bg-indigo-100"},title:{en:"Take me there",ar:"خذني إلى هناك"},body:{en:"Ask Packman AI to open the dashboard section you need.",ar:"اطلب من باكمان الذكي فتح القسم الذي تحتاجه في لوحة التحكم."},examples:[{en:"Open my orders.",ar:"افتح طلباتي."},{en:"Take me to analytics.",ar:"خذني إلى التحليلات."},{en:"Show me my wallet.",ar:"أظهر لي محفظتي."},{en:"Open store settings.",ar:"افتح إعدادات المتجر."}],links:[]},{id:"talk",Icon:vr,tone:{card:"border-violet-200/70 bg-gradient-to-br from-white to-violet-50/60",icon:"bg-violet-100 text-violet-700",label:"text-violet-600",chip:"border-violet-200 bg-vi
728olet-50 text-violet-800 hover:border-violet-300 hover:bg-violet-100",link:"bg-violet-50 text-violet-700 hover:bg-violet-100"},title:{en:"Talk naturally",ar:"تحدث بشكل طبيعي"},body:{en:"Continue the conversation, ask follow-ups, and use everyday language. Voice is supported in English and Arabic.",ar:"واصل المحادثة، واطرح أسئلة متابعة، واستخدم لغة يومية. الصوت مدعوم بالعربية والإنجليزية."},tip:{en:"Tip: Include a product name, order number, customer email, or time period when relevant to get the most useful answer.",ar:"نصيحة: أضف اسم المنتج أو رقم الطلب أو بريد العميل أو الفترة الزمنية عند الحاجة لتحصل على أدق إجابة."},examples:[],links:[]}];function Bn(e,n){return e?typeof e=="string"?e:n?e.ar||e.en:e.en||e.ar:""}function vy({onClose:e,onAsk:n,onLeaveToGuide:r,isRTL:s,t:a}){const o=wt(),d=l=>{l&&(o(We(l)),r?.())},u=l=>{l&&(n?.(l),e?.())};return t.jsxs("div",{className:"absolute inset-0 z-30 flex flex-col bg-gray-50",dir:s?"rtl":"ltr",role:"dialog","aria-modal":"true","aria-label":a?.t_ai_help_title||(s?"ماذا يمكن لباكمان الذكي فعله":"What Packman AI can do"),children:[t.jsxs("div",{className:"flex h-11 flex-shrink-0 items-center justify-between border-b border-gray-200 bg-white px-3",children:[t.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[t.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-lg bg-gradient-to-br from-brand-secondary to-fuchsia-500 text-white shadow-sm",children:t.jsx(Jn,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),t.jsxs("div",{className:s?"text-right":"text-left",children:[t.jsx("h3",{className:"text-[13px] font-semibold leading-tight text-gray-900",children:a?.t_ai_help_title||(s?"ماذا يمكن لباكمان الذكي فعله":"What Packman AI can do")}),t.jsx("p",{className:"text-[10px] leading-tight text-gray-400",children:a?.t_ai_help_subtitle||(s?"دليلك السريع لاستخدام المساعد":"A quick guide to using your assistant")})]})]}),t.jsx("button",{type:"button",onClick:e,"aria-label":a?.t_close||(s?"إغلاق":"Close"),className:"flex h-6 w-6 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600",children:t.jsx(Ft,{className:"h-3.5 w-3.5"})})]}),t.jsx(fl,{className:"min-h-0 flex-1",children:t.jsxs("div",{className:"space-y-3 px-3 py-3",children:[t.jsxs("div",{className:"rounded-2xl border border-brand-secondary/15 bg-gradient-to-br from-brand-secondary/5 to-fuchsia-50 px-3.5 py-3",children:[t.jsxs("div",{className:`mb-1.5 flex items-center gap-1.5 ${s?"flex-row-reverse":""}`,children:[t.jsx(zt,{className:"h-3.5 w-3.5 text-brand-secondary","aria-hidden":"true"}),t.jsx("p",{className:"text-[12px] font-semibold text-gray-900",children:a?.t_ai_help_intro_title||(s?"تعرّف على باكمان الذكي":"Meet Packman AI")})]}),t.jsx("p",{className:`text-[12px] leading-relaxed text-gray-600 ${s?"text-right":""}`,children:a?.t_ai_help_intro_body||(s?"يجيب عن أسئلتك، ويجد المعلومات، ويرشدك في لوحة التحكم، ويساعدك على إنجاز المهام اليومية. اسأل بلغة طبيعية بالعربية أو الإنجليزية.":"Your store assistant can answer questions, find information, guide you through the dashboard, and help you complete everyday tasks. Just ask naturally, in English or Arabic.")})]}),wy.map(l=>{const i=l.Icon;return t.jsxs("section",{className:`rounded-2xl border p-3.5 shadow-[0_1px_2px_rgba(15,23,42,0.05)] ${l.tone.card}`,children:[t.jsxs("div",{className:`mb-2 flex items-start gap-2 ${s?"flex-row-reverse":""}`,children:[t.jsx("span",{className:`mt-0.5 flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-xl ${l.tone.icon}`,children:t.jsx(i,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),t.jsxs("div",{className:`min-w-0 flex-1 ${s?"text-right":"text-left"}`,children:[t.jsx("h4",{className:"text-[13px] font-semibold text-gray-900",children:Bn(l.title,s)}),t.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-gray-600",children:Bn(l.body,s)})]})]}),l.examples?.length>0&&t.jsxs("div",{className:"mt-2.5",children:[t.jsx("p",{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-wide ${l.tone.label} ${s?"text-right":""}`,children:a?.t_ai_help_try_asking||(s?"جرّب أن تسأل":"Try asking")}),t.jsx("div",{className:`flex flex-wrap gap-1.5 ${s?"flex-row-reverse justify-start":""}`,children:l.examples.map(g=>{const y=Bn(g,s);return t.jsxs("button",{type:"button",onClick:()=>u(y),className:`inline-flex items-center gap-1 rounded-lg border px-2 py-1 text-[11px] font-medium shadow-sm transition-all hover:-translate-y-
728px hover:shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/40 ${l.tone.chip} ${s?"flex-row-reverse text-right":""}`,children:[t.jsx(yu,{className:"h-2.5 w-2.5 opacity-60","aria-hidden":"true"}),y]},y)})})]}),l.tip&&t.jsx("p",{className:`mt-2.5 rounded-xl bg-amber-50 px-2.5 py-2 text-[11px] leading-relaxed text-amber-800 ${s?"text-right":""}`,children:Bn(l.tip,s)}),l.links?.length>0&&t.jsx("div",{className:`mt-2.5 flex flex-wrap gap-1.5 border-t border-black/5 pt-2.5 ${s?"flex-row-reverse justify-start":""}`,children:l.links.map(g=>t.jsxs("button",{type:"button",onClick:()=>d(g.route),className:`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-[11px] font-semibold transition-all hover:-translate-y-px focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/40 ${l.tone.link} ${s?"flex-row-reverse":""}`,children:[t.jsx(ns,{className:"h-2.5 w-2.5","aria-hidden":"true"}),Bn(g.label,s)]},`${l.id}-${g.route}-${Bn(g.label,s)}`))})]},l.id)}),t.jsxs("button",{type:"button",onClick:()=>d(m.LEARNING_CENTER.INDEX),className:`mb-1 flex w-full items-center justify-center gap-1.5 rounded-2xl bg-gradient-to-r from-brand-secondary to-fuchsia-500 px-3 py-2.5 text-[12px] font-semibold text-white shadow-sm transition-all hover:brightness-105 hover:shadow-md focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/50 ${s?"flex-row-reverse":""}`,children:[t.jsx(Kc,{className:"h-3.5 w-3.5","aria-hidden":"true"}),a?.t_ai_help_browse_learning||(s?"تصفّح مركز التعلم":"Browse the Learning Center")]})]})})]})}const oi=e=>{const n=String(e||"").trim();if(!n)return"";if(/\s/.test(n))return n;const r=n.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean);return r.length===0?n:r.map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")},Ur=(e,n)=>{const r=String(e||"").trim();if(!r)return"";if(r.length<=n)return r;const s=r.slice(0,n),a=s.lastIndexOf(" ");return(a>n*.6?s.slice(0,a):s).trim()},ii=(e,n,r)=>{const s=[];e&&s.push(e),n&&!e?.toLowerCase().includes(n.toLowerCase())&&s.push(n),r&&String(r).split(/\s*>\s*/).map(d=>d.trim()).filter(Boolean).forEach(d=>s.push(d));const a=new Set,o=[];return s.forEach(d=>{const u=d.toLowerCase();a.has(u)||(a.add(u),o.push(d))}),o.slice(0,8).join(", ")},ur=e=>{const n=Number(e);return Number.isFinite(n)&&n>0},$s=(...e)=>{for(const n of e)if(ur(n))return String(n);return""},Ey=(e,{storeId:n})=>{if(!e||typeof e!="object")return e;const r={...e},s={...r.basicInfo||{}};n&&!s.storeId&&(s.storeId=n),r.basicInfo=s;const a=r.packmanAiProductDraft||{},o=a.price||{},d=a.suggestedPhysicalDetails||{},u={...r.pricing||{}};!ur(u.price)&&ur(o.amount)&&(u.price=String(o.amount),u.priceSource="ai_estimate",u.priceConfidence=o.confidence??null),r.pricing=u;const l=(C,k)=>{if(!ur(C))return"";const L=Number(C);return String(k==="g"?L/1e3:k==="lb"?L*.453592:k==="oz"?L*.0283495:L)},i={...r.physicalDetails||{}};ur(i.weight)||(i.weight=l(d.weight,d.weightUnit||"g")),i.length=$s(i.length,d.length),i.width=$s(i.width,d.width),i.height=$s(i.height,d.height),i.dimensionUnit||(i.dimensionUnit=d.dimensionUnit||"cm"),i.weightUnit="kg",r.physicalDetails=i,Array.isArray(r.attributes)&&r.attributes.length>0&&(r.attributes=r.attributes.map(C=>{if(!C||typeof C!="object")return C;const k=oi(C.key),L=C.nameAr&&C.nameAr!==C.key?C.nameAr:oi(C.nameAr||C.key);return{...C,key:k||C.key,nameAr:L||C.nameAr||k}}));const g={...r.seo||{}},y=s.name||"",p=s.nameAr||"",f=s.description||"",x=s.descriptionAr||"",v=s.brand||"",S=s.brandAr||"",_=s.categoryMatching?.aiCategoryInfo?.productCategory||"",w=C=>String(C||"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();return g.metaTitle||(g.metaTitle=Ur(y,60)),g.metaTitleAr||(g.metaTitleAr=Ur(p,60)),g.metaDescription||(g.metaDescription=Ur(w(f)||y,160)),g.metaDescriptionAr||(g.metaDescriptionAr=Ur(w(x)||p,160)),g.metaKeywords||(g.metaKeywords=ii(y,v,_)),g.metaKeywordsAr||(g.metaKeywordsAr=ii(p,S,_)),g.title={en:g.metaTitle||g.title?.en||"",ar:g.metaTitleAr||g.title?.ar||""},g.description={en:g.metaDescription||g.description?.en||"",ar:g.metaDescriptionAr||g.description?.ar||""},g.keywords={en:g.metaKeywords||g.keywords?.en||"",ar:g.metaKeywordsAr||g.keywords?.ar||""},r.seo=g,r},pr=e=>String(e||"").trim().toLowerCase(),Sy=e=>pr(e).replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")||`category-${Date.now()}`,ci=e=>!!(e?.parentId??e?.parent?.id??e?.parent_id),Ay=(e,n)=>{if(!Array.isArray(e))return null;const r=pr(n);return r&&(e.find(s=>
728pr(s?.name)===r)||e.find(s=>pr(s?.displayName)===r)||e.find(s=>pr(s?.name_ar)===r))||null},li=e=>!e||typeof e!="string"?[]:e.split(/\s*>\s*/).map(n=>n.trim()).filter(Boolean).slice(0,2),Ny=({storeId:e,systemCountry:n,storeCategories:r})=>{const s=c.useRef(r);s.current=r;const a=Ie();return{ensure:c.useCallback(async({productCategory:d,productCategoryAr:u,alreadyMatchedIds:l,locale:i="en"})=>{if(Array.isArray(l)&&l.length>0)return l;if(!e)return[];const g=li(d);if(g.length===0)return[];const y=li(u),p=(n||"ae").toString().toLowerCase(),f=Sr(),x=Array.isArray(s.current)?s.current:[];let v=null;const S=[];let _=!1;for(let w=0;w<g.length;w+=1){const C=g[w],k=y[w]||(i==="ar"?C:""),L=x.filter(E=>w===0?!ci(E):ci(E)),A=Ay(L,C);if(A?.id){v=A.id,S.includes(A.id)||S.push(A.id);continue}try{const E={name:C,slug:Sy(C),active:!0,storeId:e,showImageOnLandingPage:!1,...v?{parentId:v}:{},...k?{name_ar:k}:{}},j=await f.post(`/${p}/categories`,E),H=j?.data?.data??j?.data??{},D=H?.data?.id!=null?H.data:H?.id!=null?H:null;if(!D?.id)break;v=D.id,S.push(D.id),_=!0}catch{break}}if(_)try{a.removeQueries({queryKey:dm.all})}catch{}return S},[e,n,a])}},ky=2,Ty=({imageUrls:e,fileIds:n,enabled:r=!0}={})=>{const[s,a]=c.useState("idle"),[o,d]=c.useState([]),[u,l]=c.useState(null),[i,g]=c.useState(null),y=c.useMemo(()=>!Array.isArray(e)||e.length===0?"":e.join("|"),[e]),p=c.useMemo(()=>!Array.isArray(n)||n.length===0?"":n.join("|"),[n]),f=c.useRef("");c.useEffect(()=>{if(!r||!y)return;const S=`${y}::${p}`;if(f.current===S)return;f.current=S;let _=!1;return a("analyzing"),g(null),d([]),l(null),(async()=>{try{const w=await Mt.analyzeImageForChat({imageUrls:y.split("|"),fileIds:p?p.split("|"):void 0}),C=w?.data??w??{},k=Array.isArray(C?.objects)?C.objects:[];if(_)return;d(k),k.length>=ky?a("picker_needed"):(l(k[0]?.label??null),a("resolved"))}catch(w){if(_)return;g(w?.message||"analyze_failed"),a("error")}})(),()=>{_=!0}},[r,y,p]);const x=c.useCallback(S=>{!S||typeof S!="string"||(l(S),a("resolved"))},[]),v=c.useCallback(()=>{f.current="",a("idle"),d([]),l(null),g(null)},[]);return{status:s,objects:o,selectedFocus:u,error:i,selectFocus:x,reset:v,isLoading:s==="analyzing",isPickerOpen:s==="picker_needed",isResolved:s==="resolved",isError:s==="error"}},nr={seen:"packman.packmanAiProductDraftSeen",dismissedAt:"packman.packmanAiProductDraftDismissedAt",reentryDismissed:"packman.packmanAiProductDraftReentryDismissed",lastLocale:"packman.packmanAiProductDraftLocale",legacySeen:"packman.packmanAiIntroductionSeen",legacyDismissedAt:"packman.packmanAiIntroductionDismissedAt",parkedDraft:"packman.packmanAiProductDraftParked"},di="packman.packmanAiProductDraftHandoff",Ea="packman-ai-product-draft:open-gated",Sa={forceOpen:"packmanAiProductDraft",reset:"packmanAiProductDraftReset",fromProductDraft:"fromPackmanAiProductDraft"},Cy="VITE_ENABLE_PACKMAN_AI_PRODUCT_DRAFT",GI=["what_i_read","why_it_sells","pricing","what_is_set_up","next_steps"],jy=2500,Iy=120,Ry=1200,$I={minCharPerFrame:1,maxCharPerFrame:4,targetMsPerChar:18,punctuationPauseMs:90},Py=.6,pn=e=>Array.isArray(e)?e:[],sd=e=>!e||typeof e!="object"?null:e.productData?e.productData:Array.isArray(e.data)&&e.data[0]?.data?.productData?e.data[0].data.productData:null,ad=e=>{const n=pn(e?.variations),s=sd(e)?.variations??{},a=pn(s.colors),o=pn(s.sizes);return{flatCount:n.length,colorCount:a.length,sizeCount:o.length}},Oy=e=>{const{flatCount:n,colorCount:r,sizeCount:s}=ad(e);return n>1||r>1||s>1||r>=1&&s>=1}
728,Dy=e=>{const n=e?.suggestedVariants??{};return pn(n.colors).length>0||pn(n.sizes).length>0},Ly=e=>{const r=sd(e)?.variations??{},s=pn(r.colors).filter(o=>o&&(o.key||o.value)).map(o=>({key:String(o.key||o.value||"").trim(),value:String(o.value||o.key||"").trim(),value_ar:String(o.value_ar||o.value||o.key||"").trim(),hexCode:typeof o.hexCode=="string"?o.hexCode:""})),a=pn(r.sizes).filter(o=>o&&(o.key||o.value)).map(o=>({key:String(o.key||o.value||"").trim(),value:String(o.value||o.key||"").trim(),value_ar:String(o.value_ar||o.value||o.key||"").trim()}));return{colors:s,sizes:a}},Vs=e=>{const n=e?.suggestedVariants??{},r=pn(n.colors).filter(a=>a&&(a.key||a.value)).map(a=>({key:String(a.key||a.value||"").trim(),value:String(a.value||a.key||"").trim(),value_ar:String(a.value_ar||a.value||a.key||"").trim(),hexCode:typeof a.hexCode=="string"?a.hexCode:""})),s=pn(n.sizes).filter(a=>a&&(a.key||a.value)).map(a=>({key:String(a.key||a.value||"").trim(),value:String(a.value||a.key||"").trim()}));return{colors:r,sizes:s}},Uy=e=>{if(!e||typeof e!="object")return{type:"simple",shouldGenerateVariants:!1,suggestedVariants:{colors:[],sizes:[]},observedSingleVariants:{colors:[],sizes:[]},assessment:null,reasonCode:"empty_response"};const n=e.variantAssessment??null,r=typeof n?.confidence=="number"?n.confidence:0,s=ad(e);return Oy(e)?{type:"variant",shouldGenerateVariants:!0,suggestedVariants:Vs(e),observedSingleVariants:{colors:[],sizes:[]},assessment:n,reasonCode:"confirmed_variants"}:!!n?.shouldHaveVariants&&r>=Py&&Dy(e)?{type:"simple",shouldGenerateVariants:!1,suggestedVariants:Vs(e),observedSingleVariants:{colors:[],sizes:[]},assessment:n,reasonCode:"suggested_only"}:s.flatCount===1||s.colorCount===1||s.sizeCount===1?{type:"simple",shouldGenerateVariants:!1,suggestedVariants:Vs(e),observedSingleVariants:Ly(e),assessment:n,reasonCode:"single_confirmed_value"}:{type:"simple",shouldGenerateVariants:!1,suggestedVariants:{colors:[],sizes:[]},observedSingleVariants:{colors:[],sizes:[]},assessment:n,reasonCode:"simple_product"}},ui=e=>new Promise(n=>setTimeout(n,e)),My={colors:[],sizes:[]},pi=e=>e?.metadata?.response??e?.data?.metadata?.response??e?.response??e?.data?.response??null,mi=(e,n)=>{const r=Uy(e),s=um(e,n,{generateVariants:r.shouldGenerateVariants});if(!s?.length)return null;const a=s[0],o=e?.productData?.productCategory_ar||e?.productData?.productCategoryAr||"";o&&(a.productCategoryAr=o);const d=e?.packmanAiProductDraft??{},u=a.packmanAiProductDraft??{};return a.packmanAiProductDraft={...d,...u,variantAssessment:r.assessment??u.variantAssessment??null,suggestedVariants:r.suggestedVariants,observedSingleVariants:r.observedSingleVariants??u.observedSingleVariants??My,suggestedPhysicalDetails:e?.suggestedPhysicalDetails??u.suggestedPhysicalDetails??null,price:d.price??u.price??null,typeDecision:{type:r.type,shouldGenerateVariants:r.shouldGenerateVariants,reasonCode:r.reasonCode}},a},Gy=({storeId:e,systemCountry:n,onTaskStarted:r,storeCategories:s})=>{const a=c.useRef(null),o=c.useRef(!1),d=Ie(),u=c.useRef(s);u.current=s,c.useEffect(()=>()=>{o.current=!0,a.current&&a.current.abort()},[]);const l=c.useCallback(async({imageUrls:g,language:y="en",focusObject:p,sellerQuestion:f,forceRefresh:x=!1})=>{if(o.current=!1,!e)throw new Error("storeId is required");if(!Array.isArray(g)||g.length===0)throw new Error("imageUrls are required");a.current=new AbortController;const v=Sr(),S=(n||"ae").toString().toLowerCase(),w={storeId:e,imageUrls:g,locale:y==="ar"?"ar":"en"};typeof p=="string"&&p.trim().length>0&&(w.focusObject=p.trim()),typeof f=="string"&&f.trim().length>0&&(w.sellerQuestion=f.trim()),x===!0&&(w.forceRefresh=!0);let C;try{C=await v.post(`/${S}/ai-chat/generate-ai-product-draft`,w,{signal:a.current.signal})}catch(E){const j=E?.response?.data?.message??E?.response?.data?.error;if((Array.isArray(j)?j[0]:j)==="insufficientBalance"){const D=new Error("insufficient_credits");throw D.code="insufficient_credits",D}throw E}const k=C?.data?.data??C?.data??{},L=k.taskId,A=k.status==="processing"&&k.cached===!0;if(!L)throw new Error("AI service did not return a taskId");if(typeof r=="function"&&r(L,{reusedExistingTask:A,status:k.status,cached:!!k.cached}),k.status==="completed"){const E=await Do(L,e),j=pi(E);if(!j)throw new Error("AI task completed but returned no payload");const H=mi(j,u.current||[]);if(!H)throw new Error("AI task returned empty product list");return d.invalidateQueries({queryKey:Lo.balance(e)}),{taskId:L,product:H}}await ui(Ry);for(let E=0;E<Iy;E++){if(o.current)throw new Error("cancelled");const j=await Do(L,e),H=j?.status??j?.data?.status;if(H==="completed"||H==="success"){const D=pi(j);if(!D)throw new Error("AI task completed but returned no payload");const $=mi(D,u.current||[]);if(!$)throw new Error("AI task returned empty product list");return d.invalidateQueries({queryKey:Lo.balance(e)}),{taskId:L,product:$}}if(H==="failed"||H==="error"){const D=j?.metadata?.error??j?.error??"AI task failed";throw new Error(D)}await ui(jy)}throw new Error("AI task timed out")},[e,n,r,d]),i=c.useCallback(()=>{o.current=!0,a.current&&a.current.abort()},[]);return{start:l,cancel:i}},$y=e=>{if(!e)return null;const n=e.basicInfo||{},r={colors:(e.options||[]).find(o=>o.option==="Colors")?.values?.en?.map((o,d)=>({value:o,hexCode:e.options?.[0]?.hex?.[d]||""}))||[],sizes:(e.options||[]).find(o=>o.option==="Sizes")?.values?.en?.map(o=>({value:o}))||[]},s=e.packmanAiProductDraft||{},a={variantAssessment:s.variantAssessment??null,suggestedVariants:s.suggestedVariants??{colors:[],sizes:[]},typeDecision:s.typeDecision??null,price:s.price??null,suggestedPhysicalDetails:s.suggestedPhysicalDetails??null};return{name:n.name,name_ar:n.nameAr,description:n.description,description_ar:n.descriptionAr,brand:n.brand,brand_ar:n.brandAr,productCategory:e.productCategory,productCategory_ar:e.productCategoryAr,productSpecifications:(e.attributes||[]).reduce((o,d)=>(d?.key&&(o[d.key]={en:d.value?.en||"",ar:d.value?.ar||""}),o),{}),variations:r,pricing:{price:e.pricing?.price??"",wasPrice:e.pricing?.
728wasPrice??"",currency:s.price?.currency??e.pricing?.currency??""},physicalDetails:e.physicalDetails??null,seo:e.seo,packmanAiProductDraft:a}},Vy=({storeId:e,systemCountry:n,locale:r})=>{const s=c.useRef(null);c.useEffect(()=>()=>{s.current&&s.current.abort()},[]);const a=c.useCallback(async({productDraft:d,productTaskId:u})=>{if(!e)throw new Error("storeId is required");const l=$y(d);if(!l)throw new Error("productDraft is required");s.current=new AbortController;const i=Sr(),g=(n||"ae").toString().toLowerCase(),{data:y}=await i.post(`/${g}/ai-chat/generate-ai-product-draft-narrative`,{storeId:e,productTaskId:u??void 0,productJson:l,locale:r},{signal:s.current.signal}),p=y?.data??y;if(!p?.sections)throw new Error("Narrative response missing sections");return{taskId:p.taskId,locale:p.locale,sections:p.sections}},[e,n,r]),o=c.useCallback(()=>{s.current&&s.current.abort()},[]);return{start:a,cancel:o}},po={width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"},Fy=e=>t.jsxs("svg",{...po,...e,children:[t.jsx("path",{d:"M6 3h12l1 6-2 12h-4l-1-9h-2l-1 9H5L7 9z"}),t.jsx("line",{x1:"6",y1:"3",x2:"18",y2:"3"}),t.jsx("line",{x1:"11",y1:"3",x2:"11",y2:"9"}),t.jsx("line",{x1:"13",y1:"3",x2:"13",y2:"9"})]}),zy=e=>t.jsxs("svg",{...po,...e,children:[t.jsx("path",{d:"M7 4h10l-1 4 4 13H4l4-13z"}),t.jsx("line",{x1:"7",y1:"4",x2:"17",y2:"4"})]}),Wy=e=>t.jsxs("svg",{...po,...e,children:[t.jsx("path",{d:"M9 3l-2 4 2 1-3 4 2 1-3 8h14l-3-8 2-1-3-4 2-1-2-4z"}),t.jsx("path",{d:"M9 3h6"})]}),By=[{icon:So,palette:"fashion",keywords:["t-shirt","tshirt","tee","shirt","blouse","polo","tank top","tank","top","sweater","hoodie","cardigan","sweatshirt","jersey"]},{icon:Fy,palette:"fashion-bottom",keywords:["pants","trouser","trousers","jeans","denim","shorts","leggings","joggers","sweatpants","chinos","slacks"]},{icon:zy,palette:"fashion-bottom",keywords:["skirt"]},{icon:Wy,palette:"fashion-dress",keywords:["dress","gown","kaftan","abaya","robe"]},{icon:So,palette:"fashion-outer",keywords:["jacket","coat","blazer","parka","cardigan","thobe","suit"]},{icon:bu,palette:"footwear",keywords:["sneaker","sneakers","shoe","shoes","boot","boots","sandal","sandals","heel","heels","loafer","loafers","slipper","slippers","trainer","trainers"]},{icon:xu,palette:"accessory",keywords:["cap","hat","beanie","headband","scarf"]},{icon:_u,palette:"accessory",keywords:["helmet"]},{icon:wu,palette:"bag",keywords:["backpack","rucksack"]},{icon:Hc,palette:"bag",keywords:["handbag","purse","tote","clutch","wallet","bag"]},{icon:vu,palette:"bag",keywords:["briefcase","luggage","suitcase"]},{icon:Eu,palette:"jewelry",keywords:["watch","bracelet","wristband"]},{icon:Su,palette:"jewelry",keywords:["jewel","ring","necklace","earring","pendant","diamond"]},{icon:Au,palette:"accessory",keywords:["glass","glasses","sunglass","sunglasses","eyewear","spectacle"]},{icon:Nu,palette:"electronics",keywords:["smartphone","iphone","android","mobile phone","cellphone","phone"]},{icon:ku,palette:"electronics",keywords:["laptop","macbook","notebook computer","computer"]},{icon:Tu,palette:"electronics",keywords:["headphone","headphones","earphone","earphones","earbud","earbuds","airpod","airpods","speaker"]},{icon:Ln,palette:"electronics",keywords:["camera"]},{icon:vr,palette:"electronics",keywords:["microphone","mic"]},{icon:Cu,palette:"electronics",keywords:["gamepad","controller","console","playstation","xbox","nintendo"]},{icon:ju,palette:"home",keywords:["sofa","couch"]},{icon:Iu,palette:"home",keywords:["armchair","chair","stool"]},{icon:Ru,palette:"home",keywords:["bed","mattress","pillow","blanket"]},{icon:Pu,palette:"home",keywords:["lamp","lantern","lighting"]},{icon:Ou,palette:"vehicle",keywords:["car","vehicle"]},{icon:Du,palette:"vehicle",keywords:["bicycle","bike","scooter","motorcycle"]},{icon:Lu,palette:"food",keywords:["pizza","burger","sandwich","bread"]},{icon:Uu,palette:"food",keywords:["cake","dessert","pastry","cupcake","donut"]},{icon:Mu,palette:"food",keywords:["fruit","apple","vegetable"]},{icon:Gu,palette:"food",keywords:["meal","food","dish"]},{icon:$u,palette:"food",keywords:["fork","knife","spoon","cutlery"]},{icon:Vu,palette:"drink",keywords:["coffee","tea","mug"]},{icon:Fu,palette:"drink",keywords:["wine","champagne"]}
728,{icon:zu,palette:"drink",keywords:["water","bottle","drink","beverage","juice"]},{icon:zt,palette:"beauty",keywords:["makeup","cosmetic","lipstick","perfume","fragrance","skincare","serum","cream"]},{icon:Wu,palette:"beauty",keywords:["brush"]},{icon:Bu,palette:"beauty",keywords:["palette","paint"]},{icon:qu,palette:"nature",keywords:["flower","plant","bouquet","rose"]},{icon:Ku,palette:"pet",keywords:["pet","dog","cat","animal"]},{icon:Hu,palette:"media",keywords:["book","novel","magazine","journal","diary"]},{icon:Yu,palette:"media",keywords:["music","album","vinyl","record"]},{icon:Qu,palette:"media",keywords:["drum"]},{icon:Xu,palette:"media",keywords:["guitar","ukulele"]},{icon:Bc,palette:"tools",keywords:["tool","wrench","spanner","hammer","drill","screwdriver"]},{icon:Ju,palette:"tools",keywords:["key","lock"]},{icon:Va,palette:"neutral",keywords:["accessory","accessories"]}],Aa={fashion:{iconBg:"bg-violet-50",iconText:"text-violet-600",ring:"ring-violet-200"},"fashion-bottom":{iconBg:"bg-indigo-50",iconText:"text-indigo-600",ring:"ring-indigo-200"},"fashion-dress":{iconBg:"bg-fuchsia-50",iconText:"text-fuchsia-600",ring:"ring-fuchsia-200"},"fashion-outer":{iconBg:"bg-purple-50",iconText:"text-purple-700",ring:"ring-purple-200"},footwear:{iconBg:"bg-amber-50",iconText:"text-amber-600",ring:"ring-amber-200"},accessory:{iconBg:"bg-rose-50",iconText:"text-rose-600",ring:"ring-rose-200"},bag:{iconBg:"bg-orange-50",iconText:"text-orange-600",ring:"ring-orange-200"},jewelry:{iconBg:"bg-pink-50",iconText:"text-pink-600",ring:"ring-pink-200"},electronics:{iconBg:"bg-sky-50",iconText:"text-sky-600",ring:"ring-sky-200"},home:{iconBg:"bg-teal-50",iconText:"text-teal-600",ring:"ring-teal-200"},vehicle:{iconBg:"bg-blue-50",iconText:"text-blue-600",ring:"ring-blue-200"},food:{iconBg:"bg-red-50",iconText:"text-red-600",ring:"ring-red-200"},drink:{iconBg:"bg-amber-50",iconText:"text-amber-700",ring:"ring-amber-200"},beauty:{iconBg:"bg-fuchsia-50",iconText:"text-fuchsia-600",ring:"ring-fuchsia-200"},nature:{iconBg:"bg-emerald-50",iconText:"text-emerald-600",ring:"ring-emerald-200"},pet:{iconBg:"bg-amber-50",iconText:"text-amber-700",ring:"ring-amber-200"},media:{iconBg:"bg-indigo-50",iconText:"text-indigo-600",ring:"ring-indigo-200"},tools:{iconBg:"bg-slate-100",iconText:"text-slate-600",ring:"ring-slate-200"},neutral:{iconBg:"bg-gray-100",iconText:"text-gray-500",ring:"ring-gray-200"}},gi={icon:Zn,palette:Aa.neutral},qy=By.map(e=>{const n=e.keywords.map(r=>{const s=r.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+");return new RegExp(`(?:^|[^a-z0-9])${s}(?:[^a-z0-9]|$)`,"i")});return{...e,patterns:n}}),hi=e=>{const n=(e||"").toString().trim();if(!n)return gi;const r=` ${n.toLowerCase()} `;for(const s of qy)for(const a of s.patterns)if(a.test(r))return{icon:s.icon,palette:Aa[s.palette]??Aa.neutral};return gi},Ky=[{label:"تي شيرت",keywords:["t-shirt","tshirt","tee"]},{label:"قميص",keywords:["shirt","blouse","polo","top"]},{label:"بنطال",keywords:["pants","trouser","trousers","jeans","leggings","joggers"]},{label:"تنورة",keywords:["skirt"]},{label:"فستان",keywords:["dress","gown","abaya","kaftan"]},{label:"جاكيت",keywords:["jacket","coat","blazer","hoodie","sweater","cardigan"]},{label:"حذاء",keywords:["shoe","shoes","sneaker","sneakers","boot","boots"]},{label:"شبشب",keywords:["slipper","slippers","sandal","sandals"]},{label:"حقيبة",keywords:["bag","handbag","purse","tote","clutch","backpack"]},{label:"ساعة",keywords:["watch"]},{label:"نظارات",keywords:["glasses","sunglasses","eyewear"]},{label:"هاتف",keywords:["phone","iphone","smartphone","mobile"]},{label:"حاسوب محمول",keywords:["laptop","macbook","computer"]},{label:"سماعات",keywords:["headphone","headphones","earbud","earbuds","airpods"]},{label:"كاميرا",keywords:["camera"]},{label:"عطر",keywords:["perfume","fragrance"]},{label:"مستحضر عناية",keywords:["skincare","serum","cream","cosmetic"]},{label:"وردة",keywords:["flower","rose","bouquet"]}],fi=(e,n="en")=>{if(!e||typeof e!="string")return"";const r=e.trim().toLowerCase();if(n==="ar"){for(const s of Ky)if(s.keywords.some(a=>r.includes(a)))return s.label;return e.trim()}return r.replace(/(^|[\s\-/])([a-z\u00e0-\u017f])/g,(s,a,o)=>a+o.toUpperCase())},Hy=.5;function Yy({objects:e,isAnalyzing:n,isRTL:r,resolvedLabel:s,onSelect:a,onChange:o}){const{t:d}=yt(),u=c.useMemo(()=>Array.isArray(e)?e.map(p=>{const f=p?.label||"";return{key:p?.key||f,rawLabel:f,displayLabel:fi(f),confidence:typeof p?.confidence=="number"?p.confidence:null,presentation:hi(f)}}):[],[e]),l=d("aiChat.t_focus_picker_analyzing")||d("packmanAiProductDraft.t_focus_picker_analyzing")||"Looking at the image…",i=d("aiChat.t_focus_picker_title")||d("packmanAiProductDraft.t_focus_picker_title")||"I spotted a few items — which one should I draft?",g=d("aiChat.t_focus_picker_change")||d("packmanAiProductDraft.t_focus_picker_change")||"Change",y=d("aiChat.t_focus_picker_drafting_from")||"Drafting from";if(n&&!s)return t.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-gray-600",children:[t.jsx("span",{className:"inline-flex h-3 w-3 animate-pulse rounded-full bg-brand-secondary/60"}),t.jsx("span",{children:l})]});if(s){const p=fi(s),{icon:f,palette:x}=hi(s);return t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[12px] text-gray-700",children:[t.jsxs("span",{className:["inline-flex items-center gap-1.5 rounded-full px-2 py-1 ring-1",x.iconBg,x.iconText,x.ring].join(" "),children:[t.jsx(f,{className:"h-3.5 w-3.5","aria-hidden":"true"}),t.jsxs("span",{className:"font-medium",children:[y,": ",t.jsx("span",{className:"font-semibold",children:p})]})]}),typeof o=="function"&&t.jsx("button",{type:"button",onClick:o,className:"text-[11px] font-medium text-gray-500 underline-offset-2 hover:text-gray-800 hover:underline",children:g})]})}return t.jsxs("div",{className:"flex flex-col gap-2.5",dir:r?"rtl":"ltr",children:[t.jsxs("p",{className:"inline-flex items-center gap-1.5 text-[13px] font-semibold text-gray-900 leading-snug",children:[t.jsx(zt,{className:"h-3.5 w-3.5 text-brand-secondary","aria-hidden":"true"}),i]}),t.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(p=>{const f=p.presentation.icon,x=p.presentation.palette;return t.jsxs("button",{type:"button",onClick:()=>a?.(p.rawLabel),className:["group inline-flex items-center gap-2 rounded-full border bg-white px-3 py-1.5 text-[12px] font-medium text-gray-800 shadow-sm transition-all","hover:-translate-y-0.5 hover:border-brand-secondary hover:text-brand-secondary hover:shadow","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/40","border-gray-200"].join(" "),children:[t.jsx("span",{className:["inline-flex h-6 w-6 items-center justify-center rounded-full ring-1",x.iconBg,x.iconText,x.ring].join(" "),"aria-hidden":"true",children:t.jsx(f,{className:"h-3.5 w-3.5"})}),t.jsx("span",{children:p.displayLabel}),typeof p.confidence=="number"&&p.confidence>=Hy&&t.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-400",children:[Math.round(p.confidence*100),"%"]}),t.jsx(Dn,{className:"h-3 w-3 text-brand-secondary opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":"true"})]},p.key)})})]})}const Qy=c.memo(Yy),yi=e=>Array.isArray(e)?e.map(n=>{if(!n||typeof n!="object"||typeof n.fileId=="number")return n;if(n.fileId==null||n.fileId==="")return null;const r=Number(n.fileId);return Number.isFinite(r)?{...n,fileId:r}:null}
728).filter(Boolean):e,Xy=e=>{if(!e||typeof e!="object")return e;const n={...e},r=e.productAttributesMetadata||{};Array.isArray(e.mediaFiles)&&(n.mediaFiles=yi(e.mediaFiles));const s={};return Object.values(r).forEach(o=>{o&&typeof o=="object"&&o.name&&(s[o.name]=o)}),Array.isArray(e.options)&&(n.options=e.options.map(o=>{if(!o||typeof o!="object")return null;if(o.name&&Array.isArray(o.values))return o;const d=o.name||o.option||"",u=s[d]||{},l=Array.isArray(o.values?.en)?o.values.en:Array.isArray(o.values)?o.values:[],i=Array.isArray(o.values?.ar)?o.values.ar:Array.isArray(o.valuesAr)?o.valuesAr:[],g=Array.isArray(o.hex)?o.hex:Array.isArray(o.hexCode)?o.hexCode:[],y=l.map(f=>f==null?"":String(f).trim()).filter(Boolean);if(y.length===0)return null;const p={name:d,nameAr:o.nameAr||u.nameAr||"",type:o.type||u.type||"dropdown",values:y,valuesAr:i.map((f,x)=>f==null||String(f).trim()===""?y[x]:String(f))};return g.length>0&&(p.hexCode=g.map(f=>f==null?"":String(f))),p}).filter(Boolean)),String(e.basicInfo?.type||"").toLowerCase()==="simple"?(n.variations=[],n.options=[]):Array.isArray(e.variations)&&(n.variations=e.variations.map(o=>{if(!o||typeof o!="object")return o;const d=o.pricing||{},u=o.physicalDetails||{},l={name:o.name||"",nameAr:o.nameAr||"",slug:o.slug||"",description:o.description??"",descriptionAr:o.descriptionAr??"",sku:o.sku||"",price:o.price??d.price??"",wasPrice:o.wasPrice??d.wasPrice??"",costPrice:o.costPrice??d.costPrice??"",videoUrl:o.videoUrl??o.youtubeVideoUrl??"",mediaFiles:yi(Array.isArray(o.mediaFiles)?o.mediaFiles:[]),attributes:o.attributes&&typeof o.attributes=="object"?o.attributes:{},weight:o.weight??u.weight??"",weightUnit:o.weightUnit??u.weightUnit??"kg",width:o.width??u.width??"",height:o.height??u.height??"",length:o.length??u.length??"",dimensionUnit:o.dimensionUnit??u.dimensionUnit??"cm",stock:o.stock??""};return typeof o.id=="number"&&(l.id=o.id),l})),n},Jy=()=>{const e=c.useCallback(r=>{if(!r||typeof window>"u")return!1;try{const s={draft:Xy(r),persistedAt:Date.now(),source:"packman-ai-product-draft"};return window.sessionStorage.setItem(di,JSON.stringify(s)),!0}catch{return!1}},[]),n=c.useCallback(()=>{if(!(typeof window>"u"))try{window.sessionStorage.removeItem(di)}catch{}},[]);return{persist:e,clear:n}};function Zy({product:e,narrative:n,images:r,isRTL:s,focusLabel:a}){const{t:o}=yt(),d=wt(),u=ae(A=>A.language)||"en",{persist:l}=Jy(),i=ae(A=>A.store?.selectedStore?.currency?.code||A.store?.selectedStore?.currency),g=c.useMemo(()=>{const A=e?.basicInfo||{};return u==="ar"?A.nameAr||A.name||"":A.name||A.nameAr||""},[e,u]),y=c.useMemo(()=>{const A=e?.packmanAiProductDraft||{},E=u==="ar"?e?.productCategoryAr||A?.suggestedCategoryPathAr||A?.categoryPathAr:A?.suggestedCategoryPath||A?.categoryPath||e?.productCategory;if(!E||typeof E!="string")return"";const j=E.split(">").map(H=>H.trim()).filter(Boolean);return j[j.length-1]||""},[e,u]),p=c.useMemo(()=>{const A=e?.packmanAiProductDraft?.price?.amount??Number(e?.pricing?.price);return Number.isFinite(Number(A))?Number(A):null},[e]),f=c.useMemo(()=>{const A=e?.packmanAiProductDraft?.price?.range;if(!A)return null;const E=Number(A.low),j=Number(A.high);return!Number.isFinite(E)||!Number.isFinite(j)?null:{low:E,high:j}},[e]),x=c.useMemo(()=>{const A=Array.isArray(e?.mediaFiles)?e.mediaFiles:[];return A[0]?.url?A[0].url:Array.isArray(r)&&r[0]?r[0]:null},[e,r]),v=c.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("packman-ai-product-draft:hydrate",{detail:{product:e,narrative:n||null,images:Array.isArray(r)?r:null,focus:a||null}}))},[e,n,r,a]),S=c.useCallback(()=>{if(!e)return;const A=l(e);fs(d,"/dashboard/products/create",{[Sa.fromProductDraft]:"1",fromAiChat:"1",...A?{prefilled:"1"}:{}})},[e,l,d]),_=o("aiChat.t_chat_card_ai_estimate")||o("packmanAiProductDraft.t_ai_estimate_label")||"AI estimate",w=o("aiChat.t_chat_card_open_overlay")||"Open full preview",C=o("aiChat.t_chat_card_create_product")||"Create product",k=u==="ar"?"":`${i||"AED"} `,L=u==="ar"?` ${i||"AED"}`:"";return t.jsxs("div",{className:"flex flex-col gap-2.5 rounded-xl border border-gray-200 bg-white p-2.5 shadow-sm",dir:s?"rtl":"ltr",children:[t.jsxs("div",{className:"flex items-stretch gap-2.5",children:[x&&t.jsxs("div",{className:"relative h-20 w-20 flex-shrink-0 overflow-hidden rounded-lg bg-gray-50",children:[t.jsx("img",{src:x,alt:g,className:"h-full w-full object-cover"}),t.jsxs("span",{className:"absolute bottom-1 left-1 inline-flex items-center gap-0.5 rounded-md bg-white/90 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-brand-secondary",children:[t.jsx(zt,{className:"h-2.5 w-2.5"}),"AI"]})]}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-between gap-1",children:[t.jsxs("div",{className:"flex flex-col gap-0.5",children:[y&&t.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em] text-gray-400",children:y}),t.jsx("p",{className:"line-clamp-2 text-[13px] font-semibold text-gray-900 leading-snug",children:g})]}),p!==null&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-gradient-to-r from-brand-secondary/10 to-fuchsia-500/10 px-2 py-0.5 text-[12px] font-semibold text-brand-secondary",children:[t.jsxs("span",{dir:"ltr",children:[k,p.toLocaleStr
728ing(),L]}),t.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wide text-brand-secondary/70",children:_})]}),f&&t.jsxs("span",{className:"text-[10px] text-gray-400",dir:"ltr",children:[f.low.toLocaleString(),"–",f.high.toLocaleString()]})]})]})]}),a&&t.jsxs("p",{className:"text-[11px] text-gray-500",children:[o("aiChat.t_focus_picker_drafting_from")||"Drafting from",":"," ",t.jsx("span",{className:"font-medium text-gray-700",children:a})]}),t.jsxs("div",{className:"flex flex-col gap-1.5 sm:flex-row",children:[t.jsxs("button",{type:"button",onClick:v,className:"inline-flex flex-1 items-center justify-center gap-1 rounded-lg border border-gray-200 bg-gray-50 px-2.5 py-1.5 text-[12px] font-medium text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-100",children:[t.jsx(ns,{className:"h-3 w-3"}),w]}),t.jsxs("button",{type:"button",onClick:S,className:"inline-flex flex-1 items-center justify-center gap-1 rounded-lg bg-gray-900 px-2.5 py-1.5 text-[12px] font-medium text-white transition-colors hover:bg-gray-800",children:[C,t.jsx(Yc,{className:`h-3 w-3 ${s?"rotate-180":""}`})]})]})]})}const eb=c.memo(Zy),tb=e=>e?Array.isArray(e)?e:Array.isArray(e?.data?.result)?e.data.result:Array.isArray(e?.data?.data)?e.data.data:Array.isArray(e?.result)?e.result:Array.isArray(e?.data)?e.data:Array.isArray(e?.categories)?e.categories:[]:[],od={status:"analyzing",focus:null,product:null,narrative:null,error:null},nb=(e,n)=>{switch(n.type){case"PICKER_NEEDED":return{...e,status:"picker_needed"};case"FOCUS_SET":return{...e,status:"generating",focus:n.focus};case"PRODUCT_READY":return{...e,product:n.product};case"NARRATIVE_READY":return{...e,status:"ready",narrative:n.narrative};case"ERROR":return{...e,status:"error",error:n.error};case"RESET_TO_PICKER":return{...od,status:"picker_needed"};default:return e}};function rb({imageUrls:e,sellerQuestion:n,fileIds:r,isRTL:s}){const{t:a}=yt(),o=ae($=>$.store?.selectedStore),d=ae($=>$.store?.selectedStoreDetails),u=ae($=>$.language)||"en",l=d?.data||d||o,i=l?.id,g=(l?.systemCountry?.code||"ae").toString().toLowerCase(),y=u==="ar"?"ar":"en",[p,f]=c.useReducer(nb,od),x=Ty({imageUrls:e,fileIds:r,enabled:!!(e&&e.length>0)}),{data:v}=pm({storeId:i,systemCountry:g},{enabled:!!i}),S=c.useMemo(()=>tb(v),[v]),{start:_}=Gy({storeId:i,systemCountry:g,storeCategories:S}),{start:w}=Vy({storeId:i,systemCountry:g,locale:y}),{ensure:C}=Ny({storeId:i,systemCountry:g,storeCategories:S});c.useEffect(()=>{x.status==="picker_needed"&&p.status==="analyzing"&&f({type:"PICKER_NEEDED"}),x.status==="error"&&p.status!=="error"&&f({type:"ERROR",error:x.error||"analyze_failed"})},[x.status,x.error,p.status]);const k=c.useCallback(async $=>{if(!i){console.warn("[ChatStartProductRunner] skipping generation: storeId not ready yet");return}f({type:"FOCUS_SET",focus:$});try{console.info("[ChatStartProductRunner] starting draft generation",{storeId:i,focus:$,imageCount:e?.length??0,locale:y});const{taskId:re,product:pe}=await _({imageUrls:e,language:y,focusObject:$||void 0,sellerQuestion:n||void 0});if(!pe)throw new Error("empty product");const te=Array.isArray(pe?.basicInfo?.categories)?pe.basicInfo.categories:[],R=pe?.basicInfo?.categoryMatching?.aiCategoryInfo?.productCategory,B=pe?.basicInfo?.categoryMatching?.aiCategoryInfo?.productCategoryAr;let U=te;if(te.length===0&&R)try{U=await C({productCategory:R,productCategoryAr:B,alreadyMatchedIds:te,locale:y})}catch{U=te}let K={...pe};U&&U.length>0&&U!==te&&(K.basicInfo={...K.basicInfo,categories:U}),K=Ey(K,{storeId:i}),f({type:"PRODUCT_READY",product:K});const ee=await w({productDraft:K,productTaskId:re?String(re):void 0});f({type:"NARRATIVE_READY",narrative:ee})}catch(re){if(re?.message==="cancelled")return;console.error("[ChatStartProductRunner] generation failed",re,{storeId:i,focus:$,imageUrls:e}),f({type:"ERROR",error:re?.message||"generation_failed"})}},[i,e,y,n,_,w,C]);c.useEffect(()=>{p.status==="analyzing"&&x.status==="resolved"&&k(x.selectedFocus)},[x.status,x.selectedFocus,p.status,k]);const L=c.useCallback($=>{x.selectFocus($),k($)},[x,k]),A=c.useCallback(()=>{x.reset()},[x]),E=a("aiChat.t_chat_working_on_draft")||"Writing up the product draft — this takes a few seconds…",j=a("aiChat.t_chat_generation_failed")||"Something went wrong while drafting the product. Want to try again?",H=a("aiChat.t_retry")||a("t_retry")||"Try again";if(p.status==="error")return t.jsxs("div",{className:"flex items-start gap-2 text-[12px] text-red-600",children:[t.jsx(Da,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:j}),t.jsxs("button",{type:"button",onClick:A,className:"inline-flex items-center gap-1 self-start text-[11px] font-medium text-red-700 underline-offset-2 hover:underline",children:[t.jsx(Zu,{className:"h-3 w-3"}),H]})]})]});if(p.status==="ready"&&p.product)return t.jsx(eb,{product:p.product,narrative:p.narrative,images:e,isRTL:s,focusLabel:p.focus});if(p.status==="picker_needed"&&x.objects.length>
7280)return t.jsx(Qy,{objects:x.objects,isAnalyzing:!1,isRTL:s,onSelect:L});const D=p.status==="generating";return t.jsxs("div",{className:"flex items-start gap-2 text-[12px] text-gray-600",children:[t.jsx(St,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0 animate-spin text-brand-secondary"}),t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:D?E:a("aiChat.t_chat_analyzing_image")||"Looking at the image for distinct products…"}),D&&p.focus&&t.jsxs("span",{className:"text-[11px] text-gray-500",children:[a("aiChat.t_focus_picker_drafting_from")||"Drafting from",":"," ",t.jsx("span",{className:"font-medium text-gray-700",children:p.focus})]})]})]})}const sb=c.memo(rb),ab=e=>{if(!e)return null;const n=e?.data??e,r=n?.products??n?.result??n?.items??(Array.isArray(n)?n:null);return Array.isArray(r)?r.length:typeof n?.total=="number"?n.total:typeof n?.totalCount=="number"?n.totalCount:typeof n?.count=="number"?n.count:null},ob=mm?.hooks?.useAllProducts,id=({storeId:e,systemCountry:n,enabled:r})=>{const s=ob({storeId:e,systemCountry:n,limit:1,page:1},{enabled:!!(r&&e),staleTime:3e4,refetchOnWindowFocus:!1});if(!r||!e)return{hasZeroProducts:null,isReady:!0};if(s?.isLoading||s?.isFetching)return{hasZeroProducts:null,isReady:!1};if(s?.isError)return{hasZeroProducts:null,isReady:!0};const a=ab(s?.data);return{hasZeroProducts:typeof a=="number"?a===0:null,isReady:!0}},Mr=typeof import.meta<"u"&&"https://cdn.packman.ai"||"",Na=e=>{if(!e||!Mr)return"";const n=Mr.endsWith("/")?Mr.slice(0,-1):Mr,r=e.startsWith("/")?e.slice(1):e;return`${n}/${r}`},ib=e=>{const n=e?.response?.data?.message,r=Array.isArray(n)?n.join(", "):n;if(typeof r!="string"||!r.includes("restricted_product_image"))return null;const a=(typeof window<"u"&&localStorage.getItem("language")||"en").toLowerCase().startsWith("ar"),o=e?.response?.data?.data?.categoryLabels,d=o?(a?o.ar:o.en)||o.en:null,u=new Error(d?a?`تم رصد هذه الصورة ضمن فئة: ${d}، وهي غير مسموح ببيعها عبر الإنترنت على منصتنا. لا يمكن استخدامها. اختر صورة منتج أخرى.`:`This image was flagged as: ${d}, a product type that isn't allowed to be sold online on our platform. It can't be used. Please choose a different product photo.`:a?"تعرض هذه الصورة منتجًا غير مسموح ببيعه عبر الإنترنت على منصتنا، لذلك لا يمكن استخدامها. اختر صورة منتج أخرى.":"This image shows a product that isn't allowed to be sold online on our platform, so it can't be used. Please choose a different product photo.");return u.code="restricted_product_image",u},cb=e=>{const n=e?.response?.data?.message,r=Array.isArray(n)?n.join(", "):n;if(typeof r!="string"||!r.includes("no_sellable_product_image"))return null;const a=(typeof window<"u"&&localStorage.getItem("language")||"en").toLowerCase().startsWith("ar"),o=new Error(a?"هذه الصورة لا تعرض منتجاً واضحاً للبيع. يرجى اختيار صورة واضحة للمنتج الذي تريد بيعه.":"This image does not show a clear product to sell. Please choose a clear photo of the product you want to sell.");return o.code="no_sellable_product_image",o},mo=async(e,{storeId:n,systemCountry:r})=>{if(!e)throw new Error("uploadChatAttachment: file is required");if(!n)throw new Error("uploadChatAttachment: storeId is required");const s=(r||"ae").toString().toLowerCase(),a=Sr(),o=new FormData;o.append("file",e),o.append("storeId",String(n)),o.append("mediaType","image"),o.append("sourceType","AI_IMAGE_ANALYSIS"),o.append("moderate","sync");let d;try{d=await a.post(`/${s}/files/upload-media`,o)}catch(f){throw cb(f)??ib(f)??f}const u=d?.data?.data??d?.data??{},l=u?.file??u?.data?.file??{},i=l?.id,g=l?.data??{},y=g.key||"",p=l?.cdnUrl||Na(y);if(!p)throw new Error("upload-media returned no url");return{url:p,fileId:i?String(i):void 0,key:y,name:g.filename||e.name,mimeType:g.mimeType||e.type||"image/jpeg",size:g.size||e.size||0,file:l}},cd=e=>{if(!e)throw new Error("libraryItemToChatAttachment: item is required");const n=e.file??null,r=n?.data??{},s=n?.id??e.fileId??e.id,a=e.key||r.key||n?.key||"",o=e.url||r.url||n?.url||n?.cdnUrl||"",d=o?o.startsWith("http")?o:Na(o):Na(a);
728if(!d)throw new Error("libraryItemToChatAttachment: no url/key on library item");return{url:d,fileId:s?String(s):void 0,key:a,name:r.filename||e.name||`library-${e.id||"image"}`,mimeType:r.mimeType||e.mimeType||"image/jpeg",size:r.size||e.size||0,file:n}},ld=(e,{sortOrder:n=0}={})=>({fileId:e.fileId,mediaType:"image",sortOrder:n,url:e.url,key:e.key,name:e.name,size:e.size,mimeType:e.mimeType,file:e.file}),lb="packman-ai-product-draft:start",VI="smart-studio:product-created",FI=(e,{returnPath:n}={})=>{typeof window>"u"||!e?.url||window.dispatchEvent(new CustomEvent(lb,{detail:{imageUrls:[e.url],mediaFiles:[ld(e)],...n?{returnPath:n}:{}}}))},db=10*1024*1024,dd=["image/png","image/jpeg","image/jpg","image/webp","image/gif"],ud=[".png",".jpg",".jpeg",".webp",".gif"],ub=dd.concat(ud).join(","),pb=e=>{if(!e)return!1;const n=(e.type||"").toLowerCase();if(n&&dd.includes(n))return!0;const r=(e.name||"").toLowerCase(),s=r.lastIndexOf(".");if(s===-1)return!1;const a=r.slice(s);return ud.includes(a)};function mb({isOpen:e,onClose:n,onSubmit:r,mode:s="analyze"}){const a=yt(),o=wt(),d=ae(O=>O.language)||"en",u=d==="ar",l=s==="attach",i=s==="logo",g=l||i,y=ae(O=>O.store?.selectedStore),p=ae(O=>O.store?.selectedStoreDetails),f=p?.data||p||y,x=f?.id,v=(f?.systemCountry?.code||"ae").toString().toLowerCase(),{hasZeroProducts:S}=id({storeId:x,systemCountry:v,enabled:!!(e&&x&&!g)}),{data:_}=gm(x,"ai_product_draft",{enabled:!!(e&&x&&!g)}),w=_?.data?.data||_?.data||null,C=S===!0,k=Number(w?.requiredCredits??0),L=Number(w?.currentBalance??0),A=g||C||!!w?.hasSufficientBalance,E=!g&&!C&&!!w&&!w.hasSufficientBalance&&k>0,j=!g&&!C&&Number.isFinite(k)&&k>0,H=c.useCallback(()=>{fs(o,"/dashboard/wallet/add-credits"),n?.()},[o,n]),[D,$]=c.useState(null),[re,pe]=c.useState(null),[te,R]=c.useState(""),[B,U]=c.useState(!1),[K,ee]=c.useState(!1),[he,fe]=c.useState(null),[ie,me]=c.useState(!1),Re=c.useRef(0),[ke,oe]=c.useState(!1),se=c.useRef(null),de=c.useRef(0),[Ne,ue]=c.useState(!1),[ve,Ve]=c.useState(null),[Te,Ge]=c.useState({page:1,pageSize:20,search:"",mediaType:"image",sourceType:""}),[Be,et]=c.useState("");c.useEffect(()=>{const O=setTimeout(()=>et(Te.search),300);return()=>clearTimeout(O)},[Te.search]);const{data:ge,isLoading:X}=hm(x,{page:Te.page,pageSize:Te.pageSize,search:Be,mediaType:Te.mediaType,sourceType:Te.sourceType},{enabled:!!(e&&x)}),Ce=c.useMemo(()=>{const O=ge?.data,ce=O?.data||O?.result||(Array.isArray(O)?O:[]);return Array.isArray(ce)?ce:[]},[ge]),xe=ge?.data?.pagination||ge?.pagination||void 0;c.useEffect(()=>{e||($(null),pe(O=>(O&&URL.revokeObjectURL(O),null)),R(""),U(!1),ee(!1),fe(null),me(!1),Re.current+=1,oe(!1),ue(!1),Ve(null),Ge(O=>({...O,page:1,search:"",sourceType:""})),et(""),de.current=0)},[e]),c.useEffect(()=>()=>{re&&URL.revokeObjectURL(re)},[re]);const dt=c.useCallback(async O=>{if(!O)return;if(!pb(O)){R(a.t_chat_attach_unsupported_format||"Unsupported format. Please upload a PNG, JPG, WebP, or GIF image.");return}if(O.size>db){R(a.t_chat_attach_too_large||"Image must be smaller than 10 MB.");return}if(R(""),Ve(null),fe(null),pe(Me=>(Me&&URL.revokeObjectURL(Me),URL.createObjectURL(O))),$(O),!x){R(u?"يرجى اختيار متجر قبل رفع صورة المنتج.":"Select a store before uploading a product photo."),$(null),pe(Me=>(Me&&URL.revokeObjectURL(Me),null));return}const ce=Re.current+=1;me(!0);try{const Me=await mo(O,{storeId:x,systemCountry:v});if(Re.current!==ce)return;fe(Me)}catch(Me){if(Re.current!==ce)return;fe(null),R(Me?.message||a.t_chat_generation_failed||(u?"تعذّر رفع الصورة. حاول مرة أخرى.":"Couldn't upload that photo. Please try again."))}finally{Re.current===ce&&me(!1)}},[a.t_chat_attach_unsupported_format,a.t_chat_attach_too_large,a.t_chat_generation_failed,x,v,u]),Gt=c.useCallback(O=>{const ce=O?.target?.files?.[0];ce&&dt(ce),se.current&&(se.current.value="")},[dt]),st=c.useCallback(()=>{se.current&&se.current.click()},[]),ft=O=>{const ce=O?.dataTransfer?.types;return ce?Array.from(ce).includes("Files"):!1},Z=c.useCallback(O=>{ft(O)&&(O.preventDefault(),de.current+=1,U(!0))},[]),M=c.useCallback(O=>{ft(O)&&(O.preventDefault(),O.dataTransfer&&(O.dataTransfer.dropEffect="copy"))},[]),Se=c.useCallback(O=>{ft(O)&&(O.preventDefault(),de.current=Math.max(0,de.current-1),de.current===0&&U(!1))},[]),G=c.useCallback(O=>{if(!ft(O))return;O.preventDefault(),de.current=0,U(!1);const ce=O.dataTransfer?.files?.[0];ce&&dt(ce)},[dt]),Ee=c.useCallback(()=>{R(""),ue(!0)},[]),Q=c.useCallback(O=>{if(!O)return"";const ce=O.url||O.file?.data?.url||O.file?.url||O.file?.cdnUrl||"",Me=O.key||O.file?.data?.key||O.file?.key||"";return ce?ce.startsWith("http")?ce:`${Hn}/${ce}`:Me?`${Hn}/${Me}`:""},[]),we=c.useCallback(O=>{const ce=Array.isArray(O)?O[0]:O;if(!ce)return;const Me=Q(ce);if(!Me){R(a.t_chat_upload_library_missing_url||(u?"تعذّر الوصول إلى هذه الصورة في المكتبة.":"Couldn't read that library image."));return}R(""),pe(nt=>(nt&&URL.revokeObjectURL(nt),null)),$(null),fe(null),me(!1),Re.current+=1,Ve({...ce,__resolvedUrl:Me}),ue(!1)},[Q,u,a.t_chat_upload_library_missing_url]),Oe=!!D||!!ve,Ye=!!he||!!ve,tt=re||ve?.__resolvedUrl||"",Ze=c.useCallback(async()=>
728{if(!(!Ye||K)){ee(!0),R("");try{await r?.(D,{libraryItem:ve,attachment:he}),oe(!1),n?.()}catch(O){ee(!1),R(O?.message||a.t_chat_generation_failed||"Something went wrong. Please try again.")}}},[D,ve,he,Ye,K,r,n,a.t_chat_generation_failed]),Ae=c.useCallback(()=>{if(!(!Ye||K||ie)&&A){if(R(""),g||C){Ze();return}oe(!0)}},[Ye,K,ie,A,g,C,Ze]),ut=c.useCallback(()=>{Ze()},[Ze]),ze=c.useCallback(()=>{K||oe(!1)},[K]),Qe=c.useCallback(()=>{$(null),Ve(null),fe(null),me(!1),Re.current+=1,pe(O=>(O&&URL.revokeObjectURL(O),null)),R(""),st()},[st]);if(typeof document>"u")return null;const nn=i?a.t_chat_upload_logo_title||(u?"ارفع شعار متجرك":"Upload your store logo"):a.t_chat_upload_modal_title||(u?"أضف صورة المنتج":"Add your product photo"),xn=i?a.t_chat_upload_logo_subtitle||(u?"ستصبح هذه الصورة شعار متجرك. بدون مسودة منتج وبدون نقاط.":"This image becomes your store logo. No product draft, no credits."):l?u?"ستُضاف هذه الصورة إلى منتجك. بدون تحليل وبدون أي نقاط.":"This photo will be added to your product. No analysis, no credits.":a.t_chat_upload_modal_subtitle||(u?"سأستخرج لك العنوان والوصف والتصنيف والسعر المقترح تلقائياً.":"I'll draft the title, description, category, and a suggested price automatically."),_n=a.t_chat_upload_modal_drop_hint||(u?"اسحب وأفلت الصورة هنا":"Drag and drop your photo here"),Bt=a.t_chat_upload_modal_or||(u?"أو":"or"),Ot=a.t_chat_upload_modal_browse||(u?"اختر من جهازك":"Browse your device"),ir=a.t_chat_upload_modal_limit||(u?"PNG أو JPG أو WebP، حتى 10 ميجابايت":"PNG, JPG, or WebP up to 10 MB"),Dt=a.t_chat_upload_modal_library||(u?"اختر من مكتبتك":"Pick from library"),pt=i?K?a.t_chat_upload_logo_submitting||(u?"جارٍ تجهيز الشعار…":"Preparing your logo…"):a.t_chat_upload_logo_confirm||(u?"استخدم هذا الشعار":"Use this logo"):l?K?u?"جارٍ الإضافة...":"Adding photo…":u?"إضافة الصورة":"Add photo":K?a.t_chat_upload_modal_submitting||(u?"جارٍ تحضير المسودة...":"Drafting your product…"):a.t_chat_upload_modal_confirm||(u?"ابدأ التحليل":"Use this photo"),$n=u?"جارٍ فحص الصورة...":"Checking photo…",qt=u?k===1?"نقطة":"نقاط":k===1?"credit":"credits",wn=u?L===1?"نقطة":"نقاط":L===1?"credit":"credits",Y=u?`سيستخدم تحليل هذه الصورة ${k===1?"نقطة واحدة":`${k} ${qt}`}`:`This analysis will use ${k} ${qt}`,ye=u?"نحجز الرصيد قبل البدء ونخصمه فقط عند نجاح المسودة.":"We hold the credit before we start and only charge it if the draft completes.",be=u?`${L} ${wn}`:`${L} ${wn}`,le=u?"الرصيد":"Balance",_e=u?"الرصيد غير كافٍ":"Not enough credits",Fe=u?`تحتاج ${k} ${qt} لتحليل هذه الصورة، لديك ${L} فقط.`:`You need ${k} ${qt} to analyze this photo — you have ${L}.`,h=u?"شراء رصيد":"Buy credits",P=a.t_chat_upload_modal_replace||(u?"اختر صورة أخرى":"Choose a different photo"),F=a.t_cancel||(u?"إلغاء":"Cancel"),W=t.jsx(Fa,{children:e&&t.jsxs(At.div,{className:`fixed inset-0 z-[110] flex items-center justify-center px-4 transition-opacity duration-150 ${Ne||ke?"opacity-0 pointer-events-none":"opacity-100"}`,"aria-hidden":Ne||ke?"true":void 0,role:"dialog","aria-modal":"true",dir:u?"rtl":"ltr",children:[t.jsx(At.div,{initial:{opacity:0}
728,animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},className:"absolute inset-0 bg-slate-950/60 backdrop-blur-md",onClick:n,"aria-hidden":"true"}),t.jsxs(At.div,{initial:{opacity:0,scale:.96,y:16},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.97,y:8},transition:{type:"spring",stiffness:260,damping:26},className:"relative w-full max-w-[560px] rounded-3xl bg-white shadow-[0_30px_80px_-20px_rgba(17,24,39,0.4)] ring-1 ring-black/5 overflow-hidden",children:[t.jsx("button",{type:"button",onClick:n,"aria-label":F,className:`absolute top-3 ${u?"left-3":"right-3"} h-8 w-8 rounded-full bg-white/80 hover:bg-gray-100 text-gray-500 flex items-center justify-center transition-colors z-10`,children:t.jsx(Ft,{className:"h-4 w-4"})}),t.jsx("div",{className:"px-6 pt-6 pb-3",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-8 w-8 rounded-xl bg-gradient-to-br from-brand-secondary to-fuchsia-500 text-white flex items-center justify-center shadow-sm",children:t.jsx(zt,{className:"h-4 w-4"})}),t.jsxs("div",{children:[t.jsx("h2",{id:"chat-upload-modal-title",className:"text-[15px] font-semibold text-gray-900 leading-tight",children:nn}),t.jsx("p",{className:"text-[12px] text-gray-500 leading-snug",children:xn})]})]})}),j&&t.jsxs("div",{className:"px-6 pb-3",children:[E?t.jsxs("div",{className:"flex items-start gap-2.5 rounded-xl border border-red-200 bg-gradient-to-r from-red-50 to-rose-50/70 px-3 py-2.5",children:[t.jsx("span",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-red-500/15 text-red-600",children:t.jsx(Ga,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-[12px] font-semibold text-red-800 leading-tight",children:_e}),t.jsx("p",{className:"text-[11px] text-red-700/80 leading-snug mt-0.5",children:Fe}),t.jsxs("button",{type:"button",onClick:H,className:"mt-1.5 inline-flex items-center gap-1 rounded-full bg-red-600 hover:bg-red-700 px-2.5 py-1 text-[11px] font-semibold text-white transition-colors",children:[t.jsx(ra,{className:"h-3 w-3","aria-hidden":"true"}),h]})]})]}):t.jsxs("div",{className:"flex items-start gap-2.5 rounded-xl border border-amber-200 bg-gradient-to-r from-amber-50 to-orange-50/70 px-3 py-2.5",children:[t.jsx("span",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-amber-500/15 text-amber-600",children:t.jsx(Ao,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-[12px] font-semibold text-amber-900 leading-tight",children:Y}),t.jsx("p",{className:"text-[11px] text-amber-700/80 leading-snug mt-0.5",children:ye})]})]}),w&&!E&&t.jsx("div",{className:`mt-2 flex items-center ${u?"justify-start":"justify-end"}`,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-white ring-1 ring-gray-200 shadow-sm px-2.5 py-1 text-[11px] font-semibold text-gray-800 tabular-nums",children:[t.jsx(ra,{className:"h-3 w-3 text-gray-500","aria-hidden":"true"}),t.jsx("span",{className:"text-gray-500 font-medium",children:le}),t.jsx("span",{children:be})]})})]}),t.jsxs("div",{className:"px-6 pb-2",children:[t.jsx("input",{ref:se,type:"file",accept:ub,className:"hidden",onChange:Gt}),Oe?t.jsxs("div",{className:"rounded-2xl overflow-hidden ring-1 ring-gray-200 bg-gray-50",children:[t.jsxs("div",{className:"relative w-full h-56 bg-gradient-to-b from-gray-100 to-gray-50 flex items-center justify-center",children:[t.jsx("img",{src:re||ve?.__resolvedUrl,alt:D?.name||ve?.name||"Selected photo",className:"max-w-full max-h-full object-contain"}),ie&&t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 bg-white/70 backdrop-blur-sm",children:[t.jsx(St,{className:"h-6 w-6 animate-spin text-brand-secondary"}),t.jsx("p",{className:"text-[12px] font-medium text-gray-700",children:u?"جارٍ فحص الصورة...":"Checking photo…"})]})]}),t.jsxs("div",{className:"px-4 py-2.5 flex items-center justify-between gap-3 border-t border-gray-100",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-[12px] font-medium text-gray-900 truncate",children:D?.name||ve?.file?.data?.f
728ilename||ve?.name||Dt}),t.jsx("p",{className:"text-[10px] text-gray-500",children:D?`${(D.size/1024/1024).toFixed(2)} MB`:ve?.file?.data?.size?`${(ve.file.data.size/1024/1024).toFixed(2)} MB`:Dt})]}),t.jsxs("button",{type:"button",onClick:Qe,disabled:K,className:"shrink-0 inline-flex items-center gap-1.5 text-[12px] font-semibold text-brand-secondary bg-brand-secondary/10 hover:bg-brand-secondary/15 hover:text-fuchsia-600 rounded-full px-3 py-1.5 transition-colors disabled:opacity-40",children:[t.jsx(No,{className:"h-3.5 w-3.5"}),P]})]})]}):t.jsxs("div",{role:"button",tabIndex:0,onClick:st,onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),st())},onDragEnter:Z,onDragOver:M,onDragLeave:Se,onDrop:G,className:`w-full rounded-2xl border-2 border-dashed transition-all flex flex-col items-center justify-center gap-3 py-10 px-6 cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/40 ${B?"border-brand-secondary bg-brand-secondary/5":"border-gray-200 hover:border-brand-secondary/50 hover:bg-gray-50"}`,children:[t.jsx("div",{className:`h-14 w-14 rounded-2xl flex items-center justify-center transition-all ${B?"bg-brand-secondary text-white scale-110":"bg-gradient-to-br from-brand-secondary/10 to-fuchsia-500/10 text-brand-secondary"}`,children:t.jsx(No,{className:"h-7 w-7"})}),t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-[14px] font-semibold text-gray-900",children:_n}),t.jsxs("p",{className:"text-[11px] text-gray-400 mt-0.5",children:[Bt," ",t.jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),st()},className:"text-brand-secondary font-medium hover:underline focus:outline-none focus-visible:underline",children:Ot})]})]}),t.jsx("div",{className:"flex items-center gap-2",onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation(),children:t.jsxs("button",{type:"button",onClick:Ee,className:"inline-flex items-center gap-1.5 rounded-full bg-white ring-1 ring-gray-200 shadow-sm px-3 py-1.5 text-[12px] font-semibold text-gray-700 hover:text-brand-secondary hover:ring-brand-secondary/40 hover:bg-brand-secondary/5 transition-colors",children:[t.jsx(ep,{className:"h-3.5 w-3.5","aria-hidden":"true"}),Dt]})}),t.jsx("p",{className:"text-[11px] text-gray-400",children:ir})]}),te&&t.jsx("p",{className:"mt-2 text-[11px] text-red-500 leading-snug",children:te})]}),t.jsxs("div",{className:"px-6 pt-4 pb-6 flex items-center justify-between gap-3",children:[t.jsx("button",{type:"button",onClick:n,disabled:K,className:"text-[13px] h-10 px-4 rounded-xl text-gray-600 hover:bg-gray-100 font-medium transition-colors disabled:opacity-40",children:F}),t.jsxs("button",{type:"button",onClick:Ae,disabled:!Ye||K||ie||!A,className:`text-[13px] h-10 px-5 rounded-xl font-semibold flex items-center gap-2 transition-all shadow-sm ${Ye&&!K&&!ie&&A?"bg-gray-900 text-white hover:bg-gray-800 hover:shadow":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,title:E?Fe:void 0,children:[(K||ie)&&t.jsx(St,{className:"h-3.5 w-3.5 animate-spin"}),t.jsx("span",{children:ie?$n:pt}),!K&&!ie&&!g&&!C&&k>0&&t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold tabular-nums ${Ye&&A?"bg-white/15 ring-1 ring-white/25 text-white":"bg-gray-200 ring-1 ring-gray-300 text-gray-500"}`,children:[t.jsx(Ao,{className:"h-3 w-3","aria-hidden":"true"}),k," ",qt]})]})]})]})]},"chat-upload-modal")}),V=u?"مسودة منتج بالذكاء الاصطناعي":"AI product draft",ne=u?"تأكيد إنشاء المسودة":"Confirm product draft",z=u?"سنخصم النقطة بعد اكتمال تحليل الصورة بنجاح.":"We'll deduct your credit once the photo analysis completes successfully.",J=u?"إنشاء المسودة":"Generate draft";return t.jsxs(t.Fragment,{children:[Kr.createPortal(W,document.body),Kr.createPortal(t.jsx(Jm,{open:ke,onCancel:ze,onConfirm:ut,onAddCredits:H,isRTL:u,isSubmitting:K,isFree:C,cost:k,currentBalance:L,previewUrl:tt,title:ne,description:z,itemLabel:V,confirmLabel:J}),document.body),Kr.createPortal(t.jsx(Zm,{open:Ne,onOpenChange:ue,onSelect:we,media:Ce,isLoading:X,pagination:xe,onPageChange:O=>Ge(ce=>({...ce,page:O})),onSearchChange:O=>Ge(ce=>({...ce,search:O,page:1})),onMediaTypeChange:O=>Ge(ce=>({...ce,mediaType:O||"image",page:1})),onSourceTypeChange:O=>Ge(ce=>({...ce,sourceType:O||"",page:1}
728)),allowedTypes:["image"],multiple:!1,language:d,t:a,baseResourceUrl:Hn,contentClassName:"z-[120]",overlayClassName:"z-[120]"}),document.body)]})}const pd=c.memo(mb);bt("categories","categories",{listOptions:{staleTime:1*60*1e3,refetchOnWindowFocus:!0},detailOptions:{staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,enabled:!0}});const Fs=Er("categories"),ar={...Fs,allCategories:()=>[...Fs.all,"allCategories"],storeCategories:e=>[...Fs.all,"storeCategories",e]},Yt=()=>{try{const e=ae.getState?.()?.systemCountry;return e?String(e).toLowerCase():"ae"}catch(e){return console.warn("Failed to access store state for system country",e),"ae"}},Gn={getStoreCategories:e=>{const n=Yt(),r=new URLSearchParams(e).toString();return q("GET",`${n}/categories/store?${r}`)(null,null)},getAllCategories:e=>{const n=Yt(),r=new URLSearchParams(e).toString();return q("GET",`${n}/categories?${r}`)(null,null)},getCategoryById:e=>{const n=Yt();return q("GET",`${n}/categories/${e}`)(null,null)},createCategory:({body:e})=>{const n=Yt();return q("POST",`${n}/categories`)(null,e)},updateCategory:({params:e,body:n})=>{const r=Yt();return q("PATCH",`${r}/categories/${e.id}`)(null,n)},deleteCategory:({params:e})=>{const n=Yt();return q("DELETE",`${n}/categories/${e.id}`)(null,null)},generateCategoryContent:e=>{const n=Yt();return q("POST",`${n}/categories/generate-content`)(null,e)}},gb=({params:e={},...n})=>{const{isAuthenticated:r}=qe(),s=Yt();return $e({queryKey:[...ar.storeCategories(e.storeId),s,e],queryFn:async()=>{try{const{data:a}=await Gn.getStoreCategories(e);return a}catch(a){throw console.error("Error fetching store categories:",a),a}},enabled:r&&!!e.storeId,staleTime:5*60*1e3,...n})},hb=({params:e={},...n})=>{const{isAuthenticated:r}=qe(),s=Yt();return $e({queryKey:[...ar.allCategories(),s,e],queryFn:async()=>{try{const{data:a}=await Gn.getAllCategories(e);return a}catch(a){throw console.error("Error fetching categories:",a),a}},enabled:r,staleTime:2*60*1e3,...n})},fb=(e,n={})=>{const{isAuthenticated:r}=qe(),s=Yt();return $e({queryKey:[...ar.detail(e),s],queryFn:async()=>{try{const{data:a}=await Gn.getCategoryById(e);return a}catch(a){throw console.error("Error fetching category:",a),a}},enabled:r&&!!e,staleTime:5*60*1e3,...n})},yb=(e={})=>{const n=Ie();return Ue({mutationFn:async({body:r})=>{try{const{data:s}=await Gn.createCategory({body:r});return s}catch(s){throw console.error("Error creating category:",s),s}},onSuccess:()=>{n.invalidateQueries({queryKey:ar.all})},...e})},bb=(e={})=>{const n=Ie();return Ue({mutationFn:async({params:r,body:s})=>{try{const{data:a}=await Gn.updateCategory({params:r,body:s});return a}catch(a){throw console.error("Error updating category:",a),a}},onSuccess:()=>{n.invalidateQueries({queryKey:ar.all})},...e})},xb=(e={})=>{const n=Ie();return Ue({mutationFn:async({params:r})=>{try{const{data:s}=await Gn.deleteCategory({params:r});return s}catch(s){throw console.error("Error deleting category:",s),s}},onSuccess:()=>{n.invalidateQueries({queryKey:ar.all})},...e})},_b=(e={})=>Ue({mutationFn:async n=>{try{const{data:r}=await Gn.generateCategoryContent(n);return r}catch(r){throw console.error("Error generating category content:",r),r}},...e}),bi={hooks:{useAllCategories:hb,useStoreCategories:gb,useCategory:fb,useCreateCategory:yb,useUpdateCategory:bb,useDeleteCategory:xb,useGenerateCategoryContent:_b}},Pe={PROVIDE_VALUE:"provide_value",CONFIRM_YES:"confirm_yes",CONFIRM_NO:"confirm_no",CORRECT_VALUE:"correct_value",SKIP_OPTIONAL:"skip_optional",GO_NEXT:"go_next",GO_BACK:"go_back",REQUEST_REPEAT:"request_repeat",SELECT_OPTION:"select_option",UNKNOWN:"unknown"},wb=new Set(Object.values(Pe));function Ht(e){const n=wb.has(e?.intent)?e.intent:Pe.UNKNOWN,r=typeof e?.confidence=="number"?Math.max(0,Math.min(1,e.confidence)):n===Pe.UNKNOWN?.2:.7;return{intent:n,fields:e?.fields&&typeof e.fields=="object"?e.fields:{},confidence:r,ask:typeof e?.ask=="string"?e.ask:"",language:typeof e?.language=="string"?e.language:"unknown"}}function vb(e,{workflow:n,state:r}={}){const s=String(e||"").trim(),a=Sb(s);return s?/^(yes|yeah|yep|sure|ok|okay|تمام|نعم|أجل|اجل)$/i.test(s)?Ht({intent:Pe.CONFIRM_YES,confidence:.9}):/^(no|nope|لا|كلا)$/i.test(s)?Ht({intent:Pe.CONFIRM_NO,confidence:.9}):/^(next|continue|skip|done|go ahead|التالي|متابعة|تخطي|تخطى)$/i.test(s)?Ht({intent:Pe.GO_NEXT,confidence:.9}):/^(back|previous|go back|رجوع|السابق|ارجع)$/i.test(s)?Ht({intent:Pe.GO_BACK,confidence:.9}):/(repeat|say again|read again|again|كرر|أعد|اعد|مرة أخرى)/i.test(s)?Ht({intent:Pe.REQUEST_REPEAT,confidence:.9}):/(wrong|incorrect|not correct|not right|change|try again|غلط|خطأ|غير صحيح|مو صحيح|غير|غيّر)/i.test(s)?Ht({intent:Pe.CORRECT_VALUE,confidence:.75}):Ht(n==="create_product"&&r==="price"&&a!==null?{intent:Pe.PROVIDE_VALUE,fields:{price:a},confidence:.85}:{intent:Pe.PROVIDE_VALUE,fields:{text:s,value:s,name:s},confidence:.6}):Ht({intent:Pe.UNKNOWN,confidence:0})}async function Eb({transcript:e,workflow:n,state:r,draft:s,context:a,storeId:o,locale:d}){const u=vb(e,{workflow:n,state:r});try{if(!o)return u;const l=await Mt.interpretDialogueTurn({transcript:e,workflow:n,state:r,draft:s,context:a,storeId:o,locale:d});return Ht(l||u)}catch{return u}}function Sb(e){const r=String(e||"").replace(/[\u0660-\u0669]/g,a=>
728String(a.charCodeAt(0)-1632)).replace(/[\u06F0-\u06F9]/g,a=>String(a.charCodeAt(0)-1776)).replace(/,/g,"").match(/\d+(?:\.\d+)?/);if(!r)return null;const s=Number(r[0]);return Number.isFinite(s)?s:null}const xi=8,_i=2,zs=50,vt=(...e)=>e.filter(Boolean).join(" "),Pn=e=>/(colou?r|لون|ألوان|الوان)/i.test(String(e||"")),go=e=>/(sizes?|مقاس|مقاسات|قياس|قياسات)/i.test(String(e||"")),vs=e=>{const n=String(e||"").trim();return n?Pn(n)?"Colors":go(n)?"Sizes":n:""},ka=e=>{const n=vs(e?.name),r=String(e?.nameAr||"").trim();return{...e,name:n,nameAr:r||(Pn(n)?"الألوان":go(n)?"المقاسات":"")}},md=[{name:"Black",hex:"#000000"},{name:"White",hex:"#FFFFFF"},{name:"Grey",hex:"#808080"},{name:"Navy",hex:"#001F5B"},{name:"Red",hex:"#E11D48"},{name:"Blue",hex:"#2563EB"},{name:"Green",hex:"#16A34A"},{name:"Beige",hex:"#E8DCC4"},{name:"Yellow",hex:"#FACC15"},{name:"Orange",hex:"#F97316"},{name:"Purple",hex:"#7C3AED"},{name:"Pink",hex:"#EC4899"},{name:"Brown",hex:"#92400E"},{name:"Gold",hex:"#D4AF37"},{name:"Silver",hex:"#C0C0C0"}],Ab=md.reduce((e,n)=>(e[n.name.toLowerCase()]=n.hex,e),{}),Qn=e=>Ab[String(e||"").trim().toLowerCase()]||"#9CA3AF",gd=e=>e?Array.isArray(e)?e:Array.isArray(e.data)?e.data:Array.isArray(e.items)?e.items:Array.isArray(e.result)?e.result:e.data?gd(e.data):null:null,ht=e=>{if(e==null||e==="")return;const n=Number(e);return Number.isFinite(n)?n:void 0},Vt=e=>{let n=String(e||"").trim();if(!n)return n;n=n.replace(/^["'“”«]+|["'“”»]+$/g,"").trim();const r=n.split(/(?<=[.!?؟])\s|[\n\r]| - | \u2013 /)[0].trim();r&&(n=r);const s=n.split(/\s+/);return s.length>10&&(n=s.slice(0,10).join(" ")),n.length>80&&(n=n.slice(0,80).trim()),n.replace(/[.,;:،]+$/g,"").trim()},Nb=e=>String(e||"").toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`category-${Date.now()}`,kb=e=>String(e||"").replace(/[\u0660-\u0669]/g,n=>String(n.charCodeAt(0)-1632)).replace(/[\u06F0-\u06F9]/g,n=>String(n.charCodeAt(0)-1776)),wi={zero:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90,hundred:100,thousand:1e3},yn=e=>{const n=kb(String(e||"").toLowerCase()),r=n.replace(/,/g,"").match(/\d+(?:\.\d+)?/);if(r)return r[0];const s=n.split(/[\s-]+/).filter(Boolean);let a=0,o=0,d=!1;for(const u of s){if(!(u in wi))continue;d=!0;const l=wi[u];l===100?o=(o||1)*100:l===1e3?(a+=(o||1)*1e3,o=0):o+=l}return d?String(a+o):""},Tb=e=>{const n=String(e||"").trim();if(!n)return null;const r=hd(n),s=yn(n);
728if(/(compare|compare-at|was price|old price|before discount|السعر قبل|قبل الخصم|سعر قبل)/i.test(r)&&s)return{field:"wasPrice",value:s};if(/(stock|quantity|inventory|المخزون|الكمية|كمية)/i.test(r)&&s)return{field:"stock",value:s.replace(/\.\d+$/,"")};if(/(selling price|main price|price|السعر|سعر البيع)/i.test(r)&&s)return{field:"price",value:s};const a=n.match(/["“”']([^"“”']{2,120})["“”']/)?.[1]?.trim(),o=n.match(/\b(?:to|as|be|into)\s+(.{2,120})$/i)?.[1]?.trim();return/(product name|name|اسم المنتج|الاسم)/i.test(r)?{field:kn(n)?"nameAr":"name",value:Vt(a||o||n)}:/(brand|علامة|براند)/i.test(r)?{field:"brand",value:Vt(a||o||n)}:null},hd=e=>String(e||"").trim().toLowerCase().replace(/[.!?،؟]+$/g,"").trim(),$t=/^(next|continue|skip|done|proceed|go ahead|go|ok|okay|التالي|التالى|متابعة|تابع|تخطي|تخطى)$/i,Cb=/^(back|previous|go back|رجوع|السابق|ارجع)$/i,jb=/^(create|create it|create product|confirm|submit|yes|finish|أنشئ|إنشاء|انشئ|تأكيد|نعم|إنهاء)$/i,Gr=/^(yes|yeah|yep|sure|ok|okay|please|improve|do it|go ahead|نعم|أجل|اجل|تمام|حسنا|حسناً)$/i,Ut=/^(no|nope|keep it|leave it|skip|no thanks|لا|اتركه|تخطي|تخطى)$/i,vi=/(wrong|incorrect|not correct|not right|bad|change|repeat|try again|say again|misheard|ما فهمت|خطأ|غلط|غير صحيح|مو صحيح|كرر|أعد|اعد|غيّر|غير)/i,Ib=/(write it|write this|generate|regenerate|suggest|with ai|by ai|using ai|اكتب|ولّد|ولد|اقترح|بالذكاء)/i,Ei=/^(skip all|skip details|continue without|تخطي الكل|تخطى الكل)$/i,Rb=/(variation|variant|size|colou?r|option|تنويع|مقاس|لون|الوان|خيار)/i,Pb=/(single|one item|simple|no variation|just one|منتج واحد|واحد|بسيط|بدون تنويع)/i,kn=e=>/[\u0600-\u06FF]/.test(String(e||"")),Ob=e=>/[A-Za-z]/.test(String(e||"")),Sn=e=>Object.keys(e||{}).sort().map(n=>`${n}=${String(e[n]).trim().toLowerCase()}`).join("&"),Si=(e,n)=>{const r={};for(const s of e||[]){const a=vs(s.name);if(!a||!Pn(a))continue;const o=n[a];if(o===void 0)continue;const d=s.valueHex?.[o]||Qn(o);r[a]=d}return r},Ai=e=>{const n={};return Object.entries(e||{}).forEach(([r,s])=>{const a=vs(r);a&&(n[a]=s)}),n},Db=e=>{const n=(e||[]).map(ka).filter(s=>s.name.trim()&&s.values.some(a=>a.trim()));if(n.length===0)return[];let r=[{}];for(const s of n){const a=s.values.map(d=>d.trim()).filter(Boolean),o=[];for(const d of r){for(const u of a)if(o.push({...d,[s.name.trim()]:u}),o.length>=zs)break;if(o.length>=zs)break}if(r=o,r.length>=zs)break}return r},Ni=()=>({name:"",nameAr:"",type:"simple",price:"",wasPrice:"",stock:"",description:"",descriptionAr:"",brand:"",categorySlugs:[],images:[],axes:[{name:"",nameAr:"",values:[""],valueHex:{}}],combos:[],weight:"",length:"",width:"",height:"",seoTitle:"",seoTitleAr:"",seoDescription:"",seoDescriptionAr:"",seoKeywords:"",seoKeywordsAr:""});
728function Lb({open:e,onClose:n,onComplete:r,storeId:s,systemCountry:a,language:o="en",initialName:d="",initialVoiceMode:u=!1}){const l=o==="ar",i=c.useCallback((h,P)=>l?P:h,[l]),[g,y]=c.useState("name"),[p,f]=c.useState(Ni),[x,v]=c.useState(""),[S,_]=c.useState(!1),[w,C]=c.useState(!1),[k,L]=c.useState(""),[A,E]=c.useState(!1),[j,H]=c.useState(""),[D,$]=c.useState(""),[re,pe]=c.useState({}),[te,R]=c.useState(!1),[B,U]=c.useState(""),[K,ee]=c.useState(null),[he,fe]=c.useState(null),[ie,me]=c.useState(""),Re=fm(),ke=bi.hooks.useCreateCategory(),oe=lo(),se=c.useRef(oe);se.current=oe;const de=c.useRef(oe.speak);de.current=oe.speak;const Ne=c.useRef(oe.stop);Ne.current=oe.stop;const ue=c.useRef(null),ve=c.useRef("name");ve.current=g;const Ve=c.useRef({armed:!1,sawSpeaking:!1,fallback:null}),Te=c.useRef(!1),Ge=c.useCallback(()=>{const h=Ve.current;h.armed=!1,h.sawSpeaking=!1,h.fallback&&(clearTimeout(h.fallback),h.fallback=null)},[]),Be=c.useCallback(()=>{const h=se.current;!h?.enabled||h.isRecording||h.isTranscribing||(h.clearCaptureError?.(),h.startRecording({autoStop:!0,silenceMs:1800,noSpeechMs:15e3,maxMs:35e3,sttLocale:"auto",bilingual:ve.current==="name",onTranscript:P=>{P&&ue.current?.(P)}}))},[]),et=c.useCallback(()=>{const h=Ve.current;h.fallback&&clearTimeout(h.fallback),h.armed=!0,h.sawSpeaking=!1,h.fallback=setTimeout(()=>{Ve.current.armed&&(Ge(),Be())},7e3)},[Ge,Be]),ge=c.useCallback(h=>{de.current?.(h),et()},[et]);c.useEffect(()=>{const h=Ve.current;oe.isSpeaking&&h.armed&&(h.sawSpeaking=!0),!oe.isSpeaking&&Te.current&&h.armed&&h.sawSpeaking&&(Ge(),Be()),Te.current=oe.isSpeaking},[oe.isSpeaking,Ge,Be]),c.useEffect(()=>{e||(y("name"),f(Ni()),v(""),_(!1),C(!1),L(""),E(!1),H(""),$(""),pe({}),R(!1),U(""),ee(null),fe(null),me(""),Ge(),se.current?.cancelRecording?.(),Ne.current?.())},[e,Ge]),c.useEffect(()=>{e&&u&&R(!0)},[e,u]),c.useEffect(()=>{if(e&&d&&d.trim()){const h=Vt(d);f(P=>P.name?P:{...P,name:h})}},[e,d]);const{data:X,isLoading:Ce}=bi.hooks.useAllCategories({params:{storeId:s,pageSize:200,active:!0},enabled:!!(e&&s)}),xe=c.useMemo(()=>(gd(X)||[]).map(P=>({slug:P?.slug||P?.categorySlug||"",name:P?.name||P?.title||P?.nameEn||""})).filter(P=>P.slug&&P.name),[X]),dt=c.useMemo(()=>{const h=k.trim().toLowerCase();return h?xe.filter(P=>P.name.toLowerCase().includes(h)):xe},[xe,k]),Gt=c.useMemo(()=>{const h=k.trim().toLowerCase();return h?xe.some(P=>P.name.trim().toLowerCase()===h):!1},[xe,k]),st=c.useMemo(()=>{const h=["name","photos","type"];return h.push(p.type==="variants"?"variants":"price"),h.push("category","details","seo","review"),h},[p.type]),ft=st.indexOf(g),Z=st.length,M=c.useCallback(h=>f(P=>({...P,...h})),[]),Se=c.useCallback(()=>{v(""),fe(null),ee(null),me("");const h=st.indexOf(g);h<st.length-1&&y(st[h+1])},[g,st]),G=c.useCallback(()=>{v(""),fe(null),ee(null),me("");const h=st.indexOf(g);h>0&&y(st[h-1])},[g,st]),Ee=c.useCallback(h=>{switch(h){case"name":return i("What's the product name? Say it out loud.","ما اسم المنتج؟ قله بصوتك.");case"photos":return i("Add product photos with the photo button. I'll wait while you upload.","أضف صور المنتج بزر الصورة. سأنتظر أثناء الرفع.");case"type":return i("Is this a single product, or does it have variations like size or color?","هل هذا منتج واحد، أم له تنويعات مثل المقاس أو اللون؟");case"price":return i("What's the selling price?","ما سعر البيع؟");case"variants":return i("Set up the variations below. Say next when you're done.","أعدّ التنويعات بالأسفل. قل التالي عند الانتهاء.");case"category":return i("Which category fits this product? Say a category name. If it is new, I can create it here.","ما الفئة المناسبة لهذا المنتج؟ قل اسم الفئة. إذا كانت جديدة يمكنني إنشاؤها هنا.");case"details":return i("Add a short description. Say it, or say write it for me.","أضف وصفاً قصيراً. قل الوصف، أو قل اكتبه لي.");case"seo":return i("Want a search title? Say it, or say skip.","هل تريد عنواناً للبحث؟ قله، أو قل تخطي.");case"review":return i("Here's the summary. Say create to add the product, or say back to edit.","هذا الملخص. قل إنشاء لإضافة المنتج، أو قل رجوع للتعديل.");default:return""}},[i]),Q=c.useCallback(h=>h==="name"?i("Got it. Want me to improve this name? Say yes or no.","تم. هل تريد أن أحسّن هذا الاسم؟ قل نعم أو لا."):i("Done. Want me to improve this? Say yes or no.","تم. هل تريد أن أحسّن هذا؟ قل نعم أو لا."),[i]),we=c.useCallback(h=>{const P=Vt(h);return P?i(`I heard "${P}". Is that correct? Say yes, or say the name again.`,`سمعت "${P}". هل هذا صحيح؟ قل نعم، أو قل الاسم مرة أخرى.`):i("I heard the name. Is that correct? Say yes, or say the name again.","سمعت الاسم. هل هذا صحيح؟ قل نعم، أو قل الاسم مرة أخرى.")},[i]),Oe=c.useCallback(()=>{const h=i("No problem. Say the product name again, slowly.","لا مشكلة. قل اسم المنتج مرة أخرى بوضوح.");ee("name_retry"),U(h),ge(h)},[ge,i]),Ye=c.useCallback(()=>{const h=he?.field?Q(he.field):K==="confirmName"?we(p.name||p.nameAr):K==="category_create"&&ie?i(`I couldn't find "${ie}". Create it as a new category? Say yes or no.`,`لم أجد "${ie}". هل أنشئها كفئة جديدة؟ قل نعم أو لا.`):B||Ee(g);h&&ge(h)},[p.name,p.nameAr,we,Q,he,ie,K,ge,Ee,g,B]),tt=c.useRef("");c.useEffect(()=>{if(!e||!te||!oe.enabled){tt.current="";return}if(tt.current===g)return;tt.current=g;const h=Ee(g);
728h&&(de.current?.(h),g!=="photos"&&et())},[e,te,g,oe.enabled,Ee,et]);const Ze=c.useCallback(()=>{U(""),fe(null),R(h=>(h&&(Ge(),se.current?.cancelRecording?.(),Ne.current?.()),!h))},[Ge]),Ae=c.useCallback(async(h,P)=>{if(!s)throw new Error("Select a store first.");const F=P?.libraryItem,W=P?.attachment?P.attachment:F?cd(F):await mo(h,{storeId:s,systemCountry:a});if(!W?.fileId)throw new Error("Upload did not return a file id.");if(f(V=>({...V,images:[...V.images,W].slice(0,xi)})),te&&se.current?.enabled&&ve.current==="photos"){ee("photos_more");const V=i("Photo added. Do you want to add another photo? Say yes to add another, or next to continue.","تمت إضافة الصورة. هل تريد إضافة صورة أخرى؟ قل نعم لإضافة أخرى، أو التالي للمتابعة.");U(V),ge(V)}},[s,a,ge,i,te]),ut=c.useCallback(h=>{f(P=>({...P,images:P.images.filter((F,W)=>W!==h)}))},[]),ze=c.useCallback(async(h,P=p)=>{if(re[h])return!1;v(""),pe(F=>({...F,[h]:!0}));try{const F={name:"product_name",description:"product_description",seoTitle:"seo_title",seoDescription:"seo_description",seoKeywords:"seo_keywords"},W={type:"product",title:P.name||P.nameAr||P.description||"",fieldType:F[h]||"product_description",brand:P.brand||"",strict:!0,storeId:s},V=await Re.mutateAsync(W);let ne;Array.isArray(V?.data)?ne=V.data[0]?.content:Array.isArray(V)?ne=V[0]?.content:ne=V?.data?.content??V?.content;const z=ne?.en||"",J=ne?.ar||"";if(!z&&!J)throw new Error(i("No suggestion came back. Try again.","لم يصل أي اقتراح. حاول مرة أخرى."));const ce={name:{name:Vt(z),nameAr:Vt(J)},description:{description:z,descriptionAr:J},seoTitle:{seoTitle:z,seoTitleAr:J},seoDescription:{seoDescription:z,seoDescriptionAr:J},seoKeywords:{seoKeywords:z,seoKeywordsAr:J}}[h]||{};return f(Me=>{const nt={...Me};for(const[ot,je]of Object.entries(ce))je&&(nt[ot]=je);return nt}),!0}catch(F){return v(F?.response?.data?.message||F?.message||i("Could not generate that right now.","تعذّر التوليد الآن.")),!1}finally{pe(F=>({...F,[h]:!1}))}},[re,p.name,p.nameAr,p.description,p.brand,s,Re,i]),Qe=c.useCallback(h=>{const P=(h||[]).map(ka);f(F=>{const W=new Map;(F.combos||[]).forEach(ne=>W.set(Sn(ne.options),ne));const V=Db(P).map(ne=>{const z=W.get(Sn(ne));return{options:ne,optionHex:Si(P,ne),price:z?.price??F.price??"",stock:z?.stock??""}});return{...F,axes:P,combos:V}})},[]),nn=c.useCallback((h,P)=>{f(F=>{const W=F.axes.map((V,ne)=>ne===h?{...V,...P}:V);return{...F,axes:W}})},[]),xn=c.useCallback(()=>{const h=String(j).replace(/[^\d.]/g,"");h&&f(P=>({...P,combos:P.combos.map(F=>({...F,price:h}))}))},[j]),_n=c.useCallback(()=>{const h=String(D).replace(/[^\d]/g,"");h!==""&&f(P=>({...P,combos:P.combos.map(F=>({...F,stock:h}))}))},[D]),Bt=()=>p.categorySlugs.map(h=>xe.find(P=>P.slug===h)?.name).filter(Boolean),Ot=c.useCallback(async()=>{if(!re.axes){v(""),pe(h=>({...h,axes:!0}));try{const{aiChatService:h}=await N(async()=>{const{aiChatService:V}=await Promise.resolve().then(()=>gr);return{aiChatService:V}},void 0,import.meta.url),P=await h.suggestVariants({storeId:s,name:p.name.trim()||p.nameAr.trim(),categoryNames:Bt(),locale:l?"ar":"en"}),F=Array.isArray(P?.options)?P.options:[];if(F.length===0)throw new Error(i("No suggestions right now.","لا توجد اقتراحات الآن."));const W=F.slice(0,_i).map(V=>{const ne=vs(V.name),z=(Array.isArray(V.values)?V.values:[]).map(O=>String(O||"").trim()).filter(Boolean),J={};return Pn(ne)&&z.forEach(O=>{J[O]=Qn(O)}),{name:ne,nameAr:String(V.nameAr||"").trim()||(Pn(ne)?"الألوان":go(ne)?"المقاسات":""),values:z,valueHex:J}});Qe(W.length?W:[{name:"",nameAr:"",values:[""],valueHex:{}}])}catch(h){v(h?.response?.data?.message||h?.message||i("Could not suggest options right now.","تعذّر اقتراح الخيارات الآن."))}finally{pe(h=>({...h,axes:!1}))}}},[re.axes,s,p.name,p.nameAr,p.categorySlugs,xe,l,Qe,i]),ir=c.useCallback(async h=>{const P=`axisValues:${h}`;if(re[P])return;const F=p.axes[h],W=(F?.name||"").trim();if(!W){v(i("Name the option first.","سمِّ الخيار أولاً."));return}v(""),pe(V=>({...V,[P]:!0}));try{const V=(F.values||[]).map(nt=>
728nt.trim()).filter(Boolean),{aiChatService:ne}=await N(async()=>{const{aiChatService:nt}=await Promise.resolve().then(()=>gr);return{aiChatService:nt}},void 0,import.meta.url),z=await ne.suggestVariants({storeId:s,name:p.name.trim()||p.nameAr.trim(),categoryNames:Bt(),optionName:W,existingValues:V,locale:l?"ar":"en"}),J=(Array.isArray(z?.values)?z.values:[]).map(nt=>String(nt||"").trim()).filter(Boolean);if(J.length===0)throw new Error(i("No suggestions right now.","لا توجد اقتراحات الآن."));const O=[...V,...J],ce=Pn(W),Me=p.axes.map((nt,ot)=>{if(ot!==h)return nt;const je={...nt.valueHex||{}};return ce&&J.forEach(lt=>{je[lt]||(je[lt]=Qn(lt))}),{...nt,values:O,valueHex:je}});Qe(Me)}catch(V){v(V?.response?.data?.message||V?.message||i("Could not suggest values right now.","تعذّر اقتراح القيم الآن."))}finally{pe(V=>({...V,[P]:!1}))}},[re,p.axes,p.name,p.nameAr,p.categorySlugs,xe,s,l,Qe,i]),Dt=c.useCallback(async h=>{const P=(h||"").trim();if(!(!P||A)){if(!s){v(i("Select a store first.","اختر متجراً أولاً."));return}v(""),E(!0);try{const F=Nb(P),W=await ke.mutateAsync({body:{name:P,slug:F,storeId:Number(s),position:0,active:!0},params:{storeId:Number(s)}}),ne=(W?.data||W||{}).slug||F;f(z=>({...z,categorySlugs:z.categorySlugs.includes(ne)?z.categorySlugs:[...z.categorySlugs,ne]})),L(""),me(""),ee(null)}catch(F){v(F?.response?.data?.message||F?.message||i("Could not create the category.","تعذّر إنشاء الفئة."))}finally{E(!1)}}},[A,s,ke,i]),pt=c.useCallback(h=>{const F={brand:i("Do you want to add a brand? Say the brand name, or say skip.","هل تريد إضافة علامة تجارية؟ قل اسم العلامة، أو قل تخطي."),shipping_weight:i("What is the package weight in kilograms? Say a number, or say skip.","ما وزن الطرد بالكيلوغرام؟ قل رقماً، أو قل تخطي."),shipping_length:i("What is the package length in centimeters? Say a number, or say skip.","ما طول الطرد بالسنتيمتر؟ قل رقماً، أو قل تخطي."),shipping_width:i("What is the package width in centimeters? Say a number, or say skip.","ما عرض الطرد بالسنتيمتر؟ قل رقماً، أو قل تخطي."),shipping_height:i("What is the package height in centimeters? Say a number, or say skip.","ما ارتفاع الطرد بالسنتيمتر؟ قل رقماً، أو قل تخطي.")}[h];F&&(ee(h),U(F),ge(F))},[ge,i]),$n=c.useCallback(()=>{ee(null);const h=i("Details are done. Say next when you're ready to continue.","تمت التفاصيل. قل التالي عندما تكون جاهزاً للمتابعة.");U(h),ge(h)},[ge,i]),qt=c.useMemo(()=>{switch(g){case"name":return p.name.trim().length>=2;case"price":{const h=ht(p.price);return h!==void 0&&h>=0}case"variants":{const h=p.combos.filter(P=>Object.keys(P.options).length>0);return h.length===0?!1:h.every(P=>{const F=ht(P.price);return F!==void 0&&F>=0})}default:return!0}},[g,p]),wn=c.useCallback(async()=>{if(!S){_(!0),v("");try{const h=p.images.map(ot=>Number(ot?.fileId)).filter(ot=>Number.isFinite(ot)),P={};ht(p.weight)!==void 0&&(P.weight=ht(p.weight)),ht(p.length)!==void 0&&(P.length=ht(p.length)),ht(p.width)!==void 0&&(P.width=ht(p.width)),ht(p.height)!==void 0&&(P.height=ht(p.height)),Object.keys(P).length>0&&(P.unit="cm");const F=(ot,je)=>{const lt={};return ot.trim()&&(lt.en=ot.trim()),je.trim()&&(lt.ar=je.trim()),Object.keys(lt).length>0?lt:void 0},W={},V=F(p.seoTitle,p.seoTitleAr),ne=F(p.seoDescription,p.seoDescriptionAr),z=F(p.seoKeywords,p.seoKeywordsAr);V&&(W.title=V),ne&&(W.description=ne),z&&(W.keywords=z);const J={storeId:s,name:p.name.trim(),type:p.type,locale:l?"ar":"en",...p.nameAr.trim()?{nameAr:p.nameAr.trim()}:{},...p.description.trim()?{description:p.description.trim()}:{},...p.descriptionAr.trim()?{descriptionAr:p.descriptionAr.trim()}:{},...p.brand.trim()?{brand:p.brand.trim()}:{},...p.categorySlugs.length>0?{categorySlugs:p.categorySlugs}:{},...h.length>0?{imageFileIds:h}:{},...Object.keys(P).length>0?{dimensions:P}:{},...Object.keys(W).length>0?{seo:W}:{}};if(p.type==="variants"){const ot=p.axes.map(ka).filter(je=>je.name.trim()&&je.values.some(lt=>lt.trim())).map(je=>({name:je.name.trim(),...je.nameAr&&je.nameAr.trim()?{nameAr:je.nameAr.trim()}:{},values:je.values.map(lt=>
728lt.trim()).filter(Boolean)}));J.variantOptions=ot,J.variations=p.combos.filter(je=>Object.keys(je.options).length>0).map(je=>{const lt=Ai(je.options),Vn=Ai(je.optionHex||Si(ot,lt));return{options:lt,...Vn&&Object.keys(Vn).length>0?{optionHex:Vn}:{},price:ht(je.price)??0,...ht(je.stock)!==void 0?{stock:ht(je.stock)}:{}}})}else J.price=ht(p.price)??0,ht(p.wasPrice)!==void 0&&(J.wasPrice=ht(p.wasPrice)),ht(p.stock)!==void 0&&(J.stock=ht(p.stock));const{aiChatService:O}=await N(async()=>{const{aiChatService:ot}=await Promise.resolve().then(()=>gr);return{aiChatService:ot}},void 0,import.meta.url),ce=await O.prepareGuidedProduct(J),Me=(ce?.reply||"").trim(),nt=ce?.meta||{};if(!nt?.actions?.some(ot=>ot?.type==="confirm_write"))throw new Error(Me||"Could not prepare the product.");r?.(Me,nt)}catch(h){v(h?.response?.data?.message||h?.message||i("Something went wrong. Please try again.","حدث خطأ ما. حاول مرة أخرى.")),_(!1)}}},[S,p,s,l,r,i]),Y=async h=>{const P=h&&typeof h=="object"?h:null,F=String(P?P.primary||P.en||P.ar:h||"").trim();if(!F)return;U("");const W=hd(F),V=await Eb({transcript:F,workflow:"create_product",state:K||he?.field||g,draft:p,context:{pendingVoiceField:K,pendingOffer:he,bilingual:!!P},storeId:s,locale:oe?.locale}),ne=Tb(F);if(ne){M({[ne.field]:ne.value});const z={price:i("selling price","سعر البيع"),wasPrice:i("compare-at price","السعر قبل الخصم"),stock:i("stock quantity","كمية المخزون"),name:i("product name","اسم المنتج"),nameAr:i("Arabic product name","اسم المنتج بالعربية"),brand:i("brand","العلامة التجارية")}[ne.field],J=g==="price"&&K==="stock"&&ne.field!=="stock"?i(`${z} is set to ${ne.value}. What stock quantity do you have? Say a number, or say skip.`,`تم ضبط ${z} على ${ne.value}. ما كمية المخزون لديك؟ قل رقماً، أو قل تخطي.`):g==="price"&&K==="wasPrice"&&ne.field!=="wasPrice"?i(`${z} is set to ${ne.value}. Do you have a compare-at price? Say a number, or say skip.`,`تم ضبط ${z} على ${ne.value}. هل لديك سعر قبل الخصم؟ قل رقماً، أو قل تخطي.`):i(`${z} is set to ${ne.value}. Say next to continue, or tell me another change.`,`تم ضبط ${z} على ${ne.value}. قل التالي للمتابعة، أو أخبرني بتعديل آخر.`);U(J),ge(J);return}if(Cb.test(W)||V.intent===Pe.GO_BACK){G();return}if(g==="name"&&K==="confirmName"){if(Gr.test(W)||V.intent===Pe.CONFIRM_YES){ee(null),fe({field:"name"});const z=Q("name");U(z),ge(z);return}if(Ut.test(W)||vi.test(F)||V.intent===Pe.CONFIRM_NO||V.intent===Pe.CORRECT_VALUE){ee("name_retry"),Oe();return}ee(null)}else g==="name"&&K==="name_retry"&&ee(null);if(he){if(he.field==="name"&&(vi.test(F)||V.intent===Pe.CORRECT_VALUE)){fe(null),Oe();return}if(Gr.test(W)||V.intent===Pe.CONFIRM_YES){const z=he.field;if(!await ze(z)){const ce=i("I couldn't improve it just now. Say next to continue, or yes to try again.","تعذّر التحسين الآن. قل التالي للمتابعة، أو نعم للمحاولة مرة أخرى.");U(ce),ge(ce);return}const O=z==="name"?i("Here's an improved name. Say yes to try another, or next to continue.","هذا اسم محسّن. قل نعم لتجربة آخر، أو التالي للمتابعة."):i("Done. Say yes to try another, or next to continue.","تم. قل نعم لتجربة آخر، أو التالي للمتابعة.");fe({field:z}),U(O),ge(O)}else if(Ut.test(W)||$t.test(W)||V.intent===Pe.CONFIRM_NO||V.intent===Pe.GO_NEXT)fe(null),Se();else{const z=i("Say yes to improve it, or no to keep it.","قل نعم لتحسينه، أو لا للإبقاء عليه.");U(z),ge(z)}return}if(K){if(K==="category_create"){if(Gr.test(W)||V.intent===Pe.CONFIRM_YES){const J=ie||k||F;ee(null),await Dt(J);const O=i(`I added "${J}". Say next to continue, or say another category.`,`أضفت "${J}". قل التالي للمتابعة، أو قل فئة أخرى.`);U(O),ge(O);return}if(Ut.test(W)||V.intent===Pe.CONFIRM_NO){ee(null),me("");const J=i("Okay. Say another category name, or say skip.","حسناً. قل اسم فئة أخرى، أو قل تخطي.");U(J),ge(J);return}
728me(F),L(F);const z=i(`I couldn't find "${F}". Create it as a new category? Say yes or no.`,`لم أجد "${F}". هل أنشئها كفئة جديدة؟ قل نعم أو لا.`);U(z),ge(z);return}if(g==="details"){if(Ei.test(W)){ee(null),Se();return}if(K==="brand"){if(Ut.test(W)||$t.test(W)||V.intent===Pe.SKIP_OPTIONAL){pt("shipping_weight");return}M({brand:F}),pt("shipping_weight");return}if(K==="shipping_weight"){if(Ut.test(W)||$t.test(W)||V.intent===Pe.SKIP_OPTIONAL){pt("shipping_length");return}const z=String(V.fields?.weight??V.fields?.value??yn(F)??"");z?(M({weight:z}),pt("shipping_length")):pt("shipping_weight");return}if(K==="shipping_length"){if(Ut.test(W)||$t.test(W)||V.intent===Pe.SKIP_OPTIONAL){pt("shipping_width");return}const z=String(V.fields?.length??V.fields?.value??yn(F)??"");z?(M({length:z}),pt("shipping_width")):pt("shipping_length");return}if(K==="shipping_width"){if(Ut.test(W)||$t.test(W)||V.intent===Pe.SKIP_OPTIONAL){pt("shipping_height");return}const z=String(V.fields?.width??V.fields?.value??yn(F)??"");z?(M({width:z}),pt("shipping_height")):pt("shipping_width");return}if(K==="shipping_height"){if(Ut.test(W)||$t.test(W)||V.intent===Pe.SKIP_OPTIONAL){$n();return}const z=String(V.fields?.height??V.fields?.value??yn(F)??"");z?(M({height:z}),$n()):pt("shipping_height");return}}if(K==="photos_more"){if(Gr.test(W)||V.intent===Pe.CONFIRM_YES){ee(null),U(i("Upload the next photo. I'll wait.","ارفع الصورة التالية. سأنتظر.")),C(!0);return}if(Ut.test(W)||$t.test(W)||V.intent===Pe.CONFIRM_NO||V.intent===Pe.GO_NEXT){ee(null),Se();return}const z=i("Say yes to add another photo, or next to continue.","قل نعم لإضافة صورة أخرى، أو التالي للمتابعة.");U(z),ge(z);return}if(g==="price"&&K==="wasPrice"){if($t.test(W)||V.intent===Pe.GO_NEXT){ee(null),Se();return}if(Ut.test(W)||V.intent===Pe.CONFIRM_NO||V.intent===Pe.SKIP_OPTIONAL||/^(none|no discount|skip|لا يوجد|بدون خصم)$/i.test(W)){ee("stock");const J=i("What stock quantity do you have? Say a number, or say skip.","ما كمية المخزون لديك؟ قل رقماً، أو قل تخطي.");U(J),ge(J);return}const z=String(V.fields?.wasPrice??V.fields?.price??yn(F)??"");if(z){M({wasPrice:z}),ee("stock");const J=i("Got it. What stock quantity do you have? Say a number, or say skip.","تم. ما كمية المخزون لديك؟ قل رقماً، أو قل تخطي.");U(J),ge(J)}else{const J=i("Say the compare-at price, or say skip.","قل السعر قبل الخصم، أو قل تخطي.");U(J),ge(J)}return}if(g==="price"&&K==="stock"){if($t.test(W)||V.intent===Pe.GO_NEXT){ee(null),Se();return}if(Ut.test(W)||V.intent===Pe.CONFIRM_NO||V.intent===Pe.SKIP_OPTIONAL||/^(none|skip|لا يوجد)$/i.test(W)){ee(null);const J=i("Price is set. Say next when you're ready to continue.","تم تحديد السعر. قل التالي عندما تكون جاهزاً للمتابعة.");U(J),ge(J);return}const z=String(V.fields?.stock??V.fields?.quantity??yn(F)??"");if(z){M({stock:z.replace(/\.\d+$/,"")}),ee(null);const J=i("Stock is set. Say next when you're ready to continue.","تم تحديد المخزون. قل التالي عندما تكون جاهزاً للمتابعة.");U(J),ge(J)}else{const J=i("Say the stock quantity, or say skip.","قل كمية المخزون، أو قل تخطي.");U(J),ge(J)}return}}if(g==="review"){if(jb.test(W))wn();else{const z=i("Say create to add the product, or say back.","قل إنشاء لإضافة المنتج، أو قل رجوع.");U(z),ge(z)}return}if(g==="details"&&($t.test(W)||V.intent===Pe.GO_NEXT)){if(/^(skip|تخطي|تخطى)$/i.test(W)){pt("brand");return}const z=i("Before continuing, do you want a description? Say it, say write it for me, or say skip all.","قبل المتابعة، هل تريد وصفاً؟ قل الوصف، أو قل اكتبه لي، أو قل تخطي الكل.");U(z),ge(z);return}if($t.test(W)||V.intent===Pe.GO_NEXT){Se();return}switch(g){case"name":{const z=String(V.fields?.name||V.fields?.productName||V.fields?.text||F).trim();if(P){const O=Vt(P.en||""),ce=Vt(P.ar||""),Me=O&&!kn(O)&&Ob(O)?O:"",nt=ce&&kn(ce)?ce:kn(O)?O:"";if(M({...Me?{name:Me}:{},...nt?{nameAr:nt}:{}}),!Me&&!p.name.trim()&&!(nt?await ze("name",{...p,nameAr:nt}):!1)){const je=i("I saved the Arabic name. Now say the product name in English, or type it here.","حفظت الاسم بالعربية. الآن قل اسم المنتج بالإنجليزية، أو اكتبه هنا.");U(je),ge(je);return}}else if(kn(z)){const O=Vt(z);if(M({nameAr:O}),!p.name.trim()&&!(O?await ze("name",{...p,nameAr:O}):!1)){const Me=i("I saved the Arabic name. Now say the product name in English, or type it here.","حفظت الاسم بالعربية. الآن قل اسم المنتج بالإنجليزية، أو اكتبه هنا.");U(Me),ge(Me);return}}else M({name:Vt(z)});ee("confirmName");const J=we((kn(z)?Vt(z):"")||p.name||p.nameAr||z);U(J),ge(J);return}case"type":{const z=Rb.test(F),J=Pb.test(F);if(z&&!J)f(O=>({...O,type:"variants"})),Qe(p.axes),y("variants");else if(J&&!z)M({type:"simple"}),y("price");else{const O=i("Say single, or say variations.","قل واحد، أو قل تنويعات.");U(O),ge(O)}return}case"price":{const z=String(V.fields?.price??V.fields?.value??yn(F)??"");if(z){M({price:z}),ee("wasPrice");const J=i("Price is set. Do you have a compare-at price before discount? Say a number, or say skip.","تم تحديد السعر. هل لديك سعر قبل الخصم؟ قل رقماً، أو قل تخطي.");U(J),ge(J)}else{const J=i("I didn't catch a number. Please say the price again.","لم ألتقط رقماً. من فضلك قل السعر مرة أخرى.");U(J),ge(J)}return}case"category":{const z=String(V.fields?.category||V.fields?.name||V.fields?.text||F).trim(),J=z.toLowerCase(),O=xe.find(ce=>ce.name.toLowerCase()===J)||xe.find(ce=>J.includes(ce.name.toLowerCase())||ce.name.toLowerCase().includes(J));if(O){M({categorySlugs:p.categorySlugs.includes(O.slug)?p.categorySlugs:[...p.categorySlugs,O.slug]});const ce=i(`Selected "${O.name}". Say next to continue, or say another category.`,`اخترت "${O.name}". قل التالي للمتابعة، أو قل فئة أخرى.`);U(ce),ge(ce)}else{ee("category_create"),me(z),L(z);const ce=i(`I couldn't find "${z}". Create it as a new category? Say yes or no.`,`لم أجد "${z}". هل أنشئها كفئة جديدة؟ قل نعم أو لا.`);U(ce),ge(ce)}return}case"details":if(Ei.test(W)){Se();return}if(Ut.test(W)||V.intent===Pe.CONFIRM_NO){pt("brand");return}if(Ib.test(F)||V.intent===Pe.SELECT_OPTION){const z=await ze("description"),J=z?i("I wrote a description. Do you want to add a brand? Say the brand name, or say skip.","كتبت وصفاً. هل تريد إضافة علامة تجارية؟ قل اسم العلامة، أو قل تخطي."):i("I couldn't write it now. Say a short description, or say skip all.","تعذّر كتابته الآن. قل وصفاً قصيراً، أو قل تخطي الكل.");z&&ee("brand"),U(J),ge(J);return}kn(F)?M({descriptionAr:F}):M({description:F}),pt("brand");return;case"seo":M({seoTitle:F}),Se();return;default:return}};ue.current=Y;const ye=async()=>
728{if(oe.enabled)if(oe.isRecording){const h=await oe.stopRecording();h&&ue.current?.(h)}else!he&&!K&&U(""),Ge(),Be()};if(!e)return null;const be=p.type==="variants"?`${p.combos.filter(h=>Object.keys(h.options).length>0).length} ${i("variations","تنويعات")}`:p.price?`${p.price}`:i("not set","غير محدد"),le=p.categorySlugs.map(h=>xe.find(P=>P.slug===h)?.name).filter(Boolean),_e=(()=>{const h=[p.length,p.width,p.height].map(W=>W.trim()),P=h.some(Boolean)?h.map(W=>W||"?").join(" × ")+" cm":"";return[p.weight.trim()?`${p.weight} kg`:"",P].filter(Boolean).join(", ")})(),Fe=[p.seoTitle,p.seoTitleAr,p.seoDescription,p.seoDescriptionAr,p.seoKeywords,p.seoKeywordsAr].some(h=>h.trim());return t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden bg-gray-50",dir:l?"rtl":"ltr",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-white border-b border-gray-200 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-brand-secondary/10 text-brand-secondary",children:t.jsx(Zn,{className:"h-4 w-4","aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-[13px] font-semibold text-gray-900 leading-tight truncate",children:i("Create a product","إنشاء منتج")}),t.jsx("p",{className:"text-[11px] text-gray-500 leading-tight",children:i(`Step ${ft+1} of ${Z}`,`الخطوة ${ft+1} من ${Z}`)})]})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[oe.enabled&&t.jsx("button",{type:"button",onClick:Ze,"aria-pressed":te,"aria-label":te?i("Turn off voice guidance","إيقاف الإرشاد الصوتي"):i("Turn on voice guidance","تشغيل الإرشاد الصوتي"),title:te?i("Voice guidance on","الإرشاد الصوتي مفعّل"):i("Voice guidance off","الإرشاد الصوتي متوقف"),className:vt("h-7 w-7 rounded-lg flex items-center justify-center transition-colors cursor-pointer",te?"bg-brand-secondary/10 text-brand-secondary":"text-gray-400 hover:text-gray-700 hover:bg-gray-100"),children:te?t.jsx(jn,{className:"h-4 w-4"}):t.jsx(Qc,{className:"h-4 w-4"})}),t.jsx("button",{type:"button",onClick:n,"aria-label":i("Close","إغلاق"),className:"h-7 w-7 rounded-lg flex items-center justify-center text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors cursor-pointer",children:t.jsx(Ft,{className:"h-4 w-4"})})]})]}),t.jsx("div",{className:"h-1 bg-gray-100 flex-shrink-0",children:t.jsx("div",{className:"h-full bg-brand-secondary transition-all duration-300",style:{width:`${(ft+1)/Z*100}%`}})}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4",children:[g==="name"&&t.jsx(sn,{title:i("What's the product name?","ما اسم المنتج؟"),hint:i("This is what buyers will see first.","هذا ما سيراه المشترون أولاً."),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700",htmlFor:"gpc-name",children:i("Product name","اسم المنتج")}),t.jsx(Tn,{loading:re.name,disabled:!p.name.trim(),title:p.name.trim()?void 0:i("Enter a product name first.","أدخل اسم المنتج أولاً."),onClick:()=>ze("name"),label:p.name.trim()?i("Regenerate","إعادة التوليد"):i("Suggest with AI","اقترح بالذكاء")})]}),t.jsx("input",{id:"gpc-name",autoFocus:!0,value:p.name,onChange:h=>M({name:h.target.value}),placeholder:i("e.g. Hydrating Face Serum","مثال: سيروم مرطب للوجه"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",htmlFor:"gpc-name-ar",children:i("Arabic name (optional)","الاسم بالعربية (اختياري)")}),t.jsx("input",{id:"gpc-name-ar",dir:"rtl",value:p.nameAr,onChange:h=>M({nameAr:h.target.value}),placeholder:i("سيروم مرطب للوجه","سيروم مرطب للوجه"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]})]})}),g==="photos"&&t.jsx(sn,{title:i("Add product photos","أضف صور المنتج"),hint:i("Clear photos help your product sell. You can also skip and add them later.","الصور الواضحة تساعد على البيع. يمكنك التخطي وإضافتها لاحقاً."),children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[p.images.map((h,P)=>t.jsxs("div",{className:"relative aspect-square rounded-xl overflow-hidden ring-1 ring-gray-200 bg-white",children:[t.jsx("img",{src:h.url,alt:h.name||`photo ${P+1}`,className:"w-full h-full object-cover"}),t.jsx("button",{type:"button",onClick:()=>ut(P),"aria-label":i("Remove photo","إزالة الصورة"),className:"absolute top-1 end-1 h-5 w-5 rounded-full bg-black/55 text-white flex items-center justify-center hover:bg-black/75 transition-colors cursor-pointer",children:t.jsx(Ft,{className:"h-3 w-3"})})]},h.fileId||h.url||P)),p.images.length<xi&&t.jsxs("button",{type:"button",onClick:()=>C(!0),className:"aspect-square rounded-xl border-2 border-dashed border-gray-300 bg-white text-gray-500 hover:border-brand-secondary/50 hover:text-brand-secondary hover:bg-brand-secondary/5 transition-colors flex flex-col items-center justify-center gap-1 cursor-pointer",children:[t.jsx(Ln,{className:"h-5 w-5","aria-hidden":"true"}),t.jsx("span",{className:"text-[11px] font-medium",children:i("Add photo","إضافة صورة")})]})]})}
728),g==="type"&&t.jsx(sn,{title:i("Is this a single item or does it have variations?","هل هذا منتج واحد أم له تنويعات؟"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(ki,{active:p.type==="simple",icon:Zn,title:i("Single product","منتج واحد"),sub:i("One price, one item.","سعر واحد، صنف واحد."),onClick:()=>{M({type:"simple"}),v(""),y("price")}}),t.jsx(ki,{active:p.type==="variants",icon:Ua,title:i("Has variations","له تنويعات"),sub:i("Options like size or color.","خيارات مثل المقاس أو اللون."),onClick:()=>{f(h=>({...h,type:"variants"})),Qe(p.axes),v(""),y("variants")}})]})}),g==="price"&&t.jsx(sn,{title:i("What's the selling price?","ما سعر البيع؟"),hint:i("You can edit prices anytime after creating.","يمكنك تعديل الأسعار في أي وقت بعد الإنشاء."),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",htmlFor:"gpc-price",children:i("Price","السعر")}),t.jsx("input",{id:"gpc-price",autoFocus:!0,inputMode:"decimal",value:p.price,onChange:h=>M({price:h.target.value.replace(/[^\d.]/g,"")}),placeholder:"0.00",className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",htmlFor:"gpc-wasprice",children:i("Compare-at price (optional)","السعر قبل الخصم (اختياري)")}),t.jsx("input",{id:"gpc-wasprice",inputMode:"decimal",value:p.wasPrice,onChange:h=>M({wasPrice:h.target.value.replace(/[^\d.]/g,"")}),placeholder:"0.00",className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",htmlFor:"gpc-stock",children:i("Stock quantity (optional)","كمية المخزون (اختياري)")}),t.jsx("input",{id:"gpc-stock",inputMode:"numeric",value:p.stock,onChange:h=>M({stock:h.target.value.replace(/[^\d]/g,"")}),placeholder:i("e.g. 25","مثال: 25"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]})]})}),g==="variants"&&t.jsx(sn,{title:i("Set up the variations","إعداد التنويعات"),hint:i("Add options like Size or Color, then set a price for each combination.","أضف خيارات مثل المقاس أو اللون، ثم حدد سعراً لكل تركيبة."),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-brand-secondary/20 bg-brand-secondary/5 px-3 py-2",children:[t.jsx("span",{className:"text-[12px] text-gray-700 leading-snug pe-2",children:i("Not sure which options to add?","غير متأكد من الخيارات التي تضيفها؟")}),t.jsx(Tn,{loading:re.axes,onClick:Ot,label:i("Suggest options","اقترح الخيارات")})]}),p.axes.map((h,P)=>t.jsx($b,{axis:h,isRTL:l,tr:i,suggesting:!!re[`axisValues:${P}`],onSuggestValues:()=>ir(P),onChange:F=>{nn(P,F)},onCommit:F=>{const W=p.axes.map((V,ne)=>ne===P?F:V);Qe(W)},onRemove:p.axes.length>1?()=>{const F=p.axes.filter((W,V)=>V!==P);Qe(F)}:void 0},P)),p.axes.length<_i&&t.jsxs("button",{type:"button",onClick:()=>M({axes:[...p.axes,{name:"",nameAr:"",values:[""],valueHex:{}}]}),className:"inline-flex items-center gap-1.5 self-start text-[12px] font-medium text-brand-secondary hover:underline cursor-pointer",children:[t.jsx(Xn,{className:"h-3.5 w-3.5"}),i("Add another option","إضافة خيار آخر")]}),p.combos.filter(h=>Object.keys(h.options).length>0).length>0&&t.jsxs("div",{className:"mt-1 rounded-xl border border-gray-200 bg-white overflow-hidden",children:[t.jsx("div",{className:"px-3 py-2 bg-gray-50 border-b border-gray-100 text-[11px] font-semibold text-gray-600",children:i("Price each combination","حدد سعر كل تركيبة")}),t.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 bg-white flex flex-col gap-2 sm:flex-row sm:items-center sm:flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("input",{inputMode:"decimal",value:j,onChange:h=>H(h.target.value.replace(/[^\d.]/g,"")),placeholder:i("Base price","السعر الأساسي"),className:"w-24 rounded-lg border border-gray-200 px-2 py-1 text-[12px] focus:outline-none focus:border-brand-secondary"}),t.jsx("button",{type:"button",onClick:xn,disabled:!j,className:vt("rounded-lg px-2.5 py-1 text-[11px] font-semibold transition-colors cursor-pointer",j?"bg-brand-secondary/10 text-brand-secondary hover:bg-brand-secondary/15":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:i("Apply to all","تطبيق على الكل")})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("input",{inputMode:"numeric",value:D,onChange:h=>$(h.target.value.replace(/[^\d]/g,"")),placeholder:i("Base stock","المخزون الأساسي"),className:"w-24 rounded-lg border border-gray-200 px-2 py-1 text-[12px] focus:outline-none focus:border-brand-secondary"}),t.jsx("button",{type:"button",onClick:_n,disabled:D==="",className:vt("rounded-lg px-2.5 py-1 text-[11px] font-semibold transition-colors cursor-pointer",D!==""?"bg-brand-secondary/10 text-brand-secondary hover:bg-brand-secondary/15":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:i("Apply to all","تطبيق على الكل")})]})]}),t.jsx("div",{className:"divide-y divide-gray-100",children:p.combos.filter(h=>Object.keys(h.options).length>0).map(h=>t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[t.jsx("span",{className:"text-[12px] text-gray-800 flex-1 min-w-0 truncate flex items-center gap-1",children:Object.entries(h.options).map(([P,F],W)=>t.jsxs("span",{className:"inline-flex items-center gap-1",children:[W>0&&t.jsx("span",{className:"text-gray-300",children:"/"}),h.optionHex?.[P]&&t.jsx("span",{className:"inline-block h-3 w-3 rounded-full ring-1 ring-black/10",style:{backgroundColor:h.optionHex[P]},"aria-hidden":"true"}),F]},P))}),t.jsx("input",{inputMode:"decimal",value:h.price,onChange:P=>{const F=P.target.value.replace(/[^\d.]/g,"");f(W=>({...W,combos:W.combos.map(V=>Sn(V.options)===Sn(h.options)?{...V,price:F}:V)}))},placeholder:i("Price","السعر"),className:"w-20 rounded-lg border border-gray-200 px-2 py-1 text-[12px] focus:outline-none focus:border-brand-secondary"}),t.jsx("input",{inputMode:"numeric",value:h.stock,onChange:P=>{const F=P.target.value.replace(/[^\d]/g,"");f(W=>({...W,combos:W.combos.map(V=>Sn(V.options)===Sn(h.options)?{...V,stock:F}:V)}))},placeholder:i("Stock","المخزون"),className:"w-16 rounded-lg border border-gray-200 px-2 py-1 text-[12px] focus:outline-none focus:border-brand-secondary"})]},Sn(h.options)))})]})]})}),g==="category"&&t.jsx(sn,{title:i("Pick a category (optional)","اختر فئة (اختياري)"),hint:i("Type or say a category. If it does not exist, create it here.","اكتب أو قل اسم الفئة. إذا لم تكن موجودة، أنشئها هنا."),children:Ce?t.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-gray-500 py-4",children:[t.jsx(St,{className:"h-4 w-4 animate-spin"}
728),i("Loading categories…","جارٍ تحميل الفئات…")]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative mb-2",children:[t.jsx(is,{className:"absolute top-1/2 -translate-y-1/2 start-2.5 h-3.5 w-3.5 text-gray-400"}),t.jsx("input",{value:k,onChange:h=>L(h.target.value),onKeyDown:h=>{h.key==="Enter"&&k.trim()&&!Gt&&(h.preventDefault(),Dt(k))},placeholder:i("Search or add a category","ابحث أو أضف فئة"),className:"w-full rounded-xl border border-gray-200 bg-white ps-8 pe-3 py-2 text-[12px] focus:outline-none focus:border-brand-secondary"})]}),K==="category_create"&&ie&&t.jsxs("div",{className:"mb-2 rounded-xl border border-brand-secondary/30 bg-brand-secondary/5 p-3",children:[t.jsx("p",{className:"text-[12px] font-medium text-gray-900",children:i(`Create "${ie}" as a new category?`,`إنشاء "${ie}" كفئة جديدة؟`)}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsxs("button",{type:"button",onClick:()=>Dt(ie),disabled:A,className:"inline-flex items-center gap-1.5 rounded-lg bg-brand-secondary px-3 py-1.5 text-[12px] font-semibold text-white transition-colors cursor-pointer disabled:opacity-60",children:[A&&t.jsx(St,{className:"h-3.5 w-3.5 animate-spin"}),i("Create category","إنشاء الفئة")]}),t.jsx("button",{type:"button",onClick:()=>{ee(null),me("")},className:"rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-[12px] font-medium text-gray-700 transition-colors hover:bg-gray-50 cursor-pointer",children:i("Choose another","اختر أخرى")})]})]}),k.trim()&&!Gt&&t.jsxs("button",{type:"button",onClick:()=>Dt(k),disabled:A,className:vt("mb-2 inline-flex w-full items-center gap-2 rounded-xl border border-dashed px-3 py-2 text-[12px] font-medium transition-colors cursor-pointer",A?"border-gray-200 text-gray-400 cursor-wait":"border-brand-secondary/40 text-brand-secondary hover:bg-brand-secondary/5"),children:[A?t.jsx(St,{className:"h-3.5 w-3.5 animate-spin"}):t.jsx(Xn,{className:"h-3.5 w-3.5"}),i(`Create "${k.trim()}"`,`إنشاء "${k.trim()}"`)]}),xe.length===0&&!k.trim()?t.jsx("p",{className:"text-[12px] text-gray-500 py-2",children:i("No categories yet. Type a name above to create one, or skip.","لا توجد فئات بعد. اكتب اسماً بالأعلى لإنشائها، أو تخطَّ.")}):t.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-48 overflow-y-auto",children:dt.map(h=>{const P=p.categorySlugs.includes(h.slug);return t.jsxs("button",{type:"button",onClick:()=>M({categorySlugs:P?p.categorySlugs.filter(F=>F!==h.slug):[...p.categorySlugs,h.slug]}),className:vt("inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[12px] font-medium transition-colors cursor-pointer border",P?"bg-brand-secondary text-white border-brand-secondary":"bg-white text-gray-700 border-gray-200 hover:border-brand-secondary/40 hover:bg-brand-secondary/5"),children:[P&&t.jsx(Dn,{className:"h-3 w-3"}),h.name]},h.slug)})})]})}),g==="details"&&t.jsx(sn,{title:i("Add a short description (optional)","أضف وصفاً قصيراً (اختياري)"),hint:i("A line or two about what makes it great.","سطر أو سطران عمّا يميّزه."),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700",htmlFor:"gpc-desc",children:i("Description","الوصف")}),t.jsx(Tn,{loading:re.description,disabled:!p.name.trim(),title:p.name.trim()?void 0:i("Add a product name first.","أضف اسم المنتج أولاً."),onClick:()=>ze("description"),label:p.description.trim()?i("Regenerate","إعادة التوليد"):i("Write with AI","اكتب بالذكاء")})]}),t.jsx("textarea",{id:"gpc-desc",rows:4,value:p.description,onChange:h=>M({description:h.target.value}),placeholder:i("Describe your product…","صف منتجك…"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30 resize-none"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",htmlFor:"gpc-desc-ar",children:i("Arabic description (optional)","الوصف بالعربية (اختياري)")}),t.jsx("textarea",{id:"gpc-desc-ar",dir:"rtl",rows:4,value:p.descriptionAr,onChange:h=>M({descriptionAr:h.target.value}),placeholder:i("صف منتجك…","صف منتجك…"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30 resize-none"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",htmlFor:"gpc-brand",children:i("Brand (optional)","العلامة التجارية (اختياري)")}),t.jsx("input",{id:"gpc-brand",value:p.brand,onChange:h=>M({brand:h.target.value}),placeholder:i("e.g. Acme","مثال: Acme"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]}),t.jsxs("div",{className:"pt-1",children:[t.jsx("p",{className:"text-[12px] font-medium text-gray-700 mb-1",children:i("Shipping size (optional)","حجم الشحن (اختياري)")}),t.jsx("p",{className:"text-[11px] text-gray-500 mb-2 leading-snug",children:i("Helps calculate accurate delivery rates. Weight in kg, sizes in cm.","يساعد على حساب رسوم توصيل دقيقة. الوزن بالكيلوغرام والأبعاد بالسنتيمتر.")}),t.jsx("p",{className:"mb-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-[11px] font-medium leading-snug text-red-700",children:i("Required before activation when calculated shipping is used. You can skip for draft creation, but the product may stay inactive until shipping size is filled.","مطلوب قبل التفعيل عند استخدام الشحن المحسوب. يمكنك تخطيه لإنشاء المسودة، لكن قد يبقى المنتج غير مفعّل حتى يتم إدخال حجم الشحن.")}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx($r,{label:i("Weight (kg)","الوزن (كغ)"),value:p.weight,onChange:h=>M({weight:h})}),t.jsx($r,{label:i("Length (cm)","الطول (سم)"),value:p.length,onChange:h=>M({length:h})}),t.jsx($r,{label:i("Width (cm)","العرض (سم)"),value:p.width,onChange:h=>M({width:h})}),t.jsx($r,{label:i("Height (cm)","الارتفاع (سم)"),value:p.height,onChange:h=>M({height:h})})]})]})]})}),g==="seo"&&t.jsx(sn,{title:i("Search visibility (optional)","الظهور في البحث (اختياري)"),hint:i("Improve how this product shows up in search. You can let AI write it.","حسّن ظهور المنتج في البحث. يمكنك ترك الذكاء يكتبه."),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700",htmlFor:"gpc-seo-title",children:i("SEO title","عنوان SEO")}),t.jsx(Tn,{loading:re.seoTitle,disabled:!p.name.trim(),title:p.name.trim()?void 0:i("Add a product name first.","أضف اسم المنتج أولاً."),onClick:()=>ze("seoTitle"),label:p.seoTitle.trim()?i("Regenerate","إعادة التوليد"):i("Suggest with AI","اقترح بالذكاء")})]}),t.jsx("input",{id:"gpc-seo-title",value:p.seoTitle,onChange:h=>M({seoTitle:h.target.value}),placeholder:i("Short title for search results","عنوان قصير لنتائج البحث"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"}),p.seoTitleAr&&t.jsx("input",{dir:"rtl",value:p.seoTitleAr,onChange:h=>M({seoTitleAr:h.target.value}),placeholder:i("العنوان بالعربية","العنوان بالعربية"),className:"mt-2 w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700",htmlFor:"gpc-seo-desc",children:i("SEO description","وصف SEO")}),t.jsx(Tn,{loading:re.seoDescription,disabled:!p.name.trim(),title:p.name.trim()?void 0:i("Add a product name first.","أضف اسم المنتج أولاً."),onClick:()=>ze("seoDescription"),label:p.seoDescription.trim()?i("Regenerate","إعادة التوليد"):i("Write with AI","اكتب بالذكاء")})]}),t.jsx("textarea",{id:"gpc-seo-desc",rows:3,value:p.seoDescription,onChange:h=>M({seoDescription:h.target.value}),placeholder:i("A sentence shown under the title in search","جملة تظهر أسفل العنوان في البحث"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30 resize-none"}),p.seoDescriptionAr&&t.jsx("textarea",{dir:"rtl",rows:3,value:p.seoDescriptionAr,onChange:h=>M({seoDescriptionAr:h.target.value}),placeholder:i("الوصف بالعربية","الوصف بالعربية"),className:"mt-2 w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30 resize-none"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("label",{className:"block text-[12px] font-medium text-gray-700",htmlFor:"gpc-seo-kw",children:i("Keywords","الكلمات المفتاحية")}),t.jsx(Tn,{loading:re.seoKeywords,disabled:!p.name.trim(),title:p.name.trim()?void 0:i("Add a product name first.","أضف اسم المنتج أولاً."),onClick:()=>ze("seoKeywords"),label:p.seoKeywords.trim()?i("Regenerate","إعادة التوليد"):i("Suggest with AI","اقترح بالذكاء")})]}),t.jsx("input",{id:"gpc-seo-kw",value:p.seoKeywords,onChange:h=>M({seoKeywords:h.target.value}),placeholder:i("comma, separated, keywords","كلمات, مفصولة, بفواصل"),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"}),p.seoKeywordsAr&&t.jsx("input",{dir:"rtl",value:p.seoKeywordsAr,onChange:h=>M({seoKeywordsAr:h.target.value}),placeholder:i("كلمات مفتاحية بالعربية","كلمات مفتاحية بالعربية"),className:"mt-2 w-full rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]})]})}),g==="review"&&t.jsx(sn,{title:i("Review and create","المراجعة والإنشاء"),hint:i("We'll create it as a hidden draft for you to review.","سننشئه كمسودة مخفية لمراجعتها."),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-3",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-[12px] font-medium text-gray-600",children:i("Photos","الصور")}),t.jsx("span",{className:"text-[12px] font-semibold text-gray-900",children:p.images.length})]}),p.images.length>0?t.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.images.map((h,P)=>t.jsx("div",{className:"h-12 w-12 rounded-lg overflow-hidden ring-1 ring-gray-200 bg-gray-50",children:t.jsx("img",{src:h.url,alt:h.name||`photo ${P+1}`,className:"h-full w-full object-cover"})},h.fileId||h.url||P))}):t.jsx("p",{className:"text-[12px] text-gray-400",children:i("No photos added","لا توجد صور")})]}),t.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-3",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-[12px] font-medium text-gray-600",children:i("Categories","الفئات")}),t.jsx("span",{className:"text-[12px] font-semibold text-gray-900",children:p.categorySlugs.length})]}),le.length>0?t.jsx("div",{className:"flex flex-wrap gap-1.5",children:le.map(h=>t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-brand-secondary/10 text-brand-secondary px-2.5 py-1 text-[11px] font-medium",children:[t.jsx(Va,{className:"h-3 w-3","aria-hidden":"true"}),h]},h))}):t.jsx("p",{className:"text-[12px] text-gray-400",children:i("None selected","لم يتم الاختيار")})]}),t.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white divide-y divide-gray-100",children:[t.jsx(An,{label:i("Name","الاسم"),value:p.name||"-"}),p.nameAr.trim()&&t.jsx(An,{label:i("Arabic name","الاسم بالعربية"),value:p.nameAr}),t.jsx(An,{label:i("Type","النوع"),value:p.type==="variants"?i("Has variations","له تنويعات"):i("Single product","منتج واحد")}),t.jsx(An,{label:i("Price","السعر"),value:be}),p.type!=="variants"&&p.stock.trim()&&t.jsx(An,{label:i("Stock","المخزون"),value:p.stock}),_e&&t.jsx(An,{label:i("Shipping size","حجم الشحن"),value:_e}),Fe&&t.jsx(An,{label:i("SEO","تحسين البحث"),value:i("Added","مضاف")})]})]})}),te&&oe.enabled&&t.jsx(Ub,{tr:i,isRTL:l,isRecording:oe.isRecording,isTranscribing:oe.isTranscribing,isSpeaking:oe.isSpeaking,permissionError:oe.permissionError,captureError:oe.captureError,hint:B,onMic:ye,onReplay:Ye}),x&&t.jsx("p",{className:"mt-3 text-[12px] text-red-600 leading-snug",children:x})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 px-4 py-3 bg-white border-t border-gray-200 flex-shrink-0",children:[t.jsxs("button",{type:"button",onClick:ft===0?n:G,disabled:S,className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-xl text-[13px] font-medium text-gray-600 hover:bg-gray-100 transition-colors disabled:opacity-40 cursor-pointer",children:[t.jsx(tp,{className:vt("h-4 w-4",l&&"rotate-180")}
728),ft===0?i("Cancel","إلغاء"):i("Back","رجوع")]}),g==="review"?t.jsxs("button",{type:"button",onClick:wn,disabled:S||!p.name.trim(),className:vt("inline-flex items-center gap-2 h-9 px-5 rounded-xl text-[13px] font-semibold transition-colors cursor-pointer",S||!p.name.trim()?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-900 text-white hover:bg-gray-800"),children:[S&&t.jsx(St,{className:"h-3.5 w-3.5 animate-spin"}),i("Create product","إنشاء المنتج")]}):t.jsxs("button",{type:"button",onClick:Se,disabled:!qt,className:vt("inline-flex items-center gap-1.5 h-9 px-5 rounded-xl text-[13px] font-semibold transition-colors cursor-pointer",qt?"bg-gray-900 text-white hover:bg-gray-800":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:[g==="photos"&&p.images.length===0||g==="category"&&p.categorySlugs.length===0||g==="details"&&!p.description.trim()&&!p.brand.trim()&&!p.weight.trim()&&!p.length.trim()&&!p.width.trim()&&!p.height.trim()||g==="seo"&&!Fe?i("Skip","تخطي"):i("Continue","متابعة"),t.jsx(Yc,{className:vt("h-4 w-4",l&&"rotate-180")})]})]}),t.jsx(pd,{isOpen:w,onClose:()=>C(!1),onSubmit:Ae,mode:"attach"})]})}function sn({title:e,hint:n,children:r}){return t.jsxs("div",{children:[t.jsx("h3",{className:"text-[15px] font-semibold text-gray-900 leading-snug",children:e}),n&&t.jsx("p",{className:"text-[12px] text-gray-500 mt-1 mb-3 leading-snug",children:n}),!n&&t.jsx("div",{className:"mb-3"}),r]})}function $r({label:e,value:n,onChange:r}){return t.jsxs("div",{children:[t.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:e}),t.jsx("input",{inputMode:"decimal",value:n,onChange:s=>r(s.target.value.replace(/[^\d.]/g,"")),placeholder:"0",className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-[13px] text-gray-900 placeholder-gray-400 focus:outline-none focus:border-brand-secondary focus:ring-1 focus:ring-brand-secondary/30"})]})}function Tn({loading:e,onClick:n,label:r,disabled:s,title:a}){const o=e||s;return t.jsxs("button",{type:"button",onClick:n,disabled:o,title:a,className:vt("inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-semibold transition-colors",e?"bg-brand-secondary/5 text-brand-secondary/60 cursor-wait":s?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-brand-secondary/10 text-brand-secondary hover:bg-brand-secondary/15 cursor-pointer"),children:[e?t.jsx(St,{className:"h-3 w-3 animate-spin"}):t.jsx(zt,{className:"h-3 w-3","aria-hidden":"true"}),r]})}function Ub({tr:e,isRecording:n,isTranscribing:r,isSpeaking:s,permissionError:a,captureError:o,hint:d,onMic:u,onReplay:l}){const i=a?e("Microphone is blocked. Allow access to use voice.","الميكروفون محظور. اسمح بالوصول لاستخدام الصوت."):o==="too_short"?e("That was too short. Hold and speak a moment longer.","كان ذلك قصيراً جداً. تحدث لوقت أطول قليلاً."):o==="empty"?e("I didn't hear anything. Try again.","لم أسمع شيئاً. حاول مرة أخرى."):o==="failed"?e("Sorry, I couldn't understand that. Try again.","عذراً، لم أفهم ذلك. حاول مرة أخرى."):d||(n?e("Listening… speak now, I'll stop on my own.","أستمع… تحدث الآن وسأتوقف تلقائياً."):r?e("Got it, one moment…","تم، لحظة…"):s?e("Reading the question…","أقرأ السؤال…"):e("Tap the mic and answer by voice.","اضغط الميكروفون وأجب بصوتك.")),g=a||!!o;return t.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-xl border border-brand-secondary/20 bg-brand-secondary/5 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:u,disabled:r,"aria-label":n?e("Stop recording","إيقاف التسجيل"):e("Answer by voice","أجب بصوتك"),className:vt("relative h-10 w-10 flex-shrink-0 rounded-full flex items-center justify-center transition-colors cursor-pointer",r?"bg-gray-200 text-gray-400 cursor-wait":n?"bg-red-500 text-white":"bg-brand-secondary text-white hover:bg-brand-secondary/90"),children:[n&&t.jsx("span",{className:"absolute inset-0 rounded-full bg-red-500/40 animate-ping","aria-hidden":"true"}),r?t.jsx(St,{className:"h-4 w-4 animate-spin"}):t.jsx(vr,{className:"h-4 w-4 relative"})]}),t.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[t.jsx("p",{className:vt("text-[12px] leading-snug",g?"text-red-600":"text-gray-600"),children:i}),n&&t.jsx(Gb,{})]}),t.jsx("button",{type:"button",onClick:l,"aria-label":e("Read again","إعادة القراءة"),title:e("Read again","إعادة القراءة"),className:"h-8 w-8 flex-shrink-0 rounded-lg flex items-center justify-center text-gray-400 hover:text-brand-secondary hover:bg-white transition-colors cursor-pointer",children:t.jsx(jn,{className:"h-4 w-4"})})]})}const Mb=[.45,.75,1,.75,.45];function Gb(){const[e,n]=c.useState(0);return c.useEffect(()=>Qf(n),[]),t.jsx("span",{className:"flex items-center gap-[2px] h-4 flex-shrink-0","aria-hidden":"true",children:Mb.map((r,s)=>{const a=Math.max(18,Math.min(100,e*r*130));return t.jsx("span",{className:"w-[3px] rounded-full bg-red-500 transition-[height] duration-75",style:{height:`${a}%`}},s)})})}function ki({active:e,icon:n,title:r,sub:s,onClick:a}){return t.jsxs("button",{type:"button",onClick:a,className:vt("w-full text-start rounded-xl border px-3.5 py-3 flex items-start gap-3 transition-colors cursor-pointer",e?"border-brand-secondary bg-brand-secondary/5":"border-gray-200 bg-white hover:border-brand-secondary/40 hover:bg-brand-secondary/5"),children:[t.jsx("span",{className:vt("mt-0.5 inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg",e?"bg-brand-secondary text-white":"bg-gray-100 text-gray-600"),children:t.jsx(n,{className:"h-4 w-4","aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-[13px] font-semibold text-gray-900 leading-tight",children:r}),t.jsx("span",{className:"block text-[12px] text-gray-500 leading-snug mt-0.5",children:s})]})]})}function $b({axis:e,tr:n,onChange:r,onCommit:s,onRemove:a,onSuggestValues:o,suggesting:d}){const u=Pn(e.name),l=e.valueHex||{},i=(x,v)=>{const S=e.values[x],_=e.values.map((C,k)=>k===x?v:C);if(!u){r({values:_});return}const w={...l};if(S in w){const C=w[S];delete w[S],v&&(w[v]=C)}else v&&(w[v]=Qn(v));r({values:_,valueHex:w})},g=(x,v)=>{const S=e.values[x];if(!S)return;const _={...e,valueHex:{...l,[S]:v}};r(_),s(_)},y=()=>r({values:[...e.values,""]}),p=x=>
728{if(e.values.map(C=>C.trim().toLowerCase()).includes(x.name.toLowerCase()))return;const _=[...e.values.filter(C=>C.trim()),x.name],w={...e,values:_,valueHex:{...l,[x.name]:x.hex}};r(w),s(w)},f=x=>{const v=e.values[x],S=e.values.filter((C,k)=>k!==x),_={...l};v in _&&delete _[v];const w={...e,values:S.length>0?S:[""],valueHex:_};r(w),s(w)};return t.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-3",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(Va,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0"}),t.jsx("input",{value:e.name,onChange:x=>r({name:x.target.value}),onBlur:()=>s(e),placeholder:n("Option name (e.g. Size)","اسم الخيار (مثل المقاس)"),className:"flex-1 min-w-0 text-[13px] font-medium text-gray-900 placeholder-gray-400 focus:outline-none"}),o&&t.jsx(Tn,{loading:d,onClick:o,label:n("Values","القيم")}),a&&t.jsx("button",{type:"button",onClick:a,"aria-label":n("Remove option","إزالة الخيار"),className:"h-6 w-6 rounded-md flex items-center justify-center text-gray-400 hover:text-red-500 hover:bg-red-50 transition-colors cursor-pointer",children:t.jsx(np,{className:"h-3.5 w-3.5"})})]}),t.jsx("input",{dir:"rtl",value:e.nameAr||"",onChange:x=>r({nameAr:x.target.value}),onBlur:()=>s(e),placeholder:n("Option name in Arabic (optional)","اسم الخيار بالعربية (اختياري)"),className:"w-full mb-2 rounded-lg border border-gray-100 bg-gray-50 px-2 py-1 text-[12px] text-gray-700 placeholder-gray-400 focus:outline-none focus:border-brand-secondary"}),u?t.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.values.map((x,v)=>t.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border border-gray-200 bg-gray-50 ps-1.5 pe-1 py-1",children:[t.jsx("input",{type:"color",value:/^#[0-9a-fA-F]{6}$/.test(l[x]||"")?l[x]:Qn(x),onChange:S=>g(v,S.target.value),"aria-label":n("Pick color","اختر اللون"),className:"h-6 w-6 flex-shrink-0 cursor-pointer rounded border border-gray-200 bg-white p-0"}),t.jsx("input",{value:x,onChange:S=>i(v,S.target.value),onBlur:()=>s(e),placeholder:n("Color name","اسم اللون"),className:"flex-1 min-w-0 bg-transparent text-[12px] text-gray-800 placeholder-gray-400 focus:outline-none"}),t.jsx("span",{className:"text-[10px] font-mono text-gray-400",children:(l[x]||Qn(x)).toUpperCase()}),e.values.length>1&&t.jsx("button",{type:"button",onClick:()=>f(v),"aria-label":n("Remove value","إزالة القيمة"),className:"h-4 w-4 rounded flex items-center justify-center text-gray-400 hover:text-red-500 cursor-pointer",children:t.jsx(Ft,{className:"h-3 w-3"})})]},v)),t.jsxs("div",{className:"flex flex-wrap gap-1 pt-0.5",children:[md.map(x=>{const v=e.values.map(S=>S.trim().toLowerCase()).includes(x.name.toLowerCase());return t.jsx("button",{type:"button",onClick:()=>p(x),disabled:v,title:x.name,"aria-label":x.name,className:vt("h-5 w-5 rounded-full ring-1 ring-black/10 transition-transform cursor-pointer",v?"opacity-30 cursor-not-allowed":"hover:scale-110"),style:{backgroundColor:x.hex}},x.name)}),t.jsxs("button",{type:"button",onClick:y,className:"inline-flex items-center gap-1 rounded-lg border border-dashed border-gray-300 px-2 py-0.5 text-[11px] text-gray-500 hover:border-brand-secondary/50 hover:text-brand-secondary transition-colors cursor-pointer",children:[t.jsx(Xn,{className:"h-3 w-3"}),n("Custom","مخصص")]})]})]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.values.map((x,v)=>t.jsxs("div",{className:"inline-flex items-center gap-1 rounded-lg border border-gray-200 bg-gray-50 ps-2 pe-1 py-1",children:[t.jsx("input",{value:x,onChange:S=>i(v,S.target.value),onBlur:()=>s(e),placeholder:n("Value","قيمة"),className:"w-20 bg-transparent text-[12px] text-gray-800 placeholder-gray-400 focus:outline-none"}),e.values.length>1&&t.jsx("button",{type:"button",onClick:()=>f(v),"aria-label":n("Remove value","إزالة القيمة"),className:"h-4 w-4 rounded flex items-center justify-center text-gray-400 hover:text-red-500 cursor-pointer",children:t.jsx(Ft,{className:"h-3 w-3"})})]},v)),t.jsxs("button",{type:"button",onClick:y,className:"inline-flex items-center gap-1 rounded-lg border border-dashed border-gray-300 px-2 py-1 text-[12px] text-gray-500 hover:border-brand-secondary/50 hover:text-brand-secondary transition-colors cursor-pointer",children:[t.jsx(Xn,{className:"h-3 w-3"}),n("Add value","إضافة قيمة")]})]})]})}function An({label:e,value:n}){return t.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2.5",children:[t.jsx("span",{className:"text-[12px] text-gray-500",children:e}),t.jsx("span",{className:"text-[13px] font-medium text-gray-900 text-end truncate max-w-[60%]",children:n})]})}const Vb=c.memo(Lb),Fb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-D4IzcURd.mp3",zb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-BOk4eFMY.mp3",Wb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-BEuVUv27.mp3",Bb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-C1MKGUWE.mp3",qb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-tV-ODCcZ.mp3",Kb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-CIiesZrB.mp3",Hb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-D6_OMiCu.mp3",Yb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-gUGHnOqS.mp3",Qb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-Y9CS5r7P.mp3",Xb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-Bdp_vbzY.mp3",Jb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-Br4UTyau.mp3",Zb="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-m3qR-31f.mp3",ex="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-CoGPRa4Y.mp3",tx="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-DHa-m65m.mp3",nx="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-DjQeNFh6.mp3",rx="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-DofS_tHw.mp3",sx="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-ar-CMrpBWBZ.mp3",ax="https://cdn.packman.ai/seller-dashboard-static-assets/assets/preview-en-DFVcyqeP.mp3",Qr=["language","dialect","gender","age"],ox={ar:"Arabic",en:"English"},ix={male:"Male",female:"Female"},cx={young:"Young",middle:"Middle aged",elderly:"Elderly"},lx={fusha:"Standard Arabic",emirati:"Emirati",najdi:"Saudi (Najdi)",hijazi:"Hijazi",omani:"Omani",kuwaiti:"Kuwaiti",qatari:"Qatari",bahraini:"Bahraini",egyptian:"Egyptian",american:"American English",british:"British English",australian:"Australian English",indian:"Indian English"},dx={ar:"العربية",en:"الإنجليزية"},ux={male:"ذكر",female:"أنثى"},px={young:"شاب",middle:"متوسط العمر",elderly:"كبير السن"},mx={fusha:"العربية الفصحى",emirati:"إماراتي",najdi:"سعودي (نجدي)",hijazi:"حجازي",omani:"عُماني",kuwaiti:"كويتي",qatari:"قطري",bahraini:"بحريني",egyptian:"مصري",american:"الإنجليزية الأمريكية",british:"الإنجليزية البريطانية",australian:"الإنجليزية الأسترالية",indian:"الإنجليزية الهندية",ireland:"أيرلندي",irish:"أيرلندي",canadian:"كندي"},Ws={en:{language:ox,gender:ix,age:cx,dialect:lx},ar:{language:dx,gender:ux,age:px,dialect:mx}},gx={emirati:"🇦🇪",najdi:"🇸🇦",hijazi:"🇸🇦",omani:"🇴🇲",kuwaiti:"🇰🇼",qatari:"🇶🇦",bahraini:"🇧🇭",egyptian:"🇪🇬",american:"🇺🇸",british:"🇬🇧",australian:"🇦🇺",indian:"🇮🇳",ireland:"🇮🇪",irish:"🇮🇪",canadian:"🇨🇦"},hx={ar:"🇸🇦",en:"🇬🇧"},fx=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),yx=(e,n)=>n?e==="dialect"?gx[n]||"":e==="language"&&hx[n]||"":"",Ta=(e,n,r="en")=>{if(!n)return"";const s=Ws[r]&&Ws[r][e]||{},a=Ws.en[e]||{},o=e==="language"?n.toUpperCase():fx(n);return s[n]||a[n]||o},Ti=(e,n,r="en")=>{const s=Ta(e,n,r),a=yx(e,n);return a?`${a} ${s}`:s}
728,Xr=(e,n)=>n==="language"?e.languages||[]:n==="dialect"?e.dialect||[]:n==="gender"?e.gender?[e.gender]:[]:n==="age"?e.age?[e.age]:[]:[],Bs=(e,n,r)=>Qr.every(s=>{if(s===r)return!0;const a=n[s];return a?Xr(e,s).includes(a):!0}),bx=(e,n)=>{const r=String(e||"").toLowerCase();return r==="female"?n?"bg-rose-500 text-white":"bg-rose-500/10 text-rose-600":r==="male"?n?"bg-sky-500 text-white":"bg-sky-500/10 text-sky-600":n?"bg-brand-secondary text-white":"bg-brand-secondary/10 text-brand-secondary"},Vr=(()=>{const e=Object.assign({"../../assets/tour-voice/voice/08XOzRjaaumxbHhcGOrWkJ7z/preview-ar.mp3":Fb,"../../assets/tour-voice/voice/08XOzRjaaumxbHhcGOrWkJ7z/preview-en.mp3":zb,"../../assets/tour-voice/voice/8jo3glQpNtAdvRHIyNN8now2/preview-ar.mp3":Wb,"../../assets/tour-voice/voice/8jo3glQpNtAdvRHIyNN8now2/preview-en.mp3":Bb,"../../assets/tour-voice/voice/DsNnaed3aGVyZZ8iFgXDK0gS/preview-ar.mp3":qb,"../../assets/tour-voice/voice/DsNnaed3aGVyZZ8iFgXDK0gS/preview-en.mp3":Kb,"../../assets/tour-voice/voice/EZ1NOlAh6RxcdjoY9FMgYdW3/preview-ar.mp3":Hb,"../../assets/tour-voice/voice/EZ1NOlAh6RxcdjoY9FMgYdW3/preview-en.mp3":Yb,"../../assets/tour-voice/voice/PCtWbxjoNTpVQ6gIPaVZ2Hqm/preview-ar.mp3":Qb,"../../assets/tour-voice/voice/PCtWbxjoNTpVQ6gIPaVZ2Hqm/preview-en.mp3":Xb,"../../assets/tour-voice/voice/SyU41Fvh3zAI9ZRf81uuTYQ4/preview-ar.mp3":Jb,"../../assets/tour-voice/voice/SyU41Fvh3zAI9ZRf81uuTYQ4/preview-en.mp3":Zb,"../../assets/tour-voice/voice/WcxyRPjVQcpVYmceBQO4Helb/preview-ar.mp3":ex,"../../assets/tour-voice/voice/WcxyRPjVQcpVYmceBQO4Helb/preview-en.mp3":tx,"../../assets/tour-voice/voice/ulkuraWveBdoDMxtdvYHkzrr/preview-ar.mp3":nx,"../../assets/tour-voice/voice/ulkuraWveBdoDMxtdvYHkzrr/preview-en.mp3":rx,"../../assets/tour-voice/voice/ybQaNl0nzt9TjN3Oh1zzyNgp/preview-ar.mp3":sx,"../../assets/tour-voice/voice/ybQaNl0nzt9TjN3Oh1zzyNgp/preview-en.mp3":ax}),n={};for(const[r,s]of Object.entries(e)){const a=/tour-voice\/voice\/([^/]+)\/preview-(ar|en)\.mp3$/.exec(r);if(!a)continue;const[,o,d]=a;n[o]||(n[o]={}),n[o][d]=s}return n})();function xx({voice:e,t:n={},isRTL:r=!1,systemCountry:s}){const a=r?"ar":"en",o=e?.voices||[],d=e?.dialectByCountry||{},u=e?.voicePrefs||{},[l,i]=c.useState(()=>({language:u.language||"",dialect:u.dialect||"",gender:u.gender||"",age:u.age||""}));c.useEffect(()=>{if(!o.length||l.language||l.dialect||l.gender||l.age)return;const E=String(s||"").toLowerCase(),j=d[E]||"",H=r?"ar":"en",D=o.some($=>($.languages||[]).includes(H));i($=>({...$,language:D?H:"",dialect:j&&o.some(re=>(re.dialect||[]).includes(j))?j:""}))},[o.length]);const g=E=>{const j=new Set;return o.forEach(H=>{Bs(H,l,E)&&Xr(H,E).forEach(D=>j.add(D))}),Array.from(j).sort()},y=c.useMemo(()=>o.filter(E=>Bs(E,l)),[o,l.language,l.dialect,l.gender,l.age]),p=(E,j)=>{i(H=>{const D={...H,[E]:j};Qr.forEach(te=>{if(te===E||!D[te])return;o.some(B=>Xr(B,te).includes(D[te])&&Qr.every(U=>U===te||!D[U]?!0:Xr(B,U).includes(D[U])))||(D[te]="")});const $=(e?.voicePrefs&&typeof e.voicePrefs.voiceId=="string"?e.voicePrefs.voiceId:"")||"",re=$&&o.find(te=>te.voiceId===$)||null,pe=re&&Bs(re,D)?$:"";return e.setVoicePrefs({language:D.language,dialect:D.dialect,gender:D.gender,age:D.age,voiceId:pe}),D})},f=()=>i({language:"",dialect:"",gender:"",age:""}),x=E=>{e.setVoicePrefs({language:l.language,dialect:l.dialect,gender:l.gender,age:l.age,voiceId:E.voiceId})},v=c.useRef(null),[S,_]=c.useState(""),w=()=>{v.current&&(v.current.pause(),v.current=null)};c.useEffect(()=>()=>{w()},[]);const C=async E=>{if(!E?.voiceId)return;const j=l.language==="ar"||l.language==="en"?l.language:a,H=Vr[E.voiceId]?.[j]||Vr[E.voiceId]?.ar||"";if(!H)return;if(S===E.voiceId&&v.current){w(),_("");return}w();const D=new Audio(H);D.onended=()=>{w(),_("")},D.onerror=()=>{w(),_("")},v.current=D,_(E.voiceId),await D.play().catch(()=>{_("")})},k={language:n.t_voice_facet_language||"Language",dialect:n.t_voice_facet_dialect||"Dialect",gender:n.t_voice_facet_gender||"Gender",age:n.t_voice_facet_age||"Age"},L=l.language||l.dialect||l.gender||l.age,A=u.voiceId||"";return o.length?t.jsxs("div",{dir:r?"rtl":"ltr",className:"flex flex-col gap-3",children:[t.jsx("div",{className:"grid grid-cols-2 gap-2",children:Qr.map(E=>{const j=g(E);return t.jsxs("label",{className:"flex flex-col gap-1",children:[t.jsx("span",{className:"text-[11px] font-medium text-gray-500",children:k[E]}),t.jsxs("select",{value:l[E],onChange:H=>p(E,H.target.value),className:"h-8 cursor-pointer rounded-lg border border-gray-200 bg-white px-2 text-xs font-medium text-gray-800 transition-colors hover:border-brand-secondary/50 focus:border-brand-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/40",children:[t.jsx("option",{value:"",children:n.t_voice_facet_any||"Any"}),j.map(H=>t.jsx("option",{value:H,children:Ti(E,H,a)},H))]})]},E)})}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-[11px] font-medium text-gray-500",children:[t.jsx("span",{className:"text-brand-secondary",children:y.length})," ",y.length===1?n.t_voice_count_one||"voice":n.t_voice_count_many||"voices"]}),L?t.jsxs("button",{type:"button",onClick:f,className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-semibold text-brand-secondary transition hover:bg-brand-secondary/10",children:[t.jsx(Xc,{className:"h-3 w-3"}),n.t_voice_reset||"Reset"]}):null]}),t.jsx("div",{className:"max-h-56 overflow-y-auto rounded-xl border border-gray-100 divide-y divide-gray-100",children:y.length===0?t.jsx("p",{className:"px-3 py-4 text-center text-xs text-gray-400",children:n.t_voice_none_match||"No voices match these filters. Try resetting."}):y.map(E=>{const j=E.voiceId===A,H=S===E.voiceId,D=l.language==="ar"||l.language==="en"?l.language:a,$=!!(Vr[E.voiceId]?.[D]||Vr[E.voiceId]?.ar),re=[E.gender?Ta("gender",E.gender,a):null,E.dialect?.[0]?Ti("dialect",E.dialect[0],a):null,E.age?Ta("age",E.age,a):null].filter(
728Boolean).join(" · ");return t.jsxs("div",{className:`flex items-center gap-2.5 px-2.5 py-2 transition-colors ${j?"bg-brand-secondary/[0.07] shadow-[inset_3px_0_0_0_var(--brand-secondary)]":"hover:bg-gray-50"}`,children:[t.jsx("button",{type:"button",onClick:()=>C(E),"aria-label":n.t_voice_preview||"Preview voice",disabled:!$,className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full transition hover:brightness-95 disabled:cursor-not-allowed disabled:opacity-50 ${bx(E.gender,H)}`,children:H?t.jsx(rp,{className:"h-3.5 w-3.5"}):t.jsx(sp,{className:"h-3.5 w-3.5"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-xs font-semibold text-gray-900",children:E.name}),re?t.jsx("p",{className:"truncate text-[10px] text-gray-400",children:re}):null]}),t.jsx("button",{type:"button",onClick:()=>x(E),className:`flex-shrink-0 rounded-lg px-2.5 py-1 text-[11px] font-semibold transition ${j?"bg-brand-secondary text-white shadow-sm":"border border-gray-200 text-gray-600 hover:border-brand-secondary hover:bg-brand-secondary/5 hover:text-brand-secondary"}`,children:j?t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(Dn,{className:"h-3 w-3"}),n.t_voice_selected||"Selected"]}):n.t_voice_use||"Use"})]},E.voiceId)})}),e.chatVoiceEnabled&&td()&&t.jsxs("button",{type:"button",onClick:()=>e.setWakeWord?.(!e.wakeWordEnabled),"aria-pressed":!!e.wakeWordEnabled,className:"flex items-center gap-2.5 rounded-xl border border-gray-100 px-2.5 py-2 text-left transition-colors hover:bg-gray-50",children:[t.jsx("span",{className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full ${e.wakeWordEnabled?"bg-brand-secondary text-white":"bg-brand-secondary/10 text-brand-secondary"}`,children:t.jsx(vr,{className:"h-3.5 w-3.5"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-xs font-semibold text-gray-900",children:n.t_wake_word_title||'Hands-free "Hey Packman"'}),t.jsx("p",{className:"truncate text-[10px] text-gray-400",children:n.t_wake_word_desc||'Say "Hey Packman" to open the chat and talk.'})]}),t.jsx("span",{className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors ${e.wakeWordEnabled?"bg-brand-secondary":"bg-gray-200"}`,children:t.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white shadow transition-all ${e.wakeWordEnabled?r?"left-0.5":"left-[1.125rem]":r?"left-[1.125rem]":"left-0.5"}`})})]})]}):t.jsx("div",{dir:r?"rtl":"ltr",className:"px-1 py-3 text-center",children:t.jsx("p",{className:"text-xs text-gray-500",children:n.t_voice_settings_unavailable||"Voice options are not available right now. Please try again later."})})}const Ci={photo:"bg-violet-100 text-violet-700",sky:"bg-sky-100 text-sky-700",emerald:"bg-emerald-100 text-emerald-700",indigo:"bg-indigo-100 text-indigo-700",cyan:"bg-cyan-100 text-cyan-700",blue:"bg-blue-100 text-blue-700",fuchsia:"bg-fuchsia-100 text-fuchsia-700",warning:"bg-amber-100 text-amber-700",muted:"bg-gray-100 text-gray-500"},_x=/(?:\p{Extended_Pictographic}|\u200D|\uFE0F)/gu,Fr=e=>!e||typeof e!="string"?e:e.replace(_x,"").replace(/[ \t]+(\n|$)/g,"$1").replace(/\n{3,}/g,`
729
730`).trim(),ji=[{label:"Analytics & Data",key:"analytics",labelKey:"t_ai_chat_welcome_analytics"},{label:"Inventory Management",key:"inventory",labelKey:"t_ai_chat_welcome_inventory"},{label:"Order Processing",key:"orders",labelKey:"t_ai_chat_welcome_orders"},{label:"Customer Insights",key:"customers",labelKey:"t_ai_chat_welcome_customers"},{label:"Cart Recovery",key:"carts",labelKey:"t_ai_chat_welcome_carts"},{label:"How-to Guides",key:"help",labelKey:"t_ai_chat_welcome_help"}];function Cn(e,n){if(!e)return[e];const r=n||{k:0},s=e.match(/^\*([^*][\s\S]*[^*])\*$/);if(s&&s[1].includes("**"))return[t.jsx("em",{className:"italic text-gray-500",children:Cn(s[1],r)},r.k++)];const a=[],o=/\*\*(.+?)\*\*|`([^`]+?)`|!\[([^\]]*?)\]\(([^)]+?)\)|\[([^\]]+?)\]\(([^)]+?)\)/g;let d=0,u;for(;(u=o.exec(e))!==null;){if(u.index>d&&a.push(...Ii(e.slice(d,u.index),r)),u[1]!==void 0)a.push(t.jsx("strong",{className:"font-semibold",children:Cn(u[1],r)},r.k++));else if(u[2]!==void 0)a.push(t.jsx("code",{className:"bg-gray-100 text-gray-800 px-1 py-0.5 rounded text-[11px] font-mono",children:u[2]},r.k++));else if(u[4]!==void 0){const l=u[4];/^https:\/\//i.test(l)&&a.push(t.jsx("button",{type:"button",onClick:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("packman-chat:view-image",{detail:{src:l,alt:u[3]||""}}))},className:"my-1 me-1.5 inline-block h-[88px] w-[88px] overflow-hidden rounded-lg border border-gray-100 bg-gray-50 align-top transition-opacity hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-brand-secondary/40",children:t.jsx("img",{src:l,alt:u[3]||"",loading:"lazy",className:"h-full w-full object-cover",onError:i=>{const g=i.currentTarget.closest("button");
730g&&(g.style.display="none")}})},r.k++))}else if(u[5]!==void 0&&u[6]!==void 0){const l=u[6];l==="__packman_attach_image__"||l==="__packman_attach_logo__"?a.push(t.jsx("button",{type:"button",onClick:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("packman-chat:request-upload",{detail:{purpose:l==="__packman_attach_logo__"?"store_logo":"product"}}))},className:"inline-flex items-center gap-1 rounded-md bg-brand-secondary/10 px-2 py-0.5 text-[12px] font-semibold text-brand-secondary hover:bg-brand-secondary/15 transition-colors align-baseline",children:u[5]},r.k++)):a.push(t.jsx("a",{href:l,className:"text-brand-secondary hover:underline font-medium",target:l.startsWith("/")?"_self":"_blank",rel:l.startsWith("/")?void 0:"noopener noreferrer",children:u[5]},r.k++))}d=u.index+u[0].length}return d<e.length&&a.push(...Ii(e.slice(d),r)),a.length>0?a:[e]}function Ii(e,n){if(!e)return[];const r=[],s=/(?<!\*)\*(?!\*)([^*]+?)(?<!\*)\*(?!\*)/g;let a=0,o;for(;(o=s.exec(e))!==null;)o.index>a&&r.push(e.slice(a,o.index)),r.push(t.jsx("em",{className:"italic text-gray-500",children:o[1]},n.k++)),a=o.index+o[0].length;return a<e.length&&r.push(e.slice(a)),r}function wx(e){const n=e.lastIndexOf(`
731`)+1,r=e.slice(n);return/^!\s*$/.test(r)||/^!\[[^\]]*$/.test(r)||/^!\[[^\]]*\]\s*$/.test(r)||/^!\[[^\]]*\]\([^)]*$/.test(r)?e.slice(0,n).trimEnd():e}const fd=c.memo(({text:e,isUser:n,isStreaming:r,isRTL:s=!1})=>{const a=c.useMemo(()=>{if(!e)return null;if(n)return t.jsx("p",{className:"text-[13px] whitespace-pre-wrap leading-relaxed",children:e});const o=r?wx(e):e;if(!o)return null;const d=o.split(`
732`),u=[];let l=[],i=null,g=0;const y=()=>{if(l.length===0)return;const v=i==="ol"?"ol":"ul",S=i==="ol"?`list-decimal list-inside space-y-0.5 text-[13px] leading-relaxed my-1 ${s?"text-right":""}`:`list-disc list-inside space-y-0.5 text-[13px] leading-relaxed my-1 ${s?"text-right":""}`;u.push(t.jsx(v,{className:S,children:l.map((_,w)=>t.jsx("li",{children:Cn(_)},w))},g++)),l=[],i=null},p=()=>{u.push(t.jsx("hr",{className:"border-t border-gray-100 my-2"},g++))};let f=[];const x=()=>{f.length!==0&&(u.push(t.jsx("div",{className:"my-2 grid w-full max-w-[360px] grid-cols-4 gap-2","aria-label":"Product images",children:f.map((v,S)=>t.jsx("button",{type:"button",onClick:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("packman-chat:view-image",{detail:{src:v.src,alt:v.alt}}))},"aria-label":v.alt?`View ${v.alt}`:"View image",className:"aspect-square cursor-zoom-in overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm transition-[border-color,box-shadow,opacity] duration-200 hover:border-brand-secondary/30 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-brand-secondary/40",children:t.jsx("img",{src:v.src,alt:v.alt,loading:"lazy",className:"h-full w-full object-contain p-1",onError:_=>{const w=_.currentTarget.closest("button");w&&(w.style.display="none")}})},S))},g++)),f=[])};for(const v of d){const S=v.trim(),_=S.match(/^!\[([^\]]*)\]\((https:\/\/[^)\s]+)\)$/i);if(_){y(),f.push({alt:_[1]||"",src:_[2]});continue}if(S===""){if(f.length>0)continue;y(),u.push(t.jsx("div",{className:"h-1.5"},g++));continue}if(x(),/^-{3,}$/.test(S)){y(),p();continue}const w=S.match(/^#{1,3}\s+(.+)$/);if(w){y(),u.push(t.jsx("p",{className:"text-[13px] font-semibold leading-relaxed mt-0.5 mb-0.5",children:Cn(w[1])},g++));continue}if(S.match(/^\d+\)\s+\*\*(.+?)\*\*(.*)$/)){y(),u.push(t.jsx("p",{className:"text-[13px] font-semibold leading-relaxed mt-0.5 mb-0.5",children:Cn(S)},g++));continue}if(!S.startsWith("-")&&!S.startsWith("•")&&/^\*\*[^*]+\*\*\s*$/.test(S)){y(),u.push(t.jsx("p",{className:"text-[13px] font-semibold leading-relaxed mt-0.5 mb-0.5",children:Cn(S)},g++));continue}const L=S.match(/^[-•]\s+(.+)$/);if(L){i==="ol"&&y(),i="ul",l.push(L[1]);continue}const A=S.match(/^\d+[.)]\s+(.+)$/);if(A){i==="ul"&&y(),i="ol",l.push(A[1]);continue}y(),u.push(t.jsx("p",{className:"text-[13px] leading-relaxed",children:Cn(S)},g++))}return y(),x(),u},[e,n,r,s]);return t.jsx("div",{dir:s?"rtl":"ltr",className:`space-y-0 ${s?"text-right":"text-left"}`,style:s?{unicodeBidi:"plaintext"}:void 0,children:a})});fd.displayName="ChatMarkdown";const Ri=[{text:"Add a new product",iKey:"t_ai_chat_add_new_product",Icon:Xn,query:"How do I add a new product?",queryIKey:"t_ai_chat_query_add_new_product",cat:"products"},{text:"Edit a product",iKey:"t_ai_chat_edit_product",Icon:Jc,query:"How do I edit an existing product?",queryIKey:"t_ai_chat_query_edit_product",cat:"products"},{text:"Product variants",iKey:"t_ai_chat_product_variants",Icon:Ua,query:"How do I add colors and sizes (variants) to a product?",queryIKey:"t_ai_chat_query_product_variants",cat:"products"},{text:"Product categories",iKey:"t_ai_chat_product_categories",Icon:ap,query:"How do I organize my products into categories?",queryIKey:"t_ai_chat_query_product_categories",cat:"products"},{text:"Bulk import products",iKey:"t_ai_chat_bulk_import_products",Icon:$a,query:"How do I bulk import products from a file?",queryIKey:"t_ai_chat_query_bulk_import_products",cat:"products"},{text:"Product images",iKey:"t_ai_chat_product_images",Icon:Ln,query:"What is the best way to add and arrange product images?",queryIKey:"t_ai_chat_query_product_images",cat:"products"},{text:"Sales last 7 days",iKey:"t_ai_chat_sales_last_7_days",Icon:cs,query:"Show me sales from the last 7 days",queryIKey:"t_ai_chat_query_sales_last_7_days",cat:"analytics"},{text:"Revenue today",iKey:"t_ai_chat_revenue_today",Icon:ra,query:"How much revenue did I make today?",queryIKey:"t_ai_chat_query_revenue_today",cat:"analytics"},{text:"Top products",iKey:"t_ai_chat_top_products",Icon:op,query:"What are my top selling products?",queryIKey:"t_ai_chat_query_top_products",cat:"analytics"},{text:"Low stock",iKey:"t_ai_chat_low_stock",Icon:Zn,query:"Which products are low in stock?",queryIKey:"t_ai_chat_query_low_stock",cat:"inventory"}
732,{text:"Stock levels",iKey:"t_ai_chat_stock_levels",Icon:ip,query:"Give me an overview of my current stock levels",queryIKey:"t_ai_chat_query_stock_levels",cat:"inventory"},{text:"Pending orders",iKey:"t_ai_chat_pending_orders",Icon:cp,query:"Show me pending orders",queryIKey:"t_ai_chat_query_pending_orders",cat:"orders"},{text:"Abandoned carts",iKey:"t_ai_chat_abandoned_carts",Icon:La,query:"How many abandoned carts do I have?",queryIKey:"t_ai_chat_query_abandoned_carts",cat:"orders"},{text:"Top customers",iKey:"t_ai_chat_top_customers",Icon:lp,query:"Who are my top customers?",queryIKey:"t_ai_chat_query_top_customers",cat:"customers"},{text:"Setup shipping",iKey:"t_ai_chat_setup_shipping",Icon:dp,query:"How to configure shipping?",queryIKey:"t_ai_chat_query_setup_shipping",cat:"help"},{text:"Setup SEO",iKey:"t_ai_chat_setup_seo",Icon:is,query:"How to set up SEO for my store?",queryIKey:"t_ai_chat_query_setup_seo",cat:"help"},{text:"Connect domain",iKey:"t_ai_chat_connect_domain",Icon:as,query:"How to connect a custom domain?",queryIKey:"t_ai_chat_query_connect_domain",cat:"help"}],vx=[{key:"all",label:"All",labelKey:"t_ai_chat_category_all",Icon:zt},{key:"products",label:"Products",labelKey:"t_ai_chat_category_products",Icon:Ln},{key:"analytics",label:"Analytics",labelKey:"t_ai_chat_category_analytics",Icon:cs},{key:"inventory",label:"Inventory",labelKey:"t_ai_chat_category_inventory",Icon:Zn},{key:"orders",label:"Orders",labelKey:"t_ai_chat_category_orders",Icon:Zc},{key:"customers",label:"Customers",labelKey:"t_ai_chat_category_customers",Icon:el},{key:"help",label:"Help",labelKey:"t_ai_chat_category_help",Icon:za}],Ca=c.memo(({onChipClick:e,isLoading:n,t:r,isRTL:s})=>{const[a,o]=c.useState("all"),d=a==="all"?Ri:Ri.filter(u=>u.cat===a);return t.jsxs("div",{className:"space-y-2",dir:s?"rtl":"ltr",children:[t.jsx("div",{className:`flex flex-wrap gap-1.5 ${s?"flex-row-reverse justify-start":""}`,children:vx.map(u=>{const l=u.Icon,i=a===u.key;return t.jsxs("button",{onClick:()=>o(u.key),className:`inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-full whitespace-nowrap transition-all font-medium leading-none ${i?"bg-gray-900 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"} ${s?"flex-row-reverse":""}`,children:[t.jsx(l,{className:"h-3 w-3","aria-hidden":"true"}),r?.[u.labelKey]||u.label]},u.key)})}),t.jsx("div",{className:`flex flex-wrap gap-1.5 ${s?"flex-row-reverse justify-start":""}`,children:d.map(u=>{const l=u.Icon,i=u.iKey&&r?.[u.iKey]||u.text,g=u.queryIKey&&r?.[u.queryIKey]||u.query;return t.jsxs("button",{onClick:()=>e(g),disabled:n,className:`text-[12px] h-7 px-2.5 rounded-md border transition-all disabled:opacity-40 inline-flex items-center gap-1.5 font-medium shadow-[0_0.5px_1px_rgba(0,0,0,0.04)] bg-white border-gray-200 text-gray-700 hover:border-gray-300 hover:bg-gray-50 ${s?"flex-row-reverse text-right":""}`,children:[l&&t.jsx(l,{className:"h-3 w-3 text-gray-500","aria-hidden":"true"}),i]},u.query)})})]})});Ca.displayName="CompactSuggestions";const Ex={analytics:cs,inventory:Zn,orders:Zc,customers:el,carts:La,help:za},Sx={analytics:"t_ai_chat_welcome_analytics",inventory:"t_ai_chat_welcome_inventory",orders:"t_ai_chat_welcome_orders",customers:"t_ai_chat_welcome_customers",carts:"t_ai_chat_welcome_carts",help:"t_ai_chat_welcome_help"},yd=c.memo(({message:e,isUser:n,onActionClick:r,isRTL:s,t:a,canSpeak:o,isSpeaking:d,playingId:u,onPlay:l,onStop:i,onConfirmWrite:g,onCancelWrite:y,onCreateOption:p,onOpenProduct:f,confirmStatus:x})=>{const v=(e?.meta?.actions||[]).filter(R=>R?.type!=="navigate"&&R?.type!=="focus_tour_step"),S=v.find(R=>R?.type==="confirm_write"),_=x||e?.meta?.confirmResolved,w=v.filter(R=>R?.type==="create_product_option"),C=v.filter(R=>R?.type==="product_card"),k=v.filter(R=>R?.type!=="confirm_write"&&R?.type!=="create_product_option"&&R?.type!=="product_card"),L=Array.isArray(e?.meta?.welcomeItems)?e.meta.welcomeItems:null,A=Array.isArray(e?.attachments)?e.attachments:[],E=!!(e.content&&String(e.content).trim().length>0),j=u===e.id,H=j&&d,D=j&&!d,$=c.useMemo(()=>e?._restored?null:v.find(R=>R?.type==="start_product_from_image"),[v,e?._restored]),re=n&&A.length>0&&!E,pe=!n&&!!e?._streaming,te=re?"rounded-2xl p-0 bg-transparent":`rounded-2xl ${A.length>0?"p-2":"px-3.5 py-2.5"} ${n?`bg-gray-900 text-white ${s?"rounded-bl-sm":"rounded-br-sm"}`:`bg-white text-gray-900 ${pe?"packman-animated-border-inner":"border border-gray-100 shadow-sm"} ${s?"rounded-br-sm":"rounded-bl-sm"}`}`;return t.jsxs("div",{className:`flex ${n?"justify-end":"justify-start"} mb-3 ${!n&&s?"flex-row-reverse":""}`,children:[!n&&t.jsx("div",{className:`packman-talking-target h-7 w-7 rounded-full overflow-hidden ${s?"ml-2":"mr-2"} flex-shrink-0 mt-0.5 ring-2 ring-white shadow-sm`,children:t.jsx("img",{src:tr,alt:"AI",className:"w-full h-full object-cover"})}),t.jsx("div",{className:pe?"packman-animated-border max-w-[85%]":"max-w-[85%]",style:pe?{"--packman-animated-border-radius":"1rem"}:void 0,children:t.jsxs("div",{className:te,children:[A.length>0&&t.jsx("div",{className:`grid gap-1 ${A.length===1?"grid-cols-1":"grid-cols-2"} ${E?"mb-1.5":""}`,children:A.map((R,B)=>{const U=R._uploading?R.previewUrl||R.url:R.url||R.previewUrl;return t.jsxs("div",{className:`relative overflow-hidden ${re?"rounded-2xl ring-1 ring-black/5 shadow-sm":"rounded-lg bg-black/5"}`,children:[t.jsx("img",{src:U,alt:R.name||`attachment-${B}`,className:"w-full h-32 object-cover"}),R._uploading&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:t.jsx(St,{className:"h-4 w-4 text-white animate-spin"})})]},R.url||R.previewUrl||B)})}),(E||e._streaming)&&t.jsx("div",{className:A.length>0?"px-1.5 pb-1":"",children:t.jsx(fd,{text:e.content,isUser:n,isStreaming:e._streaming,isRTL:s})}),!n&&L&&L.length>0&&t.jsx("ul",{className:`mt-1 mb-0.5 space-y-1 ${s?"text-right":""}`,children:L.map((R,B)=>{const U=Ex[R.key];return t.jsxs("li",{className:`flex w-full items-center gap-2 text-[13px] text-gray-800 leading-snug ${s?"flex-row-reverse text-right justify-start":""}`,children:[U&&t.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-md bg-gray-100 text-gray-600",children:t.jsx(U,{className:"h-3 w-3","aria-hidden":"true"})}),t.jsx("span",{children:a?.[R.labelKey||Sx[R.key]]||R.label})]},R.key||B)})}),!n&&E&&!pe&&o&&t.jsx("div",{className:`mt-1.5 flex ${s?"justify-end":"justify-start"}`,children:t.jsxs("button",{type:"button",onClick:()=>H?i?.():l?.(e.id,e.content),className:"inline-flex items-center gap-1 h-6 px-2 rounded-full text-[11px] text-gray-500 hover:text-brand-secondary hover:bg-brand-secondary/5 transition-colors",title:H?a?.t_voice_stop||"Stop":a?.t_voice_listen||"Listen",children:[D?t.jsx(St,{className:"h-3.5 w-3.5 animate-spin"}):H?t.jsx(tl,{className:"h-3 w-3"}):t.jsx(jn,{className:"h-3.5 w-3.5"}),H?a?.t_voice_stop||"Stop":a?.t_voice_listen||"Listen"]})}),!n&&$&&t.jsx("div",{className:E||A.length>0?"mt-2 pt-2 border-t border-gray-100":"",children:t.jsx(sb,{imageUrls:$.imageUrls||[],sellerQuestion:$.sellerQuestion,fileIds:$.fileIds,isRTL:s})}),!n&&S&&!$&&t.jsx("div",{className:"mt-2 pt-2 border-t border-gray-100 flex flex-wrap gap-1.5 items-center",children:_==="done"?t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12px] text-green-600 font-medium",children:[t.jsx(Dn,{className:"h-3.5 w-3.5","aria-hidden":"true"}),a?.t_chat_confirm_applied||"Applied"]}):_==="cancelled"?t.jsx("span",{className:"inline-flex items-center gap-1.5 text-[12px] text-gray-400",children:a?.t_chat_confirm_cancelled||"Cancelled"}):_==="expired"?t.jsx("span",{className:"inline-flex items-center gap-1.5 text-[12px] text-amber-600 font-medium",children:a?.t_chat_confirm_expired||"Approval expired"}):t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",disabled:_==="confirming",onClick:()=>g?.(e.id,S.token),className:"text-[12px] h-7 px-3 rounded-md bg-brand-secondary text-white hover:bg-brand-secondary/90 transition-colors inline-flex items-center gap-1.5 font-medium shadow-sm disabled:opacity-50",children:[_==="confirming"?t.jsx(St,{className:"h-3.5 w-3.5 animate-spin"}):t.jsx(Dn,{className:"h-3.5 w-3.5","aria-hidden":"true"}),a?.t_chat_confirm_yes||"Confirm"]}),t.jsx("button",{type:"button",disabled:_==="confirming",onClick:()=>y?.(e.id),className:"text-[12px] h-7 px-3 rounded-md border border-gray-200 bg-gray-50 text-gray-700 hover:bg-gray-100 hover:border-gray-300 transition-colors inline-flex items-center gap-1.5 disabled:opacity-50",children:a?.t_chat_confirm_no||"Cancel"})]})}),!n&&w.length>0&&!$&&t.jsx("div",{className:"mt-2 pt-2 border-t border-gray-100 flex flex-col gap-1.5",children:w.map((R,B)=>{const U=R.option==="fast_photo"?Ln:R.option==="manual_form"?Jc:zt;return t.jsxs("button",{type:"button",onClick:()=>p?.(R),className:`w-full text-start rounded-lg border px-3 py-2 transition-colors flex items-start gap-2.5 ${R.option==="fast_photo"?"border-brand-secondary/30 bg-brand-secondary/5 hover:bg-brand-secondary/10":"border-gray-200 bg-gray-50 hover:bg-gray-100 hover:border-gray-300"}`,children:[t.jsx("span",{className:`mt-0.5 inline-flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md ${R.option==="fast_photo"?"bg-brand-secondary text-white":"bg-white text-gray-600 border border-gray-200"}`,children:t.jsx(U,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-[12.5px] font-medium text-gray-900 leading-tight",children:R.label}),R.sublabel&&t.jsx("span",{className:"block text-[11px] text-gray-500 leading-snug mt-0.5",children:R.sublabel})]})]},R.option||B)})}),!n&&C.length>0&&t.jsx("div",{className:"mt-2 space-y-2",children:C.map((R,B)=>{const U=[...R.imageUrl?[R.imageUrl]:[],...Array.isArray(R.extraImageUrls)?R.extraImageUrls.slice(0,2):[]];return t.jsxs("div",{className:"rounded-xl border border-gray-100 bg-gray-50/60 p-2.5",children:[t.jsx("p",{className:"text-[13px] font-semibold text-gray-900 leading-snug truncate",children:R.title}),R.category&&t.jsx("p",{className:"text-[11px] text-gray-400 truncate",children:R.category}),t.jsxs("p",{className:"text-[11px] text-gray-500 mt-0.5",children:[R.sku&&t.jsx("span",{className:"font-mono",children:R.sku}),R.sku&&R.price!=null&&t.jsx("span",{children:" · "}),R.price!=null&&t.jsxs("span",{className:"font-semibold text-gray-700",children:[R.currency?`${R.currency} `:"",R.price]}),R.wasPrice!=null&&t.jsxs("span",{className:"text-gray-400 line-through ms-1.5",children:[R.currency?`${R.currency} `:"",R.wasPrice]})]}),Array.isArray(R.badges)&&R.badges.length>0&&t.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:R.badges.map((K,ee)=>t.jsxs("span",{className:`inline-flex items-center rounded-full px-1.5 py-px text-[10px] font-medium ${Ci[K.tone]||Ci.muted}`,children:[K.tone==="photo"&&t.jsx(up,{className:"h-2.5 w-2.5 me-1","aria-hidden":"true"}),K.label]},ee))}),U.length>0&&t.jsx("div",{className:"mt-1.5 flex gap-1.5",children:U.map((K,ee)=>t.jsx("img",{src:K,alt:R.title||"",loading:"lazy",className:"h-14 w-14 cursor-zoom-in rounded-lg border border-gray-100 object-cover",onClick:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("packman-chat:view-image",{detail:{src:K,alt:R.title||""}}))},onError:he=>{he.currentTarget.style.display="none"}},ee))}),t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[R.shopUrl&&t.jsxs("a",{href:R.shopUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] h-7 px-2.5 rounded-md bg-brand-secondary text-white hover:bg-brand-secondary/90 transition-colors inline-flex items-center gap-1.5 font-medium shadow-sm",children:[t.jsx(ns,{className:"h-3.5 w-3.5 text-white","aria-hidden":"true"}),R.shopLabel]}),t.jsx("button",{type:"button",onClick:()=>f?.(R.productId),className:"text-[12px] h-7 px-2.5 rounded-md border border-gray-200 bg-white text-gray-700 hover:bg-gray-100 hover:border-gray-300 transition-colors inline-flex items-center gap-1.5",children:R.dashboardLabel})]})]},B)})}),!n&&k.length>0&&!$&&t.jsx("div",{className:"mt-2 pt-2 border-t border-gray-100 flex flex-wrap gap-1.5 items-center",children:k.map((R,B)=>{const U=R?.type==="prompt_upload_product_image",K=R?.type==="prompt_upload_store_logo",ee=U||K,he=R?.type==="open_product",fe=()=>{if(ee){if(typeof window>"u")return;window.dispatchEvent(new CustomEvent("packman-chat:request-upload",{detail:{purpose:K?"store_logo":"product"}}));return}if(he){f?.(R.productId);return}
732r?.(R.query)},ie=ee||he,me=K?$a:U?Ln:he?ns:R.Icon;return t.jsxs("button",{type:"button",onClick:fe,className:ie?"text-[12px] h-7 px-2.5 rounded-md bg-brand-secondary text-white hover:bg-brand-secondary/90 transition-colors inline-flex items-center gap-1.5 font-medium shadow-sm":"text-[12px] h-7 px-2.5 rounded-md border border-gray-200 bg-gray-50 text-gray-700 hover:bg-gray-100 hover:border-gray-300 transition-colors inline-flex items-center gap-1.5",children:[me&&typeof me=="function"&&t.jsx(me,{className:ie?"h-3.5 w-3.5 text-white":"h-3 w-3 text-gray-500","aria-hidden":"true"}),R.label]},B)})})]})})]})});yd.displayName="MessageBubble";const Pi=e=>`ai_chat_messages_${e}`,Ax=new Set(["show_create_product_options","mcp_create_product","prompt_upload_product_image","start_product_from_image","mcp_list_categories","mcp_list_collections"]),Nx=/\b(stock|inventory|orders?|sales|revenue|customers?|buyers?|carts?|checkout|refunds?|payouts?|coupons?|discounts?|analytics|kpis?)\b/i,kx=/\b(update|set|adjust|change|increase|decrease|reduce|show|list|view|check|get|how|what|which|when|where|why|status|report|summary|top|best|low|out of|pending|abandoned)\b/i;function Tx(e){const n=String(e||"").toLowerCase();return Nx.test(n)?kx.test(n):!1}function Oi(e){const n=String(e||"").trim();if(!n)return"";const r=n.match(/(?:called|named|titled|name(?:d)?\s+(?:is|it)?|product\s+name\s+(?:is)?)\s*[:'"“”]?\s*(.+?)\s*['"“”]?\s*$/i);if(!r||!r[1])return"";let s=r[1].trim();return s=s.replace(/\s+(?:with|that|which|for|and it has)\b.*$/i,"").trim(),s.length<2||s.length>120?"":s}function Cx(e){for(const n of[...e||[]].reverse()){if(n?.isUser)continue;const s=(Array.isArray(n?.meta?.actions)?n.meta.actions:[]).filter(a=>a?.type==="create_product_option");return s.length>0?s:[]}return[]}function jx(e,n){const r=String(e||"").trim();if(!r||!Array.isArray(n)||n.length===0)return null;const s=a=>n.find(o=>o?.option===a)||null;return/(fast|photo|picture|image|سريع|أسرع|اسرع|صورة)/i.test(r)?s("fast_photo"):/(guide|guided|step|chat|together|موجه|موجّه|خطوة|محادثة)/i.test(r)?s("guided_chat"):/(manual|form|myself|يدوي|يدوياً|نموذج|بنفسي)/i.test(r)?s("manual_form"):null}function Ix(e,n){const r=String(e||"").trim();return!r||(Array.isArray(n?.actions)?n.actions:[]).some(a=>["confirm_write","navigate","focus_tour_step","create_product_option","prompt_upload_product_image","start_product_from_image","open_product"].includes(a?.type))?!1:/[?؟]\s*$/.test(r)||/\b(what|which|who|where|when|how many|tell me|share|provide|give me|send me|i need)\b/i.test(r)||/(ما|ماذا|أي|اي|كم|أخبرني|اخبرني|زوّدني|زودني|أرسل|ارسل|أحتاج|احتاج)/.test(r)}const Rx=c.memo(function({isOpen:n,onClose:r,initialMessage:s="",manager:a=null}){const o=yt(),d=o.language==="ar",u=wt(),l=lo(),i=l.chatVoiceEnabled&&l.isSupported,g=i&&l.optedIn,y=a||{id:"packman",labelKey:"t_ai_manager_packman",labelFallback:"Packman AI",shortLabelKey:"t_ai_manager_packman_short",shortLabelFallback:"Packman AI",accent:{from:"from-brand-secondary",to:"to-fuchsia-500"}},p=o?.[y.labelKey]||y.labelFallback,f=o?.t_ai_manager_packman||(d?"باكمان الذكي":"Packman AI"),x=o?.t_your_store||(d?"متجرك":"Your Store"),[v,S]=c.useState(""),[_,w]=c.useState([]),[C,k]=c.useState({}),[L,A]=c.useState(!1),[E,j]=c.useState(!1),[H,D]=c.useState(!1),[$,re]=c.useState(!1),[pe,te]=c.useState(!1),[R,B]=c.useState(!1),[U,K]=c.useState(!1),[ee,he]=c.useState(!1),[fe,ie]=c.useState("product"),me=c.useRef("product"),[Re,ke]=c.useState(null),[oe,se]=c.useState(!1),[de,Ne]=c.useState([]),ue=c.useRef(!1),ve=c.useRef([]),[Ve,Te]=c.useState(!1),[Ge,Be]=c.useState(""),[et,ge]=c.useState(!1),X=c.useRef(null),Ce=c.useRef(!1),xe=c.useRef(!1),dt=c.useRef(null),[Gt,st]=c.useState(null),ft=c.useRef(!1),Z=c.useRef(null),{selectedStore:M}=ae(Y=>Y.store),Se=M?.systemCountry?.code,G=c.useRef(!1),Ee=c.useRef(!1),Q=c.useRef(!1),we=_.length>1;c.useEffect(()=>{ue.current=oe},[oe]),c.useEffect(()=>{ve.current=de},[de]);const Oe=c.useCallback(()=>{ue.current=!1,ve.current=[],se(!1),Ne([])},[]);c.useEffect(()=>{if(M?.id&&_.length>0)try{sessionStorage.setItem(Pi(M.id),JSON.stringify(_))}catch{}},[_,M?.id]),c.useEffect(()=>{if(n&&M?.id&&!Q.current){Q.current=!0;try{const Y=sessionStorage.getItem(Pi(M.id));if(Y){const ye=JSON.parse(Y);if(Array.isArray(ye)&&ye.length>0){const be=ye.map(_e=>{const Fe=(_e?.meta?.actions||[]).some(W=>W?.type==="start_product_from_image"),h=_e?.meta?.actions?.length>0?{..._e.meta,actions:_e.meta.actions.filter(W=>W?.type!=="start_product_from_image")}:_e?.meta,P=Array.isArray(_e?.attachments)?_e.attachments.filter(W=>!!W?.url).map(W=>({url:W.url,name:W.name,mimeType:W.mimeType,fileId:W.fileId})):void 0,F=Fe?"":_e.content;return{..._e,content:F,_streaming:!1,_restored:!0,meta:h,...P?{attachments:P}:{}}}),le=be.filter(_e=>{if(_e?.isUser)return!0;const Fe=!!(_e?.content&&String(_e.content).trim().length>0),h=Array.isArray(_e?.attachments)&&_e.attachments.length>0,P=(_e?.meta?.actions||[]).length>0;return Fe||h||P});w(le.length>0?le:be),G.current=!0;return}}}catch{}Ye()}else n||(Q.current=!1,G.current=!1,Ee.current=!1,re(!1),B(!1),te(!1),Oe())},[n,M?.id]),c.useEffect(()=>{n&&M?.id&&!G.current&&!Q.current&&(G.current=!0,Ye())},[n,M?.id]),c.useEffect(()=>{n&&s&&!Ee.current&&!E&&(Ee.current=!0,setTimeout(()=>Ot(s),300))},[n,s,E]),c.useEffect(()=>{if(Z.current){const Y=Z.current.querySelector("[data-radix-scroll-area-viewport]");Y&&(Y.scrollTop=Y.scrollHeight)}},[_]);const Ye=c.useCallback(async()=>
732{if(M?.id){j(!0);try{const Y=ae.getState?.()?.systemCountry;if(!Y){w([tt()]);return}const ye=new URLSearchParams({storeId:String(M.id),manager:y.id}),be=await fetch(`/api/${Y}/ai-chat/insights?${ye.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(be.ok){const le=await be.json(),_e=le.data?.reply||le.reply||"Welcome! I'm here to help you manage your store.",Fe=le.data?.meta||le.meta||{},h=d?`مرحباً، أنا باكمان الذكي.
733
734يمكنني مساعدتك في إدارة متجرك.
735
736اسألني عن أي شيء، مثل:
737• مبيعات آخر 7 أيام
738• كيف أضيف منتجاً جديداً؟`:Fr(_e),P=Array.isArray(Fe.welcomeItems)&&Fe.welcomeItems.length>0?Fe.welcomeItems:ji,F={...Fe,welcomeItems:P};w([{id:Date.now(),content:h,isUser:!1,timestamp:new Date,meta:F}])}else w([tt()])}catch{w([tt()])}finally{j(!1)}}},[M?.id,y.id,d]),tt=()=>({id:Date.now(),content:d?`مرحباً، أنا باكمان الذكي.
739
740يمكنني مساعدتك في إدارة متجرك.
741
742اسألني عن أي شيء، مثل:
743• مبيعات آخر 7 أيام
744• كيف أضيف منتجاً جديداً؟`:`Welcome! I'm your AI assistant.
745
746I can help you with:
747
748Just ask me anything! Try "sales last 7 days" or "how to add product".`,isUser:!1,timestamp:new Date,meta:{welcomeItems:ji}}),Ze=c.useCallback((Y,ye)=>{let be=0;const le=()=>{be+=Math.max(1,Math.floor(Y.length/100));const _e=be>=Y.length,Fe=_e?Y:Y.slice(0,be);w(h=>h.map(P=>P.id===ye?{...P,content:Fe,_streaming:!_e}:P)),_e||requestAnimationFrame(le)};requestAnimationFrame(le)},[]),Ae=c.useCallback(async(Y,ye)=>{const be=(Y||"").trim(),le=!!ye?.viaVoice;if(L)return;const _e=!!ye?.storeLogoUpload,Fe=Array.isArray(ye?.attachments)?ye.attachments:[];if(!be&&!(_e&&Fe.length>0))return;xe.current=!1,ue.current&&Tx(be)&&Oe(),re(!1);const P={id:Date.now(),content:be,isUser:!0,timestamp:new Date,...Array.isArray(ye?.displayAttachments)&&ye.displayAttachments.length>0||Fe.length>0?{attachments:ye.displayAttachments||Fe}:{}},F=jx(be,Cx(_));if(F){if(w(ne=>[...ne,P]),S(""),X.current=null,Ce.current=!1,F.option==="fast_photo"){Oe(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("packman-chat:request-upload"));return}if(F.option==="manual_form"){Oe(),Ms({type:"navigate",destination:F.destination||"products_create"},ne=>u(ne));return}if(F.option==="guided_chat"){Oe();let ne=(F?.productName||"").trim();if(!ne){const z=[..._].reverse().find(J=>J?.isUser);ne=Oi(z?.content)}Be(ne),ge(le),Te(!0);return}}const W=ue.current?ve.current.map(ne=>Number(ne?.fileId)).filter(ne=>Number.isFinite(ne)):[],V=_.filter(ne=>ne.content&&!ne._streaming).map(ne=>({role:ne.isUser?"user":"assistant",content:ne.content})).slice(-6);w(ne=>[...ne,P]),S(""),A(!0);try{const{aiChatService:ne}=await N(async()=>{const{aiChatService:je}=await Promise.resolve().then(()=>gr);return{aiChatService:je}},void 0,import.meta.url),z=await ne.sendMessage({message:be,storeId:M?.id,history:V.length>0?V:void 0,manager:y.id,locale:le?l.locale:void 0,voiceReply:le&&l.enabled?!0:void 0,productImageFileIds:W.length>0?W:void 0,attachments:Fe.length>0?Fe:void 0,storeLogoUpload:_e||void 0}),J=z.data||z,O=Fr((J.reply||"").trim()),ce=Date.now()+1,Me=J.meta||z.meta||{};ue.current&&Me?.tool&&!Ax.has(Me.tool)&&Oe();const nt=(Me?.actions||[]).find(je=>je?.type==="start_product_from_image"),ot=ly(Me);if(ot&&setTimeout(()=>Ms(ot,je=>u(je)),600),nt)w(je=>[...je,{id:ce,content:O,isUser:!1,timestamp:new Date,meta:Me,_streaming:!1}]);else{const je=O.length>0?O:o.t_chat_connection_error||"I'm sorry, I couldn't process your request right now. Please try again.";if(w(lt=>[...lt,{id:ce,content:"",isUser:!1,timestamp:new Date,meta:Me,_streaming:!0}]),le&&l.enabled&&je){let lt=!1;const Vn=()=>{lt||(lt=!0,Ze(je,ce))},fo=(Me?.actions||[]).filter(Ss=>Ss?.type==="create_product_option");let Es;if(fo.length>0){X.current=fo,Ce.current=!0;const Ss=d?"قل سريع لإنشائه من صورة، أو موجه لنبنيه خطوة بخطوة، أو يدوي لفتح النموذج.":"Say fast to draft it from a photo, guided to build it step by step, or manual to open the form.";Es=l.speak(`${je} ${Ss}`)}else xe.current=Ix(je,Me),Es=l.speakStream(je);Promise.resolve(Es).then(Vn),setTimeout(Vn,1800)}else Ze(je,ce)}}catch{w(ne=>[...ne,{id:Date.now()+1,content:o.t_chat_connection_error||"I'm having trouble connecting. Please try again.",isUser:!1,timestamp:new Date}])}finally{A(!1)}},[L,M?.id,o,Ze,_,y.id,l,u,Oe,d]),ut=c.useCallback(()=>Ae(v),[v,Ae]),ze=c.useCallback((Y,ye)=>{w(be=>be.map(le=>le.id===Y?{...le,meta:{...le.meta||{},confirmResolved:ye}}:le))},[]),Qe=c.useCallback(async(Y,ye)=>{if(!(!ye||L)){k(be=>({...be,[Y]:"confirming"})),A(!0);try{const{aiChatService:be}=await N(async()=>{const{aiChatService:W}=await Promise.resolve().then(()=>gr);return{aiChatService:W}},void 0,import.meta.url),le=await be.sendMessage({message:"confirm",storeId:M?.id,manager:y.id,confirmToken:ye}),_e=le.data||le,Fe=Fr((_e.reply||"").trim()),h=Date.now()+1,P=_e.meta||le.meta||{};if(P?.confirmExpired){k(ne=>({...ne,[Y]:"expired"})),ze(Y,"expired");const W=Fe.length>0?Fe:d?"انتهت صلاحية هذا التأكيد. ابدأ من جديد.":"This approval expired. Please start again.";let V=[];if(P?.tool==="mcp_create_product")Oe(),V=[{type:"create_product_option",option:"guided_chat",label:d?"إنشاء المنتج من جديد":"Create the product again",sublabel:d?"أكمل الخطوات وسأطلب التأكيد في النهاية":"Walk through the steps and confirm at the end"}];else{const ne=_.findIndex(J=>J.id===Y);let z="";for(let J=ne-1;J>=0&&ne>0;J--)if(_[J]?.isUser&&String(_[J]?.content||"").trim()){z=String(_[J].content).trim();break}z&&(V=[{type:"retry_request",query:z,label:d?"إعادة المحاولة":"Try again"}])}w(ne=>[...ne,{id:h,content:"",isUser:!1,timestamp:new Date,meta:{...P,actions:V},_streaming:!0}]),Ze(W,h);return}P?.tool==="mcp_create_product"&&Oe(),k(W=>({...W,[Y]:"done"})),ze(Y,"done");const F=Fe.length>0?Fe:o.t_chat_connection_error||"I'm sorry, I couldn't process your request right now. Please try again.";w(W=>[...W,{id:h,content:"",isUser:!1,timestamp:new Date,meta:P,_streaming:!0}]),Ze(F,h)}catch(be){k(h=>({...h,[Y]:void 0}));const le=be?.response?.data?.message||be?.response?.data?.error||be?.message,_e=Array.isArray(le)?le.join(". "):le,Fe=o.t_chat_connection_error||"I'm having trouble connecting. Please try again.";w(h=>[...h,{id:Date.now()+1,content:typeof _e=="string"&&_e&&!/network error/i.test(_e)?_e:Fe,isUser:!1,timestamp:new Date}])}finally{A(!1)}}},[L,M?.id,y.id,o,Ze,Oe,d,_,ze]),nn=c.useCallback(Y=>{k(ye=>({...ye,[Y]:"cancelled"})),ze(Y,"cancelled")},[ze]),xn=c.useCallback((Y,ye)=>{const be=uy(ye);be&&(st(Y),l.playText(be))},[l]),_n=c.useCallback(()=>{l.stop(),st(null)},[l]);c.useEffect(()=>{ft.current&&!l.isSpeaking&&(st(null),Ce.current?(Ce.current=!1,l.startRecording({autoStop:!0,sttLocale:"auto",onTranscript:Y=>dt.current?.(Y)})):xe.current&&(xe.current=!1,l.startRecording({autoStop:!0,sttLocale:"auto",silenceMs:1800,noSpeechMs:1e4,maxMs:25e3,onTranscript:Y=>{const ye=String(Y||"").trim();ye&&Ae(ye,{viaVoice:!0})}}))),ft.current=l.isSpeaking},[l.isSpeaking,l,Ae]);const Bt=c.useCallback(async()=>
748{if(g&&!(L||l.isTranscribing)){if(xe.current=!1,Ce.current=!1,l.isRecording){const Y=await l.stopRecording(),ye=typeof Y=="string"?Y:typeof Y?.primary=="string"?Y.primary:"";ye&&Ae(ye,{viaVoice:!0});return}l.stop(),await l.startRecording({sttLocale:"auto",bilingual:!0})}},[g,L,l,Ae]),Ot=c.useCallback(Y=>{Ae(Y)},[Ae]),ir=c.useCallback(Y=>{Y!=null&&u(We(m.PRODUCTS_EDIT.replace(":id",String(Y))))},[u]),Dt=c.useCallback((Y,ye)=>{const be=Y?.option;if(X.current=null,Ce.current=!1,be==="fast_photo"){Oe(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("packman-chat:request-upload"));return}if(be==="manual_form"){Oe(),Ms({type:"navigate",destination:Y.destination||"products_create"},le=>u(le));return}if(be==="guided_chat"){Oe();let le=(Y?.productName||"").trim();if(!le){const _e=[..._].reverse().find(Fe=>Fe?.isUser);le=Oi(_e?.content)}Be(le),ge(!!ye?.viaVoice),Te(!0)}},[Oe,u,_]),pt=c.useCallback(Y=>{const ye=String(Y||"").trim(),be=X.current||[];if(be.length===0)return;const le=Fe=>be.find(h=>h?.option===Fe);let _e=null;if(/(fast|photo|picture|image|سريع|أسرع|اسرع|صورة)/i.test(ye)?_e=le("fast_photo"):/(guide|step|chat|together|موجه|موجّه|خطوة|محادثة)/i.test(ye)?_e=le("guided_chat"):/(manual|form|myself|يدوي|يدوياً|نموذج|بنفسي)/i.test(ye)&&(_e=le("manual_form")),_e){Dt(_e,{viaVoice:!0});return}if(!ye){X.current=null;return}l.speak(d?"لم أفهم. قل سريع، أو موجه، أو يدوي.":"Sorry, I didn't catch that. Say fast, guided, or manual."),Ce.current=!0},[Dt,l,d]);dt.current=pt;const $n=c.useCallback((Y,ye)=>{Te(!1);const be=Fr((Y||"").trim()),le=Date.now()+1;w(_e=>[..._e,{id:le,content:"",isUser:!1,timestamp:new Date,meta:ye,_streaming:!0}]),Ze(be.length>0?be:d?"هل تريد المتابعة؟":"Do you want me to go ahead?",le)},[Ze,d]);c.useEffect(()=>{if(typeof window>"u")return;const Y=ye=>{const be=ye?.detail?.purpose==="store_logo"?"store_logo":"product";me.current=be,ie(be),he(!0)};return window.addEventListener("packman-chat:request-upload",Y),()=>{window.removeEventListener("packman-chat:request-upload",Y)}},[]),c.useEffect(()=>{if(typeof window>"u")return;const Y=be=>{const le=be?.detail?.src;typeof le=="string"&&/^https:\/\//i.test(le)&&ke({src:le,alt:be?.detail?.alt||""})},ye=be=>{be.key==="Escape"&&ke(null)};return window.addEventListener("packman-chat:view-image",Y),window.addEventListener("keydown",ye),()=>{window.removeEventListener("packman-chat:view-image",Y),window.removeEventListener("keydown",ye)}},[]),c.useEffect(()=>{if(typeof window>"u")return;const Y=async()=>{if(!i||!l.optedIn&&await l.enableVoice?.()===!1)return;const ye=d?"أهلاً بك في باكمان. كيف أقدر أساعدك اليوم؟":"Welcome to Packman. How can I help today?";xe.current=!0,l.playText(ye)};return window.addEventListener("packman-wake",Y),()=>window.removeEventListener("packman-wake",Y)},[l,i,d]);const qt=c.useCallback(async(Y,ye)=>{if(!M?.id)throw new Error(me.current==="store_logo"?o.t_chat_select_store_before_logo||"Select a store before uploading a logo.":"Select a store before uploading a product photo.");const be=ye?.libraryItem,le=ye?.attachment?ye.attachment:be?cd(be):await mo(Y,{storeId:M.id,systemCountry:Se});if(!le?.url)throw new Error("Upload did not return a usable URL.");if(me.current==="store_logo"){Ae(o.t_chat_logo_set_message||"Set this as my store logo",{attachments:[le],displayAttachments:[le],storeLogoUpload:!0});return}if(ue.current){if(!le.fileId)throw new Error("Upload did not return a file id.");const _e=[...ve.current,le].slice(0,8);ve.current=_e,Ne(_e),Ae(d?`أضفت صورة المنتج (${_e.length}).`:`Added a product photo (${_e.length} total).`,{displayAttachments:[{url:le.url,name:le.name,mimeType:le.mimeType,fileId:le.fileId}]});return}typeof window<"u"&&window.dispatchEvent(new CustomEvent("packman-ai-product-draft:start",{detail:{imageUrls:[le.url],mediaFiles:[ld(le)]}}))},[M?.id,Se,Ae,d,o]),wn=c.useCallback(Y=>{Y.nativeEvent?.isComposing||Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),ut())},[ut]);return n?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm z-[60] transition-opacity",onClick:r}),t.jsxs("div",{className:`fixed top-0 h-full bg-gray-50 shadow-2xl z-[70] flex flex-col transition-all duration-300 ease-in-out ${d?"left-0":"right-0"} ${H?"":"w-full sm:w-[480px] sm:max-w-[480px]"}`,style:H?{width:"calc(100% - 240px)",maxWidth:"calc(100% - 240px)"}:void 0,dir:d?"rtl":"ltr",children:[t.jsxs("div",{className:"h-12 px-3 bg-white border-b border-gray-200 flex items-center justify-between flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:`h-7 w-7 rounded-full overflow-hidden p-[1.5px] bg-gradient-to-br ${y.accent.from} ${y.accent.to} shadow-sm`,children:t.jsx("div",{className:"h-full w-full rounded-full overflow-hidden bg-white",children:t.jsx(_y,{fill:!0,alt:"AI"})})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("h2",{className:"text-gray-900 font-semibold text-[13px] leading-tight",children:p}),t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider bg-amber-100 text-amber-700 rounded-full leading-none",children:d?"تجريبي":"Beta"})]}),t.jsx("p",{className:"text-gray-400 text-[10px] leading-tight",children:y.id==="packman"?M?.name||x:d?`${M?.name||x} · ${f}`:`${f} · ${M?.name||x}`})]})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{onClick:()=>{B(Y=>!Y),te(!1)},"aria-pressed":R,"aria-label":o.t_ai_help_title||"What Packman AI can do",title:o.t_ai_help_title||"What Packman AI can do",className:`h-6 w-6 rounded flex items-center justify-center transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/50 ${R?"text-brand-secondary bg-brand-secondary/10":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,children:t.jsx(Jn,{className:"h-3.5 w-3.5"})}),i&&t.jsx("button",{onClick:()=>l.optedIn?l.disableVoice():l.enableVoice(),"aria-pressed":l.optedIn,"aria-label":l.optedIn?o.t_voice_turn_off||"Turn off voice":o.t_voice_turn_on||"Turn on voice",title:l.optedIn?o.t_voice_turn_off||"Turn off voice":o.t_voice_turn_on||"Turn on voice",className:`h-6 w-6 rounded flex items-center justify-center transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/50 ${l.o
748ptedIn?"text-brand-secondary hover:bg-brand-secondary/10":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,children:l.optedIn?t.jsx(jn,{className:"h-3.5 w-3.5"}):t.jsx(Qc,{className:"h-3.5 w-3.5"})}),g&&t.jsxs("div",{className:"relative",children:[t.jsx("button",{onClick:()=>{te(Y=>!Y),B(!1)},"aria-expanded":pe,"aria-label":o.t_voice_settings_title||"Voice settings",title:o.t_voice_settings_title||"Voice settings",className:`h-6 w-6 rounded flex items-center justify-center transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/50 ${pe?"text-brand-secondary bg-brand-secondary/10":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,children:t.jsx(pp,{className:"h-3.5 w-3.5"})}),pe&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-40","aria-hidden":"true",onClick:()=>te(!1)}),t.jsxs("div",{dir:d?"rtl":"ltr",className:`absolute z-50 mt-2 w-80 rounded-2xl border border-gray-200 bg-white p-3 shadow-xl ${d?"start-0":"end-0"}`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-lg bg-gradient-to-br from-brand-secondary to-fuchsia-500 text-white shadow-sm",children:t.jsx(mp,{className:"h-3.5 w-3.5"})}),t.jsx("h3",{className:"text-xs font-semibold text-gray-800",children:o.t_voice_settings_title||"Voice settings"})]}),t.jsx("button",{onClick:()=>te(!1),"aria-label":o.t_close||"Close",className:"h-5 w-5 rounded flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:t.jsx(Ft,{className:"h-3 w-3"})})]}),t.jsx(xx,{voice:l,t:o,isRTL:d,systemCountry:Se})]})]})]}),_.length>1&&t.jsx("button",{onClick:()=>{w([tt()]),S(""),re(!1),B(!1)},className:"h-6 px-2 rounded text-[10px] text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors font-medium",children:o.t_clear_chat||"Clear"}),t.jsx("button",{onClick:()=>D(!H),className:"hidden sm:flex h-6 w-6 rounded hover:bg-gray-100 items-center justify-center transition-colors",children:H?t.jsx(gp,{className:"h-3 w-3 text-gray-400"}):t.jsx(hp,{className:"h-3 w-3 text-gray-400"})}),t.jsx("button",{onClick:r,className:"h-6 w-6 rounded hover:bg-gray-100 flex items-center justify-center transition-colors",children:t.jsx(Ft,{className:"h-3 w-3 text-gray-400"})})]})]}),t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[R&&t.jsx(vy,{onClose:()=>B(!1),onAsk:Ot,onLeaveToGuide:()=>{B(!1),r?.()},isRTL:d,t:o}),t.jsx("div",{className:"px-3 py-1.5 bg-amber-50 border-b border-amber-100 flex-shrink-0",children:t.jsx("p",{className:"text-[10px] text-amber-600 leading-snug",children:o.t_ai_beta_disclaimer||"This feature is in beta. Responses may not always be accurate. Please verify important information."})}),Ve&&t.jsx(Vb,{open:Ve,onClose:()=>Te(!1),onComplete:$n,storeId:M?.id,systemCountry:Se,language:d?"ar":"en",initialName:Ge,initialVoiceMode:et}),!Ve&&t.jsx(fl,{ref:Z,className:"flex-1 overflow-hidden",children:t.jsxs("div",{className:"px-3 py-3",children:[E&&_.length===0&&t.jsxs("div",{className:`flex items-start mb-3 ${d?"flex-row-reverse":""}`,children:[t.jsx("div",{className:`h-7 w-7 rounded-full overflow-hidden ${d?"ml-2":"mr-2"} flex-shrink-0 ring-2 ring-white shadow-sm`,children:t.jsx("img",{src:tr,alt:"AI",className:"w-full h-full object-cover"})}),t.jsx("div",{className:`bg-white rounded-2xl ${d?"rounded-br-sm":"rounded-bl-sm"} px-4 py-2.5 border border-gray-100 shadow-sm`,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-sm text-gray-500",children:[o.t_loading||"Loading","..."]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx("div",{className:"w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),t.jsx("div",{className:"w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),t.jsx("div",{className:"w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})]})})]}),_.map(Y=>t.jsx(yd,{message:Y,isUser:Y.isUser,onActionClick:Ot,isRTL:d,t:o,canSpeak:i,isSpeaking:l.isSpeaking,playingId:Gt,onPlay:xn,onStop:_n,onConfirmWrite:Qe,onCancelWrite:nn,onCreateOption:Dt,onOpenProduct:ir,confirmStatus:C[Y.id]},Y.id)),L&&t.jsxs("div",{className:`flex items-start mb-3 ${d?"flex-row-reverse":""}`,children:[t.jsx("div",{className:`h-7 w-7 rounded-full overflow-hidden ${d?"ml-2":"mr-2"} flex-shrink-0 ring-2 ring-white shadow-sm`,children:t.jsx("img",{src:tr,alt:"AI",className:"w-full h-full object-cover"})}),t.jsx("div",{className:"packman-animated-border",style:{"--packman-animated-border-radius":"1rem"},children:t.jsx("div",{className:`packman-animated-border-inner bg-white ${d?"rounded-br-sm":"rounded-bl-sm"} px-4 py-2.5`,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(zt,{className:"h-3.5 w-3.5 text-brand-secondary animate-pulse"}),t.jsxs("span",{className:"text-sm text-gray-500",children:[o.t_thinking||"Thinking","..."]}
748)]})})})]}),!we&&!L&&!E&&t.jsx("div",{className:"mt-2",children:t.jsx(Ca,{onChipClick:Ot,isLoading:L,t:o,isRTL:d})})]})}),!Ve&&t.jsxs("div",{className:"flex-shrink-0 bg-white border-t border-gray-200",children:[we&&t.jsxs("div",{className:"px-3 pt-1.5",children:[$?t.jsx("div",{className:"pb-1.5",children:t.jsx(Ca,{onChipClick:Ot,isLoading:L,t:o,isRTL:d})}):null,t.jsxs("button",{onClick:()=>re(!$),className:"flex items-center gap-1 text-[10px] text-gray-400 hover:text-gray-600 transition-colors font-medium mb-0.5",children:[t.jsx(za,{className:"h-2.5 w-2.5"}),$?o.t_hide_suggestions||"Hide":o.t_show_suggestions||"Suggestions"]})]}),oe&&t.jsx("div",{className:"px-3 pt-2",children:t.jsxs("button",{type:"button",onClick:()=>he(!0),className:"w-full inline-flex items-center justify-center gap-1.5 h-8 rounded-lg border border-brand-secondary/30 bg-brand-secondary/5 text-[12px] font-medium text-brand-secondary hover:bg-brand-secondary/10 transition-colors",children:[t.jsx(Ln,{className:"h-3.5 w-3.5","aria-hidden":"true"}),de.length>0?d?`إضافة صورة أخرى (${de.length})`:`Add another photo (${de.length})`:d?"إضافة صورة المنتج":"Add product photo"]})}),t.jsxs("div",{className:"px-3 py-2",children:[g&&l.permissionError&&t.jsxs("div",{className:"relative mb-1.5 px-1",children:[t.jsxs("div",{className:"inline-flex items-start gap-1.5 rounded-lg bg-amber-50 px-2 py-1.5",children:[t.jsx("p",{className:"text-[11px] font-medium text-amber-600",children:o.t_voice_permission_denied||"Microphone access is blocked. Allow it in your browser settings, then try again."}),t.jsx("button",{type:"button","aria-label":"How to enable microphone access",title:"How to enable microphone access",onClick:()=>K(Y=>!Y),className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-amber-600 hover:bg-amber-100 hover:text-amber-800 transition-colors",children:t.jsx(Jn,{className:"h-3.5 w-3.5"})})]}),U&&t.jsxs("div",{className:"absolute left-1 top-[calc(100%+0.25rem)] z-10 w-[19rem] rounded-2xl bg-white p-3 text-[11px] text-gray-700 shadow-xl ring-1 ring-black/10",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:"Enable microphone access"}),t.jsx("p",{className:"mt-1 text-gray-600",children:"Allow microphone access for this site, then reload the page."}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:"Chrome / Edge"}),t.jsx("p",{children:"1) Click the lock or tune icon next to the URL."}),t.jsx("p",{children:"2) Open Site settings."}),t.jsx("p",{children:"3) Set Microphone to Allow."}),t.jsx("p",{children:"4) Reload the page."})]}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:"Safari (Mac)"}),t.jsx("p",{children:"1) Safari menu - Settings for This Website."}),t.jsx("p",{children:"2) Set Microphone to Allow."}),t.jsx("p",{children:"3) Reload the page."})]})]})]}),g&&!l.permissionError&&l.captureError&&t.jsx("p",{className:"mb-1.5 px-1 text-[11px] font-medium text-amber-600",children:l.captureError==="too_short"||l.captureError==="empty"?o.t_voice_too_short||"I didn't catch that. Tap the mic, speak, then tap again to send.":o.t_voice_failed||"Sorry, I couldn't understand that recording. Please try again."}),t.jsx("div",{className:"packman-chat-composer",children:t.jsxs("div",{className:"packman-chat-composer-inner flex gap-2 items-center bg-gray-50 px-3 py-1.5 focus-within:bg-white transition-colors",children:[t.jsx("input",{value:v,onChange:Y=>S(Y.target.value),onKeyDown:wn,placeholder:l.isRecording?o.t_voice_listening||"Listening. Tap to send.":l.isTranscribing?o.t_voice_transcribing||"Got it. One moment.":o.t_ask_anything||"Ask anything...",className:"flex-1 bg-transparent text-sm text-gray-900 placeholder-gray-400 focus:outline-none",disabled:L||l.isRecording||l.isTranscribing}),g&&t.jsx("button",{onClick:Bt,disabled:L||l.isTranscribing,"aria-label":l.isRecording?o.t_voice_stop||"Stop":o.t_voice_tap_to_speak||"Tap to speak",title:l.isRecording?o.t_voice_stop||"Stop":o.t_voice_tap_to_speak||"Tap to speak",className:`h-7 w-7 rounded-lg flex items-center justify-center transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-secondary/50 active:scale-95 ${l.isRecording?"bg-red-500 text-white animate-pulse":l.isTranscribing?"bg-gray-200 text-gray-400 cursor-wait":"bg-gray-200 text-gray-600 hover:bg-gray-300"}`,children:l.isTranscribing?t.jsx(St,{className:"h-3.5 w-3.5 animate-spin"}):l.isRecording?t.jsx(tl,{className:"h-3 w-3"}):t.jsx(vr,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:ut,disabled:!v.trim()||L,className:`h-7 w-7 rounded-lg flex items-center justify-center transition-all ${v.trim()&&!L?"bg-gray-900 text-white hover:bg-gray-800":"bg-gray-200 text-gray-400 cursor-not-allowed"}`,children:t.jsx(fp,{className:"h-3.5 w-3.5"})})]})})]})]})]})]}),t.jsx(pd,{isOpen:ee,onClose:()=>he(!1),onSubmit:qt,mode:fe==="store_logo"?"logo":oe?"attach":"analyze"}),Re&&t.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-6",onClick:()=>ke(null),role:"dialog","aria-modal":"true",children:[t.jsx("button",{type:"button",onClick:()=>ke(null),"aria-label":"Close",className:"absolute top-4 end-4 roun
748ded-full bg-white/15 p-2 text-white transition-colors hover:bg-white/25",children:t.jsx(Ft,{className:"h-5 w-5","aria-hidden":"true"})}),t.jsx("img",{src:Re.src,alt:Re.alt,className:"max-h-[85vh] max-w-full rounded-xl object-contain shadow-2xl",onClick:Y=>Y.stopPropagation()})]})]}):null}),bd=[{id:"packman",labelKey:"t_ai_manager_packman",labelFallback:"Packman AI",shortLabelKey:"t_ai_manager_packman_short",shortLabelFallback:"Packman AI",accent:{from:"from-brand-secondary",to:"to-fuchsia-500"},routePrefixes:[]},{id:"marketing",labelKey:"t_ai_manager_marketing",labelFallback:"Marketing Officer",shortLabelKey:"t_ai_manager_marketing_short",shortLabelFallback:"Marketing Officer",accent:{from:"from-pink-500",to:"to-rose-500"},routePrefixes:["/dashboard/marketing","/dashboard/coupons","/dashboard/draft-carts"]},{id:"content",labelKey:"t_ai_manager_content",labelFallback:"Content Officer",shortLabelKey:"t_ai_manager_content_short",shortLabelFallback:"Content Officer",accent:{from:"from-violet-500",to:"to-indigo-500"},routePrefixes:["/dashboard/products","/dashboard/collections","/dashboard/categories","/dashboard/size-guides","/dashboard/product-attributes","/dashboard/store/media-library"]},{id:"storefront",labelKey:"t_ai_manager_storefront",labelFallback:"Storefront Officer",shortLabelKey:"t_ai_manager_storefront_short",shortLabelFallback:"Storefront Officer",accent:{from:"from-sky-500",to:"to-blue-600"},routePrefixes:["/dashboard/store","/dashboard/theme-templates","/dashboard/builder","/dashboard/templates","/dashboard/store/general","/dashboard/store/settings","/dashboard/store/search-sync","/dashboard/store/integrations","/dashboard/store/api-tokens","/dashboard/store/domains","/dashboard/store/documents"]},{id:"fulfillment",labelKey:"t_ai_manager_fulfillment",labelFallback:"Fulfillment Officer",shortLabelKey:"t_ai_manager_fulfillment_short",shortLabelFallback:"Fulfillment Officer",accent:{from:"from-amber-500",to:"to-orange-500"},routePrefixes:["/dashboard/orders","/dashboard/inventory","/dashboard/transfers","/dashboard/store/shipping","/dashboard/store/pickup-locations","/dashboard/carts"]},{id:"support",labelKey:"t_ai_manager_support",labelFallback:"Support Officer",shortLabelKey:"t_ai_manager_support_short",shortLabelFallback:"Support Officer",accent:{from:"from-emerald-500",to:"to-teal-500"},routePrefixes:["/dashboard/customers","/dashboard/store/customers","/dashboard/reviews","/dashboard/wishlists"]},{id:"analyst",labelKey:"t_ai_manager_analyst",labelFallback:"Analyst Officer",shortLabelKey:"t_ai_manager_analyst_short",shortLabelFallback:"Analyst Officer",accent:{from:"from-cyan-500",to:"to-sky-500"},routePrefixes:["/dashboard/analytics"]},{id:"accountant",labelKey:"t_ai_manager_accountant",labelFallback:"Accountant Officer",shortLabelKey:"t_ai_manager_accountant_short",shortLabelFallback:"Accountant Officer",accent:{from:"from-lime-500",to:"to-emerald-500"},routePrefixes:["/dashboard/wallet","/dashboard/subscriptions","/dashboard/subscription-orders","/dashboard/store/payments","/dashboard/store/vat-settings"]}],Px=bd.reduce((e,n)=>(e[n.id]=n,e),{}),Di=Px.packman;function Ox(e){if(!e||typeof e!="string")return Di;let n=null,r=-1;for(const s of bd)for(const a of s.routePrefixes||[])(e===a||e.startsWith(`${a}/`))&&a.length>r&&(n=s,r=a.length);return n||Di}function Dx(){const{pathname:e}=kt();return c.useMemo(()=>Ox(e),[e])}const Lx=c.memo(function({className:n="",disabled:r=!1,hideWakeHint:s=!1}){const[a,o]=c.useState(!1),[d,u]=c.useState(""),[l,i]=c.useState(!1),g=c.useRef(r);c.useEffect(()=>{g.current=r,r&&(o(!1),u(""))},[r]);const p=(ae(B=>B.language)||"en")==="ar",f=yt(),x=Dx(),v=f?.[x.shortLabelKey]||x.shortLabelFallback,S=f?.[x.labelKey]||x.labelFallback,_=rd(),w=lo(),C=!r&&w.chatVoiceEnabled&&w.isSupported&&w.wakeWordEnabled&&td(),[k,L]=c.useState(!1),[A,E]=c.useState(!1),[j,H]=c.useState(""),D=c.useCallback(()=>{g.current||(L(!0),setTimeout(()=>{o(!0),window.dispatchEvent(new CustomEvent("ai-chat-panel-opened")),setTimeout(()=>window.dispatchEvent(new CustomEvent("packman-wake")),60)},750),setTimeout(()=>L(!1),1500))},[]);ry({enabled:C,paused:w.isRecording||w.isSpeaking,lang:"en-US",onWake:D,onListeningChange:E,onError:H});const $=C&&!a&&!_,re=$&&!s,pe=$&&s;c.useEffect(()=>{$||i(!1)},[$]),c.useEffect(()=>{const B=U=>{g.current||(u(U.detail?.message||""),o(!0),window.dispatchEvent(new CustomEvent("ai-chat-panel-opened")))};return window.addEventListener("open-ai-chat",B),()=>window.removeEventListener("open-ai-chat",B)},[]),c.useEffect(()=>{const B=()=>{o(!1),u(""),window.dispatchEvent(new CustomEvent("ai-chat-panel-closed"))};return window.addEventListener("close-ai-chat",B),()=>window.removeEventListener("close-ai-chat",B)},[]);const te=c.useCallback(()=>{g.current||(o(!0),window.dispatchEvent(new CustomEvent("ai-chat-panel-opened")))},[]),R=c.useCallback(()=>{o(!1),u(""),window.dispatchEvent(new CustomEvent("ai-chat-panel-closed"))},[]);return r?null:t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:te,className:`relative h-9 w-9 rounded-full overflow-hidden bg-brand hover:ring-2 hover:ring-brand-600 transition-all ${n}`,"aria-label":"AI Assistant",children:t.jsx("img",{src:tr,alt:"AI Assistant",className:"w-full h-full object-cover"})}),!a&&!_&&t.jsxs("div",{className:"fixed z-40 flex flex-col items-center gap-1.5 pointer-events-none",style:{bottom:"calc(1rem + env(safe-area-inset-bottom))",...p?{left:"calc(1rem + env(safe-area-inset-left))"}:{right:"calc(1rem + env(safe-area-inset-right))"}},children:[re&&t.jsxs("div",{className:"pointer-events-auto relative flex max-w-[15rem] items-center gap-2 rounded-2xl bg-white/95 px-3 py-1.5 text-[11px] font-medium text-gray-700 shadow-lg ring-1 ring-black/5 backdrop-blur",children:[t.jsxs("span",{className:`relative flex h-5 w-5 shrink-0 items-center justify-center rounded-full ${j==="not-allowed"?"bg-amber-100 text-amber-600":A?"bg-brand-secondary text-white":"bg-brand-secondary/10 text-brand-secondary"}`,children:[A&&j!=="not-allowed"&&t.jsx("span",{className:"absolute inset-0 rounded-full bg-brand-secondary/40 animate-ping"}),t.jsx(jn,{className:`relative h-3 w-3 ${A?"animate-pulse":""}`})]}),t.jsx("span",{className:"leading-snug",children:j==="not-allowed"?f.t_wake_hint_permission||'Allow microphone access to use "Hey Packman".':f.t_wake_hint_short||'Say "Hey Packman"'}),t.jsx("button",{type:"button","aria-label":"How to enable microphone access",title:"How to enable microphone access",onClick:()=>i(B=>!B),className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-gray-500 hover:bg-gray-100 hover:text-gray-800 transition-colors",children:t.jsx(Jn,{className:"h-3.5 w-3.5"})}),l&&t.jsxs("div",{className:"absolute bottom-[calc(100%+0.5rem)] left-0 w-[19rem] rounded-2xl bg-white p-3 text-[11px] text-gray-700 shadow-xl ring-1 ring-black/10",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:'Enable microphone for "Hey Packman"'}),t.jsx("p",{className:"mt-1 text-gray-600",children:"Allow microphone access for this site, then reload the page."}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:"Chrome / Edge"}),t.jsx("p",{children:"1) Click the lock or tune icon next to the URL."}),t.jsx("p",{children:"2) Open Site settings."}),t.jsx("p",{children:"3) Set Microphone to Allow."}),t.jsx("p",{children:"4) Reload the page."})]}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:"Safari (Mac)"}),t.jsx("p",{children:"1) Safari menu - Settings for This Website."}),t.jsx("p",{children:"2) Set Microphone to Allow."}),t.jsx("p",{children:"3) Reload the page."})]}),t.jsx("p",{className:"mt-2 text-gray-500",children:'If needed, open voice settings and toggle Hands-free "Hey Packman" off then on.'})]})]}),t.jsx("span",{className:`pointer-events-auto select-none rounded-full bg-gradient-to-br ${x.accent.from} ${x.accent.to} px-2.5 py-0.5 text-[10px] font-semibold text-white shadow-sm ring-1 ring-white/20`,children:v},x.id),t.jsxs("button",{type:"button",onClick:te,"aria-label":S,className:`pointer-events-auto relative h-10 w-10 sm:h-14 sm:w-14 roun
748ded-full overflow-visible shadow-lg shadow-brand-secondary/30 hover:shadow-xl hover:shadow-brand-secondary/40 active:scale-[0.97] transition-transform group ${k?"scale-110":""}`,children:[k&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"absolute -inset-1 rounded-full bg-brand-secondary/30 animate-ping"}),t.jsx("span",{className:"absolute -inset-2 rounded-full bg-brand-secondary/20 animate-ping",style:{animationDelay:"150ms"}}),t.jsx("span",{className:"absolute -inset-3 rounded-full ring-2 ring-brand-secondary/40 animate-pulse"})]}),t.jsxs("span",{className:`relative block h-full w-full rounded-full p-[2px] bg-gradient-to-br ${x.accent.from} ${x.accent.to}`,children:[t.jsx("span",{className:"relative block h-full w-full rounded-full overflow-hidden bg-white ring-2 ring-white",children:t.jsx("img",{src:tr,alt:"","aria-hidden":"true",className:"w-full h-full object-cover"})}),t.jsx("span",{className:`absolute -bottom-0.5 inline-flex h-3 w-3 sm:h-4 sm:w-4 items-center justify-center ${p?"-left-0.5":"-right-0.5"}`,children:C&&A&&j!=="not-allowed"?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"absolute inset-0 rounded-full bg-brand-secondary/50 animate-ping"}),t.jsx("span",{className:"relative inline-flex h-3 w-3 sm:h-4 sm:w-4 items-center justify-center rounded-full bg-brand-secondary ring-2 ring-white",children:t.jsx(jn,{className:"h-1.5 w-1.5 sm:h-2 sm:w-2 text-white animate-pulse"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"absolute inset-0 rounded-full bg-emerald-400 animate-ping opacity-60"}),t.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 sm:h-2.5 sm:w-2.5 rounded-full bg-emerald-500 ring-2 ring-white"})]})})]})]})]}),pe&&t.jsx("div",{className:"fixed z-[90] pointer-events-auto",style:{bottom:"calc(1.75rem + env(safe-area-inset-bottom))",...p?{left:"calc(5rem + env(safe-area-inset-left))"}:{right:"calc(5rem + env(safe-area-inset-right))"}},children:t.jsxs("div",{className:"relative flex items-center gap-2 rounded-2xl bg-white px-3 py-1.5 text-[11px] font-medium text-gray-700 shadow-lg ring-1 ring-black/10",children:[t.jsxs("span",{className:`relative flex h-5 w-5 shrink-0 items-center justify-center rounded-full ${j==="not-allowed"?"bg-amber-100 text-amber-600":A?"bg-brand-secondary text-white":"bg-brand-secondary/10 text-brand-secondary"}`,children:[A&&j!=="not-allowed"&&t.jsx("span",{className:"absolute inset-0 rounded-full bg-brand-secondary/40 animate-ping"}),t.jsx(jn,{className:`relative h-3 w-3 ${A?"animate-pulse":""}`})]}),t.jsx("span",{className:"leading-snug whitespace-nowrap",children:j==="not-allowed"?f.t_wake_hint_permission||'Allow microphone access to use "Hey Packman".':f.t_wake_hint_short||'Say "Hey Packman"'}),t.jsx("button",{type:"button","aria-label":"How to enable microphone access",title:"How to enable microphone access",onClick:()=>i(B=>!B),className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-gray-500 hover:bg-gray-100 hover:text-gray-800 transition-colors",children:t.jsx(Jn,{className:"h-3.5 w-3.5"})}),l&&t.jsxs("div",{className:`absolute bottom-[calc(100%+0.5rem)] w-[19rem] rounded-2xl bg-white p-3 text-[11px] text-gray-700 shadow-xl ring-1 ring-black/10 ${p?"left-0":"right-0"}`,children:[t.jsx("p",{className:"font-semibold text-gray-900",children:'Enable microphone for "Hey Packman"'}),t.jsx("p",{className:"mt-1 text-gray-600",children:"Allow microphone access for this site, then reload the page."}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:"Chrome / Edge"}),t.jsx("p",{children:"1) Click the lock or tune icon next to the URL."}),t.jsx("p",{children:"2) Open Site settings."}),t.jsx("p",{children:"3) Set Microphone to Allow."}),t.jsx("p",{children:"4) Reload the page."})]}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[t.jsx("p",{className:"font-semibold text-gray-900",children:"Safari (Mac)"}),t.jsx("p",{children:"1) Safari menu - Settings for This Website."}),t.jsx("p",{children:"2) Set Microphone to Allow."}),t.jsx("p",{children:"3) Reload the page."})]}),t.jsx("p",{className:"mt-2 text-gray-500",children:'If needed, open voice settings and toggle Hands-free "Hey Packman" off then on.'})]})]})}),t.jsx(Rx,{isOpen:a,onClose:R,initialMessage:d,manager:x})]})});function Ux({className:e=""}){const[n,r]=c.useState(!1),{language:s,setLanguage:a}=ao(),o=()=>{n||(r(!0),setTimeout(()=>{a(s==="en"?"ar":"en")},150),setTimeout(()=>{r(!1)},300))};return t.jsx(al,{children:t.jsxs(ol,{children:[t.jsx(il,{asChild:!0,children:t.jsx(mt,{variant:"outline",size:"sm",onClick:o,className:`flex h-9 items-center justify-center overflow-hidden px-2 py-1.5 sm:px-2.5 ${s==="ar"?"font-arabic":""} ${e}`,dir:s==="ar"?"rtl":"ltr",children:t.jsxs("span",{className:`
749          inline-block text-xs transition-all duration-300
750          ${n?"opacity-0 transform translate-y-4":"opacity-100 transform translate-y-0"}
751        `,children:[t.jsx("span",{className:"sm:hidden",children:s==="en"?"🇦🇪":"🇺🇸"}),t.jsx("span",{className:"hidden sm:inline",children:s==="en"?"🇦🇪 العربية":"English 🇺🇸"})]})})}),t.jsx(cl,{children:t.jsxs("p",{children:[" ",s==="en"?"English":"العربية"]})})]})})}const Mx=(e,n,r)=>{if(!e||e.trim().length===0)return n.t_mobile_number_required||"Phone number is required";const s=ym(String(e).trim());if(/[^0-9]/.test(s))return n.t_mobile_number_digits_only||"Phone number should contain only digits";const a=s.replace(/\D/g,"");if(a.length===0)return n.t_mobile_number_digits_only||"Phone number should contain only digits";try{const o=String(r||"AE").toUpperCase(),d=yp(a,o);if(!d||!d.isValid())return n.t_mobile_number_invalid||"Please enter a valid mobile number"}catch(o){return console.error("validatePhoneNumber failed to parse number",{error:o,iso2:r}),n.t_mobile_number_invalid||"Please enter a valid mobile number"}return!0},zI=(e,n)=>{const r=(e||"").trim();if(r.length===0)return n.t_full_name_required||"Full name is required";const s=r.replace(/\s+/g," ");return s.length<2?n.t_full_name_too_short||"Name must be at least 2 characters":s.length>70?n.t_full_name_too_long||"Name must be at most 70 characters":/\d/.test(s)?n.t_full_name_no_numbers||"Name cannot contain numbers":/[^\p{L}\p{M} .'-]/u.test(s)?n.t_full_name_invalid_characters||"Only letters, space
751s, apostrophes ('), hyphens (-), and dots (.) are allowed":/^[.'-]|[.'-]$/.test(s)?n.t_full_name_invalid_punctuation_edges||"Name cannot start or end with punctuation":/[.'-]{2,}/.test(s)?n.t_full_name_invalid_punctuation_repetition||"Avoid repeated punctuation":!0},WI=(e,n)=>!e||e<=0?n.t_store_country_required||"Country is required":!0,BI=(e,n)=>e!==!0?n.t_terms_required||"You must accept the terms and conditions":!0,Li=()=>t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),t.jsx("path",{d:"m15 5 4 4"})]}),Gx=({className:e=""})=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:t.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})}),xd=60,Ui=30,$x="seller-phone-verify-otp-cooldown",qs=e=>{const n=e?.response?.data?.retryAfter??e?.response?.data?.data?.retryAfter??e?.response?.data?.meta?.retryAfter,r=Number(n);return Number.isFinite(r)&&r>0?Math.ceil(r):xd},Ks=e=>{const n=e?.response?.data?.message||e?.response?.data?.data?.message||e?.message;return e?.response?.status===429||n==="too_many_otp_requests"},Vx=e=>{const n=e?.response?.data?.message||e?.response?.data?.data?.message||e?.message||"";return n==="failed_to_send_otp_via_whatsapp"||n.toLowerCase().includes("failed to send otp via whatsapp")};function Fx(){const e=yt(),n=wt(),r=ae(X=>X.language),{data:s,refetch:a}=jr(),o=r==="ar",[d,u]=c.useState(!1),[l,i]=c.useState("phone"),[g,y]=c.useState(""),[p,f]=c.useState("AE"),[x,v]=c.useState(""),[S,_]=c.useState(""),[w,C]=c.useState(!1),[k,L]=c.useState(!1),[A,E]=c.useState(0),[j,H]=c.useState(0),[D,$]=c.useState(null),[re,pe]=c.useState(!1),[te,R]=c.useState(!1),B=c.useRef(null),U=c.useCallback(()=>{try{typeof window<"u"&&window.sessionStorage.setItem("packman-curated-theme-media:trigger","1")}catch{}},[]),K=c.useCallback(()=>({code:Fn.find(Ce=>Ce.iso===p)?.code||"971",number:g.replace(/^0+/,""),country:p}),[g,p]),ee=c.useCallback(()=>`+${Fn.find(xe=>xe.iso===p)?.code||"971"} ${g}`,[g,p]),he=c.useCallback(async()=>g.replace(/^0+/,"")?(await q("POST","ae/auth/sellers/onboarding/otp/send")(null,{phoneNumber:K()}),!0):!1,[K,g]),fe=c.useCallback(()=>{const X=K();if(!X.number)return"";const Ce=D?`seller:${D}`:`phone:${X.country}:${X.code}:${X.number}`;return`${$x}:${Ce}`},[K,D]),ie=c.useCallback(X=>{const Ce=Math.max(1,Math.ceil(Number(X)||xd));if(E(Ce),typeof window>"u")return;const xe=fe();xe&&window.localStorage.setItem(xe,String(Date.now()+Ce*1e3))},[fe]),me=c.useCallback(()=>{if(E(0),typeof window>"u")return;const X=fe();X&&window.localStorage.removeItem(X)},[fe]);c.useEffect(()=>{if(!s)return;const X=s?.data?.data||s?.data||s;if(!X)return;$(X.id);const Ce=X.phoneNumber&&X.phoneNumber.number,xe=!!X.phoneNumberVerified,dt=B.current;if(B.current=xe,!Ce||!xe){u(!0),Ce&&(y(X.phoneNumber.number||""),f(X.phoneNumber.country||"AE"),pe(!0));return}dt===!1&&U(),u(!1)},[s,U]),c.useEffect(()=>{if(!d)return;const X=window.setInterval(()=>{a().catch(()=>{})},5e3);return()=>window.clearInterval(X)},[d,a]),c.useEffect(()=>{if(A<=0)return;const X=window.setInterval(()=>{E(Ce=>Math.max(0,Ce-1))},1e3);return()=>window.clearInterval(X)},[A]),c.useEffect(()=>{if(j<=0)return;const X=window.setInterval(()=>{H(Ce=>Math.max(0,Ce-1))},1e3);return()=>window.clearInterval(X)},[j]),c.useEffect(()=>{if(typeof window>"u")return;const X=fe();if(!X)return;const Ce=Number(window.localStorage.getItem(X)),xe=Math.ceil((Ce-Date.now())/1e3);if(Number.isFinite(xe)&&xe>0){E(xe);return}window.localStorage.removeItem(X)},[fe]);const Re=async()=>{_("");const X=Mx(g,e,p);if(X!==!0){_(X);return}const Ce=te||!re;v(""),R(!1),i("otp"),L(!0);try{Ce?await q("PATCH","ae/auth/sellers/phone")(null,{phoneNumber:K()}):await he(),H(Ui)}catch(xe){Ks(xe)?(ie(qs(xe)),i("otp"),R(!1),_("")):Vx(xe)?(i("otp"),R(!1),_(xe?.message||xe?.response?.data?.message||"Failed to send verification code")):(i("phone"),R(re&&Ce),_(xe?.message||xe?.response?.data?.message||"Failed to send verification code"))}finally{L(!1)}},ke=()=>{R(!0),v(""),L(!1),H(0),me(),_(""),i("phone")},oe=4,se=c.useCallback(async X=>{if(A>0)return;const Ce=X||x;if(_(""),!Ce||Ce.length<oe){_(e.t_otp_required||"Please enter the OTP code");return}C(!0);try{await q("POST","ae/auth/sellers/onboarding/otp/verify")(null,{sellerId:D,otpCode:Ce});try{Nt.setQueryData(hh(),dt=>dt&&{...dt,phoneNumberVerified:!0})}catch{}B.current=!0,a().catch(()=>{}),U(),u(!1),fs(n,m.HOME)}catch(xe){Ks(xe)?(ie(qs(xe)),_("")):_(xe?.message||xe?.response?.data?.message||"Invalid OTP code"),v("")}finally{C(!1)}},[x,A,D,e,a,n,ie,o,U]),de=c.useCallback(X=>{A>0||(v(X),_(""),X.length===oe&&se(X))},[A,se]),Ne=async()=>
751{if(!(j>0)){_(""),v(""),L(!0);try{await he(),H(Ui)}catch(X){Ks(X)?(ie(qs(X)),_("")):_(X?.message||X?.response?.data?.message||"Failed to resend OTP")}finally{L(!1)}}};if(c.useEffect(()=>{if(!d||typeof document>"u")return;const X=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=X}},[d]),c.useEffect(()=>{if(!(typeof window>"u"))return window.dispatchEvent(new CustomEvent("phone-verify-popup:visibility",{detail:{open:d}})),()=>{window.dispatchEvent(new CustomEvent("phone-verify-popup:visibility",{detail:{open:!1}}))}},[d]),!d)return null;const ue=re&&!te&&l==="phone",ve=(!re||te)&&l==="phone",Ve=Fn.find(X=>X.iso===p),Te=A>0,Ge=j>0,Be=l==="otp"?e.t_enter_otp_title||(o?"أدخل رمز التحقق":"Enter verification code"):e.t_verify_phone_title||(o?"تحقق من رقم هاتفك":"Verify your phone number"),et=l==="otp"?e.t_enter_otp_description||(o?"أرسلنا رمز التحقق إلى هاتفك عبر واتساب.":"We sent a verification code to your phone via WhatsApp."):ue?e.t_verify_phone_send_otp||(o?"اضغط على إرسال الرمز لاستلام رمز التحقق عبر واتساب.":"Click Send OTP to receive a verification code on WhatsApp."):e.t_verify_phone_description||(o?"أضف رقم هاتفك لحماية الحساب واستلام إشعارات الطلبات.":"Add your phone number for account security and order notifications."),ge=/whatsapp/i.test(et)||et.includes("واتساب");return t.jsxs(t.Fragment,{children:[typeof document<"u"&&Kr.createPortal(t.jsx("div",{className:"fixed inset-0 z-[49] bg-slate-950/60 backdrop-blur-sm animate-in fade-in-0 duration-150","aria-hidden":"true"}),document.body),t.jsx(Ka,{open:d,modal:!1,children:t.jsxs(Ha,{className:"w-[calc(100vw-2rem)] max-w-md [&>button]:hidden",onOpenAutoFocus:X=>X.preventDefault(),onEscapeKeyDown:X=>X.preventDefault(),onPointerDownOutside:X=>X.preventDefault(),onInteractOutside:X=>X.preventDefault(),children:[t.jsxs(yl,{children:[t.jsx(Ya,{children:Be}),t.jsxs(hl,{children:[et,ge&&t.jsx(Gx,{className:"ms-1.5 inline-block h-4 w-4 shrink-0 align-text-bottom text-[#25D366]"})]})]}),t.jsxs("div",{className:"space-y-4 py-2",children:[ue&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl leading-none",children:Fn.find(X=>X.iso===p)?.flag||"🌍"}),t.jsx("span",{className:"text-base font-medium text-gray-800",dir:"ltr",children:ee()})]}),t.jsx("button",{type:"button",onClick:ke,className:"flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-600",title:e.t_change_phone||(o?"تغيير رقم الهاتف":"Change phone number"),children:t.jsx(Li,{})})]}),S&&t.jsx("p",{className:"text-red-500 text-sm",children:S})]}),ve&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:[e.t_phone_number||(o?"رقم الهاتف":"Phone Number"),t.jsx("span",{className:"text-red-500",children:" *"})]}),t.jsxs("div",{className:`flex items-stretch overflow-hidden rounded-xl border bg-white shadow-sm transition-colors ${S?"border-red-400":"border-gray-200 focus-within:border-brand-500 focus-within:ring-2 focus-within:ring-brand-200"}`,children:[t.jsxs("div",{dir:"ltr",className:`relative flex shrink-0 items-center gap-1.5 border-e border-gray-200 bg-gray-50 ps-3 pe-2 ${w?"opacity-60":""}`,children:[t.jsx("span",{className:"text-lg leading-none","aria-hidden":"true",children:Ve?.flag||"🌍"}),t.jsxs("span",{className:"text-sm font-semibold tabular-nums text-gray-800","aria-hidden":"true",children:["+",Ve?.code||"971"]}),t.jsx("svg",{className:"h-3.5 w-3.5 text-gray-500",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.084l3.71-3.853a.75.75 0 111.08 1.04l-4.24 4.4a.75.75 0 01-1.08 0l-4.24-4.4a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),t.jsx("select",{value:p,onChange:X=>f(X.target.value),disabled:w,"aria-label":e.t_country||(o?"الدولة":"Country"),className:"absolute inset-0 h-full w-full cursor-pointer appearance-none bg-transparent text-transparent opacity-0",children:Fn.map(X=>
751t.jsxs("option",{value:X.iso,children:[X.name," (+",X.code,")"]},X.iso3))})]}),t.jsx("input",{type:"tel",inputMode:"tel",autoComplete:"tel-national",dir:"ltr",value:g,onChange:X=>{y(X.target.value.replace(/[^\d]/g,"")),_("")},placeholder:e.t_enter_mobile_number||(o?"أدخل رقم الهاتف المتحرك":"Enter mobile number"),disabled:w,className:`min-w-0 flex-1 border-0 bg-transparent px-3 py-2.5 text-base text-gray-900 outline-none placeholder:text-gray-400 ${o?"text-right":"text-left"}`})]}),S&&t.jsx("p",{className:"text-sm text-red-500",children:S})]}),l==="otp"&&t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",dir:"ltr",children:[t.jsx("button",{type:"button",onClick:ke,disabled:w||k||Te,className:"text-brand-600 hover:text-brand-700 transition-colors disabled:opacity-50",title:e.t_change_phone||(o?"تغيير رقم الهاتف":"Change phone number"),children:t.jsx(Li,{})}),t.jsx("span",{dir:"ltr",children:ee()}),t.jsx("span",{className:"text-base",children:Fn.find(X=>X.iso===p)?.flag||"🌍"})]}),t.jsx("div",{dir:"ltr",children:t.jsx(bm,{maxLength:oe,value:x,onChange:de,disabled:w||k||Te,autoFocus:!0,children:t.jsx(xm,{className:"gap-2 sm:gap-3",children:Array.from({length:oe}).map((X,Ce)=>t.jsx(_m,{index:Ce,className:`h-12 w-12 text-xl sm:h-14 sm:w-14 sm:text-2xl font-semibold rounded-xl border-2 ${S?"border-red-400 ring-red-200":Te?"border-gray-200 opacity-60":"border-gray-200 focus-within:border-brand-500 focus-within:ring-2 focus-within:ring-brand-200"}`},Ce))})})}),(w||Te)&&t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[w&&t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-brand-500 border-t-transparent"}),Te?o?`يرجى الانتظار ${A} ثانية قبل المحاولة مرة أخرى.`:`Please wait ${A}s before trying again.`:e.t_verifying||(o?"جارٍ التحقق...":"Verifying...")]}),S&&!Te&&t.jsx("p",{className:"text-red-500 text-sm text-center",children:S}),t.jsx("button",{type:"button",onClick:Ne,disabled:w||k||Te||Ge,className:"text-sm text-brand-600 hover:underline disabled:opacity-50",children:k?e.t_sending||(o?"جارٍ الإرسال...":"Sending..."):Te?o?`إعادة الإرسال خلال ${A} ثانية`:`Resend in ${A}s`:Ge?o?`إعادة الإرسال خلال ${j} ثانية`:`Resend in ${j}s`:e.t_resend_otp||(o?"إعادة إرسال الرمز":"Resend OTP")})]})]}),l==="phone"&&t.jsx(wm,{className:"flex flex-col sm:flex-row gap-2",children:t.jsx(mt,{onClick:Re,disabled:w||k||Te||!g,children:w||k?e.t_sending||(o?"جارٍ الإرسال...":"Sending..."):Te?o?`حاول مرة أخرى خلال ${A} ثانية`:`Try again in ${A}s`:e.t_send_otp||(o?"إرسال الرمز":"Send OTP")})})]})})]})}const _d=()=>{const{data:e,isLoading:n,isFetching:r,isError:s}=jr();if(n||r)return{isPhoneVerified:null,isReady:!1};if(s||!e)return{isPhoneVerified:null,isReady:!0};const a=e?.data?.data||e?.data||e||null;if(!a)return{isPhoneVerified:null,isReady:!0};const o=!!(a.phoneNumber&&a.phoneNumber.number),d=!!a.phoneNumberVerified;return{isPhoneVerified:o&&d,isReady:!0}},Mi="packman-curated-identity:open",zx="packman-curated-identity:resync",Wx=6e3,Gi=60,$i=e=>e&&typeof e=="object"&&"data"in e?e.data:e;function Bx({storeId:e,systemCountry:n,phoneVerified:r}){const[s,a]=c.useState(null),[o,d]=c.useState(!1),[u,l]=c.useState(null),[i,g]=c.useState(null),y=c.useRef(null),p=c.useRef(0),f=c.useRef(null),x=c.useRef(null),v=Le(n);c.useEffect(()=>{if(!e||!v)return;let w=!1;const C=`${v}/stores/${e}/curated-theme-media`,k=async()=>$i(await q("GET",`${C}/status`)())||{},L=async D=>$i(await q("POST",`${C}/confirm-identity`)(null,{productName:D}))||{},A=()=>{y.current&&(clearInterval(y.current),y.current=null)},E=D=>{if(w)return;a(D.status??null),d(!!D.needsProductConfirmation),l(D.productHint??null),g(Array.isArray(D.productIdentityOptions)?D.productIdentityOptions:null),!D.needsProductConfirmation&&(D.status===null||D.status===void 0||D.status==="GENERATING")&&r===!0&&p.current<Gi?j():A()},j=()=>{y.current||(y.current=setInterval(async()=>{p.current+=1;try{const D=await k();if(w)return;E(D)}catch{}p.current>=Gi&&A()},Wx))};f.current=async D=>{const $=await L(D);return w?!1:(p.current=0,E($),typeof window<"u"&&window.dispatchEvent(new CustomEvent(zx)),$.status==="GENERATING")},x.current=async()=>{try{const D=await k();return w?null:(E(D),D)}catch{return null}};const H=()=>{document.visibilityState==="visible"&&x.current?.()};return window.addEventListener("focus",H),document.addEventListener("visibilitychange",H),(async()=>{try{p.current=0,E(await k())}catch{}})(),()=>{w=!0,f.current=null,x.current=null,window.removeEventListener("focus",H),document.removeEventListener("visibilitychange",H),A()}},[e,v,r]);const S=c.useCallback(async w=>typeof f.current!="function"?!1:f.current(w),[]),_=c.useCallback(async()=>typeof x.current!="function"?null:x.current(),[]);return{status:s,needsProductConfirmation:o,productHint:u,productIdentityOptions:i,confirmProductIdentity:S,refreshIdentityGate:_}}function qx({t:e,isRTL:n,open:r,initialValue:s="",options:a=null,onConfirm:o,onClose:d}){const u=c.useMemo(()=>Array.isArray(a)?a.map(_=>{if(typeof _=="string"){const w=_.trim();return w?{en:w,ar:w}:null}if(_&&typeof _=="object"){const w=(_.en||"").trim(),C=(_.ar||"").trim()||w;return w?{en:w,ar:C||w}:null}return null}
751).filter(Boolean):[],[a]),l=u.length>0,[i,g]=c.useState(null),[y,p]=c.useState(!1),[f,x]=c.useState("");c.useEffect(()=>{if(!r)return;x(""),p(!1);const _=u.find(w=>w.en.toLowerCase()===(s||"").toLowerCase());g(_?_.en:null)},[r,s,u]);const v=async()=>{if(!i||i.length<2){x(e.t_curated_identity_error_select||"Please pick your product.");return}p(!0),x("");try{await o?.(i)||(p(!1),x(e.t_curated_identity_error_generic||"Something went wrong. Please try again."))}catch{p(!1),x(e.t_curated_identity_error_generic||"Something went wrong. Please try again.")}},S=_=>{const w=i===_.en,C=n?_.ar:_.en,k=n?_.en:_.ar,L=k&&k!==C;return t.jsxs("button",{type:"button",disabled:y,onClick:()=>{g(_.en),f&&x("")},className:`flex w-full items-center gap-3 rounded-xl border p-3 text-start transition-all ${w?"border-brand bg-brand/10 ring-1 ring-brand":"border-gray-200 bg-white hover:border-gray-300 hover:bg-gray-50"}`,children:[t.jsx("span",{className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full border ${w?"border-brand bg-brand text-brand-secondary":"border-gray-300 bg-white"}`,children:w&&t.jsx(Dn,{className:"h-3 w-3"})}),t.jsxs("span",{className:"flex min-w-0 flex-col items-start",children:[t.jsx("span",{className:"text-start text-sm font-medium text-gray-800",children:C}),L&&t.jsx("span",{className:"text-start text-xs text-gray-400",children:k})]})]},_.en)};return t.jsx(Ka,{open:r,onOpenChange:_=>{!_&&!y&&d?.()},children:t.jsxs(Ha,{dir:n?"rtl":"ltr",className:"max-h-[92vh] w-[calc(100vw-1.5rem)] max-w-md gap-0 overflow-y-auto rounded-3xl border-0 p-0 shadow-2xl sm:max-h-[90vh]",children:[t.jsx(yl,{className:"sr-only",children:t.jsx(Ya,{children:e.t_curated_identity_title||"Help us get your product right"})}),t.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-b from-brand/15 via-brand/5 to-transparent px-6 pb-5 pt-9 text-center",children:[t.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute -top-12 left-1/2 h-44 w-44 -translate-x-1/2 rounded-full bg-brand/20 blur-3xl"}),t.jsx("span",{className:"relative mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-brand/15 text-brand-secondary shadow-sm ring-1 ring-brand/30",children:t.jsx(Jn,{className:"h-9 w-9"})}),t.jsx("p",{className:"relative mt-4 text-lg font-semibold text-gray-900",children:e.t_curated_identity_title||"Help us get your product right"}),t.jsx("p",{className:"relative mx-auto mt-1.5 max-w-[22rem] text-[13px] leading-relaxed text-gray-500",children:l?e.t_curated_identity_subtitle_choices||"We could not tell exactly what your product is. Which of these is it?":e.t_curated_identity_subtitle_none||"We could not tell exactly what your product is. Please try again later or contact support."})]}),t.jsxs("div",{className:"px-6 pb-6 pt-1",children:[l&&t.jsx("div",{className:"flex flex-col gap-2",children:u.map(S)}),f?t.jsx("p",{className:"mt-2 text-start text-xs font-medium text-red-500",children:f}):t.jsx("p",{className:"mt-2 text-start text-[11px] leading-relaxed text-gray-400",children:e.t_curated_identity_hint_choices||"Pick the closest match. This helps us avoid wrong images and wasted time."}),l&&t.jsx(mt,{onClick:v,disabled:y,className:"mt-4 h-12 w-full gap-2 rounded-xl bg-brand text-sm font-semibold text-brand-secondary shadow-sm transition-all hover:bg-brand/90 hover:shadow-md active:scale-[0.99]",children:y?t.jsxs(t.Fragment,{children:[t.jsx(St,{className:"h-4 w-4 animate-spin"}),e.t_curated_identity_submitting||"Creating your store..."]}):t.jsxs(t.Fragment,{children:[t.jsx(zt,{className:"h-4 w-4"}),e.t_curated_identity_submit||"Confirm and create my images"]})}),t.jsx(mt,{onClick:()=>d?.(),disabled:y,variant:"ghost",className:"mt-1.5 h-10 w-full rounded-xl text-sm font-medium text-gray-500 hover:bg-gray-100 hover:text-gray-700",children:e.t_curated_identity_later||"I will do this later"})]})]})})}const Kx={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_URL:"https://api.packman.ai",VITE_APPLE_CLIENT_ID:"com.packman.seller.web",VITE_APPLE_REDIRECT_URI:"https://seller.packman.ai",VITE_APP_ENV:"production",VITE_BASE_RESOURCE_URL:"https://cdn.packman.ai",VITE_ENVIRONMENT:"production",VITE_ER
751ROR_MONITOR_DSN:"https://67dece45d633ce8d0525e2384257dec7@o4510482194497536.ingest.de.sentry.io/4510504129331280",VITE_GA_MEASUREMENT_ID:"G-4PKVQP3F56",VITE_GOOGLE_ADS_ID:"AW-18117877331",VITE_GOOGLE_ADS_SIGNUP_LABEL:"3uibCMbbpdJcEN08o79D",VITE_GOOGLE_ADS_SUBSCRIPTION_LABEL:"7YzuCJixpt0cENO8o79D",VITE_GOOGLE_API_KEY:"AIzaSyAq1wts8xf2Nrz-c7l2RXlg8KccYiikf_s",VITE_GOOGLE_CLIENT_ID:"839778205182-nuvhkhhpkac4olls5vqq9nr1jjcuegq7.apps.googleusercontent.com",VITE_GTM_CONTAINER_ID:"GTM-TT3HKL6L",VITE_MARKETING_GET_STARTED_URL:"https://packman.ai/get-started",VITE_MARKETING_PORTAL_URL:"https://marketing.packman.ai",VITE_ONBOARDING_FLOW:"v2",VITE_POSTHOG_HOST:"https://us.i.posthog.com",VITE_POSTHOG_KEY:"phc_rrtqMEugBJVeG5HJNFXjvLVw6w24zDSL9nfHzXzWwjT2",VITE_POSTHOG_USE_INGEST_PROXY:"true",VITE_SHOP_URL:"https://shop.packman.ai",VITE_TRACKING_ENV:"production",VITE_TURNSTILE_SITE_KEY:"0x4AAAAAADeg3pcYqtLtEb7W"},Hx=()=>{if(typeof import.meta>"u")return!0;const e=Kx?.[Cy];return!(e===!1||typeof e=="string"&&e.trim().toLowerCase()==="false")},Yx=e=>(e?.systemCountry?.code||"ae").toString().toLowerCase(),Qx=({enabled:e})=>{const n=ae(l=>l.store?.selectedStore),r=ae(l=>l.store?.selectedStoreDetails),s=r?.data||r||n,a=s?.uid||s?.store?.uid||n?.uid||n?.store?.uid,o=Yx(s||n),[d,u]=c.useState({hasOnboardingImages:null,isReady:!1});return c.useEffect(()=>{if(!e||!a){u({hasOnboardingImages:null,isReady:!e});return}let l=!1;return(async()=>{try{const i=Sr(),{data:g}=await i.get(`/${o}/on-boardings/by-store-uid/${a}/product-images`);if(l)return;const y=g?.data?.data??g?.data??g??{},p=typeof y=="string"?(()=>{try{return JSON.parse(y)}catch{return{}}})():y,f=Array.isArray(p.productImages)?p.productImages.filter(v=>typeof v=="string"&&v.length>0):[],x=p?.hasOnboardingImages===!0;u({hasOnboardingImages:x||f.length>0,isReady:!0})}catch{if(l)return;u({hasOnboardingImages:null,isReady:!0})}})(),()=>{l=!0}},[e,a,o]),d},ss=e=>`${nr.seen}:${e}`,Vi=e=>`${nr.legacySeen}:${e}`,Fi=e=>{if(!e||typeof window>"u")return!0;try{if(window.localStorage.getItem(ss(e))==="1")return!0;if(window.localStorage.getItem(Vi(e))==="1"){try{window.localStorage.setItem(ss(e),"1"),window.localStorage.removeItem(Vi(e))}catch{}return!0}return!1}catch{return!0}},Xx=e=>{const[n,r]=c.useState(()=>Fi(e));c.useEffect(()=>{r(Fi(e))},[e]);const s=c.useCallback(()=>{if(e){try{window.localStorage.setItem(ss(e),"1"),window.localStorage.setItem(`${nr.dismissedAt}:${e}`,String(Date.now()))}catch{}r(!0)}},[e]),a=c.useCallback(()=>{if(e){try{window.localStorage.removeItem(ss(e)),window.localStorage.removeItem(`${nr.dismissedAt}:${e}`)}catch{}r(!1)}},[e]);return{seen:n,markSeen:s,resetSeen:a}},Jx=()=>{const e=kt();return c.useMemo(()=>{const n=new URLSearchParams(e.search),r=n.get(Sa.forceOpen)==="1",s=n.get(Sa.reset)==="1";return{forceOpen:r,reset:s}},[e.search])},ja=e=>`${nr.reentryDismissed}:${e}`,zi=e=>{if(!e||typeof window>"u")return!1;try{return window.localStorage.getItem(ja(e))==="1"}catch{return!1}},Zx=({storeId:e,systemCountry:n})=>{const r=Hx(),{forceOpen:s,reset:a}=Jx(),{markSeen:o,resetSeen:d}=Xx(e),u=!!(r&&e),{isPhoneVerified:l,isReady:i}=_d(),g=u&&l===!0,{hasZeroProducts:y,isReady:p}=id({storeId:e,systemCountry:n,enabled:g}),f=g&&y===!0,{hasOnboardingImages:x,isReady:v}=Qx({enabled:f}),[S,_]=c.useState(!1),[w,C]=c.useState(()=>zi(e));c.useEffect(()=>{C(zi(e))},[e]),c.useEffect(()=>{if(a){if(d(),e&&typeof window<"u")try{window.localStorage.removeItem(ja(e))}catch{}C(!1)}},[a,d,e]);const k=c.useCallback(()=>_(!0),[]),L=c.useCallback(()=>{_(!1),o()},[o]),A=c.useCallback(()=>{if(e){if(typeof window<"u")try{window.localStorage.setItem(ja(e),"1")}catch{}C(!0)}},[e]),E=u&&i&&l===!0&&p&&y===!0&&v&&x===!0,j={markSeen:o,resetSeen:d,requestOpen:k,close:L,dismissReentry:A,hasZeroProducts:y,productCountReady:p,canReenter:!1};return u?i?l!==!0?{...j,shouldShow:!1}:s?p?y===!1?{...j,shouldShow:!1}:{...j,shouldShow:!0}:{...j,shouldShow:!1}:E?S?{...j,shouldShow:!0,canReenter:!1}:w?{...j,shouldShow:!1,canReenter:!1}:{...j,shouldShow:!1,canReenter:!0}:{...j,shouldShow:!1}:{...j,shouldShow:!1}:{...j,shouldShow:!1}};function qI(e){typeof window>"u"||window.dispatchEvent(new CustomEvent("open-ai-chat",{detail:{message:e}}))}const Ia="packman-home-v2-curated-preparing:active";function KI(e){if(typeof window>"u")return;const n=!!e;window.__packmanCuratedPreparingActive=n,window.dispatchEvent(new CustomEvent(Ia,{detail:{active:n}}
751))}function Wi(){return typeof window>"u"?!1:!!window.__packmanCuratedPreparingActive}function e0({onReopen:e,onDiscard:n,isRTL:r=!1,variant:s="first_product"}){const{t:a}=yt(),o=rd(),[d,u]=c.useState(!1);c.useEffect(()=>{const A=()=>u(!0),E=()=>u(!1);return window.addEventListener("ai-chat-panel-opened",A),window.addEventListener("ai-chat-panel-closed",E),()=>{window.removeEventListener("ai-chat-panel-opened",A),window.removeEventListener("ai-chat-panel-closed",E)}},[]);const[l,i]=c.useState(()=>Wi());c.useEffect(()=>{const A=E=>i(!!E?.detail?.active);return window.addEventListener(Ia,A),i(Wi()),()=>window.removeEventListener(Ia,A)},[]);const[g,y]=c.useState(!1),p=s==="another_product",f=typeof n=="function",x=c.useCallback(A=>{A.stopPropagation(),y(!0)},[y]),v=c.useCallback(A=>{A.stopPropagation(),y(!1),typeof n=="function"&&n()},[n]),S=c.useCallback(A=>{A.stopPropagation(),y(!1)},[]),_=p?"packmanAiProductDraft.t_bubble_cta_another":"packmanAiProductDraft.t_bubble_cta",w=p?"packmanAiProductDraft.t_bubble_aria_reopen_another":"packmanAiProductDraft.t_bubble_aria_reopen",C=p?"packmanAiProductDraft.t_bubble_discard_confirm_title":"packmanAiProductDraft.t_bubble_discard_confirm_title_first",k=p?"packmanAiProductDraft.t_bubble_discard_confirm_body":"packmanAiProductDraft.t_bubble_discard_confirm_body_first",L=p?"packmanAiProductDraft.t_bubble_discard_confirm_yes":"packmanAiProductDraft.t_bubble_discard_confirm_yes_first";return o||d||l?null:t.jsx("div",{className:["fixed bottom-24 sm:bottom-28 z-[80] flex flex-col items-end gap-2",r?"left-3 sm:left-5":"right-3 sm:right-5"].join(" "),dir:r?"rtl":"ltr",children:t.jsx(Fa,{initial:!1,mode:"wait",children:g?t.jsxs(At.div,{initial:{opacity:0,y:6,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.96},transition:{type:"spring",stiffness:360,damping:28},role:"dialog","aria-modal":"false","aria-label":a(C),className:"max-w-[280px] rounded-2xl bg-white shadow-[0_18px_40px_-16px_rgba(17,24,39,0.35)] ring-1 ring-black/5 p-3.5",children:[t.jsx("p",{className:"text-[13px] font-semibold text-gray-900 leading-snug",children:a(C)}),t.jsx("p",{className:"mt-1 text-[11.5px] text-gray-500 leading-snug",children:a(k)}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:S,className:"flex-1 rounded-full bg-gray-100 hover:bg-gray-200 text-gray-700 text-[12px] font-semibold py-2 px-3 transition-colors",children:a("packmanAiProductDraft.t_bubble_discard_confirm_no")}),t.jsx("button",{type:"button",onClick:v,className:"flex-1 rounded-full bg-red-600 hover:bg-red-700 text-white text-[12px] font-semibold py-2 px-3 transition-colors",children:a(L)})]})]},"confirm"):t.jsxs(At.div,{className:"relative",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:"spring",stiffness:300,damping:22},children:[t.jsxs(At.button,{type:"button",onClick:e,"aria-label":a(w),whileHover:{scale:1.04},whileTap:{scale:.96},className:"group relative inline-flex items-center gap-1 sm:gap-2 rounded-full bg-gradient-to-br from-[#2c2a59] via-[#3a357a] to-[#1e1c37] px-2 py-1 sm:px-3 sm:py-2 shadow-[0_16px_32px_-12px_rgba(44,42,89,0.55)] ring-1 ring-white/10 text-white",children:[t.jsx("span",{className:"absolute inset-0 rounded-full bg-[#2c2a59]/60 blur-md opacity-40 group-hover:opacity-60 transition-opacity -z-10 animate-pulse","aria-hidden":"true"}),t.jsx("span",{className:"relative inline-flex h-5 w-5 sm:h-8 sm:w-8 items-center justify-center rounded-full bg-white ring-2 ring-white/30 overflow-hidden",children:t.jsx("img",{src:tr,alt:"",className:"h-full w-full object-contain",loading:"lazy",decoding:"async"})}),t.jsx("span",{className:"pe-0.5 sm:pe-1 text-[10px] sm:text-[12px] font-semibold tracking-tight whitespace-nowrap",children:a(_)})]}),f&&t.jsx("button",{type:"button",onClick:x,"aria-label":a("packmanAiProductDraft.t_bubble_discard_aria"),title:a("packmanAiProductDraft.t_bubble_discard_tooltip"),className:"absolute -top-1.5 -start-1.5 inline-flex items-center justify-center h-5 w-5 rounded-full bg-white text-gray-500 hover:text-red-600 hover:bg-red-50 ring-1 ring-black/10 shadow-md transition-colors z-10",children:t.jsx(Ft,{className:"h-3 w-3","aria-hidden":"true"})})]},"bubble")})})}c.memo(e0);const Hs=()=>{try{const e=ae.getState?.()?.systemCountry;return e?String(e).toLowerCase():"ae"}catch{return"ae"}},Ys={async getParked({storeId:e}){if(!e)return null;const n=Hs();return rt("GET",`${n}/ai-chat/product-draft`)({storeId:e})},async upsertParked({storeId:e,source:n,payload:r}){if(!e)throw new Error("storeId is required");const s=Hs();return rt("PUT",`${s}/ai-chat/product-draft`)(null,{storeId:e,source:n,payload:r})},async removeParked({storeId:e}){if(!e)return null;const n=Hs();return rt("DELETE",`${n}/ai-chat/product-draft`)({storeId:e})}},Ra=e=>`${nr.parkedDraft}:${e}`,Bi="packman-ai-product-draft:clear-parked",t0={chat_hydrated:"hydrated",chat_seeded:"seeded"},n0={hydrated:"chat_hydrated",seeded:"chat_seeded"},qi=30*60*1e3,zr=e=>{if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(Ra(e));if(!n)return null;const r=JSON.parse(n);if(!r||typeof r!="object")return null;const s=r.kind==="hydrated"||r.kind==="seeded"?r.kind:null;if(!s||!r.payload||typeof r.payload!="object")return null;const a=typeof r.fetchedAt=="number"?r.fetchedAt:0;return{kind:s,payload:r.payload,fetchedAt:a}}catch{return null}},dr=(e,n)=>{if(!(!e||typeof window>"u"))try{if(!n){window.localStorage.removeItem(Ra(e));return}window.localStorage.setItem(Ra(e),JSON.stringify({...n,fetchedAt:Date.now()}))}catch{}},r0=({storeId:e})=>{const[n,r]=c.useState(()=>{const d=zr(e);return d?{kind:d.kind,payload:d.payload}:null}),s=c.useRef(e);c.useEffect(()=>{s.current=e;const d=zr(e);r(d?{kind:d.kind,payload:d.payload}:null)},[e]),c.useEffect(()=>{let d=!1;if(!e)return;const u=zr(e);if(!(u&&u.fetchedAt>0&&Date.now()-u.fetchedAt<qi))return(async()=>{try{const i=await Ys.getParked({storeId:e});if(d||s.current!==e)return;const g=i?.data??i;if(!g||!g.source||!g.payload){const f=zr(e);f&&f.fetchedAt>0&&Date.now()-f.fetchedAt<qi||(dr(e,null),r(null));return}const y=t0[g.source];if(!y)return;const p={kind:y,payload:g.payload};dr(e,p),r(p)}catch{}})(),()=>{d=!0}},[e]),c.useEffect(()=>{if(typeof window>"u")return;const d=u=>{const l=u?.detail?.storeId;!e||Number(l)!==Number(e)||(dr(e,null),r(null))};return window.addEventListener(Bi,d),()=>{window.removeEventListener(Bi,d)}},[e]);const a=c.useCallback(({kind:d,payload:u})=>
751{if(!e||!d||!u)return;const l=n0[d];if(!l)return;const i={kind:d,payload:u};dr(e,i),r(i),Ys.upsertParked({storeId:e,source:l,payload:u}).catch(()=>{})},[e]),o=c.useCallback(()=>{e&&(dr(e,null),r(null),Ys.removeParked({storeId:e}).catch(()=>{}))},[e]);return{parked:n,park:a,discard:o}},Ki=e=>e&&typeof e=="object"&&"data"in e&&"success"in e?e.data:e,s0={order_new:"orders",low_stock:"low_stock",out_of_stock:"out_of_stock",product_draft_ready:"product_draft_first",smart_studio_ready:"smart_studio_image",generation_failed:"smart_studio_image",subscription_expiring:"billing",document_required:"compliance",vat_compliance:"compliance",media_rejected:"compliance",account_message:"account",marketing_broadcast:"marketing"},a0={smart_studio_ready:"completed",product_draft_ready:"completed",generation_failed:"failed"},o0={order_new:"t_notif_order_new_title",low_stock:"t_notif_low_stock_title",out_of_stock:"t_notif_out_of_stock_title",product_draft_ready:"t_notif_product_draft_ready_title",smart_studio_ready:"t_notif_smart_studio_ready_title",generation_failed:"t_notif_generation_failed_title",subscription_expiring:"t_notif_subscription_expiring_title",document_required:"t_notif_document_required_title",vat_compliance:"t_notif_vat_compliance_title",media_rejected:"t_notif_media_rejected_title"},i0={product_draft_ready:"t_notif_product_draft_ready_desc",smart_studio_ready:"t_notif_smart_studio_ready_desc",generation_failed:"t_notif_generation_failed_desc"},c0={order_new:"t_notif_action_view_order",product_draft_ready:"t_notif_action_review_draft",smart_studio_ready:"t_notif_action_open_result",document_required:"t_notif_action_upload_now",vat_compliance:"t_notif_action_complete_now",media_rejected:"t_notif_action_view_products"},Hi=(e,n,r)=>{if(!e||typeof e!="object")return r;const s=String(n||"en").toLowerCase().startsWith("ar")?"ar":"en",a=typeof e[s]=="string"?e[s].trim():"";if(a)return a;const o=s==="ar"?"en":"ar";return(typeof e[o]=="string"?e[o].trim():"")||r},l0=e=>{if(!e||typeof e!="string")return null;const n=e.trim();if(!n)return null;if(n.startsWith("/dashboard/products/import"))try{const a=new URL(n,"https://dashboard.local").searchParams.get("taskId"),o=new URLSearchParams({packmanAiProductDraft:"1"});return a&&o.set("taskId",a),`/dashboard/products?${o.toString()}`}catch{return"/dashboard/products?packmanAiProductDraft=1"}if(n.startsWith("/dashboard/"))return n;if(n==="/home")return"/home";const r=n.match(/^\/orders\/(\d+)$/);return r?`/dashboard/orders/details/${r[1]}`:n==="/inventory"?"/dashboard/inventory":n==="/settings/subscription"?"/dashboard/subscriptions":n==="/settings/vat"?"/dashboard/store/vat-settings":n==="/settings/documents"?"/dashboard/store/documents":n.startsWith("/")&&!n.startsWith("/auth/")?`/dashboard${n}`:n},d0=({event:e,route:n,payload:r})=>{if(r?.openInNewTab&&n&&/^https?:\/\//i.test(n))return()=>typeof window>"u"?!1:(window.open(n,"_blank","noopener,noreferrer"),!0);if(!(e!=="product_draft_ready"||!n))return()=>{if(typeof window>"u")return!1;const s=r?.taskId,a=Number(s),o={source:"notification",fallbackRoute:n,...Number.isFinite(a)?{taskId:a}:{}};return window.dispatchEvent(new CustomEvent(Ea,{detail:o})),!0}},u0=(e,n)=>{const r=e.event,s=e.payload||{},a=i0[r]||null,o=Hi(s.titleLocalized,n,e.title||null),d=Hi(s.messageLocalized,n,e.message||null),u=l0(s.actionRoute),l=d0({event:r,route:u,payload:s}),i=c0[r]||(u?"t_notif_action_open":null);let g;return r==="low_stock"?g=Number(s.lowStockCount)||void 0:r==="out_of_stock"&&(g=Number(s.outOfStockCount)||void 0),{key:`server:${e.notificationId}`,notificationId:e.notificationId,recipientId:e.recipientId,source:s0[r]||"orders",status:a0[r]||"alert",titleKey:o0[r]||null,title:o,descriptionKey:a,description:a?null:d,count:g,route:u,onClick:l,actionKey:i,createdAt:e.createdAt||null,read:!!e.read,signature:`server:${e.notificationId}`,dismissable:!0,server:!0}},p0=[{freq:1046.5,at:0},{freq:1318.5,at:.11},{freq:1568,at:.22}],m0=()=>{if(!(typeof window>"u"))try{const e=window.AudioContext||window.webkitAudioContext;if(!e)return;const n=new e,r=n.currentTime,s=n.createGain();s.gain.setValueAtTime(.5,r),s.connect(n.destination);const a=(o,d,u,l,i)=>{const g=r+d,y=n.createOscillator(),p=n.createGain();y.type=i,y.frequency.setValueAtTime(o,g),p.gain.setValueAtTime(1e-4,g),p.gain.exponentialRampToValueAtTime(l,g+.012),p.gain.exponentialRampToValueAtTime(1e-4,g+u),y.connect(p),p.connect(s),y.start(g),y.stop(g+u+.02)};for(const o of p0)a(o.freq,o.at,.5,.16,"sine"),a(o.freq*2,o.at,.35,.04,"
751sine");window.setTimeout(()=>{n.close().catch(()=>{})},1100)}catch{}};function g0({storeId:e,systemCountry:n,language:r="en",isOpen:s=!1,enabled:a=!0,extraItems:o=[]}){const d=Ie(),u=!!(a&&e&&n),l=c.useRef(null),i=c.useRef(!1);c.useEffect(()=>{if(typeof window>"u")return;const w=()=>{i.current=!0};return window.addEventListener("pointerdown",w,{once:!0}),window.addEventListener("keydown",w,{once:!0}),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("keydown",w)}},[]);const g=$e({queryKey:["notif","unread-count",n],queryFn:async()=>{const w=await q("GET",`${n}/notifications/unread-count`)(),C=Ki(w)||{};return Number(C.count)||0},enabled:u,refetchInterval:s?2e4:45e3,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,staleTime:15e3}),y=$e({queryKey:["notif","list",n,r],queryFn:async()=>{const w=await q("GET",`${n}/notifications`)({limit:30}),C=Ki(w)||{};return(Array.isArray(C.items)?C.items:[]).map(L=>u0(L,r))},enabled:u&&s,refetchInterval:s?3e4:!1,refetchIntervalInBackground:!1,staleTime:15e3}),p=c.useCallback(()=>{d.invalidateQueries({queryKey:["notif","unread-count"]}),d.invalidateQueries({queryKey:["notif","list"]})},[d]),f=c.useMemo(()=>{const w=[];for(const k of o||[])k&&w.push(k);w.push(...y.data||[]);const C=k=>k.status==="processing"||k.status==="pending"?0:k.status==="alert"?1:2;return w.sort((k,L)=>{const A=C(k)-C(L);if(A!==0)return A;const E=k.createdAt?new Date(k.createdAt).getTime():0;return(L.createdAt?new Date(L.createdAt).getTime():0)-E})},[o,y.data]),x=g.data||0;c.useEffect(()=>{if(!u)return;const w=l.current;l.current=x,w!=null&&(x<=w||i.current&&m0())},[x,u]);const v=c.useCallback(async w=>{if(!(!w?.server||!w.notificationId||w.read)){try{await q("POST",`${n}/notifications/${w.notificationId}/read`)()}catch{}p()}},[n,p]),S=c.useCallback(async()=>{try{await q("POST",`${n}/notifications/read-all`)(void 0,{})}catch{}p()},[n,p]),_=c.useCallback(async w=>{if(!(!w?.server||!w.notificationId)){try{await q("POST",`${n}/notifications/${w.notificationId}/dismiss`)()}catch{}p()}},[n,p]);return{items:f,unreadCount:x,isLoading:g.isLoading,markRead:v,markAllRead:S,dismiss:_}}function Yi({text:e,className:n,clampClass:r="line-clamp-2",t:s}){const a=c.useRef(null),[o,d]=c.useState(!1),[u,l]=c.useState(!1);return c.useLayoutEffect(()=>{const i=a.current;if(!i)return;const g=()=>{o||l(i.scrollHeight-i.clientHeight>1)};g();const y=typeof ResizeObserver<"u"?new ResizeObserver(g):null;return y&&y.observe(i),()=>y?.disconnect()},[e,o]),e?t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{ref:a,className:Et(n,!o&&r),children:e}),(u||o)&&t.jsx("span",{role:"button",tabIndex:0,onClick:i=>{i.preventDefault(),i.stopPropagation(),d(g=>!g)},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopPropagation(),d(g=>!g))},className:"mt-0.5 w-fit cursor-pointer text-[11px] font-semibold text-brand-primary hover:underline",children:o?s.t_notif_see_less||"See less":s.t_notif_see_more||"See more"})]}):null}const Qi={smart_studio_image:{Icon:zt,bg:"bg-violet-500",fg:"text-white"},smart_studio_video:{Icon:Ep,bg:"bg-fuchsia-500",fg:"text-white"},orders:{Icon:Hc,bg:"bg-sky-500",fg:"text-white"},low_stock:{Icon:Ga,bg:"bg-amber-500",fg:"text-white"},out_of_stock:{Icon:vp,bg:"bg-red-500",fg:"text-white"},curated:{Icon:wp,bg:"bg-indigo-500",fg:"text-white"},product_draft_first:{Icon:qc,bg:"bg-emerald-500",fg:"text-white"},product_draft_resume:{Icon:Xc,bg:"bg-blue-500",fg:"text-white"},billing:{Icon:_p,bg:"bg-teal-500",fg:"text-white"},compliance:{Icon:Wc,bg:"bg-orange-500",fg:"text-white"},account:{Icon:xp,bg:"bg-slate-600",fg:"text-white"},marketing:{Icon:bp,bg:"bg-pink-500",fg:"text-white"}},h0={pending:{key:"t_notif_status_pending",cls:"bg-gray-100 text-gray-600",Icon:Np},processing:{key:"t_notif_status_processing",cls:"bg-blue-50 text-blue-600",Icon:St},completed:{key:"t_notif_status_completed",cls:"bg-green-50 text-green-600",Icon:Ap},failed:{key:"t_notif_status_failed",cls:"bg-red-50 text-red-600",Icon:Sp}};function f0({item:e,t:n,onActivate:r,onDismiss:s}){const a=Qi[e.source]||Qi.orders,{Icon:o}=a,d=h0[e.status],u=e.server&&!e.read,l=e.titleKey?n[e.titleKey]||e.title||"":e.title||"",i=e.descriptionKey?n[e.descriptionKey]:e.description||null;return t.jsxs("div",{className:Et("group relative flex w-full items-start gap-3 rounded-xl border-s-[3px] py-2.5 pe-2.5 transition-colors",u?"border-brand-primary bg-brand-primary/[0.07] ps-2 hover:bg-brand-primary/[0.12]":"border-transparent ps-2.5 hover:bg-gray-50"),children:[t.jsxs("button",{type:"button",onClick:()=>r(e),className:"flex min-w-0 flex-1 items-start gap-3 text-start",children:[t.jsx("span",{className:Et("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",a.bg,a.fg),children:t.jsx(o,{className:Et("h-4 w-4",e.status==="processing"&&"animate-spin")})}),t.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[t.jsxs("span",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"min-w-0 flex-1",children:t.jsx(Yi,{text:l,t:n,clampClass:"line-clamp-2",className:Et("break-words text-sm leading-5",u?"font-bold text-gray-900":"font-medium text-gray-700")})}),u?t.jsx("span",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-brand-primary ring-2 ring-brand-primary/20"}):e.server&&e.read?t.jsx("span",{title:n.t_notif_read||"Read",className:"mt-0.5 inline-flex shrink-0 items-center text-gray-400",children:t.jsx(kp,{className:"h-4 w-4"})}):null,typeof e.count=="number"&&e.count>0&&t.jsx("span",{className:"mt-0.5 shrink-0 rounded-full bg-gray-900 px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-white",children:e.count})]}),i&&t.jsx(Yi,{text:i,t:n,clampClass:"line-clamp-2",className:Et("break-words text-xs leading-5",u?"text-gray-700":"text-gray-500")}),t.jsxs("span",{className:"mt-0.5 flex items-center gap-2",children:[d&&t.jsxs("span",{className:Et("inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px] font-semibold",d.cls),children:[t.jsx(d.Icon,{className:Et("h-3 w-3",e.status==="processing"&&"animate-spin")}),n[d.key]]}),e.actionKey&&t.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[11px] font-semibold text-brand-primary",children:[n[e.actionKey],t.jsx(zc,{className:"h-3 w-3 rtl:rotate-180"})]}),typeof e.progress=="number"&&t.jsxs("span",{className:"text-[10px] font-medium tabular-nums text-gray-400",children:[e.progress,"%"]})]})]})]}),e.dismissable&&t.jsx("button",{type:"button",onClick:g=>{g.preventDefault(),g.stopPropagation(),s(e)},"aria-label":n.t_notif_dismiss||"Dismiss",title:n.t_notif_dismiss||"Dismiss",className:"mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-500 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-100 hover:text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-primary/50",children:t.jsx(Ft,{className:"h-4 w-4"})})]})}function y0({items:e,t:n,onActivate:r,onDismiss:s}){if(!e.length)return t.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-6 py-12 text-center",children:[t.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-100",children:t.jsx(nl,{className:"h-5 w-5 text-gray-400"})}),t.jsx("p",{className:"text-sm font-semibold text-gray-900",children:n.t_notif_empty_title}),t.jsx("p",{className:"text-xs text-gray-500",children:n.t_notif_empty_desc})]});const a=e.filter(l=>l.status==="processing"||l.status==="pending"),o=e.filter(l=>l.status==="alert"),d=e.filter(l=>l.status==="completed"||l.status==="failed"),u=({titleKey:l,rows:i})=>i.length?t.jsxs("div",{className:"py-1",children:[t.jsx("p",{className:"px-2.5 pb-1 pt-2 text-[11px] font-semibold text-gray-400",children:n[l]}),i.map(g=>t.jsx(f0,{item:g,t:n,onActivate:r,onDismiss:s},g.key))]}):null;return t.jsxs("div",{className:"flex flex-col",children:[t.jsx(u,{titleKey:"t_notif_section_active",rows:a}),t.jsx(u,{titleKey:"t_notif_section_alerts",rows:o}),t.jsx(u,{titleKey:"t_notif_section_recent",rows:d})]})}function b0({storeId:e,systemCountry:n,isRTL:r=!1,enabled:s=!0,extraItems:a=[],className:o=""}){const d=yt(),u=vm(),l=wt(),[i,g]=c.useState(!1),{items:y,unreadCount:p,markRead:f,markAllRead:x,dismiss:v}=g0({storeId:e,systemCountry:n,language:d.language,isOpen:i,enabled:s,extraItems:a}
751),S=A=>{g(A)},_=A=>{if(A.server&&f(A),typeof A.onClick=="function"&&A.onClick()!==!1){typeof window<"u"?window.requestAnimationFrame(()=>g(!1)):g(!1);return}g(!1),A.route&&l(A.route)},w=A=>{if(typeof A.onDismiss=="function"){A.onDismiss();return}v(A)},C=t.jsxs("button",{type:"button","aria-label":d.t_notif_open_aria||"Open notifications",className:Et("relative flex h-9 w-9 items-center justify-center rounded-full text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900",o),children:[t.jsx(nl,{className:"h-5 w-5"}),p>0&&t.jsx(oa,{className:"absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full border-2 border-white bg-red-500 px-1 text-[10px] font-bold leading-none text-white",variant:"destructive",children:p>9?"9+":p})]}),k=t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-gray-100 px-4 py-3 pr-12",children:[t.jsx(Em,{className:"text-sm font-bold text-gray-900",children:d.t_notif_title}),y.length>0&&t.jsx(mt,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-gray-500 hover:text-gray-900",onClick:x,children:d.t_notif_mark_all_read})]}),L=t.jsx("div",{className:"flex-1 overflow-y-auto px-1 py-1",children:t.jsx(y0,{items:y,t:d,onActivate:_,onDismiss:w})});return t.jsxs(Sm,{open:i,onOpenChange:S,children:[t.jsx(Am,{asChild:!0,children:C}),t.jsxs(Nm,{side:u?"bottom":"right",dir:r?"rtl":"ltr",className:Et("flex flex-col gap-0 p-0",u?"max-h-[80vh] rounded-t-2xl":"w-full sm:max-w-[420px]"),children:[k,L]})]})}const x0="dashboard",_0=e=>e&&typeof e=="object"&&"data"in e?e.data:e,w0=({systemCountry:e,enabled:n=!0}={})=>{const r=Le(e);return $e({queryKey:["product-draft-delivery-mode",{systemCountry:r}],queryFn:async()=>_0(await q("GET",`${r}/system/ai-social/models`)())?.productDraftDeliveryMode==="dashboard"?"dashboard":x0,enabled:!!(n&&r),staleTime:6e4})},Qs=c.lazy(()=>N(()=>import("./packman-ai-product-draft-overlay-BHcwnvJG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url));function v0(){const e=kt(),n=wt(),r=e.pathname.includes("/builder"),s=/\/products\/(create|edit)(\/|$)/.test(e.pathname),a=c.useCallback(G=>{if(!G||typeof G!="string")return;if(/^https?:\/\//i.test(G)){window.open(G,"_blank","noopener,noreferrer");return}const[Ee,Q=""]=G.split("?"),we=Object.fromEntries(new URLSearchParams(Q));n(We(Ee,we))},[n]),o=ae(G=>G.direction),d=ae(G=>G.language),u=o==="rtl",l=ae(G=>G.store?.selectedStore),i=ae(G=>G.store?.selectedStoreDetails),g=l?.id??i?.id??i?.data?.id,y=i?.data||i||{},p=l?.systemCountry?.code||y?.systemCountry?.code||l?.systemCountryCode||y?.systemCountryCode,f=i?.data||i||l,{data:x,isLoading:v}=Ba.useCurrent({storeId:g??0,category:qa.platform},{enabled:!!g}),_=!(f?.status==="inactive"||!!g&&!v&&!x),{data:w}=w0({systemCountry:p,enabled:!!g}),C=_&&w==="dashboard",k=_,L=x?ls(x):!!g&&!v,A=f?.status==="inactive"||er(l)||L,{isPhoneVerified:E}=_d(),{needsProductConfirmation:j,productHint:H,productIdentityOptions:D,confirmProductIdentity:$,refreshIdentityGate:re}=Bx({storeId:g,systemCountry:p,phoneVerified:E}),[pe,te]=c.useState(!1);c.useEffect(()=>{te(!!j)},[j]),c.useEffect(()=>{if(typeof window>"u")return;const G=async()=>{const Ee=await re?.();(!Ee||Ee.needsProductConfirmation)&&te(!0)};return window.addEventListener(Mi,G),()=>window.removeEventListener(Mi,G)},[re]);const R=Zx({storeId:C?g:null,systemCountry:p}),[B,U]=c.useState(null),[K,ee]=c.useState(null),{parked:he,park:fe,discard:ie}=r0({storeId:g}),me=he?.kind==="seeded"?he.payload:null,Re=he?.kind==="hydrated"?he.payload:null;c.useEffect(()=>{if(typeof window>"u")return;const G=Ee=>{if(!k)return;const Q=Ee?.detail;if(!Q||!Q.product)return;const we={product:Q.product,narrative:Q.narrative??null,images:Array.isArray(Q.images)?Q.images:null,focus:Q.focus??null,focusSkipped:!!Q.focusSkipped,focusObjects:Array.isArray(Q.focusObjects)?Q.focusObjects:null};U(we),ie()};return window.addEventListener("packman-ai-product-draft:hydrate",G),()=>{window.removeEventListener("packman-ai-product-draft:hydrate",G)}},[k,ie]),c.useEffect(()=>{if(typeof window>"u")return;const G=Ee=>{if(!k)return;const Q=Ee?.detail,we=Array.isArray(Q?.imageUrls)?Q.imageUrls.filter(Ye=>typeof Ye=="string"&&Ye.length>0):[];if(we.length===0)return;const Oe={imageUrls:we,mediaFiles:Array.isArray(Q?.mediaFiles)?Q.mediaFiles:[],...typeof Q?.returnPath=="string"&&Q.returnPath.length>0?{returnPath:Q.returnPath}:{}};ee(Oe),ie()};return window.addEventListener("packman-ai-product-draft:start",G),()=>{window.removeEventListener("packman-ai-product-draft:start",G)}},[k,ie]),c.useEffect(()=>{if(!C)return;const G=Ee=>{const Q=Ee?.detail||{},we=Q?.source==="notification",Oe=!!(R?.canReenter||R?.shouldShow);
751if(we&&!Oe){if(R?.productCountReady&&R?.hasZeroProducts===!1){ko.info("This draft was already used to create a product. Opening your products."),n(We("/dashboard/products"));return}const Ye=typeof Q?.fallbackRoute=="string"?Q.fallbackRoute.trim():"";if(Ye){a(Ye);return}ko.info("This draft is no longer available to review. Opening your products list instead."),n(We("/dashboard/products"));return}R.requestOpen?.()};return window.addEventListener(Ea,G),()=>window.removeEventListener(Ea,G)},[n,a,C,R]);const ke=c.useCallback(()=>{U(null)},[]),oe=c.useCallback(()=>{ee(null)},[]),se=G=>{if(!G||typeof G!="object")return G;const{returnPath:Ee,...Q}=G;return Q},de=(G,Ee)=>{if(!G)return G;const Q=Ee&&typeof Ee=="object"?Ee:{},we={...G};return Array.isArray(Q.focusObjects)&&(we.focusObjects=Q.focusObjects),typeof Q.focus=="string"&&Q.focus.length>0&&(we.focus=Q.focus),typeof Q.focusSkipped=="boolean"&&(we.focusSkipped=Q.focusSkipped),Q.product&&(we.product=Q.product),Q.narrative&&(we.narrative=Q.narrative),Array.isArray(Q.images)&&(we.images=Q.images),we},Ne=G=>!!(G&&typeof G=="object"&&G.product),ue=G=>!!(G&&typeof G=="object"&&G.directCreated),ve=c.useCallback(G=>{U(Ee=>{if(ue(G))return ie(),null;const Q=de(Ee,G);return Q&&fe({kind:"hydrated",payload:Q}),null})},[fe,ie]),Ve=c.useCallback(G=>{ee(Ee=>{if(ue(G))return ie(),null;const Q=de(Ee,G);return Q&&(Ne(G)?fe({kind:"hydrated",payload:{product:G.product,narrative:G.narrative,images:Array.isArray(Q.imageUrls)?Q.imageUrls:void 0,focus:Q.focus,focusSkipped:Q.focusSkipped,focusObjects:Q.focusObjects}}):fe({kind:"seeded",payload:se(Q)})),null})},[fe,ie]),Te=c.useCallback(G=>{if(R.close(),ue(G)){ie();return}Ne(G)&&fe({kind:"hydrated",payload:{product:G.product,narrative:G.narrative,images:Array.isArray(G.images)?G.images:void 0,focus:G.focus,focusSkipped:G.focusSkipped,focusObjects:G.focusObjects}})},[R,fe,ie]),Ge=c.useCallback(()=>{if(C){if(Re){U(Re),ie();return}me&&(ee(me),ie())}},[C,Re,me,ie]),Be=c.useCallback(()=>{ie()},[ie]),et=C&&!!(me||Re)&&!K&&!B,ge=!et&&C&&R.canReenter&&!R.shouldShow,X=!r&&!s&&!A&&(et||ge),Ce=c.useMemo(()=>{if(r||s||A)return[];const G=[];return et&&G.push({key:"product_draft_resume",source:"product_draft_resume",status:"alert",titleKey:"t_notif_resume_draft_title",descriptionKey:"t_notif_resume_draft_desc",actionKey:"t_notif_action_resume",signature:"product_draft_resume",onClick:Ge,onDismiss:Be,dismissable:!0}),ge&&G.push({key:"product_draft_first",source:"product_draft_first",status:"alert",titleKey:"t_notif_first_product_title",descriptionKey:"t_notif_first_product_desc",actionKey:"t_notif_action_start",signature:"product_draft_first",onClick:()=>R.requestOpen?.(),onDismiss:()=>R.dismissReentry?.(),dismissable:!0}),j&&G.push({key:"curated_identity_confirm",source:"curated_identity_confirm",status:"alert",titleKey:"t_curated_identity_banner_title",descriptionKey:"t_curated_identity_banner_body",actionKey:"t_curated_identity_banner_cta",signature:"curated_identity_confirm",onClick:()=>(te(!0),!0),dismissable:!1}),G},[r,s,A,et,ge,Ge,Be,R,j]),xe=!!(k&&(K||B)||C&&R.shouldShow);c.useEffect(()=>{xe&&(typeof window>"u"||window.dispatchEvent(new CustomEvent("close-ai-chat")))},[xe]);const{shouldBlockRender:dt}=km({systemCountry:p,createUrlWithSc:We,shouldSkipPath:G=>G.includes("/builder"),watchKey:`${p||""}:${g||""}`}),Gt=yt(),{t_wallet:st,t_credits:ft}=Gt,{data:Z}=Tm(l?.id,{enabled:!!l?.id}),M=Z?.data?.data?.balance??Z?.data?.balance??0,Se=G=>G?.toLocaleString()||"0";return c.useEffect(()=>{document.documentElement.dir=o,document.documentElement.lang=d},[o,d]),t.jsxs(Cm,{children:[t.jsx(xf,{}),t.jsx(Af,{}),t.jsx(Fx,{}),t.jsx(qx,{t:Gt,isRTL:u,open:pe&&j,initialValue:H,options:D,onConfirm:$,onClose:()=>te(!1)}),C&&!r&&!s&&R.shouldShow&&t.jsx(c.Suspense,{fallback:null,children:t.jsx(Qs,{onDone:R.close,onDismiss:Te})}),k&&B&&t.jsx(c.Suspense,{fallback:null,children:t.jsx(Qs,{hydration:B,onDone:ke,onDismiss:ve},`hydrated-${B?.product?.basicInfo?.name||"draft"}`)}),k&&K&&t.jsx(c.Suspense,{fallback:null,children:t.jsx(Qs,{seed:K,onDone:oe,onDismiss:Ve},`seeded-${K.imageUrls[0]||"start"}`)}),t.jsx(bf,{}),t.jsxs(jm,{children:[t.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b border-border  transition-[width,height] bg-white ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12",dir:o,children:t.jsxs("div",{className:"flex w-full items-center gap-2 px-4",children:[t.jsx(Im,{className:o==="rtl"?"
751-mr-1":"-ml-1"}),t.jsx("div",{className:"flex min-w-0 flex-1 justify-center px-1",children:t.jsx(Mf,{})}),t.jsxs("div",{className:`flex items-center gap-2 ${o==="rtl"?"flex-row-reverse":""}`,children:[l?.id&&(()=>{const G=M===0,Ee=M>0&&M<20,Q=G?{btn:"bg-gradient-to-r from-red-50 to-rose-50 border-red-200/50 hover:from-red-100 hover:to-rose-100",icon:"bg-red-100",iconColor:"text-red-600",label:"text-red-700",value:"text-red-900"}:Ee?{btn:"bg-gradient-to-r from-amber-50 to-yellow-50 border-amber-200/50 hover:from-amber-100 hover:to-yellow-100",icon:"bg-amber-100",iconColor:"text-amber-600",label:"text-amber-700",value:"text-amber-900"}:{btn:"bg-gradient-to-r from-green-50 to-emerald-50 border-green-200/50 hover:from-green-100 hover:to-emerald-100",icon:"bg-green-100",iconColor:"text-green-600",label:"text-green-700",value:"text-green-900"};return t.jsxs(mt,{variant:"ghost",size:"sm",className:`hidden sm:flex gap-2 border px-3 h-9 ${Q.btn}`,onClick:()=>n("/dashboard/wallet"),children:[t.jsx("div",{className:`flex items-center justify-center h-6 w-6 rounded-md ${Q.icon}`,children:t.jsx(wr,{className:`h-3.5 w-3.5 ${Q.iconColor}`})}),t.jsxs("div",{className:"flex flex-col items-start",children:[t.jsx("span",{className:`text-[10px] font-medium leading-none ${Q.label}`,children:st||"Wallet"}),t.jsxs("span",{className:`text-xs font-semibold leading-tight ${Q.value}`,children:[Se(M)," ",ft||"Credits"]})]})]})})(),t.jsx(b0,{storeId:g,systemCountry:p,isRTL:u,enabled:!A,extraItems:Ce}),t.jsx(Lx,{className:"hidden sm:flex",disabled:A,hideWakeHint:X}),t.jsx(Ux,{})]})]})}),t.jsx(Wf,{}),t.jsx("div",{className:`flex w-full flex-1 flex-col px-2 pt-2 md:px-5 md:pt-5 ${r?"pb-2 md:pb-5":"pb-[calc(5.5rem+env(safe-area-inset-bottom))] sm:pb-[calc(6.5rem+env(safe-area-inset-bottom))]"}`,children:r?t.jsx(Jt,{}):t.jsx(Bf,{children:dt?t.jsx("div",{className:"w-full min-h-[50vh] flex items-center justify-center",children:t.jsx(Qt,{size:"sm",variant:"black"})}):t.jsxs(t.Fragment,{children:[t.jsx(jf,{}),t.jsx(Jt,{})]})})})]})]})}const E0=[{code:"en",label:"EN",full:"English"},{code:"ar",label:"ع",full:"العربية"}];function S0({compact:e=!1}){const{language:n,setLanguage:r}=ao(),s=n==="ar"?"ar":"en";return t.jsxs("div",{className:Uo("inline-flex items-center gap-1 rounded-full border border-white/60 bg-white/80 p-1 shadow-sm ring-1 ring-slate-900/5 backdrop-blur-md",e?"h-9":"h-10"),role:"group","aria-label":"Language",children:[t.jsx("span",{className:"ms-1.5 flex h-6 w-6 items-center justify-center rounded-full text-slate-400",children:t.jsx(as,{className:"h-4 w-4"})}),E0.map(a=>{const o=s===a.code;return t.jsxs("button",{type:"button",onClick:()=>r(a.code),"aria-pressed":o,title:a.full,className:Uo("relative flex h-7 min-w-[2rem] cursor-pointer items-center justify-center rounded-full px-2.5 text-sm font-semibold transition-colors duration-200",o?"text-white":"text-slate-500 hover:text-slate-900"),children:[o&&t.jsx(At.span,{layoutId:"lang-switcher-active",transition:{type:"spring",stiffness:420,damping:32},className:"absolute inset-0 -z-10 rounded-full bg-[color:var(--brand-secondary)] shadow-sm"}),a.label]},a.code)})]})}const A0="97145940603",N0="[email protected]";function k0(){const{t:e}=_r("onboarding"),n=`https://wa.me/${A0}`,r=`mailto:${N0}`;return t.jsxs(us,{children:[t.jsx(ps,{asChild:!0,children:t.jsxs(mt,{variant:"outline",className:"border-brand-600 rounded-2xl bg-transparent flex gap-2 items-center p-2",children:[t.jsx(Tp,{className:"text-brand-600 flex-shrink-0",size:20}),t.jsx("div",{className:"hidden sm:block text-sm font-semibold text-brand-600 leading-5",children:e("helpButton")})]})}),t.jsxs(ms,{className:"w-80 sm:w-96 max-w-[calc(100vw-2rem)] rounded-2xl shadow-4xl p-4 flex flex-col gap-1",children:[t.jsx("p",{className:"text-sm text-base-black",children:e("helpDescription")}),t.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"block",children:t.jsxs(mt,{variant:"default",className:"w-full text-sm font-semibold leading-5 capitalize gap-1 items-center flex py-3 px-4",children:[t.jsx(Cp,{className:"w-5 h-5"}),t.jsx("div",{className:"text-center flex-1",children:e("helpCallUs")})]})}),t.jsx("a",{href:r,className:"block",children:t.jsxs(mt,{variant:"outline",className:"w-full text-sm text-brand-700 font-semibold leading-5 capitalize gap-1 items-center flex border-brand-300 bg-transparent py-3 px-4",children:[t.jsx(jp,{className:"text-brand-700",size:20}),t.jsx("div",{className:"text-center flex-1",children:e("helpEmailUs")})]})})]})]})}function T0(){const{t:e}=_r("onboarding");return t.jsxs("header",{className:"fixed z-50 flex w-full items-center border-b border-white/40 bg-white/70 shadow-sm backdrop-blur-md",children:[t.jsxs("div",{className:"hidden md:flex md:min-w-[280px] lg:min-w-[320px] items-center gap-3 whitespace-nowrap p-4 md:p-6",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700",children:e("haveAccount")||"Have an account?"}),t.jsx(On,{to:m.AUTH.LOGIN,children:t.jsxs(At.button,{className:"group relative flex flex-shrink-0 items-center justify-center gap-2 overflow-hidden rounded-full bg-yellow-secondary-500 px-4 py-2 shadow-md transition-all duration-300 hover:bg-yellow-secondary-600 hover:shadow-lg",whileHover:{scale:1.02},whileTap:{scale:.98},children:[t.jsx("span",{className:"text-sm font-bold text-gray-900",children:e("login")||"Login"}),t.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-gray-800",children:t.jsx(To,{className:"h-3 w-3 text-white rtl:rotate-180",strokeWidth:2.5})})]})})]}),t.jsxs("div",{className:"flex flex-1 justify-start p-3 md:justify-center md:p-6",children:[t.jsx("span",{className:"flex md:hidden",children:t.jsx(ha,{size:30,variant:"icon"})}),t.jsx("span",{className:"hidden md:flex",children:t.jsx(ha,{size:32,variant:"full"})})]}),t.jsxs("div",{className:"flex items-center justify-end gap-2 p-3 md:min-w-[280px] md:gap-3 md:p-6 lg:min-w-[320px]",children:[t.jsx(S0,{compact:!0}),t.jsx(On,{to:m.AUTH.LOGIN,className:"md:hidden",children:t.jsxs(At.button,{className:"group relative flex flex-shrink-0 items-center justify-center gap-1.5 overflow-hidden rounded-full bg-yellow-secondary-500 px-3 py-1.5 shadow-md transition-all duration-300 hover:bg-yellow-secondary-600 hover:shadow-lg",whileHover:{scale:1.02},whileTap:{scale:.98},children:[t.jsx("span",{className:"text-xs font-bold text-gray-900",children:e("login")||"Login"}),t.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-gray-800",children:t.jsx(To,{className:"h-2.5 w-2.5 text-white rtl:rotate-180",strokeWidth:2.5})})]})}),t.jsx(k0,{})]})]})}function C0(){const e=Co(0),n=Co(0),r=jo(e,{stiffness:40,damping:18,mass:.6}),s=jo(n,{stiffness:40,damping:18,mass:.6}),a=rn(r,f=>f*46),o=rn(s,f=>f*46),d=rn(r,f=>f*-34),u=rn(s,f=>f*-34),l=rn(r,f=>f*24),i=rn(s,f=>f*24),g=rn(r,f=>`${50+f*60}%`),y=rn(s,f=>`${50+f*60}%`),p=rn([g,y],([f,x])=>`radial-gradient(420px circle at ${f} ${x}, rgba(210,248,1,0.16), transparent 60%)`);return c.useEffect(()=>{const f=x=>
751{const v=x.clientX/window.innerWidth-.5,S=x.clientY/window.innerHeight-.5;e.set(v),n.set(S)};return window.addEventListener("pointermove",f,{passive:!0}),()=>window.removeEventListener("pointermove",f)},[e,n]),t.jsxs("div",{className:"pointer-events-none fixed inset-0 -z-10 overflow-hidden","aria-hidden":"true",children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-[color:var(--brand-50)] via-white to-slate-50"}),t.jsx("div",{className:"absolute left-1/2 top-[-30%] h-[120vmax] w-[120vmax] -translate-x-1/2 animate-[onboarding-spin-slow_60s_linear_infinite] opacity-70",children:t.jsx("div",{className:"h-full w-full",style:{background:"conic-gradient(from 0deg, rgba(210,248,1,0.12), rgba(44,42,89,0.10), rgba(167,139,250,0.10), rgba(210,248,1,0.12))",maskImage:"radial-gradient(closest-side, black, transparent)",WebkitMaskImage:"radial-gradient(closest-side, black, transparent)"}})}),t.jsx("div",{className:"absolute inset-0 opacity-[0.5]",style:{backgroundImage:"radial-gradient(rgba(148,163,184,0.22) 1px, transparent 1.4px)",backgroundSize:"26px 26px",maskImage:"radial-gradient(ellipse 90% 70% at 50% 40%, black 35%, transparent 80%)",WebkitMaskImage:"radial-gradient(ellipse 90% 70% at 50% 40%, black 35%, transparent 80%)"}}),t.jsx(At.div,{style:{x:a,y:o},className:"absolute -top-24 start-[-10%] h-[440px] w-[440px] rounded-full bg-[color:var(--brand)]/30 blur-[90px] animate-[onboarding-drift_18s_ease-in-out_infinite]"}),t.jsx(At.div,{style:{x:d,y:u},className:"absolute top-[26%] end-[-8%] h-[380px] w-[380px] rounded-full bg-[color:var(--brand-secondary)]/20 blur-[80px] animate-[onboarding-drift-alt_22s_ease-in-out_infinite]"}),t.jsx(At.div,{style:{x:l,y:i},className:"absolute bottom-[-12%] start-[18%] h-[340px] w-[340px] rounded-full bg-violet-300/25 blur-[70px] animate-[onboarding-drift_26s_ease-in-out_infinite_reverse]"}),t.jsx("div",{className:"absolute inset-x-0 top-0 h-64 bg-gradient-to-b from-white/70 to-transparent"}),t.jsx(At.div,{className:"absolute inset-0 hidden md:block",style:{background:p}}),t.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_0%,rgba(248,250,252,0.55)_72%)]"})]})}function j0(){const{direction:e,language:n}=ae(),{t:r}=_r("onboarding");return c.useEffect(()=>{document.documentElement.dir=e,document.documentElement.lang=n},[e,n]),t.jsxs(t.Fragment,{children:[t.jsx("title",{children:r("pageTitle")}),t.jsx("meta",{name:"description",content:r("pageDescription")}),t.jsx("meta",{name:"keywords",content:r("pageKeywords")}),t.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),t.jsx("meta",{property:"og:title",content:r("pageTitle")}),t.jsx("meta",{property:"og:description",content:r("pageDescription")}),t.jsx("meta",{property:"og:type",content:"website"}),t.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),t.jsx("meta",{name:"twitter:title",content:r("pageTitle")}),t.jsx("meta",{name:"twitter:description",content:r("pageDescription")}),t.jsxs("div",{className:"relative min-h-screen bg-brand-50 font-poppins",children:[t.jsx(C0,{}),t.jsx(T0,{}),t.jsx("div",{className:"bg-transparent px-0 mx-auto",children:t.jsx(Jt,{})})]})]})}const I0=["prompt","imageUrl","instagramUrl","autoStart","onboardingId","uid","taskId","stage","src"],R0=()=>{if(!(typeof window>"u"))try{const e=new URL(window.location.href);let n=!1;I0.forEach(r=>{e.searchParams.has(r)&&(e.searchParams.delete(r),n=!0)}),n&&window.history.replaceState({},"",e.toString())}catch{}};function wd({open:e,currentEmail:n,isHandoff:r=!1}){const{t:s,i18n:a}=_r("onboarding"),o=wt(),d=qe(_=>_.signOutPreservingOnboarding),[u,l]=c.useState(!1),i=a.language==="ar",g=()=>{r&&R0(),o(We(m.HOME),{replace:!0})},y=async()=>{l(!0);try{d()}finally{l(!1)}},p=r?s("switchSeller.handoff.title","Where should this new product go?"):s("switchSeller.title","You're already signed in"),f=r?n?s("switchSeller.handoff.descriptionWithEmail",{defaultValue:"You're signed in as {{email}} and we've already started analyzing the product image you uploaded. Choose whether to finish this new product under a fresh store, or keep your current store and ignore this upload.",email:n}):s("switchSeller.handoff.description","You're already signed in and we've started analyzing the product image you uploaded. Choose whether to finish this new product under a fresh store, or keep your current store and ignore this upload."):n?
751s("switchSeller.descriptionWithEmail",{defaultValue:"You're signed in as {{email}}, but you're in the middle of setting up a new store in this tab.",email:n}):s("switchSeller.description","You're signed in to a seller account, but you're in the middle of setting up a new store in this tab."),x=r?s("switchSeller.handoff.hint","Choose “Sign out & continue this product” to keep the analysis we've already started and finish setting up this new store under a fresh session. Or choose “Keep my current store” to stay signed in and discard this upload."):s("switchSeller.hint","Choose “Sign out & continue this setup” to keep the progress you've already made and finish this new store under a fresh session. Or choose “Go to my current store” to keep your existing account and discard this new setup. If you want both accounts active at the same time, open this signup in a private/incognito window instead."),v=r?s("switchSeller.handoff.continueCurrent","Keep my current store"):s("switchSeller.continueCurrent","Go to my current store"),S=r?s("switchSeller.handoff.startNewSignup","Sign out & continue this product"):s("switchSeller.startNewSignup","Sign out & continue this setup");return t.jsx(Rm,{open:e,children:t.jsxs(Pm,{dir:i?"rtl":"ltr",onEscapeKeyDown:_=>_.preventDefault(),onPointerDownOutside:_=>_.preventDefault(),className:"w-[calc(100%-2rem)] max-w-[calc(100%-2rem)] sm:max-w-lg max-h-[calc(100vh-2rem)] overflow-y-auto p-5 sm:p-6 gap-5",children:[t.jsxs(Om,{className:"space-y-3",children:[t.jsx(Dm,{className:"text-base sm:text-lg leading-snug",children:p}),t.jsxs(Lm,{className:"space-y-2 text-[13px] sm:text-sm leading-relaxed",children:[t.jsx("span",{className:"block",children:f}),t.jsx("span",{className:"block",children:x})]})]}),t.jsxs(Um,{className:"gap-2 sm:gap-3",children:[t.jsx(Mm,{onClick:g,disabled:u,className:"w-full sm:w-auto whitespace-normal text-center leading-tight h-auto min-h-10 py-2 px-3 sm:px-4 mt-0",children:v}),t.jsx(Gm,{onClick:y,disabled:u,className:"bg-brand-600 text-white hover:bg-brand-700 w-full sm:w-auto whitespace-normal text-center leading-tight h-auto min-h-10 py-2 px-3 sm:px-4",children:u?t.jsxs("span",{className:"flex items-center justify-center gap-2",children:[t.jsx(Qt,{size:"sm",variant:"white"}),s("switchSeller.signingOut","Signing out…")]}):S})]})]})})}const P0=bt("on-boarding","on-boardings",{listOptions:{staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,enabled:!0}}),Xi=Er("onboarding"),O0={...Xi,sendOtp:()=>[...Xi.all,"sendOtp"]},vd={getStatus:(e,n)=>{const r=`ae/on-boardings/${e}/status?email=${encodeURIComponent(n)}`;return q("GET",r)(null,null)},sendOtp:(e,n)=>{const{lang:r}=e,s=`ae/auth/sellers/onboarding/otp/send?lang=${r}`;return q("POST",s)(null,n)}},D0=bt("onboarding-register","auth/sellers/onboarding/register",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),L0=bt("google-signin-seller","auth/sellers/google",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),U0=bt("apple-signin-seller","auth/sellers/apple",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),M0=bt("v2-send-verification","auth/sellers/v2/send-verification",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),G0=bt("v2-verify-email","auth/sellers/v2/verify-email",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),$0=bt("v2-claim-session","auth/sellers/v2/claim-session",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),V0=bt("send-verify-otp","auth/sellers/onboarding/otp/send",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),F0=bt("verify-otp","auth/sellers/onboarding/otp/verify",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),z0=bt("change-phone-number","auth/sellers/onboarding/phone/change/send",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),W0=bt("verify-phone-change","auth/sellers/onboarding/phone/change/verify",{listOptions:{enabled:!1},detailOptions:{enabled:!1}}),B0=Er("onboarding-status"),q0=(e,n,r={})=>$e({queryKey:[...B0.all,e,n],queryFn:()=>vd.getStatus(e,n),enabled:!!(e&&n),staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,...r}),HI=()=>mn(O0,({params:e,body:n})=>
751vd.sendOtp(e,n))(),{useCreate:YI,useUpdate:QI}=P0.hooks,XI=D0.hooks.useCreate,JI=L0.hooks.useCreate,ZI=U0.hooks.useCreate,e1=M0.hooks.useCreate,t1=G0.hooks.useCreate,n1=$0.hooks.useCreate;V0.hooks.useCreate;const r1=F0.hooks.useCreate,s1=z0.hooks.useCreate,a1=W0.hooks.useCreate,K0=()=>q("GET","ae/on-boardings/signup-bonus")(null,null);function o1(){return $e({queryKey:["signup-bonus"],queryFn:async()=>{const e=await K0();return e?.data?.bonusCredits??e?.bonusCredits??0},staleTime:5*60*1e3})}const Ed=()=>t.jsx("div",{className:"w-screen min-h-screen h-full flex flex-col items-center justify-center",children:t.jsx(Qt,{size:"sm",className:"",variant:"black"})}),qn=[],H0=4e3,Y0=6;let Ji=!1;const Q0=e=>{const n=Date.now(),r=typeof window<"u"?window.location.pathname+window.location.search:"",{isAuthenticated:s,token:a}=qe.getState();for(qn.push({t:n,from:r,to:e,isAuthenticated:s,hasToken:!!a});qn.length>0&&n-qn[0].t>H0;)qn.shift();Pt("guard-redirect",{to:e,isAuthenticated:s,hasToken:!!a}),!Ji&&qn.length>=Y0&&(Ji=!0,Pt("REDIRECT-LOOP-DETECTED",{hops:qn.map(o=>`${o.from} -> ${o.to} (auth=${o.isAuthenticated?1:0},tok=${o.hasToken?1:0})`)}))},X0=3e3,Jr=({to:e})=>(c.useEffect(()=>{Q0(e)},[e]),c.useEffect(()=>{const n=setTimeout(()=>{Pt("redirect-watchdog: SPA navigation never committed, hard-navigating",{to:e}),window.location.replace(e)},X0);return()=>clearTimeout(n)},[e]),t.jsxs(t.Fragment,{children:[t.jsx(Ed,{}),t.jsx(it,{to:e,replace:!0})]})),ho=({shouldBeAuthenticated:e=!0,skipAuthenticatedRedirect:n=!1}={})=>{const{isAuthenticated:r,token:s}=qe(),a=r&&!!s,o=e&&a,{isLoading:d,isError:u}=jr({enabled:o}),l=r&&!s;c.useEffect(()=>{l&&Pt("stale-session-flag (isAuthenticated=true, token=null)",{shouldBeAuthenticated:e})},[l,e]);const i=o&&u;return c.useEffect(()=>{i&&(Pt("profile-error -> clearing token + redirect to login"),qe.getState().setToken(null))},[i]),o&&d?t.jsx(Ed,{}):i?t.jsx(Jr,{to:We(m.AUTH.LOGIN)}):e&&!a?t.jsx(Jr,{to:We(m.AUTH.LOGIN)}):!e&&a&&!n?t.jsx(Jr,{to:We(m.HOME)}):null},J0=[m.HOME,m.SUBSCRIPTIONS.INDEX,"/dashboard/subscription-orders",m.STORE.CREATE,m.STORE.VAT_SETTINGS,m.STORE.DOCUMENTS],Z0=e=>{const{isAuthenticated:n}=qe(),{selectedStore:r,isLoadingStoreDetails:s}=ae(d=>d.store);if(!n)return{shouldRedirect:!1,isLoading:!1};const a=r;return s||!a?{shouldRedirect:!1,isLoading:!1}:er(a)&&!J0.some(u=>e?.startsWith(u))?{shouldRedirect:!0,redirectTo:m.SUBSCRIPTIONS.INDEX,isLoading:!1}:{shouldRedirect:!1,isLoading:!1}},e_=()=>{const e=ho({shouldBeAuthenticated:!0}),n=kt();c.useEffect(()=>{Pt("PrivateGuard mounted")},[]);const{shouldRedirect:r,redirectTo:s,isLoading:a}=Z0(n.pathname),o=wt(),{stores:d,selectedStore:u}=ae(i=>i.store),{isLoading:l}=jr();if(c.useEffect(()=>{if(!u)return;const i=x=>x?String(x).toLowerCase():void 0,g=u?.systemCountry,y=(typeof g=="string"?i(g):i(g?.code)||i(g?.iso)||i(g?.iso2)||i(g?.iso3)||i(g?.isoCode)||i(g?.countryCode)||i(g?.slug))||void 0;if(!y)return;const p=new URLSearchParams(n.search);if(i(p.get("sc"))!==y){p.set("sc",y);const x=p.toString();o(x?`${n.pathname}?${x}`:n.pathname,{replace:!0})}},[u,n.pathname,n.search,o]),c.useEffect(()=>{!l&&d.length>0&&!u&&Xt(d[0])},[d,u,l]),e)return e;if(!l&&d.length===0&&n.pathname!==m.AUTH.SELECT_STORE)return t.jsx(Jr,{to:We(m.AUTH.SELECT_STORE)});if(a)return t.jsx("div",{className:"w-screen min-h-screen h-full flex flex-col items-center justify-center",children:t.jsx(Qt,{size:"sm",className:"",variant:"black"})});if(r){const i=s||m.HOME;return t.jsx(it,{to:We(i),replace:!0})}return t.jsx(v0,{})},t_=()=>{const e=ho({shouldBeAuthenticated:!1,skipAuthenticatedRedirect:!0}),{isAuthenticated:n,user:r}=qe(),{onboardingStage:s,onboardingId:a}=ae(j=>j.onboarding),{resetOnboardingStage:o}=ae(j=>j.onboarding),{chatAnswers:d}=ae(j=>j.chat),[u]=xr(),l=c.useRef(!1),i=location.pathname===m.ONBOARDING.BUILDER,g=location.pathname===m.ONBOARDING.VERIFY_OTP,y=vh(u,"data"),p=y?.email||d?.email,f=y?.onBoardingId||a,{data:x,isLoading:v,isError:S}=q0(f,p,{enabled:!!(f&&p)}),_=!!(f&&p&&S);if(c.useEffect(()=>{_&&!l.current&&(l.current=!0,o())},[_,o]),e)return e;if(f&&p&&v)return t.jsx("div",{className:"w-screen min-h-screen h-full flex flex-col items-center justify-center",children:t.jsx(Qt,{size:"sm",className:"",variant:"black"})});if(_)return t.jsx(it,{to:We(m.ONBOARDING.START),replace:!0});if(f&&p&&x&&!S){const j=x.data;if(j.completed&&!j.phoneNumberVerified&&j.registered,j.completed&&(j.phoneNumberVerified||Nl())&&j.registered)return t.jsx(it,{to:We(m.AUTH.LOGIN),replace:!0});g&&j.completed&&!j.registered&&j.phoneNumberVerified}if(i&&y&&x&&!S){const j=x.data;y.onBoardingId&&y.email&&y.token&&j.registered&&j.phoneNumberVerified}if(u.has("data")&&y===null)return t.jsx(it,{to:We(m.ONBOARDING.START),replace:!0});const w=!!y?.onBoardingId,C=!!y?.email,k=!!y?.token,L=w&&C&&k;if(i){const j=s?.name===De.LITE_BUILDER;if(n&&j&&!L)return Ol(),t.jsx(it,{to:We(m.HOME),replace:!0});if(!(j||L))return t.jsx(it,{to:We(m.ONBOARDING.START),replace:!0})}const A=u.get("src")==="packman-website"||u.has("imageUrl")||u.has("prompt")||u.has("autoStart"),E=n?t.jsx(wd,{open:!0,currentEmail:r?.email,isHandoff:A}):null;return s?.name===De.LITE_BUILDER?t.jsxs(t.Fragment,{children:[t.jsx(Jt,{}),E]}):t.jsxs(t.Fragment,{children:[t.jsx(j0,{}),E]})},n_=()=>{const{selectedStore:e,selectedStoreDetails:n}=ae(a=>a.store);return(n?.data||n||e)?.type==="website"?t.jsx(it,{to:We(m.STORE.GENERAL),replace:!0}):t.jsx(Jt,{})},r_=()=>{const e=kt(),{onboardingId:n}=ae(C=>C.onboarding),{resetOnboardingStage:r}=ae(C=>C.onboarding),{isAuthenticated:s,user:a,token:o}=qe(),{selectedStore:d,stores:u}=ae(C=>C.store),[l]=xr(),g=!!(br()&&s&&o);c.useEffect(()=>{g&&!ma()&&Cr(o)},[g,o]);const y=e.pathname===m.AUTH.SIGNUP,p=e.pathname===m.AUTH.VERIFY_OTP,f=e.pathname===m.AUTH.SELECT_STORE,v=s&&(y&&!!n),S=s&&(p||f)&&!v,{isLoading:_}=jr({enabled:S}
751),w=ho({shouldBeAuthenticated:!1,skipAuthenticatedRedirect:v||g||p||f});if(f&&s&&!_){if(u.length===0)return t.jsx(Jt,{});const C=u.length>1,k=u.length>0&&!d;if(C||k)return t.jsx(Jt,{});if(d)return t.jsx(it,{to:We(m.HOME),replace:!0})}if(p&&s&&!_&&u.length>0&&!d)return t.jsx(Cs,{});if(g)return t.jsx("div",{className:"w-screen min-h-screen h-full flex flex-col items-center justify-center",children:t.jsx(Qt,{size:"sm",className:"",variant:"black"})});if(w)return w;if(y&&Nl())return n?t.jsx(it,{to:We(m.ONBOARDING.BUILDER),replace:!0}):(r(),t.jsx(it,{to:We(m.ONBOARDING.START),replace:!0}));if(y&&!n)return r(),t.jsx(it,{to:We(m.ONBOARDING.START),replace:!0});if(v){const C=l.get("src")==="packman-website"||l.has("imageUrl")||l.has("prompt")||l.has("autoStart");return t.jsxs(t.Fragment,{children:[t.jsx(Cs,{}),t.jsx(wd,{open:!0,currentEmail:a?.email,isHandoff:C})]})}return t.jsx(Cs,{})},s_=()=>{const{isAuthenticated:e,token:n}=qe();return!e&&!n?t.jsx(it,{to:We(m.AUTH.LOGIN),replace:!0}):t.jsx(Jt,{})},I=e=>function(r){const[s,a]=c.useState(!0);return t.jsxs(t.Fragment,{children:[t.jsx(Fa,{children:s&&t.jsx(At.div,{initial:{opacity:0}
751,animate:{opacity:1},exit:{opacity:0,transition:{duration:.4,ease:"easeInOut"}},className:"fixed inset-0 z-50",children:t.jsx(eg,{})},"loading-overlay")}),t.jsx(c.Suspense,{fallback:null,children:t.jsx(At.div,{initial:{opacity:0},animate:{opacity:s?0:1},transition:{duration:.6,ease:[.4,0,.2,1],delay:s?0:.2},children:t.jsx(a_,{Component:e,onLoadComplete:()=>a(!1),...r})})})]})};function a_({Component:e,onLoadComplete:n,...r}){return c.useEffect(()=>{const s=setTimeout(()=>{n()},100);return()=>clearTimeout(s)},[n]),t.jsx(e,{...r})}function o_(){return t.jsx("div",{className:"min-h-full w-full rounded-lg bg-white",children:t.jsx(Jt,{})})}const i_=bt("templates","templates",{listOptions:{staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,enabled:!0},detailOptions:{staleTime:0,refetchOnWindowFocus:!1,refetchOnMount:!0,enabled:!0}}),or={uploadToGallery:(e,n)=>{const r=Le();return q("POST",`${r}/files/upload-file`)(null,n)},cloneFromTheme:e=>{const n=Le();return q("POST",`${n}/templates/clone-from-theme`)(null,e)},refreshFromTheme:({templateId:e,source:n="latest",strategy:r="merge"})=>{const s=Le();return q("POST",`${s}/templates/${e}/refresh-from-theme`)(null,{source:n,strategy:r})},updatePage:(e,n)=>{const r=Le();return q("PATCH",`${r}/template-pages/${e}`)(null,n)},updatePageContent:(e,n)=>{const r=Le();return q("PATCH",`${r}/template-pages/${e}/content`)(null,n)},createPage:e=>{const n=Le();return q("POST",`${n}/template-pages`)(null,e)}},c_=(e,n)=>bl.generateTemplateContent(e,n),l_=()=>({mutateAsync:async e=>await or.uploadToGallery({},e)}),i1=()=>({mutateAsync:async e=>await c_(null,e)}),c1=()=>{const e=Ie();return Ue({mutationFn:async n=>(await or.cloneFromTheme(n)).data,onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["store-templates",r.storeId]}),e.invalidateQueries({queryKey:["templates"]})}})},l1=()=>{const e=Ie();return Ue({mutationFn:async n=>(await or.refreshFromTheme(n)).data,onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["store-templates"]}),e.invalidateQueries({queryKey:["templates"]}),e.invalidateQueries({queryKey:["templates",r?.templateId]})}})},d1=()=>{const e=Ie();return Ue({mutationFn:async({pageId:n,payload:r})=>(await or.updatePage(n,r)).data,onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})},u1=()=>{const e=Ie();return Ue({mutationFn:async({pageId:n,payload:r})=>(await or.updatePageContent(n,r)).data,onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})},p1=()=>{const e=Ie();return Ue({mutationFn:async n=>(await or.createPage(n)).data,onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})},{useList:m1,useDetail:d_,useCreate:u_,useUpdate:p_}=i_.hooks,m_=async e=>{try{return await bl.generateComponentContent(null,e)}catch(n){throw console.error("AI Generation Error:",n),n}},g_=(e={})=>async(n,r,s,a="")=>{const o={componentType:n,storeName:e.storeName||"",StoreIndustry:e.StoreIndustry||"",StoreDescription:e.StoreDescription||"",propertyType:r,text:s,Prompt:a};return await m_(o)};function h_(){const e=wt(),n=kt(),{templateId:r}=Ip(),[s]=xr();s.get("storeUid");const{language:a,store:o}=ae(),{selectedStore:d}=o||{},u=l_();u_(),p_(),console.log({templateId:r});const l=d_(r,{},{enabled:!!r}),{data:i,isError:g,isLoading:y,refetch:p}=l,f=fh(i?.data,n.state);f?.store,g_({storeName:f?.name||"",StoreIndustry:"",StoreDescription:f?.description||""}),u.isPending,u.error;const x=c.useCallback(()=>{typeof window<"u"&&window.history.state&&window.history.state.idx>0?e(-1):e(m.THEME_TEMPLATES.INDEX,{replace:!0})},[e]),v=!!(n.state?.isClone||n.state?.sourceTemplate);return c.useEffect(()=>{if(!r&&!v){x();return}r&&g&&x()},[r,v,g,x]),null}function f_(){const{language:e}=ae(),n=e==="ar",{selectedStore:r,selectedStoreDetails:s}=ae(l=>l.store),o=(s?.data||s||r)?.type==="website",d=zl.map(l=>!o&&l.storeTypes.includes("ecommerce")?l:l.storeTypes.includes("all")?{...l,cards:l.cards.filter(i=>i.storeTypes.includes("all"))}:null).filter(Boolean),u=n?o?Nn.titleArWebsite:Nn.titleAr:o?Nn.titleEnWebsite:Nn.titleEn;return t.jsxs("div",{className:"p-4 md:p-6",dir:n?"rtl":"ltr",children:[t.jsxs("div",{className:"mb-6",children:[t.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-brand-secondary/10 flex items-center justify-center",children:t.jsx(os,{className:"h-6 w-6 text-brand-secondary"})}),t.jsx("h1",{className:"text-2xl font-bold",children:u})]}),t.jsx("p",{className:"text-muted-foreground text-sm",children:n?Nn.descriptionAr:Nn.descriptionEn})]}
751),t.jsx("div",{className:"flex flex-col gap-6",children:d.map(l=>t.jsxs("div",{children:[t.jsx("div",{className:"mb-3",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold text-primary-foreground bg-primary px-3 py-1 rounded-full shadow-sm tracking-wide",children:[l.icon&&t.jsx(l.icon,{className:"h-3.5 w-3.5 shrink-0"}),n?l.labelAr:l.labelEn]})}),t.jsx(tg,{children:l.cards.map(i=>{const g=i.icon;return t.jsx(On,{to:i.route,children:t.jsx($m,{className:"h-full cursor-pointer transition-all duration-200 hover:shadow-md hover:-translate-y-0.5",children:t.jsxs(Vm,{className:"p-3 md:p-4",children:[t.jsx("div",{className:`w-8 h-8 md:w-10 md:h-10 rounded-lg ${i.color} flex items-center justify-center mb-2`,children:t.jsx(g,{className:"h-4 w-4 md:h-5 md:w-5"})}),t.jsx(Fm,{className:"text-sm md:text-base leading-snug",children:n?i.titleAr:i.titleEn}),t.jsx(zm,{className:"text-[11px] leading-snug line-clamp-2 md:text-sm md:line-clamp-none",children:n?i.descriptionAr:i.descriptionEn})]})})},i.key)})})]},l.key))})]})}const y_=I(T.lazy(()=>N(()=>import("./index-C3S05cQG.js"),__vite__mapDeps([9,1,2,3,4,5,6,8]),import.meta.url))),b_=T.lazy(()=>N(()=>import("./index-CAdnOMhD.js"),__vite__mapDeps([10,1,2,3,5,4,6,8]),import.meta.url)),x_=T.lazy(()=>N(()=>import("./index-SUX2xzW4.js"),__vite__mapDeps([11,1,2,3,5,4,6,8]),import.meta.url)),__=T.lazy(()=>N(()=>import("./index-BgML80Ht.js"),__vite__mapDeps([12,1,2,3,4,5,6,8]),import.meta.url)),w_=T.lazy(()=>N(()=>import("./index-BmemELyl.js"),__vite__mapDeps([13,1,2,3,4,5,6,8]),import.meta.url)),v_=T.lazy(()=>N(()=>import("./index-Cfnv_9yb.js"),__vite__mapDeps([14,1,2,3,4,5,6,8]),import.meta.url)),E_=T.lazy(()=>N(()=>import("./index-CHjkDtBC.js"),__vite__mapDeps([15,1,2,3,4,5,6,8]),import.meta.url)),S_=T.lazy(()=>N(()=>import("./index-CiLd2ZpN.js"),__vite__mapDeps([16,1,2,3,4,5,6,8]),import.meta.url)),A_=T.lazy(()=>N(()=>import("./index-DtZoZkgf.js"),__vite__mapDeps([17,1,2,3,4,5,6,8]),import.meta.url)),N_=T.lazy(()=>N(()=>import("./index-BZPr6Z17.js"),__vite__mapDeps([18,1,2,3,4,5,6,8]),import.meta.url)),k_=T.lazy(()=>N(()=>import("./index-CXu29fZL.js"),__vite__mapDeps([19,1,2,3,4,5,6,8]),import.meta.url)),T_=T.lazy(()=>N(()=>import("./index-B7Xwh1iU.js"),__vite__mapDeps([20,1,2,3,4,5,6,8]),import.meta.url)),C_=T.lazy(()=>N(()=>import("./index-Des2DaAP.js"),__vite__mapDeps([21,1,2,3,4,5,6,8]),import.meta.url)),j_=T.lazy(()=>N(()=>import("./index-Cdnd0HIV.js"),__vite__mapDeps([22,1,2,3,5,4,6,8]),import.meta.url)),I_=T.lazy(()=>N(()=>import("./search-sync-Bfq1Tbld.js"),__vite__mapDeps([23,1,2,3,5,4,6]),import.meta.url)),R_=T.lazy(()=>N(()=>import("./index-C1I5TqtF.js"),__vite__mapDeps([24,1,2,3,5,4,6,8]),import.meta.url)),P_=T.lazy(()=>N(()=>import("./index-DzzAY_zv.js"),__vite__mapDeps([25,1,2,3,5,4,6,8]),import.meta.url)),O_=T.lazy(()=>N(()=>import("./index-IXYdm8ot.js"),__vite__mapDeps([26,1,2,3,5,4,6,8]),import.meta.url)),D_=T.lazy(()=>N(()=>import("./index-LZ13ifsa.js"),__vite__mapDeps([27,1,2,3,28,5,4,6,29,8]),import.meta.url)),L_=T.lazy(()=>N(()=>import("./index-B4ixJ3Sq.js"),__vite__mapDeps([30,1,2,3,4,5,6,8]),import.meta.url)),U_=T.lazy(()=>N(()=>import("./index-hWxGMRRz.js"),__vite__mapDeps([31,1,2,3,4,5,6,8]),import.meta.url)),M_=T.lazy(()=>N(()=>import("./index-CSXhjPqI.js"),__vite__mapDeps([32,1,2,3,33,5,4,6,8]),import.meta.url)),G_=T.lazy(()=>N(()=>import("./index-BTREBIS7.js"),__vite__mapDeps([34,1,2,3,5,4,6,8]),import.meta.url)),$_=T.lazy(()=>N(()=>import("./create-C-jMnjTs.js"),__vite__mapDeps([35,1,2,3,4,5,6,8]),import.meta.url)),V_=T.lazy(()=>N(()=>import("./edit-BBy1EmB3.js"),__vite__mapDeps([36,1,2,3,5,4,6,8]),import.meta.url)),F_=T.lazy(()=>N(()=>import("./create-BUj4mYGx.js"),__vite__mapDeps([37,1,2,3,33,5,4,6,8]),import.meta.url)),z_=T.lazy(()=>N(()=>import("./edit-MKyXaCT_.js"),__vite__mapDeps([38,1,2,3,33,5,4,6,8]),import.meta.url)),W_=T.lazy(()=>N(()=>import("./create-wEWBzFAR.js"),__vite__mapDeps([39,1,2,3,33,5,4,6,8]),import.meta.url)),B_=T.lazy(()=>N(()=>import("./edit-BrDz_JxI.js"),__vite__mapDeps([40,1,2,3,33,5,4,6,8]),import.meta.url)),q_=T.lazy(()=>N(()=>import("./create-Cz2o2ARx.js"),__vite__mapDeps([41,1,2,3,33,5,4,6,8]),import.meta.url)),K_=T.lazy(()=>N(()=>import("./edit-CXZaDWCo.js"),__vite__mapDeps([42,1,2,3,33,5,4,6,8]),import.meta.url)),H_=T.lazy(()=>N(()=>import("./create-CtOY51Gn.js"),__vite__mapDeps([43,1,2,3,33,5,4,6,8]),import.meta.url)),Y_=T.lazy(()=>N(()=>import("./index-DvSynNN4.js"),__vite__mapDeps([44,1,2,3,4,5,6,8]),import.meta.url)),Q_=T.lazy(()=>N(()=>import("./index-CZOHHbDy.js"),__vite__mapDeps([45,1,2,3,4,5,6,8]),import.meta.url)),X_=T.lazy(()=>N(()=>import("./index-E_L0Kkfp.js"),__vite__mapDeps([46,1,2,3,47,5,4,6,8]),import.meta.url)),J_=T.lazy(()=>N(()=>import("./index-DRxoDb7Q.js"),__vite__mapDeps([48,1,2,3,49,5,4,6,8]),import.meta.url)),Z_=T.lazy(()=>N(()=>import("./index-CKnljf9s.js"),__vite__mapDeps([50,1,2,3,4,5,6,8]),import.meta.url)),ew=T.lazy(()=>N(()=>import("./index-asPTu8jF.js"),__vite__mapDeps([51,1,2,3,4,5,6,8]),import.meta.url)),tw=T.lazy(()=>N(()=>import("./create-D8l2jcmP.js"),__vite__mapDeps([52,1,2,3,4,5,6,53,8]),import.meta.url)),nw=T.lazy(()=>N(()=>import("./subscriptions-D2PQFOw8.js"),__vite__mapDeps([54,1,2,3,5,4,6,55,8]),import.meta.url)),rw=T.lazy(()=>N(()=>import("./services-BKBAvaxC.js"),__vite__mapDeps([56,1,2,3,5,4,6,55,8]),import.meta.url)),sw=T.lazy(()=>N(()=>import("./page-BaZ2871S.js"),__vite__mapDeps([57,1,2,3,47,5,4,6,58,8]),import.meta.url)),aw=T.lazy(()=>N(()=>import("./public-page-kTjAzeTA.js"),__vite__mapDeps([59,1,2,3,47,5,58,4,6,8]),import.meta.url)),ow=T.lazy(()=>N(()=>import("./index-CC0K7H5i.js"),__vite__mapDeps([60,1,2,3,4,5,6,8]),import.meta.url)),iw=T.lazy(()=>N(()=>import("./create-BpaUmBsC.js"),__vite__mapDeps([61,1,2,3,4,5,6,8]),import.meta.url)),cw=T.lazy(()=>N(()=>import("./index-DEfutZQF.js"),__vite__mapDeps([62,1,2,3,4,5,6,8]),import.meta.url)),lw=T.lazy(()=>N(()=>
751import("./details-BfwgFQtW.js"),__vite__mapDeps([63,1,2,3,4,5,6,8]),import.meta.url)),dw=T.lazy(()=>N(()=>import("./index-Ik9UQsNQ.js"),__vite__mapDeps([64,1,2,3,4,5,6,8]),import.meta.url)),uw=T.lazy(()=>N(()=>import("./create-page-Dd4x-NUU.js"),__vite__mapDeps([65,1,2,3,4,5,6,8]),import.meta.url)),pw=T.lazy(()=>N(()=>import("./import-page-BjnlxMOw.js"),__vite__mapDeps([66,1,2,3,4,5,6,8]),import.meta.url)),mw=T.lazy(()=>N(()=>import("./index-rCGuuCI8.js"),__vite__mapDeps([67,1,2,3,4,5,6,8]),import.meta.url)),gw=T.lazy(()=>N(()=>import("./create-page-BYueOZqN.js"),__vite__mapDeps([68,1,2,3,4,5,6,8]),import.meta.url)),hw=T.lazy(()=>N(()=>import("./create-page-BYueOZqN.js"),__vite__mapDeps([68,1,2,3,4,5,6,8]),import.meta.url)),fw=T.lazy(()=>N(()=>import("./import-page-C3g-cbp7.js"),__vite__mapDeps([69,1,2,3,4,5,6,8]),import.meta.url)),yw=T.lazy(()=>N(()=>import("./index-CG9gnEMq.js"),__vite__mapDeps([70,1,2,3,4,5,6,8]),import.meta.url)),bw=T.lazy(()=>N(()=>import("./index-Bu-6C0px.js"),__vite__mapDeps([71,1,2,3,4,5,6,8]),import.meta.url)),xw=T.lazy(()=>N(()=>import("./index-CXtCrULK.js"),__vite__mapDeps([72,1,2,3,4,5,6,8]),import.meta.url)),_w=T.lazy(()=>N(()=>import("./create-page-DF_-frVJ.js"),__vite__mapDeps([73,1,2,3,4,5,6,74,8]),import.meta.url)),ww=T.lazy(()=>N(()=>import("./import-page-BZjLSZbb.js"),__vite__mapDeps([75,1,2,3,4,5,6,8]),import.meta.url)),vw=T.lazy(()=>N(()=>import("./website-import-page-BG0FYJuG.js"),__vite__mapDeps([76,1,2,3,5,4,6,74,8]),import.meta.url)),Ew=T.lazy(()=>N(()=>import("./product-content-tasks-page-DK1kLR-B.js"),__vite__mapDeps([77,1,2,3,49,5,4,6,8]),import.meta.url)),Sw=T.lazy(()=>N(()=>import("./create-page-DF_-frVJ.js"),__vite__mapDeps([73,1,2,3,4,5,6,74,8]),import.meta.url)),Aw=T.lazy(()=>N(()=>import("./index-BOYW-VxZ.js"),__vite__mapDeps([78,1,2,3,5,4,6,8]),import.meta.url)),Nw=T.lazy(()=>N(()=>import("./create-CY4c8mep.js"),__vite__mapDeps([79,1,2,3,4,5,6,8]),import.meta.url)),kw=T.lazy(()=>N(()=>import("./index-KeE-FMgd.js"),__vite__mapDeps([80,1,2,3,4,5,6,8]),import.meta.url)),Tw=T.lazy(()=>N(()=>import("./index-Cxk8B-2E.js"),__vite__mapDeps([81,1,2,3,4,5,6,8]),import.meta.url)),Cw=T.lazy(()=>N(()=>import("./index-CnI3x_hz.js"),__vite__mapDeps([82,1,2,3,4,5,6,8]),import.meta.url)),jw=T.lazy(()=>N(()=>import("./index-B52T-8A5.js"),__vite__mapDeps([83,1,2,3,4,5,6,8]),import.meta.url)),Iw=T.lazy(()=>N(()=>import("./index-BxeD-s58.js"),__vite__mapDeps([84,1,2,3,85,5,4,6,8]),import.meta.url)),Rw=T.lazy(()=>N(()=>import("./history-BbtQv75-.js"),__vite__mapDeps([86,1,2,3,4,5,6,8]),import.meta.url)),Pw=T.lazy(()=>N(()=>import("./all-history-BSY2RzNA.js"),__vite__mapDeps([87,1,2,3,85,5,4,6,8]),import.meta.url)),Ow=T.lazy(()=>N(()=>import("./import-DkEY7muY.js"),__vite__mapDeps([88,1,2,3,4,5,6,8]),import.meta.url)),Dw=T.lazy(()=>N(()=>import("./index-rNSGFyOZ.js"),__vite__mapDeps([89,1,2,3,5,4,6,8]),import.meta.url)),Lw=T.lazy(()=>N(()=>import("./create-C7GSXGfQ.js"),__vite__mapDeps([90,1,2,3,5,4,6,8]),import.meta.url)),Uw=T.lazy(()=>N(()=>import("./details-D_pQ6Aiz.js"),__vite__mapDeps([91,1,2,3,5,4,6,8]),import.meta.url)),Mw=T.lazy(()=>N(()=>import("./index-Dcmodb0F.js"),__vite__mapDeps([92,1,2,3,28,93,5,33,4,6,7,8]),import.meta.url)),Gw=T.lazy(()=>N(()=>import("./index-D5ApkaUk.js"),__vite__mapDeps([94,1,2,3,95,5,93,4,6,8]),import.meta.url)),$w=T.lazy(()=>N(()=>import("./index-lXUUP442.js"),__vite__mapDeps([96,1,2,3,4,5,6,8]),import.meta.url)),Vw=T.lazy(()=>N(()=>import("./details-DZfXJKgB.js"),__vite__mapDeps([97,1,2,3,5,4,6,95,8]),import.meta.url)),Fw=T.lazy(()=>N(()=>import("./index-BjLVnxj1.js"),__vite__mapDeps([98,1,2,3,4,5,6,8]),import.meta.url)),zw=T.lazy(()=>N(()=>import("./details-my3uzY3o.js"),__vite__mapDeps([99,1,2,3,4,5,6,8]),import.meta.url)),Ww=T.lazy(()=>N(()=>import("./create-VA29iw2c.js"),__vite__mapDeps([100,1,2,3,4,5,6,8]),import.meta.url)),Bw=T.lazy(()=>N(()=>import("./index-CjiyFZiA.js"),__vite__mapDeps([101,1,2,3,4,5,6,8]),import.meta.url)),qw=T.lazy(()=>N(()=>import("./index-DZcNa-z5.js"),__vite__mapDeps([102,1,2,3,29,5,103,53,104,4,6,8]),import.meta.url)),Kw=T.lazy(()=>N(()=>import("./public-not-found-BGDOmZYM.js"),__vite__mapDeps([105,1,2,3]),import.meta.url)),Hw=T.lazy(()=>N(()=>import("./sign-up-BrfLgB76.js"),__vite__mapDeps([106,1,2,3,103,5,4,6,8]),import.meta.url)),Yw=T.lazy(()=>N(()=>import("./index-BvgWru-G.js"),__vite__mapDeps([107,1,2,3,5,103,4,6,8]),import.meta.url)),Qw=T.lazy(()=>N(()=>import("./verify-otp-T5njY5Px.js"),__vite__mapDeps([108,1,2,3,5,4,6,8]),import.meta.url)),Xw=T.lazy(()=>N(()=>import("./change-phone-1pXUYDmj.js"),__vite__mapDeps([109,1,2,3,5,110,4,6,8]),import.meta.url)),Jw=T.lazy(()=>N(()=>import("./select-store-Dq7x-7EB.js"),__vite__mapDeps([111,1,2,3,5,4,6,8]),import.meta.url)),Zw=T.lazy(()=>N(()=>import("./index-By9NxGHv.js"),__vite__mapDeps([112,1,2,3,5,110,113,4,6,8,114,29,104]),import.meta.url)),ev=T.lazy(()=>N(()=>import("./_locale_-BNcVWTbD.js"),__vite__mapDeps([115,1,2,3,113,5,4,6,8,114,29]),import.meta.url)),tv=T.lazy(()=>N(()=>import("./_id_-BHcmXDLv.js"),__vite__mapDeps([116,1,2,3,5,8,4,6,113,28]),import.meta.url)),nv=T.lazy(()=>N(()=>import("./verify-email-DHE4X8LB.js"),__vite__mapDeps([117,1,2,3,5,4,6,8]),import.meta.url)),rv=T.lazy(()=>N(()=>import("./index-BeOoOb-L.js"),__vite__mapDeps([118,1,2,3,5,4,6,8]),import.meta.url)),sv=T.lazy(()=>N(()=>
751import("./index-DWc6mtdz.js"),__vite__mapDeps([119,1,2,3,28,93,5,4,6,8]),import.meta.url)),av=I(Mw),ov=I(Gw),iv=I($w),cv=I(Vw),lv=I(Fw),dv=I(zw),uv=I(Ww),pv=I(Bw),Xs=I(qw),mv=I(Kw),gv=I(Yw),hv=I(Qw),fv=I(Hw),yv=I(Xw),bv=I(Jw),xv=I(Zw),_v=I(nv),wv=I(rv),vv=I(ev),Ev=I(f_),Sv=I(S_),Av=I(A_),Nv=I(N_),kv=I(k_),Tv=I(T_),Cv=I(C_),jv=I(sv),Iv=I(j_),Rv=I(I_),Pv=I(R_),Ov=I(P_),Dv=I(L_),Lv=I(U_),Uv=I(M_),Mv=I(G_),Gv=I($_),$v=I(V_),Vv=I(F_),Fv=I(z_),zv=I(K_),Zi=I(H_),Wv=I(Y_),Bv=I(Q_),qv=I(X_),Kv=I(J_),Hv=I(Z_),Yv=I(ew),Qv=I(tw),Xv=I(nw),Jv=I(rw),Zv=I(sw),eE=I(aw),tE=I(ow),ec=I(iw),nE=I(cw),tc=I(lw),rE=I(h_),sE=()=>t.jsx(T.Suspense,{fallback:null,children:t.jsx(tv,{})}),aE=I(O_),oE=I(D_),nc=I(dw),Wr=I(uw),rc=I(pw),iE=T.lazy(()=>N(()=>import("./index-DWf1UPMg.js"),__vite__mapDeps([120,1,2,3,4,5,6,8]),import.meta.url)),cE=T.lazy(()=>N(()=>import("./create-page-0Bb7E37F.js"),__vite__mapDeps([121,1,2,3,4,5,6,8]),import.meta.url)),lE=I(iE),sc=I(cE),ac=I(mw),oc=I(gw),ic=I(hw),cc=I(fw),dE=I(yw),lc=I(bw),dc=I(xw),uc=I(_w),pc=I(ww),mc=I(vw),gc=I(Ew),hc=I(Sw),fc=I(Aw),Br=I(Nw),yc=I(kw),bc=I(Tw),xc=I(Iw),_c=I(Rw),wc=I(Pw),vc=I(Ow),Ec=I(Dw),qr=I(Lw),Sc=I(Uw),uE=I(T.lazy(()=>N(()=>import("./index-Dn3_hWcc.js"),__vite__mapDeps([122,1,2,3,5,4,6,8]),import.meta.url))),Ac=I(T.lazy(()=>N(()=>import("./create-B4l7F5r4.js"),__vite__mapDeps([123,1,2,3,5,4,6,8]),import.meta.url))),pE=I(T.lazy(()=>N(()=>import("./analytics-CKzU-so1.js"),__vite__mapDeps([124,1,2,3,4,5,6,8]),import.meta.url))),mE=I(T.lazy(()=>N(()=>import("./layout-BEgxUm0w.js"),__vite__mapDeps([125,1,2,3,49,5,126,4,6,8]),import.meta.url))),gE=I(T.lazy(()=>N(()=>import("./overview-7JW9g5jh.js"),__vite__mapDeps([127,1,2,3,5,126,4,6,8]),import.meta.url))),hE=I(T.lazy(()=>N(()=>import("./transactions-C3JiXu_y.js"),__vite__mapDeps([128,1,2,3,5,126,4,6,8]),import.meta.url))),fE=I(T.lazy(()=>N(()=>import("./expenses-CRViRnDa.js"),__vite__mapDeps([129,1,2,3,5,126,4,6,8]),import.meta.url))),yE=I(T.lazy(()=>N(()=>import("./reports-BvIQLahZ.js"),__vite__mapDeps([130,1,2,3,5,126,4,6,8]),import.meta.url))),bE=I(T.lazy(()=>N(()=>import("./settings-CLjVEq7J.js"),__vite__mapDeps([131,1,2,3,5,126,4,6,8]),import.meta.url))),xE=I(T.lazy(()=>N(()=>import("./setup-CFDcXhWK.js"),__vite__mapDeps([132,1,2,3,49,5,4,6,8]),import.meta.url))),_E=I(T.lazy(()=>N(()=>import("./layout-CZCf9l1l.js"),__vite__mapDeps([133,1,2,3,49,5,134,4,6,8]),import.meta.url))),wE=I(T.lazy(()=>N(()=>import("./index-BXqAswFJ.js"),__vite__mapDeps([135,1,2,3,5,134,4,6,8]),import.meta.url))),vE=I(T.lazy(()=>N(()=>import("./approvals-DM_dSgwg.js"),__vite__mapDeps([136,1,2,3,5,134,4,6,8]),import.meta.url))),EE=I(T.lazy(()=>N(()=>import("./strategy-Cs49dgVd.js"),__vite__mapDeps([137,1,2,3,5,134,4,6,8]),import.meta.url))),SE=I(T.lazy(()=>N(()=>import("./packages-CaIcvXaA.js"),__vite__mapDeps([138,1,2,3,5,134,4,6,8]),import.meta.url))),AE=I(T.lazy(()=>N(()=>import("./settings-zQfEfInA.js"),__vite__mapDeps([139,1,2,3,5,134,4,6,8]),import.meta.url))),NE=I(T.lazy(()=>N(()=>import("./index-D_BY9n9e.js"),__vite__mapDeps([140,1,2,3,141,5,49,4,6,8]),import.meta.url))),kE=I(T.lazy(()=>N(()=>import("./flow-BhwLjj-l.js"),__vite__mapDeps([142,1,2,3,141,5,49,4,6,8]),import.meta.url))),TE=I(T.lazy(()=>N(()=>import("./result-CzewGf-V.js"),__vite__mapDeps([143,1,2,3,49,4,5,6,8]),import.meta.url))),CE=I(T.lazy(()=>N(()=>import("./publish-BRd_Tl8L.js"),__vite__mapDeps([144,1,2,3,49,4,5,6,8]),import.meta.url))),jE=I(T.lazy(()=>N(()=>import("./templates-erFArwoG.js"),__vite__mapDeps([145,1,2,3,49,4,5,6,8]),import.meta.url))),IE=I(T.lazy(()=>N(()=>import("./history-DvtHPqC0.js"),__vite__mapDeps([146,1,2,3,49,4,5,6,8]),import.meta.url))),RE=I(T.lazy(()=>N(()=>import("./brand-voice-RKn-JriA.js"),__vite__mapDeps([147,1,2,3,49,4,5,6,8]),import.meta.url))),PE=I(T.lazy(()=>N(()=>import("./index-DKAzEBBh.js"),__vite__mapDeps([148,1,2,3,4,5,6,8]),import.meta.url))),OE=I(T.lazy(()=>N(()=>import("./create-DzrcqQpp.js"),__vite__mapDeps([149,1,2,3,4,5,6,8]),import.meta.url))),DE=I(T.lazy(()=>N(()=>import("./ai-marketing-portal-cl-a_HSY.js"),__vite__mapDeps([150,1,2,3,5,4,6,8]),import.meta.url))),LE=I(T.lazy(()=>N(()=>import("./index-ZreKK8S_.js"),__vite__mapDeps([151,1,2,3,5,4,6,8]),import.meta.url))),UE=I(T.lazy(()=>N(()=>import("./add-credits-DxzP2Bno.js"),__vite__mapDeps([152,1,2,3,47,5,4,6,8]),import.meta.url))),ME=I(T.lazy(()=>N(()=>import("./index-Cf8Y5gD0.js"),__vite__mapDeps([153,1,2,3,4,5,6,8]),import.meta.url))),GE=I(T.lazy(()=>N(()=>import("./getting-started-F_8zs3g8.js"),__vite__mapDeps([154,1,2,3,5,4,6,8]),import.meta.url))),$E=I(T.lazy(()=>N(()=>import("./dashboard-overview-guide-BgYdNdyO.js"),__vite__mapDeps([155,1,2,3,5,4,6,8]),import.meta.url))),VE=I(T.lazy(()=>N(()=>import("./seo-guide-guFVi2uD.js"),__vite__mapDeps([156,1,2,3,5,4,6,8]),import.meta.url))),FE=I(T.lazy(()=>N(()=>import("./pricing-guide-CiITqSaL.js"),__vite__mapDeps([157,1,2,3,5,4,6,8]),import.meta.url))),zE=I(T.lazy(()=>N(()=>import("./subscriptions-guide-Db9lfEbp.js"),__vite__mapDeps([158,1,2,3,5,4,6,8]),import.meta.url))),WE=I(T.lazy(()=>N(()=>import("./design-guidelines-BNrPGas0.js"),__vite__mapDeps([159,1,2,3,5,4,6,8]),import.meta.url))),BE=I(T.lazy(()=>N(()=>import("./ai-generation-DkhvhV2w.js"),__vite__mapDeps([160,1,2,3,5,4,6,8]),import.meta.url))),qE=I(T.lazy(()=>N(()=>import("./product-upload-mwZ0VmqT.js"),__vite__mapDeps([161,1,2,3,5,4,6,8]),import.meta.url))),KE=I(T.lazy(()=>N(()=>import("./store-optimization-BiTRSj8V.js"),__vite__mapDeps([162,1,2,3,5,4,6,8]),import.meta.url))),HE=I(T.lazy(()=>N(()=>import("./shipping-guide-3MeQNmsp.js"),__vite__mapDeps([163,1,2,3,5,4,6,8]),import.meta.url))),YE=I(T.lazy(()=>N(()=>import("./inventory-guide-mH0CiDpQ.js"),__vite__mapDeps([164,1,2,3,5,4,6,8]),import.meta.url))),QE=I(T.lazy(()=>N(()=>import("./coupons-guide-Bp0D6WVS.js"),__vite__mapDeps([165,1,2,3,5,4,6,8]),import.meta.url))),XE=I(T.lazy(()=>N(()=>import("./orders-guide-B18vkehB.js"),__vite__mapDeps([166,1,2,3,5,4,6,8]),import.meta.url))),JE=I(T.lazy(()=>N(()=>import("./size-guides-page-HqYSzptN.js"),__vite__mapDeps([167,1,2,3,5,4,6,8]),import.meta.url))),ZE=I(T.lazy(()=>N(()=>import("./domains-guide-BccyzF-E.js"),__vite__mapDeps([168,1,2,3,5,4,6,8]),import.meta.url))),eS=I(T.lazy(()=>N(()=>
751import("./seller-builder-guide-ByMJEZ0r.js"),__vite__mapDeps([169,1,2,3,5,4,6,8]),import.meta.url))),tS=I(T.lazy(()=>N(()=>import("./store-settings-guide-Ciogp_MH.js"),__vite__mapDeps([170,1,2,3,5,4,6,8]),import.meta.url))),nS=I(T.lazy(()=>N(()=>import("./wallet-guide-wz-CpEGO.js"),__vite__mapDeps([171,1,2,3,5,4,6,8]),import.meta.url))),rS=I(T.lazy(()=>N(()=>import("./cart-recovery-guide-CJor6Yhh.js"),__vite__mapDeps([172,1,2,3,5,4,6,8]),import.meta.url))),sS=I(T.lazy(()=>N(()=>import("./categories-guide-0_g1iloo.js"),__vite__mapDeps([173,1,2,3,5,4,6,8]),import.meta.url))),aS=I(T.lazy(()=>N(()=>import("./analytics-guide-Cm20jDrR.js"),__vite__mapDeps([174,1,2,3,5,4,6,8]),import.meta.url))),oS=I(T.lazy(()=>N(()=>import("./customers-guide-C2dz_U9z.js"),__vite__mapDeps([175,1,2,3,5,4,6,8]),import.meta.url))),iS=I(T.lazy(()=>N(()=>import("./returns-guide-lgOylOB0.js"),__vite__mapDeps([176,1,2,3,177,4,5,6,8]),import.meta.url))),cS=I(T.lazy(()=>N(()=>import("./product-labels-guide-Ba24xhz4.js"),__vite__mapDeps([178,1,2,3,177,4,5,6,8]),import.meta.url))),lS=I(T.lazy(()=>N(()=>import("./store-credit-guide-BHu_nHOz.js"),__vite__mapDeps([179,1,2,3,177,4,5,6,8]),import.meta.url))),dS=I(T.lazy(()=>N(()=>import("./users-guide-DopFd4MB.js"),__vite__mapDeps([180,1,2,3,177,4,5,6,8]),import.meta.url))),uS=I(T.lazy(()=>N(()=>import("./api-tokens-guide-BzaCQHNR.js"),__vite__mapDeps([181,1,2,3,177,4,5,6,8]),import.meta.url))),pS=I(T.lazy(()=>N(()=>import("./accounting-guide-kADf2imw.js"),__vite__mapDeps([182,1,2,3,177,4,5,6,8]),import.meta.url))),mS=I(T.lazy(()=>N(()=>import("./marketing-assistant-guide-BjEZs8oi.js"),__vite__mapDeps([183,1,2,3,177,4,5,6,8]),import.meta.url))),gS=I(T.lazy(()=>N(()=>import("./ai-assistant-guide-DMZsZwhT.js"),__vite__mapDeps([184,1,2,3,177,4,5,6,8]),import.meta.url))),hS=I(b_),fS=I(x_),yS=I(__),bS=I(w_),xS=I(v_),_S=I(E_);function wS(){const e=kt();return c.useEffect(()=>{Bg(e.pathname+e.search)},[e.pathname,e.search]),null}function vS(){return t.jsxs(Rp,{children:[t.jsx(wS,{}),t.jsx(wh,{children:t.jsxs(Pp,{children:[t.jsx(b,{path:m.PREVIEW,element:t.jsx(vv,{})}),t.jsx(b,{path:"/pay/subscription-orders/:id",element:t.jsx(eE,{})}),t.jsx(b,{element:t.jsx(s_,{}),children:t.jsx(b,{path:m.TEMPLATE,element:t.jsx(sE,{})})}),t.jsxs(b,{element:t.jsx(e_,{}),children:[t.jsx(b,{path:m.HOME,element:t.jsx(av,{})}),t.jsx(b,{path:m.HOME_V2,element:t.jsx(it,{to:m.HOME,replace:!0})}),t.jsx(b,{path:m.HOME_LEGACY,element:t.jsx(it,{to:m.HOME,replace:!0})}),t.jsx(b,{path:m.ANALYTICS.INDEX,element:t.jsx(hS,{})}),t.jsx(b,{path:m.ANALYTICS.LIVE_VIEW,element:t.jsx(fS,{})}),t.jsx(b,{path:m.ANALYTICS.SALES,element:t.jsx(yS,{})}),t.jsx(b,{path:m.ANALYTICS.ORDERS,element:t.jsx(bS,{})}),t.jsx(b,{path:m.ANALYTICS.PRODUCTS,element:t.jsx(xS,{})}),t.jsx(b,{path:m.ANALYTICS.LOCATIONS,element:t.jsx(_S,{})}),t.jsx(b,{path:m.AUDIT_LOG.INDEX,element:t.jsx(y_,{})}),t.jsx(b,{path:m.ACCOUNT,element:t.jsx(wv,{})}),t.jsxs(b,{element:t.jsx(n_,{}),children:[t.jsx(b,{path:m.DASHBOARD,element:t.jsx(ov,{})}),t.jsx(b,{path:m.ORDERS.INDEX,element:t.jsx(iv,{})}),t.jsx(b,{path:m.RETURNS.INDEX,element:t.jsx(lv,{})}),t.jsx(b,{path:m.RETURNS.DETAILS,element:t.jsx(dv,{})}),t.jsx(b,{path:m.RETURNS.CREATE,element:t.jsx(uv,{})}),t.jsx(b,{path:m.STORE_CREDIT.INDEX,element:t.jsx(pv,{})}),t.jsx(b,{path:m.CATEGORIES,element:t.jsx(nc,{})}),t.jsx(b,{path:m.CATEGORIES_CREATE,element:t.jsx(Wr,{})}),t.jsx(b,{path:m.CATEGORIES_EDIT,element:t.jsx(Wr,{})}),t.jsx(b,{path:m.CATEGORIES_IMPORT,element:t.jsx(rc,{})}),t.jsx(b,{path:m.COLLECTIONS_INDEX,element:t.jsx(ac,{})}),t.jsx(b,{path:m.COLLECTIONS_CREATE,element:t.jsx(oc,{})}),t.jsx(b,{path:m.COLLECTIONS_EDIT,element:t.jsx(ic,{})}),t.jsx(b,{path:m.COLLECTIONS_IMPORT,element:t.jsx(cc,{})}),t.jsx(b,{path:m.PRODUCTS_INDEX,element:t.jsx(lc,{})}),t.jsx(b,{path:m.APPOINTMENTS,element:t.jsx(dc,{})}),t.jsx(b,{path:m.PRODUCTS_CREATE,element:t.jsx(uc,{})}),t.jsx(b,{path:m.PRODUCTS_EDIT,element:t.jsx(hc,{})}),t.jsx(b,{path:m.PRODUCTS_IMPORT,element:t.jsx(pc,{})}),t.jsx(b,{path:m.PRODUCTS_WEBSITE_IMPORT,element:t.jsx(mc,{})}),t.jsx(b,{path:m.PRODUCTS_CONTENT_TASKS,element:t.jsx(gc,{})}),t.jsx(b,{path:m.PRODUCTS_ATTRIBUTES.INDEX,element:t.jsx(fc,{})}),t.jsx(b,{path:m.PRODUCTS_ATTRIBUTES.CREATE,element:t.jsx(Br,{})}
751),t.jsx(b,{path:m.PRODUCTS_ATTRIBUTES.EDIT,element:t.jsx(Br,{})}),t.jsx(b,{path:m.PRODUCT_LABELS.INDEX,element:t.jsx(yc,{})}),t.jsx(b,{path:`${m.ADDONS.INDEX}/*`,element:t.jsx(bc,{})}),t.jsx(b,{path:m.INVENTORIES.INDEX,element:t.jsx(xc,{})}),t.jsx(b,{path:m.INVENTORIES.HISTORY,element:t.jsx(_c,{})}),t.jsx(b,{path:m.INVENTORIES.ALL_HISTORY,element:t.jsx(wc,{})}),t.jsx(b,{path:m.INVENTORIES.IMPORT,element:t.jsx(vc,{})}),t.jsx(b,{path:m.TRANSFERS.INDEX,element:t.jsx(Ec,{})}),t.jsx(b,{path:m.TRANSFERS.CREATE,element:t.jsx(qr,{})}),t.jsx(b,{path:m.TRANSFERS.EDIT,element:t.jsx(qr,{})}),t.jsx(b,{path:m.TRANSFERS.DETAILS,element:t.jsx(Sc,{})}),t.jsx(b,{path:m.STORE.CUSTOMERS,element:t.jsx(Dv,{})}),t.jsx(b,{path:m.STORE.CUSTOMERS_ROUTES.DETAILS,element:t.jsx(tc,{})}),t.jsx(b,{path:m.STORE.PAYMENTS,element:t.jsx(Lv,{})}),t.jsx(b,{path:m.STORE.SHIPPING,element:t.jsx(Uv,{})}),t.jsx(b,{path:m.STORE.PICKUP_LOCATIONS,element:t.jsx(Mv,{})}),t.jsx(b,{path:m.STORE.PICKUP_LOCATIONS_ROUTES.CREATE,element:t.jsx(Gv,{})}),t.jsx(b,{path:m.STORE.PICKUP_LOCATIONS_ROUTES.EDIT,element:t.jsx($v,{})}),t.jsx(b,{path:m.STORE.SHIPPING_METHODS.CREATE,element:t.jsx(Vv,{})}),t.jsx(b,{path:m.STORE.SHIPPING_METHODS.EDIT,element:t.jsx(Fv,{})}),t.jsx(b,{path:m.STORE.SHIPPING_ZONES.CREATE,element:t.jsx(W_,{})}),t.jsx(b,{path:m.STORE.SHIPPING_ZONES.EDIT,element:t.jsx(B_,{})}),t.jsx(b,{path:m.STORE.SHIPPING_ZONE_MAPS.CREATE,element:t.jsx(q_,{})}),t.jsx(b,{path:m.STORE.SHIPPING_ZONE_MAPS.EDIT,element:t.jsx(zv,{})}),t.jsx(b,{path:m.STORE.SHIPPING_RATE_TIER_TEMPLATES.CREATE,element:t.jsx(Zi,{})}),t.jsx(b,{path:m.STORE.SHIPPING_RATE_TIER_TEMPLATES.EDIT,element:t.jsx(Zi,{})}),t.jsx(b,{path:m.STORE.DOCUMENTS,element:t.jsx(Bv,{})}),t.jsx(b,{path:m.STORE.MEDIA_LIBRARY,element:t.jsx(Kv,{})}),t.jsx(b,{path:m.STORE.VAT_SETTINGS,element:t.jsx(Hv,{})}),t.jsx(b,{path:m.STORE.API_TOKENS,element:t.jsx(Yv,{})})]}),t.jsx(b,{path:m.ORDERS.DETAILS,element:t.jsx(cv,{})}),t.jsx(b,{path:m.REVIEWS.INDEX,element:t.jsx(Cw,{})}),t.jsx(b,{path:m.WISHLISTS.INDEX,element:t.jsx(jw,{})}),t.jsx(b,{path:m.CATEGORIES,element:t.jsx(nc,{})}),t.jsx(b,{path:m.CATEGORIES_CREATE,element:t.jsx(Wr,{})}),t.jsx(b,{path:m.CATEGORIES_EDIT,element:t.jsx(Wr,{})}),t.jsx(b,{path:m.CATEGORIES_IMPORT,element:t.jsx(rc,{})}),t.jsx(b,{path:m.SIZE_GUIDES?.INDEX,element:t.jsx(lE,{})}),t.jsx(b,{path:m.SIZE_GUIDES?.CREATE,element:t.jsx(sc,{})}),t.jsx(b,{path:m.SIZE_GUIDES?.EDIT,element:t.jsx(sc,{})}),t.jsx(b,{path:m.COLLECTIONS_INDEX,element:t.jsx(ac,{})}),t.jsx(b,{path:m.COLLECTIONS_CREATE,element:t.jsx(oc,{})}),t.jsx(b,{path:m.COLLECTIONS_EDIT,element:t.jsx(ic,{})}),t.jsx(b,{path:m.COLLECTIONS_IMPORT,element:t.jsx(cc,{})}),t.jsx(b,{path:m.CARTS?.INDEX||"/dashboard/carts",element:t.jsx(dE,{})}),t.jsx(b,{path:m.COUPONS.INDEX,element:t.jsx(uE,{})}),t.jsx(b,{path:m.COUPONS.CREATE,element:t.jsx(Ac,{})}),t.jsx(b,{path:m.COUPONS.EDIT,element:t.jsx(Ac,{})}),t.jsx(b,{path:m.COUPONS.ANALYTICS,element:t.jsx(pE,{})}),t.jsx(b,{path:`${m.MARKETING.MEDIA_AI_GENERATOR}/*`,element:t.jsx(it,{to:m.MARKETING.SMART_STUDIO,replace:!0})}),t.jsxs(b,{path:m.ACCOUNTING.INDEX,element:t.jsx(mE,{}),children:[t.jsx(b,{index:!0,element:t.jsx(gE,{})}),t.jsx(b,{path:"transactions",element:t.jsx(hE,{})}),t.jsx(b,{path:"expenses",element:t.jsx(fE,{})}),t.jsx(b,{path:"reports",element:t.jsx(yE,{})}),t.jsx(b,{path:"settings",element:t.jsx(bE,{})})]}),t.jsx(b,{path:m.ACCOUNTING.SETUP,element:t.jsx(xE,{})}),t.jsxs(b,{path:m.MARKETING.ASSISTANT,element:t.jsx(_E,{}),children:[t.jsx(b,{index:!0,element:t.jsx(wE,{})}),t.jsx(b,{path:"approvals",element:t.jsx(vE,{})}),t.jsx(b,{path:"strategy",element:t.jsx(EE,{})}),t.jsx(b,{path:"packages",element:t.jsx(SE,{})}),t.jsx(b,{path:"settings",element:t.jsx(AE,{})})]}),t.jsx(b,{path:m.MARKETING.SMART_STUDIO,element:t.jsx(NE,{})}),t.jsx(b,{path:m.MARKETING.SMART_STUDIO_FLOW,element:t.jsx(kE,{})}),t.jsx(b,{path:m.MARKETING.SMART_STUDIO_TEMPLATES,element:t.jsx(jE,{})}),t.jsx(b,{path:m.MARKETING.SMART_STUDIO_RESULT,element:t.jsx(TE,{})}),t.jsx(b,{path:m.MARKETING.SMART_STUDIO_PUBLISH,element:t.jsx(CE,{})}),t.jsx(b,{path:m.MARKETING.SMART_STUDIO_HISTORY,element:t.jsx(IE,{})}),t.jsx(b,{path:m.MARKETING.SMART_STUDIO_BRAND_VOICE,element:t.jsx(RE,{})}),t.jsx(b,{path:m.MARKETING.WHATSAPP_MESSAGING,element:t.jsx(it,{to:m.MARKETING.INDEX,replace:!0})}),t.jsx(b,{path:m.MARKETING.DRAFT_CARTS,element:t.jsx(PE,{})}),t.jsx(b,{path:m.MARKETING.DRAFT_CARTS_CREATE,element:t.jsx(OE,{})}),t.jsx(b,{path:m.MARKETING.AI_MARKETING_PORTAL,element:t.jsx(DE,{})}),t.jsx(b,{path:m.WALLET.INDEX,element:t.jsx(LE,{})}),t.jsx(b,{path:m.WALLET.ADD_CREDITS,element:t.jsx(UE,{})}),t.jsxs(b,{element:t.jsx(o_,{}),children:[t.jsx(b,{path:m.LEARNING_CENTER.INDEX,element:t.jsx(ME,{})}),t.jsx(b,{path:m.LEARNING_CENTER.DASHBOARD_GUIDE,element:t.jsx($E,{})}),t.jsx(b,{path:m.LEARNING_CENTER.GETTING_STARTED,element:t.jsx(GE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.SEO_GUIDE,element:t.jsx(VE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.PRICING_GUIDE,element:t.jsx(FE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.SUBSCRIPTIONS_GUIDE,element:t.jsx(zE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.DESIGN_GUIDELINES,element:t.jsx(WE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.AI_GENERATION,element:t.jsx(BE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.PRODUCT_UPLOAD,element:t.jsx(qE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.STORE_OPTIMIZATION,element:t.jsx(KE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.SHIPPING_GUIDE,element:t.jsx(HE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.INVENTORY_GUIDE,element:t.jsx(YE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.COUPONS_GUIDE,element:t.jsx(QE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.ORDERS_GUIDE,element:t.jsx(XE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.SIZE_GUIDES,element:t.jsx(JE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.DOMAINS_GUIDE,element:t.jsx(ZE,{})}),t.jsx(b,{path:m.LEARNING_CENTER.WHATSAPP_GUIDE,element:t.jsx(it,{to:m.LEARNING_CENTER.INDEX,replace:!0})}),t.jsx(b,{path:m.LEARNING_CENTER.SELLER_BUILDER_GUIDE,element:t.jsx(eS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.STORE_SETTINGS_GUIDE,element:t.jsx(tS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.WALLET_GUIDE,element:t.jsx(nS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.CART_RECOVERY_GUIDE,element:t.jsx(rS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.CATEGORIES_GUIDE,element:t.jsx(sS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.ANALYTICS_GUIDE,element:t.jsx(aS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.CUSTOMERS_GUIDE,element:t.jsx(oS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.RETURNS_GUIDE,element:t.jsx(iS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.PRODUCT_LABELS_GUIDE,element:t.jsx(cS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.STORE_CREDIT_GUIDE,element:t.jsx(lS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.USERS_GUIDE,element:t.jsx(dS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.API_TOKENS_GUIDE,element:t.jsx(uS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.ACCOUNTING_GUIDE,element:t.jsx(pS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.MARKETING_ASSISTANT_GUIDE,element:t.jsx(mS,{})}),t.jsx(b,{path:m.LEARNING_CENTER.AI_ASSISTANT_GUIDE,element:t.jsx(gS,{})})]}),t.jsx(b,{path:m.PRODUCTS_INDEX,element:t.jsx(lc,{})}),t.jsx(b,{path:m.APPOINTMENTS,element:t.jsx(dc,{})}),t.jsx(b,{path:m.PRODUCTS_CREATE,element:t.jsx(uc,{})}),t.jsx(b,{path:m.PRODUCTS_EDIT,element:t.jsx(hc,{})}),t.jsx(b,{path:m.PRODUCTS_IMPORT,element:t.jsx(pc,{})}),t.jsx(b,{path:m.PRODUCTS_WEBSITE_IMPORT,element:t.jsx(mc,{})}),t.jsx(b,{path:m.PRODUCTS_CONTENT_TASKS,element:t.jsx(gc,{})}),t.jsx(b,{path:m.PRODUCTS_ATTRIBUTES.INDEX,element:t.jsx(fc,{})}),t.jsx(b,{path:m.PRODUCTS_ATTRIBUTES.CREATE,element:t.jsx(Br,{})}
751),t.jsx(b,{path:m.PRODUCTS_ATTRIBUTES.EDIT,element:t.jsx(Br,{})}),t.jsx(b,{path:m.PRODUCT_LABELS.INDEX,element:t.jsx(yc,{})}),t.jsx(b,{path:`${m.ADDONS.INDEX}/*`,element:t.jsx(bc,{})}),t.jsx(b,{path:m.INVENTORIES.INDEX,element:t.jsx(xc,{})}),t.jsx(b,{path:m.INVENTORIES.HISTORY,element:t.jsx(_c,{})}),t.jsx(b,{path:m.INVENTORIES.ALL_HISTORY,element:t.jsx(wc,{})}),t.jsx(b,{path:m.INVENTORIES.IMPORT,element:t.jsx(vc,{})}),t.jsx(b,{path:m.TRANSFERS.INDEX,element:t.jsx(Ec,{})}),t.jsx(b,{path:m.TRANSFERS.CREATE,element:t.jsx(qr,{})}),t.jsx(b,{path:m.TRANSFERS.EDIT,element:t.jsx(qr,{})}),t.jsx(b,{path:m.TRANSFERS.DETAILS,element:t.jsx(Sc,{})}),t.jsx(b,{path:m.STORE.INDEX,element:t.jsx(Ev,{})}),t.jsx(b,{path:m.CATALOG?.INDEX||"/dashboard/catalog",element:t.jsx(Sv,{})}),t.jsx(b,{path:m.MARKETING?.INDEX||"/dashboard/marketing",element:t.jsx(Av,{})}),t.jsx(b,{path:m.SUBSCRIPTIONS_AND_SERVICES?.INDEX||"/dashboard/subscriptions-services",element:t.jsx(Nv,{})}),t.jsx(b,{path:m.ANALYTICS?.HUB||"/dashboard/analytics-hub",element:t.jsx(kv,{})}),t.jsx(b,{path:m.ORDERS.HUB||"/dashboard/orders-hub",element:t.jsx(Tv,{})}),t.jsx(b,{path:m.WAREHOUSE?.HUB||"/dashboard/warehouse-hub",element:t.jsx(Cv,{})}),t.jsx(b,{path:m.STORE.CREATE,element:t.jsx(Qv,{})}),t.jsx(b,{path:m.STORE.GENERAL,element:t.jsx(jv,{})}),t.jsx(b,{path:m.STORE.SETTINGS,element:t.jsx(Iv,{})}),t.jsx(b,{path:m.STORE.SEARCH_SYNC,element:t.jsx(Rv,{})}),t.jsx(b,{path:m.STORE.INTEGRATIONS,element:t.jsx(Ov,{})}),t.jsx(b,{path:m.STORE.CUSTOM_CSS,element:t.jsx(Pv,{})}),t.jsx(b,{path:m.STORE.DOMAINS,element:t.jsx(Wv,{})}),t.jsx(b,{path:m.STORE.TERMS_AND_CONDITIONS,element:t.jsx(qv,{})}),t.jsx(b,{path:m.SUBSCRIPTIONS.INDEX,element:t.jsx(Xv,{})}),t.jsx(b,{path:m.SUBSCRIPTION_ORDERS.DETAILS,element:t.jsx(Zv,{})}),t.jsx(b,{path:m.SERVICES.INDEX,element:t.jsx(it,{to:m.SUBSCRIPTIONS.INDEX,replace:!0})}),t.jsx(b,{path:m.SERVICES.CATEGORY,element:t.jsx(Jv,{})}),t.jsx(b,{path:m.SELLERS.INDEX,element:t.jsx(tE,{})}),t.jsx(b,{path:m.SELLERS.CREATE,element:t.jsx(ec,{})}),t.jsx(b,{path:m.SELLERS.EDIT,element:t.jsx(ec,{})}),t.jsx(b,{path:m.CUSTOMERS.INDEX,element:t.jsx(nE,{})}),t.jsx(b,{path:m.CUSTOMERS.DETAILS,element:t.jsx(tc,{})}),t.jsx(b,{path:m.BUILDER.INDEX,element:t.jsx(rE,{})}),t.jsx(b,{path:m.TEMPLATES,element:t.jsx(it,{to:m.THEME_TEMPLATES.TEMPLATES,replace:!0})}),t.jsx(b,{path:m.THEME_TEMPLATES.STYLE,element:t.jsx(aE,{})}),t.jsx(b,{path:m.THEME_TEMPLATES.TEMPLATES,element:t.jsx(oE,{})})]}),t.jsxs(b,{element:t.jsx(r_,{}),children:[t.jsx(b,{path:"/auth",element:t.jsx(it,{to:m.AUTH.LOGIN,replace:!0})}),t.jsx(b,{path:m.AUTH.SIGNUP,element:t.jsx(fv,{})}),t.jsx(b,{path:m.AUTH.LOGIN,element:t.jsx(xh,{})}),t.jsx(b,{path:m.AUTH.VERIFY_OTP,element:t.jsx(hv,{})}),t.jsx(b,{path:m.AUTH.SELECT_STORE,element:t.jsx(bv,{})}),t.jsx(b,{path:m.AUTH.CHANGE_PHONE,element:t.jsx(yv,{})}),t.jsx(b,{path:m.ONBOARDING.VERIFY_OTP,element:t.jsx(gv,{})})]}),t.jsx(b,{path:Og,element:t.jsx(Yg,{})}),t.jsx(b,{path:m.ONBOARDING.VERIFY_EMAIL,element:t.jsx(_v,{})}),t.jsxs(b,{element:t.jsx(t_,{}),children:[t.jsx(b,{path:m.ONBOARDING.START,element:t.jsx(Xs,{})}),t.jsx(b,{path:"/en",element:t.jsx(Xs,{})}),t.jsx(b,{path:"/ar",element:t.jsx(Xs,{})}),t.jsx(b,{path:m.ONBOARDING.BUILDER,element:t.jsx(xv,{})}),t.jsx(b,{path:"*",element:t.jsx(mv,{})})]})]})})]})}const ES="لديك حساب؟",SS="تسجيل الدخول",AS="ابدأ من جديد",NS={title:"أنت مسجّل الدخول بالفعل",description:"أنت مسجّل الدخول بحساب بائع، لكنك في منتصف إعداد متجر جديد في هذه النافذة.",descriptionWithEmail:"أنت مسجّل الدخول باسم {{email}}، لكنك في منتصف إعداد متجر جديد في هذه النافذة.",hint:"اختر «تسجيل الخروج ومتابعة هذا الإعداد» للاحتفاظ بالتقدّم الذي أنجزته وإكمال هذا المتجر الجديد بجلسة جديدة. أو اختر «الذهاب إلى متجري الحالي» لإبقاء حسابك الحالي وتجاهل هذا الإعداد الجديد. إذا أردت إبقاء الحسابين نشطَين في نفس الوقت، افتح هذا الإعداد في نافذة خاصة/مخفية.",continueCurrent:"الذهاب إلى متجري الحالي",startNewSignup:"تسجيل الخروج ومتابعة هذا الإعداد",signingOut:"جاري تسجيل الخروج…",handoff:{title:"إلى أين يذهب هذا المنتج الجديد؟",description:"أنت مسجّل الدخول بالفعل، وقد بدأنا بتحليل صورة المنتج التي رفعتها. اختر إكمال هذا المنتج الجديد في متجر جديد، أو الاحتفاظ بمتجرك الحالي وتجاهل هذا الرفع.",descriptionWithEmail:"أنت مسجّل الدخول باسم {{email}}، وقد بدأنا بتحليل صورة المنتج التي رفعتها. اختر إكمال هذا المنتج الجديد في متجر جديد، أو الاحتفاظ بمتجرك الحالي وتجاهل هذا الرفع.",hint:"اختر «تسجيل الخروج ومتابعة هذا المنتج» للاحتفاظ بالتحليل الذي بدأناه وإكمال إعداد هذا المتجر الجديد بجلسة جديدة. أو اختر «الاحتفاظ بمتجري الحالي» للبقاء مسجّلاً وتجاهل هذا الرفع.",continueCurrent:"الاحتفاظ بمتجري الحالي",startNewSignup:"تسجيل الخروج ومتابعة هذا المنتج"}},kS={hi:"مرحبًا، أنا Packman",welcome:"أنا هنا لمساعدتك في بناء موقعك أو متجرك الإلكتروني بكل سهولة وفي بضع خطÙ
751ˆØ§Øª فقط. فلنبدأ! 💫",chooseLanguage:"Select your preferred language! / اختر لغتك المفضلة!"},TS={name:"دعنا نجعل متجرك الإلكتروني مذهلاً! 💻✨🛍️",store:"أنت على بعد خطوة واحدة فقط من جاهزية متجرك!"},CS="ما هو اسمك؟ 😊",jS="سعيد بلقائك، {{name}}",IS="ادخل اسمك",RS="ما نوع الموقع الذي ترغب في إنشائه اليوم؟",PS={website:"موقع تعريفي",ecommerce:"متجر إلكتروني"},OS={select:"اختر",selected:"تم الاختيار",businessNamePlaceholder:"اسم علامتك التجارية"},DS={title:"موقع تعريفي",description:"مثالي لعرض علامتك التجارية أو خدماتك أو أعمالك ✨ بدون بيع عبر الإنترنت.",features:{showcase:"مثالي لعرض علامتك التجارية",simple:"تجربة بسيطة ومركزة",services:"رائع للخدمات والمحافظ",fast:"إعداد وإطلاق سريع"}},LS={title:"متجر إلكتروني كامل",description:"مثالي لبيع المنتجات 🛍️ مع الدفع 💳 والمخزون 📦 والتقييمات ⭐",features:{multiple:"بيع منتجات متعددة",payment:"معالجة دفع آمنة",inventory:"إدارة المخزون",reviews:"تقييمات ومراجعات العملاء"}},US="ما اسم علامتك التجارية أو شركتك؟ 🏷️",MS="ادخل اسم علامتك التجارية أو شركتك",GS="اسم جميل! 👏 لننتقل إلى الخطوة التالية! 🚀",$S=`أخبرني قليلاً عن عملك! 
752ماذا تبيع؟ 🏷️✨`,VS=`أخبرني قليلاً عن علامتك التجارية أو موقعك!
753ما هو محتوى موقعك؟ 🏷️✨`,FS="أدخل وصف عملك",zS=`رائع! 
754لا أطيق الانتظار لمساعدتك في إنشاء متجر مذهل يعكس علامتك التجارية! 💖✨`,WS=`رائع!
755لا أطيق الانتظار لمساعدتك في إنشاء موقع مميز يعكس علامتك التجارية! 💖✨`,BS="هل تبيع {{industry}}؟ أم أن علامتك التجارية تعمل في مجالات مختلفة؟ 🌟",qS="هل يدور موقعك بشكل أساسي حول {{industry}}؟ أم يغطي مواضيع مختلفة؟ 🌟",KS={yes:"نعم، هذا صحيح",no:"لا، أبيع شيئًا آخر"},HS={yes:"نعم، هذا صحيح",no:"لا، يتعلق بشيء آخر"},YS="... جاري تحليل تصنيف متجرك 🔎",QS="ما هو مجال متجرك؟ 🏪✨ هذا يساعدني على تخصيص الإعداد المثالي لك! 😊 يمكنك اختيار أكثر من خيار إذا أردت 😊",XS="ما هو التصنيف الرئيسي لموقعك؟ 🏷️✨ هذا يساعدني على تخصيص الإعداد المثالي لك! 😊 يمكنك اختيار أكثر من خيار إذا أردت 😊",JS=`هذا رائع! 
756لنجعل متجرك يتألق ويجذب الأنظار من محبي {{industry}}! 💖🚀`,ZS=`رائع!
757لنجعل موقعك يتألق ويجذب الزوار المهتمين بـ {{industry}}! 💖🚀`,eA="هل لديك متجر إلكتروني بالفعل حالياً؟",tA="هل لديك موقع إلكتروني بالفعل؟",nA={yes:"نعم، لدي متجر إلكتروني",no:"لا، ليس لدي متجر إلكتروني"},rA={yes:"نعم، لدي موقع إلكتروني",no:"لا، ليس لدي موقع إلكتروني"},sA="أدخل رابط متجرك أدناه 🔗✨ سأقوم بتحليله والعثور على التصميم المثالي لعلامتك التجارية! 🚀",aA="أدخل رابط موقعك أدناه 🔗✨ سأقوم بتحليله والعثور على التصميم المثالي لعلامتك التجارية! 🚀",oA="أدخل رابط متجرك",iA="أدخل رابط موقعك",cA="لا تقلق، {{name}}",lA="أنت على بعد خطوة واحدة فقط من إنشاء متجرك الإلكتروني!",dA="هل هذا هو موقعك الإلكتروني؟ 😊",uA={yes:"نعم",no:"لا"},pA="من فضلك شارك رابط متجرك! 🔗",mA="هل لديك حساب إنستغرام لعملك؟ 📸✨",gA={yes:"نعم، لدي حساب إنستغرام",no:"لا، ليس لدي حساب إنستغرام"},hA="رائع! من فضلك شارك رابط حسابك على إنستغرام أدناه 📸✨ هذا سيساعدني في إنشاء تجربة علامة تجارية أكثر تكاملاً! 🚀",fA="أدخل رابط حسابك على إنستغرام",yA="ممتاز! سأستخدم هذا لتعزيز الحضور الاجتماعي لعلامتك التجارية! 📸💖",bA="من فضلك أدخل رابط حسابك على إنستغرام",xA="من فضلك أدخل رابط إنستغرام صحيح مع النطاق (مثل instagram.com/yourprofile)",_A="من فضلك قدم حساب إنستغرام تجاري صحيح للمتابعة.",wA="تعذر التحقق من حساب إنستغرام الخاص بك. من فضلك حاول مرة أخرى.",vA="🎨 ما هو لونك المفضل؟ سأستخدمه لجعل متجرك يليق بك ويظهر بالطريقة التي تحبها! ✨😊",EA="🎨 ما هو لونك المفضل؟ سأستخدمه لجعل موقعك يليق بك ويظهر بالطريقة التي تحبها! ✨😊",SA={red:"أحمر",blue:"أزرق",yellow:"أصفر",green:"أخضر",orange:"برتقالي",purple:"بنفسجي",black:"أسود",gray:"رمادي",brown:"بني",other:"لون آخر"},AA="اختيار رائع! 🎨 دعني أنشئ تصميمات تناسب رؤيتك. ✨",NA="ما هو اللون الذي تفضله؟ اختر اللون الذي تحبه.",kA="اختر اللون",TA="اختر لونًا 🎨",CA=`🎨 اختر النمط لمتجرك! 
758بمجرد اختيارك، ستتمكن من تعديل وتغيير أي شيء لجعله يناسبك تمامًا! ✨🖌️`,jA=`🎨 اختر النمط لموقعك! 
759بمجرد اختيارك، ستتمكن من تعديل وتغيير أي شيء لجعله يناسبك تمامًا! ✨🖌️`,IA="إرسال",RA="أدخل النص",PA="اختر النمط",OA="اسم التصميم",DA="وصف التصميم",LA="مدفوع",UA="مجاني",MA="موصى به",GA="مخصص لمتجرك",$A="بناءً على مجال عملك، اخترنا لك أفضل القوالب",VA="موصى به لك",FA="مطابق تماماً لمجال عملك",zA="استكشف المزيد من الأنماط",WA="اكتشف أنماطاً أخرى قد تلهمك",BA="أو استكشف المزيد من الخيارات",qA="لم يتم العثور على قوالب",KA="نعمل على إضافة المزيد من القوالب. يرجى المحاولة مرة أخرى قريباً!",HA="معاينة والتفاصيل",YA="المزيد من التفاصيل",QA="الوصف",XA="المجال",JA="الصفحات",ZA="تاريخ الإنشاء",eN="يستخدمه",tN="متجر",nN="متجر يستخدم هذا القالب",rN="معاينة التصميم",sN="إغلاق",aN="صفحات",oN="اختر النمط لمتجرك!",iN="اختر النمط لموقعك!",cN="بمجرد اختيارك، ستتمكن من تعديل وتغيير أي شيء لجعله يناسبك تمامًا! ✨",lN="بمجرد اختيارك، ستتمكن من تعديل وتغيير أي شيء لجعله يناسبك تمامًا! ✨",dN="لا تحب أيًا منها؟",uN="لا تقلق! دعنا نجد التصميم المثالي! ✨",pN="المزيد من الأفكار",mN="تحتاج مساعدة؟",gN="إذا كنت تشعر بالضياع أو تحتاج إلى مساعدة في إعداد متجرك، لا تتردد في الاتصال بنا أو إرسال بريد إلكتروني لمساعدتك!",hN="اتصل بنا",fN="راسلنا عبر البريد الإلكتروني",yN={storeGenerated:"تم إنشاء المتجر!",websiteGenerated:"تم إنشاء الموقع!",signUpToView:"سجل لمشاهدته",startTrial:"ابدأ فترة تجريبية مجانية لمدة 14 يومًا.",checkEmailAddress:"تحقق من عنوان بريدك الإلكتروني",confirmationEmailMessage:"لقد أرسلنا لك بريد إلكتروني للتأكيد للتحقق من حسابك والوصول إلى متجرك",emailSentTo:"لقد أرسلنا بريد إلكتروني للتأكيد إلى",changeEmail:"تغيير البريد الإلكتروني",signUpGoogle:"التسجيل باستخدام Google",signUpFacebook:"التسجيل باستخدام Facebook",signUpApple:"التسجيل باستخدام Apple",email:"البريد الإلكتروني",emailPlaceholder:"أدخل بريدك الإلكتروني",emailError:"يرجى إدخال عنوان بريد إلكتروني صالح",emailRequired:"البريد الإلكتروني مطلوب",emailInvalid:"يرجى إدخال عنوان بريد إلكتروني صالح",emailVerificationFailed:"فشل في إرسال بريد التحقق. يرجى المحاولة مرة أخرى.",sending:"جاري الإرسال...",getStarted:"ابدأ الآن",or:"أو",verifyPhoneNumber:"تحقق من رقم هاتفك",otpSentTo:"لقد أرسلنا رمز مكون من 4 أرقام إلى",enterOtp:"أدخل رمز التحقق",otpRequired:"يرجى إدخال رمز تحقق صالح مكون من 4 أرقام",sellerIdMissing:"معرف البائع مفقود. يرجى إعادة إرسال رمز التحقق.",otpVerificationFailed:"فشل في التحقق من رمز التحقق. يرجى المحاولة مرة أخرى.",verifying:"جاري التحقق...",verifyOtp:"تحقق من الرمز",didntReceiveCode:"لم تستلم الرمزØ
759Ÿ",resending:"جاري الإرسال مرة أخرى...",resendCode:"إعادة إرسال الرمز",resendIn:"إعادة الإرسال خلال",otpSendFailed:"فشل في إرسال رمز التحقق. يرجى المحاولة مرة أخرى.",verificationSuccessful:"تم التحقق بنجاح!",phoneVerifiedSuccessfully:"تم التحقق من رقم هاتفك بنجاح.",readyToProceed:"كل شيء جاهز! يمكنك الآن المتابعة لتسجيل الدخول.",proceedToLogin:"المتابعة إلى تسجيل الدخول",changeNumber:"تغيير الرقم",phoneChangeRequestSent:"تم إرسال طلب تغيير الرقم!",checkEmailToVerifyChange:"تحقق من بريدك الإلكتروني للتأكيد على التغيير",changePhoneNumber:"تغيير رقم الهاتف",enterEmailToChangePhone:"أدخل عنوان بريدك الإلكتروني لتغيير رقم هاتفك",emailAddress:"عنوان البريد الإلكتروني",enterEmailAddress:"أدخل عنوان بريدك الإلكتروني",phoneChangeError:"فشل في تغيير رقم الهاتف. يرجى المحاولة مرة أخرى.",cancel:"إلغاء",submitting:"جاري الإرسال...",submitChange:"إرسال التغيير",clickToSendOtp:"انقر على الزر أدناه لإرسال رمز التحقق إلى رقم هاتفك",clickToSendOtpWhatsApp:"اضغط على إرسال الرمز لاستلام رمز التحقق عبر واتساب",whatsappOtpHint:"تأكد أن الرقم أعلاه مفعّل عليه واتساب",otpSentViaWhatsApp:"أرسلنا رمز التحقق عبر واتساب إلى",sendingOtp:"جاري إرسال رمز التحقق...",sendOtp:"إرسال رمز التحقق"},bN="عذراً، لم نتمكن من معالجة طلبك. يرجى المحاولة مرة أخرى.",xN="الاسم مطلوب",_N="يجب أن يكون الاسم أقل من 50 حرفاً",wN="يجب أن يحتوي الاسم على حروف ومسافات فقط",vN="اسم العمل مطلوب",EN="يجب أن يكون اسم العمل أقل من 100 حرف",SN="يجب أن يحتوي اسم العمل على حروف وأرقام ومسافات وعلامات ترقيم أساسية فقط",AN="وصف العمل مطلوب",NN="يرجى تقديم وصف أكثر تفصيلاً (20 حرفاً على الأقل)",kN="يجب أن يكون الوصف أقل من 500 حرف",TN="رابط الموقع مطلوب",CN="يرجى إدخال رابط موقع صالح مع نطاق (مثال: example.com)",jN="اللون مطلوب",IN="يرجى إدخال لون صالح (رمز hex، أو rgb، أو hsl)",RN="اللون مطلوب",PN="تنسيق لون غير صحيح. استخدم hex (#ff0000) أو rgb(255,0,0) أو hsl(0,100%,50%).",ON={bothQuestion:"هل تريد مني استخدام موقعك الإلكتروني أو حساب إنستغرام لإنشاء محتوى شخصي أكثر لك؟ 🎨✨",websiteQuestion:"هل تريد مني استخدام موقعك الإلكتروني لإنشاء محتوى شخصي أكثر لك؟ 🎨✨",instagramQuestion:"هل تريد مني استخدام حساب إنستغرام لإنشاء محتوى شخصي أكثر لك؟ 🎨✨",industryDescriptionQuestion:"هل تريد مني استخدام مجال عملك ووصف متجرك لإنشاء محتوى شخصي أكثر لك؟ 🎨✨",industryDescriptionQuestionWebsite:"هل تريد مني استخدام تصنيفك ووصف موقعك لإنشاء محتوى شخصي أكثر لك؟ 🎨✨",yes:"نعم، استخدمه!",no:"لا، تخطى",processingError:"لم نتمكن من إنشاء المحتوى الآن. هل تريد المحاولة مرة أخرى؟",retryButton:"حاول مرة أخرى",skipButton:"تخطى",finalError:"نواجه مشكلة في إنشاء المحتوى. دعنا نستمر مع القالب الذي اخترته.",skipButtonFinal:"انتقل إلى البيلدر",dialog:{title:"التخصيص بالذكاء الاصطناعي",description:"اختر كيف تريد تخصيص تصميمك:",questionTitle:"خيارات التخصيص",selectedTemplate:"التصميم المختار",yesSubtext:"احصل على تخصيص بالذكاء الاصطناعي",noSubtext:"استخدم التصميم العادي",helpText:"يمكنك دائماً تخصيص تصميمك لاحقاً.",continue:"متابعة",selectChoiceFirst:"يرجى اختيار خيار أولاً"}},DN="البحث عن أفضل القوالب لك... ✨",LN={title:"جاري إنشاء تصميم متجرك!",titleWebsite:"جاري إنشاء تصميم موقعك الإلكتروني!",description:"⏳ انتظر! نحن ننشئ المحتوى الخاص بك بناءً على التفاصيل التي قدمتها أثناء التنصيب - بما في ذلك 🌐 الموقع الإلكتروني و 📸 حساب إنستغرام. هذه العملية مخصصة وقد يستغرق ذلك ما يصل إلى 2 دقيقة. 🚀",status:{initializing:"🚀 بدء إنشاء متجرك...",initializingWebsite:"🚀 بدء إنشاء موقعك...",analyzing:"🔍 تحليل تفاصيل عملك...",analyzingWebsite:"🔍 تحليل تفاصيل موقعك...",designing:"
759🎨 إنشاء تصميمك المخصص...",customizing:"✨ تخصيص عناصر علامتك التجارية...",finalizing:"🛠️ الانتهاء من إعداد متجرك...",finalizingWebsite:"🛠️ الانتهاء من إعداد موقعك...",completing:"🎉 شارفنا على الانتهاء! نضع اللمسات الأخيرة...",ready:"✅ متجرك جاهز!",readyWebsite:"✅ موقعك جاهز!"},takingLong:"يستغرق وقتاً أطول من المتوقع؟",cancel:"إلغاء",cancelRetry:"إلغاء وإعادة المحاولة"},UN="تراجع",MN="الصورة غير متوفرة",GN={title:"ما ستحصل عليه مع باكمان",tagline:"كل ما تحتاجه للنجاح عبر الإنترنت",aiMedia:"مولد الوسائط بالذكاء الاصطناعي",aiMediaDesc:"أنشئ صور منتجات مذهلة في ثوانٍ",aiMediaTooltip:"أنشئ صور منتجات احترافية وبانرات ومواد تسويقية تلقائياً باستخدام الذكاء الاصطناعي — بدون الحاجة لمهارات تصميم.",ecommerce:"التجارة الإلكترونية",ecommerceDesc:"متجر إلكتروني كامل مع الدفع",ecommerceTooltip:"متجر إلكتروني متكامل مع بوابات دفع آمنة وكتالوج منتجات وسلة شراء وإدارة طلبات مدمجة.",shipping:"الشحن الذكي",shippingDesc:"توصيل وتتبع تلقائي",shippingTooltip:"شحن متكامل مع حساب تلقائي للأسعار وإنشاء بوالص الشحن وتتبع الطرود مباشرة لعملائك.",analytics:"التحليلات",analyticsDesc:"رؤى وتقارير لحظية",analyticsTooltip:"تابع المبيعات وسلوك الزوار ومعدلات التحويل من خلال لوحة تحليلات مباشرة تساعدك في اتخاذ قرارات مبنية على البيانات.",multiStore:"متعدد المتاجر",multiStoreDesc:"إدارة علامات تجارية متعددة بسهولة",multiStoreTooltip:"أدر عدة متاجر أو علامات تجارية من حساب واحد — لكل منها منتجاته وتصميمه ونطاقه الخاص.",fastSetup:"إعداد سريع",fastSetupDesc:"أطلق متجرك في دقائق",fastSetupTooltip:"انطلق بسرعة مع إعداد ذكي بالذكاء الاصطناعي يبني متجرك في دقائق — فقط أجب على بعض الأسئلة وستكون جاهزاً."},$N="اعداد البائع | باكمان",VN="قم بإعداد متجرك الإلكتروني مع عملية الإعداد المرشدة من باكمان. أنشئ متجرك، اختر القوالب، وابدأ البيع عبر الإنترنت في دقائق.",FN="اعداد البائع، انشاء متجر الكتروني، اعداد التجارة الالكترونية، منشئ المتاجر، باكمان",zN={title:"لنبني متجرك",subtitle:"اختر كيف تريد أن تبدأ",recommended:"موصى به",quickAiSetup:{title:"إعداد سريع بالذكاء الاصطناعي",description:"ببساطة ارفع صور منتجاتك وسيقوم الذكاء الاصطناعي بالباقي — يفهم عملك فوراً وينشئ متجراً مثالياً في دقائق.",time:"~٢ دقائق",feature1:"تخطى الأسئلة — فقط ارفع الصور",feature2:"الذكاء الاصطناعي يفهم منتجاتك وعملك",feature3:"إنشاء محتوى متجر احترافي تلقائياً",feature4:"مطابقة مع القوالب المثالية"},guidedSetup:{title:"إعداد موجه",description:"تفضل أن توجه العملية؟ أجب على أسئلة بسيطة حول عملك وسنساعدك في بناء ما تتخيله بالضبط.",time:"~٥ دقائق",feature1:"إعداد تفاعلي بأسلوب المحادثة",feature2:"أخبرنا عن علامتك التجارية بكلماتك",feature3:"اختر مجالك وتفضيلاتك",feature4:"مثالي لاحتياجات العمل الفريدة"}
759,getStarted:"ابدأ الآن"},WN={step:"الخطوة ١ من ٣",title:"أرنا ما تبيع",subtitle:"قم برفع صورة لأفضل منتجاتك",back:"رجوع",productImages:"منتجك",addImage:"إضافة",imageTip:"الصور الواضحة والمضاءة جيداً تساعدنا على فهم منتجاتك بشكل أفضل",maxImages:"الحد الأقصى صورة واحدة",uploadError:"فشل في رفع الصورة",existingWebsite:"موقعك الحالي",optional:"اختياري",websiteHint:"لديك موقع حالي؟ يساعدنا على فهم علامتك التجارية بشكل أفضل",screenshotCaptured:"تم التقاط لقطة الشاشة",screenshotFailed:"لم نتمكن من التقاط موقعك. يمكنك المحاولة مرة أخرى أو الرفع يدوياً:",uploadScreenshot:"رفع لقطة شاشة",skipScreenshot:"تخطي - لا أحتاج هذا",continue:"متابعة",analyzing:"جاري التحليل...",atLeastOneImage:"يرجى رفع صورة واحدة على الأقل",capturingWebsite:"جاري التقاط الموقع...",capturingProgress:"جاري التقاط موقعك",capturingProgressDesc:"قد يستغرق هذا بضع ثوانٍ...",tryAgain:"حاول مرة أخرى",uploadManually:"رفع",captureLimitReached:"لقد وصلت إلى الحد الأقصى لمحاولات الالتقاط. يرجى رفع لقطة شاشة يدوياً.",captureLimitReachedShort:"تم الوصول لحد الالتقاط. ارفع يدوياً.",captureAttemptsRemaining:"متبقي {{remaining}} محاولة التقاط",startOver:"ابدأ من جديد بإعداد جديد",resetting:"جاري إعادة التعيين...",resetError:"فشل في إعادة التعيين. يرجى المحاولة مرة أخرى.",isScreenshotCorrect:"هل لقطة الشاشة هذه صحيحة؟",looksGood:"تبدو جيدة",uploadDifferent:"رفع مختلفة",screenshotConfirmed:"تم تأكيد لقطة الشاشة",autoCapture:"التقاط تلقائي",screenshotOptional:"لقطة الشاشة اختيارية - تساعد الذكاء الاصطناعي على فهم أسلوب علامتك التجارية",uploadingScreenshot:"جاري رفع لقطة الشاشة...",pleaseWait:"يرجى الانتظار...",instagram:"إنستغرام",instagramHint:"شارك حساب إنستغرام الخاص بك لمساعدتنا في تخصيص متجرك",restrictedProduct:"هذا النوع من المنتجات غير مسموح ببيعه عبر الإنترنت على منصتنا، لذلك لا يمكننا إنشاء متجر له. يرجى إزالة هذه الصورة ورفع صورة لمنتج آخر.",noSellableProduct:"ارفع صورة واضحة لمنتج واحد تبيعه. تجنب الملصقات والصور المجمعة والإعلانات المليئة بالنصوص والصور الواسعة للمتجر أو المزرعة أو المناظر الطبيعية أو المساحات الداخلية أو الخلفيات فقط."},BN={title:"سؤالان سريعان",subtitle:"يساعدنا هذا في إعداد متجرك بالشكل الصحيح",questions:{hasTradeLicense:"هل لديك رخصة تجارية؟",hasProductToSell:"هل لديك منتج للبيع؟"},yes:"نعم",no:"لا",pleaseAnswerAll:"يرجى الإجابة على السؤالين للمتابعة.",analyzingHint:"لن يستغرق هذا سوى لحظة."},qN={title:"شكرًا لزيارتك!",subtitle:"عندما يصبح لديك منتج للبيع، نحن هنا لمساعدتك على الانطلاق. تواصل معنا في أي وقت عبر واتساب.",whatsappCta:"تواصل معنا للبدء",whatsappMessage:"مرحبًا باكمان، أرغب في البدء بالبيع عبر الإنترنت.",visitWebsite:"تصفّح موقعنا"},KN={title:"دع فريقنا يساعدك",subtitle:"شارك بياناتك وسنتواصل معك لإعداد متجرك.",name:"الاسم الكامل",namePlaceholder:"أدخل اسمك",email:"البريد الإلكتروني",whatsapp:"رقم واتساب",whatsappPlaceholder:"50 000 0000",whatsappInvali
759d:"يرجى إدخال رقم واتساب صحيح.",pleaseComplete:"يرجى إدخال اسمك وبريد إلكتروني صحيح ورقم واتساب.",submit:"إرسال",submitting:"جارٍ الإرسال...",error:"حدث خطأ ما. يرجى المحاولة مرة أخرى.",privacyNote:"سنستخدم بياناتك فقط لمساعدتك على البدء.",successTitle:"شكرًا لك!",successSubtitle:"سيتواصل معك فريقنا قريبًا لمساعدتك على البدء.",visitWebsite:"تصفّح موقعنا"},HN={brandLabel:"باكمان الذكي",title:"جاري التحليل...",titleComplete:"اكتمل التحليل!",titleFailed:"حدث خطأ",subtitle:"منتجك يبدو رائعاً! لحظات فقط...",subtitleComplete:"لقد فهمنا عملك!",subtitleFailed:"لم نتمكن من تحليل صورك. يرجى المحاولة مرة أخرى.",tryAgain:"حاول مرة أخرى",stepDone:"تم",steps:{products:"تم تحديد فئة المنتج",productsPending:"جاري تحديد فئة المنتج...",colors:"تم اكتشاف ألوان العلامة التجارية",colorsPending:"جاري اكتشاف ألوان العلامة التجارية...",description:"تم إنشاء وصف المتجر",descriptionPending:"جاري إنشاء وصف المتجر...",recommendations:"تم تحضير التوصيات",recommendationsPending:"جاري تحضير التوصيات..."}},YN={step:"الخطوة ٢ من ٣",title:"هذا ما تعلمناه عن عملك",subtitle:"اكتشف الذكاء الاصطناعي هذه التفاصيل من صورك. انقر ✏️ لتعديل أي شيء غير صحيح",subtitleNoData:"لم نتمكن من اكتشاف بعض التفاصيل. يرجى ملء الحقول المطلوبة أدناه",industry:"الصناعة",storeName:"اسم المتجر",storeDescription:"وصف المتجر",brandColors:"ألوان العلامة التجارية",primaryColor:"اللون الأساسي",secondaryColor:"اللون الثانوي",notDetected:"غير مكتشف",required:"مطلوب",clickToAdd:"انقر للإضافة",clickToSelect:"انقر للاختيار",enterStoreName:"أدخل اسم متجرك",enterStoreDescription:"أدخل وصف متجرك...",selectPrimaryColor:"اختر اللون الأساسي",selectSecondaryColor:"اختر اللون الثانوي",cancel:"إلغاء",save:"حفظ",looksGood:"يبدو رائعاً! متابعة",continue:"متابعة",fillRequired:"يرجى ملء جميع الحقول المطلوبة",missingFields:"الناقص: {{fields}}",aiDetected:"تم اكتشاف هذه التفاصيل بواسطة الذكاء الاصطناعي من صورك",youEnteredDetail
759s:"يرجى المراجعة والمتابعة",saving:"جارٍ الحفظ...",saveChangesFirst:"احفظ التغييرات أولاً",storeLogo:"شعار المتجر",yourProducts:"منتجك",storeNameArabic:"اسم المتجر بالعربية",enterStoreNameArabic:"أدخل اسم متجرك بالعربية",optional:"اختياري",photo:"صورة",photos:"صور",back:"رجوع",startOver:"ابدأ من جديد",selectIndustry:"اختر المجال",pick:"اختر",instagram:"إنستغرام"},QN="اختيار رائع! الآن اختر لونًا ثانويًا ليكمل علامتك التجارية 🎨",XN="جميل! الآن اختر لونًا ثانويًا لموقعك 🎨",JN={step:"الخطوة Ù£ من Ù£",title:"تقريباً انتهينا!",subtitle:"فقط بعض التفاصيل السريعة",yourName:"اسمك",enterName:"أدخل اسمك",existingWebsite:"موقعك الحالي",websiteHint:"يساعدنا على فهم علامتك التجارية الحالية",instagram:"انستغرام",optional:"اختياري",pleaseEnterName:"يرجى إدخال اسمك",findTemplates:"البحث عن القوالب",saving:"جاري الحفظ...",error:"حدث خطأ. يرجى المحاولة مرة أخرى"},ZN={title:"أنشئ حسابك",subtitle:"سجّل لإطلاق متجرك",country:"الدولة",storeCountry:"دولة المتجر",selectCountry:"اختر الدولة",countryRequired:"الدولة مطلوبة",termsPrefix:"أوافق على",termsLink:"الشروط والأحكام",continueGoogle:"المتابعة مع جوجل",continueApple:"تسجيل الدخول بـ Apple",or:"أو",fullName:"الاسم الكامل",fullNamePlaceholder:"أدخل اسمك الكامل",nameRequired:"الاسم الكامل مطلوب",email:"البريد الإلكتروني",emailPlaceholder:"[email protected]",emailRequired:"البريد الإلكتروني مطلوب",emailInvalid:"يرجى إدخال بريد إلكتروني صالح",phone:"رقم الهاتف",phonePlaceholder:"أدخل رقم الهاتف",phoneRequired:"رقم الهاتف مطلوب",phoneWhatsappHint:"تأكد أن هذا الرقم مفعّل عليه واتساب — سنرسل رمز التحقق عبره",getStarted:"ابدأ الآن",submitting:"جاري إنشاء الحساب...",socialSubmitting:"يرجى الانتظار بينما نتحقق من حسابك...",loading:"جاري التحميل...",freeCredits:"{{count}} رصيد مجاني بانتظارك!",checkYourEmail:"تحقق من بريدك الإلكتروني",verificationLinkSent:"لقد أرسلنا رابط التحقق إلى:",checkEmailInstructions:"انقر على الرابط في البريد الإلكتروني لتأكيد حسابك وتسجيل الدخول تلقائياً. يرجى التحقق من مجلد البريد العشوائي أيضاً.",verificationCheckTimedOut:"ما زلنا بانتظار التحقق",verificationCheckTimedOutHint:"لم نتلق إشارة تأكيد خلال 5 دقائق. يمكنك إعادة إرسال البريد الإلكتروني أو التحقق من أحدث رابط.",checkVerificationNow:"تحقق مرة أخرى الآن",checkingVerificationNow:"جارٍ التحقق...",sending:"جاري الإرسال...",resendIn:"إعادة الإرسال خلال {{seconds}} ثانية",resendEmail:"إعادة إرسال البريد الإلكتروني",subtitleWebsite:"سجّل لإطلاق موقعك الإلكتروني",startOver:"ابدأ من جديد",startOverTitle:"هل تريد البدء من جديد؟",startOverConfirm:"هل تريد البدء من جديد؟ سيؤدي ذلك إلى مسح تقدّم الإعداد الحالي.",startOverAction:"نعم، ابدأ من جديد",cancel:"إلغاء",errors:{createFailed:"فشل في إنشاء الحساب. يرجى المحاولة مرة أخرى.",googleFailed:"فشل تسجيل الدخول بـ Google. يرجى المحاولة مرة أخرى.",appleFailed:"فشل تسجيل الدخول بـ Apple. يرجى المحاولة مرة أخرى.",resendFailed:"فشل في إعادة الإرسال. حاول مرة أخرى.",verificationTimeout:"لم نتمكن من تأكيد التحقق بعد. يرجى إعادة إرسال البريد الإلكتروني أو المحاولة مرة أخرى.",verificationCheckFailed:"تعذر التحقق حالياً. يرجى المحاولة مرة أخرى."}},ek={verifying:"جاري التحقق من بريدك الإلكتروني",verifyingDescription:"يرجى الانتظار بينما نتحقق من بريدك الإلكتروني ونعد حسابك...",success:"تم التحقق من البريد الإلكتروني!",successDescription:"تم إنشاء حسابك. جاري إعادة التوجيه إلى لوحة التحكم...",failed:"فشل التحقق",goBack:"العودة إلى التسجيل",goToLogin:"الذهاب لتسجيل الدخول",noRegistrationData:"لم يتم العثور على بيانات التسجيل. يرجى بدء عملية التسجيل مرة أخرى.",noToken:"تم التحقق بنجاح ولكن لم يتم استلام رمز تسجيل الدخول.",defaultError:"فشل التحقق من البريد الإلكتروني. قد يكون الرابط منتهي الصلاحية."},tk={haveAccount:ES,login:SS,startOver:AS,switchSeller:NS,intro:kS,statusMessages:TS,nameQuestion:CS,nameResponse:jS,namePlaceholder:IS,websiteTypeQuestion:RS,websiteTypeChoices:PS,websiteTypeChoice:OS,websiteTypeChoice1:DS,websiteTypeChoice2:LS,businessNameQuestion:US,businessNamePlaceholder:MS,businessNameResponse:GS,businessDescriptionQuestion:$S,businessDescriptionQuestionWebsite:VS,businessDescriptionPlaceholder:FS,businessDescriptionResponse:zS,businessDescriptionResponseWebsite:WS,industryGuess:BS,industryGuessWebsite:qS,industryChoices:KS,industryChoicesWebsite:HS,industryLoadingMessage:YS,industryQuestion:QS,industryQuestionWebsite:XS,industryChoiceResponseYes:JS,industryChoiceResponseYesWebsite:ZS,existingWebsiteQuestion:eA,existingWebsiteQuestionWebsite:tA,existingWebsiteChoices:nA,existingWebsiteChoicesWebsite:rA,existingWebsiteResponseYes:sA,existingWebsiteResponseYesWebsite:aA,existingWebsiteResponseYesPlaceholder:oA,existingWebsiteResponseYesPlaceholderWebsite:iA,existingWebsiteResponseNo:cA,existingWebsiteResponseNo2:lA,confirmWebsiteQuestion:dA,confirmWebsiteChoices:uA,confirmWebsiteChoiceNo:pA,instagramQuestion:mA,instagramChoices:gA,instagramResponseYes:hA,instagramResponseYesPlaceholder:fA,instagramResponseConfirm:yA,instagramUrlRequired:bA,instagramUrlError:xA,instagramValidationFailed:_A,instagramValidationError:wA,colorQuestion:vA,colorQuestionWebsite:EA,colorChoices:SA,colorResponse:AA,colorResponseOther:NA,colorResponseOtherPlaceholder:kA,pickAColor:TA,templateQuestion:CA,templateQuestionWebsite:jA,send:IA,inputPlaceholder:RA,selectTemplate:PA,templateName:OA,templateDescription:DA,templatePremium:LA,templateFree:UA,recommended:MA,personalizedFor:GA,industryBasedRecommendation:$A,recommendedForYou:VA,perfectMatchIndustry:FA,exploreMoreTemplates:zA,discoverOtherStyles:WA,orExploreMore:BA,noTemplatesFound:qA,noTemplatesDescription:KA,previewDetails:HA,moreDetails:YA,description:QA,industry:XA,pages:JA,createdAt:ZA,usedBy:eN,stores:tN,storesUsingTemplate:nN,previewTemplate:rN,close:sN,templatePages:aN,templateChooseHeading:oN,templateChooseHeadingWebsite:iN,templateChooseDescription:cN,templateChooseDescriptionWebsite:lN,templateMoreQuestion:dN,templateMoreTitle:uN,templateMoreIdeas:pN,helpButton:mN,helpDescription:gN,helpCallUs:hN,helpEmailUs:fN,auth:yN,generalApiError:bN,nameRequired:xN,nameTooLong:_N,nameInvalidChars:wN,businessNameRequired:vN,businessNameTooLong:EN,businessNameInvalidChars:SN,businessDescriptionRequired:AN,businessDescriptionTooShort:NN,businessDescriptionTooLong:kN,websiteUrlRequired:TN,existingWebsiteUrlError:CN,colorRequired:jN,colorInvalidFormat:IN,colorValidationRequired:RN,colorValidationInvalidFormat:PN,verifyWebsiteInstagram:ON,findingTemplates:DN,generatingTheme:LN,undoMessage:UN,imageNotAvailable:MN,packmanServices:GN,pageTitle:$N,pageDescription:VN,pageKeywords:FN,flowSelect:zN,imageUpload:WN,questionnaire:BN,thankYouHappy:qN,leadForm:KN,aiAnalyzing:HN,aiReview:YN,secondaryColorQuestion:QN,secondaryColorQuestionWebsite:XN,quickInfo:JN,signupOverlay:ZN,verifyEmail:ek},nk="Have an account?",rk="Login",sk="Start over",ak={title:"You're already signed in",description:"You're signed in to a seller account, but you're in the middle of setting up a new store in this tab.",descriptionWithEmail:"You're signed in as {{email}}, but you're in the middle of setting up a new store in this tab.",hint:"Choose “Sign out & continue this setup” to keep the progress you've already made and finish this new store under a fresh session. Or choose “Go to my current store” to keep your existing account and discard this new setup. If you want both accounts active at the same time, open this 
759signup in a private/incognito window instead.",continueCurrent:"Go to my current store",startNewSignup:"Sign out & continue this setup",signingOut:"Signing out…",handoff:{title:"Where should this new product go?",description:"You're already signed in and we've started analyzing the product image you uploaded. Choose whether to finish this new product under a fresh store, or keep your current store and ignore this upload.",descriptionWithEmail:"You're signed in as {{email}} and we've already started analyzing the product image you uploaded. Choose whether to finish this new product under a fresh store, or keep your current store and ignore this upload.",hint:"Choose “Sign out & continue this product” to keep the analysis we've already started and finish setting up this new store under a fresh session. Or choose “Keep my current store” to stay signed in and discard this upload.",continueCurrent:"Keep my current store",startNewSignup:"Sign out & continue this product"}},ok={hi:"Hi, I'm Packman",welcome:"I'm here to help you build your website or eCommerce store in just a few clicks. let's make it happen! 💫",chooseLanguage:"Select your preferred language! / اختر لغتك المفضلة!"},ik={name:"Let's make your e-commerce store amazing! 💻✨🛍️",store:"You're just one step away from having your store ready!"},ck="What is your name? 😊",lk=" I'm happy to meet you , {{name}}",dk="Enter your name",uk="What type of website would you like to create today?",pk={website:"Website",ecommerce:"Full E-Commerce Store"},mk={select:"Select",selected:"Selected",businessNamePlaceholder:"Your Business Name"},gk={title:"Website",description:"Perfect for showcasing your brand, services, or portfolio ✨ No online selling.",features:{showcase:"Perfect for showcasing your brand",simple:"Simple & focused experience",services:"Great for services & portfolios",fast:"Fast setup & launch"}},hk={title:"Full E-Commerce Store",description:"Perfect for selling products 🛍️ with payments 💳, inventory 📦 & reviews ⭐",features:{multiple:"Sell multiple products",payment:"Secure payment processing",inventory:"Inventory management",reviews:"Customer reviews & ratings"}},fk="What's the name of your brand or business? 🏷️",yk="Enter your business name",bk=`Nice name!👏  I love it :) 
760Let's move on to the next step! 🚀`,xk=`Tell me a little about your business! 
761What do you sell? 🏷️✨`,_k=`Tell me a little about your brand or website!
762What is your website about? 🏷️✨`,wk="Enter your business description",vk=`Great! 
763I can't wait to help you create a stunning store that reflects your brand! 💖✨`,Ek=`Great!
764I can't wait to help you create a stunning website that reflects your brand! 💖✨`,Sk="Are you selling {{industry}} ? Or does your brand work in different industries? 🌟",Ak="Is your website mainly about {{industry}}? Or does it cover different topics? 🌟",Nk={yes:"Yes That's Correct",no:"No, I sell Something Else"},kk={yes:"Yes, that's correct",no:"No, it's about something else"},Tk="What's your store's industry? 🏪✨ This helps me tailor the perfect setup for you! 😊. you can select multiple if you like 😊",Ck="What is your website's main category? 🏷️✨ This helps me tailor the perfect setup for you! 😊 You can select multiple if you like 😊",jk=`That's amazing! 
765Let's make your store shine and attract customers who love {{industry}}! 💖🚀`,Ik=`Awesome!
766Let's make your website shine and engage visitors interested in {{industry}}! 💖🚀`,Rk="🔎 I'm analyzing your industry ...",Pk="Do you already have an online store?",Ok="Do you already have a website?",Dk={yes:"Yes, I have an Online Store",no:"No, I don't have an Online Store"},Lk={yes:"Yes, I have a Website",no:"No, I don't have a Website"},Uk="Drop your store URL below 🔗✨ I'll analyze it and find the perfect theme for your brand! 🚀",Mk="Drop your website URL below 🔗✨ I'll analyze it and find the perfect theme for your brand website! 🚀",Gk="Enter your store URL",$k="Enter your website URL",Vk="Please enter a valid website URL with a domain (e.g., example.com)",Fk="Don't worry {{name}}",zk="You're just one step away from having your store ready!",Wk="Is this your website? 😊",Bk={yes:"Yes",no:"No"},qk="Please share the link with me! 🔗",Kk="Do you have an Instagram account for your business? 📸✨",Hk={yes:"Yes, I have an Instagram",no:"No, I don't have Instagram"},Yk="Great! Please share your Instagram URL below 📸✨ This will help me create a more connected brand experience! 🚀",Qk="Enter your Instagram URL",Xk="Perfect! I'll use this to enhance your brand's social presence! 📸💖",Jk="Please enter your Instagram URL",Zk="Please enter a valid Instagram URL with a domain (e.g., instagram.com/yourprofile)",eT="Please provide a valid business Instagram account to continue.",tT="Unable to validate your Instagram account. Please try again.",nT=`🎨 Pick your favorite color! 
767Let's make your store look just the way you like! ✨😊`,rT=`🎨 Pick your favorite color! 
768Let's make your website look just the way you like! ✨😊`,sT={red:"Red",blue:"Blue",yellow:"Yellow",green:"Green",orange:"Orange",purple:"Purple",black:"Black",gray:"Gray",brown:"Brown",other:"Other Color"},aT="Nice choice! 🎨 Let me generate stories that match your vision. ✨",oT="Which Color Would you Like? Select the color you like.",iT="Select Color",cT="🎨 Pick a color",lT=`🎨 Select the style for your store! 
769Once you make your choice, you'll be able to edit and change anything to make it truly yours! ✨🖌️`,dT=`🎨 Select the style for your website! 
770Once you make your choice, you'll be able to edit and change anything to make it truly yours! ✨🖌️`,uT="Send",pT="Enter Text",mT="Select Style",gT="Template Name",hT="Template Description",fT="Premium",yT="Free",bT="Recommended",xT="Personalized for your store",_T="Based on your industry, we've curated the best templates for you",wT="Recommended for You",vT="Perfect match for your industry",ET="Explore More Styles",ST="Discover other styles that might inspire you",AT="or explore more options",NT="No templates found",kT="We're working on adding more templates. Please check back soon!",TT="Preview & Details",CT="More Details",jT="Description",IT="Industry",RT="Pages",PT="Created",OT="Used by",DT="stores",LT="stores using this template",UT="Preview Template",MT="Close",GT="pages",$T="Select the style for your store!",VT="Select the style for your website!",FT="Once you make your choice, you'll be able to edit and change anything to make it truly yours! ✨",zT="Once you make your choice, you'll be able to edit and change anything to make it truly yours! ✨",WT="Don't like any?",BT="No worries!  let's find the perfect one! ✨",qT="More Ideas",KT="Need Help?",HT="If you feel lost or you need help setting up your store, feel free to Give us a call or Drop us an Email to Help you!",YT="Call Us",QT="Email Us",XT={storeGenerated:"Store Generated!",websiteGenerated:"Website Generated!",signUpToView:"Sign up To View it",startTrial:"Start your 14-day free trial.",checkEmailAddress:"Check Your Email Address",confirmationEmailMessage:"We sent you a Confirmation Email to Verify your account and Access your store",emailSentTo:"We sent you a confirmation email to",changeEmail:"Change Email",signUpGoogle:"Sign up with Google",signUpFacebook:"Sign up with Facebook",signUpApple:"Sign up with Apple",email:"Email",emailPlaceholder:"Enter your email",emailError:"Please enter a valid email address",emailRequired:"Email is required",emailInvalid:"Please enter a valid email address",emailVerificationFailed:"Failed to send verification email. Please try again.",sending:"Sending...",getStarted:"Get Started",or:"OR",verifyPhoneNumber:"Verify Your Phone Number",otpSentTo:"We sent you a 4-
770digit code to",changeNumber:"Change Number",phoneChangeRequestSent:"Phone Change Request Sent!",checkEmailToVerifyChange:"Check your email to verify the change",verificationSuccessful:"Verification Successful!",phoneVerifiedSuccessfully:"Your phone number has been verified successfully.",readyToProceed:"You're all set! You can now proceed to login.",proceedToLogin:"Proceed to Login",changePhoneNumber:"Change Phone Number",enterEmailToChangePhone:"Enter your email address to change your phone number",emailAddress:"Email Address",enterEmailAddress:"Enter your email address",phoneChangeError:"Failed to change phone number. Please try again.",cancel:"Cancel",submitting:"Submitting...",submitChange:"Submit Change",clickToSendOtp:"Click the button below to send OTP to your phone number",clickToSendOtpWhatsApp:"Click Send OTP to receive a verification code on WhatsApp",whatsappOtpHint:"Make sure the phone number above has WhatsApp installed",otpSentViaWhatsApp:"We sent a verification code via WhatsApp to",sendingOtp:"Sending OTP...",sendOtp:"Send OTP",otpSendFailed:"Failed to send OTP. Please try again.",enterOtp:"Enter verification code",otpRequired:"Please enter a valid 4-digit OTP",sellerIdMissing:"Seller ID missing. Please resend OTP.",otpVerificationFailed:"OTP verification failed. Please try again.",verifying:"Verifying...",verifyOtp:"Verify Code",didntReceiveCode:"Didn't receive the code?",resending:"Resending...",resendCode:"Resend Code",resendIn:"Resend in"},JT="Unable to process your request. Please try again.",ZT="Name is required",eC="Name must be less than 50 characters",tC="Name can only contain letters and spaces",nC="Business name is required",rC="Business name must be less than 100 characters",sC="Business name can only contain letters, numbers, spaces, and basic punctuation",aC="Business description is required",oC="Please provide a more detailed description (minimum 20 characters)",iC="Description must be less than 500 characters",cC="Website URL is required",lC="Color is required",dC="Please enter a valid color (hex, rgb, or hsl)",uC="Color is required",pC="Invalid color format. Use hex (#ff0000), rgb(255,0,0), or hsl(0,100%,50%).",mC={bothQuestion:"Would you like me to use your website or Instagram to generate more personalized content for you? 🎨✨",websiteQuestion:"Would you like me to use your website to generate more personalized content for you? 🎨✨",instagramQuestion:"Would you like me to use your Instagram to generate more personalized content for you? 🎨✨",industryDescriptionQuestion:"Would you like me to use your industry and store description to generate more personalized content for you? 🎨✨",industryDescriptionQuestionWebsite:"Would you like me to use your category and website description to generate more personalized content for you? 🎨✨",yes:"Yes, use it!",no:"No, skip it",processingError:"We couldn't generate your content right now. Would you like to try again?",retryButton:"Try Again",skipButton:"Skip",finalError:"We're having trouble generating your content. Let's continue with the template you selected.",skipButtonFinal:"Continue to Builder",dialog:{title:"AI Personalization",description:"Choose how you'd like to personalize your template",questionTitle:"Personalization Options",selectedTemplate:"Selected Template",yesSubtext:"Get AI-powered customization",noSubtext:"Use standard template",helpText:"You can always customize your template later.",continue:"Continue",selectChoiceFirst:"Please select an option first"}},gC="Finding the best templates for you... ✨",hC={title:"Generating your Store Theme!",titleWebsite:"Generating your Website Theme!",description:"⏳ Hang tight! We're generating your content based on the details you shared during onboarding — including your 🌐 website and 📸 Instagram. This process is fully personalized and may take up to 2 minutes. 🚀",status:{initializing:"🚀 Initializing your store generation...",initializingWebsite:"🚀 Initializing your website generation...",analyzing:"🔍 Analyzing your business details...",analyzingWebsite:"🔍 Analyzing your website details...",designing:"
770🎨 Designing your custom theme...",customizing:"✨ Customizing your brand elements...",finalizing:"🛠️ Finalizing your store setup...",finalizingWebsite:"🛠️ Finalizing your website setup...",completing:"🎉 Almost done! Putting the finishing touches...",ready:"✅ Your store is ready!",readyWebsite:"✅ Your website is ready!"},takingLong:"Taking longer than expected?",cancel:"Cancel",cancelRetry:"Cancel & Retry"},fC="Undo",yC="Image not available",bC={title:"What you'll get with Packman",tagline:"Everything you need to succeed online",aiMedia:"AI Media Generator",aiMediaDesc:"Create stunning product visuals in seconds",aiMediaTooltip:"Automatically generate professional product photos, banners, and marketing visuals using AI and no design skills needed.",ecommerce:"E-Commerce",ecommerceDesc:"Complete online store with payments",ecommerceTooltip:"A fully-featured online store with secure payment gateways, product catalogs, checkout flow, and order management built in.",shipping:"Smart Shipping",shippingDesc:"Automated delivery & tracking",shippingTooltip:"Integrated shipping with automatic rate calculation, label generation, and real-time package tracking for your customers.",analytics:"Analytics",analyticsDesc:"Real-time insights & reports",analyticsTooltip:"Track sales, visitor behavior, and conversion rates with a live analytics dashboard to help you make data-driven decisions.",multiStore:"Multi-Store",multiStoreDesc:"Manage multiple brands easily",multiStoreTooltip:"Run multiple stores or brands from a single account — each with its own products, theme, and domain.",fastSetup:"Fast Setup",fastSetupDesc:"Launch your store in minutes",fastSetupTooltip:"Get online fast with AI-powered onboarding that builds your store in minutes just answer a few questions and you're live."},xC="Seller Onboarding | Packman",_C="Set up your online store with Packman's guided onboarding process. Create your store, choose templates, and start selling online in minutes.",wC="seller onboarding, create online store, ecommerce setup, store builder, Packman",vC={title:"Let's build your store",subtitle:"Choose how you'd like to get started",recommended:"Recommended",quickAiSetup:{title:"Quick AI Setup",de
770scription:"Simply upload your product photos and our AI will do the rest — instantly understanding your business to create a perfectly tailored store in minutes.",time:"~2 minutes",feature1:"Skip the questions — just upload images",feature2:"AI understands your products & business",feature3:"Auto-generates professional store content",feature4:"Get matched with perfect templates"},guidedSetup:{title:"Guided Setup",description:"Prefer to guide the process? Answer simple questions about your business and we'll help you build exactly what you envision.",time:"~5 minutes",feature1:"Interactive conversation-style setup",feature2:"Tell us about your brand in your words",feature3:"Choose your industry & preferences",feature4:"Perfect for unique business needs"},getStarted:"Get Started"},EC={step:"Step 1 of 3",title:"Show us what you sell",subtitle:"Upload a photo of your best product",back:"Back",productImages:"Your Products",addImage:"Add",imageTip:"Clear, well-lit photos help us understand your products better",maxImages:"Maximum {{max}} images allowed",uploadError:"Failed to upload image",existingWebsite:"Existing Website",optional:"Optional",websiteHint:"Have an existing site? It helps us understand your brand better",screenshotCaptured:"Screenshot captured",screenshotFailed:"We couldn't capture your website. You can try again or upload manually:",uploadScreenshot:"Upload screenshot",skipScreenshot:"Skip - I don't need this",continue:"Continue",analyzing:"Analyzing...",atLeastOneImage:"Please upload at least one image",capturingWebsite:"Capturing website...",capturingProgress:"Capturing your website",capturingProgressDesc:"This may take a few seconds...",tryAgain:"Try Again",uploadManually:"Upload",captureLimitReached:"You've reached the maximum capture attempts. Please upload a screenshot manually.",captureLimitReachedShort:"Capture limit reached. Upload manually.",captureAttemptsRemaining:"{{remaining}} capture attempt(s) remaining",startOver:"Start over with a new setup",resetting:"Resetting...",resetError:"Failed to reset. Please try again.",isScreenshotCorrect:"Is this screenshot correct?",looksGood:"Looks good",uploadDifferent:"Upload different",screenshotConfirmed:"Screenshot confirmed",autoCapture:"Auto capture",screenshotOptional:"Screenshot is optional - helps AI understand your brand style",uploadingScreenshot:"Uploading screenshot...",pleaseWait:"Please wait...",instagram:"Instagram",instagramHint:"Share your Instagram handle to help us personalize your store",restrictedProduct:"This product type isn't allowed to be sold online on our platform, so we can't build a store for it. Please remove this image and upload a different product.",noSellableProduct:"Upload a clear photo of one product you sell. Avoid posters, collages, text-heavy advertisements, or wide store, farm, landscape, interior, and background-only photos."},SC={title:"A couple of quick questions",subtitle:"This helps us set up your store the right way",questions:{hasTradeLicense:"Do you have a trade license?",hasProductToSell:"Do you have a product to sell?"},yes:"Yes",no:"No",pleaseAnswerAll:"Please answer both questions to continue.",analyzingHint:"This only takes a moment."},AC={title:"Thanks for stopping by!",subtitle:"When you are ready with a product to sell, we are here to help you launch. Reach out any time on WhatsApp.",whatsappCta:"Chat with us to get started",whatsappMessage:"Hi Packman, I would like to get started selling online.",visitWebsite:"Explore our website"},NC={title:"Let our team help you",subtitle:"Share your details and we will reach out to get you set up.",name:"Full name",namePlaceholder:"Enter your name",email:"Email",whatsapp:"WhatsApp number",whatsappPlaceholder:"50 000 0000",whatsappInvalid:"Please enter a valid WhatsApp number.",pleaseComplete:"Please fill in your name, a valid email, and your WhatsApp number.",submit:"Submit",submitting:"Submitting...",error:"Something went wrong. Please try again.",privacyNote:"We will only use your details to help you get started.",successTitle:"Thank you!",successSubtitle:"Our team will reach out to you shortly to help you get started.",visitWebsite:"Explore our website"},kC={brandLabel:"AI",title:"Analyzing...",titleComplete:"Analysis Complete!",titleFailed:"Something went wrong",subt
770itle:"Your products look amazing! Just a moment...",subtitleComplete:"We've understood your business!",subtitleFailed:"We couldn't analyze your images. Please try again.",tryAgain:"Try Again",stepDone:"Done",steps:{products:"Identified product category",productsPending:"Identifying product category...",colors:"Detected brand colors",colorsPending:"Detecting brand colors...",description:"Generating store description",descriptionPending:"Generating store description...",recommendations:"Preparing recommendations",recommendationsPending:"Preparing recommendations..."}},TC={step:"Step 2 of 3",title:"Here's what we learned about your business",subtitle:"AI detected these details from your photos. Click ✏️ to edit anything that's not right",subtitleNoData:"We couldn't detect some details. Please fill in the required fields below",industry:"Industry",storeName:"Store Name",storeDescription:"Store Description",brandColors:"Brand Colors",primaryColor:"Primary Color",secondaryColor:"Secondary Color",notDetected:"Not detected",required:"Required",clickToAdd:"Click to add",clickToSelect:"Click to select",enterStoreName:"Enter your store name",enterStoreDescription:"Enter your store description...",selectPrimaryColor:"Select primary color",selectSecondaryColor:"Select secondary color",cancel:"Cancel",save:"Save",looksGood:"Looks Good! Continue",continue:"Continue",fillRequired:"Please fill all required fields",missingFields:"Missing: {{fields}}",aiDetected:"AI detected these details from your photos",youEnteredDetail
770s:"Please review and continue",saving:"Saving...",saveChangesFirst:"Save your changes first",storeLogo:"Store Logo",yourProducts:"Your Product",storeNameArabic:"Store Name in Arabic",enterStoreNameArabic:"Enter your store name in Arabic",optional:"Optional",photo:"photo",photos:"photos",back:"Back",startOver:"Start over",selectIndustry:"Select Industry",pick:"Pick",instagram:"Instagram"},CC="Great choice! Now pick a secondary color to complement your brand 🎨",jC="Nice! Now choose a secondary color for your website 🎨",IC={step:"Step 3 of 3",title:"Almost there!",subtitle:"Just a few quick details",yourName:"Your Name",enterName:"Enter your name",existingWebsite:"Existing Website",websiteHint:"Helps us understand your current brand",instagram:"Instagram",optional:"Optional",pleaseEnterName:"Please enter your name",findTemplates:"Find My Templates",saving:"Saving...",error:"An error occurred. Please try again"},RC={title:"Create your account",subtitle:"Sign up to launch your store",country:"Country",storeCountry:"Store Country",selectCountry:"Select country",countryRequired:"Country is required",termsPrefix:"I agree to the",termsLink:"Terms and Conditions",continueGoogle:"Continue with Google",continueApple:"Sign in with Apple",or:"or",fullName:"Full Name",fullNamePlaceholder:"Enter your full name",nameRequired:"Full name is required",email:"Email",emailPlaceholder:"[email protected]",emailRequired:"Email is required",emailInvalid:"Please enter a valid email address",phone:"Phone Number",phonePlaceholder:"Enter mobile number",phoneRequired:"Phone number is required",phoneWhatsappHint:"Make sure this number has WhatsApp — we'll send your verification code there",getStarted:"Get Started",submitting:"Creating account...",socialSubmitting:"Please wait while we verify your account...",loading:"Loading...",freeCredits:"{{count}} free credits waiting for you!",checkYourEmail:"Check Your Email",verificationLinkSent:"We've sent a verification link to:",checkEmailInstructions:"Click the link in the email to verify your account and log in automatically. Please also check your spam folder.",verificationCheckTimedOut:"Still waiting for verification",verificationCheckTimedOutHint:"We did not receive a confirmation signal within 5 minutes. You can resend the email or verify from the latest link.",checkVerificationNow:"Check again now",checkingVerificationNow:"Checking...",sending:"Sending...",resendIn:"Resend in {{seconds}}s",resendEmail:"Resend Email",subtitleWebsite:"Sign up to launch your website",startOver:"Start over",startOverTitle:"Start over?",startOverConfirm:"Start over from the beginning? This clears the current onboarding progress.",startOverAction:"Yes, start over",cancel:"Cancel",errors:{createFailed:"Failed to create account. Please try again.",googleFailed:"Google sign-in failed. Please try again.",appleFailed:"Apple sign-in failed. Please try again.",resendFailed:"Failed to resend. Try again.",verificationTimeout:"We could not confirm verification yet. Please resend the email or check again.",verificationCheckFailed:"Unable to check verification right now. Please try again."}},PC={verifying:"Verifying Your Email",verifyingDescription:"Please wait while we verify your email and set up your account...",success:"Email Verified!",successDescription:"Your account has been created. Redirecting to your dashboard...",failed:"Verification Failed",goBack:"Go Back to Signup",goToLogin:"Go to Login",noRegistrationData:"Registration data not found. Please start the signup process again.",noToken:"Verification succeeded but no login token received.",defaultError:"Email verification failed. The link may be expired."},OC={haveAccount:nk,login:rk,startOver:sk,switchSeller:ak,intro:ok,statusMessages:ik,nameQuestion:ck,nameResponse:lk,namePlaceholder:dk,websiteTypeQuestion:uk,websiteTypeChoices:pk,websiteTypeChoice:mk,websiteTypeChoice1:gk,websiteTypeChoice2:hk,businessNameQuestion:fk,businessNamePlaceholder:yk,businessNameResponse:bk,businessDescriptionQuestion:xk,businessDescriptionQuestionWebsite:_k,businessDescriptionPlaceholder:wk,businessDescriptionResponse:vk,businessDescriptionResponseWebsite:Ek,industryGuess:Sk,industryGuessWebsite:Ak,industryChoices:Nk,industryChoicesWebsite:kk,industryQuestion:Tk,industryQuestionWebsite:Ck,industryChoiceResponseYes:jk,industryChoiceResponseYesWebsite:Ik,industryLoadingMessage:Rk,existingWebsiteQuestion:Pk,existingWebsiteQuestionWebsite:Ok,existingWebsiteChoices:Dk,existingWebsiteChoicesWebsite:Lk,existingWebsiteResponseYes:Uk,existingWebsiteResponseYesWebsite:Mk,existingWebsiteResponseYesPlaceholder:Gk,existingWebsiteResponseYesPlaceholderWebsite:$k,existingWebsiteUrlError:Vk,existingWebsiteResponseNo:Fk,existingWebsiteResponseNo2:zk,confirmWebsiteQuestion:Wk,confirmWebsiteChoices:Bk,confirmWebsiteChoiceNo:qk,instagramQuestion:Kk,instagramChoices:Hk,instagramResponseYes:Yk,instagramResponseYesPlaceholder:Qk,instagramResponseConfirm:Xk,instagramUrlRequired:Jk,instagramUrlError:Zk,instagramValidationFailed:eT,instagramValidationError:tT,colorQuestion:nT,colorQuestionWebsite:rT,colorChoices:sT,colorResponse:aT,colorResponseOther:oT,colorResponseOtherPlaceholder:iT,pickAColor:cT,templateQuestion:lT,templateQuestionWebsite:dT,send:uT,inputPlaceholder:pT,selectTemplate:mT,templateName:gT,templateDescription:hT,templatePremium:fT,templateFree:yT,recommended:bT,personalizedFor:xT,industryBasedRecommendation:_T,recommendedForYou:wT,perfectMatchIndustry:vT,exploreMoreTemplates:ET,discoverOtherStyles:ST,orExploreMore:AT,noTemplatesFound:NT,noTemplatesDescription:kT,previewDetails:TT,moreDetails:CT,description:jT,industry:IT,pages:RT,createdAt:PT,usedBy:OT,stores:DT,storesUsingTemplate:LT,previewTemplate:UT,close:MT,templatePages:GT,templateChooseHeading:$T,templateChooseHeadingWebsite:VT,templateChooseDescription:FT,templateChooseDescriptionWebsite:zT,templateMoreQuestion:WT,templateMoreTitle:BT,templateMoreIdeas:qT,helpButton:KT,helpDescription:HT,helpCallUs:YT,helpEmailUs:QT,auth:XT,generalApiError:JT,nameRequired:ZT,nameTooLong:eC,nameInvalidChars:tC,businessNameRequired:nC,businessNameTooLong:rC,businessNameInvalidChars:sC,businessDescriptionRequired:aC,businessDescriptionTooShort:oC,businessDescriptionTooLong:iC,websiteUrlRequired:cC,colorRequired:lC,colorInvalidFormat:dC,colorValidationRequired:uC,colorValidationInvalidFormat:pC,verifyWebsiteInstagram:mC,findingTemplates:gC,generatingTheme:hC,undoMessage:fC,imageNotAvailable:yC,packmanServices:bC,pageTitle:xC,pageDescription:_C,pageKeywords:wC,flowSelect:vC,imageUpload:EC,questionnaire:SC,thankYouHappy:AC,leadForm:NC,aiAnalyzing:kC,aiReview:TC,secondaryColorQuestion:CC,secondaryColorQuestionWebsite:jC,quickInfo:IC,signupOverlay:RC,verifyEmail:PC},DC={},LC={},Nc={en:DC,ar:LC};Wa.use(Op).init({lng:typeof window<"u"&&localStorage.getItem("language")||"en",fallbackLng:"en",resources:{en:{onboarding:OC,backend:{...Mo("en","seller"),...Nc?.en||{}}},ar:{onboarding:tk,backend:{...Mo("ar","seller"),...Nc?.ar||{}}}},interpolation:{escapeValue:!1}});Wm({apiClient:ln,systemCountry:"ae",getSystemCountry:()=>Un()?"ae":ae.getState?.()?.systemCountry});Bm(e=>{const n=ae.getState?.(),r=n?.store?.selectedStore,s=r?.systemCountry?.code||r?.systemCountryCode||n?.systemCountry;e.tags={...e.tags,system_country:(typeof s=="string"?s:s?.code)||"ae",...r?.id!=null?{store_id:String(r.id)}:{}},r&&(e.contexts={...e.contexts,store:{id:r.id,name:r.name,slug:r.slug??r.uid}})});function UC(){const{language:e}=ae(),n=ae(y=>y.store?.selectedStore),r=qe(y=>y.user),s=c.useRef(!1),[a,o]=c.useState(!1);c.useEffect(()=>{const y=()=>o(typeof window<"u"&&window.innerWidth<=768);return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]),c.useEffect(()=>{Wg()},[]);const d=n?.systemCountry?.code||n?.systemCountryCode||ae.getState?.()?.systemCountry,u=n?.systemCountry?.currency;c.useEffect(()=>{if(!r?.id){s.current=!1;return}Kg({userId:r.id,role:"seller",storeId:n?.id,storeUid:n?.uid,storeName:n?.name,plan:n?.subscription?.plan||n?.plan,systemCountry:d,currency:u}),s.current||(qg({method:"token",role:"seller"}),s.current=!0)},[r?.id,n?.id,n?.uid,n?.name,n?.subscription?.plan,n?.plan,d,u]);const l=a?"bottom-center":e==="ar"?"bottom-left":"bottom-right",i="839778205182-nuvhkhhpkac4olls5vqq9nr1jjcuegq7.apps.googleusercontent.com",g=t.jsx(Lp,{i18n:Wa,children:t.jsx(Up,{client:Nt,children:t.jsx(qm,{language:e,children:t.jsxs("div",{dir:e==="ar"?"rtl":"ltr",children:[t.jsx(vS,{}),t.jsx(Km,{direction:e==="ar"?"rtl":"ltr",position:l})]})})})});return t.jsx(Dp,{clientId:i,children:g})}function MC(){return c.useEffect(()=>{const e=s=>{xl(s)&&ia()&&(ca(),console.log("[deployment-error] Reload triggered by: ChunkErrorHandler"),window.location.reload())},n=s=>{if(s?.target?.tagName==="SCRIPT"&&s?.target?.src?.includes("_next/")){if(!ia())return;ca(),console.log("[deployment-error] Reload triggered by: ChunkErrorHandler (script load)"),window.location.reload();return}e(s?.message??s?.error)},r=s=>e(s?.reason?.message??s?.reason);return window.addEventListener("error",n,!0),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",n,!0),window.removeEventListener("unhandledrejection",r)}},[]),null}const GC="https://67dece45d633ce8d0525e2384257dec7@o4510482194497536.ingest.de.sentry.io/4510504
770129331280",$C="production";Hm({dsn:GC,environment:$C});Ym();Qm({sourceLanguage:"en",getLanguage:()=>ae.getState().language,setLanguage:e=>{Ar(e);try{localStorage.setItem("language",e)}catch{}Wa.changeLanguage(e)}});rg(["@tabler/icons-react"]);const VC=e=>{xl(e)&&ia()&&(ca(),console.log("[deployment-error] Reload triggered by: SentryErrorBoundary"),window.location.reload())};Mp.createRoot(document.getElementById("root")).render(t.jsxs(c.StrictMode,{children:[t.jsx(MC,{}),t.jsx(Xm,{fallback:ng,onError:VC,children:t.jsx(UC,{})})]}));export{Ea as $,Uh as A,Hn as B,Gh as C,gt as D,YC as E,xj as F,QC as G,gg as H,XC as I,wj as J,Ef as K,_j as L,Wh as M,We as N,qh as O,Bf as P,cd as Q,m as R,Go as S,mo as T,ld as U,pd as V,tj as W,ej as X,nr as Y,Ys as Z,kf as _,ae as a,Jg as a$,Sa as a0,tr as a1,rj as a2,zx as a3,ws as a4,nd as a5,fa as a6,CI as a7,jI as a8,ax as a9,PI as aA,LI as aB,DI as aC,MI as aD,UI as aE,RI as aF,sy as aG,ai as aH,Yf as aI,xy as aJ,by as aK,qI as aL,ga as aM,Lj as aN,xx as aO,w0 as aP,id as aQ,KI as aR,er as aS,Mi as aT,nj as aU,QI as aV,i1 as aW,Ol as aX,vg as aY,da as aZ,De as a_,sx as aa,rx as ab,nx as ac,tx as ad,ex as ae,Zb as af,Jb as ag,Xb as ah,Qb as ai,Yb as aj,Hb as ak,Kb as al,qb as am,Bb as an,Wb as ao,zb as ap,Fb as aq,Mt as ar,uy as as,ly as at,Ms as au,lo as av,ao as aw,_d as ax,II as ay,OI as az,Xl as b,Vj as b$,kj as b0,JC as b1,Sg as b2,YI as b3,uj as b4,pj as b5,Nj as b6,mj as b7,gj as b8,Ns as b9,JI as bA,ZI as bB,e1 as bC,n1 as bD,q0 as bE,l_ as bF,Ng as bG,cj as bH,d_ as bI,p_ as bJ,d1 as bK,u1 as bL,p1 as bM,t1 as bN,hj as bO,Pj as bP,Dj as bQ,Oj as bR,sj as bS,Xt as bT,aj as bU,Uj as bV,Gj as bW,Yn as bX,Wj as bY,Bj as bZ,$j as b_,lj as ba,dj as bb,Il as bc,Rl as bd,Xg as be,sr as bf,Ag as bg,HI as bh,r1 as bi,s1 as bj,Rj as bk,Ij as bl,ma as bm,Et as bn,a1 as bo,Ts as bp,jr as bq,ha as br,WI as bs,zI as bt,Mx as bu,BI as bv,Nl as bw,XI as bx,o1 as by,vh as bz,$h as c,Ke as c0,Yj as c1,Xj as c2,Hj as c3,aI as c4,iI as c5,cI as c6,Qj as c7,Jj as c8,Zj as c9,wI as cA,AI as cB,NI as cC,kI as cD,TI as cE,uI as cF,oj as cG,VI as cH,FI as cI,vj as cJ,yj as cK,Ej as cL,Sj as cM,Aj as cN,Vh as cO,Fh as cP,Gy as cQ,Vy as cR,Ny as cS,Ey as cT,$I as cU,GI as cV,fi as cW,hi as cX,Jy as cY,Xy as cZ,jj as c_,eI as ca,qj as cb,Kj as cc,rI as cd,tI as ce,nI as cf,oI as cg,zj as ch,Fj as ci,sI as cj,Mj as ck,Lh as cl,dI as cm,lI as cn,pI as co,gI as cp,hI as cq,yI as cr,mI as cs,fI as ct,bI as cu,xI as cv,_I as cw,vI as cx,EI as cy,SI as cz,zh as d,Rh as e,Mh as f,Bh as g,Tj as h,rs as i,qe as j,cf as k,c1 as l,l1 as m,lf as n,fs as o,ln as p,ZC as q,Cj as r,Yl as s,ij as t,Ql as u,Kl as v,_h as w,Nt as x,bj as y,fj as z};
771//# sourceMappingURL=index-DtPjspnE.js.map

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.