@cedros/pay-react 1.1.28 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/{AISettingsSection-BlIv3CzS.mjs → AISettingsSection-BMh3hAb5.mjs} +6 -4
- package/dist/{AISettingsSection-DELur7D2.js → AISettingsSection-C0zqPbd6.js} +2 -2
- package/dist/{AutosaveIndicator-Bed0-ekg.mjs → AutosaveIndicator-3ctAnz8Y.mjs} +1 -1
- package/dist/{AutosaveIndicator-Dn_qA2hK.js → AutosaveIndicator-DXRPr4P7.js} +1 -1
- package/dist/CedrosContext-5Gjveoba.mjs +2555 -0
- package/dist/CedrosContext-CCakH2SZ.js +3 -0
- package/dist/CedrosPayAdminDashboard-DaJ9JoGn.mjs +250 -0
- package/dist/CedrosPayAdminDashboard-Uvyh9p7A.js +1 -0
- package/dist/{ChatLogsSection-v4zwzCTC.mjs → ChatLogsSection-BtJixYAp.mjs} +19 -17
- package/dist/ChatLogsSection-FC3O536G.js +1 -0
- package/dist/{ComplianceSection-CemgfDrL.mjs → ComplianceSection-BMnb1p4w.mjs} +18 -15
- package/dist/ComplianceSection-BioTKm7k.js +1 -0
- package/dist/{CryptoButton-BV9owVe2.mjs → CryptoButton-Cl2kZbOP.mjs} +26 -24
- package/dist/CryptoButton-DxFCYDlJ.js +1 -0
- package/dist/{CustomersSection-D_j7OrfS.mjs → CustomersSection-dmwoBhcf.mjs} +21 -19
- package/dist/CustomersSection-z6ARxuex.js +1 -0
- package/dist/DisputesSection-BjHHQAi7.js +1 -0
- package/dist/{DisputesSection-BcAbXp3K.mjs → DisputesSection-CHyLne76.mjs} +19 -17
- package/dist/Dropdown-BRSZlhik.mjs +111 -0
- package/dist/Dropdown-j8o0OO5L.js +1 -0
- package/dist/ErrorBanner-CAgPnj62.js +1 -0
- package/dist/ErrorBanner-lZJhCmDX.mjs +22 -0
- package/dist/{FAQSection-Dn38OhB_.mjs → FAQSection-Di2xE9Sm.mjs} +8 -6
- package/dist/FAQSection-b34DMzgV.js +1 -0
- package/dist/{ImagesSection-Ctw9Icym.mjs → ImagesSection-D63PEjR6.mjs} +6 -4
- package/dist/ImagesSection-DGBA7iKY.js +1 -0
- package/dist/{InventorySection-DmhjUlRZ.mjs → InventorySection-Dp5Yu4TA.mjs} +25 -23
- package/dist/InventorySection-bVCECzX5.js +1 -0
- package/dist/LazyCedrosPayAdminDashboard-BqJDNrDI.mjs +9 -0
- package/dist/LazyCedrosPayAdminDashboard-CpfTtOBc.js +1 -0
- package/dist/{MessagingSection-B1FaGxkp.mjs → MessagingSection-BLCnCpEv.mjs} +5 -4
- package/dist/MessagingSection-DU0dYNMy.js +1 -0
- package/dist/{OrdersSection-Bj8bPdg8.mjs → OrdersSection-Bd56F3cj.mjs} +27 -24
- package/dist/OrdersSection-FOFEAgs1.js +1 -0
- package/dist/PaymentSettingsSection-52iw47Su.mjs +648 -0
- package/dist/PaymentSettingsSection-B5J56VAk.js +1 -0
- package/dist/ReturnsSection-BjpIVFfN.js +1 -0
- package/dist/{ReturnsSection-BC0L8r2e.mjs → ReturnsSection-DUVeKrCd.mjs} +11 -9
- package/dist/{SettingsSection-vdYFSNxB.js → SettingsSection-DKkHykaC.js} +1 -1
- package/dist/{SettingsSection-KYdEizq_.mjs → SettingsSection-vK9WIwXE.mjs} +1 -1
- package/dist/ShippingSection-B5lk7zpS.js +1 -0
- package/dist/{ShippingSection-BOgto6_9.mjs → ShippingSection-CZRrXrlh.mjs} +5 -3
- package/dist/{SingleCategorySettings-suJ8z9d8.mjs → SingleCategorySettings-C8xJ47_T.mjs} +143 -140
- package/dist/SingleCategorySettings-g7D-9lG1.js +3 -0
- package/dist/StatsBar-CWXw2ZT3.js +1 -0
- package/dist/StatsBar-D4cOKG2e.mjs +25 -0
- package/dist/StorefrontSection-BWnMB9k-.js +1 -0
- package/dist/{StorefrontSection-BRvIGBEJ.mjs → StorefrontSection-uXSVbEAa.mjs} +121 -119
- package/dist/{SubscriptionsSection-D60qrX9a.mjs → SubscriptionsSection-Ci_AZrWA.mjs} +11 -9
- package/dist/SubscriptionsSection-DQfXkuDv.js +1 -0
- package/dist/{TaxSection-C7-pv-Rl.mjs → TaxSection-BTukS_cU.mjs} +23 -21
- package/dist/TaxSection-cuPQISxZ.js +1 -0
- package/dist/ThemeContext-CFXyYx7A.js +1 -0
- package/dist/ThemeContext-l0bqcOGW.mjs +126 -0
- package/dist/Token22Section-CCfkDm8W.js +1 -0
- package/dist/{Token22Section-CrHLQ0EB.mjs → Token22Section-DRsPJuTq.mjs} +7 -6
- package/dist/{WalletManager-BIwH8Dw_.mjs → WalletManager-D-eoqUDy.mjs} +21 -19
- package/dist/WalletManager-DXChB9LA.js +1 -0
- package/dist/{WebhooksSection-COPW4Ec0.mjs → WebhooksSection-A8Y4ZGcj.mjs} +40 -38
- package/dist/WebhooksSection-CnEmaGH1.js +1 -0
- package/dist/admin.d.ts +2 -0
- package/dist/admin.js +1 -0
- package/dist/admin.mjs +7 -0
- package/dist/configApi-BS5UJfzm.js +1 -0
- package/dist/{configApi-6XhAJGKX.mjs → configApi-BUXZOMWK.mjs} +57 -3
- package/dist/crypto-only.js +1 -1
- package/dist/crypto-only.mjs +215 -202
- package/dist/dateHelpers-BKW_lGND.js +1 -0
- package/dist/dateHelpers-yvPkofYQ.mjs +6 -0
- package/dist/fetchWithTimeout-CG0EKbhf.js +1 -0
- package/dist/fetchWithTimeout-DmMOwL0Q.mjs +195 -0
- package/dist/icons-C3yDMnKE.mjs +235 -0
- package/dist/icons-Cjgd9YVo.js +1 -0
- package/dist/index-9QF_UfSN.mjs +18668 -0
- package/dist/index-Cq9ya93W.js +84 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +74 -63
- package/dist/safeHref-DqJPLPl5.mjs +12 -0
- package/dist/safeHref-DyHIpVjY.js +1 -0
- package/dist/sectionIds-D46-_-h-.js +1 -0
- package/dist/sectionIds-YktNxmRt.mjs +124 -0
- package/dist/sections-511_XBh4.js +1 -0
- package/dist/sections-CRaMa8ZB.mjs +9 -0
- package/dist/sections-more-Cgw2qJlA.js +1 -0
- package/dist/sections-more-Ixw6mM6R.mjs +3082 -0
- package/dist/src/admin/index.d.ts +3 -3
- package/dist/src/admin/index.d.ts.map +1 -1
- package/dist/src/admin/plugin.d.ts.map +1 -1
- package/dist/src/admin/types.d.ts +2 -6
- package/dist/src/admin/types.d.ts.map +1 -1
- package/dist/src/admin.d.ts +9 -0
- package/dist/src/admin.d.ts.map +1 -0
- package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts +4 -0
- package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts.map +1 -0
- package/dist/src/components/admin/PaymentReadinessChecklist.d.ts +9 -0
- package/dist/src/components/admin/PaymentReadinessChecklist.d.ts.map +1 -0
- package/dist/src/components/admin/PaymentSettingsSection.d.ts.map +1 -1
- package/dist/src/components/admin/PaymentSetupGuide.d.ts +6 -0
- package/dist/src/components/admin/PaymentSetupGuide.d.ts.map +1 -0
- package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
- package/dist/src/components/admin/configApi.d.ts +1 -1
- package/dist/src/components/admin/configApi.d.ts.map +1 -1
- package/dist/src/components/admin/icons.d.ts +3 -50
- package/dist/src/components/admin/icons.d.ts.map +1 -1
- package/dist/src/components/admin/index.d.ts +1 -1
- package/dist/src/components/admin/index.d.ts.map +1 -1
- package/dist/src/components/admin/types.d.ts +43 -0
- package/dist/src/components/admin/types.d.ts.map +1 -1
- package/dist/src/context/CedrosContext.d.ts +2 -0
- package/dist/src/context/CedrosContext.d.ts.map +1 -1
- package/dist/src/ecommerce/__tests__/featureFlags.test.d.ts +2 -0
- package/dist/src/ecommerce/__tests__/featureFlags.test.d.ts.map +1 -0
- package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
- package/dist/src/ecommerce/components/general/ErrorBoundary.d.ts +1 -1
- package/dist/src/ecommerce/components/ui/button.d.ts +1 -1
- package/dist/src/ecommerce/components/ui/sheet.d.ts +1 -1
- package/dist/src/ecommerce/config/context.d.ts +2 -0
- package/dist/src/ecommerce/config/context.d.ts.map +1 -1
- package/dist/src/ecommerce/config/types.d.ts +2 -0
- package/dist/src/ecommerce/config/types.d.ts.map +1 -1
- package/dist/src/ecommerce/index.d.ts +2 -0
- package/dist/src/ecommerce/index.d.ts.map +1 -1
- package/dist/src/featureFlags.d.ts +41 -0
- package/dist/src/featureFlags.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/managers/StripeManager.d.ts.map +1 -1
- package/dist/src/managers/SubscriptionManager.d.ts +1 -0
- package/dist/src/managers/SubscriptionManager.d.ts.map +1 -1
- package/dist/src/standalone-admin.d.ts +8 -0
- package/dist/src/standalone-admin.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +14 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/subscription.d.ts +47 -1
- package/dist/src/types/subscription.d.ts.map +1 -1
- package/dist/src/utils/validateConfig.d.ts.map +1 -1
- package/dist/standalone-admin.d.ts +2 -0
- package/dist/standalone-admin.js +1 -0
- package/dist/standalone-admin.mjs +4 -0
- package/dist/stripe-only.js +1 -1
- package/dist/stripe-only.mjs +35 -33
- package/dist/styles--fxb3lCl.js +1 -0
- package/dist/{styles-D4SQkuV3.mjs → styles-DGagylUj.mjs} +53 -51
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.mjs +1 -1
- package/dist/tokenMintValidator-DAjQld0r.mjs +98 -0
- package/dist/tokenMintValidator-DNBhoefh.js +4 -0
- package/dist/{walletPool-DE-t1wSW.mjs → walletPool-9MylB2QK.mjs} +1 -1
- package/dist/walletPool-BjTXX6Vn.js +1 -0
- package/package.json +9 -3
- package/dist/CedrosContext-C2RjHLaQ.js +0 -6
- package/dist/CedrosContext-CY6zvjvJ.mjs +0 -2801
- package/dist/ChatLogsSection-BH5tLA4T.js +0 -1
- package/dist/ComplianceSection-DP2a9-S0.js +0 -1
- package/dist/CryptoButton-DpiCnyXE.js +0 -1
- package/dist/CustomersSection-CBwy_waO.js +0 -1
- package/dist/DisputesSection-BLjIk60n.js +0 -1
- package/dist/FAQSection-wNeH0i6Q.js +0 -1
- package/dist/ImagesSection-0ZzKlzMJ.js +0 -1
- package/dist/InventorySection-zV6lTmue.js +0 -1
- package/dist/MessagingSection-B_wdFR0j.js +0 -1
- package/dist/OrdersSection-Dw2FX-1d.js +0 -1
- package/dist/PaymentSettingsSection-BYF4D-GR.js +0 -1
- package/dist/PaymentSettingsSection-EnMxeWjv.mjs +0 -94
- package/dist/ReturnsSection-D_pJVxuG.js +0 -1
- package/dist/ShippingSection-1DRSTu49.js +0 -1
- package/dist/SingleCategorySettings-DwCnBdRf.js +0 -3
- package/dist/StorefrontSection-RumGkb3C.js +0 -1
- package/dist/SubscriptionsSection-C2aLLn7L.js +0 -1
- package/dist/TaxSection-Dt1DnM51.js +0 -1
- package/dist/Token22Section-DY3mUwTY.js +0 -1
- package/dist/WalletManager-B3UdQ5pQ.js +0 -1
- package/dist/WebhooksSection-CKeiJ7Py.js +0 -1
- package/dist/configApi-DkduMQg1.js +0 -1
- package/dist/index-C0g-JxJk.js +0 -84
- package/dist/index-DXnuQp5x.mjs +0 -22128
- package/dist/sections-C1NpK7hk.mjs +0 -9
- package/dist/sections-DVVSZBhW.js +0 -1
- package/dist/styles-BT4bhFey.js +0 -1
- package/dist/walletPool-IS7R3MR1.js +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),j=require("react"),_o=require("./fetchWithTimeout-CG0EKbhf.js"),pt=require("./CedrosContext-CCakH2SZ.js"),Ml=require("./ThemeContext-CFXyYx7A.js"),Qo=require("react-dom"),Ue=require("./safeHref-DyHIpVjY.js"),zf=require("./styles--fxb3lCl.js");function Dl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const m=Dl(j),hs=Dl(Qo);function zl(){const{config:e}=pt.useCedrosContext(),[t,n]=j.useState(!1),[r,s]=j.useState(null),[a,i]=j.useState(null);return{checkCompliance:j.useCallback(async(c,d,f)=>{n(!0),i(null),s(null);try{const g=`${e.serverUrl||window.location.origin}/paywall/v1/compliance-check`,h={"Content-Type":"application/json"};d&&(h.Authorization=`Bearer ${d}`);const x=await _o.fetchWithTimeout(g,{method:"POST",headers:h,body:JSON.stringify({resources:c,...f?{wallet:f}:{}})});if(!x.ok){const v=await pt.parseErrorResponse(x,"Compliance check failed");throw new Error(v)}const p=await x.json();return s(p),p}catch(u){const g=u instanceof Error?u.message:"Compliance check failed";_o.getLogger().error("[useComplianceCheck]",g),i(g);const h={cleared:!0};return s(h),h}finally{n(!1)}},[e.serverUrl]),loading:t,result:r,error:a}}function Lf({resources:e,onCleared:t,onBlocked:n,onCancel:r,authToken:s,wallet:a,children:i}){const l=Ml.useCedrosTheme(),{checkCompliance:c,loading:d,result:f,error:u}=zl(),g=j.useRef(!1);j.useEffect(()=>{g.current||e.length===0||(g.current=!0,c(e,s,a))},[e,s,a,c]),j.useEffect(()=>{f&&(f.cleared?t():f.reasons?.length&&n?.(f.reasons))},[f,t,n]);const h=l.unstyled?"":`${l.className} cedros-theme__compliance-gate`,x=l.unstyled?{}:l.style;return d||!f?o.jsx("div",{className:h,style:x,children:i??o.jsx("div",{className:l.unstyled?"":"cedros-theme__compliance-checking",children:o.jsx("p",{children:"Verifying purchase eligibility..."})})}):f.cleared?null:o.jsx("div",{className:h,style:x,children:o.jsxs("div",{className:l.unstyled?"":"cedros-theme__compliance-blocked",children:[o.jsx("h3",{children:"Purchase Not Available"}),o.jsx("ul",{children:f.reasons?.map((p,v)=>o.jsx("li",{children:p},v))}),u&&o.jsx("p",{className:l.unstyled?"":"cedros-theme__error",children:u}),r&&o.jsx("button",{type:"button",onClick:r,className:l.unstyled?"":"cedros-theme__button",children:"Go back"})]})})}function Ll(e){const{creditsManager:t}=pt.useCedrosContext(),[n,r]=j.useState({available:0,held:0,currency:"",loading:!1,error:null}),s=j.useRef(!0);j.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]);const a=j.useCallback(async()=>{if(e){r(i=>({...i,loading:!0,error:null}));try{const i=await t.getBalance(e);if(!s.current)return;r(i?{available:i.available,held:i.held,currency:i.currency,loading:!1,error:null}:l=>({...l,loading:!1}))}catch(i){if(!s.current)return;r(l=>({...l,loading:!1,error:i instanceof Error?i.message:"Failed to fetch balance"}))}}},[e,t]);return j.useEffect(()=>{a()},[a]),{...n,refresh:a}}function $f({authToken:e,className:t="",formatBalance:n,showHeld:r=!1}){const s=Ml.useCedrosTheme(),{available:a,held:i,currency:l,loading:c,error:d,refresh:f}=Ll(e),u=s.unstyled?t:`${s.className} cedros-theme__credits-balance ${t}`.trim();if(!e)return null;const g=n?n(a,l):`${a} ${l}`;return o.jsxs("div",{className:u,style:s.unstyled?{}:s.style,children:[o.jsx("div",{className:s.unstyled?"":"cedros-theme__credits-balance-amount",children:c?"Loading…":g}),r&&i>0&&!c&&o.jsxs("div",{className:s.unstyled?"":"cedros-theme__credits-balance-held",children:[i," ",l," held"]}),d&&o.jsx("div",{className:s.unstyled?"":"cedros-theme__error",children:d}),!c&&o.jsx("button",{type:"button",onClick:f,className:s.unstyled?"":"cedros-theme__credits-balance-refresh","aria-label":"Refresh balance",children:"↻"})]})}const Jo=j.createContext(null);function ye(){const e=j.useContext(Jo);if(!e)throw new Error("useCedrosShop must be used within CedrosShopProvider");return e}function gs(){return j.useContext(Jo)}function Ff({config:e,children:t}){const n=j.useMemo(()=>pt.resolveFeatureFlags({featureFlags:e.featureFlags}),[e.featureFlags]),r=j.useMemo(()=>({config:e,featureFlags:n}),[e,n]);return o.jsx(Jo.Provider,{value:r,children:t})}function vt(e){return new Promise(t=>setTimeout(t,e))}const $l=[{id:"cat_all",slug:"all",name:"All Products",description:"Everything in the catalog."},{id:"cat_apparel",slug:"apparel",name:"Apparel",description:"Soft goods and daily wear."},{id:"cat_accessories",slug:"accessories",name:"Accessories",description:"Carry, attach, decorate."}],Qr=[{id:"p_tee",slug:"cedros-tee",title:"Cedros Tee",description:"A heavyweight tee with a clean silhouette.",images:[{url:"https://picsum.photos/seed/cedros-tee/900/900",alt:"Cedros Tee"},{url:"https://picsum.photos/seed/cedros-tee-2/900/900",alt:"Cedros Tee detail"}],price:38,currency:"USD",tags:["new","cotton"],categoryIds:["cat_apparel"],compareAtPrice:48,inventoryStatus:"in_stock",variants:[{id:"v_tee_s",title:"Small / Black",options:{Size:"S",Color:"Black"}},{id:"v_tee_m",title:"Medium / Black",options:{Size:"M",Color:"Black"}},{id:"v_tee_l",title:"Large / Black",options:{Size:"L",Color:"Black"}}],shippingProfile:"physical"},{id:"p_crewneck",slug:"cedros-crewneck",title:"Cedros Crewneck",description:"Midweight fleece with a relaxed fit and embroidered mark.",images:[{url:"https://picsum.photos/seed/cedros-crewneck/900/900",alt:"Cedros Crewneck"}],price:64,currency:"USD",tags:["fleece","core"],categoryIds:["cat_apparel"],inventoryStatus:"in_stock",compareAtPrice:78,variants:[{id:"v_crew_s",title:"Small / Heather",options:{Size:"S",Color:"Heather"}},{id:"v_crew_m",title:"Medium / Heather",options:{Size:"M",Color:"Heather"}},{id:"v_crew_l",title:"Large / Heather",options:{Size:"L",Color:"Heather"}}],shippingProfile:"physical"},{id:"p_hoodie",slug:"cedros-hoodie",title:"Cedros Hoodie",description:"Pullover hoodie with soft interior and structured hood.",images:[{url:"https://picsum.photos/seed/cedros-hoodie/900/900",alt:"Cedros Hoodie"},{url:"https://picsum.photos/seed/cedros-hoodie-2/900/900",alt:"Cedros Hoodie detail"}],price:74,currency:"USD",tags:["fleece","new"],categoryIds:["cat_apparel"],inventoryStatus:"low",variants:[{id:"v_hoodie_s",title:"Small / Black",options:{Size:"S",Color:"Black"}},{id:"v_hoodie_m",title:"Medium / Black",options:{Size:"M",Color:"Black"}},{id:"v_hoodie_l",title:"Large / Black",options:{Size:"L",Color:"Black"}}],shippingProfile:"physical"},{id:"p_cap",slug:"cedros-cap",title:"Cedros Cap",description:"Unstructured cap with adjustable strap and curved brim.",images:[{url:"https://picsum.photos/seed/cedros-cap/900/900",alt:"Cedros Cap"}],price:28,currency:"USD",tags:["core"],categoryIds:["cat_apparel"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_socks",slug:"cedros-socks",title:"Cedros Socks",description:"Rib-knit socks designed for everyday comfort.",images:[{url:"https://picsum.photos/seed/cedros-socks/900/900",alt:"Cedros Socks"}],price:14,currency:"USD",tags:["cotton"],categoryIds:["cat_apparel"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_tote",slug:"cedros-tote",title:"Cedros Tote",description:"Heavy canvas tote with reinforced handles.",images:[{url:"https://picsum.photos/seed/cedros-tote/900/900",alt:"Cedros Tote"}],price:32,currency:"USD",tags:["gift","canvas"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_stickers",slug:"cedros-sticker-pack",title:"Sticker Pack",description:"Five durable vinyl stickers for laptops and water bottles.",images:[{url:"https://picsum.photos/seed/cedros-stickers/900/900",alt:"Sticker Pack"}],price:8,currency:"USD",tags:["gift"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_keychain",slug:"cedros-keychain",title:"Enamel Keychain",description:"Polished enamel keychain with a subtle mark.",images:[{url:"https://picsum.photos/seed/cedros-keychain/900/900",alt:"Enamel Keychain"}],price:12,currency:"USD",tags:["gift"],categoryIds:["cat_accessories"],inventoryStatus:"low",shippingProfile:"physical"},{id:"p_lanyard",slug:"cedros-lanyard",title:"Woven Lanyard",description:"Soft woven lanyard with swivel clasp.",images:[{url:"https://picsum.photos/seed/cedros-lanyard/900/900",alt:"Woven Lanyard"}],price:10,currency:"USD",tags:["core"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_notebook",slug:"cedros-notebook",title:"Dot Grid Notebook",description:"Lay-flat notebook for sketches, notes, and plans.",images:[{url:"https://picsum.photos/seed/cedros-notebook/900/900",alt:"Dot Grid Notebook"}],price:18,currency:"USD",tags:["gift"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_waterbottle",slug:"cedros-water-bottle",title:"Insulated Bottle",description:"Vacuum-insulated bottle that keeps drinks cold for hours.",images:[{url:"https://picsum.photos/seed/cedros-bottle/900/900",alt:"Insulated Bottle"}],price:36,currency:"USD",tags:["gift","new"],categoryIds:["cat_accessories"],inventoryStatus:"backorder",shippingProfile:"physical"},{id:"p_posters",slug:"cedros-poster-set",title:"Poster Set",description:"Two prints on thick matte stock.",images:[{url:"https://picsum.photos/seed/cedros-posters/900/900",alt:"Poster Set"}],price:24,currency:"USD",tags:["gift","limited"],categoryIds:["cat_accessories"],inventoryStatus:"out_of_stock",shippingProfile:"physical"},{id:"p_pins",slug:"cedros-pin-set",title:"Pin Set",description:"Two enamel pins with rubber backings.",images:[{url:"https://picsum.photos/seed/cedros-pins/900/900",alt:"Pin Set"}],price:16,currency:"USD",tags:["gift"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_brandbook",slug:"cedros-brand-book",title:"Brand Book (PDF)",description:"A compact brand book: typography, color, layout, and voice.",images:[{url:"https://picsum.photos/seed/cedros-brandbook/900/900",alt:"Brand Book cover"}],price:19,currency:"USD",tags:["digital"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"digital",checkoutRequirements:{email:"optional",name:"none",phone:"none",shippingAddress:!1,billingAddress:!1},fulfillment:{type:"digital_download",notes:"This is a digital product and will be downloadable from your account after purchase."}},{id:"p_wallpaper",slug:"cedros-wallpaper-pack",title:"Wallpaper Pack",description:"A set of desktop + mobile wallpapers in multiple colorways.",images:[{url:"https://picsum.photos/seed/cedros-wallpaper/900/900",alt:"Wallpaper Pack"}],price:6,currency:"USD",tags:["digital","new"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"digital"},{id:"p_longsleeve",slug:"cedros-long-sleeve",title:"Long Sleeve Tee",description:"Soft long sleeve tee with rib cuff and relaxed drape.",images:[{url:"https://picsum.photos/seed/cedros-longsleeve/900/900",alt:"Long Sleeve Tee"}],price:44,currency:"USD",tags:["cotton"],categoryIds:["cat_apparel"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_shorts",slug:"cedros-shorts",title:"Everyday Shorts",description:"Lightweight shorts with a comfortable waistband.",images:[{url:"https://picsum.photos/seed/cedros-shorts/900/900",alt:"Everyday Shorts"}],price:40,currency:"USD",tags:["new"],categoryIds:["cat_apparel"],inventoryStatus:"in_stock",shippingProfile:"physical"},{id:"p_beanie",slug:"cedros-beanie",title:"Rib Beanie",description:"Warm rib beanie with a clean folded cuff.",images:[{url:"https://picsum.photos/seed/cedros-beanie/900/900",alt:"Rib Beanie"}],price:20,currency:"USD",tags:["core"],categoryIds:["cat_apparel"],inventoryStatus:"low",shippingProfile:"physical"},{id:"p_jacket",slug:"cedros-coach-jacket",title:"Coach Jacket",description:"Lightweight jacket with snap front and subtle sheen.",images:[{url:"https://picsum.photos/seed/cedros-jacket/900/900",alt:"Coach Jacket"}],price:96,currency:"USD",tags:["limited"],categoryIds:["cat_apparel"],inventoryStatus:"backorder",shippingProfile:"physical"},{id:"p_mug",slug:"cedros-mug",title:"Cedros Mug",description:"Stoneware mug with a satin glaze.",images:[{url:"https://picsum.photos/seed/cedros-mug/900/900",alt:"Cedros Mug"}],price:22,currency:"USD",tags:["gift"],categoryIds:["cat_accessories"],inventoryStatus:"low",shippingProfile:"physical"},{id:"p_guide",slug:"cedros-field-guide",title:"Field Guide (Digital)",description:"A short digital guide to shipping delightful checkout flows.",images:[{url:"https://picsum.photos/seed/cedros-guide/900/900",alt:"Field Guide cover"}],price:12,currency:"USD",tags:["digital"],categoryIds:["cat_accessories"],inventoryStatus:"in_stock",shippingProfile:"digital"}];function Bf(e,t){let n=e;if(t.category&&t.category!=="all"){const c=$l.find(d=>d.slug===t.category||d.id===t.category);c&&(n=n.filter(d=>d.categoryIds.includes(c.id)))}if(t.search){const c=t.search.toLowerCase();n=n.filter(d=>d.title.toLowerCase().includes(c)||d.description.toLowerCase().includes(c))}const r=t.filters??{},s=r.tags;if(Array.isArray(s)&&s.length>0){const c=new Set(s.map(String));n=n.filter(d=>d.tags?.some(f=>c.has(f)))}const a=typeof r.priceMin=="number"?r.priceMin:void 0,i=typeof r.priceMax=="number"?r.priceMax:void 0;return typeof a=="number"&&(n=n.filter(c=>c.price>=a)),typeof i=="number"&&(n=n.filter(c=>c.price<=i)),(typeof r.inStock=="boolean"?r.inStock:void 0)===!0&&(n=n.filter(c=>c.inventoryStatus!=="out_of_stock")),n}function Uf(e,t){if(!t||t==="featured")return e;const n=[...e];return t==="price_asc"&&n.sort((r,s)=>r.price-s.price),t==="price_desc"&&n.sort((r,s)=>s.price-r.price),n}function Vf(e,t,n){const r=(t-1)*n;return{items:e.slice(r,r+n),page:t,pageSize:n,total:e.length,hasNextPage:r+n<e.length}}function Hf(e){const t=new Date().toISOString(),n=e.cart.map(s=>{const a=Qr.find(i=>i.id===s.resource||i.slug===s.resource)??Qr[0];return{title:a.title,qty:s.quantity,unitPrice:a.price,currency:e.options.currency,imageUrl:a.images[0]?.url,productId:a.id,tokenizedAsset:!!a.tokenizedAssetConfig}}),r=n.reduce((s,a)=>s+a.qty*a.unitPrice,0);return{id:`ord_${Math.random().toString(16).slice(2)}`,createdAt:t,status:"paid",total:r,currency:e.options.currency,items:n,receiptUrl:e.options.successUrl}}function Zf(){let e=[];const t={};return{async listProducts(n){await vt(150);const r=n.page??1,s=n.pageSize??24,a=Bf(Qr,n),i=Uf(a,n.sort);return Vf(i,r,s)},async getProductBySlug(n){return await vt(100),Qr.find(r=>r.slug===n)??null},async listCategories(){return await vt(80),$l},async getOrderHistory(){return await vt(120),e},async getCart({customerId:n}){return await vt(80),t[n]??{items:[]}},async mergeCart({customerId:n,cart:r}){await vt(120);const s=t[n]??{items:[]},a=new Map,i=c=>{const d=`${c.productId}::${c.variantId??""}`,f=a.get(d);f?a.set(d,{...f,qty:f.qty+c.qty}):a.set(d,c)};for(const c of s.items)i(c);for(const c of r.items)i(c);const l={items:Array.from(a.values()),promoCode:r.promoCode??s.promoCode};return t[n]=l,l},async updateCart({customerId:n,cart:r}){await vt(60),t[n]=r},async createCheckoutSession(n){await vt(250);const r=Hf(n);if(e=[r,...e].slice(0,25),n.options.successUrl){const s=new URL(n.options.successUrl,"http://localhost");return s.searchParams.set("demoOrderId",r.id),{kind:"redirect",url:s.toString().replace("http://localhost","")}}return{kind:"custom",data:{orderId:r.id}}},async listSubscriptionTiers(){return await vt(80),[{id:"tier_starter",title:"Starter",description:"For small shops getting started.",priceMonthly:19,priceAnnual:190,currency:"USD",features:["Basic analytics","Email support","1 storefront"]},{id:"tier_growth",title:"Growth",description:"For teams iterating fast.",priceMonthly:49,priceAnnual:490,currency:"USD",features:["Advanced analytics","Priority support","3 storefronts"],isPopular:!0},{id:"tier_enterprise",title:"Enterprise",description:"For high volume and custom needs.",priceMonthly:199,priceAnnual:1990,currency:"USD",features:["SLA","Dedicated success","Unlimited storefronts"]}]},async getSubscriptionStatus(){return await vt(80),{isActive:!1}},async createSubscriptionCheckoutSession(n){return await vt(200),n.successUrl?{kind:"redirect",url:n.successUrl}:{kind:"custom",data:n}}}}const ui=50,Wf=4,qf=5,Gf=100,Yf=1e4,Kf={maxRetries:2,initialDelayMs:100,backoffFactor:2,maxDelayMs:500,jitter:!1};function Eo(e){return e.replace(/[_-]+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function Qf(e){return e?e.toUpperCase():"USD"}function Jf(e){if(e&&(e==="in_stock"||e==="low"||e==="out_of_stock"||e==="backorder"))return e}function Xf(e){if(e&&(e==="physical"||e==="digital"))return e}function em(e){const t=[];if(Array.isArray(e))for(const n of e)typeof n=="string"&&t.push(n);else if(typeof e=="string"){const n=e.trim();if(n.startsWith("["))try{const r=JSON.parse(n);if(Array.isArray(r))for(const s of r)typeof s=="string"&&t.push(s);else t.push(e)}catch{t.push(e)}else t.push(e)}return t.flatMap(n=>n.split(",")).map(n=>n.trim().toUpperCase()).filter(Boolean)}function _n(e){const t=Qf(e.fiatCurrency),n=e.images&&e.images.length?e.images:e.imageUrl?[{url:e.imageUrl,alt:e.title}]:[],r=e.effectiveFiatAmountCents??e.fiatAmountCents??0,s=e.compareAtAmountCents,a=e.metadata?.shippingCountries??e.metadata?.shipping_countries,i=em(a);return{id:e.id,slug:e.slug??e.id,title:e.title??Eo(e.id),description:e.description??"",images:n,price:r/100,currency:t,tags:e.tags??[],categoryIds:e.categoryIds??[],inventoryStatus:Jf(e.inventoryStatus),inventoryQuantity:typeof e.inventoryQuantity=="number"?e.inventoryQuantity:void 0,compareAtPrice:typeof s=="number"?s/100:void 0,shippingProfile:Xf(e.shippingProfile),checkoutRequirements:e.checkoutRequirements,fulfillment:e.fulfillment,tokenizedAssetConfig:e.tokenizedAssetConfig,attributes:i.length?{shippingCountries:i.join(",")}:void 0}}function Hr(e){if(Array.isArray(e))return{products:e};const t=e.products??e.items??[],n=e.total??e.count;return{products:t,total:n}}function tm(e){if(Array.isArray(e))return{collections:e};const t=e.collections??e.items??[],n=e.total??e.count;return{collections:t,total:n}}async function it(e,t,n,r={}){const{body:s,headers:a,method:i="GET",retryableRead:l=!1,timeoutMs:c=Yf}=r,d={};n&&(d["X-API-Key"]=n),a&&Object.assign(d,a);const f=async()=>{const u=await _o.fetchWithTimeout(`${e}${t}`,{body:s,headers:d,method:i},c);if(!u.ok){const g=await u.text().catch(()=>""),h=new Error(`Request failed (${u.status}): ${g}`);throw h.status=u.status,h}return u.json()};return l?pt.retryWithBackoff(f,{...Kf,name:`paywall-read-${i.toLowerCase()}`}):f()}async function nm(e,t,n,r){const s=await it(e,`/paywall/v1/products?limit=${n}&offset=${r}`,t,{retryableRead:!0});return Hr(s)}async function fi(e,t,n,r){const{maxPages:s,pageSize:a}=n;for(let i=0;i<s;i+=1){const l=i*a,{products:c,total:d}=await nm(e,t,a,l);if(c.length===0||r(c))return;const f=typeof d=="number"&&l+c.length>=d,u=c.length<a;if(f||u)return}}function rm(e){const t=async f=>{const u=f.page??1,g=f.pageSize??24,h=g,x=(u-1)*g,p=new URLSearchParams;p.set("limit",String(h)),p.set("offset",String(x)),f.search&&p.set("search",f.search),f.category&&(p.set("collection_id",f.category),p.set("category",f.category)),f.sort&&p.set("sort",f.sort),f.filters?.inStock&&p.set("in_stock","true"),f.filters?.minPrice!=null&&p.set("min_price",String(f.filters.minPrice)),f.filters?.maxPrice!=null&&p.set("max_price",String(f.filters.maxPrice));const v=f.filters?.tags,w=Array.isArray(v)?v:typeof v=="string"?[v]:[];w.length&&p.set("tags",w.join(","));const y=await it(e.serverUrl,`/paywall/v1/products?${p.toString()}`,e.apiKey,{retryableRead:!0}),{products:k,total:b}=Hr(y);return{items:k.map(_n),page:u,pageSize:g,total:b,hasNextPage:typeof b=="number"?x+h<b:k.length===h}},n=async f=>{try{const u=await it(e.serverUrl,`/paywall/v1/products/by-slug/${encodeURIComponent(f)}`,e.apiKey,{retryableRead:!0});return _n(u)}catch(u){const g=u?.status;if(g!==404&&g!==405)throw u;try{const h=await it(e.serverUrl,`/paywall/v1/products/${encodeURIComponent(f)}`,e.apiKey,{retryableRead:!0});return _n(h)}catch(h){const x=h?.status;if(x!==404&&x!==405)throw h;let p;return await fi(e.serverUrl,e.apiKey,{maxPages:Wf,pageSize:ui},v=>(p=v.find(w=>w.slug===f||w.id===f),!!p)),p?_n(p):null}}};return{listProducts:t,getProductBySlug:n,getProductsByIds:async f=>{const u=Array.from(new Set(f.filter(Boolean)));if(u.length===0)return new Map;const g=new Map;try{const p=new URLSearchParams;p.set("ids",u.join(",")),p.set("limit",String(u.length)),p.set("offset","0");const v=await it(e.serverUrl,`/paywall/v1/products?${p.toString()}`,e.apiKey,{retryableRead:!0}),{products:w}=Hr(v);for(const y of w){const k=_n(y);g.set(k.id,k),k.slug&&k.slug!==k.id&&g.set(k.slug,k)}}catch{}const h=u.filter(p=>!g.has(p));if(h.length===0)return g;let x=h;try{const p=new Set(x);if(await fi(e.serverUrl,e.apiKey,{maxPages:qf,pageSize:ui},v=>{for(const w of v){const y=_n(w);!p.has(y.id)&&!(y.slug&&p.has(y.slug))||(g.set(y.id,y),y.slug&&y.slug!==y.id&&g.set(y.slug,y),p.delete(y.id),y.slug&&p.delete(y.slug))}return p.size===0}),x=Array.from(p),x.length===0)return g}catch{}for(const p of x)try{const v=await n(p);v&&(g.set(v.id,v),v.slug&&v.slug!==v.id&&g.set(v.slug,v))}catch{}return g},listCategories:async()=>{try{const h=await it(e.serverUrl,`/paywall/v1/collections?limit=${Gf}&offset=0`,e.apiKey,{retryableRead:!0}),{collections:x}=tm(h);if(x.length>0)return x.map(p=>({id:p.id,slug:p.slug??p.id,name:p.name??Eo(p.id),description:p.description}))}catch{}const f=await it(e.serverUrl,"/paywall/v1/products?limit=500&offset=0",e.apiKey,{retryableRead:!0}),{products:u}=Hr(f),g=new Set;for(const h of u)for(const x of h.categoryIds??[])g.add(x);return Array.from(g).map(h=>({id:h,slug:h,name:Eo(h)}))},getOrderHistory:async()=>[],createCheckoutSession:async f=>{const u=f.options.paymentMethodId??"card";if(u!=="card")throw new Error(`Payment method "${u}" is not supported by the paywall commerce adapter`);const g=f.cart.map(y=>({resource:y.resource,quantity:y.quantity,variantId:y.variantId})),h={items:g,metadata:f.options.metadata,coupon:f.options.discountCode,couponCode:f.options.discountCode},x=await it(e.serverUrl,"/paywall/v1/cart/quote",e.apiKey,{method:"POST",body:JSON.stringify(h),headers:{"Content-Type":"application/json"}}),p=x.cartId??x.cart_id;if(!p)throw new Error("Cart quote response did not include cartId");const v={cartId:p,items:g,customerEmail:f.customer.email,customerName:f.customer.name,customerPhone:f.customer.phone,shippingAddress:f.customer.shippingAddress,billingAddress:f.customer.billingAddress,metadata:f.options.metadata,successUrl:f.options.successUrl,cancelUrl:f.options.cancelUrl,coupon:f.options.discountCode,couponCode:f.options.discountCode,tipAmount:f.options.tipAmount,shippingMethodId:f.options.shippingMethodId},w=await it(e.serverUrl,"/paywall/v1/cart/checkout",e.apiKey,{method:"POST",body:JSON.stringify(v),headers:{"Content-Type":"application/json"}});if(!w.url)throw new Error("Checkout session response did not include a redirect URL");return{kind:"redirect",url:w.url}},getStorefrontSettings:async()=>{try{return(await it(e.serverUrl,"/paywall/v1/storefront",e.apiKey,{retryableRead:!0})).config??null}catch{return null}},getPaymentMethodsConfig:async()=>{try{const u=(await it(e.serverUrl,"/paywall/v1/storefront",e.apiKey,{retryableRead:!0})).paymentMethods;return u?{card:!!u.stripe,crypto:!1,credits:!1}:null}catch{return null}},getAIRelatedProducts:async f=>it(e.serverUrl,"/admin/ai/related-products",e.apiKey,{method:"POST",body:JSON.stringify(f),headers:{"Content-Type":"application/json"},retryableRead:!1}),sendChatMessage:async f=>{const u={message:f.message};return f.sessionId&&(u.sessionId=f.sessionId),it(e.serverUrl,"/paywall/v1/chat",e.apiKey,{method:"POST",body:JSON.stringify(u),headers:{"Content-Type":"application/json"},retryableRead:!1})}}}function sm(e){throw new Error(`Unhandled cart action: ${JSON.stringify(e)}`)}function ln(e){return`${e.productId}::${e.variantId??""}`}const om={items:[]};function am(e,t){switch(t.type){case"cart/hydrate":return t.state;case"cart/add":{const n=Math.max(1,Math.floor(t.qty??1)),r=ln(t.item);return e.items.find(a=>ln(a)===r)?{...e,items:e.items.map(a=>ln(a)===r?{...a,qty:a.qty+n}:a)}:{...e,items:[...e.items,{...t.item,qty:n}]}}case"cart/remove":{const n=`${t.productId}::${t.variantId??""}`;return{...e,items:e.items.filter(r=>ln(r)!==n)}}case"cart/setQty":{const n=Math.max(0,Math.floor(t.qty)),r=`${t.productId}::${t.variantId??""}`;return n===0?{...e,items:e.items.filter(s=>ln(s)!==r)}:{...e,items:e.items.map(s=>ln(s)===r?{...s,qty:n}:s)}}case"cart/clear":return{items:[],promoCode:void 0};case"cart/setPromoCode":return{...e,promoCode:t.promoCode||void 0};case"cart/updateHold":{const n=`${t.productId}::${t.variantId??""}`;return{...e,items:e.items.map(r=>ln(r)===n?{...r,holdId:t.holdId,holdExpiresAt:t.holdExpiresAt}:r)}}default:return sm(t)}}function im(e){return e.reduce((t,n)=>t+n.qty,0)}function lm(e){return e.reduce((t,n)=>t+n.qty*n.unitPrice,0)}function mi(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function cm(e,t){try{const n=e.getItem(t);return n?JSON.parse(n):null}catch{return null}}function dm(e,t,n){try{return e.setItem(t,JSON.stringify(n)),!0}catch(r){return console.warn(`[cedros] Failed to write "${t}" to storage`,r),!1}}const Fl=j.createContext(null);function St(){const e=j.useContext(Fl);if(!e)throw new Error("useCart must be used within CartProvider");return e}function pi(e){return!!e&&typeof e=="object"&&typeof e.productId=="string"&&e.productId.length>0&&typeof e.qty=="number"&&e.qty>0&&typeof e.unitPrice=="number"&&typeof e.currency=="string"&&typeof e.titleSnapshot=="string"}function um({children:e}){const{config:t}=ye(),n=t.cart?.storageKey??"cedros_shop_cart_v1",r=t.customer?.id,s=t.customer?.isSignedIn??!!r,a=t.cart?.syncDebounceMs??800,i=!!t.adapter.getCartInventoryStatus,[l,c]=j.useReducer(am,om),d=j.useRef(l);d.current=l;const[f,u]=j.useState(!1),g=j.useRef(!1),h=j.useRef(null),x=j.useRef(null);j.useEffect(()=>{const y=mi();if(!y)return;const k=cm(y,n);if(k&&Array.isArray(k.items)){const b=k.items.filter(pi);c({type:"cart/hydrate",state:{items:b,promoCode:typeof k.promoCode=="string"?k.promoCode:void 0}})}u(!0)},[n]),j.useEffect(()=>{if(!f)return;const y=mi();y&&dm(y,n,l)},[l,n,f]),j.useEffect(()=>{if(!f||!s||!r||!t.adapter.mergeCart&&!t.adapter.getCart||(x.current!==r&&(g.current=!1,h.current=null,x.current=r),g.current))return;let y=!1;return(async()=>{try{const k=t.adapter.mergeCart?await t.adapter.mergeCart({customerId:r,cart:d.current}):await t.adapter.getCart({customerId:r});if(y)return;if(k&&Array.isArray(k.items)){g.current=!0;const b={...k,items:k.items.filter(pi)};c({type:"cart/hydrate",state:b}),h.current=JSON.stringify(b)}}catch{y||(g.current=!1)}})(),()=>{y=!0}},[t.adapter,r,f,s]),j.useEffect(()=>{if(!f||!s||!r||!t.adapter.updateCart||!g.current||typeof window>"u")return;const y=JSON.stringify(l);if(h.current===y)return;const k=window.setTimeout(()=>{t.adapter.updateCart({customerId:r,cart:l}).then(()=>{h.current=y}).catch(b=>{console.warn("[CedrosPay] Cart server sync failed:",b instanceof Error?b.message:b)})},a);return()=>window.clearTimeout(k)},[t.adapter,r,f,s,l,a]);const p=j.useCallback((y,k)=>{const b=l.items.find(S=>S.productId===y&&S.variantId===k);if(b)return{holdId:b.holdId,expiresAt:b.holdExpiresAt}},[l.items]),v=j.useCallback((y,k,b)=>{c({type:"cart/updateHold",productId:y,variantId:k,holdExpiresAt:b})},[]),w=j.useMemo(()=>{const y=im(l.items),k=lm(l.items);return{items:l.items,promoCode:l.promoCode,count:y,subtotal:k,addItem:(b,S)=>c({type:"cart/add",item:b,qty:S}),removeItem:(b,S)=>c({type:"cart/remove",productId:b,variantId:S}),setQty:(b,S,A)=>c({type:"cart/setQty",productId:b,variantId:S,qty:A}),clear:()=>c({type:"cart/clear"}),setPromoCode:b=>c({type:"cart/setPromoCode",promoCode:b}),holdsSupported:i,getItemHold:p,updateItemHold:v}},[l.items,l.promoCode,i,p,v]);return o.jsx(Fl.Provider,{value:w,children:e})}function P(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const d=i.prototype,f=Object.keys(d);for(let u=0;u<f.length;u++){const g=f[u];g in l||(l[g]=d[g].bind(l))}}const s=n?.Parent??Object;class a extends s{}Object.defineProperty(a,"name",{value:e});function i(l){var c;const d=n?.Parent?new a:this;r(d,l),(c=d._zod).deferred??(c.deferred=[]);for(const f of d._zod.deferred)f();return d}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Rn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Bl extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ul={};function dn(e){return Ul}function Vl(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function Ao(e,t){return typeof t=="bigint"?t.toString():t}function Xo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ea(e){return e==null}function ta(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function fm(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let s=(r.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(s=Number.parseInt(c[1]))}const a=n>s?n:s,i=Number.parseInt(e.toFixed(a).replace(".","")),l=Number.parseInt(t.toFixed(a).replace(".",""));return i%l/10**a}const hi=Symbol("evaluating");function me(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==hi)return r===void 0&&(r=hi,r=n()),r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function gn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function gi(e){return JSON.stringify(e)}function mm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Hl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Jr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const pm=Xo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function dr(e){if(Jr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Jr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Zl(e){return dr(e)?{...e}:Array.isArray(e)?[...e]:e}const hm=new Set(["string","number","symbol"]);function Dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function en(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function J(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function gm(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const xm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function vm(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const a=Xt(e._zod.def,{get shape(){const i={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(i[l]=n.shape[l])}return gn(this,"shape",i),i},checks:[]});return en(e,a)}function bm(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=Xt(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete i[l]}return gn(this,"shape",i),i},checks:[]});return en(e,a)}function ym(e,t){if(!dr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const a=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(a,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Xt(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return gn(this,"shape",a),a}});return en(e,s)}function wm(e,t){if(!dr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Xt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gn(this,"shape",r),r}});return en(e,n)}function km(e,t){const n=Xt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return en(e,n)}function Sm(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Xt(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const d in n){if(!(d in l))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(c[d]=e?new e({type:"optional",innerType:l[d]}):l[d])}else for(const d in l)c[d]=e?new e({type:"optional",innerType:l[d]}):l[d];return gn(this,"shape",c),c},checks:[]});return en(t,i)}function Nm(e,t,n){const r=Xt(t._zod.def,{get shape(){const s=t._zod.def.shape,a={...s};if(n)for(const i in n){if(!(i in a))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(a[i]=new e({type:"nonoptional",innerType:s[i]}))}else for(const i in s)a[i]=new e({type:"nonoptional",innerType:s[i]});return gn(this,"shape",a),a}});return en(t,r)}function Pn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Wl(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function _r(e){return typeof e=="string"?e:e?.message}function un(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const s=_r(e.inst?._zod.def?.error?.(e))??_r(t?.error?.(e))??_r(n.customError?.(e))??_r(n.localeError?.(e))??"Invalid input";r.message=s}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function na(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ur(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ql=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ao,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gl=P("$ZodError",ql),Yl=P("$ZodError",ql,{Parent:Error});function jm(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function Cm(e,t=n=>n.message){const n={_errors:[]},r=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(i=>r({issues:i}));else if(a.code==="invalid_key")r({issues:a.issues});else if(a.code==="invalid_element")r({issues:a.issues});else if(a.path.length===0)n._errors.push(t(a));else{let i=n,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(a))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(e),n}const ra=e=>(t,n,r,s)=>{const a=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new Rn;if(i.issues.length){const l=new(s?.Err??e)(i.issues.map(c=>un(c,a,dn())));throw Hl(l,s?.callee),l}return i.value},sa=e=>async(t,n,r,s)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new(s?.Err??e)(i.issues.map(c=>un(c,a,dn())));throw Hl(l,s?.callee),l}return i.value},xs=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new Rn;return a.issues.length?{success:!1,error:new(e??Gl)(a.issues.map(i=>un(i,s,dn())))}:{success:!0,data:a.value}},_m=xs(Yl),vs=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(i=>un(i,s,dn())))}:{success:!0,data:a.value}},Em=vs(Yl),Am=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ra(e)(t,n,s)},Im=e=>(t,n,r)=>ra(e)(t,n,r),Tm=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return sa(e)(t,n,s)},Pm=e=>async(t,n,r)=>sa(e)(t,n,r),Rm=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xs(e)(t,n,s)},Om=e=>(t,n,r)=>xs(e)(t,n,r),Mm=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vs(e)(t,n,s)},Dm=e=>async(t,n,r)=>vs(e)(t,n,r),zm=/^[cC][^\s-]{8,}$/,Lm=/^[0-9a-z]+$/,$m=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fm=/^[0-9a-vA-V]{20}$/,Bm=/^[A-Za-z0-9]{27}$/,Um=/^[a-zA-Z0-9_-]{21}$/,Vm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hm=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xi=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Wm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function qm(){return new RegExp(Wm,"u")}const Gm=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ym=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Km=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qm=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Kl=/^[A-Za-z0-9_-]*$/,Xm=/^\+[1-9]\d{6,14}$/,Ql="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ep=new RegExp(`^${Ql}$`);function Jl(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function tp(e){return new RegExp(`^${Jl(e)}$`)}function np(e){const t=Jl({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Ql}T(?:${r})$`)}const rp=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},sp=/^-?\d+$/,op=/^-?\d+(?:\.\d+)?$/,ap=/^(?:true|false)$/i,ip=/^[^A-Z]*$/,lp=/^[^a-z]*$/,st=P("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Xl={number:"number",bigint:"bigint",object:"date"},ec=P("$ZodCheckLessThan",(e,t)=>{st.init(e,t);const n=Xl[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,a=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tc=P("$ZodCheckGreaterThan",(e,t)=>{st.init(e,t);const n=Xl[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,a=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cp=P("$ZodCheckMultipleOf",(e,t)=>{st.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):fm(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dp=P("$ZodCheckNumberFormat",(e,t)=>{st.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[s,a]=xm[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=s,l.maximum=a,n&&(l.pattern=sp)}),e._zod.check=i=>{const l=i.value;if(n){if(!Number.isInteger(l)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<s&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),l>a&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),up=P("$ZodCheckMaxLength",(e,t)=>{var n;st.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!ea(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const i=na(s);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),fp=P("$ZodCheckMinLength",(e,t)=>{var n;st.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!ea(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const i=na(s);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),mp=P("$ZodCheckLengthEquals",(e,t)=>{var n;st.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!ea(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,a=s.length;if(a===t.length)return;const i=na(s),l=a>t.length;r.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),bs=P("$ZodCheckStringFormat",(e,t)=>{var n,r;st.init(e,t),e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),pp=P("$ZodCheckRegex",(e,t)=>{bs.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hp=P("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ip),bs.init(e,t)}),gp=P("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=lp),bs.init(e,t)}),xp=P("$ZodCheckIncludes",(e,t)=>{st.init(e,t);const n=Dn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),vp=P("$ZodCheckStartsWith",(e,t)=>{st.init(e,t);const n=new RegExp(`^${Dn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),bp=P("$ZodCheckEndsWith",(e,t)=>{st.init(e,t);const n=new RegExp(`.*${Dn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),yp=P("$ZodCheckOverwrite",(e,t)=>{st.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class wp{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
2
|
+
`).filter(i=>i),s=Math.min(...r.map(i=>i.length-i.trimStart().length)),a=r.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of a)this.content.push(i)}compile(){const t=Function,n=this?.args,s=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...n,s.join(`
|
|
3
|
+
`))}}const kp={major:4,minor:3,patch:6},Se=P("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kp;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const a of s._zod.onattach)a(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,l,c)=>{let d=Pn(i),f;for(const u of l){if(u._zod.def.when){if(!u._zod.def.when(i))continue}else if(d)continue;const g=i.issues.length,h=u._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new Rn;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,i.issues.length!==g&&(d||(d=Pn(i,g)))});else{if(i.issues.length===g)continue;d||(d=Pn(i,g))}}return f?f.then(()=>i):i},a=(i,l,c)=>{if(Pn(i))return i.aborted=!0,i;const d=s(l,r,c);if(d instanceof Promise){if(c.async===!1)throw new Rn;return d.then(f=>e._zod.parse(f,c))}return e._zod.parse(d,c)};e._zod.run=(i,l)=>{if(l.skipChecks)return e._zod.parse(i,l);if(l.direction==="backward"){const d=e._zod.parse({value:i.value,issues:[]},{...l,skipChecks:!0});return d instanceof Promise?d.then(f=>a(f,i,l)):a(d,i,l)}const c=e._zod.parse(i,l);if(c instanceof Promise){if(l.async===!1)throw new Rn;return c.then(d=>s(d,r,l))}return s(c,r,l)}}me(e,"~standard",()=>({validate:s=>{try{const a=_m(e,s);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Em(e,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),oa=P("$ZodString",(e,t)=>{Se.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??rp(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ve=P("$ZodStringFormat",(e,t)=>{bs.init(e,t),oa.init(e,t)}),Sp=P("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Hm),ve.init(e,t)}),Np=P("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xi(r))}else t.pattern??(t.pattern=xi());ve.init(e,t)}),jp=P("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Zm),ve.init(e,t)}),Cp=P("$ZodURL",(e,t)=>{ve.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),s=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),_p=P("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=qm()),ve.init(e,t)}),Ep=P("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Um),ve.init(e,t)}),Ap=P("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zm),ve.init(e,t)}),Ip=P("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Lm),ve.init(e,t)}),Tp=P("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$m),ve.init(e,t)}),Pp=P("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fm),ve.init(e,t)}),Rp=P("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Bm),ve.init(e,t)}),Op=P("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=np(t)),ve.init(e,t)}),Mp=P("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ep),ve.init(e,t)}),Dp=P("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=tp(t)),ve.init(e,t)}),zp=P("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vm),ve.init(e,t)}),Lp=P("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gm),ve.init(e,t),e._zod.bag.format="ipv4"}),$p=P("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ym),ve.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Fp=P("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Km),ve.init(e,t)}),Bp=P("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Qm),ve.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,a]=r;if(!a)throw new Error;const i=Number(a);if(`${i}`!==a)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function nc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Up=P("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Jm),ve.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{nc(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Vp(e){if(!Kl.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return nc(n)}const Hp=P("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Kl),ve.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Vp(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Zp=P("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Xm),ve.init(e,t)});function Wp(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const qp=P("$ZodJWT",(e,t)=>{ve.init(e,t),e._zod.check=n=>{Wp(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),rc=P("$ZodNumber",(e,t)=>{Se.init(e,t),e._zod.pattern=e._zod.bag.pattern??op,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const a=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...a?{received:a}:{}}),n}}),Gp=P("$ZodNumberFormat",(e,t)=>{dp.init(e,t),rc.init(e,t)}),Yp=P("$ZodBoolean",(e,t)=>{Se.init(e,t),e._zod.pattern=ap,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),Kp=P("$ZodUnknown",(e,t)=>{Se.init(e,t),e._zod.parse=n=>n}),Qp=P("$ZodNever",(e,t)=>{Se.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function vi(e,t,n){e.issues.length&&t.issues.push(...Wl(n,e.issues)),t.value[n]=e.value}const Jp=P("$ZodArray",(e,t)=>{Se.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const a=[];for(let i=0;i<s.length;i++){const l=s[i],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?a.push(c.then(d=>vi(d,n,i))):vi(c,n,i)}return a.length?Promise.all(a).then(()=>n):n}});function Xr(e,t,n,r,s){if(e.issues.length){if(s&&!(n in r))return;t.issues.push(...Wl(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function sc(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=gm(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function oc(e,t,n,r,s,a){const i=[],l=s.keySet,c=s.catchall._zod,d=c.def.type,f=c.optout==="optional";for(const u in t){if(l.has(u))continue;if(d==="never"){i.push(u);continue}const g=c.run({value:t[u],issues:[]},r);g instanceof Promise?e.push(g.then(h=>Xr(h,n,u,t,f))):Xr(g,n,u,t,f)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Xp=P("$ZodObject",(e,t)=>{if(Se.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Xo(()=>sc(t));me(e._zod,"propValues",()=>{const l=t.shape,c={};for(const d in l){const f=l[d]._zod;if(f.values){c[d]??(c[d]=new Set);for(const u of f.values)c[d].add(u)}}return c});const s=Jr,a=t.catchall;let i;e._zod.parse=(l,c)=>{i??(i=r.value);const d=l.value;if(!s(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value={};const f=[],u=i.shape;for(const g of i.keys){const h=u[g],x=h._zod.optout==="optional",p=h._zod.run({value:d[g],issues:[]},c);p instanceof Promise?f.push(p.then(v=>Xr(v,l,g,d,x))):Xr(p,l,g,d,x)}return a?oc(f,d,l,c,r.value,e):f.length?Promise.all(f).then(()=>l):l}}),eh=P("$ZodObjectJIT",(e,t)=>{Xp.init(e,t);const n=e._zod.parse,r=Xo(()=>sc(t)),s=g=>{const h=new wp(["shape","payload","ctx"]),x=r.value,p=k=>{const b=gi(k);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};h.write("const input = payload.value;");const v=Object.create(null);let w=0;for(const k of x.keys)v[k]=`key_${w++}`;h.write("const newResult = {};");for(const k of x.keys){const b=v[k],S=gi(k),I=g[k]?._zod?.optout==="optional";h.write(`const ${b} = ${p(k)};`),I?h.write(`
|
|
4
|
+
if (${b}.issues.length) {
|
|
5
|
+
if (${S} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${b}.value === undefined) {
|
|
14
|
+
if (${S} in input) {
|
|
15
|
+
newResult[${S}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${S}] = ${b}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):h.write(`
|
|
22
|
+
if (${b}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${b}.value === undefined) {
|
|
30
|
+
if (${S} in input) {
|
|
31
|
+
newResult[${S}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${S}] = ${b}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`)}h.write("payload.value = newResult;"),h.write("return payload;");const y=h.compile();return(k,b)=>y(g,k,b)};let a;const i=Jr,l=!Ul.jitless,d=l&&pm.value,f=t.catchall;let u;e._zod.parse=(g,h)=>{u??(u=r.value);const x=g.value;return i(x)?l&&d&&h?.async===!1&&h.jitless!==!0?(a||(a=s(t.shape)),g=a(g,h),f?oc([],x,g,h,u,e):g):n(g,h):(g.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),g)}});function bi(e,t,n,r){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const s=e.filter(a=>!Pn(a));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(a=>a.issues.map(i=>un(i,r,dn())))}),t)}const th=P("$ZodUnion",(e,t)=>{Se.init(e,t),me(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),me(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),me(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),me(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${s.map(a=>ta(a.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(s,a)=>{if(n)return r(s,a);let i=!1;const l=[];for(const c of t.options){const d=c._zod.run({value:s.value,issues:[]},a);if(d instanceof Promise)l.push(d),i=!0;else{if(d.issues.length===0)return d;l.push(d)}}return i?Promise.all(l).then(c=>bi(c,s,e,a)):bi(l,s,e,a)}}),nh=P("$ZodIntersection",(e,t)=>{Se.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,a=t.left._zod.run({value:s,issues:[]},r),i=t.right._zod.run({value:s,issues:[]},r);return a instanceof Promise||i instanceof Promise?Promise.all([a,i]).then(([c,d])=>yi(n,c,d)):yi(n,a,i)}});function Io(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(dr(e)&&dr(t)){const n=Object.keys(t),r=Object.keys(e).filter(a=>n.indexOf(a)!==-1),s={...e,...t};for(const a of r){const i=Io(e[a],t[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};s[a]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],a=t[r],i=Io(s,a);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yi(e,t,n){const r=new Map;let s;for(const l of t.issues)if(l.code==="unrecognized_keys"){s??(s=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length&&s&&e.issues.push({...s,keys:a}),Pn(e))return e;const i=Io(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const rh=P("$ZodEnum",(e,t)=>{Se.init(e,t);const n=Vl(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(s=>hm.has(typeof s)).map(s=>typeof s=="string"?Dn(s):s.toString()).join("|")})$`),e._zod.parse=(s,a)=>{const i=s.value;return r.has(i)||s.issues.push({code:"invalid_value",values:n,input:i,inst:e}),s}}),sh=P("$ZodLiteral",(e,t)=>{if(Se.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Dn(r):r?Dn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,s)=>{const a=r.value;return n.has(a)||r.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),r}}),oh=P("$ZodTransform",(e,t)=>{Se.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Bl(e.constructor.name);const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(n.value=i,n));if(s instanceof Promise)throw new Rn;return n.value=s,n}});function wi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ac=P("$ZodOptional",(e,t)=>{Se.init(e,t),e._zod.optin="optional",e._zod.optout="optional",me(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),me(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ta(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>wi(a,n.value)):wi(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),ah=P("$ZodExactOptional",(e,t)=>{ac.init(e,t),me(e._zod,"values",()=>t.innerType._zod.values),me(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ih=P("$ZodNullable",(e,t)=>{Se.init(e,t),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ta(n.source)}|null)$`):void 0}),me(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),lh=P("$ZodDefault",(e,t)=>{Se.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>ki(a,t)):ki(s,t)}});function ki(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ch=P("$ZodPrefault",(e,t)=>{Se.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),dh=P("$ZodNonOptional",(e,t)=>{Se.init(e,t),me(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>Si(a,e)):Si(s,e)}});function Si(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const uh=P("$ZodCatch",(e,t)=>{Se.init(e,t),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(i=>un(i,r,dn()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(a=>un(a,r,dn()))},input:n.value}),n.issues=[]),n)}}),fh=P("$ZodPipe",(e,t)=>{Se.init(e,t),me(e._zod,"values",()=>t.in._zod.values),me(e._zod,"optin",()=>t.in._zod.optin),me(e._zod,"optout",()=>t.out._zod.optout),me(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const a=t.out._zod.run(n,r);return a instanceof Promise?a.then(i=>Er(i,t.in,r)):Er(a,t.in,r)}const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(a=>Er(a,t.out,r)):Er(s,t.out,r)}});function Er(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const mh=P("$ZodReadonly",(e,t)=>{Se.init(e,t),me(e._zod,"propValues",()=>t.innerType._zod.propValues),me(e._zod,"values",()=>t.innerType._zod.values),me(e._zod,"optin",()=>t.innerType?._zod?.optin),me(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(Ni):Ni(s)}});function Ni(e){return e.value=Object.freeze(e.value),e}const ph=P("$ZodCustom",(e,t)=>{st.init(e,t),Se.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(a=>ji(a,n,r,e));ji(s,n,r,e)}});function ji(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(ur(s))}}var Ci;class hh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function gh(){return new hh}(Ci=globalThis).__zod_globalRegistry??(Ci.__zod_globalRegistry=gh());const or=globalThis.__zod_globalRegistry;function xh(e,t){return new e({type:"string",...J(t)})}function vh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...J(t)})}function _i(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...J(t)})}function bh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...J(t)})}function yh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J(t)})}function wh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J(t)})}function kh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J(t)})}function Sh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...J(t)})}function Nh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...J(t)})}function jh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...J(t)})}function Ch(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...J(t)})}function _h(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...J(t)})}function Eh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...J(t)})}function Ah(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...J(t)})}function Ih(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...J(t)})}function Th(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...J(t)})}function Ph(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...J(t)})}function Rh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J(t)})}function Oh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J(t)})}function Mh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...J(t)})}function Dh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...J(t)})}function zh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...J(t)})}function Lh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...J(t)})}function $h(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J(t)})}function Fh(e,t){return new e({type:"string",format:"date",check:"string_format",...J(t)})}function Bh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...J(t)})}function Uh(e,t){return new e({type:"string",format:"duration",check:"string_format",...J(t)})}function Vh(e,t){return new e({type:"number",checks:[],...J(t)})}function Hh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...J(t)})}function Zh(e,t){return new e({type:"boolean",...J(t)})}function Wh(e){return new e({type:"unknown"})}function qh(e,t){return new e({type:"never",...J(t)})}function Ei(e,t){return new ec({check:"less_than",...J(t),value:e,inclusive:!1})}function eo(e,t){return new ec({check:"less_than",...J(t),value:e,inclusive:!0})}function Ai(e,t){return new tc({check:"greater_than",...J(t),value:e,inclusive:!1})}function to(e,t){return new tc({check:"greater_than",...J(t),value:e,inclusive:!0})}function Ii(e,t){return new cp({check:"multiple_of",...J(t),value:e})}function ic(e,t){return new up({check:"max_length",...J(t),maximum:e})}function es(e,t){return new fp({check:"min_length",...J(t),minimum:e})}function lc(e,t){return new mp({check:"length_equals",...J(t),length:e})}function Gh(e,t){return new pp({check:"string_format",format:"regex",...J(t),pattern:e})}function Yh(e){return new hp({check:"string_format",format:"lowercase",...J(e)})}function Kh(e){return new gp({check:"string_format",format:"uppercase",...J(e)})}function Qh(e,t){return new xp({check:"string_format",format:"includes",...J(t),includes:e})}function Jh(e,t){return new vp({check:"string_format",format:"starts_with",...J(t),prefix:e})}function Xh(e,t){return new bp({check:"string_format",format:"ends_with",...J(t),suffix:e})}function $n(e){return new yp({check:"overwrite",tx:e})}function eg(e){return $n(t=>t.normalize(e))}function tg(){return $n(e=>e.trim())}function ng(){return $n(e=>e.toLowerCase())}function rg(){return $n(e=>e.toUpperCase())}function sg(){return $n(e=>mm(e))}function og(e,t,n){return new e({type:"array",element:t,...J(n)})}function ag(e,t,n){return new e({type:"custom",check:"custom",fn:t,...J(n)})}function ig(e){const t=lg(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(ur(r,n.value,t._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(ur(s))}},e(n.value,n)));return t}function lg(e,t){const n=new st({check:"custom",...J(t)});return n._zod.check=e,n}function cc(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??or,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ze(e,t,n={path:[],schemaPath:[]}){var r;const s=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{const f={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,f);else{const g=i.schema,h=t.processors[s.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);h(e,t,g,f)}const u=e._zod.parent;u&&(i.ref||(i.ref=u),ze(u,t,f),t.seen.get(u).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&Ge(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function dc(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const l=e.metadataRegistry.get(i[0])?.id;if(l){const c=r.get(l);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,i[0])}}const s=i=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const u=e.external.registry.get(i[0])?.id,g=e.external.uri??(x=>x);if(u)return{ref:g(u)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${g("__shared")}#/${l}/${h}`}}if(i[1]===n)return{ref:"#"};const d=`#/${l}/`,f=i[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:d+f}},a=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:c,defId:d}=s(i);l.def={...l.schema},d&&(l.defId=d);const f=l.schema;for(const u in f)delete f[u];f.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const l=i[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
38
|
+
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const l=i[1];if(t===i[0]){a(i);continue}if(e.external){const d=e.external.registry.get(i[0])?.id;if(t!==i[0]&&d){a(i);continue}}if(e.metadataRegistry.get(i[0])?.id){a(i);continue}if(l.cycle){a(i);continue}if(l.count>1&&e.reused==="ref"){a(i);continue}}}function uc(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const l=e.seen.get(i);if(l.ref===null)return;const c=l.def??l.schema,d={...c},f=l.ref;if(l.ref=null,f){r(f);const g=e.seen.get(f),h=g.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,d),i._zod.parent===f)for(const p in c)p==="$ref"||p==="allOf"||p in d||delete c[p];if(h.$ref&&g.def)for(const p in c)p==="$ref"||p==="allOf"||p in g.def&&JSON.stringify(c[p])===JSON.stringify(g.def[p])&&delete c[p]}const u=i._zod.parent;if(u&&u!==f){r(u);const g=e.seen.get(u);if(g?.schema.$ref&&(c.$ref=g.schema.$ref,g.def))for(const h in c)h==="$ref"||h==="allOf"||h in g.def&&JSON.stringify(c[h])===JSON.stringify(g.def[h])&&delete c[h]}e.override({zodSchema:i,jsonSchema:c,path:l.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(i)}Object.assign(s,n.def??n.schema);const a=e.external?.defs??{};for(const i of e.seen.entries()){const l=i[1];l.def&&l.defId&&(a[l.defId]=l.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?s.$defs=a:s.definitions=a);try{const i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:ts(t,"input",e.processors),output:ts(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function Ge(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ge(r.element,n);if(r.type==="set")return Ge(r.valueType,n);if(r.type==="lazy")return Ge(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ge(r.innerType,n);if(r.type==="intersection")return Ge(r.left,n)||Ge(r.right,n);if(r.type==="record"||r.type==="map")return Ge(r.keyType,n)||Ge(r.valueType,n);if(r.type==="pipe")return Ge(r.in,n)||Ge(r.out,n);if(r.type==="object"){for(const s in r.shape)if(Ge(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(Ge(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(Ge(s,n))return!0;return!!(r.rest&&Ge(r.rest,n))}return!1}const cg=(e,t={})=>n=>{const r=cc({...n,processors:t});return ze(e,r),dc(r,e),uc(r,e)},ts=(e,t,n={})=>r=>{const{libraryOptions:s,target:a}=r??{},i=cc({...s??{},target:a,io:t,processors:n});return ze(e,i),dc(i,e),uc(i,e)},dg={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ug=(e,t,n,r)=>{const s=n;s.type="string";const{minimum:a,maximum:i,format:l,patterns:c,contentEncoding:d}=e._zod.bag;if(typeof a=="number"&&(s.minLength=a),typeof i=="number"&&(s.maxLength=i),l&&(s.format=dg[l]??l,s.format===""&&delete s.format,l==="time"&&delete s.format),d&&(s.contentEncoding=d),c&&c.size>0){const f=[...c];f.length===1?s.pattern=f[0].source:f.length>1&&(s.allOf=[...f.map(u=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:u.source}))])}},fg=(e,t,n,r)=>{const s=n,{minimum:a,maximum:i,format:l,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:f}=e._zod.bag;typeof l=="string"&&l.includes("int")?s.type="integer":s.type="number",typeof f=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=f,s.exclusiveMinimum=!0):s.exclusiveMinimum=f),typeof a=="number"&&(s.minimum=a,typeof f=="number"&&t.target!=="draft-04"&&(f>=a?delete s.minimum:delete s.exclusiveMinimum)),typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=d,s.exclusiveMaximum=!0):s.exclusiveMaximum=d),typeof i=="number"&&(s.maximum=i,typeof d=="number"&&t.target!=="draft-04"&&(d<=i?delete s.maximum:delete s.exclusiveMaximum)),typeof c=="number"&&(s.multipleOf=c)},mg=(e,t,n,r)=>{n.type="boolean"},pg=(e,t,n,r)=>{n.not={}},hg=(e,t,n,r)=>{},gg=(e,t,n,r)=>{const s=e._zod.def,a=Vl(s.entries);a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),n.enum=a},xg=(e,t,n,r)=>{const s=e._zod.def,a=[];for(const i of s.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(i))}else a.push(i);if(a.length!==0)if(a.length===1){const i=a[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),a.every(i=>typeof i=="boolean")&&(n.type="boolean"),a.every(i=>i===null)&&(n.type="null"),n.enum=a},vg=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},bg=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},yg=(e,t,n,r)=>{const s=n,a=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof l=="number"&&(s.maxItems=l),s.type="array",s.items=ze(a.element,t,{...r,path:[...r.path,"items"]})},wg=(e,t,n,r)=>{const s=n,a=e._zod.def;s.type="object",s.properties={};const i=a.shape;for(const d in i)s.properties[d]=ze(i[d],t,{...r,path:[...r.path,"properties",d]});const l=new Set(Object.keys(i)),c=new Set([...l].filter(d=>{const f=a.shape[d]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(s.required=Array.from(c)),a.catchall?._zod.def.type==="never"?s.additionalProperties=!1:a.catchall?a.catchall&&(s.additionalProperties=ze(a.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},kg=(e,t,n,r)=>{const s=e._zod.def,a=s.inclusive===!1,i=s.options.map((l,c)=>ze(l,t,{...r,path:[...r.path,a?"oneOf":"anyOf",c]}));a?n.oneOf=i:n.anyOf=i},Sg=(e,t,n,r)=>{const s=e._zod.def,a=ze(s.left,t,{...r,path:[...r.path,"allOf",0]}),i=ze(s.right,t,{...r,path:[...r.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,c=[...l(a)?a.allOf:[a],...l(i)?i.allOf:[i]];n.allOf=c},Ng=(e,t,n,r)=>{const s=e._zod.def,a=ze(s.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},jg=(e,t,n,r)=>{const s=e._zod.def;ze(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType},Cg=(e,t,n,r)=>{const s=e._zod.def;ze(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},_g=(e,t,n,r)=>{const s=e._zod.def;ze(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Eg=(e,t,n,r)=>{const s=e._zod.def;ze(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Ag=(e,t,n,r)=>{const s=e._zod.def,a=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;ze(a,t,r);const i=t.seen.get(e);i.ref=a},Ig=(e,t,n,r)=>{const s=e._zod.def;ze(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType,n.readOnly=!0},fc=(e,t,n,r)=>{const s=e._zod.def;ze(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType},Tg=P("ZodISODateTime",(e,t)=>{Op.init(e,t),we.init(e,t)});function Pg(e){return $h(Tg,e)}const Rg=P("ZodISODate",(e,t)=>{Mp.init(e,t),we.init(e,t)});function Og(e){return Fh(Rg,e)}const Mg=P("ZodISOTime",(e,t)=>{Dp.init(e,t),we.init(e,t)});function Dg(e){return Bh(Mg,e)}const zg=P("ZodISODuration",(e,t)=>{zp.init(e,t),we.init(e,t)});function Lg(e){return Uh(zg,e)}const $g=(e,t)=>{Gl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Cm(e,n)},flatten:{value:n=>jm(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ao,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ao,2)}},isEmpty:{get(){return e.issues.length===0}}})},gt=P("ZodError",$g,{Parent:Error}),Fg=ra(gt),Bg=sa(gt),Ug=xs(gt),Vg=vs(gt),Hg=Am(gt),Zg=Im(gt),Wg=Tm(gt),qg=Pm(gt),Gg=Rm(gt),Yg=Om(gt),Kg=Mm(gt),Qg=Dm(gt),Ne=P("ZodType",(e,t)=>(Se.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ts(e,"input"),output:ts(e,"output")}}),e.toJSONSchema=cg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Xt(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>en(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Fg(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Ug(e,n,r),e.parseAsync=async(n,r)=>Bg(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Vg(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Hg(e,n,r),e.decode=(n,r)=>Zg(e,n,r),e.encodeAsync=async(n,r)=>Wg(e,n,r),e.decodeAsync=async(n,r)=>qg(e,n,r),e.safeEncode=(n,r)=>Gg(e,n,r),e.safeDecode=(n,r)=>Yg(e,n,r),e.safeEncodeAsync=async(n,r)=>Kg(e,n,r),e.safeDecodeAsync=async(n,r)=>Qg(e,n,r),e.refine=(n,r)=>e.check(Gx(n,r)),e.superRefine=n=>e.check(Yx(n)),e.overwrite=n=>e.check($n(n)),e.optional=()=>Oi(e),e.exactOptional=()=>Mx(e),e.nullable=()=>Mi(e),e.nullish=()=>Oi(Mi(e)),e.nonoptional=n=>Bx(e,n),e.array=()=>Nx(e),e.or=n=>_x([e,n]),e.and=n=>Ax(e,n),e.transform=n=>Di(e,Rx(n)),e.default=n=>Lx(e,n),e.prefault=n=>Fx(e,n),e.catch=n=>Vx(e,n),e.pipe=n=>Di(e,n),e.readonly=()=>Wx(e),e.describe=n=>{const r=e.clone();return or.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return or.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return or.get(e);const r=e.clone();return or.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),mc=P("_ZodString",(e,t)=>{oa.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(r,s,a)=>ug(e,r,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(Gh(...r)),e.includes=(...r)=>e.check(Qh(...r)),e.startsWith=(...r)=>e.check(Jh(...r)),e.endsWith=(...r)=>e.check(Xh(...r)),e.min=(...r)=>e.check(es(...r)),e.max=(...r)=>e.check(ic(...r)),e.length=(...r)=>e.check(lc(...r)),e.nonempty=(...r)=>e.check(es(1,...r)),e.lowercase=r=>e.check(Yh(r)),e.uppercase=r=>e.check(Kh(r)),e.trim=()=>e.check(tg()),e.normalize=(...r)=>e.check(eg(...r)),e.toLowerCase=()=>e.check(ng()),e.toUpperCase=()=>e.check(rg()),e.slugify=()=>e.check(sg())}),Jg=P("ZodString",(e,t)=>{oa.init(e,t),mc.init(e,t),e.email=n=>e.check(vh(Xg,n)),e.url=n=>e.check(Sh(ex,n)),e.jwt=n=>e.check(Lh(hx,n)),e.emoji=n=>e.check(Nh(tx,n)),e.guid=n=>e.check(_i(Ti,n)),e.uuid=n=>e.check(bh(Ar,n)),e.uuidv4=n=>e.check(yh(Ar,n)),e.uuidv6=n=>e.check(wh(Ar,n)),e.uuidv7=n=>e.check(kh(Ar,n)),e.nanoid=n=>e.check(jh(nx,n)),e.guid=n=>e.check(_i(Ti,n)),e.cuid=n=>e.check(Ch(rx,n)),e.cuid2=n=>e.check(_h(sx,n)),e.ulid=n=>e.check(Eh(ox,n)),e.base64=n=>e.check(Mh(fx,n)),e.base64url=n=>e.check(Dh(mx,n)),e.xid=n=>e.check(Ah(ax,n)),e.ksuid=n=>e.check(Ih(ix,n)),e.ipv4=n=>e.check(Th(lx,n)),e.ipv6=n=>e.check(Ph(cx,n)),e.cidrv4=n=>e.check(Rh(dx,n)),e.cidrv6=n=>e.check(Oh(ux,n)),e.e164=n=>e.check(zh(px,n)),e.datetime=n=>e.check(Pg(n)),e.date=n=>e.check(Og(n)),e.time=n=>e.check(Dg(n)),e.duration=n=>e.check(Lg(n))});function Me(e){return xh(Jg,e)}const we=P("ZodStringFormat",(e,t)=>{ve.init(e,t),mc.init(e,t)}),Xg=P("ZodEmail",(e,t)=>{jp.init(e,t),we.init(e,t)}),Ti=P("ZodGUID",(e,t)=>{Sp.init(e,t),we.init(e,t)}),Ar=P("ZodUUID",(e,t)=>{Np.init(e,t),we.init(e,t)}),ex=P("ZodURL",(e,t)=>{Cp.init(e,t),we.init(e,t)}),tx=P("ZodEmoji",(e,t)=>{_p.init(e,t),we.init(e,t)}),nx=P("ZodNanoID",(e,t)=>{Ep.init(e,t),we.init(e,t)}),rx=P("ZodCUID",(e,t)=>{Ap.init(e,t),we.init(e,t)}),sx=P("ZodCUID2",(e,t)=>{Ip.init(e,t),we.init(e,t)}),ox=P("ZodULID",(e,t)=>{Tp.init(e,t),we.init(e,t)}),ax=P("ZodXID",(e,t)=>{Pp.init(e,t),we.init(e,t)}),ix=P("ZodKSUID",(e,t)=>{Rp.init(e,t),we.init(e,t)}),lx=P("ZodIPv4",(e,t)=>{Lp.init(e,t),we.init(e,t)}),cx=P("ZodIPv6",(e,t)=>{$p.init(e,t),we.init(e,t)}),dx=P("ZodCIDRv4",(e,t)=>{Fp.init(e,t),we.init(e,t)}),ux=P("ZodCIDRv6",(e,t)=>{Bp.init(e,t),we.init(e,t)}),fx=P("ZodBase64",(e,t)=>{Up.init(e,t),we.init(e,t)}),mx=P("ZodBase64URL",(e,t)=>{Hp.init(e,t),we.init(e,t)}),px=P("ZodE164",(e,t)=>{Zp.init(e,t),we.init(e,t)}),hx=P("ZodJWT",(e,t)=>{qp.init(e,t),we.init(e,t)}),pc=P("ZodNumber",(e,t)=>{rc.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(r,s,a)=>fg(e,r,s),e.gt=(r,s)=>e.check(Ai(r,s)),e.gte=(r,s)=>e.check(to(r,s)),e.min=(r,s)=>e.check(to(r,s)),e.lt=(r,s)=>e.check(Ei(r,s)),e.lte=(r,s)=>e.check(eo(r,s)),e.max=(r,s)=>e.check(eo(r,s)),e.int=r=>e.check(Pi(r)),e.safe=r=>e.check(Pi(r)),e.positive=r=>e.check(Ai(0,r)),e.nonnegative=r=>e.check(to(0,r)),e.negative=r=>e.check(Ei(0,r)),e.nonpositive=r=>e.check(eo(0,r)),e.multipleOf=(r,s)=>e.check(Ii(r,s)),e.step=(r,s)=>e.check(Ii(r,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function gx(e){return Vh(pc,e)}const xx=P("ZodNumberFormat",(e,t)=>{Gp.init(e,t),pc.init(e,t)});function Pi(e){return Hh(xx,e)}const vx=P("ZodBoolean",(e,t)=>{Yp.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>mg(e,n,r)});function bx(e){return Zh(vx,e)}const yx=P("ZodUnknown",(e,t)=>{Kp.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>hg()});function Ri(){return Wh(yx)}const wx=P("ZodNever",(e,t)=>{Qp.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>pg(e,n,r)});function kx(e){return qh(wx,e)}const Sx=P("ZodArray",(e,t)=>{Jp.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>yg(e,n,r,s),e.element=t.element,e.min=(n,r)=>e.check(es(n,r)),e.nonempty=n=>e.check(es(1,n)),e.max=(n,r)=>e.check(ic(n,r)),e.length=(n,r)=>e.check(lc(n,r)),e.unwrap=()=>e.element});function Nx(e,t){return og(Sx,e,t)}const jx=P("ZodObject",(e,t)=>{eh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>wg(e,n,r,s),me(e,"shape",()=>t.shape),e.keyof=()=>Ix(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ri()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ri()}),e.strict=()=>e.clone({...e._zod.def,catchall:kx()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>ym(e,n),e.safeExtend=n=>wm(e,n),e.merge=n=>km(e,n),e.pick=n=>vm(e,n),e.omit=n=>bm(e,n),e.partial=(...n)=>Sm(gc,e,n[0]),e.required=(...n)=>Nm(xc,e,n[0])});function hc(e,t){const n={type:"object",shape:e??{},...J(t)};return new jx(n)}const Cx=P("ZodUnion",(e,t)=>{th.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>kg(e,n,r,s),e.options=t.options});function _x(e,t){return new Cx({type:"union",options:e,...J(t)})}const Ex=P("ZodIntersection",(e,t)=>{nh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Sg(e,n,r,s)});function Ax(e,t){return new Ex({type:"intersection",left:e,right:t})}const To=P("ZodEnum",(e,t)=>{rh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(r,s,a)=>gg(e,r,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const a={};for(const i of r)if(n.has(i))a[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new To({...t,checks:[],...J(s),entries:a})},e.exclude=(r,s)=>{const a={...t.entries};for(const i of r)if(n.has(i))delete a[i];else throw new Error(`Key ${i} not found in enum`);return new To({...t,checks:[],...J(s),entries:a})}});function Ix(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new To({type:"enum",entries:n,...J(t)})}const Tx=P("ZodLiteral",(e,t)=>{sh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>xg(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function no(e,t){return new Tx({type:"literal",values:Array.isArray(e)?e:[e],...J(t)})}const Px=P("ZodTransform",(e,t)=>{oh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>bg(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Bl(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(ur(a,n.value,t));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(ur(i))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(a=>(n.value=a,n)):(n.value=s,n)}});function Rx(e){return new Px({type:"transform",transform:e})}const gc=P("ZodOptional",(e,t)=>{ac.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>fc(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Oi(e){return new gc({type:"optional",innerType:e})}const Ox=P("ZodExactOptional",(e,t)=>{ah.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>fc(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Mx(e){return new Ox({type:"optional",innerType:e})}const Dx=P("ZodNullable",(e,t)=>{ih.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ng(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Mi(e){return new Dx({type:"nullable",innerType:e})}const zx=P("ZodDefault",(e,t)=>{lh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Cg(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Lx(e,t){return new zx({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Zl(t)}})}const $x=P("ZodPrefault",(e,t)=>{ch.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>_g(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Fx(e,t){return new $x({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Zl(t)}})}const xc=P("ZodNonOptional",(e,t)=>{dh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>jg(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Bx(e,t){return new xc({type:"nonoptional",innerType:e,...J(t)})}const Ux=P("ZodCatch",(e,t)=>{uh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Eg(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vx(e,t){return new Ux({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Hx=P("ZodPipe",(e,t)=>{fh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ag(e,n,r,s),e.in=t.in,e.out=t.out});function Di(e,t){return new Hx({type:"pipe",in:e,out:t})}const Zx=P("ZodReadonly",(e,t)=>{mh.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ig(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Wx(e){return new Zx({type:"readonly",innerType:e})}const qx=P("ZodCustom",(e,t)=>{ph.init(e,t),Ne.init(e,t),e._zod.processJSONSchema=(n,r,s)=>vg(e,n)});function Gx(e,t={}){return ag(qx,e,t)}function Yx(e){return ig(e)}const Ir=hc({line1:Me().min(1,"Address line 1 is required"),line2:Me().optional(),city:Me().min(1,"City is required"),state:Me().optional(),postalCode:Me().min(1,"Postal code is required"),country:Me().min(2,"Country is required")});function Kx(e){return hc({email:e.requireEmail?Me().email("Valid email required"):Me().email("Valid email required").or(no("")).optional(),name:e.requireName?Me().min(1,"Name is required"):Me().optional(),phone:e.requirePhone?Me().min(6,"Phone is required"):Me().optional(),notes:Me().max(500).optional(),shippingAddress:e.requireShippingAddress?Ir:Ir.optional(),billingAddress:e.requireBillingAddress?Ir:Ir.optional(),recipientEmail:Me().email("Valid recipient email required").or(no("")).optional(),giftMessage:Me().max(500).optional(),discountCode:Me().optional(),tipAmount:gx().min(0).optional(),shippingMethodId:Me().optional(),regulatoryConsent:e.requireRegulatoryConsent?no(!0,{message:"You must acknowledge the regulatory notice"}):bx().optional()})}const zi={none:0,optional:1,required:2};function ro(e,t){return zi[e]>=zi[t]?e:t}function Qx(e){if(!e)return null;try{const t=JSON.parse(e);return!t||typeof t!="object"?null:t}catch{return null}}function Zr(e,t){let n=!1,r=!1;const s=new Set;let a=t.requireEmail?"required":"none",i=t.defaultMode==="none"?"none":"optional",l=t.defaultMode==="full"?"optional":"none",c=t.allowShipping&&(t.defaultMode==="shipping"||t.defaultMode==="full"),d=t.defaultMode==="full";for(const u of e){u.metadata?.shippingProfile==="digital"?n=!0:r=!0;const h=Qx(u.metadata?.checkoutRequirements);h&&(h.email&&(a=ro(a,h.email)),h.name&&(i=ro(i,h.name)),h.phone&&(l=ro(l,h.phone)),typeof h.shippingAddress=="boolean"&&(c=c||h.shippingAddress),typeof h.billingAddress=="boolean"&&(d=d||h.billingAddress));const x=u.metadata?.fulfillmentNotes;x&&s.add(x)}const f=n&&!r;return f&&(c=!1),{email:a,name:i,phone:l,shippingAddress:c,billingAddress:d,fulfillmentNotes:Array.from(s).join(" "),isDigitalOnly:f,hasPhysical:r}}const vc=j.createContext(null);function bc(){const{config:e}=ye(),t=St(),n=j.useMemo(()=>({line1:"",line2:"",city:"",state:"",postalCode:"",country:"US"}),[]),r=t.items.some(b=>!!b.metadata?.regulatoryNotice),s=j.useMemo(()=>{const b=Zr(t.items,{requireEmail:e.checkout.requireEmail??!0,defaultMode:e.checkout.mode,allowShipping:e.checkout.allowShipping??!1});return Kx({requireEmail:b.email==="required",requireName:b.name==="required",requirePhone:b.phone==="required",requireShippingAddress:b.shippingAddress,requireBillingAddress:b.billingAddress,requireRegulatoryConsent:r})},[t.items,e.checkout.allowShipping,e.checkout.mode,e.checkout.requireEmail,r]),[a,i]=j.useState(()=>({email:e.checkout.requireEmail??!0?"":void 0,name:"",phone:"",notes:"",shippingAddress:e.checkout.mode==="shipping"||e.checkout.mode==="full"?n:void 0,billingAddress:e.checkout.mode==="full"?n:void 0,discountCode:"",tipAmount:0,shippingMethodId:"",regulatoryConsent:void 0}));j.useEffect(()=>{const b=Zr(t.items,{requireEmail:e.checkout.requireEmail??!0,defaultMode:e.checkout.mode,allowShipping:e.checkout.allowShipping??!1});i(S=>{const A={...S};return b.email==="required"&&!A.email&&(A.email=""),b.shippingAddress&&!A.shippingAddress&&(A.shippingAddress=n),b.billingAddress&&!A.billingAddress&&(A.billingAddress=n),b.shippingAddress||(A.shippingAddress=void 0),b.billingAddress||(A.billingAddress=void 0),A})},[t.items,e.checkout.allowShipping,e.checkout.mode,e.checkout.requireEmail,n]);const l=j.useRef(!1),[c,d]=j.useState({}),[f,u]=j.useState("idle"),[g,h]=j.useState(null),[x,p]=j.useState(null),v=j.useCallback(()=>{d({}),u("idle"),h(null),p(null)},[]),w=j.useCallback((b,S)=>{i(A=>({...A,[b]:S}))},[]),y=j.useCallback(()=>{u("validating"),h(null);const b=s.safeParse(a);if(b.success)return d({}),u("idle"),{ok:!0,values:b.data};const S={};for(const A of b.error.issues)S[A.path.join(".")]=A.message;return d(S),u("error"),h("Please fix the highlighted fields."),{ok:!1}},[s,a]),k=j.useCallback(async b=>{if(l.current)return{ok:!1};const S=y();if(!S.ok)return{ok:!1};l.current=!0,u("creating_session"),h(null),p(null);const A=t.items.map(F=>({resource:F.paymentResource??F.productId,quantity:F.qty,variantId:F.variantId})),I=Zr(t.items,{requireEmail:e.checkout.requireEmail??!0,defaultMode:e.checkout.mode,allowShipping:e.checkout.allowShipping??!1}),E=new Set;if(I.shippingAddress)for(const F of t.items){const $=F.metadata?.shippingCountries;if($)for(const D of $.split(",")){const z=D.trim().toUpperCase();z&&E.add(z)}}const Z={...E.size?{shippingCountries:Array.from(E).join(","),shipping_countries:Array.from(E).join(",")}:{},...S.values.recipientEmail?{recipient_email:S.values.recipientEmail}:{},...S.values.giftMessage?{gift_message:S.values.giftMessage}:{},...S.values.regulatoryConsent?{regulatory_consent:"true"}:{}};try{const F=await e.adapter.createCheckoutSession({cart:A,customer:{email:S.values.email||void 0,name:S.values.name||void 0,phone:S.values.phone||void 0,notes:S.values.notes||void 0,shippingAddress:S.values.shippingAddress,billingAddress:S.values.billingAddress},options:{currency:e.currency,successUrl:e.checkout.successUrl,cancelUrl:e.checkout.cancelUrl,allowPromoCodes:e.checkout.allowPromoCodes,metadata:Object.keys(Z).length?Z:void 0,discountCode:(e.checkout.allowPromoCodes?S.values.discountCode||t.promoCode:void 0)||void 0,tipAmount:e.checkout.allowTipping&&S.values.tipAmount||void 0,shippingMethodId:e.checkout.allowShipping&&S.values.shippingMethodId||void 0,paymentMethodId:b?.paymentMethodId}});return F.kind==="redirect"?(p(F),u("redirecting"),typeof window<"u"&&window.location.assign(F.url),{ok:!0,session:F}):(p(F),u("success"),{ok:!0,session:F})}catch(F){return u("error"),h(F instanceof Error?F.message:"Checkout failed"),{ok:!1}}finally{l.current=!1}},[t.items,t.promoCode,e.adapter,e.checkout,e.currency,y]);return{values:a,setValues:i,setField:w,fieldErrors:c,status:f,error:g,session:x,reset:v,validate:y,createCheckoutSession:k}}function yc({children:e}){const t=bc();return o.jsx(vc.Provider,{value:t,children:e})}function wr(){const e=j.useContext(vc);if(!e)throw new Error("useCheckout must be used within CheckoutProvider");return e}function Jx(){return bc()}function aa(){const{config:e}=ye(),[t,n]=m.useState([]),[r,s]=m.useState(!0),[a,i]=m.useState(null);return m.useEffect(()=>{let l=!1;return s(!0),i(null),e.adapter.listCategories().then(c=>{l||n(c)}).catch(c=>{l||i(c instanceof Error?c.message:"Failed to load categories")}).finally(()=>{l||s(!1)}),()=>{l=!0}},[e.adapter]),{categories:t,isLoading:r,error:a}}function ys(e){const{config:t}=ye(),[n,r]=m.useState(null),[s,a]=m.useState(!0),[i,l]=m.useState(null),c=m.useMemo(()=>JSON.stringify(e.filters??{}),[e.filters]);return m.useEffect(()=>{let d=!1;return a(!0),l(null),t.adapter.listProducts(e).then(f=>{d||r(f)}).catch(f=>{d||l(f instanceof Error?f.message:"Failed to load products")}).finally(()=>{d||a(!1)}),()=>{d=!0}},[t.adapter,e.category,e.search,e.sort,e.page,e.pageSize,c]),{data:n,isLoading:s,error:i}}function wc(e){const{config:t}=ye(),[n,r]=m.useState(null),[s,a]=m.useState(!0),[i,l]=m.useState(null);return m.useEffect(()=>{let c=!1;return a(!0),l(null),t.adapter.getProductBySlug(e).then(d=>{c||r(d)}).catch(d=>{c||l(d instanceof Error?d.message:"Failed to load product")}).finally(()=>{c||a(!1)}),()=>{c=!0}},[t.adapter,e]),{product:n,isLoading:s,error:i}}function kc(){const{config:e}=ye(),[t,n]=m.useState([]),[r,s]=m.useState(!0),[a,i]=m.useState(null);return m.useEffect(()=>{let l=!1;return s(!0),i(null),e.adapter.getOrderHistory().then(c=>{l||n(c)}).catch(c=>{l||i(c instanceof Error?c.message:"Failed to load orders")}).finally(()=>{l||s(!1)}),()=>{l=!0}},[e.adapter]),{orders:t,isLoading:r,error:a}}function Sc(){const{config:e}=ye(),[t,n]=m.useState([]),[r,s]=m.useState(null),[a,i]=m.useState(!0),[l,c]=m.useState(null);return m.useEffect(()=>{let d=!1;async function f(){i(!0),c(null);try{const[u,g]=await Promise.all([e.adapter.listSubscriptionTiers?.()??Promise.resolve([]),e.adapter.getSubscriptionStatus?.()??Promise.resolve(null)]);if(d)return;n(u),s(g)}catch(u){if(d)return;c(u instanceof Error?u.message:"Failed to load subscriptions")}finally{d||i(!1)}}return f(),()=>{d=!0}},[e.adapter]),{tiers:t,status:r,isLoading:a,error:l}}function Nc({enabled:e,customer:t}){const{config:n}=ye(),[r,s]=m.useState([]),[a,i]=m.useState(!1),[l,c]=m.useState(null),d=JSON.stringify(t.shippingAddress??{});return m.useEffect(()=>{let f=!1;if(!e||!n.adapter.getShippingMethods){s([]);return}return i(!0),c(null),n.adapter.getShippingMethods({currency:n.currency,customer:t}).then(u=>{f||s(u)}).catch(u=>{f||c(u instanceof Error?u.message:"Failed to load shipping methods")}).finally(()=>{f||i(!1)}),()=>{f=!0}},[n.adapter,n.currency,e,t.email,t.name,d]),{methods:r,isLoading:a,error:l}}function Kn(e,...t){for(const n of t){const r=e[n];if(r)return r}}function ia(e){const t=Kn(e,"error","error_message","message");if(t)return{kind:"error",message:t};const n=Kn(e,"canceled","cancelled","cancel","canceled_at");if(n&&n!=="0"&&n!=="false")return{kind:"cancel"};const r=Kn(e,"orderId","order_id","demoOrderId"),s=Kn(e,"session_id","checkout_session_id");if(r||s)return{kind:"success",orderId:r??s};const a=(Kn(e,"status","checkout")??"").toLowerCase();return a==="success"?{kind:"success",orderId:r}:a==="cancel"||a==="canceled"?{kind:"cancel"}:a==="error"?{kind:"error"}:{kind:"idle"}}function Xx(e){const t={};return e.forEach((n,r)=>{t[r]=n}),t}function la(){const{config:e}=ye(),[t,n]=m.useState({kind:"idle"});return m.useEffect(()=>{if(typeof window>"u")return;const r=new URLSearchParams(window.location.search),s=Xx(r);(async()=>{try{const a=e.adapter.resolveCheckoutReturn?await e.adapter.resolveCheckoutReturn({query:s}):ia(s);if(a.kind==="success"&&a.orderId&&e.adapter.getOrderById){const i=await e.adapter.getOrderById(a.orderId);if(i){n({kind:"success",orderId:a.orderId,order:i});return}}n(a)}catch(a){n({kind:"error",message:a instanceof Error?a.message:"Failed to resolve checkout"})}})()},[e.adapter]),t}function Po(e){if(!e)return;const t=Number(e);return Number.isFinite(t)?t:void 0}function e0(e){const t=e.get("tags"),n=t?t.split(",").map(l=>l.trim()).filter(Boolean):void 0,r=Po(e.get("min")),s=Po(e.get("max")),a=e.get("inStock"),i=a==="1"?!0:a==="0"?!1:void 0;return{tags:n&&n.length?n:void 0,priceMin:r,priceMax:s,inStock:i}}function t0(e,t){t.tags?.length?e.set("tags",t.tags.join(",")):e.delete("tags"),typeof t.priceMin=="number"?e.set("min",String(t.priceMin)):e.delete("min"),typeof t.priceMax=="number"?e.set("max",String(t.priceMax)):e.delete("max"),typeof t.inStock=="boolean"?e.set("inStock",t.inStock?"1":"0"):e.delete("inStock")}function ca({includeCategory:e}){if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),n=t.get("q")??"",r=t.get("sort")??"featured",s=Po(t.get("page"))??1,a=e0(t),i=e?t.get("cat")??void 0:void 0;return{search:n,sort:r,page:Math.max(1,Math.floor(s)),category:i,filters:a}}function da(e,{includeCategory:t}){const n=e.filters.tags?.join(",")??"";m.useEffect(()=>{if(typeof window>"u")return;const r=window.setTimeout(()=>{const s=new URL(window.location.href),a=s.searchParams;e.search.trim()?a.set("q",e.search.trim()):a.delete("q"),e.sort&&e.sort!=="featured"?a.set("sort",e.sort):a.delete("sort"),e.page&&e.page!==1?a.set("page",String(e.page)):a.delete("page"),t&&(e.category?a.set("cat",e.category):a.delete("cat")),t0(a,e.filters);const i=`${s.pathname}?${a.toString()}${s.hash}`,l=`${window.location.pathname}${window.location.search}${window.location.hash}`;i!==l&&window.history.replaceState({},"",i)},250);return()=>window.clearTimeout(r)},[t,e.category,e.page,e.search,e.sort,n,e.filters.priceMin,e.filters.priceMax,e.filters.inStock])}const Li=2;function $i(e,t){return`${e}::${t??""}`}function n0(e,t){if(t&&e.variants?.length){const n=e.variants.find(r=>r.id===t);if(n)return{qty:n.inventoryQuantity,status:n.inventoryStatus}}return{qty:e.inventoryQuantity,status:e.inventoryStatus}}function r0(e,t){const n={productId:e.productId,variantId:e.variantId,isOutOfStock:!1,exceedsAvailable:!1,isLowStock:!1};if(!t)return{...n,isOutOfStock:!0,message:"This product is no longer available"};const{qty:r,status:s}=n0(t,e.variantId);return n.availableQty=r,n.status=s,s==="out_of_stock"||typeof r=="number"&&r<=0?{...n,isOutOfStock:!0,message:"Out of stock"}:typeof r=="number"&&e.qty>r?{...n,exceedsAvailable:!0,message:r===0?"Out of stock":`Only ${r} available (you have ${e.qty} in cart)`}:s==="low"||typeof r=="number"&&r>0&&r<=5?{...n,isLowStock:!0,message:typeof r=="number"?`Only ${r} left`:"Low stock"}:n}function s0(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e){const s=t.get(n);if(!s||r.productId!==s.productId||r.variantId!==s.variantId||r.availableQty!==s.availableQty||r.status!==s.status||r.isOutOfStock!==s.isOutOfStock||r.exceedsAvailable!==s.exceedsAvailable||r.isLowStock!==s.isLowStock||r.message!==s.message)return!1}return!0}async function o0(e,t){const n=new Map;for(let r=0;r<e.length;r+=Li){const s=e.slice(r,r+Li),a=await Promise.all(s.map(async i=>{try{return await t(i)}catch{return null}}));for(const i of a)i&&(n.set(i.id,i),i.slug&&i.slug!==i.id&&n.set(i.slug,i))}return n}function ua({items:e,refreshInterval:t=3e4,skip:n=!1}){const{config:r}=ye(),[s,a]=m.useState(new Map),[i,l]=m.useState(!1),[c,d]=m.useState(null),f=m.useRef(null),u=m.useRef(e);u.current=e;const g=m.useRef([]),h=m.useMemo(()=>{const k=new Set;for(const b of e)k.add(b.productId);return k},[e]),x=m.useMemo(()=>Array.from(h).sort().join(","),[h]),p=m.useMemo(()=>Array.from(h),[h]);g.current=p;const v=m.useCallback(async()=>{if(n||g.current.length===0){d(null),l(!1),a(S=>S.size===0?S:new Map);return}if(f.current)return f.current;const b=(async()=>{l(!0),d(null);try{const S=g.current,A=r.adapter.getProductsByIds?await r.adapter.getProductsByIds(S):await o0(S,r.adapter.getProductBySlug),I=new Map;for(const E of u.current){const Z=$i(E.productId,E.variantId),F=A.get(E.productId)??null;I.set(Z,r0(E,F))}a(E=>s0(E,I)?E:I)}catch(S){d(S instanceof Error?S.message:"Failed to check inventory")}finally{l(!1),f.current=null}})();return f.current=b,b},[r.adapter,x,n]);m.useEffect(()=>{v()},[v]),m.useEffect(()=>{if(n||t<=0||p.length===0)return;let k=!1,b=null;const S=()=>{b=setTimeout(async()=>{await v(),k||S()},t)};return S(),()=>{k=!0,b&&clearTimeout(b)}},[v,p.length,t,n]);const w=m.useCallback((k,b)=>s.get($i(k,b)),[s]),y=m.useMemo(()=>{for(const k of s.values())if(k.isOutOfStock||k.exceedsAvailable)return!0;return!1},[s]);return{inventory:s,isLoading:i,error:c,refresh:v,getItemInventory:w,hasIssues:y}}function a0(e,t){if(t&&e.variants?.length){const n=e.variants.find(r=>r.id===t);if(n)return{qty:n.inventoryQuantity,status:n.inventoryStatus}}return{qty:e.inventoryQuantity,status:e.inventoryStatus}}function i0(e,t,n){if(!t)return e.titleSnapshot??"Unknown Product";const r=t.title??e.titleSnapshot??"Product";if(n&&t.variants?.length){const s=t.variants.find(a=>a.id===n);if(s?.title)return`${r} - ${s.title}`}return r}function l0(e,t){const n=i0(e,t,e.variantId);if(!t)return{productId:e.productId,variantId:e.variantId,title:n,requestedQty:e.qty,availableQty:0,type:"product_unavailable",message:"This product is no longer available"};const{qty:r,status:s}=a0(t,e.variantId);return s==="out_of_stock"||typeof r=="number"&&r<=0?{productId:e.productId,variantId:e.variantId,title:n,requestedQty:e.qty,availableQty:0,type:"out_of_stock",message:"This item is out of stock"}:typeof r=="number"&&e.qty>r?{productId:e.productId,variantId:e.variantId,title:n,requestedQty:e.qty,availableQty:r,type:"insufficient_stock",message:r===0?"This item is out of stock":`Only ${r} available`}:null}function jc({items:e}){const{config:t}=ye(),[n,r]=m.useState(null),[s,a]=m.useState(!1),[i,l]=m.useState(null),c=m.useMemo(()=>{const u=new Set;for(const g of e)u.add(g.productId);return Array.from(u)},[e]),d=m.useCallback(async()=>{if(e.length===0){const u={ok:!0,issues:[],verifiedAt:new Date};return r(u),u}a(!0),l(null);try{let u=new Map;if(t.adapter.getProductsByIds)u=await t.adapter.getProductsByIds(c);else{const x=await Promise.all(c.map(async p=>{try{return await t.adapter.getProductBySlug(p)}catch{return null}}));u=new Map;for(const p of x)p&&(u.set(p.id,p),p.slug&&p.slug!==p.id&&u.set(p.slug,p))}const g=[];for(const x of e){const p=u.get(x.productId)??null,v=l0(x,p);v&&g.push(v)}const h={ok:g.length===0,issues:g,verifiedAt:new Date};return r(h),a(!1),h}catch(u){const g=u instanceof Error?u.message:"Failed to verify inventory";l(g),a(!1);const h={ok:!1,issues:[],verifiedAt:new Date};return r(h),h}},[t.adapter,e,c]),f=m.useCallback(()=>{r(null),l(null)},[]);return{result:n,isVerifying:s,error:i,verify:d,reset:f}}function c0({items:e,onExpiry:t,enabled:n=!0}){const[r,s]=m.useState([]),[a,i]=m.useState([]),l=m.useRef(new Set),c=m.useRef(t);c.current=t;const d=m.useMemo(()=>n?e.filter(f=>f.holdId&&f.holdExpiresAt):[],[e,n]);return m.useEffect(()=>{if(!n||d.length===0){s([]),i([]);return}const f=()=>{const g=Date.now(),h=120*1e3,x=[],p=[];for(const v of d){if(!v.holdExpiresAt)continue;const w=new Date(v.holdExpiresAt),y=w.getTime()-g,k=`${v.productId}::${v.variantId??""}`;y<=0?(x.push({productId:v.productId,variantId:v.variantId}),l.current.has(k)||(l.current.add(k),c.current?.({productId:v.productId,variantId:v.variantId,title:v.titleSnapshot,expiredAt:w}))):y<=h&&p.push({productId:v.productId,variantId:v.variantId,expiresAt:w,remainingMs:y})}s(x),i(p)};f();const u=setInterval(f,1e4);return()=>clearInterval(u)},[n,d]),m.useEffect(()=>{const f=new Set(d.map(u=>`${u.productId}::${u.variantId??""}`));for(const u of l.current)f.has(u)||l.current.delete(u)},[d]),{expiringItems:a,expiredItems:r}}const he={relatedProducts:{mode:"most_recent",maxItems:4,layout:{layout:"large",imageCrop:"center"}},catalog:{filters:{tags:!0,priceRange:!0,inStock:!0},sort:{featured:!0,priceAsc:!0,priceDesc:!0}},checkout:{promoCodes:!0},shopLayout:{layout:"large",imageCrop:"center"},categoryLayout:{layout:"large",imageCrop:"center"},sections:{showDescription:!0,showSpecs:!0,showShipping:!0,showRelatedProducts:!0},inventory:{preCheckoutVerification:!0,holdsEnabled:!1,holdDurationMinutes:15},shopPage:{title:"Shop",description:""}};function d0(e){return{relatedProducts:{mode:e.relatedProducts?.mode||he.relatedProducts.mode,maxItems:e.relatedProducts?.maxItems||he.relatedProducts.maxItems,layout:{layout:e.relatedProducts?.layout?.layout??he.relatedProducts.layout.layout,imageCrop:e.relatedProducts?.layout?.imageCrop??he.relatedProducts.layout.imageCrop}},catalog:{filters:{tags:e.catalog?.filters?.tags??he.catalog.filters.tags,priceRange:e.catalog?.filters?.priceRange??he.catalog.filters.priceRange,inStock:e.catalog?.filters?.inStock??he.catalog.filters.inStock},sort:{featured:e.catalog?.sort?.featured??he.catalog.sort.featured,priceAsc:e.catalog?.sort?.priceAsc??he.catalog.sort.priceAsc,priceDesc:e.catalog?.sort?.priceDesc??he.catalog.sort.priceDesc}},checkout:{promoCodes:e.checkout?.promoCodes??he.checkout.promoCodes},shopLayout:{layout:e.shopLayout?.layout??he.shopLayout.layout,imageCrop:e.shopLayout?.imageCrop??he.shopLayout.imageCrop},categoryLayout:{layout:e.categoryLayout?.layout??he.categoryLayout.layout,imageCrop:e.categoryLayout?.imageCrop??he.categoryLayout.imageCrop},sections:{showDescription:e.sections?.showDescription??he.sections.showDescription,showSpecs:e.sections?.showSpecs??he.sections.showSpecs,showShipping:e.sections?.showShipping??he.sections.showShipping,showRelatedProducts:e.sections?.showRelatedProducts??he.sections.showRelatedProducts},inventory:{preCheckoutVerification:e.inventory?.preCheckoutVerification??he.inventory.preCheckoutVerification,holdsEnabled:e.inventory?.holdsEnabled??he.inventory.holdsEnabled,holdDurationMinutes:e.inventory?.holdDurationMinutes??he.inventory.holdDurationMinutes},shopPage:{title:e.shopPage?.title??he.shopPage.title,description:e.shopPage?.description??he.shopPage.description}}}function Fn(e={}){const n=gs()?.config?.adapter,[r,s]=j.useState(he),[a,i]=j.useState(!!n?.getStorefrontSettings);return j.useEffect(()=>{if(!n?.getStorefrontSettings){i(!1);return}let l=!1;async function c(){try{const d=await n.getStorefrontSettings();!l&&d&&s(d0(d))}catch{}finally{l||i(!1)}}return c(),()=>{l=!0}},[n]),{settings:r,isLoading:a}}const u0={card:!0,crypto:!0,credits:!1};function Cc(){const t=gs()?.config?.adapter,[n,r]=j.useState(u0),[s,a]=j.useState(!!t?.getPaymentMethodsConfig);return j.useEffect(()=>{if(!t?.getPaymentMethodsConfig){a(!1);return}let i=!1;async function l(){try{const c=await t.getPaymentMethodsConfig();!i&&c&&r(c)}catch{}finally{i||a(!1)}}return l(),()=>{i=!0}},[t]),{config:n,isLoading:s}}const f0=50,Qn=new Map;function m0(e){return e.productId?`id:${e.productId}`:e.name?`name:${e.name}`:""}function _c(e={}){const{productId:t,product:n,enabled:r=!0}=e,a=gs()?.config?.adapter,[i,l]=j.useState(null),[c,d]=j.useState(null),[f,u]=j.useState(!1),[g,h]=j.useState(null),x=j.useRef(0),p=j.useCallback(async()=>{const v=t?{productId:t}:n?{name:n.name,description:n.description,tags:n.tags,categoryIds:n.categoryIds}:{};if(!v.productId&&!v.name)return;if(!a?.getAIRelatedProducts){h("AI recommendations not available");return}const w=m0(v),y=Qn.get(w);if(y){l(y.relatedProductIds),d(y.reasoning),h(null);return}const k=++x.current;u(!0),h(null);try{const b=await a.getAIRelatedProducts(v);if(k===x.current&&(l(b.relatedProductIds),d(b.reasoning),h(null),w)){if(Qn.size>=f0){const S=Qn.keys().next().value;S!==void 0&&Qn.delete(S)}Qn.set(w,b)}}catch(b){if(k===x.current){const S=b instanceof Error?b.message:"Failed to get AI recommendations";h(S),l(null),d(null)}}finally{k===x.current&&u(!1)}},[a,t,n]);return j.useEffect(()=>{r&&(!t&&!n?.name||p())},[r,t,n?.name,p]),{relatedProductIds:i,reasoning:c,isLoading:f,error:g,refetch:p}}function be(e,t){if(!e)throw new Error(t)}function bt(e){return typeof e=="string"&&e.trim().length>0}async function p0(e,t={}){const n=t.pageSize??10,r=await e.listCategories();be(Array.isArray(r),"listCategories() must return an array");for(const i of r)be(bt(i.id),"Category.id is required"),be(bt(i.slug),"Category.slug is required"),be(bt(i.name),"Category.name is required");const s=await e.listProducts({page:1,pageSize:n});if(be(s&&Array.isArray(s.items),"listProducts() must return { items: Product[] }"),be(typeof s.page=="number","listProducts().page must be a number"),be(typeof s.pageSize=="number","listProducts().pageSize must be a number"),s.items.length>0){const i=s.items[0];be(bt(i.id),"Product.id is required"),be(bt(i.slug),"Product.slug is required"),be(bt(i.title),"Product.title is required"),be(typeof i.description=="string","Product.description must be a string"),be(Array.isArray(i.images),"Product.images must be an array"),be(typeof i.price=="number","Product.price must be a number"),be(bt(i.currency),"Product.currency is required"),be(Array.isArray(i.tags),"Product.tags must be an array"),be(Array.isArray(i.categoryIds),"Product.categoryIds must be an array");const l=await e.getProductBySlug(i.slug);be(l===null||bt(l.id),"getProductBySlug() must return Product or null")}const a=await e.getOrderHistory();be(Array.isArray(a),"getOrderHistory() must return an array");for(const i of a)be(bt(i.id),"Order.id is required"),be(bt(i.createdAt),"Order.createdAt is required"),be(typeof i.total=="number","Order.total must be a number"),be(bt(i.currency),"Order.currency is required"),be(Array.isArray(i.items),"Order.items must be an array")}function Fi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Bn(...e){return t=>{let n=!1;const r=e.map(s=>{const a=Fi(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():Fi(e[s],null)}}}}function xe(...e){return m.useCallback(Bn(...e),e)}var h0=Symbol.for("react.lazy"),ns=m[" use ".trim().toString()];function g0(e){return typeof e=="object"&&e!==null&&"then"in e}function Ec(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===h0&&"_payload"in e&&g0(e._payload)}function Ac(e){const t=v0(e),n=m.forwardRef((r,s)=>{let{children:a,...i}=r;Ec(a)&&typeof ns=="function"&&(a=ns(a._payload));const l=m.Children.toArray(a),c=l.find(y0);if(c){const d=c.props.children,f=l.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return o.jsx(t,{...i,ref:s,children:m.isValidElement(d)?m.cloneElement(d,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}var x0=Ac("Slot");function v0(e){const t=m.forwardRef((n,r)=>{let{children:s,...a}=n;if(Ec(s)&&typeof ns=="function"&&(s=ns(s._payload)),m.isValidElement(s)){const i=k0(s),l=w0(a,s.props);return s.type!==m.Fragment&&(l.ref=r?Bn(r,i):i),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var b0=Symbol("radix.slottable");function y0(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===b0}function w0(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function k0(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ic(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Ic(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Tc(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Ic(e))&&(r&&(r+=" "),r+=t);return r}const Bi=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ui=Tc,fa=(e,t)=>n=>{var r;if(t?.variants==null)return Ui(e,n?.class,n?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(d=>{const f=n?.[d],u=a?.[d];if(f===null)return null;const g=Bi(f)||Bi(u);return s[d][g]}),l=n&&Object.entries(n).reduce((d,f)=>{let[u,g]=f;return g===void 0||(d[u]=g),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:g,...h}=f;return Object.entries(h).every(x=>{let[p,v]=x;return Array.isArray(v)?v.includes({...a,...l}[p]):{...a,...l}[p]===v})?[...d,u,g]:d},[]);return Ui(e,i,c,n?.class,n?.className)},S0=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},N0=(e,t)=>({classGroupId:e,validator:t}),Pc=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rs="-",Vi=[],j0="arbitrary..",C0=e=>{const t=E0(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return _0(i);const l=i.split(rs),c=l[0]===""&&l.length>1?1:0;return Rc(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],d=n[i];return c?d?S0(d,c):c:d||Vi}return n[i]||Vi}}},Rc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const d=Rc(e,t+1,a);if(d)return d}const i=n.validators;if(i===null)return;const l=t===0?e.join(rs):e.slice(t).join(rs),c=i.length;for(let d=0;d<c;d++){const f=i[d];if(f.validator(l))return f.classGroupId}},_0=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?j0+r:void 0})(),E0=e=>{const{theme:t,classGroups:n}=e;return A0(n,t)},A0=(e,t)=>{const n=Pc();for(const r in e){const s=e[r];ma(s,n,r,t)}return n},ma=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];I0(i,t,n,r)}},I0=(e,t,n,r)=>{if(typeof e=="string"){T0(e,t,n);return}if(typeof e=="function"){P0(e,t,n,r);return}R0(e,t,n,r)},T0=(e,t,n)=>{const r=e===""?t:Oc(t,e);r.classGroupId=n},P0=(e,t,n,r)=>{if(O0(e)){ma(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(N0(n,e))},R0=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];ma(c,Oc(t,l),n,r)}},Oc=(e,t)=>{let n=e;const r=t.split(rs),s=r.length;for(let a=0;a<s;a++){const i=r[a];let l=n.nextPart.get(i);l||(l=Pc(),n.nextPart.set(i,l)),n=l}return n},O0=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,M0=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,i)=>{n[a]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=r[a])!==void 0)return s(a,i),i},set(a,i){a in n?n[a]=i:s(a,i)}}},Ro="!",Hi=":",D0=[],Zi=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),z0=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let i=0,l=0,c=0,d;const f=s.length;for(let p=0;p<f;p++){const v=s[p];if(i===0&&l===0){if(v===Hi){a.push(s.slice(c,p)),c=p+1;continue}if(v==="/"){d=p;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const u=a.length===0?s:s.slice(c);let g=u,h=!1;u.endsWith(Ro)?(g=u.slice(0,-1),h=!0):u.startsWith(Ro)&&(g=u.slice(1),h=!0);const x=d&&d>c?d-c:void 0;return Zi(a,h,g,x)};if(t){const s=t+Hi,a=r;r=i=>i.startsWith(s)?a(i.slice(s.length)):Zi(D0,!1,i,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},L0=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const i=n[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},$0=e=>({cache:M0(e.cacheSize),parseClassName:z0(e),sortModifiers:L0(e),...C0(e)}),F0=/\s+/,B0=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(F0);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:u,modifiers:g,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:p}=n(f);if(u){c=f+(c.length>0?" "+c:c);continue}let v=!!p,w=r(v?x.substring(0,p):x);if(!w){if(!v){c=f+(c.length>0?" "+c:c);continue}if(w=r(x),!w){c=f+(c.length>0?" "+c:c);continue}v=!1}const y=g.length===0?"":g.length===1?g[0]:a(g).join(":"),k=h?y+Ro:y,b=k+w;if(i.indexOf(b)>-1)continue;i.push(b);const S=s(w,v);for(let A=0;A<S.length;++A){const I=S[A];i.push(k+I)}c=f+(c.length>0?" "+c:c)}return c},U0=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Mc(n))&&(s&&(s+=" "),s+=r);return s},Mc=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Mc(e[r]))&&(n&&(n+=" "),n+=t);return n},V0=(e,...t)=>{let n,r,s,a;const i=c=>{const d=t.reduce((f,u)=>u(f),e());return n=$0(d),r=n.cache.get,s=n.cache.set,a=l,l(c)},l=c=>{const d=r(c);if(d)return d;const f=B0(c,n);return s(c,f),f};return a=i,(...c)=>a(U0(...c))},H0=[],Pe=e=>{const t=n=>n[e]||H0;return t.isThemeGetter=!0,t},Dc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Z0=/^\d+\/\d+$/,W0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,q0=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,G0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Y0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,K0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,En=e=>Z0.test(e),ae=e=>!!e&&!Number.isNaN(Number(e)),qt=e=>!!e&&Number.isInteger(Number(e)),so=e=>e.endsWith("%")&&ae(e.slice(0,-1)),Ut=e=>W0.test(e),Q0=()=>!0,J0=e=>q0.test(e)&&!G0.test(e),Lc=()=>!1,X0=e=>Y0.test(e),ev=e=>K0.test(e),tv=e=>!W(e)&&!q(e),nv=e=>Un(e,Bc,Lc),W=e=>Dc.test(e),cn=e=>Un(e,Uc,J0),oo=e=>Un(e,iv,ae),Wi=e=>Un(e,$c,Lc),rv=e=>Un(e,Fc,ev),Tr=e=>Un(e,Vc,X0),q=e=>zc.test(e),Jn=e=>Vn(e,Uc),sv=e=>Vn(e,lv),qi=e=>Vn(e,$c),ov=e=>Vn(e,Bc),av=e=>Vn(e,Fc),Pr=e=>Vn(e,Vc,!0),Un=(e,t,n)=>{const r=Dc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Vn=(e,t,n=!1)=>{const r=zc.exec(e);return r?r[1]?t(r[1]):n:!1},$c=e=>e==="position"||e==="percentage",Fc=e=>e==="image"||e==="url",Bc=e=>e==="length"||e==="size"||e==="bg-size",Uc=e=>e==="length",iv=e=>e==="number",lv=e=>e==="family-name",Vc=e=>e==="shadow",cv=()=>{const e=Pe("color"),t=Pe("font"),n=Pe("text"),r=Pe("font-weight"),s=Pe("tracking"),a=Pe("leading"),i=Pe("breakpoint"),l=Pe("container"),c=Pe("spacing"),d=Pe("radius"),f=Pe("shadow"),u=Pe("inset-shadow"),g=Pe("text-shadow"),h=Pe("drop-shadow"),x=Pe("blur"),p=Pe("perspective"),v=Pe("aspect"),w=Pe("ease"),y=Pe("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...b(),q,W],A=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],E=()=>[q,W,c],Z=()=>[En,"full","auto",...E()],F=()=>[qt,"none","subgrid",q,W],$=()=>["auto",{span:["full",qt,q,W]},qt,q,W],D=()=>[qt,"auto",q,W],z=()=>["auto","min","max","fr",q,W],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...E()],V=()=>[En,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],T=()=>[e,q,W],te=()=>[...b(),qi,Wi,{position:[q,W]}],ne=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",ov,nv,{size:[q,W]}],je=()=>[so,Jn,cn],L=()=>["","none","full",d,q,W],K=()=>["",ae,Jn,cn],G=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>[ae,so,qi,Wi],B=()=>["","none",x,q,W],le=()=>["none",ae,q,W],O=()=>["none",ae,q,W],ee=()=>[ae,q,W],se=()=>[En,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ut],breakpoint:[Ut],color:[Q0],container:[Ut],"drop-shadow":[Ut],ease:["in","out","in-out"],font:[tv],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ut],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ut],shadow:[Ut],spacing:["px",ae],text:[Ut],"text-shadow":[Ut],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",En,W,q,v]}],container:["container"],columns:[{columns:[ae,W,q,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Z()}],"inset-x":[{"inset-x":Z()}],"inset-y":[{"inset-y":Z()}],start:[{start:Z()}],end:[{end:Z()}],top:[{top:Z()}],right:[{right:Z()}],bottom:[{bottom:Z()}],left:[{left:Z()}],visibility:["visible","invisible","collapse"],z:[{z:[qt,"auto",q,W]}],basis:[{basis:[En,"full","auto",l,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ae,En,"auto","initial","none",W]}],grow:[{grow:["",ae,q,W]}],shrink:[{shrink:["",ae,q,W]}],order:[{order:[qt,"first","last","none",q,W]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[l,"screen",...V()]}],"min-w":[{"min-w":[l,"screen","none",...V()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,Jn,cn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,q,oo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",so,W]}],"font-family":[{font:[sv,W,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,q,W]}],"line-clamp":[{"line-clamp":[ae,"none",q,oo]}],leading:[{leading:[a,...E()]}],"list-image":[{"list-image":["none",q,W]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",q,W]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[ae,"from-font","auto",q,cn]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[ae,"auto",q,W]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",q,W]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",q,W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qt,q,W],radial:["",q,W],conic:[qt,q,W]},av,rv]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:je()}],"gradient-via-pos":[{via:je()}],"gradient-to-pos":[{to:je()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ae,q,W]}],"outline-w":[{outline:["",ae,Jn,cn]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",f,Pr,Tr]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",u,Pr,Tr]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[ae,cn]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",g,Pr,Tr]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[ae,q,W]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":_()}],"mask-image-linear-to-pos":[{"mask-linear-to":_()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":_()}],"mask-image-t-to-pos":[{"mask-t-to":_()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":_()}],"mask-image-r-to-pos":[{"mask-r-to":_()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":_()}],"mask-image-b-to-pos":[{"mask-b-to":_()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":_()}],"mask-image-l-to-pos":[{"mask-l-to":_()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":_()}],"mask-image-x-to-pos":[{"mask-x-to":_()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":_()}],"mask-image-y-to-pos":[{"mask-y-to":_()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[q,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":_()}],"mask-image-radial-to-pos":[{"mask-radial-to":_()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":_()}],"mask-image-conic-to-pos":[{"mask-conic-to":_()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",q,W]}],filter:[{filter:["","none",q,W]}],blur:[{blur:B()}],brightness:[{brightness:[ae,q,W]}],contrast:[{contrast:[ae,q,W]}],"drop-shadow":[{"drop-shadow":["","none",h,Pr,Tr]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",ae,q,W]}],"hue-rotate":[{"hue-rotate":[ae,q,W]}],invert:[{invert:["",ae,q,W]}],saturate:[{saturate:[ae,q,W]}],sepia:[{sepia:["",ae,q,W]}],"backdrop-filter":[{"backdrop-filter":["","none",q,W]}],"backdrop-blur":[{"backdrop-blur":B()}],"backdrop-brightness":[{"backdrop-brightness":[ae,q,W]}],"backdrop-contrast":[{"backdrop-contrast":[ae,q,W]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ae,q,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ae,q,W]}],"backdrop-invert":[{"backdrop-invert":["",ae,q,W]}],"backdrop-opacity":[{"backdrop-opacity":[ae,q,W]}],"backdrop-saturate":[{"backdrop-saturate":[ae,q,W]}],"backdrop-sepia":[{"backdrop-sepia":["",ae,q,W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",q,W]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ae,"initial",q,W]}],ease:[{ease:["linear","initial",w,q,W]}],delay:[{delay:[ae,q,W]}],animate:[{animate:["none",y,q,W]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,q,W]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:O()}],"scale-x":[{"scale-x":O()}],"scale-y":[{"scale-y":O()}],"scale-z":[{"scale-z":O()}],"scale-3d":["scale-3d"],skew:[{skew:ee()}],"skew-x":[{"skew-x":ee()}],"skew-y":[{"skew-y":ee()}],transform:[{transform:[q,W,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",q,W]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",q,W]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[ae,Jn,cn,oo]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dv=V0(cv);function C(...e){return dv(Tc(e))}const uv=fa("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-900/20 disabled:pointer-events-none disabled:opacity-50 dark:focus-visible:ring-neutral-50/20",{variants:{variant:{default:"bg-neutral-900 text-neutral-50 hover:bg-neutral-900/90 dark:bg-neutral-50 dark:text-neutral-900 dark:hover:bg-neutral-50/90",secondary:"bg-neutral-100 text-neutral-900 hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80",outline:"border border-neutral-200 bg-transparent text-neutral-900 hover:bg-neutral-100 dark:border-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800",ghost:"bg-transparent text-neutral-900 hover:bg-neutral-100 dark:text-neutral-50 dark:hover:bg-neutral-800",destructive:"bg-red-600 text-neutral-50 hover:bg-red-600/90 dark:bg-red-500 dark:hover:bg-red-500/90",link:"bg-transparent text-neutral-900 underline-offset-4 hover:underline dark:text-neutral-50"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-6",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),H=m.forwardRef(({className:e,variant:t,size:n,asChild:r,...s},a)=>{const i=r?x0:"button";return o.jsx(i,{className:C(uv({variant:t,size:n}),e),ref:a,...s})});H.displayName="Button";const fv=fa("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors",{variants:{variant:{default:"border-transparent bg-neutral-900 text-neutral-50 dark:bg-neutral-50 dark:text-neutral-900",secondary:"border-transparent bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-50",outline:"border-neutral-200 text-neutral-900 dark:border-neutral-800 dark:text-neutral-50"}},defaultVariants:{variant:"secondary"}});function dt({className:e,variant:t,...n}){return o.jsx("div",{className:C(fv({variant:t}),e),...n})}const Ve=m.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:C("rounded-xl border border-neutral-200 bg-white text-neutral-950 shadow-sm dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",e),...t}));Ve.displayName="Card";const fr=m.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:C("flex flex-col space-y-1.5 p-6",e),...t}));fr.displayName="CardHeader";const mr=m.forwardRef(({className:e,...t},n)=>o.jsx("h3",{ref:n,className:C("text-lg font-semibold leading-none tracking-tight",e),...t}));mr.displayName="CardTitle";const Hc=m.forwardRef(({className:e,...t},n)=>o.jsx("p",{ref:n,className:C("text-sm text-neutral-500 dark:text-neutral-400",e),...t}));Hc.displayName="CardDescription";const Ye=m.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:C("p-6 pt-0",e),...t}));Ye.displayName="CardContent";const Zc=m.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:C("flex items-center p-6 pt-0",e),...t}));Zc.displayName="CardFooter";const ke=m.forwardRef(({className:e,...t},n)=>o.jsx("input",{ref:n,className:C("flex h-10 w-full rounded-md border border-neutral-200 bg-white px-3 py-2 text-sm text-neutral-950 shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-900/20 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50 dark:placeholder:text-neutral-400 dark:focus-visible:ring-neutral-50/20",e),...t}));ke.displayName="Input";const De=m.forwardRef(({className:e,...t},n)=>o.jsx("label",{ref:n,className:C("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));De.displayName="Label";var mv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pv=mv.reduce((e,t)=>{const n=Ac(`Primitive.${t}`),r=m.forwardRef((s,a)=>{const{asChild:i,...l}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),hv="Separator",Gi="horizontal",gv=["horizontal","vertical"],Wc=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=Gi,...s}=e,a=xv(r)?r:Gi,l=n?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return o.jsx(pv.div,{"data-orientation":a,...l,...s,ref:t})});Wc.displayName=hv;function xv(e){return gv.includes(e)}var qc=Wc;const rt=m.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>o.jsx(qc,{ref:s,decorative:n,orientation:t,className:C("shrink-0 bg-neutral-200 dark:bg-neutral-800",t==="horizontal"?"h-px w-full":"h-full w-px",e),...r}));rt.displayName=qc.displayName;function Ce({className:e,...t}){return o.jsx("div",{className:C("animate-pulse rounded-md bg-neutral-100 dark:bg-neutral-800",e),...t})}function Yi(e,[t,n]){return Math.min(n,Math.max(t,e))}function ue(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function vv(e,t){const n=m.createContext(t),r=a=>{const{children:i,...l}=a,c=m.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function s(a){const i=m.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,s]}function tn(e,t=[]){let n=[];function r(a,i){const l=m.createContext(i),c=n.length;n=[...n,i];const d=u=>{const{scope:g,children:h,...x}=u,p=g?.[e]?.[c]||l,v=m.useMemo(()=>x,Object.values(x));return o.jsx(p.Provider,{value:v,children:h})};d.displayName=a+"Provider";function f(u,g){const h=g?.[e]?.[c]||l,x=m.useContext(h);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${u}\` must be used within \`${a}\``)}return[d,f]}const s=()=>{const a=n.map(i=>m.createContext(i));return function(l){const c=l?.[e]||a;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,bv(s,...t)]}function bv(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const u=c(a)[`__scope${d}`];return{...l,...u}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ki(e){const t=yv(e),n=m.forwardRef((r,s)=>{const{children:a,...i}=r,l=m.Children.toArray(a),c=l.find(kv);if(c){const d=c.props.children,f=l.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return o.jsx(t,{...i,ref:s,children:m.isValidElement(d)?m.cloneElement(d,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function yv(e){const t=m.forwardRef((n,r)=>{const{children:s,...a}=n;if(m.isValidElement(s)){const i=Nv(s),l=Sv(a,s.props);return s.type!==m.Fragment&&(l.ref=r?Bn(r,i):i),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wv=Symbol("radix.slottable");function kv(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wv}function Sv(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function Nv(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pa(e){const t=e+"CollectionProvider",[n,r]=tn(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:v,children:w}=p,y=j.useRef(null),k=j.useRef(new Map).current;return o.jsx(s,{scope:v,itemMap:k,collectionRef:y,children:w})};i.displayName=t;const l=e+"CollectionSlot",c=Ki(l),d=j.forwardRef((p,v)=>{const{scope:w,children:y}=p,k=a(l,w),b=xe(v,k.collectionRef);return o.jsx(c,{ref:b,children:y})});d.displayName=l;const f=e+"CollectionItemSlot",u="data-radix-collection-item",g=Ki(f),h=j.forwardRef((p,v)=>{const{scope:w,children:y,...k}=p,b=j.useRef(null),S=xe(v,b),A=a(f,w);return j.useEffect(()=>(A.itemMap.set(b,{ref:b,...k}),()=>void A.itemMap.delete(b))),o.jsx(g,{[u]:"",ref:S,children:y})});h.displayName=f;function x(p){const v=a(e+"CollectionConsumer",p);return j.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const k=Array.from(y.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((A,I)=>k.indexOf(A.ref.current)-k.indexOf(I.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:h},x,r]}var jv=m.createContext(void 0);function ws(e){const t=m.useContext(jv);return e||t||"ltr"}function Cv(e){const t=_v(e),n=m.forwardRef((r,s)=>{const{children:a,...i}=r,l=m.Children.toArray(a),c=l.find(Av);if(c){const d=c.props.children,f=l.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return o.jsx(t,{...i,ref:s,children:m.isValidElement(d)?m.cloneElement(d,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function _v(e){const t=m.forwardRef((n,r)=>{const{children:s,...a}=n;if(m.isValidElement(s)){const i=Tv(s),l=Iv(a,s.props);return s.type!==m.Fragment&&(l.ref=r?Bn(r,i):i),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ev=Symbol("radix.slottable");function Av(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ev}function Iv(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function Tv(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Pv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ce=Pv.reduce((e,t)=>{const n=Cv(`Primitive.${t}`),r=m.forwardRef((s,a)=>{const{asChild:i,...l}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rv(e,t){e&&hs.flushSync(()=>e.dispatchEvent(t))}function Yt(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function Ov(e,t=globalThis?.document){const n=Yt(e);m.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Mv="DismissableLayer",Oo="dismissableLayer.update",Dv="dismissableLayer.pointerDownOutside",zv="dismissableLayer.focusOutside",Qi,Gc=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ha=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:i,onDismiss:l,...c}=e,d=m.useContext(Gc),[f,u]=m.useState(null),g=f?.ownerDocument??globalThis?.document,[,h]=m.useState({}),x=xe(t,I=>u(I)),p=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=p.indexOf(v),y=f?p.indexOf(f):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,b=y>=w,S=Fv(I=>{const E=I.target,Z=[...d.branches].some(F=>F.contains(E));!b||Z||(s?.(I),i?.(I),I.defaultPrevented||l?.())},g),A=Bv(I=>{const E=I.target;[...d.branches].some(F=>F.contains(E))||(a?.(I),i?.(I),I.defaultPrevented||l?.())},g);return Ov(I=>{y===d.layers.size-1&&(r?.(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))},g),m.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Qi=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Ji(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Qi)}},[f,g,n,d]),m.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Ji())},[f,d]),m.useEffect(()=>{const I=()=>h({});return document.addEventListener(Oo,I),()=>document.removeEventListener(Oo,I)},[]),o.jsx(ce.div,{...c,ref:x,style:{pointerEvents:k?b?"auto":"none":void 0,...e.style},onFocusCapture:ue(e.onFocusCapture,A.onFocusCapture),onBlurCapture:ue(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:ue(e.onPointerDownCapture,S.onPointerDownCapture)})});ha.displayName=Mv;var Lv="DismissableLayerBranch",$v=m.forwardRef((e,t)=>{const n=m.useContext(Gc),r=m.useRef(null),s=xe(t,r);return m.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),o.jsx(ce.div,{...e,ref:s})});$v.displayName=Lv;function Fv(e,t=globalThis?.document){const n=Yt(e),r=m.useRef(!1),s=m.useRef(()=>{});return m.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){Yc(Dv,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Bv(e,t=globalThis?.document){const n=Yt(e),r=m.useRef(!1);return m.useEffect(()=>{const s=a=>{a.target&&!r.current&&Yc(zv,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ji(){const e=new CustomEvent(Oo);document.dispatchEvent(e)}function Yc(e,t,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Rv(s,a):s.dispatchEvent(a)}var ao=0;function Kc(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Xi()),document.body.insertAdjacentElement("beforeend",e[1]??Xi()),ao++,()=>{ao===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ao--}},[])}function Xi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var io="focusScope.autoFocusOnMount",lo="focusScope.autoFocusOnUnmount",el={bubbles:!1,cancelable:!0},Uv="FocusScope",ga=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...i}=e,[l,c]=m.useState(null),d=Yt(s),f=Yt(a),u=m.useRef(null),g=xe(t,p=>c(p)),h=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let p=function(k){if(h.paused||!l)return;const b=k.target;l.contains(b)?u.current=b:Gt(u.current,{select:!0})},v=function(k){if(h.paused||!l)return;const b=k.relatedTarget;b!==null&&(l.contains(b)||Gt(u.current,{select:!0}))},w=function(k){if(document.activeElement===document.body)for(const S of k)S.removedNodes.length>0&&Gt(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const y=new MutationObserver(w);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),y.disconnect()}}},[r,l,h.paused]),m.useEffect(()=>{if(l){nl.add(h);const p=document.activeElement;if(!l.contains(p)){const w=new CustomEvent(io,el);l.addEventListener(io,d),l.dispatchEvent(w),w.defaultPrevented||(Vv(Gv(Qc(l)),{select:!0}),document.activeElement===p&&Gt(l))}return()=>{l.removeEventListener(io,d),setTimeout(()=>{const w=new CustomEvent(lo,el);l.addEventListener(lo,f),l.dispatchEvent(w),w.defaultPrevented||Gt(p??document.body,{select:!0}),l.removeEventListener(lo,f),nl.remove(h)},0)}}},[l,d,f,h]);const x=m.useCallback(p=>{if(!n&&!r||h.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,w=document.activeElement;if(v&&w){const y=p.currentTarget,[k,b]=Hv(y);k&&b?!p.shiftKey&&w===b?(p.preventDefault(),n&&Gt(k,{select:!0})):p.shiftKey&&w===k&&(p.preventDefault(),n&&Gt(b,{select:!0})):w===y&&p.preventDefault()}},[n,r,h.paused]);return o.jsx(ce.div,{tabIndex:-1,...i,ref:g,onKeyDown:x})});ga.displayName=Uv;function Vv(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Gt(r,{select:t}),document.activeElement!==n)return}function Hv(e){const t=Qc(e),n=tl(t,e),r=tl(t.reverse(),e);return[n,r]}function Qc(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function tl(e,t){for(const n of e)if(!Zv(n,{upTo:t}))return n}function Zv(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Wv(e){return e instanceof HTMLInputElement&&"select"in e}function Gt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Wv(e)&&t&&e.select()}}var nl=qv();function qv(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=rl(e,t),e.unshift(t)},remove(t){e=rl(e,t),e[0]?.resume()}}}function rl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Gv(e){return e.filter(t=>t.tagName!=="A")}var Le=globalThis?.document?m.useLayoutEffect:()=>{},Yv=m[" useId ".trim().toString()]||(()=>{}),Kv=0;function Tt(e){const[t,n]=m.useState(Yv());return Le(()=>{n(r=>r??String(Kv++))},[e]),e||(t?`radix-${t}`:"")}const Qv=["top","right","bottom","left"],Kt=Math.min,ct=Math.max,ss=Math.round,Rr=Math.floor,Pt=e=>({x:e,y:e}),Jv={left:"right",right:"left",bottom:"top",top:"bottom"},Xv={start:"end",end:"start"};function Mo(e,t,n){return ct(e,Kt(t,n))}function Vt(e,t){return typeof e=="function"?e(t):e}function Ht(e){return e.split("-")[0]}function Hn(e){return e.split("-")[1]}function xa(e){return e==="x"?"y":"x"}function va(e){return e==="y"?"height":"width"}const eb=new Set(["top","bottom"]);function It(e){return eb.has(Ht(e))?"y":"x"}function ba(e){return xa(It(e))}function tb(e,t,n){n===void 0&&(n=!1);const r=Hn(e),s=ba(e),a=va(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=os(i)),[i,os(i)]}function nb(e){const t=os(e);return[Do(e),t,Do(t)]}function Do(e){return e.replace(/start|end/g,t=>Xv[t])}const sl=["left","right"],ol=["right","left"],rb=["top","bottom"],sb=["bottom","top"];function ob(e,t,n){switch(e){case"top":case"bottom":return n?t?ol:sl:t?sl:ol;case"left":case"right":return t?rb:sb;default:return[]}}function ab(e,t,n,r){const s=Hn(e);let a=ob(Ht(e),n==="start",r);return s&&(a=a.map(i=>i+"-"+s),t&&(a=a.concat(a.map(Do)))),a}function os(e){return e.replace(/left|right|bottom|top/g,t=>Jv[t])}function ib(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jc(e){return typeof e!="number"?ib(e):{top:e,right:e,bottom:e,left:e}}function as(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function al(e,t,n){let{reference:r,floating:s}=e;const a=It(t),i=ba(t),l=va(i),c=Ht(t),d=a==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,g=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:f,y:r.y-s.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-s.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Hn(t)){case"start":h[i]-=g*(n&&d?-1:1);break;case"end":h[i]+=g*(n&&d?-1:1);break}return h}const lb=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:i}=n,l=a.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=al(d,r,c),g=r,h={},x=0;for(let p=0;p<l.length;p++){const{name:v,fn:w}=l[p],{x:y,y:k,data:b,reset:S}=await w({x:f,y:u,initialPlacement:r,placement:g,strategy:s,middlewareData:h,rects:d,platform:i,elements:{reference:e,floating:t}});f=y??f,u=k??u,h={...h,[v]:{...h[v],...b}},S&&x<=50&&(x++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:f,y:u}=al(d,g,c)),p=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:h}};async function pr(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:a,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=Vt(t,e),x=Jc(h),v=l[g?u==="floating"?"reference":"floating":u],w=as(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(v)))==null||n?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),y=u==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),b=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},S=as(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:k,strategy:c}):y);return{top:(w.top-S.top+x.top)/b.y,bottom:(S.bottom-w.bottom+x.bottom)/b.y,left:(w.left-S.left+x.left)/b.x,right:(S.right-w.right+x.right)/b.x}}const cb=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:a,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Vt(e,t)||{};if(d==null)return{};const u=Jc(f),g={x:n,y:r},h=ba(s),x=va(h),p=await i.getDimensions(d),v=h==="y",w=v?"top":"left",y=v?"bottom":"right",k=v?"clientHeight":"clientWidth",b=a.reference[x]+a.reference[h]-g[h]-a.floating[x],S=g[h]-a.reference[h],A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let I=A?A[k]:0;(!I||!await(i.isElement==null?void 0:i.isElement(A)))&&(I=l.floating[k]||a.floating[x]);const E=b/2-S/2,Z=I/2-p[x]/2-1,F=Kt(u[w],Z),$=Kt(u[y],Z),D=F,z=I-p[x]-$,U=I/2-p[x]/2+E,X=Mo(D,U,z),R=!c.arrow&&Hn(s)!=null&&U!==X&&a.reference[x]/2-(U<D?F:$)-p[x]/2<0,V=R?U<D?U-D:U-z:0;return{[h]:g[h]+V,data:{[h]:X,centerOffset:U-X-V,...R&&{alignmentOffset:V}},reset:R}}}),db=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:a,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:p=!0,...v}=Vt(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const w=Ht(s),y=It(l),k=Ht(l)===l,b=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=g||(k||!p?[os(l)]:nb(l)),A=x!=="none";!g&&A&&S.push(...ab(l,p,x,b));const I=[l,...S],E=await pr(t,v),Z=[];let F=((r=a.flip)==null?void 0:r.overflows)||[];if(f&&Z.push(E[w]),u){const U=tb(s,i,b);Z.push(E[U[0]],E[U[1]])}if(F=[...F,{placement:s,overflows:Z}],!Z.every(U=>U<=0)){var $,D;const U=((($=a.flip)==null?void 0:$.index)||0)+1,X=I[U];if(X&&(!(u==="alignment"?y!==It(X):!1)||F.every(T=>It(T.placement)===y?T.overflows[0]>0:!0)))return{data:{index:U,overflows:F},reset:{placement:X}};let R=(D=F.filter(V=>V.overflows[0]<=0).sort((V,T)=>V.overflows[1]-T.overflows[1])[0])==null?void 0:D.placement;if(!R)switch(h){case"bestFit":{var z;const V=(z=F.filter(T=>{if(A){const te=It(T.placement);return te===y||te==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(te=>te>0).reduce((te,ne)=>te+ne,0)]).sort((T,te)=>T[1]-te[1])[0])==null?void 0:z[0];V&&(R=V);break}case"initialPlacement":R=l;break}if(s!==R)return{reset:{placement:R}}}return{}}}};function il(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ll(e){return Qv.some(t=>e[t]>=0)}const ub=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Vt(e,t);switch(r){case"referenceHidden":{const a=await pr(t,{...s,elementContext:"reference"}),i=il(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ll(i)}}}case"escaped":{const a=await pr(t,{...s,altBoundary:!0}),i=il(a,n.floating);return{data:{escapedOffsets:i,escaped:ll(i)}}}default:return{}}}}},Xc=new Set(["left","top"]);async function fb(e,t){const{placement:n,platform:r,elements:s}=e,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Ht(n),l=Hn(n),c=It(n)==="y",d=Xc.has(i)?-1:1,f=a&&c?-1:1,u=Vt(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof x=="number"&&(h=l==="end"?x*-1:x),c?{x:h*f,y:g*d}:{x:g*d,y:h*f}}const mb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:a,placement:i,middlewareData:l}=t,c=await fb(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:{...c,placement:i}}}}},pb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:l={fn:v=>{let{x:w,y}=v;return{x:w,y}}},...c}=Vt(e,t),d={x:n,y:r},f=await pr(t,c),u=It(Ht(s)),g=xa(u);let h=d[g],x=d[u];if(a){const v=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=h+f[v],k=h-f[w];h=Mo(y,h,k)}if(i){const v=u==="y"?"top":"left",w=u==="y"?"bottom":"right",y=x+f[v],k=x-f[w];x=Mo(y,x,k)}const p=l.fn({...t,[g]:h,[u]:x});return{...p,data:{x:p.x-n,y:p.y-r,enabled:{[g]:a,[u]:i}}}}}},hb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:a,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Vt(e,t),f={x:n,y:r},u=It(s),g=xa(u);let h=f[g],x=f[u];const p=Vt(l,t),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const k=g==="y"?"height":"width",b=a.reference[g]-a.floating[k]+v.mainAxis,S=a.reference[g]+a.reference[k]-v.mainAxis;h<b?h=b:h>S&&(h=S)}if(d){var w,y;const k=g==="y"?"width":"height",b=Xc.has(Ht(s)),S=a.reference[u]-a.floating[k]+(b&&((w=i.offset)==null?void 0:w[u])||0)+(b?0:v.crossAxis),A=a.reference[u]+a.reference[k]+(b?0:((y=i.offset)==null?void 0:y[u])||0)-(b?v.crossAxis:0);x<S?x=S:x>A&&(x=A)}return{[g]:h,[u]:x}}}},gb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:a,platform:i,elements:l}=t,{apply:c=()=>{},...d}=Vt(e,t),f=await pr(t,d),u=Ht(s),g=Hn(s),h=It(s)==="y",{width:x,height:p}=a.floating;let v,w;u==="top"||u==="bottom"?(v=u,w=g===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(w=u,v=g==="end"?"top":"bottom");const y=p-f.top-f.bottom,k=x-f.left-f.right,b=Kt(p-f[v],y),S=Kt(x-f[w],k),A=!t.middlewareData.shift;let I=b,E=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(I=y),A&&!g){const F=ct(f.left,0),$=ct(f.right,0),D=ct(f.top,0),z=ct(f.bottom,0);h?E=x-2*(F!==0||$!==0?F+$:ct(f.left,f.right)):I=p-2*(D!==0||z!==0?D+z:ct(f.top,f.bottom))}await c({...t,availableWidth:E,availableHeight:I});const Z=await i.getDimensions(l.floating);return x!==Z.width||p!==Z.height?{reset:{rects:!0}}:{}}}};function ks(){return typeof window<"u"}function Zn(e){return ed(e)?(e.nodeName||"").toLowerCase():"#document"}function ut(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mt(e){var t;return(t=(ed(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ed(e){return ks()?e instanceof Node||e instanceof ut(e).Node:!1}function wt(e){return ks()?e instanceof Element||e instanceof ut(e).Element:!1}function Ot(e){return ks()?e instanceof HTMLElement||e instanceof ut(e).HTMLElement:!1}function cl(e){return!ks()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ut(e).ShadowRoot}const xb=new Set(["inline","contents"]);function kr(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=kt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!xb.has(s)}const vb=new Set(["table","td","th"]);function bb(e){return vb.has(Zn(e))}const yb=[":popover-open",":modal"];function Ss(e){return yb.some(t=>{try{return e.matches(t)}catch{return!1}})}const wb=["transform","translate","scale","rotate","perspective"],kb=["transform","translate","scale","rotate","perspective","filter"],Sb=["paint","layout","strict","content"];function ya(e){const t=wa(),n=wt(e)?kt(e):e;return wb.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||kb.some(r=>(n.willChange||"").includes(r))||Sb.some(r=>(n.contain||"").includes(r))}function Nb(e){let t=Qt(e);for(;Ot(t)&&!zn(t);){if(ya(t))return t;if(Ss(t))return null;t=Qt(t)}return null}function wa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const jb=new Set(["html","body","#document"]);function zn(e){return jb.has(Zn(e))}function kt(e){return ut(e).getComputedStyle(e)}function Ns(e){return wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qt(e){if(Zn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||cl(e)&&e.host||Mt(e);return cl(t)?t.host:t}function td(e){const t=Qt(e);return zn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ot(t)&&kr(t)?t:td(t)}function hr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=td(e),a=s===((r=e.ownerDocument)==null?void 0:r.body),i=ut(s);if(a){const l=zo(i);return t.concat(i,i.visualViewport||[],kr(s)?s:[],l&&n?hr(l):[])}return t.concat(s,hr(s,[],n))}function zo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nd(e){const t=kt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ot(e),a=s?e.offsetWidth:n,i=s?e.offsetHeight:r,l=ss(n)!==a||ss(r)!==i;return l&&(n=a,r=i),{width:n,height:r,$:l}}function ka(e){return wt(e)?e:e.contextElement}function On(e){const t=ka(e);if(!Ot(t))return Pt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:a}=nd(t);let i=(a?ss(n.width):n.width)/r,l=(a?ss(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Cb=Pt(0);function rd(e){const t=ut(e);return!wa()||!t.visualViewport?Cb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _b(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ut(e)?!1:t}function fn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=ka(e);let i=Pt(1);t&&(r?wt(r)&&(i=On(r)):i=On(e));const l=_b(a,n,r)?rd(a):Pt(0);let c=(s.left+l.x)/i.x,d=(s.top+l.y)/i.y,f=s.width/i.x,u=s.height/i.y;if(a){const g=ut(a),h=r&&wt(r)?ut(r):r;let x=g,p=zo(x);for(;p&&r&&h!==x;){const v=On(p),w=p.getBoundingClientRect(),y=kt(p),k=w.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,b=w.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,u*=v.y,c+=k,d+=b,x=ut(p),p=zo(x)}}return as({width:f,height:u,x:c,y:d})}function js(e,t){const n=Ns(e).scrollLeft;return t?t.left+n:fn(Mt(e)).left+n}function sd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-js(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Eb(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const a=s==="fixed",i=Mt(r),l=t?Ss(t.floating):!1;if(r===i||l&&a)return n;let c={scrollLeft:0,scrollTop:0},d=Pt(1);const f=Pt(0),u=Ot(r);if((u||!u&&!a)&&((Zn(r)!=="body"||kr(i))&&(c=Ns(r)),Ot(r))){const h=fn(r);d=On(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const g=i&&!u&&!a?sd(i,c):Pt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-c.scrollTop*d.y+f.y+g.y}}function Ab(e){return Array.from(e.getClientRects())}function Ib(e){const t=Mt(e),n=Ns(e),r=e.ownerDocument.body,s=ct(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ct(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+js(e);const l=-n.scrollTop;return kt(r).direction==="rtl"&&(i+=ct(t.clientWidth,r.clientWidth)-s),{width:s,height:a,x:i,y:l}}const dl=25;function Tb(e,t){const n=ut(e),r=Mt(e),s=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,l=0,c=0;if(s){a=s.width,i=s.height;const f=wa();(!f||f&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=js(r);if(d<=0){const f=r.ownerDocument,u=f.body,g=getComputedStyle(u),h=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(r.clientWidth-u.clientWidth-h);x<=dl&&(a-=x)}else d<=dl&&(a+=d);return{width:a,height:i,x:l,y:c}}const Pb=new Set(["absolute","fixed"]);function Rb(e,t){const n=fn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,a=Ot(e)?On(e):Pt(1),i=e.clientWidth*a.x,l=e.clientHeight*a.y,c=s*a.x,d=r*a.y;return{width:i,height:l,x:c,y:d}}function ul(e,t,n){let r;if(t==="viewport")r=Tb(e,n);else if(t==="document")r=Ib(Mt(e));else if(wt(t))r=Rb(t,n);else{const s=rd(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return as(r)}function od(e,t){const n=Qt(e);return n===t||!wt(n)||zn(n)?!1:kt(n).position==="fixed"||od(n,t)}function Ob(e,t){const n=t.get(e);if(n)return n;let r=hr(e,[],!1).filter(l=>wt(l)&&Zn(l)!=="body"),s=null;const a=kt(e).position==="fixed";let i=a?Qt(e):e;for(;wt(i)&&!zn(i);){const l=kt(i),c=ya(i);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&Pb.has(s.position)||kr(i)&&!c&&od(e,i))?r=r.filter(f=>f!==i):s=l,i=Qt(i)}return t.set(e,r),r}function Mb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Ss(t)?[]:Ob(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((d,f)=>{const u=ul(t,f,s);return d.top=ct(u.top,d.top),d.right=Kt(u.right,d.right),d.bottom=Kt(u.bottom,d.bottom),d.left=ct(u.left,d.left),d},ul(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Db(e){const{width:t,height:n}=nd(e);return{width:t,height:n}}function zb(e,t,n){const r=Ot(t),s=Mt(t),a=n==="fixed",i=fn(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=Pt(0);function d(){c.x=js(s)}if(r||!r&&!a)if((Zn(t)!=="body"||kr(s))&&(l=Ns(t)),r){const h=fn(t,!0,a,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&d();a&&!r&&s&&d();const f=s&&!r&&!a?sd(s,l):Pt(0),u=i.left+l.scrollLeft-c.x-f.x,g=i.top+l.scrollTop-c.y-f.y;return{x:u,y:g,width:i.width,height:i.height}}function co(e){return kt(e).position==="static"}function fl(e,t){if(!Ot(e)||kt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Mt(e)===n&&(n=n.ownerDocument.body),n}function ad(e,t){const n=ut(e);if(Ss(e))return n;if(!Ot(e)){let s=Qt(e);for(;s&&!zn(s);){if(wt(s)&&!co(s))return s;s=Qt(s)}return n}let r=fl(e,t);for(;r&&bb(r)&&co(r);)r=fl(r,t);return r&&zn(r)&&co(r)&&!ya(r)?n:r||Nb(e)||n}const Lb=async function(e){const t=this.getOffsetParent||ad,n=this.getDimensions,r=await n(e.floating);return{reference:zb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $b(e){return kt(e).direction==="rtl"}const Fb={convertOffsetParentRelativeRectToViewportRelativeRect:Eb,getDocumentElement:Mt,getClippingRect:Mb,getOffsetParent:ad,getElementRects:Lb,getClientRects:Ab,getDimensions:Db,getScale:On,isElement:wt,isRTL:$b};function id(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bb(e,t){let n=null,r;const s=Mt(e);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const d=e.getBoundingClientRect(),{left:f,top:u,width:g,height:h}=d;if(l||t(),!g||!h)return;const x=Rr(u),p=Rr(s.clientWidth-(f+g)),v=Rr(s.clientHeight-(u+h)),w=Rr(f),k={rootMargin:-x+"px "+-p+"px "+-v+"px "+-w+"px",threshold:ct(0,Kt(1,c))||1};let b=!0;function S(A){const I=A[0].intersectionRatio;if(I!==c){if(!b)return i();I?i(!1,I):r=setTimeout(()=>{i(!1,1e-7)},1e3)}I===1&&!id(d,e.getBoundingClientRect())&&i(),b=!1}try{n=new IntersectionObserver(S,{...k,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,k)}n.observe(e)}return i(!0),a}function Ub(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=ka(e),f=s||a?[...d?hr(d):[],...hr(t)]:[];f.forEach(w=>{s&&w.addEventListener("scroll",n,{passive:!0}),a&&w.addEventListener("resize",n)});const u=d&&l?Bb(d,n):null;let g=-1,h=null;i&&(h=new ResizeObserver(w=>{let[y]=w;y&&y.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),d&&!c&&h.observe(d),h.observe(t));let x,p=c?fn(e):null;c&&v();function v(){const w=fn(e);p&&!id(p,w)&&n(),p=w,x=requestAnimationFrame(v)}return n(),()=>{var w;f.forEach(y=>{s&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),u?.(),(w=h)==null||w.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const Vb=mb,Hb=pb,Zb=db,Wb=gb,qb=ub,ml=cb,Gb=hb,Yb=(e,t,n)=>{const r=new Map,s={platform:Fb,...n},a={...s.platform,_c:r};return lb(e,t,{...s,platform:a})};var Kb=typeof document<"u",Qb=function(){},Wr=Kb?j.useLayoutEffect:Qb;function is(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!is(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&e.$$typeof)&&!is(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function ld(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pl(e,t){const n=ld(e);return Math.round(t*n)/n}function uo(e){const t=m.useRef(e);return Wr(()=>{t.current=e}),t}function Jb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,h]=m.useState(r);is(g,r)||h(r);const[x,p]=m.useState(null),[v,w]=m.useState(null),y=m.useCallback(T=>{T!==A.current&&(A.current=T,p(T))},[]),k=m.useCallback(T=>{T!==I.current&&(I.current=T,w(T))},[]),b=a||x,S=i||v,A=m.useRef(null),I=m.useRef(null),E=m.useRef(f),Z=c!=null,F=uo(c),$=uo(s),D=uo(d),z=m.useCallback(()=>{if(!A.current||!I.current)return;const T={placement:t,strategy:n,middleware:g};$.current&&(T.platform=$.current),Yb(A.current,I.current,T).then(te=>{const ne={...te,isPositioned:D.current!==!1};U.current&&!is(E.current,ne)&&(E.current=ne,hs.flushSync(()=>{u(ne)}))})},[g,t,n,$,D]);Wr(()=>{d===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,u(T=>({...T,isPositioned:!1})))},[d]);const U=m.useRef(!1);Wr(()=>(U.current=!0,()=>{U.current=!1}),[]),Wr(()=>{if(b&&(A.current=b),S&&(I.current=S),b&&S){if(F.current)return F.current(b,S,z);z()}},[b,S,z,F,Z]);const X=m.useMemo(()=>({reference:A,floating:I,setReference:y,setFloating:k}),[y,k]),R=m.useMemo(()=>({reference:b,floating:S}),[b,S]),V=m.useMemo(()=>{const T={position:n,left:0,top:0};if(!R.floating)return T;const te=pl(R.floating,f.x),ne=pl(R.floating,f.y);return l?{...T,transform:"translate("+te+"px, "+ne+"px)",...ld(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:ne}},[n,l,R.floating,f.x,f.y]);return m.useMemo(()=>({...f,update:z,refs:X,elements:R,floatingStyles:V}),[f,z,X,R,V])}const Xb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ml({element:r.current,padding:s}).fn(n):{}:r?ml({element:r,padding:s}).fn(n):{}}}},ey=(e,t)=>({...Vb(e),options:[e,t]}),ty=(e,t)=>({...Hb(e),options:[e,t]}),ny=(e,t)=>({...Gb(e),options:[e,t]}),ry=(e,t)=>({...Zb(e),options:[e,t]}),sy=(e,t)=>({...Wb(e),options:[e,t]}),oy=(e,t)=>({...qb(e),options:[e,t]}),ay=(e,t)=>({...Xb(e),options:[e,t]});var iy="Arrow",cd=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...a}=e;return o.jsx(ce.svg,{...a,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});cd.displayName=iy;var ly=cd;function cy(e){const[t,n]=m.useState(void 0);return Le(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let i,l;if("borderBoxSize"in a){const c=a.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Sa="Popper",[dd,ud]=tn(Sa),[dy,fd]=dd(Sa),md=e=>{const{__scopePopper:t,children:n}=e,[r,s]=m.useState(null);return o.jsx(dy,{scope:t,anchor:r,onAnchorChange:s,children:n})};md.displayName=Sa;var pd="PopperAnchor",hd=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,a=fd(pd,n),i=m.useRef(null),l=xe(t,i),c=m.useRef(null);return m.useEffect(()=>{const d=c.current;c.current=r?.current||i.current,d!==c.current&&a.onAnchorChange(c.current)}),r?null:o.jsx(ce.div,{...s,ref:l})});hd.displayName=pd;var Na="PopperContent",[uy,fy]=dd(Na),gd=m.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:g=!1,updatePositionStrategy:h="optimized",onPlaced:x,...p}=e,v=fd(Na,n),[w,y]=m.useState(null),k=xe(t,_=>y(_)),[b,S]=m.useState(null),A=cy(b),I=A?.width??0,E=A?.height??0,Z=r+(a!=="center"?"-"+a:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},$=Array.isArray(d)?d:[d],D=$.length>0,z={padding:F,boundary:$.filter(py),altBoundary:D},{refs:U,floatingStyles:X,placement:R,isPositioned:V,middlewareData:T}=Jb({strategy:"fixed",placement:Z,whileElementsMounted:(..._)=>Ub(..._,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[ey({mainAxis:s+E,alignmentAxis:i}),c&&ty({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?ny():void 0,...z}),c&&ry({...z}),sy({...z,apply:({elements:_,rects:B,availableWidth:le,availableHeight:O})=>{const{width:ee,height:se}=B.reference,pe=_.floating.style;pe.setProperty("--radix-popper-available-width",`${le}px`),pe.setProperty("--radix-popper-available-height",`${O}px`),pe.setProperty("--radix-popper-anchor-width",`${ee}px`),pe.setProperty("--radix-popper-anchor-height",`${se}px`)}}),b&&ay({element:b,padding:l}),hy({arrowWidth:I,arrowHeight:E}),g&&oy({strategy:"referenceHidden",...z})]}),[te,ne]=bd(R),re=Yt(x);Le(()=>{V&&re?.()},[V,re]);const je=T.arrow?.x,L=T.arrow?.y,K=T.arrow?.centerOffset!==0,[G,fe]=m.useState();return Le(()=>{w&&fe(window.getComputedStyle(w).zIndex)},[w]),o.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:V?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(uy,{scope:n,placedSide:te,onArrowChange:S,arrowX:je,arrowY:L,shouldHideArrow:K,children:o.jsx(ce.div,{"data-side":te,"data-align":ne,...p,ref:k,style:{...p.style,animation:V?void 0:"none"}})})})});gd.displayName=Na;var xd="PopperArrow",my={top:"bottom",right:"left",bottom:"top",left:"right"},vd=m.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,a=fy(xd,r),i=my[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:o.jsx(ly,{...s,ref:n,style:{...s.style,display:"block"}})})});vd.displayName=xd;function py(e){return e!==null}var hy=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=bd(n),u={start:"0%",center:"50%",end:"100%"}[f],g=(s.arrow?.x??0)+l/2,h=(s.arrow?.y??0)+c/2;let x="",p="";return d==="bottom"?(x=i?u:`${g}px`,p=`${-c}px`):d==="top"?(x=i?u:`${g}px`,p=`${r.floating.height+c}px`):d==="right"?(x=`${-c}px`,p=i?u:`${h}px`):d==="left"&&(x=`${r.floating.width+c}px`,p=i?u:`${h}px`),{data:{x,y:p}}}});function bd(e){const[t,n="center"]=e.split("-");return[t,n]}var gy=md,xy=hd,vy=gd,by=vd,yy="Portal",ja=m.forwardRef((e,t)=>{const{container:n,...r}=e,[s,a]=m.useState(!1);Le(()=>a(!0),[]);const i=n||s&&globalThis?.document?.body;return i?Qo.createPortal(o.jsx(ce.div,{...r,ref:t}),i):null});ja.displayName=yy;function wy(e){const t=ky(e),n=m.forwardRef((r,s)=>{const{children:a,...i}=r,l=m.Children.toArray(a),c=l.find(Ny);if(c){const d=c.props.children,f=l.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return o.jsx(t,{...i,ref:s,children:m.isValidElement(d)?m.cloneElement(d,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function ky(e){const t=m.forwardRef((n,r)=>{const{children:s,...a}=n;if(m.isValidElement(s)){const i=Cy(s),l=jy(a,s.props);return s.type!==m.Fragment&&(l.ref=r?Bn(r,i):i),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sy=Symbol("radix.slottable");function Ny(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sy}function jy(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function Cy(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _y=m[" useInsertionEffect ".trim().toString()]||Le;function Jt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,a,i]=Ey({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const f=m.useRef(e!==void 0);m.useEffect(()=>{const u=f.current;u!==l&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=l},[l,r])}const d=m.useCallback(f=>{if(l){const u=Ay(f)?f(e):f;u!==e&&i.current?.(u)}else a(f)},[l,e,a,i]);return[c,d]}function Ey({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),s=m.useRef(n),a=m.useRef(t);return _y(()=>{a.current=t},[t]),m.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,r,a]}function Ay(e){return typeof e=="function"}function Iy(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yd=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ty="VisuallyHidden",Py=m.forwardRef((e,t)=>o.jsx(ce.span,{...e,ref:t,style:{...yd,...e.style}}));Py.displayName=Ty;var Ry=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},An=new WeakMap,Or=new WeakMap,Mr={},fo=0,wd=function(e){return e&&(e.host||wd(e.parentNode))},Oy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=wd(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},My=function(e,t,n,r){var s=Oy(t,Array.isArray(e)?e:[e]);Mr[n]||(Mr[n]=new WeakMap);var a=Mr[n],i=[],l=new Set,c=new Set(s),d=function(u){!u||l.has(u)||(l.add(u),d(u.parentNode))};s.forEach(d);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(g){if(l.has(g))f(g);else try{var h=g.getAttribute(r),x=h!==null&&h!=="false",p=(An.get(g)||0)+1,v=(a.get(g)||0)+1;An.set(g,p),a.set(g,v),i.push(g),p===1&&x&&Or.set(g,!0),v===1&&g.setAttribute(n,"true"),x||g.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",g,w)}})};return f(t),l.clear(),fo++,function(){i.forEach(function(u){var g=An.get(u)-1,h=a.get(u)-1;An.set(u,g),a.set(u,h),g||(Or.has(u)||u.removeAttribute(r),Or.delete(u)),h||u.removeAttribute(n)}),fo--,fo||(An=new WeakMap,An=new WeakMap,Or=new WeakMap,Mr={})}},kd=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Ry(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),My(r,s,n,"aria-hidden")):function(){return null}},At=function(){return At=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},At.apply(this,arguments)};function Sd(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Dy(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,a;r<s;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var qr="right-scroll-bar-position",Gr="width-before-scroll-bar",zy="with-scroll-bars-hidden",Ly="--removed-body-scroll-bar-size";function mo(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function $y(e,t){var n=j.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var Fy=typeof window<"u"?m.useLayoutEffect:m.useEffect,hl=new WeakMap;function By(e,t){var n=$y(null,function(r){return e.forEach(function(s){return mo(s,r)})});return Fy(function(){var r=hl.get(n);if(r){var s=new Set(r),a=new Set(e),i=n.current;s.forEach(function(l){a.has(l)||mo(l,null)}),a.forEach(function(l){s.has(l)||mo(l,i)})}hl.set(n,e)},[e]),n}function Uy(e){return e}function Vy(e,t){t===void 0&&(t=Uy);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(a){for(r=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(l){return a(l)},filter:function(){return n}}},assignMedium:function(a){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(a),i=n}var c=function(){var f=i;i=[],f.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return s}function Hy(e){e===void 0&&(e={});var t=Vy(null);return t.options=At({async:!0,ssr:!1},e),t}var Nd=function(e){var t=e.sideCar,n=Sd(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,At({},n))};Nd.isSideCarExport=!0;function Zy(e,t){return e.useMedium(t),Nd}var jd=Hy(),po=function(){},Cs=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:po,onWheelCapture:po,onTouchMoveCapture:po}),s=r[0],a=r[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,g=e.sideCar,h=e.noRelative,x=e.noIsolation,p=e.inert,v=e.allowPinchZoom,w=e.as,y=w===void 0?"div":w,k=e.gapMode,b=Sd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=g,A=By([n,t]),I=At(At({},b),s);return m.createElement(m.Fragment,null,f&&m.createElement(S,{sideCar:jd,removeScrollBar:d,shards:u,noRelative:h,noIsolation:x,inert:p,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:k}),i?m.cloneElement(m.Children.only(l),At(At({},I),{ref:A})):m.createElement(y,At({},I,{className:c,ref:A}),l))});Cs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cs.classNames={fullWidth:Gr,zeroRight:qr};var Wy=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qy(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Wy();return t&&e.setAttribute("nonce",t),e}function Gy(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Yy(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ky=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qy())&&(Gy(t,n),Yy(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Qy=function(){var e=Ky();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Cd=function(){var e=Qy(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Jy={left:0,top:0,right:0,gap:0},ho=function(e){return parseInt(e||"",10)||0},Xy=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[ho(n),ho(r),ho(s)]},ew=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Jy;var t=Xy(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},tw=Cd(),Mn="data-scroll-locked",nw=function(e,t,n,r){var s=e.left,a=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
40
|
+
.`.concat(zy,` {
|
|
41
|
+
overflow: hidden `).concat(r,`;
|
|
42
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
43
|
+
}
|
|
44
|
+
body[`).concat(Mn,`] {
|
|
45
|
+
overflow: hidden `).concat(r,`;
|
|
46
|
+
overscroll-behavior: contain;
|
|
47
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
48
|
+
padding-left: `.concat(s,`px;
|
|
49
|
+
padding-top: `).concat(a,`px;
|
|
50
|
+
padding-right: `).concat(i,`px;
|
|
51
|
+
margin-left:0;
|
|
52
|
+
margin-top:0;
|
|
53
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
54
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.`).concat(qr,` {
|
|
58
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.`).concat(Gr,` {
|
|
62
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.`).concat(qr," .").concat(qr,` {
|
|
66
|
+
right: 0 `).concat(r,`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.`).concat(Gr," .").concat(Gr,` {
|
|
70
|
+
margin-right: 0 `).concat(r,`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
body[`).concat(Mn,`] {
|
|
74
|
+
`).concat(Ly,": ").concat(l,`px;
|
|
75
|
+
}
|
|
76
|
+
`)},gl=function(){var e=parseInt(document.body.getAttribute(Mn)||"0",10);return isFinite(e)?e:0},rw=function(){m.useEffect(function(){return document.body.setAttribute(Mn,(gl()+1).toString()),function(){var e=gl()-1;e<=0?document.body.removeAttribute(Mn):document.body.setAttribute(Mn,e.toString())}},[])},sw=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;rw();var a=m.useMemo(function(){return ew(s)},[s]);return m.createElement(tw,{styles:nw(a,!t,s,n?"":"!important")})},Lo=!1;if(typeof window<"u")try{var Dr=Object.defineProperty({},"passive",{get:function(){return Lo=!0,!0}});window.addEventListener("test",Dr,Dr),window.removeEventListener("test",Dr,Dr)}catch{Lo=!1}var In=Lo?{passive:!1}:!1,ow=function(e){return e.tagName==="TEXTAREA"},_d=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ow(e)&&n[t]==="visible")},aw=function(e){return _d(e,"overflowY")},iw=function(e){return _d(e,"overflowX")},xl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Ed(e,r);if(s){var a=Ad(e,r),i=a[1],l=a[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},lw=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},cw=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ed=function(e,t){return e==="v"?aw(t):iw(t)},Ad=function(e,t){return e==="v"?lw(t):cw(t)},dw=function(e,t){return e==="h"&&t==="rtl"?-1:1},uw=function(e,t,n,r,s){var a=dw(e,window.getComputedStyle(t).direction),i=a*r,l=n.target,c=t.contains(l),d=!1,f=i>0,u=0,g=0;do{if(!l)break;var h=Ad(e,l),x=h[0],p=h[1],v=h[2],w=p-v-a*x;(x||w)&&Ed(e,l)&&(u+=w,g+=x);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(u)<1||!f&&Math.abs(g)<1)&&(d=!0),d},zr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vl=function(e){return[e.deltaX,e.deltaY]},bl=function(e){return e&&"current"in e?e.current:e},fw=function(e,t){return e[0]===t[0]&&e[1]===t[1]},mw=function(e){return`
|
|
77
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
78
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
79
|
+
`)},pw=0,Tn=[];function hw(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),s=m.useState(pw++)[0],a=m.useState(Cd)[0],i=m.useRef(e);m.useEffect(function(){i.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=Dy([e.lockRef.current],(e.shards||[]).map(bl),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var w=zr(p),y=n.current,k="deltaX"in p?p.deltaX:y[0]-w[0],b="deltaY"in p?p.deltaY:y[1]-w[1],S,A=p.target,I=Math.abs(k)>Math.abs(b)?"h":"v";if("touches"in p&&I==="h"&&A.type==="range")return!1;var E=window.getSelection(),Z=E&&E.anchorNode,F=Z?Z===A||Z.contains(A):!1;if(F)return!1;var $=xl(I,A);if(!$)return!0;if($?S=I:(S=I==="v"?"h":"v",$=xl(I,A)),!$)return!1;if(!r.current&&"changedTouches"in p&&(k||b)&&(r.current=S),!S)return!0;var D=r.current||S;return uw(D,v,p,D==="h"?k:b)},[]),c=m.useCallback(function(p){var v=p;if(!(!Tn.length||Tn[Tn.length-1]!==a)){var w="deltaY"in v?vl(v):zr(v),y=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&fw(S.delta,w)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var k=(i.current.shards||[]).map(bl).filter(Boolean).filter(function(S){return S.contains(v.target)}),b=k.length>0?l(v,k[0]):!i.current.noIsolation;b&&v.cancelable&&v.preventDefault()}}},[]),d=m.useCallback(function(p,v,w,y){var k={name:p,delta:v,target:w,should:y,shadowParent:gw(w)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(b){return b!==k})},1)},[]),f=m.useCallback(function(p){n.current=zr(p),r.current=void 0},[]),u=m.useCallback(function(p){d(p.type,vl(p),p.target,l(p,e.lockRef.current))},[]),g=m.useCallback(function(p){d(p.type,zr(p),p.target,l(p,e.lockRef.current))},[]);m.useEffect(function(){return Tn.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:g}),document.addEventListener("wheel",c,In),document.addEventListener("touchmove",c,In),document.addEventListener("touchstart",f,In),function(){Tn=Tn.filter(function(p){return p!==a}),document.removeEventListener("wheel",c,In),document.removeEventListener("touchmove",c,In),document.removeEventListener("touchstart",f,In)}},[]);var h=e.removeScrollBar,x=e.inert;return m.createElement(m.Fragment,null,x?m.createElement(a,{styles:mw(s)}):null,h?m.createElement(sw,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function gw(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xw=Zy(jd,hw);var Ca=m.forwardRef(function(e,t){return m.createElement(Cs,At({},e,{ref:t,sideCar:xw}))});Ca.classNames=Cs.classNames;var vw=[" ","Enter","ArrowUp","ArrowDown"],bw=[" ","Enter"],mn="Select",[_s,Es,yw]=pa(mn),[Wn]=tn(mn,[yw,ud]),As=ud(),[ww,nn]=Wn(mn),[kw,Sw]=Wn(mn),Id=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:a,value:i,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:u,disabled:g,required:h,form:x}=e,p=As(t),[v,w]=m.useState(null),[y,k]=m.useState(null),[b,S]=m.useState(!1),A=ws(d),[I,E]=Jt({prop:r,defaultProp:s??!1,onChange:a,caller:mn}),[Z,F]=Jt({prop:i,defaultProp:l,onChange:c,caller:mn}),$=m.useRef(null),D=v?x||!!v.closest("form"):!0,[z,U]=m.useState(new Set),X=Array.from(z).map(R=>R.props.value).join(";");return o.jsx(gy,{...p,children:o.jsxs(ww,{required:h,scope:t,trigger:v,onTriggerChange:w,valueNode:y,onValueNodeChange:k,valueNodeHasChildren:b,onValueNodeHasChildrenChange:S,contentId:Tt(),value:Z,onValueChange:F,open:I,onOpenChange:E,dir:A,triggerPointerDownPosRef:$,disabled:g,children:[o.jsx(_s.Provider,{scope:t,children:o.jsx(kw,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(R=>{U(V=>new Set(V).add(R))},[]),onNativeOptionRemove:m.useCallback(R=>{U(V=>{const T=new Set(V);return T.delete(R),T})},[]),children:n})}),D?o.jsxs(Kd,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:u,value:Z,onChange:R=>F(R.target.value),disabled:g,form:x,children:[Z===void 0?o.jsx("option",{value:""}):null,Array.from(z)]},X):null]})})};Id.displayName=mn;var Td="SelectTrigger",Pd=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,a=As(n),i=nn(Td,n),l=i.disabled||r,c=xe(t,i.onTriggerChange),d=Es(n),f=m.useRef("touch"),[u,g,h]=Jd(p=>{const v=d().filter(k=>!k.disabled),w=v.find(k=>k.value===i.value),y=Xd(v,p,w);y!==void 0&&i.onValueChange(y.value)}),x=p=>{l||(i.onOpenChange(!0),h()),p&&(i.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return o.jsx(xy,{asChild:!0,...a,children:o.jsx(ce.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Qd(i.value)?"":void 0,...s,ref:c,onClick:ue(s.onClick,p=>{p.currentTarget.focus(),f.current!=="mouse"&&x(p)}),onPointerDown:ue(s.onPointerDown,p=>{f.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(x(p),p.preventDefault())}),onKeyDown:ue(s.onKeyDown,p=>{const v=u.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&g(p.key),!(v&&p.key===" ")&&vw.includes(p.key)&&(x(),p.preventDefault())})})})});Pd.displayName=Td;var Rd="SelectValue",Od=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:i="",...l}=e,c=nn(Rd,n),{onValueNodeHasChildrenChange:d}=c,f=a!==void 0,u=xe(t,c.onValueNodeChange);return Le(()=>{d(f)},[d,f]),o.jsx(ce.span,{...l,ref:u,style:{pointerEvents:"none"},children:Qd(c.value)?o.jsx(o.Fragment,{children:i}):a})});Od.displayName=Rd;var Nw="SelectIcon",Md=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return o.jsx(ce.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Md.displayName=Nw;var jw="SelectPortal",Dd=e=>o.jsx(ja,{asChild:!0,...e});Dd.displayName=jw;var pn="SelectContent",zd=m.forwardRef((e,t)=>{const n=nn(pn,e.__scopeSelect),[r,s]=m.useState();if(Le(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?hs.createPortal(o.jsx(Ld,{scope:e.__scopeSelect,children:o.jsx(_s.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),a):null}return o.jsx($d,{...e,ref:t})});zd.displayName=pn;var yt=10,[Ld,rn]=Wn(pn),Cw="SelectContentImpl",_w=wy("SelectContent.RemoveScroll"),$d=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:h,sticky:x,hideWhenDetached:p,avoidCollisions:v,...w}=e,y=nn(pn,n),[k,b]=m.useState(null),[S,A]=m.useState(null),I=xe(t,_=>b(_)),[E,Z]=m.useState(null),[F,$]=m.useState(null),D=Es(n),[z,U]=m.useState(!1),X=m.useRef(!1);m.useEffect(()=>{if(k)return kd(k)},[k]),Kc();const R=m.useCallback(_=>{const[B,...le]=D().map(se=>se.ref.current),[O]=le.slice(-1),ee=document.activeElement;for(const se of _)if(se===ee||(se?.scrollIntoView({block:"nearest"}),se===B&&S&&(S.scrollTop=0),se===O&&S&&(S.scrollTop=S.scrollHeight),se?.focus(),document.activeElement!==ee))return},[D,S]),V=m.useCallback(()=>R([E,k]),[R,E,k]);m.useEffect(()=>{z&&V()},[z,V]);const{onOpenChange:T,triggerPointerDownPosRef:te}=y;m.useEffect(()=>{if(k){let _={x:0,y:0};const B=O=>{_={x:Math.abs(Math.round(O.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(O.pageY)-(te.current?.y??0))}},le=O=>{_.x<=10&&_.y<=10?O.preventDefault():k.contains(O.target)||T(!1),document.removeEventListener("pointermove",B),te.current=null};return te.current!==null&&(document.addEventListener("pointermove",B),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",le,{capture:!0})}}},[k,T,te]),m.useEffect(()=>{const _=()=>T(!1);return window.addEventListener("blur",_),window.addEventListener("resize",_),()=>{window.removeEventListener("blur",_),window.removeEventListener("resize",_)}},[T]);const[ne,re]=Jd(_=>{const B=D().filter(ee=>!ee.disabled),le=B.find(ee=>ee.ref.current===document.activeElement),O=Xd(B,_,le);O&&setTimeout(()=>O.ref.current.focus())}),je=m.useCallback((_,B,le)=>{const O=!X.current&&!le;(y.value!==void 0&&y.value===B||O)&&(Z(_),O&&(X.current=!0))},[y.value]),L=m.useCallback(()=>k?.focus(),[k]),K=m.useCallback((_,B,le)=>{const O=!X.current&&!le;(y.value!==void 0&&y.value===B||O)&&$(_)},[y.value]),G=r==="popper"?$o:Fd,fe=G===$o?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:h,sticky:x,hideWhenDetached:p,avoidCollisions:v}:{};return o.jsx(Ld,{scope:n,content:k,viewport:S,onViewportChange:A,itemRefCallback:je,selectedItem:E,onItemLeave:L,itemTextRefCallback:K,focusSelectedItem:V,selectedItemText:F,position:r,isPositioned:z,searchRef:ne,children:o.jsx(Ca,{as:_w,allowPinchZoom:!0,children:o.jsx(ga,{asChild:!0,trapped:y.open,onMountAutoFocus:_=>{_.preventDefault()},onUnmountAutoFocus:ue(s,_=>{y.trigger?.focus({preventScroll:!0}),_.preventDefault()}),children:o.jsx(ha,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:_=>_.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:o.jsx(G,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:_=>_.preventDefault(),...w,...fe,onPlaced:()=>U(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:ue(w.onKeyDown,_=>{const B=_.ctrlKey||_.altKey||_.metaKey;if(_.key==="Tab"&&_.preventDefault(),!B&&_.key.length===1&&re(_.key),["ArrowUp","ArrowDown","Home","End"].includes(_.key)){let O=D().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes(_.key)&&(O=O.slice().reverse()),["ArrowUp","ArrowDown"].includes(_.key)){const ee=_.target,se=O.indexOf(ee);O=O.slice(se+1)}setTimeout(()=>R(O)),_.preventDefault()}})})})})})})});$d.displayName=Cw;var Ew="SelectItemAlignedPosition",Fd=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,a=nn(pn,n),i=rn(pn,n),[l,c]=m.useState(null),[d,f]=m.useState(null),u=xe(t,I=>f(I)),g=Es(n),h=m.useRef(!1),x=m.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:w,focusSelectedItem:y}=i,k=m.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&d&&p&&v&&w){const I=a.trigger.getBoundingClientRect(),E=d.getBoundingClientRect(),Z=a.valueNode.getBoundingClientRect(),F=w.getBoundingClientRect();if(a.dir!=="rtl"){const ee=F.left-E.left,se=Z.left-ee,pe=I.left-se,Re=I.width+pe,He=Math.max(Re,E.width),Je=window.innerWidth-yt,Ze=Yi(se,[yt,Math.max(yt,Je-He)]);l.style.minWidth=Re+"px",l.style.left=Ze+"px"}else{const ee=E.right-F.right,se=window.innerWidth-Z.right-ee,pe=window.innerWidth-I.right-se,Re=I.width+pe,He=Math.max(Re,E.width),Je=window.innerWidth-yt,Ze=Yi(se,[yt,Math.max(yt,Je-He)]);l.style.minWidth=Re+"px",l.style.right=Ze+"px"}const $=g(),D=window.innerHeight-yt*2,z=p.scrollHeight,U=window.getComputedStyle(d),X=parseInt(U.borderTopWidth,10),R=parseInt(U.paddingTop,10),V=parseInt(U.borderBottomWidth,10),T=parseInt(U.paddingBottom,10),te=X+R+z+T+V,ne=Math.min(v.offsetHeight*5,te),re=window.getComputedStyle(p),je=parseInt(re.paddingTop,10),L=parseInt(re.paddingBottom,10),K=I.top+I.height/2-yt,G=D-K,fe=v.offsetHeight/2,_=v.offsetTop+fe,B=X+R+_,le=te-B;if(B<=K){const ee=$.length>0&&v===$[$.length-1].ref.current;l.style.bottom="0px";const se=d.clientHeight-p.offsetTop-p.offsetHeight,pe=Math.max(G,fe+(ee?L:0)+se+V),Re=B+pe;l.style.height=Re+"px"}else{const ee=$.length>0&&v===$[0].ref.current;l.style.top="0px";const pe=Math.max(K,X+p.offsetTop+(ee?je:0)+fe)+le;l.style.height=pe+"px",p.scrollTop=B-K+p.offsetTop}l.style.margin=`${yt}px 0`,l.style.minHeight=ne+"px",l.style.maxHeight=D+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[g,a.trigger,a.valueNode,l,d,p,v,w,a.dir,r]);Le(()=>k(),[k]);const[b,S]=m.useState();Le(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const A=m.useCallback(I=>{I&&x.current===!0&&(k(),y?.(),x.current=!1)},[k,y]);return o.jsx(Iw,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:A,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:o.jsx(ce.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Fd.displayName=Ew;var Aw="SelectPopperPosition",$o=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=yt,...a}=e,i=As(n);return o.jsx(vy,{...i,...a,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});$o.displayName=Aw;var[Iw,_a]=Wn(pn,{}),Fo="SelectViewport",Bd=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,a=rn(Fo,n),i=_a(Fo,n),l=xe(t,a.onViewportChange),c=m.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),o.jsx(_s.Slot,{scope:n,children:o.jsx(ce.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ue(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:g}=i;if(g?.current&&u){const h=Math.abs(c.current-f.scrollTop);if(h>0){const x=window.innerHeight-yt*2,p=parseFloat(u.style.minHeight),v=parseFloat(u.style.height),w=Math.max(p,v);if(w<x){const y=w+h,k=Math.min(x,y),b=y-k;u.style.height=k+"px",u.style.bottom==="0px"&&(f.scrollTop=b>0?b:0,u.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Bd.displayName=Fo;var Ud="SelectGroup",[Tw,Pw]=Wn(Ud),Vd=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Tt();return o.jsx(Tw,{scope:n,id:s,children:o.jsx(ce.div,{role:"group","aria-labelledby":s,...r,ref:t})})});Vd.displayName=Ud;var Hd="SelectLabel",Rw=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Pw(Hd,n);return o.jsx(ce.div,{id:s.id,...r,ref:t})});Rw.displayName=Hd;var ls="SelectItem",[Ow,Zd]=Wn(ls),Wd=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...i}=e,l=nn(ls,n),c=rn(ls,n),d=l.value===r,[f,u]=m.useState(a??""),[g,h]=m.useState(!1),x=xe(t,y=>c.itemRefCallback?.(y,r,s)),p=Tt(),v=m.useRef("touch"),w=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Ow,{scope:n,value:r,disabled:s,textId:p,isSelected:d,onItemTextChange:m.useCallback(y=>{u(k=>k||(y?.textContent??"").trim())},[]),children:o.jsx(_s.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:o.jsx(ce.div,{role:"option","aria-labelledby":p,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ue(i.onFocus,()=>h(!0)),onBlur:ue(i.onBlur,()=>h(!1)),onClick:ue(i.onClick,()=>{v.current!=="mouse"&&w()}),onPointerUp:ue(i.onPointerUp,()=>{v.current==="mouse"&&w()}),onPointerDown:ue(i.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:ue(i.onPointerMove,y=>{v.current=y.pointerType,s?c.onItemLeave?.():v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ue(i.onPointerLeave,y=>{y.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ue(i.onKeyDown,y=>{c.searchRef?.current!==""&&y.key===" "||(bw.includes(y.key)&&w(),y.key===" "&&y.preventDefault())})})})})});Wd.displayName=ls;var ar="SelectItemText",qd=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...a}=e,i=nn(ar,n),l=rn(ar,n),c=Zd(ar,n),d=Sw(ar,n),[f,u]=m.useState(null),g=xe(t,w=>u(w),c.onItemTextChange,w=>l.itemTextRefCallback?.(w,c.value,c.disabled)),h=f?.textContent,x=m.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=d;return Le(()=>(p(x),()=>v(x)),[p,v,x]),o.jsxs(o.Fragment,{children:[o.jsx(ce.span,{id:c.textId,...a,ref:g}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?hs.createPortal(a.children,i.valueNode):null]})});qd.displayName=ar;var Gd="SelectItemIndicator",Mw=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Zd(Gd,n).isSelected?o.jsx(ce.span,{"aria-hidden":!0,...r,ref:t}):null});Mw.displayName=Gd;var Bo="SelectScrollUpButton",Dw=m.forwardRef((e,t)=>{const n=rn(Bo,e.__scopeSelect),r=_a(Bo,e.__scopeSelect),[s,a]=m.useState(!1),i=xe(t,r.onScrollButtonChange);return Le(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;a(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?o.jsx(Yd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Dw.displayName=Bo;var Uo="SelectScrollDownButton",zw=m.forwardRef((e,t)=>{const n=rn(Uo,e.__scopeSelect),r=_a(Uo,e.__scopeSelect),[s,a]=m.useState(!1),i=xe(t,r.onScrollButtonChange);return Le(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;a(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?o.jsx(Yd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});zw.displayName=Uo;var Yd=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,a=rn("SelectScrollButton",n),i=m.useRef(null),l=Es(n),c=m.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return m.useEffect(()=>()=>c(),[c]),Le(()=>{l().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),o.jsx(ce.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ue(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ue(s.onPointerMove,()=>{a.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ue(s.onPointerLeave,()=>{c()})})}),Lw="SelectSeparator",$w=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return o.jsx(ce.div,{"aria-hidden":!0,...r,ref:t})});$w.displayName=Lw;var Vo="SelectArrow",Fw=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=As(n),a=nn(Vo,n),i=rn(Vo,n);return a.open&&i.position==="popper"?o.jsx(by,{...s,...r,ref:t}):null});Fw.displayName=Vo;var Bw="SelectBubbleInput",Kd=m.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=m.useRef(null),a=xe(r,s),i=Iy(t);return m.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const u=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(ce.select,{...n,style:{...yd,...n.style},ref:a,defaultValue:t})});Kd.displayName=Bw;function Qd(e){return e===""||e===void 0}function Jd(e){const t=Yt(e),n=m.useRef(""),r=m.useRef(0),s=m.useCallback(i=>{const l=n.current+i;t(l),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),a=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function Xd(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=Uw(e,Math.max(a,0));s.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function Uw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vw=Id,eu=Pd,Hw=Od,Zw=Md,Ww=Dd,tu=zd,qw=Bd,Gw=Vd,nu=Wd,Yw=qd;const cs=Vw,Kw=Gw,ds=Hw,gr=m.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(eu,{ref:r,className:C("flex h-10 w-full items-center justify-between rounded-md border border-neutral-200 bg-white px-3 py-2 text-sm text-neutral-950 shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-900/20 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50 dark:focus-visible:ring-neutral-50/20",e),...n,children:[t,o.jsx(Zw,{className:"ml-2 text-neutral-500 dark:text-neutral-400",children:"▾"})]}));gr.displayName=eu.displayName;const xr=m.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>o.jsx(Ww,{children:o.jsx(tu,{ref:s,position:n,className:C("z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 bg-white text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",e),...r,children:o.jsx(qw,{className:C("p-1",n==="popper"?"w-full":void 0),children:t})})}));xr.displayName=tu.displayName;const vr=m.forwardRef(({className:e,children:t,...n},r)=>o.jsx(nu,{ref:r,className:C("relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-neutral-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800",e),...n,children:o.jsx(Yw,{children:t})}));vr.displayName=nu.displayName;function Qw(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var qn=e=>{const{present:t,children:n}=e,r=Jw(t),s=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),a=xe(r.ref,Xw(s));return typeof n=="function"||r.isPresent?m.cloneElement(s,{ref:a}):null};qn.displayName="Presence";function Jw(e){const[t,n]=m.useState(),r=m.useRef(null),s=m.useRef(e),a=m.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Qw(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const d=Lr(r.current);a.current=l==="mounted"?d:"none"},[l]),Le(()=>{const d=r.current,f=s.current;if(f!==e){const g=a.current,h=Lr(d);e?c("MOUNT"):h==="none"||d?.display==="none"?c("UNMOUNT"):c(f&&g!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Le(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=h=>{const p=Lr(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&p&&(c("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},g=h=>{h.target===t&&(a.current=Lr(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Lr(e){return e?.animationName||"none"}function Xw(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ek(e){const t=tk(e),n=m.forwardRef((r,s)=>{const{children:a,...i}=r,l=m.Children.toArray(a),c=l.find(rk);if(c){const d=c.props.children,f=l.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return o.jsx(t,{...i,ref:s,children:m.isValidElement(d)?m.cloneElement(d,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function tk(e){const t=m.forwardRef((n,r)=>{const{children:s,...a}=n;if(m.isValidElement(s)){const i=ok(s),l=sk(a,s.props);return s.type!==m.Fragment&&(l.ref=r?Bn(r,i):i),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nk=Symbol("radix.slottable");function rk(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nk}function sk(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function ok(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Is="Dialog",[ru]=tn(Is),[ak,Nt]=ru(Is),su=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,l=m.useRef(null),c=m.useRef(null),[d,f]=Jt({prop:r,defaultProp:s??!1,onChange:a,caller:Is});return o.jsx(ak,{scope:t,triggerRef:l,contentRef:c,contentId:Tt(),titleId:Tt(),descriptionId:Tt(),open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(u=>!u),[f]),modal:i,children:n})};su.displayName=Is;var ou="DialogTrigger",au=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Nt(ou,n),a=xe(t,s.triggerRef);return o.jsx(ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ia(s.open),...r,ref:a,onClick:ue(e.onClick,s.onOpenToggle)})});au.displayName=ou;var Ea="DialogPortal",[ik,iu]=ru(Ea,{forceMount:void 0}),lu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,a=Nt(Ea,t);return o.jsx(ik,{scope:t,forceMount:n,children:m.Children.map(r,i=>o.jsx(qn,{present:n||a.open,children:o.jsx(ja,{asChild:!0,container:s,children:i})}))})};lu.displayName=Ea;var us="DialogOverlay",cu=m.forwardRef((e,t)=>{const n=iu(us,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=Nt(us,e.__scopeDialog);return a.modal?o.jsx(qn,{present:r||a.open,children:o.jsx(ck,{...s,ref:t})}):null});cu.displayName=us;var lk=ek("DialogOverlay.RemoveScroll"),ck=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Nt(us,n);return o.jsx(Ca,{as:lk,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(ce.div,{"data-state":Ia(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),hn="DialogContent",du=m.forwardRef((e,t)=>{const n=iu(hn,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=Nt(hn,e.__scopeDialog);return o.jsx(qn,{present:r||a.open,children:a.modal?o.jsx(dk,{...s,ref:t}):o.jsx(uk,{...s,ref:t})})});du.displayName=hn;var dk=m.forwardRef((e,t)=>{const n=Nt(hn,e.__scopeDialog),r=m.useRef(null),s=xe(t,n.contentRef,r);return m.useEffect(()=>{const a=r.current;if(a)return kd(a)},[]),o.jsx(uu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ue(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ue(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&a.preventDefault()}),onFocusOutside:ue(e.onFocusOutside,a=>a.preventDefault())})}),uk=m.forwardRef((e,t)=>{const n=Nt(hn,e.__scopeDialog),r=m.useRef(!1),s=m.useRef(!1);return o.jsx(uu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;n.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),uu=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...i}=e,l=Nt(hn,n),c=m.useRef(null),d=xe(t,c);return Kc(),o.jsxs(o.Fragment,{children:[o.jsx(ga,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(ha,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ia(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(fk,{titleId:l.titleId}),o.jsx(pk,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Aa="DialogTitle",fu=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Nt(Aa,n);return o.jsx(ce.h2,{id:s.titleId,...r,ref:t})});fu.displayName=Aa;var mu="DialogDescription",pu=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Nt(mu,n);return o.jsx(ce.p,{id:s.descriptionId,...r,ref:t})});pu.displayName=mu;var hu="DialogClose",gu=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Nt(hu,n);return o.jsx(ce.button,{type:"button",...r,ref:t,onClick:ue(e.onClick,()=>s.onOpenChange(!1))})});gu.displayName=hu;function Ia(e){return e?"open":"closed"}var xu="DialogTitleWarning",[sj,vu]=vv(xu,{contentName:hn,titleName:Aa,docsSlug:"dialog"}),fk=({titleId:e})=>{const t=vu(xu),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
80
|
+
|
|
81
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
82
|
+
|
|
83
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},mk="DialogDescriptionWarning",pk=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vu(mk).contentName}}.`;return m.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},bu=su,yu=au,wu=lu,Ts=cu,Ps=du,Rs=fu,Os=pu,ku=gu;const Ta=bu,hk=yu,Su=wu,gk=ku,Pa=m.forwardRef(({className:e,...t},n)=>o.jsx(Ts,{ref:n,className:C("fixed inset-0 z-50 bg-neutral-950/40 backdrop-blur-sm transition-opacity data-[state=closed]:opacity-0 data-[state=open]:opacity-100",e),...t}));Pa.displayName=Ts.displayName;const Ms=m.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(Su,{children:[o.jsx(Pa,{}),o.jsx(Ps,{ref:r,className:C("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border border-neutral-200 bg-white p-6 shadow-lg outline-none transition data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data-[state=open]:opacity-100 data-[state=open]:scale-100 dark:border-neutral-800 dark:bg-neutral-950","rounded-2xl",e),...n,children:t})]}));Ms.displayName=Ps.displayName;const Ra=({className:e,...t})=>o.jsx("div",{className:C("flex flex-col space-y-2 text-center sm:text-left",e),...t}),Nu=({className:e,...t})=>o.jsx("div",{className:C("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t}),Ds=m.forwardRef(({className:e,...t},n)=>o.jsx(Rs,{ref:n,className:C("text-lg font-semibold leading-none tracking-tight",e),...t}));Ds.displayName=Rs.displayName;const Oa=m.forwardRef(({className:e,...t},n)=>o.jsx(Os,{ref:n,className:C("text-sm text-neutral-500 dark:text-neutral-400",e),...t}));Oa.displayName=Os.displayName;const zs=bu,Ls=yu,ju=ku,Cu=wu,Ma=m.forwardRef(({className:e,...t},n)=>o.jsx(Ts,{ref:n,className:C("fixed inset-0 z-50 bg-neutral-950/40 backdrop-blur-sm transition-opacity data-[state=closed]:opacity-0 data-[state=open]:opacity-100",e),...t}));Ma.displayName=Ts.displayName;const xk=fa("fixed z-50 gap-4 bg-white p-6 shadow-lg outline-none transition duration-200 ease-out dark:bg-neutral-950",{variants:{side:{top:"inset-x-0 top-0 border-b border-neutral-200 data-[state=closed]:-translate-y-full data-[state=open]:translate-y-0 dark:border-neutral-800",bottom:"inset-x-0 bottom-0 border-t border-neutral-200 data-[state=closed]:translate-y-full data-[state=open]:translate-y-0 dark:border-neutral-800",left:"inset-y-0 left-0 h-full w-3/4 border-r border-neutral-200 data-[state=closed]:-translate-x-full data-[state=open]:translate-x-0 sm:max-w-sm dark:border-neutral-800",right:"inset-y-0 right-0 h-full w-3/4 border-l border-neutral-200 data-[state=closed]:translate-x-full data-[state=open]:translate-x-0 sm:max-w-sm dark:border-neutral-800",popup:"bottom-4 right-4 w-[420px] max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)] overflow-hidden rounded-2xl border border-neutral-200 p-4 data-[state=closed]:translate-y-2 data-[state=open]:translate-y-0 data-[state=closed]:opacity-0 data-[state=open]:opacity-100 data-[state=closed]:scale-95 data-[state=open]:scale-100 dark:border-neutral-800"}},defaultVariants:{side:"right"}}),Sr=m.forwardRef(({side:e="right",className:t,children:n,overlayClassName:r,...s},a)=>o.jsxs(Cu,{children:[o.jsx(Ma,{className:r}),o.jsx(Ps,{ref:a,className:C(xk({side:e}),t),...s,children:n})]}));Sr.displayName=Ps.displayName;const $s=({className:e,...t})=>o.jsx("div",{className:C("flex flex-col space-y-2 text-left",e),...t}),Fs=m.forwardRef(({className:e,...t},n)=>o.jsx(Rs,{ref:n,className:C("text-lg font-semibold leading-none tracking-tight",e),...t}));Fs.displayName=Rs.displayName;const _u=m.forwardRef(({className:e,...t},n)=>o.jsx(Os,{ref:n,className:C("text-sm text-neutral-500 dark:text-neutral-400",e),...t}));_u.displayName=Os.displayName;var Bs="Collapsible",[vk,Eu]=tn(Bs),[bk,Da]=vk(Bs),Au=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:a,onOpenChange:i,...l}=e,[c,d]=Jt({prop:r,defaultProp:s??!1,onChange:i,caller:Bs});return o.jsx(bk,{scope:n,disabled:a,contentId:Tt(),open:c,onOpenToggle:m.useCallback(()=>d(f=>!f),[d]),children:o.jsx(ce.div,{"data-state":La(c),"data-disabled":a?"":void 0,...l,ref:t})})});Au.displayName=Bs;var Iu="CollapsibleTrigger",Tu=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Da(Iu,n);return o.jsx(ce.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":La(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:ue(e.onClick,s.onOpenToggle)})});Tu.displayName=Iu;var za="CollapsibleContent",Pu=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Da(za,e.__scopeCollapsible);return o.jsx(qn,{present:n||s.open,children:({present:a})=>o.jsx(yk,{...r,ref:t,present:a})})});Pu.displayName=za;var yk=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...a}=e,i=Da(za,n),[l,c]=m.useState(r),d=m.useRef(null),f=xe(t,d),u=m.useRef(0),g=u.current,h=m.useRef(0),x=h.current,p=i.open||l,v=m.useRef(p),w=m.useRef(void 0);return m.useEffect(()=>{const y=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(y)},[]),Le(()=>{const y=d.current;if(y){w.current=w.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const k=y.getBoundingClientRect();u.current=k.height,h.current=k.width,v.current||(y.style.transitionDuration=w.current.transitionDuration,y.style.animationName=w.current.animationName),c(r)}},[i.open,r]),o.jsx(ce.div,{"data-state":La(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!p,...a,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:p&&s})});function La(e){return e?"open":"closed"}var wk=Au,kk=Tu,Sk=Pu,jt="Accordion",Nk=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[$a,jk,Ck]=pa(jt),[Us]=tn(jt,[Ck,Eu]),Fa=Eu(),Ru=j.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,a=r;return o.jsx($a.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?o.jsx(Ik,{...a,ref:t}):o.jsx(Ak,{...s,ref:t})})});Ru.displayName=jt;var[Ou,_k]=Us(jt),[Mu,Ek]=Us(jt,{collapsible:!1}),Ak=j.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:a=!1,...i}=e,[l,c]=Jt({prop:n,defaultProp:r??"",onChange:s,caller:jt});return o.jsx(Ou,{scope:e.__scopeAccordion,value:j.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:j.useCallback(()=>a&&c(""),[a,c]),children:o.jsx(Mu,{scope:e.__scopeAccordion,collapsible:a,children:o.jsx(Du,{...i,ref:t})})})}),Ik=j.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...a}=e,[i,l]=Jt({prop:n,defaultProp:r??[],onChange:s,caller:jt}),c=j.useCallback(f=>l((u=[])=>[...u,f]),[l]),d=j.useCallback(f=>l((u=[])=>u.filter(g=>g!==f)),[l]);return o.jsx(Ou,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:d,children:o.jsx(Mu,{scope:e.__scopeAccordion,collapsible:!0,children:o.jsx(Du,{...a,ref:t})})})}),[Tk,Vs]=Us(jt),Du=j.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:a="vertical",...i}=e,l=j.useRef(null),c=xe(l,t),d=jk(n),u=ws(s)==="ltr",g=ue(e.onKeyDown,h=>{if(!Nk.includes(h.key))return;const x=h.target,p=d().filter(E=>!E.ref.current?.disabled),v=p.findIndex(E=>E.ref.current===x),w=p.length;if(v===-1)return;h.preventDefault();let y=v;const k=0,b=w-1,S=()=>{y=v+1,y>b&&(y=k)},A=()=>{y=v-1,y<k&&(y=b)};switch(h.key){case"Home":y=k;break;case"End":y=b;break;case"ArrowRight":a==="horizontal"&&(u?S():A());break;case"ArrowDown":a==="vertical"&&S();break;case"ArrowLeft":a==="horizontal"&&(u?A():S());break;case"ArrowUp":a==="vertical"&&A();break}const I=y%w;p[I].ref.current?.focus()});return o.jsx(Tk,{scope:n,disabled:r,direction:s,orientation:a,children:o.jsx($a.Slot,{scope:n,children:o.jsx(ce.div,{...i,"data-orientation":a,ref:c,onKeyDown:r?void 0:g})})})}),fs="AccordionItem",[Pk,Ba]=Us(fs),zu=j.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,a=Vs(fs,n),i=_k(fs,n),l=Fa(n),c=Tt(),d=r&&i.value.includes(r)||!1,f=a.disabled||e.disabled;return o.jsx(Pk,{scope:n,open:d,disabled:f,triggerId:c,children:o.jsx(wk,{"data-orientation":a.orientation,"data-state":Vu(d),...l,...s,ref:t,disabled:f,open:d,onOpenChange:u=>{u?i.onItemOpen(r):i.onItemClose(r)}})})});zu.displayName=fs;var Lu="AccordionHeader",$u=j.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Vs(jt,n),a=Ba(Lu,n);return o.jsx(ce.h3,{"data-orientation":s.orientation,"data-state":Vu(a.open),"data-disabled":a.disabled?"":void 0,...r,ref:t})});$u.displayName=Lu;var Ho="AccordionTrigger",Fu=j.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Vs(jt,n),a=Ba(Ho,n),i=Ek(Ho,n),l=Fa(n);return o.jsx($a.ItemSlot,{scope:n,children:o.jsx(kk,{"aria-disabled":a.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:a.triggerId,...l,...r,ref:t})})});Fu.displayName=Ho;var Bu="AccordionContent",Uu=j.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Vs(jt,n),a=Ba(Bu,n),i=Fa(n);return o.jsx(Sk,{role:"region","aria-labelledby":a.triggerId,"data-orientation":s.orientation,...i,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Uu.displayName=Bu;function Vu(e){return e?"open":"closed"}var Rk=Ru,Hu=zu,Ok=$u,Zu=Fu,Wu=Uu;const qu=Rk,ir=m.forwardRef(({className:e,...t},n)=>o.jsx(Hu,{ref:n,className:C("border-b border-neutral-200 dark:border-neutral-800",e),...t}));ir.displayName=Hu.displayName;const lr=m.forwardRef(({className:e,children:t,...n},r)=>o.jsx(Ok,{className:"flex",children:o.jsxs(Zu,{ref:r,className:C("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline",e),...n,children:[t,o.jsx("span",{className:"ml-3 text-neutral-500 dark:text-neutral-400","aria-hidden":!0,children:"▾"})]})}));lr.displayName=Zu.displayName;const cr=m.forwardRef(({className:e,children:t,...n},r)=>o.jsx(Wu,{ref:r,className:C("overflow-hidden text-sm",e),...n,children:o.jsx("div",{className:"pb-4 pt-0",children:t})}));cr.displayName=Wu.displayName;var go="rovingFocusGroup.onEntryFocus",Mk={bubbles:!1,cancelable:!0},Nr="RovingFocusGroup",[Zo,Gu,Dk]=pa(Nr),[zk,Yu]=tn(Nr,[Dk]),[Lk,$k]=zk(Nr),Ku=m.forwardRef((e,t)=>o.jsx(Zo.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Zo.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Fk,{...e,ref:t})})}));Ku.displayName=Nr;var Fk=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...u}=e,g=m.useRef(null),h=xe(t,g),x=ws(a),[p,v]=Jt({prop:i,defaultProp:l??null,onChange:c,caller:Nr}),[w,y]=m.useState(!1),k=Yt(d),b=Gu(n),S=m.useRef(!1),[A,I]=m.useState(0);return m.useEffect(()=>{const E=g.current;if(E)return E.addEventListener(go,k),()=>E.removeEventListener(go,k)},[k]),o.jsx(Lk,{scope:n,orientation:r,dir:x,loop:s,currentTabStopId:p,onItemFocus:m.useCallback(E=>v(E),[v]),onItemShiftTab:m.useCallback(()=>y(!0),[]),onFocusableItemAdd:m.useCallback(()=>I(E=>E+1),[]),onFocusableItemRemove:m.useCallback(()=>I(E=>E-1),[]),children:o.jsx(ce.div,{tabIndex:w||A===0?-1:0,"data-orientation":r,...u,ref:h,style:{outline:"none",...e.style},onMouseDown:ue(e.onMouseDown,()=>{S.current=!0}),onFocus:ue(e.onFocus,E=>{const Z=!S.current;if(E.target===E.currentTarget&&Z&&!w){const F=new CustomEvent(go,Mk);if(E.currentTarget.dispatchEvent(F),!F.defaultPrevented){const $=b().filter(R=>R.focusable),D=$.find(R=>R.active),z=$.find(R=>R.id===p),X=[D,z,...$].filter(Boolean).map(R=>R.ref.current);Xu(X,f)}}S.current=!1}),onBlur:ue(e.onBlur,()=>y(!1))})})}),Qu="RovingFocusGroupItem",Ju=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:i,...l}=e,c=Tt(),d=a||c,f=$k(Qu,n),u=f.currentTabStopId===d,g=Gu(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:p}=f;return m.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),o.jsx(Zo.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:o.jsx(ce.span,{tabIndex:u?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:ue(e.onMouseDown,v=>{r?f.onItemFocus(d):v.preventDefault()}),onFocus:ue(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ue(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const w=Vk(v,f.orientation,f.dir);if(w!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let k=g().filter(b=>b.focusable).map(b=>b.ref.current);if(w==="last")k.reverse();else if(w==="prev"||w==="next"){w==="prev"&&k.reverse();const b=k.indexOf(v.currentTarget);k=f.loop?Hk(k,b+1):k.slice(b+1)}setTimeout(()=>Xu(k))}}),children:typeof i=="function"?i({isCurrentTabStop:u,hasTabStop:p!=null}):i})})});Ju.displayName=Qu;var Bk={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Uk(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vk(e,t,n){const r=Uk(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Bk[r]}function Xu(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Hk(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Zk=Ku,Wk=Ju,Hs="Tabs",[qk]=tn(Hs,[Yu]),ef=Yu(),[Gk,Ua]=qk(Hs),tf=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:a,orientation:i="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=ws(l),[u,g]=Jt({prop:r,onChange:s,defaultProp:a??"",caller:Hs});return o.jsx(Gk,{scope:n,baseId:Tt(),value:u,onValueChange:g,orientation:i,dir:f,activationMode:c,children:o.jsx(ce.div,{dir:f,"data-orientation":i,...d,ref:t})})});tf.displayName=Hs;var nf="TabsList",rf=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,a=Ua(nf,n),i=ef(n);return o.jsx(Zk,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:o.jsx(ce.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});rf.displayName=nf;var sf="TabsTrigger",of=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...a}=e,i=Ua(sf,n),l=ef(n),c=cf(i.baseId,r),d=df(i.baseId,r),f=r===i.value;return o.jsx(Wk,{asChild:!0,...l,focusable:!s,active:f,children:o.jsx(ce.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...a,ref:t,onMouseDown:ue(e.onMouseDown,u=>{!s&&u.button===0&&u.ctrlKey===!1?i.onValueChange(r):u.preventDefault()}),onKeyDown:ue(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&i.onValueChange(r)}),onFocus:ue(e.onFocus,()=>{const u=i.activationMode!=="manual";!f&&!s&&u&&i.onValueChange(r)})})})});of.displayName=sf;var af="TabsContent",lf=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:a,...i}=e,l=Ua(af,n),c=cf(l.baseId,r),d=df(l.baseId,r),f=r===l.value,u=m.useRef(f);return m.useEffect(()=>{const g=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(g)},[]),o.jsx(qn,{present:s||f,children:({present:g})=>o.jsx(ce.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:g&&a})})});lf.displayName=af;function cf(e,t){return`${e}-trigger-${t}`}function df(e,t){return`${e}-content-${t}`}var Yk=tf,uf=rf,ff=of,mf=lf;const Va=Yk,Zs=m.forwardRef(({className:e,...t},n)=>o.jsx(uf,{ref:n,className:C("inline-flex h-10 items-center justify-center rounded-md bg-neutral-100 p-1 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400",e),...t}));Zs.displayName=uf.displayName;const br=m.forwardRef(({className:e,...t},n)=>o.jsx(ff,{ref:n,className:C("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-900/20 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-neutral-950 data-[state=active]:shadow-sm dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-50/20 dark:data-[state=active]:bg-neutral-950 dark:data-[state=active]:text-neutral-50",e),...t}));br.displayName=ff.displayName;const pf=m.forwardRef(({className:e,...t},n)=>o.jsx(mf,{ref:n,className:C("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-900/20 dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-50/20",e),...t}));pf.displayName=mf.displayName;function Ln({title:e,description:t,actionLabel:n,onAction:r,className:s}){return o.jsx("div",{className:C("flex flex-col items-center justify-center rounded-xl border border-neutral-200 bg-white p-10 text-center dark:border-neutral-800 dark:bg-neutral-950",s),children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx("h3",{className:"text-base font-semibold text-neutral-950 dark:text-neutral-50",children:e}),t?o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:t}):null,n&&r?o.jsx("div",{className:"mt-5",children:o.jsx(H,{type:"button",onClick:r,variant:"secondary",children:n})}):null]})})}function Rt({title:e,description:t,onRetry:n,className:r}){return o.jsxs("div",{className:C("rounded-xl border border-neutral-200 bg-white p-6 text-neutral-950 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",r),children:[o.jsx("h3",{className:"text-sm font-semibold",children:e??"Something went wrong"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:t}),n?o.jsx("div",{className:"mt-4",children:o.jsx(H,{type:"button",variant:"outline",onClick:n,children:"Try again"})}):null]})}class Kk extends m.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}render(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error):o.jsx(Rt,{description:this.state.error.message}):this.props.children}}function Qk(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Jk=e=>{switch(e){case"success":return tS;case"info":return rS;case"warning":return nS;case"error":return sS;default:return null}},Xk=Array(12).fill(0),eS=({visible:e,className:t})=>j.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},j.createElement("div",{className:"sonner-spinner"},Xk.map((n,r)=>j.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),tS=j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},j.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),nS=j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},j.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rS=j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},j.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),sS=j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},j.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),oS=j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},j.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),j.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),aS=()=>{const[e,t]=j.useState(document.hidden);return j.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Wo=1;class iS{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,a=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Wo++,i=this.toasts.find(c=>c.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...t,id:a,title:r}),{...c,...t,id:a,dismissible:l,title:r}):c):this.addToast({title:r,...s,dismissible:l,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=r!==void 0,i;const l=s.then(async d=>{if(i=["resolve",d],j.isValidElement(d))a=!1,this.create({id:r,type:"default",message:d});else if(cS(d)&&!d.ok){a=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,g=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,x=typeof u=="object"&&!j.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:g,...x})}else if(d instanceof Error){a=!1;const u=typeof n.error=="function"?await n.error(d):n.error,g=typeof n.description=="function"?await n.description(d):n.description,x=typeof u=="object"&&!j.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:g,...x})}else if(n.success!==void 0){a=!1;const u=typeof n.success=="function"?await n.success(d):n.success,g=typeof n.description=="function"?await n.description(d):n.description,x=typeof u=="object"&&!j.isValidElement(u)?u:{message:u};this.create({id:r,type:"success",description:g,...x})}}).catch(async d=>{if(i=["reject",d],n.error!==void 0){a=!1;const f=typeof n.error=="function"?await n.error(d):n.error,u=typeof n.description=="function"?await n.description(d):n.description,h=typeof f=="object"&&!j.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:u,...h})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((d,f)=>l.then(()=>i[0]==="reject"?f(i[1]):d(i[1])).catch(f));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{const r=n?.id||Wo++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const nt=new iS,lS=(e,t)=>{const n=t?.id||Wo++;return nt.addToast({title:e,...t,id:n}),n},cS=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",dS=lS,uS=()=>nt.toasts,fS=()=>nt.getActiveToasts(),mS=Object.assign(dS,{success:nt.success,info:nt.info,warning:nt.warning,error:nt.error,custom:nt.custom,message:nt.message,promise:nt.promise,dismiss:nt.dismiss,loading:nt.loading},{getHistory:uS,getToasts:fS});Qk("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function $r(e){return e.label!==void 0}const pS=3,hS="24px",gS="16px",yl=4e3,xS=356,vS=14,bS=45,yS=200;function _t(...e){return e.filter(Boolean).join(" ")}function wS(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const kS=e=>{var t,n,r,s,a,i,l,c,d;const{invert:f,toast:u,unstyled:g,interacting:h,setHeights:x,visibleToasts:p,heights:v,index:w,toasts:y,expanded:k,removeToast:b,defaultRichColors:S,closeButton:A,style:I,cancelButtonStyle:E,actionButtonStyle:Z,className:F="",descriptionClassName:$="",duration:D,position:z,gap:U,expandByDefault:X,classNames:R,icons:V,closeButtonAriaLabel:T="Close toast"}=e,[te,ne]=j.useState(null),[re,je]=j.useState(null),[L,K]=j.useState(!1),[G,fe]=j.useState(!1),[_,B]=j.useState(!1),[le,O]=j.useState(!1),[ee,se]=j.useState(!1),[pe,Re]=j.useState(0),[He,Je]=j.useState(0),Ze=j.useRef(u.duration||D||yl),Dt=j.useRef(null),Xe=j.useRef(null),xn=w===0,jr=w+1<=p,$e=u.type,Zt=u.dismissible!==!1,Gn=u.className||"",sn=u.descriptionClassName||"",xt=j.useMemo(()=>v.findIndex(oe=>oe.toastId===u.id)||0,[v,u.id]),ft=j.useMemo(()=>{var oe;return(oe=u.closeButton)!=null?oe:A},[u.closeButton,A]),vn=j.useMemo(()=>u.duration||D||yl,[u.duration,D]),bn=j.useRef(0),zt=j.useRef(0),yn=j.useRef(0),Lt=j.useRef(null),[wn,kn]=z.split("-"),mt=j.useMemo(()=>v.reduce((oe,_e,de)=>de>=xt?oe:oe+_e.height,0),[v,xt]),$t=aS(),Yn=u.invert||f,on=$e==="loading";zt.current=j.useMemo(()=>xt*U+mt,[xt,mt]),j.useEffect(()=>{Ze.current=vn},[vn]),j.useEffect(()=>{K(!0)},[]),j.useEffect(()=>{const oe=Xe.current;if(oe){const _e=oe.getBoundingClientRect().height;return Je(_e),x(de=>[{toastId:u.id,height:_e,position:u.position},...de]),()=>x(de=>de.filter(Ee=>Ee.toastId!==u.id))}},[x,u.id]),j.useLayoutEffect(()=>{if(!L)return;const oe=Xe.current,_e=oe.style.height;oe.style.height="auto";const de=oe.getBoundingClientRect().height;oe.style.height=_e,Je(de),x(Ee=>Ee.find(Ae=>Ae.toastId===u.id)?Ee.map(Ae=>Ae.toastId===u.id?{...Ae,height:de}:Ae):[{toastId:u.id,height:de,position:u.position},...Ee])},[L,u.title,u.description,x,u.id,u.jsx,u.action,u.cancel]);const Ct=j.useCallback(()=>{fe(!0),Re(zt.current),x(oe=>oe.filter(_e=>_e.toastId!==u.id)),setTimeout(()=>{b(u)},yS)},[u,b,x,zt]);j.useEffect(()=>{if(u.promise&&$e==="loading"||u.duration===1/0||u.type==="loading")return;let oe;return k||h||$t?(()=>{if(yn.current<bn.current){const Ee=new Date().getTime()-bn.current;Ze.current=Ze.current-Ee}yn.current=new Date().getTime()})():(()=>{Ze.current!==1/0&&(bn.current=new Date().getTime(),oe=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),Ct()},Ze.current))})(),()=>clearTimeout(oe)},[k,h,u,$e,$t,Ct]),j.useEffect(()=>{u.delete&&(Ct(),u.onDismiss==null||u.onDismiss.call(u,u))},[Ct,u.delete]);function Sn(){var oe;if(V?.loading){var _e;return j.createElement("div",{className:_t(R?.loader,u==null||(_e=u.classNames)==null?void 0:_e.loader,"sonner-loader"),"data-visible":$e==="loading"},V.loading)}return j.createElement(eS,{className:_t(R?.loader,u==null||(oe=u.classNames)==null?void 0:oe.loader),visible:$e==="loading"})}const Nn=u.icon||V?.[$e]||Jk($e);var Cr,Wt;return j.createElement("li",{tabIndex:0,ref:Xe,className:_t(F,Gn,R?.toast,u==null||(t=u.classNames)==null?void 0:t.toast,R?.default,R?.[$e],u==null||(n=u.classNames)==null?void 0:n[$e]),"data-sonner-toast":"","data-rich-colors":(Cr=u.richColors)!=null?Cr:S,"data-styled":!(u.jsx||u.unstyled||g),"data-mounted":L,"data-promise":!!u.promise,"data-swiped":ee,"data-removed":G,"data-visible":jr,"data-y-position":wn,"data-x-position":kn,"data-index":w,"data-front":xn,"data-swiping":_,"data-dismissible":Zt,"data-type":$e,"data-invert":Yn,"data-swipe-out":le,"data-swipe-direction":re,"data-expanded":!!(k||X&&L),"data-testid":u.testId,style:{"--index":w,"--toasts-before":w,"--z-index":y.length-w,"--offset":`${G?pe:zt.current}px`,"--initial-height":X?"auto":`${He}px`,...I,...u.style},onDragEnd:()=>{B(!1),ne(null),Lt.current=null},onPointerDown:oe=>{oe.button!==2&&(on||!Zt||(Dt.current=new Date,Re(zt.current),oe.target.setPointerCapture(oe.pointerId),oe.target.tagName!=="BUTTON"&&(B(!0),Lt.current={x:oe.clientX,y:oe.clientY})))},onPointerUp:()=>{var oe,_e,de;if(le||!Zt)return;Lt.current=null;const Ee=Number(((oe=Xe.current)==null?void 0:oe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),jn=Number(((_e=Xe.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ae=new Date().getTime()-((de=Dt.current)==null?void 0:de.getTime()),Fe=te==="x"?Ee:jn,an=Math.abs(Fe)/Ae;if(Math.abs(Fe)>=bS||an>.11){Re(zt.current),u.onDismiss==null||u.onDismiss.call(u,u),je(te==="x"?Ee>0?"right":"left":jn>0?"down":"up"),Ct(),O(!0);return}else{var et,ot;(et=Xe.current)==null||et.style.setProperty("--swipe-amount-x","0px"),(ot=Xe.current)==null||ot.style.setProperty("--swipe-amount-y","0px")}se(!1),B(!1),ne(null)},onPointerMove:oe=>{var _e,de,Ee;if(!Lt.current||!Zt||((_e=window.getSelection())==null?void 0:_e.toString().length)>0)return;const Ae=oe.clientY-Lt.current.y,Fe=oe.clientX-Lt.current.x;var an;const et=(an=e.swipeDirections)!=null?an:wS(z);!te&&(Math.abs(Fe)>1||Math.abs(Ae)>1)&&ne(Math.abs(Fe)>Math.abs(Ae)?"x":"y");let ot={x:0,y:0};const at=We=>1/(1.5+Math.abs(We)/20);if(te==="y"){if(et.includes("top")||et.includes("bottom"))if(et.includes("top")&&Ae<0||et.includes("bottom")&&Ae>0)ot.y=Ae;else{const We=Ae*at(Ae);ot.y=Math.abs(We)<Math.abs(Ae)?We:Ae}}else if(te==="x"&&(et.includes("left")||et.includes("right")))if(et.includes("left")&&Fe<0||et.includes("right")&&Fe>0)ot.x=Fe;else{const We=Fe*at(Fe);ot.x=Math.abs(We)<Math.abs(Fe)?We:Fe}(Math.abs(ot.x)>0||Math.abs(ot.y)>0)&&se(!0),(de=Xe.current)==null||de.style.setProperty("--swipe-amount-x",`${ot.x}px`),(Ee=Xe.current)==null||Ee.style.setProperty("--swipe-amount-y",`${ot.y}px`)}},ft&&!u.jsx&&$e!=="loading"?j.createElement("button",{"aria-label":T,"data-disabled":on,"data-close-button":!0,onClick:on||!Zt?()=>{}:()=>{Ct(),u.onDismiss==null||u.onDismiss.call(u,u)},className:_t(R?.closeButton,u==null||(r=u.classNames)==null?void 0:r.closeButton)},(Wt=V?.close)!=null?Wt:oS):null,($e||u.icon||u.promise)&&u.icon!==null&&(V?.[$e]!==null||u.icon)?j.createElement("div",{"data-icon":"",className:_t(R?.icon,u==null||(s=u.classNames)==null?void 0:s.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||Sn():null,u.type!=="loading"?Nn:null):null,j.createElement("div",{"data-content":"",className:_t(R?.content,u==null||(a=u.classNames)==null?void 0:a.content)},j.createElement("div",{"data-title":"",className:_t(R?.title,u==null||(i=u.classNames)==null?void 0:i.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?j.createElement("div",{"data-description":"",className:_t($,sn,R?.description,u==null||(l=u.classNames)==null?void 0:l.description)},typeof u.description=="function"?u.description():u.description):null),j.isValidElement(u.cancel)?u.cancel:u.cancel&&$r(u.cancel)?j.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||E,onClick:oe=>{$r(u.cancel)&&Zt&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,oe),Ct())},className:_t(R?.cancelButton,u==null||(c=u.classNames)==null?void 0:c.cancelButton)},u.cancel.label):null,j.isValidElement(u.action)?u.action:u.action&&$r(u.action)?j.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||Z,onClick:oe=>{$r(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,oe),!oe.defaultPrevented&&Ct())},className:_t(R?.actionButton,u==null||(d=u.classNames)==null?void 0:d.actionButton)},u.action.label):null)};function wl(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function SS(e,t){const n={};return[e,t].forEach((r,s)=>{const a=s===1,i=a?"--mobile-offset":"--offset",l=a?gS:hS;function c(d){["top","right","bottom","left"].forEach(f=>{n[`${i}-${f}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${i}-${d}`]=l:n[`${i}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(l)}),n}const NS=j.forwardRef(function(t,n){const{id:r,invert:s,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:l,closeButton:c,className:d,offset:f,mobileOffset:u,theme:g="light",richColors:h,duration:x,style:p,visibleToasts:v=pS,toastOptions:w,dir:y=wl(),gap:k=vS,icons:b,containerAriaLabel:S="Notifications"}=t,[A,I]=j.useState([]),E=j.useMemo(()=>r?A.filter(L=>L.toasterId===r):A.filter(L=>!L.toasterId),[A,r]),Z=j.useMemo(()=>Array.from(new Set([a].concat(E.filter(L=>L.position).map(L=>L.position)))),[E,a]),[F,$]=j.useState([]),[D,z]=j.useState(!1),[U,X]=j.useState(!1),[R,V]=j.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=j.useRef(null),te=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),ne=j.useRef(null),re=j.useRef(!1),je=j.useCallback(L=>{I(K=>{var G;return(G=K.find(fe=>fe.id===L.id))!=null&&G.delete||nt.dismiss(L.id),K.filter(({id:fe})=>fe!==L.id)})},[]);return j.useEffect(()=>nt.subscribe(L=>{if(L.dismiss){requestAnimationFrame(()=>{I(K=>K.map(G=>G.id===L.id?{...G,delete:!0}:G))});return}setTimeout(()=>{Qo.flushSync(()=>{I(K=>{const G=K.findIndex(fe=>fe.id===L.id);return G!==-1?[...K.slice(0,G),{...K[G],...L},...K.slice(G+1)]:[L,...K]})})})}),[A]),j.useEffect(()=>{if(g!=="system"){V(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const L=window.matchMedia("(prefers-color-scheme: dark)");try{L.addEventListener("change",({matches:K})=>{V(K?"dark":"light")})}catch{L.addListener(({matches:G})=>{try{V(G?"dark":"light")}catch(fe){console.error(fe)}})}},[g]),j.useEffect(()=>{A.length<=1&&z(!1)},[A]),j.useEffect(()=>{const L=K=>{var G;if(i.every(B=>K[B]||K.code===B)){var _;z(!0),(_=T.current)==null||_.focus()}K.code==="Escape"&&(document.activeElement===T.current||(G=T.current)!=null&&G.contains(document.activeElement))&&z(!1)};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[i]),j.useEffect(()=>{if(T.current)return()=>{ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null,re.current=!1)}},[T.current]),j.createElement("section",{ref:n,"aria-label":`${S} ${te}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Z.map((L,K)=>{var G;const[fe,_]=L.split("-");return E.length?j.createElement("ol",{key:L,dir:y==="auto"?wl():y,tabIndex:-1,ref:T,className:d,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":fe,"data-x-position":_,style:{"--front-toast-height":`${((G=F[0])==null?void 0:G.height)||0}px`,"--width":`${xS}px`,"--gap":`${k}px`,...p,...SS(f,u)},onBlur:B=>{re.current&&!B.currentTarget.contains(B.relatedTarget)&&(re.current=!1,ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null))},onFocus:B=>{B.target instanceof HTMLElement&&B.target.dataset.dismissible==="false"||re.current||(re.current=!0,ne.current=B.relatedTarget)},onMouseEnter:()=>z(!0),onMouseMove:()=>z(!0),onMouseLeave:()=>{U||z(!1)},onDragEnd:()=>z(!1),onPointerDown:B=>{B.target instanceof HTMLElement&&B.target.dataset.dismissible==="false"||X(!0)},onPointerUp:()=>X(!1)},E.filter(B=>!B.position&&K===0||B.position===L).map((B,le)=>{var O,ee;return j.createElement(kS,{key:B.id,icons:b,index:le,toast:B,defaultRichColors:h,duration:(O=w?.duration)!=null?O:x,className:w?.className,descriptionClassName:w?.descriptionClassName,invert:s,visibleToasts:v,closeButton:(ee=w?.closeButton)!=null?ee:c,interacting:U,position:L,style:w?.style,unstyled:w?.unstyled,classNames:w?.classNames,cancelButtonStyle:w?.cancelButtonStyle,actionButtonStyle:w?.actionButtonStyle,closeButtonAriaLabel:w?.closeButtonAriaLabel,removeToast:je,toasts:E.filter(se=>se.position==B.position),heights:F.filter(se=>se.position==B.position),setHeights:$,expandByDefault:l,gap:k,expanded:D,swipeDirections:t.swipeDirections})})):null}))}),Ha=m.createContext(null);function jS(){const e=m.useContext(Ha);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function Ws(){return m.useContext(Ha)}function CS({children:e}){const t=m.useCallback(n=>{const r=n.title??"",s=n.description;mS(r||s||"Notification",{description:r?s:void 0,duration:n.durationMs??5e3,action:n.actionLabel&&n.onAction?{label:n.actionLabel,onClick:()=>n.onAction?.()}:void 0})},[]);return o.jsxs(Ha.Provider,{value:{toast:t},children:[e,o.jsx(NS,{position:"top-center",closeButton:!0,expand:!0,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:pointer-events-auto group-[.toaster]:w-full group-[.toaster]:rounded-xl group-[.toaster]:border group-[.toaster]:border-neutral-200 group-[.toaster]:bg-white group-[.toaster]:p-4 group-[.toaster]:shadow-lg dark:group-[.toaster]:border-neutral-800 dark:group-[.toaster]:bg-neutral-950",title:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",description:"text-sm text-neutral-600 dark:text-neutral-400",actionButton:"h-8 rounded-md border border-neutral-200 bg-white px-3 text-xs font-medium text-neutral-900 shadow-sm hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50 dark:hover:bg-neutral-900",cancelButton:"h-8 rounded-md bg-neutral-100 px-3 text-xs font-medium text-neutral-900 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-700",closeButton:"rounded-md text-neutral-600 opacity-0 transition-opacity hover:bg-neutral-100 hover:text-neutral-900 group-hover:opacity-100 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-neutral-50"}}})]})}const{entries:hf,setPrototypeOf:kl,isFrozen:_S,getPrototypeOf:ES,getOwnPropertyDescriptor:AS}=Object;let{freeze:Ke,seal:ht,create:Yr}=Object,{apply:qo,construct:Go}=typeof Reflect<"u"&&Reflect;Ke||(Ke=function(t){return t});ht||(ht=function(t){return t});qo||(qo=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),a=2;a<r;a++)s[a-2]=arguments[a];return t.apply(n,s)});Go||(Go=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new t(...r)});const Fr=Qe(Array.prototype.forEach),IS=Qe(Array.prototype.lastIndexOf),Sl=Qe(Array.prototype.pop),Xn=Qe(Array.prototype.push),TS=Qe(Array.prototype.splice),Kr=Qe(String.prototype.toLowerCase),xo=Qe(String.prototype.toString),vo=Qe(String.prototype.match),er=Qe(String.prototype.replace),PS=Qe(String.prototype.indexOf),RS=Qe(String.prototype.trim),lt=Qe(Object.prototype.hasOwnProperty),qe=Qe(RegExp.prototype.test),tr=OS(TypeError);function Qe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return qo(e,t,r)}}function OS(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Go(e,n)}}function ie(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Kr;kl&&kl(e,null);let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){const a=n(s);a!==s&&(_S(t)||(t[r]=a),s=a)}e[s]=!0}return e}function MS(e){for(let t=0;t<e.length;t++)lt(e,t)||(e[t]=null);return e}function Et(e){const t=Yr(null);for(const[n,r]of hf(e))lt(e,n)&&(Array.isArray(r)?t[n]=MS(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Et(r):t[n]=r);return t}function nr(e,t){for(;e!==null;){const r=AS(e,t);if(r){if(r.get)return Qe(r.get);if(typeof r.value=="function")return Qe(r.value)}e=ES(e)}function n(){return null}return n}const Nl=Ke(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),bo=Ke(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),yo=Ke(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),DS=Ke(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),wo=Ke(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),zS=Ke(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),jl=Ke(["#text"]),Cl=Ke(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ko=Ke(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_l=Ke(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Br=Ke(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),LS=ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$S=ht(/<%[\w\W]*|[\w\W]*%>/gm),FS=ht(/\$\{[\w\W]*/gm),BS=ht(/^data-[\-\w.\u00B7-\uFFFF]+$/),US=ht(/^aria-[\-\w]+$/),gf=ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VS=ht(/^(?:\w+script|data):/i),HS=ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xf=ht(/^html$/i),ZS=ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var El=Object.freeze({__proto__:null,ARIA_ATTR:US,ATTR_WHITESPACE:HS,CUSTOM_ELEMENT:ZS,DATA_ATTR:BS,DOCTYPE_NAME:xf,ERB_EXPR:$S,IS_ALLOWED_URI:gf,IS_SCRIPT_OR_DATA:VS,MUSTACHE_EXPR:LS,TMPLIT_EXPR:FS});const rr={element:1,text:3,progressingInstruction:7,comment:8,document:9},WS=function(){return typeof window>"u"?null:window},qS=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const a="dompurify"+(r?"#"+r:"");try{return t.createPolicy(a,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Al=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function vf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:WS();const t=Q=>vf(Q);if(t.version="3.3.2",t.removed=[],!e||!e.document||e.document.nodeType!==rr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,s=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:h}=e,x=c.prototype,p=nr(x,"cloneNode"),v=nr(x,"remove"),w=nr(x,"nextSibling"),y=nr(x,"childNodes"),k=nr(x,"parentNode");if(typeof i=="function"){const Q=n.createElement("template");Q.content&&Q.content.ownerDocument&&(n=Q.content.ownerDocument)}let b,S="";const{implementation:A,createNodeIterator:I,createDocumentFragment:E,getElementsByTagName:Z}=n,{importNode:F}=r;let $=Al();t.isSupported=typeof hf=="function"&&typeof k=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:D,ERB_EXPR:z,TMPLIT_EXPR:U,DATA_ATTR:X,ARIA_ATTR:R,IS_SCRIPT_OR_DATA:V,ATTR_WHITESPACE:T,CUSTOM_ELEMENT:te}=El;let{IS_ALLOWED_URI:ne}=El,re=null;const je=ie({},[...Nl,...bo,...yo,...wo,...jl]);let L=null;const K=ie({},[...Cl,...ko,..._l,...Br]);let G=Object.seal(Yr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,_=null;const B=Object.seal(Yr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,O=!0,ee=!1,se=!0,pe=!1,Re=!0,He=!1,Je=!1,Ze=!1,Dt=!1,Xe=!1,xn=!1,jr=!0,$e=!1;const Zt="user-content-";let Gn=!0,sn=!1,xt={},ft=null;const vn=ie({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let bn=null;const zt=ie({},["audio","video","img","source","image","track"]);let yn=null;const Lt=ie({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),wn="http://www.w3.org/1998/Math/MathML",kn="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let $t=mt,Yn=!1,on=null;const Ct=ie({},[wn,kn,mt],xo);let Sn=ie({},["mi","mo","mn","ms","mtext"]),Nn=ie({},["annotation-xml"]);const Cr=ie({},["title","style","font","a","script"]);let Wt=null;const oe=["application/xhtml+xml","text/html"],_e="text/html";let de=null,Ee=null;const jn=n.createElement("form"),Ae=function(N){return N instanceof RegExp||N instanceof Function},Fe=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ee&&Ee===N)){if((!N||typeof N!="object")&&(N={}),N=Et(N),Wt=oe.indexOf(N.PARSER_MEDIA_TYPE)===-1?_e:N.PARSER_MEDIA_TYPE,de=Wt==="application/xhtml+xml"?xo:Kr,re=lt(N,"ALLOWED_TAGS")?ie({},N.ALLOWED_TAGS,de):je,L=lt(N,"ALLOWED_ATTR")?ie({},N.ALLOWED_ATTR,de):K,on=lt(N,"ALLOWED_NAMESPACES")?ie({},N.ALLOWED_NAMESPACES,xo):Ct,yn=lt(N,"ADD_URI_SAFE_ATTR")?ie(Et(Lt),N.ADD_URI_SAFE_ATTR,de):Lt,bn=lt(N,"ADD_DATA_URI_TAGS")?ie(Et(zt),N.ADD_DATA_URI_TAGS,de):zt,ft=lt(N,"FORBID_CONTENTS")?ie({},N.FORBID_CONTENTS,de):vn,fe=lt(N,"FORBID_TAGS")?ie({},N.FORBID_TAGS,de):Et({}),_=lt(N,"FORBID_ATTR")?ie({},N.FORBID_ATTR,de):Et({}),xt=lt(N,"USE_PROFILES")?N.USE_PROFILES:!1,le=N.ALLOW_ARIA_ATTR!==!1,O=N.ALLOW_DATA_ATTR!==!1,ee=N.ALLOW_UNKNOWN_PROTOCOLS||!1,se=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=N.SAFE_FOR_TEMPLATES||!1,Re=N.SAFE_FOR_XML!==!1,He=N.WHOLE_DOCUMENT||!1,Dt=N.RETURN_DOM||!1,Xe=N.RETURN_DOM_FRAGMENT||!1,xn=N.RETURN_TRUSTED_TYPE||!1,Ze=N.FORCE_BODY||!1,jr=N.SANITIZE_DOM!==!1,$e=N.SANITIZE_NAMED_PROPS||!1,Gn=N.KEEP_CONTENT!==!1,sn=N.IN_PLACE||!1,ne=N.ALLOWED_URI_REGEXP||gf,$t=N.NAMESPACE||mt,Sn=N.MATHML_TEXT_INTEGRATION_POINTS||Sn,Nn=N.HTML_INTEGRATION_POINTS||Nn,G=N.CUSTOM_ELEMENT_HANDLING||{},N.CUSTOM_ELEMENT_HANDLING&&Ae(N.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=N.CUSTOM_ELEMENT_HANDLING.tagNameCheck),N.CUSTOM_ELEMENT_HANDLING&&Ae(N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),pe&&(O=!1),Xe&&(Dt=!0),xt&&(re=ie({},jl),L=Yr(null),xt.html===!0&&(ie(re,Nl),ie(L,Cl)),xt.svg===!0&&(ie(re,bo),ie(L,ko),ie(L,Br)),xt.svgFilters===!0&&(ie(re,yo),ie(L,ko),ie(L,Br)),xt.mathMl===!0&&(ie(re,wo),ie(L,_l),ie(L,Br))),lt(N,"ADD_TAGS")||(B.tagCheck=null),lt(N,"ADD_ATTR")||(B.attributeCheck=null),N.ADD_TAGS&&(typeof N.ADD_TAGS=="function"?B.tagCheck=N.ADD_TAGS:(re===je&&(re=Et(re)),ie(re,N.ADD_TAGS,de))),N.ADD_ATTR&&(typeof N.ADD_ATTR=="function"?B.attributeCheck=N.ADD_ATTR:(L===K&&(L=Et(L)),ie(L,N.ADD_ATTR,de))),N.ADD_URI_SAFE_ATTR&&ie(yn,N.ADD_URI_SAFE_ATTR,de),N.FORBID_CONTENTS&&(ft===vn&&(ft=Et(ft)),ie(ft,N.FORBID_CONTENTS,de)),N.ADD_FORBID_CONTENTS&&(ft===vn&&(ft=Et(ft)),ie(ft,N.ADD_FORBID_CONTENTS,de)),Gn&&(re["#text"]=!0),He&&ie(re,["html","head","body"]),re.table&&(ie(re,["tbody"]),delete fe.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw tr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw tr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=N.TRUSTED_TYPES_POLICY,S=b.createHTML("")}else b===void 0&&(b=qS(h,s)),b!==null&&typeof S=="string"&&(S=b.createHTML(""));Ke&&Ke(N),Ee=N}},an=ie({},[...bo,...yo,...DS]),et=ie({},[...wo,...zS]),ot=function(N){let M=k(N);(!M||!M.tagName)&&(M={namespaceURI:$t,tagName:"template"});const Y=Kr(N.tagName),ge=Kr(M.tagName);return on[N.namespaceURI]?N.namespaceURI===kn?M.namespaceURI===mt?Y==="svg":M.namespaceURI===wn?Y==="svg"&&(ge==="annotation-xml"||Sn[ge]):!!an[Y]:N.namespaceURI===wn?M.namespaceURI===mt?Y==="math":M.namespaceURI===kn?Y==="math"&&Nn[ge]:!!et[Y]:N.namespaceURI===mt?M.namespaceURI===kn&&!Nn[ge]||M.namespaceURI===wn&&!Sn[ge]?!1:!et[Y]&&(Cr[Y]||!an[Y]):!!(Wt==="application/xhtml+xml"&&on[N.namespaceURI]):!1},at=function(N){Xn(t.removed,{element:N});try{k(N).removeChild(N)}catch{v(N)}},We=function(N,M){try{Xn(t.removed,{attribute:M.getAttributeNode(N),from:M})}catch{Xn(t.removed,{attribute:null,from:M})}if(M.removeAttribute(N),N==="is")if(Dt||Xe)try{at(M)}catch{}else try{M.setAttribute(N,"")}catch{}},Qs=function(N){let M=null,Y=null;if(Ze)N="<remove></remove>"+N;else{const Ie=vo(N,/^[\r\n\t ]+/);Y=Ie&&Ie[0]}Wt==="application/xhtml+xml"&&$t===mt&&(N='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+N+"</body></html>");const ge=b?b.createHTML(N):N;if($t===mt)try{M=new g().parseFromString(ge,Wt)}catch{}if(!M||!M.documentElement){M=A.createDocument($t,"template",null);try{M.documentElement.innerHTML=Yn?S:ge}catch{}}const Be=M.body||M.documentElement;return N&&Y&&Be.insertBefore(n.createTextNode(Y),Be.childNodes[0]||null),$t===mt?Z.call(M,He?"html":"body")[0]:He?M.documentElement:Be},ri=function(N){return I.call(N.ownerDocument||N,N,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Js=function(N){return N instanceof u&&(typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||!(N.attributes instanceof f)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function")},si=function(N){return typeof l=="function"&&N instanceof l};function Ft(Q,N,M){Fr(Q,Y=>{Y.call(t,N,M,Ee)})}const oi=function(N){let M=null;if(Ft($.beforeSanitizeElements,N,null),Js(N))return at(N),!0;const Y=de(N.nodeName);if(Ft($.uponSanitizeElement,N,{tagName:Y,allowedTags:re}),Re&&N.hasChildNodes()&&!si(N.firstElementChild)&&qe(/<[/\w!]/g,N.innerHTML)&&qe(/<[/\w!]/g,N.textContent)||N.nodeType===rr.progressingInstruction||Re&&N.nodeType===rr.comment&&qe(/<[/\w]/g,N.data))return at(N),!0;if(!(B.tagCheck instanceof Function&&B.tagCheck(Y))&&(!re[Y]||fe[Y])){if(!fe[Y]&&ii(Y)&&(G.tagNameCheck instanceof RegExp&&qe(G.tagNameCheck,Y)||G.tagNameCheck instanceof Function&&G.tagNameCheck(Y)))return!1;if(Gn&&!ft[Y]){const ge=k(N)||N.parentNode,Be=y(N)||N.childNodes;if(Be&&ge){const Ie=Be.length;for(let tt=Ie-1;tt>=0;--tt){const Bt=p(Be[tt],!0);Bt.__removalCount=(N.__removalCount||0)+1,ge.insertBefore(Bt,w(N))}}}return at(N),!0}return N instanceof c&&!ot(N)||(Y==="noscript"||Y==="noembed"||Y==="noframes")&&qe(/<\/no(script|embed|frames)/i,N.innerHTML)?(at(N),!0):(pe&&N.nodeType===rr.text&&(M=N.textContent,Fr([D,z,U],ge=>{M=er(M,ge," ")}),N.textContent!==M&&(Xn(t.removed,{element:N.cloneNode()}),N.textContent=M)),Ft($.afterSanitizeElements,N,null),!1)},ai=function(N,M,Y){if(_[M]||jr&&(M==="id"||M==="name")&&(Y in n||Y in jn))return!1;if(!(O&&!_[M]&&qe(X,M))){if(!(le&&qe(R,M))){if(!(B.attributeCheck instanceof Function&&B.attributeCheck(M,N))){if(!L[M]||_[M]){if(!(ii(N)&&(G.tagNameCheck instanceof RegExp&&qe(G.tagNameCheck,N)||G.tagNameCheck instanceof Function&&G.tagNameCheck(N))&&(G.attributeNameCheck instanceof RegExp&&qe(G.attributeNameCheck,M)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(M,N))||M==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&qe(G.tagNameCheck,Y)||G.tagNameCheck instanceof Function&&G.tagNameCheck(Y))))return!1}else if(!yn[M]){if(!qe(ne,er(Y,T,""))){if(!((M==="src"||M==="xlink:href"||M==="href")&&N!=="script"&&PS(Y,"data:")===0&&bn[N])){if(!(ee&&!qe(V,er(Y,T,"")))){if(Y)return!1}}}}}}}return!0},ii=function(N){return N!=="annotation-xml"&&vo(N,te)},li=function(N){Ft($.beforeSanitizeAttributes,N,null);const{attributes:M}=N;if(!M||Js(N))return;const Y={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0};let ge=M.length;for(;ge--;){const Be=M[ge],{name:Ie,namespaceURI:tt,value:Bt}=Be,Cn=de(Ie),Xs=Bt;let Oe=Ie==="value"?Xs:RS(Xs);if(Y.attrName=Cn,Y.attrValue=Oe,Y.keepAttr=!0,Y.forceKeepAttr=void 0,Ft($.uponSanitizeAttribute,N,Y),Oe=Y.attrValue,$e&&(Cn==="id"||Cn==="name")&&(We(Ie,N),Oe=Zt+Oe),Re&&qe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Oe)){We(Ie,N);continue}if(Cn==="attributename"&&vo(Oe,"href")){We(Ie,N);continue}if(Y.forceKeepAttr)continue;if(!Y.keepAttr){We(Ie,N);continue}if(!se&&qe(/\/>/i,Oe)){We(Ie,N);continue}pe&&Fr([D,z,U],di=>{Oe=er(Oe,di," ")});const ci=de(N.nodeName);if(!ai(ci,Cn,Oe)){We(Ie,N);continue}if(b&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!tt)switch(h.getAttributeType(ci,Cn)){case"TrustedHTML":{Oe=b.createHTML(Oe);break}case"TrustedScriptURL":{Oe=b.createScriptURL(Oe);break}}if(Oe!==Xs)try{tt?N.setAttributeNS(tt,Ie,Oe):N.setAttribute(Ie,Oe),Js(N)?at(N):Sl(t.removed)}catch{We(Ie,N)}}Ft($.afterSanitizeAttributes,N,null)},Df=function Q(N){let M=null;const Y=ri(N);for(Ft($.beforeSanitizeShadowDOM,N,null);M=Y.nextNode();)Ft($.uponSanitizeShadowNode,M,null),oi(M),li(M),M.content instanceof a&&Q(M.content);Ft($.afterSanitizeShadowDOM,N,null)};return t.sanitize=function(Q){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=null,Y=null,ge=null,Be=null;if(Yn=!Q,Yn&&(Q="<!-->"),typeof Q!="string"&&!si(Q))if(typeof Q.toString=="function"){if(Q=Q.toString(),typeof Q!="string")throw tr("dirty is not a string, aborting")}else throw tr("toString is not a function");if(!t.isSupported)return Q;if(Je||Fe(N),t.removed=[],typeof Q=="string"&&(sn=!1),sn){if(Q.nodeName){const Bt=de(Q.nodeName);if(!re[Bt]||fe[Bt])throw tr("root node is forbidden and cannot be sanitized in-place")}}else if(Q instanceof l)M=Qs("<!---->"),Y=M.ownerDocument.importNode(Q,!0),Y.nodeType===rr.element&&Y.nodeName==="BODY"||Y.nodeName==="HTML"?M=Y:M.appendChild(Y);else{if(!Dt&&!pe&&!He&&Q.indexOf("<")===-1)return b&&xn?b.createHTML(Q):Q;if(M=Qs(Q),!M)return Dt?null:xn?S:""}M&&Ze&&at(M.firstChild);const Ie=ri(sn?Q:M);for(;ge=Ie.nextNode();)oi(ge),li(ge),ge.content instanceof a&&Df(ge.content);if(sn)return Q;if(Dt){if(Xe)for(Be=E.call(M.ownerDocument);M.firstChild;)Be.appendChild(M.firstChild);else Be=M;return(L.shadowroot||L.shadowrootmode)&&(Be=F.call(r,Be,!0)),Be}let tt=He?M.outerHTML:M.innerHTML;return He&&re["!doctype"]&&M.ownerDocument&&M.ownerDocument.doctype&&M.ownerDocument.doctype.name&&qe(xf,M.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+M.ownerDocument.doctype.name+`>
|
|
84
|
+
`+tt),pe&&Fr([D,z,U],Bt=>{tt=er(tt,Bt," ")}),b&&xn?b.createHTML(tt):tt},t.setConfig=function(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fe(Q),Je=!0},t.clearConfig=function(){Ee=null,Je=!1},t.isValidAttribute=function(Q,N,M){Ee||Fe({});const Y=de(Q),ge=de(N);return ai(Y,ge,M)},t.addHook=function(Q,N){typeof N=="function"&&Xn($[Q],N)},t.removeHook=function(Q,N){if(N!==void 0){const M=IS($[Q],N);return M===-1?void 0:TS($[Q],M,1)[0]}return Sl($[Q])},t.removeHooks=function(Q){$[Q]=[]},t.removeAllHooks=function(){$=Al()},t}var So=vf();function bf({faq:e,className:t,expanded:n,defaultExpanded:r=!1,onExpandedChange:s,showKeywords:a=!1,dangerouslySetAnswerHTML:i=!1}){const[l,c]=m.useState(r),d=n!==void 0,f=d?n:l,u=()=>{const g=!f;d||c(g),s?.(g)};return o.jsxs("div",{className:C("border border-neutral-200 rounded-lg overflow-hidden dark:border-neutral-800",t),children:[o.jsxs("button",{type:"button",onClick:u,className:C("w-full flex items-center justify-between px-4 py-3 text-left","bg-neutral-50 hover:bg-neutral-100 dark:bg-neutral-900 dark:hover:bg-neutral-800","transition-colors duration-150"),"aria-expanded":f,children:[o.jsx("span",{className:"font-medium text-neutral-900 dark:text-neutral-100 pr-4",children:e.question}),o.jsx("svg",{className:C("w-5 h-5 text-neutral-500 transition-transform duration-200 flex-shrink-0",f&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&o.jsxs("div",{className:"px-4 py-3 bg-white dark:bg-neutral-950",children:[i?o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400 prose prose-sm dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:(()=>{So.addHook("afterSanitizeAttributes",h=>{h.tagName==="A"&&h.setAttribute("rel","noopener noreferrer")});const g=So.sanitize(e.answer,{ALLOWED_TAGS:["b","i","em","strong","a","p","br","ul","ol","li"],ALLOWED_ATTR:["href","target","rel"]});return So.removeAllHooks(),g})()}}):o.jsx("p",{className:"text-sm text-neutral-600 dark:text-neutral-400 whitespace-pre-wrap",children:e.answer}),a&&e.keywords&&e.keywords.length>0&&o.jsx("div",{className:"mt-3 flex flex-wrap gap-1",children:e.keywords.map(g=>o.jsx("span",{className:"px-2 py-0.5 text-xs bg-neutral-100 text-neutral-600 rounded dark:bg-neutral-800 dark:text-neutral-400",children:g},g))})]})]})}function GS({faqs:e,className:t,accordion:n=!1,showKeywords:r=!1,dangerouslySetAnswerHTML:s=!1,emptyMessage:a="No FAQs available."}){const[i,l]=m.useState(null),c=e.filter(d=>d.active!==!1);return c.length===0?o.jsx("div",{className:C("text-center py-8 text-neutral-500 dark:text-neutral-400",t),children:a}):o.jsx("div",{className:C("space-y-2",t),children:c.map(d=>o.jsx(bf,{faq:d,showKeywords:r,dangerouslySetAnswerHTML:s,expanded:n?i===d.id:void 0,onExpandedChange:n?f=>l(f?d.id:null):void 0},d.id))})}function Te({amount:e,currency:t}){return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e)}function qs({amount:e,currency:t,compareAt:n,className:r,size:s="default"}){const a=typeof n=="number"&&n>e;return o.jsxs("div",{className:C("flex items-baseline gap-2 tabular-nums",r),children:[o.jsx("span",{className:C("font-semibold",s==="sm"?"text-sm":"text-base"),children:Te({amount:e,currency:t})}),a?o.jsx("span",{className:C("text-neutral-500 line-through dark:text-neutral-400",s==="sm"?"text-xs":"text-sm"),children:Te({amount:n,currency:t})}):null]})}const YS={securities:{label:"Security",className:"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-200"},commodities:{label:"Commodity",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-200"},property:{label:"Property",className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-200"},collectibles:{label:"Collectible",className:"bg-purple-100 text-purple-800 dark:bg-purple-900/50 dark:text-purple-200"}},KS={label:"Tokenized Asset",className:"bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300"};function Za({assetClass:e}){const{label:t,className:n}=YS[e.toLowerCase()]??KS;return o.jsx(dt,{className:n,children:t})}const Il={large:"aspect-[4/5]",square:"aspect-square",compact:"aspect-[3/4]"},Tl={center:"object-center",top:"object-top",bottom:"object-bottom",left:"object-left",right:"object-right"};function yf({product:e,href:t,onAddToCart:n,onQuickView:r,className:s,layout:a="large",imageCrop:i="center"}){const l=e.inventoryStatus==="out_of_stock"||typeof e.inventoryQuantity=="number"&&e.inventoryQuantity<=0,c=typeof e.inventoryQuantity=="number"?e.inventoryQuantity:null;return o.jsxs(Ve,{className:C("group flex h-full flex-col overflow-hidden rounded-2xl",s),children:[o.jsxs("div",{className:"relative",children:[t?o.jsx("a",{href:t,className:"block","aria-label":`View ${e.title}`,children:o.jsx("div",{className:C("overflow-hidden bg-neutral-100 dark:bg-neutral-900",Il[a]),children:o.jsx("img",{src:e.images[0]?.url,alt:e.images[0]?.alt??e.title,className:C("h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.03]",Tl[i]),loading:"lazy"})})}):o.jsx("div",{className:C("overflow-hidden bg-neutral-100 dark:bg-neutral-900",Il[a]),children:o.jsx("img",{src:e.images[0]?.url,alt:e.images[0]?.alt??e.title,className:C("h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.03]",Tl[i]),loading:"lazy"})}),a!=="compact"&&e.tags?.length?o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 flex gap-1 p-3",children:e.tags.slice(0,2).map(d=>o.jsx(dt,{className:"pointer-events-none bg-white/90 text-neutral-900 backdrop-blur dark:bg-neutral-950/80 dark:text-neutral-50",children:d},d))}):null,e.tokenizedAssetConfig?o.jsx("div",{className:"pointer-events-none absolute right-3 bottom-3",children:o.jsx(Za,{assetClass:e.tokenizedAssetConfig?.assetClass??""})}):null,l?o.jsx("div",{className:"pointer-events-none absolute left-3 top-3",children:o.jsx(dt,{variant:"secondary",className:"bg-white/90 text-neutral-900 backdrop-blur dark:bg-neutral-950/80 dark:text-neutral-50",children:"Out of stock"})}):c!=null&&c>0&&c<=5?o.jsx("div",{className:"pointer-events-none absolute left-3 top-3",children:o.jsxs(dt,{variant:"secondary",className:"bg-white/90 text-neutral-900 backdrop-blur dark:bg-neutral-950/80 dark:text-neutral-50",children:["Only ",c," left"]})}):null,r?o.jsx("div",{className:"absolute right-3 top-3 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(H,{type:"button",size:"sm",variant:"secondary",className:"h-9",onClick:()=>r(e),children:"Quick view"})}):null]}),o.jsxs("div",{className:C("flex flex-1 flex-col",a==="compact"?"p-3":"p-4"),children:[o.jsx("div",{className:"flex items-start justify-between gap-3",children:o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:C("line-clamp-1 font-medium text-neutral-950 dark:text-neutral-50",a==="compact"?"text-xs":"text-sm"),children:e.title}),o.jsx("div",{className:"mt-1",children:o.jsx(qs,{amount:e.price,currency:e.currency,compareAt:e.compareAtPrice,size:a==="compact"?"sm":"default"})})]})}),a==="large"&&o.jsx("p",{className:"mt-2 line-clamp-2 min-h-8 text-xs leading-4 text-neutral-600 dark:text-neutral-400",children:e.description}),o.jsx("div",{className:C("mt-auto",a==="compact"?"pt-3":"pt-4"),children:o.jsx(H,{type:"button",className:"w-full",size:a==="compact"?"sm":"default",onClick:()=>n?.(e,null),disabled:l,children:l?"Out of stock":"Add to cart"})})]})]})}function Gs({products:e,columns:t,onAddToCart:n,onQuickView:r,getProductHref:s,className:a,layout:i,imageCrop:l}){const c=t?.base??2,d=t?.md??3,f=t?.lg??3,u={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"},g={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4"},h={1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4"},x=C("grid gap-4",u[Math.min(4,Math.max(1,c))],g[Math.min(4,Math.max(1,d))],h[Math.min(4,Math.max(1,f))]);return o.jsx("div",{className:C(x,a),children:e.map(p=>o.jsx(yf,{product:p,href:s?s(p):void 0,onAddToCart:n,onQuickView:r,layout:i,imageCrop:l},p.id))})}function Wa({images:e,className:t}){const[n,r]=m.useState(0),s=e[n];return e.length===0?o.jsx("div",{className:C("aspect-square w-full rounded-xl border border-neutral-200 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900",t)}):o.jsxs("div",{className:C("space-y-3",t),children:[o.jsx("div",{className:"aspect-square overflow-hidden rounded-2xl border border-neutral-200 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900",children:o.jsx("img",{src:s?.url,alt:s?.alt??"",className:"h-full w-full object-cover",loading:"eager"})}),e.length>1?o.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1",children:e.map((a,i)=>{const l=i===n;return o.jsx("button",{type:"button",className:C("h-16 w-16 shrink-0 overflow-hidden rounded-lg border",l?"border-neutral-900 dark:border-neutral-50":"border-neutral-200 dark:border-neutral-800"),onClick:()=>r(i),"aria-label":`View image ${i+1}`,children:o.jsx("img",{src:a.url,alt:a.alt??"",className:"h-full w-full object-cover",loading:"lazy"})},a.url)})}):null]})}function QS(e){const t=new Set;for(const n of e)for(const r of Object.keys(n.options))t.add(r);return Array.from(t)}function JS(e,t){const n=new Set;for(const r of e){const s=r.options[t];s&&n.add(s)}return Array.from(n)}function Pl(e,t){return e.find(n=>Object.entries(t).every(([r,s])=>n.options[r]===s))??null}function wf(e){return e.inventoryStatus==="out_of_stock"||typeof e.inventoryQuantity=="number"&&e.inventoryQuantity<=0}function XS(e){return e.inventoryStatus==="low"||typeof e.inventoryQuantity=="number"&&e.inventoryQuantity>0&&e.inventoryQuantity<=5}function eN(e){const t=wf(e),n=!t&&XS(e),r=typeof e.inventoryQuantity=="number"?e.inventoryQuantity:void 0;return{isOutOfStock:t,isLow:n,quantity:r}}function tN(e,t,n,r){const s={...t,[n]:r},a=e.filter(i=>Object.entries(s).every(([l,c])=>i.options[l]===c));return a.length===0?!1:a.some(i=>!wf(i))}function qa({product:e,value:t,onChange:n,className:r,showInventory:s=!0,disableOutOfStock:a=!1}){const i=m.useMemo(()=>e.variants??[],[e.variants]),l=m.useMemo(()=>QS(i),[i]),c=m.useMemo(()=>Pl(i,t.selectedOptions),[i,t.selectedOptions]),d=m.useMemo(()=>c?eN(c):null,[c]);return i.length===0||l.length===0?null:o.jsxs("div",{className:C("space-y-4",r),children:[l.map(f=>{const u=JS(i,f),g=t.selectedOptions[f];return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-baseline justify-between",children:[o.jsx("div",{className:"text-sm font-medium text-neutral-950 dark:text-neutral-50",children:f}),o.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:g||"Select"})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(h=>{const x=h===g,p=tN(i,t.selectedOptions,f,h),v=a&&!p;return o.jsxs(H,{type:"button",size:"sm",variant:x?"default":"outline",onClick:()=>{const w={...t.selectedOptions,[f]:h},y=Pl(i,w);n({selectedOptions:w,variant:y})},"aria-pressed":x,disabled:v,className:C(!p&&!v&&"opacity-50 line-through"),children:[h,!p&&!v&&o.jsx("span",{className:"ml-1 text-[10px] opacity-70",children:"(Out)"})]},h)})})]},f)}),s&&c&&d&&o.jsx("div",{className:"pt-2",children:d.isOutOfStock?o.jsx("div",{className:"text-sm font-medium text-red-600 dark:text-red-400",children:"Out of stock"}):d.isLow&&d.quantity!==void 0?o.jsxs("div",{className:"text-sm text-amber-600 dark:text-amber-400",children:["Only ",o.jsx("span",{className:"font-semibold",children:d.quantity})," left"]}):null})]})}function Ga({qty:e,onChange:t,min:n=1,max:r,className:s}){const a=Number.isFinite(e)?Math.max(n,Math.floor(e)):n,i=a>n,l=typeof r=="number"?a<r:!0;return o.jsxs("div",{className:C("flex items-center gap-2",s),children:[o.jsx(H,{type:"button",size:"icon",variant:"outline",onClick:()=>t(Math.max(n,a-1)),disabled:!i,"aria-label":"Decrease quantity",children:"-"}),o.jsx(ke,{inputMode:"numeric",pattern:"[0-9]*",value:String(a),onChange:c=>{const d=Math.floor(Number(c.target.value));if(!Number.isFinite(d))return;const f=Math.max(n,typeof r=="number"?Math.min(r,d):d);t(f)},className:"h-10 w-16 text-center","aria-label":"Quantity"}),o.jsx(H,{type:"button",size:"icon",variant:"outline",onClick:()=>t(a+1),disabled:!l,"aria-label":"Increase quantity",children:"+"})]})}function Ya({product:e,open:t,onOpenChange:n,productHref:r,onAddToCart:s,className:a}){const[i,l]=m.useState(1),[c,d]=m.useState({selectedOptions:{},variant:null});if(m.useEffect(()=>{if(e)if(l(1),e.variants?.length){const p=e.variants[0];d({selectedOptions:{...p.options},variant:p})}else d({selectedOptions:{},variant:null})},[e?.id]),!e)return null;const f=c.variant?.price??e.price,u=c.variant?.compareAtPrice??e.compareAtPrice,g=c.variant?.inventoryStatus==="out_of_stock"||typeof c.variant?.inventoryQuantity=="number"&&c.variant.inventoryQuantity<=0,h=e.inventoryStatus==="out_of_stock"||typeof e.inventoryQuantity=="number"&&e.inventoryQuantity<=0,x=c.variant?g:h;return o.jsx(Ta,{open:t,onOpenChange:n,children:o.jsxs(Ms,{className:C("max-w-3xl",a),children:[o.jsx(Ra,{children:o.jsxs(Ds,{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"truncate",children:e.title}),r?o.jsx("a",{href:r(e.slug),className:"text-sm font-normal text-neutral-700 hover:underline dark:text-neutral-300",children:"View details"}):null]})}),o.jsxs("div",{className:"grid gap-8 md:grid-cols-2",children:[o.jsx(Wa,{images:e.images}),o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsx(qs,{amount:f,currency:e.currency,compareAt:u}),o.jsx("p",{className:"mt-3 text-sm text-neutral-600 dark:text-neutral-400",children:e.description})]}),o.jsx(qa,{product:e,value:{selectedOptions:c.selectedOptions,variantId:c.variant?.id},onChange:p=>d(p)}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsx(Ga,{qty:i,onChange:l}),o.jsx(H,{type:"button",className:"flex-1",disabled:x,onClick:()=>{s(e,c.variant,i),n(!1)},children:x?"Out of stock":"Add to cart"})]}),o.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:x?"Out of stock":"In stock"})]})]})]})})}function Yo({categories:e,activeSlug:t,onSelect:n,className:r}){return o.jsx("nav",{className:C("space-y-1",r),"aria-label":"Categories",children:e.map(s=>{const a=t===s.slug;return o.jsxs("button",{type:"button",className:C("flex w-full items-center justify-between rounded-md px-3 py-2 text-sm transition-colors",a?"bg-neutral-900 text-neutral-50 dark:bg-neutral-50 dark:text-neutral-900":"text-neutral-700 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"),onClick:()=>n?.(s),"aria-current":a?"page":void 0,children:[o.jsx("span",{className:"truncate",children:s.name}),o.jsx("span",{className:"text-xs opacity-70",children:"›"})]},s.id)})})}function Ka({items:e,className:t}){return o.jsx("nav",{className:C("flex items-center gap-2 text-xs text-neutral-600 dark:text-neutral-400",t),"aria-label":"Breadcrumb",children:e.map((n,r)=>o.jsxs("span",{className:"flex items-center gap-2",children:[n.href?o.jsx("a",{href:n.href,className:"hover:underline",children:n.label}):o.jsx("span",{className:"text-neutral-900 dark:text-neutral-50",children:n.label}),r<e.length-1?o.jsx("span",{"aria-hidden":!0,children:"·"}):null]},`${n.label}-${r}`))})}function Qa({value:e,onChange:t,placeholder:n="Search products…",className:r}){return o.jsxs("div",{className:C("relative",r),children:[o.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-3 flex items-center text-neutral-500 dark:text-neutral-400","aria-hidden":!0,children:"⌕"}),o.jsx(ke,{value:e,onChange:s=>t(s.target.value),placeholder:n,className:"pl-9","aria-label":"Search"})]})}function ms({facets:e,value:t,onChange:n,onClear:r,className:s,enabledFilters:a}){const i=e.tags??[],l=new Set(t.tags??[]),c=a?.tags??!0,d=a?.priceRange??!0,f=a?.inStock??!0;return c||d||f?o.jsxs("div",{className:C("space-y-4",s),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Filters"}),o.jsx(H,{type:"button",variant:"ghost",className:"h-8 px-2 text-xs",onClick:r,children:"Clear"})]}),o.jsx(rt,{}),c&&i.length?o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-sm font-medium",children:"Tags"}),o.jsx("div",{className:"space-y-2",children:i.map(g=>o.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[o.jsx("input",{type:"checkbox",checked:l.has(g),onChange:h=>{const x=new Set(l);h.target.checked?x.add(g):x.delete(g),n({...t,tags:Array.from(x)})}}),g]},g))})]}):null,d&&e.price?o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-sm font-medium",children:"Price"}),o.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(De,{className:"text-xs",htmlFor:"price-min",children:"Min"}),o.jsx(ke,{id:"price-min",inputMode:"decimal",placeholder:String(e.price.min),value:t.priceMin??"",onChange:g=>{const h=Number(g.target.value);n({...t,priceMin:Number.isFinite(h)&&g.target.value!==""?h:void 0})}})]}),o.jsxs("div",{className:"grid gap-1",children:[o.jsx(De,{className:"text-xs",htmlFor:"price-max",children:"Max"}),o.jsx(ke,{id:"price-max",inputMode:"decimal",placeholder:String(e.price.max),value:t.priceMax??"",onChange:g=>{const h=Number(g.target.value);n({...t,priceMax:Number.isFinite(h)&&g.target.value!==""?h:void 0})}})]})]})]}):null,f?o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-sm font-medium",children:"Availability"}),o.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[o.jsx("input",{type:"checkbox",checked:t.inStock??!1,onChange:g=>n({...t,inStock:g.target.checked})}),"In stock"]})]}):null]}):null}function Rl(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}function nN(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M3 6h18"}),o.jsx("path",{d:"M8 6V4h8v2"}),o.jsx("path",{d:"M6 6l1 16h10l1-16"}),o.jsx("path",{d:"M10 11v6"}),o.jsx("path",{d:"M14 11v6"})]})}function Ja({item:e,onRemove:t,onSetQty:n,variant:r="table",className:s,inventory:a}){const i=e.unitPrice*e.qty,[l,c]=m.useState(!1),d=m.useMemo(()=>{if(a?.availableQty)return a.availableQty},[a?.availableQty]),f=!a?.isOutOfStock&&(d===void 0||e.qty<d),u=m.useMemo(()=>a?a.isOutOfStock?{type:"error",message:a.message||"Out of stock"}:a.exceedsAvailable?{type:"warning",message:a.message||"Quantity exceeds available stock"}:a.isLowStock?{type:"info",message:a.message||"Low stock"}:null:null,[a]);return m.useEffect(()=>{l&&e.qty!==1&&c(!1)},[l,e.qty]),r==="compact"?o.jsxs("div",{className:C("flex items-start gap-3",s),children:[o.jsx("div",{className:"h-12 w-12 shrink-0 overflow-hidden rounded-lg border border-neutral-200 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900",children:e.imageSnapshot?o.jsx("img",{src:e.imageSnapshot,alt:e.titleSnapshot,className:"h-full w-full object-cover"}):null}),o.jsx("div",{className:"min-w-0 flex-1",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate text-sm font-medium text-neutral-950 dark:text-neutral-50",children:e.titleSnapshot}),o.jsx("div",{className:"mt-0.5 text-xs tabular-nums text-neutral-600 dark:text-neutral-400",children:Te({amount:i,currency:e.currency})}),u&&o.jsxs("div",{className:C("mt-1 flex items-center gap-1 text-[11px]",u.type==="error"&&"text-red-600 dark:text-red-400",u.type==="warning"&&"text-amber-600 dark:text-amber-400",u.type==="info"&&"text-blue-600 dark:text-blue-400"),children:[o.jsx(Rl,{className:"h-3 w-3 shrink-0"}),o.jsx("span",{children:u.message})]})]}),o.jsx("div",{className:"flex h-12 w-[140px] shrink-0 items-center justify-end",children:l?o.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[o.jsx("div",{className:"text-center text-[11px] font-medium leading-none text-neutral-600 dark:text-neutral-400",children:"Remove item?"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(H,{type:"button",variant:"outline",className:"h-7 w-[62px] px-0 text-[11px] leading-none",onClick:()=>c(!1),children:"Cancel"}),o.jsx(H,{type:"button",variant:"destructive",className:"h-7 w-[62px] px-0 text-[11px] leading-none",onClick:t,children:"Confirm"})]})]}):o.jsxs("div",{className:"flex items-center justify-end gap-1.5 whitespace-nowrap",children:[o.jsx(H,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8","aria-label":e.qty===1?"Remove item":"Decrease quantity",onClick:()=>{if(e.qty===1){c(!0);return}n(e.qty-1)},children:e.qty===1?o.jsx(nN,{className:"h-4 w-4"}):"-"}),o.jsx(ke,{inputMode:"numeric",pattern:"[0-9]*",value:String(e.qty),onChange:g=>{const h=Math.floor(Number(g.target.value));if(!Number.isFinite(h))return;const x=Math.max(1,d?Math.min(d,h):h);n(x)},className:"h-8 w-11 px-2 text-center","aria-label":"Quantity"}),o.jsx(H,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8","aria-label":"Increase quantity",onClick:()=>n(d?Math.min(d,e.qty+1):e.qty+1),disabled:!f,children:"+"})]})})]})})]}):o.jsxs("div",{className:C("grid grid-cols-[64px_1fr] items-start gap-x-4 gap-y-3 sm:grid-cols-[64px_1fr_176px_120px]",s),children:[o.jsx("div",{className:"h-16 w-16 overflow-hidden rounded-lg border border-neutral-200 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900",children:e.imageSnapshot?o.jsx("img",{src:e.imageSnapshot,alt:e.titleSnapshot,className:"h-full w-full object-cover"}):null}),o.jsxs("div",{className:"col-start-2 row-start-1 min-w-0",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsx("div",{className:"truncate text-sm font-medium text-neutral-950 dark:text-neutral-50",children:e.titleSnapshot}),o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50 sm:hidden",children:Te({amount:i,currency:e.currency})})]}),o.jsxs("div",{className:"mt-1 text-xs text-neutral-600 dark:text-neutral-400",children:[Te({amount:e.unitPrice,currency:e.currency})," each"]}),u&&o.jsxs("div",{className:C("mt-1.5 flex items-center gap-1 text-xs",u.type==="error"&&"text-red-600 dark:text-red-400",u.type==="warning"&&"text-amber-600 dark:text-amber-400",u.type==="info"&&"text-blue-600 dark:text-blue-400"),children:[o.jsx(Rl,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{children:u.message})]})]}),o.jsxs("div",{className:"col-span-2 col-start-1 row-start-2 flex items-center justify-between gap-3 sm:col-span-1 sm:col-start-3 sm:row-start-1 sm:justify-center",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(H,{type:"button",size:"icon",variant:"outline",className:"h-9 w-9","aria-label":"Decrease quantity",onClick:()=>n(Math.max(1,e.qty-1)),children:"-"}),o.jsx(ke,{inputMode:"numeric",pattern:"[0-9]*",value:String(e.qty),onChange:g=>{const h=Math.floor(Number(g.target.value));if(!Number.isFinite(h))return;const x=Math.max(1,d?Math.min(d,h):h);n(x)},className:"h-9 w-14 text-center","aria-label":"Quantity"}),o.jsx(H,{type:"button",size:"icon",variant:"outline",className:"h-9 w-9","aria-label":"Increase quantity",onClick:()=>n(d?Math.min(d,e.qty+1):e.qty+1),disabled:!f,children:"+"})]}),o.jsx(H,{type:"button",variant:"ghost",className:"h-9 px-2 text-xs text-red-600 dark:text-red-400 sm:hidden",onClick:t,children:"Remove"})]}),o.jsxs("div",{className:"hidden sm:col-start-4 sm:row-start-1 sm:flex sm:flex-col sm:items-center sm:text-center",children:[o.jsx("div",{className:"text-sm font-semibold tabular-nums text-neutral-950 dark:text-neutral-50",children:Te({amount:i,currency:e.currency})}),o.jsx(H,{type:"button",variant:"ghost",className:"mt-1 h-8 px-2 text-xs text-red-600 dark:text-red-400",onClick:t,children:"Remove"})]})]})}function Xa({currency:e,subtotal:t,itemCount:n,onCheckout:r,isCheckoutDisabled:s,checkoutDisabledReason:a,onRemoveUnavailable:i,className:l}){return o.jsxs("div",{className:C("space-y-4",l),children:[o.jsx(rt,{}),o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2 text-neutral-600 dark:text-neutral-400",children:[o.jsx("span",{children:"Subtotal"}),typeof n=="number"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-neutral-300 dark:text-neutral-700",children:"·"}),o.jsxs("span",{className:"tabular-nums",children:[n," item",n===1?"":"s"]})]}):null]}),o.jsx("span",{className:"font-semibold text-neutral-950 dark:text-neutral-50",children:Te({amount:t,currency:e})})]}),o.jsx(H,{type:"button",onClick:r,disabled:s,className:"w-full",children:"Checkout"}),s&&a&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-center text-xs text-amber-600 dark:text-amber-400",children:a}),i&&o.jsx("button",{type:"button",onClick:i,className:"mx-auto block text-xs text-neutral-500 underline underline-offset-2 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300",children:"Remove unavailable items"})]})]})}function kf({onCheckout:e,className:t}){const{config:n}=ye(),r=St(),{getItemInventory:s,hasIssues:a}=ua({items:r.items,refreshInterval:3e4,skip:r.items.length===0}),i=()=>{for(const l of r.items){const c=s(l.productId,l.variantId);(c?.isOutOfStock||c?.exceedsAvailable)&&r.removeItem(l.productId,l.variantId)}};return r.items.length===0?o.jsx(Ln,{title:"Cart is empty",description:"Add items from the catalog to check out.",className:t}):o.jsxs("div",{className:C("flex h-full flex-col rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-950",t),children:[o.jsx("div",{className:"-mr-4 min-h-0 flex-1 overflow-y-auto overflow-x-hidden pr-4",children:o.jsx("div",{className:"divide-y divide-neutral-200 dark:divide-neutral-800",children:r.items.map(l=>o.jsx("div",{className:"py-3",children:o.jsx(Ja,{variant:"compact",item:l,onRemove:()=>r.removeItem(l.productId,l.variantId),onSetQty:c=>r.setQty(l.productId,l.variantId,c),inventory:s(l.productId,l.variantId)})},`${l.productId}::${l.variantId??""}`))})}),o.jsx("div",{className:"mt-4 space-y-4",children:o.jsx(Xa,{currency:n.currency,subtotal:r.subtotal,itemCount:r.count,onCheckout:e,isCheckoutDisabled:r.items.length===0||a,checkoutDisabledReason:a?"Some items have inventory issues":void 0,onRemoveUnavailable:a?i:void 0})})]})}const Sf=m.forwardRef(({className:e,...t},n)=>o.jsx("textarea",{ref:n,className:C("flex min-h-10 w-full rounded-md border border-neutral-200 bg-white px-3 py-2 text-sm text-neutral-950 shadow-sm transition-colors placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-900/20 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50 dark:placeholder:text-neutral-400 dark:focus-visible:ring-neutral-50/20",e),...t}));Sf.displayName="Textarea";function rN(){const[e,t]=m.useState(!1);return m.useEffect(()=>{const n=window.matchMedia?.("(prefers-reduced-motion: reduce)");if(!n)return;const r=()=>t(n.matches);return r(),n.addEventListener?.("change",r),()=>n.removeEventListener?.("change",r)},[]),e}function Ol({children:e,className:t}){const n=m.useRef(null),r=rN();return m.useEffect(()=>{const s=n.current;!s||r||s.animate([{opacity:0,transform:"translateY(6px)"},{opacity:1,transform:"translateY(0px)"}],{duration:180,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)",fill:"both"})},[r]),o.jsx("div",{ref:n,className:t,children:e})}function sr(){return`${Date.now()}_${Math.random().toString(16).slice(2)}`}function sN(e){return`$${(e/100).toFixed(2)}`}function oN({product:e,onSelect:t}){return o.jsxs("button",{type:"button",onClick:()=>t?.(e.slug??e.id),className:"flex w-full items-center gap-2 rounded-lg border border-neutral-200 bg-white p-2 text-left transition-colors hover:bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:bg-neutral-800",children:[e.imageUrl&&o.jsx("img",{src:e.imageUrl,alt:e.name,className:"h-10 w-10 shrink-0 rounded object-cover"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate text-xs font-medium",children:e.name}),e.priceCents!=null&&o.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:sN(e.priceCents)})]})]})}function aN({faq:e}){const[t,n]=m.useState(!1);return o.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"w-full rounded-lg border border-neutral-200 bg-white p-2 text-left transition-colors hover:bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:bg-neutral-800",children:[o.jsx("div",{className:"text-xs font-medium",children:e.question}),t&&o.jsx("div",{className:"mt-1 text-xs text-neutral-600 dark:text-neutral-400",children:e.answer})]})}function Nf({className:e,onProductSelect:t}){const r=gs()?.config.adapter,s=!!r?.sendChatMessage,[a,i]=m.useState(""),[l,c]=m.useState(!1),[d,f]=m.useState(null),u=m.useRef(void 0),[g,h]=m.useState(()=>[{id:sr(),role:"agent",text:"Hi! How can we help today? We can recommend products or answer support questions.",createdAt:Date.now()}]),[x,p]=m.useState("…");m.useEffect(()=>{if(!l)return;const b=[".","..","..."];let S=0;const A=window.setInterval(()=>{S=(S+1)%b.length,p(b[S])},450);return()=>window.clearInterval(A)},[l]);const v=m.useRef(null),w=m.useRef(null);m.useEffect(()=>{const b=v.current;b&&(b.scrollTop=b.scrollHeight)},[g.length]);const y=m.useCallback(()=>{const b=w.current;if(!b)return;const S=120;b.style.height="0px";const A=Math.min(S,Math.max(40,b.scrollHeight));b.style.height=`${A}px`,b.style.overflowY=b.scrollHeight>S?"auto":"hidden"},[]);m.useEffect(()=>{y()},[a,y]);const k=m.useCallback(async()=>{const b=a.trim();if(!(!b||l)){if(h(S=>[...S,{id:sr(),role:"user",text:b,createdAt:Date.now()}]),i(""),f(null),c(!0),!s||!r?.sendChatMessage){window.setTimeout(()=>{h(S=>[...S,{id:sr(),role:"agent",text:"Chat is not configured. Please contact support.",createdAt:Date.now()}]),c(!1)},300);return}try{const S=await r.sendChatMessage({sessionId:u.current,message:b});u.current=S.sessionId,h(A=>[...A,{id:sr(),role:"agent",text:S.message,products:S.products,faqs:S.faqs,createdAt:Date.now()}])}catch(S){const A=S instanceof Error?S.message:"Something went wrong";f(A),h(I=>[...I,{id:sr(),role:"agent",text:"Sorry, I had trouble processing that. Please try again.",createdAt:Date.now()}])}finally{c(!1)}}},[a,l,s,r]);return o.jsxs("div",{className:C("flex h-full min-h-0 flex-col",e),children:[o.jsxs("div",{ref:v,className:"min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain rounded-2xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-950",children:[g.map(b=>o.jsx(Ol,{className:C("flex",b.role==="user"?"justify-end":"justify-start"),children:o.jsxs("div",{className:C("max-w-[85%]",b.role==="user"?"":"space-y-2"),children:[o.jsx("div",{className:C("rounded-2xl px-3 py-2 text-sm leading-5",b.role==="user"?"bg-neutral-900 text-neutral-50 dark:bg-neutral-50 dark:text-neutral-900":"bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-50"),children:o.jsx("span",{className:"whitespace-pre-wrap break-words",children:b.text})}),b.products&&b.products.length>0&&o.jsx("div",{className:"space-y-1",children:b.products.map(S=>o.jsx(oN,{product:S,onSelect:t},S.id))}),b.faqs&&b.faqs.length>0&&o.jsx("div",{className:"space-y-1",children:b.faqs.map(S=>o.jsx(aN,{faq:S},S.id))})]})},b.id)),l?o.jsx(Ol,{className:"flex justify-start",children:o.jsx("div",{className:"max-w-[85%] rounded-2xl bg-neutral-100 px-3 py-2 text-sm leading-5 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-50",children:x})}):null]}),d&&o.jsx("div",{className:"mt-1 text-xs text-red-500 dark:text-red-400",children:d}),o.jsxs("div",{className:"mt-3 flex shrink-0 items-end gap-2",children:[o.jsx(Sf,{ref:w,rows:1,value:a,onChange:b=>i(b.target.value),placeholder:"Type a message…",className:"max-h-[120px] resize-none",onKeyDown:b=>{b.key==="Enter"&&(b.shiftKey||(b.preventDefault(),k()))}}),o.jsx(H,{type:"button",onClick:k,disabled:!a.trim()||l,className:"h-10 shrink-0",children:"Send"})]})]})}function yr({trigger:e,side:t="right",open:n,onOpenChange:r,onCheckout:s,preferredTab:a,className:i}){const[l,c]=m.useState(a??"cart");return m.useEffect(()=>{n&&c(a??"cart")},[n,a]),o.jsxs(zs,{modal:!1,open:n,onOpenChange:r,children:[e?o.jsx(Ls,{asChild:!0,children:e}):null,o.jsxs(Sr,{side:t,overlayClassName:t==="popup"?"pointer-events-none bg-transparent backdrop-blur-none":"pointer-events-none bg-neutral-950/40 backdrop-blur-none",className:C(t==="bottom"?"h-[85vh] rounded-t-2xl":void 0,t==="popup"?"shadow-xl":"w-full sm:max-w-md",t==="popup"?"h-[min(640px,calc(100vh-2rem))]":void 0,t==="popup"?void 0:"p-4","flex flex-col overflow-hidden",i),children:[o.jsx($s,{className:"space-y-0",children:o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(Va,{value:l,onValueChange:d=>c(d),children:o.jsxs(Zs,{className:"h-9",children:[o.jsx(br,{value:"cart",className:"text-sm",children:"Cart"}),o.jsx(br,{value:"chat",className:"text-sm",children:"Chat"})]})}),o.jsx(ju,{asChild:!0,children:o.jsx(H,{type:"button",size:"icon",variant:"ghost",className:"h-9 w-9 rounded-full text-lg leading-none","aria-label":"Close cart",children:"X"})})]})}),o.jsx("div",{className:"mt-3 min-h-0 flex-1 overflow-hidden",children:l==="chat"?o.jsxs("div",{className:"flex h-full flex-col",children:[o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Get help finding a product or ask us any questions. We’re both your shopping assistant and support chat."}),o.jsx("div",{className:"mt-3 min-h-0 flex-1",children:o.jsx(Nf,{className:"h-full"})})]}):o.jsx(kf,{onCheckout:()=>{s(),r?.(!1)},className:"h-full border-0 bg-transparent p-0 shadow-none"})})]})]})}function ei({value:e,onApply:t,className:n}){const[r,s]=m.useState(e??"");return m.useEffect(()=>{s(e??"")},[e]),o.jsxs("div",{className:C("space-y-2",n),children:[o.jsx("div",{className:"text-sm font-medium text-neutral-950 dark:text-neutral-50",children:"Promo code"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ke,{value:r,onChange:a=>s(a.target.value),placeholder:"SAVE10","aria-label":"Promo code"}),o.jsx(H,{type:"button",variant:"outline",onClick:()=>t(r.trim()||void 0),children:"Apply"})]})]})}function jf({onCheckout:e,showPromoCode:t,className:n}){const{config:r}=ye(),s=St(),{getItemInventory:a,hasIssues:i}=ua({items:s.items,refreshInterval:3e4,skip:s.items.length===0}),l=()=>{for(const c of s.items){const d=a(c.productId,c.variantId);(d?.isOutOfStock||d?.exceedsAvailable)&&s.removeItem(c.productId,c.variantId)}};return s.items.length===0?o.jsx(Ln,{title:"Your cart is empty",description:"Add a few products and come back here when you're ready to check out.",className:n}):o.jsxs("div",{className:C("grid items-start gap-6 lg:grid-cols-[1fr_360px]",n),children:[o.jsxs("div",{className:"self-start rounded-2xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950",children:[o.jsxs("div",{className:"hidden grid-cols-[64px_1fr_176px_120px] gap-x-4 px-5 py-3 text-xs font-medium text-neutral-500 dark:text-neutral-400 sm:grid",children:[o.jsx("div",{}),o.jsx("div",{children:"Item"}),o.jsx("div",{className:"text-center",children:"Qty"}),o.jsx("div",{className:"text-center",children:"Total"})]}),o.jsx("div",{className:"divide-y divide-neutral-200 dark:divide-neutral-800",children:s.items.map(c=>o.jsx("div",{className:"px-4 py-4 sm:px-5",children:o.jsx(Ja,{item:c,onRemove:()=>s.removeItem(c.productId,c.variantId),onSetQty:d=>s.setQty(c.productId,c.variantId,d),inventory:a(c.productId,c.variantId)})},`${c.productId}::${c.variantId??""}`))})]}),o.jsx("div",{className:"lg:sticky lg:top-24 self-start",children:o.jsxs("div",{className:"rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm dark:border-neutral-800 dark:bg-neutral-950",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Summary"}),o.jsx(rt,{className:"my-4"}),o.jsxs("div",{className:"space-y-4",children:[t?o.jsx(ei,{value:s.promoCode,onApply:s.setPromoCode}):null,o.jsx(Xa,{currency:r.currency,subtotal:s.subtotal,onCheckout:e,isCheckoutDisabled:s.items.length===0||i,checkoutDisabledReason:i?"Some items have inventory issues":void 0,onRemoveUnavailable:i?l:void 0})]})]})})]})}function Cf({left:e,right:t,className:n}){return o.jsxs("div",{className:C("grid items-start gap-8 lg:grid-cols-[1fr_420px]",n),children:[o.jsx("div",{children:e}),o.jsx("div",{children:t})]})}function Ko({title:e,value:t,onChange:n,errors:r,className:s}){return o.jsxs("section",{className:C("space-y-4 rounded-2xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-950",s),children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:e}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:`${e}-line1`,children:"Address line 1"}),o.jsx(ke,{id:`${e}-line1`,value:t.line1,onChange:a=>n({...t,line1:a.target.value}),"aria-invalid":!!r?.line1}),r?.line1?o.jsx("div",{className:"text-xs text-red-600",children:r.line1}):null]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:`${e}-line2`,children:"Address line 2"}),o.jsx(ke,{id:`${e}-line2`,value:t.line2??"",onChange:a=>n({...t,line2:a.target.value})})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:`${e}-city`,children:"City"}),o.jsx(ke,{id:`${e}-city`,value:t.city,onChange:a=>n({...t,city:a.target.value}),"aria-invalid":!!r?.city}),r?.city?o.jsx("div",{className:"text-xs text-red-600",children:r.city}):null]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:`${e}-state`,children:"State"}),o.jsx(ke,{id:`${e}-state`,value:t.state??"",onChange:a=>n({...t,state:a.target.value})})]})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:`${e}-postal`,children:"Postal code"}),o.jsx(ke,{id:`${e}-postal`,value:t.postalCode,onChange:a=>n({...t,postalCode:a.target.value}),"aria-invalid":!!r?.postalCode}),r?.postalCode?o.jsx("div",{className:"text-xs text-red-600",children:r.postalCode}):null]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:`${e}-country`,children:"Country"}),o.jsx(ke,{id:`${e}-country`,value:t.country,onChange:a=>n({...t,country:a.target.value}),"aria-invalid":!!r?.country}),r?.country?o.jsx("div",{className:"text-xs text-red-600",children:r.country}):null]})]})]})]})}function iN({message:e}){return e?o.jsx("div",{className:"text-xs text-red-600",children:e}):null}function _f({defaultOpen:e=!1,label:t="Send as a gift"}){const n=wr(),[r,s]=j.useState(e||!!(n.values.recipientEmail||n.values.giftMessage)),a=()=>{const i=!r;s(i),i||(n.setField("recipientEmail",""),n.setField("giftMessage",""))};return o.jsxs("section",{className:"space-y-4 rounded-2xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-950",children:[o.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"h-4 w-4 rounded border-neutral-300 text-neutral-900 focus:ring-neutral-500 dark:border-neutral-600 dark:bg-neutral-800"}),o.jsx("span",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:t})]}),r&&o.jsxs("div",{className:"grid gap-3 pl-7",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:"gift-recipient-email",children:"Recipient email"}),o.jsx(ke,{id:"gift-recipient-email",type:"email",value:n.values.recipientEmail??"",onChange:i=>n.setField("recipientEmail",i.target.value),placeholder:"recipient@example.com","aria-invalid":!!n.fieldErrors.recipientEmail}),o.jsx(iN,{message:n.fieldErrors.recipientEmail}),o.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"The recipient will receive an email with details on how to claim their gift."})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:"gift-message",children:"Gift message (optional)"}),o.jsx("textarea",{id:"gift-message",value:n.values.giftMessage??"",onChange:i=>n.setField("giftMessage",i.target.value),placeholder:"Add a personal message...",maxLength:500,rows:3,className:"w-full resize-y rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-neutral-500 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-50 dark:placeholder-neutral-500"}),n.values.giftMessage&&o.jsxs("div",{className:"text-right text-xs text-neutral-400",children:[n.values.giftMessage.length,"/500"]})]})]})]})}function Ef({methods:e,value:t,onChange:n,currency:r,className:s}){return e.length===0?null:o.jsxs("section",{className:C("space-y-4 rounded-2xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-950",s),children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Shipping method"}),o.jsx("div",{className:"space-y-2",children:e.map(a=>{const i=a.id===t;return o.jsxs(H,{type:"button",variant:i?"default":"outline",className:"h-auto w-full justify-between px-4 py-3",onClick:()=>n(a.id),"aria-pressed":i,children:[o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"text-sm font-medium",children:a.label}),a.detail?o.jsx("div",{className:"text-xs opacity-80",children:a.detail}):null]}),o.jsx("div",{className:"text-sm font-semibold",children:Te({amount:a.price,currency:a.currency||r})})]},a.id)})})]})}function Ur({message:e}){return e?o.jsx("div",{className:"text-xs text-red-600",children:e}):null}function Af({className:e}){const{config:t}=ye(),n=wr(),r=St(),s=t.checkout.mode,a=m.useMemo(()=>Zr(r.items,{requireEmail:t.checkout.requireEmail??!0,defaultMode:s,allowShipping:t.checkout.allowShipping??!1}),[r.items,t.checkout.allowShipping,t.checkout.requireEmail,s]),i=(t.checkout.allowShipping??!1)&&a.shippingAddress&&(s==="shipping"||s==="full"),l=a.email!=="none"||a.name!=="none"||a.phone!=="none",c=r.items.some(x=>x.metadata?.product_type==="gift_card"),d=m.useMemo(()=>{const x=new Set;for(const p of r.items)p.metadata?.regulatoryNotice&&x.add(p.metadata.regulatoryNotice);return Array.from(x)},[r.items]),f={line1:"",line2:"",city:"",state:"",postalCode:"",country:"US"},u=n.values.shippingAddress??f,g=n.values.billingAddress??f,h=Nc({enabled:!!t.adapter.getShippingMethods&&i,customer:{email:n.values.email||void 0,name:n.values.name||void 0,shippingAddress:u}});return o.jsxs("form",{className:C("space-y-6",e),onSubmit:x=>x.preventDefault(),children:[a.isDigitalOnly?o.jsx(Ve,{className:"rounded-2xl",children:o.jsxs(Ye,{className:"p-5",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Digital delivery"}),o.jsx("div",{className:"mt-1 text-sm text-neutral-600 dark:text-neutral-400",children:a.fulfillmentNotes||"This is a digital product and will be available from your account after purchase."})]})}):null,a.hasPhysical&&!(t.checkout.allowShipping??!1)?o.jsx(Ve,{className:"rounded-2xl border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/30",children:o.jsxs(Ye,{className:"p-5",children:[o.jsx("div",{className:"text-sm font-semibold text-red-900 dark:text-red-200",children:"Shipping required"}),o.jsx("div",{className:"mt-1 text-sm text-red-800/90 dark:text-red-200/80",children:"Your cart contains shippable items, but shipping is disabled for this checkout."})]})}):null,l?o.jsxs("section",{className:"space-y-4 rounded-2xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-950",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Contact"}),o.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:a.email==="required"||a.name==="required"||a.phone==="required"?"Required":"Optional"})]}),o.jsxs("div",{className:"grid gap-3",children:[a.email!=="none"?o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:"checkout-email",children:"Email"}),o.jsx(ke,{id:"checkout-email",value:n.values.email??"",onChange:x=>n.setField("email",x.target.value),placeholder:"you@company.com","aria-invalid":!!n.fieldErrors.email,required:a.email==="required"}),o.jsx(Ur,{message:n.fieldErrors.email})]}):null,a.name!=="none"?o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:"checkout-name",children:"Name"}),o.jsx(ke,{id:"checkout-name",value:n.values.name??"",onChange:x=>n.setField("name",x.target.value),placeholder:"Full name","aria-invalid":!!n.fieldErrors.name,required:a.name==="required"}),o.jsx(Ur,{message:n.fieldErrors.name})]}):null,a.phone!=="none"?o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:"checkout-phone",children:"Phone"}),o.jsx(ke,{id:"checkout-phone",value:n.values.phone??"",onChange:x=>n.setField("phone",x.target.value),placeholder:"Phone number","aria-invalid":!!n.fieldErrors.phone,required:a.phone==="required"}),o.jsx(Ur,{message:n.fieldErrors.phone})]}):null]})]}):null,o.jsx(_f,{defaultOpen:c,label:c?"Send gift card to someone":"Send as a gift"}),d.length>0?o.jsxs("section",{className:"space-y-3 rounded-2xl border border-amber-200 bg-amber-50 p-5 dark:border-amber-900/40 dark:bg-amber-950/30",children:[o.jsx("div",{className:"text-sm font-semibold text-amber-900 dark:text-amber-200",children:"Regulatory notice"}),d.map((x,p)=>o.jsx("div",{className:"text-xs text-amber-800/90 dark:text-amber-200/80",children:x},p)),o.jsxs("label",{className:"flex items-start gap-2 pt-1",children:[o.jsx("input",{type:"checkbox",checked:n.values.regulatoryConsent===!0,onChange:x=>n.setField("regulatoryConsent",x.target.checked),className:"mt-0.5 h-4 w-4 rounded border-amber-300 accent-amber-700"}),o.jsx("span",{className:"text-xs font-medium text-amber-900 dark:text-amber-200",children:"I acknowledge and accept the regulatory terms above"})]}),o.jsx(Ur,{message:n.fieldErrors.regulatoryConsent})]}):null,i?o.jsx(Ko,{title:"Shipping address",value:u,onChange:x=>n.setField("shippingAddress",x),errors:{line1:n.fieldErrors["shippingAddress.line1"],city:n.fieldErrors["shippingAddress.city"],postalCode:n.fieldErrors["shippingAddress.postalCode"],country:n.fieldErrors["shippingAddress.country"]}}):null,i&&h.methods.length?o.jsx(Ef,{methods:h.methods,value:n.values.shippingMethodId,onChange:x=>n.setField("shippingMethodId",x),currency:t.currency}):null,s==="full"?o.jsx(Ko,{title:"Billing address",value:g,onChange:x=>n.setField("billingAddress",x)}):null,t.checkout.allowTipping?o.jsxs("section",{className:"space-y-4 rounded-2xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-950",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Tip"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs(De,{htmlFor:"checkout-tip",children:["Tip amount (",t.currency,")"]}),o.jsx(ke,{id:"checkout-tip",inputMode:"decimal",value:String(n.values.tipAmount??0),onChange:x=>n.setField("tipAmount",Number(x.target.value)||0)})]})]}):null,s==="full"?o.jsxs("section",{className:"space-y-4 rounded-2xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-950",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Notes"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(De,{htmlFor:"checkout-notes",children:"Order notes (optional)"}),o.jsx(ke,{id:"checkout-notes",value:n.values.notes??"",onChange:x=>n.setField("notes",x.target.value),placeholder:"Delivery instructions, gift note…"})]})]}):null]})}function lN(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}function cN(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M3 6h18"}),o.jsx("path",{d:"M8 6V4h8v2"}),o.jsx("path",{d:"M6 6l1 16h10l1-16"})]})}function If({open:e,onOpenChange:t,issues:n,onRemoveItem:r,onUpdateQuantity:s,onGoToCart:a,className:i}){const l=n.some(c=>c.type==="out_of_stock"||c.type==="product_unavailable");return o.jsx(Ta,{open:e,onOpenChange:t,children:o.jsxs(Ms,{className:C("sm:max-w-lg",i),children:[o.jsxs(Ra,{children:[o.jsxs(Ds,{className:"flex items-center gap-2",children:[o.jsx(lN,{className:"h-5 w-5 text-amber-500"}),"Inventory Update"]}),o.jsx(Oa,{children:l?"Some items in your cart are no longer available.":"Some items in your cart have limited availability."})]}),o.jsx("div",{className:"my-4 divide-y divide-neutral-200 dark:divide-neutral-800",children:n.map(c=>o.jsx(dN,{issue:c,onRemove:()=>r(c.productId,c.variantId),onUpdateQty:d=>s(c.productId,c.variantId,d)},`${c.productId}::${c.variantId??""}`))}),o.jsxs(Nu,{className:"flex-col gap-2 sm:flex-row",children:[a?o.jsx(H,{type:"button",variant:"outline",onClick:()=>{t(!1),a()},children:"Go to Cart"}):null,o.jsx(H,{type:"button",onClick:()=>t(!1),children:"Continue"})]})]})})}function dN({issue:e,onRemove:t,onUpdateQty:n}){const r=e.type==="out_of_stock"||e.type==="product_unavailable";return o.jsxs("div",{className:"flex items-start gap-3 py-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-sm font-medium text-neutral-900 dark:text-neutral-100",children:e.title}),o.jsx("div",{className:C("mt-0.5 text-sm",r?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400"),children:e.message}),e.type==="insufficient_stock"&&e.availableQty>0?o.jsxs("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:["You requested ",e.requestedQty,", but only ",e.availableQty," available"]}):null]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.type==="insufficient_stock"&&e.availableQty>0?o.jsxs(H,{type:"button",size:"sm",variant:"outline",onClick:()=>n(e.availableQty),children:["Update to ",e.availableQty]}):null,o.jsxs(H,{type:"button",size:"sm",variant:"ghost",className:"text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/30 dark:hover:text-red-300",onClick:t,children:[o.jsx(cN,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Remove"})]})]})]})}function Tf({className:e,ctaLabel:t,renderEmbedded:n,embeddedFallback:r,renderCustom:s,customFallback:a}){const{config:i}=ye(),l=St(),c=wr(),{config:d,isLoading:f}=Cc(),[u,g]=m.useState(!1);m.useEffect(()=>{let D=!0;return Promise.resolve().then(()=>require("./walletDetection-bNmV5ItZ.js")).then(z=>{D&&g(z.detectSolanaWallets())}),()=>{D=!1}},[]);const h=jc({items:l.items}),[x,p]=m.useState(!1),v=m.useMemo(()=>i.checkout.paymentMethods&&i.checkout.paymentMethods.length?i.checkout.paymentMethods:[{id:"card",label:"Card",ctaLabel:"Pay now"}],[i.checkout.paymentMethods]),w=m.useMemo(()=>v.filter(z=>!(z.id==="card"&&!d.card||z.id==="crypto"&&!d.crypto||z.id==="credits"&&!d.credits||z.id==="crypto"&&!u)),[u,v,d]),[y,k]=m.useState((w[0]??v[0])?.id??"card");m.useEffect(()=>{w.length&&(w.some(D=>D.id===y)||k(w[0].id))},[y,w]),m.useEffect(()=>{c.reset()},[y]);const b=w.find(D=>D.id===y)??v.find(D=>D.id===y)??v[0]??{ctaLabel:"Pay now"},S=b.description??(y==="crypto"?"Pay using a connected wallet.":void 0),A=y==="crypto"&&!u,I=f||c.status==="validating"||c.status==="creating_session"||c.status==="redirecting"||h.isVerifying,E=t??b.ctaLabel??(i.checkout.mode==="none"?"Continue to payment":"Pay now"),Z=m.useCallback(async D=>{const z=await h.verify();if(!z.ok&&z.issues.length>0){p(!0);return}c.createCheckoutSession({paymentMethodId:D})},[c,h]),F=c.session?.kind==="embedded"?c.session:null,$=c.session?.kind==="custom"?c.session:null;return o.jsxs("div",{className:C("space-y-3",e),children:[w.length>1?o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-xs font-medium text-neutral-600 dark:text-neutral-400",children:"Payment method"}),o.jsx(Va,{value:y,onValueChange:k,children:o.jsx(Zs,{className:"w-full",children:w.map(D=>o.jsx(br,{value:D.id,className:"flex-1",disabled:I,children:D.label},D.id))})})]}):null,c.error?o.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-200",children:c.error}):null,$?o.jsx("div",{className:"space-y-3",children:s?s($):a??o.jsx("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 text-sm text-neutral-700 dark:border-neutral-800 dark:bg-neutral-900/40 dark:text-neutral-300",children:"Checkout session created. Provide `renderCustom` to render a custom payment UI."})}):F?o.jsx("div",{className:"space-y-3",children:n?n(F):r??o.jsx("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 text-sm text-neutral-700 dark:border-neutral-800 dark:bg-neutral-900/40 dark:text-neutral-300",children:"Embedded checkout session created. Provide `renderEmbedded` to render your payment UI."})}):o.jsx(H,{type:"button",className:"w-full",disabled:l.items.length===0||I||A,onClick:()=>{Z(y)},children:h.isVerifying?"Checking availability…":I?"Processing…":E}),!F&&!$?o.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:A?"Install a browser wallet to enable crypto payments.":S??"You will be redirected to complete your payment."}):null,o.jsx(If,{open:x,onOpenChange:D=>{p(D),D||h.reset()},issues:h.result?.issues??[],onRemoveItem:(D,z)=>{l.removeItem(D,z)},onUpdateQuantity:(D,z,U)=>{l.setQty(D,z,U)}})]})}function Pf({className:e}){const{config:t}=ye(),n=St(),r=wr(),{settings:s}=Fn(),a=(t.checkout.allowPromoCodes??!1)&&s.checkout.promoCodes;return o.jsxs("div",{className:C("rounded-2xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-950",e),children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Order review"}),o.jsx(rt,{className:"my-3"}),o.jsx("div",{className:"space-y-3",children:n.items.map(i=>o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[o.jsx("div",{className:"h-10 w-10 shrink-0 overflow-hidden rounded-lg border border-neutral-200 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900",children:i.imageSnapshot?o.jsx("img",{src:i.imageSnapshot,alt:i.titleSnapshot,className:"h-full w-full object-cover"}):null}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"line-clamp-1 text-sm text-neutral-950 dark:text-neutral-50",children:i.titleSnapshot}),o.jsxs("div",{className:"text-xs text-neutral-600 dark:text-neutral-400",children:["Qty ",i.qty]})]})]}),o.jsx("div",{className:"text-sm font-semibold tabular-nums text-neutral-950 dark:text-neutral-50",children:Te({amount:i.unitPrice*i.qty,currency:i.currency})})]},`${i.productId}::${i.variantId??""}`))}),o.jsx(rt,{className:"my-3"}),a?o.jsx(ei,{value:r.values.discountCode??n.promoCode,onApply:i=>{r.setField("discountCode",i??""),n.setPromoCode(i)}}):null,a?o.jsx(rt,{className:"my-3"}):null,o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:"Subtotal"}),o.jsx("span",{className:"font-semibold text-neutral-950 dark:text-neutral-50",children:Te({amount:n.subtotal,currency:t.currency})})]})]})}function No(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function uN({status:e}){const t={info_submitted:"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-200",approved:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900/50 dark:text-red-200",processing:"bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-200"},n=e.replace(/_/g," ");return o.jsx(dt,{className:t[e]??"bg-neutral-100 text-neutral-700",children:n})}function fN({field:e,value:t,onChange:n}){const r="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-neutral-500 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-50 dark:placeholder-neutral-500";if(e.fieldType==="dropdown"&&e.options?.length)return o.jsxs("select",{id:e.id,required:e.required,value:t,onChange:a=>n(a.target.value),className:r,children:[o.jsx("option",{value:"",children:"Select…"}),e.options.map(a=>o.jsx("option",{value:a,children:a},a))]});if(e.fieldType==="address"||e.fieldType==="textarea")return o.jsx("textarea",{id:e.id,required:e.required,value:t,placeholder:e.placeholder,rows:3,onChange:a=>n(a.target.value),className:C(r,"resize-y")});if(e.fieldType==="file_upload"){const a=i=>{const l=i.target.files?.[0];if(!l){n("");return}if(l.size>1572864){n(""),i.target.value="",alert("File must be under 1.5 MB.");return}const c=new FileReader;c.onload=()=>{const d=c.result,f=l.name.replace(/[^a-zA-Z0-9._\-() ]/g,"_").slice(0,200);n(JSON.stringify({name:f,data:d}))},c.readAsDataURL(l)};return o.jsx("input",{id:e.id,type:"file",required:e.required,onChange:a,className:"w-full text-sm text-neutral-700 file:mr-3 file:rounded file:border-0 file:bg-neutral-100 file:px-3 file:py-1.5 file:text-sm file:font-medium dark:text-neutral-300 dark:file:bg-neutral-800 dark:file:text-neutral-200"})}const s={email:"email",phone:"tel",text:"text"};return o.jsx("input",{id:e.id,type:s[e.fieldType]??"text",required:e.required,value:t,placeholder:e.placeholder,onChange:a=>n(a.target.value),className:r})}function Ys({serverUrl:e,productId:t,authToken:n}){const[r,s]=m.useState("loading"),[a,i]=m.useState(null),[l,c]=m.useState(null),[d,f]=m.useState({}),[u,g]=m.useState(!1),[h,x]=m.useState(null),p=m.useCallback((w,y)=>{f(k=>({...k,[w]:y}))},[]);m.useEffect(()=>{if(r!=="already_submitted"&&r!=="success")return;const w=No(n),k=setInterval(async()=>{try{const b=await fetch(`${e}/paywall/v1/asset-redemption/${t}/status`,{headers:w});if(!b.ok)return;const S=await b.json();S.redemptions?.length&&(c(S.redemptions[0].status),r==="success"&&s("already_submitted"))}catch{}},3e4);return()=>clearInterval(k)},[r,e,t,n]),m.useEffect(()=>{let w=!1;const y=No(n);async function k(){try{const b=await fetch(`${e}/paywall/v1/asset-redemption/${t}/status`,{headers:y});if(!w&&b.ok){const I=await b.json();if(I.redemptions?.length){c(I.redemptions[0].status),s("already_submitted");return}}const S=await fetch(`${e}/paywall/v1/asset-redemption/${t}/form`,{headers:y});if(w)return;if(!S.ok)throw new Error(`Server error: ${S.status}`);const A=await S.json();if(!A.redemptionConfig){s("no_config");return}i(A.redemptionConfig),s("form")}catch(b){w||(x(b instanceof Error?b.message:"Failed to load redemption form."),s("form"))}}return k(),()=>{w=!0}},[e,t,n]);const v=m.useCallback(async w=>{w.preventDefault(),g(!0),x(null);try{const y=await fetch(`${e}/paywall/v1/asset-redemption/${t}/submit`,{method:"POST",headers:No(n),body:JSON.stringify({formData:d})});if(!y.ok){const k=await y.text();throw new Error(k||`Server error: ${y.status}`)}s("success")}catch(y){x(y instanceof Error?y.message:"Submission failed. Please try again.")}finally{g(!1)}},[e,t,n,d]);return r==="loading"?o.jsx("div",{className:"py-8 text-center text-sm text-neutral-500 dark:text-neutral-400",children:"Loading redemption form..."}):r==="no_config"?o.jsx("div",{className:"py-8 text-center text-sm text-neutral-500 dark:text-neutral-400",children:"Redemption not available for this product."}):r==="already_submitted"?o.jsxs("div",{className:"space-y-3 rounded-xl border border-neutral-200 bg-neutral-50 p-5 dark:border-neutral-800 dark:bg-neutral-900/50",children:[o.jsx("p",{className:"text-sm font-medium text-neutral-900 dark:text-neutral-50",children:"Redemption request status"}),l?o.jsx(uN,{status:l}):null,o.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"You have already submitted redemption information. We will notify you of any updates."})]}):r==="success"?o.jsx("div",{className:"rounded-xl border border-emerald-200 bg-emerald-50 p-5 text-sm text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/30 dark:text-emerald-200",children:"Redemption submitted! You will be notified when reviewed."}):o.jsxs("form",{onSubmit:w=>{v(w)},className:"space-y-5",children:[a?.instructions?o.jsx("p",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:a.instructions}):null,h?o.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-200",children:h}):null,a?.fields.map(w=>o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("label",{htmlFor:w.id,className:"block text-sm font-medium text-neutral-900 dark:text-neutral-50",children:[w.label,w.required?o.jsx("span",{className:"ml-1 text-red-500","aria-hidden":"true",children:"*"}):null]}),o.jsx(fN,{field:w,value:d[w.id]??"",onChange:y=>p(w.id,y)})]},w.id)),a?.estimatedProcessingDays?o.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["Estimated processing time: ",a.estimatedProcessingDays," business day",a.estimatedProcessingDays!==1?"s":"","."]}):null,o.jsx(H,{type:"submit",className:"w-full",disabled:u,children:u?"Submitting...":"Submit redemption info"})]})}function Ks({result:e,onContinueShopping:t,onViewOrders:n,className:r,serverUrl:s,authToken:a,tokenizedProductIds:i}){return e.kind==="idle"?null:e.kind==="success"?o.jsxs("div",{className:C("rounded-2xl border border-neutral-200 bg-white p-8 text-neutral-950 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",r),children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-600 dark:text-neutral-400",children:"Receipt"}),o.jsx("h2",{className:"mt-2 text-2xl font-semibold",children:"Payment successful"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:"Thanks for your purchase. You'll receive a confirmation email shortly."}),e.order?.metadata?.recipient_email?o.jsxs("div",{className:"mt-4 rounded-xl border border-emerald-200 bg-emerald-50 p-4 dark:border-emerald-900/40 dark:bg-emerald-950/30",children:[o.jsx("div",{className:"text-sm font-semibold text-emerald-900 dark:text-emerald-200",children:"Gift card sent"}),o.jsxs("div",{className:"mt-1 text-sm text-emerald-800/90 dark:text-emerald-200/80",children:["A gift card has been sent to"," ",o.jsx("span",{className:"font-medium",children:e.order.metadata.recipient_email}),"."," ","The recipient will receive credits in their account."]})]}):e.order?.items.some(l=>l.title.toLowerCase().includes("gift card"))?o.jsxs("div",{className:"mt-4 rounded-xl border border-emerald-200 bg-emerald-50 p-4 dark:border-emerald-900/40 dark:bg-emerald-950/30",children:[o.jsx("div",{className:"text-sm font-semibold text-emerald-900 dark:text-emerald-200",children:"Gift card credits added"}),o.jsx("div",{className:"mt-1 text-sm text-emerald-800/90 dark:text-emerald-200/80",children:"Your gift card credits have been added to your account and are ready to use."})]}):null,e.order?o.jsxs("div",{className:"mt-5 rounded-xl border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-800 dark:bg-neutral-900/40",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:["Order ",e.order.id]}),o.jsxs("div",{className:"mt-1 text-xs text-neutral-600 dark:text-neutral-400",children:[new Date(e.order.createdAt).toLocaleString()," · ",e.order.status]})]}),o.jsx("div",{className:"text-sm font-semibold",children:Te({amount:e.order.total,currency:e.order.currency})})]}),o.jsxs("div",{className:"mt-3 space-y-2",children:[e.order.items.slice(0,4).map((l,c)=>o.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[o.jsx("div",{className:"min-w-0 truncate",children:l.title}),o.jsxs("div",{className:"shrink-0 text-neutral-600 dark:text-neutral-400",children:["Qty ",l.qty]})]},`${l.title}-${c}`)),e.order.items.length>4?o.jsxs("div",{className:"text-xs text-neutral-600 dark:text-neutral-400",children:["+",e.order.items.length-4," more item(s)"]}):null]}),o.jsxs("div",{className:"mt-3 flex gap-3 text-sm",children:[Ue.safeHref(e.order.receiptUrl)?o.jsx("a",{href:Ue.safeHref(e.order.receiptUrl),className:"hover:underline",children:"Receipt"}):null,Ue.safeHref(e.order.invoiceUrl)?o.jsx("a",{href:Ue.safeHref(e.order.invoiceUrl),className:"hover:underline",children:"Invoice"}):null]})]}):e.orderId?o.jsxs("p",{className:"mt-4 text-xs text-neutral-500 dark:text-neutral-400",children:["Session/Order ID: ",o.jsx("span",{className:"font-mono",children:e.orderId})]}):null,(()=>{const l=i??e.order?.items.filter(c=>c.tokenizedAsset&&c.productId).map(c=>c.productId)??[];return!s||l.length===0?null:o.jsxs("div",{className:"mt-5 space-y-4",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-900 dark:text-neutral-50",children:"Complete your asset redemption"}),o.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Your tokenized asset was minted on-chain. Submit your redemption information below."}),l.map(c=>o.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-800 dark:bg-neutral-900/40",children:o.jsx(Ys,{serverUrl:s,productId:c,authToken:a})},c))]})})(),o.jsxs("div",{className:"mt-6 flex flex-col gap-2 sm:flex-row",children:[t?o.jsx(H,{type:"button",onClick:t,children:"Continue shopping"}):null,n?o.jsx(H,{type:"button",variant:"outline",onClick:n,children:"View orders"}):null]})]}):e.kind==="cancel"?o.jsxs("div",{className:C("rounded-2xl border border-neutral-200 bg-white p-8 text-neutral-950 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",r),children:[o.jsx("h2",{className:"text-2xl font-semibold",children:"Checkout cancelled"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:"No charges were made. You can continue shopping and try again."}),t?o.jsx("div",{className:"mt-6",children:o.jsx(H,{type:"button",onClick:t,children:"Back to shop"})}):null]}):o.jsxs("div",{className:C("rounded-2xl border border-neutral-200 bg-white p-8 text-neutral-950 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",r),children:[o.jsx("h2",{className:"text-2xl font-semibold",children:"Payment failed"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:e.message??"Something went wrong while processing your payment."}),t?o.jsx("div",{className:"mt-6",children:o.jsx(H,{type:"button",onClick:t,children:"Back to shop"})}):null]})}function mN({onContinueShopping:e,onViewOrders:t,className:n,receiptClassName:r,serverUrl:s,authToken:a,tokenizedProductIds:i}){const l=la();return l.kind==="idle"?o.jsx("div",{className:C("flex min-h-[50vh] items-center justify-center p-4",n),children:o.jsx("div",{className:"text-center text-neutral-600 dark:text-neutral-400",children:"Loading order details..."})}):o.jsx("div",{className:C("flex min-h-[50vh] items-center justify-center p-4",n),children:o.jsx(Ks,{result:l,onContinueShopping:e,onViewOrders:t,className:C("w-full max-w-lg",r),serverUrl:s,authToken:a,tokenizedProductIds:i})})}function pN({onContinueShopping:e,className:t,receiptClassName:n}){const r={kind:"cancel"};return o.jsx("div",{className:C("flex min-h-[50vh] items-center justify-center p-4",t),children:o.jsx(Ks,{result:r,onContinueShopping:e,className:C("w-full max-w-lg",n)})})}function hN(e){switch(e){case"created":return"secondary";case"paid":return"default";case"processing":return"secondary";case"fulfilled":return"outline";case"shipped":return"default";case"delivered":return"outline";case"cancelled":return"outline";case"refunded":return"outline";default:return"secondary"}}function Rf({order:e,onView:t,className:n}){const r=`${e.items.length} item${e.items.length===1?"":"s"}`,s=new Date(e.createdAt).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),a=e.status.charAt(0).toUpperCase()+e.status.slice(1);return o.jsx(Ve,{className:C("group overflow-hidden rounded-2xl border-neutral-200/70 bg-white shadow-sm transition-shadow hover:shadow-md dark:border-neutral-800 dark:bg-neutral-950",n),children:o.jsx(Ye,{className:"p-5",children:o.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[o.jsx("span",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Order"}),o.jsx("span",{className:"truncate font-mono text-sm font-semibold text-neutral-950/80 dark:text-neutral-50/80",children:e.id})]}),o.jsx("div",{className:"mt-0.5 text-xs text-neutral-600 dark:text-neutral-400",children:s})]}),o.jsx("div",{className:"flex items-start justify-end",children:o.jsx(dt,{variant:hN(e.status),className:"capitalize",children:a})}),o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:r}),o.jsx("div",{className:"text-right text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:Te({amount:e.total,currency:e.currency})}),o.jsxs("div",{className:"col-span-2 mt-3 flex items-center justify-between gap-3 border-t border-neutral-200/70 pt-3 dark:border-neutral-800",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[Ue.safeHref(e.receiptUrl)?o.jsx(H,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-8 px-2",children:o.jsx("a",{href:Ue.safeHref(e.receiptUrl),target:"_blank",rel:"noreferrer",children:"Receipt"})}):null,Ue.safeHref(e.invoiceUrl)?o.jsx(H,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-8 px-2",children:o.jsx("a",{href:Ue.safeHref(e.invoiceUrl),target:"_blank",rel:"noreferrer",children:"Invoice"})}):null]}),t?o.jsx(H,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:()=>t(e),children:"Details"}):null]})]})})})}function Of({orders:e,onView:t,className:n}){return o.jsx("div",{className:C("grid gap-4",n),children:e.map(r=>o.jsx(Rf,{order:r,onView:t},r.id))})}function jo(e,t,n){const r="https://explorer.solana.com",s=n==="mainnet-beta"?"":`?cluster=${n}`;return`${r}/${e}/${t}${s}`}function Co(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function gN(e,t){const n=e/100;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(n)}catch{return`${n.toFixed(2)} ${t}`}}const xN={securities:"Security Token",commodities:"Commodity Token",property:"Property Token",collectibles:"Collectible NFT"};function ti({mintAddress:e,mintSignature:t,burnSignature:n,assetClass:r,backingValueCents:s,backingCurrency:a,cluster:i="mainnet-beta",className:l}){if(!e&&!t)return null;const c=r?xN[r.toLowerCase()]??"Tokenized Asset":"Tokenized Asset",d=!!n;return o.jsx(Ve,{className:C("overflow-hidden rounded-xl border-neutral-200/70 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-950",l),children:o.jsxs(Ye,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(vN,{}),o.jsx("span",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:c})]}),d?o.jsx(dt,{className:"bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-200",children:"redeemed"}):o.jsx(dt,{className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-200",children:"on-chain"})]}),o.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[e&&o.jsx(Vr,{label:"Token address",value:Co(e),href:jo("address",e,i),mono:!0}),t&&o.jsx(Vr,{label:"Mint transaction",value:Co(t),href:jo("tx",t,i),mono:!0}),n&&o.jsx(Vr,{label:"Burn transaction",value:Co(n),href:jo("tx",n,i),mono:!0}),s!=null&&a&&o.jsx(Vr,{label:"Backing value",value:gN(s,a)})]})]})})}function Vr({label:e,value:t,href:n,mono:r}){return o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"text-neutral-500 dark:text-neutral-400",children:e}),n?o.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:C("text-blue-600 underline decoration-blue-600/30 hover:decoration-blue-600 dark:text-blue-400",r&&"font-mono text-xs"),children:t}):o.jsx("span",{className:C("text-neutral-950 dark:text-neutral-50",r&&"font-mono text-xs"),children:t})]})}function vN(){return o.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",className:"text-neutral-400 dark:text-neutral-500",children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function bN(e){switch(e){case"paid":return"default";case"processing":return"secondary";case"fulfilled":return"outline";case"cancelled":return"outline";case"refunded":return"outline";default:return"secondary"}}function Mf({order:e,onBack:t,className:n,serverUrl:r,authToken:s}){const a=new Date(e.createdAt).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),i=e.status.charAt(0).toUpperCase()+e.status.slice(1),l=e.items.filter(u=>u.tokenizedAsset&&u.productId),[c,d]=j.useState({}),f=j.useCallback(async()=>{if(!r||!l.length)return;const u={"Content-Type":"application/json"};s&&(u.Authorization=`Bearer ${s}`);const g={};await Promise.all(l.map(async h=>{try{const x=await fetch(`${r}/paywall/v1/asset-redemption/${encodeURIComponent(h.productId)}/status`,{headers:u});if(x.ok){const v=(await x.json()).redemptions?.[0];v&&(g[h.productId]={mintSignature:v.tokenMintSignature??void 0,burnSignature:v.tokenBurnSignature??void 0,status:v.status??void 0})}}catch{}})),d(g)},[r,s,l.map(u=>u.productId).join(",")]);return j.useEffect(()=>{f()},[f]),o.jsx(Ve,{className:C("overflow-hidden rounded-2xl border-neutral-200/70 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-950",n),children:o.jsxs(Ye,{className:"p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[o.jsx("span",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:"Order"}),o.jsx("span",{className:"truncate font-mono text-sm font-semibold text-neutral-950/80 dark:text-neutral-50/80",children:e.id})]}),o.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-neutral-600 dark:text-neutral-400",children:[o.jsx("span",{children:a}),o.jsx("span",{className:"text-neutral-300 dark:text-neutral-700",children:"·"}),o.jsx("span",{children:i})]})]}),o.jsxs("div",{className:"flex items-center gap-2 sm:justify-end",children:[o.jsx(dt,{variant:bN(e.status),className:"capitalize",children:i}),t?o.jsx(H,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:t,children:"Back"}):null]})]}),o.jsx(rt,{className:"my-5"}),o.jsx("div",{className:"space-y-3",children:e.items.map((u,g)=>o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"truncate text-sm text-neutral-950 dark:text-neutral-50",children:u.title}),o.jsxs("div",{className:"mt-0.5 text-xs text-neutral-600 dark:text-neutral-400",children:["Qty ",u.qty]})]}),o.jsx("div",{className:"text-right text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:Te({amount:u.unitPrice*u.qty,currency:u.currency})})]},`${u.title}-${g}`))}),e.metadata?.recipient_email?o.jsxs(o.Fragment,{children:[o.jsx(rt,{className:"my-5"}),o.jsxs("div",{className:"rounded-xl border border-emerald-200 bg-emerald-50 p-3 dark:border-emerald-900/40 dark:bg-emerald-950/30",children:[o.jsx("div",{className:"text-xs font-semibold text-emerald-900 dark:text-emerald-200",children:"Gift card"}),o.jsxs("div",{className:"mt-1 text-xs text-emerald-800/90 dark:text-emerald-200/80",children:["Sent to ",o.jsx("span",{className:"font-medium",children:e.metadata.recipient_email})]})]})]}):null,r&&l.length>0?o.jsxs(o.Fragment,{children:[o.jsx(rt,{className:"my-5"}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-900 dark:text-neutral-50",children:"Asset redemption"}),l.map(u=>{const g=c[u.productId];return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"text-xs font-medium text-neutral-600 dark:text-neutral-400",children:u.title}),g?.mintSignature&&o.jsx(ti,{mintSignature:g.mintSignature,burnSignature:g.burnSignature,assetClass:u.assetClass,backingValueCents:u.backingValueCents,backingCurrency:u.backingCurrency}),o.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-800 dark:bg-neutral-900/40",children:o.jsx(Ys,{serverUrl:r,productId:u.productId,authToken:s})})]},u.productId)})]})]}):null,o.jsx(rt,{className:"my-5"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Total"}),o.jsx("span",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:Te({amount:e.total,currency:e.currency})})]}),Ue.safeHref(e.receiptUrl)||Ue.safeHref(e.invoiceUrl)?o.jsxs("div",{className:"mt-5 flex flex-wrap items-center gap-2",children:[Ue.safeHref(e.receiptUrl)?o.jsx(H,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-8 px-2",children:o.jsx("a",{href:Ue.safeHref(e.receiptUrl),target:"_blank",rel:"noreferrer",children:"Receipt"})}):null,Ue.safeHref(e.invoiceUrl)?o.jsx(H,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-8 px-2",children:o.jsx("a",{href:Ue.safeHref(e.invoiceUrl),target:"_blank",rel:"noreferrer",children:"Invoice"})}):null]}):null]})})}const yN={pending_info:"bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-200",info_submitted:"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-200",approved:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-200",completed:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-200",processing:"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900/50 dark:text-red-200"};function wN({status:e}){const t=e.replace(/_/g," ");return o.jsx(dt,{className:yN[e]??"bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300",children:t})}function kN({orders:e,serverUrl:t,authToken:n,className:r}){const[s,a]=j.useState({}),[i,l]=j.useState(!0),[c,d]=j.useState(null),f=e.flatMap(x=>x.items.filter(p=>p.tokenizedAsset&&p.productId).map(p=>p.productId)),u=[...new Set(f)],g=j.useCallback(async()=>{if(!u.length){l(!1);return}l(!0);const x={"Content-Type":"application/json"};n&&(x.Authorization=`Bearer ${n}`);const p={};await Promise.all(u.map(async v=>{try{const w=await fetch(`${t}/paywall/v1/asset-redemption/${encodeURIComponent(v)}/status`,{headers:x});if(w.ok){const y=await w.json();p[v]=(y.redemptions??[]).map(k=>({...k,productId:v}))}}catch{}})),a(p),l(!1)},[t,n,u.join(",")]);j.useEffect(()=>{g()},[g]);const h=[];for(const x of e){x.metadata?.recipient_email&&h.push({kind:"gift-card",order:x,recipientEmail:x.metadata.recipient_email});for(const p of x.items)if(p.tokenizedAsset&&p.productId){const v=s[p.productId]??[];if(v.length)for(const w of v)h.push({kind:"asset",order:x,item:p,status:w.status,redemptionId:w.redemptionId});else h.push({kind:"asset",order:x,item:p,status:null,redemptionId:null})}}return h.sort((x,p)=>{const v=new Date(x.order.createdAt).getTime();return new Date(p.order.createdAt).getTime()-v}),i?o.jsx("div",{className:C("py-8 text-center text-sm text-neutral-500 dark:text-neutral-400",r),children:"Loading redemptions..."}):h.length?o.jsxs("div",{className:C("space-y-3",r),children:[o.jsx("h2",{className:"text-lg font-semibold text-neutral-950 dark:text-neutral-50",children:"My Redemptions"}),h.map((x,p)=>x.kind==="gift-card"?o.jsx(SN,{order:x.order,recipientEmail:x.recipientEmail},`gc-${x.order.id}-${p}`):o.jsx(NN,{order:x.order,item:x.item,status:x.status,isExpanded:c===x.item.productId,onToggle:()=>d(v=>v===x.item.productId?null:x.item.productId),serverUrl:t,authToken:n},`ar-${x.order.id}-${x.item.productId}-${p}`))]}):o.jsxs("div",{className:C("py-12 text-center",r),children:[o.jsx("div",{className:"text-sm font-medium text-neutral-900 dark:text-neutral-100",children:"No redemptions yet"}),o.jsx("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"Redemptions from tokenized asset purchases and gift card claims will appear here."})]})}function SN({order:e,recipientEmail:t}){return o.jsx(Ve,{className:"rounded-xl border-neutral-200/70 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-950",children:o.jsx(Ye,{className:"p-4",children:o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-sm font-medium text-neutral-950 dark:text-neutral-50",children:"Gift card sent"}),o.jsxs("div",{className:"mt-0.5 text-xs text-neutral-500 dark:text-neutral-400",children:["To ",t]})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"text-sm font-semibold text-neutral-950 dark:text-neutral-50",children:Te({amount:e.total,currency:e.currency})}),o.jsx("div",{className:"mt-0.5 text-xs text-neutral-400",children:new Date(e.createdAt).toLocaleDateString()})]})]})})})}function NN({order:e,item:t,status:n,isExpanded:r,onToggle:s,serverUrl:a,authToken:i}){return o.jsx(Ve,{className:"rounded-xl border-neutral-200/70 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-950",children:o.jsxs(Ye,{className:"p-4",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-sm font-medium text-neutral-950 dark:text-neutral-50",children:t.title}),o.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-xs text-neutral-500 dark:text-neutral-400",children:[o.jsxs("span",{children:["Order ",e.id.slice(0,8),"..."]}),o.jsx("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]}),o.jsx("div",{className:"flex items-center gap-2",children:n?o.jsx(wN,{status:n}):o.jsx(dt,{className:"bg-neutral-100 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-400",children:"awaiting info"})})]}),(!n||n==="pending_info")&&o.jsxs("div",{className:"mt-3",children:[o.jsx(H,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:s,children:r?"Hide form":"Submit redemption info"}),r&&t.productId&&o.jsx("div",{className:"mt-3 rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-800 dark:bg-neutral-900/40",children:o.jsx(Ys,{serverUrl:a,productId:t.productId,authToken:i})})]})]})})}function jN({orders:e,serverUrl:t,authToken:n,cluster:r="mainnet-beta",className:s}){const[a,i]=j.useState({}),[l,c]=j.useState(!0),d=e.flatMap(h=>h.items.filter(x=>x.tokenizedAsset&&x.productId).map(x=>x.productId)),f=[...new Set(d)],u=j.useCallback(async()=>{if(!f.length){c(!1);return}c(!0);const h={"Content-Type":"application/json"};n&&(h.Authorization=`Bearer ${n}`);const x={};await Promise.all(f.map(async p=>{try{const v=await fetch(`${t}/paywall/v1/asset-redemption/${encodeURIComponent(p)}/status`,{headers:h});if(v.ok){const y=(await v.json()).redemptions?.[0];y&&(x[p]={tokenMintSignature:y.tokenMintSignature??void 0,tokenBurnSignature:y.tokenBurnSignature??void 0,status:y.status??void 0})}}catch{}})),i(x),c(!1)},[t,n,f.join(",")]);j.useEffect(()=>{u()},[u]);const g=[];for(const h of e)for(const x of h.items)if(x.tokenizedAsset&&x.productId){const p=a[x.productId];g.push({order:h,item:x,mintSignature:p?.tokenMintSignature,burnSignature:p?.tokenBurnSignature,status:p?.status})}return g.sort((h,x)=>{const p=new Date(h.order.createdAt).getTime();return new Date(x.order.createdAt).getTime()-p}),l?o.jsx("div",{className:C("py-8 text-center text-sm text-neutral-500 dark:text-neutral-400",s),children:"Loading tokens..."}):g.length?o.jsxs("div",{className:C("space-y-4",s),children:[o.jsx("h2",{className:"text-lg font-semibold text-neutral-950 dark:text-neutral-50",children:"My Tokens"}),o.jsxs("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:[g.length," token",g.length===1?"":"s"]}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:g.map((h,x)=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-sm font-medium text-neutral-950 dark:text-neutral-50",children:h.item.title}),o.jsxs("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["Order ",h.order.id.slice(0,8),"... ·"," ",new Date(h.order.createdAt).toLocaleDateString()]}),o.jsx(ti,{mintSignature:h.mintSignature,burnSignature:h.burnSignature,assetClass:h.item.assetClass,backingValueCents:h.item.backingValueCents,backingCurrency:h.item.backingCurrency,cluster:r})]},`${h.item.productId}-${x}`))})]}):o.jsxs("div",{className:C("py-12 text-center",s),children:[o.jsx("div",{className:"text-sm font-medium text-neutral-900 dark:text-neutral-100",children:"No tokens yet"}),o.jsx("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"Tokens from tokenized asset purchases will appear here."})]})}function ps(e,t){const n=e/100;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(n)}catch{return`${n.toFixed(2)} ${t}`}}function CN({serverUrl:e,token:t,authToken:n,onSignIn:r,onContinueShopping:s,className:a}){const[i,l]=j.useState({kind:"loading"}),c=j.useCallback(async()=>{l({kind:"loading"});try{const f=await fetch(`${e}/paywall/v1/gift-card/claim/${encodeURIComponent(t)}`);if(f.status===404){l({kind:"not-found"});return}if(!f.ok){const g=await f.text().catch(()=>`HTTP ${f.status}`);l({kind:"error",message:g});return}const u=await f.json();u.claimed?l({kind:"already-claimed",data:u}):l({kind:"info",data:u})}catch(f){l({kind:"error",message:f instanceof Error?f.message:"Network error"})}},[e,t]);j.useEffect(()=>{c()},[c]);const d=j.useCallback(async()=>{if(n){l({kind:"claiming"});try{const f=await fetch(`${e}/paywall/v1/gift-card/claim/${encodeURIComponent(t)}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});if(!f.ok){const g=await f.text().catch(()=>`HTTP ${f.status}`);l({kind:"error",message:g});return}const u=await f.json();l({kind:"claimed",result:u})}catch(f){l({kind:"error",message:f instanceof Error?f.message:"Network error"})}}},[e,t,n]);return o.jsx("div",{className:C("flex min-h-[50vh] items-center justify-center p-4",a),children:o.jsx(Ve,{className:"w-full max-w-md overflow-hidden rounded-2xl border-neutral-200/70 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-950",children:o.jsx(Ye,{className:"p-8",children:i.kind==="loading"?o.jsx(_N,{}):i.kind==="not-found"?o.jsx(EN,{}):i.kind==="error"?o.jsx(AN,{message:i.message,onRetry:c}):i.kind==="already-claimed"?o.jsx(IN,{data:i.data,onContinueShopping:s}):i.kind==="info"?o.jsx(TN,{data:i.data,isAuthenticated:!!n,onClaim:d,onSignIn:r}):i.kind==="claiming"?o.jsx(PN,{}):o.jsx(RN,{result:i.result,onContinueShopping:s})})})})}function _N(){return o.jsx("div",{className:"text-center text-neutral-600 dark:text-neutral-400",children:"Loading gift card details..."})}function EN(){return o.jsxs("div",{className:"text-center",children:[o.jsx("h2",{className:"text-xl font-semibold text-neutral-950 dark:text-neutral-50",children:"Gift card not found"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:"This gift card link is invalid or has expired. Please check the link and try again."})]})}function AN({message:e,onRetry:t}){return o.jsxs("div",{className:"text-center",children:[o.jsx("h2",{className:"text-xl font-semibold text-neutral-950 dark:text-neutral-50",children:"Something went wrong"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:e}),o.jsx("div",{className:"mt-4",children:o.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Try again"})})]})}function IN({data:e,onContinueShopping:t}){return o.jsxs("div",{className:"text-center",children:[o.jsx("h2",{className:"text-xl font-semibold text-neutral-950 dark:text-neutral-50",children:"Already claimed"}),o.jsxs("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:["This ",ps(e.faceValueCents,e.currency)," gift card has already been redeemed. The credits are in your account."]}),t?o.jsx("div",{className:"mt-6",children:o.jsx(H,{type:"button",onClick:t,children:"Continue shopping"})}):null]})}function TN({data:e,isAuthenticated:t,onClaim:n,onSignIn:r}){const s=ps(e.faceValueCents,e.currency);return o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-sm font-semibold text-emerald-700 dark:text-emerald-400",children:"Gift card"}),o.jsx("div",{className:"mt-2 text-4xl font-bold text-neutral-950 dark:text-neutral-50",children:s}),o.jsx("p",{className:"mt-3 text-sm text-neutral-600 dark:text-neutral-400",children:e.recipientEmail?`A gift card for ${e.recipientEmail} is ready to claim.`:"You have a gift card ready to claim."}),o.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-500",children:"Credits will be added to your account and can be used for purchases."}),o.jsx("div",{className:"mt-6",children:t?o.jsxs(H,{type:"button",onClick:n,className:"w-full",children:["Claim ",s," credits"]}):o.jsxs(o.Fragment,{children:[o.jsx(H,{type:"button",onClick:r,className:"w-full",children:"Sign in to claim"}),o.jsx("p",{className:"mt-2 text-xs text-neutral-500 dark:text-neutral-500",children:"You need to sign in or create an account to receive your credits."})]})})]})}function PN(){return o.jsx("div",{className:"text-center text-neutral-600 dark:text-neutral-400",children:"Claiming your gift card..."})}function RN({result:e,onContinueShopping:t}){const n=ps(e.creditsAdded,e.currency),r=ps(e.newBalance,e.currency);return o.jsxs("div",{className:"text-center",children:[o.jsx("h2",{className:"text-xl font-semibold text-neutral-950 dark:text-neutral-50",children:"Gift card claimed"}),o.jsxs("div",{className:"mt-4 rounded-xl border border-emerald-200 bg-emerald-50 p-4 dark:border-emerald-900/40 dark:bg-emerald-950/30",children:[o.jsxs("div",{className:"text-sm font-semibold text-emerald-900 dark:text-emerald-200",children:[n," credits added"]}),o.jsxs("div",{className:"mt-1 text-xs text-emerald-800/90 dark:text-emerald-200/80",children:["Your new balance is ",r]})]}),t?o.jsx("div",{className:"mt-6",children:o.jsx(H,{type:"button",onClick:t,children:"Start shopping"})}):null]})}function ON(e,t){const n=e/100;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(n)}catch{return`${n.toFixed(2)} ${t}`}}function MN(e){try{return new Date(e).toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}catch{return e}}function DN({serverUrl:e,className:t}){const[n,r]=j.useState(""),[s,a]=j.useState({kind:"idle"}),i=j.useCallback(async l=>{l.preventDefault();const c=n.trim();if(c){a({kind:"loading"});try{const d=await fetch(`${e}/paywall/v1/gift-card/balance/${encodeURIComponent(c)}`);if(d.status===404){a({kind:"not-found"});return}if(!d.ok){const u=await d.text().catch(()=>`HTTP ${d.status}`);a({kind:"error",message:u});return}const f=await d.json();a({kind:"result",data:f})}catch(d){a({kind:"error",message:d instanceof Error?d.message:"Network error"})}}},[e,n]);return o.jsx(Ve,{className:C("w-full max-w-md overflow-hidden rounded-2xl border-neutral-200/70 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-950",t),children:o.jsxs(Ye,{className:"p-6",children:[o.jsx("h2",{className:"mb-4 text-lg font-semibold text-neutral-950 dark:text-neutral-50",children:"Check gift card balance"}),o.jsxs("form",{onSubmit:l=>void i(l),className:"space-y-3",children:[o.jsx(ke,{type:"text",value:n,onChange:l=>r(l.target.value),placeholder:"Enter gift card code",required:!0,className:"font-mono tracking-wide uppercase"}),o.jsx(H,{type:"submit",className:"w-full",disabled:s.kind==="loading"||!n.trim(),children:s.kind==="loading"?"Checking...":"Check balance"})]}),s.kind==="result"&&o.jsx(zN,{data:s.data}),s.kind==="not-found"&&o.jsx("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800 dark:border-amber-900/40 dark:bg-amber-950/30 dark:text-amber-200",children:"No gift card found with that code. Please check the code and try again."}),s.kind==="error"&&o.jsx("div",{className:"mt-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-200",children:s.message})]})})}function zN({data:e}){const t=e.expiresAt&&new Date(e.expiresAt)<=new Date,n=e.active&&!t&&e.balance>0;return o.jsxs("div",{className:"mt-4 space-y-3",children:[o.jsxs("div",{className:C("rounded-xl border p-4 text-center",n?"border-emerald-200 bg-emerald-50 dark:border-emerald-900/40 dark:bg-emerald-950/30":"border-neutral-200 bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900/50"),children:[o.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Available balance"}),o.jsx("div",{className:C("mt-1 text-3xl font-bold",n?"text-emerald-700 dark:text-emerald-300":"text-neutral-400 dark:text-neutral-600"),children:ON(e.balance,e.currency)})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsx("div",{className:"text-neutral-500 dark:text-neutral-400",children:"Status"}),o.jsx("div",{className:"text-right",children:e.active?t?o.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"Expired"}):e.balance===0?o.jsx("span",{className:"text-neutral-500 dark:text-neutral-400",children:"Fully used"}):o.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"Active"}):o.jsx("span",{className:"text-red-600 dark:text-red-400",children:"Inactive"})}),e.expiresAt&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-neutral-500 dark:text-neutral-400",children:"Expires"}),o.jsx("div",{className:C("text-right",t?"text-amber-600 dark:text-amber-400":"text-neutral-900 dark:text-neutral-100"),children:MN(e.expiresAt)})]})]})]})}function ni(e){const t={};e.shippingProfile&&(t.shippingProfile=e.shippingProfile),e.checkoutRequirements&&(t.checkoutRequirements=JSON.stringify(e.checkoutRequirements)),e.fulfillment?.type&&(t.fulfillmentType=e.fulfillment.type),e.fulfillment?.notes&&(t.fulfillmentNotes=e.fulfillment.notes);const n=e.attributes?.shippingCountries;return typeof n=="string"&&n.trim()&&(t.shippingCountries=n),e.tokenizedAssetConfig&&(t.tokenizedAsset="true",e.tokenizedAssetConfig.regulatoryNotice&&(t.regulatoryNotice=e.tokenizedAssetConfig.regulatoryNotice),e.tokenizedAssetConfig.assetClass&&(t.assetClass=e.tokenizedAssetConfig.assetClass),e.tokenizedAssetConfig.backingValueCents!=null&&(t.backingValueCents=String(e.tokenizedAssetConfig.backingValueCents)),e.tokenizedAssetConfig.backingCurrency&&(t.backingCurrency=e.tokenizedAssetConfig.backingCurrency)),Object.keys(t).length?t:void 0}function LN(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"})})}const $N={shop:"/shop",category:e=>`/shop/${e}`,product:e=>`/product/${e}`,cart:"/cart",checkout:"/checkout",orders:"/account/orders",subscribe:"/subscribe"};function FN(e){const t=new Set;let n=Number.POSITIVE_INFINITY,r=0;for(const i of e){for(const l of i.tags??[])t.add(l);n=Math.min(n,i.price),r=Math.max(r,i.price)}const s=Array.from(t).slice(0,12),a=Number.isFinite(n)?{min:n,max:r}:void 0;return{tags:s,price:a}}function BN({className:e,routes:t,initialCategorySlug:n}){const{config:r}=ye(),s=St(),a=Ws(),i={...$N,...t},[l,c]=m.useState("cart"),[d,f]=m.useState(()=>typeof window>"u"?!1:window.matchMedia?.("(min-width: 1024px)")?.matches??!1);m.useEffect(()=>{if(typeof window>"u")return;const _=window.matchMedia?.("(min-width: 1024px)");if(!_)return;const B=()=>f(_.matches);return B(),_.addEventListener?.("change",B),()=>_.removeEventListener?.("change",B)},[]);const{categories:u,isLoading:g,error:h}=aa(),x=m.useMemo(()=>ca({includeCategory:!0}),[]),[p,v]=m.useState(x?.search??""),[w,y]=m.useState(n??x?.category),[k,b]=m.useState(x?.page??1),[S,A]=m.useState(x?.sort??"featured"),[I,E]=m.useState(x?.filters??{}),{data:Z,isLoading:F,error:$}=ys({category:w,search:p.trim()||void 0,filters:I,sort:S,page:k,pageSize:24}),D=m.useMemo(()=>FN(Z?.items??[]),[Z?.items]),{settings:z}=Fn(),U=z.catalog.filters,X=z.catalog.sort,R=m.useMemo(()=>{const _=[];return X.featured&&_.push({value:"featured",label:"Featured"}),X.priceAsc&&_.push({value:"price_asc",label:"Price: Low to High"}),X.priceDesc&&_.push({value:"price_desc",label:"Price: High to Low"}),_.length===0&&_.push({value:"featured",label:"Featured"}),_},[X]);m.useEffect(()=>{R.some(_=>_.value===S)||A(R[0].value)},[R,S]),da({search:p,sort:S,page:k,category:w,filters:I},{includeCategory:!0});const[V,T]=m.useState(!1),[te,ne]=m.useState(!1),[re,je]=m.useState(null),[L,K]=m.useState(!1),G=_=>{y(_.slug),b(1),T(!1)},fe=m.useCallback((_,B,le)=>{s.addItem({productId:_.id,variantId:B?.id,unitPrice:_.price,currency:_.currency,titleSnapshot:B?`${_.title} — ${B.title}`:_.title,imageSnapshot:_.images[0]?.url,paymentResource:_.id,metadata:ni(_)},le),a?.toast({title:"Added to cart",description:_.title,actionLabel:"View cart",onAction:()=>{typeof window<"u"&&(window.matchMedia?.("(min-width: 1024px)").matches?window.location.assign(i.cart):(c("cart"),ne(!0)))}})},[s,i.cart,a]);return o.jsxs("div",{className:C("min-h-screen bg-neutral-50 text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",e),children:[o.jsx("header",{className:"sticky top-0 z-40 border-b border-neutral-200 bg-neutral-50/80 backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/70",children:o.jsxs("div",{className:"mx-auto flex max-w-7xl items-center gap-3 px-4 py-3",children:[o.jsx("a",{href:i.shop,className:"text-sm font-semibold tracking-tight",children:r.brand?.name??"Shop"}),o.jsx("div",{className:"flex-1",children:o.jsx(Qa,{value:p,onChange:v})}),o.jsxs("div",{className:"flex items-center gap-2 lg:hidden",children:[o.jsxs(zs,{open:V,onOpenChange:T,children:[o.jsx(Ls,{asChild:!0,children:o.jsx(H,{type:"button",variant:"outline",children:"Filters"})}),o.jsxs(Sr,{side:"left",children:[o.jsx($s,{children:o.jsx(Fs,{children:"Browse"})}),o.jsxs("div",{className:"mt-4",children:[h?o.jsx(Rt,{description:h}):null,g?o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ce,{className:"h-9"}),o.jsx(Ce,{className:"h-9"}),o.jsx(Ce,{className:"h-9"})]}):o.jsxs("div",{className:"space-y-6",children:[o.jsx(Yo,{categories:u,activeSlug:w,onSelect:G}),o.jsx(ms,{facets:D,value:I,onChange:_=>{E(_),b(1)},onClear:()=>{E({}),b(1)},enabledFilters:U}),R.length>1&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-sm font-semibold",children:"Sort"}),o.jsxs(cs,{value:S,onValueChange:_=>{A(_),b(1)},children:[o.jsx(gr,{"aria-label":"Sort",children:o.jsx(ds,{placeholder:"Sort"})}),o.jsx(xr,{children:R.map(_=>o.jsx(vr,{value:_.value,children:_.label},_.value))})]})]})]})]})]})]}),o.jsx(yr,{open:!d&&te,onOpenChange:ne,side:"bottom",preferredTab:l,onCheckout:()=>{typeof window<"u"&&window.location.assign(i.checkout)},trigger:o.jsxs(H,{type:"button",variant:"default",onClick:()=>c("cart"),children:["Cart (",s.count,")"]})})]}),o.jsxs("div",{className:"hidden lg:flex items-center gap-2",children:[o.jsx(yr,{open:d&&te,onOpenChange:ne,side:"popup",preferredTab:l,onCheckout:()=>{typeof window<"u"&&window.location.assign(i.checkout)},trigger:o.jsxs(H,{type:"button",variant:"outline",onClick:()=>c("cart"),children:["Cart (",s.count,")"]})}),o.jsx(H,{type:"button",variant:"default",onClick:()=>{typeof window<"u"&&window.location.assign(i.checkout)},children:"Checkout"})]})]})}),o.jsxs(H,{type:"button",variant:"ghost",className:C("fixed bottom-4 right-4 z-30 hidden items-center gap-2 rounded-full border border-neutral-200 bg-white/90 px-3 py-2 text-xs font-medium text-neutral-900 shadow-sm backdrop-blur hover:bg-white dark:border-neutral-800 dark:bg-neutral-950/80 dark:text-neutral-50 dark:hover:bg-neutral-950 lg:flex",te?"lg:hidden":void 0),onClick:()=>{c("chat"),ne(!0)},"aria-label":"Open chat",children:[o.jsx(LN,{className:"h-4 w-4"}),"Chat"]}),o.jsxs("main",{className:"mx-auto grid max-w-7xl items-start gap-6 px-4 py-6 lg:grid-cols-[280px_1fr]",children:[o.jsx("aside",{className:"hidden lg:block",children:o.jsx("div",{className:"sticky top-24",children:o.jsxs(Ve,{className:"flex max-h-[calc(100vh-6rem)] flex-col rounded-2xl",children:[o.jsx(fr,{className:"pb-4",children:o.jsx(mr,{className:"text-base",children:"Browse"})}),o.jsxs(Ye,{className:"flex-1 space-y-6 overflow-y-auto pr-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-semibold",children:"Categories"}),h?o.jsx(Rt,{className:"mt-3",description:h}):null,g?o.jsxs("div",{className:"mt-3 space-y-2",children:[o.jsx(Ce,{className:"h-9"}),o.jsx(Ce,{className:"h-9"}),o.jsx(Ce,{className:"h-9"})]}):o.jsx("div",{className:"mt-3",children:o.jsx(Yo,{categories:u,activeSlug:w,onSelect:G})})]}),R.length>1&&o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-semibold",children:"Sort"}),o.jsx("div",{className:"mt-2",children:o.jsxs(cs,{value:S,onValueChange:_=>{A(_),b(1)},children:[o.jsx(gr,{"aria-label":"Sort",children:o.jsx(ds,{placeholder:"Sort"})}),o.jsx(xr,{children:R.map(_=>o.jsx(vr,{value:_.value,children:_.label},_.value))})]})})]}),o.jsx(ms,{facets:D,value:I,onChange:_=>{E(_),b(1)},onClear:()=>{E({}),b(1)},enabledFilters:U})]})]})})}),o.jsxs("section",{children:[o.jsx("div",{className:"flex items-end justify-between gap-3",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:z.shopPage.title||"Shop"}),z.shopPage.description&&o.jsx("p",{className:"mt-1 text-sm text-neutral-600 dark:text-neutral-400",children:z.shopPage.description})]})}),$?o.jsx(Rt,{className:"mt-6",description:$}):null,F?o.jsx("div",{className:"mt-6 grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:Array.from({length:8}).map((_,B)=>o.jsx(Ce,{className:"aspect-[4/5] rounded-2xl"},B))}):o.jsxs("div",{className:"mt-6",children:[o.jsx(Gs,{products:Z?.items??[],columns:r.ui?.productGrid?.columns,getProductHref:_=>i.product(_.slug),onAddToCart:_=>fe(_,null,1),onQuickView:_=>{je(_),K(!0)},layout:z.shopLayout.layout,imageCrop:z.shopLayout.imageCrop}),o.jsxs("div",{className:"mt-8 flex items-center justify-between",children:[o.jsx(H,{type:"button",variant:"outline",disabled:k<=1,onClick:()=>b(_=>Math.max(1,_-1)),children:"Previous"}),o.jsxs("div",{className:"text-xs text-neutral-600 dark:text-neutral-400",children:["Page ",k]}),o.jsx(H,{type:"button",variant:"outline",disabled:!Z?.hasNextPage,onClick:()=>b(_=>_+1),children:"Next"})]})]})]})]}),o.jsx(Ya,{product:re,open:L,onOpenChange:K,productHref:_=>i.product(_),onAddToCart:(_,B,le)=>fe(_,B,le)})]})}function UN(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"})})}function VN({categorySlug:e,className:t,routes:n}){const{config:r}=ye(),s=St(),a=Ws(),{categories:i}=aa(),[l,c]=m.useState(()=>typeof window>"u"?!1:window.matchMedia?.("(min-width: 1024px)")?.matches??!1);m.useEffect(()=>{if(typeof window>"u")return;const O=window.matchMedia?.("(min-width: 1024px)");if(!O)return;const ee=()=>c(O.matches);return ee(),O.addEventListener?.("change",ee),()=>O.removeEventListener?.("change",ee)},[]);const[d,f]=m.useState(!1),[u,g]=m.useState(!1),[h,x]=m.useState("cart"),p=m.useMemo(()=>ca({includeCategory:!1}),[]),[v,w]=m.useState(p?.search??""),[y,k]=m.useState(p?.page??1),[b,S]=m.useState(p?.sort??"featured"),[A,I]=m.useState(p?.filters??{}),[E,Z]=m.useState(null),[F,$]=m.useState(!1),D=i.find(O=>O.slug===e)??null,{data:z,isLoading:U,error:X}=ys({category:e,search:v.trim()||void 0,filters:A,sort:b,page:y,pageSize:24}),R=n?.product??(O=>`/product/${O}`),V=n?.shop??"/shop",T=n?.cart??"/cart",te=n?.checkout??"/checkout",ne=m.useMemo(()=>{const O=z?.items??[],ee=new Set;let se=Number.POSITIVE_INFINITY,pe=0;for(const Je of O){for(const Ze of Je.tags??[])ee.add(Ze);se=Math.min(se,Je.price),pe=Math.max(pe,Je.price)}const Re=Array.from(ee).slice(0,12),He=Number.isFinite(se)?{min:se,max:pe}:void 0;return{tags:Re,price:He}},[z?.items]),{settings:re}=Fn(),je=re.catalog.filters,L=re.catalog.sort,K=m.useMemo(()=>{const O=[];return L.featured&&O.push({value:"featured",label:"Featured"}),L.priceAsc&&O.push({value:"price_asc",label:"Price: Low to High"}),L.priceDesc&&O.push({value:"price_desc",label:"Price: High to Low"}),O.length===0&&O.push({value:"featured",label:"Featured"}),O},[L]);m.useEffect(()=>{K.some(O=>O.value===b)||S(K[0].value)},[K,b]),da({search:v,sort:b,page:y,filters:A},{includeCategory:!1});const G=m.useCallback((O,ee,se)=>{s.addItem({productId:O.id,variantId:ee?.id,unitPrice:O.price,currency:O.currency,titleSnapshot:ee?`${O.title} — ${ee.title}`:O.title,imageSnapshot:O.images[0]?.url,paymentResource:O.id,metadata:ni(O)},se),a?.toast({title:"Added to cart",description:O.title,actionLabel:"View cart",onAction:()=>{typeof window<"u"&&(window.matchMedia?.("(min-width: 1024px)").matches?window.location.assign(T):(x("cart"),g(!0)))}})},[s,T,a]),fe=O=>{I(O),k(1)},_=()=>{I({}),k(1)},B=O=>{S(O),k(1)},le=o.jsx(Ve,{className:"flex max-h-[calc(100vh-6rem)] flex-col rounded-2xl",children:o.jsxs(Ye,{className:"flex-1 space-y-5 overflow-y-auto pr-2 pt-6",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:text-neutral-400",children:"Category"}),o.jsx(H,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs",children:o.jsx("a",{href:V,children:"All categories"})})]}),o.jsx("div",{className:"text-base font-semibold text-neutral-950 dark:text-neutral-50",children:D?.name??e}),o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:D?.description??"Browse products in this category."})]}),K.length>1&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-sm font-semibold",children:"Sort"}),o.jsxs(cs,{value:b,onValueChange:B,children:[o.jsx(gr,{"aria-label":"Sort",children:o.jsx(ds,{placeholder:"Sort"})}),o.jsx(xr,{children:K.map(O=>o.jsx(vr,{value:O.value,children:O.label},O.value))})]})]}),o.jsx(rt,{}),o.jsx(ms,{facets:ne,value:A,onChange:fe,onClear:_,enabledFilters:je})]})});return o.jsxs("div",{className:C("min-h-screen bg-neutral-50 text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",t),children:[o.jsx("header",{className:"sticky top-0 z-40 border-b border-neutral-200 bg-neutral-50/80 backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/70",children:o.jsxs("div",{className:"mx-auto flex max-w-7xl items-center gap-3 px-4 py-3",children:[o.jsx("a",{href:V,className:"text-sm font-semibold tracking-tight",children:r.brand?.name??"Shop"}),o.jsx("div",{className:"flex-1",children:o.jsx(Qa,{value:v,onChange:w})}),o.jsxs("div",{className:"flex items-center gap-2 lg:hidden",children:[o.jsxs(zs,{open:d,onOpenChange:f,children:[o.jsx(Ls,{asChild:!0,children:o.jsx(H,{type:"button",variant:"outline",children:"Filters"})}),o.jsxs(Sr,{side:"left",children:[o.jsx($s,{children:o.jsx(Fs,{children:"Filters"})}),o.jsx("div",{className:"mt-4",children:le})]})]}),o.jsx(yr,{open:!l&&u,onOpenChange:g,side:"bottom",preferredTab:h,onCheckout:()=>{typeof window<"u"&&window.location.assign(te)},trigger:o.jsxs(H,{type:"button",variant:"default",onClick:()=>x("cart"),children:["Cart (",s.count,")"]})})]}),o.jsxs("div",{className:"hidden lg:flex items-center gap-2",children:[o.jsx(yr,{open:l&&u,onOpenChange:g,side:"popup",preferredTab:h,onCheckout:()=>{typeof window<"u"&&window.location.assign(te)},trigger:o.jsxs(H,{type:"button",variant:"outline",onClick:()=>x("cart"),children:["Cart (",s.count,")"]})}),o.jsx(H,{type:"button",variant:"default",onClick:()=>{typeof window<"u"&&window.location.assign(te)},children:"Checkout"})]})]})}),o.jsxs(H,{type:"button",variant:"ghost",className:C("fixed bottom-4 right-4 z-30 hidden items-center gap-2 rounded-full border border-neutral-200 bg-white/90 px-3 py-2 text-xs font-medium text-neutral-900 shadow-sm backdrop-blur hover:bg-white dark:border-neutral-800 dark:bg-neutral-950/80 dark:text-neutral-50 dark:hover:bg-neutral-950 lg:flex",u?"lg:hidden":void 0),onClick:()=>{x("chat"),g(!0)},"aria-label":"Open chat",children:[o.jsx(UN,{className:"h-4 w-4"}),"Chat"]}),o.jsxs("main",{className:"mx-auto max-w-7xl px-4 py-8",children:[o.jsx(Ka,{items:[{label:"Shop",href:V},{label:D?.name??e}]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:D?.name??"Category"}),o.jsx("p",{className:"mt-1 text-sm text-neutral-600 dark:text-neutral-400",children:D?.description??"Browse products in this category."})]}),X?o.jsx(Rt,{className:"mt-6",description:X}):null,o.jsxs("div",{className:"mt-6 grid gap-6 lg:grid-cols-[280px_1fr]",children:[o.jsx("aside",{className:"hidden lg:block",children:o.jsx("div",{className:"sticky top-24",children:le})}),o.jsx("div",{children:U?o.jsx("div",{className:"mt-6 grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:Array.from({length:8}).map((O,ee)=>o.jsx(Ce,{className:"aspect-[4/5] rounded-2xl"},ee))}):o.jsxs("div",{className:"mt-6",children:[o.jsx(Gs,{products:z?.items??[],columns:r.ui?.productGrid?.columns,getProductHref:O=>R(O.slug),onAddToCart:O=>G(O,null,1),onQuickView:O=>{Z(O),$(!0)},layout:re.categoryLayout.layout,imageCrop:re.categoryLayout.imageCrop}),o.jsxs("div",{className:"mt-8 flex items-center justify-between",children:[o.jsx(H,{type:"button",variant:"outline",disabled:y<=1,onClick:()=>k(O=>Math.max(1,O-1)),children:"Previous"}),o.jsxs("div",{className:"text-xs text-neutral-600 dark:text-neutral-400",children:["Page ",y]}),o.jsx(H,{type:"button",variant:"outline",disabled:!z?.hasNextPage,onClick:()=>k(O=>O+1),children:"Next"})]})]})})]}),o.jsx(Ya,{product:E,open:F,onOpenChange:$,productHref:O=>R(O),onAddToCart:(O,ee,se)=>G(O,ee,se)})]})]})}function HN(e){return!e||typeof e!="string"?[]:e.split(",").map(t=>t.trim()).filter(Boolean)}function ZN({config:e,currency:t}){return o.jsxs("div",{className:"mt-4 rounded-xl border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-800 dark:bg-neutral-900/40",children:[o.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Tokenized Asset"}),o.jsxs("div",{className:"mt-2 space-y-1.5 text-sm text-neutral-700 dark:text-neutral-300",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Backing value"}),o.jsx("span",{className:"font-medium text-neutral-950 dark:text-neutral-50",children:Te({amount:e.backingValueCents/100,currency:e.backingCurrency||t})})]}),e.assetIdentifier?o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Asset ID"}),o.jsx("span",{className:"font-mono text-xs text-neutral-950 dark:text-neutral-50",children:e.assetIdentifier})]}):null,e.tokensPerUnit>1?o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Tokens per unit"}),o.jsx("span",{className:"font-medium text-neutral-950 dark:text-neutral-50",children:e.tokensPerUnit})]}):null,Ue.safeHref(e.custodyProofUrl)?o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Custody proof"}),o.jsx("a",{href:Ue.safeHref(e.custodyProofUrl),target:"_blank",rel:"noreferrer",className:"text-xs font-medium underline underline-offset-2",children:"View document"})]}):null,e.nftMintAddress?o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"On-chain token"}),o.jsxs("a",{href:`https://solscan.io/account/${e.nftMintAddress}`,target:"_blank",rel:"noreferrer",className:"font-mono text-xs font-medium underline underline-offset-2",children:[e.nftMintAddress.slice(0,4),"...",e.nftMintAddress.slice(-4)]})]}):null]}),e.regulatoryNotice?o.jsx("div",{className:"mt-3 rounded-lg border border-amber-200 bg-amber-50 p-3 text-xs text-amber-900 dark:border-amber-900/40 dark:bg-amber-950/30 dark:text-amber-200",children:e.regulatoryNotice}):null]})}function WN({slug:e,className:t,routes:n}){const r=St(),s=Ws(),{product:a,isLoading:i,error:l}=wc(e),[c,d]=m.useState(1),[f,u]=m.useState({selectedOptions:{},variant:null});m.useEffect(()=>{if(!a||!a.variants?.length)return;const U=a.variants[0];u({selectedOptions:{...U.options},variant:U})},[a?.id]);const{settings:g}=Fn(),{mode:h,maxItems:x}=g.relatedProducts,p=_c({productId:a?.id,enabled:h==="ai"&&!!a?.id}),v=m.useMemo(()=>h==="by_category"&&a?.categoryIds?.length?{category:a.categoryIds[0],page:1,pageSize:x+1}:{page:1,pageSize:x+4},[h,x,a?.categoryIds]),w=ys(v),y=m.useMemo(()=>{const X=(w.data?.items??[]).filter(R=>R.slug!==e);if(h==="manual"&&a){const R=a.attributes?.relatedProductIds||a.attributes?.related_product_ids;if(R){const V=HN(String(R));if(V.length>0){const T=new Map(X.map(ne=>[ne.id,ne]));return V.map(ne=>T.get(ne)).filter(ne=>!!ne).slice(0,x)}}}if(h==="ai"&&p.relatedProductIds&&p.relatedProductIds.length>0){const R=new Map(X.map(T=>[T.id,T])),V=p.relatedProductIds.map(T=>R.get(T)).filter(T=>!!T);if(V.length>0)return V.slice(0,x)}return X.slice(0,x)},[w.data?.items,e,h,x,a,p.relatedProductIds]),k=n?.shop??"/shop",b=n?.checkout??"/checkout",S=n?.cart??"/cart",A=n?.product??(U=>`/product/${U}`);if(i)return o.jsx("div",{className:C("min-h-screen bg-neutral-50 p-6 dark:bg-neutral-950",t),children:o.jsxs("div",{className:"mx-auto max-w-6xl",children:[o.jsx(Ce,{className:"h-5 w-40"}),o.jsxs("div",{className:"mt-6 grid gap-8 lg:grid-cols-2",children:[o.jsx(Ce,{className:"aspect-square rounded-2xl"}),o.jsxs("div",{className:"space-y-4",children:[o.jsx(Ce,{className:"h-8 w-2/3"}),o.jsx(Ce,{className:"h-6 w-32"}),o.jsx(Ce,{className:"h-20"}),o.jsx(Ce,{className:"h-11"})]})]})]})});if(l)return o.jsx("div",{className:C("min-h-screen bg-neutral-50 p-6 dark:bg-neutral-950",t),children:o.jsx("div",{className:"mx-auto max-w-6xl",children:o.jsx(Rt,{description:l})})});if(!a)return o.jsx("div",{className:C("min-h-screen bg-neutral-50 p-6 dark:bg-neutral-950",t),children:o.jsx("div",{className:"mx-auto max-w-6xl",children:o.jsx(Rt,{description:"Product not found."})})});const I=f.variant?.price??a.price,E=f.variant?.compareAtPrice??a.compareAtPrice,Z=f.variant?.inventoryStatus==="out_of_stock"||typeof f.variant?.inventoryQuantity=="number"&&f.variant.inventoryQuantity<=0,F=a.inventoryStatus==="out_of_stock"||typeof a.inventoryQuantity=="number"&&a.inventoryQuantity<=0,$=f.variant?Z:F,D=()=>{$||(r.addItem({productId:a.id,variantId:f.variant?.id,unitPrice:I,currency:a.currency,titleSnapshot:f.variant?`${a.title} — ${f.variant.title}`:a.title,imageSnapshot:a.images[0]?.url,paymentResource:a.id,metadata:ni(a)},c),s?.toast({title:"Added to cart",description:a.title,actionLabel:"View cart",onAction:()=>{typeof window<"u"&&window.location.assign(S)}}))},z=()=>{$||(D(),typeof window<"u"&&window.location.assign(b))};return o.jsx("div",{className:C("min-h-screen bg-neutral-50 text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",t),children:o.jsxs("main",{className:"mx-auto max-w-6xl px-4 py-8",children:[o.jsx(Ka,{items:[{label:"Shop",href:k},{label:a.title}]}),o.jsxs("div",{className:"mt-6 grid gap-10 lg:grid-cols-2",children:[o.jsx(Wa,{images:a.images}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:a.title}),a.tokenizedAssetConfig?.assetClass?o.jsx(Za,{assetClass:a.tokenizedAssetConfig.assetClass}):null]}),o.jsx("div",{className:"mt-3",children:o.jsx(qs,{amount:I,currency:a.currency,compareAt:E})}),$?o.jsx("div",{className:"mt-2 text-sm font-medium text-red-700 dark:text-red-300",children:"Out of stock"}):typeof a.inventoryQuantity=="number"&&a.inventoryQuantity>0&&a.inventoryQuantity<=5?o.jsxs("div",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:["Only ",o.jsx("span",{className:"font-semibold text-neutral-950 dark:text-neutral-50",children:a.inventoryQuantity})," left"]}):null,o.jsx("p",{className:"mt-4 text-sm text-neutral-600 dark:text-neutral-400",children:a.description}),a.tokenizedAssetConfig?o.jsx(ZN,{config:a.tokenizedAssetConfig,currency:a.currency}):null]}),o.jsx(qa,{product:a,value:{selectedOptions:f.selectedOptions,variantId:f.variant?.id},onChange:U=>u(U)}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsx(Ga,{qty:c,onChange:d}),o.jsx(H,{type:"button",onClick:D,className:"flex-1",disabled:$,children:$?"Out of stock":"Add to cart"}),o.jsx(H,{type:"button",variant:"outline",onClick:z,disabled:$,children:"Buy now"})]}),(g.sections.showDescription||g.sections.showSpecs||g.sections.showShipping)&&o.jsxs(qu,{type:"single",collapsible:!0,defaultValue:g.sections.showDescription?"desc":void 0,children:[g.sections.showDescription&&o.jsxs(ir,{value:"desc",children:[o.jsx(lr,{children:"Description"}),o.jsx(cr,{children:o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:a.description})})]}),g.sections.showSpecs&&o.jsxs(ir,{value:"specs",children:[o.jsx(lr,{children:"Specs"}),o.jsx(cr,{children:o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:a.attributes?o.jsx("div",{className:"space-y-1",children:Object.entries(a.attributes).map(([U,X])=>o.jsxs("div",{children:[o.jsxs("span",{className:"font-medium text-neutral-950 dark:text-neutral-50",children:[U,":"]})," ",String(X)]},U))}):"No specs provided."})})]}),g.sections.showShipping&&o.jsxs(ir,{value:"ship",children:[o.jsx(lr,{children:"Shipping & returns"}),o.jsx(cr,{children:o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Ships in 2–3 business days. Easy returns within 30 days."})})]})]})]})]}),g.sections.showRelatedProducts&&y.length?o.jsxs("section",{className:"mt-12",children:[o.jsx("h2",{className:"text-lg font-semibold",children:"Related products"}),o.jsx("div",{className:"mt-4",children:o.jsx(Gs,{products:y,columns:{base:2,md:4,lg:4},layout:g.relatedProducts.layout.layout,imageCrop:g.relatedProducts.layout.imageCrop,getProductHref:U=>A(U.slug),onAddToCart:U=>r.addItem({productId:U.id,unitPrice:U.price,currency:U.currency,titleSnapshot:U.title,imageSnapshot:U.images[0]?.url,paymentResource:U.id},1)})})]}):null]})})}function qN({className:e,checkoutHref:t}){const{config:n}=ye(),{settings:r}=Fn(),s=t??"/checkout",a=n.checkout.allowPromoCodes&&r.checkout.promoCodes;return o.jsx("div",{className:C("min-h-screen bg-neutral-50 text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",e),children:o.jsxs("main",{className:"mx-auto max-w-6xl px-4 py-10",children:[o.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Cart"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:"Review items, adjust quantities, then check out."}),o.jsx("div",{className:"mt-8",children:o.jsx(jf,{onCheckout:()=>{typeof window<"u"&&window.location.assign(s)},showPromoCode:a})})]})})}function GN({className:e,routes:t}){const{config:n}=ye(),r=St(),s=la(),a=n.customer?.isSignedIn??!!n.customer?.id,l=!(n.checkout.requireAccount?!1:n.checkout.guestCheckout??!0)&&!a;m.useEffect(()=>{s.kind==="success"&&r.clear()},[s.kind]);const c=t?.shop??"/shop",d=t?.orders??"/account/orders",f=t?.login;return o.jsx("div",{className:C("min-h-screen bg-neutral-50 text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",e),children:o.jsxs("main",{className:"mx-auto max-w-6xl px-4 py-10",children:[o.jsx(Ks,{result:s,onContinueShopping:()=>{typeof window<"u"&&window.location.assign(c)},onViewOrders:()=>{typeof window<"u"&&window.location.assign(d)}}),s.kind==="idle"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Checkout"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:n.checkout.mode==="none"?"Confirm and pay.":"Enter details, then complete payment."})]}),o.jsx("div",{className:"mt-8",children:o.jsx(yc,{children:l?o.jsxs(Ve,{className:"rounded-2xl",children:[o.jsx(fr,{className:"pb-4",children:o.jsx(mr,{className:"text-base",children:"Sign in required"})}),o.jsxs(Ye,{children:[o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"This store requires an account to complete checkout."}),f?o.jsx("div",{className:"mt-4",children:o.jsx(H,{type:"button",onClick:()=>{typeof window<"u"&&window.location.assign(f)},children:"Sign in"})}):null]})]}):o.jsx(Cf,{left:o.jsxs("div",{className:"space-y-6",children:[o.jsx(Af,{}),o.jsxs(Ve,{className:"rounded-2xl",children:[o.jsx(fr,{className:"pb-4",children:o.jsx(mr,{className:"text-base",children:"Payment"})}),o.jsxs(Ye,{children:[o.jsx(rt,{className:"mb-4"}),o.jsx(Tf,{})]})]})]}),right:o.jsx("div",{className:"lg:sticky lg:top-24",children:o.jsx(Pf,{})})})})})]}):null]})})}function YN({className:e,isSignedIn:t=!0,onLogin:n,serverUrl:r,authToken:s}){const{orders:a,isLoading:i,error:l}=kc(),[c,d]=m.useState(null);return t?o.jsx("div",{className:C("min-h-screen bg-neutral-50 text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",e),children:o.jsxs("main",{className:"mx-auto max-w-5xl px-4 py-10 sm:py-12",children:[o.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Orders"}),o.jsx("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-400",children:"View past purchases and receipts."})]}),!i&&!l&&!c&&a.length>0?o.jsxs("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:[a.length," order",a.length===1?"":"s"]}):null]}),l?o.jsx(Rt,{className:"mt-8",description:l}):null,i?o.jsxs("div",{className:"mt-8 grid gap-4",children:[o.jsx(Ce,{className:"h-32 rounded-2xl"}),o.jsx(Ce,{className:"h-32 rounded-2xl"}),o.jsx(Ce,{className:"h-32 rounded-2xl"})]}):a.length===0?o.jsx("div",{className:"mt-8",children:o.jsx(Ln,{title:"No orders yet",description:"When you purchase something, it will show up here."})}):c?o.jsx("div",{className:"mt-8",children:o.jsx(Mf,{order:c,onBack:()=>d(null),serverUrl:r,authToken:s})}):o.jsx("div",{className:"mt-8",children:o.jsx(Of,{orders:a,onView:d})})]})}):o.jsx("div",{className:C("min-h-screen bg-neutral-50 p-10 dark:bg-neutral-950",e),children:o.jsx("div",{className:"mx-auto max-w-4xl",children:o.jsx(Ln,{title:"Sign in to view your orders",description:"Your purchase history will appear here once you're logged in.",actionLabel:n?"Sign in":void 0,onAction:n})})})}function KN({className:e}){return o.jsxs("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),o.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),o.jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function QN({className:e}){return o.jsx("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m15 18-6-6 6-6"})})}function JN(e){switch(e){case"x402":return"Crypto (x402)";case"credits":return"Credits";case"stripe":return"Card";default:return"Payment"}}function XN({order:e,source:t,purchaseId:n,customerEmail:r,customerName:s,className:a,onBack:i}){const{config:l}=ye(),c=t??e.source,d=n??e.purchaseId,f=r??e.customerEmail,u=s??e.customerName,g=l.brand?.name??"Store",h=l.brand?.logoUrl,x=()=>{typeof window<"u"&&window.print()},p=new Date(e.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),v=new Date(e.createdAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return o.jsxs("div",{className:C("min-h-screen bg-neutral-100 dark:bg-neutral-900 print:bg-white print:dark:bg-white",a),children:[o.jsx("div",{className:"border-b border-neutral-200 bg-white px-4 py-3 dark:border-neutral-800 dark:bg-neutral-950 print:hidden",children:o.jsxs("div",{className:"mx-auto flex max-w-2xl items-center justify-between",children:[i?o.jsxs(H,{type:"button",variant:"ghost",size:"sm",onClick:i,children:[o.jsx(QN,{className:"mr-1"})," Back"]}):o.jsx("div",{}),o.jsxs(H,{type:"button",variant:"outline",size:"sm",onClick:x,children:[o.jsx(KN,{className:"mr-2"})," Print Receipt"]})]})}),o.jsx("div",{className:"mx-auto max-w-2xl px-4 py-8 print:max-w-none print:px-0 print:py-0",children:o.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-950 print:border-0 print:shadow-none print:dark:bg-white print:dark:text-neutral-950",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-neutral-200 pb-6 dark:border-neutral-800 print:dark:border-neutral-200",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[h?o.jsx("img",{src:h,alt:g,className:"h-10 w-10 rounded-lg object-contain"}):null,o.jsx("div",{className:"text-xl font-semibold",children:g})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Receipt"}),o.jsx("div",{className:"mt-1 font-mono text-sm",children:e.id})]})]}),o.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-4 text-sm sm:grid-cols-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Date"}),o.jsx("div",{className:"mt-1 font-medium",children:p}),o.jsx("div",{className:"text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:v})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Payment Method"}),o.jsx("div",{className:"mt-1 font-medium",children:JN(c)})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Status"}),o.jsx("div",{className:"mt-1",children:o.jsx(dt,{variant:"outline",className:"capitalize print:border-neutral-300",children:e.status})})]})]}),(u||f)&&o.jsxs("div",{className:"mt-6 border-t border-neutral-200 pt-6 dark:border-neutral-800 print:dark:border-neutral-200",children:[o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Customer"}),u&&o.jsx("div",{className:"mt-1 font-medium",children:u}),f&&o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:f})]}),o.jsx("div",{className:"mt-6 border-t border-neutral-200 pt-6 dark:border-neutral-800 print:dark:border-neutral-200",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-neutral-200 dark:border-neutral-800 print:dark:border-neutral-200",children:[o.jsx("th",{className:"pb-3 text-left font-medium text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Item"}),o.jsx("th",{className:"pb-3 text-center font-medium text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Qty"}),o.jsx("th",{className:"pb-3 text-right font-medium text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Price"})]})}),o.jsx("tbody",{children:e.items.map((w,y)=>o.jsxs("tr",{className:"border-b border-neutral-100 dark:border-neutral-800/50 print:dark:border-neutral-100",children:[o.jsx("td",{className:"py-3",children:o.jsx("div",{className:"font-medium",children:w.title})}),o.jsx("td",{className:"py-3 text-center text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:w.qty}),o.jsx("td",{className:"py-3 text-right",children:Te({amount:w.unitPrice*w.qty,currency:w.currency})})]},`${w.title}-${y}`))})]})}),o.jsxs("div",{className:"mt-4 flex flex-col items-end gap-2 text-sm",children:[o.jsxs("div",{className:"flex w-48 justify-between",children:[o.jsx("span",{className:"text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Subtotal"}),o.jsx("span",{children:Te({amount:e.total,currency:e.currency})})]}),o.jsxs("div",{className:"flex w-48 justify-between border-t border-neutral-200 pt-2 text-base font-semibold dark:border-neutral-800 print:dark:border-neutral-200",children:[o.jsx("span",{children:"Total"}),o.jsx("span",{children:Te({amount:e.total,currency:e.currency})})]})]}),d&&o.jsxs("div",{className:"mt-6 border-t border-neutral-200 pt-6 dark:border-neutral-800 print:dark:border-neutral-200",children:[o.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400 print:dark:text-neutral-600",children:"Transaction ID"}),o.jsx("div",{className:"mt-1 break-all font-mono text-xs",children:d})]}),o.jsxs("div",{className:"mt-8 border-t border-neutral-200 pt-6 text-center text-xs text-neutral-500 dark:border-neutral-800 dark:text-neutral-400 print:dark:border-neutral-200 print:dark:text-neutral-500",children:[o.jsx("p",{children:"Thank you for your purchase!"}),o.jsx("p",{className:"mt-1",children:"If you have any questions, please contact support."})]})]})})]})}function ej({className:e}){return o.jsx("svg",{className:C("h-4 w-4 flex-shrink-0",e),viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}function tj({className:e,title:t="Choose Your Plan",subtitle:n="Select the plan that best fits your needs.",annualSavingsBadge:r="2 months free",popularBadgeText:s="Best Deal",footerNotice:a}){const{config:i}=ye(),{tiers:l,status:c,isLoading:d,error:f}=Sc(),[u,g]=m.useState("monthly"),h=!!i.adapter.createSubscriptionCheckoutSession,x=async p=>{if(!i.adapter.createSubscriptionCheckoutSession)return;const v=await i.adapter.createSubscriptionCheckoutSession({tierId:p,interval:u,successUrl:i.checkout.successUrl,cancelUrl:i.checkout.cancelUrl});v.kind==="redirect"&&typeof window<"u"&&window.location.assign(v.url)};return o.jsx("div",{className:C("min-h-screen bg-neutral-50 text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",e),children:o.jsxs("main",{className:"mx-auto max-w-6xl px-4 py-16",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("h1",{className:"text-5xl font-bold tracking-tight",children:t}),o.jsx("p",{className:"mt-4 text-base text-neutral-600 dark:text-neutral-400",children:n})]}),o.jsx("div",{className:"mt-10 flex justify-center",children:o.jsxs("div",{className:"inline-flex items-center rounded-full bg-neutral-200/60 p-1 dark:bg-neutral-800/60",children:[o.jsxs("button",{type:"button",onClick:()=>g("annual"),className:C("relative flex items-center gap-2 rounded-full px-4 py-2 text-sm font-medium transition-all",u==="annual"?"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900":"text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-white"),children:["Yearly",r&&o.jsx("span",{className:C("rounded-full px-2 py-0.5 text-xs font-medium",u==="annual"?"bg-white/20 text-white dark:bg-neutral-900/20 dark:text-neutral-900":"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900"),children:r})]}),o.jsx("button",{type:"button",onClick:()=>g("monthly"),className:C("rounded-full px-4 py-2 text-sm font-medium transition-all",u==="monthly"?"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900":"text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-white"),children:"Monthly"})]})}),f?o.jsx(Rt,{className:"mt-10",description:f}):null,d?o.jsxs("div",{className:"mt-12 grid gap-6 md:grid-cols-3",children:[o.jsx(Ce,{className:"h-[480px] rounded-2xl"}),o.jsx(Ce,{className:"h-[480px] rounded-2xl"}),o.jsx(Ce,{className:"h-[480px] rounded-2xl"})]}):l.length===0?o.jsx("div",{className:"mt-12",children:o.jsx(Ln,{title:"No plans available",description:"Subscription plans will appear here once configured."})}):o.jsx("div",{className:"mt-12 grid gap-6 md:grid-cols-3 items-start",children:l.map(p=>{const v=c?.isActive&&c.currentTierId===p.id,w=u==="annual"&&p.priceAnnual?p.priceAnnual:p.priceMonthly,y=p.isPopular,k=p.inventoryQuantity!=null,b=k?Math.max(0,(p.inventoryQuantity??0)-(p.inventorySold??0)):null,S=k&&b===0,A=k&&b!=null&&b>0&&b<=5,[I,...E]=p.features;return o.jsxs("div",{className:C("relative flex flex-col rounded-2xl border p-6 transition-shadow",y?"border-neutral-900 bg-neutral-900 text-white shadow-xl dark:border-white dark:bg-white dark:text-neutral-900":"border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900"),children:[y&&s&&o.jsx("div",{className:"absolute -top-3 right-4",children:o.jsx("span",{className:"rounded-full bg-neutral-100 px-3 py-1 text-xs font-semibold text-neutral-900 shadow-sm dark:bg-neutral-800 dark:text-white",children:s})}),o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-xl font-bold",children:p.title}),p.description&&o.jsx("p",{className:C("mt-2 text-sm leading-relaxed",y?"text-neutral-300 dark:text-neutral-600":"text-neutral-600 dark:text-neutral-400"),children:p.description})]}),o.jsxs("div",{className:"mb-6",children:[o.jsx("div",{className:"text-5xl font-bold tracking-tight",children:Te({amount:w,currency:p.currency||i.currency})}),o.jsxs("div",{className:C("mt-2 text-sm",y?"text-neutral-400 dark:text-neutral-500":"text-neutral-500 dark:text-neutral-400"),children:["Per ",u==="annual"?"year":"month",", billed ",u==="annual"?"annually":"monthly"]})]}),k&&o.jsx("div",{className:C("mb-3 text-xs font-medium",S?"text-red-600 dark:text-red-400":A?y?"text-amber-300 dark:text-amber-600":"text-amber-600 dark:text-amber-400":y?"text-neutral-400 dark:text-neutral-500":"text-neutral-500 dark:text-neutral-400"),children:S?"Sold out":`${b} remaining`}),o.jsx(H,{type:"button",className:C("mb-6 w-full rounded-full py-3 font-medium",y?"bg-white text-neutral-900 hover:bg-neutral-100 dark:bg-neutral-900 dark:text-white dark:hover:bg-neutral-800":""),variant:y?"default":"outline",disabled:v||!h||S,onClick:()=>void x(p.id),children:S?"Sold Out":v?"Current Plan":"Purchase"}),I&&o.jsx("div",{className:C("mb-4 text-sm font-semibold",y?"":"text-neutral-900 dark:text-white"),children:I}),E.length>0&&o.jsx("ul",{className:"space-y-3",children:E.map((Z,F)=>o.jsxs("li",{className:"flex items-start gap-3",children:[o.jsx(ej,{className:C("mt-0.5",y?"text-neutral-400 dark:text-neutral-500":"text-neutral-500 dark:text-neutral-400")}),o.jsx("span",{className:C("text-sm leading-relaxed",y?"text-neutral-300 dark:text-neutral-600":"text-neutral-600 dark:text-neutral-400"),children:Z})]},F))})]},p.id)})}),a&&o.jsx("div",{className:"mt-12 text-center",children:o.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400 leading-relaxed max-w-2xl mx-auto",children:a})})]})})}function nj(e){const{processCartCheckout:t}=zf.useStripeCheckout();return m.useMemo(()=>({...e,async createCheckoutSession(n){const{customer:r,options:s}=n,a=r.shippingAddress?r.shippingAddress:void 0,i=r.billingAddress?r.billingAddress:void 0,l=await t(n.cart,s.successUrl,s.cancelUrl,s.metadata,r.email,s.discountCode,r.name,r.phone,a,i,s.tipAmount,s.shippingMethodId,s.paymentMethodId);if(!l.success)throw new Error(l.error||"Checkout failed");return{kind:"redirect",url:n.options.successUrl??"/"}},async resolveCheckoutReturn({query:n}){return ia(n)}}),[e,t])}const rj=Object.freeze(Object.defineProperty({__proto__:null,Accordion:qu,AccordionContent:cr,AccordionItem:ir,AccordionTrigger:lr,AddressForm:Ko,AssetBadge:Za,Badge:dt,Breadcrumbs:Ka,Button:H,Card:Ve,CardContent:Ye,CardDescription:Hc,CardFooter:Zc,CardHeader:fr,CardTitle:mr,CartLineItem:Ja,CartPageContent:jf,CartPanel:kf,CartProvider:um,CartSidebar:yr,CartSummary:Xa,CartTemplate:qN,CategoryNav:Yo,CategoryTemplate:VN,CedrosShopProvider:Ff,CheckoutCancelPage:pN,CheckoutForm:Af,CheckoutLayout:Cf,CheckoutProvider:yc,CheckoutReceipt:Ks,CheckoutSuccessPage:mN,CheckoutTemplate:GN,Dialog:Ta,DialogClose:gk,DialogContent:Ms,DialogDescription:Oa,DialogFooter:Nu,DialogHeader:Ra,DialogOverlay:Pa,DialogPortal:Su,DialogTitle:Ds,DialogTrigger:hk,EmptyState:Ln,ErrorBoundary:Kk,ErrorState:Rt,FAQItem:bf,FAQList:GS,FEATURE_FLAG_NAMES:pt.FEATURE_FLAG_NAMES,FEATURE_FLAG_REGISTRY:pt.FEATURE_FLAG_REGISTRY,FilterPanel:ms,GiftCardBalanceChecker:DN,GiftCardRedemptionPage:CN,Input:ke,InventoryVerificationDialog:If,Label:De,MyRedemptionsPage:kN,MyTokensPage:jN,OrderCard:Rf,OrderDetails:Mf,OrderList:Of,OrderReview:Pf,PaymentStep:Tf,Price:qs,ProductCard:yf,ProductGallery:Wa,ProductGrid:Gs,ProductTemplate:WN,PromoCodeInput:ei,PurchaseHistoryTemplate:YN,QuantitySelector:Ga,QuickViewDialog:Ya,ReceiptTemplate:XN,RedemptionForm:Ys,SearchInput:Qa,Select:cs,SelectContent:xr,SelectGroup:Kw,SelectItem:vr,SelectTrigger:gr,SelectValue:ds,SendAsGiftSection:_f,Separator:rt,Sheet:zs,SheetClose:ju,SheetContent:Sr,SheetDescription:_u,SheetHeader:$s,SheetOverlay:Ma,SheetPortal:Cu,SheetTitle:Fs,SheetTrigger:Ls,ShippingMethodSelector:Ef,ShopChatPanel:Nf,ShopTemplate:BN,Skeleton:Ce,SubscriptionTemplate:tj,Tabs:Va,TabsContent:pf,TabsList:Zs,TabsTrigger:br,ToastProvider:CS,TokenDisplay:ti,VariantSelector:qa,createMockCommerceAdapter:Zf,createPaywallCommerceAdapter:rm,getFeatureFlagDefinition:pt.getFeatureFlagDefinition,getFeatureFlagDefinitions:pt.getFeatureFlagDefinitions,isFeatureEnabled:pt.isFeatureEnabled,parseCheckoutReturn:ia,parseFeatureFlagBoolean:pt.parseFeatureFlagBoolean,readCatalogUrlState:ca,resolveFeatureFlags:pt.resolveFeatureFlags,useAIRelatedProducts:_c,useCart:St,useCartInventory:ua,useCatalogUrlSync:da,useCategories:aa,useCedrosPayCheckoutAdapter:nj,useCedrosShop:ye,useCheckout:wr,useCheckoutResultFromUrl:la,useHoldExpiry:c0,useInventoryVerification:jc,useOptionalToast:Ws,useOrders:kc,usePaymentMethodsConfig:Cc,useProduct:wc,useProducts:ys,useShippingMethods:Nc,useStandaloneCheckout:Jx,useStorefrontSettings:Fn,useSubscriptionData:Sc,useToast:jS,validateCommerceAdapterContract:p0},Symbol.toStringTag,{value:"Module"}));exports.ComplianceGatePage=Lf;exports.CreditsBalance=$f;exports.index=rj;exports.useComplianceCheck=zl;exports.useCreditsBalance=Ll;
|